@kitman-sh/cli 0.11.5 → 0.11.7

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.
@@ -248,6 +248,15 @@ var makeEquivalence = (equivalence) => {
248
248
  return (self, that) => is(self, that) && is(that, self);
249
249
  };
250
250
 
251
+ // node_modules/.bun/effect@4.1.2/node_modules/effect/dist/BigInt.js
252
+ var BigInt2 = globalThis.BigInt;
253
+ var toNumber = (b) => {
254
+ if (b > BigInt2(Number.MAX_SAFE_INTEGER) || b < BigInt2(Number.MIN_SAFE_INTEGER)) {
255
+ return none();
256
+ }
257
+ return some(Number(b));
258
+ };
259
+
251
260
  // node_modules/.bun/effect@4.1.2/node_modules/effect/dist/ByteSize.js
252
261
  var bigint0 = /* @__PURE__ */ BigInt(0);
253
262
  var bigint1 = /* @__PURE__ */ BigInt(1);
@@ -3552,4 +3561,4 @@ var srtArgv2 = (srtCommand, settingsFile, argv) => [
3552
3561
  ...argv
3553
3562
  ];
3554
3563
 
3555
- export { map, makeEquivalence, bytes, join, interrupt, getCurrent, BadArgument, systemError, badArgument, makeUnsafe2, make8, unbounded, publishUnsafe, make9, bounded, sliding, unbounded2, offer, offerUnsafe, offerAll, fail, failCause, failCauseUnsafe, end, endUnsafe, shutdownUnsafe, take, poll, makeUnsafe3, fromTransform, mapDone, isSink, fromChannel, drain, make10, get3, isStream, fromChannel2, callback, empty2, make11, suspend, fail2, fromQueue, fromPubSub, fromReadableStream, unwrap, map2, tap, drainFork, concat, merge2, filter, catchCause, tapError, mapError, transduce, decodeText, encodeText, splitLines, interruptWhen, ensuring, provideContext, run, runCollect, runFold, runHead, runForEach, runDrain, mkString, mkArrayBuffer, toReadableStreamEffect, FileSystem, make12, FileTypeId, WatchBackend, Path, make13, embeddedFile, extractEmbeddedFile, map3, all, withDefault, option, String2, optionalEnv, operatorConfigHome, harnessesUnsupportedInSrt2, compiled2, pinnedSrtCommand2, pinnedSrtStepCommand2, runSrtCli2, kitmanCacheDirectory2, srtSettings2, srtCacheEnvironment2, srtInheritedEnv2, inheritedEnvironment2, withOnlyEnvironment2, writeSrtSettings2, srtStepArgv2, srtArgv2 };
3564
+ export { map, makeEquivalence, toNumber, bytes, join, interrupt, getCurrent, BadArgument, systemError, badArgument, makeUnsafe2, make8, unbounded, publishUnsafe, make9, bounded, sliding, unbounded2, offer, offerUnsafe, offerAll, fail, failCause, failCauseUnsafe, end, endUnsafe, shutdownUnsafe, take, poll, makeUnsafe3, fromTransform, mapDone, isSink, fromChannel, drain, make10, get3, isStream, fromChannel2, callback, empty2, make11, suspend, fail2, fromQueue, fromPubSub, fromReadableStream, unwrap, map2, tap, drainFork, concat, merge2, filter, catchCause, tapError, mapError, transduce, decodeText, encodeText, splitLines, interruptWhen, ensuring, provideContext, run, runCollect, runFold, runHead, runForEach, runDrain, mkString, mkArrayBuffer, toReadableStreamEffect, FileSystem, make12, FileTypeId, WatchBackend, Path, make13, embeddedFile, extractEmbeddedFile, map3, all, withDefault, option, String2, optionalEnv, operatorConfigHome, harnessesUnsupportedInSrt2, compiled2, pinnedSrtCommand2, pinnedSrtStepCommand2, runSrtCli2, kitmanCacheDirectory2, srtSettings2, srtCacheEnvironment2, srtInheritedEnv2, inheritedEnvironment2, withOnlyEnvironment2, writeSrtSettings2, srtStepArgv2, srtArgv2 };
@@ -4,12 +4,12 @@ import {
4
4
  runnerRpcUrl2,
5
5
  makeRunnerRpcClient2,
6
6
  makeProgramRpcClient2
7
- } from "./chunk-73rctgzy.js";
8
- import"./chunk-k004grgr.js";
9
- import"./chunk-zbdnd7z7.js";
7
+ } from "./chunk-akzke77d.js";
8
+ import"./chunk-f3cbjk00.js";
9
+ import"./chunk-5wvqtbfp.js";
10
10
  import"./chunk-0qz10ek8.js";
11
11
  import"./chunk-c6rbt85q.js";
12
- import"./chunk-3d4d52e5.js";
12
+ import"./chunk-0b93nv6j.js";
13
13
  import"./chunk-vtfwjhzh.js";
14
14
  export {
15
15
  makeProgramRpcClient2 as makeProgramRpcClient,
@@ -31,7 +31,7 @@ import {
31
31
  runCollect,
32
32
  runDrain,
33
33
  mkString
34
- } from "./chunk-3d4d52e5.js";
34
+ } from "./chunk-0b93nv6j.js";
35
35
 
36
36
  // node_modules/.bun/effect@4.1.2/node_modules/effect/dist/internal/redacted.js
37
37
  var redactedRegistry = /* @__PURE__ */ new WeakMap;
@@ -7,10 +7,10 @@ import {
7
7
  decoded2,
8
8
  readOpencode2,
9
9
  runOpencodeReader2
10
- } from "./chunk-vmv7gwwr.js";
11
- import"./chunk-sk6ceghr.js";
10
+ } from "./chunk-kpfrhex3.js";
11
+ import"./chunk-2qarscbj.js";
12
12
  import"./chunk-c6rbt85q.js";
13
- import"./chunk-3d4d52e5.js";
13
+ import"./chunk-0b93nv6j.js";
14
14
  import"./chunk-vtfwjhzh.js";
15
15
  export {
16
16
  decoded2 as decoded,
@@ -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;
@@ -14423,6 +14415,7 @@ class RunnerCapabilityRpcs extends make7(make6("PutQuestion", {
14423
14415
  payload: {
14424
14416
  lease: ProgramLease,
14425
14417
  step: String4,
14418
+ waitsWhenUnconfirmed: optionalKey(Boolean2),
14426
14419
  effect: Union([
14427
14420
  Struct({
14428
14421
  kind: Literal("post_comment"),
@@ -14669,6 +14662,7 @@ class RunnerCapabilityRpcs extends make7(make6("PutQuestion", {
14669
14662
  payload: {
14670
14663
  lease: ProgramLease,
14671
14664
  step: String4,
14665
+ waitsWhenUnconfirmed: optionalKey(Boolean2),
14672
14666
  changeRequestId: String4,
14673
14667
  head: optionalKey(String4),
14674
14668
  rebase: optionalKey(Boolean2)
@@ -14721,6 +14715,7 @@ class RunnerCapabilityRpcs extends make7(make6("PutQuestion", {
14721
14715
  payload: {
14722
14716
  lease: ProgramLease,
14723
14717
  step: String4,
14718
+ waitsWhenUnconfirmed: optionalKey(Boolean2),
14724
14719
  tag: String4,
14725
14720
  revision: optionalKey(String4),
14726
14721
  title: String4,
@@ -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-y78nw5ty.js";
29
+ } from "./chunk-y1rfbqaf.js";
30
30
  import {
31
31
  instructionsStart,
32
32
  instructionsEnd,
33
33
  renderMcpServer,
34
34
  materializeKitSetup,
35
35
  tomlInline
36
- } from "./chunk-zbdnd7z7.js";
37
- import"./chunk-xadtvj2q.js";
38
- import"./chunk-sk6ceghr.js";
36
+ } from "./chunk-5wvqtbfp.js";
37
+ import"./chunk-z2dnw6ey.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") {
@@ -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-zbdnd7z7.js";
22
+ } from "./chunk-5wvqtbfp.js";
23
23
  import {
24
24
  layerJson,
25
25
  make4,
26
26
  withHeaders,
27
27
  layerProtocolSocket
28
- } from "./chunk-k004grgr.js";
28
+ } from "./chunk-f3cbjk00.js";
29
29
 
30
30
  // packages/live/src/rpc/runner-client.ts
31
31
  var proxiedWebSocket = (proxy) => succeed5(WebSocketConstructor)((target) => {
@@ -14,7 +14,7 @@ import {
14
14
  writeSrtSettings2,
15
15
  srtStepArgv2,
16
16
  srtArgv2
17
- } from "./chunk-3d4d52e5.js";
17
+ } from "./chunk-0b93nv6j.js";
18
18
  import"./chunk-vtfwjhzh.js";
19
19
  export {
20
20
  compiled2 as compiled,
@@ -1,4 +1,12 @@
1
1
  // @bun
2
+ import {
3
+ decodeText,
4
+ mkString,
5
+ FileSystem,
6
+ Path,
7
+ withDefault,
8
+ String2
9
+ } from "./chunk-0b93nv6j.js";
2
10
  import {
3
11
  isString2,
4
12
  hasProperty,
@@ -35,14 +43,6 @@ import {
35
43
  } from "./chunk-vtfwjhzh.js";
36
44
  import"./chunk-0qz10ek8.js";
37
45
  import"./chunk-c6rbt85q.js";
38
- import {
39
- decodeText,
40
- mkString,
41
- FileSystem,
42
- Path,
43
- withDefault,
44
- String2
45
- } from "./chunk-3d4d52e5.js";
46
46
  import {
47
47
  SecureRandom,
48
48
  layerWebCrypto,
@@ -54,23 +54,23 @@ import {
54
54
  layer4,
55
55
  kitmanMcpServer,
56
56
  RunnerRpcProtocolVersion
57
- } from "./chunk-zbdnd7z7.js";
57
+ } from "./chunk-5wvqtbfp.js";
58
58
  import {
59
59
  Packument,
60
60
  tarballMatches
61
- } from "./chunk-xadtvj2q.js";
62
- import"./chunk-73rctgzy.js";
61
+ } from "./chunk-z2dnw6ey.js";
62
+ import"./chunk-akzke77d.js";
63
63
  import {
64
64
  AgentDeclaration,
65
65
  KitDeclarations,
66
66
  describeFlag,
67
67
  Described
68
- } from "./chunk-0j0bncss.js";
68
+ } from "./chunk-z9zqctv2.js";
69
69
  import {
70
70
  ChildProcessSpawner,
71
71
  make3
72
- } from "./chunk-sk6ceghr.js";
73
- import"./chunk-k004grgr.js";
72
+ } from "./chunk-2qarscbj.js";
73
+ import"./chunk-f3cbjk00.js";
74
74
 
75
75
  // packages/sdk/src/build/index.ts
76
76
  class DependencyInstallFailed extends TaggedError2()("DependencyInstallFailed", {
@@ -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-zbdnd7z7.js";
126
+ } from "./chunk-5wvqtbfp.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")) {
@@ -159,7 +159,21 @@ import {
159
159
  runMcpEffect,
160
160
  createAgentAuthSignedFetch,
161
161
  setupMcpAgentCredential
162
- } from "./chunk-zbdnd7z7.js";
162
+ } from "./chunk-5wvqtbfp.js";
163
+ import {
164
+ join,
165
+ interrupt,
166
+ runForEach,
167
+ FileSystem,
168
+ Path,
169
+ embeddedFile,
170
+ extractEmbeddedFile,
171
+ map3,
172
+ all,
173
+ withDefault,
174
+ option,
175
+ String2
176
+ } from "./chunk-0b93nv6j.js";
163
177
  import {
164
178
  guard,
165
179
  Id,
@@ -179,20 +193,6 @@ import {
179
193
  isString,
180
194
  kindOf
181
195
  } from "./chunk-c6rbt85q.js";
182
- import {
183
- join,
184
- interrupt,
185
- runForEach,
186
- FileSystem,
187
- Path,
188
- embeddedFile,
189
- extractEmbeddedFile,
190
- map3,
191
- all,
192
- withDefault,
193
- option,
194
- String2
195
- } from "./chunk-3d4d52e5.js";
196
196
  import {
197
197
  nextInt
198
198
  } from "./chunk-nzjb36ad.js";
@@ -202,7 +202,7 @@ import {
202
202
  withHeaders,
203
203
  layerProtocolSocket,
204
204
  ConnectionHooks
205
- } from "./chunk-k004grgr.js";
205
+ } from "./chunk-f3cbjk00.js";
206
206
 
207
207
  // apps/cli/src/mcp.ts
208
208
  import { tmpdir as tmpdir2 } from "os";
@@ -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";
@@ -7,6 +7,46 @@ import {
7
7
  isJsonObject,
8
8
  isString
9
9
  } from "./chunk-c6rbt85q.js";
10
+ import {
11
+ join,
12
+ interrupt,
13
+ unbounded,
14
+ publishUnsafe,
15
+ unbounded2,
16
+ offer,
17
+ makeUnsafe3,
18
+ make11,
19
+ fromQueue,
20
+ fromPubSub,
21
+ map2,
22
+ filter,
23
+ decodeText,
24
+ encodeText,
25
+ splitLines,
26
+ run,
27
+ runHead,
28
+ runForEach,
29
+ FileSystem,
30
+ Path,
31
+ embeddedFile,
32
+ extractEmbeddedFile,
33
+ optionalEnv,
34
+ operatorConfigHome,
35
+ harnessesUnsupportedInSrt2,
36
+ compiled2,
37
+ pinnedSrtCommand2,
38
+ pinnedSrtStepCommand2,
39
+ runSrtCli2,
40
+ kitmanCacheDirectory2,
41
+ srtSettings2,
42
+ srtCacheEnvironment2,
43
+ srtInheritedEnv2,
44
+ inheritedEnvironment2,
45
+ withOnlyEnvironment2,
46
+ writeSrtSettings2,
47
+ srtStepArgv2,
48
+ srtArgv2
49
+ } from "./chunk-0b93nv6j.js";
10
50
  import {
11
51
  pipeArguments,
12
52
  dual,
@@ -17,6 +57,7 @@ import {
17
57
  isUint8Array,
18
58
  PipeInspectableProto,
19
59
  none,
60
+ some,
20
61
  isNone,
21
62
  isSome,
22
63
  match,
@@ -246,47 +287,7 @@ import {
246
287
  installCommand,
247
288
  checkServicesFile,
248
289
  checkServices
249
- } from "./chunk-zbdnd7z7.js";
250
- import {
251
- join,
252
- interrupt,
253
- unbounded,
254
- publishUnsafe,
255
- unbounded2,
256
- offer,
257
- makeUnsafe3,
258
- make11,
259
- fromQueue,
260
- fromPubSub,
261
- map2,
262
- filter,
263
- decodeText,
264
- encodeText,
265
- splitLines,
266
- run,
267
- runHead,
268
- runForEach,
269
- FileSystem,
270
- Path,
271
- embeddedFile,
272
- extractEmbeddedFile,
273
- optionalEnv,
274
- operatorConfigHome,
275
- harnessesUnsupportedInSrt2,
276
- compiled2,
277
- pinnedSrtCommand2,
278
- pinnedSrtStepCommand2,
279
- runSrtCli2,
280
- kitmanCacheDirectory2,
281
- srtSettings2,
282
- srtCacheEnvironment2,
283
- srtInheritedEnv2,
284
- inheritedEnvironment2,
285
- withOnlyEnvironment2,
286
- writeSrtSettings2,
287
- srtStepArgv2,
288
- srtArgv2
289
- } from "./chunk-3d4d52e5.js";
290
+ } from "./chunk-5wvqtbfp.js";
290
291
  import {
291
292
  writeAgentEnvironmentConfigFile2,
292
293
  readManifestSkillPaths2,
@@ -302,8 +303,8 @@ import {
302
303
  applyAgentEnvironmentMaterialization2,
303
304
  isPathWithin2,
304
305
  skillIdentity2
305
- } from "./chunk-y78nw5ty.js";
306
- import"./chunk-xadtvj2q.js";
306
+ } from "./chunk-y1rfbqaf.js";
307
+ import"./chunk-z2dnw6ey.js";
307
308
  import {
308
309
  egressAllowed,
309
310
  writeSecretRegistry,
@@ -321,23 +322,23 @@ import {
321
322
  decodedOption2,
322
323
  decoded2,
323
324
  readOpencode2
324
- } from "./chunk-vmv7gwwr.js";
325
+ } from "./chunk-kpfrhex3.js";
325
326
  import {
326
327
  uploadRunFile,
327
328
  programLease,
328
329
  rpcRunFiles,
329
330
  programHostsEnv,
330
331
  undeclaredHostsEnv
331
- } from "./chunk-0j0bncss.js";
332
- import"./chunk-73rctgzy.js";
332
+ } from "./chunk-z9zqctv2.js";
333
+ import"./chunk-akzke77d.js";
333
334
  import {
334
335
  nextInt
335
336
  } from "./chunk-nzjb36ad.js";
336
337
  import {
337
338
  ChildProcessSpawner,
338
339
  make3
339
- } from "./chunk-sk6ceghr.js";
340
- import"./chunk-k004grgr.js";
340
+ } from "./chunk-2qarscbj.js";
341
+ import"./chunk-f3cbjk00.js";
341
342
 
342
343
  // packages/core/src/sync-kit.ts
343
344
  import { createHash } from "crypto";
@@ -3083,7 +3084,19 @@ var setUnsafe = (self, value) => {
3083
3084
  var update = /* @__PURE__ */ dual(2, (self, update) => self.semaphore.withPermit(sync2(() => setUnsafe(self, update(self.value)))));
3084
3085
 
3085
3086
  // packages/agent-runtime/src/claude-workspace-trust.ts
3087
+ class ClaudeTrustNotRecorded extends TaggedError("ClaudeTrustNotRecorded") {
3088
+ get message() {
3089
+ return `${this.file}: ${this.reason}`;
3090
+ }
3091
+ }
3092
+
3093
+ class ConfigLockHeld extends TaggedError("ConfigLockHeld") {
3094
+ }
3086
3095
  var withEntry = (object, key, value) => Object.fromEntries([...Object.entries(object), [key, value]]);
3096
+ var configLockStaleMs = 1e4;
3097
+ var configLockPollMs = 25;
3098
+ var configLockPolls = 2 * configLockStaleMs / configLockPollMs;
3099
+ var recordAttempts = 3;
3087
3100
  var writePermits = new Map;
3088
3101
  var trustClaudeWorkspace = (home, workspace) => {
3089
3102
  const permit = writePermits.get(home) ?? makeUnsafe3(1);
@@ -3093,21 +3106,62 @@ var trustClaudeWorkspace = (home, workspace) => {
3093
3106
  var trust = (home, workspace) => gen(function* () {
3094
3107
  const fs = yield* FileSystem;
3095
3108
  const file = `${home}/.claude.json`;
3109
+ yield* fs.makeDirectory(home, { recursive: true });
3110
+ for (let attempt = 0;attempt < recordAttempts; attempt++) {
3111
+ if (yield* isTrusted(file, workspace))
3112
+ return;
3113
+ if (attempt > 0)
3114
+ yield* logWarning("claude_trust_lost", { file, workspace });
3115
+ yield* scoped(andThen2(holdConfigLock(file), record(home, workspace)));
3116
+ }
3117
+ if (yield* isTrusted(file, workspace))
3118
+ return;
3119
+ return yield* new ClaudeTrustNotRecorded({
3120
+ file,
3121
+ reason: `the trust of ${workspace} was overwritten after each of ${recordAttempts} writes`
3122
+ });
3123
+ });
3124
+ var readConfig = (file) => gen(function* () {
3125
+ const fs = yield* FileSystem;
3096
3126
  const text = yield* fs.readFileString(file).pipe(catchReason("PlatformError", "NotFound", () => succeed6("{}")));
3097
3127
  const config = yield* decodeJsonString(text).pipe(orElseSucceed(() => {
3098
3128
  return;
3099
3129
  }));
3100
- if (!isJsonObject(config))
3101
- return yield* logWarning("claude_trust_skipped", `${file} is not a JSON object`);
3130
+ return isJsonObject(config) ? some(config) : none();
3131
+ });
3132
+ var projectOf = (config, workspace) => {
3102
3133
  const projects = isJsonObject(config.projects) ? config.projects : {};
3103
3134
  const project = isJsonObject(projects[workspace]) ? projects[workspace] : {};
3135
+ return { projects, project };
3136
+ };
3137
+ var isTrusted = (file, workspace) => map8(readConfig(file), (config) => isSome(config) ? projectOf(config.value, workspace).project.hasTrustDialogAccepted === true : false);
3138
+ var holdConfigLock = (file) => gen(function* () {
3139
+ const fs = yield* FileSystem;
3140
+ const lock = `${file}.lock`;
3141
+ const take = fs.makeDirectory(lock).pipe(catchReason("PlatformError", "AlreadyExists", () => gen(function* () {
3142
+ const modified = flatMap(yield* option2(fs.stat(lock)), (info) => info.mtime);
3143
+ const now = yield* currentTimeMillis;
3144
+ if (isSome(modified) && now - modified.value.getTime() > configLockStaleMs)
3145
+ yield* fs.remove(lock, { recursive: true }).pipe(ignore);
3146
+ return yield* new ConfigLockHeld;
3147
+ })), retry({
3148
+ while: isTagged("ConfigLockHeld"),
3149
+ schedule: spaced(configLockPollMs),
3150
+ times: configLockPolls
3151
+ }), catchTag("ConfigLockHeld", () => fail7(new ClaudeTrustNotRecorded({ file, reason: `${lock} stayed held` }))));
3152
+ yield* acquireRelease(take, () => fs.remove(lock, { recursive: true }).pipe(ignore));
3153
+ });
3154
+ var record = (home, workspace) => gen(function* () {
3155
+ const fs = yield* FileSystem;
3156
+ const file = `${home}/.claude.json`;
3157
+ const config = yield* readConfig(file);
3158
+ if (isNone(config))
3159
+ return yield* new ClaudeTrustNotRecorded({ file, reason: "it is not a JSON object" });
3160
+ const { projects, project } = projectOf(config.value, workspace);
3104
3161
  if (project.hasTrustDialogAccepted === true)
3105
3162
  return;
3106
- const json = yield* encodePrettyJsonString(withEntry(config, "projects", withEntry(projects, workspace, withEntry(project, "hasTrustDialogAccepted", true))));
3107
- const temporary = yield* fs.makeTempFile({
3108
- directory: home,
3109
- prefix: ".claude.json.kitman-"
3110
- });
3163
+ const json = yield* encodePrettyJsonString(withEntry(config.value, "projects", withEntry(projects, workspace, withEntry(project, "hasTrustDialogAccepted", true))));
3164
+ const temporary = yield* fs.makeTempFile({ directory: home, prefix: ".claude.json.kitman-" });
3111
3165
  yield* fs.chmod(temporary, 384);
3112
3166
  yield* fs.writeFileString(temporary, `${json}
3113
3167
  `);
@@ -4225,10 +4279,15 @@ var runAttempt = (request, options) => gen(function* () {
4225
4279
  }
4226
4280
  }
4227
4281
  }), registry === undefined ? void_3 : watchSecretRegistry(registry, request, options.secretRevocationMs))));
4228
- if (adapter.id === "claude" && request.sandbox.backend !== "docker")
4229
- yield* trustClaudeWorkspace(launch.globalConfig === undefined ? options.home : (yield* Path).dirname(launch.globalConfig.path), workspace).pipe(catch_((error) => logWarning("claude_trust_failed", error)));
4230
4282
  if (isFailure(command))
4231
4283
  return failed(command.failure.reason, command.failure.summary);
4284
+ if (adapter.id === "claude" && request.sandbox.backend !== "docker") {
4285
+ const trusted = yield* result(trustClaudeWorkspace(launch.globalConfig === undefined ? options.home : (yield* Path).dirname(launch.globalConfig.path), workspace));
4286
+ if (isFailure(trusted)) {
4287
+ yield* logWarning("claude_trust_failed", trusted.failure);
4288
+ return failed("harness_launch_failed", `Kitman could not record the workspace's trust, so Claude Code would wait on its folder trust prompt: ${trusted.failure.message}`);
4289
+ }
4290
+ }
4232
4291
  const call = requester(options.core, yield* scope2);
4233
4292
  const argv = yield* options.stepProcesses.contain(request.runnerId, attempt.id, command.success.argv);
4234
4293
  const run = (connection) => connection.run({
@@ -6009,6 +6068,30 @@ var stepAttempt = (input, resending) => (work) => gen(function* () {
6009
6068
  const restored = repoBinding === undefined || saved === undefined ? undefined : yield* checkouts.checkout(work, repoBinding, saved).pipe(catch_((error) => as(logWarning("runner_checkpoint_not_restored", error.message), undefined)));
6010
6069
  const worktree = restored ?? (repoBinding === undefined ? yield* checkouts.scratch(work) : yield* checkouts.checkout(work, repoBinding));
6011
6070
  const merge = merging === undefined ? undefined : yield* mergeTarget(worktree, merging);
6071
+ const deliver = (branch) => gen(function* () {
6072
+ const mergeCommit = merge === undefined ? undefined : (yield* runCommand2("git", ["-C", worktree, "rev-parse", "HEAD"])).trim();
6073
+ const revision = yield* pushWork(worktree, branch, work.stepKey, sharedBranch(work), yield* checkouts.transferEnv(repoBinding));
6074
+ const boundary = yield* runChange(worktree, work.runBaseRevision ?? work.baseRevision ?? `origin/${repoBinding?.defaultTargetBranch ?? "HEAD"}`).pipe(catch_((error) => as(logWarning("runner_boundary_unread", error.message), undefined)));
6075
+ const catchUp = merge === undefined || merging === undefined || mergeCommit === undefined || mergeCommit === merge.from ? undefined : yield* catchUpReport(worktree, {
6076
+ from: merge.from,
6077
+ merged: mergeCommit,
6078
+ head: revision,
6079
+ target: merging,
6080
+ conflicted: merge.conflicted,
6081
+ ...merge.automerged === undefined ? undefined : { automerged: merge.automerged }
6082
+ }).pipe(catch_((error) => as(logWarning("runner_catch_up_unread", error.message), undefined)));
6083
+ const completed = {
6084
+ status: "completed",
6085
+ revision,
6086
+ ...boundary === undefined ? undefined : { boundary },
6087
+ ...catchUp === undefined ? undefined : { catchUp },
6088
+ ...merge === undefined ? undefined : { syncedTarget: merge.target },
6089
+ ...merge?.clean === undefined ? undefined : { cleanSync: merge.clean }
6090
+ };
6091
+ return completed;
6092
+ });
6093
+ if (merge?.clean === "up_to_date" && work.branch !== undefined)
6094
+ return yield* deliver(work.branch);
6012
6095
  const notes = [...work.resumeNotes ?? [], ...merge === undefined ? [] : [merge.note]];
6013
6096
  const configDir = yield* (yield* FileSystem).makeTempDirectoryScoped({ prefix: "kitman-harness-" }).pipe(orDie);
6014
6097
  const backend = work.sandbox ?? (isFunction2(input.sandbox) ? input.sandbox(work) : input.sandbox);
@@ -6211,26 +6294,7 @@ var stepAttempt = (input, resending) => (work) => gen(function* () {
6211
6294
  const unmerged = merge === undefined ? undefined : yield* concludeMerge(worktree, merge.conflicted, state.outputMerged === true);
6212
6295
  if (unmerged !== undefined)
6213
6296
  return { status: "failed", failureSummary: unmerged };
6214
- const mergeCommit = merge === undefined ? undefined : (yield* runCommand2("git", ["-C", worktree, "rev-parse", "HEAD"])).trim();
6215
- const revision = yield* pushWork(worktree, work.branch, work.stepKey, sharedBranch(work), yield* checkouts.transferEnv(repoBinding));
6216
- const boundary = yield* runChange(worktree, work.runBaseRevision ?? work.baseRevision ?? `origin/${repoBinding?.defaultTargetBranch ?? "HEAD"}`).pipe(catch_((error) => as(logWarning("runner_boundary_unread", error.message), undefined)));
6217
- const catchUp = merge === undefined || merging === undefined || mergeCommit === undefined || mergeCommit === merge.from ? undefined : yield* catchUpReport(worktree, {
6218
- from: merge.from,
6219
- merged: mergeCommit,
6220
- head: revision,
6221
- target: merging,
6222
- conflicted: merge.conflicted,
6223
- ...merge.automerged === undefined ? undefined : { automerged: merge.automerged }
6224
- }).pipe(catch_((error) => as(logWarning("runner_catch_up_unread", error.message), undefined)));
6225
- const completed = {
6226
- status: "completed",
6227
- revision,
6228
- ...boundary === undefined ? undefined : { boundary },
6229
- ...catchUp === undefined ? undefined : { catchUp },
6230
- ...merge === undefined ? undefined : { syncedTarget: merge.target },
6231
- ...merge?.clean === undefined ? undefined : { cleanSync: merge.clean }
6232
- };
6233
- return completed;
6297
+ return yield* deliver(work.branch);
6234
6298
  }).pipe(scoped);
6235
6299
  var agentStepExecutor = (input) => stepAttempt(input, new Map);
6236
6300
  var checkpointRef = (work) => `refs/kitman/checkpoints/${work.runId}/${work.id}`;