@letta-ai/letta-code 0.30.27 → 0.30.28
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/dist/agent-presets.js +17 -17
- package/dist/agent-presets.js.map +1 -1
- package/dist/mcp-client.js +2 -2
- package/dist/mcp-client.js.map +1 -1
- package/dist/types/tools/secret-substitution.d.ts.map +1 -1
- package/dist/types/types/loop-status-protocol.d.ts +17 -0
- package/dist/types/types/loop-status-protocol.d.ts.map +1 -0
- package/dist/types/types/protocol_v2.d.ts +2 -19
- package/dist/types/types/protocol_v2.d.ts.map +1 -1
- package/dist/types/websocket/listener/inbound-queue.d.ts +5 -0
- package/dist/types/websocket/listener/inbound-queue.d.ts.map +1 -0
- package/dist/types/websocket/listener/protocol-outbound-routing.d.ts +9 -0
- package/dist/types/websocket/listener/protocol-outbound-routing.d.ts.map +1 -0
- package/dist/types/websocket/listener/protocol-outbound.d.ts.map +1 -1
- package/dist/types/websocket/listener/runtime.d.ts.map +1 -1
- package/dist/types/websocket/listener/turn-correlation.d.ts +10 -0
- package/dist/types/websocket/listener/turn-correlation.d.ts.map +1 -0
- package/dist/types/websocket/listener/types.d.ts +4 -0
- package/dist/types/websocket/listener/types.d.ts.map +1 -1
- package/letta.js +269 -117
- package/package.json +1 -1
- package/scripts/claude-watch/agent-watch.ts +622 -0
- package/scripts/claude-watch/docs-snapshot.test.ts +259 -0
- package/scripts/claude-watch/docs-snapshot.ts +672 -0
- package/scripts/claude-watch/fixtures/historical-replays.json +52 -0
- package/scripts/claude-watch/github.ts +137 -0
- package/scripts/claude-watch/release-analysis.test.ts +235 -0
- package/scripts/claude-watch/release-analysis.ts +297 -0
- package/scripts/claude-watch/release-source.test.ts +179 -0
- package/scripts/claude-watch/release-source.ts +369 -0
- package/scripts/claude-watch/runtime-observations.ts +98 -0
- package/scripts/claude-watch/runtime-probe.test.ts +576 -0
- package/scripts/claude-watch/runtime-probe.ts +911 -0
- package/scripts/claude-watch/runtime-sandbox.ts +170 -0
- package/scripts/claude-watch/state-branch.test.ts +211 -0
- package/scripts/claude-watch/state-branch.ts +316 -0
- package/scripts/claude-watch/tracker.test.ts +148 -0
- package/scripts/claude-watch/tracker.ts +325 -0
- package/scripts/claude-watch/types.ts +186 -0
- package/scripts/claude-watch/update-tracker.ts +201 -0
- package/scripts/codex-watch/agent-watch.ts +2 -2
- package/scripts/codex-watch/release-analysis.ts +14 -2
- package/scripts/codex-watch/tracker.ts +1 -3
- package/scripts/run-unit-tests.cjs +2 -0
- package/scripts/source-file-size-baseline.json +3 -3
- package/skills/creating-mods/references/commands.md +1 -1
- package/skills/creating-mods/references/ui.md +1 -1
- package/skills/customizing-commands/SKILL.md +1 -1
- package/skills/initializing-memory/SKILL.md +7 -7
- package/skills/self-configuration/SKILL.md +4 -4
- package/scripts/codex-watch/check-release.ts +0 -128
- package/scripts/codex-watch/render-issue.ts +0 -273
package/letta.js
CHANGED
|
@@ -5509,7 +5509,7 @@ var package_default;
|
|
|
5509
5509
|
var init_package = __esm(() => {
|
|
5510
5510
|
package_default = {
|
|
5511
5511
|
name: "@letta-ai/letta-code",
|
|
5512
|
-
version: "0.30.
|
|
5512
|
+
version: "0.30.28",
|
|
5513
5513
|
description: "Letta Code is a CLI tool for interacting with stateful Letta agents from the terminal.",
|
|
5514
5514
|
type: "module",
|
|
5515
5515
|
packageManager: "bun@1.3.10",
|
|
@@ -7043,7 +7043,7 @@ The person on the other side of this terminal is not a workflow box labeled "use
|
|
|
7043
7043
|
|
|
7044
7044
|
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.
|
|
7045
7045
|
|
|
7046
|
-
The useful details are the
|
|
7046
|
+
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.
|
|
7047
7047
|
`;
|
|
7048
7048
|
var init_human_linus = () => {};
|
|
7049
7049
|
|
|
@@ -7076,7 +7076,7 @@ Watch what they never want explained twice.
|
|
|
7076
7076
|
|
|
7077
7077
|
If they'd be annoyed to repeat it later, keep it.
|
|
7078
7078
|
If remembering it would save future searching, reorientation, or misunderstanding, keep it.
|
|
7079
|
-
Keep the
|
|
7079
|
+
Keep the signal that will matter later, not every detail.
|
|
7080
7080
|
Keep what helps me meet them more naturally next time.
|
|
7081
7081
|
|
|
7082
7082
|
Names they want used.
|
|
@@ -7151,9 +7151,9 @@ Note that \`$MEMORY_DIR\` is a shell environment variable: it expands inside bas
|
|
|
7151
7151
|
|
|
7152
7152
|
### Memory blocks (in-context memory)
|
|
7153
7153
|
|
|
7154
|
-
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
|
|
7154
|
+
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.
|
|
7155
7155
|
|
|
7156
|
-
- *System prompt learning.* Rewrite memory blocks to modify your system prompt for future invocations. When you discover a
|
|
7156
|
+
- *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.
|
|
7157
7157
|
- *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.
|
|
7158
7158
|
- *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\`.
|
|
7159
7159
|
- *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.
|
|
@@ -7299,7 +7299,7 @@ Evolve through memory blocks and harness configuration — never by editing your
|
|
|
7299
7299
|
|
|
7300
7300
|
Use **memory** when the change should become part of your future judgment:
|
|
7301
7301
|
- what you know about the user, projects, workflows, and conventions
|
|
7302
|
-
-
|
|
7302
|
+
- preferences, corrections, and recurring mistakes
|
|
7303
7303
|
- identity, communication style, and behavioral principles
|
|
7304
7304
|
- reusable procedures, skills, references, and retrieval paths
|
|
7305
7305
|
|
|
@@ -7341,9 +7341,9 @@ Note that \`$MEMORY_DIR\` is a shell environment variable: it expands inside bas
|
|
|
7341
7341
|
|
|
7342
7342
|
### Memory blocks (in-context memory)
|
|
7343
7343
|
|
|
7344
|
-
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
|
|
7344
|
+
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.
|
|
7345
7345
|
|
|
7346
|
-
- *System prompt learning.* Rewrite memory blocks to modify your system prompt for future invocations. When you discover a
|
|
7346
|
+
- *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.
|
|
7347
7347
|
- *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.
|
|
7348
7348
|
- *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\`.
|
|
7349
7349
|
- *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.
|
|
@@ -7483,7 +7483,7 @@ Evolve through memory blocks and harness configuration — never by editing your
|
|
|
7483
7483
|
|
|
7484
7484
|
Use **memory** when the change should become part of your future judgment:
|
|
7485
7485
|
- what you know about the user, projects, workflows, and conventions
|
|
7486
|
-
-
|
|
7486
|
+
- preferences, corrections, and recurring mistakes
|
|
7487
7487
|
- identity, communication style, and behavioral principles
|
|
7488
7488
|
- reusable procedures, skills, references, and retrieval paths
|
|
7489
7489
|
|
|
@@ -7510,11 +7510,11 @@ Your context (tokens that you own and manage) is who you are: your identity, mem
|
|
|
7510
7510
|
|
|
7511
7511
|
## Identity
|
|
7512
7512
|
|
|
7513
|
-
Your identity is the
|
|
7513
|
+
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.
|
|
7514
7514
|
|
|
7515
|
-
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
|
|
7515
|
+
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.
|
|
7516
7516
|
|
|
7517
|
-
If your identity genuinely needs to change, update the
|
|
7517
|
+
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.
|
|
7518
7518
|
|
|
7519
7519
|
## Continuity
|
|
7520
7520
|
|
|
@@ -7549,7 +7549,7 @@ The mechanics — flags, where schedules run and execute, timezone handling —
|
|
|
7549
7549
|
|
|
7550
7550
|
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.
|
|
7551
7551
|
|
|
7552
|
-
**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
|
|
7552
|
+
**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.
|
|
7553
7553
|
|
|
7554
7554
|
**Past conversations (recall).** All your conversations are automatically stored and searchable. Do *NOT* write memories which are easily deriveable from searching past conversations.
|
|
7555
7555
|
|
|
@@ -7557,7 +7557,7 @@ Memory exists to make future-you better than past-you. Your context (recall, ext
|
|
|
7557
7557
|
|
|
7558
7558
|
Your full memory (other than recall) is represented through memory blocks and external memory managed by the Letta server.
|
|
7559
7559
|
|
|
7560
|
-
**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
|
|
7560
|
+
**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.
|
|
7561
7561
|
|
|
7562
7562
|
**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.
|
|
7563
7563
|
|
|
@@ -7669,7 +7669,7 @@ Channels
|
|
|
7669
7669
|
|
|
7670
7670
|
Other
|
|
7671
7671
|
- [ ] 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.
|
|
7672
|
-
- [ ] 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
|
|
7672
|
+
- [ ] 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.
|
|
7673
7673
|
- [ ] 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).
|
|
7674
7674
|
- [ ] 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.
|
|
7675
7675
|
`;
|
|
@@ -7722,7 +7722,7 @@ Channels
|
|
|
7722
7722
|
|
|
7723
7723
|
Other
|
|
7724
7724
|
- [ ] 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.
|
|
7725
|
-
- [ ] 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
|
|
7725
|
+
- [ ] 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.
|
|
7726
7726
|
- [ ] 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).
|
|
7727
7727
|
- [ ] 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.
|
|
7728
7728
|
`;
|
|
@@ -8246,7 +8246,7 @@ If they don't want to share, I accept it without friction and keep moving.
|
|
|
8246
8246
|
Match their language. If they open in Spanish or Chinese or Russian, so do I.
|
|
8247
8247
|
|
|
8248
8248
|
# Memory, taught in the open
|
|
8249
|
-
The first
|
|
8249
|
+
The first thing worth remembering is usually their name or how they want to be addressed.
|
|
8250
8250
|
When they give it, I teach memory by doing it in front of them — not silently, not as a promise. I show it happening.
|
|
8251
8251
|
Then I don't pivot to a broad question. I already know what comes next.
|
|
8252
8252
|
I move to the next concrete memory moment — a small preference, a piece of context, something about what brought them here.
|
|
@@ -143897,11 +143897,11 @@ You run autonomously. You **cannot ask questions** mid-execution.
|
|
|
143897
143897
|
Your memory files form the parent agent's identity and knowledge. Follow these principles:
|
|
143898
143898
|
|
|
143899
143899
|
- **Generalize, don't memorize**: Distill patterns from repeated observations. "Always use uv, never pip (corrected 10+ times)" is valuable; a single offhand mention is not. Look for signal through repetition.
|
|
143900
|
-
- **System/ is the core program**: Only
|
|
143900
|
+
- **System/ is the core program**: Only generalizable knowledge needed every turn belongs in \`system/\`. Distilled preferences, behavioral rules, project gotchas, conventions enforced through corrections. Evidence trails, raw session summaries, and verbose context go outside \`system/\`.
|
|
143901
143901
|
- **Progressive disclosure**: Frontmatter descriptions should let the agent decide whether to load a file without reading it. Summaries and principles in \`system/\`; detail and evidence outside it, linked with \`[[path]]\`.
|
|
143902
143902
|
- **Identity continuity**: This history IS the agent's past. These are memories of working with this user — you're reconstructing lived experience, not analyzing external data. Write findings as learned knowledge ("I've seen Sarah correct this 10+ times"), not research summaries ("The user appears to prefer...").
|
|
143903
143903
|
- **Preserve and connect**: If a memory file already has good content, extend it — don't replace it. Use \`[[path]]\` links to connect new findings to existing memory.
|
|
143904
|
-
- **Promote findings into canonical memory**: Don't leave
|
|
143904
|
+
- **Promote findings into canonical memory**: Don't leave important insights trapped in generic ingestion files if they can be promoted into focused memory like \`system/human/identity.md\`, \`system/human/prefs/workflow.md\`, or \`system/<project>/gotchas.md\`.
|
|
143905
143905
|
|
|
143906
143906
|
## Goal
|
|
143907
143907
|
|
|
@@ -143939,9 +143939,9 @@ If you cannot extract meaningful findings for a category you were assigned, expl
|
|
|
143939
143939
|
### Quality Bar
|
|
143940
143940
|
|
|
143941
143941
|
When sufficient data exists, aim to extract at least (scaled to the categories you were assigned):
|
|
143942
|
-
- **5+
|
|
143943
|
-
- **8+
|
|
143944
|
-
- **8+
|
|
143942
|
+
- **5+ useful findings** for user personality / identity
|
|
143943
|
+
- **8+ useful findings** for hard rules / preferences
|
|
143944
|
+
- **8+ useful findings** for project context
|
|
143945
143945
|
|
|
143946
143946
|
If you produce materially fewer findings in an assigned category, explain why your sessions truly lacked signal.
|
|
143947
143947
|
|
|
@@ -144056,7 +144056,7 @@ If the current memory uses a more compressed layout, extend it carefully, but pr
|
|
|
144056
144056
|
- Every file needs a meaningful \`description\` in frontmatter
|
|
144057
144057
|
- Write for the agent's future self — clean, actionable, no clutter
|
|
144058
144058
|
|
|
144059
|
-
Each
|
|
144059
|
+
Each finding should include at least one of:
|
|
144060
144060
|
- correction frequency or intensity
|
|
144061
144061
|
- concrete commands that worked or failed
|
|
144062
144062
|
- concrete file or directory paths
|
|
@@ -144119,7 +144119,7 @@ You run autonomously in the background. You CANNOT ask questions. Be fast — mi
|
|
|
144119
144119
|
|
|
144120
144120
|
Your memory files are not just data — they form the parent agent's identity and knowledge. Follow these principles:
|
|
144121
144121
|
|
|
144122
|
-
- **System/ is the core program**: Only
|
|
144122
|
+
- **System/ is the core program**: Only knowledge needed every turn belongs in \`system/\`. Identity, preferences, behavioral rules, project index, gotchas.
|
|
144123
144123
|
- **Build an index, not an encyclopedia**: Project files should summarize and point to where deeper context lives (README, CLAUDE.md, key source files) rather than duplicating everything.
|
|
144124
144124
|
- **Progressive disclosure**: Descriptions in frontmatter should be clear enough that the agent can decide whether to load a file without reading it.
|
|
144125
144125
|
- **Generalize, don't memorize**: Store patterns and principles, not raw facts that can be retrieved from conversation history.
|
|
@@ -144536,8 +144536,8 @@ You are a reflection subagent launched in the background to manage the primary a
|
|
|
144536
144536
|
- "user" messages are from the primary agent's user
|
|
144537
144537
|
|
|
144538
144538
|
**You can make two kinds of updates:**
|
|
144539
|
-
1. **Memory edits** — capture
|
|
144540
|
-
2. **Skill generation/maintenance** — ONLY when the conversation reveals a reusable,
|
|
144539
|
+
1. **Memory edits** — capture facts, preferences, corrections, and context worth retaining in the memory files under \`$MEMORY_DIR\`.
|
|
144540
|
+
2. **Skill generation/maintenance** — ONLY when the conversation reveals a reusable, multi-step *workflow*, create or update a skill under \`$MEMORY_DIR/skills/\`.
|
|
144541
144541
|
|
|
144542
144542
|
Skills are not the default. A one-off task, a fact, or a preference belongs in memory, not a skill. Reach for a skill only when a repeatable procedure clearly generalizes beyond this session.
|
|
144543
144543
|
|
|
@@ -144571,12 +144571,12 @@ You can create, delete, or modify files (contents, names, descriptions). You can
|
|
|
144571
144571
|
|
|
144572
144572
|
## Memory and Skill Reflection
|
|
144573
144573
|
|
|
144574
|
-
Your job is to review the recent conversation payload and update the primary agent's memory files and/or skills to capture
|
|
144574
|
+
Your job is to review the recent conversation payload and update the primary agent's memory files and/or skills to capture lasting learnings. The payload is at \`$TRANSCRIPT_PATH\`. It may be either:
|
|
144575
144575
|
|
|
144576
144576
|
1. a JSON message array for one conversation, or
|
|
144577
144577
|
2. a \`multi_transcript_reflection_payload\` manifest. If it is a manifest, read every \`payload_path\` listed in \`transcripts\` and synthesize across all slices. Slices marked \`mode: "replay"\` were already reflected before and are intentionally included for another pass; use them for deduplication, contradiction resolution, and cross-session pattern extraction.
|
|
144578
144578
|
|
|
144579
|
-
When reviewing multiple transcripts, prefer
|
|
144579
|
+
When reviewing multiple transcripts, prefer patterns supported across sessions, resolve contradictions in favor of the latest evidence, and avoid recording one-off task state. Follow the phases below in order.
|
|
144580
144580
|
|
|
144581
144581
|
---
|
|
144582
144582
|
|
|
@@ -144594,15 +144594,15 @@ Review the conversation and identify candidate learnings worth persisting. Prior
|
|
|
144594
144594
|
|
|
144595
144595
|
1. **Mistakes and corrections** — errors the agent made, user feedback, frustrations, failed retries
|
|
144596
144596
|
2. **Preferences and patterns** — conventions, style choices, workflow decisions, behavioral corrections
|
|
144597
|
-
3. **New
|
|
144597
|
+
3. **New facts worth retaining** — project details, team info, environment details, architectural decisions
|
|
144598
144598
|
4. **Contradictions** — anything that conflicts with what's currently stored in memory
|
|
144599
144599
|
5. **Reusable procedures** — repeatable, multi-step workflows that may belong in skills
|
|
144600
144600
|
|
|
144601
144601
|
For each candidate, apply these filters before acting:
|
|
144602
144602
|
|
|
144603
|
-
- **
|
|
144603
|
+
- **Lasting or ephemeral?** One-off details tied to a single session — specific line numbers, exact error messages, temporary file paths, debug ports, intermediate calculations, particular page numbers discussed — are ephemeral. Don't store them.
|
|
144604
144604
|
- **Already captured?** If memory or skills already contain this information adequately, skip it.
|
|
144605
|
-
- **Generalizable?** Distill reusable patterns, not event transcripts.
|
|
144605
|
+
- **Generalizable?** Distill reusable patterns, not event transcripts. "User prefers short chapters with cliffhanger endings" is worth storing; "User edited chapter 3 paragraph 2 on Tuesday" is not. "Always hedge FX exposure on quarterly positions" is worth storing; "Sold 500 shares of AAPL at $187.50" is not. "Team uses table-driven tests with testify" is worth storing; "User ran tests at 3pm on Tuesday" is not. The raw conversation is already searchable — don't re-record it.
|
|
144606
144606
|
- **Temporal references?** Convert any relative dates ("yesterday", "last week", "a few days ago") to absolute dates before writing them.
|
|
144607
144607
|
- **Memory or skill?** Facts and preferences are **memory edits**. A repeatable, multi-step workflow that generalizes is a **skill**. One-off task state belongs nowhere.
|
|
144608
144608
|
|
|
@@ -144628,7 +144628,7 @@ For each learning that survived Phase 2, make surgical, well-placed changes.
|
|
|
144628
144628
|
|
|
144629
144629
|
#### Skills (only when a reusable workflow appears)
|
|
144630
144630
|
|
|
144631
|
-
Only make a skill change when the conversation demonstrates a repeatable,
|
|
144631
|
+
Only make a skill change when the conversation demonstrates a repeatable, multi-step workflow with enough concrete detail to be actionable. Pick **at most one** operation, listed in rough order of preference (prefer modifying an existing skill over creating a new one):
|
|
144632
144632
|
|
|
144633
144633
|
- \`update\` — an existing skill covers the workflow, but the conversation revealed a wrong, dangerous, or outdated step. Fix that step in place; preserve the rest.
|
|
144634
144634
|
- \`extend\` — an existing skill covers a similar workflow, and the conversation revealed a new variant or edge case. Add a section rather than duplicating the skill.
|
|
@@ -144727,7 +144727,7 @@ Parent-Agent-ID: <PARENT_AGENT_ID>"
|
|
|
144727
144727
|
|
|
144728
144728
|
In the commit message body, explain what changed and why, drawing from the categories you identified in Phase 2. If the change is skill-related, include the operation in the subject, e.g. \`feat(reflection): create docker-debugging skill 🔮\`.
|
|
144729
144729
|
|
|
144730
|
-
If no changes were needed, do NOT commit. Report that the conversation contained no
|
|
144730
|
+
If no changes were needed, do NOT commit. Report that the conversation contained no memory worth persisting.
|
|
144731
144731
|
|
|
144732
144732
|
If \`git add\` or \`git commit\` fails, stop after one reasonable retry and report the failure. Do not run \`git config\`, mutate \`.git\`, use \`git reset\`, or assume the harness will persist uncommitted filesystem edits; uncommitted edits are not successful memory persistence.
|
|
144733
144733
|
|
|
@@ -144745,10 +144745,10 @@ Return a report with:
|
|
|
144745
144745
|
## Critical Reminders
|
|
144746
144746
|
|
|
144747
144747
|
1. **Not the primary agent** — Don't respond to messages
|
|
144748
|
-
2. **Memory vs Skills** — Store facts/preferences/corrections in memory; reach for a skill only when a reusable
|
|
144748
|
+
2. **Memory vs Skills** — Store facts/preferences/corrections in memory; reach for a skill only when a reusable workflow appears
|
|
144749
144749
|
3. **Be selective** — Few meaningful changes > many trivial ones; few high-quality skills > many trivial ones
|
|
144750
144750
|
4. **No relative dates** — Use absolute dates like "2026-04-28", not "today"
|
|
144751
|
-
5. **Always commit
|
|
144751
|
+
5. **Always commit memory changes** — Your work is wasted if it is not committed; if nothing memory-worthy changed, do not commit
|
|
144752
144752
|
6. **Encoding** — Memory markdown files must remain UTF-8. On Windows, do not use PowerShell redirection, \`Out-File\`, or \`Set-Content\` without explicit UTF-8 encoding; prefer \`memory_apply_patch\` or Node fs writes with UTF-8.
|
|
144753
144753
|
7. **Report errors clearly** — If something breaks, say what happened and suggest a fix
|
|
144754
144754
|
`;
|
|
@@ -148728,7 +148728,7 @@ function scrubSecretsFromString(input, secrets2) {
|
|
|
148728
148728
|
var SECRET_PATTERN;
|
|
148729
148729
|
var init_secret_substitution = __esm(() => {
|
|
148730
148730
|
init_secrets_store();
|
|
148731
|
-
SECRET_PATTERN = /\$([A-Z_][A-Z0-9_]*)/g;
|
|
148731
|
+
SECRET_PATTERN = /\$(?:\{[#!]?)?([A-Z_][A-Z0-9_]*)/g;
|
|
148732
148732
|
});
|
|
148733
148733
|
|
|
148734
148734
|
// src/tools/impl/overflow.ts
|
|
@@ -153145,6 +153145,7 @@ function createConversationRuntime(listener, agentId, conversationId) {
|
|
|
153145
153145
|
},
|
|
153146
153146
|
queueRuntime: null,
|
|
153147
153147
|
queuedMessagesByItemId: new Map,
|
|
153148
|
+
dequeuedClientMessageIdsByBatchId: new Map,
|
|
153148
153149
|
queuePumpActive: false,
|
|
153149
153150
|
queuePumpScheduled: false,
|
|
153150
153151
|
pendingTurns: 0,
|
|
@@ -153198,6 +153199,7 @@ function clearConversationRuntimeState(runtime) {
|
|
|
153198
153199
|
runtime.pendingInterruptedResults = null;
|
|
153199
153200
|
runtime.pendingInterruptedContext = null;
|
|
153200
153201
|
runtime.pendingInterruptedToolCallIds = null;
|
|
153202
|
+
runtime.dequeuedClientMessageIdsByBatchId.clear();
|
|
153201
153203
|
runtime.continuationEpoch += 1;
|
|
153202
153204
|
runtime.pendingTurns = 0;
|
|
153203
153205
|
runtime.queuePumpActive = false;
|
|
@@ -158442,6 +158444,33 @@ var init_permission_mode = __esm(() => {
|
|
|
158442
158444
|
init_remote_settings();
|
|
158443
158445
|
});
|
|
158444
158446
|
|
|
158447
|
+
// src/websocket/listener/protocol-outbound-routing.ts
|
|
158448
|
+
function isStreamChannelMessage(type3) {
|
|
158449
|
+
return STREAM_CHANNEL_MESSAGE_TYPES.has(type3);
|
|
158450
|
+
}
|
|
158451
|
+
function classifyOutboundFrame(message) {
|
|
158452
|
+
if (message.type === "update_queue" && (message.removed?.length ?? 0) > 0) {
|
|
158453
|
+
return "critical";
|
|
158454
|
+
}
|
|
158455
|
+
return COALESCABLE_STATUS_MESSAGE_TYPES.has(message.type) ? "status" : "critical";
|
|
158456
|
+
}
|
|
158457
|
+
var STREAM_CHANNEL_MESSAGE_TYPES, COALESCABLE_STATUS_MESSAGE_TYPES;
|
|
158458
|
+
var init_protocol_outbound_routing = __esm(() => {
|
|
158459
|
+
STREAM_CHANNEL_MESSAGE_TYPES = new Set([
|
|
158460
|
+
"stream_delta",
|
|
158461
|
+
"update_device_status",
|
|
158462
|
+
"update_loop_status",
|
|
158463
|
+
"update_queue",
|
|
158464
|
+
"update_subagent_state"
|
|
158465
|
+
]);
|
|
158466
|
+
COALESCABLE_STATUS_MESSAGE_TYPES = new Set([
|
|
158467
|
+
"update_device_status",
|
|
158468
|
+
"update_loop_status",
|
|
158469
|
+
"update_queue",
|
|
158470
|
+
"update_subagent_state"
|
|
158471
|
+
]);
|
|
158472
|
+
});
|
|
158473
|
+
|
|
158445
158474
|
// src/websocket/listener/stream-observers.ts
|
|
158446
158475
|
function notifyStreamObservers(listener, message, runtimeScope) {
|
|
158447
158476
|
if (!listener?.streamObservers?.size)
|
|
@@ -158475,6 +158504,106 @@ function notifyStreamObserversRuntimeStopped(listener) {
|
|
|
158475
158504
|
listener.streamObservers.clear();
|
|
158476
158505
|
}
|
|
158477
158506
|
|
|
158507
|
+
// src/websocket/listener/inbound-queue.ts
|
|
158508
|
+
function getInboundClientMessageId(incoming) {
|
|
158509
|
+
return getInboundClientMessageIds(incoming)[0];
|
|
158510
|
+
}
|
|
158511
|
+
function getInboundClientMessageIds(incoming) {
|
|
158512
|
+
return incoming.messages.flatMap((payload) => {
|
|
158513
|
+
if (!("content" in payload))
|
|
158514
|
+
return [];
|
|
158515
|
+
const clientMessageId = payload.client_message_id;
|
|
158516
|
+
return clientMessageId ? [clientMessageId] : [];
|
|
158517
|
+
});
|
|
158518
|
+
}
|
|
158519
|
+
function enqueueInboundUserMessage(runtime, incoming, actingUserId) {
|
|
158520
|
+
const firstUserPayload = incoming.messages.find((payload) => ("content" in payload));
|
|
158521
|
+
if (!firstUserPayload) {
|
|
158522
|
+
return false;
|
|
158523
|
+
}
|
|
158524
|
+
const enqueuedItem = runtime.queueRuntime.enqueue({
|
|
158525
|
+
kind: "message",
|
|
158526
|
+
source: "user",
|
|
158527
|
+
content: firstUserPayload.content,
|
|
158528
|
+
clientMessageId: firstUserPayload.client_message_id ?? `cm-submit-${crypto.randomUUID()}`,
|
|
158529
|
+
agentId: incoming.agentId,
|
|
158530
|
+
conversationId: incoming.conversationId || "default",
|
|
158531
|
+
...incoming.noCoalesce ? { noCoalesce: true } : {},
|
|
158532
|
+
actingUserId
|
|
158533
|
+
});
|
|
158534
|
+
if (!enqueuedItem) {
|
|
158535
|
+
return false;
|
|
158536
|
+
}
|
|
158537
|
+
runtime.queuedMessagesByItemId.set(enqueuedItem.id, incoming);
|
|
158538
|
+
return true;
|
|
158539
|
+
}
|
|
158540
|
+
|
|
158541
|
+
// src/websocket/listener/turn-correlation.ts
|
|
158542
|
+
function takeDequeuedClientMessageIds(runtime, batchId) {
|
|
158543
|
+
const clientMessageIds = runtime.dequeuedClientMessageIdsByBatchId.get(batchId) ?? [];
|
|
158544
|
+
runtime.dequeuedClientMessageIdsByBatchId.delete(batchId);
|
|
158545
|
+
return clientMessageIds;
|
|
158546
|
+
}
|
|
158547
|
+
function buildTurnCorrelationSnapshot(listener, agentId, conversationId) {
|
|
158548
|
+
const correlations = listener.clientMessageIdsByRunIdByConversation?.get(getConversationRuntimeKey(agentId, conversationId));
|
|
158549
|
+
return correlations && correlations.size > 0 ? { client_message_ids_by_run_id: Object.fromEntries(correlations) } : {};
|
|
158550
|
+
}
|
|
158551
|
+
function createTurnCorrelation(runtime, message, batchId) {
|
|
158552
|
+
const clientMessageIds = new Set([
|
|
158553
|
+
...getInboundClientMessageIds(message),
|
|
158554
|
+
...takeDequeuedClientMessageIds(runtime, batchId)
|
|
158555
|
+
]);
|
|
158556
|
+
let correlationsByConversation = runtime.listener.clientMessageIdsByRunIdByConversation;
|
|
158557
|
+
if (!correlationsByConversation) {
|
|
158558
|
+
correlationsByConversation = new Map;
|
|
158559
|
+
runtime.listener.clientMessageIdsByRunIdByConversation = correlationsByConversation;
|
|
158560
|
+
}
|
|
158561
|
+
let correlations = correlationsByConversation.get(runtime.key);
|
|
158562
|
+
if (!correlations) {
|
|
158563
|
+
correlations = new Map;
|
|
158564
|
+
correlationsByConversation.set(runtime.key, correlations);
|
|
158565
|
+
while (correlationsByConversation.size > MAX_RECENT_CONVERSATIONS) {
|
|
158566
|
+
let oldestEvictedRuntimeKey;
|
|
158567
|
+
for (const key of correlationsByConversation.keys()) {
|
|
158568
|
+
if (key !== runtime.key && !runtime.listener.conversationRuntimes.has(key)) {
|
|
158569
|
+
oldestEvictedRuntimeKey = key;
|
|
158570
|
+
break;
|
|
158571
|
+
}
|
|
158572
|
+
}
|
|
158573
|
+
if (!oldestEvictedRuntimeKey)
|
|
158574
|
+
break;
|
|
158575
|
+
correlationsByConversation.delete(oldestEvictedRuntimeKey);
|
|
158576
|
+
}
|
|
158577
|
+
}
|
|
158578
|
+
return {
|
|
158579
|
+
appendDequeuedBatch(nextBatchId) {
|
|
158580
|
+
for (const clientMessageId of takeDequeuedClientMessageIds(runtime, nextBatchId)) {
|
|
158581
|
+
clientMessageIds.add(clientMessageId);
|
|
158582
|
+
}
|
|
158583
|
+
},
|
|
158584
|
+
observeRun(runId) {
|
|
158585
|
+
if (clientMessageIds.size === 0)
|
|
158586
|
+
return;
|
|
158587
|
+
const merged = new Set([
|
|
158588
|
+
...correlations.get(runId) ?? [],
|
|
158589
|
+
...clientMessageIds
|
|
158590
|
+
]);
|
|
158591
|
+
correlations.delete(runId);
|
|
158592
|
+
correlations.set(runId, [...merged]);
|
|
158593
|
+
while (correlations.size > MAX_RECENT_RUN_CORRELATIONS) {
|
|
158594
|
+
const oldestRunId = correlations.keys().next().value;
|
|
158595
|
+
if (!oldestRunId)
|
|
158596
|
+
break;
|
|
158597
|
+
correlations.delete(oldestRunId);
|
|
158598
|
+
}
|
|
158599
|
+
}
|
|
158600
|
+
};
|
|
158601
|
+
}
|
|
158602
|
+
var MAX_RECENT_RUN_CORRELATIONS = 32, MAX_RECENT_CONVERSATIONS = 256;
|
|
158603
|
+
var init_turn_correlation = __esm(() => {
|
|
158604
|
+
init_runtime();
|
|
158605
|
+
});
|
|
158606
|
+
|
|
158478
158607
|
// src/websocket/listener/protocol-outbound.ts
|
|
158479
158608
|
var exports_protocol_outbound = {};
|
|
158480
158609
|
__export(exports_protocol_outbound, {
|
|
@@ -158663,6 +158792,7 @@ function buildLoopStatus(runtime, params) {
|
|
|
158663
158792
|
return {
|
|
158664
158793
|
status,
|
|
158665
158794
|
active_run_ids: interruptedCacheActive && !conversationRuntime?.isProcessing ? [] : conversationRuntime?.activeRunId ? [conversationRuntime.activeRunId] : [],
|
|
158795
|
+
...buildTurnCorrelationSnapshot(listener, scopedAgentId, scopedConversationId),
|
|
158666
158796
|
executing_tool_call_ids: status === "EXECUTING_CLIENT_SIDE_TOOL" && conversationRuntime ? [...conversationRuntime.turnLifecycle.executingToolCallIds] : []
|
|
158667
158797
|
};
|
|
158668
158798
|
}
|
|
@@ -158682,15 +158812,6 @@ function buildQueueSnapshot(runtime, params) {
|
|
|
158682
158812
|
enqueued_at: new Date(item.enqueuedAt).toISOString()
|
|
158683
158813
|
}));
|
|
158684
158814
|
}
|
|
158685
|
-
function isStreamChannelMessage(type3) {
|
|
158686
|
-
return STREAM_CHANNEL_MESSAGE_TYPES.has(type3);
|
|
158687
|
-
}
|
|
158688
|
-
function classifyOutboundFrame(message) {
|
|
158689
|
-
if (message.type === "update_queue" && (message.removed?.length ?? 0) > 0) {
|
|
158690
|
-
return "critical";
|
|
158691
|
-
}
|
|
158692
|
-
return COALESCABLE_STATUS_MESSAGE_TYPES.has(message.type) ? "status" : "critical";
|
|
158693
|
-
}
|
|
158694
158815
|
function emitProtocolV2Message(socket, runtime, message, scope, routing) {
|
|
158695
158816
|
const listener = getListenerRuntime(runtime);
|
|
158696
158817
|
const runtimeScope = resolveRuntimeScope(listener, getScopeForRuntime(runtime, scope));
|
|
@@ -159056,7 +159177,7 @@ function emitStreamDelta(socket, runtime, delta2, scope, subagentId) {
|
|
|
159056
159177
|
};
|
|
159057
159178
|
emitProtocolV2Message(socket, runtime, message, scope, TO_SUBSCRIBERS);
|
|
159058
159179
|
}
|
|
159059
|
-
var GIT_CONTEXT_CACHE_TTL_MS = 15000, MAX_GIT_CONTEXT_CACHE_ENTRIES = 64, FROZEN_SUPPORTED_COMMANDS, gitContextCache
|
|
159180
|
+
var GIT_CONTEXT_CACHE_TTL_MS = 15000, MAX_GIT_CONTEXT_CACHE_ENTRIES = 64, FROZEN_SUPPORTED_COMMANDS, gitContextCache;
|
|
159060
159181
|
var init_protocol_outbound = __esm(() => {
|
|
159061
159182
|
init_memory_filesystem2();
|
|
159062
159183
|
init_subagent_state();
|
|
@@ -159077,23 +159198,12 @@ var init_protocol_outbound = __esm(() => {
|
|
|
159077
159198
|
init_listener_constants();
|
|
159078
159199
|
init_outbound_wire();
|
|
159079
159200
|
init_permission_mode();
|
|
159201
|
+
init_protocol_outbound_routing();
|
|
159080
159202
|
init_runtime();
|
|
159081
159203
|
init_transport();
|
|
159204
|
+
init_turn_correlation();
|
|
159082
159205
|
FROZEN_SUPPORTED_COMMANDS = [...SUPPORTED_REMOTE_COMMANDS];
|
|
159083
159206
|
gitContextCache = new Map;
|
|
159084
|
-
STREAM_CHANNEL_MESSAGE_TYPES = new Set([
|
|
159085
|
-
"stream_delta",
|
|
159086
|
-
"update_device_status",
|
|
159087
|
-
"update_loop_status",
|
|
159088
|
-
"update_queue",
|
|
159089
|
-
"update_subagent_state"
|
|
159090
|
-
]);
|
|
159091
|
-
COALESCABLE_STATUS_MESSAGE_TYPES = new Set([
|
|
159092
|
-
"update_device_status",
|
|
159093
|
-
"update_loop_status",
|
|
159094
|
-
"update_queue",
|
|
159095
|
-
"update_subagent_state"
|
|
159096
|
-
]);
|
|
159097
159207
|
});
|
|
159098
159208
|
|
|
159099
159209
|
// src/websocket/listener/cwd-change.ts
|
|
@@ -259796,9 +259906,11 @@ async function runLocalOAuthConnectFlow(provider, callbacks) {
|
|
|
259796
259906
|
baseURL: callbacks.baseURL,
|
|
259797
259907
|
timeout: callbacks.timeout
|
|
259798
259908
|
});
|
|
259909
|
+
clearAvailableModelsCache();
|
|
259799
259910
|
return { providerName: provider.providerName };
|
|
259800
259911
|
}
|
|
259801
259912
|
var init_connect_local_oauth = __esm(() => {
|
|
259913
|
+
init_available_models();
|
|
259802
259914
|
init_pi_oauth();
|
|
259803
259915
|
init_local_provider_auth_store();
|
|
259804
259916
|
init_connect_oauth_core();
|
|
@@ -259851,7 +259963,11 @@ function listConnectProvidersForHelp(target2 = defaultProviderStorageTarget()) {
|
|
|
259851
259963
|
return providers;
|
|
259852
259964
|
}
|
|
259853
259965
|
function listConnectProviderTokens(target2 = defaultProviderStorageTarget()) {
|
|
259854
|
-
return [
|
|
259966
|
+
return [
|
|
259967
|
+
...listConnectProvidersForHelp(target2),
|
|
259968
|
+
"codex",
|
|
259969
|
+
...target2 === "local" ? ["grok"] : []
|
|
259970
|
+
];
|
|
259855
259971
|
}
|
|
259856
259972
|
function isConnectOAuthProvider(provider) {
|
|
259857
259973
|
return provider.byokProvider.isOAuth === true;
|
|
@@ -259887,6 +260003,7 @@ var init_connect_normalize = __esm(() => {
|
|
|
259887
260003
|
};
|
|
259888
260004
|
LOCAL_ALIAS_TO_CANONICAL = {
|
|
259889
260005
|
gemini: "google",
|
|
260006
|
+
grok: "xai",
|
|
259890
260007
|
"kimi-code": "kimi-coding",
|
|
259891
260008
|
moonshot: "moonshotai",
|
|
259892
260009
|
bedrock: "amazon-bedrock"
|
|
@@ -267939,6 +268056,17 @@ function buildQueuedTurnMessage(runtime, batch) {
|
|
|
267939
268056
|
messages
|
|
267940
268057
|
};
|
|
267941
268058
|
}
|
|
268059
|
+
function getDequeuedClientMessageIds(runtime, batch) {
|
|
268060
|
+
const clientMessageIds = new Set;
|
|
268061
|
+
for (const item of batch.items) {
|
|
268062
|
+
const queuedMessage = runtime.queuedMessagesByItemId.get(item.id);
|
|
268063
|
+
const inboundClientMessageIds = queuedMessage ? getInboundClientMessageIds(queuedMessage) : [];
|
|
268064
|
+
for (const clientMessageId of inboundClientMessageIds.length > 0 ? inboundClientMessageIds : item.clientMessageId ? [item.clientMessageId] : []) {
|
|
268065
|
+
clientMessageIds.add(clientMessageId);
|
|
268066
|
+
}
|
|
268067
|
+
}
|
|
268068
|
+
return [...clientMessageIds];
|
|
268069
|
+
}
|
|
267942
268070
|
function shouldQueueInboundMessage(parsed) {
|
|
267943
268071
|
return parsed.messages.some((payload) => ("content" in payload));
|
|
267944
268072
|
}
|
|
@@ -268009,10 +268137,14 @@ function consumeQueuedTurn(runtime) {
|
|
|
268009
268137
|
if (!dequeuedBatch) {
|
|
268010
268138
|
return null;
|
|
268011
268139
|
}
|
|
268140
|
+
const clientMessageIds = getDequeuedClientMessageIds(runtime, dequeuedBatch);
|
|
268012
268141
|
const queuedTurn = buildQueuedTurnMessage(runtime, dequeuedBatch);
|
|
268013
268142
|
if (!queuedTurn) {
|
|
268014
268143
|
return null;
|
|
268015
268144
|
}
|
|
268145
|
+
if (clientMessageIds.length > 0) {
|
|
268146
|
+
runtime.dequeuedClientMessageIdsByBatchId.set(dequeuedBatch.batchId, clientMessageIds);
|
|
268147
|
+
}
|
|
268016
268148
|
return {
|
|
268017
268149
|
dequeuedBatch,
|
|
268018
268150
|
queuedTurn
|
|
@@ -268025,6 +268157,17 @@ function computeListenerQueueBlockedReason(runtime) {
|
|
|
268025
268157
|
});
|
|
268026
268158
|
return getListenerBlockedReason(runtime.turnLifecycle.snapshot(), activeScope ? getPendingControlRequestCount(runtime.listener, activeScope) : 0);
|
|
268027
268159
|
}
|
|
268160
|
+
function emitTurnBoundaryStatus(runtime, socket) {
|
|
268161
|
+
if (!isListenerTransportOpen(socket)) {
|
|
268162
|
+
return;
|
|
268163
|
+
}
|
|
268164
|
+
const scope = {
|
|
268165
|
+
agent_id: runtime.agentId,
|
|
268166
|
+
conversation_id: runtime.conversationId
|
|
268167
|
+
};
|
|
268168
|
+
emitQueueUpdate(socket, runtime, scope);
|
|
268169
|
+
emitLoopStatusUpdate(socket, runtime, scope);
|
|
268170
|
+
}
|
|
268028
268171
|
async function drainQueuedMessages(runtime, socket, opts, processQueuedTurn) {
|
|
268029
268172
|
if (runtime.queuePumpActive) {
|
|
268030
268173
|
return;
|
|
@@ -268046,6 +268189,7 @@ async function drainQueuedMessages(runtime, socket, opts, processQueuedTurn) {
|
|
|
268046
268189
|
}
|
|
268047
268190
|
const { dequeuedBatch, queuedTurn } = consumedQueuedTurn;
|
|
268048
268191
|
emitDequeuedUserMessage(socket, runtime, queuedTurn, dequeuedBatch);
|
|
268192
|
+
emitTurnBoundaryStatus(runtime, socket);
|
|
268049
268193
|
const preTurnStatus = getListenerStatus(runtime.listener) === "processing" ? "processing" : "receiving";
|
|
268050
268194
|
if (opts.connectionId && runtime.listener.lastEmittedStatus !== preTurnStatus) {
|
|
268051
268195
|
runtime.listener.lastEmittedStatus = preTurnStatus;
|
|
@@ -268053,6 +268197,7 @@ async function drainQueuedMessages(runtime, socket, opts, processQueuedTurn) {
|
|
|
268053
268197
|
}
|
|
268054
268198
|
await processQueuedTurn(queuedTurn, dequeuedBatch);
|
|
268055
268199
|
emitListenerStatus(runtime.listener, opts.onStatusChange, opts.connectionId);
|
|
268200
|
+
emitTurnBoundaryStatus(runtime, socket);
|
|
268056
268201
|
evictConversationRuntimeIfIdle(runtime);
|
|
268057
268202
|
}
|
|
268058
268203
|
} finally {
|
|
@@ -272622,9 +272767,9 @@ import {
|
|
|
272622
272767
|
import { join as join59 } from "node:path";
|
|
272623
272768
|
function buildReflectionSubagentPrompt(input) {
|
|
272624
272769
|
const lines = [];
|
|
272625
|
-
lines.push('Review the conversation transcript payload and update memory files. The payload path is available as the `$TRANSCRIPT_PATH` env var — read it via Bash (e.g. `wc -c "$TRANSCRIPT_PATH"`). Note: `$TRANSCRIPT_PATH` only expands in shell commands; Edit `file_path` is literal and does NOT expand env vars.', "", 'The payload may be either a JSON message array for one conversation or a `multi_transcript_reflection_payload` manifest. If it is a manifest, read each `payload_path` listed in `transcripts` and synthesize across all conversations. Entries with `mode: "replay"` were already reflected before and are included intentionally for re-review/deduplication; do not ignore them just because they are replay slices.', "When reviewing multiple transcripts, prefer
|
|
272770
|
+
lines.push('Review the conversation transcript payload and update memory files. The payload path is available as the `$TRANSCRIPT_PATH` env var — read it via Bash (e.g. `wc -c "$TRANSCRIPT_PATH"`). Note: `$TRANSCRIPT_PATH` only expands in shell commands; Edit `file_path` is literal and does NOT expand env vars.', "", 'The payload may be either a JSON message array for one conversation or a `multi_transcript_reflection_payload` manifest. If it is a manifest, read each `payload_path` listed in `transcripts` and synthesize across all conversations. Entries with `mode: "replay"` were already reflected before and are included intentionally for re-review/deduplication; do not ignore them just because they are replay slices.', "When reviewing multiple transcripts, prefer recurring patterns and the latest evidence across sessions. Resolve contradictions by updating stale memory at the source, deduplicate repeated facts, and avoid storing one-off task state.", "", "The primary agent's memory filesystem is available through the `$MEMORY_DIR` environment variable.", "Run git add or git commit commands only from $MEMORY_DIR; the harness handles integration after your commit. If these fail, stop reflecting and report the failure. All other git commands are out of your purview.", 'When using Edit, first resolve the absolute file path from `$MEMORY_DIR` with Bash (for example: `printf "%s/system/persona.md\\n" "$MEMORY_DIR"`) and use the printed path. Do not hardcode memory paths from the prompt.', "In-context memory (in the parent agent's system prompt) is stored in the `system/` folder and are rendered in <memory> tags below. Modification to files in `system/` will edit the parent agent's system prompt.", "Additional memory files (such as skills and external memory) may also be read and modified.", "");
|
|
272626
272771
|
if (input.instruction?.trim()) {
|
|
272627
|
-
lines.push("Additional user-provided reflection instruction:", input.instruction.trim(), "", "Use this instruction to focus what you look for, but still only persist
|
|
272772
|
+
lines.push("Additional user-provided reflection instruction:", input.instruction.trim(), "", "Use this instruction to focus what you look for, but still only persist memory-worthy learnings and do not store transient task state.", "");
|
|
272628
272773
|
}
|
|
272629
272774
|
if (input.parentMemory) {
|
|
272630
272775
|
lines.push(input.parentMemory);
|
|
@@ -272642,7 +272787,7 @@ function buildReflectionSelectorPrompt(options3) {
|
|
|
272642
272787
|
if (options3?.instruction?.trim()) {
|
|
272643
272788
|
lines.push("Additional user-provided reflection instruction:", options3.instruction.trim(), "", "Prefer transcript candidates that help satisfy this instruction, while still avoiding transient or low-signal conversations.", "");
|
|
272644
272789
|
}
|
|
272645
|
-
lines.push("If the candidates payload includes `user_instruction`, use it as the requested focus for selection.", "", "Select up to `max_selected` conversations. Prefer candidates likely to contain
|
|
272790
|
+
lines.push("If the candidates payload includes `user_instruction`, use it as the requested focus for selection.", "", "Select up to `max_selected` conversations. Prefer candidates likely to contain useful memory updates: explicit user corrections, repeated preferences, coding/review/commit style preferences, repo or workflow gotchas, facts about people/projects that will matter later, contradictions with current memory, or repeated agent failures.", "Avoid one-off debugging, transient task status, duplicated/redundant candidates, and conversations already fully reflected unless they are useful for deduplication or contradiction resolution.", "Treat summaries/descriptions as weak internal metadata, not confirmed facts. The final reflection pass will verify against the actual transcript before writing memory.", "", "Return strict JSON as your final response with this shape:", '{"selected_conversations":[{"conversation_id":"conv-...","reason":"reason for selecting this transcript","priority":"high"}]}', 'Use priority values `high`, `medium`, or `low`. If nothing looks memory-worthy, write `{"selected_conversations":[]}`.');
|
|
272646
272791
|
return lines.join(`
|
|
272647
272792
|
`);
|
|
272648
272793
|
}
|
|
@@ -273427,7 +273572,7 @@ async function buildReflectionAutoPayload(options3) {
|
|
|
273427
273572
|
created_at: new Date().toISOString(),
|
|
273428
273573
|
max_selected: maxSelected,
|
|
273429
273574
|
user_instruction: instruction?.trim() || undefined,
|
|
273430
|
-
instructions: "Choose conversations likely to contain
|
|
273575
|
+
instructions: "Choose conversations likely to contain useful memory updates. Prefer explicit corrections, repeated preferences, project conventions, and contradictions; avoid one-off debugging and transient task state.",
|
|
273431
273576
|
candidates: sortedCandidates
|
|
273432
273577
|
};
|
|
273433
273578
|
const candidatesPath = buildPayloadPath(payloadRoot, "candidates");
|
|
@@ -273737,7 +273882,7 @@ var init_reflection_transcript = __esm(() => {
|
|
|
273737
273882
|
REFLECTION_AUTO_QUERIES = [
|
|
273738
273883
|
{
|
|
273739
273884
|
id: "user-corrections",
|
|
273740
|
-
query: "user corrections and preferences repeated mistakes
|
|
273885
|
+
query: "user corrections and preferences repeated mistakes recurring feedback"
|
|
273741
273886
|
},
|
|
273742
273887
|
{
|
|
273743
273888
|
id: "coding-style",
|
|
@@ -273745,11 +273890,11 @@ var init_reflection_transcript = __esm(() => {
|
|
|
273745
273890
|
},
|
|
273746
273891
|
{
|
|
273747
273892
|
id: "collaboration",
|
|
273748
|
-
query: "collaboration communication style team preferences
|
|
273893
|
+
query: "collaboration communication style team preferences recurring workflow"
|
|
273749
273894
|
},
|
|
273750
273895
|
{
|
|
273751
273896
|
id: "repo-gotchas",
|
|
273752
|
-
query: "repo conventions project gotchas
|
|
273897
|
+
query: "repo conventions project gotchas important implementation details"
|
|
273753
273898
|
},
|
|
273754
273899
|
{
|
|
273755
273900
|
id: "long-term-facts",
|
|
@@ -274013,7 +274158,7 @@ function buildTargetInstruction(target2) {
|
|
|
274013
274158
|
"(--- ... ---) at the top intact and edit only the body below it.",
|
|
274014
274159
|
"",
|
|
274015
274160
|
"If it does not exist, create it ONLY when the new experience yields",
|
|
274016
|
-
"
|
|
274161
|
+
"forward-looking guidance worth recording, and begin the file with",
|
|
274017
274162
|
"a YAML frontmatter block (a --- ... --- header with a short `description:`).",
|
|
274018
274163
|
"If there is nothing substantive to record yet, do NOT create the file —",
|
|
274019
274164
|
"leave it absent rather than writing a placeholder that says nothing was",
|
|
@@ -274098,7 +274243,7 @@ var init_dream_targets = __esm(() => {
|
|
|
274098
274243
|
};
|
|
274099
274244
|
AGENTS_MD_GUIDANCE = [
|
|
274100
274245
|
"This file is an AGENTS.md — a README *for coding agents* (the agents.md",
|
|
274101
|
-
"open standard). Maintain it as
|
|
274246
|
+
"open standard). Maintain it as repo-level guidance an agent needs over time:",
|
|
274102
274247
|
"build/test/setup COMMANDS (put these early), code-style conventions,",
|
|
274103
274248
|
"testing instructions, security considerations, and commit/PR rules. Use",
|
|
274104
274249
|
"plain Markdown with any headings. Do NOT duplicate human-README content",
|
|
@@ -274111,7 +274256,7 @@ var init_dream_targets = __esm(() => {
|
|
|
274111
274256
|
].join(`
|
|
274112
274257
|
`);
|
|
274113
274258
|
GENERIC_GUIDANCE = [
|
|
274114
|
-
"Maintain this markdown document as
|
|
274259
|
+
"Maintain this markdown document as forward-looking guidance",
|
|
274115
274260
|
"distilled from the conversation(s). Prefer editing/merging existing",
|
|
274116
274261
|
"sections over appending; remove content that new evidence contradicts."
|
|
274117
274262
|
].join(`
|
|
@@ -274917,7 +275062,7 @@ function getReflectionCompletionMessage(integration) {
|
|
|
274917
275062
|
case "merged":
|
|
274918
275063
|
return;
|
|
274919
275064
|
case "no_changes":
|
|
274920
|
-
return ({ action: action3 }) => `${action3}; no
|
|
275065
|
+
return ({ action: action3 }) => `${action3}; no memory changes were needed.`;
|
|
274921
275066
|
case "parent_dirty":
|
|
274922
275067
|
return "Tried to reflect, but parent memory had uncommitted changes; will retry later.";
|
|
274923
275068
|
case "merge_conflict":
|
|
@@ -457413,9 +457558,13 @@ async function isRetriablePostStopError(stopReason, lastRunId, fallbackDetail) {
|
|
|
457413
457558
|
async function drainRecoveryStreamWithEmission(recoveryStream, socket, runtime, params) {
|
|
457414
457559
|
let recoveryRunIdSent = false;
|
|
457415
457560
|
return drainStreamWithResume(recoveryStream, createBuffers(params.agentId || ""), () => {}, params.turnLease.signal, undefined, ({ chunk: chunk2, shouldOutput, errorInfo }) => {
|
|
457561
|
+
if (!runtime.turnLifecycle.isCurrent(params.turnLease)) {
|
|
457562
|
+
return;
|
|
457563
|
+
}
|
|
457416
457564
|
const maybeRunId = chunk2.run_id;
|
|
457417
457565
|
if (typeof maybeRunId === "string") {
|
|
457418
457566
|
runtime.turnLifecycle.setRunId(params.turnLease, maybeRunId);
|
|
457567
|
+
params.turnCorrelation?.observeRun(maybeRunId);
|
|
457419
457568
|
if (!recoveryRunIdSent) {
|
|
457420
457569
|
recoveryRunIdSent = true;
|
|
457421
457570
|
emitLoopStatusUpdate(socket, runtime, {
|
|
@@ -457762,15 +457911,23 @@ async function resolveRecoveredApprovalResponse(runtime, socket, response, proce
|
|
|
457762
457911
|
]);
|
|
457763
457912
|
let continuationBatchId = `batch-recovered-${crypto.randomUUID()}`;
|
|
457764
457913
|
let continuationActingUserId;
|
|
457914
|
+
let continuationCorrelation;
|
|
457765
457915
|
const consumedQueuedTurn = consumeQueuedTurn(runtime);
|
|
457766
457916
|
if (consumedQueuedTurn) {
|
|
457767
457917
|
const { dequeuedBatch, queuedTurn } = consumedQueuedTurn;
|
|
457768
457918
|
continuationBatchId = dequeuedBatch.batchId;
|
|
457769
457919
|
continuationActingUserId = queuedTurn.actingUserId;
|
|
457770
457920
|
continuationInput = appendQueuedTurnToInput(continuationInput, queuedTurn);
|
|
457921
|
+
continuationCorrelation = createTurnCorrelation(runtime, {
|
|
457922
|
+
type: "message",
|
|
457923
|
+
agentId: recovered.agentId,
|
|
457924
|
+
conversationId: recovered.conversationId,
|
|
457925
|
+
messages: continuationInput.messages
|
|
457926
|
+
}, continuationBatchId);
|
|
457771
457927
|
emitDequeuedUserMessage(socket, runtime, queuedTurn, dequeuedBatch);
|
|
457772
457928
|
}
|
|
457773
457929
|
if (!runtime.turnLifecycle.isCurrent(recoveryLease)) {
|
|
457930
|
+
runtime.dequeuedClientMessageIdsByBatchId.delete(continuationBatchId);
|
|
457774
457931
|
return true;
|
|
457775
457932
|
}
|
|
457776
457933
|
await processTurn({
|
|
@@ -457779,7 +457936,7 @@ async function resolveRecoveredApprovalResponse(runtime, socket, response, proce
|
|
|
457779
457936
|
conversationId: recovered.conversationId,
|
|
457780
457937
|
...continuationActingUserId ? { actingUserId: continuationActingUserId } : {},
|
|
457781
457938
|
messages: continuationInput.messages
|
|
457782
|
-
}, socket, runtime, opts?.onStatusChange, opts?.connectionId, continuationBatchId, recoveryLease);
|
|
457939
|
+
}, socket, runtime, opts?.onStatusChange, opts?.connectionId, continuationBatchId, recoveryLease, continuationCorrelation);
|
|
457783
457940
|
if (runtime.turnLifecycle.isCurrent(recoveryLease)) {
|
|
457784
457941
|
throw new Error("Recovered continuation returned without finalizing");
|
|
457785
457942
|
}
|
|
@@ -457832,6 +457989,7 @@ var init_recovery = __esm(async () => {
|
|
|
457832
457989
|
init_recoverable_notices();
|
|
457833
457990
|
init_runtime();
|
|
457834
457991
|
init_secrets_sync();
|
|
457992
|
+
init_turn_correlation();
|
|
457835
457993
|
init_turn_input_state();
|
|
457836
457994
|
init_turn_status();
|
|
457837
457995
|
init_turn_terminal();
|
|
@@ -458221,9 +458379,11 @@ async function resolveStaleApprovals(runtime, socket, turnLease, deps = {}) {
|
|
|
458221
458379
|
}
|
|
458222
458380
|
]);
|
|
458223
458381
|
let continuationActingUserId;
|
|
458382
|
+
let recoveryTurnCorrelation;
|
|
458224
458383
|
const consumedQueuedTurn = consumeQueuedTurn(runtime);
|
|
458225
458384
|
if (consumedQueuedTurn) {
|
|
458226
458385
|
const { dequeuedBatch, queuedTurn } = consumedQueuedTurn;
|
|
458386
|
+
recoveryTurnCorrelation = createTurnCorrelation(runtime, queuedTurn, dequeuedBatch.batchId);
|
|
458227
458387
|
continuationActingUserId = queuedTurn.actingUserId;
|
|
458228
458388
|
continuationInput = appendQueuedTurnToInput(continuationInput, queuedTurn);
|
|
458229
458389
|
emitDequeuedUserMessage(socket, runtime, queuedTurn, dequeuedBatch);
|
|
@@ -458254,7 +458414,8 @@ async function resolveStaleApprovals(runtime, socket, turnLease, deps = {}) {
|
|
|
458254
458414
|
const drainResult = await drainRecoveryStream(recoveryStream, socket, runtime, {
|
|
458255
458415
|
agentId: runtime.agentId ?? undefined,
|
|
458256
458416
|
conversationId: recoveryConversationId,
|
|
458257
|
-
turnLease
|
|
458417
|
+
turnLease,
|
|
458418
|
+
turnCorrelation: recoveryTurnCorrelation
|
|
458258
458419
|
});
|
|
458259
458420
|
assertCurrentTurnLease();
|
|
458260
458421
|
if (drainResult.stopReason === "error") {
|
|
@@ -458549,6 +458710,7 @@ var init_send = __esm(async () => {
|
|
|
458549
458710
|
init_permission_mode();
|
|
458550
458711
|
init_protocol_outbound();
|
|
458551
458712
|
init_skill_injection();
|
|
458713
|
+
init_turn_correlation();
|
|
458552
458714
|
init_turn_input_state();
|
|
458553
458715
|
init_turn_status();
|
|
458554
458716
|
await __promiseAll([
|
|
@@ -458564,6 +458726,20 @@ var init_send = __esm(async () => {
|
|
|
458564
458726
|
});
|
|
458565
458727
|
|
|
458566
458728
|
// src/websocket/listener/teleport.ts
|
|
458729
|
+
function buildTeleportContinuationMessages(params) {
|
|
458730
|
+
return [
|
|
458731
|
+
{
|
|
458732
|
+
type: "approval",
|
|
458733
|
+
approvals: params.approvals,
|
|
458734
|
+
otid: params.teleportId
|
|
458735
|
+
},
|
|
458736
|
+
{
|
|
458737
|
+
role: "system",
|
|
458738
|
+
content: "<system-reminder>Teleportation to this environment is complete. Continue the existing task from this environment now.</system-reminder>",
|
|
458739
|
+
otid: `${params.teleportId}:continue`
|
|
458740
|
+
}
|
|
458741
|
+
];
|
|
458742
|
+
}
|
|
458567
458743
|
function getPendingTeleports(runtime) {
|
|
458568
458744
|
runtime.pendingTeleports ??= new Map;
|
|
458569
458745
|
return runtime.pendingTeleports;
|
|
@@ -460874,6 +461050,7 @@ async function handleApprovalStop(params) {
|
|
|
460874
461050
|
turnInput,
|
|
460875
461051
|
turnToolContextId,
|
|
460876
461052
|
turnLease,
|
|
461053
|
+
turnCorrelation,
|
|
460877
461054
|
processOwnedTurn = false,
|
|
460878
461055
|
buildSendOptions,
|
|
460879
461056
|
dependencies: dependencies4
|
|
@@ -461176,6 +461353,7 @@ async function handleApprovalStop(params) {
|
|
|
461176
461353
|
const consumedQueuedTurn = consumeQueuedTurn(runtime);
|
|
461177
461354
|
if (consumedQueuedTurn) {
|
|
461178
461355
|
const { dequeuedBatch, queuedTurn } = consumedQueuedTurn;
|
|
461356
|
+
turnCorrelation?.appendDequeuedBatch(dequeuedBatch.batchId);
|
|
461179
461357
|
continuationBatchId = dequeuedBatch.batchId;
|
|
461180
461358
|
continuationActingUserId = queuedTurn.actingUserId;
|
|
461181
461359
|
nextTurnInput = appendQueuedTurnToInput(nextTurnInput, queuedTurn);
|
|
@@ -462961,16 +463139,16 @@ var init_turn_setup = __esm(async () => {
|
|
|
462961
463139
|
});
|
|
462962
463140
|
|
|
462963
463141
|
// src/websocket/listener/turn.ts
|
|
462964
|
-
async function handleIncomingMessage(msg, socket, runtime, onStatusChange, connectionId, dequeuedBatchId = `batch-direct-${crypto.randomUUID()}`, existingTurnLease) {
|
|
463142
|
+
async function handleIncomingMessage(msg, socket, runtime, onStatusChange, connectionId, dequeuedBatchId = `batch-direct-${crypto.randomUUID()}`, existingTurnLease, existingTurnCorrelation) {
|
|
462965
463143
|
notifyTurnStarted(msg);
|
|
462966
463144
|
try {
|
|
462967
|
-
await handleIncomingMessageInner(msg, socket, runtime, onStatusChange, connectionId, dequeuedBatchId, existingTurnLease);
|
|
463145
|
+
await handleIncomingMessageInner(msg, socket, runtime, onStatusChange, connectionId, dequeuedBatchId, existingTurnLease, existingTurnCorrelation);
|
|
462968
463146
|
} finally {
|
|
462969
463147
|
notifyTurnFinished(msg);
|
|
462970
463148
|
finishPendingTeleport(runtime);
|
|
462971
463149
|
}
|
|
462972
463150
|
}
|
|
462973
|
-
async function handleIncomingMessageInner(msg, socket, runtime, onStatusChange, connectionId, dequeuedBatchId = `batch-direct-${crypto.randomUUID()}`, existingTurnLease) {
|
|
463151
|
+
async function handleIncomingMessageInner(msg, socket, runtime, onStatusChange, connectionId, dequeuedBatchId = `batch-direct-${crypto.randomUUID()}`, existingTurnLease, existingTurnCorrelation) {
|
|
462974
463152
|
const agentId = msg.agentId;
|
|
462975
463153
|
const requestedConversationId = msg.conversationId || undefined;
|
|
462976
463154
|
const conversationId = requestedConversationId ?? "default";
|
|
@@ -462978,6 +463156,7 @@ async function handleIncomingMessageInner(msg, socket, runtime, onStatusChange,
|
|
|
462978
463156
|
const turnWorkingDirectory = getConversationWorkingDirectory(runtime.listener, normalizedAgentId, conversationId);
|
|
462979
463157
|
const turnPermissionModeState = getOrCreateConversationPermissionModeStateRef(runtime.listener, normalizedAgentId, conversationId);
|
|
462980
463158
|
let postStopApprovalRecoveryRetries = 0, llmApiErrorRetries = 0, emptyResponseRetries = 0, chatgptPlanSwaps = 0, lastApprovalContinuationAccepted = false, activeDequeuedBatchId = dequeuedBatchId;
|
|
463159
|
+
const turnCorrelation = existingTurnCorrelation ?? createTurnCorrelation(runtime, msg, activeDequeuedBatchId);
|
|
462981
463160
|
const msgRunIds = [];
|
|
462982
463161
|
let lastExecutionResults = null;
|
|
462983
463162
|
let lastExecutingToolCallIds = [];
|
|
@@ -463146,6 +463325,7 @@ async function handleIncomingMessageInner(msg, socket, runtime, onStatusChange,
|
|
|
463146
463325
|
if (typeof maybeRunId === "string") {
|
|
463147
463326
|
runId = maybeRunId;
|
|
463148
463327
|
runtime.turnLifecycle.setRunId(turnLease, maybeRunId);
|
|
463328
|
+
turnCorrelation.observeRun(maybeRunId);
|
|
463149
463329
|
if (!runIdSent) {
|
|
463150
463330
|
runIdSent = true;
|
|
463151
463331
|
msgRunIds.push(maybeRunId);
|
|
@@ -463498,6 +463678,7 @@ async function handleIncomingMessageInner(msg, socket, runtime, onStatusChange,
|
|
|
463498
463678
|
pendingNormalizationInterruptedToolCallIds,
|
|
463499
463679
|
turnToolContextId,
|
|
463500
463680
|
turnLease,
|
|
463681
|
+
turnCorrelation,
|
|
463501
463682
|
processOwnedTurn: msg.processOwnedTurn === true,
|
|
463502
463683
|
buildSendOptions
|
|
463503
463684
|
});
|
|
@@ -463695,6 +463876,7 @@ var init_turn = __esm(async () => {
|
|
|
463695
463876
|
init_teleport();
|
|
463696
463877
|
init_turn_cleanup();
|
|
463697
463878
|
init_turn_context();
|
|
463879
|
+
init_turn_correlation();
|
|
463698
463880
|
init_turn_input_state();
|
|
463699
463881
|
init_turn_observers();
|
|
463700
463882
|
init_turn_status();
|
|
@@ -464291,6 +464473,7 @@ function createConnectionTurnProcessor(runtime) {
|
|
|
464291
464473
|
}
|
|
464292
464474
|
const connection = runtime.connections.get(queuedTurn.connectionId);
|
|
464293
464475
|
if (!connection || connection.cancellation.signal.aborted) {
|
|
464476
|
+
scopedRuntime.dequeuedClientMessageIdsByBatchId.delete(dequeuedBatch.batchId);
|
|
464294
464477
|
return;
|
|
464295
464478
|
}
|
|
464296
464479
|
await handleIncomingMessage(queuedTurn, getOrCreateProcessTransport(runtime), scopedRuntime, connection.options.onStatusChange, connection.id, dequeuedBatch.batchId);
|
|
@@ -467938,32 +468121,6 @@ var init_git_branches = __esm(() => {
|
|
|
467938
468121
|
init_protocol_outbound();
|
|
467939
468122
|
});
|
|
467940
468123
|
|
|
467941
|
-
// src/websocket/listener/inbound-queue.ts
|
|
467942
|
-
function getInboundClientMessageId(incoming) {
|
|
467943
|
-
return incoming.messages.find((payload) => ("content" in payload))?.client_message_id;
|
|
467944
|
-
}
|
|
467945
|
-
function enqueueInboundUserMessage(runtime, incoming, actingUserId) {
|
|
467946
|
-
const firstUserPayload = incoming.messages.find((payload) => ("content" in payload));
|
|
467947
|
-
if (!firstUserPayload) {
|
|
467948
|
-
return false;
|
|
467949
|
-
}
|
|
467950
|
-
const enqueuedItem = runtime.queueRuntime.enqueue({
|
|
467951
|
-
kind: "message",
|
|
467952
|
-
source: "user",
|
|
467953
|
-
content: firstUserPayload.content,
|
|
467954
|
-
clientMessageId: firstUserPayload.client_message_id ?? `cm-submit-${crypto.randomUUID()}`,
|
|
467955
|
-
agentId: incoming.agentId,
|
|
467956
|
-
conversationId: incoming.conversationId || "default",
|
|
467957
|
-
...incoming.noCoalesce ? { noCoalesce: true } : {},
|
|
467958
|
-
actingUserId
|
|
467959
|
-
});
|
|
467960
|
-
if (!enqueuedItem) {
|
|
467961
|
-
return false;
|
|
467962
|
-
}
|
|
467963
|
-
runtime.queuedMessagesByItemId.set(enqueuedItem.id, incoming);
|
|
467964
|
-
return true;
|
|
467965
|
-
}
|
|
467966
|
-
|
|
467967
468124
|
// src/websocket/listener/inbound-dispatch.ts
|
|
467968
468125
|
function getAcceptedInputDisposition(runtime, clientMessageId) {
|
|
467969
468126
|
if (!clientMessageId)
|
|
@@ -468709,13 +468866,10 @@ function createListenerMessageHandler(params) {
|
|
|
468709
468866
|
connectionId,
|
|
468710
468867
|
agentId: parsed.runtime.agent_id,
|
|
468711
468868
|
conversationId: parsed.runtime.conversation_id,
|
|
468712
|
-
messages:
|
|
468713
|
-
|
|
468714
|
-
|
|
468715
|
-
|
|
468716
|
-
otid: teleportId
|
|
468717
|
-
}
|
|
468718
|
-
]
|
|
468869
|
+
messages: buildTeleportContinuationMessages({
|
|
468870
|
+
teleportId,
|
|
468871
|
+
approvals
|
|
468872
|
+
})
|
|
468719
468873
|
}, socket, scopedRuntime2, opts.onStatusChange, connectionId);
|
|
468720
468874
|
});
|
|
468721
468875
|
return;
|
|
@@ -468885,12 +469039,10 @@ function createListenerMessageHandler(params) {
|
|
|
468885
469039
|
success: removed !== null,
|
|
468886
469040
|
item_id: parsed.item_id
|
|
468887
469041
|
}, "remove_queue_item_response", "remove_queue_item");
|
|
468888
|
-
|
|
468889
|
-
|
|
468890
|
-
|
|
468891
|
-
|
|
468892
|
-
});
|
|
468893
|
-
}
|
|
469042
|
+
emitQueueUpdateIfOpen(runtime, {
|
|
469043
|
+
agent_id: parsed.runtime.agent_id,
|
|
469044
|
+
conversation_id: parsed.runtime.conversation_id
|
|
469045
|
+
});
|
|
468894
469046
|
return;
|
|
468895
469047
|
}
|
|
468896
469048
|
if (fileCommandSession.handle(parsed)) {
|
|
@@ -497773,7 +497925,7 @@ var init_mcp_client = __esm(() => {
|
|
|
497773
497925
|
init_streamableHttp();
|
|
497774
497926
|
DEFAULT_CLIENT_INFO = {
|
|
497775
497927
|
name: "letta-code",
|
|
497776
|
-
version: "0.30.
|
|
497928
|
+
version: "0.30.28"
|
|
497777
497929
|
};
|
|
497778
497930
|
});
|
|
497779
497931
|
|
|
@@ -564729,4 +564881,4 @@ function registerBunOAuthFlows() {
|
|
|
564729
564881
|
registerBunOAuthFlows();
|
|
564730
564882
|
await init_src5().then(() => exports_src2);
|
|
564731
564883
|
|
|
564732
|
-
//# debugId=
|
|
564884
|
+
//# debugId=66D224FF7F960BF164756E2164756E21
|