intentdna 1.9.0 → 1.9.3

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 (131) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/README.md +227 -87
  4. package/dist/cli/commands/run-lifecycle.d.ts +61 -11
  5. package/dist/cli/commands/run-lifecycle.js +184 -50
  6. package/dist/cli/commands/run-observer.d.ts +15 -0
  7. package/dist/cli/commands/run-observer.js +210 -0
  8. package/dist/cli/commands/run.d.ts +16 -20
  9. package/dist/cli/commands/run.js +461 -659
  10. package/dist/cli/commands/sync.js +16 -12
  11. package/dist/cli/index.js +14 -5
  12. package/dist/compiler/compile.d.ts +1 -0
  13. package/dist/compiler/compile.js +1 -1
  14. package/dist/compiler/controller.d.ts +16 -0
  15. package/dist/compiler/controller.js +693 -0
  16. package/dist/compiler/input-resolver.d.ts +2 -0
  17. package/dist/compiler/input-resolver.js +22 -6
  18. package/dist/hooks/cli.d.ts +45 -0
  19. package/dist/hooks/cli.js +263 -31
  20. package/dist/hooks/host-event.d.ts +57 -0
  21. package/dist/hooks/host-event.js +187 -0
  22. package/dist/hooks/index.d.ts +1 -0
  23. package/dist/hooks/index.js +1 -0
  24. package/dist/hooks/protocol.d.ts +7 -0
  25. package/dist/hooks/schema.d.ts +1 -0
  26. package/dist/hooks/schema.js +89 -1
  27. package/dist/hooks/state.d.ts +23 -1
  28. package/dist/hooks/state.js +9 -0
  29. package/dist/index.d.ts +1 -0
  30. package/dist/index.js +1 -0
  31. package/dist/mcp/index.js +2 -0
  32. package/dist/mcp/tools-run.d.ts +4 -0
  33. package/dist/mcp/tools-run.js +419 -0
  34. package/dist/mcp/tools-state.d.ts +1 -1
  35. package/dist/mcp/tools-state.js +13 -241
  36. package/dist/runtime/artifact-store.d.ts +146 -0
  37. package/dist/runtime/artifact-store.js +1436 -0
  38. package/dist/runtime/canonical-attempt-outcome.d.ts +12 -0
  39. package/dist/runtime/canonical-attempt-outcome.js +195 -0
  40. package/dist/runtime/canonical-json.d.ts +10 -0
  41. package/dist/runtime/canonical-json.js +105 -0
  42. package/dist/runtime/canonical-run-application.d.ts +93 -0
  43. package/dist/runtime/canonical-run-application.js +229 -0
  44. package/dist/runtime/canonical-run-service.d.ts +454 -0
  45. package/dist/runtime/canonical-run-service.js +4760 -0
  46. package/dist/runtime/canonical-runtime-composition.d.ts +22 -0
  47. package/dist/runtime/canonical-runtime-composition.js +34 -0
  48. package/dist/runtime/canonical-runtime-projection.d.ts +3 -0
  49. package/dist/runtime/canonical-runtime-projection.js +4 -0
  50. package/dist/runtime/canonical-target-compiler.d.ts +46 -0
  51. package/dist/runtime/canonical-target-compiler.js +514 -0
  52. package/dist/runtime/claude-agent-identity.d.ts +2 -0
  53. package/dist/runtime/claude-agent-identity.js +21 -0
  54. package/dist/runtime/executable-run-plan.d.ts +328 -0
  55. package/dist/runtime/executable-run-plan.js +1485 -0
  56. package/dist/runtime/execution-authority.d.ts +83 -0
  57. package/dist/runtime/execution-authority.js +98 -0
  58. package/dist/runtime/handoff-resolver.js +4 -1
  59. package/dist/runtime/harness-pull-adapter.d.ts +146 -0
  60. package/dist/runtime/harness-pull-adapter.js +315 -0
  61. package/dist/runtime/index.d.ts +39 -14
  62. package/dist/runtime/index.js +29 -7
  63. package/dist/runtime/local-execution-authority.d.ts +194 -0
  64. package/dist/runtime/local-execution-authority.js +2897 -0
  65. package/dist/runtime/local-execution-reconciliation.d.ts +20 -0
  66. package/dist/runtime/local-execution-reconciliation.js +107 -0
  67. package/dist/runtime/local-execution-supervisor-script.d.ts +7 -0
  68. package/dist/runtime/local-execution-supervisor-script.js +793 -0
  69. package/dist/runtime/local-provider-sandbox.d.ts +42 -0
  70. package/dist/runtime/local-provider-sandbox.js +154 -0
  71. package/dist/runtime/local-verifier-execution.d.ts +24 -0
  72. package/dist/runtime/local-verifier-execution.js +290 -0
  73. package/dist/runtime/local-windows-execution-supervisor-script.d.ts +6 -0
  74. package/dist/runtime/local-windows-execution-supervisor-script.js +788 -0
  75. package/dist/runtime/plan-store.d.ts +30 -0
  76. package/dist/runtime/plan-store.js +231 -0
  77. package/dist/runtime/process-tree.d.ts +9 -0
  78. package/dist/runtime/process-tree.js +97 -24
  79. package/dist/runtime/providers/codex.js +2 -2
  80. package/dist/runtime/push-driver.d.ts +184 -0
  81. package/dist/runtime/push-driver.js +1002 -0
  82. package/dist/runtime/result-store.d.ts +34 -3
  83. package/dist/runtime/result-store.js +1073 -2
  84. package/dist/runtime/run-binding.d.ts +68 -0
  85. package/dist/runtime/run-binding.js +278 -0
  86. package/dist/runtime/run-contracts.d.ts +575 -0
  87. package/dist/runtime/run-contracts.js +58 -7
  88. package/dist/runtime/run-controller.d.ts +1 -6
  89. package/dist/runtime/run-controller.js +0 -41
  90. package/dist/runtime/run-store.d.ts +85 -7
  91. package/dist/runtime/run-store.js +2528 -186
  92. package/dist/runtime/skill-adapter.d.ts +18 -7
  93. package/dist/runtime/skill-adapter.js +100 -742
  94. package/dist/runtime/structured-output-validator.d.ts +44 -0
  95. package/dist/runtime/structured-output-validator.js +171 -0
  96. package/dist/runtime/verifier-command-binding.d.ts +22 -0
  97. package/dist/runtime/verifier-command-binding.js +162 -0
  98. package/dist/runtime/verifier.d.ts +46 -6
  99. package/dist/runtime/verifier.js +355 -53
  100. package/dist/runtime/windows-job-keeper.d.ts +47 -0
  101. package/dist/runtime/windows-job-keeper.js +231 -0
  102. package/dist/runtime/worker-executor.d.ts +17 -1
  103. package/dist/runtime/worker-executor.js +26 -5
  104. package/dist/runtime/workflow-plan-adapter.d.ts +19 -0
  105. package/dist/runtime/workflow-plan-adapter.js +502 -6
  106. package/dist/runtime/workflow-runtime-manifest.d.ts +1 -0
  107. package/dist/runtime/workflow-runtime-manifest.js +5 -0
  108. package/dist/runtime/workspace-isolation.d.ts +29 -2
  109. package/dist/runtime/workspace-isolation.js +488 -11
  110. package/dist/runtime/workspace-observation.d.ts +44 -0
  111. package/dist/runtime/workspace-observation.js +216 -0
  112. package/dist/schema/controller-registry.d.ts +0 -7
  113. package/dist/schema/controller-registry.js +0 -8
  114. package/dist/schema/types.d.ts +84 -10
  115. package/dist/schema/types.js +2 -0
  116. package/dist/schema/validate.js +151 -1
  117. package/dist/schema/validators/controllers.d.ts +1 -1
  118. package/dist/schema/validators/controllers.js +126 -41
  119. package/dist/schema/workflow-authoring-contract.js +2 -0
  120. package/dist/schema/yaml-parser.js +1 -1
  121. package/dist/templates/flutter-rewrite-new.dna.yaml +1 -0
  122. package/dist/templates/flutter-rewrite.dna.yaml +87 -60
  123. package/dist/templates/safe-refactoring.dna.yaml +1 -0
  124. package/native/windows-job-keeper/README.md +80 -0
  125. package/native/windows-job-keeper/bin/aarch64/intentdna-windows-job-keeper.exe +0 -0
  126. package/native/windows-job-keeper/bin/x86_64/intentdna-windows-job-keeper.exe +0 -0
  127. package/native/windows-job-keeper/keeper.c +979 -0
  128. package/native/windows-job-keeper/manifest.json +33 -0
  129. package/package.json +6 -2
  130. package/scripts/build-windows-job-keeper.mjs +172 -0
  131. package/scripts/verify-windows-job-keeper.mjs +184 -0
@@ -0,0 +1,68 @@
1
+ import { type CanonicalJsonValue } from "./canonical-json.js";
2
+ import { type Sha256Digest, type StoredExecutableRunPlan } from "./executable-run-plan.js";
3
+ export declare const RUN_BINDING_SCHEMA_VERSION = "intentdna.run_binding.v1";
4
+ export declare const STORED_RUN_BINDING_SCHEMA_VERSION = "intentdna.stored_run_binding.v1";
5
+ export interface SecretReference {
6
+ readonly input_name: string;
7
+ readonly source: "environment" | "file" | "keychain" | "external";
8
+ readonly reference: string;
9
+ }
10
+ export interface ProviderCredentialReference {
11
+ readonly name: string;
12
+ readonly source: "environment" | "file" | "keychain" | "external";
13
+ readonly reference: string;
14
+ }
15
+ export interface ProviderOptions {
16
+ readonly reasoning_effort?: "low" | "medium" | "high" | "xhigh" | "max" | "ultra";
17
+ readonly temperature?: number;
18
+ readonly max_output_tokens?: number;
19
+ readonly executable?: string;
20
+ readonly max_budget_usd?: number;
21
+ readonly permission_mode?: string;
22
+ }
23
+ export interface ProviderConfiguration {
24
+ readonly provider: string;
25
+ readonly model: string | null;
26
+ readonly options: ProviderOptions;
27
+ readonly credential_references: readonly ProviderCredentialReference[];
28
+ }
29
+ export interface RunBindingPayload {
30
+ readonly schema_version: typeof RUN_BINDING_SCHEMA_VERSION;
31
+ readonly plan_id: Sha256Digest;
32
+ readonly max_concurrency?: number;
33
+ readonly validated_inputs: Readonly<Record<string, CanonicalJsonValue>>;
34
+ readonly secret_references: readonly SecretReference[];
35
+ readonly provider_config: ProviderConfiguration;
36
+ readonly project_root: string;
37
+ readonly workspace_root: string;
38
+ }
39
+ export interface StoredRunBinding {
40
+ readonly schema_version: typeof STORED_RUN_BINDING_SCHEMA_VERSION;
41
+ readonly binding_id: Sha256Digest;
42
+ readonly binding_digest: Sha256Digest;
43
+ readonly binding: RunBindingPayload;
44
+ }
45
+ export type RunBinding = StoredRunBinding;
46
+ export interface RunBindingRequest {
47
+ readonly plan: StoredExecutableRunPlan;
48
+ readonly max_concurrency?: number;
49
+ readonly inputs: Readonly<Record<string, unknown>>;
50
+ readonly environment: {
51
+ readonly project_root: string;
52
+ readonly workspace_root: string;
53
+ readonly secret_references: readonly SecretReference[];
54
+ };
55
+ readonly provider: ProviderConfiguration;
56
+ }
57
+ export declare class RunBindingError extends TypeError {
58
+ readonly path: string;
59
+ constructor(path: string, message: string);
60
+ }
61
+ export declare function assertRunBindingPayload(value: unknown): asserts value is RunBindingPayload;
62
+ export declare function parseRunBindingPayload(value: unknown): RunBindingPayload;
63
+ export declare function runBindingDigest(binding: RunBindingPayload): Sha256Digest;
64
+ export declare function createStoredRunBinding(binding: RunBindingPayload): StoredRunBinding;
65
+ export declare function parseStoredRunBinding(value: unknown): StoredRunBinding;
66
+ export declare class RunBindingFactory {
67
+ static bind(request: RunBindingRequest): StoredRunBinding;
68
+ }
@@ -0,0 +1,278 @@
1
+ import { createHash } from "node:crypto";
2
+ import { isAbsolute, win32 } from "node:path";
3
+ import { canonicalizeJson } from "./canonical-json.js";
4
+ import { parseStoredExecutableRunPlan, } from "./executable-run-plan.js";
5
+ export const RUN_BINDING_SCHEMA_VERSION = "intentdna.run_binding.v1";
6
+ export const STORED_RUN_BINDING_SCHEMA_VERSION = "intentdna.stored_run_binding.v1";
7
+ export class RunBindingError extends TypeError {
8
+ path;
9
+ constructor(path, message) {
10
+ super(`${path}: ${message}`);
11
+ this.name = "RunBindingError";
12
+ this.path = path;
13
+ }
14
+ }
15
+ function record(value, path, fields) {
16
+ if (value === null || typeof value !== "object" || Array.isArray(value)) {
17
+ throw new RunBindingError(path, "must be an object");
18
+ }
19
+ const prototype = Object.getPrototypeOf(value);
20
+ if (prototype !== Object.prototype && prototype !== null) {
21
+ throw new RunBindingError(path, "must be a plain object");
22
+ }
23
+ if (fields) {
24
+ const unknown = Object.keys(value).filter((key) => !fields.includes(key));
25
+ if (unknown.length > 0)
26
+ throw new RunBindingError(path, `unknown field '${unknown[0]}'`);
27
+ }
28
+ return value;
29
+ }
30
+ function required(value, key, path) {
31
+ if (!Object.prototype.hasOwnProperty.call(value, key)) {
32
+ throw new RunBindingError(path, `missing field '${key}'`);
33
+ }
34
+ return value[key];
35
+ }
36
+ function string(value, path) {
37
+ if (typeof value !== "string" || value.length === 0) {
38
+ throw new RunBindingError(path, "must be a non-empty string");
39
+ }
40
+ }
41
+ function digest(value, path) {
42
+ if (typeof value !== "string" || !/^sha256:[a-f0-9]{64}$/u.test(value)) {
43
+ throw new RunBindingError(path, "must be a lowercase sha256 digest");
44
+ }
45
+ }
46
+ function absolutePath(value, path) {
47
+ string(value, path);
48
+ if (value.includes("\0")) {
49
+ throw new RunBindingError(path, "must not contain NUL");
50
+ }
51
+ if (!isAbsolute(value) && !win32.isAbsolute(value)) {
52
+ throw new RunBindingError(path, "must be absolute");
53
+ }
54
+ }
55
+ function assertReferenceSource(value, path) {
56
+ if (!["environment", "file", "keychain", "external"].includes(value)) {
57
+ throw new RunBindingError(path, "has an unsupported secret source");
58
+ }
59
+ }
60
+ function assertProviderOptions(value) {
61
+ const path = "$.provider_config.options";
62
+ const options = record(value, path, [
63
+ "reasoning_effort",
64
+ "temperature",
65
+ "max_output_tokens",
66
+ "executable",
67
+ "max_budget_usd",
68
+ "permission_mode",
69
+ ]);
70
+ if (Object.prototype.hasOwnProperty.call(options, "reasoning_effort")) {
71
+ const effort = options.reasoning_effort;
72
+ if (!["low", "medium", "high", "xhigh", "max", "ultra"].includes(effort)) {
73
+ throw new RunBindingError(`${path}.reasoning_effort`, "has an unsupported value");
74
+ }
75
+ }
76
+ if (Object.prototype.hasOwnProperty.call(options, "temperature")) {
77
+ const temperature = options.temperature;
78
+ if (typeof temperature !== "number" || !Number.isFinite(temperature)) {
79
+ throw new RunBindingError(`${path}.temperature`, "must be a finite number");
80
+ }
81
+ if (temperature < 0 || temperature > 2) {
82
+ throw new RunBindingError(`${path}.temperature`, "must be between 0 and 2");
83
+ }
84
+ }
85
+ if (Object.prototype.hasOwnProperty.call(options, "max_output_tokens")) {
86
+ const maxOutputTokens = options.max_output_tokens;
87
+ if (typeof maxOutputTokens !== "number" || !Number.isSafeInteger(maxOutputTokens) || maxOutputTokens <= 0) {
88
+ throw new RunBindingError(`${path}.max_output_tokens`, "must be a positive safe integer");
89
+ }
90
+ }
91
+ if (Object.prototype.hasOwnProperty.call(options, "executable")) {
92
+ absolutePath(options.executable, `${path}.executable`);
93
+ }
94
+ if (Object.prototype.hasOwnProperty.call(options, "max_budget_usd")) {
95
+ const maxBudgetUsd = options.max_budget_usd;
96
+ if (typeof maxBudgetUsd !== "number" || !Number.isFinite(maxBudgetUsd) || maxBudgetUsd <= 0) {
97
+ throw new RunBindingError(`${path}.max_budget_usd`, "must be a positive finite number");
98
+ }
99
+ }
100
+ if (Object.prototype.hasOwnProperty.call(options, "permission_mode")) {
101
+ const permissionMode = options.permission_mode;
102
+ string(permissionMode, `${path}.permission_mode`);
103
+ if (permissionMode.includes("\0")) {
104
+ throw new RunBindingError(`${path}.permission_mode`, "must not contain NUL");
105
+ }
106
+ if (permissionMode.trim() !== permissionMode) {
107
+ throw new RunBindingError(`${path}.permission_mode`, "must not have leading or trailing whitespace");
108
+ }
109
+ if (permissionMode.length > 128) {
110
+ throw new RunBindingError(`${path}.permission_mode`, "must be at most 128 characters");
111
+ }
112
+ }
113
+ }
114
+ export function assertRunBindingPayload(value) {
115
+ canonicalizeJson(value);
116
+ const binding = record(value, "$", ["schema_version", "plan_id", "max_concurrency", "validated_inputs", "secret_references", "provider_config", "project_root", "workspace_root"]);
117
+ if (required(binding, "schema_version", "$") !== RUN_BINDING_SCHEMA_VERSION) {
118
+ throw new RunBindingError("$.schema_version", "unsupported schema version");
119
+ }
120
+ digest(required(binding, "plan_id", "$"), "$.plan_id");
121
+ if (Object.prototype.hasOwnProperty.call(binding, "max_concurrency")) {
122
+ const maxConcurrency = binding.max_concurrency;
123
+ if (!Number.isSafeInteger(maxConcurrency) || maxConcurrency <= 0) {
124
+ throw new RunBindingError("$.max_concurrency", "must be a positive safe integer");
125
+ }
126
+ }
127
+ const inputs = record(required(binding, "validated_inputs", "$"), "$.validated_inputs");
128
+ canonicalizeJson(inputs);
129
+ const references = required(binding, "secret_references", "$");
130
+ if (!Array.isArray(references))
131
+ throw new RunBindingError("$.secret_references", "must be an array");
132
+ const inputNames = new Set();
133
+ references.forEach((item, index) => {
134
+ const path = `$.secret_references[${index}]`;
135
+ const reference = record(item, path, ["input_name", "source", "reference"]);
136
+ string(required(reference, "input_name", path), `${path}.input_name`);
137
+ if (inputNames.has(reference.input_name)) {
138
+ throw new RunBindingError(`${path}.input_name`, "must be unique");
139
+ }
140
+ inputNames.add(reference.input_name);
141
+ assertReferenceSource(reference.source, `${path}.source`);
142
+ string(required(reference, "reference", path), `${path}.reference`);
143
+ });
144
+ const provider = record(required(binding, "provider_config", "$"), "$.provider_config", ["provider", "model", "options", "credential_references"]);
145
+ string(required(provider, "provider", "$.provider_config"), "$.provider_config.provider");
146
+ const model = required(provider, "model", "$.provider_config");
147
+ if (model !== null)
148
+ string(model, "$.provider_config.model");
149
+ assertProviderOptions(required(provider, "options", "$.provider_config"));
150
+ const providerReferences = required(provider, "credential_references", "$.provider_config");
151
+ if (!Array.isArray(providerReferences)) {
152
+ throw new RunBindingError("$.provider_config.credential_references", "must be an array");
153
+ }
154
+ const credentialNames = new Set();
155
+ providerReferences.forEach((item, index) => {
156
+ const path = `$.provider_config.credential_references[${index}]`;
157
+ const reference = record(item, path, ["name", "source", "reference"]);
158
+ string(required(reference, "name", path), `${path}.name`);
159
+ if (credentialNames.has(reference.name)) {
160
+ throw new RunBindingError(`${path}.name`, "must be unique");
161
+ }
162
+ credentialNames.add(reference.name);
163
+ assertReferenceSource(reference.source, `${path}.source`);
164
+ string(required(reference, "reference", path), `${path}.reference`);
165
+ });
166
+ absolutePath(required(binding, "project_root", "$"), "$.project_root");
167
+ absolutePath(required(binding, "workspace_root", "$"), "$.workspace_root");
168
+ }
169
+ export function parseRunBindingPayload(value) {
170
+ assertRunBindingPayload(value);
171
+ return value;
172
+ }
173
+ export function runBindingDigest(binding) {
174
+ assertRunBindingPayload(binding);
175
+ return `sha256:${createHash("sha256").update(canonicalizeJson(binding), "utf8").digest("hex")}`;
176
+ }
177
+ export function createStoredRunBinding(binding) {
178
+ const canonicalBinding = JSON.parse(canonicalizeJson(binding));
179
+ assertRunBindingPayload(canonicalBinding);
180
+ const bindingDigest = runBindingDigest(canonicalBinding);
181
+ return {
182
+ schema_version: STORED_RUN_BINDING_SCHEMA_VERSION,
183
+ binding_id: bindingDigest,
184
+ binding_digest: bindingDigest,
185
+ binding: canonicalBinding,
186
+ };
187
+ }
188
+ export function parseStoredRunBinding(value) {
189
+ canonicalizeJson(value);
190
+ const stored = record(value, "$", ["schema_version", "binding_id", "binding_digest", "binding"]);
191
+ if (required(stored, "schema_version", "$") !== STORED_RUN_BINDING_SCHEMA_VERSION) {
192
+ throw new RunBindingError("$.schema_version", "unsupported stored binding schema version");
193
+ }
194
+ digest(required(stored, "binding_id", "$"), "$.binding_id");
195
+ digest(required(stored, "binding_digest", "$"), "$.binding_digest");
196
+ const binding = parseRunBindingPayload(required(stored, "binding", "$"));
197
+ const recomputed = runBindingDigest(binding);
198
+ if (stored.binding_id !== stored.binding_digest || stored.binding_digest !== recomputed) {
199
+ throw new RunBindingError("$", "binding_id, binding_digest, and canonical payload digest must match");
200
+ }
201
+ return value;
202
+ }
203
+ function validateInputType(value, type, path) {
204
+ canonicalizeJson(value);
205
+ if (type === "string" || type === "reference" || type === "trusted_verifier_command") {
206
+ if (typeof value !== "string")
207
+ throw new RunBindingError(path, `must be ${type}`);
208
+ }
209
+ else if (type === "number") {
210
+ if (typeof value !== "number" || !Number.isFinite(value))
211
+ throw new RunBindingError(path, "must be a finite number");
212
+ }
213
+ else if (type === "boolean" && typeof value !== "boolean") {
214
+ throw new RunBindingError(path, "must be boolean");
215
+ }
216
+ return value;
217
+ }
218
+ export class RunBindingFactory {
219
+ static bind(request) {
220
+ const plan = parseStoredExecutableRunPlan(request.plan);
221
+ const inputDefinitions = new Map(plan.plan.input_contract.inputs.map((input) => [
222
+ input.name,
223
+ input,
224
+ ]));
225
+ for (const name of Object.keys(request.inputs)) {
226
+ if (!inputDefinitions.has(name)) {
227
+ throw new RunBindingError(`$.inputs.${name}`, "is not declared by the plan input contract");
228
+ }
229
+ }
230
+ const referencesByInput = new Map(request.environment.secret_references.map((reference) => [reference.input_name, reference]));
231
+ const validatedInputs = Object.create(null);
232
+ for (const definition of plan.plan.input_contract.inputs) {
233
+ const hasValue = Object.prototype.hasOwnProperty.call(request.inputs, definition.name);
234
+ const hasReference = referencesByInput.has(definition.name);
235
+ if (definition.sensitive) {
236
+ if (hasValue) {
237
+ throw new RunBindingError(`$.inputs.${definition.name}`, "resolved sensitive values are forbidden; use a secret reference");
238
+ }
239
+ if (definition.required && !hasReference) {
240
+ throw new RunBindingError(`$.environment.secret_references`, `missing required secret reference '${definition.name}'`);
241
+ }
242
+ }
243
+ else if (hasReference) {
244
+ throw new RunBindingError(`$.environment.secret_references`, `input '${definition.name}' is not sensitive`);
245
+ }
246
+ else if (hasValue) {
247
+ if (definition.type === "trusted_verifier_command") {
248
+ throw new RunBindingError(`$.inputs.${definition.name}`, "trusted verifier commands cannot be overridden at runtime");
249
+ }
250
+ validatedInputs[definition.name] = validateInputType(request.inputs[definition.name], definition.type, `$.inputs.${definition.name}`);
251
+ }
252
+ else if (definition.default_value !== undefined) {
253
+ validatedInputs[definition.name] = validateInputType(definition.default_value, definition.type, `$.plan.input_contract.${definition.name}.default_value`);
254
+ }
255
+ else if (definition.required) {
256
+ throw new RunBindingError("$.inputs", `missing required input '${definition.name}'`);
257
+ }
258
+ }
259
+ for (const reference of request.environment.secret_references) {
260
+ const definition = inputDefinitions.get(reference.input_name);
261
+ if (!definition) {
262
+ throw new RunBindingError("$.environment.secret_references", `unknown input '${reference.input_name}'`);
263
+ }
264
+ }
265
+ return createStoredRunBinding({
266
+ schema_version: RUN_BINDING_SCHEMA_VERSION,
267
+ plan_id: plan.plan_id,
268
+ ...(request.max_concurrency === undefined
269
+ ? {}
270
+ : { max_concurrency: request.max_concurrency }),
271
+ validated_inputs: validatedInputs,
272
+ secret_references: request.environment.secret_references,
273
+ provider_config: request.provider,
274
+ project_root: request.environment.project_root,
275
+ workspace_root: request.environment.workspace_root,
276
+ });
277
+ }
278
+ }