@lace-cloud/canvas 0.22.0 → 0.23.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.
@@ -12489,27 +12489,25 @@ var stackPreviewSchema = import_zod.z.object({
12489
12489
  bound: import_zod.z.number().optional()
12490
12490
  })
12491
12491
  });
12492
- var changeRequestSchema = import_zod.z.object({
12492
+ var gateChangeRequestSchema = import_zod.z.object({
12493
12493
  id: import_zod.z.string(),
12494
- orgId: import_zod.z.string(),
12495
- teamId: import_zod.z.string(),
12496
- runId: import_zod.z.string(),
12497
- bindingId: import_zod.z.string().nullable(),
12498
- invocationId: import_zod.z.string().nullable(),
12499
12494
  state: import_zod.z.string(),
12500
- approverUserId: import_zod.z.string().nullable(),
12501
- approvalChain: import_zod.z.unknown(),
12502
- emergencyApproval: import_zod.z.boolean(),
12503
- narrativeArtifactId: import_zod.z.string().nullable(),
12504
- policyResolution: import_zod.z.unknown(),
12505
- externalSystemId: import_zod.z.string().nullable(),
12506
- externalRef: import_zod.z.string().nullable(),
12507
- idempotencyKey: import_zod.z.string().nullable(),
12508
- lastReconciledAt: import_zod.z.string().nullable(),
12509
- submittedByUserId: import_zod.z.string().nullable(),
12510
- submittedAt: import_zod.z.string().nullable(),
12511
- createdAt: import_zod.z.string(),
12512
- updatedAt: import_zod.z.string()
12495
+ requirements: import_zod.z.array(
12496
+ import_zod.z.object({
12497
+ id: import_zod.z.string(),
12498
+ state: import_zod.z.string(),
12499
+ decidedBy: import_zod.z.enum(["lace", "ecm"])
12500
+ })
12501
+ ),
12502
+ records: import_zod.z.array(
12503
+ import_zod.z.object({
12504
+ externalSystemId: import_zod.z.string(),
12505
+ kind: import_zod.z.string(),
12506
+ externalRef: import_zod.z.string().nullable(),
12507
+ externalUrl: import_zod.z.string().nullable(),
12508
+ state: import_zod.z.string().nullable()
12509
+ })
12510
+ )
12513
12511
  });
12514
12512
  var runEventSchema = import_zod.z.discriminatedUnion("type", [
12515
12513
  import_zod.z.object({ type: import_zod.z.literal("log"), text: import_zod.z.string() }),
@@ -12517,8 +12515,11 @@ var runEventSchema = import_zod.z.discriminatedUnion("type", [
12517
12515
  import_zod.z.object({
12518
12516
  type: import_zod.z.literal("gate"),
12519
12517
  resolution: import_zod.z.object({ mode: import_zod.z.string(), reason: import_zod.z.string().optional() }),
12520
- changeRequest: changeRequestSchema.nullable()
12521
- }),
12518
+ changeRequest: gateChangeRequestSchema.nullable()
12519
+ }).refine(
12520
+ (gate) => gate.resolution.mode === "awaiting_approval" === (gate.changeRequest !== null),
12521
+ { message: "a gate event carries a change request exactly when it holds the Run" }
12522
+ ),
12522
12523
  import_zod.z.object({
12523
12524
  type: import_zod.z.literal("result"),
12524
12525
  run: runSchema,
@@ -13449,10 +13450,10 @@ function reduceRun(prev, token, event) {
13449
13450
  const lastLog = event.type === "log" ? event.text : carried?.lastLog ?? null;
13450
13451
  const phases = event.type === "phase" ? withPhase(carried?.phases ?? [], event.name) : carried?.phases ?? [];
13451
13452
  const submitted = carried?.submitted || event.type === "phase" && event.name === "submit";
13452
- if (event.type === "gate" && event.resolution.mode === "awaiting_approval") {
13453
+ if (event.type === "gate" && event.changeRequest !== null) {
13453
13454
  return {
13454
13455
  token,
13455
- outcome: { kind: "awaiting-approval", changeRequestId: event.changeRequest?.id ?? "" },
13456
+ outcome: { kind: "awaiting-approval", changeRequest: event.changeRequest },
13456
13457
  lastLog,
13457
13458
  submitted,
13458
13459
  phases: closePhases(phases)