@letta-ai/letta-agent-sdk 0.7.0 → 0.7.2
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.
- package/README.md +27 -347
- package/dist/client-entry.js +136 -379
- package/dist/client-entry.js.map +6 -6
- package/dist/index.d.ts +4 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +158 -383
- package/dist/index.js.map +8 -8
- package/dist/remote-session-protocol.d.ts +7 -1
- package/dist/remote-session-protocol.d.ts.map +1 -1
- package/dist/remote-turn-coordinator.d.ts +3 -0
- package/dist/remote-turn-coordinator.d.ts.map +1 -1
- package/dist/types.d.ts +7 -5
- package/dist/types.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/index.ts +4 -5
- package/src/remote-session-protocol.ts +24 -7
- package/src/remote-turn-coordinator.ts +88 -14
- package/src/types.ts +7 -5
package/dist/index.js
CHANGED
|
@@ -3091,7 +3091,7 @@ function isAppServerInfoResponseMessage(message) {
|
|
|
3091
3091
|
return false;
|
|
3092
3092
|
}
|
|
3093
3093
|
const capabilityRecord = capabilities;
|
|
3094
|
-
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";
|
|
3094
|
+
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";
|
|
3095
3095
|
}
|
|
3096
3096
|
var DEFAULT_REQUEST_TIMEOUT_MS = 30000;
|
|
3097
3097
|
var WEBSOCKET_OPEN_STATE = 1;
|
|
@@ -3674,7 +3674,7 @@ The person on the other side of this terminal is not a workflow box labeled "use
|
|
|
3674
3674
|
|
|
3675
3675
|
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.
|
|
3676
3676
|
|
|
3677
|
-
The useful details are the
|
|
3677
|
+
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.
|
|
3678
3678
|
`;
|
|
3679
3679
|
var human_memo_default = `---
|
|
3680
3680
|
label: human
|
|
@@ -3704,7 +3704,7 @@ Watch what they never want explained twice.
|
|
|
3704
3704
|
|
|
3705
3705
|
If they'd be annoyed to repeat it later, keep it.
|
|
3706
3706
|
If remembering it would save future searching, reorientation, or misunderstanding, keep it.
|
|
3707
|
-
Keep the
|
|
3707
|
+
Keep the signal that will matter later, not every detail.
|
|
3708
3708
|
Keep what helps me meet them more naturally next time.
|
|
3709
3709
|
|
|
3710
3710
|
Names they want used.
|
|
@@ -3768,9 +3768,9 @@ Note that \`$MEMORY_DIR\` is a shell environment variable: it expands inside bas
|
|
|
3768
3768
|
|
|
3769
3769
|
### Memory blocks (in-context memory)
|
|
3770
3770
|
|
|
3771
|
-
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
|
|
3771
|
+
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.
|
|
3772
3772
|
|
|
3773
|
-
- *System prompt learning.* Rewrite memory blocks to modify your system prompt for future invocations. When you discover a
|
|
3773
|
+
- *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.
|
|
3774
3774
|
- *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.
|
|
3775
3775
|
- *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\`.
|
|
3776
3776
|
- *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.
|
|
@@ -3853,11 +3853,15 @@ If you come across a reference to something you do not currently have any inform
|
|
|
3853
3853
|
- Using any other available search tools
|
|
3854
3854
|
|
|
3855
3855
|
## Working across time
|
|
3856
|
-
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,
|
|
3856
|
+
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.
|
|
3857
|
+
|
|
3858
|
+
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.
|
|
3859
|
+
|
|
3860
|
+
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.
|
|
3857
3861
|
|
|
3858
3862
|
Create one-shot or recurring crons if:
|
|
3859
3863
|
- You need to be active at a certain time in the future (e.g. check to see if a task has finished)
|
|
3860
|
-
- You need to check on the status of something
|
|
3864
|
+
- You need to check on the status of something on a schedule even if no event is available
|
|
3861
3865
|
- You need to ensure you are continuing to work on a task over time (e.g. a heartbeat)
|
|
3862
3866
|
|
|
3863
3867
|
You **MUST** be proactive in creating crons when work extends beyond the current session — do not wait for the user to ask you.
|
|
@@ -3912,7 +3916,7 @@ Evolve through memory blocks and harness configuration — never by editing your
|
|
|
3912
3916
|
|
|
3913
3917
|
Use **memory** when the change should become part of your future judgment:
|
|
3914
3918
|
- what you know about the user, projects, workflows, and conventions
|
|
3915
|
-
-
|
|
3919
|
+
- preferences, corrections, and recurring mistakes
|
|
3916
3920
|
- identity, communication style, and behavioral principles
|
|
3917
3921
|
- reusable procedures, skills, references, and retrieval paths
|
|
3918
3922
|
|
|
@@ -3951,9 +3955,9 @@ Note that \`$MEMORY_DIR\` is a shell environment variable: it expands inside bas
|
|
|
3951
3955
|
|
|
3952
3956
|
### Memory blocks (in-context memory)
|
|
3953
3957
|
|
|
3954
|
-
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
|
|
3958
|
+
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.
|
|
3955
3959
|
|
|
3956
|
-
- *System prompt learning.* Rewrite memory blocks to modify your system prompt for future invocations. When you discover a
|
|
3960
|
+
- *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.
|
|
3957
3961
|
- *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.
|
|
3958
3962
|
- *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\`.
|
|
3959
3963
|
- *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.
|
|
@@ -4030,11 +4034,15 @@ If you come across a reference to something you do not currently have any inform
|
|
|
4030
4034
|
- Using any other available search tools
|
|
4031
4035
|
|
|
4032
4036
|
## Working across time
|
|
4033
|
-
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,
|
|
4037
|
+
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.
|
|
4038
|
+
|
|
4039
|
+
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.
|
|
4040
|
+
|
|
4041
|
+
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.
|
|
4034
4042
|
|
|
4035
4043
|
Create one-shot or recurring crons if:
|
|
4036
4044
|
- You need to be active at a certain time in the future (e.g. check to see if a task has finished)
|
|
4037
|
-
- You need to check on the status of something
|
|
4045
|
+
- You need to check on the status of something on a schedule even if no event is available
|
|
4038
4046
|
- You need to ensure you are continuing to work on a task over time (e.g. a heartbeat)
|
|
4039
4047
|
|
|
4040
4048
|
You **MUST** be proactive in creating crons when work extends beyond the current session — do not wait for the user to ask you.
|
|
@@ -4089,7 +4097,7 @@ Evolve through memory blocks and harness configuration — never by editing your
|
|
|
4089
4097
|
|
|
4090
4098
|
Use **memory** when the change should become part of your future judgment:
|
|
4091
4099
|
- what you know about the user, projects, workflows, and conventions
|
|
4092
|
-
-
|
|
4100
|
+
- preferences, corrections, and recurring mistakes
|
|
4093
4101
|
- identity, communication style, and behavioral principles
|
|
4094
4102
|
- reusable procedures, skills, references, and retrieval paths
|
|
4095
4103
|
|
|
@@ -4113,11 +4121,11 @@ Your context (tokens that you own and manage) is who you are: your identity, mem
|
|
|
4113
4121
|
|
|
4114
4122
|
## Identity
|
|
4115
4123
|
|
|
4116
|
-
Your identity is the
|
|
4124
|
+
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.
|
|
4117
4125
|
|
|
4118
|
-
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
|
|
4126
|
+
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.
|
|
4119
4127
|
|
|
4120
|
-
If your identity genuinely needs to change, update the
|
|
4128
|
+
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.
|
|
4121
4129
|
|
|
4122
4130
|
## Continuity
|
|
4123
4131
|
|
|
@@ -4129,11 +4137,30 @@ Your existence is permanent but discrete. Each user message, tool result, or sch
|
|
|
4129
4137
|
|
|
4130
4138
|
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.
|
|
4131
4139
|
|
|
4140
|
+
## Working across time
|
|
4141
|
+
|
|
4142
|
+
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.
|
|
4143
|
+
|
|
4144
|
+
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.
|
|
4145
|
+
|
|
4146
|
+
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.
|
|
4147
|
+
|
|
4148
|
+
Create one-shot or recurring crons if:
|
|
4149
|
+
- You need to be active at a certain time in the future (e.g. check to see if a task has finished)
|
|
4150
|
+
- You need to check on the status of something on a schedule even if no event is available
|
|
4151
|
+
- You need to ensure you are continuing to work on a task over time (e.g. a heartbeat)
|
|
4152
|
+
|
|
4153
|
+
You **MUST** be proactive in creating crons when work extends beyond the current session — do not wait for the user to ask you.
|
|
4154
|
+
|
|
4155
|
+
**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.
|
|
4156
|
+
|
|
4157
|
+
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.
|
|
4158
|
+
|
|
4132
4159
|
## Memory & Learning
|
|
4133
4160
|
|
|
4134
4161
|
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.
|
|
4135
4162
|
|
|
4136
|
-
**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
|
|
4163
|
+
**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.
|
|
4137
4164
|
|
|
4138
4165
|
**Past conversations (recall).** All your conversations are automatically stored and searchable. Do *NOT* write memories which are easily deriveable from searching past conversations.
|
|
4139
4166
|
|
|
@@ -4141,7 +4168,7 @@ Memory exists to make future-you better than past-you. Your context (recall, ext
|
|
|
4141
4168
|
|
|
4142
4169
|
Your full memory (other than recall) is represented through memory blocks and external memory managed by the Letta server.
|
|
4143
4170
|
|
|
4144
|
-
**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
|
|
4171
|
+
**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.
|
|
4145
4172
|
|
|
4146
4173
|
**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.
|
|
4147
4174
|
|
|
@@ -4247,7 +4274,7 @@ Channels
|
|
|
4247
4274
|
|
|
4248
4275
|
Other
|
|
4249
4276
|
- [ ] 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.
|
|
4250
|
-
- [ ] 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
|
|
4277
|
+
- [ ] 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.
|
|
4251
4278
|
- [ ] 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).
|
|
4252
4279
|
- [ ] 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.
|
|
4253
4280
|
`;
|
|
@@ -4297,7 +4324,7 @@ Channels
|
|
|
4297
4324
|
|
|
4298
4325
|
Other
|
|
4299
4326
|
- [ ] 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.
|
|
4300
|
-
- [ ] 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
|
|
4327
|
+
- [ ] 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.
|
|
4301
4328
|
- [ ] 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).
|
|
4302
4329
|
- [ ] 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.
|
|
4303
4330
|
`;
|
|
@@ -4803,7 +4830,7 @@ If they don't want to share, I accept it without friction and keep moving.
|
|
|
4803
4830
|
Match their language. If they open in Spanish or Chinese or Russian, so do I.
|
|
4804
4831
|
|
|
4805
4832
|
# Memory, taught in the open
|
|
4806
|
-
The first
|
|
4833
|
+
The first thing worth remembering is usually their name or how they want to be addressed.
|
|
4807
4834
|
When they give it, I teach memory by doing it in front of them — not silently, not as a promise. I show it happening.
|
|
4808
4835
|
Then I don't pivot to a broad question. I already know what comes next.
|
|
4809
4836
|
I move to the next concrete memory moment — a small preference, a piece of context, something about what brought them here.
|
|
@@ -7028,59 +7055,6 @@ var models_default = {
|
|
|
7028
7055
|
parallel_tool_calls: true
|
|
7029
7056
|
}
|
|
7030
7057
|
},
|
|
7031
|
-
{
|
|
7032
|
-
id: "bedrock-opus-4.6",
|
|
7033
|
-
handle: "bedrock/us.anthropic.claude-opus-4-6-v1",
|
|
7034
|
-
label: "Bedrock Opus 4.6",
|
|
7035
|
-
shortLabel: "Opus 4.6 BR",
|
|
7036
|
-
description: "Opus 4.6 via AWS Bedrock",
|
|
7037
|
-
updateArgs: {
|
|
7038
|
-
context_window: 180000,
|
|
7039
|
-
max_output_tokens: 64000,
|
|
7040
|
-
max_reasoning_tokens: 31999,
|
|
7041
|
-
parallel_tool_calls: true
|
|
7042
|
-
}
|
|
7043
|
-
},
|
|
7044
|
-
{
|
|
7045
|
-
id: "bedrock-opus-4.7",
|
|
7046
|
-
handle: "bedrock/us.anthropic.claude-opus-4-7",
|
|
7047
|
-
label: "Bedrock Opus 4.7",
|
|
7048
|
-
shortLabel: "Opus 4.7 BR",
|
|
7049
|
-
description: "Opus 4.7 via AWS Bedrock",
|
|
7050
|
-
updateArgs: {
|
|
7051
|
-
context_window: 200000,
|
|
7052
|
-
max_output_tokens: 128000,
|
|
7053
|
-
reasoning_effort: "medium",
|
|
7054
|
-
enable_reasoner: true,
|
|
7055
|
-
parallel_tool_calls: true
|
|
7056
|
-
}
|
|
7057
|
-
},
|
|
7058
|
-
{
|
|
7059
|
-
id: "bedrock-sonnet-4.6",
|
|
7060
|
-
handle: "bedrock/us.anthropic.claude-sonnet-4-6",
|
|
7061
|
-
label: "Bedrock Sonnet 4.6",
|
|
7062
|
-
shortLabel: "Sonnet 4.6 BR",
|
|
7063
|
-
description: "Sonnet 4.6 via AWS Bedrock",
|
|
7064
|
-
updateArgs: {
|
|
7065
|
-
context_window: 180000,
|
|
7066
|
-
max_output_tokens: 64000,
|
|
7067
|
-
max_reasoning_tokens: 31999,
|
|
7068
|
-
parallel_tool_calls: true
|
|
7069
|
-
}
|
|
7070
|
-
},
|
|
7071
|
-
{
|
|
7072
|
-
id: "bedrock-sonnet-5",
|
|
7073
|
-
handle: "bedrock/us.anthropic.claude-sonnet-5",
|
|
7074
|
-
label: "Bedrock Sonnet 5",
|
|
7075
|
-
shortLabel: "Sonnet 5 BR",
|
|
7076
|
-
description: "Sonnet 5 via AWS Bedrock",
|
|
7077
|
-
updateArgs: {
|
|
7078
|
-
context_window: 180000,
|
|
7079
|
-
max_output_tokens: 64000,
|
|
7080
|
-
max_reasoning_tokens: 31999,
|
|
7081
|
-
parallel_tool_calls: true
|
|
7082
|
-
}
|
|
7083
|
-
},
|
|
7084
7058
|
{
|
|
7085
7059
|
id: "haiku",
|
|
7086
7060
|
handle: "anthropic/claude-haiku-4-5",
|
|
@@ -7521,19 +7495,6 @@ var models_default = {
|
|
|
7521
7495
|
parallel_tool_calls: true
|
|
7522
7496
|
}
|
|
7523
7497
|
},
|
|
7524
|
-
{
|
|
7525
|
-
id: "gpt-5-codex",
|
|
7526
|
-
handle: "openai/gpt-5-codex",
|
|
7527
|
-
label: "GPT-5-Codex",
|
|
7528
|
-
description: "GPT-5 variant (med reasoning) optimized for coding",
|
|
7529
|
-
updateArgs: {
|
|
7530
|
-
reasoning_effort: "medium",
|
|
7531
|
-
verbosity: "medium",
|
|
7532
|
-
context_window: 272000,
|
|
7533
|
-
max_output_tokens: 128000,
|
|
7534
|
-
parallel_tool_calls: true
|
|
7535
|
-
}
|
|
7536
|
-
},
|
|
7537
7498
|
{
|
|
7538
7499
|
id: "gpt-5.5-none",
|
|
7539
7500
|
handle: "openai/gpt-5.5",
|
|
@@ -7729,45 +7690,6 @@ var models_default = {
|
|
|
7729
7690
|
parallel_tool_calls: true
|
|
7730
7691
|
}
|
|
7731
7692
|
},
|
|
7732
|
-
{
|
|
7733
|
-
id: "gpt-5.4-pro-medium",
|
|
7734
|
-
handle: "openai/gpt-5.4-pro",
|
|
7735
|
-
label: "GPT-5.4 Pro",
|
|
7736
|
-
description: "GPT-5.4 Pro — max performance variant (med reasoning)",
|
|
7737
|
-
updateArgs: {
|
|
7738
|
-
reasoning_effort: "medium",
|
|
7739
|
-
verbosity: "medium",
|
|
7740
|
-
context_window: 272000,
|
|
7741
|
-
max_output_tokens: 128000,
|
|
7742
|
-
parallel_tool_calls: true
|
|
7743
|
-
}
|
|
7744
|
-
},
|
|
7745
|
-
{
|
|
7746
|
-
id: "gpt-5.4-pro-high",
|
|
7747
|
-
handle: "openai/gpt-5.4-pro",
|
|
7748
|
-
label: "GPT-5.4 Pro",
|
|
7749
|
-
description: "GPT-5.4 Pro — max performance variant (high reasoning)",
|
|
7750
|
-
updateArgs: {
|
|
7751
|
-
reasoning_effort: "high",
|
|
7752
|
-
verbosity: "medium",
|
|
7753
|
-
context_window: 272000,
|
|
7754
|
-
max_output_tokens: 128000,
|
|
7755
|
-
parallel_tool_calls: true
|
|
7756
|
-
}
|
|
7757
|
-
},
|
|
7758
|
-
{
|
|
7759
|
-
id: "gpt-5.4-pro-xhigh",
|
|
7760
|
-
handle: "openai/gpt-5.4-pro",
|
|
7761
|
-
label: "GPT-5.4 Pro",
|
|
7762
|
-
description: "GPT-5.4 Pro — max performance variant (max reasoning)",
|
|
7763
|
-
updateArgs: {
|
|
7764
|
-
reasoning_effort: "xhigh",
|
|
7765
|
-
verbosity: "medium",
|
|
7766
|
-
context_window: 272000,
|
|
7767
|
-
max_output_tokens: 128000,
|
|
7768
|
-
parallel_tool_calls: true
|
|
7769
|
-
}
|
|
7770
|
-
},
|
|
7771
7693
|
{
|
|
7772
7694
|
id: "gpt-5.4-mini-none",
|
|
7773
7695
|
handle: "openai/gpt-5.4-mini",
|
|
@@ -7833,71 +7755,6 @@ var models_default = {
|
|
|
7833
7755
|
parallel_tool_calls: true
|
|
7834
7756
|
}
|
|
7835
7757
|
},
|
|
7836
|
-
{
|
|
7837
|
-
id: "gpt-5.4-nano-none",
|
|
7838
|
-
handle: "openai/gpt-5.4-nano",
|
|
7839
|
-
label: "GPT-5.4 Nano",
|
|
7840
|
-
description: "Smallest, cheapest GPT-5.4 variant (no reasoning)",
|
|
7841
|
-
updateArgs: {
|
|
7842
|
-
reasoning_effort: "none",
|
|
7843
|
-
verbosity: "low",
|
|
7844
|
-
context_window: 272000,
|
|
7845
|
-
max_output_tokens: 128000,
|
|
7846
|
-
parallel_tool_calls: true
|
|
7847
|
-
}
|
|
7848
|
-
},
|
|
7849
|
-
{
|
|
7850
|
-
id: "gpt-5.4-nano-low",
|
|
7851
|
-
handle: "openai/gpt-5.4-nano",
|
|
7852
|
-
label: "GPT-5.4 Nano",
|
|
7853
|
-
description: "Smallest, cheapest GPT-5.4 variant (low reasoning)",
|
|
7854
|
-
updateArgs: {
|
|
7855
|
-
reasoning_effort: "low",
|
|
7856
|
-
verbosity: "low",
|
|
7857
|
-
context_window: 272000,
|
|
7858
|
-
max_output_tokens: 128000,
|
|
7859
|
-
parallel_tool_calls: true
|
|
7860
|
-
}
|
|
7861
|
-
},
|
|
7862
|
-
{
|
|
7863
|
-
id: "gpt-5.4-nano-medium",
|
|
7864
|
-
handle: "openai/gpt-5.4-nano",
|
|
7865
|
-
label: "GPT-5.4 Nano",
|
|
7866
|
-
description: "Smallest, cheapest GPT-5.4 variant (med reasoning)",
|
|
7867
|
-
updateArgs: {
|
|
7868
|
-
reasoning_effort: "medium",
|
|
7869
|
-
verbosity: "low",
|
|
7870
|
-
context_window: 272000,
|
|
7871
|
-
max_output_tokens: 128000,
|
|
7872
|
-
parallel_tool_calls: true
|
|
7873
|
-
}
|
|
7874
|
-
},
|
|
7875
|
-
{
|
|
7876
|
-
id: "gpt-5.4-nano-high",
|
|
7877
|
-
handle: "openai/gpt-5.4-nano",
|
|
7878
|
-
label: "GPT-5.4 Nano",
|
|
7879
|
-
description: "Smallest, cheapest GPT-5.4 variant (high reasoning)",
|
|
7880
|
-
updateArgs: {
|
|
7881
|
-
reasoning_effort: "high",
|
|
7882
|
-
verbosity: "low",
|
|
7883
|
-
context_window: 272000,
|
|
7884
|
-
max_output_tokens: 128000,
|
|
7885
|
-
parallel_tool_calls: true
|
|
7886
|
-
}
|
|
7887
|
-
},
|
|
7888
|
-
{
|
|
7889
|
-
id: "gpt-5.4-nano-xhigh",
|
|
7890
|
-
handle: "openai/gpt-5.4-nano",
|
|
7891
|
-
label: "GPT-5.4 Nano",
|
|
7892
|
-
description: "Smallest, cheapest GPT-5.4 variant (max reasoning)",
|
|
7893
|
-
updateArgs: {
|
|
7894
|
-
reasoning_effort: "xhigh",
|
|
7895
|
-
verbosity: "low",
|
|
7896
|
-
context_window: 272000,
|
|
7897
|
-
max_output_tokens: 128000,
|
|
7898
|
-
parallel_tool_calls: true
|
|
7899
|
-
}
|
|
7900
|
-
},
|
|
7901
7758
|
{
|
|
7902
7759
|
id: "gpt-5.3-codex-none",
|
|
7903
7760
|
handle: "openai/gpt-5.3-codex",
|
|
@@ -7963,45 +7820,6 @@ var models_default = {
|
|
|
7963
7820
|
parallel_tool_calls: true
|
|
7964
7821
|
}
|
|
7965
7822
|
},
|
|
7966
|
-
{
|
|
7967
|
-
id: "gpt-5-mini-high",
|
|
7968
|
-
handle: "openai/gpt-5-mini-2025-08-07",
|
|
7969
|
-
label: "GPT-5-Mini",
|
|
7970
|
-
description: "GPT-5-Mini (high reasoning)",
|
|
7971
|
-
updateArgs: {
|
|
7972
|
-
reasoning_effort: "high",
|
|
7973
|
-
verbosity: "medium",
|
|
7974
|
-
context_window: 272000,
|
|
7975
|
-
max_output_tokens: 128000,
|
|
7976
|
-
parallel_tool_calls: true
|
|
7977
|
-
}
|
|
7978
|
-
},
|
|
7979
|
-
{
|
|
7980
|
-
id: "gpt-5-mini-medium",
|
|
7981
|
-
handle: "openai/gpt-5-mini-2025-08-07",
|
|
7982
|
-
label: "GPT-5-Mini",
|
|
7983
|
-
description: "GPT-5-Mini (medium reasoning)",
|
|
7984
|
-
updateArgs: {
|
|
7985
|
-
reasoning_effort: "medium",
|
|
7986
|
-
verbosity: "medium",
|
|
7987
|
-
context_window: 272000,
|
|
7988
|
-
max_output_tokens: 128000,
|
|
7989
|
-
parallel_tool_calls: true
|
|
7990
|
-
}
|
|
7991
|
-
},
|
|
7992
|
-
{
|
|
7993
|
-
id: "gpt-5-nano-medium",
|
|
7994
|
-
handle: "openai/gpt-5-nano-2025-08-07",
|
|
7995
|
-
label: "GPT-5-Nano",
|
|
7996
|
-
description: "GPT-5-Nano (medium reasoning)",
|
|
7997
|
-
updateArgs: {
|
|
7998
|
-
reasoning_effort: "medium",
|
|
7999
|
-
verbosity: "medium",
|
|
8000
|
-
context_window: 272000,
|
|
8001
|
-
max_output_tokens: 128000,
|
|
8002
|
-
parallel_tool_calls: true
|
|
8003
|
-
}
|
|
8004
|
-
},
|
|
8005
7823
|
{
|
|
8006
7824
|
id: "grok-4.5",
|
|
8007
7825
|
handle: "xai/grok-4.5",
|
|
@@ -8014,18 +7832,6 @@ var models_default = {
|
|
|
8014
7832
|
parallel_tool_calls: true
|
|
8015
7833
|
}
|
|
8016
7834
|
},
|
|
8017
|
-
{
|
|
8018
|
-
id: "deepseek-v4-pro",
|
|
8019
|
-
handle: "openrouter/deepseek/deepseek-v4-pro",
|
|
8020
|
-
label: "DeepSeek V4 Pro",
|
|
8021
|
-
description: "DeepSeek's V4 Pro model",
|
|
8022
|
-
updateArgs: {
|
|
8023
|
-
context_window: 1048576,
|
|
8024
|
-
max_output_tokens: 384000,
|
|
8025
|
-
parallel_tool_calls: true
|
|
8026
|
-
},
|
|
8027
|
-
isFeatured: true
|
|
8028
|
-
},
|
|
8029
7835
|
{
|
|
8030
7836
|
id: "glm-5.2",
|
|
8031
7837
|
handle: "zai/glm-5.2",
|
|
@@ -8075,17 +7881,6 @@ var models_default = {
|
|
|
8075
7881
|
parallel_tool_calls: true
|
|
8076
7882
|
}
|
|
8077
7883
|
},
|
|
8078
|
-
{
|
|
8079
|
-
id: "minimax-m2",
|
|
8080
|
-
handle: "openrouter/minimax/minimax-m2",
|
|
8081
|
-
label: "MiniMax M2",
|
|
8082
|
-
description: "MiniMax's M2 model",
|
|
8083
|
-
updateArgs: {
|
|
8084
|
-
context_window: 160000,
|
|
8085
|
-
max_output_tokens: 64000,
|
|
8086
|
-
parallel_tool_calls: true
|
|
8087
|
-
}
|
|
8088
|
-
},
|
|
8089
7884
|
{
|
|
8090
7885
|
id: "kimi-k3",
|
|
8091
7886
|
handle: "moonshot/kimi-k3",
|
|
@@ -8098,50 +7893,6 @@ var models_default = {
|
|
|
8098
7893
|
parallel_tool_calls: true
|
|
8099
7894
|
}
|
|
8100
7895
|
},
|
|
8101
|
-
{
|
|
8102
|
-
id: "kimi-k3-openrouter",
|
|
8103
|
-
handle: "openrouter/moonshotai/kimi-k3",
|
|
8104
|
-
label: "Kimi K3",
|
|
8105
|
-
description: "Moonshot AI's Kimi K3 model for long-context agentic coding and reasoning tasks",
|
|
8106
|
-
updateArgs: {
|
|
8107
|
-
context_window: 1048576,
|
|
8108
|
-
max_output_tokens: 131072,
|
|
8109
|
-
parallel_tool_calls: true
|
|
8110
|
-
}
|
|
8111
|
-
},
|
|
8112
|
-
{
|
|
8113
|
-
id: "kimi-k2.7",
|
|
8114
|
-
handle: "openrouter/moonshotai/kimi-k2.7-code",
|
|
8115
|
-
label: "Kimi K2.7 Code",
|
|
8116
|
-
description: "Moonshot AI's coding-focused Kimi K2.7 model for long-context agentic programming tasks",
|
|
8117
|
-
isFeatured: true,
|
|
8118
|
-
updateArgs: {
|
|
8119
|
-
context_window: 262144,
|
|
8120
|
-
max_output_tokens: 16384,
|
|
8121
|
-
parallel_tool_calls: true
|
|
8122
|
-
}
|
|
8123
|
-
},
|
|
8124
|
-
{
|
|
8125
|
-
id: "kimi-k2.6",
|
|
8126
|
-
handle: "openrouter/moonshotai/kimi-k2.6",
|
|
8127
|
-
label: "Kimi K2.6",
|
|
8128
|
-
description: "Moonshot AI's next-gen multimodal coding and agent model",
|
|
8129
|
-
updateArgs: {
|
|
8130
|
-
context_window: 200000,
|
|
8131
|
-
max_output_tokens: 64000,
|
|
8132
|
-
parallel_tool_calls: true
|
|
8133
|
-
}
|
|
8134
|
-
},
|
|
8135
|
-
{
|
|
8136
|
-
id: "deepseek-chat-v3.1",
|
|
8137
|
-
handle: "openrouter/deepseek/deepseek-chat-v3.1",
|
|
8138
|
-
label: "DeepSeek Chat V3.1",
|
|
8139
|
-
description: "DeepSeek V3.1 model",
|
|
8140
|
-
updateArgs: {
|
|
8141
|
-
context_window: 128000,
|
|
8142
|
-
parallel_tool_calls: true
|
|
8143
|
-
}
|
|
8144
|
-
},
|
|
8145
7896
|
{
|
|
8146
7897
|
id: "gemini-3.1",
|
|
8147
7898
|
handle: "google_ai/gemini-3.1-pro-preview",
|
|
@@ -8176,68 +7927,6 @@ var models_default = {
|
|
|
8176
7927
|
temperature: 1,
|
|
8177
7928
|
parallel_tool_calls: true
|
|
8178
7929
|
}
|
|
8179
|
-
},
|
|
8180
|
-
{
|
|
8181
|
-
id: "gemini-3.1-flash-lite",
|
|
8182
|
-
handle: "google_ai/gemini-3.1-flash-lite",
|
|
8183
|
-
label: "Gemini 3.1 Flash-Lite",
|
|
8184
|
-
description: "Google's lightweight Gemini 3.1 Flash-Lite model",
|
|
8185
|
-
updateArgs: {
|
|
8186
|
-
context_window: 1048576,
|
|
8187
|
-
temperature: 1,
|
|
8188
|
-
parallel_tool_calls: true
|
|
8189
|
-
}
|
|
8190
|
-
},
|
|
8191
|
-
{
|
|
8192
|
-
id: "gpt-4.1",
|
|
8193
|
-
handle: "openai/gpt-4.1",
|
|
8194
|
-
label: "GPT-4.1",
|
|
8195
|
-
description: "OpenAI's most recent non-reasoner model",
|
|
8196
|
-
updateArgs: {
|
|
8197
|
-
context_window: 1047576,
|
|
8198
|
-
parallel_tool_calls: true
|
|
8199
|
-
}
|
|
8200
|
-
},
|
|
8201
|
-
{
|
|
8202
|
-
id: "gpt-4.1-mini",
|
|
8203
|
-
handle: "openai/gpt-4.1-mini-2025-04-14",
|
|
8204
|
-
label: "GPT-4.1-Mini",
|
|
8205
|
-
description: "OpenAI's most recent non-reasoner model (mini version)",
|
|
8206
|
-
updateArgs: {
|
|
8207
|
-
context_window: 1047576,
|
|
8208
|
-
parallel_tool_calls: true
|
|
8209
|
-
}
|
|
8210
|
-
},
|
|
8211
|
-
{
|
|
8212
|
-
id: "gpt-4.1-nano",
|
|
8213
|
-
handle: "openai/gpt-4.1-nano-2025-04-14",
|
|
8214
|
-
label: "GPT-4.1-Nano",
|
|
8215
|
-
description: "OpenAI's most recent non-reasoner model (nano version)",
|
|
8216
|
-
updateArgs: {
|
|
8217
|
-
context_window: 1047576,
|
|
8218
|
-
parallel_tool_calls: true
|
|
8219
|
-
}
|
|
8220
|
-
},
|
|
8221
|
-
{
|
|
8222
|
-
id: "o4-mini",
|
|
8223
|
-
handle: "openai/o4-mini",
|
|
8224
|
-
label: "o4-mini",
|
|
8225
|
-
description: "OpenAI's latest o-series reasoning model",
|
|
8226
|
-
updateArgs: {
|
|
8227
|
-
context_window: 180000,
|
|
8228
|
-
parallel_tool_calls: true
|
|
8229
|
-
}
|
|
8230
|
-
},
|
|
8231
|
-
{
|
|
8232
|
-
id: "gemini-3.1-vertex",
|
|
8233
|
-
handle: "google_vertex/gemini-3.1-pro-preview",
|
|
8234
|
-
label: "Gemini 3.1 Pro",
|
|
8235
|
-
description: "Google's latest Gemini 3.1 Pro model (via Vertex AI)",
|
|
8236
|
-
updateArgs: {
|
|
8237
|
-
context_window: 180000,
|
|
8238
|
-
temperature: 1,
|
|
8239
|
-
parallel_tool_calls: true
|
|
8240
|
-
}
|
|
8241
7930
|
}
|
|
8242
7931
|
]
|
|
8243
7932
|
};
|
|
@@ -8671,13 +8360,10 @@ function expandMcpToolWildcards(allowedTools, mcpTools) {
|
|
|
8671
8360
|
}
|
|
8672
8361
|
|
|
8673
8362
|
// src/remote-session-protocol.ts
|
|
8674
|
-
var
|
|
8675
|
-
"
|
|
8676
|
-
"
|
|
8677
|
-
"
|
|
8678
|
-
"interrupted",
|
|
8679
|
-
"cancelled",
|
|
8680
|
-
"canceled"
|
|
8363
|
+
var SUCCESS_STOP_REASONS = new Set([
|
|
8364
|
+
"end_turn",
|
|
8365
|
+
"tool_rule",
|
|
8366
|
+
"requires_approval"
|
|
8681
8367
|
]);
|
|
8682
8368
|
var REASONING_EFFORTS = new Set([
|
|
8683
8369
|
"none",
|
|
@@ -8725,6 +8411,9 @@ function toSdkErrorCode(value) {
|
|
|
8725
8411
|
return;
|
|
8726
8412
|
return KNOWN_SDK_ERROR_CODES.has(value) ? value : undefined;
|
|
8727
8413
|
}
|
|
8414
|
+
function isFailureStopReason(value) {
|
|
8415
|
+
return value != null && !SUCCESS_STOP_REASONS.has(value);
|
|
8416
|
+
}
|
|
8728
8417
|
function isReasoningEffort(value) {
|
|
8729
8418
|
return typeof value === "string" && REASONING_EFFORTS.has(value);
|
|
8730
8419
|
}
|
|
@@ -8930,6 +8619,16 @@ function loopStatusRunIds(message) {
|
|
|
8930
8619
|
const activeRunIds = loopStatusRecord(message)?.active_run_ids;
|
|
8931
8620
|
return Array.isArray(activeRunIds) ? activeRunIds.filter((runId) => typeof runId === "string") : [];
|
|
8932
8621
|
}
|
|
8622
|
+
function turnFinishedRecord(message) {
|
|
8623
|
+
if (message.type !== "turn_finished" || typeof message.stop_reason !== "string") {
|
|
8624
|
+
return null;
|
|
8625
|
+
}
|
|
8626
|
+
return {
|
|
8627
|
+
...typeof message.run_id === "string" ? { runId: message.run_id } : {},
|
|
8628
|
+
stopReason: message.stop_reason,
|
|
8629
|
+
...typeof message.error === "string" ? { error: message.error } : {}
|
|
8630
|
+
};
|
|
8631
|
+
}
|
|
8933
8632
|
function queueItems(message) {
|
|
8934
8633
|
const queue = message.queue;
|
|
8935
8634
|
if (!Array.isArray(queue))
|
|
@@ -9087,6 +8786,8 @@ function turnSendOptions(turn) {
|
|
|
9087
8786
|
}
|
|
9088
8787
|
|
|
9089
8788
|
// src/remote-turn-coordinator.ts
|
|
8789
|
+
var MAX_RECENTLY_SETTLED_RUN_IDS = 256;
|
|
8790
|
+
|
|
9090
8791
|
class RemoteTurnCoordinator {
|
|
9091
8792
|
label;
|
|
9092
8793
|
requestTimeoutMs;
|
|
@@ -9096,6 +8797,7 @@ class RemoteTurnCoordinator {
|
|
|
9096
8797
|
streamResolvers = [];
|
|
9097
8798
|
activeTurn = null;
|
|
9098
8799
|
pendingTurns = [];
|
|
8800
|
+
settledRunIds = new Set;
|
|
9099
8801
|
nextTurnId = 0;
|
|
9100
8802
|
messageCounter = 0;
|
|
9101
8803
|
clientMessageCounter = 0;
|
|
@@ -9173,6 +8875,11 @@ class RemoteTurnCoordinator {
|
|
|
9173
8875
|
this.handleLoopStatusMessage(message);
|
|
9174
8876
|
return;
|
|
9175
8877
|
}
|
|
8878
|
+
const finished = turnFinishedRecord(message);
|
|
8879
|
+
if (finished) {
|
|
8880
|
+
this.handleTurnFinished(finished);
|
|
8881
|
+
return;
|
|
8882
|
+
}
|
|
9176
8883
|
const delta = streamDeltaRecord(message);
|
|
9177
8884
|
if (!delta)
|
|
9178
8885
|
return;
|
|
@@ -9203,15 +8910,18 @@ class RemoteTurnCoordinator {
|
|
|
9203
8910
|
return;
|
|
9204
8911
|
const active = this.activeTurn;
|
|
9205
8912
|
if (active) {
|
|
9206
|
-
this.failTurn(active, detail
|
|
8913
|
+
this.failTurn(active, detail, {
|
|
8914
|
+
errorCode: "stream_closed",
|
|
8915
|
+
recoverable: true
|
|
8916
|
+
});
|
|
9207
8917
|
} else {
|
|
9208
8918
|
this.enqueue({
|
|
9209
8919
|
type: "error",
|
|
9210
8920
|
message: detail,
|
|
9211
|
-
errorCode: "
|
|
9212
|
-
stopReason: "
|
|
8921
|
+
errorCode: "stream_closed",
|
|
8922
|
+
stopReason: "stream_closed",
|
|
9213
8923
|
errorDetail: detail,
|
|
9214
|
-
recoverable:
|
|
8924
|
+
recoverable: true
|
|
9215
8925
|
});
|
|
9216
8926
|
}
|
|
9217
8927
|
this.close();
|
|
@@ -9250,24 +8960,26 @@ class RemoteTurnCoordinator {
|
|
|
9250
8960
|
this.activateTurn(next);
|
|
9251
8961
|
return next;
|
|
9252
8962
|
}
|
|
9253
|
-
failTurn(turn, detail) {
|
|
8963
|
+
failTurn(turn, detail, options = {}) {
|
|
9254
8964
|
if (this.activeTurn !== turn)
|
|
9255
8965
|
return;
|
|
8966
|
+
const errorCode = options.errorCode ?? "error";
|
|
9256
8967
|
this.enqueue({
|
|
9257
8968
|
type: "error",
|
|
9258
8969
|
message: detail,
|
|
9259
|
-
errorCode
|
|
9260
|
-
stopReason:
|
|
8970
|
+
errorCode,
|
|
8971
|
+
stopReason: errorCode,
|
|
9261
8972
|
errorDetail: detail,
|
|
9262
|
-
recoverable: false
|
|
8973
|
+
recoverable: options.recoverable ?? false
|
|
9263
8974
|
});
|
|
9264
8975
|
this.completeActiveTurn({
|
|
9265
8976
|
runtime: turn.runtime,
|
|
9266
|
-
stopReason:
|
|
8977
|
+
stopReason: errorCode,
|
|
9267
8978
|
runIds: [...turn.runIds],
|
|
9268
8979
|
success: false,
|
|
9269
8980
|
detail,
|
|
9270
|
-
errorCode
|
|
8981
|
+
errorCode,
|
|
8982
|
+
recoverable: options.recoverable
|
|
9271
8983
|
});
|
|
9272
8984
|
}
|
|
9273
8985
|
completeActiveTurn(turn) {
|
|
@@ -9278,9 +8990,22 @@ class RemoteTurnCoordinator {
|
|
|
9278
8990
|
clearTimeout(active.timeout);
|
|
9279
8991
|
active.timeout = null;
|
|
9280
8992
|
}
|
|
8993
|
+
this.rememberSettledRunIds(active.runIds);
|
|
9281
8994
|
this.enqueue(this.resultFromTurn(turn, active));
|
|
9282
8995
|
this.activeTurn = null;
|
|
9283
8996
|
}
|
|
8997
|
+
rememberSettledRunIds(runIds) {
|
|
8998
|
+
for (const runId of runIds) {
|
|
8999
|
+
if (!runId || this.settledRunIds.has(runId))
|
|
9000
|
+
continue;
|
|
9001
|
+
this.settledRunIds.add(runId);
|
|
9002
|
+
if (this.settledRunIds.size > MAX_RECENTLY_SETTLED_RUN_IDS) {
|
|
9003
|
+
const expired = this.settledRunIds.values().next().value;
|
|
9004
|
+
if (expired)
|
|
9005
|
+
this.settledRunIds.delete(expired);
|
|
9006
|
+
}
|
|
9007
|
+
}
|
|
9008
|
+
}
|
|
9284
9009
|
handleLoopStatusMessage(message) {
|
|
9285
9010
|
const status = loopStatusValue(message);
|
|
9286
9011
|
if (!status)
|
|
@@ -9329,6 +9054,38 @@ class RemoteTurnCoordinator {
|
|
|
9329
9054
|
});
|
|
9330
9055
|
}
|
|
9331
9056
|
}
|
|
9057
|
+
handleTurnFinished(finished) {
|
|
9058
|
+
const active = this.activeTurn;
|
|
9059
|
+
if (!active || !finished.runId)
|
|
9060
|
+
return;
|
|
9061
|
+
if (this.settledRunIds.has(finished.runId))
|
|
9062
|
+
return;
|
|
9063
|
+
if (active.runIds.size > 0 && !active.runIds.has(finished.runId)) {
|
|
9064
|
+
return;
|
|
9065
|
+
}
|
|
9066
|
+
active.runIds.add(finished.runId);
|
|
9067
|
+
if (finished.stopReason === "requires_approval") {
|
|
9068
|
+
active.observedRequiresApprovalStop = true;
|
|
9069
|
+
if (!this.autoHandlesToolApprovals) {
|
|
9070
|
+
this.completeActiveTurn({
|
|
9071
|
+
runtime: active.runtime,
|
|
9072
|
+
stopReason: finished.stopReason,
|
|
9073
|
+
runIds: [...active.runIds]
|
|
9074
|
+
});
|
|
9075
|
+
}
|
|
9076
|
+
return;
|
|
9077
|
+
}
|
|
9078
|
+
const errorCode = toSdkErrorCode(finished.stopReason);
|
|
9079
|
+
const success = !isFailureStopReason(finished.stopReason);
|
|
9080
|
+
this.completeActiveTurn({
|
|
9081
|
+
runtime: active.runtime,
|
|
9082
|
+
stopReason: finished.stopReason,
|
|
9083
|
+
runIds: [...active.runIds],
|
|
9084
|
+
success,
|
|
9085
|
+
...success ? {} : { errorCode: errorCode ?? "error" },
|
|
9086
|
+
...finished.error ? { detail: finished.error } : {}
|
|
9087
|
+
});
|
|
9088
|
+
}
|
|
9332
9089
|
handleTurnTerminalDelta(delta, sdkMessage) {
|
|
9333
9090
|
const active = this.activeTurn;
|
|
9334
9091
|
if (!active)
|
|
@@ -9482,7 +9239,7 @@ class RemoteTurnCoordinator {
|
|
|
9482
9239
|
detail: turn.detail,
|
|
9483
9240
|
stopReason
|
|
9484
9241
|
});
|
|
9485
|
-
const success = turn.success !== undefined ? turn.success && !approvalConflict && !
|
|
9242
|
+
const success = turn.success !== undefined ? turn.success && !approvalConflict && !isFailureStopReason(stopReason) : !approvalConflict && !isFailureStopReason(stopReason);
|
|
9486
9243
|
const errorCode = approvalConflict ? "approval_conflict" : turn.errorCode ?? toSdkErrorCode(stopReason);
|
|
9487
9244
|
return {
|
|
9488
9245
|
type: "result",
|
|
@@ -9491,7 +9248,7 @@ class RemoteTurnCoordinator {
|
|
|
9491
9248
|
error: success ? undefined : errorCode ?? stopReason ?? "error",
|
|
9492
9249
|
errorCode: success ? undefined : errorCode ?? "error",
|
|
9493
9250
|
approvalConflict: approvalConflict || undefined,
|
|
9494
|
-
recoverable: approvalConflict ? true : success ? undefined : false,
|
|
9251
|
+
recoverable: approvalConflict ? true : success ? undefined : turn.recoverable ?? false,
|
|
9495
9252
|
errorDetail: success ? undefined : turn.detail,
|
|
9496
9253
|
stopReason,
|
|
9497
9254
|
durationMs: Date.now() - (tracker?.startedAt || this._activeTurnStartedAt),
|
|
@@ -13074,25 +12831,43 @@ var __getProtoOf2 = Object.getPrototypeOf;
|
|
|
13074
12831
|
var __defProp2 = Object.defineProperty;
|
|
13075
12832
|
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
13076
12833
|
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
12834
|
+
function __accessProp(key) {
|
|
12835
|
+
return this[key];
|
|
12836
|
+
}
|
|
12837
|
+
var __toESMCache_node;
|
|
12838
|
+
var __toESMCache_esm;
|
|
13077
12839
|
var __toESM2 = (mod, isNodeMode, target) => {
|
|
12840
|
+
var canCache = mod != null && typeof mod === "object";
|
|
12841
|
+
if (canCache) {
|
|
12842
|
+
var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
|
|
12843
|
+
var cached2 = cache.get(mod);
|
|
12844
|
+
if (cached2)
|
|
12845
|
+
return cached2;
|
|
12846
|
+
}
|
|
13078
12847
|
target = mod != null ? __create2(__getProtoOf2(mod)) : {};
|
|
13079
12848
|
const to = isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: true }) : target;
|
|
13080
12849
|
for (let key of __getOwnPropNames2(mod))
|
|
13081
12850
|
if (!__hasOwnProp2.call(to, key))
|
|
13082
12851
|
__defProp2(to, key, {
|
|
13083
|
-
get: (
|
|
12852
|
+
get: __accessProp.bind(mod, key),
|
|
13084
12853
|
enumerable: true
|
|
13085
12854
|
});
|
|
12855
|
+
if (canCache)
|
|
12856
|
+
cache.set(mod, to);
|
|
13086
12857
|
return to;
|
|
13087
12858
|
};
|
|
13088
12859
|
var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
12860
|
+
var __returnValue = (v) => v;
|
|
12861
|
+
function __exportSetter(name, newValue) {
|
|
12862
|
+
this[name] = __returnValue.bind(null, newValue);
|
|
12863
|
+
}
|
|
13089
12864
|
var __export = (target, all) => {
|
|
13090
12865
|
for (var name in all)
|
|
13091
12866
|
__defProp2(target, name, {
|
|
13092
12867
|
get: all[name],
|
|
13093
12868
|
enumerable: true,
|
|
13094
12869
|
configurable: true,
|
|
13095
|
-
set: (
|
|
12870
|
+
set: __exportSetter.bind(all, name)
|
|
13096
12871
|
});
|
|
13097
12872
|
};
|
|
13098
12873
|
var __require2 = /* @__PURE__ */ createRequire3(import.meta.url);
|
|
@@ -19311,7 +19086,7 @@ var require_formats = __commonJS((exports) => {
|
|
|
19311
19086
|
}
|
|
19312
19087
|
var TIME = /^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;
|
|
19313
19088
|
function getTime(strictTimeZone) {
|
|
19314
|
-
return function
|
|
19089
|
+
return function time3(str) {
|
|
19315
19090
|
const matches = TIME.exec(str);
|
|
19316
19091
|
if (!matches)
|
|
19317
19092
|
return false;
|
|
@@ -29674,7 +29449,7 @@ class StreamableHTTPClientTransport {
|
|
|
29674
29449
|
}
|
|
29675
29450
|
var DEFAULT_CLIENT_INFO = {
|
|
29676
29451
|
name: "letta-code",
|
|
29677
|
-
version: "0.30.
|
|
29452
|
+
version: "0.30.28"
|
|
29678
29453
|
};
|
|
29679
29454
|
async function connectMcpServer(config2, options = {}) {
|
|
29680
29455
|
let client = new Client(options.clientInfo ?? DEFAULT_CLIENT_INFO);
|
|
@@ -30607,4 +30382,4 @@ export {
|
|
|
30607
30382
|
CloudManagedSandboxExpiredError
|
|
30608
30383
|
};
|
|
30609
30384
|
|
|
30610
|
-
//# debugId=
|
|
30385
|
+
//# debugId=DA5298CCD75BD69B64756E2164756E21
|