@kitman-sh/cli 0.12.8 → 0.12.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. package/dist/{chunk-c8wpw9nh.js → chunk-0h49y8gf.js} +214 -65
  2. package/dist/{chunk-bh9k3kty.js → chunk-4gkp713b.js} +55 -55
  3. package/dist/{chunk-gyek54h3.js → chunk-4gy4ty6k.js} +8 -8
  4. package/dist/{chunk-cr3qw0xf.js → chunk-4w0c1ykv.js} +381 -297
  5. package/dist/{chunk-j1cnq2j0.js → chunk-5zhh41gb.js} +4 -4
  6. package/dist/{chunk-kzwdhdej.js → chunk-5zth85pj.js} +2 -2
  7. package/dist/{chunk-9qp59fht.js → chunk-6pq0yj40.js} +32 -32
  8. package/dist/{chunk-tgwa9vqw.js → chunk-7afnkx5b.js} +6 -6
  9. package/dist/{chunk-n9351czb.js → chunk-azfjx5d8.js} +7 -7
  10. package/dist/{chunk-31gpnkq3.js → chunk-cbpb2rww.js} +5 -5
  11. package/dist/{chunk-wcvfkdwd.js → chunk-fr79hgq2.js} +24 -24
  12. package/dist/{chunk-6w7ajkm8.js → chunk-fyvtc3xv.js} +18 -18
  13. package/dist/{chunk-cw61zyh5.js → chunk-gq7y5v3e.js} +1 -1
  14. package/dist/{chunk-jwrs9pfa.js → chunk-gwnyxm1r.js} +107 -107
  15. package/dist/{chunk-3x6cbhzd.js → chunk-gxbcvd4q.js} +4 -4
  16. package/dist/{chunk-fh58za51.js → chunk-gy9rf14f.js} +3 -3
  17. package/dist/{chunk-c8hwfktd.js → chunk-jn7w2ntt.js} +7 -7
  18. package/dist/{chunk-6d53ezj1.js → chunk-mtkstrh3.js} +4 -4
  19. package/dist/{chunk-0tjg9eya.js → chunk-q5w3v4k1.js} +1 -1
  20. package/dist/{chunk-xng6j3a8.js → chunk-rtpk65fj.js} +1 -1
  21. package/dist/{chunk-93ypzdpa.js → chunk-vkg40ysx.js} +7 -7
  22. package/dist/{chunk-z5f7g1w1.js → chunk-y1krmnbv.js} +2 -2
  23. package/dist/{chunk-s5pzy86v.js → chunk-ywzxwgrz.js} +6 -6
  24. package/dist/{chunk-pjpfc3sd.js → chunk-z0q62687.js} +1 -1
  25. package/dist/{chunk-qjqa338f.js → chunk-zw3gf6r5.js} +94 -333
  26. package/dist/index.js +4 -4
  27. package/package.json +1 -1
@@ -7,10 +7,10 @@ import {
7
7
  decoded2,
8
8
  readOpencode2,
9
9
  runOpencodeReader2
10
- } from "./chunk-31gpnkq3.js";
11
- import"./chunk-6d53ezj1.js";
12
- import"./chunk-c8wpw9nh.js";
13
- import"./chunk-qjqa338f.js";
10
+ } from "./chunk-cbpb2rww.js";
11
+ import"./chunk-mtkstrh3.js";
12
+ import"./chunk-0h49y8gf.js";
13
+ import"./chunk-zw3gf6r5.js";
14
14
  export {
15
15
  decoded2 as decoded,
16
16
  decodedOption2 as decodedOption,
@@ -14,8 +14,8 @@ import {
14
14
  writeSrtSettings2,
15
15
  srtStepArgv2,
16
16
  srtArgv2
17
- } from "./chunk-c8wpw9nh.js";
18
- import"./chunk-qjqa338f.js";
17
+ } from "./chunk-0h49y8gf.js";
18
+ import"./chunk-zw3gf6r5.js";
19
19
  export {
20
20
  compiled2 as compiled,
21
21
  harnessesUnsupportedInSrt2 as harnessesUnsupportedInSrt,
@@ -17,12 +17,12 @@ import {
17
17
  isSuccess,
18
18
  TaggedError,
19
19
  void_2,
20
- makeUnsafe4,
20
+ makeUnsafe5,
21
21
  _await,
22
22
  fail5,
23
23
  succeed4,
24
24
  doneUnsafe,
25
- makeUnsafe5,
25
+ makeUnsafe6,
26
26
  provide,
27
27
  close,
28
28
  buildWithScope,
@@ -30,7 +30,6 @@ import {
30
30
  provide2,
31
31
  provideMerge,
32
32
  squash,
33
- currentTimeMillis,
34
33
  spaced,
35
34
  all3,
36
35
  forEach,
@@ -50,7 +49,7 @@ import {
50
49
  tap2,
51
50
  result,
52
51
  option2,
53
- map7,
52
+ map8,
54
53
  as,
55
54
  asVoid,
56
55
  catch_,
@@ -80,8 +79,6 @@ import {
80
79
  runSync,
81
80
  fnUntraced,
82
81
  fn,
83
- makeUnsafe6,
84
- formatIso,
85
82
  decodeUnknownEffect2,
86
83
  optionalKey,
87
84
  optional,
@@ -121,9 +118,12 @@ import {
121
118
  decodeJsonStringOption,
122
119
  encodeJsonStringSync,
123
120
  encodePrettyJsonString
124
- } from "./chunk-qjqa338f.js";
121
+ } from "./chunk-zw3gf6r5.js";
125
122
  import {
123
+ currentTimeMillis,
126
124
  SecureRandom,
125
+ makeUnsafe,
126
+ formatIso,
127
127
  error,
128
128
  parseDate,
129
129
  currentDate,
@@ -170,13 +170,13 @@ import {
170
170
  runMcpEffect,
171
171
  createAgentAuthSignedFetch,
172
172
  setupMcpAgentCredential
173
- } from "./chunk-cr3qw0xf.js";
173
+ } from "./chunk-4w0c1ykv.js";
174
174
  import {
175
175
  guard,
176
176
  Id,
177
177
  Timestamp,
178
178
  ActorType
179
- } from "./chunk-0tjg9eya.js";
179
+ } from "./chunk-q5w3v4k1.js";
180
180
  import {
181
181
  join,
182
182
  interrupt,
@@ -190,21 +190,21 @@ import {
190
190
  withDefault,
191
191
  option,
192
192
  String2
193
- } from "./chunk-c8wpw9nh.js";
193
+ } from "./chunk-0h49y8gf.js";
194
194
  import {
195
195
  searchDocs2,
196
196
  readDoc2
197
- } from "./chunk-xng6j3a8.js";
197
+ } from "./chunk-rtpk65fj.js";
198
198
  import {
199
199
  nextInt
200
- } from "./chunk-cw61zyh5.js";
200
+ } from "./chunk-gq7y5v3e.js";
201
201
  import {
202
202
  layerJson,
203
203
  make4,
204
204
  withHeaders,
205
205
  layerProtocolSocket,
206
206
  ConnectionHooks
207
- } from "./chunk-wcvfkdwd.js";
207
+ } from "./chunk-fr79hgq2.js";
208
208
 
209
209
  // apps/cli/src/mcp.ts
210
210
  import { tmpdir as tmpdir2 } from "os";
@@ -2043,7 +2043,7 @@ function connectKitmanLiveRoot(protocol) {
2043
2043
  const authenticate = async (input) => {
2044
2044
  close2();
2045
2045
  const brokenListeners = new Set;
2046
- const scope = makeUnsafe5();
2046
+ const scope = makeUnsafe6();
2047
2047
  let connected = false;
2048
2048
  const hooks = succeed5(ConnectionHooks)({
2049
2049
  onConnect: sync2(() => {
@@ -2085,7 +2085,7 @@ function call(connection, effect) {
2085
2085
  }
2086
2086
  function openStream(connection, stream, isOpened, deliver) {
2087
2087
  return new Promise((resolve, reject) => {
2088
- const opened = makeUnsafe4();
2088
+ const opened = makeUnsafe5();
2089
2089
  const fiber = runFork(withHeaders2(connection, runForEach(stream, (message) => isOpened(message) ? succeed4(opened, message) : promise(() => deliver(message)))).pipe(mapError2(toError), tapError2((error) => fail5(opened, error)), ensuring2(fail5(opened, toError({ message: "Live subscription ended before it opened" }))), provide(connection.scope)));
2090
2090
  runPromise(_await(opened)).then((message) => resolve({
2091
2091
  opened: message,
@@ -5328,7 +5328,7 @@ process.stdin.on('data', chunk => {
5328
5328
  var bootGuest = gen(function* () {
5329
5329
  const assets = yield* codeModeAssets;
5330
5330
  const nonce = yield* (yield* SecureRandom).uuidV4();
5331
- const result = makeUnsafe4();
5331
+ const result = makeUnsafe5();
5332
5332
  let call = () => Promise.reject(new Error("Code Mode guest has no execution"));
5333
5333
  yield* sweepStaleSidecarTemp;
5334
5334
  const fs = yield* FileSystem;
@@ -5419,12 +5419,12 @@ var takeGuest = suspend3(() => {
5419
5419
  expireWhenIdle(booting);
5420
5420
  return join(taken);
5421
5421
  });
5422
- var outcomeOf = (warm) => raceFirst(map7(_await(warm.result), (text) => ({ text })), tryPromise({
5422
+ var outcomeOf = (warm) => raceFirst(map8(_await(warm.result), (text) => ({ text })), tryPromise({
5423
5423
  try: () => warm.guest.wait(),
5424
5424
  catch: (error) => new CodeModeExecutionError({
5425
5425
  message: `Code Mode secure-exec failed: ${error instanceof Error ? error.message : "unknown error"}`
5426
5426
  })
5427
- }).pipe(flatMap3((exitCode) => exitCode === 0 ? _await(warm.result).pipe(timeoutOrElse({ duration: millis(100), orElse: () => succeed6("{}") }), map7((text) => ({ text }))) : succeed6({ exitCode }))));
5427
+ }).pipe(flatMap3((exitCode) => exitCode === 0 ? _await(warm.result).pipe(timeoutOrElse({ duration: millis(100), orElse: () => succeed6("{}") }), map8((text) => ({ text }))) : succeed6({ exitCode }))));
5428
5428
  var executeCodeMode = fnUntraced(function* (input, options) {
5429
5429
  const startedAt = yield* currentTimeMillis;
5430
5430
  const codeHash = digestSha256(input.code, "hex");
@@ -5442,7 +5442,7 @@ var executeCodeMode = fnUntraced(function* (input, options) {
5442
5442
  return yield* new CodeModeExecutionError({
5443
5443
  message: `Code Mode secure-exec failed with exit code ${outcome.exitCode}`
5444
5444
  });
5445
- const returned = yield* decodeJsonString(outcome.text).pipe(map7((json) => isJsonObject(json) ? json : {}), mapError2(() => new CodeModeExecutionError({ message: "Code Mode secure-exec returned an unreadable result" })));
5445
+ const returned = yield* decodeJsonString(outcome.text).pipe(map8((json) => isJsonObject(json) ? json : {}), mapError2(() => new CodeModeExecutionError({ message: "Code Mode secure-exec returned an unreadable result" })));
5446
5446
  if (isString2(returned.thrown))
5447
5447
  return yield* new CodeModeExecutionError({ message: `Code Mode code threw ${returned.thrown}` });
5448
5448
  const finishedAt = yield* currentTimeMillis;
@@ -5972,7 +5972,7 @@ function createCodeModeHost(options) {
5972
5972
  const dispatchPrepared = fnUntraced(function* (operationName, preparedArgs, descriptor) {
5973
5973
  const startedAt = yield* currentTimeMillis;
5974
5974
  const backend = options.dispatchOperation ?? options.executeCapability ?? (() => fail7(new McpToolInputError({ message: "Kitman Code Mode dispatch is not configured." })));
5975
- return yield* backend(operationName, preparedArgs).pipe(tap2((output) => validateOperationOutput(descriptor, output)), tap2((output) => currentTimeMillis.pipe(map7((now) => calls.push({ operationName, status: "ok", durationMs: now - startedAt, resourceIds: resourceIds(output) })))), tapError2(() => currentTimeMillis.pipe(map7((now) => calls.push({ operationName, status: "error", durationMs: now - startedAt })))));
5975
+ return yield* backend(operationName, preparedArgs).pipe(tap2((output) => validateOperationOutput(descriptor, output)), tap2((output) => currentTimeMillis.pipe(map8((now) => calls.push({ operationName, status: "ok", durationMs: now - startedAt, resourceIds: resourceIds(output) })))), tapError2(() => currentTimeMillis.pipe(map8((now) => calls.push({ operationName, status: "error", durationMs: now - startedAt })))));
5976
5976
  });
5977
5977
  const dispatch = fnUntraced(function* (operationName, args) {
5978
5978
  const { descriptor, preparedArgs } = yield* prepareArgs(operationName, args);
@@ -6429,7 +6429,7 @@ function createCodeModeExecutionStore(options = {}) {
6429
6429
  ...input.content === undefined ? undefined : { content: input.content }
6430
6430
  });
6431
6431
  });
6432
- const listForActor = (actorDigest) => sweep.pipe(map7(() => [...entries.values()].flatMap((entry) => entry.approvalActorDigest === actorDigest && entry.status === "paused" ? [inspection(entry)] : [])));
6432
+ const listForActor = (actorDigest) => sweep.pipe(map8(() => [...entries.values()].flatMap((entry) => entry.approvalActorDigest === actorDigest && entry.status === "paused" ? [inspection(entry)] : [])));
6433
6433
  const markUnknown = (input) => {
6434
6434
  const entry = entries.get(input.executionId);
6435
6435
  if (entry === undefined || entry.ownerDigest !== ownerDigest(input.owner))
@@ -6439,7 +6439,7 @@ function createCodeModeExecutionStore(options = {}) {
6439
6439
  markUnknownEntry(entry, input.reason);
6440
6440
  return true;
6441
6441
  };
6442
- const inspect = (executionId) => sweep.pipe(map7(() => {
6442
+ const inspect = (executionId) => sweep.pipe(map8(() => {
6443
6443
  const entry = entries.get(executionId);
6444
6444
  return entry === undefined ? undefined : inspection(entry);
6445
6445
  }));
@@ -6462,7 +6462,7 @@ function createCodeModeExecutionStore(options = {}) {
6462
6462
  entry.onDecision = undefined;
6463
6463
  }
6464
6464
  function settle(entry, result) {
6465
- return currentTimeMillis.pipe(map7((now) => {
6465
+ return currentTimeMillis.pipe(map8((now) => {
6466
6466
  entry.status = "settled";
6467
6467
  entry.settledResult = result;
6468
6468
  entry.settledUntilMs = now + settledReplayTtlMs;
@@ -6472,7 +6472,7 @@ function createCodeModeExecutionStore(options = {}) {
6472
6472
  }));
6473
6473
  }
6474
6474
  function settledResume(entry, input) {
6475
- return currentTimeMillis.pipe(map7((now) => {
6475
+ return currentTimeMillis.pipe(map8((now) => {
6476
6476
  if (entry.settledResult === undefined || entry.settledUntilMs === undefined || now >= entry.settledUntilMs) {
6477
6477
  entry.status = "expired";
6478
6478
  entry.settledResult = undefined;
@@ -6487,7 +6487,7 @@ function createCodeModeExecutionStore(options = {}) {
6487
6487
  }
6488
6488
  }
6489
6489
  function isoString(epochMillis) {
6490
- return formatIso(makeUnsafe6(epochMillis));
6490
+ return formatIso(makeUnsafe(epochMillis));
6491
6491
  }
6492
6492
  function pauseValue(entry, ttlMs) {
6493
6493
  return {
@@ -6849,7 +6849,7 @@ function registerCodeModeTools(server, options = {}) {
6849
6849
  const resolveDecision = (id) => options.resolveExecutionDecision?.({ executionId: id, owner }) ?? undefined_;
6850
6850
  if (executionId === undefined) {
6851
6851
  const paused = yield* executionStore.listForActor(owner.approvalActorDigest ?? owner.actorDigest);
6852
- const decided = yield* forEach(paused, (execution) => resolveDecision(execution.executionId).pipe(map7((decision) => ({ execution, action: decision }))), { concurrency: "unbounded" });
6852
+ const decided = yield* forEach(paused, (execution) => resolveDecision(execution.executionId).pipe(map8((decision) => ({ execution, action: decision }))), { concurrency: "unbounded" });
6853
6853
  const resumable = decided.filter((candidate) => candidate.action !== undefined);
6854
6854
  if (resumable.length === 1) {
6855
6855
  executionId = resumable[0]?.execution.executionId;
@@ -8295,7 +8295,7 @@ function registerStepTools(server, adapt, input) {
8295
8295
  description: "Read the brief for the Step you are working on: its instructions, Context Pack and Output schema. A long brief comes in pages; each names the offset of the next.",
8296
8296
  inputSchema: adapt(StepBriefArguments),
8297
8297
  annotations: { readOnlyHint: true, idempotentHint: true }
8298
- }, (args) => run(map7(request("/brief"), (brief) => text(briefPage(brief.prompt, isNumber2(args.offset) ? args.offset : 0)))));
8298
+ }, (args) => run(map8(request("/brief"), (brief) => text(briefPage(brief.prompt, isNumber2(args.offset) ? args.offset : 0)))));
8299
8299
  const closed = (question) => gen(function* () {
8300
8300
  let current = question;
8301
8301
  const interval = fromInputUnsafe(input.answerPollInterval ?? "2 seconds");
@@ -8330,7 +8330,7 @@ function registerStepTools(server, adapt, input) {
8330
8330
  structuredContent: result
8331
8331
  });
8332
8332
  case "parked":
8333
- return map7(closed(result.question), (question) => ({
8333
+ return map8(closed(result.question), (question) => ({
8334
8334
  ...failure(question.answer === undefined ? `Output refused again: ${result.message}. The Question it put to a person was closed without an answer (${question.status}). Stop working.` : `Output refused again: ${result.message}. Your Step waited for a person, who answered: \u201C${question.answer.value}\u201D Correct the Output as they say and submit it again; you have one more submission and one repair.`),
8335
8335
  structuredContent: { ...result, question }
8336
8336
  }));
@@ -8343,11 +8343,11 @@ function registerStepTools(server, adapt, input) {
8343
8343
  inputSchema: adapt(SessionUpdateArguments),
8344
8344
  outputSchema: adapt(AnyResult),
8345
8345
  annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false }
8346
- }, (args) => run(map7(request("/session-updates", {
8346
+ }, (args) => run(map8(request("/session-updates", {
8347
8347
  kind: isString2(args.kind) ? args.kind : "progress",
8348
8348
  content: isString2(args.content) ? args.content : ""
8349
8349
  }), (result) => ({ content: [{ type: "text", text: "SessionUpdate recorded." }], structuredContent: result }))));
8350
- const answerOf = (question) => map7(closed(question), (current) => current.answer === undefined ? failure(`The Question was closed without an answer (${current.status}). Stop and submit what you have.`) : {
8350
+ const answerOf = (question) => map8(closed(question), (current) => current.answer === undefined ? failure(`The Question was closed without an answer (${current.status}). Stop and submit what you have.`) : {
8351
8351
  content: [
8352
8352
  { type: "text", text: encodeJsonStringSync({ answer: current.answer.value, questionId: current.id }) }
8353
8353
  ],
@@ -8372,13 +8372,13 @@ function registerStepTools(server, adapt, input) {
8372
8372
  const fitting = input.fittingSkills ?? [];
8373
8373
  const rank = (name) => fitting.includes(name) ? fitting.indexOf(name) : fitting.length;
8374
8374
  const names = (yield* fs.readDirectory(skillsDir).pipe(orElseSucceed(() => []))).toSorted((a, b) => rank(a) - rank(b) || a.localeCompare(b));
8375
- return yield* forEach(names, (name) => fs.readFileString(`${skillsDir}/${name}/SKILL.md`).pipe(map7((skill) => [{ name, skill }]), orElseSucceed(() => []))).pipe(map7((found) => found.flat()));
8375
+ return yield* forEach(names, (name) => fs.readFileString(`${skillsDir}/${name}/SKILL.md`).pipe(map8((skill) => [{ name, skill }]), orElseSucceed(() => []))).pipe(map8((found) => found.flat()));
8376
8376
  });
8377
8377
  server.registerTool("skills", {
8378
8378
  description: "List the Run's skills you can load with no name, or load one by name; a second load answers that it is already in your context unless you pass reload: true after compaction.",
8379
8379
  inputSchema: adapt(SkillsArguments),
8380
8380
  annotations: { readOnlyHint: true, idempotentHint: false }
8381
- }, (args) => runMcpEffect(map7(loadable, (skills) => {
8381
+ }, (args) => runMcpEffect(map8(loadable, (skills) => {
8382
8382
  const name = isString2(args.name) ? args.name : undefined;
8383
8383
  if (name === undefined)
8384
8384
  return skills.length === 0 ? text("This Step has no skills to load.") : text(skills.map((found) => `- ${found.name}: ${skillDescription(found.skill)}`).join(`
@@ -6,7 +6,10 @@ import {
6
6
  gen,
7
7
  flatMap3,
8
8
  provideContext2
9
- } from "./chunk-qjqa338f.js";
9
+ } from "./chunk-zw3gf6r5.js";
10
+ import {
11
+ runForEach
12
+ } from "./chunk-0h49y8gf.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-cr3qw0xf.js";
20
- import {
21
- runForEach
22
- } from "./chunk-c8wpw9nh.js";
22
+ } from "./chunk-4w0c1ykv.js";
23
23
  import {
24
24
  layerJson,
25
25
  make4,
26
26
  withHeaders,
27
27
  layerProtocolSocket
28
- } from "./chunk-wcvfkdwd.js";
28
+ } from "./chunk-fr79hgq2.js";
29
29
 
30
30
  // packages/live/src/rpc/runner-client.ts
31
31
  var proxiedWebSocket = (proxy) => succeed5(WebSocketConstructor)((target) => {
@@ -12,7 +12,7 @@ import {
12
12
  gen,
13
13
  fail7,
14
14
  flatMap3,
15
- map7,
15
+ map8,
16
16
  mapError2,
17
17
  orDie,
18
18
  provide3,
@@ -24,11 +24,11 @@ import {
24
24
  Record,
25
25
  Int,
26
26
  fromJsonString
27
- } from "./chunk-qjqa338f.js";
27
+ } from "./chunk-zw3gf6r5.js";
28
28
  import {
29
29
  withDefault,
30
30
  String2
31
- } from "./chunk-c8wpw9nh.js";
31
+ } from "./chunk-0h49y8gf.js";
32
32
  import {
33
33
  newerKitmanVersion,
34
34
  digestSha256,
@@ -39,7 +39,7 @@ import {
39
39
  get2,
40
40
  layer4,
41
41
  KitDigest
42
- } from "./chunk-cr3qw0xf.js";
42
+ } from "./chunk-4w0c1ykv.js";
43
43
 
44
44
  // packages/core/src/npm-registry.ts
45
45
  var KitManifest = Struct({
@@ -73,7 +73,7 @@ var PackageJson = Struct({ kitman: optionalKey(Unknown) });
73
73
  var decodePackageJson = decodeUnknownOption(fromJsonString(PackageJson));
74
74
  var decodeManifest = decodeUnknownOption(KitManifest);
75
75
  var decodeJson = decodeUnknownOption(fromJsonString(Unknown));
76
- var gunzip = (bytes) => tryPromise(() => new Response(new Blob([new Uint8Array(bytes)]).stream().pipeThrough(new DecompressionStream("gzip"))).arrayBuffer()).pipe(map7((buffer) => new Uint8Array(buffer)));
76
+ var gunzip = (bytes) => tryPromise(() => new Response(new Blob([new Uint8Array(bytes)]).stream().pipeThrough(new DecompressionStream("gzip"))).arrayBuffer()).pipe(map8((buffer) => new Uint8Array(buffer)));
77
77
  var text = (bytes) => new TextDecoder().decode(bytes).replace(/\0.*$/su, "");
78
78
  var untar = (tar) => {
79
79
  const files = new Map;
@@ -103,7 +103,7 @@ var untar = (tar) => {
103
103
  var registryUrl = String2("NPM_CONFIG_REGISTRY").pipe(withDefault("https://registry.npmjs.org"));
104
104
  var newerOf = (latest, next) => latest === undefined || next !== undefined && newerKitmanVersion(next, latest) ? next : latest;
105
105
  var npmRegistryAt = (url = registryUrl) => {
106
- const base = (isString(url) ? succeed6(url) : orDie(url)).pipe(map7((value) => value.replace(/\/+$/u, "")));
106
+ const base = (isString(url) ? succeed6(url) : orDie(url)).pipe(map8((value) => value.replace(/\/+$/u, "")));
107
107
  const unreachable = (name, version) => (error) => new NpmRegistryError({
108
108
  kind: "unreachable",
109
109
  message: `npm did not answer for ${name}@${version}: ${error.message}; try again`
@@ -131,7 +131,7 @@ var npmRegistryAt = (url = registryUrl) => {
131
131
  const dist = found.versions[version]?.dist;
132
132
  if (dist === undefined)
133
133
  return yield* new NpmRegistryError({ kind: "not_found", message: `npm has no ${name}@${wanted}` });
134
- const tarball = yield* get2(dist.tarball).pipe(flatMap3(filterStatusOk), flatMap3((response) => response.arrayBuffer), map7((buffer) => new Uint8Array(buffer)), mapError2(unreachable(name, version)), provide3(layer4));
134
+ const tarball = yield* get2(dist.tarball).pipe(flatMap3(filterStatusOk), flatMap3((response) => response.arrayBuffer), map8((buffer) => new Uint8Array(buffer)), mapError2(unreachable(name, version)), provide3(layer4));
135
135
  if (!tarballMatches(tarball, dist))
136
136
  return yield* new NpmRegistryError({
137
137
  kind: "integrity",
@@ -25,16 +25,16 @@ import {
25
25
  isJsonObject,
26
26
  isString2,
27
27
  encodeUnknownJsonStringSync
28
- } from "./chunk-qjqa338f.js";
28
+ } from "./chunk-zw3gf6r5.js";
29
29
  import {
30
- make10,
30
+ make11,
31
31
  runForEach,
32
32
  compiled2
33
- } from "./chunk-c8wpw9nh.js";
33
+ } from "./chunk-0h49y8gf.js";
34
34
  import {
35
35
  ChildProcessSpawner,
36
36
  make3
37
- } from "./chunk-6d53ezj1.js";
37
+ } from "./chunk-mtkstrh3.js";
38
38
 
39
39
  // packages/agent-runtime/src/opencode-store.ts
40
40
  import { lstatSync, readFileSync, realpathSync } from "fs";
@@ -168,7 +168,7 @@ var isolatedRead = (store, name, input) => gen(function* () {
168
168
  const spawner = yield* ChildProcessSpawner;
169
169
  const [command, ...args] = opencodeReaderCommand();
170
170
  const handle = yield* spawner.spawn(make3(command, args, {
171
- stdin: make10(new TextEncoder().encode(encodeUnknownJsonStringSync({ store, name, input }))),
171
+ stdin: make11(new TextEncoder().encode(encodeUnknownJsonStringSync({ store, name, input }))),
172
172
  stderr: "ignore",
173
173
  extendEnv: false,
174
174
  env: {},
@@ -12,7 +12,7 @@ import {
12
12
  add,
13
13
  getOrUndefinedUnsafe,
14
14
  getUnsafe,
15
- get3,
15
+ get4,
16
16
  Reference,
17
17
  toMillis,
18
18
  isSuccess,
@@ -22,7 +22,7 @@ import {
22
22
  interrupt2,
23
23
  void_2,
24
24
  isFailure2,
25
- makeUnsafe4,
25
+ makeUnsafe5,
26
26
  _await,
27
27
  isDoneUnsafe,
28
28
  succeed4,
@@ -36,7 +36,6 @@ import {
36
36
  findError,
37
37
  hasInterrupts2,
38
38
  interruptors,
39
- Clock,
40
39
  min2,
41
40
  exponential,
42
41
  spaced,
@@ -52,7 +51,7 @@ import {
52
51
  withFiber2,
53
52
  flatMap3,
54
53
  andThen2,
55
- map7,
54
+ map8,
56
55
  catchCause2,
57
56
  catchCauseIf,
58
57
  orDie,
@@ -97,8 +96,21 @@ import {
97
96
  Defect,
98
97
  Exit,
99
98
  toCodecJson
100
- } from "./chunk-qjqa338f.js";
99
+ } from "./chunk-zw3gf6r5.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-0h49y8gf.js";
101
112
  import {
113
+ Clock,
102
114
  empty,
103
115
  fromInput,
104
116
  merge,
@@ -111,19 +123,7 @@ import {
111
123
  ParseOptions,
112
124
  RpcClientDefect,
113
125
  RpcClientError
114
- } from "./chunk-cr3qw0xf.js";
115
- import {
116
- interrupt,
117
- getCurrent,
118
- makeUnsafe,
119
- bounded,
120
- offerAll,
121
- failCause,
122
- end,
123
- shutdownUnsafe,
124
- fromQueue,
125
- unwrap
126
- } from "./chunk-c8wpw9nh.js";
126
+ } from "./chunk-4w0c1ykv.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")) {
@@ -200,7 +200,7 @@ var withRunClient = (f) => suspend3(() => {
200
200
  buffer.push([data, context]);
201
201
  return void_3;
202
202
  });
203
- return map7(f((clientId, data) => {
203
+ return map8(f((clientId, data) => {
204
204
  const clientWrite = clientWrites.get(clientId);
205
205
  if (clientWrite) {
206
206
  return clientWrite(data);
@@ -237,7 +237,7 @@ var makeNoSerialization = /* @__PURE__ */ fnUntraced(function* (group, options)
237
237
  const disableTracing = options?.disableTracing ?? false;
238
238
  const generateRequestId = options?.generateRequestId ?? (() => requestIdCounter++);
239
239
  const services = yield* context();
240
- const scope = get3(services, Scope);
240
+ const scope = get4(services, Scope);
241
241
  const entries = new Map;
242
242
  let isShutdown = false;
243
243
  yield* addFinalizer(scope, withFiber2((parent) => {
@@ -271,7 +271,7 @@ var makeNoSerialization = /* @__PURE__ */ fnUntraced(function* (group, options)
271
271
  const queue = onStreamRequest(rpc, middleware, rpc.payloadSchema.make(payload), headers, opts?.streamBufferSize ?? 16, context);
272
272
  if (opts?.asQueue)
273
273
  return queue;
274
- return unwrap(map7(queue, fromQueue));
274
+ return unwrap(map8(queue, fromQueue));
275
275
  };
276
276
  };
277
277
  const onEffectRequest = (rpc, middleware, span, payload, headers, context, discard) => withFiber2((parentFiber) => {
@@ -495,7 +495,7 @@ var make4 = /* @__PURE__ */ fnUntraced(function* (group, options) {
495
495
  const rpcSchemas = makeRpcSchemas(codecFor);
496
496
  const decodeDefect = decodeSync(codecFor(Defect()));
497
497
  const entries = new Map;
498
- const closing = makeUnsafe4();
498
+ const closing = makeUnsafe5();
499
499
  const interruptRequest = (requestId) => {
500
500
  if (!entries.has(requestId))
501
501
  return void_3;
@@ -643,7 +643,7 @@ var makeRpcSchemas = (codecFor) => {
643
643
  return entry;
644
644
  }
645
645
  const streamSchemas = getStreamSchemas(rpc.successSchema);
646
- const parseOptions = get3(rpc.annotations, ParseOptions);
646
+ const parseOptions = get4(rpc.annotations, ParseOptions);
647
647
  const exitSchema2 = exitSchema(rpc);
648
648
  let decodeDiscardExit;
649
649
  entry = {
@@ -804,7 +804,7 @@ var makePinger = /* @__PURE__ */ fnUntraced(function* (writePing, options) {
804
804
  const timeoutMillis = toMillis(options?.pingTimeout ?? interval);
805
805
  let lastSeen = clock.currentTimeMillisUnsafe();
806
806
  let awaitingResponse = false;
807
- const latch = makeUnsafe();
807
+ const latch = makeUnsafe2();
808
808
  const onFrame = () => {
809
809
  lastSeen = clock.currentTimeMillisUnsafe();
810
810
  awaitingResponse = false;
@@ -10,7 +10,7 @@ import {
10
10
  gen,
11
11
  fail7,
12
12
  flatMap3,
13
- map7,
13
+ map8,
14
14
  catchTags,
15
15
  mapError2,
16
16
  orDie,
@@ -32,8 +32,8 @@ import {
32
32
  toCodecJson,
33
33
  Json,
34
34
  encodePrettyJsonString
35
- } from "./chunk-qjqa338f.js";
36
- import"./chunk-0tjg9eya.js";
35
+ } from "./chunk-zw3gf6r5.js";
36
+ import"./chunk-q5w3v4k1.js";
37
37
  import {
38
38
  decodeText,
39
39
  mkString,
@@ -41,7 +41,7 @@ import {
41
41
  Path,
42
42
  withDefault,
43
43
  String2
44
- } from "./chunk-c8wpw9nh.js";
44
+ } from "./chunk-0h49y8gf.js";
45
45
  import {
46
46
  SecureRandom,
47
47
  layerWebCrypto,
@@ -53,23 +53,23 @@ import {
53
53
  layer4,
54
54
  kitmanMcpServer,
55
55
  RunnerRpcProtocolVersion
56
- } from "./chunk-cr3qw0xf.js";
56
+ } from "./chunk-4w0c1ykv.js";
57
57
  import {
58
58
  Packument,
59
59
  tarballMatches
60
- } from "./chunk-n9351czb.js";
61
- import"./chunk-tgwa9vqw.js";
60
+ } from "./chunk-azfjx5d8.js";
61
+ import"./chunk-7afnkx5b.js";
62
62
  import {
63
63
  AgentDeclaration,
64
64
  KitDeclarations,
65
65
  describeFlag,
66
66
  Described
67
- } from "./chunk-gyek54h3.js";
67
+ } from "./chunk-4gy4ty6k.js";
68
68
  import {
69
69
  ChildProcessSpawner,
70
70
  make3
71
- } from "./chunk-6d53ezj1.js";
72
- import"./chunk-wcvfkdwd.js";
71
+ } from "./chunk-mtkstrh3.js";
72
+ import"./chunk-fr79hgq2.js";
73
73
 
74
74
  // packages/sdk/src/build/index.ts
75
75
  class DependencyInstallFailed extends TaggedError2()("DependencyInstallFailed", {
@@ -118,7 +118,7 @@ var run = (command, args, cwd) => gen(function* () {
118
118
  }).pipe(scoped);
119
119
  var failure = (result) => (result.stderr.trim() || result.stdout.trim()).slice(-2000);
120
120
  var provenance = (directory) => gen(function* () {
121
- const git = (...args) => run("git", args, directory).pipe(map7((result) => result.ok ? result.stdout.trim() : undefined), orElseSucceed(() => {
121
+ const git = (...args) => run("git", args, directory).pipe(map8((result) => result.ok ? result.stdout.trim() : undefined), orElseSucceed(() => {
122
122
  return;
123
123
  }));
124
124
  const repository = yield* git("remote", "get-url", "origin");
@@ -144,7 +144,7 @@ var readText = (directory, text, what) => gen(function* () {
144
144
  const file = yield* inKit(directory, text.file, what);
145
145
  return yield* fs.readFileString(file).pipe(mapError2(() => new DeclarationsInvalid({ reason: `${what} ${text.file} does not read` })));
146
146
  });
147
- var readAgents = (directory, agents) => forEach(Object.entries(agents), ([id, { instructions, ...agent }]) => instructions === undefined ? succeed6([id, agent]) : map7(readText(directory, instructions, `Agent "${id}" instructions`), (text) => [id, { ...agent, instructions: text.trim() }])).pipe(map7(Object.fromEntries));
147
+ var readAgents = (directory, agents) => forEach(Object.entries(agents), ([id, { instructions, ...agent }]) => instructions === undefined ? succeed6([id, agent]) : map8(readText(directory, instructions, `Agent "${id}" instructions`), (text) => [id, { ...agent, instructions: text.trim() }])).pipe(map8(Object.fromEntries));
148
148
  var utf8 = new TextDecoder("utf-8", { fatal: true });
149
149
  var setupFile = (bytes) => {
150
150
  try {
@@ -219,7 +219,7 @@ var fetchNpm = (name, wanted, what) => gen(function* () {
219
219
  const dist = packument.versions[packument["dist-tags"][wanted] ?? wanted]?.dist;
220
220
  if (dist === undefined)
221
221
  return yield* failed("npm has no such version or dist-tag");
222
- const tarball = yield* get2(dist.tarball).pipe(flatMap3(filterStatusOk), flatMap3((response) => response.arrayBuffer), map7((buffer) => new Uint8Array(buffer)), mapError2((error) => failed(error.message)));
222
+ const tarball = yield* get2(dist.tarball).pipe(flatMap3(filterStatusOk), flatMap3((response) => response.arrayBuffer), map8((buffer) => new Uint8Array(buffer)), mapError2((error) => failed(error.message)));
223
223
  if (!tarballMatches(tarball, dist))
224
224
  return yield* failed(`the tarball does not match its integrity ${dist.integrity ?? `sha1 ${dist.shasum}`}`);
225
225
  const directory = yield* fs.makeTempDirectoryScoped({ prefix: "kitman-npm-" });
@@ -260,11 +260,11 @@ var setupArchive = (directory, kit, setup, checkouts) => gen(function* () {
260
260
  const file = yield* inKit(directory, setup.instructions, what);
261
261
  files["instructions.md"] = setupFile(yield* fs.readFile(file).pipe(mapError2(() => new DeclarationsInvalid({ reason: `${what} do not read` }))));
262
262
  }
263
- const skills = setup.skills === undefined ? undefined : yield* forEach(setup.skills, (skill) => map7(sourceTree(directory, skill.source, `Kit ${kit} skill ${skill.name}`, checkouts), (tree) => ({
263
+ const skills = setup.skills === undefined ? undefined : yield* forEach(setup.skills, (skill) => map8(sourceTree(directory, skill.source, `Kit ${kit} skill ${skill.name}`, checkouts), (tree) => ({
264
264
  ...skill,
265
265
  source: place(`skills/${skill.name}`, tree)
266
266
  })));
267
- const plugins = setup.plugins === undefined ? undefined : yield* forEach(setup.plugins, (plugin) => map7(sourceTree(directory, plugin.sources[0], `Kit ${kit} plugin ${plugin.name}`, checkouts), (tree) => ({
267
+ const plugins = setup.plugins === undefined ? undefined : yield* forEach(setup.plugins, (plugin) => map8(sourceTree(directory, plugin.sources[0], `Kit ${kit} plugin ${plugin.name}`, checkouts), (tree) => ({
268
268
  ...plugin,
269
269
  sources: [place(`plugins/${plugin.name}`, tree)]
270
270
  })));
@@ -310,7 +310,7 @@ var importedFile = (file, specifier) => gen(function* () {
310
310
  const path = yield* Path;
311
311
  const target = path.resolve(path.dirname(file), specifier);
312
312
  for (const candidate of [target, `${target}.ts`, path.join(target, "kitman.config.ts")])
313
- if (yield* fs.stat(candidate).pipe(map7((info) => info.type === "File"), orElseSucceed(() => false)))
313
+ if (yield* fs.stat(candidate).pipe(map8((info) => info.type === "File"), orElseSucceed(() => false)))
314
314
  return candidate;
315
315
  return;
316
316
  });
@@ -351,7 +351,7 @@ var kitModules = (root) => gen(function* () {
351
351
  if (visited.has(file))
352
352
  return;
353
353
  visited.add(file);
354
- const transpiled = yield* run("bun", ["build", "--no-bundle", file], root).pipe(map7((result) => result.ok ? result.stdout : ""), orElseSucceed(() => ""));
354
+ const transpiled = yield* run("bun", ["build", "--no-bundle", file], root).pipe(map8((result) => result.ok ? result.stdout : ""), orElseSucceed(() => ""));
355
355
  for (const [, specifier] of transpiled.matchAll(/\b(?:from|import)\s*"(\.{1,2}\/[^"]+)"/gu)) {
356
356
  const module = specifier === undefined ? undefined : yield* importedFile(file, specifier);
357
357
  if (module === undefined || visited.has(module))
@@ -477,7 +477,7 @@ var buildKit = (directory, options = {}) => gen(function* () {
477
477
  ...own.schedules === undefined ? undefined : { schedules: own.schedules },
478
478
  carried
479
479
  }).pipe(mapError2((error) => new DeclarationsInvalid({ reason: error.message })));
480
- const bundle = yield* fs.readFileString(bundleFile).pipe(map7((text) => new TextEncoder().encode(text.replaceAll(entryName, ".kitman-build-entry.ts"))), mapError2((error) => new BundleFailed({ reason: error.message })));
480
+ const bundle = yield* fs.readFileString(bundleFile).pipe(map8((text) => new TextEncoder().encode(text.replaceAll(entryName, ".kitman-build-entry.ts"))), mapError2((error) => new BundleFailed({ reason: error.message })));
481
481
  return {
482
482
  ...identity,
483
483
  bundle,
@@ -3,7 +3,7 @@ import {
3
3
  Random,
4
4
  succeed6,
5
5
  withFiber2
6
- } from "./chunk-qjqa338f.js";
6
+ } from "./chunk-zw3gf6r5.js";
7
7
 
8
8
  // node_modules/.bun/effect@4.1.2/node_modules/effect/dist/Random.js
9
9
  var Random2 = Random;