@letta-ai/letta-code 0.34.11 → 0.34.13
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/app-server-client.cjs +2 -2
- package/dist/app-server-client.cjs.map +3 -3
- package/dist/app-server-client.js +2 -2
- package/dist/app-server-client.js.map +3 -3
- package/dist/mcp-client.js +2 -2
- package/dist/mcp-client.js.map +1 -1
- package/dist/mcp-oauth.js +2 -2
- package/dist/mcp-oauth.js.map +1 -1
- package/dist/types/agent/organization-id.d.ts +33 -0
- package/dist/types/agent/organization-id.d.ts.map +1 -0
- package/dist/types/agent/skills.d.ts.map +1 -1
- package/dist/types/agent/subagent-state.d.ts +4 -0
- package/dist/types/agent/subagent-state.d.ts.map +1 -1
- package/dist/types/agent/subagents/index.d.ts.map +1 -1
- package/dist/types/auth/oauth.d.ts +2 -0
- package/dist/types/auth/oauth.d.ts.map +1 -1
- package/dist/types/backend/api/environments.d.ts +2 -0
- package/dist/types/backend/api/environments.d.ts.map +1 -1
- package/dist/types/backend/api/metadata.d.ts +5 -1
- package/dist/types/backend/api/metadata.d.ts.map +1 -1
- package/dist/types/cli/subcommands/mcp.d.ts +2 -1
- package/dist/types/cli/subcommands/mcp.d.ts.map +1 -1
- package/dist/types/tools/impl/claude-stream-session.d.ts +3 -0
- package/dist/types/tools/impl/claude-stream-session.d.ts.map +1 -1
- package/dist/types/tools/impl/codex-app-server.d.ts +6 -0
- package/dist/types/tools/impl/codex-app-server.d.ts.map +1 -1
- package/dist/types/tools/impl/external-coding-agent-task.d.ts +2 -1
- package/dist/types/tools/impl/external-coding-agent-task.d.ts.map +1 -1
- package/dist/types/tools/impl/external-coding-agent.d.ts +7 -1
- package/dist/types/tools/impl/external-coding-agent.d.ts.map +1 -1
- package/dist/types/tools/impl/external-tool-call.d.ts +11 -0
- package/dist/types/tools/impl/external-tool-call.d.ts.map +1 -0
- package/dist/types/tools/impl/kill-bash.d.ts.map +1 -1
- package/dist/types/tools/impl/monitor-backup.d.ts +43 -0
- package/dist/types/tools/impl/monitor-backup.d.ts.map +1 -0
- package/dist/types/tools/impl/monitor.d.ts +2 -0
- package/dist/types/tools/impl/monitor.d.ts.map +1 -1
- package/dist/types/tools/impl/opencode-server.d.ts +36 -0
- package/dist/types/tools/impl/opencode-server.d.ts.map +1 -0
- package/dist/types/tools/impl/opencode-session.d.ts +47 -0
- package/dist/types/tools/impl/opencode-session.d.ts.map +1 -0
- package/dist/types/tools/impl/remote-external-coding-agent.d.ts +53 -0
- package/dist/types/tools/impl/remote-external-coding-agent.d.ts.map +1 -0
- package/dist/types/tools/impl/send-agent-message.d.ts.map +1 -1
- package/dist/types/tools/impl/shell-env.d.ts.map +1 -1
- package/dist/types/tools/impl/task.d.ts +4 -0
- package/dist/types/tools/impl/task.d.ts.map +1 -1
- package/dist/types/tools/impl/workflow.d.ts +6 -3
- package/dist/types/tools/impl/workflow.d.ts.map +1 -1
- package/dist/types/tools/workflow/journal.d.ts +1 -1
- package/dist/types/tools/workflow/journal.d.ts.map +1 -1
- package/dist/types/tools/workflow/types.d.ts +16 -7
- package/dist/types/tools/workflow/types.d.ts.map +1 -1
- package/dist/types/tools/workflow/workflow-engine.d.ts.map +1 -1
- package/dist/types/types/app-server-info.d.ts +4 -0
- package/dist/types/types/app-server-info.d.ts.map +1 -1
- package/dist/types/types/file-write-protocol.d.ts +41 -0
- package/dist/types/types/file-write-protocol.d.ts.map +1 -0
- package/dist/types/types/protocol_v2.d.ts +5 -19
- package/dist/types/types/protocol_v2.d.ts.map +1 -1
- package/dist/types/types/subagent-protocol.d.ts +13 -0
- package/dist/types/types/subagent-protocol.d.ts.map +1 -1
- package/letta.js +5457 -4088
- package/npm-shrinkwrap.json +69 -69
- package/package.json +2 -2
- package/scripts/source-file-size-baseline.json +2 -2
- package/skills/creating-skills/scripts/package-skill.ts +18 -8
- package/skills/managing-agent-webhooks/SKILL.md +305 -0
- package/skills/managing-agent-webhooks/scripts/manage-agent-webhooks.mjs +1364 -0
- package/skills/workflow-authoring/SKILL.md +18 -13
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: managing-agent-webhooks
|
|
3
|
+
description: Creates, lists, tests, enables, disables, rotates, inspects, and deletes inbound webhooks for the current Letta Cloud agent. Use when a user asks to set up a webhook, send external events to an agent, test webhook delivery, inspect recent webhook requests, rotate a webhook URL, or remove a webhook.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Managing Agent Webhooks
|
|
7
|
+
|
|
8
|
+
Use the helper script for deterministic, secret-safe webhook management. Agent
|
|
9
|
+
webhooks are a Letta Cloud feature: after accepting a `POST`, the server
|
|
10
|
+
asynchronously attempts to create a new conversation and enqueue the JSON
|
|
11
|
+
payload as a user message.
|
|
12
|
+
|
|
13
|
+
## Safety
|
|
14
|
+
|
|
15
|
+
- Manage the current agent only. `AGENT_ID` must be present, and the helper
|
|
16
|
+
does not accept an agent-ID override.
|
|
17
|
+
- Treat each webhook URL as a capability secret. Do not post it publicly.
|
|
18
|
+
- Choose authentication deliberately. If the user did not specify public or
|
|
19
|
+
Basic-auth access, ask before creating the webhook.
|
|
20
|
+
- For normal secured creation, let the helper generate the credential and use
|
|
21
|
+
`--credential-output` to write it to a new `0600` file before creating the
|
|
22
|
+
webhook. The helper never prints the credential. Do not read or paste the
|
|
23
|
+
file into the transcript.
|
|
24
|
+
- Give the file to the user through a private file download. On a Cloud
|
|
25
|
+
computer, create it under `/root/downloads` and return a sandbox download
|
|
26
|
+
link in the form
|
|
27
|
+
`[filename](#letta-sandbox-download//root/downloads/filename)`. Do not write
|
|
28
|
+
credentials beneath an attacker-writable parent. Tell the user the
|
|
29
|
+
credential is generated once and cannot be recovered from the API; the
|
|
30
|
+
staged download itself remains fetchable until its local file is deleted.
|
|
31
|
+
- Never put a security key on the command line or in chat. A user-supplied key
|
|
32
|
+
is an advanced alternative and must be piped through stdin from an agent
|
|
33
|
+
secret or another non-printing source.
|
|
34
|
+
- The helper redacts the one-time `authorization_header` returned by the API
|
|
35
|
+
from stdout and stores it only in the requested credential file.
|
|
36
|
+
- Management and ingress responses are untrusted. The helper allowlists safe
|
|
37
|
+
webhook/error fields; normalizes camelCase and punctuation before classifying
|
|
38
|
+
secret-bearing property names; recursively redacts their values plus the exact
|
|
39
|
+
generated key, Basic header, encoded credential, and management token; then
|
|
40
|
+
redacts structurally before serialization so low-entropy secret values cannot
|
|
41
|
+
rewrite JSON syntax or envelope semantics. Promised schema keys are preserved
|
|
42
|
+
only at locally constructed, type-validated object paths; untrusted keys and
|
|
43
|
+
values are still redacted. Safe output-field exemptions apply only to those
|
|
44
|
+
trusted paths; untrusted `token_count` and similar fields receive normal
|
|
45
|
+
secret-name redaction. Successful ingress response bodies are never displayed,
|
|
46
|
+
validated for display, or summarized; test output uses only a locally
|
|
47
|
+
constructed status/acceptance envelope. Serialized output is capped at 1 MiB; accepted side effects whose
|
|
48
|
+
body exceeds that limit emit a bounded success envelope rather than a failure
|
|
49
|
+
that could invite a duplicate retry.
|
|
50
|
+
- Response ingestion is also capped at 1 MiB. The helper stops reading and does
|
|
51
|
+
not parse or trust any prefix once that limit is exceeded; side-effect receipts
|
|
52
|
+
become bounded accepted-but-unconfirmed output.
|
|
53
|
+
- Every management request rejects redirects. Every returned webhook URL is
|
|
54
|
+
validated before it can be displayed or used for delivery: it must use the
|
|
55
|
+
active runtime's canonical origin and exactly
|
|
56
|
+
`/v1/agent-webhooks/<returned-slug>`, with no URL credentials, query, fragment,
|
|
57
|
+
malformed slug, or redirect. A redirect or transport failure after a mutation
|
|
58
|
+
dispatch is ambiguous. So are `5xx`, `408`, `429`, and every status outside
|
|
59
|
+
the explicit pre-handler rejection allowlist. Reconcile before retrying and
|
|
60
|
+
never treat a redirect target or non-definitive status as proof that the
|
|
61
|
+
mutation did nothing.
|
|
62
|
+
- Every returned webhook record must belong to the authoritative runtime
|
|
63
|
+
`AGENT_ID`. A same-origin record for another agent is rejected before output
|
|
64
|
+
or delivery; a mismatch after an accepted mutation uses the accepted/reconcile
|
|
65
|
+
path rather than ordinary success.
|
|
66
|
+
- Rotating invalidates the old URL. Deleting is permanent. Use the required
|
|
67
|
+
`--confirm` flag only after the user has approved that exact action.
|
|
68
|
+
- Request bodies may contain sensitive third-party data. `requests` omits them
|
|
69
|
+
unless `--include-body` is explicitly passed. The typed
|
|
70
|
+
`authorization_passed` boolean remains visible; an untyped value is rejected.
|
|
71
|
+
History output is constructed only from typed `id`, `status_code`,
|
|
72
|
+
`authorization_passed`, `enqueued`, nullable `error_message`, and `created_at`,
|
|
73
|
+
plus the locally derived `accepted`; `enqueued` is validated but intentionally
|
|
74
|
+
omitted, and alternate body-like or future server fields are never spread into
|
|
75
|
+
stdout.
|
|
76
|
+
- Sending a test starts asynchronous agent work. Ask for affirmative consent
|
|
77
|
+
before passing `--confirm`; do not treat general webhook setup approval as
|
|
78
|
+
permission to trigger a test run.
|
|
79
|
+
- If test delivery is ambiguous, webhook state and request history cannot
|
|
80
|
+
reliably prove whether asynchronous agent work started. Do not retry without
|
|
81
|
+
renewed affirmative user consent and explicit acceptance of duplicate-work
|
|
82
|
+
risk.
|
|
83
|
+
- After a secure-create request is dispatched, any transport failure, 5xx, or
|
|
84
|
+
unreadable/truncated/contradictory success response is ambiguous. The helper
|
|
85
|
+
validates the returned authentication mode for public, generated-key, and
|
|
86
|
+
user-supplied-key creation, plus the returned Basic header for both secured
|
|
87
|
+
modes. It preserves generated credentials and tells you to list webhooks and
|
|
88
|
+
reconcile the name before any retry. Never blindly retry an ambiguous create.
|
|
89
|
+
- For test, update, rotate, and delete, successful HTTP headers establish that
|
|
90
|
+
the side effect was accepted. If the success body is truncated, malformed,
|
|
91
|
+
or cannot be validated, the helper emits an operation-specific exit-0 receipt
|
|
92
|
+
with the HTTP status and reconciliation guidance rather than a generic error
|
|
93
|
+
that could trigger a duplicate mutation.
|
|
94
|
+
- Delete reports `deleted: true` only after a `200` JSON object with literal
|
|
95
|
+
`success: true`. A false, missing, malformed, null, empty, oversized, or
|
|
96
|
+
unreadable receipt means deletion was accepted but remains unconfirmed; list
|
|
97
|
+
webhooks before treating the capability URL as removed or retrying.
|
|
98
|
+
- Normal update output additionally requires the returned webhook ID and
|
|
99
|
+
`enabled` state to match the requested operation; normal rotate output
|
|
100
|
+
requires the returned webhook ID to match. Canonical but contradictory 2xx
|
|
101
|
+
records receive the same accepted/reconcile envelope and are never printed as
|
|
102
|
+
ordinary success.
|
|
103
|
+
- Normal create output also requires returned name and enabled state to match.
|
|
104
|
+
An explicitly supplied preprompt must round-trip exactly; when preprompt is
|
|
105
|
+
omitted, the server-owned default is accepted only as a nonblank string, while
|
|
106
|
+
missing, null, empty, whitespace-only, and non-string values are contradictory.
|
|
107
|
+
Rotate first reads the current agent-bound record and reports ordinary success
|
|
108
|
+
only when the returned canonical slug/URL changed; an unchanged result is
|
|
109
|
+
accepted but requires reconciliation.
|
|
110
|
+
|
|
111
|
+
## Environment
|
|
112
|
+
|
|
113
|
+
Live operations require:
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
LETTA_API_KEY=... # supplied by the active Letta runtime
|
|
117
|
+
LETTA_BASE_URL=... # supplied by the active runtime; never override it
|
|
118
|
+
AGENT_ID=agent-... # required; the helper manages only this agent
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
Run the helper with:
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
node <SKILL_DIR>/scripts/manage-agent-webhooks.mjs <command> [options]
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
Output is JSON. Summarize the result for the user instead of pasting large raw
|
|
128
|
+
responses.
|
|
129
|
+
|
|
130
|
+
## Workflow
|
|
131
|
+
|
|
132
|
+
1. List current webhooks first to avoid accidental duplicates.
|
|
133
|
+
2. For creation, establish a short name, a preprompt describing how the agent
|
|
134
|
+
should interpret payloads, and whether the endpoint is public or secured.
|
|
135
|
+
3. Create the webhook and report its URL. For a secured webhook, give the user
|
|
136
|
+
the generated credential file as a private download without opening it.
|
|
137
|
+
Remind the user to store it safely because the credential is not returned
|
|
138
|
+
by later list calls.
|
|
139
|
+
4. Ask for affirmative consent before sending a smoke-test payload. Then pass
|
|
140
|
+
`--confirm` for that exact test.
|
|
141
|
+
5. Report HTTP `202` only as accepted by the ingress handler. Conversation
|
|
142
|
+
creation and queue submission happen asynchronously after the response;
|
|
143
|
+
request history cannot prove or correlate successful dispatch.
|
|
144
|
+
6. Explain that every accepted request attempts to start a separate
|
|
145
|
+
conversation asynchronously.
|
|
146
|
+
|
|
147
|
+
## Commands
|
|
148
|
+
|
|
149
|
+
### List
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
node <SKILL_DIR>/scripts/manage-agent-webhooks.mjs list
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
### Create a public webhook
|
|
156
|
+
|
|
157
|
+
Use only when the user explicitly accepts a public capability URL:
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
node <SKILL_DIR>/scripts/manage-agent-webhooks.mjs create \
|
|
161
|
+
--name "Build events" \
|
|
162
|
+
--preprompt "Summarize this build event and tell the user whether action is needed." \
|
|
163
|
+
--public
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
### Create a secured webhook with a generated credential
|
|
167
|
+
|
|
168
|
+
Prefer this for normal secured creation. Choose a unique new filename; the
|
|
169
|
+
helper refuses to overwrite an existing file.
|
|
170
|
+
|
|
171
|
+
```bash
|
|
172
|
+
node <SKILL_DIR>/scripts/manage-agent-webhooks.mjs create \
|
|
173
|
+
--name "Pager events" \
|
|
174
|
+
--preprompt "Triage this pager event and summarize its urgency." \
|
|
175
|
+
--secure \
|
|
176
|
+
--credential-output /root/downloads/pager-events-webhook-credential.json
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
The output reports the webhook URL and credential-file path but not the file's
|
|
180
|
+
contents. Return the URL in chat and a private download link for the file. The
|
|
181
|
+
file contains the generated security key and complete `Authorization` header,
|
|
182
|
+
is created with mode `0600` on POSIX systems, and must be treated as a secret.
|
|
183
|
+
The helper writes and syncs it before the API request. It removes the file only
|
|
184
|
+
after a definitive rejection; once dispatch begins it preserves the credential
|
|
185
|
+
across connection resets, 5xx responses, truncated success bodies, malformed
|
|
186
|
+
responses, close failures, and stdout failures. Do not use `cat`, JSON
|
|
187
|
+
inspection, shell
|
|
188
|
+
interpolation, or any other operation that would put its contents in the agent
|
|
189
|
+
transcript. Delete the sandbox copy after the user confirms safe receipt.
|
|
190
|
+
|
|
191
|
+
### Create a webhook with a user-supplied security key
|
|
192
|
+
|
|
193
|
+
Use this advanced path only when the user already controls the key and does not
|
|
194
|
+
need a generated credential file.
|
|
195
|
+
|
|
196
|
+
Read the key from stdin without echoing or placing it in process arguments:
|
|
197
|
+
|
|
198
|
+
```bash
|
|
199
|
+
printf '%s' "$WEBHOOK_SECURITY_KEY" | \
|
|
200
|
+
node <SKILL_DIR>/scripts/manage-agent-webhooks.mjs create \
|
|
201
|
+
--name "Pager events" \
|
|
202
|
+
--preprompt "Triage this pager event and summarize its urgency." \
|
|
203
|
+
--security-key-stdin
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
The caller sends `Authorization: Basic <base64("webhook:<security-key>")>`.
|
|
207
|
+
Do not print that header or the key. The helper derives it internally for test
|
|
208
|
+
requests when the same key is piped through stdin.
|
|
209
|
+
|
|
210
|
+
### Test acceptance
|
|
211
|
+
|
|
212
|
+
Public webhook:
|
|
213
|
+
|
|
214
|
+
```bash
|
|
215
|
+
node <SKILL_DIR>/scripts/manage-agent-webhooks.mjs test \
|
|
216
|
+
--webhook-id webhook-agent-... \
|
|
217
|
+
--confirm
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
Secured webhook using the generated credential file:
|
|
221
|
+
|
|
222
|
+
```bash
|
|
223
|
+
node <SKILL_DIR>/scripts/manage-agent-webhooks.mjs test \
|
|
224
|
+
--webhook-id webhook-agent-... \
|
|
225
|
+
--credential-file /root/downloads/pager-events-webhook-credential.json \
|
|
226
|
+
--payload-file /tmp/event.json \
|
|
227
|
+
--confirm
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
The helper reads the authorization header internally; it does not print it.
|
|
231
|
+
When the generated JSON contains both fields, the helper verifies that
|
|
232
|
+
`authorization_header` matches `security_key` before sending a request.
|
|
233
|
+
|
|
234
|
+
Secured webhook using a user-supplied key:
|
|
235
|
+
|
|
236
|
+
```bash
|
|
237
|
+
printf '%s' "$WEBHOOK_SECURITY_KEY" | \
|
|
238
|
+
node <SKILL_DIR>/scripts/manage-agent-webhooks.mjs test \
|
|
239
|
+
--webhook-id webhook-agent-... \
|
|
240
|
+
--payload-file /tmp/event.json \
|
|
241
|
+
--security-key-stdin \
|
|
242
|
+
--confirm
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
For a custom payload, prefer an existing protected JSON file. Never place
|
|
246
|
+
sensitive payload JSON directly in argv, shell history, or process listings.
|
|
247
|
+
Delete temporary payload files after the test. The helper never prints,
|
|
248
|
+
validates for display, or summarizes the ingress response body, because a
|
|
249
|
+
provider could echo protected payload-file values under otherwise benign keys.
|
|
250
|
+
|
|
251
|
+
Inspect recent accepted requests separately:
|
|
252
|
+
|
|
253
|
+
```bash
|
|
254
|
+
node <SKILL_DIR>/scripts/manage-agent-webhooks.mjs requests \
|
|
255
|
+
--webhook-id webhook-agent-... \
|
|
256
|
+
--limit 5
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
Pass `--include-body` only when the user needs payload contents and it is safe
|
|
260
|
+
to display them. Request history is written fire-and-forget and cannot be
|
|
261
|
+
correlated with the test command, so do not use it as proof of dispatch.
|
|
262
|
+
|
|
263
|
+
### Enable or disable
|
|
264
|
+
|
|
265
|
+
```bash
|
|
266
|
+
node <SKILL_DIR>/scripts/manage-agent-webhooks.mjs disable \
|
|
267
|
+
--webhook-id webhook-agent-... --confirm
|
|
268
|
+
|
|
269
|
+
node <SKILL_DIR>/scripts/manage-agent-webhooks.mjs enable \
|
|
270
|
+
--webhook-id webhook-agent-...
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
### Rotate or delete
|
|
274
|
+
|
|
275
|
+
```bash
|
|
276
|
+
node <SKILL_DIR>/scripts/manage-agent-webhooks.mjs rotate \
|
|
277
|
+
--webhook-id webhook-agent-... --confirm
|
|
278
|
+
|
|
279
|
+
node <SKILL_DIR>/scripts/manage-agent-webhooks.mjs delete \
|
|
280
|
+
--webhook-id webhook-agent-... --confirm
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
After rotation, give the user the new URL and clearly state that the old one no
|
|
284
|
+
longer works.
|
|
285
|
+
|
|
286
|
+
## Errors
|
|
287
|
+
|
|
288
|
+
- `404 Webhook not found` on management routes can mean the webhook feature is
|
|
289
|
+
unavailable to the organization, the webhook ID is wrong, or the caller
|
|
290
|
+
lacks permission. Do not claim the agent itself is missing without checking
|
|
291
|
+
the response's `errorCode`.
|
|
292
|
+
- `401 Unauthorized` from a webhook test means the endpoint requires Basic
|
|
293
|
+
auth and the supplied key was missing or wrong.
|
|
294
|
+
- If secure creation says its status is unknown or may have succeeded, keep the
|
|
295
|
+
credential file, run `list`, and reconcile the requested name before retrying
|
|
296
|
+
or deleting anything. A retry without reconciliation can create a duplicate.
|
|
297
|
+
- If cleanup reports that a sensitive file may remain, tell the user the path
|
|
298
|
+
without reading it and remove it manually once it is safe to do so.
|
|
299
|
+
- Malformed credential or payload JSON produces a fixed diagnostic that does
|
|
300
|
+
not quote source fragments. Repair the protected file outside the transcript;
|
|
301
|
+
never paste its contents into chat to diagnose it.
|
|
302
|
+
- A `202 {"ok":true}` response means accepted by the ingress handler, not
|
|
303
|
+
dispatched or completed. Do not report successful conversation creation or
|
|
304
|
+
queueing from that response or from the history `enqueued` field; the server
|
|
305
|
+
currently derives that field from the same `202` status.
|