@letta-ai/letta-agent-sdk 0.3.3 → 0.5.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 (56) hide show
  1. package/AGENTS.md +0 -3
  2. package/README.md +8 -1
  3. package/dist/app-server-management.d.ts +3 -48
  4. package/dist/app-server-management.d.ts.map +1 -1
  5. package/dist/app-server-session.d.ts +0 -6
  6. package/dist/app-server-session.d.ts.map +1 -1
  7. package/dist/client-base.d.ts +7 -15
  8. package/dist/client-base.d.ts.map +1 -1
  9. package/dist/client-entry.js +428 -486
  10. package/dist/client-entry.js.map +13 -12
  11. package/dist/client.d.ts +3 -3
  12. package/dist/client.d.ts.map +1 -1
  13. package/dist/cloud-session.d.ts +2 -0
  14. package/dist/cloud-session.d.ts.map +1 -1
  15. package/dist/cloud-status-transport.d.ts +53 -0
  16. package/dist/cloud-status-transport.d.ts.map +1 -0
  17. package/dist/index.d.ts +7 -16
  18. package/dist/index.d.ts.map +1 -1
  19. package/dist/index.js +911 -1993
  20. package/dist/index.js.map +18 -18
  21. package/dist/local-app-server-session.d.ts +1 -1
  22. package/dist/local-app-server-session.d.ts.map +1 -1
  23. package/dist/local-app-server.d.ts +11 -0
  24. package/dist/local-app-server.d.ts.map +1 -1
  25. package/dist/management.d.ts +0 -7
  26. package/dist/management.d.ts.map +1 -1
  27. package/dist/remote-session-protocol.d.ts +2 -0
  28. package/dist/remote-session-protocol.d.ts.map +1 -1
  29. package/dist/remote-turn-coordinator.d.ts.map +1 -1
  30. package/dist/types.d.ts +65 -66
  31. package/dist/types.d.ts.map +1 -1
  32. package/dist/validation.d.ts.map +1 -1
  33. package/package.json +2 -2
  34. package/src/app-server-management.ts +20 -256
  35. package/src/app-server-session.ts +0 -32
  36. package/src/client-base.ts +47 -73
  37. package/src/client.ts +31 -70
  38. package/src/cloud-session.ts +113 -287
  39. package/src/cloud-status-transport.ts +305 -0
  40. package/src/index.ts +11 -29
  41. package/src/local-app-server-session.ts +13 -3
  42. package/src/local-app-server.ts +97 -3
  43. package/src/management.ts +0 -7
  44. package/src/remote-session-protocol.ts +18 -0
  45. package/src/remote-turn-coordinator.ts +20 -2
  46. package/src/types.ts +72 -111
  47. package/src/validation.ts +21 -6
  48. package/dist/protocol.d.ts +0 -205
  49. package/dist/protocol.d.ts.map +0 -1
  50. package/dist/session.d.ts +0 -155
  51. package/dist/session.d.ts.map +0 -1
  52. package/dist/transport.d.ts +0 -53
  53. package/dist/transport.d.ts.map +0 -1
  54. package/src/protocol.ts +0 -249
  55. package/src/session.ts +0 -1638
  56. package/src/transport.ts +0 -484
package/src/types.ts CHANGED
@@ -5,27 +5,6 @@
5
5
  * Protocol types are defined locally to avoid relying on broken package subpath exports.
6
6
  */
7
7
 
8
- // Re-export protocol types for internal use
9
- export type {
10
- WireMessage,
11
- SystemInitMessage,
12
- MessageWire,
13
- ResultMessage,
14
- ErrorMessage,
15
- StreamEvent,
16
- ControlRequest,
17
- ControlResponse,
18
- CanUseToolControlRequest,
19
- CanUseToolResponse,
20
- CanUseToolResponseAllow,
21
- CanUseToolResponseDeny,
22
- // Configuration types
23
- SystemPromptPresetConfig,
24
- CreateBlock,
25
- } from "./protocol.js";
26
-
27
- // Import types for use in this file
28
- import type { CreateBlock, CanUseToolResponse } from "./protocol.js";
29
8
  import type { PersonalityId } from "@letta-ai/letta-code/agent-presets";
30
9
  import type { LettaCodeCloudSandboxOptions } from "./cloud-sandbox.js";
31
10
  export type {
@@ -36,6 +15,26 @@ export type {
36
15
  /** Letta Code personality preset used to seed a new agent. */
37
16
  export type LettaCodePersonalityId = PersonalityId;
38
17
 
18
+ /** Custom memory block definition accepted when creating agents. */
19
+ export interface CreateBlock {
20
+ label: string;
21
+ value: string;
22
+ base_template_id?: string | null;
23
+ deployment_id?: string | null;
24
+ description?: string | null;
25
+ entity_id?: string | null;
26
+ hidden?: boolean | null;
27
+ is_template?: boolean;
28
+ limit?: number;
29
+ metadata?: Record<string, unknown> | null;
30
+ preserve_on_migration?: boolean | null;
31
+ project_id?: string | null;
32
+ read_only?: boolean;
33
+ tags?: string[] | null;
34
+ template_id?: string | null;
35
+ template_name?: string | null;
36
+ }
37
+
39
38
  export interface LettaCodeSocketLike {
40
39
  readyState: number;
41
40
  send(data: string): void;
@@ -152,6 +151,9 @@ export interface DreamingOptions {
152
151
  stepCount?: number;
153
152
  }
154
153
 
154
+ /** Dreaming settings that can be changed when opening an existing agent session. */
155
+ export type SessionDreamingOptions = Omit<DreamingOptions, "behavior">;
156
+
155
157
  /**
156
158
  * Fully-resolved dreaming settings emitted by init messages.
157
159
  */
@@ -319,8 +321,6 @@ export interface LettaCodeLocalAppServerOptions {
319
321
  WebSocket?: LettaCodeSocketConstructor;
320
322
  /** Timeout for websocket protocol request/turn correlation. */
321
323
  requestTimeoutMs?: number;
322
- /** Milliseconds an idle management connection may be reused before release. Defaults to 250. */
323
- idleLingerMs?: number;
324
324
  /** Whether agents created through this app-server are added to Letta Code's global pinned-agent list. */
325
325
  pinGlobalAgent?: boolean;
326
326
  /** Local app-server listen URL when the SDK spawns it. Defaults to ws://127.0.0.1:0. */
@@ -331,9 +331,7 @@ export interface LettaCodeLocalAppServerOptions {
331
331
 
332
332
  export interface LettaCodeLocalClientOptions {
333
333
  backend?: "local";
334
- /** Advanced local transport override. Defaults to app-server. */
335
- transport?: "app-server" | "stdio";
336
- /** Advanced app-server overrides for local transport. */
334
+ /** Advanced app-server overrides for local execution. */
337
335
  appServer?: LettaCodeLocalAppServerOptions;
338
336
  }
339
337
 
@@ -347,8 +345,6 @@ export interface LettaCodeRemoteClientOptions {
347
345
  WebSocket?: LettaCodeSocketConstructor;
348
346
  /** Timeout for websocket protocol request/turn correlation. */
349
347
  requestTimeoutMs?: number;
350
- /** Milliseconds an idle management connection may be reused before release. Defaults to 250. */
351
- idleLingerMs?: number;
352
348
  /** Whether agents created through this app-server are added to Letta Code's global pinned-agent list. */
353
349
  pinGlobalAgent?: boolean;
354
350
  }
@@ -412,6 +408,12 @@ export interface ListRepositoriesResult {
412
408
  export interface RepositoryResource {
413
409
  type: "repository";
414
410
  repositoryId: string;
411
+ /**
412
+ * Whether to trigger a system-prompt recompile after attaching (and after
413
+ * detaching on cleanup) so the session's conversation does not retain
414
+ * stale repository projections. Defaults to `true`.
415
+ */
416
+ recompile?: boolean;
415
417
  }
416
418
 
417
419
  export interface RepositoryFileEntry {
@@ -496,6 +498,23 @@ export interface CanUseToolPermissionSuggestion {
496
498
  text: string;
497
499
  }
498
500
 
501
+ export interface CanUseToolResponseAllow {
502
+ behavior: "allow";
503
+ message?: string;
504
+ updatedInput?: Record<string, unknown> | null;
505
+ updatedPermissions?: unknown[];
506
+ }
507
+
508
+ export interface CanUseToolResponseDeny {
509
+ behavior: "deny";
510
+ message: string;
511
+ interrupt?: boolean;
512
+ }
513
+
514
+ export type CanUseToolResponse =
515
+ | CanUseToolResponseAllow
516
+ | CanUseToolResponseDeny;
517
+
499
518
  /**
500
519
  * Additional context for a `can_use_tool` approval request, passed as the
501
520
  * optional third argument to {@link CanUseToolCallback}.
@@ -532,69 +551,6 @@ export type CanUseToolCallback = (
532
551
  context?: CanUseToolContext,
533
552
  ) => Promise<CanUseToolResponse> | CanUseToolResponse;
534
553
 
535
- /**
536
- * Internal session options used by Session/Transport classes.
537
- * Not user-facing - use CreateSessionOptions or CreateAgentOptions instead.
538
- * @internal
539
- */
540
- export interface InternalSessionOptions {
541
- // Agent/conversation routing
542
- agentId?: string;
543
- conversationId?: string;
544
- newConversation?: boolean;
545
- defaultConversation?: boolean;
546
- createOnly?: boolean;
547
-
548
- // Agent configuration
549
- model?: string;
550
- reasoningEffort?: ReasoningEffort;
551
- embedding?: string;
552
- systemPrompt?: SystemPromptConfig;
553
-
554
- // Memory blocks (only for new agents)
555
- memory?: MemoryItem[];
556
- persona?: string; // Convenience for persona block
557
- human?: string; // Convenience for human block
558
-
559
- // Tags (only for new agents)
560
- tags?: string[];
561
-
562
- // Skills/reminders
563
- skillSources?: SkillSource[];
564
- systemInfoReminder?: boolean;
565
- dreaming?: DreamingOptions;
566
-
567
- // Permissions
568
- allowedTools?: string[];
569
- disallowedTools?: string[];
570
- permissionMode?: PermissionMode;
571
- canUseTool?: CanUseToolCallback;
572
-
573
- // Server-side tools (only for new agents); omitted -> harness defaults.
574
- baseTools?: string[];
575
-
576
- // Custom tools
577
- tools?: AnyAgentTool[];
578
-
579
- // Process settings
580
- cwd?: string;
581
-
582
- /** If true, pass --include-partial-messages to CLI for token-level stream_event chunks */
583
- includePartialMessages?: boolean;
584
-
585
- /**
586
- * Max automatic approval-conflict recovery attempts per runTurn() call.
587
- * Set to 0 to disable automatic recovery.
588
- */
589
- maxApprovalRecoveryAttempts?: number;
590
-
591
- /**
592
- * Timeout in milliseconds for a single approval recovery request.
593
- */
594
- approvalRecoveryTimeoutMs?: number;
595
-
596
- }
597
-
598
554
  export type PermissionMode =
599
555
  | "standard"
600
556
  | "acceptEdits"
@@ -662,7 +618,8 @@ export interface SendCommandOptions<TResponseType extends string = string> {
662
618
  }
663
619
 
664
620
  /**
665
- * Options for createSession() and resumeSession() - restricted to options that can be applied to existing agents (LRU/Memo).
621
+ * Options for createSession() and resumeSession() restricted to settings that
622
+ * can be applied to existing agents.
666
623
  * For creating new agents with custom memory/persona, use createAgent().
667
624
  */
668
625
  export interface CreateSessionOptions {
@@ -672,9 +629,6 @@ export interface CreateSessionOptions {
672
629
  /** Reasoning effort tier to use with the selected/current model on websocket protocol sessions. */
673
630
  reasoningEffort?: ReasoningEffort;
674
631
 
675
- /** System prompt preset (only presets, no custom strings or append) - updates the agent */
676
- systemPrompt?: SystemPromptPreset;
677
-
678
632
  /**
679
633
  * Exact client-side tool allowlist for the session, including custom SDK
680
634
  * tools. When omitted, the harness default toolset and registered custom
@@ -683,9 +637,6 @@ export interface CreateSessionOptions {
683
637
  */
684
638
  allowedTools?: string[];
685
639
 
686
- /** List of disallowed tool names */
687
- disallowedTools?: string[];
688
-
689
640
  /** Permission mode */
690
641
  permissionMode?: PermissionMode;
691
642
 
@@ -698,16 +649,10 @@ export interface CreateSessionOptions {
698
649
  */
699
650
  skillSources?: SkillSource[];
700
651
 
701
- /**
702
- * Toggle first-turn system info reminder (device/git/cwd context).
703
- * false -> `--no-system-info-reminder`.
704
- */
705
- systemInfoReminder?: boolean;
706
-
707
652
  /**
708
653
  * Configure dreaming settings.
709
654
  */
710
- dreaming?: DreamingOptions;
655
+ dreaming?: SessionDreamingOptions;
711
656
 
712
657
  /** Custom permission callback - called when tool needs approval */
713
658
  canUseTool?: CanUseToolCallback;
@@ -718,12 +663,6 @@ export interface CreateSessionOptions {
718
663
  */
719
664
  tools?: AnyAgentTool[];
720
665
 
721
- /**
722
- * If true, pass --include-partial-messages to CLI to receive token-level
723
- * stream_event chunks for incremental assistant/reasoning rendering.
724
- */
725
- includePartialMessages?: boolean;
726
-
727
666
  /**
728
667
  * Max automatic approval-conflict recovery attempts per runTurn() call.
729
668
  * Set to 0 to disable automatic recovery.
@@ -758,6 +697,14 @@ export interface LettaCodeClientSessionOptions extends CreateSessionOptions {
758
697
  * memory copy. Ignored on remote and cloud transports.
759
698
  */
760
699
  env?: Record<string, string>;
700
+ /**
701
+ * Constrain an SDK-owned local session harness to memory-worker filesystem
702
+ * access. Agent-ID sessions derive the standard root; set `MEMORY_DIR` or
703
+ * `LETTA_MEMORY_DIR` for overrides and conversation-ID resumes. Fails closed
704
+ * without a root or supported kernel sandbox. Excludes agent creation,
705
+ * management calls, and remote/Cloud runtimes.
706
+ */
707
+ filesystemConfinement?: "memory";
761
708
  }
762
709
 
763
710
  export interface LettaCodeSession extends AsyncDisposable {
@@ -904,6 +851,8 @@ export interface SessionDeviceStatus {
904
851
  permissionMode: PermissionMode;
905
852
  /** Working directory currently applied to this runtime scope. */
906
853
  workingDirectory: string | null;
854
+ /** Agent memory checkout on the computer executing this session. */
855
+ memoryDirectory: string | null;
907
856
  /** Approvals the device is still waiting on (foreground-resume UI). */
908
857
  pendingControlRequests: SessionPendingControlRequest[];
909
858
  /** Full wire `device_status` payload as an escape hatch. */
@@ -1044,7 +993,12 @@ export interface SDKInitMessage {
1044
993
  export interface SDKAssistantMessage {
1045
994
  type: "assistant";
1046
995
  content: string;
996
+ /** Top-level message ID when provided by the stream; otherwise an SDK-generated identifier. */
1047
997
  uuid: string;
998
+ /** Stable lineage key for this typed message slice, when provided. */
999
+ otid?: string | null;
1000
+ /** Per-run replay cursor. Compare only within the same `runId`. */
1001
+ seqId?: number;
1048
1002
  /** Run ID from the Letta API for this event (used for stale-run detection). */
1049
1003
  runId?: string;
1050
1004
  }
@@ -1074,7 +1028,12 @@ export interface SDKToolResultMessage {
1074
1028
  export interface SDKReasoningMessage {
1075
1029
  type: "reasoning";
1076
1030
  content: string;
1031
+ /** Top-level message ID when provided by the stream; otherwise an SDK-generated identifier. */
1077
1032
  uuid: string;
1033
+ /** Stable lineage key for this typed message slice, when provided. */
1034
+ otid?: string | null;
1035
+ /** Per-run replay cursor. Compare only within the same `runId`. */
1036
+ seqId?: number;
1078
1037
  /** Run ID from the Letta API for this event (used for stale-run detection). */
1079
1038
  runId?: string;
1080
1039
  }
@@ -1126,6 +1085,8 @@ export interface SDKStreamEventMessagePayload {
1126
1085
  message_type: string;
1127
1086
  id?: string;
1128
1087
  otid?: string | null;
1088
+ seq_id?: number;
1089
+ run_id?: string;
1129
1090
  content?: unknown;
1130
1091
  reasoning?: string;
1131
1092
  name?: string;
package/src/validation.ts CHANGED
@@ -66,7 +66,27 @@ function validateApprovalRecoveryOptions(options: CreateSessionOptions): void {
66
66
  }
67
67
 
68
68
  function validateRemovedSessionOptions(options: CreateSessionOptions): void {
69
- if ((options as { memfsStartup?: unknown }).memfsStartup !== undefined) {
69
+ const removedOptions = options as CreateSessionOptions & Record<string, unknown>;
70
+ if (removedOptions.systemPrompt !== undefined) {
71
+ throw new Error("systemPrompt is not supported when opening an existing agent session.");
72
+ }
73
+ if (removedOptions.disallowedTools !== undefined) {
74
+ throw new Error("disallowedTools is not supported when opening an existing agent session.");
75
+ }
76
+ if (removedOptions.systemInfoReminder !== undefined) {
77
+ throw new Error("systemInfoReminder is not supported when opening an existing agent session.");
78
+ }
79
+ if (removedOptions.includePartialMessages !== undefined) {
80
+ throw new Error("includePartialMessages is not supported by app-server sessions.");
81
+ }
82
+ if (
83
+ options.dreaming &&
84
+ "behavior" in options.dreaming &&
85
+ options.dreaming.behavior !== undefined
86
+ ) {
87
+ throw new Error("dreaming.behavior is not supported when opening an existing agent session.");
88
+ }
89
+ if (removedOptions.memfsStartup !== undefined) {
70
90
  throw new Error(
71
91
  "memfsStartup is not supported by the SDK.",
72
92
  );
@@ -157,11 +177,6 @@ function validateReasoningEffort(value: unknown): void {
157
177
  * Validate CreateSessionOptions (used by createSession and resumeSession).
158
178
  */
159
179
  export function validateCreateSessionOptions(options: CreateSessionOptions): void {
160
- // Validate systemPrompt preset if provided
161
- if (options.systemPrompt !== undefined) {
162
- validateSystemPromptPreset(options.systemPrompt);
163
- }
164
-
165
180
  validateSkillSources(options.skillSources);
166
181
  validateReasoningEffort(options.reasoningEffort);
167
182
  validateDreamingOptions(options.dreaming);
@@ -1,205 +0,0 @@
1
- /**
2
- * Local protocol type surface consumed by the SDK.
3
- *
4
- * @letta-ai/letta-code@0.27.11 publishes these declarations under an internal
5
- * dist path while its package.json points the public `./protocol` export at a
6
- * missing file. Keep the SDK's public types self-contained so CI and consumers
7
- * do not depend on that broken subpath export.
8
- */
9
- export interface MessageEnvelope {
10
- type: string;
11
- session_id?: string;
12
- uuid?: string;
13
- timestamp?: string;
14
- event_seq?: number;
15
- agent_id?: string;
16
- conversation_id?: string;
17
- [key: string]: unknown;
18
- }
19
- /**
20
- * System prompt preset configuration used by the CLI protocol.
21
- */
22
- export interface SystemPromptPresetConfig {
23
- type: "preset";
24
- preset: string;
25
- append?: string;
26
- }
27
- /**
28
- * Custom memory block definition accepted when creating agents.
29
- */
30
- export interface CreateBlock {
31
- label: string;
32
- value: string;
33
- base_template_id?: string | null;
34
- deployment_id?: string | null;
35
- description?: string | null;
36
- entity_id?: string | null;
37
- hidden?: boolean | null;
38
- is_template?: boolean;
39
- limit?: number;
40
- metadata?: Record<string, unknown> | null;
41
- preserve_on_migration?: boolean | null;
42
- project_id?: string | null;
43
- read_only?: boolean;
44
- tags?: string[] | null;
45
- template_id?: string | null;
46
- template_name?: string | null;
47
- }
48
- export interface SystemInitMessage extends MessageEnvelope {
49
- type: "system";
50
- subtype: "init";
51
- agent_id: string;
52
- conversation_id: string;
53
- model: string;
54
- tools: string[];
55
- cwd: string;
56
- mcp_servers: Array<{
57
- name: string;
58
- status: string;
59
- }>;
60
- permission_mode: string;
61
- slash_commands: string[];
62
- memfs_enabled?: boolean;
63
- skill_sources?: Array<"bundled" | "global" | "agent" | "project">;
64
- system_info_reminder_enabled?: boolean;
65
- reflection_trigger?: "off" | "step-count" | "compaction-event";
66
- reflection_behavior?: "reminder" | "auto-launch";
67
- reflection_step_count?: number;
68
- }
69
- export interface MessageWire extends MessageEnvelope {
70
- type: "message";
71
- message_type?: string;
72
- run_id?: string;
73
- }
74
- export interface StreamEvent extends MessageEnvelope {
75
- type: "stream_event";
76
- event: unknown;
77
- }
78
- export type ResultSubtype = "success" | "interrupted" | "error" | string;
79
- export interface ResultMessage extends MessageEnvelope {
80
- type: "result";
81
- subtype: ResultSubtype;
82
- agent_id?: string;
83
- conversation_id: string;
84
- duration_ms: number;
85
- duration_api_ms?: number;
86
- num_turns?: number;
87
- result?: string | null;
88
- run_ids?: string[];
89
- usage?: unknown;
90
- stop_reason?: string;
91
- }
92
- export interface ErrorMessage extends MessageEnvelope {
93
- type: "error";
94
- message: string;
95
- stop_reason: string;
96
- run_id?: string;
97
- api_error?: Record<string, unknown>;
98
- }
99
- export interface CanUseToolControlRequest {
100
- subtype: "can_use_tool";
101
- tool_name: string;
102
- input: Record<string, unknown>;
103
- tool_call_id: string;
104
- permission_suggestions?: unknown[];
105
- blocked_path?: string | null;
106
- diffs?: unknown[];
107
- }
108
- export interface RegisterExternalToolsRequest {
109
- subtype: "register_external_tools";
110
- tools: Array<{
111
- name: string;
112
- label?: string;
113
- description: string;
114
- parameters: Record<string, unknown>;
115
- }>;
116
- }
117
- export interface BootstrapSessionStateRequest {
118
- subtype: "bootstrap_session_state";
119
- limit?: number;
120
- order?: "asc" | "desc";
121
- }
122
- export interface RecoverPendingApprovalsControlRequest {
123
- subtype: "recover_pending_approvals";
124
- agent_id?: string;
125
- conversation_id?: string;
126
- }
127
- export interface ListMessagesControlRequest {
128
- subtype: "list_messages";
129
- conversation_id?: string;
130
- agent_id?: string;
131
- before?: string;
132
- after?: string;
133
- order?: "asc" | "desc";
134
- limit?: number;
135
- }
136
- export interface InterruptControlRequest {
137
- subtype: "interrupt";
138
- }
139
- export interface InitializeControlRequest {
140
- subtype: "initialize";
141
- }
142
- export interface ExecuteExternalToolControlRequest {
143
- subtype: "execute_external_tool";
144
- tool_call_id: string;
145
- tool_name: string;
146
- input: Record<string, unknown>;
147
- }
148
- export type ControlRequestBody = InitializeControlRequest | InterruptControlRequest | RegisterExternalToolsRequest | BootstrapSessionStateRequest | RecoverPendingApprovalsControlRequest | ListMessagesControlRequest | CanUseToolControlRequest | ExecuteExternalToolControlRequest | (Record<string, unknown> & {
149
- subtype: string;
150
- });
151
- export interface ControlRequest extends MessageEnvelope {
152
- type: "control_request";
153
- request_id: string;
154
- request: ControlRequestBody;
155
- }
156
- export interface CanUseToolResponseAllow {
157
- behavior: "allow";
158
- message?: string;
159
- updatedInput?: Record<string, unknown> | null;
160
- updatedPermissions?: unknown[];
161
- }
162
- export interface CanUseToolResponseDeny {
163
- behavior: "deny";
164
- message: string;
165
- interrupt?: boolean;
166
- }
167
- export type CanUseToolResponse = CanUseToolResponseAllow | CanUseToolResponseDeny;
168
- export interface ExternalToolResultContent {
169
- type: "text" | "image";
170
- text?: string;
171
- data?: string;
172
- mimeType?: string;
173
- }
174
- export interface ExternalToolResultResponse {
175
- subtype: "external_tool_result";
176
- request_id: string;
177
- tool_call_id: string;
178
- content: ExternalToolResultContent[];
179
- is_error: boolean;
180
- }
181
- export type ControlResponseBody = {
182
- subtype: "success";
183
- request_id: string;
184
- response?: CanUseToolResponse | Record<string, unknown>;
185
- } | {
186
- subtype: "error";
187
- request_id: string;
188
- error: string;
189
- } | ExternalToolResultResponse;
190
- export interface ControlResponse extends MessageEnvelope {
191
- type: "control_response";
192
- response: ControlResponseBody;
193
- }
194
- export interface RetryMessage extends MessageEnvelope {
195
- type: "retry";
196
- reason: string;
197
- attempt: number;
198
- max_attempts: number;
199
- delay_ms: number;
200
- run_id?: string;
201
- }
202
- export type WireMessage = SystemInitMessage | MessageWire | StreamEvent | ResultMessage | ErrorMessage | RetryMessage | ControlRequest | ControlResponse | (MessageEnvelope & {
203
- type: string;
204
- });
205
- //# sourceMappingURL=protocol.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../src/protocol.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,QAAQ,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,aAAa,CAAC,EAAE,M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