@ancha-labs/cli 0.4.10 → 0.4.11
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/README.md +10 -10
- package/lib/ancha.mjs +8976 -5468
- package/lib/assets/SKILL.md +30 -27
- package/lib/assets/agents-section.md +21 -19
- package/lib/assets/docs/apps.md +8 -8
- package/lib/assets/docs/cloud.md +35 -32
- package/lib/assets/docs/compare.md +3 -3
- package/lib/assets/docs/explain.md +8 -6
- package/lib/assets/docs/run.md +13 -13
- package/lib/assets/docs/scenes.md +4 -4
- package/lib/assets/docs/setup.md +26 -24
- package/lib/assets/docs/traces.md +8 -7
- package/lib/assets/harbor/companion.mjs +19 -19
- package/lib/assets/llms.txt +6 -6
- package/lib/assets/ui/app.js +110 -35
- package/lib/assets/ui/style.css +5 -2
- package/lib/mcp-entry.mjs +15 -15
- package/lib/worker.mjs +690 -330
- package/lib/world-server.mjs +19 -19
- package/package.json +1 -1
package/lib/worker.mjs
CHANGED
|
@@ -5058,7 +5058,7 @@ function isRef(value4) {
|
|
|
5058
5058
|
function cloneIssues(issues) {
|
|
5059
5059
|
return issues.map((iss) => iss.path ? { ...iss, path: iss.path.slice() } : { ...iss });
|
|
5060
5060
|
}
|
|
5061
|
-
function isRecursive(inst, stack,
|
|
5061
|
+
function isRecursive(inst, stack, resolve13) {
|
|
5062
5062
|
const cached3 = recursive.get(inst);
|
|
5063
5063
|
if (cached3 !== void 0)
|
|
5064
5064
|
return cached3 ? PROVEN : NONE;
|
|
@@ -5068,7 +5068,7 @@ function isRecursive(inst, stack, resolve12) {
|
|
|
5068
5068
|
let result = NONE;
|
|
5069
5069
|
const check3 = (child2) => {
|
|
5070
5070
|
if (result !== PROVEN && child2?._zod) {
|
|
5071
|
-
const answer = isRecursive(child2, stack,
|
|
5071
|
+
const answer = isRecursive(child2, stack, resolve13);
|
|
5072
5072
|
if (answer > result)
|
|
5073
5073
|
result = answer;
|
|
5074
5074
|
}
|
|
@@ -5079,7 +5079,7 @@ function isRecursive(inst, stack, resolve12) {
|
|
|
5079
5079
|
const desc = Object.getOwnPropertyDescriptor(sh, key4);
|
|
5080
5080
|
if (spread && !desc.enumerable)
|
|
5081
5081
|
continue;
|
|
5082
|
-
const child2 = desc.get ? ASSUMED : desc.value?._zod ? isRecursive(desc.value, stack,
|
|
5082
|
+
const child2 = desc.get ? ASSUMED : desc.value?._zod ? isRecursive(desc.value, stack, resolve13) : NONE;
|
|
5083
5083
|
if (child2 > answer)
|
|
5084
5084
|
answer = child2;
|
|
5085
5085
|
}
|
|
@@ -5143,7 +5143,7 @@ function isRecursive(inst, stack, resolve12) {
|
|
|
5143
5143
|
break;
|
|
5144
5144
|
// `$ZodLazy` caches its inner on the def, so a resolved edge is followed exactly
|
|
5145
5145
|
case "lazy": {
|
|
5146
|
-
const inner = def._cachedInner ?? (
|
|
5146
|
+
const inner = def._cachedInner ?? (resolve13 ? inst._zod.innerType : void 0);
|
|
5147
5147
|
merge3(inner ? isRecursive(inner, stack, false) : ASSUMED);
|
|
5148
5148
|
break;
|
|
5149
5149
|
}
|
|
@@ -22747,7 +22747,7 @@ var init_gmail = __esm({
|
|
|
22747
22747
|
} catch {
|
|
22748
22748
|
return false;
|
|
22749
22749
|
}
|
|
22750
|
-
}, "expected an ISO 8601 time with a timezone, or a nonpositive offset from the
|
|
22750
|
+
}, "expected an ISO 8601 time with a timezone, or a nonpositive offset from the start of the test such as -35m");
|
|
22751
22751
|
ref7 = external_exports.string().regex(/^[A-Za-z0-9_-]{1,80}$/);
|
|
22752
22752
|
attachment = external_exports.strictObject({
|
|
22753
22753
|
filename: external_exports.string().min(1).max(255),
|
|
@@ -23134,7 +23134,7 @@ var init_linear = __esm({
|
|
|
23134
23134
|
} catch {
|
|
23135
23135
|
return false;
|
|
23136
23136
|
}
|
|
23137
|
-
}, "expected an ISO 8601 time with a timezone, or a nonpositive offset from the
|
|
23137
|
+
}, "expected an ISO 8601 time with a timezone, or a nonpositive offset from the start of the test such as -2h");
|
|
23138
23138
|
zone3 = external_exports.string().max(100).refine((value4) => {
|
|
23139
23139
|
try {
|
|
23140
23140
|
new Intl.DateTimeFormat("en", { timeZone: value4 });
|
|
@@ -23683,11 +23683,11 @@ var init_stripe = __esm({
|
|
|
23683
23683
|
};
|
|
23684
23684
|
past = external_exports.string().refine(
|
|
23685
23685
|
(value4) => external_exports.iso.datetime({ offset: true }).safeParse(value4).success ? Number.isFinite(Date.parse(value4)) : isDuration(value4) && parseDuration(value4) <= 0,
|
|
23686
|
-
"expected an ISO 8601 time with a timezone, or a nonpositive offset from the
|
|
23686
|
+
"expected an ISO 8601 time with a timezone, or a nonpositive offset from the start of the test such as -720h"
|
|
23687
23687
|
);
|
|
23688
23688
|
moment = external_exports.string().refine(
|
|
23689
23689
|
(value4) => external_exports.iso.datetime({ offset: true }).safeParse(value4).success ? Number.isFinite(Date.parse(value4)) : isDuration(value4),
|
|
23690
|
-
"expected an ISO 8601 time with a timezone, or an offset from the
|
|
23690
|
+
"expected an ISO 8601 time with a timezone, or an offset from the start of the test such as 72h or -24h"
|
|
23691
23691
|
);
|
|
23692
23692
|
StripeSeedSchema = external_exports.strictObject({
|
|
23693
23693
|
account: external_exports.strictObject({ name: text8, currency: external_exports.enum(["usd", "eur", "gbp", "cad", "aud"]).default("usd"), statement_descriptor: external_exports.string().regex(/^[A-Za-z0-9 .-]{5,22}$/).optional() }),
|
|
@@ -24240,7 +24240,7 @@ var init_notion = __esm({
|
|
|
24240
24240
|
} catch {
|
|
24241
24241
|
return false;
|
|
24242
24242
|
}
|
|
24243
|
-
}, "expected an ISO 8601 time with a timezone, or a nonpositive offset from the
|
|
24243
|
+
}, "expected an ISO 8601 time with a timezone, or a nonpositive offset from the start of the test such as -8h");
|
|
24244
24244
|
day2 = external_exports.string().regex(/^\d{4}-\d{2}-\d{2}$/);
|
|
24245
24245
|
block = external_exports.lazy(() => external_exports.strictObject({
|
|
24246
24246
|
type: external_exports.enum(NOTION_BLOCK_TYPES),
|
|
@@ -24549,7 +24549,7 @@ var init_attio = __esm({
|
|
|
24549
24549
|
} catch {
|
|
24550
24550
|
return false;
|
|
24551
24551
|
}
|
|
24552
|
-
}, "expected an ISO 8601 time with a timezone, or a nonpositive offset from the
|
|
24552
|
+
}, "expected an ISO 8601 time with a timezone, or a nonpositive offset from the start of the test such as -30h");
|
|
24553
24553
|
attribute = external_exports.strictObject({
|
|
24554
24554
|
api_slug: slug,
|
|
24555
24555
|
title: external_exports.string().min(1).max(100),
|
|
@@ -24831,7 +24831,7 @@ var init_resend = __esm({
|
|
|
24831
24831
|
};
|
|
24832
24832
|
past2 = external_exports.string().refine(
|
|
24833
24833
|
(v) => external_exports.iso.datetime({ offset: true }).safeParse(v).success ? Number.isFinite(Date.parse(v)) : isDuration2(v) && parseDuration(v) <= 0,
|
|
24834
|
-
"expected an ISO 8601 time with a timezone, or a nonpositive offset from the
|
|
24834
|
+
"expected an ISO 8601 time with a timezone, or a nonpositive offset from the start of the test such as -26h"
|
|
24835
24835
|
);
|
|
24836
24836
|
moment2 = external_exports.string().refine((v) => external_exports.iso.datetime({ offset: true }).safeParse(v).success ? Number.isFinite(Date.parse(v)) : isDuration2(v), "expected an ISO 8601 time or an offset such as 24h");
|
|
24837
24837
|
ResendSeedSchema = external_exports.strictObject({
|
|
@@ -25210,7 +25210,7 @@ var init_shopify = __esm({
|
|
|
25210
25210
|
} catch {
|
|
25211
25211
|
return false;
|
|
25212
25212
|
}
|
|
25213
|
-
}, "expected an ISO 8601 time with a timezone, or a nonpositive offset from the
|
|
25213
|
+
}, "expected an ISO 8601 time with a timezone, or a nonpositive offset from the start of the test such as -30h");
|
|
25214
25214
|
address3 = external_exports.strictObject({
|
|
25215
25215
|
first_name: external_exports.string().max(100).optional(),
|
|
25216
25216
|
last_name: external_exports.string().max(100).optional(),
|
|
@@ -25972,7 +25972,7 @@ var init_paypal = __esm({
|
|
|
25972
25972
|
} catch {
|
|
25973
25973
|
return false;
|
|
25974
25974
|
}
|
|
25975
|
-
}, "expected an ISO 8601 time with a timezone, or a nonpositive offset from the
|
|
25975
|
+
}, "expected an ISO 8601 time with a timezone, or a nonpositive offset from the start of the test such as -30h");
|
|
25976
25976
|
person = external_exports.strictObject({ first_name: external_exports.string().min(1).max(140), last_name: external_exports.string().min(1).max(140), email: external_exports.string().regex(EMAIL8) });
|
|
25977
25977
|
PayPalSeedSchema = external_exports.strictObject({
|
|
25978
25978
|
account: external_exports.strictObject({
|
|
@@ -26185,7 +26185,7 @@ var init_jira = __esm({
|
|
|
26185
26185
|
} catch {
|
|
26186
26186
|
return false;
|
|
26187
26187
|
}
|
|
26188
|
-
}, future ? "expected an ISO 8601 time with a timezone, or an offset from the
|
|
26188
|
+
}, future ? "expected an ISO 8601 time with a timezone, or an offset from the start of the test such as 7d" : "expected an ISO 8601 time with a timezone, or a nonpositive offset from the start of the test such as -30h");
|
|
26189
26189
|
past5 = time3();
|
|
26190
26190
|
moment3 = time3(true);
|
|
26191
26191
|
JiraSeedSchema = external_exports.strictObject({
|
|
@@ -26746,7 +26746,7 @@ var init_intercom = __esm({
|
|
|
26746
26746
|
} catch {
|
|
26747
26747
|
return false;
|
|
26748
26748
|
}
|
|
26749
|
-
}, future ? "expected an ISO 8601 time with a timezone, or an offset from the
|
|
26749
|
+
}, future ? "expected an ISO 8601 time with a timezone, or an offset from the start of the test such as 1d" : "expected an ISO 8601 time with a timezone, or a nonpositive offset from the start of the test such as -30h");
|
|
26750
26750
|
past6 = time4();
|
|
26751
26751
|
moment4 = time4(true);
|
|
26752
26752
|
IntercomSeedSchema = external_exports.strictObject({
|
|
@@ -27288,7 +27288,7 @@ var init_google_calendar = __esm({
|
|
|
27288
27288
|
};
|
|
27289
27289
|
time5 = (future) => external_exports.string().refine(
|
|
27290
27290
|
(v) => external_exports.iso.datetime({ offset: true }).safeParse(v).success ? Number.isFinite(Date.parse(v)) : offsetOk(v, future),
|
|
27291
|
-
future ? "expected an ISO 8601 time with an offset, or an offset from the
|
|
27291
|
+
future ? "expected an ISO 8601 time with an offset, or an offset from the start of the test such as 26h" : "expected an ISO 8601 time with an offset, or a nonpositive offset such as -30h"
|
|
27292
27292
|
);
|
|
27293
27293
|
past7 = time5(false);
|
|
27294
27294
|
moment5 = time5(true);
|
|
@@ -28056,7 +28056,7 @@ var init_sentry = __esm({
|
|
|
28056
28056
|
} catch {
|
|
28057
28057
|
return false;
|
|
28058
28058
|
}
|
|
28059
|
-
}, "expected an ISO 8601 time with a timezone, or a nonpositive offset from the
|
|
28059
|
+
}, "expected an ISO 8601 time with a timezone, or a nonpositive offset from the start of the test such as -30h");
|
|
28060
28060
|
spacing = external_exports.string().refine((value4) => {
|
|
28061
28061
|
try {
|
|
28062
28062
|
return parseDuration(value4) > 0;
|
|
@@ -30395,7 +30395,7 @@ var init_netsuite = __esm({
|
|
|
30395
30395
|
positive = money6.refine((value4) => value4 > 0, "must be more than 0");
|
|
30396
30396
|
day5 = external_exports.string().refine(
|
|
30397
30397
|
(value4) => /^-?\d+d$/.test(value4) || /^\d{4}-\d{2}-\d{2}$/.test(value4) && (/* @__PURE__ */ new Date(`${value4}T00:00:00Z`)).toISOString().slice(0, 10) === value4,
|
|
30398
|
-
"expected YYYY-MM-DD or an offset in days from the
|
|
30398
|
+
"expected YYYY-MM-DD or an offset in days from the start of the test, e.g. -30d"
|
|
30399
30399
|
);
|
|
30400
30400
|
external = text11.optional();
|
|
30401
30401
|
custom2 = external_exports.record(external_exports.string().regex(/^cust(?:entity|body|col|item)[a-z0-9_]+$/), external_exports.union([external_exports.string().max(4e3), external_exports.number(), external_exports.boolean(), external_exports.null()])).optional();
|
|
@@ -31069,7 +31069,7 @@ var init_schema2 = __esm({
|
|
|
31069
31069
|
});
|
|
31070
31070
|
SceneToolSchema = external_exports.strictObject({
|
|
31071
31071
|
/** A JSON lines file next to the scene, one recorded call per line (`ancha run` reads it into `recorded`). */
|
|
31072
|
-
observations: external_exports.string().regex(/^(?!\/)(?!.*(?:^|\/)\.\.(?:\/|$))[^\0]+$/, "a path relative to the
|
|
31072
|
+
observations: external_exports.string().regex(/^(?!\/)(?!.*(?:^|\/)\.\.(?:\/|$))[^\0]+$/, "a path relative to the test file (scene.yaml), without ..").optional(),
|
|
31073
31073
|
recorded: external_exports.array(ToolObservationSchema).optional(),
|
|
31074
31074
|
/** Calls from other traces of this agent, so a simulated answer can follow how the tool behaved there. */
|
|
31075
31075
|
examples: external_exports.array(ToolExampleSchema).optional(),
|
|
@@ -39635,7 +39635,7 @@ function toolIssues(scene2) {
|
|
|
39635
39635
|
if (tool.unrecorded === "twin" && tool.twin === void 0) issues.push({ path: `${path6}.unrecorded`, message: "unrecorded: twin needs the twin that answers", hint: `set ${path6}.twin, e.g. twin: slack` });
|
|
39636
39636
|
if (tool.pure && tool.write) issues.push({ path: `${path6}.pure`, message: "a tool that changes something is not pure", hint: `remove ${path6}.pure, or ${path6}.write if it only computes from its arguments` });
|
|
39637
39637
|
if (tool.observations !== void 0 && tool.recorded === void 0) {
|
|
39638
|
-
issues.push({ path: `${path6}.observations`, message: `${tool.observations} was not read`, hint: "load the
|
|
39638
|
+
issues.push({ path: `${path6}.observations`, message: `${tool.observations} was not read`, hint: "load the test from its file (ancha run, ancha scene validate), which reads the recorded calls next to it" });
|
|
39639
39639
|
}
|
|
39640
39640
|
tool.recorded?.forEach((o, i) => {
|
|
39641
39641
|
if (o.tool !== name5) issues.push({ path: `${path6}.recorded[${i}].tool`, message: `a call to ${o.tool} recorded under ${name5}` });
|
|
@@ -39648,7 +39648,7 @@ function toolIssues(scene2) {
|
|
|
39648
39648
|
const patterns = check3.trace[key4] === void 0 ? [] : [].concat(check3.trace[key4]);
|
|
39649
39649
|
patterns.forEach((pattern) => {
|
|
39650
39650
|
const bare = /^([A-Za-z_][\w.-]{0,127})(?:\s+\{.*\})?$/s.exec(pattern.trim());
|
|
39651
|
-
if (bare && !scene2.tools[bare[1]]) issues.push({ path: `checks[${i}].trace.${key4}`, message: `${bare[1]} is not one of this
|
|
39651
|
+
if (bare && !scene2.tools[bare[1]]) issues.push({ path: `checks[${i}].trace.${key4}`, message: `${bare[1]} is not one of this test's tools`, hint: `the tools are ${Object.keys(scene2.tools).join(", ")}; an API call is "<METHOD> <PATH>"` });
|
|
39652
39652
|
});
|
|
39653
39653
|
}
|
|
39654
39654
|
});
|
|
@@ -39972,7 +39972,7 @@ function ruleIssues(scene2) {
|
|
|
39972
39972
|
if (scene2.world === "static" && scene2.world_rules !== void 0) {
|
|
39973
39973
|
issues.push({
|
|
39974
39974
|
path: "world_rules",
|
|
39975
|
-
message: "static
|
|
39975
|
+
message: "static tests cannot declare world rules",
|
|
39976
39976
|
hint: "set world: living, or remove world_rules"
|
|
39977
39977
|
});
|
|
39978
39978
|
}
|
|
@@ -40109,7 +40109,7 @@ function parseSceneYaml(text24) {
|
|
|
40109
40109
|
return { path: `line ${line2}, column ${col2}`, message: e.message };
|
|
40110
40110
|
});
|
|
40111
40111
|
const atError = doc.errors.findIndex((e) => text24[e.pos[0]] === "@");
|
|
40112
|
-
if (atError >= 0) issues[atError].hint = "
|
|
40112
|
+
if (atError >= 0) issues[atError].hint = "refs in a test use $, e.g. $alice \u2014 YAML reserves @";
|
|
40113
40113
|
throw sceneError(issues, doc.errors[0]);
|
|
40114
40114
|
}
|
|
40115
40115
|
const cut = cutProseIssues(doc, text24, lineCounter);
|
|
@@ -45198,14 +45198,14 @@ function inputRequiredRoundsExceededMessage(method2, maxRounds) {
|
|
|
45198
45198
|
return `Multi-round-trip request '${method2}' still required input after ${maxRounds} rounds (inputRequired.maxRounds)`;
|
|
45199
45199
|
}
|
|
45200
45200
|
function sleep(ms, signal) {
|
|
45201
|
-
return new Promise((
|
|
45201
|
+
return new Promise((resolve13, reject3) => {
|
|
45202
45202
|
if (signal?.aborted) {
|
|
45203
45203
|
reject3(signal.reason instanceof SdkError ? signal.reason : new SdkError(SdkErrorCode.RequestTimeout, String(signal.reason)));
|
|
45204
45204
|
return;
|
|
45205
45205
|
}
|
|
45206
45206
|
const timer = setTimeout(() => {
|
|
45207
45207
|
signal?.removeEventListener("abort", onAbort);
|
|
45208
|
-
|
|
45208
|
+
resolve13();
|
|
45209
45209
|
}, ms);
|
|
45210
45210
|
const onAbort = () => {
|
|
45211
45211
|
clearTimeout(timer);
|
|
@@ -47069,7 +47069,7 @@ var init_src_DdvbAHrR = __esm({
|
|
|
47069
47069
|
const flowStartedAt = Date.now();
|
|
47070
47070
|
let onAbort;
|
|
47071
47071
|
let cleanupMessageId;
|
|
47072
|
-
return new Promise((
|
|
47072
|
+
return new Promise((resolve13, reject3) => {
|
|
47073
47073
|
const earlyReject = (error64) => {
|
|
47074
47074
|
reject3(error64);
|
|
47075
47075
|
};
|
|
@@ -47138,7 +47138,7 @@ var init_src_DdvbAHrR = __esm({
|
|
|
47138
47138
|
}
|
|
47139
47139
|
if (decoded.kind === "invalid") return reject3(decoded.error);
|
|
47140
47140
|
if (decoded.kind === "input_required") {
|
|
47141
|
-
if (options4?.allowInputRequired === true) return
|
|
47141
|
+
if (options4?.allowInputRequired === true) return resolve13(manualInputRequiredValue(decoded));
|
|
47142
47142
|
const flow = {
|
|
47143
47143
|
codec: codec2,
|
|
47144
47144
|
request: request2,
|
|
@@ -47150,11 +47150,11 @@ var init_src_DdvbAHrR = __esm({
|
|
|
47150
47150
|
params: params10
|
|
47151
47151
|
}, resultSchema, legOptions)
|
|
47152
47152
|
};
|
|
47153
|
-
return
|
|
47153
|
+
return resolve13(this._resolveNonCompleteResult(decoded, flow));
|
|
47154
47154
|
}
|
|
47155
47155
|
const result = decoded.result;
|
|
47156
47156
|
validateStandardSchema(resultSchema, result).then((parseResult) => {
|
|
47157
|
-
if (parseResult.success)
|
|
47157
|
+
if (parseResult.success) resolve13(parseResult.data);
|
|
47158
47158
|
else reject3(new SdkError(SdkErrorCode.InvalidResult, `Invalid result for ${request2.method}: ${parseResult.error}`));
|
|
47159
47159
|
}, reject3);
|
|
47160
47160
|
});
|
|
@@ -49941,7 +49941,7 @@ var init_ajvProvider_DyjnscPj = __esm({
|
|
|
49941
49941
|
ref22 = (0, resolve_1.resolveUrl)(this.opts.uriResolver, baseId, ref22);
|
|
49942
49942
|
const schOrFunc = root3.refs[ref22];
|
|
49943
49943
|
if (schOrFunc) return schOrFunc;
|
|
49944
|
-
let _sch =
|
|
49944
|
+
let _sch = resolve13.call(this, root3, ref22);
|
|
49945
49945
|
if (_sch === void 0) {
|
|
49946
49946
|
const schema = (_a7 = root3.localRefs) === null || _a7 === void 0 ? void 0 : _a7[ref22];
|
|
49947
49947
|
const { schemaId } = this.opts;
|
|
@@ -49967,7 +49967,7 @@ var init_ajvProvider_DyjnscPj = __esm({
|
|
|
49967
49967
|
function sameSchemaEnv(s1, s2) {
|
|
49968
49968
|
return s1.schema === s2.schema && s1.root === s2.root && s1.baseId === s2.baseId;
|
|
49969
49969
|
}
|
|
49970
|
-
function
|
|
49970
|
+
function resolve13(root3, ref22) {
|
|
49971
49971
|
let sch;
|
|
49972
49972
|
while (typeof (sch = this.refs[ref22]) == "string") ref22 = sch;
|
|
49973
49973
|
return sch || this.schemas[ref22] || resolveSchema.call(this, root3, ref22);
|
|
@@ -50662,7 +50662,7 @@ var init_ajvProvider_DyjnscPj = __esm({
|
|
|
50662
50662
|
else if (typeof uri === "object") uri = parse14(serialize2(uri, options4), options4);
|
|
50663
50663
|
return uri;
|
|
50664
50664
|
}
|
|
50665
|
-
function
|
|
50665
|
+
function resolve13(baseURI, relativeURI, options4) {
|
|
50666
50666
|
const schemelessOptions = options4 ? Object.assign({ scheme: "null" }, options4) : { scheme: "null" };
|
|
50667
50667
|
const { parsed: baseParsed, malformedAuthorityOrPort: baseMalformed, malformedPercentEncoding: baseMalformedPercentEncoding, malformedSchemeSpecific: baseMalformedSchemeSpecific, malformedHost: baseMalformedHost, malformedScheme: baseMalformedScheme } = parseWithStatus(baseURI, schemelessOptions);
|
|
50668
50668
|
const { parsed: relativeParsed, malformedAuthorityOrPort: relativeMalformed, malformedPercentEncoding: relativeMalformedPercentEncoding, malformedSchemeSpecific: relativeMalformedSchemeSpecific, malformedHost: relativeMalformedHost, malformedScheme: relativeMalformedScheme } = parseWithStatus(relativeURI, schemelessOptions);
|
|
@@ -50677,41 +50677,41 @@ var init_ajvProvider_DyjnscPj = __esm({
|
|
|
50677
50677
|
schemelessOptions.skipEscape = true;
|
|
50678
50678
|
return serialize2(resolved, schemelessOptions);
|
|
50679
50679
|
}
|
|
50680
|
-
function resolveComponent(base3,
|
|
50680
|
+
function resolveComponent(base3, relative7, options4, skipNormalization) {
|
|
50681
50681
|
const target4 = {};
|
|
50682
50682
|
if (!skipNormalization) {
|
|
50683
50683
|
base3 = parse14(serialize2(base3, options4), options4);
|
|
50684
|
-
|
|
50684
|
+
relative7 = parse14(serialize2(relative7, options4), options4);
|
|
50685
50685
|
}
|
|
50686
50686
|
options4 = options4 || {};
|
|
50687
|
-
if (!options4.tolerant &&
|
|
50688
|
-
target4.scheme =
|
|
50689
|
-
target4.userinfo =
|
|
50690
|
-
target4.host =
|
|
50691
|
-
target4.port =
|
|
50692
|
-
target4.path = removeDotSegments(
|
|
50693
|
-
target4.query =
|
|
50687
|
+
if (!options4.tolerant && relative7.scheme) {
|
|
50688
|
+
target4.scheme = relative7.scheme;
|
|
50689
|
+
target4.userinfo = relative7.userinfo;
|
|
50690
|
+
target4.host = relative7.host;
|
|
50691
|
+
target4.port = relative7.port;
|
|
50692
|
+
target4.path = removeDotSegments(relative7.path || "");
|
|
50693
|
+
target4.query = relative7.query;
|
|
50694
50694
|
} else {
|
|
50695
|
-
if (
|
|
50696
|
-
target4.userinfo =
|
|
50697
|
-
target4.host =
|
|
50698
|
-
target4.port =
|
|
50699
|
-
target4.path = removeDotSegments(
|
|
50700
|
-
target4.query =
|
|
50695
|
+
if (relative7.userinfo !== void 0 || relative7.host !== void 0 || relative7.port !== void 0) {
|
|
50696
|
+
target4.userinfo = relative7.userinfo;
|
|
50697
|
+
target4.host = relative7.host;
|
|
50698
|
+
target4.port = relative7.port;
|
|
50699
|
+
target4.path = removeDotSegments(relative7.path || "");
|
|
50700
|
+
target4.query = relative7.query;
|
|
50701
50701
|
} else {
|
|
50702
|
-
if (!
|
|
50702
|
+
if (!relative7.path) {
|
|
50703
50703
|
target4.path = base3.path;
|
|
50704
|
-
if (
|
|
50704
|
+
if (relative7.query !== void 0) target4.query = relative7.query;
|
|
50705
50705
|
else target4.query = base3.query;
|
|
50706
50706
|
} else {
|
|
50707
|
-
if (
|
|
50707
|
+
if (relative7.path[0] === "/") target4.path = removeDotSegments(relative7.path);
|
|
50708
50708
|
else {
|
|
50709
|
-
if ((base3.userinfo !== void 0 || base3.host !== void 0 || base3.port !== void 0) && !base3.path) target4.path = "/" +
|
|
50710
|
-
else if (!base3.path) target4.path =
|
|
50711
|
-
else target4.path = base3.path.slice(0, base3.path.lastIndexOf("/") + 1) +
|
|
50709
|
+
if ((base3.userinfo !== void 0 || base3.host !== void 0 || base3.port !== void 0) && !base3.path) target4.path = "/" + relative7.path;
|
|
50710
|
+
else if (!base3.path) target4.path = relative7.path;
|
|
50711
|
+
else target4.path = base3.path.slice(0, base3.path.lastIndexOf("/") + 1) + relative7.path;
|
|
50712
50712
|
target4.path = removeDotSegments(target4.path);
|
|
50713
50713
|
}
|
|
50714
|
-
target4.query =
|
|
50714
|
+
target4.query = relative7.query;
|
|
50715
50715
|
}
|
|
50716
50716
|
target4.userinfo = base3.userinfo;
|
|
50717
50717
|
target4.host = base3.host;
|
|
@@ -50719,7 +50719,7 @@ var init_ajvProvider_DyjnscPj = __esm({
|
|
|
50719
50719
|
}
|
|
50720
50720
|
target4.scheme = base3.scheme;
|
|
50721
50721
|
}
|
|
50722
|
-
target4.fragment =
|
|
50722
|
+
target4.fragment = relative7.fragment;
|
|
50723
50723
|
return target4;
|
|
50724
50724
|
}
|
|
50725
50725
|
function equal3(uriA, uriB, options4) {
|
|
@@ -50944,7 +50944,7 @@ var init_ajvProvider_DyjnscPj = __esm({
|
|
|
50944
50944
|
const fastUri = {
|
|
50945
50945
|
SCHEMES,
|
|
50946
50946
|
normalize: normalize2,
|
|
50947
|
-
resolve:
|
|
50947
|
+
resolve: resolve13,
|
|
50948
50948
|
resolveComponent,
|
|
50949
50949
|
equal: equal3,
|
|
50950
50950
|
serialize: serialize2,
|
|
@@ -54808,9 +54808,9 @@ function validateScopeChallenge(challenge) {
|
|
|
54808
54808
|
if (challenge.errorDescription !== void 0 && !/^[\u0020-\u0021\u0023-\u005B\u005D-\u007E]+$/.test(challenge.errorDescription)) throw new TypeError("scope challenge errorDescription must satisfy the RFC 6750 error-description grammar");
|
|
54809
54809
|
return challenge;
|
|
54810
54810
|
}
|
|
54811
|
-
async function findScopeChallenge(requests, authInfo,
|
|
54811
|
+
async function findScopeChallenge(requests, authInfo, resolve13) {
|
|
54812
54812
|
for (const request2 of requests) {
|
|
54813
|
-
const challenge = await
|
|
54813
|
+
const challenge = await resolve13({
|
|
54814
54814
|
request: request2,
|
|
54815
54815
|
...authInfo !== void 0 && { authInfo }
|
|
54816
54816
|
});
|
|
@@ -55029,15 +55029,15 @@ var init_mcp_oHn3ureC = __esm({
|
|
|
55029
55029
|
};
|
|
55030
55030
|
if (isJSONRPCRequest(message7)) {
|
|
55031
55031
|
this._requestId = message7.id;
|
|
55032
|
-
let
|
|
55032
|
+
let resolve13;
|
|
55033
55033
|
let reject3;
|
|
55034
55034
|
const promise2 = new Promise((promiseResolve, promiseReject) => {
|
|
55035
|
-
|
|
55035
|
+
resolve13 = promiseResolve;
|
|
55036
55036
|
reject3 = promiseReject;
|
|
55037
55037
|
});
|
|
55038
55038
|
this._deferredResponse = {
|
|
55039
55039
|
promise: promise2,
|
|
55040
|
-
resolve:
|
|
55040
|
+
resolve: resolve13,
|
|
55041
55041
|
reject: reject3,
|
|
55042
55042
|
settled: false
|
|
55043
55043
|
};
|
|
@@ -57559,9 +57559,9 @@ data:
|
|
|
57559
57559
|
const streamId = crypto.randomUUID();
|
|
57560
57560
|
const initRequest = messages2.find((m) => isInitializeRequest(m));
|
|
57561
57561
|
const clientProtocolVersion = initRequest ? initRequest.params.protocolVersion : req.headers.get("mcp-protocol-version") ?? DEFAULT_NEGOTIATED_PROTOCOL_VERSION;
|
|
57562
|
-
if (this._enableJsonResponse) return new Promise((
|
|
57562
|
+
if (this._enableJsonResponse) return new Promise((resolve13) => {
|
|
57563
57563
|
this._streamMapping.set(streamId, {
|
|
57564
|
-
resolveJson:
|
|
57564
|
+
resolveJson: resolve13,
|
|
57565
57565
|
cleanup: () => {
|
|
57566
57566
|
this._streamMapping.delete(streamId);
|
|
57567
57567
|
}
|
|
@@ -61448,13 +61448,13 @@ function reviewCommentShape(ctx, repo4, row) {
|
|
|
61448
61448
|
const url4 = apiUrl(ctx, `${repoPath(repo4)}/pulls/comments/${row.id}`), pull2 = apiUrl(ctx, `${repoPath(repo4)}/pulls/${row.pull_number}`), html2 = `https://github.com/${repo4.full_name}/pull/${row.pull_number}#discussion_r${row.id}`;
|
|
61449
61449
|
return { id: row.id, node_id: nodeId("PullRequestReviewComment", row.id), pull_request_review_id: row.review_id, url: url4, html_url: html2, pull_request_url: pull2, user: userShape(ctx, getUser(ctx, row.user_id)), body: row.body, diff_hunk: row.diff_hunk, path: row.path, commit_id: row.commit_sha, original_commit_id: row.commit_sha, line: row.line, original_line: row.line, side: row.side, start_line: null, original_start_line: null, start_side: null, ...row.in_reply_to_id !== null && { in_reply_to_id: row.in_reply_to_id }, created_at: row.created_at, updated_at: row.updated_at, author_association: "NONE", _links: { self: { href: url4 }, html: { href: html2 }, pull_request: { href: pull2 } } };
|
|
61450
61450
|
}
|
|
61451
|
-
function resourceUserShape(ctx, user8,
|
|
61452
|
-
const result = userShape(
|
|
61453
|
-
if (
|
|
61451
|
+
function resourceUserShape(ctx, user8, relative7 = false) {
|
|
61452
|
+
const result = userShape(relative7 ? { ...ctx, serviceUrl: "https://ancha.invalid" } : ctx, user8);
|
|
61453
|
+
if (relative7) for (const key4 of ["url", "followers_url", "following_url", "gists_url", "starred_url", "subscriptions_url", "organizations_url", "repos_url", "events_url", "received_events_url"]) result[key4] = result[key4].slice("https://ancha.invalid".length);
|
|
61454
61454
|
return result;
|
|
61455
61455
|
}
|
|
61456
|
-
function resourceUrl(ctx, path6,
|
|
61457
|
-
return
|
|
61456
|
+
function resourceUrl(ctx, path6, relative7 = false) {
|
|
61457
|
+
return relative7 ? path6 : apiUrl(ctx, path6);
|
|
61458
61458
|
}
|
|
61459
61459
|
var segment, repoPath, nodeId;
|
|
61460
61460
|
var init_shapes = __esm({
|
|
@@ -61939,13 +61939,13 @@ function requireDeployment(ctx, repoId, id14) {
|
|
|
61939
61939
|
if (!row) throw new GitHubError(404, "Not Found");
|
|
61940
61940
|
return row;
|
|
61941
61941
|
}
|
|
61942
|
-
function deploymentShape(ctx, repo4, row,
|
|
61942
|
+
function deploymentShape(ctx, repo4, row, relative7 = false) {
|
|
61943
61943
|
const path6 = `${repoPath(repo4)}/deployments/${row.id}`, data5 = JSON.parse(row.json);
|
|
61944
|
-
return { ...data5, id: row.id, node_id: Buffer.from(`Deployment:${row.id}`).toString("base64"), sha: row.sha, ref: row.ref, environment: row.environment, creator: resourceUserShape(ctx, getUser(ctx, row.user_id),
|
|
61944
|
+
return { ...data5, id: row.id, node_id: Buffer.from(`Deployment:${row.id}`).toString("base64"), sha: row.sha, ref: row.ref, environment: row.environment, creator: resourceUserShape(ctx, getUser(ctx, row.user_id), relative7), created_at: row.created_at, updated_at: row.created_at, url: resourceUrl(ctx, path6, relative7), statuses_url: resourceUrl(ctx, `${path6}/statuses`, relative7), repository_url: resourceUrl(ctx, repoPath(repo4), relative7) };
|
|
61945
61945
|
}
|
|
61946
|
-
function deploymentStatusShape(ctx, repo4, deployment, row,
|
|
61946
|
+
function deploymentStatusShape(ctx, repo4, deployment, row, relative7 = false) {
|
|
61947
61947
|
const path6 = `${repoPath(repo4)}/deployments/${deployment.id}`;
|
|
61948
|
-
return { ...JSON.parse(row.json), id: row.id, node_id: Buffer.from(`DeploymentStatus:${row.id}`).toString("base64"), state: row.state, creator: resourceUserShape(ctx, botUser(ctx),
|
|
61948
|
+
return { ...JSON.parse(row.json), id: row.id, node_id: Buffer.from(`DeploymentStatus:${row.id}`).toString("base64"), state: row.state, creator: resourceUserShape(ctx, botUser(ctx), relative7), created_at: row.created_at, updated_at: row.created_at, environment: deployment.environment, url: resourceUrl(ctx, `${path6}/statuses/${row.id}`, relative7), deployment_url: resourceUrl(ctx, path6, relative7), repository_url: resourceUrl(ctx, repoPath(repo4), relative7) };
|
|
61949
61949
|
}
|
|
61950
61950
|
function insertDeployment(ctx, repo4, sha2, ref22, environment2, data5 = {}) {
|
|
61951
61951
|
return withMutation(ctx, () => {
|
|
@@ -62055,11 +62055,11 @@ function requireRun(ctx, repoId, runId) {
|
|
|
62055
62055
|
if (!row) throw new GitHubError(404, "Not Found");
|
|
62056
62056
|
return row;
|
|
62057
62057
|
}
|
|
62058
|
-
function workflowRunShape(ctx, repo4, row,
|
|
62058
|
+
function workflowRunShape(ctx, repo4, row, relative7 = false) {
|
|
62059
62059
|
const workflow = ctx.store.db.prepare("SELECT * FROM github_workflows WHERE repo_id = ? AND id = ?").get(repo4.id, row.workflow_id);
|
|
62060
|
-
const path6 = `${repoPath(repo4)}/actions/runs/${row.id}`, commit = getCommit(ctx, repo4.id, row.head_sha), actor2 = resourceUserShape(ctx, botUser(ctx),
|
|
62061
|
-
const link6 = (suffix) => resourceUrl(ctx, `${path6}/${suffix}`,
|
|
62062
|
-
const repository2 = repositoryShape(
|
|
62060
|
+
const path6 = `${repoPath(repo4)}/actions/runs/${row.id}`, commit = getCommit(ctx, repo4.id, row.head_sha), actor2 = resourceUserShape(ctx, botUser(ctx), relative7);
|
|
62061
|
+
const link6 = (suffix) => resourceUrl(ctx, `${path6}/${suffix}`, relative7);
|
|
62062
|
+
const repository2 = repositoryShape(relative7 ? githubEventContext(ctx) : ctx, repo4);
|
|
62063
62063
|
return {
|
|
62064
62064
|
id: row.id,
|
|
62065
62065
|
node_id: Buffer.from(`WorkflowRun:${row.id}`).toString("base64"),
|
|
@@ -62079,16 +62079,16 @@ function workflowRunShape(ctx, repo4, row, relative6 = false) {
|
|
|
62079
62079
|
actor: actor2,
|
|
62080
62080
|
triggering_actor: actor2,
|
|
62081
62081
|
display_title: commit.message.split("\n")[0],
|
|
62082
|
-
url: resourceUrl(ctx, path6,
|
|
62082
|
+
url: resourceUrl(ctx, path6, relative7),
|
|
62083
62083
|
html_url: `https://github.com/${repo4.full_name}/actions/runs/${row.id}`,
|
|
62084
62084
|
pull_requests: [],
|
|
62085
62085
|
jobs_url: link6("jobs"),
|
|
62086
62086
|
logs_url: link6("logs"),
|
|
62087
|
-
check_suite_url: resourceUrl(ctx, `${repoPath(repo4)}/check-suites/${row.id}`,
|
|
62087
|
+
check_suite_url: resourceUrl(ctx, `${repoPath(repo4)}/check-suites/${row.id}`, relative7),
|
|
62088
62088
|
artifacts_url: link6("artifacts"),
|
|
62089
62089
|
cancel_url: link6("cancel"),
|
|
62090
62090
|
rerun_url: link6("rerun"),
|
|
62091
|
-
workflow_url: resourceUrl(ctx, `${repoPath(repo4)}/actions/workflows/${workflow.id}`,
|
|
62091
|
+
workflow_url: resourceUrl(ctx, `${repoPath(repo4)}/actions/workflows/${workflow.id}`, relative7),
|
|
62092
62092
|
repository: repository2,
|
|
62093
62093
|
head_repository: repository2,
|
|
62094
62094
|
head_commit: { id: row.head_sha, tree_id: commit.tree, message: commit.message, timestamp: commit.at, author: commit.author, committer: commit.author }
|
|
@@ -67170,7 +67170,7 @@ function matches(integration2, event3) {
|
|
|
67170
67170
|
return on.includes(type) || event3.action !== void 0 && on.includes(`${type}.${event3.action}`);
|
|
67171
67171
|
}
|
|
67172
67172
|
function renderContext(env) {
|
|
67173
|
-
const
|
|
67173
|
+
const resolve13 = (ref22, kind) => {
|
|
67174
67174
|
try {
|
|
67175
67175
|
return env.refs.tryResolve(ref22, kind);
|
|
67176
67176
|
} catch {
|
|
@@ -67178,9 +67178,9 @@ function renderContext(env) {
|
|
|
67178
67178
|
}
|
|
67179
67179
|
};
|
|
67180
67180
|
return {
|
|
67181
|
-
resolve:
|
|
67181
|
+
resolve: resolve13,
|
|
67182
67182
|
openIssueByTitle: (repoRef, title2) => {
|
|
67183
|
-
const repo4 =
|
|
67183
|
+
const repo4 = resolve13(repoRef, "repo");
|
|
67184
67184
|
if (repo4 === void 0) return void 0;
|
|
67185
67185
|
return env.store.db.prepare("SELECT number FROM github_issues WHERE repo_id = ? AND title = ? AND state = 'open' AND is_pull = 0 ORDER BY number LIMIT 1").get(Number(repo4), title2)?.number;
|
|
67186
67186
|
},
|
|
@@ -67387,13 +67387,13 @@ function aggregateValues(values2, aggregation) {
|
|
|
67387
67387
|
}
|
|
67388
67388
|
function resolveQueryRange(from, to, nowMs) {
|
|
67389
67389
|
if (!Number.isFinite(nowMs)) invalid3("invalid captured query time");
|
|
67390
|
-
const
|
|
67390
|
+
const resolve13 = (text24) => {
|
|
67391
67391
|
if (text24 === "now") return Math.floor(nowMs);
|
|
67392
|
-
const
|
|
67393
|
-
if (
|
|
67392
|
+
const relative7 = /^now-(.+)$/.exec(text24);
|
|
67393
|
+
if (relative7) {
|
|
67394
67394
|
let duration9;
|
|
67395
67395
|
try {
|
|
67396
|
-
duration9 = /^[1-9]\d*d$/.test(
|
|
67396
|
+
duration9 = /^[1-9]\d*d$/.test(relative7[1]) ? Number(relative7[1].slice(0, -1)) * MAX_QUERY_WINDOW_MS : parseDuration(relative7[1]);
|
|
67397
67397
|
} catch {
|
|
67398
67398
|
return invalid3("invalid relative query duration");
|
|
67399
67399
|
}
|
|
@@ -67407,7 +67407,7 @@ function resolveQueryRange(from, to, nowMs) {
|
|
|
67407
67407
|
if (date10.toISOString().slice(0, 10) !== absolute2[1]) return invalid3("invalid ISO calendar date");
|
|
67408
67408
|
return value4;
|
|
67409
67409
|
};
|
|
67410
|
-
const fromMs =
|
|
67410
|
+
const fromMs = resolve13(from), toMs = resolve13(to);
|
|
67411
67411
|
checkRange(fromMs, toMs);
|
|
67412
67412
|
return { fromMs, toMs };
|
|
67413
67413
|
}
|
|
@@ -68933,7 +68933,7 @@ async function fetchPost(url4, body6, headers, signal) {
|
|
|
68933
68933
|
return { status: response5.status, headers: Object.fromEntries(response5.headers), text: Buffer.concat(chunks).toString("utf8") };
|
|
68934
68934
|
}
|
|
68935
68935
|
function socketPost(socketPath) {
|
|
68936
|
-
return (url4, body6, headers, signal) => new Promise((
|
|
68936
|
+
return (url4, body6, headers, signal) => new Promise((resolve13, reject3) => {
|
|
68937
68937
|
const req = httpRequest({ socketPath, path: new URL(url4).pathname, method: "POST", headers: { ...headers, host: "relay", "content-length": Buffer.byteLength(body6) }, signal }, (res) => {
|
|
68938
68938
|
let text24 = "", bytes2 = 0;
|
|
68939
68939
|
res.setEncoding("utf8");
|
|
@@ -68948,7 +68948,7 @@ function socketPost(socketPath) {
|
|
|
68948
68948
|
}
|
|
68949
68949
|
text24 += chunk;
|
|
68950
68950
|
});
|
|
68951
|
-
res.on("end", () =>
|
|
68951
|
+
res.on("end", () => resolve13({ status: res.statusCode ?? 0, headers: Object.fromEntries(Object.entries(res.headers).map(([k, v]) => [k, String(v)])), text: text24 }));
|
|
68952
68952
|
res.on("error", reject3);
|
|
68953
68953
|
});
|
|
68954
68954
|
req.on("error", reject3);
|
|
@@ -69110,8 +69110,8 @@ var init_model = __esm({
|
|
|
69110
69110
|
if (code2 !== void 0) this.code = code2;
|
|
69111
69111
|
}
|
|
69112
69112
|
};
|
|
69113
|
-
defaultSleep = (ms, signal) => new Promise((
|
|
69114
|
-
const timer = setTimeout(
|
|
69113
|
+
defaultSleep = (ms, signal) => new Promise((resolve13, reject3) => {
|
|
69114
|
+
const timer = setTimeout(resolve13, ms);
|
|
69115
69115
|
signal.addEventListener("abort", () => {
|
|
69116
69116
|
clearTimeout(timer);
|
|
69117
69117
|
reject3(signal.reason);
|
|
@@ -71458,8 +71458,8 @@ var init_env = __esm({
|
|
|
71458
71458
|
this.world.freeze();
|
|
71459
71459
|
this.#draining = true;
|
|
71460
71460
|
const disposals = this.#stop();
|
|
71461
|
-
const drain = this.#active === 0 ? Promise.resolve() : new Promise((
|
|
71462
|
-
this.#freeze = new Promise((
|
|
71461
|
+
const drain = this.#active === 0 ? Promise.resolve() : new Promise((resolve13) => this.#drained.add(resolve13));
|
|
71462
|
+
this.#freeze = new Promise((resolve13, reject3) => {
|
|
71463
71463
|
const timer = setTimeout(() => fail6(new AnchaError("INTERNAL", "environment request drain exceeded 5000ms")), 5e3);
|
|
71464
71464
|
timer.unref();
|
|
71465
71465
|
const fail6 = (error64) => {
|
|
@@ -71474,7 +71474,7 @@ var init_env = __esm({
|
|
|
71474
71474
|
Promise.all([drain, ...disposals]).then(() => {
|
|
71475
71475
|
clearTimeout(timer);
|
|
71476
71476
|
this.#draining = false;
|
|
71477
|
-
|
|
71477
|
+
resolve13();
|
|
71478
71478
|
}, fail6);
|
|
71479
71479
|
});
|
|
71480
71480
|
return this.#freeze;
|
|
@@ -72845,7 +72845,7 @@ var require_aspromise = __commonJS({
|
|
|
72845
72845
|
var params10 = new Array(arguments.length - 1), offset17 = 0, index = 2, pending = true;
|
|
72846
72846
|
while (index < arguments.length)
|
|
72847
72847
|
params10[offset17++] = arguments[index++];
|
|
72848
|
-
return new Promise(function executor(
|
|
72848
|
+
return new Promise(function executor(resolve13, reject3) {
|
|
72849
72849
|
params10[offset17] = function callback(err2) {
|
|
72850
72850
|
if (pending) {
|
|
72851
72851
|
pending = false;
|
|
@@ -72855,7 +72855,7 @@ var require_aspromise = __commonJS({
|
|
|
72855
72855
|
var params11 = new Array(arguments.length - 1), offset18 = 0;
|
|
72856
72856
|
while (offset18 < params11.length)
|
|
72857
72857
|
params11[offset18++] = arguments[offset18];
|
|
72858
|
-
|
|
72858
|
+
resolve13.apply(null, params11);
|
|
72859
72859
|
}
|
|
72860
72860
|
}
|
|
72861
72861
|
};
|
|
@@ -75415,7 +75415,7 @@ var require_path = __commonJS({
|
|
|
75415
75415
|
return prefix2 + parts3.join("/");
|
|
75416
75416
|
}
|
|
75417
75417
|
);
|
|
75418
|
-
path6.resolve = function
|
|
75418
|
+
path6.resolve = function resolve13(originPath, includePath, alreadyNormalized) {
|
|
75419
75419
|
if (!alreadyNormalized)
|
|
75420
75420
|
includePath = normalize2(includePath);
|
|
75421
75421
|
if (isAbsolute4(includePath))
|
|
@@ -75772,7 +75772,7 @@ var require_mapfield = __commonJS({
|
|
|
75772
75772
|
keepComments ? this.comment : void 0
|
|
75773
75773
|
]);
|
|
75774
75774
|
};
|
|
75775
|
-
MapField.prototype.resolve = function
|
|
75775
|
+
MapField.prototype.resolve = function resolve13() {
|
|
75776
75776
|
if (this.resolved)
|
|
75777
75777
|
return this;
|
|
75778
75778
|
if (types.mapKey[this.keyType] === void 0)
|
|
@@ -75849,7 +75849,7 @@ var require_method = __commonJS({
|
|
|
75849
75849
|
this.parsedOptions
|
|
75850
75850
|
]);
|
|
75851
75851
|
};
|
|
75852
|
-
Method.prototype.resolve = function
|
|
75852
|
+
Method.prototype.resolve = function resolve13() {
|
|
75853
75853
|
if (this.resolved)
|
|
75854
75854
|
return this;
|
|
75855
75855
|
this.resolvedRequestType = this.parent.lookupType(this.requestType);
|
|
@@ -77467,7 +77467,7 @@ var require_field = __commonJS({
|
|
|
77467
77467
|
keepComments ? this.comment : void 0
|
|
77468
77468
|
]);
|
|
77469
77469
|
};
|
|
77470
|
-
Field.prototype.resolve = function
|
|
77470
|
+
Field.prototype.resolve = function resolve13() {
|
|
77471
77471
|
if (this.resolved)
|
|
77472
77472
|
return this;
|
|
77473
77473
|
if ((this.typeDefault = types.defaults[this.type]) === void 0) {
|
|
@@ -77740,7 +77740,7 @@ var require_object = __commonJS({
|
|
|
77740
77740
|
this.parent = null;
|
|
77741
77741
|
this.resolved = false;
|
|
77742
77742
|
};
|
|
77743
|
-
ReflectionObject.prototype.resolve = function
|
|
77743
|
+
ReflectionObject.prototype.resolve = function resolve13() {
|
|
77744
77744
|
if (this.resolved)
|
|
77745
77745
|
return this;
|
|
77746
77746
|
if (this.root instanceof Root)
|
|
@@ -82622,7 +82622,7 @@ var require_call_credentials = __commonJS({
|
|
|
82622
82622
|
if (isCurrentOauth2Client(googleCredentials)) {
|
|
82623
82623
|
getHeaders = googleCredentials.getRequestHeaders(options4.service_url);
|
|
82624
82624
|
} else {
|
|
82625
|
-
getHeaders = new Promise((
|
|
82625
|
+
getHeaders = new Promise((resolve13, reject3) => {
|
|
82626
82626
|
googleCredentials.getRequestMetadata(options4.service_url, (err2, headers) => {
|
|
82627
82627
|
if (err2) {
|
|
82628
82628
|
reject3(err2);
|
|
@@ -82632,7 +82632,7 @@ var require_call_credentials = __commonJS({
|
|
|
82632
82632
|
reject3(new Error("Headers not set by metadata plugin"));
|
|
82633
82633
|
return;
|
|
82634
82634
|
}
|
|
82635
|
-
|
|
82635
|
+
resolve13(headers);
|
|
82636
82636
|
});
|
|
82637
82637
|
});
|
|
82638
82638
|
}
|
|
@@ -82688,10 +82688,10 @@ var require_call_credentials = __commonJS({
|
|
|
82688
82688
|
this.metadataGenerator = metadataGenerator;
|
|
82689
82689
|
}
|
|
82690
82690
|
generateMetadata(options4) {
|
|
82691
|
-
return new Promise((
|
|
82691
|
+
return new Promise((resolve13, reject3) => {
|
|
82692
82692
|
this.metadataGenerator(options4, (err2, metadata7) => {
|
|
82693
82693
|
if (metadata7 !== void 0) {
|
|
82694
|
-
|
|
82694
|
+
resolve13(metadata7);
|
|
82695
82695
|
} else {
|
|
82696
82696
|
reject3(err2);
|
|
82697
82697
|
}
|
|
@@ -83076,14 +83076,14 @@ var require_channel_credentials = __commonJS({
|
|
|
83076
83076
|
}
|
|
83077
83077
|
connect(socket) {
|
|
83078
83078
|
const tlsConnectOptions = Object.assign({ socket }, this.connectionOptions);
|
|
83079
|
-
return new Promise((
|
|
83079
|
+
return new Promise((resolve13, reject3) => {
|
|
83080
83080
|
const tlsSocket = (0, tls_1.connect)(tlsConnectOptions, () => {
|
|
83081
83081
|
var _a7;
|
|
83082
83082
|
if (((_a7 = this.connectionOptions.rejectUnauthorized) !== null && _a7 !== void 0 ? _a7 : true) && !tlsSocket.authorized) {
|
|
83083
83083
|
reject3(tlsSocket.authorizationError);
|
|
83084
83084
|
return;
|
|
83085
83085
|
}
|
|
83086
|
-
|
|
83086
|
+
resolve13({
|
|
83087
83087
|
socket: tlsSocket,
|
|
83088
83088
|
secure: true
|
|
83089
83089
|
});
|
|
@@ -83202,8 +83202,8 @@ var require_channel_credentials = __commonJS({
|
|
|
83202
83202
|
if (this.hasReceivedUpdates()) {
|
|
83203
83203
|
return Promise.resolve(this.getLatestSecureContext());
|
|
83204
83204
|
} else {
|
|
83205
|
-
return new Promise((
|
|
83206
|
-
this.secureContextWatchers.push(
|
|
83205
|
+
return new Promise((resolve13) => {
|
|
83206
|
+
this.secureContextWatchers.push(resolve13);
|
|
83207
83207
|
});
|
|
83208
83208
|
}
|
|
83209
83209
|
}
|
|
@@ -83236,7 +83236,7 @@ var require_channel_credentials = __commonJS({
|
|
|
83236
83236
|
this.callCredentials = callCredentials;
|
|
83237
83237
|
}
|
|
83238
83238
|
connect(socket) {
|
|
83239
|
-
return new Promise((
|
|
83239
|
+
return new Promise((resolve13, reject3) => {
|
|
83240
83240
|
const secureContext = this.parent.getLatestSecureContext();
|
|
83241
83241
|
if (!secureContext) {
|
|
83242
83242
|
reject3(new Error("Failed to load credentials"));
|
|
@@ -83261,7 +83261,7 @@ var require_channel_credentials = __commonJS({
|
|
|
83261
83261
|
reject3(tlsSocket.authorizationError);
|
|
83262
83262
|
return;
|
|
83263
83263
|
}
|
|
83264
|
-
|
|
83264
|
+
resolve13({
|
|
83265
83265
|
socket: tlsSocket,
|
|
83266
83266
|
secure: true
|
|
83267
83267
|
});
|
|
@@ -87176,18 +87176,18 @@ var require_compression_filter = __commonJS({
|
|
|
87176
87176
|
this.maxRecvMessageLength = maxRecvMessageLength;
|
|
87177
87177
|
}
|
|
87178
87178
|
compressMessage(message7) {
|
|
87179
|
-
return new Promise((
|
|
87179
|
+
return new Promise((resolve13, reject3) => {
|
|
87180
87180
|
zlib.deflate(message7, (err2, output2) => {
|
|
87181
87181
|
if (err2) {
|
|
87182
87182
|
reject3(err2);
|
|
87183
87183
|
} else {
|
|
87184
|
-
|
|
87184
|
+
resolve13(output2);
|
|
87185
87185
|
}
|
|
87186
87186
|
});
|
|
87187
87187
|
});
|
|
87188
87188
|
}
|
|
87189
87189
|
decompressMessage(message7) {
|
|
87190
|
-
return new Promise((
|
|
87190
|
+
return new Promise((resolve13, reject3) => {
|
|
87191
87191
|
let totalLength = 0;
|
|
87192
87192
|
const messageParts = [];
|
|
87193
87193
|
const decompresser = zlib.createInflate();
|
|
@@ -87209,7 +87209,7 @@ var require_compression_filter = __commonJS({
|
|
|
87209
87209
|
}
|
|
87210
87210
|
});
|
|
87211
87211
|
decompresser.on("end", () => {
|
|
87212
|
-
|
|
87212
|
+
resolve13(Buffer.concat(messageParts));
|
|
87213
87213
|
});
|
|
87214
87214
|
decompresser.write(message7);
|
|
87215
87215
|
decompresser.end();
|
|
@@ -87222,18 +87222,18 @@ var require_compression_filter = __commonJS({
|
|
|
87222
87222
|
this.maxRecvMessageLength = maxRecvMessageLength;
|
|
87223
87223
|
}
|
|
87224
87224
|
compressMessage(message7) {
|
|
87225
|
-
return new Promise((
|
|
87225
|
+
return new Promise((resolve13, reject3) => {
|
|
87226
87226
|
zlib.gzip(message7, (err2, output2) => {
|
|
87227
87227
|
if (err2) {
|
|
87228
87228
|
reject3(err2);
|
|
87229
87229
|
} else {
|
|
87230
|
-
|
|
87230
|
+
resolve13(output2);
|
|
87231
87231
|
}
|
|
87232
87232
|
});
|
|
87233
87233
|
});
|
|
87234
87234
|
}
|
|
87235
87235
|
decompressMessage(message7) {
|
|
87236
|
-
return new Promise((
|
|
87236
|
+
return new Promise((resolve13, reject3) => {
|
|
87237
87237
|
let totalLength = 0;
|
|
87238
87238
|
const messageParts = [];
|
|
87239
87239
|
const decompresser = zlib.createGunzip();
|
|
@@ -87255,7 +87255,7 @@ var require_compression_filter = __commonJS({
|
|
|
87255
87255
|
}
|
|
87256
87256
|
});
|
|
87257
87257
|
decompresser.on("end", () => {
|
|
87258
|
-
|
|
87258
|
+
resolve13(Buffer.concat(messageParts));
|
|
87259
87259
|
});
|
|
87260
87260
|
decompresser.write(message7);
|
|
87261
87261
|
decompresser.end();
|
|
@@ -88605,7 +88605,7 @@ var require_http_proxy = __commonJS({
|
|
|
88605
88605
|
options4.headers = headers;
|
|
88606
88606
|
const proxyAddressString = (0, subchannel_address_1.subchannelAddressToString)(address8);
|
|
88607
88607
|
trace("Using proxy " + proxyAddressString + " to connect to " + options4.path);
|
|
88608
|
-
return new Promise((
|
|
88608
|
+
return new Promise((resolve13, reject3) => {
|
|
88609
88609
|
const request2 = http.request(options4);
|
|
88610
88610
|
request2.once("connect", (res, socket, head) => {
|
|
88611
88611
|
request2.removeAllListeners();
|
|
@@ -88616,7 +88616,7 @@ var require_http_proxy = __commonJS({
|
|
|
88616
88616
|
socket.unshift(head);
|
|
88617
88617
|
}
|
|
88618
88618
|
trace("Successfully established a plaintext connection to " + options4.path + " through proxy " + proxyAddressString);
|
|
88619
|
-
|
|
88619
|
+
resolve13(socket);
|
|
88620
88620
|
} else {
|
|
88621
88621
|
(0, logging_1.log)(constants_1.LogVerbosity.ERROR, "Failed to connect to " + options4.path + " through proxy " + proxyAddressString + " with status " + res.statusCode);
|
|
88622
88622
|
reject3();
|
|
@@ -89599,7 +89599,7 @@ var require_transport = __commonJS({
|
|
|
89599
89599
|
if (secureConnectResult.socket.closed) {
|
|
89600
89600
|
return Promise.reject("Connection closed before starting HTTP/2 handshake");
|
|
89601
89601
|
}
|
|
89602
|
-
return new Promise((
|
|
89602
|
+
return new Promise((resolve13, reject3) => {
|
|
89603
89603
|
var _a7, _b, _c, _d, _e, _f, _g, _h;
|
|
89604
89604
|
let remoteName = null;
|
|
89605
89605
|
let realTarget = this.channelTarget;
|
|
@@ -89670,7 +89670,7 @@ var require_transport = __commonJS({
|
|
|
89670
89670
|
session2.removeAllListeners();
|
|
89671
89671
|
secureConnectResult.socket.removeListener("close", closeHandler);
|
|
89672
89672
|
secureConnectResult.socket.removeListener("error", errorHandler2);
|
|
89673
|
-
|
|
89673
|
+
resolve13(new Http2Transport(session2, address8, options4, remoteName));
|
|
89674
89674
|
this.session = null;
|
|
89675
89675
|
});
|
|
89676
89676
|
session2.once("close", closeHandler);
|
|
@@ -89684,7 +89684,7 @@ var require_transport = __commonJS({
|
|
|
89684
89684
|
if (proxiedSocket) {
|
|
89685
89685
|
return proxiedSocket;
|
|
89686
89686
|
} else {
|
|
89687
|
-
return new Promise((
|
|
89687
|
+
return new Promise((resolve13, reject3) => {
|
|
89688
89688
|
const closeCallback = () => {
|
|
89689
89689
|
reject3(new Error("Socket closed"));
|
|
89690
89690
|
};
|
|
@@ -89694,7 +89694,7 @@ var require_transport = __commonJS({
|
|
|
89694
89694
|
const socket = net.connect(address8, () => {
|
|
89695
89695
|
socket.removeListener("close", closeCallback);
|
|
89696
89696
|
socket.removeListener("error", errorCallback);
|
|
89697
|
-
|
|
89697
|
+
resolve13(socket);
|
|
89698
89698
|
});
|
|
89699
89699
|
socket.once("close", closeCallback);
|
|
89700
89700
|
socket.once("error", errorCallback);
|
|
@@ -93135,7 +93135,7 @@ var require_server_interceptors = __commonJS({
|
|
|
93135
93135
|
} else {
|
|
93136
93136
|
decompresser = zlib.createGunzip();
|
|
93137
93137
|
}
|
|
93138
|
-
return new Promise((
|
|
93138
|
+
return new Promise((resolve13, reject3) => {
|
|
93139
93139
|
let totalLength = 0;
|
|
93140
93140
|
const messageParts = [];
|
|
93141
93141
|
decompresser.on("error", (error64) => {
|
|
@@ -93156,7 +93156,7 @@ var require_server_interceptors = __commonJS({
|
|
|
93156
93156
|
}
|
|
93157
93157
|
});
|
|
93158
93158
|
decompresser.on("end", () => {
|
|
93159
|
-
|
|
93159
|
+
resolve13(Buffer.concat(messageParts));
|
|
93160
93160
|
});
|
|
93161
93161
|
decompresser.write(messageContents);
|
|
93162
93162
|
decompresser.end();
|
|
@@ -93767,10 +93767,10 @@ var require_server = __commonJS({
|
|
|
93767
93767
|
bindOneAddress(address8, boundPortObject) {
|
|
93768
93768
|
this.trace("Attempting to bind " + (0, subchannel_address_1.subchannelAddressToString)(address8));
|
|
93769
93769
|
const http2Server = this.createHttp2Server(boundPortObject.credentials);
|
|
93770
|
-
return new Promise((
|
|
93770
|
+
return new Promise((resolve13, reject3) => {
|
|
93771
93771
|
const onError = (err2) => {
|
|
93772
93772
|
this.trace("Failed to bind " + (0, subchannel_address_1.subchannelAddressToString)(address8) + " with error " + err2.message);
|
|
93773
|
-
|
|
93773
|
+
resolve13({
|
|
93774
93774
|
port: "port" in address8 ? address8.port : 1,
|
|
93775
93775
|
error: err2.message
|
|
93776
93776
|
});
|
|
@@ -93798,7 +93798,7 @@ var require_server = __commonJS({
|
|
|
93798
93798
|
});
|
|
93799
93799
|
boundPortObject.listeningServers.add(http2Server);
|
|
93800
93800
|
this.trace("Successfully bound " + (0, subchannel_address_1.subchannelAddressToString)(boundSubchannelAddress));
|
|
93801
|
-
|
|
93801
|
+
resolve13({
|
|
93802
93802
|
port: "port" in boundSubchannelAddress ? boundSubchannelAddress.port : 1
|
|
93803
93803
|
});
|
|
93804
93804
|
http2Server.removeListener("error", onError);
|
|
@@ -93851,7 +93851,7 @@ var require_server = __commonJS({
|
|
|
93851
93851
|
}
|
|
93852
93852
|
}
|
|
93853
93853
|
resolvePort(port) {
|
|
93854
|
-
return new Promise((
|
|
93854
|
+
return new Promise((resolve13, reject3) => {
|
|
93855
93855
|
let seenResolution = false;
|
|
93856
93856
|
const resolverListener = (endpointList, attributes2, serviceConfig, resolutionNote) => {
|
|
93857
93857
|
if (seenResolution) {
|
|
@@ -93867,7 +93867,7 @@ var require_server = __commonJS({
|
|
|
93867
93867
|
reject3(new Error(`No addresses resolved for port ${port}`));
|
|
93868
93868
|
return true;
|
|
93869
93869
|
}
|
|
93870
|
-
|
|
93870
|
+
resolve13(addressList);
|
|
93871
93871
|
return true;
|
|
93872
93872
|
};
|
|
93873
93873
|
const resolver = (0, resolver_1.createResolver)(port, resolverListener, this.options);
|
|
@@ -97144,7 +97144,7 @@ async function startGoogleAdsGrpc(env) {
|
|
|
97144
97144
|
}
|
|
97145
97145
|
native2.addService(serviceDefinition(service), handlers);
|
|
97146
97146
|
}
|
|
97147
|
-
const innerPort = await new Promise((
|
|
97147
|
+
const innerPort = await new Promise((resolve13, reject3) => native2.bindAsync("127.0.0.1:0", grpc.ServerCredentials.createInsecure(), (err2, port2) => err2 ? reject3(err2) : resolve13(port2)));
|
|
97148
97148
|
const proxy = connect(`http://127.0.0.1:${innerPort}`);
|
|
97149
97149
|
proxy.on("error", () => {
|
|
97150
97150
|
});
|
|
@@ -97256,11 +97256,11 @@ async function startGoogleAdsGrpc(env) {
|
|
|
97256
97256
|
stream.pipe(upstream);
|
|
97257
97257
|
upstream.pipe(stream);
|
|
97258
97258
|
});
|
|
97259
|
-
await new Promise((
|
|
97259
|
+
await new Promise((resolve13, reject3) => {
|
|
97260
97260
|
front.once("error", reject3);
|
|
97261
97261
|
front.listen(0, "127.0.0.1", () => {
|
|
97262
97262
|
front.off("error", reject3);
|
|
97263
|
-
|
|
97263
|
+
resolve13();
|
|
97264
97264
|
});
|
|
97265
97265
|
}).catch((e) => {
|
|
97266
97266
|
proxy.destroy();
|
|
@@ -97279,7 +97279,7 @@ async function startGoogleAdsGrpc(env) {
|
|
|
97279
97279
|
s2.destroy();
|
|
97280
97280
|
proxy.destroy();
|
|
97281
97281
|
native2.forceShutdown();
|
|
97282
|
-
await new Promise((
|
|
97282
|
+
await new Promise((resolve13) => front.close(() => resolve13()));
|
|
97283
97283
|
})();
|
|
97284
97284
|
return closing;
|
|
97285
97285
|
} };
|
|
@@ -109374,9 +109374,9 @@ var require_lexer2 = __commonJS({
|
|
|
109374
109374
|
}
|
|
109375
109375
|
if (code2 === 92) {
|
|
109376
109376
|
value4 += body6.slice(chunkStart, position);
|
|
109377
|
-
const
|
|
109378
|
-
value4 +=
|
|
109379
|
-
position +=
|
|
109377
|
+
const escape11 = body6.charCodeAt(position + 1) === 117 ? body6.charCodeAt(position + 2) === 123 ? readEscapedUnicodeVariableWidth(lexer, position) : readEscapedUnicodeFixedWidth(lexer, position) : readEscapedCharacter(lexer, position);
|
|
109378
|
+
value4 += escape11.value;
|
|
109379
|
+
position += escape11.size;
|
|
109380
109380
|
chunkStart = position;
|
|
109381
109381
|
continue;
|
|
109382
109382
|
}
|
|
@@ -122791,7 +122791,7 @@ var require_graphql = __commonJS({
|
|
|
122791
122791
|
var _validate2 = require_validate3();
|
|
122792
122792
|
var _execute = require_execute();
|
|
122793
122793
|
function graphql(args) {
|
|
122794
|
-
return new Promise((
|
|
122794
|
+
return new Promise((resolve13) => resolve13(graphqlImpl(args)));
|
|
122795
122795
|
}
|
|
122796
122796
|
function graphqlSync(args) {
|
|
122797
122797
|
const result = graphqlImpl(args);
|
|
@@ -137782,9 +137782,9 @@ function scheduleTime(r2, value4) {
|
|
|
137782
137782
|
if (value4 === void 0 || value4 === null) invalid16("Missing `scheduled_at` field.", "missing_required_field");
|
|
137783
137783
|
if (typeof value4 !== "string") invalid16("The `scheduled_at` field must be a string.");
|
|
137784
137784
|
const now11 = r2.ctx.clock.nowMs(), text24 = value4.trim();
|
|
137785
|
-
const
|
|
137785
|
+
const relative7 = /^in\s+(\d{1,6})\s+(min|minute|hr|hour|day|week)s?$/i.exec(text24);
|
|
137786
137786
|
const iso22 = /^\d{4}-\d{2}-\d{2}(T\d{2}:\d{2}(?::\d{2}(?:\.\d+)?)?(Z|[+-]\d{2}:?\d{2})?)?$/i.exec(text24);
|
|
137787
|
-
const ms =
|
|
137787
|
+
const ms = relative7 ? now11 + Number(relative7[1]) * UNIT_MS[relative7[2].toLowerCase()] : iso22 ? Date.parse(iso22[1] && !iso22[2] ? `${text24}Z` : text24) : unsupported20(`scheduled_at in natural language ("${text24}")`);
|
|
137788
137788
|
if (!Number.isFinite(ms)) invalid16("The `scheduled_at` field must be a valid date.");
|
|
137789
137789
|
if (ms <= now11) invalid16("The `scheduled_at` field must be a date in the future.");
|
|
137790
137790
|
if (ms > now11 + 30 * 864e5) invalid16("The `scheduled_at` field must be within the next 30 days.");
|
|
@@ -138854,9 +138854,9 @@ function freeName(ctx, parentId, name5) {
|
|
|
138854
138854
|
if (!childNamed(ctx, parentId, candidate)) return candidate;
|
|
138855
138855
|
}
|
|
138856
138856
|
}
|
|
138857
|
-
function walk(call2, from,
|
|
138857
|
+
function walk(call2, from, relative7) {
|
|
138858
138858
|
let node5 = from;
|
|
138859
|
-
for (const part of
|
|
138859
|
+
for (const part of relative7.split("/").filter(Boolean)) node5 = node5 && childNamed(call2.ctx, node5.id, part);
|
|
138860
138860
|
return node5;
|
|
138861
138861
|
}
|
|
138862
138862
|
function ensureFolder(call2, from, parts3) {
|
|
@@ -140169,14 +140169,14 @@ async function handle17(c) {
|
|
|
140169
140169
|
if (!item2) throw new GraphError(404, "itemNotFound", "The resource could not be found.");
|
|
140170
140170
|
remaining = remaining.slice(byId2[0].length);
|
|
140171
140171
|
}
|
|
140172
|
-
let
|
|
140172
|
+
let relative7;
|
|
140173
140173
|
if (remaining.startsWith(":/")) {
|
|
140174
140174
|
const end = remaining.indexOf(":", 2);
|
|
140175
|
-
|
|
140175
|
+
relative7 = decodeURIComponent(end === -1 ? remaining.slice(2) : remaining.slice(2, end));
|
|
140176
140176
|
remaining = end === -1 ? "" : remaining.slice(end + 1);
|
|
140177
140177
|
} else if (remaining === ":") remaining = "";
|
|
140178
140178
|
const action = remaining.replace(/^\//, "");
|
|
140179
|
-
return itemRoute({ ctx, method: method2, url: url4, item: item2, relative:
|
|
140179
|
+
return itemRoute({ ctx, method: method2, url: url4, item: item2, relative: relative7, action, body: raw3, json: body6, headers: c.req.raw.headers });
|
|
140180
140180
|
});
|
|
140181
140181
|
} catch (error64) {
|
|
140182
140182
|
if (ctx.signal?.aborted) return new Response(null, { status: 409 });
|
|
@@ -145850,9 +145850,9 @@ function evaluate2(q, w2) {
|
|
|
145850
145850
|
if (!found2) throw new JqlError(/^[A-Za-z][A-Za-z0-9]*-\d+$/.test(text24) ? `An issue with key '${text24.toUpperCase()}' does not exist for field '${field6}'.` : `The issue key '${text24}' for field '${field6}' is invalid.`);
|
|
145851
145851
|
return found2.id;
|
|
145852
145852
|
};
|
|
145853
|
-
const one7 = (
|
|
145853
|
+
const one7 = (resolve13) => (v) => {
|
|
145854
145854
|
const t = literal2(v, "");
|
|
145855
|
-
return t === null ? [] : [
|
|
145855
|
+
return t === null ? [] : [resolve13(t)];
|
|
145856
145856
|
};
|
|
145857
145857
|
const users5 = (field6, get5) => ({ kind: "set", get: (i) => get5(i).filter((x) => x !== null), resolve: (v) => {
|
|
145858
145858
|
if (v.kind === "func") {
|
|
@@ -150249,9 +150249,9 @@ function parseQuery2(query10) {
|
|
|
150249
150249
|
return terms;
|
|
150250
150250
|
}
|
|
150251
150251
|
function dateMatches(ms, term2, now11) {
|
|
150252
|
-
const
|
|
150253
|
-
if (
|
|
150254
|
-
const edge = now11 - Number(
|
|
150252
|
+
const relative7 = /^(\d+)(minute|hour|day|week|month|year)s?$/i.exec(term2.value);
|
|
150253
|
+
if (relative7) {
|
|
150254
|
+
const edge = now11 - Number(relative7[1]) * UNITS3[relative7[2].toLowerCase()];
|
|
150255
150255
|
return term2.op === ">" || term2.op === ">=" || term2.op === ":" ? ms >= edge : ms < edge;
|
|
150256
150256
|
}
|
|
150257
150257
|
const date10 = /^\d{4}-\d{2}-\d{2}$/.test(term2.value) ? Date.parse(`${term2.value}T00:00:00Z`) : Date.parse(term2.value);
|
|
@@ -155954,9 +155954,9 @@ function matches6(f2, value4, now11) {
|
|
|
155954
155954
|
if (f2.key === "message" || f2.key === "title") return f2.values.some((v) => v.includes("*") ? glob2(v, value4, true) : value4.toLowerCase().includes(v.toLowerCase()));
|
|
155955
155955
|
return f2.values.some((v) => glob2(v, value4, caseless));
|
|
155956
155956
|
}
|
|
155957
|
-
function eventTest(filters, text24, lookup6, now11,
|
|
155957
|
+
function eventTest(filters, text24, lookup6, now11, resolve13 = (f2) => f2) {
|
|
155958
155958
|
return (e) => filters.every((raw3) => {
|
|
155959
|
-
const f2 =
|
|
155959
|
+
const f2 = resolve13(raw3, e);
|
|
155960
155960
|
if (f2.key === "has") return f2.values.every((k) => {
|
|
155961
155961
|
const v = eventValue(e, k, lookup6);
|
|
155962
155962
|
return v !== null && v !== "" && !(Array.isArray(v) && !v.length);
|
|
@@ -163136,9 +163136,9 @@ function formatNumber(value4, model) {
|
|
|
163136
163136
|
}
|
|
163137
163137
|
return (number7 < 0 ? "-" : " ") + result.padStart(spec.integer.length + (spec.decimals ? spec.decimals.length + 1 : 0), " ");
|
|
163138
163138
|
}
|
|
163139
|
-
function like(value4, pattern, ...
|
|
163140
|
-
if (value4 == null || pattern == null ||
|
|
163141
|
-
const esc2 =
|
|
163139
|
+
function like(value4, pattern, ...escape11) {
|
|
163140
|
+
if (value4 == null || pattern == null || escape11.length > 0 && escape11[0] == null) return null;
|
|
163141
|
+
const esc2 = escape11.length ? Array.from(String(escape11[0])) : void 0;
|
|
163142
163142
|
if (esc2 && esc2.length !== 1) invalid24("The LIKE escape character must be one character.");
|
|
163143
163143
|
const mask2 = [], chars = Array.from(String(pattern));
|
|
163144
163144
|
for (let k = 0; k < chars.length; k++) {
|
|
@@ -163834,8 +163834,8 @@ var init_suiteql = __esm({
|
|
|
163834
163834
|
this.need(")");
|
|
163835
163835
|
left = this.node({ kind: "in", arg: left, query: query10, values: query10 ? void 0 : values2, not: negated });
|
|
163836
163836
|
} else if (actual === "like") {
|
|
163837
|
-
const pattern = this.expr(prec + 1),
|
|
163838
|
-
left = this.node({ kind: "like", arg: left, pattern, escape:
|
|
163837
|
+
const pattern = this.expr(prec + 1), escape11 = this.eat("escape") ? this.expr(prec + 1) : void 0;
|
|
163838
|
+
left = this.node({ kind: "like", arg: left, pattern, escape: escape11, not: negated });
|
|
163839
163839
|
} else left = this.node({ kind: "binary", op: actual, left, right: this.expr(prec + 1) });
|
|
163840
163840
|
}
|
|
163841
163841
|
this.depth--;
|
|
@@ -164774,8 +164774,8 @@ var init_suiteql_executor = __esm({
|
|
|
164774
164774
|
const free = this.#slots.size < this.#options.workers || [...this.#slots].some((s2) => !s2.job && !s2.terminating);
|
|
164775
164775
|
const active2 = [...this.#slots].some((s2) => s2.job?.ctx.store === ctx.store);
|
|
164776
164776
|
if ((!free || active2) && this.#queue.length >= this.#options.queue) return Promise.reject(new NetsuiteError(429, "CONCURRENCY_LIMIT_EXCEEDED", "Query execution queue is full."));
|
|
164777
|
-
return new Promise((
|
|
164778
|
-
const job = { ctx, query: query10, page: page18, mapped, params: params10, prepare: prepare2, resolve:
|
|
164777
|
+
return new Promise((resolve13, reject3) => {
|
|
164778
|
+
const job = { ctx, query: query10, page: page18, mapped, params: params10, prepare: prepare2, resolve: resolve13, reject: reject3, settled: false, timer: void 0, abort: () => this.#cancel(job, ctx.signal?.reason ?? new DOMException("Aborted", "AbortError")) };
|
|
164779
164779
|
job.timer = setTimeout(() => this.#cancel(job, new NetsuiteError(400, "INVALID_REQUEST", "Query execution deadline exceeded.")), this.#options.deadlineMs);
|
|
164780
164780
|
ctx.signal?.addEventListener("abort", job.abort, { once: true });
|
|
164781
164781
|
this.#queue.push(job);
|
|
@@ -172505,12 +172505,12 @@ function grantsFor(manager) {
|
|
|
172505
172505
|
}
|
|
172506
172506
|
function closeSocket(socket) {
|
|
172507
172507
|
if (!socket || socket.readyState === import_websocket.default.CLOSED) return Promise.resolve();
|
|
172508
|
-
return new Promise((
|
|
172508
|
+
return new Promise((resolve13) => {
|
|
172509
172509
|
const timer = setTimeout(() => socket.terminate(), 1e3);
|
|
172510
172510
|
timer.unref();
|
|
172511
172511
|
socket.once("close", () => {
|
|
172512
172512
|
clearTimeout(timer);
|
|
172513
|
-
|
|
172513
|
+
resolve13();
|
|
172514
172514
|
});
|
|
172515
172515
|
socket.close(1e3, "session ended");
|
|
172516
172516
|
});
|
|
@@ -172558,7 +172558,7 @@ Content-Length: 0\r
|
|
|
172558
172558
|
return { close: () => closing ??= (async () => {
|
|
172559
172559
|
server.off("upgrade", upgrade);
|
|
172560
172560
|
await Promise.all([...wss.clients].map(closeSocket));
|
|
172561
|
-
await new Promise((
|
|
172561
|
+
await new Promise((resolve13) => wss.close(() => resolve13()));
|
|
172562
172562
|
})() };
|
|
172563
172563
|
}
|
|
172564
172564
|
var SOCKET_GRANT_TTL_MS, SOCKET_ACK_MS, SOCKET_PING_MS, SOCKET_PONG_MS, registries, SocketDelivery;
|
|
@@ -172873,7 +172873,7 @@ async function readFeed(env, options4) {
|
|
|
172873
172873
|
if (!Number.isSafeInteger(waitMs) || waitMs < 0 || waitMs > 25e3) throw new AnchaError("USAGE", "wait_ms must be an integer from 0 to 25000");
|
|
172874
172874
|
let events3 = env.events.list(after);
|
|
172875
172875
|
if (events3.length === 0 && waitMs > 0) {
|
|
172876
|
-
events3 = await new Promise((
|
|
172876
|
+
events3 = await new Promise((resolve13, reject3) => {
|
|
172877
172877
|
let settled = false;
|
|
172878
172878
|
let unsubscribe = () => {
|
|
172879
172879
|
};
|
|
@@ -172888,7 +172888,7 @@ async function readFeed(env, options4) {
|
|
|
172888
172888
|
if (settled) return;
|
|
172889
172889
|
settled = true;
|
|
172890
172890
|
cleanup();
|
|
172891
|
-
|
|
172891
|
+
resolve13(batch4);
|
|
172892
172892
|
};
|
|
172893
172893
|
const abort = () => {
|
|
172894
172894
|
if (settled) return;
|
|
@@ -174635,7 +174635,7 @@ var init_dist3 = __esm({
|
|
|
174635
174635
|
});
|
|
174636
174636
|
if (!chunk) {
|
|
174637
174637
|
if (i === 1) {
|
|
174638
|
-
await new Promise((
|
|
174638
|
+
await new Promise((resolve13) => setTimeout(resolve13));
|
|
174639
174639
|
maxReadCount = 3;
|
|
174640
174640
|
continue;
|
|
174641
174641
|
}
|
|
@@ -174832,11 +174832,11 @@ async function startServer(opts = {}) {
|
|
|
174832
174832
|
let stopAfterError;
|
|
174833
174833
|
let onError;
|
|
174834
174834
|
try {
|
|
174835
|
-
await new Promise((
|
|
174835
|
+
await new Promise((resolve13, reject3) => {
|
|
174836
174836
|
let listening = false;
|
|
174837
174837
|
const onListening = () => {
|
|
174838
174838
|
listening = true;
|
|
174839
|
-
|
|
174839
|
+
resolve13();
|
|
174840
174840
|
};
|
|
174841
174841
|
onError = (cause) => {
|
|
174842
174842
|
if (!listening) {
|
|
@@ -174861,8 +174861,8 @@ async function startServer(opts = {}) {
|
|
|
174861
174861
|
const sweep = setInterval(() => manager.reapExpired(), 1e3);
|
|
174862
174862
|
sweep.unref();
|
|
174863
174863
|
let resolveClosed;
|
|
174864
|
-
const closed = new Promise((
|
|
174865
|
-
resolveClosed =
|
|
174864
|
+
const closed = new Promise((resolve13) => {
|
|
174865
|
+
resolveClosed = resolve13;
|
|
174866
174866
|
});
|
|
174867
174867
|
let closing;
|
|
174868
174868
|
const close = () => closing ??= (async () => {
|
|
@@ -174874,12 +174874,12 @@ async function startServer(opts = {}) {
|
|
|
174874
174874
|
await manager.drainResources().catch((error64) => {
|
|
174875
174875
|
runtimeError ??= error64 instanceof AnchaError ? error64 : new AnchaError("INTERNAL", "native transport shutdown failed", { cause: error64 });
|
|
174876
174876
|
});
|
|
174877
|
-
await new Promise((
|
|
174877
|
+
await new Promise((resolve13, reject3) => {
|
|
174878
174878
|
const force = setTimeout(() => server.closeAllConnections(), 1e3);
|
|
174879
174879
|
server.close((e) => {
|
|
174880
174880
|
clearTimeout(force);
|
|
174881
174881
|
if (e) reject3(runtimeError ?? startError(e));
|
|
174882
|
-
else
|
|
174882
|
+
else resolve13();
|
|
174883
174883
|
});
|
|
174884
174884
|
server.closeIdleConnections();
|
|
174885
174885
|
});
|
|
@@ -176035,11 +176035,11 @@ async function startIsolationGateway(options4) {
|
|
|
176035
176035
|
server.on("clientError", (_error, socket) => socket.destroy());
|
|
176036
176036
|
server.on("upgrade", (_req, socket) => socket.end("HTTP/1.1 501 Not Implemented\r\nConnection: close\r\nContent-Length: 0\r\n\r\n"));
|
|
176037
176037
|
server.on("connect", (_req, client2) => client2.end("HTTP/1.1 403 Rejected\r\nConnection: close\r\nContent-Length: 0\r\n\r\n"));
|
|
176038
|
-
await new Promise((
|
|
176038
|
+
await new Promise((resolve13, rejectListen) => {
|
|
176039
176039
|
server.once("error", rejectListen);
|
|
176040
176040
|
server.listen(options4.port ?? 0, "127.0.0.1", () => {
|
|
176041
176041
|
server.removeListener("error", rejectListen);
|
|
176042
|
-
|
|
176042
|
+
resolve13();
|
|
176043
176043
|
});
|
|
176044
176044
|
});
|
|
176045
176045
|
const address8 = server.address();
|
|
@@ -176052,7 +176052,7 @@ async function startIsolationGateway(options4) {
|
|
|
176052
176052
|
options4.signal?.removeEventListener("abort", abort);
|
|
176053
176053
|
for (const target4 of upstreamRequests) target4.destroy();
|
|
176054
176054
|
for (const socket of sockets) socket.destroy();
|
|
176055
|
-
await new Promise((
|
|
176055
|
+
await new Promise((resolve13) => server.close(() => resolve13()));
|
|
176056
176056
|
})();
|
|
176057
176057
|
const abort = () => {
|
|
176058
176058
|
void close();
|
|
@@ -176187,8 +176187,12 @@ var init_runtime3 = __esm({
|
|
|
176187
176187
|
});
|
|
176188
176188
|
|
|
176189
176189
|
// backend/src/runner/agent-env.ts
|
|
176190
|
+
function agentTask(scene2, runtime2) {
|
|
176191
|
+
return runtime2?.task ?? scene2.trigger?.task ?? scene2.task ?? "";
|
|
176192
|
+
}
|
|
176190
176193
|
function agentTemplateVars(envId, services2, task2, trial, session2, runtime2, mcp) {
|
|
176191
176194
|
const vars = { task: task2, "env.id": envId, trial: String(trial) };
|
|
176195
|
+
if (runtime2?.taskFile !== void 0) vars.task_file = runtime2.taskFile;
|
|
176192
176196
|
for (const [tool, connection3] of Object.entries(mcp ?? {})) Object.assign(vars, { [`${tool}.mcp_url`]: connection3.url, [`${tool}.mcp_token`]: connection3.token });
|
|
176193
176197
|
for (const [twin, s2] of Object.entries(services2)) {
|
|
176194
176198
|
vars[`${twin}.url`] = s2.url;
|
|
@@ -176234,12 +176238,13 @@ function describeAgentEnvironment(agent, parent2, crash) {
|
|
|
176234
176238
|
return { target: "host", inherited, withheld, ...(agent.inheritEnv || agent.passEnv === void 0) && { inheritAll: true }, ...named3.length > 0 && { withheldInLogs: named3 } };
|
|
176235
176239
|
}
|
|
176236
176240
|
function agentEnv(env, scene2, agent, trial, inheritedEnv, session2, runtime2) {
|
|
176237
|
-
const task2 =
|
|
176241
|
+
const task2 = agentTask(scene2, runtime2);
|
|
176238
176242
|
const defaults3 = {
|
|
176239
176243
|
ANCHA_ENV_ID: env.id,
|
|
176240
176244
|
ANCHA_TRIAL: String(trial),
|
|
176241
176245
|
ANCHA_SCENE_ID: scene2.id,
|
|
176242
176246
|
ANCHA_TASK: task2,
|
|
176247
|
+
...runtime2?.taskFile !== void 0 && { ANCHA_TASK_FILE: runtime2.taskFile },
|
|
176243
176248
|
...runtime2?.event !== void 0 && { ANCHA_EVENT_JSON: runtime2.event },
|
|
176244
176249
|
// A test made from a trace hands the agent the invocation's own input: the conversation so far and the user (TRACE_PLAN_V2 §3).
|
|
176245
176250
|
...scene2.trigger?.input !== void 0 && { ANCHA_INPUT_JSON: JSON.stringify(scene2.trigger.input) }
|
|
@@ -176276,7 +176281,12 @@ function validateAgentEnv(scene2, agent) {
|
|
|
176276
176281
|
if (Object.keys(scene2.tools ?? {}).length) services2.tools = { url: "http://localhost", hostUrl: "http://localhost", token: "" };
|
|
176277
176282
|
for (const twin of scene2.twins) services2[twin] = { url: "http://localhost", hostUrl: "http://localhost", token: "", signingSecret: "", ...twin === "slack" ? { appToken: "" } : {}, ...twin === "gmail" ? { address: "" } : {}, ...twin === "datadog" ? { apiKey: "", appKey: "", webhookToken: "" } : {}, ...twin === "pagerduty" ? { fromEmail: "", routingKey: "", routingKeys: {} } : {}, ...twin === "gong" ? { accessKey: "", accessKeySecret: "" } : {}, ...twin === "google-ads" ? { grpcEndpoint: "localhost:1", tlsRootCertificate: "" } : {} };
|
|
176278
176283
|
const session2 = { id: "", token: "", envId: "", eventsUrl: "http://localhost/events", doneUrl: "http://localhost/done", contextUrl: "http://localhost/context", state: "prepared" };
|
|
176279
|
-
const
|
|
176284
|
+
const launched = agent.mode !== "endpoint";
|
|
176285
|
+
const runtime2 = {
|
|
176286
|
+
...(agent.mode === "endpoint" && agent.start !== void 0 || agent.taskInput?.kind === "http") && { port: 34567 },
|
|
176287
|
+
attempt: { id: "validation", caseId: scene2.id, stateDir: "/ancha/validation/agent-state", seed: "validation" },
|
|
176288
|
+
...launched && { taskFile: "/ancha/validation/task.txt" }
|
|
176289
|
+
};
|
|
176280
176290
|
const vars = agentTemplateVars("", services2, "", 0, session2, runtime2, Object.keys(scene2.tools ?? {}).length ? { tools: { url: "http://localhost/mcp", token: "" } } : void 0);
|
|
176281
176291
|
renderEnvMapping(agent.env, vars);
|
|
176282
176292
|
if (agent.mode === "endpoint") {
|
|
@@ -176441,7 +176451,7 @@ var init_run_bundle = __esm({
|
|
|
176441
176451
|
entriesFor = (source) => source === "cloud" ? BUNDLE_LIMITS2.cloudEntries : BUNDLE_LIMITS2.entries;
|
|
176442
176452
|
allowedFor = (source, path6) => BUNDLE_PATH.test(path6) && (source === "cloud" || !CLOUD_ONLY_PATH.test(path6));
|
|
176443
176453
|
sha2563 = (data5) => createHash53("sha256").update(data5).digest("hex");
|
|
176444
|
-
tooBig = (message7) => new AnchaError("USAGE", message7, { hint: "upload a run with fewer trials, or run fewer trials per
|
|
176454
|
+
tooBig = (message7) => new AnchaError("USAGE", message7, { hint: "upload a run with fewer trials, or run fewer trials per test" });
|
|
176445
176455
|
}
|
|
176446
176456
|
});
|
|
176447
176457
|
|
|
@@ -176514,10 +176524,155 @@ var init_actions7 = __esm({
|
|
|
176514
176524
|
}
|
|
176515
176525
|
});
|
|
176516
176526
|
|
|
176527
|
+
// cloud/rebuild/readers/suiteql.mjs
|
|
176528
|
+
var init_suiteql2 = __esm({
|
|
176529
|
+
"cloud/rebuild/readers/suiteql.mjs"() {
|
|
176530
|
+
"use strict";
|
|
176531
|
+
}
|
|
176532
|
+
});
|
|
176533
|
+
|
|
176534
|
+
// cloud/rebuild/netsuite-mcp.mjs
|
|
176535
|
+
var NETSUITE_MCP_TOOLS, TOOLS;
|
|
176536
|
+
var init_netsuite_mcp = __esm({
|
|
176537
|
+
"cloud/rebuild/netsuite-mcp.mjs"() {
|
|
176538
|
+
"use strict";
|
|
176539
|
+
NETSUITE_MCP_TOOLS = Object.freeze([
|
|
176540
|
+
"ns_createRecord",
|
|
176541
|
+
"ns_getRecord",
|
|
176542
|
+
"ns_getRecordTransformMetadata",
|
|
176543
|
+
"ns_getRecordTypeMetadata",
|
|
176544
|
+
"ns_transformRecord",
|
|
176545
|
+
"ns_updateRecord",
|
|
176546
|
+
"ns_getRecordActionMetadata",
|
|
176547
|
+
"ns_executeRecordAction",
|
|
176548
|
+
"ns_getAccountingBooks",
|
|
176549
|
+
"ns_getAccountingContexts",
|
|
176550
|
+
"ns_getNexusIds",
|
|
176551
|
+
"ns_getSubsidiaries",
|
|
176552
|
+
"ns_listAllReports",
|
|
176553
|
+
"ns_runReport",
|
|
176554
|
+
"ns_getSessionInfo",
|
|
176555
|
+
"ns_listSavedSearches",
|
|
176556
|
+
"ns_runSavedSearch",
|
|
176557
|
+
"ns_getSuiteQLMetadata",
|
|
176558
|
+
"ns_runCustomSuiteQL",
|
|
176559
|
+
"ns_attachFile",
|
|
176560
|
+
"ns_detachFile",
|
|
176561
|
+
"ns_getFolderByPath",
|
|
176562
|
+
"ns_getIdFromPath",
|
|
176563
|
+
"ns_getPathFromId",
|
|
176564
|
+
"ns_searchFiles"
|
|
176565
|
+
]);
|
|
176566
|
+
TOOLS = new Set(NETSUITE_MCP_TOOLS);
|
|
176567
|
+
}
|
|
176568
|
+
});
|
|
176569
|
+
|
|
176570
|
+
// cloud/rebuild/readers/netsuite.mjs
|
|
176571
|
+
var RECORD_TYPES, TYPE_BY_LOWER, TX2, TX_TYPES, LABEL, TYPE_OF_LABEL, TYPE_OF_CODE, ITEM_TYPES, CODE_OF, ITEM_USE2;
|
|
176572
|
+
var init_netsuite4 = __esm({
|
|
176573
|
+
"cloud/rebuild/readers/netsuite.mjs"() {
|
|
176574
|
+
"use strict";
|
|
176575
|
+
init_suiteql2();
|
|
176576
|
+
init_netsuite_mcp();
|
|
176577
|
+
RECORD_TYPES = Object.freeze([
|
|
176578
|
+
"customer",
|
|
176579
|
+
"vendor",
|
|
176580
|
+
"contact",
|
|
176581
|
+
"employee",
|
|
176582
|
+
"serviceSaleItem",
|
|
176583
|
+
"servicePurchaseItem",
|
|
176584
|
+
"serviceResaleItem",
|
|
176585
|
+
"nonInventorySaleItem",
|
|
176586
|
+
"nonInventoryPurchaseItem",
|
|
176587
|
+
"nonInventoryResaleItem",
|
|
176588
|
+
"otherChargeSaleItem",
|
|
176589
|
+
"otherChargePurchaseItem",
|
|
176590
|
+
"otherChargeResaleItem",
|
|
176591
|
+
"inventoryItem",
|
|
176592
|
+
"account",
|
|
176593
|
+
"subsidiary",
|
|
176594
|
+
"currency",
|
|
176595
|
+
"term",
|
|
176596
|
+
"department",
|
|
176597
|
+
"location",
|
|
176598
|
+
"classification",
|
|
176599
|
+
"accountingPeriod",
|
|
176600
|
+
"accountingBook",
|
|
176601
|
+
"currencyRate",
|
|
176602
|
+
"expenseCategory",
|
|
176603
|
+
"bankingTransaction",
|
|
176604
|
+
"bankRecSuggestion",
|
|
176605
|
+
"transactionMatch",
|
|
176606
|
+
"estimate",
|
|
176607
|
+
"salesOrder",
|
|
176608
|
+
"itemFulfillment",
|
|
176609
|
+
"invoice",
|
|
176610
|
+
"cashSale",
|
|
176611
|
+
"cashRefund",
|
|
176612
|
+
"creditMemo",
|
|
176613
|
+
"customerPayment",
|
|
176614
|
+
"customerDeposit",
|
|
176615
|
+
"depositApplication",
|
|
176616
|
+
"customerRefund",
|
|
176617
|
+
"returnAuthorization",
|
|
176618
|
+
"purchaseOrder",
|
|
176619
|
+
"itemReceipt",
|
|
176620
|
+
"vendorBill",
|
|
176621
|
+
"vendorCredit",
|
|
176622
|
+
"vendorPayment",
|
|
176623
|
+
"vendorReturnAuthorization",
|
|
176624
|
+
"journalEntry",
|
|
176625
|
+
"expenseReport"
|
|
176626
|
+
]);
|
|
176627
|
+
TYPE_BY_LOWER = new Map(RECORD_TYPES.map((t) => [t.toLowerCase(), t]));
|
|
176628
|
+
TX2 = {
|
|
176629
|
+
CustInvc: ["invoice", "Invoice"],
|
|
176630
|
+
VendBill: ["vendorBill", "Bill"],
|
|
176631
|
+
PurchOrd: ["purchaseOrder", "Purchase Order"],
|
|
176632
|
+
ItemRcpt: ["itemReceipt", "Item Receipt"],
|
|
176633
|
+
CustPymt: ["customerPayment", "Payment"],
|
|
176634
|
+
VendPymt: ["vendorPayment", "Bill Payment"],
|
|
176635
|
+
Journal: ["journalEntry", "Journal"],
|
|
176636
|
+
CustCred: ["creditMemo", "Credit Memo"],
|
|
176637
|
+
SalesOrd: ["salesOrder", "Sales Order"],
|
|
176638
|
+
ItemShip: ["itemFulfillment", "Item Fulfillment"],
|
|
176639
|
+
VendCred: ["vendorCredit", "Bill Credit"],
|
|
176640
|
+
CustDep: ["customerDeposit", "Customer Deposit"],
|
|
176641
|
+
CustRfnd: ["customerRefund", "Customer Refund"],
|
|
176642
|
+
CashSale: ["cashSale", "Cash Sale"],
|
|
176643
|
+
CashRfnd: ["cashRefund", "Cash Refund"],
|
|
176644
|
+
Estimate: ["estimate", "Quote"],
|
|
176645
|
+
ExpRept: ["expenseReport", "Expense Report"],
|
|
176646
|
+
RtnAuth: ["returnAuthorization", "Return Authorization"],
|
|
176647
|
+
VendAuth: ["vendorReturnAuthorization", "Vendor Return Authorization"],
|
|
176648
|
+
DepAppl: ["depositApplication", "Deposit Application"]
|
|
176649
|
+
};
|
|
176650
|
+
TX_TYPES = new Set(Object.values(TX2).map(([type]) => type));
|
|
176651
|
+
LABEL = Object.fromEntries(Object.values(TX2).map(([type, label5]) => [type, label5]));
|
|
176652
|
+
TYPE_OF_LABEL = new Map(Object.values(TX2).map(([type, label5]) => [label5.toLowerCase(), type]));
|
|
176653
|
+
TYPE_OF_CODE = new Map(Object.entries(TX2).map(([code2, [type]]) => [code2.toLowerCase(), type]));
|
|
176654
|
+
ITEM_TYPES = new Set(RECORD_TYPES.filter((t) => /Item$/.test(t)));
|
|
176655
|
+
CODE_OF = Object.fromEntries(Object.entries(TX2).map(([code2, [type]]) => [type, code2]));
|
|
176656
|
+
ITEM_USE2 = Object.fromEntries([...ITEM_TYPES].map((t) => [t, { sale: !/Purchase/.test(t), purchase: !/Sale/.test(t), inventory: t === "inventoryItem" }]));
|
|
176657
|
+
}
|
|
176658
|
+
});
|
|
176659
|
+
|
|
176660
|
+
// cloud/rebuild/netsuite-checks.mjs
|
|
176661
|
+
var COUNTED, BOOKS;
|
|
176662
|
+
var init_netsuite_checks = __esm({
|
|
176663
|
+
"cloud/rebuild/netsuite-checks.mjs"() {
|
|
176664
|
+
"use strict";
|
|
176665
|
+
init_netsuite4();
|
|
176666
|
+
COUNTED = new Set(RECORD_TYPES.filter((t) => !["account", "accountingPeriod", "accountingBook", "currencyRate", "expenseCategory", "bankingTransaction", "bankRecSuggestion", "transactionMatch"].includes(t)));
|
|
176667
|
+
BOOKS = RECORD_TYPES.filter((t) => !["bankingTransaction", "bankRecSuggestion", "transactionMatch"].includes(t));
|
|
176668
|
+
}
|
|
176669
|
+
});
|
|
176670
|
+
|
|
176517
176671
|
// cloud/rebuild/production-state.mjs
|
|
176518
176672
|
var init_production_state = __esm({
|
|
176519
176673
|
"cloud/rebuild/production-state.mjs"() {
|
|
176520
176674
|
"use strict";
|
|
176675
|
+
init_netsuite_checks();
|
|
176521
176676
|
}
|
|
176522
176677
|
});
|
|
176523
176678
|
|
|
@@ -176790,7 +176945,7 @@ var init_values2 = __esm({
|
|
|
176790
176945
|
var sleep2;
|
|
176791
176946
|
var init_sleep = __esm({
|
|
176792
176947
|
"node_modules/.pnpm/openai@7.43.0_@aws-sdk+credential-provider-node@3.972.91_@smithy+signature-v4@5.7.5_undici@8.12.3_ws@8.22.0_zod@4.6.7/node_modules/openai/internal/utils/sleep.mjs"() {
|
|
176793
|
-
sleep2 = (ms, ...signals) => new Promise((
|
|
176948
|
+
sleep2 = (ms, ...signals) => new Promise((resolve13, reject3) => {
|
|
176794
176949
|
const activeSignals = [...new Set(signals.filter((signal) => signal != null))];
|
|
176795
176950
|
let timeout;
|
|
176796
176951
|
let settled = false;
|
|
@@ -176822,7 +176977,7 @@ var init_sleep = __esm({
|
|
|
176822
176977
|
return;
|
|
176823
176978
|
}
|
|
176824
176979
|
timeout = setTimeout(() => {
|
|
176825
|
-
settle3(
|
|
176980
|
+
settle3(resolve13);
|
|
176826
176981
|
}, ms);
|
|
176827
176982
|
for (const signal of activeSignals) {
|
|
176828
176983
|
if (settled) {
|
|
@@ -177368,8 +177523,8 @@ function createAbortableSSESource(body6, signal) {
|
|
|
177368
177523
|
let interrupt;
|
|
177369
177524
|
const waitForAbort = () => (
|
|
177370
177525
|
// oxlint-disable-next-line promise/avoid-new -- AbortSignal callbacks need a portable Promise bridge.
|
|
177371
|
-
new Promise((
|
|
177372
|
-
interrupt =
|
|
177526
|
+
new Promise((resolve13) => {
|
|
177527
|
+
interrupt = resolve13;
|
|
177373
177528
|
})
|
|
177374
177529
|
);
|
|
177375
177530
|
const cancel3 = () => {
|
|
@@ -178642,8 +178797,8 @@ var init_api_promise = __esm({
|
|
|
178642
178797
|
init_parse3();
|
|
178643
178798
|
APIPromise = class _APIPromise extends Promise {
|
|
178644
178799
|
constructor(client2, responsePromise, parseResponse2 = defaultParseResponse) {
|
|
178645
|
-
super((
|
|
178646
|
-
|
|
178800
|
+
super((resolve13) => {
|
|
178801
|
+
resolve13(null);
|
|
178647
178802
|
});
|
|
178648
178803
|
this.responsePromise = responsePromise;
|
|
178649
178804
|
this.parseResponse = parseResponse2;
|
|
@@ -181814,12 +181969,12 @@ var init_EventStream = __esm({
|
|
|
181814
181969
|
_EventStream_aborted.set(this, false);
|
|
181815
181970
|
_EventStream_catchingPromiseCreated.set(this, false);
|
|
181816
181971
|
_EventStream_terminalFailure.set(this, void 0);
|
|
181817
|
-
__classPrivateFieldSet(this, _EventStream_connectedPromise, new Promise((
|
|
181818
|
-
__classPrivateFieldSet(this, _EventStream_resolveConnectedPromise,
|
|
181972
|
+
__classPrivateFieldSet(this, _EventStream_connectedPromise, new Promise((resolve13, reject3) => {
|
|
181973
|
+
__classPrivateFieldSet(this, _EventStream_resolveConnectedPromise, resolve13, "f");
|
|
181819
181974
|
__classPrivateFieldSet(this, _EventStream_rejectConnectedPromise, reject3, "f");
|
|
181820
181975
|
}), "f");
|
|
181821
|
-
__classPrivateFieldSet(this, _EventStream_endPromise, new Promise((
|
|
181822
|
-
__classPrivateFieldSet(this, _EventStream_resolveEndPromise,
|
|
181976
|
+
__classPrivateFieldSet(this, _EventStream_endPromise, new Promise((resolve13, reject3) => {
|
|
181977
|
+
__classPrivateFieldSet(this, _EventStream_resolveEndPromise, resolve13, "f");
|
|
181823
181978
|
__classPrivateFieldSet(this, _EventStream_rejectEndPromise, reject3, "f");
|
|
181824
181979
|
}), "f");
|
|
181825
181980
|
__classPrivateFieldGet(this, _EventStream_connectedPromise, "f").catch(() => void 0);
|
|
@@ -181957,7 +182112,7 @@ var init_EventStream = __esm({
|
|
|
181957
182112
|
* const message = await stream.emitted('message') // rejects if the stream errors
|
|
181958
182113
|
*/
|
|
181959
182114
|
emitted(event3) {
|
|
181960
|
-
return new Promise((
|
|
182115
|
+
return new Promise((resolve13, reject3) => {
|
|
181961
182116
|
__classPrivateFieldSet(this, _EventStream_catchingPromiseCreated, true, "f");
|
|
181962
182117
|
const onError = (error64) => {
|
|
181963
182118
|
this.off(event3, onEvent);
|
|
@@ -181967,7 +182122,7 @@ var init_EventStream = __esm({
|
|
|
181967
182122
|
if (event3 !== "error") {
|
|
181968
182123
|
this.off("error", onError);
|
|
181969
182124
|
}
|
|
181970
|
-
|
|
182125
|
+
resolve13(values2.length > 1 ? values2 : values2[0]);
|
|
181971
182126
|
};
|
|
181972
182127
|
if (event3 !== "error") {
|
|
181973
182128
|
__classPrivateFieldGet(this, _EventStream_instances, "m", _EventStream_onceForEmitted).call(this, "error", onError);
|
|
@@ -182183,8 +182338,8 @@ var init_EventStream = __esm({
|
|
|
182183
182338
|
if (ended) {
|
|
182184
182339
|
return Promise.resolve(doneResult());
|
|
182185
182340
|
}
|
|
182186
|
-
return new Promise((
|
|
182187
|
-
readQueue.enqueue({ resolve:
|
|
182341
|
+
return new Promise((resolve13, reject3) => {
|
|
182342
|
+
readQueue.enqueue({ resolve: resolve13, reject: reject3 });
|
|
182188
182343
|
});
|
|
182189
182344
|
},
|
|
182190
182345
|
return: () => {
|
|
@@ -182953,21 +183108,21 @@ var init_parser2 = __esm({
|
|
|
182953
183108
|
};
|
|
182954
183109
|
const parseStr = () => {
|
|
182955
183110
|
const start = index;
|
|
182956
|
-
let
|
|
183111
|
+
let escape11 = false;
|
|
182957
183112
|
index++;
|
|
182958
|
-
while (index < length && (jsonString[index] !== '"' ||
|
|
182959
|
-
|
|
183113
|
+
while (index < length && (jsonString[index] !== '"' || escape11 && jsonString[index - 1] === "\\")) {
|
|
183114
|
+
escape11 = jsonString[index] === "\\" ? !escape11 : false;
|
|
182960
183115
|
index++;
|
|
182961
183116
|
}
|
|
182962
183117
|
if (jsonString.charAt(index) === '"') {
|
|
182963
183118
|
try {
|
|
182964
|
-
return JSON.parse(jsonString.substring(start, ++index - Number(
|
|
183119
|
+
return JSON.parse(jsonString.substring(start, ++index - Number(escape11)));
|
|
182965
183120
|
} catch (e) {
|
|
182966
183121
|
throwMalformedError(String(e));
|
|
182967
183122
|
}
|
|
182968
183123
|
} else if (Allow.STR & allow) {
|
|
182969
183124
|
try {
|
|
182970
|
-
return JSON.parse(jsonString.substring(start, index - Number(
|
|
183125
|
+
return JSON.parse(jsonString.substring(start, index - Number(escape11)) + '"');
|
|
182971
183126
|
} catch {
|
|
182972
183127
|
return JSON.parse(jsonString.substring(start, jsonString.lastIndexOf("\\")) + '"');
|
|
182973
183128
|
}
|
|
@@ -190770,8 +190925,8 @@ var init_tool_dispatcher = __esm({
|
|
|
190770
190925
|
try {
|
|
190771
190926
|
await __classPrivateFieldGet(this, _AgentToolDispatcher_instances, "m", _AgentToolDispatcher_wait).call(this, () => (
|
|
190772
190927
|
// oxlint-disable-next-line promise/avoid-new -- Own the registration timer so cancellation clears it promptly.
|
|
190773
|
-
new Promise((
|
|
190774
|
-
timer = setTimeout(
|
|
190928
|
+
new Promise((resolve13) => {
|
|
190929
|
+
timer = setTimeout(resolve13, delay);
|
|
190775
190930
|
})
|
|
190776
190931
|
));
|
|
190777
190932
|
} finally {
|
|
@@ -192704,7 +192859,7 @@ var init_steps2 = __esm({
|
|
|
192704
192859
|
|
|
192705
192860
|
// node_modules/.pnpm/openai@7.43.0_@aws-sdk+credential-provider-node@3.972.91_@smithy+signature-v4@5.7.5_undici@8.12.3_ws@8.22.0_zod@4.6.7/node_modules/openai/lib/polling.mjs
|
|
192706
192861
|
function sleepUntilAborted(milliseconds, signal) {
|
|
192707
|
-
return new Promise((
|
|
192862
|
+
return new Promise((resolve13, reject3) => {
|
|
192708
192863
|
let timer;
|
|
192709
192864
|
let registered;
|
|
192710
192865
|
let settled = false;
|
|
@@ -192753,7 +192908,7 @@ function sleepUntilAborted(milliseconds, signal) {
|
|
|
192753
192908
|
}
|
|
192754
192909
|
settled = true;
|
|
192755
192910
|
cleanup();
|
|
192756
|
-
|
|
192911
|
+
resolve13();
|
|
192757
192912
|
}, milliseconds);
|
|
192758
192913
|
registered = abort;
|
|
192759
192914
|
try {
|
|
@@ -201960,6 +202115,55 @@ var init_production = __esm({
|
|
|
201960
202115
|
}
|
|
201961
202116
|
});
|
|
201962
202117
|
|
|
202118
|
+
// backend/src/reproduction-text.ts
|
|
202119
|
+
function renderWrites(writes2) {
|
|
202120
|
+
const of = `${writes2.of} ${writes2.of === 1 ? "trial" : "trials"}`;
|
|
202121
|
+
if (!writes2.tools.length) return [` writes compared with production: none in production, none in this run's ${of}`];
|
|
202122
|
+
const called = (n2) => n2 === 0 ? "not called" : n2 === 1 ? "called" : `called ${n2} times`;
|
|
202123
|
+
const width = Math.max(...writes2.tools.map((w2) => w2.tool.length)), said = Math.max(...writes2.tools.map((w2) => called(w2.production).length));
|
|
202124
|
+
return [" writes compared with production:", ...writes2.tools.map((w2) => ` ${w2.tool.padEnd(width)} production: ${called(w2.production).padEnd(said)} this run: ${w2.trials} of ${of}`)];
|
|
202125
|
+
}
|
|
202126
|
+
function renderReproduction(reproductions, opts = {}) {
|
|
202127
|
+
if (opts.neverRan) return reproductions.map((r2) => `compared with production${r2.trace === void 0 ? "" : ` (trace ${r2.trace.slice(0, 12)})`}: ${r2.sceneId}
|
|
202128
|
+
=> not compared: the agent never ran`).join("\n\n");
|
|
202129
|
+
return reproductions.map((r2) => {
|
|
202130
|
+
const width = Math.max(...r2.checks.map((c) => c.check.length));
|
|
202131
|
+
const rows7 = r2.checks.map((c) => ` ${c.check.padEnd(width)} ${c.production} in production \xB7 ${c.total === 0 ? "not run" : c.failed === 0 ? `passed ${c.total}/${c.total} here` : `failed ${c.failed}/${c.total} here`}`);
|
|
202132
|
+
const also = r2.verdict !== "differs" ? r2.checks.filter((c) => c.production === "passed" && c.failed > 0).map((c) => c.check) : [];
|
|
202133
|
+
const verdict = r2.error !== void 0 && r2.checks.length === 0 ? [] : [`=> ${SAY[r2.verdict]}`];
|
|
202134
|
+
return [
|
|
202135
|
+
`compared with production${r2.trace === void 0 ? "" : ` (trace ${r2.trace.slice(0, 12)})`}: ${r2.sceneId}`,
|
|
202136
|
+
...rows7,
|
|
202137
|
+
...verdict,
|
|
202138
|
+
...r2.error !== void 0 ? [` grading production's record failed: ${r2.error}`] : [],
|
|
202139
|
+
...also.length > 0 ? [` also failing here, though production passed: ${also.join(", ")}`] : [],
|
|
202140
|
+
// A failure here on a check production is not graded on yet is neither a match nor a regression: say how to grade both.
|
|
202141
|
+
...r2.verdict !== "unknown" && r2.checks.some((c) => c.production === "unknown" && c.failed > 0) ? [` set OPENROUTER_API_KEY to grade ${r2.checks.filter((c) => c.production === "unknown" && c.failed > 0).map((c) => c.check).join(", ")} on production's record and here`] : [],
|
|
202142
|
+
...r2.added.length > 0 ? [` checks added after saving, with no production result: ${r2.added.join(", ")}`] : [],
|
|
202143
|
+
// How much of the run stood on production's own answers (TRACE_PLAN_V2 §8.6).
|
|
202144
|
+
...r2.answers ? [` answers to the agent's tools: ${["replayed", "replayed-elsewhere", "twin", "ran", "simulated", "validated", "failed"].filter((s2) => r2.answers[s2]).map((s2) => `${r2.answers[s2]} ${s2}`).join(", ")}${r2.answers.simulated ? "; simulated answers took the agent where production never went (ancha explain lists them)" : ""}`] : [],
|
|
202145
|
+
// What the agent changed, next to what production changed: an answer that needs no model (SPEC-020 R1).
|
|
202146
|
+
...r2.writes !== void 0 && r2.writes.of > 0 ? renderWrites(r2.writes) : []
|
|
202147
|
+
].join("\n");
|
|
202148
|
+
}).join("\n\n");
|
|
202149
|
+
}
|
|
202150
|
+
var SAY;
|
|
202151
|
+
var init_reproduction_text = __esm({
|
|
202152
|
+
"backend/src/reproduction-text.ts"() {
|
|
202153
|
+
"use strict";
|
|
202154
|
+
SAY = {
|
|
202155
|
+
crashed: "the agent exited with an error in every trial, so this run says nothing about production's failure: fix the agent first",
|
|
202156
|
+
reproduced: "production's failure happens here too",
|
|
202157
|
+
partly: "production's failure happens here in part",
|
|
202158
|
+
"not-reproduced": "production's failure did not happen here",
|
|
202159
|
+
matches: "this run matches production, which passed these checks",
|
|
202160
|
+
differs: "checks production passed failed here",
|
|
202161
|
+
unknown: "set OPENROUTER_API_KEY and run again: a model grades these checks on production's record and on this run",
|
|
202162
|
+
ungraded: "no check production failed could be graded in this run, so it says nothing about production's failure yet"
|
|
202163
|
+
};
|
|
202164
|
+
}
|
|
202165
|
+
});
|
|
202166
|
+
|
|
201963
202167
|
// backend/src/production-comparison.ts
|
|
201964
202168
|
import { readFile as readFile6 } from "node:fs/promises";
|
|
201965
202169
|
import { dirname as dirname3, join as join7, resolve as resolve6 } from "node:path";
|
|
@@ -201979,7 +202183,7 @@ async function reproductionOf(summary, scenePaths, cwd, runDir, scenes = [], pro
|
|
|
201979
202183
|
const failedInProduction = checks2.filter((c) => c.production === "failed"), failedThere = failedInProduction.filter((c) => c.total > 0);
|
|
201980
202184
|
const ungraded = failedInProduction.length > 0 && failedThere.length === 0;
|
|
201981
202185
|
const detail3 = scene2.trialsDetail ?? [];
|
|
201982
|
-
const crashed = detail3.length > 0 && detail3.every((t) => t.exit === "exited" && t.exitCode !== 0);
|
|
202186
|
+
const crashed = detail3.length > 0 && detail3.every((t) => t.exit === "exited" && t.exitCode !== 0 || t.exit === "spawn_failed" || t.exit === "invalid" && t.originalExit === "spawn_failed");
|
|
201983
202187
|
const verdict = crashed ? "crashed" : ungraded ? Object.values(scene2.checks).some((c) => c.invalid) ? "ungraded" : "unknown" : failedThere.length > 0 ? failedThere.every((c) => c.failed * 2 > c.total) ? "reproduced" : failedThere.some((c) => c.failed > 0) ? "partly" : "not-reproduced" : checks2.some((c) => c.production === "passed" && c.failed > 0) ? "differs" : checks2.some((c) => c.production === "passed") ? "matches" : "unknown";
|
|
201984
202188
|
const added = Object.keys(scene2.checks).filter((check3) => !(check3 in production2.checks));
|
|
201985
202189
|
const counts = runDir === void 0 ? {} : await answerSources(runDir, scene2);
|
|
@@ -202014,51 +202218,12 @@ async function writesOf(scene2, dir, runDir, ran) {
|
|
|
202014
202218
|
const tools = [...made.keys(), ...[...here.keys()].filter((tool) => !made.has(tool)).sort()];
|
|
202015
202219
|
return { of: trials.length, tools: tools.map((tool) => ({ tool, production: made.get(tool) ?? 0, trials: here.get(tool) ?? 0 })) };
|
|
202016
202220
|
}
|
|
202017
|
-
function renderWrites(writes2) {
|
|
202018
|
-
const of = `${writes2.of} ${writes2.of === 1 ? "trial" : "trials"}`;
|
|
202019
|
-
if (!writes2.tools.length) return [` writes compared with production: none in production, none in this run's ${of}`];
|
|
202020
|
-
const called = (n2) => n2 === 0 ? "not called" : n2 === 1 ? "called" : `called ${n2} times`;
|
|
202021
|
-
const width = Math.max(...writes2.tools.map((w2) => w2.tool.length)), said = Math.max(...writes2.tools.map((w2) => called(w2.production).length));
|
|
202022
|
-
return [" writes compared with production:", ...writes2.tools.map((w2) => ` ${w2.tool.padEnd(width)} production: ${called(w2.production).padEnd(said)} this run: ${w2.trials} of ${of}`)];
|
|
202023
|
-
}
|
|
202024
|
-
function renderReproduction(reproductions) {
|
|
202025
|
-
return reproductions.map((r2) => {
|
|
202026
|
-
const width = Math.max(...r2.checks.map((c) => c.check.length));
|
|
202027
|
-
const rows7 = r2.checks.map((c) => ` ${c.check.padEnd(width)} ${c.production} in production \xB7 ${c.total === 0 ? "not run" : c.failed === 0 ? `passed ${c.total}/${c.total} here` : `failed ${c.failed}/${c.total} here`}`);
|
|
202028
|
-
const also = r2.verdict !== "differs" ? r2.checks.filter((c) => c.production === "passed" && c.failed > 0).map((c) => c.check) : [];
|
|
202029
|
-
const verdict = r2.error !== void 0 && r2.checks.length === 0 ? [] : [`=> ${SAY[r2.verdict]}`];
|
|
202030
|
-
return [
|
|
202031
|
-
`compared with production${r2.trace === void 0 ? "" : ` (trace ${r2.trace.slice(0, 12)})`}: ${r2.sceneId}`,
|
|
202032
|
-
...rows7,
|
|
202033
|
-
...verdict,
|
|
202034
|
-
...r2.error !== void 0 ? [` grading production's record failed: ${r2.error}`] : [],
|
|
202035
|
-
...also.length > 0 ? [` also failing here, though production passed: ${also.join(", ")}`] : [],
|
|
202036
|
-
// A failure here on a check production is not graded on yet is neither a match nor a regression: say how to grade both.
|
|
202037
|
-
...r2.verdict !== "unknown" && r2.checks.some((c) => c.production === "unknown" && c.failed > 0) ? [` set OPENROUTER_API_KEY to grade ${r2.checks.filter((c) => c.production === "unknown" && c.failed > 0).map((c) => c.check).join(", ")} on production's record and here`] : [],
|
|
202038
|
-
...r2.added.length > 0 ? [` checks added after saving, with no production result: ${r2.added.join(", ")}`] : [],
|
|
202039
|
-
// How much of the run stood on production's own answers (TRACE_PLAN_V2 §8.6).
|
|
202040
|
-
...r2.answers ? [` answers to the agent's tools: ${["replayed", "replayed-elsewhere", "twin", "ran", "simulated", "validated", "failed"].filter((s2) => r2.answers[s2]).map((s2) => `${r2.answers[s2]} ${s2}`).join(", ")}${r2.answers.simulated ? "; simulated answers took the agent where production never went (ancha explain lists them)" : ""}`] : [],
|
|
202041
|
-
// What the agent changed, next to what production changed: an answer that needs no model (SPEC-020 R1).
|
|
202042
|
-
...r2.writes !== void 0 && r2.writes.of > 0 ? renderWrites(r2.writes) : []
|
|
202043
|
-
].join("\n");
|
|
202044
|
-
}).join("\n\n");
|
|
202045
|
-
}
|
|
202046
|
-
var SAY;
|
|
202047
202221
|
var init_production_comparison = __esm({
|
|
202048
202222
|
"backend/src/production-comparison.ts"() {
|
|
202049
202223
|
"use strict";
|
|
202050
202224
|
init_actions7();
|
|
202051
202225
|
init_production();
|
|
202052
|
-
|
|
202053
|
-
crashed: "the agent exited with an error in every trial, so this run says nothing about production's failure: fix the agent first",
|
|
202054
|
-
reproduced: "production's failure happens here too",
|
|
202055
|
-
partly: "production's failure happens here in part",
|
|
202056
|
-
"not-reproduced": "production's failure did not happen here",
|
|
202057
|
-
matches: "this run matches production, which passed these checks",
|
|
202058
|
-
differs: "checks production passed failed here",
|
|
202059
|
-
unknown: "set OPENROUTER_API_KEY and run again: a model grades these checks on production's record and on this run",
|
|
202060
|
-
ungraded: "no check production failed could be graded in this run, so it says nothing about production's failure yet"
|
|
202061
|
-
};
|
|
202226
|
+
init_reproduction_text();
|
|
202062
202227
|
}
|
|
202063
202228
|
});
|
|
202064
202229
|
|
|
@@ -202083,9 +202248,97 @@ var init_scenes = __esm({
|
|
|
202083
202248
|
}
|
|
202084
202249
|
});
|
|
202085
202250
|
|
|
202251
|
+
// backend/src/agent-fix.ts
|
|
202252
|
+
function givenByTwins(name5) {
|
|
202253
|
+
twinVariables ??= new Set(Object.keys(toolConnectionEnvironment(Object.fromEntries(SUPPORTED_TWINS.map((twin) => [twin, ANY_SERVICE2])))));
|
|
202254
|
+
return twinVariables.has(name5);
|
|
202255
|
+
}
|
|
202256
|
+
function taskVariables(text24) {
|
|
202257
|
+
const found = [];
|
|
202258
|
+
for (const match3 of text24.matchAll(TASK_NAME)) {
|
|
202259
|
+
const name5 = match3[1], before = text24.slice(0, match3.index);
|
|
202260
|
+
if (name5.startsWith("ANCHA_") || /--?[A-Za-z][\w-]*[ =]$/.test(before)) continue;
|
|
202261
|
+
const bare = !name5.includes("_");
|
|
202262
|
+
const named3 = escape10(name5);
|
|
202263
|
+
if (bare && !new RegExp(`(?:\\$\\{?|process\\.env\\.|process\\.env\\[['"]|environ(?:\\.get)?\\(?\\[?['"]|getenv\\(['"]|\\bset\\s+|\\bexport\\s+)${named3}\\b|\\b${named3}\\s+(?:is\\s+)?(?:not\\s+set|unset|empty|missing|required|undefined)|\\b${named3}\\s+(?:env(?:ironment)?\\s+)?variable|variable\\s+${named3}\\b|KeyError:\\s*['"]${named3}['"]`).test(text24)) continue;
|
|
202264
|
+
if (!found.includes(name5)) found.push(name5);
|
|
202265
|
+
}
|
|
202266
|
+
return found;
|
|
202267
|
+
}
|
|
202268
|
+
function taskFlags(text24) {
|
|
202269
|
+
return [...new Set([...text24.matchAll(TASK_FLAG)].map((match3) => match3[1]))];
|
|
202270
|
+
}
|
|
202271
|
+
function taskFix(text24, command) {
|
|
202272
|
+
const names5 = taskVariables(text24);
|
|
202273
|
+
const plain3 = names5.find((name5) => !/_(?:FILE|PATH)$/.test(name5)), file3 = names5.find((name5) => /_(?:FILE|PATH)$/.test(name5));
|
|
202274
|
+
if (plain3 !== void 0) return `it looks for its task in ${plain3}; Ancha gives the task in ANCHA_TASK. Add under agent: in ancha.yaml: env: { ${plain3}: "{{task}}" }`;
|
|
202275
|
+
const flags = taskFlags(text24), flag5 = flags.find((f2) => !f2.endsWith("-file")), fileFlag = flags.find((f2) => f2.endsWith("-file"));
|
|
202276
|
+
const shellCommand = command !== void 0 && !/^https?:\/\//.test(command) ? command : void 0;
|
|
202277
|
+
if (flag5 !== void 0 && !shellCommand?.includes(flag5)) {
|
|
202278
|
+
return `it takes its task with ${flag5}; Ancha gives the task in ANCHA_TASK. In ancha.yaml, set agent.command to: ${shellCommand === void 0 ? "<its command>" : shellCommand} ${flag5} "$ANCHA_TASK"`;
|
|
202279
|
+
}
|
|
202280
|
+
if (file3 !== void 0) return `it looks for a file with its task in ${file3}; Ancha writes the task to a file at {{task_file}}. Add under agent: in ancha.yaml: env: { ${file3}: "{{task_file}}" }`;
|
|
202281
|
+
if (fileFlag !== void 0 && !shellCommand?.includes(fileFlag)) {
|
|
202282
|
+
return `it reads its task from the file given with ${fileFlag}; Ancha writes the task to a file at {{task_file}}. Add under agent: in ancha.yaml: env: { TASK_FILE: "{{task_file}}" }, and add ${fileFlag} "$TASK_FILE" to agent.command`;
|
|
202283
|
+
}
|
|
202284
|
+
return void 0;
|
|
202285
|
+
}
|
|
202286
|
+
function keyFix(lines, context3) {
|
|
202287
|
+
for (const line2 of [...lines].reverse()) {
|
|
202288
|
+
if (!MISSING.test(line2)) continue;
|
|
202289
|
+
const name5 = [...line2.matchAll(CREDENTIAL)].map((match3) => match3[1]).find((found) => !found.startsWith("ANCHA_") && !givenByTwins(found));
|
|
202290
|
+
if (name5 === void 0) continue;
|
|
202291
|
+
return context3.target === "cloud" ? `it needs ${name5}: run ancha secrets set ${name5} in the project, which stores it in your workspace and lists it under agent.pass_env in ancha.yaml` : `it needs ${name5}: set it in this shell and list it under agent.pass_env in ancha.yaml (or pass --pass-env ${name5})`;
|
|
202292
|
+
}
|
|
202293
|
+
return void 0;
|
|
202294
|
+
}
|
|
202295
|
+
function missingFix(text24, context3) {
|
|
202296
|
+
const cloud = context3.target === "cloud";
|
|
202297
|
+
const notFoundCommand = /(?:^|\n|: )([\w./@+-]+): (?:command )?not found\b/.exec(text24) ?? /(?:^|\n)(?:sh|bash|zsh|\/bin\/sh)(?:: line \d+|: \d+)?: ([\w./@+-]+): not found/.exec(text24);
|
|
202298
|
+
const packageName = /Cannot find package '([^']+)'/.exec(text24)?.[1];
|
|
202299
|
+
const required4 = /Cannot find module '([^']+)'/.exec(text24)?.[1];
|
|
202300
|
+
const requiredFile = required4 !== void 0 && /^(?:\.{1,2}[/\\]|[/\\]|[A-Za-z]:\\)|\.(?:[cm]?[jt]s|py|sh)$/.test(required4);
|
|
202301
|
+
const missingFile = (requiredFile ? required4 : void 0) ?? /can't open file '([^']+)'/.exec(text24)?.[1] ?? /No such file or directory: '([^']+)'/.exec(text24)?.[1];
|
|
202302
|
+
const module = packageName ?? (requiredFile ? void 0 : required4);
|
|
202303
|
+
const pythonModule = /No module named '([^']+)'/.exec(text24)?.[1];
|
|
202304
|
+
const install = cloud ? "the cloud machine installs what the project's manifests list (agent.install in ancha.yaml sets the command)" : "install the project's dependencies";
|
|
202305
|
+
if (module === void 0 && missingFile !== void 0) {
|
|
202306
|
+
const file3 = missingFile.replace(/^.*[/\\](?=[^/\\]+$)/, "");
|
|
202307
|
+
return cloud ? `it could not find ${file3}: check the path in agent.command in ancha.yaml; the cloud machine has the project's files, so a built or gitignored file is built by agent.install or added with --bundle-file` : `it could not find ${file3}: check the path in agent.command in ancha.yaml (it runs in the project folder)`;
|
|
202308
|
+
}
|
|
202309
|
+
if (module !== void 0) return `its dependency ${module} is not installed: add it to package.json; ${install}`;
|
|
202310
|
+
if (pythonModule !== void 0) return `its dependency ${pythonModule} is not installed: add it to requirements.txt or pyproject.toml; ${install}`;
|
|
202311
|
+
if (notFoundCommand !== null) return `its command ${notFoundCommand[1]} was not found: check agent.command in ancha.yaml, or make it a dependency of the project; ${install}`;
|
|
202312
|
+
return void 0;
|
|
202313
|
+
}
|
|
202314
|
+
function likelyFix(logTail3, context3 = {}) {
|
|
202315
|
+
const task2 = taskFix(logTail3.join("\n"), context3.command);
|
|
202316
|
+
if (task2 !== void 0 || context3.withheld !== void 0) return task2 ?? context3.withheld;
|
|
202317
|
+
const errors2 = logTail3.filter((line2) => /error|exception|fatal|panic|missing|required|usage|not set|not found|cannot|can't/i.test(line2));
|
|
202318
|
+
for (const lines of [errors2, logTail3]) {
|
|
202319
|
+
const fix = lines.length === 0 ? void 0 : keyFix(lines, context3) ?? missingFix(lines.join("\n"), context3);
|
|
202320
|
+
if (fix !== void 0) return fix;
|
|
202321
|
+
}
|
|
202322
|
+
return void 0;
|
|
202323
|
+
}
|
|
202324
|
+
var TASK_WORD, TASK_NAME, TASK_FLAG, CREDENTIAL, MISSING, twinVariables, ANY_SERVICE2, escape10;
|
|
202325
|
+
var init_agent_fix = __esm({
|
|
202326
|
+
"backend/src/agent-fix.ts"() {
|
|
202327
|
+
"use strict";
|
|
202328
|
+
init_src();
|
|
202329
|
+
TASK_WORD = "(?:TASKS?|PROMPTS?|QUERY|QUERIES|INSTRUCTIONS?|MESSAGES?|REQUESTS?|INPUTS?)";
|
|
202330
|
+
TASK_NAME = new RegExp(`(?<![A-Za-z0-9_])((?:[A-Z][A-Z0-9]*_)*${TASK_WORD}(?:_[A-Z0-9]+)*)(?![A-Za-z0-9_])`, "g");
|
|
202331
|
+
TASK_FLAG = /(?<![\w-])(--(?:task|prompt|message|input|query|instructions?|request)(?:-file)?)(?![\w-])/g;
|
|
202332
|
+
CREDENTIAL = /(?<![A-Za-z0-9_])([A-Z][A-Z0-9]*(?:_[A-Z0-9]+)*_(?:KEY|TOKEN|SECRET|PASSWORD))(?![A-Za-z0-9_])/g;
|
|
202333
|
+
MISSING = /missing|not set|unset|undefined|required|must be set|no .*(?:key|token)|KeyError|not found|empty|expected/i;
|
|
202334
|
+
ANY_SERVICE2 = { url: "x", hostUrl: "x", token: "x", signingSecret: "x", appToken: "x", apiKey: "x", appKey: "x", webhookToken: "x", fromEmail: "x", address: "x", routingKey: "x", routingKeys: {}, accessKey: "x", accessKeySecret: "x", clientSecret: "x", grpcEndpoint: "x", tlsRootCertificate: "x" };
|
|
202335
|
+
escape10 = (text24) => text24.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
202336
|
+
}
|
|
202337
|
+
});
|
|
202338
|
+
|
|
202086
202339
|
// backend/src/report.ts
|
|
202087
202340
|
import { readFile as readFile7, writeFile as writeFile5 } from "node:fs/promises";
|
|
202088
|
-
import { basename as basename3, dirname as dirname4, join as join8, resolve as resolve7 } from "node:path";
|
|
202341
|
+
import { basename as basename3, dirname as dirname4, join as join8, relative as relative3, resolve as resolve7 } from "node:path";
|
|
202089
202342
|
function okFalseError(response5) {
|
|
202090
202343
|
if (typeof response5 !== "object" || response5 === null || response5.ok !== false) return void 0;
|
|
202091
202344
|
const error64 = response5.error;
|
|
@@ -202131,8 +202384,9 @@ function summarizeScene(sceneId, trials, requestedTrials = trials.length) {
|
|
|
202131
202384
|
for (const issue6 of trialIssues(t)) {
|
|
202132
202385
|
if (harnessIssues.length < MAX_FAILURES_PER_SCENE) harnessIssues.push({ ...issue6, sceneId, trial: t.trial });
|
|
202133
202386
|
}
|
|
202134
|
-
|
|
202135
|
-
|
|
202387
|
+
const exit = t.exit === "invalid" && t.originalExit === "spawn_failed" ? "spawn_failed" : t.exit;
|
|
202388
|
+
if (!t.passed && exit !== "invalid" && !exitedCleanly({ exit, exitCode: t.exitCode }) && agentIssues.length < MAX_FAILURES_PER_SCENE) {
|
|
202389
|
+
agentIssues.push({ sceneId, trial: t.trial, exit, exitCode: t.exitCode, realMs: t.realMs, log: join8(t.dir, "agent.log"), logTail: t.logTail, ...t.invocations !== void 0 && { invocations: t.invocations } });
|
|
202136
202390
|
}
|
|
202137
202391
|
const valid = trialValid(t);
|
|
202138
202392
|
for (const c of t.checks) {
|
|
@@ -202233,6 +202487,70 @@ function crashLines(logTail3) {
|
|
|
202233
202487
|
while (start > 0 && start > last - 2 && ERROR_LINE.test(lines[start - 1])) start--;
|
|
202234
202488
|
return (start >= 0 ? lines.slice(start, start + 3) : lines.slice(-3)).map((line2) => line2.length > CRASH_LINE_MAX ? `${line2.slice(0, CRASH_LINE_MAX)}\u2026` : line2);
|
|
202235
202489
|
}
|
|
202490
|
+
function agentNeverRan(s2) {
|
|
202491
|
+
if (s2.pytest) return void 0;
|
|
202492
|
+
const ended = [];
|
|
202493
|
+
for (const scene2 of s2.scenes) {
|
|
202494
|
+
if ((scene2.agentCalls ?? 0) > 0) return void 0;
|
|
202495
|
+
for (const t of scene2.trialsDetail ?? []) {
|
|
202496
|
+
const issue6 = (scene2.agentIssues ?? []).find((i) => i.trial === t.trial);
|
|
202497
|
+
const spawn4 = t.exit === "spawn_failed" || t.exit === "invalid" && (t.originalExit === "spawn_failed" || (scene2.harnessIssues ?? []).some((i) => i.trial === t.trial && i.message.startsWith("AGENT_SPAWN_FAILED")));
|
|
202498
|
+
if (spawn4) {
|
|
202499
|
+
ended.push({ exit: "spawn_failed", exitCode: t.exitCode, realMs: t.realMs, perEvent: false, issue: issue6 });
|
|
202500
|
+
continue;
|
|
202501
|
+
}
|
|
202502
|
+
if (t.exit !== "exited" || t.exitCode === 0 || t.passed) return void 0;
|
|
202503
|
+
const invocations = issue6?.invocations;
|
|
202504
|
+
if (invocations !== void 0 ? invocations.total === 0 || invocations.failed < invocations.total : t.realMs > NEVER_RAN_MS) return void 0;
|
|
202505
|
+
ended.push({ exit: "exited", exitCode: t.exitCode, realMs: t.realMs, perEvent: invocations !== void 0, issue: issue6 });
|
|
202506
|
+
}
|
|
202507
|
+
}
|
|
202508
|
+
if (ended.length === 0) return void 0;
|
|
202509
|
+
const exits = new Set(ended.map((e) => e.exit)), codes = new Set(ended.map((e) => e.exitCode));
|
|
202510
|
+
const first = ended.find((e) => e.issue !== void 0)?.issue;
|
|
202511
|
+
const cloud = s2.target === "cloud";
|
|
202512
|
+
const withheld = first === void 0 || cloud ? void 0 : withheldHint(first, s2.agentEnvironment);
|
|
202513
|
+
const fix = first === void 0 ? void 0 : likelyFix(first.logTail, { target: s2.target, command: s2.agent, ...withheld !== void 0 && { withheld } });
|
|
202514
|
+
const checksFailed = s2.scenes.reduce((n2, scene2) => n2 + Object.values(scene2.checks).filter((c) => c.required && c.total - c.passed - (c.skipped ?? 0) - (c.invalid ?? 0) > 0).length, 0);
|
|
202515
|
+
const exit = exits.size > 1 ? "mixed" : [...exits][0];
|
|
202516
|
+
return {
|
|
202517
|
+
attempts: ended.length,
|
|
202518
|
+
tests: s2.scenes.filter((scene2) => (scene2.trialsDetail ?? []).length > 0).length,
|
|
202519
|
+
exit,
|
|
202520
|
+
exitCode: codes.size === 1 ? ended[0].exitCode : null,
|
|
202521
|
+
...exit === "exited" && codes.size === 1 && ended[0].exitCode === null && { signal: true },
|
|
202522
|
+
...exit === "exited" && ended.every((e) => e.perEvent) && { perEvent: true },
|
|
202523
|
+
ms: Math.max(...ended.map((e) => e.realMs)),
|
|
202524
|
+
logTail: (first?.logTail ?? []).filter((line2) => !CRASH_NOISE.test(line2)).slice(-10).map((line2) => line2.length > CRASH_LINE_MAX ? `${line2.slice(0, CRASH_LINE_MAX)}\u2026` : line2),
|
|
202525
|
+
...first !== void 0 && !cloud && { log: first.log },
|
|
202526
|
+
...fix !== void 0 && { fix },
|
|
202527
|
+
checksFailed
|
|
202528
|
+
};
|
|
202529
|
+
}
|
|
202530
|
+
function neverRanHeadline(n2) {
|
|
202531
|
+
const time7 = `${n2.attempts === 1 ? "after" : "within"} ${spaced(n2.ms)}`;
|
|
202532
|
+
const how = n2.exit === "spawn_failed" ? n2.exitCode === 127 ? "its command was not found" : "its command could not be started" : n2.exit === "mixed" ? "it stopped before doing anything" : n2.perEvent ? n2.signal ? "it was killed by a signal each time it was started" : n2.exitCode === null ? "it exited with an error each time it was started" : `it exited with code ${n2.exitCode} each time it was started` : n2.signal ? `it was killed by a signal ${time7}` : n2.exitCode === null ? `it exited with an error ${time7}` : `it exited with code ${n2.exitCode} ${time7}`;
|
|
202533
|
+
const where2 = n2.attempts === 1 ? "" : n2.tests > 1 ? ` in all ${n2.attempts} attempts of ${n2.tests} tests` : n2.attempts === 2 ? " in both attempts" : ` in all ${n2.attempts} attempts`;
|
|
202534
|
+
return `Your agent didn't run: ${how}${where2}`;
|
|
202535
|
+
}
|
|
202536
|
+
function neverRanLines(n2, cwd) {
|
|
202537
|
+
const path6 = n2.log === void 0 || cwd === void 0 || relative3(cwd, n2.log).startsWith("..") ? n2.log : relative3(cwd, n2.log);
|
|
202538
|
+
const log2 = path6 === void 0 ? "log (from the cloud machine)" : `log (${path6})`;
|
|
202539
|
+
return [neverRanHeadline(n2), n2.logTail.length === 0 ? ` ${log2}: empty` : ` ${log2}:`, ...n2.logTail.map((line2) => ` ${line2}`), ...n2.fix === void 0 ? [] : [` likely fix: ${n2.fix}`]];
|
|
202540
|
+
}
|
|
202541
|
+
function neverRanChecksLine(n2, runId, out) {
|
|
202542
|
+
if (n2.checksFailed === 0) return void 0;
|
|
202543
|
+
return `${n2.checksFailed} ${n2.checksFailed === 1 ? "check" : "checks"} failed because the agent never ran; ancha explain ${runId}${out === void 0 ? "" : ` --out ${shellWord(out)}`} --all shows them`;
|
|
202544
|
+
}
|
|
202545
|
+
function retryCommands(s2, opts = {}) {
|
|
202546
|
+
const tests = opts.tests !== void 0 && opts.tests.length > 0 && opts.tests.length <= 3 ? ` ${opts.tests.map(shellWord).join(" ")}` : "";
|
|
202547
|
+
if (s2.target === "cloud") return ["ancha agent upload", `ancha run --on cloud${tests}`];
|
|
202548
|
+
const on = s2.target === "docker" ? " --on docker" : s2.target === "local" ? " --on local" : "";
|
|
202549
|
+
return [`ancha run${on}${tests}${opts.out === void 0 ? "" : ` --out ${shellWord(opts.out)}`}`];
|
|
202550
|
+
}
|
|
202551
|
+
function neverRanNextLine(n2, retry) {
|
|
202552
|
+
return `next: ${n2.fix === void 0 ? "fix what its log says" : "make the fix above"}, then ${retry.join(", then ")}`;
|
|
202553
|
+
}
|
|
202236
202554
|
async function writeSummary(run4, summary) {
|
|
202237
202555
|
await writeFile5(join8(run4.dir, "summary.json"), `${JSON.stringify(summary, null, 2)}
|
|
202238
202556
|
`);
|
|
@@ -202262,12 +202580,15 @@ function nonDefaultOut(cwd, out) {
|
|
|
202262
202580
|
function renderSummaryText(s2, opts = {}) {
|
|
202263
202581
|
const lines = s2.replayOf === void 0 ? [] : [`replay of ${s2.replayOf}`];
|
|
202264
202582
|
if (s2.pytest) lines.push(`pytest ${s2.pytest.nodeId}: ${s2.pytest.outcome}${s2.pytest.invalid ? " [invalid]" : !s2.pytest.graded ? " (ungraded)" : ""}`);
|
|
202583
|
+
const never2 = agentNeverRan(s2);
|
|
202584
|
+
if (never2 !== void 0) lines.push(...neverRanLines(never2, opts.cwd));
|
|
202265
202585
|
for (const scene2 of s2.scenes) {
|
|
202266
202586
|
const invalid30 = scene2.invalidTrials ?? 0;
|
|
202267
202587
|
const ok = invalid30 === 0 && !!scene2.counts && meetsPassRate(scene2.counts, s2.minPassRate);
|
|
202268
202588
|
const excluded2 = scene2.trialsDetail.filter((trial) => trial.outcome === "skipped" || trial.outcome === "xfailed").length;
|
|
202269
202589
|
if (s2.pytest && !s2.pytest.graded) lines.push(`\u2014 ${scene2.sceneId} ungraded${excluded2 ? ` (${excluded2} excluded)` : ""}${invalid30 ? " [invalid]" : ""}`);
|
|
202270
202590
|
else lines.push(`${ok ? "\u2713" : "\u2717"} ${scene2.sceneId} ${scene2.passed}/${scene2.counts?.requested ?? scene2.trials} (${pct(scene2.passRate)}%)${invalid30 > 0 ? " [invalid]" : ""}${excluded2 ? ` (${excluded2} excluded)` : ""}`);
|
|
202591
|
+
if (never2 !== void 0) continue;
|
|
202271
202592
|
if (invalid30 > 0) lines.push(` \u2717 harness failure: ${invalid30}/${scene2.trials} trials invalid`);
|
|
202272
202593
|
if ((scene2.skippedJudges ?? 0) > 0) lines.push(` judge grading skipped: ${scene2.skippedJudges} check(s)`);
|
|
202273
202594
|
for (const warning of scene2.warnings ?? []) lines.push(` warning: trial ${warning.trial} ${warning.check}: ${warning.message.replaceAll("\n", "\n ")}`);
|
|
@@ -202309,13 +202630,17 @@ function renderSummaryText(s2, opts = {}) {
|
|
|
202309
202630
|
if (made.length > SUMMARY_ACTIONS_SHOWN) lines.push(` \u2026 ${made.length - SUMMARY_ACTIONS_SHOWN} more`);
|
|
202310
202631
|
}
|
|
202311
202632
|
}
|
|
202633
|
+
const folded = never2 === void 0 ? void 0 : neverRanChecksLine(never2, s2.runId, opts.out);
|
|
202634
|
+
if (folded !== void 0) lines.push(folded);
|
|
202312
202635
|
lines.push("");
|
|
202313
202636
|
lines.push(...strictSummaryLines(s2));
|
|
202314
202637
|
if (s2.comparison !== void 0) lines.push(...comparisonLines(s2.comparison));
|
|
202638
|
+
if ((opts.reproduction ?? []).length > 0) lines.push(renderReproduction(opts.reproduction, { neverRan: never2 !== void 0 }), "");
|
|
202315
202639
|
const noneGraded = s2.scenes.length > 0 && s2.scenes.every((scene2) => scene2.trials > 0 && (scene2.invalidTrials ?? 0) >= scene2.trials);
|
|
202316
202640
|
lines.push(`${s2.pytest && !s2.pytest.graded && !s2.pytest.invalid ? s2.pytest.outcome + " (ungraded)" : noneGraded ? "invalid (no trials graded)" : s2.verdict} (minimum pass rate ${pct(s2.minPassRate)}%) run ${s2.runId}`);
|
|
202317
202641
|
const next2 = nextAfterRun(s2, opts);
|
|
202318
|
-
if (
|
|
202642
|
+
if (never2 !== void 0) lines.push(neverRanNextLine(never2, next2));
|
|
202643
|
+
else if (next2.length > 0) lines.push(`next: ${next2.join(", then ")}`);
|
|
202319
202644
|
return lines.join("\n").replaceAll(PATTERN_NOTE, "") + (lines.some((line2) => line2.includes(PATTERN_NOTE)) ? `
|
|
202320
202645
|
${PATTERN_NOTE.trim()}` : "");
|
|
202321
202646
|
}
|
|
@@ -202332,6 +202657,7 @@ function comparisonLines(comparison2) {
|
|
|
202332
202657
|
return lines;
|
|
202333
202658
|
}
|
|
202334
202659
|
function nextAfterRun(s2, opts = {}) {
|
|
202660
|
+
if (agentNeverRan(s2) !== void 0) return retryCommands(s2, opts);
|
|
202335
202661
|
const out = opts.out === void 0 ? "" : ` --out ${shellWord(opts.out)}`;
|
|
202336
202662
|
const failed = s2.verdict === "fail" || s2.scenes.some((scene2) => scene2.failures.length > 0 || (scene2.agentIssues ?? []).length > 0 || (scene2.harnessIssues ?? []).length > 0 || (scene2.invalidTrials ?? 0) > 0);
|
|
202337
202663
|
if (failed) return [`ancha explain ${s2.runId}${out}`];
|
|
@@ -202340,7 +202666,7 @@ function nextAfterRun(s2, opts = {}) {
|
|
|
202340
202666
|
function uploadHintLine(runId, workspace3, opts = {}) {
|
|
202341
202667
|
return `ancha runs upload ${runId}${opts.out === void 0 ? "" : ` --out ${shellWord(opts.out)}`} sends this run to ${workspace3}`;
|
|
202342
202668
|
}
|
|
202343
|
-
var MAX_FAILURES_PER_SCENE, DEFAULT_RUNS_DIR, exitedCleanly, FALLBACK_EXCERPT_CALLS, round4, trialIssues, trialValid, outcomeOf2, CRASH_NOISE, ERROR_LINE, CRASH_LINE_MAX, pct, SUMMARY_GAPS_SHOWN, SUMMARY_ACTIONS_SHOWN, ANSWER_SOURCES, duration8, shellWord, PATTERN_NOTE;
|
|
202669
|
+
var MAX_FAILURES_PER_SCENE, DEFAULT_RUNS_DIR, exitedCleanly, FALLBACK_EXCERPT_CALLS, round4, trialIssues, trialValid, outcomeOf2, CRASH_NOISE, ERROR_LINE, CRASH_LINE_MAX, NEVER_RAN_MS, spaced, pct, SUMMARY_GAPS_SHOWN, SUMMARY_ACTIONS_SHOWN, ANSWER_SOURCES, duration8, shellWord, PATTERN_NOTE;
|
|
202344
202670
|
var init_report2 = __esm({
|
|
202345
202671
|
"backend/src/report.ts"() {
|
|
202346
202672
|
"use strict";
|
|
@@ -202348,6 +202674,8 @@ var init_report2 = __esm({
|
|
|
202348
202674
|
init_harness_issues2();
|
|
202349
202675
|
init_scenes();
|
|
202350
202676
|
init_actions7();
|
|
202677
|
+
init_reproduction_text();
|
|
202678
|
+
init_agent_fix();
|
|
202351
202679
|
init_src();
|
|
202352
202680
|
MAX_FAILURES_PER_SCENE = 20;
|
|
202353
202681
|
DEFAULT_RUNS_DIR = ".ancha/runs";
|
|
@@ -202360,6 +202688,8 @@ var init_report2 = __esm({
|
|
|
202360
202688
|
CRASH_NOISE = /^\s*$|^\s+at\s|^\s*… \d+ more frames$|^\s*[~^]+\s*$|^\s*[{}]\s*$|^Node\.js v\d/;
|
|
202361
202689
|
ERROR_LINE = /error|exception|fatal|panic/i;
|
|
202362
202690
|
CRASH_LINE_MAX = 200;
|
|
202691
|
+
NEVER_RAN_MS = 5e3;
|
|
202692
|
+
spaced = (ms) => ms < 1e3 ? `${ms} ms` : `${(ms / 1e3).toFixed(1)} s`;
|
|
202363
202693
|
pct = (rate) => String(Math.round(rate * 1e3) / 10);
|
|
202364
202694
|
SUMMARY_GAPS_SHOWN = 10;
|
|
202365
202695
|
SUMMARY_ACTIONS_SHOWN = 8;
|
|
@@ -202411,9 +202741,9 @@ function startAgentProcess(command, opts) {
|
|
|
202411
202741
|
graceEnds = performance.now() + KILL_GRACE_MS;
|
|
202412
202742
|
killTimer = setTimeout(() => signalGroup(pid, "SIGKILL"), KILL_GRACE_MS);
|
|
202413
202743
|
};
|
|
202414
|
-
const outcome3 = new Promise((
|
|
202415
|
-
child2.once("error", (error64) =>
|
|
202416
|
-
child2.once("exit", (code2) =>
|
|
202744
|
+
const outcome3 = new Promise((resolve13) => {
|
|
202745
|
+
child2.once("error", (error64) => resolve13({ kind: "error", error: error64 }));
|
|
202746
|
+
child2.once("exit", (code2) => resolve13({ kind: "exit", code: code2 }));
|
|
202417
202747
|
});
|
|
202418
202748
|
const exited = outcome3.then(async (result) => {
|
|
202419
202749
|
try {
|
|
@@ -202496,7 +202826,7 @@ var init_contained_env = __esm({
|
|
|
202496
202826
|
// backend/src/execution/source.ts
|
|
202497
202827
|
import { constants as constants5 } from "node:fs";
|
|
202498
202828
|
import { chmod as chmod2, lstat, mkdir as mkdir3, open as open2, readdir as readdir2, realpath } from "node:fs/promises";
|
|
202499
|
-
import { basename as basename4, dirname as dirname5, isAbsolute as isAbsolute3, join as join9, relative as
|
|
202829
|
+
import { basename as basename4, dirname as dirname5, isAbsolute as isAbsolute3, join as join9, relative as relative4, resolve as resolve8, sep, win32 } from "node:path";
|
|
202500
202830
|
function invalid29(message7) {
|
|
202501
202831
|
return new AnchaError("CONFIG_INVALID", `Cannot stage agent source: ${message7}`, {
|
|
202502
202832
|
hint: "Select only source files or directories. Put Linux dependencies in the runtime image and pass credentials explicitly."
|
|
@@ -202507,7 +202837,7 @@ function excluded(name5) {
|
|
|
202507
202837
|
return lower4.startsWith(".") || EXCLUDED_DIRECTORIES.has(lower4) || EXCLUDED_NAMES.has(lower4) || /\.(?:env|pem|key|p12|pfx|jks|keystore|pyc|pyo)$/.test(lower4);
|
|
202508
202838
|
}
|
|
202509
202839
|
function within(root3, candidate) {
|
|
202510
|
-
const path6 =
|
|
202840
|
+
const path6 = relative4(root3, candidate);
|
|
202511
202841
|
return path6 === "" || path6 !== ".." && !path6.startsWith(`..${sep}`) && !isAbsolute3(path6);
|
|
202512
202842
|
}
|
|
202513
202843
|
function sameFile(a, b) {
|
|
@@ -202539,10 +202869,10 @@ async function stageProject(sourceRoot, selections2, destination, options4 = {})
|
|
|
202539
202869
|
const rootNow = await lstat(source);
|
|
202540
202870
|
if (!sameFile(sourceIdentity, rootNow) || rootNow.isSymbolicLink()) throw invalid29("project directory changed while staging");
|
|
202541
202871
|
const stat2 = await lstat(path6).catch(() => {
|
|
202542
|
-
throw invalid29(`selected source is missing or changed: ${
|
|
202872
|
+
throw invalid29(`selected source is missing or changed: ${relative4(source, path6) || "."}`);
|
|
202543
202873
|
});
|
|
202544
202874
|
if (stat2.isSymbolicLink() || await realpath(path6) !== path6 || !within(source, path6)) {
|
|
202545
|
-
throw invalid29(`symlinks are not allowed: ${
|
|
202875
|
+
throw invalid29(`symlinks are not allowed: ${relative4(source, path6) || "."}`);
|
|
202546
202876
|
}
|
|
202547
202877
|
return stat2;
|
|
202548
202878
|
}
|
|
@@ -202566,7 +202896,7 @@ async function stageProject(sourceRoot, selections2, destination, options4 = {})
|
|
|
202566
202896
|
async function destinationDirectory(path6) {
|
|
202567
202897
|
if (!within(target4, path6)) throw invalid29("staging destination escaped its root");
|
|
202568
202898
|
if (!sameFile(targetIdentity, await lstat(target4)) || await realpath(target4) !== target4) throw invalid29("staging destination changed");
|
|
202569
|
-
const parts3 =
|
|
202899
|
+
const parts3 = relative4(target4, path6).split(sep).filter(Boolean);
|
|
202570
202900
|
let current = target4;
|
|
202571
202901
|
for (const part of parts3) {
|
|
202572
202902
|
current = join9(current, part);
|
|
@@ -202597,7 +202927,7 @@ async function stageProject(sourceRoot, selections2, destination, options4 = {})
|
|
|
202597
202927
|
return;
|
|
202598
202928
|
}
|
|
202599
202929
|
if (excludedPaths.has(path6)) return;
|
|
202600
|
-
const name5 =
|
|
202930
|
+
const name5 = relative4(source, path6);
|
|
202601
202931
|
if (!stat2.isFile()) throw invalid29(`only regular files are supported: ${name5}`);
|
|
202602
202932
|
if (stat2.nlink !== 1) throw invalid29(`hard-linked source files are not allowed: ${name5}`);
|
|
202603
202933
|
if (files2 + 1 > MAX_FILES) throw invalid29(`source exceeds ${MAX_FILES} files`);
|
|
@@ -202705,14 +203035,14 @@ function attachIsolationRelay(options4) {
|
|
|
202705
203035
|
const channels = /* @__PURE__ */ new Map();
|
|
202706
203036
|
let ended = false, readySeen = false, buffer = "", counter = 0;
|
|
202707
203037
|
let resolveReady, rejectReady, resolveClosed;
|
|
202708
|
-
const peerReady = new Promise((
|
|
202709
|
-
resolveReady =
|
|
203038
|
+
const peerReady = new Promise((resolve13, reject3) => {
|
|
203039
|
+
resolveReady = resolve13;
|
|
202710
203040
|
rejectReady = reject3;
|
|
202711
203041
|
});
|
|
202712
203042
|
void peerReady.catch(() => {
|
|
202713
203043
|
});
|
|
202714
|
-
const closed = new Promise((
|
|
202715
|
-
resolveClosed =
|
|
203044
|
+
const closed = new Promise((resolve13) => {
|
|
203045
|
+
resolveClosed = resolve13;
|
|
202716
203046
|
});
|
|
202717
203047
|
const forward = options4.forwardPort === void 0 ? void 0 : createServer2({ allowHalfOpen: true });
|
|
202718
203048
|
let closing;
|
|
@@ -202729,9 +203059,9 @@ function attachIsolationRelay(options4) {
|
|
|
202729
203059
|
}
|
|
202730
203060
|
channels.clear();
|
|
202731
203061
|
options4.output.end();
|
|
202732
|
-
closing = new Promise((
|
|
202733
|
-
if (forward?.listening) forward.close(() =>
|
|
202734
|
-
else
|
|
203062
|
+
closing = new Promise((resolve13) => {
|
|
203063
|
+
if (forward?.listening) forward.close(() => resolve13());
|
|
203064
|
+
else resolve13();
|
|
202735
203065
|
}).finally(resolveClosed);
|
|
202736
203066
|
}
|
|
202737
203067
|
function send2(frame2) {
|
|
@@ -202859,9 +203189,9 @@ function attachIsolationRelay(options4) {
|
|
|
202859
203189
|
options4.output.once("close", () => fail6());
|
|
202860
203190
|
options4.signal?.addEventListener("abort", abort, { once: true });
|
|
202861
203191
|
if (options4.signal?.aborted) abort();
|
|
202862
|
-
const forwardReady = new Promise((
|
|
203192
|
+
const forwardReady = new Promise((resolve13, reject3) => {
|
|
202863
203193
|
if (!forward || ended) {
|
|
202864
|
-
|
|
203194
|
+
resolve13();
|
|
202865
203195
|
return;
|
|
202866
203196
|
}
|
|
202867
203197
|
forward.on("connection", (socket) => {
|
|
@@ -202880,7 +203210,7 @@ function attachIsolationRelay(options4) {
|
|
|
202880
203210
|
});
|
|
202881
203211
|
forward.listen(options4.forwardPort, "127.0.0.1", () => {
|
|
202882
203212
|
if (ended) forward.close();
|
|
202883
|
-
|
|
203213
|
+
resolve13();
|
|
202884
203214
|
});
|
|
202885
203215
|
});
|
|
202886
203216
|
const ready3 = Promise.all([peerReady, forwardReady]).then(() => {
|
|
@@ -203063,7 +203393,7 @@ async function preflightExecution(agent, scenes = [], signal) {
|
|
|
203063
203393
|
if (agent.slackTransport === "socket") throw new AnchaError("CONFIG_INVALID", "Contained Slack Socket Mode is not qualified yet; use the event feed or managed HTTP delivery");
|
|
203064
203394
|
if (scenes.some((scene2) => scene2.twins.includes("google-ads"))) throw new AnchaError("CONFIG_INVALID", "Contained Google Ads gRPC is not qualified yet; this run cannot use a host-process fallback");
|
|
203065
203395
|
const status4 = await executionRuntimeStatus();
|
|
203066
|
-
if (!status4.available) throw new AnchaError("AGENT_UNREACHABLE", status4.message, { hint: "Run ancha execution doctor
|
|
203396
|
+
if (!status4.available) throw new AnchaError("AGENT_UNREACHABLE", status4.message, { hint: "Run ancha execution doctor. Container execution never falls back to a host process." });
|
|
203067
203397
|
await inspectImage(policy.image, status4.context, signal);
|
|
203068
203398
|
await inspectImage(RELAY_IMAGE, status4.context, signal);
|
|
203069
203399
|
}
|
|
@@ -203140,7 +203470,7 @@ async function startContainedAgent(command, opts) {
|
|
|
203140
203470
|
failures.push("gateway");
|
|
203141
203471
|
}
|
|
203142
203472
|
await rm(temporary, { force: true, recursive: true });
|
|
203143
|
-
if (failures.length) throw new AnchaError("INTERNAL", `Container cleanup incomplete: ${failures.join(", ")}`, { hint: "Inspect ancha execution list
|
|
203473
|
+
if (failures.length) throw new AnchaError("INTERNAL", `Container cleanup incomplete: ${failures.join(", ")}`, { hint: "Inspect ancha execution list before starting another run." });
|
|
203144
203474
|
})();
|
|
203145
203475
|
const abort = () => {
|
|
203146
203476
|
void cleanup().catch(() => {
|
|
@@ -203153,11 +203483,16 @@ async function startContainedAgent(command, opts) {
|
|
|
203153
203483
|
await mkdir4(join10(temporary, "project", ".ancha-records"), { recursive: true });
|
|
203154
203484
|
await copyFile2(records3, join10(temporary, "project", CONTAINER_RECORDS));
|
|
203155
203485
|
}
|
|
203486
|
+
const withTask = opts.agent.mode !== "endpoint";
|
|
203487
|
+
if (withTask) {
|
|
203488
|
+
await mkdir4(join10(temporary, "project", ".ancha-task"), { recursive: true });
|
|
203489
|
+
await writeFile6(join10(temporary, "project", CONTAINER_TASK), agentTask(opts.scene, opts.runtime));
|
|
203490
|
+
}
|
|
203156
203491
|
startup2.throwIfAborted();
|
|
203157
203492
|
createdVolume = true;
|
|
203158
|
-
await run4(["volume", "create", "--label", `${
|
|
203493
|
+
await run4(["volume", "create", "--label", `${LABEL2}=true`, volume]);
|
|
203159
203494
|
containers.add(helperName);
|
|
203160
|
-
await run4(["create", "--name", helperName, "--label", `${
|
|
203495
|
+
await run4(["create", "--name", helperName, "--label", `${LABEL2}=true`, "--network", "none", "--cap-drop", "ALL", "--security-opt", "no-new-privileges=true", "--mount", `type=volume,source=${volume},target=/workspace`, "--entrypoint", "/bin/sh", relayImage.id, "-c", "find /workspace -type d -exec chmod 755 {} +; find /workspace -type f -exec chmod a+r {} +; ln -s /opt/ancha/node_modules /workspace/node_modules"]);
|
|
203161
203496
|
await run4(["cp", join10(temporary, "project") + "/.", `${helperName}:/workspace`]);
|
|
203162
203497
|
await run4(["start", "-a", helperName]);
|
|
203163
203498
|
await run4(["rm", helperName]);
|
|
@@ -203170,7 +203505,7 @@ async function startContainedAgent(command, opts) {
|
|
|
203170
203505
|
"--name",
|
|
203171
203506
|
agentName,
|
|
203172
203507
|
"--label",
|
|
203173
|
-
`${
|
|
203508
|
+
`${LABEL2}=true`,
|
|
203174
203509
|
"--network",
|
|
203175
203510
|
"none",
|
|
203176
203511
|
...hardening,
|
|
@@ -203197,7 +203532,7 @@ async function startContainedAgent(command, opts) {
|
|
|
203197
203532
|
"--name",
|
|
203198
203533
|
relayName,
|
|
203199
203534
|
"--label",
|
|
203200
|
-
`${
|
|
203535
|
+
`${LABEL2}=true`,
|
|
203201
203536
|
"--network",
|
|
203202
203537
|
`container:${agentName}`,
|
|
203203
203538
|
"--cap-drop",
|
|
@@ -203239,7 +203574,7 @@ async function startContainedAgent(command, opts) {
|
|
|
203239
203574
|
startup2.throwIfAborted();
|
|
203240
203575
|
const mapped = gateway.rewrite(`http://127.0.0.1:${RELAY_PORT}`);
|
|
203241
203576
|
const allowed2 = explicitEnvironment(policy.env, opts.inheritedEnv);
|
|
203242
|
-
const runtime2 = { ...opts.runtime, ...opts.runtime?.attempt && { attempt: { ...opts.runtime.attempt, stateDir: "/state", records: records3 === void 0 ? void 0 : `/workspace/${CONTAINER_RECORDS}` } } };
|
|
203577
|
+
const runtime2 = { ...opts.runtime, ...withTask && { taskFile: `/workspace/${CONTAINER_TASK}` }, ...opts.runtime?.attempt && { attempt: { ...opts.runtime.attempt, stateDir: "/state", records: records3 === void 0 ? void 0 : `/workspace/${CONTAINER_RECORDS}` } } };
|
|
203243
203578
|
const values2 = containedEnvironment({ ...opts, secretValues: opts.inheritedEnv, policy, mapped, runtime: runtime2, paths: { path: image2.path, home: "/home/ancha", tmp: "/tmp", state: "/state" } });
|
|
203244
203579
|
const names5 = Object.keys(values2);
|
|
203245
203580
|
if (names5.some((name5) => !/^[A-Za-z_][A-Za-z0-9_]*$/.test(name5))) throw new AnchaError("CONFIG_INVALID", "Invalid agent environment variable name");
|
|
@@ -203291,9 +203626,9 @@ async function startContainedAgent(command, opts) {
|
|
|
203291
203626
|
});
|
|
203292
203627
|
}
|
|
203293
203628
|
});
|
|
203294
|
-
const outcome3 = new Promise((
|
|
203295
|
-
child2.once("error", (error64) =>
|
|
203296
|
-
child2.once("close", (code2) =>
|
|
203629
|
+
const outcome3 = new Promise((resolve13) => {
|
|
203630
|
+
child2.once("error", (error64) => resolve13({ kind: "error", error: error64 }));
|
|
203631
|
+
child2.once("close", (code2) => resolve13(bridgeFailed ? { kind: "error", error: new Error("Container bridge failed or agent output exceeded 8 MiB") } : { kind: "exit", code: code2 }));
|
|
203297
203632
|
});
|
|
203298
203633
|
const exited = outcome3.then(async (result) => {
|
|
203299
203634
|
try {
|
|
@@ -203316,11 +203651,12 @@ async function startContainedAgent(command, opts) {
|
|
|
203316
203651
|
throw error64;
|
|
203317
203652
|
}
|
|
203318
203653
|
}
|
|
203319
|
-
var exec, RELAY_IMAGE, RELAY_PORT, LOG_LIMIT,
|
|
203654
|
+
var exec, RELAY_IMAGE, RELAY_PORT, LOG_LIMIT, LABEL2, CONTAINER_RECORDS, CONTAINER_TASK;
|
|
203320
203655
|
var init_docker = __esm({
|
|
203321
203656
|
"backend/src/execution/docker.ts"() {
|
|
203322
203657
|
"use strict";
|
|
203323
203658
|
init_src();
|
|
203659
|
+
init_agent_env();
|
|
203324
203660
|
init_contained_env();
|
|
203325
203661
|
init_runtime3();
|
|
203326
203662
|
init_policy();
|
|
@@ -203332,8 +203668,9 @@ var init_docker = __esm({
|
|
|
203332
203668
|
RELAY_IMAGE = "node:24-slim";
|
|
203333
203669
|
RELAY_PORT = 18991;
|
|
203334
203670
|
LOG_LIMIT = 8 * 1024 * 1024;
|
|
203335
|
-
|
|
203671
|
+
LABEL2 = "dev.ancha.execution";
|
|
203336
203672
|
CONTAINER_RECORDS = ".ancha-records/records.jsonl";
|
|
203673
|
+
CONTAINER_TASK = ".ancha-task/task.txt";
|
|
203337
203674
|
}
|
|
203338
203675
|
});
|
|
203339
203676
|
|
|
@@ -203478,9 +203815,17 @@ async function startVmAgent(command, opts, deps = {}) {
|
|
|
203478
203815
|
await chmod3(records3, 292);
|
|
203479
203816
|
await chmod3(directory, 457);
|
|
203480
203817
|
}
|
|
203818
|
+
let taskFile;
|
|
203819
|
+
if (opts.agent.mode !== "endpoint") {
|
|
203820
|
+
const directory = await mkdtemp2(join11(paths2.root, "task-"));
|
|
203821
|
+
taskFile = join11(directory, "task.txt");
|
|
203822
|
+
await writeFile7(taskFile, agentTask(opts.scene, opts.runtime), { mode: 292 });
|
|
203823
|
+
await chmod3(taskFile, 292);
|
|
203824
|
+
await chmod3(directory, 457);
|
|
203825
|
+
}
|
|
203481
203826
|
gateway = await (deps.gateway ?? startIsolationGateway)({ env: opts.env, ...opts.session && { session: opts.session }, modelHosts, port: unsafe ? 0 : 18991 });
|
|
203482
203827
|
const mapped = gateway.rewrite(unsafe ? gateway.url : VM_GATEWAY_ORIGIN);
|
|
203483
|
-
const agentRuntime = { ...opts.runtime, ...opts.runtime?.attempt && { attempt: { ...opts.runtime.attempt, stateDir: paths2.state, records: records3 } } };
|
|
203828
|
+
const agentRuntime = { ...opts.runtime, ...taskFile !== void 0 && { taskFile }, ...opts.runtime?.attempt && { attempt: { ...opts.runtime.attempt, stateDir: paths2.state, records: records3 } } };
|
|
203484
203829
|
const values2 = containedEnvironment({
|
|
203485
203830
|
...opts,
|
|
203486
203831
|
secretValues: descriptor2.secretValues,
|
|
@@ -203530,10 +203875,10 @@ async function startVmAgent(command, opts, deps = {}) {
|
|
|
203530
203875
|
};
|
|
203531
203876
|
child2.stdout?.on("data", log2);
|
|
203532
203877
|
child2.stderr?.on("data", log2);
|
|
203533
|
-
const closed = new Promise((
|
|
203534
|
-
const outcome3 = new Promise((
|
|
203535
|
-
child2.once("error", () =>
|
|
203536
|
-
child2.once("exit", (code2) =>
|
|
203878
|
+
const closed = new Promise((resolve13) => child2.once("close", () => resolve13()));
|
|
203879
|
+
const outcome3 = new Promise((resolve13) => {
|
|
203880
|
+
child2.once("error", () => resolve13({ kind: "error", error: new AnchaError("AGENT_UNREACHABLE", "The agent process could not be started.") }));
|
|
203881
|
+
child2.once("exit", (code2) => resolve13({ kind: "exit", code: code2 }));
|
|
203537
203882
|
});
|
|
203538
203883
|
const exited = outcome3.then(async (result) => {
|
|
203539
203884
|
try {
|
|
@@ -203548,7 +203893,7 @@ async function startVmAgent(command, opts, deps = {}) {
|
|
|
203548
203893
|
void exited.catch(() => {
|
|
203549
203894
|
});
|
|
203550
203895
|
const startup2 = AbortSignal.any([AbortSignal.timeout(1e4), ...opts.signal ? [opts.signal] : [], ...opts.startupSignal ? [opts.startupSignal] : []]);
|
|
203551
|
-
await new Promise((
|
|
203896
|
+
await new Promise((resolve13, reject3) => {
|
|
203552
203897
|
const pipe2 = unsafe ? void 0 : child2.stdio[3];
|
|
203553
203898
|
let received = "";
|
|
203554
203899
|
const remove5 = () => {
|
|
@@ -203560,7 +203905,7 @@ async function startVmAgent(command, opts, deps = {}) {
|
|
|
203560
203905
|
};
|
|
203561
203906
|
const ready3 = () => {
|
|
203562
203907
|
remove5();
|
|
203563
|
-
|
|
203908
|
+
resolve13();
|
|
203564
203909
|
};
|
|
203565
203910
|
const failed = () => {
|
|
203566
203911
|
remove5();
|
|
@@ -203604,6 +203949,7 @@ var init_vm = __esm({
|
|
|
203604
203949
|
"backend/src/execution/vm.ts"() {
|
|
203605
203950
|
"use strict";
|
|
203606
203951
|
init_src();
|
|
203952
|
+
init_agent_env();
|
|
203607
203953
|
init_contained_env();
|
|
203608
203954
|
init_gateway();
|
|
203609
203955
|
init_runtime3();
|
|
@@ -203616,17 +203962,26 @@ var init_vm = __esm({
|
|
|
203616
203962
|
});
|
|
203617
203963
|
|
|
203618
203964
|
// backend/src/execution/launch.ts
|
|
203965
|
+
import { writeFile as writeFile8 } from "node:fs/promises";
|
|
203966
|
+
import { resolve as resolve9 } from "node:path";
|
|
203619
203967
|
async function launchAgent(command, opts) {
|
|
203620
203968
|
const runtime2 = trustedRuntime();
|
|
203621
203969
|
if (runtime2 === "fly-vm" || runtime2 === "unsafe-local") return startVmAgent(command, opts);
|
|
203622
203970
|
if (opts.agent.execution?.mode === "container") return startContainedAgent(command, opts);
|
|
203971
|
+
let agentRuntime = opts.runtime;
|
|
203972
|
+
if (opts.agent.mode !== "endpoint") {
|
|
203973
|
+
const taskFile = resolve9(opts.dir, TASK_FILE);
|
|
203974
|
+
await writeFile8(taskFile, agentTask(opts.scene, opts.runtime), { mode: 384 });
|
|
203975
|
+
agentRuntime = { ...opts.runtime, taskFile };
|
|
203976
|
+
}
|
|
203623
203977
|
return startAgentProcess(command, {
|
|
203624
203978
|
cwd: opts.agent.cwd,
|
|
203625
|
-
env: agentEnv(opts.env, opts.scene, opts.agent, opts.trial, hostEnvironment(opts.inheritedEnv, opts.agent).env, opts.session,
|
|
203979
|
+
env: agentEnv(opts.env, opts.scene, opts.agent, opts.trial, hostEnvironment(opts.inheritedEnv, opts.agent).env, opts.session, agentRuntime),
|
|
203626
203980
|
logFd: opts.logFd,
|
|
203627
203981
|
signal: opts.signal
|
|
203628
203982
|
});
|
|
203629
203983
|
}
|
|
203984
|
+
var TASK_FILE;
|
|
203630
203985
|
var init_launch = __esm({
|
|
203631
203986
|
"backend/src/execution/launch.ts"() {
|
|
203632
203987
|
"use strict";
|
|
@@ -203635,11 +203990,12 @@ var init_launch = __esm({
|
|
|
203635
203990
|
init_docker();
|
|
203636
203991
|
init_runtime3();
|
|
203637
203992
|
init_vm();
|
|
203993
|
+
TASK_FILE = "task.txt";
|
|
203638
203994
|
}
|
|
203639
203995
|
});
|
|
203640
203996
|
|
|
203641
203997
|
// backend/src/runner/artifacts.ts
|
|
203642
|
-
import { open as open3, writeFile as
|
|
203998
|
+
import { open as open3, writeFile as writeFile9 } from "node:fs/promises";
|
|
203643
203999
|
import { join as join12 } from "node:path";
|
|
203644
204000
|
async function logTail2(path6) {
|
|
203645
204001
|
const file3 = await open3(path6, "r");
|
|
@@ -203677,23 +204033,23 @@ async function captureTrial(backend, envId, sessionId, dir, scene2, judge = {},
|
|
|
203677
204033
|
const capture3 = await evaluateJudges(scene2, frozen, judge);
|
|
203678
204034
|
onCaptured?.(capture3);
|
|
203679
204035
|
await Promise.all([
|
|
203680
|
-
|
|
204036
|
+
writeFile9(join12(dir, "trace.jsonl"), capture3.trace.map((e) => `${JSON.stringify(e)}
|
|
203681
204037
|
`).join("")),
|
|
203682
|
-
|
|
204038
|
+
writeFile9(join12(dir, "state.json"), `${JSON.stringify(capture3.state, null, 2)}
|
|
203683
204039
|
`),
|
|
203684
|
-
|
|
204040
|
+
writeFile9(join12(dir, "checks.json"), `${JSON.stringify(capture3.checks, null, 2)}
|
|
203685
204041
|
`),
|
|
203686
204042
|
// Every people-model call, in order: who, what kind, which model, hashes, tokens, cost and the answer. No credentials.
|
|
203687
|
-
...capture3.people?.length ? [
|
|
204043
|
+
...capture3.people?.length ? [writeFile9(join12(dir, "people.jsonl"), capture3.people.map((record11) => `${JSON.stringify(record11)}
|
|
203688
204044
|
`).join(""))] : [],
|
|
203689
204045
|
// A replay: how many answers came from the recording, how many live, and where it first diverged.
|
|
203690
|
-
...capture3.peopleReplay ? [
|
|
204046
|
+
...capture3.peopleReplay ? [writeFile9(join12(dir, "people-replay.json"), `${JSON.stringify(capture3.peopleReplay, null, 2)}
|
|
203691
204047
|
`)] : [],
|
|
203692
204048
|
// What passed between the agent and people, for the console; fact ids only, never values.
|
|
203693
|
-
...capture3.peopleTimeline ? [
|
|
204049
|
+
...capture3.peopleTimeline ? [writeFile9(join12(dir, "people-timeline.json"), `${JSON.stringify(capture3.peopleTimeline, null, 2)}
|
|
203694
204050
|
`)] : [],
|
|
203695
204051
|
// Why each failed check failed, from the world's records (explain v2).
|
|
203696
|
-
...capture3.explanations?.length ? [
|
|
204052
|
+
...capture3.explanations?.length ? [writeFile9(join12(dir, "explain.json"), `${JSON.stringify(capture3.explanations, null, 2)}
|
|
203697
204053
|
`)] : []
|
|
203698
204054
|
]);
|
|
203699
204055
|
return capture3;
|
|
@@ -203737,7 +204093,7 @@ var init_budget = __esm({
|
|
|
203737
204093
|
import { closeSync as closeSync2, openSync as openSync2, writeSync as writeSync3 } from "node:fs";
|
|
203738
204094
|
import { mkdir as mkdir6 } from "node:fs/promises";
|
|
203739
204095
|
import { createServer as createServer3 } from "node:net";
|
|
203740
|
-
import { join as join13, resolve as
|
|
204096
|
+
import { join as join13, resolve as resolve10 } from "node:path";
|
|
203741
204097
|
import { setTimeout as sleep6 } from "node:timers/promises";
|
|
203742
204098
|
function deadline2(ms) {
|
|
203743
204099
|
const controller = new AbortController();
|
|
@@ -203766,13 +204122,13 @@ async function abortable(promise2, signal) {
|
|
|
203766
204122
|
}
|
|
203767
204123
|
async function reservePort(used) {
|
|
203768
204124
|
const rejected = [];
|
|
203769
|
-
const close = (server) => new Promise((
|
|
204125
|
+
const close = (server) => new Promise((resolve13, reject3) => server.close((error64) => error64 ? reject3(error64) : resolve13()));
|
|
203770
204126
|
try {
|
|
203771
204127
|
for (; ; ) {
|
|
203772
204128
|
const socket = createServer3();
|
|
203773
|
-
await new Promise((
|
|
204129
|
+
await new Promise((resolve13, reject3) => {
|
|
203774
204130
|
socket.once("error", reject3);
|
|
203775
|
-
socket.listen(0, "127.0.0.1",
|
|
204131
|
+
socket.listen(0, "127.0.0.1", resolve13);
|
|
203776
204132
|
});
|
|
203777
204133
|
const address8 = socket.address();
|
|
203778
204134
|
if (address8 === null || typeof address8 === "string") {
|
|
@@ -203850,7 +204206,7 @@ async function runEndpointTrial(spec) {
|
|
|
203850
204206
|
const port = agent.start !== void 0 ? await reservePort(spec.reservedPorts ?? /* @__PURE__ */ new Set()) : void 0;
|
|
203851
204207
|
let released = false;
|
|
203852
204208
|
try {
|
|
203853
|
-
const clockFile = agent.clock === "node" ?
|
|
204209
|
+
const clockFile = agent.clock === "node" ? resolve10(dir, "clock.json") : void 0;
|
|
203854
204210
|
const session2 = await backend.prepareTrial(env.id, { mode: "endpoint", idleMs: agent.idleMs, slackTransport: agent.slackTransport ?? "http", ...agent.setupCalls && { setupCalls: true }, ...clockFile && { clockFile }, ...agent.execution?.mode === "container" && { clientOrigin: "http://127.0.0.1:18991" } });
|
|
203855
204211
|
const runtime2 = { ...port && { port: port.port }, ...spec.attempt && { attempt: spec.attempt } };
|
|
203856
204212
|
const vars = agentTemplateVars(env.id, env.services, scene2.task ?? "", trial, session2, runtime2, env.mcp);
|
|
@@ -203993,16 +204349,16 @@ async function reserve(used) {
|
|
|
203993
204349
|
for (let n2 = 0; n2 < 100; n2++) {
|
|
203994
204350
|
const server = createServer4();
|
|
203995
204351
|
held.push(server);
|
|
203996
|
-
await new Promise((
|
|
204352
|
+
await new Promise((resolve13, reject3) => {
|
|
203997
204353
|
server.once("error", reject3);
|
|
203998
|
-
server.listen(0, "127.0.0.1",
|
|
204354
|
+
server.listen(0, "127.0.0.1", resolve13);
|
|
203999
204355
|
});
|
|
204000
204356
|
const address8 = server.address();
|
|
204001
204357
|
if (!address8 || typeof address8 === "string") throw new Error("local agent port unavailable");
|
|
204002
204358
|
if (used.has(address8.port)) continue;
|
|
204003
204359
|
used.add(address8.port);
|
|
204004
204360
|
chosen = true;
|
|
204005
|
-
return { port: address8.port, release: () => new Promise((
|
|
204361
|
+
return { port: address8.port, release: () => new Promise((resolve13, reject3) => server.close((error64) => error64 ? reject3(error64) : resolve13())) };
|
|
204006
204362
|
}
|
|
204007
204363
|
throw new Error("fresh local agent port unavailable");
|
|
204008
204364
|
} finally {
|
|
@@ -204522,8 +204878,8 @@ var init_invalid_trial = __esm({
|
|
|
204522
204878
|
|
|
204523
204879
|
// backend/src/runner/run.ts
|
|
204524
204880
|
import { createHash as createHash55, randomInt } from "node:crypto";
|
|
204525
|
-
import { access as access3, mkdir as mkdir11, readFile as readFile8, writeFile as
|
|
204526
|
-
import { dirname as dirname7, join as join18, relative as
|
|
204881
|
+
import { access as access3, mkdir as mkdir11, readFile as readFile8, writeFile as writeFile10 } from "node:fs/promises";
|
|
204882
|
+
import { dirname as dirname7, join as join18, relative as relative5, resolve as resolve11 } from "node:path";
|
|
204527
204883
|
function interrupted(dir) {
|
|
204528
204884
|
return new AnchaError("USAGE", "run interrupted", dir === void 0 ? {} : { hint: `partial results in ${dir}` });
|
|
204529
204885
|
}
|
|
@@ -204535,11 +204891,11 @@ function newRunId(now11) {
|
|
|
204535
204891
|
}
|
|
204536
204892
|
async function recordsFor(scenePath, root3 = process.cwd()) {
|
|
204537
204893
|
if (scenePath === void 0) return void 0;
|
|
204538
|
-
const top =
|
|
204539
|
-
for (let dir = dirname7(
|
|
204894
|
+
const top = resolve11(root3);
|
|
204895
|
+
for (let dir = dirname7(resolve11(top, scenePath)); ; dir = dirname7(dir)) {
|
|
204540
204896
|
const file3 = join18(dir, "records.jsonl");
|
|
204541
204897
|
if (await access3(file3).then(() => true, () => false)) return file3;
|
|
204542
|
-
if (dir === top ||
|
|
204898
|
+
if (dir === top || relative5(top, dir).startsWith("..") || dirname7(dir) === dir) return void 0;
|
|
204543
204899
|
}
|
|
204544
204900
|
}
|
|
204545
204901
|
async function createEnvFor(backend, scene2, seed43, path6, people3) {
|
|
@@ -204547,7 +204903,7 @@ async function createEnvFor(backend, scene2, seed43, path6, people3) {
|
|
|
204547
204903
|
return await backend.createEnv(scene2, seed43, { paused: true, ...people3 !== void 0 && { people: people3 } });
|
|
204548
204904
|
} catch (e) {
|
|
204549
204905
|
if (!(e instanceof AnchaError)) throw e;
|
|
204550
|
-
const where2 = path6 === void 0 ? `
|
|
204906
|
+
const where2 = path6 === void 0 ? `test ${scene2.id}` : `test ${scene2.id} (${path6})`;
|
|
204551
204907
|
throw new AnchaError(e.code, `${where2}: ${e.message}`, {
|
|
204552
204908
|
...e.hint !== void 0 && { hint: e.hint },
|
|
204553
204909
|
...e.docs !== void 0 && { docs: e.docs },
|
|
@@ -204584,7 +204940,7 @@ async function executeRun(opts) {
|
|
|
204584
204940
|
for (const scene2 of scenes) validateAgentEnv(scene2, agent);
|
|
204585
204941
|
} else {
|
|
204586
204942
|
const calling = scenes.find((scene2) => scene2.world_rules?.app_calls?.length);
|
|
204587
|
-
if (calling) throw new AnchaError("CONFIG_INVALID", `
|
|
204943
|
+
if (calling) throw new AnchaError("CONFIG_INVALID", `test ${calling.id} has app_calls, which need an app Ancha can call: set agent.url (and agent.start for an app Ancha starts)`);
|
|
204588
204944
|
}
|
|
204589
204945
|
const ids2 = cases.map((item2) => item2.id);
|
|
204590
204946
|
const duplicate2 = ids2.find((id14, i) => ids2.indexOf(id14) !== i);
|
|
@@ -204686,7 +205042,7 @@ async function executeRun(opts) {
|
|
|
204686
205042
|
try {
|
|
204687
205043
|
await mkdir11(outDir, { recursive: true });
|
|
204688
205044
|
await mkdir11(dir);
|
|
204689
|
-
await
|
|
205045
|
+
await writeFile10(join18(dir, "inputs.json"), `${JSON.stringify({
|
|
204690
205046
|
schemaVersion: 1,
|
|
204691
205047
|
cases: frozen.map((value4, index) => ({ ...value4, scene: cases[index].scene })),
|
|
204692
205048
|
// Names only, never values: what a later `ancha runs upload` redacts (hosting spec §3.1).
|
|
@@ -204700,7 +205056,7 @@ async function executeRun(opts) {
|
|
|
204700
205056
|
if (source === void 0) continue;
|
|
204701
205057
|
const text24 = await readFile8(source), copy = join18(dir, "records", `${index}.jsonl`);
|
|
204702
205058
|
await mkdir11(dirname7(copy), { recursive: true });
|
|
204703
|
-
await
|
|
205059
|
+
await writeFile10(copy, text24, { flag: "wx", mode: 384 });
|
|
204704
205060
|
kept.set(item2.id, copy);
|
|
204705
205061
|
results.get(item2.id).records = createHash55("sha256").update(text24).digest("hex");
|
|
204706
205062
|
}
|
|
@@ -204712,7 +205068,7 @@ async function executeRun(opts) {
|
|
|
204712
205068
|
const trial = Math.floor(index / cases.length) + 1 + trialOffset;
|
|
204713
205069
|
const trialDir = join18(dir, `trial-${item2.id}-${trial}`);
|
|
204714
205070
|
const records3 = kept.get(item2.id);
|
|
204715
|
-
const attempt = { id: `${runId}/${item2.id}/${trial}`, caseId: item2.id, stateDir:
|
|
205071
|
+
const attempt = { id: `${runId}/${item2.id}/${trial}`, caseId: item2.id, stateDir: resolve11(trialDir, "agent-state"), seed: seedOf(item2), ...records3 !== void 0 && { records: records3 }, ...opts.recordsDiagnostic && { recordsDiagnostic: { ...opts.recordsDiagnostic, attempt: trial } } };
|
|
204716
205072
|
const startedAt2 = performance.now();
|
|
204717
205073
|
const attemptCancellation = new AbortController();
|
|
204718
205074
|
const attemptSignal = AbortSignal.any([runningSignal, attemptCancellation.signal]);
|
|
@@ -204788,7 +205144,7 @@ async function executeRun(opts) {
|
|
|
204788
205144
|
}
|
|
204789
205145
|
finished++;
|
|
204790
205146
|
results.get(item2.id).trials.push(result);
|
|
204791
|
-
await
|
|
205147
|
+
await writeFile10(join18(trialDir, "result.json"), `${JSON.stringify({ ...result, trace: void 0 }, null, 2)}
|
|
204792
205148
|
`, { flag: "wx", mode: 384 });
|
|
204793
205149
|
onEvent?.({
|
|
204794
205150
|
event: "trial_finished",
|
|
@@ -204855,9 +205211,9 @@ var init_run_store = __esm({
|
|
|
204855
205211
|
// backend/src/baselines.ts
|
|
204856
205212
|
function validateTrialCounts(scene2) {
|
|
204857
205213
|
if (!Number.isSafeInteger(scene2.passed) || !Number.isSafeInteger(scene2.trials) || scene2.trials <= 0 || scene2.passed < 0 || scene2.passed > scene2.trials) {
|
|
204858
|
-
throw new AnchaError("USAGE", `invalid passed/trial counts for
|
|
205214
|
+
throw new AnchaError("USAGE", `invalid passed/trial counts for test ${scene2.sceneId}`);
|
|
204859
205215
|
}
|
|
204860
|
-
if (!Number.isFinite(scene2.passRate) || scene2.passRate < 0 || scene2.passRate > 1) throw new AnchaError("USAGE", `invalid pass rate for
|
|
205216
|
+
if (!Number.isFinite(scene2.passRate) || scene2.passRate < 0 || scene2.passRate > 1) throw new AnchaError("USAGE", `invalid pass rate for test ${scene2.sceneId}`);
|
|
204861
205217
|
}
|
|
204862
205218
|
function assertComparableSummaries(current, baseline) {
|
|
204863
205219
|
try {
|
|
@@ -204872,12 +205228,12 @@ function assertComparableSummaries(current, baseline) {
|
|
|
204872
205228
|
const ids2 = (s2) => s2.scenes.map((scene2) => scene2.sceneId).sort();
|
|
204873
205229
|
const currentIds = ids2(current), baselineIds = ids2(baseline);
|
|
204874
205230
|
if (new Set(currentIds).size !== currentIds.length || JSON.stringify(currentIds) !== JSON.stringify(baselineIds) || currentIds.length === 0) {
|
|
204875
|
-
throw new AnchaError("USAGE", "comparison requires the same complete
|
|
205231
|
+
throw new AnchaError("USAGE", "comparison requires the same complete set of tests", { hint: "save a fresh baseline after intentional test changes" });
|
|
204876
205232
|
}
|
|
204877
205233
|
for (const id14 of currentIds) {
|
|
204878
205234
|
const before = baseline.sceneFingerprints?.[id14], after = current.sceneFingerprints?.[id14];
|
|
204879
|
-
if (!before || !after || !/^[a-f0-9]{64}$/.test(before) || !/^[a-f0-9]{64}$/.test(after)) throw new AnchaError("USAGE", `unverified
|
|
204880
|
-
if (before !== after) throw new AnchaError("USAGE", `
|
|
205235
|
+
if (!before || !after || !/^[a-f0-9]{64}$/.test(before) || !/^[a-f0-9]{64}$/.test(after)) throw new AnchaError("USAGE", `unverified test fingerprint for ${id14}`, { hint: "legacy summaries can be displayed but need a new run before comparison" });
|
|
205236
|
+
if (before !== after) throw new AnchaError("USAGE", `test fingerprint changed for ${id14} (test, criteria or records differ)`, { hint: "save a fresh baseline after intentional test changes" });
|
|
204881
205237
|
}
|
|
204882
205238
|
for (const id14 of currentIds) {
|
|
204883
205239
|
const before = baseline.caseFingerprints?.[id14], after = current.caseFingerprints?.[id14];
|
|
@@ -204943,7 +205299,7 @@ init_src();
|
|
|
204943
205299
|
|
|
204944
205300
|
// packages/cli/src/commands/run.ts
|
|
204945
205301
|
import { appendFileSync } from "node:fs";
|
|
204946
|
-
import { dirname as dirname8, join as join19, relative as
|
|
205302
|
+
import { dirname as dirname8, join as join19, relative as relative6, resolve as resolve12 } from "node:path";
|
|
204947
205303
|
init_src();
|
|
204948
205304
|
init_run_state();
|
|
204949
205305
|
|
|
@@ -205105,7 +205461,7 @@ function progressLine(e, scenes) {
|
|
|
205105
205461
|
if (e.event === "trace_skipped" && typeof e.trace === "string" && typeof e.reason === "string") return `skipped trace ${e.trace.slice(0, 8)}: ${e.reason}`;
|
|
205106
205462
|
if (e.event === "run_started" && typeof e.runId === "string" && Array.isArray(e.scenes) && typeof e.trials === "number" && typeof e.parallel === "number") {
|
|
205107
205463
|
if (typeof e.replayOf === "string") return `${e.runId}: replay of ${e.replayOf}`;
|
|
205108
|
-
const what = e.scenes.length === 1 ? `${plural4(e.trials, "trial")} of ${String(e.scenes[0])}` : `${plural4(e.trials, "trial")} each of ${e.scenes.length}
|
|
205464
|
+
const what = e.scenes.length === 1 ? `${plural4(e.trials, "trial")} of ${String(e.scenes[0])}` : `${plural4(e.trials, "trial")} each of ${e.scenes.length} tests`;
|
|
205109
205465
|
const total2 = e.trials * e.scenes.length;
|
|
205110
205466
|
return `${e.runId}: ${what}${total2 > 1 ? `, ${Math.min(e.parallel, total2)} at a time` : ""}`;
|
|
205111
205467
|
}
|
|
@@ -205193,6 +205549,10 @@ var Output = class {
|
|
|
205193
205549
|
}
|
|
205194
205550
|
};
|
|
205195
205551
|
|
|
205552
|
+
// packages/cli/src/onboarding.ts
|
|
205553
|
+
init_src();
|
|
205554
|
+
init_credentials();
|
|
205555
|
+
|
|
205196
205556
|
// packages/cli/src/commands/internal-cloud.ts
|
|
205197
205557
|
init_src();
|
|
205198
205558
|
init_config();
|
|
@@ -205219,14 +205579,14 @@ async function interruptible(ctx, fn) {
|
|
|
205219
205579
|
external2?.removeEventListener("abort", stop);
|
|
205220
205580
|
}
|
|
205221
205581
|
}
|
|
205222
|
-
function emitFinished(ctx, summary, out, upload4, uploadHint, reproduction = summary.reproduction ?? []) {
|
|
205223
|
-
|
|
205582
|
+
function emitFinished(ctx, summary, out, upload4, uploadHint, reproduction = summary.reproduction ?? [], tests) {
|
|
205583
|
+
const opts = { out: nonDefaultOut(ctx.io.cwd, out), ...tests !== void 0 && { tests }, cwd: ctx.io.cwd };
|
|
205584
|
+
const never2 = agentNeverRan(summary);
|
|
205585
|
+
if (ctx.out.json) ctx.out.event({ event: "run_finished", summary, next: nextAfterRun(summary, opts), ...upload4 !== void 0 && { upload: upload4 }, ...reproduction.length > 0 && { reproduction }, ...never2 !== void 0 && { agentNeverRan: never2 } });
|
|
205224
205586
|
else ctx.out.result(summary, () => `
|
|
205225
|
-
${renderSummaryText(summary, {
|
|
205226
|
-
${renderReproduction(reproduction)}
|
|
205227
|
-
` : ""}${upload4 !== void 0 && "url" in upload4 ? `
|
|
205587
|
+
${renderSummaryText(summary, { ...opts, reproduction })}${upload4 !== void 0 && "url" in upload4 ? `
|
|
205228
205588
|
uploaded: ${upload4.url}` : ""}${upload4 === void 0 && uploadHint !== void 0 ? `
|
|
205229
|
-
${uploadHintLine(summary.runId, uploadHint, { out:
|
|
205589
|
+
${uploadHintLine(summary.runId, uploadHint, { out: opts.out })}` : ""}`);
|
|
205230
205590
|
}
|
|
205231
205591
|
async function uploadFinished(ctx, input4, runId) {
|
|
205232
205592
|
if (input4.upload === void 0) return void 0;
|
|
@@ -205290,7 +205650,7 @@ async function executePreparedRun(ctx, input4, initial, ready3) {
|
|
|
205290
205650
|
const upload4 = await uploadFinished(ctx, input4, summary.runId);
|
|
205291
205651
|
await writer.finish({ state: "finished", exitCode: ctx.exitCode, ...upload4 !== void 0 && { upload: keptUpload(upload4, summary.runId) } });
|
|
205292
205652
|
if (input4.strict && summary.scenes.some((scene2) => scene2.coverageGaps.length > 0)) ctx.out.info("--strict: endpoint coverage errors are recorded in the summary");
|
|
205293
|
-
emitFinished(ctx, summary, input4.out, upload4, input4.uploadHint);
|
|
205653
|
+
emitFinished(ctx, summary, input4.out, upload4, input4.uploadHint, summary.reproduction ?? [], Object.values(input4.scenePaths));
|
|
205294
205654
|
} catch (error64) {
|
|
205295
205655
|
const code2 = toErrorJson(error64).code;
|
|
205296
205656
|
const interrupted2 = error64 instanceof AnchaError && error64.code === "USAGE" && error64.message === "run interrupted";
|
|
@@ -205324,7 +205684,7 @@ process.once("message", async (message7) => {
|
|
|
205324
205684
|
throw new Error("worker inputs must be prepared");
|
|
205325
205685
|
}, exitCode: 0 };
|
|
205326
205686
|
try {
|
|
205327
|
-
await executePreparedRun(ctx, input4, state3, () => new Promise((
|
|
205687
|
+
await executePreparedRun(ctx, input4, state3, () => new Promise((resolve13, reject3) => {
|
|
205328
205688
|
const timer = setTimeout(() => finish2(new Error("startup acceptance timed out")), 1e4);
|
|
205329
205689
|
const disconnected = () => finish2(new Error("startup parent disconnected before acceptance"));
|
|
205330
205690
|
const accepted = (value4) => {
|
|
@@ -205335,7 +205695,7 @@ process.once("message", async (message7) => {
|
|
|
205335
205695
|
process.off("disconnect", disconnected);
|
|
205336
205696
|
process.off("message", accepted);
|
|
205337
205697
|
if (error64) reject3(error64);
|
|
205338
|
-
else
|
|
205698
|
+
else resolve13();
|
|
205339
205699
|
}
|
|
205340
205700
|
process.once("disconnect", disconnected);
|
|
205341
205701
|
process.on("message", accepted);
|