@opencow-ai/opencow-agent-sdk 0.4.23 → 0.4.24
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 +172 -37
- package/dist/client.js +166 -29
- package/dist/controller/dispatch/permissionPreDecision.d.ts +22 -0
- package/dist/entrypoints/sdk/runtimeTypes.d.ts +11 -0
- package/dist/lib/toolInputNullCoercion.d.ts +1 -1
- package/dist/sdk.js +166 -29
- package/dist/session/forkedAgent.d.ts +2 -1
- package/dist/types/toolRuntime.d.ts +18 -0
- package/package.json +1 -1
|
@@ -11,6 +11,11 @@ export interface SdkTool {
|
|
|
11
11
|
* behind the permissive value type.
|
|
12
12
|
*/
|
|
13
13
|
readonly inputSchema: ToolInputSchemaShape;
|
|
14
|
+
/**
|
|
15
|
+
* Runtime policy for object keys that are absent from `inputSchema`.
|
|
16
|
+
* Defaults to `strip`; security-sensitive host tools can opt into `reject`.
|
|
17
|
+
*/
|
|
18
|
+
readonly unknownKeys?: 'strip' | 'reject';
|
|
14
19
|
/**
|
|
15
20
|
* Business logic. Receives validated args plus a structured invocation
|
|
16
21
|
* context. Must return a `CallToolResult`. Exceptions are caught by the
|
|
@@ -99,6 +99,7 @@ export declare const AgentTool: {
|
|
|
99
99
|
isLsp?: boolean;
|
|
100
100
|
shouldDefer?: boolean;
|
|
101
101
|
alwaysLoad?: boolean;
|
|
102
|
+
unknownKeys?: "strip" | "reject";
|
|
102
103
|
outputSchema?: z.ZodType<unknown>;
|
|
103
104
|
call: (args: any, context: import("../../../types/toolRuntime.js").ToolRuntimeContext, canUseTool: import("../../../types/toolRuntime.js").CanUseToolFn, parentMessage: MessageType, onProgress?: import("../../../types/toolRuntime.js").ToolCallProgress<any>) => Promise<import("../../../types/toolRuntime.js").ToolResult<any>>;
|
|
104
105
|
validateInput?: (input: any, context: import("../../../types/toolRuntime.js").ToolRuntimeContext) => Promise<import("../../../types/toolRuntime.js").ValidationResult>;
|
|
@@ -6,3 +6,4 @@ import type { AgentDefinition } from './loadAgentsDir.js';
|
|
|
6
6
|
* host-provided `Options.agents` (`override`).
|
|
7
7
|
*/
|
|
8
8
|
export declare function mergeAgentsByType(base: AgentDefinition[], override: AgentDefinition[]): AgentDefinition[];
|
|
9
|
+
export declare function withDefaultAgentForInvocation(activeAgents: AgentDefinition[], requestedType: string | undefined, defaultAgent: AgentDefinition): AgentDefinition[];
|
|
@@ -71,11 +71,11 @@ export declare function runAgent({ agentDefinition, promptMessages, toolUseConte
|
|
|
71
71
|
* during long single-block streams (e.g. thinking) where no assistant
|
|
72
72
|
* message is yielded for >60s. */
|
|
73
73
|
onQueryProgress?: () => void;
|
|
74
|
-
/** Optional callback fired with a GROWING single-block
|
|
75
|
-
* the sub-agent's text streams
|
|
74
|
+
/** Optional callback fired at most once every 50ms with a GROWING single-block
|
|
75
|
+
* assistant message as the sub-agent's text streams (content_block_delta /
|
|
76
76
|
* text_delta accumulated per content-block index, keyed to the message_start
|
|
77
77
|
* id). The consumer (AgentTool) forwards it via the existing agent_progress
|
|
78
|
-
* onProgress channel so the host renders the sub-conversation
|
|
78
|
+
* onProgress channel so the host renders the sub-conversation progressively
|
|
79
79
|
* instead of block-at-once. Side-channel only: these partials are NOT yielded
|
|
80
80
|
* and NOT recorded to the sidechain transcript — the authoritative whole
|
|
81
81
|
* messages still flow through the normal yield path (graceful degradation:
|
package/dist/cli.mjs
CHANGED
|
@@ -94818,7 +94818,7 @@ function printStartupScreen() {
|
|
|
94818
94818
|
const sLen = ` ● ${sL} Ready — type /help to begin`.length;
|
|
94819
94819
|
out.push(boxRow(sRow, W2, sLen));
|
|
94820
94820
|
out.push(`${rgb(...BORDER)}╚${"═".repeat(W2 - 2)}╝${RESET}`);
|
|
94821
|
-
out.push(` ${DIM}${rgb(...DIMCOL)}opencow ${RESET}${rgb(...ACCENT)}v${"0.4.
|
|
94821
|
+
out.push(` ${DIM}${rgb(...DIMCOL)}opencow ${RESET}${rgb(...ACCENT)}v${"0.4.24"}${RESET}`);
|
|
94822
94822
|
out.push("");
|
|
94823
94823
|
process.stdout.write(out.join(`
|
|
94824
94824
|
`) + `
|
|
@@ -146571,6 +146571,12 @@ function mergeAgentsByType(base2, override) {
|
|
|
146571
146571
|
byType.set(agent.agentType, agent);
|
|
146572
146572
|
return [...byType.values()];
|
|
146573
146573
|
}
|
|
146574
|
+
function withDefaultAgentForInvocation(activeAgents, requestedType, defaultAgent) {
|
|
146575
|
+
if (requestedType !== undefined || activeAgents.some((agent) => agent.agentType === defaultAgent.agentType)) {
|
|
146576
|
+
return activeAgents;
|
|
146577
|
+
}
|
|
146578
|
+
return [...activeAgents, defaultAgent];
|
|
146579
|
+
}
|
|
146574
146580
|
|
|
146575
146581
|
// src/capabilities/tools/AgentTool/builtInAgents.ts
|
|
146576
146582
|
var exports_builtInAgents = {};
|
|
@@ -240340,10 +240346,23 @@ function deepOmitNullProps(value) {
|
|
|
240340
240346
|
}
|
|
240341
240347
|
return value;
|
|
240342
240348
|
}
|
|
240343
|
-
function
|
|
240349
|
+
function containsUnrecognizedKeysIssue(value) {
|
|
240350
|
+
if (Array.isArray(value))
|
|
240351
|
+
return value.some(containsUnrecognizedKeysIssue);
|
|
240352
|
+
if (value === null || typeof value !== "object")
|
|
240353
|
+
return false;
|
|
240354
|
+
const issue2 = value;
|
|
240355
|
+
if (issue2.code === "unrecognized_keys")
|
|
240356
|
+
return true;
|
|
240357
|
+
return containsUnrecognizedKeysIssue(issue2.errors);
|
|
240358
|
+
}
|
|
240359
|
+
function safeParseToolInputWithNullCoercion(schema, input, unknownKeys = "strip") {
|
|
240344
240360
|
const first = schema.safeParse(input);
|
|
240345
240361
|
if (first.success)
|
|
240346
240362
|
return first;
|
|
240363
|
+
if (unknownKeys === "reject" && containsUnrecognizedKeysIssue(first.error.issues)) {
|
|
240364
|
+
return first;
|
|
240365
|
+
}
|
|
240347
240366
|
if (input === null || typeof input !== "object") {
|
|
240348
240367
|
return first;
|
|
240349
240368
|
}
|
|
@@ -240829,6 +240848,54 @@ function getRuleBehaviorDescription(permissionResult) {
|
|
|
240829
240848
|
}
|
|
240830
240849
|
}
|
|
240831
240850
|
|
|
240851
|
+
// src/controller/dispatch/permissionPreDecision.ts
|
|
240852
|
+
function startPermissionPreDecisions(blocks, assistantMessages, canUseTool, toolUseContext) {
|
|
240853
|
+
const existing = toolUseContext.permissionPreDecisions;
|
|
240854
|
+
if (existing && existing.size > 0) {
|
|
240855
|
+
return;
|
|
240856
|
+
}
|
|
240857
|
+
const preDecisions = new Map;
|
|
240858
|
+
toolUseContext.permissionPreDecisions = preDecisions;
|
|
240859
|
+
for (const block2 of blocks) {
|
|
240860
|
+
const tool = findToolRuntimeByName(toolUseContext.options.tools, block2.name);
|
|
240861
|
+
if (!tool) {
|
|
240862
|
+
continue;
|
|
240863
|
+
}
|
|
240864
|
+
const parsedInput = safeParseToolInputWithNullCoercion(tool.inputSchema, block2.input, tool.unknownKeys);
|
|
240865
|
+
if (!parsedInput.success) {
|
|
240866
|
+
continue;
|
|
240867
|
+
}
|
|
240868
|
+
const assistantMessage = assistantMessages.find((message) => message.message.content.some((content) => content.type === "tool_use" && content.id === block2.id));
|
|
240869
|
+
if (!assistantMessage) {
|
|
240870
|
+
continue;
|
|
240871
|
+
}
|
|
240872
|
+
let input = parsedInput.data;
|
|
240873
|
+
if (tool.backfillObservableInput && typeof input === "object" && input !== null) {
|
|
240874
|
+
input = { ...input };
|
|
240875
|
+
tool.backfillObservableInput(input);
|
|
240876
|
+
}
|
|
240877
|
+
const promise3 = canUseTool(tool, input, toolUseContext, assistantMessage, block2.id);
|
|
240878
|
+
promise3.catch(() => {});
|
|
240879
|
+
preDecisions.set(block2.id, { input, promise: promise3 });
|
|
240880
|
+
}
|
|
240881
|
+
}
|
|
240882
|
+
function consumePermissionPreDecision(toolUseContext, toolUseID, input, fallback) {
|
|
240883
|
+
const cache2 = toolUseContext.permissionPreDecisions;
|
|
240884
|
+
const entry = cache2?.get(toolUseID);
|
|
240885
|
+
if (!cache2 || !entry) {
|
|
240886
|
+
return fallback();
|
|
240887
|
+
}
|
|
240888
|
+
cache2.delete(toolUseID);
|
|
240889
|
+
if (jsonStringify(entry.input) !== jsonStringify(input)) {
|
|
240890
|
+
return fallback();
|
|
240891
|
+
}
|
|
240892
|
+
return entry.promise;
|
|
240893
|
+
}
|
|
240894
|
+
var init_permissionPreDecision = __esm(() => {
|
|
240895
|
+
init_toolRuntime();
|
|
240896
|
+
init_slowOperations();
|
|
240897
|
+
});
|
|
240898
|
+
|
|
240832
240899
|
// src/controller/dispatch/toolHooks.ts
|
|
240833
240900
|
async function* runPostToolUseHooks(toolUseContext, tool, toolUseID, messageId, toolInput, toolResponse, requestId, mcpServerType, mcpServerBaseUrl) {
|
|
240834
240901
|
const postToolStartTime = Date.now();
|
|
@@ -241016,7 +241083,7 @@ async function resolveHookPermissionDecision(hookPermissionResult, tool, input,
|
|
|
241016
241083
|
if (requiresInteraction && !interactionSatisfied || requireCanUseTool) {
|
|
241017
241084
|
logForDebugging2(`Hook approved tool use for ${tool.name}, but canUseTool is required`);
|
|
241018
241085
|
return {
|
|
241019
|
-
decision: await canUseTool(tool, hookInput, toolUseContext, assistantMessage, toolUseID),
|
|
241086
|
+
decision: await consumePermissionPreDecision(toolUseContext, toolUseID, hookInput, () => canUseTool(tool, hookInput, toolUseContext, assistantMessage, toolUseID)),
|
|
241020
241087
|
input: hookInput
|
|
241021
241088
|
};
|
|
241022
241089
|
}
|
|
@@ -241031,7 +241098,7 @@ async function resolveHookPermissionDecision(hookPermissionResult, tool, input,
|
|
|
241031
241098
|
}
|
|
241032
241099
|
logForDebugging2(`Hook approved tool use for ${tool.name}, but ask rule requires prompt`);
|
|
241033
241100
|
return {
|
|
241034
|
-
decision: await canUseTool(tool, hookInput, toolUseContext, assistantMessage, toolUseID),
|
|
241101
|
+
decision: await consumePermissionPreDecision(toolUseContext, toolUseID, hookInput, () => canUseTool(tool, hookInput, toolUseContext, assistantMessage, toolUseID)),
|
|
241035
241102
|
input: hookInput
|
|
241036
241103
|
};
|
|
241037
241104
|
}
|
|
@@ -241041,8 +241108,9 @@ async function resolveHookPermissionDecision(hookPermissionResult, tool, input,
|
|
|
241041
241108
|
}
|
|
241042
241109
|
const forceDecision = hookPermissionResult?.behavior === "ask" ? hookPermissionResult : undefined;
|
|
241043
241110
|
const askInput = hookPermissionResult?.behavior === "ask" && hookPermissionResult.updatedInput ? hookPermissionResult.updatedInput : input;
|
|
241111
|
+
const decision = forceDecision ? await canUseTool(tool, askInput, toolUseContext, assistantMessage, toolUseID, forceDecision) : await consumePermissionPreDecision(toolUseContext, toolUseID, askInput, () => canUseTool(tool, askInput, toolUseContext, assistantMessage, toolUseID));
|
|
241044
241112
|
return {
|
|
241045
|
-
decision
|
|
241113
|
+
decision,
|
|
241046
241114
|
input: askInput
|
|
241047
241115
|
};
|
|
241048
241116
|
}
|
|
@@ -241203,6 +241271,7 @@ var init_toolHooks = __esm(() => {
|
|
|
241203
241271
|
init_permissions2();
|
|
241204
241272
|
init_toolErrors();
|
|
241205
241273
|
init_utils5();
|
|
241274
|
+
init_permissionPreDecision();
|
|
241206
241275
|
});
|
|
241207
241276
|
|
|
241208
241277
|
// src/controller/dispatch/toolExecution.ts
|
|
@@ -241458,9 +241527,8 @@ function streamedCheckPermissionsAndCallTool(tool, toolUseID, input, toolUseCont
|
|
|
241458
241527
|
return stream4;
|
|
241459
241528
|
}
|
|
241460
241529
|
async function checkPermissionsAndCallTool(tool, toolUseID, input, toolUseContext, canUseTool, assistantMessage, messageId, requestId, mcpServerType, mcpServerBaseUrl, onToolProgress) {
|
|
241461
|
-
const
|
|
241462
|
-
|
|
241463
|
-
let errorContent = formatZodValidationError(tool.name, parsedInput.error);
|
|
241530
|
+
const inputValidationFailure = (error41) => {
|
|
241531
|
+
let errorContent = formatZodValidationError(tool.name, error41);
|
|
241464
241532
|
const schemaHint = buildSchemaNotSentHint(tool, toolUseContext.messages, toolUseContext.options.tools);
|
|
241465
241533
|
if (schemaHint) {
|
|
241466
241534
|
logEvent("tengu_deferred_tool_schema_not_sent", {
|
|
@@ -241500,11 +241568,15 @@ async function checkPermissionsAndCallTool(tool, toolUseID, input, toolUseContex
|
|
|
241500
241568
|
tool_use_id: toolUseID
|
|
241501
241569
|
}
|
|
241502
241570
|
],
|
|
241503
|
-
toolUseResult: `InputValidationError: ${
|
|
241571
|
+
toolUseResult: `InputValidationError: ${error41.message}`,
|
|
241504
241572
|
sourceToolAssistantUUID: assistantMessage.uuid
|
|
241505
241573
|
})
|
|
241506
241574
|
}
|
|
241507
241575
|
];
|
|
241576
|
+
};
|
|
241577
|
+
const parsedInput = safeParseToolInputWithNullCoercion(tool.inputSchema, input, tool.unknownKeys);
|
|
241578
|
+
if (!parsedInput.success) {
|
|
241579
|
+
return inputValidationFailure(parsedInput.error);
|
|
241508
241580
|
}
|
|
241509
241581
|
const isValidCall = await tool.validateInput?.(parsedInput.data, toolUseContext);
|
|
241510
241582
|
if (isValidCall?.result === false) {
|
|
@@ -241740,6 +241812,16 @@ async function checkPermissionsAndCallTool(tool, toolUseID, input, toolUseContex
|
|
|
241740
241812
|
if (permissionDecision.updatedInput !== undefined) {
|
|
241741
241813
|
processedInput = permissionDecision.updatedInput;
|
|
241742
241814
|
}
|
|
241815
|
+
if (tool.unknownKeys === "reject") {
|
|
241816
|
+
const finalInput = safeParseToolInputWithNullCoercion(tool.inputSchema, processedInput, tool.unknownKeys);
|
|
241817
|
+
if (!finalInput.success) {
|
|
241818
|
+
endToolBlockedOnUserSpan("reject", "input-validation");
|
|
241819
|
+
endToolSpan();
|
|
241820
|
+
resultingMessages.push(...inputValidationFailure(finalInput.error));
|
|
241821
|
+
return resultingMessages;
|
|
241822
|
+
}
|
|
241823
|
+
processedInput = finalInput.data;
|
|
241824
|
+
}
|
|
241743
241825
|
const telemetryToolInput = extractToolInputForTelemetry(processedInput);
|
|
241744
241826
|
let toolParameters = {};
|
|
241745
241827
|
if (isToolDetailsLoggingEnabled()) {
|
|
@@ -242702,6 +242784,9 @@ function getMaxToolUseConcurrency() {
|
|
|
242702
242784
|
return parseInt(resolveEnvVar("MAX_TOOL_USE_CONCURRENCY") || "", 10) || 10;
|
|
242703
242785
|
}
|
|
242704
242786
|
async function* runTools(toolUseMessages, assistantMessages, canUseTool, toolUseContext) {
|
|
242787
|
+
if (toolUseContext.options.preDecidePermissions) {
|
|
242788
|
+
startPermissionPreDecisions(toolUseMessages, assistantMessages, canUseTool, toolUseContext);
|
|
242789
|
+
}
|
|
242705
242790
|
let currentContext = toolUseContext;
|
|
242706
242791
|
for (const { isConcurrencySafe, blocks } of partitionToolCalls(toolUseMessages, currentContext)) {
|
|
242707
242792
|
if (isConcurrencySafe) {
|
|
@@ -242795,6 +242880,7 @@ var init_toolOrchestration = __esm(() => {
|
|
|
242795
242880
|
init_toolRuntime();
|
|
242796
242881
|
init_generators();
|
|
242797
242882
|
init_toolExecution();
|
|
242883
|
+
init_permissionPreDecision();
|
|
242798
242884
|
init_state();
|
|
242799
242885
|
});
|
|
242800
242886
|
|
|
@@ -244891,7 +244977,7 @@ function getAnthropicEnvMetadata() {
|
|
|
244891
244977
|
function getBuildAgeMinutes() {
|
|
244892
244978
|
if (false)
|
|
244893
244979
|
;
|
|
244894
|
-
const buildTime = new Date("2026-
|
|
244980
|
+
const buildTime = new Date("2026-09-03T09:12:13.936Z").getTime();
|
|
244895
244981
|
if (isNaN(buildTime))
|
|
244896
244982
|
return;
|
|
244897
244983
|
return Math.floor((Date.now() - buildTime) / 60000);
|
|
@@ -245421,6 +245507,7 @@ function createSubagentContext(parentContext, overrides) {
|
|
|
245421
245507
|
dynamicSkillDirTriggers: new Set,
|
|
245422
245508
|
discoveredSkillNames: new Set,
|
|
245423
245509
|
toolDecisions: undefined,
|
|
245510
|
+
permissionPreDecisions: undefined,
|
|
245424
245511
|
contentReplacementState: overrides?.contentReplacementState ?? (parentContext.contentReplacementState ? cloneContentReplacementState(parentContext.contentReplacementState) : undefined),
|
|
245425
245512
|
abortController,
|
|
245426
245513
|
getAppState,
|
|
@@ -248675,6 +248762,31 @@ async function* runAgent({
|
|
|
248675
248762
|
level: "warn"
|
|
248676
248763
|
});
|
|
248677
248764
|
});
|
|
248765
|
+
let partialBaseMessage = null;
|
|
248766
|
+
const partialTextByIndex = new Map;
|
|
248767
|
+
const PARTIAL_PROGRESS_INTERVAL_MS = 50;
|
|
248768
|
+
let lastPartialAssistantAt = 0;
|
|
248769
|
+
let lastPartialProgressHookAt = 0;
|
|
248770
|
+
let foregroundSkipped = 0;
|
|
248771
|
+
let backgroundSkipped = 0;
|
|
248772
|
+
const logPartialProgress = (reason, chars, foregroundEmitted, backgroundEmitted) => {
|
|
248773
|
+
logForDebugging2(`[StreamThrottle:SubAgent] ${JSON.stringify({
|
|
248774
|
+
reason,
|
|
248775
|
+
agentId,
|
|
248776
|
+
agentType: agentDefinition.agentType,
|
|
248777
|
+
messageId: partialBaseMessage?.id ?? null,
|
|
248778
|
+
intervalMs: PARTIAL_PROGRESS_INTERVAL_MS,
|
|
248779
|
+
chars,
|
|
248780
|
+
foregroundEmitted,
|
|
248781
|
+
foregroundSkipped,
|
|
248782
|
+
backgroundEmitted,
|
|
248783
|
+
backgroundSkipped
|
|
248784
|
+
})}`);
|
|
248785
|
+
if (foregroundEmitted)
|
|
248786
|
+
foregroundSkipped = 0;
|
|
248787
|
+
if (backgroundEmitted)
|
|
248788
|
+
backgroundSkipped = 0;
|
|
248789
|
+
};
|
|
248678
248790
|
try {
|
|
248679
248791
|
const additionalContexts = [];
|
|
248680
248792
|
for await (const hookResult of executeSubagentStartHooks(agentId, agentDefinition.agentType, agentAbortController.signal, undefined, toolUseContext.toolUseId, isAsync2)) {
|
|
@@ -248782,10 +248894,6 @@ async function* runAgent({
|
|
|
248782
248894
|
...description && { description }
|
|
248783
248895
|
}).catch((_err) => logForDebugging2(`Failed to write agent metadata: ${_err}`));
|
|
248784
248896
|
let lastRecordedUuid = initialMessages.at(-1)?.uuid ?? null;
|
|
248785
|
-
let partialBaseMessage = null;
|
|
248786
|
-
const partialTextByIndex = new Map;
|
|
248787
|
-
const PARTIAL_PROGRESS_HOOK_INTERVAL_MS = 100;
|
|
248788
|
-
let lastPartialProgressHookAt = 0;
|
|
248789
248897
|
const agentExtraBody = agentDefinition.extraBody;
|
|
248790
248898
|
const agentQuery = query({
|
|
248791
248899
|
messages: initialMessages,
|
|
@@ -248810,6 +248918,11 @@ async function* runAgent({
|
|
|
248810
248918
|
if (message.type === "stream_event") {
|
|
248811
248919
|
const ev = message.event;
|
|
248812
248920
|
if (ev.type === "message_start") {
|
|
248921
|
+
if (foregroundSkipped > 0 || backgroundSkipped > 0) {
|
|
248922
|
+
logPartialProgress("message-start", 0, false, false);
|
|
248923
|
+
foregroundSkipped = 0;
|
|
248924
|
+
backgroundSkipped = 0;
|
|
248925
|
+
}
|
|
248813
248926
|
if (message.ttftMs != null) {
|
|
248814
248927
|
toolUseContext.pushApiMetricsEntry?.(message.ttftMs);
|
|
248815
248928
|
}
|
|
@@ -248821,22 +248934,36 @@ async function* runAgent({
|
|
|
248821
248934
|
const idx = ev.index ?? 0;
|
|
248822
248935
|
const acc = (partialTextByIndex.get(idx) ?? "") + ev.delta.text;
|
|
248823
248936
|
partialTextByIndex.set(idx, acc);
|
|
248824
|
-
|
|
248825
|
-
|
|
248826
|
-
|
|
248827
|
-
|
|
248828
|
-
|
|
248829
|
-
|
|
248830
|
-
|
|
248831
|
-
|
|
248832
|
-
|
|
248937
|
+
const now = Date.now();
|
|
248938
|
+
let foregroundEmitted = false;
|
|
248939
|
+
let backgroundEmitted = false;
|
|
248940
|
+
if (onPartialAssistant && now - lastPartialAssistantAt >= PARTIAL_PROGRESS_INTERVAL_MS) {
|
|
248941
|
+
lastPartialAssistantAt = now;
|
|
248942
|
+
foregroundEmitted = true;
|
|
248943
|
+
onPartialAssistant({
|
|
248944
|
+
type: "assistant",
|
|
248945
|
+
message: {
|
|
248946
|
+
...partialBaseMessage,
|
|
248947
|
+
content: [{ type: "text", text: acc, citations: null }]
|
|
248948
|
+
},
|
|
248949
|
+
uuid: randomUUID10(),
|
|
248950
|
+
timestamp: new Date().toISOString()
|
|
248951
|
+
});
|
|
248952
|
+
} else if (onPartialAssistant) {
|
|
248953
|
+
foregroundSkipped += 1;
|
|
248954
|
+
}
|
|
248833
248955
|
if (isAsync2) {
|
|
248834
|
-
|
|
248835
|
-
if (now - lastPartialProgressHookAt >= PARTIAL_PROGRESS_HOOK_INTERVAL_MS) {
|
|
248956
|
+
if (now - lastPartialProgressHookAt >= PARTIAL_PROGRESS_INTERVAL_MS) {
|
|
248836
248957
|
lastPartialProgressHookAt = now;
|
|
248958
|
+
backgroundEmitted = true;
|
|
248837
248959
|
executeSubagentProgressHooks(agentId, agentDefinition.agentType, partialBaseMessage.id, toolUseContext.toolUseId, [{ type: "text", text: acc }]).catch(() => {});
|
|
248960
|
+
} else {
|
|
248961
|
+
backgroundSkipped += 1;
|
|
248838
248962
|
}
|
|
248839
248963
|
}
|
|
248964
|
+
if (foregroundEmitted || backgroundEmitted) {
|
|
248965
|
+
logPartialProgress("emit", acc.length, foregroundEmitted, backgroundEmitted);
|
|
248966
|
+
}
|
|
248840
248967
|
}
|
|
248841
248968
|
continue;
|
|
248842
248969
|
}
|
|
@@ -248885,6 +249012,9 @@ async function* runAgent({
|
|
|
248885
249012
|
agentRunError = err2;
|
|
248886
249013
|
throw err2;
|
|
248887
249014
|
} finally {
|
|
249015
|
+
if (foregroundSkipped > 0 || backgroundSkipped > 0) {
|
|
249016
|
+
logPartialProgress("finalize", 0, false, false);
|
|
249017
|
+
}
|
|
248888
249018
|
await finalizeLifecycle([
|
|
248889
249019
|
async () => {
|
|
248890
249020
|
const naturalStopAlreadyFired = isAsync2 && hasSubagentStopFired(agentId);
|
|
@@ -265595,7 +265725,7 @@ var init_AgentTool = __esm(() => {
|
|
|
265595
265725
|
}
|
|
265596
265726
|
selectedAgent = FORK_AGENT;
|
|
265597
265727
|
} else {
|
|
265598
|
-
const allAgents = toolUseContext.options.agentDefinitions.activeAgents;
|
|
265728
|
+
const allAgents = withDefaultAgentForInvocation(toolUseContext.options.agentDefinitions.activeAgents, subagent_type, GENERAL_PURPOSE_AGENT);
|
|
265599
265729
|
const {
|
|
265600
265730
|
allowedAgentTypes
|
|
265601
265731
|
} = toolUseContext.options.agentDefinitions;
|
|
@@ -492398,7 +492528,7 @@ function buildPrimarySection() {
|
|
|
492398
492528
|
}, undefined, false, undefined, this);
|
|
492399
492529
|
return [{
|
|
492400
492530
|
label: "Version",
|
|
492401
|
-
value: "0.4.
|
|
492531
|
+
value: "0.4.24"
|
|
492402
492532
|
}, {
|
|
492403
492533
|
label: "Session name",
|
|
492404
492534
|
value: nameValue
|
|
@@ -540540,7 +540670,7 @@ var init_bridge_kick = __esm(() => {
|
|
|
540540
540670
|
var call58 = async () => {
|
|
540541
540671
|
return {
|
|
540542
540672
|
type: "text",
|
|
540543
|
-
value: `${"99.0.0"} (built ${"2026-
|
|
540673
|
+
value: `${"99.0.0"} (built ${"2026-09-03T09:12:13.936Z"})`
|
|
540544
540674
|
};
|
|
540545
540675
|
}, version2, version_default;
|
|
540546
540676
|
var init_version = __esm(() => {
|
|
@@ -558307,7 +558437,7 @@ function WelcomeV2() {
|
|
|
558307
558437
|
dimColor: true,
|
|
558308
558438
|
children: [
|
|
558309
558439
|
"v",
|
|
558310
|
-
"0.4.
|
|
558440
|
+
"0.4.24",
|
|
558311
558441
|
" "
|
|
558312
558442
|
]
|
|
558313
558443
|
}, undefined, true, undefined, this)
|
|
@@ -558507,7 +558637,7 @@ function WelcomeV2() {
|
|
|
558507
558637
|
dimColor: true,
|
|
558508
558638
|
children: [
|
|
558509
558639
|
"v",
|
|
558510
|
-
"0.4.
|
|
558640
|
+
"0.4.24",
|
|
558511
558641
|
" "
|
|
558512
558642
|
]
|
|
558513
558643
|
}, undefined, true, undefined, this)
|
|
@@ -558733,7 +558863,7 @@ function AppleTerminalWelcomeV2(t0) {
|
|
|
558733
558863
|
dimColor: true,
|
|
558734
558864
|
children: [
|
|
558735
558865
|
"v",
|
|
558736
|
-
"0.4.
|
|
558866
|
+
"0.4.24",
|
|
558737
558867
|
" "
|
|
558738
558868
|
]
|
|
558739
558869
|
}, undefined, true, undefined, this);
|
|
@@ -558987,7 +559117,7 @@ function AppleTerminalWelcomeV2(t0) {
|
|
|
558987
559117
|
dimColor: true,
|
|
558988
559118
|
children: [
|
|
558989
559119
|
"v",
|
|
558990
|
-
"0.4.
|
|
559120
|
+
"0.4.24",
|
|
558991
559121
|
" "
|
|
558992
559122
|
]
|
|
558993
559123
|
}, undefined, true, undefined, this);
|
|
@@ -569747,6 +569877,7 @@ class QueryEngine {
|
|
|
569747
569877
|
includePartialMessages = false,
|
|
569748
569878
|
agents: agents2 = [],
|
|
569749
569879
|
setSDKStatus,
|
|
569880
|
+
preDecidePermissions,
|
|
569750
569881
|
onToolInvoke,
|
|
569751
569882
|
uploadMedia,
|
|
569752
569883
|
orphanedPermission
|
|
@@ -569824,7 +569955,8 @@ class QueryEngine {
|
|
|
569824
569955
|
maxOutputTokensLimit,
|
|
569825
569956
|
contextWindow,
|
|
569826
569957
|
modelProviders: this.config.modelProviders,
|
|
569827
|
-
subagentDisallowedTools: this.config.subagentDisallowedTools
|
|
569958
|
+
subagentDisallowedTools: this.config.subagentDisallowedTools,
|
|
569959
|
+
preDecidePermissions
|
|
569828
569960
|
},
|
|
569829
569961
|
getAppState,
|
|
569830
569962
|
setAppState,
|
|
@@ -569922,7 +570054,8 @@ class QueryEngine {
|
|
|
569922
570054
|
maxOutputTokensLimit,
|
|
569923
570055
|
contextWindow,
|
|
569924
570056
|
modelProviders: this.config.modelProviders,
|
|
569925
|
-
subagentDisallowedTools: this.config.subagentDisallowedTools
|
|
570057
|
+
subagentDisallowedTools: this.config.subagentDisallowedTools,
|
|
570058
|
+
preDecidePermissions
|
|
569926
570059
|
},
|
|
569927
570060
|
getAppState,
|
|
569928
570061
|
setAppState,
|
|
@@ -570439,6 +570572,7 @@ async function* ask({
|
|
|
570439
570572
|
handleElicitation,
|
|
570440
570573
|
agents: agents2 = [],
|
|
570441
570574
|
setSDKStatus,
|
|
570575
|
+
preDecidePermissions,
|
|
570442
570576
|
onToolInvoke,
|
|
570443
570577
|
uploadMedia,
|
|
570444
570578
|
orphanedPermission
|
|
@@ -570473,6 +570607,7 @@ async function* ask({
|
|
|
570473
570607
|
replayUserMessages,
|
|
570474
570608
|
includePartialMessages,
|
|
570475
570609
|
setSDKStatus,
|
|
570610
|
+
preDecidePermissions,
|
|
570476
570611
|
onToolInvoke,
|
|
570477
570612
|
uploadMedia,
|
|
570478
570613
|
abortController,
|
|
@@ -579972,7 +580107,7 @@ Usage: claude --remote "your task description"`, () => gracefulShutdown(1));
|
|
|
579972
580107
|
pendingHookMessages
|
|
579973
580108
|
}, renderAndRun);
|
|
579974
580109
|
}
|
|
579975
|
-
}).version("0.4.
|
|
580110
|
+
}).version("0.4.24 (OpenCow)", "-v, --version", "Output the version number");
|
|
579976
580111
|
program2.option("-w, --worktree [name]", "Create a new git worktree for this session (optionally specify a name)");
|
|
579977
580112
|
program2.option("--tmux", "Create a tmux session for the worktree (requires --worktree). Uses iTerm2 native panes when available; use --tmux=classic for traditional tmux.");
|
|
579978
580113
|
if (canUserConfigureAdvisor()) {
|
|
@@ -580617,7 +580752,7 @@ if (false) {}
|
|
|
580617
580752
|
async function main2() {
|
|
580618
580753
|
const args = process.argv.slice(2);
|
|
580619
580754
|
if (args.length === 1 && (args[0] === "--version" || args[0] === "-v" || args[0] === "-V")) {
|
|
580620
|
-
console.log(`${"0.4.
|
|
580755
|
+
console.log(`${"0.4.24"} (OpenCow)`);
|
|
580621
580756
|
return;
|
|
580622
580757
|
}
|
|
580623
580758
|
if (args.includes("--provider")) {
|
|
@@ -580735,4 +580870,4 @@ async function main2() {
|
|
|
580735
580870
|
}
|
|
580736
580871
|
main2();
|
|
580737
580872
|
|
|
580738
|
-
//# debugId=
|
|
580873
|
+
//# debugId=686B073019ED8C6564756E2164756E21
|