@opencow-ai/opencow-agent-sdk 0.4.23 → 0.4.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/capabilities/SdkTool.d.ts +5 -0
- package/dist/capabilities/tools/AgentTool/AgentTool.d.ts +1 -0
- package/dist/capabilities/tools/AgentTool/agentMerge.d.ts +1 -0
- package/dist/capabilities/tools/AgentTool/runAgent.d.ts +3 -3
- package/dist/cli.mjs +64022 -76785
- package/dist/client.js +31615 -93160
- package/dist/constants/envVars.d.ts +4 -0
- package/dist/controller/dispatch/permissionPreDecision.d.ts +22 -0
- package/dist/controller/loop.d.ts +5 -0
- package/dist/entrypoints/sdk/runtimeTypes.d.ts +11 -0
- package/dist/lib/toolInputNullCoercion.d.ts +1 -1
- package/dist/providers/shared/retry.d.ts +33 -1
- package/dist/sdk.js +31615 -93160
- package/dist/session/forkedAgent.d.ts +2 -1
- package/dist/session/tokens.d.ts +2 -1
- package/dist/types/replayState.d.ts +13 -0
- package/dist/types/toolRuntime.d.ts +18 -0
- package/package.json +1 -1
|
@@ -181,7 +181,8 @@ export type SubagentContextOverrides = {
|
|
|
181
181
|
* - abortController: new controller linked to parent (parent abort propagates)
|
|
182
182
|
* - getAppState: wrapped to set shouldAvoidPermissionPrompts
|
|
183
183
|
* - All mutation callbacks (setAppState, etc.): no-op
|
|
184
|
-
* - Fresh collections: nestedMemoryAttachmentTriggers, toolDecisions
|
|
184
|
+
* - Fresh collections: nestedMemoryAttachmentTriggers, toolDecisions,
|
|
185
|
+
* permissionPreDecisions
|
|
185
186
|
*
|
|
186
187
|
* Callers can:
|
|
187
188
|
* - Override specific fields via the overrides parameter
|
package/dist/session/tokens.d.ts
CHANGED
|
@@ -50,7 +50,8 @@ export declare function doesMostRecentAssistantMessageExceed200k(messages: Messa
|
|
|
50
50
|
* - thinking (thinking_delta)
|
|
51
51
|
* - redacted_thinking data
|
|
52
52
|
* - tool_use input (input_json_delta)
|
|
53
|
-
* Note: signature_delta
|
|
53
|
+
* Note: signature_delta and replay_state_delta are excluded from streaming
|
|
54
|
+
* counts (not model output).
|
|
54
55
|
*/
|
|
55
56
|
export declare function getAssistantMessageContentLength(message: AssistantMessage): number;
|
|
56
57
|
/**
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { CanonicalThinkingBlock } from '../session/canonical/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* Opaque reasoning-replay token issued by the gateway for non-Anthropic
|
|
4
|
+
* providers. The SDK only stores it on the thinking block and sends it back
|
|
5
|
+
* with the history; only the gateway can decode it.
|
|
6
|
+
*/
|
|
7
|
+
export type ReplayStateThinkingBlock = CanonicalThinkingBlock & {
|
|
8
|
+
replay_state?: string;
|
|
9
|
+
};
|
|
10
|
+
export type ReplayStateDelta = {
|
|
11
|
+
type: 'replay_state_delta';
|
|
12
|
+
replay_state: string;
|
|
13
|
+
};
|
|
@@ -130,6 +130,12 @@ export type ToolRuntimeContext = {
|
|
|
130
130
|
* nested subagents via agentOptions; the main loop never filters on it.
|
|
131
131
|
*/
|
|
132
132
|
subagentDisallowedTools?: string[];
|
|
133
|
+
/**
|
|
134
|
+
* 权限决策前置开关(见 Options.preDecidePermissions)。开启后 runTools() 入口
|
|
135
|
+
* 对同批 tool_use 并发预调 canUseTool 并缓存到 permissionPreDecisions;
|
|
136
|
+
* 默认 undefined(关),由 host 显式开启。
|
|
137
|
+
*/
|
|
138
|
+
preDecidePermissions?: boolean;
|
|
133
139
|
};
|
|
134
140
|
abortController: AbortController;
|
|
135
141
|
readFileState: FileStateCache;
|
|
@@ -184,6 +190,17 @@ export type ToolRuntimeContext = {
|
|
|
184
190
|
decision: 'accept' | 'reject';
|
|
185
191
|
timestamp: number;
|
|
186
192
|
}>;
|
|
193
|
+
/**
|
|
194
|
+
* 权限预决策缓存(options.preDecidePermissions 开启时由 runTools() 入口填充,
|
|
195
|
+
* 键为 tool_use id)。与 toolDecisions 审计快照不同:本缓存是一次性消费——
|
|
196
|
+
* 执行期 resolveHookPermissionDecision 取出即删,且仅当执行期 input 与缓存
|
|
197
|
+
* input 深比较一致时才采用缓存 promise,否则回退内联询问。预决策拿不到
|
|
198
|
+
* PreToolUse hook 的改写/ask 消息,故 hook 改写 input 后必然 miss 回退。
|
|
199
|
+
*/
|
|
200
|
+
permissionPreDecisions?: Map<string, {
|
|
201
|
+
input: Record<string, unknown>;
|
|
202
|
+
promise: Promise<PermissionResult>;
|
|
203
|
+
}>;
|
|
187
204
|
queryTracking?: QueryChainTracking;
|
|
188
205
|
requestPrompt?: (sourceName: string, toolInputSummary?: string | null) => (request: PromptRequest) => Promise<PromptResponse>;
|
|
189
206
|
toolUseId?: string;
|
|
@@ -233,6 +250,7 @@ export type ToolRuntime<Input extends AnyObject = AnyObject, Output = unknown, P
|
|
|
233
250
|
readonly shouldDefer?: boolean;
|
|
234
251
|
readonly alwaysLoad?: boolean;
|
|
235
252
|
readonly strict?: boolean;
|
|
253
|
+
readonly unknownKeys?: 'strip' | 'reject';
|
|
236
254
|
readonly inputSchema: Input;
|
|
237
255
|
readonly inputJSONSchema?: ToolInputJSONSchema;
|
|
238
256
|
outputSchema?: z.ZodType<unknown>;
|
package/package.json
CHANGED