@getmateo/protocol 0.0.0-stage → 0.18.0

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 (179) hide show
  1. package/LICENSE +211 -0
  2. package/README.md +11 -2
  3. package/dist/addresses.d.ts +6 -0
  4. package/dist/addresses.js +2 -0
  5. package/dist/agent-attention-notification.d.ts +57 -0
  6. package/dist/agent-attention-notification.js +177 -0
  7. package/dist/agent-deep-link.d.ts +8 -0
  8. package/dist/agent-deep-link.js +49 -0
  9. package/dist/agent-labels.d.ts +14 -0
  10. package/dist/agent-labels.js +38 -0
  11. package/dist/agent-lifecycle.d.ts +3 -0
  12. package/dist/agent-lifecycle.js +8 -0
  13. package/dist/agent-message.d.ts +20 -0
  14. package/dist/agent-message.js +12 -0
  15. package/dist/agent-profile.d.ts +31 -0
  16. package/dist/agent-profile.js +32 -0
  17. package/dist/agent-runtime-config.d.ts +4 -0
  18. package/dist/agent-runtime-config.js +5 -0
  19. package/dist/agent-shells.d.ts +25 -0
  20. package/dist/agent-shells.js +17 -0
  21. package/dist/agent-state-bucket.d.ts +15 -0
  22. package/dist/agent-state-bucket.js +41 -0
  23. package/dist/agent-title-limits.d.ts +2 -0
  24. package/dist/agent-title-limits.js +2 -0
  25. package/dist/agent-types.d.ts +484 -0
  26. package/dist/agent-types.js +33 -0
  27. package/dist/binary-frames/demux.d.ts +15 -0
  28. package/dist/binary-frames/demux.js +28 -0
  29. package/dist/binary-frames/file-transfer.d.ts +51 -0
  30. package/dist/binary-frames/file-transfer.js +108 -0
  31. package/dist/binary-frames/host-route.d.ts +13 -0
  32. package/dist/binary-frames/host-route.js +39 -0
  33. package/dist/binary-frames/index.d.ts +5 -0
  34. package/dist/binary-frames/index.js +5 -0
  35. package/dist/binary-frames/terminal.d.ts +35 -0
  36. package/dist/binary-frames/terminal.js +100 -0
  37. package/dist/branch-slug.d.ts +14 -0
  38. package/dist/branch-slug.js +49 -0
  39. package/dist/browser-automation/capabilities.d.ts +7 -0
  40. package/dist/browser-automation/capabilities.js +31 -0
  41. package/dist/browser-automation/rpc-schemas.d.ts +1224 -0
  42. package/dist/browser-automation/rpc-schemas.js +497 -0
  43. package/dist/browser-download-rules.d.ts +21 -0
  44. package/dist/browser-download-rules.js +54 -0
  45. package/dist/build-metadata.d.ts +17 -0
  46. package/dist/build-metadata.js +61 -0
  47. package/dist/chat/rpc-schemas.d.ts +158 -0
  48. package/dist/chat/rpc-schemas.js +104 -0
  49. package/dist/chat/types.d.ts +30 -0
  50. package/dist/chat/types.js +23 -0
  51. package/dist/check-traits.d.ts +11 -0
  52. package/dist/check-traits.js +10 -0
  53. package/dist/chunked-transport.d.ts +42 -0
  54. package/dist/chunked-transport.js +277 -0
  55. package/dist/client-capabilities.d.ts +24 -0
  56. package/dist/client-capabilities.js +52 -0
  57. package/dist/connection-offer.d.ts +36 -0
  58. package/dist/connection-offer.js +53 -0
  59. package/dist/daemon-auth.d.ts +548 -0
  60. package/dist/daemon-auth.js +152 -0
  61. package/dist/daemon-endpoints.d.ts +54 -0
  62. package/dist/daemon-endpoints.js +243 -0
  63. package/dist/error-utils.d.ts +11 -0
  64. package/dist/error-utils.js +27 -0
  65. package/dist/fleet.d.ts +381 -0
  66. package/dist/fleet.js +134 -0
  67. package/dist/forge-manifest.d.ts +66 -0
  68. package/dist/forge-manifest.js +92 -0
  69. package/dist/generated/validation/ws-outbound-schema-metadata.d.ts +14187 -0
  70. package/dist/generated/validation/ws-outbound-schema-metadata.js +262 -0
  71. package/dist/generated/validation/ws-outbound.aot.d.ts +520 -0
  72. package/dist/generated/validation/ws-outbound.aot.js +106677 -0
  73. package/dist/git-remote.d.ts +33 -0
  74. package/dist/git-remote.js +94 -0
  75. package/dist/gitea-status.d.ts +10 -0
  76. package/dist/gitea-status.js +23 -0
  77. package/dist/gitlab-pipeline.d.ts +10 -0
  78. package/dist/gitlab-pipeline.js +17 -0
  79. package/dist/global-terminal.d.ts +3 -0
  80. package/dist/global-terminal.js +8 -0
  81. package/dist/host-connection-schema.d.ts +11 -0
  82. package/dist/host-connection-schema.js +9 -0
  83. package/dist/host-target.d.ts +20 -0
  84. package/dist/host-target.js +137 -0
  85. package/dist/hosts.d.ts +133 -0
  86. package/dist/hosts.js +82 -0
  87. package/dist/literal-union.d.ts +2 -0
  88. package/dist/literal-union.js +2 -0
  89. package/dist/loop/rpc-schemas.d.ts +636 -0
  90. package/dist/loop/rpc-schemas.js +164 -0
  91. package/dist/mateo-config-schema.d.ts +138 -0
  92. package/dist/mateo-config-schema.js +98 -0
  93. package/dist/mateo-tool-call-detail.d.ts +2 -0
  94. package/dist/mateo-tool-call-detail.js +3 -0
  95. package/dist/mateo-tool-presentation/agent-message.d.ts +10 -0
  96. package/dist/mateo-tool-presentation/agent-message.js +23 -0
  97. package/dist/mateo-tool-presentation/catalog.d.ts +321 -0
  98. package/dist/mateo-tool-presentation/catalog.js +319 -0
  99. package/dist/mateo-tool-presentation/detail-sections.d.ts +15 -0
  100. package/dist/mateo-tool-presentation/detail-sections.js +161 -0
  101. package/dist/mateo-tool-presentation/index.d.ts +22 -0
  102. package/dist/mateo-tool-presentation/index.js +62 -0
  103. package/dist/mateo-tool-presentation/summary-text.d.ts +7 -0
  104. package/dist/mateo-tool-presentation/summary-text.js +22 -0
  105. package/dist/messages.d.ts +70260 -0
  106. package/dist/messages.js +6740 -0
  107. package/dist/path-utils.d.ts +2 -0
  108. package/dist/path-utils.js +16 -0
  109. package/dist/plugin-browser-consent-copy.d.ts +193 -0
  110. package/dist/plugin-browser-consent-copy.js +109 -0
  111. package/dist/plugin-browser-grants.d.ts +48 -0
  112. package/dist/plugin-browser-grants.js +56 -0
  113. package/dist/plugin-browser.d.ts +321 -0
  114. package/dist/plugin-browser.js +109 -0
  115. package/dist/plugin-config.d.ts +18 -0
  116. package/dist/plugin-config.js +13 -0
  117. package/dist/plugin-overview.d.ts +12 -0
  118. package/dist/plugin-overview.js +50 -0
  119. package/dist/plugin-registry.d.ts +153 -0
  120. package/dist/plugin-registry.js +83 -0
  121. package/dist/plugin-requirements.d.ts +11 -0
  122. package/dist/plugin-requirements.js +26 -0
  123. package/dist/plugin-source-reference.d.ts +11 -0
  124. package/dist/plugin-source-reference.js +68 -0
  125. package/dist/provider-config.d.ts +141 -0
  126. package/dist/provider-config.js +113 -0
  127. package/dist/provider-icon-names.d.ts +5 -0
  128. package/dist/provider-icon-names.js +54 -0
  129. package/dist/provider-manifest.d.ts +30 -0
  130. package/dist/provider-manifest.js +247 -0
  131. package/dist/provider-snapshot-codec.d.ts +18 -0
  132. package/dist/provider-snapshot-codec.js +71 -0
  133. package/dist/schedule/cadence.d.ts +6 -0
  134. package/dist/schedule/cadence.js +28 -0
  135. package/dist/schedule/cron-expression.d.ts +14 -0
  136. package/dist/schedule/cron-expression.js +107 -0
  137. package/dist/schedule/rpc-schemas.d.ts +570 -0
  138. package/dist/schedule/rpc-schemas.js +158 -0
  139. package/dist/schedule/types.d.ts +201 -0
  140. package/dist/schedule/types.js +68 -0
  141. package/dist/search/text-match.d.ts +78 -0
  142. package/dist/search/text-match.js +330 -0
  143. package/dist/service-defaults.d.ts +3 -0
  144. package/dist/service-defaults.js +5 -0
  145. package/dist/ssh-transport.d.ts +11 -0
  146. package/dist/ssh-transport.js +72 -0
  147. package/dist/terminal-activity.d.ts +21 -0
  148. package/dist/terminal-activity.js +25 -0
  149. package/dist/terminal-input-mode.d.ts +30 -0
  150. package/dist/terminal-input-mode.js +180 -0
  151. package/dist/terminal-key-input.d.ts +13 -0
  152. package/dist/terminal-key-input.js +210 -0
  153. package/dist/terminal-profile.d.ts +10 -0
  154. package/dist/terminal-profile.js +11 -0
  155. package/dist/terminal-profiles.d.ts +41 -0
  156. package/dist/terminal-profiles.js +276 -0
  157. package/dist/terminal-snapshot.d.ts +4 -0
  158. package/dist/terminal-snapshot.js +220 -0
  159. package/dist/terminal-stream-protocol.d.ts +2 -0
  160. package/dist/terminal-stream-protocol.js +2 -0
  161. package/dist/terminal-subscription-key.d.ts +2 -0
  162. package/dist/terminal-subscription-key.js +9 -0
  163. package/dist/timeline-identity.d.ts +3 -0
  164. package/dist/timeline-identity.js +8 -0
  165. package/dist/tool-call-display.d.ts +13 -0
  166. package/dist/tool-call-display.js +144 -0
  167. package/dist/tool-name-normalization.d.ts +9 -0
  168. package/dist/tool-name-normalization.js +82 -0
  169. package/dist/user-agent.d.ts +26 -0
  170. package/dist/user-agent.js +101 -0
  171. package/dist/validation/ws-outbound-envelope.d.ts +13413 -0
  172. package/dist/validation/ws-outbound-envelope.js +17 -0
  173. package/dist/validation/ws-outbound.d.ts +12 -0
  174. package/dist/validation/ws-outbound.js +38 -0
  175. package/dist/websocket-message-limit.d.ts +5 -0
  176. package/dist/websocket-message-limit.js +5 -0
  177. package/dist/workspace-labels.d.ts +9 -0
  178. package/dist/workspace-labels.js +19 -0
  179. package/package.json +48 -4
@@ -0,0 +1,32 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * A named launch bundle: a provider plus the agent-config values a client would
4
+ * otherwise set one control at a time. Field names mirror `AgentSessionConfig`
5
+ * so applying a profile is a copy rather than a translation table.
6
+ *
7
+ * There is deliberately no system prompt here. `AgentSessionConfig.systemPrompt`
8
+ * is creation-only, so a profile carrying one would apply when starting a new
9
+ * agent and silently do nothing when applied to a running one.
10
+ */
11
+ export const AgentProfileSchema = z
12
+ .object({
13
+ id: z.string(),
14
+ name: z.string(),
15
+ /** A key into the client's icon registry, not a glyph. Unknown keys draw the default. */
16
+ icon: z.string().optional(),
17
+ /** An identity colour name shared with host badges. Unknown values draw unthemed. */
18
+ color: z.string().optional(),
19
+ provider: z.string(),
20
+ model: z.string().optional(),
21
+ modeId: z.string().optional(),
22
+ thinkingOptionId: z.string().optional(),
23
+ featureValues: z.record(z.string(), z.unknown()).optional(),
24
+ /** Free text, surfaced to orchestrating agents by the `list_profiles` MCP tool. */
25
+ notes: z.string().optional(),
26
+ })
27
+ .passthrough();
28
+ export const AgentSkillSelectionSchema = z.discriminatedUnion("mode", [
29
+ z.object({ mode: z.literal("all") }).strict(),
30
+ z.object({ mode: z.literal("custom"), skills: z.array(z.string()) }).strict(),
31
+ ]);
32
+ //# sourceMappingURL=agent-profile.js.map
@@ -0,0 +1,4 @@
1
+ import { z } from "zod";
2
+ export declare const IdleRuntimeCleanupMinutesSchema: z.ZodNullable<z.ZodUnion<readonly [z.ZodLiteral<60>, z.ZodLiteral<120>, z.ZodLiteral<240>]>>;
3
+ export type IdleRuntimeCleanupMinutes = z.infer<typeof IdleRuntimeCleanupMinutesSchema>;
4
+ //# sourceMappingURL=agent-runtime-config.d.ts.map
@@ -0,0 +1,5 @@
1
+ import { z } from "zod";
2
+ export const IdleRuntimeCleanupMinutesSchema = z
3
+ .union([z.literal(60), z.literal(120), z.literal(240)])
4
+ .nullable();
5
+ //# sourceMappingURL=agent-runtime-config.js.map
@@ -0,0 +1,25 @@
1
+ import { z } from "zod";
2
+ export declare const AgentShellSchema: z.ZodObject<{
3
+ id: z.ZodString;
4
+ description: z.ZodString;
5
+ command: z.ZodNullable<z.ZodString>;
6
+ status: z.ZodEnum<{
7
+ running: "running";
8
+ canceled: "canceled";
9
+ unknown: "unknown";
10
+ pending: "pending";
11
+ completed: "completed";
12
+ failed: "failed";
13
+ }>;
14
+ background: z.ZodBoolean;
15
+ startedAt: z.ZodNullable<z.ZodString>;
16
+ endedAt: z.ZodNullable<z.ZodString>;
17
+ canStop: z.ZodBoolean;
18
+ elapsedSeconds: z.ZodOptional<z.ZodNumber>;
19
+ output: z.ZodOptional<z.ZodString>;
20
+ outputTruncated: z.ZodOptional<z.ZodBoolean>;
21
+ exitCode: z.ZodOptional<z.ZodNumber>;
22
+ ownerSubagentId: z.ZodOptional<z.ZodString>;
23
+ }, z.core.$strip>;
24
+ export type AgentShell = z.infer<typeof AgentShellSchema>;
25
+ //# sourceMappingURL=agent-shells.d.ts.map
@@ -0,0 +1,17 @@
1
+ import { z } from "zod";
2
+ export const AgentShellSchema = z.object({
3
+ id: z.string(),
4
+ description: z.string(),
5
+ command: z.string().nullable(),
6
+ status: z.enum(["pending", "running", "completed", "failed", "canceled", "unknown"]),
7
+ background: z.boolean(),
8
+ startedAt: z.string().nullable(),
9
+ endedAt: z.string().nullable(),
10
+ canStop: z.boolean(),
11
+ elapsedSeconds: z.number().optional(),
12
+ output: z.string().optional(),
13
+ outputTruncated: z.boolean().optional(),
14
+ exitCode: z.number().optional(),
15
+ ownerSubagentId: z.string().optional(),
16
+ });
17
+ //# sourceMappingURL=agent-shells.js.map
@@ -0,0 +1,15 @@
1
+ import type { AgentLifecycleStatus } from "./agent-lifecycle.js";
2
+ import type { WorkspaceStateBucket } from "./messages.js";
3
+ export type { WorkspaceStateBucket };
4
+ export type AgentAttentionReason = "finished" | "error" | "permission" | null | undefined;
5
+ export interface AgentStateBucketInput {
6
+ status: AgentLifecycleStatus;
7
+ pendingPermissionCount?: number;
8
+ backgroundShellCount?: number;
9
+ requiresAttention?: boolean;
10
+ attentionReason?: AgentAttentionReason;
11
+ }
12
+ export declare function deriveAgentStateBucket(input: AgentStateBucketInput): WorkspaceStateBucket;
13
+ export declare function getWorkspaceStateBucketPriority(bucket: WorkspaceStateBucket): number;
14
+ export declare function getAgentStatusPriority(input: AgentStateBucketInput): number;
15
+ //# sourceMappingURL=agent-state-bucket.d.ts.map
@@ -0,0 +1,41 @@
1
+ const WORKSPACE_STATE_BUCKET_PRIORITY = {
2
+ needs_input: 0,
3
+ failed: 1,
4
+ running: 2,
5
+ attention: 3,
6
+ done: 4,
7
+ };
8
+ export function deriveAgentStateBucket(input) {
9
+ if ((input.pendingPermissionCount ?? 0) > 0 || input.attentionReason === "permission") {
10
+ return "needs_input";
11
+ }
12
+ if (input.status === "error" || input.attentionReason === "error") {
13
+ return "failed";
14
+ }
15
+ if (input.status === "running" || (input.backgroundShellCount ?? 0) > 0) {
16
+ return "running";
17
+ }
18
+ if (input.requiresAttention) {
19
+ return "attention";
20
+ }
21
+ return "done";
22
+ }
23
+ export function getWorkspaceStateBucketPriority(bucket) {
24
+ return WORKSPACE_STATE_BUCKET_PRIORITY[bucket];
25
+ }
26
+ export function getAgentStatusPriority(input) {
27
+ if ((input.pendingPermissionCount ?? 0) > 0 || input.attentionReason === "permission") {
28
+ return 0;
29
+ }
30
+ if (input.status === "error" || input.attentionReason === "error") {
31
+ return 1;
32
+ }
33
+ if (input.status === "running" || (input.backgroundShellCount ?? 0) > 0) {
34
+ return 2;
35
+ }
36
+ if (input.status === "initializing") {
37
+ return 3;
38
+ }
39
+ return 4;
40
+ }
41
+ //# sourceMappingURL=agent-state-bucket.js.map
@@ -0,0 +1,2 @@
1
+ export declare const MAX_EXPLICIT_AGENT_TITLE_CHARS = 200;
2
+ //# sourceMappingURL=agent-title-limits.d.ts.map
@@ -0,0 +1,2 @@
1
+ export const MAX_EXPLICIT_AGENT_TITLE_CHARS = 200;
2
+ //# sourceMappingURL=agent-title-limits.js.map
@@ -0,0 +1,484 @@
1
+ import type { AgentMessage } from "./agent-message.js";
2
+ import type { AgentAttachment } from "./messages.js";
3
+ export type AgentProvider = string;
4
+ export interface AgentMetadata {
5
+ [key: string]: unknown;
6
+ }
7
+ export type AgentProviderNotice = {
8
+ type: "info";
9
+ message: string;
10
+ } | {
11
+ type: "warning";
12
+ message: string;
13
+ } | {
14
+ type: "error";
15
+ message: string;
16
+ };
17
+ /**
18
+ * Stdio-based MCP server (spawns a subprocess).
19
+ */
20
+ export interface McpStdioServerConfig {
21
+ type: "stdio";
22
+ command: string;
23
+ args?: string[];
24
+ env?: Record<string, string>;
25
+ /**
26
+ * When true, all tools from this server are always included in the prompt
27
+ * and never deferred behind tool search. Honored by the Claude provider.
28
+ */
29
+ alwaysLoad?: boolean;
30
+ }
31
+ /**
32
+ * HTTP-based MCP server.
33
+ */
34
+ export interface McpHttpServerConfig {
35
+ type: "http";
36
+ url: string;
37
+ headers?: Record<string, string>;
38
+ /**
39
+ * When true, all tools from this server are always included in the prompt
40
+ * and never deferred behind tool search. Honored by the Claude provider.
41
+ */
42
+ alwaysLoad?: boolean;
43
+ }
44
+ /**
45
+ * SSE-based MCP server (Server-Sent Events over HTTP).
46
+ */
47
+ export interface McpSseServerConfig {
48
+ type: "sse";
49
+ url: string;
50
+ headers?: Record<string, string>;
51
+ /**
52
+ * When true, all tools from this server are always included in the prompt
53
+ * and never deferred behind tool search. Honored by the Claude provider.
54
+ */
55
+ alwaysLoad?: boolean;
56
+ }
57
+ /**
58
+ * Canonical MCP server configuration.
59
+ * Discriminated union by `type` field.
60
+ * Each provider normalizes this to their expected format.
61
+ */
62
+ export type McpServerConfig = McpStdioServerConfig | McpHttpServerConfig | McpSseServerConfig;
63
+ export interface AgentMode {
64
+ id: string;
65
+ label: string;
66
+ description?: string;
67
+ icon?: string;
68
+ colorTier?: string;
69
+ }
70
+ export type ProviderStatus = "ready" | "loading" | "error" | "unavailable";
71
+ export interface AgentModelDefinition {
72
+ provider: AgentProvider;
73
+ id: string;
74
+ aliases?: string[];
75
+ isSelectable?: boolean;
76
+ label: string;
77
+ description?: string;
78
+ isDefault?: boolean;
79
+ metadata?: AgentMetadata;
80
+ contextWindowMaxTokens?: number;
81
+ thinkingOptions?: AgentSelectOption[];
82
+ defaultThinkingOptionId?: string;
83
+ }
84
+ export interface AgentSelectOption {
85
+ id: string;
86
+ label: string;
87
+ description?: string;
88
+ isDefault?: boolean;
89
+ metadata?: AgentMetadata;
90
+ }
91
+ export declare function normalizeAgentModelDefinition(model: AgentModelDefinition): AgentModelDefinition;
92
+ /** A provider addresses models by ID; repeated rows retain the first definition. */
93
+ export declare function normalizeAgentModelCatalog(models: AgentModelDefinition[]): AgentModelDefinition[];
94
+ export interface ProviderSnapshotEntry {
95
+ provider: AgentProvider;
96
+ status: ProviderStatus;
97
+ enabled: boolean;
98
+ source?: "builtin" | "custom";
99
+ error?: string;
100
+ models?: AgentModelDefinition[];
101
+ modes?: AgentMode[];
102
+ fetchedAt?: string;
103
+ label?: string;
104
+ description?: string;
105
+ iconSvg?: string;
106
+ defaultModeId?: string | null;
107
+ }
108
+ export interface AgentFeatureToggle {
109
+ type: "toggle";
110
+ id: string;
111
+ label: string;
112
+ description?: string;
113
+ tooltip?: string;
114
+ icon?: string;
115
+ value: boolean;
116
+ }
117
+ export interface AgentFeatureSelect {
118
+ type: "select";
119
+ id: string;
120
+ label: string;
121
+ description?: string;
122
+ tooltip?: string;
123
+ icon?: string;
124
+ /** Desktop toolbar presentation; omitted means labeled. Mobile selectors stay labeled. */
125
+ desktopTrigger?: "icon" | "label";
126
+ value: string | null;
127
+ options: AgentSelectOption[];
128
+ }
129
+ export type AgentFeature = AgentFeatureToggle | AgentFeatureSelect;
130
+ export interface AgentCapabilityFlags {
131
+ [capability: string]: boolean | undefined;
132
+ supportsStreaming: boolean;
133
+ supportsSessionPersistence: boolean;
134
+ supportsSessionListing?: boolean;
135
+ supportsDynamicModes: boolean;
136
+ supportsMcpServers: boolean;
137
+ supportsReasoningStream: boolean;
138
+ supportsToolInvocations: boolean;
139
+ supportsRewindConversation?: boolean;
140
+ supportsRewindFiles?: boolean;
141
+ supportsRewindBoth?: boolean;
142
+ }
143
+ export interface AgentPersistenceHandle {
144
+ provider: AgentProvider;
145
+ sessionId: string;
146
+ /** Provider specific handle (Codex thread id, Claude resume token, etc). */
147
+ nativeHandle?: string;
148
+ metadata?: AgentMetadata;
149
+ }
150
+ export type AgentPromptContentBlock = {
151
+ type: "text";
152
+ text: string;
153
+ } | {
154
+ type: "image";
155
+ data: string;
156
+ mimeType: string;
157
+ } | AgentAttachment;
158
+ export type AgentPromptInput = string | AgentPromptContentBlock[];
159
+ export interface AgentRunOptions {
160
+ outputSchema?: unknown;
161
+ resumeFrom?: AgentPersistenceHandle;
162
+ maxThinkingTokens?: number;
163
+ }
164
+ export interface AgentUsage {
165
+ inputTokens?: number;
166
+ cachedInputTokens?: number;
167
+ outputTokens?: number;
168
+ totalCostUsd?: number;
169
+ contextWindowMaxTokens?: number;
170
+ contextWindowUsedTokens?: number;
171
+ }
172
+ export declare const TOOL_CALL_ICON_NAMES: readonly ["wrench", "square_terminal", "eye", "pencil", "search", "bot", "sparkles", "brain", "mic_vocal"];
173
+ export type ToolCallIconName = (typeof TOOL_CALL_ICON_NAMES)[number];
174
+ export type ToolCallDetail = {
175
+ type: "shell";
176
+ command: string;
177
+ cwd?: string;
178
+ output?: string;
179
+ exitCode?: number | null;
180
+ backgroundTaskId?: string;
181
+ background?: boolean;
182
+ } | {
183
+ type: "read";
184
+ filePath: string;
185
+ content?: string;
186
+ offset?: number;
187
+ limit?: number;
188
+ } | {
189
+ type: "edit";
190
+ filePath: string;
191
+ oldString?: string;
192
+ newString?: string;
193
+ unifiedDiff?: string;
194
+ } | {
195
+ type: "write";
196
+ filePath: string;
197
+ content?: string;
198
+ } | {
199
+ type: "search";
200
+ query: string;
201
+ toolName?: "search" | "grep" | "glob" | "web_search";
202
+ content?: string;
203
+ filePaths?: string[];
204
+ webResults?: Array<{
205
+ title: string;
206
+ url: string;
207
+ }>;
208
+ annotations?: string[];
209
+ numFiles?: number;
210
+ numMatches?: number;
211
+ durationMs?: number;
212
+ durationSeconds?: number;
213
+ truncated?: boolean;
214
+ mode?: "content" | "files_with_matches" | "count";
215
+ } | {
216
+ type: "fetch";
217
+ url: string;
218
+ prompt?: string;
219
+ result?: string;
220
+ code?: number;
221
+ codeText?: string;
222
+ bytes?: number;
223
+ durationMs?: number;
224
+ } | {
225
+ type: "worktree_setup";
226
+ worktreePath: string;
227
+ branchName: string;
228
+ log: string;
229
+ commands: Array<{
230
+ index: number;
231
+ command: string;
232
+ cwd: string;
233
+ log: string;
234
+ status: "running" | "completed" | "failed";
235
+ exitCode: number | null;
236
+ durationMs?: number;
237
+ }>;
238
+ truncated?: boolean;
239
+ } | {
240
+ type: "sub_agent";
241
+ subAgentType?: string;
242
+ description?: string;
243
+ childSessionId?: string;
244
+ log: string;
245
+ actions?: Array<{
246
+ index: number;
247
+ toolName: string;
248
+ summary?: string;
249
+ }>;
250
+ } | {
251
+ type: "plain_text";
252
+ label?: string;
253
+ text?: string;
254
+ icon?: ToolCallIconName;
255
+ } | {
256
+ type: "plan";
257
+ text: string;
258
+ } | {
259
+ type: "unknown";
260
+ input: unknown;
261
+ output: unknown;
262
+ };
263
+ interface ToolCallBase {
264
+ agentMessage?: AgentMessage;
265
+ [key: string]: unknown;
266
+ type: "tool_call";
267
+ callId: string;
268
+ name: string;
269
+ detail: ToolCallDetail;
270
+ metadata?: Record<string, unknown>;
271
+ }
272
+ type ToolCallRunningTimelineItem = ToolCallBase & {
273
+ status: "running";
274
+ error: null;
275
+ };
276
+ type ToolCallCompletedTimelineItem = ToolCallBase & {
277
+ status: "completed";
278
+ error: null;
279
+ };
280
+ type ToolCallFailedTimelineItem = ToolCallBase & {
281
+ status: "failed";
282
+ error: unknown;
283
+ };
284
+ type ToolCallCanceledTimelineItem = ToolCallBase & {
285
+ status: "canceled";
286
+ error: null;
287
+ };
288
+ export type ToolCallTimelineItem = ToolCallRunningTimelineItem | ToolCallCompletedTimelineItem | ToolCallFailedTimelineItem | ToolCallCanceledTimelineItem;
289
+ export interface CompactionTimelineItem {
290
+ [key: string]: unknown;
291
+ type: "compaction";
292
+ status: "loading" | "completed";
293
+ trigger?: "auto" | "manual";
294
+ preTokens?: number;
295
+ }
296
+ export interface PluginTimelineItem {
297
+ type: "plugin";
298
+ id: string;
299
+ pluginId: string;
300
+ kind: string;
301
+ version: number;
302
+ data: JsonValue;
303
+ }
304
+ export interface AgentTaskItem {
305
+ text: string;
306
+ completed: boolean;
307
+ id?: string;
308
+ status?: "pending" | "in_progress" | "completed";
309
+ activeForm?: string;
310
+ }
311
+ export type AgentTimelineItem = {
312
+ type: "user_message";
313
+ text: string;
314
+ messageId?: string;
315
+ clientMessageId?: string;
316
+ } | {
317
+ type: "assistant_message";
318
+ text: string;
319
+ messageId?: string;
320
+ } | {
321
+ type: "reasoning";
322
+ text: string;
323
+ } | ToolCallTimelineItem | {
324
+ type: "todo";
325
+ items: AgentTaskItem[];
326
+ } | {
327
+ type: "error";
328
+ message: string;
329
+ } | {
330
+ type: "notification";
331
+ level: "info" | "warning" | "error";
332
+ message: string;
333
+ } | CompactionTimelineItem | PluginTimelineItem;
334
+ export type AgentStreamEvent = {
335
+ type: "thread_started";
336
+ sessionId: string;
337
+ provider: AgentProvider;
338
+ } | {
339
+ type: "turn_started";
340
+ provider: AgentProvider;
341
+ turnId?: string;
342
+ } | {
343
+ type: "turn_completed";
344
+ provider: AgentProvider;
345
+ usage?: AgentUsage;
346
+ turnId?: string;
347
+ } | {
348
+ type: "usage_updated";
349
+ provider: AgentProvider;
350
+ usage: AgentUsage;
351
+ turnId?: string;
352
+ } | {
353
+ type: "mode_changed";
354
+ provider: AgentProvider;
355
+ currentModeId: string | null;
356
+ availableModes: AgentMode[];
357
+ } | {
358
+ type: "model_changed";
359
+ provider: AgentProvider;
360
+ runtimeInfo: AgentRuntimeInfo;
361
+ } | {
362
+ type: "thinking_option_changed";
363
+ provider: AgentProvider;
364
+ thinkingOptionId: string | null;
365
+ } | {
366
+ type: "turn_failed";
367
+ provider: AgentProvider;
368
+ error: string;
369
+ code?: string;
370
+ diagnostic?: string;
371
+ turnId?: string;
372
+ } | {
373
+ type: "turn_canceled";
374
+ provider: AgentProvider;
375
+ reason: string;
376
+ turnId?: string;
377
+ } | {
378
+ type: "timeline";
379
+ item: AgentTimelineItem;
380
+ provider: AgentProvider;
381
+ turnId?: string;
382
+ timestamp?: string;
383
+ } | {
384
+ type: "permission_requested";
385
+ provider: AgentProvider;
386
+ request: AgentPermissionRequest;
387
+ turnId?: string;
388
+ } | {
389
+ type: "permission_resolved";
390
+ provider: AgentProvider;
391
+ requestId: string;
392
+ resolution: AgentPermissionResponse;
393
+ turnId?: string;
394
+ } | {
395
+ type: "attention_required";
396
+ provider: AgentProvider;
397
+ reason: "finished" | "error" | "permission";
398
+ timestamp: string;
399
+ };
400
+ export declare function getAgentStreamEventTurnId(event: AgentStreamEvent): string | undefined;
401
+ export type AgentPermissionRequestKind = "tool" | "plan" | "question" | "mode" | "other";
402
+ export type AgentPermissionUpdate = AgentMetadata;
403
+ export interface AgentPermissionAction {
404
+ id: string;
405
+ label: string;
406
+ behavior: "allow" | "deny";
407
+ variant?: "primary" | "secondary" | "danger";
408
+ intent?: "implement" | "implement_resume" | "dismiss";
409
+ }
410
+ export interface AgentPermissionRequest {
411
+ id: string;
412
+ provider: AgentProvider;
413
+ name: string;
414
+ kind: AgentPermissionRequestKind;
415
+ title?: string;
416
+ description?: string;
417
+ input?: AgentMetadata;
418
+ detail?: ToolCallDetail;
419
+ suggestions?: AgentPermissionUpdate[];
420
+ actions?: AgentPermissionAction[];
421
+ metadata?: AgentMetadata;
422
+ }
423
+ export type AgentPermissionResponse = {
424
+ behavior: "allow";
425
+ selectedActionId?: string;
426
+ updatedInput?: AgentMetadata;
427
+ updatedPermissions?: AgentPermissionUpdate[];
428
+ } | {
429
+ behavior: "deny";
430
+ selectedActionId?: string;
431
+ message?: string;
432
+ interrupt?: boolean;
433
+ };
434
+ export interface AgentRunResult {
435
+ sessionId: string;
436
+ finalText: string;
437
+ usage?: AgentUsage;
438
+ timeline: AgentTimelineItem[];
439
+ canceled?: boolean;
440
+ }
441
+ export type JsonValue = null | boolean | number | string | JsonValue[] | {
442
+ [key: string]: JsonValue;
443
+ };
444
+ export type ProviderOptions = Record<string, unknown>;
445
+ export interface McpToolRef {
446
+ kind: "mcp";
447
+ server: string;
448
+ tool: string;
449
+ }
450
+ export interface ToolPolicy {
451
+ preapproved: McpToolRef[];
452
+ }
453
+ export interface AgentSessionConfig {
454
+ provider: AgentProvider;
455
+ cwd: string;
456
+ /**
457
+ * Provider-agnostic system/developer instruction string.
458
+ * Mapped by each provider to its native instruction field.
459
+ */
460
+ systemPrompt?: string;
461
+ modeId?: string;
462
+ model?: string;
463
+ thinkingOptionId?: string;
464
+ featureValues?: Record<string, unknown>;
465
+ title?: string | null;
466
+ providerOptions?: ProviderOptions;
467
+ toolPolicy?: ToolPolicy;
468
+ mcpServers?: Record<string, McpServerConfig>;
469
+ /**
470
+ * Internal agents are hidden from listings and don't trigger notifications.
471
+ * They are used for ephemeral system tasks like commit/PR generation.
472
+ */
473
+ internal?: boolean;
474
+ }
475
+ export interface AgentRuntimeInfo {
476
+ provider: AgentProvider;
477
+ sessionId: string | null;
478
+ model?: string | null;
479
+ thinkingOptionId?: string | null;
480
+ modeId?: string | null;
481
+ extra?: AgentMetadata;
482
+ }
483
+ export {};
484
+ //# sourceMappingURL=agent-types.d.ts.map
@@ -0,0 +1,33 @@
1
+ export function normalizeAgentModelDefinition(model) {
2
+ const defaultThinkingOptionId = model.defaultThinkingOptionId ?? model.thinkingOptions?.find((option) => option.isDefault)?.id;
3
+ if (!defaultThinkingOptionId || defaultThinkingOptionId === model.defaultThinkingOptionId) {
4
+ return model;
5
+ }
6
+ return { ...model, defaultThinkingOptionId };
7
+ }
8
+ /** A provider addresses models by ID; repeated rows retain the first definition. */
9
+ export function normalizeAgentModelCatalog(models) {
10
+ const ids = new Set();
11
+ const unique = models.filter((model) => {
12
+ if (ids.has(model.id))
13
+ return false;
14
+ ids.add(model.id);
15
+ return true;
16
+ });
17
+ return unique.length === models.length ? models : unique;
18
+ }
19
+ export const TOOL_CALL_ICON_NAMES = [
20
+ "wrench",
21
+ "square_terminal",
22
+ "eye",
23
+ "pencil",
24
+ "search",
25
+ "bot",
26
+ "sparkles",
27
+ "brain",
28
+ "mic_vocal",
29
+ ];
30
+ export function getAgentStreamEventTurnId(event) {
31
+ return "turnId" in event ? event.turnId : undefined;
32
+ }
33
+ //# sourceMappingURL=agent-types.js.map
@@ -0,0 +1,15 @@
1
+ import { type HostRouteFrame } from "./host-route.js";
2
+ import { type FileTransferFrame } from "./file-transfer.js";
3
+ import { type TerminalStreamFrame } from "./terminal.js";
4
+ export type BinaryFrame = {
5
+ kind: "host_route";
6
+ frame: HostRouteFrame;
7
+ } | {
8
+ kind: "terminal";
9
+ frame: TerminalStreamFrame;
10
+ } | {
11
+ kind: "file_transfer";
12
+ frame: FileTransferFrame;
13
+ };
14
+ export declare function decodeBinaryFrame(bytes: Uint8Array): BinaryFrame | null;
15
+ //# sourceMappingURL=demux.d.ts.map