@kitman-sh/cli 0.12.0-rc.7 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-gspfm7qh.js → chunk-0h49y8gf.js} +1 -1
- package/dist/{chunk-pd2vz4bm.js → chunk-0wdm7br1.js} +13 -15
- package/dist/{chunk-xcf887a4.js → chunk-4k5jfyqd.js} +39 -41
- package/dist/{chunk-znar1th3.js → chunk-4x06mdcd.js} +4 -4
- package/dist/{chunk-0346hwh6.js → chunk-5zhh41gb.js} +4 -5
- package/dist/{chunk-ewhzaqp3.js → chunk-5zth85pj.js} +2 -2
- package/dist/{chunk-j5t5nye5.js → chunk-cb78rzqd.js} +4 -4
- package/dist/{chunk-56knbdt6.js → chunk-cbpb2rww.js} +19 -21
- package/dist/{chunk-nzjb36ad.js → chunk-gq7y5v3e.js} +1 -1
- package/dist/{chunk-z450wa10.js → chunk-gy9rf14f.js} +3 -4
- package/dist/{chunk-xe8qf2xy.js → chunk-h3em3y8r.js} +111 -113
- package/dist/{chunk-bheg4ybe.js → chunk-mjdt8wbv.js} +18 -19
- package/dist/{chunk-xwya1er0.js → chunk-mtkstrh3.js} +4 -4
- package/dist/{chunk-qrm334c6.js → chunk-pf13sv65.js} +4 -4
- package/dist/{chunk-0qz10ek8.js → chunk-q5w3v4k1.js} +4 -4
- package/dist/{chunk-15geyg2d.js → chunk-qj6gjtdd.js} +87 -90
- package/dist/{chunk-wc2kba4z.js → chunk-s6z4aqag.js} +6 -7
- package/dist/{chunk-1t12wvv1.js → chunk-shv2xs9y.js} +92 -94
- package/dist/{chunk-r5sw3fe0.js → chunk-vw462m91.js} +10 -12
- package/dist/{chunk-8twjqszj.js → chunk-wh2ep6fc.js} +1 -1
- package/dist/{chunk-4w4spvb1.js → chunk-wyhg9cyk.js} +3 -3
- package/dist/{chunk-2e91ymwn.js → chunk-xaspqegt.js} +1 -1
- package/dist/{chunk-e4an66v2.js → chunk-xsdceanv.js} +5 -5
- package/dist/{chunk-5j848ckb.js → chunk-y1krmnbv.js} +2 -2
- package/dist/{chunk-vtfwjhzh.js → chunk-zw3gf6r5.js} +154 -24
- package/dist/index.js +4 -4
- package/package.json +1 -1
- package/dist/chunk-c6rbt85q.js +0 -141
|
@@ -201,7 +201,7 @@ import {
|
|
|
201
201
|
String4,
|
|
202
202
|
toCodecStringTree,
|
|
203
203
|
encodeUnknownJsonStringSync
|
|
204
|
-
} from "./chunk-
|
|
204
|
+
} from "./chunk-zw3gf6r5.js";
|
|
205
205
|
|
|
206
206
|
// node_modules/.bun/effect@4.1.2/node_modules/effect/dist/Iterable.js
|
|
207
207
|
var headUnsafe = (self) => {
|
|
@@ -21,27 +21,25 @@ import {
|
|
|
21
21
|
provideService,
|
|
22
22
|
scoped,
|
|
23
23
|
fnUntraced,
|
|
24
|
+
isJsonObject,
|
|
25
|
+
isString2,
|
|
24
26
|
encodePrettyJsonString,
|
|
25
27
|
decodeJsonStringSync
|
|
26
|
-
} from "./chunk-
|
|
27
|
-
import {
|
|
28
|
-
isJsonObject,
|
|
29
|
-
isString
|
|
30
|
-
} from "./chunk-c6rbt85q.js";
|
|
28
|
+
} from "./chunk-zw3gf6r5.js";
|
|
31
29
|
import {
|
|
32
30
|
FileSystem,
|
|
33
31
|
Path,
|
|
34
32
|
optionalEnv,
|
|
35
33
|
tempDirectoryScoped
|
|
36
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-0h49y8gf.js";
|
|
37
35
|
import {
|
|
38
36
|
AgentHarnessIds,
|
|
39
37
|
sha2562,
|
|
40
38
|
runCommand2
|
|
41
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-shv2xs9y.js";
|
|
42
40
|
import {
|
|
43
41
|
NpmRegistry
|
|
44
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-xsdceanv.js";
|
|
45
43
|
|
|
46
44
|
// packages/agent-runtime/src/config-convergence.ts
|
|
47
45
|
var writeAgentEnvironmentConfigFile2 = fnUntraced(function* (file, content, keep = {}) {
|
|
@@ -106,13 +104,13 @@ var readManagedNamesForConfig = (paths, file) => gen(function* () {
|
|
|
106
104
|
return {
|
|
107
105
|
mcpNames: new Set(servers.flatMap((entry) => {
|
|
108
106
|
const item = objectValue(objectValue(entry).item);
|
|
109
|
-
return
|
|
107
|
+
return isString2(item.name) ? [item.name] : [];
|
|
110
108
|
})),
|
|
111
109
|
packageNames: new Set(plugins.flatMap((entry) => {
|
|
112
110
|
const { source: legacySource, sources } = objectValue(objectValue(entry).item);
|
|
113
111
|
return (Array.isArray(sources) ? sources : legacySource === undefined ? [] : [legacySource]).flatMap((source) => {
|
|
114
112
|
const { kind, packageName } = objectValue(source);
|
|
115
|
-
return kind === "package" &&
|
|
113
|
+
return kind === "package" && isString2(packageName) ? [packageName] : [];
|
|
116
114
|
});
|
|
117
115
|
})),
|
|
118
116
|
skillPaths: manifestSkillPaths(manifest)
|
|
@@ -122,7 +120,7 @@ function manifestSkillPaths(manifest) {
|
|
|
122
120
|
const materializedSkills = Array.isArray(manifest.materializedSkills) ? manifest.materializedSkills : [];
|
|
123
121
|
return new Set(materializedSkills.flatMap((entry) => {
|
|
124
122
|
const item = objectValue(entry);
|
|
125
|
-
return
|
|
123
|
+
return isString2(item.skillPath) ? [item.skillPath] : [];
|
|
126
124
|
}));
|
|
127
125
|
}
|
|
128
126
|
var readManifestSkillPaths2 = (manifestPath) => map8(readExistingText(manifestPath), (text) => manifestSkillPaths(parseJsonObject(text)));
|
|
@@ -210,7 +208,7 @@ function mergeOpenCodeConfig(existingText, generatedText, managedMcpNames, manag
|
|
|
210
208
|
`;
|
|
211
209
|
}
|
|
212
210
|
function isManagedPackageReference(entry, managedPackageNames, prefix = "") {
|
|
213
|
-
if (!
|
|
211
|
+
if (!isString2(entry))
|
|
214
212
|
return false;
|
|
215
213
|
for (const name of managedPackageNames) {
|
|
216
214
|
if (entry === `${prefix}${name}` || entry.startsWith(`${prefix}${name}@`))
|
|
@@ -253,7 +251,7 @@ function uniquePackageEntries(values) {
|
|
|
253
251
|
const seen = new Set;
|
|
254
252
|
const result = [];
|
|
255
253
|
for (const value of values) {
|
|
256
|
-
const key =
|
|
254
|
+
const key = isString2(value) ? `string:${value}` : `json:${JSON.stringify(value)}`;
|
|
257
255
|
if (seen.has(key))
|
|
258
256
|
continue;
|
|
259
257
|
seen.add(key);
|
|
@@ -390,7 +388,7 @@ function codexSkillPathFromBlock(block) {
|
|
|
390
388
|
for (const line of block) {
|
|
391
389
|
const match = /^path\s*=\s*"((?:\\"|[^"])*)"/.exec(line.trim());
|
|
392
390
|
const value = match === null ? undefined : decodeJsonStringSync(`"${match[1]}"`);
|
|
393
|
-
if (
|
|
391
|
+
if (isString2(value))
|
|
394
392
|
return value;
|
|
395
393
|
}
|
|
396
394
|
}
|
|
@@ -411,7 +409,7 @@ function objectValue(value) {
|
|
|
411
409
|
return isJsonObject(value) ? value : {};
|
|
412
410
|
}
|
|
413
411
|
function arrayValue(value) {
|
|
414
|
-
return Array.isArray(value) ? value.filter((item) =>
|
|
412
|
+
return Array.isArray(value) ? value.filter((item) => isString2(item)) : [];
|
|
415
413
|
}
|
|
416
414
|
function uniqueStrings(values) {
|
|
417
415
|
return [...new Set(values)];
|
|
@@ -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-zw3gf6r5.js";
|
|
100
108
|
import {
|
|
101
109
|
tap,
|
|
102
110
|
mapError,
|
|
@@ -108,7 +116,7 @@ import {
|
|
|
108
116
|
withDefault,
|
|
109
117
|
option,
|
|
110
118
|
String2
|
|
111
|
-
} from "./chunk-
|
|
119
|
+
} from "./chunk-0h49y8gf.js";
|
|
112
120
|
import {
|
|
113
121
|
currentTimeMillis,
|
|
114
122
|
SecureRandom,
|
|
@@ -218,38 +226,28 @@ import {
|
|
|
218
226
|
harnessNames,
|
|
219
227
|
herdrRunnerCapabilities2,
|
|
220
228
|
declaredChecks
|
|
221
|
-
} from "./chunk-
|
|
229
|
+
} from "./chunk-shv2xs9y.js";
|
|
222
230
|
import {
|
|
223
231
|
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";
|
|
232
|
+
} from "./chunk-q5w3v4k1.js";
|
|
235
233
|
import {
|
|
236
234
|
ChildProcessSpawner,
|
|
237
235
|
make3
|
|
238
|
-
} from "./chunk-
|
|
236
|
+
} from "./chunk-mtkstrh3.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-4x06mdcd.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-4x06mdcd.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-vw462m91.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 [
|
|
@@ -2328,7 +2326,7 @@ var package_default = {
|
|
|
2328
2326
|
};
|
|
2329
2327
|
|
|
2330
2328
|
// apps/cli/src/scaffold.ts
|
|
2331
|
-
var cliVersion = "0.12.0
|
|
2329
|
+
var cliVersion = "0.12.0";
|
|
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-qj6gjtdd.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-s6z4aqag.js"));
|
|
3486
3484
|
return yield* makeRunnerRpcClient({
|
|
3487
3485
|
runnerId: options.runnerId,
|
|
3488
3486
|
bearer: options.bearer,
|
|
@@ -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-h3em3y8r.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-wh2ep6fc.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-mjdt8wbv.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-mjdt8wbv.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 });
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import"./chunk-
|
|
2
|
+
import"./chunk-mtkstrh3.js";
|
|
3
3
|
import {
|
|
4
4
|
HERDR_CORE_GENERATION2,
|
|
5
5
|
HERDR_CORE_INSTALL_COMMAND2,
|
|
@@ -12,9 +12,9 @@ import {
|
|
|
12
12
|
herdrCoreLayer2,
|
|
13
13
|
herdrCoreTransportLayer2,
|
|
14
14
|
updateHerdrCore2
|
|
15
|
-
} from "./chunk-
|
|
16
|
-
import"./chunk-
|
|
17
|
-
import"./chunk-
|
|
15
|
+
} from "./chunk-shv2xs9y.js";
|
|
16
|
+
import"./chunk-0h49y8gf.js";
|
|
17
|
+
import"./chunk-zw3gf6r5.js";
|
|
18
18
|
export {
|
|
19
19
|
HERDR_CORE_GENERATION2 as HERDR_CORE_GENERATION,
|
|
20
20
|
HERDR_CORE_INSTALL_COMMAND2 as HERDR_CORE_INSTALL_COMMAND,
|
|
@@ -7,11 +7,10 @@ import {
|
|
|
7
7
|
decoded2,
|
|
8
8
|
readOpencode2,
|
|
9
9
|
runOpencodeReader2
|
|
10
|
-
} from "./chunk-
|
|
11
|
-
import"./chunk-
|
|
12
|
-
import"./chunk-
|
|
13
|
-
import"./chunk-
|
|
14
|
-
import"./chunk-vtfwjhzh.js";
|
|
10
|
+
} from "./chunk-cbpb2rww.js";
|
|
11
|
+
import"./chunk-mtkstrh3.js";
|
|
12
|
+
import"./chunk-0h49y8gf.js";
|
|
13
|
+
import"./chunk-zw3gf6r5.js";
|
|
15
14
|
export {
|
|
16
15
|
decoded2 as decoded,
|
|
17
16
|
decodedOption2 as decodedOption,
|
|
@@ -14,8 +14,8 @@ import {
|
|
|
14
14
|
writeSrtSettings2,
|
|
15
15
|
srtStepArgv2,
|
|
16
16
|
srtArgv2
|
|
17
|
-
} from "./chunk-
|
|
18
|
-
import"./chunk-
|
|
17
|
+
} from "./chunk-0h49y8gf.js";
|
|
18
|
+
import"./chunk-zw3gf6r5.js";
|
|
19
19
|
export {
|
|
20
20
|
compiled2 as compiled,
|
|
21
21
|
harnessesUnsupportedInSrt2 as harnessesUnsupportedInSrt,
|
|
@@ -6,10 +6,10 @@ import {
|
|
|
6
6
|
gen,
|
|
7
7
|
flatMap3,
|
|
8
8
|
provideContext2
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-zw3gf6r5.js";
|
|
10
10
|
import {
|
|
11
11
|
runForEach
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-0h49y8gf.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-
|
|
22
|
+
} from "./chunk-shv2xs9y.js";
|
|
23
23
|
import {
|
|
24
24
|
layerJson,
|
|
25
25
|
make4,
|
|
26
26
|
withHeaders,
|
|
27
27
|
layerProtocolSocket
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-wyhg9cyk.js";
|
|
29
29
|
|
|
30
30
|
// packages/live/src/rpc/runner-client.ts
|
|
31
31
|
var proxiedWebSocket = (proxy) => succeed5(WebSocketConstructor)((target) => {
|
|
@@ -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-zw3gf6r5.js";
|
|
31
29
|
import {
|
|
32
30
|
make11,
|
|
33
31
|
runForEach,
|
|
34
32
|
compiled2
|
|
35
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-0h49y8gf.js";
|
|
36
34
|
import {
|
|
37
35
|
ChildProcessSpawner,
|
|
38
36
|
make3
|
|
39
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-mtkstrh3.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))
|
|
@@ -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)));
|
|
@@ -4,10 +4,9 @@ import {
|
|
|
4
4
|
opaqueTunnelRefusal2,
|
|
5
5
|
isOpaqueConnectReason2,
|
|
6
6
|
runSrtStep2
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import"./chunk-
|
|
9
|
-
import"./chunk-
|
|
10
|
-
import"./chunk-vtfwjhzh.js";
|
|
7
|
+
} from "./chunk-y1krmnbv.js";
|
|
8
|
+
import"./chunk-q5w3v4k1.js";
|
|
9
|
+
import"./chunk-zw3gf6r5.js";
|
|
11
10
|
export {
|
|
12
11
|
isOpaqueConnectReason2 as isOpaqueConnectReason,
|
|
13
12
|
opaqueTunnelRefusal2 as opaqueTunnelRefusal,
|