@cleocode/contracts 2026.10.27 → 2026.11.1-canary.11
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 +2 -1
- package/dist/.source-stamp.json +4 -0
- package/dist/__tests__/acceptance-gate.test.js +15 -3
- package/dist/__tests__/acceptance-gate.test.js.map +1 -1
- package/dist/__tests__/completion-operation-contracts.test.js +1 -1
- package/dist/__tests__/completion-operation-contracts.test.js.map +1 -1
- package/dist/__tests__/evidence-atom-schema.test.js +3 -1
- package/dist/__tests__/evidence-atom-schema.test.js.map +1 -1
- package/dist/__tests__/gateway-contract.test.js +1 -1
- package/dist/__tests__/gateway-contract.test.js.map +1 -1
- package/dist/__tests__/memory-wire-shapes.test.js.map +1 -1
- package/dist/__tests__/operation-def.test.js +4 -3
- package/dist/__tests__/operation-def.test.js.map +1 -1
- package/dist/acceptance-gate-schema.d.ts +25 -0
- package/dist/acceptance-gate-schema.d.ts.map +1 -1
- package/dist/acceptance-gate-schema.js +5 -0
- package/dist/acceptance-gate-schema.js.map +1 -1
- package/dist/acceptance-gate.d.ts +8 -0
- package/dist/acceptance-gate.d.ts.map +1 -1
- package/dist/brain-graph.d.ts +1 -1
- package/dist/brain-graph.js +1 -1
- package/dist/caamp-markers.d.ts +11 -0
- package/dist/caamp-markers.d.ts.map +1 -1
- package/dist/config/manifest.d.ts.map +1 -1
- package/dist/config/manifest.js +13 -0
- package/dist/config/manifest.js.map +1 -1
- package/dist/{config.d.ts → config/types.d.ts} +130 -6
- package/dist/config/types.d.ts.map +1 -0
- package/dist/{config.js → config/types.js} +1 -1
- package/dist/config/types.js.map +1 -0
- package/dist/config/worker-policy.d.ts +42 -0
- package/dist/config/worker-policy.d.ts.map +1 -0
- package/dist/config/worker-policy.js +35 -0
- package/dist/config/worker-policy.js.map +1 -0
- package/dist/data-accessor.d.ts +15 -0
- package/dist/data-accessor.d.ts.map +1 -1
- package/dist/data-accessor.js.map +1 -1
- package/dist/dependency.d.ts +2 -0
- package/dist/dependency.d.ts.map +1 -1
- package/dist/dispatch/__tests__/operation-envelope-snapshots.test.js +0 -6
- package/dist/dispatch/__tests__/operation-envelope-snapshots.test.js.map +1 -1
- package/dist/dispatch/identity.d.ts +3 -8
- package/dist/dispatch/identity.d.ts.map +1 -1
- package/dist/dispatch/identity.js +2 -8
- package/dist/dispatch/identity.js.map +1 -1
- package/dist/dispatch/operations-registry.d.ts.map +1 -1
- package/dist/dispatch/operations-registry.js +360 -513
- package/dist/dispatch/operations-registry.js.map +1 -1
- package/dist/docs/modernize.d.ts +468 -0
- package/dist/docs/modernize.d.ts.map +1 -0
- package/dist/docs/modernize.js +145 -0
- package/dist/docs/modernize.js.map +1 -0
- package/dist/docs/provenance.d.ts +6 -6
- package/dist/docs-taxonomy.d.ts +6 -0
- package/dist/docs-taxonomy.d.ts.map +1 -1
- package/dist/docs-taxonomy.js +38 -1
- package/dist/docs-taxonomy.js.map +1 -1
- package/dist/done-plan.d.ts +34 -3
- package/dist/done-plan.d.ts.map +1 -1
- package/dist/evidence-atom-schema.d.ts +78 -4
- package/dist/evidence-atom-schema.d.ts.map +1 -1
- package/dist/evidence-atom-schema.js +136 -11
- package/dist/evidence-atom-schema.js.map +1 -1
- package/dist/evidence-record-schema.d.ts +2 -2
- package/dist/exit-codes.d.ts +93 -0
- package/dist/exit-codes.d.ts.map +1 -1
- package/dist/exit-codes.js +93 -0
- package/dist/exit-codes.js.map +1 -1
- package/dist/{gateway.d.ts → gateway/index.d.ts} +4 -4
- package/dist/gateway/index.d.ts.map +1 -0
- package/dist/{gateway.js → gateway/index.js} +2 -2
- package/dist/gateway/index.js.map +1 -0
- package/dist/gateway/rpc/messages.d.ts +4 -4
- package/dist/gateway/rpc/messages.js +1 -1
- package/dist/gateway/rpc/messages.js.map +1 -1
- package/dist/git-hooks.d.ts +29 -3
- package/dist/git-hooks.d.ts.map +1 -1
- package/dist/git-hooks.js +34 -3
- package/dist/git-hooks.js.map +1 -1
- package/dist/heavy-command-hook.d.ts +5 -0
- package/dist/heavy-command-hook.d.ts.map +1 -1
- package/dist/index.d.ts +23 -19
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -6
- package/dist/index.js.map +1 -1
- package/dist/invariants/sync-write-invariants.d.ts.map +1 -1
- package/dist/invariants/sync-write-invariants.js +29 -1
- package/dist/invariants/sync-write-invariants.js.map +1 -1
- package/dist/jobs.d.ts +5 -0
- package/dist/jobs.d.ts.map +1 -1
- package/dist/lease-ipc/messages.d.ts +5 -5
- package/dist/llm/onboarding.d.ts +1 -1
- package/dist/llm/system-of-use.d.ts +1 -1
- package/dist/llm/system-of-use.d.ts.map +1 -1
- package/dist/llm/system-resolver.d.ts +1 -1
- package/dist/llm/system-resolver.d.ts.map +1 -1
- package/dist/{memory.d.ts → memory/index.d.ts} +1 -1
- package/dist/memory/index.d.ts.map +1 -0
- package/dist/{memory.js → memory/index.js} +1 -1
- package/dist/memory/index.js.map +1 -0
- package/dist/memory/search.d.ts +20 -2
- package/dist/memory/search.d.ts.map +1 -1
- package/dist/merge-close.d.ts +277 -0
- package/dist/merge-close.d.ts.map +1 -0
- package/dist/merge-close.js +16 -0
- package/dist/merge-close.js.map +1 -0
- package/dist/nexus-cloud.d.ts +1 -1
- package/dist/operations/admin.d.ts +6 -0
- package/dist/operations/admin.d.ts.map +1 -1
- package/dist/operations/docs.d.ts +233 -9
- package/dist/operations/docs.d.ts.map +1 -1
- package/dist/operations/docs.js.map +1 -1
- package/dist/operations/index.d.ts +0 -1
- package/dist/operations/index.d.ts.map +1 -1
- package/dist/operations/index.js +0 -1
- package/dist/operations/index.js.map +1 -1
- package/dist/operations/memory.d.ts +7 -4
- package/dist/operations/memory.d.ts.map +1 -1
- package/dist/operations/nexus-scope-map.d.ts +0 -8
- package/dist/operations/nexus-scope-map.d.ts.map +1 -1
- package/dist/operations/nexus-scope-map.js +0 -8
- package/dist/operations/nexus-scope-map.js.map +1 -1
- package/dist/operations/nexus.d.ts +2 -10
- package/dist/operations/nexus.d.ts.map +1 -1
- package/dist/operations/nexus.js.map +1 -1
- package/dist/operations/orchestrate.d.ts +219 -6
- package/dist/operations/orchestrate.d.ts.map +1 -1
- package/dist/operations/orchestrate.js +329 -1
- package/dist/operations/orchestrate.js.map +1 -1
- package/dist/operations/output-contracts-data.js +1 -1
- package/dist/operations/output-contracts-data.js.map +1 -1
- package/dist/operations/release.d.ts +0 -79
- package/dist/operations/release.d.ts.map +1 -1
- package/dist/operations/session.d.ts +1 -1
- package/dist/operations/session.d.ts.map +1 -1
- package/dist/operations/tasks.d.ts +18 -6
- package/dist/operations/tasks.d.ts.map +1 -1
- package/dist/operations/tasks.js.map +1 -1
- package/dist/operations/validate.d.ts +6 -0
- package/dist/operations/validate.d.ts.map +1 -1
- package/dist/operations/worktree.d.ts +209 -19
- package/dist/operations/worktree.d.ts.map +1 -1
- package/dist/orca-execution.d.ts +533 -0
- package/dist/orca-execution.d.ts.map +1 -0
- package/dist/orca-execution.js +385 -0
- package/dist/orca-execution.js.map +1 -0
- package/dist/project-context.d.ts +31 -0
- package/dist/project-context.d.ts.map +1 -1
- package/dist/project-hooks.d.ts +8 -8
- package/dist/release/authorization.d.ts +46 -0
- package/dist/release/authorization.d.ts.map +1 -0
- package/dist/release/authorization.js +10 -0
- package/dist/release/authorization.js.map +1 -0
- package/dist/release/hook-pilot.d.ts +1 -1
- package/dist/resource-governor.d.ts +44 -0
- package/dist/resource-governor.d.ts.map +1 -1
- package/dist/resource-governor.js +10 -0
- package/dist/resource-governor.js.map +1 -1
- package/dist/review-verdict.d.ts +253 -0
- package/dist/review-verdict.d.ts.map +1 -0
- package/dist/review-verdict.js +20 -0
- package/dist/review-verdict.js.map +1 -0
- package/dist/row-identity.d.ts +11 -0
- package/dist/row-identity.d.ts.map +1 -1
- package/dist/session-journal.d.ts.map +1 -1
- package/dist/session-journal.js +7 -1
- package/dist/session-journal.js.map +1 -1
- package/dist/session.d.ts +11 -0
- package/dist/session.d.ts.map +1 -1
- package/dist/session.js.map +1 -1
- package/dist/skills/migrate.d.ts +1 -1
- package/dist/skills/migrate.js +1 -1
- package/dist/skills/stats.d.ts +1 -1
- package/dist/skills/stats.js +1 -1
- package/dist/spawn-types.d.ts +57 -0
- package/dist/spawn-types.d.ts.map +1 -1
- package/dist/spawn.d.ts +43 -0
- package/dist/spawn.d.ts.map +1 -1
- package/dist/spawn.js +1 -0
- package/dist/spawn.js.map +1 -1
- package/dist/status-registry.d.ts +27 -0
- package/dist/status-registry.d.ts.map +1 -1
- package/dist/status-registry.js +28 -0
- package/dist/status-registry.js.map +1 -1
- package/dist/table-classification.d.ts +22 -0
- package/dist/table-classification.d.ts.map +1 -1
- package/dist/task-id.d.ts +8 -10
- package/dist/task-id.d.ts.map +1 -1
- package/dist/task-id.js +9 -48
- package/dist/task-id.js.map +1 -1
- package/dist/task-record.d.ts +10 -1
- package/dist/task-record.d.ts.map +1 -1
- package/dist/task.d.ts +177 -4
- package/dist/task.d.ts.map +1 -1
- package/dist/task.js.map +1 -1
- package/dist/{tasks.d.ts → tasks/index.d.ts} +3 -3
- package/dist/tasks/index.d.ts.map +1 -0
- package/dist/{tasks.js → tasks/index.js} +2 -2
- package/dist/tasks/index.js.map +1 -0
- package/dist/templates/manifest.d.ts +1 -1
- package/dist/tools/build-task-tree.d.ts +1 -1
- package/dist/tools/build-task-tree.d.ts.map +1 -1
- package/dist/workgraph.d.ts +56 -56
- package/package.json +22 -6
- package/schemas/acceptance-gate.schema.json +24 -0
- package/schemas/task.schema.json +24 -0
- package/src/__tests__/__snapshots__/operations-registry.test.ts.snap +1 -1
- package/src/__tests__/acceptance-gate.test.ts +16 -3
- package/src/__tests__/completion-operation-contracts.test.ts +1 -1
- package/src/__tests__/evidence-atom-schema.test.ts +3 -1
- package/src/__tests__/gateway-contract.test.ts +1 -1
- package/src/__tests__/llm-config-schema.test.ts +1 -1
- package/src/__tests__/memory-wire-shapes.test.ts +4 -1
- package/src/__tests__/operation-def.test.ts +4 -3
- package/src/acceptance-gate-schema.ts +5 -0
- package/src/acceptance-gate.ts +9 -0
- package/src/brain-graph.ts +1 -1
- package/src/caamp-markers.ts +11 -0
- package/src/config/manifest.ts +13 -0
- package/src/{config.ts → config/types.ts} +134 -5
- package/src/config/worker-policy.ts +55 -0
- package/src/data-accessor.ts +16 -0
- package/src/dependency.ts +2 -0
- package/src/dispatch/__tests__/operation-envelope-snapshots.test.ts +0 -6
- package/src/dispatch/identity.ts +2 -8
- package/src/dispatch/operations-registry.ts +377 -525
- package/src/docs/modernize.ts +442 -0
- package/src/docs-taxonomy.ts +44 -1
- package/src/done-plan.ts +33 -2
- package/src/evidence-atom-schema.ts +167 -14
- package/src/exit-codes.ts +95 -0
- package/src/{gateway.ts → gateway/index.ts} +3 -3
- package/src/gateway/rpc/messages.ts +1 -1
- package/src/git-hooks.ts +43 -3
- package/src/heavy-command-hook.ts +5 -0
- package/src/index.ts +132 -48
- package/src/invariants/sync-write-invariants.ts +30 -0
- package/src/jobs.ts +5 -0
- package/src/llm/onboarding.ts +1 -1
- package/src/llm/system-of-use.ts +1 -1
- package/src/llm/system-resolver.ts +1 -1
- package/src/memory/search.ts +17 -2
- package/src/merge-close.ts +291 -0
- package/src/operations/admin.ts +6 -0
- package/src/operations/docs.ts +242 -10
- package/src/operations/index.ts +0 -1
- package/src/operations/memory.ts +7 -4
- package/src/operations/nexus-scope-map.ts +0 -8
- package/src/operations/nexus.ts +2 -11
- package/src/operations/orchestrate.ts +490 -6
- package/src/operations/output-contracts-data.ts +1 -1
- package/src/operations/release.ts +0 -87
- package/src/operations/session.ts +1 -1
- package/src/operations/tasks.ts +20 -7
- package/src/operations/validate.ts +6 -0
- package/src/operations/worktree.ts +216 -19
- package/src/orca-execution.ts +528 -0
- package/src/project-context.ts +33 -0
- package/src/release/authorization.ts +48 -0
- package/src/resource-governor.ts +47 -0
- package/src/review-verdict.ts +265 -0
- package/src/row-identity.ts +11 -0
- package/src/session-journal.ts +7 -1
- package/src/session.ts +11 -0
- package/src/skills/migrate.ts +1 -1
- package/src/skills/stats.ts +1 -1
- package/src/spawn-types.ts +75 -0
- package/src/spawn.ts +48 -0
- package/src/status-registry.ts +37 -0
- package/src/table-classification.ts +23 -0
- package/src/task-id.ts +9 -47
- package/src/task-record.ts +10 -1
- package/src/task.ts +171 -4
- package/src/{tasks.ts → tasks/index.ts} +3 -3
- package/src/tools/build-task-tree.ts +1 -1
- package/dist/config.d.ts.map +0 -1
- package/dist/config.js.map +0 -1
- package/dist/gateway.d.ts.map +0 -1
- package/dist/gateway.js.map +0 -1
- package/dist/memory.d.ts.map +0 -1
- package/dist/memory.js.map +0 -1
- package/dist/operations/conduit.d.ts +0 -285
- package/dist/operations/conduit.d.ts.map +0 -1
- package/dist/operations/conduit.js +0 -39
- package/dist/operations/conduit.js.map +0 -1
- package/dist/tasks.d.ts.map +0 -1
- package/dist/tasks.js.map +0 -1
- package/src/operations/conduit.ts +0 -348
- /package/src/{memory.ts → memory/index.ts} +0 -0
|
@@ -0,0 +1,528 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Local Orca execution contracts, independent of model/provider registration.
|
|
3
|
+
*
|
|
4
|
+
* @task T14455
|
|
5
|
+
* @packageDocumentation
|
|
6
|
+
*/
|
|
7
|
+
import { z } from 'zod';
|
|
8
|
+
|
|
9
|
+
/** Current public Orca launch APIs cannot carry the native lead's enforced guards. */
|
|
10
|
+
export const ORCA_LEAD_LAUNCH_REFUSAL = {
|
|
11
|
+
code: 'E_LEAD_TOOLS_UNSTRIPPED',
|
|
12
|
+
message:
|
|
13
|
+
'Orca cannot enforce lead tool/permission restrictions (--restricted, --tools, --allowedTools, --disallowedTools, --permission-mode, --setting-sources), strict MCP isolation (--mcp-config, --strict-mcp-config), or the owner channel and own session (--session-id, --settings, inherited owner terminal or validated user-only mbx) before launch.',
|
|
14
|
+
fix: 'Run cleo orchestrate lead <epicId> --adapter claude-code for the enforced native lead route, including inside Orca, with validated user-scope mbx for --detached; keep orchestrate.leadWorker.v1 enabled. The Orca backend needs a constrained launch API carrying these argv/settings before it can start a lead.',
|
|
15
|
+
} as const;
|
|
16
|
+
|
|
17
|
+
const identifier = z.string().min(1);
|
|
18
|
+
|
|
19
|
+
/** Orca server agent ids supported by the local routing contract. */
|
|
20
|
+
export const orcaAgentSchema = z.enum(['codex', 'opencode2', 'claude', 'grok']);
|
|
21
|
+
|
|
22
|
+
/** Server agent identity, separate from CLEO harness and model identity. */
|
|
23
|
+
export type OrcaAgent = z.infer<typeof orcaAgentSchema>;
|
|
24
|
+
|
|
25
|
+
/** Ordered rotation defaults; availability is verified on the execution host. */
|
|
26
|
+
export const DEFAULT_ORCA_AGENTS: OrcaAgent[] = ['codex', 'opencode2', 'claude'];
|
|
27
|
+
|
|
28
|
+
/** Harness identity for each supported Orca server agent. */
|
|
29
|
+
export const ORCA_AGENT_HARNESSES = {
|
|
30
|
+
codex: 'codex',
|
|
31
|
+
opencode2: 'opencode',
|
|
32
|
+
claude: 'claude-code',
|
|
33
|
+
grok: 'grok',
|
|
34
|
+
} as const;
|
|
35
|
+
|
|
36
|
+
/** Account inventory provider; Grok uses its server-side sign-in. */
|
|
37
|
+
export const ORCA_AGENT_PROVIDERS = {
|
|
38
|
+
codex: 'codex',
|
|
39
|
+
opencode2: 'opencode',
|
|
40
|
+
claude: 'claude',
|
|
41
|
+
grok: null,
|
|
42
|
+
} as const;
|
|
43
|
+
|
|
44
|
+
/** Project rotation configuration; duplicates and unsupported ids refuse. */
|
|
45
|
+
export const orchestrateOrcaConfigSchema = z.object({
|
|
46
|
+
agents: z
|
|
47
|
+
.array(orcaAgentSchema)
|
|
48
|
+
.min(1)
|
|
49
|
+
.refine((agents) => new Set(agents).size === agents.length, 'Agent ids must be unique.')
|
|
50
|
+
.default(DEFAULT_ORCA_AGENTS),
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
/** Configuration for `orchestrate.orca`, independent of native provider discovery. */
|
|
54
|
+
export type OrchestrateOrcaConfig = z.input<typeof orchestrateOrcaConfigSchema>;
|
|
55
|
+
|
|
56
|
+
/** Explicit execution endpoint and caller; never inferred from the newest Run. */
|
|
57
|
+
export const orcaContextSchema = z.object({
|
|
58
|
+
runtimeId: identifier,
|
|
59
|
+
coordinatorHandle: identifier,
|
|
60
|
+
executionHostId: z.literal('local'),
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
/** Verified local endpoint used for every operation, including recovery. */
|
|
64
|
+
export type OrcaContext = z.infer<typeof orcaContextSchema>;
|
|
65
|
+
|
|
66
|
+
/** Nonsecret account availability; private account rows never leave the adapter. */
|
|
67
|
+
export interface OrcaAccountAvailability {
|
|
68
|
+
/** Provider understood by `orca account list`. */
|
|
69
|
+
provider: 'codex' | 'opencode' | 'claude';
|
|
70
|
+
/** Number of configured accounts, excluding their private fields. */
|
|
71
|
+
accountCount: number;
|
|
72
|
+
/** An active account or the provider's `system` sign-in is selected. */
|
|
73
|
+
activeAccountPresent: boolean;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/** Verified caller and the sanitized local account inventory. */
|
|
77
|
+
export interface OrcaDiscovery {
|
|
78
|
+
/** Runtime and coordinator proven through read-only host calls. */
|
|
79
|
+
context: OrcaContext;
|
|
80
|
+
/** Availability only; no emails, homes, credentials or exact account placement. */
|
|
81
|
+
accounts: OrcaAccountAvailability[];
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/** Durable routing state for one exact runtime/coordinator Run. */
|
|
85
|
+
export const orcaRoutingRunSchema = z.object({
|
|
86
|
+
runId: identifier.nullable(),
|
|
87
|
+
unconfiguredAgents: z.array(orcaAgentSchema),
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
/** Persisted execution Run and its confirmed prelaunch refusals. */
|
|
91
|
+
export type OrcaRoutingRun = z.infer<typeof orcaRoutingRunSchema>;
|
|
92
|
+
|
|
93
|
+
/** Canonically prepared CLEO assignment consumed without allocating another session. */
|
|
94
|
+
export const orcaLaunchSchema = z.object({
|
|
95
|
+
projectId: identifier,
|
|
96
|
+
projectRoot: identifier,
|
|
97
|
+
taskId: identifier,
|
|
98
|
+
instanceId: identifier,
|
|
99
|
+
workerSessionId: identifier,
|
|
100
|
+
agentId: identifier,
|
|
101
|
+
role: z.enum(['worker', 'lead']),
|
|
102
|
+
protocol: identifier,
|
|
103
|
+
worktreePath: identifier,
|
|
104
|
+
worktreeBranch: identifier,
|
|
105
|
+
projectHash: identifier,
|
|
106
|
+
lockToken: identifier,
|
|
107
|
+
prompt: identifier,
|
|
108
|
+
harness: z.enum(['claude-code', 'codex', 'opencode', 'grok', 'kimi']),
|
|
109
|
+
leadMailbox: identifier.nullable(),
|
|
110
|
+
model: identifier.optional(),
|
|
111
|
+
effort: identifier.optional(),
|
|
112
|
+
accountId: identifier.optional(),
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
/** Input from canonical CLEO spawn preparation; Orca does not create its checkout. */
|
|
116
|
+
export type OrcaLaunch = z.infer<typeof orcaLaunchSchema>;
|
|
117
|
+
|
|
118
|
+
/** Original launch addressing, retained even when a partial receipt supplies ids. */
|
|
119
|
+
export const orcaStartBindingSchema = z.object({
|
|
120
|
+
runId: identifier.nullable(),
|
|
121
|
+
orcaTaskId: identifier.nullable(),
|
|
122
|
+
retryOf: identifier.nullable(),
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
/** Durable attempt, stored in the existing local worker record before launch. */
|
|
126
|
+
export const orcaAttemptSchema = z.object({
|
|
127
|
+
backend: z.literal('orca'),
|
|
128
|
+
version: z.literal(1),
|
|
129
|
+
/** Monotonic local CAS revision; repeated identical observations still serialize. */
|
|
130
|
+
revision: z.number().int().nonnegative(),
|
|
131
|
+
context: orcaContextSchema,
|
|
132
|
+
launch: orcaLaunchSchema,
|
|
133
|
+
promptDigest: z.string().regex(/^[a-f0-9]{64}$/),
|
|
134
|
+
workspaceId: identifier,
|
|
135
|
+
workspaceSelector: identifier,
|
|
136
|
+
state: z.enum([
|
|
137
|
+
'prepared',
|
|
138
|
+
'launching',
|
|
139
|
+
'ready',
|
|
140
|
+
'turn_unobserved',
|
|
141
|
+
'outcome_unknown',
|
|
142
|
+
'stop_pending',
|
|
143
|
+
'stop_unknown',
|
|
144
|
+
'stopped',
|
|
145
|
+
'failed',
|
|
146
|
+
'circuit_broken',
|
|
147
|
+
]),
|
|
148
|
+
runId: identifier.nullable(),
|
|
149
|
+
orcaTaskId: identifier.nullable(),
|
|
150
|
+
dispatchId: identifier.nullable(),
|
|
151
|
+
retryOf: identifier.nullable(),
|
|
152
|
+
/** Absent on legacy records, whose original argv cannot safely be reconstructed. */
|
|
153
|
+
startBinding: orcaStartBindingSchema.optional(),
|
|
154
|
+
/** UUID reserved before committing a retry; its first send and every replay use this key. */
|
|
155
|
+
startRequestKey: z.string().uuid().optional(),
|
|
156
|
+
startRequestId: identifier.nullable(),
|
|
157
|
+
/** UUID reserved before committing a stop; its first send and every replay use this key. */
|
|
158
|
+
stopRequestKey: z.string().uuid().optional(),
|
|
159
|
+
/** Orca-issued stop request id, retained only when the stop receipt was received. */
|
|
160
|
+
stopRequestId: identifier.nullable(),
|
|
161
|
+
/**
|
|
162
|
+
* Set when the worker-stop reply came from a runtime that proved it enumerates
|
|
163
|
+
* every helper it stopped, so an omitted helper list means the worker had none.
|
|
164
|
+
*/
|
|
165
|
+
stopHelperEvidence: z.literal('enumerated').optional(),
|
|
166
|
+
failureCount: z.number().int().nonnegative(),
|
|
167
|
+
resourceState: z.string(),
|
|
168
|
+
/** Full receipts retain effects, residual resources and recovery advice. */
|
|
169
|
+
lastReceipt: z.string().nullable(),
|
|
170
|
+
lastError: z.string().nullable(),
|
|
171
|
+
/** Confirmed pre-dispatch refusal; never inferred from a process exit. */
|
|
172
|
+
startRefusal: z.literal('agent_unconfigured').optional(),
|
|
173
|
+
observedAt: z.string(),
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
/** An exact execution attempt; uncertain states always retain worker custody. */
|
|
177
|
+
export type OrcaAttempt = z.infer<typeof orcaAttemptSchema>;
|
|
178
|
+
|
|
179
|
+
/** Selected worker_done transport, independent of the canonical CLEO report bytes. */
|
|
180
|
+
export const orcaWorkerDoneSchema = z.object({
|
|
181
|
+
messageId: identifier,
|
|
182
|
+
runtimeId: identifier,
|
|
183
|
+
runId: identifier,
|
|
184
|
+
orcaTaskId: identifier,
|
|
185
|
+
dispatchId: identifier,
|
|
186
|
+
senderHandle: identifier,
|
|
187
|
+
outcome: z.enum(['succeeded', 'failed']),
|
|
188
|
+
body: z.string(),
|
|
189
|
+
reportPath: identifier,
|
|
190
|
+
});
|
|
191
|
+
|
|
192
|
+
/** Provenance returned by the read-only Orca report transport. */
|
|
193
|
+
export type OrcaWorkerDone = z.infer<typeof orcaWorkerDoneSchema>;
|
|
194
|
+
|
|
195
|
+
/** Durable report settlement; no task acceptance or process-release state is implied. */
|
|
196
|
+
export const orcaWorkerReportSchema = z.object({
|
|
197
|
+
event: orcaWorkerDoneSchema,
|
|
198
|
+
manifestId: identifier,
|
|
199
|
+
manifestDigest: z.string().regex(/^[a-f0-9]{64}$/),
|
|
200
|
+
reportText: z.string().min(1).max(65_536),
|
|
201
|
+
reportDigest: z.string().regex(/^[a-f0-9]{64}$/),
|
|
202
|
+
ingestedAt: z.string().datetime(),
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
/** Validated original report and manifest link, stored on the local worker record. */
|
|
206
|
+
export type OrcaWorkerReport = z.infer<typeof orcaWorkerReportSchema>;
|
|
207
|
+
|
|
208
|
+
/** Durable AgentMBX outbox state for the first validated report of one Dispatch. */
|
|
209
|
+
export const orcaReportDeliverySchema = z.object({
|
|
210
|
+
key: identifier,
|
|
211
|
+
mailbox: identifier.nullable(),
|
|
212
|
+
state: z.enum(['pending', 'delivered']),
|
|
213
|
+
messageId: identifier.nullable(),
|
|
214
|
+
deliveredAt: z.string().datetime().nullable(),
|
|
215
|
+
lastError: z.string().nullable(),
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
/** Independent report transport acknowledgement; never CLEO acceptance evidence. */
|
|
219
|
+
export type OrcaReportDelivery = z.infer<typeof orcaReportDeliverySchema>;
|
|
220
|
+
|
|
221
|
+
/** Separate physical exit, execution retirement and logical report delivery receipts. */
|
|
222
|
+
export const orcaWorkerSettlementSchema = z.object({
|
|
223
|
+
resourceRelease: z
|
|
224
|
+
.object({
|
|
225
|
+
dispatchId: identifier,
|
|
226
|
+
releasedAt: z.string().datetime(),
|
|
227
|
+
receiptDigest: z.string().regex(/^[a-f0-9]{64}$/),
|
|
228
|
+
receipt: identifier,
|
|
229
|
+
})
|
|
230
|
+
.optional(),
|
|
231
|
+
retiredAt: z.string().datetime().optional(),
|
|
232
|
+
reportDelivery: orcaReportDeliverySchema.optional(),
|
|
233
|
+
});
|
|
234
|
+
|
|
235
|
+
/** Local-only settlement fields carried by the existing CLEO worker record. */
|
|
236
|
+
export type OrcaWorkerSettlement = z.infer<typeof orcaWorkerSettlementSchema>;
|
|
237
|
+
|
|
238
|
+
/** Full transport fields validated only for the requested inbox message id. */
|
|
239
|
+
export const orcaReportMessageSchema = z.object({
|
|
240
|
+
id: identifier,
|
|
241
|
+
run_id: z.string().nullable(),
|
|
242
|
+
delivery_contract: z.string(),
|
|
243
|
+
from_handle: z.string(),
|
|
244
|
+
to_handle: z.string(),
|
|
245
|
+
type: z.string(),
|
|
246
|
+
body: z.string(),
|
|
247
|
+
payload: z.string().nullable(),
|
|
248
|
+
sender_pane_key: z.string().nullable(),
|
|
249
|
+
});
|
|
250
|
+
|
|
251
|
+
/** Full report source envelope; unrelated inbox rows remain unvalidated JSON. */
|
|
252
|
+
export const orcaReportSourceSchema = z.object({
|
|
253
|
+
ok: z.literal(true),
|
|
254
|
+
_meta: z.object({ runtimeId: identifier }),
|
|
255
|
+
result: z.object({
|
|
256
|
+
messages: z.array(z.json()).optional(),
|
|
257
|
+
dispatch: z
|
|
258
|
+
.object({
|
|
259
|
+
id: identifier,
|
|
260
|
+
run_id: identifier,
|
|
261
|
+
task_id: identifier,
|
|
262
|
+
assignee_handle: identifier,
|
|
263
|
+
assignee_pane_key: z.string().nullable(),
|
|
264
|
+
status: z.string(),
|
|
265
|
+
})
|
|
266
|
+
.optional(),
|
|
267
|
+
}),
|
|
268
|
+
});
|
|
269
|
+
|
|
270
|
+
/** Parsed report source with subprocess diagnostics retained for target validation. */
|
|
271
|
+
export type OrcaReportSource = z.infer<typeof orcaReportSourceSchema> & {
|
|
272
|
+
command: OrcaCommandResult;
|
|
273
|
+
};
|
|
274
|
+
|
|
275
|
+
/** Fields Orca records from worker_done flags; prose never supplies a report or proof. */
|
|
276
|
+
export const orcaWorkerDonePayloadSchema = z.object({
|
|
277
|
+
taskId: identifier,
|
|
278
|
+
dispatchId: identifier,
|
|
279
|
+
outcome: z.enum(['succeeded', 'failed']),
|
|
280
|
+
reportPath: identifier,
|
|
281
|
+
});
|
|
282
|
+
|
|
283
|
+
/** Exact-record supervision request; recovery never chooses a task's newest attempt. */
|
|
284
|
+
export const orcaWorkerRequestSchema = z
|
|
285
|
+
.object({
|
|
286
|
+
action: z.enum([
|
|
287
|
+
'show',
|
|
288
|
+
'read',
|
|
289
|
+
'recover-start',
|
|
290
|
+
'recover-stop',
|
|
291
|
+
'retry',
|
|
292
|
+
'stop',
|
|
293
|
+
'ingest-report',
|
|
294
|
+
'relay-report',
|
|
295
|
+
]),
|
|
296
|
+
recordId: identifier,
|
|
297
|
+
cursor: identifier.optional(),
|
|
298
|
+
messageId: identifier.optional(),
|
|
299
|
+
})
|
|
300
|
+
.refine(({ action, cursor }) => cursor === undefined || action === 'read', {
|
|
301
|
+
message: 'A source-pinned cursor is accepted only for read.',
|
|
302
|
+
path: ['cursor'],
|
|
303
|
+
})
|
|
304
|
+
.refine(({ action, messageId }) => (action === 'ingest-report') === (messageId !== undefined), {
|
|
305
|
+
message: 'ingest-report requires an exact message id; other actions do not accept one.',
|
|
306
|
+
path: ['messageId'],
|
|
307
|
+
});
|
|
308
|
+
|
|
309
|
+
/** CLI and SDK input for inspecting or recovering one durable Orca attempt. */
|
|
310
|
+
export type OrcaWorkerRequest = z.infer<typeof orcaWorkerRequestSchema>;
|
|
311
|
+
|
|
312
|
+
/**
|
|
313
|
+
* Process-side execution port. Core owns persistence and receives this port from
|
|
314
|
+
* its caller, so it never imports an adapter that builds after core.
|
|
315
|
+
*/
|
|
316
|
+
export interface OrcaExecutionAdapter {
|
|
317
|
+
/** Verify installed commands, runtime and existing workspace before admission. */
|
|
318
|
+
preflight(
|
|
319
|
+
launch: OrcaLaunch,
|
|
320
|
+
context: OrcaContext,
|
|
321
|
+
): Promise<Pick<OrcaAttempt, 'workspaceId' | 'workspaceSelector'>>;
|
|
322
|
+
/** Start a durably reserved attempt, preserving uncertain outcomes. */
|
|
323
|
+
start(attempt: OrcaAttempt): Promise<OrcaAttempt>;
|
|
324
|
+
/** Replay only the original mutation identity, including a pre-reserved retry. */
|
|
325
|
+
replayStart(attempt: OrcaAttempt): Promise<OrcaAttempt>;
|
|
326
|
+
/** Read the exact stored Dispatch identity. */
|
|
327
|
+
show(attempt: OrcaAttempt): Promise<OrcaAttempt>;
|
|
328
|
+
/** Read a bounded output page without consuming coordinator mail. */
|
|
329
|
+
read(attempt: OrcaAttempt, cursor?: string): Promise<string>;
|
|
330
|
+
/** Fetch one current-dispatch worker_done without consuming coordinator mail. */
|
|
331
|
+
readReport(attempt: OrcaAttempt, messageId: string): Promise<OrcaWorkerDone>;
|
|
332
|
+
/** Request guarded cancellation after core reserves it durably. */
|
|
333
|
+
stop(attempt: OrcaAttempt): Promise<OrcaAttempt>;
|
|
334
|
+
/** Replay only the issued stop request on its original exact Dispatch. */
|
|
335
|
+
replayStop(attempt: OrcaAttempt): Promise<OrcaAttempt>;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
/** Host discovery port injected by product dispatch, outside the model registry. */
|
|
339
|
+
export interface OrcaRoutingAdapter extends OrcaExecutionAdapter {
|
|
340
|
+
/** Process-free admission hint; backend selection still requires verified discovery. */
|
|
341
|
+
hasContextHints(): boolean;
|
|
342
|
+
/** Null outside Orca; partial, unavailable or ambiguous contexts throw a refusal. */
|
|
343
|
+
discover(projectRoot: string): Promise<OrcaDiscovery | null>;
|
|
344
|
+
/** Inspect the exact coordinator's current Run; explicit null proves no binding. */
|
|
345
|
+
currentRun(projectRoot: string, context: OrcaContext): Promise<string | null>;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
/** Result from one bounded subprocess invocation, including nonzero JSON receipts. */
|
|
349
|
+
export interface OrcaCommandResult {
|
|
350
|
+
/** Entire stdout, with no shell or human-output parsing. */
|
|
351
|
+
stdout: string;
|
|
352
|
+
/** Diagnostic stderr. */
|
|
353
|
+
stderr: string;
|
|
354
|
+
/** Null for a transport failure or timeout; never proof of worker exit. */
|
|
355
|
+
exitCode: number | null;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
/** Process boundary; fixtures inject this instead of launching real workers. */
|
|
359
|
+
export type OrcaCommandRunner = (
|
|
360
|
+
executable: string,
|
|
361
|
+
args: readonly string[],
|
|
362
|
+
cwd: string,
|
|
363
|
+
input?: string,
|
|
364
|
+
) => Promise<OrcaCommandResult>;
|
|
365
|
+
|
|
366
|
+
const effectSchema = z.object({
|
|
367
|
+
kind: z.string(),
|
|
368
|
+
role: z.string().optional(),
|
|
369
|
+
action: z.string().optional(),
|
|
370
|
+
id: z.string().optional(),
|
|
371
|
+
});
|
|
372
|
+
const selectionSchema = z.object({
|
|
373
|
+
agent: z.string().nullable().optional(),
|
|
374
|
+
model: z.string().nullable().optional(),
|
|
375
|
+
effort: z.string().nullable().optional(),
|
|
376
|
+
});
|
|
377
|
+
|
|
378
|
+
/**
|
|
379
|
+
* Validates the wire fields used for admission and fencing. Unknown fields are
|
|
380
|
+
* ignored here and preserved in the original receipt, never treated as evidence.
|
|
381
|
+
* Audited against the installed Orca 1.4.255 full CLI views.
|
|
382
|
+
*/
|
|
383
|
+
export const orcaReplySchema = z.object({
|
|
384
|
+
ok: z.boolean(),
|
|
385
|
+
_meta: z.object({ runtimeId: z.string().nullable() }).optional(),
|
|
386
|
+
error: z
|
|
387
|
+
.object({
|
|
388
|
+
code: z.string(),
|
|
389
|
+
message: z.string(),
|
|
390
|
+
data: z
|
|
391
|
+
.object({
|
|
392
|
+
requestId: identifier.optional(),
|
|
393
|
+
orchestrationRequestId: identifier.optional(),
|
|
394
|
+
dispatchId: identifier.optional(),
|
|
395
|
+
})
|
|
396
|
+
.optional(),
|
|
397
|
+
})
|
|
398
|
+
.optional(),
|
|
399
|
+
result: z
|
|
400
|
+
.object({
|
|
401
|
+
state: z.string().optional(),
|
|
402
|
+
requestId: identifier.optional(),
|
|
403
|
+
/**
|
|
404
|
+
* Mutation ledger identity Orca stamps on every successful mutation result.
|
|
405
|
+
* @remarks Installed Orca 1.4.255 attaches `{ requestId, replayed }` to the
|
|
406
|
+
* result it records (`Jy` in the retained source), so a successful stop can
|
|
407
|
+
* be bound to the request key this attempt issued.
|
|
408
|
+
*/
|
|
409
|
+
mutation: z
|
|
410
|
+
.object({
|
|
411
|
+
requestId: identifier.optional(),
|
|
412
|
+
replayed: z.boolean().optional(),
|
|
413
|
+
})
|
|
414
|
+
.optional(),
|
|
415
|
+
stage: z.string().optional(),
|
|
416
|
+
turnStart: z.string().optional(),
|
|
417
|
+
runId: identifier.optional(),
|
|
418
|
+
run: z.object({ id: identifier }).nullable().optional(),
|
|
419
|
+
taskId: identifier.optional(),
|
|
420
|
+
dispatchId: identifier.optional(),
|
|
421
|
+
failureCount: z.number().int().nonnegative().optional(),
|
|
422
|
+
effects: z.array(effectSchema).optional(),
|
|
423
|
+
residualResources: z.array(effectSchema).optional(),
|
|
424
|
+
launch: z.object({ effective: selectionSchema.optional() }).optional(),
|
|
425
|
+
lastError: z.string().nullable().optional(),
|
|
426
|
+
processAction: z.string().optional(),
|
|
427
|
+
helpers: z
|
|
428
|
+
.array(
|
|
429
|
+
z.object({
|
|
430
|
+
dispatchId: identifier.optional(),
|
|
431
|
+
creatorDispatchId: identifier.optional(),
|
|
432
|
+
outcome: z.string(),
|
|
433
|
+
keptOpenBy: identifier.optional(),
|
|
434
|
+
state: z.string().optional(),
|
|
435
|
+
lastError: z.string().nullable().optional(),
|
|
436
|
+
}),
|
|
437
|
+
)
|
|
438
|
+
.optional(),
|
|
439
|
+
helperStopError: z.string().nullable().optional(),
|
|
440
|
+
status: z.string().optional(),
|
|
441
|
+
terminal: z
|
|
442
|
+
.object({
|
|
443
|
+
handle: identifier,
|
|
444
|
+
connected: z.boolean(),
|
|
445
|
+
writable: z.boolean(),
|
|
446
|
+
executionHostId: identifier,
|
|
447
|
+
})
|
|
448
|
+
.optional(),
|
|
449
|
+
runtime: z
|
|
450
|
+
.object({
|
|
451
|
+
runtimeId: identifier,
|
|
452
|
+
reachable: z.boolean(),
|
|
453
|
+
state: z.string(),
|
|
454
|
+
capabilities: z.array(z.string()),
|
|
455
|
+
})
|
|
456
|
+
.optional(),
|
|
457
|
+
worktree: z
|
|
458
|
+
.object({
|
|
459
|
+
id: identifier,
|
|
460
|
+
path: identifier,
|
|
461
|
+
branch: identifier,
|
|
462
|
+
hostId: identifier,
|
|
463
|
+
address: z.object({ worktree: identifier }).optional(),
|
|
464
|
+
})
|
|
465
|
+
.optional(),
|
|
466
|
+
dispatch: z
|
|
467
|
+
.object({
|
|
468
|
+
id: identifier,
|
|
469
|
+
runId: identifier,
|
|
470
|
+
taskId: identifier,
|
|
471
|
+
/** Direct creator Dispatch that started this one; null for a Run root. */
|
|
472
|
+
creatorDispatchId: identifier.nullable().optional(),
|
|
473
|
+
failureCount: z.number().int().nonnegative(),
|
|
474
|
+
})
|
|
475
|
+
.optional(),
|
|
476
|
+
worker: z
|
|
477
|
+
.object({
|
|
478
|
+
dispatchId: identifier,
|
|
479
|
+
runtimeEpoch: identifier,
|
|
480
|
+
state: z.string(),
|
|
481
|
+
stage: z.string(),
|
|
482
|
+
worktreeId: identifier.nullable(),
|
|
483
|
+
})
|
|
484
|
+
.optional(),
|
|
485
|
+
observation: z.object({ status: z.string(), exactWorker: z.boolean().optional() }).optional(),
|
|
486
|
+
projection: z
|
|
487
|
+
.object({
|
|
488
|
+
resource: z
|
|
489
|
+
.object({
|
|
490
|
+
state: z.string(),
|
|
491
|
+
terminalState: z.string(),
|
|
492
|
+
ownerDispatchId: identifier.optional(),
|
|
493
|
+
releaseState: z.string().optional(),
|
|
494
|
+
})
|
|
495
|
+
.optional(),
|
|
496
|
+
})
|
|
497
|
+
.optional(),
|
|
498
|
+
})
|
|
499
|
+
.optional(),
|
|
500
|
+
});
|
|
501
|
+
|
|
502
|
+
/** Validated subset of a full Orca response. */
|
|
503
|
+
export type OrcaReply = z.infer<typeof orcaReplySchema>;
|
|
504
|
+
|
|
505
|
+
/** Parsed fields alongside the original receipt, kept per call during parallel fanout. */
|
|
506
|
+
export type OrcaCommandReply = OrcaReply & { rawReceipt: string };
|
|
507
|
+
|
|
508
|
+
/** Installed command declarations; PATH presence alone never authorizes a launch. */
|
|
509
|
+
export const orcaCommandRegistrySchema = z.object({
|
|
510
|
+
schemaVersion: z.number().int().positive(),
|
|
511
|
+
commands: z.array(z.object({ command: identifier, flags: z.array(z.string()) })),
|
|
512
|
+
});
|
|
513
|
+
|
|
514
|
+
const accountProviderSchema = z.object({
|
|
515
|
+
accounts: z.array(z.object({})),
|
|
516
|
+
activeAccountId: identifier.nullable(),
|
|
517
|
+
});
|
|
518
|
+
|
|
519
|
+
/** Private account wire fields: account attributes are discarded during parsing. */
|
|
520
|
+
export const orcaAccountReplySchema = z.object({
|
|
521
|
+
ok: z.literal(true),
|
|
522
|
+
_meta: z.object({ runtimeId: identifier }),
|
|
523
|
+
result: z.object({
|
|
524
|
+
codex: accountProviderSchema,
|
|
525
|
+
opencode: accountProviderSchema,
|
|
526
|
+
claude: accountProviderSchema,
|
|
527
|
+
}),
|
|
528
|
+
});
|
package/src/project-context.ts
CHANGED
|
@@ -11,6 +11,8 @@
|
|
|
11
11
|
* @adr ADR-013
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
+
import type { VerificationGate } from './task.js';
|
|
15
|
+
|
|
14
16
|
/** Detected project ecosystem. Matches the writer in `detectProjectType`. */
|
|
15
17
|
export type ProjectType =
|
|
16
18
|
| 'node'
|
|
@@ -78,6 +80,14 @@ export interface ProjectEvidenceContext {
|
|
|
78
80
|
* @task T12634
|
|
79
81
|
*/
|
|
80
82
|
ciSatisfies?: boolean;
|
|
83
|
+
/**
|
|
84
|
+
* Gates a probed `deploy:` atom satisfies (T14083). No default: unset or
|
|
85
|
+
* empty, a deploy atom satisfies nothing, and never `testsPassed` unless
|
|
86
|
+
* listed here.
|
|
87
|
+
*
|
|
88
|
+
* @task T14083
|
|
89
|
+
*/
|
|
90
|
+
deploySatisfies?: VerificationGate[];
|
|
81
91
|
/**
|
|
82
92
|
* Which required checks attest each gate for `ci:<pr>`. Each list must be a
|
|
83
93
|
* subset of the required-check list; a gate without a list refuses `ci:`.
|
|
@@ -106,6 +116,24 @@ export interface ProjectEvidenceContext {
|
|
|
106
116
|
* refused (E_EVIDENCE_RUNTIME_PATH_PROTECTED). Default: none.
|
|
107
117
|
*/
|
|
108
118
|
runtimePaths?: string[];
|
|
119
|
+
/**
|
|
120
|
+
* Further git repositories this project's evidence may come from (an SDK in
|
|
121
|
+
* a separate repository, T14078). A typed gate names one by `repo`; any
|
|
122
|
+
* repository not declared here is refused.
|
|
123
|
+
*/
|
|
124
|
+
repositories?: EvidenceRepositoryDeclaration[];
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* A git repository outside the project that typed gates may run in (T14078).
|
|
129
|
+
*/
|
|
130
|
+
export interface EvidenceRepositoryDeclaration {
|
|
131
|
+
/** Name a typed gate's `repo` field uses. */
|
|
132
|
+
name: string;
|
|
133
|
+
/** The checkout's root, relative to the CLEO store root or absolute. */
|
|
134
|
+
path: string;
|
|
135
|
+
/** Why the project's evidence comes from it. */
|
|
136
|
+
purpose: string;
|
|
109
137
|
}
|
|
110
138
|
|
|
111
139
|
/**
|
|
@@ -163,6 +191,11 @@ export interface ProjectContext {
|
|
|
163
191
|
build?: {
|
|
164
192
|
command?: string;
|
|
165
193
|
outputDir?: string;
|
|
194
|
+
/**
|
|
195
|
+
* Globs, relative to the project root, of scripts that run heavy tools:
|
|
196
|
+
* `cleo run` charges them as heavy whatever their content shows (T14162).
|
|
197
|
+
*/
|
|
198
|
+
heavyScripts?: string[];
|
|
166
199
|
};
|
|
167
200
|
directories?: {
|
|
168
201
|
source?: string;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Standing release authorization (T14141 · owner decision D11215): a grant the
|
|
3
|
+
* owner signs with the enrolled owner key so a non-interactive
|
|
4
|
+
* `cleo release cut --yes` (an agent) may tag without a typed terminal
|
|
5
|
+
* confirmation.
|
|
6
|
+
*
|
|
7
|
+
* @task T14141
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* What a grant covers: `canary` (`-canary.N` versions), `prerelease` (any
|
|
12
|
+
* `-suffix`), `stable` (no suffix), or one exact `v`-prefixed version.
|
|
13
|
+
*/
|
|
14
|
+
export type ReleaseAuthorizationScope = 'canary' | 'prerelease' | 'stable' | `v${string}`;
|
|
15
|
+
|
|
16
|
+
/** One owner-signed standing release authorization. */
|
|
17
|
+
export interface ReleaseAuthorizationGrant {
|
|
18
|
+
/** Grant id (`ra-<hex>`), named in the cut audit row and the tag message. */
|
|
19
|
+
id: string;
|
|
20
|
+
/** Versions the grant covers. */
|
|
21
|
+
scope: ReleaseAuthorizationScope;
|
|
22
|
+
/** Why the owner granted it. */
|
|
23
|
+
reason: string;
|
|
24
|
+
/** ISO time the grant was issued. */
|
|
25
|
+
issuedAt: string;
|
|
26
|
+
/** ISO time it stops counting (at most 30 days after issue). */
|
|
27
|
+
expiresAt: string;
|
|
28
|
+
/** Optional cap on cuts it may allow; null = no limit (D11215). */
|
|
29
|
+
uses: number | null;
|
|
30
|
+
/** The owner decision recorded for the grant (BRAIN decision id). */
|
|
31
|
+
decisionId: string;
|
|
32
|
+
/** Revocations on record when it was issued; a shorter revocation list later means tampering. */
|
|
33
|
+
revocationsAtIssue: number;
|
|
34
|
+
/** Enrolled owner public key (hex) that signed it. */
|
|
35
|
+
ownerPubkey: string;
|
|
36
|
+
/** Ed25519 signature (hex) over the grant's fields. */
|
|
37
|
+
sig: string;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** A grant as `cleo release authorize --list` reports it. */
|
|
41
|
+
export interface ReleaseAuthorizationStatus extends ReleaseAuthorizationGrant {
|
|
42
|
+
/** Whether it currently allows a cut, and if not why. */
|
|
43
|
+
state: 'active' | 'expired' | 'used-up' | 'revoked' | 'tampered';
|
|
44
|
+
/** Cuts it has allowed (audit rows and tags naming it). */
|
|
45
|
+
used: number;
|
|
46
|
+
/** Why it is tampered, when it is. */
|
|
47
|
+
why?: string;
|
|
48
|
+
}
|
package/src/resource-governor.ts
CHANGED
|
@@ -67,6 +67,17 @@ export const RESOURCE_CLASSES: readonly ResourceClass[] = Object.freeze([
|
|
|
67
67
|
/** Error code emitted when an acquire is denied because no slot is available. */
|
|
68
68
|
export const RESOURCE_DEFERRED_CODE = 'E_RESOURCE_DEFERRED' as const;
|
|
69
69
|
|
|
70
|
+
/**
|
|
71
|
+
* `cleo run --wait` (and a queued evidence run): memory pressure held the
|
|
72
|
+
* queue above the refuse line while CLEO itself held nothing, for two notice
|
|
73
|
+
* intervals. The pressure is another program's, so waiting longer is not a
|
|
74
|
+
* plan: the verdict names those programs ({@link ExternalPressureDetails}).
|
|
75
|
+
* Nothing was started.
|
|
76
|
+
*
|
|
77
|
+
* @task T14282
|
|
78
|
+
*/
|
|
79
|
+
export const RESOURCE_EXTERNAL_PRESSURE_CODE = 'E_RESOURCE_EXTERNAL_PRESSURE' as const;
|
|
80
|
+
|
|
70
81
|
/**
|
|
71
82
|
* `cleo run`: the admitted command exited non-zero, was killed by a signal, or
|
|
72
83
|
* could not be started. The envelope's `details` carry the exit code/signal.
|
|
@@ -146,6 +157,8 @@ export interface MemoryConsumer {
|
|
|
146
157
|
* compressed and swapped pages, which `ps` RSS leaves out), on Linux its RSS.
|
|
147
158
|
*/
|
|
148
159
|
readonly footprintBytes: number;
|
|
160
|
+
/** The project it runs in (its working directory's), when known (T14206). */
|
|
161
|
+
readonly project?: string;
|
|
149
162
|
}
|
|
150
163
|
|
|
151
164
|
/** The largest memory users at one moment (T13914). */
|
|
@@ -179,6 +192,40 @@ export interface ResourceDeferral {
|
|
|
179
192
|
readonly memoryPressure?: MemoryPressureReading;
|
|
180
193
|
}
|
|
181
194
|
|
|
195
|
+
/**
|
|
196
|
+
* One process outside CLEO holding the memory behind an
|
|
197
|
+
* {@link RESOURCE_EXTERNAL_PRESSURE_CODE} verdict.
|
|
198
|
+
*
|
|
199
|
+
* @task T14282
|
|
200
|
+
*/
|
|
201
|
+
export interface ExternalPressureProcess {
|
|
202
|
+
/** Process id. */
|
|
203
|
+
readonly pid: number;
|
|
204
|
+
/** Command name, as the process table shows it. */
|
|
205
|
+
readonly command: string;
|
|
206
|
+
/** Memory it holds in bytes (macOS footprint, Linux RSS; see {@link MemoryConsumer}). */
|
|
207
|
+
readonly rssBytes: number;
|
|
208
|
+
/** The project it runs in, when known. */
|
|
209
|
+
readonly project?: string;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* Why admission gave up on a wait: pressure from processes outside CLEO
|
|
214
|
+
* ({@link RESOURCE_EXTERNAL_PRESSURE_CODE}).
|
|
215
|
+
*
|
|
216
|
+
* @task T14282
|
|
217
|
+
*/
|
|
218
|
+
export interface ExternalPressureDetails {
|
|
219
|
+
/** The largest memory users outside CLEO, largest first; empty when none could be listed. */
|
|
220
|
+
readonly topProcesses: readonly ExternalPressureProcess[];
|
|
221
|
+
/** Always `null`: CLEO cannot say when another program frees its memory. */
|
|
222
|
+
readonly expectedAdmitAt: null;
|
|
223
|
+
/** How long the run waited before the verdict. */
|
|
224
|
+
readonly waitedMs: number;
|
|
225
|
+
/** The memory gate's readings at the verdict. */
|
|
226
|
+
readonly memoryPressure: MemoryPressureReading;
|
|
227
|
+
}
|
|
228
|
+
|
|
182
229
|
/**
|
|
183
230
|
* A granted admission slot. Hold it for the lifetime of the work, then
|
|
184
231
|
* {@link ResourceGrant.release}. Releasing reaps the slot so the next acquirer
|