@kitman-sh/cli 0.45.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-tqv14b4c.js → chunk-0511zsxk.js} +429 -54
  2. package/dist/{chunk-9qvgbp6k.js → chunk-16wyj1eq.js} +36 -27
  3. package/dist/{chunk-5smh4dp2.js → chunk-2xeq2a7j.js} +21 -155
  4. package/dist/{chunk-4vxbxjf8.js → chunk-5tgpa02q.js} +1 -1
  5. package/dist/{chunk-fqh4pj6b.js → chunk-6evexbdx.js} +2 -2
  6. package/dist/{chunk-8gkrs473.js → chunk-7wq13jgx.js} +3 -3
  7. package/dist/{chunk-fmvdwf5h.js → chunk-8qbem52x.js} +23 -23
  8. package/dist/{chunk-a71b15k3.js → chunk-9hqskzqc.js} +2 -2
  9. package/dist/{chunk-04wqa07j.js → chunk-apv9h5tz.js} +1 -1
  10. package/dist/{chunk-tx9aey19.js → chunk-bc40mcq9.js} +17 -17
  11. package/dist/{chunk-0dfg674z.js → chunk-c6pnj2aj.js} +4 -4
  12. package/dist/{chunk-zx86g3dw.js → chunk-e1v0c57f.js} +7 -7
  13. package/dist/{chunk-f957cxrx.js → chunk-j0b47jdz.js} +3 -3
  14. package/dist/{chunk-9ykh05hz.js → chunk-k1fdsn2c.js} +1 -1
  15. package/dist/{chunk-es6rnmyw.js → chunk-m5wqyzhk.js} +3 -3
  16. package/dist/{chunk-tfwgeqx5.js → chunk-mxy4wzhs.js} +4 -4
  17. package/dist/{chunk-n3jpxd14.js → chunk-n00cpb86.js} +2 -2
  18. package/dist/{chunk-k462v2v7.js → chunk-n381rqax.js} +157 -13
  19. package/dist/{chunk-qzwsh96c.js → chunk-nyagtr2t.js} +2 -2
  20. package/dist/{chunk-69y8j7fs.js → chunk-pty4b78m.js} +189 -16
  21. package/dist/{chunk-5pjbxhxy.js → chunk-qfwhsqej.js} +3 -3
  22. package/dist/{chunk-g26y214g.js → chunk-qy0enebe.js} +4 -4
  23. package/dist/{chunk-k7eh8tac.js → chunk-t2x4p5sp.js} +4 -4
  24. package/dist/{chunk-e3dv8hzy.js → chunk-tsw66qp3.js} +1 -1
  25. package/dist/{chunk-yyz9xrc1.js → chunk-w0tzm3fg.js} +6 -6
  26. package/dist/{chunk-5gbt1vhm.js → chunk-x38fytew.js} +87 -21
  27. package/dist/index.js +4 -4
  28. package/package.json +1 -1
@@ -191,6 +191,8 @@ import {
191
191
  clockWith,
192
192
  logError,
193
193
  effectify,
194
+ toNumber,
195
+ bytes,
194
196
  decode,
195
197
  isRedacted,
196
198
  make16,
@@ -202,6 +204,7 @@ import {
202
204
  is,
203
205
  decodeUnknownEffect2,
204
206
  decodeEffect,
207
+ decodeUnknownExit,
205
208
  decodeUnknownOption,
206
209
  decodeOption,
207
210
  make17,
@@ -265,13 +268,12 @@ import {
265
268
  decodeJsonStringOption,
266
269
  encodeJsonStringSync,
267
270
  encodePrettyJsonString
268
- } from "./chunk-k462v2v7.js";
271
+ } from "./chunk-n381rqax.js";
269
272
  import {
270
273
  map,
271
274
  makeEquivalence,
272
275
  Clock,
273
276
  currentTimeMillis,
274
- bytes,
275
277
  BadArgument,
276
278
  systemError,
277
279
  badArgument,
@@ -335,7 +337,7 @@ import {
335
337
  optionalEnv,
336
338
  harnessesUnsupportedInSrt2,
337
339
  harnessesUnsupportedInDocker2
338
- } from "./chunk-5smh4dp2.js";
340
+ } from "./chunk-2xeq2a7j.js";
339
341
  import {
340
342
  ExitCode,
341
343
  ProcessId,
@@ -346,7 +348,7 @@ import {
346
348
  make2,
347
349
  parseFdName,
348
350
  fdName
349
- } from "./chunk-fqh4pj6b.js";
351
+ } from "./chunk-6evexbdx.js";
350
352
  import {
351
353
  isDateTime,
352
354
  Numeric,
@@ -359,8 +361,7 @@ import {
359
361
  SecretScope,
360
362
  SecretHosts,
361
363
  isSecretReference
362
- } from "./chunk-4vxbxjf8.js";
363
-
364
+ } from "./chunk-5tgpa02q.js";
364
365
  // node_modules/.bun/effect@4.1.2/node_modules/effect/dist/Tuple.js
365
366
  var makeEquivalence3 = Tuple;
366
367
 
@@ -897,15 +898,6 @@ var runMain2 = /* @__PURE__ */ makeRunMain(({
897
898
  // node_modules/.bun/@effect+platform-bun@4.1.2+edf248c88a527e3e/node_modules/@effect/platform-bun/dist/BunRuntime.js
898
899
  var runMain = runMain2;
899
900
 
900
- // node_modules/.bun/effect@4.1.2/node_modules/effect/dist/BigInt.js
901
- var BigInt2 = globalThis.BigInt;
902
- var toNumber = (b) => {
903
- if (b > BigInt2(Number.MAX_SAFE_INTEGER) || b < BigInt2(Number.MIN_SAFE_INTEGER)) {
904
- return none();
905
- }
906
- return some(Number(b));
907
- };
908
-
909
901
  // node_modules/.bun/effect@4.1.2/node_modules/effect/dist/DateTime.js
910
902
  var makeUnsafe = makeUnsafe6;
911
903
  var make18 = make3;
@@ -6377,6 +6369,184 @@ var checkTests = (reports, printed = []) => {
6377
6369
  };
6378
6370
  };
6379
6371
 
6372
+ // packages/core/src/question-answer.ts
6373
+ var AnswerSchemaJson = Record(String4, Json);
6374
+ var description = optionalKey(String4);
6375
+ var Count = Int.check(isGreaterThanOrEqualTo(0));
6376
+ var Nested = suspend4(() => DeclaredAnswerSchema);
6377
+ var DeclaredAnswerSchema = Union([
6378
+ Struct({ description, type: Literal("boolean"), const: optionalKey(Boolean2) }),
6379
+ Struct({
6380
+ description,
6381
+ type: Literal("string"),
6382
+ const: optionalKey(String4),
6383
+ enum: optionalKey(ArraySchema(String4).check(isMinLength(1))),
6384
+ minLength: optionalKey(Count),
6385
+ maxLength: optionalKey(Count)
6386
+ }),
6387
+ Struct({
6388
+ description,
6389
+ type: Literal("integer"),
6390
+ const: optionalKey(Int),
6391
+ minimum: optionalKey(Int),
6392
+ maximum: optionalKey(Int)
6393
+ }),
6394
+ Struct({
6395
+ description,
6396
+ type: Literal("array"),
6397
+ items: Nested,
6398
+ minItems: optionalKey(Count),
6399
+ maxItems: optionalKey(Count)
6400
+ }),
6401
+ Struct({
6402
+ description,
6403
+ type: Literal("object"),
6404
+ properties: Record(String4, Nested),
6405
+ required: ArraySchema(String4),
6406
+ additionalProperties: Literal(false)
6407
+ }),
6408
+ Struct({ description, anyOf: ArraySchema(Nested).check(isMinLength(1)) })
6409
+ ]);
6410
+ var decodeDeclared = decodeUnknownExit(DeclaredAnswerSchema, { onExcessProperty: "error" });
6411
+ var inverted = (low, high) => low !== undefined && high !== undefined && low > high;
6412
+ var declarationProblem = (schema, path) => {
6413
+ if ("anyOf" in schema) {
6414
+ for (const [index, form] of schema.anyOf.entries()) {
6415
+ const problem = declarationProblem(form, `${path}anyOf[${index}].`);
6416
+ if (problem !== undefined)
6417
+ return problem;
6418
+ }
6419
+ return;
6420
+ }
6421
+ switch (schema.type) {
6422
+ case "boolean":
6423
+ return;
6424
+ case "string":
6425
+ return inverted(schema.minLength, schema.maxLength) ? `${path}minLength is past maxLength` : undefined;
6426
+ case "integer":
6427
+ return inverted(schema.minimum, schema.maximum) ? `${path}minimum is past maximum` : undefined;
6428
+ case "array":
6429
+ return inverted(schema.minItems, schema.maxItems) ? `${path}minItems is past maxItems` : declarationProblem(schema.items, `${path}items.`);
6430
+ case "object": {
6431
+ const missing = schema.required.find((key) => !Object.hasOwn(schema.properties, key));
6432
+ if (missing !== undefined)
6433
+ return `${path}required names "${missing}", which is not one of its properties`;
6434
+ for (const [key, field] of Object.entries(schema.properties)) {
6435
+ const problem = declarationProblem(field, `${path}properties.${key}.`);
6436
+ if (problem !== undefined)
6437
+ return problem;
6438
+ }
6439
+ return;
6440
+ }
6441
+ }
6442
+ };
6443
+ var decodeAnswerSchema = (declared) => {
6444
+ const decoded = decodeDeclared(declared);
6445
+ if (decoded._tag === "Failure")
6446
+ return {
6447
+ problem: `The answer schema is not one Kitman supports: boolean, string, integer, array, object with additionalProperties false, or anyOf, each with only their own keywords`
6448
+ };
6449
+ const problem = declarationProblem(decoded.value, "");
6450
+ return problem === undefined ? { schema: decoded.value } : { problem: `The answer schema is invalid: ${problem}` };
6451
+ };
6452
+ var shown = (value) => encodeJsonStringSync(value);
6453
+ var valueProblem = (schema, value, path) => {
6454
+ const at = path === "" ? "The answer" : path;
6455
+ if ("anyOf" in schema)
6456
+ return schema.anyOf.some((form) => valueProblem(form, value, path) === undefined) ? undefined : `${at} is none of the forms it accepts`;
6457
+ switch (schema.type) {
6458
+ case "boolean":
6459
+ if (!isBoolean2(value))
6460
+ return `${at} must be true or false`;
6461
+ return schema.const !== undefined && value !== schema.const ? `${at} must be ${schema.const}` : undefined;
6462
+ case "string":
6463
+ if (!isString2(value))
6464
+ return `${at} must be a string`;
6465
+ if (schema.const !== undefined && value !== schema.const)
6466
+ return `${at} must be ${shown(schema.const)}`;
6467
+ if (schema.enum !== undefined && !schema.enum.includes(value))
6468
+ return `${at} must be one of ${schema.enum.map(shown).join(", ")}`;
6469
+ if (schema.minLength !== undefined && value.length < schema.minLength)
6470
+ return `${at} must be at least ${schema.minLength} characters`;
6471
+ return schema.maxLength !== undefined && value.length > schema.maxLength ? `${at} must be at most ${schema.maxLength} characters` : undefined;
6472
+ case "integer":
6473
+ if (!Number.isInteger(value))
6474
+ return `${at} must be an integer`;
6475
+ if (schema.const !== undefined && value !== schema.const)
6476
+ return `${at} must be ${schema.const}`;
6477
+ if (schema.minimum !== undefined && Number(value) < schema.minimum)
6478
+ return `${at} must be at least ${schema.minimum}`;
6479
+ return schema.maximum !== undefined && Number(value) > schema.maximum ? `${at} must be at most ${schema.maximum}` : undefined;
6480
+ case "array": {
6481
+ if (!Array.isArray(value))
6482
+ return `${at} must be an array`;
6483
+ if (schema.minItems !== undefined && value.length < schema.minItems)
6484
+ return `${at} must hold at least ${schema.minItems} item${schema.minItems === 1 ? "" : "s"}`;
6485
+ if (schema.maxItems !== undefined && value.length > schema.maxItems)
6486
+ return `${at} must hold at most ${schema.maxItems} item${schema.maxItems === 1 ? "" : "s"}`;
6487
+ for (const [index, item] of value.entries()) {
6488
+ const problem = valueProblem(schema.items, item, `${path === "" ? "" : path}[${index}]`);
6489
+ if (problem !== undefined)
6490
+ return problem;
6491
+ }
6492
+ return;
6493
+ }
6494
+ case "object": {
6495
+ if (!isJsonObject(value))
6496
+ return `${at} must be an object`;
6497
+ const extra = Object.keys(value).find((key) => !Object.hasOwn(schema.properties, key));
6498
+ if (extra !== undefined)
6499
+ return `${at} must not have "${extra}"`;
6500
+ const missing = schema.required.find((key) => !Object.hasOwn(value, key));
6501
+ if (missing !== undefined)
6502
+ return `${at} must have "${missing}"`;
6503
+ for (const [key, field] of Object.entries(schema.properties)) {
6504
+ const given = value[key];
6505
+ if (given === undefined)
6506
+ continue;
6507
+ const problem = valueProblem(field, given, path === "" ? key : `${path}.${key}`);
6508
+ if (problem !== undefined)
6509
+ return problem;
6510
+ }
6511
+ return;
6512
+ }
6513
+ }
6514
+ };
6515
+ var sketch = (schema) => {
6516
+ if ("anyOf" in schema)
6517
+ return schema.anyOf.map(sketch).join(" or ");
6518
+ switch (schema.type) {
6519
+ case "boolean":
6520
+ return schema.const === undefined ? "<true or false>" : String(schema.const);
6521
+ case "string":
6522
+ if (schema.const !== undefined)
6523
+ return shown(schema.const);
6524
+ return schema.enum === undefined ? '"<text>"' : schema.enum.map(shown).join(" or ");
6525
+ case "integer":
6526
+ return schema.const === undefined ? "<integer>" : String(schema.const);
6527
+ case "array":
6528
+ return `[${sketch(schema.items)}, \u2026]`;
6529
+ case "object":
6530
+ return `{${Object.entries(schema.properties).map(([key, field]) => `${shown(key)}${schema.required.includes(key) ? "" : "?"}:${sketch(field)}`).join(",")}}`;
6531
+ }
6532
+ };
6533
+ var answerAccepts = (declared) => {
6534
+ const read = decodeAnswerSchema(declared);
6535
+ if ("problem" in read)
6536
+ return "JSON its schema accepts";
6537
+ const described = read.schema.description?.trim();
6538
+ return redactCredentialText(described === undefined || described === "" ? `JSON like ${sketch(read.schema)}` : described);
6539
+ };
6540
+ var answerProblem = (schema, answer) => {
6541
+ const decoded = decodeJsonStringOption(answer);
6542
+ const problem = decoded._tag === "None" ? "The answer is not JSON" : valueProblem(schema, decoded.value, "");
6543
+ return problem === undefined ? undefined : redactCredentialText(`${problem}. It accepts ${answerAccepts(schema)}`);
6544
+ };
6545
+ var answerValue = (schema, answer) => {
6546
+ const decoded = decodeJsonStringOption(answer);
6547
+ return decoded._tag === "Some" && valueProblem(schema, decoded.value, "") === undefined ? { value: decoded.value } : undefined;
6548
+ };
6549
+
6380
6550
  // packages/core/src/loop.ts
6381
6551
  var LoopStatuses = ["draft", "active", "disabled", "archived"];
6382
6552
  var LoopStepImplementationKinds = [
@@ -6603,6 +6773,7 @@ var LoopSafeInternalReferenceString = String4.check(isMinLength(1), isMaxLength(
6603
6773
  var loopSafeTextMaxLength = 4000;
6604
6774
  var LoopSafeText = String4.check(isMaxLength(loopSafeTextMaxLength), isPattern(new RegExp(`^(?![\\s\\S]*(?:${LoopCredentialContentPattern}|[A-Za-z][A-Za-z0-9+.-]*://(?:[^\\s/?#]*@|[^\\s?#]*\\?)))[\\s\\S]*$`, "u")));
6605
6775
  var recommendedDefault = (recommended) => recommended !== undefined && is(LoopSafeText)(recommended) ? recommended : undefined;
6776
+ var isLoopSafeText = is(LoopSafeText);
6606
6777
  var reportedModelName = (named) => /^[A-Za-z0-9][\w.:/@+[\]-]{0,199}$/u.test(named) && is(LoopSafeText)(named) && redactCredentialText(named) === named ? named : undefined;
6607
6778
  var QuestionText = String4;
6608
6779
  var LoopSafeOutputDataString = String4.check(isMaxLength(4000), isPattern(new RegExp(LoopSafeInternalReferencePattern, "u")));
@@ -7216,6 +7387,7 @@ var Question = Struct({
7216
7387
  prompt: QuestionText,
7217
7388
  options: optionalKey(ArraySchema(QuestionText)),
7218
7389
  freeText: optionalKey(Boolean2),
7390
+ answerSchema: optionalKey(AnswerSchemaJson),
7219
7391
  optionDescriptions: optionalKey(Record(String4, QuestionText)),
7220
7392
  recommended: optionalKey(QuestionText),
7221
7393
  recommendationReason: optionalKey(QuestionText),
@@ -15993,6 +16165,7 @@ class RunnerCapabilityRpcs extends make6(make5("PutQuestion", {
15993
16165
  step: String4,
15994
16166
  prompt: String4,
15995
16167
  options: optional(ArraySchema(String4)),
16168
+ answerSchema: optional(AnswerSchemaJson),
15996
16169
  optionDescriptions: optional(Record(String4, String4)),
15997
16170
  recommended: optional(String4),
15998
16171
  recommendationReason: optional(String4),
@@ -17888,4 +18061,4 @@ function serviceChecks(declaration) {
17888
18061
  return decoded === undefined || decoded.services.length === 0 ? [] : [...new Set(decoded.checks ?? [])];
17889
18062
  }
17890
18063
 
17891
- export { WebCrypto, SecureRandom, layerWebCrypto, makeUnsafe, formatIso, empty, fromInput, merge, runMain, layer, layer2, Stdio, Terminal, layer3, error, log, toDate, parseDate, toIso, currentDate, wallClockMillis, waitingOnWords, queueWords, scanDurableSurface, redactResponseSurface, redactCredentials, redactedOutputTail, ReleaseChannels, DefaultReleaseChannel, newerKitmanVersion, releaseChannelOffers, AgentHarnessIds, AgentSkillRequirement, AgentMcpServerRequirement, AgentEnvironmentFragment, findForbiddenAgentEnvironmentSecretPath, NetworkHost, RepoBindingProviders, RepoBindingCredentialProviderTypes, RepoBindingProvider, findForbiddenRepoBindingSecretPath, releaseVersion, ReleaseScope, isBranchName, baseBranchLayerWords, repositoryKey, loopInputFields, InputSourceLayers, InputSource, inputSourceWords, runnerAgentSandboxPolicy, agentNetworkAllowlist, verificationNetworkAllowlist, programNetworkHosts, ContextPackModes, DefaultContextPackMode, ProposalStatuses, ProposalTargetTypes, canonicalJson, canonicalSha256, tokensSpent, tokenCountWords, endsFailing, outlineText, anyFailure, goesOn, outlineMermaid, runOutlineText, isTestReportName, testDigest, failedTestOfLine, printedNotReported, failedTestsOf, testOutcomes, checkTests, loopSafeTextMaxLength, recommendedDefault, reportedModelName, RunDisplayStates, RunWaitUntils, calverNumbers, compareCalver, DeliveryMode, defaultDeployCommand, ProgramWorkUnit, MeasureSample, MeasureEvidence, TagVersions, compareCommitMax, commitMessageMax, commandTimeoutMillisDefault, commandTextLimit, catchUpPathLimit, CatchUp, RunnerOwnership, RunnerExecutionBackend, verificationCap, PinnedImage, RunnerSettings, RunnerSettingNames, RunnerSettingsUpdate, defaultRunnerSettings, shownRunnerSetting, defaultRunnerCapabilities, deliveryProviderActions, MemoryStatuses, MemoryScopes, MaxMemoryListLimit, DecisionStatuses, Session, SessionEnd, SessionUpdate, SessionUpdateCreate, FixFlowRecoveryActions, KitmanAgentCapabilityNames, sha2562, DeployTargetName, DeployRef, DeployStatus, runsDeployedTag, Deploy, DeployTargetRunning, isRunFileRefusalReason, runFileRefusalWords, RunFileRefused, runFileContentType, ClaimResult, mergeTurnResource, createId, digestSha256, digestSha512, digestWith, sha256Hasher, AgentEvent, raw, make4, get, post, put, setHeaders, acceptJson, bodyUint8Array, bodyJsonUnsafe, bodyUrlParams, schemaBodyJson, filterStatusOk, HttpClient, execute, get2, Fetch, layer4, Socket, SocketReadError, SocketError, WebSocketConstructor, layerWebSocketConstructorGlobal, layerWebSocket, runDisplayLabels, listedSummary, stepFallbackWords, runTicketsPayload, runTicketResult, ticketOutcomeLabels, runGraphLayout, KitDigest, defaultKitName, LoopCapabilities, LoopManifest, CallableLoop, AgentDeclaration, StepManifest, KitDeclarations, KitSetup, SetupArchive, kitMcpSecretNames, kitmanMcpServer, KitmanClientError, KitmanEffectClient, CliError, DefaultApiUrl, resolveConfig, apiUrlFromEnv, stepCredentialFromEnv, stepWorkspaceFromEnv, stepLogDirFromEnv, stepSkillsDirFromEnv, stepFittingSkillsFromEnv, stepOutputOnlyFromEnv, mcpCredentialNameFromEnv, userConfigPath, userAuthPath, userHarnessSyncPath, kitSetupCacheDir, bundleCacheDir, runnerReleaseChannelPath, localConfigPath, readUserConfig, writeUserConfig, sessionForApi, readAuthStore, storeSession, removeSession, removeAllSessions, agentCredentialForApi, storeAgentCredential, removeAgentCredential, normalizeApiUrl, isStoredAgentCredential, isStreamSchema, getStreamSchemas, make5, exitSchema, ParseOptions, RpcClientDefect, RpcClientError, make6, Service, RunnerHeaders, RunnerRpcProtocolVersion, RunnerRpcError, WorkAvailable, RunSettled, UpdateAvailable, RunnerReplicaRpcs, RunnerRunFileRpcs, ProgramRpcs, parseCallbackUrl, revokeToken, toStoredSession, browserLogin, openBrowser, shouldRefresh, createSdkClient, refreshSession, AgentAuthClientError, executeAgentCapability, createAgentAuthBearerToken, McpPlatformLive, runMcpEffect, createAgentAuthSignedFetch, setupMcpAgentCredential, generateAgentKeyPair, HERDR_CORE_GENERATION2, HERDR_CORE_INSTALL_COMMAND2, HerdrCoreMissing2, HerdrCoreIncompatible2, HerdrCoreConnectionLost2, HerdrCoreRpcError2, HerdrCoreUpdateFailed2, HerdrCore2, herdrCoreLayer2, herdrCoreTransportLayer2, updateHerdrCore2, CommandFailed2, runCommand2, withoutPreloads2, shellOutputTailChars2, runProcess2, CommandRunner2, runShell2, detectHarnesses2, kitHarnesses, isKitHarness, instructionsStart, instructionsEnd, harnessNames, renderMcpServer, antigravityPlugins, materializeKitSetup, tomlInline, herdrExecutionExtension2, herdrNativeExtensionIds2, herdrRunnerCapabilitiesForRepoBinding2, herdrRunnerCapabilities2, assertHerdrRunnerCapability2, declaredChecks, installCommand, checkServicesFile, checkServices, serviceChecks };
18064
+ export { WebCrypto, SecureRandom, layerWebCrypto, makeUnsafe, formatIso, empty, fromInput, merge, runMain, layer, layer2, Stdio, Terminal, layer3, error, log, toDate, parseDate, toIso, currentDate, wallClockMillis, waitingOnWords, queueWords, scanDurableSurface, redactResponseSurface, redactCredentials, redactedOutputTail, ReleaseChannels, DefaultReleaseChannel, newerKitmanVersion, releaseChannelOffers, AgentHarnessIds, AgentSkillRequirement, AgentMcpServerRequirement, AgentEnvironmentFragment, findForbiddenAgentEnvironmentSecretPath, NetworkHost, RepoBindingProviders, RepoBindingCredentialProviderTypes, RepoBindingProvider, findForbiddenRepoBindingSecretPath, releaseVersion, ReleaseScope, isBranchName, baseBranchLayerWords, repositoryKey, loopInputFields, InputSourceLayers, InputSource, inputSourceWords, runnerAgentSandboxPolicy, agentNetworkAllowlist, verificationNetworkAllowlist, programNetworkHosts, ContextPackModes, DefaultContextPackMode, ProposalStatuses, ProposalTargetTypes, canonicalJson, canonicalSha256, tokensSpent, tokenCountWords, endsFailing, outlineText, anyFailure, goesOn, outlineMermaid, runOutlineText, isTestReportName, testDigest, failedTestOfLine, printedNotReported, failedTestsOf, testOutcomes, checkTests, decodeAnswerSchema, answerAccepts, answerProblem, answerValue, loopSafeTextMaxLength, recommendedDefault, isLoopSafeText, reportedModelName, RunDisplayStates, RunWaitUntils, calverNumbers, compareCalver, DeliveryMode, defaultDeployCommand, ProgramWorkUnit, MeasureSample, MeasureEvidence, TagVersions, compareCommitMax, commitMessageMax, commandTimeoutMillisDefault, commandTextLimit, catchUpPathLimit, CatchUp, RunnerOwnership, RunnerExecutionBackend, verificationCap, PinnedImage, RunnerSettings, RunnerSettingNames, RunnerSettingsUpdate, defaultRunnerSettings, shownRunnerSetting, defaultRunnerCapabilities, deliveryProviderActions, MemoryStatuses, MemoryScopes, MaxMemoryListLimit, DecisionStatuses, Session, SessionEnd, SessionUpdate, SessionUpdateCreate, FixFlowRecoveryActions, KitmanAgentCapabilityNames, sha2562, DeployTargetName, DeployRef, DeployStatus, runsDeployedTag, Deploy, DeployTargetRunning, isRunFileRefusalReason, runFileRefusalWords, RunFileRefused, runFileContentType, ClaimResult, mergeTurnResource, createId, digestSha256, digestSha512, digestWith, sha256Hasher, AgentEvent, raw, make4, get, post, put, setHeaders, acceptJson, bodyUint8Array, bodyJsonUnsafe, bodyUrlParams, schemaBodyJson, filterStatusOk, HttpClient, execute, get2, Fetch, layer4, Socket, SocketReadError, SocketError, WebSocketConstructor, layerWebSocketConstructorGlobal, layerWebSocket, runDisplayLabels, listedSummary, stepFallbackWords, runTicketsPayload, runTicketResult, ticketOutcomeLabels, runGraphLayout, KitDigest, defaultKitName, LoopCapabilities, LoopManifest, CallableLoop, AgentDeclaration, StepManifest, KitDeclarations, KitSetup, SetupArchive, kitMcpSecretNames, kitmanMcpServer, KitmanClientError, KitmanEffectClient, CliError, DefaultApiUrl, resolveConfig, apiUrlFromEnv, stepCredentialFromEnv, stepWorkspaceFromEnv, stepLogDirFromEnv, stepSkillsDirFromEnv, stepFittingSkillsFromEnv, stepOutputOnlyFromEnv, mcpCredentialNameFromEnv, userConfigPath, userAuthPath, userHarnessSyncPath, kitSetupCacheDir, bundleCacheDir, runnerReleaseChannelPath, localConfigPath, readUserConfig, writeUserConfig, sessionForApi, readAuthStore, storeSession, removeSession, removeAllSessions, agentCredentialForApi, storeAgentCredential, removeAgentCredential, normalizeApiUrl, isStoredAgentCredential, isStreamSchema, getStreamSchemas, make5, exitSchema, ParseOptions, RpcClientDefect, RpcClientError, make6, Service, RunnerHeaders, RunnerRpcProtocolVersion, RunnerRpcError, WorkAvailable, RunSettled, UpdateAvailable, RunnerReplicaRpcs, RunnerRunFileRpcs, ProgramRpcs, parseCallbackUrl, revokeToken, toStoredSession, browserLogin, openBrowser, shouldRefresh, createSdkClient, refreshSession, AgentAuthClientError, executeAgentCapability, createAgentAuthBearerToken, McpPlatformLive, runMcpEffect, createAgentAuthSignedFetch, setupMcpAgentCredential, generateAgentKeyPair, HERDR_CORE_GENERATION2, HERDR_CORE_INSTALL_COMMAND2, HerdrCoreMissing2, HerdrCoreIncompatible2, HerdrCoreConnectionLost2, HerdrCoreRpcError2, HerdrCoreUpdateFailed2, HerdrCore2, herdrCoreLayer2, herdrCoreTransportLayer2, updateHerdrCore2, CommandFailed2, runCommand2, withoutPreloads2, shellOutputTailChars2, runProcess2, CommandRunner2, runShell2, detectHarnesses2, kitHarnesses, isKitHarness, instructionsStart, instructionsEnd, harnessNames, renderMcpServer, antigravityPlugins, materializeKitSetup, tomlInline, herdrExecutionExtension2, herdrNativeExtensionIds2, herdrRunnerCapabilitiesForRepoBinding2, herdrRunnerCapabilities2, assertHerdrRunnerCapability2, declaredChecks, installCommand, checkServicesFile, checkServices, serviceChecks };
@@ -4,9 +4,9 @@ import {
4
4
  opaqueTunnelRefusal2,
5
5
  isOpaqueConnectReason2,
6
6
  runSrtStep2
7
- } from "./chunk-n3jpxd14.js";
8
- import"./chunk-4vxbxjf8.js";
9
- import"./chunk-k462v2v7.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,
@@ -25,21 +25,21 @@ import {
25
25
  isString2,
26
26
  encodePrettyJsonString,
27
27
  decodeJsonStringSync
28
- } from "./chunk-k462v2v7.js";
28
+ } from "./chunk-n381rqax.js";
29
29
  import {
30
30
  FileSystem,
31
31
  Path,
32
32
  optionalEnv,
33
33
  tempDirectoryScoped
34
- } from "./chunk-5smh4dp2.js";
34
+ } from "./chunk-2xeq2a7j.js";
35
35
  import {
36
36
  AgentHarnessIds,
37
37
  sha2562,
38
38
  runCommand2
39
- } from "./chunk-69y8j7fs.js";
39
+ } from "./chunk-pty4b78m.js";
40
40
  import {
41
41
  NpmRegistry
42
- } from "./chunk-es6rnmyw.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-fqh4pj6b.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-69y8j7fs.js";
16
- import"./chunk-5smh4dp2.js";
17
- import"./chunk-k462v2v7.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-qzwsh96c.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-0dfg674z.js";
8
- import"./chunk-f957cxrx.js";
9
- import"./chunk-69y8j7fs.js";
10
- import"./chunk-4vxbxjf8.js";
11
- import"./chunk-5smh4dp2.js";
12
- import"./chunk-k462v2v7.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,8 +137,9 @@ import {
137
137
  TaggedError2,
138
138
  toJsonSchemaDocument,
139
139
  toCodecJson,
140
- Json
141
- } from "./chunk-k462v2v7.js";
140
+ Json,
141
+ encodeUnknownJsonStringSync
142
+ } from "./chunk-n381rqax.js";
142
143
  import {
143
144
  WebCrypto,
144
145
  makeUnsafe,
@@ -146,7 +147,11 @@ import {
146
147
  RepoBindingProvider,
147
148
  releaseVersion,
148
149
  ReleaseScope,
150
+ decodeAnswerSchema,
151
+ answerProblem,
152
+ answerValue,
149
153
  recommendedDefault,
154
+ isLoopSafeText,
150
155
  DeliveryMode,
151
156
  ProgramWorkUnit,
152
157
  MeasureEvidence,
@@ -175,24 +180,24 @@ import {
175
180
  StepManifest,
176
181
  KitSetup,
177
182
  RunnerRpcError
178
- } from "./chunk-69y8j7fs.js";
183
+ } from "./chunk-pty4b78m.js";
179
184
  import {
180
185
  currentTimeMillis,
181
186
  getCurrent,
182
187
  runForEach,
183
188
  FileSystem
184
- } from "./chunk-5smh4dp2.js";
189
+ } from "./chunk-2xeq2a7j.js";
185
190
  import {
186
191
  splitQuestionOptions,
187
192
  recommendationProblem,
188
193
  questionAdvice
189
- } from "./chunk-9ykh05hz.js";
194
+ } from "./chunk-k1fdsn2c.js";
190
195
  import {
191
196
  guard,
192
197
  Id,
193
198
  Timestamp,
194
199
  ActorType
195
- } from "./chunk-4vxbxjf8.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-a71b15k3.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-5pjbxhxy.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-tfwgeqx5.js");
14
+ const { runOpencodeReader } = await import("./chunk-mxy4wzhs.js");
15
15
  runOpencodeReader();
16
16
  } else {
17
- const { runCli } = await import("./chunk-9qvgbp6k.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.45.0",
3
+ "version": "0.46.0",
4
4
  "type": "module",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "bin": {