@kitman-sh/sdk 0.8.0 → 0.10.52
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.
- package/dist/build/index.js +531 -116
- package/dist/{chunk-36jhc745.js → chunk-tcbgb4wm.js} +1841 -1574
- package/dist/{chunk-160ww64c.js → chunk-zvzw3zs4.js} +939 -535
- package/dist/loop/index.js +117 -3
- package/dist/program/index.js +10 -6
- package/package.json +6 -6
- package/types/packages/core/src/agent-capabilities.d.ts +6 -0
- package/types/packages/core/src/agent-environment.d.ts +32 -216
- package/types/packages/core/src/agent-sandbox-policy.d.ts +17 -3
- package/types/packages/core/src/change-request-review.d.ts +20 -5
- package/types/packages/core/src/change-request.d.ts +33 -208
- package/types/packages/core/src/crypto.d.ts +2 -0
- package/types/packages/core/src/index.d.ts +8 -4
- package/types/packages/core/src/{package-declarations.d.ts → kit-declarations.d.ts} +84 -180
- package/types/packages/core/src/kit-install.d.ts +130 -0
- package/types/packages/core/src/kit-setup.d.ts +316 -0
- package/types/packages/core/src/kit.d.ts +302 -1444
- package/types/packages/core/src/loop-layers.d.ts +33 -4
- package/types/packages/core/src/loop.d.ts +325 -55
- package/types/packages/core/src/marketplace.d.ts +51 -10
- package/types/packages/core/src/my-teams.d.ts +135 -20
- package/types/packages/core/src/network-host.d.ts +41 -0
- package/types/packages/core/src/notification.d.ts +8 -0
- package/types/packages/core/src/npm-registry.d.ts +65 -0
- package/types/packages/core/src/proposal.d.ts +0 -76
- package/types/packages/core/src/push.d.ts +68 -0
- package/types/packages/core/src/question-recommendation.d.ts +28 -0
- package/types/packages/core/src/redaction.d.ts +15 -3
- package/types/packages/core/src/resource-claim.d.ts +79 -0
- package/types/packages/core/src/run-display.d.ts +7 -1
- package/types/packages/core/src/run-graph.d.ts +1 -1
- package/types/packages/core/src/run-launch.d.ts +15 -2
- package/types/packages/core/src/run-queue.d.ts +28 -0
- package/types/packages/core/src/runner-eligibility.d.ts +21 -2
- package/types/packages/core/src/runner.d.ts +46 -15
- package/types/packages/core/src/secret.d.ts +18 -1
- package/types/packages/core/src/step-brief.d.ts +21 -7
- package/types/packages/core/src/sync-kit.d.ts +8 -0
- package/types/packages/core/src/task-detail.d.ts +15 -2
- package/types/packages/core/src/task.d.ts +9 -0
- package/types/packages/core/src/transcript.d.ts +24 -4
- package/types/packages/core/src/trust-panel.d.ts +1 -1
- package/types/packages/core/src/waiting-on.d.ts +14 -0
- package/types/packages/core/src/work-unit.d.ts +339 -8
- package/types/packages/live/src/rpc/runner-client.d.ts +1229 -566
- package/types/packages/live/src/rpc/runner-group.d.ts +2851 -441
- package/types/packages/sdk/src/build/index.d.ts +45 -9
- package/types/packages/sdk/src/loop/activities.d.ts +382 -2
- package/types/packages/sdk/src/loop/claims.d.ts +57 -0
- package/types/packages/sdk/src/loop/config.d.ts +38 -31
- package/types/packages/sdk/src/loop/continuing.d.ts +22 -0
- package/types/packages/sdk/src/loop/define.d.ts +30 -5
- package/types/packages/sdk/src/loop/evidence.d.ts +18 -3
- package/types/packages/sdk/src/loop/index.d.ts +4 -0
- package/types/packages/sdk/src/loop/measure.d.ts +132 -0
- package/types/packages/sdk/src/loop/plan.d.ts +2 -2
- package/types/packages/sdk/src/loop/steps.d.ts +127 -17
- package/types/packages/sdk/src/loop/sync.d.ts +53 -0
- package/types/packages/sdk/src/loop/test-loop.d.ts +25 -5
- package/types/packages/sdk/src/program/engine.d.ts +116 -17
- package/types/packages/sdk/src/program/host.d.ts +200 -38
- package/types/packages/core/src/engineering-resources.d.ts +0 -24
- package/types/packages/core/src/package.d.ts +0 -369
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
// packages/core/src/
|
|
2
|
+
// packages/core/src/kit-declarations.ts
|
|
3
3
|
import * as Schema14 from "effect/Schema";
|
|
4
4
|
|
|
5
5
|
// packages/core/src/agent-sandbox-policy.ts
|
|
@@ -21,13 +21,58 @@ var AgentSandboxPolicy = Schema.Struct({
|
|
|
21
21
|
// packages/core/src/loop-version.ts
|
|
22
22
|
import * as Schema4 from "effect/Schema";
|
|
23
23
|
|
|
24
|
+
// packages/core/src/runtime-type.ts
|
|
25
|
+
import * as Predicate from "effect/Predicate";
|
|
26
|
+
var UnsafeJsonObjectKeys = new Set(["__proto__", "constructor", "prototype"]);
|
|
27
|
+
function isBigInt2(value) {
|
|
28
|
+
return Predicate.isBigInt(value);
|
|
29
|
+
}
|
|
30
|
+
function isBoolean2(value) {
|
|
31
|
+
return Predicate.isBoolean(value);
|
|
32
|
+
}
|
|
33
|
+
function isFunction2(value) {
|
|
34
|
+
return Predicate.isFunction(value);
|
|
35
|
+
}
|
|
36
|
+
function isNumber2(value) {
|
|
37
|
+
return Predicate.isNumber(value);
|
|
38
|
+
}
|
|
39
|
+
function isObject(value) {
|
|
40
|
+
return Predicate.isObjectOrArray(value);
|
|
41
|
+
}
|
|
42
|
+
function isString2(value) {
|
|
43
|
+
return Predicate.isString(value);
|
|
44
|
+
}
|
|
45
|
+
function isSymbol2(value) {
|
|
46
|
+
return Predicate.isSymbol(value);
|
|
47
|
+
}
|
|
48
|
+
function isUndefined2(value) {
|
|
49
|
+
return Predicate.isUndefined(value);
|
|
50
|
+
}
|
|
51
|
+
function kindOf(value) {
|
|
52
|
+
if (isString2(value))
|
|
53
|
+
return "string";
|
|
54
|
+
if (isNumber2(value))
|
|
55
|
+
return "number";
|
|
56
|
+
if (isBoolean2(value))
|
|
57
|
+
return "boolean";
|
|
58
|
+
if (isBigInt2(value))
|
|
59
|
+
return "bigint";
|
|
60
|
+
if (isSymbol2(value))
|
|
61
|
+
return "symbol";
|
|
62
|
+
if (isUndefined2(value))
|
|
63
|
+
return "undefined";
|
|
64
|
+
if (isFunction2(value))
|
|
65
|
+
return "function";
|
|
66
|
+
return "object";
|
|
67
|
+
}
|
|
68
|
+
|
|
24
69
|
// packages/core/src/common.ts
|
|
25
70
|
import * as Schema3 from "effect/Schema";
|
|
26
71
|
|
|
27
72
|
// packages/core/src/schema.ts
|
|
28
73
|
import * as Exit from "effect/Exit";
|
|
29
74
|
import * as JsonSchema from "effect/JsonSchema";
|
|
30
|
-
import * as
|
|
75
|
+
import * as Predicate2 from "effect/Predicate";
|
|
31
76
|
import * as Schema2 from "effect/Schema";
|
|
32
77
|
var Days = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
|
33
78
|
var DatePattern = /^(\d\d\d\d)-(\d\d)-(\d\d)$/;
|
|
@@ -82,7 +127,7 @@ var guards = new WeakMap;
|
|
|
82
127
|
function hasUndefinedProperty(value) {
|
|
83
128
|
if (Array.isArray(value))
|
|
84
129
|
return value.some(hasUndefinedProperty);
|
|
85
|
-
if (!
|
|
130
|
+
if (!Predicate2.isObject(value))
|
|
86
131
|
return false;
|
|
87
132
|
return Object.values(value).some((entry) => entry === undefined || hasUndefinedProperty(entry));
|
|
88
133
|
}
|
|
@@ -90,7 +135,7 @@ function withoutUndefined(value) {
|
|
|
90
135
|
if (Array.isArray(value)) {
|
|
91
136
|
return value.map(withoutUndefined);
|
|
92
137
|
}
|
|
93
|
-
if (!
|
|
138
|
+
if (!Predicate2.isObject(value) || Object.getPrototypeOf(value) !== Object.prototype)
|
|
94
139
|
return value;
|
|
95
140
|
return Object.fromEntries(Object.entries(value).flatMap(([key, entry]) => entry === undefined ? [] : [[key, withoutUndefined(entry)]]));
|
|
96
141
|
}
|
|
@@ -134,962 +179,183 @@ var LoopReferenceSchema = Schema4.Union([
|
|
|
134
179
|
digest: Schema4.String.check(Schema4.isMinLength(64), Schema4.isMaxLength(64), Schema4.isPattern(new RegExp("^[a-f0-9]{64}$", "u")))
|
|
135
180
|
})
|
|
136
181
|
]);
|
|
182
|
+
function canonicalJson(value) {
|
|
183
|
+
return canonicalJsonValue(value);
|
|
184
|
+
}
|
|
185
|
+
function canonicalJsonValue(value, propertyName) {
|
|
186
|
+
if (value === null)
|
|
187
|
+
return "null";
|
|
188
|
+
if (isString2(value))
|
|
189
|
+
return JSON.stringify(propertyName !== undefined && /(?:digest|sha256)$/i.test(propertyName) ? value.toLowerCase() : value);
|
|
190
|
+
if (isBoolean2(value))
|
|
191
|
+
return value ? "true" : "false";
|
|
192
|
+
if (isNumber2(value)) {
|
|
193
|
+
if (!Number.isFinite(value))
|
|
194
|
+
throw new TypeError("Canonical JSON cannot contain non-finite numbers");
|
|
195
|
+
return JSON.stringify(value);
|
|
196
|
+
}
|
|
197
|
+
if (isUndefined2(value))
|
|
198
|
+
throw new TypeError("Canonical JSON cannot contain undefined values");
|
|
199
|
+
if (isBigInt2(value) || isFunction2(value) || isSymbol2(value))
|
|
200
|
+
throw new TypeError(`Canonical JSON cannot contain ${kindOf(value)}`);
|
|
201
|
+
if (Array.isArray(value))
|
|
202
|
+
return `[${value.map((item) => canonicalJsonValue(item)).join(",")}]`;
|
|
203
|
+
if (isObject(value))
|
|
204
|
+
return `{${Object.keys(value).sort().map((key) => `${JSON.stringify(key)}:${canonicalJsonValue(Object.getOwnPropertyDescriptor(value, key)?.value, key)}`).join(",")}}`;
|
|
205
|
+
throw new TypeError("Canonical JSON value is not supported");
|
|
206
|
+
}
|
|
137
207
|
|
|
138
|
-
// packages/core/src/
|
|
208
|
+
// packages/core/src/kit.ts
|
|
139
209
|
import * as Schema5 from "effect/Schema";
|
|
140
|
-
var
|
|
141
|
-
var
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
Schema5.
|
|
145
|
-
Schema5.
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
var
|
|
149
|
-
var
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
}),
|
|
157
|
-
Schema5.Struct({
|
|
158
|
-
kind: Schema5.Literal("kitman"),
|
|
159
|
-
skillId: Schema5.optionalKey(Id),
|
|
160
|
-
name: Schema5.optionalKey(Schema5.String.check(Schema5.isMinLength(1))),
|
|
161
|
-
contentMarkdown: Schema5.optionalKey(Schema5.String.check(Schema5.isMinLength(1))),
|
|
162
|
-
files: Schema5.optionalKey(Schema5.Record(SourcePath, Schema5.String))
|
|
163
|
-
}),
|
|
164
|
-
Schema5.Struct({
|
|
165
|
-
kind: Schema5.Literal("git"),
|
|
166
|
-
url: Schema5.String.check(Schema5.isMinLength(1)),
|
|
167
|
-
ref: Schema5.optionalKey(Schema5.String.check(Schema5.isMinLength(1))),
|
|
168
|
-
path: Schema5.optionalKey(SourcePath),
|
|
169
|
-
sha256: Schema5.optionalKey(Sha256)
|
|
170
|
-
}),
|
|
171
|
-
Schema5.Struct({
|
|
172
|
-
kind: Schema5.Literal("package"),
|
|
173
|
-
packageName: Schema5.String.check(Schema5.isMinLength(1)),
|
|
174
|
-
version: Schema5.String.check(Schema5.isMinLength(1)),
|
|
175
|
-
path: Schema5.optionalKey(SourcePath),
|
|
176
|
-
sha256: Schema5.optionalKey(Sha256)
|
|
177
|
-
}),
|
|
178
|
-
Schema5.Struct({ kind: Schema5.Literal("url"), url: Schema5.String.check(Schema5.isMinLength(1)), sha256: Sha256 }),
|
|
179
|
-
Schema5.Struct({ kind: Schema5.Literal("local_path"), path: Schema5.String.check(Schema5.isMinLength(1)) })
|
|
180
|
-
]);
|
|
181
|
-
var PluginSource = Schema5.Union([
|
|
182
|
-
Schema5.Struct({
|
|
183
|
-
kind: Schema5.Literal("package"),
|
|
184
|
-
packageName: Schema5.String.check(Schema5.isMinLength(1)),
|
|
185
|
-
version: Schema5.optionalKey(Schema5.String.check(Schema5.isMinLength(1)))
|
|
186
|
-
}),
|
|
187
|
-
Schema5.Struct({
|
|
188
|
-
kind: Schema5.Literal("git"),
|
|
189
|
-
url: Schema5.String.check(Schema5.isMinLength(1)),
|
|
190
|
-
ref: Schema5.optionalKey(Schema5.String.check(Schema5.isMinLength(1)))
|
|
191
|
-
}),
|
|
192
|
-
Schema5.Struct({
|
|
193
|
-
kind: Schema5.Literal("url"),
|
|
194
|
-
url: Schema5.String.check(Schema5.isMinLength(1)),
|
|
195
|
-
sha256: Schema5.String.check(Schema5.isPattern(new RegExp("^[a-fA-F0-9]{64}$", "u")))
|
|
196
|
-
}),
|
|
197
|
-
Schema5.Struct({ kind: Schema5.Literal("local_path"), path: Schema5.String.check(Schema5.isMinLength(1)) })
|
|
198
|
-
]);
|
|
199
|
-
var McpServerTransport = Schema5.Union([
|
|
200
|
-
Schema5.Struct({
|
|
201
|
-
kind: Schema5.Literal("stdio"),
|
|
202
|
-
command: Schema5.String.check(Schema5.isMinLength(1)),
|
|
203
|
-
args: Schema5.optionalKey(Schema5.Array(Schema5.String)),
|
|
204
|
-
env: Schema5.optionalKey(Schema5.Record(Schema5.String, Schema5.String))
|
|
205
|
-
}),
|
|
206
|
-
Schema5.Struct({
|
|
207
|
-
kind: Schema5.Literal("streamable_http"),
|
|
208
|
-
url: Schema5.String.check(Schema5.isMinLength(1)),
|
|
209
|
-
headers: Schema5.optionalKey(Schema5.Record(Schema5.String, Schema5.String))
|
|
210
|
-
})
|
|
211
|
-
]);
|
|
212
|
-
var ProviderAuthRef = Schema5.Union([
|
|
213
|
-
Schema5.Struct({
|
|
214
|
-
provider: Schema5.String.check(Schema5.isMinLength(1)),
|
|
215
|
-
policy: AgentEnvironmentPolicy,
|
|
216
|
-
kind: Schema5.Literal("existing_harness_login"),
|
|
217
|
-
accountHint: Schema5.optionalKey(Schema5.String.check(Schema5.isMinLength(1)))
|
|
218
|
-
}),
|
|
219
|
-
Schema5.Struct({
|
|
220
|
-
provider: Schema5.String.check(Schema5.isMinLength(1)),
|
|
221
|
-
policy: AgentEnvironmentPolicy,
|
|
222
|
-
kind: Schema5.Literal("local_env"),
|
|
223
|
-
envName: Schema5.String.check(Schema5.isMinLength(1))
|
|
224
|
-
}),
|
|
225
|
-
Schema5.Struct({
|
|
226
|
-
provider: Schema5.String.check(Schema5.isMinLength(1)),
|
|
227
|
-
policy: AgentEnvironmentPolicy,
|
|
228
|
-
kind: Schema5.Literal("runner_secret"),
|
|
229
|
-
runnerSecretName: Schema5.String.check(Schema5.isMinLength(1))
|
|
230
|
-
}),
|
|
231
|
-
Schema5.Struct({
|
|
232
|
-
provider: Schema5.String.check(Schema5.isMinLength(1)),
|
|
233
|
-
policy: AgentEnvironmentPolicy,
|
|
234
|
-
kind: Schema5.Literal("managed_oauth"),
|
|
235
|
-
grantId: Schema5.optionalKey(Id)
|
|
236
|
-
})
|
|
237
|
-
]);
|
|
238
|
-
var RunnerSecretSource = Schema5.Union([
|
|
239
|
-
Schema5.Struct({ kind: Schema5.Literal("env"), envName: Schema5.String.check(Schema5.isMinLength(1)) }),
|
|
240
|
-
Schema5.Struct({ kind: Schema5.Literal("file"), pathRef: Schema5.String.check(Schema5.isMinLength(1)) }),
|
|
241
|
-
Schema5.Struct({ kind: Schema5.Literal("exec"), commandRef: Schema5.String.check(Schema5.isMinLength(1)) })
|
|
242
|
-
]);
|
|
243
|
-
var RunnerSecretRef = Schema5.Struct({
|
|
244
|
-
name: Schema5.String.check(Schema5.isMinLength(1)),
|
|
245
|
-
policy: AgentEnvironmentPolicy,
|
|
246
|
-
source: RunnerSecretSource,
|
|
247
|
-
capabilities: Schema5.optionalKey(Schema5.Array(Schema5.String.check(Schema5.isMinLength(1))))
|
|
248
|
-
});
|
|
249
|
-
var AgentSkillRequirement = Schema5.Struct({
|
|
250
|
-
name: Schema5.String.check(Schema5.isMinLength(1)),
|
|
251
|
-
policy: AgentEnvironmentPolicy,
|
|
252
|
-
source: SkillSource
|
|
253
|
-
});
|
|
254
|
-
var AgentPluginRequirement = Schema5.Struct({
|
|
255
|
-
name: Schema5.String.check(Schema5.isMinLength(1)),
|
|
256
|
-
policy: AgentEnvironmentPolicy,
|
|
257
|
-
sources: Schema5.NonEmptyArray(PluginSource)
|
|
258
|
-
});
|
|
259
|
-
var AgentMcpServerRequirement = Schema5.Struct({
|
|
260
|
-
name: Schema5.String.check(Schema5.isMinLength(1)),
|
|
261
|
-
policy: AgentEnvironmentPolicy,
|
|
262
|
-
transport: McpServerTransport
|
|
263
|
-
});
|
|
264
|
-
var AgentHarnessSetting = Schema5.Struct({
|
|
265
|
-
harness: AgentHarnessId,
|
|
266
|
-
key: Schema5.String.check(Schema5.isMinLength(1)),
|
|
267
|
-
policy: AgentEnvironmentPolicy,
|
|
268
|
-
value: Schema5.Unknown
|
|
269
|
-
});
|
|
270
|
-
var AgentRuntimeConstraint = Schema5.Struct({
|
|
271
|
-
key: Schema5.String.check(Schema5.isMinLength(1)),
|
|
272
|
-
policy: AgentEnvironmentPolicy,
|
|
273
|
-
value: Schema5.Unknown
|
|
274
|
-
});
|
|
275
|
-
var AgentPermissionRequirement = Schema5.Struct({
|
|
276
|
-
key: Schema5.String.check(Schema5.isMinLength(1)),
|
|
277
|
-
policy: AgentEnvironmentPolicy,
|
|
278
|
-
value: Schema5.Unknown
|
|
279
|
-
});
|
|
280
|
-
var AgentHookRequirement = Schema5.Struct({
|
|
281
|
-
name: Schema5.String.check(Schema5.isMinLength(1)),
|
|
282
|
-
event: Schema5.String.check(Schema5.isMinLength(1)),
|
|
283
|
-
policy: AgentEnvironmentPolicy,
|
|
284
|
-
command: Schema5.String.check(Schema5.isMinLength(1)),
|
|
285
|
-
args: Schema5.optionalKey(Schema5.Array(Schema5.String)),
|
|
286
|
-
timeoutMs: Schema5.optionalKey(Schema5.Finite.check(Schema5.isGreaterThanOrEqualTo(1)))
|
|
287
|
-
});
|
|
288
|
-
var AgentSandboxPolicyRequirement = Schema5.Struct({
|
|
289
|
-
key: Schema5.String.check(Schema5.isMinLength(1)),
|
|
290
|
-
policy: AgentEnvironmentPolicy,
|
|
291
|
-
value: Schema5.Unknown
|
|
292
|
-
});
|
|
293
|
-
var AgentEnvironmentFragment = Schema5.Struct({
|
|
294
|
-
skills: Schema5.optionalKey(Schema5.Array(AgentSkillRequirement)),
|
|
295
|
-
plugins: Schema5.optionalKey(Schema5.Array(AgentPluginRequirement)),
|
|
296
|
-
mcpServers: Schema5.optionalKey(Schema5.Array(AgentMcpServerRequirement)),
|
|
297
|
-
harnessSettings: Schema5.optionalKey(Schema5.Array(AgentHarnessSetting)),
|
|
298
|
-
providerAuthRefs: Schema5.optionalKey(Schema5.Array(ProviderAuthRef)),
|
|
299
|
-
runnerSecretRefs: Schema5.optionalKey(Schema5.Array(RunnerSecretRef)),
|
|
300
|
-
permissions: Schema5.optionalKey(Schema5.Array(AgentPermissionRequirement)),
|
|
301
|
-
hooks: Schema5.optionalKey(Schema5.Array(AgentHookRequirement)),
|
|
302
|
-
runtimeConstraints: Schema5.optionalKey(Schema5.Array(AgentRuntimeConstraint)),
|
|
303
|
-
sandboxPolicyRequirements: Schema5.optionalKey(Schema5.Array(AgentSandboxPolicyRequirement))
|
|
304
|
-
});
|
|
305
|
-
var HarnessKitActivation = Schema5.Struct({
|
|
306
|
-
harness: AgentHarnessId,
|
|
307
|
-
kitId: Id,
|
|
308
|
-
enabled: Schema5.Boolean,
|
|
309
|
-
policy: Schema5.optionalKey(AgentEnvironmentPolicy)
|
|
310
|
-
});
|
|
311
|
-
var AgentModelPreference = Schema5.Struct({
|
|
312
|
-
harness: AgentHarnessId,
|
|
313
|
-
profileRef: Schema5.String.check(Schema5.isMinLength(1)),
|
|
314
|
-
provider: Schema5.optionalKey(Schema5.String.check(Schema5.isMinLength(1))),
|
|
315
|
-
model: Schema5.optionalKey(Schema5.String.check(Schema5.isMinLength(1)))
|
|
316
|
-
});
|
|
317
|
-
var UserAgentPreferences = Schema5.Struct({
|
|
318
|
-
userId: Schema5.optionalKey(Id),
|
|
319
|
-
defaultHarness: Schema5.optionalKey(AgentHarnessId),
|
|
320
|
-
perHarnessKitActivations: Schema5.optionalKey(Schema5.Array(HarnessKitActivation)),
|
|
321
|
-
modelPreferences: Schema5.optionalKey(Schema5.Array(AgentModelPreference)),
|
|
322
|
-
providerAuthRefs: Schema5.optionalKey(Schema5.Array(ProviderAuthRef)),
|
|
323
|
-
ui: Schema5.optionalKey(Schema5.Record(Schema5.String, Schema5.Unknown)),
|
|
324
|
-
agentEnvironment: Schema5.optionalKey(AgentEnvironmentFragment)
|
|
325
|
-
});
|
|
326
|
-
var AgentSyncProfileSource = Schema5.Union([
|
|
327
|
-
Schema5.Struct({
|
|
328
|
-
kind: Schema5.Literal("personal_kit_defaults"),
|
|
329
|
-
harness: Schema5.optionalKey(AgentHarnessId),
|
|
330
|
-
enabled: Schema5.Boolean
|
|
331
|
-
}),
|
|
332
|
-
Schema5.Struct({ kind: Schema5.Literal("workspace_assignments"), workspaceId: Id, enabled: Schema5.Boolean }),
|
|
333
|
-
Schema5.Struct({
|
|
334
|
-
kind: Schema5.Literal("team_defaults"),
|
|
335
|
-
workspaceId: Id,
|
|
336
|
-
teamId: Schema5.optionalKey(Id),
|
|
337
|
-
enabled: Schema5.Boolean
|
|
338
|
-
}),
|
|
339
|
-
Schema5.Struct({ kind: Schema5.Literal("team_kits"), teamId: Id, enabled: Schema5.Boolean })
|
|
340
|
-
]);
|
|
341
|
-
var AgentSyncProfile = Schema5.Struct({
|
|
342
|
-
id: Schema5.optionalKey(Id),
|
|
343
|
-
userId: Id,
|
|
344
|
-
name: Schema5.String.check(Schema5.isMinLength(1)),
|
|
345
|
-
default: Schema5.optionalKey(Schema5.Boolean),
|
|
346
|
-
harnesses: Schema5.optionalKey(Schema5.Array(AgentHarnessId)),
|
|
347
|
-
sources: Schema5.Array(AgentSyncProfileSource)
|
|
348
|
-
});
|
|
349
|
-
var AgentKitSourceFields = {
|
|
350
|
-
kitRef: Schema5.optionalKey(Schema5.String.check(Schema5.isMinLength(1), Schema5.isMaxLength(240))),
|
|
351
|
-
kitVersion: Schema5.optionalKey(Schema5.String.check(Schema5.isMinLength(1), Schema5.isMaxLength(120))),
|
|
352
|
-
kitSha256: Schema5.optionalKey(Schema5.String.check(Schema5.isMinLength(64), Schema5.isMaxLength(64), Schema5.isPattern(new RegExp("^[a-fA-F0-9]{64}$", "u")))),
|
|
353
|
-
kitActivationId: Schema5.optionalKey(Id),
|
|
354
|
-
kitActivationType: Schema5.optionalKey(Schema5.String.check(Schema5.isMinLength(1), Schema5.isMaxLength(80)))
|
|
210
|
+
var KitName = Schema5.String.check(Schema5.isMinLength(1), Schema5.isMaxLength(214), Schema5.isPattern(new RegExp("^(@[a-z0-9-~][a-z0-9-._~]*/)?[a-z0-9-~][a-z0-9-._~]*$", "u")));
|
|
211
|
+
var KitDigest = Schema5.String.check(Schema5.isPattern(new RegExp("^[a-f0-9]{64}$", "u")));
|
|
212
|
+
var KitLayer = Schema5.Union([Schema5.Literal("team"), Schema5.Literal("workspace"), Schema5.Literal("shipped")]);
|
|
213
|
+
var KitProvenance = Schema5.Struct({
|
|
214
|
+
repository: Schema5.optionalKey(Schema5.String),
|
|
215
|
+
commit: Schema5.optionalKey(Schema5.String),
|
|
216
|
+
clean: Schema5.Boolean
|
|
217
|
+
});
|
|
218
|
+
var KitBundleUpload = Schema5.Struct({ bundle: Schema5.String.check(Schema5.isMinLength(1)) });
|
|
219
|
+
var kitBuild = {
|
|
220
|
+
name: KitName,
|
|
221
|
+
teamId: Schema5.optionalKey(Id),
|
|
222
|
+
digest: KitDigest,
|
|
223
|
+
declarations: Schema5.Record(Schema5.String, Schema5.Unknown),
|
|
224
|
+
protocolVersion: Schema5.Int.check(Schema5.isGreaterThanOrEqualTo(1)),
|
|
225
|
+
provenance: KitProvenance
|
|
355
226
|
};
|
|
356
|
-
var
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
227
|
+
var KitPlanRequest = Schema5.Struct(kitBuild);
|
|
228
|
+
var KitDeployRequest = Schema5.Struct({
|
|
229
|
+
...kitBuild,
|
|
230
|
+
expectedVersion: Schema5.Union([Schema5.Int.check(Schema5.isGreaterThanOrEqualTo(1)), Schema5.Null])
|
|
231
|
+
});
|
|
232
|
+
var { name: _name, teamId: _teamId, ...devBuild } = kitBuild;
|
|
233
|
+
var KitDevRequest = Schema5.Struct(devBuild);
|
|
234
|
+
var KitDevVersion = Schema5.Struct({ id: Id, digest: KitDigest, loops: Schema5.Array(Schema5.String) });
|
|
235
|
+
var KitChanges = Schema5.Struct({
|
|
236
|
+
created: Schema5.Array(Schema5.String),
|
|
237
|
+
changed: Schema5.Array(Schema5.String),
|
|
238
|
+
removed: Schema5.Array(Schema5.String)
|
|
239
|
+
});
|
|
240
|
+
var KitPlanConflict = Schema5.Union([
|
|
366
241
|
Schema5.Struct({
|
|
367
|
-
kind: Schema5.Literal("
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
label: Schema5.optionalKey(Schema5.String.check(Schema5.isMinLength(1)))
|
|
242
|
+
kind: Schema5.Literal("id_taken"),
|
|
243
|
+
resource: Schema5.Union([Schema5.Literal("loop"), Schema5.Literal("agent")]),
|
|
244
|
+
id: Schema5.String,
|
|
245
|
+
kit: Schema5.String
|
|
372
246
|
}),
|
|
247
|
+
Schema5.Struct({ kind: Schema5.Literal("not_for_team"), declaration: Schema5.String }),
|
|
373
248
|
Schema5.Struct({
|
|
374
|
-
kind: Schema5.Literal("
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
label: Schema5.optionalKey(Schema5.String.check(Schema5.isMinLength(1)))
|
|
249
|
+
kind: Schema5.Literal("schedule_team"),
|
|
250
|
+
key: Schema5.String,
|
|
251
|
+
problem: Schema5.Union([Schema5.Literal("missing"), Schema5.Literal("not_allowed"), Schema5.Literal("unknown")])
|
|
378
252
|
}),
|
|
379
253
|
Schema5.Struct({
|
|
380
|
-
kind: Schema5.Literal("
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
kind: Schema5.Literal("workspace_kit"),
|
|
385
|
-
kitId: Id,
|
|
386
|
-
...AgentKitSourceFields,
|
|
387
|
-
label: Schema5.optionalKey(Schema5.String.check(Schema5.isMinLength(1)))
|
|
388
|
-
}),
|
|
389
|
-
Schema5.Struct({
|
|
390
|
-
kind: Schema5.Literal("team_default_kit"),
|
|
391
|
-
teamId: Id,
|
|
392
|
-
kitId: Id,
|
|
393
|
-
...AgentKitSourceFields,
|
|
394
|
-
label: Schema5.optionalKey(Schema5.String.check(Schema5.isMinLength(1)))
|
|
395
|
-
}),
|
|
396
|
-
Schema5.Struct({
|
|
397
|
-
kind: Schema5.Literal("team_kit"),
|
|
398
|
-
kitId: Id,
|
|
399
|
-
...AgentKitSourceFields,
|
|
400
|
-
provenance: Schema5.optionalKey(Schema5.Union([
|
|
401
|
-
Schema5.Literal("explicit"),
|
|
402
|
-
Schema5.Literal("workspace_default"),
|
|
403
|
-
Schema5.Literal("workspace_mandatory")
|
|
404
|
-
])),
|
|
405
|
-
policyRevision: Schema5.optionalKey(Schema5.Int.check(Schema5.isGreaterThanOrEqualTo(1))),
|
|
406
|
-
label: Schema5.optionalKey(Schema5.String.check(Schema5.isMinLength(1)))
|
|
407
|
-
}),
|
|
408
|
-
Schema5.Struct({
|
|
409
|
-
kind: Schema5.Literal("marketplace_kit"),
|
|
410
|
-
kitSourceId: Id,
|
|
411
|
-
kitVersionId: Schema5.optionalKey(Id),
|
|
412
|
-
kitInstallationId: Schema5.optionalKey(Id),
|
|
413
|
-
kitActivationId: Schema5.optionalKey(Id),
|
|
414
|
-
label: Schema5.optionalKey(Schema5.String.check(Schema5.isMinLength(1)))
|
|
415
|
-
}),
|
|
416
|
-
Schema5.Struct({
|
|
417
|
-
kind: Schema5.Literal("step_attempt_override"),
|
|
418
|
-
stepAttemptId: Id,
|
|
419
|
-
label: Schema5.optionalKey(Schema5.String.check(Schema5.isMinLength(1)))
|
|
420
|
-
}),
|
|
421
|
-
Schema5.Struct({
|
|
422
|
-
kind: Schema5.Literal("command_override"),
|
|
423
|
-
label: Schema5.optionalKey(Schema5.String.check(Schema5.isMinLength(1)))
|
|
254
|
+
kind: Schema5.Literal("loop_unresolved"),
|
|
255
|
+
record: Schema5.Literal("schedule"),
|
|
256
|
+
key: Schema5.String,
|
|
257
|
+
loop: Schema5.String
|
|
424
258
|
})
|
|
425
259
|
]);
|
|
426
|
-
var
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
var
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
});
|
|
495
|
-
var
|
|
496
|
-
state: Schema5.Literals(KitMarketplaceAgentEnvironmentSyncStates),
|
|
497
|
-
agentEnvironment: AgentEnvironment,
|
|
498
|
-
effects: Schema5.Array(KitMarketplaceAgentEnvironmentEffect),
|
|
499
|
-
blockers: Schema5.Array(Schema5.String),
|
|
500
|
-
drift: Schema5.Array(Schema5.String)
|
|
501
|
-
});
|
|
502
|
-
var AgentEnvironmentSyncPlanStatuses = ["ready", "needs_apply", "blocked"];
|
|
503
|
-
var AgentEnvironmentSyncPlanItemKinds = [
|
|
504
|
-
"skill",
|
|
505
|
-
"plugin",
|
|
506
|
-
"mcp_server",
|
|
507
|
-
"harness_setting",
|
|
508
|
-
"provider_auth_ref",
|
|
509
|
-
"runner_secret_ref",
|
|
510
|
-
"permission",
|
|
511
|
-
"hook",
|
|
512
|
-
"runtime_constraint",
|
|
513
|
-
"sandbox_policy_requirement"
|
|
514
|
-
];
|
|
515
|
-
var AgentEnvironmentSyncPlanApplyModes = ["automatic", "manual", "verify_only"];
|
|
516
|
-
var AgentEnvironmentSyncPlanItem = Schema5.Struct({
|
|
517
|
-
kind: Schema5.Literals(AgentEnvironmentSyncPlanItemKinds),
|
|
518
|
-
name: Schema5.String.check(Schema5.isMinLength(1)),
|
|
519
|
-
policy: AgentEnvironmentPolicy,
|
|
520
|
-
source: AgentEnvironmentSource,
|
|
521
|
-
materializerRequirements: Schema5.Array(Schema5.Literals(KitMarketplaceAgentEnvironmentMaterializerRequirements)),
|
|
522
|
-
applyMode: Schema5.Literals(AgentEnvironmentSyncPlanApplyModes)
|
|
523
|
-
});
|
|
524
|
-
var AgentEnvironmentSyncPlan = Schema5.Struct({
|
|
525
|
-
status: Schema5.Literals(AgentEnvironmentSyncPlanStatuses),
|
|
526
|
-
targetHarness: AgentHarnessId,
|
|
527
|
-
agentEnvironment: AgentEnvironment,
|
|
528
|
-
items: Schema5.Array(AgentEnvironmentSyncPlanItem),
|
|
529
|
-
blockers: Schema5.Array(Schema5.String),
|
|
530
|
-
drift: Schema5.Array(Schema5.String)
|
|
531
|
-
});
|
|
532
|
-
|
|
533
|
-
// packages/core/src/kit.ts
|
|
534
|
-
import * as Schema6 from "effect/Schema";
|
|
535
|
-
import * as Struct6 from "effect/Struct";
|
|
536
|
-
var KitKinds = ["technology", "brand", "domain", "process", "other"];
|
|
537
|
-
var TeamKitProvenanceKinds = ["explicit", "workspace_default", "workspace_mandatory"];
|
|
538
|
-
var KitKind = Schema6.Union([
|
|
539
|
-
Schema6.Literal("technology"),
|
|
540
|
-
Schema6.Literal("brand"),
|
|
541
|
-
Schema6.Literal("domain"),
|
|
542
|
-
Schema6.Literal("process"),
|
|
543
|
-
Schema6.Literal("other")
|
|
544
|
-
]);
|
|
545
|
-
var Kit = Schema6.Struct({
|
|
546
|
-
id: Id,
|
|
547
|
-
workspaceId: Id,
|
|
548
|
-
name: Schema6.String,
|
|
549
|
-
slug: Slug,
|
|
550
|
-
kind: KitKind,
|
|
551
|
-
description: Schema6.optionalKey(Schema6.String),
|
|
552
|
-
contentMarkdown: Schema6.String,
|
|
553
|
-
metadata: Schema6.Record(Schema6.String, Schema6.Unknown),
|
|
554
|
-
teamAttachment: Schema6.optionalKey(Schema6.Struct({
|
|
555
|
-
provenance: Schema6.Literals(TeamKitProvenanceKinds),
|
|
556
|
-
workspaceKitAssignmentId: Schema6.optionalKey(Id),
|
|
557
|
-
policyRevision: Schema6.optionalKey(Schema6.Int.check(Schema6.isGreaterThanOrEqualTo(1))),
|
|
558
|
-
package: Schema6.optionalKey(Schema6.String)
|
|
559
|
-
})),
|
|
560
|
-
package: Schema6.optionalKey(Schema6.String),
|
|
561
|
-
agentEnvironment: Schema6.optionalKey(AgentEnvironmentFragment),
|
|
562
|
-
agentInstructions: Schema6.optionalKey(Schema6.String),
|
|
563
|
-
doNotDo: Schema6.optionalKey(Schema6.String),
|
|
564
|
-
createdAt: Timestamp,
|
|
565
|
-
updatedAt: Timestamp
|
|
566
|
-
});
|
|
567
|
-
var KitPublisherIdentity = Schema6.Struct({
|
|
568
|
-
name: Schema6.String.check(Schema6.isMinLength(1)),
|
|
569
|
-
type: Schema6.optionalKey(Schema6.Union([
|
|
570
|
-
Schema6.Literal("kitman"),
|
|
571
|
-
Schema6.Literal("workspace"),
|
|
572
|
-
Schema6.Literal("organization"),
|
|
573
|
-
Schema6.Literal("individual")
|
|
574
|
-
])),
|
|
575
|
-
url: Schema6.optionalKey(Schema6.String),
|
|
576
|
-
verified: Schema6.optionalKey(Schema6.Boolean)
|
|
577
|
-
});
|
|
578
|
-
var KitSourceType = Schema6.Union([
|
|
579
|
-
Schema6.Literal("hosted"),
|
|
580
|
-
Schema6.Literal("git"),
|
|
581
|
-
Schema6.Literal("package"),
|
|
582
|
-
Schema6.Literal("url"),
|
|
583
|
-
Schema6.Literal("skills_sh")
|
|
584
|
-
]);
|
|
585
|
-
var KitTrustStatus = Schema6.Union([
|
|
586
|
-
Schema6.Literal("unreviewed"),
|
|
587
|
-
Schema6.Literal("trusted"),
|
|
588
|
-
Schema6.Literal("reviewed"),
|
|
589
|
-
Schema6.Literal("rejected"),
|
|
590
|
-
Schema6.Literal("deprecated")
|
|
591
|
-
]);
|
|
592
|
-
var KitReviewStatus = Schema6.Union([
|
|
593
|
-
Schema6.Literal("pending"),
|
|
594
|
-
Schema6.Literal("approved"),
|
|
595
|
-
Schema6.Literal("rejected"),
|
|
596
|
-
Schema6.Literal("deprecated")
|
|
597
|
-
]);
|
|
598
|
-
var KitSourceVisibility = Schema6.Union([
|
|
599
|
-
Schema6.Literal("public"),
|
|
600
|
-
Schema6.Literal("organization"),
|
|
601
|
-
Schema6.Literal("workspace")
|
|
602
|
-
]);
|
|
603
|
-
var SpdxLicenseExpression = Schema6.String.check(Schema6.isMinLength(1), Schema6.isMaxLength(240), Schema6.isPattern(new RegExp("^[A-Za-z0-9][A-Za-z0-9.+:()\\-\\s]*$", "u")));
|
|
604
|
-
var KitLifecycleStatus = Schema6.Union([
|
|
605
|
-
Schema6.Literal("active"),
|
|
606
|
-
Schema6.Literal("deprecated"),
|
|
607
|
-
Schema6.Literal("rejected")
|
|
608
|
-
]);
|
|
609
|
-
var KitMarketplaceInstallState = Schema6.Union([
|
|
610
|
-
Schema6.Literal("not_installed"),
|
|
611
|
-
Schema6.Literal("installed"),
|
|
612
|
-
Schema6.Literal("active"),
|
|
613
|
-
Schema6.Literal("update_available")
|
|
614
|
-
]);
|
|
615
|
-
var KitMarketplaceRuntimeState = Schema6.Union([
|
|
616
|
-
Schema6.Literal("ready"),
|
|
617
|
-
Schema6.Literal("needs_sync"),
|
|
618
|
-
Schema6.Literal("proposal_required"),
|
|
619
|
-
Schema6.Literal("deprecated"),
|
|
620
|
-
Schema6.Literal("blocked")
|
|
621
|
-
]);
|
|
622
|
-
var KitMarketplaceLifecycleOperation = Schema6.Union([
|
|
623
|
-
Schema6.Literal("install"),
|
|
624
|
-
Schema6.Literal("activate"),
|
|
625
|
-
Schema6.Literal("update"),
|
|
626
|
-
Schema6.Literal("rollback"),
|
|
627
|
-
Schema6.Literal("disable"),
|
|
628
|
-
Schema6.Literal("uninstall")
|
|
629
|
-
]);
|
|
630
|
-
var KitCompatibility = Schema6.Struct({
|
|
631
|
-
harnesses: Schema6.optionalKey(Schema6.Array(Schema6.String)),
|
|
632
|
-
capabilities: Schema6.optionalKey(Schema6.Array(Schema6.String)),
|
|
633
|
-
minimumKitmanVersion: Schema6.optionalKey(Schema6.String),
|
|
634
|
-
runtimeRequirements: Schema6.optionalKey(Schema6.Array(Schema6.String))
|
|
635
|
-
});
|
|
636
|
-
var Sha2562 = Schema6.String.check(Schema6.isPattern(new RegExp("^[a-fA-F0-9]{64}$", "u")));
|
|
637
|
-
var SourcePath2 = Schema6.String.check(Schema6.isMinLength(1), Schema6.isPattern(new RegExp("^(?!/)(?!.*\\\\)(?!.*//)(?!.*(?:^|/)\\.\\.?($|/))(?!.*\\s).+$", "u")));
|
|
638
|
-
var HostedKitSourceProvenance = Schema6.Struct({
|
|
639
|
-
sourceType: Schema6.Literal("hosted"),
|
|
640
|
-
path: Schema6.optionalKey(SourcePath2),
|
|
641
|
-
sha256: Schema6.optionalKey(Sha2562)
|
|
642
|
-
});
|
|
643
|
-
var GitKitSourceProvenance = Schema6.Struct({
|
|
644
|
-
sourceType: Schema6.Literal("git"),
|
|
645
|
-
repositoryUrl: Schema6.String.check(Schema6.isMinLength(1)),
|
|
646
|
-
ref: Schema6.String.check(Schema6.isMinLength(1)),
|
|
647
|
-
path: Schema6.optionalKey(SourcePath2),
|
|
648
|
-
sha256: Schema6.optionalKey(Sha2562)
|
|
649
|
-
});
|
|
650
|
-
var PackageKitSourceProvenance = Schema6.Struct({
|
|
651
|
-
sourceType: Schema6.Literal("package"),
|
|
652
|
-
packageName: Schema6.String.check(Schema6.isMinLength(1)),
|
|
653
|
-
version: Schema6.String.check(Schema6.isMinLength(1)),
|
|
654
|
-
path: Schema6.optionalKey(SourcePath2),
|
|
655
|
-
sha256: Schema6.optionalKey(Sha2562)
|
|
656
|
-
});
|
|
657
|
-
var UrlKitSourceProvenance = Schema6.Struct({
|
|
658
|
-
sourceType: Schema6.Literal("url"),
|
|
659
|
-
url: Schema6.String.check(Schema6.isMinLength(1)),
|
|
660
|
-
sha256: Sha2562
|
|
661
|
-
});
|
|
662
|
-
var SkillsShKitSourceProvenance = Schema6.Struct({
|
|
663
|
-
sourceType: Schema6.Literal("skills_sh"),
|
|
664
|
-
skillsSlug: Schema6.String.check(Schema6.isMinLength(1)),
|
|
665
|
-
version: Schema6.optionalKey(Schema6.String.check(Schema6.isMinLength(1))),
|
|
666
|
-
sha256: Schema6.optionalKey(Sha2562)
|
|
667
|
-
});
|
|
668
|
-
var KitSourceProvenance = Schema6.Union([
|
|
669
|
-
HostedKitSourceProvenance,
|
|
670
|
-
GitKitSourceProvenance,
|
|
671
|
-
PackageKitSourceProvenance,
|
|
672
|
-
UrlKitSourceProvenance,
|
|
673
|
-
SkillsShKitSourceProvenance
|
|
674
|
-
]);
|
|
675
|
-
var KitSourceBase = Schema6.Struct({
|
|
676
|
-
id: Id,
|
|
677
|
-
workspaceId: Schema6.optionalKey(Id),
|
|
678
|
-
name: Schema6.String,
|
|
679
|
-
slug: Slug,
|
|
680
|
-
summary: Schema6.String,
|
|
681
|
-
publisher: KitPublisherIdentity,
|
|
682
|
-
visibility: KitSourceVisibility,
|
|
683
|
-
licenseExpression: Schema6.optionalKey(SpdxLicenseExpression),
|
|
684
|
-
tags: Schema6.Array(Schema6.String),
|
|
685
|
-
compatibleHarnesses: Schema6.Array(Schema6.String),
|
|
686
|
-
capabilitySummaries: Schema6.Array(Schema6.String),
|
|
687
|
-
trustStatus: KitTrustStatus,
|
|
688
|
-
reviewStatus: KitReviewStatus,
|
|
689
|
-
lifecycleStatus: KitLifecycleStatus,
|
|
690
|
-
installable: Schema6.Boolean,
|
|
691
|
-
createdAt: Timestamp,
|
|
692
|
-
updatedAt: Timestamp
|
|
693
|
-
});
|
|
694
|
-
var KitSource = Schema6.Union([
|
|
695
|
-
Schema6.Struct({
|
|
696
|
-
...KitSourceBase.fields,
|
|
697
|
-
...Schema6.Struct({ sourceType: Schema6.Literal("hosted"), provenance: HostedKitSourceProvenance }).fields
|
|
698
|
-
}),
|
|
699
|
-
Schema6.Struct({
|
|
700
|
-
...KitSourceBase.fields,
|
|
701
|
-
...Schema6.Struct({ sourceType: Schema6.Literal("git"), provenance: GitKitSourceProvenance }).fields
|
|
702
|
-
}),
|
|
703
|
-
Schema6.Struct({
|
|
704
|
-
...KitSourceBase.fields,
|
|
705
|
-
...Schema6.Struct({ sourceType: Schema6.Literal("package"), provenance: PackageKitSourceProvenance }).fields
|
|
706
|
-
}),
|
|
707
|
-
Schema6.Struct({
|
|
708
|
-
...KitSourceBase.fields,
|
|
709
|
-
...Schema6.Struct({ sourceType: Schema6.Literal("url"), provenance: UrlKitSourceProvenance }).fields
|
|
710
|
-
}),
|
|
711
|
-
Schema6.Struct({
|
|
712
|
-
...KitSourceBase.fields,
|
|
713
|
-
...Schema6.Struct({ sourceType: Schema6.Literal("skills_sh"), provenance: SkillsShKitSourceProvenance }).fields
|
|
714
|
-
})
|
|
715
|
-
]);
|
|
716
|
-
var KitVersion = Schema6.Struct({
|
|
717
|
-
id: Id,
|
|
718
|
-
kitSourceId: Id,
|
|
719
|
-
version: Schema6.String,
|
|
720
|
-
provenance: KitSourceProvenance,
|
|
721
|
-
contentKitId: Schema6.optionalKey(Id),
|
|
722
|
-
compatibility: KitCompatibility,
|
|
723
|
-
trustStatus: KitTrustStatus,
|
|
724
|
-
reviewStatus: KitReviewStatus,
|
|
725
|
-
lifecycleStatus: KitLifecycleStatus,
|
|
726
|
-
reviewMetadata: Schema6.Record(Schema6.String, Schema6.Unknown),
|
|
727
|
-
publishedAt: Schema6.optionalKey(Timestamp),
|
|
728
|
-
createdAt: Timestamp,
|
|
729
|
-
updatedAt: Timestamp
|
|
730
|
-
});
|
|
731
|
-
var KitInstallationScope = Schema6.Union([
|
|
732
|
-
Schema6.Literal("user"),
|
|
733
|
-
Schema6.Literal("workspace"),
|
|
734
|
-
Schema6.Literal("team")
|
|
735
|
-
]);
|
|
736
|
-
var KitInstallationBase = Schema6.Struct({
|
|
737
|
-
id: Id,
|
|
738
|
-
kitSourceId: Id,
|
|
739
|
-
scopeType: KitInstallationScope,
|
|
740
|
-
scopeId: Id,
|
|
741
|
-
trustStatus: KitTrustStatus,
|
|
742
|
-
reviewStatus: KitReviewStatus,
|
|
743
|
-
lifecycleStatus: KitLifecycleStatus,
|
|
744
|
-
installedByActorType: Schema6.optionalKey(Schema6.String),
|
|
745
|
-
installedByActorId: Schema6.optionalKey(Id),
|
|
746
|
-
enabled: Schema6.Boolean,
|
|
747
|
-
package: Schema6.optionalKey(Schema6.String),
|
|
748
|
-
createdAt: Timestamp,
|
|
749
|
-
updatedAt: Timestamp
|
|
750
|
-
});
|
|
751
|
-
var KitInstallation = Schema6.Union([
|
|
752
|
-
Schema6.Struct({
|
|
753
|
-
...KitInstallationBase.fields,
|
|
754
|
-
...Schema6.Struct({ pinned: Schema6.Literal(true), kitVersionId: Id }).fields
|
|
755
|
-
}),
|
|
756
|
-
Schema6.Struct({
|
|
757
|
-
...KitInstallationBase.fields,
|
|
758
|
-
...Schema6.Struct({ pinned: Schema6.Literal(false), kitVersionId: Schema6.optionalKey(Id) }).fields
|
|
759
|
-
})
|
|
760
|
-
]);
|
|
761
|
-
var KitRegistrySearchItem = Schema6.Struct({
|
|
762
|
-
id: Id,
|
|
763
|
-
name: Schema6.String,
|
|
764
|
-
slug: Slug,
|
|
765
|
-
summary: Schema6.String,
|
|
766
|
-
publisher: KitPublisherIdentity,
|
|
767
|
-
visibility: KitSourceVisibility,
|
|
768
|
-
licenseExpression: Schema6.optionalKey(SpdxLicenseExpression),
|
|
769
|
-
sourceType: KitSourceType,
|
|
770
|
-
versions: Schema6.Array(Schema6.String),
|
|
771
|
-
tags: Schema6.Array(Schema6.String),
|
|
772
|
-
compatibleHarnesses: Schema6.Array(Schema6.String),
|
|
773
|
-
capabilitySummaries: Schema6.Array(Schema6.String),
|
|
774
|
-
trustStatus: KitTrustStatus,
|
|
775
|
-
reviewStatus: KitReviewStatus,
|
|
776
|
-
lifecycleStatus: KitLifecycleStatus,
|
|
777
|
-
installable: Schema6.Boolean
|
|
778
|
-
});
|
|
779
|
-
var KitActivation = Schema6.Struct({
|
|
780
|
-
id: Id,
|
|
781
|
-
kitInstallationId: Id,
|
|
782
|
-
kitSourceId: Id,
|
|
783
|
-
kitVersionId: Schema6.optionalKey(Id),
|
|
784
|
-
scopeType: KitInstallationScope,
|
|
785
|
-
scopeId: Id,
|
|
786
|
-
activationType: Schema6.Union([
|
|
787
|
-
Schema6.Literal("workspace_default"),
|
|
788
|
-
Schema6.Literal("team_default"),
|
|
789
|
-
Schema6.Literal("team_attachment"),
|
|
790
|
-
Schema6.Literal("personal_default"),
|
|
791
|
-
Schema6.Literal("harness")
|
|
792
|
-
]),
|
|
793
|
-
active: Schema6.Boolean,
|
|
794
|
-
activeThrough: Schema6.optionalKey(Schema6.String),
|
|
795
|
-
metadata: Schema6.Record(Schema6.String, Schema6.Unknown),
|
|
796
|
-
createdAt: Timestamp,
|
|
797
|
-
updatedAt: Timestamp
|
|
798
|
-
});
|
|
799
|
-
var KitRegistrySearch = Schema6.Struct({
|
|
800
|
-
items: Schema6.Array(KitRegistrySearchItem)
|
|
801
|
-
});
|
|
802
|
-
var KitMarketplaceCatalogItem = Schema6.Struct({
|
|
803
|
-
id: Id,
|
|
804
|
-
name: Schema6.String,
|
|
805
|
-
slug: Slug,
|
|
806
|
-
summary: Schema6.String,
|
|
807
|
-
publisher: KitPublisherIdentity,
|
|
808
|
-
visibility: KitSourceVisibility,
|
|
809
|
-
licenseExpression: Schema6.optionalKey(SpdxLicenseExpression),
|
|
810
|
-
sourceType: KitSourceType,
|
|
811
|
-
trustStatus: KitTrustStatus,
|
|
812
|
-
reviewStatus: KitReviewStatus,
|
|
813
|
-
lifecycleStatus: KitLifecycleStatus,
|
|
814
|
-
installable: Schema6.Boolean,
|
|
815
|
-
latestVersion: Schema6.optionalKey(Schema6.String),
|
|
816
|
-
installedVersion: Schema6.optionalKey(Schema6.String),
|
|
817
|
-
installState: KitMarketplaceInstallState,
|
|
818
|
-
runtimeState: KitMarketplaceRuntimeState,
|
|
819
|
-
activeThrough: Schema6.optionalKey(Schema6.String),
|
|
820
|
-
compatibleHarnesses: Schema6.Array(Schema6.String),
|
|
821
|
-
capabilitySummaries: Schema6.Array(Schema6.String),
|
|
822
|
-
tags: Schema6.Array(Schema6.String),
|
|
823
|
-
installedByPackage: Schema6.optionalKey(Schema6.String)
|
|
824
|
-
});
|
|
825
|
-
var KitMarketplacePageInfo = Schema6.Struct({
|
|
826
|
-
hasNextPage: Schema6.Boolean,
|
|
827
|
-
endCursor: Schema6.optionalKey(Schema6.String.check(Schema6.isMinLength(1)))
|
|
828
|
-
});
|
|
829
|
-
var KitMarketplaceCatalog = Schema6.Struct({
|
|
830
|
-
items: Schema6.Array(KitMarketplaceCatalogItem).check(Schema6.isMaxLength(100)),
|
|
831
|
-
total: Schema6.Int.check(Schema6.isGreaterThanOrEqualTo(0)),
|
|
832
|
-
pageInfo: KitMarketplacePageInfo
|
|
833
|
-
});
|
|
834
|
-
var KitMarketplaceDetail = Schema6.Struct({
|
|
835
|
-
...KitMarketplaceCatalogItem.fields,
|
|
836
|
-
...Schema6.Struct({
|
|
837
|
-
provenance: KitSourceProvenance,
|
|
838
|
-
versions: Schema6.Array(KitVersion),
|
|
839
|
-
installations: Schema6.Array(KitInstallation),
|
|
840
|
-
activations: Schema6.Array(KitActivation)
|
|
841
|
-
}).fields
|
|
842
|
-
});
|
|
843
|
-
var KitMarketplaceCatalogValidator = guard(KitMarketplaceCatalog);
|
|
844
|
-
var KitMarketplaceDetailValidator = guard(KitMarketplaceDetail);
|
|
845
|
-
var KitMarketplacePreviewInput = Schema6.Struct({
|
|
846
|
-
operation: KitMarketplaceLifecycleOperation,
|
|
847
|
-
source: Schema6.String.check(Schema6.isMinLength(1)),
|
|
848
|
-
version: Schema6.optionalKey(Schema6.String.check(Schema6.isMinLength(1))),
|
|
849
|
-
scopeType: Schema6.optionalKey(KitInstallationScope),
|
|
850
|
-
scopeId: Schema6.optionalKey(Id),
|
|
851
|
-
activationType: Schema6.optionalKey(Schema6.Union([
|
|
852
|
-
Schema6.Literal("workspace_default"),
|
|
853
|
-
Schema6.Literal("team_default"),
|
|
854
|
-
Schema6.Literal("team_attachment"),
|
|
855
|
-
Schema6.Literal("personal_default"),
|
|
856
|
-
Schema6.Literal("harness")
|
|
857
|
-
]))
|
|
858
|
-
});
|
|
859
|
-
var KitMarketplaceSyncReadiness = Schema6.Struct({
|
|
860
|
-
state: Schema6.Union([Schema6.Literal("ready"), Schema6.Literal("needs_sync"), Schema6.Literal("blocked")]),
|
|
861
|
-
blockers: Schema6.Array(Schema6.String)
|
|
862
|
-
});
|
|
863
|
-
var KitMarketplacePreview = Schema6.Struct({
|
|
864
|
-
previewToken: Schema6.String.check(Schema6.isMinLength(1)),
|
|
865
|
-
operation: KitMarketplaceLifecycleOperation,
|
|
866
|
-
sourceId: Id,
|
|
867
|
-
sourceSlug: Slug,
|
|
868
|
-
scopeType: KitInstallationScope,
|
|
869
|
-
scopeId: Id,
|
|
870
|
-
fromVersion: Schema6.optionalKey(Schema6.String),
|
|
871
|
-
toVersion: Schema6.optionalKey(Schema6.String),
|
|
872
|
-
installState: KitMarketplaceInstallState,
|
|
873
|
-
runtimeState: KitMarketplaceRuntimeState,
|
|
874
|
-
contextImpact: Schema6.Array(Schema6.String),
|
|
875
|
-
agentEnvironmentEffects: Schema6.Array(Schema6.String),
|
|
876
|
-
activeThrough: Schema6.optionalKey(Schema6.String),
|
|
877
|
-
conflicts: Schema6.Array(Schema6.String),
|
|
878
|
-
warnings: Schema6.Array(Schema6.String),
|
|
879
|
-
syncReadiness: KitMarketplaceSyncReadiness,
|
|
880
|
-
requiresProposal: Schema6.Boolean
|
|
881
|
-
});
|
|
882
|
-
var KitMarketplaceApplyPreviewInput = Schema6.Struct({
|
|
883
|
-
...KitMarketplacePreviewInput.fields,
|
|
884
|
-
...Schema6.Struct({ previewToken: Schema6.String.check(Schema6.isMinLength(1)) }).fields
|
|
885
|
-
});
|
|
886
|
-
var KitMarketplaceLifecycleResult = Schema6.Struct({
|
|
887
|
-
status: Schema6.Union([
|
|
888
|
-
Schema6.Literal("installed"),
|
|
889
|
-
Schema6.Literal("activated"),
|
|
890
|
-
Schema6.Literal("updated"),
|
|
891
|
-
Schema6.Literal("rolled_back"),
|
|
892
|
-
Schema6.Literal("disabled"),
|
|
893
|
-
Schema6.Literal("uninstalled")
|
|
894
|
-
]),
|
|
895
|
-
previewToken: Schema6.String.check(Schema6.isMinLength(1)),
|
|
896
|
-
installation: Schema6.optionalKey(KitInstallation),
|
|
897
|
-
activation: Schema6.optionalKey(KitActivation),
|
|
898
|
-
syncReadiness: KitMarketplaceSyncReadiness
|
|
899
|
-
});
|
|
900
|
-
var KitCreate = Schema6.Struct({
|
|
901
|
-
name: Schema6.String.check(Schema6.isMinLength(1), Schema6.isMaxLength(160)),
|
|
902
|
-
slug: Schema6.optionalKey(Slug),
|
|
903
|
-
kind: Schema6.optionalKey(KitKind),
|
|
904
|
-
description: Schema6.optionalKey(Schema6.String),
|
|
905
|
-
contentMarkdown: Schema6.String.check(Schema6.isMinLength(1)),
|
|
906
|
-
metadata: Schema6.optionalKey(Schema6.Record(Schema6.String, Schema6.Unknown)),
|
|
907
|
-
agentEnvironment: Schema6.optionalKey(AgentEnvironmentFragment),
|
|
908
|
-
agentInstructions: Schema6.optionalKey(Schema6.String),
|
|
909
|
-
doNotDo: Schema6.optionalKey(Schema6.String)
|
|
910
|
-
});
|
|
911
|
-
var KitUpdate = Schema6.Struct(Struct6.map(KitCreate.fields, Schema6.optionalKey));
|
|
912
|
-
var KitDeleteResult = Schema6.Struct({ deleted: Schema6.Boolean });
|
|
913
|
-
var KitList = Schema6.Struct({
|
|
914
|
-
items: Schema6.Array(Kit),
|
|
915
|
-
policyOptOuts: Schema6.optionalKey(Schema6.Array(Schema6.Struct({
|
|
916
|
-
workspaceKitAssignmentId: Id,
|
|
917
|
-
kitId: Id,
|
|
918
|
-
policyRevision: Schema6.Int.check(Schema6.isGreaterThanOrEqualTo(1))
|
|
919
|
-
})))
|
|
920
|
-
});
|
|
921
|
-
var TeamKitAttachResult = Schema6.Struct({
|
|
922
|
-
status: Schema6.Union([Schema6.Literal("attached"), Schema6.Literal("already_attached")]),
|
|
923
|
-
teamId: Id,
|
|
924
|
-
kitId: Id
|
|
925
|
-
});
|
|
926
|
-
var TeamKitDetachResult = Schema6.Struct({
|
|
927
|
-
status: Schema6.Union([Schema6.Literal("detached"), Schema6.Literal("not_attached")]),
|
|
928
|
-
teamId: Id,
|
|
929
|
-
kitId: Id
|
|
930
|
-
});
|
|
931
|
-
var WorkspacePolicyKitMode = Schema6.Union([Schema6.Literal("default"), Schema6.Literal("mandatory")]);
|
|
932
|
-
var TeamKitProvenanceKind = Schema6.Union([
|
|
933
|
-
Schema6.Literal("explicit"),
|
|
934
|
-
Schema6.Literal("workspace_default"),
|
|
935
|
-
Schema6.Literal("workspace_mandatory")
|
|
936
|
-
]);
|
|
937
|
-
var WorkspacePolicyKitAssignment = Schema6.Struct({
|
|
938
|
-
id: Id,
|
|
939
|
-
workspaceId: Id,
|
|
940
|
-
kitId: Id,
|
|
941
|
-
mode: WorkspacePolicyKitMode,
|
|
942
|
-
revision: Schema6.Int.check(Schema6.isGreaterThanOrEqualTo(1)),
|
|
943
|
-
createdByActorType: Schema6.optionalKey(ActorType),
|
|
944
|
-
createdByActorId: Schema6.optionalKey(Id),
|
|
945
|
-
package: Schema6.optionalKey(Schema6.String),
|
|
946
|
-
createdAt: Timestamp,
|
|
947
|
-
updatedAt: Timestamp
|
|
948
|
-
});
|
|
949
|
-
var WorkspacePolicyKitAssignmentList = Schema6.Struct({
|
|
950
|
-
items: Schema6.Array(WorkspacePolicyKitAssignment)
|
|
951
|
-
});
|
|
952
|
-
var WorkspacePolicyKitCandidate = Schema6.Struct({
|
|
953
|
-
kitId: Id,
|
|
954
|
-
name: Schema6.String,
|
|
955
|
-
kind: KitKind,
|
|
956
|
-
trustStatus: KitTrustStatus,
|
|
957
|
-
installationState: Schema6.Literal("active")
|
|
958
|
-
});
|
|
959
|
-
var WorkspacePolicyKitCandidateList = Schema6.Struct({ items: Schema6.Array(WorkspacePolicyKitCandidate) });
|
|
960
|
-
var WorkspacePolicyKitAssignmentCreate = Schema6.Struct({
|
|
961
|
-
kitId: Id,
|
|
962
|
-
mode: WorkspacePolicyKitMode
|
|
963
|
-
});
|
|
964
|
-
var WorkspacePolicyKitAssignmentUpdate = Schema6.Struct({
|
|
965
|
-
mode: WorkspacePolicyKitMode,
|
|
966
|
-
expectedRevision: Schema6.Int.check(Schema6.isGreaterThanOrEqualTo(1))
|
|
967
|
-
});
|
|
968
|
-
var WorkspacePolicyKitAssignmentDelete = Schema6.Struct({
|
|
969
|
-
expectedRevision: Schema6.Int.check(Schema6.isGreaterThanOrEqualTo(1))
|
|
970
|
-
});
|
|
971
|
-
var WorkspacePolicyKitAssignmentDeleteResult = Schema6.Struct({
|
|
972
|
-
deleted: Schema6.Boolean,
|
|
973
|
-
assignmentId: Id
|
|
974
|
-
});
|
|
975
|
-
var TeamKitPolicyOverride = Schema6.Struct({
|
|
260
|
+
var OwnedRecordKind = Schema5.Literal("schedule");
|
|
261
|
+
var KitRecordChanges = Schema5.Struct({
|
|
262
|
+
created: Schema5.Array(Schema5.String),
|
|
263
|
+
changed: Schema5.Array(Schema5.String),
|
|
264
|
+
removed: Schema5.Array(Schema5.String),
|
|
265
|
+
adopted: Schema5.Array(Schema5.Struct({ key: Schema5.String, id: Schema5.String }))
|
|
266
|
+
});
|
|
267
|
+
var KitDrift = Schema5.Struct({
|
|
268
|
+
kind: OwnedRecordKind,
|
|
269
|
+
key: Schema5.String,
|
|
270
|
+
field: Schema5.String,
|
|
271
|
+
declared: Schema5.Unknown,
|
|
272
|
+
live: Schema5.Unknown,
|
|
273
|
+
changedBy: Schema5.optionalKey(Schema5.Struct({ actorType: Schema5.String, actorId: Schema5.String })),
|
|
274
|
+
changedAt: Schema5.optionalKey(Timestamp)
|
|
275
|
+
});
|
|
276
|
+
var KitPlanWarning = Schema5.Struct({
|
|
277
|
+
kind: Schema5.Literal("still_named"),
|
|
278
|
+
resource: Schema5.Union([Schema5.Literal("loop"), Schema5.Literal("agent")]),
|
|
279
|
+
id: Schema5.String,
|
|
280
|
+
record: Schema5.String
|
|
281
|
+
});
|
|
282
|
+
var KitPlanResult = Schema5.Struct({
|
|
283
|
+
name: KitName,
|
|
284
|
+
layer: KitLayer,
|
|
285
|
+
currentVersion: Schema5.Union([Schema5.Int.check(Schema5.isGreaterThanOrEqualTo(1)), Schema5.Null]),
|
|
286
|
+
currentCommit: Schema5.optionalKey(Schema5.String),
|
|
287
|
+
loops: KitChanges,
|
|
288
|
+
agents: KitChanges,
|
|
289
|
+
schedules: KitRecordChanges,
|
|
290
|
+
drift: Schema5.Array(KitDrift),
|
|
291
|
+
conflicts: Schema5.Array(KitPlanConflict),
|
|
292
|
+
warnings: Schema5.Array(KitPlanWarning),
|
|
293
|
+
secretsWithoutValue: Schema5.Array(Schema5.String)
|
|
294
|
+
});
|
|
295
|
+
var KitVersionSummary = Schema5.Struct({
|
|
296
|
+
number: Schema5.Int.check(Schema5.isGreaterThanOrEqualTo(1)),
|
|
297
|
+
digest: KitDigest,
|
|
298
|
+
protocolVersion: Schema5.Int.check(Schema5.isGreaterThanOrEqualTo(1)),
|
|
299
|
+
provenance: KitProvenance,
|
|
300
|
+
deployedByActorType: ActorType,
|
|
301
|
+
deployedByActorId: Schema5.String,
|
|
302
|
+
deployBindingId: Schema5.optionalKey(Id),
|
|
303
|
+
carried: Schema5.optionalKey(Schema5.Array(Schema5.Struct({ name: KitName, version: Schema5.String, setup: KitDigest }))),
|
|
304
|
+
deployedAt: Timestamp,
|
|
305
|
+
status: Schema5.Union([
|
|
306
|
+
Schema5.Literal("current"),
|
|
307
|
+
Schema5.Literal("superseded"),
|
|
308
|
+
Schema5.Literal("dev"),
|
|
309
|
+
Schema5.Literal("removed")
|
|
310
|
+
])
|
|
311
|
+
});
|
|
312
|
+
var kitFields = {
|
|
313
|
+
name: KitName,
|
|
314
|
+
layer: KitLayer,
|
|
315
|
+
teamId: Schema5.optionalKey(Id),
|
|
316
|
+
current: Schema5.optionalKey(KitVersionSummary),
|
|
317
|
+
loops: Schema5.Array(Schema5.String),
|
|
318
|
+
agents: Schema5.Array(Schema5.String)
|
|
319
|
+
};
|
|
320
|
+
var KitSummary = Schema5.Struct(kitFields);
|
|
321
|
+
var KitList = Schema5.Struct({ items: Schema5.Array(KitSummary) });
|
|
322
|
+
var KitDetail = Schema5.Struct({
|
|
323
|
+
...kitFields,
|
|
324
|
+
versions: Schema5.Array(KitVersionSummary),
|
|
325
|
+
schedules: Schema5.Array(Schema5.Struct({ key: Schema5.String, id: Id, name: Schema5.optionalKey(Schema5.String) })),
|
|
326
|
+
drift: Schema5.Array(KitDrift)
|
|
327
|
+
});
|
|
328
|
+
var KitScopeQuery = Schema5.Struct({ teamId: Schema5.optionalKey(Id) });
|
|
329
|
+
var DeployBinding = Schema5.Struct({
|
|
976
330
|
id: Id,
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
331
|
+
repoBindingId: Id,
|
|
332
|
+
repository: Schema5.String,
|
|
333
|
+
branch: Schema5.String.check(Schema5.isMinLength(1), Schema5.isMaxLength(255)),
|
|
334
|
+
kitName: KitName,
|
|
335
|
+
layer: KitLayer,
|
|
336
|
+
teamId: Schema5.optionalKey(Id),
|
|
337
|
+
createdByUserId: Schema5.String,
|
|
984
338
|
createdAt: Timestamp
|
|
985
339
|
});
|
|
986
|
-
var
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
expectedRevision: Schema6.Int.check(Schema6.isGreaterThanOrEqualTo(1))
|
|
992
|
-
});
|
|
993
|
-
var TeamKitPolicyOverrideDeleteResult = Schema6.Struct({
|
|
994
|
-
deleted: Schema6.Boolean,
|
|
995
|
-
teamId: Id,
|
|
996
|
-
workspaceKitAssignmentId: Id
|
|
997
|
-
});
|
|
998
|
-
var TeamPolicyKitConvergenceResult = Schema6.Struct({
|
|
999
|
-
teamId: Id,
|
|
1000
|
-
state: Schema6.Union([Schema6.Literal("current"), Schema6.Literal("degraded")]),
|
|
1001
|
-
highestPolicyRevision: Schema6.Int.check(Schema6.isGreaterThanOrEqualTo(0)),
|
|
1002
|
-
scanned: Schema6.Int.check(Schema6.isGreaterThanOrEqualTo(0), Schema6.isLessThanOrEqualTo(100)),
|
|
1003
|
-
applied: Schema6.Int.check(Schema6.isGreaterThanOrEqualTo(0), Schema6.isLessThanOrEqualTo(100)),
|
|
1004
|
-
replayed: Schema6.Int.check(Schema6.isGreaterThanOrEqualTo(0), Schema6.isLessThanOrEqualTo(100)),
|
|
1005
|
-
explicitAttachmentsPreserved: Schema6.Int.check(Schema6.isGreaterThanOrEqualTo(0), Schema6.isLessThanOrEqualTo(100)),
|
|
1006
|
-
hasMore: Schema6.Boolean,
|
|
1007
|
-
retry: Schema6.Boolean,
|
|
1008
|
-
repairAvailable: Schema6.Boolean,
|
|
1009
|
-
nextCursor: Schema6.optionalKey(Id)
|
|
1010
|
-
});
|
|
1011
|
-
var TeamPolicyKitConvergenceInput = Schema6.Struct({ cursor: Schema6.optionalKey(Id) });
|
|
1012
|
-
var WorkspacePolicyKitBackfillPreviewKinds = [
|
|
1013
|
-
"affected",
|
|
1014
|
-
"unchanged",
|
|
1015
|
-
"opted_out",
|
|
1016
|
-
"inaccessible",
|
|
1017
|
-
"conflict"
|
|
1018
|
-
];
|
|
1019
|
-
var WorkspacePolicyKitBackfillApplyStatuses = [
|
|
1020
|
-
"pending",
|
|
1021
|
-
"applied",
|
|
1022
|
-
"skipped",
|
|
1023
|
-
"conflict",
|
|
1024
|
-
"retryable_failure",
|
|
1025
|
-
"cancelled"
|
|
1026
|
-
];
|
|
1027
|
-
var WorkspacePolicyKitBackfillStates = ["previewed", "running", "partial", "completed", "cancelled"];
|
|
1028
|
-
var WorkspacePolicyKitBackfillPreviewKind = Schema6.Literals(WorkspacePolicyKitBackfillPreviewKinds);
|
|
1029
|
-
var WorkspacePolicyKitBackfillApplyStatus = Schema6.Literals(WorkspacePolicyKitBackfillApplyStatuses);
|
|
1030
|
-
var WorkspacePolicyKitBackfillState = Schema6.Literals(WorkspacePolicyKitBackfillStates);
|
|
1031
|
-
var WorkspacePolicyKitBackfillCounts = Schema6.Struct({
|
|
1032
|
-
affected: Schema6.Int.check(Schema6.isGreaterThanOrEqualTo(0)),
|
|
1033
|
-
unchanged: Schema6.Int.check(Schema6.isGreaterThanOrEqualTo(0)),
|
|
1034
|
-
optedOut: Schema6.Int.check(Schema6.isGreaterThanOrEqualTo(0)),
|
|
1035
|
-
inaccessible: Schema6.Int.check(Schema6.isGreaterThanOrEqualTo(0)),
|
|
1036
|
-
conflict: Schema6.Int.check(Schema6.isGreaterThanOrEqualTo(0)),
|
|
1037
|
-
pending: Schema6.Int.check(Schema6.isGreaterThanOrEqualTo(0)),
|
|
1038
|
-
applied: Schema6.Int.check(Schema6.isGreaterThanOrEqualTo(0)),
|
|
1039
|
-
skipped: Schema6.Int.check(Schema6.isGreaterThanOrEqualTo(0)),
|
|
1040
|
-
retryableFailure: Schema6.Int.check(Schema6.isGreaterThanOrEqualTo(0)),
|
|
1041
|
-
cancelled: Schema6.Int.check(Schema6.isGreaterThanOrEqualTo(0))
|
|
1042
|
-
});
|
|
1043
|
-
var WorkspacePolicyKitBackfillItem = Schema6.Struct({
|
|
1044
|
-
teamId: Id,
|
|
1045
|
-
teamName: Schema6.String,
|
|
1046
|
-
previewKind: WorkspacePolicyKitBackfillPreviewKind,
|
|
1047
|
-
applyStatus: WorkspacePolicyKitBackfillApplyStatus,
|
|
1048
|
-
attempts: Schema6.Int.check(Schema6.isGreaterThanOrEqualTo(0)),
|
|
1049
|
-
errorCode: Schema6.optionalKey(Schema6.String),
|
|
1050
|
-
errorMessage: Schema6.optionalKey(Schema6.String)
|
|
1051
|
-
});
|
|
1052
|
-
var WorkspacePolicyKitBackfillPage = Schema6.Struct({
|
|
1053
|
-
backfillId: Id,
|
|
1054
|
-
workspaceId: Id,
|
|
1055
|
-
policyRevision: Schema6.Int.check(Schema6.isGreaterThanOrEqualTo(0)),
|
|
1056
|
-
previewToken: Schema6.String.check(Schema6.isMinLength(1)),
|
|
1057
|
-
state: WorkspacePolicyKitBackfillState,
|
|
1058
|
-
counts: WorkspacePolicyKitBackfillCounts,
|
|
1059
|
-
items: Schema6.Array(WorkspacePolicyKitBackfillItem).check(Schema6.isMaxLength(100)),
|
|
1060
|
-
hasMore: Schema6.Boolean,
|
|
1061
|
-
nextCursor: Schema6.optionalKey(Id),
|
|
1062
|
-
createdAt: Timestamp,
|
|
1063
|
-
updatedAt: Timestamp
|
|
1064
|
-
});
|
|
1065
|
-
var WorkspacePolicyKitBackfillPreviewInput = Schema6.Struct({
|
|
1066
|
-
limit: Schema6.optionalKey(Schema6.Int.check(Schema6.isGreaterThanOrEqualTo(1), Schema6.isLessThanOrEqualTo(100))),
|
|
1067
|
-
cursor: Schema6.optionalKey(Id)
|
|
1068
|
-
});
|
|
1069
|
-
var WorkspacePolicyKitBackfillApplyInput = Schema6.Struct({
|
|
1070
|
-
previewToken: Schema6.String.check(Schema6.isMinLength(1)),
|
|
1071
|
-
limit: Schema6.optionalKey(Schema6.Int.check(Schema6.isGreaterThanOrEqualTo(1), Schema6.isLessThanOrEqualTo(100))),
|
|
1072
|
-
cursor: Schema6.optionalKey(Id)
|
|
1073
|
-
});
|
|
1074
|
-
var WorkspacePolicyKitBackfillStatusQuery = Schema6.Struct({
|
|
1075
|
-
limit: Schema6.optionalKey(Numeric.check(isWholeNumber, Schema6.isGreaterThanOrEqualTo(1), Schema6.isLessThanOrEqualTo(100))),
|
|
1076
|
-
cursor: Schema6.optionalKey(Id)
|
|
1077
|
-
});
|
|
1078
|
-
var WorkspacePolicyKitBackfillCancelResult = Schema6.Struct({
|
|
1079
|
-
backfillId: Id,
|
|
1080
|
-
state: Schema6.Literal("cancelled")
|
|
340
|
+
var DeployBindingCreate = Schema5.Struct({
|
|
341
|
+
repoBindingId: Id,
|
|
342
|
+
branch: Schema5.String.check(Schema5.isMinLength(1), Schema5.isMaxLength(255)),
|
|
343
|
+
kitName: KitName,
|
|
344
|
+
teamId: Schema5.optionalKey(Id)
|
|
1081
345
|
});
|
|
346
|
+
var DeployBindingList = Schema5.Struct({ items: Schema5.Array(DeployBinding) });
|
|
1082
347
|
|
|
1083
348
|
// packages/core/src/loop-layers.ts
|
|
1084
349
|
var LoopLayers = ["team", "workspace", "shipped"];
|
|
1085
350
|
var AgentEfforts = ["low", "medium", "high", "xhigh"];
|
|
351
|
+
var AgentCapabilities = ["web", "subagents", "artifacts", "browser"];
|
|
1086
352
|
|
|
1087
353
|
// packages/core/src/loop.ts
|
|
1088
354
|
import * as Effect from "effect/Effect";
|
|
1089
355
|
import * as Schema12 from "effect/Schema";
|
|
1090
356
|
|
|
1091
357
|
// packages/core/src/context-pack.ts
|
|
1092
|
-
import * as
|
|
358
|
+
import * as Schema6 from "effect/Schema";
|
|
1093
359
|
var ContextPackIndexEntryKinds = [
|
|
1094
360
|
"task",
|
|
1095
361
|
"team",
|
|
@@ -1116,162 +382,162 @@ var ContextPackRetrievalRefKinds = [
|
|
|
1116
382
|
"agent_environment",
|
|
1117
383
|
"loop_step"
|
|
1118
384
|
];
|
|
1119
|
-
var ContextPackMode =
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
385
|
+
var ContextPackMode = Schema6.Union([
|
|
386
|
+
Schema6.Literal("planning"),
|
|
387
|
+
Schema6.Literal("implementation"),
|
|
388
|
+
Schema6.Literal("debugging"),
|
|
389
|
+
Schema6.Literal("review"),
|
|
390
|
+
Schema6.Literal("handoff")
|
|
1125
391
|
]);
|
|
1126
|
-
var ContextPackIndexEntryKind =
|
|
1127
|
-
var ContextPackRetrievalRefKind =
|
|
1128
|
-
var ContextPackLaunchBrief =
|
|
392
|
+
var ContextPackIndexEntryKind = Schema6.Literals(ContextPackIndexEntryKinds);
|
|
393
|
+
var ContextPackRetrievalRefKind = Schema6.Literals(ContextPackRetrievalRefKinds);
|
|
394
|
+
var ContextPackLaunchBrief = Schema6.Struct({
|
|
1129
395
|
mode: ContextPackMode,
|
|
1130
|
-
taskTitle:
|
|
1131
|
-
teamName:
|
|
1132
|
-
summary:
|
|
396
|
+
taskTitle: Schema6.String.check(Schema6.isMinLength(1)),
|
|
397
|
+
teamName: Schema6.optionalKey(Schema6.String.check(Schema6.isMinLength(1))),
|
|
398
|
+
summary: Schema6.String.check(Schema6.isMinLength(1))
|
|
1133
399
|
});
|
|
1134
|
-
var ContextPackIndexEntry =
|
|
400
|
+
var ContextPackIndexEntry = Schema6.Struct({
|
|
1135
401
|
kind: ContextPackIndexEntryKind,
|
|
1136
402
|
id: Id,
|
|
1137
|
-
title:
|
|
1138
|
-
reason:
|
|
403
|
+
title: Schema6.String.check(Schema6.isMinLength(1)),
|
|
404
|
+
reason: Schema6.String.check(Schema6.isMinLength(1))
|
|
1139
405
|
});
|
|
1140
|
-
var ContextPackRetrievalRef =
|
|
406
|
+
var ContextPackRetrievalRef = Schema6.Struct({
|
|
1141
407
|
kind: ContextPackRetrievalRefKind,
|
|
1142
408
|
id: Id,
|
|
1143
|
-
label:
|
|
1144
|
-
});
|
|
1145
|
-
var ContextPackReadinessEvidence =
|
|
1146
|
-
scopeAvailable:
|
|
1147
|
-
acceptanceCriteriaAvailable:
|
|
1148
|
-
dependenciesSatisfied:
|
|
1149
|
-
executionPlanAvailable:
|
|
1150
|
-
repoBindingAvailable:
|
|
1151
|
-
verificationCommands:
|
|
1152
|
-
deliveryTargetAvailable:
|
|
1153
|
-
});
|
|
1154
|
-
var ContextPackRelevanceSummary =
|
|
1155
|
-
included:
|
|
1156
|
-
omitted:
|
|
1157
|
-
notes:
|
|
1158
|
-
readiness:
|
|
1159
|
-
});
|
|
1160
|
-
var ContextPackBudget =
|
|
1161
|
-
maxMarkdownChars:
|
|
1162
|
-
markdownChars:
|
|
1163
|
-
indexedItemCount:
|
|
1164
|
-
retrievalRefCount:
|
|
1165
|
-
});
|
|
1166
|
-
var ContextPack =
|
|
409
|
+
label: Schema6.String.check(Schema6.isMinLength(1))
|
|
410
|
+
});
|
|
411
|
+
var ContextPackReadinessEvidence = Schema6.Struct({
|
|
412
|
+
scopeAvailable: Schema6.Boolean,
|
|
413
|
+
acceptanceCriteriaAvailable: Schema6.Boolean,
|
|
414
|
+
dependenciesSatisfied: Schema6.Boolean,
|
|
415
|
+
executionPlanAvailable: Schema6.Boolean,
|
|
416
|
+
repoBindingAvailable: Schema6.Boolean,
|
|
417
|
+
verificationCommands: Schema6.Array(Schema6.String.check(Schema6.isMinLength(1), Schema6.isMaxLength(500))).check(Schema6.isMaxLength(50)),
|
|
418
|
+
deliveryTargetAvailable: Schema6.Boolean
|
|
419
|
+
});
|
|
420
|
+
var ContextPackRelevanceSummary = Schema6.Struct({
|
|
421
|
+
included: Schema6.Array(Schema6.String.check(Schema6.isMinLength(1))),
|
|
422
|
+
omitted: Schema6.Array(Schema6.String.check(Schema6.isMinLength(1))),
|
|
423
|
+
notes: Schema6.Array(Schema6.String.check(Schema6.isMinLength(1))),
|
|
424
|
+
readiness: Schema6.optionalKey(ContextPackReadinessEvidence)
|
|
425
|
+
});
|
|
426
|
+
var ContextPackBudget = Schema6.Struct({
|
|
427
|
+
maxMarkdownChars: Schema6.Int.check(Schema6.isGreaterThanOrEqualTo(1)),
|
|
428
|
+
markdownChars: Schema6.Int.check(Schema6.isGreaterThanOrEqualTo(0)),
|
|
429
|
+
indexedItemCount: Schema6.Int.check(Schema6.isGreaterThanOrEqualTo(0)),
|
|
430
|
+
retrievalRefCount: Schema6.Int.check(Schema6.isGreaterThanOrEqualTo(0))
|
|
431
|
+
});
|
|
432
|
+
var ContextPack = Schema6.Struct({
|
|
1167
433
|
contextPackId: Id,
|
|
1168
434
|
workspaceId: Id,
|
|
1169
|
-
teamId:
|
|
435
|
+
teamId: Schema6.optionalKey(Id),
|
|
1170
436
|
taskId: Id,
|
|
1171
437
|
mode: ContextPackMode,
|
|
1172
|
-
contentMarkdown:
|
|
438
|
+
contentMarkdown: Schema6.String.check(Schema6.isMinLength(1)),
|
|
1173
439
|
launchBrief: ContextPackLaunchBrief,
|
|
1174
|
-
contextIndex:
|
|
1175
|
-
retrievalRefs:
|
|
440
|
+
contextIndex: Schema6.Array(ContextPackIndexEntry),
|
|
441
|
+
retrievalRefs: Schema6.Array(ContextPackRetrievalRef),
|
|
1176
442
|
relevanceSummary: ContextPackRelevanceSummary,
|
|
1177
443
|
budget: ContextPackBudget,
|
|
1178
|
-
includedKitIds:
|
|
1179
|
-
includedMemoryIds:
|
|
1180
|
-
includedDecisionIds:
|
|
1181
|
-
includedProposalIds:
|
|
1182
|
-
includedSessionIds:
|
|
444
|
+
includedKitIds: Schema6.Array(Id),
|
|
445
|
+
includedMemoryIds: Schema6.Array(Id),
|
|
446
|
+
includedDecisionIds: Schema6.Array(Id),
|
|
447
|
+
includedProposalIds: Schema6.Array(Id),
|
|
448
|
+
includedSessionIds: Schema6.Array(Id),
|
|
1183
449
|
createdByActorType: ActorType,
|
|
1184
450
|
createdByActorId: Id,
|
|
1185
451
|
createdAt: Timestamp
|
|
1186
452
|
});
|
|
1187
|
-
var ContextPackGenerate =
|
|
1188
|
-
mode:
|
|
453
|
+
var ContextPackGenerate = Schema6.Struct({
|
|
454
|
+
mode: Schema6.optionalKey(ContextPackMode)
|
|
1189
455
|
});
|
|
1190
|
-
var ContextPackLatestQuery =
|
|
1191
|
-
mode:
|
|
456
|
+
var ContextPackLatestQuery = Schema6.Struct({
|
|
457
|
+
mode: Schema6.optionalKey(ContextPackMode)
|
|
1192
458
|
});
|
|
1193
|
-
var ContextPackResult =
|
|
459
|
+
var ContextPackResult = Schema6.Struct({
|
|
1194
460
|
contextPackId: Id,
|
|
1195
461
|
mode: ContextPackMode,
|
|
1196
|
-
contentMarkdown:
|
|
1197
|
-
launchBrief:
|
|
1198
|
-
contextIndex:
|
|
1199
|
-
retrievalRefs:
|
|
1200
|
-
relevanceSummary:
|
|
1201
|
-
budget:
|
|
1202
|
-
includedDecisionIds:
|
|
1203
|
-
includedProposalIds:
|
|
1204
|
-
});
|
|
1205
|
-
var ContextPackRetrievalInput =
|
|
462
|
+
contentMarkdown: Schema6.String.check(Schema6.isMinLength(1)),
|
|
463
|
+
launchBrief: Schema6.optionalKey(ContextPackLaunchBrief),
|
|
464
|
+
contextIndex: Schema6.optionalKey(Schema6.Array(ContextPackIndexEntry)),
|
|
465
|
+
retrievalRefs: Schema6.optionalKey(Schema6.Array(ContextPackRetrievalRef)),
|
|
466
|
+
relevanceSummary: Schema6.optionalKey(ContextPackRelevanceSummary),
|
|
467
|
+
budget: Schema6.optionalKey(ContextPackBudget),
|
|
468
|
+
includedDecisionIds: Schema6.optionalKey(Schema6.Array(Id)),
|
|
469
|
+
includedProposalIds: Schema6.optionalKey(Schema6.Array(Id))
|
|
470
|
+
});
|
|
471
|
+
var ContextPackRetrievalInput = Schema6.Struct({
|
|
1206
472
|
contextPackId: Id,
|
|
1207
473
|
ref: ContextPackRetrievalRef
|
|
1208
474
|
});
|
|
1209
|
-
var ContextPackRetrievedContext =
|
|
475
|
+
var ContextPackRetrievedContext = Schema6.Struct({
|
|
1210
476
|
contextPackId: Id,
|
|
1211
477
|
ref: ContextPackRetrievalRef,
|
|
1212
|
-
contentMarkdown:
|
|
1213
|
-
safety:
|
|
1214
|
-
rawContentIncluded:
|
|
1215
|
-
notes:
|
|
478
|
+
contentMarkdown: Schema6.String.check(Schema6.isMinLength(1)),
|
|
479
|
+
safety: Schema6.Struct({
|
|
480
|
+
rawContentIncluded: Schema6.Boolean,
|
|
481
|
+
notes: Schema6.Array(Schema6.String.check(Schema6.isMinLength(1)))
|
|
1216
482
|
})
|
|
1217
483
|
});
|
|
1218
484
|
|
|
1219
485
|
// packages/core/src/extension.ts
|
|
1220
|
-
import * as
|
|
486
|
+
import * as Schema9 from "effect/Schema";
|
|
1221
487
|
|
|
1222
488
|
// packages/core/src/run.ts
|
|
1223
|
-
import * as
|
|
489
|
+
import * as Schema8 from "effect/Schema";
|
|
1224
490
|
|
|
1225
491
|
// packages/core/src/redaction.ts
|
|
1226
|
-
import * as
|
|
492
|
+
import * as Schema7 from "effect/Schema";
|
|
1227
493
|
import * as Data from "effect/Data";
|
|
1228
494
|
var EvidenceRefContractVersion = "evidence-ref.v1";
|
|
1229
|
-
var RedactionClassificationSchema =
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
495
|
+
var RedactionClassificationSchema = Schema7.Union([
|
|
496
|
+
Schema7.Literal("secret"),
|
|
497
|
+
Schema7.Literal("credential"),
|
|
498
|
+
Schema7.Literal("pii"),
|
|
499
|
+
Schema7.Literal("source"),
|
|
500
|
+
Schema7.Literal("log"),
|
|
501
|
+
Schema7.Literal("diff"),
|
|
502
|
+
Schema7.Literal("transcript"),
|
|
503
|
+
Schema7.Literal("provider_payload"),
|
|
504
|
+
Schema7.Literal("url"),
|
|
505
|
+
Schema7.Literal("path"),
|
|
506
|
+
Schema7.Literal("unknown")
|
|
1241
507
|
]);
|
|
1242
|
-
var RedactionFindingSchema =
|
|
1243
|
-
path:
|
|
508
|
+
var RedactionFindingSchema = Schema7.Struct({
|
|
509
|
+
path: Schema7.String.check(Schema7.isMinLength(1), Schema7.isMaxLength(512)),
|
|
1244
510
|
classification: RedactionClassificationSchema,
|
|
1245
|
-
rule:
|
|
1246
|
-
preview:
|
|
1247
|
-
sha256:
|
|
1248
|
-
});
|
|
1249
|
-
var EvidenceRef =
|
|
1250
|
-
contractVersion:
|
|
1251
|
-
kind:
|
|
1252
|
-
summary:
|
|
1253
|
-
sha256:
|
|
1254
|
-
redaction:
|
|
1255
|
-
findingCount:
|
|
1256
|
-
classifications:
|
|
511
|
+
rule: Schema7.String.check(Schema7.isMinLength(1), Schema7.isMaxLength(120)),
|
|
512
|
+
preview: Schema7.String.check(Schema7.isMaxLength(160)),
|
|
513
|
+
sha256: Schema7.String.check(Schema7.isPattern(new RegExp("^[a-f0-9]{64}$", "u")))
|
|
514
|
+
});
|
|
515
|
+
var EvidenceRef = Schema7.Struct({
|
|
516
|
+
contractVersion: Schema7.Literal(EvidenceRefContractVersion),
|
|
517
|
+
kind: Schema7.String.check(Schema7.isMinLength(1), Schema7.isMaxLength(80)),
|
|
518
|
+
summary: Schema7.String.check(Schema7.isMinLength(1), Schema7.isMaxLength(240)),
|
|
519
|
+
sha256: Schema7.String.check(Schema7.isPattern(new RegExp("^[a-f0-9]{64}$", "u"))),
|
|
520
|
+
redaction: Schema7.Literal("redacted"),
|
|
521
|
+
findingCount: Schema7.Int.check(Schema7.isGreaterThanOrEqualTo(0)),
|
|
522
|
+
classifications: Schema7.Array(RedactionClassificationSchema).check(Schema7.isMaxLength(20))
|
|
1257
523
|
});
|
|
1258
524
|
var RedactionSurfaceKinds = ["api", "mcp", "cli", "web", "event", "log", "evidence", "export"];
|
|
1259
|
-
var RedactionSurfaceKindSchema =
|
|
1260
|
-
var RedactionWaiver =
|
|
1261
|
-
contractVersion:
|
|
1262
|
-
id:
|
|
1263
|
-
workspaceId:
|
|
1264
|
-
findingId:
|
|
1265
|
-
reason:
|
|
1266
|
-
authorityActorType:
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
525
|
+
var RedactionSurfaceKindSchema = Schema7.Literals(RedactionSurfaceKinds);
|
|
526
|
+
var RedactionWaiver = Schema7.Struct({
|
|
527
|
+
contractVersion: Schema7.Literal("redaction-waiver.v1"),
|
|
528
|
+
id: Schema7.String.check(Schema7.isMinLength(1)),
|
|
529
|
+
workspaceId: Schema7.String.check(Schema7.isMinLength(1)),
|
|
530
|
+
findingId: Schema7.String.check(Schema7.isMinLength(1)),
|
|
531
|
+
reason: Schema7.String.check(Schema7.isMinLength(1), Schema7.isMaxLength(1000)),
|
|
532
|
+
authorityActorType: Schema7.Union([
|
|
533
|
+
Schema7.Literal("human"),
|
|
534
|
+
Schema7.Literal("delegated_agent"),
|
|
535
|
+
Schema7.Literal("agent")
|
|
1270
536
|
]),
|
|
1271
|
-
authorityActorId:
|
|
1272
|
-
authorityRole:
|
|
1273
|
-
expiresAt:
|
|
1274
|
-
createdAt:
|
|
537
|
+
authorityActorId: Schema7.String.check(Schema7.isMinLength(1)),
|
|
538
|
+
authorityRole: Schema7.Union([Schema7.Literal("owner"), Schema7.Literal("admin")]),
|
|
539
|
+
expiresAt: Schema7.optionalKey(Schema7.String.check(isDateTime)),
|
|
540
|
+
createdAt: Schema7.String.check(isDateTime)
|
|
1275
541
|
});
|
|
1276
542
|
class DurableSurfaceScanError extends Data.TaggedError("DurableSurfaceScanError") {
|
|
1277
543
|
constructor(findings) {
|
|
@@ -1321,7 +587,7 @@ var LOCAL_PATH_KEYS = new Set([
|
|
|
1321
587
|
]);
|
|
1322
588
|
var VALUE_RULES = [
|
|
1323
589
|
["secret", /-----BEGIN (?:RSA |EC |OPENSSH )?PRIVATE KEY-----/u, "private-key"],
|
|
1324
|
-
["credential", /\bBearer\s+[A-Za-z0-9._~+/-]+=*/iu, "bearer-token"],
|
|
590
|
+
["credential", /\bBearer\s+(?=[A-Za-z]*(?:[0-9]|[._~+/-][A-Za-z0-9]))[A-Za-z0-9._~+/-]+=*/iu, "bearer-token"],
|
|
1325
591
|
[
|
|
1326
592
|
"credential",
|
|
1327
593
|
/(?:^|[^A-Za-z0-9])(?:ghp_|github_pat_|glpat-|ksa1\.|sk-[A-Za-z0-9_-]{8,}|xox[baprs]-)[A-Za-z0-9._-]+/u,
|
|
@@ -1342,115 +608,121 @@ var VALUE_RULES = [
|
|
|
1342
608
|
["log", /(?:^|\n)\s*\d{4}-\d{2}-\d{2}T\S+\s+(?:ERROR|WARN|INFO|DEBUG)\b/u, "structured-log"],
|
|
1343
609
|
["transcript", /(?:^|\n)\s*(?:user|assistant|system)\s*:/iu, "transcript-content"]
|
|
1344
610
|
];
|
|
611
|
+
var credentialUrl = /\b(?:https?|ftp):\/\/(?:[^\s/?#]*@|[^\s?#]*\?)[^\s]*/iu;
|
|
612
|
+
var keptClassifications = new Set(["secret", "credential", "unknown"]);
|
|
1345
613
|
var normalizedKeys = new Map;
|
|
1346
614
|
var CREDENTIAL_RULES = VALUE_RULES.flatMap(([classification, pattern]) => classification === "secret" || classification === "credential" ? [[classification, new RegExp(pattern.source, `${pattern.flags}g`)]] : []);
|
|
615
|
+
var RESPONSE_RULES = [
|
|
616
|
+
...CREDENTIAL_RULES,
|
|
617
|
+
["url", new RegExp(credentialUrl.source, "giu")]
|
|
618
|
+
];
|
|
1347
619
|
|
|
1348
620
|
// packages/core/src/run.ts
|
|
1349
|
-
var RunContractVersion =
|
|
1350
|
-
var ImmutableExecutionClosureContractVersion =
|
|
1351
|
-
var
|
|
1352
|
-
var BoundedText =
|
|
1353
|
-
var SafeKey =
|
|
1354
|
-
var SafeJson =
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
621
|
+
var RunContractVersion = Schema8.Literal("run.v1");
|
|
622
|
+
var ImmutableExecutionClosureContractVersion = Schema8.Literal("immutable-execution-closure.v1");
|
|
623
|
+
var Sha256 = Schema8.String.check(Schema8.isPattern(new RegExp("^[a-f0-9]{64}$", "u")));
|
|
624
|
+
var BoundedText = Schema8.String.check(Schema8.isMinLength(1), Schema8.isMaxLength(4000));
|
|
625
|
+
var SafeKey = Schema8.String.check(Schema8.isMinLength(1), Schema8.isMaxLength(120), Schema8.isPattern(new RegExp("^[A-Za-z][A-Za-z0-9_-]*$", "u")));
|
|
626
|
+
var SafeJson = Schema8.Union([
|
|
627
|
+
Schema8.Null,
|
|
628
|
+
Schema8.Boolean,
|
|
629
|
+
Schema8.Finite.check(Schema8.isLessThanOrEqualTo(Number.MAX_SAFE_INTEGER), Schema8.isGreaterThanOrEqualTo(Number.MIN_SAFE_INTEGER)),
|
|
1358
630
|
BoundedText,
|
|
1359
|
-
|
|
1360
|
-
|
|
631
|
+
Schema8.Array(Schema8.suspend(() => SafeJson)).check(Schema8.isMaxLength(200)),
|
|
632
|
+
Schema8.Record(SafeKey, Schema8.suspend(() => SafeJson)).check(Schema8.isMaxProperties(200))
|
|
1361
633
|
]).annotate({ identifier: "RunSafeJson" });
|
|
1362
|
-
var RunActorRef =
|
|
1363
|
-
actorType:
|
|
634
|
+
var RunActorRef = Schema8.Struct({
|
|
635
|
+
actorType: Schema8.Union([ActorType, Schema8.Literal("runner")]),
|
|
1364
636
|
actorId: Id,
|
|
1365
|
-
delegatedByUserId:
|
|
1366
|
-
agentIdentityId:
|
|
1367
|
-
runnerId:
|
|
637
|
+
delegatedByUserId: Schema8.optionalKey(Id),
|
|
638
|
+
agentIdentityId: Schema8.optionalKey(Id),
|
|
639
|
+
runnerId: Schema8.optionalKey(Id)
|
|
1368
640
|
});
|
|
1369
|
-
var RunResourceRef =
|
|
1370
|
-
kind:
|
|
641
|
+
var RunResourceRef = Schema8.Struct({
|
|
642
|
+
kind: Schema8.String.check(Schema8.isMinLength(1), Schema8.isMaxLength(80)),
|
|
1371
643
|
id: Id
|
|
1372
644
|
});
|
|
1373
|
-
var RunSchemaRef =
|
|
1374
|
-
kind:
|
|
1375
|
-
name:
|
|
1376
|
-
version:
|
|
1377
|
-
sha256:
|
|
645
|
+
var RunSchemaRef = Schema8.Struct({
|
|
646
|
+
kind: Schema8.Literal("typebox_ref"),
|
|
647
|
+
name: Schema8.String.check(Schema8.isMinLength(1), Schema8.isMaxLength(160)),
|
|
648
|
+
version: Schema8.String.check(Schema8.isMinLength(1), Schema8.isMaxLength(40)),
|
|
649
|
+
sha256: Sha256
|
|
1378
650
|
});
|
|
1379
|
-
var AgentPinnedKitRef =
|
|
651
|
+
var AgentPinnedKitRef = Schema8.Struct({
|
|
1380
652
|
kitId: Id,
|
|
1381
|
-
version:
|
|
1382
|
-
sha256:
|
|
1383
|
-
precedence:
|
|
1384
|
-
required:
|
|
1385
|
-
});
|
|
1386
|
-
var AgentSkillRef =
|
|
1387
|
-
sourceId:
|
|
1388
|
-
name:
|
|
1389
|
-
version:
|
|
1390
|
-
sha256:
|
|
1391
|
-
required:
|
|
1392
|
-
});
|
|
1393
|
-
var AgentReference =
|
|
1394
|
-
|
|
1395
|
-
|
|
653
|
+
version: Schema8.Int.check(Schema8.isGreaterThanOrEqualTo(1)),
|
|
654
|
+
sha256: Sha256,
|
|
655
|
+
precedence: Schema8.Int.check(Schema8.isGreaterThanOrEqualTo(0)),
|
|
656
|
+
required: Schema8.Boolean
|
|
657
|
+
});
|
|
658
|
+
var AgentSkillRef = Schema8.Struct({
|
|
659
|
+
sourceId: Schema8.String.check(Schema8.isMinLength(1), Schema8.isMaxLength(240)),
|
|
660
|
+
name: Schema8.String.check(Schema8.isMinLength(1), Schema8.isMaxLength(160)),
|
|
661
|
+
version: Schema8.optionalKey(Schema8.String.check(Schema8.isMaxLength(80))),
|
|
662
|
+
sha256: Schema8.optionalKey(Sha256),
|
|
663
|
+
required: Schema8.Boolean
|
|
664
|
+
});
|
|
665
|
+
var AgentReference = Schema8.Union([
|
|
666
|
+
Schema8.Struct({ agentId: Id, alias: Schema8.String.check(Schema8.isMinLength(1), Schema8.isMaxLength(80)) }),
|
|
667
|
+
Schema8.Struct({ agentId: Id, version: Schema8.Int.check(Schema8.isGreaterThanOrEqualTo(1)), digest: Sha256 })
|
|
1396
668
|
]);
|
|
1397
|
-
var AgentToolGrant =
|
|
1398
|
-
ref:
|
|
1399
|
-
inputSchema:
|
|
1400
|
-
scope:
|
|
1401
|
-
approval:
|
|
1402
|
-
delegable:
|
|
1403
|
-
});
|
|
1404
|
-
var AgentHarnessSelector =
|
|
1405
|
-
mode:
|
|
1406
|
-
harness:
|
|
1407
|
-
adapterRef:
|
|
1408
|
-
requiredCapabilities:
|
|
1409
|
-
allowedFallbacks:
|
|
1410
|
-
});
|
|
1411
|
-
var AgentModelSelector =
|
|
1412
|
-
providerRef:
|
|
1413
|
-
modelRef:
|
|
1414
|
-
profile:
|
|
1415
|
-
reasoning:
|
|
1416
|
-
});
|
|
1417
|
-
var AgentPolicy =
|
|
1418
|
-
requestedCapabilities:
|
|
1419
|
-
maxChildDepth:
|
|
1420
|
-
allowSubdelegation:
|
|
1421
|
-
maxWallSeconds:
|
|
1422
|
-
maxInputTokens:
|
|
1423
|
-
maxOutputTokens:
|
|
1424
|
-
hardLimit:
|
|
1425
|
-
});
|
|
1426
|
-
var AgentProvenance =
|
|
1427
|
-
source:
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
669
|
+
var AgentToolGrant = Schema8.Struct({
|
|
670
|
+
ref: Schema8.String.check(Schema8.isMinLength(1), Schema8.isMaxLength(240)),
|
|
671
|
+
inputSchema: Schema8.optionalKey(RunSchemaRef),
|
|
672
|
+
scope: Schema8.optionalKey(RunResourceRef),
|
|
673
|
+
approval: Schema8.Union([Schema8.Literal("none"), Schema8.Literal("human_each_call"), Schema8.Literal("human_once")]),
|
|
674
|
+
delegable: Schema8.Boolean
|
|
675
|
+
});
|
|
676
|
+
var AgentHarnessSelector = Schema8.Struct({
|
|
677
|
+
mode: Schema8.Union([Schema8.Literal("direct_model"), Schema8.Literal("harness_v1"), Schema8.Literal("native")]),
|
|
678
|
+
harness: Schema8.optionalKey(Schema8.String.check(Schema8.isMinLength(1), Schema8.isMaxLength(80))),
|
|
679
|
+
adapterRef: Schema8.optionalKey(Schema8.String.check(Schema8.isMinLength(1), Schema8.isMaxLength(240))),
|
|
680
|
+
requiredCapabilities: Schema8.Array(Schema8.String.check(Schema8.isMinLength(1), Schema8.isMaxLength(80))).check(Schema8.isMaxLength(40)),
|
|
681
|
+
allowedFallbacks: Schema8.Array(Schema8.String.check(Schema8.isMinLength(1), Schema8.isMaxLength(160))).check(Schema8.isMaxLength(20))
|
|
682
|
+
});
|
|
683
|
+
var AgentModelSelector = Schema8.Struct({
|
|
684
|
+
providerRef: Schema8.String.check(Schema8.isMinLength(1), Schema8.isMaxLength(160)),
|
|
685
|
+
modelRef: Schema8.String.check(Schema8.isMinLength(1), Schema8.isMaxLength(160)),
|
|
686
|
+
profile: Schema8.optionalKey(Schema8.String.check(Schema8.isMaxLength(80))),
|
|
687
|
+
reasoning: Schema8.optionalKey(Schema8.String.check(Schema8.isMaxLength(80)))
|
|
688
|
+
});
|
|
689
|
+
var AgentPolicy = Schema8.Struct({
|
|
690
|
+
requestedCapabilities: Schema8.Array(Schema8.String.check(Schema8.isMinLength(1), Schema8.isMaxLength(120))).check(Schema8.isMaxLength(100)),
|
|
691
|
+
maxChildDepth: Schema8.Int.check(Schema8.isGreaterThanOrEqualTo(0), Schema8.isLessThanOrEqualTo(32)),
|
|
692
|
+
allowSubdelegation: Schema8.Boolean,
|
|
693
|
+
maxWallSeconds: Schema8.optionalKey(Schema8.Int.check(Schema8.isGreaterThanOrEqualTo(1), Schema8.isLessThanOrEqualTo(31536000))),
|
|
694
|
+
maxInputTokens: Schema8.optionalKey(Schema8.Int.check(Schema8.isGreaterThanOrEqualTo(0), Schema8.isLessThanOrEqualTo(1e8))),
|
|
695
|
+
maxOutputTokens: Schema8.optionalKey(Schema8.Int.check(Schema8.isGreaterThanOrEqualTo(0), Schema8.isLessThanOrEqualTo(1e8))),
|
|
696
|
+
hardLimit: Schema8.Boolean
|
|
697
|
+
});
|
|
698
|
+
var AgentProvenance = Schema8.Struct({
|
|
699
|
+
source: Schema8.Union([
|
|
700
|
+
Schema8.Literal("kitman"),
|
|
701
|
+
Schema8.Literal("workspace"),
|
|
702
|
+
Schema8.Literal("team"),
|
|
703
|
+
Schema8.Literal("git"),
|
|
704
|
+
Schema8.Literal("package"),
|
|
705
|
+
Schema8.Literal("import")
|
|
1434
706
|
]),
|
|
1435
|
-
sourceRef:
|
|
1436
|
-
sourceCommitSha:
|
|
1437
|
-
contentSha256:
|
|
1438
|
-
reviewedBy:
|
|
707
|
+
sourceRef: Schema8.optionalKey(Schema8.String.check(Schema8.isMaxLength(240))),
|
|
708
|
+
sourceCommitSha: Schema8.optionalKey(Schema8.String.check(Schema8.isMaxLength(128))),
|
|
709
|
+
contentSha256: Sha256,
|
|
710
|
+
reviewedBy: Schema8.optionalKey(Schema8.Array(RunActorRef).check(Schema8.isMaxLength(20)))
|
|
1439
711
|
});
|
|
1440
|
-
var Agent =
|
|
712
|
+
var Agent = Schema8.Struct({
|
|
1441
713
|
contractVersion: RunContractVersion,
|
|
1442
714
|
id: Id,
|
|
1443
715
|
workspaceId: Id,
|
|
1444
|
-
teamId:
|
|
1445
|
-
name:
|
|
1446
|
-
slug:
|
|
1447
|
-
currentVersion:
|
|
1448
|
-
status:
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
716
|
+
teamId: Schema8.optionalKey(Id),
|
|
717
|
+
name: Schema8.String.check(Schema8.isMinLength(1), Schema8.isMaxLength(160)),
|
|
718
|
+
slug: Schema8.String.check(Schema8.isMinLength(1), Schema8.isMaxLength(160), Schema8.isPattern(new RegExp("^[a-z0-9]+(?:-[a-z0-9]+)*$", "u"))),
|
|
719
|
+
currentVersion: Schema8.optionalKey(Schema8.Int.check(Schema8.isGreaterThanOrEqualTo(1))),
|
|
720
|
+
status: Schema8.Union([
|
|
721
|
+
Schema8.Literal("draft"),
|
|
722
|
+
Schema8.Literal("published"),
|
|
723
|
+
Schema8.Literal("deprecated"),
|
|
724
|
+
Schema8.Literal("disabled"),
|
|
725
|
+
Schema8.Literal("archived")
|
|
1454
726
|
]),
|
|
1455
727
|
createdBy: RunActorRef,
|
|
1456
728
|
createdAt: Timestamp,
|
|
@@ -1468,78 +740,78 @@ var RunMessageTypes = [
|
|
|
1468
740
|
"instruction",
|
|
1469
741
|
"notice"
|
|
1470
742
|
];
|
|
1471
|
-
var RunMessageType =
|
|
1472
|
-
var MessageEvidenceRefs =
|
|
1473
|
-
var MessageProgressPayload =
|
|
1474
|
-
type:
|
|
743
|
+
var RunMessageType = Schema8.Literals(RunMessageTypes);
|
|
744
|
+
var MessageEvidenceRefs = Schema8.Array(RunResourceRef).check(Schema8.isMaxLength(100));
|
|
745
|
+
var MessageProgressPayload = Schema8.Struct({
|
|
746
|
+
type: Schema8.Literal("progress"),
|
|
1475
747
|
summary: BoundedText,
|
|
1476
|
-
phase:
|
|
1477
|
-
percent:
|
|
1478
|
-
evidenceRefs:
|
|
748
|
+
phase: Schema8.optionalKey(Schema8.String.check(Schema8.isMaxLength(120))),
|
|
749
|
+
percent: Schema8.optionalKey(Schema8.Finite.check(Schema8.isGreaterThanOrEqualTo(0), Schema8.isLessThanOrEqualTo(100))),
|
|
750
|
+
evidenceRefs: Schema8.optionalKey(MessageEvidenceRefs)
|
|
1479
751
|
});
|
|
1480
|
-
var MessageQuestionPayload =
|
|
1481
|
-
type:
|
|
1482
|
-
questionId:
|
|
752
|
+
var MessageQuestionPayload = Schema8.Struct({
|
|
753
|
+
type: Schema8.Literal("question"),
|
|
754
|
+
questionId: Schema8.String.check(Schema8.isMinLength(1), Schema8.isMaxLength(160)),
|
|
1483
755
|
prompt: BoundedText,
|
|
1484
756
|
answerSchema: RunSchemaRef,
|
|
1485
|
-
urgency:
|
|
757
|
+
urgency: Schema8.Union([Schema8.Literal("normal"), Schema8.Literal("blocking")]),
|
|
1486
758
|
waitId: Id
|
|
1487
759
|
});
|
|
1488
|
-
var MessageAnswerPayload =
|
|
1489
|
-
type:
|
|
1490
|
-
questionId:
|
|
760
|
+
var MessageAnswerPayload = Schema8.Struct({
|
|
761
|
+
type: Schema8.Literal("answer"),
|
|
762
|
+
questionId: Schema8.String.check(Schema8.isMinLength(1), Schema8.isMaxLength(160)),
|
|
1491
763
|
answer: SafeJson,
|
|
1492
764
|
answerSchema: RunSchemaRef,
|
|
1493
765
|
waitId: Id
|
|
1494
766
|
});
|
|
1495
|
-
var MessageContextRequestPayload =
|
|
1496
|
-
type:
|
|
1497
|
-
requestId:
|
|
1498
|
-
refs:
|
|
767
|
+
var MessageContextRequestPayload = Schema8.Struct({
|
|
768
|
+
type: Schema8.Literal("context_request"),
|
|
769
|
+
requestId: Schema8.String.check(Schema8.isMinLength(1), Schema8.isMaxLength(160)),
|
|
770
|
+
refs: Schema8.Array(RunResourceRef).check(Schema8.isMaxLength(100)),
|
|
1499
771
|
reason: BoundedText
|
|
1500
772
|
});
|
|
1501
|
-
var MessageContextResponsePayload =
|
|
1502
|
-
type:
|
|
1503
|
-
requestId:
|
|
1504
|
-
refs:
|
|
1505
|
-
summaries:
|
|
1506
|
-
});
|
|
1507
|
-
var MessageFindingPayload =
|
|
1508
|
-
type:
|
|
1509
|
-
severity:
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
773
|
+
var MessageContextResponsePayload = Schema8.Struct({
|
|
774
|
+
type: Schema8.Literal("context_response"),
|
|
775
|
+
requestId: Schema8.String.check(Schema8.isMinLength(1), Schema8.isMaxLength(160)),
|
|
776
|
+
refs: Schema8.Array(RunResourceRef).check(Schema8.isMaxLength(100)),
|
|
777
|
+
summaries: Schema8.Array(SafeJson).check(Schema8.isMaxLength(100))
|
|
778
|
+
});
|
|
779
|
+
var MessageFindingPayload = Schema8.Struct({
|
|
780
|
+
type: Schema8.Literal("finding"),
|
|
781
|
+
severity: Schema8.Union([
|
|
782
|
+
Schema8.Literal("info"),
|
|
783
|
+
Schema8.Literal("low"),
|
|
784
|
+
Schema8.Literal("medium"),
|
|
785
|
+
Schema8.Literal("high"),
|
|
786
|
+
Schema8.Literal("critical")
|
|
1515
787
|
]),
|
|
1516
|
-
category:
|
|
788
|
+
category: Schema8.String.check(Schema8.isMinLength(1), Schema8.isMaxLength(120)),
|
|
1517
789
|
summary: BoundedText,
|
|
1518
790
|
evidenceRefs: MessageEvidenceRefs
|
|
1519
791
|
});
|
|
1520
|
-
var MessagePartialResultPayload =
|
|
1521
|
-
type:
|
|
792
|
+
var MessagePartialResultPayload = Schema8.Struct({
|
|
793
|
+
type: Schema8.Literal("partial_result"),
|
|
1522
794
|
outputSchema: RunSchemaRef,
|
|
1523
795
|
data: SafeJson,
|
|
1524
|
-
complete:
|
|
796
|
+
complete: Schema8.Literal(false)
|
|
1525
797
|
});
|
|
1526
|
-
var MessageHandoffPayload =
|
|
1527
|
-
type:
|
|
798
|
+
var MessageHandoffPayload = Schema8.Struct({
|
|
799
|
+
type: Schema8.Literal("handoff"),
|
|
1528
800
|
summary: BoundedText,
|
|
1529
|
-
nextAction:
|
|
1530
|
-
evidenceRefs:
|
|
801
|
+
nextAction: Schema8.optionalKey(Schema8.String.check(Schema8.isMaxLength(4000))),
|
|
802
|
+
evidenceRefs: Schema8.optionalKey(MessageEvidenceRefs)
|
|
1531
803
|
});
|
|
1532
|
-
var MessageInstructionPayload =
|
|
1533
|
-
type:
|
|
804
|
+
var MessageInstructionPayload = Schema8.Struct({
|
|
805
|
+
type: Schema8.Literal("instruction"),
|
|
1534
806
|
instruction: BoundedText,
|
|
1535
|
-
authority:
|
|
807
|
+
authority: Schema8.Union([Schema8.Literal("normal"), Schema8.Literal("operator")])
|
|
1536
808
|
});
|
|
1537
|
-
var MessageNoticePayload =
|
|
1538
|
-
type:
|
|
1539
|
-
code:
|
|
809
|
+
var MessageNoticePayload = Schema8.Struct({
|
|
810
|
+
type: Schema8.Literal("notice"),
|
|
811
|
+
code: Schema8.String.check(Schema8.isMinLength(1), Schema8.isMaxLength(120)),
|
|
1540
812
|
summary: BoundedText
|
|
1541
813
|
});
|
|
1542
|
-
var RunMessagePayload =
|
|
814
|
+
var RunMessagePayload = Schema8.Union([
|
|
1543
815
|
MessageProgressPayload,
|
|
1544
816
|
MessageQuestionPayload,
|
|
1545
817
|
MessageAnswerPayload,
|
|
@@ -1551,94 +823,94 @@ var RunMessagePayload = Schema9.Union([
|
|
|
1551
823
|
MessageInstructionPayload,
|
|
1552
824
|
MessageNoticePayload
|
|
1553
825
|
]);
|
|
1554
|
-
var RunMessage =
|
|
826
|
+
var RunMessage = Schema8.Struct({
|
|
1555
827
|
contractVersion: RunContractVersion,
|
|
1556
828
|
id: Id,
|
|
1557
829
|
workspaceId: Id,
|
|
1558
|
-
teamId:
|
|
830
|
+
teamId: Schema8.optionalKey(Id),
|
|
1559
831
|
rootRunId: Id,
|
|
1560
|
-
sender:
|
|
1561
|
-
|
|
832
|
+
sender: Schema8.Union([
|
|
833
|
+
Schema8.Struct({ kind: Schema8.Union([Schema8.Literal("run"), Schema8.Literal("step_attempt")]), id: Id }),
|
|
1562
834
|
RunActorRef
|
|
1563
835
|
]),
|
|
1564
|
-
recipient:
|
|
836
|
+
recipient: Schema8.Struct({ kind: Schema8.String.check(Schema8.isMinLength(1), Schema8.isMaxLength(80)), id: Id }),
|
|
1565
837
|
type: RunMessageType,
|
|
1566
|
-
streamKey:
|
|
1567
|
-
sequence:
|
|
1568
|
-
correlationId:
|
|
1569
|
-
causationId:
|
|
1570
|
-
replyToMessageId:
|
|
1571
|
-
payloadSchema:
|
|
838
|
+
streamKey: Schema8.String.check(Schema8.isMinLength(1), Schema8.isMaxLength(240)),
|
|
839
|
+
sequence: Schema8.Int.check(Schema8.isGreaterThanOrEqualTo(1)),
|
|
840
|
+
correlationId: Schema8.optionalKey(Id),
|
|
841
|
+
causationId: Schema8.optionalKey(Id),
|
|
842
|
+
replyToMessageId: Schema8.optionalKey(Id),
|
|
843
|
+
payloadSchema: Schema8.optionalKey(RunSchemaRef),
|
|
1572
844
|
payload: RunMessagePayload,
|
|
1573
|
-
delivery:
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
845
|
+
delivery: Schema8.Union([
|
|
846
|
+
Schema8.Literal("created"),
|
|
847
|
+
Schema8.Literal("queued"),
|
|
848
|
+
Schema8.Literal("delivered"),
|
|
849
|
+
Schema8.Literal("acknowledged"),
|
|
850
|
+
Schema8.Literal("expired"),
|
|
851
|
+
Schema8.Literal("failed")
|
|
1580
852
|
]),
|
|
1581
|
-
idempotencyKey:
|
|
1582
|
-
expiresAt:
|
|
853
|
+
idempotencyKey: Schema8.String.check(Schema8.isMinLength(1), Schema8.isMaxLength(240)),
|
|
854
|
+
expiresAt: Schema8.optionalKey(Timestamp),
|
|
1583
855
|
createdAt: Timestamp,
|
|
1584
|
-
acknowledgedAt:
|
|
856
|
+
acknowledgedAt: Schema8.optionalKey(Timestamp)
|
|
1585
857
|
});
|
|
1586
|
-
var RunResult =
|
|
858
|
+
var RunResult = Schema8.Struct({
|
|
1587
859
|
contractVersion: RunContractVersion,
|
|
1588
860
|
id: Id,
|
|
1589
861
|
workspaceId: Id,
|
|
1590
|
-
teamId:
|
|
862
|
+
teamId: Schema8.optionalKey(Id),
|
|
1591
863
|
runId: Id,
|
|
1592
864
|
rootRunId: Id,
|
|
1593
|
-
attempt:
|
|
1594
|
-
outcome:
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
865
|
+
attempt: Schema8.Int.check(Schema8.isGreaterThanOrEqualTo(1)),
|
|
866
|
+
outcome: Schema8.Union([
|
|
867
|
+
Schema8.Literal("succeeded"),
|
|
868
|
+
Schema8.Literal("failed"),
|
|
869
|
+
Schema8.Literal("canceled"),
|
|
870
|
+
Schema8.Literal("blocked"),
|
|
871
|
+
Schema8.Literal("expired")
|
|
1600
872
|
]),
|
|
1601
|
-
output:
|
|
1602
|
-
failure:
|
|
1603
|
-
code:
|
|
1604
|
-
category:
|
|
873
|
+
output: Schema8.optionalKey(Schema8.Struct({ schema: RunSchemaRef, data: SafeJson, digest: Sha256 })),
|
|
874
|
+
failure: Schema8.optionalKey(Schema8.Struct({
|
|
875
|
+
code: Schema8.String.check(Schema8.isMinLength(1), Schema8.isMaxLength(120)),
|
|
876
|
+
category: Schema8.String.check(Schema8.isMinLength(1), Schema8.isMaxLength(80)),
|
|
1605
877
|
summary: BoundedText,
|
|
1606
|
-
retryable:
|
|
1607
|
-
details:
|
|
878
|
+
retryable: Schema8.Boolean,
|
|
879
|
+
details: Schema8.optionalKey(SafeJson)
|
|
1608
880
|
})),
|
|
1609
|
-
evidenceRefs:
|
|
1610
|
-
childSummary:
|
|
1611
|
-
awaited:
|
|
1612
|
-
detached:
|
|
1613
|
-
succeeded:
|
|
1614
|
-
failed:
|
|
1615
|
-
canceled:
|
|
881
|
+
evidenceRefs: Schema8.Array(Schema8.Union([RunResourceRef, EvidenceRef])).check(Schema8.isMaxLength(100)),
|
|
882
|
+
childSummary: Schema8.Struct({
|
|
883
|
+
awaited: Schema8.Int.check(Schema8.isGreaterThanOrEqualTo(0)),
|
|
884
|
+
detached: Schema8.Int.check(Schema8.isGreaterThanOrEqualTo(0)),
|
|
885
|
+
succeeded: Schema8.Int.check(Schema8.isGreaterThanOrEqualTo(0)),
|
|
886
|
+
failed: Schema8.Int.check(Schema8.isGreaterThanOrEqualTo(0)),
|
|
887
|
+
canceled: Schema8.Int.check(Schema8.isGreaterThanOrEqualTo(0))
|
|
1616
888
|
}),
|
|
1617
|
-
usage:
|
|
1618
|
-
producedBy:
|
|
1619
|
-
workUnitId:
|
|
1620
|
-
leaseId:
|
|
1621
|
-
fencingTokenDigest:
|
|
889
|
+
usage: Schema8.optionalKey(Schema8.Record(SafeKey, SafeJson).check(Schema8.isMaxProperties(20))),
|
|
890
|
+
producedBy: Schema8.Struct({
|
|
891
|
+
workUnitId: Schema8.optionalKey(Id),
|
|
892
|
+
leaseId: Schema8.optionalKey(Id),
|
|
893
|
+
fencingTokenDigest: Schema8.optionalKey(Sha256)
|
|
1622
894
|
}),
|
|
1623
895
|
createdAt: Timestamp,
|
|
1624
896
|
finalizedAt: Timestamp
|
|
1625
897
|
});
|
|
1626
|
-
var RunEvent =
|
|
898
|
+
var RunEvent = Schema8.Struct({
|
|
1627
899
|
contractVersion: RunContractVersion,
|
|
1628
900
|
id: Id,
|
|
1629
|
-
eventVersion:
|
|
901
|
+
eventVersion: Schema8.Literal(1),
|
|
1630
902
|
streamId: Id,
|
|
1631
|
-
sequence:
|
|
903
|
+
sequence: Schema8.Int.check(Schema8.isGreaterThanOrEqualTo(1)),
|
|
1632
904
|
workspaceId: Id,
|
|
1633
|
-
teamId:
|
|
905
|
+
teamId: Schema8.optionalKey(Id),
|
|
1634
906
|
subject: RunResourceRef,
|
|
1635
907
|
rootRunId: Id,
|
|
1636
|
-
type:
|
|
1637
|
-
actor:
|
|
1638
|
-
correlationId:
|
|
1639
|
-
causationId:
|
|
908
|
+
type: Schema8.String.check(Schema8.isMinLength(1), Schema8.isMaxLength(100)),
|
|
909
|
+
actor: Schema8.optionalKey(RunActorRef),
|
|
910
|
+
correlationId: Schema8.optionalKey(Id),
|
|
911
|
+
causationId: Schema8.optionalKey(Id),
|
|
1640
912
|
occurredAt: Timestamp,
|
|
1641
|
-
data:
|
|
913
|
+
data: Schema8.Struct({ type: Schema8.String.check(Schema8.isMinLength(1), Schema8.isMaxLength(100)), value: SafeJson })
|
|
1642
914
|
});
|
|
1643
915
|
var WaitKinds = [
|
|
1644
916
|
"timer",
|
|
@@ -1650,44 +922,44 @@ var WaitKinds = [
|
|
|
1650
922
|
"provider_quota",
|
|
1651
923
|
"resource"
|
|
1652
924
|
];
|
|
1653
|
-
var WaitKind =
|
|
1654
|
-
var Wait =
|
|
925
|
+
var WaitKind = Schema8.Literals(WaitKinds);
|
|
926
|
+
var Wait = Schema8.Struct({
|
|
1655
927
|
contractVersion: RunContractVersion,
|
|
1656
928
|
id: Id,
|
|
1657
929
|
workspaceId: Id,
|
|
1658
|
-
teamId:
|
|
930
|
+
teamId: Schema8.optionalKey(Id),
|
|
1659
931
|
runId: Id,
|
|
1660
932
|
rootRunId: Id,
|
|
1661
|
-
stepKey:
|
|
933
|
+
stepKey: Schema8.optionalKey(Schema8.String.check(Schema8.isMinLength(1), Schema8.isMaxLength(160))),
|
|
1662
934
|
kind: WaitKind,
|
|
1663
|
-
state:
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
935
|
+
state: Schema8.Union([
|
|
936
|
+
Schema8.Literal("open"),
|
|
937
|
+
Schema8.Literal("resolved"),
|
|
938
|
+
Schema8.Literal("expired"),
|
|
939
|
+
Schema8.Literal("canceled")
|
|
1668
940
|
]),
|
|
1669
|
-
correlation:
|
|
1670
|
-
expectedSchema:
|
|
1671
|
-
timeout:
|
|
1672
|
-
dueAt:
|
|
1673
|
-
onTimeout:
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
941
|
+
correlation: Schema8.Record(SafeKey, SafeJson).check(Schema8.isMaxProperties(20)),
|
|
942
|
+
expectedSchema: Schema8.optionalKey(RunSchemaRef),
|
|
943
|
+
timeout: Schema8.Struct({
|
|
944
|
+
dueAt: Schema8.optionalKey(Timestamp),
|
|
945
|
+
onTimeout: Schema8.Union([
|
|
946
|
+
Schema8.Literal("fail"),
|
|
947
|
+
Schema8.Literal("block"),
|
|
948
|
+
Schema8.Literal("cancel"),
|
|
949
|
+
Schema8.Literal("default"),
|
|
950
|
+
Schema8.Literal("escalate")
|
|
1679
951
|
]),
|
|
1680
|
-
defaultValue:
|
|
952
|
+
defaultValue: Schema8.optionalKey(SafeJson)
|
|
1681
953
|
}),
|
|
1682
|
-
responderScope:
|
|
1683
|
-
resolution:
|
|
1684
|
-
kind:
|
|
1685
|
-
data:
|
|
1686
|
-
digest:
|
|
1687
|
-
actor:
|
|
954
|
+
responderScope: Schema8.optionalKey(RunResourceRef),
|
|
955
|
+
resolution: Schema8.optionalKey(Schema8.Struct({
|
|
956
|
+
kind: Schema8.String.check(Schema8.isMinLength(1), Schema8.isMaxLength(80)),
|
|
957
|
+
data: Schema8.optionalKey(SafeJson),
|
|
958
|
+
digest: Sha256,
|
|
959
|
+
actor: Schema8.optionalKey(RunActorRef)
|
|
1688
960
|
})),
|
|
1689
961
|
createdAt: Timestamp,
|
|
1690
|
-
resolvedAt:
|
|
962
|
+
resolvedAt: Schema8.optionalKey(Timestamp)
|
|
1691
963
|
});
|
|
1692
964
|
var ControlCommandKinds = [
|
|
1693
965
|
"pause",
|
|
@@ -1713,74 +985,74 @@ var ControlCommandKinds = [
|
|
|
1713
985
|
"request_status",
|
|
1714
986
|
"request_handoff"
|
|
1715
987
|
];
|
|
1716
|
-
var ControlCommandKind =
|
|
1717
|
-
var ControlCommand =
|
|
988
|
+
var ControlCommandKind = Schema8.Literals(ControlCommandKinds);
|
|
989
|
+
var ControlCommand = Schema8.Struct({
|
|
1718
990
|
contractVersion: RunContractVersion,
|
|
1719
991
|
id: Id,
|
|
1720
992
|
workspaceId: Id,
|
|
1721
|
-
teamId:
|
|
993
|
+
teamId: Schema8.optionalKey(Id),
|
|
1722
994
|
target: RunResourceRef,
|
|
1723
995
|
kind: ControlCommandKind,
|
|
1724
|
-
payload:
|
|
996
|
+
payload: Schema8.Struct({ kind: ControlCommandKind, data: SafeJson }),
|
|
1725
997
|
requestedBy: RunActorRef,
|
|
1726
|
-
idempotencyKey:
|
|
1727
|
-
expectedResourceVersion:
|
|
1728
|
-
status:
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
998
|
+
idempotencyKey: Schema8.String.check(Schema8.isMinLength(1), Schema8.isMaxLength(240)),
|
|
999
|
+
expectedResourceVersion: Schema8.optionalKey(Schema8.Int.check(Schema8.isGreaterThanOrEqualTo(1))),
|
|
1000
|
+
status: Schema8.Union([
|
|
1001
|
+
Schema8.Literal("accepted"),
|
|
1002
|
+
Schema8.Literal("queued"),
|
|
1003
|
+
Schema8.Literal("applied"),
|
|
1004
|
+
Schema8.Literal("rejected"),
|
|
1005
|
+
Schema8.Literal("expired"),
|
|
1006
|
+
Schema8.Literal("superseded")
|
|
1735
1007
|
]),
|
|
1736
|
-
rejection:
|
|
1008
|
+
rejection: Schema8.optionalKey(Schema8.Struct({ code: Schema8.String.check(Schema8.isMinLength(1), Schema8.isMaxLength(120)), summary: BoundedText })),
|
|
1737
1009
|
createdAt: Timestamp,
|
|
1738
|
-
appliedAt:
|
|
1739
|
-
});
|
|
1740
|
-
var ControlCommandList =
|
|
1741
|
-
var RunCommandCenterSnapshot =
|
|
1742
|
-
source:
|
|
1743
|
-
collection:
|
|
1744
|
-
scope:
|
|
1745
|
-
kind:
|
|
1010
|
+
appliedAt: Schema8.optionalKey(Timestamp)
|
|
1011
|
+
});
|
|
1012
|
+
var ControlCommandList = Schema8.Struct({ items: Schema8.Array(ControlCommand).check(Schema8.isMaxLength(50)) });
|
|
1013
|
+
var RunCommandCenterSnapshot = Schema8.Struct({
|
|
1014
|
+
source: Schema8.Literal("http_snapshot"),
|
|
1015
|
+
collection: Schema8.Literal("run_command_center"),
|
|
1016
|
+
scope: Schema8.Struct({
|
|
1017
|
+
kind: Schema8.Literal("run"),
|
|
1746
1018
|
workspaceId: Id,
|
|
1747
|
-
teamId:
|
|
1019
|
+
teamId: Schema8.optionalKey(Id),
|
|
1748
1020
|
runId: Id
|
|
1749
1021
|
}),
|
|
1750
1022
|
capturedAt: Timestamp,
|
|
1751
|
-
consistency:
|
|
1752
|
-
lowerBound:
|
|
1753
|
-
isComplete:
|
|
1023
|
+
consistency: Schema8.Literal("lower_bound"),
|
|
1024
|
+
lowerBound: Schema8.String.check(Schema8.isMinLength(1), Schema8.isMaxLength(512)),
|
|
1025
|
+
isComplete: Schema8.Literal(true)
|
|
1754
1026
|
});
|
|
1755
1027
|
|
|
1756
1028
|
// packages/core/src/extension.ts
|
|
1757
1029
|
var NativeExtensionTargets = ["runner_backend", "harness", "sandbox"];
|
|
1758
|
-
var NativeExtensionTarget =
|
|
1030
|
+
var NativeExtensionTarget = Schema9.Literals(NativeExtensionTargets);
|
|
1759
1031
|
var NativeExtensionPolicies = ["optional", "required"];
|
|
1760
|
-
var NativeExtensionPolicy =
|
|
1761
|
-
var NativeExtensionIdentity =
|
|
1762
|
-
var NativeExtensionRef =
|
|
1032
|
+
var NativeExtensionPolicy = Schema9.Literals(NativeExtensionPolicies);
|
|
1033
|
+
var NativeExtensionIdentity = Schema9.String.check(Schema9.isMinLength(3), Schema9.isMaxLength(120), Schema9.isPattern(new RegExp("^[a-z0-9][a-z0-9_-]*(\\.[a-z0-9][a-z0-9_-]*)+$", "u")));
|
|
1034
|
+
var NativeExtensionRef = Schema9.Struct({
|
|
1763
1035
|
extensionId: NativeExtensionIdentity,
|
|
1764
|
-
version:
|
|
1036
|
+
version: Schema9.Int.check(Schema9.isGreaterThanOrEqualTo(1), Schema9.isLessThanOrEqualTo(10)),
|
|
1765
1037
|
policy: NativeExtensionPolicy,
|
|
1766
|
-
requiredCapabilities:
|
|
1767
|
-
configuration:
|
|
1038
|
+
requiredCapabilities: Schema9.optionalKey(Schema9.Array(Schema9.String.check(Schema9.isMinLength(1), Schema9.isMaxLength(120))).check(Schema9.isMaxLength(50))),
|
|
1039
|
+
configuration: Schema9.optionalKey(Schema9.Record(Schema9.String.check(Schema9.isMinLength(1), Schema9.isMaxLength(120)), SafeJson).check(Schema9.isMaxProperties(40)))
|
|
1768
1040
|
});
|
|
1769
|
-
var NativeExtensionDescriptor =
|
|
1041
|
+
var NativeExtensionDescriptor = Schema9.Struct({
|
|
1770
1042
|
extensionId: NativeExtensionIdentity,
|
|
1771
|
-
version:
|
|
1043
|
+
version: Schema9.Int.check(Schema9.isGreaterThanOrEqualTo(1), Schema9.isLessThanOrEqualTo(10)),
|
|
1772
1044
|
target: NativeExtensionTarget,
|
|
1773
|
-
requiredCapabilities:
|
|
1774
|
-
configurationSchema:
|
|
1775
|
-
resultSchema:
|
|
1776
|
-
observability:
|
|
1777
|
-
transcriptPolicy:
|
|
1778
|
-
maxMetadataChars:
|
|
1045
|
+
requiredCapabilities: Schema9.Array(Schema9.String.check(Schema9.isMinLength(1), Schema9.isMaxLength(120))).check(Schema9.isMaxLength(50)),
|
|
1046
|
+
configurationSchema: Schema9.optionalKey(Schema9.Record(Schema9.String.check(Schema9.isMinLength(1), Schema9.isMaxLength(120)), SafeJson).check(Schema9.isMaxProperties(80))),
|
|
1047
|
+
resultSchema: Schema9.optionalKey(Schema9.Record(Schema9.String.check(Schema9.isMinLength(1), Schema9.isMaxLength(120)), SafeJson).check(Schema9.isMaxProperties(80))),
|
|
1048
|
+
observability: Schema9.Struct({
|
|
1049
|
+
transcriptPolicy: Schema9.Literal("metadata_only"),
|
|
1050
|
+
maxMetadataChars: Schema9.optionalKey(Schema9.Int.check(Schema9.isGreaterThanOrEqualTo(1), Schema9.isLessThanOrEqualTo(65536)))
|
|
1779
1051
|
})
|
|
1780
1052
|
});
|
|
1781
1053
|
|
|
1782
1054
|
// packages/core/src/proposal.ts
|
|
1783
|
-
import * as
|
|
1055
|
+
import * as Schema10 from "effect/Schema";
|
|
1784
1056
|
var ProposalStatuses = [
|
|
1785
1057
|
"proposed",
|
|
1786
1058
|
"in_review",
|
|
@@ -1798,16 +1070,6 @@ var KitMarketplaceProposalTargetTypes = [
|
|
|
1798
1070
|
"kit_activation",
|
|
1799
1071
|
"kit_trust_policy"
|
|
1800
1072
|
];
|
|
1801
|
-
var KitMarketplaceProposalActions = [
|
|
1802
|
-
"source_publish",
|
|
1803
|
-
"version_publish",
|
|
1804
|
-
"source_update",
|
|
1805
|
-
"trust_change",
|
|
1806
|
-
"visibility_change",
|
|
1807
|
-
"broad_activation",
|
|
1808
|
-
"risky_agent_environment_effect",
|
|
1809
|
-
"rollback"
|
|
1810
|
-
];
|
|
1811
1073
|
var ProposalTargetTypes = [
|
|
1812
1074
|
"memory",
|
|
1813
1075
|
"kit",
|
|
@@ -1903,115 +1165,105 @@ var ForbiddenProposalNormalizedKeySet = new Set(ForbiddenProposalNormalizedKeys)
|
|
|
1903
1165
|
var ProposalSafePayloadKeyPattern = `^(?!(?:${proposalForbiddenKeyVariants().map(escapeRegExp).join("|")})$).+$`;
|
|
1904
1166
|
var ProposalForbiddenContentPattern = "sk-[A-Za-z0-9_-]{8,}|ghp_[A-Za-z0-9_]+|glpat-[A-Za-z0-9_-]+|\\bBearer\\s+[A-Za-z0-9._~+/=-]+|eyJ[A-Za-z0-9_-]+\\.[A-Za-z0-9_-]+\\.[A-Za-z0-9_-]+|[dD][iI][fF][fF]\\s+--git|[rR][aA][wW]\\s+(?:[tT][eE][rR][mM][iI][nN][aA][lL]\\s+)?[lL][oO][gG]s?|[tT][eE][rR][mM][iI][nN][aA][lL]\\s+[oO][uU][tT][pP][uU][tT]|[rR][aA][wW]\\s+[tT][rR][aA][nN][sS][cC][rR][iI][pP][tT]s?|[sS][oO][uU][rR][cC][eE]\\s+[cC][oO][dD][eE]|[fF][iI][lL][eE]\\s+[cC][oO][nN][tT][eE][nN][tT]";
|
|
1905
1167
|
var ProposalSafeStringPattern = `^(?!.*(?:${ProposalForbiddenContentPattern})).*$`;
|
|
1906
|
-
var ProposalStatus =
|
|
1907
|
-
var ProposalTargetType =
|
|
1908
|
-
var ProposalRiskLevel =
|
|
1909
|
-
var ProposalApprovalPolicyMode =
|
|
1910
|
-
var ProposalPolicyViolationCode =
|
|
1911
|
-
var ProposalPolicyViolationSeverity =
|
|
1912
|
-
var ProposalCheckKind =
|
|
1913
|
-
var ProposalCheckStatus =
|
|
1914
|
-
var ProposalApplicationAction =
|
|
1915
|
-
var ProposalRenderedDiffFormat =
|
|
1916
|
-
var ProposalRenderedDiffSectionRisk =
|
|
1917
|
-
var ProposalRenderedDiffRefKind =
|
|
1918
|
-
var ProposalSafeString =
|
|
1919
|
-
var ProposalSafeMetadataScalar =
|
|
1920
|
-
var ProposalSafeMetadataValue =
|
|
1168
|
+
var ProposalStatus = Schema10.Literals(ProposalStatuses);
|
|
1169
|
+
var ProposalTargetType = Schema10.Literals(ProposalTargetTypes);
|
|
1170
|
+
var ProposalRiskLevel = Schema10.Literals(ProposalRiskLevels);
|
|
1171
|
+
var ProposalApprovalPolicyMode = Schema10.Literals(ProposalApprovalPolicyModes);
|
|
1172
|
+
var ProposalPolicyViolationCode = Schema10.Literals(ProposalPolicyViolationCodes);
|
|
1173
|
+
var ProposalPolicyViolationSeverity = Schema10.Literals(ProposalPolicyViolationSeverities);
|
|
1174
|
+
var ProposalCheckKind = Schema10.Literals(ProposalCheckKinds);
|
|
1175
|
+
var ProposalCheckStatus = Schema10.Literals(ProposalCheckStatuses);
|
|
1176
|
+
var ProposalApplicationAction = Schema10.Literals(ProposalApplicationActions);
|
|
1177
|
+
var ProposalRenderedDiffFormat = Schema10.Literals(ProposalRenderedDiffFormats);
|
|
1178
|
+
var ProposalRenderedDiffSectionRisk = Schema10.Literals(ProposalRenderedDiffSectionRisks);
|
|
1179
|
+
var ProposalRenderedDiffRefKind = Schema10.Literals(ProposalRenderedDiffRefKinds);
|
|
1180
|
+
var ProposalSafeString = Schema10.String.check(Schema10.isMaxLength(4000), Schema10.isPattern(new RegExp(ProposalSafeStringPattern, "u")));
|
|
1181
|
+
var ProposalSafeMetadataScalar = Schema10.Union([ProposalSafeString, Schema10.Finite, Schema10.Boolean, Schema10.Null]);
|
|
1182
|
+
var ProposalSafeMetadataValue = Schema10.Union([
|
|
1921
1183
|
ProposalSafeMetadataScalar,
|
|
1922
|
-
|
|
1184
|
+
Schema10.Array(ProposalSafeMetadataScalar).check(Schema10.isMaxLength(100))
|
|
1923
1185
|
]);
|
|
1924
|
-
var ProposalSafeMetadata =
|
|
1925
|
-
var ProposalPayload =
|
|
1926
|
-
memory:
|
|
1927
|
-
kit:
|
|
1928
|
-
kit_source:
|
|
1929
|
-
kit_version:
|
|
1930
|
-
kit_installation:
|
|
1931
|
-
kit_activation:
|
|
1932
|
-
kit_trust_policy:
|
|
1933
|
-
agent_environment_policy:
|
|
1934
|
-
decision:
|
|
1935
|
-
task:
|
|
1936
|
-
team_context:
|
|
1937
|
-
context_relevance:
|
|
1938
|
-
});
|
|
1939
|
-
var ProposalTargetRef =
|
|
1186
|
+
var ProposalSafeMetadata = Schema10.Record(Schema10.String.check(Schema10.isMinLength(1), Schema10.isPattern(new RegExp(ProposalSafePayloadKeyPattern, "u"))), ProposalSafeMetadataValue);
|
|
1187
|
+
var ProposalPayload = Schema10.Struct({
|
|
1188
|
+
memory: Schema10.optionalKey(ProposalSafeMetadata),
|
|
1189
|
+
kit: Schema10.optionalKey(ProposalSafeMetadata),
|
|
1190
|
+
kit_source: Schema10.optionalKey(ProposalSafeMetadata),
|
|
1191
|
+
kit_version: Schema10.optionalKey(ProposalSafeMetadata),
|
|
1192
|
+
kit_installation: Schema10.optionalKey(ProposalSafeMetadata),
|
|
1193
|
+
kit_activation: Schema10.optionalKey(ProposalSafeMetadata),
|
|
1194
|
+
kit_trust_policy: Schema10.optionalKey(ProposalSafeMetadata),
|
|
1195
|
+
agent_environment_policy: Schema10.optionalKey(ProposalSafeMetadata),
|
|
1196
|
+
decision: Schema10.optionalKey(ProposalSafeMetadata),
|
|
1197
|
+
task: Schema10.optionalKey(ProposalSafeMetadata),
|
|
1198
|
+
team_context: Schema10.optionalKey(ProposalSafeMetadata),
|
|
1199
|
+
context_relevance: Schema10.optionalKey(ProposalSafeMetadata)
|
|
1200
|
+
});
|
|
1201
|
+
var ProposalTargetRef = Schema10.Struct({
|
|
1940
1202
|
type: ProposalTargetType,
|
|
1941
|
-
id:
|
|
1942
|
-
scopeType:
|
|
1943
|
-
scopeId:
|
|
1203
|
+
id: Schema10.optionalKey(Id),
|
|
1204
|
+
scopeType: Schema10.optionalKey(Schema10.Union([Schema10.Literal("workspace"), Schema10.Literal("team"), Schema10.Literal("task"), Schema10.Literal("kit")])),
|
|
1205
|
+
scopeId: Schema10.optionalKey(Id)
|
|
1944
1206
|
});
|
|
1945
|
-
var ProposalApprovalPolicy =
|
|
1207
|
+
var ProposalApprovalPolicy = Schema10.Struct({
|
|
1946
1208
|
mode: ProposalApprovalPolicyMode,
|
|
1947
|
-
requireDifferentApprover:
|
|
1948
|
-
autonomousAgentApprovalAllowed:
|
|
1949
|
-
deniedViolationCodes:
|
|
1209
|
+
requireDifferentApprover: Schema10.optionalKey(Schema10.Boolean),
|
|
1210
|
+
autonomousAgentApprovalAllowed: Schema10.Literal(false),
|
|
1211
|
+
deniedViolationCodes: Schema10.Array(ProposalPolicyViolationCode)
|
|
1950
1212
|
});
|
|
1951
|
-
var ProposalPolicyViolation =
|
|
1213
|
+
var ProposalPolicyViolation = Schema10.Struct({
|
|
1952
1214
|
code: ProposalPolicyViolationCode,
|
|
1953
1215
|
severity: ProposalPolicyViolationSeverity,
|
|
1954
1216
|
message: ProposalSafeString,
|
|
1955
|
-
actorId:
|
|
1956
|
-
target:
|
|
1957
|
-
metadata:
|
|
1217
|
+
actorId: Schema10.optionalKey(Id),
|
|
1218
|
+
target: Schema10.optionalKey(ProposalTargetRef),
|
|
1219
|
+
metadata: Schema10.optionalKey(ProposalSafeMetadata)
|
|
1958
1220
|
});
|
|
1959
|
-
var ProposalRenderedDiffRef =
|
|
1221
|
+
var ProposalRenderedDiffRef = Schema10.Struct({
|
|
1960
1222
|
kind: ProposalRenderedDiffRefKind,
|
|
1961
|
-
id:
|
|
1962
|
-
externalId:
|
|
1963
|
-
url:
|
|
1964
|
-
title:
|
|
1965
|
-
});
|
|
1966
|
-
var ProposalRenderedDiffSection =
|
|
1967
|
-
title:
|
|
1968
|
-
beforeSummary:
|
|
1969
|
-
afterSummary:
|
|
1223
|
+
id: Schema10.optionalKey(Id),
|
|
1224
|
+
externalId: Schema10.optionalKey(Schema10.String.check(Schema10.isMinLength(1))),
|
|
1225
|
+
url: Schema10.optionalKey(Schema10.String.check(Schema10.isMinLength(1))),
|
|
1226
|
+
title: Schema10.optionalKey(Schema10.String.check(Schema10.isMinLength(1), Schema10.isMaxLength(240)))
|
|
1227
|
+
});
|
|
1228
|
+
var ProposalRenderedDiffSection = Schema10.Struct({
|
|
1229
|
+
title: Schema10.String.check(Schema10.isMinLength(1), Schema10.isMaxLength(240), Schema10.isPattern(new RegExp(ProposalSafeStringPattern, "u"))),
|
|
1230
|
+
beforeSummary: Schema10.optionalKey(ProposalSafeString),
|
|
1231
|
+
afterSummary: Schema10.optionalKey(ProposalSafeString),
|
|
1970
1232
|
risk: ProposalRenderedDiffSectionRisk
|
|
1971
1233
|
});
|
|
1972
|
-
var ProposalRenderedDiff =
|
|
1234
|
+
var ProposalRenderedDiff = Schema10.Struct({
|
|
1973
1235
|
format: ProposalRenderedDiffFormat,
|
|
1974
|
-
title:
|
|
1236
|
+
title: Schema10.String.check(Schema10.isMinLength(1), Schema10.isMaxLength(240), Schema10.isPattern(new RegExp(ProposalSafeStringPattern, "u"))),
|
|
1975
1237
|
summary: ProposalSafeString,
|
|
1976
|
-
sections:
|
|
1977
|
-
refs:
|
|
1238
|
+
sections: Schema10.Array(ProposalRenderedDiffSection),
|
|
1239
|
+
refs: Schema10.Array(ProposalRenderedDiffRef)
|
|
1978
1240
|
});
|
|
1979
|
-
var ProposalRiskSummary =
|
|
1241
|
+
var ProposalRiskSummary = Schema10.Struct({
|
|
1980
1242
|
level: ProposalRiskLevel,
|
|
1981
1243
|
summary: ProposalSafeString,
|
|
1982
|
-
reasons:
|
|
1244
|
+
reasons: Schema10.Array(ProposalSafeString)
|
|
1983
1245
|
});
|
|
1984
|
-
var
|
|
1985
|
-
var KitMarketplaceProposalReview = Schema11.Struct({
|
|
1986
|
-
action: KitMarketplaceProposalAction,
|
|
1987
|
-
target: ProposalTargetRef,
|
|
1988
|
-
payload: ProposalPayload,
|
|
1989
|
-
renderedDiff: ProposalRenderedDiff,
|
|
1990
|
-
riskSummary: ProposalRiskSummary,
|
|
1991
|
-
validationFindings: Schema11.Array(ProposalPolicyViolation),
|
|
1992
|
-
approvalPolicy: ProposalApprovalPolicy
|
|
1993
|
-
});
|
|
1994
|
-
var Proposal = Schema11.Struct({
|
|
1246
|
+
var Proposal = Schema10.Struct({
|
|
1995
1247
|
id: Id,
|
|
1996
1248
|
workspaceId: Id,
|
|
1997
|
-
teamId:
|
|
1998
|
-
taskId:
|
|
1249
|
+
teamId: Schema10.optionalKey(Id),
|
|
1250
|
+
taskId: Schema10.optionalKey(Id),
|
|
1999
1251
|
target: ProposalTargetRef,
|
|
2000
|
-
title:
|
|
1252
|
+
title: Schema10.String.check(Schema10.isMinLength(1), Schema10.isMaxLength(240), Schema10.isPattern(new RegExp(ProposalSafeStringPattern, "u"))),
|
|
2001
1253
|
summary: ProposalSafeString,
|
|
2002
1254
|
status: ProposalStatus,
|
|
2003
1255
|
riskLevel: ProposalRiskLevel,
|
|
2004
1256
|
approvalPolicy: ProposalApprovalPolicy,
|
|
2005
1257
|
proposedByActorType: ActorType,
|
|
2006
1258
|
proposedByActorId: Id,
|
|
2007
|
-
delegatedByUserId:
|
|
1259
|
+
delegatedByUserId: Schema10.optionalKey(Id),
|
|
2008
1260
|
createdAt: Timestamp,
|
|
2009
1261
|
updatedAt: Timestamp
|
|
2010
1262
|
});
|
|
2011
|
-
var ProposalRevision =
|
|
1263
|
+
var ProposalRevision = Schema10.Struct({
|
|
2012
1264
|
id: Id,
|
|
2013
1265
|
proposalId: Id,
|
|
2014
|
-
revisionNumber:
|
|
1266
|
+
revisionNumber: Schema10.Int.check(Schema10.isGreaterThanOrEqualTo(1)),
|
|
2015
1267
|
payload: ProposalPayload,
|
|
2016
1268
|
renderedDiff: ProposalRenderedDiff,
|
|
2017
1269
|
riskSummary: ProposalRiskSummary,
|
|
@@ -2019,32 +1271,32 @@ var ProposalRevision = Schema11.Struct({
|
|
|
2019
1271
|
createdByActorId: Id,
|
|
2020
1272
|
createdAt: Timestamp
|
|
2021
1273
|
});
|
|
2022
|
-
var ProposalCommentAnchor =
|
|
2023
|
-
path:
|
|
2024
|
-
label:
|
|
1274
|
+
var ProposalCommentAnchor = Schema10.Struct({
|
|
1275
|
+
path: Schema10.Array(Schema10.String.check(Schema10.isMinLength(1), Schema10.isPattern(new RegExp(ProposalSafePayloadKeyPattern, "u")))),
|
|
1276
|
+
label: Schema10.optionalKey(Schema10.String.check(Schema10.isMinLength(1), Schema10.isMaxLength(120), Schema10.isPattern(new RegExp(ProposalSafeStringPattern, "u"))))
|
|
2025
1277
|
});
|
|
2026
|
-
var ProposalComment =
|
|
1278
|
+
var ProposalComment = Schema10.Struct({
|
|
2027
1279
|
id: Id,
|
|
2028
1280
|
proposalId: Id,
|
|
2029
|
-
revisionId:
|
|
1281
|
+
revisionId: Schema10.optionalKey(Id),
|
|
2030
1282
|
body: ProposalSafeString,
|
|
2031
|
-
anchor:
|
|
1283
|
+
anchor: Schema10.optionalKey(ProposalCommentAnchor),
|
|
2032
1284
|
actorType: ActorType,
|
|
2033
1285
|
actorId: Id,
|
|
2034
|
-
delegatedByUserId:
|
|
1286
|
+
delegatedByUserId: Schema10.optionalKey(Id),
|
|
2035
1287
|
createdAt: Timestamp
|
|
2036
1288
|
});
|
|
2037
|
-
var ProposalCheck =
|
|
1289
|
+
var ProposalCheck = Schema10.Struct({
|
|
2038
1290
|
id: Id,
|
|
2039
1291
|
proposalId: Id,
|
|
2040
|
-
revisionId:
|
|
1292
|
+
revisionId: Schema10.optionalKey(Id),
|
|
2041
1293
|
kind: ProposalCheckKind,
|
|
2042
1294
|
status: ProposalCheckStatus,
|
|
2043
1295
|
summary: ProposalSafeString,
|
|
2044
|
-
details:
|
|
1296
|
+
details: Schema10.optionalKey(ProposalSafeMetadata),
|
|
2045
1297
|
createdAt: Timestamp
|
|
2046
1298
|
});
|
|
2047
|
-
var ProposalApplication =
|
|
1299
|
+
var ProposalApplication = Schema10.Struct({
|
|
2048
1300
|
id: Id,
|
|
2049
1301
|
proposalId: Id,
|
|
2050
1302
|
revisionId: Id,
|
|
@@ -2052,9 +1304,9 @@ var ProposalApplication = Schema11.Struct({
|
|
|
2052
1304
|
target: ProposalTargetRef,
|
|
2053
1305
|
appliedByActorType: ActorType,
|
|
2054
1306
|
appliedByActorId: Id,
|
|
2055
|
-
targetVersionBefore:
|
|
2056
|
-
targetVersionAfter:
|
|
2057
|
-
rollbackRef:
|
|
1307
|
+
targetVersionBefore: Schema10.optionalKey(Schema10.String.check(Schema10.isMinLength(1), Schema10.isMaxLength(240), Schema10.isPattern(new RegExp(ProposalSafeStringPattern, "u")))),
|
|
1308
|
+
targetVersionAfter: Schema10.optionalKey(Schema10.String.check(Schema10.isMinLength(1), Schema10.isMaxLength(240), Schema10.isPattern(new RegExp(ProposalSafeStringPattern, "u")))),
|
|
1309
|
+
rollbackRef: Schema10.optionalKey(Schema10.String.check(Schema10.isMinLength(1), Schema10.isMaxLength(240), Schema10.isPattern(new RegExp(ProposalSafeStringPattern, "u")))),
|
|
2058
1310
|
appliedAt: Timestamp
|
|
2059
1311
|
});
|
|
2060
1312
|
function proposalForbiddenKeyVariants() {
|
|
@@ -2068,6 +1320,13 @@ function escapeRegExp(value) {
|
|
|
2068
1320
|
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
2069
1321
|
}
|
|
2070
1322
|
|
|
1323
|
+
// packages/core/src/waiting-on.ts
|
|
1324
|
+
import * as Schema11 from "effect/Schema";
|
|
1325
|
+
var WaitingOn = Schema11.Struct({ keys: Schema11.Array(Schema11.String), hidden: Schema11.Int });
|
|
1326
|
+
|
|
1327
|
+
// packages/core/src/run-queue.ts
|
|
1328
|
+
var ClaimRanks = ["in_progress", "finishing", "new"];
|
|
1329
|
+
|
|
2071
1330
|
// packages/core/src/loop.ts
|
|
2072
1331
|
var LoopStatuses = ["draft", "active", "disabled", "archived"];
|
|
2073
1332
|
var LoopStepImplementationKinds = [
|
|
@@ -2223,7 +1482,8 @@ var LoopRequiredRunStepStatus = Schema12.Literals(LoopRequiredRunStepStatuses);
|
|
|
2223
1482
|
var LoopSafeRefKind = Schema12.Literals(LoopSafeRefKinds);
|
|
2224
1483
|
var LoopSha256 = Schema12.String.check(Schema12.isPattern(new RegExp("^[a-fA-F0-9]{64}$", "u")));
|
|
2225
1484
|
var LoopGitCommitSha = Schema12.String.check(Schema12.isPattern(new RegExp("^[a-fA-F0-9]{40}$|^[a-fA-F0-9]{64}$", "u")));
|
|
2226
|
-
var
|
|
1485
|
+
var LoopCredentialContentPattern = "(?:^|[^A-Za-z0-9])sk-[A-Za-z0-9_-]{16,}|ghp_[A-Za-z0-9_]+|github_pat_[A-Za-z0-9_]+|glpat-[A-Za-z0-9_-]+|\\b[Bb][Ee][Aa][Rr][Ee][Rr]\\s+[A-Za-z0-9._~+/=-]+|eyJ[A-Za-z0-9_-]+\\.[A-Za-z0-9_-]+\\.[A-Za-z0-9_-]+";
|
|
1486
|
+
var LoopReferenceForbiddenContentPattern = `${LoopCredentialContentPattern}|[dD][iI][fF][fF]\\s+--git|[rR][aA][wW]\\s+(?:[tT][eE][rR][mM][iI][nN][aA][lL]\\s+)?[lL][oO][gG]s?|[tT][eE][rR][mM][iI][nN][aA][lL]\\s+[oO][uU][tT][pP][uU][tT]|[rR][aA][wW]\\s+[tT][rR][aA][nN][sS][cC][rR][iI][pP][tT]s?|[sS][oO][uU][rR][cC][eE]\\s+[cC][oO][dD][eE]|[fF][iI][lL][eE]\\s+[cC][oO][nN][tT][eE][nN][tT]`;
|
|
2227
1487
|
var LoopReferenceAndUrlForbiddenContentPattern = `${LoopReferenceForbiddenContentPattern}|[A-Za-z][A-Za-z0-9+.-]*://\\S+`;
|
|
2228
1488
|
var LoopSafeReferencePattern = `^(?!.*(?:${LoopReferenceAndUrlForbiddenContentPattern})).*$`;
|
|
2229
1489
|
var LoopScopeValueForbiddenContentPattern = LoopReferenceAndUrlForbiddenContentPattern;
|
|
@@ -2290,7 +1550,9 @@ var LoopForbiddenDataflowKeyRegExp = new RegExp(LoopForbiddenDataflowKeyPattern)
|
|
|
2290
1550
|
var LoopForbiddenContentRegExp = new RegExp(LoopReferenceAndUrlForbiddenContentPattern);
|
|
2291
1551
|
var LoopSafeReferenceString = Schema12.String.check(Schema12.isMinLength(1), Schema12.isMaxLength(240), Schema12.isPattern(new RegExp(LoopSafeReferencePattern, "u")));
|
|
2292
1552
|
var LoopSafeInternalReferenceString = Schema12.String.check(Schema12.isMinLength(1), Schema12.isMaxLength(240), Schema12.isPattern(new RegExp(LoopSafeInternalReferencePattern, "u")));
|
|
2293
|
-
var LoopSafeText = Schema12.String.check(Schema12.isMaxLength(4000), Schema12.isPattern(new RegExp(
|
|
1553
|
+
var LoopSafeText = Schema12.String.check(Schema12.isMaxLength(4000), Schema12.isPattern(new RegExp(`^(?![\\s\\S]*(?:${LoopCredentialContentPattern}|[A-Za-z][A-Za-z0-9+.-]*://(?:[^\\s/?#]*@|[^\\s?#]*\\?)))[\\s\\S]*$`, "u")));
|
|
1554
|
+
var recommendedDefault = (recommended) => recommended !== undefined && Schema12.is(LoopSafeText)(recommended) ? recommended : undefined;
|
|
1555
|
+
var QuestionText = Schema12.String;
|
|
2294
1556
|
var LoopSafeOutputDataString = Schema12.String.check(Schema12.isMaxLength(4000), Schema12.isPattern(new RegExp(LoopSafeInternalReferencePattern, "u")));
|
|
2295
1557
|
var LoopSafePackageName = Schema12.String.check(Schema12.isMinLength(1), Schema12.isMaxLength(200), Schema12.isPattern(new RegExp(LoopSafeReferencePattern, "u")));
|
|
2296
1558
|
var LoopSafeScopeValue = Schema12.String.check(Schema12.isMinLength(1), Schema12.isMaxLength(240), Schema12.isPattern(new RegExp(LoopSafeScopeValuePattern, "u")));
|
|
@@ -2598,6 +1860,14 @@ var RunWaiting = Schema12.Union([
|
|
|
2598
1860
|
kind: Schema12.Literal("verification"),
|
|
2599
1861
|
name: Schema12.String.check(Schema12.isMinLength(1)),
|
|
2600
1862
|
verificationId: Id
|
|
1863
|
+
}),
|
|
1864
|
+
Schema12.Struct({
|
|
1865
|
+
kind: Schema12.Literal("queue"),
|
|
1866
|
+
name: Schema12.String.check(Schema12.isMinLength(1)),
|
|
1867
|
+
workUnitId: Id,
|
|
1868
|
+
rank: Schema12.Literals(ClaimRanks),
|
|
1869
|
+
position: Schema12.Int.check(Schema12.isGreaterThanOrEqualTo(1)),
|
|
1870
|
+
reason: Schema12.String
|
|
2601
1871
|
})
|
|
2602
1872
|
]);
|
|
2603
1873
|
var RunEvidence = Schema12.Struct({
|
|
@@ -2620,6 +1890,7 @@ var ApprovedVerification = Schema12.Struct({
|
|
|
2620
1890
|
name: Schema12.String,
|
|
2621
1891
|
command: Schema12.String,
|
|
2622
1892
|
workingDirectory: Schema12.optionalKey(Schema12.String),
|
|
1893
|
+
pipeline: Schema12.optionalKey(Schema12.Boolean),
|
|
2623
1894
|
approvedByUserId: Schema12.String,
|
|
2624
1895
|
createdAt: Timestamp
|
|
2625
1896
|
});
|
|
@@ -2667,14 +1938,16 @@ var Run = Schema12.Struct({
|
|
|
2667
1938
|
taskId: Schema12.optionalKey(Id),
|
|
2668
1939
|
sessionId: Schema12.optionalKey(Id),
|
|
2669
1940
|
loopId: Id,
|
|
2670
|
-
|
|
1941
|
+
kitVersionId: Schema12.optionalKey(Id),
|
|
2671
1942
|
resourceVersion: Schema12.Int.check(Schema12.isGreaterThanOrEqualTo(1)),
|
|
2672
1943
|
status: RunStatus,
|
|
2673
1944
|
trigger: RunTrigger,
|
|
2674
1945
|
state: RunState,
|
|
2675
1946
|
loopDigest: Schema12.optionalKey(BundleDigest),
|
|
2676
1947
|
loopLayer: Schema12.optionalKey(Schema12.Literals(["team", "workspace", "shipped"])),
|
|
1948
|
+
loopVersion: Schema12.optionalKey(Schema12.String),
|
|
2677
1949
|
parentRunId: Schema12.optionalKey(Id),
|
|
1950
|
+
continuesRunId: Schema12.optionalKey(Id),
|
|
2678
1951
|
waiting: Schema12.optionalKey(Schema12.Array(RunWaiting)),
|
|
2679
1952
|
output: Schema12.optionalKey(Schema12.Unknown),
|
|
2680
1953
|
failureSummary: Schema12.optionalKey(Schema12.String),
|
|
@@ -2765,11 +2038,14 @@ var StepBrief = Schema12.Struct({
|
|
|
2765
2038
|
contentMarkdown: Schema12.String.check(Schema12.isMinLength(1))
|
|
2766
2039
|
})),
|
|
2767
2040
|
outputSchema: JsonDocumentObject,
|
|
2768
|
-
|
|
2769
|
-
name: Schema12.String.check(Schema12.
|
|
2770
|
-
|
|
2041
|
+
kits: Schema12.optionalKey(Schema12.Array(Schema12.Struct({
|
|
2042
|
+
name: Schema12.String.check(Schema12.isMinLength(1)),
|
|
2043
|
+
version: Schema12.String.check(Schema12.isMinLength(1)),
|
|
2044
|
+
setupDigest: Schema12.String.check(Schema12.isPattern(/^[a-f0-9]{64}$/u))
|
|
2771
2045
|
}))),
|
|
2772
|
-
toolless: Schema12.optionalKey(Schema12.Literal(true))
|
|
2046
|
+
toolless: Schema12.optionalKey(Schema12.Literal(true)),
|
|
2047
|
+
tools: Schema12.optionalKey(Schema12.Array(Schema12.Literals(AgentCapabilities))),
|
|
2048
|
+
listedSkills: Schema12.optionalKey(Schema12.Array(Schema12.String.check(Schema12.isMinLength(1))))
|
|
2773
2049
|
});
|
|
2774
2050
|
var StepOutputSubmission = Schema12.Struct({ output: JsonDocumentObject });
|
|
2775
2051
|
var StepSessionUpdate = Schema12.Struct({
|
|
@@ -2795,6 +2071,15 @@ var StepOutputSubmissionResult = Schema12.Union([
|
|
|
2795
2071
|
}),
|
|
2796
2072
|
Schema12.Struct({ status: Schema12.Literal("failed"), message: Schema12.String })
|
|
2797
2073
|
]);
|
|
2074
|
+
var HarnessHoldReasons = ["out_of_quota", "failed_to_start"];
|
|
2075
|
+
var SkippedChoiceReasons = ["not_on_runner", ...HarnessHoldReasons];
|
|
2076
|
+
var SkippedChoice = Schema12.Struct({
|
|
2077
|
+
harness: Schema12.optionalKey(Schema12.String),
|
|
2078
|
+
model: Schema12.optionalKey(Schema12.String),
|
|
2079
|
+
effort: Schema12.optionalKey(Schema12.Literals(AgentEfforts)),
|
|
2080
|
+
reason: Schema12.Literals(SkippedChoiceReasons),
|
|
2081
|
+
until: Schema12.optionalKey(Timestamp)
|
|
2082
|
+
});
|
|
2798
2083
|
var StepAttempt = Schema12.Struct({
|
|
2799
2084
|
id: Id,
|
|
2800
2085
|
workspaceId: Id,
|
|
@@ -2815,6 +2100,7 @@ var StepAttempt = Schema12.Struct({
|
|
|
2815
2100
|
brief: Schema12.optionalKey(StepBrief),
|
|
2816
2101
|
failureSummary: Schema12.optionalKey(LoopSafeText),
|
|
2817
2102
|
reviewEvidence: Schema12.Array(LoopSafeRef),
|
|
2103
|
+
skippedChoices: Schema12.optionalKey(Schema12.Array(SkippedChoice)),
|
|
2818
2104
|
lease: Schema12.optionalKey(StepAttemptLease),
|
|
2819
2105
|
claimIdempotencyKey: Schema12.optionalKey(LoopSafeReferenceString),
|
|
2820
2106
|
terminalIdempotencyKey: Schema12.optionalKey(LoopSafeReferenceString),
|
|
@@ -2830,7 +2116,8 @@ var QuestionResponderPolicy = Schema12.Struct({
|
|
|
2830
2116
|
});
|
|
2831
2117
|
var QuestionAnswer = Schema12.Struct({
|
|
2832
2118
|
value: LoopSafeText,
|
|
2833
|
-
answeredByUserId: Id,
|
|
2119
|
+
answeredByUserId: Schema12.optionalKey(Id),
|
|
2120
|
+
byDefault: Schema12.optionalKey(Schema12.Boolean),
|
|
2834
2121
|
answeredAt: Timestamp,
|
|
2835
2122
|
idempotencyKey: Schema12.String.check(Schema12.isMinLength(1), Schema12.isMaxLength(240))
|
|
2836
2123
|
});
|
|
@@ -2843,9 +2130,15 @@ var Question = Schema12.Struct({
|
|
|
2843
2130
|
stepKey: Schema12.String.check(Schema12.isMinLength(1), Schema12.isMaxLength(240)),
|
|
2844
2131
|
waitId: Id,
|
|
2845
2132
|
taskThreadEntryId: Schema12.optionalKey(Id),
|
|
2846
|
-
prompt:
|
|
2847
|
-
options: Schema12.optionalKey(Schema12.Array(
|
|
2133
|
+
prompt: QuestionText,
|
|
2134
|
+
options: Schema12.optionalKey(Schema12.Array(QuestionText)),
|
|
2848
2135
|
freeText: Schema12.optionalKey(Schema12.Boolean),
|
|
2136
|
+
optionDescriptions: Schema12.optionalKey(Schema12.Record(Schema12.String, QuestionText)),
|
|
2137
|
+
recommended: Schema12.optionalKey(QuestionText),
|
|
2138
|
+
recommendationReason: Schema12.optionalKey(QuestionText),
|
|
2139
|
+
informationOnly: Schema12.optionalKey(Schema12.Boolean),
|
|
2140
|
+
default: Schema12.optionalKey(LoopSafeText),
|
|
2141
|
+
defaultAt: Schema12.optionalKey(Timestamp),
|
|
2849
2142
|
responderPolicy: QuestionResponderPolicy,
|
|
2850
2143
|
status: QuestionStatus,
|
|
2851
2144
|
answer: Schema12.optionalKey(QuestionAnswer),
|
|
@@ -2876,8 +2169,11 @@ var RunStart = Schema12.Struct({
|
|
|
2876
2169
|
input: Schema12.optionalKey(Schema12.Record(Schema12.String, Schema12.Unknown)),
|
|
2877
2170
|
context: Schema12.optionalKey(RunLaunchContext),
|
|
2878
2171
|
devVersionId: Schema12.optionalKey(Id),
|
|
2879
|
-
constraints: Schema12.optionalKey(Schema12.Array(Schema12.String.check(Schema12.isMinLength(1), Schema12.isMaxLength(1000))).check(Schema12.isMaxLength(20)))
|
|
2172
|
+
constraints: Schema12.optionalKey(Schema12.Array(Schema12.String.check(Schema12.isMinLength(1), Schema12.isMaxLength(1000))).check(Schema12.isMaxLength(20))),
|
|
2173
|
+
fresh: Schema12.optionalKey(Schema12.Boolean),
|
|
2174
|
+
overrideBlockers: Schema12.optionalKey(Schema12.Boolean)
|
|
2880
2175
|
});
|
|
2176
|
+
var RunActionTake = Schema12.Struct({ overrideBlockers: Schema12.optionalKey(Schema12.Boolean) });
|
|
2881
2177
|
var RunStarted = Schema12.Struct({
|
|
2882
2178
|
run: Run,
|
|
2883
2179
|
task: Schema12.optionalKey(Schema12.Struct({ id: Id, taskKey: Schema12.String })),
|
|
@@ -2917,6 +2213,12 @@ var RunSteerInput = Schema12.Struct({
|
|
|
2917
2213
|
stepAttemptId: Schema12.optionalKey(Id),
|
|
2918
2214
|
idempotencyKey: Schema12.String.check(Schema12.isMinLength(1), Schema12.isMaxLength(240))
|
|
2919
2215
|
});
|
|
2216
|
+
var RunResumeInput = Schema12.Struct({
|
|
2217
|
+
steer: Schema12.optionalKey(Schema12.Struct({
|
|
2218
|
+
text: LoopSafeText,
|
|
2219
|
+
idempotencyKey: Schema12.String.check(Schema12.isMinLength(1), Schema12.isMaxLength(240))
|
|
2220
|
+
}))
|
|
2221
|
+
});
|
|
2920
2222
|
var RunSteerSent = Schema12.Struct({
|
|
2921
2223
|
steer: RunSteer,
|
|
2922
2224
|
target: Schema12.Literals(["session", "next_step"])
|
|
@@ -2983,7 +2285,13 @@ var RunShow = Schema12.Struct({
|
|
|
2983
2285
|
graph: RunGraph,
|
|
2984
2286
|
steps: Schema12.Array(RunStepSummary),
|
|
2985
2287
|
questions: Schema12.Array(Question),
|
|
2986
|
-
children: Schema12.Array(Schema12.Struct({
|
|
2288
|
+
children: Schema12.Array(Schema12.Struct({
|
|
2289
|
+
runId: Id,
|
|
2290
|
+
name: Schema12.String,
|
|
2291
|
+
status: RunStatus,
|
|
2292
|
+
createdAt: Timestamp,
|
|
2293
|
+
unsettled: Schema12.optional(Schema12.Array(Schema12.String))
|
|
2294
|
+
})),
|
|
2987
2295
|
activities: Schema12.Array(Schema12.Struct({
|
|
2988
2296
|
name: Schema12.String,
|
|
2989
2297
|
attempt: Schema12.Int.check(Schema12.isGreaterThanOrEqualTo(1)),
|
|
@@ -3003,6 +2311,8 @@ var RunStartPreview = Schema12.Struct({
|
|
|
3003
2311
|
inputSchema: Schema12.Record(Schema12.String, Schema12.Unknown),
|
|
3004
2312
|
input: Schema12.Record(Schema12.String, Schema12.Unknown),
|
|
3005
2313
|
missing: Schema12.Array(Schema12.String),
|
|
2314
|
+
message: Schema12.optionalKey(Schema12.String),
|
|
2315
|
+
waitingOn: Schema12.optionalKey(WaitingOn),
|
|
3006
2316
|
teamId: Schema12.optionalKey(Id),
|
|
3007
2317
|
inferred: Schema12.Struct({
|
|
3008
2318
|
repoBindingId: Schema12.optionalKey(Id),
|
|
@@ -3012,15 +2322,22 @@ var RunStartPreview = Schema12.Struct({
|
|
|
3012
2322
|
outcome: Schema12.optionalKey(Schema12.String)
|
|
3013
2323
|
})
|
|
3014
2324
|
});
|
|
2325
|
+
var LoopVersion = Schema12.String.check(Schema12.isPattern(/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/));
|
|
3015
2326
|
var ProgramLoop = Schema12.Struct({
|
|
3016
2327
|
id: Schema12.String,
|
|
3017
2328
|
title: Schema12.String,
|
|
2329
|
+
version: Schema12.optionalKey(LoopVersion),
|
|
3018
2330
|
layer: Schema12.Literals(["team", "workspace", "shipped"]),
|
|
3019
2331
|
digest: Schema12.String,
|
|
3020
2332
|
outcome: Schema12.optionalKey(Schema12.String),
|
|
3021
|
-
offers: Schema12.Array(Schema12.Struct({
|
|
2333
|
+
offers: Schema12.Array(Schema12.Struct({
|
|
2334
|
+
id: Schema12.String,
|
|
2335
|
+
title: Schema12.String,
|
|
2336
|
+
loop: Schema12.String,
|
|
2337
|
+
from: Schema12.optionalKey(Schema12.String)
|
|
2338
|
+
})),
|
|
3022
2339
|
publishedAt: Timestamp,
|
|
3023
|
-
|
|
2340
|
+
kit: Schema12.String
|
|
3024
2341
|
});
|
|
3025
2342
|
var AutomaticStart = Schema12.Struct({
|
|
3026
2343
|
eventId: Schema12.String,
|
|
@@ -3032,16 +2349,23 @@ var AutomaticStart = Schema12.Struct({
|
|
|
3032
2349
|
at: Schema12.String
|
|
3033
2350
|
});
|
|
3034
2351
|
var AutomaticStartList = Schema12.Struct({ items: Schema12.Array(AutomaticStart) });
|
|
2352
|
+
var AgentFallback = Schema12.Struct({
|
|
2353
|
+
harness: Schema12.String,
|
|
2354
|
+
model: Schema12.optionalKey(Schema12.String),
|
|
2355
|
+
effort: Schema12.optionalKey(Schema12.Literals(AgentEfforts))
|
|
2356
|
+
});
|
|
3035
2357
|
var ProgramAgent = Schema12.Struct({
|
|
3036
2358
|
id: Schema12.String,
|
|
3037
2359
|
layer: Schema12.Literals(["team", "workspace", "shipped"]),
|
|
3038
|
-
|
|
2360
|
+
kit: Schema12.String,
|
|
3039
2361
|
extends: Schema12.optionalKey(Schema12.String),
|
|
3040
2362
|
instructions: Schema12.optionalKey(Schema12.String),
|
|
3041
2363
|
harness: Schema12.optionalKey(Schema12.String),
|
|
3042
2364
|
model: Schema12.optionalKey(Schema12.String),
|
|
3043
2365
|
effort: Schema12.optionalKey(Schema12.Literals(AgentEfforts)),
|
|
3044
|
-
|
|
2366
|
+
fallbacks: Schema12.optionalKey(Schema12.Array(AgentFallback)),
|
|
2367
|
+
tools: Schema12.optionalKey(Schema12.Array(Schema12.Literals(AgentCapabilities))),
|
|
2368
|
+
skills: Schema12.optionalKey(Schema12.Array(Schema12.String)),
|
|
3045
2369
|
network: Schema12.optionalKey(AgentSandboxNetwork),
|
|
3046
2370
|
sandbox: Schema12.optionalKey(Schema12.Literal("docker")),
|
|
3047
2371
|
fieldLayers: Schema12.optionalKey(Schema12.Struct({
|
|
@@ -3049,7 +2373,9 @@ var ProgramAgent = Schema12.Struct({
|
|
|
3049
2373
|
harness: Schema12.optionalKey(Schema12.Literals(LoopLayers)),
|
|
3050
2374
|
model: Schema12.optionalKey(Schema12.Literals(LoopLayers)),
|
|
3051
2375
|
effort: Schema12.optionalKey(Schema12.Literals(LoopLayers)),
|
|
3052
|
-
|
|
2376
|
+
fallbacks: Schema12.optionalKey(Schema12.Literals(LoopLayers)),
|
|
2377
|
+
tools: Schema12.optionalKey(Schema12.Literals(LoopLayers)),
|
|
2378
|
+
skills: Schema12.optionalKey(Schema12.Literals(LoopLayers)),
|
|
3053
2379
|
network: Schema12.optionalKey(Schema12.Literals(LoopLayers)),
|
|
3054
2380
|
sandbox: Schema12.optionalKey(Schema12.Literals(LoopLayers))
|
|
3055
2381
|
}))
|
|
@@ -3171,7 +2497,7 @@ var ScheduleVersion = Schema13.Struct({
|
|
|
3171
2497
|
var zones = new Map;
|
|
3172
2498
|
var resolvedLocalDateTimes = new Map;
|
|
3173
2499
|
|
|
3174
|
-
// packages/core/src/
|
|
2500
|
+
// packages/core/src/kit-declarations.ts
|
|
3175
2501
|
var LoopCapabilities2 = [
|
|
3176
2502
|
"agent_work",
|
|
3177
2503
|
"ask",
|
|
@@ -3182,33 +2508,40 @@ var LoopCapabilities2 = [
|
|
|
3182
2508
|
"post_comment",
|
|
3183
2509
|
"create_tasks",
|
|
3184
2510
|
"merge_change_request",
|
|
2511
|
+
"approve_change_request",
|
|
3185
2512
|
"publish_release",
|
|
3186
2513
|
"read_transcripts",
|
|
2514
|
+
"read_change_request",
|
|
2515
|
+
"measure",
|
|
2516
|
+
"claim",
|
|
3187
2517
|
"propose",
|
|
3188
2518
|
"read_project",
|
|
3189
2519
|
"draft_update"
|
|
3190
2520
|
];
|
|
3191
2521
|
var JsonObject2 = Schema14.Record(Schema14.String, Schema14.Json);
|
|
3192
|
-
var recordKeyedBy = (pattern, value) => Schema14.Record(Schema14.String, value).check(Schema14.makeFilter((record) => {
|
|
3193
|
-
const bad = Object.keys(record).find((key) => !new RegExp(pattern).test(key));
|
|
3194
|
-
return bad === undefined ? true : `${JSON.stringify(bad)} is not a valid name or relative path`;
|
|
3195
|
-
}));
|
|
3196
2522
|
var SecretName = Schema14.String.check(Schema14.isPattern(/^[A-Za-z_][A-Za-z0-9_]{0,127}$/));
|
|
3197
2523
|
var EventFilterValue = Schema14.Union([Schema14.String, Schema14.Finite, Schema14.Boolean, Schema14.Null]);
|
|
3198
2524
|
var LoopManifest = Schema14.Struct({
|
|
3199
2525
|
id: Schema14.String,
|
|
3200
2526
|
title: Schema14.String,
|
|
2527
|
+
version: Schema14.optionalKey(LoopVersion),
|
|
3201
2528
|
input: JsonObject2,
|
|
3202
2529
|
output: JsonObject2,
|
|
3203
|
-
outcome: Schema14.optionalKey(Schema14.Literals(["feature", "bug", "refactor", "investigation", "docs", "migration"])),
|
|
2530
|
+
outcome: Schema14.optionalKey(Schema14.Literals(["feature", "bug", "refactor", "investigation", "docs", "migration", "performance"])),
|
|
3204
2531
|
agents: Schema14.Record(Schema14.String, Schema14.String),
|
|
3205
2532
|
checkout: Schema14.Literals(["none", "read", "write"]),
|
|
3206
2533
|
when: Schema14.Array(Schema14.Struct({
|
|
3207
2534
|
event: Schema14.String,
|
|
3208
2535
|
filter: Schema14.optionalKey(Schema14.Record(Schema14.String, Schema14.Union([EventFilterValue, Schema14.Array(EventFilterValue)]))),
|
|
3209
|
-
input: Schema14.Record(Schema14.String, Schema14.String)
|
|
2536
|
+
input: Schema14.Record(Schema14.String, Schema14.String),
|
|
2537
|
+
values: Schema14.optionalKey(JsonObject2)
|
|
2538
|
+
})),
|
|
2539
|
+
offers: Schema14.Array(Schema14.Struct({
|
|
2540
|
+
id: Schema14.String,
|
|
2541
|
+
title: Schema14.String,
|
|
2542
|
+
loop: Schema14.String,
|
|
2543
|
+
from: Schema14.optionalKey(Schema14.String)
|
|
3210
2544
|
})),
|
|
3211
|
-
offers: Schema14.Array(Schema14.Struct({ id: Schema14.String, title: Schema14.String, loop: Schema14.String })),
|
|
3212
2545
|
capabilities: Schema14.Array(Schema14.Literals(LoopCapabilities2)),
|
|
3213
2546
|
secrets: Schema14.optionalKey(Schema14.Array(SecretName)),
|
|
3214
2547
|
network: Schema14.optionalKey(AgentSandboxNetwork),
|
|
@@ -3234,7 +2567,9 @@ var AgentDeclaration = Schema14.Struct({
|
|
|
3234
2567
|
harness: Schema14.optionalKey(Schema14.String),
|
|
3235
2568
|
model: Schema14.optionalKey(Schema14.String),
|
|
3236
2569
|
effort: Schema14.optionalKey(Schema14.Literals(AgentEfforts)),
|
|
3237
|
-
|
|
2570
|
+
fallbacks: Schema14.optionalKey(Schema14.Array(AgentFallback)),
|
|
2571
|
+
tools: Schema14.optionalKey(Schema14.Array(Schema14.Literals(AgentCapabilities))),
|
|
2572
|
+
skills: Schema14.optionalKey(Schema14.Array(Schema14.String.check(Schema14.isMinLength(1)))),
|
|
3238
2573
|
network: Schema14.optionalKey(Schema14.Union([Schema14.Struct({ hosts: Schema14.Array(Schema14.String) }), Schema14.Literal("open")])),
|
|
3239
2574
|
sandbox: Schema14.optionalKey(Schema14.Literal("docker"))
|
|
3240
2575
|
});
|
|
@@ -3259,32 +2594,18 @@ var ScheduleDeclaration = Schema14.Union([
|
|
|
3259
2594
|
})
|
|
3260
2595
|
})
|
|
3261
2596
|
]);
|
|
3262
|
-
var
|
|
3263
|
-
name:
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
});
|
|
3269
|
-
var
|
|
3270
|
-
source: Schema14.String.check(Schema14.isMinLength(1)),
|
|
3271
|
-
version: Schema14.optionalKey(Schema14.String)
|
|
3272
|
-
});
|
|
3273
|
-
var KitAssignmentDeclaration = Schema14.Struct({
|
|
3274
|
-
kit: Schema14.String.check(Schema14.isMinLength(1)),
|
|
3275
|
-
workspace: Schema14.optionalKey(Schema14.Literals(["default", "mandatory"])),
|
|
3276
|
-
teams: Schema14.optionalKey(Schema14.Array(Schema14.String))
|
|
3277
|
-
});
|
|
3278
|
-
var KitDeclaration = Schema14.Union([
|
|
3279
|
-
KitInstallationDeclaration,
|
|
3280
|
-
KitAssignmentDeclaration,
|
|
3281
|
-
AuthoredKitDeclaration
|
|
3282
|
-
]);
|
|
3283
|
-
var PackageDeclarations = Schema14.Struct({
|
|
2597
|
+
var CarriedKit = Schema14.Struct({
|
|
2598
|
+
name: KitName,
|
|
2599
|
+
version: Schema14.String.check(Schema14.isMinLength(1)),
|
|
2600
|
+
setup: KitDigest,
|
|
2601
|
+
loops: Schema14.Array(Schema14.String),
|
|
2602
|
+
agents: Schema14.Array(Schema14.String)
|
|
2603
|
+
});
|
|
2604
|
+
var KitDeclarations = Schema14.Struct({
|
|
3284
2605
|
loops: Schema14.Array(LoopManifest),
|
|
3285
2606
|
agents: Schema14.Record(Schema14.String, AgentDeclaration),
|
|
3286
2607
|
schedules: Schema14.optionalKey(Schema14.Record(Schema14.String, ScheduleDeclaration)),
|
|
3287
|
-
|
|
2608
|
+
carried: Schema14.optionalKey(Schema14.Array(CarriedKit))
|
|
3288
2609
|
});
|
|
3289
2610
|
var sameLoop = Schema14.toEquivalence(LoopManifest);
|
|
3290
2611
|
var sameAgent = Schema14.toEquivalence(AgentDeclaration);
|
|
@@ -3292,7 +2613,33 @@ var sameAgent = Schema14.toEquivalence(AgentDeclaration);
|
|
|
3292
2613
|
// packages/sdk/src/loop/define.ts
|
|
3293
2614
|
import * as Effect2 from "effect/Effect";
|
|
3294
2615
|
import * as Schema15 from "effect/Schema";
|
|
3295
|
-
var LoopOutcome2 = Schema15.Literals([
|
|
2616
|
+
var LoopOutcome2 = Schema15.Literals([
|
|
2617
|
+
"feature",
|
|
2618
|
+
"bug",
|
|
2619
|
+
"refactor",
|
|
2620
|
+
"investigation",
|
|
2621
|
+
"docs",
|
|
2622
|
+
"migration",
|
|
2623
|
+
"performance"
|
|
2624
|
+
]);
|
|
2625
|
+
var capabilitiesOf2 = (loop) => {
|
|
2626
|
+
const seen = new Set;
|
|
2627
|
+
const granted = new Set;
|
|
2628
|
+
const visit = (current) => {
|
|
2629
|
+
if (seen.has(current))
|
|
2630
|
+
return;
|
|
2631
|
+
seen.add(current);
|
|
2632
|
+
for (const capability of current.capabilities)
|
|
2633
|
+
granted.add(capability);
|
|
2634
|
+
const called = current.calls?.() ?? [];
|
|
2635
|
+
if (called.length > 0)
|
|
2636
|
+
granted.add("call");
|
|
2637
|
+
for (const child of called)
|
|
2638
|
+
visit(child);
|
|
2639
|
+
};
|
|
2640
|
+
visit(loop);
|
|
2641
|
+
return [...granted];
|
|
2642
|
+
};
|
|
3296
2643
|
var defineLoop2 = (definition) => definition;
|
|
3297
2644
|
|
|
3298
2645
|
class ManifestInvalid2 extends Schema15.TaggedError()("ManifestInvalid", {
|
|
@@ -3313,9 +2660,15 @@ var declarationsAreData = (definition) => Schema15.decodeEffect(JsonObjectSchema
|
|
|
3313
2660
|
}).pipe(Effect2.mapError((error) => new ManifestInvalid2({ loop: definition.id, message: `Declarations must be data: ${error.message}` })));
|
|
3314
2661
|
var loopManifest2 = (definition) => Effect2.gen(function* () {
|
|
3315
2662
|
yield* declarationsAreData(definition);
|
|
2663
|
+
if (definition.version !== undefined && !Schema15.is(LoopVersion)(definition.version))
|
|
2664
|
+
return yield* new ManifestInvalid2({
|
|
2665
|
+
loop: definition.id,
|
|
2666
|
+
message: `version "${String(definition.version)}" is not semver, such as 2.0.0`
|
|
2667
|
+
});
|
|
3316
2668
|
return {
|
|
3317
2669
|
id: definition.id,
|
|
3318
2670
|
title: definition.title,
|
|
2671
|
+
...definition.version === undefined ? undefined : { version: definition.version },
|
|
3319
2672
|
input: yield* jsonSchemaOf2(definition.id, definition.input),
|
|
3320
2673
|
output: yield* jsonSchemaOf2(definition.id, definition.output),
|
|
3321
2674
|
...definition.outcome === undefined ? undefined : { outcome: definition.outcome },
|
|
@@ -3323,7 +2676,7 @@ var loopManifest2 = (definition) => Effect2.gen(function* () {
|
|
|
3323
2676
|
checkout: definition.checkout,
|
|
3324
2677
|
when: definition.when ?? [],
|
|
3325
2678
|
offers: definition.offers ?? [],
|
|
3326
|
-
capabilities: definition
|
|
2679
|
+
capabilities: capabilitiesOf2(definition),
|
|
3327
2680
|
...definition.secrets === undefined ? undefined : { secrets: definition.secrets },
|
|
3328
2681
|
...definition.network === undefined ? undefined : { network: definition.network },
|
|
3329
2682
|
...definition.schedule === undefined ? undefined : { schedule: definition.schedule }
|
|
@@ -3338,6 +2691,39 @@ import * as Exit2 from "effect/Exit";
|
|
|
3338
2691
|
import * as Schema17 from "effect/Schema";
|
|
3339
2692
|
import { Activity, DurableDeferred } from "effect/workflow";
|
|
3340
2693
|
|
|
2694
|
+
// packages/core/src/question-recommendation.ts
|
|
2695
|
+
var optionValue = (option) => isString2(option) ? option : option.value;
|
|
2696
|
+
var splitQuestionOptions = (options) => {
|
|
2697
|
+
const descriptions = Object.fromEntries(options.flatMap((option) => isString2(option) || option.description === undefined || option.description.trim() === "" ? [] : [[option.value, option.description]]));
|
|
2698
|
+
return {
|
|
2699
|
+
options: options.map(optionValue),
|
|
2700
|
+
...Object.keys(descriptions).length === 0 ? undefined : { optionDescriptions: descriptions }
|
|
2701
|
+
};
|
|
2702
|
+
};
|
|
2703
|
+
var recommendationProblem = (question) => {
|
|
2704
|
+
const options = question.options?.map(optionValue);
|
|
2705
|
+
const reason = question.recommendationReason?.trim() ?? "";
|
|
2706
|
+
const recommended = question.recommended?.trim() ?? "";
|
|
2707
|
+
if (question.informationOnly === true) {
|
|
2708
|
+
if (options !== undefined)
|
|
2709
|
+
return "A Question with options always has one to recommend: set `recommended` to one of them, and drop `informationOnly`.";
|
|
2710
|
+
if (recommended !== "")
|
|
2711
|
+
return "A Question that recommends an answer is not `informationOnly`: drop `informationOnly`.";
|
|
2712
|
+
return reason === "" ? "Say in `recommendationReason` why you cannot suggest an answer, such as that only the person knows the secret\u2019s name." : undefined;
|
|
2713
|
+
}
|
|
2714
|
+
if (recommended === "")
|
|
2715
|
+
return `Add \`recommended\`: the answer you would pick${options === undefined ? ", as a suggested free-text answer" : `, one of: ${options.join(", ")}`}. Add \`recommendationReason\` too, in one or two sentences. Only a Question that purely asks for information you cannot guess, such as a secret's name, may set \`informationOnly\` instead and say why in \`recommendationReason\`.`;
|
|
2716
|
+
if (options !== undefined && !options.includes(question.recommended ?? ""))
|
|
2717
|
+
return `The recommended answer "${question.recommended}" is not one of the options: ${options.join(", ")}.`;
|
|
2718
|
+
return reason === "" ? "Add `recommendationReason`: why you recommend that answer, in one or two sentences." : undefined;
|
|
2719
|
+
};
|
|
2720
|
+
var questionAdvice = (question) => ({
|
|
2721
|
+
...question.optionDescriptions === undefined ? undefined : { optionDescriptions: question.optionDescriptions },
|
|
2722
|
+
...question.recommended === undefined ? undefined : { recommended: question.recommended },
|
|
2723
|
+
...question.recommendationReason === undefined ? undefined : { recommendationReason: question.recommendationReason },
|
|
2724
|
+
...question.informationOnly === true ? { informationOnly: true } : undefined
|
|
2725
|
+
});
|
|
2726
|
+
|
|
3341
2727
|
// packages/sdk/src/loop/evidence.ts
|
|
3342
2728
|
import * as Schema16 from "effect/Schema";
|
|
3343
2729
|
var EvidenceCheck2 = Schema16.Struct({
|
|
@@ -3346,12 +2732,15 @@ var EvidenceCheck2 = Schema16.Struct({
|
|
|
3346
2732
|
status: Schema16.Literals(["passed", "failed"]),
|
|
3347
2733
|
preExisting: Schema16.Boolean,
|
|
3348
2734
|
durationMs: Schema16.Finite,
|
|
3349
|
-
evidenceId: Schema16.String
|
|
2735
|
+
evidenceId: Schema16.String,
|
|
2736
|
+
outputTail: Schema16.optionalKey(Schema16.String),
|
|
2737
|
+
suggested: Schema16.optionalKey(Schema16.Boolean)
|
|
3350
2738
|
});
|
|
3351
2739
|
var VerifyResult2 = Schema16.Struct({
|
|
3352
2740
|
revision: Schema16.String,
|
|
3353
2741
|
tree: Schema16.String,
|
|
3354
2742
|
passed: Schema16.Boolean,
|
|
2743
|
+
unchanged: Schema16.optionalKey(Schema16.Boolean),
|
|
3355
2744
|
checks: Schema16.Array(EvidenceCheck2)
|
|
3356
2745
|
});
|
|
3357
2746
|
var OutcomeTable2 = {
|
|
@@ -3361,16 +2750,18 @@ var OutcomeTable2 = {
|
|
|
3361
2750
|
investigation: "A conclusion Output with its sources; no patch needed",
|
|
3362
2751
|
docs: "The documented commands run",
|
|
3363
2752
|
migration: "A rollback check passes",
|
|
2753
|
+
performance: "A kept final measurement against the merge base shows a gain, and approved verifications pass on the head",
|
|
3364
2754
|
none: "Only the approved verifications"
|
|
3365
2755
|
};
|
|
3366
2756
|
var verdict = (reasons) => reasons.length === 0 ? { settled: true } : { settled: false, reasons };
|
|
3367
2757
|
var missing = (side) => `No verification evidence for the ${side}`;
|
|
2758
|
+
var failsOn2 = (side, name, tree) => `${name} fails on the ${side} tree ${tree}`;
|
|
3368
2759
|
var allPass = (side, result) => {
|
|
3369
2760
|
if (result === undefined)
|
|
3370
2761
|
return [missing(side)];
|
|
3371
2762
|
if (result.checks.length === 0)
|
|
3372
2763
|
return [`No approved verification ran on the ${side} tree ${result.tree}`];
|
|
3373
|
-
return result.checks.filter((check) => check.status === "failed" && !check.preExisting).map((check) =>
|
|
2764
|
+
return result.checks.filter((check) => check.status === "failed" && !check.preExisting).map((check) => failsOn2(side, check.name, result.tree));
|
|
3374
2765
|
};
|
|
3375
2766
|
var checkOn = (side, result, name) => {
|
|
3376
2767
|
if (result === undefined)
|
|
@@ -3384,14 +2775,14 @@ var passesOnHead = (head, name) => {
|
|
|
3384
2775
|
const { found, reason } = checkOn("head", head, name);
|
|
3385
2776
|
if (found === undefined)
|
|
3386
2777
|
return [reason];
|
|
3387
|
-
return found.status === "passed" ? [] : [
|
|
2778
|
+
return found.status === "passed" ? [] : [failsOn2("head", found.name, head?.tree)];
|
|
3388
2779
|
};
|
|
3389
2780
|
var bugReasons = (input) => {
|
|
3390
2781
|
const base = checkOn("base", input.base, input.reproducing);
|
|
3391
2782
|
const head = checkOn("head", input.head, input.reproducing);
|
|
3392
2783
|
return [
|
|
3393
2784
|
...base.found === undefined ? [base.reason] : base.found.status === "failed" ? [] : [`${base.found.name} does not fail on the base tree ${input.base?.tree}, so the bug is not reproduced`],
|
|
3394
|
-
...head.found === undefined ? [head.reason] : head.found.status === "passed" ? [] : [
|
|
2785
|
+
...head.found === undefined ? [head.reason] : head.found.status === "passed" ? [] : [failsOn2("head", head.found.name, input.head?.tree)]
|
|
3395
2786
|
];
|
|
3396
2787
|
};
|
|
3397
2788
|
var conclusionReasons = (conclusion) => {
|
|
@@ -3420,6 +2811,11 @@ var evidenceGate2 = (input) => {
|
|
|
3420
2811
|
return verdict((input.documented ?? []).length === 0 ? ["No documented command was named"] : (input.documented ?? []).flatMap((name) => passesOnHead(input.head, name)));
|
|
3421
2812
|
case "migration":
|
|
3422
2813
|
return verdict(passesOnHead(input.head, input.rollback));
|
|
2814
|
+
case "performance":
|
|
2815
|
+
return verdict([
|
|
2816
|
+
...input.measurement === undefined ? ["No final measurement against the merge base was kept"] : input.measurement.verdict === "gain" ? [] : [`The final measurement is ${input.measurement.verdict}: ${input.measurement.reason}`],
|
|
2817
|
+
...allPass("head", input.head)
|
|
2818
|
+
]);
|
|
3423
2819
|
default:
|
|
3424
2820
|
return verdict(allPass("head", input.head));
|
|
3425
2821
|
}
|
|
@@ -3454,6 +2850,12 @@ class WaitTimedOut2 extends Schema17.TaggedError()("WaitTimedOut", {
|
|
|
3454
2850
|
}) {
|
|
3455
2851
|
}
|
|
3456
2852
|
|
|
2853
|
+
class ChangeRequestClosed2 extends Schema17.TaggedError()("ChangeRequestClosed", {
|
|
2854
|
+
step: Schema17.String,
|
|
2855
|
+
merged: Schema17.Boolean
|
|
2856
|
+
}) {
|
|
2857
|
+
}
|
|
2858
|
+
|
|
3457
2859
|
class ChildFailed2 extends Schema17.TaggedError()("ChildFailed", {
|
|
3458
2860
|
step: Schema17.String,
|
|
3459
2861
|
loop: Schema17.String,
|
|
@@ -3491,7 +2893,9 @@ class LoopRun2 extends Context.Service()("@kitman-sh/sdk/loop/LoopRun") {
|
|
|
3491
2893
|
|
|
3492
2894
|
class LoopHost2 extends Context.Service()("@kitman-sh/sdk/loop/LoopHost") {
|
|
3493
2895
|
}
|
|
3494
|
-
var
|
|
2896
|
+
var agentDeferredNamed2 = (deferredName) => DurableDeferred.make(deferredName, { success: Schema17.Json, error: StepFailed2 });
|
|
2897
|
+
var agentWorkDeferred2 = (step) => agentDeferredNamed2(`agent_work/${step}`);
|
|
2898
|
+
var syncDeferred2 = (step) => agentDeferredNamed2(`sync/${step}`);
|
|
3495
2899
|
var answerDeferred2 = (step) => DurableDeferred.make(`ask/${step}`, { success: Schema17.String, error: StepFailed2 });
|
|
3496
2900
|
var childDeferred2 = (step) => DurableDeferred.make(`call/${step}`, { success: Schema17.Json, error: ChildFailed2 });
|
|
3497
2901
|
var eventDeferred2 = (step) => DurableDeferred.make(`wait_for/${step}`, { success: LoopEvent2, error: WaitTimedOut2 });
|
|
@@ -3516,7 +2920,7 @@ var takeStep2 = (name, kind, capability, body) => Effect3.gen(function* () {
|
|
|
3516
2920
|
run.steps.push(record);
|
|
3517
2921
|
})));
|
|
3518
2922
|
});
|
|
3519
|
-
var
|
|
2923
|
+
var launch2 = (deferred, start) => Activity.make({
|
|
3520
2924
|
name: deferred.name,
|
|
3521
2925
|
error: StepFailed2,
|
|
3522
2926
|
execute: Effect3.gen(function* () {
|
|
@@ -3524,7 +2928,8 @@ var launch = (deferred, start) => Activity.make({
|
|
|
3524
2928
|
})
|
|
3525
2929
|
});
|
|
3526
2930
|
var toJson = (step, schema, value) => Schema17.encodeUnknownEffect(Schema17.toCodecJson(schema))(value).pipe(Effect3.flatMap(Schema17.decodeUnknownEffect(Schema17.Json)), Effect3.mapError((error) => new StepFailed2({ step, reason: error.message })));
|
|
3527
|
-
var agentWork2 = (name, options) =>
|
|
2931
|
+
var agentWork2 = (name, options) => agentWorkAs2(agentWorkDeferred2, name, options);
|
|
2932
|
+
var agentWorkAs2 = (deferredOf, name, options) => takeStep2(name, "agent_work", "agent_work", Effect3.gen(function* () {
|
|
3528
2933
|
const run = yield* LoopRun2;
|
|
3529
2934
|
const agent = run.agents[options.agent];
|
|
3530
2935
|
const undeclared = options.secrets?.find((secret) => !run.secrets.has(secret));
|
|
@@ -3532,62 +2937,100 @@ var agentWork2 = (name, options) => takeStep2(name, "agent_work", "agent_work",
|
|
|
3532
2937
|
return yield* new CapabilityDenied2({ step: name, capability: "agent_work", secret: undeclared });
|
|
3533
2938
|
if (agent === undefined)
|
|
3534
2939
|
return yield* new StepFailed2({ step: name, reason: `Agent role "${options.agent}" is not declared` });
|
|
3535
|
-
const deferred =
|
|
3536
|
-
const output = yield* jsonSchemaOf2(run.loop, options.output).pipe(Effect3.mapError((error) => new StepFailed2({ step: name, reason: error.message })));
|
|
3537
|
-
yield*
|
|
2940
|
+
const deferred = deferredOf(name);
|
|
2941
|
+
const output = yield* jsonSchemaOf2(run.loop, options.answer ?? options.output).pipe(Effect3.mapError((error) => new StepFailed2({ step: name, reason: error.message })));
|
|
2942
|
+
yield* launch2(deferred, (host, token) => host.startAgentWork({
|
|
3538
2943
|
step: name,
|
|
2944
|
+
deferredName: deferred.name,
|
|
3539
2945
|
role: options.agent,
|
|
3540
2946
|
agent,
|
|
3541
2947
|
prompt: options.prompt,
|
|
2948
|
+
...options.skill === undefined ? undefined : { skill: options.skill },
|
|
3542
2949
|
output,
|
|
3543
2950
|
...options.secrets === undefined ? undefined : { secrets: options.secrets },
|
|
2951
|
+
...options.timeout === undefined ? undefined : { timeoutMillis: Duration.toMillis(Duration.fromInputUnsafe(options.timeout)) },
|
|
2952
|
+
...options.mergeTarget === undefined ? undefined : { mergeTarget: options.mergeTarget },
|
|
3544
2953
|
token
|
|
3545
2954
|
}));
|
|
3546
2955
|
const submitted = yield* DurableDeferred.await(deferred);
|
|
3547
2956
|
return yield* Schema17.decodeEffect(Schema17.toCodecJson(options.output))(submitted).pipe(Effect3.mapError((error) => new OutputInvalid2({ step: name, message: error.message })));
|
|
3548
2957
|
}));
|
|
2958
|
+
var agentWorkOnce2 = (name, options) => agentWork2(name, options).pipe(Effect3.catchTag("OutputInvalid", (invalid) => agentWork2(`${name}:again`, {
|
|
2959
|
+
...options,
|
|
2960
|
+
prompt: `${options.prompt}
|
|
2961
|
+
|
|
2962
|
+
Your last Output was refused: ${invalid.message}. Give it again in the right shape.`
|
|
2963
|
+
})));
|
|
3549
2964
|
var ask2 = (name, question) => takeStep2(name, "ask", "ask", Effect3.gen(function* () {
|
|
3550
2965
|
const deferred = answerDeferred2(name);
|
|
3551
|
-
const
|
|
3552
|
-
|
|
2966
|
+
const offered = "options" in question ? splitQuestionOptions(question.options) : undefined;
|
|
2967
|
+
const options = offered?.options;
|
|
2968
|
+
const recommended = "recommended" in question ? question.recommended : undefined;
|
|
2969
|
+
const informationOnly = "informationOnly" in question ? question.informationOnly : undefined;
|
|
2970
|
+
const advice = questionAdvice({
|
|
2971
|
+
...offered,
|
|
2972
|
+
...recommended === undefined ? undefined : { recommended },
|
|
2973
|
+
recommendationReason: question.recommendationReason,
|
|
2974
|
+
...informationOnly === undefined ? undefined : { informationOnly }
|
|
2975
|
+
});
|
|
2976
|
+
const refused = recommendationProblem({ ...advice, ...options === undefined ? undefined : { options } });
|
|
2977
|
+
if (refused !== undefined)
|
|
2978
|
+
return yield* new StepFailed2({ step: name, reason: refused });
|
|
2979
|
+
const fallback = question.default === undefined ? recommendedDefault(recommended) : question.default ?? undefined;
|
|
2980
|
+
if (fallback !== undefined && options !== undefined && !options.includes(fallback))
|
|
2981
|
+
return yield* new QuestionRefused2({ step: name, answer: fallback, options });
|
|
2982
|
+
yield* launch2(deferred, (host, token) => host.putQuestion({
|
|
3553
2983
|
step: name,
|
|
3554
2984
|
prompt: question.prompt,
|
|
3555
2985
|
...options === undefined ? undefined : { options },
|
|
2986
|
+
...advice,
|
|
2987
|
+
...fallback === undefined ? undefined : { default: fallback },
|
|
2988
|
+
...question.timeout === undefined ? undefined : { timeoutMillis: Duration.toMillis(Duration.fromInputUnsafe(question.timeout)) },
|
|
3556
2989
|
token
|
|
3557
2990
|
}));
|
|
3558
2991
|
const answer = yield* DurableDeferred.await(deferred);
|
|
3559
|
-
if (options === undefined)
|
|
2992
|
+
if (options === undefined) {
|
|
3560
2993
|
return answer;
|
|
3561
|
-
|
|
3562
|
-
|
|
2994
|
+
}
|
|
2995
|
+
const offeredAnswer = options.find((option) => option === answer);
|
|
2996
|
+
if (offeredAnswer === undefined)
|
|
3563
2997
|
return yield* new QuestionRefused2({ step: name, answer, options });
|
|
3564
|
-
return
|
|
2998
|
+
return offeredAnswer;
|
|
3565
2999
|
}));
|
|
3566
3000
|
var call2 = (name, loop, input) => takeStep2(name, "call", "call", Effect3.gen(function* () {
|
|
3567
3001
|
const deferred = childDeferred2(name);
|
|
3568
3002
|
const encoded = yield* toJson(name, loop.input, input);
|
|
3569
|
-
yield*
|
|
3003
|
+
yield* launch2(deferred, (host, token) => host.admitChild({ step: name, loop: loop.id, input: encoded, token }));
|
|
3570
3004
|
const result = yield* DurableDeferred.await(deferred);
|
|
3571
3005
|
return yield* Schema17.decodeEffect(Schema17.toCodecJson(loop.output))(result).pipe(Effect3.mapError((error) => new ChildFailed2({ step: name, loop: loop.id, reason: error.message })));
|
|
3572
3006
|
}));
|
|
3573
3007
|
var waitFor2 = (name, wait) => takeStep2(name, "wait_for", undefined, Effect3.gen(function* () {
|
|
3574
3008
|
const deferred = eventDeferred2(name);
|
|
3575
3009
|
const timeoutMillis = Duration.toMillis(Duration.fromInputUnsafe(wait.timeout));
|
|
3576
|
-
yield*
|
|
3010
|
+
yield* launch2(deferred, (host, token) => host.awaitEvent({
|
|
3577
3011
|
step: name,
|
|
3578
3012
|
event: wait.event,
|
|
3579
3013
|
...wait.filter === undefined ? undefined : { filter: wait.filter },
|
|
3014
|
+
...wait.since === undefined ? undefined : { since: wait.since },
|
|
3015
|
+
...wait.or === undefined ? undefined : { or: wait.or },
|
|
3580
3016
|
timeoutMillis,
|
|
3581
3017
|
token
|
|
3582
3018
|
}));
|
|
3583
|
-
|
|
3019
|
+
const event = yield* DurableDeferred.await(deferred);
|
|
3020
|
+
if (event.type === "change_request.closed" && wait.event !== event.type && wait.or?.some((other) => other.event === event.type) !== true)
|
|
3021
|
+
return yield* new ChangeRequestClosed2({
|
|
3022
|
+
step: name,
|
|
3023
|
+
merged: event.payload.merged === true
|
|
3024
|
+
});
|
|
3025
|
+
return event;
|
|
3584
3026
|
}));
|
|
3585
3027
|
var verify2 = (name, request) => takeStep2(name, "verify", "verify", Effect3.gen(function* () {
|
|
3586
3028
|
const deferred = verifyDeferred2(name);
|
|
3587
|
-
yield*
|
|
3029
|
+
yield* launch2(deferred, (host, token) => host.startVerification({
|
|
3588
3030
|
step: name,
|
|
3589
3031
|
...request.revision === undefined ? undefined : { revision: request.revision },
|
|
3590
3032
|
...request.checks === undefined ? undefined : { checks: request.checks },
|
|
3033
|
+
...request.suggested === undefined || request.suggested.length === 0 ? undefined : { suggested: request.suggested },
|
|
3591
3034
|
token
|
|
3592
3035
|
}));
|
|
3593
3036
|
return yield* DurableDeferred.await(deferred);
|
|
@@ -3595,10 +3038,16 @@ var verify2 = (name, request) => takeStep2(name, "verify", "verify", Effect3.gen
|
|
|
3595
3038
|
var approval = ["Approve", "Reject"];
|
|
3596
3039
|
var suggestVerification2 = (name, verification) => takeStep2(name, "ask", "ask", Effect3.gen(function* () {
|
|
3597
3040
|
const deferred = answerDeferred2(name);
|
|
3598
|
-
yield*
|
|
3041
|
+
yield* launch2(deferred, (host, token) => host.putQuestion({
|
|
3599
3042
|
step: name,
|
|
3600
3043
|
prompt: `Approve the verification "${verification.name}" for this repository? It runs \`${verification.command}\`${verification.workingDirectory === undefined ? "" : ` in ${verification.workingDirectory}`}.`,
|
|
3601
3044
|
options: approval,
|
|
3045
|
+
optionDescriptions: {
|
|
3046
|
+
Approve: "Runs it on every Build of this repository from now on.",
|
|
3047
|
+
Reject: "The Run goes on without this check."
|
|
3048
|
+
},
|
|
3049
|
+
recommended: "Approve",
|
|
3050
|
+
recommendationReason: "An agent suggested it to prove its own work, and an approved check guards later Builds too. Reject it if the command is not safe to run here.",
|
|
3602
3051
|
verification,
|
|
3603
3052
|
token
|
|
3604
3053
|
}));
|
|
@@ -3694,22 +3143,82 @@ var ArtifactRequest2 = Schema19.Struct({
|
|
|
3694
3143
|
});
|
|
3695
3144
|
var ArtifactResult2 = Schema19.Struct({ artifactId: Schema19.String });
|
|
3696
3145
|
var NoteRequest2 = Schema19.Struct({ text: Schema19.String, artifactId: Schema19.optional(Schema19.String) });
|
|
3697
|
-
var CreateTasksRequest2 = Schema19.Struct({
|
|
3146
|
+
var CreateTasksRequest2 = Schema19.Struct({
|
|
3147
|
+
tickets: Schema19.Array(PlanTicket2),
|
|
3148
|
+
projectId: Schema19.optionalKey(Schema19.String)
|
|
3149
|
+
});
|
|
3698
3150
|
var CreateTasksResult2 = Schema19.Struct({
|
|
3699
3151
|
tasks: Schema19.Array(Schema19.Struct({ key: Schema19.String, taskId: Schema19.String }))
|
|
3700
3152
|
});
|
|
3153
|
+
var AlertTaskRequest2 = Schema19.Struct({
|
|
3154
|
+
fingerprint: Schema19.String.check(Schema19.isMinLength(1), Schema19.isMaxLength(400)),
|
|
3155
|
+
title: Schema19.String,
|
|
3156
|
+
windowHours: Schema19.Int.check(Schema19.isGreaterThanOrEqualTo(0), Schema19.isLessThanOrEqualTo(720)),
|
|
3157
|
+
resolved: Schema19.optionalKey(Schema19.Boolean),
|
|
3158
|
+
priority: Schema19.optionalKey(Schema19.Literals(["urgent", "high", "medium", "low"]))
|
|
3159
|
+
});
|
|
3160
|
+
var AlertTaskResult2 = Schema19.Struct({
|
|
3161
|
+
taskId: Schema19.optionalKey(Schema19.String),
|
|
3162
|
+
created: Schema19.Boolean,
|
|
3163
|
+
resolved: Schema19.optionalKey(Schema19.Boolean),
|
|
3164
|
+
joined: Schema19.optionalKey(Schema19.Struct({ kind: Schema19.Literals(["run", "recent"]), runId: Schema19.String }))
|
|
3165
|
+
});
|
|
3701
3166
|
var IntegrationBranchRequest2 = Schema19.Struct({ repoBindingId: Schema19.optional(Schema19.String) });
|
|
3702
3167
|
var IntegrationBranch2 = Schema19.Struct({
|
|
3703
3168
|
repoBindingId: Schema19.String,
|
|
3704
3169
|
branch: Schema19.String,
|
|
3705
3170
|
revision: Schema19.String
|
|
3706
3171
|
});
|
|
3707
|
-
var MergeChangeRequestRequest2 = Schema19.Struct({
|
|
3172
|
+
var MergeChangeRequestRequest2 = Schema19.Struct({
|
|
3173
|
+
changeRequestId: Schema19.String,
|
|
3174
|
+
head: Schema19.optionalKey(Schema19.String)
|
|
3175
|
+
});
|
|
3708
3176
|
var MergeResult2 = Schema19.Union([
|
|
3709
3177
|
Schema19.Struct({ status: Schema19.Literal("merged"), revision: Schema19.String }),
|
|
3710
|
-
Schema19.Struct({ status: Schema19.Literal("conflict") })
|
|
3178
|
+
Schema19.Struct({ status: Schema19.Literal("conflict") }),
|
|
3179
|
+
Schema19.Struct({ status: Schema19.Literal("moved"), head: Schema19.String })
|
|
3711
3180
|
]);
|
|
3712
|
-
var
|
|
3181
|
+
var ApproveChangeRequestRequest2 = Schema19.Struct({
|
|
3182
|
+
changeRequestId: Schema19.String,
|
|
3183
|
+
head: Schema19.String,
|
|
3184
|
+
summary: Schema19.String,
|
|
3185
|
+
review: Schema19.optionalKey(Schema19.String),
|
|
3186
|
+
carries: Schema19.optionalKey(Schema19.String)
|
|
3187
|
+
});
|
|
3188
|
+
var ApproveChangeRequestResult2 = Schema19.Union([
|
|
3189
|
+
Schema19.Struct({ approved: Schema19.Literal(true), reviewId: Schema19.String }),
|
|
3190
|
+
Schema19.Struct({ approved: Schema19.Literal(false), reason: Schema19.String })
|
|
3191
|
+
]);
|
|
3192
|
+
var CloseChangeRequestRequest2 = Schema19.Struct({
|
|
3193
|
+
number: Schema19.String,
|
|
3194
|
+
head: Schema19.String,
|
|
3195
|
+
note: Schema19.String
|
|
3196
|
+
});
|
|
3197
|
+
var CloseChangeRequestResult2 = Schema19.Struct({
|
|
3198
|
+
closed: Schema19.Boolean,
|
|
3199
|
+
head: Schema19.optionalKey(Schema19.String)
|
|
3200
|
+
});
|
|
3201
|
+
var RerunPipelineRequest2 = Schema19.Union([
|
|
3202
|
+
Schema19.Struct({ changeRequestId: Schema19.String }),
|
|
3203
|
+
Schema19.Struct({ ref: Schema19.String, all: Schema19.optionalKey(Schema19.Boolean) })
|
|
3204
|
+
]);
|
|
3205
|
+
var RerunPipelineResult2 = Schema19.Struct({ head: Schema19.String, pipelines: Schema19.Int });
|
|
3206
|
+
var ReportPipelineRequest2 = Schema19.Struct({ changeRequestId: Schema19.String, verification: Schema19.String });
|
|
3207
|
+
var ReportPipelineResult2 = Schema19.Struct({
|
|
3208
|
+
head: Schema19.String,
|
|
3209
|
+
status: Schema19.Literals(["success", "failed"])
|
|
3210
|
+
});
|
|
3211
|
+
var CommentRequest2 = Schema19.Struct({
|
|
3212
|
+
changeRequestId: Schema19.String,
|
|
3213
|
+
body: Schema19.String,
|
|
3214
|
+
threadId: Schema19.optionalKey(Schema19.String),
|
|
3215
|
+
summary: Schema19.optionalKey(Schema19.String),
|
|
3216
|
+
anchors: Schema19.optionalKey(Schema19.Array(Schema19.Struct({
|
|
3217
|
+
file: Schema19.String,
|
|
3218
|
+
line: Schema19.Int.check(Schema19.isGreaterThanOrEqualTo(1)),
|
|
3219
|
+
body: Schema19.String.check(Schema19.isMinLength(1))
|
|
3220
|
+
})))
|
|
3221
|
+
});
|
|
3713
3222
|
var ReleaseRequest2 = Schema19.Struct({
|
|
3714
3223
|
tag: Schema19.String,
|
|
3715
3224
|
revision: Schema19.optional(Schema19.String),
|
|
@@ -3717,6 +3226,49 @@ var ReleaseRequest2 = Schema19.Struct({
|
|
|
3717
3226
|
notes: Schema19.String
|
|
3718
3227
|
});
|
|
3719
3228
|
var ReleaseResult2 = Schema19.Struct({ tag: Schema19.String, revision: Schema19.String, url: Schema19.String });
|
|
3229
|
+
var ChangeRequestReadRequest2 = Schema19.Struct({ changeRequestId: Schema19.String });
|
|
3230
|
+
var PipelineJob2 = Schema19.Struct({
|
|
3231
|
+
name: Schema19.String,
|
|
3232
|
+
status: Schema19.Literals(["running", "success", "failed", "skipped"]),
|
|
3233
|
+
url: Schema19.optional(Schema19.String),
|
|
3234
|
+
logTail: Schema19.optional(Schema19.String)
|
|
3235
|
+
});
|
|
3236
|
+
var PipelineStatus2 = Schema19.Struct({
|
|
3237
|
+
head: Schema19.String,
|
|
3238
|
+
status: Schema19.Literals(["none", "running", "success", "failed", "canceled"]),
|
|
3239
|
+
source: Schema19.Literals(["forge", "reported"]),
|
|
3240
|
+
jobs: Schema19.Array(PipelineJob2),
|
|
3241
|
+
readAt: Schema19.optionalKey(Schema19.String),
|
|
3242
|
+
runnerChecks: Schema19.optionalKey(Schema19.Array(Schema19.String))
|
|
3243
|
+
});
|
|
3244
|
+
var ReviewThread2 = Schema19.Struct({
|
|
3245
|
+
id: Schema19.String,
|
|
3246
|
+
path: Schema19.optional(Schema19.String),
|
|
3247
|
+
line: Schema19.optional(Schema19.Int),
|
|
3248
|
+
outdated: Schema19.optional(Schema19.Boolean),
|
|
3249
|
+
comments: Schema19.Array(Schema19.Struct({ author: Schema19.optional(Schema19.String), body: Schema19.String }))
|
|
3250
|
+
});
|
|
3251
|
+
var ReviewThreads2 = Schema19.Struct({ threads: Schema19.Array(ReviewThread2) });
|
|
3252
|
+
var OpenChangeRequestsRequest2 = Schema19.Struct({ authors: Schema19.NonEmptyArray(Schema19.String) });
|
|
3253
|
+
var OpenChangeRequest2 = Schema19.Struct({
|
|
3254
|
+
number: Schema19.String,
|
|
3255
|
+
title: Schema19.String,
|
|
3256
|
+
body: Schema19.String,
|
|
3257
|
+
url: Schema19.String,
|
|
3258
|
+
author: Schema19.String,
|
|
3259
|
+
sourceBranch: Schema19.String,
|
|
3260
|
+
head: Schema19.String
|
|
3261
|
+
});
|
|
3262
|
+
var OpenChangeRequests2 = Schema19.Struct({ changeRequests: Schema19.Array(OpenChangeRequest2) });
|
|
3263
|
+
var OwnChangeRequest2 = Schema19.Struct({
|
|
3264
|
+
id: Schema19.String,
|
|
3265
|
+
number: Schema19.String,
|
|
3266
|
+
url: Schema19.String,
|
|
3267
|
+
title: Schema19.String,
|
|
3268
|
+
sourceBranch: Schema19.String,
|
|
3269
|
+
body: Schema19.String
|
|
3270
|
+
});
|
|
3271
|
+
var OwnChangeRequests2 = Schema19.Struct({ changeRequests: Schema19.Array(OwnChangeRequest2) });
|
|
3720
3272
|
var TranscriptPoint2 = Schema19.Struct({
|
|
3721
3273
|
runId: Schema19.String,
|
|
3722
3274
|
stepAttemptId: Schema19.String,
|
|
@@ -3729,8 +3281,10 @@ var TranscriptsResult2 = Schema19.Struct({
|
|
|
3729
3281
|
runs: Schema19.Array(Schema19.Struct({
|
|
3730
3282
|
runId: Schema19.String,
|
|
3731
3283
|
loopId: Schema19.String,
|
|
3284
|
+
status: Schema19.optional(Schema19.Literals(["completed", "failed", "canceled", "expired"])),
|
|
3732
3285
|
teamId: Schema19.optional(Schema19.String),
|
|
3733
3286
|
failure: Schema19.optional(Schema19.String),
|
|
3287
|
+
retried: Schema19.optional(Schema19.Boolean),
|
|
3734
3288
|
entries: Schema19.Array(Schema19.Struct({ stepAttemptId: Schema19.String, sequence: Schema19.Int, kind: Schema19.String, text: Schema19.String }))
|
|
3735
3289
|
}))
|
|
3736
3290
|
});
|
|
@@ -3747,10 +3301,15 @@ var ProposeRequest2 = Schema19.Union([
|
|
|
3747
3301
|
title: Schema19.String,
|
|
3748
3302
|
description: Schema19.String,
|
|
3749
3303
|
teamId: Schema19.optional(Schema19.String),
|
|
3304
|
+
key: Schema19.optionalKey(Schema19.String.check(Schema19.isPattern(/^[a-z0-9]+(?:-[a-z0-9]+)*$/), Schema19.isMaxLength(80))),
|
|
3750
3305
|
citations: Citations
|
|
3751
3306
|
})
|
|
3752
3307
|
]);
|
|
3753
|
-
var ProposeResult2 = Schema19.Struct({
|
|
3308
|
+
var ProposeResult2 = Schema19.Struct({
|
|
3309
|
+
kind: Schema19.Literals(["memory", "task"]),
|
|
3310
|
+
id: Schema19.String,
|
|
3311
|
+
matched: Schema19.optionalKey(Schema19.Boolean)
|
|
3312
|
+
});
|
|
3754
3313
|
var Health = Schema19.Literals(["on_track", "at_risk", "off_track"]);
|
|
3755
3314
|
var ProjectActivityRequest2 = Schema19.Struct({ projectId: Schema19.String });
|
|
3756
3315
|
var ProjectActivityResult2 = Schema19.Struct({
|
|
@@ -3801,6 +3360,9 @@ class CommentActivity2 extends Context2.Service()("@kitman-sh/sdk/loop/CommentAc
|
|
|
3801
3360
|
class CreateTasksActivity2 extends Context2.Service()("@kitman-sh/sdk/loop/CreateTasksActivity") {
|
|
3802
3361
|
}
|
|
3803
3362
|
|
|
3363
|
+
class AlertTaskActivity2 extends Context2.Service()("@kitman-sh/sdk/loop/AlertTaskActivity") {
|
|
3364
|
+
}
|
|
3365
|
+
|
|
3804
3366
|
class IntegrationBranchActivity2 extends Context2.Service()("@kitman-sh/sdk/loop/IntegrationBranchActivity") {
|
|
3805
3367
|
}
|
|
3806
3368
|
|
|
@@ -3821,6 +3383,9 @@ class ProjectActivityActivity2 extends Context2.Service()("@kitman-sh/sdk/loop/P
|
|
|
3821
3383
|
|
|
3822
3384
|
class DraftUpdateActivity2 extends Context2.Service()("@kitman-sh/sdk/loop/DraftUpdateActivity") {
|
|
3823
3385
|
}
|
|
3386
|
+
|
|
3387
|
+
class ChangeRequestReadActivity2 extends Context2.Service()("@kitman-sh/sdk/loop/ChangeRequestReadActivity") {
|
|
3388
|
+
}
|
|
3824
3389
|
var hostActivity = (name, kind, capability, success, execute) => takeStep2(name, kind, capability, Activity2.make({ name: `${kind}/${name}`, success, error: StepFailed2, execute }));
|
|
3825
3390
|
var changeRequest2 = (name, request) => hostActivity(name, "change_request", "change_request", ChangeRequestResult2, Effect5.gen(function* () {
|
|
3826
3391
|
return yield* (yield* ChangeRequestActivity2).run(request, name);
|
|
@@ -3843,12 +3408,33 @@ var comment2 = (name, request) => hostActivity(name, "comment", "post_comment",
|
|
|
3843
3408
|
var createTasks2 = (name, request) => hostActivity(name, "create_tasks", "create_tasks", CreateTasksResult2, Effect5.gen(function* () {
|
|
3844
3409
|
return yield* (yield* CreateTasksActivity2).run(request, name);
|
|
3845
3410
|
}));
|
|
3411
|
+
var alertTask2 = (name, request) => hostActivity(name, "create_tasks", "create_tasks", AlertTaskResult2, Effect5.gen(function* () {
|
|
3412
|
+
return yield* (yield* AlertTaskActivity2).run(request, name);
|
|
3413
|
+
}));
|
|
3846
3414
|
var integrationBranch2 = (name, request) => hostActivity(name, "integration_branch", "merge_change_request", IntegrationBranch2, Effect5.gen(function* () {
|
|
3847
3415
|
return yield* (yield* IntegrationBranchActivity2).run(request, name);
|
|
3848
3416
|
}));
|
|
3849
3417
|
var mergeChangeRequest2 = (name, request) => hostActivity(name, "merge_change_request", "merge_change_request", MergeResult2, Effect5.gen(function* () {
|
|
3850
3418
|
return yield* (yield* MergeChangeRequestActivity2).run(request, name);
|
|
3851
3419
|
}));
|
|
3420
|
+
var approveChangeRequest2 = (name, request) => hostActivity(name, "approve_change_request", "approve_change_request", ApproveChangeRequestResult2, Effect5.gen(function* () {
|
|
3421
|
+
return yield* (yield* MergeChangeRequestActivity2).approve(request, name);
|
|
3422
|
+
}));
|
|
3423
|
+
var closeChangeRequest2 = (name, request) => hostActivity(name, "close_change_request", "merge_change_request", CloseChangeRequestResult2, Effect5.gen(function* () {
|
|
3424
|
+
return yield* (yield* MergeChangeRequestActivity2).close(request, name);
|
|
3425
|
+
}));
|
|
3426
|
+
var pipelineMoved2 = (name, changeRequestId, read, timeout = "6 hours") => waitFor2(name, {
|
|
3427
|
+
event: "change_request.pipeline",
|
|
3428
|
+
filter: read.readAt === undefined ? { changeRequestId, head: read.head } : { changeRequestId },
|
|
3429
|
+
timeout,
|
|
3430
|
+
...read.readAt === undefined ? undefined : { since: read.readAt }
|
|
3431
|
+
});
|
|
3432
|
+
var rerunPipeline2 = (name, request) => hostActivity(name, "rerun_pipeline", "merge_change_request", RerunPipelineResult2, Effect5.gen(function* () {
|
|
3433
|
+
return yield* (yield* MergeChangeRequestActivity2).rerun(request, name);
|
|
3434
|
+
}));
|
|
3435
|
+
var reportPipeline2 = (name, request) => hostActivity(name, "report_pipeline", "verify", ReportPipelineResult2, Effect5.gen(function* () {
|
|
3436
|
+
return yield* (yield* MergeChangeRequestActivity2).report(request, name);
|
|
3437
|
+
}));
|
|
3852
3438
|
var release2 = (name, request) => hostActivity(name, "release", "publish_release", ReleaseResult2, Effect5.gen(function* () {
|
|
3853
3439
|
return yield* (yield* ReleaseActivity2).run(request, name);
|
|
3854
3440
|
}));
|
|
@@ -3861,6 +3447,18 @@ var propose2 = (name, request) => hostActivity(name, "propose", "propose", Propo
|
|
|
3861
3447
|
var projectActivity2 = (name, request) => hostActivity(name, "project_activity", "read_project", ProjectActivityResult2, Effect5.gen(function* () {
|
|
3862
3448
|
return yield* (yield* ProjectActivityActivity2).run(request, name);
|
|
3863
3449
|
}));
|
|
3450
|
+
var pipelineStatus2 = (name, request) => hostActivity(name, "pipeline_status", "read_change_request", PipelineStatus2, Effect5.gen(function* () {
|
|
3451
|
+
return yield* (yield* ChangeRequestReadActivity2).pipeline(request, name);
|
|
3452
|
+
}));
|
|
3453
|
+
var reviewThreads2 = (name, request) => hostActivity(name, "review_threads", "read_change_request", ReviewThreads2, Effect5.gen(function* () {
|
|
3454
|
+
return yield* (yield* ChangeRequestReadActivity2).reviewThreads(request, name);
|
|
3455
|
+
}));
|
|
3456
|
+
var openChangeRequests2 = (name, request) => hostActivity(name, "open_change_requests", "read_change_request", OpenChangeRequests2, Effect5.gen(function* () {
|
|
3457
|
+
return yield* (yield* ChangeRequestReadActivity2).opened(request, name);
|
|
3458
|
+
}));
|
|
3459
|
+
var ownChangeRequests2 = (name) => hostActivity(name, "own_change_requests", "read_change_request", OwnChangeRequests2, Effect5.gen(function* () {
|
|
3460
|
+
return yield* (yield* ChangeRequestReadActivity2).own(name);
|
|
3461
|
+
}));
|
|
3864
3462
|
var draftUpdate2 = (name, request) => hostActivity(name, "draft_update", "draft_update", DraftUpdateResult2, Effect5.gen(function* () {
|
|
3865
3463
|
return yield* (yield* DraftUpdateActivity2).run(request, name);
|
|
3866
3464
|
}));
|
|
@@ -3868,15 +3466,585 @@ var draftUpdate2 = (name, request) => hostActivity(name, "draft_update", "draft_
|
|
|
3868
3466
|
import * as ConfigProvider from "effect/ConfigProvider";
|
|
3869
3467
|
import * as Context3 from "effect/Context";
|
|
3870
3468
|
import * as Data2 from "effect/Data";
|
|
3871
|
-
import * as
|
|
3469
|
+
import * as Effect8 from "effect/Effect";
|
|
3872
3470
|
import * as Exit3 from "effect/Exit";
|
|
3873
3471
|
import * as Layer from "effect/Layer";
|
|
3874
3472
|
import * as Option2 from "effect/Option";
|
|
3473
|
+
import * as Record12 from "effect/Record";
|
|
3474
|
+
import * as Schema27 from "effect/Schema";
|
|
3475
|
+
import { DurableDeferred as DurableDeferred4, Workflow, WorkflowEngine } from "effect/workflow";
|
|
3476
|
+
|
|
3477
|
+
// packages/core/src/resource-claim.ts
|
|
3875
3478
|
import * as Schema20 from "effect/Schema";
|
|
3876
|
-
|
|
3877
|
-
var
|
|
3878
|
-
|
|
3879
|
-
|
|
3479
|
+
var ResourceName = Schema20.String.check(Schema20.isPattern(/^[a-z0-9][a-z0-9._:-]*$/u), Schema20.isMinLength(1), Schema20.isMaxLength(128));
|
|
3480
|
+
var ClaimHolder = Schema20.Struct({
|
|
3481
|
+
runId: Schema20.optionalKey(Id),
|
|
3482
|
+
loopId: Schema20.optionalKey(Schema20.String),
|
|
3483
|
+
status: Schema20.optionalKey(RunStatus),
|
|
3484
|
+
reason: Schema20.optionalKey(Schema20.String),
|
|
3485
|
+
private: Schema20.optionalKey(Schema20.Literal(true)),
|
|
3486
|
+
sameLoop: Schema20.Boolean
|
|
3487
|
+
});
|
|
3488
|
+
var ClaimResult2 = Schema20.Union([
|
|
3489
|
+
Schema20.Struct({
|
|
3490
|
+
status: Schema20.Literal("granted"),
|
|
3491
|
+
resource: ResourceName,
|
|
3492
|
+
takenOverFrom: Schema20.optionalKey(ClaimHolder)
|
|
3493
|
+
}),
|
|
3494
|
+
Schema20.Struct({ status: Schema20.Literal("kept"), resource: ResourceName, holder: ClaimHolder })
|
|
3495
|
+
]);
|
|
3496
|
+
var ResourceClaim = Schema20.Struct({
|
|
3497
|
+
resource: ResourceName,
|
|
3498
|
+
runId: Id,
|
|
3499
|
+
loopId: Schema20.String,
|
|
3500
|
+
runStatus: RunStatus,
|
|
3501
|
+
claimedAt: Timestamp,
|
|
3502
|
+
keptAt: Schema20.optionalKey(Timestamp),
|
|
3503
|
+
keptReason: Schema20.optionalKey(Schema20.String),
|
|
3504
|
+
waiting: Schema20.Array(Id)
|
|
3505
|
+
});
|
|
3506
|
+
var ResourceClaimList = Schema20.Struct({ items: Schema20.Array(ResourceClaim) });
|
|
3507
|
+
var ClaimRelease = Schema20.Struct({
|
|
3508
|
+
reason: Schema20.String.check(Schema20.isMinLength(1), Schema20.isMaxLength(500))
|
|
3509
|
+
});
|
|
3510
|
+
|
|
3511
|
+
// packages/sdk/src/loop/claims.ts
|
|
3512
|
+
import * as Effect6 from "effect/Effect";
|
|
3513
|
+
import * as Schema21 from "effect/Schema";
|
|
3514
|
+
import { DurableDeferred as DurableDeferred2 } from "effect/workflow";
|
|
3515
|
+
var claimDeferred2 = (step) => DurableDeferred2.make(`claim/${step}`, { success: ClaimResult2, error: StepFailed2 });
|
|
3516
|
+
var letGoDeferred2 = (step) => DurableDeferred2.make(`let_go/${step}`, { success: Schema21.Null, error: StepFailed2 });
|
|
3517
|
+
var claimOnce = (name, resource, action) => takeStep2(name, "claim", "claim", Effect6.gen(function* () {
|
|
3518
|
+
const deferred = claimDeferred2(name);
|
|
3519
|
+
yield* launch2(deferred, (host, token) => host.claimResource({ step: name, resource, action, token }));
|
|
3520
|
+
return yield* DurableDeferred2.await(deferred);
|
|
3521
|
+
}));
|
|
3522
|
+
var takeOver = "Take it over";
|
|
3523
|
+
var holderName = (holder) => holder.private === true ? "a Run of a private Team you are not in" : `Run ${holder.runId} of ${holder.loopId}`;
|
|
3524
|
+
var claim2 = (name, request) => Effect6.gen(function* () {
|
|
3525
|
+
const first = yield* claimOnce(name, request.resource, "claim");
|
|
3526
|
+
if (first.status === "granted")
|
|
3527
|
+
return first;
|
|
3528
|
+
const { holder } = first;
|
|
3529
|
+
const fallback = holder.sameLoop ? takeOver : "Leave it";
|
|
3530
|
+
const answer = (yield* LoopRun2).granted.has("ask") ? yield* ask2(`${name}-offer`, {
|
|
3531
|
+
prompt: `${request.resource} is still held by ${holderName(holder)}${holder.status === undefined ? "" : `, which ${holder.status}`}${holder.reason === undefined ? "" : `: ${holder.reason}`}. Take it over?`,
|
|
3532
|
+
options: [takeOver, "Leave it"],
|
|
3533
|
+
recommended: fallback,
|
|
3534
|
+
recommendationReason: holder.sameLoop ? "The holder is this Loop on the same repository and settled without completing, so nothing else is using it." : "Another Loop holds it and may still need it; waiting is safer than taking it from under that Run.",
|
|
3535
|
+
timeout: request.timeout ?? "10 minutes"
|
|
3536
|
+
}) : fallback;
|
|
3537
|
+
if (answer !== takeOver)
|
|
3538
|
+
return yield* new StepFailed2({ step: name, reason: `${request.resource} was left to ${holderName(holder)}` });
|
|
3539
|
+
const taken = yield* claimOnce(`${name}-take-over`, request.resource, "take_over");
|
|
3540
|
+
if (taken.status === "granted")
|
|
3541
|
+
return taken;
|
|
3542
|
+
return yield* new StepFailed2({ step: name, reason: `${request.resource} is kept by ${holderName(taken.holder)}` });
|
|
3543
|
+
});
|
|
3544
|
+
var letGo2 = (name, held) => takeStep2(name, "let_go", "claim", Effect6.gen(function* () {
|
|
3545
|
+
const deferred = letGoDeferred2(name);
|
|
3546
|
+
yield* launch2(deferred, (host, token) => host.claimResource({ step: name, resource: held.resource, action: "let_go", token }));
|
|
3547
|
+
yield* DurableDeferred2.await(deferred);
|
|
3548
|
+
}));
|
|
3549
|
+
|
|
3550
|
+
// packages/core/src/work-unit.ts
|
|
3551
|
+
import * as Schema25 from "effect/Schema";
|
|
3552
|
+
import * as Struct23 from "effect/Struct";
|
|
3553
|
+
|
|
3554
|
+
// packages/core/src/repo-binding.ts
|
|
3555
|
+
import * as Schema22 from "effect/Schema";
|
|
3556
|
+
var ForgeKinds = ["github", "gitlab", "forgejo", "gitea", "gitee", "bitbucket", "azure-devops"];
|
|
3557
|
+
var ForgeKind = Schema22.Literals(ForgeKinds);
|
|
3558
|
+
var RepoBindingProviders = [...ForgeKinds, "generic_git"];
|
|
3559
|
+
var RepoBindingPathPrefixPattern = "^(?!/)(?!.*\\\\)(?!.*(?:^|/)\\.\\.?(?:/|$))(?!.*//)\\S+$";
|
|
3560
|
+
var RepoBindingProvider = Schema22.Literals(RepoBindingProviders);
|
|
3561
|
+
var RepoBindingStatus = Schema22.Union([Schema22.Literal("active"), Schema22.Literal("disabled")]);
|
|
3562
|
+
var RepoBindingCredentialProviderType = Schema22.Union([
|
|
3563
|
+
Schema22.Literal("env"),
|
|
3564
|
+
Schema22.Literal("file"),
|
|
3565
|
+
Schema22.Literal("exec")
|
|
3566
|
+
]);
|
|
3567
|
+
var RepoBindingAccessMode = Schema22.Union([
|
|
3568
|
+
Schema22.Literal("local_checkout"),
|
|
3569
|
+
Schema22.Literal("managed_clone"),
|
|
3570
|
+
Schema22.Literal("runner_secret_provider")
|
|
3571
|
+
]);
|
|
3572
|
+
var RepoBindingCredentialRef = Schema22.Union([
|
|
3573
|
+
Schema22.Struct({ kind: Schema22.Literal("none") }),
|
|
3574
|
+
Schema22.Struct({ kind: Schema22.Literal("local_env"), envName: Schema22.String.check(Schema22.isMinLength(1)) }),
|
|
3575
|
+
Schema22.Struct({
|
|
3576
|
+
kind: Schema22.Literal("runner_secret"),
|
|
3577
|
+
runnerSecretName: Schema22.String.check(Schema22.isMinLength(1)),
|
|
3578
|
+
providerType: RepoBindingCredentialProviderType
|
|
3579
|
+
}),
|
|
3580
|
+
Schema22.Struct({ kind: Schema22.Literal("ssh_agent") })
|
|
3581
|
+
]);
|
|
3582
|
+
var RepoBinding = Schema22.Struct({
|
|
3583
|
+
id: Id,
|
|
3584
|
+
workspaceId: Id,
|
|
3585
|
+
teamId: Schema22.optionalKey(Id),
|
|
3586
|
+
provider: RepoBindingProvider,
|
|
3587
|
+
host: Schema22.String.check(Schema22.isMinLength(1)),
|
|
3588
|
+
owner: Schema22.String.check(Schema22.isMinLength(1)),
|
|
3589
|
+
name: Schema22.String.check(Schema22.isMinLength(1)),
|
|
3590
|
+
repositoryUrl: Schema22.optionalKey(Schema22.String.check(Schema22.isMinLength(1))),
|
|
3591
|
+
pathPrefix: Schema22.optionalKey(Schema22.String.check(Schema22.isMinLength(1), Schema22.isPattern(new RegExp(RepoBindingPathPrefixPattern, "u")))),
|
|
3592
|
+
defaultTargetBranch: Schema22.String.check(Schema22.isMinLength(1)),
|
|
3593
|
+
expectedBranch: Schema22.optionalKey(Schema22.String.check(Schema22.isMinLength(1))),
|
|
3594
|
+
expectedCommitSha: Schema22.optionalKey(Schema22.String.check(Schema22.isMinLength(1))),
|
|
3595
|
+
credentialRefs: Schema22.Array(RepoBindingCredentialRef),
|
|
3596
|
+
status: RepoBindingStatus,
|
|
3597
|
+
webhook: Schema22.optionalKey(Schema22.Struct({
|
|
3598
|
+
status: Schema22.Literals(["active", "missing", "unavailable"]),
|
|
3599
|
+
message: Schema22.optionalKey(Schema22.String.check(Schema22.isMaxLength(240)))
|
|
3600
|
+
})),
|
|
3601
|
+
createdAt: Timestamp,
|
|
3602
|
+
updatedAt: Timestamp
|
|
3603
|
+
});
|
|
3604
|
+
var RepoBindingCreate = Schema22.Struct({
|
|
3605
|
+
teamId: Schema22.optionalKey(Id),
|
|
3606
|
+
provider: RepoBindingProvider,
|
|
3607
|
+
host: Schema22.String.check(Schema22.isMinLength(1)),
|
|
3608
|
+
owner: Schema22.String.check(Schema22.isMinLength(1)),
|
|
3609
|
+
name: Schema22.String.check(Schema22.isMinLength(1)),
|
|
3610
|
+
repositoryUrl: Schema22.optionalKey(Schema22.String.check(Schema22.isMinLength(1))),
|
|
3611
|
+
pathPrefix: Schema22.optionalKey(Schema22.String.check(Schema22.isMinLength(1), Schema22.isPattern(new RegExp(RepoBindingPathPrefixPattern, "u")))),
|
|
3612
|
+
defaultTargetBranch: Schema22.String.check(Schema22.isMinLength(1)),
|
|
3613
|
+
expectedBranch: Schema22.optionalKey(Schema22.String.check(Schema22.isMinLength(1))),
|
|
3614
|
+
expectedCommitSha: Schema22.optionalKey(Schema22.String.check(Schema22.isMinLength(1))),
|
|
3615
|
+
credentialRefs: Schema22.optionalKey(Schema22.Array(RepoBindingCredentialRef))
|
|
3616
|
+
});
|
|
3617
|
+
var RepoBindingTargetOverride = Schema22.Struct({
|
|
3618
|
+
targetBranch: Schema22.optionalKey(Schema22.String.check(Schema22.isMinLength(1)))
|
|
3619
|
+
});
|
|
3620
|
+
var RepoBindingList = Schema22.Struct({ items: Schema22.Array(RepoBinding) });
|
|
3621
|
+
var RunnerRepoBindingCapability = Schema22.Struct({
|
|
3622
|
+
repoBindingId: Id,
|
|
3623
|
+
provider: RepoBindingProvider,
|
|
3624
|
+
host: Schema22.String.check(Schema22.isMinLength(1)),
|
|
3625
|
+
accessModes: Schema22.Array(RepoBindingAccessMode),
|
|
3626
|
+
credentialProviderTypes: Schema22.Array(RepoBindingCredentialProviderType),
|
|
3627
|
+
authenticated: Schema22.Boolean,
|
|
3628
|
+
canPush: Schema22.optionalKey(Schema22.Boolean)
|
|
3629
|
+
});
|
|
3630
|
+
|
|
3631
|
+
// packages/core/src/network-host.ts
|
|
3632
|
+
import * as Schema23 from "effect/Schema";
|
|
3633
|
+
var label = "[A-Za-z0-9](?:[A-Za-z0-9-]{0,61}[A-Za-z0-9])?";
|
|
3634
|
+
var port = "(?:[1-9][0-9]{0,3}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5])";
|
|
3635
|
+
var NetworkHost = Schema23.String.check(Schema23.isMaxLength(260), Schema23.isPattern(new RegExp(`^(?:localhost|${label}(?:\\.${label})+|\\*\\.${label}\\.${label}(?:\\.${label})*)(?::${port})?$`, "u")));
|
|
3636
|
+
var NetworkHostScope = Schema23.Union([Schema23.Struct({ teamId: Id }), Schema23.Struct({ repoBindingId: Id })]);
|
|
3637
|
+
var NetworkHostSummary = Schema23.Struct({
|
|
3638
|
+
host: NetworkHost,
|
|
3639
|
+
teamId: Schema23.optionalKey(Id),
|
|
3640
|
+
repoBindingId: Schema23.optionalKey(Id),
|
|
3641
|
+
addedByActorType: ActorType,
|
|
3642
|
+
addedByActorId: Schema23.String,
|
|
3643
|
+
addedAt: Timestamp
|
|
3644
|
+
});
|
|
3645
|
+
var NetworkHostList = Schema23.Struct({ items: Schema23.Array(NetworkHostSummary) });
|
|
3646
|
+
var NetworkHostQuery = Schema23.Struct({
|
|
3647
|
+
teamId: Schema23.optionalKey(Id),
|
|
3648
|
+
repoBindingId: Schema23.optionalKey(Id)
|
|
3649
|
+
});
|
|
3650
|
+
|
|
3651
|
+
// packages/core/src/secret.ts
|
|
3652
|
+
import * as Schema24 from "effect/Schema";
|
|
3653
|
+
var SecretName2 = Schema24.String.check(Schema24.isPattern(new RegExp("^[A-Za-z_][A-Za-z0-9_]*$", "u")), Schema24.isMinLength(1), Schema24.isMaxLength(128));
|
|
3654
|
+
var SecretScope = Schema24.Union([Schema24.Literal("workspace"), Schema24.Literal("team")]);
|
|
3655
|
+
var SecretHost = Schema24.String.check(Schema24.isPattern(new RegExp("^(\\*\\.)?[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*(?::[0-9]{1,5})?$", "u")), Schema24.isMaxLength(260));
|
|
3656
|
+
var SecretHosts = Schema24.Array(SecretHost).check(Schema24.isMaxLength(32));
|
|
3657
|
+
var SecretSummary = Schema24.Struct({
|
|
3658
|
+
name: SecretName2,
|
|
3659
|
+
scope: SecretScope,
|
|
3660
|
+
teamId: Schema24.optionalKey(Id),
|
|
3661
|
+
hosts: SecretHosts,
|
|
3662
|
+
setByActorType: ActorType,
|
|
3663
|
+
setByActorId: Schema24.String,
|
|
3664
|
+
setAt: Timestamp
|
|
3665
|
+
});
|
|
3666
|
+
var SecretList = Schema24.Struct({ items: Schema24.Array(SecretSummary) });
|
|
3667
|
+
var SecretSet = Schema24.Struct({
|
|
3668
|
+
value: Schema24.String.check(Schema24.isMinLength(1), Schema24.isMaxLength(65536)),
|
|
3669
|
+
teamId: Schema24.optionalKey(Schema24.String.check(Schema24.isMinLength(1))),
|
|
3670
|
+
hosts: Schema24.optionalKey(SecretHosts)
|
|
3671
|
+
});
|
|
3672
|
+
var SecretScopeQuery = Schema24.Struct({ teamId: Schema24.optionalKey(Id) });
|
|
3673
|
+
|
|
3674
|
+
// packages/core/src/work-unit.ts
|
|
3675
|
+
var WorkUnitLease = Schema25.Struct({
|
|
3676
|
+
leaseOwnerId: Id,
|
|
3677
|
+
runnerReplicaId: Id,
|
|
3678
|
+
leaseId: Id,
|
|
3679
|
+
attempt: Schema25.Int.check(Schema25.isGreaterThanOrEqualTo(1)),
|
|
3680
|
+
fencingToken: Schema25.String.check(Schema25.isMinLength(1), Schema25.isMaxLength(240), Schema25.isPattern(new RegExp("^[A-Za-z0-9._:-]+$", "u"))),
|
|
3681
|
+
capacitySlot: Schema25.String.check(Schema25.isMinLength(1), Schema25.isMaxLength(240)),
|
|
3682
|
+
leaseExpiresAt: Timestamp,
|
|
3683
|
+
lastHeartbeatAt: Timestamp
|
|
3684
|
+
});
|
|
3685
|
+
var WorkUnitLeaseProjection = Schema25.Struct(Struct23.map(WorkUnitLease.fields, Schema25.optionalKey));
|
|
3686
|
+
var WorkUnitRepoBinding = Schema25.Struct({
|
|
3687
|
+
id: Id,
|
|
3688
|
+
provider: RepoBindingProvider,
|
|
3689
|
+
host: Schema25.String.check(Schema25.isMinLength(1)),
|
|
3690
|
+
owner: Schema25.String.check(Schema25.isMinLength(1)),
|
|
3691
|
+
name: Schema25.String.check(Schema25.isMinLength(1)),
|
|
3692
|
+
repositoryUrl: Schema25.optionalKey(Schema25.String.check(Schema25.isMinLength(1))),
|
|
3693
|
+
pathPrefix: Schema25.optionalKey(Schema25.String.check(Schema25.isMinLength(1))),
|
|
3694
|
+
defaultTargetBranch: Schema25.String.check(Schema25.isMinLength(1)),
|
|
3695
|
+
expectedBranch: Schema25.optionalKey(Schema25.String.check(Schema25.isMinLength(1))),
|
|
3696
|
+
expectedCommitSha: Schema25.optionalKey(Schema25.String.check(Schema25.isMinLength(1)))
|
|
3697
|
+
});
|
|
3698
|
+
var WorkUnitLeaseInput = Schema25.Struct({
|
|
3699
|
+
leaseOwnerId: Id,
|
|
3700
|
+
runnerReplicaId: Id,
|
|
3701
|
+
leaseId: Id,
|
|
3702
|
+
attempt: Schema25.Int.check(Schema25.isGreaterThanOrEqualTo(1)),
|
|
3703
|
+
fencingToken: Schema25.String.check(Schema25.isMinLength(1), Schema25.isMaxLength(240), Schema25.isPattern(new RegExp("^[A-Za-z0-9._:-]+$", "u"))),
|
|
3704
|
+
capacitySlot: Schema25.String.check(Schema25.isMinLength(1), Schema25.isMaxLength(240))
|
|
3705
|
+
});
|
|
3706
|
+
var WorkUnitStatus = Schema25.Union([
|
|
3707
|
+
Schema25.Literal("pending"),
|
|
3708
|
+
Schema25.Literal("claimed"),
|
|
3709
|
+
Schema25.Literal("running"),
|
|
3710
|
+
Schema25.Literal("waiting"),
|
|
3711
|
+
Schema25.Literal("blocked"),
|
|
3712
|
+
Schema25.Literal("completed"),
|
|
3713
|
+
Schema25.Literal("failed"),
|
|
3714
|
+
Schema25.Literal("canceled"),
|
|
3715
|
+
Schema25.Literal("expired")
|
|
3716
|
+
]);
|
|
3717
|
+
var LoopCheckout = Schema25.Union([Schema25.Literal("none"), Schema25.Literal("read"), Schema25.Literal("write")]);
|
|
3718
|
+
var StorageOrigin = Schema25.optionalKey(Schema25.String.check(Schema25.isMinLength(1), Schema25.isMaxLength(2048)));
|
|
3719
|
+
var SecretDestination = Schema25.Struct({
|
|
3720
|
+
scope: SecretScope,
|
|
3721
|
+
hosts: SecretHosts,
|
|
3722
|
+
version: Schema25.String.check(Schema25.isMinLength(1), Schema25.isMaxLength(128))
|
|
3723
|
+
});
|
|
3724
|
+
var AgentStepWorkUnit = Schema25.Struct({
|
|
3725
|
+
kind: Schema25.Literal("agent_step"),
|
|
3726
|
+
id: Id,
|
|
3727
|
+
teamId: Schema25.optionalKey(Id),
|
|
3728
|
+
runId: Id,
|
|
3729
|
+
stepKey: Schema25.String.check(Schema25.isMinLength(1), Schema25.isMaxLength(240)),
|
|
3730
|
+
attempt: Schema25.Int.check(Schema25.isGreaterThanOrEqualTo(1)),
|
|
3731
|
+
lease: WorkUnitLease,
|
|
3732
|
+
deadlineAt: Schema25.optionalKey(Timestamp),
|
|
3733
|
+
brief: StepBrief,
|
|
3734
|
+
stepCredential: Schema25.String.check(Schema25.isMinLength(1), Schema25.isMaxLength(512)),
|
|
3735
|
+
checkout: LoopCheckout,
|
|
3736
|
+
repoBinding: Schema25.optionalKey(WorkUnitRepoBinding),
|
|
3737
|
+
branch: Schema25.optionalKey(Schema25.String.check(Schema25.isMinLength(1))),
|
|
3738
|
+
baseRevision: Schema25.optionalKey(Schema25.String.check(Schema25.isMinLength(1))),
|
|
3739
|
+
network: Schema25.optionalKey(AgentSandboxNetwork),
|
|
3740
|
+
hosts: Schema25.optionalKey(Schema25.Array(NetworkHost)),
|
|
3741
|
+
sandbox: Schema25.optionalKey(Schema25.Literal("docker")),
|
|
3742
|
+
secrets: Schema25.optionalKey(Schema25.Record(Schema25.String, Schema25.String)),
|
|
3743
|
+
secretDestinations: Schema25.optionalKey(Schema25.Record(Schema25.String, SecretDestination)),
|
|
3744
|
+
runBaseRevision: Schema25.optionalKey(Schema25.String.check(Schema25.isMinLength(1))),
|
|
3745
|
+
mergeTarget: Schema25.optionalKey(Schema25.String.check(Schema25.isMinLength(1))),
|
|
3746
|
+
resumeNotes: Schema25.optionalKey(Schema25.Array(Schema25.String)),
|
|
3747
|
+
transcriptSequence: Schema25.optionalKey(Schema25.Int.check(Schema25.isGreaterThanOrEqualTo(1))),
|
|
3748
|
+
storageOrigin: StorageOrigin
|
|
3749
|
+
});
|
|
3750
|
+
var RunJournal = Schema25.Struct({
|
|
3751
|
+
activities: Schema25.Record(Schema25.String, Schema25.Unknown),
|
|
3752
|
+
deferreds: Schema25.Record(Schema25.String, Schema25.Unknown)
|
|
3753
|
+
});
|
|
3754
|
+
var OrchestrationWorkUnit = Schema25.Struct({
|
|
3755
|
+
kind: Schema25.Literal("orchestration"),
|
|
3756
|
+
id: Id,
|
|
3757
|
+
teamId: Schema25.optionalKey(Id),
|
|
3758
|
+
runId: Id,
|
|
3759
|
+
loopDigest: Schema25.String.check(Schema25.isMinLength(64), Schema25.isMaxLength(64), Schema25.isPattern(new RegExp("^[a-f0-9]{64}$", "u"))),
|
|
3760
|
+
input: Schema25.Unknown,
|
|
3761
|
+
granted: Schema25.Array(Schema25.String),
|
|
3762
|
+
lease: WorkUnitLease,
|
|
3763
|
+
journal: RunJournal,
|
|
3764
|
+
network: Schema25.optionalKey(AgentSandboxNetwork),
|
|
3765
|
+
storageOrigin: StorageOrigin,
|
|
3766
|
+
program: Schema25.Struct({
|
|
3767
|
+
loopId: Schema25.String.check(Schema25.isMinLength(1)),
|
|
3768
|
+
credential: Schema25.String.check(Schema25.isMinLength(1))
|
|
3769
|
+
})
|
|
3770
|
+
});
|
|
3771
|
+
var ProgramWorkUnit = OrchestrationWorkUnit.mapFields(Struct23.omit(["program"]));
|
|
3772
|
+
var CheckName = Schema25.String.check(Schema25.isMinLength(1), Schema25.isMaxLength(120), Schema25.isPattern(new RegExp("^[A-Za-z0-9][A-Za-z0-9._:-]*$", "u")));
|
|
3773
|
+
var ApprovedCheck = Schema25.Struct({
|
|
3774
|
+
name: CheckName,
|
|
3775
|
+
command: Schema25.String.check(Schema25.isMinLength(1), Schema25.isMaxLength(2000)),
|
|
3776
|
+
workingDirectory: Schema25.optionalKey(Schema25.String.check(Schema25.isMinLength(1), Schema25.isMaxLength(500))),
|
|
3777
|
+
suggested: Schema25.optionalKey(Schema25.Boolean)
|
|
3778
|
+
});
|
|
3779
|
+
var RepositoryCheck = Schema25.Struct({
|
|
3780
|
+
...ApprovedCheck.fields,
|
|
3781
|
+
pipeline: Schema25.optionalKey(Schema25.Boolean)
|
|
3782
|
+
});
|
|
3783
|
+
var MetricName = Schema25.String.check(Schema25.isMinLength(1), Schema25.isMaxLength(80), Schema25.isPattern(new RegExp("^[A-Za-z0-9][A-Za-z0-9._:-]*$", "u")));
|
|
3784
|
+
var MeasurePlan2 = Schema25.Struct({
|
|
3785
|
+
command: Schema25.String.check(Schema25.isMinLength(1), Schema25.isMaxLength(2000)),
|
|
3786
|
+
prepare: Schema25.optionalKey(Schema25.String.check(Schema25.isMinLength(1), Schema25.isMaxLength(2000))),
|
|
3787
|
+
workingDirectory: Schema25.optionalKey(Schema25.String.check(Schema25.isMinLength(1), Schema25.isMaxLength(500))),
|
|
3788
|
+
warmup: Schema25.optionalKey(Schema25.Int.check(Schema25.isGreaterThanOrEqualTo(0), Schema25.isLessThanOrEqualTo(10))),
|
|
3789
|
+
metrics: Schema25.Array(Schema25.Struct({
|
|
3790
|
+
name: MetricName,
|
|
3791
|
+
direction: Schema25.Literals(["lower", "higher"]),
|
|
3792
|
+
role: Schema25.Literals(["primary", "guardrail"]),
|
|
3793
|
+
lowVariance: Schema25.optionalKey(Schema25.Boolean)
|
|
3794
|
+
})).check(Schema25.isMinLength(1), Schema25.isMaxLength(20))
|
|
3795
|
+
});
|
|
3796
|
+
var MeasureSpec = Schema25.Struct({
|
|
3797
|
+
base: Schema25.String.check(Schema25.isMinLength(1), Schema25.isMaxLength(240)),
|
|
3798
|
+
plan: MeasurePlan2,
|
|
3799
|
+
samples: Schema25.Int.check(Schema25.isGreaterThanOrEqualTo(1), Schema25.isLessThanOrEqualTo(50)),
|
|
3800
|
+
calibrate: Schema25.Boolean
|
|
3801
|
+
});
|
|
3802
|
+
var MeasureSample = Schema25.Record(MetricName, Schema25.Finite);
|
|
3803
|
+
var MeasureSamples = Schema25.Array(MeasureSample).check(Schema25.isMaxLength(50));
|
|
3804
|
+
var MeasureEvidence = Schema25.Struct({
|
|
3805
|
+
base: MeasureSamples,
|
|
3806
|
+
head: MeasureSamples,
|
|
3807
|
+
baseAgain: Schema25.optionalKey(MeasureSamples)
|
|
3808
|
+
});
|
|
3809
|
+
var VerificationWorkUnit = Schema25.Struct({
|
|
3810
|
+
kind: Schema25.Literal("verification"),
|
|
3811
|
+
id: Id,
|
|
3812
|
+
teamId: Schema25.optionalKey(Id),
|
|
3813
|
+
runId: Id,
|
|
3814
|
+
stepKey: Schema25.String.check(Schema25.isMinLength(1), Schema25.isMaxLength(240)),
|
|
3815
|
+
lease: WorkUnitLease,
|
|
3816
|
+
repoBinding: WorkUnitRepoBinding,
|
|
3817
|
+
revision: Schema25.String.check(Schema25.isMinLength(1), Schema25.isMaxLength(240)),
|
|
3818
|
+
baseline: Schema25.optionalKey(Schema25.String.check(Schema25.isMinLength(1), Schema25.isMaxLength(300))),
|
|
3819
|
+
checks: Schema25.Array(RepositoryCheck).check(Schema25.isMaxLength(50)),
|
|
3820
|
+
measure: Schema25.optionalKey(MeasureSpec),
|
|
3821
|
+
hosts: Schema25.optionalKey(Schema25.Array(NetworkHost)),
|
|
3822
|
+
storageOrigin: StorageOrigin
|
|
3823
|
+
});
|
|
3824
|
+
var WorkUnit = Schema25.Union([OrchestrationWorkUnit, AgentStepWorkUnit, VerificationWorkUnit]);
|
|
3825
|
+
var WorkUnitClaimResult = Schema25.Struct({ workUnit: Schema25.optionalKey(WorkUnit) });
|
|
3826
|
+
var WorkUnitClaimInput = Schema25.Struct({
|
|
3827
|
+
teamId: Schema25.optionalKey(Id),
|
|
3828
|
+
runnerReplicaId: Id,
|
|
3829
|
+
capacitySlot: Schema25.String.check(Schema25.isMinLength(1), Schema25.isMaxLength(240)),
|
|
3830
|
+
idempotencyKey: Schema25.String.check(Schema25.isMinLength(1), Schema25.isMaxLength(240)),
|
|
3831
|
+
leaseDurationSeconds: Schema25.optionalKey(Schema25.Int.check(Schema25.isGreaterThanOrEqualTo(1), Schema25.isLessThanOrEqualTo(3600)))
|
|
3832
|
+
});
|
|
3833
|
+
var WorkUnitHeartbeatInput = Schema25.Struct({
|
|
3834
|
+
workUnitId: Id,
|
|
3835
|
+
lease: WorkUnitLeaseInput,
|
|
3836
|
+
leaseDurationSeconds: Schema25.optionalKey(Schema25.Int.check(Schema25.isGreaterThanOrEqualTo(1), Schema25.isLessThanOrEqualTo(3600))),
|
|
3837
|
+
secrets: Schema25.optionalKey(Schema25.Array(Schema25.Struct({ name: SecretName2, version: Schema25.String.check(Schema25.isMinLength(1), Schema25.isMaxLength(128)) })).check(Schema25.isMaxLength(256)))
|
|
3838
|
+
});
|
|
3839
|
+
var WorkUnitHeartbeatResult = Schema25.Struct({
|
|
3840
|
+
settled: Schema25.Boolean,
|
|
3841
|
+
outputSubmitted: Schema25.optionalKey(Schema25.Boolean),
|
|
3842
|
+
outputMerged: Schema25.optionalKey(Schema25.Boolean),
|
|
3843
|
+
questionOpen: Schema25.optionalKey(Schema25.Boolean),
|
|
3844
|
+
revokedSecrets: Schema25.optionalKey(Schema25.Array(SecretName2))
|
|
3845
|
+
});
|
|
3846
|
+
var WorkUnitReleaseInput = Schema25.Struct({
|
|
3847
|
+
workUnitId: Id,
|
|
3848
|
+
lease: WorkUnitLeaseInput,
|
|
3849
|
+
crashed: Schema25.optionalKey(Schema25.Struct({ reason: Schema25.String.check(Schema25.isMinLength(1), Schema25.isMaxLength(500)) }))
|
|
3850
|
+
});
|
|
3851
|
+
var CheckEvidence = Schema25.Struct({
|
|
3852
|
+
name: Schema25.String.check(Schema25.isMinLength(1), Schema25.isMaxLength(120)),
|
|
3853
|
+
command: Schema25.String.check(Schema25.isMinLength(1), Schema25.isMaxLength(2000)),
|
|
3854
|
+
status: Schema25.Union([Schema25.Literal("passed"), Schema25.Literal("failed")]),
|
|
3855
|
+
exitCode: Schema25.optionalKey(Schema25.Int),
|
|
3856
|
+
durationMs: Schema25.Int.check(Schema25.isGreaterThanOrEqualTo(0)),
|
|
3857
|
+
outputTail: Schema25.String.check(Schema25.isMaxLength(8000)),
|
|
3858
|
+
fileIds: Schema25.optionalKey(Schema25.Array(Schema25.String).check(Schema25.isMaxLength(51)))
|
|
3859
|
+
});
|
|
3860
|
+
var TreeEvidence = Schema25.Struct({
|
|
3861
|
+
revision: Schema25.String.check(Schema25.isMinLength(1), Schema25.isMaxLength(240)),
|
|
3862
|
+
tree: Schema25.String.check(Schema25.isMinLength(1), Schema25.isMaxLength(120)),
|
|
3863
|
+
checks: Schema25.Array(CheckEvidence).check(Schema25.isMaxLength(50))
|
|
3864
|
+
});
|
|
3865
|
+
var VerificationEvidence = Schema25.Struct({
|
|
3866
|
+
head: TreeEvidence,
|
|
3867
|
+
baseline: Schema25.optionalKey(TreeEvidence),
|
|
3868
|
+
measurement: Schema25.optionalKey(MeasureEvidence)
|
|
3869
|
+
});
|
|
3870
|
+
var BoundaryChange = Schema25.Struct({
|
|
3871
|
+
kind: Schema25.Literal("change"),
|
|
3872
|
+
changedPaths: Schema25.Array(Schema25.String.check(Schema25.isMinLength(1), Schema25.isMaxLength(4096))).check(Schema25.isMaxLength(1000)),
|
|
3873
|
+
omittedPaths: Schema25.Int.check(Schema25.isGreaterThanOrEqualTo(0)),
|
|
3874
|
+
files: Schema25.Array(Schema25.Struct({
|
|
3875
|
+
path: Schema25.String.check(Schema25.isMinLength(1), Schema25.isMaxLength(4096)),
|
|
3876
|
+
excerpt: Schema25.String.check(Schema25.isMaxLength(250000)),
|
|
3877
|
+
redacted: Schema25.Boolean,
|
|
3878
|
+
truncated: Schema25.Boolean
|
|
3879
|
+
})).check(Schema25.isMaxLength(20)),
|
|
3880
|
+
truncated: Schema25.Boolean
|
|
3881
|
+
});
|
|
3882
|
+
var catchUpPathLimit = 200;
|
|
3883
|
+
var CatchUpPaths = Schema25.Array(Schema25.String.check(Schema25.isMinLength(1), Schema25.isMaxLength(1000))).check(Schema25.isMaxLength(catchUpPathLimit));
|
|
3884
|
+
var Revision = Schema25.String.check(Schema25.isPattern(/^[0-9a-f]{40,64}$/));
|
|
3885
|
+
var CatchUp = Schema25.Struct({
|
|
3886
|
+
from: Revision,
|
|
3887
|
+
head: Revision,
|
|
3888
|
+
conflicted: CatchUpPaths,
|
|
3889
|
+
rewritten: CatchUpPaths,
|
|
3890
|
+
changed: CatchUpPaths,
|
|
3891
|
+
truncated: Schema25.Boolean
|
|
3892
|
+
});
|
|
3893
|
+
var HarnessHold = Schema25.Struct({
|
|
3894
|
+
reason: Schema25.Literals(HarnessHoldReasons),
|
|
3895
|
+
until: Schema25.optionalKey(Timestamp),
|
|
3896
|
+
scope: Schema25.optionalKey(Schema25.Literal("step"))
|
|
3897
|
+
});
|
|
3898
|
+
var StepRestart = Schema25.Struct({ reason: Schema25.Literal("login_revoked") });
|
|
3899
|
+
var WorkUnitOutcome = Schema25.Struct({
|
|
3900
|
+
status: Schema25.Union([
|
|
3901
|
+
Schema25.Literal("completed"),
|
|
3902
|
+
Schema25.Literal("failed"),
|
|
3903
|
+
Schema25.Literal("blocked"),
|
|
3904
|
+
Schema25.Literal("canceled")
|
|
3905
|
+
]),
|
|
3906
|
+
result: Schema25.optionalKey(LoopStepOutput),
|
|
3907
|
+
revision: Schema25.optionalKey(Schema25.String.check(Schema25.isMinLength(1), Schema25.isMaxLength(120))),
|
|
3908
|
+
evidence: Schema25.optionalKey(VerificationEvidence),
|
|
3909
|
+
boundary: Schema25.optionalKey(BoundaryChange),
|
|
3910
|
+
catchUp: Schema25.optionalKey(CatchUp),
|
|
3911
|
+
harnessHold: Schema25.optionalKey(HarnessHold),
|
|
3912
|
+
restart: Schema25.optionalKey(StepRestart),
|
|
3913
|
+
failureSummary: Schema25.optionalKey(Schema25.String.check(Schema25.isMinLength(1), Schema25.isMaxLength(4000)))
|
|
3914
|
+
});
|
|
3915
|
+
var WorkUnitCompletion = Schema25.Struct({
|
|
3916
|
+
workUnitId: Id,
|
|
3917
|
+
lease: WorkUnitLeaseInput,
|
|
3918
|
+
idempotencyKey: Schema25.String.check(Schema25.isMinLength(1), Schema25.isMaxLength(240)),
|
|
3919
|
+
outcome: WorkUnitOutcome
|
|
3920
|
+
});
|
|
3921
|
+
|
|
3922
|
+
// packages/sdk/src/loop/measure.ts
|
|
3923
|
+
import * as Effect7 from "effect/Effect";
|
|
3924
|
+
import * as Schema26 from "effect/Schema";
|
|
3925
|
+
import { DurableDeferred as DurableDeferred3 } from "effect/workflow";
|
|
3926
|
+
var MetricStats2 = Schema26.Struct({
|
|
3927
|
+
samples: Schema26.Finite,
|
|
3928
|
+
median: Schema26.Finite,
|
|
3929
|
+
mean: Schema26.Finite,
|
|
3930
|
+
min: Schema26.Finite,
|
|
3931
|
+
max: Schema26.Finite,
|
|
3932
|
+
stdev: Schema26.Finite
|
|
3933
|
+
});
|
|
3934
|
+
var MeasureVerdict2 = Schema26.Literals(["gain", "no_gain", "guardrail_regressed", "too_noisy"]);
|
|
3935
|
+
var Measurement2 = Schema26.Struct({
|
|
3936
|
+
verdict: MeasureVerdict2,
|
|
3937
|
+
reason: Schema26.String,
|
|
3938
|
+
metrics: Schema26.Array(Schema26.Struct({
|
|
3939
|
+
name: Schema26.String,
|
|
3940
|
+
role: Schema26.Literals(["primary", "guardrail"]),
|
|
3941
|
+
direction: Schema26.Literals(["lower", "higher"]),
|
|
3942
|
+
base: MetricStats2,
|
|
3943
|
+
head: MetricStats2,
|
|
3944
|
+
change: Schema26.Finite,
|
|
3945
|
+
noise: Schema26.Finite
|
|
3946
|
+
})),
|
|
3947
|
+
suggestion: Schema26.optional(Schema26.String),
|
|
3948
|
+
evidence: MeasureEvidence
|
|
3949
|
+
});
|
|
3950
|
+
var measureDeferred2 = (step) => DurableDeferred3.make(`measure/${step}`, { success: MeasureEvidence, error: StepFailed2 });
|
|
3951
|
+
var stats = (values) => {
|
|
3952
|
+
if (values.length === 0)
|
|
3953
|
+
return { samples: 0, median: 0, mean: 0, min: 0, max: 0, stdev: 0 };
|
|
3954
|
+
const sorted = [...values].sort((left, right) => left - right);
|
|
3955
|
+
const middle = Math.floor(sorted.length / 2);
|
|
3956
|
+
const mean = values.reduce((sum, value) => sum + value, 0) / values.length;
|
|
3957
|
+
return {
|
|
3958
|
+
samples: values.length,
|
|
3959
|
+
median: sorted.length % 2 === 0 ? ((sorted[middle - 1] ?? 0) + (sorted[middle] ?? 0)) / 2 : sorted[middle] ?? 0,
|
|
3960
|
+
mean,
|
|
3961
|
+
min: sorted[0] ?? 0,
|
|
3962
|
+
max: sorted.at(-1) ?? 0,
|
|
3963
|
+
stdev: Math.sqrt(values.reduce((sum, value) => sum + (value - mean) ** 2, 0) / values.length)
|
|
3964
|
+
};
|
|
3965
|
+
};
|
|
3966
|
+
var valuesOf = (samples, metric) => samples.flatMap((sample) => sample[metric] === undefined ? [] : [sample[metric]]);
|
|
3967
|
+
var incomplete = (plan, evidence) => plan.metrics.map((metric) => metric.name).filter((metric) => evidence.base.length === 0 || evidence.head.length === 0 || [...evidence.base, ...evidence.head, ...evidence.baseAgain ?? []].some((sample) => sample[metric] === undefined));
|
|
3968
|
+
var relative = (delta, of) => of === 0 ? Math.sign(delta) : delta / Math.abs(of);
|
|
3969
|
+
var noiseFloor2 = (plan, evidence) => Object.fromEntries(plan.metrics.map((metric) => {
|
|
3970
|
+
const base = stats(valuesOf(evidence.base, metric.name));
|
|
3971
|
+
const again = stats(valuesOf(evidence.baseAgain ?? [], metric.name));
|
|
3972
|
+
const spread = relative(base.stdev, base.median);
|
|
3973
|
+
const gap = again.samples === 0 ? 0 : relative(Math.abs(again.median - base.median), base.median);
|
|
3974
|
+
return [metric.name, Math.max(spread, gap)];
|
|
3975
|
+
}));
|
|
3976
|
+
var judgeMeasurement2 = (plan, evidence, noise, limits) => {
|
|
3977
|
+
const metrics = plan.metrics.map((metric) => {
|
|
3978
|
+
const base = stats(valuesOf(evidence.base, metric.name));
|
|
3979
|
+
const head = stats(valuesOf(evidence.head, metric.name));
|
|
3980
|
+
const delta = metric.direction === "lower" ? base.median - head.median : head.median - base.median;
|
|
3981
|
+
const change = base.samples === 0 || head.samples === 0 ? 0 : relative(delta, base.median);
|
|
3982
|
+
return { ...metric, base, head, change, noise: noise[metric.name] ?? 0 };
|
|
3983
|
+
});
|
|
3984
|
+
const percent = (fraction) => `${(fraction * 100).toFixed(1)}%`;
|
|
3985
|
+
const primary = metrics.find((metric) => metric.role === "primary");
|
|
3986
|
+
const judged = { metrics, evidence };
|
|
3987
|
+
if (primary === undefined)
|
|
3988
|
+
return { ...judged, verdict: "too_noisy", reason: "The plan names no primary metric" };
|
|
3989
|
+
const missing = incomplete(plan, evidence);
|
|
3990
|
+
if (missing.length > 0)
|
|
3991
|
+
return { ...judged, verdict: "too_noisy", reason: `${missing.join(", ")} is missing from some samples` };
|
|
3992
|
+
if (!Number.isFinite(primary.noise) || primary.noise > limits.threshold) {
|
|
3993
|
+
const steadier = plan.metrics.find((metric) => metric.lowVariance === true && metric.name !== primary.name);
|
|
3994
|
+
return {
|
|
3995
|
+
...judged,
|
|
3996
|
+
verdict: "too_noisy",
|
|
3997
|
+
reason: `${primary.name} strays ${percent(primary.noise)} from itself, more than the ${percent(limits.threshold)} threshold`,
|
|
3998
|
+
suggestion: steadier === undefined ? "Measure a low-variance counter (instructions, allocations, queries) and make it the primary metric" : `Make ${steadier.name}, which varies less, the primary metric`
|
|
3999
|
+
};
|
|
4000
|
+
}
|
|
4001
|
+
const regressed = metrics.filter((metric) => metric.role === "guardrail" && metric.change < -(limits.tolerance + metric.noise));
|
|
4002
|
+
if (regressed.length > 0)
|
|
4003
|
+
return {
|
|
4004
|
+
...judged,
|
|
4005
|
+
verdict: "guardrail_regressed",
|
|
4006
|
+
reason: regressed.map((metric) => `${metric.name} got ${percent(-metric.change)} worse, beyond the ${percent(limits.tolerance)} tolerance`).join("; ")
|
|
4007
|
+
};
|
|
4008
|
+
return primary.change > limits.threshold + primary.noise ? {
|
|
4009
|
+
...judged,
|
|
4010
|
+
verdict: "gain",
|
|
4011
|
+
reason: `${primary.name} improved ${percent(primary.change)}, past the ${percent(limits.threshold)} threshold and ${percent(primary.noise)} of noise`
|
|
4012
|
+
} : {
|
|
4013
|
+
...judged,
|
|
4014
|
+
verdict: "no_gain",
|
|
4015
|
+
reason: `${primary.name} changed ${percent(primary.change)}, within the ${percent(limits.threshold)} threshold and ${percent(primary.noise)} of noise`
|
|
4016
|
+
};
|
|
4017
|
+
};
|
|
4018
|
+
var floors = new WeakMap;
|
|
4019
|
+
var measure2 = (name, request) => takeStep2(name, "measure", "measure", Effect7.gen(function* () {
|
|
4020
|
+
const run = yield* LoopRun2;
|
|
4021
|
+
const known = floors.get(run);
|
|
4022
|
+
const deferred = measureDeferred2(name);
|
|
4023
|
+
yield* launch2(deferred, (host, token) => host.startVerification({
|
|
4024
|
+
step: name,
|
|
4025
|
+
...request.head === undefined ? undefined : { revision: request.head },
|
|
4026
|
+
measure: {
|
|
4027
|
+
...request.base === undefined ? undefined : { base: request.base },
|
|
4028
|
+
plan: request.plan,
|
|
4029
|
+
samples: request.samples ?? 5,
|
|
4030
|
+
calibrate: known === undefined
|
|
4031
|
+
},
|
|
4032
|
+
token
|
|
4033
|
+
}));
|
|
4034
|
+
const evidence = yield* DurableDeferred3.await(deferred);
|
|
4035
|
+
const noise = known ?? noiseFloor2(request.plan, evidence);
|
|
4036
|
+
if (known === undefined && incomplete(request.plan, evidence).length === 0)
|
|
4037
|
+
floors.set(run, noise);
|
|
4038
|
+
return judgeMeasurement2(request.plan, evidence, noise, {
|
|
4039
|
+
threshold: request.threshold ?? 0.05,
|
|
4040
|
+
tolerance: request.tolerance ?? 0.02
|
|
4041
|
+
});
|
|
4042
|
+
}));
|
|
4043
|
+
|
|
4044
|
+
// packages/sdk/src/loop/test-loop.ts
|
|
4045
|
+
var LoopJournal2 = Schema27.Struct({
|
|
4046
|
+
activities: Schema27.Record(Schema27.String, Schema27.Json),
|
|
4047
|
+
deferreds: Schema27.Record(Schema27.String, Schema27.Json)
|
|
3880
4048
|
});
|
|
3881
4049
|
|
|
3882
4050
|
class ScriptedFailure2 extends Data2.TaggedClass("ScriptedFailure") {
|
|
@@ -3884,106 +4052,140 @@ class ScriptedFailure2 extends Data2.TaggedClass("ScriptedFailure") {
|
|
|
3884
4052
|
var scriptedFailure2 = (reason) => new ScriptedFailure2({ reason });
|
|
3885
4053
|
var defaultActivities = {
|
|
3886
4054
|
changeRequest: {
|
|
3887
|
-
run: () =>
|
|
4055
|
+
run: () => Effect8.succeed({ id: "change-request-1", number: "1", url: "test://change-requests/1" })
|
|
3888
4056
|
},
|
|
3889
|
-
writeBack: { run: () =>
|
|
3890
|
-
artifact: { run: (request) =>
|
|
3891
|
-
file: { run: (_request, step) =>
|
|
3892
|
-
note: { run: () =>
|
|
3893
|
-
comment: { run: () =>
|
|
4057
|
+
writeBack: { run: () => Effect8.void },
|
|
4058
|
+
artifact: { run: (request) => Effect8.succeed({ artifactId: request.title }) },
|
|
4059
|
+
file: { run: (_request, step) => Effect8.succeed({ id: `file-${step}` }) },
|
|
4060
|
+
note: { run: () => Effect8.void },
|
|
4061
|
+
comment: { run: () => Effect8.void },
|
|
3894
4062
|
createTasks: {
|
|
3895
|
-
run: (request) =>
|
|
4063
|
+
run: (request) => Effect8.succeed({ tasks: request.tickets.map((ticket) => ({ key: ticket.key, taskId: `task-${ticket.key}` })) })
|
|
3896
4064
|
},
|
|
4065
|
+
alertTask: { run: () => Effect8.succeed({ taskId: "task-alert", created: true }) },
|
|
3897
4066
|
integrationBranch: {
|
|
3898
|
-
run: (request) =>
|
|
4067
|
+
run: (request) => Effect8.succeed({
|
|
3899
4068
|
repoBindingId: request.repoBindingId ?? "repo",
|
|
3900
4069
|
branch: "kitman/run/integration",
|
|
3901
4070
|
revision: "integration-head"
|
|
3902
4071
|
})
|
|
3903
4072
|
},
|
|
3904
4073
|
mergeChangeRequest: {
|
|
3905
|
-
run: (request) =>
|
|
4074
|
+
run: (request) => Effect8.succeed({ status: "merged", revision: `merged-${request.changeRequestId}` }),
|
|
4075
|
+
close: () => Effect8.succeed({ closed: true }),
|
|
4076
|
+
rerun: () => Effect8.succeed({ head: "head", pipelines: 1 }),
|
|
4077
|
+
report: () => Effect8.succeed({ head: "head", status: "success" }),
|
|
4078
|
+
approve: (request) => Effect8.succeed({ approved: true, reviewId: `review-${request.changeRequestId}` })
|
|
3906
4079
|
},
|
|
3907
4080
|
release: {
|
|
3908
|
-
run: (request) =>
|
|
4081
|
+
run: (request) => Effect8.succeed({
|
|
3909
4082
|
tag: request.tag,
|
|
3910
4083
|
revision: request.revision ?? "base-head",
|
|
3911
4084
|
url: `test://releases/${request.tag}`
|
|
3912
4085
|
})
|
|
3913
4086
|
},
|
|
3914
|
-
transcripts: { run: () =>
|
|
3915
|
-
|
|
4087
|
+
transcripts: { run: () => Effect8.succeed({ runs: [] }) },
|
|
4088
|
+
changeRequestRead: {
|
|
4089
|
+
pipeline: () => Effect8.succeed({ head: "head", status: "success", source: "forge", jobs: [] }),
|
|
4090
|
+
reviewThreads: () => Effect8.succeed({ threads: [] }),
|
|
4091
|
+
opened: () => Effect8.succeed({ changeRequests: [] }),
|
|
4092
|
+
own: () => Effect8.succeed({ changeRequests: [] })
|
|
4093
|
+
},
|
|
4094
|
+
propose: { run: (request, step) => Effect8.succeed({ kind: request.kind, id: `${request.kind}-${step}` }) },
|
|
3916
4095
|
projectActivity: {
|
|
3917
|
-
run: (request) =>
|
|
4096
|
+
run: (request) => Effect8.succeed({ project: { id: request.projectId, name: request.projectId }, runs: [], taskChanges: [] })
|
|
3918
4097
|
},
|
|
3919
|
-
draftUpdate: { run: (_, step) =>
|
|
4098
|
+
draftUpdate: { run: (_, step) => Effect8.succeed({ id: `draft-${step}` }) }
|
|
3920
4099
|
};
|
|
3921
|
-
var withoutServices = (effect) =>
|
|
3922
|
-
var deferredExit = (deferred) =>
|
|
4100
|
+
var withoutServices = (effect) => Effect8.orDie(Effect8.provide(effect, Context3.empty()));
|
|
4101
|
+
var deferredExit = (deferred) => Schema27.Exit(Schema27.toCodecJson(deferred.successSchema), Schema27.toCodecJson(deferred.errorSchema), Schema27.toCodecJson(Schema27.Defect()));
|
|
3923
4102
|
var journaled = (engine, journal, ran) => ({
|
|
3924
4103
|
...engine,
|
|
3925
|
-
activityExecute: (activity, attempt) =>
|
|
4104
|
+
activityExecute: (activity, attempt) => Effect8.gen(function* () {
|
|
3926
4105
|
const key = `${activity.name}/${attempt}`;
|
|
3927
4106
|
const recorded = journal.activities[key];
|
|
3928
4107
|
if (recorded !== undefined)
|
|
3929
4108
|
return new Workflow.Complete({
|
|
3930
|
-
exit: yield* withoutServices(
|
|
4109
|
+
exit: yield* withoutServices(Schema27.decodeEffect(Schema27.toCodecJson(activity.exitSchema))(recorded))
|
|
3931
4110
|
});
|
|
3932
4111
|
const result = yield* engine.activityExecute(activity, attempt);
|
|
3933
4112
|
if (result instanceof Workflow.Complete) {
|
|
3934
4113
|
ran.push(activity.name);
|
|
3935
|
-
journal.activities[key] = yield* withoutServices(
|
|
4114
|
+
journal.activities[key] = yield* withoutServices(Schema27.encodeEffect(Schema27.toCodecJson(activity.exitSchema))(result.exit));
|
|
3936
4115
|
}
|
|
3937
4116
|
return result;
|
|
3938
4117
|
}),
|
|
3939
|
-
deferredResult: (deferred) =>
|
|
4118
|
+
deferredResult: (deferred) => Effect8.gen(function* () {
|
|
3940
4119
|
const recorded = journal.deferreds[deferred.name];
|
|
3941
4120
|
if (recorded !== undefined)
|
|
3942
|
-
return Option2.some(yield* withoutServices(
|
|
4121
|
+
return Option2.some(yield* withoutServices(Schema27.decodeEffect(Schema27.toCodecJson(deferredExit(deferred)))(recorded)));
|
|
3943
4122
|
const result = yield* engine.deferredResult(deferred);
|
|
3944
4123
|
if (Option2.isSome(result))
|
|
3945
|
-
journal.deferreds[deferred.name] = yield* withoutServices(
|
|
4124
|
+
journal.deferreds[deferred.name] = yield* withoutServices(Schema27.encodeEffect(Schema27.toCodecJson(deferredExit(deferred)))(result.value));
|
|
3946
4125
|
return result;
|
|
3947
4126
|
})
|
|
3948
4127
|
});
|
|
3949
4128
|
var scriptedExit = (scripted, failure) => scripted === undefined ? Exit3.fail(failure("nothing was scripted for this Step")) : scripted instanceof ScriptedFailure2 ? Exit3.fail(failure(scripted.reason)) : Exit3.succeed(scripted);
|
|
3950
|
-
var scriptedHost = (script, engine, agentLaunches, childLaunches) => {
|
|
3951
|
-
const resolve = (deferred, token, exit) =>
|
|
4129
|
+
var scriptedHost = (script, engine, agentLaunches, childLaunches, waits) => {
|
|
4130
|
+
const resolve = (deferred, token, exit) => DurableDeferred4.done(deferred, { token, exit }).pipe(Effect8.provideService(WorkflowEngine.WorkflowEngine, engine));
|
|
3952
4131
|
return {
|
|
3953
|
-
startAgentWork: (launch) =>
|
|
4132
|
+
startAgentWork: (launch) => Effect8.andThen(Effect8.sync(() => agentLaunches.push({
|
|
3954
4133
|
step: launch.step,
|
|
3955
4134
|
agent: launch.agent,
|
|
3956
4135
|
prompt: launch.prompt,
|
|
3957
|
-
...launch.
|
|
3958
|
-
|
|
4136
|
+
...launch.skill === undefined ? undefined : { skill: launch.skill },
|
|
4137
|
+
...launch.secrets === undefined ? undefined : { secrets: launch.secrets },
|
|
4138
|
+
...launch.mergeTarget === undefined ? undefined : { mergeTarget: launch.mergeTarget }
|
|
4139
|
+
})), resolve(agentDeferredNamed2(launch.deferredName), launch.token, scriptedExit(script.outputs?.[launch.step], (reason) => new StepFailed2({ step: launch.step, reason })))),
|
|
3959
4140
|
putQuestion: (launch) => {
|
|
3960
|
-
const answer = script.answers?.[launch.step];
|
|
4141
|
+
const answer = script.answers?.[launch.step] ?? launch.default;
|
|
3961
4142
|
return resolve(answerDeferred2(launch.step), launch.token, answer === undefined ? Exit3.fail(new StepFailed2({ step: launch.step, reason: "no answer was scripted" })) : Exit3.succeed(answer));
|
|
3962
4143
|
},
|
|
3963
|
-
admitChild: (launch) =>
|
|
4144
|
+
admitChild: (launch) => Effect8.andThen(Effect8.sync(() => childLaunches.push({ step: launch.step, loop: launch.loop, input: launch.input })), resolve(childDeferred2(launch.step), launch.token, scriptedExit(script.children?.[launch.step], (reason) => new ChildFailed2({ step: launch.step, loop: launch.loop, reason })))),
|
|
3964
4145
|
awaitEvent: (launch) => {
|
|
3965
4146
|
const event = script.events?.[launch.step];
|
|
4147
|
+
waits.push({
|
|
4148
|
+
step: launch.step,
|
|
4149
|
+
event: launch.event,
|
|
4150
|
+
...launch.filter === undefined ? undefined : { filter: launch.filter },
|
|
4151
|
+
...launch.since === undefined ? undefined : { since: launch.since },
|
|
4152
|
+
...launch.or === undefined ? undefined : { or: launch.or }
|
|
4153
|
+
});
|
|
3966
4154
|
return resolve(eventDeferred2(launch.step), launch.token, event === undefined ? Exit3.fail(new WaitTimedOut2({ step: launch.step, event: launch.event })) : Exit3.succeed(event));
|
|
3967
4155
|
},
|
|
4156
|
+
claimResource: (launch) => launch.action === "let_go" ? resolve(letGoDeferred2(launch.step), launch.token, Exit3.succeed(null)) : resolve(claimDeferred2(launch.step), launch.token, Exit3.succeed(script.claims?.[launch.step] ?? { status: "granted", resource: launch.resource })),
|
|
3968
4157
|
startVerification: (launch) => {
|
|
3969
4158
|
const scripted = script.verifications?.[launch.step];
|
|
4159
|
+
if (launch.measure !== undefined) {
|
|
4160
|
+
const measured = script.measurements?.[launch.step];
|
|
4161
|
+
const flat = Array.from({ length: launch.measure.samples }, () => Object.fromEntries(launch.measure?.plan.metrics.map((metric) => [metric.name, 100]) ?? []));
|
|
4162
|
+
return resolve(measureDeferred2(launch.step), launch.token, measured instanceof ScriptedFailure2 ? Exit3.fail(new StepFailed2({ step: launch.step, reason: measured.reason })) : Exit3.succeed(measured ?? { base: flat, head: flat, ...launch.measure.calibrate ? { baseAgain: flat } : undefined }));
|
|
4163
|
+
}
|
|
3970
4164
|
return resolve(verifyDeferred2(launch.step), launch.token, scripted instanceof ScriptedFailure2 ? Exit3.fail(new StepFailed2({ step: launch.step, reason: scripted.reason })) : Exit3.succeed(scripted ?? {
|
|
3971
4165
|
revision: launch.revision ?? "head",
|
|
3972
4166
|
tree: launch.revision ?? "head",
|
|
3973
4167
|
passed: true,
|
|
3974
|
-
checks: []
|
|
4168
|
+
checks: (launch.suggested ?? []).map((check) => ({
|
|
4169
|
+
name: check.name,
|
|
4170
|
+
command: check.command,
|
|
4171
|
+
status: "passed",
|
|
4172
|
+
preExisting: false,
|
|
4173
|
+
durationMs: 0,
|
|
4174
|
+
evidenceId: `suggested-${check.name}`,
|
|
4175
|
+
suggested: true
|
|
4176
|
+
}))
|
|
3975
4177
|
}));
|
|
3976
4178
|
}
|
|
3977
4179
|
};
|
|
3978
4180
|
};
|
|
3979
4181
|
var loopWorkflow2 = (loop) => Workflow.make(`kitman-loop/${loop.id}`, {
|
|
3980
|
-
payload: { input:
|
|
4182
|
+
payload: { input: Schema27.Json },
|
|
3981
4183
|
idempotencyKey: () => loop.id,
|
|
3982
4184
|
success: loop.output,
|
|
3983
|
-
error:
|
|
4185
|
+
error: Schema27.declare((_error) => true)
|
|
3984
4186
|
});
|
|
3985
|
-
var executeLoop2 = (loop, runtime) => ({ input }) =>
|
|
3986
|
-
const decoded = yield*
|
|
4187
|
+
var executeLoop2 = (loop, runtime) => ({ input }) => Effect8.gen(function* () {
|
|
4188
|
+
const decoded = yield* Schema27.decodeEffect(Schema27.toCodecJson(loop.input))(input).pipe(Effect8.mapError((error) => new InputInvalid2({ loop: loop.id, message: error.message })));
|
|
3987
4189
|
const run = LoopRun2.of({
|
|
3988
4190
|
loop: loop.id,
|
|
3989
4191
|
agents: loop.agents,
|
|
@@ -3993,7 +4195,7 @@ var executeLoop2 = (loop, runtime) => ({ input }) => Effect6.gen(function* () {
|
|
|
3993
4195
|
steps: []
|
|
3994
4196
|
});
|
|
3995
4197
|
runtime.onRun?.(run);
|
|
3996
|
-
return yield* loop.run(decoded).pipe(
|
|
4198
|
+
return yield* loop.run(decoded).pipe(Effect8.provideService(LoopRun2, run), Effect8.provideService(LoopHost2, runtime.host), Effect8.provideService(ChangeRequestActivity2, runtime.activities.changeRequest), Effect8.provideService(WriteBackActivity2, runtime.activities.writeBack), Effect8.provideService(ArtifactActivity2, runtime.activities.artifact), Effect8.provideService(FileActivity2, runtime.activities.file), Effect8.provideService(NoteActivity2, runtime.activities.note), Effect8.provideService(CommentActivity2, runtime.activities.comment), Effect8.provideService(CreateTasksActivity2, runtime.activities.createTasks), Effect8.provideService(AlertTaskActivity2, runtime.activities.alertTask), Effect8.provideService(IntegrationBranchActivity2, runtime.activities.integrationBranch), Effect8.provideService(MergeChangeRequestActivity2, runtime.activities.mergeChangeRequest), Effect8.provideService(ReleaseActivity2, runtime.activities.release), Effect8.provideService(TranscriptsActivity2, runtime.activities.transcripts), Effect8.provideService(ChangeRequestReadActivity2, runtime.activities.changeRequestRead), Effect8.provideService(ProposeActivity2, runtime.activities.propose), Effect8.provideService(ProjectActivityActivity2, runtime.activities.projectActivity), Effect8.provideService(DraftUpdateActivity2, runtime.activities.draftUpdate));
|
|
3997
4199
|
});
|
|
3998
4200
|
var testLoop2 = (loop, script) => {
|
|
3999
4201
|
const journal = {
|
|
@@ -4003,43 +4205,49 @@ var testLoop2 = (loop, script) => {
|
|
|
4003
4205
|
const ran = [];
|
|
4004
4206
|
const agentLaunches = [];
|
|
4005
4207
|
const childLaunches = [];
|
|
4208
|
+
const waits = [];
|
|
4006
4209
|
let latestSteps = [];
|
|
4007
|
-
const
|
|
4008
|
-
const
|
|
4210
|
+
const declared = capabilitiesOf2(loop);
|
|
4211
|
+
const granted = new Set((script.grant ?? declared).filter((capability) => declared.includes(capability)));
|
|
4212
|
+
const overrides = script.activities ?? {};
|
|
4213
|
+
const activities = Record12.map(defaultActivities, (service, key) => ({
|
|
4214
|
+
...service,
|
|
4215
|
+
...overrides[key]
|
|
4216
|
+
}));
|
|
4009
4217
|
const workflow = loopWorkflow2(loop);
|
|
4010
|
-
const execute = (payload) =>
|
|
4218
|
+
const execute = (payload) => Effect8.gen(function* () {
|
|
4011
4219
|
const engine = yield* WorkflowEngine.WorkflowEngine;
|
|
4012
4220
|
return yield* executeLoop2(loop, {
|
|
4013
|
-
host: scriptedHost(script, engine, agentLaunches, childLaunches),
|
|
4221
|
+
host: scriptedHost(script, engine, agentLaunches, childLaunches, waits),
|
|
4014
4222
|
activities,
|
|
4015
4223
|
granted,
|
|
4016
4224
|
onRun: (run) => {
|
|
4017
4225
|
latestSteps = run.steps;
|
|
4018
4226
|
}
|
|
4019
|
-
})(payload).pipe(
|
|
4227
|
+
})(payload).pipe(Effect8.provideService(WorkflowEngine.WorkflowEngine, journaled(engine, journal, ran)));
|
|
4020
4228
|
});
|
|
4021
|
-
return
|
|
4022
|
-
const result = yield*
|
|
4023
|
-
return { result, steps: latestSteps, journal, activities: ran, agentLaunches, childLaunches };
|
|
4024
|
-
}).pipe(
|
|
4229
|
+
return Effect8.gen(function* () {
|
|
4230
|
+
const result = yield* Effect8.exit(workflow.execute({ input: script.input }).pipe(Effect8.provideService(ConfigProvider.ConfigProvider, ConfigProvider.fromUnknown(script.secrets ?? {}))));
|
|
4231
|
+
return { result, steps: latestSteps, journal, activities: ran, agentLaunches, childLaunches, waits };
|
|
4232
|
+
}).pipe(Effect8.provide(workflow.toLayer(execute).pipe(Layer.provideMerge(WorkflowEngine.layerMemory))));
|
|
4025
4233
|
};
|
|
4026
4234
|
// packages/sdk/src/loop/review.ts
|
|
4027
|
-
import * as
|
|
4028
|
-
var Severity2 =
|
|
4029
|
-
var Finding2 =
|
|
4235
|
+
import * as Schema28 from "effect/Schema";
|
|
4236
|
+
var Severity2 = Schema28.Literals(["blocker", "major", "minor"]);
|
|
4237
|
+
var Finding2 = Schema28.Struct({
|
|
4030
4238
|
severity: Severity2,
|
|
4031
|
-
file:
|
|
4032
|
-
line:
|
|
4033
|
-
detail:
|
|
4239
|
+
file: Schema28.String,
|
|
4240
|
+
line: Schema28.Int,
|
|
4241
|
+
detail: Schema28.String
|
|
4034
4242
|
});
|
|
4035
|
-
var MergedFinding2 =
|
|
4036
|
-
id:
|
|
4243
|
+
var MergedFinding2 = Schema28.Struct({
|
|
4244
|
+
id: Schema28.String,
|
|
4037
4245
|
...Finding2.fields,
|
|
4038
|
-
seats:
|
|
4246
|
+
seats: Schema28.Array(Schema28.String)
|
|
4039
4247
|
});
|
|
4040
|
-
var Rebuttal2 =
|
|
4041
|
-
var RebuttalVerdict2 =
|
|
4042
|
-
var ScopeJudgement2 =
|
|
4248
|
+
var Rebuttal2 = Schema28.Struct({ findingId: Schema28.String, reason: Schema28.String });
|
|
4249
|
+
var RebuttalVerdict2 = Schema28.Struct({ findingId: Schema28.String, accepted: Schema28.Boolean });
|
|
4250
|
+
var ScopeJudgement2 = Schema28.Struct({ met: Schema28.Boolean, unmet: Schema28.Array(Schema28.String) });
|
|
4043
4251
|
var rank = { blocker: 0, major: 1, minor: 2 };
|
|
4044
4252
|
var isBlocking2 = (finding) => finding.severity !== "minor";
|
|
4045
4253
|
var mergeFindings2 = (bySeat) => {
|
|
@@ -4094,14 +4302,14 @@ var rallyStop2 = (input) => {
|
|
|
4094
4302
|
var sameIds = (left, right) => left.length === right.length && left.every((id) => right.includes(id));
|
|
4095
4303
|
// packages/sdk/src/loop/check.ts
|
|
4096
4304
|
import * as Cause2 from "effect/Cause";
|
|
4097
|
-
import * as
|
|
4305
|
+
import * as Effect9 from "effect/Effect";
|
|
4098
4306
|
import * as Exit5 from "effect/Exit";
|
|
4099
|
-
import * as
|
|
4100
|
-
import * as
|
|
4101
|
-
class CheckFailed2 extends
|
|
4102
|
-
loop:
|
|
4103
|
-
check:
|
|
4104
|
-
reason:
|
|
4307
|
+
import * as Predicate3 from "effect/Predicate";
|
|
4308
|
+
import * as Schema29 from "effect/Schema";
|
|
4309
|
+
class CheckFailed2 extends Schema29.TaggedError()("CheckFailed", {
|
|
4310
|
+
loop: Schema29.String,
|
|
4311
|
+
check: Schema29.String,
|
|
4312
|
+
reason: Schema29.String
|
|
4105
4313
|
}) {
|
|
4106
4314
|
get detail() {
|
|
4107
4315
|
return `Check "${this.check}": ${this.reason}`;
|
|
@@ -4111,10 +4319,10 @@ class CheckFailed2 extends Schema22.TaggedError()("CheckFailed", {
|
|
|
4111
4319
|
}
|
|
4112
4320
|
}
|
|
4113
4321
|
|
|
4114
|
-
class StepNamedTwice2 extends
|
|
4115
|
-
loop:
|
|
4116
|
-
check:
|
|
4117
|
-
step:
|
|
4322
|
+
class StepNamedTwice2 extends Schema29.TaggedError()("StepNamedTwice", {
|
|
4323
|
+
loop: Schema29.String,
|
|
4324
|
+
check: Schema29.String,
|
|
4325
|
+
step: Schema29.String
|
|
4118
4326
|
}) {
|
|
4119
4327
|
get detail() {
|
|
4120
4328
|
return `Check "${this.check}": Step "${this.step}" is named twice`;
|
|
@@ -4124,12 +4332,12 @@ class StepNamedTwice2 extends Schema22.TaggedError()("StepNamedTwice", {
|
|
|
4124
4332
|
}
|
|
4125
4333
|
}
|
|
4126
4334
|
|
|
4127
|
-
class ReplayDiverged2 extends
|
|
4128
|
-
loop:
|
|
4129
|
-
check:
|
|
4130
|
-
first:
|
|
4131
|
-
replay:
|
|
4132
|
-
rerun:
|
|
4335
|
+
class ReplayDiverged2 extends Schema29.TaggedError()("ReplayDiverged", {
|
|
4336
|
+
loop: Schema29.String,
|
|
4337
|
+
check: Schema29.String,
|
|
4338
|
+
first: Schema29.Array(Schema29.String),
|
|
4339
|
+
replay: Schema29.Array(Schema29.String),
|
|
4340
|
+
rerun: Schema29.Array(Schema29.String)
|
|
4133
4341
|
}) {
|
|
4134
4342
|
get detail() {
|
|
4135
4343
|
const steps = (names) => names.join(", ") || "no Steps";
|
|
@@ -4139,12 +4347,12 @@ class ReplayDiverged2 extends Schema22.TaggedError()("ReplayDiverged", {
|
|
|
4139
4347
|
return `Loop "${this.loop}": ${this.detail}`;
|
|
4140
4348
|
}
|
|
4141
4349
|
}
|
|
4142
|
-
var LoopCheckError2 =
|
|
4143
|
-
var checkLoop2 = (loop, check) =>
|
|
4350
|
+
var LoopCheckError2 = Schema29.Union([CheckFailed2, StepNamedTwice2, ReplayDiverged2]);
|
|
4351
|
+
var checkLoop2 = (loop, check) => Effect9.gen(function* () {
|
|
4144
4352
|
const first = yield* testLoop2(loop, check.script);
|
|
4145
4353
|
if (Exit5.isFailure(first.result)) {
|
|
4146
4354
|
const error = Cause2.squash(first.result.cause);
|
|
4147
|
-
if (
|
|
4355
|
+
if (Predicate3.isTagged(error, "DuplicateStep") && Predicate3.hasProperty(error, "step"))
|
|
4148
4356
|
return yield* new StepNamedTwice2({ loop: loop.id, check: check.name, step: String(error.step) });
|
|
4149
4357
|
return yield* new CheckFailed2({
|
|
4150
4358
|
loop: loop.id,
|
|
@@ -4164,5 +4372,64 @@ var checkLoop2 = (loop, check) => Effect7.gen(function* () {
|
|
|
4164
4372
|
});
|
|
4165
4373
|
});
|
|
4166
4374
|
// packages/sdk/src/loop/config.ts
|
|
4167
|
-
var
|
|
4168
|
-
|
|
4375
|
+
var defineKit2 = (config) => ({ ...config, loops: config.loops ?? [] });
|
|
4376
|
+
// packages/sdk/src/loop/sync.ts
|
|
4377
|
+
import * as Schema30 from "effect/Schema";
|
|
4378
|
+
var UpToDate = Schema30.Struct({ status: Schema30.Literal("up_to_date") });
|
|
4379
|
+
var Conflict = Schema30.Struct({
|
|
4380
|
+
status: Schema30.Literal("conflict"),
|
|
4381
|
+
files: Schema30.NonEmptyArray(Schema30.String),
|
|
4382
|
+
reason: Schema30.String
|
|
4383
|
+
});
|
|
4384
|
+
var merged = {
|
|
4385
|
+
status: Schema30.Literal("merged"),
|
|
4386
|
+
settled: Schema30.Array(Schema30.String)
|
|
4387
|
+
};
|
|
4388
|
+
var SyncAnswer = Schema30.Union([UpToDate, Schema30.Struct(merged), Conflict]);
|
|
4389
|
+
var BaseSync2 = Schema30.Union([
|
|
4390
|
+
UpToDate,
|
|
4391
|
+
Schema30.Struct({ ...merged, catchUp: Schema30.optionalKey(CatchUp) }),
|
|
4392
|
+
Conflict
|
|
4393
|
+
]);
|
|
4394
|
+
var afterMerge = "One thing comes before any answer of merged, a clean merge included, and stopping above means stopping after it: before you answer merged, do what the repository's agent instructions say to do once the target branch is merged in, such as regenerating this branch's database migrations on top of the target's. Leave what that changes in the workspace: Kitman commits it.";
|
|
4395
|
+
var prompt = (target) => [
|
|
4396
|
+
`Kitman merged \`origin/${target}\` into this branch before you started, outside your sandbox, and says what came of it in a note after this brief. Do not fetch, as this workspace has no credential for the forge, and do not run git commands that write, such as \`git add\`, \`git commit\` or \`git merge --abort\`: Kitman finishes the merge itself from your answer.`,
|
|
4397
|
+
"If it was already up to date, change nothing and answer up_to_date. If it merged cleanly, answer merged with no settled files and stop: do not review or test anything else.",
|
|
4398
|
+
"If it conflicts, settle each file the note names so both sides' intent survives: leave no conflict marker, and for a file one side deleted or git could not mark, leave it as the version you want or delete it. Run the tests of the files you touched, and answer merged with those files under settled. Kitman then commits the files as you left them.",
|
|
4399
|
+
"If you cannot settle a file, answer conflict with the files and why: Kitman then aborts the whole merge.",
|
|
4400
|
+
"Never rebase, reset or force-push: this branch's history only grows."
|
|
4401
|
+
].concat(afterMerge).join(`
|
|
4402
|
+
|
|
4403
|
+
`);
|
|
4404
|
+
var syncBase2 = (name, options) => agentWorkAs2(syncDeferred2, name, {
|
|
4405
|
+
agent: options.agent,
|
|
4406
|
+
prompt: prompt(options.target ?? "HEAD"),
|
|
4407
|
+
output: BaseSync2,
|
|
4408
|
+
answer: SyncAnswer,
|
|
4409
|
+
mergeTarget: options.target ?? "HEAD"
|
|
4410
|
+
});
|
|
4411
|
+
// packages/sdk/src/loop/continuing.ts
|
|
4412
|
+
import * as Schema31 from "effect/Schema";
|
|
4413
|
+
var Continuing2 = Schema31.Struct({
|
|
4414
|
+
changeRequestId: Schema31.String,
|
|
4415
|
+
number: Schema31.String,
|
|
4416
|
+
url: Schema31.String,
|
|
4417
|
+
branch: Schema31.String,
|
|
4418
|
+
targetBranch: Schema31.String,
|
|
4419
|
+
revision: Schema31.optional(Schema31.String),
|
|
4420
|
+
lastRunId: Schema31.optional(Schema31.String),
|
|
4421
|
+
lastRunStatus: Schema31.optional(Schema31.String),
|
|
4422
|
+
lastRunSummary: Schema31.optional(Schema31.String)
|
|
4423
|
+
});
|
|
4424
|
+
var continuingBrief2 = (continuing) => [
|
|
4425
|
+
`This continues the work on ${continuing.branch}, whose ChangeRequest is ${continuing.url}. Build on what is there; do not start over.`,
|
|
4426
|
+
...continuing.lastRunId === undefined ? [] : [
|
|
4427
|
+
`The last Run on it, ${continuing.lastRunId}, ended ${continuing.lastRunStatus ?? "unfinished"}${continuing.lastRunSummary === undefined ? "" : `: ${continuing.lastRunSummary}`}.`
|
|
4428
|
+
],
|
|
4429
|
+
...continuing.revision === undefined ? [] : [
|
|
4430
|
+
`It last pushed ${continuing.revision}. If the branch head is newer, someone pushed since: read \`git log ${continuing.revision}..HEAD\` first and keep their work.`
|
|
4431
|
+
],
|
|
4432
|
+
"The ChangeRequest's description lists what was left unsettled; settle those first."
|
|
4433
|
+
].join(`
|
|
4434
|
+
`);
|
|
4435
|
+
export { Numeric, isWholeNumber, guard, Id, Timestamp, canonicalJson, KitDigest, LoopCapabilities2, LoopManifest, AgentDeclaration, KitDeclarations, LoopOutcome2, capabilitiesOf2, defineLoop2, ManifestInvalid2, jsonSchemaOf2, loopManifest2, questionAdvice, EvidenceCheck2, VerifyResult2, OutcomeTable2, failsOn2, evidenceGate2, StepFailed2, OutputInvalid2, QuestionRefused2, WaitTimedOut2, ChangeRequestClosed2, ChildFailed2, CapabilityDenied2, DuplicateStep2, InputInvalid2, LoopEvent2, LoopRun2, LoopHost2, agentDeferredNamed2, agentWorkDeferred2, syncDeferred2, answerDeferred2, childDeferred2, eventDeferred2, verifyDeferred2, takeStep2, launch2, agentWork2, agentWorkAs2, agentWorkOnce2, ask2, call2, waitFor2, verify2, suggestVerification2, PlanTicket2, PlanTickets2, BlockingCycle2, planWaves2, ChangeRequestRequest2, ChangeRequestResult2, WriteBackMilestones2, WriteBackRequest2, RunFile2, FileRequest2, ArtifactRequest2, ArtifactResult2, NoteRequest2, CreateTasksRequest2, CreateTasksResult2, AlertTaskRequest2, AlertTaskResult2, IntegrationBranchRequest2, IntegrationBranch2, MergeChangeRequestRequest2, MergeResult2, ApproveChangeRequestRequest2, ApproveChangeRequestResult2, CloseChangeRequestRequest2, CloseChangeRequestResult2, RerunPipelineRequest2, RerunPipelineResult2, ReportPipelineRequest2, ReportPipelineResult2, CommentRequest2, ReleaseRequest2, ReleaseResult2, ChangeRequestReadRequest2, PipelineJob2, PipelineStatus2, ReviewThread2, ReviewThreads2, OpenChangeRequestsRequest2, OpenChangeRequest2, OpenChangeRequests2, OwnChangeRequest2, OwnChangeRequests2, TranscriptPoint2, TranscriptsRequest2, TranscriptsResult2, ProposeRequest2, ProposeResult2, ProjectActivityRequest2, ProjectActivityResult2, DraftUpdateRequest2, DraftUpdateResult2, ChangeRequestActivity2, WriteBackActivity2, ArtifactActivity2, FileActivity2, NoteActivity2, CommentActivity2, CreateTasksActivity2, AlertTaskActivity2, IntegrationBranchActivity2, MergeChangeRequestActivity2, ReleaseActivity2, TranscriptsActivity2, ProposeActivity2, ProjectActivityActivity2, DraftUpdateActivity2, ChangeRequestReadActivity2, changeRequest2, writeBack2, artifact2, file2, note2, comment2, createTasks2, alertTask2, integrationBranch2, mergeChangeRequest2, approveChangeRequest2, closeChangeRequest2, pipelineMoved2, rerunPipeline2, reportPipeline2, release2, transcripts2, propose2, projectActivity2, pipelineStatus2, reviewThreads2, openChangeRequests2, ownChangeRequests2, draftUpdate2, ResourceName, ClaimResult2, claimDeferred2, letGoDeferred2, claim2, letGo2, WorkUnitRepoBinding, ProgramWorkUnit, ApprovedCheck, MeasurePlan2, WorkUnitClaimResult, WorkUnitClaimInput, WorkUnitHeartbeatInput, WorkUnitHeartbeatResult, WorkUnitReleaseInput, WorkUnitCompletion, MetricStats2, MeasureVerdict2, Measurement2, measureDeferred2, noiseFloor2, judgeMeasurement2, measure2, LoopJournal2, ScriptedFailure2, scriptedFailure2, loopWorkflow2, executeLoop2, testLoop2, Severity2, Finding2, MergedFinding2, Rebuttal2, RebuttalVerdict2, ScopeJudgement2, isBlocking2, mergeFindings2, splitDisputed2, settleRound2, rallyStop2, CheckFailed2, StepNamedTwice2, ReplayDiverged2, LoopCheckError2, checkLoop2, defineKit2, BaseSync2, syncBase2, Continuing2, continuingBrief2 };
|