@farmslot/protocol 0.21.0 → 0.26.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 (199) hide show
  1. package/CHANGELOG.md +115 -0
  2. package/dist/contracts/agents.d.ts +33 -0
  3. package/dist/contracts/agents.d.ts.map +1 -1
  4. package/dist/contracts/backlog.d.ts +8 -0
  5. package/dist/contracts/backlog.d.ts.map +1 -1
  6. package/dist/contracts/backlog.js.map +1 -1
  7. package/dist/contracts/device-inventory.d.ts +118 -0
  8. package/dist/contracts/device-inventory.d.ts.map +1 -0
  9. package/dist/contracts/device-inventory.js +51 -0
  10. package/dist/contracts/device-inventory.js.map +1 -0
  11. package/dist/contracts/dispatch.d.ts +4 -0
  12. package/dist/contracts/dispatch.d.ts.map +1 -1
  13. package/dist/contracts/execution-templates.d.ts +16 -0
  14. package/dist/contracts/execution-templates.d.ts.map +1 -1
  15. package/dist/contracts/execution-templates.js +6 -0
  16. package/dist/contracts/execution-templates.js.map +1 -1
  17. package/dist/contracts/gate-park.d.ts +284 -0
  18. package/dist/contracts/gate-park.d.ts.map +1 -0
  19. package/dist/contracts/gate-park.js +415 -0
  20. package/dist/contracts/gate-park.js.map +1 -0
  21. package/dist/contracts/index.d.ts +8 -0
  22. package/dist/contracts/index.d.ts.map +1 -1
  23. package/dist/contracts/index.js +8 -0
  24. package/dist/contracts/index.js.map +1 -1
  25. package/dist/contracts/pr-monitoring.d.ts +167 -0
  26. package/dist/contracts/pr-monitoring.d.ts.map +1 -0
  27. package/dist/contracts/pr-monitoring.js +2 -0
  28. package/dist/contracts/pr-monitoring.js.map +1 -0
  29. package/dist/contracts/pr-rules.d.ts +350 -0
  30. package/dist/contracts/pr-rules.d.ts.map +1 -0
  31. package/dist/contracts/pr-rules.js +6 -0
  32. package/dist/contracts/pr-rules.js.map +1 -0
  33. package/dist/contracts/pressure-admission.d.ts +175 -0
  34. package/dist/contracts/pressure-admission.d.ts.map +1 -0
  35. package/dist/contracts/pressure-admission.js +26 -0
  36. package/dist/contracts/pressure-admission.js.map +1 -0
  37. package/dist/contracts/readiness.d.ts +37 -0
  38. package/dist/contracts/readiness.d.ts.map +1 -0
  39. package/dist/contracts/readiness.js +8 -0
  40. package/dist/contracts/readiness.js.map +1 -0
  41. package/dist/contracts/resource-posture.d.ts +379 -0
  42. package/dist/contracts/resource-posture.d.ts.map +1 -0
  43. package/dist/contracts/resource-posture.js +293 -0
  44. package/dist/contracts/resource-posture.js.map +1 -0
  45. package/dist/contracts/resources.d.ts +27 -1
  46. package/dist/contracts/resources.d.ts.map +1 -1
  47. package/dist/contracts/resources.js +1 -1
  48. package/dist/contracts/resources.js.map +1 -1
  49. package/dist/contracts/reviews.d.ts +3 -0
  50. package/dist/contracts/reviews.d.ts.map +1 -1
  51. package/dist/contracts/reviews.js.map +1 -1
  52. package/dist/contracts/runs.d.ts +501 -12
  53. package/dist/contracts/runs.d.ts.map +1 -1
  54. package/dist/contracts/runs.js +148 -5
  55. package/dist/contracts/runs.js.map +1 -1
  56. package/dist/contracts/runtime-capabilities.d.ts +255 -3
  57. package/dist/contracts/runtime-capabilities.d.ts.map +1 -1
  58. package/dist/contracts/runtime-capabilities.js +113 -1
  59. package/dist/contracts/runtime-capabilities.js.map +1 -1
  60. package/dist/contracts/slots.d.ts +53 -1
  61. package/dist/contracts/slots.d.ts.map +1 -1
  62. package/dist/contracts/template-placeholders.d.ts +16 -0
  63. package/dist/contracts/template-placeholders.d.ts.map +1 -0
  64. package/dist/contracts/template-placeholders.js +39 -0
  65. package/dist/contracts/template-placeholders.js.map +1 -0
  66. package/dist/index.d.ts +6 -0
  67. package/dist/index.d.ts.map +1 -1
  68. package/dist/index.js +6 -0
  69. package/dist/index.js.map +1 -1
  70. package/dist/integrations/pr-monitoring.d.ts +13 -0
  71. package/dist/integrations/pr-monitoring.d.ts.map +1 -0
  72. package/dist/integrations/pr-monitoring.js +160 -0
  73. package/dist/integrations/pr-monitoring.js.map +1 -0
  74. package/dist/integrations/pr-project-import.d.ts +12 -0
  75. package/dist/integrations/pr-project-import.d.ts.map +1 -0
  76. package/dist/integrations/pr-project-import.js +279 -0
  77. package/dist/integrations/pr-project-import.js.map +1 -0
  78. package/dist/integrations/pr-review-requirements.d.ts +4 -0
  79. package/dist/integrations/pr-review-requirements.d.ts.map +1 -0
  80. package/dist/integrations/pr-review-requirements.js +21 -0
  81. package/dist/integrations/pr-review-requirements.js.map +1 -0
  82. package/dist/integrations/pr-rule-config.d.ts +6 -0
  83. package/dist/integrations/pr-rule-config.d.ts.map +1 -0
  84. package/dist/integrations/pr-rule-config.js +217 -0
  85. package/dist/integrations/pr-rule-config.js.map +1 -0
  86. package/dist/integrations/pr-rule-predicates.d.ts +9 -0
  87. package/dist/integrations/pr-rule-predicates.d.ts.map +1 -0
  88. package/dist/integrations/pr-rule-predicates.js +223 -0
  89. package/dist/integrations/pr-rule-predicates.js.map +1 -0
  90. package/dist/recipes/step-io.d.ts +10 -1
  91. package/dist/recipes/step-io.d.ts.map +1 -1
  92. package/dist/rpc/backlog.d.ts +2 -2
  93. package/dist/rpc/backlog.d.ts.map +1 -1
  94. package/dist/rpc/backlog.js +2 -1
  95. package/dist/rpc/backlog.js.map +1 -1
  96. package/dist/rpc/config.d.ts +22 -2
  97. package/dist/rpc/config.d.ts.map +1 -1
  98. package/dist/rpc/config.js +1 -0
  99. package/dist/rpc/config.js.map +1 -1
  100. package/dist/rpc/copilot-runtime.d.ts +17 -0
  101. package/dist/rpc/copilot-runtime.d.ts.map +1 -1
  102. package/dist/rpc/copilot-runtime.js +5 -0
  103. package/dist/rpc/copilot-runtime.js.map +1 -1
  104. package/dist/rpc/dispatch.d.ts +39 -1
  105. package/dist/rpc/dispatch.d.ts.map +1 -1
  106. package/dist/rpc/dispatch.js +2 -0
  107. package/dist/rpc/dispatch.js.map +1 -1
  108. package/dist/rpc/git.d.ts +35 -0
  109. package/dist/rpc/git.d.ts.map +1 -1
  110. package/dist/rpc/index.d.ts +7 -0
  111. package/dist/rpc/index.d.ts.map +1 -1
  112. package/dist/rpc/index.js +7 -0
  113. package/dist/rpc/index.js.map +1 -1
  114. package/dist/rpc/machine-pause.d.ts +158 -0
  115. package/dist/rpc/machine-pause.d.ts.map +1 -0
  116. package/dist/rpc/machine-pause.js +8 -0
  117. package/dist/rpc/machine-pause.js.map +1 -0
  118. package/dist/rpc/native-session.d.ts +193 -0
  119. package/dist/rpc/native-session.d.ts.map +1 -0
  120. package/dist/rpc/native-session.js +2 -0
  121. package/dist/rpc/native-session.js.map +1 -0
  122. package/dist/rpc/pr-push.d.ts +56 -0
  123. package/dist/rpc/pr-push.d.ts.map +1 -0
  124. package/dist/rpc/pr-push.js +2 -0
  125. package/dist/rpc/pr-push.js.map +1 -0
  126. package/dist/rpc/pr-rules.d.ts +72 -0
  127. package/dist/rpc/pr-rules.d.ts.map +1 -0
  128. package/dist/rpc/pr-rules.js +2 -0
  129. package/dist/rpc/pr-rules.js.map +1 -0
  130. package/dist/rpc/pr-watch.d.ts +43 -0
  131. package/dist/rpc/pr-watch.d.ts.map +1 -0
  132. package/dist/rpc/pr-watch.js +2 -0
  133. package/dist/rpc/pr-watch.js.map +1 -0
  134. package/dist/rpc/registry.d.ts +56 -0
  135. package/dist/rpc/registry.d.ts.map +1 -1
  136. package/dist/rpc/registry.js +57 -0
  137. package/dist/rpc/registry.js.map +1 -1
  138. package/dist/rpc/resource-posture.d.ts +36 -0
  139. package/dist/rpc/resource-posture.d.ts.map +1 -0
  140. package/dist/rpc/resource-posture.js +7 -0
  141. package/dist/rpc/resource-posture.js.map +1 -0
  142. package/dist/rpc/resource-pressure-selection.d.ts +4 -0
  143. package/dist/rpc/resource-pressure-selection.d.ts.map +1 -0
  144. package/dist/rpc/resource-pressure-selection.js +21 -0
  145. package/dist/rpc/resource-pressure-selection.js.map +1 -0
  146. package/dist/rpc/resources.d.ts +176 -1
  147. package/dist/rpc/resources.d.ts.map +1 -1
  148. package/dist/rpc/resources.js +6 -0
  149. package/dist/rpc/resources.js.map +1 -1
  150. package/dist/rpc/roadmap.d.ts +1 -1
  151. package/dist/rpc/roadmap.d.ts.map +1 -1
  152. package/dist/rpc/roadmap.js +2 -1
  153. package/dist/rpc/roadmap.js.map +1 -1
  154. package/dist/rpc/run.d.ts +122 -5
  155. package/dist/rpc/run.d.ts.map +1 -1
  156. package/dist/rpc/run.js +1 -0
  157. package/dist/rpc/run.js.map +1 -1
  158. package/dist/rpc/runtime-capabilities.d.ts +73 -3
  159. package/dist/rpc/runtime-capabilities.d.ts.map +1 -1
  160. package/dist/rpc/runtime-capabilities.js +11 -0
  161. package/dist/rpc/runtime-capabilities.js.map +1 -1
  162. package/dist/rpc/slot.d.ts +9 -1
  163. package/dist/rpc/slot.d.ts.map +1 -1
  164. package/dist/rpc/slot.js.map +1 -1
  165. package/dist/rpc/tmux.d.ts +4 -0
  166. package/dist/rpc/tmux.d.ts.map +1 -1
  167. package/dist/rpc/worker-session-history.d.ts +1 -1
  168. package/dist/rpc/worker-session-history.d.ts.map +1 -1
  169. package/dist/runs/decision-resolution.d.ts +7 -0
  170. package/dist/runs/decision-resolution.d.ts.map +1 -1
  171. package/dist/runs/decision-resolution.js +1 -0
  172. package/dist/runs/decision-resolution.js.map +1 -1
  173. package/dist/runs/interactive-handoff.d.ts +14 -0
  174. package/dist/runs/interactive-handoff.d.ts.map +1 -0
  175. package/dist/runs/interactive-handoff.js +69 -0
  176. package/dist/runs/interactive-handoff.js.map +1 -0
  177. package/dist/runs/portable-bundle.d.ts +2 -0
  178. package/dist/runs/portable-bundle.d.ts.map +1 -1
  179. package/dist/runs/portable-bundle.js +14 -1
  180. package/dist/runs/portable-bundle.js.map +1 -1
  181. package/dist/runs/review-chain.d.ts +3 -2
  182. package/dist/runs/review-chain.d.ts.map +1 -1
  183. package/dist/runs/review-chain.js +4 -2
  184. package/dist/runs/review-chain.js.map +1 -1
  185. package/dist/slots/tracking-branch.d.ts +12 -0
  186. package/dist/slots/tracking-branch.d.ts.map +1 -1
  187. package/dist/slots/tracking-branch.js +12 -0
  188. package/dist/slots/tracking-branch.js.map +1 -1
  189. package/dist/transport/events.d.ts +19 -2
  190. package/dist/transport/events.d.ts.map +1 -1
  191. package/dist/transport/events.js +6 -0
  192. package/dist/transport/events.js.map +1 -1
  193. package/dist/transport/signal.d.ts +11 -0
  194. package/dist/transport/signal.d.ts.map +1 -1
  195. package/dist/transport/signal.js +19 -1
  196. package/dist/transport/signal.js.map +1 -1
  197. package/dist/version.d.ts +1 -1
  198. package/dist/version.js +1 -1
  199. package/package.json +6 -1
@@ -1,14 +1,48 @@
1
+ import type { ProjectResourcePostureConfig, ResourcePostureRetention, ResourcePostureRetentionBoundary } from './resource-posture.js';
1
2
  /** Runtime resources acquired after core prepare from a declared proof plan. */
2
3
  export type RuntimeCapabilityCostClass = 'low' | 'medium' | 'high';
3
4
  export type RuntimeCapabilitySharePolicy = 'exclusive' | 'shared';
4
5
  export type RuntimeCapabilityLeaseState = 'queued' | 'acquiring' | 'acquired' | 'releasing' | 'released' | 'error';
5
6
  export type RuntimeCapabilityHealthState = 'unknown' | 'healthy' | 'unhealthy';
6
- export type RuntimeCapabilityProofMode = 'state' | 'visual' | 'mixed';
7
+ /** Proof modes a requirement may ask for. Exported as a value so clients can
8
+ * build option lists and validators from the protocol instead of retyping it. */
9
+ export declare const RUNTIME_CAPABILITY_PROOF_MODES: readonly ["state", "visual", "mixed"];
10
+ export type RuntimeCapabilityProofMode = (typeof RUNTIME_CAPABILITY_PROOF_MODES)[number];
11
+ export declare function isRuntimeCapabilityProofMode(value: unknown): value is RuntimeCapabilityProofMode;
12
+ /**
13
+ * How far a resource claim's exclusivity reaches.
14
+ *
15
+ * `slot` is the historical behaviour and stays the default: the claim only
16
+ * arbitrates against other leases on the same slot. `machine` reaches every
17
+ * slot on the same host, and `fleet` reaches every slot the Gateway knows
18
+ * about, which is how one physical device shared by several slots is expressed.
19
+ */
20
+ export declare const RUNTIME_CAPABILITY_CLAIM_SCOPES: readonly ["slot", "machine", "fleet"];
21
+ export type RuntimeCapabilityClaimScope = (typeof RUNTIME_CAPABILITY_CLAIM_SCOPES)[number];
22
+ export declare function isRuntimeCapabilityClaimScope(value: unknown): value is RuntimeCapabilityClaimScope;
7
23
  export interface RuntimeCapabilityResourceClaim {
8
24
  id: string;
9
25
  access: RuntimeCapabilitySharePolicy;
10
26
  kind?: 'port' | 'device' | 'process' | 'service' | 'other';
27
+ /**
28
+ * Absent means `slot`. Normalization fills it in, so a catalog entry always
29
+ * carries an explicit scope; the field stays optional because leases and
30
+ * fixtures written before scopes existed have none, and those are slot-scoped
31
+ * by definition.
32
+ */
33
+ scope?: RuntimeCapabilityClaimScope;
11
34
  }
35
+ /** A claim's effective scope. The one place the `slot` default is applied. */
36
+ export declare function runtimeCapabilityClaimScope(claim: Pick<RuntimeCapabilityResourceClaim, 'scope'>): RuntimeCapabilityClaimScope;
37
+ /**
38
+ * The widest of two scopes.
39
+ *
40
+ * Arbitration is symmetric: if either side declares a claim `fleet`, the two
41
+ * are contending for one physical thing whatever the other side declared. Two
42
+ * projects can describe the same claim id differently, so the wider declaration
43
+ * wins rather than whichever acquire happened to come second.
44
+ */
45
+ export declare function widerRuntimeCapabilityClaimScope(left: RuntimeCapabilityClaimScope, right: RuntimeCapabilityClaimScope): RuntimeCapabilityClaimScope;
12
46
  export interface RuntimeCapabilityCost {
13
47
  class: RuntimeCapabilityCostClass;
14
48
  resources: RuntimeCapabilityResourceClaim[];
@@ -26,6 +60,30 @@ export interface RuntimeCapabilityProviderActions {
26
60
  health: RuntimeCapabilityProviderActionRef;
27
61
  release: RuntimeCapabilityProviderActionRef;
28
62
  }
63
+ /**
64
+ * Who owns the lifecycle of a slot resource a provider touches.
65
+ * - `capability`: the lease is the resource's owner, so a running resource with
66
+ * no lease is an unowned leak and machine parking refuses to stop it.
67
+ * - `slot-lifecycle`: prepare (or the operator) owns the resource and the
68
+ * capability only rides on it, so no lease is required for it to be running.
69
+ */
70
+ export declare const RUNTIME_CAPABILITY_AFFECTED_OWNERSHIPS: readonly ["capability", "slot-lifecycle"];
71
+ export type RuntimeCapabilityAffectedOwnership = (typeof RUNTIME_CAPABILITY_AFFECTED_OWNERSHIPS)[number];
72
+ /**
73
+ * What releasing the provider factually does to the resource. This is a claim
74
+ * about mechanics, not a policy knob: `retain` means the provider's release
75
+ * action leaves the resource running, so parking must not stop it either and
76
+ * restore must find it still running rather than boot it.
77
+ */
78
+ export declare const RUNTIME_CAPABILITY_AFFECTED_RELEASE_EFFECTS: readonly ["stop", "retain"];
79
+ export type RuntimeCapabilityAffectedReleaseEffect = (typeof RUNTIME_CAPABILITY_AFFECTED_RELEASE_EFFECTS)[number];
80
+ /** One slot resource a provider touches, declared by the project catalog. */
81
+ export interface RuntimeCapabilityAffectedResource {
82
+ /** Names a key of the project's `resources` map. */
83
+ resourceId: string;
84
+ ownership: RuntimeCapabilityAffectedOwnership;
85
+ releaseEffect: RuntimeCapabilityAffectedReleaseEffect;
86
+ }
29
87
  export interface RuntimeCapabilityProviderConfig {
30
88
  label: string;
31
89
  description?: string;
@@ -36,12 +94,53 @@ export interface RuntimeCapabilityProviderConfig {
36
94
  /** JSON Schema object for acquire parameters. */
37
95
  parameters?: Record<string, unknown>;
38
96
  actions: RuntimeCapabilityProviderActions;
97
+ /**
98
+ * Slot resources this provider touches. Absent means "derive from the
99
+ * resource-kind action refs" (every referenced resource, owned by the
100
+ * capability, stopped on release) — the behaviour every catalog had before
101
+ * this field existed. An empty array is a deliberate declaration that the
102
+ * provider touches no watched slot resource, which is distinct from absent.
103
+ */
104
+ affectedResources?: RuntimeCapabilityAffectedResource[];
39
105
  releaseEffects: string[];
40
106
  /** Explicit project policy; zero/absent means release immediately. */
41
107
  keepWarmMs?: number;
108
+ /**
109
+ * Per-posture retention (ADR-054). Overrides the project posture defaults for
110
+ * this provider. `retain` is not accepted at `terminal`.
111
+ */
112
+ retention?: Partial<Record<ResourcePostureRetentionBoundary, ResourcePostureRetention>>;
42
113
  }
43
114
  export interface ProjectRuntimeCapabilitiesConfig {
44
115
  providers: Record<string, RuntimeCapabilityProviderConfig>;
116
+ /** Project-wide posture defaults (ADR-054); provider `retention` wins over these. */
117
+ posture?: ProjectResourcePostureConfig;
118
+ /** Opt-in host-pressure admission for this project's capability acquires. */
119
+ hostPressureAdmission?: ProjectHostPressureAdmissionConfig;
120
+ }
121
+ /**
122
+ * How this project's medium/high-cost capability acquires react to critical
123
+ * host pressure.
124
+ *
125
+ * `off` (the DEFAULT when the block is absent) never refuses: pressure is still
126
+ * evaluated and carried on the granted lease as an advisory. `refuse` blocks the
127
+ * acquire. `queue` blocks it and parks the caller in the pressure queue whether
128
+ * or not the caller passed `queueOnPressure`.
129
+ */
130
+ export type HostPressureAdmissionMode = 'off' | 'refuse' | 'queue';
131
+ export declare const HOST_PRESSURE_ADMISSION_MODES: readonly HostPressureAdmissionMode[];
132
+ /**
133
+ * Project overrides for the critical thresholds that decide the pressure
134
+ * severity an enforcing mode acts on. Every field is optional and falls back to
135
+ * the gateway defaults (1.5x cores, 90% CPU, 90% memory, 95% disk); the warn
136
+ * band and thermal pressure are not project-tunable.
137
+ */
138
+ export interface ProjectHostPressureAdmissionConfig {
139
+ mode: HostPressureAdmissionMode;
140
+ load1CriticalMultiplier?: number;
141
+ cpuCriticalPercent?: number;
142
+ memoryCriticalPercent?: number;
143
+ diskCriticalPercent?: number;
45
144
  }
46
145
  export interface RuntimeCapabilityProviderProvenance {
47
146
  project: string;
@@ -99,7 +198,70 @@ export interface RuntimeCapabilityLease {
99
198
  keepWarmUntil?: string;
100
199
  cleanupFailure?: string;
101
200
  /** Admission pressure retained while this lease is queued. */
102
- pressure?: RuntimeCapabilityPressureConflict;
201
+ pressure?: RuntimeCapabilityLeasePressure;
202
+ /**
203
+ * The machine the slot ran on when the lease was taken.
204
+ *
205
+ * Persisted rather than resolved on read: judging a foreign lease's claim
206
+ * needs its machine, and reading another slot's config to get it would make
207
+ * arbitration depend on a file that can be mid-write. A lease without it
208
+ * (written before scopes existed, or by a Gateway with no fleet) can only
209
+ * arbitrate at `slot` and `fleet` scope.
210
+ */
211
+ machine?: string;
212
+ /**
213
+ * The resource claims this lease holds, resolved from the catalog entry at
214
+ * acquire time.
215
+ *
216
+ * Persisted for the same reason as `machine`: a conflict check across slots
217
+ * would otherwise need every foreign slot's catalog, possibly from another
218
+ * project. A lease with no `claims` predates scoped arbitration and is
219
+ * treated as slot-scoped, which is exactly how it behaved when it was taken.
220
+ */
221
+ claims?: RuntimeCapabilityLeaseClaim[];
222
+ /** Why this lease is queued behind a scoped claim, while it is queued. */
223
+ wait?: RuntimeCapabilityScopedClaimWait;
224
+ }
225
+ /** One resource claim a lease holds, with the scope it was resolved at. */
226
+ export interface RuntimeCapabilityLeaseClaim {
227
+ id: string;
228
+ access: RuntimeCapabilitySharePolicy;
229
+ scope: RuntimeCapabilityClaimScope;
230
+ }
231
+ /**
232
+ * A queued lease's place in a scoped claim's wait queue.
233
+ *
234
+ * `blockingOwner` is carried rather than looked up because
235
+ * `runtime.capability.status` is slot-filtered: the run holding the claim is
236
+ * usually on another slot, so without this a client could only report that
237
+ * something, somewhere, holds it.
238
+ */
239
+ export interface RuntimeCapabilityScopedClaimWait {
240
+ kind: 'scoped-claim';
241
+ claimId: string;
242
+ scope: RuntimeCapabilityClaimScope;
243
+ blockingOwner: RuntimeCapabilityLeaseOwner;
244
+ blockingLeaseId: string;
245
+ enqueuedAt: string;
246
+ }
247
+ /**
248
+ * One waiter in a scoped claim's queue, derived on read.
249
+ *
250
+ * Position is never stored. Order comes from `enqueuedAt` then lease id, so a
251
+ * Gateway restart preserves it for free and nothing has to renumber a queue.
252
+ */
253
+ export interface RuntimeCapabilityClaimWaiter {
254
+ claimId: string;
255
+ scope: RuntimeCapabilityClaimScope;
256
+ /** 1-based place in the queue for this claim, across every slot in scope. */
257
+ position: number;
258
+ leaseId: string;
259
+ slotId: string;
260
+ capabilityId: string;
261
+ owner: RuntimeCapabilityLeaseOwner;
262
+ enqueuedAt: string;
263
+ blockingOwner: RuntimeCapabilityLeaseOwner;
264
+ blockingLeaseId: string;
103
265
  }
104
266
  export interface RuntimeCapabilityLeaseConflict {
105
267
  kind: 'lease-conflict';
@@ -108,6 +270,16 @@ export interface RuntimeCapabilityLeaseConflict {
108
270
  leaseId: string;
109
271
  reason: string;
110
272
  }
273
+ /**
274
+ * The acquire was REFUSED because the host is under critical pressure and the
275
+ * project opted in to enforcement.
276
+ *
277
+ * This type only ever describes a refusal. Pressure that was observed but NOT
278
+ * enforced is a `RuntimeCapabilityPressureAdvisory`, which is deliberately a
279
+ * different `kind` and is not a member of `RuntimeCapabilityAcquireConflict`:
280
+ * a client matching `kind === 'host-pressure'` must never be able to paint an
281
+ * admitted acquire as a block, and an absent boolean was too easy to miss.
282
+ */
111
283
  export interface RuntimeCapabilityPressureConflict {
112
284
  kind: 'host-pressure';
113
285
  reason: string;
@@ -116,7 +288,53 @@ export interface RuntimeCapabilityPressureConflict {
116
288
  queued: boolean;
117
289
  retryAfterMs?: number;
118
290
  }
119
- export type RuntimeCapabilityAcquireConflict = RuntimeCapabilityLeaseConflict | RuntimeCapabilityPressureConflict | {
291
+ /**
292
+ * Pressure that was observed and NOT enforced: the project (or the gateway env
293
+ * override) has `host_pressure_admission.mode: 'off'`, which is the default.
294
+ * The acquire PROCEEDED. This rides along on the granted lease so operators can
295
+ * still see the machine was loaded, and it is never a refusal.
296
+ *
297
+ * It is a reading taken AT ACQUIRE TIME and never refreshed — hence the
298
+ * required `observedAt`. A live view of the machine is
299
+ * `resource.pressure.snapshot`.
300
+ */
301
+ export interface RuntimeCapabilityPressureAdvisory {
302
+ kind: 'host-pressure-advisory';
303
+ reason: string;
304
+ severity: 'warn' | 'critical';
305
+ machine?: string;
306
+ observedAt: string;
307
+ }
308
+ /**
309
+ * What a lease's `pressure` field may hold: why a QUEUED lease is waiting
310
+ * (a conflict), or the unenforced reading an ACQUIRED lease was taken under
311
+ * (an advisory). The `kind` tells them apart; nothing else has to.
312
+ */
313
+ export type RuntimeCapabilityLeasePressure = RuntimeCapabilityPressureConflict | RuntimeCapabilityPressureAdvisory;
314
+ /**
315
+ * The acquire was refused AND enqueued: a scoped claim is held elsewhere and
316
+ * the caller asked to queue on that conflict.
317
+ *
318
+ * Distinct from `lease-conflict`, which is a flat refusal with nothing to wait
319
+ * for. A client that sees this has a durable place in line — `queuedLeaseId` —
320
+ * and the run is in a resource wait until the holder releases.
321
+ */
322
+ export interface RuntimeCapabilityScopedWaitConflict {
323
+ kind: 'scoped-wait';
324
+ capabilityId: string;
325
+ claimId: string;
326
+ scope: RuntimeCapabilityClaimScope;
327
+ /** The run holding the claim, which may be on another slot. */
328
+ owner: RuntimeCapabilityLeaseOwner;
329
+ /** The holder's lease. */
330
+ leaseId: string;
331
+ /** The queued lease this acquire now owns. */
332
+ queuedLeaseId: string;
333
+ /** 1-based place in line at the moment of the refusal. */
334
+ position: number;
335
+ reason: string;
336
+ }
337
+ export type RuntimeCapabilityAcquireConflict = RuntimeCapabilityLeaseConflict | RuntimeCapabilityPressureConflict | RuntimeCapabilityScopedWaitConflict | {
120
338
  kind: 'unavailable' | 'invalid-request';
121
339
  capabilityId: string;
122
340
  reason: string;
@@ -131,4 +349,38 @@ export interface RuntimeCapabilityLifecycleEvent {
131
349
  owner?: RuntimeCapabilityLeaseOwner;
132
350
  detail?: string;
133
351
  }
352
+ /**
353
+ * Device-identity parameters a capability provider may accept so a validation
354
+ * or recipe rerun can name a target device instead of re-dispatching the run to
355
+ * another slot (ADR-054 item 3).
356
+ *
357
+ * These are the ONLY acquire parameters the Gateway turns into hook template
358
+ * variables. Everything else in a provider's parameter schema stays data the
359
+ * provider's own actions read; it never reaches a shell template.
360
+ */
361
+ export declare const RUNTIME_CAPABILITY_TARGET_KEYS: readonly ["platform", "udid", "simulator", "avd", "adb_serial"];
362
+ export type RuntimeCapabilityTargetKey = (typeof RUNTIME_CAPABILITY_TARGET_KEYS)[number];
363
+ export type RuntimeCapabilityTarget = Partial<Record<RuntimeCapabilityTargetKey, string>>;
364
+ /**
365
+ * The charset a device identity may use. Deliberately narrow: these values are
366
+ * substituted into project hook command templates, so anything that could carry
367
+ * shell meaning is refused before it reaches a template rather than escaped
368
+ * afterwards.
369
+ *
370
+ * A LEADING dash is refused too. `-x` is shell-safe but it is still an argument
371
+ * to whatever the hook runs — `simctl boot -x`, `adb -s -x` — so an identity
372
+ * must start with an identity character.
373
+ */
374
+ export declare const RUNTIME_CAPABILITY_TARGET_VALUE_PATTERN: RegExp;
375
+ export declare function isRuntimeCapabilityTargetKey(value: unknown): value is RuntimeCapabilityTargetKey;
376
+ export declare function isRuntimeCapabilityTargetValue(value: unknown): value is string;
377
+ /**
378
+ * The device-identity subset of a lease's stored acquire parameters, for
379
+ * clients that show which device a lease actually resolved to. Values that are
380
+ * not well-formed identities are dropped rather than rendered: a lease can only
381
+ * have been acquired with valid ones, so anything else is not a target.
382
+ */
383
+ export declare function runtimeCapabilityTargetFromParameters(parameters: Record<string, unknown> | undefined): RuntimeCapabilityTarget | undefined;
384
+ /** `simulator=A, udid=B` in the order the keys are declared. For labels only. */
385
+ export declare function formatRuntimeCapabilityTarget(target: RuntimeCapabilityTarget): string;
134
386
  //# sourceMappingURL=runtime-capabilities.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"runtime-capabilities.d.ts","sourceRoot":"","sources":["../../src/contracts/runtime-capabilities.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,MAAM,MAAM,0BAA0B,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC;AACnE,MAAM,MAAM,4BAA4B,GAAG,WAAW,GAAG,QAAQ,CAAC;AAClE,MAAM,MAAM,2BAA2B,GACnC,QAAQ,GACR,WAAW,GACX,UAAU,GACV,WAAW,GACX,UAAU,GACV,OAAO,CAAC;AACZ,MAAM,MAAM,4BAA4B,GAAG,SAAS,GAAG,SAAS,GAAG,WAAW,CAAC;AAC/E,MAAM,MAAM,0BAA0B,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,CAA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AE,OAAO,CAAC,GAAG,SAAS,GAC9C,uBAAuB,GAAG,SAAS,CAQrC;AAED,iFAAiF;AACjF,wBAAgB,6BAA6B,CAAC,MAAM,EAAE,uBAAuB,GAAG,MAAM,CAIrF"}
@@ -1,2 +1,114 @@
1
- export {};
1
+ /** Proof modes a requirement may ask for. Exported as a value so clients can
2
+ * build option lists and validators from the protocol instead of retyping it. */
3
+ export const RUNTIME_CAPABILITY_PROOF_MODES = ['state', 'visual', 'mixed'];
4
+ export function isRuntimeCapabilityProofMode(value) {
5
+ return RUNTIME_CAPABILITY_PROOF_MODES.includes(value);
6
+ }
7
+ /**
8
+ * How far a resource claim's exclusivity reaches.
9
+ *
10
+ * `slot` is the historical behaviour and stays the default: the claim only
11
+ * arbitrates against other leases on the same slot. `machine` reaches every
12
+ * slot on the same host, and `fleet` reaches every slot the Gateway knows
13
+ * about, which is how one physical device shared by several slots is expressed.
14
+ */
15
+ export const RUNTIME_CAPABILITY_CLAIM_SCOPES = ['slot', 'machine', 'fleet'];
16
+ export function isRuntimeCapabilityClaimScope(value) {
17
+ return RUNTIME_CAPABILITY_CLAIM_SCOPES.includes(value);
18
+ }
19
+ /** A claim's effective scope. The one place the `slot` default is applied. */
20
+ export function runtimeCapabilityClaimScope(claim) {
21
+ return claim.scope ?? 'slot';
22
+ }
23
+ /**
24
+ * The widest of two scopes.
25
+ *
26
+ * Arbitration is symmetric: if either side declares a claim `fleet`, the two
27
+ * are contending for one physical thing whatever the other side declared. Two
28
+ * projects can describe the same claim id differently, so the wider declaration
29
+ * wins rather than whichever acquire happened to come second.
30
+ */
31
+ export function widerRuntimeCapabilityClaimScope(left, right) {
32
+ if (left === 'fleet' || right === 'fleet')
33
+ return 'fleet';
34
+ if (left === 'machine' || right === 'machine')
35
+ return 'machine';
36
+ return 'slot';
37
+ }
38
+ /**
39
+ * Who owns the lifecycle of a slot resource a provider touches.
40
+ * - `capability`: the lease is the resource's owner, so a running resource with
41
+ * no lease is an unowned leak and machine parking refuses to stop it.
42
+ * - `slot-lifecycle`: prepare (or the operator) owns the resource and the
43
+ * capability only rides on it, so no lease is required for it to be running.
44
+ */
45
+ export const RUNTIME_CAPABILITY_AFFECTED_OWNERSHIPS = ['capability', 'slot-lifecycle'];
46
+ /**
47
+ * What releasing the provider factually does to the resource. This is a claim
48
+ * about mechanics, not a policy knob: `retain` means the provider's release
49
+ * action leaves the resource running, so parking must not stop it either and
50
+ * restore must find it still running rather than boot it.
51
+ */
52
+ export const RUNTIME_CAPABILITY_AFFECTED_RELEASE_EFFECTS = ['stop', 'retain'];
53
+ export const HOST_PRESSURE_ADMISSION_MODES = [
54
+ 'off',
55
+ 'refuse',
56
+ 'queue',
57
+ ];
58
+ /**
59
+ * Device-identity parameters a capability provider may accept so a validation
60
+ * or recipe rerun can name a target device instead of re-dispatching the run to
61
+ * another slot (ADR-054 item 3).
62
+ *
63
+ * These are the ONLY acquire parameters the Gateway turns into hook template
64
+ * variables. Everything else in a provider's parameter schema stays data the
65
+ * provider's own actions read; it never reaches a shell template.
66
+ */
67
+ export const RUNTIME_CAPABILITY_TARGET_KEYS = [
68
+ 'platform',
69
+ 'udid',
70
+ 'simulator',
71
+ 'avd',
72
+ 'adb_serial',
73
+ ];
74
+ /**
75
+ * The charset a device identity may use. Deliberately narrow: these values are
76
+ * substituted into project hook command templates, so anything that could carry
77
+ * shell meaning is refused before it reaches a template rather than escaped
78
+ * afterwards.
79
+ *
80
+ * A LEADING dash is refused too. `-x` is shell-safe but it is still an argument
81
+ * to whatever the hook runs — `simctl boot -x`, `adb -s -x` — so an identity
82
+ * must start with an identity character.
83
+ */
84
+ export const RUNTIME_CAPABILITY_TARGET_VALUE_PATTERN = /^[A-Za-z0-9._:][A-Za-z0-9._:-]*$/;
85
+ export function isRuntimeCapabilityTargetKey(value) {
86
+ return RUNTIME_CAPABILITY_TARGET_KEYS.includes(value);
87
+ }
88
+ export function isRuntimeCapabilityTargetValue(value) {
89
+ return typeof value === 'string' && RUNTIME_CAPABILITY_TARGET_VALUE_PATTERN.test(value);
90
+ }
91
+ /**
92
+ * The device-identity subset of a lease's stored acquire parameters, for
93
+ * clients that show which device a lease actually resolved to. Values that are
94
+ * not well-formed identities are dropped rather than rendered: a lease can only
95
+ * have been acquired with valid ones, so anything else is not a target.
96
+ */
97
+ export function runtimeCapabilityTargetFromParameters(parameters) {
98
+ if (!parameters)
99
+ return undefined;
100
+ const target = {};
101
+ for (const key of RUNTIME_CAPABILITY_TARGET_KEYS) {
102
+ const value = parameters[key];
103
+ if (isRuntimeCapabilityTargetValue(value))
104
+ target[key] = value;
105
+ }
106
+ return Object.keys(target).length > 0 ? target : undefined;
107
+ }
108
+ /** `simulator=A, udid=B` in the order the keys are declared. For labels only. */
109
+ export function formatRuntimeCapabilityTarget(target) {
110
+ return RUNTIME_CAPABILITY_TARGET_KEYS.filter((key) => target[key] !== undefined)
111
+ .map((key) => `${key}=${target[key]}`)
112
+ .join(', ');
113
+ }
2
114
  //# sourceMappingURL=runtime-capabilities.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"runtime-capabilities.js","sourceRoot":"","sources":["../../src/contracts/runtime-capabilities.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"runtime-capabilities.js","sourceRoot":"","sources":["../../src/contracts/runtime-capabilities.ts"],"names":[],"mappings":"AAiBA;iFACiF;AACjF,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAE,OAAO,CAAU,CAAC;AAGpF,MAAM,UAAU,4BAA4B,CAAC,KAAc;IACzD,OAAO,8BAA8B,CAAC,QAAQ,CAAC,KAAmC,CAAC,CAAC;AACtF,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,CAAU,CAAC;AAGrF,MAAM,UAAU,6BAA6B,CAC3C,KAAc;IAEd,OAAO,+BAA+B,CAAC,QAAQ,CAAC,KAAoC,CAAC,CAAC;AACxF,CAAC;A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4B,EAAE,CAAC;IAC3C,KAAK,MAAM,GAAG,IAAI,8BAA8B,EAAE,CAAC;QACjD,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC;QAC9B,IAAI,8BAA8B,CAAC,KAAK,CAAC;YAAE,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;IACjE,CAAC;IACD,OAAO,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;AAC7D,CAAC;AAED,iFAAiF;AACjF,MAAM,UAAU,6BAA6B,CAAC,MAA+B;IAC3E,OAAO,8BAA8B,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,SAAS,CAAC;SAC7E,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,GAAG,IAAI,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC;SACrC,IAAI,CAAC,IAAI,CAAC,CAAC;AAChB,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import type { RecipeRuntimeCapabilityDeclaration } from '../recipe/common.js';
2
2
  import type { AgentContextSummary, SlotAgent } from './agents.js';
3
- import type { ResourceRollup } from './resources.js';
3
+ import type { ResourceRollup, ResourceWatchRuntimeStats } from './resources.js';
4
4
  import type { RunLane } from './runs.js';
5
5
  export type SlotLifecycle = 'ready' | 'busy' | 'held' | 'manual' | 'disabled';
6
6
  /**
@@ -43,6 +43,13 @@ export interface SlotStatus {
43
43
  project: string;
44
44
  health: SlotHealth;
45
45
  branch: string;
46
+ /**
47
+ * The commit HEAD points at, as the last fleet refresh saw it. Recorded
48
+ * alongside `branch` because a detached checkout reports `branch` as the
49
+ * literal `HEAD`, which identifies nothing on its own — dispatch needs the
50
+ * commit to tell one detached slot from another.
51
+ */
52
+ headSha?: string;
46
53
  /** Pool tmux/session id — used to resolve slot_tracking_branch templates. */
47
54
  session?: string;
48
55
  /** Slot checkout path from pool config. */
@@ -120,6 +127,44 @@ export type { ActiveResourcePointer, SlotActionDefinition, SlotActionMode, SlotA
120
127
  export type { SlotRunHistoryEntry } from './runs.js';
121
128
  export type ThermalPressure = 'nominal' | 'fair' | 'serious' | 'critical';
122
129
  export type Headroom = 'green' | 'yellow' | 'red';
130
+ export interface NodePressureRatios {
131
+ cpu: number;
132
+ memory: number;
133
+ disk: number;
134
+ load1?: number;
135
+ load5?: number;
136
+ }
137
+ /** Ownership-safe process data: executable name/path only, never argv or environment. */
138
+ export interface NodeProcessSample {
139
+ pid: number;
140
+ ppid: number;
141
+ cpuPercent: number;
142
+ rssBytes: number;
143
+ elapsedSeconds: number;
144
+ executable: string;
145
+ }
146
+ export interface NodeProcessSamplerHealth {
147
+ attempts: number;
148
+ executions: number;
149
+ failures: number;
150
+ skippedBusy: number;
151
+ skippedCadence: number;
152
+ lastDurationMs: number | null;
153
+ lastError?: string;
154
+ }
155
+ export interface NodeProcessInventory {
156
+ generation: string;
157
+ sampleId: number;
158
+ collectedAt: string;
159
+ processes: NodeProcessSample[];
160
+ totalProcesses: number;
161
+ maxEntries: number;
162
+ truncated: boolean;
163
+ ancestryTruncated?: boolean;
164
+ /** Health-only failed attempt; does not represent a process census. */
165
+ failed?: boolean;
166
+ health: NodeProcessSamplerHealth;
167
+ }
123
168
  export interface NodeSystemMetrics {
124
169
  cpuPercent: number;
125
170
  memoryPercent: number;
@@ -128,9 +173,16 @@ export interface NodeSystemMetrics {
128
173
  diskPercent: number;
129
174
  loadAvg1: number;
130
175
  loadAvg5: number;
176
+ cpuCores?: number;
177
+ pressure?: NodePressureRatios;
131
178
  thermalPressure?: ThermalPressure;
179
+ resourceWatches?: ResourceWatchRuntimeStats;
132
180
  collectedAt: string;
133
181
  }
182
+ /** Private node→gateway sample; process census is never part of MachineHealth.system. */
183
+ export interface NodeMetricsSample extends NodeSystemMetrics {
184
+ processInventory?: NodeProcessInventory;
185
+ }
134
186
  export interface MachineHealth {
135
187
  machine: string;
136
188
  online: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"slots.d.ts","sourceRoot":"","sources":["../../src/contracts/slots.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kCAAkC,EAAE,MAAM,qBAAqB,CAAC;AAE9E,OAAO,KAAK,EAAE,mBAAmB,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAClE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,MAAM,MAAM,aAAa,GACrB,OAAO,GACP,MAAM,GACN,MAAM,GACN,QAAQ,GACR,UAAU,CAAC;AAEf;;;GAGG;AACH,eAAO,MAAM,cAAc;;;;;;CAMqB,CAAC;AAGjD,MAAM,MAAM,SAAS,GACjB,WAAW,GACX,aAAa,GACb,SAAS,GACT,WAAW,GACX,aAAa,GACb,UAAU,GACV,UAAU,GACV,IAAI,CAAC;AACT,MAAM,MAAM,YAAY,GAAG,UAAU,GAAG,QAAQ,GAAG,UAAU,CAAC;AAE9D;;;;GAIG;AACH,eAAO,MAAM,oBAAoB;;;;;CAKvB,CAAC;AACX,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,OAAO,oBAAoB,CAAC,CAAC;AAEjG,MAAM,MAAM,YAAY,GAAG,IAAI,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;AAE9D,MAAM,WAAW,UAAU;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB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AAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,kBAAkB,CAAC;IAC9B,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC,eAAe,CAAC,EAAE,yBAAyB,CAAC;IAC5C,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,yFAAyF;AACzF,MAAM,WAAW,iBAAkB,SAAQ,iBAAiB;IAC1D,gBAAgB,CAAC,EAAE,oBAAoB,CAAC;CACzC;AAED,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,OAAO,CAAC;IAChB,YAAY,CAAC,EAAE,kCAAkC,EAAE,CAAC;IACpD,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAC3B,QAAQ,CAAC,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC;IACvE,QAAQ,EAAE,QAAQ,CAAC;CACpB"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * `{{NAME}}` placeholder guard shared by every template renderer (task writer,
3
+ * agent-runtime task init, prompt templates). Pure string functions: no slot or
4
+ * project coupling, so a harness can render the same template a control plane
5
+ * renders and fail on the same unknown token.
6
+ */
7
+ /** Full {{...}} tokens present in the text, including malformed names. */
8
+ export declare function collectPlaceholderTokens(text: string): Set<string>;
9
+ export declare function assertNoUnknownPlaceholders(template: string, known: Iterable<string>, source: string): void;
10
+ /**
11
+ * Substitute `{{KEY}}` with `vars[KEY]` after the guard. Values are inserted
12
+ * verbatim and never re-expanded; a value that itself contains `{{...}}` is the
13
+ * caller's responsibility (the slot-config renderer rejects such values).
14
+ */
15
+ export declare function renderTemplatePlaceholders(template: string, vars: Record<string, string>, source?: string): string;
16
+ //# sourceMappingURL=template-placeholders.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"template-placeholders.d.ts","sourceRoot":"","sources":["../../src/contracts/template-placeholders.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAOH,0EAA0E;AAC1E,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,CAElE;AAED,wBAAgB,2BAA2B,CACzC,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,EACvB,MAAM,EAAE,MAAM,GACb,IAAI,CAYN;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B,CACxC,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC5B,MAAM,SAAa,GAClB,MAAM,CAOR"}
@@ -0,0 +1,39 @@
1
+ /**
2
+ * `{{NAME}}` placeholder guard shared by every template renderer (task writer,
3
+ * agent-runtime task init, prompt templates). Pure string functions: no slot or
4
+ * project coupling, so a harness can render the same template a control plane
5
+ * renders and fail on the same unknown token.
6
+ */
7
+ // Any double-brace token, valid identifier or not — a malformed name like
8
+ // {{foo-bar}} can never be substituted, so it must fail the guard rather
9
+ // than slip through an identifier-only scan.
10
+ const PLACEHOLDER_TOKEN_RE = /\{\{[^{}\n]+\}\}/g;
11
+ /** Full {{...}} tokens present in the text, including malformed names. */
12
+ export function collectPlaceholderTokens(text) {
13
+ return new Set(Array.from(text.matchAll(PLACEHOLDER_TOKEN_RE), (match) => match[0]));
14
+ }
15
+ export function assertNoUnknownPlaceholders(template, known, source) {
16
+ const knownSet = known instanceof Set ? known : new Set(known);
17
+ const unknown = [...collectPlaceholderTokens(template)].filter((token) => {
18
+ const name = token.slice(2, -2);
19
+ return !/^[A-Za-z_][A-Za-z0-9_]*$/.test(name) || !knownSet.has(name);
20
+ });
21
+ if (unknown.length > 0) {
22
+ throw new Error(`${source} references placeholder(s) with no expansion value: ${unknown.join(', ')} — ` +
23
+ `supply the variable or remove the placeholder from the template`);
24
+ }
25
+ }
26
+ /**
27
+ * Substitute `{{KEY}}` with `vars[KEY]` after the guard. Values are inserted
28
+ * verbatim and never re-expanded; a value that itself contains `{{...}}` is the
29
+ * caller's responsibility (the slot-config renderer rejects such values).
30
+ */
31
+ export function renderTemplatePlaceholders(template, vars, source = 'template') {
32
+ assertNoUnknownPlaceholders(template, Object.keys(vars), source);
33
+ let content = template;
34
+ for (const [key, value] of Object.entries(vars)) {
35
+ content = content.replaceAll(`{{${key}}}`, value);
36
+ }
37
+ return content;
38
+ }
39
+ //# sourceMappingURL=template-placeholders.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"template-placeholders.js","sourceRoot":"","sources":["../../src/contracts/template-placeholders.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,0EAA0E;AAC1E,yEAAyE;AACzE,6CAA6C;AAC7C,MAAM,oBAAoB,GAAG,mBAAmB,CAAC;AAEjD,0EAA0E;AAC1E,MAAM,UAAU,wBAAwB,CAAC,IAAY;IACnD,OAAO,IAAI,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,oBAAoB,CAAC,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACvF,CAAC;AAED,MAAM,UAAU,2BAA2B,CACzC,QAAgB,EAChB,KAAuB,EACvB,MAAc;IAEd,MAAM,QAAQ,GAAG,KAAK,YAAY,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC;IAC/D,MAAM,OAAO,GAAG,CAAC,GAAG,wBAAwB,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE;QACvE,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QAChC,OAAO,CAAC,0BAA0B,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACvE,CAAC,CAAC,CAAC;I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