@vybestack/llxprt-code-agents 0.10.0-nightly.260613.1adad3b34
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/.last_build +0 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -0
- package/dist/src/agents/executor-prompt-builder.d.ts +19 -0
- package/dist/src/agents/executor-prompt-builder.js +44 -0
- package/dist/src/agents/executor-prompt-builder.js.map +1 -0
- package/dist/src/agents/executor-termination.d.ts +22 -0
- package/dist/src/agents/executor-termination.js +44 -0
- package/dist/src/agents/executor-termination.js.map +1 -0
- package/dist/src/agents/executor-validation.d.ts +17 -0
- package/dist/src/agents/executor-validation.js +35 -0
- package/dist/src/agents/executor-validation.js.map +1 -0
- package/dist/src/agents/executor.d.ts +136 -0
- package/dist/src/agents/executor.js +874 -0
- package/dist/src/agents/executor.js.map +1 -0
- package/dist/src/agents/invocation.d.ts +45 -0
- package/dist/src/agents/invocation.js +118 -0
- package/dist/src/agents/invocation.js.map +1 -0
- package/dist/src/agents/recovery.d.ts +75 -0
- package/dist/src/agents/recovery.js +107 -0
- package/dist/src/agents/recovery.js.map +1 -0
- package/dist/src/agents/types.d.ts +149 -0
- package/dist/src/agents/types.js +18 -0
- package/dist/src/agents/types.js.map +1 -0
- package/dist/src/agents/utils.d.ts +15 -0
- package/dist/src/agents/utils.js +28 -0
- package/dist/src/agents/utils.js.map +1 -0
- package/dist/src/compression/CompressionHandler.d.ts +178 -0
- package/dist/src/compression/CompressionHandler.js +630 -0
- package/dist/src/compression/CompressionHandler.js.map +1 -0
- package/dist/src/compression/HighDensityStrategy.d.ts +113 -0
- package/dist/src/compression/HighDensityStrategy.js +769 -0
- package/dist/src/compression/HighDensityStrategy.js.map +1 -0
- package/dist/src/compression/MiddleOutStrategy.d.ts +27 -0
- package/dist/src/compression/MiddleOutStrategy.js +347 -0
- package/dist/src/compression/MiddleOutStrategy.js.map +1 -0
- package/dist/src/compression/OneShotStrategy.d.ts +22 -0
- package/dist/src/compression/OneShotStrategy.js +235 -0
- package/dist/src/compression/OneShotStrategy.js.map +1 -0
- package/dist/src/compression/TopDownTruncationStrategy.d.ts +13 -0
- package/dist/src/compression/TopDownTruncationStrategy.js +74 -0
- package/dist/src/compression/TopDownTruncationStrategy.js.map +1 -0
- package/dist/src/compression/compressionBudgeting.d.ts +34 -0
- package/dist/src/compression/compressionBudgeting.js +139 -0
- package/dist/src/compression/compressionBudgeting.js.map +1 -0
- package/dist/src/compression/compressionStrategyFactory.d.ts +23 -0
- package/dist/src/compression/compressionStrategyFactory.js +40 -0
- package/dist/src/compression/compressionStrategyFactory.js.map +1 -0
- package/dist/src/compression/index.d.ts +16 -0
- package/dist/src/compression/index.js +17 -0
- package/dist/src/compression/index.js.map +1 -0
- package/dist/src/compression/reasoningUtils.d.ts +18 -0
- package/dist/src/compression/reasoningUtils.js +22 -0
- package/dist/src/compression/reasoningUtils.js.map +1 -0
- package/dist/src/compression/utils.d.ts +114 -0
- package/dist/src/compression/utils.js +316 -0
- package/dist/src/compression/utils.js.map +1 -0
- package/dist/src/core/AgentHookManager.d.ts +41 -0
- package/dist/src/core/AgentHookManager.js +65 -0
- package/dist/src/core/AgentHookManager.js.map +1 -0
- package/dist/src/core/ChatSessionFactory.d.ts +50 -0
- package/dist/src/core/ChatSessionFactory.js +216 -0
- package/dist/src/core/ChatSessionFactory.js.map +1 -0
- package/dist/src/core/ConversationManager.d.ts +113 -0
- package/dist/src/core/ConversationManager.js +311 -0
- package/dist/src/core/ConversationManager.js.map +1 -0
- package/dist/src/core/DirectMessageProcessor.d.ts +79 -0
- package/dist/src/core/DirectMessageProcessor.js +478 -0
- package/dist/src/core/DirectMessageProcessor.js.map +1 -0
- package/dist/src/core/IdeContextTracker.d.ts +56 -0
- package/dist/src/core/IdeContextTracker.js +207 -0
- package/dist/src/core/IdeContextTracker.js.map +1 -0
- package/dist/src/core/MessageConverter.d.ts +78 -0
- package/dist/src/core/MessageConverter.js +492 -0
- package/dist/src/core/MessageConverter.js.map +1 -0
- package/dist/src/core/MessageStreamOrchestrator.d.ts +85 -0
- package/dist/src/core/MessageStreamOrchestrator.js +448 -0
- package/dist/src/core/MessageStreamOrchestrator.js.map +1 -0
- package/dist/src/core/MessageStreamTerminalHandler.d.ts +16 -0
- package/dist/src/core/MessageStreamTerminalHandler.js +170 -0
- package/dist/src/core/MessageStreamTerminalHandler.js.map +1 -0
- package/dist/src/core/StreamProcessor.d.ts +105 -0
- package/dist/src/core/StreamProcessor.js +660 -0
- package/dist/src/core/StreamProcessor.js.map +1 -0
- package/dist/src/core/TodoContinuationService.d.ts +74 -0
- package/dist/src/core/TodoContinuationService.js +312 -0
- package/dist/src/core/TodoContinuationService.js.map +1 -0
- package/dist/src/core/TurnProcessor.d.ts +91 -0
- package/dist/src/core/TurnProcessor.js +540 -0
- package/dist/src/core/TurnProcessor.js.map +1 -0
- package/dist/src/core/baseLlmClient.d.ts +115 -0
- package/dist/src/core/baseLlmClient.js +231 -0
- package/dist/src/core/baseLlmClient.js.map +1 -0
- package/dist/src/core/bucketFailoverIntegration.d.ts +62 -0
- package/dist/src/core/bucketFailoverIntegration.js +186 -0
- package/dist/src/core/bucketFailoverIntegration.js.map +1 -0
- package/dist/src/core/chatSession.d.ts +121 -0
- package/dist/src/core/chatSession.js +720 -0
- package/dist/src/core/chatSession.js.map +1 -0
- package/dist/src/core/client.d.ts +132 -0
- package/dist/src/core/client.js +524 -0
- package/dist/src/core/client.js.map +1 -0
- package/dist/src/core/clientHelpers.d.ts +15 -0
- package/dist/src/core/clientHelpers.js +122 -0
- package/dist/src/core/clientHelpers.js.map +1 -0
- package/dist/src/core/clientLlmUtilities.d.ts +30 -0
- package/dist/src/core/clientLlmUtilities.js +125 -0
- package/dist/src/core/clientLlmUtilities.js.map +1 -0
- package/dist/src/core/clientToolGovernance.d.ts +37 -0
- package/dist/src/core/clientToolGovernance.js +104 -0
- package/dist/src/core/clientToolGovernance.js.map +1 -0
- package/dist/src/core/compression-config.d.ts +12 -0
- package/dist/src/core/compression-config.js +21 -0
- package/dist/src/core/compression-config.js.map +1 -0
- package/dist/src/core/coreToolScheduler.d.ts +105 -0
- package/dist/src/core/coreToolScheduler.js +453 -0
- package/dist/src/core/coreToolScheduler.js.map +1 -0
- package/dist/src/core/hookToolRestrictions.d.ts +18 -0
- package/dist/src/core/hookToolRestrictions.js +187 -0
- package/dist/src/core/hookToolRestrictions.js.map +1 -0
- package/dist/src/core/nonInteractiveToolExecutor.d.ts +17 -0
- package/dist/src/core/nonInteractiveToolExecutor.js +102 -0
- package/dist/src/core/nonInteractiveToolExecutor.js.map +1 -0
- package/dist/src/core/subagent.d.ts +105 -0
- package/dist/src/core/subagent.js +650 -0
- package/dist/src/core/subagent.js.map +1 -0
- package/dist/src/core/subagentExecution.d.ts +104 -0
- package/dist/src/core/subagentExecution.js +275 -0
- package/dist/src/core/subagentExecution.js.map +1 -0
- package/dist/src/core/subagentOrchestrator.d.ts +84 -0
- package/dist/src/core/subagentOrchestrator.js +503 -0
- package/dist/src/core/subagentOrchestrator.js.map +1 -0
- package/dist/src/core/subagentRuntimeSetup.d.ts +75 -0
- package/dist/src/core/subagentRuntimeSetup.js +387 -0
- package/dist/src/core/subagentRuntimeSetup.js.map +1 -0
- package/dist/src/core/subagentScheduler.d.ts +17 -0
- package/dist/src/core/subagentScheduler.js +7 -0
- package/dist/src/core/subagentScheduler.js.map +1 -0
- package/dist/src/core/subagentToolProcessing.d.ts +51 -0
- package/dist/src/core/subagentToolProcessing.js +359 -0
- package/dist/src/core/subagentToolProcessing.js.map +1 -0
- package/dist/src/core/toolGovernance.d.ts +18 -0
- package/dist/src/core/toolGovernance.js +50 -0
- package/dist/src/core/toolGovernance.js.map +1 -0
- package/dist/src/core/turn.d.ts +47 -0
- package/dist/src/core/turn.js +455 -0
- package/dist/src/core/turn.js.map +1 -0
- package/dist/src/core/turnLogging.d.ts +35 -0
- package/dist/src/core/turnLogging.js +80 -0
- package/dist/src/core/turnLogging.js.map +1 -0
- package/dist/src/index.d.ts +32 -0
- package/dist/src/index.js +44 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/scheduler/confirmation-coordinator.d.ts +139 -0
- package/dist/src/scheduler/confirmation-coordinator.js +443 -0
- package/dist/src/scheduler/confirmation-coordinator.js.map +1 -0
- package/dist/src/scheduler/result-aggregator.d.ts +127 -0
- package/dist/src/scheduler/result-aggregator.js +302 -0
- package/dist/src/scheduler/result-aggregator.js.map +1 -0
- package/dist/src/scheduler/status-transitions.d.ts +39 -0
- package/dist/src/scheduler/status-transitions.js +184 -0
- package/dist/src/scheduler/status-transitions.js.map +1 -0
- package/dist/src/scheduler/tool-dispatcher.d.ts +40 -0
- package/dist/src/scheduler/tool-dispatcher.js +120 -0
- package/dist/src/scheduler/tool-dispatcher.js.map +1 -0
- package/dist/src/scheduler/tool-executor.d.ts +44 -0
- package/dist/src/scheduler/tool-executor.js +117 -0
- package/dist/src/scheduler/tool-executor.js.map +1 -0
- package/dist/src/scheduler/utils.d.ts +11 -0
- package/dist/src/scheduler/utils.js +19 -0
- package/dist/src/scheduler/utils.js.map +1 -0
- package/dist/src/tools/task.d.ts +128 -0
- package/dist/src/tools/task.js +932 -0
- package/dist/src/tools/task.js.map +1 -0
- package/package.json +54 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @plan:PLAN-20260610-ISSUE1592.P02
|
|
3
|
+
* @requirement:REQ-PKG-001
|
|
4
|
+
*/
|
|
5
|
+
import { TaskTool } from './tools/task.js';
|
|
6
|
+
export { AgentClient, PostTurnAction } from './core/client.js';
|
|
7
|
+
export { ChatSession, StreamEventType, InvalidStreamError, } from './core/chatSession.js';
|
|
8
|
+
export * from './core/ChatSessionFactory.js';
|
|
9
|
+
export { CoreToolScheduler } from './core/coreToolScheduler.js';
|
|
10
|
+
export { executeToolCall } from './core/nonInteractiveToolExecutor.js';
|
|
11
|
+
export { SubagentOrchestrator } from './core/subagentOrchestrator.js';
|
|
12
|
+
export { TaskTool } from './tools/task.js';
|
|
13
|
+
export * from './core/turn.js';
|
|
14
|
+
export * from './core/subagent.js';
|
|
15
|
+
export * from './core/subagentExecution.js';
|
|
16
|
+
export * from './core/subagentRuntimeSetup.js';
|
|
17
|
+
export * from './core/subagentToolProcessing.js';
|
|
18
|
+
export * from './core/subagentScheduler.js';
|
|
19
|
+
export { buildToolGovernance, isToolBlocked, } from './core/toolGovernance.js';
|
|
20
|
+
export * from './compression/index.js';
|
|
21
|
+
export * from './agents/types.js';
|
|
22
|
+
export * from './agents/invocation.js';
|
|
23
|
+
export * from './agents/executor.js';
|
|
24
|
+
/**
|
|
25
|
+
* @plan PLAN-20260610-ISSUE1592.P03
|
|
26
|
+
* @requirement REQ-INV-003
|
|
27
|
+
*
|
|
28
|
+
* Creates the core-owned TaskToolRegistration descriptor without requiring core
|
|
29
|
+
* to import the concrete agents-owned TaskTool class.
|
|
30
|
+
*/
|
|
31
|
+
export function createTaskToolRegistration() {
|
|
32
|
+
return {
|
|
33
|
+
toolClass: TaskTool,
|
|
34
|
+
className: 'TaskTool',
|
|
35
|
+
staticName: TaskTool.Name,
|
|
36
|
+
buildArgs(config, taskToolArgs) {
|
|
37
|
+
return [config, taskToolArgs];
|
|
38
|
+
},
|
|
39
|
+
create(config, taskToolArgs) {
|
|
40
|
+
return new TaskTool(config, taskToolArgs);
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAaH,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAE3C,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EACL,WAAW,EACX,eAAe,EACf,kBAAkB,GAEnB,MAAM,uBAAuB,CAAC;AAC/B,cAAc,8BAA8B,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AACvE,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AACtE,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAE3C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,kCAAkC,CAAC;AACjD,cAAc,6BAA6B,CAAC;AAC5C,OAAO,EACL,mBAAmB,EACnB,aAAa,GAGd,MAAM,0BAA0B,CAAC;AAClC,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC;AAErC;;;;;;GAMG;AACH,MAAM,UAAU,0BAA0B;IACxC,OAAO;QACL,SAAS,EAAE,QAAQ;QACnB,SAAS,EAAE,UAAU;QACrB,UAAU,EAAE,QAAQ,CAAC,IAAI;QACzB,SAAS,CAAC,MAAe,EAAE,YAA0B;YACnD,OAAO,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;QAChC,CAAC;QACD,MAAM,CAAC,MAAe,EAAE,YAA0B;YAChD,OAAO,IAAI,QAAQ,CAAC,MAAgB,EAAE,YAAY,CAAC,CAAC;QACtD,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import type { Config } from '@vybestack/llxprt-code-core/config/config.js';
|
|
7
|
+
import type { MessageBus } from '@vybestack/llxprt-code-core/confirmation-bus/message-bus.js';
|
|
8
|
+
import { type SerializableConfirmationDetails } from '@vybestack/llxprt-code-core/confirmation-bus/types.js';
|
|
9
|
+
import { ToolConfirmationOutcome } from '@vybestack/llxprt-code-tools';
|
|
10
|
+
import type { ToolCallConfirmationDetails } from '@vybestack/llxprt-code-tools';
|
|
11
|
+
import type { ToolConfirmationPayload } from '@vybestack/llxprt-code-tools';
|
|
12
|
+
import type { ToolCallResponseInfo } from '../core/turn.js';
|
|
13
|
+
import type { ToolCall, ValidatingToolCall } from '@vybestack/llxprt-code-core/scheduler/types.js';
|
|
14
|
+
import type { EditorType } from '@vybestack/llxprt-code-core/utils/editor.js';
|
|
15
|
+
/**
|
|
16
|
+
* Discriminated status-mutation callbacks provided by CoreToolScheduler.
|
|
17
|
+
* Each method maps 1:1 to a setStatusInternal overload.
|
|
18
|
+
*/
|
|
19
|
+
export interface StatusMutator {
|
|
20
|
+
setSuccess(callId: string, response: ToolCallResponseInfo): void;
|
|
21
|
+
setError(callId: string, response: ToolCallResponseInfo): void;
|
|
22
|
+
setCancelled(callId: string, reason: string): void;
|
|
23
|
+
setAwaitingApproval(callId: string, details: ToolCallConfirmationDetails | SerializableConfirmationDetails): void;
|
|
24
|
+
setScheduled(callId: string): void;
|
|
25
|
+
setExecuting(callId: string): void;
|
|
26
|
+
setValidating(callId: string): void;
|
|
27
|
+
setArgs(callId: string, args: unknown): void;
|
|
28
|
+
setOutcome(callId: string, outcome: ToolConfirmationOutcome): void;
|
|
29
|
+
approve(callId: string): void;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Accessor into the scheduler for reading tool call state and triggering
|
|
33
|
+
* execution. The getter MUST return the current array on each call — stored
|
|
34
|
+
* references become stale because setStatusInternal reassigns toolCalls[].
|
|
35
|
+
*/
|
|
36
|
+
export interface SchedulerAccessor {
|
|
37
|
+
attemptExecution(signal: AbortSignal): Promise<void>;
|
|
38
|
+
getToolCalls(): readonly ToolCall[];
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Editor-related callbacks from the host environment.
|
|
42
|
+
*/
|
|
43
|
+
export interface EditorCallbacks {
|
|
44
|
+
getPreferredEditor(): EditorType | undefined;
|
|
45
|
+
onEditorClose(): void;
|
|
46
|
+
onEditorOpen?(): void;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Coordinates the full confirmation flow for tool execution:
|
|
50
|
+
* - Policy evaluation and routing (ALLOW/DENY/ASK)
|
|
51
|
+
* - Confirmation prompt setup and MessageBus subscription
|
|
52
|
+
* - Handling all confirmation outcomes (ProceedOnce, ProceedAlways, Cancel,
|
|
53
|
+
* ModifyWithEditor, SuggestEdit, inline modify)
|
|
54
|
+
* - Auto-approving compatible pending tools after ProceedAlways
|
|
55
|
+
* - Stale correlation ID grace-period management
|
|
56
|
+
*/
|
|
57
|
+
export declare class ConfirmationCoordinator {
|
|
58
|
+
private readonly messageBus;
|
|
59
|
+
private readonly config;
|
|
60
|
+
private readonly statusMutator;
|
|
61
|
+
private readonly schedulerAccessor;
|
|
62
|
+
private readonly editorCallbacks;
|
|
63
|
+
private readonly onToolNotification;
|
|
64
|
+
/** correlationId → callId */
|
|
65
|
+
private readonly pendingConfirmations;
|
|
66
|
+
/** correlationId → timeout handle — tracks stale IDs after ModifyWithEditor */
|
|
67
|
+
private readonly staleCorrelationIds;
|
|
68
|
+
/** callIds already processed — prevents double-handling */
|
|
69
|
+
private readonly processedConfirmations;
|
|
70
|
+
/** callId → AbortSignal — populated via registerSignal(), removed via deleteSignal() */
|
|
71
|
+
private readonly callIdToSignal;
|
|
72
|
+
/** MessageBus unsubscribe handle */
|
|
73
|
+
private messageBusUnsubscribe?;
|
|
74
|
+
constructor(messageBus: MessageBus, config: Config, statusMutator: StatusMutator, schedulerAccessor: SchedulerAccessor, editorCallbacks: EditorCallbacks, onToolNotification: (config: Config, details: ToolCallConfirmationDetails) => Promise<unknown>);
|
|
75
|
+
/** Subscribe to MessageBus TOOL_CONFIRMATION_RESPONSE events. */
|
|
76
|
+
subscribe(): void;
|
|
77
|
+
/** Unsubscribe from MessageBus and reset all state. */
|
|
78
|
+
dispose(): void;
|
|
79
|
+
/** Clear all maps, sets, and timers. Called during cancelAll(). */
|
|
80
|
+
reset(): void;
|
|
81
|
+
/** Store an AbortSignal for a tool call so MessageBus responses can use it. */
|
|
82
|
+
registerSignal(callId: string, signal: AbortSignal): void;
|
|
83
|
+
/** Remove the signal on terminal completion. */
|
|
84
|
+
deleteSignal(callId: string): void;
|
|
85
|
+
/**
|
|
86
|
+
* Synchronous fast-path for ALLOW and DENY policy decisions.
|
|
87
|
+
* Returns true if the decision was handled synchronously (no async work needed).
|
|
88
|
+
* Returns false if the decision is ASK and requires async confirmation.
|
|
89
|
+
*
|
|
90
|
+
* This preserves the synchronous approval semantics of the original _schedule loop,
|
|
91
|
+
* which is critical for tests that rely on all tools reaching 'executing' state
|
|
92
|
+
* within the same microtask as schedule().
|
|
93
|
+
*/
|
|
94
|
+
tryFastApprove(toolCall: ValidatingToolCall): boolean;
|
|
95
|
+
/**
|
|
96
|
+
* Async confirmation path for PolicyDecision.ASK.
|
|
97
|
+
* Called only when tryFastApprove returns false.
|
|
98
|
+
*/
|
|
99
|
+
evaluateAndRoute(toolCall: ValidatingToolCall, signal: AbortSignal): Promise<void>;
|
|
100
|
+
/**
|
|
101
|
+
* Set up the interactive confirmation prompt:
|
|
102
|
+
* - Wire IDE resolution promise if present
|
|
103
|
+
* - Wrap onConfirm to route through handleConfirmationResponse
|
|
104
|
+
* - Publish confirmation request and set awaiting_approval status
|
|
105
|
+
*/
|
|
106
|
+
private setupConfirmationPrompt;
|
|
107
|
+
/**
|
|
108
|
+
* Called when a TOOL_CONFIRMATION_RESPONSE arrives on the MessageBus.
|
|
109
|
+
* Validates the correlation, derives the outcome, and dispatches to
|
|
110
|
+
* handleConfirmationResponse.
|
|
111
|
+
*/
|
|
112
|
+
private handleMessageBusResponse;
|
|
113
|
+
private deriveOutcome;
|
|
114
|
+
/**
|
|
115
|
+
* Public facade: handle a confirmation response for the given callId.
|
|
116
|
+
* Routes to the appropriate sub-handler based on the outcome.
|
|
117
|
+
*/
|
|
118
|
+
handleConfirmationResponse(callId: string, originalOnConfirm: (outcome: ToolConfirmationOutcome, payload?: ToolConfirmationPayload) => Promise<void>, outcome: ToolConfirmationOutcome, signal: AbortSignal, payload?: ToolConfirmationPayload, skipBusPublish?: boolean): Promise<void>;
|
|
119
|
+
private handleCancellation;
|
|
120
|
+
private handleApproval;
|
|
121
|
+
private handleSuggestEdit;
|
|
122
|
+
private handleInlineModify;
|
|
123
|
+
private handleModifyWithEditor;
|
|
124
|
+
private registerStaleCorrelationId;
|
|
125
|
+
/**
|
|
126
|
+
* After a ProceedAlways outcome, check all other pending tools and
|
|
127
|
+
* auto-approve those that no longer need confirmation.
|
|
128
|
+
*/
|
|
129
|
+
private autoApproveCompatiblePendingTools;
|
|
130
|
+
/**
|
|
131
|
+
* Applies user-provided content changes to a tool call awaiting confirmation.
|
|
132
|
+
* Updates the tool's arguments and refreshes the confirmation prompt with a
|
|
133
|
+
* new diff.
|
|
134
|
+
*/
|
|
135
|
+
private _applyInlineModify;
|
|
136
|
+
private publishOutcome;
|
|
137
|
+
private approveInternal;
|
|
138
|
+
private findWaitingToolCall;
|
|
139
|
+
}
|
|
@@ -0,0 +1,443 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* @internal
|
|
8
|
+
* Owns the entire confirmation flow lifecycle: MessageBus subscription,
|
|
9
|
+
* policy evaluation routing, approval/cancel/modify/suggest-edit handling,
|
|
10
|
+
* stale correlation management, and auto-approve cascading.
|
|
11
|
+
*
|
|
12
|
+
* Extracted from CoreToolScheduler as part of the Phase 3 decomposition
|
|
13
|
+
* (issue 1580).
|
|
14
|
+
*/
|
|
15
|
+
import { randomUUID } from 'node:crypto';
|
|
16
|
+
import * as Diff from 'diff';
|
|
17
|
+
import { ApprovalMode } from '@vybestack/llxprt-code-core/config/config.js';
|
|
18
|
+
import { MessageBusType, } from '@vybestack/llxprt-code-core/confirmation-bus/types.js';
|
|
19
|
+
import { ToolConfirmationOutcome } from '@vybestack/llxprt-code-tools';
|
|
20
|
+
import { PolicyDecision } from '@vybestack/llxprt-code-core/policy/types.js';
|
|
21
|
+
import { evaluatePolicyDecision, handlePolicyDenial, getPolicyContextFromInvocation, publishConfirmationRequest, } from '@vybestack/llxprt-code-core/policy/policy-helpers.js';
|
|
22
|
+
import { isModifiableDeclarativeTool, modifyWithEditor, } from '@vybestack/llxprt-code-tools';
|
|
23
|
+
import { doesToolInvocationMatch } from '@vybestack/llxprt-code-core/utils/tool-utils.js';
|
|
24
|
+
import { DebugLogger } from '@vybestack/llxprt-code-core/debug/index.js';
|
|
25
|
+
const logger = new DebugLogger('llxprt:scheduler:confirmation-coordinator');
|
|
26
|
+
function isInteractiveConfirmationDetails(details) {
|
|
27
|
+
return 'onConfirm' in details;
|
|
28
|
+
}
|
|
29
|
+
function getConfirmationCorrelationId(details) {
|
|
30
|
+
if (!details || !('correlationId' in details)) {
|
|
31
|
+
return undefined;
|
|
32
|
+
}
|
|
33
|
+
const correlationId = details.correlationId;
|
|
34
|
+
return typeof correlationId === 'string' ? correlationId : undefined;
|
|
35
|
+
}
|
|
36
|
+
// ── ConfirmationCoordinator ───────────────────────────────────────────────
|
|
37
|
+
/**
|
|
38
|
+
* Coordinates the full confirmation flow for tool execution:
|
|
39
|
+
* - Policy evaluation and routing (ALLOW/DENY/ASK)
|
|
40
|
+
* - Confirmation prompt setup and MessageBus subscription
|
|
41
|
+
* - Handling all confirmation outcomes (ProceedOnce, ProceedAlways, Cancel,
|
|
42
|
+
* ModifyWithEditor, SuggestEdit, inline modify)
|
|
43
|
+
* - Auto-approving compatible pending tools after ProceedAlways
|
|
44
|
+
* - Stale correlation ID grace-period management
|
|
45
|
+
*/
|
|
46
|
+
export class ConfirmationCoordinator {
|
|
47
|
+
messageBus;
|
|
48
|
+
config;
|
|
49
|
+
statusMutator;
|
|
50
|
+
schedulerAccessor;
|
|
51
|
+
editorCallbacks;
|
|
52
|
+
onToolNotification;
|
|
53
|
+
/** correlationId → callId */
|
|
54
|
+
pendingConfirmations = new Map();
|
|
55
|
+
/** correlationId → timeout handle — tracks stale IDs after ModifyWithEditor */
|
|
56
|
+
staleCorrelationIds = new Map();
|
|
57
|
+
/** callIds already processed — prevents double-handling */
|
|
58
|
+
processedConfirmations = new Set();
|
|
59
|
+
/** callId → AbortSignal — populated via registerSignal(), removed via deleteSignal() */
|
|
60
|
+
callIdToSignal = new Map();
|
|
61
|
+
/** MessageBus unsubscribe handle */
|
|
62
|
+
messageBusUnsubscribe;
|
|
63
|
+
constructor(messageBus, config, statusMutator, schedulerAccessor, editorCallbacks, onToolNotification) {
|
|
64
|
+
this.messageBus = messageBus;
|
|
65
|
+
this.config = config;
|
|
66
|
+
this.statusMutator = statusMutator;
|
|
67
|
+
this.schedulerAccessor = schedulerAccessor;
|
|
68
|
+
this.editorCallbacks = editorCallbacks;
|
|
69
|
+
this.onToolNotification = onToolNotification;
|
|
70
|
+
}
|
|
71
|
+
// ── Lifecycle ──────────────────────────────────────────────────────────────
|
|
72
|
+
/** Subscribe to MessageBus TOOL_CONFIRMATION_RESPONSE events. */
|
|
73
|
+
subscribe() {
|
|
74
|
+
this.messageBusUnsubscribe =
|
|
75
|
+
this.messageBus.subscribe(MessageBusType.TOOL_CONFIRMATION_RESPONSE, this.handleMessageBusResponse.bind(this));
|
|
76
|
+
}
|
|
77
|
+
/** Unsubscribe from MessageBus and reset all state. */
|
|
78
|
+
dispose() {
|
|
79
|
+
if (this.messageBusUnsubscribe) {
|
|
80
|
+
this.messageBusUnsubscribe();
|
|
81
|
+
this.messageBusUnsubscribe = undefined;
|
|
82
|
+
}
|
|
83
|
+
this.reset();
|
|
84
|
+
}
|
|
85
|
+
/** Clear all maps, sets, and timers. Called during cancelAll(). */
|
|
86
|
+
reset() {
|
|
87
|
+
this.pendingConfirmations.clear();
|
|
88
|
+
this.processedConfirmations.clear();
|
|
89
|
+
this.staleCorrelationIds.forEach((t) => clearTimeout(t));
|
|
90
|
+
this.staleCorrelationIds.clear();
|
|
91
|
+
this.callIdToSignal.clear();
|
|
92
|
+
}
|
|
93
|
+
// ── Signal lifecycle ───────────────────────────────────────────────────────
|
|
94
|
+
/** Store an AbortSignal for a tool call so MessageBus responses can use it. */
|
|
95
|
+
registerSignal(callId, signal) {
|
|
96
|
+
this.callIdToSignal.set(callId, signal);
|
|
97
|
+
}
|
|
98
|
+
/** Remove the signal on terminal completion. */
|
|
99
|
+
deleteSignal(callId) {
|
|
100
|
+
this.callIdToSignal.delete(callId);
|
|
101
|
+
}
|
|
102
|
+
// ── Policy evaluation and routing ─────────────────────────────────────────
|
|
103
|
+
/**
|
|
104
|
+
* Synchronous fast-path for ALLOW and DENY policy decisions.
|
|
105
|
+
* Returns true if the decision was handled synchronously (no async work needed).
|
|
106
|
+
* Returns false if the decision is ASK and requires async confirmation.
|
|
107
|
+
*
|
|
108
|
+
* This preserves the synchronous approval semantics of the original _schedule loop,
|
|
109
|
+
* which is critical for tests that rely on all tools reaching 'executing' state
|
|
110
|
+
* within the same microtask as schedule().
|
|
111
|
+
*/
|
|
112
|
+
tryFastApprove(toolCall) {
|
|
113
|
+
const { request: reqInfo, invocation } = toolCall;
|
|
114
|
+
const evaluation = evaluatePolicyDecision(invocation, reqInfo, this.config.getPolicyEngine());
|
|
115
|
+
if (evaluation.decision === PolicyDecision.ALLOW) {
|
|
116
|
+
this.approveInternal(reqInfo.callId);
|
|
117
|
+
return true;
|
|
118
|
+
}
|
|
119
|
+
if (evaluation.decision === PolicyDecision.DENY) {
|
|
120
|
+
handlePolicyDenial(reqInfo, evaluation.context, (callId, _status, response) => this.statusMutator.setError(callId, response), this.messageBus);
|
|
121
|
+
return true;
|
|
122
|
+
}
|
|
123
|
+
return false;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Async confirmation path for PolicyDecision.ASK.
|
|
127
|
+
* Called only when tryFastApprove returns false.
|
|
128
|
+
*/
|
|
129
|
+
async evaluateAndRoute(toolCall, signal) {
|
|
130
|
+
const { request: reqInfo, invocation } = toolCall;
|
|
131
|
+
const evaluation = evaluatePolicyDecision(invocation, reqInfo, this.config.getPolicyEngine());
|
|
132
|
+
// ALLOW and DENY should have been handled by tryFastApprove, but
|
|
133
|
+
// handle them here as well for safety
|
|
134
|
+
if (evaluation.decision === PolicyDecision.ALLOW) {
|
|
135
|
+
this.approveInternal(reqInfo.callId);
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
if (evaluation.decision === PolicyDecision.DENY) {
|
|
139
|
+
handlePolicyDenial(reqInfo, evaluation.context, (callId, _status, response) => this.statusMutator.setError(callId, response), this.messageBus);
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
// PolicyDecision.ASK — check shouldConfirmExecute
|
|
143
|
+
const confirmationDetails = await invocation.shouldConfirmExecute(signal);
|
|
144
|
+
if (confirmationDetails === false ||
|
|
145
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- Scheduler plugin boundary can return malformed nullish values at runtime.
|
|
146
|
+
confirmationDetails == null) {
|
|
147
|
+
this.approveInternal(reqInfo.callId);
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
const allowedTools = this.config.getAllowedTools() ?? [];
|
|
151
|
+
if (this.config.getApprovalMode() === ApprovalMode.YOLO ||
|
|
152
|
+
doesToolInvocationMatch(toolCall.tool, invocation, allowedTools)) {
|
|
153
|
+
this.approveInternal(reqInfo.callId);
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
await this.setupConfirmationPrompt(toolCall, signal, confirmationDetails, evaluation.context);
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Set up the interactive confirmation prompt:
|
|
160
|
+
* - Wire IDE resolution promise if present
|
|
161
|
+
* - Wrap onConfirm to route through handleConfirmationResponse
|
|
162
|
+
* - Publish confirmation request and set awaiting_approval status
|
|
163
|
+
*/
|
|
164
|
+
async setupConfirmationPrompt(toolCall, signal, confirmationDetails, policyContext) {
|
|
165
|
+
const { request: reqInfo } = toolCall;
|
|
166
|
+
if (!this.config.isInteractive()) {
|
|
167
|
+
throw new Error(`Tool execution for "${toolCall.tool.displayName || toolCall.tool.name}" requires user confirmation, which is not supported in non-interactive mode.`);
|
|
168
|
+
}
|
|
169
|
+
if (confirmationDetails.type === 'edit' &&
|
|
170
|
+
confirmationDetails.ideConfirmation) {
|
|
171
|
+
void confirmationDetails.ideConfirmation.then((resolution) => {
|
|
172
|
+
const outcome = resolution.status === 'accepted'
|
|
173
|
+
? ToolConfirmationOutcome.ProceedOnce
|
|
174
|
+
: ToolConfirmationOutcome.Cancel;
|
|
175
|
+
void this.handleConfirmationResponse(reqInfo.callId, confirmationDetails.onConfirm, outcome, signal);
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
const originalOnConfirm = confirmationDetails.onConfirm;
|
|
179
|
+
const correlationId = randomUUID();
|
|
180
|
+
const wrappedDetails = {
|
|
181
|
+
...confirmationDetails,
|
|
182
|
+
correlationId,
|
|
183
|
+
onConfirm: (outcome, payload) => this.handleConfirmationResponse(reqInfo.callId, originalOnConfirm, outcome, signal, payload, false),
|
|
184
|
+
};
|
|
185
|
+
this.pendingConfirmations.set(correlationId, reqInfo.callId);
|
|
186
|
+
void this.onToolNotification(this.config, wrappedDetails);
|
|
187
|
+
publishConfirmationRequest(correlationId, policyContext, this.messageBus);
|
|
188
|
+
this.statusMutator.setAwaitingApproval(reqInfo.callId, wrappedDetails);
|
|
189
|
+
}
|
|
190
|
+
// ── MessageBus handler ────────────────────────────────────────────────────
|
|
191
|
+
/**
|
|
192
|
+
* Called when a TOOL_CONFIRMATION_RESPONSE arrives on the MessageBus.
|
|
193
|
+
* Validates the correlation, derives the outcome, and dispatches to
|
|
194
|
+
* handleConfirmationResponse.
|
|
195
|
+
*/
|
|
196
|
+
handleMessageBusResponse(response) {
|
|
197
|
+
const callId = this.pendingConfirmations.get(response.correlationId);
|
|
198
|
+
if (!callId && this.staleCorrelationIds.has(response.correlationId)) {
|
|
199
|
+
if (logger.enabled) {
|
|
200
|
+
logger.debug(() => `Received TOOL_CONFIRMATION_RESPONSE for stale correlationId=${response.correlationId}. Ignoring.`);
|
|
201
|
+
}
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
if (!callId) {
|
|
205
|
+
if (logger.enabled) {
|
|
206
|
+
logger.debug(() => `Received TOOL_CONFIRMATION_RESPONSE for unknown correlationId=${response.correlationId}`);
|
|
207
|
+
}
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
210
|
+
const waitingToolCall = this.schedulerAccessor
|
|
211
|
+
.getToolCalls()
|
|
212
|
+
.find((call) => call.request.callId === callId && call.status === 'awaiting_approval');
|
|
213
|
+
if (!waitingToolCall) {
|
|
214
|
+
if (logger.enabled) {
|
|
215
|
+
logger.debug(() => `No waiting tool call found for correlationId=${response.correlationId}, callId=${callId}`);
|
|
216
|
+
}
|
|
217
|
+
this.pendingConfirmations.delete(response.correlationId);
|
|
218
|
+
return;
|
|
219
|
+
}
|
|
220
|
+
const derivedOutcome = this.deriveOutcome(response);
|
|
221
|
+
const signal = this.callIdToSignal.get(callId);
|
|
222
|
+
if (!signal) {
|
|
223
|
+
if (logger.enabled) {
|
|
224
|
+
logger.debug(() => `Skipping TOOL_CONFIRMATION_RESPONSE for callId=${callId} — signal missing (call already finalized).`);
|
|
225
|
+
}
|
|
226
|
+
this.pendingConfirmations.delete(response.correlationId);
|
|
227
|
+
return;
|
|
228
|
+
}
|
|
229
|
+
if (!isInteractiveConfirmationDetails(waitingToolCall.confirmationDetails)) {
|
|
230
|
+
if (logger.enabled) {
|
|
231
|
+
logger.debug(() => `Skipping TOOL_CONFIRMATION_RESPONSE for callId=${callId} — confirmation details are not interactive.`);
|
|
232
|
+
}
|
|
233
|
+
this.pendingConfirmations.delete(response.correlationId);
|
|
234
|
+
this.statusMutator.setOutcome(callId, ToolConfirmationOutcome.Cancel);
|
|
235
|
+
void this.handleCancellation(callId);
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
void this.handleConfirmationResponse(callId, waitingToolCall.confirmationDetails.onConfirm, derivedOutcome, signal, response.payload, true);
|
|
239
|
+
}
|
|
240
|
+
deriveOutcome(response) {
|
|
241
|
+
return (response.outcome ??
|
|
242
|
+
(response.confirmed !== undefined
|
|
243
|
+
? // eslint-disable-next-line sonarjs/no-nested-conditional -- Existing structure is intentionally preserved; refactoring this boundary is outside the lint slice.
|
|
244
|
+
response.confirmed
|
|
245
|
+
? ToolConfirmationOutcome.ProceedOnce
|
|
246
|
+
: ToolConfirmationOutcome.Cancel
|
|
247
|
+
: ToolConfirmationOutcome.Cancel));
|
|
248
|
+
}
|
|
249
|
+
// ── Main confirmation dispatcher ──────────────────────────────────────────
|
|
250
|
+
/**
|
|
251
|
+
* Public facade: handle a confirmation response for the given callId.
|
|
252
|
+
* Routes to the appropriate sub-handler based on the outcome.
|
|
253
|
+
*/
|
|
254
|
+
async handleConfirmationResponse(callId, originalOnConfirm, outcome, signal, payload, skipBusPublish = false) {
|
|
255
|
+
if (this.processedConfirmations.has(callId)) {
|
|
256
|
+
if (logger.enabled) {
|
|
257
|
+
logger.debug(() => `Skipping duplicate confirmation for callId=${callId}`);
|
|
258
|
+
}
|
|
259
|
+
return;
|
|
260
|
+
}
|
|
261
|
+
this.processedConfirmations.add(callId);
|
|
262
|
+
const waitingToolCall = this.findWaitingToolCall(callId);
|
|
263
|
+
const previousCorrelationId = getConfirmationCorrelationId(waitingToolCall?.confirmationDetails);
|
|
264
|
+
await originalOnConfirm(outcome, payload);
|
|
265
|
+
if (outcome === ToolConfirmationOutcome.ProceedAlways) {
|
|
266
|
+
await this.autoApproveCompatiblePendingTools(signal, callId);
|
|
267
|
+
}
|
|
268
|
+
this.statusMutator.setOutcome(callId, outcome);
|
|
269
|
+
if (outcome === ToolConfirmationOutcome.Cancel || signal.aborted) {
|
|
270
|
+
await this.handleCancellation(callId);
|
|
271
|
+
}
|
|
272
|
+
else if (outcome === ToolConfirmationOutcome.ModifyWithEditor &&
|
|
273
|
+
waitingToolCall) {
|
|
274
|
+
await this.handleModifyWithEditor(callId, waitingToolCall, signal);
|
|
275
|
+
}
|
|
276
|
+
else {
|
|
277
|
+
await this.handleApproval(callId, waitingToolCall, outcome, payload, signal);
|
|
278
|
+
}
|
|
279
|
+
await this.publishOutcome(previousCorrelationId, outcome, payload, skipBusPublish);
|
|
280
|
+
}
|
|
281
|
+
// ── Sub-handlers ──────────────────────────────────────────────────────────
|
|
282
|
+
async handleCancellation(callId) {
|
|
283
|
+
this.statusMutator.setCancelled(callId, 'User did not allow tool call');
|
|
284
|
+
}
|
|
285
|
+
async handleApproval(callId, waitingToolCall, outcome, payload, signal) {
|
|
286
|
+
if (outcome === ToolConfirmationOutcome.SuggestEdit && waitingToolCall) {
|
|
287
|
+
this.handleSuggestEdit(callId, waitingToolCall, payload);
|
|
288
|
+
}
|
|
289
|
+
else if (payload?.newContent && waitingToolCall) {
|
|
290
|
+
await this.handleInlineModify(callId, waitingToolCall, payload, signal);
|
|
291
|
+
return; // setScheduled is called inside handleInlineModify
|
|
292
|
+
}
|
|
293
|
+
this.statusMutator.setScheduled(callId);
|
|
294
|
+
await this.schedulerAccessor.attemptExecution(signal);
|
|
295
|
+
}
|
|
296
|
+
handleSuggestEdit(callId, waitingToolCall, payload) {
|
|
297
|
+
if (waitingToolCall.confirmationDetails.type === 'exec' &&
|
|
298
|
+
payload?.editedCommand) {
|
|
299
|
+
const updatedArgs = {
|
|
300
|
+
...waitingToolCall.request.args,
|
|
301
|
+
command: payload.editedCommand,
|
|
302
|
+
};
|
|
303
|
+
this.statusMutator.setArgs(callId, updatedArgs);
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
async handleInlineModify(callId, waitingToolCall, payload, signal) {
|
|
307
|
+
await this._applyInlineModify(waitingToolCall, payload.newContent, signal);
|
|
308
|
+
this.statusMutator.setScheduled(callId);
|
|
309
|
+
await this.schedulerAccessor.attemptExecution(signal);
|
|
310
|
+
}
|
|
311
|
+
async handleModifyWithEditor(callId, waitingToolCall, signal) {
|
|
312
|
+
if (!isModifiableDeclarativeTool(waitingToolCall.tool)) {
|
|
313
|
+
return;
|
|
314
|
+
}
|
|
315
|
+
const modifyContext = waitingToolCall.tool.getModifyContext(signal);
|
|
316
|
+
const editorType = this.editorCallbacks.getPreferredEditor();
|
|
317
|
+
if (!editorType) {
|
|
318
|
+
return;
|
|
319
|
+
}
|
|
320
|
+
this.statusMutator.setAwaitingApproval(callId, {
|
|
321
|
+
...waitingToolCall.confirmationDetails,
|
|
322
|
+
isModifying: true,
|
|
323
|
+
});
|
|
324
|
+
const contentOverrides = waitingToolCall.confirmationDetails.type === 'edit'
|
|
325
|
+
? {
|
|
326
|
+
currentContent: waitingToolCall.confirmationDetails.originalContent,
|
|
327
|
+
proposedContent: waitingToolCall.confirmationDetails.newContent,
|
|
328
|
+
}
|
|
329
|
+
: undefined;
|
|
330
|
+
const { updatedParams, updatedDiff } = await modifyWithEditor(waitingToolCall.request.args, modifyContext, editorType, signal, this.editorCallbacks.onEditorClose, this.editorCallbacks.onEditorOpen, contentOverrides);
|
|
331
|
+
this.statusMutator.setArgs(callId, updatedParams);
|
|
332
|
+
const newCorrelationId = randomUUID();
|
|
333
|
+
const updatedDetails = {
|
|
334
|
+
...waitingToolCall.confirmationDetails,
|
|
335
|
+
fileDiff: updatedDiff,
|
|
336
|
+
isModifying: false,
|
|
337
|
+
correlationId: newCorrelationId,
|
|
338
|
+
};
|
|
339
|
+
this.pendingConfirmations.set(newCorrelationId, callId);
|
|
340
|
+
this.processedConfirmations.delete(callId);
|
|
341
|
+
const context = getPolicyContextFromInvocation(waitingToolCall.invocation, waitingToolCall.request);
|
|
342
|
+
publishConfirmationRequest(newCorrelationId, context, this.messageBus);
|
|
343
|
+
this.statusMutator.setAwaitingApproval(callId, updatedDetails);
|
|
344
|
+
this.registerStaleCorrelationId(getConfirmationCorrelationId(waitingToolCall.confirmationDetails), newCorrelationId);
|
|
345
|
+
}
|
|
346
|
+
registerStaleCorrelationId(previousCorrelationId, newCorrelationId) {
|
|
347
|
+
if (!previousCorrelationId)
|
|
348
|
+
return;
|
|
349
|
+
const graceTimeout = setTimeout(() => {
|
|
350
|
+
this.staleCorrelationIds.delete(previousCorrelationId);
|
|
351
|
+
if (logger.enabled) {
|
|
352
|
+
logger.debug(() => `Removed stale correlationId=${previousCorrelationId} after grace period`);
|
|
353
|
+
}
|
|
354
|
+
}, 2000);
|
|
355
|
+
this.staleCorrelationIds.set(previousCorrelationId, graceTimeout);
|
|
356
|
+
if (logger.enabled) {
|
|
357
|
+
logger.debug(() => `Marked correlationId=${previousCorrelationId} as stale with 2s grace period after ModifyWithEditor created new correlationId=${newCorrelationId}`);
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
// ── Auto-approve cascade ──────────────────────────────────────────────────
|
|
361
|
+
/**
|
|
362
|
+
* After a ProceedAlways outcome, check all other pending tools and
|
|
363
|
+
* auto-approve those that no longer need confirmation.
|
|
364
|
+
*/
|
|
365
|
+
async autoApproveCompatiblePendingTools(signal, triggeringCallId) {
|
|
366
|
+
const pendingTools = this.schedulerAccessor
|
|
367
|
+
.getToolCalls()
|
|
368
|
+
.filter((call) => call.status === 'awaiting_approval' &&
|
|
369
|
+
call.request.callId !== triggeringCallId);
|
|
370
|
+
for (const pendingTool of pendingTools) {
|
|
371
|
+
try {
|
|
372
|
+
const stillNeedsConfirmation = await pendingTool.invocation.shouldConfirmExecute(signal);
|
|
373
|
+
if (stillNeedsConfirmation === false ||
|
|
374
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- Scheduler plugin boundary can return malformed nullish values at runtime.
|
|
375
|
+
stillNeedsConfirmation == null) {
|
|
376
|
+
this.statusMutator.setOutcome(pendingTool.request.callId, ToolConfirmationOutcome.ProceedAlways);
|
|
377
|
+
this.statusMutator.setScheduled(pendingTool.request.callId);
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
catch (error) {
|
|
381
|
+
logger.debug(() => `Error checking confirmation for tool ${pendingTool.request.callId}: ${error}`);
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
// ── Inline modify ─────────────────────────────────────────────────────────
|
|
386
|
+
/**
|
|
387
|
+
* Applies user-provided content changes to a tool call awaiting confirmation.
|
|
388
|
+
* Updates the tool's arguments and refreshes the confirmation prompt with a
|
|
389
|
+
* new diff.
|
|
390
|
+
*/
|
|
391
|
+
async _applyInlineModify(toolCall, newContent, signal) {
|
|
392
|
+
if (toolCall.confirmationDetails.type !== 'edit' ||
|
|
393
|
+
!isModifiableDeclarativeTool(toolCall.tool)) {
|
|
394
|
+
return;
|
|
395
|
+
}
|
|
396
|
+
const modifyContext = toolCall.tool.getModifyContext(signal);
|
|
397
|
+
const currentContent = await modifyContext.getCurrentContent(toolCall.request.args);
|
|
398
|
+
const updatedParams = modifyContext.createUpdatedParams(currentContent, newContent, toolCall.request.args);
|
|
399
|
+
const updatedDiff = Diff.createPatch(modifyContext.getFilePath(toolCall.request.args), currentContent, newContent, 'Current', 'Proposed');
|
|
400
|
+
this.statusMutator.setArgs(toolCall.request.callId, updatedParams);
|
|
401
|
+
if (!isInteractiveConfirmationDetails(toolCall.confirmationDetails)) {
|
|
402
|
+
return;
|
|
403
|
+
}
|
|
404
|
+
this.statusMutator.setAwaitingApproval(toolCall.request.callId, {
|
|
405
|
+
...toolCall.confirmationDetails,
|
|
406
|
+
fileDiff: updatedDiff,
|
|
407
|
+
});
|
|
408
|
+
}
|
|
409
|
+
// ── Bus publish ────────────────────────────────────────────────────────────
|
|
410
|
+
async publishOutcome(correlationId, outcome, payload, skipBusPublish) {
|
|
411
|
+
if (!correlationId)
|
|
412
|
+
return;
|
|
413
|
+
this.pendingConfirmations.delete(correlationId);
|
|
414
|
+
if (!skipBusPublish) {
|
|
415
|
+
const confirmed = outcome !== ToolConfirmationOutcome.Cancel &&
|
|
416
|
+
outcome !== ToolConfirmationOutcome.ModifyWithEditor &&
|
|
417
|
+
outcome !== ToolConfirmationOutcome.SuggestEdit;
|
|
418
|
+
this.messageBus.publish({
|
|
419
|
+
type: MessageBusType.TOOL_CONFIRMATION_RESPONSE,
|
|
420
|
+
correlationId,
|
|
421
|
+
outcome,
|
|
422
|
+
payload,
|
|
423
|
+
confirmed,
|
|
424
|
+
requiresUserConfirmation: false,
|
|
425
|
+
});
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
// ── Helpers ────────────────────────────────────────────────────────────────
|
|
429
|
+
approveInternal(callId) {
|
|
430
|
+
this.statusMutator.setOutcome(callId, ToolConfirmationOutcome.ProceedAlways);
|
|
431
|
+
this.statusMutator.setScheduled(callId);
|
|
432
|
+
}
|
|
433
|
+
findWaitingToolCall(callId) {
|
|
434
|
+
const toolCall = this.schedulerAccessor
|
|
435
|
+
.getToolCalls()
|
|
436
|
+
.find((c) => c.request.callId === callId && c.status === 'awaiting_approval');
|
|
437
|
+
if (toolCall && toolCall.status === 'awaiting_approval') {
|
|
438
|
+
return toolCall;
|
|
439
|
+
}
|
|
440
|
+
return undefined;
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
//# sourceMappingURL=confirmation-coordinator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"confirmation-coordinator.js","sourceRoot":"","sources":["../../../src/scheduler/confirmation-coordinator.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;GAQG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAE7B,OAAO,EAAE,YAAY,EAAE,MAAM,8CAA8C,CAAC;AAE5E,OAAO,EACL,cAAc,GAGf,MAAM,uDAAuD,CAAC;AAC/D,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,C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