@kitman-sh/cli 0.12.6 → 0.12.8

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-s8m2tzdr.js → chunk-0tjg9eya.js} +1 -1
  2. package/dist/{chunk-vkchn89k.js → chunk-31gpnkq3.js} +5 -5
  3. package/dist/{chunk-n17dr5c1.js → chunk-3x6cbhzd.js} +4 -4
  4. package/dist/{chunk-892qrkb3.js → chunk-6d53ezj1.js} +62 -16
  5. package/dist/{chunk-dcnn882c.js → chunk-6w7ajkm8.js} +29 -29
  6. package/dist/{chunk-fen5480a.js → chunk-93ypzdpa.js} +7 -7
  7. package/dist/{chunk-jk5fp5cy.js → chunk-9qp59fht.js} +48 -48
  8. package/dist/{chunk-8djn7v2p.js → chunk-bh9k3kty.js} +59 -59
  9. package/dist/{chunk-x5t0c4g4.js → chunk-c8hwfktd.js} +7 -7
  10. package/dist/{chunk-y7vjk8vv.js → chunk-c8wpw9nh.js} +207 -222
  11. package/dist/{chunk-gezjwdpw.js → chunk-cr3qw0xf.js} +373 -448
  12. package/dist/{chunk-mm2m3bys.js → chunk-cw61zyh5.js} +1 -1
  13. package/dist/{chunk-bz4bp0q7.js → chunk-fh58za51.js} +3 -3
  14. package/dist/{chunk-7ncc3m3n.js → chunk-gyek54h3.js} +8 -8
  15. package/dist/{chunk-8sz25ptv.js → chunk-j1cnq2j0.js} +4 -4
  16. package/dist/{chunk-wberffvr.js → chunk-jwrs9pfa.js} +108 -108
  17. package/dist/{chunk-e711ebdj.js → chunk-kzwdhdej.js} +2 -2
  18. package/dist/{chunk-7tnm4jef.js → chunk-n9351czb.js} +7 -7
  19. package/dist/{chunk-k3ak93p1.js → chunk-pjpfc3sd.js} +1 -1
  20. package/dist/{chunk-x3cc7dfc.js → chunk-qjqa338f.js} +302 -249
  21. package/dist/{chunk-v4wn0tz8.js → chunk-s5pzy86v.js} +6 -6
  22. package/dist/{chunk-gtsq369x.js → chunk-tgwa9vqw.js} +9 -9
  23. package/dist/{chunk-23245qh7.js → chunk-wcvfkdwd.js} +26 -26
  24. package/dist/{chunk-rvpfyjtv.js → chunk-xng6j3a8.js} +1 -1
  25. package/dist/{chunk-skqn4h13.js → chunk-z5f7g1w1.js} +2 -2
  26. package/dist/index.js +4 -4
  27. package/package.json +1 -1
@@ -17,12 +17,12 @@ import {
17
17
  isSuccess,
18
18
  TaggedError,
19
19
  void_2,
20
- makeUnsafe5,
20
+ makeUnsafe4,
21
21
  _await,
22
22
  fail5,
23
23
  succeed4,
24
24
  doneUnsafe,
25
- makeUnsafe6,
25
+ makeUnsafe5,
26
26
  provide,
27
27
  close,
28
28
  buildWithScope,
@@ -30,6 +30,7 @@ import {
30
30
  provide2,
31
31
  provideMerge,
32
32
  squash,
33
+ currentTimeMillis,
33
34
  spaced,
34
35
  all3,
35
36
  forEach,
@@ -49,7 +50,7 @@ import {
49
50
  tap2,
50
51
  result,
51
52
  option2,
52
- map8,
53
+ map7,
53
54
  as,
54
55
  asVoid,
55
56
  catch_,
@@ -79,6 +80,8 @@ import {
79
80
  runSync,
80
81
  fnUntraced,
81
82
  fn,
83
+ makeUnsafe6,
84
+ formatIso,
82
85
  decodeUnknownEffect2,
83
86
  optionalKey,
84
87
  optional,
@@ -118,12 +121,9 @@ import {
118
121
  decodeJsonStringOption,
119
122
  encodeJsonStringSync,
120
123
  encodePrettyJsonString
121
- } from "./chunk-x3cc7dfc.js";
124
+ } from "./chunk-qjqa338f.js";
122
125
  import {
123
- currentTimeMillis,
124
126
  SecureRandom,
125
- makeUnsafe,
126
- formatIso,
127
127
  error,
128
128
  parseDate,
129
129
  currentDate,
@@ -158,8 +158,8 @@ import {
158
158
  sessionForApi,
159
159
  readAuthStore,
160
160
  agentCredentialForApi,
161
- make5,
162
161
  make6,
162
+ make7,
163
163
  Service,
164
164
  shouldRefresh,
165
165
  refreshSession,
@@ -170,13 +170,13 @@ import {
170
170
  runMcpEffect,
171
171
  createAgentAuthSignedFetch,
172
172
  setupMcpAgentCredential
173
- } from "./chunk-gezjwdpw.js";
173
+ } from "./chunk-cr3qw0xf.js";
174
174
  import {
175
175
  guard,
176
176
  Id,
177
177
  Timestamp,
178
178
  ActorType
179
- } from "./chunk-s8m2tzdr.js";
179
+ } from "./chunk-0tjg9eya.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-y7vjk8vv.js";
193
+ } from "./chunk-c8wpw9nh.js";
194
194
  import {
195
195
  searchDocs2,
196
196
  readDoc2
197
- } from "./chunk-rvpfyjtv.js";
197
+ } from "./chunk-xng6j3a8.js";
198
198
  import {
199
199
  nextInt
200
- } from "./chunk-mm2m3bys.js";
200
+ } from "./chunk-cw61zyh5.js";
201
201
  import {
202
202
  layerJson,
203
- make3,
203
+ make4,
204
204
  withHeaders,
205
205
  layerProtocolSocket,
206
206
  ConnectionHooks
207
- } from "./chunk-23245qh7.js";
207
+ } from "./chunk-wcvfkdwd.js";
208
208
 
209
209
  // apps/cli/src/mcp.ts
210
210
  import { tmpdir as tmpdir2 } from "os";
@@ -1956,56 +1956,56 @@ var LivePresenceSubscriptionMessage = Union([
1956
1956
  LivePresenceSubscriptionUpdate
1957
1957
  ]);
1958
1958
 
1959
- class LiveRpcs extends make6(make5("Session", {
1959
+ class LiveRpcs extends make7(make6("Session", {
1960
1960
  success: Struct({ workspaceId: String4, clientKind: String4 }),
1961
1961
  error: LiveRpcError
1962
- }), make5("Subscribe", {
1962
+ }), make6("Subscribe", {
1963
1963
  payload: LiveSubscribeInput,
1964
1964
  success: LiveSubscriptionMessage,
1965
1965
  error: LiveRpcError,
1966
1966
  stream: true
1967
- }), make5("Replay", {
1967
+ }), make6("Replay", {
1968
1968
  payload: LiveReplayInput,
1969
1969
  success: ArraySchema(LiveEvent),
1970
1970
  error: LiveRpcError
1971
- }), make5("Ack", {
1971
+ }), make6("Ack", {
1972
1972
  payload: LiveAckInput,
1973
1973
  success: LiveAckResult,
1974
1974
  error: LiveRpcError
1975
- }), make5("SubscribeWeb", {
1975
+ }), make6("SubscribeWeb", {
1976
1976
  payload: LiveWebSubscribeInput,
1977
1977
  success: LiveWebSubscriptionMessage,
1978
1978
  error: LiveRpcError,
1979
1979
  stream: true
1980
- }), make5("SubscriptionStatus", {
1980
+ }), make6("SubscriptionStatus", {
1981
1981
  payload: { subscriptionId: String4 },
1982
1982
  success: LiveSubscriptionStatus,
1983
1983
  error: LiveRpcError
1984
- }), make5("ReplayWeb", {
1984
+ }), make6("ReplayWeb", {
1985
1985
  payload: LiveWebReplayInput,
1986
1986
  success: LiveWebReplayResult,
1987
1987
  error: LiveRpcError
1988
- }), make5("AckWeb", {
1988
+ }), make6("AckWeb", {
1989
1989
  payload: LiveWebAckInput,
1990
1990
  success: LiveWebAckResult,
1991
1991
  error: LiveRpcError
1992
- }), make5("PublishPresence", {
1992
+ }), make6("PublishPresence", {
1993
1993
  payload: LivePresencePublishInput,
1994
1994
  success: LivePresenceEntry,
1995
1995
  error: LiveRpcError
1996
- }), make5("SubscribePresence", {
1996
+ }), make6("SubscribePresence", {
1997
1997
  payload: LivePresenceSubscribeInput,
1998
1998
  success: LivePresenceSubscriptionMessage,
1999
1999
  error: LiveRpcError,
2000
2000
  stream: true
2001
- }), make5("ClearPresence", {
2001
+ }), make6("ClearPresence", {
2002
2002
  payload: { scope: optional(LiveScope) },
2003
2003
  error: LiveRpcError
2004
- }), make5("RecordSessionUpdate", {
2004
+ }), make6("RecordSessionUpdate", {
2005
2005
  payload: { sessionId: String4, input: SessionUpdateCreate },
2006
2006
  success: SessionUpdate,
2007
2007
  error: LiveRpcError
2008
- }), make5("EndSession", {
2008
+ }), make6("EndSession", {
2009
2009
  payload: { sessionId: String4, input: SessionEnd },
2010
2010
  success: Session,
2011
2011
  error: LiveRpcError
@@ -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 = makeUnsafe6();
2046
+ const scope = makeUnsafe5();
2047
2047
  let connected = false;
2048
2048
  const hooks = succeed5(ConnectionHooks)({
2049
2049
  onConnect: sync2(() => {
@@ -2057,7 +2057,7 @@ function connectKitmanLiveRoot(protocol) {
2057
2057
  })
2058
2058
  });
2059
2059
  const layer = (isString2(protocol) ? liveWebSocketProtocol(protocol) : protocol()).pipe(provideMerge(hooks));
2060
- const client = await runPromise(buildWithScope(layer, scope).pipe(flatMap3((context) => make3(LiveRpcs).pipe(provideContext2(context))), provide(scope)));
2060
+ const client = await runPromise(buildWithScope(layer, scope).pipe(flatMap3((context) => make4(LiveRpcs).pipe(provideContext2(context))), provide(scope)));
2061
2061
  let abandon = () => {};
2062
2062
  const abandoned = new Promise((_resolve, reject) => {
2063
2063
  abandon = reject;
@@ -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 = makeUnsafe5();
2088
+ const opened = makeUnsafe4();
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 = makeUnsafe5();
5331
+ const result = makeUnsafe4();
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(map8(_await(warm.result), (text) => ({ text })), tryPromise({
5422
+ var outcomeOf = (warm) => raceFirst(map7(_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("{}") }), map8((text) => ({ text }))) : succeed6({ exitCode }))));
5427
+ }).pipe(flatMap3((exitCode) => exitCode === 0 ? _await(warm.result).pipe(timeoutOrElse({ duration: millis(100), orElse: () => succeed6("{}") }), map7((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(map8((json) => isJsonObject(json) ? json : {}), mapError2(() => new CodeModeExecutionError({ message: "Code Mode secure-exec returned an unreadable result" })));
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" })));
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(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 })))));
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 })))));
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(map8(() => [...entries.values()].flatMap((entry) => entry.approvalActorDigest === actorDigest && entry.status === "paused" ? [inspection(entry)] : [])));
6432
+ const listForActor = (actorDigest) => sweep.pipe(map7(() => [...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(map8(() => {
6442
+ const inspect = (executionId) => sweep.pipe(map7(() => {
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(map8((now) => {
6465
+ return currentTimeMillis.pipe(map7((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(map8((now) => {
6475
+ return currentTimeMillis.pipe(map7((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(makeUnsafe(epochMillis));
6490
+ return formatIso(makeUnsafe6(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(map8((decision) => ({ execution, action: decision }))), { concurrency: "unbounded" });
6852
+ const decided = yield* forEach(paused, (execution) => resolveDecision(execution.executionId).pipe(map7((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(map8(request("/brief"), (brief) => text(briefPage(brief.prompt, isNumber2(args.offset) ? args.offset : 0)))));
8298
+ }, (args) => run(map7(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 map8(closed(result.question), (question) => ({
8333
+ return map7(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(map8(request("/session-updates", {
8346
+ }, (args) => run(map7(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) => map8(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) => map7(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(map8((skill) => [{ name, skill }]), orElseSucceed(() => []))).pipe(map8((found) => found.flat()));
8375
+ return yield* forEach(names, (name) => fs.readFileString(`${skillsDir}/${name}/SKILL.md`).pipe(map7((skill) => [{ name, skill }]), orElseSucceed(() => []))).pipe(map7((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(map8(loadable, (skills) => {
8381
+ }, (args) => runMcpEffect(map7(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(`