@letta-ai/letta-code 0.30.19 → 0.30.21

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 (96) hide show
  1. package/dist/app-server-client.cjs +2 -2
  2. package/dist/app-server-client.cjs.map +3 -3
  3. package/dist/app-server-client.js +2 -2
  4. package/dist/app-server-client.js.map +3 -3
  5. package/dist/channels-public.js +29 -6
  6. package/dist/channels-public.js.map +4 -5
  7. package/dist/channels-slack.js +98 -9
  8. package/dist/channels-slack.js.map +7 -6
  9. package/dist/gateway-core.js +34 -4
  10. package/dist/gateway-core.js.map +4 -4
  11. package/dist/mcp-client.js +2 -2
  12. package/dist/mcp-client.js.map +1 -1
  13. package/dist/types/agent/model.d.ts.map +1 -1
  14. package/dist/types/agent/subagents/subagent-launcher.d.ts.map +1 -1
  15. package/dist/types/backend/dev/headless-turn-executor.d.ts.map +1 -1
  16. package/dist/types/backend/dev/pi-model-factory.d.ts +1 -0
  17. package/dist/types/backend/dev/pi-model-factory.d.ts.map +1 -1
  18. package/dist/types/backend/dev/pi-models-runtime.d.ts +3 -1
  19. package/dist/types/backend/dev/pi-models-runtime.d.ts.map +1 -1
  20. package/dist/types/backend/dev/pi-ollama-provider.d.ts +35 -0
  21. package/dist/types/backend/dev/pi-ollama-provider.d.ts.map +1 -1
  22. package/dist/types/backend/dev/pi-stream-adapter.d.ts.map +1 -1
  23. package/dist/types/backend/dev/provider-turn-executor.d.ts +8 -0
  24. package/dist/types/backend/dev/provider-turn-executor.d.ts.map +1 -1
  25. package/dist/types/channels/gateway-core.d.ts +3 -0
  26. package/dist/types/channels/gateway-core.d.ts.map +1 -1
  27. package/dist/types/channels/message-references.d.ts +12 -0
  28. package/dist/types/channels/message-references.d.ts.map +1 -0
  29. package/dist/types/channels/slack/ingress-policy.d.ts +3 -0
  30. package/dist/types/channels/slack/ingress-policy.d.ts.map +1 -1
  31. package/dist/types/channels/slack/public-utils.d.ts +0 -1
  32. package/dist/types/channels/slack/public-utils.d.ts.map +1 -1
  33. package/dist/types/channels/slack/user-mentions.d.ts +10 -0
  34. package/dist/types/channels/slack/user-mentions.d.ts.map +1 -0
  35. package/dist/types/channels/slack/utils.d.ts +0 -1
  36. package/dist/types/channels/slack/utils.d.ts.map +1 -1
  37. package/dist/types/channels/types.d.ts +8 -1
  38. package/dist/types/channels/types.d.ts.map +1 -1
  39. package/dist/types/channels/xml.d.ts +2 -7
  40. package/dist/types/channels/xml.d.ts.map +1 -1
  41. package/dist/types/channels-public.d.ts +1 -0
  42. package/dist/types/channels-public.d.ts.map +1 -1
  43. package/dist/types/channels-slack.d.ts +2 -1
  44. package/dist/types/channels-slack.d.ts.map +1 -1
  45. package/dist/types/mods/capabilities.d.ts +4 -0
  46. package/dist/types/mods/capabilities.d.ts.map +1 -1
  47. package/dist/types/mods/conversation-handle.d.ts.map +1 -1
  48. package/dist/types/mods/conversation-title-events.d.ts +9 -0
  49. package/dist/types/mods/conversation-title-events.d.ts.map +1 -0
  50. package/dist/types/mods/mod-adapter.d.ts.map +1 -1
  51. package/dist/types/mods/types.d.ts +2 -0
  52. package/dist/types/mods/types.d.ts.map +1 -1
  53. package/dist/types/permissions/checker.d.ts.map +1 -1
  54. package/dist/types/permissions/workspace-sandbox.d.ts +19 -0
  55. package/dist/types/permissions/workspace-sandbox.d.ts.map +1 -0
  56. package/dist/types/runtime-context.d.ts +7 -0
  57. package/dist/types/runtime-context.d.ts.map +1 -1
  58. package/dist/types/telemetry/fatal-error-handler.d.ts +13 -0
  59. package/dist/types/telemetry/fatal-error-handler.d.ts.map +1 -0
  60. package/dist/types/telemetry/index.d.ts +2 -0
  61. package/dist/types/telemetry/index.d.ts.map +1 -1
  62. package/dist/types/tools/impl/shell-sandbox.d.ts +1 -1
  63. package/dist/types/tools/impl/shell-sandbox.d.ts.map +1 -1
  64. package/dist/types/tools/impl/task-update.d.ts +1 -1
  65. package/dist/types/tools/impl/task-update.d.ts.map +1 -1
  66. package/dist/types/tools/impl/task.d.ts +1 -0
  67. package/dist/types/tools/impl/task.d.ts.map +1 -1
  68. package/dist/types/tools/impl/tasks/store.d.ts +3 -6
  69. package/dist/types/tools/impl/tasks/store.d.ts.map +1 -1
  70. package/dist/types/tools/toolset.d.ts +1 -0
  71. package/dist/types/tools/toolset.d.ts.map +1 -1
  72. package/dist/types/types/app-server-info.d.ts +1 -0
  73. package/dist/types/types/app-server-info.d.ts.map +1 -1
  74. package/dist/types/types/protocol.d.ts +1 -1
  75. package/dist/types/types/protocol_v2.d.ts +12 -10
  76. package/dist/types/types/protocol_v2.d.ts.map +1 -1
  77. package/dist/types/types/service-protocol.d.ts +11 -0
  78. package/dist/types/types/service-protocol.d.ts.map +1 -1
  79. package/dist/types/types/teleport-protocol.d.ts +54 -0
  80. package/dist/types/types/teleport-protocol.d.ts.map +1 -0
  81. package/dist/types/utils/error.d.ts +1 -1
  82. package/dist/types/utils/error.d.ts.map +1 -1
  83. package/dist/types/websocket/listener/runtime.d.ts.map +1 -1
  84. package/dist/types/websocket/listener/types.d.ts +16 -1
  85. package/dist/types/websocket/listener/types.d.ts.map +1 -1
  86. package/letta.js +4478 -3170
  87. package/package.json +1 -1
  88. package/scripts/isolated-unit-tests.json +5 -0
  89. package/scripts/source-file-size-baseline.json +4 -4
  90. package/skills/creating-mods/references/tools.md +1 -0
  91. package/skills/scheduling-tasks/SKILL.md +10 -8
  92. package/skills/teleporting-between-environments/SKILL.md +100 -0
  93. package/dist/types/cli/helpers/session-context.d.ts +0 -25
  94. package/dist/types/cli/helpers/session-context.d.ts.map +0 -1
  95. package/dist/types/utils/shell-context.d.ts +0 -7
  96. package/dist/types/utils/shell-context.d.ts.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@letta-ai/letta-code",
3
- "version": "0.30.19",
3
+ "version": "0.30.21",
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",
@@ -165,6 +165,11 @@
165
165
  "timeoutMs": 30000,
166
166
  "reason": "Exercises real WebSockets while mutating listener, settings, HOME, and process environment state."
167
167
  },
168
+ {
169
+ "path": "src/websocket/listener/auth-lifecycle-approval-reconnect.test.ts",
170
+ "timeoutMs": 30000,
171
+ "reason": "Exercises real WebSockets while mutating listener, settings, HOME, and process environment state."
172
+ },
168
173
  {
169
174
  "path": "src/websocket/listener/control-inputs.test.ts",
170
175
  "timeoutMs": 15000,
@@ -21,9 +21,9 @@
21
21
  "src/cli/mods/local-mod-loader.test.ts": 1043,
22
22
  "src/cli/reflection-transcript.test.ts": 1084,
23
23
  "src/cli/subcommands/skills.ts": 1264,
24
- "src/headless.ts": 5253,
24
+ "src/headless.ts": 5054,
25
25
  "src/hooks/integration.test.ts": 1147,
26
- "src/index.ts": 2773,
26
+ "src/index.ts": 2775,
27
27
  "src/mods/learning-harness.ts": 2434,
28
28
  "src/mods/mod-engine.test.ts": 2153,
29
29
  "src/mods/mod-engine.ts": 1838,
@@ -44,7 +44,7 @@
44
44
  "src/websocket/listener/commands/memory.ts": 1114,
45
45
  "src/websocket/listener/file-commands.ts": 1053,
46
46
  "src/websocket/listener/lifecycle.ts": 1051,
47
- "src/websocket/listener/protocol-inbound.ts": 2264,
47
+ "src/websocket/listener/protocol-inbound.ts": 2244,
48
48
  "src/websocket/listener/protocol-outbound.ts": 1072,
49
- "src/websocket/listener/turn.ts": 1010
49
+ "src/websocket/listener/turn.ts": 1009
50
50
  }
@@ -22,6 +22,7 @@ For tools that are part of a larger mod with commands, UI, local state, or event
22
22
  - Use `ctx.cwd` as the invocation workspace.
23
23
  - Use the dynamic context passed to `run(ctx)` (`ctx.agent`, `ctx.model`, `ctx.toolset`, `ctx.permissionMode`) instead of reading global app context.
24
24
  - Use `await ctx.conversation.getHistory()` when a tool needs recent conversation context. It returns the most recent messages in chronological order by default.
25
+ - Use `await ctx.conversation.updateTitle(title)` to persist a conversation title and refresh active local UI consumers when the host supports it.
25
26
  - Respect `ctx.signal` for long-running work when practical.
26
27
  - Tools should return information for the model to use; they should not start hidden model runs.
27
28
 
@@ -31,7 +31,7 @@ The CLI reports its placement in the command output. If it warns that the schedu
31
31
  Two patterns cover most schedules:
32
32
 
33
33
  - **Fast follow-ups** ("check on the PR in 5m"): the default is right — same computer as the active conversation. If the session dies before it fires, the follow-up usually died with the task anyway.
34
- - **Recurring jobs** ("every Monday 11am, start the lunch order"): prefer durability. If the CLI warned that a recurring schedule is local, that's usually wrong for the user's intent — recreate it with `--runner cloud`, or `--computer` if the job needs a specific always-on computer. Also consider whether the job should post into a dedicated conversation rather than this one (continuity in one thread vs a fresh context per run).
34
+ - **Recurring jobs** ("every Monday 11am, start the lunch order"): prefer durability. If the CLI warned that a recurring schedule is local, that's usually wrong for the user's intent — recreate it with `--runner cloud`, or `--computer` if the job needs a specific always-on computer. A fresh conversation per run is the default; pass a conversation explicitly when the job needs continuity in one thread.
35
35
 
36
36
  ## CLI Usage
37
37
 
@@ -64,7 +64,7 @@ letta cron add --name <short-name> --description <text> --prompt <text> <schedul
64
64
  | Flag | Description |
65
65
  |------|-------------|
66
66
  | `--agent <id>` | Agent ID (defaults to `LETTA_AGENT_ID` from the current shell/session) |
67
- | `--conversation <id>` | Conversation ID (defaults to `LETTA_CONVERSATION_ID` from the current shell/session, otherwise `"default"`) |
67
+ | `--conversation <id>` | Conversation target: omit or pass `new` for a fresh conversation per fire; pass `self` for the current conversation; pass `default` for the agent default; or pass a concrete ID |
68
68
  | `--runner <runner>` | `cloud` or `local` — normally omit; see "Where Schedules Run" above |
69
69
  | `--computer <id>` | Execute on a specific connected computer — normally omit |
70
70
  | `--once` | Mark `--at` as one-shot (already the default for `--at`) |
@@ -97,7 +97,7 @@ For local run history, `--run-id <id>` selects one run. Cloud history ignores th
97
97
 
98
98
  If exact routing matters, pass both `--agent` and `--conversation` explicitly.
99
99
 
100
- `letta cron add` will otherwise fall back to `LETTA_AGENT_ID` and `LETTA_CONVERSATION_ID` from the current shell/session. Those values may be correct for the current chat, but they can also be inherited from surrounding tooling, another conversation, or an older shell.
100
+ `letta cron add` falls back to `LETTA_AGENT_ID` for the agent. An omitted `--conversation` means `"new"`, so every fire gets a fresh conversation. Pass `--conversation self` to capture the current `LETTA_CONVERSATION_ID`, `--conversation default` for the agent default, or a concrete conversation ID.
101
101
 
102
102
  Safest pattern:
103
103
 
@@ -107,14 +107,14 @@ letta cron add \
107
107
  --description "Daily email summary in this conversation" \
108
108
  --prompt "Check the user's email and post a summary here." \
109
109
  --cron "0 10 * * *" \
110
- --agent "$AGENT_ID" \
111
- --conversation "$CONVERSATION_ID"
110
+ --agent "$LETTA_AGENT_ID" \
111
+ --conversation self
112
112
  ```
113
113
 
114
114
  Then verify the binding explicitly:
115
115
 
116
116
  ```bash
117
- letta cron list --agent "$AGENT_ID" --conversation "$CONVERSATION_ID"
117
+ letta cron list --agent "$LETTA_AGENT_ID" --conversation self
118
118
  ```
119
119
 
120
120
  ### Deleting or Replacing Tasks
@@ -156,7 +156,9 @@ letta cron add \
156
156
  --name "deploy-check" \
157
157
  --description "One-time check on deployment status" \
158
158
  --prompt "Check the deployment status and report the result here." \
159
- --at "in 30m"
159
+ --at "in 30m" \
160
+ --agent "$LETTA_AGENT_ID" \
161
+ --conversation self
160
162
  ```
161
163
 
162
164
  ### "Every weekday at 5pm, remind me to submit my timesheet" (user in UTC−7)
@@ -203,7 +205,7 @@ Include context about what the user originally asked for, so you can give a help
203
205
  - **Minimum granularity**: 1 minute. Intervals under 60 seconds are rounded up.
204
206
  - **Recurring tasks**: No longer auto-expire. They remain active until explicitly cancelled.
205
207
  - **One-shot cleanup (local runner)**: One-shot local tasks are garbage-collected 24 hours after firing.
206
- - **Default binding precedence**: `letta cron add` uses `--agent` / `--conversation` first, then falls back to `LETTA_AGENT_ID` / `LETTA_CONVERSATION_ID`, then finally uses `"default"` for the conversation if no env var is present.
208
+ - **Default binding**: `letta cron add` uses `--agent` first, then `LETTA_AGENT_ID`. Omit `--conversation` for a fresh conversation per fire; use `--conversation self` to capture `LETTA_CONVERSATION_ID` explicitly.
207
209
  - **Local scheduler requirement**: Local schedules only fire while a Letta session is running on their computer; fires while no session runs are marked as missed. Cloud schedules fire from the cloud regardless.
208
210
  - **`--at` for specific times**: `--at "3:00pm"` schedules a one-shot. If the time has already passed today, it schedules for tomorrow.
209
211
  - **Cloud schedule creation failures are loud**: if creating a cloud schedule fails, no schedule is created — a failed create never silently becomes a local schedule. (The local placement for computers the cloud scheduler can't reach is decided before creation and reported in the output.)
@@ -0,0 +1,100 @@
1
+ ---
2
+ name: teleporting-between-environments
3
+ description: Moves the current agent conversation to Cloud or a Cloud-registered remote environment while coordinating machine-local files and setup. Use when the user says "let's continue this task on cloud", asks to continue or move work on another connected computer, wants to teleport between environments, or needs to upload or download artifacts before a handoff.
4
+ ---
5
+
6
+ # Teleporting Between Environments
7
+
8
+ Teleport the current agent and conversation without losing conversational memory. Prepare machine-local state first, then let the destination continue the same task.
9
+
10
+ ## Mental model
11
+
12
+ - **Memory follows the agent; filesystem access does not.** Files, working directories, credentials, running processes, and local services belong to the computer currently executing the conversation.
13
+ - Upload and download paths are relative to the current computer. Cloud cannot read a laptop path until the conversation teleports to that laptop.
14
+ - The conversation’s managed Cloud sandbox remains alive while the conversation runs elsewhere.
15
+ - Filesystem paths and cwd do not transfer between computers. Re-establish the destination’s repository, working directory, dependencies, credentials, and services after arrival.
16
+
17
+ ## Commands
18
+
19
+ ```bash
20
+ letta teleport list
21
+ letta teleport cloud
22
+ letta teleport <environment>
23
+ ```
24
+
25
+ - `list`: show accessible online remote targets. Desktop Local is excluded.
26
+ - `cloud`: create or resume this conversation’s managed Cloud sandbox.
27
+ - `<environment>`: target a listed remote environment by its friendly selector.
28
+
29
+ Teleport cannot target Desktop Local yet. Once the conversation runs in Cloud,
30
+ the agent cannot programmatically return to Desktop Local. The user can still
31
+ switch manually with Desktop's environment picker. Do not run or recommend
32
+ `letta teleport back`.
33
+
34
+ Transfer files with the existing sandbox commands:
35
+
36
+ ```bash
37
+ letta sandbox upload <local-path>
38
+ letta sandbox download <sandbox-path> [--to <local-path>]
39
+ ```
40
+
41
+ Do not invent `letta teleport push`, `pull`, or remote file-listing commands. No sandbox ID or wake command is needed.
42
+
43
+ ## Prepare the handoff
44
+
45
+ Before teleporting:
46
+
47
+ 1. Identify the target and every file, repository state, credential, service, or setup step the task needs there.
48
+ 2. Finish work that requires the current computer. Verify relevant files exist before transferring them.
49
+ 3. Upload current-computer artifacts needed in Cloud and retain the returned `/root/downloads/...` paths in context.
50
+ 4. Retain enough context to recreate destination-local setup, including the repository, branch or revision, working directory, dependency commands, and next action.
51
+ 5. Run teleport only after all source-side preparation is complete.
52
+
53
+ ## Teleport is the final action
54
+
55
+ Run the teleport command as the only command in the final Bash tool call. Do not chain later commands, poll the teleport operation, or invoke another source-side tool after it.
56
+
57
+ The CLI intentionally returns after the server accepts the handoff. Once the Bash result is persisted, the source yields at a clean turn or tool boundary and the destination resumes with no synthetic user message.
58
+
59
+ If the command reports an offline, stale, unsupported, same-source, or startup error, the conversation remains on the source. Surface the concrete error, correct it if possible, and retry only after the target is available.
60
+
61
+ ## Common workflows
62
+
63
+ ### Continue local work in Cloud
64
+
65
+ 1. Inspect the local task state and identify local-only artifacts or setup.
66
+ 2. Upload each artifact Cloud needs:
67
+
68
+ ```bash
69
+ letta sandbox upload <local-path>
70
+ ```
71
+
72
+ 3. Retain each returned sandbox path.
73
+ 4. As the final action, run:
74
+
75
+ ```bash
76
+ letta teleport cloud
77
+ ```
78
+
79
+ 5. After continuation in Cloud, establish the Cloud-local cwd and repository setup before using the uploaded paths.
80
+
81
+ ### Return to Desktop Local
82
+
83
+ The agent cannot initiate this transition. Retain the next local action and ask
84
+ the user to select Local from Desktop's environment picker. After continuation
85
+ locally, resume the task from the retained context.
86
+
87
+ ### Continue on another connected computer
88
+
89
+ 1. Discover available targets if needed:
90
+
91
+ ```bash
92
+ letta teleport list
93
+ ```
94
+
95
+ 2. Prepare or upload everything the current computer owns.
96
+ 3. As the final action, run:
97
+
98
+ ```bash
99
+ letta teleport <environment>
100
+ ```
@@ -1,25 +0,0 @@
1
- import type { SessionContextReason } from "../../reminders/state";
2
- import type { ShellContext } from "../../utils/shell-context";
3
- export type SessionContextSource = "interactive-cli" | "headless" | "listen";
4
- /**
5
- * Get the current local time in a human-readable format
6
- */
7
- export declare function getLocalTime(): string;
8
- /**
9
- * Get device type based on platform
10
- */
11
- export declare function getDeviceType(): string;
12
- export interface BuildSessionContextOptions {
13
- cwd?: string;
14
- source?: SessionContextSource;
15
- reason?: SessionContextReason;
16
- shellContext?: ShellContext;
17
- }
18
- export declare function buildWindowsShellNotes(shellContext?: ShellContext): string;
19
- /**
20
- * Build the session context system reminder (device/environment info only).
21
- * Agent metadata is handled separately by buildAgentMetadata().
22
- * Returns empty string on any failure (graceful degradation).
23
- */
24
- export declare function buildSessionContext(options?: BuildSessionContextOptions): string;
25
- //# sourceMappingURL=session-context.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"session-context.d.ts","sourceRoot":"","sources":["../../../../src/cli/helpers/session-context.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAI1D,MAAM,MAAM,oBAAoB,GAAG,iBAAiB,GAAG,UAAU,GAAG,QAAQ,CAAC;AAE7E;;GAEG;AACH,wBAAgB,YAAY,IAAI,MAAM,CAWrC;AAED;;GAEG;AACH,wBAAgB,aAAa,IAAI,MAAM,CAYtC;AAkCD,MAAM,WAAW,0BAA0B;IACzC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,oBAAoB,CAAC;IAC9B,MAAM,CAAC,EAAE,oBAAoB,CAAC;IAC9B,YAAY,CAAC,EAAE,YAAY,CAAC;CAC7B;AAmBD,wBAAgB,sBAAsB,CAAC,YAAY,CAAC,EAAE,YAAY,GAAG,MAAM,CAsB1E;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,CAAC,EAAE,0BAA0B,GACnC,MAAM,CA2ER"}
@@ -1,7 +0,0 @@
1
- export type ShellFamily = "powershell" | "cmd" | "bash" | "unknown";
2
- export interface ShellContext {
3
- family: ShellFamily;
4
- displayName: string;
5
- }
6
- export declare function detectShellContext(env?: NodeJS.ProcessEnv, currentPlatform?: NodeJS.Platform): ShellContext;
7
- //# sourceMappingURL=shell-context.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"shell-context.d.ts","sourceRoot":"","sources":["../../../src/utils/shell-context.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,WAAW,GAAG,YAAY,GAAG,KAAK,GAAG,MAAM,GAAG,SAAS,CAAC;AAEpE,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,WAAW,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;CACrB;AAgDD,wBAAgB,kBAAkB,CAChC,GAAG,GAAE,MAAM,CAAC,UAAwB,EACpC,eAAe,GAAE,MAAM,CAAC,QAAqB,GAC5C,YAAY,CAUd"}