@kitman-sh/cli 0.10.99 → 0.10.100
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.
- package/dist/{chunk-rdv42ygn.js → chunk-0rf10v29.js} +4 -4
- package/dist/{chunk-0a10kdrd.js → chunk-1k3cvdbt.js} +4 -4
- package/dist/{chunk-et6qa95h.js → chunk-1kww1jdz.js} +1 -1
- package/dist/{chunk-0tsc91qr.js → chunk-1nw7sbtr.js} +4 -4
- package/dist/{chunk-abf4m4b2.js → chunk-4c78jfqk.js} +5 -5
- package/dist/{chunk-rrj434w6.js → chunk-5z0cwmet.js} +28 -28
- package/dist/{chunk-t7ncjd6s.js → chunk-6sanfepb.js} +6 -6
- package/dist/{chunk-4sswz0mn.js → chunk-9xj0djtp.js} +8 -8
- package/dist/{chunk-ampzxrqe.js → chunk-ayfdkptb.js} +61 -60
- package/dist/{chunk-3v70x040.js → chunk-cpx45jzk.js} +5 -5
- package/dist/{chunk-6vmpa1nw.js → chunk-cy7cy84h.js} +10 -10
- package/dist/{chunk-g3r5xp0t.js → chunk-gs6qdy2k.js} +2 -2
- package/dist/{chunk-56e202xk.js → chunk-hcpjfshb.js} +6 -6
- package/dist/{chunk-vjcn82g3.js → chunk-mjrr0wzp.js} +28 -177
- package/dist/{chunk-a244myqw.js → chunk-mk8vsaj7.js} +1 -1
- package/dist/{chunk-3ka78n56.js → chunk-mtz8f1hn.js} +7 -7
- package/dist/{chunk-3r7ahnwy.js → chunk-p3kwtm82.js} +2 -2
- package/dist/{chunk-fv6kgtze.js → chunk-qv9te9gr.js} +2 -2
- package/dist/{chunk-2fs34341.js → chunk-r3rap6hz.js} +30 -24
- package/dist/{chunk-0hjtwtms.js → chunk-tk85pw4z.js} +92 -21
- package/dist/{chunk-rp224rm4.js → chunk-tqw2rkc9.js} +3 -3
- package/dist/{chunk-z2f9enrp.js → chunk-vatjyw59.js} +17 -17
- package/dist/{chunk-k0shg2fb.js → chunk-wyh06par.js} +291 -135
- package/dist/{chunk-bk3dpjxq.js → chunk-wzkdjdb7.js} +1 -1
- package/dist/index.js +4 -4
- package/package.json +1 -1
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
identity,
|
|
4
|
+
hasProperty,
|
|
4
5
|
isNone,
|
|
5
6
|
isSome,
|
|
6
7
|
getOrElse,
|
|
7
8
|
getOrUndefined,
|
|
9
|
+
exists,
|
|
8
10
|
Reference,
|
|
9
11
|
fromInputUnsafe,
|
|
10
12
|
zero,
|
|
@@ -28,6 +30,7 @@ import {
|
|
|
28
30
|
provide2,
|
|
29
31
|
provideMerge,
|
|
30
32
|
squash,
|
|
33
|
+
spaced,
|
|
31
34
|
all3,
|
|
32
35
|
forEach,
|
|
33
36
|
promise,
|
|
@@ -68,6 +71,7 @@ import {
|
|
|
68
71
|
ensuring2,
|
|
69
72
|
onError,
|
|
70
73
|
cached,
|
|
74
|
+
repeat,
|
|
71
75
|
forkDetach,
|
|
72
76
|
runFork,
|
|
73
77
|
runPromise,
|
|
@@ -75,6 +79,7 @@ import {
|
|
|
75
79
|
runSync,
|
|
76
80
|
fnUntraced,
|
|
77
81
|
fn,
|
|
82
|
+
decodeUnknownEffect2,
|
|
78
83
|
optionalKey,
|
|
79
84
|
optional,
|
|
80
85
|
Literal,
|
|
@@ -102,7 +107,7 @@ import {
|
|
|
102
107
|
decodeJsonStringOption,
|
|
103
108
|
encodeJsonStringSync,
|
|
104
109
|
encodePrettyJsonString
|
|
105
|
-
} from "./chunk-
|
|
110
|
+
} from "./chunk-ayfdkptb.js";
|
|
106
111
|
import {
|
|
107
112
|
currentTimeMillis,
|
|
108
113
|
SecureRandom,
|
|
@@ -154,13 +159,13 @@ import {
|
|
|
154
159
|
runMcpEffect,
|
|
155
160
|
createAgentAuthSignedFetch,
|
|
156
161
|
setupMcpAgentCredential
|
|
157
|
-
} from "./chunk-
|
|
162
|
+
} from "./chunk-wyh06par.js";
|
|
158
163
|
import {
|
|
159
164
|
guard,
|
|
160
165
|
Id,
|
|
161
166
|
Timestamp,
|
|
162
167
|
ActorType
|
|
163
|
-
} from "./chunk-
|
|
168
|
+
} from "./chunk-1kww1jdz.js";
|
|
164
169
|
import {
|
|
165
170
|
toJsonValue,
|
|
166
171
|
isOneOf,
|
|
@@ -173,7 +178,7 @@ import {
|
|
|
173
178
|
isJsonObject,
|
|
174
179
|
isString,
|
|
175
180
|
kindOf
|
|
176
|
-
} from "./chunk-
|
|
181
|
+
} from "./chunk-wzkdjdb7.js";
|
|
177
182
|
import {
|
|
178
183
|
join,
|
|
179
184
|
interrupt,
|
|
@@ -187,20 +192,20 @@ import {
|
|
|
187
192
|
withDefault,
|
|
188
193
|
option,
|
|
189
194
|
String2
|
|
190
|
-
} from "./chunk-
|
|
195
|
+
} from "./chunk-mjrr0wzp.js";
|
|
191
196
|
import {
|
|
192
197
|
nextInt
|
|
193
|
-
} from "./chunk-
|
|
198
|
+
} from "./chunk-mk8vsaj7.js";
|
|
194
199
|
import {
|
|
195
200
|
layerJson,
|
|
196
201
|
make4,
|
|
197
202
|
withHeaders,
|
|
198
203
|
layerProtocolSocket,
|
|
199
204
|
ConnectionHooks
|
|
200
|
-
} from "./chunk-
|
|
205
|
+
} from "./chunk-vatjyw59.js";
|
|
201
206
|
|
|
202
207
|
// apps/cli/src/mcp.ts
|
|
203
|
-
import { tmpdir } from "os";
|
|
208
|
+
import { tmpdir as tmpdir2 } from "os";
|
|
204
209
|
|
|
205
210
|
// apps/mcp/src/index.ts
|
|
206
211
|
import { StdioServerTransport } from "@modelcontextprotocol/server/stdio";
|
|
@@ -4363,6 +4368,8 @@ var publicOperationDescriptors = createOperationDescriptors();
|
|
|
4363
4368
|
var publicOperationDescriptorByName = new Map(publicOperationDescriptors.map((operation) => [operation.name, operation]));
|
|
4364
4369
|
|
|
4365
4370
|
// apps/mcp/src/code-mode-executor.ts
|
|
4371
|
+
import { rmSync } from "fs";
|
|
4372
|
+
import { tmpdir } from "os";
|
|
4366
4373
|
import { NodeRuntime, Sidecar } from "secure-exec";
|
|
4367
4374
|
|
|
4368
4375
|
// apps/mcp/src/code-mode-assets.ts
|
|
@@ -4389,19 +4396,31 @@ var resolveCodeModeAssets = fnUntraced(function* (input) {
|
|
|
4389
4396
|
const missing = (asset, override) => new CodeModeAssetError({
|
|
4390
4397
|
message: `Code Mode cannot start: this kitman has no ${asset} for ${platform} to extract to ` + `${directory}. To fix it, reinstall kitman from the control plane, or set ${override}.`
|
|
4391
4398
|
});
|
|
4392
|
-
const
|
|
4393
|
-
message: `Code Mode cannot
|
|
4394
|
-
})
|
|
4399
|
+
const unwritable = (action, override) => (error) => new CodeModeAssetError({
|
|
4400
|
+
message: `Code Mode cannot ${action} ${directory}: ${error.message}. Make that directory writable, set ` + `XDG_CACHE_HOME to one that is, or set ${override}.`
|
|
4401
|
+
});
|
|
4402
|
+
const extract = (file, name, override) => extractEmbeddedFile(directory, file, name).pipe(mapError2(unwritable(`extract its ${platform} ${name} to`, override)));
|
|
4395
4403
|
return {
|
|
4396
|
-
sidecar: env.sidecar !== "" ? env.sidecar : sidecar !== undefined ? yield* extract(sidecar, "secure-exec-sidecar", sidecarOverride) : yield* core.pipe(
|
|
4397
|
-
commandsDir: env.commandsDir !== "" ? env.commandsDir : sh !== undefined ? path.dirname(yield* extract(sh, "sh", shOverride)) : yield* core.pipe(
|
|
4404
|
+
sidecar: env.sidecar !== "" ? env.sidecar : sidecar !== undefined ? yield* extract(sidecar, "secure-exec-sidecar", sidecarOverride) : yield* core.pipe(flatMap3(installedSidecar), mapError2(() => missing("secure-exec sidecar", sidecarOverride))),
|
|
4405
|
+
commandsDir: env.commandsDir !== "" ? env.commandsDir : sh !== undefined ? path.dirname(yield* extract(sh, "sh", shOverride)) : yield* core.pipe(mapError2(() => missing("secure-exec guest sh", shOverride)), flatMap3((installed) => shellOnlyCommandsDir(installed, directory).pipe(mapError2(unwritable("link secure-exec's guest sh in", shOverride)))))
|
|
4398
4406
|
};
|
|
4399
4407
|
});
|
|
4400
|
-
var
|
|
4408
|
+
var installedSidecar = (core) => try_2(() => createRequire(core)("@secure-exec/sidecar").getSidecarPath()).pipe(flatMap3(decodeUnknownEffect2(String4)));
|
|
4409
|
+
var shellOnlyCommandsDir = fnUntraced(function* (core, cache) {
|
|
4401
4410
|
const fs = yield* FileSystem;
|
|
4402
4411
|
const path = yield* Path;
|
|
4403
|
-
const
|
|
4404
|
-
|
|
4412
|
+
const sh = path.join(path.dirname(core), "..", "commands", "sh");
|
|
4413
|
+
const directory = path.join(cache, `secure-exec-commands-${digestSha256(sh, "hex").slice(0, 16)}`);
|
|
4414
|
+
const link = path.join(directory, "sh");
|
|
4415
|
+
if ((yield* fs.readLink(link).pipe(orElseSucceed(() => {
|
|
4416
|
+
return;
|
|
4417
|
+
}))) === sh)
|
|
4418
|
+
return directory;
|
|
4419
|
+
const staged = `${link}.${process.pid}`;
|
|
4420
|
+
yield* fs.makeDirectory(directory, { recursive: true });
|
|
4421
|
+
yield* fs.remove(staged, { force: true });
|
|
4422
|
+
yield* fs.symlink(sh, staged);
|
|
4423
|
+
yield* fs.rename(staged, link);
|
|
4405
4424
|
return directory;
|
|
4406
4425
|
});
|
|
4407
4426
|
|
|
@@ -4413,6 +4432,47 @@ var codeModeAssets = runSync(cached(resolveCodeModeAssets({
|
|
|
4413
4432
|
embeddedFiles: typeof Bun === "undefined" ? [] : Bun.embeddedFiles,
|
|
4414
4433
|
resolveFrom: import.meta.url
|
|
4415
4434
|
}).pipe(provide3(McpPlatformLive), mapError2((error) => new CodeModeExecutionError({ message: error.message })))));
|
|
4435
|
+
var sidecarTempPrefix = "kitman-code-mode-sidecar-";
|
|
4436
|
+
var ownerPid = new RegExp(`^${sidecarTempPrefix}(\\d+)-`);
|
|
4437
|
+
var orphanedSidecarTempMs = 10 * 60 * 1000;
|
|
4438
|
+
var staleSidecarTempMs = 6 * 60 * 60 * 1000;
|
|
4439
|
+
var running = (pid) => {
|
|
4440
|
+
try {
|
|
4441
|
+
process.kill(pid, 0);
|
|
4442
|
+
return true;
|
|
4443
|
+
} catch (error) {
|
|
4444
|
+
return hasProperty(error, "code") && error.code === "EPERM";
|
|
4445
|
+
}
|
|
4446
|
+
};
|
|
4447
|
+
var leftBehind = (entry, ageMs) => {
|
|
4448
|
+
const owner = Number(ownerPid.exec(entry)?.[1]);
|
|
4449
|
+
return ageMs > staleSidecarTempMs || ageMs > orphanedSidecarTempMs && Number.isInteger(owner) && !running(owner);
|
|
4450
|
+
};
|
|
4451
|
+
var sweepStaleSidecarTemp = runSync(cached(gen(function* () {
|
|
4452
|
+
const fs = yield* FileSystem;
|
|
4453
|
+
const path = yield* Path;
|
|
4454
|
+
const now = yield* currentTimeMillis;
|
|
4455
|
+
const root = tmpdir();
|
|
4456
|
+
const entries = (yield* fs.readDirectory(root)).filter((entry) => entry.startsWith(sidecarTempPrefix));
|
|
4457
|
+
yield* forEach(entries, (entry) => fs.stat(path.join(root, entry)).pipe(flatMap3((info) => exists(info.mtime, (mtime) => leftBehind(entry, now - mtime.getTime())) ? fs.remove(path.join(root, entry), { recursive: true, force: true }) : void_3), ignore), { discard: true });
|
|
4458
|
+
}).pipe(ignore, provide3(McpPlatformLive))));
|
|
4459
|
+
var liveSidecarTemp = new Set;
|
|
4460
|
+
process.once("exit", () => {
|
|
4461
|
+
for (const directory of liveSidecarTemp)
|
|
4462
|
+
rmSync(directory, { recursive: true, force: true });
|
|
4463
|
+
});
|
|
4464
|
+
var spawnSidecar = (command, temporary) => {
|
|
4465
|
+
const inherited = process.env.TMPDIR;
|
|
4466
|
+
process.env.TMPDIR = temporary;
|
|
4467
|
+
try {
|
|
4468
|
+
return Sidecar.spawn({ command });
|
|
4469
|
+
} finally {
|
|
4470
|
+
if (inherited === undefined)
|
|
4471
|
+
delete process.env.TMPDIR;
|
|
4472
|
+
else
|
|
4473
|
+
process.env.TMPDIR = inherited;
|
|
4474
|
+
}
|
|
4475
|
+
};
|
|
4416
4476
|
function createCodeModeExecutor(options = {}) {
|
|
4417
4477
|
return { execute: (input) => executeCodeMode(input, options) };
|
|
4418
4478
|
}
|
|
@@ -4447,12 +4507,16 @@ var bootGuest = gen(function* () {
|
|
|
4447
4507
|
const nonce = yield* (yield* SecureRandom).uuidV4();
|
|
4448
4508
|
const result = makeUnsafe5();
|
|
4449
4509
|
let call = () => Promise.reject(new Error("Code Mode guest has no execution"));
|
|
4450
|
-
|
|
4451
|
-
const
|
|
4510
|
+
yield* sweepStaleSidecarTemp;
|
|
4511
|
+
const fs = yield* FileSystem;
|
|
4512
|
+
const temporary = yield* fs.makeTempDirectory({ prefix: `${sidecarTempPrefix}${process.pid}-` }).pipe(mapError2((error) => new CodeModeExecutionError({ message: `Code Mode secure-exec could not start: ${error.message}` })));
|
|
4513
|
+
liveSidecarTemp.add(temporary);
|
|
4514
|
+
const sidecar = spawnSidecar(assets.sidecar, temporary);
|
|
4515
|
+
const disposeSidecar = ignore(tryPromise(() => sidecar.dispose())).pipe(andThen2(ignore(fs.remove(temporary, { recursive: true, force: true }))), andThen2(sync2(() => liveSidecarTemp.delete(temporary))));
|
|
4452
4516
|
const runtime = yield* tryPromise({
|
|
4453
4517
|
try: () => NodeRuntime.create({
|
|
4454
|
-
|
|
4455
|
-
|
|
4518
|
+
commandsDir: assets.commandsDir,
|
|
4519
|
+
sidecar,
|
|
4456
4520
|
cwd: "/root",
|
|
4457
4521
|
env: {},
|
|
4458
4522
|
permissions: {
|
|
@@ -4518,6 +4582,13 @@ var warmCodeModeGuest = sync2(() => {
|
|
|
4518
4582
|
nextGuest = runFork(bootGuest);
|
|
4519
4583
|
expireWhenIdle(nextGuest);
|
|
4520
4584
|
});
|
|
4585
|
+
var disposeCodeModeGuests = suspend3(() => {
|
|
4586
|
+
if (idleExpiry !== undefined)
|
|
4587
|
+
runFork(interrupt(idleExpiry));
|
|
4588
|
+
const booting = nextGuest;
|
|
4589
|
+
nextGuest = undefined;
|
|
4590
|
+
return (booting === undefined ? void_3 : join(booting).pipe(flatMap3(disposeGuest), ignore)).pipe(andThen2(sync2(() => liveSidecarTemp.size).pipe(repeat({ schedule: spaced("50 millis"), until: (live) => live === 0, times: 200 }))), asVoid);
|
|
4591
|
+
});
|
|
4521
4592
|
var takeGuest = suspend3(() => {
|
|
4522
4593
|
const taken = nextGuest ?? runFork(bootGuest);
|
|
4523
4594
|
const booting = runFork(bootGuest);
|
|
@@ -8067,7 +8138,7 @@ function runMcpServerCommand(input = {}) {
|
|
|
8067
8138
|
apiUrl: config.apiUrl,
|
|
8068
8139
|
stepCredential,
|
|
8069
8140
|
...(yield* stepOutputOnlyFromEnv) ? { outputOnly: true } : {
|
|
8070
|
-
fileRoots: [(yield* stepWorkspaceFromEnv) ?? cwd,
|
|
8141
|
+
fileRoots: [(yield* stepWorkspaceFromEnv) ?? cwd, tmpdir2()],
|
|
8071
8142
|
...skillsDir === undefined ? undefined : { skillsDir },
|
|
8072
8143
|
...fittingSkills.length === 0 ? undefined : { fittingSkills }
|
|
8073
8144
|
}
|
|
@@ -24,11 +24,11 @@ import {
|
|
|
24
24
|
Record,
|
|
25
25
|
Int,
|
|
26
26
|
fromJsonString
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-ayfdkptb.js";
|
|
28
28
|
import {
|
|
29
29
|
withDefault,
|
|
30
30
|
String2
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-mjrr0wzp.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-
|
|
41
|
+
} from "./chunk-wyh06par.js";
|
|
42
42
|
|
|
43
43
|
// packages/core/src/npm-registry.ts
|
|
44
44
|
var KitManifest = Struct({
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
add,
|
|
13
13
|
getOrUndefinedUnsafe,
|
|
14
14
|
getUnsafe,
|
|
15
|
-
|
|
15
|
+
get3,
|
|
16
16
|
Reference,
|
|
17
17
|
toMillis,
|
|
18
18
|
isSuccess,
|
|
@@ -96,19 +96,7 @@ import {
|
|
|
96
96
|
Defect,
|
|
97
97
|
Exit,
|
|
98
98
|
toCodecJson
|
|
99
|
-
} from "./chunk-
|
|
100
|
-
import {
|
|
101
|
-
interrupt,
|
|
102
|
-
getCurrent,
|
|
103
|
-
makeUnsafe2,
|
|
104
|
-
bounded,
|
|
105
|
-
offerAll,
|
|
106
|
-
failCause,
|
|
107
|
-
end,
|
|
108
|
-
shutdownUnsafe,
|
|
109
|
-
fromQueue,
|
|
110
|
-
unwrap
|
|
111
|
-
} from "./chunk-vjcn82g3.js";
|
|
99
|
+
} from "./chunk-ayfdkptb.js";
|
|
112
100
|
import {
|
|
113
101
|
Clock,
|
|
114
102
|
empty,
|
|
@@ -123,7 +111,19 @@ import {
|
|
|
123
111
|
ParseOptions,
|
|
124
112
|
RpcClientDefect,
|
|
125
113
|
RpcClientError
|
|
126
|
-
} from "./chunk-
|
|
114
|
+
} from "./chunk-wyh06par.js";
|
|
115
|
+
import {
|
|
116
|
+
interrupt,
|
|
117
|
+
getCurrent,
|
|
118
|
+
makeUnsafe2,
|
|
119
|
+
bounded,
|
|
120
|
+
offerAll,
|
|
121
|
+
failCause,
|
|
122
|
+
end,
|
|
123
|
+
shutdownUnsafe,
|
|
124
|
+
fromQueue,
|
|
125
|
+
unwrap
|
|
126
|
+
} from "./chunk-mjrr0wzp.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")) {
|
|
@@ -237,7 +237,7 @@ var makeNoSerialization = /* @__PURE__ */ fnUntraced(function* (group, options)
|
|
|
237
237
|
const disableTracing = options?.disableTracing ?? false;
|
|
238
238
|
const generateRequestId = options?.generateRequestId ?? (() => requestIdCounter++);
|
|
239
239
|
const services = yield* context();
|
|
240
|
-
const scope =
|
|
240
|
+
const scope = get3(services, Scope);
|
|
241
241
|
const entries = new Map;
|
|
242
242
|
let isShutdown = false;
|
|
243
243
|
yield* addFinalizer(scope, withFiber2((parent) => {
|
|
@@ -643,7 +643,7 @@ var makeRpcSchemas = (codecFor) => {
|
|
|
643
643
|
return entry;
|
|
644
644
|
}
|
|
645
645
|
const streamSchemas = getStreamSchemas(rpc.successSchema);
|
|
646
|
-
const parseOptions =
|
|
646
|
+
const parseOptions = get3(rpc.annotations, ParseOptions);
|
|
647
647
|
const exitSchema2 = exitSchema(rpc);
|
|
648
648
|
let decodeDiscardExit;
|
|
649
649
|
entry = {
|