@kitman-sh/cli 0.10.58 → 0.10.59
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-qbyxcjy1.js → chunk-09jf8588.js} +16 -11
- package/dist/{chunk-kvv9vzzr.js → chunk-0fdgam8v.js} +186 -46
- package/dist/{chunk-ec5df6ea.js → chunk-1w81w56v.js} +2 -2
- package/dist/{chunk-ahtfwz4b.js → chunk-1z9p4q8b.js} +2 -2
- package/dist/{chunk-bbsh3a70.js → chunk-5y050gx7.js} +38 -38
- package/dist/{chunk-zxs37afg.js → chunk-88257wax.js} +19 -19
- package/dist/{chunk-4jbn6hma.js → chunk-a4798jzf.js} +3 -3
- package/dist/{chunk-nk5h4cvx.js → chunk-d3ksv8y1.js} +76 -117
- package/dist/{chunk-ac19vqmc.js → chunk-d8awdfdj.js} +204 -88
- package/dist/{chunk-zc214v7k.js → chunk-e3tv8mv2.js} +8 -8
- package/dist/{chunk-tr80mjnp.js → chunk-eawcprsb.js} +60 -14
- package/dist/{chunk-9rxwzn7y.js → chunk-hvev0dve.js} +11 -11
- package/dist/{chunk-hegberew.js → chunk-hxkk42cg.js} +7 -7
- package/dist/{chunk-59n1m39j.js → chunk-phmma642.js} +7 -7
- package/dist/{chunk-jd8xhqgm.js → chunk-q3c7vmby.js} +1 -1
- package/dist/{chunk-qkbnbr47.js → chunk-r76gsqds.js} +31 -21
- package/dist/{chunk-8y8ax1bt.js → chunk-rrnee9mk.js} +1 -1
- package/dist/{chunk-n1m89pnt.js → chunk-rrz0v4fg.js} +5 -5
- package/dist/{chunk-qmmer308.js → chunk-sdpjvc1r.js} +201 -344
- package/dist/{chunk-c6gyfqv4.js → chunk-smgvtzd2.js} +7 -7
- package/dist/{chunk-76y7v9rj.js → chunk-v01c0k6j.js} +1 -1
- package/dist/{chunk-edf91eyv.js → chunk-wkccjgwb.js} +4 -4
- package/dist/{chunk-ac851090.js → chunk-wtpwkjws.js} +4 -4
- package/dist/{chunk-mfhmj6r6.js → chunk-z0z56a72.js} +9 -9
- package/dist/index.js +4 -4
- package/package.json +1 -1
|
@@ -5,46 +5,7 @@ import {
|
|
|
5
5
|
isObject,
|
|
6
6
|
isJsonObject,
|
|
7
7
|
isString
|
|
8
|
-
} from "./chunk-
|
|
9
|
-
import {
|
|
10
|
-
join,
|
|
11
|
-
interrupt,
|
|
12
|
-
unbounded,
|
|
13
|
-
publishUnsafe,
|
|
14
|
-
unbounded2,
|
|
15
|
-
offer,
|
|
16
|
-
makeUnsafe3,
|
|
17
|
-
make9,
|
|
18
|
-
fromQueue,
|
|
19
|
-
fromPubSub,
|
|
20
|
-
map2,
|
|
21
|
-
filter,
|
|
22
|
-
decodeText,
|
|
23
|
-
encodeText,
|
|
24
|
-
splitLines,
|
|
25
|
-
run,
|
|
26
|
-
runHead,
|
|
27
|
-
runForEach,
|
|
28
|
-
FileSystem,
|
|
29
|
-
Path,
|
|
30
|
-
embeddedFile,
|
|
31
|
-
extractEmbeddedFile,
|
|
32
|
-
optionalEnv,
|
|
33
|
-
harnessesUnsupportedInSrt2,
|
|
34
|
-
compiled2,
|
|
35
|
-
pinnedSrtCommand2,
|
|
36
|
-
pinnedSrtStepCommand2,
|
|
37
|
-
runSrtCli2,
|
|
38
|
-
kitmanCacheDirectory2,
|
|
39
|
-
srtSettings2,
|
|
40
|
-
srtCacheEnvironment2,
|
|
41
|
-
srtInheritedEnv2,
|
|
42
|
-
inheritedEnvironment2,
|
|
43
|
-
withOnlyEnvironment2,
|
|
44
|
-
writeSrtSettings2,
|
|
45
|
-
srtStepArgv2,
|
|
46
|
-
srtArgv2
|
|
47
|
-
} from "./chunk-kvv9vzzr.js";
|
|
8
|
+
} from "./chunk-v01c0k6j.js";
|
|
48
9
|
import {
|
|
49
10
|
pipeArguments,
|
|
50
11
|
dual,
|
|
@@ -81,7 +42,7 @@ import {
|
|
|
81
42
|
isFailure2,
|
|
82
43
|
hasInterrupts,
|
|
83
44
|
makeUnsafe5,
|
|
84
|
-
|
|
45
|
+
make16,
|
|
85
46
|
_await,
|
|
86
47
|
fail5,
|
|
87
48
|
isDoneUnsafe,
|
|
@@ -141,6 +102,7 @@ import {
|
|
|
141
102
|
timeoutOption,
|
|
142
103
|
timeoutOrElse,
|
|
143
104
|
sleep,
|
|
105
|
+
raceAllFirst,
|
|
144
106
|
raceFirst,
|
|
145
107
|
filter2,
|
|
146
108
|
matchEffect2,
|
|
@@ -194,11 +156,11 @@ import {
|
|
|
194
156
|
encodePrettyJsonString,
|
|
195
157
|
decodeJsonStringSync,
|
|
196
158
|
encodeUnknownJsonStringSync
|
|
197
|
-
} from "./chunk-
|
|
159
|
+
} from "./chunk-d3ksv8y1.js";
|
|
198
160
|
import {
|
|
199
161
|
Id,
|
|
200
162
|
secretReference
|
|
201
|
-
} from "./chunk-
|
|
163
|
+
} from "./chunk-rrnee9mk.js";
|
|
202
164
|
import {
|
|
203
165
|
currentTimeMillis,
|
|
204
166
|
SecureRandom,
|
|
@@ -263,7 +225,46 @@ import {
|
|
|
263
225
|
installCommand,
|
|
264
226
|
checkServicesFile,
|
|
265
227
|
checkServices
|
|
266
|
-
} from "./chunk-
|
|
228
|
+
} from "./chunk-sdpjvc1r.js";
|
|
229
|
+
import {
|
|
230
|
+
join,
|
|
231
|
+
interrupt,
|
|
232
|
+
unbounded,
|
|
233
|
+
publishUnsafe,
|
|
234
|
+
unbounded2,
|
|
235
|
+
offer,
|
|
236
|
+
makeUnsafe3,
|
|
237
|
+
make11,
|
|
238
|
+
fromQueue,
|
|
239
|
+
fromPubSub,
|
|
240
|
+
map2,
|
|
241
|
+
filter,
|
|
242
|
+
decodeText,
|
|
243
|
+
encodeText,
|
|
244
|
+
splitLines,
|
|
245
|
+
run,
|
|
246
|
+
runHead,
|
|
247
|
+
runForEach,
|
|
248
|
+
FileSystem,
|
|
249
|
+
Path,
|
|
250
|
+
embeddedFile,
|
|
251
|
+
extractEmbeddedFile,
|
|
252
|
+
optionalEnv,
|
|
253
|
+
harnessesUnsupportedInSrt2,
|
|
254
|
+
compiled2,
|
|
255
|
+
pinnedSrtCommand2,
|
|
256
|
+
pinnedSrtStepCommand2,
|
|
257
|
+
runSrtCli2,
|
|
258
|
+
kitmanCacheDirectory2,
|
|
259
|
+
srtSettings2,
|
|
260
|
+
srtCacheEnvironment2,
|
|
261
|
+
srtInheritedEnv2,
|
|
262
|
+
inheritedEnvironment2,
|
|
263
|
+
withOnlyEnvironment2,
|
|
264
|
+
writeSrtSettings2,
|
|
265
|
+
srtStepArgv2,
|
|
266
|
+
srtArgv2
|
|
267
|
+
} from "./chunk-0fdgam8v.js";
|
|
267
268
|
import {
|
|
268
269
|
writeAgentEnvironmentConfigFile2,
|
|
269
270
|
readManifestSkillPaths2,
|
|
@@ -279,8 +280,8 @@ import {
|
|
|
279
280
|
applyAgentEnvironmentMaterialization2,
|
|
280
281
|
isPathWithin2,
|
|
281
282
|
skillIdentity2
|
|
282
|
-
} from "./chunk-
|
|
283
|
-
import"./chunk-
|
|
283
|
+
} from "./chunk-z0z56a72.js";
|
|
284
|
+
import"./chunk-a4798jzf.js";
|
|
284
285
|
import {
|
|
285
286
|
sliceBytes2,
|
|
286
287
|
maxLineBytes2,
|
|
@@ -288,28 +289,28 @@ import {
|
|
|
288
289
|
decodedOption2,
|
|
289
290
|
decoded2,
|
|
290
291
|
readOpencode2
|
|
291
|
-
} from "./chunk-
|
|
292
|
+
} from "./chunk-09jf8588.js";
|
|
292
293
|
import {
|
|
293
294
|
writeSecretRegistry,
|
|
294
295
|
secretRefusalLog,
|
|
295
296
|
parseSecretRefusals
|
|
296
|
-
} from "./chunk-
|
|
297
|
+
} from "./chunk-1w81w56v.js";
|
|
297
298
|
import {
|
|
298
299
|
uploadRunFile,
|
|
299
300
|
programLease,
|
|
300
301
|
rpcRunFiles,
|
|
301
302
|
programHostsEnv,
|
|
302
303
|
undeclaredHostsEnv
|
|
303
|
-
} from "./chunk-
|
|
304
|
-
import"./chunk-
|
|
304
|
+
} from "./chunk-phmma642.js";
|
|
305
|
+
import"./chunk-hxkk42cg.js";
|
|
305
306
|
import {
|
|
306
307
|
nextInt
|
|
307
|
-
} from "./chunk-
|
|
308
|
+
} from "./chunk-q3c7vmby.js";
|
|
308
309
|
import {
|
|
309
310
|
ChildProcessSpawner,
|
|
310
|
-
|
|
311
|
-
} from "./chunk-
|
|
312
|
-
import"./chunk-
|
|
311
|
+
make3
|
|
312
|
+
} from "./chunk-eawcprsb.js";
|
|
313
|
+
import"./chunk-e3tv8mv2.js";
|
|
313
314
|
|
|
314
315
|
// packages/core/src/sync-kit.ts
|
|
315
316
|
import { createHash } from "crypto";
|
|
@@ -3080,20 +3081,24 @@ var removeRunnerTerminals = (connection, runnerId, teardownDelayMs = 250) => fla
|
|
|
3080
3081
|
}));
|
|
3081
3082
|
var until = (seen, done) => changes(seen).pipe(filter(done), runHead, flatMap3((head) => match(head, { onNone: () => never, onSome: succeed6 })));
|
|
3082
3083
|
var stirredSince = (turn) => (last) => last.end !== undefined || last.status === "working" || last.status === "blocked" || last.turn > turn;
|
|
3083
|
-
var
|
|
3084
|
+
var lastingStatus = (seen, status, graceMs) => gen(function* () {
|
|
3084
3085
|
while (true) {
|
|
3085
|
-
const
|
|
3086
|
-
const left = yield* until(seen, (last) => last.status !==
|
|
3086
|
+
const entered = yield* until(seen, (last) => last.status === status);
|
|
3087
|
+
const left = yield* until(seen, (last) => last.status !== status).pipe(timeoutOption(graceMs));
|
|
3087
3088
|
if (isNone(left))
|
|
3088
|
-
return
|
|
3089
|
+
return entered;
|
|
3089
3090
|
}
|
|
3090
3091
|
});
|
|
3091
3092
|
var lastingStop = (input) => gen(function* () {
|
|
3092
3093
|
let reminders = idleReminders;
|
|
3093
3094
|
let remindedTurn = -1;
|
|
3094
3095
|
while (true) {
|
|
3095
|
-
const stopped = yield*
|
|
3096
|
-
|
|
3096
|
+
const stopped = yield* raceAllFirst([
|
|
3097
|
+
until(input.seen, (last) => last.end !== undefined || last.turn > input.promptTurn && !["blocked", "working", "error"].includes(last.status ?? "")),
|
|
3098
|
+
lastingStatus(input.seen, "blocked", input.blockedGraceMs),
|
|
3099
|
+
lastingStatus(input.seen, "error", input.idleGraceMs)
|
|
3100
|
+
]);
|
|
3101
|
+
if (stopped.end !== undefined || stopped.status === "blocked" || stopped.status === "error" || (yield* input.outputSubmitted))
|
|
3097
3102
|
return stopped;
|
|
3098
3103
|
const stirred = stirredSince(stopped.turn);
|
|
3099
3104
|
const waited = yield* until(input.seen, stirred).pipe(timeoutOption(input.idleGraceMs));
|
|
@@ -3328,10 +3333,14 @@ var runAttempt = (request, options) => gen(function* () {
|
|
|
3328
3333
|
case "finished":
|
|
3329
3334
|
return failed("output_missing", "The agent finished without submitting its Output.");
|
|
3330
3335
|
case undefined: {
|
|
3331
|
-
if (last.status !== "blocked")
|
|
3336
|
+
if (last.status !== "blocked" && last.status !== "error")
|
|
3332
3337
|
return failed("output_missing", "The agent finished without submitting its Output.");
|
|
3333
3338
|
const screen = yield* option2(call((connection) => connection.read(address)));
|
|
3334
3339
|
const shown = isSome(screen) ? redactCredentials(screen.value).trim() : "";
|
|
3340
|
+
if (last.status === "error") {
|
|
3341
|
+
yield* logWarning("agent_errored", { attempt: attempt.id, address, screen: shown });
|
|
3342
|
+
return failed("harness_error", `The Harness stopped in its error state before it submitted its Output.${shown === "" ? "" : ` Its screen ended: ${shown.slice(-blockedScreenChars)}`}`);
|
|
3343
|
+
}
|
|
3335
3344
|
yield* logWarning("agent_blocked", { attempt: attempt.id, address, screen: shown });
|
|
3336
3345
|
if (loginRefused(shown))
|
|
3337
3346
|
return failed("harness_login_lost", `The Harness's login was refused before it submitted its Output. Its screen ended: ${shown.slice(-blockedScreenChars)}`);
|
|
@@ -4141,6 +4150,87 @@ var claudeOutOfQuota = (line) => {
|
|
|
4141
4150
|
return { summary: bounded(text || "Usage limit reached"), ...resetTime(resetsAt) };
|
|
4142
4151
|
};
|
|
4143
4152
|
var claudeLoginLost = (line) => isJsonObject(line) && line.type === "assistant" && line.isApiErrorMessage === true && line.error === "authentication_failed" ? bounded((isJsonObject(line.message) ? textOf(line.message.content) : "") || "Authentication failed") : undefined;
|
|
4153
|
+
var quotaError = /usage limit|quota|insufficient_quota|resource_exhausted|credit balance|billing|(daily|weekly|monthly) limit/i;
|
|
4154
|
+
var loginError = /\b401\b|unauthori[sz]ed|authentication|invalid.{0,20}(api[ _-]?key|token|credentials)|no api key|(token|credentials?) (has |have )?(expired|been revoked)|(api[ _-]?key|token|credentials?) (is |are )?not valid|log ?in again|re-?authenticate/i;
|
|
4155
|
+
var rateLimitError = /rate.?limit|too many requests|\b429\b/i;
|
|
4156
|
+
var passingLimit = /per minute|retry in \d+(\.\d+)?\s*s/i;
|
|
4157
|
+
var claudeProviderRefusal = (line) => {
|
|
4158
|
+
const spent = claudeOutOfQuota(line);
|
|
4159
|
+
if (spent !== undefined)
|
|
4160
|
+
return { ...spent, kind: "out_of_quota" };
|
|
4161
|
+
if (!isJsonObject(line) || line.type !== "assistant" || line.isApiErrorMessage !== true)
|
|
4162
|
+
return;
|
|
4163
|
+
const said = bounded(isJsonObject(line.message) ? textOf(line.message.content) : "");
|
|
4164
|
+
if (line.error === "rate_limit")
|
|
4165
|
+
return { summary: said || "Rate limit reached", kind: "rate_limited" };
|
|
4166
|
+
return line.error === "billing_error" ? { summary: said || "Billing error", kind: "out_of_quota" } : undefined;
|
|
4167
|
+
};
|
|
4168
|
+
var codexQuotaErrors = new Set([
|
|
4169
|
+
"usage_limit_exceeded",
|
|
4170
|
+
"organization_usage_limit_exceeded",
|
|
4171
|
+
"organization_spend_limit_exceeded"
|
|
4172
|
+
]);
|
|
4173
|
+
var codexProviderRefusal = (line) => {
|
|
4174
|
+
const event = isJsonObject(line) && line.type === "event_msg" ? line.payload : undefined;
|
|
4175
|
+
const error = !isJsonObject(event) ? undefined : event.type === "task_complete" ? event.error : event.type === "error" ? event : undefined;
|
|
4176
|
+
if (!isJsonObject(error))
|
|
4177
|
+
return;
|
|
4178
|
+
const info = error.codex_error_info;
|
|
4179
|
+
const tag = isString(info) ? info : isJsonObject(info) ? Object.keys(info)[0] : undefined;
|
|
4180
|
+
const detail = isJsonObject(info) && tag !== undefined ? info[tag] : undefined;
|
|
4181
|
+
const status = isJsonObject(detail) ? detail.http_status_code : undefined;
|
|
4182
|
+
const summary = bounded(isString(error.message) ? error.message : tag ?? "");
|
|
4183
|
+
if (codexQuotaErrors.has(tag))
|
|
4184
|
+
return { summary, kind: "out_of_quota" };
|
|
4185
|
+
if (tag === "unauthorized" || status === 401)
|
|
4186
|
+
return { summary, kind: "login_refused" };
|
|
4187
|
+
return tag === "rate_limit_exceeded" || status === 429 ? { summary, kind: "rate_limited" } : undefined;
|
|
4188
|
+
};
|
|
4189
|
+
var opencodeQuotaErrors = /^provider\.(quota|free-limit|go-limit|budget-limit|model-budget-limit|chatgpt-limit)$/;
|
|
4190
|
+
var opencodeProviderRefusal = (error) => {
|
|
4191
|
+
if (!isJsonObject(error))
|
|
4192
|
+
return;
|
|
4193
|
+
if (isString(error.type)) {
|
|
4194
|
+
const summary = bounded(isString(error.message) ? error.message : error.type);
|
|
4195
|
+
if (opencodeQuotaErrors.test(error.type))
|
|
4196
|
+
return { summary, kind: "out_of_quota" };
|
|
4197
|
+
if (error.type === "provider.auth")
|
|
4198
|
+
return { summary, kind: "login_refused" };
|
|
4199
|
+
return error.type === "provider.rate-limit" ? { summary, kind: "rate_limited" } : undefined;
|
|
4200
|
+
}
|
|
4201
|
+
const data = isJsonObject(error.data) ? error.data : {};
|
|
4202
|
+
const said = isString(data.message) ? data.message : isString(error.name) ? error.name : "";
|
|
4203
|
+
const summary = bounded(said);
|
|
4204
|
+
if (error.name === "ProviderAuthError")
|
|
4205
|
+
return { summary, kind: "login_refused" };
|
|
4206
|
+
if (error.name !== "APIError")
|
|
4207
|
+
return;
|
|
4208
|
+
if (quotaError.test(said) || isString(data.responseBody) && quotaError.test(data.responseBody))
|
|
4209
|
+
return { summary, kind: "out_of_quota" };
|
|
4210
|
+
if (data.statusCode === 401)
|
|
4211
|
+
return { summary, kind: "login_refused" };
|
|
4212
|
+
return data.statusCode === 429 ? { summary, kind: "rate_limited" } : undefined;
|
|
4213
|
+
};
|
|
4214
|
+
var piProviderRefusal = (line) => {
|
|
4215
|
+
const message = isJsonObject(line) && line.type === "message" ? line.message : undefined;
|
|
4216
|
+
if (!isJsonObject(message) || message.role !== "assistant" || message.stopReason !== "error")
|
|
4217
|
+
return;
|
|
4218
|
+
const said = isString(message.errorMessage) ? message.errorMessage : "";
|
|
4219
|
+
const summary = bounded(said);
|
|
4220
|
+
if (passingLimit.test(said))
|
|
4221
|
+
return { summary, kind: "rate_limited", retried: true };
|
|
4222
|
+
if (quotaError.test(said))
|
|
4223
|
+
return { summary, kind: "out_of_quota" };
|
|
4224
|
+
if (loginError.test(said))
|
|
4225
|
+
return { summary, kind: "login_refused" };
|
|
4226
|
+
return rateLimitError.test(said) ? { summary, kind: "rate_limited", retried: true } : undefined;
|
|
4227
|
+
};
|
|
4228
|
+
var piReplied = (line) => isJsonObject(line) && line.type === "message" && isJsonObject(line.message) && line.message.role === "assistant";
|
|
4229
|
+
var sessionRefusals = new Map([
|
|
4230
|
+
["claude", claudeProviderRefusal],
|
|
4231
|
+
["codex", codexProviderRefusal],
|
|
4232
|
+
["pi", piProviderRefusal]
|
|
4233
|
+
]);
|
|
4144
4234
|
var sessionNormalizer = (harness) => {
|
|
4145
4235
|
const asks = new Set;
|
|
4146
4236
|
const called = (fullCallId, name, args) => {
|
|
@@ -4323,8 +4413,13 @@ var transcriptRelay = (input) => {
|
|
|
4323
4413
|
let progressAt;
|
|
4324
4414
|
let lastSeen;
|
|
4325
4415
|
const asking = new Set;
|
|
4326
|
-
let outOfQuota;
|
|
4327
4416
|
let loginLost;
|
|
4417
|
+
let refusal;
|
|
4418
|
+
let errorReadAt;
|
|
4419
|
+
const heard = (said) => {
|
|
4420
|
+
if (refusal === undefined || refusal.retried === true)
|
|
4421
|
+
refusal = said;
|
|
4422
|
+
};
|
|
4328
4423
|
const backedUp = () => unsentChars >= maxUnsentChars;
|
|
4329
4424
|
const sawSession = (extent) => gen(function* () {
|
|
4330
4425
|
if (extent !== lastSeen)
|
|
@@ -4407,10 +4502,11 @@ var transcriptRelay = (input) => {
|
|
|
4407
4502
|
while (queued.length > 0) {
|
|
4408
4503
|
yield* suspend3(() => record(queued.splice(0, linesPerTurn2).flatMap((line) => {
|
|
4409
4504
|
const value = decoded2(line);
|
|
4410
|
-
if (input.harness === "claude")
|
|
4411
|
-
outOfQuota = claudeOutOfQuota(value) ?? outOfQuota;
|
|
4505
|
+
if (input.harness === "claude")
|
|
4412
4506
|
loginLost = claudeLoginLost(value) ?? loginLost;
|
|
4413
|
-
|
|
4507
|
+
const refused = sessionRefusals.get(input.harness)?.(value);
|
|
4508
|
+
if (refused !== undefined || input.harness === "pi" && piReplied(value))
|
|
4509
|
+
heard(refused);
|
|
4414
4510
|
return normalize(value).slice(0, maxEventsPerLine);
|
|
4415
4511
|
}))).pipe(uninterruptible);
|
|
4416
4512
|
yield* yieldNow;
|
|
@@ -4526,15 +4622,19 @@ var transcriptRelay = (input) => {
|
|
|
4526
4622
|
record,
|
|
4527
4623
|
stalledFor: (millis) => map8(currentTimeMillis, (now) => asking.size === 0 && progressAt !== undefined && now - progressAt >= millis),
|
|
4528
4624
|
asking: sync2(() => asking.size > 0),
|
|
4529
|
-
outOfQuota: sync2(() => outOfQuota),
|
|
4530
4625
|
loginLost: sync2(() => loginLost),
|
|
4626
|
+
refusal: sync2(() => refusal),
|
|
4531
4627
|
read: (source) => gen(function* () {
|
|
4532
4628
|
if (source.kind === "opencode_v2") {
|
|
4533
|
-
|
|
4629
|
+
const extent = yield* readOpencode2(source, "extent", {});
|
|
4630
|
+
yield* sawSession(extent);
|
|
4534
4631
|
while (!backedUp() && (yield* takeMessages(source))) {
|
|
4535
4632
|
yield* flush;
|
|
4536
4633
|
yield* yieldNow;
|
|
4537
4634
|
}
|
|
4635
|
+
if (extent !== errorReadAt)
|
|
4636
|
+
heard(opencodeProviderRefusal(yield* readOpencode2(source, "lastError", { v2: true })));
|
|
4637
|
+
errorReadAt = extent;
|
|
4538
4638
|
return;
|
|
4539
4639
|
}
|
|
4540
4640
|
if (source.kind === "opencode") {
|
|
@@ -4545,6 +4645,7 @@ var transcriptRelay = (input) => {
|
|
|
4545
4645
|
yield* flush;
|
|
4546
4646
|
yield* yieldNow;
|
|
4547
4647
|
}
|
|
4648
|
+
heard(opencodeProviderRefusal(yield* readOpencode2(source, "lastError", { v2: false })));
|
|
4548
4649
|
return;
|
|
4549
4650
|
}
|
|
4550
4651
|
yield* drain;
|
|
@@ -5044,19 +5145,21 @@ var stepAttempt = (input, resending) => (work) => gen(function* () {
|
|
|
5044
5145
|
};
|
|
5045
5146
|
}
|
|
5046
5147
|
});
|
|
5047
|
-
const
|
|
5148
|
+
const refusalHold = (refusal) => ({
|
|
5149
|
+
reason: refusal.kind,
|
|
5150
|
+
...refusal.until === undefined ? undefined : { until: refusal.until },
|
|
5151
|
+
...backend === "docker" ? { scope: "step" } : undefined
|
|
5152
|
+
});
|
|
5153
|
+
const outputSubmitted = input.heartbeat(work).pipe(option2, map8((state) => isSome(state) && state.value.outputSubmitted === true));
|
|
5154
|
+
const providerRefused = relay === undefined ? never : gen(function* () {
|
|
5048
5155
|
for (;; ) {
|
|
5049
5156
|
yield* sleep("1 second");
|
|
5050
|
-
const
|
|
5051
|
-
if (
|
|
5052
|
-
|
|
5053
|
-
|
|
5054
|
-
|
|
5055
|
-
|
|
5056
|
-
reason: "out_of_quota",
|
|
5057
|
-
...spent.until === undefined ? undefined : { until: spent.until }
|
|
5058
|
-
}
|
|
5059
|
-
};
|
|
5157
|
+
const refusal = yield* relay.refusal;
|
|
5158
|
+
if (refusal === undefined || refusal.retried === true)
|
|
5159
|
+
continue;
|
|
5160
|
+
if (yield* outputSubmitted)
|
|
5161
|
+
return { status: "finished" };
|
|
5162
|
+
return { status: "failed", summary: refusal.summary, harnessHold: refusalHold(refusal) };
|
|
5060
5163
|
}
|
|
5061
5164
|
});
|
|
5062
5165
|
const loginLost = relay === undefined ? never : gen(function* () {
|
|
@@ -5065,8 +5168,7 @@ var stepAttempt = (input, resending) => (work) => gen(function* () {
|
|
|
5065
5168
|
const said = yield* relay.loginLost;
|
|
5066
5169
|
if (said === undefined)
|
|
5067
5170
|
continue;
|
|
5068
|
-
|
|
5069
|
-
if (isSome(state) && state.value.outputSubmitted === true)
|
|
5171
|
+
if (yield* outputSubmitted)
|
|
5070
5172
|
return { status: "finished" };
|
|
5071
5173
|
return { status: "failed", summary: said, restart: { reason: "login_revoked" } };
|
|
5072
5174
|
}
|
|
@@ -5090,7 +5192,7 @@ var stepAttempt = (input, resending) => (work) => gen(function* () {
|
|
|
5090
5192
|
host: refusal.host.slice(0, 300),
|
|
5091
5193
|
reason: refusal.reason.slice(0, 500)
|
|
5092
5194
|
}
|
|
5093
|
-
])).pipe(raceFirst(stalled), raceFirst(parked), raceFirst(
|
|
5195
|
+
])).pipe(raceFirst(stalled), raceFirst(parked), raceFirst(providerRefused), raceFirst(loginLost), onExit((exit) => gen(function* () {
|
|
5094
5196
|
if (relay === undefined || relaying === undefined)
|
|
5095
5197
|
return;
|
|
5096
5198
|
yield* interrupt(relaying);
|
|
@@ -5106,8 +5208,22 @@ var stepAttempt = (input, resending) => (work) => gen(function* () {
|
|
|
5106
5208
|
yield* interrupt(checkpointing);
|
|
5107
5209
|
if (ran.status === "parked")
|
|
5108
5210
|
return { status: "deferred" };
|
|
5109
|
-
|
|
5211
|
+
const refused = ran.status === "failed" && !("harnessHold" in ran) && relay !== undefined ? yield* relay.refusal : undefined;
|
|
5212
|
+
const deliversOutput = refused !== undefined && (yield* outputSubmitted);
|
|
5213
|
+
if (ran.status !== "finished" && !deliversOutput) {
|
|
5110
5214
|
yield* uninterruptible(checkpoint).pipe(catch_((error) => logWarning("runner_last_checkpoint_failed", error.message)));
|
|
5215
|
+
if (refused !== undefined)
|
|
5216
|
+
return {
|
|
5217
|
+
status: "failed",
|
|
5218
|
+
failureSummary: refused.summary,
|
|
5219
|
+
harnessHold: refusalHold(refused)
|
|
5220
|
+
};
|
|
5221
|
+
if (backend === "docker" && "restart" in ran && ran.restart !== undefined)
|
|
5222
|
+
return {
|
|
5223
|
+
status: "failed",
|
|
5224
|
+
failureSummary: ran.summary,
|
|
5225
|
+
harnessHold: refusalHold({ summary: ran.summary, kind: "login_refused" })
|
|
5226
|
+
};
|
|
5111
5227
|
return {
|
|
5112
5228
|
status: ran.status,
|
|
5113
5229
|
failureSummary: ran.summary,
|
|
@@ -5711,7 +5827,7 @@ var codexAppServer = (binary = "codex") => (env) => gen(function* () {
|
|
|
5711
5827
|
const input = yield* unbounded2();
|
|
5712
5828
|
const pending = new Map;
|
|
5713
5829
|
let lastId = 0;
|
|
5714
|
-
const handle = yield* spawner.spawn(
|
|
5830
|
+
const handle = yield* spawner.spawn(make3(binary, ["app-server"], {
|
|
5715
5831
|
cwd: env.home,
|
|
5716
5832
|
extendEnv: true,
|
|
5717
5833
|
env: { HOME: env.home, CODEX_HOME: env.codexHome },
|
|
@@ -5734,7 +5850,7 @@ var codexAppServer = (binary = "codex") => (env) => gen(function* () {
|
|
|
5734
5850
|
return {
|
|
5735
5851
|
request: (method, params) => gen(function* () {
|
|
5736
5852
|
const id = ++lastId;
|
|
5737
|
-
const deferred = yield*
|
|
5853
|
+
const deferred = yield* make16();
|
|
5738
5854
|
pending.set(id, deferred);
|
|
5739
5855
|
yield* send({ id, method, params });
|
|
5740
5856
|
return yield* _await(deferred).pipe(mapError2((error) => new CodexAppServerFailed({ reason: `${method}: ${error.message}` })));
|
|
@@ -5874,10 +5990,10 @@ var handshake = [
|
|
|
5874
5990
|
`).join("");
|
|
5875
5991
|
var kitmanMcpPreflight = (mcp) => gen(function* () {
|
|
5876
5992
|
const spawner = yield* ChildProcessSpawner;
|
|
5877
|
-
const server = yield* spawner.spawn(
|
|
5993
|
+
const server = yield* spawner.spawn(make3(mcp.command, [...mcp.args], {
|
|
5878
5994
|
extendEnv: true,
|
|
5879
5995
|
env: mcp.env,
|
|
5880
|
-
stdin: { stream:
|
|
5996
|
+
stdin: { stream: make11(new TextEncoder().encode(handshake)), endOnDone: false },
|
|
5881
5997
|
stderr: "ignore"
|
|
5882
5998
|
}));
|
|
5883
5999
|
const reply = yield* server.stdout.pipe(decodeText, splitLines, map2((line) => getOrUndefined(decodeJsonStringOption(line))), filter((message) => isJsonObject(message) && message.id === 2), runHead);
|
|
@@ -5950,8 +6066,8 @@ var programProcessExecutor = (input) => (work) => gen(function* () {
|
|
|
5950
6066
|
};
|
|
5951
6067
|
const exitCode = sandbox === undefined ? yield* gen(function* () {
|
|
5952
6068
|
const spawner = yield* ChildProcessSpawner;
|
|
5953
|
-
const handle = yield* spawner.spawn(
|
|
5954
|
-
stdin:
|
|
6069
|
+
const handle = yield* spawner.spawn(make3(input.bun ?? process.execPath, [file], {
|
|
6070
|
+
stdin: make11(new TextEncoder().encode(stdin)),
|
|
5955
6071
|
stdout: "inherit",
|
|
5956
6072
|
stderr: "inherit",
|
|
5957
6073
|
extendEnv: false,
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
add,
|
|
13
13
|
getOrUndefinedUnsafe,
|
|
14
14
|
getUnsafe,
|
|
15
|
-
|
|
15
|
+
get4,
|
|
16
16
|
Reference,
|
|
17
17
|
toMillis,
|
|
18
18
|
isSuccess,
|
|
@@ -96,7 +96,7 @@ import {
|
|
|
96
96
|
Defect,
|
|
97
97
|
Exit,
|
|
98
98
|
toCodecJson
|
|
99
|
-
} from "./chunk-
|
|
99
|
+
} from "./chunk-d3ksv8y1.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-0fdgam8v.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-sdpjvc1r.js";
|
|
127
127
|
|
|
128
128
|
// node_modules/.bun/effect@4.1.2/node_modules/effect/dist/workers/Transferable.js
|
|
129
129
|
class Collector extends (/* @__PURE__ */ Service2()("effect/workers/Transferable/Collector")) {
|
|
@@ -237,7 +237,7 @@ var makeNoSerialization = /* @__PURE__ */ fnUntraced(function* (group, options)
|
|
|
237
237
|
const disableTracing = options?.disableTracing ?? false;
|
|
238
238
|
const generateRequestId = options?.generateRequestId ?? (() => requestIdCounter++);
|
|
239
239
|
const services = yield* context();
|
|
240
|
-
const scope =
|
|
240
|
+
const scope = get4(services, Scope);
|
|
241
241
|
const entries = new Map;
|
|
242
242
|
let isShutdown = false;
|
|
243
243
|
yield* addFinalizer(scope, withFiber2((parent) => {
|
|
@@ -483,7 +483,7 @@ var makeNoSerialization = /* @__PURE__ */ fnUntraced(function* (group, options)
|
|
|
483
483
|
};
|
|
484
484
|
});
|
|
485
485
|
var clientIdCounter = 0;
|
|
486
|
-
var
|
|
486
|
+
var make4 = /* @__PURE__ */ fnUntraced(function* (group, options) {
|
|
487
487
|
const clientId = clientIdCounter++;
|
|
488
488
|
const {
|
|
489
489
|
codecFor,
|
|
@@ -643,7 +643,7 @@ var makeRpcSchemas = (codecFor) => {
|
|
|
643
643
|
return entry;
|
|
644
644
|
}
|
|
645
645
|
const streamSchemas = getStreamSchemas(rpc.successSchema);
|
|
646
|
-
const parseOptions =
|
|
646
|
+
const parseOptions = get4(rpc.annotations, ParseOptions);
|
|
647
647
|
const exitSchema2 = exitSchema(rpc);
|
|
648
648
|
let decodeDiscardExit;
|
|
649
649
|
entry = {
|
|
@@ -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, make4, withHeaders, layerProtocolSocket, ConnectionHooks };
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
|
+
isString2,
|
|
4
|
+
hasProperty,
|
|
5
|
+
symbol,
|
|
6
|
+
hash,
|
|
7
|
+
symbol2,
|
|
8
|
+
equals,
|
|
3
9
|
BaseProto,
|
|
10
|
+
PipeInspectableProto,
|
|
4
11
|
Prototype,
|
|
5
12
|
some,
|
|
6
13
|
Service2,
|
|
@@ -14,11 +21,8 @@ import {
|
|
|
14
21
|
andThen2,
|
|
15
22
|
map8,
|
|
16
23
|
raceFirst,
|
|
17
|
-
scoped
|
|
18
|
-
|
|
19
|
-
make15,
|
|
20
|
-
value
|
|
21
|
-
} from "./chunk-nk5h4cvx.js";
|
|
24
|
+
scoped
|
|
25
|
+
} from "./chunk-d3ksv8y1.js";
|
|
22
26
|
import {
|
|
23
27
|
unwrap,
|
|
24
28
|
drainFork,
|
|
@@ -27,7 +31,49 @@ import {
|
|
|
27
31
|
runCollect,
|
|
28
32
|
runDrain,
|
|
29
33
|
mkString
|
|
30
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-0fdgam8v.js";
|
|
35
|
+
|
|
36
|
+
// node_modules/.bun/effect@4.1.2/node_modules/effect/dist/internal/redacted.js
|
|
37
|
+
var redactedRegistry = /* @__PURE__ */ new WeakMap;
|
|
38
|
+
var value2 = (self) => {
|
|
39
|
+
if (redactedRegistry.has(self)) {
|
|
40
|
+
return redactedRegistry.get(self);
|
|
41
|
+
} else {
|
|
42
|
+
throw new Error("Unable to get redacted value" + (self.label ? ` with label: "${self.label}"` : ""));
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
// node_modules/.bun/effect@4.1.2/node_modules/effect/dist/Redacted.js
|
|
47
|
+
var TypeId = "~effect/Redacted";
|
|
48
|
+
var isRedacted = (u) => hasProperty(u, TypeId);
|
|
49
|
+
var make = (value, options) => {
|
|
50
|
+
const self = Object.create(Proto);
|
|
51
|
+
if (options?.label) {
|
|
52
|
+
self.label = options.label;
|
|
53
|
+
}
|
|
54
|
+
redactedRegistry.set(self, value);
|
|
55
|
+
return self;
|
|
56
|
+
};
|
|
57
|
+
var Proto = {
|
|
58
|
+
[TypeId]: {
|
|
59
|
+
_A: (_) => _
|
|
60
|
+
},
|
|
61
|
+
label: undefined,
|
|
62
|
+
...PipeInspectableProto,
|
|
63
|
+
toJSON() {
|
|
64
|
+
return this.toString();
|
|
65
|
+
},
|
|
66
|
+
toString() {
|
|
67
|
+
return `<redacted${isString2(this.label) ? ":" + this.label : ""}>`;
|
|
68
|
+
},
|
|
69
|
+
[symbol]() {
|
|
70
|
+
return hash(redactedRegistry.get(this));
|
|
71
|
+
},
|
|
72
|
+
[symbol2](that) {
|
|
73
|
+
return isRedacted(that) && equals(redactedRegistry.get(this), redactedRegistry.get(that));
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
var value = value2;
|
|
31
77
|
|
|
32
78
|
// node_modules/.bun/effect@4.1.2/node_modules/effect/dist/Brand.js
|
|
33
79
|
function nominal() {
|
|
@@ -55,7 +101,7 @@ var HandleProto = {
|
|
|
55
101
|
var makeHandle = (params) => Object.setPrototypeOf({
|
|
56
102
|
...params
|
|
57
103
|
}, HandleProto);
|
|
58
|
-
var
|
|
104
|
+
var make2 = (spawn) => {
|
|
59
105
|
const streamString = (command, options) => spawn(command).pipe(map8((handle) => decodeText(options?.includeStderr === true ? handle.all : drainFork(handle.stdout, handle.stderr))), unwrap);
|
|
60
106
|
const streamLines = (command, options) => splitLines(streamString(command, options));
|
|
61
107
|
return ChildProcessSpawner.of({
|
|
@@ -176,7 +222,7 @@ var parseTemplate = (texts, values) => {
|
|
|
176
222
|
if (word.length === 0)
|
|
177
223
|
return;
|
|
178
224
|
const value = word.map(unwrap2).join("");
|
|
179
|
-
words.push(word.length === 1 && isRedacted(word[0]) ? word[0] : word.some(isRedacted) ?
|
|
225
|
+
words.push(word.length === 1 && isRedacted(word[0]) ? word[0] : word.some(isRedacted) ? make(value) : value);
|
|
180
226
|
word = [];
|
|
181
227
|
plain = true;
|
|
182
228
|
braceDepth = 0;
|
|
@@ -266,23 +312,23 @@ var parseTemplate = (texts, values) => {
|
|
|
266
312
|
};
|
|
267
313
|
|
|
268
314
|
// node_modules/.bun/effect@4.1.2/node_modules/effect/dist/process/ChildProcess.js
|
|
269
|
-
var
|
|
270
|
-
var
|
|
315
|
+
var TypeId2 = "~effect/process/ChildProcess";
|
|
316
|
+
var Proto2 = {
|
|
271
317
|
.../* @__PURE__ */ Prototype({
|
|
272
318
|
label: "Command",
|
|
273
319
|
evaluate(fiber) {
|
|
274
320
|
return getUnsafe(fiber.context, ChildProcessSpawner).spawn(this);
|
|
275
321
|
}
|
|
276
322
|
}),
|
|
277
|
-
[
|
|
323
|
+
[TypeId2]: TypeId2
|
|
278
324
|
};
|
|
279
|
-
var makeStandardCommand = (command, args, options) => Object.assign(Object.create(
|
|
325
|
+
var makeStandardCommand = (command, args, options) => Object.assign(Object.create(Proto2), {
|
|
280
326
|
_tag: "StandardCommand",
|
|
281
327
|
command,
|
|
282
328
|
args,
|
|
283
329
|
options
|
|
284
330
|
});
|
|
285
|
-
var
|
|
331
|
+
var make3 = function make(...args) {
|
|
286
332
|
if (isTemplateString(args[0])) {
|
|
287
333
|
const [templates, ...expressions] = args;
|
|
288
334
|
const [command, cmdArgs] = parseTemplate2(templates, expressions);
|
|
@@ -340,4 +386,4 @@ var shellScript = (templates, expressions) => {
|
|
|
340
386
|
}
|
|
341
387
|
return script;
|
|
342
388
|
};
|
|
343
|
-
export { ExitCode, ProcessId, makeHandle,
|
|
389
|
+
export { isRedacted, make, value, ExitCode, ProcessId, makeHandle, make2, ChildProcessSpawner, display, make3, parseFdName, fdName };
|