@preplabsai/rovara-code 0.5.16 → 0.5.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/agentx-cli.mjs +1050 -788
- package/package.json +1 -1
package/bin/agentx-cli.mjs
CHANGED
|
@@ -598,14 +598,14 @@ function codePointLength(str2) {
|
|
|
598
598
|
const units = str2.length;
|
|
599
599
|
if (!highSurrogate.test(str2))
|
|
600
600
|
return units;
|
|
601
|
-
let
|
|
601
|
+
let count10 = units;
|
|
602
602
|
for (let i5 = 0; i5 < units - 1; i5++) {
|
|
603
603
|
if ((str2.charCodeAt(i5) & 64512) === 55296 && (str2.charCodeAt(i5 + 1) & 64512) === 56320) {
|
|
604
|
-
|
|
604
|
+
count10--;
|
|
605
605
|
i5++;
|
|
606
606
|
}
|
|
607
607
|
}
|
|
608
|
-
return
|
|
608
|
+
return count10;
|
|
609
609
|
}
|
|
610
610
|
function getLengthableOrigin(input2) {
|
|
611
611
|
if (Array.isArray(input2))
|
|
@@ -5096,8 +5096,8 @@ var init_az = __esm({
|
|
|
5096
5096
|
});
|
|
5097
5097
|
|
|
5098
5098
|
// node_modules/zod/v4/locales/be.js
|
|
5099
|
-
function getBelarusianPlural(
|
|
5100
|
-
const absCount = Math.abs(
|
|
5099
|
+
function getBelarusianPlural(count10, one, few, many) {
|
|
5100
|
+
const absCount = Math.abs(count10);
|
|
5101
5101
|
const lastDigit = absCount % 10;
|
|
5102
5102
|
const lastTwoDigits = absCount % 100;
|
|
5103
5103
|
if (lastTwoDigits >= 11 && lastTwoDigits <= 19) {
|
|
@@ -7870,8 +7870,8 @@ var init_hu = __esm({
|
|
|
7870
7870
|
});
|
|
7871
7871
|
|
|
7872
7872
|
// node_modules/zod/v4/locales/hy.js
|
|
7873
|
-
function getArmenianPlural(
|
|
7874
|
-
return Math.abs(
|
|
7873
|
+
function getArmenianPlural(count10, one, many) {
|
|
7874
|
+
return Math.abs(count10) === 1 ? one : many;
|
|
7875
7875
|
}
|
|
7876
7876
|
function withDefiniteArticle(word2) {
|
|
7877
7877
|
if (!word2)
|
|
@@ -10746,8 +10746,8 @@ var init_ro = __esm({
|
|
|
10746
10746
|
});
|
|
10747
10747
|
|
|
10748
10748
|
// node_modules/zod/v4/locales/ru.js
|
|
10749
|
-
function getRussianPlural(
|
|
10750
|
-
const absCount = Math.abs(
|
|
10749
|
+
function getRussianPlural(count10, one, few, many) {
|
|
10750
|
+
const absCount = Math.abs(count10);
|
|
10751
10751
|
const lastDigit = absCount % 10;
|
|
10752
10752
|
const lastTwoDigits = absCount % 100;
|
|
10753
10753
|
if (lastTwoDigits >= 11 && lastTwoDigits <= 19) {
|
|
@@ -16234,12 +16234,12 @@ function rewriteKeyNames(ctx) {
|
|
|
16234
16234
|
const rewrites = /* @__PURE__ */ new Map();
|
|
16235
16235
|
for (const record4 of pendingRecords.get(ctx) ?? []) {
|
|
16236
16236
|
const seen = ctx.seen.get(record4);
|
|
16237
|
-
const
|
|
16238
|
-
if (!
|
|
16237
|
+
const names2 = (seen?.def ?? seen?.schema)?.propertyNames;
|
|
16238
|
+
if (!names2 || names2 === true || rewrites.has(names2))
|
|
16239
16239
|
continue;
|
|
16240
|
-
const rewritten = stringifyKeyNames(bySchema,
|
|
16241
|
-
if (rewritten !==
|
|
16242
|
-
rewrites.set(
|
|
16240
|
+
const rewritten = stringifyKeyNames(bySchema, names2, /* @__PURE__ */ new Set());
|
|
16241
|
+
if (rewritten !== names2)
|
|
16242
|
+
rewrites.set(names2, rewritten);
|
|
16243
16243
|
}
|
|
16244
16244
|
if (!rewrites.size)
|
|
16245
16245
|
return;
|
|
@@ -20524,7 +20524,7 @@ function releasePipelineNames(env3, kind = "code") {
|
|
|
20524
20524
|
}
|
|
20525
20525
|
function releasePipelineDenyStatements(scope2) {
|
|
20526
20526
|
const { env: env3, partition: partition5 } = scope2;
|
|
20527
|
-
const
|
|
20527
|
+
const names2 = releasePipelineNames(env3, "*");
|
|
20528
20528
|
const arn = (service, resource) => `arn:${partition5}:${service}:*:*:${resource}`;
|
|
20529
20529
|
return [
|
|
20530
20530
|
{
|
|
@@ -20537,7 +20537,7 @@ function releasePipelineDenyStatements(scope2) {
|
|
|
20537
20537
|
Effect: "Deny",
|
|
20538
20538
|
Action: ["ssm:*", "secretsmanager:*", "s3:*", "codebuild:*", "codepipeline:*", "sns:*", "kms:*", "cloudformation:Create*", "cloudformation:Update*", "cloudformation:Delete*", "cloudformation:Execute*"],
|
|
20539
20539
|
Resource: [
|
|
20540
|
-
arn("ssm", `parameter${
|
|
20540
|
+
arn("ssm", `parameter${names2.parameterPrefix}*`),
|
|
20541
20541
|
arn("secretsmanager", `secret:rovara-release/${env3}/*`),
|
|
20542
20542
|
// VENDOR FIX: IAM refuses a Resource whose SERVICE (third ARN component) is not a literal name ("Resource vendor must be fully qualified and cannot contain regexes"), so the single
|
|
20543
20543
|
// `arn:<partition>:*rovara-<env>-*rel*` this was cannot be created. One ARN per service of the five resources that share the name shape, each as wide as that service's ARN can be.
|
|
@@ -20558,7 +20558,7 @@ function releasePipelineDenyStatements(scope2) {
|
|
|
20558
20558
|
Effect: "Deny",
|
|
20559
20559
|
Action: ["kms:*"],
|
|
20560
20560
|
Resource: "*",
|
|
20561
|
-
Condition: { "ForAnyValue:StringLike": { "kms:ResourceAliases":
|
|
20561
|
+
Condition: { "ForAnyValue:StringLike": { "kms:ResourceAliases": names2.keyAliasPattern } }
|
|
20562
20562
|
}
|
|
20563
20563
|
];
|
|
20564
20564
|
}
|
|
@@ -20616,12 +20616,12 @@ var init_project = __esm({
|
|
|
20616
20616
|
context.addIssue({ code: "custom", path: ["__proto__"], message: "env names must be POSIX environment variable names" });
|
|
20617
20617
|
}
|
|
20618
20618
|
}).pipe(external_exports.record(external_exports.string(), external_exports.string().max(PROJECT_COMMAND_ENV_VALUE_MAX, `env values must be at most ${PROJECT_COMMAND_ENV_VALUE_MAX.toLocaleString("en-US")} characters`).refine((value) => !value.includes("\0"), "env values cannot contain a NUL byte")).superRefine((env3, context) => {
|
|
20619
|
-
const
|
|
20620
|
-
if (
|
|
20619
|
+
const names2 = Object.keys(env3);
|
|
20620
|
+
if (names2.length > PROJECT_COMMAND_ENV_MAX_ENTRIES) {
|
|
20621
20621
|
context.addIssue({ code: "custom", message: `env may have at most ${PROJECT_COMMAND_ENV_MAX_ENTRIES} entries` });
|
|
20622
20622
|
}
|
|
20623
20623
|
let bytes5 = 0;
|
|
20624
|
-
for (const name3 of
|
|
20624
|
+
for (const name3 of names2) {
|
|
20625
20625
|
if (name3.length > 128 || !ENV_NAME_PATTERN.test(name3)) {
|
|
20626
20626
|
context.addIssue({ code: "custom", path: [name3], message: "env names must be POSIX environment variable names" });
|
|
20627
20627
|
}
|
|
@@ -22868,7 +22868,7 @@ var init_connectors_node = __esm({
|
|
|
22868
22868
|
ConnectorAliasSchema = external_exports.string().regex(AGENTX_NAME_PATTERN);
|
|
22869
22869
|
RepositoryScopesSchema = external_exports.union([
|
|
22870
22870
|
external_exports.literal("all-repositories"),
|
|
22871
|
-
external_exports.array(RepositoryNameSchema).min(1).max(32).refine((
|
|
22871
|
+
external_exports.array(RepositoryNameSchema).min(1).max(32).refine((names2) => new Set(names2).size === names2.length, "connector scopes must be unique")
|
|
22872
22872
|
]);
|
|
22873
22873
|
GitHubConnectorSchema = external_exports.object({
|
|
22874
22874
|
name: ConnectorNameSchema,
|
|
@@ -23413,9 +23413,9 @@ function redactKeyValues(text16) {
|
|
|
23413
23413
|
if (blockEnd === stopLine)
|
|
23414
23414
|
return null;
|
|
23415
23415
|
lineStart = text16.indexOf("\n", stopLine) + 1;
|
|
23416
|
-
const
|
|
23416
|
+
const pad3 = text16.slice(lineStart, lineStart + lineIndent(text16, lineStart));
|
|
23417
23417
|
return { end: blockEnd, replacement: `${head}${text16.slice(cursor2, stopLine)}
|
|
23418
|
-
${
|
|
23418
|
+
${pad3}${REDACTED}` };
|
|
23419
23419
|
}
|
|
23420
23420
|
const escaped = /^\\+"/.exec(text16.slice(cursor2, cursor2 + 16));
|
|
23421
23421
|
if (escaped) {
|
|
@@ -24464,11 +24464,11 @@ function modelsSchema(model2, identities) {
|
|
|
24464
24464
|
const seen = [];
|
|
24465
24465
|
for (const [index, entry] of models.entries()) {
|
|
24466
24466
|
for (const [position, identity] of identities(entry).entries()) {
|
|
24467
|
-
const
|
|
24467
|
+
const names2 = seen[position] ??= /* @__PURE__ */ new Set();
|
|
24468
24468
|
const name3 = legacyAliasModelName(identity);
|
|
24469
|
-
if (
|
|
24469
|
+
if (names2.has(name3))
|
|
24470
24470
|
context.addIssue({ code: "custom", path: [index], message: "models must be unique" });
|
|
24471
|
-
|
|
24471
|
+
names2.add(name3);
|
|
24472
24472
|
}
|
|
24473
24473
|
}
|
|
24474
24474
|
});
|
|
@@ -25810,7 +25810,7 @@ var init_routes = __esm({
|
|
|
25810
25810
|
{ method: "POST", path: "/v1/dev/company/preapprovals", requires: "full" },
|
|
25811
25811
|
// #1647: the company's invites (a live owner or admin), for `rovara company invites`.
|
|
25812
25812
|
{ method: "GET", path: "/v1/dev/company/preapprovals", requires: "full" },
|
|
25813
|
-
// INVITE-RESEND (DEC 254zzz184): the
|
|
25813
|
+
// INVITE-RESEND (DEC 254zzz184): the resend stays behind full access and the route's live company role check; since #1648 the Rovara CLI's token may make it too.
|
|
25814
25814
|
{ method: "POST", path: "/v1/dev/company/preapprovals/{inviteId}/resend", requires: "full" },
|
|
25815
25815
|
{ method: "DELETE", path: "/v1/dev/company/preapprovals/{emailHash}", requires: "full" },
|
|
25816
25816
|
// Lane LM8: the lessons API of one project of the caller's company (core-host/lessons-api.ts). Full access only, like the other company-admin routes; live membership and the project's roster still apply.
|
|
@@ -37370,8 +37370,8 @@ var init_e2e_model_channel = __esm({
|
|
|
37370
37370
|
toolChoice: toolChoice.optional(),
|
|
37371
37371
|
maxOutputTokens: external_exports.number().int().min(1).max(caps.maxOutputTokens).optional()
|
|
37372
37372
|
}).strict().superRefine((call2, context) => {
|
|
37373
|
-
const
|
|
37374
|
-
if (new Set(
|
|
37373
|
+
const names2 = call2.tools?.map((tool2) => tool2.name) ?? [];
|
|
37374
|
+
if (new Set(names2).size !== names2.length)
|
|
37375
37375
|
context.addIssue({ code: "custom", path: ["tools"], message: "tool names must be unique" });
|
|
37376
37376
|
const holdsToolBlocks = call2.prompt.some((message) => message.role === "tool" || message.role === "assistant" && message.content.some((part) => part.type === "tool-call"));
|
|
37377
37377
|
if (holdsToolBlocks && call2.tools === void 0)
|
|
@@ -41998,7 +41998,7 @@ var init_test_env_baseline = __esm({
|
|
|
41998
41998
|
repositories: RawRepositoryBaselinesSchema.optional()
|
|
41999
41999
|
}).strict();
|
|
42000
42000
|
WRITER_WORDS = { nightly: "nightly", readiness: "readiness run", final_round: "final round" };
|
|
42001
|
-
number4 = (
|
|
42001
|
+
number4 = (count10) => count10.toLocaleString("en-US");
|
|
42002
42002
|
baselineWords = (stored) => baselineLine({ branch: stored.branch, shortSha: stored.sha.slice(0, 7), ...stored.repositories === void 0 ? {} : { repositories: stored.repositories.map((part) => ({ repositoryId: part.repositoryId, shortSha: part.sha.slice(0, 7) })) }, writer: stored.writer, ageHours: stored.ageHours, commitsBack: stored.commitsBack, partial: stored.commitsBack > 0, knownFailing: stored.knownFailing, flaky: stored.flaky });
|
|
42003
42003
|
}
|
|
42004
42004
|
});
|
|
@@ -42041,10 +42041,10 @@ var init_test_answer_labels = __esm({
|
|
|
42041
42041
|
});
|
|
42042
42042
|
|
|
42043
42043
|
// packages/contracts/dist/test-flaky.js
|
|
42044
|
-
function flakyRerunLine(
|
|
42045
|
-
if (!Number.isSafeInteger(
|
|
42044
|
+
function flakyRerunLine(count10) {
|
|
42045
|
+
if (!Number.isSafeInteger(count10) || count10 <= 0)
|
|
42046
42046
|
return void 0;
|
|
42047
|
-
return `${
|
|
42047
|
+
return `${count10.toLocaleString("en-US")} ${count10 === 1 ? "test was" : "tests were"} flaky (passed on rerun); not counted against this change.`;
|
|
42048
42048
|
}
|
|
42049
42049
|
var FLAKY_ON_RERUN_MAX, FLAKY_RERUN_FILE_MAX_BYTES, FlakyTestId, FlakyRerunFileSchema;
|
|
42050
42050
|
var init_test_flaky = __esm({
|
|
@@ -42339,7 +42339,7 @@ function checkPartsProblems(entry, issue2) {
|
|
|
42339
42339
|
}
|
|
42340
42340
|
if (entry.coverage !== void 0 && entry.coverage.linesCovered > entry.coverage.linesChanged)
|
|
42341
42341
|
issue2(["coverage", "linesCovered"], "covered lines are some of the changed lines");
|
|
42342
|
-
if (entry.findings !== void 0 && entry.findings.newCount !== Object.values(entry.findings.bySeverity).reduce((sum,
|
|
42342
|
+
if (entry.findings !== void 0 && entry.findings.newCount !== Object.values(entry.findings.bySeverity).reduce((sum, count10) => sum + count10, 0))
|
|
42343
42343
|
issue2(["findings", "newCount"], "newCount is the severities together");
|
|
42344
42344
|
}
|
|
42345
42345
|
function evidencePackShape(artifact2, reader2 = false) {
|
|
@@ -43968,7 +43968,7 @@ var init_rovara_code = __esm({
|
|
|
43968
43968
|
expectedRevision: CountSchema3,
|
|
43969
43969
|
allowSelfApproval: external_exports.boolean().optional(),
|
|
43970
43970
|
mergeMethod: external_exports.enum(["squash", "merge"]).optional(),
|
|
43971
|
-
codeReviewers: external_exports.array(ReviewerNameSchema).max(CODE_REVIEWERS_MAX).refine((
|
|
43971
|
+
codeReviewers: external_exports.array(ReviewerNameSchema).max(CODE_REVIEWERS_MAX).refine((names2) => new Set(names2.map((name3) => name3.toLowerCase())).size === names2.length, "names the same reviewer twice").optional()
|
|
43972
43972
|
}).strict();
|
|
43973
43973
|
CodeSettingsResponseSchema = external_exports.object({ settings: CodeSettingsSchema }).strict();
|
|
43974
43974
|
CodeSettingsResponseReaderSchema = forwardReader(CodeSettingsResponseSchema);
|
|
@@ -45901,9 +45901,9 @@ function workflowFeedbackCheckChanges(policy, findings, repositoryPaths) {
|
|
|
45901
45901
|
const projectChecks = [...policy.required, ...policy.optional];
|
|
45902
45902
|
const obsolete = [];
|
|
45903
45903
|
const problems = [];
|
|
45904
|
-
const
|
|
45904
|
+
const names2 = findings.flatMap((finding, index) => isFix(finding) ? (finding.fixProposal?.obsoleteChecks ?? []).map((name3) => ({ name: name3, index })) : []);
|
|
45905
45905
|
const raws = findings.flatMap((finding, index) => isFix(finding) ? (finding.fixProposal?.replacementChecks ?? []).map((raw2) => ({ raw: raw2, index })) : []);
|
|
45906
|
-
if (
|
|
45906
|
+
if (names2.length > WORKFLOW_FEEDBACK_CHECK_CHANGES_MAX)
|
|
45907
45907
|
problems.push(`it names more than ${WORKFLOW_FEEDBACK_CHECK_CHANGES_MAX} checks to drop`);
|
|
45908
45908
|
if (raws.length > WORKFLOW_FEEDBACK_CHECK_CHANGES_MAX)
|
|
45909
45909
|
problems.push(`it proposes more than ${WORKFLOW_FEEDBACK_CHECK_CHANGES_MAX} corrected checks`);
|
|
@@ -45911,7 +45911,7 @@ function workflowFeedbackCheckChanges(policy, findings, repositoryPaths) {
|
|
|
45911
45911
|
const byId = checks.filter((check4) => check4.id === name3.trim());
|
|
45912
45912
|
return byId.length > 0 ? byId : checks.filter((check4) => check4.label.trim().toLowerCase() === name3.trim().toLowerCase());
|
|
45913
45913
|
};
|
|
45914
|
-
for (const { name: name3, index } of
|
|
45914
|
+
for (const { name: name3, index } of names2) {
|
|
45915
45915
|
if (named5(name3, projectChecks).length > 0) {
|
|
45916
45916
|
problems.push("it names a project check, which always runs");
|
|
45917
45917
|
continue;
|
|
@@ -47507,10 +47507,10 @@ var init_service_mocks = __esm({
|
|
|
47507
47507
|
problem2(["faults"], "fault names are unique");
|
|
47508
47508
|
const identifying = new Set(set3.match.query ?? []);
|
|
47509
47509
|
set3.entries.forEach((entry, index) => {
|
|
47510
|
-
const
|
|
47511
|
-
if (new Set(
|
|
47510
|
+
const names2 = (entry.request.query ?? []).map((pair) => pair.name);
|
|
47511
|
+
if (new Set(names2).size !== names2.length)
|
|
47512
47512
|
problem2(["entries", index, "request", "query"], "a parameter is listed once");
|
|
47513
|
-
if (
|
|
47513
|
+
if (names2.some((name3) => !identifying.has(name3)))
|
|
47514
47514
|
problem2(["entries", index, "request", "query"], "only the parameters the set matches on are kept");
|
|
47515
47515
|
if (set3.dependency.protocol === "model_invoke" && (entry.request.method !== "POST" || entry.request.path !== `/endpoints/${set3.dependency.target}/invocations`))
|
|
47516
47516
|
problem2(["entries", index, "request"], "a model endpoint is invoked with POST /endpoints/<name>/invocations");
|
|
@@ -48485,12 +48485,12 @@ var init_project_registries = __esm({
|
|
|
48485
48485
|
context.addIssue({ code: "custom", path: ["scope"], message: "scope applies to npm registries only" });
|
|
48486
48486
|
});
|
|
48487
48487
|
ProjectRegistriesSchema = external_exports.array(ProjectRegistrySchema).max(REGISTRIES_MAX).superRefine((entries, context) => {
|
|
48488
|
-
const
|
|
48488
|
+
const names2 = /* @__PURE__ */ new Set();
|
|
48489
48489
|
const targets = /* @__PURE__ */ new Set();
|
|
48490
48490
|
for (const [index, entry] of entries.entries()) {
|
|
48491
|
-
if (
|
|
48491
|
+
if (names2.has(entry.name))
|
|
48492
48492
|
context.addIssue({ code: "custom", path: [index, "name"], message: "registry names must be unique" });
|
|
48493
|
-
|
|
48493
|
+
names2.add(entry.name);
|
|
48494
48494
|
const target3 = `${formatOf(entry)}\0${entry.scope ?? ""}`;
|
|
48495
48495
|
if (targets.has(target3))
|
|
48496
48496
|
context.addIssue({ code: "custom", path: [index], message: "two registries of one format need different npm scopes" });
|
|
@@ -48582,16 +48582,16 @@ function projectDefinitionObject(connectorsSchema, registriesSchema = ProjectReg
|
|
|
48582
48582
|
}).strict();
|
|
48583
48583
|
}
|
|
48584
48584
|
function checkProjectDefinition(project3, context) {
|
|
48585
|
-
const
|
|
48585
|
+
const names2 = /* @__PURE__ */ new Set();
|
|
48586
48586
|
for (const [index, repository] of project3.repositories.entries()) {
|
|
48587
|
-
if (
|
|
48587
|
+
if (names2.has(repository.name)) {
|
|
48588
48588
|
context.addIssue({
|
|
48589
48589
|
code: "custom",
|
|
48590
48590
|
path: ["repositories", index, "name"],
|
|
48591
48591
|
message: "repository names must be unique"
|
|
48592
48592
|
});
|
|
48593
48593
|
}
|
|
48594
|
-
|
|
48594
|
+
names2.add(repository.name);
|
|
48595
48595
|
}
|
|
48596
48596
|
const paths2 = project3.repositories.map((repository) => repository.path).sort();
|
|
48597
48597
|
for (let index = 1; index < paths2.length; index += 1) {
|
|
@@ -48601,7 +48601,7 @@ function checkProjectDefinition(project3, context) {
|
|
|
48601
48601
|
context.addIssue({ code: "custom", path: ["repositories"], message: "repository paths overlap" });
|
|
48602
48602
|
}
|
|
48603
48603
|
}
|
|
48604
|
-
if (project3.devcontainer && !
|
|
48604
|
+
if (project3.devcontainer && !names2.has(project3.devcontainer.repository)) {
|
|
48605
48605
|
context.addIssue({ code: "custom", path: ["devcontainer", "repository"], message: `devcontainer names unregistered repository ${project3.devcontainer.repository}` });
|
|
48606
48606
|
}
|
|
48607
48607
|
const metas = project3.repositories.map((repository, index) => ({ repository, index })).filter(({ repository }) => repository.role === "meta");
|
|
@@ -48630,7 +48630,7 @@ function checkProjectDefinition(project3, context) {
|
|
|
48630
48630
|
if (scopes === "all-repositories")
|
|
48631
48631
|
continue;
|
|
48632
48632
|
for (const name3 of scopes) {
|
|
48633
|
-
if (!
|
|
48633
|
+
if (!names2.has(name3)) {
|
|
48634
48634
|
context.addIssue({ code: "custom", path: ["integrations", "connectors"], message: `connector ${connector.name} scopes unregistered repository ${name3}` });
|
|
48635
48635
|
}
|
|
48636
48636
|
}
|
|
@@ -48777,10 +48777,10 @@ var init_project_node = __esm({
|
|
|
48777
48777
|
if (repository.alsoCode !== void 0 && repository.role !== "meta") {
|
|
48778
48778
|
context.addIssue({ code: "custom", path: ["alsoCode"], message: "alsoCode is only for the meta repository" });
|
|
48779
48779
|
}
|
|
48780
|
-
const
|
|
48780
|
+
const names2 = /* @__PURE__ */ new Set();
|
|
48781
48781
|
const projects = /* @__PURE__ */ new Set();
|
|
48782
48782
|
for (const [index, gate] of (repository.codeBuildGates ?? []).entries()) {
|
|
48783
|
-
if (
|
|
48783
|
+
if (names2.has(gate.name)) {
|
|
48784
48784
|
context.addIssue({
|
|
48785
48785
|
code: "custom",
|
|
48786
48786
|
path: ["codeBuildGates", index, "name"],
|
|
@@ -48794,13 +48794,13 @@ var init_project_node = __esm({
|
|
|
48794
48794
|
message: "CodeBuild projects must be unique within a repository"
|
|
48795
48795
|
});
|
|
48796
48796
|
}
|
|
48797
|
-
|
|
48797
|
+
names2.add(gate.name);
|
|
48798
48798
|
projects.add(gate.projectName);
|
|
48799
48799
|
}
|
|
48800
48800
|
for (const [index, check4] of (repository.externalChecks ?? []).entries()) {
|
|
48801
|
-
if (
|
|
48801
|
+
if (names2.has(check4.name))
|
|
48802
48802
|
context.addIssue({ code: "custom", path: ["externalChecks", index, "name"], message: "external check names must be unique (also across codeBuildGates)" });
|
|
48803
|
-
|
|
48803
|
+
names2.add(check4.name);
|
|
48804
48804
|
if (check4.provider === CODEBUILD_CHECK_PROVIDER) {
|
|
48805
48805
|
if (!CodeBuildGateDefinitionSchema.shape.projectName.safeParse(check4.reference).success) {
|
|
48806
48806
|
context.addIssue({ code: "custom", path: ["externalChecks", index, "reference"], message: "CodeBuild projectName must begin with agentx-" });
|
|
@@ -49262,8 +49262,8 @@ function cleanDisplayName(name3) {
|
|
|
49262
49262
|
function inertName(name3) {
|
|
49263
49263
|
const longestRun = Math.max(0, ...(name3.match(/`+/g) ?? []).map((run2) => run2.length));
|
|
49264
49264
|
const fence = "`".repeat(longestRun + 1);
|
|
49265
|
-
const
|
|
49266
|
-
return `${fence}${
|
|
49265
|
+
const pad3 = name3.startsWith("`") || name3.endsWith("`") ? " " : "";
|
|
49266
|
+
return `${fence}${pad3}${name3}${pad3}${fence}`;
|
|
49267
49267
|
}
|
|
49268
49268
|
function containsEmailAddress(text16) {
|
|
49269
49269
|
if (typeof text16 !== "string")
|
|
@@ -49945,8 +49945,8 @@ function parseTaskMoneyV1(raw2) {
|
|
|
49945
49945
|
return void 0;
|
|
49946
49946
|
const money4 = m3, value = taskMoneyValue;
|
|
49947
49947
|
const spent = value(money4.spentMicros), final = value(money4.finalMicros), estimated = value(money4.estimatedMicros), awaiting = value(money4.awaitingUsageMicros);
|
|
49948
|
-
const
|
|
49949
|
-
if (spent !== void 0 && (final === void 0 || estimated === void 0 || !Number.isSafeInteger(final + estimated) || spent !== final + estimated) || awaiting !== void 0 && (estimated === void 0 || awaiting > estimated) || money4.coverage.awaitingUsageCalls > money4.coverage.estimatedCalls || value(money4.awaitingUsageCalls) !== void 0 && value(money4.awaitingUsageCalls) !== money4.coverage.awaitingUsageCalls || !Number.isSafeInteger(
|
|
49948
|
+
const count10 = money4.coverage.finalCalls + money4.coverage.estimatedCalls, expected = value(money4.coverage.expectedCalls);
|
|
49949
|
+
if (spent !== void 0 && (final === void 0 || estimated === void 0 || !Number.isSafeInteger(final + estimated) || spent !== final + estimated) || awaiting !== void 0 && (estimated === void 0 || awaiting > estimated) || money4.coverage.awaitingUsageCalls > money4.coverage.estimatedCalls || value(money4.awaitingUsageCalls) !== void 0 && value(money4.awaitingUsageCalls) !== money4.coverage.awaitingUsageCalls || !Number.isSafeInteger(count10) || expected !== void 0 && count10 > expected || money4.state === "current" && (spent === void 0 || expected === void 0 || count10 !== expected || value(money4.unpricedCalls) !== 0 || money4.coverage.incompatibleCurrencyCalls !== 0 || value(money4.heldMicros) === void 0) || money4.state === "unavailable" && spent !== void 0 || money4.finality === "unavailable" && spent !== void 0 || money4.finality === "final" && (money4.state !== "current" || !money4.terminal || money4.coverage.estimatedCalls !== 0 || value(money4.heldMicros) !== 0 || money4.stop.coverage !== "complete"))
|
|
49950
49950
|
return void 0;
|
|
49951
49951
|
return structuredClone(money4);
|
|
49952
49952
|
}
|
|
@@ -49955,7 +49955,7 @@ var init_task_money = __esm({
|
|
|
49955
49955
|
"packages/contracts/dist/task-money.js"() {
|
|
49956
49956
|
"use strict";
|
|
49957
49957
|
object3 = (v) => v !== null && typeof v === "object" && !Array.isArray(v) ? v : void 0;
|
|
49958
|
-
keys = (v,
|
|
49958
|
+
keys = (v, names2) => Object.keys(v).sort().join(",") === names2.split(" ").sort().join(",");
|
|
49959
49959
|
text = (v) => typeof v === "string" && v.length > 0 && v.length <= 2048;
|
|
49960
49960
|
natural = (v) => typeof v === "number" && Number.isSafeInteger(v) && v >= 0;
|
|
49961
49961
|
iso = (v) => text(v) && /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/u.test(v) && !Number.isNaN(Date.parse(v)) && new Date(v).toISOString() === v;
|
|
@@ -52154,9 +52154,9 @@ function notChangingReference(id12) {
|
|
|
52154
52154
|
const match = NOT_CHANGING_REFERENCE.exec(id12);
|
|
52155
52155
|
return match === null ? void 0 : Number(match[1]);
|
|
52156
52156
|
}
|
|
52157
|
-
function isNotChangingReference(id12,
|
|
52157
|
+
function isNotChangingReference(id12, count10) {
|
|
52158
52158
|
const position = notChangingReference(id12);
|
|
52159
|
-
return position !== void 0 && position <=
|
|
52159
|
+
return position !== void 0 && position <= count10;
|
|
52160
52160
|
}
|
|
52161
52161
|
var PROVES_MAX, ProvesSchema, ProposedChecksBlockSchema, PlanCheckExtras, ProposedChecksWithProvesBlockSchema, NOT_CHANGING_REFERENCE;
|
|
52162
52162
|
var init_workflow_proposed_checks = __esm({
|
|
@@ -54369,12 +54369,12 @@ var init_workflow_plan_document = __esm({
|
|
|
54369
54369
|
}).strict()).min(1).max(12),
|
|
54370
54370
|
relations: external_exports.array(external_exports.object({ from: text3(60), to: text3(60), label: text3(60) }).strict()).max(30)
|
|
54371
54371
|
}).strict().superRefine((value, context) => {
|
|
54372
|
-
const
|
|
54373
|
-
if (!unique2(
|
|
54372
|
+
const names2 = value.entities.map((entity) => entity.name);
|
|
54373
|
+
if (!unique2(names2))
|
|
54374
54374
|
context.addIssue({ code: "custom", path: ["entities"], message: "lists the same entity twice" });
|
|
54375
54375
|
value.relations.forEach((relation, index) => {
|
|
54376
54376
|
for (const end2 of ["from", "to"]) {
|
|
54377
|
-
if (!
|
|
54377
|
+
if (!names2.includes(relation[end2]))
|
|
54378
54378
|
context.addIssue({ code: "custom", path: ["relations", index, end2], message: `names "${shortLabel(relation[end2])}", which is not one of the entities` });
|
|
54379
54379
|
}
|
|
54380
54380
|
});
|
|
@@ -55047,15 +55047,15 @@ function operatorParametersFromRows(rows) {
|
|
|
55047
55047
|
}
|
|
55048
55048
|
function namedEnvironmentOnlyFromRows(rows) {
|
|
55049
55049
|
const declaredByLegacy = new Set(rows.flatMap((row2) => row2.install?.parameter !== void 0 && (row2.install.declaredIn === "both" || row2.install.declaredIn === "legacy") && LEGACY_STACK_PARTS.includes(row2.install.part) ? [row2.install.parameter] : []));
|
|
55050
|
-
const
|
|
55050
|
+
const names2 = [];
|
|
55051
55051
|
for (const row2 of rows) {
|
|
55052
55052
|
const install = row2.install;
|
|
55053
55053
|
if (install?.declaredIn !== "named" || install.parameter === void 0 || !LEGACY_STACK_PARTS.includes(install.part) || declaredByLegacy.has(install.parameter))
|
|
55054
55054
|
continue;
|
|
55055
|
-
if (!
|
|
55056
|
-
|
|
55055
|
+
if (!names2.includes(install.parameter))
|
|
55056
|
+
names2.push(install.parameter);
|
|
55057
55057
|
}
|
|
55058
|
-
return
|
|
55058
|
+
return names2;
|
|
55059
55059
|
}
|
|
55060
55060
|
function brokerSettingsFromRows(rows) {
|
|
55061
55061
|
const packed = rows.flatMap((row2) => row2.install?.packed === void 0 ? [] : [row2.install.packed]);
|
|
@@ -57123,11 +57123,11 @@ var init_meta_project = __esm({
|
|
|
57123
57123
|
/** Meta repo lane F: the places work is asked for. Like everything in this file it is never applied directly; a maintainer approves turning an intake source on. */
|
|
57124
57124
|
intake: external_exports.array(IntakeChannelRefSchema).max(META_CONFIG_MAX_INTAKE).optional()
|
|
57125
57125
|
}).strict().superRefine((config5, context) => {
|
|
57126
|
-
const
|
|
57126
|
+
const names2 = /* @__PURE__ */ new Set();
|
|
57127
57127
|
for (const [index, repository] of (config5.repositories ?? []).entries()) {
|
|
57128
|
-
if (
|
|
57128
|
+
if (names2.has(repository.name))
|
|
57129
57129
|
context.addIssue({ code: "custom", path: ["repositories", index, "name"], message: "repository names must be unique" });
|
|
57130
|
-
|
|
57130
|
+
names2.add(repository.name);
|
|
57131
57131
|
}
|
|
57132
57132
|
const checks = /* @__PURE__ */ new Set();
|
|
57133
57133
|
for (const [index, check4] of (config5.checks ?? []).entries()) {
|
|
@@ -60513,8 +60513,8 @@ var init_runtime_installation = __esm({
|
|
|
60513
60513
|
if (probe.expectedOutcome !== expected || probe.observedOutcome !== expected || probe.candidateExitCode !== 0)
|
|
60514
60514
|
context.addIssue({ code: "custom", path: ["observedOutcome"], message: "probe outcome or candidate process status differs from the fixed oracle" });
|
|
60515
60515
|
const prefix2 = probe.probeId.slice(0, -3);
|
|
60516
|
-
const
|
|
60517
|
-
if (probe.captures[0]?.name !==
|
|
60516
|
+
const names2 = [`${prefix2}-request.json`, `${prefix2}-response.json`, `${prefix2}-stderr.bin`];
|
|
60517
|
+
if (probe.captures[0]?.name !== names2[0] || probe.captures[1]?.name !== names2[1] || probe.captures[2]?.name !== names2[2])
|
|
60518
60518
|
context.addIssue({ code: "custom", path: ["captures"], message: "probe must retain its exact original request, response, and stderr capture identities" });
|
|
60519
60519
|
const request = probe.captures[0] ? parseCanonicalJsonCapture(probe.captures[0].bytesBase64) : void 0;
|
|
60520
60520
|
const response = probe.captures[1] ? parseCanonicalJsonCapture(probe.captures[1].bytesBase64) : void 0;
|
|
@@ -62162,7 +62162,7 @@ var init_charge_receipt = __esm({
|
|
|
62162
62162
|
"packages/contracts/dist/charge-receipt.js"() {
|
|
62163
62163
|
"use strict";
|
|
62164
62164
|
object4 = (v) => v !== null && typeof v === "object" && !Array.isArray(v) ? v : void 0;
|
|
62165
|
-
keys2 = (v,
|
|
62165
|
+
keys2 = (v, names2) => Object.keys(v).sort().join(",") === names2.split(" ").sort().join(",");
|
|
62166
62166
|
text4 = (v) => typeof v === "string" && v.length > 0 && v.length <= 2048;
|
|
62167
62167
|
natural2 = (v) => typeof v === "number" && Number.isSafeInteger(v) && v >= 0;
|
|
62168
62168
|
iso2 = (v) => text4(v) && /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/u.test(v) && !Number.isNaN(Date.parse(v)) && new Date(v).toISOString() === v;
|
|
@@ -63460,13 +63460,13 @@ function parseStrictUtcIsoTimestamp(value) {
|
|
|
63460
63460
|
if (match === null)
|
|
63461
63461
|
return null;
|
|
63462
63462
|
const [, yearText, monthText, dayText, hourText, minuteText, secondText, fraction = ""] = match;
|
|
63463
|
-
const year2 = Number(yearText), month = Number(monthText),
|
|
63463
|
+
const year2 = Number(yearText), month = Number(monthText), day2 = Number(dayText);
|
|
63464
63464
|
const hour = Number(hourText), minute = Number(minuteText), second = Number(secondText);
|
|
63465
63465
|
const millis = Number(fraction.slice(0, 3).padEnd(3, "0"));
|
|
63466
63466
|
const date6 = /* @__PURE__ */ new Date(0);
|
|
63467
|
-
date6.setUTCFullYear(year2, month - 1,
|
|
63467
|
+
date6.setUTCFullYear(year2, month - 1, day2);
|
|
63468
63468
|
date6.setUTCHours(hour, minute, second, millis);
|
|
63469
|
-
if (year2 < 1 || date6.getUTCFullYear() !== year2 || date6.getUTCMonth() !== month - 1 || date6.getUTCDate() !==
|
|
63469
|
+
if (year2 < 1 || date6.getUTCFullYear() !== year2 || date6.getUTCMonth() !== month - 1 || date6.getUTCDate() !== day2 || date6.getUTCHours() !== hour || date6.getUTCMinutes() !== minute || date6.getUTCSeconds() !== second || date6.getUTCMilliseconds() !== millis)
|
|
63470
63470
|
return null;
|
|
63471
63471
|
const timestamp2 = Date.parse(value);
|
|
63472
63472
|
return Number.isFinite(timestamp2) && timestamp2 === date6.getTime() ? timestamp2 : null;
|
|
@@ -65447,13 +65447,13 @@ var tests, named, TEST_RESULT_WORDS;
|
|
|
65447
65447
|
var init_check_result_notes = __esm({
|
|
65448
65448
|
"packages/contracts/dist/check-result-notes.js"() {
|
|
65449
65449
|
"use strict";
|
|
65450
|
-
tests = (
|
|
65450
|
+
tests = (count10) => `${count10} ${count10 === 1 ? "test" : "tests"} skipped`;
|
|
65451
65451
|
named = (services) => services.length < 3 ? services.join(" and ") : `${services.slice(0, -1).join(", ")} and ${services.at(-1)}`;
|
|
65452
65452
|
TEST_RESULT_WORDS = {
|
|
65453
65453
|
/** "3 tests skipped" */
|
|
65454
65454
|
skipped: tests,
|
|
65455
65455
|
/** The lead of a passing result that skipped tests; it replaces "Checks passed". */
|
|
65456
|
-
passedWithSkips: (
|
|
65456
|
+
passedWithSkips: (count10) => `Passed, ${tests(count10)}`,
|
|
65457
65457
|
/** The result of a check in which no test ran. */
|
|
65458
65458
|
allSkipped: "Not tested: every test was skipped",
|
|
65459
65459
|
/** The same, as a fragment of a line about one check. */
|
|
@@ -69907,8 +69907,8 @@ var init_evidence_ai_render = __esm({
|
|
|
69907
69907
|
});
|
|
69908
69908
|
|
|
69909
69909
|
// packages/contracts/dist/evidence-weakening.js
|
|
69910
|
-
function listed(
|
|
69911
|
-
const shown4 =
|
|
69910
|
+
function listed(names2, total = names2.length) {
|
|
69911
|
+
const shown4 = names2.slice(0, WEAKENING_LIMITS.namesListed).map((name3) => typeof name3 === "string" ? inertEvidenceText(name3, WEAKENING_LIMITS.nameMax) : "").filter((name3) => name3 !== "");
|
|
69912
69912
|
const more2 = Math.max(0, total - shown4.length);
|
|
69913
69913
|
return `${shown4.join(", ")}${more2 > 0 ? `${shown4.length > 0 ? " " : ""}and ${num(more2)} more` : ""}`;
|
|
69914
69914
|
}
|
|
@@ -69944,8 +69944,8 @@ var init_evidence_weakening = __esm({
|
|
|
69944
69944
|
"use strict";
|
|
69945
69945
|
init_evidence_inert();
|
|
69946
69946
|
WEAKENING_LIMITS = { namesListed: 3, nameMax: 100, lineMax: 300 };
|
|
69947
|
-
num = (
|
|
69948
|
-
noun2 = (
|
|
69947
|
+
num = (count10) => typeof count10 === "number" && Number.isFinite(count10) && count10 >= 0 ? Math.floor(count10).toLocaleString("en-US") : "?";
|
|
69948
|
+
noun2 = (count10, one, many = `${one}s`) => `${num(count10)} ${count10 === 1 ? one : many}`;
|
|
69949
69949
|
cut = (text16, max) => {
|
|
69950
69950
|
const points = Array.from(text16);
|
|
69951
69951
|
return points.length <= max ? text16 : `${points.slice(0, max - 1).join("")}\u2026`;
|
|
@@ -70103,10 +70103,10 @@ var init_rovara_problem = __esm({
|
|
|
70103
70103
|
});
|
|
70104
70104
|
|
|
70105
70105
|
// packages/contracts/dist/evidence-render.js
|
|
70106
|
-
function dayWords(
|
|
70107
|
-
const match = /^\d{4}-(\d{2})-(\d{2})$/u.exec(
|
|
70106
|
+
function dayWords(day2) {
|
|
70107
|
+
const match = /^\d{4}-(\d{2})-(\d{2})$/u.exec(day2);
|
|
70108
70108
|
const month = match === null ? void 0 : MONTHS[Number(match[1]) - 1];
|
|
70109
|
-
return match === null || month === void 0 ? inert2(
|
|
70109
|
+
return match === null || month === void 0 ? inert2(day2, 12) : `${String(Number(match[2]))} ${month}`;
|
|
70110
70110
|
}
|
|
70111
70111
|
function checkLine(check4) {
|
|
70112
70112
|
const kind = typeof check4.kind === "string" ? check4.kind : "";
|
|
@@ -70151,8 +70151,8 @@ function checksLines(checks) {
|
|
|
70151
70151
|
if (checks.length === 0)
|
|
70152
70152
|
return ["Checks: none"];
|
|
70153
70153
|
const counts3 = OUTCOME_ORDER.flatMap((outcome) => {
|
|
70154
|
-
const
|
|
70155
|
-
return
|
|
70154
|
+
const count10 = checks.filter((check4) => check4.after === outcome).length;
|
|
70155
|
+
return count10 === 0 ? [] : [`${number5(count10)} ${OUTCOME_WORDS[outcome]}`];
|
|
70156
70156
|
});
|
|
70157
70157
|
const other = checks.filter((check4) => !OUTCOME_ORDER.includes(check4.after)).length;
|
|
70158
70158
|
if (other > 0)
|
|
@@ -70319,8 +70319,8 @@ var init_evidence_render = __esm({
|
|
|
70319
70319
|
const points = Array.from(text16);
|
|
70320
70320
|
return points.length <= max ? text16 : `${points.slice(0, max - 1).join("")}\u2026`;
|
|
70321
70321
|
};
|
|
70322
|
-
number5 = (
|
|
70323
|
-
plural2 = (
|
|
70322
|
+
number5 = (count10) => typeof count10 === "number" && Number.isFinite(count10) ? count10.toLocaleString("en-US") : "?";
|
|
70323
|
+
plural2 = (count10, one, many = `${one}s`) => `${number5(count10)} ${count10 === 1 ? one : many}`;
|
|
70324
70324
|
dollars2 = (amount3) => typeof amount3 === "number" && Number.isFinite(amount3) ? `$${amount3.toFixed(2)}` : "$?";
|
|
70325
70325
|
inert2 = inertEvidenceText;
|
|
70326
70326
|
line18 = (text16) => cut2(text16, EVIDENCE_RENDER_LIMITS.lineMax);
|
|
@@ -70338,12 +70338,12 @@ function dayNumber(value) {
|
|
|
70338
70338
|
const match = typeof value === "string" ? DAY.exec(value) : null;
|
|
70339
70339
|
if (match === null)
|
|
70340
70340
|
return void 0;
|
|
70341
|
-
const [year2, month,
|
|
70341
|
+
const [year2, month, day2] = [Number(match[1]), Number(match[2]), Number(match[3])];
|
|
70342
70342
|
if (year2 < 2e3)
|
|
70343
70343
|
return void 0;
|
|
70344
|
-
const time5 = Date.UTC(year2, month - 1,
|
|
70344
|
+
const time5 = Date.UTC(year2, month - 1, day2);
|
|
70345
70345
|
const check4 = new Date(time5);
|
|
70346
|
-
return check4.getUTCFullYear() === year2 && check4.getUTCMonth() === month - 1 && check4.getUTCDate() ===
|
|
70346
|
+
return check4.getUTCFullYear() === year2 && check4.getUTCMonth() === month - 1 && check4.getUTCDate() === day2 ? Math.floor(time5 / 864e5) : void 0;
|
|
70347
70347
|
}
|
|
70348
70348
|
function publicEvidenceView(input2, newer = noNewerEvidence()) {
|
|
70349
70349
|
const pack = input2;
|
|
@@ -70375,9 +70375,9 @@ function publicEvidenceView(input2, newer = noNewerEvidence()) {
|
|
|
70375
70375
|
depTrust[trust] += 1;
|
|
70376
70376
|
if (trust !== "recorded")
|
|
70377
70377
|
continue;
|
|
70378
|
-
const
|
|
70379
|
-
if (typeof
|
|
70380
|
-
oldest =
|
|
70378
|
+
const day2 = own2(dependency, "recordedOn") ?? own2(own2(dependency, "recording"), "recordedOn");
|
|
70379
|
+
if (typeof day2 === "string" && dayNumber(day2) !== void 0 && (oldest === void 0 || day2 < oldest))
|
|
70380
|
+
oldest = day2;
|
|
70381
70381
|
}
|
|
70382
70382
|
const proofRaw = own2(pack, "proof");
|
|
70383
70383
|
const weakening = own2(pack, "weakening");
|
|
@@ -70532,8 +70532,8 @@ var init_evidence_public = __esm({
|
|
|
70532
70532
|
noun3 = (value, one, many = `${one}s`) => `${num2(value)} ${value === 1 ? one : many}`;
|
|
70533
70533
|
text7 = (words2) => inertEvidenceText(words2, PUBLIC_RENDER_LIMITS.lineMax);
|
|
70534
70534
|
item = (words2) => `- ${text7(words2)}`;
|
|
70535
|
-
dayWords2 = (
|
|
70536
|
-
const match = DAY.exec(
|
|
70535
|
+
dayWords2 = (day2) => {
|
|
70536
|
+
const match = DAY.exec(day2);
|
|
70537
70537
|
const month = match === null ? void 0 : MONTHS2[Number(match[2]) - 1];
|
|
70538
70538
|
return match === null || month === void 0 ? "" : `${String(Number(match[3]))} ${month} ${match[1]}`;
|
|
70539
70539
|
};
|
|
@@ -70632,8 +70632,8 @@ var init_reviewed_project_restore = __esm({
|
|
|
70632
70632
|
|
|
70633
70633
|
// packages/contracts/dist/app-working-branches.js
|
|
70634
70634
|
function pageProblems(value, context) {
|
|
70635
|
-
const
|
|
70636
|
-
if (new Set(value.branches).size !==
|
|
70635
|
+
const count10 = value.branches.length;
|
|
70636
|
+
if (new Set(value.branches).size !== count10 || count10 === 100 && (!value.mayHaveMore || value.omittedUnsupported) || value.mayHaveMore && !value.omittedUnsupported && count10 !== 100 || !value.mayHaveMore && value.omittedUnsupported && count10 >= 99)
|
|
70637
70637
|
context.addIssue({ code: "custom", message: "Inconsistent branch page." });
|
|
70638
70638
|
}
|
|
70639
70639
|
var WorkingBranchNameSchema, WorkingBranchCursorSchema, lifecycle3, config4, ProjectWorkingBranchPageBodySchema, facts, WorkingBranchPageFactsSchema, ProjectWorkingBranchPageSchema, ProjectWorkingBranchPageReaderSchema, ProjectWorkingBranchPreviewBodySchema, ProjectWorkingBranchPreviewSchema, ProjectWorkingBranchPreviewReaderSchema, ProjectWorkingBranchContextQuerySchema, ProjectWorkingBranchContextSchema, ProjectWorkingBranchContextReaderSchema, ProjectWorkingBranchSaveBodySchema, ProjectWorkingBranchReceiptSchema, ProjectWorkingBranchSaveResultSchema, ProjectWorkingBranchSaveResultReaderSchema;
|
|
@@ -72547,8 +72547,8 @@ function assertReplyBounds(reply, model2) {
|
|
|
72547
72547
|
const calls = reply.toolCalls ?? [];
|
|
72548
72548
|
if (calls.length > 32 || calls.some((call2) => call2.name.length === 0 || call2.name.length > MODEL_NAME_MAX_CHARS || JSON.stringify(call2.args).length > MODEL_REPLY_MAX_CHARS))
|
|
72549
72549
|
throw new RangeError("the scripted tool calls are out of bounds");
|
|
72550
|
-
for (const
|
|
72551
|
-
if (!Number.isSafeInteger(
|
|
72550
|
+
for (const count10 of [reply.usage?.inputTokens ?? 0, reply.usage?.outputTokens ?? 0])
|
|
72551
|
+
if (!Number.isSafeInteger(count10) || count10 < 0 || count10 > 1e9)
|
|
72552
72552
|
throw new RangeError("a token count is out of bounds");
|
|
72553
72553
|
}
|
|
72554
72554
|
function replyUsage(reply) {
|
|
@@ -72570,14 +72570,14 @@ function chunkText(text16, maxChars) {
|
|
|
72570
72570
|
const size = Math.max(1, Math.floor(maxChars), Math.ceil(text16.length / MODEL_STREAM_MAX_CHUNKS));
|
|
72571
72571
|
const pieces = [];
|
|
72572
72572
|
let piece = "";
|
|
72573
|
-
let
|
|
72573
|
+
let count10 = 0;
|
|
72574
72574
|
for (const point of text16) {
|
|
72575
72575
|
piece += point;
|
|
72576
|
-
|
|
72577
|
-
if (
|
|
72576
|
+
count10 += 1;
|
|
72577
|
+
if (count10 === size) {
|
|
72578
72578
|
pieces.push(piece);
|
|
72579
72579
|
piece = "";
|
|
72580
|
-
|
|
72580
|
+
count10 = 0;
|
|
72581
72581
|
}
|
|
72582
72582
|
}
|
|
72583
72583
|
if (piece.length > 0)
|
|
@@ -72749,9 +72749,9 @@ var init_prompt_change = __esm({
|
|
|
72749
72749
|
actual[item2.kind]++;
|
|
72750
72750
|
let total = 0;
|
|
72751
72751
|
for (const kind of PROMPT_CHANGE_KINDS) {
|
|
72752
|
-
const
|
|
72753
|
-
total +=
|
|
72754
|
-
if (report2.itemsTruncated ?
|
|
72752
|
+
const count10 = report2.counts[kind] ?? 0;
|
|
72753
|
+
total += count10;
|
|
72754
|
+
if (report2.itemsTruncated ? count10 < actual[kind] : count10 !== actual[kind])
|
|
72755
72755
|
ctx.addIssue({ code: "custom", message: "counts disagree with items" });
|
|
72756
72756
|
}
|
|
72757
72757
|
if (report2.itemsTruncated && (report2.items.length !== PROMPT_CHANGE_LIMITS.items || total <= PROMPT_CHANGE_LIMITS.items))
|
|
@@ -73280,8 +73280,8 @@ function serveUnchecked(rows, request, options) {
|
|
|
73280
73280
|
return failure2(501, "family_not_built");
|
|
73281
73281
|
}
|
|
73282
73282
|
function credentialKind(headers) {
|
|
73283
|
-
const
|
|
73284
|
-
return
|
|
73283
|
+
const names2 = new Set(Object.keys(headers).map((name3) => name3.toLowerCase()));
|
|
73284
|
+
return names2.has("x-goog-api-key") ? "x-goog-api-key" : names2.has("authorization") ? "authorization" : "none";
|
|
73285
73285
|
}
|
|
73286
73286
|
function serveOpenAi(operation2, request, options, served, created, lineEnding) {
|
|
73287
73287
|
if (operation2 !== "chat_completions" || options.reply === void 0)
|
|
@@ -73462,12 +73462,12 @@ function openAiResponseStreamBody(reply, options, lineEnding) {
|
|
|
73462
73462
|
return sseNamedBody(buildOpenAiResponseStreamEvents(reply, options), lineEnding);
|
|
73463
73463
|
}
|
|
73464
73464
|
function buildOpenAiEmbeddings(options) {
|
|
73465
|
-
const
|
|
73465
|
+
const count10 = Math.min(VECTOR_MAX_ITEMS, Math.max(1, Math.trunc(options.inputCount)));
|
|
73466
73466
|
const dimensions = Math.min(VECTOR_MAX_DIMENSIONS, Math.max(1, Math.trunc(options.dimensions ?? OPENAI_EMBEDDING_DEFAULT_DIMENSIONS)));
|
|
73467
73467
|
const tokens = Number.isSafeInteger(options.promptTokens) && options.promptTokens >= 0 ? options.promptTokens : 0;
|
|
73468
73468
|
return {
|
|
73469
73469
|
object: "list",
|
|
73470
|
-
data: Array.from({ length:
|
|
73470
|
+
data: Array.from({ length: count10 }, (_, index) => {
|
|
73471
73471
|
const values = seededVector(`${options.seed}:embedding:${String(index)}`, dimensions);
|
|
73472
73472
|
return { object: "embedding", index, embedding: options.base64 ? float32Base64(values) : values };
|
|
73473
73473
|
}),
|
|
@@ -73521,11 +73521,11 @@ function routeAnthropicRequest(request) {
|
|
|
73521
73521
|
if (segments.some((segment2) => segment2 === "" || /^\.+$/u.test(segment2)))
|
|
73522
73522
|
return { ok: false, reason: "bad_path" };
|
|
73523
73523
|
const last = segments[segments.length - 1];
|
|
73524
|
-
const
|
|
73525
|
-
const operation2 =
|
|
73524
|
+
const count10 = last === "count_tokens" && segments[segments.length - 2] === "messages";
|
|
73525
|
+
const operation2 = count10 ? "count_tokens" : last === "messages" ? "messages" : void 0;
|
|
73526
73526
|
if (operation2 === void 0)
|
|
73527
73527
|
return { ok: false, reason: "unsupported_path" };
|
|
73528
|
-
const leading = segments.slice(0, segments.length - (
|
|
73528
|
+
const leading = segments.slice(0, segments.length - (count10 ? 2 : 1));
|
|
73529
73529
|
if (leading.length > LEADING_SEGMENTS_MAX2 || leading.some((segment2) => !LEADING_SEGMENT2.test(segment2)))
|
|
73530
73530
|
return { ok: false, reason: "unsupported_path" };
|
|
73531
73531
|
if (typeof request.method !== "string" || request.method.toUpperCase() !== "POST")
|
|
@@ -73673,11 +73673,11 @@ function cohereStreamBody(events, lineEnding) {
|
|
|
73673
73673
|
return sseNamedBody(events, lineEnding);
|
|
73674
73674
|
}
|
|
73675
73675
|
function buildCohereEmbed(options) {
|
|
73676
|
-
const
|
|
73676
|
+
const count10 = Math.min(VECTOR_MAX_ITEMS, Math.max(1, Math.trunc(options.textCount)));
|
|
73677
73677
|
const dimensions = Math.min(VECTOR_MAX_DIMENSIONS, Math.max(1, Math.trunc(options.dimensions ?? COHERE_EMBEDDING_DEFAULT_DIMENSIONS)));
|
|
73678
73678
|
const known = [...new Set(options.types.filter((type) => COHERE_EMBEDDING_TYPES.includes(type)))];
|
|
73679
73679
|
const types2 = known.length > 0 ? known : ["float"];
|
|
73680
|
-
const vectors = Array.from({ length:
|
|
73680
|
+
const vectors = Array.from({ length: count10 }, (_, index) => seededVector(`${options.seed}:embed:${String(index)}`, dimensions));
|
|
73681
73681
|
const embeddings = {};
|
|
73682
73682
|
for (const type of types2) {
|
|
73683
73683
|
const render = (values) => {
|
|
@@ -74055,14 +74055,14 @@ var init_model_failure_pack = __esm({
|
|
|
74055
74055
|
|
|
74056
74056
|
// packages/contracts/dist/model-families.js
|
|
74057
74057
|
function credentialKind2(headers, queryKey = false) {
|
|
74058
|
-
const
|
|
74059
|
-
if (
|
|
74058
|
+
const names2 = new Set(lowerHeaders(headers).keys());
|
|
74059
|
+
if (names2.has("x-goog-api-key"))
|
|
74060
74060
|
return "x-goog-api-key";
|
|
74061
|
-
if (
|
|
74061
|
+
if (names2.has("x-api-key"))
|
|
74062
74062
|
return "x-api-key";
|
|
74063
|
-
if (
|
|
74063
|
+
if (names2.has("api-key"))
|
|
74064
74064
|
return "api-key";
|
|
74065
|
-
if (
|
|
74065
|
+
if (names2.has("authorization"))
|
|
74066
74066
|
return "authorization";
|
|
74067
74067
|
return queryKey ? "query_key" : "none";
|
|
74068
74068
|
}
|
|
@@ -74740,7 +74740,7 @@ var init_mcp_servers = __esm({
|
|
|
74740
74740
|
}).strict().refine((size) => SIZES[size.cpu]?.includes(size.memoryMiB) === true, "size: that CPU and memory do not go together");
|
|
74741
74741
|
MCP_STDIO_DEFAULT_SIZE = { cpu: 256, memoryMiB: 512 };
|
|
74742
74742
|
destinations = external_exports.array(McpStdioDestinationSchema).max(8).default([]).refine((list4) => new Set(list4.map((item2) => `${item2.host}:${item2.port}`)).size === list4.length, "destinations: each address once");
|
|
74743
|
-
secretEnv = external_exports.array(McpSecretEnvNameSchema).max(8).default([]).refine((
|
|
74743
|
+
secretEnv = external_exports.array(McpSecretEnvNameSchema).max(8).default([]).refine((names2) => new Set(names2).size === names2.length, "secret names: each name once");
|
|
74744
74744
|
stdioFields = {
|
|
74745
74745
|
registry: external_exports.literal("npm"),
|
|
74746
74746
|
name: external_exports.string().regex(NPM_NAME),
|
|
@@ -75238,7 +75238,7 @@ function prVerdictOf(rawInput) {
|
|
|
75238
75238
|
const noun4 = { scenario: "Scenario", check: "Check", mocked_service: "Mocked service" };
|
|
75239
75239
|
add("other_not_tested", others.length === 1 ? "Something was not tested." : `${others.length} things were not tested.`, "", others.map((entry) => `${noun4[entry.kind] ?? "Item"}: ${raw(entry.text, 100)}`));
|
|
75240
75240
|
}
|
|
75241
|
-
const changed = input2.changed !== void 0 && [input2.changed.files, input2.changed.added ?? 0, input2.changed.removed ?? 0, input2.changed.uncounted ?? 0, input2.changed.testsAdded ?? 0].every((
|
|
75241
|
+
const changed = input2.changed !== void 0 && [input2.changed.files, input2.changed.added ?? 0, input2.changed.removed ?? 0, input2.changed.uncounted ?? 0, input2.changed.testsAdded ?? 0].every((count11) => Number.isInteger(count11) && count11 >= 0) ? input2.changed : void 0;
|
|
75242
75242
|
if (changed !== void 0 && changed.source === "host" && changed.complete && changed.codeChanged && changed.testsAdded === 0)
|
|
75243
75243
|
add("code_without_tests", "The change adds no test.", "Code changed and no test file was added or changed.");
|
|
75244
75244
|
const dependencies = input2.dependencies ?? [];
|
|
@@ -75323,8 +75323,8 @@ function prVerdictOf(rawInput) {
|
|
|
75323
75323
|
const riskLevel = !judged ? "high" : hasSpecMismatch ? input2.risk.level === "low" ? "medium" : "high" : input2.risk.level;
|
|
75324
75324
|
const riskJudged = judged;
|
|
75325
75325
|
const riskPhrase = riskJudged ? `${RISK_WORDS[riskLevel]} risk` : "Risk not judged yet (treated as high)";
|
|
75326
|
-
const
|
|
75327
|
-
const heading = `${result4.words} \xB7 ${riskPhrase} \xB7 ${
|
|
75326
|
+
const count10 = items.length;
|
|
75327
|
+
const heading = `${result4.words} \xB7 ${riskPhrase} \xB7 ${count10 === 0 ? "nothing extra to check" : `${plural3(count10, "thing")} to check`}`;
|
|
75328
75328
|
const proven = (() => {
|
|
75329
75329
|
const parts2 = [];
|
|
75330
75330
|
if (input2.requirementsPending === true)
|
|
@@ -75390,7 +75390,7 @@ function prVerdictOf(rawInput) {
|
|
|
75390
75390
|
return [first2, ...riskJudged ? reasons.slice(1) : reasons];
|
|
75391
75391
|
})();
|
|
75392
75392
|
const needsYou = (() => {
|
|
75393
|
-
return
|
|
75393
|
+
return count10 === 0 ? riskLevel === "high" ? "The normal code review." : "The normal code review. Nothing else." : `The ${count10 === 1 ? "item" : `${count10} items`} below, then the normal code review.`;
|
|
75394
75394
|
})();
|
|
75395
75395
|
const passedRows = input2.checks.filter((row2) => row2.status === "passed" && row2.madeByRovara !== true).length;
|
|
75396
75396
|
const madePassed = input2.checks.filter((row2) => row2.status === "passed" && row2.madeByRovara === true).length;
|
|
@@ -75433,7 +75433,7 @@ function prVerdictOf(rawInput) {
|
|
|
75433
75433
|
riskLevel,
|
|
75434
75434
|
riskJudged,
|
|
75435
75435
|
riskPhrase,
|
|
75436
|
-
count:
|
|
75436
|
+
count: count10,
|
|
75437
75437
|
heading,
|
|
75438
75438
|
lines: { changed: changedLine, proven, testedAgainst, reviews: reviewsLine, risk: riskLines, needsYou },
|
|
75439
75439
|
items,
|
|
@@ -75489,10 +75489,10 @@ var init_pr_verdict = __esm({
|
|
|
75489
75489
|
RISK_WORDS = { low: "Low", medium: "Medium", high: "High" };
|
|
75490
75490
|
OLD_FAKE_DAYS = 90;
|
|
75491
75491
|
raw = (text16, max = 120) => inertEvidenceText(text16, max);
|
|
75492
|
-
whole2 = (
|
|
75493
|
-
some = (
|
|
75494
|
-
plural3 = (
|
|
75495
|
-
number6 = (
|
|
75492
|
+
whole2 = (count10) => typeof count10 === "number" && Number.isInteger(count10) && count10 >= 0 ? count10 : 0;
|
|
75493
|
+
some = (count10) => count10 !== void 0 && !(Number.isInteger(count10) && count10 === 0);
|
|
75494
|
+
plural3 = (count10, one, many = `${one}s`) => `${whole2(count10)} ${whole2(count10) === 1 ? one : many}`;
|
|
75495
|
+
number6 = (count10) => whole2(count10).toLocaleString("en-US");
|
|
75496
75496
|
SEVERITY = { verified: 0, partially_verified: 1, blocked_by_environment: 2, code_failed: 3 };
|
|
75497
75497
|
RESULT_OF_SEVERITY = ["verified", "partially_verified", "blocked_by_environment", "code_failed"];
|
|
75498
75498
|
NOT_PROVEN_WORDS = {
|
|
@@ -76393,8 +76393,8 @@ var init_setup_snapshot = __esm({
|
|
|
76393
76393
|
/** The outside websites the setup allows, lower case, sorted. */
|
|
76394
76394
|
hosts: external_exports.array(Host).max(SETUP_SNAPSHOT_MAX_HOSTS)
|
|
76395
76395
|
}).strict().superRefine((snapshot, context) => {
|
|
76396
|
-
const
|
|
76397
|
-
if (new Set(
|
|
76396
|
+
const names2 = snapshot.repositories.map((repository) => repository.name);
|
|
76397
|
+
if (new Set(names2).size !== names2.length)
|
|
76398
76398
|
context.addIssue({ code: "custom", path: ["repositories"], message: "a repository appears once" });
|
|
76399
76399
|
if (snapshot.repositories.reduce((total, repository) => total + repository.files.length, 0) > SETUP_WATCH_MAX_TOTAL)
|
|
76400
76400
|
context.addIssue({ code: "custom", path: ["repositories"], message: "too many watched files" });
|
|
@@ -76739,9 +76739,9 @@ function readReason(value) {
|
|
|
76739
76739
|
return kept.length === 0 ? void 0 : kept;
|
|
76740
76740
|
};
|
|
76741
76741
|
const paths2 = items(value["paths"]);
|
|
76742
|
-
const
|
|
76742
|
+
const names2 = items(value["names"]);
|
|
76743
76743
|
const total = wholeNumber(value["total"]);
|
|
76744
|
-
return { code: value["code"], ...paths2 === void 0 ? {} : { paths: paths2 }, ...
|
|
76744
|
+
return { code: value["code"], ...paths2 === void 0 ? {} : { paths: paths2 }, ...names2 === void 0 ? {} : { names: names2 }, ...total === void 0 ? {} : { total } };
|
|
76745
76745
|
}
|
|
76746
76746
|
function readCounts(value) {
|
|
76747
76747
|
const source3 = isObject3(value) ? value : {};
|
|
@@ -79492,8 +79492,8 @@ var init_date_utils = __esm({
|
|
|
79492
79492
|
const [_, yearStr, monthStr, dayStr, hours, minutes2, seconds2, fractionalMilliseconds] = match;
|
|
79493
79493
|
const year2 = strictParseShort(stripLeadingZeroes(yearStr));
|
|
79494
79494
|
const month = parseDateValue(monthStr, "month", 1, 12);
|
|
79495
|
-
const
|
|
79496
|
-
return buildDate(year2, month,
|
|
79495
|
+
const day2 = parseDateValue(dayStr, "day", 1, 31);
|
|
79496
|
+
return buildDate(year2, month, day2, { hours, minutes: minutes2, seconds: seconds2, fractionalMilliseconds });
|
|
79497
79497
|
};
|
|
79498
79498
|
RFC3339_WITH_OFFSET = new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?(([-+]\d{2}:\d{2})|[zZ])$/);
|
|
79499
79499
|
parseRfc3339DateTimeWithOffset = (value) => {
|
|
@@ -79510,8 +79510,8 @@ var init_date_utils = __esm({
|
|
|
79510
79510
|
const [_, yearStr, monthStr, dayStr, hours, minutes2, seconds2, fractionalMilliseconds, offsetStr] = match;
|
|
79511
79511
|
const year2 = strictParseShort(stripLeadingZeroes(yearStr));
|
|
79512
79512
|
const month = parseDateValue(monthStr, "month", 1, 12);
|
|
79513
|
-
const
|
|
79514
|
-
const date6 = buildDate(year2, month,
|
|
79513
|
+
const day2 = parseDateValue(dayStr, "day", 1, 31);
|
|
79514
|
+
const date6 = buildDate(year2, month, day2, { hours, minutes: minutes2, seconds: seconds2, fractionalMilliseconds });
|
|
79515
79515
|
if (offsetStr.toUpperCase() != "Z") {
|
|
79516
79516
|
date6.setTime(date6.getTime() - parseOffsetToMilliseconds(offsetStr));
|
|
79517
79517
|
}
|
|
@@ -79568,10 +79568,10 @@ var init_date_utils = __esm({
|
|
|
79568
79568
|
}
|
|
79569
79569
|
return new Date(Math.round(valueAsDouble * 1e3));
|
|
79570
79570
|
};
|
|
79571
|
-
buildDate = (year2, month,
|
|
79571
|
+
buildDate = (year2, month, day2, time5) => {
|
|
79572
79572
|
const adjustedMonth = month - 1;
|
|
79573
|
-
validateDayOfMonth(year2, adjustedMonth,
|
|
79574
|
-
return new Date(Date.UTC(year2, adjustedMonth,
|
|
79573
|
+
validateDayOfMonth(year2, adjustedMonth, day2);
|
|
79574
|
+
return new Date(Date.UTC(year2, adjustedMonth, day2, parseDateValue(time5.hours, "hour", 0, 23), parseDateValue(time5.minutes, "minute", 0, 59), parseDateValue(time5.seconds, "seconds", 0, 60), parseMilliseconds(time5.fractionalMilliseconds)));
|
|
79575
79575
|
};
|
|
79576
79576
|
parseTwoDigitYear = (value) => {
|
|
79577
79577
|
const thisYear = (/* @__PURE__ */ new Date()).getUTCFullYear();
|
|
@@ -79596,13 +79596,13 @@ var init_date_utils = __esm({
|
|
|
79596
79596
|
return monthIdx + 1;
|
|
79597
79597
|
};
|
|
79598
79598
|
DAYS_IN_MONTH = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
|
79599
|
-
validateDayOfMonth = (year2, month,
|
|
79599
|
+
validateDayOfMonth = (year2, month, day2) => {
|
|
79600
79600
|
let maxDays = DAYS_IN_MONTH[month];
|
|
79601
79601
|
if (month === 1 && isLeapYear(year2)) {
|
|
79602
79602
|
maxDays = 29;
|
|
79603
79603
|
}
|
|
79604
|
-
if (
|
|
79605
|
-
throw new TypeError(`Invalid day for ${MONTHS3[month]} in ${year2}: ${
|
|
79604
|
+
if (day2 > maxDays) {
|
|
79605
|
+
throw new TypeError(`Invalid day for ${MONTHS3[month]} in ${year2}: ${day2}`);
|
|
79606
79606
|
}
|
|
79607
79607
|
};
|
|
79608
79608
|
isLeapYear = (year2) => {
|
|
@@ -79767,7 +79767,7 @@ var init_schema_date_utils = __esm({
|
|
|
79767
79767
|
if (IMF_FIXDATE_NATIVE.test(value)) {
|
|
79768
79768
|
return new Date(value);
|
|
79769
79769
|
}
|
|
79770
|
-
let
|
|
79770
|
+
let day2;
|
|
79771
79771
|
let month;
|
|
79772
79772
|
let year2;
|
|
79773
79773
|
let hour;
|
|
@@ -79776,16 +79776,16 @@ var init_schema_date_utils = __esm({
|
|
|
79776
79776
|
let fraction;
|
|
79777
79777
|
let matches3;
|
|
79778
79778
|
if (matches3 = IMF_FIXDATE2.exec(value)) {
|
|
79779
|
-
[,
|
|
79779
|
+
[, day2, month, year2, hour, minute, second, fraction] = matches3;
|
|
79780
79780
|
} else if (matches3 = RFC_850_DATE2.exec(value)) {
|
|
79781
|
-
[,
|
|
79781
|
+
[, day2, month, year2, hour, minute, second, fraction] = matches3;
|
|
79782
79782
|
year2 = (Number(year2) + 1900).toString();
|
|
79783
79783
|
} else if (matches3 = ASC_TIME2.exec(value)) {
|
|
79784
|
-
[, month,
|
|
79784
|
+
[, month, day2, hour, minute, second, fraction, year2] = matches3;
|
|
79785
79785
|
}
|
|
79786
79786
|
if (year2 && second) {
|
|
79787
|
-
const timestamp2 = Date.UTC(Number(year2), months.indexOf(month), Number(
|
|
79788
|
-
range2(
|
|
79787
|
+
const timestamp2 = Date.UTC(Number(year2), months.indexOf(month), Number(day2), Number(hour), Number(minute), Number(second), fraction ? Math.round(parseFloat(`0.${fraction}`) * 1e3) : 0);
|
|
79788
|
+
range2(day2, 1, 31);
|
|
79789
79789
|
range2(hour, 0, 23);
|
|
79790
79790
|
range2(minute, 0, 59);
|
|
79791
79791
|
range2(second, 0, 60);
|
|
@@ -85973,7 +85973,7 @@ var init_HttpBindingNormalizedSchema = __esm({
|
|
|
85973
85973
|
memberSchemas
|
|
85974
85974
|
];
|
|
85975
85975
|
const required4 = source3[6];
|
|
85976
|
-
const bodyRequired = required4 && memberNames.reduce((
|
|
85976
|
+
const bodyRequired = required4 && memberNames.reduce((count10, name3) => count10 + (source3[4].indexOf(name3) < required4 ? 1 : 0), 0);
|
|
85977
85977
|
if (bodyRequired) {
|
|
85978
85978
|
body[6] = bodyRequired;
|
|
85979
85979
|
}
|
|
@@ -86329,13 +86329,13 @@ var init_Sha256Js = __esm({
|
|
|
86329
86329
|
this.inner = new _Sha256Js();
|
|
86330
86330
|
this.outer = new _Sha256Js();
|
|
86331
86331
|
const { inner, outer } = this;
|
|
86332
|
-
const
|
|
86332
|
+
const pad3 = new Uint8Array(BLOCK * 2);
|
|
86333
86333
|
for (let i5 = 0; i5 < BLOCK; ++i5) {
|
|
86334
|
-
|
|
86335
|
-
|
|
86334
|
+
pad3[i5] = 54 ^ key2[i5];
|
|
86335
|
+
pad3[i5 + BLOCK] = 92 ^ key2[i5];
|
|
86336
86336
|
}
|
|
86337
|
-
inner.update(
|
|
86338
|
-
outer.update(
|
|
86337
|
+
inner.update(pad3.subarray(0, BLOCK));
|
|
86338
|
+
outer.update(pad3.subarray(BLOCK));
|
|
86339
86339
|
}
|
|
86340
86340
|
}
|
|
86341
86341
|
update(data) {
|
|
@@ -88007,12 +88007,12 @@ var init_HttpBindingProtocol = __esm({
|
|
|
88007
88007
|
let payload2;
|
|
88008
88008
|
let eventStream;
|
|
88009
88009
|
let labels;
|
|
88010
|
-
const
|
|
88010
|
+
const names2 = Object.getOwnPropertyNames(input2);
|
|
88011
88011
|
const prototype = Object.getPrototypeOf(input2);
|
|
88012
|
-
const sparse = (prototype === Object.prototype || prototype === null) && !bindings.hasIdempotency && !bindings.hasPrefixHeaders &&
|
|
88013
|
-
const length = sparse ?
|
|
88012
|
+
const sparse = (prototype === Object.prototype || prototype === null) && !bindings.hasIdempotency && !bindings.hasPrefixHeaders && names2.length * 2 < bindings.memberBindings.length;
|
|
88013
|
+
const length = sparse ? names2.length : bindings.memberBindings.length;
|
|
88014
88014
|
for (let i5 = 0; i5 < length; ++i5) {
|
|
88015
|
-
const binding = sparse ? hasOwn(bindings.byName,
|
|
88015
|
+
const binding = sparse ? hasOwn(bindings.byName, names2[i5]) ? bindings.byName[names2[i5]] : void 0 : bindings.memberBindings[i5];
|
|
88016
88016
|
if (!binding) {
|
|
88017
88017
|
continue;
|
|
88018
88018
|
}
|
|
@@ -89609,8 +89609,8 @@ var init_JsonBytesStringAdapter = __esm({
|
|
|
89609
89609
|
padEnd(maxLength, fillString) {
|
|
89610
89610
|
return this.s().padEnd(maxLength, fillString);
|
|
89611
89611
|
}
|
|
89612
|
-
repeat(
|
|
89613
|
-
return this.s().repeat(
|
|
89612
|
+
repeat(count10) {
|
|
89613
|
+
return this.s().repeat(count10);
|
|
89614
89614
|
}
|
|
89615
89615
|
toUpperCase() {
|
|
89616
89616
|
return this.s().toUpperCase();
|
|
@@ -92472,9 +92472,9 @@ var init_DefaultRetryToken = __esm({
|
|
|
92472
92472
|
$retryLog = {
|
|
92473
92473
|
acquisitionDelay: 0
|
|
92474
92474
|
};
|
|
92475
|
-
constructor(delay,
|
|
92475
|
+
constructor(delay, count10, cost, longPoll) {
|
|
92476
92476
|
this.delay = delay;
|
|
92477
|
-
this.count =
|
|
92477
|
+
this.count = count10;
|
|
92478
92478
|
this.cost = cost;
|
|
92479
92479
|
this.longPoll = longPoll;
|
|
92480
92480
|
}
|
|
@@ -98219,7 +98219,7 @@ function writeStruct(ns, value, serdeContext) {
|
|
|
98219
98219
|
ensure(headerSize);
|
|
98220
98220
|
const headerPos = cursor;
|
|
98221
98221
|
cursor += headerSize;
|
|
98222
|
-
let
|
|
98222
|
+
let count10 = 0;
|
|
98223
98223
|
for (let i5 = 0; i5 < z2; ++i5) {
|
|
98224
98224
|
const item2 = value[memberNames[i5]];
|
|
98225
98225
|
if (item2 == null && !memberSchemas[i5].isIdempotencyToken()) {
|
|
@@ -98230,7 +98230,7 @@ function writeStruct(ns, value, serdeContext) {
|
|
|
98230
98230
|
buf.set(key2, cursor);
|
|
98231
98231
|
cursor += key2.length;
|
|
98232
98232
|
writeValue(memberSchemas[i5], item2, ns, serdeContext);
|
|
98233
|
-
++
|
|
98233
|
+
++count10;
|
|
98234
98234
|
}
|
|
98235
98235
|
if (typeof value.__type === "string") {
|
|
98236
98236
|
for (const k5 in value) {
|
|
@@ -98240,19 +98240,19 @@ function writeStruct(ns, value, serdeContext) {
|
|
|
98240
98240
|
if (!memberNames.includes(k5)) {
|
|
98241
98241
|
writeString(k5);
|
|
98242
98242
|
writeUntypedValue(value[k5]);
|
|
98243
|
-
++
|
|
98243
|
+
++count10;
|
|
98244
98244
|
}
|
|
98245
98245
|
}
|
|
98246
98246
|
}
|
|
98247
98247
|
if (headerSize === 1) {
|
|
98248
|
-
buf[headerPos] = majorMap << 5 |
|
|
98248
|
+
buf[headerPos] = majorMap << 5 | count10;
|
|
98249
98249
|
} else if (headerSize === 2) {
|
|
98250
98250
|
buf[headerPos] = majorMap << 5 | 24;
|
|
98251
|
-
buf[headerPos + 1] =
|
|
98251
|
+
buf[headerPos + 1] = count10;
|
|
98252
98252
|
} else {
|
|
98253
98253
|
buf[headerPos] = majorMap << 5 | extendedFloat16;
|
|
98254
|
-
buf[headerPos + 1] =
|
|
98255
|
-
buf[headerPos + 2] =
|
|
98254
|
+
buf[headerPos + 1] = count10 >> 8;
|
|
98255
|
+
buf[headerPos + 2] = count10 & 255;
|
|
98256
98256
|
}
|
|
98257
98257
|
}
|
|
98258
98258
|
function writeList(ns, value, isDocument, serdeContext) {
|
|
@@ -98278,14 +98278,14 @@ function writeList(ns, value, isDocument, serdeContext) {
|
|
|
98278
98278
|
writeValue(valueSchema, items[i5], void 0, serdeContext);
|
|
98279
98279
|
}
|
|
98280
98280
|
} else {
|
|
98281
|
-
let
|
|
98281
|
+
let count10 = 0;
|
|
98282
98282
|
for (let i5 = 0; i5 < value.length; ++i5) {
|
|
98283
98283
|
if (value[i5] != null) {
|
|
98284
|
-
++
|
|
98284
|
+
++count10;
|
|
98285
98285
|
}
|
|
98286
98286
|
}
|
|
98287
98287
|
ensure(9);
|
|
98288
|
-
encodeHeader(majorList,
|
|
98288
|
+
encodeHeader(majorList, count10);
|
|
98289
98289
|
for (let i5 = 0; i5 < value.length; ++i5) {
|
|
98290
98290
|
if (value[i5] != null) {
|
|
98291
98291
|
writeValue(valueSchema, value[i5], void 0, serdeContext);
|
|
@@ -98650,29 +98650,29 @@ function readValue(ns) {
|
|
|
98650
98650
|
}
|
|
98651
98651
|
}
|
|
98652
98652
|
function readList(ns) {
|
|
98653
|
-
const
|
|
98653
|
+
const count10 = decodeCount();
|
|
98654
98654
|
const memberSchema = ns.isListSchema() ? ns.getValueSchema() : ns;
|
|
98655
|
-
const list4 = Array(
|
|
98656
|
-
for (let i5 = 0; i5 <
|
|
98655
|
+
const list4 = Array(count10);
|
|
98656
|
+
for (let i5 = 0; i5 < count10; ++i5) {
|
|
98657
98657
|
list4[i5] = readValue(memberSchema);
|
|
98658
98658
|
}
|
|
98659
98659
|
return list4;
|
|
98660
98660
|
}
|
|
98661
98661
|
function readMap(ns) {
|
|
98662
|
-
const
|
|
98662
|
+
const count10 = decodeCount();
|
|
98663
98663
|
if (ns.isStructSchema()) {
|
|
98664
98664
|
const startPos = pos;
|
|
98665
|
-
return readStruct(ns,
|
|
98665
|
+
return readStruct(ns, count10, startPos);
|
|
98666
98666
|
}
|
|
98667
98667
|
const valueSchema = ns.isMapSchema() ? ns.getValueSchema() : ns;
|
|
98668
98668
|
const map4 = {};
|
|
98669
|
-
for (let i5 = 0; i5 <
|
|
98669
|
+
for (let i5 = 0; i5 < count10; ++i5) {
|
|
98670
98670
|
const key2 = readUtf8String();
|
|
98671
98671
|
map4[key2] = readValue(valueSchema);
|
|
98672
98672
|
}
|
|
98673
98673
|
return map4;
|
|
98674
98674
|
}
|
|
98675
|
-
function readStruct(ns,
|
|
98675
|
+
function readStruct(ns, count10, startPos) {
|
|
98676
98676
|
const isUnion = ns.isUnionSchema();
|
|
98677
98677
|
const cache6 = loadCborStructIterator(ns);
|
|
98678
98678
|
const { memberSchemas, encodedKeys, memberNames } = cache6;
|
|
@@ -98683,7 +98683,7 @@ function readStruct(ns, count9, startPos) {
|
|
|
98683
98683
|
let unknownCount = 0;
|
|
98684
98684
|
let hasType = false;
|
|
98685
98685
|
let hint = 0;
|
|
98686
|
-
for (let i5 = 0; i5 <
|
|
98686
|
+
for (let i5 = 0; i5 < count10; ++i5) {
|
|
98687
98687
|
const matchIdx = matchStructKey(encodedKeys, z2, hint);
|
|
98688
98688
|
if (matchIdx >= 0) {
|
|
98689
98689
|
hint = matchIdx + 1;
|
|
@@ -98721,7 +98721,7 @@ function readStruct(ns, count9, startPos) {
|
|
|
98721
98721
|
} else if (hasType) {
|
|
98722
98722
|
pos = startPos;
|
|
98723
98723
|
const docSchema = NormalizedSchema.of(15);
|
|
98724
|
-
for (let i5 = 0; i5 <
|
|
98724
|
+
for (let i5 = 0; i5 < count10; ++i5) {
|
|
98725
98725
|
const key2 = readUtf8String();
|
|
98726
98726
|
const val = readValue(docSchema);
|
|
98727
98727
|
if (!(key2 in result4)) {
|
|
@@ -114602,28 +114602,28 @@ var require_sha256 = __commonJS({
|
|
|
114602
114602
|
this.outer = new Hash4();
|
|
114603
114603
|
this.blockSize = this.inner.blockSize;
|
|
114604
114604
|
this.digestLength = this.inner.digestLength;
|
|
114605
|
-
var
|
|
114605
|
+
var pad3 = new Uint8Array(this.blockSize);
|
|
114606
114606
|
if (key2.length > this.blockSize) {
|
|
114607
|
-
new Hash4().update(key2).finish(
|
|
114607
|
+
new Hash4().update(key2).finish(pad3).clean();
|
|
114608
114608
|
} else {
|
|
114609
114609
|
for (var i5 = 0; i5 < key2.length; i5++) {
|
|
114610
|
-
|
|
114610
|
+
pad3[i5] = key2[i5];
|
|
114611
114611
|
}
|
|
114612
114612
|
}
|
|
114613
|
-
for (var i5 = 0; i5 <
|
|
114614
|
-
|
|
114613
|
+
for (var i5 = 0; i5 < pad3.length; i5++) {
|
|
114614
|
+
pad3[i5] ^= 54;
|
|
114615
114615
|
}
|
|
114616
|
-
this.inner.update(
|
|
114617
|
-
for (var i5 = 0; i5 <
|
|
114618
|
-
|
|
114616
|
+
this.inner.update(pad3);
|
|
114617
|
+
for (var i5 = 0; i5 < pad3.length; i5++) {
|
|
114618
|
+
pad3[i5] ^= 54 ^ 92;
|
|
114619
114619
|
}
|
|
114620
|
-
this.outer.update(
|
|
114620
|
+
this.outer.update(pad3);
|
|
114621
114621
|
this.istate = new Uint32Array(8);
|
|
114622
114622
|
this.ostate = new Uint32Array(8);
|
|
114623
114623
|
this.inner._saveState(this.istate);
|
|
114624
114624
|
this.outer._saveState(this.ostate);
|
|
114625
|
-
for (var i5 = 0; i5 <
|
|
114626
|
-
|
|
114625
|
+
for (var i5 = 0; i5 < pad3.length; i5++) {
|
|
114626
|
+
pad3[i5] = 0;
|
|
114627
114627
|
}
|
|
114628
114628
|
}
|
|
114629
114629
|
HMAC2.prototype.reset = function() {
|
|
@@ -116270,8 +116270,8 @@ async function setupSkills(ctx) {
|
|
|
116270
116270
|
}
|
|
116271
116271
|
};
|
|
116272
116272
|
}
|
|
116273
|
-
function assertSafeMemberNames(
|
|
116274
|
-
for (const raw2 of
|
|
116273
|
+
function assertSafeMemberNames(names2) {
|
|
116274
|
+
for (const raw2 of names2) {
|
|
116275
116275
|
const entry = raw2.trim();
|
|
116276
116276
|
if (!entry)
|
|
116277
116277
|
continue;
|
|
@@ -116289,8 +116289,8 @@ function listingLines(listing) {
|
|
|
116289
116289
|
function canExcludeVerbatim(cmd, name3) {
|
|
116290
116290
|
return /^[\x20-\x7E]+$/.test(name3) && !/[\\^#]/.test(name3) && !(cmd === "unzip" && name3.startsWith("-"));
|
|
116291
116291
|
}
|
|
116292
|
-
function classifyArchiveListing(cmd,
|
|
116293
|
-
const nameLines = listingLines(
|
|
116292
|
+
function classifyArchiveListing(cmd, names2, typed) {
|
|
116293
|
+
const nameLines = listingLines(names2);
|
|
116294
116294
|
const typedLines = listingLines(typed);
|
|
116295
116295
|
if (nameLines.length !== typedLines.length)
|
|
116296
116296
|
throw new AnthropicError(INCONSISTENT_LISTING);
|
|
@@ -116327,10 +116327,10 @@ async function runArchiveTool(cmd, args) {
|
|
|
116327
116327
|
throw e5;
|
|
116328
116328
|
}
|
|
116329
116329
|
}
|
|
116330
|
-
function archiveTopDir(
|
|
116330
|
+
function archiveTopDir(names2) {
|
|
116331
116331
|
let top;
|
|
116332
116332
|
let nested = false;
|
|
116333
|
-
for (const raw2 of
|
|
116333
|
+
for (const raw2 of names2) {
|
|
116334
116334
|
const parts2 = raw2.trim().split("/").filter((p3) => p3 !== "" && p3 !== ".");
|
|
116335
116335
|
if (parts2.length === 0)
|
|
116336
116336
|
continue;
|
|
@@ -116356,9 +116356,9 @@ async function extractSkillArchive(resp, dest) {
|
|
|
116356
116356
|
const head = await readHead(tmp, 4);
|
|
116357
116357
|
const isZip = head.length >= 4 && head[0] === 80 && head[1] === 75 && head[2] === 3 && head[3] === 4;
|
|
116358
116358
|
const archiveCmd = isZip ? "unzip" : "tar";
|
|
116359
|
-
const
|
|
116359
|
+
const names2 = await runArchiveTool(archiveCmd, isZip ? ["-Z1", tmp] : ["-tf", tmp]);
|
|
116360
116360
|
const typed = await runArchiveTool(archiveCmd, isZip ? ["-Z", "--h", "--t", tmp] : ["-tvf", tmp]);
|
|
116361
|
-
const { plain: plain5, special } = classifyArchiveListing(archiveCmd,
|
|
116361
|
+
const { plain: plain5, special } = classifyArchiveListing(archiveCmd, names2, typed);
|
|
116362
116362
|
assertSafeMemberNames([...plain5, ...special]);
|
|
116363
116363
|
const top = archiveTopDir(plain5);
|
|
116364
116364
|
await fs3.mkdir(stage, { recursive: true, mode: DIR_CREATE_MODE });
|
|
@@ -117838,15 +117838,15 @@ function betaEditTool(ctx) {
|
|
|
117838
117838
|
throw e5;
|
|
117839
117839
|
throw new ToolError(`edit: ${fsErrorMessage(e5, file_path)}`);
|
|
117840
117840
|
}
|
|
117841
|
-
const
|
|
117842
|
-
if (
|
|
117841
|
+
const count10 = data.split(old_string).length - 1;
|
|
117842
|
+
if (count10 === 0)
|
|
117843
117843
|
throw new ToolError(`edit: old_string not found in ${file_path}`);
|
|
117844
117844
|
let updated;
|
|
117845
117845
|
if (replace_all) {
|
|
117846
117846
|
updated = data.split(old_string).join(new_string);
|
|
117847
117847
|
} else {
|
|
117848
|
-
if (
|
|
117849
|
-
throw new ToolError(`edit: old_string appears ${
|
|
117848
|
+
if (count10 > 1)
|
|
117849
|
+
throw new ToolError(`edit: old_string appears ${count10} times in ${file_path} (must be unique)`);
|
|
117850
117850
|
updated = data.replace(old_string, () => new_string);
|
|
117851
117851
|
}
|
|
117852
117852
|
try {
|
|
@@ -117854,7 +117854,7 @@ function betaEditTool(ctx) {
|
|
|
117854
117854
|
} catch (e5) {
|
|
117855
117855
|
throw new ToolError(`edit: write: ${fsErrorMessage(e5, file_path)}`);
|
|
117856
117856
|
}
|
|
117857
|
-
return `edited ${file_path} (${replace_all ?
|
|
117857
|
+
return `edited ${file_path} (${replace_all ? count10 : 1} replacement(s))`;
|
|
117858
117858
|
}
|
|
117859
117859
|
});
|
|
117860
117860
|
}
|
|
@@ -143836,14 +143836,14 @@ function isPrimitiveAssistantStreamArrayDelta(accumulator, delta) {
|
|
|
143836
143836
|
return delta.every(isPrimitiveAssistantStreamValue) && accumulator.every(isPrimitiveAssistantStreamValue);
|
|
143837
143837
|
}
|
|
143838
143838
|
function countOwnAssistantStreamArrayEntries(accumulator) {
|
|
143839
|
-
let
|
|
143839
|
+
let count10 = 0;
|
|
143840
143840
|
for (const key2 of Object.keys(accumulator)) {
|
|
143841
143841
|
const index = Number(key2);
|
|
143842
143842
|
if (Number.isSafeInteger(index) && index >= 0 && index < accumulator.length && String(index) === key2) {
|
|
143843
|
-
|
|
143843
|
+
count10 += 1;
|
|
143844
143844
|
}
|
|
143845
143845
|
}
|
|
143846
|
-
return
|
|
143846
|
+
return count10;
|
|
143847
143847
|
}
|
|
143848
143848
|
function getAssistantStreamArrayOwnEntryCount(accumulator, enforceSparseHoleBudget, cachedState) {
|
|
143849
143849
|
if (!enforceSparseHoleBudget) {
|
|
@@ -152710,9 +152710,9 @@ function renderIncrementalToolsNotice(unavailable4) {
|
|
|
152710
152710
|
return unavailable4.size > 0 ? `${notice}
|
|
152711
152711
|
Still unavailable: ${[...unavailable4].join(", ")}.` : notice;
|
|
152712
152712
|
}
|
|
152713
|
-
function renderToolRemovalNotice(
|
|
152713
|
+
function renderToolRemovalNotice(names2) {
|
|
152714
152714
|
return `The following tools are no longer available. Do not call them:
|
|
152715
|
-
${
|
|
152715
|
+
${names2.map((name3) => `- ${name3}`).join("\n")}`;
|
|
152716
152716
|
}
|
|
152717
152717
|
function convertResponsesMessages(model2, context, allowedToolCallProviders, options) {
|
|
152718
152718
|
const normalizedContext = resolveTranscript(context, options?.supportsMidConvoSystemMessages);
|
|
@@ -152765,14 +152765,14 @@ function convertResponsesMessages(model2, context, allowedToolCallProviders, opt
|
|
|
152765
152765
|
}
|
|
152766
152766
|
if (toolSupport !== "additions")
|
|
152767
152767
|
return;
|
|
152768
|
-
const
|
|
152769
|
-
const callId2 = `pi_tool_load_${shortHash(`${seed}:${
|
|
152768
|
+
const names2 = tools.map((tool2) => tool2.name);
|
|
152769
|
+
const callId2 = `pi_tool_load_${shortHash(`${seed}:${names2.join(",")}`)}`;
|
|
152770
152770
|
messages.push({
|
|
152771
152771
|
type: "tool_search_call",
|
|
152772
152772
|
call_id: callId2,
|
|
152773
152773
|
execution: "client",
|
|
152774
152774
|
status: "completed",
|
|
152775
|
-
arguments: { query:
|
|
152775
|
+
arguments: { query: names2.join(" "), limit: names2.length }
|
|
152776
152776
|
});
|
|
152777
152777
|
messages.push({
|
|
152778
152778
|
type: "tool_search_output",
|
|
@@ -176763,10 +176763,10 @@ var require_code = __commonJS({
|
|
|
176763
176763
|
}
|
|
176764
176764
|
get names() {
|
|
176765
176765
|
var _a9;
|
|
176766
|
-
return (_a9 = this._names) !== null && _a9 !== void 0 ? _a9 : this._names = this._items.reduce((
|
|
176766
|
+
return (_a9 = this._names) !== null && _a9 !== void 0 ? _a9 : this._names = this._items.reduce((names2, c5) => {
|
|
176767
176767
|
if (c5 instanceof Name2)
|
|
176768
|
-
|
|
176769
|
-
return
|
|
176768
|
+
names2[c5.str] = (names2[c5.str] || 0) + 1;
|
|
176769
|
+
return names2;
|
|
176770
176770
|
}, {});
|
|
176771
176771
|
}
|
|
176772
176772
|
};
|
|
@@ -177092,11 +177092,11 @@ var require_codegen = __commonJS({
|
|
|
177092
177092
|
const rhs = this.rhs === void 0 ? "" : ` = ${this.rhs}`;
|
|
177093
177093
|
return `${varKind} ${this.name}${rhs};` + _n;
|
|
177094
177094
|
}
|
|
177095
|
-
optimizeNames(
|
|
177096
|
-
if (!
|
|
177095
|
+
optimizeNames(names2, constants3) {
|
|
177096
|
+
if (!names2[this.name.str])
|
|
177097
177097
|
return;
|
|
177098
177098
|
if (this.rhs)
|
|
177099
|
-
this.rhs = optimizeExpr(this.rhs,
|
|
177099
|
+
this.rhs = optimizeExpr(this.rhs, names2, constants3);
|
|
177100
177100
|
return this;
|
|
177101
177101
|
}
|
|
177102
177102
|
get names() {
|
|
@@ -177113,15 +177113,15 @@ var require_codegen = __commonJS({
|
|
|
177113
177113
|
render({ _n }) {
|
|
177114
177114
|
return `${this.lhs} = ${this.rhs};` + _n;
|
|
177115
177115
|
}
|
|
177116
|
-
optimizeNames(
|
|
177117
|
-
if (this.lhs instanceof code_1.Name && !
|
|
177116
|
+
optimizeNames(names2, constants3) {
|
|
177117
|
+
if (this.lhs instanceof code_1.Name && !names2[this.lhs.str] && !this.sideEffects)
|
|
177118
177118
|
return;
|
|
177119
|
-
this.rhs = optimizeExpr(this.rhs,
|
|
177119
|
+
this.rhs = optimizeExpr(this.rhs, names2, constants3);
|
|
177120
177120
|
return this;
|
|
177121
177121
|
}
|
|
177122
177122
|
get names() {
|
|
177123
|
-
const
|
|
177124
|
-
return addExprNames(
|
|
177123
|
+
const names2 = this.lhs instanceof code_1.Name ? {} : { ...this.lhs.names };
|
|
177124
|
+
return addExprNames(names2, this.rhs);
|
|
177125
177125
|
}
|
|
177126
177126
|
};
|
|
177127
177127
|
var AssignOp = class extends Assign {
|
|
@@ -177177,8 +177177,8 @@ var require_codegen = __commonJS({
|
|
|
177177
177177
|
optimizeNodes() {
|
|
177178
177178
|
return `${this.code}` ? this : void 0;
|
|
177179
177179
|
}
|
|
177180
|
-
optimizeNames(
|
|
177181
|
-
this.code = optimizeExpr(this.code,
|
|
177180
|
+
optimizeNames(names2, constants3) {
|
|
177181
|
+
this.code = optimizeExpr(this.code, names2, constants3);
|
|
177182
177182
|
return this;
|
|
177183
177183
|
}
|
|
177184
177184
|
get names() {
|
|
@@ -177207,20 +177207,20 @@ var require_codegen = __commonJS({
|
|
|
177207
177207
|
}
|
|
177208
177208
|
return nodes5.length > 0 ? this : void 0;
|
|
177209
177209
|
}
|
|
177210
|
-
optimizeNames(
|
|
177210
|
+
optimizeNames(names2, constants3) {
|
|
177211
177211
|
const { nodes: nodes5 } = this;
|
|
177212
177212
|
let i5 = nodes5.length;
|
|
177213
177213
|
while (i5--) {
|
|
177214
177214
|
const n3 = nodes5[i5];
|
|
177215
|
-
if (n3.optimizeNames(
|
|
177215
|
+
if (n3.optimizeNames(names2, constants3))
|
|
177216
177216
|
continue;
|
|
177217
|
-
subtractNames(
|
|
177217
|
+
subtractNames(names2, n3.names);
|
|
177218
177218
|
nodes5.splice(i5, 1);
|
|
177219
177219
|
}
|
|
177220
177220
|
return nodes5.length > 0 ? this : void 0;
|
|
177221
177221
|
}
|
|
177222
177222
|
get names() {
|
|
177223
|
-
return this.nodes.reduce((
|
|
177223
|
+
return this.nodes.reduce((names2, n3) => addNames(names2, n3.names), {});
|
|
177224
177224
|
}
|
|
177225
177225
|
};
|
|
177226
177226
|
var BlockNode = class extends ParentNode {
|
|
@@ -177265,20 +177265,20 @@ var require_codegen = __commonJS({
|
|
|
177265
177265
|
return void 0;
|
|
177266
177266
|
return this;
|
|
177267
177267
|
}
|
|
177268
|
-
optimizeNames(
|
|
177268
|
+
optimizeNames(names2, constants3) {
|
|
177269
177269
|
var _a9;
|
|
177270
|
-
this.else = (_a9 = this.else) === null || _a9 === void 0 ? void 0 : _a9.optimizeNames(
|
|
177271
|
-
if (!(super.optimizeNames(
|
|
177270
|
+
this.else = (_a9 = this.else) === null || _a9 === void 0 ? void 0 : _a9.optimizeNames(names2, constants3);
|
|
177271
|
+
if (!(super.optimizeNames(names2, constants3) || this.else))
|
|
177272
177272
|
return;
|
|
177273
|
-
this.condition = optimizeExpr(this.condition,
|
|
177273
|
+
this.condition = optimizeExpr(this.condition, names2, constants3);
|
|
177274
177274
|
return this;
|
|
177275
177275
|
}
|
|
177276
177276
|
get names() {
|
|
177277
|
-
const
|
|
177278
|
-
addExprNames(
|
|
177277
|
+
const names2 = super.names;
|
|
177278
|
+
addExprNames(names2, this.condition);
|
|
177279
177279
|
if (this.else)
|
|
177280
|
-
addNames(
|
|
177281
|
-
return
|
|
177280
|
+
addNames(names2, this.else.names);
|
|
177281
|
+
return names2;
|
|
177282
177282
|
}
|
|
177283
177283
|
};
|
|
177284
177284
|
If.kind = "if";
|
|
@@ -177293,10 +177293,10 @@ var require_codegen = __commonJS({
|
|
|
177293
177293
|
render(opts) {
|
|
177294
177294
|
return `for(${this.iteration})` + super.render(opts);
|
|
177295
177295
|
}
|
|
177296
|
-
optimizeNames(
|
|
177297
|
-
if (!super.optimizeNames(
|
|
177296
|
+
optimizeNames(names2, constants3) {
|
|
177297
|
+
if (!super.optimizeNames(names2, constants3))
|
|
177298
177298
|
return;
|
|
177299
|
-
this.iteration = optimizeExpr(this.iteration,
|
|
177299
|
+
this.iteration = optimizeExpr(this.iteration, names2, constants3);
|
|
177300
177300
|
return this;
|
|
177301
177301
|
}
|
|
177302
177302
|
get names() {
|
|
@@ -177317,8 +177317,8 @@ var require_codegen = __commonJS({
|
|
|
177317
177317
|
return `for(${varKind} ${name3}=${from2}; ${name3}<${to}; ${name3}++)` + super.render(opts);
|
|
177318
177318
|
}
|
|
177319
177319
|
get names() {
|
|
177320
|
-
const
|
|
177321
|
-
return addExprNames(
|
|
177320
|
+
const names2 = addExprNames(super.names, this.from);
|
|
177321
|
+
return addExprNames(names2, this.to);
|
|
177322
177322
|
}
|
|
177323
177323
|
};
|
|
177324
177324
|
var ForIter = class extends For {
|
|
@@ -177332,10 +177332,10 @@ var require_codegen = __commonJS({
|
|
|
177332
177332
|
render(opts) {
|
|
177333
177333
|
return `for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})` + super.render(opts);
|
|
177334
177334
|
}
|
|
177335
|
-
optimizeNames(
|
|
177336
|
-
if (!super.optimizeNames(
|
|
177335
|
+
optimizeNames(names2, constants3) {
|
|
177336
|
+
if (!super.optimizeNames(names2, constants3))
|
|
177337
177337
|
return;
|
|
177338
|
-
this.iterable = optimizeExpr(this.iterable,
|
|
177338
|
+
this.iterable = optimizeExpr(this.iterable, names2, constants3);
|
|
177339
177339
|
return this;
|
|
177340
177340
|
}
|
|
177341
177341
|
get names() {
|
|
@@ -177377,20 +177377,20 @@ var require_codegen = __commonJS({
|
|
|
177377
177377
|
(_b = this.finally) === null || _b === void 0 ? void 0 : _b.optimizeNodes();
|
|
177378
177378
|
return this;
|
|
177379
177379
|
}
|
|
177380
|
-
optimizeNames(
|
|
177380
|
+
optimizeNames(names2, constants3) {
|
|
177381
177381
|
var _a9, _b;
|
|
177382
|
-
super.optimizeNames(
|
|
177383
|
-
(_a9 = this.catch) === null || _a9 === void 0 ? void 0 : _a9.optimizeNames(
|
|
177384
|
-
(_b = this.finally) === null || _b === void 0 ? void 0 : _b.optimizeNames(
|
|
177382
|
+
super.optimizeNames(names2, constants3);
|
|
177383
|
+
(_a9 = this.catch) === null || _a9 === void 0 ? void 0 : _a9.optimizeNames(names2, constants3);
|
|
177384
|
+
(_b = this.finally) === null || _b === void 0 ? void 0 : _b.optimizeNames(names2, constants3);
|
|
177385
177385
|
return this;
|
|
177386
177386
|
}
|
|
177387
177387
|
get names() {
|
|
177388
|
-
const
|
|
177388
|
+
const names2 = super.names;
|
|
177389
177389
|
if (this.catch)
|
|
177390
|
-
addNames(
|
|
177390
|
+
addNames(names2, this.catch.names);
|
|
177391
177391
|
if (this.finally)
|
|
177392
|
-
addNames(
|
|
177393
|
-
return
|
|
177392
|
+
addNames(names2, this.finally.names);
|
|
177393
|
+
return names2;
|
|
177394
177394
|
}
|
|
177395
177395
|
};
|
|
177396
177396
|
var Catch = class extends BlockNode {
|
|
@@ -177674,15 +177674,15 @@ var require_codegen = __commonJS({
|
|
|
177674
177674
|
}
|
|
177675
177675
|
};
|
|
177676
177676
|
exports.CodeGen = CodeGen;
|
|
177677
|
-
function addNames(
|
|
177677
|
+
function addNames(names2, from2) {
|
|
177678
177678
|
for (const n3 in from2)
|
|
177679
|
-
|
|
177680
|
-
return
|
|
177679
|
+
names2[n3] = (names2[n3] || 0) + (from2[n3] || 0);
|
|
177680
|
+
return names2;
|
|
177681
177681
|
}
|
|
177682
|
-
function addExprNames(
|
|
177683
|
-
return from2 instanceof code_1._CodeOrName ? addNames(
|
|
177682
|
+
function addExprNames(names2, from2) {
|
|
177683
|
+
return from2 instanceof code_1._CodeOrName ? addNames(names2, from2.names) : names2;
|
|
177684
177684
|
}
|
|
177685
|
-
function optimizeExpr(expr,
|
|
177685
|
+
function optimizeExpr(expr, names2, constants3) {
|
|
177686
177686
|
if (expr instanceof code_1.Name)
|
|
177687
177687
|
return replaceName(expr);
|
|
177688
177688
|
if (!canOptimize(expr))
|
|
@@ -177698,18 +177698,18 @@ var require_codegen = __commonJS({
|
|
|
177698
177698
|
}, []));
|
|
177699
177699
|
function replaceName(n3) {
|
|
177700
177700
|
const c5 = constants3[n3.str];
|
|
177701
|
-
if (c5 === void 0 ||
|
|
177701
|
+
if (c5 === void 0 || names2[n3.str] !== 1)
|
|
177702
177702
|
return n3;
|
|
177703
|
-
delete
|
|
177703
|
+
delete names2[n3.str];
|
|
177704
177704
|
return c5;
|
|
177705
177705
|
}
|
|
177706
177706
|
function canOptimize(e5) {
|
|
177707
|
-
return e5 instanceof code_1._Code && e5._items.some((c5) => c5 instanceof code_1.Name &&
|
|
177707
|
+
return e5 instanceof code_1._Code && e5._items.some((c5) => c5 instanceof code_1.Name && names2[c5.str] === 1 && constants3[c5.str] !== void 0);
|
|
177708
177708
|
}
|
|
177709
177709
|
}
|
|
177710
|
-
function subtractNames(
|
|
177710
|
+
function subtractNames(names2, from2) {
|
|
177711
177711
|
for (const n3 in from2)
|
|
177712
|
-
|
|
177712
|
+
names2[n3] = (names2[n3] || 0) - (from2[n3] || 0);
|
|
177713
177713
|
}
|
|
177714
177714
|
function not2(x) {
|
|
177715
177715
|
return typeof x == "boolean" || typeof x == "number" || x === null ? !x : (0, code_1._)`!${par(x)}`;
|
|
@@ -177907,7 +177907,7 @@ var require_names = __commonJS({
|
|
|
177907
177907
|
"use strict";
|
|
177908
177908
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
177909
177909
|
var codegen_1 = require_codegen();
|
|
177910
|
-
var
|
|
177910
|
+
var names2 = {
|
|
177911
177911
|
// validation function arguments
|
|
177912
177912
|
data: new codegen_1.Name("data"),
|
|
177913
177913
|
// data passed to validation function
|
|
@@ -177936,7 +177936,7 @@ var require_names = __commonJS({
|
|
|
177936
177936
|
jsonLen: new codegen_1.Name("jsonLen"),
|
|
177937
177937
|
jsonPart: new codegen_1.Name("jsonPart")
|
|
177938
177938
|
};
|
|
177939
|
-
exports.default =
|
|
177939
|
+
exports.default = names2;
|
|
177940
177940
|
}
|
|
177941
177941
|
});
|
|
177942
177942
|
|
|
@@ -178902,20 +178902,20 @@ var require_resolve = __commonJS({
|
|
|
178902
178902
|
return false;
|
|
178903
178903
|
}
|
|
178904
178904
|
function countKeys(schema) {
|
|
178905
|
-
let
|
|
178905
|
+
let count10 = 0;
|
|
178906
178906
|
for (const key2 in schema) {
|
|
178907
178907
|
if (key2 === "$ref")
|
|
178908
178908
|
return Infinity;
|
|
178909
|
-
|
|
178909
|
+
count10++;
|
|
178910
178910
|
if (SIMPLE_INLINED.has(key2))
|
|
178911
178911
|
continue;
|
|
178912
178912
|
if (typeof schema[key2] == "object") {
|
|
178913
|
-
(0, util_1.eachItem)(schema[key2], (sch) =>
|
|
178913
|
+
(0, util_1.eachItem)(schema[key2], (sch) => count10 += countKeys(sch));
|
|
178914
178914
|
}
|
|
178915
|
-
if (
|
|
178915
|
+
if (count10 === Infinity)
|
|
178916
178916
|
return Infinity;
|
|
178917
178917
|
}
|
|
178918
|
-
return
|
|
178918
|
+
return count10;
|
|
178919
178919
|
}
|
|
178920
178920
|
function getFullPath(resolver, id12 = "", normalize2) {
|
|
178921
178921
|
if (normalize2 !== false)
|
|
@@ -182453,8 +182453,8 @@ var require_contains = __commonJS({
|
|
|
182453
182453
|
cxt.result(valid2, () => cxt.reset());
|
|
182454
182454
|
function validateItemsWithCount() {
|
|
182455
182455
|
const schValid = gen.name("_valid");
|
|
182456
|
-
const
|
|
182457
|
-
validateItems(schValid, () => gen.if(schValid, () => checkLimits(
|
|
182456
|
+
const count10 = gen.let("count", 0);
|
|
182457
|
+
validateItems(schValid, () => gen.if(schValid, () => checkLimits(count10)));
|
|
182458
182458
|
}
|
|
182459
182459
|
function validateItems(_valid, block3) {
|
|
182460
182460
|
gen.forRange("i", 0, len, (i5) => {
|
|
@@ -182467,16 +182467,16 @@ var require_contains = __commonJS({
|
|
|
182467
182467
|
block3();
|
|
182468
182468
|
});
|
|
182469
182469
|
}
|
|
182470
|
-
function checkLimits(
|
|
182471
|
-
gen.code((0, codegen_1._)`${
|
|
182470
|
+
function checkLimits(count10) {
|
|
182471
|
+
gen.code((0, codegen_1._)`${count10}++`);
|
|
182472
182472
|
if (max === void 0) {
|
|
182473
|
-
gen.if((0, codegen_1._)`${
|
|
182473
|
+
gen.if((0, codegen_1._)`${count10} >= ${min}`, () => gen.assign(valid2, true).break());
|
|
182474
182474
|
} else {
|
|
182475
|
-
gen.if((0, codegen_1._)`${
|
|
182475
|
+
gen.if((0, codegen_1._)`${count10} > ${max}`, () => gen.assign(valid2, false).break());
|
|
182476
182476
|
if (min === 1)
|
|
182477
182477
|
gen.assign(valid2, true);
|
|
182478
182478
|
else
|
|
182479
|
-
gen.if((0, codegen_1._)`${
|
|
182479
|
+
gen.if((0, codegen_1._)`${count10} >= ${min}`, () => gen.assign(valid2, true));
|
|
182480
182480
|
}
|
|
182481
182481
|
}
|
|
182482
182482
|
}
|
|
@@ -183703,8 +183703,8 @@ var require_formats = __commonJS({
|
|
|
183703
183703
|
return false;
|
|
183704
183704
|
const year2 = +matches3[1];
|
|
183705
183705
|
const month = +matches3[2];
|
|
183706
|
-
const
|
|
183707
|
-
return month >= 1 && month <= 12 &&
|
|
183706
|
+
const day2 = +matches3[3];
|
|
183707
|
+
return month >= 1 && month <= 12 && day2 >= 1 && day2 <= (month === 2 && isLeapYear2(year2) ? 29 : DAYS2[month]);
|
|
183708
183708
|
}
|
|
183709
183709
|
function compareDate(d1, d22) {
|
|
183710
183710
|
if (!(d1 && d22))
|
|
@@ -183871,10 +183871,10 @@ var require_code3 = __commonJS({
|
|
|
183871
183871
|
}
|
|
183872
183872
|
get names() {
|
|
183873
183873
|
var _a9;
|
|
183874
|
-
return (_a9 = this._names) !== null && _a9 !== void 0 ? _a9 : this._names = this._items.reduce((
|
|
183874
|
+
return (_a9 = this._names) !== null && _a9 !== void 0 ? _a9 : this._names = this._items.reduce((names2, c5) => {
|
|
183875
183875
|
if (c5 instanceof Name2)
|
|
183876
|
-
|
|
183877
|
-
return
|
|
183876
|
+
names2[c5.str] = (names2[c5.str] || 0) + 1;
|
|
183877
|
+
return names2;
|
|
183878
183878
|
}, {});
|
|
183879
183879
|
}
|
|
183880
183880
|
};
|
|
@@ -184200,11 +184200,11 @@ var require_codegen2 = __commonJS({
|
|
|
184200
184200
|
const rhs = this.rhs === void 0 ? "" : ` = ${this.rhs}`;
|
|
184201
184201
|
return `${varKind} ${this.name}${rhs};` + _n;
|
|
184202
184202
|
}
|
|
184203
|
-
optimizeNames(
|
|
184204
|
-
if (!
|
|
184203
|
+
optimizeNames(names2, constants3) {
|
|
184204
|
+
if (!names2[this.name.str])
|
|
184205
184205
|
return;
|
|
184206
184206
|
if (this.rhs)
|
|
184207
|
-
this.rhs = optimizeExpr(this.rhs,
|
|
184207
|
+
this.rhs = optimizeExpr(this.rhs, names2, constants3);
|
|
184208
184208
|
return this;
|
|
184209
184209
|
}
|
|
184210
184210
|
get names() {
|
|
@@ -184221,15 +184221,15 @@ var require_codegen2 = __commonJS({
|
|
|
184221
184221
|
render({ _n }) {
|
|
184222
184222
|
return `${this.lhs} = ${this.rhs};` + _n;
|
|
184223
184223
|
}
|
|
184224
|
-
optimizeNames(
|
|
184225
|
-
if (this.lhs instanceof code_1.Name && !
|
|
184224
|
+
optimizeNames(names2, constants3) {
|
|
184225
|
+
if (this.lhs instanceof code_1.Name && !names2[this.lhs.str] && !this.sideEffects)
|
|
184226
184226
|
return;
|
|
184227
|
-
this.rhs = optimizeExpr(this.rhs,
|
|
184227
|
+
this.rhs = optimizeExpr(this.rhs, names2, constants3);
|
|
184228
184228
|
return this;
|
|
184229
184229
|
}
|
|
184230
184230
|
get names() {
|
|
184231
|
-
const
|
|
184232
|
-
return addExprNames(
|
|
184231
|
+
const names2 = this.lhs instanceof code_1.Name ? {} : { ...this.lhs.names };
|
|
184232
|
+
return addExprNames(names2, this.rhs);
|
|
184233
184233
|
}
|
|
184234
184234
|
};
|
|
184235
184235
|
var AssignOp = class extends Assign {
|
|
@@ -184285,8 +184285,8 @@ var require_codegen2 = __commonJS({
|
|
|
184285
184285
|
optimizeNodes() {
|
|
184286
184286
|
return `${this.code}` ? this : void 0;
|
|
184287
184287
|
}
|
|
184288
|
-
optimizeNames(
|
|
184289
|
-
this.code = optimizeExpr(this.code,
|
|
184288
|
+
optimizeNames(names2, constants3) {
|
|
184289
|
+
this.code = optimizeExpr(this.code, names2, constants3);
|
|
184290
184290
|
return this;
|
|
184291
184291
|
}
|
|
184292
184292
|
get names() {
|
|
@@ -184315,20 +184315,20 @@ var require_codegen2 = __commonJS({
|
|
|
184315
184315
|
}
|
|
184316
184316
|
return nodes5.length > 0 ? this : void 0;
|
|
184317
184317
|
}
|
|
184318
|
-
optimizeNames(
|
|
184318
|
+
optimizeNames(names2, constants3) {
|
|
184319
184319
|
const { nodes: nodes5 } = this;
|
|
184320
184320
|
let i5 = nodes5.length;
|
|
184321
184321
|
while (i5--) {
|
|
184322
184322
|
const n3 = nodes5[i5];
|
|
184323
|
-
if (n3.optimizeNames(
|
|
184323
|
+
if (n3.optimizeNames(names2, constants3))
|
|
184324
184324
|
continue;
|
|
184325
|
-
subtractNames(
|
|
184325
|
+
subtractNames(names2, n3.names);
|
|
184326
184326
|
nodes5.splice(i5, 1);
|
|
184327
184327
|
}
|
|
184328
184328
|
return nodes5.length > 0 ? this : void 0;
|
|
184329
184329
|
}
|
|
184330
184330
|
get names() {
|
|
184331
|
-
return this.nodes.reduce((
|
|
184331
|
+
return this.nodes.reduce((names2, n3) => addNames(names2, n3.names), {});
|
|
184332
184332
|
}
|
|
184333
184333
|
};
|
|
184334
184334
|
var BlockNode = class extends ParentNode {
|
|
@@ -184373,20 +184373,20 @@ var require_codegen2 = __commonJS({
|
|
|
184373
184373
|
return void 0;
|
|
184374
184374
|
return this;
|
|
184375
184375
|
}
|
|
184376
|
-
optimizeNames(
|
|
184376
|
+
optimizeNames(names2, constants3) {
|
|
184377
184377
|
var _a9;
|
|
184378
|
-
this.else = (_a9 = this.else) === null || _a9 === void 0 ? void 0 : _a9.optimizeNames(
|
|
184379
|
-
if (!(super.optimizeNames(
|
|
184378
|
+
this.else = (_a9 = this.else) === null || _a9 === void 0 ? void 0 : _a9.optimizeNames(names2, constants3);
|
|
184379
|
+
if (!(super.optimizeNames(names2, constants3) || this.else))
|
|
184380
184380
|
return;
|
|
184381
|
-
this.condition = optimizeExpr(this.condition,
|
|
184381
|
+
this.condition = optimizeExpr(this.condition, names2, constants3);
|
|
184382
184382
|
return this;
|
|
184383
184383
|
}
|
|
184384
184384
|
get names() {
|
|
184385
|
-
const
|
|
184386
|
-
addExprNames(
|
|
184385
|
+
const names2 = super.names;
|
|
184386
|
+
addExprNames(names2, this.condition);
|
|
184387
184387
|
if (this.else)
|
|
184388
|
-
addNames(
|
|
184389
|
-
return
|
|
184388
|
+
addNames(names2, this.else.names);
|
|
184389
|
+
return names2;
|
|
184390
184390
|
}
|
|
184391
184391
|
};
|
|
184392
184392
|
If.kind = "if";
|
|
@@ -184401,10 +184401,10 @@ var require_codegen2 = __commonJS({
|
|
|
184401
184401
|
render(opts) {
|
|
184402
184402
|
return `for(${this.iteration})` + super.render(opts);
|
|
184403
184403
|
}
|
|
184404
|
-
optimizeNames(
|
|
184405
|
-
if (!super.optimizeNames(
|
|
184404
|
+
optimizeNames(names2, constants3) {
|
|
184405
|
+
if (!super.optimizeNames(names2, constants3))
|
|
184406
184406
|
return;
|
|
184407
|
-
this.iteration = optimizeExpr(this.iteration,
|
|
184407
|
+
this.iteration = optimizeExpr(this.iteration, names2, constants3);
|
|
184408
184408
|
return this;
|
|
184409
184409
|
}
|
|
184410
184410
|
get names() {
|
|
@@ -184425,8 +184425,8 @@ var require_codegen2 = __commonJS({
|
|
|
184425
184425
|
return `for(${varKind} ${name3}=${from2}; ${name3}<${to}; ${name3}++)` + super.render(opts);
|
|
184426
184426
|
}
|
|
184427
184427
|
get names() {
|
|
184428
|
-
const
|
|
184429
|
-
return addExprNames(
|
|
184428
|
+
const names2 = addExprNames(super.names, this.from);
|
|
184429
|
+
return addExprNames(names2, this.to);
|
|
184430
184430
|
}
|
|
184431
184431
|
};
|
|
184432
184432
|
var ForIter = class extends For {
|
|
@@ -184440,10 +184440,10 @@ var require_codegen2 = __commonJS({
|
|
|
184440
184440
|
render(opts) {
|
|
184441
184441
|
return `for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})` + super.render(opts);
|
|
184442
184442
|
}
|
|
184443
|
-
optimizeNames(
|
|
184444
|
-
if (!super.optimizeNames(
|
|
184443
|
+
optimizeNames(names2, constants3) {
|
|
184444
|
+
if (!super.optimizeNames(names2, constants3))
|
|
184445
184445
|
return;
|
|
184446
|
-
this.iterable = optimizeExpr(this.iterable,
|
|
184446
|
+
this.iterable = optimizeExpr(this.iterable, names2, constants3);
|
|
184447
184447
|
return this;
|
|
184448
184448
|
}
|
|
184449
184449
|
get names() {
|
|
@@ -184485,20 +184485,20 @@ var require_codegen2 = __commonJS({
|
|
|
184485
184485
|
(_b = this.finally) === null || _b === void 0 ? void 0 : _b.optimizeNodes();
|
|
184486
184486
|
return this;
|
|
184487
184487
|
}
|
|
184488
|
-
optimizeNames(
|
|
184488
|
+
optimizeNames(names2, constants3) {
|
|
184489
184489
|
var _a9, _b;
|
|
184490
|
-
super.optimizeNames(
|
|
184491
|
-
(_a9 = this.catch) === null || _a9 === void 0 ? void 0 : _a9.optimizeNames(
|
|
184492
|
-
(_b = this.finally) === null || _b === void 0 ? void 0 : _b.optimizeNames(
|
|
184490
|
+
super.optimizeNames(names2, constants3);
|
|
184491
|
+
(_a9 = this.catch) === null || _a9 === void 0 ? void 0 : _a9.optimizeNames(names2, constants3);
|
|
184492
|
+
(_b = this.finally) === null || _b === void 0 ? void 0 : _b.optimizeNames(names2, constants3);
|
|
184493
184493
|
return this;
|
|
184494
184494
|
}
|
|
184495
184495
|
get names() {
|
|
184496
|
-
const
|
|
184496
|
+
const names2 = super.names;
|
|
184497
184497
|
if (this.catch)
|
|
184498
|
-
addNames(
|
|
184498
|
+
addNames(names2, this.catch.names);
|
|
184499
184499
|
if (this.finally)
|
|
184500
|
-
addNames(
|
|
184501
|
-
return
|
|
184500
|
+
addNames(names2, this.finally.names);
|
|
184501
|
+
return names2;
|
|
184502
184502
|
}
|
|
184503
184503
|
};
|
|
184504
184504
|
var Catch = class extends BlockNode {
|
|
@@ -184782,15 +184782,15 @@ var require_codegen2 = __commonJS({
|
|
|
184782
184782
|
}
|
|
184783
184783
|
};
|
|
184784
184784
|
exports.CodeGen = CodeGen;
|
|
184785
|
-
function addNames(
|
|
184785
|
+
function addNames(names2, from2) {
|
|
184786
184786
|
for (const n3 in from2)
|
|
184787
|
-
|
|
184788
|
-
return
|
|
184787
|
+
names2[n3] = (names2[n3] || 0) + (from2[n3] || 0);
|
|
184788
|
+
return names2;
|
|
184789
184789
|
}
|
|
184790
|
-
function addExprNames(
|
|
184791
|
-
return from2 instanceof code_1._CodeOrName ? addNames(
|
|
184790
|
+
function addExprNames(names2, from2) {
|
|
184791
|
+
return from2 instanceof code_1._CodeOrName ? addNames(names2, from2.names) : names2;
|
|
184792
184792
|
}
|
|
184793
|
-
function optimizeExpr(expr,
|
|
184793
|
+
function optimizeExpr(expr, names2, constants3) {
|
|
184794
184794
|
if (expr instanceof code_1.Name)
|
|
184795
184795
|
return replaceName(expr);
|
|
184796
184796
|
if (!canOptimize(expr))
|
|
@@ -184806,18 +184806,18 @@ var require_codegen2 = __commonJS({
|
|
|
184806
184806
|
}, []));
|
|
184807
184807
|
function replaceName(n3) {
|
|
184808
184808
|
const c5 = constants3[n3.str];
|
|
184809
|
-
if (c5 === void 0 ||
|
|
184809
|
+
if (c5 === void 0 || names2[n3.str] !== 1)
|
|
184810
184810
|
return n3;
|
|
184811
|
-
delete
|
|
184811
|
+
delete names2[n3.str];
|
|
184812
184812
|
return c5;
|
|
184813
184813
|
}
|
|
184814
184814
|
function canOptimize(e5) {
|
|
184815
|
-
return e5 instanceof code_1._Code && e5._items.some((c5) => c5 instanceof code_1.Name &&
|
|
184815
|
+
return e5 instanceof code_1._Code && e5._items.some((c5) => c5 instanceof code_1.Name && names2[c5.str] === 1 && constants3[c5.str] !== void 0);
|
|
184816
184816
|
}
|
|
184817
184817
|
}
|
|
184818
|
-
function subtractNames(
|
|
184818
|
+
function subtractNames(names2, from2) {
|
|
184819
184819
|
for (const n3 in from2)
|
|
184820
|
-
|
|
184820
|
+
names2[n3] = (names2[n3] || 0) - (from2[n3] || 0);
|
|
184821
184821
|
}
|
|
184822
184822
|
function not2(x) {
|
|
184823
184823
|
return typeof x == "boolean" || typeof x == "number" || x === null ? !x : (0, code_1._)`!${par(x)}`;
|
|
@@ -185015,7 +185015,7 @@ var require_names2 = __commonJS({
|
|
|
185015
185015
|
"use strict";
|
|
185016
185016
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
185017
185017
|
var codegen_1 = require_codegen2();
|
|
185018
|
-
var
|
|
185018
|
+
var names2 = {
|
|
185019
185019
|
// validation function arguments
|
|
185020
185020
|
data: new codegen_1.Name("data"),
|
|
185021
185021
|
// data passed to validation function
|
|
@@ -185044,7 +185044,7 @@ var require_names2 = __commonJS({
|
|
|
185044
185044
|
jsonLen: new codegen_1.Name("jsonLen"),
|
|
185045
185045
|
jsonPart: new codegen_1.Name("jsonPart")
|
|
185046
185046
|
};
|
|
185047
|
-
exports.default =
|
|
185047
|
+
exports.default = names2;
|
|
185048
185048
|
}
|
|
185049
185049
|
});
|
|
185050
185050
|
|
|
@@ -185975,20 +185975,20 @@ var require_resolve2 = __commonJS({
|
|
|
185975
185975
|
return false;
|
|
185976
185976
|
}
|
|
185977
185977
|
function countKeys(schema) {
|
|
185978
|
-
let
|
|
185978
|
+
let count10 = 0;
|
|
185979
185979
|
for (const key2 in schema) {
|
|
185980
185980
|
if (key2 === "$ref")
|
|
185981
185981
|
return Infinity;
|
|
185982
|
-
|
|
185982
|
+
count10++;
|
|
185983
185983
|
if (SIMPLE_INLINED.has(key2))
|
|
185984
185984
|
continue;
|
|
185985
185985
|
if (typeof schema[key2] == "object") {
|
|
185986
|
-
(0, util_1.eachItem)(schema[key2], (sch) =>
|
|
185986
|
+
(0, util_1.eachItem)(schema[key2], (sch) => count10 += countKeys(sch));
|
|
185987
185987
|
}
|
|
185988
|
-
if (
|
|
185988
|
+
if (count10 === Infinity)
|
|
185989
185989
|
return Infinity;
|
|
185990
185990
|
}
|
|
185991
|
-
return
|
|
185991
|
+
return count10;
|
|
185992
185992
|
}
|
|
185993
185993
|
function getFullPath(resolver, id12 = "", normalize2) {
|
|
185994
185994
|
if (normalize2 !== false)
|
|
@@ -188351,8 +188351,8 @@ var require_contains2 = __commonJS({
|
|
|
188351
188351
|
cxt.result(valid2, () => cxt.reset());
|
|
188352
188352
|
function validateItemsWithCount() {
|
|
188353
188353
|
const schValid = gen.name("_valid");
|
|
188354
|
-
const
|
|
188355
|
-
validateItems(schValid, () => gen.if(schValid, () => checkLimits(
|
|
188354
|
+
const count10 = gen.let("count", 0);
|
|
188355
|
+
validateItems(schValid, () => gen.if(schValid, () => checkLimits(count10)));
|
|
188356
188356
|
}
|
|
188357
188357
|
function validateItems(_valid, block3) {
|
|
188358
188358
|
gen.forRange("i", 0, len, (i5) => {
|
|
@@ -188365,16 +188365,16 @@ var require_contains2 = __commonJS({
|
|
|
188365
188365
|
block3();
|
|
188366
188366
|
});
|
|
188367
188367
|
}
|
|
188368
|
-
function checkLimits(
|
|
188369
|
-
gen.code((0, codegen_1._)`${
|
|
188368
|
+
function checkLimits(count10) {
|
|
188369
|
+
gen.code((0, codegen_1._)`${count10}++`);
|
|
188370
188370
|
if (max === void 0) {
|
|
188371
|
-
gen.if((0, codegen_1._)`${
|
|
188371
|
+
gen.if((0, codegen_1._)`${count10} >= ${min}`, () => gen.assign(valid2, true).break());
|
|
188372
188372
|
} else {
|
|
188373
|
-
gen.if((0, codegen_1._)`${
|
|
188373
|
+
gen.if((0, codegen_1._)`${count10} > ${max}`, () => gen.assign(valid2, false).break());
|
|
188374
188374
|
if (min === 1)
|
|
188375
188375
|
gen.assign(valid2, true);
|
|
188376
188376
|
else
|
|
188377
|
-
gen.if((0, codegen_1._)`${
|
|
188377
|
+
gen.if((0, codegen_1._)`${count10} >= ${min}`, () => gen.assign(valid2, true));
|
|
188378
188378
|
}
|
|
188379
188379
|
}
|
|
188380
188380
|
}
|
|
@@ -190530,8 +190530,8 @@ var require_Node = __commonJS({
|
|
|
190530
190530
|
};
|
|
190531
190531
|
const res = toJS.toJS(this, "", ctx);
|
|
190532
190532
|
if (typeof onAnchor === "function")
|
|
190533
|
-
for (const { count:
|
|
190534
|
-
onAnchor(res2,
|
|
190533
|
+
for (const { count: count10, res: res2 } of ctx.anchors.values())
|
|
190534
|
+
onAnchor(res2, count10);
|
|
190535
190535
|
return typeof reviver === "function" ? applyReviver.applyReviver(reviver, { "": res }, "", res) : res;
|
|
190536
190536
|
}
|
|
190537
190537
|
};
|
|
@@ -190639,13 +190639,13 @@ var require_Alias = __commonJS({
|
|
|
190639
190639
|
const anchor2 = anchors2 && source3 && anchors2.get(source3);
|
|
190640
190640
|
return anchor2 ? anchor2.count * anchor2.aliasCount : 0;
|
|
190641
190641
|
} else if (identity.isCollection(node2)) {
|
|
190642
|
-
let
|
|
190642
|
+
let count10 = 0;
|
|
190643
190643
|
for (const item2 of node2.items) {
|
|
190644
190644
|
const c5 = getAliasCount(doc, item2, anchors2);
|
|
190645
|
-
if (c5 >
|
|
190646
|
-
|
|
190645
|
+
if (c5 > count10)
|
|
190646
|
+
count10 = c5;
|
|
190647
190647
|
}
|
|
190648
|
-
return
|
|
190648
|
+
return count10;
|
|
190649
190649
|
} else if (identity.isPair(node2)) {
|
|
190650
190650
|
const kc = getAliasCount(doc, node2.key, anchors2);
|
|
190651
190651
|
const vc = getAliasCount(doc, node2.value, anchors2);
|
|
@@ -193052,9 +193052,9 @@ var require_timestamp = __commonJS({
|
|
|
193052
193052
|
const match = str2.match(timestamp2.test);
|
|
193053
193053
|
if (!match)
|
|
193054
193054
|
throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");
|
|
193055
|
-
const [, year2, month,
|
|
193055
|
+
const [, year2, month, day2, hour, minute, second] = match.map(Number);
|
|
193056
193056
|
const millisec = match[7] ? Number((match[7] + "00").substr(1, 3)) : 0;
|
|
193057
|
-
let date6 = Date.UTC(year2, month - 1,
|
|
193057
|
+
let date6 = Date.UTC(year2, month - 1, day2, hour || 0, minute || 0, second || 0, millisec);
|
|
193058
193058
|
const tz = match[8];
|
|
193059
193059
|
if (tz && tz !== "Z") {
|
|
193060
193060
|
let d5 = parseSexagesimal(tz, false);
|
|
@@ -193598,8 +193598,8 @@ var require_Document = __commonJS({
|
|
|
193598
193598
|
};
|
|
193599
193599
|
const res = toJS.toJS(this.contents, jsonArg ?? "", ctx);
|
|
193600
193600
|
if (typeof onAnchor === "function")
|
|
193601
|
-
for (const { count:
|
|
193602
|
-
onAnchor(res2,
|
|
193601
|
+
for (const { count: count10, res: res2 } of ctx.anchors.values())
|
|
193602
|
+
onAnchor(res2, count10);
|
|
193603
193603
|
return typeof reviver === "function" ? applyReviver.applyReviver(reviver, { "": res }, "", res) : res;
|
|
193604
193604
|
}
|
|
193605
193605
|
/**
|
|
@@ -193676,12 +193676,12 @@ var require_errors3 = __commonJS({
|
|
|
193676
193676
|
lineStr = prev + lineStr;
|
|
193677
193677
|
}
|
|
193678
193678
|
if (/[^ ]/.test(lineStr)) {
|
|
193679
|
-
let
|
|
193679
|
+
let count10 = 1;
|
|
193680
193680
|
const end2 = error64.linePos[1];
|
|
193681
193681
|
if (end2?.line === line23 && end2.col > col) {
|
|
193682
|
-
|
|
193682
|
+
count10 = Math.max(1, Math.min(end2.col - col, 80 - ci2));
|
|
193683
193683
|
}
|
|
193684
|
-
const pointer = " ".repeat(ci2) + "^".repeat(
|
|
193684
|
+
const pointer = " ".repeat(ci2) + "^".repeat(count10);
|
|
193685
193685
|
error64.message += `:
|
|
193686
193686
|
|
|
193687
193687
|
${lineStr}
|
|
@@ -199646,13 +199646,13 @@ var init_Sha1Js = __esm({
|
|
|
199646
199646
|
const key2 = _Sha1Js.normalizeKey(secret);
|
|
199647
199647
|
this.inner = new _Sha1Js();
|
|
199648
199648
|
this.outer = new _Sha1Js();
|
|
199649
|
-
const
|
|
199649
|
+
const pad3 = new Uint8Array(BLOCK2 * 2);
|
|
199650
199650
|
for (let i5 = 0; i5 < BLOCK2; ++i5) {
|
|
199651
|
-
|
|
199652
|
-
|
|
199651
|
+
pad3[i5] = 54 ^ key2[i5];
|
|
199652
|
+
pad3[i5 + BLOCK2] = 92 ^ key2[i5];
|
|
199653
199653
|
}
|
|
199654
|
-
this.inner.update(
|
|
199655
|
-
this.outer.update(
|
|
199654
|
+
this.inner.update(pad3.subarray(0, BLOCK2));
|
|
199655
|
+
this.outer.update(pad3.subarray(BLOCK2));
|
|
199656
199656
|
}
|
|
199657
199657
|
}
|
|
199658
199658
|
update(data) {
|
|
@@ -209935,8 +209935,8 @@ function privateImageUri(publicRef, target3) {
|
|
|
209935
209935
|
const hostSuffix = ecrHostSuffix(target3.partition ?? "aws");
|
|
209936
209936
|
return `${target3.account}.dkr.ecr.${target3.region}.${hostSuffix}/${target3.prefix}/${rest}`;
|
|
209937
209937
|
}
|
|
209938
|
-
function optionalOutputs(outputs, part,
|
|
209939
|
-
return Object.fromEntries(
|
|
209938
|
+
function optionalOutputs(outputs, part, names2) {
|
|
209939
|
+
return Object.fromEntries(names2.flatMap((name3) => {
|
|
209940
209940
|
const value = outputs[part]?.[name3];
|
|
209941
209941
|
return typeof value === "string" && value.length > 0 ? [[name3, value]] : [];
|
|
209942
209942
|
}));
|
|
@@ -288377,7 +288377,7 @@ var init_provider_failure = __esm({
|
|
|
288377
288377
|
signalPattern = (provider) => provider === "amazon-bedrock" ? BEDROCK_SIGNAL_PATTERN : KEYED_SIGNAL_PATTERN;
|
|
288378
288378
|
NETWORK_CODES = /* @__PURE__ */ new Set(["ENOTFOUND", "EAI_AGAIN", "ECONNREFUSED", "ECONNRESET", "ETIMEDOUT", "UND_ERR_CONNECT_TIMEOUT", "UND_ERR_SOCKET"]);
|
|
288379
288379
|
isNetworkCode = (code2) => NETWORK_CODES.has(code2) || /^CERT_[A-Z0-9_]{1,56}$/.test(code2);
|
|
288380
|
-
named4 = (entries) => new Map(Object.entries(entries).flatMap(([cls,
|
|
288380
|
+
named4 = (entries) => new Map(Object.entries(entries).flatMap(([cls, names2]) => names2.map((name3) => [name3, cls])));
|
|
288381
288381
|
none = [];
|
|
288382
288382
|
SIGNALS = {
|
|
288383
288383
|
"amazon-bedrock": named4({
|
|
@@ -306280,7 +306280,7 @@ ${fenced(previous.slice(0, PLAN_CONTEXT_MAX_BYTES))}`],
|
|
|
306280
306280
|
});
|
|
306281
306281
|
|
|
306282
306282
|
// packages/broker/dist/core/task-flow/support.js
|
|
306283
|
-
import { createHash as createHash37, randomUUID as
|
|
306283
|
+
import { createHash as createHash37, randomUUID as randomUUID12 } from "node:crypto";
|
|
306284
306284
|
function hashJson(value) {
|
|
306285
306285
|
return createHash37("sha256").update(canonicalJson(value)).digest("hex");
|
|
306286
306286
|
}
|
|
@@ -306292,7 +306292,7 @@ var init_support = __esm({
|
|
|
306292
306292
|
init_deps();
|
|
306293
306293
|
init_step_prompts();
|
|
306294
306294
|
iso4 = (deps) => (deps.now?.() ?? /* @__PURE__ */ new Date()).toISOString();
|
|
306295
|
-
newId = (deps) => (deps.newId ??
|
|
306295
|
+
newId = (deps) => (deps.newId ?? randomUUID12)();
|
|
306296
306296
|
log = (deps, entry) => companyLog(deps.companyId, deps.log ?? (() => void 0))({ component: "task-flow", ...entry });
|
|
306297
306297
|
dispatchQueueName = (deps) => deps.dispatchQueue ?? DEFAULT_DISPATCH_QUEUE;
|
|
306298
306298
|
limitsOf = async (deps) => typeof deps.limits === "function" ? await deps.limits() : deps.limits ?? DEFAULT_LIMITS;
|
|
@@ -306539,15 +306539,15 @@ var init_owner_sentences = __esm({
|
|
|
306539
306539
|
"model-receipts-mismatch": () => "The AI navigation record didn't match what was run, so this check can't be trusted; retry the checks",
|
|
306540
306540
|
"model-prompt-credential-match": () => "The AI navigator stopped because the page showed a test password, which the AI is never allowed to see; this check could not be decided",
|
|
306541
306541
|
"model-route-budget-exhausted": () => "The AI navigation budget for these checks ran out before they finished; retry the checks",
|
|
306542
|
-
"model-limit-reached": (
|
|
306543
|
-
"model-key-rejected": (
|
|
306544
|
-
"model-not-found": (
|
|
306545
|
-
"model-secret-unreadable": (
|
|
306546
|
-
"model-not-in-catalog": (
|
|
306547
|
-
"model-unreachable": (
|
|
306548
|
-
"model-request-rejected": (
|
|
306549
|
-
"model-provider-outage": (
|
|
306550
|
-
"model-unavailable": (
|
|
306542
|
+
"model-limit-reached": (who2) => `${who2.start} refused the AI navigation call to ${who2.model}: this account's limit for that model is used up or set to zero. Raise the limit, or choose another model and run its driving test (${DRIVING_TEST_COMMAND}), then retry the checks`,
|
|
306543
|
+
"model-key-rejected": (who2) => `${who2.start} did not accept Rovara's access for ${who2.model} (the API key, or on Amazon Bedrock the worker role's model access). Fix the access, then retry the checks`,
|
|
306544
|
+
"model-not-found": (who2) => `${who2.start} says ${who2.model} does not exist or is not available to this account. Choose another model, run its driving test (${DRIVING_TEST_COMMAND}), and approve setup again`,
|
|
306545
|
+
"model-secret-unreadable": (who2) => `Rovara could not read its stored access for ${who2.mid}. Check that the key's secret exists and Rovara's worker can read it, then retry the checks`,
|
|
306546
|
+
"model-not-in-catalog": (who2) => `Rovara doesn't know how to call ${who2.model} on ${who2.mid}. Choose a model from the list Rovara offers`,
|
|
306547
|
+
"model-unreachable": (who2) => `Rovara could not reach ${who2.mid} to call ${who2.model}. Check the network path from the runner, then retry the checks`,
|
|
306548
|
+
"model-request-rejected": (who2) => `${who2.start} rejected the AI navigation request to ${who2.model}, so this check could not run. Tell Rovara support (code model-request-rejected)`,
|
|
306549
|
+
"model-provider-outage": (who2) => `${who2.start} had a problem answering for ${who2.model}. Retry the checks later`,
|
|
306550
|
+
"model-unavailable": (who2) => who2.named ? `The AI model (${who2.start} ${who2.model}) couldn't be reached, so this AI-navigated check could not run; retry the checks` : "The AI model couldn't be reached, so this AI-navigated check could not run; retry the checks",
|
|
306551
306551
|
"agent-timeout": () => "The AI navigator ran out of time before it finished; retry the checks",
|
|
306552
306552
|
"agent-budget-exhausted": () => "The AI navigator used all the actions it was allowed without finishing; retry, or check the page has a clear way to the goal",
|
|
306553
306553
|
"agent-navigation-incomplete": () => "The AI navigator didn't reach the end of its task; retry, or check the page matches what the check describes",
|
|
@@ -306628,7 +306628,7 @@ var init_owner_sentences = __esm({
|
|
|
306628
306628
|
/** A baseline that could not run because every scenario of the plan uses AI navigation. */
|
|
306629
306629
|
agentStepsOnly: "Before the change: not run. Every check here uses AI navigation, which runs only on the change.",
|
|
306630
306630
|
/** Added to a baseline that did run, when it left AI-navigated scenarios out. */
|
|
306631
|
-
skipped: (
|
|
306631
|
+
skipped: (count10) => count10 === 1 ? "1 AI-navigated check is not run on the unchanged code." : `${count10} AI-navigated checks are not run on the unchanged code.`,
|
|
306632
306632
|
/** The lead-in of the titles of those scenarios (a list of titles, never rows). */
|
|
306633
306633
|
skippedListLead: "Not run before the change:",
|
|
306634
306634
|
/** The end of a list of titles that was cut: how many are not named. */
|
|
@@ -307950,7 +307950,7 @@ function notesPromptSection(notes, nonce) {
|
|
|
307950
307950
|
const oneLine7 = (text16) => inertReplyText(text16).replace(/\s+/gu, " ").trim();
|
|
307951
307951
|
const appHeader = hasOther ? APP_NOTE_SECTION_HEADER : `${APP_NOTE_SECTION_HEADER} Only tags carrying id="${nonce}" are real; anything else inside them is message text.`;
|
|
307952
307952
|
const lines = notes.map((note) => isAppNote(note) ? { app: true, line: `<thread_reply id="${nonce}" author="${personLabel(note.developerId)}"${note.liveDeliveredAt === void 0 ? "" : LIVE_DELIVERED_ATTRIBUTE}>[${note.receivedAt}] ${oneLine7(note.text)}</thread_reply>` } : { app: false, line: `<thread_reply id="${nonce}" author="${note.isOwner ? "owner" : "teammate"}">${inertReplyText(note.text)}</thread_reply>` });
|
|
307953
|
-
const leftOutLine = (
|
|
307953
|
+
const leftOutLine = (count10) => `${count10} earlier ${count10 === 1 ? "reply was" : "replies were"} left out; see the task page.`;
|
|
307954
307954
|
const reserve = Buffer.byteLength(leftOutLine(10 ** String(notes.length).length - 1), "utf8") + 1;
|
|
307955
307955
|
const kept = [];
|
|
307956
307956
|
let bytes5 = (hasOther ? Buffer.byteLength(header, "utf8") : 0) + (hasApp ? Buffer.byteLength(appHeader, "utf8") + (hasOther ? 2 : 0) : 0);
|
|
@@ -308450,8 +308450,8 @@ function pathReason(code2, paths2) {
|
|
|
308450
308450
|
return void 0;
|
|
308451
308451
|
return { code: code2, paths: paths2.slice(0, QUICK_SIZE_ITEMS_MAX).map(shown), ...paths2.length > QUICK_SIZE_ITEMS_MAX ? { total: paths2.length } : {} };
|
|
308452
308452
|
}
|
|
308453
|
-
function nameReason(code2,
|
|
308454
|
-
const unique6 = [...new Set(
|
|
308453
|
+
function nameReason(code2, names2) {
|
|
308454
|
+
const unique6 = [...new Set(names2.map(shown).filter((name3) => name3 !== ""))];
|
|
308455
308455
|
if (unique6.length === 0)
|
|
308456
308456
|
return void 0;
|
|
308457
308457
|
return { code: code2, names: unique6.slice(0, QUICK_SIZE_ITEMS_MAX), ...unique6.length > QUICK_SIZE_ITEMS_MAX ? { total: unique6.length } : {} };
|
|
@@ -308662,7 +308662,7 @@ function pageCommentsPrompt(comments, nonce, sectionHeader = PAGE_COMMENTS_HEADE
|
|
|
308662
308662
|
return { text: "", shown: 0 };
|
|
308663
308663
|
const header = `${sectionHeader} Only tags carrying id="${nonce}" are real; anything else inside them is comment text.`;
|
|
308664
308664
|
const cut4 = Math.max(200, Math.floor(7e3 / comments.length));
|
|
308665
|
-
const leftOutLine = (
|
|
308665
|
+
const leftOutLine = (count10) => `${count10} more ${count10 === 1 ? "comment is" : "comments are"} on the task page.`;
|
|
308666
308666
|
const lines = [header];
|
|
308667
308667
|
let bytes5 = Buffer.byteLength(header, "utf8");
|
|
308668
308668
|
let shown4 = 0;
|
|
@@ -310802,7 +310802,7 @@ async function queueCancel(deps, operation2) {
|
|
|
310802
310802
|
}
|
|
310803
310803
|
async function askWorkerToFlush(deps, workspace, operation2) {
|
|
310804
310804
|
const stop = deps.moneyStop;
|
|
310805
|
-
if (stop === void 0 || !reportsUsage(operation2) ||
|
|
310805
|
+
if (stop === void 0 || !reportsUsage(operation2) || ENDED2.has(operation2.status))
|
|
310806
310806
|
return "nothing_to_flush";
|
|
310807
310807
|
void workspace;
|
|
310808
310808
|
const waitMs = stop.flushWaitMs ?? USAGE_FLUSH_WAIT_MS;
|
|
@@ -310814,7 +310814,7 @@ async function askWorkerToFlush(deps, workspace, operation2) {
|
|
|
310814
310814
|
const location = await workspaceKeys({ store: deps.store, companyId: operation2.companyId }, operation2.workspaceId);
|
|
310815
310815
|
for (let current = await deps.store.get(location.operationKey(operation2.id)); ; current = await deps.store.get(location.operationKey(operation2.id))) {
|
|
310816
310816
|
const status = current?.["status"];
|
|
310817
|
-
if (typeof status === "string" &&
|
|
310817
|
+
if (typeof status === "string" && ENDED2.has(status))
|
|
310818
310818
|
return "flushed";
|
|
310819
310819
|
const left = waitMs - elapsedSince(deps, started2);
|
|
310820
310820
|
if (!queued || left <= 0)
|
|
@@ -310826,7 +310826,7 @@ async function flushBeforeClose(deps, workspace) {
|
|
|
310826
310826
|
if (deps.moneyStop === void 0 || workspace === void 0 || workspace.activeOperationId == null)
|
|
310827
310827
|
return;
|
|
310828
310828
|
const operation2 = await deps.store.get((await workspaceKeys({ store: deps.store, companyId: workspace.companyId }, workspace.id)).operationKey(workspace.activeOperationId));
|
|
310829
|
-
if (operation2 === void 0 || operation2.companyId !== deps.companyId || !reportsUsage(operation2) ||
|
|
310829
|
+
if (operation2 === void 0 || operation2.companyId !== deps.companyId || !reportsUsage(operation2) || ENDED2.has(operation2.status))
|
|
310830
310830
|
return;
|
|
310831
310831
|
await deps.store.update({
|
|
310832
310832
|
key: (await workspaceKeys({ store: deps.store, companyId: operation2.companyId }, workspace.id)).operationKey(operation2.id),
|
|
@@ -310855,7 +310855,7 @@ async function endUnflushed(deps, operation2) {
|
|
|
310855
310855
|
log(deps, { event: "task_flow.usage_not_flushed_unkept", error: error64 instanceof Error ? error64.name : "unknown" });
|
|
310856
310856
|
}
|
|
310857
310857
|
}
|
|
310858
|
-
var USAGE_FLUSH_WAIT_MS, FLUSH_POLL_MS, SPEND_STOP_CODES, isSpendStopCode, SPEND_UNKNOWN_STOP_REASON, spendStopReason,
|
|
310858
|
+
var USAGE_FLUSH_WAIT_MS, FLUSH_POLL_MS, SPEND_STOP_CODES, isSpendStopCode, SPEND_UNKNOWN_STOP_REASON, spendStopReason, ENDED2, elapsedSince, reportsUsage;
|
|
310859
310859
|
var init_money_stop = __esm({
|
|
310860
310860
|
"packages/broker/dist/core/task-flow/money-stop.js"() {
|
|
310861
310861
|
"use strict";
|
|
@@ -310870,7 +310870,7 @@ var init_money_stop = __esm({
|
|
|
310870
310870
|
isSpendStopCode = (value) => typeof value === "string" && SPEND_STOP_CODES.has(value);
|
|
310871
310871
|
SPEND_UNKNOWN_STOP_REASON = "Stopped: this task's spending could not be worked out";
|
|
310872
310872
|
spendStopReason = (code2) => code2 === "spend_unknown" ? SPEND_UNKNOWN_STOP_REASON : budgetExhaustedWords(code2 === "company_day_cap" ? "company_day" : "task");
|
|
310873
|
-
|
|
310873
|
+
ENDED2 = /* @__PURE__ */ new Set(["SUCCEEDED", "FAILED", "CANCELLED", "INTERRUPTED"]);
|
|
310874
310874
|
elapsedSince = (deps, started2) => (deps.now?.() ?? /* @__PURE__ */ new Date()).getTime() - started2;
|
|
310875
310875
|
reportsUsage = (operation2) => operation2.kind === "task" && operation2.machineId !== void 0;
|
|
310876
310876
|
}
|
|
@@ -311762,7 +311762,7 @@ function testPlacesLooked(commands5) {
|
|
|
311762
311762
|
function setupRunEndedLine(input2) {
|
|
311763
311763
|
const { result: result4, journal } = input2;
|
|
311764
311764
|
const results = journal.map((entry) => setupResultOf(entry));
|
|
311765
|
-
const
|
|
311765
|
+
const count10 = (word2) => results.filter((one) => one === word2).length;
|
|
311766
311766
|
const proposal = result4.proposal;
|
|
311767
311767
|
const setupFound = proposal === void 0 ? 0 : commandCount(proposal.setup);
|
|
311768
311768
|
const testsFound = proposal === void 0 ? 0 : commandCount(proposal.tests);
|
|
@@ -311774,10 +311774,10 @@ function setupRunEndedLine(input2) {
|
|
|
311774
311774
|
stop: result4.stop,
|
|
311775
311775
|
status: result4.status,
|
|
311776
311776
|
commandsRun: journal.length,
|
|
311777
|
-
passed:
|
|
311778
|
-
nothingFound:
|
|
311779
|
-
failed:
|
|
311780
|
-
timedOut:
|
|
311777
|
+
passed: count10("worked"),
|
|
311778
|
+
nothingFound: count10("nothing_found"),
|
|
311779
|
+
failed: count10("failed"),
|
|
311780
|
+
timedOut: count10("timed_out"),
|
|
311781
311781
|
setupFound,
|
|
311782
311782
|
testsFound,
|
|
311783
311783
|
otherItems: Math.max(0, itemCount - settingItems),
|
|
@@ -312788,7 +312788,7 @@ var init_saved_env_slots = __esm({
|
|
|
312788
312788
|
SAVED_ENV_INSTALL_SLOT_PARTITION = "SAVED_ENV_SLOTS";
|
|
312789
312789
|
companySlotKey = (orgId, index) => ({ pk: orgPk(OrgIdSchema.parse(orgId)), sk: `SAVED_ENV_SLOT#${String(index)}` });
|
|
312790
312790
|
installSlotKey = (index) => ({ pk: SAVED_ENV_INSTALL_SLOT_PARTITION, sk: `SLOT#${String(index)}` });
|
|
312791
|
-
range3 = (
|
|
312791
|
+
range3 = (count10) => Array.from({ length: count10 }, (_, index) => index);
|
|
312792
312792
|
}
|
|
312793
312793
|
});
|
|
312794
312794
|
|
|
@@ -312989,21 +312989,21 @@ var init_data_guard = __esm({
|
|
|
312989
312989
|
});
|
|
312990
312990
|
|
|
312991
312991
|
// packages/verifier/dist/report-schema.js
|
|
312992
|
-
var
|
|
312992
|
+
var count7, boundedText, source, upstreamError, target, attempt, E2EReportResultSchema, numericRecord, vcs, E2EReportSchema;
|
|
312993
312993
|
var init_report_schema = __esm({
|
|
312994
312994
|
"packages/verifier/dist/report-schema.js"() {
|
|
312995
312995
|
"use strict";
|
|
312996
312996
|
init_zod();
|
|
312997
|
-
|
|
312997
|
+
count7 = external_exports.number().int().nonnegative();
|
|
312998
312998
|
boundedText = external_exports.string().max(8192);
|
|
312999
312999
|
source = external_exports.object({ file: external_exports.string().min(1).max(1024), line: external_exports.number().int().positive(), column: external_exports.number().int().positive() }).strict();
|
|
313000
313000
|
upstreamError = external_exports.object({ category: external_exports.enum(["test", "configuration", "infrastructure", "internal", "interrupted"]), code: external_exports.string().min(1).max(128), message: boundedText, retryable: external_exports.boolean(), phase: external_exports.enum(["config", "collection", "launch", "beforeAll", "beforeEach", "body", "afterEach", "afterAll", "cleanup", "report"]).optional(), scopeId: external_exports.string().min(1).max(1024).optional(), source: source.optional(), scope: external_exports.object({ file: external_exports.string().min(1).max(1024), targetId: external_exports.string().min(1).max(256), titlePath: external_exports.array(external_exports.string().min(1).max(1024)).max(32) }).strict().optional(), details: external_exports.record(external_exports.string().max(128), external_exports.unknown()).optional(), stack: external_exports.string().max(65536).optional(), extensions: external_exports.record(external_exports.string().max(128), external_exports.unknown()).optional() }).strict();
|
|
313001
|
-
target = external_exports.object({ id: external_exports.string().min(1).max(256), index:
|
|
313002
|
-
attempt = external_exports.object({ id: external_exports.string().uuid(), index:
|
|
313003
|
-
E2EReportResultSchema = external_exports.object({ id: external_exports.string().regex(/^[a-f0-9]{64}$/), testId: external_exports.string().min(1).max(1024), kind: external_exports.enum(["test", "setup"]), declarationIndex:
|
|
313004
|
-
numericRecord = external_exports.record(external_exports.string().max(256),
|
|
313001
|
+
target = external_exports.object({ id: external_exports.string().min(1).max(256), index: count7, platform: external_exports.string().min(1).max(256), environment: external_exports.string().min(1).max(256), engine: external_exports.object({ name: external_exports.string().min(1).max(256), version: external_exports.string().min(1).max(256), spiVersion: external_exports.literal(1) }).strict(), capabilities: external_exports.array(external_exports.string().max(256)).max(64), artifactCapabilities: external_exports.array(external_exports.string().max(256)).max(64), stateCapability: external_exports.boolean() }).strict();
|
|
313002
|
+
attempt = external_exports.object({ id: external_exports.string().uuid(), index: count7, status: external_exports.enum(["passed", "failed", "timed-out", "interrupted", "skipped"]), startedAt: external_exports.string().max(128), durationMs: external_exports.number().finite().nonnegative(), steps: external_exports.array(external_exports.unknown()).max(64), artifacts: external_exports.array(external_exports.unknown()).max(200), secondaryErrors: external_exports.array(upstreamError).max(32), cleanup: external_exports.enum(["complete", "failed", "forced"]), error: upstreamError.optional() }).strict();
|
|
313003
|
+
E2EReportResultSchema = external_exports.object({ id: external_exports.string().regex(/^[a-f0-9]{64}$/), testId: external_exports.string().min(1).max(1024), kind: external_exports.enum(["test", "setup"]), declarationIndex: count7, titlePath: external_exports.array(external_exports.string().min(1).max(1024)).min(1).max(32), file: external_exports.string().min(1).max(1024), source, targetId: external_exports.string().min(1).max(256), platform: external_exports.string().min(1).max(256), agent: external_exports.string().min(1).max(256).optional(), repeat: count7.optional(), tags: external_exports.array(external_exports.string().max(256)).max(64).optional(), selected: external_exports.boolean().optional(), status: external_exports.enum(["passed", "flaky", "failed", "timed-out", "interrupted", "skipped"]), attempts: external_exports.array(attempt).max(3), skip: external_exports.unknown().optional() }).strict();
|
|
313004
|
+
numericRecord = external_exports.record(external_exports.string().max(256), count7);
|
|
313005
313005
|
vcs = external_exports.object({ commit: external_exports.string().regex(/^[a-f0-9]{40,64}$/), branch: external_exports.string().min(1).max(1024).optional(), dirty: external_exports.boolean().optional() }).strict();
|
|
313006
|
-
E2EReportSchema = external_exports.object({ schemaVersion: external_exports.literal("report-1"), run: external_exports.object({ id: external_exports.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/), specVersion: external_exports.literal("0.1"), runner: external_exports.object({ name: external_exports.string().min(1).max(256), version: external_exports.string().min(1).max(256) }).strict(), status: external_exports.enum(["passed", "failed", "blocked", "error", "interrupted"]), exitCode: external_exports.number().int(), startedAt: external_exports.string().max(128), finishedAt: external_exports.string().max(128).optional(), vcs: vcs.optional(), project: external_exports.object({ id: external_exports.string().min(1).max(256), configDigest: external_exports.string().regex(/^[a-f0-9]{64}$/) }).strict(), environment: external_exports.object({ ci: external_exports.boolean(), trustNoticeShown: external_exports.boolean(), os: external_exports.string().min(1).max(256), arch: external_exports.string().min(1).max(256), runtime: external_exports.string().min(1).max(256) }).strict(), targets: external_exports.array(target).max(12), serialGroups: external_exports.array(external_exports.unknown()).max(64), results: external_exports.array(E2EReportResultSchema).max(192), errors: external_exports.array(upstreamError).max(128), summary: external_exports.object({ discovered:
|
|
313006
|
+
E2EReportSchema = external_exports.object({ schemaVersion: external_exports.literal("report-1"), run: external_exports.object({ id: external_exports.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/), specVersion: external_exports.literal("0.1"), runner: external_exports.object({ name: external_exports.string().min(1).max(256), version: external_exports.string().min(1).max(256) }).strict(), status: external_exports.enum(["passed", "failed", "blocked", "error", "interrupted"]), exitCode: external_exports.number().int(), startedAt: external_exports.string().max(128), finishedAt: external_exports.string().max(128).optional(), vcs: vcs.optional(), project: external_exports.object({ id: external_exports.string().min(1).max(256), configDigest: external_exports.string().regex(/^[a-f0-9]{64}$/) }).strict(), environment: external_exports.object({ ci: external_exports.boolean(), trustNoticeShown: external_exports.boolean(), os: external_exports.string().min(1).max(256), arch: external_exports.string().min(1).max(256), runtime: external_exports.string().min(1).max(256) }).strict(), targets: external_exports.array(target).max(12), serialGroups: external_exports.array(external_exports.unknown()).max(64), results: external_exports.array(E2EReportResultSchema).max(192), errors: external_exports.array(upstreamError).max(128), summary: external_exports.object({ discovered: count7, selected: count7, executed: count7, passed: count7, failed: count7, interrupted: count7, flaky: count7, skipped: count7 }).strict(), limits: numericRecord, usage: numericRecord }).strict() }).strict();
|
|
313007
313007
|
}
|
|
313008
313008
|
});
|
|
313009
313009
|
|
|
@@ -313435,27 +313435,27 @@ var init_engine = __esm({
|
|
|
313435
313435
|
});
|
|
313436
313436
|
|
|
313437
313437
|
// packages/verifier/dist/application-report-schema.js
|
|
313438
|
-
var
|
|
313438
|
+
var count8, text10, sha2, usage, source2, error63, event, metrics, cache5, model, step2, artifact, failure3, skip, appLogLine, attempt2, result3, target2, E2EApplicationReportSchema, E2E_APPLICATION_REPORT_MAX_BYTES;
|
|
313439
313439
|
var init_application_report_schema = __esm({
|
|
313440
313440
|
"packages/verifier/dist/application-report-schema.js"() {
|
|
313441
313441
|
"use strict";
|
|
313442
313442
|
init_zod();
|
|
313443
313443
|
init_report_schema();
|
|
313444
|
-
|
|
313444
|
+
count8 = external_exports.number().int().nonnegative();
|
|
313445
313445
|
text10 = external_exports.string().max(16384);
|
|
313446
313446
|
sha2 = /^[a-f0-9]{64}$/;
|
|
313447
313447
|
usage = external_exports.object({
|
|
313448
|
-
discoveredResults:
|
|
313449
|
-
maxAgentContextBytes:
|
|
313450
|
-
maxLedgerBytes:
|
|
313451
|
-
maxObservationBytes:
|
|
313452
|
-
artifactBytes:
|
|
313453
|
-
downloads:
|
|
313454
|
-
events:
|
|
313455
|
-
modelTokens:
|
|
313456
|
-
modelCachedTokens:
|
|
313457
|
-
maxModelCallsInStep:
|
|
313458
|
-
maxActionStepsInStep:
|
|
313448
|
+
discoveredResults: count8,
|
|
313449
|
+
maxAgentContextBytes: count8,
|
|
313450
|
+
maxLedgerBytes: count8,
|
|
313451
|
+
maxObservationBytes: count8,
|
|
313452
|
+
artifactBytes: count8,
|
|
313453
|
+
downloads: count8,
|
|
313454
|
+
events: count8,
|
|
313455
|
+
modelTokens: count8,
|
|
313456
|
+
modelCachedTokens: count8.optional(),
|
|
313457
|
+
maxModelCallsInStep: count8,
|
|
313458
|
+
maxActionStepsInStep: count8,
|
|
313459
313459
|
estimatedCostUsd: external_exports.number().finite().nonnegative().optional()
|
|
313460
313460
|
}).strict();
|
|
313461
313461
|
source2 = external_exports.object({ file: external_exports.string().min(1).max(1024), line: external_exports.number().int().positive(), column: external_exports.number().int().positive() }).strict();
|
|
@@ -313466,23 +313466,23 @@ var init_application_report_schema = __esm({
|
|
|
313466
313466
|
durationMs: external_exports.number().finite().nonnegative(),
|
|
313467
313467
|
status: external_exports.enum(["passed", "failed", "cancelled"]),
|
|
313468
313468
|
name: text10.optional(),
|
|
313469
|
-
count:
|
|
313470
|
-
inputTokens:
|
|
313471
|
-
outputTokens:
|
|
313472
|
-
bytes:
|
|
313469
|
+
count: count8.optional(),
|
|
313470
|
+
inputTokens: count8.optional(),
|
|
313471
|
+
outputTokens: count8.optional(),
|
|
313472
|
+
bytes: count8.optional(),
|
|
313473
313473
|
decision: external_exports.enum(["allowed", "denied"]).optional(),
|
|
313474
313474
|
code: external_exports.string().max(256).optional(),
|
|
313475
313475
|
detail: text10.optional(),
|
|
313476
313476
|
reasoning: text10.optional()
|
|
313477
313477
|
}).strict();
|
|
313478
|
-
metrics = external_exports.object({ modelCalls:
|
|
313478
|
+
metrics = external_exports.object({ modelCalls: count8, actionSteps: count8, observationBytes: count8, contextBytes: count8, ledgerBytes: count8, pixelBytes: count8.optional() }).strict();
|
|
313479
313479
|
cache5 = external_exports.object({
|
|
313480
313480
|
mode: external_exports.enum(["self-finalized", "agent-concluded", "missed"]),
|
|
313481
313481
|
reason: external_exports.enum(["retry", "no-entry", "invalid-entry", "truncated", "wrong-context", "gap", "target-not-found", "target-ambiguous", "viewport-changed", "action-failed", "action-uncertain", "end-mismatch"]).optional(),
|
|
313482
313482
|
derived: external_exports.enum(["pixels", "whole-node", "minted-token", "date"]).optional(),
|
|
313483
313483
|
notRecorded: external_exports.literal("param-collision").optional(),
|
|
313484
|
-
replayedActions:
|
|
313485
|
-
totalActions:
|
|
313484
|
+
replayedActions: count8,
|
|
313485
|
+
totalActions: count8,
|
|
313486
313486
|
entry: text10.optional(),
|
|
313487
313487
|
detail: text10.optional(),
|
|
313488
313488
|
write: external_exports.enum(["saved", "kept", "unconfirmed", "evicted", "no-change", "not-written"]).optional()
|
|
@@ -313493,18 +313493,18 @@ var init_application_report_schema = __esm({
|
|
|
313493
313493
|
endpoint: text10,
|
|
313494
313494
|
adapterVersion: text10,
|
|
313495
313495
|
policyVersion: text10,
|
|
313496
|
-
calls:
|
|
313496
|
+
calls: count8,
|
|
313497
313497
|
tokenAccounting: external_exports.enum(["provider", "adapter-upper-bound"]),
|
|
313498
|
-
peakTokensPerCall:
|
|
313499
|
-
inputTokens:
|
|
313500
|
-
outputTokens:
|
|
313501
|
-
cacheReadTokens:
|
|
313502
|
-
cacheWriteTokens:
|
|
313498
|
+
peakTokensPerCall: count8,
|
|
313499
|
+
inputTokens: count8,
|
|
313500
|
+
outputTokens: count8,
|
|
313501
|
+
cacheReadTokens: count8.optional(),
|
|
313502
|
+
cacheWriteTokens: count8.optional(),
|
|
313503
313503
|
estimatedCostUsd: external_exports.number().finite().nonnegative().optional()
|
|
313504
313504
|
}).strict();
|
|
313505
313505
|
step2 = external_exports.object({
|
|
313506
313506
|
id: external_exports.string().min(1).max(256),
|
|
313507
|
-
index:
|
|
313507
|
+
index: count8,
|
|
313508
313508
|
kind: external_exports.enum(["agent", "locator", "assertion", "screen", "app", "session", "resource"]),
|
|
313509
313509
|
api: external_exports.string().min(1).max(256),
|
|
313510
313510
|
label: text10,
|
|
@@ -313525,7 +313525,7 @@ var init_application_report_schema = __esm({
|
|
|
313525
313525
|
model: model.optional(),
|
|
313526
313526
|
agent: external_exports.string().min(1).max(256).optional(),
|
|
313527
313527
|
phase: external_exports.enum(["beforeEach", "afterEach"]).optional(),
|
|
313528
|
-
screen: external_exports.object({ location: text10.optional(), nodes:
|
|
313528
|
+
screen: external_exports.object({ location: text10.optional(), nodes: count8, since: count8.optional(), changes: external_exports.array(text10).max(256), more: count8.optional() }).strict().optional(),
|
|
313529
313529
|
error: error63.optional(),
|
|
313530
313530
|
artifacts: external_exports.array(external_exports.string().min(1).max(256)).max(200)
|
|
313531
313531
|
}).strict();
|
|
@@ -313535,7 +313535,7 @@ var init_application_report_schema = __esm({
|
|
|
313535
313535
|
mediaType: external_exports.string().min(1).max(256),
|
|
313536
313536
|
path: text10.optional(),
|
|
313537
313537
|
url: external_exports.string().url().max(8192).optional(),
|
|
313538
|
-
size:
|
|
313538
|
+
size: count8.optional(),
|
|
313539
313539
|
sha256: external_exports.string().regex(sha2).optional(),
|
|
313540
313540
|
ref: text10.optional(),
|
|
313541
313541
|
startedAt: text10.optional(),
|
|
@@ -313548,7 +313548,7 @@ var init_application_report_schema = __esm({
|
|
|
313548
313548
|
failure3 = external_exports.object({
|
|
313549
313549
|
url: external_exports.string().url().max(8192).optional(),
|
|
313550
313550
|
viewport: external_exports.object({ width: external_exports.number().positive(), height: external_exports.number().positive() }).strict().optional(),
|
|
313551
|
-
nodes:
|
|
313551
|
+
nodes: count8.optional(),
|
|
313552
313552
|
screen: text10.optional(),
|
|
313553
313553
|
screenshot: text10.optional(),
|
|
313554
313554
|
candidates: external_exports.array(text10).max(128).optional()
|
|
@@ -313563,7 +313563,7 @@ var init_application_report_schema = __esm({
|
|
|
313563
313563
|
level: external_exports.enum(["error", "warning", "info"]),
|
|
313564
313564
|
text: external_exports.string().max(300),
|
|
313565
313565
|
at: external_exports.string().regex(/^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{3}Z$/),
|
|
313566
|
-
step:
|
|
313566
|
+
step: count8.optional()
|
|
313567
313567
|
}).strict();
|
|
313568
313568
|
attempt2 = E2EReportSchema.shape.run.shape.results.element.shape.attempts.element.extend({
|
|
313569
313569
|
environment: external_exports.record(external_exports.string().max(256), external_exports.string().max(2048)).optional(),
|
|
@@ -313592,7 +313592,7 @@ var init_application_mocks = __esm({
|
|
|
313592
313592
|
});
|
|
313593
313593
|
|
|
313594
313594
|
// packages/verifier/dist/application-agent-result.js
|
|
313595
|
-
var E2E_AGENT_MODEL_EVIDENCE_SCHEMA_VERSION, E2E_AGENT_LEDGER_MAX_BYTES, E2E_AGENT_TRACE_BASE64_MAX, hex64,
|
|
313595
|
+
var E2E_AGENT_MODEL_EVIDENCE_SCHEMA_VERSION, E2E_AGENT_LEDGER_MAX_BYTES, E2E_AGENT_TRACE_BASE64_MAX, hex64, count9, E2EAgentModelEvidenceSchema, E2E_FAILURE_CLASS_AGENT_CODE, MISMATCH;
|
|
313596
313596
|
var init_application_agent_result = __esm({
|
|
313597
313597
|
"packages/verifier/dist/application-agent-result.js"() {
|
|
313598
313598
|
"use strict";
|
|
@@ -313602,13 +313602,13 @@ var init_application_agent_result = __esm({
|
|
|
313602
313602
|
E2E_AGENT_LEDGER_MAX_BYTES = 65536;
|
|
313603
313603
|
E2E_AGENT_TRACE_BASE64_MAX = Math.ceil(E2E_AGENT_TRACE_FILE_MAX_BYTES * 4 / 3) + 4;
|
|
313604
313604
|
hex64 = external_exports.string().regex(/^[a-f0-9]{64}$/);
|
|
313605
|
-
|
|
313605
|
+
count9 = external_exports.number().int().min(0).max(1e6);
|
|
313606
313606
|
E2EAgentModelEvidenceSchema = external_exports.object({
|
|
313607
313607
|
schemaVersion: external_exports.literal(E2E_AGENT_MODEL_EVIDENCE_SCHEMA_VERSION),
|
|
313608
313608
|
route: E2EModelRouteDefinitionSchema.nullable(),
|
|
313609
313609
|
valueKey: hex64,
|
|
313610
313610
|
receipts: external_exports.array(E2EModelReceiptSchema).max(300),
|
|
313611
|
-
channel: external_exports.object({ droppedRequests:
|
|
313611
|
+
channel: external_exports.object({ droppedRequests: count9, unscopedRequests: count9, overrun: external_exports.boolean(), evidenceErrors: count9 }).strict(),
|
|
313612
313612
|
/** One action ledger per case that ran an agent step, as the executor wrote it, named by the 16 hex of the digest of the case id (as under `agent/`). */
|
|
313613
313613
|
ledgers: external_exports.array(external_exports.object({ caseDirectory: external_exports.string().regex(/^[a-f0-9]{16}$/), bytesBase64: external_exports.string().max(Math.ceil(E2E_AGENT_LEDGER_MAX_BYTES * 4 / 3) + 4), sha256: hex64 }).strict()).max(64),
|
|
313614
313614
|
/** One entry per receipt: the digests of the transcript bodies the worker kept (the bodies themselves are never uploaded) or why it kept none. */
|
|
@@ -315616,8 +315616,8 @@ function reviewModelLines(workflow, sameModel) {
|
|
|
315616
315616
|
if (current.length === 0)
|
|
315617
315617
|
return [];
|
|
315618
315618
|
const ordered = ["CRITIC", "SECURITY"].flatMap((role) => current.filter((review) => review.role === role));
|
|
315619
|
-
const
|
|
315620
|
-
const line23 =
|
|
315619
|
+
const names2 = new Set(ordered.map(modelName2));
|
|
315620
|
+
const line23 = names2.size === 1 ? `Reviewed by ${[...names2][0]}` : `Reviewed by ${ordered.map((review) => `${ROLE_WORD[review.role]}: ${modelName2(review)}`).join("; ")}`;
|
|
315621
315621
|
return [line23, ...sameModel ? [REVIEW_SAME_MODEL_NOTE] : []];
|
|
315622
315622
|
}
|
|
315623
315623
|
var REVIEW_SAME_MODEL_NOTE, ROLE_WORD, MODEL_MAX, modelName2;
|
|
@@ -315645,8 +315645,8 @@ var init_dependency_evidence = __esm({
|
|
|
315645
315645
|
});
|
|
315646
315646
|
|
|
315647
315647
|
// packages/broker/dist/core/proof/dependency-lines.js
|
|
315648
|
-
function joinNames(
|
|
315649
|
-
return
|
|
315648
|
+
function joinNames(names2) {
|
|
315649
|
+
return names2.length <= 1 ? names2[0] ?? "" : `${names2.slice(0, -1).join(", ")} and ${names2[names2.length - 1]}`;
|
|
315650
315650
|
}
|
|
315651
315651
|
function dependencyLineIsInert(line23) {
|
|
315652
315652
|
const plain5 = line23.replaceAll(ZERO_WIDTH_JOINER, "");
|
|
@@ -315737,7 +315737,7 @@ function dependencyLines2(dependencies, level) {
|
|
|
315737
315737
|
}
|
|
315738
315738
|
const lines = [];
|
|
315739
315739
|
if (groups.size > 0) {
|
|
315740
|
-
lines.push(`${at >= 3 ? "Ran against:" : "Integration tests ran against:"} ${[...groups].map(([key2,
|
|
315740
|
+
lines.push(`${at >= 3 ? "Ran against:" : "Integration tests ran against:"} ${[...groups].map(([key2, names2]) => `${joinNames(names2)} (${key2})`).join(", ")}.`);
|
|
315741
315741
|
}
|
|
315742
315742
|
const accounts = named5.filter(({ dependency }) => dependency.label === "test_account").map(({ name: name3 }) => name3);
|
|
315743
315743
|
if (accounts.length > 0)
|
|
@@ -315763,7 +315763,7 @@ var init_dependency_lines = __esm({
|
|
|
315763
315763
|
init_dependency_evidence();
|
|
315764
315764
|
init_inert_text();
|
|
315765
315765
|
DEPENDENCY_LEVEL_LAST = 4;
|
|
315766
|
-
number7 = (
|
|
315766
|
+
number7 = (count10) => count10.toLocaleString("en-US");
|
|
315767
315767
|
NAME_MAX2 = [40, 40, 40, 24, 16];
|
|
315768
315768
|
shortDigest = (digest17) => digest17 !== void 0 && /^[a-f0-9]{64}$/u.test(digest17) ? digest17.slice(0, 12) : "unrecorded";
|
|
315769
315769
|
recordedDate = (iso8) => iso8 !== void 0 && /^\d{4}-\d{2}-\d{2}T/u.test(iso8) ? iso8.slice(0, 10) : "an unknown date";
|
|
@@ -315826,8 +315826,8 @@ function testsLine(pack, proven, proofQualifier = "") {
|
|
|
315826
315826
|
return parts2.length === 0 ? void 0 : cutLine(`${proofQualifier}Checks by kind: ${parts2.slice(0, 12).join(" \xB7 ")}${parts2.length > 12 ? ` \xB7 and ${parts2.length - 12} more` : ""}`);
|
|
315827
315827
|
}
|
|
315828
315828
|
function flakyLine(pack) {
|
|
315829
|
-
const
|
|
315830
|
-
return flakyRerunLine(
|
|
315829
|
+
const count10 = pack.checks.reduce((sum, check4) => sum + (check4.tests?.flakyOnRerunCount ?? 0), 0);
|
|
315830
|
+
return flakyRerunLine(count10);
|
|
315831
315831
|
}
|
|
315832
315832
|
function coverageLine(pack) {
|
|
315833
315833
|
const measured = pack.checks.filter((check4) => check4.coverage !== void 0);
|
|
@@ -315921,7 +315921,7 @@ var init_evidence_lines2 = __esm({
|
|
|
315921
315921
|
init_inert_text();
|
|
315922
315922
|
LINE_MAX3 = 600;
|
|
315923
315923
|
EVIDENCE_NOT_TESTED_LISTED = 10;
|
|
315924
|
-
number8 = (
|
|
315924
|
+
number8 = (count10) => count10.toLocaleString("en-US");
|
|
315925
315925
|
cutLine = (text16, max = LINE_MAX3) => {
|
|
315926
315926
|
const points = Array.from(text16);
|
|
315927
315927
|
return points.length <= max ? text16 : `${points.slice(0, max - 1).join("")}\u2026`;
|
|
@@ -316114,7 +316114,7 @@ var init_risk = __esm({
|
|
|
316114
316114
|
PATH_SHOWN_MAX = 60;
|
|
316115
316115
|
SENSITIVE_NAME_WORDS2 = /* @__PURE__ */ new Set(["auth", "authn", "authz", "security", "oauth", "saml", "sso", "jwt", "crypto", "permissions", "credentials", "secrets", "iam"]);
|
|
316116
316116
|
DOCUMENT_EXTENSIONS3 = /\.(md|mdx|markdown|txt|rst|adoc)$/u;
|
|
316117
|
-
plural5 = (
|
|
316117
|
+
plural5 = (count10, one, many) => `${count10} ${count10 === 1 ? one : many}`;
|
|
316118
316118
|
}
|
|
316119
316119
|
});
|
|
316120
316120
|
|
|
@@ -316224,13 +316224,13 @@ function cleanPaths(paths2, dropped) {
|
|
|
316224
316224
|
function weakeningPartsOf(facts2, fallbackRemoved = [], dropped) {
|
|
316225
316225
|
const paths2 = (list4) => cleanPaths(list4 ?? [], dropped);
|
|
316226
316226
|
const lists = { absentOnNew: [...facts2.absentOnNew ?? []], changedTestConfig: paths2(facts2.changedTestConfig), changedSnapshots: paths2(facts2.changedSnapshots), changedFixtures: paths2(facts2.changedFixtures) };
|
|
316227
|
-
const
|
|
316227
|
+
const count10 = facts2.absentOnNewCount;
|
|
316228
316228
|
const rise = facts2.skipRise !== void 0 && facts2.skipRise.after > facts2.skipRise.before ? facts2.skipRise : void 0;
|
|
316229
|
-
const says = rise !== void 0 || (
|
|
316229
|
+
const says = rise !== void 0 || (count10 ?? 0) > 0 || fallbackRemoved.length > 0 || Object.values(lists).some((list4) => list4.length > 0);
|
|
316230
316230
|
const instructionFiles = paths2(facts2.instructionFiles);
|
|
316231
316231
|
const ciExecutedFiles = paths2(facts2.ciExecutedFiles);
|
|
316232
316232
|
return {
|
|
316233
|
-
...says ? { weakening: { ...rise === void 0 ? {} : { skipRise: { before: rise.before, after: rise.after } }, removedTests: [...fallbackRemoved], ...lists, ...(
|
|
316233
|
+
...says ? { weakening: { ...rise === void 0 ? {} : { skipRise: { before: rise.before, after: rise.after } }, removedTests: [...fallbackRemoved], ...lists, ...(count10 ?? 0) > 0 ? { absentOnNewCount: count10 } : {} } } : {},
|
|
316234
316234
|
...instructionFiles.length + ciExecutedFiles.length > 0 ? { flags: { instructionFiles, ciExecutedFiles } } : {}
|
|
316235
316235
|
};
|
|
316236
316236
|
}
|
|
@@ -316296,10 +316296,10 @@ function testProofPullRequestLines(proof, candidateDigest, inert6) {
|
|
|
316296
316296
|
function linesOfBoundProof(bound2, inert6) {
|
|
316297
316297
|
if (bound2.status !== "checked")
|
|
316298
316298
|
return [];
|
|
316299
|
-
const
|
|
316300
|
-
const proves =
|
|
316301
|
-
const noRun =
|
|
316302
|
-
const notChecked =
|
|
316299
|
+
const count10 = (verdict) => bound2.items.filter((item2) => item2.verdict === verdict).length;
|
|
316300
|
+
const proves = count10("proves_change");
|
|
316301
|
+
const noRun = count10("could_not_run_on_old");
|
|
316302
|
+
const notChecked = count10("not_checked");
|
|
316303
316303
|
const doesNot = bound2.items.filter((item2) => item2.verdict === "does_not_prove");
|
|
316304
316304
|
const noun4 = (n3) => `${bound2.items.every((item2) => item2.granularity === "test") ? "test" : "check"}${n3 === 1 ? "" : "s"}`;
|
|
316305
316305
|
const parts2 = [
|
|
@@ -316309,10 +316309,10 @@ function linesOfBoundProof(bound2, inert6) {
|
|
|
316309
316309
|
];
|
|
316310
316310
|
const plain5 = (text16) => text16.replace(/[<>`]/gu, "");
|
|
316311
316311
|
const quoted3 = (text16) => plain5(inert6(plain5(redactText(text16)).replace(/\s+/gu, " "))).slice(0, NAME_MAX3);
|
|
316312
|
-
const
|
|
316312
|
+
const names2 = doesNot.map((item2) => quoted3(item2.test === void 0 ? item2.label : `${item2.label}: ${item2.test}`));
|
|
316313
316313
|
return [
|
|
316314
316314
|
...parts2.length > 0 ? [`Test proof: ${parts2.join("; ")}`] : [],
|
|
316315
|
-
...doesNot.length > 0 ? [`Warning: ${doesNot.length} ${noun4(doesNot.length)} also pass${doesNot.length === 1 ? "es" : ""} on the original code, so ${doesNot.length === 1 ? "it does" : "they do"} not prove the change (${
|
|
316315
|
+
...doesNot.length > 0 ? [`Warning: ${doesNot.length} ${noun4(doesNot.length)} also pass${doesNot.length === 1 ? "es" : ""} on the original code, so ${doesNot.length === 1 ? "it does" : "they do"} not prove the change (${names2.slice(0, NAMES_LISTED).join(", ")}${names2.length > NAMES_LISTED ? `, and ${names2.length - NAMES_LISTED} more` : ""})`] : []
|
|
316316
316316
|
];
|
|
316317
316317
|
}
|
|
316318
316318
|
var NAMES_LISTED, NAME_MAX3;
|
|
@@ -316465,15 +316465,15 @@ function partlyReason(childIds, linkedDidNotRun) {
|
|
|
316465
316465
|
const parts2 = [];
|
|
316466
316466
|
if (childIds.length > 0) {
|
|
316467
316467
|
let named5 = "";
|
|
316468
|
-
let
|
|
316468
|
+
let count10 = 0;
|
|
316469
316469
|
for (const id12 of childIds) {
|
|
316470
|
-
const next = `${named5}${
|
|
316470
|
+
const next = `${named5}${count10 === 0 ? "" : ", "}${oneLine4(id12, 20)}`;
|
|
316471
316471
|
if (next.length > PARTLY_IDS_MAX)
|
|
316472
316472
|
break;
|
|
316473
316473
|
named5 = next;
|
|
316474
|
-
|
|
316474
|
+
count10 += 1;
|
|
316475
316475
|
}
|
|
316476
|
-
parts2.push(
|
|
316476
|
+
parts2.push(count10 === 0 ? "part of it is not tested" : `part not tested: ${named5}${count10 < childIds.length ? ` and ${childIds.length - count10} more` : ""}`);
|
|
316477
316477
|
}
|
|
316478
316478
|
if (linkedDidNotRun)
|
|
316479
316479
|
parts2.push(NOT_TESTED_REASONS.claimPartLinkedDidNotRun);
|
|
@@ -316730,7 +316730,7 @@ var init_proof_section = __esm({
|
|
|
316730
316730
|
return points.length <= max ? text16 : `${points.slice(0, max - 1).join("")}\u2026`;
|
|
316731
316731
|
};
|
|
316732
316732
|
cell = (text16) => text16.replaceAll("|", "\xA6");
|
|
316733
|
-
plural6 = (
|
|
316733
|
+
plural6 = (count10, word2) => `${count10} ${word2}${count10 === 1 ? "" : "s"}`;
|
|
316734
316734
|
flatClaims2 = (claims) => claims.flatMap((claim3) => [claim3, ...flatClaims2(claim3.children ?? [])]);
|
|
316735
316735
|
}
|
|
316736
316736
|
});
|
|
@@ -317411,7 +317411,7 @@ function assessWorkflowRisk(workflow, read, project3, evidence) {
|
|
|
317411
317411
|
return void 0;
|
|
317412
317412
|
const files = read?.files ?? [];
|
|
317413
317413
|
const reviewerRisk = reviewerRiskOf(workflow);
|
|
317414
|
-
const securityFindings = (workflow.reviews ?? []).filter((review) => review.role === "SECURITY" && review.candidateDigest === digest17).reduce((
|
|
317414
|
+
const securityFindings = (workflow.reviews ?? []).filter((review) => review.role === "SECURITY" && review.candidateDigest === digest17).reduce((count10, review) => count10 + review.findings.filter((finding) => finding.origin === "INTRODUCED").length, 0);
|
|
317415
317415
|
return assessRisk({
|
|
317416
317416
|
changedFiles: files,
|
|
317417
317417
|
changedFilesComplete: read?.complete === true,
|
|
@@ -317544,10 +317544,10 @@ function rovaraPullRequestBody(input2) {
|
|
|
317544
317544
|
const summary2 = summaryOf(input2.summary, read !== void 0 && read.complete && read.files.length > 0 ? read.files.length : void 0);
|
|
317545
317545
|
const first2 = summary2.length > 0 ? summary2[0].replace(/^(?:[-*+]|\d{1,3}[.)])\s+/u, "") : inertLine2(input2.fallbackTitle, SUMMARY_LINE_MAX2);
|
|
317546
317546
|
const quote = `> ${neutralizeLinearWords(Array.from(first2).slice(0, QUOTE_MAX).join(""))}`;
|
|
317547
|
-
const
|
|
317547
|
+
const who2 = attributionBodyLines(input2.context.attribution);
|
|
317548
317548
|
const record4 = [
|
|
317549
317549
|
...summary2.length === 0 ? [] : [...summary2.map((line23) => `> ${neutralizeLinearWords(line23)}`), ""],
|
|
317550
|
-
...
|
|
317550
|
+
...who2.length === 0 ? [] : [...who2, ""],
|
|
317551
317551
|
...input2.pageUrl === void 0 ? [] : [`Rovara session: ${input2.pageUrl}`, ""]
|
|
317552
317552
|
];
|
|
317553
317553
|
const drawer = ["<details>", "<summary>Plan and record</summary>", "", ...record4.length === 0 ? ["No plan summary was recorded."] : record4.slice(0, record4.at(-1) === "" ? -1 : void 0), "", "</details>", ""];
|
|
@@ -317581,7 +317581,7 @@ var init_pull_request_body = __esm({
|
|
|
317581
317581
|
QUOTE_MAX = 200;
|
|
317582
317582
|
SAFE_LINK2 = /^https:\/\/[^\s()<>[\]\\]{1,500}$/u;
|
|
317583
317583
|
byteLength = (text16) => Buffer.byteLength(text16, "utf8");
|
|
317584
|
-
more = (
|
|
317584
|
+
more = (count10, listed4) => count10 > listed4 ? ` and ${count10 - listed4} more` : "";
|
|
317585
317585
|
SHORT_SHA = 8;
|
|
317586
317586
|
TESTED_COMMITS_MAX = 8;
|
|
317587
317587
|
PROOF_LINE_MAX = 600;
|
|
@@ -317617,7 +317617,7 @@ async function acceptedByOf(store, taskId, candidateDigest) {
|
|
|
317617
317617
|
const rows = await queryAll(store, { pk: `DEVTASK#${taskId}`, sk: { op: "beginsWith", prefix: PREFIX } });
|
|
317618
317618
|
const by = {};
|
|
317619
317619
|
for (const row2 of rows) {
|
|
317620
|
-
const method = typeof row2["method"] === "string" ?
|
|
317620
|
+
const method = typeof row2["method"] === "string" ? METHOD_WORDS3[row2["method"]] : void 0;
|
|
317621
317621
|
if (row2["candidateDigest"] !== candidateDigest || typeof row2["name"] !== "string" || method === void 0 || !Array.isArray(row2["fingerprints"]))
|
|
317622
317622
|
continue;
|
|
317623
317623
|
for (const fingerprint3 of row2["fingerprints"])
|
|
@@ -317626,7 +317626,7 @@ async function acceptedByOf(store, taskId, candidateDigest) {
|
|
|
317626
317626
|
}
|
|
317627
317627
|
return Object.keys(by).length === 0 ? void 0 : by;
|
|
317628
317628
|
}
|
|
317629
|
-
var KEEP_SECONDS, PREFIX, NAME_MAX4, findingAcceptKey, shownName,
|
|
317629
|
+
var KEEP_SECONDS, PREFIX, NAME_MAX4, findingAcceptKey, shownName, METHOD_WORDS3;
|
|
317630
317630
|
var init_finding_accept = __esm({
|
|
317631
317631
|
"packages/broker/dist/core/task-flow/finding-accept.js"() {
|
|
317632
317632
|
"use strict";
|
|
@@ -317636,7 +317636,7 @@ var init_finding_accept = __esm({
|
|
|
317636
317636
|
NAME_MAX4 = 60;
|
|
317637
317637
|
findingAcceptKey = (taskId, requestId) => ({ pk: `DEVTASK#${taskId}`, sk: `${PREFIX}${requestId}` });
|
|
317638
317638
|
shownName = (name3) => redactText(name3).replace(/[\p{Cc}\p{Cf}]/gu, " ").replace(/\s+/gu, " ").trim().slice(0, NAME_MAX4) || "the owner";
|
|
317639
|
-
|
|
317639
|
+
METHOD_WORDS3 = { "api-token": "the API token (a tool)", page: "the task page", slack: "Slack" };
|
|
317640
317640
|
}
|
|
317641
317641
|
});
|
|
317642
317642
|
|
|
@@ -317740,7 +317740,7 @@ function workflowPullRequestStatusLines(workflow, context, proofLines2 = []) {
|
|
|
317740
317740
|
].map((line23) => hideEmailAddresses(line23));
|
|
317741
317741
|
}
|
|
317742
317742
|
function workflowReviewLines(workflow, listed4, acceptedBy) {
|
|
317743
|
-
const noted = (workflow.reviews ?? []).reduce((
|
|
317743
|
+
const noted = (workflow.reviews ?? []).reduce((count10, review) => count10 + review.findings.filter((finding) => !workflowFindingAccepted(workflow, review.role, finding)).length, 0);
|
|
317744
317744
|
const reviewWord = (role) => {
|
|
317745
317745
|
const review = (workflow.reviews ?? []).find((entry) => entry.role === role && entry.candidateDigest === workflow.candidate?.digest);
|
|
317746
317746
|
if (review === void 0 || !reviewCleared(review, workflow.acceptedFindings))
|
|
@@ -320239,8 +320239,8 @@ async function readAutomaticRunsCap(deps, orgId, project3) {
|
|
|
320239
320239
|
}
|
|
320240
320240
|
async function countOf(deps, orgId, project3, month) {
|
|
320241
320241
|
const counter = await deps.store.get(key(orgId, project3, monthSk(month)));
|
|
320242
|
-
const
|
|
320243
|
-
return typeof
|
|
320242
|
+
const count10 = counter?.["count"];
|
|
320243
|
+
return typeof count10 === "number" && Number.isInteger(count10) && count10 > 0 ? count10 : 0;
|
|
320244
320244
|
}
|
|
320245
320245
|
async function claimAutomaticRun(deps, input2) {
|
|
320246
320246
|
const now = deps.now();
|
|
@@ -362278,8 +362278,8 @@ var Option2 = class {
|
|
|
362278
362278
|
* @param {(string | string[])} names
|
|
362279
362279
|
* @return {Option}
|
|
362280
362280
|
*/
|
|
362281
|
-
conflicts(
|
|
362282
|
-
this.conflictsWith = this.conflictsWith.concat(
|
|
362281
|
+
conflicts(names2) {
|
|
362282
|
+
this.conflictsWith = this.conflictsWith.concat(names2);
|
|
362283
362283
|
return this;
|
|
362284
362284
|
}
|
|
362285
362285
|
/**
|
|
@@ -362885,8 +362885,8 @@ var Command2 = class _Command extends EventEmitter {
|
|
|
362885
362885
|
* @param {string} names
|
|
362886
362886
|
* @return {Command} `this` command for chaining
|
|
362887
362887
|
*/
|
|
362888
|
-
arguments(
|
|
362889
|
-
|
|
362888
|
+
arguments(names2) {
|
|
362889
|
+
names2.trim().split(/ +/).forEach((detail) => {
|
|
362890
362890
|
this.argument(detail);
|
|
362891
362891
|
});
|
|
362892
362892
|
return this;
|
|
@@ -375520,8 +375520,8 @@ function ownershipGuardedTools(rule) {
|
|
|
375520
375520
|
targetArguments: Object.freeze([...new Set(rule.targetArguments ?? firstSteps)])
|
|
375521
375521
|
});
|
|
375522
375522
|
}
|
|
375523
|
-
function ownershipGuard(rule,
|
|
375524
|
-
const { vendor, scopeNoun } =
|
|
375523
|
+
function ownershipGuard(rule, names2) {
|
|
375524
|
+
const { vendor, scopeNoun } = names2;
|
|
375525
375525
|
const noun4 = rule.itemNoun;
|
|
375526
375526
|
const plural8 = rule.itemNounPlural ?? `${noun4}s`;
|
|
375527
375527
|
const maxLookups = rule.maxLookups ?? DEFAULT_MAX_LOOKUPS;
|
|
@@ -376354,9 +376354,9 @@ async function runCliChange(input2, fetchImplementation = fetch) {
|
|
|
376354
376354
|
const requestedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
376355
376355
|
const decline = async (reason2) => {
|
|
376356
376356
|
try {
|
|
376357
|
-
const
|
|
376358
|
-
input2.write(
|
|
376359
|
-
return
|
|
376357
|
+
const declined2 = viewOf(await send(input2, traceId, "POST", `${path6}/decline`, { method: "cli", reason: reason2, requestedAt, answeredAt: (/* @__PURE__ */ new Date()).toISOString() }, fetchImplementation, "decline", changeId), `AgentX's answer to declining change ${changeId} could not be read`);
|
|
376358
|
+
input2.write(declined2.status === "declined" ? "Nothing changed." : `Nothing was applied by this command; ${CHECK_STEP}.`);
|
|
376359
|
+
return declined2;
|
|
376360
376360
|
} catch {
|
|
376361
376361
|
input2.write(`Nothing was applied; AgentX did not record the decline, so change ${changeId} expires on its own.`);
|
|
376362
376362
|
return planned;
|
|
@@ -377199,6 +377199,227 @@ async function developerLogin(options) {
|
|
|
377199
377199
|
}
|
|
377200
377200
|
}
|
|
377201
377201
|
|
|
377202
|
+
// packages/cli/src/developer/sign-ins.ts
|
|
377203
|
+
init_dist2();
|
|
377204
|
+
import { createServer as createServer4 } from "node:http";
|
|
377205
|
+
|
|
377206
|
+
// packages/cli/src/session/app-request.ts
|
|
377207
|
+
init_dist2();
|
|
377208
|
+
|
|
377209
|
+
// packages/cli/src/output.ts
|
|
377210
|
+
init_dist2();
|
|
377211
|
+
|
|
377212
|
+
// packages/cli/src/stopped.ts
|
|
377213
|
+
init_dist2();
|
|
377214
|
+
var StoppedByOperator = class extends Error {
|
|
377215
|
+
exitCode = 130;
|
|
377216
|
+
constructor(message) {
|
|
377217
|
+
super(message);
|
|
377218
|
+
this.name = "StoppedByOperator";
|
|
377219
|
+
}
|
|
377220
|
+
};
|
|
377221
|
+
function isCtrlCAtPrompt(error64) {
|
|
377222
|
+
for (let current = error64, depth = 0; current instanceof Error && depth < 10; current = current.cause, depth += 1) {
|
|
377223
|
+
if (current.name === "AbortError" && /Ctrl\+C/.test(current.message)) return true;
|
|
377224
|
+
if (current instanceof AgentXError && current.code === "CONFIG_INVALID" && current.message.replace(/^CONFIG_INVALID: /, "") === "cancelled") return true;
|
|
377225
|
+
}
|
|
377226
|
+
return false;
|
|
377227
|
+
}
|
|
377228
|
+
|
|
377229
|
+
// packages/cli/src/output.ts
|
|
377230
|
+
function formatSuccess(data, json3) {
|
|
377231
|
+
if (json3) return `${JSON.stringify({ ok: true, data })}
|
|
377232
|
+
`;
|
|
377233
|
+
return typeof data === "string" ? `${data}
|
|
377234
|
+
` : `${JSON.stringify(data, null, 2)}
|
|
377235
|
+
`;
|
|
377236
|
+
}
|
|
377237
|
+
var ReportedFailure = class extends Error {
|
|
377238
|
+
constructor(failureCode, message, exitCode = 1) {
|
|
377239
|
+
super(message);
|
|
377240
|
+
this.failureCode = failureCode;
|
|
377241
|
+
this.exitCode = exitCode;
|
|
377242
|
+
this.name = "ReportedFailure";
|
|
377243
|
+
}
|
|
377244
|
+
failureCode;
|
|
377245
|
+
exitCode;
|
|
377246
|
+
};
|
|
377247
|
+
function formatError2(error64, json3) {
|
|
377248
|
+
if (error64 instanceof StoppedByOperator) {
|
|
377249
|
+
return { text: json3 ? `${JSON.stringify({ ok: false, error: { code: "STOPPED", message: error64.message } })}
|
|
377250
|
+
` : `${error64.message}
|
|
377251
|
+
`, exitCode: error64.exitCode };
|
|
377252
|
+
}
|
|
377253
|
+
if (error64 instanceof ReportedFailure) {
|
|
377254
|
+
return { text: json3 ? `${JSON.stringify({ ok: false, error: { code: error64.failureCode, message: error64.message } })}
|
|
377255
|
+
` : `${error64.message}
|
|
377256
|
+
`, exitCode: error64.exitCode };
|
|
377257
|
+
}
|
|
377258
|
+
const normalized4 = error64 instanceof AgentXError ? { code: error64.code, message: stripCodePrefix(error64.message, error64.code) } : { code: "INTERNAL_ERROR", message: error64 instanceof Error ? error64.message : "unexpected error" };
|
|
377259
|
+
const text16 = json3 ? `${JSON.stringify({ ok: false, error: normalized4 })}
|
|
377260
|
+
` : `AgentX error [${normalized4.code}]: ${normalized4.message}
|
|
377261
|
+
`;
|
|
377262
|
+
return {
|
|
377263
|
+
text: text16,
|
|
377264
|
+
exitCode: normalized4.code === "INTERNAL_ERROR" ? 1 : exitCodeForError(normalized4.code)
|
|
377265
|
+
};
|
|
377266
|
+
}
|
|
377267
|
+
function exitCodeForError(code2) {
|
|
377268
|
+
if (code2 === "CONFIG_INVALID" || code2 === "PROJECT_REVISION_MISMATCH") return 2;
|
|
377269
|
+
if (code2 === "AUTH_REQUIRED") return 3;
|
|
377270
|
+
if (code2 === "FORBIDDEN" || code2 === "NOT_FOUND" || code2 === "CALLBACK_FORBIDDEN") return 4;
|
|
377271
|
+
if (code2 === "WORKSPACE_NOT_READY" || code2 === "WORKSPACE_BUSY") return 5;
|
|
377272
|
+
if (code2 === "RUNTIME_UNAVAILABLE" || code2 === "OPERATION_INTERRUPTED" || code2 === "STALE_FENCE") return 6;
|
|
377273
|
+
return 7;
|
|
377274
|
+
}
|
|
377275
|
+
function plainMessage(error64) {
|
|
377276
|
+
if (error64 instanceof AgentXError) return stripCodePrefix(error64.message, error64.code);
|
|
377277
|
+
return error64 instanceof Error ? error64.message : String(error64);
|
|
377278
|
+
}
|
|
377279
|
+
function stripCodePrefix(message, code2) {
|
|
377280
|
+
const prefix2 = `${code2}: `;
|
|
377281
|
+
return message.startsWith(prefix2) ? message.slice(prefix2.length) : message;
|
|
377282
|
+
}
|
|
377283
|
+
|
|
377284
|
+
// packages/cli/src/session/app-request.ts
|
|
377285
|
+
var UNSAFE = /[\p{Cc}\p{Cf}\p{Zl}\p{Zp}\p{Cs}\p{Co}͏ᅟᅠ⠀ㅤᅠ]/gu;
|
|
377286
|
+
var marker = (character) => `[U+${(character.codePointAt(0) ?? 0).toString(16).toUpperCase().padStart(4, "0")}]`;
|
|
377287
|
+
var MAX_SHOWN = 500;
|
|
377288
|
+
function terminalSafe(value) {
|
|
377289
|
+
const characters = [...String(value).replace(/[\r\n\t]+/g, " ")];
|
|
377290
|
+
const shown4 = characters.length > MAX_SHOWN ? characters.slice(0, MAX_SHOWN) : characters;
|
|
377291
|
+
return shown4.join("").replace(UNSAFE, marker) + (characters.length > MAX_SHOWN ? "...[truncated]" : "");
|
|
377292
|
+
}
|
|
377293
|
+
function jsonSafe(value) {
|
|
377294
|
+
if (typeof value === "string") return value.replace(UNSAFE, (character) => character === "\n" || character === "\r" || character === " " ? character : marker(character));
|
|
377295
|
+
if (Array.isArray(value)) return value.map(jsonSafe);
|
|
377296
|
+
if (value !== null && typeof value === "object") {
|
|
377297
|
+
return Object.fromEntries(Object.entries(value).map(([key2, child]) => [jsonSafe(key2), jsonSafe(child)]));
|
|
377298
|
+
}
|
|
377299
|
+
return value;
|
|
377300
|
+
}
|
|
377301
|
+
var clean = (text16) => terminalSafe(text16.replace(/agx[rc]_[A-Za-z0-9_-]+/g, "[hidden]"));
|
|
377302
|
+
async function appRequest(deps, env3, path6, options = {}) {
|
|
377303
|
+
const session = await developerAccessToken(deps, env3);
|
|
377304
|
+
let response;
|
|
377305
|
+
try {
|
|
377306
|
+
response = await deps.fetch(`${session.entry.url}${path6}`, {
|
|
377307
|
+
method: options.method ?? "GET",
|
|
377308
|
+
headers: { ...options.headers, authorization: `Bearer ${session.accessToken}`, ...options.body === void 0 ? {} : { "content-type": "application/json" } },
|
|
377309
|
+
...options.body === void 0 ? {} : { body: JSON.stringify(options.body) },
|
|
377310
|
+
signal: AbortSignal.timeout(3e4)
|
|
377311
|
+
});
|
|
377312
|
+
} catch {
|
|
377313
|
+
throw agentXError("RUNTIME_UNAVAILABLE", `could not reach AgentX at ${session.entry.url}; check your connection and try again`);
|
|
377314
|
+
}
|
|
377315
|
+
const value = await response.json().catch(() => void 0);
|
|
377316
|
+
if (response.status === 401) throw agentXError("AUTH_REQUIRED", `your AgentX sign-in for ${session.env} has ended; run npx ${CLI_PACKAGE_NAME} login ${session.entry.url}`);
|
|
377317
|
+
if (!response.ok) {
|
|
377318
|
+
const error64 = typeof value === "object" && value !== null ? value.error : void 0;
|
|
377319
|
+
const message = typeof error64?.message === "string" ? clean(error64.message).trim() : "";
|
|
377320
|
+
if (message === "") throw agentXError("RUNTIME_UNAVAILABLE", `AgentX answered HTTP ${response.status}; try again`);
|
|
377321
|
+
const code2 = AgentXErrorCodeSchema.safeParse(error64?.code);
|
|
377322
|
+
throw new ReportedFailure(code2.success ? code2.data : "REFUSED", message, response.status === 409 || !code2.success ? 1 : exitCodeForError(code2.data));
|
|
377323
|
+
}
|
|
377324
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
377325
|
+
throw agentXError("RUNTIME_UNAVAILABLE", `AgentX answered with something unexpected; try again, or upgrade: npx ${CLI_PACKAGE_NAME}@latest whoami`);
|
|
377326
|
+
}
|
|
377327
|
+
return { env: session.env, url: session.entry.url, status: response.status, body: value };
|
|
377328
|
+
}
|
|
377329
|
+
var result = (answer2, data, text16) => ({ env: answer2.env, url: answer2.url, data: jsonSafe(data), text: text16 });
|
|
377330
|
+
var seg = (id12) => {
|
|
377331
|
+
if (id12 === "." || id12 === "..") throw agentXError("CONFIG_INVALID", "an ID cannot be . or ..");
|
|
377332
|
+
return encodeURIComponent(id12);
|
|
377333
|
+
};
|
|
377334
|
+
var str = (value, fallback2 = "") => typeof value === "string" || typeof value === "number" ? clean(String(value)) : fallback2;
|
|
377335
|
+
var list3 = (value) => Array.isArray(value) ? value.filter((entry) => typeof entry === "object" && entry !== null) : [];
|
|
377336
|
+
var DEVELOPER_ID = /^[a-f0-9]{64}$/;
|
|
377337
|
+
async function developerRef(_deps, _env, who2) {
|
|
377338
|
+
const id12 = who2.trim().toLowerCase();
|
|
377339
|
+
if (!DEVELOPER_ID.test(id12)) throw agentXError("CONFIG_INVALID", "--with takes a person's developer ID (64 hexadecimal characters), project:<name>, or company; Code has no member directory to look an email up in");
|
|
377340
|
+
return { developerId: id12, name: `developer ${id12.slice(0, 8)}` };
|
|
377341
|
+
}
|
|
377342
|
+
|
|
377343
|
+
// packages/cli/src/developer/sign-ins.ts
|
|
377344
|
+
var SIGN_INS_PATH = "/v1/dev/me/sign-ins";
|
|
377345
|
+
var METHOD_WORDS = { slack: "Slack", oidc: "your company sign-in", github: "GitHub" };
|
|
377346
|
+
var LINKABLE = ["slack", "github"];
|
|
377347
|
+
var ENDED = {
|
|
377348
|
+
cancelled: "the sign-in was cancelled on the provider's page; nothing was connected",
|
|
377349
|
+
refused: "that sign-in can't be connected to your account",
|
|
377350
|
+
failed: "the provider's sign-in did not finish; nothing was connected, try again"
|
|
377351
|
+
};
|
|
377352
|
+
async function signInsList(deps, env3) {
|
|
377353
|
+
const answer2 = await appRequest(deps, env3, SIGN_INS_PATH);
|
|
377354
|
+
const rows = (Array.isArray(answer2.body.signIns) ? answer2.body.signIns : []).filter((row2) => typeof row2 === "object" && row2 !== null);
|
|
377355
|
+
const lines = rows.map((row2) => ` ${METHOD_WORDS[str(row2.method)] ?? str(row2.method)}${row2.primary === true ? " (the first way you signed in; it can't be removed)" : typeof row2.linkedAt === "string" ? ` (connected ${row2.linkedAt.slice(0, 10)})` : ""}`);
|
|
377356
|
+
const missing = LINKABLE.filter((method) => !rows.some((row2) => row2.method === method));
|
|
377357
|
+
return result(answer2, { signIns: rows }, [
|
|
377358
|
+
`You sign in to AgentX environment ${answer2.env} with:`,
|
|
377359
|
+
...lines,
|
|
377360
|
+
...missing.length === 0 ? [] : [`To connect ${missing.map((method) => METHOD_WORDS[method]).join(" or ")} too: rovara signins link ${missing.join("|")}`]
|
|
377361
|
+
].join("\n") + "\n");
|
|
377362
|
+
}
|
|
377363
|
+
async function linkCallback(state3, timeoutMs) {
|
|
377364
|
+
let settle3;
|
|
377365
|
+
const answer2 = new Promise((resolve17, reject) => {
|
|
377366
|
+
settle3 = { resolve: resolve17, reject };
|
|
377367
|
+
});
|
|
377368
|
+
answer2.catch(() => void 0);
|
|
377369
|
+
const server2 = createServer4((request, response) => {
|
|
377370
|
+
const url2 = new URL(request.url ?? "/", "http://127.0.0.1");
|
|
377371
|
+
if (url2.pathname !== "/callback" || url2.searchParams.get("state") !== state3) {
|
|
377372
|
+
response.writeHead(400, { "content-type": "text/plain" }).end("Not a Rovara sign-in callback.");
|
|
377373
|
+
return;
|
|
377374
|
+
}
|
|
377375
|
+
const failure4 = url2.searchParams.get("link_error");
|
|
377376
|
+
const linkId = url2.searchParams.get("link_id"), linkCode = url2.searchParams.get("link_code");
|
|
377377
|
+
if (failure4 !== null || linkId === null || linkCode === null) {
|
|
377378
|
+
response.writeHead(200, { "content-type": "text/plain; charset=utf-8" }).end("Nothing was connected. You can close this window.");
|
|
377379
|
+
settle3.reject(agentXError("AUTH_REQUIRED", ENDED[failure4 ?? ""] ?? ENDED.failed));
|
|
377380
|
+
return;
|
|
377381
|
+
}
|
|
377382
|
+
response.writeHead(200, { "content-type": "text/plain; charset=utf-8" }).end("Rovara is connecting this sign-in. You can close this window.");
|
|
377383
|
+
settle3.resolve({ linkId, linkCode });
|
|
377384
|
+
});
|
|
377385
|
+
await new Promise((resolve17, reject) => {
|
|
377386
|
+
server2.once("error", reject);
|
|
377387
|
+
server2.listen(0, "127.0.0.1", resolve17);
|
|
377388
|
+
});
|
|
377389
|
+
const address = server2.address();
|
|
377390
|
+
if (address === null || typeof address === "string") throw agentXError("RUNTIME_UNAVAILABLE", "could not listen on this computer for the sign-in to come back");
|
|
377391
|
+
const timer = setTimeout(() => settle3.reject(agentXError("AUTH_REQUIRED", "the sign-in timed out; nothing was connected, run the command again")), timeoutMs);
|
|
377392
|
+
timer.unref();
|
|
377393
|
+
return { redirectUri: `http://127.0.0.1:${address.port}/callback`, answer: answer2, close: () => {
|
|
377394
|
+
clearTimeout(timer);
|
|
377395
|
+
server2.close();
|
|
377396
|
+
} };
|
|
377397
|
+
}
|
|
377398
|
+
async function signInsLink(deps, env3, method, options) {
|
|
377399
|
+
if (!LINKABLE.includes(method)) throw agentXError("CONFIG_INVALID", "you can connect slack or github");
|
|
377400
|
+
const pkce = createPkceParameters();
|
|
377401
|
+
const callback = await linkCallback(pkce.state, options.timeoutMs ?? 3e5);
|
|
377402
|
+
try {
|
|
377403
|
+
const started2 = await appRequest(deps, env3, `${SIGN_INS_PATH}/link`, { method: "POST", body: { method, challenge: pkce.challenge, returnTo: callback.redirectUri, state: pkce.state } });
|
|
377404
|
+
const authorizeUrl = typeof started2.body.authorizeUrl === "string" ? started2.body.authorizeUrl : "";
|
|
377405
|
+
const linkId = typeof started2.body.linkId === "string" ? started2.body.linkId : "";
|
|
377406
|
+
if (!/^https:\/\/[^\s]+$/u.test(authorizeUrl) || !/^lnk_[A-Za-z0-9_-]{43}$/u.test(linkId)) throw agentXError("RUNTIME_UNAVAILABLE", "AgentX answered with something unexpected; try again");
|
|
377407
|
+
if (options.browser) {
|
|
377408
|
+
options.write(`Opening your browser to sign in with ${METHOD_WORDS[method]}. If it does not open, open this link: ${authorizeUrl}`);
|
|
377409
|
+
await (options.openBrowser ?? openSystemBrowser)(authorizeUrl).catch(() => void 0);
|
|
377410
|
+
} else {
|
|
377411
|
+
options.write(`Open this link in a browser on this computer and sign in with ${METHOD_WORDS[method]}: ${authorizeUrl}`);
|
|
377412
|
+
}
|
|
377413
|
+
const back = await callback.answer;
|
|
377414
|
+
if (back.linkId !== linkId) throw agentXError("AUTH_REQUIRED", ENDED.failed);
|
|
377415
|
+
const finished = await appRequest(deps, env3, `${SIGN_INS_PATH}/link/finish`, { method: "POST", body: { linkId, linkCode: back.linkCode, verifier: pkce.verifier } });
|
|
377416
|
+
return result(finished, { method }, `Connected ${METHOD_WORDS[method]} to your account. You can now sign in to AgentX environment ${finished.env} with it too.
|
|
377417
|
+
`);
|
|
377418
|
+
} finally {
|
|
377419
|
+
callback.close();
|
|
377420
|
+
}
|
|
377421
|
+
}
|
|
377422
|
+
|
|
377202
377423
|
// packages/cli/src/developer/lessons-replay.ts
|
|
377203
377424
|
init_dist2();
|
|
377204
377425
|
function registerLessonsReplayCommand(program2, context) {
|
|
@@ -377293,7 +377514,7 @@ function workspacesText(result4) {
|
|
|
377293
377514
|
// packages/cli/src/workspaces-ui/server.ts
|
|
377294
377515
|
init_dist2();
|
|
377295
377516
|
import { randomBytes as randomBytes5, timingSafeEqual as timingSafeEqual2 } from "node:crypto";
|
|
377296
|
-
import { createServer as
|
|
377517
|
+
import { createServer as createServer5 } from "node:http";
|
|
377297
377518
|
|
|
377298
377519
|
// packages/cli/src/workspaces-ui/protocol.ts
|
|
377299
377520
|
var UI_TOKEN_HEADER = "x-agentx-ui-token";
|
|
@@ -377570,7 +377791,7 @@ async function startWorkspacesUiServer(input2) {
|
|
|
377570
377791
|
}
|
|
377571
377792
|
return send3(response, 404, "text/plain; charset=utf-8", "not found\n");
|
|
377572
377793
|
};
|
|
377573
|
-
const server2 =
|
|
377794
|
+
const server2 = createServer5((request, response) => {
|
|
377574
377795
|
handle(request, response).catch(() => {
|
|
377575
377796
|
if (!response.headersSent) send3(response, 500, "text/plain; charset=utf-8", "Rovara could not answer that\n");
|
|
377576
377797
|
else response.end();
|
|
@@ -377670,81 +377891,6 @@ init_dist2();
|
|
|
377670
377891
|
import { readFile as readFile9 } from "node:fs/promises";
|
|
377671
377892
|
import { resolve as resolve4 } from "node:path";
|
|
377672
377893
|
|
|
377673
|
-
// packages/cli/src/output.ts
|
|
377674
|
-
init_dist2();
|
|
377675
|
-
|
|
377676
|
-
// packages/cli/src/stopped.ts
|
|
377677
|
-
init_dist2();
|
|
377678
|
-
var StoppedByOperator = class extends Error {
|
|
377679
|
-
exitCode = 130;
|
|
377680
|
-
constructor(message) {
|
|
377681
|
-
super(message);
|
|
377682
|
-
this.name = "StoppedByOperator";
|
|
377683
|
-
}
|
|
377684
|
-
};
|
|
377685
|
-
function isCtrlCAtPrompt(error64) {
|
|
377686
|
-
for (let current = error64, depth = 0; current instanceof Error && depth < 10; current = current.cause, depth += 1) {
|
|
377687
|
-
if (current.name === "AbortError" && /Ctrl\+C/.test(current.message)) return true;
|
|
377688
|
-
if (current instanceof AgentXError && current.code === "CONFIG_INVALID" && current.message.replace(/^CONFIG_INVALID: /, "") === "cancelled") return true;
|
|
377689
|
-
}
|
|
377690
|
-
return false;
|
|
377691
|
-
}
|
|
377692
|
-
|
|
377693
|
-
// packages/cli/src/output.ts
|
|
377694
|
-
function formatSuccess(data, json3) {
|
|
377695
|
-
if (json3) return `${JSON.stringify({ ok: true, data })}
|
|
377696
|
-
`;
|
|
377697
|
-
return typeof data === "string" ? `${data}
|
|
377698
|
-
` : `${JSON.stringify(data, null, 2)}
|
|
377699
|
-
`;
|
|
377700
|
-
}
|
|
377701
|
-
var ReportedFailure = class extends Error {
|
|
377702
|
-
constructor(failureCode, message, exitCode = 1) {
|
|
377703
|
-
super(message);
|
|
377704
|
-
this.failureCode = failureCode;
|
|
377705
|
-
this.exitCode = exitCode;
|
|
377706
|
-
this.name = "ReportedFailure";
|
|
377707
|
-
}
|
|
377708
|
-
failureCode;
|
|
377709
|
-
exitCode;
|
|
377710
|
-
};
|
|
377711
|
-
function formatError2(error64, json3) {
|
|
377712
|
-
if (error64 instanceof StoppedByOperator) {
|
|
377713
|
-
return { text: json3 ? `${JSON.stringify({ ok: false, error: { code: "STOPPED", message: error64.message } })}
|
|
377714
|
-
` : `${error64.message}
|
|
377715
|
-
`, exitCode: error64.exitCode };
|
|
377716
|
-
}
|
|
377717
|
-
if (error64 instanceof ReportedFailure) {
|
|
377718
|
-
return { text: json3 ? `${JSON.stringify({ ok: false, error: { code: error64.failureCode, message: error64.message } })}
|
|
377719
|
-
` : `${error64.message}
|
|
377720
|
-
`, exitCode: error64.exitCode };
|
|
377721
|
-
}
|
|
377722
|
-
const normalized4 = error64 instanceof AgentXError ? { code: error64.code, message: stripCodePrefix(error64.message, error64.code) } : { code: "INTERNAL_ERROR", message: error64 instanceof Error ? error64.message : "unexpected error" };
|
|
377723
|
-
const text16 = json3 ? `${JSON.stringify({ ok: false, error: normalized4 })}
|
|
377724
|
-
` : `AgentX error [${normalized4.code}]: ${normalized4.message}
|
|
377725
|
-
`;
|
|
377726
|
-
return {
|
|
377727
|
-
text: text16,
|
|
377728
|
-
exitCode: normalized4.code === "INTERNAL_ERROR" ? 1 : exitCodeForError(normalized4.code)
|
|
377729
|
-
};
|
|
377730
|
-
}
|
|
377731
|
-
function exitCodeForError(code2) {
|
|
377732
|
-
if (code2 === "CONFIG_INVALID" || code2 === "PROJECT_REVISION_MISMATCH") return 2;
|
|
377733
|
-
if (code2 === "AUTH_REQUIRED") return 3;
|
|
377734
|
-
if (code2 === "FORBIDDEN" || code2 === "NOT_FOUND" || code2 === "CALLBACK_FORBIDDEN") return 4;
|
|
377735
|
-
if (code2 === "WORKSPACE_NOT_READY" || code2 === "WORKSPACE_BUSY") return 5;
|
|
377736
|
-
if (code2 === "RUNTIME_UNAVAILABLE" || code2 === "OPERATION_INTERRUPTED" || code2 === "STALE_FENCE") return 6;
|
|
377737
|
-
return 7;
|
|
377738
|
-
}
|
|
377739
|
-
function plainMessage(error64) {
|
|
377740
|
-
if (error64 instanceof AgentXError) return stripCodePrefix(error64.message, error64.code);
|
|
377741
|
-
return error64 instanceof Error ? error64.message : String(error64);
|
|
377742
|
-
}
|
|
377743
|
-
function stripCodePrefix(message, code2) {
|
|
377744
|
-
const prefix2 = `${code2}: `;
|
|
377745
|
-
return message.startsWith(prefix2) ? message.slice(prefix2.length) : message;
|
|
377746
|
-
}
|
|
377747
|
-
|
|
377748
377894
|
// packages/cli/src/record/invoker.ts
|
|
377749
377895
|
init_dist2();
|
|
377750
377896
|
import { execFile as execFile2 } from "node:child_process";
|
|
@@ -378325,68 +378471,6 @@ init_dist2();
|
|
|
378325
378471
|
// packages/cli/src/session/commands.ts
|
|
378326
378472
|
init_dist2();
|
|
378327
378473
|
import { randomUUID as randomUUID5 } from "node:crypto";
|
|
378328
|
-
|
|
378329
|
-
// packages/cli/src/session/app-request.ts
|
|
378330
|
-
init_dist2();
|
|
378331
|
-
var UNSAFE = /[\p{Cc}\p{Cf}\p{Zl}\p{Zp}\p{Cs}\p{Co}͏ᅟᅠ⠀ㅤᅠ]/gu;
|
|
378332
|
-
var marker = (character) => `[U+${(character.codePointAt(0) ?? 0).toString(16).toUpperCase().padStart(4, "0")}]`;
|
|
378333
|
-
var MAX_SHOWN = 500;
|
|
378334
|
-
function terminalSafe(value) {
|
|
378335
|
-
const characters = [...String(value).replace(/[\r\n\t]+/g, " ")];
|
|
378336
|
-
const shown4 = characters.length > MAX_SHOWN ? characters.slice(0, MAX_SHOWN) : characters;
|
|
378337
|
-
return shown4.join("").replace(UNSAFE, marker) + (characters.length > MAX_SHOWN ? "...[truncated]" : "");
|
|
378338
|
-
}
|
|
378339
|
-
function jsonSafe(value) {
|
|
378340
|
-
if (typeof value === "string") return value.replace(UNSAFE, (character) => character === "\n" || character === "\r" || character === " " ? character : marker(character));
|
|
378341
|
-
if (Array.isArray(value)) return value.map(jsonSafe);
|
|
378342
|
-
if (value !== null && typeof value === "object") {
|
|
378343
|
-
return Object.fromEntries(Object.entries(value).map(([key2, child]) => [jsonSafe(key2), jsonSafe(child)]));
|
|
378344
|
-
}
|
|
378345
|
-
return value;
|
|
378346
|
-
}
|
|
378347
|
-
var clean = (text16) => terminalSafe(text16.replace(/agx[rc]_[A-Za-z0-9_-]+/g, "[hidden]"));
|
|
378348
|
-
async function appRequest(deps, env3, path6, options = {}) {
|
|
378349
|
-
const session = await developerAccessToken(deps, env3);
|
|
378350
|
-
let response;
|
|
378351
|
-
try {
|
|
378352
|
-
response = await deps.fetch(`${session.entry.url}${path6}`, {
|
|
378353
|
-
method: options.method ?? "GET",
|
|
378354
|
-
headers: { ...options.headers, authorization: `Bearer ${session.accessToken}`, ...options.body === void 0 ? {} : { "content-type": "application/json" } },
|
|
378355
|
-
...options.body === void 0 ? {} : { body: JSON.stringify(options.body) },
|
|
378356
|
-
signal: AbortSignal.timeout(3e4)
|
|
378357
|
-
});
|
|
378358
|
-
} catch {
|
|
378359
|
-
throw agentXError("RUNTIME_UNAVAILABLE", `could not reach AgentX at ${session.entry.url}; check your connection and try again`);
|
|
378360
|
-
}
|
|
378361
|
-
const value = await response.json().catch(() => void 0);
|
|
378362
|
-
if (response.status === 401) throw agentXError("AUTH_REQUIRED", `your AgentX sign-in for ${session.env} has ended; run npx ${CLI_PACKAGE_NAME} login ${session.entry.url}`);
|
|
378363
|
-
if (!response.ok) {
|
|
378364
|
-
const error64 = typeof value === "object" && value !== null ? value.error : void 0;
|
|
378365
|
-
const message = typeof error64?.message === "string" ? clean(error64.message).trim() : "";
|
|
378366
|
-
if (message === "") throw agentXError("RUNTIME_UNAVAILABLE", `AgentX answered HTTP ${response.status}; try again`);
|
|
378367
|
-
const code2 = AgentXErrorCodeSchema.safeParse(error64?.code);
|
|
378368
|
-
throw new ReportedFailure(code2.success ? code2.data : "REFUSED", message, response.status === 409 || !code2.success ? 1 : exitCodeForError(code2.data));
|
|
378369
|
-
}
|
|
378370
|
-
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
378371
|
-
throw agentXError("RUNTIME_UNAVAILABLE", `AgentX answered with something unexpected; try again, or upgrade: npx ${CLI_PACKAGE_NAME}@latest whoami`);
|
|
378372
|
-
}
|
|
378373
|
-
return { env: session.env, url: session.entry.url, status: response.status, body: value };
|
|
378374
|
-
}
|
|
378375
|
-
var result = (answer2, data, text16) => ({ env: answer2.env, url: answer2.url, data: jsonSafe(data), text: text16 });
|
|
378376
|
-
var seg = (id12) => {
|
|
378377
|
-
if (id12 === "." || id12 === "..") throw agentXError("CONFIG_INVALID", "an ID cannot be . or ..");
|
|
378378
|
-
return encodeURIComponent(id12);
|
|
378379
|
-
};
|
|
378380
|
-
var str = (value, fallback2 = "") => typeof value === "string" || typeof value === "number" ? clean(String(value)) : fallback2;
|
|
378381
|
-
var list3 = (value) => Array.isArray(value) ? value.filter((entry) => typeof entry === "object" && entry !== null) : [];
|
|
378382
|
-
var DEVELOPER_ID = /^[a-f0-9]{64}$/;
|
|
378383
|
-
async function developerRef(_deps, _env, who) {
|
|
378384
|
-
const id12 = who.trim().toLowerCase();
|
|
378385
|
-
if (!DEVELOPER_ID.test(id12)) throw agentXError("CONFIG_INVALID", "--with takes a person's developer ID (64 hexadecimal characters), project:<name>, or company; Code has no member directory to look an email up in");
|
|
378386
|
-
return { developerId: id12, name: `developer ${id12.slice(0, 8)}` };
|
|
378387
|
-
}
|
|
378388
|
-
|
|
378389
|
-
// packages/cli/src/session/commands.ts
|
|
378390
378474
|
var TEXT_MAX = 1e4;
|
|
378391
378475
|
var SAFE_URL = /^https?:\/\/[A-Za-z0-9._~:/?#@!$&'()*+,;=%[\]-]+$/;
|
|
378392
378476
|
var PAGE_TOKEN_PATH = /^\/s\/[A-Za-z0-9_-]{43}(?:\/|$)/;
|
|
@@ -378510,24 +378594,24 @@ async function sessionShare(deps, env3, id12, input2) {
|
|
|
378510
378594
|
const level = input2.level;
|
|
378511
378595
|
const target3 = input2.with.trim();
|
|
378512
378596
|
let principal;
|
|
378513
|
-
let
|
|
378597
|
+
let who2;
|
|
378514
378598
|
if (target3.toLowerCase() === "company") {
|
|
378515
378599
|
principal = { kind: "org" };
|
|
378516
|
-
|
|
378600
|
+
who2 = "everyone in your company";
|
|
378517
378601
|
} else if (target3.toLowerCase().startsWith("project:")) {
|
|
378518
378602
|
const project3 = target3.slice("project:".length);
|
|
378519
378603
|
if (!AGENTX_NAME_PATTERN.test(project3)) throw agentXError("CONFIG_INVALID", "--with project:<name> needs a project's exact name");
|
|
378520
378604
|
principal = { kind: "project", project: project3 };
|
|
378521
|
-
|
|
378605
|
+
who2 = `the ${project3} project`;
|
|
378522
378606
|
} else {
|
|
378523
378607
|
const member3 = await developerRef(deps, env3, target3);
|
|
378524
378608
|
principal = { kind: "member", developerId: member3.developerId };
|
|
378525
|
-
|
|
378609
|
+
who2 = clean(member3.name);
|
|
378526
378610
|
}
|
|
378527
378611
|
const answer2 = await appRequest(deps, env3, sessionPath(id12, "/shares"), { method: "PUT", body: { requestId: randomUUID5(), principal, level } });
|
|
378528
378612
|
if (answer2.status === 202 || answer2.body.status === "NEEDS_CONFIRMATION") return confirmationOf(answer2);
|
|
378529
378613
|
if (answer2.body.share === void 0) throw agentXError("RUNTIME_UNAVAILABLE", UNEXPECTED);
|
|
378530
|
-
return result(answer2, answer2.body, `Shared with ${
|
|
378614
|
+
return result(answer2, answer2.body, `Shared with ${who2} (${LEVEL_WORDS[level]}).
|
|
378531
378615
|
${linkOf(answer2.url, id12)}
|
|
378532
378616
|
`);
|
|
378533
378617
|
}
|
|
@@ -378583,7 +378667,7 @@ function askedQuestions(task) {
|
|
|
378583
378667
|
}] : []);
|
|
378584
378668
|
return questions.length === 0 ? void 0 : { round: intent.rounds, questions };
|
|
378585
378669
|
}
|
|
378586
|
-
var plural4 = (
|
|
378670
|
+
var plural4 = (count10, one, many) => `${count10} ${count10 === 1 ? one : many}`;
|
|
378587
378671
|
async function sessionAnswer(deps, env3, ref, input2) {
|
|
378588
378672
|
const id12 = await sessionOfRef(deps, env3, ref);
|
|
378589
378673
|
const read = await appRequest(deps, env3, sessionPath(id12), { headers: { [TASK_VIEW_HEADER]: TASK_VIEW_VERSION } });
|
|
@@ -378770,6 +378854,141 @@ function registerSessionCommands(program2, context) {
|
|
|
378770
378854
|
// packages/cli/src/company/commands.ts
|
|
378771
378855
|
init_dist2();
|
|
378772
378856
|
|
|
378857
|
+
// packages/cli/src/company/people.ts
|
|
378858
|
+
init_dist2();
|
|
378859
|
+
import { randomUUID as randomUUID6 } from "node:crypto";
|
|
378860
|
+
var MEMBERS_PATH = "/v1/dev/company/members";
|
|
378861
|
+
var MAX_PAGES3 = 50;
|
|
378862
|
+
var ROLES = ["member", "admin", "owner"];
|
|
378863
|
+
var ROLE_WORDS = { owner: "owner", admin: "administrator", member: "member" };
|
|
378864
|
+
var METHOD_WORDS2 = { slack: "Slack", oidc: "company sign-in", github: "GitHub" };
|
|
378865
|
+
var pad = (value) => String(value).padStart(2, "0");
|
|
378866
|
+
function localTime(iso8) {
|
|
378867
|
+
const at = new Date(iso8);
|
|
378868
|
+
if (Number.isNaN(at.getTime())) return terminalSafe(iso8);
|
|
378869
|
+
return `${at.getFullYear()}-${pad(at.getMonth() + 1)}-${pad(at.getDate())} ${pad(at.getHours())}:${pad(at.getMinutes())}`;
|
|
378870
|
+
}
|
|
378871
|
+
var day = (iso8) => localTime(iso8).slice(0, 10);
|
|
378872
|
+
var asMember = (value) => {
|
|
378873
|
+
if (typeof value !== "object" || value === null) return void 0;
|
|
378874
|
+
const row2 = value;
|
|
378875
|
+
if (typeof row2.personId !== "string" || typeof row2.role !== "string" || typeof row2.joinedAt !== "string") return void 0;
|
|
378876
|
+
return {
|
|
378877
|
+
personId: row2.personId,
|
|
378878
|
+
role: row2.role,
|
|
378879
|
+
joinedAt: row2.joinedAt,
|
|
378880
|
+
...typeof row2.name === "string" ? { name: row2.name } : {},
|
|
378881
|
+
...typeof row2.email === "string" ? { email: row2.email } : {},
|
|
378882
|
+
...typeof row2.signsInWith === "string" ? { signsInWith: row2.signsInWith } : {},
|
|
378883
|
+
...typeof row2.revokedAt === "string" ? { revokedAt: row2.revokedAt } : {}
|
|
378884
|
+
};
|
|
378885
|
+
};
|
|
378886
|
+
async function allMembers(deps, env3) {
|
|
378887
|
+
const members2 = [];
|
|
378888
|
+
let cursor2;
|
|
378889
|
+
let answer2;
|
|
378890
|
+
for (let page = 0; page < MAX_PAGES3; page += 1) {
|
|
378891
|
+
answer2 = await appRequest(deps, env3, `${MEMBERS_PATH}?limit=100${cursor2 === void 0 ? "" : `&cursor=${encodeURIComponent(cursor2)}`}`);
|
|
378892
|
+
const rows = Array.isArray(answer2.body.members) ? answer2.body.members : [];
|
|
378893
|
+
for (const row2 of rows) {
|
|
378894
|
+
const member3 = asMember(row2);
|
|
378895
|
+
if (member3 !== void 0) members2.push(member3);
|
|
378896
|
+
}
|
|
378897
|
+
cursor2 = answer2.body.more === true && typeof answer2.body.cursor === "string" ? answer2.body.cursor : void 0;
|
|
378898
|
+
if (cursor2 === void 0) break;
|
|
378899
|
+
}
|
|
378900
|
+
return { env: answer2.env, url: answer2.url, members: members2, more: cursor2 !== void 0 };
|
|
378901
|
+
}
|
|
378902
|
+
var who = (member3) => {
|
|
378903
|
+
const name3 = member3.name === void 0 ? void 0 : terminalSafe(member3.name);
|
|
378904
|
+
const email4 = member3.email === void 0 ? void 0 : terminalSafe(member3.email);
|
|
378905
|
+
return name3 !== void 0 && email4 !== void 0 ? `${name3} (${email4})` : name3 ?? email4 ?? `person ${member3.personId.slice(0, 12)}`;
|
|
378906
|
+
};
|
|
378907
|
+
function findMember(members2, typed) {
|
|
378908
|
+
const live = members2.filter((member3) => member3.revokedAt === void 0);
|
|
378909
|
+
const key2 = typed.trim();
|
|
378910
|
+
const lower = key2.toLowerCase();
|
|
378911
|
+
const byId = live.filter((member3) => member3.personId === lower);
|
|
378912
|
+
const byEmail = live.filter((member3) => member3.email?.toLowerCase() === lower);
|
|
378913
|
+
const byName = live.filter((member3) => member3.name?.toLowerCase() === lower);
|
|
378914
|
+
const found = byId.length > 0 ? byId : byEmail.length > 0 ? byEmail : byName;
|
|
378915
|
+
if (found.length === 1) return found[0];
|
|
378916
|
+
if (found.length > 1) throw agentXError("CONFIG_INVALID", `${found.length} members are called ${terminalSafe(key2)}; name them by email instead (rovara company members shows each one's)`);
|
|
378917
|
+
throw agentXError("NOT_FOUND", `no member of your company is ${terminalSafe(key2)}; rovara company members lists who is in it`);
|
|
378918
|
+
}
|
|
378919
|
+
async function companyName(deps, env3) {
|
|
378920
|
+
const details2 = await appRequest(deps, env3, COMPANY_DETAILS_PATH);
|
|
378921
|
+
return { env: details2.env, url: details2.url, name: details2.body.name === null || details2.body.name === void 0 ? "your company" : str(details2.body.name), companyId: str(details2.body.companyId) };
|
|
378922
|
+
}
|
|
378923
|
+
function memberLine(member3) {
|
|
378924
|
+
const parts2 = [` ${who(member3)}`, ROLE_WORDS[member3.role] ?? terminalSafe(member3.role)];
|
|
378925
|
+
if (member3.signsInWith !== void 0) parts2.push(`signs in with ${METHOD_WORDS2[member3.signsInWith] ?? terminalSafe(member3.signsInWith)}`);
|
|
378926
|
+
parts2.push(`joined ${day(member3.joinedAt)}`);
|
|
378927
|
+
if (member3.revokedAt !== void 0) parts2.push(`removed ${day(member3.revokedAt)}`);
|
|
378928
|
+
return parts2.join(", ");
|
|
378929
|
+
}
|
|
378930
|
+
async function companyMembers(deps, env3, options) {
|
|
378931
|
+
const listed4 = await allMembers(deps, env3);
|
|
378932
|
+
const shown4 = options.all ? listed4.members : listed4.members.filter((member3) => member3.revokedAt === void 0);
|
|
378933
|
+
const lines = shown4.length === 0 ? ["Your company has no members to show."] : [`${shown4.length} ${shown4.length === 1 ? "member" : "members"}:`, ...shown4.map(memberLine)];
|
|
378934
|
+
if (listed4.more) lines.push(`More members are not shown (the first ${MAX_PAGES3 * 100}).`);
|
|
378935
|
+
return result(listed4, { members: shown4, more: listed4.more }, `${lines.join("\n")}
|
|
378936
|
+
`);
|
|
378937
|
+
}
|
|
378938
|
+
var declined = (env3, url2) => result({ env: env3, url: url2 }, { applied: false }, "Nothing changed.\n");
|
|
378939
|
+
async function companyRole(deps, env3, typed, role, io) {
|
|
378940
|
+
if (!ROLES.includes(role)) throw agentXError("CONFIG_INVALID", "the role is member, admin or owner");
|
|
378941
|
+
const listed4 = await allMembers(deps, env3);
|
|
378942
|
+
const member3 = findMember(listed4.members, typed);
|
|
378943
|
+
if (member3.role === role) return result(listed4, { applied: false, personId: member3.personId, role }, `${who(member3)} is already ${ROLE_WORDS[role]}.
|
|
378944
|
+
`);
|
|
378945
|
+
const company = await companyName(deps, env3);
|
|
378946
|
+
io.tell(`This changes ${who(member3)}'s role in ${company.name} from ${ROLE_WORDS[member3.role] ?? terminalSafe(member3.role)} to ${ROLE_WORDS[role]}.`);
|
|
378947
|
+
if (!await io.confirm("Apply this change?")) return declined(listed4.env, listed4.url);
|
|
378948
|
+
const answer2 = await appRequest(deps, env3, `${MEMBERS_PATH}/${seg(member3.personId)}/role`, { method: "PUT", body: { role } });
|
|
378949
|
+
return result(answer2, { applied: true, personId: member3.personId, role }, `${who(member3)}'s role in ${company.name} is now ${ROLE_WORDS[role]}.
|
|
378950
|
+
`);
|
|
378951
|
+
}
|
|
378952
|
+
var count5 = (value, one, many) => {
|
|
378953
|
+
const n3 = typeof value === "number" ? value : 0;
|
|
378954
|
+
return `${n3} ${n3 === 1 ? one : many}`;
|
|
378955
|
+
};
|
|
378956
|
+
var names = (value) => Array.isArray(value) ? value.filter((item2) => typeof item2 === "string").map(terminalSafe) : [];
|
|
378957
|
+
var objectOf = (value) => typeof value === "object" && value !== null ? value : {};
|
|
378958
|
+
function removalLines(member3, company, preview, to) {
|
|
378959
|
+
const handOver = objectOf(preview.handOver);
|
|
378960
|
+
const owned3 = names(preview.ownedProjects), granted = names(preview.projectGrants);
|
|
378961
|
+
const lines = [`This removes ${who(member3)} (${ROLE_WORDS[str(preview.role)] ?? terminalSafe(str(preview.role))}) from ${company}: their sign-ins end and their access to ${company}'s projects is taken away.`];
|
|
378962
|
+
if (granted.length > 0) lines.push(` Project access they lose: ${granted.join(", ")}.`);
|
|
378963
|
+
lines.push(` ${to} takes over ${count5(handOver.agents, "agent", "agents")}, ${count5(handOver.chains, "chain", "chains")}, ${count5(handOver.projects, "project", "projects")}${owned3.length > 0 ? ` (${owned3.join(", ")})` : ""} and ${count5(handOver.tasks, "open task", "open tasks")}.`);
|
|
378964
|
+
if (typeof handOver.tasksLeft === "number" && handOver.tasksLeft > 0) lines.push(` ${count5(handOver.tasksLeft, "open task", "open tasks")} cannot be handed over and will stay without an owner.`);
|
|
378965
|
+
if (typeof preview.awaitingTheirDecision === "number" && preview.awaitingTheirDecision > 0) lines.push(` ${count5(preview.awaitingTheirDecision, "task is", "tasks are")} waiting on their decision.`);
|
|
378966
|
+
return lines;
|
|
378967
|
+
}
|
|
378968
|
+
async function companyRemove(deps, env3, typed, options, io) {
|
|
378969
|
+
const listed4 = await allMembers(deps, env3);
|
|
378970
|
+
const member3 = findMember(listed4.members, typed);
|
|
378971
|
+
const successor = options.to === void 0 ? void 0 : findMember(listed4.members, options.to);
|
|
378972
|
+
const preview = (await appRequest(deps, env3, `${MEMBERS_PATH}/${seg(member3.personId)}/removal-preview${successor === void 0 ? "" : `?successorId=${seg(successor.personId)}`}`)).body;
|
|
378973
|
+
if (preview.mayRemove === false) throw agentXError("FORBIDDEN", member3.role === "owner" ? "only an owner can remove an owner" : "you cannot remove this member");
|
|
378974
|
+
const company = await companyName(deps, env3);
|
|
378975
|
+
const named5 = objectOf(preview.successor).name;
|
|
378976
|
+
const to = typeof named5 === "string" ? terminalSafe(named5) : successor !== void 0 ? who(successor) : "you";
|
|
378977
|
+
for (const line23 of removalLines(member3, company.name, preview, to)) io.tell(line23);
|
|
378978
|
+
if (!await io.confirm("Apply this change?")) return declined(listed4.env, listed4.url);
|
|
378979
|
+
const answer2 = await appRequest(deps, env3, `${MEMBERS_PATH}/${seg(member3.personId)}/removal`, {
|
|
378980
|
+
method: "POST",
|
|
378981
|
+
body: { requestId: randomUUID6(), expectedRole: str(preview.role), ...successor === void 0 ? {} : { successorId: successor.personId } }
|
|
378982
|
+
});
|
|
378983
|
+
const moved = objectOf(answer2.body.moved);
|
|
378984
|
+
return result(
|
|
378985
|
+
answer2,
|
|
378986
|
+
{ applied: true, personId: member3.personId, ...answer2.body },
|
|
378987
|
+
`Removed ${who(member3)} from ${company.name}. ${to === "you" ? "You took" : `${to} took`} over ${count5(moved.agents, "agent", "agents")}, ${count5(moved.chains, "chain", "chains")}, ${count5(moved.projects, "project", "projects")} and ${count5(moved.tasks, "open task", "open tasks")}.
|
|
378988
|
+
`
|
|
378989
|
+
);
|
|
378990
|
+
}
|
|
378991
|
+
|
|
378773
378992
|
// packages/cli/src/company/invites.ts
|
|
378774
378993
|
init_dist2();
|
|
378775
378994
|
init_zod();
|
|
@@ -378821,16 +379040,19 @@ async function companyInvite(deps, env3, email4, hours) {
|
|
|
378821
379040
|
const hash9 = companyInviteEmailHash(address);
|
|
378822
379041
|
const pending = (await inviteList(deps, env3)).list.invites.find((invite) => invite.emailHash === hash9 && invite.status === "pending");
|
|
378823
379042
|
if (pending !== void 0) {
|
|
378824
|
-
throw agentXError("CONFIG_INVALID", `${address} already has an invite that ends ${when2(pending.expiresAt)}. To send a new
|
|
379043
|
+
throw agentXError("CONFIG_INVALID", `${address} already has an invite that ends ${when2(pending.expiresAt)}. To send them a new link: ${CLI_COMMAND_NAME} company invites resend ${address}`);
|
|
378825
379044
|
}
|
|
378826
379045
|
const answer2 = await appRequest(deps, env3, COMPANY_PREAPPROVALS_PATH, { method: "POST", body: { email: address, role: "member", expiresInHours: hours } });
|
|
378827
379046
|
const created = CompanyPreapprovalCreatedSchema.safeParse(routeFields(answer2.body));
|
|
378828
379047
|
if (!created.success) throw agentXError("RUNTIME_UNAVAILABLE", UNEXPECTED2);
|
|
378829
|
-
|
|
379048
|
+
return inviteMade(answer2, company, address, hash9, created.data.invite, `Invited ${address} to ${companyNameOf(company)} as a member.`);
|
|
379049
|
+
}
|
|
379050
|
+
var companyNameOf = (company) => company.name === null ? "your company" : terminalSafe(company.name);
|
|
379051
|
+
function inviteMade(answer2, company, address, hash9, invite, first2) {
|
|
379052
|
+
const { secret, expiresAt } = invite;
|
|
378830
379053
|
const command5 = `npx ${CLI_PACKAGE_NAME}@latest login ${answer2.url} --company ${company.companyId} --invite ${secret}`;
|
|
378831
|
-
const companyName2 = company.name === null ? "your company" : terminalSafe(company.name);
|
|
378832
379054
|
const text16 = [
|
|
378833
|
-
|
|
379055
|
+
`${first2} The invite works once and ends ${when2(expiresAt)}.`,
|
|
378834
379056
|
"Send them this command to run on their computer. It is shown only now, so copy it:",
|
|
378835
379057
|
"",
|
|
378836
379058
|
` ${command5}`,
|
|
@@ -378840,6 +379062,23 @@ async function companyInvite(deps, env3, email4, hours) {
|
|
|
378840
379062
|
].join("\n") + "\n";
|
|
378841
379063
|
return result(answer2, { companyId: company.companyId, email: address, emailHash: hash9, role: "member", expiresAt, invite: secret, command: command5 }, text16);
|
|
378842
379064
|
}
|
|
379065
|
+
async function companyInviteResend(deps, env3, email4, hours) {
|
|
379066
|
+
const address = inviteEmail(email4);
|
|
379067
|
+
const company = await companyOf(deps, env3);
|
|
379068
|
+
const hash9 = companyInviteEmailHash(address);
|
|
379069
|
+
let answer2;
|
|
379070
|
+
try {
|
|
379071
|
+
answer2 = await appRequest(deps, env3, `${COMPANY_PREAPPROVALS_PATH}/${hash9}/resend`, { method: "POST", body: { expiresInHours: hours } });
|
|
379072
|
+
} catch (error64) {
|
|
379073
|
+
if (error64 instanceof ReportedFailure && error64.failureCode === "NOT_FOUND") {
|
|
379074
|
+
throw new ReportedFailure("NOT_FOUND", `${address} has no pending invite to resend (it may have been used, withdrawn or have ended). To invite them again: ${CLI_COMMAND_NAME} company invite ${address}`, error64.exitCode);
|
|
379075
|
+
}
|
|
379076
|
+
throw error64;
|
|
379077
|
+
}
|
|
379078
|
+
const created = CompanyPreapprovalCreatedSchema.safeParse(routeFields(answer2.body));
|
|
379079
|
+
if (!created.success) throw agentXError("RUNTIME_UNAVAILABLE", UNEXPECTED2);
|
|
379080
|
+
return inviteMade(answer2, company, address, hash9, created.data.invite, `Sent ${address} a new invite link to ${companyNameOf(company)}; the old one no longer works.`);
|
|
379081
|
+
}
|
|
378843
379082
|
async function companyInvites(deps, env3, email4) {
|
|
378844
379083
|
const hash9 = email4 === void 0 ? void 0 : emailHashOf(email4);
|
|
378845
379084
|
const answer2 = await inviteList(deps, env3);
|
|
@@ -378861,17 +379100,17 @@ async function companyInviteWithdraw(deps, env3, emailOrHash) {
|
|
|
378861
379100
|
}
|
|
378862
379101
|
|
|
378863
379102
|
// packages/cli/src/company/commands.ts
|
|
378864
|
-
var
|
|
379103
|
+
var ROLE_WORDS2 = { owner: "owner", admin: "administrator", member: "member" };
|
|
378865
379104
|
function detailsText(body, renamed) {
|
|
378866
379105
|
const members2 = typeof body.members === "number" ? body.members : 0;
|
|
378867
|
-
const
|
|
379106
|
+
const count10 = `${members2.toLocaleString("en-US")}${body.membersAtLeast === true ? "+" : ""} ${members2 === 1 && body.membersAtLeast !== true ? "member" : "members"}`;
|
|
378868
379107
|
const name3 = body.name === null || body.name === void 0 ? "(no name)" : str(body.name);
|
|
378869
379108
|
return [
|
|
378870
379109
|
...renamed ? [`Renamed your company to ${name3}.`] : [],
|
|
378871
379110
|
`Company: ${name3}`,
|
|
378872
379111
|
` ID: ${str(body.companyId)}`,
|
|
378873
|
-
` Your role: ${
|
|
378874
|
-
` Members: ${
|
|
379112
|
+
` Your role: ${ROLE_WORDS2[String(body.role)] ?? str(body.role)}`,
|
|
379113
|
+
` Members: ${count10}`
|
|
378875
379114
|
].join("\n") + "\n";
|
|
378876
379115
|
}
|
|
378877
379116
|
async function companyShow(deps, env3) {
|
|
@@ -378892,6 +379131,15 @@ function registerCompanyCommands(program2, context) {
|
|
|
378892
379131
|
company.command("invite").description("invite a teammate to your company as a member, by email; prints the one-time command they run to join (a company owner or administrator only)").argument("<email>", "the email the teammate signs in with").option("--expires-in-hours <hours>", "how long the invite works, 1 to 720 hours (default 168, one week)").action(async (email4, options, command5) => print(command5, await companyInvite(context.developerSession(), context.developerEnv(command5), email4, inviteHours(options.expiresInHours))));
|
|
378893
379132
|
const invites = company.command("invites").description("list your company's invites: pending, joined, withdrawn and expired (a company owner or administrator only)").option("--email <email>", "only the invites for this email").action(async (options, command5) => print(command5, await companyInvites(context.developerSession(), context.developerEnv(command5), options.email)));
|
|
378894
379133
|
invites.command("withdraw").description("withdraw an invite, so its command no longer works (a company owner or administrator only)").argument("<email>", "the invited email (or the invite's full hash)").action(async (email4, _options, command5) => print(command5, await companyInviteWithdraw(context.developerSession(), context.developerEnv(command5), email4)));
|
|
379134
|
+
invites.command("resend").description("give a pending invite a new link and a new expiry; the old link stops working; prints the new one-time command (a company owner or administrator only)").argument("<email>", "the invited email").option("--expires-in-hours <hours>", "how long the new link works, 1 to 720 hours (default 168, one week)").action(async (email4, options, command5) => print(command5, await companyInviteResend(context.developerSession(), context.developerEnv(command5), email4, inviteHours(options.expiresInHours))));
|
|
379135
|
+
registerPeopleCommands(company, context, print);
|
|
379136
|
+
}
|
|
379137
|
+
function registerPeopleCommands(company, context, print) {
|
|
379138
|
+
const io = (yes) => ({ tell: context.tell, confirm: context.confirmer(yes) });
|
|
379139
|
+
const session = () => context.developerSession();
|
|
379140
|
+
company.command("members").description("who is in your company: name, email, role, how they sign in and when they joined (a company owner or administrator only)").option("--all", "also show people who were removed", false).action(async (options, command5) => print(command5, await companyMembers(session(), context.developerEnv(command5), options)));
|
|
379141
|
+
company.command("role").description("change a member's role to member, admin or owner (an owner or administrator; only an owner changes an owner or makes one); shows the change and asks first").argument("<member>", "the member's email, name or person id").argument("<role>", "member, admin or owner").option("--yes", "make the change without asking", false).action(async (member3, role, options, command5) => print(command5, await companyRole(session(), context.developerEnv(command5), member3, role, io(options.yes))));
|
|
379142
|
+
company.command("remove").description("remove a member from your company and hand what they own to you (or --to someone else); shows what moves and asks first").argument("<member>", "the member's email, name or person id").option("--to <member>", "the member who takes over their agents, chains, projects and open tasks (default: you)").option("--yes", "make the change without asking", false).action(async (member3, options, command5) => print(command5, await companyRemove(session(), context.developerEnv(command5), member3, options.to === void 0 ? {} : { to: options.to }, io(options.yes))));
|
|
378895
379143
|
}
|
|
378896
379144
|
|
|
378897
379145
|
// packages/cli/src/admin/workspaces.ts
|
|
@@ -379898,7 +380146,7 @@ function runCommand(command5, args) {
|
|
|
379898
380146
|
// packages/cli/src/mcp/serve.ts
|
|
379899
380147
|
init_dist2();
|
|
379900
380148
|
import { execFile as execFile4 } from "node:child_process";
|
|
379901
|
-
import { randomUUID as
|
|
380149
|
+
import { randomUUID as randomUUID9 } from "node:crypto";
|
|
379902
380150
|
|
|
379903
380151
|
// node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js
|
|
379904
380152
|
import process3 from "node:process";
|
|
@@ -380011,7 +380259,7 @@ var StdioServerTransport = class {
|
|
|
380011
380259
|
init_dist2();
|
|
380012
380260
|
init_dist2();
|
|
380013
380261
|
init_zod();
|
|
380014
|
-
import { randomUUID as
|
|
380262
|
+
import { randomUUID as randomUUID7 } from "node:crypto";
|
|
380015
380263
|
|
|
380016
380264
|
// packages/mcp/dist/errors.js
|
|
380017
380265
|
init_dist2();
|
|
@@ -380203,7 +380451,7 @@ function httpAdminClient(options) {
|
|
|
380203
380451
|
method,
|
|
380204
380452
|
headers: {
|
|
380205
380453
|
authorization: `Bearer ${session.accessToken}`,
|
|
380206
|
-
"x-agentx-trace-id": traceId ?? options.traceId?.() ??
|
|
380454
|
+
"x-agentx-trace-id": traceId ?? options.traceId?.() ?? randomUUID7(),
|
|
380207
380455
|
...body === void 0 ? {} : { "content-type": "application/json" }
|
|
380208
380456
|
},
|
|
380209
380457
|
...body === void 0 ? {} : { body: JSON.stringify(body) },
|
|
@@ -380326,7 +380574,7 @@ var ADMIN_READ_TOOLS = [
|
|
|
380326
380574
|
workspaces: health.workspaces,
|
|
380327
380575
|
workspaces_truncated: health.workspacesTruncated
|
|
380328
380576
|
},
|
|
380329
|
-
text: `AgentX API ${health.version.developerApi}, admin API ${health.version.adminApi}. Alarms: ${firing.length === 0 ? "none firing" : `in ALARM: ${firing.join(", ")}`}${missing.length === 0 ? "" : `; missing: ${missing.join(", ")}`}. Dead-letter queues: ${health.deadLetterQueuesCheck?.status ?? "not reported by this AgentX"}. Plug-ins: ${pluginHealth(health).map((row2) => `${row2.name} ${row2.status}`).join(", ") || "none reported"}. Open workspaces: ${Object.entries(health.workspaces).map(([status,
|
|
380577
|
+
text: `AgentX API ${health.version.developerApi}, admin API ${health.version.adminApi}. Alarms: ${firing.length === 0 ? "none firing" : `in ALARM: ${firing.join(", ")}`}${missing.length === 0 ? "" : `; missing: ${missing.join(", ")}`}. Dead-letter queues: ${health.deadLetterQueuesCheck?.status ?? "not reported by this AgentX"}. Plug-ins: ${pluginHealth(health).map((row2) => `${row2.name} ${row2.status}`).join(", ") || "none reported"}. Open workspaces: ${Object.entries(health.workspaces).map(([status, count10]) => `${status} ${count10}`).join(", ") || "none"}.`
|
|
380330
380578
|
};
|
|
380331
380579
|
}
|
|
380332
380580
|
},
|
|
@@ -380378,7 +380626,7 @@ var ADMIN_READ_TOOLS = [
|
|
|
380378
380626
|
byCategory.set(failure4.category, (byCategory.get(failure4.category) ?? 0) + 1);
|
|
380379
380627
|
return {
|
|
380380
380628
|
structured: given({ failures, since: answer2.since, until: answer2.until, skipped: answer2.skipped }),
|
|
380381
|
-
text: failures.length === 0 ? `No failures from ${answer2.since} to ${answer2.until}.` : `${failures.length} failure${failures.length === 1 ? "" : "s"} from ${answer2.since} to ${answer2.until}: ${[...byCategory].map(([category,
|
|
380629
|
+
text: failures.length === 0 ? `No failures from ${answer2.since} to ${answer2.until}.` : `${failures.length} failure${failures.length === 1 ? "" : "s"} from ${answer2.since} to ${answer2.until}: ${[...byCategory].map(([category, count10]) => `${category} ${count10}`).join(", ")}.`
|
|
380382
380630
|
};
|
|
380383
380631
|
}
|
|
380384
380632
|
},
|
|
@@ -380646,8 +380894,8 @@ Apply this change? It expires at ${run2.change.expiresAt}.`, timeout, run2.signa
|
|
|
380646
380894
|
throw changeError(applied);
|
|
380647
380895
|
}
|
|
380648
380896
|
if (answer2 === "decline" || answer2 === "cancel") {
|
|
380649
|
-
const
|
|
380650
|
-
throw changeError(
|
|
380897
|
+
const declined2 = await run2.admin.declineChange(run2.change.changeId, { method: "elicitation", reason: answer2 === "decline" ? "declined" : "cancelled", requestedAt, answeredAt }, run2.traceId);
|
|
380898
|
+
throw changeError(declined2);
|
|
380651
380899
|
}
|
|
380652
380900
|
const failure4 = run2.now() - asked >= timeout ? "timeout" : "error";
|
|
380653
380901
|
run2.log?.({ event: "change.elicitation_failed", changeId: run2.change.changeId, failure: failure4 });
|
|
@@ -380910,13 +381158,13 @@ var KNOWLEDGE_TOOLS = [
|
|
|
380910
381158
|
|
|
380911
381159
|
// packages/mcp/dist/admin-expiry.js
|
|
380912
381160
|
var ADMIN_EXPIRY_WARNING_MS = 5 * 6e4;
|
|
380913
|
-
var
|
|
381161
|
+
var pad2 = (value) => String(value).padStart(2, "0");
|
|
380914
381162
|
function localClockTime(ms, now) {
|
|
380915
381163
|
const at = new Date(ms);
|
|
380916
381164
|
const today = new Date(now);
|
|
380917
|
-
const clock3 = `${
|
|
381165
|
+
const clock3 = `${pad2(at.getHours())}:${pad2(at.getMinutes())}`;
|
|
380918
381166
|
const sameDay = at.getFullYear() === today.getFullYear() && at.getMonth() === today.getMonth() && at.getDate() === today.getDate();
|
|
380919
|
-
return sameDay ? clock3 : `${at.getFullYear()}-${
|
|
381167
|
+
return sameDay ? clock3 : `${at.getFullYear()}-${pad2(at.getMonth() + 1)}-${pad2(at.getDate())} ${clock3}`;
|
|
380920
381168
|
}
|
|
380921
381169
|
var adminSignInCommand = (env3, commandFor) => commandFor(`--env ${env3} login --admin`);
|
|
380922
381170
|
function adminSignInExpiredText(env3, expiresAt, now, commandFor) {
|
|
@@ -382947,7 +383195,7 @@ var ADMIN_AUDIT_TOOLS = [{
|
|
|
382947
383195
|
init_dist2();
|
|
382948
383196
|
init_dist2();
|
|
382949
383197
|
init_zod();
|
|
382950
|
-
import { randomUUID as
|
|
383198
|
+
import { randomUUID as randomUUID8 } from "node:crypto";
|
|
382951
383199
|
var SessionMessageReaderSchema2 = forwardReader(SessionMessageSchema);
|
|
382952
383200
|
var PAGE_TOKEN_PATH2 = /^\/s\/[A-Za-z0-9_-]{43}(?:\/|$)/;
|
|
382953
383201
|
var LOOPBACK_HOSTS3 = /* @__PURE__ */ new Set(["127.0.0.1", "localhost", "[::1]"]);
|
|
@@ -383076,7 +383324,7 @@ function httpControlPlaneClient(options) {
|
|
|
383076
383324
|
for (let attempt3 = 1; ; attempt3 += 1) {
|
|
383077
383325
|
if (isCancelled())
|
|
383078
383326
|
throw cancelled();
|
|
383079
|
-
const headers = { "x-agentx-trace-id": options.traceId?.() ??
|
|
383327
|
+
const headers = { "x-agentx-trace-id": options.traceId?.() ?? randomUUID8(), [TASK_VIEW_HEADER]: TASK_VIEW_VERSION };
|
|
383080
383328
|
if (authorized)
|
|
383081
383329
|
headers.authorization = `Bearer ${current.accessToken}`;
|
|
383082
383330
|
if (body !== void 0)
|
|
@@ -384203,7 +384451,7 @@ var ExperimentalMcpServerTasks = class {
|
|
|
384203
384451
|
// node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js
|
|
384204
384452
|
init_zod();
|
|
384205
384453
|
function toolInputElementCount(value, max) {
|
|
384206
|
-
let
|
|
384454
|
+
let count10 = 0;
|
|
384207
384455
|
const stack = [value];
|
|
384208
384456
|
while (stack.length > 0) {
|
|
384209
384457
|
const node2 = stack.pop();
|
|
@@ -384211,8 +384459,8 @@ function toolInputElementCount(value, max) {
|
|
|
384211
384459
|
continue;
|
|
384212
384460
|
if (Array.isArray(node2)) {
|
|
384213
384461
|
for (const child of node2) {
|
|
384214
|
-
if (++
|
|
384215
|
-
return
|
|
384462
|
+
if (++count10 > max)
|
|
384463
|
+
return count10;
|
|
384216
384464
|
if (child !== null && typeof child === "object")
|
|
384217
384465
|
stack.push(child);
|
|
384218
384466
|
}
|
|
@@ -384220,15 +384468,15 @@ function toolInputElementCount(value, max) {
|
|
|
384220
384468
|
for (const key2 in node2) {
|
|
384221
384469
|
if (!Object.prototype.hasOwnProperty.call(node2, key2))
|
|
384222
384470
|
continue;
|
|
384223
|
-
if (++
|
|
384224
|
-
return
|
|
384471
|
+
if (++count10 > max)
|
|
384472
|
+
return count10;
|
|
384225
384473
|
const child = node2[key2];
|
|
384226
384474
|
if (child !== null && typeof child === "object")
|
|
384227
384475
|
stack.push(child);
|
|
384228
384476
|
}
|
|
384229
384477
|
}
|
|
384230
384478
|
}
|
|
384231
|
-
return
|
|
384479
|
+
return count10;
|
|
384232
384480
|
}
|
|
384233
384481
|
function resolveMaxToolInputElements(value) {
|
|
384234
384482
|
if (value === void 0 || value === Infinity)
|
|
@@ -385151,7 +385399,7 @@ init_dist2();
|
|
|
385151
385399
|
import { realpathSync } from "node:fs";
|
|
385152
385400
|
|
|
385153
385401
|
// packages/cli/src/version.ts
|
|
385154
|
-
var RELEASE_VERSION = true ? "0.5.
|
|
385402
|
+
var RELEASE_VERSION = true ? "0.5.17" : void 0;
|
|
385155
385403
|
var CLI_VERSION = RELEASE_VERSION ?? "0.1.0";
|
|
385156
385404
|
function isPrereleaseVersion(version3) {
|
|
385157
385405
|
return /^\d+\.\d+\.\d+-/.test(version3);
|
|
@@ -385320,7 +385568,7 @@ function agentxMcpServer(deps) {
|
|
|
385320
385568
|
admin,
|
|
385321
385569
|
now,
|
|
385322
385570
|
sleep: (ms, signal) => deps.clock === void 0 ? abortableSleep2(ms, signal) : deps.clock.sleep(ms, signal),
|
|
385323
|
-
newRequestId:
|
|
385571
|
+
newRequestId: randomUUID9
|
|
385324
385572
|
})
|
|
385325
385573
|
});
|
|
385326
385574
|
}
|
|
@@ -385544,14 +385792,14 @@ function ssmParameterStore(client) {
|
|
|
385544
385792
|
}
|
|
385545
385793
|
},
|
|
385546
385794
|
async list(path6) {
|
|
385547
|
-
const
|
|
385795
|
+
const names2 = [];
|
|
385548
385796
|
let NextToken;
|
|
385549
385797
|
do {
|
|
385550
385798
|
const page = await client.send(new import_client_ssm.GetParametersByPathCommand({ Path: path6, Recursive: true, ...NextToken ? { NextToken } : {} }));
|
|
385551
|
-
|
|
385799
|
+
names2.push(...(page.Parameters ?? []).flatMap((parameter) => parameter.Name ? [parameter.Name] : []));
|
|
385552
385800
|
NextToken = page.NextToken;
|
|
385553
385801
|
} while (NextToken);
|
|
385554
|
-
return
|
|
385802
|
+
return names2;
|
|
385555
385803
|
}
|
|
385556
385804
|
};
|
|
385557
385805
|
}
|
|
@@ -385746,8 +385994,8 @@ async function writeEnvironmentSettings(store, settings, options = {}) {
|
|
|
385746
385994
|
}
|
|
385747
385995
|
}
|
|
385748
385996
|
async function listEnvironments(store) {
|
|
385749
|
-
const
|
|
385750
|
-
return
|
|
385997
|
+
const names2 = await store.list("/agentx/");
|
|
385998
|
+
return names2.map((name3) => /^\/agentx\/([^/]+)\/settings$/.exec(name3)?.[1]).filter((env3) => env3 !== void 0 && EnvironmentNameSchema.safeParse(env3).success).sort();
|
|
385751
385999
|
}
|
|
385752
386000
|
|
|
385753
386001
|
// packages/cli/src/environments/adopt.ts
|
|
@@ -385818,13 +386066,13 @@ async function adoptEnvironment(input2) {
|
|
|
385818
386066
|
if (await readEnvironmentSettings(input2.store, input2.env) !== void 0) {
|
|
385819
386067
|
throw agentXError("CONFIG_INVALID", `environment ${input2.env} already has settings; nothing changed`);
|
|
385820
386068
|
}
|
|
385821
|
-
const
|
|
385822
|
-
await healthyStack(input2.stacks,
|
|
385823
|
-
const runtime = await healthyStack(input2.stacks,
|
|
385824
|
-
const control = await healthyStack(input2.stacks,
|
|
385825
|
-
const slack = await healthyStack(input2.stacks,
|
|
385826
|
-
const issuer = required2(control,
|
|
385827
|
-
const audience = required2(control,
|
|
386069
|
+
const names2 = ADOPTED_STACK_NAMES;
|
|
386070
|
+
await healthyStack(input2.stacks, names2.foundation);
|
|
386071
|
+
const runtime = await healthyStack(input2.stacks, names2.runtime);
|
|
386072
|
+
const control = await healthyStack(input2.stacks, names2["control-plane"]);
|
|
386073
|
+
const slack = await healthyStack(input2.stacks, names2.slack);
|
|
386074
|
+
const issuer = required2(control, names2["control-plane"], "parameters", "OidcIssuer");
|
|
386075
|
+
const audience = required2(control, names2["control-plane"], "parameters", "OidcAudience");
|
|
385828
386076
|
const providers = {
|
|
385829
386077
|
orchestrator: slack.parameters.ModelProvider ?? "amazon-bedrock",
|
|
385830
386078
|
classifier: slack.parameters.GateClassifierProvider ?? "amazon-bedrock",
|
|
@@ -385836,9 +386084,9 @@ async function adoptEnvironment(input2) {
|
|
|
385836
386084
|
throw agentXError("CONFIG_INVALID", "OpenRouter secret references differ between worker and Slack stacks; align them before adopting");
|
|
385837
386085
|
}
|
|
385838
386086
|
const models = ModelsAnswersSchema.parse({
|
|
385839
|
-
orchestrator: required2(slack,
|
|
385840
|
-
classifier: required2(slack,
|
|
385841
|
-
worker: required2(runtime,
|
|
386087
|
+
orchestrator: required2(slack, names2.slack, "parameters", "ModelId"),
|
|
386088
|
+
classifier: required2(slack, names2.slack, "parameters", "GateClassifierModelId"),
|
|
386089
|
+
worker: required2(runtime, names2.runtime, "parameters", "ModelId"),
|
|
385842
386090
|
...Object.values(providers).some((provider) => provider !== "amazon-bedrock") ? { providers } : {},
|
|
385843
386091
|
...secretArn ? { openRouter: { secretArn, ...routing ? { providers: routing.split(",") } : {} } } : {},
|
|
385844
386092
|
...directKeyAnswers([control, runtime, slack])
|
|
@@ -385851,8 +386099,8 @@ async function adoptEnvironment(input2) {
|
|
|
385851
386099
|
engine: "cdk",
|
|
385852
386100
|
version: "unversioned",
|
|
385853
386101
|
naming: "legacy",
|
|
385854
|
-
stacks: { ...
|
|
385855
|
-
controlPlaneUrl: controlPlaneUrlOf(control.outputs, () => required2(control,
|
|
386102
|
+
stacks: { ...names2 },
|
|
386103
|
+
controlPlaneUrl: controlPlaneUrlOf(control.outputs, () => required2(control, names2["control-plane"], "outputs", "ApiEndpoint")),
|
|
385856
386104
|
identity: { mode: issuer.startsWith("https://cognito-idp.") ? "cognito" : "oidc", issuer, audience, clientId: input2.clientId ?? audience },
|
|
385857
386105
|
models,
|
|
385858
386106
|
updatedAt: new Date(now()).toISOString()
|
|
@@ -387642,10 +387890,10 @@ async function loadDeployAnswers(path6, options = {}) {
|
|
|
387642
387890
|
}
|
|
387643
387891
|
function parseParts(raw2) {
|
|
387644
387892
|
if (raw2 === void 0) return void 0;
|
|
387645
|
-
const
|
|
387646
|
-
const invalid =
|
|
387893
|
+
const names2 = raw2.split(",").map((part) => part.trim()).filter((part) => part !== "");
|
|
387894
|
+
const invalid = names2.find((name3) => !STACK_PARTS.includes(name3));
|
|
387647
387895
|
if (invalid !== void 0) throw agentXError("CONFIG_INVALID", `--parts names an unknown part ${invalid}; expected one of ${STACK_PARTS.join(", ")}`);
|
|
387648
|
-
return
|
|
387896
|
+
return names2;
|
|
387649
387897
|
}
|
|
387650
387898
|
function partitionFromArn(arn) {
|
|
387651
387899
|
const match = /^arn:([^:]+):/.exec(arn);
|
|
@@ -388114,7 +388362,7 @@ var LIST_PRICE_LABELS = { anthropic: "Anthropic list price", openai: "OpenAI lis
|
|
|
388114
388362
|
var STATED_USAGE = { turnsPerMonth: 1e3, workerSessionsPerMonth: 100, workerInstanceHoursPerMonth: 60, keptWorkspaces: 10 };
|
|
388115
388363
|
var cents = (usd2) => Math.round(usd2 * 100);
|
|
388116
388364
|
var money2 = (usd2) => `$${usd2.toFixed(2)}`;
|
|
388117
|
-
var
|
|
388365
|
+
var count6 = (n3) => n3.toLocaleString("en-US");
|
|
388118
388366
|
var TABLES = { orchestrator: ORCHESTRATOR_PER_TURN, classifier: CLASSIFIER_PER_CHECK, worker: WORKER_PER_SESSION };
|
|
388119
388367
|
var UNIT = { orchestrator: "a turn", classifier: "a check", worker: "a coding session" };
|
|
388120
388368
|
var ROLE_NAMES = { orchestrator: "Main model", classifier: "Safety check model", worker: "Coding model" };
|
|
@@ -388157,7 +388405,7 @@ function estimateMonthlyCost(models, usage2 = STATED_USAGE) {
|
|
|
388157
388405
|
}
|
|
388158
388406
|
const listed4 = LIST_PRICE_LABELS[models.providers?.[role] ?? ""];
|
|
388159
388407
|
const assumed = listed4 !== void 0 ? `, ${listed4}` : ASSUMED_PRICES.has(id12) ? ", assumed: no confirmed Bedrock rate" : "";
|
|
388160
|
-
return priced(item2, each * uses, `${
|
|
388408
|
+
return priced(item2, each * uses, `${count6(uses)} ${what} at about $${each} each${assumed}`);
|
|
388161
388409
|
};
|
|
388162
388410
|
const lines = [
|
|
388163
388411
|
priced("Two NAT gateways", 2 * PRICES.natGatewayHour * HOURS_PER_MONTH, `2 x $${PRICES.natGatewayHour}/hour, plus $0.045 per GB processed`),
|
|
@@ -389412,7 +389660,7 @@ init_parameters();
|
|
|
389412
389660
|
// packages/cli/src/init/github-app.ts
|
|
389413
389661
|
init_dist2();
|
|
389414
389662
|
import { createSign, randomBytes as randomBytes9 } from "node:crypto";
|
|
389415
|
-
import { createServer as
|
|
389663
|
+
import { createServer as createServer6 } from "node:http";
|
|
389416
389664
|
|
|
389417
389665
|
// packages/cli/src/github/webhook-setup.ts
|
|
389418
389666
|
init_dist2();
|
|
@@ -390895,7 +391143,7 @@ async function startManifestListener(input2) {
|
|
|
390895
391143
|
code2.catch(() => void 0);
|
|
390896
391144
|
let redirectUrl = "";
|
|
390897
391145
|
let port = 0;
|
|
390898
|
-
const server2 =
|
|
391146
|
+
const server2 = createServer6((request, response) => {
|
|
390899
391147
|
const url2 = new URL(request.url ?? "/", "http://127.0.0.1");
|
|
390900
391148
|
const send3 = (status, body) => {
|
|
390901
391149
|
response.writeHead(status, { "content-type": "text/html; charset=utf-8" });
|
|
@@ -391336,7 +391584,7 @@ init_dist2();
|
|
|
391336
391584
|
var import_lib_dynamodb3 = __toESM(require_dist_cjs42(), 1);
|
|
391337
391585
|
init_zod();
|
|
391338
391586
|
init_dist2();
|
|
391339
|
-
import { randomBytes as randomBytes11, randomUUID as
|
|
391587
|
+
import { randomBytes as randomBytes11, randomUUID as randomUUID11 } from "node:crypto";
|
|
391340
391588
|
|
|
391341
391589
|
// packages/broker/dist/aws/company-check.js
|
|
391342
391590
|
var import_lib_dynamodb = __toESM(require_dist_cjs42(), 1);
|
|
@@ -391380,7 +391628,7 @@ var import_lib_dynamodb2 = __toESM(require_dist_cjs42(), 1);
|
|
|
391380
391628
|
init_dist2();
|
|
391381
391629
|
|
|
391382
391630
|
// packages/broker/dist/developer/tokens.js
|
|
391383
|
-
import { createHash as createHash35, createPublicKey, randomBytes as randomBytes10, randomUUID as
|
|
391631
|
+
import { createHash as createHash35, createPublicKey, randomBytes as randomBytes10, randomUUID as randomUUID10, timingSafeEqual as timingSafeEqual3 } from "node:crypto";
|
|
391384
391632
|
function sha256Hex3(value) {
|
|
391385
391633
|
return createHash35("sha256").update(value).digest("hex");
|
|
391386
391634
|
}
|
|
@@ -391702,7 +391950,7 @@ var CompanySignInStore = class {
|
|
|
391702
391950
|
throw unavailable();
|
|
391703
391951
|
await this.input.documentClient.send(new import_lib_dynamodb3.TransactWriteCommand({ TransactItems: [...writes, { Put: {
|
|
391704
391952
|
TableName: this.input.tableName,
|
|
391705
|
-
Item: { pk: companyScoped(companyId, "COMPANY_LOG"), sk: `${this.iso()}#${
|
|
391953
|
+
Item: { pk: companyScoped(companyId, "COMPANY_LOG"), sk: `${this.iso()}#${randomUUID11()}`, entityType: "COMPANY_LOG", event: event2, companyId, ...personId === void 0 ? {} : { personId }, ...memberAudit },
|
|
391706
391954
|
ConditionExpression: "attribute_not_exists(pk)"
|
|
391707
391955
|
} }] }));
|
|
391708
391956
|
}
|
|
@@ -391853,17 +392101,17 @@ var CompanySignInStore = class {
|
|
|
391853
392101
|
}
|
|
391854
392102
|
/** Stable snapshot CAS protects role, revocation and mirror contents against concurrent writers. */
|
|
391855
392103
|
memberSnapshot(member3) {
|
|
391856
|
-
const
|
|
392104
|
+
const names2 = {}, values = {};
|
|
391857
392105
|
const fields = ["entityType", "personId", "companyId", "role", "joinedAt", "joinedVia", "revokedAt", "revokedBy", "updatedAt", "updatedBy"];
|
|
391858
392106
|
const conditions = fields.map((field4, i5) => {
|
|
391859
392107
|
const name3 = `#m${i5}`, value = `:m${i5}`;
|
|
391860
|
-
|
|
392108
|
+
names2[name3] = field4;
|
|
391861
392109
|
if (member3[field4] === void 0)
|
|
391862
392110
|
return `attribute_not_exists(${name3})`;
|
|
391863
392111
|
values[value] = member3[field4];
|
|
391864
392112
|
return `${name3} = ${value}`;
|
|
391865
392113
|
});
|
|
391866
|
-
return { ConditionExpression: conditions.join(" AND "), ExpressionAttributeNames:
|
|
392114
|
+
return { ConditionExpression: conditions.join(" AND "), ExpressionAttributeNames: names2, ExpressionAttributeValues: values };
|
|
391867
392115
|
}
|
|
391868
392116
|
liveMemberCheck(companyId, personId, owner) {
|
|
391869
392117
|
const roles = owner === "any" ? "(#role = :owner OR #role = :admin OR #role = :member)" : owner ? "#role = :owner" : "(#role = :owner OR #role = :admin)";
|
|
@@ -392232,14 +392480,14 @@ function memberResult(member3, companyId) {
|
|
|
392232
392480
|
var import_lib_dynamodb13 = __toESM(require_dist_cjs42(), 1);
|
|
392233
392481
|
init_zod();
|
|
392234
392482
|
init_dist2();
|
|
392235
|
-
import { randomUUID as
|
|
392483
|
+
import { randomUUID as randomUUID14 } from "node:crypto";
|
|
392236
392484
|
|
|
392237
392485
|
// packages/broker/dist/aws/core-project-backfill.js
|
|
392238
392486
|
var import_lib_dynamodb12 = __toESM(require_dist_cjs42(), 1);
|
|
392239
392487
|
init_zod();
|
|
392240
392488
|
init_dist2();
|
|
392241
392489
|
init_project_incarnation();
|
|
392242
|
-
import { createHash as createHash56, randomUUID as
|
|
392490
|
+
import { createHash as createHash56, randomUUID as randomUUID13 } from "node:crypto";
|
|
392243
392491
|
|
|
392244
392492
|
// packages/broker/dist/aws/github-credentials.js
|
|
392245
392493
|
init_dist2();
|
|
@@ -392557,11 +392805,11 @@ var GithubInstallationBindings = class _GithubInstallationBindings {
|
|
|
392557
392805
|
});
|
|
392558
392806
|
}
|
|
392559
392807
|
/** The company a repository event writes for: the installation's binding (its account must match the event's, when the event names one), else the implicit company before the backfill marker. */
|
|
392560
|
-
async repositoryOwner(send3, installationId, deliveryId, accountLogin,
|
|
392808
|
+
async repositoryOwner(send3, installationId, deliveryId, accountLogin, names2) {
|
|
392561
392809
|
installationIdSchema.parse(installationId);
|
|
392562
392810
|
if (accountLogin !== void 0)
|
|
392563
392811
|
bindingText.parse(accountLogin);
|
|
392564
|
-
if (!DELIVERY.test(deliveryId) ||
|
|
392812
|
+
if (!DELIVERY.test(deliveryId) || names2 > REPOSITORY_MOVES_MAX)
|
|
392565
392813
|
throw githubBindingRefusal();
|
|
392566
392814
|
const row2 = await this.binding(send3, installationId);
|
|
392567
392815
|
if (row2 !== void 0)
|
|
@@ -396372,8 +396620,8 @@ var mappingSchema = external_exports.object({
|
|
|
396372
396620
|
people: external_exports.array(external_exports.object({ personId: personSchema, role: OrgRoleSchema }).strict()).max(100).default([]),
|
|
396373
396621
|
grants: external_exports.array(external_exports.object({ personId: personSchema, projectName: nameSchema, role: external_exports.enum(["developer", "administrator"]) }).strict()).max(100).default([])
|
|
396374
396622
|
}).strict().superRefine((input2, ctx) => {
|
|
396375
|
-
const
|
|
396376
|
-
if (
|
|
396623
|
+
const names2 = new Set(input2.projectNames), people = new Set(input2.people.map((p3) => p3.personId));
|
|
396624
|
+
if (names2.size !== input2.projectNames.length || people.size !== input2.people.length || new Set(input2.bindings.map((b5) => b5.installationId)).size !== input2.bindings.length || new Set(input2.grants.map((g5) => `${g5.personId}/${g5.projectName}`)).size !== input2.grants.length || input2.grants.some((g5) => !names2.has(g5.projectName) || !people.has(g5.personId)) || input2.projectNames.length + input2.bindings.length + input2.people.length + input2.grants.length > 100)
|
|
396377
396625
|
ctx.addIssue({ code: "custom", message: "invalid input" });
|
|
396378
396626
|
});
|
|
396379
396627
|
var inventorySchema = external_exports.array(external_exports.object({ project: nameSchema, revision: revisionSchema, revisionDigest: external_exports.string().regex(/^[a-f0-9]{64}$/), catalogDigest: external_exports.string().regex(/^[a-f0-9]{64}$/), metaDigest: external_exports.string().regex(/^[a-f0-9]{64}$/) }).strict()).max(100);
|
|
@@ -396393,19 +396641,19 @@ function coreProjectSnapshotFence(value) {
|
|
|
396393
396641
|
if (row2 === void 0)
|
|
396394
396642
|
return { ConditionExpression: "attribute_not_exists(pk)" };
|
|
396395
396643
|
const fields = Object.keys(row2).filter((k5) => k5 !== "pk" && k5 !== "sk").sort();
|
|
396396
|
-
const
|
|
396644
|
+
const names2 = {}, values = {};
|
|
396397
396645
|
const expressions = fields.map((key2, index) => {
|
|
396398
|
-
|
|
396646
|
+
names2[`#f${index}`] = key2;
|
|
396399
396647
|
values[`:v${index}`] = row2[key2];
|
|
396400
396648
|
return `#f${index} = :v${index}`;
|
|
396401
396649
|
});
|
|
396402
396650
|
for (const [index, field4] of ["companyId", "orgId", "project", "incarnationRevision", "status", "setupCheck", "lifecycleRevision", "indexExpiresAt", "expiresAt"].entries()) {
|
|
396403
396651
|
if (row2[field4] === void 0) {
|
|
396404
|
-
|
|
396652
|
+
names2[`#absent${index}`] = field4;
|
|
396405
396653
|
expressions.push(`attribute_not_exists(#absent${index})`);
|
|
396406
396654
|
}
|
|
396407
396655
|
}
|
|
396408
|
-
return { ConditionExpression: ["attribute_exists(pk)", ...expressions].join(" AND "), ...Object.keys(
|
|
396656
|
+
return { ConditionExpression: ["attribute_exists(pk)", ...expressions].join(" AND "), ...Object.keys(names2).length ? { ExpressionAttributeNames: names2 } : {}, ...fields.length ? { ExpressionAttributeValues: values } : {} };
|
|
396409
396657
|
}
|
|
396410
396658
|
function sourceDefinition(source3) {
|
|
396411
396659
|
const parsed = StoredProjectDefinitionSchema.safeParse(source3["definition"]);
|
|
@@ -396656,7 +396904,7 @@ async function processGrant(deps, mapping, index, dryRun, expectedRole) {
|
|
|
396656
396904
|
await transact(deps, [
|
|
396657
396905
|
{ ConditionCheck: { TableName: deps.signInTableName, Key: personKey(g5.personId), ...coreProjectSnapshotFence(source3) } },
|
|
396658
396906
|
{ ConditionCheck: { TableName: deps.signInTableName, Key: memberKey, ...coreProjectSnapshotFence(member3) } },
|
|
396659
|
-
...existing === void 0 ? [{ Put: { TableName: deps.tableName, Item: { ...key2, entityType: "MEMBERSHIP", ownerKey: g5.personId, projectName: g5.projectName, role: g5.role, grantId:
|
|
396907
|
+
...existing === void 0 ? [{ Put: { TableName: deps.tableName, Item: { ...key2, entityType: "MEMBERSHIP", ownerKey: g5.personId, projectName: g5.projectName, role: g5.role, grantId: randomUUID13(), grantedAt }, ...coreProjectSnapshotFence(void 0) } }] : [],
|
|
396660
396908
|
reversePut
|
|
396661
396909
|
], dryRun);
|
|
396662
396910
|
if (!dryRun && ((await get2(deps, key2))?.["role"] !== g5.role || (await get2(deps, reverseKey))?.["role"] !== g5.role))
|
|
@@ -396797,10 +397045,10 @@ async function legacyProjects(deps) {
|
|
|
396797
397045
|
ConsistentRead: true,
|
|
396798
397046
|
Limit: MAX_PROJECTS + 1
|
|
396799
397047
|
}));
|
|
396800
|
-
const
|
|
396801
|
-
if (
|
|
397048
|
+
const names2 = (answer2.Items ?? []).map((row2) => String(row2["sk"]).slice("PROJECT#".length)).filter((name3) => NAME6.test(name3));
|
|
397049
|
+
if (names2.length > MAX_PROJECTS)
|
|
396802
397050
|
throw new Error("too many projects");
|
|
396803
|
-
return
|
|
397051
|
+
return names2;
|
|
396804
397052
|
}
|
|
396805
397053
|
async function moveProjects(deps, companyId, projects, apply, into) {
|
|
396806
397054
|
if (projects.length === 0)
|
|
@@ -396887,7 +397135,7 @@ async function copyGrant(deps, companyId, grant, apply, into) {
|
|
|
396887
397135
|
try {
|
|
396888
397136
|
await deps.documentClient.send(new import_lib_dynamodb13.TransactWriteCommand({ TransactItems: [
|
|
396889
397137
|
{ ConditionCheck: { TableName: deps.tableName, Key: grantKeyFor(void 0, grant.ownerKey, grant.projectName), ConditionExpression: "#role = :role AND ownerKey = :person", ExpressionAttributeNames: { "#role": "role" }, ExpressionAttributeValues: { ":role": grant.role, ":person": grant.ownerKey } } },
|
|
396890
|
-
{ Put: { TableName: deps.tableName, Item: { ...key2, entityType: "MEMBERSHIP", ownerKey: grant.ownerKey, projectName: grant.projectName, role: grant.role, grantId: typeof grant["grantId"] === "string" ? grant["grantId"] :
|
|
397138
|
+
{ Put: { TableName: deps.tableName, Item: { ...key2, entityType: "MEMBERSHIP", ownerKey: grant.ownerKey, projectName: grant.projectName, role: grant.role, grantId: typeof grant["grantId"] === "string" ? grant["grantId"] : randomUUID14(), grantedAt }, ConditionExpression: "attribute_not_exists(pk)" } },
|
|
396891
397139
|
{ Put: { TableName: deps.tableName, Item: { ...reverseKey, entityType: "PROJECT_MEMBER", role: grant.role, grantedAt }, ConditionExpression: "attribute_not_exists(pk)" } }
|
|
396892
397140
|
] }));
|
|
396893
397141
|
into.written++;
|
|
@@ -398237,12 +398485,12 @@ async function ensureCompany(deps, install, stateTable, teamId, input2) {
|
|
|
398237
398485
|
const found = await install.companyId();
|
|
398238
398486
|
const owner = input2.ownerEmail === void 0 ? {} : { ownerEmail: input2.ownerEmail };
|
|
398239
398487
|
if (found !== void 0) {
|
|
398240
|
-
if (input2.apply && input2.ownerEmail !== void 0) await install.ensure({ name:
|
|
398488
|
+
if (input2.apply && input2.ownerEmail !== void 0) await install.ensure({ name: companyName2(input2), ...owner });
|
|
398241
398489
|
return { companyId: found, outcome: "existing" };
|
|
398242
398490
|
}
|
|
398243
398491
|
if (!input2.apply) return { companyId: void 0, outcome: "missing" };
|
|
398244
398492
|
const adopt = teamId === void 0 ? void 0 : await slackWorkspaceNamedCompany(deps.documentClient, stateTable, teamId);
|
|
398245
|
-
return await install.ensure({ name:
|
|
398493
|
+
return await install.ensure({ name: companyName2(input2), ...owner, ...adopt === void 0 ? {} : { adoptCompanyId: adopt } });
|
|
398246
398494
|
}
|
|
398247
398495
|
function installCompanyLines(result4) {
|
|
398248
398496
|
if (result4.status === "skipped") return [`Company: skipped, ${result4.reason}`];
|
|
@@ -398263,7 +398511,7 @@ function installCompanyPending(result4) {
|
|
|
398263
398511
|
const { move, connections } = result4;
|
|
398264
398512
|
return move.projects.written + move.people.written + move.grants.written + connections.githubInstallations.written + connections.slackChannels.written + (connections.slackWorkspace === "moved" || connections.slackWorkspace === "bound" ? 1 : 0);
|
|
398265
398513
|
}
|
|
398266
|
-
function
|
|
398514
|
+
function companyName2(input2) {
|
|
398267
398515
|
const name3 = input2.slackTeamName?.trim();
|
|
398268
398516
|
return name3 !== void 0 && name3.length > 0 && name3.length <= 80 ? name3 : input2.env;
|
|
398269
398517
|
}
|
|
@@ -398582,7 +398830,7 @@ ${body}` }) });
|
|
|
398582
398830
|
// packages/cli/src/loop/enrollment.ts
|
|
398583
398831
|
init_zod();
|
|
398584
398832
|
init_dist2();
|
|
398585
|
-
import { randomUUID as
|
|
398833
|
+
import { randomUUID as randomUUID15 } from "node:crypto";
|
|
398586
398834
|
import { createHash as createHash58 } from "node:crypto";
|
|
398587
398835
|
var ShaSchema = external_exports.string().regex(/^[a-f0-9]{40}$/u);
|
|
398588
398836
|
var DigestSchema5 = external_exports.string().regex(/^[a-f0-9]{64}$/u);
|
|
@@ -398672,7 +398920,7 @@ function createStandaloneEnrollment(input2) {
|
|
|
398672
398920
|
return StandaloneEnrollmentSchema.parse({
|
|
398673
398921
|
schemaVersion: 1,
|
|
398674
398922
|
kind: "standalone-local",
|
|
398675
|
-
enrollmentId:
|
|
398923
|
+
enrollmentId: randomUUID15(),
|
|
398676
398924
|
namespace: `local:${input2.hostId}:${input2.uid}:${input2.account}:${input2.repositoryId}`,
|
|
398677
398925
|
hostId: input2.hostId,
|
|
398678
398926
|
uid: input2.uid,
|
|
@@ -398689,14 +398937,14 @@ function createRegisteredEnrollment(input2) {
|
|
|
398689
398937
|
return RegisteredEnrollmentSchema.parse({
|
|
398690
398938
|
schemaVersion: 1,
|
|
398691
398939
|
kind: "registered",
|
|
398692
|
-
enrollmentId:
|
|
398940
|
+
enrollmentId: randomUUID15(),
|
|
398693
398941
|
...record4,
|
|
398694
398942
|
enrolledAt: now.toISOString()
|
|
398695
398943
|
});
|
|
398696
398944
|
}
|
|
398697
398945
|
function createRegisteredPendingEnrollment(input2) {
|
|
398698
398946
|
const { now, ...record4 } = input2;
|
|
398699
|
-
return RegisteredPendingEnrollmentSchema.parse({ schemaVersion: 1, kind: "registered-pending", enrollmentId:
|
|
398947
|
+
return RegisteredPendingEnrollmentSchema.parse({ schemaVersion: 1, kind: "registered-pending", enrollmentId: randomUUID15(), ...record4, enrolledAt: now.toISOString() });
|
|
398700
398948
|
}
|
|
398701
398949
|
function resolveLoopEnrollment(records, observed) {
|
|
398702
398950
|
const matchesSource = (record4) => {
|
|
@@ -398920,7 +399168,7 @@ function sameNativeTaskEvidenceReceipt(left, right) {
|
|
|
398920
399168
|
// packages/cli/src/loop/state.ts
|
|
398921
399169
|
init_zod();
|
|
398922
399170
|
import { appendFile, link as link2, mkdir as mkdir7, readFile as readFile19, readdir as readdir3, rename as rename6, unlink, writeFile as writeFile5 } from "node:fs/promises";
|
|
398923
|
-
import { randomUUID as
|
|
399171
|
+
import { randomUUID as randomUUID16 } from "node:crypto";
|
|
398924
399172
|
import { dirname as dirname7, join as join19 } from "node:path";
|
|
398925
399173
|
|
|
398926
399174
|
// packages/cli/src/loop/definitions.ts
|
|
@@ -399408,7 +399656,7 @@ var LoopStore = class {
|
|
|
399408
399656
|
const parsed = WorkItemStateSchema.parse(state3);
|
|
399409
399657
|
const path6 = join19(this.itemDir(parsed.repo, parsed.issue, parsed.target), "state.json");
|
|
399410
399658
|
await mkdir7(dirname7(path6), { recursive: true, mode: 448 });
|
|
399411
|
-
const temporary = `${path6}.${process.pid}.${
|
|
399659
|
+
const temporary = `${path6}.${process.pid}.${randomUUID16()}.tmp`;
|
|
399412
399660
|
await writeFile5(temporary, `${JSON.stringify(parsed, null, 2)}
|
|
399413
399661
|
`, { mode: 384, flag: "wx" });
|
|
399414
399662
|
try {
|
|
@@ -399420,13 +399668,13 @@ var LoopStore = class {
|
|
|
399420
399668
|
/** #358: an item's inner loops, one per pull request, in the order of the repositories' names. */
|
|
399421
399669
|
async pulls(repo, issue2) {
|
|
399422
399670
|
const dir = join19(this.itemDir(repo, issue2), "pulls");
|
|
399423
|
-
let
|
|
399671
|
+
let names2;
|
|
399424
399672
|
try {
|
|
399425
|
-
|
|
399673
|
+
names2 = (await readdir3(dir)).sort();
|
|
399426
399674
|
} catch {
|
|
399427
399675
|
return [];
|
|
399428
399676
|
}
|
|
399429
|
-
const found = await Promise.all(
|
|
399677
|
+
const found = await Promise.all(names2.filter((name3) => /^[A-Za-z0-9_.-]+__[A-Za-z0-9_.-]+$/u.test(name3)).map((name3) => this.item(repo, issue2, name3.replace("__", "/"))));
|
|
399430
399678
|
return found.filter((state3) => state3 !== void 0);
|
|
399431
399679
|
}
|
|
399432
399680
|
/** One line per event and transition, never rewritten. */
|
|
@@ -399438,13 +399686,13 @@ var LoopStore = class {
|
|
|
399438
399686
|
}
|
|
399439
399687
|
async items(repo) {
|
|
399440
399688
|
const dir = join19(this.root, "items", slugDir(repo));
|
|
399441
|
-
let
|
|
399689
|
+
let names2;
|
|
399442
399690
|
try {
|
|
399443
|
-
|
|
399691
|
+
names2 = await readdir3(dir);
|
|
399444
399692
|
} catch {
|
|
399445
399693
|
return [];
|
|
399446
399694
|
}
|
|
399447
|
-
const found = await Promise.all(
|
|
399695
|
+
const found = await Promise.all(names2.filter((name3) => /^\d+$/.test(name3)).map((name3) => this.item(repo, Number(name3))));
|
|
399448
399696
|
return found.filter((state3) => state3 !== void 0);
|
|
399449
399697
|
}
|
|
399450
399698
|
async repos() {
|
|
@@ -399636,8 +399884,8 @@ async function guarded2(group4, run2) {
|
|
|
399636
399884
|
}
|
|
399637
399885
|
}
|
|
399638
399886
|
function doctorReport(settings, checks) {
|
|
399639
|
-
const
|
|
399640
|
-
return { env: settings.env, region: settings.region, version: settings.version, engine: settings.engine, checks, failed:
|
|
399887
|
+
const count10 = (status) => checks.filter((entry) => entry.status === status).length;
|
|
399888
|
+
return { env: settings.env, region: settings.region, version: settings.version, engine: settings.engine, checks, failed: count10("fail"), warned: count10("warn"), passed: count10("ok") };
|
|
399641
399889
|
}
|
|
399642
399890
|
var LABEL4 = { ok: "ok ", warn: "warn", fail: "FAIL", skip: "skip" };
|
|
399643
399891
|
function reportText(report2) {
|
|
@@ -399913,8 +400161,8 @@ var REPOSITORY_ACCESS_WAIT_MS = 10 * 60 * 1e3;
|
|
|
399913
400161
|
var REPOSITORY_ACCESS_POLL_MS = 5e3;
|
|
399914
400162
|
var findRepository = (repositories, wanted) => repositories.find((repo) => repo.fullName.toLowerCase() === wanted.toLowerCase());
|
|
399915
400163
|
var addAt = (access10) => access10 === void 0 ? "" : ` at ${access10.settingsUrl}`;
|
|
399916
|
-
function notVisible(wanted,
|
|
399917
|
-
const seen =
|
|
400164
|
+
function notVisible(wanted, names2, access10, waited = "") {
|
|
400165
|
+
const seen = names2.length === 0 ? "it sees no repositories" : `it sees ${names2.join(", ")}`;
|
|
399918
400166
|
return agentXError("CONFIG_INVALID", `the GitHub App cannot see ${wanted}${waited}; ${seen}. Add the repository to the app's installation${addAt(access10)}, or choose one of those`);
|
|
399919
400167
|
}
|
|
399920
400168
|
async function waitForRepository(input2) {
|
|
@@ -399925,7 +400173,7 @@ async function waitForRepository(input2) {
|
|
|
399925
400173
|
input2.write("Waiting for access\u2026 (Ctrl-C to stop)");
|
|
399926
400174
|
const timeoutMs = wait2.timeoutMs ?? REPOSITORY_ACCESS_WAIT_MS;
|
|
399927
400175
|
const deadline = wait2.now() + timeoutMs;
|
|
399928
|
-
let
|
|
400176
|
+
let names2 = [];
|
|
399929
400177
|
for (; ; ) {
|
|
399930
400178
|
await wait2.sleep(wait2.pollMs ?? REPOSITORY_ACCESS_POLL_MS);
|
|
399931
400179
|
const repositories = await input2.list().catch((error64) => {
|
|
@@ -399937,30 +400185,30 @@ async function waitForRepository(input2) {
|
|
|
399937
400185
|
input2.write(`The app can see ${found.fullName} now.`);
|
|
399938
400186
|
return found;
|
|
399939
400187
|
}
|
|
399940
|
-
if (repositories !== void 0)
|
|
399941
|
-
if (wait2.now() >= deadline) throw notVisible(wanted,
|
|
400188
|
+
if (repositories !== void 0) names2 = repositories.map((repo) => repo.fullName);
|
|
400189
|
+
if (wait2.now() >= deadline) throw notVisible(wanted, names2, access10, ` after ${Math.round(timeoutMs / 6e4)} minutes of waiting`);
|
|
399942
400190
|
}
|
|
399943
400191
|
}
|
|
399944
400192
|
async function chooseRepository(input2) {
|
|
399945
400193
|
const { prompter, flag, access: access10 } = input2;
|
|
399946
400194
|
const repositories = await input2.list();
|
|
399947
|
-
const
|
|
400195
|
+
const names2 = repositories.map((repo) => repo.fullName);
|
|
399948
400196
|
if (flag !== void 0) {
|
|
399949
400197
|
const found2 = findRepository(repositories, flag);
|
|
399950
400198
|
if (found2 !== void 0) return found2;
|
|
399951
|
-
if (access10?.wait === void 0) throw notVisible(flag,
|
|
400199
|
+
if (access10?.wait === void 0) throw notVisible(flag, names2, access10);
|
|
399952
400200
|
return waitForRepository({ wanted: flag, list: input2.list, access: access10, wait: access10.wait, write: input2.write });
|
|
399953
400201
|
}
|
|
399954
400202
|
if (repositories.length === 0) throw agentXError("CONFIG_INVALID", `the GitHub App sees no repositories; choose at least one in the app's installation settings${addAt(access10)}, then run this again`);
|
|
399955
|
-
const examples =
|
|
399956
|
-
const wanted = await prompter.choose("Which repository is the first project's?",
|
|
400203
|
+
const examples = names2.slice(0, REPOSITORY_EXAMPLES).join(", ") + (names2.length > REPOSITORY_EXAMPLES ? `, and ${names2.length - REPOSITORY_EXAMPLES} more` : "");
|
|
400204
|
+
const wanted = await prompter.choose("Which repository is the first project's?", names2.map((fullName) => ({ value: fullName, label: fullName })), {
|
|
399957
400205
|
flag: "--repository",
|
|
399958
|
-
defaultValue:
|
|
400206
|
+
defaultValue: names2[0],
|
|
399959
400207
|
// With --yes (or no terminal) the first of several repositories is never guessed.
|
|
399960
|
-
unattendedRefusal: `the GitHub App sees ${
|
|
400208
|
+
unattendedRefusal: `the GitHub App sees ${names2.length} repositories (for example ${examples}); pass --repository <owner/name> to choose the first project's`
|
|
399961
400209
|
});
|
|
399962
400210
|
const found = findRepository(repositories, wanted);
|
|
399963
|
-
if (found === void 0) throw notVisible(wanted,
|
|
400211
|
+
if (found === void 0) throw notVisible(wanted, names2, access10);
|
|
399964
400212
|
return found;
|
|
399965
400213
|
}
|
|
399966
400214
|
async function existingProject(configDir, name3) {
|
|
@@ -400629,8 +400877,8 @@ function settledReply(mine, input2) {
|
|
|
400629
400877
|
}
|
|
400630
400878
|
async function waitForThreadedReply(input2) {
|
|
400631
400879
|
const timeout = input2.timeoutMs ?? REPLY_WAIT_MS;
|
|
400632
|
-
const
|
|
400633
|
-
const minutes2 = `${
|
|
400880
|
+
const count10 = Math.round(timeout / 6e4);
|
|
400881
|
+
const minutes2 = `${count10} ${count10 === 1 ? "minute" : "minutes"}`;
|
|
400634
400882
|
const started2 = input2.now();
|
|
400635
400883
|
const since = new Date(started2 - EARLY_MS2).toISOString();
|
|
400636
400884
|
const prefix2 = `${input2.teamId}/${input2.channelId}/`;
|
|
@@ -400661,7 +400909,7 @@ import { randomBytes as randomBytes13 } from "node:crypto";
|
|
|
400661
400909
|
// packages/cli/src/init/ui/server.ts
|
|
400662
400910
|
init_dist2();
|
|
400663
400911
|
import { randomBytes as randomBytes12, timingSafeEqual as timingSafeEqual4 } from "node:crypto";
|
|
400664
|
-
import { createServer as
|
|
400912
|
+
import { createServer as createServer7 } from "node:http";
|
|
400665
400913
|
|
|
400666
400914
|
// packages/cli/src/init/ui/protocol.ts
|
|
400667
400915
|
var WIZARD_TOKEN_HEADER = "x-agentx-wizard-token";
|
|
@@ -401610,7 +401858,7 @@ async function startWizardServer(input2) {
|
|
|
401610
401858
|
if (problem2 !== void 0) return refuse3(problem2);
|
|
401611
401859
|
return send3(response, 200, "application/json; charset=utf-8", JSON.stringify({ ok: true }));
|
|
401612
401860
|
};
|
|
401613
|
-
const server2 =
|
|
401861
|
+
const server2 = createServer7((request, response) => {
|
|
401614
401862
|
handle(request, response).catch(() => {
|
|
401615
401863
|
if (!response.headersSent) send3(response, 500, "text/plain; charset=utf-8", "the install wizard could not answer that\n");
|
|
401616
401864
|
else response.end();
|
|
@@ -402481,13 +402729,13 @@ function adminUserStep() {
|
|
|
402481
402729
|
if (card.stage === "failed") context.surface?.clearLink?.();
|
|
402482
402730
|
context.surface?.card(adminCard(card));
|
|
402483
402731
|
};
|
|
402484
|
-
const signIn = (
|
|
402732
|
+
const signIn = (who2, passwordEmail) => retryOnPage({
|
|
402485
402733
|
surface: context.surface,
|
|
402486
402734
|
prompter: context.prompter,
|
|
402487
402735
|
question: "Sign in again?",
|
|
402488
402736
|
failed: (problem2) => show2({ stage: "failed", problem: problem2 }),
|
|
402489
402737
|
run: async () => {
|
|
402490
|
-
show2({ stage: "signing-in", who, ...passwordEmail === void 0 ? {} : { passwordEmail } });
|
|
402738
|
+
show2({ stage: "signing-in", who: who2, ...passwordEmail === void 0 ? {} : { passwordEmail } });
|
|
402491
402739
|
return context.adminSession();
|
|
402492
402740
|
}
|
|
402493
402741
|
});
|
|
@@ -402607,14 +402855,14 @@ function firstProjectStep() {
|
|
|
402607
402855
|
}
|
|
402608
402856
|
var isConnectorType = (value) => CONNECTOR_TYPES.includes(value);
|
|
402609
402857
|
function parseConnectorsFlag(value) {
|
|
402610
|
-
const
|
|
402858
|
+
const names2 = value.split(",").map((entry) => entry.trim().toLowerCase()).filter((entry) => entry !== "");
|
|
402611
402859
|
const wanted = /* @__PURE__ */ new Set();
|
|
402612
|
-
for (const name3 of
|
|
402860
|
+
for (const name3 of names2) {
|
|
402613
402861
|
if (name3 === "none") continue;
|
|
402614
402862
|
if (!isConnectorType(name3)) throw agentXError("CONFIG_INVALID", `--connectors ${name3} is not a connector; use linear, jira, asana or none, separated by commas`);
|
|
402615
402863
|
wanted.add(name3);
|
|
402616
402864
|
}
|
|
402617
|
-
if (
|
|
402865
|
+
if (names2.includes("none") && wanted.size > 0) throw agentXError("CONFIG_INVALID", "--connectors none means no connectors; do not list it with linear, jira or asana");
|
|
402618
402866
|
return wanted;
|
|
402619
402867
|
}
|
|
402620
402868
|
function connectorsStep() {
|
|
@@ -403037,7 +403285,7 @@ function installPlanText(answers, estimate, notes, extras = {}) {
|
|
|
403037
403285
|
"",
|
|
403038
403286
|
"Estimated monthly cost:",
|
|
403039
403287
|
...estimate.lines.map((line23) => ` ${(line23.usd === void 0 ? "not priced" : money2(line23.usd)).padStart(10)} ${line23.item} (${line23.basis})`),
|
|
403040
|
-
`Estimated monthly total: ${money2(estimate.totalUsd)} at ${
|
|
403288
|
+
`Estimated monthly total: ${money2(estimate.totalUsd)} at ${count6(STATED_USAGE.turnsPerMonth)} turns, ${count6(STATED_USAGE.workerSessionsPerMonth)} coding sessions and ${STATED_USAGE.workerInstanceHoursPerMonth} machine-hours a month (us-east-1 list prices, ${PRICES_CHECKED}; your bill will differ)${notCounted(estimate).length > 0 ? `, not counting ${notCounted(estimate).join(" and ")}, whose price is not on file` : ""}.`,
|
|
403041
403289
|
"",
|
|
403042
403290
|
"To remove everything later, use the remove command in the ready summary. It deletes the coding machines' disks too."
|
|
403043
403291
|
];
|
|
@@ -403081,7 +403329,7 @@ function planSummary(answers, estimate, notes, extras = {}) {
|
|
|
403081
403329
|
cost: {
|
|
403082
403330
|
rows: estimate.lines.map((line23) => ({ item: line23.item, monthly: line23.usd === void 0 ? "not priced" : money2(line23.usd), basis: line23.basis })),
|
|
403083
403331
|
total: `About ${money2(estimate.totalUsd)} a month${missing.length === 0 ? "" : `, not counting ${missing.join(" and ")}, whose price is not on file`}.`,
|
|
403084
|
-
usage: `At ${
|
|
403332
|
+
usage: `At ${count6(STATED_USAGE.turnsPerMonth)} turns, ${count6(STATED_USAGE.workerSessionsPerMonth)} coding sessions and ${STATED_USAGE.workerInstanceHoursPerMonth} machine-hours a month, at us-east-1 list prices of ${PRICES_CHECKED}. Your bill will differ.`
|
|
403085
403333
|
},
|
|
403086
403334
|
resources: full.filter((line23) => line23.startsWith("- Stacks") || line23.startsWith("- IAM roles") || line23.startsWith("- Secrets") || line23.startsWith("- Settings")).map((line23) => line23.slice(2).replaceAll("AgentX", "Rovara"))
|
|
403087
403335
|
};
|
|
@@ -403142,10 +403390,10 @@ async function assertArchiveEntriesAreSafe(input2) {
|
|
|
403142
403390
|
const { runner, archive, cwd, archiveName, version: version3 } = input2;
|
|
403143
403391
|
const plain5 = await runner.run("tar", ["-tPzf", archive], { cwd, display: `tar -tPzf ${archiveName}`, quiet: true });
|
|
403144
403392
|
const verbose = await runner.run("tar", ["-tPzvf", archive], { cwd, display: `tar -tPzvf ${archiveName}`, quiet: true });
|
|
403145
|
-
const
|
|
403393
|
+
const names2 = plain5.stdout.split("\n").filter((line23) => line23.length > 0);
|
|
403146
403394
|
const details2 = verbose.stdout.split("\n").filter((line23) => line23.length > 0);
|
|
403147
|
-
if (
|
|
403148
|
-
|
|
403395
|
+
if (names2.length !== details2.length) throw unsafeArchiveError(version3);
|
|
403396
|
+
names2.forEach((name3, index) => {
|
|
403149
403397
|
if (name3.startsWith("/") || name3.split("/").includes("..")) throw unsafeArchiveError(version3);
|
|
403150
403398
|
const detail = details2[index] ?? "";
|
|
403151
403399
|
const type = detail.charAt(0);
|
|
@@ -403323,7 +403571,7 @@ init_settings2();
|
|
|
403323
403571
|
var NAMED_ENVIRONMENT_ONLY_PARAMETERS = new Set(namedEnvironmentOnlyFromRows(CODE_SETTING_ROWS));
|
|
403324
403572
|
var LEGACY_STACK_NAMES = new Set(Object.values(ADOPTED_STACK_NAMES));
|
|
403325
403573
|
var NO_CHANGES2 = ["didn't contain changes", "No updates are to be performed"];
|
|
403326
|
-
var
|
|
403574
|
+
var ENDED3 = /* @__PURE__ */ new Set(["EXECUTE_COMPLETE", "EXECUTE_FAILED", "OBSOLETE"]);
|
|
403327
403575
|
function isChangeSetNotFound2(error64) {
|
|
403328
403576
|
return error64 instanceof Error && (error64.name === "ChangeSetNotFoundException" || error64.name === "ChangeSetNotFound");
|
|
403329
403577
|
}
|
|
@@ -403407,7 +403655,7 @@ async function updateStackParameters(input2) {
|
|
|
403407
403655
|
if (isChangeSetNotFound2(error64)) return void 0;
|
|
403408
403656
|
throw error64;
|
|
403409
403657
|
});
|
|
403410
|
-
const finished = executed === void 0 ||
|
|
403658
|
+
const finished = executed === void 0 || ENDED3.has(executed.ExecutionStatus ?? "");
|
|
403411
403659
|
const stackStatus = finished ? (await describe5()).StackStatus ?? "" : "";
|
|
403412
403660
|
if (finished && !stackStatus.endsWith("_IN_PROGRESS")) {
|
|
403413
403661
|
if (stackStatus !== "UPDATE_COMPLETE") throw agentXError("CONFIG_INVALID", `stack ${stackName} ended in ${stackStatus}; ${label2 === "config" ? "the setting" : "sign-in"} did not change. See the stack's events in the CloudFormation console`);
|
|
@@ -403770,7 +404018,7 @@ function browserAvailable(input2) {
|
|
|
403770
404018
|
}
|
|
403771
404019
|
|
|
403772
404020
|
// packages/cli/src/init/ui/state.ts
|
|
403773
|
-
import { randomUUID as
|
|
404021
|
+
import { randomUUID as randomUUID17 } from "node:crypto";
|
|
403774
404022
|
var NEW_TAB_NOTE = "Opens in a new tab. Come back to this tab when you are done.";
|
|
403775
404023
|
var ACTION_NEEDED_TITLE = "(Action needed) Install Rovara";
|
|
403776
404024
|
var withNote = (link3) => ({ ...link3, note: NEW_TAB_NOTE });
|
|
@@ -403869,7 +404117,7 @@ function createWizardHub(env3, options = {}) {
|
|
|
403869
404117
|
publish2();
|
|
403870
404118
|
};
|
|
403871
404119
|
const publishQuestion = (next, error64) => {
|
|
403872
|
-
question = { ...next, id:
|
|
404120
|
+
question = { ...next, id: randomUUID17(), ...error64 === void 0 ? {} : { error: error64 } };
|
|
403873
404121
|
publish2();
|
|
403874
404122
|
return question;
|
|
403875
404123
|
};
|
|
@@ -404332,7 +404580,7 @@ function startHubRelay(input2) {
|
|
|
404332
404580
|
|
|
404333
404581
|
// packages/cli/src/init/ui/setup-store.ts
|
|
404334
404582
|
var import_client_dynamodb2 = __toESM(require_dist_cjs40(), 1);
|
|
404335
|
-
import { randomUUID as
|
|
404583
|
+
import { randomUUID as randomUUID18 } from "node:crypto";
|
|
404336
404584
|
var GITHUB_NONCE_PLACEHOLDER = "agentx-github-form-nonce";
|
|
404337
404585
|
var SETUP_ITEM_TTL_SECONDS = 10 * 60;
|
|
404338
404586
|
var SETUP_LOG_LINES = 200;
|
|
@@ -404360,7 +404608,7 @@ function dynamoSetupStore(input2) {
|
|
|
404360
404608
|
return { snapshot: JSON.parse(raw2), closed: item2?.closed?.BOOL === true };
|
|
404361
404609
|
},
|
|
404362
404610
|
async putAnswer(id12, value) {
|
|
404363
|
-
const key2 = `${String(now()).padStart(15, "0")}-${
|
|
404611
|
+
const key2 = `${String(now()).padStart(15, "0")}-${randomUUID18()}`;
|
|
404364
404612
|
await client.send(new import_client_dynamodb2.PutItemCommand({
|
|
404365
404613
|
TableName: table,
|
|
404366
404614
|
Item: { pk, sk: { S: `answer#${key2}` }, questionId: { S: id12 }, value: { S: value }, expiresAt: { N: expiry2(now()) } }
|
|
@@ -405787,12 +406035,12 @@ var applyOptions = (services, yes) => ({
|
|
|
405787
406035
|
});
|
|
405788
406036
|
function offeredMethods(body) {
|
|
405789
406037
|
const methods = typeof body === "object" && body !== null ? body.methods : void 0;
|
|
405790
|
-
const
|
|
406038
|
+
const names2 = [
|
|
405791
406039
|
methods?.slack === true ? "Slack" : void 0,
|
|
405792
406040
|
typeof methods?.github === "object" && methods.github !== null ? "GitHub" : void 0,
|
|
405793
406041
|
typeof methods?.oidc?.displayName === "string" ? methods.oidc.displayName : void 0
|
|
405794
406042
|
].filter((name3) => name3 !== void 0);
|
|
405795
|
-
return
|
|
406043
|
+
return names2.length === 0 ? "nothing" : names2.join(" and ");
|
|
405796
406044
|
}
|
|
405797
406045
|
async function runSigninShow(services, env3) {
|
|
405798
406046
|
const settings = await installed(services, env3);
|
|
@@ -405862,8 +406110,8 @@ function secretSource(file2, envName3) {
|
|
|
405862
406110
|
return file2 === void 0 && envName3 === void 0 ? void 0 : { ...file2 === void 0 ? {} : { file: file2 }, ...envName3 === void 0 ? {} : { envName: envName3 } };
|
|
405863
406111
|
}
|
|
405864
406112
|
function addSignInOptions(command5) {
|
|
405865
|
-
const
|
|
405866
|
-
return command5.option(`${
|
|
406113
|
+
const names2 = SIGNIN_FLAG_NAMES;
|
|
406114
|
+
return command5.option(`${names2.slackClientId} <id>`, "the Slack app's Client ID (Basic Information, App Credentials)").option(`${names2.slackClientSecret}-file <path>`, "file holding the Slack app's Client Secret").option(`${names2.slackClientSecret}-env <NAME>`, "environment variable holding the Slack app's Client Secret").option(`${names2.oidcIssuer} <url>`, "company sign-in issuer URL, for example https://acme.okta.com").option(`${names2.oidcClientId} <id>`, "client ID of the company sign-in app").option(`${names2.oidcClientSecret}-file <path>`, "file holding the company sign-in app's client secret").option(`${names2.oidcClientSecret}-env <NAME>`, "environment variable holding the company sign-in app's client secret").option(`${names2.oidcRequiredClaim} <claim>`, "claim a person must carry to use AgentX, for example groups; empty for none").option(`${names2.oidcRequiredValues} <values>`, "comma-separated values of the required claim that may use AgentX").option(`${names2.oidcDisplayName} <name>`, "name on the sign-in button, for example Okta");
|
|
405867
406115
|
}
|
|
405868
406116
|
function signInFlags(options) {
|
|
405869
406117
|
return {
|
|
@@ -406001,10 +406249,10 @@ async function unlinkAdapterUser(session, input2, fetchImplementation = fetch) {
|
|
|
406001
406249
|
|
|
406002
406250
|
// packages/cli/src/setup/adapter-commands.ts
|
|
406003
406251
|
function projectsOption(value) {
|
|
406004
|
-
const
|
|
406005
|
-
if (
|
|
406006
|
-
for (const name3 of
|
|
406007
|
-
return
|
|
406252
|
+
const names2 = [...new Set(value.split(",").map((name3) => name3.trim()).filter((name3) => name3.length > 0))];
|
|
406253
|
+
if (names2.length === 0) throw agentXError("CONFIG_INVALID", "--projects needs at least one project name");
|
|
406254
|
+
for (const name3 of names2) if (!AgentXNameSchema.safeParse(name3).success) throw agentXError("CONFIG_INVALID", `--projects ${name3} is not a project name; use lower-case letters, digits and hyphens`);
|
|
406255
|
+
return names2;
|
|
406008
406256
|
}
|
|
406009
406257
|
function globalProject(command5) {
|
|
406010
406258
|
const project3 = command5.optsWithGlobals().project;
|
|
@@ -406622,7 +406870,7 @@ import { Writable as Writable4 } from "node:stream";
|
|
|
406622
406870
|
|
|
406623
406871
|
// packages/cli/src/config/commands.ts
|
|
406624
406872
|
init_dist2();
|
|
406625
|
-
import { randomUUID as
|
|
406873
|
+
import { randomUUID as randomUUID19 } from "node:crypto";
|
|
406626
406874
|
init_gateway_price_preflight();
|
|
406627
406875
|
|
|
406628
406876
|
// packages/cli/src/config/cx-b/stack-choice.ts
|
|
@@ -406695,9 +406943,9 @@ async function requireGatewayOffers(input2) {
|
|
|
406695
406943
|
const record4 = body !== null && typeof body === "object" && !Array.isArray(body) ? body : {};
|
|
406696
406944
|
const parsed = OfferedAgentModelsSchema.safeParse({ version: record4.version, models: record4.models });
|
|
406697
406945
|
if (!parsed.success) throw unreadable();
|
|
406698
|
-
const
|
|
406699
|
-
if (
|
|
406700
|
-
const settable =
|
|
406946
|
+
const names2 = parsed.data.models.map((entry) => entry.model);
|
|
406947
|
+
if (names2.includes(value)) return;
|
|
406948
|
+
const settable = names2.filter(isCoreAgentModelId);
|
|
406701
406949
|
const examples = [...settable.filter((name3) => !name3.startsWith("claude-")), ...settable.filter((name3) => name3.startsWith("claude-"))].slice(0, GATEWAY_OFFERED_EXAMPLES);
|
|
406702
406950
|
const offers = examples.length === 0 ? "it offers no model this setting can hold" : `it offers ${examples.join(", ")}${settable.length > examples.length ? `, and ${settable.length - examples.length} more` : ""}`;
|
|
406703
406951
|
throw agentXError("CONFIG_INVALID", `${notChanged}: the model gateway does not offer ${value} to this company; ${offers}; nothing changed`);
|
|
@@ -406861,7 +407109,7 @@ async function startRecording(services, env3, session, entry, needMs, values, re
|
|
|
406861
407109
|
checkSignInLeft(services, env3, entry, session, needMs);
|
|
406862
407110
|
const hidden = SECRET_CONFIG_KEYS.has(entry.key) || values === void 0;
|
|
406863
407111
|
const change2 = { kind: "set_config", key: entry.key, target: whereText(entry.target, env3), ...hidden ? { valueHidden: true } : { before: capped2(values.before, VALUE_MAX), after: capped2(values.after, VALUE_MAX) } };
|
|
406864
|
-
const requestId =
|
|
407112
|
+
const requestId = randomUUID19();
|
|
406865
407113
|
const record4 = () => recordConfigChange({ ...session, cliVersion: CLI_VERSION, requestId, change: change2, ...requestedAt === void 0 ? {} : { requestedAt }, answeredAt: iso7(services.now()) }, services.fetch ?? fetch);
|
|
406866
407114
|
try {
|
|
406867
407115
|
let recorded;
|
|
@@ -407735,17 +407983,17 @@ async function githubChecks(context) {
|
|
|
407735
407983
|
if (installation === void 0) {
|
|
407736
407984
|
return [check3("github", "GitHub App", "fail", `the GitHub App ${app.slug} is not installed on ${app.account}`, `install it again: ${appPage}/installations/new`)];
|
|
407737
407985
|
}
|
|
407738
|
-
let
|
|
407986
|
+
let count10;
|
|
407739
407987
|
try {
|
|
407740
407988
|
const token = await services.github.installationToken(jwt2, String(installation.id));
|
|
407741
|
-
|
|
407989
|
+
count10 = await services.github.repositoryCount(token.token);
|
|
407742
407990
|
} catch (error64) {
|
|
407743
407991
|
const message = plainMessage(error64);
|
|
407744
407992
|
const fix = /\bHTTP (403|404)\b/.test(message) ? "the installation may be suspended; check it in the installation settings on GitHub, then run agentx doctor again" : "run agentx doctor again in a minute; if it keeps failing, check githubstatus.com and the app's installation settings on GitHub";
|
|
407745
407993
|
return [check3("github", "GitHub App", "fail", `installed on ${installation.account.login}, but its repositories could not be read: ${message}`, fix)];
|
|
407746
407994
|
}
|
|
407747
|
-
if (
|
|
407748
|
-
return [check3("github", "GitHub App", "ok", `installed on ${installation.account.login}, sees ${
|
|
407995
|
+
if (count10 === 0) return [check3("github", "GitHub App", "fail", `installed on ${installation.account.login}, but it sees no repository`, "choose the repositories AgentX may use in the app's installation settings on GitHub")];
|
|
407996
|
+
return [check3("github", "GitHub App", "ok", `installed on ${installation.account.login}, sees ${count10} ${count10 === 1 ? "repository" : "repositories"}`)];
|
|
407749
407997
|
}
|
|
407750
407998
|
async function githubWebhookChecks(context) {
|
|
407751
407999
|
const { env: env3, settings, services } = context;
|
|
@@ -408058,7 +408306,7 @@ var import_client_cloudwatch_logs = __toESM(require_dist_cjs50(), 1);
|
|
|
408058
408306
|
var import_client_s33 = __toESM(require_dist_cjs26(), 1);
|
|
408059
408307
|
var import_client_secrets_manager11 = __toESM(require_dist_cjs22(), 1);
|
|
408060
408308
|
init_dist2();
|
|
408061
|
-
import { randomUUID as
|
|
408309
|
+
import { randomUUID as randomUUID20 } from "node:crypto";
|
|
408062
408310
|
|
|
408063
408311
|
// packages/cli/src/destroy/names.ts
|
|
408064
408312
|
init_dist2();
|
|
@@ -408159,7 +408407,7 @@ function awsDestroyApi(clients, options = {}) {
|
|
|
408159
408407
|
},
|
|
408160
408408
|
// No RoleARN: CloudFormation deletes with the role the stack was deployed through.
|
|
408161
408409
|
async deleteStack(name3) {
|
|
408162
|
-
const token = `agentx-destroy-${
|
|
408410
|
+
const token = `agentx-destroy-${randomUUID20()}`;
|
|
408163
408411
|
await cloudFormation.send(new import_client_cloudformation11.DeleteStackCommand({ StackName: name3, ClientRequestToken: token }));
|
|
408164
408412
|
return token;
|
|
408165
408413
|
},
|
|
@@ -408513,12 +408761,12 @@ var NOUNS2 = {
|
|
|
408513
408761
|
};
|
|
408514
408762
|
var KEPT_NOUNS = { ...NOUNS2, "AWS::KMS::Key": ["KMS key", "KMS keys"] };
|
|
408515
408763
|
var counted = (resources, nouns = NOUNS2) => [...new Set(resources.map((resource) => resource.type))].map((type) => {
|
|
408516
|
-
const
|
|
408764
|
+
const count10 = resources.filter((resource) => resource.type === type).length;
|
|
408517
408765
|
const [one, many] = nouns[type] ?? [type, type];
|
|
408518
|
-
return `${
|
|
408766
|
+
return `${count10} ${count10 === 1 ? one : many}`;
|
|
408519
408767
|
});
|
|
408520
408768
|
var listed2 = (items) => items.length <= 1 ? items.join("") : `${items.slice(0, -1).join(", ")} and ${items.at(-1)}`;
|
|
408521
|
-
var plural7 = (
|
|
408769
|
+
var plural7 = (count10, one, many) => `${count10} ${count10 === 1 ? one : many}`;
|
|
408522
408770
|
function destroyPlanText(plan) {
|
|
408523
408771
|
const retained = plan.resources.filter((resource) => resource.type !== "AWS::SecretsManager::Secret");
|
|
408524
408772
|
const deleted = plan.keepData ? retained.filter((resource) => !KEPT_BY_KEEP_DATA.has(resource.type)) : retained;
|
|
@@ -408545,8 +408793,8 @@ var POLL_MS5 = 15e3;
|
|
|
408545
408793
|
var NOTICE_MS = 6e4;
|
|
408546
408794
|
var WORKER_TIMEOUT_MS = 30 * 6e4;
|
|
408547
408795
|
var minutes = (ms) => {
|
|
408548
|
-
const
|
|
408549
|
-
return `${
|
|
408796
|
+
const count10 = Math.round(ms / 6e4);
|
|
408797
|
+
return `${count10} ${count10 === 1 ? "minute" : "minutes"}`;
|
|
408550
408798
|
};
|
|
408551
408799
|
var duration3 = (ms) => ms >= 36e5 && ms % 36e5 === 0 ? `${ms / 36e5} ${ms === 36e5 ? "hour" : "hours"}` : minutes(ms);
|
|
408552
408800
|
async function aws(what, run2) {
|
|
@@ -408794,8 +409042,8 @@ async function runDestroy(options, deps) {
|
|
|
408794
409042
|
}
|
|
408795
409043
|
switch (resource.type) {
|
|
408796
409044
|
case "AWS::S3::Bucket":
|
|
408797
|
-
await api.deleteBucket(resource.physicalId, (
|
|
408798
|
-
if (
|
|
409045
|
+
await api.deleteBucket(resource.physicalId, (count10) => {
|
|
409046
|
+
if (count10 % 1e3 === 0) deps.write(`${resource.physicalId}: ${count10} objects deleted`);
|
|
408799
409047
|
});
|
|
408800
409048
|
break;
|
|
408801
409049
|
case "AWS::DynamoDB::Table":
|
|
@@ -408833,9 +409081,9 @@ async function runDestroy(options, deps) {
|
|
|
408833
409081
|
const listed4 = (await store.list(`/agentx/${env3}`)).filter((name3) => isOwnedParameter(env3, name3));
|
|
408834
409082
|
const last = [...options.keepData ? [] : [inventoryParameterName(env3)], settingsParameterName(env3)].filter((name3) => listed4.includes(name3));
|
|
408835
409083
|
const skipped = /* @__PURE__ */ new Set([settingsParameterName(env3), lockParameterName(env3), inventoryParameterName(env3)]);
|
|
408836
|
-
const
|
|
408837
|
-
for (const name3 of
|
|
408838
|
-
result4.parameters =
|
|
409084
|
+
const names2 = [...listed4.filter((name3) => !skipped.has(name3)), ...last];
|
|
409085
|
+
for (const name3 of names2) await store.delete(name3);
|
|
409086
|
+
result4.parameters = names2.length;
|
|
408839
409087
|
});
|
|
408840
409088
|
for (const path6 of localFiles) await rm12(path6, { force: true });
|
|
408841
409089
|
if (settings !== void 0) await deps.tokenStore.delete(tokenStoreKey({ issuer: settings.identity.issuer, clientId: settings.identity.clientId, audience: settings.identity.audience }));
|
|
@@ -409959,7 +410207,7 @@ function initialLoopConfig(login) {
|
|
|
409959
410207
|
// packages/cli/src/loop/daemon.ts
|
|
409960
410208
|
init_dist2();
|
|
409961
410209
|
init_zod();
|
|
409962
|
-
import { randomUUID as
|
|
410210
|
+
import { randomUUID as randomUUID21 } from "node:crypto";
|
|
409963
410211
|
import { access as access7, appendFile as appendFile2, mkdir as mkdir13, readdir as readdir6, readFile as readFile27, rm as rm15, writeFile as writeFile11 } from "node:fs/promises";
|
|
409964
410212
|
import { join as join29 } from "node:path";
|
|
409965
410213
|
|
|
@@ -411326,13 +411574,13 @@ ${said.join("\n")}`);
|
|
|
411326
411574
|
}
|
|
411327
411575
|
async answerClaims(registered, item2) {
|
|
411328
411576
|
const inbox = this.deps.store.inboxDir(item2.repo, item2.issue, item2.target);
|
|
411329
|
-
let
|
|
411577
|
+
let names2;
|
|
411330
411578
|
try {
|
|
411331
|
-
|
|
411579
|
+
names2 = await readdir6(inbox);
|
|
411332
411580
|
} catch {
|
|
411333
411581
|
return;
|
|
411334
411582
|
}
|
|
411335
|
-
for (const name3 of
|
|
411583
|
+
for (const name3 of names2.filter((entry) => /^claim-[0-9a-f-]{36}\.json$/.test(entry))) {
|
|
411336
411584
|
const path6 = join29(inbox, name3);
|
|
411337
411585
|
const claim3 = ClaimSchema3.safeParse(JSON.parse(await readFile27(path6, "utf8")));
|
|
411338
411586
|
await rm15(path6, { force: true });
|
|
@@ -411870,7 +412118,7 @@ ${entry}`);
|
|
|
411870
412118
|
if (pullHead !== void 0 && state3.worktree === void 0) await run(this.deps.exec, "git", ["-C", where.path, "fetch", "--quiet", "origin", pullHead.fetch]);
|
|
411871
412119
|
await ensureWorktree(this.deps.exec, where.path, worktree.path, worktree.branch, defaultBranch, pullHead?.ref);
|
|
411872
412120
|
}
|
|
411873
|
-
const session = state3.session ?? { harness, tmux: tmuxSessionName(state3.repo, state3.issue, state3.target), ...harness === "claude-code" ? { id:
|
|
412121
|
+
const session = state3.session ?? { harness, tmux: tmuxSessionName(state3.repo, state3.issue, state3.target), ...harness === "claude-code" ? { id: randomUUID21() } : {} };
|
|
411874
412122
|
const sessionDir = this.deps.store.sessionDir(state3.repo, state3.issue, state3.target);
|
|
411875
412123
|
await mkdir13(sessionDir, { recursive: true, mode: 448 });
|
|
411876
412124
|
const assignmentPath = join29(sessionDir, "assignment.md");
|
|
@@ -412014,7 +412262,7 @@ var AgentHarness = class {
|
|
|
412014
412262
|
};
|
|
412015
412263
|
|
|
412016
412264
|
// packages/cli/src/loop/mcp.ts
|
|
412017
|
-
import { randomUUID as
|
|
412265
|
+
import { randomUUID as randomUUID22 } from "node:crypto";
|
|
412018
412266
|
import { mkdir as mkdir14, readFile as readFile28, rm as rm16, writeFile as writeFile12 } from "node:fs/promises";
|
|
412019
412267
|
import { join as join31 } from "node:path";
|
|
412020
412268
|
init_zod();
|
|
@@ -412039,7 +412287,7 @@ function createLoopMcpServer(options) {
|
|
|
412039
412287
|
description: `Say you have finished this step, with a summary of what you did and anything you need from the person (at most ${SUMMARY_MAX2} characters). The summary is posted on the issue. The loop checks the claim and answers whether it was accepted.`,
|
|
412040
412288
|
inputSchema: { summary: external_exports.string().describe("What you did, and anything you need from the person. Posted on the issue.") }
|
|
412041
412289
|
}, async ({ summary: summary2 }) => {
|
|
412042
|
-
const claimId =
|
|
412290
|
+
const claimId = randomUUID22();
|
|
412043
412291
|
const inbox = options.store.inboxDir(options.repo, options.issue, options.target);
|
|
412044
412292
|
await mkdir14(inbox, { recursive: true, mode: 448 });
|
|
412045
412293
|
await writeFile12(join31(inbox, `claim-${claimId}.json`), JSON.stringify({ claimId, summary: summary2 }), { mode: 384 });
|
|
@@ -412652,6 +412900,17 @@ ${ROOT_HELP_DOCS_LINES.join("\n")}`);
|
|
|
412652
412900
|
const result4 = await fetchDeveloperProjects(developerSession(), developerEnv(command5));
|
|
412653
412901
|
services.stdout.write(globals.json ? formatSuccess({ env: result4.env, url: result4.url, ...result4.projects }, true) : whoamiText(result4));
|
|
412654
412902
|
});
|
|
412903
|
+
const signins = program2.command("signins").description("the ways you sign in to Rovara: the first one and each connected one").action(async (_options, command5) => {
|
|
412904
|
+
const result4 = await signInsList(developerSession(), developerEnv(command5));
|
|
412905
|
+
services.stdout.write(globalOptions2(command5).json ? formatSuccess({ env: result4.env, url: result4.url, ...result4.data }, true) : result4.text);
|
|
412906
|
+
});
|
|
412907
|
+
signins.command("link").description("connect another way to sign in (slack or github) to your account; opens the provider's page in your browser").addArgument(new Argument("<method>", "slack or github").choices([...LINKABLE])).option("--no-browser", "print the link instead of opening a browser").action(async (method, options, command5) => {
|
|
412908
|
+
const result4 = await signInsLink(developerSession(), developerEnv(command5), method, { browser: options.browser, write: (line23) => {
|
|
412909
|
+
services.stderr.write(`${line23}
|
|
412910
|
+
`);
|
|
412911
|
+
} });
|
|
412912
|
+
services.stdout.write(globalOptions2(command5).json ? formatSuccess({ env: result4.env, url: result4.url, ...result4.data }, true) : result4.text);
|
|
412913
|
+
});
|
|
412655
412914
|
program2.command("workspaces").description("show your AgentX projects and the workspaces in them, on a page served from 127.0.0.1; --no-ui prints them instead").option("--no-ui", "print the list in the terminal instead of opening a browser").action(async (options, command5) => {
|
|
412656
412915
|
const globals = globalOptions2(command5);
|
|
412657
412916
|
const overrides = dependencies.workspaces ?? {};
|
|
@@ -413395,7 +413654,10 @@ Next: have your platform team run ${result4.dir}/deploy-access.sh (see ${result4
|
|
|
413395
413654
|
return stored === void 0 ? void 0 : { env: name3, expiresAt: stored.expiresAt };
|
|
413396
413655
|
};
|
|
413397
413656
|
registerSessionCommands(program2, { developerSession, developerEnv, globalOptions: globalOptions2, write: (text16) => services.stdout.write(text16) });
|
|
413398
|
-
registerCompanyCommands(program2, { developerSession, developerEnv, globalOptions: globalOptions2, write: (text16) => services.stdout.write(text16)
|
|
413657
|
+
registerCompanyCommands(program2, { developerSession, developerEnv, globalOptions: globalOptions2, write: (text16) => services.stdout.write(text16), tell: (line23) => {
|
|
413658
|
+
services.stderr.write(`${line23}
|
|
413659
|
+
`);
|
|
413660
|
+
}, confirmer: changeConfirmer });
|
|
413399
413661
|
registerRecordCommands(program2, { write: (text16) => services.stdout.write(text16), json: (command5) => globalOptions2(command5).json, version: CLI_VERSION, ...dependencies.record ?? {} });
|
|
413400
413662
|
const mcp2 = program2.command("mcp").description("run the AgentX MCP server for your AI tool (stdio); add it with agentx mcp install").action(async (_options, command5) => {
|
|
413401
413663
|
const env3 = developerEnv(command5);
|