@letta-ai/letta-code 0.28.6 → 0.28.8

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@letta-ai/letta-code",
3
- "version": "0.28.6",
3
+ "version": "0.28.8",
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",
@@ -73,6 +73,7 @@ const ciDirs = [
73
73
  "src/cli",
74
74
  "src/cron",
75
75
  "src/experiments",
76
+ "src/helpers",
76
77
  "src/hooks",
77
78
  "src/lsp",
78
79
  "src/mods",
@@ -69,6 +69,21 @@
69
69
  "path": "src/websocket/listener/auth-lifecycle.test.ts",
70
70
  "timeoutMs": 30000,
71
71
  "reason": "Exercises real WebSockets while mutating listener, settings, HOME, and process environment state."
72
+ },
73
+ {
74
+ "path": "src/websocket/listener/control-inputs.test.ts",
75
+ "timeoutMs": 15000,
76
+ "reason": "Mutates HOME and the remote-settings singleton while exercising cwd recovery persistence."
77
+ },
78
+ {
79
+ "path": "src/websocket/listener/protocol-ergonomics.test.ts",
80
+ "timeoutMs": 15000,
81
+ "reason": "Mutates HOME and the remote-settings singleton while verifying durable cwd-map pruning."
82
+ },
83
+ {
84
+ "path": "src/websocket/listener/remote-settings.test.ts",
85
+ "timeoutMs": 15000,
86
+ "reason": "Mutates HOME and the remote-settings singleton to verify startup cwd-map repair."
72
87
  }
73
88
  ]
74
89
  }
@@ -12,6 +12,7 @@ const dirs = [
12
12
  "src/cli",
13
13
  "src/cron",
14
14
  "src/experiments",
15
+ "src/helpers",
15
16
  "src/hooks",
16
17
  "src/lsp",
17
18
  "src/mods",
@@ -5,12 +5,12 @@
5
5
  "src/backend/local/local-backend.ts": 1058,
6
6
  "src/backend/local/local-store.ts": 3613,
7
7
  "src/backend/pi-stream-adapter.test.ts": 1442,
8
- "src/cli/app/AppCoordinator.tsx": 5198,
8
+ "src/cli/app/AppCoordinator.tsx": 5196,
9
9
  "src/cli/app/AppView.tsx": 1750,
10
10
  "src/cli/app/use-approval-flow.ts": 1163,
11
11
  "src/cli/app/use-configuration-handlers.ts": 1383,
12
12
  "src/cli/app/use-conversation-loop.ts": 2935,
13
- "src/cli/app/use-submit-handler.ts": 4100,
13
+ "src/cli/app/use-submit-handler.ts": 4099,
14
14
  "src/cli/components/AgentSelector.tsx": 1270,
15
15
  "src/cli/components/InputRich.tsx": 2219,
16
16
  "src/cli/components/ModelSelector.tsx": 1204,
@@ -86,9 +86,12 @@ Commands:
86
86
  list-resources List available resources
87
87
  info <tool> Show tool schema
88
88
  call <tool> '<json>' Call a tool
89
+ login Run OAuth flow and cache tokens for this server
90
+ logout Clear cached OAuth tokens for this server
89
91
 
90
92
  Options:
91
- --header "K: V" Add HTTP header (repeatable)
93
+ --header "K: V" Add HTTP header (repeatable). Disables auto-OAuth.
94
+ --auth <mode> "auto" (default), "oauth", or "none"
92
95
  --timeout <ms> Request timeout (default: 30000)
93
96
  ```
94
97
 
@@ -97,13 +100,37 @@ Options:
97
100
  # Basic usage
98
101
  npx tsx mcp-http.ts http://localhost:3001/mcp list-tools
99
102
 
100
- # With authentication
103
+ # With static bearer authentication
101
104
  npx tsx mcp-http.ts http://localhost:3001/mcp --header "Authorization: Bearer KEY" list-tools
102
105
 
106
+ # OAuth-protected server (opens a browser to sign in, then caches tokens)
107
+ npx tsx mcp-http.ts https://example.com/mcp login
108
+ npx tsx mcp-http.ts https://example.com/mcp list-tools
109
+
103
110
  # Call a tool
104
111
  npx tsx mcp-http.ts http://localhost:3001/mcp call vault '{"action":"search","query":"notes"}'
105
112
  ```
106
113
 
114
+ **OAuth support:**
115
+ When a server returns `401 WWW-Authenticate: Bearer ...` and no static
116
+ `Authorization` header was supplied, `mcp-http.ts` will automatically:
117
+
118
+ 1. Discover the authorization server via `resource_metadata`, the
119
+ `realm=` param, or the server's own origin (`.well-known/oauth-authorization-server`
120
+ then `.well-known/openid-configuration`).
121
+ 2. Dynamically register a public client with PKCE (`token_endpoint_auth_method: none`).
122
+ 3. Open the system browser to the authorization endpoint, catch the redirect
123
+ on a `127.0.0.1` loopback port, and exchange the code for tokens.
124
+ 4. Cache the token set (and the registered client) at
125
+ `~/.letta/mcp-oauth/<host>_<path>.json` with `0600` perms.
126
+ 5. Auto-refresh expired access tokens using the stored refresh token before
127
+ each request; if refresh fails, it re-runs the browser flow once.
128
+
129
+ Use `login` to run the flow explicitly (e.g. as a first step in a skill's
130
+ setup) and `logout` to clear cached tokens. Passing an explicit
131
+ `--header "Authorization: ..."` disables auto-OAuth so you stay in control.
132
+ Pass `--auth none` to force static-only behavior.
133
+
107
134
  ### mcp-stdio.ts - stdio Transport
108
135
 
109
136
  Connects to MCP servers that run as subprocesses. No dependencies required.
@@ -153,8 +180,22 @@ Here are some well-known MCP servers:
153
180
  - For stdio: Check the command works when run directly in terminal
154
181
 
155
182
  **"Authentication required" error:**
156
- - Add `--header "Authorization: Bearer YOUR_KEY"` for HTTP
183
+ - Add `--header "Authorization: Bearer YOUR_KEY"` for HTTP servers using static bearers
157
184
  - Or `--env "API_KEY=xxx"` for stdio servers that need env vars
185
+ - For OAuth-protected HTTP servers, just run any command (or `login`) — the helper
186
+ will do PKCE + dynamic client registration and cache tokens under
187
+ `~/.letta/mcp-oauth/`. Delete that file (or run `logout`) to force a re-login.
188
+
189
+ **OAuth issues:**
190
+ - "Could not discover OAuth server metadata": the server didn't include
191
+ `resource_metadata` and its origin doesn't serve `.well-known/oauth-authorization-server`
192
+ or `.well-known/openid-configuration`. Fall back to a static bearer, or point the
193
+ helper at the auth server manually via a custom skill.
194
+ - "Dynamic client registration failed": the auth server disables open DCR.
195
+ You'll need to pre-register a client and pass its `client_id` (and any required
196
+ credentials) via headers, or wrap this skill with a server-specific one.
197
+ - "state mismatch" / callback timeout: another process may be holding the browser
198
+ callback; re-run and complete the sign-in in the newly opened tab.
158
199
 
159
200
  **Tool call fails:**
160
201
  - Use `info <tool>` to see the expected input schema