@camerontaylor/paseo-protocol 0.8.0-fork.1
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/README.md +12 -0
- package/dist/agent-attention-notification.d.ts +43 -0
- package/dist/agent-attention-notification.js +141 -0
- package/dist/agent-deep-link.d.ts +8 -0
- package/dist/agent-deep-link.js +49 -0
- package/dist/agent-labels.d.ts +10 -0
- package/dist/agent-labels.js +21 -0
- package/dist/agent-lifecycle.d.ts +3 -0
- package/dist/agent-lifecycle.js +8 -0
- package/dist/agent-state-bucket.d.ts +14 -0
- package/dist/agent-state-bucket.js +41 -0
- package/dist/agent-title-limits.d.ts +2 -0
- package/dist/agent-title-limits.js +2 -0
- package/dist/agent-types.d.ts +478 -0
- package/dist/agent-types.js +22 -0
- package/dist/binary-frames/demux.d.ts +11 -0
- package/dist/binary-frames/demux.js +23 -0
- package/dist/binary-frames/file-transfer.d.ts +51 -0
- package/dist/binary-frames/file-transfer.js +108 -0
- package/dist/binary-frames/index.d.ts +4 -0
- package/dist/binary-frames/index.js +4 -0
- package/dist/binary-frames/terminal.d.ts +35 -0
- package/dist/binary-frames/terminal.js +100 -0
- package/dist/branch-slug.d.ts +14 -0
- package/dist/branch-slug.js +49 -0
- package/dist/browser-automation/capabilities.d.ts +7 -0
- package/dist/browser-automation/capabilities.js +31 -0
- package/dist/browser-automation/rpc-schemas.d.ts +1112 -0
- package/dist/browser-automation/rpc-schemas.js +462 -0
- package/dist/chat/rpc-schemas.d.ts +158 -0
- package/dist/chat/rpc-schemas.js +104 -0
- package/dist/chat/types.d.ts +30 -0
- package/dist/chat/types.js +23 -0
- package/dist/check-traits.d.ts +11 -0
- package/dist/check-traits.js +10 -0
- package/dist/client-capabilities.d.ts +20 -0
- package/dist/client-capabilities.js +47 -0
- package/dist/connection-offer.d.ts +36 -0
- package/dist/connection-offer.js +53 -0
- package/dist/daemon-endpoints.d.ts +47 -0
- package/dist/daemon-endpoints.js +201 -0
- package/dist/error-utils.d.ts +11 -0
- package/dist/error-utils.js +27 -0
- package/dist/forge-manifest.d.ts +66 -0
- package/dist/forge-manifest.js +92 -0
- package/dist/generated/validation/ws-outbound.aot.d.ts +2 -0
- package/dist/generated/validation/ws-outbound.aot.js +98097 -0
- package/dist/git-remote.d.ts +33 -0
- package/dist/git-remote.js +94 -0
- package/dist/gitea-status.d.ts +10 -0
- package/dist/gitea-status.js +23 -0
- package/dist/gitlab-pipeline.d.ts +10 -0
- package/dist/gitlab-pipeline.js +17 -0
- package/dist/host-connection-schema.d.ts +11 -0
- package/dist/host-connection-schema.js +9 -0
- package/dist/literal-union.d.ts +2 -0
- package/dist/literal-union.js +2 -0
- package/dist/loop/rpc-schemas.d.ts +636 -0
- package/dist/loop/rpc-schemas.js +164 -0
- package/dist/messages.d.ts +60742 -0
- package/dist/messages.js +6152 -0
- package/dist/paseo-config-schema.d.ts +138 -0
- package/dist/paseo-config-schema.js +98 -0
- package/dist/paseo-tool-call-detail.d.ts +15 -0
- package/dist/paseo-tool-call-detail.js +305 -0
- package/dist/path-utils.d.ts +2 -0
- package/dist/path-utils.js +16 -0
- package/dist/plugin-requirements.d.ts +11 -0
- package/dist/plugin-requirements.js +26 -0
- package/dist/plugin-source-reference.d.ts +7 -0
- package/dist/plugin-source-reference.js +41 -0
- package/dist/provider-config.d.ts +139 -0
- package/dist/provider-config.js +115 -0
- package/dist/provider-icon-names.d.ts +5 -0
- package/dist/provider-icon-names.js +54 -0
- package/dist/provider-manifest.d.ts +37 -0
- package/dist/provider-manifest.js +261 -0
- package/dist/provider-snapshot-codec.d.ts +18 -0
- package/dist/provider-snapshot-codec.js +71 -0
- package/dist/schedule/cadence.d.ts +6 -0
- package/dist/schedule/cadence.js +28 -0
- package/dist/schedule/cron-expression.d.ts +13 -0
- package/dist/schedule/cron-expression.js +97 -0
- package/dist/schedule/rpc-schemas.d.ts +568 -0
- package/dist/schedule/rpc-schemas.js +155 -0
- package/dist/schedule/types.d.ts +201 -0
- package/dist/schedule/types.js +68 -0
- package/dist/search/text-match.d.ts +71 -0
- package/dist/search/text-match.js +291 -0
- package/dist/ssh-transport.d.ts +11 -0
- package/dist/ssh-transport.js +72 -0
- package/dist/terminal-activity.d.ts +21 -0
- package/dist/terminal-activity.js +25 -0
- package/dist/terminal-input-mode.d.ts +30 -0
- package/dist/terminal-input-mode.js +180 -0
- package/dist/terminal-key-input.d.ts +13 -0
- package/dist/terminal-key-input.js +210 -0
- package/dist/terminal-profiles.d.ts +41 -0
- package/dist/terminal-profiles.js +270 -0
- package/dist/terminal-snapshot.d.ts +3 -0
- package/dist/terminal-snapshot.js +184 -0
- package/dist/terminal-stream-protocol.d.ts +2 -0
- package/dist/terminal-stream-protocol.js +2 -0
- package/dist/terminal-subscription-key.d.ts +2 -0
- package/dist/terminal-subscription-key.js +9 -0
- package/dist/timeline-identity.d.ts +3 -0
- package/dist/timeline-identity.js +8 -0
- package/dist/tool-call-display.d.ts +11 -0
- package/dist/tool-call-display.js +136 -0
- package/dist/tool-name-normalization.d.ts +9 -0
- package/dist/tool-name-normalization.js +82 -0
- package/dist/validation/ws-outbound-schema-metadata.d.ts +11418 -0
- package/dist/validation/ws-outbound-schema-metadata.js +3 -0
- package/dist/validation/ws-outbound.d.ts +12 -0
- package/dist/validation/ws-outbound.js +8 -0
- package/dist/workspace-labels.d.ts +9 -0
- package/dist/workspace-labels.js +19 -0
- package/package.json +44 -0
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
const DEFAULT_STYLE = {
|
|
2
|
+
fg: undefined,
|
|
3
|
+
bg: undefined,
|
|
4
|
+
fgMode: undefined,
|
|
5
|
+
bgMode: undefined,
|
|
6
|
+
bold: false,
|
|
7
|
+
italic: false,
|
|
8
|
+
underline: false,
|
|
9
|
+
dim: false,
|
|
10
|
+
inverse: false,
|
|
11
|
+
strikethrough: false,
|
|
12
|
+
};
|
|
13
|
+
export function renderTerminalSnapshotToAnsi(state) {
|
|
14
|
+
const rows = [...state.scrollback, ...state.grid];
|
|
15
|
+
const wrapFlags = [...(state.scrollbackWrapped ?? []), ...(state.gridWrapped ?? [])];
|
|
16
|
+
// Soft-wrapped lines can only be re-wrapped on resize when we know which rows
|
|
17
|
+
// were continuations. With that per-row flag we replay each logical line as one
|
|
18
|
+
// unbroken run (autowrap on) so xterm marks the continuations wrapped and reflows
|
|
19
|
+
// them. Without it (old daemon) we keep the verbatim per-row replay: autowrap off
|
|
20
|
+
// plus a hard newline per row.
|
|
21
|
+
const hasWrapInfo = wrapFlags.length === rows.length;
|
|
22
|
+
const lines = hasWrapInfo ? [] : ["\u001b[?7l"];
|
|
23
|
+
for (let rowIndex = 0; rowIndex < rows.length; rowIndex += 1) {
|
|
24
|
+
const row = rows[rowIndex] ?? [];
|
|
25
|
+
const continuesToNextRow = hasWrapInfo && wrapFlags[rowIndex] === true;
|
|
26
|
+
// A continuation row must fill the full width so the next row first cell
|
|
27
|
+
// triggers xterm auto-wrap, which is what marks the row wrapped/reflowable.
|
|
28
|
+
lines.push(renderTerminalRow(row, continuesToNextRow ? state.cols : undefined));
|
|
29
|
+
if (rowIndex < rows.length - 1 && !continuesToNextRow) {
|
|
30
|
+
lines.push("\r\n");
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
lines.push("\u001b[0m");
|
|
34
|
+
const cursorPresentationAnsi = renderCursorPresentationToAnsi(state.cursor);
|
|
35
|
+
if (cursorPresentationAnsi) {
|
|
36
|
+
lines.push(cursorPresentationAnsi);
|
|
37
|
+
}
|
|
38
|
+
lines.push(`\u001b[${state.cursor.row + 1};${state.cursor.col + 1}H`);
|
|
39
|
+
lines.push(state.cursor.hidden ? "\u001b[?25l" : "\u001b[?25h");
|
|
40
|
+
if (!hasWrapInfo) {
|
|
41
|
+
lines.push("\u001b[?7h");
|
|
42
|
+
}
|
|
43
|
+
return lines.join("");
|
|
44
|
+
}
|
|
45
|
+
function renderCursorPresentationToAnsi(cursor) {
|
|
46
|
+
if (!cursor.style) {
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
const cursorStyleCode = (() => {
|
|
50
|
+
if (cursor.style === "block") {
|
|
51
|
+
return cursor.blink === false ? 2 : 1;
|
|
52
|
+
}
|
|
53
|
+
if (cursor.style === "underline") {
|
|
54
|
+
return cursor.blink === false ? 4 : 3;
|
|
55
|
+
}
|
|
56
|
+
return cursor.blink === false ? 6 : 5;
|
|
57
|
+
})();
|
|
58
|
+
return `\u001b[${cursorStyleCode} q`;
|
|
59
|
+
}
|
|
60
|
+
function renderTerminalRow(row, padToCols) {
|
|
61
|
+
const output = [];
|
|
62
|
+
const contentLength = getTerminalRowLength(row);
|
|
63
|
+
const length = padToCols !== undefined ? Math.max(contentLength, padToCols) : contentLength;
|
|
64
|
+
let previousStyle = DEFAULT_STYLE;
|
|
65
|
+
for (let index = 0; index < length; index += 1) {
|
|
66
|
+
const cell = row[index] ?? { char: " " };
|
|
67
|
+
// An empty char marks a wide-char continuation cell. The glyph in the
|
|
68
|
+
// previous cell already advances the cursor two columns, so emitting
|
|
69
|
+
// anything here would shift the rest of the row one column right.
|
|
70
|
+
if (cell.char === "") {
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
const nextStyle = getTerminalStyle(cell);
|
|
74
|
+
if (!terminalStylesEqual(previousStyle, nextStyle)) {
|
|
75
|
+
output.push(styleToAnsi(nextStyle));
|
|
76
|
+
previousStyle = nextStyle;
|
|
77
|
+
}
|
|
78
|
+
output.push(cell.char || " ");
|
|
79
|
+
}
|
|
80
|
+
if (!terminalStylesEqual(previousStyle, DEFAULT_STYLE)) {
|
|
81
|
+
output.push("\u001b[0m");
|
|
82
|
+
}
|
|
83
|
+
return output.join("");
|
|
84
|
+
}
|
|
85
|
+
function getTerminalRowLength(row) {
|
|
86
|
+
for (let index = row.length - 1; index >= 0; index -= 1) {
|
|
87
|
+
const cell = row[index];
|
|
88
|
+
if (!cell) {
|
|
89
|
+
continue;
|
|
90
|
+
}
|
|
91
|
+
if (cell.char !== " ") {
|
|
92
|
+
return index + 1;
|
|
93
|
+
}
|
|
94
|
+
if (cell.fg !== undefined ||
|
|
95
|
+
cell.bg !== undefined ||
|
|
96
|
+
cell.fgMode !== undefined ||
|
|
97
|
+
cell.bgMode !== undefined ||
|
|
98
|
+
cell.bold ||
|
|
99
|
+
cell.italic ||
|
|
100
|
+
cell.underline ||
|
|
101
|
+
cell.dim ||
|
|
102
|
+
cell.inverse ||
|
|
103
|
+
cell.strikethrough) {
|
|
104
|
+
return index + 1;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
return 0;
|
|
108
|
+
}
|
|
109
|
+
function getTerminalStyle(cell) {
|
|
110
|
+
return {
|
|
111
|
+
fg: cell.fg,
|
|
112
|
+
bg: cell.bg,
|
|
113
|
+
fgMode: cell.fgMode,
|
|
114
|
+
bgMode: cell.bgMode,
|
|
115
|
+
bold: Boolean(cell.bold),
|
|
116
|
+
italic: Boolean(cell.italic),
|
|
117
|
+
underline: Boolean(cell.underline),
|
|
118
|
+
dim: Boolean(cell.dim),
|
|
119
|
+
inverse: Boolean(cell.inverse),
|
|
120
|
+
strikethrough: Boolean(cell.strikethrough),
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
function terminalStylesEqual(left, right) {
|
|
124
|
+
return (left.fg === right.fg &&
|
|
125
|
+
left.bg === right.bg &&
|
|
126
|
+
left.fgMode === right.fgMode &&
|
|
127
|
+
left.bgMode === right.bgMode &&
|
|
128
|
+
left.bold === right.bold &&
|
|
129
|
+
left.italic === right.italic &&
|
|
130
|
+
left.underline === right.underline &&
|
|
131
|
+
left.dim === right.dim &&
|
|
132
|
+
left.inverse === right.inverse &&
|
|
133
|
+
left.strikethrough === right.strikethrough);
|
|
134
|
+
}
|
|
135
|
+
function styleToAnsi(style) {
|
|
136
|
+
const codes = ["0"];
|
|
137
|
+
if (style.bold) {
|
|
138
|
+
codes.push("1");
|
|
139
|
+
}
|
|
140
|
+
if (style.dim) {
|
|
141
|
+
codes.push("2");
|
|
142
|
+
}
|
|
143
|
+
if (style.italic) {
|
|
144
|
+
codes.push("3");
|
|
145
|
+
}
|
|
146
|
+
if (style.underline) {
|
|
147
|
+
codes.push("4");
|
|
148
|
+
}
|
|
149
|
+
if (style.inverse) {
|
|
150
|
+
codes.push("7");
|
|
151
|
+
}
|
|
152
|
+
if (style.strikethrough) {
|
|
153
|
+
codes.push("9");
|
|
154
|
+
}
|
|
155
|
+
if (style.fg !== undefined && style.fgMode !== undefined) {
|
|
156
|
+
codes.push(...colorToSgr(style.fgMode, style.fg, false));
|
|
157
|
+
}
|
|
158
|
+
if (style.bg !== undefined && style.bgMode !== undefined) {
|
|
159
|
+
codes.push(...colorToSgr(style.bgMode, style.bg, true));
|
|
160
|
+
}
|
|
161
|
+
return `\u001b[${codes.join(";")}m`;
|
|
162
|
+
}
|
|
163
|
+
function colorToSgr(mode, value, background) {
|
|
164
|
+
if (mode === 1) {
|
|
165
|
+
if (value >= 8) {
|
|
166
|
+
return [String((background ? 100 : 90) + (value - 8))];
|
|
167
|
+
}
|
|
168
|
+
return [String((background ? 40 : 30) + value)];
|
|
169
|
+
}
|
|
170
|
+
if (mode === 2) {
|
|
171
|
+
return [background ? "48" : "38", "5", String(value)];
|
|
172
|
+
}
|
|
173
|
+
if (mode === 3) {
|
|
174
|
+
return [
|
|
175
|
+
background ? "48" : "38",
|
|
176
|
+
"2",
|
|
177
|
+
String((value >> 16) & 0xff),
|
|
178
|
+
String((value >> 8) & 0xff),
|
|
179
|
+
String(value & 0xff),
|
|
180
|
+
];
|
|
181
|
+
}
|
|
182
|
+
return [];
|
|
183
|
+
}
|
|
184
|
+
//# sourceMappingURL=terminal-snapshot.js.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// A terminal directory subscription is scoped to a (cwd, workspaceId) pair, not
|
|
2
|
+
// cwd alone: under Model B two workspaces can share a cwd, and each must track
|
|
3
|
+
// and tear down its own live subscription without disturbing the other. An
|
|
4
|
+
// absent workspaceId (old clients) keys to the cwd on its own. The `::`
|
|
5
|
+
// separator cannot collide with a workspace id, which is always `wks_<hex>`.
|
|
6
|
+
export function terminalSubscriptionKey(cwd, workspaceId) {
|
|
7
|
+
return workspaceId === undefined ? cwd : `${workspaceId}::${cwd}`;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=terminal-subscription-key.js.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ToolCallTimelineItem } from "./agent-types.js";
|
|
2
|
+
export type ToolCallDisplayInput = Pick<ToolCallTimelineItem, "name" | "status" | "error" | "metadata" | "detail"> & {
|
|
3
|
+
cwd?: string;
|
|
4
|
+
};
|
|
5
|
+
export interface ToolCallDisplayModel {
|
|
6
|
+
displayName: string;
|
|
7
|
+
summary?: string;
|
|
8
|
+
errorText?: string;
|
|
9
|
+
}
|
|
10
|
+
export declare function buildToolCallDisplayModel(input: ToolCallDisplayInput): ToolCallDisplayModel;
|
|
11
|
+
//# sourceMappingURL=tool-call-display.d.ts.map
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { getPaseoToolLeafName, isPaseoToolName } from "./tool-name-normalization.js";
|
|
2
|
+
import { stripCwdPrefix } from "./path-utils.js";
|
|
3
|
+
function isRecord(value) {
|
|
4
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
5
|
+
}
|
|
6
|
+
function readString(value) {
|
|
7
|
+
return typeof value === "string" && value.length > 0 ? value : undefined;
|
|
8
|
+
}
|
|
9
|
+
function humanizeToolName(name) {
|
|
10
|
+
const trimmed = name.trim();
|
|
11
|
+
if (!trimmed) {
|
|
12
|
+
return name;
|
|
13
|
+
}
|
|
14
|
+
if (isPaseoToolName(trimmed)) {
|
|
15
|
+
const leaf = getPaseoToolLeafName(trimmed);
|
|
16
|
+
if (leaf) {
|
|
17
|
+
return humanizeToolName(leaf);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
if (/[:./]/.test(trimmed) || trimmed.includes("__")) {
|
|
21
|
+
return trimmed;
|
|
22
|
+
}
|
|
23
|
+
return trimmed
|
|
24
|
+
.replace(/[._-]+/g, " ")
|
|
25
|
+
.split(" ")
|
|
26
|
+
.filter((segment) => segment.length > 0)
|
|
27
|
+
.join(" ")
|
|
28
|
+
.toLowerCase()
|
|
29
|
+
.replace(/^./, (character) => character.toUpperCase());
|
|
30
|
+
}
|
|
31
|
+
function formatErrorText(error) {
|
|
32
|
+
if (error === null || error === undefined) {
|
|
33
|
+
return undefined;
|
|
34
|
+
}
|
|
35
|
+
if (typeof error === "string") {
|
|
36
|
+
return error;
|
|
37
|
+
}
|
|
38
|
+
if (isRecord(error) && typeof error.content === "string") {
|
|
39
|
+
return error.content;
|
|
40
|
+
}
|
|
41
|
+
try {
|
|
42
|
+
return JSON.stringify(error, null, 2);
|
|
43
|
+
}
|
|
44
|
+
catch {
|
|
45
|
+
return String(error);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
function buildFilePathDisplay(displayName, filePath, cwd) {
|
|
49
|
+
return {
|
|
50
|
+
displayName,
|
|
51
|
+
summary: stripCwdPrefix(filePath, cwd),
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
function buildCanonicalDetailDisplay(input) {
|
|
55
|
+
switch (input.detail.type) {
|
|
56
|
+
case "shell":
|
|
57
|
+
return {
|
|
58
|
+
displayName: "Shell",
|
|
59
|
+
summary: input.detail.command,
|
|
60
|
+
};
|
|
61
|
+
case "read":
|
|
62
|
+
return buildFilePathDisplay("Read", input.detail.filePath, input.cwd);
|
|
63
|
+
case "edit":
|
|
64
|
+
return buildFilePathDisplay("Edit", input.detail.filePath, input.cwd);
|
|
65
|
+
case "write":
|
|
66
|
+
return buildFilePathDisplay("Write", input.detail.filePath, input.cwd);
|
|
67
|
+
case "search":
|
|
68
|
+
return {
|
|
69
|
+
displayName: "Search",
|
|
70
|
+
summary: input.detail.query,
|
|
71
|
+
};
|
|
72
|
+
case "fetch":
|
|
73
|
+
return {
|
|
74
|
+
displayName: "Fetch",
|
|
75
|
+
summary: input.detail.url,
|
|
76
|
+
};
|
|
77
|
+
case "worktree_setup":
|
|
78
|
+
return {
|
|
79
|
+
displayName: "Worktree setup",
|
|
80
|
+
summary: input.detail.branchName,
|
|
81
|
+
};
|
|
82
|
+
case "sub_agent":
|
|
83
|
+
return {
|
|
84
|
+
displayName: readString(input.detail.subAgentType) ?? "Task",
|
|
85
|
+
summary: readString(input.detail.description),
|
|
86
|
+
};
|
|
87
|
+
case "plain_text":
|
|
88
|
+
return {
|
|
89
|
+
summary: input.detail.label,
|
|
90
|
+
};
|
|
91
|
+
case "plan":
|
|
92
|
+
return {
|
|
93
|
+
displayName: "Plan",
|
|
94
|
+
};
|
|
95
|
+
case "unknown":
|
|
96
|
+
return {};
|
|
97
|
+
default:
|
|
98
|
+
throw new Error("unreachable");
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
function buildUnknownDetailOverride(input) {
|
|
102
|
+
const lowerName = input.name.trim().toLowerCase();
|
|
103
|
+
if (input.detail.type === "unknown" && lowerName === "task") {
|
|
104
|
+
return {
|
|
105
|
+
displayName: "Task",
|
|
106
|
+
summary: isRecord(input.metadata) ? readString(input.metadata.subAgentActivity) : undefined,
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
if (input.detail.type === "unknown" && lowerName === "thinking") {
|
|
110
|
+
return {
|
|
111
|
+
displayName: "Thinking",
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
if (lowerName === "terminal") {
|
|
115
|
+
return {
|
|
116
|
+
displayName: "Terminal",
|
|
117
|
+
summary: input.detail.type === "plain_text" ? readString(input.detail.label) : undefined,
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
return {};
|
|
121
|
+
}
|
|
122
|
+
export function buildToolCallDisplayModel(input) {
|
|
123
|
+
const canonicalDisplay = buildCanonicalDetailDisplay(input);
|
|
124
|
+
const unknownDetailOverride = buildUnknownDetailOverride(input);
|
|
125
|
+
const displayName = unknownDetailOverride.displayName ??
|
|
126
|
+
canonicalDisplay.displayName ??
|
|
127
|
+
humanizeToolName(input.name);
|
|
128
|
+
const summary = unknownDetailOverride.summary ?? canonicalDisplay.summary;
|
|
129
|
+
const errorText = input.status === "failed" ? formatErrorText(input.error) : undefined;
|
|
130
|
+
return {
|
|
131
|
+
displayName,
|
|
132
|
+
...(summary ? { summary } : {}),
|
|
133
|
+
...(errorText ? { errorText } : {}),
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
//# sourceMappingURL=tool-call-display.js.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare function normalizeToolName(name: string): string;
|
|
2
|
+
export declare function tokenizeToolName(name: string): string[];
|
|
3
|
+
export declare function getToolLeafName(name: string): string | null;
|
|
4
|
+
export declare function isSpeakToolName(name: string): boolean;
|
|
5
|
+
export declare function isLikelyNamespacedToolName(name: string): boolean;
|
|
6
|
+
export declare function isPaseoToolName(name: string): boolean;
|
|
7
|
+
export declare function getPaseoToolLeafName(name: string): string | null;
|
|
8
|
+
export declare function isLikelyExternalToolName(name: string): boolean;
|
|
9
|
+
//# sourceMappingURL=tool-name-normalization.d.ts.map
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
const TOOL_TOKEN_REGEX = /[a-z0-9]+/g;
|
|
2
|
+
const STANDARD_NAMESPACE_SEPARATOR_REGEX = /[.:/]/;
|
|
3
|
+
export function normalizeToolName(name) {
|
|
4
|
+
return name.trim().toLowerCase();
|
|
5
|
+
}
|
|
6
|
+
export function tokenizeToolName(name) {
|
|
7
|
+
const normalized = normalizeToolName(name);
|
|
8
|
+
return normalized.match(TOOL_TOKEN_REGEX) ?? [];
|
|
9
|
+
}
|
|
10
|
+
export function getToolLeafName(name) {
|
|
11
|
+
const tokens = tokenizeToolName(name);
|
|
12
|
+
return tokens.length > 0 ? tokens[tokens.length - 1] : null;
|
|
13
|
+
}
|
|
14
|
+
export function isSpeakToolName(name) {
|
|
15
|
+
return getToolLeafName(name) === "speak";
|
|
16
|
+
}
|
|
17
|
+
export function isLikelyNamespacedToolName(name) {
|
|
18
|
+
const normalized = normalizeToolName(name);
|
|
19
|
+
if (STANDARD_NAMESPACE_SEPARATOR_REGEX.test(normalized)) {
|
|
20
|
+
return true;
|
|
21
|
+
}
|
|
22
|
+
if (!normalized.includes("__")) {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
// Keep `__` handling strict to avoid false positives on arbitrary custom names.
|
|
26
|
+
const segments = normalized.split("__").filter((segment) => segment.length > 0);
|
|
27
|
+
if (segments.length >= 3) {
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
30
|
+
if (segments.length === 2 && segments[1].includes("_")) {
|
|
31
|
+
return true;
|
|
32
|
+
}
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
export function isPaseoToolName(name) {
|
|
36
|
+
const normalized = normalizeToolName(name);
|
|
37
|
+
if (isSpeakToolName(normalized)) {
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
if (normalized.includes("__")) {
|
|
41
|
+
const segments = normalized.split("__").filter((s) => s.length > 0);
|
|
42
|
+
return (segments.length >= 3 &&
|
|
43
|
+
segments[0] === "mcp" &&
|
|
44
|
+
(segments[1] === "paseo" || segments[1].startsWith("paseo_")));
|
|
45
|
+
}
|
|
46
|
+
if (normalized.includes(".")) {
|
|
47
|
+
const firstSegment = normalized.split(".")[0];
|
|
48
|
+
return firstSegment === "paseo" || firstSegment.startsWith("paseo_");
|
|
49
|
+
}
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
export function getPaseoToolLeafName(name) {
|
|
53
|
+
const normalized = normalizeToolName(name);
|
|
54
|
+
if (normalized.includes("__")) {
|
|
55
|
+
const segments = normalized.split("__").filter((s) => s.length > 0);
|
|
56
|
+
if (segments.length >= 3 &&
|
|
57
|
+
segments[0] === "mcp" &&
|
|
58
|
+
(segments[1] === "paseo" || segments[1].startsWith("paseo_"))) {
|
|
59
|
+
return segments.slice(2).join("__");
|
|
60
|
+
}
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
if (normalized.includes(".")) {
|
|
64
|
+
const firstSegment = normalized.split(".")[0];
|
|
65
|
+
if (firstSegment === "paseo" || firstSegment.startsWith("paseo_")) {
|
|
66
|
+
return normalized.split(".").slice(1).join(".");
|
|
67
|
+
}
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
72
|
+
export function isLikelyExternalToolName(name) {
|
|
73
|
+
const normalized = normalizeToolName(name);
|
|
74
|
+
if (!normalized) {
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
if (isSpeakToolName(normalized)) {
|
|
78
|
+
return true;
|
|
79
|
+
}
|
|
80
|
+
return isLikelyNamespacedToolName(normalized);
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=tool-name-normalization.js.map
|