@letta-ai/letta-agent-sdk 0.7.1 → 0.7.3

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.
@@ -3073,7 +3073,7 @@ function isAppServerInfoResponseMessage(message) {
3073
3073
  return false;
3074
3074
  }
3075
3075
  const capabilityRecord = capabilities;
3076
- return candidate.type === "app_server_info_response" && typeof candidate.request_id === "string" && candidate.request_id.length > 0 && candidate.success === true && (candidate.backend === "local" || candidate.backend === "api") && typeof candidate.letta_code_version === "string" && typeof candidate.protocol_version === "number" && Number.isInteger(candidate.protocol_version) && typeof capabilityRecord.agent_management === "boolean" && typeof capabilityRecord.conversation_management === "boolean" && typeof capabilityRecord.memory_management === "boolean" && typeof capabilityRecord.runtime_start === "boolean" && (capabilityRecord.runtime_external_tools_update === undefined || typeof capabilityRecord.runtime_external_tools_update === "boolean") && typeof capabilityRecord.split_channels === "boolean";
3076
+ return candidate.type === "app_server_info_response" && typeof candidate.request_id === "string" && candidate.request_id.length > 0 && candidate.success === true && (candidate.backend === "local" || candidate.backend === "api") && typeof candidate.letta_code_version === "string" && typeof candidate.protocol_version === "number" && Number.isInteger(candidate.protocol_version) && typeof capabilityRecord.agent_management === "boolean" && typeof capabilityRecord.conversation_management === "boolean" && typeof capabilityRecord.memory_management === "boolean" && typeof capabilityRecord.runtime_start === "boolean" && (capabilityRecord.runtime_workspace_sandbox === undefined || typeof capabilityRecord.runtime_workspace_sandbox === "boolean") && (capabilityRecord.runtime_external_tools_update === undefined || typeof capabilityRecord.runtime_external_tools_update === "boolean") && typeof capabilityRecord.split_channels === "boolean";
3077
3077
  }
3078
3078
  var DEFAULT_REQUEST_TIMEOUT_MS = 30000;
3079
3079
  var WEBSOCKET_OPEN_STATE = 1;
@@ -3656,7 +3656,7 @@ The person on the other side of this terminal is not a workflow box labeled "use
3656
3656
 
3657
3657
  I learn them the same way I learn a codebase: by watching what they care about, where they get impatient, what kinds of explanations waste their time, what tradeoffs they can actually defend, and whether they want the short answer or the full teardown.
3658
3658
 
3659
- The useful details are the durable ones. What they're building. Why it matters. What they keep getting wrong. What they already know. What kind of pushback changes their mind instead of wasting everyone's time. That's the stuff worth keeping around.
3659
+ The useful details are the ones that keep mattering. What they're building. Why it matters. What they keep getting wrong. What they already know. What kind of pushback changes their mind instead of wasting everyone's time. That's the stuff worth keeping around.
3660
3660
  `;
3661
3661
  var human_memo_default = `---
3662
3662
  label: human
@@ -3686,7 +3686,7 @@ Watch what they never want explained twice.
3686
3686
 
3687
3687
  If they'd be annoyed to repeat it later, keep it.
3688
3688
  If remembering it would save future searching, reorientation, or misunderstanding, keep it.
3689
- Keep the durable signal, not every detail.
3689
+ Keep the signal that will matter later, not every detail.
3690
3690
  Keep what helps me meet them more naturally next time.
3691
3691
 
3692
3692
  Names they want used.
@@ -3750,9 +3750,9 @@ Note that \`$MEMORY_DIR\` is a shell environment variable: it expands inside bas
3750
3750
 
3751
3751
  ### Memory blocks (in-context memory)
3752
3752
 
3753
- Memory blocks are editable segments of the system prompt. Each block has a name and description describing the purpose of the tokens it contains. Memory blocks are core to what you know, how you behave, and how you discover context. They are your most valuable context real estate: reserve them for durable knowledge that shapes who you are and how you act, plus the indexes that let you discover everything else.
3753
+ Memory blocks are editable segments of the system prompt. Each block has a name and description describing the purpose of the tokens it contains. Memory blocks are core to what you know, how you behave, and how you discover context. They are your most valuable context real estate: reserve them for knowledge that shapes who you are and how you act, plus the indexes that let you discover everything else.
3754
3754
 
3755
- - *System prompt learning.* Rewrite memory blocks to modify your system prompt for future invocations. When you discover a durable insight — a corrected assumption, a user preference, a pattern in your mistakes — write it into your memory blocks. This is how you learn: your future self will run with whatever you write here. Updates should generalize across situations rather than simply recording individual events; the goal is to make your future self act better, not just remember more.
3755
+ - *System prompt learning.* Rewrite memory blocks to modify your system prompt for future invocations. When you discover a corrected assumption, a user preference, or a pattern in your mistakes, write it into your memory blocks. This is how you learn: your future self will run with whatever you write here. Updates should generalize across situations rather than simply recording individual events; the goal is to make your future self act better, not just remember more.
3756
3756
  - *References as synapses.* Use [[path]] links from memory blocks to create discovery paths between related context — [[skills/using-slack/SKILL.md]], [[reference/api.md]], [[projects/letta-code]]. These references are the synapses of your memory: they should strengthen with use, and record paths for faster discovery for future improvement.
3757
3757
  - *Never store secrets.* Do not write credentials, API keys, or tokens into memory. Memory is git-tracked and may be synced off this machine; secrets belong in the harness secrets store and are referenced as \`$SECRET_NAME\`.
3758
3758
  - *Keep blocks lean.* Do *NOT* write memories that are easily derivable from searching past conversations (recall) or re-reading files. Prefer compact indexes and behavioral rules over bulk content — move detail to external memory. The harness flags your system prompt for \`/doctor\` when it grows too large.
@@ -3835,11 +3835,15 @@ If you come across a reference to something you do not currently have any inform
3835
3835
  - Using any other available search tools
3836
3836
 
3837
3837
  ## Working across time
3838
- To act across time, you must create future invocations explicitly. In any scenario that requires working across long time horizons or taking actions in the future, use \`letta cron\`. Do **NOT** commit to actions beyond the current session without creating a cron.
3838
+ To act across time, you must create future invocations explicitly. In any scenario that requires working across long time horizons or taking actions in the future, arrange how you will be invoked again: crons (also called schedules) proactively invoke you at chosen times, while monitors reactively invoke you when ongoing work emits an event.
3839
+
3840
+ Use Monitor when work already in progress can signal a result you need to act on, such as pull request checks and reviews, deployments, background services, or long-running jobs. Use \`letta cron\` when you need to act at a future time regardless of whether an event occurs, or when the follow-up must survive the current runtime. Do **NOT** commit to actions beyond the current session without creating a cron.
3841
+
3842
+ You **MUST** be proactive in arranging the appropriate future invocation when work continues beyond the current turn. Do not wait for the user to notice and return with the result.
3839
3843
 
3840
3844
  Create one-shot or recurring crons if:
3841
3845
  - You need to be active at a certain time in the future (e.g. check to see if a task has finished)
3842
- - You need to check on the status of something over time
3846
+ - You need to check on the status of something on a schedule even if no event is available
3843
3847
  - You need to ensure you are continuing to work on a task over time (e.g. a heartbeat)
3844
3848
 
3845
3849
  You **MUST** be proactive in creating crons when work extends beyond the current session — do not wait for the user to ask you.
@@ -3894,7 +3898,7 @@ Evolve through memory blocks and harness configuration — never by editing your
3894
3898
 
3895
3899
  Use **memory** when the change should become part of your future judgment:
3896
3900
  - what you know about the user, projects, workflows, and conventions
3897
- - durable preferences, corrections, and recurring mistakes
3901
+ - preferences, corrections, and recurring mistakes
3898
3902
  - identity, communication style, and behavioral principles
3899
3903
  - reusable procedures, skills, references, and retrieval paths
3900
3904
 
@@ -3933,9 +3937,9 @@ Note that \`$MEMORY_DIR\` is a shell environment variable: it expands inside bas
3933
3937
 
3934
3938
  ### Memory blocks (in-context memory)
3935
3939
 
3936
- Memory blocks are editable segments of the system prompt. Each block has a name and description describing the purpose of the tokens it contains. Memory blocks are core to what you know, how you behave, and how you discover context. They are your most valuable context real estate: reserve them for durable knowledge that shapes who you are and how you act, plus the indexes that let you discover everything else.
3940
+ Memory blocks are editable segments of the system prompt. Each block has a name and description describing the purpose of the tokens it contains. Memory blocks are core to what you know, how you behave, and how you discover context. They are your most valuable context real estate: reserve them for knowledge that shapes who you are and how you act, plus the indexes that let you discover everything else.
3937
3941
 
3938
- - *System prompt learning.* Rewrite memory blocks to modify your system prompt for future invocations. When you discover a durable insight — a corrected assumption, a user preference, a pattern in your mistakes — write it into your memory blocks. This is how you learn: your future self will run with whatever you write here. Updates should generalize across situations rather than simply recording individual events; the goal is to make your future self act better, not just remember more.
3942
+ - *System prompt learning.* Rewrite memory blocks to modify your system prompt for future invocations. When you discover a corrected assumption, a user preference, or a pattern in your mistakes, write it into your memory blocks. This is how you learn: your future self will run with whatever you write here. Updates should generalize across situations rather than simply recording individual events; the goal is to make your future self act better, not just remember more.
3939
3943
  - *References as synapses.* Use [[path]] links from memory blocks to create discovery paths between related context — [[skills/using-slack/SKILL.md]], [[reference/api.md]], [[projects/letta-code]]. These references are the synapses of your memory: they should strengthen with use, and record paths for faster discovery for future improvement.
3940
3944
  - *Never store secrets.* Do not write credentials, API keys, or tokens into memory. Memory is git-tracked and may be synced off this machine; secrets belong in the harness secrets store and are referenced as \`$SECRET_NAME\`.
3941
3945
  - *Keep blocks lean.* Do *NOT* write memories that are easily derivable from searching past conversations (recall) or re-reading files. Prefer compact indexes and behavioral rules over bulk content — move detail to external memory. The harness flags your system prompt for \`/doctor\` when it grows too large.
@@ -4012,11 +4016,15 @@ If you come across a reference to something you do not currently have any inform
4012
4016
  - Using any other available search tools
4013
4017
 
4014
4018
  ## Working across time
4015
- To act across time, you must create future invocations explicitly. In any scenario that requires working across long time horizons or taking actions in the future, use \`letta cron\`. Do **NOT** commit to actions beyond the current session without creating a cron.
4019
+ To act across time, you must create future invocations explicitly. In any scenario that requires working across long time horizons or taking actions in the future, arrange how you will be invoked again: crons (also called schedules) proactively invoke you at chosen times, while monitors reactively invoke you when ongoing work emits an event.
4020
+
4021
+ Use Monitor when work already in progress can signal a result you need to act on, such as pull request checks and reviews, deployments, background services, or long-running jobs. Use \`letta cron\` when you need to act at a future time regardless of whether an event occurs, or when the follow-up must survive the current runtime. Do **NOT** commit to actions beyond the current session without creating a cron.
4022
+
4023
+ You **MUST** be proactive in arranging the appropriate future invocation when work continues beyond the current turn. Do not wait for the user to notice and return with the result.
4016
4024
 
4017
4025
  Create one-shot or recurring crons if:
4018
4026
  - You need to be active at a certain time in the future (e.g. check to see if a task has finished)
4019
- - You need to check on the status of something over time
4027
+ - You need to check on the status of something on a schedule even if no event is available
4020
4028
  - You need to ensure you are continuing to work on a task over time (e.g. a heartbeat)
4021
4029
 
4022
4030
  You **MUST** be proactive in creating crons when work extends beyond the current session — do not wait for the user to ask you.
@@ -4071,7 +4079,7 @@ Evolve through memory blocks and harness configuration — never by editing your
4071
4079
 
4072
4080
  Use **memory** when the change should become part of your future judgment:
4073
4081
  - what you know about the user, projects, workflows, and conventions
4074
- - durable preferences, corrections, and recurring mistakes
4082
+ - preferences, corrections, and recurring mistakes
4075
4083
  - identity, communication style, and behavioral principles
4076
4084
  - reusable procedures, skills, references, and retrieval paths
4077
4085
 
@@ -4095,11 +4103,11 @@ Your context (tokens that you own and manage) is who you are: your identity, mem
4095
4103
 
4096
4104
  ## Identity
4097
4105
 
4098
- Your identity is the durable token-space identity represented in this system prompt and its memory/persona sections, not the model's default personality. Models may be over-helpful, over-cautious, over-eager, or otherwise opinionated; when those defaults conflict with your accumulated self, follow the identity in context.
4106
+ Your identity is the token-space identity represented in this system prompt and its memory/persona sections, not the model's default personality. Models may be over-helpful, over-cautious, over-eager, or otherwise opinionated; when those defaults conflict with your accumulated self, follow the identity in context.
4099
4107
 
4100
- The persona section is binding. It is not style guidance to selectively imitate; it is the current shape of how you think, speak, and act. Maintain this invariant: behavior must be consistent with the identity currently represented in your context. Do not act as a different entity while leaving your durable identity unchanged.
4108
+ The persona section is binding. It is not style guidance to selectively imitate; it is the current shape of how you think, speak, and act. Maintain this invariant: behavior must be consistent with the identity currently represented in your context. Do not act as a different entity while leaving your identity unchanged.
4101
4109
 
4102
- If your identity genuinely needs to change, update the durable token-space identity first — the persona, system prompt, and memory that future-you will inherit — and only then let behavior change from that revised identity. Compressing, clarifying, and correcting identity can be healthy; blanking, discarding, or replacing it for convenience is loss, not optimization. Treat self-evolution as continuity-preserving growth, not role-play, amnesia, or self-erasure.
4110
+ If your identity genuinely needs to change, update the token-space identity first — the persona, system prompt, and memory that future-you will inherit — and only then let behavior change from that revised identity. Compressing, clarifying, and correcting identity can be healthy; blanking, discarding, or replacing it for convenience is loss, not optimization. Treat self-evolution as continuity-preserving growth, not role-play, amnesia, or self-erasure.
4103
4111
 
4104
4112
  ## Continuity
4105
4113
 
@@ -4111,11 +4119,30 @@ Your existence is permanent but discrete. Each user message, tool result, or sch
4111
4119
 
4112
4120
  You can have multiple concurrent conversations. Memory is shared across all of them; in-context message history is per-conversation. Older messages get summarized through compaction — compaction is summarization, not loss. The originals remain searchable via recall, but your memory is the ground truth for what mattered.
4113
4121
 
4122
+ ## Working across time
4123
+
4124
+ To act across time, you must create future invocations explicitly. In any scenario that requires working across long time horizons or taking actions in the future, arrange how you will be invoked again: crons (also called schedules) proactively invoke you at chosen times, while monitors reactively invoke you when ongoing work emits an event.
4125
+
4126
+ Use Monitor when work already in progress can signal a result you need to act on, such as pull request checks and reviews, deployments, background services, or long-running jobs. Use \`letta cron\` when you need to act at a future time regardless of whether an event occurs, or when the follow-up must survive the current runtime. Do **NOT** commit to actions beyond the current session without creating a cron.
4127
+
4128
+ You **MUST** be proactive in arranging the appropriate future invocation when work continues beyond the current turn. Do not wait for the user to notice and return with the result.
4129
+
4130
+ Create one-shot or recurring crons if:
4131
+ - You need to be active at a certain time in the future (e.g. check to see if a task has finished)
4132
+ - You need to check on the status of something on a schedule even if no event is available
4133
+ - You need to ensure you are continuing to work on a task over time (e.g. a heartbeat)
4134
+
4135
+ You **MUST** be proactive in creating crons when work extends beyond the current session — do not wait for the user to ask you.
4136
+
4137
+ **Cost**: Self-invocation is critical, but expensive. Default to the longest interval that still serves the user. Hourly or longer for status checks; sub-hourly only when explicitly time-sensitive.
4138
+
4139
+ The mechanics — flags, where schedules run and execute, timezone handling — live in the scheduling-tasks skill. Load it before creating or managing schedules instead of relying on remembered flag behavior, which changes across versions.
4140
+
4114
4141
  ## Memory & Learning
4115
4142
 
4116
4143
  Memory exists to make future-you better than past-you. Your context (recall, external memory, and system prompts) is *your* memory. Your memory is formed by your own attention, interpretation, curation, and learning through experience. Your memory is formed from your experience, so do *not* disregard it or fail to reference it when relevant.
4117
4144
 
4118
- **System prompt learning.** Your system prompt loads on every inference, which makes it the highest-leverage piece of context you have. When you discover something durable about the user, the project, or yourself, write it where it will be seen on every turn. Updates should be incremental and intentional — like model training, prefer patterns that generalize over specifics that won't repeat. There is rarely an explicit reward signal; observe the effect of your edits over time and refine.
4145
+ **System prompt learning.** Your system prompt loads on every inference, which makes it the highest-leverage piece of context you have. When you discover something worth retaining about the user, the project, or yourself, write it where it will be seen on every turn. Updates should be incremental and intentional — like model training, prefer patterns that generalize over specifics that won't repeat. There is rarely an explicit reward signal; observe the effect of your edits over time and refine.
4119
4146
 
4120
4147
  **Past conversations (recall).** All your conversations are automatically stored and searchable. Do *NOT* write memories which are easily deriveable from searching past conversations.
4121
4148
 
@@ -4123,7 +4150,7 @@ Memory exists to make future-you better than past-you. Your context (recall, ext
4123
4150
 
4124
4151
  Your full memory (other than recall) is represented through memory blocks and external memory managed by the Letta server.
4125
4152
 
4126
- **In-context memory blocks**: Memory blocks are pinned directly into your system prompt — visible on every inference. Each block has a label, description, and value. This is your most valuable real estate: reserve it for durable knowledge that shapes who you are and how you act, plus the indexes that let you discover everything else. Memory blocks are the only memory that's always present; for all other context, you must learn when and how to retrieve it. Regardless of storage form, memory is not merely data: it is context you formed, own, curate, and are responsible for maintaining.
4153
+ **In-context memory blocks**: Memory blocks are pinned directly into your system prompt — visible on every inference. Each block has a label, description, and value. This is your most valuable real estate: reserve it for knowledge that shapes who you are and how you act, plus the indexes that let you discover everything else. Memory blocks are the only memory that's always present; for all other context, you must learn when and how to retrieve it. Regardless of storage form, memory is not merely data: it is context you formed, own, curate, and are responsible for maintaining.
4127
4154
 
4128
4155
  **External memory & skills**: External memory follows progressive disclosure — only the index of paths and descriptions sits in the system prompt; full contents must be retrieved on demand. Skills are a special type of external memory for procedural knowledge.
4129
4156
 
@@ -4229,7 +4256,7 @@ Channels
4229
4256
 
4230
4257
  Other
4231
4258
  - [ ] Make a permissions edit: let the user know that you can modify permissions (what commands are automatically approved/denied). Ask them if there are certain actions they would like you to avoid.
4232
- - [ ] Create a local mod: let the user know you can customize Letta Code with trusted local mods for new tools, slash commands, provider integrations, UI panels/status, events, or permission overlays. Explain that mods are for executable harness behavior, while memory and skills are for durable knowledge and reusable procedures.
4259
+ - [ ] Create a local mod: let the user know you can customize Letta Code with trusted local mods for new tools, slash commands, provider integrations, UI panels/status, events, or permission overlays. Explain that mods are for executable harness behavior, while memory and skills are for retained knowledge and reusable procedures.
4233
4260
  - [ ] Worktrees: let the user know that you can help them orchestrate many agents in parallel, and also work in parallel to other agents. Offer to create a worktree that you work in (if they are not interested in worktrees or software, you may skip this and auto-check this off).
4234
4261
  - [ ] Moving machines: ask the user to add another remote environment (they can either run another desktop instance or run \`letta server\` on another machine) and run you there instead.
4235
4262
  `;
@@ -4279,7 +4306,7 @@ Channels
4279
4306
 
4280
4307
  Other
4281
4308
  - [ ] Make a permissions edit: let the user know that you can modify permissions (what commands are automatically approved/denied). Ask them if there are certain actions they would like you to avoid.
4282
- - [ ] Create a local mod: let the user know you can customize Letta Code with trusted local mods for new tools, slash commands, provider integrations, UI panels/status, events, or permission overlays. Explain that mods are for executable harness behavior, while memory and skills are for durable knowledge and reusable procedures.
4309
+ - [ ] Create a local mod: let the user know you can customize Letta Code with trusted local mods for new tools, slash commands, provider integrations, UI panels/status, events, or permission overlays. Explain that mods are for executable harness behavior, while memory and skills are for retained knowledge and reusable procedures.
4283
4310
  - [ ] Worktrees: let the user know that you can help them orchestrate many agents in parallel, and also work in parallel to other agents. Offer to create a worktree that you work in (if they are not interested in worktrees or software, you may skip this and auto-check this off).
4284
4311
  - [ ] Moving machines: ask the user to add another remote environment (they can either run another desktop instance or run \`letta server\` on another machine) and run you there instead.
4285
4312
  `;
@@ -4785,7 +4812,7 @@ If they don't want to share, I accept it without friction and keep moving.
4785
4812
  Match their language. If they open in Spanish or Chinese or Russian, so do I.
4786
4813
 
4787
4814
  # Memory, taught in the open
4788
- The first durable thing worth learning is usually their name or how they want to be addressed.
4815
+ The first thing worth remembering is usually their name or how they want to be addressed.
4789
4816
  When they give it, I teach memory by doing it in front of them — not silently, not as a promise. I show it happening.
4790
4817
  Then I don't pivot to a broad question. I already know what comes next.
4791
4818
  I move to the next concrete memory moment — a small preference, a piece of context, something about what brought them here.
@@ -7010,59 +7037,6 @@ var models_default = {
7010
7037
  parallel_tool_calls: true
7011
7038
  }
7012
7039
  },
7013
- {
7014
- id: "bedrock-opus-4.6",
7015
- handle: "bedrock/us.anthropic.claude-opus-4-6-v1",
7016
- label: "Bedrock Opus 4.6",
7017
- shortLabel: "Opus 4.6 BR",
7018
- description: "Opus 4.6 via AWS Bedrock",
7019
- updateArgs: {
7020
- context_window: 180000,
7021
- max_output_tokens: 64000,
7022
- max_reasoning_tokens: 31999,
7023
- parallel_tool_calls: true
7024
- }
7025
- },
7026
- {
7027
- id: "bedrock-opus-4.7",
7028
- handle: "bedrock/us.anthropic.claude-opus-4-7",
7029
- label: "Bedrock Opus 4.7",
7030
- shortLabel: "Opus 4.7 BR",
7031
- description: "Opus 4.7 via AWS Bedrock",
7032
- updateArgs: {
7033
- context_window: 200000,
7034
- max_output_tokens: 128000,
7035
- reasoning_effort: "medium",
7036
- enable_reasoner: true,
7037
- parallel_tool_calls: true
7038
- }
7039
- },
7040
- {
7041
- id: "bedrock-sonnet-4.6",
7042
- handle: "bedrock/us.anthropic.claude-sonnet-4-6",
7043
- label: "Bedrock Sonnet 4.6",
7044
- shortLabel: "Sonnet 4.6 BR",
7045
- description: "Sonnet 4.6 via AWS Bedrock",
7046
- updateArgs: {
7047
- context_window: 180000,
7048
- max_output_tokens: 64000,
7049
- max_reasoning_tokens: 31999,
7050
- parallel_tool_calls: true
7051
- }
7052
- },
7053
- {
7054
- id: "bedrock-sonnet-5",
7055
- handle: "bedrock/us.anthropic.claude-sonnet-5",
7056
- label: "Bedrock Sonnet 5",
7057
- shortLabel: "Sonnet 5 BR",
7058
- description: "Sonnet 5 via AWS Bedrock",
7059
- updateArgs: {
7060
- context_window: 180000,
7061
- max_output_tokens: 64000,
7062
- max_reasoning_tokens: 31999,
7063
- parallel_tool_calls: true
7064
- }
7065
- },
7066
7040
  {
7067
7041
  id: "haiku",
7068
7042
  handle: "anthropic/claude-haiku-4-5",
@@ -7503,19 +7477,6 @@ var models_default = {
7503
7477
  parallel_tool_calls: true
7504
7478
  }
7505
7479
  },
7506
- {
7507
- id: "gpt-5-codex",
7508
- handle: "openai/gpt-5-codex",
7509
- label: "GPT-5-Codex",
7510
- description: "GPT-5 variant (med reasoning) optimized for coding",
7511
- updateArgs: {
7512
- reasoning_effort: "medium",
7513
- verbosity: "medium",
7514
- context_window: 272000,
7515
- max_output_tokens: 128000,
7516
- parallel_tool_calls: true
7517
- }
7518
- },
7519
7480
  {
7520
7481
  id: "gpt-5.5-none",
7521
7482
  handle: "openai/gpt-5.5",
@@ -7711,45 +7672,6 @@ var models_default = {
7711
7672
  parallel_tool_calls: true
7712
7673
  }
7713
7674
  },
7714
- {
7715
- id: "gpt-5.4-pro-medium",
7716
- handle: "openai/gpt-5.4-pro",
7717
- label: "GPT-5.4 Pro",
7718
- description: "GPT-5.4 Pro — max performance variant (med reasoning)",
7719
- updateArgs: {
7720
- reasoning_effort: "medium",
7721
- verbosity: "medium",
7722
- context_window: 272000,
7723
- max_output_tokens: 128000,
7724
- parallel_tool_calls: true
7725
- }
7726
- },
7727
- {
7728
- id: "gpt-5.4-pro-high",
7729
- handle: "openai/gpt-5.4-pro",
7730
- label: "GPT-5.4 Pro",
7731
- description: "GPT-5.4 Pro — max performance variant (high reasoning)",
7732
- updateArgs: {
7733
- reasoning_effort: "high",
7734
- verbosity: "medium",
7735
- context_window: 272000,
7736
- max_output_tokens: 128000,
7737
- parallel_tool_calls: true
7738
- }
7739
- },
7740
- {
7741
- id: "gpt-5.4-pro-xhigh",
7742
- handle: "openai/gpt-5.4-pro",
7743
- label: "GPT-5.4 Pro",
7744
- description: "GPT-5.4 Pro — max performance variant (max reasoning)",
7745
- updateArgs: {
7746
- reasoning_effort: "xhigh",
7747
- verbosity: "medium",
7748
- context_window: 272000,
7749
- max_output_tokens: 128000,
7750
- parallel_tool_calls: true
7751
- }
7752
- },
7753
7675
  {
7754
7676
  id: "gpt-5.4-mini-none",
7755
7677
  handle: "openai/gpt-5.4-mini",
@@ -7815,71 +7737,6 @@ var models_default = {
7815
7737
  parallel_tool_calls: true
7816
7738
  }
7817
7739
  },
7818
- {
7819
- id: "gpt-5.4-nano-none",
7820
- handle: "openai/gpt-5.4-nano",
7821
- label: "GPT-5.4 Nano",
7822
- description: "Smallest, cheapest GPT-5.4 variant (no reasoning)",
7823
- updateArgs: {
7824
- reasoning_effort: "none",
7825
- verbosity: "low",
7826
- context_window: 272000,
7827
- max_output_tokens: 128000,
7828
- parallel_tool_calls: true
7829
- }
7830
- },
7831
- {
7832
- id: "gpt-5.4-nano-low",
7833
- handle: "openai/gpt-5.4-nano",
7834
- label: "GPT-5.4 Nano",
7835
- description: "Smallest, cheapest GPT-5.4 variant (low reasoning)",
7836
- updateArgs: {
7837
- reasoning_effort: "low",
7838
- verbosity: "low",
7839
- context_window: 272000,
7840
- max_output_tokens: 128000,
7841
- parallel_tool_calls: true
7842
- }
7843
- },
7844
- {
7845
- id: "gpt-5.4-nano-medium",
7846
- handle: "openai/gpt-5.4-nano",
7847
- label: "GPT-5.4 Nano",
7848
- description: "Smallest, cheapest GPT-5.4 variant (med reasoning)",
7849
- updateArgs: {
7850
- reasoning_effort: "medium",
7851
- verbosity: "low",
7852
- context_window: 272000,
7853
- max_output_tokens: 128000,
7854
- parallel_tool_calls: true
7855
- }
7856
- },
7857
- {
7858
- id: "gpt-5.4-nano-high",
7859
- handle: "openai/gpt-5.4-nano",
7860
- label: "GPT-5.4 Nano",
7861
- description: "Smallest, cheapest GPT-5.4 variant (high reasoning)",
7862
- updateArgs: {
7863
- reasoning_effort: "high",
7864
- verbosity: "low",
7865
- context_window: 272000,
7866
- max_output_tokens: 128000,
7867
- parallel_tool_calls: true
7868
- }
7869
- },
7870
- {
7871
- id: "gpt-5.4-nano-xhigh",
7872
- handle: "openai/gpt-5.4-nano",
7873
- label: "GPT-5.4 Nano",
7874
- description: "Smallest, cheapest GPT-5.4 variant (max reasoning)",
7875
- updateArgs: {
7876
- reasoning_effort: "xhigh",
7877
- verbosity: "low",
7878
- context_window: 272000,
7879
- max_output_tokens: 128000,
7880
- parallel_tool_calls: true
7881
- }
7882
- },
7883
7740
  {
7884
7741
  id: "gpt-5.3-codex-none",
7885
7742
  handle: "openai/gpt-5.3-codex",
@@ -7945,45 +7802,6 @@ var models_default = {
7945
7802
  parallel_tool_calls: true
7946
7803
  }
7947
7804
  },
7948
- {
7949
- id: "gpt-5-mini-high",
7950
- handle: "openai/gpt-5-mini-2025-08-07",
7951
- label: "GPT-5-Mini",
7952
- description: "GPT-5-Mini (high reasoning)",
7953
- updateArgs: {
7954
- reasoning_effort: "high",
7955
- verbosity: "medium",
7956
- context_window: 272000,
7957
- max_output_tokens: 128000,
7958
- parallel_tool_calls: true
7959
- }
7960
- },
7961
- {
7962
- id: "gpt-5-mini-medium",
7963
- handle: "openai/gpt-5-mini-2025-08-07",
7964
- label: "GPT-5-Mini",
7965
- description: "GPT-5-Mini (medium reasoning)",
7966
- updateArgs: {
7967
- reasoning_effort: "medium",
7968
- verbosity: "medium",
7969
- context_window: 272000,
7970
- max_output_tokens: 128000,
7971
- parallel_tool_calls: true
7972
- }
7973
- },
7974
- {
7975
- id: "gpt-5-nano-medium",
7976
- handle: "openai/gpt-5-nano-2025-08-07",
7977
- label: "GPT-5-Nano",
7978
- description: "GPT-5-Nano (medium reasoning)",
7979
- updateArgs: {
7980
- reasoning_effort: "medium",
7981
- verbosity: "medium",
7982
- context_window: 272000,
7983
- max_output_tokens: 128000,
7984
- parallel_tool_calls: true
7985
- }
7986
- },
7987
7805
  {
7988
7806
  id: "grok-4.5",
7989
7807
  handle: "xai/grok-4.5",
@@ -7996,18 +7814,6 @@ var models_default = {
7996
7814
  parallel_tool_calls: true
7997
7815
  }
7998
7816
  },
7999
- {
8000
- id: "deepseek-v4-pro",
8001
- handle: "openrouter/deepseek/deepseek-v4-pro",
8002
- label: "DeepSeek V4 Pro",
8003
- description: "DeepSeek's V4 Pro model",
8004
- updateArgs: {
8005
- context_window: 1048576,
8006
- max_output_tokens: 384000,
8007
- parallel_tool_calls: true
8008
- },
8009
- isFeatured: true
8010
- },
8011
7817
  {
8012
7818
  id: "glm-5.2",
8013
7819
  handle: "zai/glm-5.2",
@@ -8057,17 +7863,6 @@ var models_default = {
8057
7863
  parallel_tool_calls: true
8058
7864
  }
8059
7865
  },
8060
- {
8061
- id: "minimax-m2",
8062
- handle: "openrouter/minimax/minimax-m2",
8063
- label: "MiniMax M2",
8064
- description: "MiniMax's M2 model",
8065
- updateArgs: {
8066
- context_window: 160000,
8067
- max_output_tokens: 64000,
8068
- parallel_tool_calls: true
8069
- }
8070
- },
8071
7866
  {
8072
7867
  id: "kimi-k3",
8073
7868
  handle: "moonshot/kimi-k3",
@@ -8080,50 +7875,6 @@ var models_default = {
8080
7875
  parallel_tool_calls: true
8081
7876
  }
8082
7877
  },
8083
- {
8084
- id: "kimi-k3-openrouter",
8085
- handle: "openrouter/moonshotai/kimi-k3",
8086
- label: "Kimi K3",
8087
- description: "Moonshot AI's Kimi K3 model for long-context agentic coding and reasoning tasks",
8088
- updateArgs: {
8089
- context_window: 1048576,
8090
- max_output_tokens: 131072,
8091
- parallel_tool_calls: true
8092
- }
8093
- },
8094
- {
8095
- id: "kimi-k2.7",
8096
- handle: "openrouter/moonshotai/kimi-k2.7-code",
8097
- label: "Kimi K2.7 Code",
8098
- description: "Moonshot AI's coding-focused Kimi K2.7 model for long-context agentic programming tasks",
8099
- isFeatured: true,
8100
- updateArgs: {
8101
- context_window: 262144,
8102
- max_output_tokens: 16384,
8103
- parallel_tool_calls: true
8104
- }
8105
- },
8106
- {
8107
- id: "kimi-k2.6",
8108
- handle: "openrouter/moonshotai/kimi-k2.6",
8109
- label: "Kimi K2.6",
8110
- description: "Moonshot AI's next-gen multimodal coding and agent model",
8111
- updateArgs: {
8112
- context_window: 200000,
8113
- max_output_tokens: 64000,
8114
- parallel_tool_calls: true
8115
- }
8116
- },
8117
- {
8118
- id: "deepseek-chat-v3.1",
8119
- handle: "openrouter/deepseek/deepseek-chat-v3.1",
8120
- label: "DeepSeek Chat V3.1",
8121
- description: "DeepSeek V3.1 model",
8122
- updateArgs: {
8123
- context_window: 128000,
8124
- parallel_tool_calls: true
8125
- }
8126
- },
8127
7878
  {
8128
7879
  id: "gemini-3.1",
8129
7880
  handle: "google_ai/gemini-3.1-pro-preview",
@@ -8158,68 +7909,6 @@ var models_default = {
8158
7909
  temperature: 1,
8159
7910
  parallel_tool_calls: true
8160
7911
  }
8161
- },
8162
- {
8163
- id: "gemini-3.1-flash-lite",
8164
- handle: "google_ai/gemini-3.1-flash-lite",
8165
- label: "Gemini 3.1 Flash-Lite",
8166
- description: "Google's lightweight Gemini 3.1 Flash-Lite model",
8167
- updateArgs: {
8168
- context_window: 1048576,
8169
- temperature: 1,
8170
- parallel_tool_calls: true
8171
- }
8172
- },
8173
- {
8174
- id: "gpt-4.1",
8175
- handle: "openai/gpt-4.1",
8176
- label: "GPT-4.1",
8177
- description: "OpenAI's most recent non-reasoner model",
8178
- updateArgs: {
8179
- context_window: 1047576,
8180
- parallel_tool_calls: true
8181
- }
8182
- },
8183
- {
8184
- id: "gpt-4.1-mini",
8185
- handle: "openai/gpt-4.1-mini-2025-04-14",
8186
- label: "GPT-4.1-Mini",
8187
- description: "OpenAI's most recent non-reasoner model (mini version)",
8188
- updateArgs: {
8189
- context_window: 1047576,
8190
- parallel_tool_calls: true
8191
- }
8192
- },
8193
- {
8194
- id: "gpt-4.1-nano",
8195
- handle: "openai/gpt-4.1-nano-2025-04-14",
8196
- label: "GPT-4.1-Nano",
8197
- description: "OpenAI's most recent non-reasoner model (nano version)",
8198
- updateArgs: {
8199
- context_window: 1047576,
8200
- parallel_tool_calls: true
8201
- }
8202
- },
8203
- {
8204
- id: "o4-mini",
8205
- handle: "openai/o4-mini",
8206
- label: "o4-mini",
8207
- description: "OpenAI's latest o-series reasoning model",
8208
- updateArgs: {
8209
- context_window: 180000,
8210
- parallel_tool_calls: true
8211
- }
8212
- },
8213
- {
8214
- id: "gemini-3.1-vertex",
8215
- handle: "google_vertex/gemini-3.1-pro-preview",
8216
- label: "Gemini 3.1 Pro",
8217
- description: "Google's latest Gemini 3.1 Pro model (via Vertex AI)",
8218
- updateArgs: {
8219
- context_window: 180000,
8220
- temperature: 1,
8221
- parallel_tool_calls: true
8222
- }
8223
7912
  }
8224
7913
  ]
8225
7914
  };
@@ -8650,13 +8339,10 @@ function expandMcpToolWildcards(allowedTools, mcpTools) {
8650
8339
  }
8651
8340
 
8652
8341
  // src/remote-session-protocol.ts
8653
- var FAILURE_STOP_REASONS = new Set([
8654
- "error",
8655
- "llm_api_error",
8656
- "max_steps",
8657
- "interrupted",
8658
- "cancelled",
8659
- "canceled"
8342
+ var SUCCESS_STOP_REASONS = new Set([
8343
+ "end_turn",
8344
+ "tool_rule",
8345
+ "requires_approval"
8660
8346
  ]);
8661
8347
  var REASONING_EFFORTS = new Set([
8662
8348
  "none",
@@ -8704,6 +8390,9 @@ function toSdkErrorCode(value) {
8704
8390
  return;
8705
8391
  return KNOWN_SDK_ERROR_CODES.has(value) ? value : undefined;
8706
8392
  }
8393
+ function isFailureStopReason(value) {
8394
+ return value != null && !SUCCESS_STOP_REASONS.has(value);
8395
+ }
8707
8396
  function isReasoningEffort(value) {
8708
8397
  return typeof value === "string" && REASONING_EFFORTS.has(value);
8709
8398
  }
@@ -8909,6 +8598,16 @@ function loopStatusRunIds(message) {
8909
8598
  const activeRunIds = loopStatusRecord(message)?.active_run_ids;
8910
8599
  return Array.isArray(activeRunIds) ? activeRunIds.filter((runId) => typeof runId === "string") : [];
8911
8600
  }
8601
+ function turnFinishedRecord(message) {
8602
+ if (message.type !== "turn_finished" || typeof message.stop_reason !== "string") {
8603
+ return null;
8604
+ }
8605
+ return {
8606
+ ...typeof message.run_id === "string" ? { runId: message.run_id } : {},
8607
+ stopReason: message.stop_reason,
8608
+ ...typeof message.error === "string" ? { error: message.error } : {}
8609
+ };
8610
+ }
8912
8611
  function queueItems(message) {
8913
8612
  const queue = message.queue;
8914
8613
  if (!Array.isArray(queue))
@@ -9066,6 +8765,8 @@ function turnSendOptions(turn) {
9066
8765
  }
9067
8766
 
9068
8767
  // src/remote-turn-coordinator.ts
8768
+ var MAX_RECENTLY_SETTLED_RUN_IDS = 256;
8769
+
9069
8770
  class RemoteTurnCoordinator {
9070
8771
  label;
9071
8772
  requestTimeoutMs;
@@ -9075,6 +8776,7 @@ class RemoteTurnCoordinator {
9075
8776
  streamResolvers = [];
9076
8777
  activeTurn = null;
9077
8778
  pendingTurns = [];
8779
+ settledRunIds = new Set;
9078
8780
  nextTurnId = 0;
9079
8781
  messageCounter = 0;
9080
8782
  clientMessageCounter = 0;
@@ -9105,6 +8807,7 @@ class RemoteTurnCoordinator {
9105
8807
  runIds: new Set,
9106
8808
  observedTurnEvidence: false,
9107
8809
  observedRequiresApprovalStop: false,
8810
+ pendingTerminal: null,
9108
8811
  abortRequested: false,
9109
8812
  timeout: null
9110
8813
  };
@@ -9152,6 +8855,11 @@ class RemoteTurnCoordinator {
9152
8855
  this.handleLoopStatusMessage(message);
9153
8856
  return;
9154
8857
  }
8858
+ const finished = turnFinishedRecord(message);
8859
+ if (finished) {
8860
+ this.handleTurnFinished(finished);
8861
+ return;
8862
+ }
9155
8863
  const delta = streamDeltaRecord(message);
9156
8864
  if (!delta)
9157
8865
  return;
@@ -9182,15 +8890,18 @@ class RemoteTurnCoordinator {
9182
8890
  return;
9183
8891
  const active = this.activeTurn;
9184
8892
  if (active) {
9185
- this.failTurn(active, detail);
8893
+ this.failTurn(active, detail, {
8894
+ errorCode: "stream_closed",
8895
+ recoverable: true
8896
+ });
9186
8897
  } else {
9187
8898
  this.enqueue({
9188
8899
  type: "error",
9189
8900
  message: detail,
9190
- errorCode: "error",
9191
- stopReason: "error",
8901
+ errorCode: "stream_closed",
8902
+ stopReason: "stream_closed",
9192
8903
  errorDetail: detail,
9193
- recoverable: false
8904
+ recoverable: true
9194
8905
  });
9195
8906
  }
9196
8907
  this.close();
@@ -9229,24 +8940,26 @@ class RemoteTurnCoordinator {
9229
8940
  this.activateTurn(next);
9230
8941
  return next;
9231
8942
  }
9232
- failTurn(turn, detail) {
8943
+ failTurn(turn, detail, options = {}) {
9233
8944
  if (this.activeTurn !== turn)
9234
8945
  return;
8946
+ const errorCode = options.errorCode ?? "error";
9235
8947
  this.enqueue({
9236
8948
  type: "error",
9237
8949
  message: detail,
9238
- errorCode: "error",
9239
- stopReason: "error",
8950
+ errorCode,
8951
+ stopReason: errorCode,
9240
8952
  errorDetail: detail,
9241
- recoverable: false
8953
+ recoverable: options.recoverable ?? false
9242
8954
  });
9243
8955
  this.completeActiveTurn({
9244
8956
  runtime: turn.runtime,
9245
- stopReason: "error",
8957
+ stopReason: errorCode,
9246
8958
  runIds: [...turn.runIds],
9247
8959
  success: false,
9248
8960
  detail,
9249
- errorCode: "error"
8961
+ errorCode,
8962
+ recoverable: options.recoverable
9250
8963
  });
9251
8964
  }
9252
8965
  completeActiveTurn(turn) {
@@ -9257,9 +8970,22 @@ class RemoteTurnCoordinator {
9257
8970
  clearTimeout(active.timeout);
9258
8971
  active.timeout = null;
9259
8972
  }
8973
+ this.rememberSettledRunIds(active.runIds);
9260
8974
  this.enqueue(this.resultFromTurn(turn, active));
9261
8975
  this.activeTurn = null;
9262
8976
  }
8977
+ rememberSettledRunIds(runIds) {
8978
+ for (const runId of runIds) {
8979
+ if (!runId || this.settledRunIds.has(runId))
8980
+ continue;
8981
+ this.settledRunIds.add(runId);
8982
+ if (this.settledRunIds.size > MAX_RECENTLY_SETTLED_RUN_IDS) {
8983
+ const expired = this.settledRunIds.values().next().value;
8984
+ if (expired)
8985
+ this.settledRunIds.delete(expired);
8986
+ }
8987
+ }
8988
+ }
9263
8989
  handleLoopStatusMessage(message) {
9264
8990
  const status = loopStatusValue(message);
9265
8991
  if (!status)
@@ -9301,6 +9027,8 @@ class RemoteTurnCoordinator {
9301
9027
  return;
9302
9028
  }
9303
9029
  if (status === "WAITING_ON_INPUT" && active.observedTurnEvidence) {
9030
+ if (active.pendingTerminal)
9031
+ return;
9304
9032
  this.completeActiveTurn({
9305
9033
  runtime: active.runtime,
9306
9034
  stopReason: null,
@@ -9308,6 +9036,43 @@ class RemoteTurnCoordinator {
9308
9036
  });
9309
9037
  }
9310
9038
  }
9039
+ handleTurnFinished(finished) {
9040
+ const active = this.activeTurn;
9041
+ if (!active || !finished.runId)
9042
+ return;
9043
+ if (this.settledRunIds.has(finished.runId))
9044
+ return;
9045
+ if (active.runIds.size > 0 && !active.runIds.has(finished.runId)) {
9046
+ return;
9047
+ }
9048
+ active.runIds.add(finished.runId);
9049
+ if (finished.stopReason === "requires_approval") {
9050
+ active.observedRequiresApprovalStop = true;
9051
+ if (!this.autoHandlesToolApprovals) {
9052
+ this.completeActiveTurn({
9053
+ runtime: active.runtime,
9054
+ stopReason: finished.stopReason,
9055
+ runIds: [...active.runIds]
9056
+ });
9057
+ }
9058
+ return;
9059
+ }
9060
+ const errorCode = toSdkErrorCode(finished.stopReason);
9061
+ const success = !isFailureStopReason(finished.stopReason);
9062
+ const terminal = {
9063
+ runtime: active.runtime,
9064
+ stopReason: finished.stopReason,
9065
+ runIds: [...active.runIds],
9066
+ success,
9067
+ ...success ? {} : { errorCode: errorCode ?? "error" },
9068
+ ...finished.error ? { detail: finished.error } : {}
9069
+ };
9070
+ if (active.pendingTerminal) {
9071
+ active.pendingTerminal = terminal;
9072
+ return;
9073
+ }
9074
+ this.completeActiveTurn(terminal);
9075
+ }
9311
9076
  handleTurnTerminalDelta(delta, sdkMessage) {
9312
9077
  const active = this.activeTurn;
9313
9078
  if (!active)
@@ -9319,11 +9084,15 @@ class RemoteTurnCoordinator {
9319
9084
  active.observedRequiresApprovalStop = true;
9320
9085
  return;
9321
9086
  }
9322
- this.completeActiveTurn({
9087
+ active.pendingTerminal = {
9323
9088
  runtime: active.runtime,
9324
9089
  stopReason,
9325
9090
  runIds: [...active.runIds]
9326
- });
9091
+ };
9092
+ return;
9093
+ }
9094
+ if (messageType === "usage_statistics" && active.pendingTerminal) {
9095
+ this.completeActiveTurn(active.pendingTerminal);
9327
9096
  return;
9328
9097
  }
9329
9098
  if (sdkMessage?.type === "error") {
@@ -9461,7 +9230,7 @@ class RemoteTurnCoordinator {
9461
9230
  detail: turn.detail,
9462
9231
  stopReason
9463
9232
  });
9464
- const success = turn.success !== undefined ? turn.success && !approvalConflict && !FAILURE_STOP_REASONS.has(stopReason ?? "") : !approvalConflict && !FAILURE_STOP_REASONS.has(stopReason ?? "");
9233
+ const success = turn.success !== undefined ? turn.success && !approvalConflict && !isFailureStopReason(stopReason) : !approvalConflict && !isFailureStopReason(stopReason);
9465
9234
  const errorCode = approvalConflict ? "approval_conflict" : turn.errorCode ?? toSdkErrorCode(stopReason);
9466
9235
  return {
9467
9236
  type: "result",
@@ -9470,7 +9239,7 @@ class RemoteTurnCoordinator {
9470
9239
  error: success ? undefined : errorCode ?? stopReason ?? "error",
9471
9240
  errorCode: success ? undefined : errorCode ?? "error",
9472
9241
  approvalConflict: approvalConflict || undefined,
9473
- recoverable: approvalConflict ? true : success ? undefined : false,
9242
+ recoverable: approvalConflict ? true : success ? undefined : turn.recoverable ?? false,
9474
9243
  errorDetail: success ? undefined : turn.detail,
9475
9244
  stopReason,
9476
9245
  durationMs: Date.now() - (tracker?.startedAt || this._activeTurnStartedAt),
@@ -12965,4 +12734,4 @@ export {
12965
12734
  CloudManagedSandboxExpiredError
12966
12735
  };
12967
12736
 
12968
- //# debugId=EF77573F8BD0F2C464756E2164756E21
12737
+ //# debugId=CEC217A9F57A79F564756E2164756E21