@cat-factory/contracts 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (166) hide show
  1. package/LICENSE +21 -0
  2. package/dist/accounts.d.ts +103 -0
  3. package/dist/accounts.d.ts.map +1 -0
  4. package/dist/accounts.js +102 -0
  5. package/dist/accounts.js.map +1 -0
  6. package/dist/agent-config.d.ts +77 -0
  7. package/dist/agent-config.d.ts.map +1 -0
  8. package/dist/agent-config.js +78 -0
  9. package/dist/agent-config.js.map +1 -0
  10. package/dist/api-keys.d.ts +44 -0
  11. package/dist/api-keys.d.ts.map +1 -0
  12. package/dist/api-keys.js +49 -0
  13. package/dist/api-keys.js.map +1 -0
  14. package/dist/auth.d.ts +24 -0
  15. package/dist/auth.d.ts.map +1 -0
  16. package/dist/auth.js +15 -0
  17. package/dist/auth.js.map +1 -0
  18. package/dist/board-scan.d.ts +89 -0
  19. package/dist/board-scan.d.ts.map +1 -0
  20. package/dist/board-scan.js +122 -0
  21. package/dist/board-scan.js.map +1 -0
  22. package/dist/bootstrap.d.ts +168 -0
  23. package/dist/bootstrap.d.ts.map +1 -0
  24. package/dist/bootstrap.js +148 -0
  25. package/dist/bootstrap.js.map +1 -0
  26. package/dist/clarity.d.ts +75 -0
  27. package/dist/clarity.d.ts.map +1 -0
  28. package/dist/clarity.js +66 -0
  29. package/dist/clarity.js.map +1 -0
  30. package/dist/companion.d.ts +32 -0
  31. package/dist/companion.d.ts.map +1 -0
  32. package/dist/companion.js +43 -0
  33. package/dist/companion.js.map +1 -0
  34. package/dist/consensus.d.ts +195 -0
  35. package/dist/consensus.d.ts.map +1 -0
  36. package/dist/consensus.js +164 -0
  37. package/dist/consensus.js.map +1 -0
  38. package/dist/documents.d.ts +197 -0
  39. package/dist/documents.d.ts.map +1 -0
  40. package/dist/documents.js +161 -0
  41. package/dist/documents.js.map +1 -0
  42. package/dist/entities.d.ts +1691 -0
  43. package/dist/entities.d.ts.map +1 -0
  44. package/dist/entities.js +853 -0
  45. package/dist/entities.js.map +1 -0
  46. package/dist/environments.d.ts +426 -0
  47. package/dist/environments.d.ts.map +1 -0
  48. package/dist/environments.js +190 -0
  49. package/dist/environments.js.map +1 -0
  50. package/dist/events.d.ts +98 -0
  51. package/dist/events.d.ts.map +1 -0
  52. package/dist/events.js +2 -0
  53. package/dist/events.js.map +1 -0
  54. package/dist/fragment-library.d.ts +123 -0
  55. package/dist/fragment-library.d.ts.map +1 -0
  56. package/dist/fragment-library.js +88 -0
  57. package/dist/fragment-library.js.map +1 -0
  58. package/dist/github.d.ts +215 -0
  59. package/dist/github.d.ts.map +1 -0
  60. package/dist/github.js +204 -0
  61. package/dist/github.js.map +1 -0
  62. package/dist/index.d.ts +41 -0
  63. package/dist/index.d.ts.map +1 -0
  64. package/dist/index.js +41 -0
  65. package/dist/index.js.map +1 -0
  66. package/dist/iteration-cap.d.ts +17 -0
  67. package/dist/iteration-cap.d.ts.map +1 -0
  68. package/dist/iteration-cap.js +25 -0
  69. package/dist/iteration-cap.js.map +1 -0
  70. package/dist/localModels.d.ts +54 -0
  71. package/dist/localModels.d.ts.map +1 -0
  72. package/dist/localModels.js +79 -0
  73. package/dist/localModels.js.map +1 -0
  74. package/dist/merge.d.ts +106 -0
  75. package/dist/merge.d.ts.map +1 -0
  76. package/dist/merge.js +129 -0
  77. package/dist/merge.js.map +1 -0
  78. package/dist/model-defaults.d.ts +23 -0
  79. package/dist/model-defaults.d.ts.map +1 -0
  80. package/dist/model-defaults.js +34 -0
  81. package/dist/model-defaults.js.map +1 -0
  82. package/dist/notifications.d.ts +136 -0
  83. package/dist/notifications.d.ts.map +1 -0
  84. package/dist/notifications.js +125 -0
  85. package/dist/notifications.js.map +1 -0
  86. package/dist/observability.d.ts +271 -0
  87. package/dist/observability.d.ts.map +1 -0
  88. package/dist/observability.js +152 -0
  89. package/dist/observability.js.map +1 -0
  90. package/dist/personal-subscriptions.d.ts +66 -0
  91. package/dist/personal-subscriptions.d.ts.map +1 -0
  92. package/dist/personal-subscriptions.js +70 -0
  93. package/dist/personal-subscriptions.js.map +1 -0
  94. package/dist/primitives.d.ts +57 -0
  95. package/dist/primitives.d.ts.map +1 -0
  96. package/dist/primitives.js +66 -0
  97. package/dist/primitives.js.map +1 -0
  98. package/dist/provisioning.d.ts +46 -0
  99. package/dist/provisioning.d.ts.map +1 -0
  100. package/dist/provisioning.js +107 -0
  101. package/dist/provisioning.js.map +1 -0
  102. package/dist/recurring.d.ts +117 -0
  103. package/dist/recurring.d.ts.map +1 -0
  104. package/dist/recurring.js +99 -0
  105. package/dist/recurring.js.map +1 -0
  106. package/dist/release.d.ts +60 -0
  107. package/dist/release.d.ts.map +1 -0
  108. package/dist/release.js +75 -0
  109. package/dist/release.js.map +1 -0
  110. package/dist/requests.d.ts +451 -0
  111. package/dist/requests.d.ts.map +1 -0
  112. package/dist/requests.js +231 -0
  113. package/dist/requests.js.map +1 -0
  114. package/dist/requirements.d.ts +127 -0
  115. package/dist/requirements.d.ts.map +1 -0
  116. package/dist/requirements.js +137 -0
  117. package/dist/requirements.js.map +1 -0
  118. package/dist/runners.d.ts +387 -0
  119. package/dist/runners.d.ts.map +1 -0
  120. package/dist/runners.js +117 -0
  121. package/dist/runners.js.map +1 -0
  122. package/dist/sandbox.d.ts +300 -0
  123. package/dist/sandbox.d.ts.map +1 -0
  124. package/dist/sandbox.js +243 -0
  125. package/dist/sandbox.js.map +1 -0
  126. package/dist/service-fragment-defaults.d.ts +16 -0
  127. package/dist/service-fragment-defaults.d.ts.map +1 -0
  128. package/dist/service-fragment-defaults.js +23 -0
  129. package/dist/service-fragment-defaults.js.map +1 -0
  130. package/dist/services.d.ts +81 -0
  131. package/dist/services.d.ts.map +1 -0
  132. package/dist/services.js +77 -0
  133. package/dist/services.js.map +1 -0
  134. package/dist/slack.d.ts +104 -0
  135. package/dist/slack.d.ts.map +1 -0
  136. package/dist/slack.js +98 -0
  137. package/dist/slack.js.map +1 -0
  138. package/dist/snapshot.d.ts +522 -0
  139. package/dist/snapshot.d.ts.map +1 -0
  140. package/dist/snapshot.js +104 -0
  141. package/dist/snapshot.js.map +1 -0
  142. package/dist/spec.d.ts +174 -0
  143. package/dist/spec.d.ts.map +1 -0
  144. package/dist/spec.js +173 -0
  145. package/dist/spec.js.map +1 -0
  146. package/dist/tasks.d.ts +150 -0
  147. package/dist/tasks.d.ts.map +1 -0
  148. package/dist/tasks.js +146 -0
  149. package/dist/tasks.js.map +1 -0
  150. package/dist/testing.d.ts +67 -0
  151. package/dist/testing.d.ts.map +1 -0
  152. package/dist/testing.js +64 -0
  153. package/dist/testing.js.map +1 -0
  154. package/dist/tracker.d.ts +18 -0
  155. package/dist/tracker.d.ts.map +1 -0
  156. package/dist/tracker.js +24 -0
  157. package/dist/tracker.js.map +1 -0
  158. package/dist/vendor-credentials.d.ts +37 -0
  159. package/dist/vendor-credentials.d.ts.map +1 -0
  160. package/dist/vendor-credentials.js +40 -0
  161. package/dist/vendor-credentials.js.map +1 -0
  162. package/dist/workspace-settings.d.ts +36 -0
  163. package/dist/workspace-settings.d.ts.map +1 -0
  164. package/dist/workspace-settings.js +41 -0
  165. package/dist/workspace-settings.js.map +1 -0
  166. package/package.json +31 -0
@@ -0,0 +1,387 @@
1
+ import * as v from 'valibot';
2
+ /** A credential reference by logical key (shared shape with the env manifest). */
3
+ export declare const runnerPoolSecretRefSchema: v.ObjectSchema<{
4
+ readonly key: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 64, undefined>]>;
5
+ }, undefined>;
6
+ export type RunnerPoolSecretRef = v.InferOutput<typeof runnerPoolSecretRefSchema>;
7
+ /** How the worker authenticates to the org's pool scheduler API. */
8
+ export declare const runnerPoolAuthSchemeSchema: v.VariantSchema<"type", [v.ObjectSchema<{
9
+ readonly type: v.LiteralSchema<"none", undefined>;
10
+ }, undefined>, v.ObjectSchema<{
11
+ readonly type: v.LiteralSchema<"api_key", undefined>;
12
+ readonly headerName: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
13
+ readonly secretRef: v.ObjectSchema<{
14
+ readonly key: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 64, undefined>]>;
15
+ }, undefined>;
16
+ readonly valuePrefix: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
17
+ }, undefined>, v.ObjectSchema<{
18
+ readonly type: v.LiteralSchema<"bearer", undefined>;
19
+ readonly secretRef: v.ObjectSchema<{
20
+ readonly key: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 64, undefined>]>;
21
+ }, undefined>;
22
+ }, undefined>, v.ObjectSchema<{
23
+ readonly type: v.LiteralSchema<"basic", undefined>;
24
+ readonly usernameSecretRef: v.ObjectSchema<{
25
+ readonly key: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 64, undefined>]>;
26
+ }, undefined>;
27
+ readonly passwordSecretRef: v.ObjectSchema<{
28
+ readonly key: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 64, undefined>]>;
29
+ }, undefined>;
30
+ }, undefined>, v.ObjectSchema<{
31
+ readonly type: v.LiteralSchema<"oauth2_client_credentials", undefined>;
32
+ readonly tokenUrl: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 2000, undefined>]>;
33
+ readonly clientIdSecretRef: v.ObjectSchema<{
34
+ readonly key: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 64, undefined>]>;
35
+ }, undefined>;
36
+ readonly clientSecretSecretRef: v.ObjectSchema<{
37
+ readonly key: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 64, undefined>]>;
38
+ }, undefined>;
39
+ readonly scope: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
40
+ readonly audience: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
41
+ }, undefined>, v.ObjectSchema<{
42
+ readonly type: v.LiteralSchema<"custom_headers", undefined>;
43
+ readonly headers: v.ArraySchema<v.ObjectSchema<{
44
+ readonly name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
45
+ readonly secretRef: v.ObjectSchema<{
46
+ readonly key: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 64, undefined>]>;
47
+ }, undefined>;
48
+ }, undefined>, undefined>;
49
+ }, undefined>], undefined>;
50
+ export type RunnerPoolAuthScheme = v.InferOutput<typeof runnerPoolAuthSchemeSchema>;
51
+ /**
52
+ * One HTTP call against the pool scheduler API. Generic: any method, a path
53
+ * appended to the manifest `baseUrl`, optional query/headers and a body, all
54
+ * supporting `{{var}}` interpolation. Variables come from a bounded namespace:
55
+ * `{{input.jobId}}` (the cat-factory execution id the pool is keyed on) and
56
+ * `{{input.job}}` (the full harness job spec as a JSON string — embed it raw to
57
+ * forward the job verbatim, e.g. `{"payload":{{input.job}}}`).
58
+ */
59
+ export declare const runnerPoolRequestTemplateSchema: v.ObjectSchema<{
60
+ readonly method: v.PicklistSchema<["GET", "POST", "PUT", "PATCH", "DELETE"], undefined>;
61
+ readonly pathTemplate: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000, undefined>]>;
62
+ readonly query: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
63
+ readonly key: v.StringSchema<undefined>;
64
+ readonly value: v.StringSchema<undefined>;
65
+ }, undefined>, undefined>, undefined>;
66
+ readonly headers: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
67
+ readonly name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
68
+ readonly value: v.StringSchema<undefined>;
69
+ }, undefined>, undefined>, undefined>;
70
+ readonly bodyTemplate: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
71
+ readonly timeoutMs: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 1, undefined>, v.MaxValueAction<number, 60000, undefined>]>, undefined>;
72
+ }, undefined>;
73
+ export type RunnerPoolRequestTemplate = v.InferOutput<typeof runnerPoolRequestTemplateSchema>;
74
+ /** The harness job lifecycle states the worker drives a job through. */
75
+ export declare const runnerJobStateSchema: v.PicklistSchema<["running", "done", "failed"], undefined>;
76
+ export type RunnerJobState = v.InferOutput<typeof runnerJobStateSchema>;
77
+ /**
78
+ * Maps the pool scheduler's arbitrary status response onto the canonical job
79
+ * view via dot-path field extraction. `statusMap` translates the scheduler's own
80
+ * status strings onto the harness states; the result/progress/error paths pull
81
+ * the work product out of whatever envelope the scheduler returns.
82
+ */
83
+ export declare const runnerPoolResponseMappingSchema: v.ObjectSchema<{
84
+ /** Dot-path to the scheduler's status string (e.g. `state`, `data.phase`). */
85
+ readonly statusPath: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
86
+ /** Translate scheduler status strings → harness states. */
87
+ readonly statusMap: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
88
+ readonly from: v.StringSchema<undefined>;
89
+ readonly to: v.PicklistSchema<["running", "done", "failed"], undefined>;
90
+ }, undefined>, undefined>, undefined>;
91
+ /** Dot-paths to live subtask counts, surfaced as "N/M done" progress. */
92
+ readonly progressCompletedPath: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
93
+ readonly progressInProgressPath: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
94
+ readonly progressTotalPath: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
95
+ /** Dot-paths to the finished work product. */
96
+ readonly prUrlPath: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
97
+ readonly branchPath: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
98
+ readonly summaryPath: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
99
+ /**
100
+ * Dot-path to the WHOLE structured result object the harness records (the
101
+ * harness `result`: `{ prUrl, branch, summary, service, spec, assessment, report,
102
+ * defaultBranch, pushed, resolved, usage }`). A pool that proxies the cat-factory
103
+ * executor-harness verbatim should set this so EVERY structured product — the
104
+ * blueprint tree, the spec doc, the merge assessment, the test report, the bootstrap
105
+ * default branch — is forwarded, not just the PR url/branch/summary scalars. Known
106
+ * fields are coerced by type; unknown ones are ignored. The individual scalar paths
107
+ * above still apply (and override) for schedulers that surface them out-of-envelope.
108
+ */
109
+ readonly resultPath: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
110
+ /** Dot-path to a job-level error message (a failed job, or a structured error). */
111
+ readonly errorPath: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
112
+ }, undefined>;
113
+ export type RunnerPoolResponseMapping = v.InferOutput<typeof runnerPoolResponseMappingSchema>;
114
+ /** The full declarative description of an org's runner-pool scheduler API. */
115
+ export declare const runnerPoolManifestSchema: v.ObjectSchema<{
116
+ readonly providerId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 64, undefined>]>;
117
+ readonly label: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 120, undefined>]>;
118
+ /** Scheduler API root; dispatch/poll/release paths are appended to it. */
119
+ readonly baseUrl: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 2000, undefined>]>;
120
+ readonly auth: v.VariantSchema<"type", [v.ObjectSchema<{
121
+ readonly type: v.LiteralSchema<"none", undefined>;
122
+ }, undefined>, v.ObjectSchema<{
123
+ readonly type: v.LiteralSchema<"api_key", undefined>;
124
+ readonly headerName: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
125
+ readonly secretRef: v.ObjectSchema<{
126
+ readonly key: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 64, undefined>]>;
127
+ }, undefined>;
128
+ readonly valuePrefix: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
129
+ }, undefined>, v.ObjectSchema<{
130
+ readonly type: v.LiteralSchema<"bearer", undefined>;
131
+ readonly secretRef: v.ObjectSchema<{
132
+ readonly key: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 64, undefined>]>;
133
+ }, undefined>;
134
+ }, undefined>, v.ObjectSchema<{
135
+ readonly type: v.LiteralSchema<"basic", undefined>;
136
+ readonly usernameSecretRef: v.ObjectSchema<{
137
+ readonly key: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 64, undefined>]>;
138
+ }, undefined>;
139
+ readonly passwordSecretRef: v.ObjectSchema<{
140
+ readonly key: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 64, undefined>]>;
141
+ }, undefined>;
142
+ }, undefined>, v.ObjectSchema<{
143
+ readonly type: v.LiteralSchema<"oauth2_client_credentials", undefined>;
144
+ readonly tokenUrl: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 2000, undefined>]>;
145
+ readonly clientIdSecretRef: v.ObjectSchema<{
146
+ readonly key: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 64, undefined>]>;
147
+ }, undefined>;
148
+ readonly clientSecretSecretRef: v.ObjectSchema<{
149
+ readonly key: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 64, undefined>]>;
150
+ }, undefined>;
151
+ readonly scope: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
152
+ readonly audience: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
153
+ }, undefined>, v.ObjectSchema<{
154
+ readonly type: v.LiteralSchema<"custom_headers", undefined>;
155
+ readonly headers: v.ArraySchema<v.ObjectSchema<{
156
+ readonly name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
157
+ readonly secretRef: v.ObjectSchema<{
158
+ readonly key: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 64, undefined>]>;
159
+ }, undefined>;
160
+ }, undefined>, undefined>;
161
+ }, undefined>], undefined>;
162
+ /** Starts a job on the pool (analogous to the harness `POST /run`). */
163
+ readonly dispatch: v.ObjectSchema<{
164
+ readonly method: v.PicklistSchema<["GET", "POST", "PUT", "PATCH", "DELETE"], undefined>;
165
+ readonly pathTemplate: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000, undefined>]>;
166
+ readonly query: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
167
+ readonly key: v.StringSchema<undefined>;
168
+ readonly value: v.StringSchema<undefined>;
169
+ }, undefined>, undefined>, undefined>;
170
+ readonly headers: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
171
+ readonly name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
172
+ readonly value: v.StringSchema<undefined>;
173
+ }, undefined>, undefined>, undefined>;
174
+ readonly bodyTemplate: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
175
+ readonly timeoutMs: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 1, undefined>, v.MaxValueAction<number, 60000, undefined>]>, undefined>;
176
+ }, undefined>;
177
+ /** Reads a job's status (analogous to the harness `GET /jobs/{id}`). */
178
+ readonly poll: v.ObjectSchema<{
179
+ readonly method: v.PicklistSchema<["GET", "POST", "PUT", "PATCH", "DELETE"], undefined>;
180
+ readonly pathTemplate: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000, undefined>]>;
181
+ readonly query: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
182
+ readonly key: v.StringSchema<undefined>;
183
+ readonly value: v.StringSchema<undefined>;
184
+ }, undefined>, undefined>, undefined>;
185
+ readonly headers: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
186
+ readonly name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
187
+ readonly value: v.StringSchema<undefined>;
188
+ }, undefined>, undefined>, undefined>;
189
+ readonly bodyTemplate: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
190
+ readonly timeoutMs: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 1, undefined>, v.MaxValueAction<number, 60000, undefined>]>, undefined>;
191
+ }, undefined>;
192
+ /** Optional: frees the runner/job once the worker is done with it. */
193
+ readonly release: v.OptionalSchema<v.ObjectSchema<{
194
+ readonly method: v.PicklistSchema<["GET", "POST", "PUT", "PATCH", "DELETE"], undefined>;
195
+ readonly pathTemplate: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000, undefined>]>;
196
+ readonly query: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
197
+ readonly key: v.StringSchema<undefined>;
198
+ readonly value: v.StringSchema<undefined>;
199
+ }, undefined>, undefined>, undefined>;
200
+ readonly headers: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
201
+ readonly name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
202
+ readonly value: v.StringSchema<undefined>;
203
+ }, undefined>, undefined>, undefined>;
204
+ readonly bodyTemplate: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
205
+ readonly timeoutMs: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 1, undefined>, v.MaxValueAction<number, 60000, undefined>]>, undefined>;
206
+ }, undefined>, undefined>;
207
+ readonly response: v.ObjectSchema<{
208
+ /** Dot-path to the scheduler's status string (e.g. `state`, `data.phase`). */
209
+ readonly statusPath: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
210
+ /** Translate scheduler status strings → harness states. */
211
+ readonly statusMap: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
212
+ readonly from: v.StringSchema<undefined>;
213
+ readonly to: v.PicklistSchema<["running", "done", "failed"], undefined>;
214
+ }, undefined>, undefined>, undefined>;
215
+ /** Dot-paths to live subtask counts, surfaced as "N/M done" progress. */
216
+ readonly progressCompletedPath: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
217
+ readonly progressInProgressPath: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
218
+ readonly progressTotalPath: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
219
+ /** Dot-paths to the finished work product. */
220
+ readonly prUrlPath: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
221
+ readonly branchPath: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
222
+ readonly summaryPath: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
223
+ /**
224
+ * Dot-path to the WHOLE structured result object the harness records (the
225
+ * harness `result`: `{ prUrl, branch, summary, service, spec, assessment, report,
226
+ * defaultBranch, pushed, resolved, usage }`). A pool that proxies the cat-factory
227
+ * executor-harness verbatim should set this so EVERY structured product — the
228
+ * blueprint tree, the spec doc, the merge assessment, the test report, the bootstrap
229
+ * default branch — is forwarded, not just the PR url/branch/summary scalars. Known
230
+ * fields are coerced by type; unknown ones are ignored. The individual scalar paths
231
+ * above still apply (and override) for schedulers that surface them out-of-envelope.
232
+ */
233
+ readonly resultPath: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
234
+ /** Dot-path to a job-level error message (a failed job, or a structured error). */
235
+ readonly errorPath: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
236
+ }, undefined>;
237
+ }, undefined>;
238
+ export type RunnerPoolManifest = v.InferOutput<typeof runnerPoolManifestSchema>;
239
+ /** A workspace's pool binding, as exposed to clients (never secret values). */
240
+ export declare const runnerPoolConnectionSchema: v.ObjectSchema<{
241
+ readonly providerId: v.StringSchema<undefined>;
242
+ readonly label: v.StringSchema<undefined>;
243
+ readonly baseUrl: v.StringSchema<undefined>;
244
+ readonly connectedAt: v.NumberSchema<undefined>;
245
+ /** Which secret keys are set (names only), so the UI can show completeness. */
246
+ readonly secretKeys: v.ArraySchema<v.StringSchema<undefined>, undefined>;
247
+ }, undefined>;
248
+ export type RunnerPoolConnection = v.InferOutput<typeof runnerPoolConnectionSchema>;
249
+ /**
250
+ * Register (or replace) a workspace's runner pool. The org supplies the actual
251
+ * per-tenant scheduler-API secret values here (write-only); they are encrypted
252
+ * and stored in D1 and never returned. Every `secretRef.key` in the manifest
253
+ * must have a matching entry in `secrets`.
254
+ */
255
+ export declare const registerRunnerPoolSchema: v.ObjectSchema<{
256
+ readonly manifest: v.ObjectSchema<{
257
+ readonly providerId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 64, undefined>]>;
258
+ readonly label: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 120, undefined>]>;
259
+ /** Scheduler API root; dispatch/poll/release paths are appended to it. */
260
+ readonly baseUrl: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 2000, undefined>]>;
261
+ readonly auth: v.VariantSchema<"type", [v.ObjectSchema<{
262
+ readonly type: v.LiteralSchema<"none", undefined>;
263
+ }, undefined>, v.ObjectSchema<{
264
+ readonly type: v.LiteralSchema<"api_key", undefined>;
265
+ readonly headerName: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
266
+ readonly secretRef: v.ObjectSchema<{
267
+ readonly key: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 64, undefined>]>;
268
+ }, undefined>;
269
+ readonly valuePrefix: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
270
+ }, undefined>, v.ObjectSchema<{
271
+ readonly type: v.LiteralSchema<"bearer", undefined>;
272
+ readonly secretRef: v.ObjectSchema<{
273
+ readonly key: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 64, undefined>]>;
274
+ }, undefined>;
275
+ }, undefined>, v.ObjectSchema<{
276
+ readonly type: v.LiteralSchema<"basic", undefined>;
277
+ readonly usernameSecretRef: v.ObjectSchema<{
278
+ readonly key: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 64, undefined>]>;
279
+ }, undefined>;
280
+ readonly passwordSecretRef: v.ObjectSchema<{
281
+ readonly key: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 64, undefined>]>;
282
+ }, undefined>;
283
+ }, undefined>, v.ObjectSchema<{
284
+ readonly type: v.LiteralSchema<"oauth2_client_credentials", undefined>;
285
+ readonly tokenUrl: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 2000, undefined>]>;
286
+ readonly clientIdSecretRef: v.ObjectSchema<{
287
+ readonly key: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 64, undefined>]>;
288
+ }, undefined>;
289
+ readonly clientSecretSecretRef: v.ObjectSchema<{
290
+ readonly key: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 64, undefined>]>;
291
+ }, undefined>;
292
+ readonly scope: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
293
+ readonly audience: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
294
+ }, undefined>, v.ObjectSchema<{
295
+ readonly type: v.LiteralSchema<"custom_headers", undefined>;
296
+ readonly headers: v.ArraySchema<v.ObjectSchema<{
297
+ readonly name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
298
+ readonly secretRef: v.ObjectSchema<{
299
+ readonly key: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 64, undefined>]>;
300
+ }, undefined>;
301
+ }, undefined>, undefined>;
302
+ }, undefined>], undefined>;
303
+ /** Starts a job on the pool (analogous to the harness `POST /run`). */
304
+ readonly dispatch: v.ObjectSchema<{
305
+ readonly method: v.PicklistSchema<["GET", "POST", "PUT", "PATCH", "DELETE"], undefined>;
306
+ readonly pathTemplate: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000, undefined>]>;
307
+ readonly query: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
308
+ readonly key: v.StringSchema<undefined>;
309
+ readonly value: v.StringSchema<undefined>;
310
+ }, undefined>, undefined>, undefined>;
311
+ readonly headers: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
312
+ readonly name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
313
+ readonly value: v.StringSchema<undefined>;
314
+ }, undefined>, undefined>, undefined>;
315
+ readonly bodyTemplate: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
316
+ readonly timeoutMs: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 1, undefined>, v.MaxValueAction<number, 60000, undefined>]>, undefined>;
317
+ }, undefined>;
318
+ /** Reads a job's status (analogous to the harness `GET /jobs/{id}`). */
319
+ readonly poll: v.ObjectSchema<{
320
+ readonly method: v.PicklistSchema<["GET", "POST", "PUT", "PATCH", "DELETE"], undefined>;
321
+ readonly pathTemplate: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000, undefined>]>;
322
+ readonly query: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
323
+ readonly key: v.StringSchema<undefined>;
324
+ readonly value: v.StringSchema<undefined>;
325
+ }, undefined>, undefined>, undefined>;
326
+ readonly headers: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
327
+ readonly name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
328
+ readonly value: v.StringSchema<undefined>;
329
+ }, undefined>, undefined>, undefined>;
330
+ readonly bodyTemplate: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
331
+ readonly timeoutMs: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 1, undefined>, v.MaxValueAction<number, 60000, undefined>]>, undefined>;
332
+ }, undefined>;
333
+ /** Optional: frees the runner/job once the worker is done with it. */
334
+ readonly release: v.OptionalSchema<v.ObjectSchema<{
335
+ readonly method: v.PicklistSchema<["GET", "POST", "PUT", "PATCH", "DELETE"], undefined>;
336
+ readonly pathTemplate: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000, undefined>]>;
337
+ readonly query: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
338
+ readonly key: v.StringSchema<undefined>;
339
+ readonly value: v.StringSchema<undefined>;
340
+ }, undefined>, undefined>, undefined>;
341
+ readonly headers: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
342
+ readonly name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
343
+ readonly value: v.StringSchema<undefined>;
344
+ }, undefined>, undefined>, undefined>;
345
+ readonly bodyTemplate: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
346
+ readonly timeoutMs: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 1, undefined>, v.MaxValueAction<number, 60000, undefined>]>, undefined>;
347
+ }, undefined>, undefined>;
348
+ readonly response: v.ObjectSchema<{
349
+ /** Dot-path to the scheduler's status string (e.g. `state`, `data.phase`). */
350
+ readonly statusPath: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
351
+ /** Translate scheduler status strings → harness states. */
352
+ readonly statusMap: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
353
+ readonly from: v.StringSchema<undefined>;
354
+ readonly to: v.PicklistSchema<["running", "done", "failed"], undefined>;
355
+ }, undefined>, undefined>, undefined>;
356
+ /** Dot-paths to live subtask counts, surfaced as "N/M done" progress. */
357
+ readonly progressCompletedPath: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
358
+ readonly progressInProgressPath: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
359
+ readonly progressTotalPath: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
360
+ /** Dot-paths to the finished work product. */
361
+ readonly prUrlPath: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
362
+ readonly branchPath: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
363
+ readonly summaryPath: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
364
+ /**
365
+ * Dot-path to the WHOLE structured result object the harness records (the
366
+ * harness `result`: `{ prUrl, branch, summary, service, spec, assessment, report,
367
+ * defaultBranch, pushed, resolved, usage }`). A pool that proxies the cat-factory
368
+ * executor-harness verbatim should set this so EVERY structured product — the
369
+ * blueprint tree, the spec doc, the merge assessment, the test report, the bootstrap
370
+ * default branch — is forwarded, not just the PR url/branch/summary scalars. Known
371
+ * fields are coerced by type; unknown ones are ignored. The individual scalar paths
372
+ * above still apply (and override) for schedulers that surface them out-of-envelope.
373
+ */
374
+ readonly resultPath: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
375
+ /** Dot-path to a job-level error message (a failed job, or a structured error). */
376
+ readonly errorPath: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
377
+ }, undefined>;
378
+ }, undefined>;
379
+ readonly secrets: v.RecordSchema<v.StringSchema<undefined>, v.StringSchema<undefined>, undefined>;
380
+ }, undefined>;
381
+ export type RegisterRunnerPoolInput = v.InferOutput<typeof registerRunnerPoolSchema>;
382
+ /** Rotate/replace the per-tenant secret bundle without re-sending the manifest. */
383
+ export declare const updateRunnerPoolSecretsSchema: v.ObjectSchema<{
384
+ readonly secrets: v.RecordSchema<v.StringSchema<undefined>, v.StringSchema<undefined>, undefined>;
385
+ }, undefined>;
386
+ export type UpdateRunnerPoolSecretsInput = v.InferOutput<typeof updateRunnerPoolSecretsSchema>;
387
+ //# sourceMappingURL=runners.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runners.d.ts","sourceRoot":"","sources":["../src/runners.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAmC5B,kFAAkF;AAClF,eAAO,MAAM,yBAAyB;;aAA6B,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AwB,CAAC,CAAA;AAE/E,+EAA+E;AAC/E,eAAO,MAAM,0BAA0B;;;;;IAKrC,+EAA+E;;aAE/E,CAAA;AACF,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,0BAA0B,CAAC,CAAA;AAInF;;;;;GAKG;AACH,eAAO,MAAM,wBAAwB;;;;QAhCnC,0EAA0E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAG1E,uEAAuE;;;;;;;;;;;;;;;QAEvE,wEAAwE;;;;;;;;;;;;;;;QAExE,sEAAsE;;;;;;;;;;;;;;;;YAvCtE,8EAA8E;;YAE9E,2DAA2D;;;;;YAE3D,yEAAyE;;;;YAIzE,8CAA8C;;;;YAI9C;;;;;;;;;eASG;;YAEH,mFAAmF;;;;;aA4CnF,CAAA;AACF,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,wBAAwB,CAAC,CAAA;AAEpF,mFAAmF;AACnF,eAAO,MAAM,6BAA6B;;aAExC,CAAA;AACF,MAAM,MAAM,4BAA4B,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,6BAA6B,CAAC,CAAA"}
@@ -0,0 +1,117 @@
1
+ import * as v from 'valibot';
2
+ import { environmentAuthSchemeSchema, environmentRequestTemplateSchema, environmentSecretRefSchema, } from './environments.js';
3
+ // ---------------------------------------------------------------------------
4
+ // Self-hosted runner-pool wire contracts ("bring your own infra").
5
+ //
6
+ // By default the repo-operating coding jobs run in per-run Cloudflare Containers.
7
+ // An organization can instead point cat-factory at its OWN container/runner pool
8
+ // (k8s, Nomad, an internal scheduler) running the standard executor-harness
9
+ // image. The harness job protocol is fixed (`POST /jobs` with the kind in the body
10
+ // → `GET /jobs/{id}`); what is org-specific is the *scheduler in front of the pool*
11
+ // — how a job is assigned to a runner and how its status is read back.
12
+ //
13
+ // So, exactly like the ephemeral-environment provider (ADR 0003), an org
14
+ // describes its pool scheduler declaratively: a manifest of HTTP request
15
+ // templates for `dispatch` / `poll` / (optional) `release`, the auth scheme for
16
+ // calling it, and a dot-path mapping from that scheduler's (arbitrary) response
17
+ // onto the canonical harness job view. One generic adapter in the worker
18
+ // interprets any manifest — no per-org code.
19
+ //
20
+ // The generic auth / request-template / secret-ref shapes are shared with the
21
+ // environment manifest (they are not environment-specific); we reuse them here
22
+ // rather than redefining them.
23
+ //
24
+ // Secret handling mirrors environments: the manifest references the pool-API
25
+ // credentials by *logical key* only; the values are supplied at registration,
26
+ // stored encrypted-at-rest in D1, and resolved in-memory at call time. The
27
+ // per-job GitHub + LLM-proxy tokens travel in the dispatch payload (the runner
28
+ // needs them) but are never logged.
29
+ // ---------------------------------------------------------------------------
30
+ /** A credential reference by logical key (shared shape with the env manifest). */
31
+ export const runnerPoolSecretRefSchema = environmentSecretRefSchema;
32
+ /** How the worker authenticates to the org's pool scheduler API. */
33
+ export const runnerPoolAuthSchemeSchema = environmentAuthSchemeSchema;
34
+ /**
35
+ * One HTTP call against the pool scheduler API. Generic: any method, a path
36
+ * appended to the manifest `baseUrl`, optional query/headers and a body, all
37
+ * supporting `{{var}}` interpolation. Variables come from a bounded namespace:
38
+ * `{{input.jobId}}` (the cat-factory execution id the pool is keyed on) and
39
+ * `{{input.job}}` (the full harness job spec as a JSON string — embed it raw to
40
+ * forward the job verbatim, e.g. `{"payload":{{input.job}}}`).
41
+ */
42
+ export const runnerPoolRequestTemplateSchema = environmentRequestTemplateSchema;
43
+ /** The harness job lifecycle states the worker drives a job through. */
44
+ export const runnerJobStateSchema = v.picklist(['running', 'done', 'failed']);
45
+ /**
46
+ * Maps the pool scheduler's arbitrary status response onto the canonical job
47
+ * view via dot-path field extraction. `statusMap` translates the scheduler's own
48
+ * status strings onto the harness states; the result/progress/error paths pull
49
+ * the work product out of whatever envelope the scheduler returns.
50
+ */
51
+ export const runnerPoolResponseMappingSchema = v.object({
52
+ /** Dot-path to the scheduler's status string (e.g. `state`, `data.phase`). */
53
+ statusPath: v.optional(v.string()),
54
+ /** Translate scheduler status strings → harness states. */
55
+ statusMap: v.optional(v.array(v.object({ from: v.string(), to: runnerJobStateSchema }))),
56
+ /** Dot-paths to live subtask counts, surfaced as "N/M done" progress. */
57
+ progressCompletedPath: v.optional(v.string()),
58
+ progressInProgressPath: v.optional(v.string()),
59
+ progressTotalPath: v.optional(v.string()),
60
+ /** Dot-paths to the finished work product. */
61
+ prUrlPath: v.optional(v.string()),
62
+ branchPath: v.optional(v.string()),
63
+ summaryPath: v.optional(v.string()),
64
+ /**
65
+ * Dot-path to the WHOLE structured result object the harness records (the
66
+ * harness `result`: `{ prUrl, branch, summary, service, spec, assessment, report,
67
+ * defaultBranch, pushed, resolved, usage }`). A pool that proxies the cat-factory
68
+ * executor-harness verbatim should set this so EVERY structured product — the
69
+ * blueprint tree, the spec doc, the merge assessment, the test report, the bootstrap
70
+ * default branch — is forwarded, not just the PR url/branch/summary scalars. Known
71
+ * fields are coerced by type; unknown ones are ignored. The individual scalar paths
72
+ * above still apply (and override) for schedulers that surface them out-of-envelope.
73
+ */
74
+ resultPath: v.optional(v.string()),
75
+ /** Dot-path to a job-level error message (a failed job, or a structured error). */
76
+ errorPath: v.optional(v.string()),
77
+ });
78
+ /** The full declarative description of an org's runner-pool scheduler API. */
79
+ export const runnerPoolManifestSchema = v.object({
80
+ providerId: v.pipe(v.string(), v.regex(/^[a-z0-9-]+$/), v.minLength(1), v.maxLength(64)),
81
+ label: v.pipe(v.string(), v.trim(), v.minLength(1), v.maxLength(120)),
82
+ /** Scheduler API root; dispatch/poll/release paths are appended to it. */
83
+ baseUrl: v.pipe(v.string(), v.trim(), v.minLength(1), v.maxLength(2000)),
84
+ auth: runnerPoolAuthSchemeSchema,
85
+ /** Starts a job on the pool (analogous to the harness `POST /run`). */
86
+ dispatch: runnerPoolRequestTemplateSchema,
87
+ /** Reads a job's status (analogous to the harness `GET /jobs/{id}`). */
88
+ poll: runnerPoolRequestTemplateSchema,
89
+ /** Optional: frees the runner/job once the worker is done with it. */
90
+ release: v.optional(runnerPoolRequestTemplateSchema),
91
+ response: runnerPoolResponseMappingSchema,
92
+ });
93
+ /** A workspace's pool binding, as exposed to clients (never secret values). */
94
+ export const runnerPoolConnectionSchema = v.object({
95
+ providerId: v.string(),
96
+ label: v.string(),
97
+ baseUrl: v.string(),
98
+ connectedAt: v.number(),
99
+ /** Which secret keys are set (names only), so the UI can show completeness. */
100
+ secretKeys: v.array(v.string()),
101
+ });
102
+ // ---- Request bodies -------------------------------------------------------
103
+ /**
104
+ * Register (or replace) a workspace's runner pool. The org supplies the actual
105
+ * per-tenant scheduler-API secret values here (write-only); they are encrypted
106
+ * and stored in D1 and never returned. Every `secretRef.key` in the manifest
107
+ * must have a matching entry in `secrets`.
108
+ */
109
+ export const registerRunnerPoolSchema = v.object({
110
+ manifest: runnerPoolManifestSchema,
111
+ secrets: v.record(v.string(), v.string()),
112
+ });
113
+ /** Rotate/replace the per-tenant secret bundle without re-sending the manifest. */
114
+ export const updateRunnerPoolSecretsSchema = v.object({
115
+ secrets: v.record(v.string(), v.string()),
116
+ });
117
+ //# sourceMappingURL=runners.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runners.js","sourceRoot":"","sources":["../src/runners.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAC5B,OAAO,EACL,2BAA2B,EAC3B,gCAAgC,EAChC,0BAA0B,GAC3B,MAAM,mBAAmB,CAAA;AAE1B,8EAA8E;AAC9E,mEAAmE;AACnE,EAAE;AACF,kFAAkF;AAClF,iFAAiF;AACjF,4EAA4E;AAC5E,mFAAmF;AACnF,oFAAoF;AACpF,uEAAuE;AACvE,EAAE;AACF,yEAAyE;AACzE,yEAAyE;AACzE,gFAAgF;AAChF,gFAAgF;AAChF,yEAAyE;AACzE,6CAA6C;AAC7C,EAAE;AACF,8EAA8E;AAC9E,+EAA+E;AAC/E,+BAA+B;AAC/B,EAAE;AACF,6EAA6E;AAC7E,8EAA8E;AAC9E,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