@kitman-sh/cli 0.11.6 → 0.12.0-rc.1

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.
@@ -253,6 +253,7 @@ import {
253
253
  import {
254
254
  map,
255
255
  makeEquivalence,
256
+ toNumber,
256
257
  bytes,
257
258
  BadArgument,
258
259
  systemError,
@@ -316,7 +317,7 @@ import {
316
317
  String2,
317
318
  optionalEnv,
318
319
  harnessesUnsupportedInSrt2
319
- } from "./chunk-3d4d52e5.js";
320
+ } from "./chunk-0b93nv6j.js";
320
321
  import {
321
322
  isDateTime,
322
323
  Numeric,
@@ -357,7 +358,7 @@ import {
357
358
  make3,
358
359
  parseFdName,
359
360
  fdName
360
- } from "./chunk-sk6ceghr.js";
361
+ } from "./chunk-2qarscbj.js";
361
362
 
362
363
  // node_modules/.bun/effect@4.1.2/node_modules/effect/dist/Tuple.js
363
364
  var makeEquivalence3 = Tuple;
@@ -899,15 +900,6 @@ var runMain2 = /* @__PURE__ */ makeRunMain(({
899
900
  // node_modules/.bun/@effect+platform-bun@4.1.2+edf248c88a527e3e/node_modules/@effect/platform-bun/dist/BunRuntime.js
900
901
  var runMain = runMain2;
901
902
 
902
- // node_modules/.bun/effect@4.1.2/node_modules/effect/dist/BigInt.js
903
- var BigInt2 = globalThis.BigInt;
904
- var toNumber = (b) => {
905
- if (b > BigInt2(Number.MAX_SAFE_INTEGER) || b < BigInt2(Number.MIN_SAFE_INTEGER)) {
906
- return none();
907
- }
908
- return some(Number(b));
909
- };
910
-
911
903
  // node_modules/.bun/effect@4.1.2/node_modules/effect/dist/DateTime.js
912
904
  var makeUnsafe = makeUnsafe6;
913
905
  var make18 = make4;
@@ -5538,6 +5530,17 @@ var LoopLayers = ["team", "workspace"];
5538
5530
  var AgentEfforts = ["low", "medium", "high", "xhigh"];
5539
5531
  var AgentCapabilities = ["web", "subagents", "artifacts", "browser"];
5540
5532
 
5533
+ // packages/core/src/tokens.ts
5534
+ var TokenCount = Int.check(isGreaterThanOrEqualTo(0));
5535
+ var TokenUsage = Struct({ input: TokenCount, output: TokenCount, cached: TokenCount });
5536
+ var AttemptTokens = Union([TokenUsage, Literal("none")]);
5537
+ var sum = (usages) => usages.length === 0 ? undefined : usages.reduce((total, usage) => ({
5538
+ input: total.input + usage.input,
5539
+ output: total.output + usage.output,
5540
+ cached: total.cached + usage.cached
5541
+ }));
5542
+ var tokensSpent = (attempts) => sum(attempts.filter((tokens) => tokens !== undefined && tokens !== "none"));
5543
+
5541
5544
  // packages/core/src/loop.ts
5542
5545
  var LoopStatuses = ["draft", "active", "disabled", "archived"];
5543
5546
  var LoopStepImplementationKinds = [
@@ -6427,8 +6430,10 @@ var RunStepSummary = Struct({
6427
6430
  status: StepAttemptStatus,
6428
6431
  failureSummary: optionalKey(String4),
6429
6432
  output: optionalKey(Unknown),
6430
- revision: optionalKey(String4)
6431
- }))
6433
+ revision: optionalKey(String4),
6434
+ tokens: optionalKey(AttemptTokens)
6435
+ })),
6436
+ tokens: optionalKey(TokenUsage)
6432
6437
  });
6433
6438
  var RunSteerDeliveries = ["queued", "delivered", "failed"];
6434
6439
  var RunSteer = Struct({
@@ -6539,7 +6544,8 @@ var RunShow = Struct({
6539
6544
  evidence: ArraySchema(RunEvidence),
6540
6545
  steers: ArraySchema(RunSteer),
6541
6546
  waiting: ArraySchema(RunWaiting),
6542
- closures: ArraySchema(RunClosure)
6547
+ closures: ArraySchema(RunClosure),
6548
+ tokens: optionalKey(TokenUsage)
6543
6549
  });
6544
6550
  var RunStartPreview = Struct({
6545
6551
  loop: Struct({ id: String4, title: String4, outcome: optionalKey(String4) }),
@@ -6917,7 +6923,8 @@ var WorkUnitHeartbeatResult = Struct({
6917
6923
  var WorkUnitReleaseInput = Struct({
6918
6924
  workUnitId: Id,
6919
6925
  lease: WorkUnitLeaseInput,
6920
- crashed: optionalKey(Struct({ reason: String4.check(isMinLength(1), isMaxLength(500)) }))
6926
+ crashed: optionalKey(Struct({ reason: String4.check(isMinLength(1), isMaxLength(500)) })),
6927
+ tokens: optionalKey(AttemptTokens)
6921
6928
  });
6922
6929
  var CheckEvidence = Struct({
6923
6930
  name: String4.check(isMinLength(1), isMaxLength(120)),
@@ -6987,6 +6994,7 @@ var WorkUnitOutcome = Struct({
6987
6994
  cleanSync: optionalKey(Literals(["up_to_date", "merged"])),
6988
6995
  harnessHold: optionalKey(HarnessHold),
6989
6996
  restart: optionalKey(StepRestart),
6997
+ tokens: optionalKey(AttemptTokens),
6990
6998
  failureSummary: optionalKey(String4.check(isMinLength(1), isMaxLength(4000)))
6991
6999
  });
6992
7000
  var WorkUnitCompletion = Struct({
@@ -16007,4 +16015,4 @@ function checkServices(declaration) {
16007
16015
  return isSome(decoded) ? [...new Set(decoded.value.services)] : undefined;
16008
16016
  }
16009
16017
 
16010
- export { Clock, currentTimeMillis, 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, SafeJson, AgentHarnessIds, AgentSkillRequirement, AgentMcpServerRequirement, AgentEnvironmentFragment, findForbiddenAgentEnvironmentSecretPath, NetworkHost, RepoBindingProviders, RepoBindingCredentialProviderTypes, findForbiddenRepoBindingSecretPath, AgentSandboxNetwork, runnerAgentSandboxPolicy, agentNetworkAllowlist, verificationNetworkAllowlist, programNetworkHosts, ContextPackModes, DefaultContextPackMode, ProposalStatuses, ProposalTargetTypes, canonicalJson, canonicalSha256, AgentEfforts, AgentCapabilities, LoopDataSchemaRef, RunDisplayStates, LoopVersion, ProgramLoop, AgentFallback, RunWaitUntils, isTestReportName, checkTests, ProgramWorkUnit, MeasureSample, MeasureEvidence, catchUpPathLimit, CatchUp, RunnerOwnership, RunnerExecutionBackend, MaxRunnerConcurrency, PinnedImage, RunnerSettingNames, RunnerSettingsUpdate, defaultRunnerSettings, shownRunnerSetting, defaultRunnerCapabilities, deliveryProviderActions, newerKitmanVersion, MemoryStatuses, MemoryScopes, MaxMemoryListLimit, DecisionStatuses, Session, SessionEnd, SessionUpdate, SessionUpdateCreate, FixFlowRecoveryActions, KitmanAgentCapabilityNames, sha2562, isRunFileRefusalReason, runFileRefusalWords, RunFileRefused, runFileContentType, repositoryKey, createId, digestSha256, digestSha512, digestWith, sha256Hasher, AgentEvent, raw, make5, get, post, put, setHeaders, acceptJson, bodyUint8Array, bodyJsonUnsafe, bodyUrlParams, schemaBodyJson, filterStatusOk, HttpClient, execute, get2, Fetch, layer4, Socket, SocketReadError, SocketError, WebSocketConstructor, layerWebSocketConstructorGlobal, layerWebSocket, runDisplayLabels, listedSummary, KitName, KitDigest, defaultKitName, KitSetup, SetupArchive, kitMcpSecretNames, kitmanMcpServer, KitmanClientError, KitmanEffectClient, CliError, DefaultApiUrl, resolveConfig, apiUrlFromEnv, stepCredentialFromEnv, stepWorkspaceFromEnv, stepSkillsDirFromEnv, stepFittingSkillsFromEnv, stepOutputOnlyFromEnv, mcpCredentialNameFromEnv, userConfigPath, userAuthPath, userHarnessSyncPath, kitSetupCacheDir, bundleCacheDir, localConfigPath, readUserConfig, writeUserConfig, sessionForApi, readAuthStore, storeSession, removeSession, removeAllSessions, agentCredentialForApi, storeAgentCredential, removeAgentCredential, normalizeApiUrl, isStoredAgentCredential, isStreamSchema, getStreamSchemas, make6, exitSchema, ParseOptions, RpcClientDefect, RpcClientError, make7, Service, RunnerHeaders, RunnerRpcProtocolVersion, RunnerRpcError, 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, materializeKitSetup, tomlInline, herdrExecutionExtension2, herdrNativeExtensionIds2, herdrRunnerCapabilitiesForRepoBinding2, herdrRunnerCapabilities2, assertHerdrRunnerCapability2, declaredChecks, installCommand, checkServicesFile, checkServices };
16018
+ export { Clock, currentTimeMillis, 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, SafeJson, AgentHarnessIds, AgentSkillRequirement, AgentMcpServerRequirement, AgentEnvironmentFragment, findForbiddenAgentEnvironmentSecretPath, NetworkHost, RepoBindingProviders, RepoBindingCredentialProviderTypes, findForbiddenRepoBindingSecretPath, AgentSandboxNetwork, runnerAgentSandboxPolicy, agentNetworkAllowlist, verificationNetworkAllowlist, programNetworkHosts, ContextPackModes, DefaultContextPackMode, ProposalStatuses, ProposalTargetTypes, canonicalJson, canonicalSha256, AgentEfforts, AgentCapabilities, tokensSpent, LoopDataSchemaRef, RunDisplayStates, LoopVersion, ProgramLoop, AgentFallback, RunWaitUntils, isTestReportName, checkTests, ProgramWorkUnit, MeasureSample, MeasureEvidence, catchUpPathLimit, CatchUp, RunnerOwnership, RunnerExecutionBackend, MaxRunnerConcurrency, PinnedImage, RunnerSettingNames, RunnerSettingsUpdate, defaultRunnerSettings, shownRunnerSetting, defaultRunnerCapabilities, deliveryProviderActions, newerKitmanVersion, MemoryStatuses, MemoryScopes, MaxMemoryListLimit, DecisionStatuses, Session, SessionEnd, SessionUpdate, SessionUpdateCreate, FixFlowRecoveryActions, KitmanAgentCapabilityNames, sha2562, isRunFileRefusalReason, runFileRefusalWords, RunFileRefused, runFileContentType, repositoryKey, createId, digestSha256, digestSha512, digestWith, sha256Hasher, AgentEvent, raw, make5, get, post, put, setHeaders, acceptJson, bodyUint8Array, bodyJsonUnsafe, bodyUrlParams, schemaBodyJson, filterStatusOk, HttpClient, execute, get2, Fetch, layer4, Socket, SocketReadError, SocketError, WebSocketConstructor, layerWebSocketConstructorGlobal, layerWebSocket, runDisplayLabels, listedSummary, KitName, KitDigest, defaultKitName, KitSetup, SetupArchive, kitMcpSecretNames, kitmanMcpServer, KitmanClientError, KitmanEffectClient, CliError, DefaultApiUrl, resolveConfig, apiUrlFromEnv, stepCredentialFromEnv, stepWorkspaceFromEnv, stepSkillsDirFromEnv, stepFittingSkillsFromEnv, stepOutputOnlyFromEnv, mcpCredentialNameFromEnv, userConfigPath, userAuthPath, userHarnessSyncPath, kitSetupCacheDir, bundleCacheDir, localConfigPath, readUserConfig, writeUserConfig, sessionForApi, readAuthStore, storeSession, removeSession, removeAllSessions, agentCredentialForApi, storeAgentCredential, removeAgentCredential, normalizeApiUrl, isStoredAgentCredential, isStreamSchema, getStreamSchemas, make6, exitSchema, ParseOptions, RpcClientDefect, RpcClientError, make7, Service, RunnerHeaders, RunnerRpcProtocolVersion, RunnerRpcError, 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, materializeKitSetup, tomlInline, herdrExecutionExtension2, herdrNativeExtensionIds2, herdrRunnerCapabilitiesForRepoBinding2, herdrRunnerCapabilities2, assertHerdrRunnerCapability2, declaredChecks, installCommand, checkServicesFile, checkServices };
@@ -28,7 +28,7 @@ import {
28
28
  import {
29
29
  withDefault,
30
30
  String2
31
- } from "./chunk-3d4d52e5.js";
31
+ } from "./chunk-0b93nv6j.js";
32
32
  import {
33
33
  digestSha256,
34
34
  digestSha512,
@@ -38,7 +38,7 @@ import {
38
38
  get2,
39
39
  layer4,
40
40
  KitDigest
41
- } from "./chunk-vxftwsbn.js";
41
+ } from "./chunk-dc57c8s5.js";
42
42
 
43
43
  // packages/core/src/npm-registry.ts
44
44
  var KitManifest = Struct({
@@ -9,7 +9,7 @@ import {
9
9
  } from "./chunk-vtfwjhzh.js";
10
10
  import {
11
11
  runForEach
12
- } from "./chunk-3d4d52e5.js";
12
+ } from "./chunk-0b93nv6j.js";
13
13
  import {
14
14
  WebSocketConstructor,
15
15
  layerWebSocketConstructorGlobal,
@@ -19,13 +19,13 @@ import {
19
19
  RunnerReplicaRpcs,
20
20
  RunnerRunFileRpcs,
21
21
  ProgramRpcs
22
- } from "./chunk-vxftwsbn.js";
22
+ } from "./chunk-dc57c8s5.js";
23
23
  import {
24
24
  layerJson,
25
25
  make4,
26
26
  withHeaders,
27
27
  layerProtocolSocket
28
- } from "./chunk-wf6hts0g.js";
28
+ } from "./chunk-rm3vqk5d.js";
29
29
 
30
30
  // packages/live/src/rpc/runner-client.ts
31
31
  var proxiedWebSocket = (proxy) => succeed5(WebSocketConstructor)((target) => {
@@ -1,4 +1,9 @@
1
1
  // @bun
2
+ import {
3
+ make11,
4
+ runForEach,
5
+ compiled2
6
+ } from "./chunk-0b93nv6j.js";
2
7
  import {
3
8
  getOrUndefined,
4
9
  liftThrowable,
@@ -28,15 +33,10 @@ import {
28
33
  isJsonObject,
29
34
  isString
30
35
  } from "./chunk-c6rbt85q.js";
31
- import {
32
- make11,
33
- runForEach,
34
- compiled2
35
- } from "./chunk-3d4d52e5.js";
36
36
  import {
37
37
  ChildProcessSpawner,
38
38
  make3
39
- } from "./chunk-sk6ceghr.js";
39
+ } from "./chunk-2qarscbj.js";
40
40
 
41
41
  // packages/agent-runtime/src/opencode-store.ts
42
42
  import { lstatSync, readFileSync, realpathSync } from "fs";
@@ -1,4 +1,8 @@
1
1
  // @bun
2
+ import {
3
+ FileSystem,
4
+ Path
5
+ } from "./chunk-0b93nv6j.js";
2
6
  import {
3
7
  isObject2,
4
8
  isUint8Array,
@@ -17,25 +21,21 @@ import"./chunk-0qz10ek8.js";
17
21
  import {
18
22
  isJsonObject
19
23
  } from "./chunk-c6rbt85q.js";
20
- import {
21
- FileSystem,
22
- Path
23
- } from "./chunk-3d4d52e5.js";
24
24
  import {
25
25
  tomlTableHeader2,
26
26
  tomlKeyPath2,
27
27
  kitmanSkillEntry,
28
28
  isPathWithin2
29
- } from "./chunk-7ww1ztjr.js";
29
+ } from "./chunk-1sy32p83.js";
30
30
  import {
31
31
  instructionsStart,
32
32
  instructionsEnd,
33
33
  renderMcpServer,
34
34
  materializeKitSetup,
35
35
  tomlInline
36
- } from "./chunk-vxftwsbn.js";
37
- import"./chunk-yz9mt7sj.js";
38
- import"./chunk-sk6ceghr.js";
36
+ } from "./chunk-dc57c8s5.js";
37
+ import"./chunk-ejhfa1t6.js";
38
+ import"./chunk-2qarscbj.js";
39
39
 
40
40
  // packages/agent-runtime/src/kit-setup-sync.ts
41
41
  class KitSyncError extends TaggedError("KitSyncError") {
@@ -108,7 +108,7 @@ import {
108
108
  shutdownUnsafe,
109
109
  fromQueue,
110
110
  unwrap
111
- } from "./chunk-3d4d52e5.js";
111
+ } from "./chunk-0b93nv6j.js";
112
112
  import {
113
113
  Clock,
114
114
  empty,
@@ -123,7 +123,7 @@ import {
123
123
  ParseOptions,
124
124
  RpcClientDefect,
125
125
  RpcClientError
126
- } from "./chunk-vxftwsbn.js";
126
+ } from "./chunk-dc57c8s5.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")) {
@@ -76,6 +76,10 @@ import {
76
76
  toCodecJson,
77
77
  Json
78
78
  } from "./chunk-vtfwjhzh.js";
79
+ import {
80
+ runForEach,
81
+ FileSystem
82
+ } from "./chunk-0b93nv6j.js";
79
83
  import {
80
84
  guard
81
85
  } from "./chunk-0qz10ek8.js";
@@ -105,11 +109,7 @@ import {
105
109
  KitDigest,
106
110
  KitSetup,
107
111
  RunnerRpcError
108
- } from "./chunk-vxftwsbn.js";
109
- import {
110
- runForEach,
111
- FileSystem
112
- } from "./chunk-3d4d52e5.js";
112
+ } from "./chunk-dc57c8s5.js";
113
113
 
114
114
  // node_modules/.bun/effect@4.1.2/node_modules/effect/dist/crypto/internal/webCrypto.js
115
115
  var subtleUnavailable = () => new Error("crypto.subtle is unavailable; browsers expose it only in secure contexts");