@cortexkit/opencode-magic-context 0.38.1 → 0.40.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.
- package/README.md +57 -4
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/profiles.d.ts +22 -0
- package/dist/config/profiles.d.ts.map +1 -0
- package/dist/config/project-security.d.ts +14 -6
- package/dist/config/project-security.d.ts.map +1 -1
- package/dist/config/raw-loader.d.ts +42 -0
- package/dist/config/raw-loader.d.ts.map +1 -0
- package/dist/config/schema/magic-context.d.ts +966 -531
- package/dist/config/schema/magic-context.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/classify.d.ts +3 -2
- package/dist/features/magic-context/dreamer/classify.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/evaluate-smart-notes.d.ts +9 -2
- package/dist/features/magic-context/dreamer/evaluate-smart-notes.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/map-memories-prompt.d.ts +4 -2
- package/dist/features/magic-context/dreamer/map-memories-prompt.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/map-memories.d.ts +21 -5
- package/dist/features/magic-context/dreamer/map-memories.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/refresh-primers.d.ts +3 -2
- package/dist/features/magic-context/dreamer/refresh-primers.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/task-config.d.ts +2 -1
- package/dist/features/magic-context/dreamer/task-config.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/task-executor.d.ts +0 -1
- package/dist/features/magic-context/dreamer/task-executor.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/task-scheduler.d.ts +3 -2
- package/dist/features/magic-context/dreamer/task-scheduler.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/verify-prompt.d.ts +5 -2
- package/dist/features/magic-context/dreamer/verify-prompt.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/verify.d.ts +6 -3
- package/dist/features/magic-context/dreamer/verify.d.ts.map +1 -1
- package/dist/features/magic-context/fail-closed-block.d.ts +11 -1
- package/dist/features/magic-context/fail-closed-block.d.ts.map +1 -1
- package/dist/features/magic-context/memory/embedding-failure.d.ts +11 -0
- package/dist/features/magic-context/memory/embedding-failure.d.ts.map +1 -0
- package/dist/features/magic-context/memory/embedding-openai.d.ts +5 -0
- package/dist/features/magic-context/memory/embedding-openai.d.ts.map +1 -1
- package/dist/features/magic-context/memory/embedding-provider.d.ts +3 -0
- package/dist/features/magic-context/memory/embedding-provider.d.ts.map +1 -1
- package/dist/features/magic-context/migrations.d.ts.map +1 -1
- package/dist/features/magic-context/mural/compress-cues.d.ts +3 -2
- package/dist/features/magic-context/mural/compress-cues.d.ts.map +1 -1
- package/dist/features/magic-context/project-embedding-registry.d.ts +2 -0
- package/dist/features/magic-context/project-embedding-registry.d.ts.map +1 -1
- package/dist/features/magic-context/smart-notes/compiler.d.ts +3 -2
- package/dist/features/magic-context/smart-notes/compiler.d.ts.map +1 -1
- package/dist/features/magic-context/smart-notes/condition-compiler.d.ts +2 -0
- package/dist/features/magic-context/smart-notes/condition-compiler.d.ts.map +1 -1
- package/dist/features/magic-context/smart-notes/sandbox-runner.d.ts.map +1 -1
- package/dist/features/magic-context/storage-db.d.ts +2 -2
- package/dist/features/magic-context/storage-db.d.ts.map +1 -1
- package/dist/features/magic-context/storage-meta-persisted.d.ts +7 -2
- package/dist/features/magic-context/storage-meta-persisted.d.ts.map +1 -1
- package/dist/features/magic-context/storage-meta-shared.d.ts +1 -0
- package/dist/features/magic-context/storage-meta-shared.d.ts.map +1 -1
- package/dist/features/magic-context/storage-meta.d.ts +1 -1
- package/dist/features/magic-context/storage-meta.d.ts.map +1 -1
- package/dist/features/magic-context/storage-session-tables.d.ts.map +1 -1
- package/dist/features/magic-context/storage-tags.d.ts.map +1 -1
- package/dist/features/magic-context/storage.d.ts +1 -1
- package/dist/features/magic-context/storage.d.ts.map +1 -1
- package/dist/features/magic-context/tool-definition-tokens.d.ts +10 -0
- package/dist/features/magic-context/tool-definition-tokens.d.ts.map +1 -1
- package/dist/features/magic-context/transform-decision-log.d.ts +11 -0
- package/dist/features/magic-context/transform-decision-log.d.ts.map +1 -1
- package/dist/features/magic-context/user-memory/review-user-memories.d.ts +3 -2
- package/dist/features/magic-context/user-memory/review-user-memories.d.ts.map +1 -1
- package/dist/hooks/magic-context/channel2-delivery.d.ts +3 -1
- package/dist/hooks/magic-context/channel2-delivery.d.ts.map +1 -1
- package/dist/hooks/magic-context/command-handler.d.ts +4 -0
- package/dist/hooks/magic-context/command-handler.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-runner-historian.d.ts +4 -1
- package/dist/hooks/magic-context/compartment-runner-historian.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-runner-partial-recomp.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-runner-recomp.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-runner-types.d.ts +4 -1
- package/dist/hooks/magic-context/compartment-runner-types.d.ts.map +1 -1
- package/dist/hooks/magic-context/ctx-reduce-nudge.d.ts +14 -2
- package/dist/hooks/magic-context/ctx-reduce-nudge.d.ts.map +1 -1
- package/dist/hooks/magic-context/emergency-fail-closed.d.ts +7 -0
- package/dist/hooks/magic-context/emergency-fail-closed.d.ts.map +1 -1
- package/dist/hooks/magic-context/format-embed-failure.d.ts +3 -0
- package/dist/hooks/magic-context/format-embed-failure.d.ts.map +1 -0
- package/dist/hooks/magic-context/hook-handlers.d.ts.map +1 -1
- package/dist/hooks/magic-context/hook.d.ts.map +1 -1
- package/dist/hooks/magic-context/inject-compartments.d.ts +13 -1
- package/dist/hooks/magic-context/inject-compartments.d.ts.map +1 -1
- package/dist/hooks/magic-context/lkg-persist.d.ts +14 -0
- package/dist/hooks/magic-context/lkg-persist.d.ts.map +1 -0
- package/dist/hooks/magic-context/lkg-slot.d.ts +13 -0
- package/dist/hooks/magic-context/lkg-slot.d.ts.map +1 -1
- package/dist/hooks/magic-context/module-state-sync.d.ts +1 -0
- package/dist/hooks/magic-context/module-state-sync.d.ts.map +1 -1
- package/dist/hooks/magic-context/module-transport.d.ts +12 -0
- package/dist/hooks/magic-context/module-transport.d.ts.map +1 -1
- package/dist/hooks/magic-context/raw-fallback-context-limit.d.ts.map +1 -1
- package/dist/hooks/magic-context/recomp-orchestrator.d.ts +4 -1
- package/dist/hooks/magic-context/recomp-orchestrator.d.ts.map +1 -1
- package/dist/hooks/magic-context/rust-mode-transform.d.ts.map +1 -1
- package/dist/hooks/magic-context/strip-content.d.ts +6 -0
- package/dist/hooks/magic-context/strip-content.d.ts.map +1 -1
- package/dist/hooks/magic-context/tail-hygiene-walk.d.ts +12 -0
- package/dist/hooks/magic-context/tail-hygiene-walk.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform-compartment-phase.d.ts +3 -1
- package/dist/hooks/magic-context/transform-compartment-phase.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform-postprocess-phase.d.ts +5 -0
- package/dist/hooks/magic-context/transform-postprocess-phase.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform.d.ts +9 -1
- package/dist/hooks/magic-context/transform.d.ts.map +1 -1
- package/dist/hooks/magic-context/wrapup-orchestrator.d.ts.map +1 -1
- package/dist/{index-2y0ybv5x.js → index-3dkzzh0t.js} +15 -17
- package/dist/{index-5znjkjws.js → index-axpym70t.js} +879 -170
- package/dist/index-ehpzdy0v.js +126 -0
- package/dist/{index-22mw8km4.js → index-rw0qrkvq.js} +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +18466 -16177
- package/dist/model-resolution-r9jbcz86.js +15 -0
- package/dist/plugin/dream-timer.d.ts +3 -0
- package/dist/plugin/dream-timer.d.ts.map +1 -1
- package/dist/plugin/hooks/create-session-hooks.d.ts +2 -0
- package/dist/plugin/hooks/create-session-hooks.d.ts.map +1 -1
- package/dist/plugin/messages-transform.d.ts +14 -6
- package/dist/plugin/messages-transform.d.ts.map +1 -1
- package/dist/plugin/rpc-handlers.d.ts.map +1 -1
- package/dist/{recomp-orchestrator-p030kxtc.js → recomp-orchestrator-dmyvqekw.js} +2 -3
- package/dist/shared/jsonc-edit.d.ts +6 -1
- package/dist/shared/jsonc-edit.d.ts.map +1 -1
- package/dist/shared/model-resolution.d.ts +53 -0
- package/dist/shared/model-resolution.d.ts.map +1 -0
- package/dist/shared/model-suggestion-retry.d.ts +4 -1
- package/dist/shared/model-suggestion-retry.d.ts.map +1 -1
- package/dist/shared/resolve-fallbacks.d.ts +5 -1
- package/dist/shared/resolve-fallbacks.d.ts.map +1 -1
- package/dist/shared/rpc-types.d.ts +2 -0
- package/dist/shared/rpc-types.d.ts.map +1 -1
- package/dist/shared/rpc-utils.d.ts +12 -1
- package/dist/shared/rpc-utils.d.ts.map +1 -1
- package/dist/shared/status-detail-text.d.ts +4 -0
- package/dist/shared/status-detail-text.d.ts.map +1 -0
- package/dist/shared/subagent-runner.d.ts +2 -1
- package/dist/shared/subagent-runner.d.ts.map +1 -1
- package/dist/{storage-meta-session-2306t3j7.js → storage-meta-session-yvtbaw7c.js} +1 -1
- package/dist/{task-config-at3adc59.js → task-config-a1qmj9bx.js} +2 -2
- package/dist/tui/data/context-db.d.ts.map +1 -1
- package/dist/tui-compiled/data/context-db.d.ts.map +1 -1
- package/package.json +4 -2
- package/src/config/index.test.ts +434 -19
- package/src/config/index.ts +67 -33
- package/src/config/profiles.ts +106 -0
- package/src/config/project-security.hostile-matrix.test.ts +480 -0
- package/src/config/project-security.test.ts +43 -5
- package/src/config/project-security.ts +151 -22
- package/src/config/raw-loader.test.ts +424 -0
- package/src/config/raw-loader.ts +490 -0
- package/src/config/schema/magic-context.test.ts +272 -2
- package/src/config/schema/magic-context.ts +342 -49
- package/src/shared/jsonc-edit.ts +74 -1
- package/src/shared/model-resolution.test.ts +170 -0
- package/src/shared/model-resolution.ts +227 -0
- package/src/shared/model-suggestion-retry.test.ts +27 -0
- package/src/shared/model-suggestion-retry.ts +19 -10
- package/src/shared/resolve-fallbacks.test.ts +13 -1
- package/src/shared/resolve-fallbacks.ts +19 -4
- package/src/shared/rpc-types.ts +2 -0
- package/src/shared/rpc-utils.test.ts +32 -0
- package/src/shared/rpc-utils.ts +38 -13
- package/src/shared/status-detail-text.test.ts +82 -0
- package/src/shared/status-detail-text.ts +57 -0
- package/src/shared/subagent-runner.ts +3 -1
- package/src/tui/data/context-db.ts +1 -0
- package/src/tui-compiled/data/context-db.ts +1 -0
- package/dist/index-td9depx5.js +0 -46
- package/dist/resolve-fallbacks-qf0ekmz9.js +0 -11
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
DEFAULT_LOCAL_EMBEDDING_MODEL,
|
|
6
6
|
type MagicContextConfig,
|
|
7
7
|
MagicContextConfigSchema,
|
|
8
|
+
PER_HARNESS_MIGRATION_INVENTORY,
|
|
8
9
|
} from "./magic-context";
|
|
9
10
|
|
|
10
11
|
describe("MagicContextConfigSchema", () => {
|
|
@@ -215,8 +216,10 @@ describe("MagicContextConfigSchema", () => {
|
|
|
215
216
|
expect(result.dreamer?.tasks.retrospective.schedule).toBe("0 5 * * *");
|
|
216
217
|
});
|
|
217
218
|
|
|
218
|
-
it("defaults classify-memories and retrospective on daily in dreamer task
|
|
219
|
-
const result = MagicContextConfigSchema.parse({
|
|
219
|
+
it("defaults classify-memories and retrospective on daily in dreamer task metadata", () => {
|
|
220
|
+
const result = MagicContextConfigSchema.parse({
|
|
221
|
+
dreamer: { opencode: { model: "x/y" } },
|
|
222
|
+
});
|
|
220
223
|
expect(result.dreamer?.tasks["classify-memories"].schedule).toBe("0 6 * * *");
|
|
221
224
|
expect(result.dreamer?.tasks.retrospective.schedule).toBe("0 5 * * *");
|
|
222
225
|
});
|
|
@@ -282,6 +285,273 @@ describe("MagicContextConfigSchema", () => {
|
|
|
282
285
|
});
|
|
283
286
|
});
|
|
284
287
|
|
|
288
|
+
describe("config profiles", () => {
|
|
289
|
+
it("admits model-selection fields and preserves per-entry harness qualifiers", () => {
|
|
290
|
+
const result = MagicContextConfigSchema.parse({
|
|
291
|
+
profile: "work",
|
|
292
|
+
profiles: {
|
|
293
|
+
work: {
|
|
294
|
+
historian: {
|
|
295
|
+
opencode: {
|
|
296
|
+
model: { model: "anthropic/work-historian", variant: "high" },
|
|
297
|
+
fallback_models: [
|
|
298
|
+
{ model: "openai/work-fallback", variant: "low" },
|
|
299
|
+
],
|
|
300
|
+
variant: "high",
|
|
301
|
+
},
|
|
302
|
+
pi: {
|
|
303
|
+
model: {
|
|
304
|
+
model: "github-copilot/work-historian",
|
|
305
|
+
thinking_level: "high",
|
|
306
|
+
},
|
|
307
|
+
thinking_level: "high",
|
|
308
|
+
},
|
|
309
|
+
},
|
|
310
|
+
dreamer: {
|
|
311
|
+
opencode: {
|
|
312
|
+
model: { model: "anthropic/work-dreamer", variant: "medium" },
|
|
313
|
+
fallback_models: [
|
|
314
|
+
{ model: "openai/work-dreamer-fallback", variant: "low" },
|
|
315
|
+
],
|
|
316
|
+
variant: "medium",
|
|
317
|
+
},
|
|
318
|
+
pi: {
|
|
319
|
+
model: {
|
|
320
|
+
model: "github-copilot/work-dreamer",
|
|
321
|
+
thinking_level: "high",
|
|
322
|
+
},
|
|
323
|
+
fallback_models: [
|
|
324
|
+
{
|
|
325
|
+
model: "openai/work-dreamer-fallback",
|
|
326
|
+
thinking_level: "minimal",
|
|
327
|
+
},
|
|
328
|
+
],
|
|
329
|
+
thinking_level: "high",
|
|
330
|
+
},
|
|
331
|
+
},
|
|
332
|
+
sidekick: {
|
|
333
|
+
model: "anthropic/work-sidekick",
|
|
334
|
+
fallback_models: ["openai/work-sidekick-fallback"],
|
|
335
|
+
},
|
|
336
|
+
},
|
|
337
|
+
},
|
|
338
|
+
});
|
|
339
|
+
|
|
340
|
+
expect(result.profiles?.work?.historian?.opencode?.fallback_models).toEqual([
|
|
341
|
+
{ model: "openai/work-fallback", variant: "low" },
|
|
342
|
+
]);
|
|
343
|
+
expect(result.profiles?.work?.dreamer?.opencode).toEqual({
|
|
344
|
+
model: { model: "anthropic/work-dreamer", variant: "medium" },
|
|
345
|
+
fallback_models: [{ model: "openai/work-dreamer-fallback", variant: "low" }],
|
|
346
|
+
variant: "medium",
|
|
347
|
+
});
|
|
348
|
+
expect(result.profiles?.work?.dreamer?.pi?.fallback_models).toEqual([
|
|
349
|
+
{ model: "openai/work-dreamer-fallback", thinking_level: "minimal" },
|
|
350
|
+
]);
|
|
351
|
+
expect(result.profiles?.work?.sidekick?.model).toBe("anthropic/work-sidekick");
|
|
352
|
+
});
|
|
353
|
+
|
|
354
|
+
it("rejects timeout_minutes in a dreamer profile", () => {
|
|
355
|
+
const profiles = {
|
|
356
|
+
work: {
|
|
357
|
+
dreamer: {
|
|
358
|
+
opencode: {
|
|
359
|
+
tasks: { verify: { timeout_minutes: 30 } },
|
|
360
|
+
},
|
|
361
|
+
},
|
|
362
|
+
},
|
|
363
|
+
};
|
|
364
|
+
|
|
365
|
+
expect(MagicContextConfigSchema.safeParse({ profiles }).success).toBe(false);
|
|
366
|
+
});
|
|
367
|
+
|
|
368
|
+
it("rejects task execution and every other non-model field class in profiles", () => {
|
|
369
|
+
const profilesWithExcludedFields = [
|
|
370
|
+
{ work: { embedding: { provider: "off" } } },
|
|
371
|
+
{ work: { historian: { two_pass: true } } },
|
|
372
|
+
{ work: { historian: { opencode: { prompt: "override" } } } },
|
|
373
|
+
{ work: { dreamer: { opencode: { tasks: {} } } } },
|
|
374
|
+
{
|
|
375
|
+
work: {
|
|
376
|
+
dreamer: {
|
|
377
|
+
opencode: {
|
|
378
|
+
tasks: {
|
|
379
|
+
verify: {
|
|
380
|
+
model: "anthropic/task-model",
|
|
381
|
+
fallback_models: ["openai/task-fallback"],
|
|
382
|
+
variant: "high",
|
|
383
|
+
timeout_minutes: 30,
|
|
384
|
+
},
|
|
385
|
+
},
|
|
386
|
+
},
|
|
387
|
+
},
|
|
388
|
+
},
|
|
389
|
+
},
|
|
390
|
+
{
|
|
391
|
+
work: {
|
|
392
|
+
dreamer: {
|
|
393
|
+
pi: {
|
|
394
|
+
tasks: {
|
|
395
|
+
verify: {
|
|
396
|
+
model: "github-copilot/task-model",
|
|
397
|
+
fallback_models: ["openai/task-fallback"],
|
|
398
|
+
thinking_level: "high",
|
|
399
|
+
timeout_minutes: 30,
|
|
400
|
+
},
|
|
401
|
+
},
|
|
402
|
+
},
|
|
403
|
+
},
|
|
404
|
+
},
|
|
405
|
+
},
|
|
406
|
+
{ work: { dreamer: { tasks: { verify: { schedule: "0 3 * * *" } } } } },
|
|
407
|
+
{ work: { sidekick: { timeout_ms: 60_000 } } },
|
|
408
|
+
];
|
|
409
|
+
|
|
410
|
+
for (const profiles of profilesWithExcludedFields) {
|
|
411
|
+
expect(MagicContextConfigSchema.safeParse({ profiles }).success).toBe(false);
|
|
412
|
+
}
|
|
413
|
+
});
|
|
414
|
+
});
|
|
415
|
+
|
|
416
|
+
describe("per-harness model configuration", () => {
|
|
417
|
+
it("keeps the migration inventory exhaustive and field-specific", () => {
|
|
418
|
+
expect(PER_HARNESS_MIGRATION_INVENTORY).toEqual({
|
|
419
|
+
historian: {
|
|
420
|
+
retained: [
|
|
421
|
+
"temperature",
|
|
422
|
+
"top_p",
|
|
423
|
+
"prompt",
|
|
424
|
+
"tools",
|
|
425
|
+
"disable",
|
|
426
|
+
"description",
|
|
427
|
+
"mode",
|
|
428
|
+
"color",
|
|
429
|
+
"maxSteps",
|
|
430
|
+
"permission",
|
|
431
|
+
"maxTokens",
|
|
432
|
+
"two_pass",
|
|
433
|
+
"disallowed_tools",
|
|
434
|
+
],
|
|
435
|
+
migrated_execution: ["model", "fallback_models", "variant", "thinking_level"],
|
|
436
|
+
},
|
|
437
|
+
dreamer: {
|
|
438
|
+
retained: [
|
|
439
|
+
"temperature",
|
|
440
|
+
"top_p",
|
|
441
|
+
"prompt",
|
|
442
|
+
"tools",
|
|
443
|
+
"disable",
|
|
444
|
+
"description",
|
|
445
|
+
"mode",
|
|
446
|
+
"color",
|
|
447
|
+
"maxSteps",
|
|
448
|
+
"permission",
|
|
449
|
+
"maxTokens",
|
|
450
|
+
"inject_docs",
|
|
451
|
+
],
|
|
452
|
+
migrated_execution: ["model", "fallback_models", "variant", "thinking_level"],
|
|
453
|
+
},
|
|
454
|
+
task: {
|
|
455
|
+
retained: ["schedule", "promotion_threshold"],
|
|
456
|
+
migrated_execution: [
|
|
457
|
+
"model",
|
|
458
|
+
"fallback_models",
|
|
459
|
+
"variant",
|
|
460
|
+
"thinking_level",
|
|
461
|
+
"timeout_minutes",
|
|
462
|
+
],
|
|
463
|
+
},
|
|
464
|
+
});
|
|
465
|
+
});
|
|
466
|
+
|
|
467
|
+
it("keeps agent and task metadata separate from strict harness execution blocks", () => {
|
|
468
|
+
const result = MagicContextConfigSchema.parse({
|
|
469
|
+
historian: {
|
|
470
|
+
disable: false,
|
|
471
|
+
two_pass: true,
|
|
472
|
+
disallowed_tools: ["read"],
|
|
473
|
+
opencode: {
|
|
474
|
+
model: { model: "anthropic/claude-sonnet-4-6", variant: "high" },
|
|
475
|
+
fallback_models: ["openai/gpt-5.4"],
|
|
476
|
+
variant: "medium",
|
|
477
|
+
},
|
|
478
|
+
pi: {
|
|
479
|
+
model: {
|
|
480
|
+
model: "github-copilot/gpt-5.4",
|
|
481
|
+
thinking_level: "high",
|
|
482
|
+
},
|
|
483
|
+
fallback_models: ["openai/gpt-5.4"],
|
|
484
|
+
thinking_level: "medium",
|
|
485
|
+
},
|
|
486
|
+
},
|
|
487
|
+
dreamer: {
|
|
488
|
+
disable: false,
|
|
489
|
+
inject_docs: false,
|
|
490
|
+
tasks: {
|
|
491
|
+
"review-user-memories": {
|
|
492
|
+
schedule: "0 3 * * *",
|
|
493
|
+
promotion_threshold: 4,
|
|
494
|
+
},
|
|
495
|
+
},
|
|
496
|
+
opencode: {
|
|
497
|
+
model: "anthropic/claude-sonnet-4-6",
|
|
498
|
+
fallback_models: [{ model: "openai/gpt-5.4", variant: "low" }],
|
|
499
|
+
tasks: {
|
|
500
|
+
verify: {
|
|
501
|
+
model: "anthropic/claude-haiku-4-5",
|
|
502
|
+
fallback_models: ["openai/gpt-5.4"],
|
|
503
|
+
variant: "medium",
|
|
504
|
+
timeout_minutes: 30,
|
|
505
|
+
},
|
|
506
|
+
},
|
|
507
|
+
},
|
|
508
|
+
pi: {
|
|
509
|
+
model: "github-copilot/gpt-5.4",
|
|
510
|
+
fallback_models: [{ model: "openai/gpt-5.4", thinking_level: "minimal" }],
|
|
511
|
+
tasks: {
|
|
512
|
+
verify: {
|
|
513
|
+
model: "github-copilot/gpt-5.4",
|
|
514
|
+
fallback_models: ["openai/gpt-5.4"],
|
|
515
|
+
thinking_level: "high",
|
|
516
|
+
timeout_minutes: 30,
|
|
517
|
+
},
|
|
518
|
+
},
|
|
519
|
+
},
|
|
520
|
+
},
|
|
521
|
+
});
|
|
522
|
+
|
|
523
|
+
expect(result.historian?.opencode?.fallback_models).toEqual(["openai/gpt-5.4"]);
|
|
524
|
+
expect(result.dreamer?.tasks["review-user-memories"]).toEqual({
|
|
525
|
+
schedule: "0 3 * * *",
|
|
526
|
+
promotion_threshold: 4,
|
|
527
|
+
});
|
|
528
|
+
expect(result.dreamer?.opencode?.tasks?.verify?.timeout_minutes).toBe(30);
|
|
529
|
+
});
|
|
530
|
+
|
|
531
|
+
it("rejects cross-harness vocabulary, non-array fallbacks, and execution fields at metadata depth", () => {
|
|
532
|
+
const invalidConfigs = [
|
|
533
|
+
{ historian: { opencode: { thinking_level: "high" } } },
|
|
534
|
+
{ historian: { pi: { variant: "high" } } },
|
|
535
|
+
{
|
|
536
|
+
dreamer: {
|
|
537
|
+
opencode: { tasks: { verify: { thinking_level: "high" } } },
|
|
538
|
+
},
|
|
539
|
+
},
|
|
540
|
+
{
|
|
541
|
+
dreamer: {
|
|
542
|
+
pi: { tasks: { verify: { variant: "high" } } },
|
|
543
|
+
},
|
|
544
|
+
},
|
|
545
|
+
{ historian: { opencode: { fallback_models: "anthropic/claude-sonnet-4-6" } } },
|
|
546
|
+
{ dreamer: { tasks: { verify: { model: "anthropic/claude-sonnet-4-6" } } } },
|
|
547
|
+
];
|
|
548
|
+
|
|
549
|
+
for (const config of invalidConfigs) {
|
|
550
|
+
expect(MagicContextConfigSchema.safeParse(config).success).toBe(false);
|
|
551
|
+
}
|
|
552
|
+
});
|
|
553
|
+
});
|
|
554
|
+
|
|
285
555
|
describe("validation", () => {
|
|
286
556
|
it("rejects an unknown transform mode", () => {
|
|
287
557
|
expect(() => MagicContextConfigSchema.parse({ transform_mode: "wasm" })).toThrow();
|