@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
|
@@ -1,19 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* Moved from packages/cli/src/lib/tools/constants.ts — the CLI re-exports it.
|
|
4
|
-
*/
|
|
5
|
-
export declare const READ_ONLY_TOOLS: ReadonlySet<string>;
|
|
6
|
-
/**
|
|
7
|
-
* Tools rendered without an outer background block in the message list (CLI gap
|
|
8
|
-
* collapse + web bare card). A superset of READ_ONLY_TOOLS: FileNew remains
|
|
9
|
-
* visually backgroundless but still requires approval, so it appears here but
|
|
10
|
-
* NOT in READ_ONLY_TOOLS (which gates `isAutoApprovedTool`).
|
|
11
|
-
*/
|
|
1
|
+
import type { ToolPermissionClass } from "@nuvin/agent-core/shared";
|
|
2
|
+
/** Tools rendered without an outer background block in message lists. */
|
|
12
3
|
export declare const BACKGROUNDLESS_TOOLS: ReadonlySet<string>;
|
|
13
|
-
export
|
|
14
|
-
export
|
|
15
|
-
export declare const EDIT_TOOLS: ReadonlySet<string>;
|
|
16
|
-
export declare function isToolAutoApprovedForMode(mode: SessionApprovalMode, toolName: string, baselineAutoApproved?: (toolName: string) => boolean): boolean;
|
|
4
|
+
export type SessionApprovalMode = "readOnly" | "write" | "sudo";
|
|
5
|
+
export declare function isToolAutoApprovedForMode(mode: SessionApprovalMode, permissionClass: ToolPermissionClass): boolean;
|
|
17
6
|
/**
|
|
18
7
|
* Decision the user makes on a pending tool approval.
|
|
19
8
|
* - 'y' → approve this call
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"approvals.d.ts","sourceRoot":"","sources":["../../src/state/approvals.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"approvals.d.ts","sourceRoot":"","sources":["../../src/state/approvals.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAEpE,yEAAyE;AACzE,eAAO,MAAM,oBAAoB,EAAE,WAAW,CAAC,MAAM,CAgBnD,CAAC;AAEH,MAAM,MAAM,mBAAmB,GAAG,UAAU,GAAG,OAAO,GAAG,MAAM,CAAC;AAEhE,wBAAgB,yBAAyB,CACvC,IAAI,EAAE,mBAAmB,EACzB,eAAe,EAAE,mBAAmB,GACnC,OAAO,CAIT;AAED;;;;;;GAMG;AACH,MAAM,MAAM,gBAAgB,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;AAErD,MAAM,MAAM,kBAAkB,CAAC,CAAC,IAAI;IAClC,MAAM,EAAE,CAAC,GAAG,IAAI,CAAC;IACjB,OAAO,EAAE,CAAC,EAAE,CAAC;CACd,CAAC;AAEF,wBAAgB,wBAAwB,CAAC,CAAC,KAAK,kBAAkB,CAAC,CAAC,CAAC,CAEnE;AAED,wBAAgB,eAAe,CAAC,CAAC,EAC/B,KAAK,EAAE,kBAAkB,CAAC,CAAC,CAAC,EAC5B,QAAQ,EAAE,CAAC,GACV,kBAAkB,CAAC,CAAC,CAAC,CAKvB;AAED,wBAAgB,qBAAqB,CAAC,CAAC,EAAE,KAAK,EAAE,kBAAkB,CAAC,CAAC,CAAC,GAAG,kBAAkB,CAAC,CAAC,CAAC,CAG5F;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAC9B,KAAK,EAAE,kBAAkB,CAAC,CAAC,CAAC,EAC5B,OAAO,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,OAAO,GAC5B,kBAAkB,CAAC,CAAC,CAAC,CAMvB"}
|
package/dist/state/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/state/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/state/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC"}
|
package/dist/state/index.js
CHANGED
|
@@ -4,8 +4,6 @@ import {
|
|
|
4
4
|
} from "../chunk-UVJIG4DT.js";
|
|
5
5
|
import {
|
|
6
6
|
BACKGROUNDLESS_TOOLS,
|
|
7
|
-
EDIT_TOOLS,
|
|
8
|
-
READ_ONLY_TOOLS,
|
|
9
7
|
appendErrorMessage,
|
|
10
8
|
appendInfoMessage,
|
|
11
9
|
appendUserMessage,
|
|
@@ -15,20 +13,23 @@ import {
|
|
|
15
13
|
createApprovalQueueState,
|
|
16
14
|
createMessageState,
|
|
17
15
|
createMessageStateFromMessages,
|
|
16
|
+
createQuestionQueueState,
|
|
18
17
|
createSessionViewState,
|
|
19
18
|
dequeueActiveApproval,
|
|
20
19
|
enqueueApproval,
|
|
21
|
-
|
|
20
|
+
enqueueQuestion,
|
|
22
21
|
isToolAutoApprovedForMode,
|
|
23
22
|
reduceSessionEvent,
|
|
24
23
|
removeApproval,
|
|
24
|
+
removeQuestion,
|
|
25
|
+
scopedToolKey,
|
|
26
|
+
setToolMessageApprovalKind,
|
|
25
27
|
setToolMessageHidden,
|
|
26
|
-
setToolMessageStatus
|
|
27
|
-
|
|
28
|
+
setToolMessageStatus,
|
|
29
|
+
settleAllLiveReasoning
|
|
30
|
+
} from "../chunk-KQHHBUVY.js";
|
|
28
31
|
export {
|
|
29
32
|
BACKGROUNDLESS_TOOLS,
|
|
30
|
-
EDIT_TOOLS,
|
|
31
|
-
READ_ONLY_TOOLS,
|
|
32
33
|
appendErrorMessage,
|
|
33
34
|
appendInfoMessage,
|
|
34
35
|
appendUserMessage,
|
|
@@ -38,15 +39,20 @@ export {
|
|
|
38
39
|
createApprovalQueueState,
|
|
39
40
|
createMessageState,
|
|
40
41
|
createMessageStateFromMessages,
|
|
42
|
+
createQuestionQueueState,
|
|
41
43
|
createSessionViewState,
|
|
42
44
|
dequeueActiveApproval,
|
|
43
45
|
dirContains,
|
|
44
46
|
enqueueApproval,
|
|
45
|
-
|
|
47
|
+
enqueueQuestion,
|
|
46
48
|
isToolAutoApprovedForMode,
|
|
47
49
|
reduceSessionEvent,
|
|
48
50
|
removeApproval,
|
|
51
|
+
removeQuestion,
|
|
49
52
|
resolveGrantDir,
|
|
53
|
+
scopedToolKey,
|
|
54
|
+
setToolMessageApprovalKind,
|
|
50
55
|
setToolMessageHidden,
|
|
51
|
-
setToolMessageStatus
|
|
56
|
+
setToolMessageStatus,
|
|
57
|
+
settleAllLiveReasoning
|
|
52
58
|
};
|
package/dist/state/messages.d.ts
CHANGED
|
@@ -25,6 +25,7 @@ export type BasicTuiMessage = {
|
|
|
25
25
|
createdAt?: number;
|
|
26
26
|
};
|
|
27
27
|
export type ToolTuiMessage = {
|
|
28
|
+
approvalKind?: "auto" | "user";
|
|
28
29
|
completedAt?: number;
|
|
29
30
|
id: string;
|
|
30
31
|
/**
|
|
@@ -80,14 +81,23 @@ export type MessageState = {
|
|
|
80
81
|
reasoningMessageIds: Record<string, string>;
|
|
81
82
|
toolMessageIds: Record<string, string>;
|
|
82
83
|
};
|
|
83
|
-
|
|
84
|
+
/**
|
|
85
|
+
* Freeze every still-live reasoning message regardless of scope: flip `live`
|
|
86
|
+
* off and stamp `completedAt` (once). Called when the session goes idle or an
|
|
87
|
+
* error surfaces, so a turn that ends without a reasoning finalize (abort,
|
|
88
|
+
* provider failure) stops the "Thinking…" timer instead of counting forever.
|
|
89
|
+
* A no-op (returns the same reference) when nothing is live.
|
|
90
|
+
*/
|
|
91
|
+
export declare function settleAllLiveReasoning(state: MessageState, now: number): MessageState;
|
|
92
|
+
export declare function setToolMessageStatus(state: MessageState, toolCallId: string, status: ToolMessageStatus, parentToolCallId?: string): MessageState;
|
|
93
|
+
export declare function setToolMessageApprovalKind(state: MessageState, toolCallId: string, approvalKind: NonNullable<ToolTuiMessage["approvalKind"]>, parentToolCallId?: string): MessageState;
|
|
84
94
|
/**
|
|
85
95
|
* Toggle a tool message's display visibility. Used by the approval lifecycle:
|
|
86
96
|
* a tool awaiting a human decision is hidden (the approval modal represents it,
|
|
87
97
|
* anti-flash rule §4.5) and only materializes as a transcript row once the
|
|
88
98
|
* decision is approved. A rejected tool stays hidden — it never ran.
|
|
89
99
|
*/
|
|
90
|
-
export declare function setToolMessageHidden(state: MessageState, toolCallId: string, hidden: boolean): MessageState;
|
|
100
|
+
export declare function setToolMessageHidden(state: MessageState, toolCallId: string, hidden: boolean, parentToolCallId?: string): MessageState;
|
|
91
101
|
export declare function createMessageState(): MessageState;
|
|
92
102
|
export declare function createMessageStateFromMessages(messages: TuiMessage[]): MessageState;
|
|
93
103
|
export declare function appendUserMessage(state: MessageState, text: string, attachmentLabels?: string[], createdAt?: number): MessageState;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../src/state/messages.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,UAAU,EACV,UAAU,EAIX,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../src/state/messages.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,UAAU,EACV,UAAU,EAIX,MAA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B,oBAAoB,CAClC,KAAK,EAAE,YAAY,EACnB,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,OAAO,EACf,gBAAgB,CAAC,EAAE,MAAM,GACxB,YAAY,CAgBd;AAwDD,wBAAgB,kBAAkB,IAAI,YAAY,CAQjD;AAED,wBAAgB,8BAA8B,CAAC,QAAQ,EAAE,UAAU,EAAE,GAAG,YAAY,CAsBnF;AAED,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,YAAY,EACnB,IAAI,EAAE,MAAM,EACZ,gBAAgB,CAAC,EAAE,MAAM,EAAE,EAC3B,SAAS,CAAC,EAAE,MAAM,GACjB,YAAY,CAQd;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,GAAG,YAAY,CAMlF;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,GAAG,YAAY,CAMjF;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,GAAG,YAAY,CAMpF;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,YAAY,EACnB,KAAK,EAAE,UAAU,EACjB,gBAAgB,CAAC,EAAE,MAAM,EACzB,GAAG,GAAE,MAAmB,GACvB,YAAY,CAkLd"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { QuestionDescriptor, QuestionQueueState } from "../protocol/types.ts";
|
|
2
|
+
export declare function createQuestionQueueState(): QuestionQueueState;
|
|
3
|
+
export declare function enqueueQuestion(state: QuestionQueueState, question: QuestionDescriptor): QuestionQueueState;
|
|
4
|
+
export declare function removeQuestion(state: QuestionQueueState, questionId: string): QuestionQueueState;
|
|
5
|
+
//# sourceMappingURL=questions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"questions.d.ts","sourceRoot":"","sources":["../../src/state/questions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAEnF,wBAAgB,wBAAwB,IAAI,kBAAkB,CAE7D;AAED,wBAAgB,eAAe,CAC7B,KAAK,EAAE,kBAAkB,EACzB,QAAQ,EAAE,kBAAkB,GAC3B,kBAAkB,CAKpB;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,GAAG,kBAAkB,CAQhG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../src/state/session.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../src/state/session.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAgB1E,wBAAgB,sBAAsB,IAAI,gBAAgB,CAczD;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,gBAAgB,EAAE,KAAK,EAAE,WAAW,GAAG,gBAAgB,CA6IhG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-key.d.ts","sourceRoot":"","sources":["../../src/state/tool-key.ts"],"names":[],"mappings":"AAAA,wBAAgB,aAAa,CAAC,gBAAgB,EAAE,MAAM,GAAG,SAAS,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAE9F"}
|
|
@@ -11,6 +11,11 @@ export type TodoItem = {
|
|
|
11
11
|
status: TodoStatus;
|
|
12
12
|
priority?: "high" | "medium" | "low";
|
|
13
13
|
};
|
|
14
|
+
export type McpToolIdentity = {
|
|
15
|
+
serverName?: string;
|
|
16
|
+
toolName: string;
|
|
17
|
+
};
|
|
18
|
+
export declare function parseMcpToolIdentity(toolName: string, structured?: unknown): McpToolIdentity;
|
|
14
19
|
/**
|
|
15
20
|
* Returns the status glyph for a given tool message status.
|
|
16
21
|
* Moved from CLI parts.tsx so the glyph logic is shared across platforms.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-preview.d.ts","sourceRoot":"","sources":["../../src/state/tool-preview.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAIvE,MAAM,MAAM,WAAW,GAAG;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG,CAAC,OAAO,EAAE,cAAc,KAAK,WAAW,CAAC;AAE5E,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,aAAa,GAAG,WAAW,CAAC;AAEjE,MAAM,MAAM,QAAQ,GAAG;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,UAAU,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,KAAK,CAAC;CACtC,CAAC;
|
|
1
|
+
{"version":3,"file":"tool-preview.d.ts","sourceRoot":"","sources":["../../src/state/tool-preview.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAIvE,MAAM,MAAM,WAAW,GAAG;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG,CAAC,OAAO,EAAE,cAAc,KAAK,WAAW,CAAC;AAE5E,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,aAAa,GAAG,WAAW,CAAC;AAEjE,MAAM,MAAM,QAAQ,GAAG;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,UAAU,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,KAAK,CAAC;CACtC,CAAC;AA2BF,MAAM,MAAM,eAAe,GAAG;IAC5B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,OAAO,GAAG,eAAe,CAkC5F;AAsZD;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,iBAAiB,GAAG,MAAM,CAcpE;AAED,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,GAAG,WAAW,CAGrF;AAED,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,cAAc,GAAG,MAAM,CAIrE;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,QAAQ,EAAE,CAevD"}
|
|
@@ -16,6 +16,34 @@ function asObj(value) {
|
|
|
16
16
|
if (!value || typeof value !== "object" || Array.isArray(value)) return void 0;
|
|
17
17
|
return value;
|
|
18
18
|
}
|
|
19
|
+
function parseMcpToolIdentity(toolName, structured) {
|
|
20
|
+
const obj = asObj(structured);
|
|
21
|
+
const structuredServer = str(obj, "serverName");
|
|
22
|
+
const structuredTool = str(obj, "toolName");
|
|
23
|
+
if (structuredServer && structuredTool) {
|
|
24
|
+
return { serverName: structuredServer, toolName: structuredTool };
|
|
25
|
+
}
|
|
26
|
+
if (!toolName.startsWith("mcp_")) {
|
|
27
|
+
return { toolName };
|
|
28
|
+
}
|
|
29
|
+
const rest = toolName.slice("mcp_".length);
|
|
30
|
+
if (rest.length === 0) {
|
|
31
|
+
return { toolName };
|
|
32
|
+
}
|
|
33
|
+
const segments = rest.split("_").filter((part) => part.length > 0);
|
|
34
|
+
const [firstSegment, ...toolSegments] = segments;
|
|
35
|
+
if (!firstSegment) {
|
|
36
|
+
return { toolName };
|
|
37
|
+
}
|
|
38
|
+
if (toolSegments.length === 0) {
|
|
39
|
+
return { toolName: firstSegment };
|
|
40
|
+
}
|
|
41
|
+
const parsedTool = toolSegments.join("_");
|
|
42
|
+
return {
|
|
43
|
+
serverName: firstSegment,
|
|
44
|
+
toolName: parsedTool.length > 0 ? parsedTool : toolName
|
|
45
|
+
};
|
|
46
|
+
}
|
|
19
47
|
var Bash_fmt = (msg) => {
|
|
20
48
|
const input = asObj(msg.input);
|
|
21
49
|
const command = str(input, "command") ?? msg.summary;
|
|
@@ -248,38 +276,38 @@ var InvokeCommand_fmt = (msg) => {
|
|
|
248
276
|
else if (msg.status === "error") phrase = "Command failed";
|
|
249
277
|
return { mainArg, phrase };
|
|
250
278
|
};
|
|
251
|
-
var
|
|
279
|
+
var Memory_fmt = (msg) => {
|
|
252
280
|
const input = asObj(msg.input);
|
|
253
281
|
const structured = asObj(msg.structured);
|
|
254
|
-
const
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
else if (msg.status === "
|
|
282
|
+
const operation = str(input, "operation") ?? "update";
|
|
283
|
+
const mainArg = str(structured, "slug") ?? str(input, "slug") ?? str(input, "title");
|
|
284
|
+
const verb = operation === "create" ? "create" : operation === "remove" ? "remove" : "edit";
|
|
285
|
+
let phrase = verb === "create" ? "Created memory" : verb === "remove" ? "Removed memory" : "Edited memory";
|
|
286
|
+
if (msg.status === "pending") phrase = `Waiting to ${verb} memory`;
|
|
287
|
+
else if (msg.status === "running" || msg.status === "approved") {
|
|
288
|
+
phrase = `${verb === "create" ? "Creating" : verb === "remove" ? "Removing" : "Editing"} memory`;
|
|
289
|
+
} else if (msg.status === "rejected") phrase = `Skipped memory ${verb}`;
|
|
290
|
+
else if (msg.status === "error") phrase = `Memory ${verb} failed`;
|
|
260
291
|
return { mainArg, phrase };
|
|
261
292
|
};
|
|
262
|
-
var
|
|
293
|
+
var MemoryRead_fmt = (msg) => {
|
|
263
294
|
const input = asObj(msg.input);
|
|
264
295
|
const structured = asObj(msg.structured);
|
|
265
|
-
const
|
|
296
|
+
const slug = str(input, "slug");
|
|
297
|
+
const pattern = str(input, "pattern");
|
|
298
|
+
const mainArg = slug ?? pattern ?? "all";
|
|
266
299
|
let phrase;
|
|
267
|
-
if (msg.status === "pending") phrase = "Waiting to
|
|
268
|
-
else if (msg.status === "running" || msg.status === "approved") phrase = "
|
|
269
|
-
else if (msg.status === "rejected") phrase = "Skipped memory
|
|
270
|
-
else if (msg.status === "error") phrase = "Memory
|
|
271
|
-
else
|
|
272
|
-
|
|
273
|
-
const
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
} else if (Array.isArray(matches)) {
|
|
279
|
-
phrase = "No memories found";
|
|
280
|
-
} else {
|
|
281
|
-
phrase = "Queried memory";
|
|
282
|
-
}
|
|
300
|
+
if (msg.status === "pending") phrase = "Waiting to read memory";
|
|
301
|
+
else if (msg.status === "running" || msg.status === "approved") phrase = "Reading memory";
|
|
302
|
+
else if (msg.status === "rejected") phrase = "Skipped memory read";
|
|
303
|
+
else if (msg.status === "error") phrase = "Memory read failed";
|
|
304
|
+
else if (slug) phrase = "Read memory";
|
|
305
|
+
else if (pattern) {
|
|
306
|
+
const count = typeof structured?.matchCount === "number" ? structured.matchCount : void 0;
|
|
307
|
+
phrase = count === void 0 ? "Searched memories" : `Found ${count} memory ${count === 1 ? "match" : "matches"}`;
|
|
308
|
+
} else {
|
|
309
|
+
const count = Array.isArray(structured?.memories) ? structured.memories.length : void 0;
|
|
310
|
+
phrase = count === void 0 ? "Listed memories" : `Listed ${count} ${count === 1 ? "memory" : "memories"}`;
|
|
283
311
|
}
|
|
284
312
|
return { mainArg, phrase };
|
|
285
313
|
};
|
|
@@ -298,6 +326,29 @@ function genericStatusPhrase(status) {
|
|
|
298
326
|
return "Denied";
|
|
299
327
|
}
|
|
300
328
|
}
|
|
329
|
+
var Mcp_fmt = (msg) => {
|
|
330
|
+
const { serverName, toolName } = parseMcpToolIdentity(msg.toolName, msg.structured);
|
|
331
|
+
let phrase;
|
|
332
|
+
switch (msg.status) {
|
|
333
|
+
case "pending":
|
|
334
|
+
phrase = `Waiting to call ${toolName}`;
|
|
335
|
+
break;
|
|
336
|
+
case "approved":
|
|
337
|
+
case "running":
|
|
338
|
+
phrase = `Calling ${toolName}`;
|
|
339
|
+
break;
|
|
340
|
+
case "error":
|
|
341
|
+
phrase = `${toolName} call failed`;
|
|
342
|
+
break;
|
|
343
|
+
case "rejected":
|
|
344
|
+
phrase = `Skipped ${toolName}`;
|
|
345
|
+
break;
|
|
346
|
+
case "ok":
|
|
347
|
+
phrase = `Called ${toolName}`;
|
|
348
|
+
break;
|
|
349
|
+
}
|
|
350
|
+
return { phrase, mainArg: serverName };
|
|
351
|
+
};
|
|
301
352
|
var Unknown_fmt = (msg) => ({
|
|
302
353
|
mainArg: msg.summary || void 0,
|
|
303
354
|
phrase: genericStatusPhrase(msg.status)
|
|
@@ -317,8 +368,8 @@ var FORMATTERS = {
|
|
|
317
368
|
ViewFile: ViewFile_fmt,
|
|
318
369
|
TodoWrite: TodoWrite_fmt,
|
|
319
370
|
UpdateTopic: UpdateTopic_fmt,
|
|
320
|
-
|
|
321
|
-
|
|
371
|
+
Memory: Memory_fmt,
|
|
372
|
+
MemoryRead: MemoryRead_fmt,
|
|
322
373
|
InvokeCommand: InvokeCommand_fmt,
|
|
323
374
|
AskUserTool: Unknown_fmt
|
|
324
375
|
};
|
|
@@ -338,7 +389,7 @@ function getToolStatusGlyph(status) {
|
|
|
338
389
|
}
|
|
339
390
|
}
|
|
340
391
|
function getToolPreview(toolName, message) {
|
|
341
|
-
const formatter = FORMATTERS[toolName] ?? Unknown_fmt;
|
|
392
|
+
const formatter = FORMATTERS[toolName] ?? (toolName.startsWith("mcp_") ? Mcp_fmt : Unknown_fmt);
|
|
342
393
|
return formatter(message);
|
|
343
394
|
}
|
|
344
395
|
function formatToolPreviewLine(message) {
|
|
@@ -360,5 +411,6 @@ export {
|
|
|
360
411
|
formatToolPreviewLine,
|
|
361
412
|
getTodoItems,
|
|
362
413
|
getToolPreview,
|
|
363
|
-
getToolStatusGlyph
|
|
414
|
+
getToolStatusGlyph,
|
|
415
|
+
parseMcpToolIdentity
|
|
364
416
|
};
|
package/dist/test-utils/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuvin/session",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0-rc.10",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Headless session layer for Nuvin: state reducers, wire protocol, session controller",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"access": "public"
|
|
13
13
|
},
|
|
14
14
|
"engines": {
|
|
15
|
-
"node": ">=
|
|
15
|
+
"node": ">=22"
|
|
16
16
|
},
|
|
17
17
|
"exports": {
|
|
18
18
|
"./state": {
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
52
|
"ws": "^8.20.0",
|
|
53
|
-
"@nuvin/agent-core": "^0.2.0-rc.
|
|
53
|
+
"@nuvin/agent-core": "^0.2.0-rc.7"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@types/node": "^22.0.0",
|
package/dist/chunk-7HGJO7ZX.js
DELETED