@camerontaylor/paseo-protocol 0.11.2-fork.2 → 0.12.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.
Files changed (34) hide show
  1. package/dist/agent-message.d.ts +18 -0
  2. package/dist/agent-message.js +11 -0
  3. package/dist/agent-types.d.ts +2 -0
  4. package/dist/browser-automation/rpc-schemas.d.ts +3 -3
  5. package/dist/generated/validation/ws-outbound-schema-metadata.d.ts +16984 -0
  6. package/dist/generated/validation/ws-outbound-schema-metadata.js +246 -0
  7. package/dist/generated/validation/ws-outbound.aot.d.ts +487 -1
  8. package/dist/generated/validation/ws-outbound.aot.js +121459 -108058
  9. package/dist/messages.d.ts +971 -24
  10. package/dist/messages.js +59 -8
  11. package/dist/paseo-tool-call-detail.d.ts +1 -14
  12. package/dist/paseo-tool-call-detail.js +2 -304
  13. package/dist/paseo-tool-presentation/agent-message.d.ts +10 -0
  14. package/dist/paseo-tool-presentation/agent-message.js +22 -0
  15. package/dist/paseo-tool-presentation/catalog.d.ts +309 -0
  16. package/dist/paseo-tool-presentation/catalog.js +315 -0
  17. package/dist/paseo-tool-presentation/detail-sections.d.ts +15 -0
  18. package/dist/paseo-tool-presentation/detail-sections.js +161 -0
  19. package/dist/paseo-tool-presentation/index.d.ts +22 -0
  20. package/dist/paseo-tool-presentation/index.js +62 -0
  21. package/dist/paseo-tool-presentation/summary-text.d.ts +7 -0
  22. package/dist/paseo-tool-presentation/summary-text.js +22 -0
  23. package/dist/provider-icon-names.js +4 -0
  24. package/dist/tool-call-display.d.ts +3 -1
  25. package/dist/tool-call-display.js +16 -8
  26. package/dist/validation/ws-outbound-envelope.d.ts +16258 -0
  27. package/dist/validation/ws-outbound-envelope.js +17 -0
  28. package/dist/validation/ws-outbound.d.ts +3 -3
  29. package/dist/validation/ws-outbound.js +34 -4
  30. package/dist/websocket-message-limit.d.ts +5 -0
  31. package/dist/websocket-message-limit.js +5 -0
  32. package/package.json +1 -1
  33. package/dist/validation/ws-outbound-schema-metadata.d.ts +0 -16062
  34. package/dist/validation/ws-outbound-schema-metadata.js +0 -3
@@ -0,0 +1,161 @@
1
+ import { getPaseoToolLeafName } from "../tool-name-normalization.js";
2
+ import { getPaseoToolEntry } from "./catalog.js";
3
+ const FIELD_LABELS = {
4
+ agentId: "Agent",
5
+ archivedAgentIds: "Archived agents",
6
+ baseBranch: "Base branch",
7
+ branchName: "New branch",
8
+ browserId: "Browser tab",
9
+ clearExpires: "Clear expiry",
10
+ currentModeId: "Current mode",
11
+ cwd: "Working directory",
12
+ deltaX: "Horizontal delta",
13
+ deltaY: "Vertical delta",
14
+ doubleClick: "Double click",
15
+ expiresIn: "Expires in",
16
+ expiresAt: "Expires",
17
+ filePaths: "Files",
18
+ fullPage: "Full page",
19
+ initialPrompt: "Prompt",
20
+ id: "ID",
21
+ lastMessage: "Last message",
22
+ maxEntries: "Maximum entries",
23
+ maxRuns: "Maximum runs",
24
+ modeId: "Mode",
25
+ newMode: "New mode",
26
+ nextRunAt: "Next run",
27
+ notifyOnFinish: "Notify on finish",
28
+ internal: "Internal",
29
+ prNumber: "Change request",
30
+ projectId: "Project",
31
+ removedDirectory: "Removed directory",
32
+ requestId: "Request",
33
+ scriptName: "Script",
34
+ sessionMode: "Session mode",
35
+ sinceHours: "Since (hours)",
36
+ sourceRef: "Source",
37
+ targetRef: "Target",
38
+ terminalId: "Terminal",
39
+ thinkingOptionId: "Thinking",
40
+ timeoutMs: "Timeout (ms)",
41
+ updateCount: "Updates",
42
+ workspaceId: "Workspace",
43
+ worktreeSlug: "Worktree",
44
+ };
45
+ function isRecord(value) {
46
+ return typeof value === "object" && value !== null && !Array.isArray(value);
47
+ }
48
+ function humanizeKey(key) {
49
+ const known = FIELD_LABELS[key];
50
+ if (known)
51
+ return known;
52
+ const words = key
53
+ .replace(/([a-z0-9])([A-Z])/g, "$1 $2")
54
+ .replace(/[._-]+/g, " ")
55
+ .split(" ")
56
+ .filter(Boolean);
57
+ const sentence = words.join(" ").toLowerCase();
58
+ return `${sentence[0]?.toUpperCase() ?? ""}${sentence.slice(1)}`;
59
+ }
60
+ function formatValue(value, depth = 0) {
61
+ if (value === null)
62
+ return "None";
63
+ if (value === undefined)
64
+ return "";
65
+ if (typeof value === "boolean")
66
+ return value ? "Yes" : "No";
67
+ if (typeof value === "string" || typeof value === "number" || typeof value === "bigint") {
68
+ return String(value);
69
+ }
70
+ if (Array.isArray(value)) {
71
+ if (value.length === 0)
72
+ return "None";
73
+ return value.map((item) => `• ${indentMultiline(formatValue(item, depth + 1), 2)}`).join("\n");
74
+ }
75
+ if (isRecord(value)) {
76
+ const entries = Object.entries(value).filter(([, child]) => child !== undefined);
77
+ if (entries.length === 0)
78
+ return "None";
79
+ return entries
80
+ .map(([key, child]) => {
81
+ const formatted = formatValue(child, depth + 1);
82
+ return `${humanizeKey(key)}: ${indentMultiline(formatted, 2)}`;
83
+ })
84
+ .join("\n");
85
+ }
86
+ return String(value);
87
+ }
88
+ function indentMultiline(value, spaces) {
89
+ const indentation = " ".repeat(spaces);
90
+ return value.replace(/\n/g, `\n${indentation}`);
91
+ }
92
+ function orderedEntries(value, order = [], omittedKey, includedKeys) {
93
+ const included = includedKeys ? new Set(includedKeys) : null;
94
+ const keys = Object.keys(value).filter((key) => key !== omittedKey && value[key] !== undefined && (!included || included.has(key)));
95
+ const rank = new Map(order.map((key, index) => [key, index]));
96
+ keys.sort((left, right) => {
97
+ const leftRank = rank.get(left) ?? Number.MAX_SAFE_INTEGER;
98
+ const rightRank = rank.get(right) ?? Number.MAX_SAFE_INTEGER;
99
+ return leftRank - rightRank || left.localeCompare(right);
100
+ });
101
+ return keys.map((key) => [key, value[key]]);
102
+ }
103
+ function fieldsFromValue(value, order, omittedKey, includedKeys) {
104
+ if (value === null || value === undefined)
105
+ return [];
106
+ if (!isRecord(value)) {
107
+ const formatted = formatValue(value);
108
+ return formatted ? [{ label: "Value", value: formatted }] : [];
109
+ }
110
+ return orderedEntries(value, order, omittedKey, includedKeys).map(([key, child]) => ({
111
+ label: humanizeKey(key),
112
+ value: formatValue(child),
113
+ }));
114
+ }
115
+ function parseJsonText(value) {
116
+ if (typeof value !== "string")
117
+ return undefined;
118
+ try {
119
+ return JSON.parse(value);
120
+ }
121
+ catch {
122
+ return undefined;
123
+ }
124
+ }
125
+ function unwrapMcpResult(output) {
126
+ if (!isRecord(output))
127
+ return output;
128
+ if (output.structuredContent !== undefined) {
129
+ return output.structuredContent;
130
+ }
131
+ if (Array.isArray(output.content) && output.content.length === 1) {
132
+ const item = output.content[0];
133
+ if (isRecord(item) && item.type === "text") {
134
+ return parseJsonText(item.text) ?? item.text;
135
+ }
136
+ }
137
+ return output;
138
+ }
139
+ export function buildPaseoToolDetailSections(toolName, input, output) {
140
+ const leafName = getPaseoToolLeafName(toolName);
141
+ if (!leafName)
142
+ return null;
143
+ const spec = getPaseoToolEntry(leafName)?.detail ?? {};
144
+ const sections = [];
145
+ if (spec.promptField && isRecord(input)) {
146
+ const prompt = input[spec.promptField];
147
+ if (typeof prompt === "string" && prompt.length > 0) {
148
+ sections.push({ kind: "prose", title: "Prompt", text: prompt });
149
+ }
150
+ }
151
+ const inputFields = fieldsFromValue(input, spec.inputOrder, spec.promptField);
152
+ if (inputFields.length > 0) {
153
+ sections.push({ kind: "fields", title: "Details", fields: inputFields });
154
+ }
155
+ const outputFields = fieldsFromValue(unwrapMcpResult(output), spec.outputFields, undefined, spec.outputFields);
156
+ if (outputFields.length > 0) {
157
+ sections.push({ kind: "fields", title: "Result", fields: outputFields });
158
+ }
159
+ return sections;
160
+ }
161
+ //# sourceMappingURL=detail-sections.js.map
@@ -0,0 +1,22 @@
1
+ import type { ToolCallDetail } from "../agent-types.js";
2
+ import { type PaseoToolName } from "./catalog.js";
3
+ export { buildAgentMessageDisplay, type AgentMessageDisplay } from "./agent-message.js";
4
+ export { buildPaseoToolDetailSections, type PaseoToolDetailField, type PaseoToolDetailSection, } from "./detail-sections.js";
5
+ export { MAX_SUMMARY_CHARS } from "./summary-text.js";
6
+ export type { PaseoToolName };
7
+ export interface PaseoToolDisplayInput {
8
+ toolName: string;
9
+ detail: ToolCallDetail;
10
+ /** Title of the agent named by the call's `agentId`, when the caller knows it. */
11
+ targetAgentTitle?: string;
12
+ }
13
+ export interface PaseoToolDisplay {
14
+ displayName: string;
15
+ summary?: string;
16
+ }
17
+ export declare const PASEO_TOOL_NAMES: readonly PaseoToolName[];
18
+ /** Returns null for tools outside the Paseo namespace. */
19
+ export declare function buildPaseoToolDisplay(input: PaseoToolDisplayInput): PaseoToolDisplay | null;
20
+ /** The agent a Paseo call acts on, so callers can resolve its title. */
21
+ export declare function getPaseoToolTargetAgentId(toolName: string, detail: ToolCallDetail | undefined): string | null;
22
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,62 @@
1
+ import { getPaseoToolLeafName, isPaseoToolName } from "../tool-name-normalization.js";
2
+ import { getPaseoToolEntry, PASEO_TOOL_CATALOG } from "./catalog.js";
3
+ import { toSummaryText } from "./summary-text.js";
4
+ export { buildAgentMessageDisplay } from "./agent-message.js";
5
+ export { buildPaseoToolDetailSections, } from "./detail-sections.js";
6
+ export { MAX_SUMMARY_CHARS } from "./summary-text.js";
7
+ export const PASEO_TOOL_NAMES = Object.keys(PASEO_TOOL_CATALOG);
8
+ /** Returns null for tools outside the Paseo namespace. */
9
+ export function buildPaseoToolDisplay(input) {
10
+ const leafName = paseoLeafName(input.toolName);
11
+ if (!leafName)
12
+ return null;
13
+ const entry = getPaseoToolEntry(leafName);
14
+ if (!entry)
15
+ return { displayName: humanizeLeafName(leafName) };
16
+ const toolInput = readToolInput(input.detail);
17
+ const targetAgent = input.targetAgentTitle ?? readString(toolInput.agentId);
18
+ const summary = formatContext(entry.context?.(toolInput, targetAgent));
19
+ return { displayName: entry.label, ...(summary ? { summary } : {}) };
20
+ }
21
+ /** The agent a Paseo call acts on, so callers can resolve its title. */
22
+ export function getPaseoToolTargetAgentId(toolName, detail) {
23
+ if (!detail || !paseoLeafName(toolName))
24
+ return null;
25
+ return readString(readToolInput(detail).agentId) ?? null;
26
+ }
27
+ function paseoLeafName(toolName) {
28
+ return isPaseoToolName(toolName) ? getPaseoToolLeafName(toolName) : null;
29
+ }
30
+ function readToolInput(detail) {
31
+ if (detail.type !== "unknown")
32
+ return {};
33
+ const value = detail.input;
34
+ return typeof value === "object" && value !== null && !Array.isArray(value)
35
+ ? value
36
+ : {};
37
+ }
38
+ function readString(value) {
39
+ return typeof value === "string" && value.length > 0 ? value : undefined;
40
+ }
41
+ function formatContext(value) {
42
+ if (typeof value === "string")
43
+ return toSummaryText(value);
44
+ if (typeof value === "number")
45
+ return String(value);
46
+ if (Array.isArray(value)) {
47
+ const [first, ...rest] = value;
48
+ const head = typeof first === "string" ? toSummaryText(first) : undefined;
49
+ if (!head)
50
+ return undefined;
51
+ return rest.length > 0 ? `${head} +${rest.length}` : head;
52
+ }
53
+ return undefined;
54
+ }
55
+ function humanizeLeafName(leafName) {
56
+ const sentence = leafName
57
+ .replace(/[._-]+/g, " ")
58
+ .trim()
59
+ .toLowerCase();
60
+ return `${sentence[0]?.toUpperCase() ?? ""}${sentence.slice(1)}`;
61
+ }
62
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Prompts and results can be one enormous line. Summaries are capped here so no
3
+ * consumer relies on its renderer to clip them.
4
+ */
5
+ export declare const MAX_SUMMARY_CHARS = 120;
6
+ export declare function toSummaryText(value: string): string | undefined;
7
+ //# sourceMappingURL=summary-text.d.ts.map
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Prompts and results can be one enormous line. Summaries are capped here so no
3
+ * consumer relies on its renderer to clip them.
4
+ */
5
+ export const MAX_SUMMARY_CHARS = 120;
6
+ // Bounds the whitespace scan: inputs can be megabytes.
7
+ const SCAN_WINDOW_CHARS = MAX_SUMMARY_CHARS * 4;
8
+ export function toSummaryText(value) {
9
+ const isPartial = value.length > SCAN_WINDOW_CHARS;
10
+ const collapsed = value.slice(0, SCAN_WINDOW_CHARS).replace(/\s+/g, " ").trim();
11
+ if (!collapsed)
12
+ return undefined;
13
+ if (collapsed.length <= MAX_SUMMARY_CHARS && !isPartial)
14
+ return collapsed;
15
+ const kept = dropTrailingHighSurrogate(collapsed.slice(0, MAX_SUMMARY_CHARS - 1)).trimEnd();
16
+ return `${kept}…`;
17
+ }
18
+ function dropTrailingHighSurrogate(text) {
19
+ const last = text.charCodeAt(text.length - 1);
20
+ return last >= 0xd800 && last <= 0xdbff ? text.slice(0, -1) : text;
21
+ }
22
+ //# sourceMappingURL=summary-text.js.map
@@ -1,4 +1,5 @@
1
1
  export const BUILTIN_PROVIDER_ICON_NAMES = [
2
+ "antigravity",
2
3
  "claude",
3
4
  "codex",
4
5
  "copilot",
@@ -21,6 +22,7 @@ export const ACP_PROVIDER_ICON_NAMES = [
21
22
  "crow-cli",
22
23
  "cursor",
23
24
  "deepagents",
25
+ "devin",
24
26
  "dimcode",
25
27
  "dirac",
26
28
  "factory-droid",
@@ -30,6 +32,8 @@ export const ACP_PROVIDER_ICON_NAMES = [
30
32
  "glm-acp-agent",
31
33
  "goose",
32
34
  "grok",
35
+ "hermes",
36
+ "hoplite",
33
37
  "junie",
34
38
  "kilo",
35
39
  "kimi",
@@ -1,6 +1,8 @@
1
1
  import type { ToolCallTimelineItem } from "./agent-types.js";
2
- export type ToolCallDisplayInput = Pick<ToolCallTimelineItem, "name" | "status" | "error" | "metadata" | "detail"> & {
2
+ export type ToolCallDisplayInput = Pick<ToolCallTimelineItem, "name" | "status" | "error" | "metadata" | "detail" | "agentMessage"> & {
3
3
  cwd?: string;
4
+ /** Title of the agent a Paseo call targets, when the caller knows it. */
5
+ targetAgentTitle?: string;
4
6
  };
5
7
  export interface ToolCallDisplayModel {
6
8
  displayName: string;
@@ -1,4 +1,4 @@
1
- import { getPaseoToolLeafName, isPaseoToolName } from "./tool-name-normalization.js";
1
+ import { buildAgentMessageDisplay, buildPaseoToolDisplay, } from "./paseo-tool-presentation/index.js";
2
2
  import { stripCwdPrefix } from "./path-utils.js";
3
3
  function isRecord(value) {
4
4
  return typeof value === "object" && value !== null && !Array.isArray(value);
@@ -11,12 +11,6 @@ function humanizeToolName(name) {
11
11
  if (!trimmed) {
12
12
  return name;
13
13
  }
14
- if (isPaseoToolName(trimmed)) {
15
- const leaf = getPaseoToolLeafName(trimmed);
16
- if (leaf) {
17
- return humanizeToolName(leaf);
18
- }
19
- }
20
14
  if (/[:./]/.test(trimmed) || trimmed.includes("__")) {
21
15
  return trimmed;
22
16
  }
@@ -120,13 +114,27 @@ function buildUnknownDetailOverride(input) {
120
114
  return {};
121
115
  }
122
116
  export function buildToolCallDisplayModel(input) {
117
+ const errorText = input.status === "failed" ? formatErrorText(input.error) : undefined;
118
+ const paseoDisplay = input.agentMessage
119
+ ? buildAgentMessageDisplay(input.agentMessage)
120
+ : buildPaseoToolDisplay({
121
+ toolName: input.name,
122
+ detail: input.detail,
123
+ targetAgentTitle: input.targetAgentTitle,
124
+ });
125
+ if (paseoDisplay) {
126
+ return {
127
+ displayName: paseoDisplay.displayName,
128
+ ...(paseoDisplay.summary ? { summary: paseoDisplay.summary } : {}),
129
+ ...(errorText ? { errorText } : {}),
130
+ };
131
+ }
123
132
  const canonicalDisplay = buildCanonicalDetailDisplay(input);
124
133
  const unknownDetailOverride = buildUnknownDetailOverride(input);
125
134
  const displayName = unknownDetailOverride.displayName ??
126
135
  canonicalDisplay.displayName ??
127
136
  humanizeToolName(input.name);
128
137
  const summary = unknownDetailOverride.summary ?? canonicalDisplay.summary;
129
- const errorText = input.status === "failed" ? formatErrorText(input.error) : undefined;
130
138
  return {
131
139
  displayName,
132
140
  ...(summary ? { summary } : {}),