docs(tools): trim concurrency classifier contract

This commit is contained in:
Dudu-0223
2026-07-16 15:27:36 +08:00
parent 3bed1a644f
commit bbf66b3a5b
3 changed files with 11 additions and 23 deletions

View File

@@ -1086,7 +1086,7 @@ export interface Config {
export type ToolPresentationMode = 'native' | 'code' | 'both' export type ToolPresentationMode = 'native' | 'code' | 'both'
``` ```
Source: [`packages/core/tools/src/index.ts:388`](../packages/core/tools/src/index.ts) Source: [`packages/core/tools/src/index.ts:376`](../packages/core/tools/src/index.ts)
## `@deepseek-ai/dsh-user-approval` ## `@deepseek-ai/dsh-user-approval`

View File

@@ -277,7 +277,7 @@ async execute(exec: ToolExecutionInput): Promise<ToolExecutionResult>
Types: [ToolDefinition](../core-data-structures/tools.md) · [ToolExecutionInput](../core-data-structures/tools.md) · [ToolExecutionMode](../core-data-structures/tools.md) · [ToolExecutionResult](../core-data-structures/tools.md) Types: [ToolDefinition](../core-data-structures/tools.md) · [ToolExecutionInput](../core-data-structures/tools.md) · [ToolExecutionMode](../core-data-structures/tools.md) · [ToolExecutionResult](../core-data-structures/tools.md)
Source: [`packages/core/tools/src/index.ts:444`](../../packages/core/tools/src/index.ts) Source: [`packages/core/tools/src/index.ts:432`](../../packages/core/tools/src/index.ts)
## `ctx.userInteraction` — `UserInteractionService` ## `ctx.userInteraction` — `UserInteractionService`

View File

@@ -132,28 +132,16 @@ export interface ToolDefinition extends ToolSchema {
*/ */
timeoutMs?: number timeoutMs?: number
/** /**
* Optional synchronous, pure classification: may this call run concurrently * Pure, synchronous host-only classifier for overlap with sibling tool calls.
* with other tool calls in the same assistant step? The agent-loop scheduler * Only `true` opts in; omission, exceptions, and invalid `defineTool`
* calls it (via {@link ToolRegistry.executionMode}) to decide whether the call * arguments are treated as exclusive.
* joins a parallel group or forms an exclusive barrier; a missing declaration,
* a thrown check, or any non-`true` return is treated as exclusive. Like
* `timeoutMs` it is host-only scheduler metadata — NEVER sent to the model,
* since `schemas()` whitelists only name/description/parameters.
* *
* It may inspect the parsed `args` (`unknown` — a hand-rolled definition * Opted-in executions must not mutate parent-owned state, and shared state
* receives the raw parsed value; `defineTool` schema-validates first and * they touch must be concurrency-safe. See the
* returns `false` on invalid args). The check performs no I/O and receives no * [parallel-tool-call RFC](../../../../docs/rfc/implemented/feature/2026-07-10-parallel-tool-call-execution.md)
* live `Agent` or mutable `ToolExecution`. * for the full safety contract and recorder exception.
* * @param args - Parsed tool arguments.
* Declaring `true` is a contract: during `execute` the tool body must NOT * @returns Whether this call may join a parallel group.
* mutate the parent agent's session or other parent-owned async state (no
* `exec.agent.session.append(...)`, no `agent.inject(...)`); its only parent-
* step outputs are the returned content, `meta`, structured error, and
* `additionalContext` on the loop's ordered post-execute path. A synchronous,
* side-effect-only recorder whose updates are commutative or fail closed for
* concurrent same-session calls is the one exception (`fs/observed` is the
* worked example). Full contract and rationale: the parallel-tool-call RFC
* (docs/rfc/implemented/feature/2026-07-10-parallel-tool-call-execution.md).
*/ */
isConcurrencySafe?(args: unknown): boolean isConcurrencySafe?(args: unknown): boolean
/** /**