@letta-ai/letta-code 0.30.3 → 0.30.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/dist/agent-presets.js +125 -19
  2. package/dist/agent-presets.js.map +3 -3
  3. package/dist/mcp-client.js +2 -2
  4. package/dist/mcp-client.js.map +1 -1
  5. package/dist/types/agent/create-agent-request.d.ts +55 -25
  6. package/dist/types/agent/create-agent-request.d.ts.map +1 -1
  7. package/dist/types/agent/modify.d.ts.map +1 -1
  8. package/dist/types/agent/subagents/index.d.ts +1 -0
  9. package/dist/types/agent/subagents/index.d.ts.map +1 -1
  10. package/dist/types/agent/subagents/manager.d.ts +1 -0
  11. package/dist/types/agent/subagents/manager.d.ts.map +1 -1
  12. package/dist/types/agent/subagents/subagent-launcher.d.ts.map +1 -1
  13. package/dist/types/agent-presets.d.ts +1 -1
  14. package/dist/types/agent-presets.d.ts.map +1 -1
  15. package/dist/types/channels/accounts.d.ts.map +1 -1
  16. package/dist/types/channels/config.d.ts.map +1 -1
  17. package/dist/types/channels/inbound-debounce.d.ts +4 -0
  18. package/dist/types/channels/inbound-debounce.d.ts.map +1 -1
  19. package/dist/types/channels/plugin-types.d.ts +8 -0
  20. package/dist/types/channels/plugin-types.d.ts.map +1 -1
  21. package/dist/types/channels/registry-inbound.d.ts.map +1 -1
  22. package/dist/types/channels/types.d.ts +11 -12
  23. package/dist/types/channels/types.d.ts.map +1 -1
  24. package/dist/types/channels/whatsapp/adapter-helpers.d.ts +21 -0
  25. package/dist/types/channels/whatsapp/adapter-helpers.d.ts.map +1 -0
  26. package/dist/types/channels/whatsapp/adapter-types.d.ts +44 -0
  27. package/dist/types/channels/whatsapp/adapter-types.d.ts.map +1 -0
  28. package/dist/types/channels/whatsapp/adapter.d.ts +5 -1
  29. package/dist/types/channels/whatsapp/adapter.d.ts.map +1 -1
  30. package/dist/types/channels/whatsapp/attachment-policy-types.d.ts +13 -0
  31. package/dist/types/channels/whatsapp/attachment-policy-types.d.ts.map +1 -0
  32. package/dist/types/channels/whatsapp/attachment-policy.d.ts +22 -0
  33. package/dist/types/channels/whatsapp/attachment-policy.d.ts.map +1 -0
  34. package/dist/types/channels/whatsapp/dedupe-claims.d.ts +8 -0
  35. package/dist/types/channels/whatsapp/dedupe-claims.d.ts.map +1 -0
  36. package/dist/types/channels/whatsapp/inbound-debounce.d.ts +28 -0
  37. package/dist/types/channels/whatsapp/inbound-debounce.d.ts.map +1 -0
  38. package/dist/types/channels/whatsapp/media.d.ts +5 -3
  39. package/dist/types/channels/whatsapp/media.d.ts.map +1 -1
  40. package/dist/types/channels/whatsapp/message-actions.d.ts.map +1 -1
  41. package/dist/types/channels/whatsapp/message-prefix-config-types.d.ts +5 -0
  42. package/dist/types/channels/whatsapp/message-prefix-config-types.d.ts.map +1 -0
  43. package/dist/types/channels/whatsapp/message-store.d.ts +13 -0
  44. package/dist/types/channels/whatsapp/message-store.d.ts.map +1 -0
  45. package/dist/types/channels/whatsapp/reactions.d.ts +33 -0
  46. package/dist/types/channels/whatsapp/reactions.d.ts.map +1 -0
  47. package/dist/types/channels/whatsapp/reconnect-scheduler.d.ts +16 -0
  48. package/dist/types/channels/whatsapp/reconnect-scheduler.d.ts.map +1 -0
  49. package/dist/types/channels/whatsapp/session.d.ts +6 -1
  50. package/dist/types/channels/whatsapp/session.d.ts.map +1 -1
  51. package/dist/types/channels/whatsapp/typing-controller.d.ts +28 -0
  52. package/dist/types/channels/whatsapp/typing-controller.d.ts.map +1 -0
  53. package/dist/types/channels/whatsapp/waiting-behavior-config-types.d.ts +6 -0
  54. package/dist/types/channels/whatsapp/waiting-behavior-config-types.d.ts.map +1 -0
  55. package/dist/types/cli/helpers/memory-reminder.d.ts +9 -3
  56. package/dist/types/cli/helpers/memory-reminder.d.ts.map +1 -1
  57. package/dist/types/reflection-settings.d.ts +9 -0
  58. package/dist/types/reflection-settings.d.ts.map +1 -0
  59. package/dist/types/settings-manager.d.ts +9 -10
  60. package/dist/types/settings-manager.d.ts.map +1 -1
  61. package/dist/types/telemetry/index.d.ts +15 -1
  62. package/dist/types/telemetry/index.d.ts.map +1 -1
  63. package/dist/types/tools/impl/process_manager.d.ts +1 -0
  64. package/dist/types/tools/impl/process_manager.d.ts.map +1 -1
  65. package/dist/types/tools/impl/task.d.ts +4 -0
  66. package/dist/types/tools/impl/task.d.ts.map +1 -1
  67. package/dist/types/types/protocol_v2.d.ts +13 -0
  68. package/dist/types/types/protocol_v2.d.ts.map +1 -1
  69. package/dist/types/websocket/listener/protocol-outbound.d.ts.map +1 -1
  70. package/dist/types/websocket/listener/types.d.ts +11 -0
  71. package/dist/types/websocket/listener/types.d.ts.map +1 -1
  72. package/letta.js +3489 -1483
  73. package/package.json +1 -1
  74. package/scripts/isolated-unit-tests.json +11 -0
  75. package/scripts/source-file-size-baseline.json +7 -7
  76. package/skills/managing-shared-memory/SKILL.md +47 -81
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@letta-ai/letta-code",
3
- "version": "0.30.3",
3
+ "version": "0.30.5",
4
4
  "description": "Letta Code is a CLI tool for interacting with stateful Letta agents from the terminal.",
5
5
  "type": "module",
6
6
  "packageManager": "bun@1.3.0",
@@ -55,6 +55,17 @@
55
55
  "timeoutMs": 15000,
56
56
  "reason": "Mutates the settings singleton, keychain test overrides, HOME, and the secrets service name."
57
57
  },
58
+ {
59
+ "path": "src/cli/reflection-worktree-completion.test.ts",
60
+ "timeoutMs": 15000,
61
+ "env": { "LETTA_CODE_TELEM": "1" },
62
+ "reason": "Exercises reflection worktree cleanup telemetry with real Git processes and the shared telemetry singleton."
63
+ },
64
+ {
65
+ "path": "src/cli/helpers/reflection-launcher.test.ts",
66
+ "timeoutMs": 15000,
67
+ "reason": "Exercises reflection launch preflight with real Git processes and temporary local-backend environment overrides."
68
+ },
58
69
  {
59
70
  "path": "src/telemetry/flush-auth.test.ts",
60
71
  "timeoutMs": 15000,
@@ -5,7 +5,7 @@
5
5
  "src/backend/local/local-backend.ts": 1014,
6
6
  "src/backend/local/local-store.ts": 3594,
7
7
  "src/backend/pi-stream-adapter.test.ts": 1304,
8
- "src/cli/app/AppCoordinator.tsx": 5203,
8
+ "src/cli/app/AppCoordinator.tsx": 5188,
9
9
  "src/cli/app/AppView.tsx": 1735,
10
10
  "src/cli/app/use-approval-flow.ts": 1163,
11
11
  "src/cli/app/use-configuration-handlers.ts": 1433,
@@ -13,7 +13,7 @@
13
13
  "src/cli/app/use-submit-handler.ts": 4077,
14
14
  "src/cli/components/AgentSelector.tsx": 1104,
15
15
  "src/cli/components/InputRich.tsx": 2225,
16
- "src/cli/components/ModelSelector.tsx": 1262,
16
+ "src/cli/components/ModelSelector.tsx": 1259,
17
17
  "src/cli/components/ProviderSelector.tsx": 1692,
18
18
  "src/cli/components/ToolCallMessageRich.tsx": 1109,
19
19
  "src/cli/helpers/accumulator.ts": 1596,
@@ -22,9 +22,9 @@
22
22
  "src/cli/mods/local-mod-loader.test.ts": 1043,
23
23
  "src/cli/reflection-transcript.test.ts": 1084,
24
24
  "src/cli/subcommands/skills.ts": 1264,
25
- "src/headless.ts": 5243,
25
+ "src/headless.ts": 5242,
26
26
  "src/hooks/integration.test.ts": 1147,
27
- "src/index.ts": 2798,
27
+ "src/index.ts": 2776,
28
28
  "src/mods/learning-harness.ts": 2434,
29
29
  "src/mods/mod-engine.test.ts": 2153,
30
30
  "src/mods/mod-engine.ts": 1847,
@@ -40,12 +40,12 @@
40
40
  "src/tools/impl/enter-worktree.ts": 1260,
41
41
  "src/tools/manager.ts": 3261,
42
42
  "src/tools/tool-execution-context.test.ts": 1422,
43
- "src/types/protocol_v2.ts": 2950,
43
+ "src/types/protocol_v2.ts": 2958,
44
44
  "src/websocket/listen-client-concurrency.test.ts": 2686,
45
45
  "src/websocket/listen-client-protocol.test.ts": 5827,
46
46
  "src/websocket/listener/commands/memory.ts": 1114,
47
- "src/websocket/listener/file-commands.ts": 1030,
47
+ "src/websocket/listener/file-commands.ts": 1053,
48
48
  "src/websocket/listener/lifecycle.ts": 1052,
49
- "src/websocket/listener/protocol-inbound.ts": 2305,
49
+ "src/websocket/listener/protocol-inbound.ts": 2315,
50
50
  "src/websocket/listener/protocol-outbound.ts": 1085
51
51
  }
@@ -5,123 +5,89 @@ description: Create and manage shared memory — git-tracked repositories hosted
5
5
 
6
6
  # Managing Shared Memory
7
7
 
8
- Shared memory is memory created independently of any single agent, designed to be dynamically attached to or detached from multiple agents. Each unit of shared memory is a **shared memory repository**: a git-tracked filesystem hosted on Letta Cloud, owned by your organization rather than by one agent, reachable from any environment (sandboxes, remote machines, sessions).
8
+ Shared memory is memory created independently of any single agent, designed to be dynamically attached to or detached from multiple agents. Each unit of shared memory is a **shared memory repository**: a git repository hosted on Letta Cloud, owned by your organization rather than by one agent, reachable from any environment (sandboxes, remote machines, sessions).
9
9
 
10
- Like the rest of your external memory, shared memory lives outside your system prompt it is not in-context. Unlike the rest of your external memory, it is not scoped to *you* specifically, so each attached repository has its own local projection root and its own remote git origin, separate from your MemFS.
10
+ Shared memory works exactly like your MemFS: attached repositories are real git checkouts on disk, and you read, edit, commit, and push them with ordinary git. The only differences are that each repository has its own projection root (next to your memory directory, not inside it) and its own remote origin, and other agents may be writing to it too.
11
11
 
12
12
  Create a shared memory repository when:
13
13
  - You have context an agent should be able to access that doesn't belong in its own MemFS (input files, datasets, docs, working artifacts)
14
14
  - Multiple agents need to read or write the same context
15
15
  - You want a versioned file store that survives across environments and sessions
16
16
 
17
- Every file change is a git commit, so history is always available.
17
+ ## Working with Files (the normal path)
18
18
 
19
- ## Accessing Attached Shared Memory
20
-
21
- When shared memory is attached to you and you're running in a cloud sandbox/environment, it is projected on disk next to your memory directory — each repository at its own projection root:
19
+ Attached shared memory is mounted next to your memory directory, one git checkout per repository:
22
20
 
23
21
  ```bash
24
- ls "$MEMORY_DIR/../" # attached shared memory appears here by name
25
- cat "$MEMORY_DIR/../<repo-name>/<path>"
22
+ ls "$MEMORY_DIR/../" # attached repositories appear here by name
23
+ cat "$MEMORY_DIR/../<repo-name>/<path>" # read like any file
26
24
  ```
27
25
 
28
- If you don't see an expected repository on disk, fall back to the API (below)it always works regardless of environment.
29
-
30
- ## API Operations
31
-
32
- Shared memory repositories are the `repositories` resource in the Letta API. All operations go through the API using `$LETTA_API_KEY` via the Bash tool. Use `https://api.letta.com` (or `$LETTA_BASE_URL` if set — e.g. when running under Letta Desktop, which proxies auth). Responses are JSON.
26
+ Edit files with your normal file tools, then commit and push with gitthe mount's origin and credentials are already configured:
33
27
 
34
28
  ```bash
35
- BASE="${LETTA_BASE_URL:-https://api.letta.com}"
36
- AUTH="Authorization: Bearer $LETTA_API_KEY"
29
+ cd "$MEMORY_DIR/../<repo-name>"
30
+ git add <files>
31
+ git commit -m "describe the change"
32
+ git push
37
33
  ```
38
34
 
39
- ### Repositories
40
-
41
- ```bash
42
- # Create
43
- curl -sS -X POST "$BASE/v1/repositories" -H "$AUTH" -H "Content-Type: application/json" \
44
- -d '{"name": "shared-inputs"}'
45
- # → {"id": "repo-...", "name": "shared-inputs", "created_at": ..., "updated_at": ...}
46
-
47
- # List (paginated)
48
- curl -sS "$BASE/v1/repositories?limit=50&offset=0" -H "$AUTH"
49
- # → {"repositories": [...], "has_next_page": false}
35
+ Unlike MemFS, the harness does not auto-push shared memory after turns — a commit you don't push is not visible to other agents or environments. Always push after committing.
50
36
 
51
- # Get one
52
- curl -sS "$BASE/v1/repositories/{repository_id}" -H "$AUTH"
37
+ To pick up other agents' changes:
53
38
 
54
- # Delete (soft-delete)
55
- curl -sS -X DELETE "$BASE/v1/repositories/{repository_id}" -H "$AUTH"
39
+ ```bash
40
+ git -C "$MEMORY_DIR/../<repo-name>" pull --rebase
56
41
  ```
57
42
 
58
- ### Files
43
+ If a push is rejected (another agent pushed first), `git pull --rebase` then push again.
59
44
 
60
- Files are text content addressed by path. Every mutation returns a `commit_sha` and the file's `content_sha256`.
45
+ History is ordinary git history:
61
46
 
62
47
  ```bash
63
- # List files (optional: path_prefix, depth, ref)
64
- curl -sS "$BASE/v1/repositories/{repository_id}/files?path_prefix=docs/&depth=2" -H "$AUTH"
65
- # → {"files": [{"path": "docs/a.md", "type": "file"}, ...], "ref": "<sha>"}
66
-
67
- # Create
68
- curl -sS -X POST "$BASE/v1/repositories/{repository_id}/files" -H "$AUTH" \
69
- -H "Content-Type: application/json" \
70
- -d '{"path": "docs/a.md", "content": "hello"}'
71
-
72
- # Read (optional: ref for a historical version)
73
- curl -sS "$BASE/v1/repositories/{repository_id}/files/content?path=docs/a.md" -H "$AUTH"
74
- # → {"path": "docs/a.md", "content": "hello", "content_sha256": "...", "ref": "..."}
75
-
76
- # Update content and/or rename. The optional precondition fails the write
77
- # if the file changed since you last read it (use when multiple agents write).
78
- curl -sS -X POST "$BASE/v1/repositories/{repository_id}/files/content" -H "$AUTH" \
79
- -H "Content-Type: application/json" \
80
- -d '{
81
- "path": "docs/a.md",
82
- "content": "updated",
83
- "new_path": "docs/b.md",
84
- "precondition": {"type": "content_sha256", "content_sha256": "<sha from last read>"}
85
- }'
86
-
87
- # Delete
88
- curl -sS -X DELETE "$BASE/v1/repositories/{repository_id}/files/content" -H "$AUTH" \
89
- -H "Content-Type: application/json" -d '{"path": "docs/b.md"}'
90
- # → {"success": true, "commit_sha": "..."}
48
+ git -C "$MEMORY_DIR/../<repo-name>" log --oneline -- <path>
91
49
  ```
92
50
 
93
- ### Version History
51
+ ## Managing Repositories (create / attach / detach)
52
+
53
+ Use the `letta shared-memory` subcommand. It uses your harness auth (works even when `LETTA_API_KEY` is not in the shell env) and inherits the agent id from `AGENT_ID`, so `--agent` is only needed when targeting another agent.
94
54
 
95
55
  ```bash
96
- # List commits (optionally scoped to one path)
97
- curl -sS "$BASE/v1/repositories/{repository_id}/versions?path=docs/a.md&limit=20" -H "$AUTH"
98
- # → {"commits": [{"sha": "...", "message": "...", "timestamp": "...", "author_name": ...}]}
56
+ # List org repositories (marks which are attached to you)
57
+ letta shared-memory list
99
58
 
100
- # Read a file as of a specific commit
101
- curl -sS "$BASE/v1/repositories/{repository_id}/versions/{sha}?path=docs/a.md" -H "$AUTH"
102
- ```
59
+ # Create a repository
60
+ letta shared-memory create --name shared-notes
103
61
 
104
- ### Attaching Shared Memory to Agents
62
+ # Attach to yourself: attaches via the API, clones the local mount at
63
+ # $MEMORY_DIR/../shared-notes, and recompiles the system prompt projection
64
+ letta shared-memory attach shared-notes
105
65
 
106
- Attaching projects the repository into the agent's environments; detaching removes it. Neither changes the agent's own MemFS.
66
+ # Attach to another agent (its mount materializes in that agent's environments)
67
+ letta shared-memory attach shared-notes --agent agent-...
107
68
 
108
- ```bash
109
- # List shared memory attached to an agent
110
- curl -sS "$BASE/v1/agents/{agent_id}/repositories" -H "$AUTH"
69
+ # Detach (leaves the local mount directory in place)
70
+ letta shared-memory detach shared-notes
111
71
 
112
- # Attach
113
- curl -sS -X POST "$BASE/v1/agents/{agent_id}/repositories" -H "$AUTH" \
114
- -H "Content-Type: application/json" -d '{"repository_id": "repo-..."}'
72
+ # Repair/refresh mounts: clone or pull every attached repository. Use this when
73
+ # the system prompt references a repository that is missing on disk (e.g. after
74
+ # it was attached from another surface while this session was running).
75
+ letta shared-memory sync
115
76
 
116
- # Detach
117
- curl -sS -X DELETE "$BASE/v1/agents/{agent_id}/repositories/{repository_id}" -H "$AUTH"
77
+ # Commit history via the API (works even without a local mount)
78
+ letta shared-memory history shared-notes --path docs/plan.md
118
79
  ```
119
80
 
120
- Attaching is asynchronous — after a POST, poll the list endpoint until the repository appears before relying on it. You can attach shared memory to yourself (`$AGENT_ID`) or to another agent to share context with it.
81
+ ## Troubleshooting
82
+
83
+ - **Prompt lists a repository but `$MEMORY_DIR/../<name>` is missing** — the repository was attached without materializing the mount. Run `letta shared-memory sync`.
84
+ - **`sync` reports "mount path already exists and is not a git repository"** — a plain directory (usually created by hand before the mount existed) is occupying the mount path. Inspect it, salvage anything worth keeping, move or delete it, then re-run `letta shared-memory sync`.
85
+ - **Never hand-clone the repository to another location (e.g. /tmp) to work around a broken mount** — fix the mount with `letta shared-memory sync` so every session and other agents see the same checkout.
86
+ - **Permission denied under another agent's directory** — shared repositories mount per-agent. Only your own mount (under your agent directory) is accessible; another agent's mount of the same repository is walled off by the cross-agent guard. Run `letta shared-memory sync` to get your own mount.
87
+ - **Push rejected (non-fast-forward)** — another agent pushed first: `git pull --rebase`, resolve any conflicts, push again.
121
88
 
122
89
  ## Notes and Limits
123
90
 
124
- - Shared memory files are **text** content; binary files are not supported via the files API.
125
- - Attached shared memory is not scoped to you — another agent may edit the same files at any time. Use the `content_sha256` precondition on updates when multiple agents may write the same file; on failure, re-read and retry.
126
91
  - Shared memory is not part of your system prompt. Writing to it does not change your in-context memory — for that, edit your memory blocks or MemFS files.
127
- - SDK equivalent: `@letta-ai/letta-agent-sdk` exposes these operations as `client.repositories` (with `files` and `versions` helpers) and supports attaching shared memory for a session's lifetime via `resources: [{ type: "repository", repositoryId }]` on cloud sessions.
92
+ - Attaching is asynchronous on the server; `letta shared-memory attach` waits for the attachment to be visible before cloning.
93
+ - SDK/API equivalent for programmatic callers: `@letta-ai/letta-agent-sdk` exposes these operations as `client.repositories` (with `files` and `versions` helpers), and shared memory can be attached for a session's lifetime via `resources: [{ type: "repository", repositoryId }]` on cloud sessions. The REST resource is `/v1/repositories`.