@nuvin/session 0.4.0-rc.10 → 0.4.0-rc.11
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-4AOFJGGN.js +141 -0
- package/dist/{chunk-U6V6IQJR.js → chunk-4FXP5TSI.js} +68 -4
- package/dist/{chunk-Y7JPSYTH.js → chunk-O3YF6Q77.js} +43 -1
- package/dist/client/control-center-socket.d.ts +14 -0
- package/dist/client/control-center-socket.d.ts.map +1 -0
- package/dist/client/daemon-client.d.ts.map +1 -1
- package/dist/client/data-client.d.ts +2 -1
- package/dist/client/data-client.d.ts.map +1 -1
- package/dist/client/http-data-client.d.ts.map +1 -1
- package/dist/client/index.js +209 -5
- package/dist/client/session-client.d.ts +4 -2
- package/dist/client/session-client.d.ts.map +1 -1
- package/dist/controller/agent-channel.d.ts +7 -2
- package/dist/controller/agent-channel.d.ts.map +1 -1
- package/dist/controller/index.js +394 -65
- package/dist/controller/session-controller.d.ts +25 -5
- package/dist/controller/session-controller.d.ts.map +1 -1
- package/dist/protocol/control-center.d.ts +141 -0
- package/dist/protocol/control-center.d.ts.map +1 -0
- package/dist/protocol/data-rpc.d.ts +5 -0
- package/dist/protocol/data-rpc.d.ts.map +1 -1
- package/dist/protocol/index.d.ts +2 -0
- package/dist/protocol/index.d.ts.map +1 -1
- package/dist/protocol/index.js +12 -2
- package/dist/protocol/submission-recovery.d.ts +6 -0
- package/dist/protocol/submission-recovery.d.ts.map +1 -0
- package/dist/protocol/types.d.ts +71 -6
- package/dist/protocol/types.d.ts.map +1 -1
- package/dist/protocol/version.d.ts +1 -1
- package/dist/state/index.js +5 -1
- package/dist/state/messages.d.ts +2 -1
- package/dist/state/messages.d.ts.map +1 -1
- package/dist/state/session.d.ts +4 -1
- package/dist/state/session.d.ts.map +1 -1
- package/dist/test-utils/index.js +2 -2
- package/package.json +2 -2
- package/dist/chunk-5PHEC5GZ.js +0 -85
package/dist/client/index.js
CHANGED
|
@@ -1,13 +1,166 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createSessionViewState,
|
|
3
3
|
reduceSessionEvent
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-4FXP5TSI.js";
|
|
5
5
|
import {
|
|
6
6
|
PROTOCOL_VERSION,
|
|
7
|
+
parseAbortRecoveryRequest,
|
|
8
|
+
parseAbortRecoveryResult,
|
|
7
9
|
parseBackgroundWorkCancellation,
|
|
8
10
|
parseBackgroundWorkInspection,
|
|
9
11
|
parseBackgroundWorkPage
|
|
10
|
-
} from "../chunk-
|
|
12
|
+
} from "../chunk-O3YF6Q77.js";
|
|
13
|
+
|
|
14
|
+
// src/client/control-center-socket.ts
|
|
15
|
+
var CONTROL_CENTER_UNSUPPORTED = "Control Center is unavailable on this daemon. Update or restart the daemon and try again.";
|
|
16
|
+
function createControlCenterSocketClient(options) {
|
|
17
|
+
const timeoutMs = options.timeoutMs ?? 6e4;
|
|
18
|
+
let closed = false;
|
|
19
|
+
let sequence = 0;
|
|
20
|
+
let socket;
|
|
21
|
+
let connecting;
|
|
22
|
+
let rejectConnection;
|
|
23
|
+
let handshakeTimer;
|
|
24
|
+
const pending = /* @__PURE__ */ new Map();
|
|
25
|
+
const disconnect = (error) => {
|
|
26
|
+
clearTimeout(handshakeTimer);
|
|
27
|
+
rejectConnection?.(error);
|
|
28
|
+
rejectConnection = void 0;
|
|
29
|
+
connecting = void 0;
|
|
30
|
+
const current = socket;
|
|
31
|
+
socket = void 0;
|
|
32
|
+
for (const entry of pending.values()) {
|
|
33
|
+
clearTimeout(entry.timer);
|
|
34
|
+
entry.reject(error);
|
|
35
|
+
}
|
|
36
|
+
pending.clear();
|
|
37
|
+
current?.close();
|
|
38
|
+
};
|
|
39
|
+
const connect = () => {
|
|
40
|
+
if (closed) return Promise.reject(new Error("Control Center connection is closed."));
|
|
41
|
+
if (connecting) return connecting;
|
|
42
|
+
connecting = new Promise((resolve, reject) => {
|
|
43
|
+
rejectConnection = reject;
|
|
44
|
+
handshakeTimer = setTimeout(
|
|
45
|
+
() => disconnect(
|
|
46
|
+
new Error(
|
|
47
|
+
"Control Center connection timed out. Check the daemon connection and try again."
|
|
48
|
+
)
|
|
49
|
+
),
|
|
50
|
+
options.timeoutMs ?? 15e3
|
|
51
|
+
);
|
|
52
|
+
void options.getEndpoint().then((endpoint) => {
|
|
53
|
+
if (closed || rejectConnection !== reject) return;
|
|
54
|
+
const current = options.socketFactory(endpoint.url);
|
|
55
|
+
socket = current;
|
|
56
|
+
current.on("open", () => {
|
|
57
|
+
if (socket !== current) return;
|
|
58
|
+
try {
|
|
59
|
+
current.send(
|
|
60
|
+
JSON.stringify({
|
|
61
|
+
type: "hello",
|
|
62
|
+
protocolVersion: PROTOCOL_VERSION,
|
|
63
|
+
...endpoint.credential
|
|
64
|
+
})
|
|
65
|
+
);
|
|
66
|
+
} catch {
|
|
67
|
+
disconnect(new Error("Control Center connection closed during authentication."));
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
current.on("message", (data) => {
|
|
71
|
+
if (socket !== current) return;
|
|
72
|
+
let frame;
|
|
73
|
+
try {
|
|
74
|
+
const value = JSON.parse(
|
|
75
|
+
data instanceof ArrayBuffer ? new TextDecoder().decode(data) : String(data)
|
|
76
|
+
);
|
|
77
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) return;
|
|
78
|
+
frame = value;
|
|
79
|
+
} catch {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
if (frame.type === "rejected") {
|
|
83
|
+
disconnect(
|
|
84
|
+
new Error(
|
|
85
|
+
frame.reason === "auth" ? "Control Center authentication failed. Reconnect to the daemon." : "Control Center requires matching client and daemon versions. Update or restart the daemon."
|
|
86
|
+
)
|
|
87
|
+
);
|
|
88
|
+
} else if (frame.type === "welcome") {
|
|
89
|
+
if (frame.protocolVersion !== PROTOCOL_VERSION) {
|
|
90
|
+
disconnect(
|
|
91
|
+
new Error(
|
|
92
|
+
"Control Center requires matching client and daemon versions. Update or restart the daemon."
|
|
93
|
+
)
|
|
94
|
+
);
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
clearTimeout(handshakeTimer);
|
|
98
|
+
rejectConnection = void 0;
|
|
99
|
+
resolve(current);
|
|
100
|
+
} else if (frame.type === "ack" && typeof frame.id === "string") {
|
|
101
|
+
const entry = pending.get(frame.id);
|
|
102
|
+
if (!entry) return;
|
|
103
|
+
pending.delete(frame.id);
|
|
104
|
+
clearTimeout(entry.timer);
|
|
105
|
+
if (frame.ok === true && Object.hasOwn(frame, "result")) {
|
|
106
|
+
entry.resolve(frame.result);
|
|
107
|
+
} else {
|
|
108
|
+
const error = frame.error;
|
|
109
|
+
const unsupported = ["unknown-command", "not-attached"].includes(error?.code ?? "") || error?.code === "unsupported" && error.message === "Control Center is unavailable. Update or restart the daemon.";
|
|
110
|
+
entry.reject(
|
|
111
|
+
new Error(
|
|
112
|
+
unsupported ? CONTROL_CENTER_UNSUPPORTED : error?.message ?? "Control Center request failed."
|
|
113
|
+
)
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
current.on("close", () => {
|
|
119
|
+
if (socket === current) disconnect(new Error("Control Center connection closed."));
|
|
120
|
+
});
|
|
121
|
+
current.on("error", () => {
|
|
122
|
+
if (socket === current)
|
|
123
|
+
disconnect(new Error("Control Center connection closed after a network error."));
|
|
124
|
+
});
|
|
125
|
+
}).catch((error) => {
|
|
126
|
+
if (rejectConnection === reject)
|
|
127
|
+
disconnect(error instanceof Error ? error : new Error(String(error)));
|
|
128
|
+
});
|
|
129
|
+
});
|
|
130
|
+
return connecting;
|
|
131
|
+
};
|
|
132
|
+
return {
|
|
133
|
+
async request(input) {
|
|
134
|
+
const current = await connect();
|
|
135
|
+
if (closed || socket !== current) throw new Error("Control Center connection is closed.");
|
|
136
|
+
return new Promise((resolve, reject) => {
|
|
137
|
+
const id = `control-center-${++sequence}`;
|
|
138
|
+
const timer = setTimeout(
|
|
139
|
+
() => {
|
|
140
|
+
pending.delete(id);
|
|
141
|
+
reject(
|
|
142
|
+
new Error(
|
|
143
|
+
"Control Center request timed out. Check the daemon connection before trying again."
|
|
144
|
+
)
|
|
145
|
+
);
|
|
146
|
+
},
|
|
147
|
+
input.operation === "runConsolidate" ? Math.max(timeoutMs, 6e4) : timeoutMs
|
|
148
|
+
);
|
|
149
|
+
pending.set(id, { resolve, reject, timer });
|
|
150
|
+
try {
|
|
151
|
+
current.send(JSON.stringify({ id, type: "control-center", input }));
|
|
152
|
+
} catch {
|
|
153
|
+
disconnect(new Error("Control Center connection closed while sending a request."));
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
},
|
|
157
|
+
close() {
|
|
158
|
+
if (closed) return;
|
|
159
|
+
closed = true;
|
|
160
|
+
disconnect(new Error("Control Center connection is closed."));
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
}
|
|
11
164
|
|
|
12
165
|
// src/client/endpoint.ts
|
|
13
166
|
var TerminalEndpointError = class extends Error {
|
|
@@ -304,6 +457,22 @@ function createHttpDataClient(options = {}) {
|
|
|
304
457
|
}
|
|
305
458
|
if (!response.ok) await throwFromResponse(response, "Failed to delete the session");
|
|
306
459
|
},
|
|
460
|
+
async controlCenter(daemonId, input) {
|
|
461
|
+
const response = await daemonFetch(daemonId, "/control-center", {
|
|
462
|
+
method: "POST",
|
|
463
|
+
headers: { "Content-Type": "application/json" },
|
|
464
|
+
body: JSON.stringify(input)
|
|
465
|
+
});
|
|
466
|
+
if (response.status === 404) {
|
|
467
|
+
const body = await response.json().catch(() => null);
|
|
468
|
+
if (body?.code === "not-found" && typeof body.message === "string" && body.message !== "Not found.") {
|
|
469
|
+
throw new Error(body.message);
|
|
470
|
+
}
|
|
471
|
+
throw new Error(CONTROL_CENTER_UNSUPPORTED);
|
|
472
|
+
}
|
|
473
|
+
if (!response.ok) await throwFromResponse(response, "Failed to update Control Center");
|
|
474
|
+
return await response.json();
|
|
475
|
+
},
|
|
307
476
|
async listProfiles(daemonId) {
|
|
308
477
|
const response = await daemonFetch(daemonId, "/profiles");
|
|
309
478
|
if (!response.ok) {
|
|
@@ -698,6 +867,14 @@ function createSessionClient(transport) {
|
|
|
698
867
|
}
|
|
699
868
|
return;
|
|
700
869
|
}
|
|
870
|
+
if (frame.type === "submission-retracted") {
|
|
871
|
+
try {
|
|
872
|
+
if (parseAbortRecoveryResult(frame.result).status !== "retracted" || !Array.isArray(frame.removedMessageIds) || !frame.removedMessageIds.every((id) => typeof id === "string"))
|
|
873
|
+
return;
|
|
874
|
+
} catch {
|
|
875
|
+
return;
|
|
876
|
+
}
|
|
877
|
+
}
|
|
701
878
|
state = reduceSessionEvent(state, frame);
|
|
702
879
|
seq = frame.seq;
|
|
703
880
|
for (const listener of eventListeners) {
|
|
@@ -747,6 +924,7 @@ function createSessionClient(transport) {
|
|
|
747
924
|
type: "submit",
|
|
748
925
|
input,
|
|
749
926
|
displayText: opts.displayText,
|
|
927
|
+
...opts.human === void 0 ? {} : { human: structuredClone(opts.human) },
|
|
750
928
|
...opts.attachmentLabels?.length ? { attachmentLabels: opts.attachmentLabels } : {},
|
|
751
929
|
...opts.turnId !== void 0 ? { turnId: opts.turnId } : {}
|
|
752
930
|
})).then(() => {
|
|
@@ -786,6 +964,19 @@ function createSessionClient(transport) {
|
|
|
786
964
|
})).then(() => {
|
|
787
965
|
});
|
|
788
966
|
},
|
|
967
|
+
async abortWithRecovery(request) {
|
|
968
|
+
const captured = parseAbortRecoveryRequest(request);
|
|
969
|
+
const result = await sendCommand((id) => ({
|
|
970
|
+
id,
|
|
971
|
+
type: "abort-with-recovery",
|
|
972
|
+
request: captured
|
|
973
|
+
}));
|
|
974
|
+
try {
|
|
975
|
+
return parseAbortRecoveryResult(result, captured);
|
|
976
|
+
} catch {
|
|
977
|
+
throw new SessionCommandError("invalid-result", "Invalid abort recovery result.");
|
|
978
|
+
}
|
|
979
|
+
},
|
|
789
980
|
abort() {
|
|
790
981
|
return sendCommand((id) => ({ id, type: "abort" })).then(() => {
|
|
791
982
|
});
|
|
@@ -794,8 +985,13 @@ function createSessionClient(transport) {
|
|
|
794
985
|
return sendCommand((id) => ({ id, type: "dequeue", queuedId })).then(() => {
|
|
795
986
|
});
|
|
796
987
|
},
|
|
797
|
-
runSlashCommand(raw) {
|
|
798
|
-
return sendCommand((id) => ({
|
|
988
|
+
runSlashCommand(raw, human) {
|
|
989
|
+
return sendCommand((id) => ({
|
|
990
|
+
id,
|
|
991
|
+
type: "slash-command",
|
|
992
|
+
raw,
|
|
993
|
+
...human === void 0 ? {} : { human: structuredClone(human) }
|
|
994
|
+
})).then(() => {
|
|
799
995
|
});
|
|
800
996
|
},
|
|
801
997
|
loadHistory(historyId) {
|
|
@@ -1317,6 +1513,7 @@ function throwCollectedErrors(errors, message) {
|
|
|
1317
1513
|
}
|
|
1318
1514
|
function bindDaemonDataClient(client, daemonId) {
|
|
1319
1515
|
return {
|
|
1516
|
+
controlCenter: (input) => client.controlCenter(daemonId, input),
|
|
1320
1517
|
fetchTranscript: (identity) => client.fetchTranscript(daemonId, identity),
|
|
1321
1518
|
fetchHistory: (opts) => client.fetchHistory(daemonId, opts),
|
|
1322
1519
|
listHistoryWorkspaces: (opts) => client.listHistoryWorkspaces(daemonId, opts),
|
|
@@ -1463,9 +1660,11 @@ function createDaemonClient(target, deps = {}) {
|
|
|
1463
1660
|
};
|
|
1464
1661
|
}
|
|
1465
1662
|
};
|
|
1663
|
+
const management = target.kind === "relay" ? createControlCenterSocketClient({ getEndpoint: acquireEndpoint, socketFactory }) : void 0;
|
|
1664
|
+
const boundData = bindDaemonDataClient(dataClient, target.id);
|
|
1466
1665
|
return {
|
|
1467
1666
|
target,
|
|
1468
|
-
data:
|
|
1667
|
+
data: management ? { ...boundData, controlCenter: (input) => management.request(input) } : boundData,
|
|
1469
1668
|
directoryEndpoint() {
|
|
1470
1669
|
requireOpen();
|
|
1471
1670
|
return { name: target.name, ...endpointConfig(directorySocketFactory) };
|
|
@@ -1507,6 +1706,11 @@ function createDaemonClient(target, deps = {}) {
|
|
|
1507
1706
|
if (closed) return;
|
|
1508
1707
|
closed = true;
|
|
1509
1708
|
const errors = [];
|
|
1709
|
+
try {
|
|
1710
|
+
management?.close();
|
|
1711
|
+
} catch (error) {
|
|
1712
|
+
errors.push(error);
|
|
1713
|
+
}
|
|
1510
1714
|
for (const connection of [...connections]) {
|
|
1511
1715
|
try {
|
|
1512
1716
|
connection.close();
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { AgentInput, AskUserAnswers } from "@nuvin/agent-core/shared";
|
|
2
|
-
import type { AgentCatalogEntry, AgentDetail, AgentEditorData, AgentEditorDefinition, AgentModelSetSelectionResult, AgentMutationResult, BackgroundWorkCancellationResult, BackgroundWorkInspection, BackgroundWorkPage, CommandDetail, ConfigPatch, ConsolidateProposalDetail, ConsolidateProposalSummary, ConsolidateRunOutcome, CustomProviderInput, DeleteAgentResult, GrantCapability, McpAction, McpActionResult, McpServerInfo, MemoryExtractSummary, PersistBashPermissionRequest, PersistBashPermissionResult, ServerEvent, SessionViewState, SetConfigResult, SkillCatalogEntry, SkillDetail, SlashCommandCompletion, SlashCommandDescriptor, WorkspaceMemoryDetail, WorkspaceMemorySummary } from "../protocol/types.ts";
|
|
2
|
+
import type { AbortRecoveryRequest, AbortRecoveryResult, AgentCatalogEntry, AgentDetail, AgentEditorData, AgentEditorDefinition, AgentModelSetSelectionResult, AgentMutationResult, BackgroundWorkCancellationResult, BackgroundWorkInspection, BackgroundWorkPage, CommandDetail, ConfigPatch, ConsolidateProposalDetail, ConsolidateProposalSummary, ConsolidateRunOutcome, CustomProviderInput, DeleteAgentResult, GrantCapability, McpAction, McpActionResult, McpServerInfo, MemoryExtractSummary, PersistBashPermissionRequest, PersistBashPermissionResult, ServerEvent, SessionViewState, SetConfigResult, SkillCatalogEntry, SkillDetail, SlashCommandCompletion, SlashCommandDescriptor, WorkspaceMemoryDetail, WorkspaceMemorySummary } from "../protocol/types.ts";
|
|
3
3
|
import type { ClientTransport } from "./transport.ts";
|
|
4
4
|
export type ClientSubmitOptions = {
|
|
5
|
+
human?: import("../protocol/types.ts").HumanSubmissionRequest;
|
|
5
6
|
displayText: string;
|
|
6
7
|
attachmentLabels?: string[];
|
|
7
8
|
turnId?: string;
|
|
@@ -22,9 +23,10 @@ export interface SessionClient {
|
|
|
22
23
|
persistBashPermission(toolCallId: string, request: PersistBashPermissionRequest, toolCallPath?: readonly string[]): Promise<PersistBashPermissionResult>;
|
|
23
24
|
answerQuestion(questionId: string, answers: AskUserAnswers, toolCallPath?: readonly string[]): Promise<void>;
|
|
24
25
|
abort(): Promise<void>;
|
|
26
|
+
abortWithRecovery(request: AbortRecoveryRequest): Promise<AbortRecoveryResult>;
|
|
25
27
|
/** Cancel a queued (not-yet-running) message by its `turn-status.queued` id. */
|
|
26
28
|
dequeueMessage(queuedId: string): Promise<void>;
|
|
27
|
-
runSlashCommand(raw: string): Promise<void>;
|
|
29
|
+
runSlashCommand(raw: string, human?: import("../protocol/types.ts").HumanSubmissionRequest): Promise<void>;
|
|
28
30
|
/**
|
|
29
31
|
* Resume a persisted transcript into this session (spec §4.4 load-history —
|
|
30
32
|
* the picker's Local resume path). The host loads the transcript and
|
|
@@ -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;
|
|
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;AAWtF,OAAO,KAAK,EACV,oBAAoB,EACpB,mBAAmB,EACnB,iBAAiB,EACjB,WAAW,EACX,eAAe,EACf,qBAAqB,EACrB,4BAA4B,EAC5B,mBAAmB,EACnB,gCAAgC,EAChC,wBAA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AAC,qBAAqB,CAAC,CAAC;IACjD;;;OAGG;IACH,yBAAyB,IAAI,OAAO,CAAC,qBAAqB,CAAC,CAAC;IAC5D;;;OAGG;IACH,YAAY,IAAI,SAAS,eAAe,EAAE,CAAC;IAC3C;;;OAGG;IACH,iBAAiB,CAAC,QAAQ,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,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;AAmTD,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,eAAe,GAAG,aAAa,CAib7E"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { AgentEvent, AskUserAnswers, AskUserQuestionRequest, Message, ToolExecutionScope, ToolPermissionClass, ToolRuntimeDispatchDecision, ToolUseBlock } from "@nuvin/agent-core/shared";
|
|
2
|
-
import type { BashPolicyApprovalDiagnostics, DirAccessRequest, PersistBashPermissionHandlerResult, PersistBashPermissionRequest, WireAgentEventScope } from "../protocol/types.ts";
|
|
2
|
+
import type { BashPolicyApprovalDiagnostics, DirAccessRequest, PersistBashPermissionHandlerResult, PersistBashPermissionRequest, RecallEntry, RecallState, WireAgentEventScope } 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 = {
|
|
6
|
+
recall: RecallState;
|
|
6
7
|
agentMessages: Message[];
|
|
7
8
|
id: string;
|
|
8
9
|
messages: TuiMessage[];
|
|
@@ -14,10 +15,12 @@ export type SessionLoadedPayload = {
|
|
|
14
15
|
*/
|
|
15
16
|
export declare function toWireSessionScope(scope: ToolExecutionScope): WireAgentEventScope | undefined;
|
|
16
17
|
export type AgentEventPayload = {
|
|
18
|
+
executionId?: string;
|
|
17
19
|
event: AgentEvent;
|
|
18
20
|
scope?: WireAgentEventScope;
|
|
19
21
|
};
|
|
20
22
|
export type ToolCallRequest = {
|
|
23
|
+
executionId?: string;
|
|
21
24
|
agentId: string;
|
|
22
25
|
approvalKey?: string;
|
|
23
26
|
bashPolicy?: BashPolicyApprovalDiagnostics;
|
|
@@ -46,7 +49,9 @@ export declare class AgentChannel {
|
|
|
46
49
|
private readonly emitter;
|
|
47
50
|
private decider;
|
|
48
51
|
private questionHandler;
|
|
49
|
-
publishEvent(event: AgentEvent, scope?: ToolExecutionScope): void;
|
|
52
|
+
publishEvent(event: AgentEvent, scope?: ToolExecutionScope, executionId?: string): void;
|
|
53
|
+
publishRecallEntry(entry: RecallEntry): void;
|
|
54
|
+
onRecallEntry(listener: (entry: RecallEntry) => void): () => void;
|
|
50
55
|
publishSessionLoaded(loaded: SessionLoadedPayload): void;
|
|
51
56
|
requestToolDecision(request: ToolCallRequest): Promise<ToolRuntimeDispatchDecision> | ToolRuntimeDispatchDecision;
|
|
52
57
|
requestUserQuestion(request: AskUserQuestionRequest, scope?: ToolExecutionScope): Promise<AskUserAnswers>;
|
|
@@ -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,kBAAkB,EAClB,mBAAmB,EACnB,2BAA2B,EAC3B,YAAY,EACb,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EACV,6BAA6B,EAC7B,gBAAgB,EAChB,kCAAkC,EAClC,4BAA4B,EAC5B,mBAAmB,EACpB,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,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