spawnfile 0.1.34 → 0.1.35

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 (87) hide show
  1. package/dist/audit/readAudit.d.ts +3 -3
  2. package/dist/auth/profileStore.d.ts +3 -1
  3. package/dist/auth/profileStore.js +31 -30
  4. package/dist/auth/types.d.ts +16 -0
  5. package/dist/cli/authCommands.d.ts +1 -1
  6. package/dist/cli/authCommands.js +21 -1
  7. package/dist/cli/runCli.d.ts +2 -0
  8. package/dist/cli/runCli.js +2 -1
  9. package/dist/cli/trainingBooted.d.ts +2 -0
  10. package/dist/cli/trainingBooted.js +5 -1
  11. package/dist/compiler/containerDaimonBrokerRender.js +12 -2
  12. package/dist/compiler/containerDaimonGatewayRender.js +4 -0
  13. package/dist/compiler/containerDaimonUidEntrypointRender.js +3 -1
  14. package/dist/compiler/runProject.d.ts +2 -0
  15. package/dist/compiler/runProject.js +6 -5
  16. package/dist/compiler/runProjectAuth.js +4 -1
  17. package/dist/compiler/training/rewind/contract.d.ts +6 -6
  18. package/dist/compiler/training/trial/boot.d.ts +20 -1
  19. package/dist/compiler/training/trial/boot.js +102 -24
  20. package/dist/compiler/training/trial/docker.d.ts +2 -0
  21. package/dist/compiler/training/trial/docker.js +1 -1
  22. package/dist/compiler/training/trial/gateway.d.ts +5 -0
  23. package/dist/compiler/training/trial/gateway.js +18 -3
  24. package/dist/compiler/training/trial/homeLogin.d.ts +31 -0
  25. package/dist/compiler/training/trial/homeLogin.js +69 -0
  26. package/dist/compiler/training/trial/index.d.ts +5 -1
  27. package/dist/compiler/training/trial/index.js +5 -1
  28. package/dist/compiler/training/trial/judge.d.ts +15 -0
  29. package/dist/compiler/training/trial/judge.js +42 -0
  30. package/dist/compiler/training/trial/launcher.d.ts +28 -13
  31. package/dist/compiler/training/trial/launcher.js +168 -24
  32. package/dist/compiler/training/trial/login.d.ts +35 -0
  33. package/dist/compiler/training/trial/login.js +85 -0
  34. package/dist/compiler/training/trial/realmTurns.d.ts +20 -0
  35. package/dist/compiler/training/trial/realmTurns.js +69 -0
  36. package/dist/manifest/renderSpawnfile.js +2 -1
  37. package/dist/runtime/daimon/config.js +3 -3
  38. package/dist/runtime/daimon/engineDescriptors.generated.d.ts +1 -1
  39. package/dist/runtime/daimon/engineDescriptors.generated.js +1 -1
  40. package/dist/runtime/daimon/index.d.ts +1 -1
  41. package/dist/runtime/daimon/index.js +1 -1
  42. package/dist/runtime/daimon/runAuth.js +8 -0
  43. package/dist/runtime/daimon/subscriptionRealms.d.ts +18 -0
  44. package/dist/runtime/daimon/subscriptionRealms.js +14 -1
  45. package/dist/runtime/daimon/training/booted/adapter.d.ts +5 -1
  46. package/dist/runtime/daimon/training/booted/adapter.js +3 -2
  47. package/dist/runtime/daimon/training/booted/adapter.js.map +1 -1
  48. package/dist/runtime/daimon/training/booted/index.d.ts +3 -1
  49. package/dist/runtime/daimon/training/booted/index.js +2 -1
  50. package/dist/runtime/daimon/training/booted/index.js.map +1 -1
  51. package/dist/runtime/daimon/training/booted/judge.d.ts +39 -0
  52. package/dist/runtime/daimon/training/booted/judge.js +122 -0
  53. package/dist/runtime/daimon/training/booted/judge.js.map +1 -0
  54. package/dist/runtime/trainingGraderProviders.js +10 -4
  55. package/dist/runtime/trainingProviders.d.ts +4 -1
  56. package/dist/runtime/trainingProviders.js +13 -6
  57. package/dist/runtime/usageRequestLedger.d.ts +2 -0
  58. package/dist/runtime/usageRequestLedger.js +3 -1
  59. package/dist/shared/trainingLegacy/trainingLegacyHashDomains.d.ts +1 -0
  60. package/dist/shared/trainingLegacy/trainingLegacyHashDomains.js +1 -0
  61. package/dist/shared/trainingLegacy/trainingLegacyHashDomains.js.map +1 -1
  62. package/package.json +1 -1
  63. package/runtimes.yaml +5 -5
  64. package/dist/runtime/daimon/training/providers/codex-subscription/index.d.ts +0 -1
  65. package/dist/runtime/daimon/training/providers/codex-subscription/index.js +0 -2
  66. package/dist/runtime/daimon/training/providers/codex-subscription/index.js.map +0 -1
  67. package/dist/runtime/daimon/training/providers/codex-subscription/protocol.d.ts +0 -17
  68. package/dist/runtime/daimon/training/providers/codex-subscription/protocol.js +0 -80
  69. package/dist/runtime/daimon/training/providers/codex-subscription/protocol.js.map +0 -1
  70. package/dist/runtime/daimon/training/providers/codex-subscription/provider.d.ts +0 -12
  71. package/dist/runtime/daimon/training/providers/codex-subscription/provider.js +0 -125
  72. package/dist/runtime/daimon/training/providers/codex-subscription/provider.js.map +0 -1
  73. package/dist/runtime/daimon/training/providers/codex-subscription/strict-schema.d.ts +0 -6
  74. package/dist/runtime/daimon/training/providers/codex-subscription/strict-schema.js +0 -219
  75. package/dist/runtime/daimon/training/providers/codex-subscription/strict-schema.js.map +0 -1
  76. package/dist/runtime/daimon/training/providers/grok-subscription/cli.d.ts +0 -19
  77. package/dist/runtime/daimon/training/providers/grok-subscription/cli.js +0 -81
  78. package/dist/runtime/daimon/training/providers/grok-subscription/cli.js.map +0 -1
  79. package/dist/runtime/daimon/training/providers/grok-subscription/index.d.ts +0 -3
  80. package/dist/runtime/daimon/training/providers/grok-subscription/index.js +0 -4
  81. package/dist/runtime/daimon/training/providers/grok-subscription/index.js.map +0 -1
  82. package/dist/runtime/daimon/training/providers/grok-subscription/protocol.d.ts +0 -14
  83. package/dist/runtime/daimon/training/providers/grok-subscription/protocol.js +0 -89
  84. package/dist/runtime/daimon/training/providers/grok-subscription/protocol.js.map +0 -1
  85. package/dist/runtime/daimon/training/providers/grok-subscription/provider.d.ts +0 -9
  86. package/dist/runtime/daimon/training/providers/grok-subscription/provider.js +0 -37
  87. package/dist/runtime/daimon/training/providers/grok-subscription/provider.js.map +0 -1
@@ -1,6 +1,7 @@
1
1
  export const BOOTED_ADAPTER_ID = 'daimon-booted';
2
2
  export const BOOTED_EVIDENCE_SCHEMA = 'spawnfile.training.daimon-booted.wake.v1';
3
- const usageOf = (rows) => rows.length === 0 ? null : {
3
+ /** Ledger rows to `Usage`; no rows means unmetered, never zero. */
4
+ export const bootedUsage = (rows) => rows.length === 0 ? null : {
4
5
  inputTokens: rows.reduce((sum, row) => sum + row.input, 0),
5
6
  cachedInputTokens: rows.reduce((sum, row) => sum + row.cache_read, 0),
6
7
  outputTokens: rows.reduce((sum, row) => sum + row.output, 0),
@@ -32,7 +33,7 @@ export function createDaimonBootedAdapter(options) {
32
33
  if (stopped)
33
34
  throw new Error('trial organization was already stopped');
34
35
  const wake = await trial.wake(turn.text, { deliveryId: `${input.trialId}:${turn.id}`, timeoutMs: options.timeoutMs, signal: signal ?? input.signal });
35
- const usage = usageOf(wake.usage);
36
+ const usage = bootedUsage(wake.usage);
36
37
  if (wake.text)
37
38
  await emit(turn.id, { type: 'output', text: wake.text });
38
39
  if (usage)
@@ -1 +1 @@
1
- {"version":3,"file":"adapter.js","sourceRoot":"","sources":["../../../../../src/runtime/daimon/training/booted/adapter.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,iBAAiB,GAAG,eAAe,CAAC;AACjD,MAAM,CAAC,MAAM,sBAAsB,GAAG,0CAA0C,CAAC;AA2BjF,MAAM,OAAO,GAAG,CAAC,IAA+B,EAAgB,EAAE,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;IAC5F,WAAW,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC,GAAG,GAAG,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC;IAC1D,iBAAiB,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC,GAAG,GAAG,GAAG,CAAC,UAAU,EAAE,CAAC,CAAC;IACrE,YAAY,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC,GAAG,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC;IAC5D,eAAe,EAAE,IAAI;IACrB,WAAW,EAAE,I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C,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,cAAc,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC;qBAC9G,CAAC;gBACJ,CAAC;aACF,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -1,2 +1,4 @@
1
- export { BOOTED_ADAPTER_ID, BOOTED_EVIDENCE_SCHEMA, createDaimonBootedAdapter } from './adapter.js';
1
+ export { BOOTED_ADAPTER_ID, BOOTED_EVIDENCE_SCHEMA, bootedUsage, createDaimonBootedAdapter } from './adapter.js';
2
2
  export type { BootedAdapterOptions, BootedTrialHandle, BootedTrialLauncher, BootedUsageRow, BootedWake } from './adapter.js';
3
+ export { bindBootedJudges, createBootedJudgeInference, transcriptToolActivity } from './judge.js';
4
+ export type { BootedJudgeLauncher, BootedJudgeOptions, BootedJudgeSpec } from './judge.js';
@@ -1,2 +1,3 @@
1
- export { BOOTED_ADAPTER_ID, BOOTED_EVIDENCE_SCHEMA, createDaimonBootedAdapter } from './adapter.js';
1
+ export { BOOTED_ADAPTER_ID, BOOTED_EVIDENCE_SCHEMA, bootedUsage, createDaimonBootedAdapter } from './adapter.js';
2
+ export { bindBootedJudges, createBootedJudgeInference, transcriptToolActivity } from './judge.js';
2
3
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/runtime/daimon/training/booted/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/runtime/daimon/training/booted/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,WAAW,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAC;AAEjH,OAAO,EAAE,gBAAgB,EAAE,0BAA0B,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC"}
@@ -0,0 +1,39 @@
1
+ import type { InferenceProvider } from '../../../../training/index.js';
2
+ import { type BootedWake } from './adapter.js';
3
+ /** One judge identity: the engine, and the model and effort its compiled organization pins. */
4
+ export interface BootedJudgeSpec {
5
+ engine: string;
6
+ model: string;
7
+ effort?: string;
8
+ }
9
+ /** The run's warm judges: one booted container per judge identity, woken once per judgment. */
10
+ export interface BootedJudgeLauncher {
11
+ judge(spec: BootedJudgeSpec): Promise<{
12
+ wake(text: string, options: {
13
+ deliveryId: string;
14
+ timeoutMs: number;
15
+ signal?: AbortSignal;
16
+ }): Promise<BootedWake>;
17
+ }>;
18
+ }
19
+ /**
20
+ * Composition binds the training run's judge launcher for the run's duration
21
+ * (`spawnfile train` runs one run per process). Providers resolve it per
22
+ * judgment, so grader and model registries stay static data.
23
+ */
24
+ export declare function bindBootedJudges(launcher: BootedJudgeLauncher | undefined): void;
25
+ export interface BootedJudgeOptions {
26
+ engine: string;
27
+ effort?: string;
28
+ timeoutMs?: number;
29
+ }
30
+ export declare function transcriptToolActivity(transcript: string): string[];
31
+ /**
32
+ * The one subscription inference path of a training run: each judgment is
33
+ * one wake of the run's warm, tool-free judge organization for this engine,
34
+ * whose login lives only in the run's auth gateway (or the engine's own
35
+ * realm). The reply is validated against the requested schema after the
36
+ * wake. A wake whose transcript or per-request tool record shows any tool
37
+ * activity is refused, and so is one that left no evidence either way.
38
+ */
39
+ export declare function createBootedJudgeInference(options: BootedJudgeOptions): InferenceProvider;
@@ -0,0 +1,122 @@
1
+ import { randomUUID } from 'node:crypto';
2
+ import { InferenceFailure, validateInferenceResponse, validateInferenceSchema } from '../../../../training/index.js';
3
+ import { bootedUsage } from './adapter.js';
4
+ let bound;
5
+ /**
6
+ * Composition binds the training run's judge launcher for the run's duration
7
+ * (`spawnfile train` runs one run per process). Providers resolve it per
8
+ * judgment, so grader and model registries stay static data.
9
+ */
10
+ export function bindBootedJudges(launcher) { bound = launcher; }
11
+ /**
12
+ * Structured records of a wake transcript that are not a message or
13
+ * reasoning: any other item kind is tool activity, including future native
14
+ * tool families. Engine-neutral: it reads record and item kinds only.
15
+ */
16
+ const TEXT_KINDS = /^(message|reasoning|agent_message|agent_reasoning|user_message|text|thinking)$/u;
17
+ const TOOL_KINDS = /tool|function|shell|exec|command|mcp|web_search|patch|file_change|search_tool|use_tool|call/iu;
18
+ export function transcriptToolActivity(transcript) {
19
+ const found = new Set();
20
+ for (const line of transcript.split('\n')) {
21
+ if (!line.trim())
22
+ continue;
23
+ let record;
24
+ try {
25
+ record = JSON.parse(line);
26
+ }
27
+ catch {
28
+ found.add('unparseable-record');
29
+ continue;
30
+ }
31
+ if (record === null || typeof record !== 'object')
32
+ continue;
33
+ const visit = (value, depth) => {
34
+ if (depth > 3 || value === null || typeof value !== 'object' || Array.isArray(value))
35
+ return;
36
+ const entry = value;
37
+ const kind = entry['type'];
38
+ if (typeof kind === 'string' && !TEXT_KINDS.test(kind) && TOOL_KINDS.test(kind))
39
+ found.add(kind);
40
+ for (const key of ['payload', 'item', 'message', 'content']) {
41
+ const nested = entry[key];
42
+ if (Array.isArray(nested))
43
+ nested.forEach(child => visit(child, depth + 1));
44
+ else
45
+ visit(nested, depth + 1);
46
+ }
47
+ };
48
+ visit(record, 0);
49
+ }
50
+ return [...found].sort();
51
+ }
52
+ function wakeFailure(wake) {
53
+ if (wake.state === 'timeout')
54
+ return 'timeout';
55
+ if (wake.state === 'stopped')
56
+ return 'cancelled';
57
+ const evidence = `${wake.code ?? ''} ${wake.text}`;
58
+ if (/auth_stale|unauthorized|authentication|sign in|login|401|403/iu.test(evidence))
59
+ return 'authentication';
60
+ if (/quota|usage limit|rate limit|429|402/iu.test(evidence))
61
+ return 'quota';
62
+ return 'unavailable';
63
+ }
64
+ /**
65
+ * The one subscription inference path of a training run: each judgment is
66
+ * one wake of the run's warm, tool-free judge organization for this engine,
67
+ * whose login lives only in the run's auth gateway (or the engine's own
68
+ * realm). The reply is validated against the requested schema after the
69
+ * wake. A wake whose transcript or per-request tool record shows any tool
70
+ * activity is refused, and so is one that left no evidence either way.
71
+ */
72
+ export function createBootedJudgeInference(options) {
73
+ const route = `${options.engine}-subscription`;
74
+ return {
75
+ id: route,
76
+ capabilities: { tools: 'disabled', billing: 'subscription', temperature: false, seed: false },
77
+ async generate(request) {
78
+ validateInferenceSchema(request.responseSchema);
79
+ if (!request.prompt.trim() || !request.model.trim() || request.temperature !== undefined || request.seed !== undefined) {
80
+ throw new InferenceFailure('unsupported', `Invalid ${route} inference controls`);
81
+ }
82
+ if (request.signal?.aborted)
83
+ throw new InferenceFailure('cancelled', `${route} cancelled before the wake`);
84
+ if (!bound)
85
+ throw new InferenceFailure('unavailable', 'Subscription judges run only as booted containers inside `spawnfile train --auth-profile <name>`');
86
+ const evidence = { responseModel: null, responseRoute: route };
87
+ const judge = await bound.judge({ engine: options.engine, model: request.model, ...(options.effort === undefined ? {} : { effort: options.effort }) })
88
+ .catch((error) => { throw new InferenceFailure('unavailable', `${route} judge did not boot: ${error instanceof Error ? error.message : String(error)}`, evidence); });
89
+ const schema = request.responseSchema === undefined ? '' : [
90
+ '', '', 'Reply with exactly one JSON value that validates against this JSON Schema and nothing else:',
91
+ JSON.stringify(request.responseSchema),
92
+ ].join('\n');
93
+ const text = `${request.system === undefined ? '' : `${request.system}\n\n`}${request.prompt}${schema}`;
94
+ const wake = await judge.wake(text, { deliveryId: `judge-${randomUUID()}`, timeoutMs: options.timeoutMs ?? 180_000, signal: request.signal });
95
+ const usage = bootedUsage(wake.usage);
96
+ const withUsage = { ...evidence, usage };
97
+ if (request.signal?.aborted)
98
+ throw new InferenceFailure('cancelled', `${route} judgment cancelled`, withUsage);
99
+ if (wake.state !== 'completed')
100
+ throw new InferenceFailure(wakeFailure(wake), `${route} judge wake ${wake.state}${wake.code ? ` (${wake.code})` : ''}`, withUsage);
101
+ const requests = wake.requestToolCalls ?? [];
102
+ if ((wake.transcript !== null && transcriptToolActivity(wake.transcript).length > 0) || requests.some(calls => calls !== null && calls.length > 0)) {
103
+ throw new InferenceFailure('protocol', `${route} attempt refused: tool-call`, { ...withUsage, detail: 'tool-call' });
104
+ }
105
+ // Proof of a tool-free wake: the engine transcript, or every model request's own tool-call record.
106
+ if (wake.transcript === null && (requests.length === 0 || requests.some(calls => calls === null))) {
107
+ throw new InferenceFailure('protocol', `${route} judge left no evidence to prove a tool-free judgment`, withUsage);
108
+ }
109
+ const reply = wake.text.trim();
110
+ if (!reply)
111
+ throw new InferenceFailure('protocol', `${route} judge replied with nothing`, withUsage);
112
+ try {
113
+ validateInferenceResponse(reply, request.responseSchema, request.responseJsonFence);
114
+ }
115
+ catch {
116
+ throw new InferenceFailure('invalid-response', `${route} answer violated the requested schema`, withUsage);
117
+ }
118
+ return { text: reply, model: request.model, modelBasis: 'requested-assumption', usage, route };
119
+ },
120
+ };
121
+ }
122
+ //# sourceMappingURL=judge.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"judge.js","sourceRoot":"","sources":["../../../../../src/runtime/daimon/training/booted/judge.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EAAE,gBAAgB,EAAE,yBAAyB,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AACrH,OAAO,EAAE,WAAW,EAAmB,MAAM,cAAc,CAAC;AAU5D,IAAI,KAAsC,CAAC;AAE3C;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAAC,QAAyC,IAAU,KAAK,GAAG,QAAQ,CAAC,CAAC,CAAC;AAIvG;;;;GAIG;AACH,MAAM,UAAU,GAAG,iFAAiF,CAAC;AACrG,MAAM,UAAU,GAAG,+FAA+F,CAAC;AAEnH,MAAM,UAAU,sBAAsB,CAAC,UAAkB;IACvD,MAAM,KAAK,GAAG,IAAI,G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AE,GAAG,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC,CAAC;YACvH,CAAC;YACD,mGAAmG;YACnG,IAAI,IAAI,CAAC,UAAU,KAAK,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,IAAI,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,KAAK,IAAI,CAAC,CAAC,EAAE,CAAC;gBAClG,MAAM,IAAI,gBAAgB,CAAC,UAAU,EAAE,GAAG,KAAK,uDAAuD,EAAE,SAAS,CAAC,CAAC;YACrH,CAAC;YACD,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;YAC/B,IAAI,CAAC,KAAK;gBAAE,MAAM,IAAI,gBAAgB,CAAC,UAAU,EAAE,GAAG,KAAK,6BAA6B,EAAE,SAAS,CAAC,CAAC;YACrG,IAAI,CAAC;gBACH,yBAAyB,CAAC,KAAK,EAAE,OAAO,CAAC,cAAc,EAAE,OAAO,CAAC,iBAAiB,CAAC,CAAC;YACtF,CAAC;YAAC,MAAM,CAAC;gBACP,MAAM,IAAI,gBAAgB,CAAC,kBAAkB,EAAE,GAAG,KAAK,uCAAuC,EAAE,SAAS,CAAC,CAAC;YAC7G,CAAC;YACD,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,UAAU,EAAE,sBAAsB,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;QACjG,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -1,8 +1,7 @@
1
1
  import { createClaudeInference } from '../training/index.js';
2
2
  import { configureGraderProviders } from '../training/contracts/index.js';
3
3
  import { CONTAINED_TEACHER_POLICY, EMPTY_TOOLS_TEACHER_POLICY } from '../shared/trainingLegacy/index.js';
4
- import { createCodexInference } from './daimon/training/providers/codex-subscription/index.js';
5
- import { createGrokInference } from './daimon/training/providers/grok-subscription/index.js';
4
+ import { createBootedJudgeInference } from './daimon/training/booted/index.js';
6
5
  export const defaultGrokWindow = { start: '20:30', end: '06:30', timeZone: 'Europe/Berlin' };
7
6
  export function grokWindowOpen(now, window = defaultGrokWindow) {
8
7
  const minutes = (value) => {
@@ -37,14 +36,21 @@ const registry = {
37
36
  } },
38
37
  { id: 'codex', inferenceProviderId: 'codex-subscription', decisionTools: 'contained', teacherPolicy: CONTAINED_TEACHER_POLICY,
39
38
  decompositionExtractor: true, atomicExtractor: true, validateAtomicConfig: atomicConfig,
40
- create: (teacher, timeoutMs) => createCodexInference({ timeoutMs, reasoningEffort: teacher.effort }) },
39
+ create: (teacher, timeoutMs) => createBootedJudgeInference({ engine: 'codex', effort: teacher.effort, timeoutMs }) },
41
40
  { id: 'grok', inferenceProviderId: 'grok-subscription', decisionTools: 'disabled', teacherPolicy: EMPTY_TOOLS_TEACHER_POLICY,
42
41
  decompositionExtractor: false, atomicExtractor: false, validateAtomicConfig: atomicConfig,
43
42
  create(teacher, timeoutMs) {
44
43
  const effort = teacher.effort;
45
44
  if (effort !== undefined && !['low', 'medium', 'high', 'xhigh'].includes(effort))
46
45
  throw new Error('Unsupported Grok teacher effort');
47
- return createGrokInference({ timeoutMs, reasoningEffort: effort });
46
+ return createBootedJudgeInference({ engine: 'grok', effort: effort ?? 'medium', timeoutMs });
47
+ } },
48
+ { id: 'agy', inferenceProviderId: 'agy-subscription', decisionTools: 'disabled', teacherPolicy: EMPTY_TOOLS_TEACHER_POLICY,
49
+ decompositionExtractor: false, atomicExtractor: false, validateAtomicConfig: atomicConfig,
50
+ create(teacher, timeoutMs) {
51
+ if (teacher.effort !== undefined)
52
+ throw new Error('AGY teacher effort is unsupported');
53
+ return createBootedJudgeInference({ engine: 'agy', timeoutMs });
48
54
  } },
49
55
  ],
50
56
  council: { requiredProviders: ['codex', 'claude'], requiredMessage: 'Council requires independent codex and claude teachers',
@@ -1,3 +1,6 @@
1
1
  import type { InferenceProviderRegistry } from '../training/contracts/index.js';
2
- /** Engine-owned descriptors extend the neutral built-ins at host composition. */
2
+ /**
3
+ * Engine-owned descriptors extend the neutral built-ins at host composition.
4
+ * Every subscription engine id names one booted judge engine (`booted/judge.ts`).
5
+ */
3
6
  export declare function createTrainingProviderRegistry(): InferenceProviderRegistry;
@@ -1,7 +1,6 @@
1
1
  import { INFERENCE_POLICY_VERSIONS } from '../training/contracts/index.js';
2
2
  import { defaultInferenceProviders, DatasetError, InferenceFailure } from '../training/index.js';
3
- import { createCodexInference } from './daimon/training/providers/codex-subscription/index.js';
4
- import { createGrokInference } from './daimon/training/providers/grok-subscription/index.js';
3
+ import { createBootedJudgeInference } from './daimon/training/booted/index.js';
5
4
  /** Frozen `grok-broker` catalog: historical YAML and measurement identities keep validating. */
6
5
  const grokGrantModels = ['grok-4.6', 'grok-4.5', 'grok-build'];
7
6
  const grokGrantReasoningEfforts = ['low', 'medium', 'high'];
@@ -33,20 +32,28 @@ function validate(model, path, reasoning) {
33
32
  fail(`${path}.${field}`, 'only supported for ollama');
34
33
  }
35
34
  }
36
- /** Engine-owned descriptors extend the neutral built-ins at host composition. */
35
+ /**
36
+ * Engine-owned descriptors extend the neutral built-ins at host composition.
37
+ * Every subscription engine id names one booted judge engine (`booted/judge.ts`).
38
+ */
37
39
  export function createTrainingProviderRegistry() {
38
40
  const codex = {
39
41
  policyVersion: INFERENCE_POLICY_VERSIONS['codex-subscription'],
40
42
  capabilities: { evaluatorPurposes: ['proposals', 'extraction'], evaluatorBudget: 'requests' },
41
43
  validate: (model, path) => validate(model, path, 'none'),
42
- create: (_model, context) => createCodexInference({ timeoutMs: context.timeoutMs }),
44
+ create: (_model, context) => createBootedJudgeInference({ engine: 'codex', timeoutMs: context.timeoutMs }),
43
45
  };
44
46
  const grok = {
45
47
  policyVersion: INFERENCE_POLICY_VERSIONS['grok-subscription'], capabilities: {},
46
48
  incompatibleWith: ['grok-broker'], incompatibilityReason: 'grok-broker routes cannot fall back to a desktop grok-subscription login',
47
49
  validate: (model, path) => validate(model, path, 'optional'),
48
50
  normalizeIdentity: model => ({ ...model, reasoning_effort: model.reasoning_effort ?? 'medium' }),
49
- create: (model, context) => createGrokInference({ timeoutMs: context.timeoutMs, reasoningEffort: model.reasoning_effort }),
51
+ create: (model, context) => createBootedJudgeInference({ engine: 'grok', effort: model.reasoning_effort ?? 'medium', timeoutMs: context.timeoutMs }),
52
+ };
53
+ const agy = {
54
+ policyVersion: INFERENCE_POLICY_VERSIONS['agy-subscription'], capabilities: {},
55
+ validate: (model, path) => validate(model, path, 'none'),
56
+ create: (_model, context) => createBootedJudgeInference({ engine: 'agy', timeoutMs: context.timeoutMs }),
50
57
  };
51
58
  // Broker grants lived in the removed training container; the ID still validates, and calls fail closed.
52
59
  const broker = {
@@ -75,5 +82,5 @@ export function createTrainingProviderRegistry() {
75
82
  }
76
83
  defaultInferenceProviders.providers.ollama.validate(model, path);
77
84
  },
78
- } } };
85
+ }, 'agy-subscription': agy } };
79
86
  }
@@ -26,6 +26,8 @@ export interface UsageRequestRecord {
26
26
  requests: number;
27
27
  started_at?: string;
28
28
  thread?: string;
29
+ /** Tool-call names the request's response carried; absent when the runtime could not say. */
30
+ tool_calls?: string[];
29
31
  total: number;
30
32
  turn?: string;
31
33
  usage_source?: UsageRequestSource;
@@ -35,7 +35,8 @@ export const parseUsageRequestLedgerLine = (line) => {
35
35
  || (row.ended_at !== undefined && !(text(row.ended_at) && TIMESTAMP.test(row.ended_at)))
36
36
  || (row.usage_source !== undefined && !USAGE_REQUEST_SOURCES.includes(row.usage_source))
37
37
  || (row.turn !== undefined && !(typeof row.turn === "string" && /^[a-f0-9]{64}$/u.test(row.turn)))
38
- || (row.reasoning !== undefined && !nonNegative(row.reasoning)))
38
+ || (row.reasoning !== undefined && !nonNegative(row.reasoning))
39
+ || (row.tool_calls !== undefined && !(Array.isArray(row.tool_calls) && row.tool_calls.every((name) => typeof name === "string"))))
39
40
  return null;
40
41
  return {
41
42
  agent: row.agent, at: row.at, cache_write: row.cache_write, cached_input: row.cached_input,
@@ -47,6 +48,7 @@ export const parseUsageRequestLedgerLine = (line) => {
47
48
  ...(text(row.model) ? { model: row.model } : {}),
48
49
  ...(row.reasoning === undefined ? {} : { reasoning: row.reasoning }),
49
50
  ...(text(row.thread) ? { thread: row.thread } : {}),
51
+ ...(row.tool_calls === undefined ? {} : { tool_calls: [...row.tool_calls] }),
50
52
  ...(row.turn === undefined ? {} : { turn: row.turn }),
51
53
  ...(row.usage_source === undefined ? {} : { usage_source: row.usage_source })
52
54
  };
@@ -18,6 +18,7 @@ export declare const INFERENCE_POLICY_VERSIONS: Readonly<{
18
18
  'grok-broker': "paideia.grok-broker-grant-response.v1";
19
19
  'claude-subscription': "paideia.claude-attested-response.v3";
20
20
  'codex-subscription': "paideia.codex-contained-response.v1";
21
+ 'agy-subscription': "spawnfile.agy-booted-judge-response.v1";
21
22
  ollama: "paideia.ollama-attested-response.v2";
22
23
  }>;
23
24
  export declare const LABEL_PROMPT_VERSION = "paideia.grader-label-prompt.v1";
@@ -18,6 +18,7 @@ export const INFERENCE_POLICY_VERSIONS = Object.freeze({
18
18
  'grok-broker': 'paideia.grok-broker-grant-response.v1',
19
19
  'claude-subscription': 'paideia.claude-attested-response.v3',
20
20
  'codex-subscription': 'paideia.codex-contained-response.v1',
21
+ 'agy-subscription': 'spawnfile.agy-booted-judge-response.v1',
21
22
  ollama: 'paideia.ollama-attested-response.v2',
22
23
  });
23
24
  export const LABEL_PROMPT_VERSION = 'paideia.grader-label-prompt.v1';
@@ -1 +1 @@
1
- {"version":3,"file":"trainingLegacyHashDomains.js","sourceRoot":"","sources":["../../../src/shared/trainingLegacy/trainingLegacyHashDomains.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,uBAAuB,CAAC;AACpE,MAAM,CAAC,MAAM,sBAAsB,GAAG,kBAAkB,CAAC;AACzD,MAAM,CAAC,MAAM,qBAAqB,GAAG,2BAA2B,CAAC;AACjE,MAAM,CAAC,MAAM,0BAA0B,GAAG,0BA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CAAkC,CAAC;AAC/E,uFAAuF;AACvF,MAAM,CAAC,MAAM,gBAAgB,GAAG,kBAAkB,CAAC;AACnD,MAAM,CAAC,MAAM,qBAAqB,GAAG,uBAAuB,CAAC;AAC7D,MAAM,CAAC,MAAM,iBAAiB,GAAG,oBAAoB,CAAC;AACtD,MAAM,CAAC,MAAM,mBAAmB,GAAG,qDAAqD,CAAC;AAEzF,wFAAwF;AACxF,MAAM,CAAC,MAAM,wCAAwC,GAAG,wCAAwC,CAAC"}
1
+ {"version":3,"file":"trainingLegacyHashDomains.js","sourceRoot":"","sources":["../../../src/shared/trainingLegacy/trainingLegacyHashDomains.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,uBAAuB,CAAC;AACpE,MAAM,CAAC,MAAM,sBAAsB,GAAG,kBAAkB,CAAC;AACzD,MAAM,CAAC,MAAM,qBAAqB,GAAG,2BAA2B,CAAC;AACjE,MAAM,CAAC,MAAM,0BAA0B,GAAG,0BAA0B,CAAC;AACrE,MAAM,CAAC,MAAM,6BAA6B,GAAG,UAAU,CAAC;AACxD,MAAM,CAAC,MAAM,2BAA2B,GAAG,0BAA0B,CAAC;AACtE,MAAM,CAAC,MAAM,6BAA6B,GAAG,4BAA4B,CAAC;AAC1E,MAAM,CAAC,MAAM,4BAA4B,GAAG,2BAA2B,CAAC;AAExE,MAAM,CAAC,MAAM,4BAA4B,GAAG,4BAA4B,CAAC;AACzE,MAAM,CAAC,MAAM,+BAA+B,GAAG,2BAA2B,CAAC;AAC3E,MAAM,CAAC,MAAM,6BAA6B,GAAG,mCAAmC,CAAC;AACjF,MAAM,CAAC,MAAM,sBAAsB,GAAG,oBAAoB,CAAC;AAC3D,MAAM,CAAC,MAAM,yBAAyB,GAAG,MAAM,CAAC,MAAM,CAAC;IACrD,mBAAmB,EAAE,mCAAmC;IACxD,aAAa,EAAE,uCAAuC;IACtD,qBAAqB,EAAE,qCAAqC;IAC5D,oBAAoB,EAAE,qCAAqC;IAC3D,kBAAkB,EAAE,wCAAwC;IAC5D,MAAM,EAAE,qCAAqC;CAC9C,CAAC,CAAC;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,gCAAgC,CAAC;AACrE,MAAM,CAAC,MAAM,iBAAiB,GAAG,yBAAyB,CAAC;AAC3D,MAAM,CAAC,MAAM,sBAAsB,GAAG,oBAAoB,CAAC;AAC3D,MAAM,CAAC,MAAM,YAAY,GAAG,iBAAiB,CAAC;AAC9C,MAAM,CAAC,MAAM,sBAAsB,GAAG,oBAAoB,CAAC;AAC3D,MAAM,CAAC,MAAM,uBAAuB,GAAG,sBAAsB,CAAC;AAC9D,MAAM,CAAC,MAAM,qBAAqB,GAAG,oBAAoB,CAAC;AAC1D,MAAM,CAAC,MAAM,oBAAoB,GAAG,mBAAmB,CAAC;AACxD,MAAM,CAAC,MAAM,yBAAyB,GAAG,+BAA+B,CAAC;AACzE,MAAM,CAAC,MAAM,wBAAwB,GAAG,8BAA8B,CAAC;AACvE,MAAM,CAAC,MAAM,4BAA4B,GAAG,kCAAkC,CAAC;AAC/E,uFAAuF;AACvF,MAAM,CAAC,MAAM,gBAAgB,GAAG,kBAAkB,CAAC;AACnD,MAAM,CAAC,MAAM,qBAAqB,GAAG,uBAAuB,CAAC;AAC7D,MAAM,CAAC,MAAM,iBAAiB,GAAG,oBAAoB,CAAC;AACtD,MAAM,CAAC,MAAM,mBAAmB,GAAG,qDAAqD,CAAC;AAEzF,wFAAwF;AACxF,MAAM,CAAC,MAAM,wCAAwC,GAAG,wCAAwC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spawnfile",
3
- "version": "0.1.34",
3
+ "version": "0.1.35",
4
4
  "description": "Canonical source compiler for autonomous agents and teams.",
5
5
  "license": "MIT",
6
6
  "type": "module",
package/runtimes.yaml CHANGED
@@ -13,16 +13,16 @@
13
13
  runtimes:
14
14
  daimon:
15
15
  remote: git@github.com:noopolis/daimon-harness.git
16
- ref: a42a2b23722eadc44874e8caf117d17237e1095f
16
+ ref: c5337565df0b60151ae731b17878f784c13a9337
17
17
  default_branch: main
18
18
  install:
19
19
  kind: container_image
20
20
  image: noopolis/spawnfile-runtime-daimon
21
- tag: 0.2.15-a42a2b2
22
- digest: sha256:d5e44b146f2aa408dd9c90c89d9f659bf7e64e918ef582752af15a7c8ec801dd
21
+ tag: 0.2.16-c533756
22
+ digest: sha256:cec10f3e0b0547d352de0a61d7d2345efe66f8ece6bf6fe7e5178cee1465f239
23
23
  capability_receipts:
24
- amd64: sha256:0c406fd74c693eab842567e40edbc5bb86bd7bae80c8be4ae0c8c06985136adf
25
- arm64: sha256:f503deecf2417bd3e19d936fc43face81dd2d75a27e5557ec53ef76e9307cd34
24
+ amd64: sha256:effee312a6ad276d19176e11eb34eea20f3dcb823a0141117e00f81ef970a491
25
+ arm64: sha256:01a5c19684a2a61de82b7630cafe8085bee7164f53555e5a3680b9e11f657c6a
26
26
  contract_manifest_sha256: sha256:85de96d75cf1e02e0e88bd6e1dcce39a125c1d5b97f1eb9c01911a0d5c3316e8
27
27
  status: active
28
28
 
@@ -1 +0,0 @@
1
- export { createCodexInference, type CodexInferenceOptions } from './provider.js';
@@ -1,2 +0,0 @@
1
- export { createCodexInference } from './provider.js';
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/runtime/daimon/training/providers/codex-subscription/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAA8B,MAAM,eAAe,CAAC"}
@@ -1,17 +0,0 @@
1
- import type { Usage, InferenceFailureKind } from '../../../../../training/index.js';
2
- export interface CodexFrames {
3
- started: boolean;
4
- turning: boolean;
5
- completed: boolean;
6
- text: string;
7
- model?: string;
8
- usage: Usage | null;
9
- }
10
- export declare function codexEvidence(frames: CodexFrames): {
11
- responseModel: string | null;
12
- responseRoute: string;
13
- usage: Usage | null;
14
- };
15
- /** Unknown item types are tool activity, including future native tool families. */
16
- export declare function consumeCodexFrame(frames: CodexFrames, line: string): void;
17
- export declare function classifyCodexFailure(message: unknown): InferenceFailureKind;
@@ -1,80 +0,0 @@
1
- import { InferenceFailure } from '../../../../../training/index.js';
2
- import { validateInferenceResponse } from '../../../../../training/index.js';
3
- export function codexEvidence(frames) {
4
- return { responseModel: frames.model ?? null, responseRoute: 'codex-subscription', usage: frames.usage };
5
- }
6
- function object(value) {
7
- if (!value || typeof value !== 'object' || Array.isArray(value))
8
- throw new Error('Expected object');
9
- return value;
10
- }
11
- /** Unknown item types are tool activity, including future native tool families. */
12
- export function consumeCodexFrame(frames, line) {
13
- try {
14
- validateInferenceResponse(line, { type: 'object' });
15
- const event = object(JSON.parse(line));
16
- const type = event['type'];
17
- if (typeof type !== 'string')
18
- throw new Error('Missing event type');
19
- if (type.startsWith('item.')) {
20
- const item = object(event['item']);
21
- if (item['type'] !== 'agent_message' && item['type'] !== 'reasoning') {
22
- throw new InferenceFailure('protocol', 'Codex attempt refused: tool-call', { ...codexEvidence(frames), detail: 'tool-call' });
23
- }
24
- const text = item['text'];
25
- if (!frames.turning || frames.completed || !['item.started', 'item.updated', 'item.completed'].includes(type) ||
26
- typeof item['id'] !== 'string' ||
27
- !(typeof text === 'string' || type === 'item.started' && text === undefined))
28
- throw new Error('Invalid item');
29
- if (type === 'item.completed' && item['type'] === 'agent_message' && typeof text === 'string')
30
- frames.text = text;
31
- }
32
- else if (type === 'error' || type === 'turn.failed') {
33
- const error = type === 'error' ? event : object(event['error']);
34
- throw new InferenceFailure(classifyCodexFailure(error['message']), 'Codex native generation failed', codexEvidence(frames));
35
- }
36
- else if (type === 'thread.started') {
37
- if (frames.started || typeof event['thread_id'] !== 'string')
38
- throw new Error('Invalid thread');
39
- frames.started = true;
40
- }
41
- else if (type === 'turn.started') {
42
- if (!frames.started || frames.turning)
43
- throw new Error('Invalid turn');
44
- frames.turning = true;
45
- }
46
- else if (type === 'turn.completed') {
47
- if (!frames.turning || frames.completed || !frames.text.trim())
48
- throw new Error('Incomplete turn');
49
- frames.completed = true;
50
- if (event['usage'] !== undefined)
51
- frames.usage = codexUsage(object(event['usage']));
52
- }
53
- else
54
- throw new Error('Unknown event');
55
- if (typeof event['model'] === 'string' && event['model'].trim())
56
- frames.model = event['model'];
57
- }
58
- catch (error) {
59
- if (error instanceof InferenceFailure)
60
- throw error;
61
- throw new InferenceFailure('protocol', 'Malformed Codex event stream', codexEvidence(frames));
62
- }
63
- }
64
- export function classifyCodexFailure(message) {
65
- if (typeof message !== 'string')
66
- return 'protocol';
67
- if (/unauthorized|authentication|sign in|login|401|403/iu.test(message))
68
- return 'authentication';
69
- if (/quota|usage limit|rate limit|429|402|payment/iu.test(message))
70
- return 'quota';
71
- if (/connection|transport|network|stream disconnected|reconnecting/iu.test(message))
72
- return 'transport';
73
- return 'protocol';
74
- }
75
- function codexUsage(raw) {
76
- const count = (key) => typeof raw[key] === 'number' && Number.isSafeInteger(raw[key]) && raw[key] >= 0 ? raw[key] : null;
77
- return { inputTokens: count('input_tokens'), cachedInputTokens: count('cached_input_tokens'),
78
- outputTokens: count('output_tokens'), reasoningTokens: count('reasoning_output_tokens'), source: 'codex.turn.usage' };
79
- }
80
- //# sourceMappingURL=protocol.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"protocol.js","sourceRoot":"","sources":["../../../../../../src/runtime/daimon/training/providers/codex-subscription/protocol.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAE,yBAAyB,EAAE,MAAM,kCAAkC,CAAC;AAU7E,MAAM,UAAU,aAAa,CAAC,MAAmB;IAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,CAAC,KAAK,IAAI,IAAI,EAAE,aAAa,EAAE,oBAAoB,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC;AAC3G,CAAC;AAED,SAAS,MAAM,CAAC,KAAc;IAC5B,IAAI,CAAC,KA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,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAChJ,OAAO,EAAE,WAAW,EAAE,KAAK,CAAC,cAAc,CAAC,EAAE,iBAAiB,EAAE,KAAK,CAAC,qBAAqB,CAAC;QAC1F,YAAY,EAAE,KAAK,CAAC,eAAe,CAAC,EAAE,eAAe,EAAE,KAAK,CAAC,yBAAyB,CAAC,EAAE,MAAM,EAAE,kBAAkB,EAAE,CAAC;AAC1H,CAAC"}
@@ -1,12 +0,0 @@
1
- import type { InferenceProvider, InferenceRequest } from '../../../../../training/index.js';
2
- import { runProcess } from '../../../../../training/index.js';
3
- export interface CodexInferenceOptions {
4
- command?: string;
5
- authHome?: string;
6
- timeoutMs?: number;
7
- reasoningEffort?: string;
8
- process?: typeof runProcess;
9
- }
10
- export declare function codexEnvironment(home: string): NodeJS.ProcessEnv;
11
- export declare function codexArguments(request: InferenceRequest, effort?: string, schemaFile?: string): string[];
12
- export declare function createCodexInference(options?: CodexInferenceOptions): InferenceProvider;