wyrm-mcp 7.3.2 → 7.3.3

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 (184) hide show
  1. package/README.md +8 -14
  2. package/dist/activation.js +59 -1
  3. package/dist/agent-daemon.js +281 -4
  4. package/dist/agent-loop.js +332 -7
  5. package/dist/analytics.js +236 -13
  6. package/dist/attribution.js +49 -1
  7. package/dist/audit.js +457 -2
  8. package/dist/auto-capture.js +138 -3
  9. package/dist/auto-orchestrator.js +325 -1
  10. package/dist/autoconfig.d.ts +50 -0
  11. package/dist/autoconfig.d.ts.map +1 -1
  12. package/dist/autoconfig.js +1115 -39
  13. package/dist/autoconfig.js.map +1 -1
  14. package/dist/buddy-runner.js +109 -1
  15. package/dist/buddy.js +564 -14
  16. package/dist/build-flags.js +15 -1
  17. package/dist/capabilities.js +183 -3
  18. package/dist/capture.js +56 -1
  19. package/dist/causality.js +148 -8
  20. package/dist/cli.js +281 -20
  21. package/dist/cloud/cli.js +541 -5
  22. package/dist/cloud/client.js +221 -1
  23. package/dist/cloud/crypto.js +85 -1
  24. package/dist/cloud/machine-id.js +113 -2
  25. package/dist/cloud/recovery.js +60 -1
  26. package/dist/cloud/sync-engine.js +543 -7
  27. package/dist/cloud-backup.js +579 -5
  28. package/dist/cloud-profile.js +138 -1
  29. package/dist/cloud-sync-entrypoint.js +47 -1
  30. package/dist/cloud-sync.js +309 -2
  31. package/dist/connectors/bridge-source.d.ts +46 -0
  32. package/dist/connectors/bridge-source.d.ts.map +1 -0
  33. package/dist/connectors/bridge-source.js +77 -0
  34. package/dist/connectors/bridge-source.js.map +1 -0
  35. package/dist/connectors/index.d.ts +24 -0
  36. package/dist/connectors/index.d.ts.map +1 -0
  37. package/dist/connectors/index.js +69 -0
  38. package/dist/connectors/index.js.map +1 -0
  39. package/dist/connectors/ingest.d.ts +16 -0
  40. package/dist/connectors/ingest.d.ts.map +1 -0
  41. package/dist/connectors/ingest.js +116 -0
  42. package/dist/connectors/ingest.js.map +1 -0
  43. package/dist/connectors/types.d.ts +99 -0
  44. package/dist/connectors/types.d.ts.map +1 -0
  45. package/dist/connectors/types.js +17 -0
  46. package/dist/connectors/types.js.map +1 -0
  47. package/dist/constellation.js +168 -12
  48. package/dist/content-signature.js +45 -1
  49. package/dist/context-build-budgeted.js +144 -4
  50. package/dist/context-ranking.js +69 -1
  51. package/dist/crypto.js +179 -1
  52. package/dist/daemon-write-endpoint.js +290 -1
  53. package/dist/daemon-writer.js +406 -2
  54. package/dist/database.js +1278 -53
  55. package/dist/deprecations.js +162 -2
  56. package/dist/design.js +141 -13
  57. package/dist/event-replication.js +112 -1
  58. package/dist/events-sse.js +43 -7
  59. package/dist/events.js +238 -6
  60. package/dist/failure-patterns.d.ts +107 -0
  61. package/dist/failure-patterns.d.ts.map +1 -1
  62. package/dist/failure-patterns.js +924 -43
  63. package/dist/failure-patterns.js.map +1 -1
  64. package/dist/federation.js +236 -12
  65. package/dist/goals.js +101 -13
  66. package/dist/golden.js +355 -3
  67. package/dist/handlers/agent.js +165 -4
  68. package/dist/handlers/alias-adapters.js +129 -1
  69. package/dist/handlers/aliases.js +171 -1
  70. package/dist/handlers/audit.js +87 -1
  71. package/dist/handlers/boundary.js +221 -1
  72. package/dist/handlers/capture.js +1114 -73
  73. package/dist/handlers/causality.js +119 -9
  74. package/dist/handlers/cloud.js +382 -85
  75. package/dist/handlers/companion.js +459 -28
  76. package/dist/handlers/datalake.js +187 -7
  77. package/dist/handlers/dispatch-context.js +22 -0
  78. package/dist/handlers/entity.js +256 -25
  79. package/dist/handlers/events.js +335 -16
  80. package/dist/handlers/failure.d.ts.map +1 -1
  81. package/dist/handlers/failure.js +408 -13
  82. package/dist/handlers/failure.js.map +1 -1
  83. package/dist/handlers/goals.js +296 -4
  84. package/dist/handlers/intelligence.js +681 -126
  85. package/dist/handlers/invoicing.js +70 -1
  86. package/dist/handlers/mcpclient.js +137 -6
  87. package/dist/handlers/orchestration.js +125 -40
  88. package/dist/handlers/output-schemas.js +24 -1
  89. package/dist/handlers/presence.js +99 -3
  90. package/dist/handlers/project.js +182 -28
  91. package/dist/handlers/prompts.js +157 -6
  92. package/dist/handlers/quest.js +224 -4
  93. package/dist/handlers/recall.js +237 -13
  94. package/dist/handlers/registry.js +167 -1
  95. package/dist/handlers/resources.js +288 -1
  96. package/dist/handlers/review.js +74 -11
  97. package/dist/handlers/run.js +498 -16
  98. package/dist/handlers/search.js +338 -15
  99. package/dist/handlers/session.js +643 -31
  100. package/dist/handlers/share.js +184 -8
  101. package/dist/handlers/shims.js +464 -1
  102. package/dist/handlers/skill.js +449 -67
  103. package/dist/handlers/survivors.js +120 -1
  104. package/dist/handlers/symbols.js +109 -8
  105. package/dist/handlers/syncops.js +302 -4
  106. package/dist/handlers/types.js +27 -1
  107. package/dist/harvest.js +191 -5
  108. package/dist/hours.js +156 -7
  109. package/dist/http-auth.js +321 -3
  110. package/dist/http-fast.js +1302 -22
  111. package/dist/icons.js +47 -1
  112. package/dist/importers.js +268 -1
  113. package/dist/index.js +840 -2
  114. package/dist/indexer.js +145 -4
  115. package/dist/intelligence.js +261 -31
  116. package/dist/internal-dispatch.js +212 -3
  117. package/dist/keyset.js +110 -1
  118. package/dist/knowledge-graph.js +176 -12
  119. package/dist/license.js +441 -2
  120. package/dist/logger.js +199 -2
  121. package/dist/maintenance.js +148 -2
  122. package/dist/mcp-client.js +262 -6
  123. package/dist/memory-artifacts.js +596 -32
  124. package/dist/migrate-prompt.js +124 -2
  125. package/dist/migrations.d.ts.map +1 -1
  126. package/dist/migrations.js +799 -42
  127. package/dist/migrations.js.map +1 -1
  128. package/dist/performance.js +228 -1
  129. package/dist/presence.js +140 -11
  130. package/dist/priority-embed.js +164 -5
  131. package/dist/providers/embedding-provider.js +196 -1
  132. package/dist/readonly-gate.js +29 -1
  133. package/dist/receipt.js +43 -1
  134. package/dist/rehydration.js +157 -9
  135. package/dist/reindex.js +88 -1
  136. package/dist/render-target.js +544 -21
  137. package/dist/render.js +280 -4
  138. package/dist/repl-guard.js +173 -1
  139. package/dist/replication-daemon-entrypoint.js +31 -1
  140. package/dist/replication-daemon.js +262 -2
  141. package/dist/rerank.js +142 -1
  142. package/dist/resilience.js +591 -1
  143. package/dist/reverse-bridge.js +360 -5
  144. package/dist/security.js +244 -1
  145. package/dist/session-seen.js +51 -3
  146. package/dist/setup.js +260 -1
  147. package/dist/skill-author.js +168 -5
  148. package/dist/spec-kit.js +191 -1
  149. package/dist/sqlite-busy.js +154 -1
  150. package/dist/statusline.js +315 -11
  151. package/dist/sub-agent.js +262 -13
  152. package/dist/summarizer.js +139 -13
  153. package/dist/symbols.js +283 -7
  154. package/dist/sync.js +359 -5
  155. package/dist/tasks-dispatch.js +84 -1
  156. package/dist/tasks.js +282 -1
  157. package/dist/token-budget.js +143 -1
  158. package/dist/tool-analytics.js +129 -7
  159. package/dist/tool-annotations.js +365 -1
  160. package/dist/tool-manifest-v2.json +1 -1
  161. package/dist/tool-manifest.json +1 -1
  162. package/dist/tool-profiles.js +75 -1
  163. package/dist/trace-harvest.js +244 -6
  164. package/dist/types.js +30 -1
  165. package/dist/ui-dashboard.js +50 -41
  166. package/dist/ulid.js +81 -1
  167. package/dist/usage-tracker.js +66 -1
  168. package/dist/validate.js +129 -1
  169. package/dist/vault.js +534 -1
  170. package/dist/vector-init.js +67 -1
  171. package/dist/vectors.js +184 -3
  172. package/dist/version-check.js +136 -4
  173. package/dist/visibility.js +155 -19
  174. package/dist/wyrm-cli.js +2845 -101
  175. package/dist/wyrm-cli.js.map +1 -1
  176. package/dist/wyrm-guard.d.ts.map +1 -1
  177. package/dist/wyrm-guard.js +475 -14
  178. package/dist/wyrm-guard.js.map +1 -1
  179. package/dist/wyrm-loop.js +150 -3
  180. package/dist/wyrm-manifest.json +1 -1
  181. package/dist/wyrm-statusline-daemon.js +11 -1
  182. package/dist/wyrm-statusline.js +56 -4
  183. package/dist/wyrm-ui.js +77 -9
  184. package/package.json +1 -1
package/dist/icons.js CHANGED
@@ -1 +1,47 @@
1
- const e={brand:process.env.WYRM_BRAND??"\u{F115D}",session:"\u2307",toolCall:"\u2699",questOpen:"\u27F6",questDone:"\u27DC",blocked:"\u2716",truth:"\u2B22",memory:"\u2731",reference:"\u2727",federation:"\u21AF",failure:"\u26A0",celebrate:"\u273A",encryption:"\u22A0",ok:"\u2713",pending:"\u25CC",active:"\u25CF",inactive:"\u25CB",point:"\u25B8",bullet:"\xB7",divider:"\u2500"};export{e as ICON};
1
+ /**
2
+ * Wyrm iconography (5.10.0 — PhantomDragon brand alignment).
3
+ *
4
+ * Curated Unicode glyphs that match the Ghost Protocol / PhantomDragon
5
+ * visual lineage — sharp, geometric, serpentine — instead of the
6
+ * grab-bag of generic emoji that accreted across earlier releases.
7
+ *
8
+ * The brand mark is a Nerd Font dragon glyph (NOT a dragon emoji) — it reads as
9
+ * the Ghost Protocol silver dragon when rendered in silver in the statusline,
10
+ * and degrades to a box on terminals without a Nerd Font. Override the glyph
11
+ * with `WYRM_BRAND` (e.g. a wordmark, a different codepoint, or '' for none).
12
+ *
13
+ * Use these constants by name everywhere instead of hard-coding glyphs
14
+ * — keeps the visual surface centrally tunable.
15
+ *
16
+ * @copyright 2026 Ghost Protocol (Pvt) Ltd.
17
+ * @license Proprietary — (c) 2026 Ghost Protocol (Pvt) Ltd. All rights reserved. See LICENSE.
18
+ */
19
+ export const ICON = {
20
+ // The brand mark — Nerd Font dragon glyph (silver in the statusline), NOT an
21
+ // emoji. Override with WYRM_BRAND. Default codepoint U+F115D renders a dragon
22
+ // on Nerd Fonts (Material Design Icons range).
23
+ brand: process.env.WYRM_BRAND ?? '\u{f115d}',
24
+ // Activity glyphs
25
+ session: '⌇', // serpentine wave — sessions are coiled time
26
+ toolCall: '⚙', // gear — tool invocations
27
+ questOpen: '⟶', // arrow — quest in progress / pending
28
+ questDone: '⟜', // tack-bar — quest completed (sealed)
29
+ blocked: '✖', // x-mark — failure check blocked an attempt
30
+ truth: '⬢', // hexagon — ground truth (matches constitution sigil)
31
+ memory: '✱', // asterisk-star — memory artifact
32
+ reference: '✧', // sparkle — design reference / inspiration
33
+ federation: '↯', // lightning — buddy / outbound federation
34
+ failure: '⚠', // warning — unresolved failure
35
+ celebrate: '✺', // burst-star — milestone hit
36
+ encryption: '⊠', // boxed-x — encrypted at rest (was 🔒)
37
+ // Status glyphs
38
+ ok: '✓', // light check — generic success
39
+ pending: '◌', // dotted circle — pending state
40
+ active: '●', // filled dot — active state
41
+ inactive: '○', // empty circle — inactive state
42
+ // Structural glyphs (markdown headings, callouts)
43
+ point: '▸', // pointer — bullet for high-emphasis lists
44
+ bullet: '·', // mid-dot — bullet for normal lists
45
+ divider: '─', // box-drawing horizontal
46
+ };
47
+ //# sourceMappingURL=icons.js.map
package/dist/importers.js CHANGED
@@ -1 +1,268 @@
1
- function m(e){return Array.isArray(e)?e:[]}function c(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:{}}function u(e){if(typeof e!="string")return null;const t=e.trim();return t.length>0?t:null}function d(e,t){if(Array.isArray(e))return e;const n=c(e);for(const r of t)if(Array.isArray(n[r]))return n[r];return[]}function p(e){const t={};for(const[n,r]of Object.entries(e))r==null||r===""||(t[n]=r);return Object.keys(t).length>0?t:void 0}function y(e){const t=d(e,["results","memories","data","records","items"]),n=[];for(const r of t){const o=c(r),a=u(o.memory??o.text);if(!a)continue;const s=["imported_from:mem0"];for(const l of["user_id","agent_id","run_id"]){const f=u(o[l]);f&&s.push(`${l}:${f}`)}const i=p({...c(o.metadata),mem0_id:o.id,created_at:o.created_at});n.push({text:a,tags:s,source:"mem0",metadata:i})}return n}function _(e){if(typeof e=="string")return u(e);const t=c(e);return u(t.fact??t.content??t.memory??t.text)}function g(e){const t=c(e);return p({role:t.role,created_at:t.created_at,name:t.name,uuid:t.uuid??t.id})}function h(e){const t=c(e),n=c(t.memory),r=c(t.graph),o=[...m(e),...m(t.facts),...m(n.facts),...m(t.relevant_facts),...m(t.messages),...m(n.messages),...m(t.edges),...m(r.edges)],a=[];for(const s of o){const i=_(s);i&&a.push({text:i,tags:["imported_from:zep"],source:"zep",metadata:g(s)})}return a}function x(e){const t=d(e,["memories","documents","results","data","records","items"]),n=[];for(const r of t){const o=c(r),a=u(o.content??o.memory??o.text);if(!a)continue;const s=["imported_from:supermemory"];for(const l of[...m(o.tags),...m(o.containerTags)]){const f=u(l);f&&s.push(f)}const i=p({...c(o.metadata),supermemory_id:o.id,created_at:o.createdAt??o.created_at});n.push({text:a,tags:s,source:"supermemory",metadata:i})}return n}function b(e){const t=[];if(Array.isArray(e))for(const n of e){const r=c(n),o=u(r.label??r.name)??"block",a=u(r.value??r.text??r.content);a&&t.push({label:o,text:a})}else for(const[n,r]of Object.entries(c(e))){const o=u(r)??u(c(r).value??c(r).text);o&&t.push({label:n,text:o})}return t}function k(e){const t=c(e),n=c(t.memory),r=[],o=t.core_memory??n.blocks??t.blocks??t.memory_blocks??n.core_memory;for(const{label:s,text:i}of b(o))r.push({text:i,tags:["imported_from:letta",`block:${s}`],source:"letta",metadata:p({block:s,memory_type:"core"})});const a=[...m(t.archival_memory),...m(t.archival),...m(n.archival_memory)];for(const s of a){const i=u(typeof s=="string"?s:c(s).text??c(s).content);i&&r.push({text:i,tags:["imported_from:letta","memory:archival"],source:"letta",metadata:p({memory_type:"archival"})})}return r}const w=["mem0","zep","supermemory","letta"];function A(e,t){switch(String(e??"").trim().toLowerCase()){case"mem0":return y(t);case"zep":return h(t);case"supermemory":return x(t);case"letta":case"memgpt":return k(t);default:throw new Error(`wyrm import: unknown source "${e}". Supported: ${w.join(", ")} (memgpt = letta).`)}}export{w as IMPORT_SOURCES,A as importFrom,k as importLetta,y as importMem0,x as importSupermemory,h as importZep};
1
+ /**
2
+ * `wyrm import` — foreign-memory IMPORT mappers.
3
+ *
4
+ * Pure functions that take a parsed memory export from a RIVAL system
5
+ * (mem0 / Zep / Supermemory / Letta·MemGPT) and normalise it into
6
+ * {@link ImportedMemory}[] — so a team can leave a rival and ARRIVE in Wyrm
7
+ * with their memories intact (and, once vetted via the review queue, upgraded
8
+ * with Wyrm's negative learning + signed provenance). This migrates the DATA;
9
+ * the sibling `@wyrm/mem0-compat` swaps the SDK.
10
+ *
11
+ * Discipline:
12
+ * - HONEST: each mapper handles the documented/common export shape AND
13
+ * tolerates the reasonable wrapper variants (a bare array vs `{results}` /
14
+ * `{memories}` / `{documents}` / `{data}` / `{facts}` / `{messages}`).
15
+ * - NEVER FABRICATE: a record with no extractable text is SKIPPED, not
16
+ * invented. Empty/blank text is dropped.
17
+ * - The exact wire shapes of these proprietary exports are not all formally
18
+ * documented; where a shape is uncertain the assumption is noted inline and
19
+ * the mapper degrades gracefully (returns [] for an unrecognised payload)
20
+ * rather than throwing.
21
+ *
22
+ * @copyright 2026 Ghost Protocol (Pvt) Ltd.
23
+ * @license Proprietary — (c) 2026 Ghost Protocol (Pvt) Ltd. All rights reserved. See LICENSE.
24
+ */
25
+ // ============================================================================
26
+ // Small, defensive shape helpers — every export is `unknown` from JSON.parse.
27
+ // ============================================================================
28
+ function asArray(v) {
29
+ return Array.isArray(v) ? v : [];
30
+ }
31
+ function asObject(v) {
32
+ return v && typeof v === 'object' && !Array.isArray(v) ? v : {};
33
+ }
34
+ /** Trim a candidate to non-empty text, or null when there is nothing to store. */
35
+ function cleanText(v) {
36
+ if (typeof v !== 'string')
37
+ return null;
38
+ const s = v.trim();
39
+ return s.length > 0 ? s : null;
40
+ }
41
+ /**
42
+ * Unwrap the records array from an export that may be a bare array OR an object
43
+ * wrapping the array under one of several common keys.
44
+ */
45
+ function unwrap(json, keys) {
46
+ if (Array.isArray(json))
47
+ return json;
48
+ const obj = asObject(json);
49
+ for (const k of keys) {
50
+ if (Array.isArray(obj[k]))
51
+ return obj[k];
52
+ }
53
+ return [];
54
+ }
55
+ /** Build a metadata object from the supplied entries, dropping undefined/null/''. */
56
+ function collectMeta(entries) {
57
+ const out = {};
58
+ for (const [k, v] of Object.entries(entries)) {
59
+ if (v === undefined || v === null || v === '')
60
+ continue;
61
+ out[k] = v;
62
+ }
63
+ return Object.keys(out).length > 0 ? out : undefined;
64
+ }
65
+ // ============================================================================
66
+ // mem0
67
+ // ============================================================================
68
+ /**
69
+ * mem0 export — an array (or `{results:[...]}`) of:
70
+ * { id, memory, user_id?/agent_id?/run_id?, metadata?, created_at? }
71
+ * `text` = `memory` (tolerating a `text` alias); the mem0 scope ids become
72
+ * tags so the per-scope isolation carries over; `imported_from:mem0` is added.
73
+ */
74
+ export function importMem0(json) {
75
+ const records = unwrap(json, ['results', 'memories', 'data', 'records', 'items']);
76
+ const out = [];
77
+ for (const raw of records) {
78
+ const rec = asObject(raw);
79
+ const text = cleanText(rec.memory ?? rec.text);
80
+ if (!text)
81
+ continue; // never fabricate a memory
82
+ const tags = ['imported_from:mem0'];
83
+ for (const k of ['user_id', 'agent_id', 'run_id']) {
84
+ const v = cleanText(rec[k]);
85
+ if (v)
86
+ tags.push(`${k}:${v}`);
87
+ }
88
+ const metadata = collectMeta({
89
+ ...asObject(rec.metadata),
90
+ mem0_id: rec.id,
91
+ created_at: rec.created_at,
92
+ });
93
+ out.push({ text, tags, source: 'mem0', metadata });
94
+ }
95
+ return out;
96
+ }
97
+ // ============================================================================
98
+ // Zep
99
+ // ============================================================================
100
+ /** Pull memory text out of a Zep fact/message/edge (object or bare string). */
101
+ function zepText(item) {
102
+ if (typeof item === 'string')
103
+ return cleanText(item);
104
+ const obj = asObject(item);
105
+ // fact (knowledge graph) → content (message) → memory/text aliases.
106
+ return cleanText(obj.fact ?? obj.content ?? obj.memory ?? obj.text);
107
+ }
108
+ function zepMeta(item) {
109
+ const obj = asObject(item);
110
+ return collectMeta({
111
+ role: obj.role,
112
+ created_at: obj.created_at,
113
+ name: obj.name,
114
+ uuid: obj.uuid ?? obj.id,
115
+ });
116
+ }
117
+ /**
118
+ * Zep export — facts and/or messages and/or a knowledge graph of edges. Zep's
119
+ * surfaces vary by API version, so this gathers from every common location:
120
+ * - `facts[]` / `memory.facts[]` / `relevant_facts[]` (objects `{fact|content}` or strings)
121
+ * - `messages[]` / `memory.messages[]` (`{role, content}`)
122
+ * - `edges[]` / `graph.edges[]` (graph edges `{fact}`)
123
+ * - a bare top-level array (each item probed for fact/content/memory/text)
124
+ * Every mapped item is tagged `imported_from:zep`.
125
+ */
126
+ export function importZep(json) {
127
+ const root = asObject(json);
128
+ const memory = asObject(root.memory);
129
+ const graph = asObject(root.graph);
130
+ const items = [
131
+ ...asArray(json), // bare top-level array
132
+ ...asArray(root.facts),
133
+ ...asArray(memory.facts),
134
+ ...asArray(root.relevant_facts),
135
+ ...asArray(root.messages),
136
+ ...asArray(memory.messages),
137
+ ...asArray(root.edges),
138
+ ...asArray(graph.edges),
139
+ ];
140
+ const out = [];
141
+ for (const item of items) {
142
+ const text = zepText(item);
143
+ if (!text)
144
+ continue;
145
+ out.push({ text, tags: ['imported_from:zep'], source: 'zep', metadata: zepMeta(item) });
146
+ }
147
+ return out;
148
+ }
149
+ // ============================================================================
150
+ // Supermemory
151
+ // ============================================================================
152
+ /**
153
+ * Supermemory export — `memories`/`documents` (or `results`/`data`, or a bare
154
+ * array) of `{ content | memory | text, metadata?, tags? }`. `text` = `content`
155
+ * (with `memory`/`text` aliases); `imported_from:supermemory` is added, and any
156
+ * string `tags`/`containerTags` on the record are carried through.
157
+ */
158
+ export function importSupermemory(json) {
159
+ const records = unwrap(json, ['memories', 'documents', 'results', 'data', 'records', 'items']);
160
+ const out = [];
161
+ for (const raw of records) {
162
+ const rec = asObject(raw);
163
+ const text = cleanText(rec.content ?? rec.memory ?? rec.text);
164
+ if (!text)
165
+ continue;
166
+ const tags = ['imported_from:supermemory'];
167
+ for (const t of [...asArray(rec.tags), ...asArray(rec.containerTags)]) {
168
+ const tv = cleanText(t);
169
+ if (tv)
170
+ tags.push(tv);
171
+ }
172
+ const metadata = collectMeta({
173
+ ...asObject(rec.metadata),
174
+ supermemory_id: rec.id,
175
+ created_at: rec.createdAt ?? rec.created_at,
176
+ });
177
+ out.push({ text, tags, source: 'supermemory', metadata });
178
+ }
179
+ return out;
180
+ }
181
+ // ============================================================================
182
+ // Letta / MemGPT
183
+ // ============================================================================
184
+ /** Read a Letta core-memory container into [label, text] block pairs. The
185
+ * container is either an object whose VALUES are the block text (classic
186
+ * MemGPT `{human, persona}`) or an array of block objects `{label|name, value|text}`. */
187
+ function lettaBlocks(container) {
188
+ const blocks = [];
189
+ if (Array.isArray(container)) {
190
+ for (const raw of container) {
191
+ const b = asObject(raw);
192
+ const label = cleanText(b.label ?? b.name) ?? 'block';
193
+ const text = cleanText(b.value ?? b.text ?? b.content);
194
+ if (text)
195
+ blocks.push({ label, text });
196
+ }
197
+ }
198
+ else {
199
+ for (const [label, raw] of Object.entries(asObject(container))) {
200
+ // value may be the block text directly, or a `{value|text}` object.
201
+ const text = cleanText(raw) ?? cleanText(asObject(raw).value ?? asObject(raw).text);
202
+ if (text)
203
+ blocks.push({ label, text });
204
+ }
205
+ }
206
+ return blocks;
207
+ }
208
+ /**
209
+ * Letta/MemGPT export — an agent's memory: core memory blocks + archival memory.
210
+ * - core blocks: `core_memory` | `memory.blocks` | `blocks` | `memory_blocks`
211
+ * (classic `{human, persona}` object OR an array of `{label, value}` blocks)
212
+ * - archival: `archival_memory[]` | `archival[]` (`{text|content}` or strings)
213
+ * Core blocks are tagged `block:<label>`; everything gets `imported_from:letta`.
214
+ */
215
+ export function importLetta(json) {
216
+ const root = asObject(json);
217
+ const memory = asObject(root.memory);
218
+ const out = [];
219
+ const coreContainer = root.core_memory ?? memory.blocks ?? root.blocks ?? root.memory_blocks ?? memory.core_memory;
220
+ for (const { label, text } of lettaBlocks(coreContainer)) {
221
+ out.push({
222
+ text,
223
+ tags: ['imported_from:letta', `block:${label}`],
224
+ source: 'letta',
225
+ metadata: collectMeta({ block: label, memory_type: 'core' }),
226
+ });
227
+ }
228
+ const archival = [...asArray(root.archival_memory), ...asArray(root.archival), ...asArray(memory.archival_memory)];
229
+ for (const raw of archival) {
230
+ const text = typeof raw === 'string' ? cleanText(raw) : cleanText(asObject(raw).text ?? asObject(raw).content);
231
+ if (!text)
232
+ continue;
233
+ out.push({
234
+ text,
235
+ tags: ['imported_from:letta', 'memory:archival'],
236
+ source: 'letta',
237
+ metadata: collectMeta({ memory_type: 'archival' }),
238
+ });
239
+ }
240
+ return out;
241
+ }
242
+ // ============================================================================
243
+ // Dispatcher
244
+ // ============================================================================
245
+ /** The rival sources `wyrm import --from` understands. */
246
+ export const IMPORT_SOURCES = ['mem0', 'zep', 'supermemory', 'letta'];
247
+ /**
248
+ * Route a parsed export to its mapper by `source`. Case- and whitespace-
249
+ * insensitive; `memgpt` is accepted as an alias for `letta`. Throws a clear
250
+ * Error for an unknown source.
251
+ */
252
+ export function importFrom(source, json) {
253
+ const key = String(source ?? '').trim().toLowerCase();
254
+ switch (key) {
255
+ case 'mem0':
256
+ return importMem0(json);
257
+ case 'zep':
258
+ return importZep(json);
259
+ case 'supermemory':
260
+ return importSupermemory(json);
261
+ case 'letta':
262
+ case 'memgpt':
263
+ return importLetta(json);
264
+ default:
265
+ throw new Error(`wyrm import: unknown source "${source}". Supported: ${IMPORT_SOURCES.join(', ')} (memgpt = letta).`);
266
+ }
267
+ }
268
+ //# sourceMappingURL=importers.js.map