Skip to content

Commit 86d300b

Browse files
committed
Add history.clearContext and Tool.isTerminal
Regenerates the RPC client for the new `session.history.clearContext` method and surfaces `isTerminal` on the tool definition so an SDK or extension tool whose purpose is to end the turn can halt the agent loop instead of faking it with a rejected result.
1 parent 40ae242 commit 86d300b

3 files changed

Lines changed: 49 additions & 0 deletions

File tree

nodejs/src/client.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1391,6 +1391,7 @@ export class CopilotClient {
13911391
overridesBuiltInTool: tool.overridesBuiltInTool,
13921392
skipPermission: tool.skipPermission,
13931393
defer: tool.defer,
1394+
isTerminal: tool.isTerminal,
13941395
})),
13951396
canvases: config.canvases?.map((canvas) => canvas.declaration),
13961397
requestCanvasRenderer: config.requestCanvasRenderer,
@@ -1591,6 +1592,7 @@ export class CopilotClient {
15911592
overridesBuiltInTool: tool.overridesBuiltInTool,
15921593
skipPermission: tool.skipPermission,
15931594
defer: tool.defer,
1595+
isTerminal: tool.isTerminal,
15941596
})),
15951597
canvases: config.canvases?.map((canvas) => canvas.declaration),
15961598
requestCanvasRenderer: config.requestCanvasRenderer,

nodejs/src/generated/rpc.ts

Lines changed: 35 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

nodejs/src/types.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -560,6 +560,17 @@ export interface Tool<TArgs = unknown> {
560560
* Optional; defaults to `"auto"`.
561561
*/
562562
defer?: "auto" | "never";
563+
/**
564+
* When true, a successful call to this tool ends the agent turn: the runtime's
565+
* tool phase halts instead of feeding the tool result back to the model for
566+
* another round. A failed call (for example input validation) leaves the loop
567+
* running so the model can read the error and retry.
568+
*
569+
* Use this for tools whose whole purpose is to terminate the turn, such as a
570+
* context clear that replaces the conversation the model would otherwise
571+
* continue from.
572+
*/
573+
isTerminal?: boolean;
563574
}
564575

565576
/**
@@ -575,6 +586,7 @@ export function defineTool<T = unknown>(
575586
overridesBuiltInTool?: boolean;
576587
skipPermission?: boolean;
577588
defer?: "auto" | "never";
589+
isTerminal?: boolean;
578590
}
579591
): Tool<T> {
580592
return { name, ...config };

0 commit comments

Comments
 (0)