@kici-dev/engine 0.1.26 → 0.2.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.
Files changed (157) hide show
  1. package/dist/approval/types.d.ts +11 -4
  2. package/dist/approval/types.js +11 -4
  3. package/dist/artifacts/name.d.ts +60 -0
  4. package/dist/artifacts/name.js +71 -0
  5. package/dist/audit/access-log-policy.d.ts +1 -1
  6. package/dist/audit/access-log-policy.js +20 -11
  7. package/dist/audit/activity.d.ts +12 -12
  8. package/dist/audit/retention-policy.js +40 -22
  9. package/dist/billing/plan-type.d.ts +53 -0
  10. package/dist/billing/plan-type.js +70 -0
  11. package/dist/bundler/rolldown-config.d.ts +3 -3
  12. package/dist/check-mode.d.ts +1 -1
  13. package/dist/context/concurrency-strategy.d.ts +34 -0
  14. package/dist/context/concurrency-strategy.js +35 -0
  15. package/dist/context/held-run-job-id.d.ts +45 -0
  16. package/dist/context/held-run-job-id.js +56 -0
  17. package/dist/context/held-run-status.d.ts +33 -0
  18. package/dist/context/held-run-status.js +37 -0
  19. package/dist/context/hold-expiry.d.ts +20 -0
  20. package/dist/context/hold-expiry.js +25 -0
  21. package/dist/context/hold-reason.d.ts +33 -0
  22. package/dist/context/hold-reason.js +23 -0
  23. package/dist/context/hold-type.d.ts +40 -0
  24. package/dist/context/hold-type.js +61 -0
  25. package/dist/{environment → context}/host-match.js +1 -1
  26. package/dist/context/index.d.ts +14 -0
  27. package/dist/context/index.js +12 -0
  28. package/dist/context/multi-context.d.ts +30 -0
  29. package/dist/context/multi-context.js +38 -0
  30. package/dist/context/scope-name.d.ts +29 -0
  31. package/dist/context/scope-name.js +49 -0
  32. package/dist/context/scope-resolver.d.ts +79 -0
  33. package/dist/{environment → context}/scope-resolver.js +47 -17
  34. package/dist/{environment → context}/scope-template.js +1 -1
  35. package/dist/{environment → context}/types.d.ts +25 -22
  36. package/dist/{environment → context}/types.js +3 -3
  37. package/dist/dev-ops/operations.d.ts +9 -1
  38. package/dist/dev-ops/operations.js +37 -20
  39. package/dist/diagnostics/infra-alert.d.ts +71 -0
  40. package/dist/diagnostics/infra-alert.js +60 -0
  41. package/dist/env/environment-allowlist.d.ts +26 -3
  42. package/dist/env/environment-allowlist.js +35 -1
  43. package/dist/fanout/materialize.d.ts +16 -0
  44. package/dist/fanout/materialize.js +34 -5
  45. package/dist/index.d.ts +16 -7
  46. package/dist/index.js +38 -23
  47. package/dist/inputs/descriptor.d.ts +9 -9
  48. package/dist/inventory.d.ts +4 -4
  49. package/dist/labels.d.ts +82 -2
  50. package/dist/labels.js +119 -1
  51. package/dist/matrix/expand.d.ts +49 -2
  52. package/dist/matrix/expand.js +102 -13
  53. package/dist/matrix/format.d.ts +6 -1
  54. package/dist/matrix/format.js +6 -1
  55. package/dist/mcp/held-run-resolve.d.ts +7 -10
  56. package/dist/mcp/held-run-resolve.js +33 -7
  57. package/dist/metrics/catalog-policy.js +4 -4
  58. package/dist/metrics/metric-catalog.generated.d.ts +954 -734
  59. package/dist/metrics/metric-catalog.generated.js +296 -32
  60. package/dist/metrics/metric-kind-compat.d.ts +26 -0
  61. package/dist/metrics/metric-kind-compat.js +33 -0
  62. package/dist/protocol/analytics-events.d.ts +6 -6
  63. package/dist/protocol/dashboard-api-errors.d.ts +13 -0
  64. package/dist/protocol/dashboard-api-errors.js +17 -0
  65. package/dist/protocol/dashboard-write-operations.d.ts +143 -86
  66. package/dist/protocol/dashboard-write-operations.js +143 -69
  67. package/dist/protocol/messages/access-log.d.ts +438 -388
  68. package/dist/protocol/messages/access-log.js +24 -14
  69. package/dist/protocol/messages/actor.d.ts +2 -2
  70. package/dist/protocol/messages/agent-dev-ops.d.ts +4 -2
  71. package/dist/protocol/messages/agent-dev-ops.js +2 -5
  72. package/dist/protocol/messages/agent-run-result.d.ts +74 -64
  73. package/dist/protocol/messages/agent-run-result.js +1 -1
  74. package/dist/protocol/messages/auth.d.ts +35 -23
  75. package/dist/protocol/messages/browser.d.ts +81 -5
  76. package/dist/protocol/messages/browser.js +53 -2
  77. package/dist/protocol/messages/capabilities.d.ts +106 -31
  78. package/dist/protocol/messages/capabilities.js +94 -10
  79. package/dist/protocol/messages/common.d.ts +45 -2
  80. package/dist/protocol/messages/common.js +64 -3
  81. package/dist/protocol/messages/dashboard-sealed-write.d.ts +52 -0
  82. package/dist/protocol/messages/dashboard-sealed-write.js +57 -0
  83. package/dist/protocol/messages/dashboard.d.ts +1232 -706
  84. package/dist/protocol/messages/dashboard.js +387 -220
  85. package/dist/protocol/messages/deployment-identity.d.ts +37 -10
  86. package/dist/protocol/messages/deployment-identity.js +30 -3
  87. package/dist/protocol/messages/event-log.d.ts +5 -5
  88. package/dist/protocol/messages/execution-status.d.ts +198 -62
  89. package/dist/protocol/messages/execution-status.js +114 -46
  90. package/dist/protocol/messages/heartbeat-health.d.ts +83 -0
  91. package/dist/protocol/messages/heartbeat-health.js +87 -0
  92. package/dist/protocol/messages/log-stream.d.ts +18 -0
  93. package/dist/protocol/messages/log-stream.js +19 -0
  94. package/dist/protocol/messages/oidc-mint.d.ts +7 -0
  95. package/dist/protocol/messages/oidc-mint.js +7 -0
  96. package/dist/protocol/messages/orchestrator-agent.d.ts +264 -67
  97. package/dist/protocol/messages/orchestrator-agent.js +170 -5
  98. package/dist/protocol/messages/pat-kind.d.ts +1 -1
  99. package/dist/protocol/messages/peer.d.ts +122 -58
  100. package/dist/protocol/messages/peer.js +37 -2
  101. package/dist/protocol/messages/platform-orchestrator.d.ts +603 -258
  102. package/dist/protocol/messages/platform-orchestrator.js +131 -21
  103. package/dist/protocol/messages/run-events.d.ts +5 -5
  104. package/dist/protocol/messages/scaler-event.d.ts +3 -3
  105. package/dist/protocol/messages/source-registration.d.ts +56 -13
  106. package/dist/protocol/messages/source-registration.js +49 -6
  107. package/dist/protocol/session-policy.d.ts +20 -0
  108. package/dist/protocol/session-policy.js +25 -0
  109. package/dist/protocol/source-origin.d.ts +1 -1
  110. package/dist/provenance/attestation-origin.d.ts +1 -1
  111. package/dist/provenance/schema.d.ts +11 -11
  112. package/dist/provenance/verify.js +2 -1
  113. package/dist/provider/changed-files-fetcher.d.ts +21 -2
  114. package/dist/provider/check-run-conclusion.d.ts +2 -2
  115. package/dist/provider/check-status-poster.d.ts +23 -0
  116. package/dist/provider/index.d.ts +2 -2
  117. package/dist/registration/registerable-trigger-type.d.ts +14 -13
  118. package/dist/registration/registerable-trigger-type.js +1 -0
  119. package/dist/sandbox/capabilities.d.ts +6 -0
  120. package/dist/sandbox/capabilities.js +57 -0
  121. package/dist/scaler/scaler-backend-type.d.ts +1 -1
  122. package/dist/status/presentation.d.ts +89 -0
  123. package/dist/status/presentation.js +163 -0
  124. package/dist/trigger/compiled-matchers.d.ts +13 -0
  125. package/dist/trigger/compiled-matchers.js +44 -0
  126. package/dist/trigger/event-buckets.d.ts +44 -0
  127. package/dist/trigger/event-buckets.js +93 -0
  128. package/dist/trigger/matcher.d.ts +7 -3
  129. package/dist/trigger/matcher.js +53 -15
  130. package/dist/trigger/schedule-key.d.ts +14 -0
  131. package/dist/trigger/schedule-key.js +21 -0
  132. package/dist/trigger/trigger-event-type.d.ts +1 -1
  133. package/dist/trigger/trigger-event-type.js +2 -0
  134. package/dist/trigger/types.d.ts +178 -47
  135. package/dist/trigger/types.js +82 -24
  136. package/dist/webhook/event-types.d.ts +56 -0
  137. package/dist/webhook/event-types.js +59 -0
  138. package/dist/ws/ws-like.d.ts +13 -0
  139. package/package.json +26 -10
  140. package/sbom.spdx.json +10 -10
  141. package/dist/environment/index.d.ts +0 -6
  142. package/dist/environment/index.js +0 -5
  143. package/dist/environment/multi-env.d.ts +0 -30
  144. package/dist/environment/multi-env.js +0 -38
  145. package/dist/environment/scope-resolver.d.ts +0 -46
  146. package/dist/package-manager.d.ts +0 -20
  147. package/dist/protocol/messages/observe.d.ts +0 -76
  148. package/dist/protocol/messages/saas-orchestrator.d.ts +0 -2179
  149. package/dist/protocol/messages/test-run.d.ts +0 -59
  150. package/dist/state-machine/index.d.ts +0 -2
  151. package/dist/state-machine/index.js +0 -3
  152. package/dist/state-machine/machine.d.ts +0 -34
  153. package/dist/state-machine/machine.js +0 -103
  154. package/dist/state-machine/types.d.ts +0 -34
  155. package/dist/state-machine/types.js +0 -15
  156. /package/dist/{environment → context}/host-match.d.ts +0 -0
  157. /package/dist/{environment → context}/scope-template.d.ts +0 -0
@@ -1,7 +1,9 @@
1
1
  import "../../rolldown-runtime-ClRpJifh.js";
2
2
  import { ExecutionJobStatus, ExecutionStepStatus, StepConcurrencyKind } from "./execution-status.js";
3
3
  import { dsseEnvelopeSchema } from "../../provenance/dsse.js";
4
- import { approverClauseSchema } from "../../approval/types.js";
4
+ import { approvalTimeoutSecondsSchema, approverClauseSchema } from "../../approval/types.js";
5
+ import { orchAgentCapabilitiesSchema } from "./capabilities.js";
6
+ import { LogStream } from "./log-stream.js";
5
7
  import { z } from "zod";
6
8
  //#region src/protocol/messages/orchestrator-agent.ts
7
9
  /**
@@ -83,6 +85,12 @@ const jobDispatchSchema = z.object({
83
85
  namespacedSecrets: z.record(z.string(), z.record(z.string(), z.string())).optional(),
84
86
  /** Max log size per step in bytes. Agent falls back to its own config default (10MB). */
85
87
  maxLogSizeBytes: z.coerce.number().optional(),
88
+ /**
89
+ * Orchestrator-resolved concurrency-slot wait timeout (ms), from the
90
+ * fleet-wide `cluster_settings.concurrency_wait_timeout_ms`. Agent falls
91
+ * back to its own env/config default (1h) when absent (older orchestrators).
92
+ */
93
+ concurrencyWaitTimeoutMs: z.coerce.number().optional(),
86
94
  /** URL or file:// path to a pre-packed `.kici/` source tarball. If present, agent extracts it into workDir instead of cloning the repo. */
87
95
  sourceTarUrl: z.string().optional(),
88
96
  /** SHA-256 hash of the source tarball bytes for integrity verification on download. */
@@ -194,7 +202,13 @@ const registerAckSchema = z.object({
194
202
  * If the dispatch never arrives (orchestrator crash, etc.) the agent's
195
203
  * KICI_SCALER_PENDING_DISPATCH_TIMEOUT (default 60s) acts as a safety net.
196
204
  */
197
- pendingDispatch: z.boolean().optional()
205
+ pendingDispatch: z.boolean().optional(),
206
+ /**
207
+ * Optional agent-facing capabilities this orchestrator supports (absent on
208
+ * pre-capability orchestrators). The agent reads it to decide whether to
209
+ * await optional acks like `artifacts.upload.complete.ack`.
210
+ */
211
+ capabilities: orchAgentCapabilitiesSchema.optional()
198
212
  });
199
213
  /** Agent registration with capabilities and capacity. */
200
214
  const agentRegisterSchema = z.object({
@@ -327,7 +341,12 @@ const agentLogChunkSchema = z.object({
327
341
  jobId: z.string(),
328
342
  stepIndex: z.number(),
329
343
  lines: z.array(z.string()),
330
- timestamp: z.number()
344
+ timestamp: z.number(),
345
+ /**
346
+ * Which stream these lines came from. Optional for backward compatibility
347
+ * with agents that do not send it; absent is read as `stdout`.
348
+ */
349
+ stream: LogStream.optional()
331
350
  });
332
351
  /** Step-level execution state report (agent -> orchestrator). */
333
352
  const agentStepStatusSchema = z.object({
@@ -559,6 +578,146 @@ const provenanceUploadDeferSchema = z.object({
559
578
  /** Ephemeral public key JWK the envelope was signed with. */
560
579
  publicKey: z.record(z.string(), z.unknown())
561
580
  });
581
+ /**
582
+ * Outcome of an artifact upload grant: the orchestrator either mints a
583
+ * presigned PUT (`granted`) or refuses with a named reason (`rejected`).
584
+ */
585
+ const ArtifactUploadOutcome = z.enum(["granted", "rejected"]);
586
+ /**
587
+ * Why an artifact upload was refused. Each value maps to an enforcement gate
588
+ * checked BEFORE a presigned PUT is minted; the agent surfaces the reason
589
+ * verbatim in the step error.
590
+ */
591
+ const ArtifactRejectReason = z.enum([
592
+ "duplicate_name",
593
+ "size_cap",
594
+ "run_cap",
595
+ "org_quota"
596
+ ]);
597
+ /** Outcome of an artifact download lookup: the named artifact exists or not. */
598
+ const ArtifactDownloadOutcome = z.enum(["found", "not_found"]);
599
+ /** Agent -> Orchestrator: request a presigned PUT for a named artifact upload. */
600
+ const artifactsUploadRequestSchema = z.object({
601
+ type: z.literal("artifacts.upload.request"),
602
+ messageId: z.string(),
603
+ /** Job producing the artifact (ownership-checked; run + org resolved server-side). */
604
+ jobId: z.string(),
605
+ /** Artifact name (immutability + storage-key discriminator within the run). */
606
+ name: z.string(),
607
+ /** Packed tarball size in bytes — drives the size/run/quota enforcement gates. */
608
+ declaredSizeBytes: z.number().int().nonnegative()
609
+ });
610
+ /**
611
+ * Orchestrator -> Agent: a presigned PUT (`granted`) or a named refusal
612
+ * (`rejected`). All enforcement (duplicate name, per-artifact/per-run cap, org
613
+ * quota) happens before minting, so a `granted` URL is safe to upload to.
614
+ */
615
+ const artifactsUploadResponseSchema = z.object({
616
+ type: z.literal("artifacts.upload.response"),
617
+ requestId: z.string(),
618
+ outcome: ArtifactUploadOutcome,
619
+ /** Presigned PUT URL. Present only on `granted`. */
620
+ uploadUrl: z.string().optional(),
621
+ /** Final storage key the agent echoes back on complete. Present only on `granted`. */
622
+ storageKey: z.string().optional(),
623
+ /** Enforcement-gate refusal reason. Present only on `rejected` at an enforcement gate. */
624
+ reason: ArtifactRejectReason.optional(),
625
+ /**
626
+ * Failure detail. Present only on `rejected` when no enforcement `reason`
627
+ * applies — the requested name violates the artifact-name contract, artifact
628
+ * uploads are not configured on the orchestrator, the job's run could not be
629
+ * resolved, the job is not owned by this agent, or the orchestrator hit an
630
+ * internal error. A safe, fixed,
631
+ * human-readable string; never a raw exception. Older agents ignore the field
632
+ * and fall back to a generic rejection message.
633
+ */
634
+ error: z.string().optional()
635
+ });
636
+ /** Agent -> Orchestrator: confirm an artifact upload finished; records the DB row. */
637
+ const artifactsUploadCompleteSchema = z.object({
638
+ type: z.literal("artifacts.upload.complete"),
639
+ messageId: z.string(),
640
+ jobId: z.string(),
641
+ name: z.string(),
642
+ /**
643
+ * Packed tarball size in bytes.
644
+ *
645
+ * @deprecated Advisory only — the orchestrator reads the real object size back
646
+ * from storage and records that instead. Still sent for backward compatibility
647
+ * with older orchestrators; removed at v1.0.0.
648
+ */
649
+ sizeBytes: z.number().int().nonnegative(),
650
+ /** SHA-256 (hex) of the tarball bytes. */
651
+ sha256: z.string(),
652
+ /**
653
+ * Storage key echoed from the grant response.
654
+ *
655
+ * @deprecated Ignored server-side — the orchestrator derives the storage key
656
+ * from the server-resolved run and artifact name. Still sent for backward
657
+ * compatibility with older orchestrators; removed at v1.0.0.
658
+ */
659
+ storageKey: z.string()
660
+ });
661
+ /**
662
+ * Outcome the orchestrator reports for an artifact commit: the DB row was
663
+ * written (`committed`) or the commit could not be completed (`failed`).
664
+ */
665
+ const ArtifactCompleteAckOutcome = z.enum(["committed", "failed"]);
666
+ /**
667
+ * Orchestrator -> Agent: the outcome of committing an
668
+ * `artifacts.upload.complete`. Sent by orchestrators that advertise the
669
+ * `artifactCompleteAck` capability on `register.ack`; the agent awaits it and
670
+ * fails the workflow step on `failed`/timeout, so a lost commit surfaces as a
671
+ * failed step instead of a green run with a missing artifact. `requestId`
672
+ * echoes the complete message's `messageId`.
673
+ */
674
+ const artifactsUploadCompleteAckSchema = z.object({
675
+ type: z.literal("artifacts.upload.complete.ack"),
676
+ requestId: z.string(),
677
+ outcome: ArtifactCompleteAckOutcome,
678
+ /**
679
+ * Failure detail — present only on `failed`. A safe, fixed, human-readable
680
+ * string classifying the failure: artifact uploads are not configured, the
681
+ * job's run could not be resolved, the job is not owned by this agent, the
682
+ * uploaded object was missing at commit time, the name violates the
683
+ * artifact-name contract, or the commit failed internally.
684
+ */
685
+ reason: z.string().optional()
686
+ });
687
+ /** Agent -> Orchestrator: request a presigned GET for a named artifact of this run. */
688
+ const artifactsDownloadRequestSchema = z.object({
689
+ type: z.literal("artifacts.download.request"),
690
+ messageId: z.string(),
691
+ /** Job requesting the download (ownership-checked; run resolved server-side). */
692
+ jobId: z.string(),
693
+ /** Artifact name to resolve within the run. */
694
+ name: z.string()
695
+ });
696
+ /**
697
+ * Orchestrator -> Agent: presigned GET + size/sha256 for the named artifact, or
698
+ * `not_found` when the run never uploaded an artifact by that name.
699
+ */
700
+ const artifactsDownloadResponseSchema = z.object({
701
+ type: z.literal("artifacts.download.response"),
702
+ requestId: z.string(),
703
+ outcome: ArtifactDownloadOutcome,
704
+ /** Presigned GET URL. Present only on `found`. */
705
+ downloadUrl: z.string().optional(),
706
+ /** Artifact size in bytes. Present only on `found`. */
707
+ sizeBytes: z.number().int().nonnegative().optional(),
708
+ /** SHA-256 (hex) of the tarball bytes for integrity verification. Present only on `found`. */
709
+ sha256: z.string().optional(),
710
+ /**
711
+ * Internal-failure detail. Present only on `not_found` when the outcome
712
+ * reflects an orchestrator failure — artifact downloads are not configured,
713
+ * the job's run could not be resolved, the job is not owned by this agent, or
714
+ * the orchestrator hit an internal error — rather than a genuinely missing
715
+ * artifact. A safe, fixed,
716
+ * human-readable string; never a raw exception. Older agents ignore the field
717
+ * and render the plain not-found message.
718
+ */
719
+ error: z.string().optional()
720
+ });
562
721
  /** Agent -> Orchestrator: emit a custom event from a running workflow step. */
563
722
  const eventEmitSchema = z.object({
564
723
  type: z.literal("event.emit"),
@@ -712,7 +871,7 @@ const stepApprovalRequestSchema = z.object({
712
871
  * Absent ⇒ the orchestrator uses the org-default `approval_expiry_seconds`.
713
872
  * The orchestrator owns the authoritative `expiresAt` computation.
714
873
  */
715
- timeoutSeconds: z.number().int().positive().optional(),
874
+ timeoutSeconds: approvalTimeoutSecondsSchema.optional(),
716
875
  /** Computed drift payload, present only for `when: 'drift'` gates. */
717
876
  payload: stepApprovalPayloadSchema.optional()
718
877
  });
@@ -743,6 +902,9 @@ const orchestratorToAgentMessageSchema = z.discriminatedUnion("type", [
743
902
  cacheUserRestoreResponseSchema,
744
903
  cacheUserSaveResponseSchema,
745
904
  provenanceUploadResponseSchema,
905
+ artifactsUploadResponseSchema,
906
+ artifactsUploadCompleteAckSchema,
907
+ artifactsDownloadResponseSchema,
746
908
  eventEmitResponseSchema,
747
909
  agentApiResponseSchema,
748
910
  agentAuthSuccessSchema,
@@ -771,6 +933,9 @@ const agentToOrchestratorMessageSchema = z.discriminatedUnion("type", [
771
933
  provenanceUploadRequestSchema,
772
934
  provenanceUploadCompleteSchema,
773
935
  provenanceUploadDeferSchema,
936
+ artifactsUploadRequestSchema,
937
+ artifactsUploadCompleteSchema,
938
+ artifactsDownloadRequestSchema,
774
939
  eventEmitSchema,
775
940
  agentApiRequestSchema,
776
941
  agentMetricsSchema,
@@ -780,6 +945,6 @@ const agentToOrchestratorMessageSchema = z.discriminatedUnion("type", [
780
945
  stepApprovalRequestSchema
781
946
  ]);
782
947
  //#endregion
783
- export { CacheRefScope, JobRejectReason, StepApprovalOutcome, agentApiRequestSchema, agentApiResponseSchema, agentAuthFailureSchema, agentAuthRequestSchema, agentAuthSuccessSchema, agentLogChunkSchema, agentMetricsSchema, agentRegisterSchema, agentStatusSchema, agentStepStatusSchema, agentToOrchestratorMessageSchema, cacheUserRestoreRequestSchema, cacheUserRestoreResponseSchema, cacheUserSaveCompleteSchema, cacheUserSaveRequestSchema, cacheUserSaveResponseSchema, configAckSchema, eventEmitResponseSchema, eventEmitSchema, fleetBundleChunkSchema, fleetBundleErrorSchema, fleetLogsRequestSchema, gitAuthSchema, jobAckSchema, jobCancelSchema, jobConcurrencyAckSchema, jobConcurrencyReportSchema, jobDispatchSchema, jobRejectSchema, jobStatusSchema, orchestratorToAgentMessageSchema, provenanceUploadCompleteSchema, provenanceUploadDeferSchema, provenanceUploadRequestSchema, provenanceUploadResponseSchema, registerAckSchema, stepApprovalPayloadSchema, stepApprovalRequestSchema, stepApprovalResolvedSchema, upstreamSnapshotSchema };
948
+ export { ArtifactCompleteAckOutcome, ArtifactDownloadOutcome, ArtifactRejectReason, ArtifactUploadOutcome, CacheRefScope, JobRejectReason, StepApprovalOutcome, agentApiRequestSchema, agentApiResponseSchema, agentAuthFailureSchema, agentAuthRequestSchema, agentAuthSuccessSchema, agentLogChunkSchema, agentMetricsSchema, agentRegisterSchema, agentStatusSchema, agentStepStatusSchema, agentToOrchestratorMessageSchema, artifactsDownloadRequestSchema, artifactsDownloadResponseSchema, artifactsUploadCompleteAckSchema, artifactsUploadCompleteSchema, artifactsUploadRequestSchema, artifactsUploadResponseSchema, cacheUserRestoreRequestSchema, cacheUserRestoreResponseSchema, cacheUserSaveCompleteSchema, cacheUserSaveRequestSchema, cacheUserSaveResponseSchema, configAckSchema, eventEmitResponseSchema, eventEmitSchema, fleetBundleChunkSchema, fleetBundleErrorSchema, fleetLogsRequestSchema, gitAuthSchema, jobAckSchema, jobCancelSchema, jobConcurrencyAckSchema, jobConcurrencyReportSchema, jobDispatchSchema, jobRejectSchema, jobStatusSchema, orchestratorToAgentMessageSchema, provenanceUploadCompleteSchema, provenanceUploadDeferSchema, provenanceUploadRequestSchema, provenanceUploadResponseSchema, registerAckSchema, stepApprovalPayloadSchema, stepApprovalRequestSchema, stepApprovalResolvedSchema, upstreamSnapshotSchema };
784
949
 
785
950
  //# sourceMappingURL=orchestrator-agent.js.map
@@ -9,8 +9,8 @@ import { z } from 'zod';
9
9
  * credential the developer MCP server accepts.
10
10
  */
11
11
  export declare const PatKind: z.ZodEnum<{
12
- user: "user";
13
12
  agent: "agent";
13
+ user: "user";
14
14
  }>;
15
15
  export type PatKind = z.infer<typeof PatKind>;
16
16
  //# sourceMappingURL=pat-kind.d.ts.map
@@ -3,8 +3,8 @@ import { z } from 'zod';
3
3
  export declare const peerCapabilitiesSchema: z.ZodObject<{
4
4
  s3LogAccess: z.ZodBoolean;
5
5
  logRoutingOverride: z.ZodOptional<z.ZodEnum<{
6
- direct: "direct";
7
6
  coordinator: "coordinator";
7
+ direct: "direct";
8
8
  }>>;
9
9
  }, z.core.$strip>;
10
10
  /** Scaler capacity summary included in peer heartbeat and auth response for routing decisions. */
@@ -72,8 +72,8 @@ export declare const peerAuthResponseSchema: z.ZodObject<{
72
72
  capabilities: z.ZodOptional<z.ZodObject<{
73
73
  s3LogAccess: z.ZodBoolean;
74
74
  logRoutingOverride: z.ZodOptional<z.ZodEnum<{
75
- direct: "direct";
76
75
  coordinator: "coordinator";
76
+ direct: "direct";
77
77
  }>>;
78
78
  }, z.core.$strip>>;
79
79
  }, z.core.$strip>;
@@ -97,8 +97,8 @@ export declare const peerHeartbeatSchema: z.ZodObject<{
97
97
  capabilities: z.ZodObject<{
98
98
  s3LogAccess: z.ZodBoolean;
99
99
  logRoutingOverride: z.ZodOptional<z.ZodEnum<{
100
- direct: "direct";
101
100
  coordinator: "coordinator";
101
+ direct: "direct";
102
102
  }>>;
103
103
  }, z.core.$strip>;
104
104
  scalerCapacity: z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -112,6 +112,7 @@ export declare const peerHeartbeatSchema: z.ZodObject<{
112
112
  }, z.core.$strip>>>;
113
113
  configVersion: z.ZodOptional<z.ZodNumber>;
114
114
  registryVersion: z.ZodOptional<z.ZodNumber>;
115
+ clusterSettingsVersion: z.ZodOptional<z.ZodNumber>;
115
116
  timestamp: z.ZodNumber;
116
117
  hostname: z.ZodOptional<z.ZodString>;
117
118
  osRelease: z.ZodOptional<z.ZodString>;
@@ -214,17 +215,18 @@ export declare const jobProgressSchema: z.ZodObject<{
214
215
  stepIndex: z.ZodNumber;
215
216
  stepName: z.ZodString;
216
217
  state: z.ZodEnum<{
217
- skipped: "skipped";
218
- success: "success";
219
- pending: "pending";
220
- running: "running";
221
- failed: "failed";
222
218
  cancelled: "cancelled";
223
219
  cancelling: "cancelling";
220
+ drift_dropped: "drift_dropped";
221
+ failed: "failed";
222
+ pending: "pending";
224
223
  queued: "queued";
225
224
  recovering: "recovering";
225
+ running: "running";
226
+ skipped: "skipped";
227
+ success: "success";
226
228
  timed_out_stale: "timed_out_stale";
227
- drift_dropped: "drift_dropped";
229
+ unroutable: "unroutable";
228
230
  }>;
229
231
  timestamp: z.ZodNumber;
230
232
  data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
@@ -240,17 +242,18 @@ export declare const jobProgressAckSchema: z.ZodObject<{
240
242
  runId: z.ZodString;
241
243
  jobId: z.ZodString;
242
244
  state: z.ZodEnum<{
243
- skipped: "skipped";
244
- success: "success";
245
- pending: "pending";
246
- running: "running";
247
- failed: "failed";
248
245
  cancelled: "cancelled";
249
246
  cancelling: "cancelling";
247
+ drift_dropped: "drift_dropped";
248
+ failed: "failed";
249
+ pending: "pending";
250
250
  queued: "queued";
251
251
  recovering: "recovering";
252
+ running: "running";
253
+ skipped: "skipped";
254
+ success: "success";
252
255
  timed_out_stale: "timed_out_stale";
253
- drift_dropped: "drift_dropped";
256
+ unroutable: "unroutable";
254
257
  }>;
255
258
  }, z.core.$strip>;
256
259
  /** Request to cancel a job on a peer orchestrator. */
@@ -292,8 +295,8 @@ declare const peerLogChunkSchema: z.ZodObject<{
292
295
  text: z.ZodString;
293
296
  timestamp: z.ZodNumber;
294
297
  stream: z.ZodOptional<z.ZodEnum<{
295
- stdout: "stdout";
296
298
  stderr: "stderr";
299
+ stdout: "stdout";
297
300
  }>>;
298
301
  }, z.core.$strip>>;
299
302
  }, z.core.$strip>;
@@ -304,8 +307,8 @@ declare const peerCacheUploadRequestSchema: z.ZodObject<{
304
307
  runId: z.ZodString;
305
308
  jobId: z.ZodString;
306
309
  cacheType: z.ZodEnum<{
307
- source: "source";
308
310
  deps: "deps";
311
+ source: "source";
309
312
  }>;
310
313
  hash: z.ZodString;
311
314
  sizeBytes: z.ZodNumber;
@@ -342,6 +345,38 @@ export declare const peerConfigReloadResponseSchema: z.ZodObject<{
342
345
  restartRequired: z.ZodOptional<z.ZodArray<z.ZodString>>;
343
346
  fieldsChanged: z.ZodOptional<z.ZodArray<z.ZodString>>;
344
347
  }, z.core.$strip>;
348
+ /**
349
+ * Worker-relevant cluster settings a DB-less worker pulls from the leader.
350
+ *
351
+ * A typed, concrete snapshot (not an open key/value bus): each worker-consumed
352
+ * cluster knob is a field here. Adding the next worker-relevant knob is one
353
+ * field on this schema, not a new protocol message.
354
+ */
355
+ export declare const workerClusterSettingsSchema: z.ZodObject<{
356
+ agentTokenTtlMs: z.ZodNumber;
357
+ }, z.core.$strip>;
358
+ /**
359
+ * Cluster-settings pull request: a DB-less worker asks the leader for the
360
+ * current worker-settings snapshot after observing the leader's advertised
361
+ * clusterSettingsVersion ahead of its own. The leader replies with
362
+ * peer.clusterSettings.response.
363
+ */
364
+ export declare const peerClusterSettingsRequestSchema: z.ZodObject<{
365
+ type: z.ZodLiteral<"peer.clusterSettings.request">;
366
+ messageId: z.ZodString;
367
+ }, z.core.$strip>;
368
+ /**
369
+ * Cluster-settings pull response: the leader resolves the snapshot from
370
+ * cluster_settings and replies with it plus the current version.
371
+ */
372
+ export declare const peerClusterSettingsResponseSchema: z.ZodObject<{
373
+ type: z.ZodLiteral<"peer.clusterSettings.response">;
374
+ messageId: z.ZodString;
375
+ version: z.ZodNumber;
376
+ settings: z.ZodObject<{
377
+ agentTokenTtlMs: z.ZodNumber;
378
+ }, z.core.$strip>;
379
+ }, z.core.$strip>;
345
380
  /** Which of THIS peer's downstream nodes to gather. all=true ignores the id lists. */
346
381
  export declare const fleetSelectionSchema: z.ZodObject<{
347
382
  all: z.ZodBoolean;
@@ -406,11 +441,11 @@ export declare const peerScalerEventSchema: z.ZodObject<{
406
441
  jobId: z.ZodString;
407
442
  agentId: z.ZodString;
408
443
  eventType: z.ZodEnum<{
409
- "scaler.provisioning": "scaler.provisioning";
444
+ "agent.connecting": "agent.connecting";
445
+ "scaler.failed": "scaler.failed";
410
446
  "scaler.network": "scaler.network";
447
+ "scaler.provisioning": "scaler.provisioning";
411
448
  "scaler.ready": "scaler.ready";
412
- "scaler.failed": "scaler.failed";
413
- "agent.connecting": "agent.connecting";
414
449
  }>;
415
450
  detail: z.ZodString;
416
451
  timestampMs: z.ZodNumber;
@@ -464,8 +499,8 @@ export declare const peerToPeerMessageSchema: z.ZodDiscriminatedUnion<[z.ZodObje
464
499
  capabilities: z.ZodOptional<z.ZodObject<{
465
500
  s3LogAccess: z.ZodBoolean;
466
501
  logRoutingOverride: z.ZodOptional<z.ZodEnum<{
467
- direct: "direct";
468
502
  coordinator: "coordinator";
503
+ direct: "direct";
469
504
  }>>;
470
505
  }, z.core.$strip>>;
471
506
  }, z.core.$strip>, z.ZodObject<{
@@ -487,8 +522,8 @@ export declare const peerToPeerMessageSchema: z.ZodDiscriminatedUnion<[z.ZodObje
487
522
  capabilities: z.ZodObject<{
488
523
  s3LogAccess: z.ZodBoolean;
489
524
  logRoutingOverride: z.ZodOptional<z.ZodEnum<{
490
- direct: "direct";
491
525
  coordinator: "coordinator";
526
+ direct: "direct";
492
527
  }>>;
493
528
  }, z.core.$strip>;
494
529
  scalerCapacity: z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -502,6 +537,7 @@ export declare const peerToPeerMessageSchema: z.ZodDiscriminatedUnion<[z.ZodObje
502
537
  }, z.core.$strip>>>;
503
538
  configVersion: z.ZodOptional<z.ZodNumber>;
504
539
  registryVersion: z.ZodOptional<z.ZodNumber>;
540
+ clusterSettingsVersion: z.ZodOptional<z.ZodNumber>;
505
541
  timestamp: z.ZodNumber;
506
542
  hostname: z.ZodOptional<z.ZodString>;
507
543
  osRelease: z.ZodOptional<z.ZodString>;
@@ -579,17 +615,18 @@ export declare const peerToPeerMessageSchema: z.ZodDiscriminatedUnion<[z.ZodObje
579
615
  stepIndex: z.ZodNumber;
580
616
  stepName: z.ZodString;
581
617
  state: z.ZodEnum<{
582
- skipped: "skipped";
583
- success: "success";
584
- pending: "pending";
585
- running: "running";
586
- failed: "failed";
587
618
  cancelled: "cancelled";
588
619
  cancelling: "cancelling";
620
+ drift_dropped: "drift_dropped";
621
+ failed: "failed";
622
+ pending: "pending";
589
623
  queued: "queued";
590
624
  recovering: "recovering";
625
+ running: "running";
626
+ skipped: "skipped";
627
+ success: "success";
591
628
  timed_out_stale: "timed_out_stale";
592
- drift_dropped: "drift_dropped";
629
+ unroutable: "unroutable";
593
630
  }>;
594
631
  timestamp: z.ZodNumber;
595
632
  data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
@@ -598,17 +635,18 @@ export declare const peerToPeerMessageSchema: z.ZodDiscriminatedUnion<[z.ZodObje
598
635
  runId: z.ZodString;
599
636
  jobId: z.ZodString;
600
637
  state: z.ZodEnum<{
601
- skipped: "skipped";
602
- success: "success";
603
- pending: "pending";
604
- running: "running";
605
- failed: "failed";
606
638
  cancelled: "cancelled";
607
639
  cancelling: "cancelling";
640
+ drift_dropped: "drift_dropped";
641
+ failed: "failed";
642
+ pending: "pending";
608
643
  queued: "queued";
609
644
  recovering: "recovering";
645
+ running: "running";
646
+ skipped: "skipped";
647
+ success: "success";
610
648
  timed_out_stale: "timed_out_stale";
611
- drift_dropped: "drift_dropped";
649
+ unroutable: "unroutable";
612
650
  }>;
613
651
  }, z.core.$strip>, z.ZodObject<{
614
652
  type: z.ZodLiteral<"peer.job.cancel">;
@@ -640,8 +678,8 @@ export declare const peerToPeerMessageSchema: z.ZodDiscriminatedUnion<[z.ZodObje
640
678
  text: z.ZodString;
641
679
  timestamp: z.ZodNumber;
642
680
  stream: z.ZodOptional<z.ZodEnum<{
643
- stdout: "stdout";
644
681
  stderr: "stderr";
682
+ stdout: "stdout";
645
683
  }>>;
646
684
  }, z.core.$strip>>;
647
685
  }, z.core.$strip>, z.ZodObject<{
@@ -650,8 +688,8 @@ export declare const peerToPeerMessageSchema: z.ZodDiscriminatedUnion<[z.ZodObje
650
688
  runId: z.ZodString;
651
689
  jobId: z.ZodString;
652
690
  cacheType: z.ZodEnum<{
653
- source: "source";
654
691
  deps: "deps";
692
+ source: "source";
655
693
  }>;
656
694
  hash: z.ZodString;
657
695
  sizeBytes: z.ZodNumber;
@@ -673,6 +711,16 @@ export declare const peerToPeerMessageSchema: z.ZodDiscriminatedUnion<[z.ZodObje
673
711
  errors: z.ZodOptional<z.ZodArray<z.ZodString>>;
674
712
  restartRequired: z.ZodOptional<z.ZodArray<z.ZodString>>;
675
713
  fieldsChanged: z.ZodOptional<z.ZodArray<z.ZodString>>;
714
+ }, z.core.$strip>, z.ZodObject<{
715
+ type: z.ZodLiteral<"peer.clusterSettings.request">;
716
+ messageId: z.ZodString;
717
+ }, z.core.$strip>, z.ZodObject<{
718
+ type: z.ZodLiteral<"peer.clusterSettings.response">;
719
+ messageId: z.ZodString;
720
+ version: z.ZodNumber;
721
+ settings: z.ZodObject<{
722
+ agentTokenTtlMs: z.ZodNumber;
723
+ }, z.core.$strip>;
676
724
  }, z.core.$strip>, z.ZodObject<{
677
725
  type: z.ZodLiteral<"peer.logs.collect.request">;
678
726
  messageId: z.ZodString;
@@ -707,11 +755,11 @@ export declare const peerToPeerMessageSchema: z.ZodDiscriminatedUnion<[z.ZodObje
707
755
  jobId: z.ZodString;
708
756
  agentId: z.ZodString;
709
757
  eventType: z.ZodEnum<{
710
- "scaler.provisioning": "scaler.provisioning";
758
+ "agent.connecting": "agent.connecting";
759
+ "scaler.failed": "scaler.failed";
711
760
  "scaler.network": "scaler.network";
761
+ "scaler.provisioning": "scaler.provisioning";
712
762
  "scaler.ready": "scaler.ready";
713
- "scaler.failed": "scaler.failed";
714
- "agent.connecting": "agent.connecting";
715
763
  }>;
716
764
  detail: z.ZodString;
717
765
  timestampMs: z.ZodNumber;
@@ -765,8 +813,8 @@ export declare const peerFromPeerMessageSchema: z.ZodDiscriminatedUnion<[z.ZodOb
765
813
  capabilities: z.ZodOptional<z.ZodObject<{
766
814
  s3LogAccess: z.ZodBoolean;
767
815
  logRoutingOverride: z.ZodOptional<z.ZodEnum<{
768
- direct: "direct";
769
816
  coordinator: "coordinator";
817
+ direct: "direct";
770
818
  }>>;
771
819
  }, z.core.$strip>>;
772
820
  }, z.core.$strip>, z.ZodObject<{
@@ -788,8 +836,8 @@ export declare const peerFromPeerMessageSchema: z.ZodDiscriminatedUnion<[z.ZodOb
788
836
  capabilities: z.ZodObject<{
789
837
  s3LogAccess: z.ZodBoolean;
790
838
  logRoutingOverride: z.ZodOptional<z.ZodEnum<{
791
- direct: "direct";
792
839
  coordinator: "coordinator";
840
+ direct: "direct";
793
841
  }>>;
794
842
  }, z.core.$strip>;
795
843
  scalerCapacity: z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -803,6 +851,7 @@ export declare const peerFromPeerMessageSchema: z.ZodDiscriminatedUnion<[z.ZodOb
803
851
  }, z.core.$strip>>>;
804
852
  configVersion: z.ZodOptional<z.ZodNumber>;
805
853
  registryVersion: z.ZodOptional<z.ZodNumber>;
854
+ clusterSettingsVersion: z.ZodOptional<z.ZodNumber>;
806
855
  timestamp: z.ZodNumber;
807
856
  hostname: z.ZodOptional<z.ZodString>;
808
857
  osRelease: z.ZodOptional<z.ZodString>;
@@ -880,17 +929,18 @@ export declare const peerFromPeerMessageSchema: z.ZodDiscriminatedUnion<[z.ZodOb
880
929
  stepIndex: z.ZodNumber;
881
930
  stepName: z.ZodString;
882
931
  state: z.ZodEnum<{
883
- skipped: "skipped";
884
- success: "success";
885
- pending: "pending";
886
- running: "running";
887
- failed: "failed";
888
932
  cancelled: "cancelled";
889
933
  cancelling: "cancelling";
934
+ drift_dropped: "drift_dropped";
935
+ failed: "failed";
936
+ pending: "pending";
890
937
  queued: "queued";
891
938
  recovering: "recovering";
939
+ running: "running";
940
+ skipped: "skipped";
941
+ success: "success";
892
942
  timed_out_stale: "timed_out_stale";
893
- drift_dropped: "drift_dropped";
943
+ unroutable: "unroutable";
894
944
  }>;
895
945
  timestamp: z.ZodNumber;
896
946
  data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
@@ -899,17 +949,18 @@ export declare const peerFromPeerMessageSchema: z.ZodDiscriminatedUnion<[z.ZodOb
899
949
  runId: z.ZodString;
900
950
  jobId: z.ZodString;
901
951
  state: z.ZodEnum<{
902
- skipped: "skipped";
903
- success: "success";
904
- pending: "pending";
905
- running: "running";
906
- failed: "failed";
907
952
  cancelled: "cancelled";
908
953
  cancelling: "cancelling";
954
+ drift_dropped: "drift_dropped";
955
+ failed: "failed";
956
+ pending: "pending";
909
957
  queued: "queued";
910
958
  recovering: "recovering";
959
+ running: "running";
960
+ skipped: "skipped";
961
+ success: "success";
911
962
  timed_out_stale: "timed_out_stale";
912
- drift_dropped: "drift_dropped";
963
+ unroutable: "unroutable";
913
964
  }>;
914
965
  }, z.core.$strip>, z.ZodObject<{
915
966
  type: z.ZodLiteral<"peer.job.cancel">;
@@ -941,8 +992,8 @@ export declare const peerFromPeerMessageSchema: z.ZodDiscriminatedUnion<[z.ZodOb
941
992
  text: z.ZodString;
942
993
  timestamp: z.ZodNumber;
943
994
  stream: z.ZodOptional<z.ZodEnum<{
944
- stdout: "stdout";
945
995
  stderr: "stderr";
996
+ stdout: "stdout";
946
997
  }>>;
947
998
  }, z.core.$strip>>;
948
999
  }, z.core.$strip>, z.ZodObject<{
@@ -951,8 +1002,8 @@ export declare const peerFromPeerMessageSchema: z.ZodDiscriminatedUnion<[z.ZodOb
951
1002
  runId: z.ZodString;
952
1003
  jobId: z.ZodString;
953
1004
  cacheType: z.ZodEnum<{
954
- source: "source";
955
1005
  deps: "deps";
1006
+ source: "source";
956
1007
  }>;
957
1008
  hash: z.ZodString;
958
1009
  sizeBytes: z.ZodNumber;
@@ -974,6 +1025,16 @@ export declare const peerFromPeerMessageSchema: z.ZodDiscriminatedUnion<[z.ZodOb
974
1025
  errors: z.ZodOptional<z.ZodArray<z.ZodString>>;
975
1026
  restartRequired: z.ZodOptional<z.ZodArray<z.ZodString>>;
976
1027
  fieldsChanged: z.ZodOptional<z.ZodArray<z.ZodString>>;
1028
+ }, z.core.$strip>, z.ZodObject<{
1029
+ type: z.ZodLiteral<"peer.clusterSettings.request">;
1030
+ messageId: z.ZodString;
1031
+ }, z.core.$strip>, z.ZodObject<{
1032
+ type: z.ZodLiteral<"peer.clusterSettings.response">;
1033
+ messageId: z.ZodString;
1034
+ version: z.ZodNumber;
1035
+ settings: z.ZodObject<{
1036
+ agentTokenTtlMs: z.ZodNumber;
1037
+ }, z.core.$strip>;
977
1038
  }, z.core.$strip>, z.ZodObject<{
978
1039
  type: z.ZodLiteral<"peer.logs.collect.request">;
979
1040
  messageId: z.ZodString;
@@ -1008,11 +1069,11 @@ export declare const peerFromPeerMessageSchema: z.ZodDiscriminatedUnion<[z.ZodOb
1008
1069
  jobId: z.ZodString;
1009
1070
  agentId: z.ZodString;
1010
1071
  eventType: z.ZodEnum<{
1011
- "scaler.provisioning": "scaler.provisioning";
1072
+ "agent.connecting": "agent.connecting";
1073
+ "scaler.failed": "scaler.failed";
1012
1074
  "scaler.network": "scaler.network";
1075
+ "scaler.provisioning": "scaler.provisioning";
1013
1076
  "scaler.ready": "scaler.ready";
1014
- "scaler.failed": "scaler.failed";
1015
- "agent.connecting": "agent.connecting";
1016
1077
  }>;
1017
1078
  detail: z.ZodString;
1018
1079
  timestampMs: z.ZodNumber;
@@ -1033,6 +1094,9 @@ export type PeerCacheUploadRequest = z.infer<typeof peerCacheUploadRequestSchema
1033
1094
  export type PeerCacheUploadResponse = z.infer<typeof peerCacheUploadResponseSchema>;
1034
1095
  export type PeerConfigReload = z.infer<typeof peerConfigReloadSchema>;
1035
1096
  export type PeerConfigReloadResponse = z.infer<typeof peerConfigReloadResponseSchema>;
1097
+ export type WorkerClusterSettings = z.infer<typeof workerClusterSettingsSchema>;
1098
+ export type PeerClusterSettingsRequest = z.infer<typeof peerClusterSettingsRequestSchema>;
1099
+ export type PeerClusterSettingsResponse = z.infer<typeof peerClusterSettingsResponseSchema>;
1036
1100
  export type PeerLeaving = z.infer<typeof peerLeavingSchema>;
1037
1101
  export type PeerAgentTokenRevoke = z.infer<typeof peerAgentTokenRevokeSchema>;
1038
1102
  export type FleetSelection = z.infer<typeof fleetSelectionSchema>;