@nuvin/session 0.1.1-rc.2 → 0.2.0-rc.10
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-WB4FEWBI.js → chunk-3CVYVANJ.js} +1 -1
- package/dist/chunk-7LEIACBZ.js +85 -0
- package/dist/{chunk-COVRYM64.js → chunk-KQHHBUVY.js} +137 -47
- package/dist/client/daemon-client.d.ts.map +1 -1
- package/dist/client/data-client.d.ts +10 -15
- package/dist/client/data-client.d.ts.map +1 -1
- package/dist/client/directory.d.ts +12 -14
- package/dist/client/directory.d.ts.map +1 -1
- package/dist/client/http-data-client.d.ts +5 -0
- package/dist/client/http-data-client.d.ts.map +1 -1
- package/dist/client/index.js +299 -40
- package/dist/client/session-client.d.ts +30 -4
- package/dist/client/session-client.d.ts.map +1 -1
- package/dist/client/websocket.d.ts.map +1 -1
- package/dist/controller/agent-channel.d.ts +10 -5
- package/dist/controller/agent-channel.d.ts.map +1 -1
- package/dist/controller/index.js +323 -48
- package/dist/controller/session-controller.d.ts +15 -14
- package/dist/controller/session-controller.d.ts.map +1 -1
- package/dist/controller/test-utils.d.ts +3 -1
- package/dist/controller/test-utils.d.ts.map +1 -1
- package/dist/protocol/data-rpc.d.ts +13 -14
- package/dist/protocol/data-rpc.d.ts.map +1 -1
- package/dist/protocol/history-text.d.ts +4 -0
- package/dist/protocol/history-text.d.ts.map +1 -0
- package/dist/protocol/index.d.ts +1 -0
- package/dist/protocol/index.d.ts.map +1 -1
- package/dist/protocol/index.js +12 -4
- package/dist/protocol/model-identity.d.ts +7 -0
- package/dist/protocol/model-identity.d.ts.map +1 -1
- package/dist/protocol/types.d.ts +339 -35
- package/dist/protocol/types.d.ts.map +1 -1
- package/dist/protocol/version.d.ts +1 -1
- package/dist/state/approvals.d.ts +4 -15
- package/dist/state/approvals.d.ts.map +1 -1
- package/dist/state/index.d.ts +2 -0
- package/dist/state/index.d.ts.map +1 -1
- package/dist/state/index.js +15 -9
- package/dist/state/messages.d.ts +12 -2
- package/dist/state/messages.d.ts.map +1 -1
- package/dist/state/questions.d.ts +5 -0
- package/dist/state/questions.d.ts.map +1 -0
- package/dist/state/session.d.ts.map +1 -1
- package/dist/state/tool-key.d.ts +2 -0
- package/dist/state/tool-key.d.ts.map +1 -0
- package/dist/state/tool-preview.d.ts +5 -0
- package/dist/state/tool-preview.d.ts.map +1 -1
- package/dist/state/tool-preview.js +81 -29
- package/dist/test-utils/index.js +2 -2
- package/package.json +3 -3
- package/dist/chunk-7HGJO7ZX.js +0 -9
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
// src/protocol/history-text.ts
|
|
2
|
+
function stripTerminalStringSequences(value) {
|
|
3
|
+
let sanitized = "";
|
|
4
|
+
for (let index = 0; index < value.length; ) {
|
|
5
|
+
const code = value.charCodeAt(index);
|
|
6
|
+
const next = value.charCodeAt(index + 1);
|
|
7
|
+
const isSevenBitSequence = code === 27 && [80, 88, 93, 94, 95].includes(next);
|
|
8
|
+
const isEightBitSequence = [144, 152, 157, 158, 159].includes(code);
|
|
9
|
+
if (!isSevenBitSequence && !isEightBitSequence) {
|
|
10
|
+
sanitized += value[index];
|
|
11
|
+
index += 1;
|
|
12
|
+
continue;
|
|
13
|
+
}
|
|
14
|
+
index += isSevenBitSequence ? 2 : 1;
|
|
15
|
+
while (index < value.length) {
|
|
16
|
+
const terminator = value.charCodeAt(index);
|
|
17
|
+
if (terminator === 7 || terminator === 156) {
|
|
18
|
+
index += 1;
|
|
19
|
+
break;
|
|
20
|
+
}
|
|
21
|
+
if (terminator === 27 && value.charCodeAt(index + 1) === 92) {
|
|
22
|
+
index += 2;
|
|
23
|
+
break;
|
|
24
|
+
}
|
|
25
|
+
index += 1;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return sanitized;
|
|
29
|
+
}
|
|
30
|
+
function stripTerminalControlSequences(value) {
|
|
31
|
+
let sanitized = "";
|
|
32
|
+
for (let index = 0; index < value.length; ) {
|
|
33
|
+
const code = value.charCodeAt(index);
|
|
34
|
+
const isCsi = code === 155 || code === 27 && value.charCodeAt(index + 1) === 91;
|
|
35
|
+
if (isCsi) {
|
|
36
|
+
index += code === 27 ? 2 : 1;
|
|
37
|
+
while (index < value.length) {
|
|
38
|
+
const current = value.charCodeAt(index);
|
|
39
|
+
index += 1;
|
|
40
|
+
if (current >= 64 && current <= 126) break;
|
|
41
|
+
}
|
|
42
|
+
continue;
|
|
43
|
+
}
|
|
44
|
+
if (code === 27) {
|
|
45
|
+
index += 1;
|
|
46
|
+
while (index < value.length) {
|
|
47
|
+
const current = value.charCodeAt(index);
|
|
48
|
+
index += 1;
|
|
49
|
+
if (current < 32 || current > 47) break;
|
|
50
|
+
}
|
|
51
|
+
continue;
|
|
52
|
+
}
|
|
53
|
+
sanitized += value[index];
|
|
54
|
+
index += 1;
|
|
55
|
+
}
|
|
56
|
+
return sanitized;
|
|
57
|
+
}
|
|
58
|
+
function sanitizeHistoryDisplayText(value) {
|
|
59
|
+
return stripTerminalControlSequences(stripTerminalStringSequences(value.normalize("NFKC"))).replace(new RegExp("\\p{Cc}", "gu"), (control) => /\s/u.test(control) ? " " : "").replace(/\s+/gu, " ").trim();
|
|
60
|
+
}
|
|
61
|
+
function normalizeHistoryText(value) {
|
|
62
|
+
return sanitizeHistoryDisplayText(value).toLowerCase();
|
|
63
|
+
}
|
|
64
|
+
function escapeLikeLiteral(value) {
|
|
65
|
+
return value.replaceAll("\\", "\\\\").replaceAll("%", "\\%").replaceAll("_", "\\_");
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// src/protocol/model-identity.ts
|
|
69
|
+
function modelNameFromIdentity(modelIdentity) {
|
|
70
|
+
const separator = modelIdentity.indexOf(":");
|
|
71
|
+
return separator === -1 ? modelIdentity : modelIdentity.slice(separator + 1);
|
|
72
|
+
}
|
|
73
|
+
function providerFromIdentity(modelIdentity) {
|
|
74
|
+
const separator = modelIdentity.indexOf(":");
|
|
75
|
+
if (separator <= 0) return void 0;
|
|
76
|
+
return modelIdentity.slice(0, separator);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export {
|
|
80
|
+
sanitizeHistoryDisplayText,
|
|
81
|
+
normalizeHistoryText,
|
|
82
|
+
escapeLikeLiteral,
|
|
83
|
+
modelNameFromIdentity,
|
|
84
|
+
providerFromIdentity
|
|
85
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/state/approvals.ts
|
|
2
|
-
var
|
|
2
|
+
var BACKGROUNDLESS_TOOLS = /* @__PURE__ */ new Set([
|
|
3
3
|
"FileRead",
|
|
4
4
|
"ViewFile",
|
|
5
5
|
"Ls",
|
|
@@ -8,27 +8,18 @@ var READ_ONLY_TOOLS = /* @__PURE__ */ new Set([
|
|
|
8
8
|
"LoadSkill",
|
|
9
9
|
"Lsp",
|
|
10
10
|
"WebFetch",
|
|
11
|
-
"WebSearch"
|
|
12
|
-
]);
|
|
13
|
-
var BACKGROUNDLESS_TOOLS = /* @__PURE__ */ new Set([
|
|
14
|
-
...READ_ONLY_TOOLS,
|
|
11
|
+
"WebSearch",
|
|
15
12
|
"FileNew",
|
|
16
13
|
"TodoWrite",
|
|
17
14
|
"UpdateTopic",
|
|
18
|
-
"
|
|
19
|
-
"
|
|
15
|
+
"Memory",
|
|
16
|
+
"MemoryRead",
|
|
20
17
|
"InvokeCommand"
|
|
21
18
|
]);
|
|
22
|
-
|
|
23
|
-
var AUTO_APPROVED_TOOLS = /* @__PURE__ */ new Set([...READ_ONLY_TOOLS, ...INTERACTIVE_TOOLS]);
|
|
24
|
-
function isAutoApprovedTool(toolName) {
|
|
25
|
-
return AUTO_APPROVED_TOOLS.has(toolName);
|
|
26
|
-
}
|
|
27
|
-
var EDIT_TOOLS = /* @__PURE__ */ new Set(["FileEdit", "FileNew"]);
|
|
28
|
-
function isToolAutoApprovedForMode(mode, toolName, baselineAutoApproved = isAutoApprovedTool) {
|
|
19
|
+
function isToolAutoApprovedForMode(mode, permissionClass) {
|
|
29
20
|
if (mode === "sudo") return true;
|
|
30
|
-
if (
|
|
31
|
-
return
|
|
21
|
+
if (permissionClass === "read") return true;
|
|
22
|
+
return mode === "write" && permissionClass === "write";
|
|
32
23
|
}
|
|
33
24
|
function createApprovalQueueState() {
|
|
34
25
|
return { active: null, pending: [] };
|
|
@@ -56,6 +47,11 @@ function asJsonObject(value) {
|
|
|
56
47
|
return typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
|
|
57
48
|
}
|
|
58
49
|
|
|
50
|
+
// src/state/tool-key.ts
|
|
51
|
+
function scopedToolKey(parentToolCallId, toolCallId) {
|
|
52
|
+
return JSON.stringify([parentToolCallId ?? null, toolCallId]);
|
|
53
|
+
}
|
|
54
|
+
|
|
59
55
|
// src/state/messages.ts
|
|
60
56
|
import { getReasoningTextFromMessage, getTextFromMessage } from "@nuvin/agent-core/formats";
|
|
61
57
|
function createMessageId(state) {
|
|
@@ -126,6 +122,17 @@ function settleLiveReasoning(state, parentToolCallId, now) {
|
|
|
126
122
|
});
|
|
127
123
|
return changed ? { ...state, messages } : state;
|
|
128
124
|
}
|
|
125
|
+
function settleAllLiveReasoning(state, now) {
|
|
126
|
+
let changed = false;
|
|
127
|
+
const messages = state.messages.map((message) => {
|
|
128
|
+
if (message.role === "reasoning" && message.live) {
|
|
129
|
+
changed = true;
|
|
130
|
+
return { ...message, live: false, completedAt: message.completedAt ?? now };
|
|
131
|
+
}
|
|
132
|
+
return message;
|
|
133
|
+
});
|
|
134
|
+
return changed ? { ...state, messages } : state;
|
|
135
|
+
}
|
|
129
136
|
function summarizeToolInput(input) {
|
|
130
137
|
const objectInput = asJsonObject(input);
|
|
131
138
|
if (!objectInput) {
|
|
@@ -219,7 +226,8 @@ function mergeToolResultText(currentText, result) {
|
|
|
219
226
|
return currentText;
|
|
220
227
|
}
|
|
221
228
|
function ensureToolMessage(state, toolCall, parentToolCallId) {
|
|
222
|
-
const
|
|
229
|
+
const toolKey = scopedToolKey(parentToolCallId, toolCall.id);
|
|
230
|
+
const existingId = state.toolMessageIds[toolKey];
|
|
223
231
|
if (existingId) {
|
|
224
232
|
return withUpdatedMessage(state, existingId, (message) => {
|
|
225
233
|
if (message.role !== "tool" || message.input !== void 0) {
|
|
@@ -247,12 +255,12 @@ function ensureToolMessage(state, toolCall, parentToolCallId) {
|
|
|
247
255
|
...nextState,
|
|
248
256
|
toolMessageIds: {
|
|
249
257
|
...nextState.toolMessageIds,
|
|
250
|
-
[
|
|
258
|
+
[toolKey]: id
|
|
251
259
|
}
|
|
252
260
|
};
|
|
253
261
|
}
|
|
254
|
-
function setToolMessageStatus(state, toolCallId, status) {
|
|
255
|
-
const toolMessageId = state.toolMessageIds[toolCallId];
|
|
262
|
+
function setToolMessageStatus(state, toolCallId, status, parentToolCallId) {
|
|
263
|
+
const toolMessageId = state.toolMessageIds[scopedToolKey(parentToolCallId, toolCallId)];
|
|
256
264
|
if (!toolMessageId) {
|
|
257
265
|
return state;
|
|
258
266
|
}
|
|
@@ -266,8 +274,23 @@ function setToolMessageStatus(state, toolCallId, status) {
|
|
|
266
274
|
};
|
|
267
275
|
});
|
|
268
276
|
}
|
|
269
|
-
function
|
|
270
|
-
const toolMessageId = state.toolMessageIds[toolCallId];
|
|
277
|
+
function setToolMessageApprovalKind(state, toolCallId, approvalKind, parentToolCallId) {
|
|
278
|
+
const toolMessageId = state.toolMessageIds[scopedToolKey(parentToolCallId, toolCallId)];
|
|
279
|
+
if (!toolMessageId) {
|
|
280
|
+
return state;
|
|
281
|
+
}
|
|
282
|
+
return withUpdatedMessage(state, toolMessageId, (message) => {
|
|
283
|
+
if (message.role !== "tool" || message.toolName !== "Bash") {
|
|
284
|
+
return message;
|
|
285
|
+
}
|
|
286
|
+
return {
|
|
287
|
+
...message,
|
|
288
|
+
approvalKind
|
|
289
|
+
};
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
function setToolMessageHidden(state, toolCallId, hidden, parentToolCallId) {
|
|
293
|
+
const toolMessageId = state.toolMessageIds[scopedToolKey(parentToolCallId, toolCallId)];
|
|
271
294
|
if (!toolMessageId) {
|
|
272
295
|
return state;
|
|
273
296
|
}
|
|
@@ -281,9 +304,10 @@ function setToolMessageHidden(state, toolCallId, hidden) {
|
|
|
281
304
|
};
|
|
282
305
|
});
|
|
283
306
|
}
|
|
284
|
-
function applyToolResult(state, result, now) {
|
|
307
|
+
function applyToolResult(state, result, now, parentToolCallId) {
|
|
285
308
|
const status = asJsonObject(result.structured)?.error === "tool_rejected" ? "rejected" : result.status;
|
|
286
|
-
const
|
|
309
|
+
const toolKey = scopedToolKey(parentToolCallId, result.callId);
|
|
310
|
+
const toolMessageId = state.toolMessageIds[toolKey];
|
|
287
311
|
if (!toolMessageId) {
|
|
288
312
|
const id = createMessageId(state);
|
|
289
313
|
const next = addMessage(state, {
|
|
@@ -295,13 +319,14 @@ function applyToolResult(state, result, now) {
|
|
|
295
319
|
status,
|
|
296
320
|
summary: "",
|
|
297
321
|
text: result.output,
|
|
298
|
-
structured: result.structured
|
|
322
|
+
structured: result.structured,
|
|
323
|
+
...parentToolCallId ? { parentToolCallId } : {}
|
|
299
324
|
});
|
|
300
325
|
return {
|
|
301
326
|
...next,
|
|
302
327
|
toolMessageIds: {
|
|
303
328
|
...next.toolMessageIds,
|
|
304
|
-
[
|
|
329
|
+
[toolKey]: id
|
|
305
330
|
}
|
|
306
331
|
};
|
|
307
332
|
}
|
|
@@ -338,7 +363,7 @@ function createMessageStateFromMessages(messages) {
|
|
|
338
363
|
const toolMessageIds = {};
|
|
339
364
|
for (const message of messages) {
|
|
340
365
|
if (message.role === "tool") {
|
|
341
|
-
toolMessageIds[message.toolCallId] = message.id;
|
|
366
|
+
toolMessageIds[scopedToolKey(message.parentToolCallId, message.toolCallId)] = message.id;
|
|
342
367
|
}
|
|
343
368
|
}
|
|
344
369
|
return {
|
|
@@ -463,7 +488,7 @@ function applyAgentEvent(state, event, parentToolCallId, now = Date.now()) {
|
|
|
463
488
|
return ensureToolMessage(state, event.toolCall, parentToolCallId);
|
|
464
489
|
case "tool_started": {
|
|
465
490
|
const toolState = ensureToolMessage(state, event.toolCall, parentToolCallId);
|
|
466
|
-
const toolMessageId = toolState.toolMessageIds[event.toolCall.id];
|
|
491
|
+
const toolMessageId = toolState.toolMessageIds[scopedToolKey(parentToolCallId, event.toolCall.id)];
|
|
467
492
|
return withUpdatedMessage(toolState, toolMessageId, (message) => {
|
|
468
493
|
if (message.role !== "tool") {
|
|
469
494
|
return message;
|
|
@@ -477,7 +502,7 @@ function applyAgentEvent(state, event, parentToolCallId, now = Date.now()) {
|
|
|
477
502
|
}
|
|
478
503
|
case "tool_output_chunk": {
|
|
479
504
|
const toolState = ensureToolMessage(state, event.toolCall, parentToolCallId);
|
|
480
|
-
const toolMessageId = toolState.toolMessageIds[event.toolCall.id];
|
|
505
|
+
const toolMessageId = toolState.toolMessageIds[scopedToolKey(parentToolCallId, event.toolCall.id)];
|
|
481
506
|
return withUpdatedMessage(toolState, toolMessageId, (message) => {
|
|
482
507
|
if (message.role !== "tool") {
|
|
483
508
|
return message;
|
|
@@ -497,13 +522,13 @@ function applyAgentEvent(state, event, parentToolCallId, now = Date.now()) {
|
|
|
497
522
|
}
|
|
498
523
|
case "tool_completed": {
|
|
499
524
|
const toolState = ensureToolMessage(state, event.toolCall, parentToolCallId);
|
|
500
|
-
return applyToolResult(toolState, event.result, now);
|
|
525
|
+
return applyToolResult(toolState, event.result, now, parentToolCallId);
|
|
501
526
|
}
|
|
502
527
|
case "tool_result":
|
|
503
|
-
return applyToolResult(state, event.result, now);
|
|
528
|
+
return applyToolResult(state, event.result, now, parentToolCallId);
|
|
504
529
|
case "tool_rejected": {
|
|
505
530
|
const toolState = ensureToolMessage(state, event.toolCall, parentToolCallId);
|
|
506
|
-
const toolMessageId = toolState.toolMessageIds[event.toolCall.id];
|
|
531
|
+
const toolMessageId = toolState.toolMessageIds[scopedToolKey(parentToolCallId, event.toolCall.id)];
|
|
507
532
|
return withUpdatedMessage(toolState, toolMessageId, (message) => {
|
|
508
533
|
if (message.role !== "tool") {
|
|
509
534
|
return message;
|
|
@@ -530,6 +555,25 @@ function applyAgentEvent(state, event, parentToolCallId, now = Date.now()) {
|
|
|
530
555
|
}
|
|
531
556
|
}
|
|
532
557
|
|
|
558
|
+
// src/state/questions.ts
|
|
559
|
+
function createQuestionQueueState() {
|
|
560
|
+
return { active: null, pending: [] };
|
|
561
|
+
}
|
|
562
|
+
function enqueueQuestion(state, question) {
|
|
563
|
+
if (state.active === null) {
|
|
564
|
+
return { ...state, active: question };
|
|
565
|
+
}
|
|
566
|
+
return { ...state, pending: [...state.pending, question] };
|
|
567
|
+
}
|
|
568
|
+
function removeQuestion(state, questionId) {
|
|
569
|
+
if (state.active?.questionId === questionId) {
|
|
570
|
+
const [active, ...pending2] = state.pending;
|
|
571
|
+
return { active: active ?? null, pending: pending2 };
|
|
572
|
+
}
|
|
573
|
+
const pending = state.pending.filter((question) => question.questionId !== questionId);
|
|
574
|
+
return pending.length === state.pending.length ? state : { ...state, pending };
|
|
575
|
+
}
|
|
576
|
+
|
|
533
577
|
// src/state/workflow-view.ts
|
|
534
578
|
function createWorkflowViewState(runId) {
|
|
535
579
|
return { runId, status: "running", tree: [], counts: {}, tokens: 0, lastSeq: -1, nodeKeys: {} };
|
|
@@ -591,14 +635,14 @@ function createSessionViewState() {
|
|
|
591
635
|
approval: createApprovalQueueState(),
|
|
592
636
|
authFlow: null,
|
|
593
637
|
busy: false,
|
|
594
|
-
mcp: { revision: 0, servers: []
|
|
638
|
+
mcp: { revision: 0, servers: [] },
|
|
595
639
|
messages: createMessageState(),
|
|
596
|
-
meta: { approvalMode: "
|
|
640
|
+
meta: { approvalMode: "read-only", cwd: "", modelIdentity: "", persona: "default" },
|
|
597
641
|
metrics: null,
|
|
598
642
|
queuedCount: 0,
|
|
599
643
|
queued: [],
|
|
600
644
|
workflows: {},
|
|
601
|
-
question:
|
|
645
|
+
question: createQuestionQueueState()
|
|
602
646
|
};
|
|
603
647
|
}
|
|
604
648
|
function reduceSessionEvent(state, event) {
|
|
@@ -611,7 +655,20 @@ function reduceSessionEvent(state, event) {
|
|
|
611
655
|
event.at
|
|
612
656
|
);
|
|
613
657
|
if (event.toolStatus && event.event.type === "tool_call") {
|
|
614
|
-
messages = setToolMessageStatus(
|
|
658
|
+
messages = setToolMessageStatus(
|
|
659
|
+
messages,
|
|
660
|
+
event.event.toolCall.id,
|
|
661
|
+
event.toolStatus,
|
|
662
|
+
event.scope?.parentToolCallId
|
|
663
|
+
);
|
|
664
|
+
if (event.toolStatus === "approved") {
|
|
665
|
+
messages = setToolMessageApprovalKind(
|
|
666
|
+
messages,
|
|
667
|
+
event.event.toolCall.id,
|
|
668
|
+
"auto",
|
|
669
|
+
event.scope?.parentToolCallId
|
|
670
|
+
);
|
|
671
|
+
}
|
|
615
672
|
}
|
|
616
673
|
return { ...state, messages };
|
|
617
674
|
}
|
|
@@ -624,33 +681,63 @@ function reduceSessionEvent(state, event) {
|
|
|
624
681
|
return {
|
|
625
682
|
...state,
|
|
626
683
|
approval: enqueueApproval(state.approval, event.approval),
|
|
627
|
-
messages: setToolMessageHidden(
|
|
684
|
+
messages: setToolMessageHidden(
|
|
685
|
+
state.messages,
|
|
686
|
+
event.approval.toolCallId,
|
|
687
|
+
true,
|
|
688
|
+
event.approval.parentToolCallId
|
|
689
|
+
)
|
|
628
690
|
};
|
|
629
691
|
case "approval-settled": {
|
|
630
|
-
|
|
692
|
+
let stamped = setToolMessageStatus(
|
|
693
|
+
state.messages,
|
|
694
|
+
event.toolCallId,
|
|
695
|
+
event.status,
|
|
696
|
+
event.parentToolCallId
|
|
697
|
+
);
|
|
698
|
+
if (event.status === "approved" && event.by === "client") {
|
|
699
|
+
stamped = setToolMessageApprovalKind(
|
|
700
|
+
stamped,
|
|
701
|
+
event.toolCallId,
|
|
702
|
+
"user",
|
|
703
|
+
event.parentToolCallId
|
|
704
|
+
);
|
|
705
|
+
}
|
|
631
706
|
return {
|
|
632
707
|
...state,
|
|
633
|
-
approval: removeApproval(
|
|
708
|
+
approval: removeApproval(
|
|
709
|
+
state.approval,
|
|
710
|
+
(item) => item.toolCallId === event.toolCallId && item.parentToolCallId === event.parentToolCallId
|
|
711
|
+
),
|
|
634
712
|
// Approved tools materialize as a transcript row; rejected ones never
|
|
635
713
|
// ran and stay hidden.
|
|
636
|
-
messages: event.status === "approved" ? setToolMessageHidden(stamped, event.toolCallId, false) : stamped
|
|
714
|
+
messages: event.status === "approved" ? setToolMessageHidden(stamped, event.toolCallId, false, event.parentToolCallId) : stamped
|
|
637
715
|
};
|
|
638
716
|
}
|
|
639
717
|
case "question-asked":
|
|
640
|
-
return { ...state, question:
|
|
718
|
+
return { ...state, question: enqueueQuestion(state.question, event.question) };
|
|
641
719
|
case "question-settled":
|
|
642
|
-
return
|
|
643
|
-
case "turn-status":
|
|
720
|
+
return { ...state, question: removeQuestion(state.question, event.questionId) };
|
|
721
|
+
case "turn-status": {
|
|
722
|
+
const messages = event.busy ? state.messages : settleAllLiveReasoning(state.messages, event.at);
|
|
644
723
|
return {
|
|
645
724
|
...state,
|
|
646
725
|
busy: event.busy,
|
|
726
|
+
messages,
|
|
647
727
|
queuedCount: event.queuedCount,
|
|
648
728
|
queued: event.queued ?? []
|
|
649
729
|
};
|
|
730
|
+
}
|
|
650
731
|
case "info":
|
|
651
732
|
return { ...state, messages: appendInfoMessage(state.messages, event.message) };
|
|
652
733
|
case "error":
|
|
653
|
-
return {
|
|
734
|
+
return {
|
|
735
|
+
...state,
|
|
736
|
+
messages: appendErrorMessage(
|
|
737
|
+
settleAllLiveReasoning(state.messages, event.at),
|
|
738
|
+
event.message
|
|
739
|
+
)
|
|
740
|
+
};
|
|
654
741
|
case "session-meta":
|
|
655
742
|
return { ...state, meta: event.meta };
|
|
656
743
|
case "metrics":
|
|
@@ -674,17 +761,17 @@ function reduceSessionEvent(state, event) {
|
|
|
674
761
|
}
|
|
675
762
|
|
|
676
763
|
export {
|
|
677
|
-
READ_ONLY_TOOLS,
|
|
678
764
|
BACKGROUNDLESS_TOOLS,
|
|
679
|
-
isAutoApprovedTool,
|
|
680
|
-
EDIT_TOOLS,
|
|
681
765
|
isToolAutoApprovedForMode,
|
|
682
766
|
createApprovalQueueState,
|
|
683
767
|
enqueueApproval,
|
|
684
768
|
dequeueActiveApproval,
|
|
685
769
|
removeApproval,
|
|
686
770
|
asJsonObject,
|
|
771
|
+
scopedToolKey,
|
|
772
|
+
settleAllLiveReasoning,
|
|
687
773
|
setToolMessageStatus,
|
|
774
|
+
setToolMessageApprovalKind,
|
|
688
775
|
setToolMessageHidden,
|
|
689
776
|
createMessageState,
|
|
690
777
|
createMessageStateFromMessages,
|
|
@@ -693,6 +780,9 @@ export {
|
|
|
693
780
|
appendInfoMessage,
|
|
694
781
|
appendWarningMessage,
|
|
695
782
|
applyAgentEvent,
|
|
783
|
+
createQuestionQueueState,
|
|
784
|
+
enqueueQuestion,
|
|
785
|
+
removeQuestion,
|
|
696
786
|
createSessionViewState,
|
|
697
787
|
reduceSessionEvent
|
|
698
788
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"daemon-client.d.ts","sourceRoot":"","sources":["../../src/client/daemon-client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAE5D,OAAO,EAAuB,KAAK,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAC9E,OAAO,EAAwB,KAAK,eAAe,EAAE,MAAM,aAAa,CAAC;AAEzE,OAAO,EAEL,KAAK,wBAAwB,EAC7B,KAAK,yBAAyB,EAC/B,MAAM,gBAAgB,CAAC;AAExB,MAAM,MAAM,YAAY,GACpB;IACE,IAAI,EAAE,OAAO,CAAC;IACd,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,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AAED,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,YAAY,EACpB,IAAI,GAAE,gBAAqB,GAC1B,YAAY,CA8Md"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AddProviderInput, ConfigMutationResult, DaemonDirectoryRow, HistoryPage, ProfileSummary, ProviderConfigSummary, ProviderCredentialInput, SessionSnapshot, UpdateWorkspaceInput, WorkspaceConfigSummary } from "../protocol/index.ts";
|
|
1
|
+
import type { AddProviderInput, ConfigMutationResult, DaemonDirectoryRow, HistoryPage, ListHistoryParams, ListHistoryWorkspacesParams, ListHistoryWorkspacesResult, ListWorkspaceHistoryParams, PersistenceIdentity, ProfileSummary, ProviderConfigSummary, ProviderCredentialInput, SessionSnapshot, UpdateWorkspaceInput, WorkspaceConfigSummary, WorkspaceHistoryPage } from "../protocol/index.ts";
|
|
2
2
|
import type { TransportCredential } from "./endpoint.ts";
|
|
3
3
|
/** Discovery payload: the daemon directory (account-scoped cloud, machine-scoped local). */
|
|
4
4
|
export type DaemonDirectory = {
|
|
@@ -33,16 +33,14 @@ export interface DaemonDirectoryClient {
|
|
|
33
33
|
* message; everything else is a plain `Error`.
|
|
34
34
|
*/
|
|
35
35
|
export interface DaemonDataClient {
|
|
36
|
-
fetchTranscript(daemonId: string,
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
cursor?: string;
|
|
45
|
-
}): Promise<HistoryPage>;
|
|
36
|
+
fetchTranscript(daemonId: string, identity: PersistenceIdentity): Promise<SessionSnapshot>;
|
|
37
|
+
fetchHistory(daemonId: string, opts?: ListHistoryParams): Promise<HistoryPage>;
|
|
38
|
+
listHistoryWorkspaces(daemonId: string, opts?: ListHistoryWorkspacesParams & {
|
|
39
|
+
signal?: AbortSignal;
|
|
40
|
+
}): Promise<ListHistoryWorkspacesResult>;
|
|
41
|
+
listWorkspaceHistory(daemonId: string, opts?: ListWorkspaceHistoryParams & {
|
|
42
|
+
signal?: AbortSignal;
|
|
43
|
+
}): Promise<WorkspaceHistoryPage>;
|
|
46
44
|
listWorkspaces(daemonId: string, opts?: {
|
|
47
45
|
profile?: string;
|
|
48
46
|
}): Promise<WorkspaceConfigSummary[]>;
|
|
@@ -51,10 +49,7 @@ export interface DaemonDataClient {
|
|
|
51
49
|
root?: string;
|
|
52
50
|
profile?: string;
|
|
53
51
|
}): Promise<WorkspaceConfigSummary>;
|
|
54
|
-
deleteSession(daemonId: string,
|
|
55
|
-
workspace?: string;
|
|
56
|
-
profile?: string;
|
|
57
|
-
}): Promise<void>;
|
|
52
|
+
deleteSession(daemonId: string, identity: PersistenceIdentity): Promise<void>;
|
|
58
53
|
listProfiles(daemonId: string): Promise<ProfileSummary[]>;
|
|
59
54
|
listProviders(daemonId: string, opts?: {
|
|
60
55
|
profile?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-client.d.ts","sourceRoot":"","sources":["../../src/client/data-client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,oBAAoB,EACpB,kBAAkB,EAClB,WAAW,EACX,cAAc,EACd,qBAAqB,EACrB,uBAAuB,EACvB,eAAe,EACf,oBAAoB,EACpB,sBAAsB,
|
|
1
|
+
{"version":3,"file":"data-client.d.ts","sourceRoot":"","sources":["../../src/client/data-client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,oBAAoB,EACpB,kBAAkB,EAClB,WAAW,EACX,iBAAiB,EACjB,2BAA2B,EAC3B,2BAA2B,EAC3B,0BAA0B,EAC1B,mBAAmB,EACnB,cAAc,EACd,qBAAqB,EACrB,uBAAuB,EACvB,eAAe,EACf,oBAAoB,EACpB,sBAAsB,EACtB,oBAAoB,EACrB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAEzD,4FAA4F;AAC5F,MAAM,MAAM,e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AAM,CAAA;KAAE,GAC1B,OAAO,CAAC,oBAAoB,CAAC,IAAI,CAAC,CAAC,CAAC;IACvC,eAAe,CACb,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,oBAAoB,GAC1B,OAAO,CAAC,oBAAoB,CAAC,sBAAsB,CAAC,CAAC,CAAC;CAC1D;AAED,0DAA0D;AAC1D,MAAM,MAAM,UAAU,GAAG,qBAAqB,GAAG,gBAAgB,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { SessionDescriptor } from "../protocol/types.ts";
|
|
1
|
+
import type { PersistenceIdentity, SessionDescriptor } from "../protocol/types.ts";
|
|
2
2
|
import type { SessionApprovalMode } from "../state/approvals.ts";
|
|
3
3
|
import type { GetEndpoint } from "./endpoint.ts";
|
|
4
4
|
import { type TransportSocket } from "./socket.ts";
|
|
@@ -37,6 +37,15 @@ export type DirectoryServerView = {
|
|
|
37
37
|
export type DirectoryView = {
|
|
38
38
|
servers: DirectoryServerView[];
|
|
39
39
|
};
|
|
40
|
+
export type DaemonRequestErrorCode = "transcript-unavailable" | "transcript-corrupt" | "history-state-conflict" | "ambiguous-session-identity";
|
|
41
|
+
export declare class DaemonRequestError extends Error {
|
|
42
|
+
readonly code?: DaemonRequestErrorCode;
|
|
43
|
+
readonly identity?: PersistenceIdentity;
|
|
44
|
+
constructor(message: string, options?: {
|
|
45
|
+
code?: string;
|
|
46
|
+
identity?: PersistenceIdentity;
|
|
47
|
+
});
|
|
48
|
+
}
|
|
40
49
|
export type ServerDirectoryOptions = {
|
|
41
50
|
servers: DirectoryServerConfig[];
|
|
42
51
|
/** Test seam / socket override. Defaults to the global WHATWG WebSocket (browsers, node >= 22). */
|
|
@@ -80,19 +89,8 @@ export interface ServerDirectory {
|
|
|
80
89
|
activeProvider?: string;
|
|
81
90
|
activeModel?: string;
|
|
82
91
|
}): Promise<SessionDescriptor>;
|
|
83
|
-
/**
|
|
84
|
-
|
|
85
|
-
* resolves the live `SessionDescriptor` the daemon rehydrated. The cold
|
|
86
|
-
* transcript carries no cwd, so the caller supplies the cwd the rehydrated
|
|
87
|
-
* runtime runs in. Idempotent daemon-side (an already-live id resolves to the
|
|
88
|
-
* existing live session).
|
|
89
|
-
*/
|
|
90
|
-
resumeSession(server: string, historyId: string, options: {
|
|
91
|
-
cwd: string;
|
|
92
|
-
name?: string;
|
|
93
|
-
workspace?: string;
|
|
94
|
-
profile?: string;
|
|
95
|
-
}): Promise<SessionDescriptor>;
|
|
92
|
+
/** Resume one exact durable session identity. */
|
|
93
|
+
resumeSession(server: string, identity: PersistenceIdentity): Promise<SessionDescriptor>;
|
|
96
94
|
killSession(server: string, sessionId: string, options?: {
|
|
97
95
|
delete?: boolean;
|
|
98
96
|
}): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"directory.d.ts","sourceRoot":"","sources":["../../src/client/directory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"directory.d.ts","sourceRoot":"","sources":["../../src/client/directory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,mBAAmB,EACnB,iBAAiB,EAClB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,KAAK,EAAE,WAAW,EAAqB,MAAM,eAAe,CAAC;AACpE,OAAO,EAAwB,KAAK,eAAe,EAAE,MAAM,aAAa,CAAC;AAEzE;;;;;GAKG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,kFAAkF;IAClF,aAAa,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,eAAe,CAAC;CAClD,CAAC;AAEF;;;GAGG;AACH,M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CAAC;IAChB;;;;;;OAMG;IACH,UAAU,CAAC,OAAO,EAAE,qBAAqB,EAAE,GAAG,IAAI,CAAC;IACnD,aAAa,CACX,MAAM,EAAE,MAAM,EACd,OAAO,EAAE;QACP,GAAG,EAAE,MAAM,CAAC;QACZ,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,QAAQ,CAAC,EAAE,IAAI,CAAC;QAChB,YAAY,CAAC,EAAE,mBAAmB,CAAC;QACnC,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,WAAW,CAAC,EAAE,MAAM,CAAC;KACtB,GACA,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAC9B,iDAAiD;IACjD,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,mBAAmB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;IACzF,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9F,gEAAgE;IAChE,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAChE,KAAK,IAAI,IAAI,CAAC;CACf;AAqDD,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,sBAAsB,GAAG,eAAe,CAsatF"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { DataRpcError } from "../protocol/index.ts";
|
|
1
2
|
import type { DataClient } from "./data-client.ts";
|
|
2
3
|
export type HttpDataClientOptions = {
|
|
3
4
|
/** "" / absent ⇒ same-origin (local). Absolute relay origin ⇒ cloud. */
|
|
@@ -10,6 +11,10 @@ export type HttpDataClientOptions = {
|
|
|
10
11
|
onUnauthorized?: () => void;
|
|
11
12
|
fetchImpl?: typeof fetch;
|
|
12
13
|
};
|
|
14
|
+
export declare class DataRpcClientError extends Error {
|
|
15
|
+
readonly code: DataRpcError["code"];
|
|
16
|
+
constructor(code: DataRpcError["code"], message: string);
|
|
17
|
+
}
|
|
13
18
|
/** Derive the daemon's HTTP origin from its ws url: ws→http, wss→https. */
|
|
14
19
|
export declare function httpBaseFromWsUrl(wsUrl: string): string;
|
|
15
20
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http-data-client.d.ts","sourceRoot":"","sources":["../../src/client/http-data-client.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"http-data-client.d.ts","sourceRoot":"","sources":["../../src/client/http-data-client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAKV,YAAY,EAQb,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAmC,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAGpF,MAAM,MAAM,qBAAqB,GAAG;IAClC,wEAAwE;IACxE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,2EAA2E;IAC3E,QAAQ,CAAC,EAAE,MAAM,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IACxC,0EAA0E;IAC1E,kBAAkB,CAAC,EAAE,MAAM,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAClD,8DAA8D;IAC9D,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAC5B,SAAS,CAAC,EAAE,OAAO,KAAK,CAAC;CAC1B,CAAC;AAEF,qBAAa,kBAAmB,SAAQ,KAAK;IAEzC,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC,MAAM,CAAC;gBAA1B,IAAI,EAAE,YAAY,CAAC,MAAM,CAAC,EACnC,OAAO,EAAE,MAAM;CAKlB;AAED,2EAA2E;AAC3E,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAIvD;AA6CD;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,GAAE,qBAA0B,GAAG,UAAU,CAgXpF"}
|