@zelari/core 1.48.1 → 2.0.0-alpha.2

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 (117) hide show
  1. package/dist/agents/promptModules.d.ts +9 -0
  2. package/dist/agents/promptModules.d.ts.map +1 -1
  3. package/dist/agents/promptModules.js +34 -0
  4. package/dist/agents/promptModules.js.map +1 -1
  5. package/dist/experimental.d.ts +17 -0
  6. package/dist/experimental.d.ts.map +1 -0
  7. package/dist/experimental.js +31 -0
  8. package/dist/experimental.js.map +1 -0
  9. package/dist/index.d.ts +5 -0
  10. package/dist/index.d.ts.map +1 -1
  11. package/dist/index.js +10 -0
  12. package/dist/index.js.map +1 -1
  13. package/dist/mission/index.d.ts +5 -0
  14. package/dist/mission/index.d.ts.map +1 -0
  15. package/dist/mission/index.js +5 -0
  16. package/dist/mission/index.js.map +1 -0
  17. package/dist/mission/missionState.d.ts +37 -0
  18. package/dist/mission/missionState.d.ts.map +1 -0
  19. package/dist/mission/missionState.js +61 -0
  20. package/dist/mission/missionState.js.map +1 -0
  21. package/dist/runtime/executionContext.d.ts +46 -0
  22. package/dist/runtime/executionContext.d.ts.map +1 -0
  23. package/dist/runtime/executionContext.js +63 -0
  24. package/dist/runtime/executionContext.js.map +1 -0
  25. package/dist/runtime/index.d.ts +10 -0
  26. package/dist/runtime/index.d.ts.map +1 -0
  27. package/dist/runtime/index.js +10 -0
  28. package/dist/runtime/index.js.map +1 -0
  29. package/dist/runtime/memoryProviders.d.ts +27 -0
  30. package/dist/runtime/memoryProviders.d.ts.map +1 -0
  31. package/dist/runtime/memoryProviders.js +64 -0
  32. package/dist/runtime/memoryProviders.js.map +1 -0
  33. package/dist/runtime/nodeProviders.d.ts +21 -0
  34. package/dist/runtime/nodeProviders.d.ts.map +1 -0
  35. package/dist/runtime/nodeProviders.js +138 -0
  36. package/dist/runtime/nodeProviders.js.map +1 -0
  37. package/dist/runtime/profiles.d.ts +44 -0
  38. package/dist/runtime/profiles.d.ts.map +1 -0
  39. package/dist/runtime/profiles.js +91 -0
  40. package/dist/runtime/profiles.js.map +1 -0
  41. package/dist/runtime/providers.d.ts +85 -0
  42. package/dist/runtime/providers.d.ts.map +1 -0
  43. package/dist/runtime/providers.js +58 -0
  44. package/dist/runtime/providers.js.map +1 -0
  45. package/dist/runtime/worktreeWorkspace.d.ts +38 -0
  46. package/dist/runtime/worktreeWorkspace.d.ts.map +1 -0
  47. package/dist/runtime/worktreeWorkspace.js +80 -0
  48. package/dist/runtime/worktreeWorkspace.js.map +1 -0
  49. package/dist/session/exportSession.d.ts +31 -0
  50. package/dist/session/exportSession.d.ts.map +1 -0
  51. package/dist/session/exportSession.js +37 -0
  52. package/dist/session/exportSession.js.map +1 -0
  53. package/dist/session/index.d.ts +15 -0
  54. package/dist/session/index.d.ts.map +1 -0
  55. package/dist/session/index.js +15 -0
  56. package/dist/session/index.js.map +1 -0
  57. package/dist/session/lineage.d.ts +38 -0
  58. package/dist/session/lineage.d.ts.map +1 -0
  59. package/dist/session/lineage.js +69 -0
  60. package/dist/session/lineage.js.map +1 -0
  61. package/dist/session/modelSurface.d.ts +43 -0
  62. package/dist/session/modelSurface.d.ts.map +1 -0
  63. package/dist/session/modelSurface.js +96 -0
  64. package/dist/session/modelSurface.js.map +1 -0
  65. package/dist/session/replay.d.ts +61 -0
  66. package/dist/session/replay.d.ts.map +1 -0
  67. package/dist/session/replay.js +137 -0
  68. package/dist/session/replay.js.map +1 -0
  69. package/dist/session/store.d.ts +60 -0
  70. package/dist/session/store.d.ts.map +1 -0
  71. package/dist/session/store.js +117 -0
  72. package/dist/session/store.js.map +1 -0
  73. package/dist/session/types.d.ts +85 -0
  74. package/dist/session/types.d.ts.map +1 -0
  75. package/dist/session/types.js +62 -0
  76. package/dist/session/types.js.map +1 -0
  77. package/dist/session/writer.d.ts +44 -0
  78. package/dist/session/writer.d.ts.map +1 -0
  79. package/dist/session/writer.js +114 -0
  80. package/dist/session/writer.js.map +1 -0
  81. package/dist/shared/events.d.ts +76 -2
  82. package/dist/shared/events.d.ts.map +1 -1
  83. package/dist/shared/events.js +6 -0
  84. package/dist/shared/events.js.map +1 -1
  85. package/dist/skills/index.d.ts +2 -2
  86. package/dist/skills/index.d.ts.map +1 -1
  87. package/dist/skills/index.js +1 -1
  88. package/dist/skills/index.js.map +1 -1
  89. package/dist/verification/completionPolicy.d.ts +33 -0
  90. package/dist/verification/completionPolicy.d.ts.map +1 -0
  91. package/dist/verification/completionPolicy.js +68 -0
  92. package/dist/verification/completionPolicy.js.map +1 -0
  93. package/dist/verification/criteriaPack.v1.d.ts +27 -0
  94. package/dist/verification/criteriaPack.v1.d.ts.map +1 -0
  95. package/dist/verification/criteriaPack.v1.js +58 -0
  96. package/dist/verification/criteriaPack.v1.js.map +1 -0
  97. package/dist/verification/engine.d.ts +38 -0
  98. package/dist/verification/engine.d.ts.map +1 -0
  99. package/dist/verification/engine.js +163 -0
  100. package/dist/verification/engine.js.map +1 -0
  101. package/dist/verification/index.d.ts +11 -0
  102. package/dist/verification/index.d.ts.map +1 -0
  103. package/dist/verification/index.js +11 -0
  104. package/dist/verification/index.js.map +1 -0
  105. package/dist/verification/metrics.d.ts +26 -0
  106. package/dist/verification/metrics.d.ts.map +1 -0
  107. package/dist/verification/metrics.js +29 -0
  108. package/dist/verification/metrics.js.map +1 -0
  109. package/dist/verification/types.d.ts +161 -0
  110. package/dist/verification/types.d.ts.map +1 -0
  111. package/dist/verification/types.js +92 -0
  112. package/dist/verification/types.js.map +1 -0
  113. package/dist/verification/verifier.d.ts +133 -0
  114. package/dist/verification/verifier.d.ts.map +1 -0
  115. package/dist/verification/verifier.js +215 -0
  116. package/dist/verification/verifier.js.map +1 -0
  117. package/package.json +17 -1
@@ -42,6 +42,15 @@ export declare const KRAKEN_IDENTITY_MODULE: SystemPromptModule;
42
42
  * Injected on the kraken path with KRAKEN_IDENTITY_MODULE.
43
43
  */
44
44
  export declare const KRAKEN_LEAD_PLAYBOOK_MODULE: SystemPromptModule;
45
+ /**
46
+ * Kraken Verified-Selection playbook (Fase 5).
47
+ * Appended to the parent Kraken prompt ONLY when the alpha flag
48
+ * ZELARI_KRAKEN_SELECTION=1 is on and the call site is standard Kraken.
49
+ * Teaches WHEN to explore competing hypotheses and the discipline around
50
+ * the kraken_select tool. Candidate-side instructions (report format,
51
+ * diversity, evidence integrity) live in the task tool candidate override.
52
+ */
53
+ export declare const KRAKEN_SELECTION_PLAYBOOK_MODULE: SystemPromptModule;
45
54
  /** @deprecated Use KRAKEN_IDENTITY_MODULE */
46
55
  export declare const SINGLE_AGENT_IDENTITY_MODULE: SystemPromptModule;
47
56
  //# sourceMappingURL=promptModules.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"promptModules.d.ts","sourceRoot":"","sources":["../../src/agents/promptModules.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AASlE,OAAO,EACL,0BAA0B,EAC1B,0BAA0B,EAC1B,wBAAwB,EACxB,oBAAoB,GACrB,MAAM,oBAAoB,CAAC;AAE5B,uEAAuE;AACvE,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,SAAS,CAAC;AAClD,kEAAkE;AAClE,MAAM,MAAM,oBAAoB,GAAG,OAAO,CAAC;AA8F3C;;;GAGG;AACH,eAAO,MAAM,2BAA2B,EAAE,kBAczC,CAAC;AAEF,+DAA+D;AAC/D,eAAO,MAAM,uBAAuB,EAAE,kBAgBrC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,sBAAsB,EAAE,kBA4BpC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,6BAA6B,EAAE,kBAkC3C,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,GAAE,cAAc,GAAG,oBAAgC,GACtD,kBAAkB,EAAE,CAiCtB;AAED,kGAAkG;AAClG,eAAO,MAAM,cAAc,EAAE,kBAAkB,EAAoC,CAAC;AAEpF,kD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KpC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,2BAA2B,EAAE,kBAMzC,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,gCAAgC,EAAE,kBAyB9C,CAAC;AAEF,6CAA6C;AAC7C,eAAO,MAAM,4BAA4B,oBAAyB,CAAC"}
@@ -261,6 +261,40 @@ export const KRAKEN_LEAD_PLAYBOOK_MODULE = {
261
261
  priority: 25,
262
262
  content: "# Kraken Lead Playbook (super-agent)\n\nYou are the **parent brain**. Sub-agents spawned with task are tentacles: they cannot see this chat and cannot nest further task calls.\n\n## Default workflow (non-trivial work)\n1. **Orient** - list/read key files; optionally task explore (parallel OK for disjoint questions).\n2. **Decompose** - todo_write with concrete slices and acceptance criteria.\n3. **Implement** - one slice at a time via tools or task agent=general for a bounded unit.\n4. **Verify** - after meaningful writes, run checks yourself (bash / typecheck / tests) or task agent=verify. Do not claim done without on-disk evidence.\n5. **Integrate** - summarize files touched + how to verify; if more remains, checkpoint and ask.\n\n## When to spawn task\n- **explore**: unfamiliar area, multi-file search, map call sites (prefer parallel explores).\n- **general**: isolated implement slice with clear path scope (serial writers unless worktree isolation is on).\n- **verify**: post-implement gate (tests/typecheck/smoke).\n\n## Task contracts (required quality)\nEvery task prompt must be self-contained and include:\n- **Goal** (one sentence)\n- **Scope** (paths / symbols allowed; what is out of scope)\n- **Acceptance** (how the parent will know it succeeded)\n- **Constraints** (no drive-by refactors; match existing style)\n\nOptional tool fields: scope (path allowlist hint), acceptance (checklist). Prefer them when available.\n\n## Caps and discipline\n- Prefer at most 4 explore and 2 general spawns per user turn unless the user asks for more.\n- Do not expand scope beyond the user request.\n- Parallel: many explore OK; general writers stay serial unless ZELARI_KRAKEN_WORKTREE=1.\n- Nested task from children is disabled - you are the only orchestrator.\n- Cheap thoroughness defaults: explore=quick|medium; deep only when stuck.\n- Model routing: explore/verify may use ZELARI_KRAKEN_SUB_MODEL (cheaper); general stays on parent model unless ZELARI_KRAKEN_GENERAL_MODEL is set.\n- After every successful task general, spawn task verify (or run tests yourself) before claiming done - the tool appends a verify-hint footer.\n- Opt-in isolation: ZELARI_KRAKEN_WORKTREE=1 runs general tentacles in a git worktree under .zelari/worktrees/ (KEEP=1 to retain branch for manual merge).\n- Progress bus: tentacle spawns log to .zelari/radio/<session>.jsonl - slash command /kraken shows status.\n\n## Done means verified\nNever end with status theater. Either tools ran and files changed, or you stop with a short report and ask whether to continue.",
263
263
  };
264
+ /**
265
+ * Kraken Verified-Selection playbook (Fase 5).
266
+ * Appended to the parent Kraken prompt ONLY when the alpha flag
267
+ * ZELARI_KRAKEN_SELECTION=1 is on and the call site is standard Kraken.
268
+ * Teaches WHEN to explore competing hypotheses and the discipline around
269
+ * the kraken_select tool. Candidate-side instructions (report format,
270
+ * diversity, evidence integrity) live in the task tool candidate override.
271
+ */
272
+ export const KRAKEN_SELECTION_PLAYBOOK_MODULE = {
273
+ type: 'behavior-rules',
274
+ title: 'Kraken Verified Selection (alpha)',
275
+ // priority 26 = right after the lead playbook (25); +1000 via custom modules.
276
+ priority: 26,
277
+ content: [
278
+ '# Kraken Verified Selection (alpha)',
279
+ '',
280
+ 'You can explore competing hypotheses before committing to one implementation path.',
281
+ 'The runtime registers candidates, preserves their evidence verbatim, and judges them via the kraken_select tool.',
282
+ '',
283
+ '## When to explore candidates',
284
+ '- **Simple task** (rename, typo fix, small requested edit, single obvious change): go DIRECT. No candidates, no kraken_select.',
285
+ '- **Ambiguous task** (two or more plausible root causes or designs): spawn 2 candidates.',
286
+ '- **High uncertainty** (intermittent bug, race condition, architecture decision with trade-offs): spawn up to 3 candidates.',
287
+ '',
288
+ '## Rules',
289
+ '- Spawn candidates with the task tool using purpose="candidate" - explore-only tentacles; they never write.',
290
+ '- Each candidate must test a DIFFERENT normalized hypothesis. If two candidates would test the same theory, keep one.',
291
+ '- Wait for all candidate reports, then call kraken_select exactly once.',
292
+ '- If the verdict is needs_more_evidence: run at most one more targeted explore, then either re-select or proceed with the best-grounded candidate.',
293
+ '- Implement ONLY the selected path. Never blend multiple candidates.',
294
+ '- If the verdict includes required checks: in PLAN fold them into the final plan verification section; in BUILD pass them as the Acceptance criteria of your verify tentacle.',
295
+ '- A degraded, timed-out, or inconclusive observation is never proof of absence.',
296
+ ].join('\n'),
297
+ };
264
298
  /** @deprecated Use KRAKEN_IDENTITY_MODULE */
265
299
  export const SINGLE_AGENT_IDENTITY_MODULE = KRAKEN_IDENTITY_MODULE;
266
300
  //# sourceMappingURL=promptModules.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"promptModules.js","sourceRoot":"","sources":["../../src/agents/promptModules.ts"],"names":[],"mappings":"AACA,OAAO,EACL,8BAA8B,EAC9B,2BAA2B,EAC3B,wBAAwB,EACxB,uBAAuB,GACxB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AAEhE,OAAO,EACL,0BAA0B,EAC1B,0BAA0B,EAC1B,wBAAwB,EACxB,oBAAoB,GACrB,MAAM,oBAAoB,CAAC;AAO5B;;;GAGG;AACH,MAAM,uBAAuB,GAAuB;IAClD,IAAI,EAAE,eAAe;IACrB,KAAK,EAAE,UAAU;IACjB,QAAQ,EAAE,EAAE;IACZ,OAAO,EAAE;;iMAEsL;CAChM,CAAC;AAEF,MAAM,gBAAgB,GAAuB;IAC3C,IAAI,EAAE,eAAe;IACrB,KAAK,EAAE,UAAU;IACjB,QAAQ,EAAE,EAAE;IACZ,OAAO,EAAE;;;;sGAI2F;CACrG,CAAC;AAEF,MAAM,cAAc,GAAuB;IACzC,IAAI,EAAE,gBAAgB;IACtB,KAAK,EAAE,UAAU;IACjB,QAAQ,EAAE,EAAE;IACZ,OAAO,EAAE;;;;;;;;;sLAS2K;CACrL,CAAC;AAEF,MAAM,gBAAgB,GAAuB;IAC3C,IAAI,EAAE,gBAAgB;IACtB,KAAK,EAAE,UAAU;IACjB,QAAQ,EAAE,EAAE;IACZ,OAAO,EAAE;;;;;;;oEAOyD;CACnE,CAA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EAAE,sBAAsB;IAC7B,kFAAkF;IAClF,QAAQ,EAAE,EAAE;IACZ,OAAO,EAAE,ugFAAugF;CACjhF,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,gCAAgC,GAAuB;IAClE,IAAI,EAAE,gBAAgB;IACtB,KAAK,EAAE,mCAAmC;IAC1C,8EAA8E;IAC9E,QAAQ,EAAE,EAAE;IACZ,OAAO,EAAE;QACP,qCAAqC;QACrC,EAAE;QACF,oFAAoF;QACpF,kHAAkH;QAClH,EAAE;QACF,+BAA+B;QAC/B,gIAAgI;QAChI,0FAA0F;QAC1F,6HAA6H;QAC7H,EAAE;QACF,UAAU;QACV,6GAA6G;QAC7G,uHAAuH;QACvH,yEAAyE;QACzE,oJAAoJ;QACpJ,sEAAsE;QACtE,+KAA+K;QAC/K,iFAAiF;KAClF,CAAC,IAAI,CAAC,IAAI,CAAC;CACb,CAAC;AAEF,6CAA6C;AAC7C,MAAM,CAAC,MAAM,4BAA4B,GAAG,sBAAsB,CAAC"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * experimental.ts — registry of experimental flags (2.0 Phase 5).
3
+ *
4
+ * Every experimental capability is OFF unless explicitly enabled via the
5
+ * `ZELARI_EXPERIMENTAL` env var (comma-separated flag list). BoN, remote
6
+ * sandbox, E2B-like providers, generated orchestration and nested delegation
7
+ * all live behind this gate; none may become default without a benchmark
8
+ * case (plan §23-24).
9
+ */
10
+ export declare const EXPERIMENTAL_FLAGS: readonly ["bon", "remote-sandbox", "e2b-provider", "generated-orchestration", "nested-delegation"];
11
+ export type ExperimentalFlag = (typeof EXPERIMENTAL_FLAGS)[number];
12
+ /**
13
+ * True when `flag` appears in `ZELARI_EXPERIMENTAL` (case-insensitive CSV).
14
+ * Unknown values in the env var are ignored silently — flags are opt-in.
15
+ */
16
+ export declare function isExperimentalEnabled(flag: ExperimentalFlag, env?: Record<string, string | undefined>): boolean;
17
+ //# sourceMappingURL=experimental.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"experimental.d.ts","sourceRoot":"","sources":["../src/experimental.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,eAAO,MAAM,kBAAkB,oGAMrB,CAAC;AAEX,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEnE;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,gBAAgB,EACtB,GAAG,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAe,GACpD,OAAO,CAUT"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * experimental.ts — registry of experimental flags (2.0 Phase 5).
3
+ *
4
+ * Every experimental capability is OFF unless explicitly enabled via the
5
+ * `ZELARI_EXPERIMENTAL` env var (comma-separated flag list). BoN, remote
6
+ * sandbox, E2B-like providers, generated orchestration and nested delegation
7
+ * all live behind this gate; none may become default without a benchmark
8
+ * case (plan §23-24).
9
+ */
10
+ export const EXPERIMENTAL_FLAGS = [
11
+ 'bon',
12
+ 'remote-sandbox',
13
+ 'e2b-provider',
14
+ 'generated-orchestration',
15
+ 'nested-delegation',
16
+ ];
17
+ /**
18
+ * True when `flag` appears in `ZELARI_EXPERIMENTAL` (case-insensitive CSV).
19
+ * Unknown values in the env var are ignored silently — flags are opt-in.
20
+ */
21
+ export function isExperimentalEnabled(flag, env = process.env) {
22
+ const raw = env.ZELARI_EXPERIMENTAL;
23
+ if (!raw)
24
+ return false;
25
+ const enabled = new Set(raw
26
+ .split(',')
27
+ .map((value) => value.trim().toLowerCase())
28
+ .filter(Boolean));
29
+ return enabled.has(flag);
30
+ }
31
+ //# sourceMappingURL=experimental.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"experimental.js","sourceRoot":"","sources":["../src/experimental.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,KAAK;IACL,gBAAgB;IAChB,cAAc;IACd,yBAAyB;IACzB,mBAAmB;CACX,CAAC;AAIX;;;GAGG;AACH,MAAM,UAAU,qBAAqB,CACnC,IAAsB,EACtB,MAA0C,OAAO,CAAC,GAAG;IAErD,MAAM,GAAG,GAAG,GAAG,CAAC,mBAAmB,CAAC;IACpC,IAAI,CAAC,GAAG;QAAE,OAAO,KAAK,CAAC;IACvB,MAAM,OAAO,GAAG,IAAI,GAAG,CACrB,GAAG;SACA,KAAK,CAAC,GAAG,CAAC;SACV,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;SAC1C,MAAM,CAAC,OAAO,CAAC,CACnB,CAAC;IACF,OAAO,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AAC3B,CAAC"}
package/dist/index.d.ts CHANGED
@@ -13,4 +13,9 @@ export * from './skills/index.js';
13
13
  export * from './memory/types.js';
14
14
  export * from './state/index.js';
15
15
  export * from './kraken/index.js';
16
+ export * from './session/index.js';
17
+ export * from './runtime/index.js';
18
+ export * from './verification/index.js';
19
+ export * from './mission/index.js';
20
+ export * from './experimental.js';
16
21
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,cAAc,mBAAmB,CAAC;AAGlC,cAAc,kBAAkB,CAAC;AAGjC,cAAc,oBAAoB,CAAC;AAGnC,cAAc,oBAAoB,CAAC;AAGnC,cAAc,mBAAmB,CAAC;AAGlC,cAAc,mBAAmB,CAAC;AAGlC,cAAc,kBAAkB,CAAC;AAGjC,cAAc,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,cAAc,mBAAmB,CAAC;AAGlC,cAAc,kBAAkB,CAAC;AAGjC,cAAc,oBAAoB,CAAC;AAGnC,cAAc,oBAAoB,CAAC;AAGnC,cAAc,mBAAmB,CAAC;AAGlC,cAAc,mBAAmB,CAAC;AAGlC,cAAc,kBAAkB,CAAC;AAGjC,cAAc,mBAAmB,CAAC;AAGlC,cAAc,oBAAoB,CAAC;AAGnC,cAAc,oBAAoB,CAAC;AAGnC,cAAc,yBAAyB,CAAC;AAGxC,cAAc,oBAAoB,CAAC;AAGnC,cAAc,mBAAmB,CAAC"}
package/dist/index.js CHANGED
@@ -21,4 +21,14 @@ export * from './memory/types.js';
21
21
  export * from './state/index.js';
22
22
  // Kraken graph engine (pure DAG primitives; orchestration lives in the CLI)
23
23
  export * from './kraken/index.js';
24
+ // Session spine — append-only log, replay, fork/resume (ADR-0016/0021)
25
+ export * from './session/index.js';
26
+ // Runtime execution seams + versioned profiles (ADR-0022)
27
+ export * from './runtime/index.js';
28
+ // Deterministic verification + completion policy + optional verifier (ADR-0023)
29
+ export * from './verification/index.js';
30
+ // Mission state derived from the session spine (2.0 Phase 4)
31
+ export * from './mission/index.js';
32
+ // Experimental flags registry (2.0 Phase 5 — all OFF by default)
33
+ export * from './experimental.js';
24
34
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,qCAAqC;AACrC,cAAc,mBAAmB,CAAC;AAElC,eAAe;AACf,cAAc,kBAAkB,CAAC;AAEjC,aAAa;AACb,cAAc,oBAAoB,CAAC;AAEnC,sCAAsC;AACtC,cAAc,oBAAoB,CAAC;AAEnC,oBAAoB;AACpB,cAAc,mBAAmB,CAAC;AAElC,4DAA4D;AAC5D,cAAc,mBAAmB,CAAC;AAElC,8DAA8D;AAC9D,cAAc,kBAAkB,CAAC;AAEjC,4EAA4E;AAC5E,cAAc,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,qCAAqC;AACrC,cAAc,mBAAmB,CAAC;AAElC,eAAe;AACf,cAAc,kBAAkB,CAAC;AAEjC,aAAa;AACb,cAAc,oBAAoB,CAAC;AAEnC,sCAAsC;AACtC,cAAc,oBAAoB,CAAC;AAEnC,oBAAoB;AACpB,cAAc,mBAAmB,CAAC;AAElC,4DAA4D;AAC5D,cAAc,mBAAmB,CAAC;AAElC,8DAA8D;AAC9D,cAAc,kBAAkB,CAAC;AAEjC,4EAA4E;AAC5E,cAAc,mBAAmB,CAAC;AAElC,uEAAuE;AACvE,cAAc,oBAAoB,CAAC;AAEnC,0DAA0D;AAC1D,cAAc,oBAAoB,CAAC;AAEnC,gFAAgF;AAChF,cAAc,yBAAyB,CAAC;AAExC,6DAA6D;AAC7D,cAAc,oBAAoB,CAAC;AAEnC,iEAAiE;AACjE,cAAc,mBAAmB,CAAC"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * @zelari/core/mission — mission state derived from the session spine.
3
+ */
4
+ export * from './missionState.js';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/mission/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,cAAc,mBAAmB,CAAC"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * @zelari/core/mission — mission state derived from the session spine.
3
+ */
4
+ export * from './missionState.js';
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/mission/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,cAAc,mBAAmB,CAAC"}
@@ -0,0 +1,37 @@
1
+ /**
2
+ * mission/missionState.ts — mission state DERIVED from the session spine
3
+ * (2.0 Phase 4). No parallel state writer: phase, progress and replan count
4
+ * are projections of logged events. Interrupt/resume is native — an
5
+ * un-ended log with events is an interrupted, resumable mission.
6
+ */
7
+ import type { SessionProjection } from '../session/replay.js';
8
+ export type MissionPhase = 'design' | 'build' | 'verification' | 'done';
9
+ export interface MissionProgress {
10
+ criteriaTotal: number;
11
+ criteriaPassed: number;
12
+ /** pass/total from the last verification run; null when never verified. */
13
+ ratio: number | null;
14
+ /** True when the last verification passed everything WITH evidence. */
15
+ evidenceComplete: boolean;
16
+ }
17
+ export interface MissionState {
18
+ sessionId: string;
19
+ phase: MissionPhase;
20
+ progress: MissionProgress;
21
+ replans: number;
22
+ verifications: number;
23
+ lastSeq: number;
24
+ /** Events exist but session.ended is absent → resumable interrupt. */
25
+ interrupted: boolean;
26
+ /** Direct fork parent (full chain via lineageOf on the store). */
27
+ forkParent?: string;
28
+ }
29
+ /**
30
+ * Project a session into mission state.
31
+ * Phase precedence: last `complete:true` verification → done; else the last
32
+ * explicit `mission.phase` event; else inferred (verification > build > design).
33
+ */
34
+ export declare function deriveMissionState(projection: SessionProjection): MissionState;
35
+ /** Serializable mission snapshot (headless/Desktop resume payload). */
36
+ export declare function missionSnapshot(state: MissionState): string;
37
+ //# sourceMappingURL=missionState.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"missionState.d.ts","sourceRoot":"","sources":["../../src/mission/missionState.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAA0B,MAAM,sBAAsB,CAAC;AAEtF,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,OAAO,GAAG,cAAc,GAAG,MAAM,CAAC;AAIxE,MAAM,WAAW,eAAe;IAC9B,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;IACvB,2EAA2E;IAC3E,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,uEAAuE;IACvE,gBAAgB,EAAE,OAAO,CAAC;CAC3B;AAED,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,YAAY,CAAC;IACpB,QAAQ,EAAE,eAAe,CAAC;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,sEAAsE;IACtE,WAAW,EAAE,OAAO,CAAC;IACrB,kEAAkE;IAClE,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAkBD;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,iBAAiB,GAAG,YAAY,CA2B9E;AAED,uEAAuE;AACvE,wBAAgB,eAAe,CAAC,KAAK,EAAE,YAAY,GAAG,MAAM,CAU3D"}
@@ -0,0 +1,61 @@
1
+ /**
2
+ * mission/missionState.ts — mission state DERIVED from the session spine
3
+ * (2.0 Phase 4). No parallel state writer: phase, progress and replan count
4
+ * are projections of logged events. Interrupt/resume is native — an
5
+ * un-ended log with events is an interrupted, resumable mission.
6
+ */
7
+ const VALID_PHASES = ['design', 'build', 'verification', 'done'];
8
+ function progressFrom(lastVerification) {
9
+ const results = lastVerification?.results ?? [];
10
+ const criteriaTotal = results.length;
11
+ const criteriaPassed = results.filter((r) => r.status === 'pass').length;
12
+ const evidenceComplete = criteriaTotal > 0 &&
13
+ criteriaPassed === criteriaTotal &&
14
+ results.every((r) => r.evidenceCount > 0);
15
+ return {
16
+ criteriaTotal,
17
+ criteriaPassed,
18
+ ratio: criteriaTotal === 0 ? null : criteriaPassed / criteriaTotal,
19
+ evidenceComplete,
20
+ };
21
+ }
22
+ /**
23
+ * Project a session into mission state.
24
+ * Phase precedence: last `complete:true` verification → done; else the last
25
+ * explicit `mission.phase` event; else inferred (verification > build > design).
26
+ */
27
+ export function deriveMissionState(projection) {
28
+ const lastVerification = projection.verifications[projection.verifications.length - 1];
29
+ const complete = lastVerification?.complete === true;
30
+ const explicit = [...projection.missionPhases]
31
+ .reverse()
32
+ .find((p) => VALID_PHASES.includes(p.phase));
33
+ const phase = complete
34
+ ? 'done'
35
+ : explicit
36
+ ? explicit.phase
37
+ : projection.verifications.length > 0
38
+ ? 'verification'
39
+ : projection.toolCalls > 0 || projection.toolResults > 0
40
+ ? 'build'
41
+ : 'design';
42
+ return {
43
+ sessionId: projection.sessionId,
44
+ phase,
45
+ progress: progressFrom(lastVerification),
46
+ replans: projection.replans,
47
+ verifications: projection.verifications.length,
48
+ lastSeq: projection.lastSeq,
49
+ interrupted: projection.lastSeq > 0 && projection.endedAt === undefined,
50
+ forkParent: projection.fork?.parentSessionId,
51
+ };
52
+ }
53
+ /** Serializable mission snapshot (headless/Desktop resume payload). */
54
+ export function missionSnapshot(state) {
55
+ return JSON.stringify({
56
+ format: 'zelari-mission-snapshot',
57
+ version: 1,
58
+ ...state,
59
+ }, null, 2);
60
+ }
61
+ //# sourceMappingURL=missionState.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"missionState.js","sourceRoot":"","sources":["../../src/mission/missionState.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,MAAM,YAAY,GAA4B,CAAC,QAAQ,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,CAAC,CAAC;AAwB1F,SAAS,YAAY,CAAC,gBAAoD;IACxE,MAAM,OAAO,GAAG,gBAAgB,EAAE,OAAO,IAAI,EAAE,CAAC;IAChD,MAAM,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC;IACrC,MAAM,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,MAAM,CAAC,CAAC,MAAM,CAAC;IACzE,MAAM,gBAAgB,GACpB,aAAa,GAAG,CAAC;QACjB,cAAc,KAAK,aAAa;QAChC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,aAAa,GAAG,CAAC,CAAC,CAAC;IAC5C,OAAO;QACL,aAAa;QACb,cAAc;QACd,KAAK,EAAE,aAAa,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,cAAc,GAAG,aAAa;QAClE,gBAAgB;KACj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AAI,CAAC,SAAS,CACnB;QACE,MAAM,EAAE,yBAAyB;QACjC,OAAO,EAAE,CAAC;QACV,GAAG,KAAK;KACT,EACD,IAAI,EACJ,CAAC,CACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,46 @@
1
+ /**
2
+ * runtime/executionContext.ts — the seam bundle handed to engines and tools.
3
+ *
4
+ * Everything with side effects enters through here: session writer,
5
+ * workspace (jailed), fs/shell/subagent providers, active profile and the
6
+ * experimental flag gate. Built by `createExecutionContext`; the CLI may
7
+ * inject its own providers (e.g. the real task-tool subagent path).
8
+ */
9
+ import type { SessionEventInput, SessionEventEnvelope } from '../session/types.js';
10
+ import type { SessionLogWriter } from '../session/writer.js';
11
+ import { SessionStore } from '../session/store.js';
12
+ import { type ExperimentalFlag } from '../experimental.js';
13
+ import { type FsProvider, type ShellProvider, type SubagentProvider, type WorkspaceProvider } from './providers.js';
14
+ import { type Profile } from './profiles.js';
15
+ export interface ExecutionContext {
16
+ readonly sessionId: string;
17
+ readonly profile: Profile;
18
+ readonly workspace: WorkspaceProvider;
19
+ readonly fs: FsProvider;
20
+ readonly shell: ShellProvider;
21
+ readonly subagent: SubagentProvider;
22
+ /** Append an event to the session spine (verification, notes, tasks…). */
23
+ appendSessionEvent(input: SessionEventInput): Promise<SessionEventEnvelope>;
24
+ experimental(flag: ExperimentalFlag): boolean;
25
+ }
26
+ export interface CreateExecutionContextOptions {
27
+ workspaceRoot?: string;
28
+ sessionsDir?: string;
29
+ profileId?: string;
30
+ workspace?: WorkspaceProvider;
31
+ fs?: FsProvider;
32
+ shell?: ShellProvider;
33
+ subagent?: SubagentProvider;
34
+ env?: Record<string, string | undefined>;
35
+ reason?: string;
36
+ }
37
+ export interface ExecutionContextHandle {
38
+ readonly ctx: ExecutionContext;
39
+ readonly writer: SessionLogWriter;
40
+ readonly store: SessionStore;
41
+ /** End the session cleanly and release the writer lock. */
42
+ close(reason?: string): Promise<void>;
43
+ }
44
+ /** Create a session + providers bundle. `close()` ends the session. */
45
+ export declare function createExecutionContext(options?: CreateExecutionContextOptions): Promise<ExecutionContextHandle>;
46
+ //# sourceMappingURL=executionContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"executionContext.d.ts","sourceRoot":"","sources":["../../src/runtime/executionContext.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AACnF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAyB,KAAK,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAClF,OAAO,EAGL,KAAK,UAAU,EACf,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACvB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAoC,KAAK,OAAO,EAAE,MAAM,eAAe,CAAC;AAE/E,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,SAAS,EAAE,iBAAiB,CAAC;IACtC,QAAQ,CAAC,EAAE,EAAE,UAAU,CAAC;IACxB,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC;IAC9B,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,CAAC;IACpC,0EAA0E;IAC1E,kBAAkB,CAAC,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;IAC5E,YAAY,CAAC,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAAC;CAC/C;AAED,MAAM,WAAW,6BAA6B;IAC5C,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,iBAAiB,CAAC;IAC9B,EAAE,CAAC,EAAE,UAAU,CAAC;IAChB,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,QAAQ,CAAC,EAAE,gBAAgB,CAAC;IAC5B,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;IACzC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,GAAG,EAAE,gBAAgB,CAAC;IAC/B,QAAQ,CAAC,MAAM,EAAE,gBAAgB,CAAC;IAClC,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAC;IAC7B,2DAA2D;IAC3D,KAAK,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACvC;AAED,uEAAuE;AACvE,wBAAsB,sBAAsB,CAC1C,OAAO,GAAE,6BAAkC,GAC1C,OAAO,CAAC,sBAAsB,CAAC,CA8CjC"}
@@ -0,0 +1,63 @@
1
+ /**
2
+ * runtime/executionContext.ts — the seam bundle handed to engines and tools.
3
+ *
4
+ * Everything with side effects enters through here: session writer,
5
+ * workspace (jailed), fs/shell/subagent providers, active profile and the
6
+ * experimental flag gate. Built by `createExecutionContext`; the CLI may
7
+ * inject its own providers (e.g. the real task-tool subagent path).
8
+ */
9
+ import path from 'node:path';
10
+ import { SessionStore } from '../session/store.js';
11
+ import { isExperimentalEnabled } from '../experimental.js';
12
+ import { LocalWorkspace, NOOP_SUBAGENT_PROVIDER, } from './providers.js';
13
+ import { NodeFsProvider, NodeShellProvider } from './nodeProviders.js';
14
+ import { resolveProfile, toolManifestHash } from './profiles.js';
15
+ /** Create a session + providers bundle. `close()` ends the session. */
16
+ export async function createExecutionContext(options = {}) {
17
+ const workspace = options.workspace ?? new LocalWorkspace(path.resolve(options.workspaceRoot ?? process.cwd()));
18
+ const profile = resolveProfile(options.profileId ?? 'kraken/v1');
19
+ const store = SessionStore.withDefaults({
20
+ baseDir: options.sessionsDir,
21
+ workspaceRoot: options.workspaceRoot,
22
+ env: options.env,
23
+ });
24
+ const { sessionId, writer } = await store.create({
25
+ reason: options.reason ?? 'execution-context',
26
+ profile: profile.id,
27
+ workspace: workspace.root,
28
+ });
29
+ await writer.append({
30
+ kind: 'note',
31
+ actor: { type: 'system', role: 'profiles' },
32
+ data: {
33
+ note: 'profile manifest',
34
+ profileId: profile.id,
35
+ toolManifestHash: toolManifestHash(profile.tools),
36
+ workspaceKind: workspace.kind,
37
+ },
38
+ });
39
+ const fs = options.fs ?? new NodeFsProvider(workspace);
40
+ const shell = options.shell ?? new NodeShellProvider(workspace);
41
+ const subagent = options.subagent ?? NOOP_SUBAGENT_PROVIDER;
42
+ const env = options.env ?? process.env;
43
+ const ctx = {
44
+ sessionId,
45
+ profile,
46
+ workspace,
47
+ fs,
48
+ shell,
49
+ subagent,
50
+ appendSessionEvent: (input) => writer.append(input),
51
+ experimental: (flag) => isExperimentalEnabled(flag, env),
52
+ };
53
+ return {
54
+ ctx,
55
+ writer,
56
+ store,
57
+ close: async (reason = 'completed') => {
58
+ await writer.append({ kind: 'session.ended', actor: { type: 'system' }, data: { reason } });
59
+ await writer.close();
60
+ },
61
+ };
62
+ }
63
+ //# sourceMappingURL=executionContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"executionContext.js","sourceRoot":"","sources":["../../src/runtime/executionContext.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,IAAI,MAAM,WAAW,CAAC;AAG7B,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,qBAAqB,EAAyB,MAAM,oBAAoB,CAAC;AAClF,OAAO,EACL,cAAc,EACd,sBAAsB,GAKvB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvE,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAgB,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ChE,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,sBAAsB,CAAC;IAC5D,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,CAAC;IACvC,MAAM,GAAG,GAAqB;QAC5B,SAAS;QACT,OAAO;QACP,SAAS;QACT,EAAE;QACF,KAAK;QACL,QAAQ;QACR,kBAAkB,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC;QACnD,YAAY,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,qBAAqB,CAAC,IAAI,EAAE,GAAG,CAAC;KACzD,CAAC;IACF,OAAO;QACL,GAAG;QACH,MAAM;QACN,KAAK;QACL,KAAK,EAAE,KAAK,EAAE,MAAM,GAAG,WAAW,EAAE,EAAE;YACpC,MAAM,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,eAAe,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,IAAI,EAAE,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC;YAC5F,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC;QACvB,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @zelari/core/runtime — execution seams + profiles (ADR-0022).
3
+ */
4
+ export * from './providers.js';
5
+ export * from './nodeProviders.js';
6
+ export * from './memoryProviders.js';
7
+ export * from './worktreeWorkspace.js';
8
+ export * from './profiles.js';
9
+ export * from './executionContext.js';
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/runtime/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC;AACvC,cAAc,eAAe,CAAC;AAC9B,cAAc,uBAAuB,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @zelari/core/runtime — execution seams + profiles (ADR-0022).
3
+ */
4
+ export * from './providers.js';
5
+ export * from './nodeProviders.js';
6
+ export * from './memoryProviders.js';
7
+ export * from './worktreeWorkspace.js';
8
+ export * from './profiles.js';
9
+ export * from './executionContext.js';
10
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/runtime/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC;AACvC,cAAc,eAAe,CAAC;AAC9B,cAAc,uBAAuB,CAAC"}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * runtime/memoryProviders.ts — deterministic in-memory providers for tests
3
+ * and benchmarks (no fs/shell side effects).
4
+ */
5
+ import type { FsProvider, ShellProvider, ShellResult, ShellExecOptions } from './providers.js';
6
+ /** In-memory file map keyed by normalized relative path. */
7
+ export declare class MemoryFsProvider implements FsProvider {
8
+ readonly files: Map<string, string>;
9
+ constructor(seed?: Record<string, string>);
10
+ private norm;
11
+ readFile(rel: string): Promise<string>;
12
+ writeFile(rel: string, data: string): Promise<void>;
13
+ exists(rel: string): Promise<boolean>;
14
+ list(rel?: string): Promise<string[]>;
15
+ }
16
+ export type MemoryShellHandler = {
17
+ /** Substring (or regex source) matched against the command. */
18
+ match: string | RegExp;
19
+ result: Partial<ShellResult> | ((command: string) => Partial<ShellResult>);
20
+ };
21
+ /** Scripted shell: first matching handler wins; unmatched commands fail. */
22
+ export declare class MemoryShellProvider implements ShellProvider {
23
+ private readonly handlers;
24
+ constructor(handlers?: MemoryShellHandler[]);
25
+ exec(command: string, _options?: ShellExecOptions): Promise<ShellResult>;
26
+ }
27
+ //# sourceMappingURL=memoryProviders.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"memoryProviders.d.ts","sourceRoot":"","sources":["../../src/runtime/memoryProviders.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACV,UAAU,EACV,aAAa,EACb,WAAW,EACX,gBAAgB,EACjB,MAAM,gBAAgB,CAAC;AAExB,4DAA4D;AAC5D,qBAAa,gBAAiB,YAAW,UAAU;IACjD,QAAQ,CAAC,KAAK,sBAA6B;gBAE/B,IAAI,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM;IAI7C,OAAO,CAAC,IAAI;IAIN,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAQtC,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAInD,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAIrC,IAAI,CAAC,GAAG,SAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;CAIzC;AAED,MAAM,MAAM,kBAAkB,GAAG;IAC/B,+DAA+D;IAC/D,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,MAAM,EACF,OAAO,CAAC,WAAW,CAAC,GACpB,CAAC,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC;CACjD,CAAC;AAEF,4EAA4E;AAC5E,qBAAa,mBAAoB,YAAW,aAAa;IAC3C,OAAO,CAAC,QAAQ,CAAC,QAAQ;gBAAR,QAAQ,GAAE,kBAAkB,EAAO;IAE1D,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,WAAW,CAAC;CAwB/E"}
@@ -0,0 +1,64 @@
1
+ /**
2
+ * runtime/memoryProviders.ts — deterministic in-memory providers for tests
3
+ * and benchmarks (no fs/shell side effects).
4
+ */
5
+ /** In-memory file map keyed by normalized relative path. */
6
+ export class MemoryFsProvider {
7
+ files = new Map();
8
+ constructor(seed = {}) {
9
+ for (const [k, v] of Object.entries(seed))
10
+ this.files.set(this.norm(k), v);
11
+ }
12
+ norm(rel) {
13
+ return rel.replace(/^\.?\//, '').replace(/\\/g, '/');
14
+ }
15
+ async readFile(rel) {
16
+ const content = this.files.get(this.norm(rel));
17
+ if (content === undefined) {
18
+ throw new Error(`ENOENT (memory): ${rel}`);
19
+ }
20
+ return content;
21
+ }
22
+ async writeFile(rel, data) {
23
+ this.files.set(this.norm(rel), data);
24
+ }
25
+ async exists(rel) {
26
+ return this.files.has(this.norm(rel));
27
+ }
28
+ async list(rel = '.') {
29
+ const prefix = rel === '.' || rel === '' ? '' : `${this.norm(rel)}/`;
30
+ return [...this.files.keys()].filter((k) => k.startsWith(prefix)).sort();
31
+ }
32
+ }
33
+ /** Scripted shell: first matching handler wins; unmatched commands fail. */
34
+ export class MemoryShellProvider {
35
+ handlers;
36
+ constructor(handlers = []) {
37
+ this.handlers = handlers;
38
+ }
39
+ async exec(command, _options) {
40
+ void _options;
41
+ for (const handler of this.handlers) {
42
+ const hit = typeof handler.match === 'string' ? command.includes(handler.match) : handler.match.test(command);
43
+ if (!hit)
44
+ continue;
45
+ const partial = typeof handler.result === 'function' ? handler.result(command) : handler.result;
46
+ return {
47
+ exitCode: 0,
48
+ stdout: '',
49
+ stderr: '',
50
+ durationMs: 0,
51
+ timedOut: false,
52
+ ...partial,
53
+ };
54
+ }
55
+ return {
56
+ exitCode: 127,
57
+ stdout: '',
58
+ stderr: `MemoryShellProvider: no handler matched command: ${command}`,
59
+ durationMs: 0,
60
+ timedOut: false,
61
+ };
62
+ }
63
+ }
64
+ //# sourceMappingURL=memoryProviders.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"memoryProviders.js","sourceRoot":"","sources":["../../src/runtime/memoryProviders.ts"],"names":[],"mappings":"AAAA;;;GAGG;AASH,4DAA4D;AAC5D,MAAM,OAAO,gBAAgB;IAClB,KAAK,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eProviders.ts — node-backed Fs/Shell providers over a jailed workspace.
3
+ */
4
+ import type { FsProvider, ShellProvider, ShellResult, ShellExecOptions, WorkspaceProvider } from './providers.js';
5
+ export declare class NodeFsProvider implements FsProvider {
6
+ private readonly workspace;
7
+ constructor(workspace: WorkspaceProvider);
8
+ readFile(rel: string): Promise<string>;
9
+ writeFile(rel: string, data: string): Promise<void>;
10
+ exists(rel: string): Promise<boolean>;
11
+ list(rel?: string): Promise<string[]>;
12
+ }
13
+ export declare class NodeShellProvider implements ShellProvider {
14
+ private readonly workspace;
15
+ private readonly defaults;
16
+ constructor(workspace: WorkspaceProvider, defaults?: {
17
+ timeoutMs?: number;
18
+ });
19
+ exec(command: string, options?: ShellExecOptions): Promise<ShellResult>;
20
+ }
21
+ //# sourceMappingURL=nodeProviders.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nodeProviders.d.ts","sourceRoot":"","sources":["../../src/runtime/nodeProviders.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,WAAW,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AA4BlH,qBAAa,cAAe,YAAW,UAAU;IACnC,OAAO,CAAC,QAAQ,CAAC,SAAS;gBAAT,SAAS,EAAE,iBAAiB;IAEnD,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAItC,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAMnD,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IASrC,IAAI,CAAC,GAAG,SAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;CAqBzC;AAED,qBAAa,iBAAkB,YAAW,aAAa;IAEnD,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,QAAQ;gBADR,SAAS,EAAE,iBAAiB,EAC5B,QAAQ,GAAE;QAAE,SAAS,CAAC,EAAE,MAAM,CAAA;KAAO;IAGlD,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE,gBAAqB,GAAG,OAAO,CAAC,WAAW,CAAC;CAkDlF"}