agent-contracts 0.5.2 → 0.6.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/dist/index.js CHANGED
@@ -6292,7 +6292,7 @@ var init_index_es = __esm({
6292
6292
  return { drive: t4.toLowerCase() + ":" };
6293
6293
  }, k2 = function() {
6294
6294
  return { drive: null };
6295
- }, z14 = function() {
6295
+ }, z15 = function() {
6296
6296
  return { drive: null };
6297
6297
  }, B2 = function(t4) {
6298
6298
  return { protocol: null, origin: null, absolute: false, drive: null, ...t4 };
@@ -6333,7 +6333,7 @@ var init_index_es = __esm({
6333
6333
  var t4, n4, r4, e4, o4;
6334
6334
  return t4 = K2, (n4 = rt()) !== c2 && (r4 = et()) !== c2 && (e4 = ut()) !== c2 && (o4 = it()) !== c2 ? (n4 = s2(n4, r4, e4, o4), t4 = n4) : (K2 = t4, t4 = c2), t4 === c2 && (t4 = K2, (n4 = rt()) !== c2 && (r4 = et()) !== c2 && (e4 = (function() {
6335
6335
  var t5;
6336
- return (t5 = x3) !== c2 && (t5 = z14()), t5;
6336
+ return (t5 = x3) !== c2 && (t5 = z15()), t5;
6337
6337
  })()) !== c2 ? (n4 = f2(n4, r4, e4), t4 = n4) : (K2 = t4, t4 = c2)), t4;
6338
6338
  })()) === c2 && (n3 = (function() {
6339
6339
  var n4, r4, e4, o4;
@@ -8022,7 +8022,7 @@ __export(index_es_exports2, {
8022
8022
  resolveExternalRef: () => ye,
8023
8023
  resolveExternalRefWithLocation: () => ge,
8024
8024
  resolveInlineRef: () => B,
8025
- resolveInlineRefWithLocation: () => z12,
8025
+ resolveInlineRefWithLocation: () => z13,
8026
8026
  safeParse: () => de,
8027
8027
  safeStringify: () => ve,
8028
8028
  startsWith: () => be,
@@ -8066,9 +8066,9 @@ function* L(e3, t3, r3) {
8066
8066
  for (const [n3, o3] of t3.entries()) O(e3.value, o3, r3), e3.value = e3.value[o3], A(e3.value) && (j(e3.value), yield [n3, e3.value]);
8067
8067
  }
8068
8068
  function B(e3, t3) {
8069
- return z12(e3, t3).value;
8069
+ return z13(e3, t3).value;
8070
8070
  }
8071
- function z12(e3, t3) {
8071
+ function z13(e3, t3) {
8072
8072
  return (function e4(t4, r3, n3, o3) {
8073
8073
  if (null !== V(r3)) throw new ReferenceError("Cannot resolve external references");
8074
8074
  const i3 = K(r3);
@@ -16898,7 +16898,7 @@ var require_immer_cjs_production_min = __commonJS({
16898
16898
  var t4 = n4[H2];
16899
16899
  return (t4 ? s2(t4) : n4)[r4];
16900
16900
  }
16901
- function z14(n4, r4) {
16901
+ function z15(n4, r4) {
16902
16902
  if (r4 in n4) for (var t4 = Object.getPrototypeOf(n4); t4; ) {
16903
16903
  var e4 = Object.getOwnPropertyDescriptor(t4, r4);
16904
16904
  if (e4) return e4;
@@ -17291,7 +17291,7 @@ var require_immer_cjs_production_min = __commonJS({
17291
17291
  if (r4 === H2) return n4;
17292
17292
  var e4 = s2(n4);
17293
17293
  if (!u2(e4, r4)) return (function(n5, r5, t4) {
17294
- var e5, i5 = z14(r5, t4);
17294
+ var e5, i5 = z15(r5, t4);
17295
17295
  return i5 ? "value" in i5 ? i5.value : null === (e5 = i5.get) || void 0 === e5 ? void 0 : e5.call(n5.k) : void 0;
17296
17296
  })(n4, e4, r4);
17297
17297
  var i4 = e4[r4];
@@ -17301,7 +17301,7 @@ var require_immer_cjs_production_min = __commonJS({
17301
17301
  }, ownKeys: function(n4) {
17302
17302
  return Reflect.ownKeys(s2(n4));
17303
17303
  }, set: function(n4, r4, t4) {
17304
- var e4 = z14(s2(n4), r4);
17304
+ var e4 = z15(s2(n4), r4);
17305
17305
  if (null == e4 ? void 0 : e4.set) return e4.set.call(n4.k, t4), true;
17306
17306
  if (!n4.g) {
17307
17307
  var i4 = A2(s2(n4), r4), o4 = null == i4 ? void 0 : i4[H2];
@@ -35640,11 +35640,11 @@ var require_brace_expansion = __commonJS({
35640
35640
  if (pad) {
35641
35641
  var need = width - c2.length;
35642
35642
  if (need > 0) {
35643
- var z14 = new Array(need + 1).join("0");
35643
+ var z15 = new Array(need + 1).join("0");
35644
35644
  if (i3 < 0)
35645
- c2 = "-" + z14 + c2.slice(1);
35645
+ c2 = "-" + z15 + c2.slice(1);
35646
35646
  else
35647
- c2 = z14 + c2;
35647
+ c2 = z15 + c2;
35648
35648
  }
35649
35649
  }
35650
35650
  }
@@ -55620,7 +55620,7 @@ var require_dist10 = __commonJS({
55620
55620
  var getSiblings = (parent) => (node) => getChildren(parent).filter(not(eq(node)));
55621
55621
  var concatAll = (
55622
55622
  /*::<T>*/
55623
- (xs) => (ys) => ys.reduce((zs, z14) => zs.concat(z14), xs)
55623
+ (xs) => (ys) => ys.reduce((zs, z15) => zs.concat(z15), xs)
55624
55624
  );
55625
55625
  function getLastSegment(instancePath) {
55626
55626
  const index4 = instancePath.lastIndexOf("/");
@@ -58308,7 +58308,7 @@ var RuleSchema = z.object({
58308
58308
  detection_method: z.string().optional(),
58309
58309
  escalation: z.string().optional(),
58310
58310
  ref: z.string().optional()
58311
- }).strict();
58311
+ }).passthrough();
58312
58312
  var EscalationCriterionSchema = z.object({
58313
58313
  condition: z.string(),
58314
58314
  action: z.enum([
@@ -58316,12 +58316,12 @@ var EscalationCriterionSchema = z.object({
58316
58316
  "report_to_architect",
58317
58317
  "wait_for_approval"
58318
58318
  ])
58319
- }).strict();
58319
+ }).passthrough();
58320
58320
  var PrerequisiteSchema = z.object({
58321
58321
  action: z.enum(["read", "execute"]),
58322
58322
  target: z.string(),
58323
58323
  required: z.boolean()
58324
- }).strict();
58324
+ }).passthrough();
58325
58325
  var AgentSchema = z.object({
58326
58326
  role_name: z.string(),
58327
58327
  purpose: z.string(),
@@ -58363,14 +58363,15 @@ import { z as z3 } from "zod";
58363
58363
  var HandoffTypeSchema = z3.object({
58364
58364
  version: z3.number(),
58365
58365
  description: z3.string().optional(),
58366
- payload: z3.record(z3.string(), z3.any())
58366
+ payload: z3.record(z3.string(), z3.any()),
58367
+ example: z3.record(z3.string(), z3.any()).optional()
58367
58368
  }).passthrough();
58368
58369
 
58369
58370
  // src/schema/policy.ts
58370
58371
  import { z as z4 } from "zod";
58371
58372
  var PolicyWhenSchema = z4.object({
58372
58373
  artifact_type: z4.string().optional(),
58373
- phase: z4.string().optional()
58374
+ workflow: z4.string().optional()
58374
58375
  }).passthrough();
58375
58376
  var PolicySchema = z4.object({
58376
58377
  when: PolicyWhenSchema,
@@ -58385,7 +58386,7 @@ var ExtendsSchema = z5.string().optional();
58385
58386
  var SystemSchema = z5.object({
58386
58387
  id: z5.string(),
58387
58388
  name: z5.string(),
58388
- default_phase_order: z5.array(z5.string())
58389
+ default_workflow_order: z5.array(z5.string())
58389
58390
  }).passthrough();
58390
58391
 
58391
58392
  // src/schema/task.ts
@@ -58393,6 +58394,7 @@ import { z as z6 } from "zod";
58393
58394
  var ExecutionStepSchema = z6.object({
58394
58395
  id: z6.string(),
58395
58396
  action: z6.string(),
58397
+ description: z6.string().optional(),
58396
58398
  required: z6.boolean().optional(),
58397
58399
  abort_on_failure: z6.boolean().optional(),
58398
58400
  uses_tool: z6.string().optional(),
@@ -58400,12 +58402,12 @@ var ExecutionStepSchema = z6.object({
58400
58402
  depends_on: z6.array(z6.string()).optional(),
58401
58403
  skip_condition: z6.string().optional(),
58402
58404
  wait_for_approval: z6.boolean().optional()
58403
- }).strict();
58405
+ }).passthrough();
58404
58406
  var TaskSchema = z6.object({
58405
58407
  description: z6.string(),
58406
58408
  target_agent: z6.string(),
58407
58409
  allowed_from_agents: z6.array(z6.string()),
58408
- phase: z6.string(),
58410
+ workflow: z6.string(),
58409
58411
  input_artifacts: z6.array(z6.string()),
58410
58412
  invocation_handoff: z6.string(),
58411
58413
  result_handoff: z6.string(),
@@ -58445,19 +58447,22 @@ var ValidationSchema = z8.object({
58445
58447
  import { z as z9 } from "zod";
58446
58448
  var WorkflowHandoffStepSchema = z9.object({
58447
58449
  type: z9.literal("handoff"),
58450
+ description: z9.string().optional(),
58448
58451
  handoff_kind: z9.string(),
58449
58452
  task: z9.string().optional(),
58450
58453
  from_agent: z9.string().optional()
58451
- }).strict();
58454
+ }).passthrough();
58452
58455
  var WorkflowValidationStepSchema = z9.object({
58453
58456
  type: z9.literal("validation"),
58457
+ description: z9.string().optional(),
58454
58458
  validation: z9.string()
58455
- }).strict();
58459
+ }).passthrough();
58456
58460
  var WorkflowDecisionStepSchema = z9.object({
58457
58461
  type: z9.literal("decision"),
58462
+ description: z9.string().optional(),
58458
58463
  on: z9.string(),
58459
58464
  branches: z9.record(z9.string(), z9.array(z9.string()))
58460
- }).strict();
58465
+ }).passthrough();
58461
58466
  var WorkflowStepSchema = z9.discriminatedUnion("type", [
58462
58467
  WorkflowHandoffStepSchema,
58463
58468
  WorkflowValidationStepSchema,
@@ -58465,6 +58470,7 @@ var WorkflowStepSchema = z9.discriminatedUnion("type", [
58465
58470
  ]);
58466
58471
  var WorkflowSchema = z9.object({
58467
58472
  entry_conditions: z9.array(z9.string()).default([]),
58473
+ trigger: z9.string().optional(),
58468
58474
  steps: z9.array(WorkflowStepSchema)
58469
58475
  }).passthrough();
58470
58476
 
@@ -59053,113 +59059,66 @@ async function resolve3(projectDirOrFile) {
59053
59059
  }
59054
59060
 
59055
59061
  // src/validator/schema-validator.ts
59056
- function hasNonExtensionCustomProps(obj, knownKeys, path) {
59057
- const diagnostics = [];
59058
- for (const key of Object.keys(obj)) {
59059
- if (knownKeys.has(key)) continue;
59060
- if (key.startsWith("x-")) continue;
59061
- diagnostics.push({
59062
- path: `${path}.${key}`,
59063
- message: `Unknown property "${key}". Custom properties must use "x-" prefix.`,
59064
- code: "unknown-property"
59065
- });
59066
- }
59067
- return diagnostics;
59062
+ import { z as z12 } from "zod";
59063
+ function unwrap(schema) {
59064
+ if (schema instanceof z12.ZodOptional) return unwrap(schema.unwrap());
59065
+ if (schema instanceof z12.ZodDefault) return unwrap(schema.removeDefault());
59066
+ if (schema instanceof z12.ZodNullable) return unwrap(schema.unwrap());
59067
+ return schema;
59068
59068
  }
59069
- var SYSTEM_KEYS = /* @__PURE__ */ new Set(["id", "name", "default_phase_order"]);
59070
- var AGENT_KEYS = /* @__PURE__ */ new Set([
59071
- "role_name",
59072
- "purpose",
59073
- "can_read_artifacts",
59074
- "can_write_artifacts",
59075
- "can_execute_tools",
59076
- "can_perform_validations",
59077
- "can_invoke_agents",
59078
- "can_return_handoffs",
59079
- "dispatch_only",
59080
- "mode",
59081
- "responsibilities",
59082
- "constraints",
59083
- "rules",
59084
- "anti_patterns",
59085
- "escalation_criteria",
59086
- "prerequisites"
59087
- ]);
59088
- var TASK_KEYS = /* @__PURE__ */ new Set([
59089
- "description",
59090
- "target_agent",
59091
- "allowed_from_agents",
59092
- "phase",
59093
- "input_artifacts",
59094
- "invocation_handoff",
59095
- "result_handoff",
59096
- "default_priority",
59097
- "responsibilities",
59098
- "constraints",
59099
- "execution_steps",
59100
- "completion_criteria",
59101
- "rules",
59102
- "anti_patterns",
59103
- "escalation_criteria"
59104
- ]);
59105
- var ARTIFACT_KEYS = /* @__PURE__ */ new Set([
59106
- "type",
59107
- "description",
59108
- "owner",
59109
- "producers",
59110
- "editors",
59111
- "consumers",
59112
- "states",
59113
- "required_validations",
59114
- "visibility"
59115
- ]);
59116
- var TOOL_KEYS = /* @__PURE__ */ new Set([
59117
- "kind",
59118
- "description",
59119
- "input_artifacts",
59120
- "output_artifacts",
59121
- "invokable_by",
59122
- "side_effects"
59123
- ]);
59124
- var VALIDATION_KEYS = /* @__PURE__ */ new Set([
59125
- "target_artifact",
59126
- "kind",
59127
- "executor_type",
59128
- "executor",
59129
- "blocking",
59130
- "produces_evidence"
59131
- ]);
59132
- var HANDOFF_TYPE_KEYS = /* @__PURE__ */ new Set(["version", "description", "payload"]);
59133
- var WORKFLOW_KEYS = /* @__PURE__ */ new Set(["entry_conditions", "steps"]);
59134
- var POLICY_KEYS = /* @__PURE__ */ new Set(["when", "requires_validations", "requires"]);
59135
- function checkCustomProps(data) {
59136
- const diagnostics = [];
59137
- if (data["system"] && typeof data["system"] === "object") {
59138
- diagnostics.push(
59139
- ...hasNonExtensionCustomProps(data["system"], SYSTEM_KEYS, "system")
59140
- );
59069
+ function checkCustomPropsRecursive(data, schema, path) {
59070
+ const inner = unwrap(schema);
59071
+ if (inner instanceof z12.ZodObject) {
59072
+ if (typeof data !== "object" || data === null || Array.isArray(data)) return [];
59073
+ const obj = data;
59074
+ const shape = inner.shape;
59075
+ const knownKeys = new Set(Object.keys(shape));
59076
+ const diagnostics = [];
59077
+ for (const key of Object.keys(obj)) {
59078
+ if (knownKeys.has(key)) continue;
59079
+ if (key.startsWith("x-")) continue;
59080
+ diagnostics.push({
59081
+ path: path ? `${path}.${key}` : key,
59082
+ message: `Unknown property "${key}". Custom properties must use "x-" prefix.`,
59083
+ code: "unknown-property"
59084
+ });
59085
+ }
59086
+ for (const [field, fieldSchema] of Object.entries(shape)) {
59087
+ if (obj[field] === void 0) continue;
59088
+ diagnostics.push(...checkCustomPropsRecursive(obj[field], fieldSchema, path ? `${path}.${field}` : field));
59089
+ }
59090
+ return diagnostics;
59141
59091
  }
59142
- const sections = [
59143
- { key: "agents", knownKeys: AGENT_KEYS },
59144
- { key: "tasks", knownKeys: TASK_KEYS },
59145
- { key: "artifacts", knownKeys: ARTIFACT_KEYS },
59146
- { key: "tools", knownKeys: TOOL_KEYS },
59147
- { key: "validations", knownKeys: VALIDATION_KEYS },
59148
- { key: "handoff_types", knownKeys: HANDOFF_TYPE_KEYS },
59149
- { key: "workflow", knownKeys: WORKFLOW_KEYS },
59150
- { key: "policies", knownKeys: POLICY_KEYS }
59151
- ];
59152
- for (const { key, knownKeys } of sections) {
59153
- const map = data[key];
59154
- if (typeof map !== "object" || map === null || Array.isArray(map)) continue;
59155
- for (const [entryKey, item] of Object.entries(map)) {
59156
- if (typeof item !== "object" || item === null) continue;
59157
- diagnostics.push(
59158
- ...hasNonExtensionCustomProps(item, knownKeys, `${key}.${entryKey}`)
59159
- );
59092
+ if (inner instanceof z12.ZodRecord) {
59093
+ if (typeof data !== "object" || data === null || Array.isArray(data)) return [];
59094
+ const valueSchema = inner._def.valueType;
59095
+ const diagnostics = [];
59096
+ for (const [key, value] of Object.entries(data)) {
59097
+ diagnostics.push(...checkCustomPropsRecursive(value, valueSchema, path ? `${path}.${key}` : key));
59160
59098
  }
59099
+ return diagnostics;
59161
59100
  }
59162
- return diagnostics;
59101
+ if (inner instanceof z12.ZodArray) {
59102
+ if (!Array.isArray(data)) return [];
59103
+ const diagnostics = [];
59104
+ for (let i3 = 0; i3 < data.length; i3++) {
59105
+ diagnostics.push(...checkCustomPropsRecursive(data[i3], inner.element, `${path}[${i3}]`));
59106
+ }
59107
+ return diagnostics;
59108
+ }
59109
+ if (inner instanceof z12.ZodDiscriminatedUnion) {
59110
+ if (typeof data !== "object" || data === null) return [];
59111
+ const obj = data;
59112
+ const disc = inner._def.discriminator;
59113
+ const discValue = obj[disc];
59114
+ const match = inner.options.find((opt) => {
59115
+ const shape = opt.shape;
59116
+ return shape[disc] instanceof z12.ZodLiteral && shape[disc].value === discValue;
59117
+ });
59118
+ if (match) return checkCustomPropsRecursive(data, match, path);
59119
+ return [];
59120
+ }
59121
+ return [];
59163
59122
  }
59164
59123
  function validateSchema(data) {
59165
59124
  const result = DslSchema.safeParse(data);
@@ -59171,7 +59130,7 @@ function validateSchema(data) {
59171
59130
  }));
59172
59131
  return { success: false, diagnostics };
59173
59132
  }
59174
- const customPropDiagnostics = checkCustomProps(data);
59133
+ const customPropDiagnostics = checkCustomPropsRecursive(data, DslSchema, "");
59175
59134
  if (customPropDiagnostics.length > 0) {
59176
59135
  return { success: false, diagnostics: customPropDiagnostics };
59177
59136
  }
@@ -59187,7 +59146,7 @@ function checkReferences(dsl) {
59187
59146
  const validationIds = new Set(Object.keys(dsl.validations));
59188
59147
  const handoffKinds = new Set(Object.keys(dsl.handoff_types));
59189
59148
  const taskIds = new Set(Object.keys(dsl.tasks));
59190
- const phases = new Set(dsl.system.default_phase_order);
59149
+ const workflowIds = new Set(dsl.system.default_workflow_order);
59191
59150
  function checkExists(value, validSet, entityType, path) {
59192
59151
  if (!validSet.has(value)) {
59193
59152
  diagnostics.push({
@@ -59273,26 +59232,26 @@ function checkReferences(dsl) {
59273
59232
  for (const ref of task.allowed_from_agents) {
59274
59233
  checkExists(ref, agentIds, "agents", `tasks.${id}.allowed_from_agents`);
59275
59234
  }
59276
- checkExists(task.phase, phases, "system.default_phase_order", `tasks.${id}.phase`);
59235
+ checkExists(task.workflow, workflowIds, "system.default_workflow_order", `tasks.${id}.workflow`);
59277
59236
  checkExists(task.invocation_handoff, handoffKinds, "handoff_types", `tasks.${id}.invocation_handoff`);
59278
59237
  checkExists(task.result_handoff, handoffKinds, "handoff_types", `tasks.${id}.result_handoff`);
59279
59238
  for (const ref of task.input_artifacts) {
59280
59239
  checkExists(ref, artifactIds, "artifacts", `tasks.${id}.input_artifacts`);
59281
59240
  }
59282
59241
  }
59283
- for (const [phase, wf] of Object.entries(dsl.workflow)) {
59284
- checkExists(phase, phases, "system.default_phase_order", `workflow.${phase}`);
59242
+ for (const [wfId, wf] of Object.entries(dsl.workflow)) {
59243
+ checkExists(wfId, workflowIds, "system.default_workflow_order", `workflow.${wfId}`);
59285
59244
  for (let j2 = 0; j2 < wf.steps.length; j2++) {
59286
59245
  const step = wf.steps[j2];
59287
59246
  if (step.type === "handoff") {
59288
59247
  if (step.task) {
59289
- checkExists(step.task, taskIds, "tasks", `workflow.${phase}.steps[${j2}].task`);
59248
+ checkExists(step.task, taskIds, "tasks", `workflow.${wfId}.steps[${j2}].task`);
59290
59249
  }
59291
59250
  if (step.from_agent) {
59292
- checkExists(step.from_agent, agentIds, "agents", `workflow.${phase}.steps[${j2}].from_agent`);
59251
+ checkExists(step.from_agent, agentIds, "agents", `workflow.${wfId}.steps[${j2}].from_agent`);
59293
59252
  }
59294
59253
  } else if (step.type === "validation") {
59295
- checkExists(step.validation, validationIds, "validations", `workflow.${phase}.steps[${j2}].validation`);
59254
+ checkExists(step.validation, validationIds, "validations", `workflow.${wfId}.steps[${j2}].validation`);
59296
59255
  }
59297
59256
  }
59298
59257
  }
@@ -59500,85 +59459,6 @@ var toolExecutionRule = {
59500
59459
  }
59501
59460
  };
59502
59461
 
59503
- // src/linter/rules/release-audit.ts
59504
- var releaseAuditRule = {
59505
- id: "release-audit",
59506
- description: "Workflow graph completeness: release/audit phases should have proper handoff structures",
59507
- run(dsl) {
59508
- const diagnostics = [];
59509
- const phases = dsl.system.default_phase_order;
59510
- const hasAuditPhase = phases.some(
59511
- (p2) => p2 === "audit" || p2 === "release" || p2 === "review"
59512
- );
59513
- if (!hasAuditPhase) {
59514
- return diagnostics;
59515
- }
59516
- const handoffKinds = new Set(Object.keys(dsl.handoff_types));
59517
- const hasReleaseReadiness = handoffKinds.has("release-readiness");
59518
- const hasReleaseResult = handoffKinds.has("release-result");
59519
- if (!hasReleaseReadiness) {
59520
- diagnostics.push({
59521
- ruleId: "release-audit",
59522
- severity: "warning",
59523
- path: "handoff_types",
59524
- message: 'Missing "release-readiness" handoff type for audit/release workflow'
59525
- });
59526
- }
59527
- if (!hasReleaseResult) {
59528
- diagnostics.push({
59529
- ruleId: "release-audit",
59530
- severity: "warning",
59531
- path: "handoff_types",
59532
- message: 'Missing "release-result" handoff type for audit/release workflow'
59533
- });
59534
- }
59535
- if (phases.some((p2) => p2 === "audit")) {
59536
- const hasAuditReport = handoffKinds.has("audit-report");
59537
- const hasAuditReconciliation = handoffKinds.has("audit-reconciliation");
59538
- if (!hasAuditReport) {
59539
- diagnostics.push({
59540
- ruleId: "release-audit",
59541
- severity: "warning",
59542
- path: "handoff_types",
59543
- message: 'Missing "audit-report" handoff type for audit workflow'
59544
- });
59545
- }
59546
- if (!hasAuditReconciliation) {
59547
- diagnostics.push({
59548
- ruleId: "release-audit",
59549
- severity: "warning",
59550
- path: "handoff_types",
59551
- message: 'Missing "audit-reconciliation" handoff type for audit workflow'
59552
- });
59553
- }
59554
- }
59555
- const workflowPhases = new Set(Object.keys(dsl.workflow));
59556
- for (const phase of phases) {
59557
- if ((phase === "audit" || phase === "release") && !workflowPhases.has(phase)) {
59558
- diagnostics.push({
59559
- ruleId: "release-audit",
59560
- severity: "warning",
59561
- path: "workflow",
59562
- message: `Phase "${phase}" is in default_phase_order but has no workflow definition`
59563
- });
59564
- }
59565
- }
59566
- for (const [phase, wf] of Object.entries(dsl.workflow)) {
59567
- if (phase !== "audit" && phase !== "release") continue;
59568
- const hasDecision = wf.steps.some((s2) => s2.type === "decision");
59569
- if (!hasDecision) {
59570
- diagnostics.push({
59571
- ruleId: "release-audit",
59572
- severity: "info",
59573
- path: `workflow.${phase}`,
59574
- message: `Audit/release workflow phase "${phase}" has no decision step for remediation routing`
59575
- });
59576
- }
59577
- }
59578
- return diagnostics;
59579
- }
59580
- };
59581
-
59582
59462
  // src/linter/rules/task-agent-binding.ts
59583
59463
  var taskAgentBindingRule = {
59584
59464
  id: "task-agent-binding",
@@ -59682,21 +59562,21 @@ var taskAgentBindingRule = {
59682
59562
  // src/linter/rules/merge-integrity.ts
59683
59563
  var mergeIntegrityRule = {
59684
59564
  id: "merge-integrity",
59685
- description: "Post-merge integrity: check that resolved DSL phase order has no duplicates",
59565
+ description: "Post-merge integrity: check that resolved DSL workflow order has no duplicates",
59686
59566
  run(dsl) {
59687
59567
  const diagnostics = [];
59688
- const phases = dsl.system.default_phase_order;
59689
- const phaseSeen = /* @__PURE__ */ new Set();
59690
- for (let i3 = 0; i3 < phases.length; i3++) {
59691
- if (phaseSeen.has(phases[i3])) {
59568
+ const workflows = dsl.system.default_workflow_order;
59569
+ const seen = /* @__PURE__ */ new Set();
59570
+ for (let i3 = 0; i3 < workflows.length; i3++) {
59571
+ if (seen.has(workflows[i3])) {
59692
59572
  diagnostics.push({
59693
59573
  ruleId: "merge-integrity",
59694
59574
  severity: "error",
59695
- path: `system.default_phase_order[${i3}]`,
59696
- message: `Duplicate phase "${phases[i3]}" in default_phase_order`
59575
+ path: `system.default_workflow_order[${i3}]`,
59576
+ message: `Duplicate workflow "${workflows[i3]}" in default_workflow_order`
59697
59577
  });
59698
59578
  }
59699
- phaseSeen.add(phases[i3]);
59579
+ seen.add(workflows[i3]);
59700
59580
  }
59701
59581
  return diagnostics;
59702
59582
  }
@@ -59706,7 +59586,6 @@ var mergeIntegrityRule = {
59706
59586
  var builtinRules = [
59707
59587
  validationCoverageRule,
59708
59588
  toolExecutionRule,
59709
- releaseAuditRule,
59710
59589
  taskAgentBindingRule,
59711
59590
  mergeIntegrityRule
59712
59591
  ];
@@ -60337,9 +60216,9 @@ function buildHandoffTypeContext(dsl, handoffTypeId) {
60337
60216
  ).map(([id, t3]) => ({ ...t3, id }));
60338
60217
  return { handoff_type, relatedTasks, dsl };
60339
60218
  }
60340
- function buildWorkflowContext(dsl, phaseId) {
60341
- const wfDef = dsl.workflow[phaseId];
60342
- const workflow = { ...wfDef, id: phaseId };
60219
+ function buildWorkflowContext(dsl, workflowId) {
60220
+ const wfDef = dsl.workflow[workflowId];
60221
+ const workflow = { ...wfDef, id: workflowId };
60343
60222
  return { workflow, dsl };
60344
60223
  }
60345
60224
  function buildPolicyContext(dsl, policyId) {
@@ -60403,7 +60282,7 @@ function buildDelegatableTasks(dsl, agentId) {
60403
60282
  id: taskId,
60404
60283
  description: t3.description,
60405
60284
  target_agent: t3.target_agent,
60406
- phase: t3.phase,
60285
+ workflow: t3.workflow,
60407
60286
  input_artifacts: t3.input_artifacts,
60408
60287
  invocation_handoff: t3.invocation_handoff,
60409
60288
  invocation_payload_keys: invocationHandoff ? extractPayloadFieldNames(invocationHandoff.payload) : [],
@@ -60654,7 +60533,7 @@ async function checkDriftFromConfig(dsl, renderTargets) {
60654
60533
  }
60655
60534
 
60656
60535
  // src/config/types.ts
60657
- import { z as z13 } from "zod";
60536
+ import { z as z14 } from "zod";
60658
60537
  var CONTEXT_TYPES = [
60659
60538
  "agent",
60660
60539
  "task",
@@ -60666,16 +60545,16 @@ var CONTEXT_TYPES = [
60666
60545
  "policy",
60667
60546
  "system"
60668
60547
  ];
60669
- var ContextTypeSchema = z13.enum(CONTEXT_TYPES);
60548
+ var ContextTypeSchema = z14.enum(CONTEXT_TYPES);
60670
60549
  var ITERABLE_CONTEXT_TYPES = CONTEXT_TYPES.filter(
60671
60550
  (t3) => t3 !== "system"
60672
60551
  );
60673
- var RenderTargetSchema = z13.object({
60674
- template: z13.string(),
60552
+ var RenderTargetSchema = z14.object({
60553
+ template: z14.string(),
60675
60554
  context: ContextTypeSchema,
60676
- output: z13.string(),
60677
- include: z13.array(z13.string()).optional(),
60678
- exclude: z13.array(z13.string()).optional()
60555
+ output: z14.string(),
60556
+ include: z14.array(z14.string()).optional(),
60557
+ exclude: z14.array(z14.string()).optional()
60679
60558
  }).refine(
60680
60559
  (data) => !(data.include && data.exclude),
60681
60560
  { message: "include and exclude are mutually exclusive" }
@@ -60688,9 +60567,9 @@ var RenderTargetSchema = z13.object({
60688
60567
  },
60689
60568
  { message: "include/exclude cannot be used with context: system" }
60690
60569
  );
60691
- var AgentContractsConfigSchema = z13.object({
60692
- dsl: z13.string(),
60693
- renders: z13.array(RenderTargetSchema).min(1)
60570
+ var AgentContractsConfigSchema = z14.object({
60571
+ dsl: z14.string(),
60572
+ renders: z14.array(RenderTargetSchema).min(1)
60694
60573
  });
60695
60574
 
60696
60575
  // src/config/loader.ts