@moxxy/core 0.26.0 → 0.27.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 (53) hide show
  1. package/dist/index.d.ts +4 -1
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +4 -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/host.d.ts +8 -0
  8. package/dist/plugins/host.d.ts.map +1 -1
  9. package/dist/plugins/host.js +14 -0
  10. package/dist/plugins/host.js.map +1 -1
  11. package/dist/plugins/registry-kinds.d.ts +1 -0
  12. package/dist/plugins/registry-kinds.d.ts.map +1 -1
  13. package/dist/plugins/registry-kinds.js +11 -0
  14. package/dist/plugins/registry-kinds.js.map +1 -1
  15. package/dist/registries/reflectors.d.ts +15 -0
  16. package/dist/registries/reflectors.d.ts.map +1 -0
  17. package/dist/registries/reflectors.js +16 -0
  18. package/dist/registries/reflectors.js.map +1 -0
  19. package/dist/session.d.ts +9 -1
  20. package/dist/session.d.ts.map +1 -1
  21. package/dist/session.js +17 -0
  22. package/dist/session.js.map +1 -1
  23. package/dist/sessions/event-shape.d.ts +68 -0
  24. package/dist/sessions/event-shape.d.ts.map +1 -0
  25. package/dist/sessions/event-shape.js +171 -0
  26. package/dist/sessions/event-shape.js.map +1 -0
  27. package/dist/sessions/persistence.d.ts +7 -5
  28. package/dist/sessions/persistence.d.ts.map +1 -1
  29. package/dist/sessions/persistence.js +39 -13
  30. package/dist/sessions/persistence.js.map +1 -1
  31. package/dist/skill-usage.d.ts +62 -0
  32. package/dist/skill-usage.d.ts.map +1 -0
  33. package/dist/skill-usage.js +106 -0
  34. package/dist/skill-usage.js.map +1 -0
  35. package/dist/skills/synthesize.d.ts.map +1 -1
  36. package/dist/skills/synthesize.js +42 -0
  37. package/dist/skills/synthesize.js.map +1 -1
  38. package/package.json +4 -4
  39. package/src/index.ts +11 -0
  40. package/src/plugins/host-options.ts +2 -0
  41. package/src/plugins/host.ts +14 -0
  42. package/src/plugins/registry-kinds.test.ts +4 -0
  43. package/src/plugins/registry-kinds.ts +13 -0
  44. package/src/registries/reflectors.test.ts +50 -0
  45. package/src/registries/reflectors.ts +17 -0
  46. package/src/session.ts +18 -0
  47. package/src/sessions/event-shape.test.ts +207 -0
  48. package/src/sessions/event-shape.ts +196 -0
  49. package/src/sessions/persistence.test.ts +132 -0
  50. package/src/sessions/persistence.ts +39 -13
  51. package/src/skill-usage.test.ts +102 -0
  52. package/src/skill-usage.ts +165 -0
  53. package/src/skills/synthesize.ts +42 -0
@@ -0,0 +1,106 @@
1
+ import { promises as fs } from 'node:fs';
2
+ import { createMutex } from '@moxxy/sdk';
3
+ import { moxxyPath, writeFileAtomic } from '@moxxy/sdk/server';
4
+ import { z } from 'zod';
5
+ export function skillsUsagePath() {
6
+ // Route through `moxxyPath` so a `$MOXXY_HOME` override relocates the skill
7
+ // usage aggregate alongside the rest of the data dir. Identical to
8
+ // `~/.moxxy/skills/.meta/usage.json` when MOXXY_HOME is unset.
9
+ return moxxyPath('skills/.meta/usage.json');
10
+ }
11
+ function emptyUsage() {
12
+ return { version: 1, updatedAt: new Date().toISOString(), skills: {} };
13
+ }
14
+ // Validates the on-disk shape so a hand-edited or partially-written file with a
15
+ // non-numeric counter (e.g. `invocations: "3"`) can't flow into the additive
16
+ // merge and corrupt the persisted aggregate via string concatenation. A failed
17
+ // parse falls through to `emptyUsage()`, exactly like malformed JSON.
18
+ const skillUsageSchema = z.object({
19
+ invocations: z.number(),
20
+ lastInvokedAt: z.string().optional(),
21
+ createdAt: z.string().optional(),
22
+ });
23
+ const skillUsageFileSchema = z.object({
24
+ version: z.literal(1),
25
+ updatedAt: z.string(),
26
+ skills: z.record(z.string(), skillUsageSchema),
27
+ });
28
+ /**
29
+ * Read the skill usage aggregate. Returns an empty file when missing or
30
+ * unparseable — skill usage is an optional, non-load-blocking layer.
31
+ */
32
+ export async function loadSkillUsage(filePath = skillsUsagePath()) {
33
+ try {
34
+ const raw = await fs.readFile(filePath, 'utf8');
35
+ const result = skillUsageFileSchema.safeParse(JSON.parse(raw));
36
+ if (result.success)
37
+ return result.data;
38
+ // shape-invalid (e.g. a non-numeric counter) — start fresh rather than let
39
+ // a corrupt entry poison the aggregate via string-concat addition.
40
+ }
41
+ catch {
42
+ // missing or malformed JSON — start fresh
43
+ }
44
+ return emptyUsage();
45
+ }
46
+ async function writeAtomic(file, filePath) {
47
+ await writeFileAtomic(filePath, JSON.stringify(file, null, 2) + '\n');
48
+ }
49
+ // Serializes the read-modify-write in `mergeSkillUsage` so two concurrent merges
50
+ // (e.g. overlapping shutdowns) can't both read the same snapshot and have the
51
+ // second write clobber the first's delta.
52
+ const mergeMutex = createMutex();
53
+ /** Later of two ISO timestamps (lexicographic sort is correct for same-format
54
+ * UTC `toISOString()` output). Either may be absent. */
55
+ function laterIso(a, b) {
56
+ if (!a)
57
+ return b;
58
+ if (!b)
59
+ return a;
60
+ return a >= b ? a : b;
61
+ }
62
+ /**
63
+ * Merge a session's per-skill delta into the persisted aggregate and write it
64
+ * back. Reads the current file, adds each `invocations` field-wise, keeps the
65
+ * earliest `createdAt` and the latest `lastInvokedAt`, and writes atomically.
66
+ * Returns the updated file.
67
+ *
68
+ * Best-effort: a write failure logs to stderr but does not throw — losing one
69
+ * session's stats must never block shutdown.
70
+ */
71
+ export async function mergeSkillUsage(delta, filePath = skillsUsagePath()) {
72
+ // An empty delta writes nothing, so there's no read-modify-write to serialize:
73
+ // skip the mutex and read the current file directly. A session that exercised
74
+ // no skills produces an empty delta on every shutdown, so this avoids needless
75
+ // I/O + contention on the common no-op path.
76
+ const keys = Object.keys(delta);
77
+ if (keys.length === 0)
78
+ return loadSkillUsage(filePath);
79
+ return mergeMutex.run(async () => {
80
+ const current = await loadSkillUsage(filePath);
81
+ const now = new Date().toISOString();
82
+ const skills = { ...current.skills };
83
+ for (const key of keys) {
84
+ const d = delta[key];
85
+ const existing = skills[key];
86
+ const invocations = (existing?.invocations ?? 0) + d.invocations;
87
+ const lastInvokedAt = laterIso(existing?.lastInvokedAt, d.lastInvokedAt);
88
+ const createdAt = existing?.createdAt ?? d.createdAt;
89
+ skills[key] = {
90
+ invocations,
91
+ ...(lastInvokedAt ? { lastInvokedAt } : {}),
92
+ ...(createdAt ? { createdAt } : {}),
93
+ };
94
+ }
95
+ const next = { version: 1, updatedAt: now, skills };
96
+ try {
97
+ await writeAtomic(next, filePath);
98
+ }
99
+ catch (err) {
100
+ process.stderr.write(`moxxy: failed to persist skill usage to ${filePath}: ` +
101
+ `${err instanceof Error ? err.message : String(err)}\n`);
102
+ }
103
+ return next;
104
+ });
105
+ }
106
+ //# sourceMappingURL=skill-usage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"skill-usage.js","sourceRoot":"","sources":["../src/skill-usage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAkDxB,MAAM,UAAU,eAAe;IAC7B,4EAA4E;IAC5E,mEAAmE;IACnE,+DAA+D;IAC/D,OAAO,SAAS,CAAC,yBAAyB,CAAC,CAAC;AAC9C,CAAC;AAED,SAAS,UAAU;IACjB,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;AACzE,CAAC;AAED,gFAAgF;AAChF,6EAA6E;AAC7E,+EAA+E;AAC/E,sEAAsE;AACtE,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IAChC,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE;IACvB,aAA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MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC;CAC5B;AAED,wBAAsB,eAAe,CACnC,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,GAAG,SAAS,EACzB,IAAI,GAAE,iBAAsB;AAC5B;;;;;;GAMG;AACH,MAAM,CAAC,EAAE,MAAM,GACd,OAAO,CAAC,gBAAgB,CAAC,CA2F3B;AAoED,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,OAAO,EAChB,IAAI,GAAE,iBAAsB,GAC3B,MAAM,CAwLR"}
@@ -155,6 +155,14 @@ async function rotateAuditIfNeeded(filePath) {
155
155
  await fs.writeFile(filePath, kept.join('\n') + '\n', 'utf8');
156
156
  }
157
157
  export function buildSynthesizeSkillPlugin(session, opts = {}) {
158
+ // Capability fs globs for the tools below, resolved from the same option
159
+ // fallbacks the handlers use. The audit JSONL defaults under the DEFAULT
160
+ // user skills dir even when `userDir` is overridden (see synthesizeSkill).
161
+ const userSkillsGlob = `${opts.userDir ?? defaultUserSkillsDir()}/**`;
162
+ const projectSkillsGlob = `${opts.projectDir ?? defaultProjectSkillsDir(session.cwd)}/**`;
163
+ const auditGlob = opts.auditPath
164
+ ? `${path.dirname(opts.auditPath)}/**`
165
+ : `${defaultUserSkillsDir()}/**`;
158
166
  return definePlugin({
159
167
  name: '@moxxy/synthesize-skill',
160
168
  version: '0.0.0',
@@ -178,6 +186,19 @@ export function buildSynthesizeSkillPlugin(session, opts = {}) {
178
186
  '"project" → <cwd>/.moxxy/skills/ — ONLY when the user explicitly asks for a project-scoped skill.'),
179
187
  }),
180
188
  permission: { action: 'prompt' },
189
+ // Drafts the skill body via the active LLMProvider (host is
190
+ // provider-config dependent, hence net: any), then writes the skill
191
+ // file + the audit JSONL.
192
+ isolation: {
193
+ capabilities: {
194
+ fs: {
195
+ read: [auditGlob],
196
+ write: [userSkillsGlob, projectSkillsGlob, auditGlob],
197
+ },
198
+ net: { mode: 'any' },
199
+ timeMs: 120_000,
200
+ },
201
+ },
181
202
  handler: async ({ intent, scope }, ctx) => {
182
203
  const result = await synthesizeSkill(session, intent, scope, opts, ctx.turnId);
183
204
  return {
@@ -200,6 +221,8 @@ export function buildSynthesizeSkillPlugin(session, opts = {}) {
200
221
  .min(1)
201
222
  .describe('The exact skill name from the "Available skills" list in the system prompt.'),
202
223
  }),
224
+ // Registry lookup — the skill body is already in memory.
225
+ isolation: { capabilities: { net: { mode: 'none' }, timeMs: 10_000 } },
203
226
  handler: async ({ name }, ctx) => {
204
227
  const skill = session.skills.byName(name);
205
228
  if (!skill) {
@@ -242,6 +265,23 @@ export function buildSynthesizeSkillPlugin(session, opts = {}) {
242
265
  // tool inherits the channel resolver's default, which denies in
243
266
  // headless runs (the skill-author flow couldn't activate a new skill).
244
267
  permission: { action: 'allow' },
268
+ // Rescans every skill source the boot loader used — the builtin and
269
+ // plugin dirs live wherever those packages are installed, so they're
270
+ // covered explicitly from the configured options.
271
+ isolation: {
272
+ capabilities: {
273
+ fs: {
274
+ read: [
275
+ userSkillsGlob,
276
+ projectSkillsGlob,
277
+ ...(opts.builtinDir ? [`${opts.builtinDir}/**`] : []),
278
+ ...(opts.pluginDirs ?? []).map((d) => `${d}/**`),
279
+ ],
280
+ },
281
+ net: { mode: 'none' },
282
+ timeMs: 30_000,
283
+ },
284
+ },
245
285
  handler: async () => {
246
286
  const { discoverSkills } = await import('./loader.js');
247
287
  // Discover first, swap second: never empty the registry while
@@ -271,6 +311,8 @@ export function buildSynthesizeSkillPlugin(session, opts = {}) {
271
311
  name: z.string().min(1).describe('Exact tool name from the "Loadable tools" index.'),
272
312
  }),
273
313
  permission: { action: 'allow' },
314
+ // Registry lookup — the schema inclusion happens on later requests.
315
+ isolation: { capabilities: { net: { mode: 'none' }, timeMs: 10_000 } },
274
316
  handler: ({ name }) => {
275
317
  // The call itself is recorded in the log; `applyLazyTools` reads that
276
318
  // to include the tool's schema on subsequent requests. Here we just
@@ -1 +1 @@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oEAAoE;oBACpE,uEAAuE;oBACvE,MAAM,IAAI,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;oBACrC,IAAI,CAAC,IAAI,EAAE,CAAC;wBACV,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK;6BACxB,IAAI,EAAE;6BACN,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;6BAClB,IAAI,CAAC,IAAI,CAAC,CAAC;wBACd,MAAM,IAAI,KAAK,CAAC,6BAA6B,IAAI,mBAAmB,KAAK,GAAG,CAAC,CAAC;oBAChF,CAAC;oBACD,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,WAAW,EAAE,IAAI,CAAC,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;gBAC1E,CAAC;aACF,CAAC;SACH;KACF,CAAC,CAAC;AACL,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moxxy/core",
3
- "version": "0.26.0",
3
+ "version": "0.27.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,14 +42,14 @@
42
42
  "jiti": "^2.4.2",
43
43
  "ulid": "^2.3.0",
44
44
  "zod": "^3.24.0",
45
- "@moxxy/sdk": "0.26.0"
45
+ "@moxxy/sdk": "0.27.0"
46
46
  },
47
47
  "devDependencies": {
48
48
  "@types/node": "^22.10.0",
49
49
  "typescript": "^5.7.3",
50
50
  "vitest": "^2.1.8",
51
- "@moxxy/vitest-preset": "0.0.0",
52
- "@moxxy/tsconfig": "0.0.0"
51
+ "@moxxy/tsconfig": "0.0.0",
52
+ "@moxxy/vitest-preset": "0.0.0"
53
53
  },
54
54
  "scripts": {
55
55
  "build": "tsc -p tsconfig.json",
package/src/index.ts CHANGED
@@ -21,6 +21,14 @@ export {
21
21
  type UsageStatsFile,
22
22
  type StoredModelUsage,
23
23
  } from './usage-stats.js';
24
+ export {
25
+ loadSkillUsage,
26
+ mergeSkillUsage,
27
+ skillsUsagePath,
28
+ type SkillUsageFile,
29
+ type SkillUsage,
30
+ type SkillUsageDelta,
31
+ } from './skill-usage.js';
24
32
  export { SkillRegistryImpl } from './registries/skills.js';
25
33
  export {
26
34
  parseSkillFile,
@@ -57,6 +65,7 @@ export { SynthesizerRegistry } from './registries/synthesizers.js';
57
65
  export { EmbedderRegistry } from './registries/embedders.js';
58
66
  export { IsolatorRegistry as ContributedIsolatorRegistry } from './registries/isolators.js';
59
67
  export { EventStoreRegistry } from './registries/event-stores.js';
68
+ export { ReflectorRegistry } from './registries/reflectors.js';
60
69
  export { jsonlEventStore } from './sessions/jsonl-event-store.js';
61
70
  export type {
62
71
  EventStoreDef,
@@ -78,11 +87,13 @@ export {
78
87
  setSessionGroup,
79
88
  seedSessionMeta,
80
89
  SESSION_META_VERSION,
90
+ SESSION_SOURCES,
81
91
  type SessionMeta,
82
92
  type SessionSource,
83
93
  type SessionPersistenceOpts,
84
94
  type EventPage,
85
95
  } from './sessions/persistence.js';
96
+ export { isMoxxyEventShape } from './sessions/event-shape.js';
86
97
  export {
87
98
  PluginHost,
88
99
  PluginRequirementError,
@@ -25,6 +25,7 @@ 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
27
  import type { EventStoreRegistry } from '../registries/event-stores.js';
28
+ import type { ReflectorRegistry } from '../registries/reflectors.js';
28
29
  import type { HookDispatcherImpl } from './lifecycle.js';
29
30
  import type { RequirementRegistry } from '../requirements.js';
30
31
 
@@ -48,6 +49,7 @@ export interface PluginHostOptions {
48
49
  readonly isolators: IsolatorRegistry;
49
50
  readonly workflowExecutors: WorkflowExecutorRegistry;
50
51
  readonly eventStores: EventStoreRegistry;
52
+ readonly reflectors: ReflectorRegistry;
51
53
  readonly requirements: RequirementRegistry;
52
54
  readonly dispatcher: HookDispatcherImpl;
53
55
  readonly loader?: PluginLoader;
@@ -92,6 +92,20 @@ export class PluginHost implements PluginHostHandle {
92
92
  return [...this.skipped.values()];
93
93
  }
94
94
 
95
+ /**
96
+ * The plugin that contributed the named tool — the `loaded` map key, i.e.
97
+ * the package name for discovered plugins and the declared plugin name for
98
+ * statically bundled ones. Linear scan over per-plugin name lists: the
99
+ * registries are small (~40 plugins × a handful of tools) and callers
100
+ * (security routing, audit views) are not hot paths.
101
+ */
102
+ ownerOfTool(toolName: string): string | undefined {
103
+ for (const [key, record] of this.loaded) {
104
+ if (record.toolNames.includes(toolName)) return key;
105
+ }
106
+ return undefined;
107
+ }
108
+
95
109
  registerStatic(plugin: Plugin, opts: RegisterStaticOptions = {}): void {
96
110
  if (this.loaded.has(plugin.name)) {
97
111
  throw new Error(`Plugin already registered: ${plugin.name}`);
@@ -37,6 +37,7 @@ import { EmbedderRegistry } from '../registries/embedders.js';
37
37
  import { IsolatorRegistry } from '../registries/isolators.js';
38
38
  import { WorkflowExecutorRegistry } from '../registries/workflow-executors.js';
39
39
  import { EventStoreRegistry } from '../registries/event-stores.js';
40
+ import { ReflectorRegistry } from '../registries/reflectors.js';
40
41
  import { RequirementRegistry } from '../requirements.js';
41
42
  import { HookDispatcherImpl } from './lifecycle.js';
42
43
  import { PluginHost } from './host.js';
@@ -87,6 +88,7 @@ const everyKindPlugin = definePlugin({
87
88
  readPage: async () => ({ events: [], prevCursor: null }),
88
89
  },
89
90
  ],
91
+ reflectors: [{ name: 'refl-1', reflect: async () => [] }],
90
92
  });
91
93
 
92
94
  function makeHost() {
@@ -108,6 +110,7 @@ function makeHost() {
108
110
  isolators: new IsolatorRegistry(),
109
111
  workflowExecutors: new WorkflowExecutorRegistry(),
110
112
  eventStores: new EventStoreRegistry(),
113
+ reflectors: new ReflectorRegistry(),
111
114
  };
112
115
  const requirements = new RequirementRegistry({
113
116
  tools: registries.tools,
@@ -147,6 +150,7 @@ function makeHost() {
147
150
  isolator: registries.isolators,
148
151
  workflowExecutor: registries.workflowExecutors,
149
152
  eventStore: registries.eventStores,
153
+ reflector: registries.reflectors,
150
154
  };
151
155
  return { host, byKind };
152
156
  }
@@ -17,6 +17,7 @@ import type {
17
17
  TunnelProviderDef,
18
18
  WorkflowExecutorDef,
19
19
  EventStoreDef,
20
+ ReflectorDef,
20
21
  } from '@moxxy/sdk';
21
22
  import type { PluginHostOptions } from './host-options.js';
22
23
 
@@ -44,6 +45,7 @@ export interface RegistryNameRecord {
44
45
  readonly isolatorNames: ReadonlyArray<string>;
45
46
  readonly workflowExecutorNames: ReadonlyArray<string>;
46
47
  readonly eventStoreNames: ReadonlyArray<string>;
48
+ readonly reflectorNames: ReadonlyArray<string>;
47
49
  }
48
50
 
49
51
  /**
@@ -243,4 +245,15 @@ export const REGISTRY_KINDS: ReadonlyArray<RegistryKind<unknown>> = [
243
245
  register: (o, e: EventStoreDef) => o.eventStores.register(e),
244
246
  unregister: (o, n) => o.eventStores.unregister(n),
245
247
  } satisfies RegistryKind<EventStoreDef>,
248
+ {
249
+ kind: 'reflector',
250
+ recordField: 'reflectorNames',
251
+ defs: (p) => p.reflectors ?? [],
252
+ nameOf: (r: ReflectorDef) => r.name,
253
+ // Throw-on-duplicate `register` (NOT `replace`): a discovered reflector is
254
+ // added but auto-adopts only when nothing is active yet (the registry is
255
+ // nullable — no core floor). The user swaps via `plugins.reflector.default`.
256
+ register: (o, r: ReflectorDef) => o.reflectors.register(r),
257
+ unregister: (o, n) => o.reflectors.unregister(n),
258
+ } satisfies RegistryKind<ReflectorDef>,
246
259
  ] as ReadonlyArray<RegistryKind<unknown>>;
@@ -0,0 +1,50 @@
1
+ import { describe, expect, it } from 'vitest';
2
+ import type { ReflectorDef } from '@moxxy/sdk';
3
+ import { Session, autoAllowResolver, silentLogger } from '../index.js';
4
+
5
+ function makeSession(): Session {
6
+ return new Session({ cwd: '/tmp', logger: silentLogger, permissionResolver: autoAllowResolver });
7
+ }
8
+
9
+ const def = (name: string): ReflectorDef => ({ name, reflect: async () => [] });
10
+
11
+ describe('Reflector registry (nullable, no floor)', () => {
12
+ it('starts empty — no core-seeded floor, reflection is off by default', () => {
13
+ const session = makeSession();
14
+ expect(session.reflectors.getActiveName()).toBeNull();
15
+ expect(session.reflectors.getFloorName()).toBeNull();
16
+ expect(session.reflectors.list()).toEqual([]);
17
+ expect(session.reflectors.getActive()).toBeNull();
18
+ });
19
+
20
+ it('publishes the registry on the service registry for the driver to resolve', () => {
21
+ const session = makeSession();
22
+ expect(session.services.get('reflectors')).toBe(session.reflectors);
23
+ });
24
+
25
+ it('auto-adopts the first registered reflector as active', () => {
26
+ const session = makeSession();
27
+ session.reflectors.register(def('default'));
28
+ expect(session.reflectors.getActiveName()).toBe('default');
29
+ expect(session.reflectors.getActive()?.name).toBe('default');
30
+ });
31
+
32
+ it('throws on a duplicate name and swaps via setActive', () => {
33
+ const session = makeSession();
34
+ session.reflectors.register(def('default'));
35
+ expect(() => session.reflectors.register(def('default'))).toThrow(/already registered/);
36
+ session.reflectors.register(def('smart'));
37
+ // Second registration does NOT steal active from the first.
38
+ expect(session.reflectors.getActiveName()).toBe('default');
39
+ session.reflectors.setActive('smart');
40
+ expect(session.reflectors.getActiveName()).toBe('smart');
41
+ });
42
+
43
+ it('reverts to null (no floor) when the active reflector is unregistered', () => {
44
+ const session = makeSession();
45
+ session.reflectors.register(def('default'));
46
+ session.reflectors.unregister('default');
47
+ expect(session.reflectors.getActiveName()).toBeNull();
48
+ expect(session.reflectors.getActive()).toBeNull();
49
+ });
50
+ });
@@ -0,0 +1,17 @@
1
+ import type { ReflectorDef } from '@moxxy/sdk';
2
+ import { ActiveDefRegistry } from './active-def-registry.js';
3
+
4
+ /**
5
+ * The single-active Reflector registry (the learning-loop block that watches a
6
+ * finished turn and proposes memory/skill improvements). NULLABLE by design:
7
+ * unlike the event-store/compactor registries there is NO core-seeded protected
8
+ * floor, so `getActive()` returns null until a plugin registers one — reflection
9
+ * is opt-in exactly like transcriber/synthesizer. `autoAdoptFirst` (the default)
10
+ * means the first registered reflector becomes active, and `unregister` reverts
11
+ * to null (no floor to fall back to). Uses throw-on-duplicate `register`.
12
+ */
13
+ export class ReflectorRegistry extends ActiveDefRegistry<ReflectorDef> {
14
+ constructor() {
15
+ super({ noun: 'Reflector', autoAdoptFirst: true });
16
+ }
17
+ }
package/src/session.ts CHANGED
@@ -35,6 +35,7 @@ import { EmbedderRegistry } from './registries/embedders.js';
35
35
  import { IsolatorRegistry } from './registries/isolators.js';
36
36
  import { WorkflowExecutorRegistry } from './registries/workflow-executors.js';
37
37
  import { EventStoreRegistry } from './registries/event-stores.js';
38
+ import { ReflectorRegistry } from './registries/reflectors.js';
38
39
  import { ServiceRegistryImpl } from './registries/services.js';
39
40
  import { jsonlEventStore } from './sessions/jsonl-event-store.js';
40
41
  import { RequirementRegistry } from './requirements.js';
@@ -50,6 +51,7 @@ import type {
50
51
  WorkflowsView,
51
52
  PluginsAdminView,
52
53
  ProviderSetupView,
54
+ SessionLike,
53
55
  PendingToolCall,
54
56
  PermissionContext,
55
57
  PermissionDecision,
@@ -136,6 +138,12 @@ export class Session implements ClientSession, SessionRuntime {
136
138
  readonly isolators: IsolatorRegistry;
137
139
  readonly workflowExecutors: WorkflowExecutorRegistry;
138
140
  readonly eventStores: EventStoreRegistry;
141
+ /**
142
+ * The learning-loop block: watches finished turns and proposes memory/skill
143
+ * improvements. NULLABLE — no core-seeded floor, so it stays empty until a
144
+ * reflector plugin (e.g. @moxxy/reflector-default) registers one.
145
+ */
146
+ readonly reflectors: ReflectorRegistry;
139
147
  /** Inter-plugin service registry — plugins publish/consume services in onInit. */
140
148
  readonly services: ServiceRegistryImpl;
141
149
  readonly requirements: RequirementRegistry;
@@ -186,6 +194,7 @@ export class Session implements ClientSession, SessionRuntime {
186
194
  workflows?: WorkflowsView;
187
195
  pluginsAdmin?: PluginsAdminView;
188
196
  providerSetup?: ProviderSetupView;
197
+ configAdmin?: SessionLike['configAdmin'];
189
198
  readonly dispatcher: HookDispatcherImpl;
190
199
  readonly pluginHost: PluginHost;
191
200
  private readonly controller = new AbortController();
@@ -241,6 +250,8 @@ export class Session implements ClientSession, SessionRuntime {
241
250
  this.services.register('synthesizers', this.synthesizers);
242
251
  this.services.register('skills', this.skills);
243
252
  this.services.register('tunnelProviders', this.tunnelProviders);
253
+ // The memory plugin (discovery-loadable) resolves its lazy embedder here.
254
+ this.services.register('embedders', this.embedders);
244
255
  // A stable accessor for the active provider's stored credentials. The
245
256
  // resolver itself is installed late (by activateProvider, after plugins are
246
257
  // built), so close over `this` and read it lazily at call time — lets
@@ -270,6 +281,12 @@ export class Session implements ClientSession, SessionRuntime {
270
281
  // Seed the built-in JSONL store as the protected floor — the storage backend
271
282
  // behind the event log always exists and can be swapped but never removed.
272
283
  this.eventStores.register(jsonlEventStore, { protected: true });
284
+ // Reflectors are nullable — no core floor is seeded, so reflection stays off
285
+ // until a reflector plugin registers one. Published on the service registry
286
+ // so a discovery-loaded driver (the reflector plugin's own hooks) can resolve
287
+ // the active reflector in onTurnEnd without importing @moxxy/core.
288
+ this.reflectors = new ReflectorRegistry();
289
+ this.services.register('reflectors', this.reflectors);
273
290
  this.requirements = new RequirementRegistry({
274
291
  tools: this.tools,
275
292
  providers: this.providers,
@@ -317,6 +334,7 @@ export class Session implements ClientSession, SessionRuntime {
317
334
  isolators: this.isolators,
318
335
  workflowExecutors: this.workflowExecutors,
319
336
  eventStores: this.eventStores,
337
+ reflectors: this.reflectors,
320
338
  requirements: this.requirements,
321
339
  dispatcher: this.dispatcher,
322
340
  loader: opts.pluginLoader,