@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
package/dist/messages.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { AgentMessageSchema } from "./agent-message.js";
1
2
  import { PluginRegistryIdentitySchema } from "./plugin-registry.js";
2
3
  import { AgentProfileSchema, AgentSkillSelectionSchema } from "./agent-profile.js";
3
4
  export { AgentProfileSchema, AgentSkillSelectionSchema, } from "./agent-profile.js";
@@ -478,6 +479,7 @@ const ToolCallDetailPayloadSchema = z.discriminatedUnion("type", [
478
479
  }),
479
480
  ]);
480
481
  const ToolCallBasePayloadSchema = z.object({
482
+ agentMessage: AgentMessageSchema.optional(),
481
483
  type: z.literal("tool_call"),
482
484
  callId: z.string(),
483
485
  name: z.string(),
@@ -685,6 +687,8 @@ export const AgentSnapshotPayloadSchema = z.object({
685
687
  attentionTimestamp: z.string().nullable().optional(),
686
688
  archivedAt: z.string().nullable().optional(),
687
689
  providerUnavailable: z.boolean().optional(),
690
+ // Private helper marker, retained for exact-ID snapshots and older wire messages.
691
+ internal: z.boolean().optional(),
688
692
  artifacts: z.array(AgentArtifactSchema).optional(),
689
693
  companionEntries: z.array(CompanionEntrySchema).optional(),
690
694
  });
@@ -775,6 +779,9 @@ const AgentDirectoryFilterSchema = z.object({
775
779
  includeArchived: z.boolean().optional(),
776
780
  requiresAttention: z.boolean().optional(),
777
781
  thinkingOptionId: z.string().nullable().optional(),
782
+ // Retained for wire parsing; private helpers are excluded from public discovery.
783
+ includeInternal: z.boolean().optional(),
784
+ includeBackground: z.boolean().optional(),
778
785
  });
779
786
  export const DeleteAgentRequestMessageSchema = z.object({
780
787
  type: z.literal("delete_agent_request"),
@@ -1124,6 +1131,7 @@ export const FetchAgentsRequestMessageSchema = z.object({
1124
1131
  type: z.literal("fetch_agents_request"),
1125
1132
  requestId: z.string(),
1126
1133
  scope: z.enum(["active"]).optional(),
1134
+ includeBackground: z.boolean().optional(),
1127
1135
  filter: AgentDirectoryFilterSchema.optional(),
1128
1136
  sort: z
1129
1137
  .array(z.object({
@@ -1153,6 +1161,7 @@ const WorkspaceStateBucketSchema = z.enum([
1153
1161
  "done",
1154
1162
  ]);
1155
1163
  export const FetchWorkspacesRequestMessageSchema = z.object({
1164
+ includeBackground: z.boolean().optional(),
1156
1165
  type: z.literal("fetch_workspaces_request"),
1157
1166
  requestId: z.string(),
1158
1167
  filter: z
@@ -1161,6 +1170,9 @@ export const FetchWorkspacesRequestMessageSchema = z.object({
1161
1170
  projectId: z.string().optional(),
1162
1171
  // Unused: accepted so older clients still parse, but the server does not filter on it.
1163
1172
  idPrefix: z.string().optional(),
1173
+ // Retained for wire parsing of older requests.
1174
+ includeInternal: z.boolean().optional(),
1175
+ includeBackground: z.boolean().optional(),
1164
1176
  })
1165
1177
  .optional(),
1166
1178
  sort: z
@@ -1230,6 +1242,8 @@ export const SendAgentMessageRequestSchema = z.object({
1230
1242
  /** Accepts full ID, unique prefix, or exact full title (server resolves). */
1231
1243
  agentId: z.string(),
1232
1244
  text: z.string(),
1245
+ /** Opaque sender identity for agent-originated prompts. */
1246
+ sourceAgentId: z.string().min(1).optional(),
1233
1247
  messageId: z.string().optional(), // Client-provided ID for deduplication
1234
1248
  activeTurnBehavior: ActiveTurnBehaviorSchema.optional(),
1235
1249
  images: z.array(ImageAttachmentSchema).optional(),
@@ -1531,6 +1545,13 @@ export const CreateAgentRequestMessageSchema = z.object({
1531
1545
  git: GitSetupOptionsSchema.optional(),
1532
1546
  worktree: CreateAgentWorktreeTargetSchema.optional(),
1533
1547
  autoArchive: z.boolean().optional(),
1548
+ // An ephemeral helper: the daemon never persists, lists, flags or announces
1549
+ // it, and plugin lifecycle hooks skip it. Lives on the request rather than
1550
+ // in the config schema, which is reused for updates. Retained for wire parsing;
1551
+ // public internal creation is no longer supported.
1552
+ internal: z.boolean().optional(),
1553
+ // Workspace creation intent, rejected when selecting an existing workspace.
1554
+ background: z.boolean().optional(),
1534
1555
  labels: z.record(z.string(), z.string()).default({}),
1535
1556
  requestId: z.string(),
1536
1557
  });
@@ -2583,6 +2604,10 @@ export const WorkspaceCreateRequestSchema = z.object({
2583
2604
  title: z.string().optional(),
2584
2605
  // Optional prompt context for workspace-level name/branch generation.
2585
2606
  firstAgentContext: FirstAgentContextSchema.optional(),
2607
+ // Retained for wire parsing; public internal creation is no longer supported.
2608
+ internal: z.boolean().optional(),
2609
+ background: z.boolean().optional(),
2610
+ callerAgentId: z.string().optional(),
2586
2611
  source: z.discriminatedUnion("kind", [
2587
2612
  z.object({
2588
2613
  kind: z.literal("directory"),
@@ -3016,6 +3041,8 @@ export const SessionEventSubscriptionSchema = z.enum([
3016
3041
  "script_status_update",
3017
3042
  "workspace_setup_progress",
3018
3043
  "agent.provider_subagents.update",
3044
+ "agent.side_conversation.update",
3045
+ "agent.side_conversation.removed",
3019
3046
  // COMPAT(durableAgentQueue): fork addition (TM-02). Only sent by clients that
3020
3047
  // saw features.durableAgentQueueV1; an old daemon parsing this enum rejects
3021
3048
  // the subscription request, which is why the client gates before subscribing.
@@ -3450,6 +3477,11 @@ export const ServerInfoStatusPayloadSchema = z
3450
3477
  creationLifecycle: z.boolean().optional(),
3451
3478
  // COMPAT(hubAgentRpc): added in v0.8.0; remove gate after 2027-03-05.
3452
3479
  hubAgentRpc: z.boolean().optional(),
3480
+ // COMPAT(internalAgents): added in v0.9.0; remove gate after 2027-03-17.
3481
+ internalAgents: z.boolean().optional(),
3482
+ // COMPAT(internalWorkspaces): added in v0.9.0; remove gate after 2027-03-17.
3483
+ internalWorkspaces: z.boolean().optional(),
3484
+ backgroundWorkspaces: z.boolean().optional(),
3453
3485
  providersSnapshot: z.boolean().optional(),
3454
3486
  usageSources: z.boolean().optional(),
3455
3487
  usageReportsStreaming: z.boolean().optional(),
@@ -3579,6 +3611,11 @@ export const ServerInfoStatusPayloadSchema = z
3579
3611
  providerSubagentNesting: z.boolean().optional(),
3580
3612
  // COMPAT(sideConversations): added in 0.7.0-beta.2.fork.1, fork-only — stock peers never gain it, so the gate lasts as long as stock peers are supported.
3581
3613
  sideConversations: z.boolean().optional(),
3614
+ // COMPAT(sideConversationEvents): added in 0.12.0-beta.1.fork.1 — session event
3615
+ // subscriptions can carry the side-conversation update/removal stream, so a modern
3616
+ // (owned-subscription) client can receive proofs for those events. Older fork daemons
3617
+ // advertise sideConversations without this selector support, so clients gate on it.
3618
+ sideConversationEvents: z.boolean().optional(),
3582
3619
  // COMPAT(workspacePinning): added in v0.1.107, remove gate after 2027-01-12.
3583
3620
  workspacePinning: z.boolean().optional(),
3584
3621
  // COMPAT(workspaceMarkUnread): added in v0.5.0, remove after 2027-08-20.
@@ -3599,6 +3636,8 @@ export const ServerInfoStatusPayloadSchema = z
3599
3636
  commitBaseClassification: z.boolean().optional(),
3600
3637
  // COMPAT(providerRemoval): added in v0.1.105, drop the gate when floor >= v0.1.105.
3601
3638
  providerRemoval: z.boolean().optional(),
3639
+ // COMPAT(hopliteProvider): added after v0.11.2, remove after 2027-04-15 once host floor includes the bundled adapter.
3640
+ hopliteProvider: z.boolean().optional(),
3602
3641
  // COMPAT(providerConfigReplace): added in v0.2.X, remove after 2027-02-02 when old daemons are unsupported.
3603
3642
  providerConfigReplace: z.boolean().optional(),
3604
3643
  // COMPAT(providerConfigRename): added in v0.2.X, remove after 2027-02-02 when old daemons are unsupported.
@@ -3619,6 +3658,7 @@ export const ServerInfoStatusPayloadSchema = z
3619
3658
  ownedSubscriptions: z.boolean().optional(),
3620
3659
  // COMPAT(canonicalSubmittedPrompts): added in v0.2.6, remove gate after 2027-01-30.
3621
3660
  canonicalSubmittedPrompts: z.boolean().optional(),
3661
+ agentMessageProvenance: z.boolean().optional(),
3622
3662
  // COMPAT(agentTurnIdentity): accept peers that observed pre-release v0.2.6 through 2027-01-31.
3623
3663
  agentTurnIdentity: z.boolean().optional(),
3624
3664
  // COMPAT(stableProjectIdentity): added in v0.1.109, remove gate after 2027-01-15.
@@ -3914,6 +3954,9 @@ export const WorkspaceDescriptorPayloadSchema = z
3914
3954
  pinnedAt: z.string().nullable().optional(),
3915
3955
  // COMPAT(workspaceLabels): added in v0.5.0, remove optional after 2027-08-14.
3916
3956
  labels: z.array(z.string()).optional(),
3957
+ // Retained for wire parsing of older daemon descriptors.
3958
+ internal: z.boolean().optional(),
3959
+ background: z.boolean().optional(),
3917
3960
  archivingAt: z.string().nullable().optional().default(null),
3918
3961
  status: WorkspaceStateBucketSchema,
3919
3962
  // Best-effort workspace status entry timestamp. Old daemons omit the
@@ -4640,7 +4683,8 @@ export const SideConversationTimelineGetResponseMessageSchema = z.object({
4640
4683
  });
4641
4684
  export const SideConversationUpdateMessageSchema = z.object({
4642
4685
  type: z.literal("agent.side_conversation.update"),
4643
- payload: SideConversationSnapshotPayloadSchema,
4686
+ // subscriptionId is the owned-delivery proof tag; it stays optional for legacy broadcasts.
4687
+ payload: SideConversationSnapshotPayloadSchema.extend({ subscriptionId: z.string().optional() }),
4644
4688
  });
4645
4689
  export const SideConversationListResponseMessageSchema = z.object({
4646
4690
  type: z.literal("agent.side_conversation.list.response"),
@@ -4656,6 +4700,7 @@ export const SideConversationRemovedMessageSchema = z.object({
4656
4700
  payload: z.object({
4657
4701
  parentAgentId: z.string(),
4658
4702
  threadId: z.string(),
4703
+ subscriptionId: z.string().optional(),
4659
4704
  }),
4660
4705
  });
4661
4706
  export const SetAgentTimelineSubscriptionResponseMessageSchema = z.object({
@@ -6029,14 +6074,15 @@ export const UsageProblemSchema = z.discriminatedUnion("kind", [
6029
6074
  }),
6030
6075
  z.object({ kind: z.literal("no_quota"), detail: z.string() }),
6031
6076
  ]);
6077
+ const AvailableUsageReportSchema = z.object({
6078
+ status: z.literal("available"),
6079
+ planLabel: z.string().optional(),
6080
+ windows: z.array(ProviderUsageWindowSchema),
6081
+ balances: z.array(ProviderUsageBalanceSchema).optional(),
6082
+ details: z.array(ProviderUsageDetailSchema).optional(),
6083
+ });
6032
6084
  export const UsageReportSchema = z.discriminatedUnion("status", [
6033
- z.object({
6034
- status: z.literal("available"),
6035
- planLabel: z.string().optional(),
6036
- windows: z.array(ProviderUsageWindowSchema),
6037
- balances: z.array(ProviderUsageBalanceSchema).optional(),
6038
- details: z.array(ProviderUsageDetailSchema).optional(),
6039
- }),
6085
+ AvailableUsageReportSchema,
6040
6086
  z.object({ status: z.literal("unavailable"), problem: UsageProblemSchema }),
6041
6087
  z.object({ status: z.literal("error"), error: z.string() }),
6042
6088
  ]);
@@ -6048,6 +6094,11 @@ export const UsageReportEntrySchema = z.object({
6048
6094
  sourceLabel: z.string(),
6049
6095
  icon: z.string().optional(),
6050
6096
  report: UsageReportSchema,
6097
+ // Successful completion time; fetchedAt remains the attempt timestamp for ordering.
6098
+ successfulAt: z.string().optional(),
6099
+ lastSuccessful: z
6100
+ .object({ fetchedAt: z.string(), report: AvailableUsageReportSchema })
6101
+ .optional(),
6051
6102
  loginErrors: z
6052
6103
  .array(z.object({
6053
6104
  harness: z.string(),
@@ -1,15 +1,2 @@
1
- export interface PaseoToolDetailField {
2
- label: string;
3
- value: string;
4
- }
5
- export type PaseoToolDetailSection = {
6
- kind: "prose";
7
- title: string;
8
- text: string;
9
- } | {
10
- kind: "fields";
11
- title: string;
12
- fields: PaseoToolDetailField[];
13
- };
14
- export declare function buildPaseoToolDetailSections(toolName: string, input: unknown, output: unknown): PaseoToolDetailSection[] | null;
1
+ export { buildPaseoToolDetailSections, type PaseoToolDetailField, type PaseoToolDetailSection, } from "./paseo-tool-presentation/index.js";
15
2
  //# sourceMappingURL=paseo-tool-call-detail.d.ts.map
@@ -1,305 +1,3 @@
1
- import { getPaseoToolLeafName } from "./tool-name-normalization.js";
2
- const WORKSPACE_FIELDS = [
3
- "title",
4
- "workspaceId",
5
- "projectId",
6
- "isolation",
7
- "path",
8
- "mode",
9
- "worktreeSlug",
10
- "branchName",
11
- "baseBranch",
12
- "branch",
13
- "prNumber",
14
- "forge",
15
- ];
16
- const AGENT_FIELDS = [
17
- "title",
18
- "agentId",
19
- "provider",
20
- "workspaceId",
21
- "cwd",
22
- "sessionMode",
23
- "modeId",
24
- "background",
25
- "notifyOnFinish",
26
- "settings",
27
- "labels",
28
- ];
29
- const AUTOMATION_FIELDS = [
30
- "name",
31
- "id",
32
- "cron",
33
- "timezone",
34
- "provider",
35
- "cwd",
36
- "isolation",
37
- "maxRuns",
38
- "expiresIn",
39
- "clearExpires",
40
- ];
41
- const BROWSER_FIELDS = [
42
- "browserId",
43
- "url",
44
- "ref",
45
- "sourceRef",
46
- "targetRef",
47
- "value",
48
- "text",
49
- "key",
50
- "button",
51
- "doubleClick",
52
- "modifiers",
53
- "filePaths",
54
- "fullPage",
55
- "maxEntries",
56
- "timeoutMs",
57
- "deltaX",
58
- "deltaY",
59
- "width",
60
- "height",
61
- "function",
62
- ];
63
- const TOOL_SPECS = {
64
- create_workspace: {
65
- inputOrder: WORKSPACE_FIELDS,
66
- outputFields: ["workspaceId", "projectId"],
67
- },
68
- list_workspaces: {},
69
- archive_workspace: {
70
- inputOrder: ["workspaceId"],
71
- outputFields: ["workspaceId", "archivedAgentIds", "removedDirectory"],
72
- },
73
- rename_workspace: { inputOrder: ["title", "workspaceId"] },
74
- create_agent: {
75
- promptField: "initialPrompt",
76
- inputOrder: AGENT_FIELDS,
77
- outputFields: ["agentId", "status", "currentModeId", "cwd"],
78
- },
79
- send_agent_prompt: {
80
- promptField: "prompt",
81
- inputOrder: AGENT_FIELDS,
82
- outputFields: ["status", "lastMessage", "permission"],
83
- },
84
- get_agent_status: { inputOrder: ["agentId"] },
85
- list_agents: { inputOrder: ["cwd", "statuses", "sinceHours", "limit", "includeArchived"] },
86
- cancel_agent: { inputOrder: ["agentId"] },
87
- archive_agent: { inputOrder: ["agentId"] },
88
- kill_agent: { inputOrder: ["agentId"] },
89
- update_agent: { inputOrder: AGENT_FIELDS },
90
- get_agent_activity: { inputOrder: ["agentId", "limit"] },
91
- set_agent_mode: { inputOrder: ["agentId", "modeId"] },
92
- list_workspace_scripts: { inputOrder: ["workspaceId"] },
93
- start_workspace_script: { inputOrder: ["workspaceId", "scriptName"] },
94
- stop_workspace_script: { inputOrder: ["workspaceId", "scriptName"] },
95
- list_terminals: { inputOrder: ["cwd", "all"] },
96
- create_terminal: { inputOrder: ["cwd", "workspaceId", "name", "command"] },
97
- kill_terminal: { inputOrder: ["terminalId"] },
98
- capture_terminal: { inputOrder: ["terminalId", "lines"] },
99
- send_terminal_keys: { inputOrder: ["terminalId", "keys", "literal"] },
100
- create_schedule: {
101
- promptField: "prompt",
102
- inputOrder: AUTOMATION_FIELDS,
103
- outputFields: ["id", "status", "nextRunAt", "expiresAt"],
104
- },
105
- create_heartbeat: {
106
- promptField: "prompt",
107
- inputOrder: AUTOMATION_FIELDS,
108
- outputFields: ["id", "status", "nextRunAt", "expiresAt"],
109
- },
110
- delete_heartbeat: { inputOrder: ["id"] },
111
- list_schedules: {},
112
- inspect_schedule: { inputOrder: ["id"] },
113
- pause_schedule: { inputOrder: ["id"] },
114
- resume_schedule: { inputOrder: ["id"] },
115
- delete_schedule: { inputOrder: ["id"] },
116
- update_schedule: { promptField: "prompt", inputOrder: AUTOMATION_FIELDS },
117
- schedule_logs: { inputOrder: ["id"] },
118
- run_schedule_once: { inputOrder: ["id"] },
119
- list_providers: {},
120
- list_models: { inputOrder: ["provider"] },
121
- list_profiles: {},
122
- inspect_provider: { inputOrder: ["provider", "cwd", "settings"] },
123
- list_pending_permissions: {},
124
- respond_to_permission: { inputOrder: ["agentId", "requestId", "response"] },
125
- browser_list_tabs: {},
126
- browser_new_tab: { inputOrder: BROWSER_FIELDS },
127
- browser_snapshot: { inputOrder: BROWSER_FIELDS },
128
- browser_click: { inputOrder: BROWSER_FIELDS },
129
- browser_fill: { inputOrder: BROWSER_FIELDS },
130
- browser_wait: { inputOrder: BROWSER_FIELDS },
131
- browser_type: { inputOrder: BROWSER_FIELDS },
132
- browser_keypress: { inputOrder: BROWSER_FIELDS },
133
- browser_navigate: { inputOrder: BROWSER_FIELDS },
134
- browser_back: { inputOrder: BROWSER_FIELDS },
135
- browser_forward: { inputOrder: BROWSER_FIELDS },
136
- browser_reload: { inputOrder: BROWSER_FIELDS },
137
- browser_screenshot: { inputOrder: BROWSER_FIELDS },
138
- browser_upload: { inputOrder: BROWSER_FIELDS },
139
- browser_hover: { inputOrder: BROWSER_FIELDS },
140
- browser_select: { inputOrder: BROWSER_FIELDS },
141
- browser_drag: { inputOrder: BROWSER_FIELDS },
142
- browser_logs: { inputOrder: BROWSER_FIELDS },
143
- browser_evaluate: { inputOrder: BROWSER_FIELDS },
144
- browser_scroll: { inputOrder: BROWSER_FIELDS },
145
- browser_resize: { inputOrder: BROWSER_FIELDS },
146
- browser_close_tab: { inputOrder: BROWSER_FIELDS },
147
- };
148
- const FIELD_LABELS = {
149
- agentId: "Agent",
150
- archivedAgentIds: "Archived agents",
151
- baseBranch: "Base branch",
152
- branchName: "New branch",
153
- browserId: "Browser tab",
154
- clearExpires: "Clear expiry",
155
- currentModeId: "Current mode",
156
- cwd: "Working directory",
157
- deltaX: "Horizontal delta",
158
- deltaY: "Vertical delta",
159
- doubleClick: "Double click",
160
- expiresIn: "Expires in",
161
- expiresAt: "Expires",
162
- filePaths: "Files",
163
- fullPage: "Full page",
164
- initialPrompt: "Prompt",
165
- id: "ID",
166
- lastMessage: "Last message",
167
- maxEntries: "Maximum entries",
168
- maxRuns: "Maximum runs",
169
- modeId: "Mode",
170
- newMode: "New mode",
171
- nextRunAt: "Next run",
172
- notifyOnFinish: "Notify on finish",
173
- prNumber: "Change request",
174
- projectId: "Project",
175
- removedDirectory: "Removed directory",
176
- requestId: "Request",
177
- scriptName: "Script",
178
- sessionMode: "Session mode",
179
- sinceHours: "Since (hours)",
180
- sourceRef: "Source",
181
- targetRef: "Target",
182
- terminalId: "Terminal",
183
- thinkingOptionId: "Thinking",
184
- timeoutMs: "Timeout (ms)",
185
- updateCount: "Updates",
186
- workspaceId: "Workspace",
187
- worktreeSlug: "Worktree",
188
- };
189
- function isRecord(value) {
190
- return typeof value === "object" && value !== null && !Array.isArray(value);
191
- }
192
- function humanizeKey(key) {
193
- const known = FIELD_LABELS[key];
194
- if (known)
195
- return known;
196
- const words = key
197
- .replace(/([a-z0-9])([A-Z])/g, "$1 $2")
198
- .replace(/[._-]+/g, " ")
199
- .split(" ")
200
- .filter(Boolean);
201
- const sentence = words.join(" ").toLowerCase();
202
- return `${sentence[0]?.toUpperCase() ?? ""}${sentence.slice(1)}`;
203
- }
204
- function formatValue(value, depth = 0) {
205
- if (value === null)
206
- return "None";
207
- if (value === undefined)
208
- return "";
209
- if (typeof value === "boolean")
210
- return value ? "Yes" : "No";
211
- if (typeof value === "string" || typeof value === "number" || typeof value === "bigint") {
212
- return String(value);
213
- }
214
- if (Array.isArray(value)) {
215
- if (value.length === 0)
216
- return "None";
217
- return value.map((item) => `• ${indentMultiline(formatValue(item, depth + 1), 2)}`).join("\n");
218
- }
219
- if (isRecord(value)) {
220
- const entries = Object.entries(value).filter(([, child]) => child !== undefined);
221
- if (entries.length === 0)
222
- return "None";
223
- return entries
224
- .map(([key, child]) => {
225
- const formatted = formatValue(child, depth + 1);
226
- return `${humanizeKey(key)}: ${indentMultiline(formatted, 2)}`;
227
- })
228
- .join("\n");
229
- }
230
- return String(value);
231
- }
232
- function indentMultiline(value, spaces) {
233
- const indentation = " ".repeat(spaces);
234
- return value.replace(/\n/g, `\n${indentation}`);
235
- }
236
- function orderedEntries(value, order = [], omittedKey, includedKeys) {
237
- const included = includedKeys ? new Set(includedKeys) : null;
238
- const keys = Object.keys(value).filter((key) => key !== omittedKey && value[key] !== undefined && (!included || included.has(key)));
239
- const rank = new Map(order.map((key, index) => [key, index]));
240
- keys.sort((left, right) => {
241
- const leftRank = rank.get(left) ?? Number.MAX_SAFE_INTEGER;
242
- const rightRank = rank.get(right) ?? Number.MAX_SAFE_INTEGER;
243
- return leftRank - rightRank || left.localeCompare(right);
244
- });
245
- return keys.map((key) => [key, value[key]]);
246
- }
247
- function fieldsFromValue(value, order, omittedKey, includedKeys) {
248
- if (value === null || value === undefined)
249
- return [];
250
- if (!isRecord(value)) {
251
- const formatted = formatValue(value);
252
- return formatted ? [{ label: "Value", value: formatted }] : [];
253
- }
254
- return orderedEntries(value, order, omittedKey, includedKeys).map(([key, child]) => ({
255
- label: humanizeKey(key),
256
- value: formatValue(child),
257
- }));
258
- }
259
- function parseJsonText(value) {
260
- if (typeof value !== "string")
261
- return undefined;
262
- try {
263
- return JSON.parse(value);
264
- }
265
- catch {
266
- return undefined;
267
- }
268
- }
269
- function unwrapMcpResult(output) {
270
- if (!isRecord(output))
271
- return output;
272
- if (output.structuredContent !== undefined) {
273
- return output.structuredContent;
274
- }
275
- if (Array.isArray(output.content) && output.content.length === 1) {
276
- const item = output.content[0];
277
- if (isRecord(item) && item.type === "text") {
278
- return parseJsonText(item.text) ?? item.text;
279
- }
280
- }
281
- return output;
282
- }
283
- export function buildPaseoToolDetailSections(toolName, input, output) {
284
- const leafName = getPaseoToolLeafName(toolName);
285
- if (!leafName)
286
- return null;
287
- const spec = TOOL_SPECS[leafName] ?? {};
288
- const sections = [];
289
- if (spec.promptField && isRecord(input)) {
290
- const prompt = input[spec.promptField];
291
- if (typeof prompt === "string" && prompt.length > 0) {
292
- sections.push({ kind: "prose", title: "Prompt", text: prompt });
293
- }
294
- }
295
- const inputFields = fieldsFromValue(input, spec.inputOrder, spec.promptField);
296
- if (inputFields.length > 0) {
297
- sections.push({ kind: "fields", title: "Details", fields: inputFields });
298
- }
299
- const outputFields = fieldsFromValue(unwrapMcpResult(output), spec.outputFields, undefined, spec.outputFields);
300
- if (outputFields.length > 0) {
301
- sections.push({ kind: "fields", title: "Result", fields: outputFields });
302
- }
303
- return sections;
304
- }
1
+ // COMPAT(paseoToolCallDetail): added in v0.12.0, remove after 2027-04-19 once plugins have migrated to paseo-tool-presentation/index.
2
+ export { buildPaseoToolDetailSections, } from "./paseo-tool-presentation/index.js";
305
3
  //# sourceMappingURL=paseo-tool-call-detail.js.map
@@ -0,0 +1,10 @@
1
+ import type { AgentMessage } from "../agent-message.js";
2
+ import type { ToolCallDetail } from "../agent-types.js";
3
+ export interface AgentMessageDisplay {
4
+ displayName: string;
5
+ summary?: string;
6
+ detail: ToolCallDetail;
7
+ }
8
+ /** Presentation shared by clients; never used to encode provider prompts. */
9
+ export declare function buildAgentMessageDisplay(message: AgentMessage): AgentMessageDisplay;
10
+ //# sourceMappingURL=agent-message.d.ts.map
@@ -0,0 +1,22 @@
1
+ import { toSummaryText } from "./summary-text.js";
2
+ /** Events read noun-first ("Agent finished"); the sender goes in the summary. */
3
+ const EVENT_LABELS = {
4
+ message: "Message received",
5
+ finished: "Agent finished",
6
+ errored: "Agent errored",
7
+ "permission-required": "Agent needs permission",
8
+ closed: "Agent closed",
9
+ };
10
+ /** Presentation shared by clients; never used to encode provider prompts. */
11
+ export function buildAgentMessageDisplay(message) {
12
+ const summary = toSummaryText(message.sender.title ?? message.sender.id);
13
+ return {
14
+ displayName: EVENT_LABELS[message.event],
15
+ ...(summary ? { summary } : {}),
16
+ detail: {
17
+ type: "plain_text",
18
+ text: `From agent: ${message.sender.id}\n\n${message.text}`,
19
+ },
20
+ };
21
+ }
22
+ //# sourceMappingURL=agent-message.js.map