@nuvin/session 0.3.0-rc.2 → 0.3.0-rc.3
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/{chunk-COSZ5DKO.js → chunk-6SBER3TI.js} +1 -1
- package/dist/{chunk-B6S3CWQX.js → chunk-CAMZK5FN.js} +262 -88
- package/dist/client/index.js +21 -11
- package/dist/client/session-client.d.ts +3 -3
- package/dist/client/session-client.d.ts.map +1 -1
- package/dist/controller/agent-channel.d.ts +11 -15
- package/dist/controller/agent-channel.d.ts.map +1 -1
- package/dist/controller/index.js +114 -51
- package/dist/controller/session-controller.d.ts +4 -4
- package/dist/controller/session-controller.d.ts.map +1 -1
- package/dist/protocol/index.js +1 -1
- package/dist/protocol/types.d.ts +18 -9
- package/dist/protocol/types.d.ts.map +1 -1
- package/dist/protocol/version.d.ts +1 -1
- package/dist/state/display-text.d.ts +8 -0
- package/dist/state/display-text.d.ts.map +1 -0
- package/dist/state/index.d.ts +1 -0
- package/dist/state/index.d.ts.map +1 -1
- package/dist/state/index.js +9 -3
- package/dist/state/messages.d.ts +12 -20
- package/dist/state/messages.d.ts.map +1 -1
- package/dist/state/questions.d.ts +1 -1
- package/dist/state/questions.d.ts.map +1 -1
- package/dist/state/session.d.ts.map +1 -1
- package/dist/state/tool-key.d.ts +1 -1
- package/dist/state/tool-key.d.ts.map +1 -1
- package/dist/state/tool-preview.js +2 -2
- package/dist/test-utils/index.js +1 -1
- package/package.json +2 -2
package/dist/client/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createSessionViewState,
|
|
3
3
|
reduceSessionEvent
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-CAMZK5FN.js";
|
|
5
5
|
import {
|
|
6
6
|
PROTOCOL_VERSION
|
|
7
|
-
} from "../chunk-
|
|
7
|
+
} from "../chunk-6SBER3TI.js";
|
|
8
8
|
|
|
9
9
|
// src/client/endpoint.ts
|
|
10
10
|
var TerminalEndpointError = class extends Error {
|
|
@@ -442,6 +442,9 @@ function createHttpDataClient(options = {}) {
|
|
|
442
442
|
}
|
|
443
443
|
|
|
444
444
|
// src/client/session-client.ts
|
|
445
|
+
function cloneNonRootToolCallPath(toolCallPath) {
|
|
446
|
+
return toolCallPath && toolCallPath.length > 0 ? [...toolCallPath] : void 0;
|
|
447
|
+
}
|
|
445
448
|
var SessionCommandError = class extends Error {
|
|
446
449
|
constructor(code, message) {
|
|
447
450
|
super(message);
|
|
@@ -633,7 +636,8 @@ function createSessionClient(transport) {
|
|
|
633
636
|
})).then(() => {
|
|
634
637
|
});
|
|
635
638
|
},
|
|
636
|
-
decideApproval(toolCallId, decision, comment, grantDir,
|
|
639
|
+
decideApproval(toolCallId, decision, comment, grantDir, toolCallPath) {
|
|
640
|
+
const commandPath = cloneNonRootToolCallPath(toolCallPath);
|
|
637
641
|
return sendCommand((id) => ({
|
|
638
642
|
id,
|
|
639
643
|
type: "decide-approval",
|
|
@@ -641,24 +645,30 @@ function createSessionClient(transport) {
|
|
|
641
645
|
decision,
|
|
642
646
|
...comment !== void 0 ? { comment } : {},
|
|
643
647
|
...grantDir !== void 0 ? { grantDir } : {},
|
|
644
|
-
...
|
|
648
|
+
...commandPath !== void 0 ? { toolCallPath: commandPath } : {}
|
|
645
649
|
})).then(() => {
|
|
646
650
|
});
|
|
647
651
|
},
|
|
648
|
-
persistBashPermission(toolCallId, request,
|
|
652
|
+
persistBashPermission(toolCallId, request, toolCallPath) {
|
|
653
|
+
const commandPath = cloneNonRootToolCallPath(toolCallPath);
|
|
649
654
|
return sendCommand((id) => ({
|
|
650
655
|
id,
|
|
651
656
|
type: "persist-bash-permission",
|
|
652
657
|
toolCallId,
|
|
653
|
-
...
|
|
658
|
+
...commandPath !== void 0 ? { toolCallPath: commandPath } : {},
|
|
654
659
|
request
|
|
655
660
|
})).then(toPersistBashPermissionResult);
|
|
656
661
|
},
|
|
657
|
-
answerQuestion(questionId, answers) {
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
+
answerQuestion(questionId, answers, toolCallPath) {
|
|
663
|
+
const commandPath = cloneNonRootToolCallPath(toolCallPath);
|
|
664
|
+
return sendCommand((id) => ({
|
|
665
|
+
id,
|
|
666
|
+
type: "answer-question",
|
|
667
|
+
questionId,
|
|
668
|
+
answers,
|
|
669
|
+
...commandPath !== void 0 ? { toolCallPath: commandPath } : {}
|
|
670
|
+
})).then(() => {
|
|
671
|
+
});
|
|
662
672
|
},
|
|
663
673
|
abort() {
|
|
664
674
|
return sendCommand((id) => ({ id, type: "abort" })).then(() => {
|
|
@@ -18,9 +18,9 @@ export interface SessionClient {
|
|
|
18
18
|
/** Raw frame hook for UI side-effects (e.g. close modals on state-reset). */
|
|
19
19
|
onEvent(listener: (event: ServerEvent) => void): () => void;
|
|
20
20
|
submit(input: AgentInput, opts: ClientSubmitOptions): Promise<void>;
|
|
21
|
-
decideApproval(toolCallId: string, decision: "a" | "n" | "y", comment?: string, grantDir?: string,
|
|
22
|
-
persistBashPermission(toolCallId: string, request: PersistBashPermissionRequest,
|
|
23
|
-
answerQuestion(questionId: string, answers: AskUserAnswers): Promise<void>;
|
|
21
|
+
decideApproval(toolCallId: string, decision: "a" | "n" | "y", comment?: string, grantDir?: string, toolCallPath?: readonly string[]): Promise<void>;
|
|
22
|
+
persistBashPermission(toolCallId: string, request: PersistBashPermissionRequest, toolCallPath?: readonly string[]): Promise<PersistBashPermissionResult>;
|
|
23
|
+
answerQuestion(questionId: string, answers: AskUserAnswers, toolCallPath?: readonly string[]): Promise<void>;
|
|
24
24
|
abort(): Promise<void>;
|
|
25
25
|
/** Cancel a queued (not-yet-running) message by its `turn-status.queued` id. */
|
|
26
26
|
dequeueMessage(queuedId: string): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-client.d.ts","sourceRoot":"","sources":["../../src/client/session-client.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAa,MAAM,0BAA0B,CAAC;AAEtF,OAAO,KAAK,EACV,iBAAiB,EACjB,WAAW,EACX,4BAA4B,EAC5B,sBAAsB,EAEtB,aAAa,EACb,WAAW,EACX,yBAAyB,EACzB,0BAA0B,EAC1B,qBAAqB,EACrB,mBAAmB,EACnB,eAAe,EACf,SAAS,EACT,eAAe,EACf,aAAa,EACb,oBAAoB,EACpB,4BAA4B,EAC5B,2BAA2B,EAC3B,WAAW,EACX,gBAAgB,EAChB,eAAe,EACf,iBAAiB,EACjB,WAAW,EACX,sBAAsB,EAEtB,sBAAsB,EACtB,qBAAqB,EACrB,sBAAsB,EACvB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEtD,MAAM,MAAM,mBAAmB,GAAG;IAChC,WAAW,EAAE,MAAM,CAAC;IACpB,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;
|
|
1
|
+
{"version":3,"file":"session-client.d.ts","sourceRoot":"","sources":["../../src/client/session-client.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAa,MAAM,0BAA0B,CAAC;AAEtF,OAAO,KAAK,EACV,iBAAiB,EACjB,WAAW,EACX,4BAA4B,EAC5B,sBAAsB,EAEtB,aAAa,EACb,WAAW,EACX,yBAAyB,EACzB,0BAA0B,EAC1B,qBAAqB,EACrB,mBAAmB,EACnB,eAAe,EACf,SAAS,EACT,eAAe,EACf,aAAa,EACb,oBAAoB,EACpB,4BAA4B,EAC5B,2BAA2B,EAC3B,WAAW,EACX,gBAAgB,EAChB,eAAe,EACf,iBAAiB,EACjB,WAAW,EACX,sBAAsB,EAEtB,sBAAsB,EACtB,qBAAqB,EACrB,sBAAsB,EACvB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,KAAK,EAAE,eA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AI,CAAC,CAAC;IAChE,KAAK,IAAI,IAAI,CAAC;CACf;AAED,qBAAa,mBAAoB,SAAQ,KAAK;IAE1C,QAAQ,CAAC,IAAI,EAAE,MAAM;gBAAZ,IAAI,EAAE,MAAM,EACrB,OAAO,EAAE,MAAM;CAKlB;AAiHD,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,eAAe,GAAG,aAAa,CAsW7E"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { AgentEvent, AskUserAnswers, AskUserQuestionRequest, Message, ToolPermissionClass, ToolRuntimeDispatchDecision, ToolUseBlock } from "@nuvin/agent-core/shared";
|
|
2
|
-
import type { BashPolicyApprovalDiagnostics, DirAccessRequest, PersistBashPermissionHandlerResult, PersistBashPermissionRequest, WorkflowBashPolicySummary } from "../protocol/types.ts";
|
|
1
|
+
import type { AgentEvent, AskUserAnswers, AskUserQuestionRequest, Message, ToolExecutionScope, ToolPermissionClass, ToolRuntimeDispatchDecision, ToolUseBlock } from "@nuvin/agent-core/shared";
|
|
2
|
+
import type { BashPolicyApprovalDiagnostics, DirAccessRequest, PersistBashPermissionHandlerResult, PersistBashPermissionRequest, WireAgentEventScope, WorkflowBashPolicySummary } from "../protocol/types.ts";
|
|
3
3
|
import type { TuiMessage } from "../state/messages.ts";
|
|
4
4
|
/** UI-safe transcript projection of runtime LoadedSession. */
|
|
5
5
|
export type SessionLoadedPayload = {
|
|
@@ -8,18 +8,14 @@ export type SessionLoadedPayload = {
|
|
|
8
8
|
messages: TuiMessage[];
|
|
9
9
|
};
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* tool call. Coordinator (root) callbacks omit it.
|
|
11
|
+
* Convert normalized host scope to protocol scope. Root activity stays
|
|
12
|
+
* unscoped on the wire; nested paths are copied so caller mutation cannot
|
|
13
|
+
* change a routed event or interaction after publication.
|
|
15
14
|
*/
|
|
16
|
-
export
|
|
17
|
-
agentId: string;
|
|
18
|
-
parentToolCallId: string;
|
|
19
|
-
};
|
|
15
|
+
export declare function toWireSessionScope(scope: ToolExecutionScope): WireAgentEventScope | undefined;
|
|
20
16
|
export type AgentEventPayload = {
|
|
21
17
|
event: AgentEvent;
|
|
22
|
-
scope?:
|
|
18
|
+
scope?: WireAgentEventScope;
|
|
23
19
|
};
|
|
24
20
|
export type ToolCallRequest = {
|
|
25
21
|
agentId: string;
|
|
@@ -27,8 +23,8 @@ export type ToolCallRequest = {
|
|
|
27
23
|
bashPolicy?: BashPolicyApprovalDiagnostics;
|
|
28
24
|
/** Set by the runtime pre-check when the call's path is outside allowedDirs. */
|
|
29
25
|
dirAccess?: DirAccessRequest;
|
|
30
|
-
parentToolCallId?: string;
|
|
31
26
|
permissionClass?: ToolPermissionClass;
|
|
27
|
+
toolCallPath?: readonly string[];
|
|
32
28
|
persistBashPermission?: (request: PersistBashPermissionRequest) => Promise<PersistBashPermissionHandlerResult>;
|
|
33
29
|
toolCall: ToolUseBlock;
|
|
34
30
|
workflowBashPolicy?: WorkflowBashPolicySummary;
|
|
@@ -36,7 +32,7 @@ export type ToolCallRequest = {
|
|
|
36
32
|
export type AgentEventListener = (payload: AgentEventPayload) => void;
|
|
37
33
|
export type SessionLoadedListener = (loaded: SessionLoadedPayload) => void;
|
|
38
34
|
export type ToolCallDecider = (request: ToolCallRequest) => Promise<ToolRuntimeDispatchDecision> | ToolRuntimeDispatchDecision;
|
|
39
|
-
export type UserQuestionHandler = (request: AskUserQuestionRequest, scope?:
|
|
35
|
+
export type UserQuestionHandler = (request: AskUserQuestionRequest, scope?: WireAgentEventScope) => Promise<AskUserAnswers> | AskUserAnswers;
|
|
40
36
|
/**
|
|
41
37
|
* In-process channel between the Agent (constructed in `main()`) and the
|
|
42
38
|
* React UI (`<App />`). Two distinct shapes:
|
|
@@ -51,10 +47,10 @@ export declare class AgentChannel {
|
|
|
51
47
|
private readonly emitter;
|
|
52
48
|
private decider;
|
|
53
49
|
private questionHandler;
|
|
54
|
-
publishEvent(event: AgentEvent, scope?:
|
|
50
|
+
publishEvent(event: AgentEvent, scope?: ToolExecutionScope): void;
|
|
55
51
|
publishSessionLoaded(loaded: SessionLoadedPayload): void;
|
|
56
52
|
requestToolDecision(request: ToolCallRequest): Promise<ToolRuntimeDispatchDecision> | ToolRuntimeDispatchDecision;
|
|
57
|
-
requestUserQuestion(request: AskUserQuestionRequest, scope?:
|
|
53
|
+
requestUserQuestion(request: AskUserQuestionRequest, scope?: ToolExecutionScope): Promise<AskUserAnswers>;
|
|
58
54
|
onEvent(listener: AgentEventListener): () => void;
|
|
59
55
|
onSessionLoaded(listener: SessionLoadedListener): () => void;
|
|
60
56
|
setToolDecider(decider: ToolCallDecider | null): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-channel.d.ts","sourceRoot":"","sources":["../../src/controller/agent-channel.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,UAAU,EACV,cAAc,EACd,sBAAsB,EACtB,OAAO,EACP,mBAAmB,EACnB,2BAA2B,EAC3B,YAAY,EACb,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EACV,6BAA6B,EAC7B,gBAAgB,EAChB,kCAAkC,EAClC,4BAA4B,EAC5B,yBAAyB,EAC1B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAEvD,8DAA8D;AAC9D,MAAM,MAAM,oBAAoB,GAAG;IACjC,aAAa,EAAE,OAAO,EAAE,CAAC;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,UAAU,EAAE,CAAC;CACxB,CAAC;AAEF
|
|
1
|
+
{"version":3,"file":"agent-channel.d.ts","sourceRoot":"","sources":["../../src/controller/agent-channel.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,UAAU,EACV,cAAc,EACd,sBAAsB,EACtB,OAAO,EACP,kBAAkB,EAClB,mBAAmB,EACnB,2BAA2B,EAC3B,YAAY,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AC5B,OAAO,EAAE,eAAe,KACrB,OAAO,CAAC,2BAA2B,CAAC,GAAG,2BAA2B,CAAC;AAExE,MAAM,MAAM,mBAAmB,GAAG,CAChC,OAAO,EAAE,sBAAsB,EAC/B,KAAK,CAAC,EAAE,mBAAmB,KACxB,OAAO,CAAC,cAAc,CAAC,GAAG,cAAc,CAAC;AAO9C;;;;;;;;;GASG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAsB;IAC9C,OAAO,CAAC,OAAO,CAAgC;IAC/C,OAAO,CAAC,eAAe,CAAoC;IAI3D,YAAY,CAAC,KAAK,EAAE,UAAU,EAAE,KAAK,CAAC,EAAE,kBAAkB,GAAG,IAAI;IAOjE,oBAAoB,CAAC,MAAM,EAAE,oBAAoB,GAAG,IAAI;IAIxD,mBAAmB,CACjB,OAAO,EAAE,eAAe,GACvB,OAAO,CAAC,2BAA2B,CAAC,GAAG,2BAA2B;IAerE,mBAAmB,CACjB,OAAO,EAAE,sBAAsB,EAC/B,KAAK,CAAC,EAAE,kBAAkB,GACzB,OAAO,CAAC,cAAc,CAAC;IAW1B,OAAO,CAAC,QAAQ,EAAE,kBAAkB,GAAG,MAAM,IAAI;IAOjD,eAAe,CAAC,QAAQ,EAAE,qBAAqB,GAAG,MAAM,IAAI;IAO5D,cAAc,CAAC,OAAO,EAAE,eAAe,GAAG,IAAI,GAAG,IAAI;IAIrD,kBAAkB,CAAC,OAAO,EAAE,mBAAmB,GAAG,IAAI,GAAG,IAAI;CAG9D"}
|
package/dist/controller/index.js
CHANGED
|
@@ -7,11 +7,16 @@ import {
|
|
|
7
7
|
createSessionViewState,
|
|
8
8
|
isToolAutoApprovedForMode,
|
|
9
9
|
reduceSessionEvent,
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
sanitizeBoundedDisplayText,
|
|
11
|
+
scopedToolKey,
|
|
12
|
+
summarizeToolCallInput
|
|
13
|
+
} from "../chunk-CAMZK5FN.js";
|
|
12
14
|
|
|
13
15
|
// src/controller/agent-channel.ts
|
|
14
16
|
import { EventEmitter } from "events";
|
|
17
|
+
function toWireSessionScope(scope) {
|
|
18
|
+
return scope.toolCallPath.length === 0 ? void 0 : { agentId: scope.agentId, toolCallPath: [...scope.toolCallPath] };
|
|
19
|
+
}
|
|
15
20
|
var NO_DECIDER_DECISION = {
|
|
16
21
|
action: "reject",
|
|
17
22
|
reason: "UI is not ready to handle tool calls."
|
|
@@ -22,7 +27,10 @@ var AgentChannel = class {
|
|
|
22
27
|
questionHandler = null;
|
|
23
28
|
// ---------- Agent-side (publishers) ----------
|
|
24
29
|
publishEvent(event, scope) {
|
|
25
|
-
this.emitter.emit("event", {
|
|
30
|
+
this.emitter.emit("event", {
|
|
31
|
+
event,
|
|
32
|
+
scope: scope === void 0 ? void 0 : toWireSessionScope(scope)
|
|
33
|
+
});
|
|
26
34
|
}
|
|
27
35
|
publishSessionLoaded(loaded) {
|
|
28
36
|
this.emitter.emit("session-loaded", loaded);
|
|
@@ -31,13 +39,23 @@ var AgentChannel = class {
|
|
|
31
39
|
if (!this.decider) {
|
|
32
40
|
return NO_DECIDER_DECISION;
|
|
33
41
|
}
|
|
34
|
-
|
|
42
|
+
const { toolCallPath, ...rootRequest } = request;
|
|
43
|
+
const scope = toWireSessionScope({
|
|
44
|
+
agentId: request.agentId,
|
|
45
|
+
toolCallPath: toolCallPath ?? []
|
|
46
|
+
});
|
|
47
|
+
return this.decider({
|
|
48
|
+
...rootRequest,
|
|
49
|
+
...scope === void 0 ? {} : { toolCallPath: scope.toolCallPath }
|
|
50
|
+
});
|
|
35
51
|
}
|
|
36
52
|
requestUserQuestion(request, scope) {
|
|
37
53
|
if (!this.questionHandler) {
|
|
38
54
|
return Promise.reject(new Error("UI is not ready to handle user questions."));
|
|
39
55
|
}
|
|
40
|
-
return Promise.resolve(
|
|
56
|
+
return Promise.resolve(
|
|
57
|
+
this.questionHandler(request, scope === void 0 ? void 0 : toWireSessionScope(scope))
|
|
58
|
+
);
|
|
41
59
|
}
|
|
42
60
|
// ---------- UI-side (subscribers) ----------
|
|
43
61
|
onEvent(listener) {
|
|
@@ -94,7 +112,6 @@ function createSessionController(deps) {
|
|
|
94
112
|
let activeTurnId;
|
|
95
113
|
let activePolicyDenial;
|
|
96
114
|
let hostBusyCount = 0;
|
|
97
|
-
let questionCounter = 0;
|
|
98
115
|
const listeners = /* @__PURE__ */ new Set();
|
|
99
116
|
const approvalResolvers = /* @__PURE__ */ new Map();
|
|
100
117
|
const privateApprovals = /* @__PURE__ */ new Map();
|
|
@@ -171,8 +188,8 @@ function createSessionController(deps) {
|
|
|
171
188
|
});
|
|
172
189
|
});
|
|
173
190
|
deps.channel.setToolDecider((request) => {
|
|
174
|
-
const { toolCall, agentId,
|
|
175
|
-
const scope =
|
|
191
|
+
const { toolCall, agentId, toolCallPath, dirAccess, bashPolicy } = request;
|
|
192
|
+
const scope = toolCallPath === void 0 ? void 0 : { agentId, toolCallPath: [...toolCallPath] };
|
|
176
193
|
const approvalKey = request.approvalKey ?? `${agentId}:${toolCall.name}`;
|
|
177
194
|
const permissionClass = request.permissionClass ?? "always-confirm";
|
|
178
195
|
const hasBashPolicy = toolCall.name === "Bash" && bashPolicy !== void 0;
|
|
@@ -246,27 +263,30 @@ function createSessionController(deps) {
|
|
|
246
263
|
activePolicyDenial = "Tool approval is unavailable in headless mode.";
|
|
247
264
|
return { action: "reject", reason: activePolicyDenial };
|
|
248
265
|
}
|
|
249
|
-
const nickname = nicknameFor(
|
|
250
|
-
const
|
|
266
|
+
const nickname = nicknameFor(toolCallPath);
|
|
267
|
+
const ancestorDisplay = buildAncestorDisplay(toolCallPath);
|
|
268
|
+
const rawInput = asJsonObject(toolCall.input);
|
|
269
|
+
const input = toolCall.name === "Program" ? typeof rawInput?.description === "string" ? { description: sanitizeBoundedDisplayText(rawInput.description) } : void 0 : rawInput;
|
|
251
270
|
const descriptor = {
|
|
252
271
|
agentId,
|
|
253
272
|
permissionClass,
|
|
254
|
-
summary: findToolSummary(toolCall.id,
|
|
273
|
+
summary: findToolSummary(toolCall.id, toolCallPath),
|
|
255
274
|
toolCallId: toolCall.id,
|
|
256
275
|
toolName: toolCall.name,
|
|
276
|
+
...ancestorDisplay !== void 0 ? { ancestorDisplay } : {},
|
|
257
277
|
...dirAccess !== void 0 ? { dirAccess } : {},
|
|
258
278
|
...input !== void 0 ? { input } : {},
|
|
259
|
-
...
|
|
279
|
+
...toolCallPath !== void 0 ? { toolCallPath: [...toolCallPath] } : {},
|
|
260
280
|
...nickname !== void 0 ? { nickname } : {},
|
|
261
281
|
...!dirAccess && bashPolicy !== void 0 ? { bashPolicy } : {},
|
|
262
282
|
...request.workflowBashPolicy !== void 0 ? { workflowBashPolicy: request.workflowBashPolicy } : {}
|
|
263
283
|
};
|
|
264
284
|
return new Promise((resolve) => {
|
|
265
|
-
const toolKey = scopedToolKey(
|
|
285
|
+
const toolKey = scopedToolKey(toolCallPath, toolCall.id);
|
|
266
286
|
approvalResolvers.set(toolKey, {
|
|
267
287
|
resolve,
|
|
268
288
|
toolCallId: toolCall.id,
|
|
269
|
-
...
|
|
289
|
+
...toolCallPath !== void 0 ? { toolCallPath: [...toolCallPath] } : {}
|
|
270
290
|
});
|
|
271
291
|
privateApprovals.set(toolKey, {
|
|
272
292
|
approvalKey,
|
|
@@ -281,39 +301,69 @@ function createSessionController(deps) {
|
|
|
281
301
|
activePolicyDenial = "Questions are unavailable in headless mode.";
|
|
282
302
|
return Promise.reject(new Error(activePolicyDenial));
|
|
283
303
|
}
|
|
284
|
-
|
|
285
|
-
const
|
|
304
|
+
const { questionId } = request;
|
|
305
|
+
const toolCallPath = scope?.toolCallPath;
|
|
286
306
|
return new Promise((resolve, reject) => {
|
|
287
|
-
|
|
288
|
-
|
|
307
|
+
const questionKey = scopedToolKey(toolCallPath, questionId);
|
|
308
|
+
questionResolvers.set(questionKey, {
|
|
309
|
+
resolve,
|
|
310
|
+
reject,
|
|
311
|
+
questionId,
|
|
312
|
+
...toolCallPath !== void 0 ? { toolCallPath: [...toolCallPath] } : {}
|
|
313
|
+
});
|
|
314
|
+
const nickname = nicknameFor(toolCallPath);
|
|
289
315
|
emit({
|
|
290
316
|
type: "question-asked",
|
|
291
317
|
question: {
|
|
292
318
|
questionId,
|
|
293
319
|
request,
|
|
294
320
|
...scope?.agentId !== void 0 ? { agentId: scope.agentId } : {},
|
|
295
|
-
...
|
|
321
|
+
...toolCallPath !== void 0 ? { toolCallPath: [...toolCallPath] } : {},
|
|
296
322
|
...nickname !== void 0 ? { nickname } : {}
|
|
297
323
|
}
|
|
298
324
|
});
|
|
299
325
|
});
|
|
300
326
|
});
|
|
301
|
-
function
|
|
302
|
-
const messageId = state.messages.toolMessageIds[scopedToolKey(
|
|
327
|
+
function findToolMessage(toolCallId, toolCallPath) {
|
|
328
|
+
const messageId = state.messages.toolMessageIds[scopedToolKey(toolCallPath, toolCallId)];
|
|
303
329
|
const message = state.messages.messages.find((entry) => entry.id === messageId);
|
|
304
|
-
return message?.role === "tool" ? message
|
|
330
|
+
return message?.role === "tool" ? message : void 0;
|
|
331
|
+
}
|
|
332
|
+
function findToolSummary(toolCallId, toolCallPath) {
|
|
333
|
+
const summary = findToolMessage(toolCallId, toolCallPath)?.summary ?? "";
|
|
334
|
+
return sanitizeBoundedDisplayText(summary);
|
|
305
335
|
}
|
|
306
|
-
function nicknameFor(
|
|
307
|
-
if (!
|
|
308
|
-
const
|
|
309
|
-
const
|
|
310
|
-
if (
|
|
311
|
-
const
|
|
312
|
-
|
|
336
|
+
function nicknameFor(toolCallPath) {
|
|
337
|
+
if (!toolCallPath || toolCallPath.length === 0) return void 0;
|
|
338
|
+
const parentIndex = toolCallPath.length - 1;
|
|
339
|
+
const directAncestorId = toolCallPath[parentIndex];
|
|
340
|
+
if (directAncestorId === void 0) return void 0;
|
|
341
|
+
const parentMessage = findToolMessage(directAncestorId, toolCallPath.slice(0, parentIndex));
|
|
342
|
+
const nickname = parentMessage?.input?.nickname;
|
|
343
|
+
return typeof nickname === "string" ? sanitizeBoundedDisplayText(nickname) : void 0;
|
|
313
344
|
}
|
|
314
|
-
function
|
|
345
|
+
function buildAncestorDisplay(toolCallPath) {
|
|
346
|
+
if (!toolCallPath || toolCallPath.length === 0) return void 0;
|
|
347
|
+
const ancestors = [];
|
|
348
|
+
for (let index = 0; index < toolCallPath.length; index += 1) {
|
|
349
|
+
const toolCallId = toolCallPath[index];
|
|
350
|
+
if (toolCallId === void 0) return void 0;
|
|
351
|
+
const message = findToolMessage(toolCallId, toolCallPath.slice(0, index));
|
|
352
|
+
if (!message) return void 0;
|
|
353
|
+
const nickname = message.input?.nickname;
|
|
354
|
+
ancestors.push({
|
|
355
|
+
toolCallId,
|
|
356
|
+
toolName: message.toolName,
|
|
357
|
+
summary: message.toolName === "Program" ? summarizeToolCallInput(message.toolName, message.input ?? {}) : sanitizeBoundedDisplayText(message.summary),
|
|
358
|
+
...typeof nickname === "string" ? { nickname: sanitizeBoundedDisplayText(nickname) } : {}
|
|
359
|
+
});
|
|
360
|
+
}
|
|
361
|
+
return ancestors;
|
|
362
|
+
}
|
|
363
|
+
function findDescriptor(toolCallId, toolCallPath) {
|
|
364
|
+
const toolKey = scopedToolKey(toolCallPath, toolCallId);
|
|
315
365
|
return [state.approval.active, ...state.approval.pending].find(
|
|
316
|
-
(entry) => entry
|
|
366
|
+
(entry) => entry !== null && scopedToolKey(entry.toolCallPath, entry.toolCallId) === toolKey
|
|
317
367
|
);
|
|
318
368
|
}
|
|
319
369
|
function rejectAllPending(reason) {
|
|
@@ -322,7 +372,7 @@ function createSessionController(deps) {
|
|
|
322
372
|
emit({
|
|
323
373
|
type: "approval-settled",
|
|
324
374
|
toolCallId: pending.toolCallId,
|
|
325
|
-
...pending.
|
|
375
|
+
...pending.toolCallPath === void 0 ? {} : { toolCallPath: [...pending.toolCallPath] },
|
|
326
376
|
status: "rejected",
|
|
327
377
|
by: "abort"
|
|
328
378
|
});
|
|
@@ -330,9 +380,13 @@ function createSessionController(deps) {
|
|
|
330
380
|
approvalResolvers.clear();
|
|
331
381
|
privateApprovals.clear();
|
|
332
382
|
persistenceInFlight.clear();
|
|
333
|
-
for (const
|
|
383
|
+
for (const { reject, questionId, toolCallPath } of questionResolvers.values()) {
|
|
334
384
|
reject(new Error(reason));
|
|
335
|
-
emit({
|
|
385
|
+
emit({
|
|
386
|
+
type: "question-settled",
|
|
387
|
+
questionId,
|
|
388
|
+
...toolCallPath === void 0 ? {} : { toolCallPath: [...toolCallPath] }
|
|
389
|
+
});
|
|
336
390
|
}
|
|
337
391
|
questionResolvers.clear();
|
|
338
392
|
}
|
|
@@ -553,12 +607,17 @@ function createSessionController(deps) {
|
|
|
553
607
|
if (hooks.compaction) compaction = hooks.compaction;
|
|
554
608
|
if (hooks.guardPrompt) guardPrompt = hooks.guardPrompt;
|
|
555
609
|
},
|
|
556
|
-
answerQuestion(questionId, answers) {
|
|
557
|
-
const
|
|
610
|
+
answerQuestion(questionId, answers, toolCallPath) {
|
|
611
|
+
const questionKey = scopedToolKey(toolCallPath, questionId);
|
|
612
|
+
const entry = questionResolvers.get(questionKey);
|
|
558
613
|
if (!entry) return false;
|
|
559
|
-
questionResolvers.delete(
|
|
614
|
+
questionResolvers.delete(questionKey);
|
|
560
615
|
entry.resolve(answers);
|
|
561
|
-
emit({
|
|
616
|
+
emit({
|
|
617
|
+
type: "question-settled",
|
|
618
|
+
questionId,
|
|
619
|
+
...toolCallPath && toolCallPath.length > 0 ? { toolCallPath: [...toolCallPath] } : {}
|
|
620
|
+
});
|
|
562
621
|
return true;
|
|
563
622
|
},
|
|
564
623
|
appendError(message) {
|
|
@@ -591,8 +650,8 @@ function createSessionController(deps) {
|
|
|
591
650
|
emitTurnStatus();
|
|
592
651
|
return true;
|
|
593
652
|
},
|
|
594
|
-
decideApproval(toolCallId, decision, comment, grantDir,
|
|
595
|
-
const toolKey = scopedToolKey(
|
|
653
|
+
decideApproval(toolCallId, decision, comment, grantDir, toolCallPath) {
|
|
654
|
+
const toolKey = scopedToolKey(toolCallPath, toolCallId);
|
|
596
655
|
if (persistenceInFlight.has(toolKey)) {
|
|
597
656
|
return false;
|
|
598
657
|
}
|
|
@@ -600,7 +659,7 @@ function createSessionController(deps) {
|
|
|
600
659
|
if (!pending) return false;
|
|
601
660
|
approvalResolvers.delete(toolKey);
|
|
602
661
|
persistenceInFlight.delete(toolKey);
|
|
603
|
-
const descriptor = findDescriptor(toolCallId,
|
|
662
|
+
const descriptor = findDescriptor(toolCallId, toolCallPath);
|
|
604
663
|
const privateApproval = privateApprovals.get(toolKey);
|
|
605
664
|
privateApprovals.delete(toolKey);
|
|
606
665
|
if (decision === "a" && descriptor && !descriptor.dirAccess) {
|
|
@@ -643,18 +702,21 @@ function createSessionController(deps) {
|
|
|
643
702
|
emit({
|
|
644
703
|
type: "approval-settled",
|
|
645
704
|
toolCallId,
|
|
646
|
-
...
|
|
705
|
+
...toolCallPath && toolCallPath.length > 0 ? { toolCallPath: [...toolCallPath] } : {},
|
|
647
706
|
status: rejected ? "rejected" : "approved",
|
|
648
707
|
by: "client"
|
|
649
708
|
});
|
|
650
709
|
return true;
|
|
651
710
|
},
|
|
652
|
-
async persistBashPermission(toolCallId, request,
|
|
653
|
-
const
|
|
711
|
+
async persistBashPermission(toolCallId, request, toolCallPath) {
|
|
712
|
+
const persistenceToolCallPath = toolCallPath && toolCallPath.length > 0 ? [...toolCallPath] : void 0;
|
|
713
|
+
const toolKey = scopedToolKey(persistenceToolCallPath, toolCallId);
|
|
654
714
|
const descriptor = state.approval.active;
|
|
715
|
+
const descriptorKey = descriptor === null ? void 0 : scopedToolKey(descriptor.toolCallPath, descriptor.toolCallId);
|
|
655
716
|
const privateApproval = privateApprovals.get(toolKey);
|
|
656
717
|
const handler = privateApproval?.persistBashPermission;
|
|
657
|
-
|
|
718
|
+
const pending = approvalResolvers.get(toolKey);
|
|
719
|
+
if (descriptorKey !== toolKey || descriptor?.toolName !== "Bash" || descriptor.dirAccess !== void 0 || descriptor.bashPolicy?.persistence.eligible !== true || handler === void 0 || pending === void 0) {
|
|
658
720
|
return void 0;
|
|
659
721
|
}
|
|
660
722
|
if (persistenceInFlight.has(toolKey)) {
|
|
@@ -676,13 +738,13 @@ function createSessionController(deps) {
|
|
|
676
738
|
emitTurnStatus();
|
|
677
739
|
try {
|
|
678
740
|
const outcome = await handler(request);
|
|
741
|
+
const activeDescriptor = state.approval.active;
|
|
742
|
+
if (approvalResolvers.get(toolKey) !== pending || activeDescriptor === null || scopedToolKey(activeDescriptor.toolCallPath, activeDescriptor.toolCallId) !== toolKey || privateApprovals.get(toolKey) !== privateApproval) {
|
|
743
|
+
return void 0;
|
|
744
|
+
}
|
|
679
745
|
if (outcome.status === "validation-error") {
|
|
680
746
|
return outcome;
|
|
681
747
|
}
|
|
682
|
-
const pending = approvalResolvers.get(toolKey);
|
|
683
|
-
if (pending === void 0 || state.approval.active?.toolCallId !== toolCallId || state.approval.active.parentToolCallId !== parentToolCallId || privateApprovals.get(toolKey) !== privateApproval) {
|
|
684
|
-
return void 0;
|
|
685
|
-
}
|
|
686
748
|
approvalResolvers.delete(toolKey);
|
|
687
749
|
privateApprovals.delete(toolKey);
|
|
688
750
|
pending.resolve({
|
|
@@ -693,7 +755,7 @@ function createSessionController(deps) {
|
|
|
693
755
|
emit({
|
|
694
756
|
type: "approval-settled",
|
|
695
757
|
toolCallId,
|
|
696
|
-
...
|
|
758
|
+
...persistenceToolCallPath === void 0 ? {} : { toolCallPath: [...persistenceToolCallPath] },
|
|
697
759
|
status: "approved",
|
|
698
760
|
by: "client"
|
|
699
761
|
});
|
|
@@ -809,5 +871,6 @@ function createSessionController(deps) {
|
|
|
809
871
|
export {
|
|
810
872
|
AgentChannel,
|
|
811
873
|
createSessionController,
|
|
812
|
-
formatBashPolicyDenial
|
|
874
|
+
formatBashPolicyDenial,
|
|
875
|
+
toWireSessionScope
|
|
813
876
|
};
|
|
@@ -89,8 +89,8 @@ export interface SessionController {
|
|
|
89
89
|
compaction?: CompactionHooks;
|
|
90
90
|
guardPrompt?: (input: AgentInput) => Promise<GuardResult>;
|
|
91
91
|
}): void;
|
|
92
|
-
/** Settle a pending question by id. */
|
|
93
|
-
answerQuestion(questionId: string, answers: AskUserAnswers): boolean;
|
|
92
|
+
/** Settle a pending question by id and full ancestor path. */
|
|
93
|
+
answerQuestion(questionId: string, answers: AskUserAnswers, toolCallPath?: readonly string[]): boolean;
|
|
94
94
|
/** Emit an error line into the replicated transcript. */
|
|
95
95
|
appendError(message: string): void;
|
|
96
96
|
/** Emit an info line into the replicated transcript (slash output, system notices). */
|
|
@@ -102,8 +102,8 @@ export interface SessionController {
|
|
|
102
102
|
* drained or never existed) — a race-safe no-op the host still acks ok.
|
|
103
103
|
*/
|
|
104
104
|
dequeue(queuedId: string): boolean;
|
|
105
|
-
decideApproval(toolCallId: string, decision: "a" | "n" | "y", comment?: string, grantDir?: string,
|
|
106
|
-
persistBashPermission(toolCallId: string, request: PersistBashPermissionRequest,
|
|
105
|
+
decideApproval(toolCallId: string, decision: "a" | "n" | "y", comment?: string, grantDir?: string, toolCallPath?: readonly string[]): boolean;
|
|
106
|
+
persistBashPermission(toolCallId: string, request: PersistBashPermissionRequest, toolCallPath?: readonly string[]): Promise<PersistBashPermissionResult | undefined>;
|
|
107
107
|
/** Echo a user-style message without starting a turn (slash commands echo their invocation). */
|
|
108
108
|
echoUserMessage(text: string, attachmentLabels?: string[]): void;
|
|
109
109
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-controller.d.ts","sourceRoot":"","sources":["../../src/controller/session-controller.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,EACL,KAAK,UAAU,EACf,KAAK,eAAe,EACpB,KAAK,cAAc,EAEnB,KAAK,OAAO,EACZ,KAAK,kBAAkB,EAGxB,MAAM,0BAA0B,CAAC;AAElC,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"session-controller.d.ts","sourceRoot":"","sources":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