@kitman-sh/cli 0.13.15 → 0.13.17
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-6z499mrc.js → chunk-0vv8cbye.js} +40 -28
- package/dist/{chunk-3syr8kyv.js → chunk-1cr225aq.js} +5 -5
- package/dist/{chunk-gq7y5v3e.js → chunk-24h0y27w.js} +1 -1
- package/dist/{chunk-ydz5ctsj.js → chunk-4yca7e7x.js} +74 -29
- package/dist/{chunk-6kz6qa2h.js → chunk-643pxp2k.js} +4 -4
- package/dist/{chunk-ga76znz9.js → chunk-67xn3yer.js} +12 -7
- package/dist/{chunk-b07c43pg.js → chunk-80f0p6s7.js} +145 -110
- package/dist/{chunk-5qeqhjxy.js → chunk-8nzsyz74.js} +4 -4
- package/dist/{chunk-fc2bhh5v.js → chunk-ahvpwkyk.js} +2 -2
- package/dist/{chunk-jattyebv.js → chunk-b5edh1jq.js} +31 -31
- package/dist/{chunk-82w8rmkc.js → chunk-cbf0q15q.js} +14 -60
- package/dist/{chunk-h0jf48ew.js → chunk-efyrm6bv.js} +1 -1
- package/dist/{chunk-zem7mg1b.js → chunk-g7ysb6ca.js} +11 -11
- package/dist/{chunk-6qdhhk6r.js → chunk-gasqek3p.js} +6 -6
- package/dist/{chunk-y1krmnbv.js → chunk-ggmwpwhf.js} +2 -2
- package/dist/{chunk-gy9rf14f.js → chunk-mmd7mjv0.js} +3 -3
- package/dist/{chunk-7cx4t4em.js → chunk-pbmadbfm.js} +4 -4
- package/dist/{chunk-rqrtf7sb.js → chunk-pjq9bf3w.js} +4 -4
- package/dist/{chunk-npnbac9a.js → chunk-pvsg1ppc.js} +4 -4
- package/dist/{chunk-q5w3v4k1.js → chunk-pxvd8w2v.js} +1 -1
- package/dist/{chunk-hn9x2jjs.js → chunk-q4ra17vf.js} +3 -3
- package/dist/{chunk-z4x9m2bv.js → chunk-syhs23yk.js} +7 -7
- package/dist/{chunk-nf9gdnsf.js → chunk-x20t7xy8.js} +17 -17
- package/dist/{chunk-my63gy4t.js → chunk-zcpnmgwb.js} +7 -7
- package/dist/{chunk-zw3gf6r5.js → chunk-zgraq2y3.js} +70 -28
- package/dist/index.js +4 -4
- package/package.json +1 -1
|
@@ -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,
|
|
@@ -104,7 +104,7 @@ import {
|
|
|
104
104
|
decodeJsonString,
|
|
105
105
|
encodeJsonStringSync,
|
|
106
106
|
encodePrettyJsonString
|
|
107
|
-
} from "./chunk-
|
|
107
|
+
} from "./chunk-zgraq2y3.js";
|
|
108
108
|
import {
|
|
109
109
|
tap,
|
|
110
110
|
mapError,
|
|
@@ -116,7 +116,7 @@ import {
|
|
|
116
116
|
withDefault,
|
|
117
117
|
option,
|
|
118
118
|
String2
|
|
119
|
-
} from "./chunk-
|
|
119
|
+
} from "./chunk-x20t7xy8.js";
|
|
120
120
|
import {
|
|
121
121
|
currentTimeMillis,
|
|
122
122
|
SecureRandom,
|
|
@@ -143,6 +143,7 @@ import {
|
|
|
143
143
|
DefaultContextPackMode,
|
|
144
144
|
ProposalStatuses,
|
|
145
145
|
ProposalTargetTypes,
|
|
146
|
+
tokenCountWords,
|
|
146
147
|
RunDisplayStates,
|
|
147
148
|
RunnerExecutionBackend,
|
|
148
149
|
MaxRunnerConcurrency,
|
|
@@ -167,7 +168,7 @@ import {
|
|
|
167
168
|
digestSha256,
|
|
168
169
|
sha256Hasher,
|
|
169
170
|
raw,
|
|
170
|
-
|
|
171
|
+
make4,
|
|
171
172
|
get,
|
|
172
173
|
put,
|
|
173
174
|
HttpClient,
|
|
@@ -176,6 +177,7 @@ import {
|
|
|
176
177
|
layer4,
|
|
177
178
|
runDisplayLabels,
|
|
178
179
|
listedSummary,
|
|
180
|
+
stepFallbackWords,
|
|
179
181
|
defaultKitName,
|
|
180
182
|
SetupArchive,
|
|
181
183
|
KitmanClientError,
|
|
@@ -230,14 +232,14 @@ import {
|
|
|
230
232
|
harnessNames,
|
|
231
233
|
herdrRunnerCapabilities2,
|
|
232
234
|
declaredChecks
|
|
233
|
-
} from "./chunk-
|
|
235
|
+
} from "./chunk-80f0p6s7.js";
|
|
234
236
|
import {
|
|
235
237
|
Id
|
|
236
|
-
} from "./chunk-
|
|
238
|
+
} from "./chunk-pxvd8w2v.js";
|
|
237
239
|
import {
|
|
238
240
|
ChildProcessSpawner,
|
|
239
|
-
|
|
240
|
-
} from "./chunk-
|
|
241
|
+
make2
|
|
242
|
+
} from "./chunk-cbf0q15q.js";
|
|
241
243
|
|
|
242
244
|
// apps/cli/src/cli-error.ts
|
|
243
245
|
function cliErrorCode(error, status) {
|
|
@@ -1018,10 +1020,10 @@ var sandboxMissing = (sandbox, missing) => ({
|
|
|
1018
1020
|
var personalCheckBackend = (agentSandbox, dockerAvailable) => agentSandbox === "srt" || agentSandbox === "docker" && dockerAvailable ? agentSandbox : undefined;
|
|
1019
1021
|
var herdrCoreSession = (runnerId, personal) => personal ? undefined : `kitman-${sha2562(runnerId).slice(0, 16)}`;
|
|
1020
1022
|
var OpenHerdrCore = Reference("kitman/cli/OpenHerdrCore", {
|
|
1021
|
-
defaultValue: () => (options) => flatMap3(promise(() => import("./chunk-
|
|
1023
|
+
defaultValue: () => (options) => flatMap3(promise(() => import("./chunk-pjq9bf3w.js")), ({ HerdrCore, herdrCoreLayer }) => provide3(service(HerdrCore), herdrCoreLayer(options)))
|
|
1022
1024
|
});
|
|
1023
1025
|
var UpdateHerdrCore = Reference("kitman/cli/UpdateHerdrCore", {
|
|
1024
|
-
defaultValue: () => (options) => flatMap3(promise(() => import("./chunk-
|
|
1026
|
+
defaultValue: () => (options) => flatMap3(promise(() => import("./chunk-pjq9bf3w.js")), (module) => module.updateHerdrCore(options))
|
|
1025
1027
|
});
|
|
1026
1028
|
var herdrCoreMissing = (error) => {
|
|
1027
1029
|
if (isTagged(error, "HerdrCoreMissing"))
|
|
@@ -1447,7 +1449,7 @@ var syncTargets = (harness) => gen(function* () {
|
|
|
1447
1449
|
});
|
|
1448
1450
|
var syncKits = (input) => gen(function* () {
|
|
1449
1451
|
const fs = yield* FileSystem;
|
|
1450
|
-
const { syncKitSetup } = yield* promise(() => import("./chunk-
|
|
1452
|
+
const { syncKitSetup } = yield* promise(() => import("./chunk-syhs23yk.js"));
|
|
1451
1453
|
const harnesses = yield* syncTargets(input.harness);
|
|
1452
1454
|
const chain = yield* input.client.getKitChain(input.workspaceId);
|
|
1453
1455
|
for (const { name, problem } of chain.skipped)
|
|
@@ -1964,7 +1966,7 @@ var ServiceManager = Reference("kitman/cli/ServiceManager", {
|
|
|
1964
1966
|
run: (command, args) => runCommand2(command, args),
|
|
1965
1967
|
attach: (command, args) => gen(function* () {
|
|
1966
1968
|
const spawner = yield* ChildProcessSpawner;
|
|
1967
|
-
const handle = yield* spawner.spawn(
|
|
1969
|
+
const handle = yield* spawner.spawn(make2(command, args, { stdin: "inherit", stdout: "inherit", stderr: "inherit" }));
|
|
1968
1970
|
const exitCode = yield* handle.exitCode;
|
|
1969
1971
|
if (exitCode !== 0)
|
|
1970
1972
|
return yield* new CommandFailed2({ command, reason: `exit code ${exitCode}` });
|
|
@@ -2366,7 +2368,7 @@ var package_default = {
|
|
|
2366
2368
|
};
|
|
2367
2369
|
|
|
2368
2370
|
// apps/cli/src/scaffold.ts
|
|
2369
|
-
var cliVersion = "0.13.
|
|
2371
|
+
var cliVersion = "0.13.17";
|
|
2370
2372
|
var packageJson = (name, scaffold) => `${JSON.stringify({
|
|
2371
2373
|
name,
|
|
2372
2374
|
private: true,
|
|
@@ -2518,7 +2520,7 @@ var scaffoldKit = (directory, scaffold = {}) => gen(function* () {
|
|
|
2518
2520
|
|
|
2519
2521
|
// apps/cli/src/commands.ts
|
|
2520
2522
|
var ClientId = "kitman-cli";
|
|
2521
|
-
var agentRuntime = promise(() => import("./chunk-
|
|
2523
|
+
var agentRuntime = promise(() => import("./chunk-4yca7e7x.js"));
|
|
2522
2524
|
var TuiLauncher = Reference("kitman/cli/TuiLauncher", {
|
|
2523
2525
|
defaultValue: () => gen(function* () {
|
|
2524
2526
|
const tui = yield* tryPromise({
|
|
@@ -3554,7 +3556,7 @@ var SandboxHostProbe = Reference("kitman/cli/SandboxHostProbe", {
|
|
|
3554
3556
|
});
|
|
3555
3557
|
var OpenRunnerRpc = Reference("kitman/cli/OpenRunnerRpc", {
|
|
3556
3558
|
defaultValue: () => (options) => gen(function* () {
|
|
3557
|
-
const { makeRunnerRpcClient, runnerRpcUrl, runnerWebSocketProtocol } = yield* promise(() => import("./chunk-
|
|
3559
|
+
const { makeRunnerRpcClient, runnerRpcUrl, runnerWebSocketProtocol } = yield* promise(() => import("./chunk-gasqek3p.js"));
|
|
3558
3560
|
return yield* makeRunnerRpcClient({
|
|
3559
3561
|
runnerId: options.runnerId,
|
|
3560
3562
|
bearer: options.bearer,
|
|
@@ -3866,7 +3868,7 @@ function startCanonicalHerdrRunnerCommand(input) {
|
|
|
3866
3868
|
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);
|
|
3867
3869
|
yield* suspend3(() => sleep(ownerLogin.expired() ? ownerLoginRetryInterval : ownerLoginInterval)).pipe(andThen2(checkOwnerLogin), forever, forkScoped);
|
|
3868
3870
|
const platform = yield* context();
|
|
3869
|
-
const updated = yield*
|
|
3871
|
+
const updated = yield* make15();
|
|
3870
3872
|
const scope = yield* scope2;
|
|
3871
3873
|
const startUpdate = (update) => update.pipe(catch_((error) => andThen2(restartOntoUpdate(input.runnerId), fail5(updated, error))), provideContext2(platform), forkIn(scope), asVoid);
|
|
3872
3874
|
const refusedForProtocol = container ? updater.stopWhenDrained(new RunnerStopped({ problem: updateRequired })).pipe(catch_((stopped) => fail5(updated, stopped)), forkIn(scope), asVoid) : startUpdate(updater.updateRequired);
|
|
@@ -3958,11 +3960,12 @@ function startCanonicalHerdrRunnerCommand(input) {
|
|
|
3958
3960
|
spending,
|
|
3959
3961
|
sandbox: sandboxOf,
|
|
3960
3962
|
heartbeat: heartbeatOf,
|
|
3963
|
+
harnessStarted: (work) => asVoid(rpc.heartbeat({ workUnitId: work.id, lease: leaseOf(work), harnessStarted: true })),
|
|
3961
3964
|
gitCredentials: rpc.gitCredential,
|
|
3962
3965
|
checkpoints: rpcStepCheckpoints(rpc, signals, storage),
|
|
3963
3966
|
transcripts: (work, entries) => rpc.appendTranscript({ workUnitId: work.id, entries }),
|
|
3964
3967
|
runnerScope: scope,
|
|
3965
|
-
runAgent: (work, worktree, session, steered, refused) => flatMap3(currentTimeMillis, (now) => agentBackend.execute({
|
|
3968
|
+
runAgent: (work, worktree, session, steered, refused, launched) => flatMap3(currentTimeMillis, (now) => agentBackend.execute({
|
|
3966
3969
|
runnerId: input.runnerId,
|
|
3967
3970
|
sharedRunner: !personal,
|
|
3968
3971
|
attempt: runnerStepAttemptFromAgentStep(work),
|
|
@@ -3974,6 +3977,7 @@ function startCanonicalHerdrRunnerCommand(input) {
|
|
|
3974
3977
|
...work.secretDestinations === undefined ? undefined : { secretDestinations: work.secretDestinations }
|
|
3975
3978
|
},
|
|
3976
3979
|
recordRefusal: refused,
|
|
3980
|
+
launched,
|
|
3977
3981
|
revokedSecrets: heartbeatOf(work).pipe(map8((state) => state.revokedSecrets ?? [])),
|
|
3978
3982
|
sandbox: {
|
|
3979
3983
|
backend: work.sandbox ?? sandboxOf(work),
|
|
@@ -4049,11 +4053,12 @@ function startCanonicalHerdrRunnerCommand(input) {
|
|
|
4049
4053
|
}).pipe(asVoid)), tapError2(onProtocolRefusal)),
|
|
4050
4054
|
heartbeatWork: (workUnitId, lease) => rpc.heartbeat({ workUnitId, lease }),
|
|
4051
4055
|
complete: (completion) => rpc.complete(completion),
|
|
4052
|
-
release: (workUnitId, lease, crashed, tokens) => rpc.release({
|
|
4056
|
+
release: (workUnitId, lease, crashed, tokens, ranModel) => rpc.release({
|
|
4053
4057
|
workUnitId,
|
|
4054
4058
|
lease,
|
|
4055
4059
|
...crashed === undefined ? undefined : { crashed: { reason: crashed } },
|
|
4056
|
-
...tokens === undefined ? undefined : { tokens }
|
|
4060
|
+
...tokens === undefined ? undefined : { tokens },
|
|
4061
|
+
...ranModel === undefined ? undefined : { ranModel }
|
|
4057
4062
|
})
|
|
4058
4063
|
};
|
|
4059
4064
|
};
|
|
@@ -4076,9 +4081,9 @@ function startCanonicalHerdrRunnerCommand(input) {
|
|
|
4076
4081
|
}
|
|
4077
4082
|
},
|
|
4078
4083
|
spent: (workUnitId) => sync2(() => {
|
|
4079
|
-
const
|
|
4084
|
+
const spend = spending.get(workUnitId);
|
|
4080
4085
|
spending.delete(workUnitId);
|
|
4081
|
-
return
|
|
4086
|
+
return spend;
|
|
4082
4087
|
})
|
|
4083
4088
|
},
|
|
4084
4089
|
signals
|
|
@@ -4118,7 +4123,7 @@ function mcpCommand(args) {
|
|
|
4118
4123
|
if (command.action === "run") {
|
|
4119
4124
|
if (command.args.length > 0)
|
|
4120
4125
|
return yield* new CliError({ message: `Unknown command: ${args.join(" ")}` });
|
|
4121
|
-
const { runMcpServerCommand } = yield* promise(() => import("./chunk-
|
|
4126
|
+
const { runMcpServerCommand } = yield* promise(() => import("./chunk-b5edh1jq.js"));
|
|
4122
4127
|
return yield* runMcpServerCommand({ flags: command.flags });
|
|
4123
4128
|
}
|
|
4124
4129
|
if (command.action !== "setup")
|
|
@@ -4606,7 +4611,7 @@ function programLoopCommand(command) {
|
|
|
4606
4611
|
return yield* new CliError({ message: `Unknown loop command: ${command.action}` });
|
|
4607
4612
|
});
|
|
4608
4613
|
}
|
|
4609
|
-
var docsModule = promise(() => import("./chunk-
|
|
4614
|
+
var docsModule = promise(() => import("./chunk-efyrm6bv.js"));
|
|
4610
4615
|
function docsCommand(args) {
|
|
4611
4616
|
return gen(function* () {
|
|
4612
4617
|
const command = parseCommand(args);
|
|
@@ -4846,8 +4851,14 @@ var runListLine = (item) => [
|
|
|
4846
4851
|
item.display.summary === undefined ? "" : listedSummary(item.display.summary),
|
|
4847
4852
|
item.run.id
|
|
4848
4853
|
].filter((part) => part !== "").join(" ");
|
|
4849
|
-
var tokenWords = (tokens) => `${tokens.input
|
|
4854
|
+
var tokenWords = (tokens) => `${tokenCountWords(tokens.input)} input, ${tokenCountWords(tokens.output)} output, ${tokenCountWords(tokens.cached)} cached`;
|
|
4850
4855
|
var stepTokenLines = (step) => step.tokens !== undefined ? [` Tokens: ${tokenWords(step.tokens)}`] : step.attempts.some((attempt) => attempt.tokens === "none") ? [" Tokens: none reported"] : [];
|
|
4856
|
+
var terminalText = (text) => text.replace(/[\u0000-\u001f\u007f-\u009f]/gu, (char) => `\\u${char.charCodeAt(0).toString(16).padStart(4, "0")}`);
|
|
4857
|
+
var reportedTokenWords = (tokens) => tokens === undefined ? "none reported" : tokenWords(tokens);
|
|
4858
|
+
var runTokenLines = ({ tokens, tokensWithChildRuns }) => [
|
|
4859
|
+
`Tokens with Child Runs: ${reportedTokenWords(tokensWithChildRuns)}`,
|
|
4860
|
+
`Tokens, the Run\u2019s own: ${reportedTokenWords(tokens)}`
|
|
4861
|
+
];
|
|
4851
4862
|
var runShowLines = (shown) => [
|
|
4852
4863
|
`Run ${shown.run.id}: ${runDisplayLabels[shown.display.state]}${shown.display.retried ? " \xB7 Retried" : ""}`,
|
|
4853
4864
|
...shown.display.summary === undefined ? [] : [`Now: ${shown.display.summary}`],
|
|
@@ -4858,9 +4869,10 @@ var runShowLines = (shown) => [
|
|
|
4858
4869
|
`Loop${shown.run.loopVersion === undefined ? "" : ` ${shown.run.loopVersion}`}${shown.run.loopLayer === undefined ? "" : ` from the ${shown.run.loopLayer} layer`}, digest ${shown.run.loopDigest}`
|
|
4859
4870
|
],
|
|
4860
4871
|
...shown.run.failureSummary === undefined ? [] : [`Failure: ${shown.run.failureSummary}`],
|
|
4861
|
-
...
|
|
4872
|
+
...runTokenLines(shown),
|
|
4862
4873
|
...shown.steps.flatMap((step) => [
|
|
4863
4874
|
`Step ${step.name}: ${step.status} (attempt ${step.attempts.length})`,
|
|
4875
|
+
...step.fallback === undefined ? [] : [` ${terminalText(stepFallbackWords(step.fallback))}`],
|
|
4864
4876
|
...stepTokenLines(step),
|
|
4865
4877
|
...claimLines(step)
|
|
4866
4878
|
]),
|
|
@@ -5441,9 +5453,9 @@ function changeRequestCommand(args) {
|
|
|
5441
5453
|
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}`);
|
|
5442
5454
|
});
|
|
5443
5455
|
}
|
|
5444
|
-
var KitWriter = map8(promise(() => import("./chunk-
|
|
5456
|
+
var KitWriter = map8(promise(() => import("./chunk-g7ysb6ca.js")), (build) => build.writeKit);
|
|
5445
5457
|
var KitBuilder = Reference("kitman/cli/KitBuilder", {
|
|
5446
|
-
defaultValue: () => (directory) => flatMap3(promise(() => import("./chunk-
|
|
5458
|
+
defaultValue: () => (directory) => flatMap3(promise(() => import("./chunk-g7ysb6ca.js")), (build) => build.buildKit(directory))
|
|
5447
5459
|
});
|
|
5448
5460
|
var uploadKit = (client, workspaceId, built) => gen(function* () {
|
|
5449
5461
|
yield* client.uploadKitBundle(workspaceId, built.digest, { bundle: encode2(built.bundle) });
|
|
@@ -6220,7 +6232,7 @@ function downloadPresignedAsset(download, outputPath) {
|
|
|
6220
6232
|
return gen(function* () {
|
|
6221
6233
|
const fs = yield* FileSystem;
|
|
6222
6234
|
const failed = (cause) => new CliError({ message: `Asset download failed: ${String(cause)}` });
|
|
6223
|
-
const response = yield* send(
|
|
6235
|
+
const response = yield* send(make4(download.method)(download.url), failed);
|
|
6224
6236
|
if (response.status < 200 || response.status >= 300)
|
|
6225
6237
|
return yield* new CliError({ message: `Asset download failed with ${response.status}` });
|
|
6226
6238
|
const body = yield* response.arrayBuffer.pipe(mapError2((error) => failed(error.message)));
|
|
@@ -96,7 +96,7 @@ import {
|
|
|
96
96
|
Defect,
|
|
97
97
|
Exit,
|
|
98
98
|
toCodecJson
|
|
99
|
-
} from "./chunk-
|
|
99
|
+
} from "./chunk-zgraq2y3.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-x20t7xy8.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-80f0p6s7.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 };
|
|
@@ -41,7 +41,7 @@ import {
|
|
|
41
41
|
isFailure2,
|
|
42
42
|
hasInterrupts,
|
|
43
43
|
makeUnsafe5,
|
|
44
|
-
|
|
44
|
+
make15,
|
|
45
45
|
_await,
|
|
46
46
|
fail5,
|
|
47
47
|
isDoneUnsafe,
|
|
@@ -168,12 +168,12 @@ import {
|
|
|
168
168
|
decodeJsonStringSync,
|
|
169
169
|
encodeUnknownJsonStringSync,
|
|
170
170
|
storable
|
|
171
|
-
} from "./chunk-
|
|
171
|
+
} from "./chunk-zgraq2y3.js";
|
|
172
172
|
import {
|
|
173
173
|
Id,
|
|
174
174
|
secretReference,
|
|
175
175
|
secretPlaceholder
|
|
176
|
-
} from "./chunk-
|
|
176
|
+
} from "./chunk-pxvd8w2v.js";
|
|
177
177
|
import {
|
|
178
178
|
currentTimeMillis,
|
|
179
179
|
SecureRandom,
|
|
@@ -196,6 +196,7 @@ import {
|
|
|
196
196
|
programNetworkHosts,
|
|
197
197
|
canonicalSha256,
|
|
198
198
|
tokensSpent,
|
|
199
|
+
reportedModelName,
|
|
199
200
|
isTestReportName,
|
|
200
201
|
failedTestOfLine,
|
|
201
202
|
checkTests,
|
|
@@ -248,7 +249,7 @@ import {
|
|
|
248
249
|
installCommand,
|
|
249
250
|
checkServicesFile,
|
|
250
251
|
checkServices
|
|
251
|
-
} from "./chunk-
|
|
252
|
+
} from "./chunk-80f0p6s7.js";
|
|
252
253
|
import {
|
|
253
254
|
join,
|
|
254
255
|
interrupt,
|
|
@@ -257,7 +258,7 @@ import {
|
|
|
257
258
|
unbounded2,
|
|
258
259
|
offer,
|
|
259
260
|
makeUnsafe3,
|
|
260
|
-
|
|
261
|
+
make10,
|
|
261
262
|
fromQueue,
|
|
262
263
|
fromPubSub,
|
|
263
264
|
map2,
|
|
@@ -291,7 +292,7 @@ import {
|
|
|
291
292
|
writeSrtSettings2,
|
|
292
293
|
srtStepArgv2,
|
|
293
294
|
srtArgv2
|
|
294
|
-
} from "./chunk-
|
|
295
|
+
} from "./chunk-x20t7xy8.js";
|
|
295
296
|
import {
|
|
296
297
|
writeAgentEnvironmentConfigFile2,
|
|
297
298
|
readManifestSkillPaths2,
|
|
@@ -307,8 +308,8 @@ import {
|
|
|
307
308
|
applyAgentEnvironmentMaterialization2,
|
|
308
309
|
isPathWithin2,
|
|
309
310
|
skillIdentity2
|
|
310
|
-
} from "./chunk-
|
|
311
|
-
import"./chunk-
|
|
311
|
+
} from "./chunk-pvsg1ppc.js";
|
|
312
|
+
import"./chunk-q4ra17vf.js";
|
|
312
313
|
import {
|
|
313
314
|
egressAllowed,
|
|
314
315
|
writeSecretRegistry,
|
|
@@ -318,7 +319,7 @@ import {
|
|
|
318
319
|
secretFilter2,
|
|
319
320
|
opaqueTunnelRefusal2,
|
|
320
321
|
isOpaqueConnectReason2
|
|
321
|
-
} from "./chunk-
|
|
322
|
+
} from "./chunk-ggmwpwhf.js";
|
|
322
323
|
import {
|
|
323
324
|
sliceBytes2,
|
|
324
325
|
maxLineBytes2,
|
|
@@ -326,23 +327,23 @@ import {
|
|
|
326
327
|
decodedOption2,
|
|
327
328
|
decoded2,
|
|
328
329
|
readOpencode2
|
|
329
|
-
} from "./chunk-
|
|
330
|
+
} from "./chunk-67xn3yer.js";
|
|
330
331
|
import {
|
|
331
332
|
uploadRunFile,
|
|
332
333
|
programLease,
|
|
333
334
|
rpcRunFiles,
|
|
334
335
|
programHostsEnv,
|
|
335
336
|
undeclaredHostsEnv
|
|
336
|
-
} from "./chunk-
|
|
337
|
-
import"./chunk-
|
|
337
|
+
} from "./chunk-pbmadbfm.js";
|
|
338
|
+
import"./chunk-zcpnmgwb.js";
|
|
338
339
|
import {
|
|
339
340
|
nextInt
|
|
340
|
-
} from "./chunk-
|
|
341
|
+
} from "./chunk-24h0y27w.js";
|
|
341
342
|
import {
|
|
342
343
|
ChildProcessSpawner,
|
|
343
|
-
|
|
344
|
-
} from "./chunk-
|
|
345
|
-
import"./chunk-
|
|
344
|
+
make2
|
|
345
|
+
} from "./chunk-cbf0q15q.js";
|
|
346
|
+
import"./chunk-1cr225aq.js";
|
|
346
347
|
|
|
347
348
|
// packages/core/src/sync-kit.ts
|
|
348
349
|
import { createHash } from "crypto";
|
|
@@ -4384,6 +4385,8 @@ var runAttempt = (request, options) => gen(function* () {
|
|
|
4384
4385
|
}
|
|
4385
4386
|
if (ready.value.end !== undefined)
|
|
4386
4387
|
return ended("terminal_ended")(yield* judge(ready.value));
|
|
4388
|
+
if (request.launched !== undefined)
|
|
4389
|
+
yield* request.launched;
|
|
4387
4390
|
const brief = firstMessage(request.launch, workspace, launch.systemBrief === true);
|
|
4388
4391
|
const readyTurn = ready.value.turn;
|
|
4389
4392
|
const deliver = (tries) => gen(function* () {
|
|
@@ -4988,22 +4991,29 @@ function runReplica(control, executor, signals) {
|
|
|
4988
4991
|
let leaseLost = false;
|
|
4989
4992
|
let crashed;
|
|
4990
4993
|
let tokens;
|
|
4994
|
+
let ranModel;
|
|
4991
4995
|
const takeSpent = executor.spent?.(work.id) ?? undefined_;
|
|
4992
4996
|
return yield* gen(function* () {
|
|
4993
4997
|
const execution = executor.execute(work).pipe(mapError2((cause) => new RunnerReplicaError({ operation: "execute", kind: "rejected", cause })));
|
|
4994
4998
|
const raced = yield* raceFirst(execution, raceFirst(workHeartbeat, pushedStop)).pipe(catchIf((error) => error instanceof RunnerReplicaCancellation, () => succeed6({ status: "canceled", failureSummary: "Cancellation requested" })));
|
|
4995
4999
|
const cutOff = yield* takeSpent;
|
|
4996
|
-
const outcome = "tokens" in raced || cutOff === undefined ? raced : { ...raced,
|
|
5000
|
+
const outcome = "tokens" in raced || cutOff === undefined ? raced : { ...raced, ...cutOff };
|
|
4997
5001
|
if (outcome.status === "deferred") {
|
|
4998
5002
|
crashed = outcome.crashed;
|
|
4999
5003
|
tokens = outcome.tokens;
|
|
5004
|
+
ranModel = outcome.ranModel;
|
|
5000
5005
|
return { status: "deferred" };
|
|
5001
5006
|
}
|
|
5002
5007
|
if (outcome.status === "settled") {
|
|
5003
5008
|
tokens = "tokens" in outcome ? outcome.tokens : undefined;
|
|
5004
|
-
|
|
5009
|
+
ranModel = "ranModel" in outcome ? outcome.ranModel : undefined;
|
|
5010
|
+
completed = tokens === undefined && ranModel === undefined;
|
|
5005
5011
|
return { status: "completed", workUnitId: work.id };
|
|
5006
5012
|
}
|
|
5013
|
+
if (outcome.status !== "failed" || outcome.harnessHold?.reason !== "failed_to_start") {
|
|
5014
|
+
tokens = "tokens" in outcome ? outcome.tokens : undefined;
|
|
5015
|
+
ranModel = "ranModel" in outcome ? outcome.ranModel : undefined;
|
|
5016
|
+
}
|
|
5007
5017
|
yield* call("complete", () => control.complete({
|
|
5008
5018
|
workUnitId: work.id,
|
|
5009
5019
|
lease,
|
|
@@ -5014,7 +5024,10 @@ function runReplica(control, executor, signals) {
|
|
|
5014
5024
|
return { status: "completed", workUnitId: work.id };
|
|
5015
5025
|
}).pipe(tapError2((error) => sync2(() => {
|
|
5016
5026
|
leaseLost = error instanceof RunnerReplicaError && error.operation !== "execute" && error.kind !== "transient";
|
|
5017
|
-
})), ensuring2(suspend3(() => completed || leaseLost ? void_3 :
|
|
5027
|
+
})), ensuring2(suspend3(() => completed || leaseLost ? void_3 : gen(function* () {
|
|
5028
|
+
const cutOff = tokens === undefined && ranModel === undefined ? yield* takeSpent : undefined;
|
|
5029
|
+
yield* call("release", () => control.release(work.id, lease, crashed, cutOff?.tokens ?? tokens, cutOff?.ranModel ?? ranModel));
|
|
5030
|
+
}).pipe(timeout(releaseTimeout), catch_((error) => logWarning("runner_release_failed", error.message))))), ensuring2(asVoid(takeSpent)), ensuring2(control.finished?.() ?? void_3));
|
|
5018
5031
|
}));
|
|
5019
5032
|
}
|
|
5020
5033
|
var ConcurrencyRecheck = seconds(1);
|
|
@@ -5290,6 +5303,12 @@ var tokenCounter = (harness) => {
|
|
|
5290
5303
|
let reported = false;
|
|
5291
5304
|
let message;
|
|
5292
5305
|
let codexTotal;
|
|
5306
|
+
let model;
|
|
5307
|
+
const ran = (named) => {
|
|
5308
|
+
const identified = isString2(named) ? reportedModelName(named) : undefined;
|
|
5309
|
+
if (identified !== undefined)
|
|
5310
|
+
model = identified;
|
|
5311
|
+
};
|
|
5293
5312
|
const add = (usage) => {
|
|
5294
5313
|
reported = true;
|
|
5295
5314
|
counted.input += usage.input;
|
|
@@ -5302,6 +5321,7 @@ var tokenCounter = (harness) => {
|
|
|
5302
5321
|
return;
|
|
5303
5322
|
const { usage } = said;
|
|
5304
5323
|
const id = isString2(said.id) ? said.id : undefined;
|
|
5324
|
+
ran(said.model);
|
|
5305
5325
|
const spent = {
|
|
5306
5326
|
input: count(usage.input_tokens) + count(usage.cache_creation_input_tokens),
|
|
5307
5327
|
output: count(usage.output_tokens),
|
|
@@ -5319,6 +5339,8 @@ var tokenCounter = (harness) => {
|
|
|
5319
5339
|
add(spent);
|
|
5320
5340
|
};
|
|
5321
5341
|
const codex = (line) => {
|
|
5342
|
+
if (line.type === "turn_context" && isJsonObject(line.payload))
|
|
5343
|
+
ran(line.payload.model);
|
|
5322
5344
|
const event = line.type === "event_msg" ? line.payload : undefined;
|
|
5323
5345
|
const info = isJsonObject(event) && event.type === "token_count" ? event.info : undefined;
|
|
5324
5346
|
if (!isJsonObject(info) || !isJsonObject(info.last_token_usage))
|
|
@@ -5336,6 +5358,7 @@ var tokenCounter = (harness) => {
|
|
|
5336
5358
|
if (!isJsonObject(said) || said.role !== "assistant" || !isJsonObject(said.usage))
|
|
5337
5359
|
return;
|
|
5338
5360
|
const { usage } = said;
|
|
5361
|
+
ran(said.model);
|
|
5339
5362
|
add({
|
|
5340
5363
|
input: count(usage.input) + count(usage.cacheWrite),
|
|
5341
5364
|
output: count(usage.output),
|
|
@@ -5353,6 +5376,7 @@ var tokenCounter = (harness) => {
|
|
|
5353
5376
|
if (read !== undefined && isJsonObject(line))
|
|
5354
5377
|
read(line);
|
|
5355
5378
|
},
|
|
5379
|
+
model: () => model,
|
|
5356
5380
|
tokens: () => {
|
|
5357
5381
|
if (!reported)
|
|
5358
5382
|
return "none";
|
|
@@ -5580,6 +5604,12 @@ var transcriptRelay = (input) => {
|
|
|
5580
5604
|
let refusal;
|
|
5581
5605
|
let codexLimits;
|
|
5582
5606
|
let errorReadAt;
|
|
5607
|
+
let opencodeModel;
|
|
5608
|
+
const namedModel = (named) => {
|
|
5609
|
+
const identified = named === null ? undefined : reportedModelName(named);
|
|
5610
|
+
if (identified !== undefined)
|
|
5611
|
+
opencodeModel = identified;
|
|
5612
|
+
};
|
|
5583
5613
|
const heard = (said) => {
|
|
5584
5614
|
if (refusal === undefined || refusal.retried === true)
|
|
5585
5615
|
refusal = said;
|
|
@@ -5795,6 +5825,7 @@ var transcriptRelay = (input) => {
|
|
|
5795
5825
|
asking: sync2(() => asking.size > 0),
|
|
5796
5826
|
loginLost: sync2(() => loginLost),
|
|
5797
5827
|
refusal: sync2(() => refusal),
|
|
5828
|
+
ranModel: sync2(() => opencodeModel ?? tokens.model()),
|
|
5798
5829
|
tokens: (source) => gen(function* () {
|
|
5799
5830
|
const own = tokens.tokens();
|
|
5800
5831
|
if (source?.kind !== "file" || source.subagents === undefined)
|
|
@@ -5812,8 +5843,10 @@ var transcriptRelay = (input) => {
|
|
|
5812
5843
|
yield* flush;
|
|
5813
5844
|
yield* yieldNow;
|
|
5814
5845
|
}
|
|
5815
|
-
if (extent !== errorReadAt)
|
|
5846
|
+
if (extent !== errorReadAt) {
|
|
5816
5847
|
heard(opencodeProviderRefusal(yield* readOpencode2(source, "lastError", { v2: true })));
|
|
5848
|
+
namedModel(yield* readOpencode2(source, "lastModel", { v2: true }));
|
|
5849
|
+
}
|
|
5817
5850
|
errorReadAt = extent;
|
|
5818
5851
|
return;
|
|
5819
5852
|
}
|
|
@@ -5826,6 +5859,7 @@ var transcriptRelay = (input) => {
|
|
|
5826
5859
|
yield* yieldNow;
|
|
5827
5860
|
}
|
|
5828
5861
|
heard(opencodeProviderRefusal(yield* readOpencode2(source, "lastError", { v2: false })));
|
|
5862
|
+
namedModel(yield* readOpencode2(source, "lastModel", { v2: false }));
|
|
5829
5863
|
return;
|
|
5830
5864
|
}
|
|
5831
5865
|
yield* drain;
|
|
@@ -6316,6 +6350,9 @@ var stepAttempt = (input, resending) => (work) => gen(function* () {
|
|
|
6316
6350
|
});
|
|
6317
6351
|
let source;
|
|
6318
6352
|
let tokens;
|
|
6353
|
+
let ranModel;
|
|
6354
|
+
let launched = false;
|
|
6355
|
+
const attemptScope = yield* scope2;
|
|
6319
6356
|
const relayed = relay === undefined || adapter === undefined ? void_3 : gen(function* () {
|
|
6320
6357
|
source ??= yield* transcriptSource(adapter, {
|
|
6321
6358
|
...sessions,
|
|
@@ -6411,7 +6448,9 @@ var stepAttempt = (input, resending) => (work) => gen(function* () {
|
|
|
6411
6448
|
host: refusal.host.slice(0, 300),
|
|
6412
6449
|
reason: refusal.reason.slice(0, 500)
|
|
6413
6450
|
}
|
|
6414
|
-
])
|
|
6451
|
+
]), andThen2(sync2(() => {
|
|
6452
|
+
launched = true;
|
|
6453
|
+
}), input.harnessStarted === undefined ? void_3 : asVoid(forkIn(input.harnessStarted(work).pipe(retry({ times: 3, schedule: exponential("1 second") }), catch_((error) => logWarning("runner_harness_started_report_failed", error.message))), attemptScope)))).pipe(raceFirst(stalled), raceFirst(parked), raceFirst(providerRefused), raceFirst(loginLost), onExit((exit) => gen(function* () {
|
|
6415
6454
|
if (relay === undefined || relaying === undefined)
|
|
6416
6455
|
return;
|
|
6417
6456
|
yield* interrupt(relaying);
|
|
@@ -6419,7 +6458,12 @@ var stepAttempt = (input, resending) => (work) => gen(function* () {
|
|
|
6419
6458
|
yield* relayed.pipe(timeout("5 seconds"), ignore);
|
|
6420
6459
|
const spentNow = yield* relay.tokens(source).pipe(timeoutOrElse({ duration: "5 seconds", orElse: () => relay.tokens(undefined) }));
|
|
6421
6460
|
tokens = spentNow;
|
|
6422
|
-
|
|
6461
|
+
ranModel = yield* relay.ranModel;
|
|
6462
|
+
if (launched && !(isSuccess2(exit) && failedToStart(exit.value)))
|
|
6463
|
+
input.spending?.set(work.id, {
|
|
6464
|
+
tokens: spentNow,
|
|
6465
|
+
...ranModel === undefined ? undefined : { ranModel }
|
|
6466
|
+
});
|
|
6423
6467
|
yield* andThen2(relay.record([{ kind: "lifecycle", state }]), relay.lastFlush).pipe(timeout("5 seconds"), ignore);
|
|
6424
6468
|
const sending = yield* forkIn(relay.sendRest, input.runnerScope ?? makeUnsafe6());
|
|
6425
6469
|
resending.set(work.id, sending);
|
|
@@ -6428,7 +6472,7 @@ var stepAttempt = (input, resending) => (work) => gen(function* () {
|
|
|
6428
6472
|
})));
|
|
6429
6473
|
if (checkpointing !== undefined)
|
|
6430
6474
|
yield* interrupt(checkpointing);
|
|
6431
|
-
const spent = tokens === undefined ? undefined : { tokens };
|
|
6475
|
+
const spent = tokens === undefined || !launched ? undefined : { tokens, ...ranModel === undefined ? undefined : { ranModel } };
|
|
6432
6476
|
if (ran.status === "parked")
|
|
6433
6477
|
return { status: "deferred", ...spent };
|
|
6434
6478
|
const refused = ran.status === "failed" && !("harnessHold" in ran) && relay !== undefined ? yield* relay.refusal : undefined;
|
|
@@ -6474,6 +6518,7 @@ var stepAttempt = (input, resending) => (work) => gen(function* () {
|
|
|
6474
6518
|
return yield* deliver(work.branch, spent);
|
|
6475
6519
|
}).pipe(scoped);
|
|
6476
6520
|
var agentStepExecutor = (input) => stepAttempt(input, new Map);
|
|
6521
|
+
var failedToStart = (ran) => ran.status === "failed" && ran.harnessHold?.reason === "failed_to_start";
|
|
6477
6522
|
var checkpointRef = (work) => `refs/kitman/checkpoints/${work.runId}/${work.id}`;
|
|
6478
6523
|
|
|
6479
6524
|
// packages/agent-runtime/src/herdr-executor.ts
|
|
@@ -7040,7 +7085,7 @@ var codexAppServer = (binary = "codex") => (env) => gen(function* () {
|
|
|
7040
7085
|
const input = yield* unbounded2();
|
|
7041
7086
|
const pending = new Map;
|
|
7042
7087
|
let lastId = 0;
|
|
7043
|
-
const handle = yield* spawner.spawn(
|
|
7088
|
+
const handle = yield* spawner.spawn(make2(binary, ["app-server"], {
|
|
7044
7089
|
cwd: env.home,
|
|
7045
7090
|
extendEnv: true,
|
|
7046
7091
|
env: { HOME: env.home, CODEX_HOME: env.codexHome },
|
|
@@ -7063,7 +7108,7 @@ var codexAppServer = (binary = "codex") => (env) => gen(function* () {
|
|
|
7063
7108
|
return {
|
|
7064
7109
|
request: (method, params) => gen(function* () {
|
|
7065
7110
|
const id = ++lastId;
|
|
7066
|
-
const deferred = yield*
|
|
7111
|
+
const deferred = yield* make15();
|
|
7067
7112
|
pending.set(id, deferred);
|
|
7068
7113
|
yield* send({ id, method, params });
|
|
7069
7114
|
return yield* _await(deferred).pipe(mapError2((error) => new CodexAppServerFailed({ reason: `${method}: ${error.message}` })));
|
|
@@ -7203,10 +7248,10 @@ var handshake = [
|
|
|
7203
7248
|
`).join("");
|
|
7204
7249
|
var kitmanMcpPreflight = (mcp) => gen(function* () {
|
|
7205
7250
|
const spawner = yield* ChildProcessSpawner;
|
|
7206
|
-
const server = yield* spawner.spawn(
|
|
7251
|
+
const server = yield* spawner.spawn(make2(mcp.command, [...mcp.args], {
|
|
7207
7252
|
extendEnv: true,
|
|
7208
7253
|
env: mcp.env,
|
|
7209
|
-
stdin: { stream:
|
|
7254
|
+
stdin: { stream: make10(new TextEncoder().encode(handshake)), endOnDone: false },
|
|
7210
7255
|
stderr: "ignore"
|
|
7211
7256
|
}));
|
|
7212
7257
|
const reply = yield* server.stdout.pipe(decodeText, splitLines, map2((line) => getOrUndefined(decodeJsonStringOption(line))), filter((message) => isJsonObject(message) && message.id === 2), runHead);
|
|
@@ -7279,8 +7324,8 @@ var programProcessExecutor = (input) => (work) => gen(function* () {
|
|
|
7279
7324
|
};
|
|
7280
7325
|
const exitCode = sandbox === undefined ? yield* gen(function* () {
|
|
7281
7326
|
const spawner = yield* ChildProcessSpawner;
|
|
7282
|
-
const handle = yield* spawner.spawn(
|
|
7283
|
-
stdin:
|
|
7327
|
+
const handle = yield* spawner.spawn(make2(input.bun ?? process.execPath, [file], {
|
|
7328
|
+
stdin: make10(new TextEncoder().encode(stdin)),
|
|
7284
7329
|
stdout: "inherit",
|
|
7285
7330
|
stderr: "inherit",
|
|
7286
7331
|
extendEnv: false,
|
|
@@ -7,10 +7,10 @@ import {
|
|
|
7
7
|
decoded2,
|
|
8
8
|
readOpencode2,
|
|
9
9
|
runOpencodeReader2
|
|
10
|
-
} from "./chunk-
|
|
11
|
-
import"./chunk-
|
|
12
|
-
import"./chunk-
|
|
13
|
-
import"./chunk-
|
|
10
|
+
} from "./chunk-67xn3yer.js";
|
|
11
|
+
import"./chunk-cbf0q15q.js";
|
|
12
|
+
import"./chunk-x20t7xy8.js";
|
|
13
|
+
import"./chunk-zgraq2y3.js";
|
|
14
14
|
export {
|
|
15
15
|
decoded2 as decoded,
|
|
16
16
|
decodedOption2 as decodedOption,
|