@moxxy/core 0.6.2 → 0.7.0

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 (70) hide show
  1. package/dist/index.d.ts +3 -1
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +5 -1
  4. package/dist/index.js.map +1 -1
  5. package/dist/plugins/host-options.d.ts +2 -0
  6. package/dist/plugins/host-options.d.ts.map +1 -1
  7. package/dist/plugins/registry-kinds.d.ts +1 -0
  8. package/dist/plugins/registry-kinds.d.ts.map +1 -1
  9. package/dist/plugins/registry-kinds.js +12 -0
  10. package/dist/plugins/registry-kinds.js.map +1 -1
  11. package/dist/registries/active-def-registry.d.ts +46 -9
  12. package/dist/registries/active-def-registry.d.ts.map +1 -1
  13. package/dist/registries/active-def-registry.js +39 -10
  14. package/dist/registries/active-def-registry.js.map +1 -1
  15. package/dist/registries/event-stores.d.ts +13 -0
  16. package/dist/registries/event-stores.d.ts.map +1 -0
  17. package/dist/registries/event-stores.js +14 -0
  18. package/dist/registries/event-stores.js.map +1 -0
  19. package/dist/registries/modes.d.ts +6 -0
  20. package/dist/registries/modes.d.ts.map +1 -1
  21. package/dist/registries/modes.js +10 -0
  22. package/dist/registries/modes.js.map +1 -1
  23. package/dist/registries/services.d.ts +15 -0
  24. package/dist/registries/services.d.ts.map +1 -0
  25. package/dist/registries/services.js +26 -0
  26. package/dist/registries/services.js.map +1 -0
  27. package/dist/run-turn.d.ts.map +1 -1
  28. package/dist/run-turn.js +3 -0
  29. package/dist/run-turn.js.map +1 -1
  30. package/dist/session-runtime.d.ts +3 -1
  31. package/dist/session-runtime.d.ts.map +1 -1
  32. package/dist/session.d.ts +25 -3
  33. package/dist/session.d.ts.map +1 -1
  34. package/dist/session.js +78 -8
  35. package/dist/session.js.map +1 -1
  36. package/dist/sessions/jsonl-event-store.d.ts +16 -0
  37. package/dist/sessions/jsonl-event-store.d.ts.map +1 -0
  38. package/dist/sessions/jsonl-event-store.js +30 -0
  39. package/dist/sessions/jsonl-event-store.js.map +1 -0
  40. package/dist/sessions/persistence.d.ts +3 -58
  41. package/dist/sessions/persistence.d.ts.map +1 -1
  42. package/dist/sessions/persistence.js +2 -0
  43. package/dist/sessions/persistence.js.map +1 -1
  44. package/dist/subagents/run-child.d.ts.map +1 -1
  45. package/dist/subagents/run-child.js +2 -0
  46. package/dist/subagents/run-child.js.map +1 -1
  47. package/package.json +2 -2
  48. package/src/index.ts +11 -6
  49. package/src/plugins/host-options.ts +2 -0
  50. package/src/plugins/registry-kinds.test.ts +17 -0
  51. package/src/plugins/registry-kinds.ts +14 -0
  52. package/src/registries/active-def-registry.test.ts +42 -0
  53. package/src/registries/active-def-registry.ts +70 -13
  54. package/src/registries/event-stores.test.ts +77 -0
  55. package/src/registries/event-stores.ts +15 -0
  56. package/src/registries/modes.ts +12 -0
  57. package/src/registries/services.test.ts +29 -0
  58. package/src/registries/services.ts +33 -0
  59. package/src/run-turn.ts +3 -0
  60. package/src/session-runtime.ts +3 -0
  61. package/src/session.ts +89 -8
  62. package/src/sessions/jsonl-event-store.ts +31 -0
  63. package/src/sessions/persistence.ts +11 -58
  64. package/src/subagents/run-child.ts +2 -0
  65. package/dist/preferences.d.ts +0 -40
  66. package/dist/preferences.d.ts.map +0 -1
  67. package/dist/preferences.js +0 -59
  68. package/dist/preferences.js.map +0 -1
  69. package/src/preferences.test.ts +0 -156
  70. package/src/preferences.ts +0 -85
@@ -289,6 +289,7 @@ function buildChildContext(rt, spec, model, childSessionId, childTurnId, toolReg
289
289
  turnId: childTurnId,
290
290
  cwd: parentAppCtx.cwd,
291
291
  env: parentAppCtx.env,
292
+ services: parentAppCtx.services,
292
293
  model,
293
294
  ...(spec.systemPrompt !== undefined ? { systemPrompt: spec.systemPrompt } : {}),
294
295
  provider: parentSession.providers.getActive(),
@@ -299,6 +300,7 @@ function buildChildContext(rt, spec, model, childSessionId, childTurnId, toolReg
299
300
  cacheStrategy: parentSession.cacheStrategies.getActive(),
300
301
  ...(parentSession.elisionSettings ? { elision: parentSession.elisionSettings } : {}),
301
302
  ...(parentSession.lazyTools ? { lazyTools: true } : {}),
303
+ ...(parentSession.loopGuard ? { loopGuard: parentSession.loopGuard } : {}),
302
304
  permissions: parentSession.resolver,
303
305
  // Intentionally no `approval` — fanning approval gates out to N
304
306
  // children in parallel would prompt the user N times. Strategies
@@ -1 +1 @@
1
- {"version":3,"file":"run-child.js","sourceRoot":"","sources":["../../src/subagents/run-child.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAeH,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAE/D,OAAO,EACL,qBAAqB,EACrB,iBAAiB,EACjB,mBAAmB,EACnB,wBAAwB,GACzB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,yBAAyB,EAAE,MAAM,YAAY,CAAC;AACvD,OAAO,EACL,kBAAkB,EAClB,qBAAqB,EACrB,oBAAoB,EACpB,oBAAoB,GAErB,MAAM,eAAe,CAAC;AAavB,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,IAIlC;IACC,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,aAAa,EAAE,GAAG,IAAI,CAAC;IACzC,MAAM,EAAE,aAAa,EAAE,YAAY,EAAE,GAAG,EAAE,CAAC;IAC3C,MAAM,cAAc,GAAG,YAAY,EAAE,CAAC;IACtC,MAAM,WAAW,GAAG,SAAS,EAAE,CAAC;IAChC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,IAAI,YAAY,MAAM,CAAC,cAAc,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAC3E,MAAM,iBAAiB,GAAG,IAAI,CAAC,IAAI,IAAI,SAAS,CAAC;IAEjD,MAAM,QAAQ,GAAG,MAAM,eAAe,CACpC,aAAa,EACb,YAAY,EACZ,KAA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C,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CACjB,YAAY,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,CAAC,aAAa,KAAK,IAAI,EAAE,CAAC,CACvE,CACF,CAAC;YACF,OAAO,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,CAAC,EAAkB,EAAE;gBACjD,IAAI,OAAO,CAAC,MAAM,KAAK,WAAW;oBAAE,OAAO,OAAO,CAAC,KAAK,CAAC;gBACzD,0EAA0E;gBAC1E,2EAA2E;gBAC3E,wEAAwE;gBACxE,oBAAoB;gBACpB,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;gBACtB,OAAO,kBAAkB,CAAC,IAAI,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;YACpE,CAAC,CAAC,CAAC;QACL,CAAC;QACD,KAAK,CAAC,QAAQ,CAAC,IAA0B;YACvC,OAAO,iBAAiB,CAAC,IAAI,CAAC,CAAC;QACjC,CAAC;QACD,OAAO,CAAC,cAAyB;YAC/B,oBAAoB,CAAC,cAAc,CAAC,CAAC;QACvC,CAAC;KACF,CAAC;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moxxy/core",
3
- "version": "0.6.2",
3
+ "version": "0.7.0",
4
4
  "description": "The moxxy runtime as a programmatic library: the agentic Session + runTurn loop, the event log, the plugin host, every block registry (providers, tools, modes, compactors, cache strategies, channels, …), session persistence, and the permission engine. Pair with @moxxy/sdk to build and embed moxxy agents in your own code.",
5
5
  "keywords": [
6
6
  "moxxy",
@@ -42,7 +42,7 @@
42
42
  "jiti": "^2.4.2",
43
43
  "ulid": "^2.3.0",
44
44
  "zod": "^3.24.0",
45
- "@moxxy/sdk": "0.18.0"
45
+ "@moxxy/sdk": "0.20.0"
46
46
  },
47
47
  "devDependencies": {
48
48
  "@types/node": "^22.10.0",
package/src/index.ts CHANGED
@@ -10,12 +10,9 @@ export {
10
10
  // so the programmatic API is fully typed from a single `@moxxy/core` import.
11
11
  export type { MoxxyEvent, Plugin, ToolDef, PermissionResolver } from '@moxxy/sdk';
12
12
  export { createSubagentSpawner, clearRetainedChildren, type SubagentRuntime } from './subagents.js';
13
- export {
14
- loadPreferences,
15
- savePreferences,
16
- preferencesPath,
17
- type MoxxyPreferences,
18
- } from './preferences.js';
13
+ // Runtime provider/mode/model/disabled persistence moved from
14
+ // ~/.moxxy/preferences.json into the unified `plugins:` manifest; the writers
15
+ // now live in @moxxy/config (setCategoryDefault/setProviderModel/…).
19
16
  export {
20
17
  loadUsageStats,
21
18
  mergeUsageStats,
@@ -59,6 +56,14 @@ export { TranscriberRegistry } from './registries/transcribers.js';
59
56
  export { SynthesizerRegistry } from './registries/synthesizers.js';
60
57
  export { EmbedderRegistry } from './registries/embedders.js';
61
58
  export { IsolatorRegistry as ContributedIsolatorRegistry } from './registries/isolators.js';
59
+ export { EventStoreRegistry } from './registries/event-stores.js';
60
+ export { jsonlEventStore } from './sessions/jsonl-event-store.js';
61
+ export type {
62
+ EventStoreDef,
63
+ EventStoreSession,
64
+ EventStoreScope,
65
+ EventLogLike,
66
+ } from '@moxxy/sdk';
62
67
  export { RequirementRegistry, type RequirementRegistryOptions } from './requirements.js';
63
68
  export {
64
69
  SessionPersistence,
@@ -24,6 +24,7 @@ import type { SynthesizerRegistry } from '../registries/synthesizers.js';
24
24
  import type { EmbedderRegistry } from '../registries/embedders.js';
25
25
  import type { IsolatorRegistry } from '../registries/isolators.js';
26
26
  import type { WorkflowExecutorRegistry } from '../registries/workflow-executors.js';
27
+ import type { EventStoreRegistry } from '../registries/event-stores.js';
27
28
  import type { HookDispatcherImpl } from './lifecycle.js';
28
29
  import type { RequirementRegistry } from '../requirements.js';
29
30
 
@@ -46,6 +47,7 @@ export interface PluginHostOptions {
46
47
  readonly embedders: EmbedderRegistry;
47
48
  readonly isolators: IsolatorRegistry;
48
49
  readonly workflowExecutors: WorkflowExecutorRegistry;
50
+ readonly eventStores: EventStoreRegistry;
49
51
  readonly requirements: RequirementRegistry;
50
52
  readonly dispatcher: HookDispatcherImpl;
51
53
  readonly loader?: PluginLoader;
@@ -36,6 +36,7 @@ import { SynthesizerRegistry } from '../registries/synthesizers.js';
36
36
  import { EmbedderRegistry } from '../registries/embedders.js';
37
37
  import { IsolatorRegistry } from '../registries/isolators.js';
38
38
  import { WorkflowExecutorRegistry } from '../registries/workflow-executors.js';
39
+ import { EventStoreRegistry } from '../registries/event-stores.js';
39
40
  import { RequirementRegistry } from '../requirements.js';
40
41
  import { HookDispatcherImpl } from './lifecycle.js';
41
42
  import { PluginHost } from './host.js';
@@ -72,6 +73,20 @@ const everyKindPlugin = definePlugin({
72
73
  embedders: [defineEmbedder({ name: 'emb-1', createClient: () => ({}) as never })],
73
74
  isolators: [isolator],
74
75
  workflowExecutors: [defineWorkflowExecutor({ name: 'wfx-1', run: async () => ({}) as never })],
76
+ eventStores: [
77
+ {
78
+ name: 'es-1',
79
+ open: () => ({
80
+ attach: () => () => {},
81
+ flush: async () => {},
82
+ settleWrites: async () => {},
83
+ updateHeader: () => {},
84
+ degraded: false,
85
+ }),
86
+ restore: async () => [],
87
+ readPage: async () => ({ events: [], prevCursor: null }),
88
+ },
89
+ ],
75
90
  });
76
91
 
77
92
  function makeHost() {
@@ -92,6 +107,7 @@ function makeHost() {
92
107
  embedders: new EmbedderRegistry(),
93
108
  isolators: new IsolatorRegistry(),
94
109
  workflowExecutors: new WorkflowExecutorRegistry(),
110
+ eventStores: new EventStoreRegistry(),
95
111
  };
96
112
  const requirements = new RequirementRegistry({
97
113
  tools: registries.tools,
@@ -130,6 +146,7 @@ function makeHost() {
130
146
  embedder: registries.embedders,
131
147
  isolator: registries.isolators,
132
148
  workflowExecutor: registries.workflowExecutors,
149
+ eventStore: registries.eventStores,
133
150
  };
134
151
  return { host, byKind };
135
152
  }
@@ -16,6 +16,7 @@ import type {
16
16
  ViewRendererDef,
17
17
  TunnelProviderDef,
18
18
  WorkflowExecutorDef,
19
+ EventStoreDef,
19
20
  } from '@moxxy/sdk';
20
21
  import type { PluginHostOptions } from './host-options.js';
21
22
 
@@ -42,6 +43,7 @@ export interface RegistryNameRecord {
42
43
  readonly embedderNames: ReadonlyArray<string>;
43
44
  readonly isolatorNames: ReadonlyArray<string>;
44
45
  readonly workflowExecutorNames: ReadonlyArray<string>;
46
+ readonly eventStoreNames: ReadonlyArray<string>;
45
47
  }
46
48
 
47
49
  /**
@@ -229,4 +231,16 @@ export const REGISTRY_KINDS: ReadonlyArray<RegistryKind<unknown>> = [
229
231
  register: (o, w: WorkflowExecutorDef) => o.workflowExecutors.register(w),
230
232
  unregister: (o, n) => o.workflowExecutors.unregister(n),
231
233
  } satisfies RegistryKind<WorkflowExecutorDef>,
234
+ {
235
+ kind: 'eventStore',
236
+ recordField: 'eventStoreNames',
237
+ defs: (p) => p.eventStores ?? [],
238
+ nameOf: (e: EventStoreDef) => e.name,
239
+ // Throw-on-duplicate `register` (NOT `replace`): a discovered plugin's store
240
+ // is added but can't shadow the protected JSONL floor and never auto-
241
+ // activates — the user opts in via `plugins.eventStore.default`. The store
242
+ // sees every event, so that explicit opt-in is the trust boundary.
243
+ register: (o, e: EventStoreDef) => o.eventStores.register(e),
244
+ unregister: (o, n) => o.eventStores.unregister(n),
245
+ } satisfies RegistryKind<EventStoreDef>,
232
246
  ] as ReadonlyArray<RegistryKind<unknown>>;
@@ -100,4 +100,46 @@ describe('ActiveDefRegistry (shared base)', () => {
100
100
  r.setActive('a');
101
101
  expect(r.getActive()?.name).toBe('a');
102
102
  });
103
+
104
+ describe('protected floor (swap, don\'t break)', () => {
105
+ it('records the floor and reports it via getFloorName', () => {
106
+ const r = new ActiveDefRegistry<Thing>({ noun: 'Thing' });
107
+ r.register(mk('base'), { protected: true });
108
+ expect(r.getFloorName()).toBe('base');
109
+ expect(r.getActiveName()).toBe('base');
110
+ const r2 = new ActiveDefRegistry<Thing>({ noun: 'Thing' });
111
+ r2.register(mk('a'));
112
+ expect(r2.getFloorName()).toBeNull(); // no floor when nothing is protected
113
+ });
114
+
115
+ it('reverts active to the floor when the active swap target is removed', () => {
116
+ const r = new ActiveDefRegistry<Thing>({ noun: 'Thing' });
117
+ r.register(mk('base'), { protected: true });
118
+ r.register(mk('swap'));
119
+ r.setActive('swap');
120
+ expect(r.getActiveName()).toBe('swap');
121
+ r.unregister('swap');
122
+ expect(r.getActiveName()).toBe('base'); // reverts to floor, never null
123
+ expect(r.getActive()?.name).toBe('base');
124
+ });
125
+
126
+ it('refuses to unregister the floor', () => {
127
+ const r = new ActiveDefRegistry<Thing>({ noun: 'Thing' });
128
+ r.register(mk('base'), { protected: true });
129
+ expect(() => r.unregister('base')).toThrow(
130
+ "Thing 'base' is a protected default and cannot be removed",
131
+ );
132
+ expect(r.has('base')).toBe(true);
133
+ });
134
+
135
+ it('falls back to the floor when nothing is explicitly active', () => {
136
+ const r = new ActiveDefRegistry<Thing>({ noun: 'Thing' });
137
+ r.register(mk('base'), { protected: true });
138
+ r.register(mk('swap'));
139
+ r.setActive('swap');
140
+ r.clearActive();
141
+ expect(r.getActiveName()).toBe('base'); // floor, not null
142
+ expect(r.getActive()?.name).toBe('base');
143
+ });
144
+ });
103
145
  });
@@ -7,14 +7,28 @@
7
7
  * - the first registration auto-activates (when `autoAdoptFirst`, the
8
8
  * default), so a session always has a default once a plugin loads one
9
9
  * - the host / agent calls `setActive(name)` to switch
10
- * - call sites read `getActive()` (returns null when nothing is active)
11
- * - `unregister` clears the active slot rather than silently picking an
12
- * arbitrary successor callers must `setActive()` again
10
+ * - call sites read `getActive()` (returns the protected floor, else null,
11
+ * when nothing is explicitly active)
12
+ * - `unregister` reverts the active slot to the protected floor (if one was
13
+ * seeded) rather than going null — so a non-nullable slot is never left
14
+ * empty by removing a swap target — and otherwise clears it (callers must
15
+ * `setActive()` again)
16
+ *
17
+ * ## Protected floor ("swap, don't break")
18
+ *
19
+ * Core seeds a non-nullable kind's built-in default with `{ protected: true }`,
20
+ * recording it as the registry's **floor**. The floor is the safety net behind
21
+ * the unified `plugins:` manifest: a user may *swap* the active def to any other
22
+ * registered one, but disabling/removing the swap target reverts to the floor
23
+ * instead of bricking the slot, and the floor itself cannot be unregistered.
24
+ * `getActive()`/`getActiveName()` fall back to the floor whenever nothing is
25
+ * explicitly active. Floors are core-seeded (never plugin-contributed), so a
26
+ * plugin's `unload` never tries to unregister a floor name.
13
27
  *
14
28
  * This is the def-only sibling of {@link ActiveBackendRegistry} (which also
15
29
  * builds runtime *instances* for STT/TTS/embeddings). The two families share
16
30
  * the same surface (register/replace/unregister/list/has/setActive/getActive/
17
- * getActiveName/clearActive) so they stay consistent.
31
+ * getActiveName/getFloorName/clearActive) so they stay consistent.
18
32
  *
19
33
  * `ModeRegistry` (change-listeners + legacy-name migration) and
20
34
  * `ProviderRegistry` (disabled-set + built instances) deliberately stay
@@ -28,9 +42,22 @@ export interface ActiveDefRegistryOptions {
28
42
  readonly autoAdoptFirst?: boolean;
29
43
  }
30
44
 
45
+ /** Options for a single registration. */
46
+ export interface RegisterOptions {
47
+ /**
48
+ * Mark this def as the registry's protected **floor** — the built-in default
49
+ * a non-nullable slot reverts to when its active swap target is removed, and
50
+ * which itself cannot be unregistered. Core seeds floors at construction; do
51
+ * not pass this from discovered plugins.
52
+ */
53
+ readonly protected?: boolean;
54
+ }
55
+
31
56
  export class ActiveDefRegistry<TDef extends { name: string }> {
32
57
  private readonly defs = new Map<string, TDef>();
33
58
  private active: string | null = null;
59
+ /** Name of the protected floor def, or null when this kind is nullable. */
60
+ private floor: string | null = null;
34
61
  private readonly noun: string;
35
62
  private readonly autoAdoptFirst: boolean;
36
63
 
@@ -42,29 +69,40 @@ export class ActiveDefRegistry<TDef extends { name: string }> {
42
69
  /**
43
70
  * Register a def. Throws on duplicate — use `replace()` to overwrite.
44
71
  * Auto-activates the first registration (when `autoAdoptFirst`).
72
+ * Pass `{ protected: true }` to record it as the floor (§ protected floor).
45
73
  */
46
- register(def: TDef): void {
74
+ register(def: TDef, opts?: RegisterOptions): void {
47
75
  if (this.defs.has(def.name)) {
48
76
  throw new Error(`${this.noun} already registered: ${def.name}`);
49
77
  }
50
78
  this.defs.set(def.name, def);
79
+ if (opts?.protected) this.floor = def.name;
51
80
  if (this.autoAdoptFirst && !this.active) this.active = def.name;
52
81
  }
53
82
 
54
83
  /** Overwrite an existing def (or add a new one) without throwing.
55
84
  * Auto-activates when nothing is active yet (mirrors `register`). */
56
- replace(def: TDef): void {
85
+ replace(def: TDef, opts?: RegisterOptions): void {
57
86
  this.defs.set(def.name, def);
87
+ if (opts?.protected) this.floor = def.name;
58
88
  if (this.autoAdoptFirst && !this.active) this.active = def.name;
59
89
  }
60
90
 
61
91
  /**
62
- * Remove a def. If it was active, the active slot is cleared (callers must
63
- * `setActive()` rather than getting an arbitrary "next").
92
+ * Remove a def. The protected floor cannot be removed (throws). If the
93
+ * removed def was active, the active slot reverts to the floor when one is
94
+ * present (so a non-nullable slot is never left empty), otherwise clears.
64
95
  */
65
96
  unregister(name: string): void {
97
+ if (name === this.floor) {
98
+ throw new Error(
99
+ `${this.noun} '${name}' is a protected default and cannot be removed — swap the default instead`,
100
+ );
101
+ }
66
102
  this.defs.delete(name);
67
- if (this.active === name) this.active = null;
103
+ if (this.active === name) {
104
+ this.active = this.floor && this.defs.has(this.floor) ? this.floor : null;
105
+ }
68
106
  }
69
107
 
70
108
  list(): ReadonlyArray<TDef> {
@@ -81,17 +119,36 @@ export class ActiveDefRegistry<TDef extends { name: string }> {
81
119
  this.active = def.name;
82
120
  }
83
121
 
84
- /** Deactivate the current def (callers fall back to their default). */
122
+ /** Deactivate the current explicit def; falls back to the floor (if any). */
85
123
  clearActive(): void {
86
124
  this.active = null;
87
125
  }
88
126
 
127
+ /**
128
+ * Designate an already-registered def as the protected floor. Used when the
129
+ * built-in default is contributed by a kernel *plugin* (e.g. compactor
130
+ * `summarize`, cacheStrategy `stable-prefix`) rather than core-seeded — setup
131
+ * calls this after the kernel plugin registers. Throws if `name` is unknown.
132
+ */
133
+ markFloor(name: string): void {
134
+ if (!this.defs.has(name)) {
135
+ throw new Error(`${this.noun} not registered: ${name}`);
136
+ }
137
+ this.floor = name;
138
+ }
139
+
140
+ /** Name of the protected floor def, or null when this kind has no floor. */
141
+ getFloorName(): string | null {
142
+ return this.floor;
143
+ }
144
+
89
145
  getActive(): TDef | null {
90
- if (!this.active) return null;
91
- return this.defs.get(this.active) ?? null;
146
+ const name = this.active ?? this.floor;
147
+ if (!name) return null;
148
+ return this.defs.get(name) ?? null;
92
149
  }
93
150
 
94
151
  getActiveName(): string | null {
95
- return this.active;
152
+ return this.active ?? this.floor;
96
153
  }
97
154
  }
@@ -0,0 +1,77 @@
1
+ import { afterEach, beforeEach, describe, expect, it } from 'vitest';
2
+ import { promises as fs } from 'node:fs';
3
+ import * as os from 'node:os';
4
+ import * as path from 'node:path';
5
+ import type { EventStoreDef } from '@moxxy/sdk';
6
+ import { Session, autoAllowResolver, silentLogger } from '../index.js';
7
+ import { jsonlEventStore } from '../sessions/jsonl-event-store.js';
8
+
9
+ function makeSession(): Session {
10
+ return new Session({ cwd: '/tmp', logger: silentLogger, permissionResolver: autoAllowResolver });
11
+ }
12
+
13
+ describe('EventStore registry + floor', () => {
14
+ it('seeds the JSONL store as the active, protected floor', () => {
15
+ const session = makeSession();
16
+ expect(session.eventStores.getActiveName()).toBe('jsonl');
17
+ expect(session.eventStores.getFloorName()).toBe('jsonl');
18
+ expect(session.eventStores.list().map((s) => s.name)).toEqual(['jsonl']);
19
+ });
20
+
21
+ it('a registered second store does NOT auto-activate (trust boundary)', () => {
22
+ const session = makeSession();
23
+ const fake: EventStoreDef = {
24
+ name: 'fake',
25
+ open: jsonlEventStore.open,
26
+ restore: jsonlEventStore.restore,
27
+ readPage: jsonlEventStore.readPage,
28
+ };
29
+ session.eventStores.register(fake);
30
+ // Still on the floor — a discovered store is inert until explicit setActive.
31
+ expect(session.eventStores.getActiveName()).toBe('jsonl');
32
+ session.eventStores.setActive('fake');
33
+ expect(session.eventStores.getActiveName()).toBe('fake');
34
+ // Removing the swap target reverts to the floor, never null.
35
+ session.eventStores.unregister('fake');
36
+ expect(session.eventStores.getActiveName()).toBe('jsonl');
37
+ });
38
+
39
+ it('refuses to unregister the protected jsonl floor', () => {
40
+ const session = makeSession();
41
+ expect(() => session.eventStores.unregister('jsonl')).toThrow(/protected default/);
42
+ expect(session.eventStores.getActiveName()).toBe('jsonl');
43
+ });
44
+ });
45
+
46
+ describe('jsonlEventStore round-trip (behaviour-identical to SessionPersistence)', () => {
47
+ let dir: string;
48
+ beforeEach(async () => {
49
+ dir = await fs.mkdtemp(path.join(os.tmpdir(), 'mox-evstore-'));
50
+ });
51
+ afterEach(async () => {
52
+ await fs.rm(dir, { recursive: true, force: true });
53
+ });
54
+
55
+ it('open().attach() persists log events that restore() reads back', async () => {
56
+ const session = makeSession();
57
+ const store = session.eventStores.getActive()!;
58
+ const handle = store.open({ sessionId: session.id, cwd: '/tmp', dir });
59
+ const detach = handle.attach(session.log);
60
+
61
+ await session.log.append({
62
+ type: 'user_prompt',
63
+ text: 'hello store',
64
+ sessionId: session.id,
65
+ source: 'user',
66
+ });
67
+ await handle.settleWrites();
68
+ await handle.flush();
69
+
70
+ const restored = await store.restore(String(session.id), dir);
71
+ expect(restored.some((e) => e.type === 'user_prompt')).toBe(true);
72
+
73
+ const page = await store.readPage(String(session.id), { before: null, limit: 10 }, dir);
74
+ expect(page.events.length).toBeGreaterThanOrEqual(1);
75
+ detach();
76
+ });
77
+ });
@@ -0,0 +1,15 @@
1
+ import type { EventStoreDef } from '@moxxy/sdk';
2
+ import { ActiveDefRegistry } from './active-def-registry.js';
3
+
4
+ /**
5
+ * The single-active EventStore registry (storage backend behind the event log).
6
+ * Core seeds the JSONL default as a protected floor; uses throw-on-duplicate
7
+ * `register` (NOT override) so a discovered plugin's store is added but never
8
+ * shadows the floor — the user must `setActive` it explicitly. A removed
9
+ * non-floor store reverts to the JSONL floor (never null).
10
+ */
11
+ export class EventStoreRegistry extends ActiveDefRegistry<EventStoreDef> {
12
+ constructor() {
13
+ super({ noun: 'EventStore' });
14
+ }
15
+ }
@@ -55,6 +55,18 @@ export class ModeRegistry {
55
55
  return [...this.modes.values()];
56
56
  }
57
57
 
58
+ has(name: string): boolean {
59
+ return this.modes.has(name) || this.modes.has(migrateModeName(name));
60
+ }
61
+
62
+ /** Active mode name, or null when none is active. Mirrors ActiveDefRegistry
63
+ * so the manifest apply loop + `categories()` surface can treat modes
64
+ * uniformly. (`mode` has no protected-floor concept here — `mode-default`
65
+ * is a critical package, so the default is protected at the package level.) */
66
+ getActiveName(): string | null {
67
+ return this.active;
68
+ }
69
+
58
70
  setActive(name: string): void {
59
71
  // Prefer the literal name; only when it isn't registered fall back to the
60
72
  // legacy-name map (e.g. a persisted "tool-use" → "default"). This never
@@ -0,0 +1,29 @@
1
+ import { describe, expect, it } from 'vitest';
2
+ import { ServiceRegistryImpl } from './services.js';
3
+
4
+ describe('ServiceRegistryImpl', () => {
5
+ it('register / get / has round-trip', () => {
6
+ const r = new ServiceRegistryImpl();
7
+ expect(r.has('vault')).toBe(false);
8
+ expect(r.get('vault')).toBeUndefined();
9
+ const store = { secret: 1 };
10
+ r.register('vault', store);
11
+ expect(r.has('vault')).toBe(true);
12
+ expect(r.get('vault')).toBe(store);
13
+ });
14
+
15
+ it('require returns the service or throws with a helpful message', () => {
16
+ const r = new ServiceRegistryImpl();
17
+ expect(() => r.require('vault')).toThrow(/Required service not registered: vault/);
18
+ const store = { secret: 2 };
19
+ r.register('vault', store);
20
+ expect(r.require<typeof store>('vault')).toBe(store);
21
+ });
22
+
23
+ it('last write wins (a later plugin may replace a service)', () => {
24
+ const r = new ServiceRegistryImpl();
25
+ r.register('x', 1);
26
+ r.register('x', 2);
27
+ expect(r.get('x')).toBe(2);
28
+ });
29
+ });
@@ -0,0 +1,33 @@
1
+ import type { ServiceRegistry } from '@moxxy/sdk';
2
+
3
+ /**
4
+ * In-process inter-plugin service registry (one per Session). A plugin publishes
5
+ * a named service in `onInit`; a sibling plugin resolves it in its own `onInit`.
6
+ * Last-write-wins on a duplicate name (a later plugin may intentionally replace
7
+ * a service); `require` throws when the name was never published.
8
+ */
9
+ export class ServiceRegistryImpl implements ServiceRegistry {
10
+ private readonly services = new Map<string, unknown>();
11
+
12
+ register<T>(name: string, impl: T): void {
13
+ this.services.set(name, impl);
14
+ }
15
+
16
+ get<T>(name: string): T | undefined {
17
+ return this.services.get(name) as T | undefined;
18
+ }
19
+
20
+ require<T>(name: string): T {
21
+ if (!this.services.has(name)) {
22
+ throw new Error(
23
+ `Required service not registered: ${name}. The providing plugin's onInit ` +
24
+ 'must run first — declare a moxxy.requirements entry on the consumer.',
25
+ );
26
+ }
27
+ return this.services.get(name) as T;
28
+ }
29
+
30
+ has(name: string): boolean {
31
+ return this.services.has(name);
32
+ }
33
+ }
package/src/run-turn.ts CHANGED
@@ -55,6 +55,7 @@ export async function* runTurn(
55
55
  ...(opts.attachments && opts.attachments.length > 0
56
56
  ? { attachments: opts.attachments }
57
57
  : {}),
58
+ ...(opts.origin ? { origin: opts.origin } : {}),
58
59
  });
59
60
 
60
61
  // Resolve provider + model AFTER the prompt is recorded so a
@@ -109,6 +110,7 @@ export async function* runTurn(
109
110
  turnId,
110
111
  cwd: appCtx.cwd,
111
112
  env: appCtx.env,
113
+ services: appCtx.services,
112
114
  model,
113
115
  systemPrompt: opts.systemPrompt,
114
116
  provider,
@@ -122,6 +124,7 @@ export async function* runTurn(
122
124
  // Reasoning preference (effort) — honored only by providers/models that
123
125
  // advertise `supportsReasoning` (gated in collectProviderStream).
124
126
  ...(session.reasoning ? { reasoning: session.reasoning } : {}),
127
+ ...(session.loopGuard ? { loopGuard: session.loopGuard } : {}),
125
128
  permissions: session.resolver,
126
129
  ...(session.approvalResolver ? { approval: session.approvalResolver } : {}),
127
130
  hooks: session.dispatcher,
@@ -6,6 +6,7 @@ import type {
6
6
  ElisionSettings,
7
7
  HookDispatcher,
8
8
  LLMProvider,
9
+ LoopGuardSettings,
9
10
  ModeDef,
10
11
  PermissionResolver,
11
12
  PluginHostHandle,
@@ -59,6 +60,8 @@ export interface SessionRuntime {
59
60
  readonly lazyTools: boolean;
60
61
  /** Reasoning/thinking preference (effort), forwarded to each turn's ModeContext. */
61
62
  readonly reasoning?: { readonly effort?: 'low' | 'medium' | 'high' } | boolean | undefined;
63
+ /** Stuck-loop guard tuning, forwarded to each turn's ModeContext. */
64
+ readonly loopGuard?: LoopGuardSettings;
62
65
  readonly dispatcher: HookDispatcher;
63
66
  readonly pluginHost: PluginHostHandle;
64
67
  /**