@kitman-sh/cli 0.44.0 → 0.46.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. package/dist/{chunk-gw0pc35c.js → chunk-0511zsxk.js} +430 -55
  2. package/dist/{chunk-5ccz7ghp.js → chunk-16wyj1eq.js} +42 -33
  3. package/dist/{chunk-3mbp8cse.js → chunk-2xeq2a7j.js} +31 -174
  4. package/dist/{chunk-9h16pekj.js → chunk-5tgpa02q.js} +1 -1
  5. package/dist/{chunk-134jdvs6.js → chunk-6evexbdx.js} +14 -60
  6. package/dist/{chunk-wh3pjr9r.js → chunk-7wq13jgx.js} +13 -13
  7. package/dist/{chunk-zvmdyf3v.js → chunk-8qbem52x.js} +39 -39
  8. package/dist/{chunk-ncp13gyf.js → chunk-9hqskzqc.js} +2 -2
  9. package/dist/{chunk-8a7337s1.js → chunk-apv9h5tz.js} +1 -1
  10. package/dist/{chunk-qkwkxn4d.js → chunk-bc40mcq9.js} +76 -76
  11. package/dist/{chunk-d0rx9esz.js → chunk-c6pnj2aj.js} +7 -7
  12. package/dist/{chunk-3zy2vbp0.js → chunk-e1v0c57f.js} +10 -10
  13. package/dist/{chunk-wkg1v0kd.js → chunk-j0b47jdz.js} +5 -5
  14. package/dist/{chunk-k2re3tp5.js → chunk-k1fdsn2c.js} +1 -1
  15. package/dist/{chunk-hmctc4eq.js → chunk-m5wqyzhk.js} +3 -3
  16. package/dist/{chunk-dp6v658s.js → chunk-mxy4wzhs.js} +4 -4
  17. package/dist/{chunk-zkvrxna8.js → chunk-n00cpb86.js} +2 -2
  18. package/dist/{chunk-x0ma41ys.js → chunk-n381rqax.js} +226 -40
  19. package/dist/{chunk-7rj9d0rp.js → chunk-nyagtr2t.js} +3 -3
  20. package/dist/{chunk-1k6z8q79.js → chunk-pty4b78m.js} +299 -117
  21. package/dist/{chunk-1c4wk9dr.js → chunk-qfwhsqej.js} +3 -3
  22. package/dist/{chunk-dre4f6s4.js → chunk-qy0enebe.js} +9 -9
  23. package/dist/{chunk-j60f2tr1.js → chunk-t2x4p5sp.js} +4 -4
  24. package/dist/{chunk-d2tpz1yp.js → chunk-tsw66qp3.js} +1 -1
  25. package/dist/{chunk-wvnsqt17.js → chunk-w0tzm3fg.js} +6 -6
  26. package/dist/{chunk-dj873p0e.js → chunk-x38fytew.js} +92 -26
  27. package/dist/index.js +4 -4
  28. package/package.json +1 -1
@@ -4,9 +4,9 @@ import {
4
4
  opaqueTunnelRefusal2,
5
5
  isOpaqueConnectReason2,
6
6
  runSrtStep2
7
- } from "./chunk-zkvrxna8.js";
8
- import"./chunk-9h16pekj.js";
9
- import"./chunk-x0ma41ys.js";
7
+ } from "./chunk-n00cpb86.js";
8
+ import"./chunk-5tgpa02q.js";
9
+ import"./chunk-n381rqax.js";
10
10
  export {
11
11
  isOpaqueConnectReason2 as isOpaqueConnectReason,
12
12
  opaqueTunnelRefusal2 as opaqueTunnelRefusal,
@@ -1,10 +1,4 @@
1
1
  // @bun
2
- import {
3
- FileSystem,
4
- Path,
5
- optionalEnv,
6
- tempDirectoryScoped
7
- } from "./chunk-3mbp8cse.js";
8
2
  import {
9
3
  Reference,
10
4
  TaggedError,
@@ -31,15 +25,21 @@ import {
31
25
  isString2,
32
26
  encodePrettyJsonString,
33
27
  decodeJsonStringSync
34
- } from "./chunk-x0ma41ys.js";
28
+ } from "./chunk-n381rqax.js";
29
+ import {
30
+ FileSystem,
31
+ Path,
32
+ optionalEnv,
33
+ tempDirectoryScoped
34
+ } from "./chunk-2xeq2a7j.js";
35
35
  import {
36
36
  AgentHarnessIds,
37
37
  sha2562,
38
38
  runCommand2
39
- } from "./chunk-1k6z8q79.js";
39
+ } from "./chunk-pty4b78m.js";
40
40
  import {
41
41
  NpmRegistry
42
- } from "./chunk-hmctc4eq.js";
42
+ } from "./chunk-m5wqyzhk.js";
43
43
 
44
44
  // packages/agent-runtime/src/config-convergence.ts
45
45
  var writeAgentEnvironmentConfigFile2 = fnUntraced(function* (file, content, keep = {}) {
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import"./chunk-134jdvs6.js";
2
+ import"./chunk-6evexbdx.js";
3
3
  import {
4
4
  HERDR_CORE_GENERATION2,
5
5
  HERDR_CORE_INSTALL_COMMAND2,
@@ -12,9 +12,9 @@ import {
12
12
  herdrCoreLayer2,
13
13
  herdrCoreTransportLayer2,
14
14
  updateHerdrCore2
15
- } from "./chunk-1k6z8q79.js";
16
- import"./chunk-3mbp8cse.js";
17
- import"./chunk-x0ma41ys.js";
15
+ } from "./chunk-pty4b78m.js";
16
+ import"./chunk-2xeq2a7j.js";
17
+ import"./chunk-n381rqax.js";
18
18
  export {
19
19
  HERDR_CORE_GENERATION2 as HERDR_CORE_GENERATION,
20
20
  HERDR_CORE_INSTALL_COMMAND2 as HERDR_CORE_INSTALL_COMMAND,
@@ -4,7 +4,7 @@ import {
4
4
  searchDocs2,
5
5
  readDoc2,
6
6
  pinnedLink2
7
- } from "./chunk-7rj9d0rp.js";
7
+ } from "./chunk-nyagtr2t.js";
8
8
  export {
9
9
  DefaultDocsSearchLimit2 as DefaultDocsSearchLimit,
10
10
  pinnedLink2 as pinnedLink,
@@ -4,12 +4,12 @@ import {
4
4
  runnerRpcUrl2,
5
5
  makeRunnerRpcClient2,
6
6
  makeProgramRpcClient2
7
- } from "./chunk-d0rx9esz.js";
8
- import"./chunk-wkg1v0kd.js";
9
- import"./chunk-1k6z8q79.js";
10
- import"./chunk-9h16pekj.js";
11
- import"./chunk-3mbp8cse.js";
12
- import"./chunk-x0ma41ys.js";
7
+ } from "./chunk-c6pnj2aj.js";
8
+ import"./chunk-j0b47jdz.js";
9
+ import"./chunk-pty4b78m.js";
10
+ import"./chunk-5tgpa02q.js";
11
+ import"./chunk-2xeq2a7j.js";
12
+ import"./chunk-n381rqax.js";
13
13
  export {
14
14
  makeProgramRpcClient2 as makeProgramRpcClient,
15
15
  makeRunnerRpcClient2 as makeRunnerRpcClient,
@@ -137,14 +137,9 @@ import {
137
137
  TaggedError2,
138
138
  toJsonSchemaDocument,
139
139
  toCodecJson,
140
- Json
141
- } from "./chunk-x0ma41ys.js";
142
- import {
143
- currentTimeMillis,
144
- getCurrent,
145
- runForEach,
146
- FileSystem
147
- } from "./chunk-3mbp8cse.js";
140
+ Json,
141
+ encodeUnknownJsonStringSync
142
+ } from "./chunk-n381rqax.js";
148
143
  import {
149
144
  WebCrypto,
150
145
  makeUnsafe,
@@ -152,7 +147,11 @@ import {
152
147
  RepoBindingProvider,
153
148
  releaseVersion,
154
149
  ReleaseScope,
150
+ decodeAnswerSchema,
151
+ answerProblem,
152
+ answerValue,
155
153
  recommendedDefault,
154
+ isLoopSafeText,
156
155
  DeliveryMode,
157
156
  ProgramWorkUnit,
158
157
  MeasureEvidence,
@@ -181,18 +180,24 @@ import {
181
180
  StepManifest,
182
181
  KitSetup,
183
182
  RunnerRpcError
184
- } from "./chunk-1k6z8q79.js";
183
+ } from "./chunk-pty4b78m.js";
184
+ import {
185
+ currentTimeMillis,
186
+ getCurrent,
187
+ runForEach,
188
+ FileSystem
189
+ } from "./chunk-2xeq2a7j.js";
185
190
  import {
186
191
  splitQuestionOptions,
187
192
  recommendationProblem,
188
193
  questionAdvice
189
- } from "./chunk-k2re3tp5.js";
194
+ } from "./chunk-k1fdsn2c.js";
190
195
  import {
191
196
  guard,
192
197
  Id,
193
198
  Timestamp,
194
199
  ActorType
195
- } from "./chunk-9h16pekj.js";
200
+ } from "./chunk-5tgpa02q.js";
196
201
  var __defProp = Object.defineProperty;
197
202
  var __returnValue = (v) => v;
198
203
  function __exportSetter(name, newValue) {
@@ -1103,6 +1108,11 @@ var noteInBranches = (take) => map9(FirstBranches, (branches) => branches.forEac
1103
1108
  var agentDeferredNamed = (deferredName) => make2(deferredName, { success: Json, error: StepFailed });
1104
1109
  var syncDeferred = (step) => agentDeferredNamed(`sync/${step}`);
1105
1110
  var answerDeferred = (step) => make2(`ask/${step}`, { success: String4, error: StepFailed });
1111
+ var AnswerTakenBy = Literals(["person", "default", "auto"]);
1112
+ var structuredAnswerDeferred = (step) => make2(`ask/${step}`, {
1113
+ success: Struct({ answer: String4, by: AnswerTakenBy }),
1114
+ error: StepFailed
1115
+ });
1106
1116
  var eventDeferred = (step) => make2(`wait_for/${step}`, { success: LoopEvent, error: WaitTimedOut });
1107
1117
  var verifyDeferred = (step) => make2(`verify/${step}`, { success: VerifyResult, error: StepFailed });
1108
1118
  var recordStep = (name, kind, exit) => {
@@ -1184,14 +1194,22 @@ var submittedBy = (step, deferred, options) => gen(function* () {
1184
1194
  });
1185
1195
  var decodeOutput = (step, schema, submitted) => decodeEffect(toCodecJson(schema))(submitted).pipe(mapError2((error) => new OutputInvalid({ step, message: error.message })));
1186
1196
  var agentWorkAs = (deferredOf, name, options) => takeStep(name, "agent_work", "agent_work", (step) => flatMap3(submittedBy(step, deferredOf(step), options), (submitted) => decodeOutput(step, options.output, submitted)));
1187
- var ask = (name, question) => takeStep(name, "ask", "ask", (name) => gen(function* () {
1188
- const deferred = answerDeferred(name);
1189
- const offered = "options" in question ? splitQuestionOptions(question.options) : undefined;
1190
- const options = offered?.options;
1191
- const recommended = "recommended" in question ? question.recommended : undefined;
1192
- const informationOnly = "informationOnly" in question ? question.informationOnly : undefined;
1197
+ class Words {
1198
+ text;
1199
+ constructor(text) {
1200
+ this.text = text;
1201
+ }
1202
+ get blank() {
1203
+ return this.text.trim() === "";
1204
+ }
1205
+ toString() {
1206
+ return this.text;
1207
+ }
1208
+ }
1209
+ var putQuestion = (name, question, deferred) => gen(function* () {
1210
+ const { options, recommended, informationOnly } = question;
1193
1211
  const advice = questionAdvice({
1194
- ...offered,
1212
+ ...question.optionDescriptions === undefined ? undefined : { optionDescriptions: question.optionDescriptions },
1195
1213
  ...recommended === undefined ? undefined : { recommended },
1196
1214
  recommendationReason: question.recommendationReason,
1197
1215
  ...informationOnly === undefined ? undefined : { informationOnly }
@@ -1210,6 +1228,7 @@ var ask = (name, question) => takeStep(name, "ask", "ask", (name) => gen(functio
1210
1228
  step: name,
1211
1229
  prompt: question.prompt,
1212
1230
  ...options === undefined ? undefined : { options },
1231
+ ...question.answerSchema === undefined ? undefined : { answerSchema: question.answerSchema },
1213
1232
  ...advice,
1214
1233
  ...fallback === undefined ? undefined : { default: fallback },
1215
1234
  ...question.auto === undefined ? undefined : { auto: question.auto },
@@ -1218,15 +1237,62 @@ var ask = (name, question) => takeStep(name, "ask", "ask", (name) => gen(functio
1218
1237
  ...question.timeout === undefined ? undefined : { timeoutMillis: toMillis(fromInputUnsafe(question.timeout)) },
1219
1238
  token: token2
1220
1239
  }));
1221
- const answer = yield* await_(deferred);
1222
- if (options === undefined) {
1223
- return answer;
1224
- }
1225
- const offeredAnswer = options.find((option) => option === answer);
1226
- if (offeredAnswer === undefined)
1240
+ return yield* await_(deferred);
1241
+ });
1242
+ var askOptions = (name, question) => gen(function* () {
1243
+ const { options, optionDescriptions } = splitQuestionOptions(question.options);
1244
+ const answer = yield* putQuestion(name, { ...question, options, ...optionDescriptions === undefined ? undefined : { optionDescriptions } }, answerDeferred(name));
1245
+ if (!options.includes(answer))
1227
1246
  return yield* new QuestionRefused({ step: name, answer, options });
1228
- return offeredAnswer;
1229
- }));
1247
+ return answer;
1248
+ });
1249
+ var askStructured = (name, question) => gen(function* () {
1250
+ const read = decodeAnswerSchema(question.answer);
1251
+ if ("problem" in read)
1252
+ return yield* new StepFailed({ step: name, reason: read.problem });
1253
+ const { schema } = read;
1254
+ const declared = (what, value, stored) => {
1255
+ const answer = encodeUnknownJsonStringSync(value);
1256
+ const problem = stored && !isLoopSafeText(answer) ? "it is too long, or holds a credential" : answerProblem(schema, answer);
1257
+ return problem === undefined ? succeed6(answer) : fail7(new StepFailed({ step: name, reason: `The ${what} is refused: ${problem}` }));
1258
+ };
1259
+ const taken = yield* putQuestion(name, {
1260
+ prompt: question.prompt,
1261
+ answerSchema: schema,
1262
+ recommended: yield* declared("recommended answer", question.recommended, false),
1263
+ recommendationReason: question.recommendationReason,
1264
+ ...question.default === undefined ? undefined : { default: question.default === null ? null : yield* declared("default", question.default, true) },
1265
+ ...question.auto === undefined ? undefined : { auto: yield* declared("full-auto answer", question.auto, true) },
1266
+ ...question.unattendedAuto === undefined ? undefined : { unattendedAuto: yield* declared("full-auto answer", question.unattendedAuto, true) },
1267
+ ...question.evidence === undefined ? undefined : { evidence: question.evidence },
1268
+ ...question.timeout === undefined ? undefined : { timeout: question.timeout }
1269
+ }, structuredAnswerDeferred(name));
1270
+ const decoded = answerValue(schema, taken.answer);
1271
+ if (decoded === undefined)
1272
+ return yield* new QuestionRefused({ step: name, answer: taken.answer, options: [] });
1273
+ return { answer: decoded.value, by: taken.by };
1274
+ });
1275
+ function ask(name, question) {
1276
+ return takeStep(name, "ask", "ask", (name) => {
1277
+ const modes = [
1278
+ "options" in question && question.options !== undefined ? "options" : [],
1279
+ "answer" in question && question.answer !== undefined ? "answer" : [],
1280
+ "freeText" in question && question.freeText !== undefined ? "freeText" : []
1281
+ ].flat();
1282
+ if (modes.length === 1) {
1283
+ if ("options" in question && question.options !== undefined)
1284
+ return askOptions(name, question);
1285
+ if ("answer" in question && question.answer !== undefined)
1286
+ return askStructured(name, question);
1287
+ if ("freeText" in question && question.freeText === true)
1288
+ return map9(putQuestion(name, question, answerDeferred(name)), (text) => new Words(text));
1289
+ }
1290
+ return fail7(new StepFailed({
1291
+ step: name,
1292
+ reason: `A Question declares exactly one of options, answer or freeText: true; this one declares ${modes.length === 0 ? "none" : modes.join(" and ")}`
1293
+ }));
1294
+ });
1295
+ }
1230
1296
  var waitFor = (name, wait) => takeStep(name, "wait_for", undefined, (name) => gen(function* () {
1231
1297
  const deferred = eventDeferred(name);
1232
1298
  const timeoutMillis = toMillis(fromInputUnsafe(wait.timeout));
package/dist/index.js CHANGED
@@ -5,15 +5,15 @@
5
5
  var args = process.argv.slice(2);
6
6
  if (args[0] === "srt") {
7
7
  process.argv.splice(2, 1);
8
- const { runSrtCli } = await import("./chunk-ncp13gyf.js");
8
+ const { runSrtCli } = await import("./chunk-9hqskzqc.js");
9
9
  await runSrtCli();
10
10
  } else if (args[0] === "srt-step") {
11
- const { runSrtStep } = await import("./chunk-1c4wk9dr.js");
11
+ const { runSrtStep } = await import("./chunk-qfwhsqej.js");
12
12
  await runSrtStep(args.slice(1));
13
13
  } else if (args[0] === "opencode-read") {
14
- const { runOpencodeReader } = await import("./chunk-dp6v658s.js");
14
+ const { runOpencodeReader } = await import("./chunk-mxy4wzhs.js");
15
15
  runOpencodeReader();
16
16
  } else {
17
- const { runCli } = await import("./chunk-5ccz7ghp.js");
17
+ const { runCli } = await import("./chunk-16wyj1eq.js");
18
18
  runCli(args);
19
19
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kitman-sh/cli",
3
- "version": "0.44.0",
3
+ "version": "0.46.0",
4
4
  "type": "module",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "bin": {