@kitman-sh/cli 0.10.91 → 0.10.92

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.
@@ -7,6 +7,9 @@ import {
7
7
  flatMap3,
8
8
  provideContext2
9
9
  } from "./chunk-dstm8aen.js";
10
+ import {
11
+ runForEach
12
+ } from "./chunk-25q7mg6g.js";
10
13
  import {
11
14
  WebSocketConstructor,
12
15
  layerWebSocketConstructorGlobal,
@@ -16,16 +19,13 @@ import {
16
19
  RunnerReplicaRpcs,
17
20
  RunnerRunFileRpcs,
18
21
  ProgramRpcs
19
- } from "./chunk-5fxxg02f.js";
20
- import {
21
- runForEach
22
- } from "./chunk-25q7mg6g.js";
22
+ } from "./chunk-63mhk3ft.js";
23
23
  import {
24
24
  layerJson,
25
25
  make3,
26
26
  withHeaders,
27
27
  layerProtocolSocket
28
- } from "./chunk-sb8c2sgy.js";
28
+ } from "./chunk-vsb31vgf.js";
29
29
 
30
30
  // packages/live/src/rpc/runner-client.ts
31
31
  var proxiedWebSocket = (proxy) => succeed5(WebSocketConstructor)((target) => {
@@ -97,6 +97,18 @@ import {
97
97
  Exit,
98
98
  toCodecJson
99
99
  } from "./chunk-dstm8aen.js";
100
+ import {
101
+ interrupt,
102
+ getCurrent,
103
+ makeUnsafe2,
104
+ bounded,
105
+ offerAll,
106
+ failCause,
107
+ end,
108
+ shutdownUnsafe,
109
+ fromQueue,
110
+ unwrap
111
+ } from "./chunk-25q7mg6g.js";
100
112
  import {
101
113
  Clock,
102
114
  empty,
@@ -111,19 +123,7 @@ import {
111
123
  ParseOptions,
112
124
  RpcClientDefect,
113
125
  RpcClientError
114
- } from "./chunk-5fxxg02f.js";
115
- import {
116
- interrupt,
117
- getCurrent,
118
- makeUnsafe2,
119
- bounded,
120
- offerAll,
121
- failCause,
122
- end,
123
- shutdownUnsafe,
124
- fromQueue,
125
- unwrap
126
- } from "./chunk-25q7mg6g.js";
126
+ } from "./chunk-63mhk3ft.js";
127
127
 
128
128
  // node_modules/.bun/effect@4.1.2/node_modules/effect/dist/workers/Transferable.js
129
129
  class Collector extends (/* @__PURE__ */ Service2()("effect/workers/Transferable/Collector")) {
@@ -38,6 +38,7 @@ import {
38
38
  fnUntraced,
39
39
  makeFormatterStandardSchemaV1,
40
40
  transform,
41
+ declare,
41
42
  is,
42
43
  encodeEffect,
43
44
  isSchema,
@@ -45,6 +46,7 @@ import {
45
46
  optional,
46
47
  Literal,
47
48
  Never,
49
+ Null,
48
50
  String4,
49
51
  Boolean2,
50
52
  Void,
@@ -70,6 +72,7 @@ import {
70
72
  Cause,
71
73
  Class2,
72
74
  TaggedError2,
75
+ toEquivalence,
73
76
  toCodecJson,
74
77
  Json
75
78
  } from "./chunk-dstm8aen.js";
@@ -79,6 +82,14 @@ import {
79
82
  import {
80
83
  currentTimeMillis,
81
84
  WebCrypto,
85
+ SafeJson,
86
+ AgentSandboxNetwork,
87
+ AgentEfforts,
88
+ AgentCapabilities,
89
+ LoopDataSchemaRef,
90
+ LoopVersion,
91
+ ProgramLoop,
92
+ AgentFallback,
82
93
  ProgramWorkUnit,
83
94
  MeasureEvidence,
84
95
  CatchUp,
@@ -90,11 +101,11 @@ import {
90
101
  bodyUint8Array,
91
102
  filterStatusOk,
92
103
  HttpClient,
93
- LoopCapabilities,
94
- LoopManifest,
104
+ KitName,
105
+ KitDigest,
95
106
  KitSetup,
96
107
  RunnerRpcError
97
- } from "./chunk-5fxxg02f.js";
108
+ } from "./chunk-63mhk3ft.js";
98
109
  import {
99
110
  runForEach,
100
111
  FileSystem
@@ -124,6 +135,200 @@ var sha256 = {
124
135
  implementation: undefined
125
136
  };
126
137
 
138
+ // packages/core/src/schedule.ts
139
+ var ScheduleFrequency = ["daily", "weekly"];
140
+ var ScheduleMisfirePolicies = ["skip", "fire_once", "catch_up"];
141
+ var ScheduleOverlapPolicies = ["allow", "skip", "coalesce"];
142
+ var ScheduleVersionStatuses = ["draft", "published", "disabled", "archived"];
143
+ var ScheduleCalendarRule = Struct({
144
+ frequency: Literals(ScheduleFrequency),
145
+ hour: Int.check(isGreaterThanOrEqualTo(0), isLessThanOrEqualTo(23)),
146
+ minute: Int.check(isGreaterThanOrEqualTo(0), isLessThanOrEqualTo(59)),
147
+ second: optionalKey(Int.check(isGreaterThanOrEqualTo(0), isLessThanOrEqualTo(59))),
148
+ daysOfWeek: optionalKey(ArraySchema(Int.check(isGreaterThanOrEqualTo(0), isLessThanOrEqualTo(6))).check(isMinLength(1), isMaxLength(7)))
149
+ });
150
+ var ScheduleCronRule = Struct({
151
+ cron: String4.check(isMinLength(9), isMaxLength(200), isPattern(new RegExp("^[0-9*,/-]+( [0-9*,/-]+){4}$", "u")))
152
+ });
153
+ var ScheduleRule = Union([ScheduleCalendarRule, ScheduleCronRule]);
154
+ var cronBounds = [
155
+ [0, 59],
156
+ [0, 23],
157
+ [1, 31],
158
+ [1, 12],
159
+ [0, 7]
160
+ ];
161
+ function cronField(field, [min, max]) {
162
+ const values = new Set;
163
+ for (const part of field.split(",")) {
164
+ const match = /^(\*|(\d+)(?:-(\d+))?)(?:\/(\d+))?$/.exec(part);
165
+ if (match === null)
166
+ return;
167
+ const from = match[1] === "*" ? min : Number(match[2]);
168
+ const to = match[1] === "*" ? max : match[3] === undefined ? match[4] === undefined ? from : max : Number(match[3]);
169
+ const step = match[4] === undefined ? 1 : Number(match[4]);
170
+ if (from < min || to > max || from > to || step < 1)
171
+ return;
172
+ for (let value = from;value <= to; value += step)
173
+ values.add(value);
174
+ }
175
+ return values;
176
+ }
177
+ function parseCron(cron) {
178
+ const fields = cron.split(" ");
179
+ const [minutes, hours, days, months, weekdays] = fields.map((field, index) => cronField(field, cronBounds[index] ?? [0, 0]));
180
+ if (fields.length !== 5 || !minutes || !hours || !days || !months || !weekdays)
181
+ return;
182
+ return {
183
+ minutes,
184
+ hours,
185
+ days,
186
+ months,
187
+ weekdays: new Set([...weekdays].map((value) => value % 7)),
188
+ dayRestricted: !(fields[2] ?? "").startsWith("*"),
189
+ weekdayRestricted: !(fields[4] ?? "").startsWith("*")
190
+ };
191
+ }
192
+ function isScheduleRule(value) {
193
+ return guard(ScheduleRule)(value) && (!("cron" in value) || parseCron(value.cron) !== undefined);
194
+ }
195
+ var ScheduleVersion = Struct({
196
+ contractVersion: Literal("schedule.v1"),
197
+ id: String4.check(isMinLength(1)),
198
+ scheduleId: String4.check(isMinLength(1)),
199
+ workspaceId: String4.check(isMinLength(1)),
200
+ teamId: optionalKey(String4.check(isMinLength(1))),
201
+ loopId: optionalKey(String4.check(isMinLength(1))),
202
+ name: optionalKey(String4.check(isMinLength(1), isMaxLength(200))),
203
+ version: Int.check(isGreaterThanOrEqualTo(1)),
204
+ status: Literals(ScheduleVersionStatuses),
205
+ timezone: String4.check(isMinLength(1), isMaxLength(80)),
206
+ rule: ScheduleRule,
207
+ misfirePolicy: Literals(ScheduleMisfirePolicies),
208
+ overlapPolicy: Literals(ScheduleOverlapPolicies),
209
+ maxCatchUp: Int.check(isGreaterThanOrEqualTo(0), isLessThanOrEqualTo(200)),
210
+ misfireGraceSeconds: optionalKey(Int.check(isGreaterThanOrEqualTo(0), isLessThanOrEqualTo(604800))),
211
+ inputSchemaRef: optionalKey(LoopDataSchemaRef),
212
+ input: optionalKey(SafeJson),
213
+ createdAt: String4.check(isMinLength(1))
214
+ });
215
+ var zones = new Map;
216
+ var resolvedLocalDateTimes = new Map;
217
+
218
+ // packages/core/src/kit-declarations.ts
219
+ var LoopCapabilities = [
220
+ "agent_work",
221
+ "ask",
222
+ "call",
223
+ "verify",
224
+ "change_request",
225
+ "write_back",
226
+ "post_comment",
227
+ "create_tasks",
228
+ "merge_change_request",
229
+ "approve_change_request",
230
+ "publish_release",
231
+ "read_transcripts",
232
+ "read_change_request",
233
+ "measure",
234
+ "claim",
235
+ "propose",
236
+ "read_project",
237
+ "draft_update"
238
+ ];
239
+ var JsonObject = Record(String4, Json);
240
+ var SecretName = String4.check(isPattern(/^[A-Za-z_][A-Za-z0-9_]{0,127}$/));
241
+ var EventFilterValue = Union([String4, Finite, Boolean2, Null]);
242
+ var LoopManifest = Struct({
243
+ id: String4,
244
+ title: String4,
245
+ version: optionalKey(LoopVersion),
246
+ input: JsonObject,
247
+ output: JsonObject,
248
+ outcome: optionalKey(Literals(["feature", "bug", "refactor", "investigation", "docs", "migration", "performance"])),
249
+ agents: Record(String4, String4),
250
+ checkout: Literals(["none", "read", "write"]),
251
+ when: ArraySchema(Struct({
252
+ event: String4,
253
+ filter: optionalKey(Record(String4, Union([EventFilterValue, ArraySchema(EventFilterValue)]))),
254
+ input: Record(String4, String4),
255
+ values: optionalKey(JsonObject)
256
+ })),
257
+ offers: ArraySchema(Struct({
258
+ id: String4,
259
+ title: String4,
260
+ loop: String4,
261
+ from: optionalKey(String4)
262
+ })),
263
+ capabilities: ArraySchema(Literals(LoopCapabilities)),
264
+ ownCapabilities: optionalKey(ArraySchema(Literals(LoopCapabilities))),
265
+ secrets: optionalKey(ArraySchema(SecretName)),
266
+ network: optionalKey(AgentSandboxNetwork),
267
+ schedule: optionalKey(Struct({ rule: ScheduleRule, timezone: String4 }))
268
+ });
269
+ var LoopDetail = Struct({
270
+ id: String4,
271
+ resolved: optionalKey(Struct({
272
+ ...ProgramLoop.fields,
273
+ agents: LoopManifest.fields.agents,
274
+ when: LoopManifest.fields.when,
275
+ schedule: optionalKey(Struct({
276
+ rule: ScheduleRule,
277
+ timezone: String4,
278
+ on: Boolean2,
279
+ nextRunAt: optionalKey(String4)
280
+ }))
281
+ }))
282
+ });
283
+ var AgentDeclaration = Struct({
284
+ extends: optionalKey(String4),
285
+ instructions: optionalKey(String4),
286
+ harness: optionalKey(String4),
287
+ model: optionalKey(String4),
288
+ effort: optionalKey(Literals(AgentEfforts)),
289
+ fallbacks: optionalKey(ArraySchema(AgentFallback)),
290
+ tools: optionalKey(ArraySchema(Literals(AgentCapabilities))),
291
+ skills: optionalKey(ArraySchema(String4.check(isMinLength(1)))),
292
+ network: optionalKey(Union([Struct({ hosts: ArraySchema(String4) }), Literal("open")])),
293
+ sandbox: optionalKey(Literal("docker"))
294
+ });
295
+ var scheduleFields = {
296
+ name: String4.check(isMinLength(1)),
297
+ loop: String4,
298
+ team: optionalKey(String4),
299
+ input: optionalKey(JsonObject),
300
+ timezone: String4,
301
+ misfire: optionalKey(Literals(ScheduleMisfirePolicies)),
302
+ overlap: optionalKey(Literals(ScheduleOverlapPolicies))
303
+ };
304
+ var ScheduleDeclaration = Union([
305
+ Struct({
306
+ ...scheduleFields,
307
+ cron: String4.check(makeFilter((cron) => isScheduleRule({ cron }) || "five cron fields, each within its range"))
308
+ }),
309
+ Struct({
310
+ ...scheduleFields,
311
+ rule: declare((value) => isScheduleRule(value), {
312
+ expected: "a Schedule rule: frequency daily or weekly, hour, minute, and optionally second and daysOfWeek"
313
+ })
314
+ })
315
+ ]);
316
+ var CarriedKit = Struct({
317
+ name: KitName,
318
+ version: String4.check(isMinLength(1)),
319
+ setup: KitDigest,
320
+ loops: ArraySchema(String4),
321
+ agents: ArraySchema(String4)
322
+ });
323
+ var KitDeclarations = Struct({
324
+ loops: ArraySchema(LoopManifest),
325
+ agents: Record(String4, AgentDeclaration),
326
+ schedules: optionalKey(Record(String4, ScheduleDeclaration)),
327
+ carried: optionalKey(ArraySchema(CarriedKit))
328
+ });
329
+ var sameLoop = toEquivalence(LoopManifest);
330
+ var sameAgent = toEquivalence(AgentDeclaration);
331
+
127
332
  // packages/sdk/src/loop/define.ts
128
333
  var LoopOutcome = Literals([
129
334
  "feature",
@@ -926,4 +1131,4 @@ var redirectStatuses = new Set([301, 302, 303, 307, 308]);
926
1131
  var readStdin = tryPromise(() => Bun.stdin.text());
927
1132
  var isWorkUnit = guard(ProgramWorkUnit);
928
1133
 
929
- export { uploadRunFile, programLease, rpcRunFiles, describeFlag, Described, programHostsEnv, undeclaredHostsEnv };
1134
+ export { AgentDeclaration, KitDeclarations, uploadRunFile, programLease, rpcRunFiles, describeFlag, Described, programHostsEnv, undeclaredHostsEnv };