@kici-dev/engine 0.1.27 → 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 (148) hide show
  1. package/dist/approval/types.d.ts +8 -1
  2. package/dist/approval/types.js +8 -1
  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 +8 -0
  7. package/dist/audit/activity.d.ts +12 -12
  8. package/dist/audit/retention-policy.js +16 -0
  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/context/index.d.ts +9 -1
  26. package/dist/context/index.js +9 -2
  27. package/dist/context/multi-context.d.ts +3 -3
  28. package/dist/context/scope-name.d.ts +29 -0
  29. package/dist/context/scope-name.js +49 -0
  30. package/dist/context/scope-resolver.d.ts +33 -0
  31. package/dist/context/scope-resolver.js +45 -15
  32. package/dist/context/types.d.ts +8 -5
  33. package/dist/dev-ops/operations.d.ts +8 -0
  34. package/dist/dev-ops/operations.js +36 -19
  35. package/dist/diagnostics/infra-alert.d.ts +71 -0
  36. package/dist/diagnostics/infra-alert.js +60 -0
  37. package/dist/env/environment-allowlist.d.ts +4 -4
  38. package/dist/fanout/materialize.d.ts +16 -0
  39. package/dist/fanout/materialize.js +32 -3
  40. package/dist/index.d.ts +15 -6
  41. package/dist/index.js +34 -19
  42. package/dist/inputs/descriptor.d.ts +9 -9
  43. package/dist/inventory.d.ts +4 -4
  44. package/dist/labels.d.ts +82 -2
  45. package/dist/labels.js +119 -1
  46. package/dist/matrix/expand.d.ts +49 -2
  47. package/dist/matrix/expand.js +102 -13
  48. package/dist/matrix/format.d.ts +6 -1
  49. package/dist/matrix/format.js +6 -1
  50. package/dist/mcp/held-run-resolve.d.ts +7 -10
  51. package/dist/mcp/held-run-resolve.js +33 -7
  52. package/dist/metrics/catalog-policy.js +4 -4
  53. package/dist/metrics/metric-catalog.generated.d.ts +954 -739
  54. package/dist/metrics/metric-catalog.generated.js +278 -20
  55. package/dist/metrics/metric-kind-compat.d.ts +26 -0
  56. package/dist/metrics/metric-kind-compat.js +33 -0
  57. package/dist/protocol/analytics-events.d.ts +6 -6
  58. package/dist/protocol/dashboard-api-errors.d.ts +1 -0
  59. package/dist/protocol/dashboard-api-errors.js +5 -1
  60. package/dist/protocol/dashboard-write-operations.d.ts +143 -86
  61. package/dist/protocol/dashboard-write-operations.js +91 -17
  62. package/dist/protocol/messages/access-log.d.ts +437 -392
  63. package/dist/protocol/messages/access-log.js +11 -2
  64. package/dist/protocol/messages/actor.d.ts +2 -2
  65. package/dist/protocol/messages/agent-dev-ops.d.ts +4 -2
  66. package/dist/protocol/messages/agent-dev-ops.js +2 -5
  67. package/dist/protocol/messages/agent-run-result.d.ts +72 -62
  68. package/dist/protocol/messages/auth.d.ts +35 -23
  69. package/dist/protocol/messages/browser.d.ts +81 -5
  70. package/dist/protocol/messages/browser.js +53 -2
  71. package/dist/protocol/messages/capabilities.d.ts +106 -31
  72. package/dist/protocol/messages/capabilities.js +94 -10
  73. package/dist/protocol/messages/common.d.ts +45 -2
  74. package/dist/protocol/messages/common.js +64 -3
  75. package/dist/protocol/messages/dashboard-sealed-write.d.ts +52 -0
  76. package/dist/protocol/messages/dashboard-sealed-write.js +57 -0
  77. package/dist/protocol/messages/dashboard.d.ts +1022 -498
  78. package/dist/protocol/messages/dashboard.js +198 -31
  79. package/dist/protocol/messages/deployment-identity.d.ts +37 -10
  80. package/dist/protocol/messages/deployment-identity.js +30 -3
  81. package/dist/protocol/messages/event-log.d.ts +5 -5
  82. package/dist/protocol/messages/execution-status.d.ts +189 -53
  83. package/dist/protocol/messages/execution-status.js +108 -40
  84. package/dist/protocol/messages/heartbeat-health.d.ts +83 -0
  85. package/dist/protocol/messages/heartbeat-health.js +87 -0
  86. package/dist/protocol/messages/log-stream.d.ts +18 -0
  87. package/dist/protocol/messages/log-stream.js +19 -0
  88. package/dist/protocol/messages/oidc-mint.d.ts +7 -0
  89. package/dist/protocol/messages/oidc-mint.js +7 -0
  90. package/dist/protocol/messages/orchestrator-agent.d.ts +264 -67
  91. package/dist/protocol/messages/orchestrator-agent.js +170 -5
  92. package/dist/protocol/messages/pat-kind.d.ts +1 -1
  93. package/dist/protocol/messages/peer.d.ts +122 -58
  94. package/dist/protocol/messages/peer.js +37 -2
  95. package/dist/protocol/messages/platform-orchestrator.d.ts +561 -217
  96. package/dist/protocol/messages/platform-orchestrator.js +131 -21
  97. package/dist/protocol/messages/run-events.d.ts +5 -5
  98. package/dist/protocol/messages/scaler-event.d.ts +3 -3
  99. package/dist/protocol/messages/source-registration.d.ts +56 -13
  100. package/dist/protocol/messages/source-registration.js +49 -6
  101. package/dist/protocol/source-origin.d.ts +1 -1
  102. package/dist/provenance/attestation-origin.d.ts +1 -1
  103. package/dist/provenance/schema.d.ts +11 -11
  104. package/dist/provenance/verify.js +2 -1
  105. package/dist/provider/changed-files-fetcher.d.ts +21 -2
  106. package/dist/provider/check-run-conclusion.d.ts +2 -2
  107. package/dist/provider/check-status-poster.d.ts +23 -0
  108. package/dist/provider/index.d.ts +2 -2
  109. package/dist/registration/registerable-trigger-type.d.ts +14 -13
  110. package/dist/registration/registerable-trigger-type.js +1 -0
  111. package/dist/sandbox/capabilities.d.ts +6 -0
  112. package/dist/sandbox/capabilities.js +57 -0
  113. package/dist/scaler/scaler-backend-type.d.ts +1 -1
  114. package/dist/status/presentation.d.ts +89 -0
  115. package/dist/status/presentation.js +163 -0
  116. package/dist/trigger/compiled-matchers.d.ts +13 -0
  117. package/dist/trigger/compiled-matchers.js +44 -0
  118. package/dist/trigger/event-buckets.d.ts +44 -0
  119. package/dist/trigger/event-buckets.js +93 -0
  120. package/dist/trigger/matcher.d.ts +7 -3
  121. package/dist/trigger/matcher.js +53 -15
  122. package/dist/trigger/schedule-key.d.ts +14 -0
  123. package/dist/trigger/schedule-key.js +21 -0
  124. package/dist/trigger/trigger-event-type.d.ts +1 -1
  125. package/dist/trigger/trigger-event-type.js +2 -0
  126. package/dist/trigger/types.d.ts +173 -43
  127. package/dist/trigger/types.js +82 -25
  128. package/dist/webhook/event-types.d.ts +56 -0
  129. package/dist/webhook/event-types.js +59 -0
  130. package/dist/ws/ws-like.d.ts +13 -0
  131. package/package.json +12 -4
  132. package/sbom.spdx.json +10 -10
  133. package/dist/environment/host-match.d.ts +0 -25
  134. package/dist/environment/index.d.ts +0 -6
  135. package/dist/environment/multi-env.d.ts +0 -30
  136. package/dist/environment/scope-resolver.d.ts +0 -46
  137. package/dist/environment/scope-template.d.ts +0 -18
  138. package/dist/environment/types.d.ts +0 -119
  139. package/dist/package-manager.d.ts +0 -20
  140. package/dist/protocol/messages/observe.d.ts +0 -76
  141. package/dist/protocol/messages/saas-orchestrator.d.ts +0 -2179
  142. package/dist/protocol/messages/test-run.d.ts +0 -59
  143. package/dist/state-machine/index.d.ts +0 -2
  144. package/dist/state-machine/index.js +0 -3
  145. package/dist/state-machine/machine.d.ts +0 -34
  146. package/dist/state-machine/machine.js +0 -103
  147. package/dist/state-machine/types.d.ts +0 -34
  148. package/dist/state-machine/types.js +0 -15
@@ -0,0 +1,83 @@
1
+ /**
2
+ * Heartbeat-freshness policy for Platform connection and agent health.
3
+ *
4
+ * Two distinct policies live here, and their numbers differ on purpose.
5
+ *
6
+ * **Rendering policy** — badge freshness, computed from `last_heartbeat_at` on
7
+ * a DB row, by any instance. Advisory: nothing routes on a badge, so it can
8
+ * afford a tight bound. Two independent heartbeat domains consult it — Platform
9
+ * connection health (platform_connections) and agent liveness in the
10
+ * dashboard's infrastructure tree — so the two badges cannot drift apart.
11
+ * Browser-safe so the dashboard renders against the same numbers the server
12
+ * computes with.
13
+ *
14
+ * **Teardown policy** — applied by the owning instance to its own live sockets.
15
+ * Wider than the rendering bounds because the `platform_connections.status`
16
+ * write it drives gates every `status = 'connected'` reader — among them the
17
+ * plan-limit connection count, the cross-instance relay lookup, the dashboard
18
+ * proxy's owning-instance lookup, and the stale-orchestrator detector. Marking
19
+ * a live socket unhealthy too eagerly removes it from routing while it is still
20
+ * serving.
21
+ *
22
+ * The two policies also cover different lifetimes. An instance that closes a
23
+ * socket at HEARTBEAT_CLOSE_MS deletes its row in the same step, so the `stale`
24
+ * (HEARTBEAT_DEGRADED_MS) and `orphaned` (HEARTBEAT_STALE_THRESHOLD_SECONDS)
25
+ * levels describe rows that delete never ran for — the ones the orphan sweeper
26
+ * reaps. That is why the sweeper cutoff sits at twice HEARTBEAT_CLOSE_MS: a
27
+ * clean close always beats the sweep to the row.
28
+ *
29
+ * Neither policy has an unclassified case, which is what makes them safe to
30
+ * keep separate: the rendering policy maps a missing `last_heartbeat_at` to
31
+ * `orphaned` (worst-case, no heartbeat evidence at all), and the teardown
32
+ * policy never encounters one because the registry stamps `lastHeartbeatAt` at
33
+ * registration. Any future attempt to collapse the two must preserve that — an
34
+ * unknown treated as healthy hides a dead peer, and one treated as unhealthy
35
+ * sheds a live one.
36
+ *
37
+ * Consumers:
38
+ * - platform ws/connection-health.ts — the four-level status computation
39
+ * - platform ws/heartbeat.ts — the teardown policy
40
+ * - platform queue/jobs/orphan-sweeper.ts — periodic DELETE of orphan rows
41
+ * - platform ws/registry.ts — plan-limit count excludes stale rows
42
+ * - platform dashboard/routes/admin.ts — GET /admin/connections filter enum
43
+ * - platform dev-ops/developer-ops.ts — the diagnostics badge + orphan count
44
+ * - dashboard utils/diagnostics-helpers.ts — agent heartbeat badge colour
45
+ */
46
+ import { z } from 'zod';
47
+ /** A heartbeat younger than this is fully healthy. */
48
+ export declare const HEARTBEAT_FRESH_MS = 60000;
49
+ /** Between fresh and this, the peer is degraded but not yet presumed gone. */
50
+ export declare const HEARTBEAT_DEGRADED_MS = 300000;
51
+ /**
52
+ * A row is considered stale (the owning orchestrator process is no longer
53
+ * publishing heartbeats) when `last_heartbeat_at` is older than this. Past it,
54
+ * the connection is orphaned and the sweeper is entitled to delete the row.
55
+ *
56
+ * The Platform's same-instance DB eviction on reconnect
57
+ * (`ws/handler.ts#handleSourceRegistration`) shares this rationale: the DELETE
58
+ * itself is unconditional on staleness, but the reason it is needed at all is
59
+ * this same staleness window.
60
+ */
61
+ export declare const HEARTBEAT_STALE_THRESHOLD_SECONDS = 360;
62
+ /**
63
+ * Silence after which the owning instance writes
64
+ * `platform_connections.status = 'unhealthy'`. Wider than HEARTBEAT_FRESH_MS
65
+ * because that write gates relay routing, not rendering.
66
+ */
67
+ export declare const HEARTBEAT_UNHEALTHY_MARK_MS = 90000;
68
+ /**
69
+ * Silence after which the owning instance closes the socket with
70
+ * WS_CLOSE_HEARTBEAT_TIMEOUT (4004) and drops it from the registry — which
71
+ * deletes the platform_connections row too. A row outlives its socket only when
72
+ * that delete never ran; the orphan sweeper reaps those.
73
+ */
74
+ export declare const HEARTBEAT_CLOSE_MS = 180000;
75
+ /** The four-level connection health vocabulary, worst-last. */
76
+ export declare const connectionHealthStatusSchema: z.ZodEnum<{
77
+ connected: "connected";
78
+ orphaned: "orphaned";
79
+ stale: "stale";
80
+ unhealthy: "unhealthy";
81
+ }>;
82
+ export type ConnectionHealthStatus = z.infer<typeof connectionHealthStatusSchema>;
83
+ //# sourceMappingURL=heartbeat-health.d.ts.map
@@ -0,0 +1,87 @@
1
+ import "../../rolldown-runtime-ClRpJifh.js";
2
+ import { z } from "zod";
3
+ //#region src/protocol/messages/heartbeat-health.ts
4
+ /**
5
+ * Heartbeat-freshness policy for Platform connection and agent health.
6
+ *
7
+ * Two distinct policies live here, and their numbers differ on purpose.
8
+ *
9
+ * **Rendering policy** — badge freshness, computed from `last_heartbeat_at` on
10
+ * a DB row, by any instance. Advisory: nothing routes on a badge, so it can
11
+ * afford a tight bound. Two independent heartbeat domains consult it — Platform
12
+ * connection health (platform_connections) and agent liveness in the
13
+ * dashboard's infrastructure tree — so the two badges cannot drift apart.
14
+ * Browser-safe so the dashboard renders against the same numbers the server
15
+ * computes with.
16
+ *
17
+ * **Teardown policy** — applied by the owning instance to its own live sockets.
18
+ * Wider than the rendering bounds because the `platform_connections.status`
19
+ * write it drives gates every `status = 'connected'` reader — among them the
20
+ * plan-limit connection count, the cross-instance relay lookup, the dashboard
21
+ * proxy's owning-instance lookup, and the stale-orchestrator detector. Marking
22
+ * a live socket unhealthy too eagerly removes it from routing while it is still
23
+ * serving.
24
+ *
25
+ * The two policies also cover different lifetimes. An instance that closes a
26
+ * socket at HEARTBEAT_CLOSE_MS deletes its row in the same step, so the `stale`
27
+ * (HEARTBEAT_DEGRADED_MS) and `orphaned` (HEARTBEAT_STALE_THRESHOLD_SECONDS)
28
+ * levels describe rows that delete never ran for — the ones the orphan sweeper
29
+ * reaps. That is why the sweeper cutoff sits at twice HEARTBEAT_CLOSE_MS: a
30
+ * clean close always beats the sweep to the row.
31
+ *
32
+ * Neither policy has an unclassified case, which is what makes them safe to
33
+ * keep separate: the rendering policy maps a missing `last_heartbeat_at` to
34
+ * `orphaned` (worst-case, no heartbeat evidence at all), and the teardown
35
+ * policy never encounters one because the registry stamps `lastHeartbeatAt` at
36
+ * registration. Any future attempt to collapse the two must preserve that — an
37
+ * unknown treated as healthy hides a dead peer, and one treated as unhealthy
38
+ * sheds a live one.
39
+ *
40
+ * Consumers:
41
+ * - platform ws/connection-health.ts — the four-level status computation
42
+ * - platform ws/heartbeat.ts — the teardown policy
43
+ * - platform queue/jobs/orphan-sweeper.ts — periodic DELETE of orphan rows
44
+ * - platform ws/registry.ts — plan-limit count excludes stale rows
45
+ * - platform dashboard/routes/admin.ts — GET /admin/connections filter enum
46
+ * - platform dev-ops/developer-ops.ts — the diagnostics badge + orphan count
47
+ * - dashboard utils/diagnostics-helpers.ts — agent heartbeat badge colour
48
+ */
49
+ /** A heartbeat younger than this is fully healthy. */
50
+ const HEARTBEAT_FRESH_MS = 6e4;
51
+ /** Between fresh and this, the peer is degraded but not yet presumed gone. */
52
+ const HEARTBEAT_DEGRADED_MS = 3e5;
53
+ /**
54
+ * A row is considered stale (the owning orchestrator process is no longer
55
+ * publishing heartbeats) when `last_heartbeat_at` is older than this. Past it,
56
+ * the connection is orphaned and the sweeper is entitled to delete the row.
57
+ *
58
+ * The Platform's same-instance DB eviction on reconnect
59
+ * (`ws/handler.ts#handleSourceRegistration`) shares this rationale: the DELETE
60
+ * itself is unconditional on staleness, but the reason it is needed at all is
61
+ * this same staleness window.
62
+ */
63
+ const HEARTBEAT_STALE_THRESHOLD_SECONDS = 360;
64
+ /**
65
+ * Silence after which the owning instance writes
66
+ * `platform_connections.status = 'unhealthy'`. Wider than HEARTBEAT_FRESH_MS
67
+ * because that write gates relay routing, not rendering.
68
+ */
69
+ const HEARTBEAT_UNHEALTHY_MARK_MS = 9e4;
70
+ /**
71
+ * Silence after which the owning instance closes the socket with
72
+ * WS_CLOSE_HEARTBEAT_TIMEOUT (4004) and drops it from the registry — which
73
+ * deletes the platform_connections row too. A row outlives its socket only when
74
+ * that delete never ran; the orphan sweeper reaps those.
75
+ */
76
+ const HEARTBEAT_CLOSE_MS = 18e4;
77
+ /** The four-level connection health vocabulary, worst-last. */
78
+ const connectionHealthStatusSchema = z.enum([
79
+ "connected",
80
+ "unhealthy",
81
+ "stale",
82
+ "orphaned"
83
+ ]);
84
+ //#endregion
85
+ export { HEARTBEAT_CLOSE_MS, HEARTBEAT_DEGRADED_MS, HEARTBEAT_FRESH_MS, HEARTBEAT_STALE_THRESHOLD_SECONDS, HEARTBEAT_UNHEALTHY_MARK_MS, connectionHealthStatusSchema };
86
+
87
+ //# sourceMappingURL=heartbeat-health.js.map
@@ -0,0 +1,18 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * Which of a subprocess's two output streams a run-log line came from.
4
+ *
5
+ * Carried per log chunk rather than per line: chunks are delivered in order and
6
+ * the agent closes the pending chunk whenever the kind flips, so stdout/stderr
7
+ * interleaving is preserved without a per-line field.
8
+ *
9
+ * Lives in its own module because three protocol planes reference it — the
10
+ * agent→orchestrator chunk, the orchestrator→Platform relay, and the
11
+ * Platform→browser fan-out — and a shared leaf keeps those files acyclic.
12
+ */
13
+ export declare const LogStream: z.ZodEnum<{
14
+ stderr: "stderr";
15
+ stdout: "stdout";
16
+ }>;
17
+ export type LogStream = z.infer<typeof LogStream>;
18
+ //# sourceMappingURL=log-stream.d.ts.map
@@ -0,0 +1,19 @@
1
+ import "../../rolldown-runtime-ClRpJifh.js";
2
+ import { z } from "zod";
3
+ //#region src/protocol/messages/log-stream.ts
4
+ /**
5
+ * Which of a subprocess's two output streams a run-log line came from.
6
+ *
7
+ * Carried per log chunk rather than per line: chunks are delivered in order and
8
+ * the agent closes the pending chunk whenever the kind flips, so stdout/stderr
9
+ * interleaving is preserved without a per-line field.
10
+ *
11
+ * Lives in its own module because three protocol planes reference it — the
12
+ * agent→orchestrator chunk, the orchestrator→Platform relay, and the
13
+ * Platform→browser fan-out — and a shared leaf keeps those files acyclic.
14
+ */
15
+ const LogStream = z.enum(["stdout", "stderr"]);
16
+ //#endregion
17
+ export { LogStream };
18
+
19
+ //# sourceMappingURL=log-stream.js.map
@@ -1,4 +1,11 @@
1
1
  import { z } from 'zod';
2
+ /**
3
+ * @deprecated The `oidc.mint.*` RPC pair (Platform-rooted identity mint) is
4
+ * hard-deprecated in favor of orchestrator-owned signing. It is kept
5
+ * wire-compatible for the mixed-version rollout window and removed at v1.0; a
6
+ * fresh orchestrator with its own signer never sends it. See
7
+ * docs/user/deprecations.md.
8
+ */
2
9
  /**
3
10
  * Error discriminator for a failed provenance mint, carried on
4
11
  * `oidc.mint.response.error.code`. Mirrors the three orchestrator-side error
@@ -3,6 +3,13 @@ import { AttestationOrigin } from "../../provenance/attestation-origin.js";
3
3
  import { z } from "zod";
4
4
  //#region src/protocol/messages/oidc-mint.ts
5
5
  /**
6
+ * @deprecated The `oidc.mint.*` RPC pair (Platform-rooted identity mint) is
7
+ * hard-deprecated in favor of orchestrator-owned signing. It is kept
8
+ * wire-compatible for the mixed-version rollout window and removed at v1.0; a
9
+ * fresh orchestrator with its own signer never sends it. See
10
+ * docs/user/deprecations.md.
11
+ */
12
+ /**
6
13
  * Error discriminator for a failed provenance mint, carried on
7
14
  * `oidc.mint.response.error.code`. Mirrors the three orchestrator-side error
8
15
  * classes that consume it: