@letta-ai/letta-code 0.34.18 → 0.34.20

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 (87) hide show
  1. package/dist/gateway-core.js +2 -2
  2. package/dist/gateway-core.js.map +3 -3
  3. package/dist/mcp-client.js +2 -2
  4. package/dist/mcp-client.js.map +1 -1
  5. package/dist/mcp-oauth.js +2 -2
  6. package/dist/mcp-oauth.js.map +1 -1
  7. package/dist/types/agent/approval-execution.d.ts +33 -1
  8. package/dist/types/agent/approval-execution.d.ts.map +1 -1
  9. package/dist/types/agent/mcp-originator-authority-file.d.ts +75 -0
  10. package/dist/types/agent/mcp-originator-authority-file.d.ts.map +1 -0
  11. package/dist/types/agent/mcp-originator-authority.d.ts +134 -0
  12. package/dist/types/agent/mcp-originator-authority.d.ts.map +1 -0
  13. package/dist/types/agent/mcp-originator-keepalive.d.ts +61 -0
  14. package/dist/types/agent/mcp-originator-keepalive.d.ts.map +1 -0
  15. package/dist/types/agent/mcp-originator-tokens.d.ts +207 -0
  16. package/dist/types/agent/mcp-originator-tokens.d.ts.map +1 -0
  17. package/dist/types/agent/modify.d.ts.map +1 -1
  18. package/dist/types/agent/parent-memory-note.d.ts +3 -0
  19. package/dist/types/agent/parent-memory-note.d.ts.map +1 -0
  20. package/dist/types/agent/skills.d.ts.map +1 -1
  21. package/dist/types/agent/subagent-state.d.ts +53 -2
  22. package/dist/types/agent/subagent-state.d.ts.map +1 -1
  23. package/dist/types/auth/oauth-refresh.d.ts +3 -1
  24. package/dist/types/auth/oauth-refresh.d.ts.map +1 -1
  25. package/dist/types/auth/oauth.d.ts +1 -1
  26. package/dist/types/auth/oauth.d.ts.map +1 -1
  27. package/dist/types/auth/org-credentials-session.d.ts +9 -3
  28. package/dist/types/auth/org-credentials-session.d.ts.map +1 -1
  29. package/dist/types/backend/api/request.d.ts +3 -1
  30. package/dist/types/backend/api/request.d.ts.map +1 -1
  31. package/dist/types/backend/api/unified-mcp.d.ts +7 -0
  32. package/dist/types/backend/api/unified-mcp.d.ts.map +1 -1
  33. package/dist/types/channels/message-channel-executor.d.ts.map +1 -1
  34. package/dist/types/cli/helpers/agent-info.d.ts +1 -0
  35. package/dist/types/cli/helpers/agent-info.d.ts.map +1 -1
  36. package/dist/types/cli/subcommands/mcp.d.ts +3 -1
  37. package/dist/types/cli/subcommands/mcp.d.ts.map +1 -1
  38. package/dist/types/reminders/engine.d.ts.map +1 -1
  39. package/dist/types/runtime-context.d.ts +6 -0
  40. package/dist/types/runtime-context.d.ts.map +1 -1
  41. package/dist/types/telemetry/channel.d.ts.map +1 -1
  42. package/dist/types/tools/external-tool-background-eligibility.d.ts +2 -1
  43. package/dist/types/tools/external-tool-background-eligibility.d.ts.map +1 -1
  44. package/dist/types/tools/external-tool-background.d.ts +14 -1
  45. package/dist/types/tools/external-tool-background.d.ts.map +1 -1
  46. package/dist/types/tools/external-tool-types.d.ts +1 -0
  47. package/dist/types/tools/external-tool-types.d.ts.map +1 -1
  48. package/dist/types/tools/impl/external-coding-agent.d.ts.map +1 -1
  49. package/dist/types/tools/impl/monitor.d.ts +2 -0
  50. package/dist/types/tools/impl/monitor.d.ts.map +1 -1
  51. package/dist/types/tools/impl/task-abort-hook.d.ts +2 -0
  52. package/dist/types/tools/impl/task-abort-hook.d.ts.map +1 -0
  53. package/dist/types/tools/impl/task.d.ts +2 -0
  54. package/dist/types/tools/impl/task.d.ts.map +1 -1
  55. package/dist/types/tools/impl/watch-pr.d.ts +1 -1
  56. package/dist/types/tools/impl/watch-pr.d.ts.map +1 -1
  57. package/dist/types/tools/impl/workflow.d.ts +2 -0
  58. package/dist/types/tools/impl/workflow.d.ts.map +1 -1
  59. package/dist/types/tools/manager.d.ts +1 -1
  60. package/dist/types/tools/manager.d.ts.map +1 -1
  61. package/dist/types/tools/script-tool-scope.d.ts.map +1 -1
  62. package/dist/types/tools/toolset.d.ts +2 -0
  63. package/dist/types/tools/toolset.d.ts.map +1 -1
  64. package/dist/types/types/input-command.d.ts +59 -0
  65. package/dist/types/types/input-command.d.ts.map +1 -0
  66. package/dist/types/types/input-create-message.d.ts +42 -0
  67. package/dist/types/types/input-create-message.d.ts.map +1 -0
  68. package/dist/types/types/protocol_v2.d.ts +3 -63
  69. package/dist/types/types/protocol_v2.d.ts.map +1 -1
  70. package/dist/types/utils/subagent-scope.d.ts +13 -0
  71. package/dist/types/utils/subagent-scope.d.ts.map +1 -0
  72. package/dist/types/utils/task-notifications.d.ts +43 -0
  73. package/dist/types/utils/task-notifications.d.ts.map +1 -1
  74. package/dist/types/websocket/listener/queue.d.ts.map +1 -1
  75. package/dist/types/websocket/listener/types.d.ts +16 -0
  76. package/dist/types/websocket/listener/types.d.ts.map +1 -1
  77. package/dist/types/websocket/ws-event-redaction.d.ts.map +1 -1
  78. package/letta.js +2947 -1449
  79. package/npm-shrinkwrap.json +14 -14
  80. package/package.json +2 -2
  81. package/scripts/claude-watch/docs-snapshot.test.ts +65 -0
  82. package/scripts/claude-watch/docs-snapshot.ts +10 -4
  83. package/scripts/isolated-unit-tests.json +5 -0
  84. package/scripts/source-file-size-baseline.json +8 -9
  85. package/skills/finding-agents/SKILL.md +0 -4
  86. package/skills/curating-memory-palace/SKILL.md +0 -147
  87. package/skills/migrating-memory/SKILL.md +0 -98
@@ -2,6 +2,36 @@ import type { ApprovalReturn, ToolReturn } from "@letta-ai/letta-client/resource
2
2
  import type { ToolReturnMessage } from "@letta-ai/letta-client/resources/tools";
3
3
  import type { ApprovalRequest } from "../cli/helpers/stream";
4
4
  import { executeTool, type ToolExecutionResult, type ToolReturnContent } from "../tools/manager";
5
+ /** Grace period an aborted batch waits for signal-honoring tools to unwind
6
+ * before discarding stragglers (ms). */
7
+ export declare const ABORT_GRACE_MS = 500;
8
+ /** True when an error represents a user-initiated abort of a tool batch. */
9
+ export declare function isUserAbortError(error: unknown): boolean;
10
+ /** Overlay real partial results over queued synthetic interrupted results:
11
+ * settled tools' actual outputs win; stragglers keep their synthetics.
12
+ * Partials for tools never present in the queue (denials, precomputed
13
+ * results) are appended so real work is not silently dropped. */
14
+ export declare function overlayPartialResults(queued: ApprovalResult[] | null, partials: ApprovalResult[] | undefined): ApprovalResult[];
15
+ /** Map auto-denied decisions to their wire form. Denials are decisions, not
16
+ * tool executions: they must reach the server even when the batch aborts. */
17
+ export declare function buildDeniedResults(autoDenied: Array<{
18
+ approval: ApprovalRequest;
19
+ reason: string;
20
+ }>): ApprovalResult[];
21
+ /** Results for decisions that never execute client-side: auto-handled tools
22
+ * with precomputed results and auto-denied calls. They must ride along on
23
+ * both the fulfilled path and the grace-expiry overlay, or the server's
24
+ * approval batch goes out incomplete. */
25
+ export declare function buildCompanionResults(autoHandled: Array<{
26
+ toolCallId: string;
27
+ result: ToolExecutionResult;
28
+ }>, autoDenied: Array<{
29
+ approval: ApprovalRequest;
30
+ reason: string;
31
+ }>): ApprovalResult[];
32
+ /** Attach extra decisions (e.g. pre-built denials) to an abort error's
33
+ * partials so the recovery queue carries a complete approval batch. */
34
+ export declare function appendAbortPartials(error: unknown, extras: ApprovalResult[]): void;
5
35
  /**
6
36
  * Extract displayable text from tool return content (for UI display).
7
37
  * Multimodal content returns the text parts concatenated.
@@ -71,7 +101,9 @@ export declare function executeApprovalBatch(decisions: ApprovalDecision[], onCh
71
101
  afterToolExecution?: (toolCallId: string, result: ApprovalResult) => void | Promise<void>;
72
102
  executeTool?: typeof executeTool;
73
103
  }): Promise<ApprovalResult[]>;
74
- export declare function settleApprovalExecutionTasks(tasks: readonly Promise<void>[], partialResults?: () => ApprovalResult[]): Promise<void>;
104
+ export declare function settleApprovalExecutionTasks(tasks: readonly Promise<void>[], partialResults?: () => ApprovalResult[], options?: {
105
+ abortSignal?: AbortSignal;
106
+ }): Promise<void>;
75
107
  /**
76
108
  * Helper to execute auto-allowed tools and map results to the format expected by App.tsx.
77
109
  * Consolidates the common pattern of converting approvals to decisions, executing them,
@@ -1 +1 @@
1
- {"version":3,"file":"approval-execution.d.ts","sourceRoot":"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AE,CAClB,UAAU,EAAE,MAAM,EAClB,KAAK,EAAE,MAAM,EACb,QAAQ,CAAC,EAAE,OAAO,KACf,IAAI,CAAC;IACV,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,WAAW,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CAC3D,GACA,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAmB9B"}
@@ -0,0 +1,75 @@
1
+ /**
2
+ * Durable-file layer for MCP originator authority records: types, wire
3
+ * validation, lattice merges, path resolution, and the locked whole-file
4
+ * read/write primitives. Split out of mcp-originator-authority.ts so both
5
+ * modules stay under the source-file size limit; all policy (gates,
6
+ * transactions, pending retirements) lives in the parent module.
7
+ */
8
+ export type McpOriginatorAuthorityState = "live" | "headerless" | "terminal";
9
+ /** The non-live end states a retirement can target. */
10
+ export type McpOriginatorRetirementState = Exclude<McpOriginatorAuthorityState, "live">;
11
+ export type AuthorityRecord = {
12
+ /** Highest mint generation observed for this run (any delivery kind). */
13
+ floor?: number;
14
+ state: McpOriginatorAuthorityState;
15
+ /**
16
+ * Durable retirement intent (evil-shub round-9 P1): set when the actual
17
+ * headerless/terminal mark could not be persisted. Every gate treats a
18
+ * record carrying an intent as NOT live, so peers fail closed even though
19
+ * the final state never landed; cleared when the mark lands.
20
+ */
21
+ retiringTo?: McpOriginatorRetirementState;
22
+ updatedAtMs: number;
23
+ };
24
+ /**
25
+ * A wire or disk generation is meaningful only as a nonnegative safe
26
+ * integer (evil-shub round-6 P1): a string, negative, fractional, or NaN
27
+ * value used to flow straight into Math.max, producing a NaN floor that
28
+ * silently disabled every later floor comparison (NaN < x is false).
29
+ */
30
+ export declare function isValidGeneration(generation: unknown): generation is number;
31
+ /**
32
+ * A record timestamp is meaningful only as a nonnegative safe integer not
33
+ * impossibly far in the future (evil-shub round-8 P1). A negative or NaN
34
+ * value flows into pruneExpired as `now - t > TTL` = always true, erasing
35
+ * live/terminal boundaries on the very next access — a fail-OPEN read of a
36
+ * corrupt file. A far-future value never prunes, pinning a stale floor.
37
+ */
38
+ export declare function isValidUpdatedAtMs(updatedAtMs: unknown, nowMs: number): updatedAtMs is number;
39
+ /** Test-only: point persistence at a fixture path (null = in-memory only). */
40
+ export declare function configureAuthorityPersistencePathForTests(path: string | null): void;
41
+ export declare function authorityPersistentPath(): string | null;
42
+ export declare const STATE_RANK: Record<McpOriginatorAuthorityState, number>;
43
+ /**
44
+ * Merge a durable retirement intent under the same monotonicity as the
45
+ * state lattice: once expressed, an intent is never silently relaxed, and a
46
+ * pending terminal subsumes a pending headerless. Intents are meaningless
47
+ * once the record left `live` (the landed mark is the stronger boundary).
48
+ */
49
+ export declare function mergeRetirementIntents(a: McpOriginatorRetirementState | undefined, b: McpOriginatorRetirementState | undefined): McpOriginatorRetirementState | undefined;
50
+ /**
51
+ * Merge two records for the same run under the monotone lattice: max floor,
52
+ * max state, max timestamp, strongest retirement intent. Never relaxes
53
+ * either side.
54
+ */
55
+ export declare function mergeRecords(a: AuthorityRecord, b: AuthorityRecord | undefined): AuthorityRecord;
56
+ /**
57
+ * Read the durable file. `degraded: true` means the file EXISTS but could
58
+ * not be read, parsed, or fully validated: the durable floor/retirement
59
+ * state is unknown, so callers must fail CLOSED (deny admission, deny token
60
+ * use) and must never overwrite the damaged file — writing a fresh file
61
+ * over it would erase a persisted headerless/terminal boundary and let a
62
+ * duplicate re-arm authority the operator already revoked (evil-shub
63
+ * round-5 P1). A missing file is NOT degraded: nothing was ever persisted.
64
+ */
65
+ export declare function readAuthorityRecords(path: string): {
66
+ records: Map<string, AuthorityRecord>;
67
+ degraded: boolean;
68
+ };
69
+ /**
70
+ * Write with the same discipline as the disposition ledger: unique tmp file,
71
+ * fsync before rename, fsync the directory after. Throws on failure — the
72
+ * caller decides whether the mutation must degrade to in-memory only.
73
+ */
74
+ export declare function writeAuthorityRecords(path: string, records: Map<string, AuthorityRecord>): void;
75
+ //# sourceMappingURL=mcp-originator-authority-file.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp-originator-authority-file.d.ts","sourceRoot":"","sources":["../../../src/agent/mcp-originator-authority-file.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAmBH,MAAM,MAAM,2BAA2B,GAAG,MAAM,GAAG,YAAY,GAAG,UAAU,CAAC;AAE7E,uDAAuD;AACvD,MAAM,MAAM,4BAA4B,GAAG,OAAO,CAChD,2BAA2B,EAC3B,MAAM,CACP,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,yEAAyE;IACzE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,2BAA2B,CAAC;IACnC;;;;;OAKG;IACH,UAAU,CAAC,EAAE,4BAA4B,CAAC;IAC1C,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,OAAO,GAAG,UAAU,IAAI,MAAM,CAM3E;AAKD;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAChC,WAAW,EAAE,OAAO,EACpB,KAAK,EAAE,MAAM,GACZ,WAAW,IAAI,MAAM,CAOvB;AASD,8EAA8E;AAC9E,wBAAgB,yCAAyC,CACvD,IAAI,EAAE,MAAM,GAAG,IAAI,GAClB,IAAI,CAEN;AAED,wBAAgB,uBAAuB,IAAI,MAAM,GAAG,IAAI,CAoBvD;AAED,eAAO,MAAM,UAAU,EAAE,MAAM,CAAC,2BAA2B,EAAE,MAAM,CAIlE,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACpC,CAAC,EAAE,4BAA4B,GAAG,SAAS,EAC3C,CAAC,EAAE,4BAA4B,GAAG,SAAS,GAC1C,4BAA4B,GAAG,SAAS,CAI1C;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAC1B,CAAC,EAAE,eAAe,EAClB,CAAC,EAAE,eAAe,GAAG,SAAS,GAC7B,eAAe,CAcjB;AAED;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG;IAClD,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;IACtC,QAAQ,EAAE,OAAO,CAAC;CACnB,CAsEA;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,eAAe,CAAC,GACpC,IAAI,CAuBN"}
@@ -0,0 +1,134 @@
1
+ /**
2
+ * Durable MCP originator authority records (USER_SCOPED_MCP_CONNECTIONS).
3
+ *
4
+ * The in-memory token Map in mcp-originator-tokens.ts forgets everything on
5
+ * teardown, which leaves three paired holes (evil-shub round-3 review):
6
+ *
7
+ * - No generation floor: a zombie delivery from a superseded mint attempt is
8
+ * accepted whenever the newer generation is not (or no longer) visible in
9
+ * memory — before the newer frame arrives, or after a restart forgot it.
10
+ * - Liveness is not authority: the durable input ledger can prove a run's
11
+ * input is still live, but not that the run still OWNS MCP authority. An
12
+ * approval origin swap or a mixed-batch merge deliberately deletes the
13
+ * run's token so the continuation stays headerless; a duplicate frame
14
+ * would otherwise recreate the key and re-arm the header mid-turn.
15
+ * - Terminal runs must stay retired: a post-terminal duplicate must never
16
+ * re-insert a token.
17
+ *
18
+ * This module keeps a small durable record per super run id:
19
+ *
20
+ * { floor?: number; state: "live" | "headerless" | "terminal";
21
+ * retiringTo?: "headerless" | "terminal"; updatedAtMs }
22
+ *
23
+ * floor is the maximum observed mint generation; state transitions only ever
24
+ * move live → headerless|terminal (never back), mirroring the fail-closed
25
+ * intent of the boundaries that set them. retiringTo is a durable retirement
26
+ * INTENT (evil-shub round-9 P1): when a headerless/terminal mark cannot be
27
+ * persisted, the intent is written instead so peers treat the record as NOT
28
+ * live (fail closed for admission and token use) and a restarted process
29
+ * reloads the pending retirement and resumes the retry. Records survive
30
+ * process restarts in the same ~/.letta/state/<server-namespace>/ directory
31
+ * as the accepted input disposition ledger.
32
+ *
33
+ * Bounded by design: originator tokens carry a 1-hour absolute TTL ceiling
34
+ * server-side, so any record older than AUTHORITY_RECORD_TTL_MS (2h, twice
35
+ * the ceiling) can only describe dead tokens and is pruned on access.
36
+ *
37
+ * Persistence is serialized read-modify-write under the shared interprocess
38
+ * durable-file lock: every transaction re-reads and merges the file, so
39
+ * concurrent listener processes sharing the server-scoped file cannot erase
40
+ * each other's records (whole-file last-writer-wins would). Mutations are
41
+ * durable-first — callers retire volatile token state only after the mark
42
+ * lands. A failed write still applies the boundary in-memory (fail-closed
43
+ * for the live process) and logs every failure, never throwing into the
44
+ * input path.
45
+ */
46
+ import { type McpOriginatorAuthorityState, type McpOriginatorRetirementState } from "./mcp-originator-authority-file";
47
+ export type { McpOriginatorAuthorityState, McpOriginatorRetirementState, } from "./mcp-originator-authority-file";
48
+ /**
49
+ * Re-attempt every pending retirement. Exported for the listener's
50
+ * teardown hook and driven explicitly by tests; the timer path calls it
51
+ * on an interval until the map drains.
52
+ */
53
+ export declare function retryPendingMcpOriginatorRetirements(): void;
54
+ /** Test-only: pending retirements, for asserting retry registration. */
55
+ export declare function readPendingMcpOriginatorRetirementsForTests(): ReadonlyMap<string, {
56
+ state: McpOriginatorRetirementState;
57
+ generation?: number;
58
+ createdAtMs: number;
59
+ }>;
60
+ /**
61
+ * Record an accepted originator delivery (any kind: token, tombstone).
62
+ * Bumps the generation floor; never relaxes a headerless/terminal state.
63
+ * Returns false when the floor bump could not be persisted (see
64
+ * mutateDurableFirst) — callers must not treat the delivery as durably
65
+ * recorded.
66
+ */
67
+ export declare function noteMcpOriginatorDelivery(runId: string, generation: number | undefined): boolean;
68
+ /**
69
+ * Atomic admission: evaluate the gate AND, when it passes, durably bump the
70
+ * generation floor — both inside ONE locked transaction (evil-shub round-5
71
+ * P1). The pre-round-6 allows() + note() pair released the lock between the
72
+ * check and the floor write, so a concurrent process could advance the
73
+ * floor or mark the run headerless/terminal in the gap and this process
74
+ * would still install its stale token. Here the check, the floor write, and
75
+ * the durable persistence are indivisible: if the durable write fails, the
76
+ * whole transaction throws and admission is DENIED (fail closed — the
77
+ * caller drops the delivery and does not ACK, so redelivery retries).
78
+ * A degraded durable file also denies: the persisted boundary is unknown.
79
+ */
80
+ /**
81
+ * Admission outcome (evil-shub round-8 P1 verdict split). A PERMANENT
82
+ * denial means this exact delivery can never be admitted — a stale
83
+ * generation at-or-below the durable floor, a legacy delivery beneath a
84
+ * known generation contract, a headerless/terminal run, or a malformed
85
+ * generation. Redelivering it would loop forever, so the caller must
86
+ * consume/drop the frame (no work, no redelivery). A RETRYABLE denial
87
+ * means the durable boundary could not be evaluated at all (degraded
88
+ * durable file, failed transaction): the caller must not commit work and
89
+ * must not ACK, so redelivery retries the whole admission once the
90
+ * infrastructure heals.
91
+ */
92
+ export type McpOriginatorAdmission = {
93
+ admitted: true;
94
+ } | {
95
+ admitted: false;
96
+ permanent: boolean;
97
+ };
98
+ export declare function admitMcpOriginatorDelivery(runId: string, generation: number | undefined): McpOriginatorAdmission;
99
+ /**
100
+ * Use-time authority recheck for token handout (evil-shub round-5 P1): the
101
+ * admission gate only runs at delivery; a revoked or deliberately retired
102
+ * run must not keep spending its token. Consulted by getMcpOriginatorToken
103
+ * on every scoped call: a non-live state or a floor ahead of the held
104
+ * generation withdraws the token (the call proceeds unattributed). Fail
105
+ * closed on degraded/unreadable durable state.
106
+ */
107
+ export declare function mcpOriginatorAuthorityPermitsUse(runId: string, generation: number | undefined): boolean;
108
+ /**
109
+ * Mark a run's authority deliberately retired mid-turn (approval origin
110
+ * swap, mixed-batch merge): the continuation must stay headerless, so no
111
+ * later delivery of ANY generation may recreate the entry.
112
+ */
113
+ export declare function markMcpOriginatorHeaderless(runId: string, deletedGeneration?: number): boolean;
114
+ /** Mark a run terminal: no later delivery may recreate the entry. */
115
+ export declare function markMcpOriginatorTerminal(runId: string, deletedGeneration?: number): boolean;
116
+ /**
117
+ * Admission gate consulted before every create/refresh/tombstone write.
118
+ * Rejects zombies below the floor, legacy deliveries beneath a known
119
+ * generation contract, and ANY delivery for a headerless/terminal run.
120
+ */
121
+ export declare function mcpOriginatorAuthorityAllows(runId: string, generation: number | undefined): boolean;
122
+ /** Test-only: point persistence at a fixture path (null = in-memory only). */
123
+ export declare function configureMcpOriginatorAuthorityPersistenceForTests(path: string | null): void;
124
+ /** Test-only: shorten the record TTL (null restores the 2h default). */
125
+ export declare function configureMcpOriginatorAuthorityTtlForTests(ttlMs: number | null): void;
126
+ /** Test-only: drop every record and forget any loaded state. */
127
+ export declare function resetMcpOriginatorAuthority(): void;
128
+ /** Test-only diagnostics. */
129
+ export declare function readMcpOriginatorAuthorityForTests(runId: string): {
130
+ floor?: number;
131
+ state: McpOriginatorAuthorityState;
132
+ retiringTo?: McpOriginatorRetirementState;
133
+ } | undefined;
134
+ //# sourceMappingURL=mcp-originator-authority.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp-originator-authority.d.ts","sourceRoot":"","sources":["../../../src/agent/mcp-originator-authority.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AAKH,OAAO,EAKL,KAAK,2BAA2B,EAChC,KAAK,4BAA4B,EAMlC,MAAM,iCAAiC,CAAC;AAEzC,YAAY,EACV,2BAA2B,EAC3B,4BAA4B,GAC7B,MAAM,iCAAiC,CAAC;AAgMzC;;;;GAIG;AACH,wBAAgB,oCAAoC,IAAI,IAAI,CAgC3D;AAsID,wEAAwE;AACxE,wBAAgB,2CAA2C,IAAI,WAAW,CACxE,MAAM,EACN;IACE,KAAK,EAAE,4BAA4B,CAAC;IACpC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;CACrB,CACF,CAEA;AA4DD;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,MAAM,EACb,UAAU,EAAE,MAAM,GAAG,SAAS,GAC7B,OA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2
+ * Active-turn renewal for MCP originator tokens (USER_SCOPED_MCP_CONNECTIONS).
3
+ *
4
+ * The server slides a pair's TTL back to the full 300s window on every
5
+ * successful verify — which today means on every MCP tool call carrying the
6
+ * header. A turn whose tool calls are spaced further apart than that window
7
+ * (long LLM generations, approval waits, sandbox stalls) would find its
8
+ * token expired at the next call and silently continue unattributed
9
+ * (evil-shub round-5 P1 lease/renewal). While this process holds a live
10
+ * token entry for a run, this module pings
11
+ * POST /v1/mcp-originator-tokens/verify on an interval comfortably below
12
+ * the sliding TTL, keeping the pair alive for exactly as long as the token
13
+ * is held — never longer: tombstones, retirements, withdrawals, and store
14
+ * clears all stop the keepalive, and the absolute 1h ceiling binds
15
+ * server-side regardless.
16
+ *
17
+ * Renewal is not authority: a token the server has revoked or fenced comes
18
+ * back { valid: false }, the local entry is withdrawn immediately, and the
19
+ * turn continues headerless. Network failures tolerate three consecutive
20
+ * ticks before giving up loudly; the server-side TTL remains the bound.
21
+ * The token value is never logged.
22
+ */
23
+ type VerifyResult = {
24
+ valid: boolean;
25
+ };
26
+ type VerifyFn = (token: string, signal: AbortSignal) => Promise<VerifyResult>;
27
+ /**
28
+ * Store access is injected by the caller (the token store) so this module
29
+ * never imports the store: the dependency points one way
30
+ * (store → keepalive), which keeps the import graph acyclic.
31
+ */
32
+ export type KeepaliveHooks = {
33
+ /** Current raw token for the run, or undefined once the entry is gone. */
34
+ getToken: () => string | undefined;
35
+ /** Withdraw the entry after a server denial (turn continues headerless). */
36
+ withdraw: () => void;
37
+ };
38
+ /**
39
+ * Ensure a keepalive is running for a run holding a live token entry.
40
+ * Idempotent per run; called by the token store on every entry install.
41
+ * A RE-install (a fresh delivery replacing the held token) refreshes the
42
+ * hooks and resets the failure counter (evil-shub round-6 P1): strikes
43
+ * against the old token must not bleed into the new one's renewal budget.
44
+ */
45
+ export declare function startMcpOriginatorKeepalive(superRunId: string, hooks: KeepaliveHooks): void;
46
+ /** Stop renewing a run's token (entry removal, tombstone, store clear). */
47
+ export declare function stopMcpOriginatorKeepalive(superRunId: string): void;
48
+ /** Stop every keepalive (listener session teardown, tests). */
49
+ export declare function stopAllMcpOriginatorKeepalives(): void;
50
+ /** Test-only: install a verify stub and/or a shorter interval; pass null to restore. */
51
+ export declare function configureMcpOriginatorKeepaliveForTests(config: {
52
+ verify?: VerifyFn;
53
+ intervalMs?: number;
54
+ verifyTimeoutMs?: number;
55
+ } | null): void;
56
+ /** Test-only: synchronously drive one tick for a run. */
57
+ export declare function runMcpOriginatorKeepaliveTickForTests(superRunId: string): Promise<void>;
58
+ /** Test-only: is a keepalive interval registered for this run? */
59
+ export declare function hasMcpOriginatorKeepaliveForTests(superRunId: string): boolean;
60
+ export {};
61
+ //# sourceMappingURL=mcp-originator-keepalive.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp-originator-keepalive.d.ts","sourceRoot":"","sources":["../../../src/agent/mcp-originator-keepalive.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAqBH,KAAK,YAAY,GAAG;IAAE,KAAK,EAAE,OAAO,CAAA;CAAE,CAAC;AACvC,KAAK,QAAQ,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,KAAK,OAAO,CAAC,YAAY,CAAC,CAAC;AAkC9E;;;;GAIG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,0EAA0E;IAC1E,QAAQ,EAAE,MAAM,MAAM,GAAG,SAAS,CAAC;IACnC,4EAA4E;IAC5E,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB,CAAC;AAwJF;;;;;;GAMG;AACH,wBAAgB,2BAA2B,CACzC,UAAU,EAAE,MAAM,EAClB,KAAK,EAAE,cAAc,GACpB,IAAI,CAyCN;AAED,2EAA2E;AAC3E,wBAAgB,0BAA0B,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAKnE;AAED,+DAA+D;AAC/D,wBAAgB,8BAA8B,IAAI,IAAI,CAIrD;AAED,wFAAwF;AACxF,wBAAgB,uCAAuC,CACrD,MAAM,EAAE;IACN,MAAM,CAAC,EAAE,QAAQ,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,GAAG,IAAI,GACP,IAAI,CAQN;AAED,yDAAyD;AACzD,wBAAsB,qCAAqC,CACzD,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,IAAI,CAAC,CAYf;AAED,kEAAkE;AAClE,wBAAgB,iCAAiC,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAE7E"}
@@ -0,0 +1,207 @@
1
+ /**
2
+ * In-memory store for MCP originator tokens (USER_SCOPED_MCP_CONNECTIONS).
3
+ *
4
+ * The cloud relay delivers a short-lived originator token on the top-level
5
+ * run-input frame (`mcp_originator_token`, alongside `super_run_id` — never
6
+ * inside the user-message payload) when the super run is attributed to a
7
+ * principal. The listener forwards that token as the
8
+ * `x-letta-mcp-originator-token` header on MCP tool-run calls so cloud-api can
9
+ * authorize user-scoped MCP connections on behalf of the originating
10
+ * principal.
11
+ *
12
+ * Hygiene contract (pinned in the design doc):
13
+ * - Tokens live ONLY in this process-local Map, keyed by super run id.
14
+ * - The token value is never logged (boolean-presence diagnostics only),
15
+ * never persisted to disk, and never copied into tool args, transcripts,
16
+ * or durable listener records. Only the super run id may travel on turn
17
+ * plumbing (IncomingMessage, runtime context); lookups happen here.
18
+ * - Entries are deleted when the owning run reaches a terminal state and the
19
+ * whole store is cleared on listener session teardown (and process exit).
20
+ *
21
+ * Ordering contract (mint generations):
22
+ * - The producer re-mints per delivery attempt inside one atomic Lua script
23
+ * that INCRs a per-run generation counter, so every delivery carries a
24
+ * strictly newer generation than any earlier attempt. A delivery whose
25
+ * generation is OLDER than the stored entry is a zombie from a superseded
26
+ * attempt and is dropped; an equal generation is an idempotent re-delivery
27
+ * and last-write-wins within it.
28
+ * - Mixed-version rule: an entry WITHOUT a generation was written by a
29
+ * legacy producer and accepts any delivery; an entry WITH a generation
30
+ * rejects legacy (generation-less) deliveries, including tokenless clears
31
+ * — a stale legacy frame must never erase known-newer authority.
32
+ * - Tokenless deliveries record a tombstone (null token) rather than
33
+ * deleting, so a later stale create cannot resurrect the key below the
34
+ * tombstone's generation. Finalizers still hard-delete at terminal.
35
+ *
36
+ * Consumer side only: this module does not verify tokens, enforce ACLs, or
37
+ * decide attribution. When no token is held for a run, callers simply omit
38
+ * the header and the call proceeds unattributed.
39
+ *
40
+ * Authority floor (durable, mcp-originator-authority.ts): generation
41
+ * comparison alone only protects against generations this volatile Map still
42
+ * remembers. A durable per-run record carries the max observed generation
43
+ * (the floor) plus a monotone live → headerless|terminal state across
44
+ * restarts, so a zombie from a superseded mint is rejected even on an empty
45
+ * Map, and a run whose authority was deliberately retired (origin swap,
46
+ * mixed-batch merge, terminal) can never be re-armed by a duplicate frame.
47
+ */
48
+ /**
49
+ * Resolve the held token for a super run, or undefined when the run is
50
+ * unattributed (no token delivered), the entry is a tombstone, or the token
51
+ * was already dropped.
52
+ */
53
+ export declare function getMcpOriginatorToken(superRunId: string | null | undefined): string | undefined;
54
+ /**
55
+ * Seed a token directly (tests and local fixtures). Production entries only
56
+ * ever arrive through recordMcpOriginatorDelivery; a seeded entry is legacy
57
+ * (no generation) so any real delivery can supersede it.
58
+ */
59
+ export declare function setMcpOriginatorToken(superRunId: string, token: string): void;
60
+ /** Drop the token for a super run that reached a terminal state. */
61
+ export declare function deleteMcpOriginatorToken(superRunId: string): void;
62
+ /** Drop every held token (listener session teardown, tests). */
63
+ export declare function clearMcpOriginatorTokens(): void;
64
+ /** Presence-only diagnostic: how many runs currently hold a token. */
65
+ export declare function mcpOriginatorTokenCount(): number;
66
+ /**
67
+ * The parsed originator delivery from an inbound frame — the single shape
68
+ * the pre-commit gate hands to the ack path so the ack installs EXACTLY
69
+ * what was admitted (evil-shub round-9 P1).
70
+ */
71
+ export type McpOriginatorParsedDelivery = {
72
+ superRunId?: string;
73
+ token?: string;
74
+ generation?: number;
75
+ /**
76
+ * True when the frame CARRIED a generation that failed shape validation —
77
+ * distinguishable from a legacy frame carrying no generation at all.
78
+ */
79
+ malformedGeneration?: boolean;
80
+ };
81
+ /**
82
+ * Extract the originator delivery from an inbound top-level run-input frame.
83
+ *
84
+ * This is the single parse site for the relay contract fields. Wire data is
85
+ * untrusted: present-but-malformed tokens/ids are treated as absent (the
86
+ * turn then runs unattributed) rather than rejecting the whole input. A
87
+ * present-but-malformed GENERATION is different (evil-shub round-6 P1 #1):
88
+ * degrading it to "legacy" would let a first malformed delivery install a
89
+ * token beneath the generation contract entirely (no floor exists yet to
90
+ * reject it), so the parse surfaces `malformedGeneration` and admission
91
+ * denies the delivery fail-closed.
92
+ */
93
+ export declare function readMcpOriginatorDelivery(payload: unknown): McpOriginatorParsedDelivery;
94
+ /**
95
+ * Apply an accepted input's originator delivery to the store.
96
+ *
97
+ * Used only by ack paths that did NOT pass through the router's pre-commit
98
+ * gate (duplicate re-acks and accepted approval payloads): it evaluates
99
+ * admission itself. Gated frames use installPreGatedMcpOriginatorDelivery
100
+ * instead — the gate's verdict is their single admission decision.
101
+ *
102
+ * Call only once the input has been ACCEPTED (queued or started); tokens
103
+ * belonging to rejected or dropped inputs must never reach the store.
104
+ *
105
+ * `allowCreate: false` (duplicate re-acks and accepted approval/teleport
106
+ * payloads — accepts that create no new owning turn) restricts the delivery
107
+ * to refreshing an entry that already exists. Two escape hatches keep live
108
+ * work from running headerless without reopening the orphaned-token hole:
109
+ *
110
+ * - `mayRecreateOwner`: when the entry is missing, the delivery may
111
+ * (re)create it if this predicate proves the DURABLE input ledger still
112
+ * shows a live accepted started/queued owner for this input — i.e. the
113
+ * work survived a process crash or an ACK loss and a finalizer still
114
+ * exists for it. Terminal disposition tombstones do not qualify, so a
115
+ * post-terminal duplicate can never re-insert an orphaned token.
116
+ * - Tombstones count as existing entries for ordering purposes: a stale
117
+ * create below the tombstone generation is dropped even when recreation
118
+ * would otherwise be allowed.
119
+ */
120
+ /**
121
+ * Outcome of recording a delivery (evil-shub round-6 P1, split in round 8).
122
+ *
123
+ * - "denied_retryable": the durable admission gate could not be evaluated
124
+ * (degraded authority file, failed transaction). The caller MUST NOT ack
125
+ * the frame and MUST NOT commit work for it: Cloud's delivery gate
126
+ * treats an unacked frame as undeliverable and redelivers, retrying the
127
+ * whole admission once the infrastructure heals.
128
+ * - "denied_permanent": this exact delivery can never be admitted — a
129
+ * stale generation at-or-below the durable floor, a legacy delivery
130
+ * beneath a known generation contract, a headerless/terminal run, or a
131
+ * malformed generation. Redelivering it would loop forever with zero
132
+ * chance of success, so the caller CONSUMES the frame (acks or rejects
133
+ * it, per path) without installing a token and without running work
134
+ * under it.
135
+ * - "admitted" covers every post-admission outcome (stored, refreshed,
136
+ * create-deferred, tombstoned) — those are idempotent and ack normally.
137
+ * - "none" means the frame carried no originator stamp at all.
138
+ */
139
+ export type McpOriginatorDeliveryVerdict = "admitted" | "denied_retryable" | "denied_permanent" | "none";
140
+ /**
141
+ * Volatile install half for a delivery the pre-commit gate ALREADY admitted
142
+ * (evil-shub round-9 P1). Runs NO durable transaction and makes NO admission
143
+ * decision: the gate's atomic admit (floor bump included) is the single
144
+ * admission verdict for this frame, so the ack path can never flip committed
145
+ * work to denied after the fact. A retirement racing the gap between gate
146
+ * and install is fenced at use time by mcpOriginatorAuthorityPermitsUse,
147
+ * which re-consults the durable authority on every token use.
148
+ *
149
+ * `allowCreate: false` restricts the delivery to refreshing an entry that
150
+ * already exists; `mayRecreateOwner` is the narrow escape hatch (see
151
+ * recordMcpOriginatorDelivery).
152
+ */
153
+ export declare function installPreGatedMcpOriginatorDelivery(delivery: McpOriginatorParsedDelivery, options?: {
154
+ allowCreate?: boolean;
155
+ mayRecreateOwner?: () => boolean;
156
+ }): void;
157
+ export declare function recordMcpOriginatorDelivery(frame: unknown, options?: {
158
+ allowCreate?: boolean;
159
+ mayRecreateOwner?: () => boolean;
160
+ }): McpOriginatorDeliveryVerdict;
161
+ /**
162
+ * Pre-commit admission gate (evil-shub round-8 P1; sole admission decision
163
+ * as of round-9 P1): evaluates ONLY the durable admission half of the
164
+ * delivery path — parse, malformed check, and the atomic durable admit
165
+ * (which bumps the generation floor) — without touching the volatile token
166
+ * store. The input router runs this BEFORE the durable input
167
+ * commit/enqueue/start so a denied frame never commits work it cannot be
168
+ * authorized for, and hands the returned `delivery` to the ack path, which
169
+ * installs it via installPreGatedMcpOriginatorDelivery with NO second
170
+ * admission transaction — a re-admission at ack time could flip committed
171
+ * work to denied when a retirement lands in the gate→ack gap (TOCTOU).
172
+ * Retirement in that gap is instead fenced at use time by
173
+ * mcpOriginatorAuthorityPermitsUse.
174
+ */
175
+ export declare function gateMcpOriginatorDeliveryAdmission(frame: unknown): {
176
+ verdict: McpOriginatorDeliveryVerdict;
177
+ /**
178
+ * The parsed delivery, present when (and only when) the verdict is
179
+ * "admitted": exactly what the ack path must install.
180
+ */
181
+ delivery?: McpOriginatorParsedDelivery;
182
+ };
183
+ /**
184
+ * Fail closed when a turn's originator authority changes mid-run.
185
+ *
186
+ * An approval continuation that consumes a queued input from a DIFFERENT
187
+ * super run must not keep running under the original run's token, and the
188
+ * queued run's own token is consumed by this very merge. Retire both runs'
189
+ * held tokens so subsequent MCP calls omit the header (unattributed) instead
190
+ * of borrowing either run's authority. Same-run follow-ups are a no-op and
191
+ * keep their token (their run is still the one executing).
192
+ */
193
+ export declare function retireMcpOriginatorTokensOnOriginSwap(turnSuperRunId: string | null | undefined, queuedSuperRunId: string | null | undefined): void;
194
+ /**
195
+ * Terminal retirement for the finalizer: drop the held token and mark the
196
+ * run terminal durably, so a post-terminal duplicate can never re-insert an
197
+ * orphaned token even after a restart forgot the deletion.
198
+ */
199
+ export declare function retireMcpOriginatorTokenOnTerminal(superRunId: string | null | undefined): void;
200
+ /**
201
+ * Mixed-batch merge retirement: constituents' tokens can never be
202
+ * legitimately used by the unattributed merged turn, so they are retired and
203
+ * durably marked headerless — the merged finalizer cannot delete them later,
204
+ * and constituent duplicates must never recreate them.
205
+ */
206
+ export declare function retireMcpOriginatorTokenOnMixedMerge(superRunId: string | null | undefined): void;
207
+ //# sourceMappingURL=mcp-originator-tokens.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp-originator-tokens.d.ts","sourceRoot":"","sources":["../../../src/agent/mcp-originator-tokens.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AAuBH;;;;GAIG;AACH,wBAAgB,qBAAqB,CACnC,UAAU,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GACpC,MAAM,GAAG,SAAS,CAepB;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAG7E;AAED,oEAAoE;AACpE,wBAAgB,wBAAwB,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAGjE;AAiBD,gEAAgE;AAChE,wBAAgB,wBAAwB,IAAI,IAAI,CAG/C;AAED,sEAAsE;AACtE,wBAAgB,uBAAuB,IAAI,MAAM,CAMhD;AAED;;;;GAIG;AACH,MAAM,MAAM,2BAA2B,GAAG;IACxC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,OAAO,GACf,2BAA2B,CAiC7B;AAgBD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,MAAM,4BAA4B,GACpC,UAAU,GACV,kBAAkB,GAClB,kBAAkB,GAClB,MAAM,CAAC;AA2BX;;;;;;;;;;;;GAYG;AACH,wBAAgB,oCAAoC,CAClD,QAAQ,EAAE,2B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MAAM,CAAC;SACnB,KACE,OAAO,CAAC,MAAM,CAAC,CAAC;KACtB,CAAC;CACH,GACA,OAAO,CAAC,MAAM,CAAC,CAsBjB;AAED,MAAM,WAAW,wBAAwB;IACvC,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;GAMG;AACH,wBAAsB,0BAA0B,CAC9C,OAAO,EAAE,MAAM,EACf,mBAAmB,EAAE,MAAM,GAAG,IAAI,GACjC,OAAO,CAAC,wBAAwB,CAAC,CAgBnC;AAED;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,UAAU,GAAG,IAAI,CAAC;CAC1B;AAED;;;;;;;GAOG;AACH,wBAAsB,uBAAuB,CAC3C,OAAO,EAAE,MAAM,EACf,cAAc,EAAE,MAAM,GACrB,OAAO,CAAC,wBAAwB,CAAC,CAwEnC;AAED;;;;;;;;;GASG;AACH,wBAAsB,4BAA4B,CAChD,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,wBAAwB,CAAC,CA2GnC"}
@@ -0,0 +1,3 @@
1
+ /** Only advertise memory that is available on this machine. */
2
+ export declare function buildParentMemoryNote(parentAgentId: string): string | undefined;
3
+ //# sourceMappingURL=parent-memory-note.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parent-memory-note.d.ts","sourceRoot":"","sources":["../../../src/agent/parent-memory-note.ts"],"names":[],"mappings":"AAGA,+DAA+D;AAC/D,wBAAgB,qBAAqB,CACnC,aAAa,EAAE,MAAM,GACpB,MAAM,GAAG,SAAS,CAQpB"}
@@ -1 +1 @@
1
- {"version":3,"file":"skills.d.ts","sourceRoot":"","sources":["../../../src/agent/skills.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAQH,OAAO,EAAqB,KAAK,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAoBtE,YAAY,EAAE,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