Skip to content

Commit b64ebea

Browse files
authored
Merge branch 'main' into blove/remove-cockpit-secret-placeholder
2 parents 2a68e95 + 5ab848f commit b64ebea

82 files changed

Lines changed: 5313 additions & 398 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

apps/website/content/docs/chat/api/api-docs.json

Lines changed: 255 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1821,6 +1821,12 @@
18211821
"description": "",
18221822
"optional": false
18231823
},
1824+
{
1825+
"name": "clientToolExecutionGuard",
1826+
"type": "InputSignal<ClientToolExecutionGuard | undefined>",
1827+
"description": "",
1828+
"optional": false
1829+
},
18241830
{
18251831
"name": "clientTools",
18261832
"type": "InputSignal<Readonly<Record<string, ClientToolDef>> | undefined>",
@@ -6305,10 +6311,16 @@
63056311
},
63066312
{
63076313
"name": "handler",
6308-
"type": "(args: any) => unknown",
6314+
"type": "(args: any, context: FunctionToolHandlerContext) => unknown",
63096315
"description": "",
63106316
"optional": false
63116317
},
6318+
{
6319+
"name": "idempotent",
6320+
"type": "boolean",
6321+
"description": "",
6322+
"optional": true
6323+
},
63126324
{
63136325
"name": "kind",
63146326
"type": "\"function\"",
@@ -6688,6 +6700,134 @@
66886700
],
66896701
"examples": []
66906702
},
6703+
{
6704+
"name": "ClientToolExecutionGuard",
6705+
"kind": "interface",
6706+
"description": "Opt-in guard configuration for claim-before-execute client tools.",
6707+
"properties": [
6708+
{
6709+
"name": "store",
6710+
"type": "ClientToolExecutionStore",
6711+
"description": "",
6712+
"optional": false
6713+
},
6714+
{
6715+
"name": "threadId",
6716+
"type": "string",
6717+
"description": "",
6718+
"optional": false
6719+
}
6720+
],
6721+
"examples": []
6722+
},
6723+
{
6724+
"name": "ClientToolExecutionKey",
6725+
"kind": "interface",
6726+
"description": "Durable identity for one client-tool execution on one thread.",
6727+
"properties": [
6728+
{
6729+
"name": "threadId",
6730+
"type": "string",
6731+
"description": "",
6732+
"optional": false
6733+
},
6734+
{
6735+
"name": "toolCallId",
6736+
"type": "string",
6737+
"description": "",
6738+
"optional": false
6739+
}
6740+
],
6741+
"examples": []
6742+
},
6743+
{
6744+
"name": "ClientToolExecutionOptions",
6745+
"kind": "interface",
6746+
"description": "Execution policy options for browser-executed function tools.",
6747+
"properties": [
6748+
{
6749+
"name": "idempotent",
6750+
"type": "boolean",
6751+
"description": "True when the handler may safely re-run and should skip durable pre-claims.",
6752+
"optional": true
6753+
}
6754+
],
6755+
"examples": []
6756+
},
6757+
{
6758+
"name": "ClientToolExecutionStore",
6759+
"kind": "interface",
6760+
"description": "Structural store contract for guarded browser client-tool execution.",
6761+
"properties": [],
6762+
"methods": [
6763+
{
6764+
"name": "claim",
6765+
"signature": "claim(key: ClientToolExecutionKey): Promise<\"claimed\" | ClientToolExecutionRecord>",
6766+
"description": "Atomically claim a tool-call execution. Returns prior state when present.",
6767+
"params": [
6768+
{
6769+
"name": "key",
6770+
"type": "ClientToolExecutionKey",
6771+
"description": "",
6772+
"optional": false
6773+
}
6774+
]
6775+
},
6776+
{
6777+
"name": "lookup",
6778+
"signature": "lookup(threadId: string, toolCallIds: readonly string[]): Promise<Record<string, ClientToolExecutionRecord>>",
6779+
"description": "Lookup prior execution states for pending tool calls on a thread.",
6780+
"params": [
6781+
{
6782+
"name": "threadId",
6783+
"type": "string",
6784+
"description": "",
6785+
"optional": false
6786+
},
6787+
{
6788+
"name": "toolCallIds",
6789+
"type": "readonly string[]",
6790+
"description": "",
6791+
"optional": false
6792+
}
6793+
]
6794+
},
6795+
{
6796+
"name": "record",
6797+
"signature": "record(key: ClientToolExecutionKey, result: ClientToolResult): Promise<void>",
6798+
"description": "Record the final client-tool result for a claimed execution.",
6799+
"params": [
6800+
{
6801+
"name": "key",
6802+
"type": "ClientToolExecutionKey",
6803+
"description": "",
6804+
"optional": false
6805+
},
6806+
{
6807+
"name": "result",
6808+
"type": "ClientToolResult",
6809+
"description": "",
6810+
"optional": false
6811+
}
6812+
]
6813+
}
6814+
],
6815+
"examples": []
6816+
},
6817+
{
6818+
"name": "ClientToolExecutorOptions",
6819+
"kind": "interface",
6820+
"description": "Options for wiring automatic browser function-tool execution.",
6821+
"properties": [
6822+
{
6823+
"name": "executionGuard",
6824+
"type": "ClientToolExecutionGuard",
6825+
"description": "",
6826+
"optional": true
6827+
}
6828+
],
6829+
"examples": []
6830+
},
66916831
{
66926832
"name": "ClientToolsCapability",
66936833
"kind": "interface",
@@ -6976,10 +7116,16 @@
69767116
},
69777117
{
69787118
"name": "handler",
6979-
"type": "(args: StandardSchemaInferOutput<S>) => R | Promise<R>",
7119+
"type": "(args: StandardSchemaInferOutput<S>, context: FunctionToolHandlerContext) => R | Promise<R>",
69807120
"description": "",
69817121
"optional": false
69827122
},
7123+
{
7124+
"name": "idempotent",
7125+
"type": "boolean",
7126+
"description": "",
7127+
"optional": true
7128+
},
69837129
{
69847130
"name": "kind",
69857131
"type": "\"function\"",
@@ -6995,6 +7141,20 @@
69957141
],
69967142
"examples": []
69977143
},
7144+
{
7145+
"name": "FunctionToolHandlerContext",
7146+
"kind": "interface",
7147+
"description": "Runtime context passed to browser-executed function tool handlers.",
7148+
"properties": [
7149+
{
7150+
"name": "signal",
7151+
"type": "AbortSignal",
7152+
"description": "Aborts when the client tool execution should stop without resolving.",
7153+
"optional": false
7154+
}
7155+
],
7156+
"examples": []
7157+
},
69987158
{
69997159
"name": "Message",
70007160
"kind": "interface",
@@ -7965,6 +8125,13 @@
79658125
"signature": "AnyFunctionToolDef | ViewToolDef | AskToolDef",
79668126
"examples": []
79678127
},
8128+
{
8129+
"name": "ClientToolExecutionRecord",
8130+
"kind": "type",
8131+
"description": "Prior durable execution state returned by a client-tool execution store.",
8132+
"signature": "object | object | object",
8133+
"examples": []
8134+
},
79688135
{
79698136
"name": "ClientToolRegistry",
79708137
"kind": "type",
@@ -8144,7 +8311,7 @@
81448311
"name": "action",
81458312
"kind": "function",
81468313
"description": "Declare an async function tool the model can call; its resolved return value\nbecomes the tool result shipped back to the model.",
8147-
"signature": "action(description: string, schema: S, handler: (args: StandardSchemaInferOutput<S>) => R | Promise<R>): FunctionToolDef<S, R>",
8314+
"signature": "action(description: string, schema: S, handler: (args: StandardSchemaInferOutput<S>, context: FunctionToolHandlerContext) => R | Promise<R>, options: ClientToolExecutionOptions): FunctionToolDef<S, R>",
81488315
"params": [
81498316
{
81508317
"name": "description",
@@ -8160,9 +8327,15 @@
81608327
},
81618328
{
81628329
"name": "handler",
8163-
"type": "(args: StandardSchemaInferOutput<S>) => R | Promise<R>",
8164-
"description": "Runs in the browser when the model calls the tool; its return\n type `R` is carried on the resulting FunctionToolDef.",
8330+
"type": "(args: StandardSchemaInferOutput<S>, context: FunctionToolHandlerContext) => R | Promise<R>",
8331+
"description": "Runs in the browser when the model calls the tool. The second\n argument carries an `AbortSignal`; its return type `R` is carried on the\n resulting FunctionToolDef.",
81658332
"optional": false
8333+
},
8334+
{
8335+
"name": "options",
8336+
"type": "ClientToolExecutionOptions",
8337+
"description": "Execution policy options, including `idempotent: true` to skip\n durable pre-execution claims when a guard is configured.",
8338+
"optional": true
81668339
}
81678340
],
81688341
"returns": {
@@ -8288,6 +8461,31 @@
82888461
},
82898462
"examples": []
82908463
},
8464+
{
8465+
"name": "clientToolGuardFailureResult",
8466+
"kind": "function",
8467+
"description": "Default fail-closed result when the execution guard itself cannot be reached.",
8468+
"signature": "clientToolGuardFailureResult(toolCallId: string, error: unknown): ClientToolResult",
8469+
"params": [
8470+
{
8471+
"name": "toolCallId",
8472+
"type": "string",
8473+
"description": "",
8474+
"optional": false
8475+
},
8476+
{
8477+
"name": "error",
8478+
"type": "unknown",
8479+
"description": "",
8480+
"optional": false
8481+
}
8482+
],
8483+
"returns": {
8484+
"type": "ClientToolResult",
8485+
"description": ""
8486+
},
8487+
"examples": []
8488+
},
82918489
{
82928490
"name": "createA2uiSurfaceStore",
82938491
"kind": "function",
@@ -8377,6 +8575,25 @@
83778575
},
83788576
"examples": []
83798577
},
8578+
{
8579+
"name": "defaultInterruptedClientToolResult",
8580+
"kind": "function",
8581+
"description": "Default fail-closed result for a stale in-progress client-tool execution.",
8582+
"signature": "defaultInterruptedClientToolResult(toolCallId: string): ClientToolResult",
8583+
"params": [
8584+
{
8585+
"name": "toolCallId",
8586+
"type": "string",
8587+
"description": "",
8588+
"optional": false
8589+
}
8590+
],
8591+
"returns": {
8592+
"type": "ClientToolResult",
8593+
"description": ""
8594+
},
8595+
"examples": []
8596+
},
83808597
{
83818598
"name": "deriveDomain",
83828599
"kind": "function",
@@ -8500,7 +8717,7 @@
85008717
"name": "executeFunctionTool",
85018718
"kind": "function",
85028719
"description": "Validate args, run the handler, and normalize the outcome to a ClientToolResult.",
8503-
"signature": "executeFunctionTool(def: AnyFunctionToolDef, rawArgs: unknown): Promise<ClientToolResult>",
8720+
"signature": "executeFunctionTool(def: AnyFunctionToolDef, rawArgs: unknown, context: FunctionToolHandlerContext): Promise<ClientToolResult>",
85048721
"params": [
85058722
{
85068723
"name": "def",
@@ -8513,6 +8730,12 @@
85138730
"type": "unknown",
85148731
"description": "",
85158732
"optional": false
8733+
},
8734+
{
8735+
"name": "context",
8736+
"type": "FunctionToolHandlerContext",
8737+
"description": "",
8738+
"optional": true
85168739
}
85178740
],
85188741
"returns": {
@@ -8946,11 +9169,30 @@
89469169
},
89479170
"examples": []
89489171
},
9172+
{
9173+
"name": "shouldClaimBeforeExecute",
9174+
"kind": "function",
9175+
"description": "Return whether this function tool should claim before browser execution.",
9176+
"signature": "shouldClaimBeforeExecute(def: AnyFunctionToolDef): boolean",
9177+
"params": [
9178+
{
9179+
"name": "def",
9180+
"type": "AnyFunctionToolDef",
9181+
"description": "",
9182+
"optional": false
9183+
}
9184+
],
9185+
"returns": {
9186+
"type": "boolean",
9187+
"description": ""
9188+
},
9189+
"examples": []
9190+
},
89499191
{
89509192
"name": "startClientToolExecutor",
89519193
"kind": "function",
89529194
"description": "Watches the agent's pending client tool calls and auto-runs FUNCTION tools,\nresolving each with its result. View/ask (component) tools are handled by the\nrendering layer, not here. No-op if the agent lacks the clientTools\ncapability. MUST be called in an injection context (sets up an effect).",
8953-
"signature": "startClientToolExecutor(agent: Agent<>, registry: ClientToolRegistry): void",
9195+
"signature": "startClientToolExecutor(agent: Agent<>, registry: ClientToolRegistry, options: ClientToolExecutorOptions): void",
89549196
"params": [
89559197
{
89569198
"name": "agent",
@@ -8963,6 +9205,12 @@
89639205
"type": "ClientToolRegistry",
89649206
"description": "",
89659207
"optional": false
9208+
},
9209+
{
9210+
"name": "options",
9211+
"type": "ClientToolExecutorOptions",
9212+
"description": "",
9213+
"optional": true
89669214
}
89679215
],
89689216
"returns": {

0 commit comments

Comments
 (0)