@kitman-sh/cli 0.12.0-rc.7 → 0.12.0-rc.8
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-15geyg2d.js → chunk-3cgshf16.js} +98 -101
- package/dist/{chunk-j5t5nye5.js → chunk-3kxwb7qn.js} +7 -7
- package/dist/{chunk-bheg4ybe.js → chunk-6pqxsnk1.js} +22 -23
- package/dist/{chunk-e4an66v2.js → chunk-7959aeck.js} +5 -5
- package/dist/{chunk-xwya1er0.js → chunk-892qrkb3.js} +14 -60
- package/dist/{chunk-0346hwh6.js → chunk-8sz25ptv.js} +4 -5
- package/dist/{chunk-1t12wvv1.js → chunk-9c9vrbh4.js} +205 -216
- package/dist/{chunk-8twjqszj.js → chunk-9q7qc1dg.js} +1 -1
- package/dist/{chunk-z450wa10.js → chunk-bz4bp0q7.js} +3 -4
- package/dist/{chunk-znar1th3.js → chunk-d8qcmqh5.js} +4 -4
- package/dist/{chunk-2e91ymwn.js → chunk-det0tmx7.js} +1 -1
- package/dist/{chunk-xe8qf2xy.js → chunk-dh09wyed.js} +127 -129
- package/dist/{chunk-ewhzaqp3.js → chunk-e711ebdj.js} +2 -2
- package/dist/{chunk-wc2kba4z.js → chunk-ey4mf341.js} +6 -7
- package/dist/{chunk-qrm334c6.js → chunk-jg8n8z0z.js} +4 -4
- package/dist/{chunk-4w4spvb1.js → chunk-jwc8bdga.js} +5 -5
- package/dist/{chunk-nzjb36ad.js → chunk-mm2m3bys.js} +1 -1
- package/dist/{chunk-r5sw3fe0.js → chunk-mmpcdj8f.js} +10 -12
- package/dist/{chunk-0qz10ek8.js → chunk-s8m2tzdr.js} +4 -4
- package/dist/{chunk-xcf887a4.js → chunk-scb6qgy2.js} +47 -49
- package/dist/{chunk-5j848ckb.js → chunk-skqn4h13.js} +2 -2
- package/dist/{chunk-56knbdt6.js → chunk-vkchn89k.js} +23 -25
- package/dist/{chunk-pd2vz4bm.js → chunk-vrms6e1m.js} +13 -15
- package/dist/{chunk-vtfwjhzh.js → chunk-x3cc7dfc.js} +379 -63
- package/dist/{chunk-gspfm7qh.js → chunk-y7vjk8vv.js} +31 -165
- package/dist/index.js +4 -4
- package/package.json +1 -1
- package/dist/chunk-c6rbt85q.js +0 -141
|
@@ -14,8 +14,8 @@ import {
|
|
|
14
14
|
writeSrtSettings2,
|
|
15
15
|
srtStepArgv2,
|
|
16
16
|
srtArgv2
|
|
17
|
-
} from "./chunk-
|
|
18
|
-
import"./chunk-
|
|
17
|
+
} from "./chunk-y7vjk8vv.js";
|
|
18
|
+
import"./chunk-x3cc7dfc.js";
|
|
19
19
|
export {
|
|
20
20
|
compiled2 as compiled,
|
|
21
21
|
harnessesUnsupportedInSrt2 as harnessesUnsupportedInSrt,
|
|
@@ -4,13 +4,12 @@ import {
|
|
|
4
4
|
runnerRpcUrl2,
|
|
5
5
|
makeRunnerRpcClient2,
|
|
6
6
|
makeProgramRpcClient2
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import"./chunk-
|
|
9
|
-
import"./chunk-
|
|
10
|
-
import"./chunk-
|
|
11
|
-
import"./chunk-
|
|
12
|
-
import"./chunk-
|
|
13
|
-
import"./chunk-vtfwjhzh.js";
|
|
7
|
+
} from "./chunk-3kxwb7qn.js";
|
|
8
|
+
import"./chunk-jwc8bdga.js";
|
|
9
|
+
import"./chunk-9c9vrbh4.js";
|
|
10
|
+
import"./chunk-s8m2tzdr.js";
|
|
11
|
+
import"./chunk-y7vjk8vv.js";
|
|
12
|
+
import"./chunk-x3cc7dfc.js";
|
|
14
13
|
export {
|
|
15
14
|
makeProgramRpcClient2 as makeProgramRpcClient,
|
|
16
15
|
makeRunnerRpcClient2 as makeRunnerRpcClient,
|
|
@@ -75,10 +75,10 @@ import {
|
|
|
75
75
|
toEquivalence,
|
|
76
76
|
toCodecJson,
|
|
77
77
|
Json
|
|
78
|
-
} from "./chunk-
|
|
78
|
+
} from "./chunk-x3cc7dfc.js";
|
|
79
79
|
import {
|
|
80
80
|
guard
|
|
81
|
-
} from "./chunk-
|
|
81
|
+
} from "./chunk-s8m2tzdr.js";
|
|
82
82
|
import {
|
|
83
83
|
currentTimeMillis,
|
|
84
84
|
WebCrypto,
|
|
@@ -105,11 +105,11 @@ import {
|
|
|
105
105
|
KitDigest,
|
|
106
106
|
KitSetup,
|
|
107
107
|
RunnerRpcError
|
|
108
|
-
} from "./chunk-
|
|
108
|
+
} from "./chunk-9c9vrbh4.js";
|
|
109
109
|
import {
|
|
110
110
|
runForEach,
|
|
111
111
|
FileSystem
|
|
112
|
-
} from "./chunk-
|
|
112
|
+
} from "./chunk-y7vjk8vv.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");
|
|
@@ -96,7 +96,7 @@ import {
|
|
|
96
96
|
Defect,
|
|
97
97
|
Exit,
|
|
98
98
|
toCodecJson
|
|
99
|
-
} from "./chunk-
|
|
99
|
+
} from "./chunk-x3cc7dfc.js";
|
|
100
100
|
import {
|
|
101
101
|
interrupt,
|
|
102
102
|
getCurrent,
|
|
@@ -108,7 +108,7 @@ import {
|
|
|
108
108
|
shutdownUnsafe,
|
|
109
109
|
fromQueue,
|
|
110
110
|
unwrap
|
|
111
|
-
} from "./chunk-
|
|
111
|
+
} from "./chunk-y7vjk8vv.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-
|
|
126
|
+
} from "./chunk-9c9vrbh4.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")) {
|
|
@@ -483,7 +483,7 @@ var makeNoSerialization = /* @__PURE__ */ fnUntraced(function* (group, options)
|
|
|
483
483
|
};
|
|
484
484
|
});
|
|
485
485
|
var clientIdCounter = 0;
|
|
486
|
-
var
|
|
486
|
+
var make3 = /* @__PURE__ */ fnUntraced(function* (group, options) {
|
|
487
487
|
const clientId = clientIdCounter++;
|
|
488
488
|
const {
|
|
489
489
|
codecFor,
|
|
@@ -829,4 +829,4 @@ var layerProtocolSocket = (options) => effect(Protocol)(makeProtocolSocket(optio
|
|
|
829
829
|
class ConnectionHooks extends (/* @__PURE__ */ Service2()("effect/rpc/RpcClient/ConnectionHooks")) {
|
|
830
830
|
}
|
|
831
831
|
|
|
832
|
-
export { layerJson,
|
|
832
|
+
export { layerJson, make3, withHeaders, layerProtocolSocket, ConnectionHooks };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
|
-
|
|
3
|
+
isObject,
|
|
4
4
|
isUint8Array,
|
|
5
5
|
isSuccess,
|
|
6
6
|
TaggedError,
|
|
@@ -10,32 +10,30 @@ import {
|
|
|
10
10
|
andThen2,
|
|
11
11
|
catchReason,
|
|
12
12
|
orElseSucceed,
|
|
13
|
+
isJsonObject,
|
|
13
14
|
decodeJsonString,
|
|
14
15
|
encodePrettyJsonString
|
|
15
|
-
} from "./chunk-
|
|
16
|
-
import"./chunk-
|
|
17
|
-
import {
|
|
18
|
-
isJsonObject
|
|
19
|
-
} from "./chunk-c6rbt85q.js";
|
|
16
|
+
} from "./chunk-x3cc7dfc.js";
|
|
17
|
+
import"./chunk-s8m2tzdr.js";
|
|
20
18
|
import {
|
|
21
19
|
FileSystem,
|
|
22
20
|
Path
|
|
23
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-y7vjk8vv.js";
|
|
24
22
|
import {
|
|
25
23
|
tomlTableHeader2,
|
|
26
24
|
tomlKeyPath2,
|
|
27
25
|
kitmanSkillEntry,
|
|
28
26
|
isPathWithin2
|
|
29
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-vrms6e1m.js";
|
|
30
28
|
import {
|
|
31
29
|
instructionsStart,
|
|
32
30
|
instructionsEnd,
|
|
33
31
|
renderMcpServer,
|
|
34
32
|
materializeKitSetup,
|
|
35
33
|
tomlInline
|
|
36
|
-
} from "./chunk-
|
|
37
|
-
import"./chunk-
|
|
38
|
-
import"./chunk-
|
|
34
|
+
} from "./chunk-9c9vrbh4.js";
|
|
35
|
+
import"./chunk-892qrkb3.js";
|
|
36
|
+
import"./chunk-7959aeck.js";
|
|
39
37
|
|
|
40
38
|
// packages/agent-runtime/src/kit-setup-sync.ts
|
|
41
39
|
class KitSyncError extends TaggedError("KitSyncError") {
|
|
@@ -93,7 +91,7 @@ var withEntries = (value, key, entries) => {
|
|
|
93
91
|
var tomlKey = (key) => /^[A-Za-z0-9_-]+$/u.test(key) ? key : JSON.stringify(key);
|
|
94
92
|
var tomlTable = (header, value) => [
|
|
95
93
|
header,
|
|
96
|
-
...
|
|
94
|
+
...isObject(value) && !Array.isArray(value) ? Object.entries(value).map(([key, entry]) => `${tomlKey(key)} = ${tomlInline(entry)}`) : [],
|
|
97
95
|
""
|
|
98
96
|
];
|
|
99
97
|
var codexConfigKept = (text, servers) => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
|
-
|
|
3
|
+
isObject,
|
|
4
4
|
isSuccess2,
|
|
5
5
|
decodeUnknownExit,
|
|
6
6
|
optionalKey,
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
isMinLength,
|
|
19
19
|
isMaxLength,
|
|
20
20
|
FiniteFromString
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-x3cc7dfc.js";
|
|
22
22
|
|
|
23
23
|
// node_modules/.bun/effect@4.1.2/node_modules/effect/dist/JsonSchema.js
|
|
24
24
|
var PRE_2020_TO_2020_COLLISIONS = ["$anchor", "$defs", "$dynamicAnchor", "$dynamicRef", "$vocabulary", "contentSchema", "dependentRequired", "dependentSchemas", "maxContains", "minContains", "prefixItems", "unevaluatedItems", "unevaluatedProperties"];
|
|
@@ -79,7 +79,7 @@ var guards = new WeakMap;
|
|
|
79
79
|
function hasUndefinedProperty(value) {
|
|
80
80
|
if (Array.isArray(value))
|
|
81
81
|
return value.some(hasUndefinedProperty);
|
|
82
|
-
if (!
|
|
82
|
+
if (!isObject(value))
|
|
83
83
|
return false;
|
|
84
84
|
return Object.values(value).some((entry) => entry === undefined || hasUndefinedProperty(entry));
|
|
85
85
|
}
|
|
@@ -87,7 +87,7 @@ function withoutUndefined(value) {
|
|
|
87
87
|
if (Array.isArray(value)) {
|
|
88
88
|
return value.map(withoutUndefined);
|
|
89
89
|
}
|
|
90
|
-
if (!
|
|
90
|
+
if (!isObject(value) || Object.getPrototypeOf(value) !== Object.prototype)
|
|
91
91
|
return value;
|
|
92
92
|
return Object.fromEntries(Object.entries(value).flatMap(([key, entry]) => entry === undefined ? [] : [[key, withoutUndefined(entry)]]));
|
|
93
93
|
}
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
succeed,
|
|
13
13
|
isSuccess,
|
|
14
14
|
TaggedError,
|
|
15
|
-
|
|
15
|
+
make15,
|
|
16
16
|
_await,
|
|
17
17
|
fail5,
|
|
18
18
|
succeed5,
|
|
@@ -93,10 +93,18 @@ import {
|
|
|
93
93
|
isMinLength,
|
|
94
94
|
isMaxLength,
|
|
95
95
|
fromJsonString,
|
|
96
|
+
toJsonValue,
|
|
97
|
+
isOneOf,
|
|
98
|
+
toJsonObject,
|
|
99
|
+
isBoolean2,
|
|
100
|
+
isNumber2,
|
|
101
|
+
isObject2,
|
|
102
|
+
isJsonObject,
|
|
103
|
+
isString2,
|
|
96
104
|
decodeJsonString,
|
|
97
105
|
encodeJsonStringSync,
|
|
98
106
|
encodePrettyJsonString
|
|
99
|
-
} from "./chunk-
|
|
107
|
+
} from "./chunk-x3cc7dfc.js";
|
|
100
108
|
import {
|
|
101
109
|
tap,
|
|
102
110
|
mapError,
|
|
@@ -108,7 +116,11 @@ import {
|
|
|
108
116
|
withDefault,
|
|
109
117
|
option,
|
|
110
118
|
String2
|
|
111
|
-
} from "./chunk-
|
|
119
|
+
} from "./chunk-y7vjk8vv.js";
|
|
120
|
+
import {
|
|
121
|
+
ChildProcessSpawner,
|
|
122
|
+
make2
|
|
123
|
+
} from "./chunk-892qrkb3.js";
|
|
112
124
|
import {
|
|
113
125
|
currentTimeMillis,
|
|
114
126
|
SecureRandom,
|
|
@@ -156,7 +168,7 @@ import {
|
|
|
156
168
|
digestSha256,
|
|
157
169
|
sha256Hasher,
|
|
158
170
|
raw,
|
|
159
|
-
|
|
171
|
+
make4,
|
|
160
172
|
get,
|
|
161
173
|
put,
|
|
162
174
|
HttpClient,
|
|
@@ -218,38 +230,24 @@ import {
|
|
|
218
230
|
harnessNames,
|
|
219
231
|
herdrRunnerCapabilities2,
|
|
220
232
|
declaredChecks
|
|
221
|
-
} from "./chunk-
|
|
233
|
+
} from "./chunk-9c9vrbh4.js";
|
|
222
234
|
import {
|
|
223
235
|
Id
|
|
224
|
-
} from "./chunk-
|
|
225
|
-
import {
|
|
226
|
-
toJsonValue,
|
|
227
|
-
isOneOf,
|
|
228
|
-
toJsonObject,
|
|
229
|
-
isBoolean,
|
|
230
|
-
isNumber,
|
|
231
|
-
isObject,
|
|
232
|
-
isJsonObject,
|
|
233
|
-
isString
|
|
234
|
-
} from "./chunk-c6rbt85q.js";
|
|
235
|
-
import {
|
|
236
|
-
ChildProcessSpawner,
|
|
237
|
-
make3
|
|
238
|
-
} from "./chunk-xwya1er0.js";
|
|
236
|
+
} from "./chunk-s8m2tzdr.js";
|
|
239
237
|
|
|
240
238
|
// apps/cli/src/cli-error.ts
|
|
241
239
|
function cliErrorCode(error, status) {
|
|
242
|
-
if (
|
|
240
|
+
if (isObject2(error) && error !== null && "code" in error && isString2(error.code))
|
|
243
241
|
return error.code;
|
|
244
242
|
if (status === 501)
|
|
245
243
|
return "CAPABILITY_UNSUPPORTED";
|
|
246
|
-
if (
|
|
244
|
+
if (isNumber2(status) && status >= 500)
|
|
247
245
|
return "INTERNAL_ERROR";
|
|
248
246
|
return "CLI_ERROR";
|
|
249
247
|
}
|
|
250
248
|
function cliErrorMessage(error) {
|
|
251
249
|
let message;
|
|
252
|
-
if (
|
|
250
|
+
if (isObject2(error) && error !== null && "responseMessage" in error && isString2(error.responseMessage))
|
|
253
251
|
message = error.responseMessage;
|
|
254
252
|
else if (error instanceof Error)
|
|
255
253
|
message = error.message;
|
|
@@ -258,7 +256,7 @@ function cliErrorMessage(error) {
|
|
|
258
256
|
return message.replace(/\s+/g, " ").trim().slice(0, 500);
|
|
259
257
|
}
|
|
260
258
|
function cliErrorJson(error) {
|
|
261
|
-
const field = (key) =>
|
|
259
|
+
const field = (key) => isObject2(error) && error !== null && (key in error) ? Object.getOwnPropertyDescriptor(error, key)?.value : undefined;
|
|
262
260
|
const status = field("status");
|
|
263
261
|
const code = cliErrorCode(error, status);
|
|
264
262
|
const retryable = field("retryable");
|
|
@@ -271,11 +269,11 @@ function cliErrorJson(error) {
|
|
|
271
269
|
contractVersion: "run.v1",
|
|
272
270
|
code,
|
|
273
271
|
message: cliErrorMessage(error),
|
|
274
|
-
retryable:
|
|
275
|
-
...
|
|
272
|
+
retryable: isBoolean2(retryable) ? retryable : code === "DURABILITY_UNAVAILABLE",
|
|
273
|
+
...isString2(requestId) ? { requestId } : undefined,
|
|
276
274
|
...details === undefined ? undefined : { details },
|
|
277
|
-
...
|
|
278
|
-
...
|
|
275
|
+
...isNumber2(retryAfterSeconds) ? { retryAfterSeconds } : undefined,
|
|
276
|
+
...isNumber2(currentResourceVersion) ? { currentResourceVersion } : undefined
|
|
279
277
|
}
|
|
280
278
|
};
|
|
281
279
|
}
|
|
@@ -877,7 +875,7 @@ function readRunnerCredentialFile(path) {
|
|
|
877
875
|
return gen(function* () {
|
|
878
876
|
const text = yield* flatMap3(FileSystem, (fs) => fs.readFileString(path));
|
|
879
877
|
const file = yield* decodeJsonString(text);
|
|
880
|
-
if (!isJsonObject(file) || !isStoredAgentCredential(file) || !
|
|
878
|
+
if (!isJsonObject(file) || !isStoredAgentCredential(file) || !isString2(file.apiUrl) || !isString2(file.runnerId) || file.hostId === undefined)
|
|
881
879
|
return yield* new CliError({ message: `${path} holds no Runner credential; pair again with --credential-file` });
|
|
882
880
|
return { apiUrl: file.apiUrl, runnerId: file.runnerId, credential: file };
|
|
883
881
|
});
|
|
@@ -987,10 +985,10 @@ var sandboxMissing = (sandbox, missing) => ({
|
|
|
987
985
|
var personalCheckBackend = (agentSandbox, dockerAvailable) => agentSandbox === "srt" || agentSandbox === "docker" && dockerAvailable ? agentSandbox : undefined;
|
|
988
986
|
var herdrCoreSession = (runnerId, personal) => personal ? undefined : `kitman-${sha2562(runnerId).slice(0, 16)}`;
|
|
989
987
|
var OpenHerdrCore = Reference("kitman/cli/OpenHerdrCore", {
|
|
990
|
-
defaultValue: () => (options) => flatMap3(promise(() => import("./chunk-
|
|
988
|
+
defaultValue: () => (options) => flatMap3(promise(() => import("./chunk-d8qcmqh5.js")), ({ HerdrCore, herdrCoreLayer }) => provide3(service(HerdrCore), herdrCoreLayer(options)))
|
|
991
989
|
});
|
|
992
990
|
var UpdateHerdrCore = Reference("kitman/cli/UpdateHerdrCore", {
|
|
993
|
-
defaultValue: () => (options) => flatMap3(promise(() => import("./chunk-
|
|
991
|
+
defaultValue: () => (options) => flatMap3(promise(() => import("./chunk-d8qcmqh5.js")), (module) => module.updateHerdrCore(options))
|
|
994
992
|
});
|
|
995
993
|
var herdrCoreMissing = (error) => {
|
|
996
994
|
if (isTagged(error, "HerdrCoreMissing"))
|
|
@@ -1410,7 +1408,7 @@ var syncTargets = (harness) => gen(function* () {
|
|
|
1410
1408
|
});
|
|
1411
1409
|
var syncKits = (input) => gen(function* () {
|
|
1412
1410
|
const fs = yield* FileSystem;
|
|
1413
|
-
const { syncKitSetup } = yield* promise(() => import("./chunk-
|
|
1411
|
+
const { syncKitSetup } = yield* promise(() => import("./chunk-mmpcdj8f.js"));
|
|
1414
1412
|
const harnesses = yield* syncTargets(input.harness);
|
|
1415
1413
|
const chain = yield* input.client.getKitChain(input.workspaceId);
|
|
1416
1414
|
for (const { name, problem } of chain.skipped)
|
|
@@ -1496,7 +1494,7 @@ function table(rows) {
|
|
|
1496
1494
|
const value = row[header];
|
|
1497
1495
|
if (value === undefined || value === null)
|
|
1498
1496
|
return "";
|
|
1499
|
-
return
|
|
1497
|
+
return isObject2(value) ? "[redacted]" : String(value);
|
|
1500
1498
|
};
|
|
1501
1499
|
const widths = headers.map((header) => Math.max(header.length, ...safeRows.map((row) => cell(row, header).length)));
|
|
1502
1500
|
return [
|
|
@@ -1926,7 +1924,7 @@ var ServiceManager = Reference("kitman/cli/ServiceManager", {
|
|
|
1926
1924
|
run: (command, args) => runCommand2(command, args),
|
|
1927
1925
|
attach: (command, args) => gen(function* () {
|
|
1928
1926
|
const spawner = yield* ChildProcessSpawner;
|
|
1929
|
-
const handle = yield* spawner.spawn(
|
|
1927
|
+
const handle = yield* spawner.spawn(make2(command, args, { stdin: "inherit", stdout: "inherit", stderr: "inherit" }));
|
|
1930
1928
|
const exitCode = yield* handle.exitCode;
|
|
1931
1929
|
if (exitCode !== 0)
|
|
1932
1930
|
return yield* new CommandFailed2({ command, reason: `exit code ${exitCode}` });
|
|
@@ -2328,7 +2326,7 @@ var package_default = {
|
|
|
2328
2326
|
};
|
|
2329
2327
|
|
|
2330
2328
|
// apps/cli/src/scaffold.ts
|
|
2331
|
-
var cliVersion = "0.12.0-rc.
|
|
2329
|
+
var cliVersion = "0.12.0-rc.8";
|
|
2332
2330
|
var packageJson = (name, scaffold) => `${JSON.stringify({
|
|
2333
2331
|
name,
|
|
2334
2332
|
private: true,
|
|
@@ -2480,7 +2478,7 @@ var scaffoldKit = (directory, scaffold = {}) => gen(function* () {
|
|
|
2480
2478
|
|
|
2481
2479
|
// apps/cli/src/commands.ts
|
|
2482
2480
|
var ClientId = "kitman-cli";
|
|
2483
|
-
var agentRuntime = promise(() => import("./chunk-
|
|
2481
|
+
var agentRuntime = promise(() => import("./chunk-3cgshf16.js"));
|
|
2484
2482
|
var TuiLauncher = Reference("kitman/cli/TuiLauncher", {
|
|
2485
2483
|
defaultValue: () => gen(function* () {
|
|
2486
2484
|
const tui = yield* tryPromise({
|
|
@@ -3482,7 +3480,7 @@ var SandboxHostProbe = Reference("kitman/cli/SandboxHostProbe", {
|
|
|
3482
3480
|
});
|
|
3483
3481
|
var OpenRunnerRpc = Reference("kitman/cli/OpenRunnerRpc", {
|
|
3484
3482
|
defaultValue: () => (options) => gen(function* () {
|
|
3485
|
-
const { makeRunnerRpcClient, runnerRpcUrl, runnerWebSocketProtocol } = yield* promise(() => import("./chunk-
|
|
3483
|
+
const { makeRunnerRpcClient, runnerRpcUrl, runnerWebSocketProtocol } = yield* promise(() => import("./chunk-ey4mf341.js"));
|
|
3486
3484
|
return yield* makeRunnerRpcClient({
|
|
3487
3485
|
runnerId: options.runnerId,
|
|
3488
3486
|
bearer: options.bearer,
|
|
@@ -3762,7 +3760,7 @@ function startCanonicalHerdrRunnerCommand(input) {
|
|
|
3762
3760
|
const checkouts = runCheckouts(path.join(runnerRootDir, ".kitman"), rpc.gitCredential);
|
|
3763
3761
|
yield* controlPlane.client.listRepoBindings(runner.workspaceId).pipe(flatMap3(({ items }) => forEach(items.filter((binding) => binding.status === "active" && (teamId === undefined || binding.teamId === teamId)), (repoBinding) => map8(checkouts.reaches(repoBinding), (reachable) => ({ repoBinding, reachable })), { concurrency: 4 })), tap2((probed) => sync2(() => reached = probed)), catch_((error) => logWarning("runner_repository_probe_failed", error.message)), flatMap3(() => sleep(reached.some((probe) => !probe.reachable) ? repositoryRetryInterval : repositoryProbeInterval)), forever, forkScoped);
|
|
3764
3762
|
const platform = yield* context();
|
|
3765
|
-
const updated = yield*
|
|
3763
|
+
const updated = yield* make15();
|
|
3766
3764
|
const scope = yield* scope2;
|
|
3767
3765
|
const startUpdate = (update) => update.pipe(catch_((error) => andThen2(restartOntoUpdate(input.runnerId), fail5(updated, error))), provideContext2(platform), forkIn(scope), asVoid);
|
|
3768
3766
|
const refusedForProtocol = container ? updater.stopWhenDrained(new RunnerStopped({ problem: updateRequired })).pipe(catch_((stopped) => fail5(updated, stopped)), forkIn(scope), asVoid) : startUpdate(updater.updateRequired);
|
|
@@ -4014,7 +4012,7 @@ function mcpCommand(args) {
|
|
|
4014
4012
|
if (command.action === "run") {
|
|
4015
4013
|
if (command.args.length > 0)
|
|
4016
4014
|
return yield* new CliError({ message: `Unknown command: ${args.join(" ")}` });
|
|
4017
|
-
const { runMcpServerCommand } = yield* promise(() => import("./chunk-
|
|
4015
|
+
const { runMcpServerCommand } = yield* promise(() => import("./chunk-dh09wyed.js"));
|
|
4018
4016
|
return yield* runMcpServerCommand({ flags: command.flags });
|
|
4019
4017
|
}
|
|
4020
4018
|
if (command.action !== "setup")
|
|
@@ -4502,7 +4500,7 @@ function programLoopCommand(command) {
|
|
|
4502
4500
|
return yield* new CliError({ message: `Unknown loop command: ${command.action}` });
|
|
4503
4501
|
});
|
|
4504
4502
|
}
|
|
4505
|
-
var docsModule = promise(() => import("./chunk-
|
|
4503
|
+
var docsModule = promise(() => import("./chunk-9q7qc1dg.js"));
|
|
4506
4504
|
function docsCommand(args) {
|
|
4507
4505
|
return gen(function* () {
|
|
4508
4506
|
const command = parseCommand(args);
|
|
@@ -4663,7 +4661,7 @@ var answerInTerminal = (client, runId, questions) => forEach(questions, (questio
|
|
|
4663
4661
|
const key = yield* idempotencyKey(undefined, "run-answer");
|
|
4664
4662
|
yield* client.answerRun(runId, { value: reply.answer, question: question.id, idempotencyKey: key }).pipe(andThen2(log(`Answered ${question.stepKey}: ${reply.answer}`)), catchIf((error) => error instanceof KitmanClientError && error.code === "question_not_open", (error) => log(`Not answered: ${question.stepKey} was settled while it waited here. ${error.responseMessage ?? error.message}`)));
|
|
4665
4663
|
}), { discard: true });
|
|
4666
|
-
var claimLines = (step) => step.output === undefined ? [] : isJsonObject(toJsonValue(step.output)) ? Object.entries(toJsonObject(step.output)).map(([field, value]) => ` Claim ${field}: ${
|
|
4664
|
+
var claimLines = (step) => step.output === undefined ? [] : isJsonObject(toJsonValue(step.output)) ? Object.entries(toJsonObject(step.output)).map(([field, value]) => ` Claim ${field}: ${isString2(value) ? value : encodeJsonStringSync(value)}`) : [` Claim: ${encodeJsonStringSync(toJsonValue(step.output))}`];
|
|
4667
4665
|
var evidenceLines = (evidence) => evidence.flatMap((entry) => {
|
|
4668
4666
|
const neverRan = [
|
|
4669
4667
|
...(entry.newNotRun ?? []).map((test) => ` Never ran: ${test} (new)`),
|
|
@@ -5335,9 +5333,9 @@ function changeRequestCommand(args) {
|
|
|
5335
5333
|
yield* log(command.action === "approve" ? `Approved ${short} of ${changeRequest.title}. A Run waiting on approval of ${short} resumes; one waiting on another head does not.` : `Requested changes to ${short} of ${changeRequest.title}`);
|
|
5336
5334
|
});
|
|
5337
5335
|
}
|
|
5338
|
-
var KitWriter = map8(promise(() => import("./chunk-
|
|
5336
|
+
var KitWriter = map8(promise(() => import("./chunk-6pqxsnk1.js")), (build) => build.writeKit);
|
|
5339
5337
|
var KitBuilder = Reference("kitman/cli/KitBuilder", {
|
|
5340
|
-
defaultValue: () => (directory) => flatMap3(promise(() => import("./chunk-
|
|
5338
|
+
defaultValue: () => (directory) => flatMap3(promise(() => import("./chunk-6pqxsnk1.js")), (build) => build.buildKit(directory))
|
|
5341
5339
|
});
|
|
5342
5340
|
var uploadKit = (client, workspaceId, built) => gen(function* () {
|
|
5343
5341
|
yield* client.uploadKitBundle(workspaceId, built.digest, { bundle: encode2(built.bundle) });
|
|
@@ -5372,7 +5370,7 @@ var ciIdToken = (apiUrl) => gen(function* () {
|
|
|
5372
5370
|
const body = yield* response.text.pipe(mapError2((error) => refused(error.message)));
|
|
5373
5371
|
const issued = yield* decodeJsonString(body).pipe(mapError2(() => refused("the answer is not JSON")));
|
|
5374
5372
|
const token = isJsonObject(issued) ? issued.value : undefined;
|
|
5375
|
-
return
|
|
5373
|
+
return isString2(token) ? token : yield* refused("the answer has no value");
|
|
5376
5374
|
});
|
|
5377
5375
|
var kitScope = (command, options = {}) => gen(function* () {
|
|
5378
5376
|
const apiUrl = yield* resolveApiUrl(command.flags.apiUrl);
|
|
@@ -5687,7 +5685,7 @@ function printOperationalResult(command, value) {
|
|
|
5687
5685
|
function operationalSummaryRows(value) {
|
|
5688
5686
|
if (Array.isArray(value))
|
|
5689
5687
|
return value.length === 0 ? [{ status: "ok", items: 0 }] : value.map(operationalItemRow);
|
|
5690
|
-
if (!
|
|
5688
|
+
if (!isObject2(value) || value === null)
|
|
5691
5689
|
return [{ status: "ok" }];
|
|
5692
5690
|
const items = "items" in value ? value.items : undefined;
|
|
5693
5691
|
if (Array.isArray(items)) {
|
|
@@ -5714,15 +5712,15 @@ function operationalItemRow(value) {
|
|
|
5714
5712
|
};
|
|
5715
5713
|
}
|
|
5716
5714
|
function fieldValues(value, keys) {
|
|
5717
|
-
if (!
|
|
5715
|
+
if (!isObject2(value) || value === null || Array.isArray(value))
|
|
5718
5716
|
return [];
|
|
5719
5717
|
return keys.map((key) => Object.getOwnPropertyDescriptor(value, key)?.value);
|
|
5720
5718
|
}
|
|
5721
5719
|
function readString(value, keys) {
|
|
5722
|
-
return fieldValues(value, keys).find(
|
|
5720
|
+
return fieldValues(value, keys).find(isString2);
|
|
5723
5721
|
}
|
|
5724
5722
|
function readNumber(value, keys) {
|
|
5725
|
-
return fieldValues(value, keys).find(
|
|
5723
|
+
return fieldValues(value, keys).find(isNumber2);
|
|
5726
5724
|
}
|
|
5727
5725
|
function loopListQuery(teamId, limit) {
|
|
5728
5726
|
const query = new URLSearchParams({ teamId });
|
|
@@ -6113,7 +6111,7 @@ function downloadPresignedAsset(download, outputPath) {
|
|
|
6113
6111
|
return gen(function* () {
|
|
6114
6112
|
const fs = yield* FileSystem;
|
|
6115
6113
|
const failed = (cause) => new CliError({ message: `Asset download failed: ${String(cause)}` });
|
|
6116
|
-
const response = yield* send(
|
|
6114
|
+
const response = yield* send(make4(download.method)(download.url), failed);
|
|
6117
6115
|
if (response.status < 200 || response.status >= 300)
|
|
6118
6116
|
return yield* new CliError({ message: `Asset download failed with ${response.status}` });
|
|
6119
6117
|
const body = yield* response.arrayBuffer.pipe(mapError2((error) => failed(error.message)));
|
|
@@ -13,11 +13,11 @@ import {
|
|
|
13
13
|
ArraySchema,
|
|
14
14
|
decodeJsonStringOption,
|
|
15
15
|
encodeUnknownJsonStringSync
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-x3cc7dfc.js";
|
|
17
17
|
import {
|
|
18
18
|
replaceSecretReferences,
|
|
19
19
|
secretReferencesIn
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-s8m2tzdr.js";
|
|
21
21
|
|
|
22
22
|
// packages/agent-runtime/src/srt-step.ts
|
|
23
23
|
import { SandboxRuntimeConfigSchema } from "@anthropic-ai/sandbox-runtime";
|
|
@@ -21,22 +21,20 @@ import {
|
|
|
21
21
|
Literals,
|
|
22
22
|
NullOr,
|
|
23
23
|
Finite,
|
|
24
|
-
|
|
25
|
-
} from "./chunk-vtfwjhzh.js";
|
|
26
|
-
import {
|
|
27
|
-
isNumber,
|
|
24
|
+
isNumber2,
|
|
28
25
|
isJsonObject,
|
|
29
|
-
|
|
30
|
-
|
|
26
|
+
isString2,
|
|
27
|
+
encodeUnknownJsonStringSync
|
|
28
|
+
} from "./chunk-x3cc7dfc.js";
|
|
31
29
|
import {
|
|
32
|
-
|
|
30
|
+
make10,
|
|
33
31
|
runForEach,
|
|
34
32
|
compiled2
|
|
35
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-y7vjk8vv.js";
|
|
36
34
|
import {
|
|
37
35
|
ChildProcessSpawner,
|
|
38
|
-
|
|
39
|
-
} from "./chunk-
|
|
36
|
+
make2
|
|
37
|
+
} from "./chunk-892qrkb3.js";
|
|
40
38
|
|
|
41
39
|
// packages/agent-runtime/src/opencode-store.ts
|
|
42
40
|
import { lstatSync, readFileSync, realpathSync } from "fs";
|
|
@@ -78,12 +76,12 @@ var decodedParts = (db, ids) => {
|
|
|
78
76
|
while (reached < ids.length && bytes < sliceBytes2) {
|
|
79
77
|
const id = ids[reached++];
|
|
80
78
|
const row = id === undefined ? undefined : statement.get(id);
|
|
81
|
-
if (id !== undefined &&
|
|
82
|
-
const message =
|
|
83
|
-
const part =
|
|
84
|
-
bytes +=
|
|
79
|
+
if (id !== undefined && isNumber2(row?.position)) {
|
|
80
|
+
const message = isString2(row.message) ? decoded2(row.message) : undefined;
|
|
81
|
+
const part = isString2(row.part) ? decoded2(row.part) : undefined;
|
|
82
|
+
bytes += isString2(row.part) ? row.part.length : 0;
|
|
85
83
|
const role = isJsonObject(message) ? message.role : undefined;
|
|
86
|
-
const shortRole =
|
|
84
|
+
const shortRole = isString2(role) && role.length <= maxRoleChars ? role : null;
|
|
87
85
|
parts.push({ id, position: row.position, role: shortRole, part: part ?? null });
|
|
88
86
|
}
|
|
89
87
|
}
|
|
@@ -93,7 +91,7 @@ var partsPast = "from part join message on message.id = part.message_id where pa
|
|
|
93
91
|
var opencodeV2Parts = (db, hasPartTable, id, data) => {
|
|
94
92
|
const rows = hasPartTable ? db.prepare("select ordinal, data from session_part where message_id = ? order by ordinal").all(id) : [];
|
|
95
93
|
if (rows.length > 0)
|
|
96
|
-
return rows.flatMap((row) =>
|
|
94
|
+
return rows.flatMap((row) => isNumber2(row.ordinal) && isString2(row.data) ? [{ ordinal: row.ordinal, part: decoded2(row.data) ?? null }] : []);
|
|
97
95
|
const content = isJsonObject(data) ? data.content : undefined;
|
|
98
96
|
return Array.isArray(content) ? content.map((part, ordinal) => ({ ordinal, part })) : [];
|
|
99
97
|
};
|
|
@@ -110,14 +108,14 @@ var readings = {
|
|
|
110
108
|
const present = new Set(db.prepare("select name from sqlite_master where type = 'table'").all().map((row) => row.name));
|
|
111
109
|
const newest = opencodeSessionTables.filter(({ table }) => present.has(table)).flatMap(({ table, kind }) => {
|
|
112
110
|
const row = db.prepare(`select id, time_created from ${table} where directory = ? and parent_id is null and time_created >= ? order by time_created desc limit 1`).get(worktree, startedAt);
|
|
113
|
-
return
|
|
111
|
+
return isString2(row?.id) && isNumber2(row.time_created) ? [{ kind, id: row.id, createdAt: row.time_created }] : [];
|
|
114
112
|
});
|
|
115
113
|
return newest.reduce((best, session) => best === null || session.createdAt > best.createdAt ? session : best, null);
|
|
116
114
|
}),
|
|
117
115
|
parts: reading(Struct({ parts: ArraySchema(PartSchema), rest: ArraySchema(String4) }), (db, { ids }) => decodedParts(db, ids)),
|
|
118
116
|
partsPast: reading(ArraySchema(PartSchema), (db, { position }, sessionId) => {
|
|
119
117
|
const rows = db.prepare(`select part.id as id ${partsPast} order by part.rowid limit ?`).all(sessionId, position, linesPerTurn2);
|
|
120
|
-
return decodedParts(db, rows.flatMap((row) =>
|
|
118
|
+
return decodedParts(db, rows.flatMap((row) => isString2(row.id) ? [row.id] : [])).parts;
|
|
121
119
|
}),
|
|
122
120
|
partsPastCount: reading(Finite, (db, { position }, sessionId) => Number(db.prepare(`select count(*) as parts ${partsPast}`).get(sessionId, position)?.parts)),
|
|
123
121
|
messagesPast: reading(ArraySchema(OpencodeV2MessageSchema), (db, { seq }, sessionId) => {
|
|
@@ -130,7 +128,7 @@ var readings = {
|
|
|
130
128
|
for (const [index, row] of found.slice(0, linesPerTurn2).entries()) {
|
|
131
129
|
if (bytes >= sliceBytes2)
|
|
132
130
|
break;
|
|
133
|
-
if (!
|
|
131
|
+
if (!isString2(row.id) || !isNumber2(row.seq) || !isNumber2(row.size))
|
|
134
132
|
continue;
|
|
135
133
|
const closed = row.completed === 1 || index < found.length - 1;
|
|
136
134
|
if (row.size > maxLineBytes2) {
|
|
@@ -139,7 +137,7 @@ var readings = {
|
|
|
139
137
|
}
|
|
140
138
|
const data = read.get(row.id)?.data;
|
|
141
139
|
bytes += row.size;
|
|
142
|
-
const parts = opencodeV2Parts(db, hasPartTable, row.id,
|
|
140
|
+
const parts = opencodeV2Parts(db, hasPartTable, row.id, isString2(data) ? decoded2(data) : undefined);
|
|
143
141
|
messages.push({ id: row.id, seq: row.seq, closed, parts: parts.length > maxPartsPerMessage ? null : parts });
|
|
144
142
|
}
|
|
145
143
|
return messages;
|
|
@@ -147,7 +145,7 @@ var readings = {
|
|
|
147
145
|
lastError: reading(Parsed, (db, { v2 }, sessionId) => {
|
|
148
146
|
const error = unlessLong("json_extract(data, '$.error')");
|
|
149
147
|
const row = v2 ? db.prepare(`select ${error} as error from session_message where session_id = ? and type = 'assistant' order by seq desc limit 1`).get(sessionId) : db.prepare(`select ${error} as error from message where session_id = ? and json_extract(data, '$.role') = 'assistant' order by time_created desc, rowid desc limit 1`).get(sessionId);
|
|
150
|
-
return
|
|
148
|
+
return isString2(row?.error) ? decoded2(row.error) ?? null : null;
|
|
151
149
|
}),
|
|
152
150
|
extent: reading(Finite, (db, _input, sessionId) => Number(db.prepare(`with recursive sessions(id) as (select ? union select session_v2.id from session_v2 join sessions on session_v2.parent_id = sessions.id)
|
|
153
151
|
select coalesce(max(time_updated), 0) as extent from session_message where session_id in sessions`).get(sessionId)?.extent))
|
|
@@ -169,8 +167,8 @@ var opencodeReaderCommand = () => compiled2 ? [process.execPath, "opencode-read"
|
|
|
169
167
|
var isolatedRead = (store, name, input) => gen(function* () {
|
|
170
168
|
const spawner = yield* ChildProcessSpawner;
|
|
171
169
|
const [command, ...args] = opencodeReaderCommand();
|
|
172
|
-
const handle = yield* spawner.spawn(
|
|
173
|
-
stdin:
|
|
170
|
+
const handle = yield* spawner.spawn(make2(command, args, {
|
|
171
|
+
stdin: make10(new TextEncoder().encode(encodeUnknownJsonStringSync({ store, name, input }))),
|
|
174
172
|
stderr: "ignore",
|
|
175
173
|
extendEnv: false,
|
|
176
174
|
env: {},
|
|
@@ -215,10 +213,10 @@ var runOpencodeReader2 = () => {
|
|
|
215
213
|
if (!isJsonObject(request) || !isJsonObject(request.store))
|
|
216
214
|
throw new Error("No request");
|
|
217
215
|
const { database, sessionId, confinedTo } = request.store;
|
|
218
|
-
if (!
|
|
216
|
+
if (!isString2(database) || !isString2(confinedTo))
|
|
219
217
|
throw new Error("No confined database");
|
|
220
218
|
assertConfined(database, confinedTo);
|
|
221
|
-
const store = { database, confinedTo, ...
|
|
219
|
+
const store = { database, confinedTo, ...isString2(sessionId) ? { sessionId } : undefined };
|
|
222
220
|
const reading = request.name;
|
|
223
221
|
const input = request.input;
|
|
224
222
|
process.stdout.write(encodeUnknownJsonStringSync(answerFrom(store, reading, input, true)));
|