@claudexor/schema 1.0.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/LICENSE +21 -0
- package/README.md +16 -0
- package/dist/agent-capabilities.d.ts +366 -0
- package/dist/agent-capabilities.d.ts.map +1 -0
- package/dist/agent-capabilities.js +125 -0
- package/dist/agent-capabilities.js.map +1 -0
- package/dist/apply-eligibility.d.ts +76 -0
- package/dist/apply-eligibility.d.ts.map +1 -0
- package/dist/apply-eligibility.js +37 -0
- package/dist/apply-eligibility.js.map +1 -0
- package/dist/attachment.d.ts +69 -0
- package/dist/attachment.d.ts.map +1 -0
- package/dist/attachment.js +54 -0
- package/dist/attachment.js.map +1 -0
- package/dist/budget.d.ts +75 -0
- package/dist/budget.d.ts.map +1 -0
- package/dist/budget.js +54 -0
- package/dist/budget.js.map +1 -0
- package/dist/config.d.ts +743 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +194 -0
- package/dist/config.js.map +1 -0
- package/dist/context.d.ts +222 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +70 -0
- package/dist/context.js.map +1 -0
- package/dist/control-run-detail.d.ts +1686 -0
- package/dist/control-run-detail.d.ts.map +1 -0
- package/dist/control-run-detail.js +107 -0
- package/dist/control-run-detail.js.map +1 -0
- package/dist/control-trust.d.ts +79 -0
- package/dist/control-trust.d.ts.map +1 -0
- package/dist/control-trust.js +39 -0
- package/dist/control-trust.js.map +1 -0
- package/dist/control.d.ts +4226 -0
- package/dist/control.d.ts.map +1 -0
- package/dist/control.js +1022 -0
- package/dist/control.js.map +1 -0
- package/dist/decision.d.ts +208 -0
- package/dist/decision.d.ts.map +1 -0
- package/dist/decision.js +98 -0
- package/dist/decision.js.map +1 -0
- package/dist/events.d.ts +70 -0
- package/dist/events.d.ts.map +1 -0
- package/dist/events.js +105 -0
- package/dist/events.js.map +1 -0
- package/dist/gate.d.ts +37 -0
- package/dist/gate.d.ts.map +1 -0
- package/dist/gate.js +20 -0
- package/dist/gate.js.map +1 -0
- package/dist/harness.d.ts +1418 -0
- package/dist/harness.d.ts.map +1 -0
- package/dist/harness.js +552 -0
- package/dist/harness.js.map +1 -0
- package/dist/index.d.ts +32 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +32 -0
- package/dist/index.js.map +1 -0
- package/dist/orchestrate.d.ts +428 -0
- package/dist/orchestrate.d.ts.map +1 -0
- package/dist/orchestrate.js +246 -0
- package/dist/orchestrate.js.map +1 -0
- package/dist/primitives.d.ts +71 -0
- package/dist/primitives.d.ts.map +1 -0
- package/dist/primitives.js +114 -0
- package/dist/primitives.js.map +1 -0
- package/dist/review.d.ts +220 -0
- package/dist/review.d.ts.map +1 -0
- package/dist/review.js +91 -0
- package/dist/review.js.map +1 -0
- package/dist/route.d.ts +67 -0
- package/dist/route.d.ts.map +1 -0
- package/dist/route.js +33 -0
- package/dist/route.js.map +1 -0
- package/dist/spec.d.ts +561 -0
- package/dist/spec.d.ts.map +1 -0
- package/dist/spec.js +133 -0
- package/dist/spec.js.map +1 -0
- package/dist/surface-run-controls.d.ts +14 -0
- package/dist/surface-run-controls.d.ts.map +1 -0
- package/dist/surface-run-controls.js +142 -0
- package/dist/surface-run-controls.js.map +1 -0
- package/dist/task.d.ts +565 -0
- package/dist/task.d.ts.map +1 -0
- package/dist/task.js +186 -0
- package/dist/task.js.map +1 -0
- package/dist/telemetry.d.ts +660 -0
- package/dist/telemetry.d.ts.map +1 -0
- package/dist/telemetry.js +140 -0
- package/dist/telemetry.js.map +1 -0
- package/dist/thread.d.ts +348 -0
- package/dist/thread.d.ts.map +1 -0
- package/dist/thread.js +194 -0
- package/dist/thread.js.map +1 -0
- package/dist/workproduct.d.ts +31 -0
- package/dist/workproduct.d.ts.map +1 -0
- package/dist/workproduct.js +25 -0
- package/dist/workproduct.js.map +1 -0
- package/dist/workspace.d.ts +53 -0
- package/dist/workspace.d.ts.map +1 -0
- package/dist/workspace.js +30 -0
- package/dist/workspace.js.map +1 -0
- package/generated/AgentCapabilityCatalog.schema.json +389 -0
- package/generated/ApplyEligibility.schema.json +44 -0
- package/generated/BudgetLease.schema.json +95 -0
- package/generated/BudgetObservation.schema.json +76 -0
- package/generated/ConformanceReport.schema.json +107 -0
- package/generated/ContextPack.schema.json +186 -0
- package/generated/ControlApplyCheckRequest.schema.json +54 -0
- package/generated/ControlApplyRequest.schema.json +74 -0
- package/generated/ControlHarnessListResponse.schema.json +498 -0
- package/generated/ControlHarnessModelsResponse.schema.json +78 -0
- package/generated/ControlHarnessSettingsPatch.schema.json +130 -0
- package/generated/ControlInteractionAnswerRequest.schema.json +48 -0
- package/generated/ControlInteractionAnswerResponse.schema.json +35 -0
- package/generated/ControlPendingInteraction.schema.json +129 -0
- package/generated/ControlQueuedRunInfo.schema.json +44 -0
- package/generated/ControlRunControlRequest.schema.json +61 -0
- package/generated/ControlRunControlResponse.schema.json +40 -0
- package/generated/ControlRunDecisionRequest.schema.json +98 -0
- package/generated/ControlRunDecisionResponse.schema.json +40 -0
- package/generated/ControlRunDetail.schema.json +1925 -0
- package/generated/ControlRunStartInfo.schema.json +33 -0
- package/generated/ControlRunStartRequest.schema.json +429 -0
- package/generated/ControlRunSummary.schema.json +666 -0
- package/generated/ControlSecretListResponse.schema.json +57 -0
- package/generated/ControlSettingsSnapshot.schema.json +281 -0
- package/generated/ControlSettingsUpdateRequest.schema.json +212 -0
- package/generated/ControlSetupJob.schema.json +148 -0
- package/generated/ControlSetupJobConfirmRequest.schema.json +18 -0
- package/generated/ControlSetupJobCreateRequest.schema.json +38 -0
- package/generated/ControlSetupJobEvent.schema.json +58 -0
- package/generated/ControlSetupJobListResponse.schema.json +162 -0
- package/generated/ControlSpecFreezeRequest.schema.json +83 -0
- package/generated/ControlSpecQuestionsRequest.schema.json +80 -0
- package/generated/ControlThread.schema.json +129 -0
- package/generated/ControlThreadApplyRequest.schema.json +32 -0
- package/generated/ControlThreadApplyResponse.schema.json +47 -0
- package/generated/ControlThreadCreateRequest.schema.json +107 -0
- package/generated/ControlThreadDetail.schema.json +515 -0
- package/generated/ControlThreadListResponse.schema.json +141 -0
- package/generated/ControlThreadUpdateRequest.schema.json +46 -0
- package/generated/ControlTrustListResponse.schema.json +59 -0
- package/generated/ControlTrustState.schema.json +45 -0
- package/generated/ControlTrustUpdateRequest.schema.json +26 -0
- package/generated/DecisionRecord.schema.json +232 -0
- package/generated/GateResult.schema.json +81 -0
- package/generated/GlobalConfig.schema.json +313 -0
- package/generated/HarnessEvent.schema.json +360 -0
- package/generated/HarnessManifest.schema.json +350 -0
- package/generated/HarnessModel.schema.json +41 -0
- package/generated/HarnessStatusDto.schema.json +486 -0
- package/generated/McpRunToolResult.schema.json +91 -0
- package/generated/OrchestrateContract.schema.json +93 -0
- package/generated/OrchestratePlan.schema.json +244 -0
- package/generated/OrchestratePlanProgress.schema.json +103 -0
- package/generated/ProjectConfig.schema.json +95 -0
- package/generated/ReviewFinding.schema.json +226 -0
- package/generated/RouteFallbackPayload.schema.json +79 -0
- package/generated/RouteProof.schema.json +111 -0
- package/generated/RunControl.schema.json +51 -0
- package/generated/RunEvent.schema.json +103 -0
- package/generated/RunFailure.schema.json +98 -0
- package/generated/RunTelemetry.schema.json +433 -0
- package/generated/SecretMetadata.schema.json +34 -0
- package/generated/Session.schema.json +80 -0
- package/generated/SessionReboundLineage.schema.json +73 -0
- package/generated/SpecPack.schema.json +372 -0
- package/generated/TaskContract.schema.json +501 -0
- package/generated/Thread.schema.json +176 -0
- package/generated/ThreadTurn.schema.json +172 -0
- package/generated/TrustConfig.schema.json +44 -0
- package/generated/WorkProduct.schema.json +60 -0
- package/generated/WorkspaceEnvelope.schema.json +94 -0
- package/package.json +43 -0
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { zodToJsonSchema } from "zod-to-json-schema";
|
|
3
|
+
import { Id, ModeKind } from "./primitives.js";
|
|
4
|
+
/**
|
|
5
|
+
* The autonomous `orchestrate` planner. It is NOT a privileged harness: it is
|
|
6
|
+
* an intent routed like reviewers (doctor-ok + capability + quota headroom),
|
|
7
|
+
* sticky per thread, overridable. Its tool belt maps 1:1 onto existing engine
|
|
8
|
+
* entry points; it never grows its own business logic.
|
|
9
|
+
*
|
|
10
|
+
* Detailed per-tool input/output schemas are introduced alongside their wiring
|
|
11
|
+
* (staged-field discipline); this module fixes the tool vocabulary + contract.
|
|
12
|
+
*/
|
|
13
|
+
export const OrchestrateToolName = z
|
|
14
|
+
.enum(["start_run", "race", "status", "answer_question", "apply", "review"])
|
|
15
|
+
.describe("Tool in the orchestrate planner's belt, mapping 1:1 onto engine entry points: start_run, race (best-of-N), status, answer_question, apply, and review.");
|
|
16
|
+
/** How much the planner may act without confirmation. */
|
|
17
|
+
export const OrchestrateAutonomy = z
|
|
18
|
+
.enum(["suggest", "auto_safe", "auto_full"])
|
|
19
|
+
.describe("How much the orchestrate planner may act without confirmation: suggest (user executes the plan), auto_safe (auto-runs only provably safe steps), auto_full (auto-runs everything).");
|
|
20
|
+
export const DEFAULT_ORCHESTRATE_TOOL_BELT = [
|
|
21
|
+
"start_run",
|
|
22
|
+
"race",
|
|
23
|
+
"status",
|
|
24
|
+
"apply",
|
|
25
|
+
"review",
|
|
26
|
+
// `answer_question` is intentionally NOT offered by default: safe sub-runs are
|
|
27
|
+
// non-interactive, so an autonomously-executed plan has no pending sub-run
|
|
28
|
+
// interaction to answer. It stays in the vocabulary + executor (honest skip) for
|
|
29
|
+
// future interactive sub-runs; a caller can add it to a custom tool_belt.
|
|
30
|
+
];
|
|
31
|
+
export const OrchestrateContract = z
|
|
32
|
+
.object({
|
|
33
|
+
thread_id: Id.describe("Thread the orchestration belongs to."),
|
|
34
|
+
goal: z.string().describe("The user goal the planner is orchestrating toward."),
|
|
35
|
+
tool_belt: z
|
|
36
|
+
.array(OrchestrateToolName)
|
|
37
|
+
.default([...DEFAULT_ORCHESTRATE_TOOL_BELT])
|
|
38
|
+
.describe("Tools the planner may use this run."),
|
|
39
|
+
budget: z
|
|
40
|
+
.object({
|
|
41
|
+
max_usd: z.number().nonnegative().nullable().default(null).describe("USD cap for the whole orchestration; null = no cap."),
|
|
42
|
+
max_tool_calls: z
|
|
43
|
+
.number()
|
|
44
|
+
.int()
|
|
45
|
+
.positive()
|
|
46
|
+
.nullable()
|
|
47
|
+
.default(null)
|
|
48
|
+
.describe("Maximum tool calls the executor will run; null = no cap."),
|
|
49
|
+
})
|
|
50
|
+
.default({})
|
|
51
|
+
.describe("Budget limits for the orchestration."),
|
|
52
|
+
autonomy: OrchestrateAutonomy.default("suggest"),
|
|
53
|
+
})
|
|
54
|
+
.describe("Contract for one orchestrate run: goal, allowed tool belt, budget, and autonomy level.");
|
|
55
|
+
/**
|
|
56
|
+
* Data-driven tool-risk classification. SAFE = provably no live-tree mutation
|
|
57
|
+
* (isolated envelope sub-runs or pure reads); RISKY = mutates the live tree.
|
|
58
|
+
* This is the SSOT the executor classifies against — never a hardcoded
|
|
59
|
+
* enum-in-logic switch. `apply` is the only mutating tool.
|
|
60
|
+
*/
|
|
61
|
+
export const TOOL_RISK = {
|
|
62
|
+
start_run: "safe",
|
|
63
|
+
race: "safe",
|
|
64
|
+
status: "safe",
|
|
65
|
+
answer_question: "safe",
|
|
66
|
+
review: "safe",
|
|
67
|
+
apply: "risky",
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* Classify a tool's risk, FAIL-CLOSED: any unknown/undeclared tool is risky.
|
|
71
|
+
* The executor must never auto-run a tool it cannot prove is safe.
|
|
72
|
+
*/
|
|
73
|
+
export function toolRisk(tool) {
|
|
74
|
+
return TOOL_RISK[tool] ?? "risky";
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* One concrete tool invocation in a planner plan, with PER-TOOL TYPED args via a
|
|
78
|
+
* discriminated union on `tool`. The executor (auto_safe/auto_full) runs these
|
|
79
|
+
* in order; under `suggest` the user executes them. Args are validated by the
|
|
80
|
+
* variant — never an open `z.record` bag — so a malformed plan fails loudly.
|
|
81
|
+
*/
|
|
82
|
+
export const OrchestratePlanCall = z
|
|
83
|
+
.discriminatedUnion("tool", [
|
|
84
|
+
z
|
|
85
|
+
.object({
|
|
86
|
+
tool: z.literal("start_run"),
|
|
87
|
+
prompt: z.string().min(1).describe("Prompt for the sub-run."),
|
|
88
|
+
mode: ModeKind.default("agent").describe("Mode for the sub-run."),
|
|
89
|
+
harness: z.string().optional().describe("Harness to run on; omitted = engine routing."),
|
|
90
|
+
why: z.string().default("").describe("Planner's reason for this step."),
|
|
91
|
+
})
|
|
92
|
+
.describe("Start one isolated sub-run."),
|
|
93
|
+
z
|
|
94
|
+
.object({
|
|
95
|
+
tool: z.literal("race"),
|
|
96
|
+
prompt: z.string().min(1).describe("Prompt raced across harnesses."),
|
|
97
|
+
n: z.number().int().min(2).default(2).describe("Number of race candidates (one per harness)."),
|
|
98
|
+
why: z.string().default("").describe("Planner's reason for this step."),
|
|
99
|
+
})
|
|
100
|
+
.describe("Race the prompt as a best-of-N run."),
|
|
101
|
+
z
|
|
102
|
+
.object({
|
|
103
|
+
tool: z.literal("review"),
|
|
104
|
+
run_id: z.string().min(1).describe("Run to review."),
|
|
105
|
+
why: z.string().default("").describe("Planner's reason for this step."),
|
|
106
|
+
})
|
|
107
|
+
.describe("Review an existing run."),
|
|
108
|
+
z
|
|
109
|
+
.object({
|
|
110
|
+
tool: z.literal("status"),
|
|
111
|
+
run_id: z.string().min(1).describe("Run to inspect."),
|
|
112
|
+
why: z.string().default("").describe("Planner's reason for this step."),
|
|
113
|
+
})
|
|
114
|
+
.describe("Read the status of an existing run."),
|
|
115
|
+
z
|
|
116
|
+
.object({
|
|
117
|
+
tool: z.literal("answer_question"),
|
|
118
|
+
interaction_id: z.string().min(1).describe("Pending interaction to answer."),
|
|
119
|
+
answers: z
|
|
120
|
+
.array(z.object({
|
|
121
|
+
question_id: z.string().min(1).describe("Id of the question being answered."),
|
|
122
|
+
selected_labels: z.array(z.string()).default([]).describe("Labels of the selected options."),
|
|
123
|
+
free_text: z.string().nullable().default(null).describe("Free-text answer; null when only options were selected."),
|
|
124
|
+
}))
|
|
125
|
+
.default([])
|
|
126
|
+
.describe("Answers, one per question."),
|
|
127
|
+
why: z.string().default("").describe("Planner's reason for this step."),
|
|
128
|
+
})
|
|
129
|
+
.describe("Answer a pending interactive question of a sub-run."),
|
|
130
|
+
z
|
|
131
|
+
.object({
|
|
132
|
+
tool: z.literal("apply"),
|
|
133
|
+
run_id: z.string().min(1).describe("Run whose work product to deliver."),
|
|
134
|
+
mode: z
|
|
135
|
+
.enum(["apply", "branch", "commit", "pr"])
|
|
136
|
+
.default("apply")
|
|
137
|
+
.describe("Delivery mode: apply to the tree, or as a branch, commit, or PR."),
|
|
138
|
+
why: z.string().default("").describe("Planner's reason for this step."),
|
|
139
|
+
})
|
|
140
|
+
.describe("Deliver a run's work product to the project (the only live-tree-mutating tool)."),
|
|
141
|
+
])
|
|
142
|
+
.describe("One concrete tool invocation in a planner plan, with per-tool typed args discriminated on `tool`.");
|
|
143
|
+
/**
|
|
144
|
+
* The TYPED orchestration plan extracted from the planner's report (the fenced
|
|
145
|
+
* JSON block the orchestrate prompt requires). Persisted as
|
|
146
|
+
* `final/orchestration.yaml`; a missing/invalid block is disclosed in the
|
|
147
|
+
* summary, never silently dropped.
|
|
148
|
+
*/
|
|
149
|
+
export const OrchestratePlan = z
|
|
150
|
+
.object({
|
|
151
|
+
tool_calls: z.array(OrchestratePlanCall).min(1).describe("Ordered tool invocations of the plan."),
|
|
152
|
+
})
|
|
153
|
+
.describe("The typed orchestration plan extracted from the planner's report; persisted as final/orchestration.yaml.");
|
|
154
|
+
/** Per-step executor status (auto_safe/auto_full). */
|
|
155
|
+
export const OrchestrateStepStatus = z
|
|
156
|
+
.enum(["pending", "running", "done", "skipped", "blocked", "failed"])
|
|
157
|
+
.describe("Executor status of one plan step: pending, running, done, skipped, blocked (risky step awaiting a human), or failed.");
|
|
158
|
+
/**
|
|
159
|
+
* Typed executor progress over a plan's tool_calls. Persisted as
|
|
160
|
+
* `final/orchestration_progress.yaml` and projected into the run detail so a
|
|
161
|
+
* surface renders honest per-step outcomes (which safe steps ran, where a risky
|
|
162
|
+
* step blocked, why it stopped). Producer: the orchestrator executor; consumer:
|
|
163
|
+
* the control-api run-detail projection.
|
|
164
|
+
*/
|
|
165
|
+
export const OrchestratePlanProgress = z
|
|
166
|
+
.object({
|
|
167
|
+
steps: z
|
|
168
|
+
.array(z.object({
|
|
169
|
+
index: z.number().int().nonnegative().describe("Position of the step in the plan."),
|
|
170
|
+
tool: OrchestrateToolName,
|
|
171
|
+
risk: z.enum(["safe", "risky"]).describe("Risk class of the step: safe (no live-tree mutation) or risky."),
|
|
172
|
+
status: OrchestrateStepStatus,
|
|
173
|
+
/** Sub-run id this step started/targeted (start_run/race/review/status/apply), when known. */
|
|
174
|
+
run_id: z.string().nullable().default(null).describe("Sub-run id this step started/targeted, when known."),
|
|
175
|
+
detail: z.string().nullable().default(null).describe("Human-readable step detail."),
|
|
176
|
+
}))
|
|
177
|
+
.default([])
|
|
178
|
+
.describe("Per-step outcomes, in plan order."),
|
|
179
|
+
autonomy: OrchestrateAutonomy,
|
|
180
|
+
/** Set when the executor stopped early (first risky step under auto_safe, budget, abort). */
|
|
181
|
+
stopped_reason: z
|
|
182
|
+
.string()
|
|
183
|
+
.nullable()
|
|
184
|
+
.default(null)
|
|
185
|
+
.describe("Set when the executor stopped early (first risky step under auto_safe, budget, abort)."),
|
|
186
|
+
})
|
|
187
|
+
.describe("Typed executor progress over a plan's tool calls, persisted as final/orchestration_progress.yaml and projected into run detail.");
|
|
188
|
+
/**
|
|
189
|
+
* JSON Schema for the planner's typed plan, computed from the LIVE Zod shape
|
|
190
|
+
* (the SSOT) — passed as HarnessRunSpec.output_schema so schema-capable CLIs
|
|
191
|
+
* constrain their final message to a valid OrchestratePlan.
|
|
192
|
+
*/
|
|
193
|
+
let orchestratePlanJsonSchemaCache = null;
|
|
194
|
+
export function orchestratePlanJsonSchema() {
|
|
195
|
+
// INLINE root (no name/$ref wrapper): claude materializes --json-schema as
|
|
196
|
+
// a StructuredOutput TOOL whose input_schema must carry a top-level "type"
|
|
197
|
+
// — a $ref-wrapped root 400s (LIVE-VERIFIED). Codex accepts both.
|
|
198
|
+
orchestratePlanJsonSchemaCache ??= strictifyForStructuredOutput(zodToJsonSchema(OrchestratePlan, { $refStrategy: "none" }));
|
|
199
|
+
return orchestratePlanJsonSchemaCache;
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Vendor STRICT structured-output mode (LIVE-VERIFIED against codex 0.137 /
|
|
203
|
+
* the OpenAI Responses API): every object must list ALL property keys in
|
|
204
|
+
* `required` and set `additionalProperties: false` — optional-with-default
|
|
205
|
+
* fields become always-emitted (their Zod defaults make explicit values
|
|
206
|
+
* equivalent). One owner for the transform; a schema that violates this is
|
|
207
|
+
* rejected by the vendor with invalid_json_schema.
|
|
208
|
+
*/
|
|
209
|
+
function strictifyForStructuredOutput(node) {
|
|
210
|
+
const walk = (value) => {
|
|
211
|
+
if (Array.isArray(value))
|
|
212
|
+
return value.map(walk);
|
|
213
|
+
if (!value || typeof value !== "object")
|
|
214
|
+
return value;
|
|
215
|
+
const obj = { ...value };
|
|
216
|
+
for (const key of Object.keys(obj))
|
|
217
|
+
obj[key] = walk(obj[key]);
|
|
218
|
+
if (obj["type"] === "object" && obj["properties"] && typeof obj["properties"] === "object") {
|
|
219
|
+
const props = obj["properties"];
|
|
220
|
+
const originallyRequired = new Set(Array.isArray(obj["required"]) ? obj["required"] : []);
|
|
221
|
+
// Vendor strict mode demands required = ALL keys; fields that were
|
|
222
|
+
// OPTIONAL in the source schema stay expressible by becoming NULLABLE
|
|
223
|
+
// (the OpenAI strict-mode recipe) — otherwise the model would be FORCED
|
|
224
|
+
// to invent values for e.g. start_run.harness on every call.
|
|
225
|
+
for (const key of Object.keys(props)) {
|
|
226
|
+
if (originallyRequired.has(key))
|
|
227
|
+
continue;
|
|
228
|
+
const prop = props[key];
|
|
229
|
+
if (prop && typeof prop === "object" && !Array.isArray(prop)) {
|
|
230
|
+
const p = prop;
|
|
231
|
+
if (typeof p["type"] === "string" && p["type"] !== "null") {
|
|
232
|
+
p["type"] = [p["type"], "null"];
|
|
233
|
+
}
|
|
234
|
+
else if (Array.isArray(p["type"]) && !p["type"].includes("null")) {
|
|
235
|
+
p["type"].push("null");
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
obj["required"] = Object.keys(props);
|
|
240
|
+
obj["additionalProperties"] = false;
|
|
241
|
+
}
|
|
242
|
+
return obj;
|
|
243
|
+
};
|
|
244
|
+
return walk(node);
|
|
245
|
+
}
|
|
246
|
+
//# sourceMappingURL=orchestrate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orchestrate.js","sourceRoot":"","sources":["../src/orchestrate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,EAAE,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAE/C;;;;;;;;GAQG;AAEH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC;KACjC,IAAI,CAAC,CAAC,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,iBAAiB,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;KAC3E,QAAQ,CACP,wJAAwJ,CACzJ,CAAC;AAGJ,yDAAyD;AACzD,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC;KACjC,IAAI,CAAC,CAAC,SAAS,EAAE,WAAW,EAAE,WAAW,CAAC,CAAC;KAC3C,QAAQ,CACP,oLAAoL,CACrL,CAAC;AAGJ,MAAM,CAAC,MAAM,6BAA6B,GAA0B;IAClE,WAAW;IACX,MAAM;IACN,QAAQ;IACR,OAAO;IACP,QAAQ;IACR,+EAA+E;IAC/E,2EAA2E;IAC3E,iF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AA+B,CAAC;oBAC1C,IAAI,OAAO,CAAC,CAAC,MAAM,CAAC,KAAK,QAAQ,IAAI,CAAC,CAAC,MAAM,CAAC,KAAK,MAAM,EAAE,CAAC;wBAC1D,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC;oBAClC,CAAC;yBAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,CAAE,CAAC,CAAC,MAAM,CAAe,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;wBACjF,CAAC,CAAC,MAAM,CAAe,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;oBACxC,CAAC;gBACH,CAAC;YACH,CAAC;YACD,GAAG,CAAC,UAAU,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YACrC,GAAG,CAAC,sBAAsB,CAAC,GAAG,KAAK,CAAC;QACtC,CAAC;QACD,OAAO,GAAG,CAAC;IACb,CAAC,CAAC;IACF,OAAO,IAAI,CAAC,IAAI,CAA4B,CAAC;AAC/C,CAAC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/** Current schema version for top-level artifacts. Bump on breaking ABI changes. */
|
|
3
|
+
export declare const SCHEMA_VERSION: 2;
|
|
4
|
+
export declare const SchemaVersion: z.ZodLiteral<2>;
|
|
5
|
+
/** A non-empty identifier string. */
|
|
6
|
+
export declare const Id: z.ZodString;
|
|
7
|
+
export type Id = z.infer<typeof Id>;
|
|
8
|
+
/** A user-supplied scalar that must contain visible content, not just spaces. */
|
|
9
|
+
export declare const NonBlankString: z.ZodString;
|
|
10
|
+
export type NonBlankString = z.infer<typeof NonBlankString>;
|
|
11
|
+
/** ISO-8601 timestamp string. */
|
|
12
|
+
export declare const IsoTimestamp: z.ZodString;
|
|
13
|
+
export type IsoTimestamp = z.infer<typeof IsoTimestamp>;
|
|
14
|
+
/** A content hash (algo:hex), e.g. "sha256:abcd...". */
|
|
15
|
+
export declare const ContentHash: z.ZodString;
|
|
16
|
+
export type ContentHash = z.infer<typeof ContentHash>;
|
|
17
|
+
export declare const RiskLevel: z.ZodEnum<["low", "medium", "high", "critical"]>;
|
|
18
|
+
export type RiskLevel = z.infer<typeof RiskLevel>;
|
|
19
|
+
export declare const AccessProfile: z.ZodEnum<["readonly", "workspace_write", "full", "external_sandbox_full", "inherit_native"]>;
|
|
20
|
+
export type AccessProfile = z.infer<typeof AccessProfile>;
|
|
21
|
+
/** External context policy is separate from process/network sandboxing. */
|
|
22
|
+
export declare const ExternalContextPolicy: z.ZodEnum<["off", "auto", "cached", "live"]>;
|
|
23
|
+
export type ExternalContextPolicy = z.infer<typeof ExternalContextPolicy>;
|
|
24
|
+
/** Whether a terminal run also has a loaded user-facing output artifact. */
|
|
25
|
+
export declare const OutputReadyState: z.ZodEnum<["pending", "finalizing", "ready", "diagnostic"]>;
|
|
26
|
+
export type OutputReadyState = z.infer<typeof OutputReadyState>;
|
|
27
|
+
/** Provider families used for route-diversity reasoning. Open-ended via "unknown". */
|
|
28
|
+
export declare const ProviderFamily: z.ZodEnum<["openai", "anthropic", "google", "cursor", "opencode", "xai", "local", "unknown"]>;
|
|
29
|
+
export type ProviderFamily = z.infer<typeof ProviderFamily>;
|
|
30
|
+
/**
|
|
31
|
+
* Canonical modes (v0.9 collapse, BREAKING): the 9 v0.8 ids shrank to 5
|
|
32
|
+
* intents-on-a-thread. The old engine strategies became FLAGS, not modes:
|
|
33
|
+
* `best_of_n` -> agent + n, `max_attempts` -> agent + attempts,
|
|
34
|
+
* `until_clean` -> agent + until_clean, `create` -> agent + create,
|
|
35
|
+
* `explore` -> audit + swarm, `readonly_audit` -> audit. Old ids hard-error
|
|
36
|
+
* at every wire boundary (Bible: modes are canonical and breaking, never
|
|
37
|
+
* silent aliases). `orchestrate` is the autonomous coordinator intent.
|
|
38
|
+
*/
|
|
39
|
+
export declare const ModeKind: z.ZodEnum<["ask", "plan", "audit", "agent", "orchestrate"]>;
|
|
40
|
+
export type ModeKind = z.infer<typeof ModeKind>;
|
|
41
|
+
/** Canonical intents a harness can be assigned. Roles are intents, never fixed
|
|
42
|
+
* classes. (`compare`/`arbitrate` were retired in the v0.15 triage: no run
|
|
43
|
+
* site ever requested them — comparison/arbitration are engine phases, not
|
|
44
|
+
* harness assignments. `verify` stays for the FinalVerifier.) */
|
|
45
|
+
export declare const Intent: z.ZodEnum<["plan", "spec", "implement", "create_from_scratch", "repair", "review", "verify", "synthesize", "explain", "audit", "orchestrate"]>;
|
|
46
|
+
export type Intent = z.infer<typeof Intent>;
|
|
47
|
+
/**
|
|
48
|
+
* How a dirty working tree is handled when creating an envelope: `snapshot`
|
|
49
|
+
* captures the dirty state as the base SHA without touching the live tree;
|
|
50
|
+
* `refuse` fails loudly. (The `include`/`stash` aliases and the untested
|
|
51
|
+
* `copy` variant were retired in the v0.15 triage — every production call
|
|
52
|
+
* site passes `snapshot`.)
|
|
53
|
+
*/
|
|
54
|
+
export declare const DirtyPolicy: z.ZodEnum<["refuse", "snapshot"]>;
|
|
55
|
+
export type DirtyPolicy = z.infer<typeof DirtyPolicy>;
|
|
56
|
+
/**
|
|
57
|
+
* A user's preferred auth route for a harness, thread, or the orchestrate planner.
|
|
58
|
+
* `subscription` = native/OAuth session; `api_key` = a stored API key; `auto`
|
|
59
|
+
* lets the engine pick subscription-first and fall back per policy. This is a
|
|
60
|
+
* preference, not a secret — the actual key refs live in global/trust config.
|
|
61
|
+
*/
|
|
62
|
+
export declare const AuthPreference: z.ZodEnum<["subscription", "api_key", "auto"]>;
|
|
63
|
+
export type AuthPreference = z.infer<typeof AuthPreference>;
|
|
64
|
+
/**
|
|
65
|
+
* Typed reason an auto-fallback (route/auth switch) or session re-host happened.
|
|
66
|
+
* Fallback decisions are driven by typed budget/quota signals and events, never
|
|
67
|
+
* by regex over model/CLI prose (Bible: no regex governance).
|
|
68
|
+
*/
|
|
69
|
+
export declare const FallbackReason: z.ZodEnum<["quota_exhausted", "money_exhausted", "subscription_exhausted", "rate_limited", "harness_error", "stall", "web_evidence_unsatisfied", "fallback_model", "not_portable", "auth_unavailable", "readiness_preferred", "manual"]>;
|
|
70
|
+
export type FallbackReason = z.infer<typeof FallbackReason>;
|
|
71
|
+
//# sourceMappingURL=primitives.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"primitives.d.ts","sourceRoot":"","sources":["../src/primitives.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,oFAAoF;AACpF,eAAO,MAAM,cAAc,EAAG,CAAU,CAAC;AAEzC,eAAO,MAAM,aAAa,iBAEoD,CAAC;AAE/E,qCAAqC;AACrC,eAAO,MAAM,EAAE,aAA6D,CAAC;AAC7E,MAAM,MAAM,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;AAEpC,iFAAiF;AACjF,eAAO,MAAM,cAAc,aAIgE,CAAC;AAC5F,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAE5D,iCAAiC;AACjC,eAAO,MAAM,YAAY,aAA2D,CAAC;AACrF,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAExD,wDAAwD;AACxD,eAAO,MAAM,WAAW,aAAsF,CAAC;AAC/G,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAEtD,eAAO,MAAM,SAAS,kDAE0D,CAAC;AACjF,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,SAAS,CAAC,CAAC;AAElD,eAAO,MAAM,aAAa,+FAIvB,CAAC;AACJ,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC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
4
|
+
export const SchemaVersion = z
|
|
5
|
+
.literal(SCHEMA_VERSION)
|
|
6
|
+
.describe("Schema version of the artifact; bumped on breaking ABI changes.");
|
|
7
|
+
/** A non-empty identifier string. */
|
|
8
|
+
export const Id = z.string().min(1).describe("Non-empty identifier string.");
|
|
9
|
+
/** A user-supplied scalar that must contain visible content, not just spaces. */
|
|
10
|
+
export const NonBlankString = z
|
|
11
|
+
.string()
|
|
12
|
+
.min(1)
|
|
13
|
+
.regex(/\S/, "must contain non-whitespace")
|
|
14
|
+
.describe("User-supplied string that must contain visible content, not just whitespace.");
|
|
15
|
+
/** ISO-8601 timestamp string. */
|
|
16
|
+
export const IsoTimestamp = z.string().min(1).describe("ISO-8601 timestamp string.");
|
|
17
|
+
/** A content hash (algo:hex), e.g. "sha256:abcd...". */
|
|
18
|
+
export const ContentHash = z.string().min(1).describe('Content hash in algo:hex form, e.g. "sha256:abcd...".');
|
|
19
|
+
export const RiskLevel = z
|
|
20
|
+
.enum(["low", "medium", "high", "critical"])
|
|
21
|
+
.describe("Risk classification of a change or finding, from low to critical.");
|
|
22
|
+
export const AccessProfile = z
|
|
23
|
+
.enum(["readonly", "workspace_write", "full", "external_sandbox_full", "inherit_native"])
|
|
24
|
+
.describe("Filesystem/command access profile for a run: readonly (no writes), workspace_write (writes inside the workspace only), full (unrestricted; requires the per-repo trust allow), external_sandbox_full (full access inside an external sandbox), inherit_native (defer to the harness's own native sandbox settings).");
|
|
25
|
+
/** External context policy is separate from process/network sandboxing. */
|
|
26
|
+
export const ExternalContextPolicy = z
|
|
27
|
+
.enum(["off", "auto", "cached", "live"])
|
|
28
|
+
.describe("External web/context policy for a run: off (no external context), auto (engine decides), cached (cached sources only), live (live web access). Separate from process/network sandboxing.");
|
|
29
|
+
/** Whether a terminal run also has a loaded user-facing output artifact. */
|
|
30
|
+
export const OutputReadyState = z
|
|
31
|
+
.enum(["pending", "finalizing", "ready", "diagnostic"])
|
|
32
|
+
.describe("Whether a terminal run also has a loaded user-facing output artifact: pending (not yet), finalizing (being produced), ready (loaded), diagnostic (only diagnostic output).");
|
|
33
|
+
/** Provider families used for route-diversity reasoning. Open-ended via "unknown". */
|
|
34
|
+
export const ProviderFamily = z
|
|
35
|
+
.enum(["openai", "anthropic", "google", "cursor", "opencode", "xai", "local", "unknown"])
|
|
36
|
+
.describe('Vendor/provider family a harness routes to, used for route-diversity reasoning; open-ended via "unknown".');
|
|
37
|
+
/**
|
|
38
|
+
* Canonical modes (v0.9 collapse, BREAKING): the 9 v0.8 ids shrank to 5
|
|
39
|
+
* intents-on-a-thread. The old engine strategies became FLAGS, not modes:
|
|
40
|
+
* `best_of_n` -> agent + n, `max_attempts` -> agent + attempts,
|
|
41
|
+
* `until_clean` -> agent + until_clean, `create` -> agent + create,
|
|
42
|
+
* `explore` -> audit + swarm, `readonly_audit` -> audit. Old ids hard-error
|
|
43
|
+
* at every wire boundary (Bible: modes are canonical and breaking, never
|
|
44
|
+
* silent aliases). `orchestrate` is the autonomous coordinator intent.
|
|
45
|
+
*/
|
|
46
|
+
export const ModeKind = z
|
|
47
|
+
.enum(["ask", "plan", "audit", "agent", "orchestrate"])
|
|
48
|
+
.describe("Canonical run mode: ask, plan, and audit are read-only; agent writes; orchestrate is the autonomous coordinator intent. Engine strategies (race, attempts, swarm, create) are flags on a mode, not modes.");
|
|
49
|
+
/** Canonical intents a harness can be assigned. Roles are intents, never fixed
|
|
50
|
+
* classes. (`compare`/`arbitrate` were retired in the v0.15 triage: no run
|
|
51
|
+
* site ever requested them — comparison/arbitration are engine phases, not
|
|
52
|
+
* harness assignments. `verify` stays for the FinalVerifier.) */
|
|
53
|
+
export const Intent = z
|
|
54
|
+
.enum([
|
|
55
|
+
"plan",
|
|
56
|
+
"spec",
|
|
57
|
+
"implement",
|
|
58
|
+
"create_from_scratch",
|
|
59
|
+
"repair",
|
|
60
|
+
"review",
|
|
61
|
+
"verify",
|
|
62
|
+
"synthesize",
|
|
63
|
+
"explain",
|
|
64
|
+
"audit",
|
|
65
|
+
"orchestrate",
|
|
66
|
+
])
|
|
67
|
+
.describe("Canonical intent a harness can be assigned for a session (roles are intents, never fixed classes).");
|
|
68
|
+
/**
|
|
69
|
+
* How a dirty working tree is handled when creating an envelope: `snapshot`
|
|
70
|
+
* captures the dirty state as the base SHA without touching the live tree;
|
|
71
|
+
* `refuse` fails loudly. (The `include`/`stash` aliases and the untested
|
|
72
|
+
* `copy` variant were retired in the v0.15 triage — every production call
|
|
73
|
+
* site passes `snapshot`.)
|
|
74
|
+
*/
|
|
75
|
+
export const DirtyPolicy = z
|
|
76
|
+
.enum(["refuse", "snapshot"])
|
|
77
|
+
.describe("How a dirty working tree is handled when creating an envelope: snapshot captures the dirty state as the base SHA without touching the live tree; refuse fails loudly.");
|
|
78
|
+
/**
|
|
79
|
+
* A user's preferred auth route for a harness, thread, or the orchestrate planner.
|
|
80
|
+
* `subscription` = native/OAuth session; `api_key` = a stored API key; `auto`
|
|
81
|
+
* lets the engine pick subscription-first and fall back per policy. This is a
|
|
82
|
+
* preference, not a secret — the actual key refs live in global/trust config.
|
|
83
|
+
*/
|
|
84
|
+
export const AuthPreference = z
|
|
85
|
+
.enum(["subscription", "api_key", "auto"])
|
|
86
|
+
.describe("Preferred auth route: subscription (native/OAuth session), api_key (a stored API key), or auto (engine picks subscription-first with policy fallback). A preference, not a secret.");
|
|
87
|
+
/**
|
|
88
|
+
* Typed reason an auto-fallback (route/auth switch) or session re-host happened.
|
|
89
|
+
* Fallback decisions are driven by typed budget/quota signals and events, never
|
|
90
|
+
* by regex over model/CLI prose (Bible: no regex governance).
|
|
91
|
+
*/
|
|
92
|
+
export const FallbackReason = z
|
|
93
|
+
.enum([
|
|
94
|
+
"quota_exhausted",
|
|
95
|
+
"money_exhausted",
|
|
96
|
+
"subscription_exhausted",
|
|
97
|
+
"rate_limited",
|
|
98
|
+
"harness_error",
|
|
99
|
+
"stall",
|
|
100
|
+
"web_evidence_unsatisfied",
|
|
101
|
+
"fallback_model",
|
|
102
|
+
/** A native vendor session could not be carried into an isolated envelope
|
|
103
|
+
* turn (write/race candidate runs fresh; continuity rides on the tree). */
|
|
104
|
+
"not_portable",
|
|
105
|
+
/** No usable auth source for the route (native session + api key both absent). */
|
|
106
|
+
"auth_unavailable",
|
|
107
|
+
/** Auto routing selected a doctor/smoke-proven route over another available
|
|
108
|
+
* auth source; used to disclose cost/readiness tradeoffs without implying the
|
|
109
|
+
* other source was missing. */
|
|
110
|
+
"readiness_preferred",
|
|
111
|
+
"manual",
|
|
112
|
+
])
|
|
113
|
+
.describe("Typed reason an auto-fallback (route/auth switch) or session re-host happened, driven by typed budget/quota signals and events, never by regex over prose.");
|
|
114
|
+
//# sourceMappingURL=primitives.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"primitives.js","sourceRoot":"","sources":["../src/primitives.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,oFAAoF;AACpF,MAAM,CAAC,MAAM,cAAc,GAAG,CAAU,CAAC;AAEzC,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC;KAC3B,OAAO,CAAC,cAAc,CAAC;KACvB,QAAQ,CAAC,iEAAiE,CAAC,CAAC;AAE/E,qCAAqC;AACrC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,8BAA8B,CAAC,CAAC;AAG7E,iFAAiF;AACjF,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC;KAC5B,MAAM,EAAE;KACR,GAAG,CAAC,CAAC,CAAC;KACN,KAAK,CAAC,IAAI,EAAE,6BAA6B,CAAC;KAC1C,QAAQ,CAAC,8EAA8E,CAAC,CAAC;AAG5F,iCAAiC;AACjC,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,4BAA4B,CAA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