@preplabsai/rovara-code 0.5.21 → 0.5.22
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 +87 -240
- package/package.json +1 -1
package/bin/agentx-cli.mjs
CHANGED
|
@@ -25797,6 +25797,9 @@ var init_routes = __esm({
|
|
|
25797
25797
|
{ method: "GET", path: "/v1/dev/tasks/{taskId}/readers", requires: "tasks:share" },
|
|
25798
25798
|
{ method: "PUT", path: "/v1/dev/tasks/{taskId}/readers/{developerId}", requires: "tasks:share" },
|
|
25799
25799
|
{ method: "DELETE", path: "/v1/dev/tasks/{taskId}/readers/{developerId}", requires: "tasks:share" },
|
|
25800
|
+
// #1673: switch a shared task between view only and continue (`rovara admin task share-mode`): a live owner or admin of the task's company, or the project's administrator there.
|
|
25801
|
+
// Full access only, like the other company admin rows; anyone else gets a missing task's answer.
|
|
25802
|
+
{ method: "POST", path: "/v1/dev/tasks/{taskId}/share-mode", requires: "full" },
|
|
25800
25803
|
// Decisions: approve a plan or request changes; decide on the pull-request feedback proposal.
|
|
25801
25804
|
{ method: "POST", path: "/v1/dev/tasks/{taskId}/workflow/decision", requires: "decisions:decide" },
|
|
25802
25805
|
{ method: "POST", path: "/v1/dev/tasks/{taskId}/workflow/feedback-decision", requires: "decisions:decide" },
|
|
@@ -52426,7 +52429,7 @@ var init_e2e_view_node = __esm({
|
|
|
52426
52429
|
});
|
|
52427
52430
|
|
|
52428
52431
|
// packages/contracts/dist/plan-quality.js
|
|
52429
|
-
var PLAN_QUALITY_CODES, PLAN_QUALITY_LINTS, PLAN_QUALITY_TARGET_REASONS, FindingIds, PlanQualityFindingSchema, TARGET_REASON_SENTENCES;
|
|
52432
|
+
var PLAN_QUALITY_CODES, PLAN_QUALITY_LINTS, PLAN_QUALITY_TARGET_REASONS, FindingIds, PlanQualityFindingSchema, UPDATE_SETUP, TARGET_REASON_SENTENCES;
|
|
52430
52433
|
var init_plan_quality = __esm({
|
|
52431
52434
|
"packages/contracts/dist/plan-quality.js"() {
|
|
52432
52435
|
"use strict";
|
|
@@ -52505,14 +52508,15 @@ var init_plan_quality = __esm({
|
|
|
52505
52508
|
/** For the planner's next prompt: one line from plan IDs and fixed text. */
|
|
52506
52509
|
plannerLine: external_exports.string().min(1).max(1e3)
|
|
52507
52510
|
}).strict();
|
|
52511
|
+
UPDATE_SETUP = "A company owner or admin can fix this on the project's Browser testing page. Then close and restart the task.";
|
|
52508
52512
|
TARGET_REASON_SENTENCES = {
|
|
52509
|
-
"runtime-unavailable":
|
|
52510
|
-
"no-launch-recipe":
|
|
52511
|
-
"needs-project-contract":
|
|
52513
|
+
"runtime-unavailable": `its runtime is not set up for this project revision. ${UPDATE_SETUP}`,
|
|
52514
|
+
"no-launch-recipe": `the project has no recipe that starts it. ${UPDATE_SETUP}`,
|
|
52515
|
+
"needs-project-contract": `its test accounts are not described by a project contract. ${UPDATE_SETUP}`,
|
|
52512
52516
|
"runtime-not-ready": "its runtime is not ready now. Wait for the runtime to be qualified, then close and restart the task.",
|
|
52513
52517
|
"no-source-identity": "its application has no package or project file that names it. Add one, then close and restart the task.",
|
|
52514
|
-
"no-account-definition":
|
|
52515
|
-
"not-offered":
|
|
52518
|
+
"no-account-definition": `no usable test account is registered for it. ${UPDATE_SETUP}`,
|
|
52519
|
+
"not-offered": `this project revision does not offer it. ${UPDATE_SETUP}`,
|
|
52516
52520
|
// BROWSER-SKIP-HONESTY: the whole sentence is the fixed words (one table: browser-runner-words.ts), so it is said the same way on every surface.
|
|
52517
52521
|
"no-browser-runner": BROWSER_RUNNER_WORDS.planWillNotRun
|
|
52518
52522
|
};
|
|
@@ -64900,7 +64904,7 @@ var init_plugin_points = __esm({
|
|
|
64900
64904
|
}).strict();
|
|
64901
64905
|
PluginConfigSchema = external_exports.object({
|
|
64902
64906
|
version: external_exports.literal(PLUGIN_CONFIG_VERSION),
|
|
64903
|
-
/** The company Code runs as (decision 45.6).
|
|
64907
|
+
/** The company Code runs as (decision 45.6). Loading a config that names none is refused (#1650). It has the shape of an organization id (`org_` and 20 characters), because plug-in calls carry it as their scope (`HostScope`). */
|
|
64904
64908
|
companyId: external_exports.string().regex(/^org_[0-9a-z]{20}$/, "a company id looks like org_ and 20 lower-case letters or digits (the same shape a hosted install uses; code-host and tracker calls are scoped by it)").optional(),
|
|
64905
64909
|
/**
|
|
64906
64910
|
* Port lane L11 (laptop only, owner-set): a worker may be given the owner's own code-host token even when that token reaches every repository its owner can (a classic token, the GitHub CLI's).
|
|
@@ -100357,7 +100361,7 @@ var require_dist_cjs16 = __commonJS({
|
|
|
100357
100361
|
var { setCredentialFeature: setCredentialFeature2 } = (init_client3(), __toCommonJS(client_exports2));
|
|
100358
100362
|
var { CredentialsProviderError: CredentialsProviderError2, parseKnownFiles: parseKnownFiles2, getProfileName: getProfileName2 } = (init_config2(), __toCommonJS(config_exports));
|
|
100359
100363
|
var { HttpRequest: HttpRequest2 } = (init_protocols(), __toCommonJS(protocols_exports));
|
|
100360
|
-
var { createHash:
|
|
100364
|
+
var { createHash: createHash37, createPrivateKey, createPublicKey: createPublicKey2, sign: sign3 } = __require("node:crypto");
|
|
100361
100365
|
var { promises } = __require("node:fs");
|
|
100362
100366
|
var { homedir: homedir6 } = __require("node:os");
|
|
100363
100367
|
var { dirname: dirname13, join: join34 } = __require("node:path");
|
|
@@ -100528,7 +100532,7 @@ var require_dist_cjs16 = __commonJS({
|
|
|
100528
100532
|
getTokenFilePath() {
|
|
100529
100533
|
const directory = process.env.AWS_LOGIN_CACHE_DIRECTORY ?? join34(homedir6(), ".aws", "login", "cache");
|
|
100530
100534
|
const loginSessionBytes = Buffer.from(this.loginSession, "utf8");
|
|
100531
|
-
const loginSessionSha256 =
|
|
100535
|
+
const loginSessionSha256 = createHash37("sha256").update(loginSessionBytes).digest("hex");
|
|
100532
100536
|
return join34(directory, `${loginSessionSha256}.json`);
|
|
100533
100537
|
}
|
|
100534
100538
|
derToRawSignature(derSignature) {
|
|
@@ -339656,7 +339660,7 @@ var init_application_build_source = __esm({
|
|
|
339656
339660
|
});
|
|
339657
339661
|
|
|
339658
339662
|
// packages/verifier/dist/rovara-http-engine-descriptor.js
|
|
339659
|
-
import { createHash as
|
|
339663
|
+
import { createHash as createHash32 } from "node:crypto";
|
|
339660
339664
|
var ROVARA_HTTP_ENGINE_ASSERTION_FIXTURE, ROVARA_HTTP_ENGINE_DESCRIPTOR, ROVARA_HTTP_ENGINE_DIGEST;
|
|
339661
339665
|
var init_rovara_http_engine_descriptor = __esm({
|
|
339662
339666
|
"packages/verifier/dist/rovara-http-engine-descriptor.js"() {
|
|
@@ -339670,7 +339674,7 @@ var init_rovara_http_engine_descriptor = __esm({
|
|
|
339670
339674
|
platform: "api",
|
|
339671
339675
|
capabilities: Object.freeze([ROVARA_HTTP_ENGINE_ASSERTION_FIXTURE])
|
|
339672
339676
|
});
|
|
339673
|
-
ROVARA_HTTP_ENGINE_DIGEST =
|
|
339677
|
+
ROVARA_HTTP_ENGINE_DIGEST = createHash32("sha256").update(canonicalJson(ROVARA_HTTP_ENGINE_DESCRIPTOR)).digest("hex");
|
|
339674
339678
|
}
|
|
339675
339679
|
});
|
|
339676
339680
|
|
|
@@ -340462,7 +340466,7 @@ var init_evidence_paths = __esm({
|
|
|
340462
340466
|
});
|
|
340463
340467
|
|
|
340464
340468
|
// packages/verifier/dist/application-result-adapter.js
|
|
340465
|
-
import { createHash as
|
|
340469
|
+
import { createHash as createHash33 } from "node:crypto";
|
|
340466
340470
|
function e2eApplicationSupervisorEvidenceEntryMax(caseCount) {
|
|
340467
340471
|
if (!Number.isSafeInteger(caseCount) || caseCount < 1 || caseCount > 64)
|
|
340468
340472
|
throw new TypeError("supervisor proof case count is outside the admitted bound");
|
|
@@ -340955,7 +340959,7 @@ var init_application_result_adapter = __esm({
|
|
|
340955
340959
|
if (field4.byteLength > E2E_REPORT_MAX_BYTES || field4.bytesBase64.length !== Math.ceil(field4.byteLength / 3) * 4)
|
|
340956
340960
|
throw new Error();
|
|
340957
340961
|
const decoded = Buffer.from(field4.bytesBase64, "base64");
|
|
340958
|
-
if (decoded.toString("base64") !== field4.bytesBase64 || decoded.byteLength !== field4.byteLength ||
|
|
340962
|
+
if (decoded.toString("base64") !== field4.bytesBase64 || decoded.byteLength !== field4.byteLength || createHash33("sha256").update(decoded).digest("hex") !== field4.sha256)
|
|
340959
340963
|
throw new Error();
|
|
340960
340964
|
} catch {
|
|
340961
340965
|
context.addIssue({ code: "custom", path: ["shards"], message: "private shard bytes are not canonical base64 with the declared size and digest" });
|
|
@@ -340979,7 +340983,7 @@ var init_application_result_adapter = __esm({
|
|
|
340979
340983
|
if (proof.ref.byteLength > 26214400 || proof.bytesBase64.length !== expectedLength || proof.bytesBase64.length > 35e6)
|
|
340980
340984
|
throw new Error();
|
|
340981
340985
|
const bytes5 = Buffer.from(proof.bytesBase64, "base64");
|
|
340982
|
-
if (bytes5.toString("base64") !== proof.bytesBase64 || bytes5.byteLength !== proof.ref.byteLength ||
|
|
340986
|
+
if (bytes5.toString("base64") !== proof.bytesBase64 || bytes5.byteLength !== proof.ref.byteLength || createHash33("sha256").update(bytes5).digest("hex") !== proof.ref.sha256 || proofIds.has(proof.ref.artifactId))
|
|
340983
340987
|
throw new Error();
|
|
340984
340988
|
proofIds.add(proof.ref.artifactId);
|
|
340985
340989
|
proofBytes += bytes5.byteLength;
|
|
@@ -341078,7 +341082,7 @@ var init_application_result_adapter = __esm({
|
|
|
341078
341082
|
if (new Set(originRows.map((item) => item.componentId)).size !== originRows.length || originRows.some((item) => !sourceDerivedMocks.some((spec) => spec.componentId === item.componentId))) {
|
|
341079
341083
|
context.addIssue({ code: "custom", path: ["mockOrigins"], message: "mock origins must name each approved mock component at most once" });
|
|
341080
341084
|
}
|
|
341081
|
-
if (
|
|
341085
|
+
if (createHash33("sha256").update(canonicalJson(sourceDerivedMocks)).digest("hex") !== oracle.binding.mockManifestDigest) {
|
|
341082
341086
|
context.addIssue({ code: "custom", path: ["expectedMocksByCase"], message: "case mock expectations do not reproduce the admitted mock manifest digest" });
|
|
341083
341087
|
}
|
|
341084
341088
|
const componentsByTarget = /* @__PURE__ */ new Map();
|
|
@@ -341394,7 +341398,7 @@ var init_install_qualification = __esm({
|
|
|
341394
341398
|
});
|
|
341395
341399
|
|
|
341396
341400
|
// packages/verifier/dist/executor/host-registry.js
|
|
341397
|
-
import { createHash as
|
|
341401
|
+
import { createHash as createHash34 } from "node:crypto";
|
|
341398
341402
|
var E2E_EXECUTOR_HOST_ENTRY_POINT_ID, E2E_EXECUTOR_HOST_ENTRY_SOURCE, E2E_EXECUTOR_HOST_DESCRIPTOR, registrySchema;
|
|
341399
341403
|
var init_host_registry = __esm({
|
|
341400
341404
|
"packages/verifier/dist/executor/host-registry.js"() {
|
|
@@ -341405,7 +341409,7 @@ var init_host_registry = __esm({
|
|
|
341405
341409
|
`;
|
|
341406
341410
|
E2E_EXECUTOR_HOST_DESCRIPTOR = Object.freeze({
|
|
341407
341411
|
entryPointId: E2E_EXECUTOR_HOST_ENTRY_POINT_ID,
|
|
341408
|
-
entryPointManifestDigest:
|
|
341412
|
+
entryPointManifestDigest: createHash34("sha256").update(E2E_EXECUTOR_HOST_ENTRY_SOURCE).digest("hex")
|
|
341409
341413
|
});
|
|
341410
341414
|
registrySchema = external_exports.object({
|
|
341411
341415
|
schemaVersion: external_exports.literal("application-cli-host-registry/v1"),
|
|
@@ -341556,7 +341560,7 @@ var init_fake_core = __esm({
|
|
|
341556
341560
|
});
|
|
341557
341561
|
|
|
341558
341562
|
// packages/verifier/dist/executor/mock-server.js
|
|
341559
|
-
import { createHash as
|
|
341563
|
+
import { createHash as createHash35 } from "node:crypto";
|
|
341560
341564
|
function sortKeys2(value) {
|
|
341561
341565
|
if (Array.isArray(value))
|
|
341562
341566
|
return value.map(sortKeys2);
|
|
@@ -341575,7 +341579,7 @@ var init_mock_server = __esm({
|
|
|
341575
341579
|
"use strict";
|
|
341576
341580
|
init_fake_core();
|
|
341577
341581
|
MOCK_UNMOCKED_STATUS = 599;
|
|
341578
|
-
sha3 = (value) =>
|
|
341582
|
+
sha3 = (value) => createHash35("sha256").update(value, "utf8").digest("hex");
|
|
341579
341583
|
mockResponseDigest = (response) => sha3(canonicalJson2({ status: response.status, body: response.body }));
|
|
341580
341584
|
MOCK_UNMOCKED_RESPONSE_DIGEST = mockResponseDigest({ status: MOCK_UNMOCKED_STATUS, body: { error: "rovara-unmocked" } });
|
|
341581
341585
|
}
|
|
@@ -359403,16 +359407,15 @@ async function projectAccessChange(deps, env3, input2, io) {
|
|
|
359403
359407
|
|
|
359404
359408
|
// packages/cli/src/admin/task-share-mode.ts
|
|
359405
359409
|
import { randomUUID as randomUUID4 } from "node:crypto";
|
|
359406
|
-
async function setTaskShareMode(
|
|
359407
|
-
const
|
|
359408
|
-
|
|
359409
|
-
{
|
|
359410
|
-
|
|
359411
|
-
|
|
359412
|
-
|
|
359413
|
-
|
|
359414
|
-
|
|
359415
|
-
return adminResponseBody(response);
|
|
359410
|
+
async function setTaskShareMode(deps, env3, input2) {
|
|
359411
|
+
const answer2 = await appRequest(deps, env3, `/v1/dev/tasks/${seg(input2.taskId)}/share-mode`, {
|
|
359412
|
+
method: "POST",
|
|
359413
|
+
body: { requestId: input2.requestId ?? randomUUID4(), shareMode: input2.mode }
|
|
359414
|
+
});
|
|
359415
|
+
const share = answer2.body.task?.share;
|
|
359416
|
+
const text11 = share?.mode === "continue" ? "is open to the channel (continue)" : input2.mode === "continue" ? "stays view only: its project does not allow continue" : "is view only";
|
|
359417
|
+
return result(answer2, { task: answer2.body.task }, `Task ${input2.taskId} ${text11}.
|
|
359418
|
+
`);
|
|
359416
359419
|
}
|
|
359417
359420
|
|
|
359418
359421
|
// packages/cli/src/admin/cancel.ts
|
|
@@ -368090,7 +368093,7 @@ init_dist2();
|
|
|
368090
368093
|
import { realpathSync } from "node:fs";
|
|
368091
368094
|
|
|
368092
368095
|
// packages/cli/src/version.ts
|
|
368093
|
-
var RELEASE_VERSION = true ? "0.5.
|
|
368096
|
+
var RELEASE_VERSION = true ? "0.5.22" : void 0;
|
|
368094
368097
|
var CLI_VERSION = RELEASE_VERSION ?? "0.1.0";
|
|
368095
368098
|
function isPrereleaseVersion(version3) {
|
|
368096
368099
|
return /^\d+\.\d+\.\d+-/.test(version3);
|
|
@@ -374296,23 +374299,14 @@ var Membership = external_exports.object({
|
|
|
374296
374299
|
});
|
|
374297
374300
|
var membershipKey = (personId) => ({ pk: `COMPANY_MEMBER#${personId}`, sk: "COMPANY" });
|
|
374298
374301
|
|
|
374299
|
-
// packages/broker/dist/aws/lambda.js
|
|
374300
|
-
init_dist2();
|
|
374301
|
-
import { createHash as createHash28 } from "node:crypto";
|
|
374302
|
-
function ownerKeyForSubject(issuer, subject) {
|
|
374303
|
-
if (!subject || subject.length > 512)
|
|
374304
|
-
throw agentXError("CONFIG_INVALID", "owner subject is invalid");
|
|
374305
|
-
return createHash28("sha256").update(issuer).update("\0").update(subject).digest("hex");
|
|
374306
|
-
}
|
|
374307
|
-
|
|
374308
374302
|
// packages/broker/dist/developer/store.js
|
|
374309
374303
|
var import_lib_dynamodb2 = __toESM(require_dist_cjs42(), 1);
|
|
374310
374304
|
init_dist2();
|
|
374311
374305
|
|
|
374312
374306
|
// packages/broker/dist/developer/tokens.js
|
|
374313
|
-
import { createHash as
|
|
374307
|
+
import { createHash as createHash28, createPublicKey, randomBytes as randomBytes10, randomUUID as randomUUID10, timingSafeEqual as timingSafeEqual3 } from "node:crypto";
|
|
374314
374308
|
function sha256Hex3(value) {
|
|
374315
|
-
return
|
|
374309
|
+
return createHash28("sha256").update(value).digest("hex");
|
|
374316
374310
|
}
|
|
374317
374311
|
|
|
374318
374312
|
// packages/broker/dist/developer/store.js
|
|
@@ -374476,7 +374470,7 @@ var CompanySignInStore = class {
|
|
|
374476
374470
|
if (!OrgIdSchema.safeParse(companyId).success)
|
|
374477
374471
|
return false;
|
|
374478
374472
|
if (companyId === IMPLICIT_COMPANY_ID)
|
|
374479
|
-
return
|
|
374473
|
+
return false;
|
|
374480
374474
|
const found = CompanyRecord.safeParse(await this.read(companyKey(companyId)));
|
|
374481
374475
|
return found.success && found.data.companyId === companyId;
|
|
374482
374476
|
}
|
|
@@ -374519,26 +374513,19 @@ var CompanySignInStore = class {
|
|
|
374519
374513
|
return this.memberResult(existing, input2.companyId);
|
|
374520
374514
|
if (!await this.companyExists(input2.companyId))
|
|
374521
374515
|
return refused();
|
|
374522
|
-
let legacy = false;
|
|
374523
|
-
if (input2.companyId === IMPLICIT_COMPANY_ID) {
|
|
374524
|
-
const developer = external_exports.object({ entityType: external_exports.literal("DEVELOPER"), provider: external_exports.enum(["slack", "oidc"]), issuer: external_exports.string().min(1), subject: external_exports.string().min(1), revoked: external_exports.literal(false), firstSignInAt: external_exports.iso.datetime(), companyless: external_exports.unknown().optional(), mergedInto: external_exports.unknown().optional() }).safeParse(await this.read({ pk: `DEVELOPER#${input2.personId}`, sk: "META" }));
|
|
374525
|
-
legacy = developer.success && developer.data.companyless === void 0 && developer.data.mergedInto === void 0 && ownerKeyForSubject(developer.data.issuer, developer.data.subject) === input2.personId;
|
|
374526
|
-
}
|
|
374527
374516
|
const key = input2.email === void 0 || !CompanyEmail.safeParse(input2.email).success ? void 0 : preapprovalKey(input2.companyId, input2.email);
|
|
374528
|
-
const approval =
|
|
374529
|
-
if (
|
|
374517
|
+
const approval = key === void 0 ? void 0 : CompanyPreapproval.safeParse(await this.read(key));
|
|
374518
|
+
if (key === void 0 || !approval?.success || approval.data.status !== "live" || approval.data.expiresAt <= this.seconds())
|
|
374530
374519
|
return refused();
|
|
374531
|
-
const member2 = { entityType: "COMPANY_MEMBERSHIP", personId: input2.personId, companyId: input2.companyId, role:
|
|
374532
|
-
const writes = [{ Put: { TableName: this.input.tableName, Item: { ...membershipKey(input2.personId), ...member2 }, ConditionExpression: "attribute_not_exists(pk)" } }, this.memberMirror(member2)
|
|
374533
|
-
|
|
374534
|
-
|
|
374535
|
-
|
|
374536
|
-
|
|
374537
|
-
|
|
374538
|
-
|
|
374539
|
-
|
|
374540
|
-
ExpressionAttributeValues: { ":used": "used", ":person": input2.personId, ":at": this.iso(), ":live": "live", ":now": this.seconds(), ":expires": approval.data.expiresAt, ":role": approval.data.role, ":created": approval.data.createdAt }
|
|
374541
|
-
} });
|
|
374520
|
+
const member2 = { entityType: "COMPANY_MEMBERSHIP", personId: input2.personId, companyId: input2.companyId, role: approval.data.role, joinedAt: this.iso(), joinedVia: "preapproval" };
|
|
374521
|
+
const writes = [{ Put: { TableName: this.input.tableName, Item: { ...membershipKey(input2.personId), ...member2 }, ConditionExpression: "attribute_not_exists(pk)" } }, this.memberMirror(member2), { Update: {
|
|
374522
|
+
TableName: this.input.tableName,
|
|
374523
|
+
Key: key,
|
|
374524
|
+
UpdateExpression: "SET #status = :used, usedBy = :person, usedAt = :at",
|
|
374525
|
+
ConditionExpression: "#status = :live AND expiresAt > :now AND expiresAt = :expires AND #role = :role AND createdAt = :created",
|
|
374526
|
+
ExpressionAttributeNames: { "#status": "status", "#role": "role" },
|
|
374527
|
+
ExpressionAttributeValues: { ":used": "used", ":person": input2.personId, ":at": this.iso(), ":live": "live", ":now": this.seconds(), ":expires": approval.data.expiresAt, ":role": approval.data.role, ":created": approval.data.createdAt }
|
|
374528
|
+
} }];
|
|
374542
374529
|
try {
|
|
374543
374530
|
await this.input.documentClient.send(new import_lib_dynamodb3.TransactWriteCommand({ TransactItems: writes }));
|
|
374544
374531
|
} catch (error64) {
|
|
@@ -374547,7 +374534,7 @@ var CompanySignInStore = class {
|
|
|
374547
374534
|
const won = await this.membership(input2.personId);
|
|
374548
374535
|
return won === void 0 ? refused() : this.memberResult(won, input2.companyId);
|
|
374549
374536
|
}
|
|
374550
|
-
return { ok: true, membership: member2,
|
|
374537
|
+
return { ok: true, membership: member2, viaPreapproval: true };
|
|
374551
374538
|
} catch (error64) {
|
|
374552
374539
|
return isUnreadableMembershipRow(error64) ? refused() : { ok: false, reason: "not_invited", readFailed: true };
|
|
374553
374540
|
}
|
|
@@ -375198,7 +375185,6 @@ var READ_TOKEN_REUSE_MS = 5 * 6e4;
|
|
|
375198
375185
|
|
|
375199
375186
|
// packages/broker/dist/aws/github-credentials.js
|
|
375200
375187
|
var bindingKey = (installationId) => ({ pk: `GITHUB_INSTALLATION#${installationId}`, sk: "BINDING" });
|
|
375201
|
-
var backfillKey = { pk: "GITHUB_INSTALLATION_BINDING", sk: "BACKFILL" };
|
|
375202
375188
|
var installationIdSchema = external_exports.number().int().positive().max(Number.MAX_SAFE_INTEGER);
|
|
375203
375189
|
var bindingText = external_exports.string().min(1).max(256);
|
|
375204
375190
|
var installationSchema = external_exports.object({ installationId: installationIdSchema, accountLogin: bindingText });
|
|
@@ -375212,7 +375198,6 @@ var bindingSchema = installationSchema.extend({
|
|
|
375212
375198
|
stateAt: external_exports.iso.datetime().optional(),
|
|
375213
375199
|
accountType: external_exports.enum(["User", "Organization"]).optional()
|
|
375214
375200
|
});
|
|
375215
|
-
var markerSchema = external_exports.object({ pk: external_exports.literal("GITHUB_INSTALLATION_BINDING"), sk: external_exports.literal("BACKFILL") }).strict();
|
|
375216
375201
|
var companyInstallationKey = (companyId, installationId) => ({ pk: `ORG#${companyId}#GITHUB_INSTALLATIONS`, sk: `INSTALLATION#${installationId}` });
|
|
375217
375202
|
var companyInstallationRow = (companyId, row2) => ({
|
|
375218
375203
|
...companyInstallationKey(companyId, row2.installationId),
|
|
@@ -375258,6 +375243,10 @@ var LIFECYCLE_TRANSITIONS = {
|
|
|
375258
375243
|
};
|
|
375259
375244
|
var DELIVERY = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
|
|
375260
375245
|
var stateOf = (row2) => row2.state ?? "active";
|
|
375246
|
+
var unboundCondition = {
|
|
375247
|
+
ConditionExpression: "attribute_not_exists(pk) OR companyId = :placeholder",
|
|
375248
|
+
ExpressionAttributeValues: { ":placeholder": IMPLICIT_COMPANY_ID }
|
|
375249
|
+
};
|
|
375261
375250
|
function sameBinding(row2) {
|
|
375262
375251
|
return {
|
|
375263
375252
|
ConditionExpression: `companyId = :company AND boundAt = :boundAt AND ${row2.state === void 0 ? "attribute_not_exists(#state)" : "#state = :read"}`,
|
|
@@ -375299,13 +375288,6 @@ var GithubInstallationBindings = class _GithubInstallationBindings {
|
|
|
375299
375288
|
throw githubBindingRefusal();
|
|
375300
375289
|
}
|
|
375301
375290
|
}
|
|
375302
|
-
async marker(send3) {
|
|
375303
|
-
const response = await send3(new import_lib_dynamodb5.GetCommand({ TableName: this.tableName, Key: backfillKey, ConsistentRead: true }));
|
|
375304
|
-
if (response.Item === void 0)
|
|
375305
|
-
return false;
|
|
375306
|
-
markerSchema.parse(response.Item);
|
|
375307
|
-
return true;
|
|
375308
|
-
}
|
|
375309
375291
|
async binding(send3, installationId) {
|
|
375310
375292
|
const response = await send3(new import_lib_dynamodb5.GetCommand({ TableName: this.tableName, Key: bindingKey(installationId), ConsistentRead: true }));
|
|
375311
375293
|
if (response.Item === void 0)
|
|
@@ -375313,46 +375295,26 @@ var GithubInstallationBindings = class _GithubInstallationBindings {
|
|
|
375313
375295
|
const row2 = bindingSchema.parse(response.Item);
|
|
375314
375296
|
if (row2.installationId !== installationId)
|
|
375315
375297
|
throw githubBindingRefusal();
|
|
375316
|
-
return row2;
|
|
375317
|
-
}
|
|
375318
|
-
async ownerOf(installationId) {
|
|
375319
|
-
return this.run(async (send3) => {
|
|
375320
|
-
installationIdSchema.parse(installationId);
|
|
375321
|
-
const row2 = await this.binding(send3, installationId);
|
|
375322
|
-
if (row2 !== void 0)
|
|
375323
|
-
return row2.companyId;
|
|
375324
|
-
return await this.marker(send3) ? void 0 : IMPLICIT_COMPANY_ID;
|
|
375325
|
-
});
|
|
375298
|
+
return row2.companyId === IMPLICIT_COMPANY_ID ? void 0 : row2;
|
|
375326
375299
|
}
|
|
375327
|
-
/**
|
|
375300
|
+
/** Each installation's owner (#1650: no binding is nobody's), within the store's total command/byte/time budget. */
|
|
375328
375301
|
async ownersOf(installationIds) {
|
|
375329
375302
|
return this.run(async (send3) => {
|
|
375330
375303
|
const ids2 = external_exports.array(installationIdSchema).max(100).parse(installationIds);
|
|
375331
|
-
let marker2;
|
|
375332
375304
|
const owners = [];
|
|
375333
|
-
for (const id12 of ids2)
|
|
375334
|
-
|
|
375335
|
-
if (row2 !== void 0)
|
|
375336
|
-
owners.push(row2.companyId);
|
|
375337
|
-
else {
|
|
375338
|
-
marker2 ??= this.marker(send3);
|
|
375339
|
-
owners.push(await marker2 ? void 0 : IMPLICIT_COMPANY_ID);
|
|
375340
|
-
}
|
|
375341
|
-
}
|
|
375305
|
+
for (const id12 of ids2)
|
|
375306
|
+
owners.push((await this.binding(send3, id12))?.companyId);
|
|
375342
375307
|
return owners;
|
|
375343
375308
|
});
|
|
375344
375309
|
}
|
|
375345
|
-
/**
|
|
375346
|
-
* The owner and state of an installation: its binding's, or (no binding) the implicit company's before backfill and nobody's after. `bound` says whether a binding row names the owner: an
|
|
375347
|
-
* implicit owner (no row) is the install's old single company, which only the legacy webhook path serves (webhook lane W0).
|
|
375348
|
-
*/
|
|
375310
|
+
/** The owner and state of an installation: its binding's, or (#1650: no binding) nobody's. `bound` says whether a binding row names the owner. */
|
|
375349
375311
|
async ownerAndState(installationId) {
|
|
375350
375312
|
return this.run(async (send3) => {
|
|
375351
375313
|
installationIdSchema.parse(installationId);
|
|
375352
375314
|
const row2 = await this.binding(send3, installationId);
|
|
375353
375315
|
if (row2 !== void 0)
|
|
375354
375316
|
return { owner: row2.companyId, state: stateOf(row2), bound: true };
|
|
375355
|
-
return { owner:
|
|
375317
|
+
return { owner: void 0, state: "active", bound: false };
|
|
375356
375318
|
});
|
|
375357
375319
|
}
|
|
375358
375320
|
/**
|
|
@@ -375437,7 +375399,7 @@ var GithubInstallationBindings = class _GithubInstallationBindings {
|
|
|
375437
375399
|
}
|
|
375438
375400
|
/**
|
|
375439
375401
|
* DEC 254zc(1): GitHub's signed webhook says repositories left this installation (`installation_repositories` removed: reason "removed") or moved to another owner (`repository`
|
|
375440
|
-
* transferred: reason "transferred"). The company is the installation's, found by the installation id alone (its binding
|
|
375402
|
+
* transferred: reason "transferred"). The company is the installation's, found by the installation id alone (its binding), so one
|
|
375441
375403
|
* company's event never marks another's. Each name gets one mark in the company's own partition; a "removed" never replaces a "transferred" (the more exact word stays). When the
|
|
375442
375404
|
* event names the installation's account (`accountLogin`) it must be the binding's, else nothing is written (a body signed for another event, replayed). An unbound installation
|
|
375443
375405
|
* writes nothing. More than REPOSITORY_MOVES_MAX names refuses the whole delivery.
|
|
@@ -375477,7 +375439,7 @@ var GithubInstallationBindings = class _GithubInstallationBindings {
|
|
|
375477
375439
|
return { outcome: "cleared", companyId: owner.companyId, count: fullNames.length };
|
|
375478
375440
|
});
|
|
375479
375441
|
}
|
|
375480
|
-
/** The company a repository event writes for: the installation's binding (its account must match the event's, when the event names one)
|
|
375442
|
+
/** The company a repository event writes for: the installation's binding (its account must match the event's, when the event names one). #1650: unbound writes nothing. */
|
|
375481
375443
|
async repositoryOwner(send3, installationId, deliveryId, accountLogin, names2) {
|
|
375482
375444
|
installationIdSchema.parse(installationId);
|
|
375483
375445
|
if (accountLogin !== void 0)
|
|
@@ -375485,14 +375447,14 @@ var GithubInstallationBindings = class _GithubInstallationBindings {
|
|
|
375485
375447
|
if (!DELIVERY.test(deliveryId) || names2 > REPOSITORY_MOVES_MAX)
|
|
375486
375448
|
throw githubBindingRefusal();
|
|
375487
375449
|
const row2 = await this.binding(send3, installationId);
|
|
375488
|
-
if (row2
|
|
375489
|
-
return
|
|
375490
|
-
return
|
|
375450
|
+
if (row2 === void 0)
|
|
375451
|
+
return "unbound";
|
|
375452
|
+
return accountLogin !== void 0 && accountLogin.toLowerCase() !== row2.accountLogin.toLowerCase() ? "unchanged" : { companyId: row2.companyId };
|
|
375491
375453
|
}
|
|
375492
375454
|
/**
|
|
375493
375455
|
* Guided onboarding PR 3: a company owner unbinds the company's installation (the route checked the role and that no project uses it). One conditional
|
|
375494
|
-
* transaction on exactly the binding that was read: the binding and the company's list row go, an audit row naming the person stays (with the claim audits, history is kept)
|
|
375495
|
-
*
|
|
375456
|
+
* transaction on exactly the binding that was read: the binding and the company's list row go, an audit row naming the person stays (with the claim audits, history is kept).
|
|
375457
|
+
* Another company's, or none: not_found, nothing written.
|
|
375496
375458
|
*/
|
|
375497
375459
|
async disconnect(companyId, installationId, personId) {
|
|
375498
375460
|
return this.run(async (send3) => {
|
|
@@ -375507,7 +375469,6 @@ var GithubInstallationBindings = class _GithubInstallationBindings {
|
|
|
375507
375469
|
const auditKey = { pk: `GITHUB_INSTALLATION#${installationId}`, sk: `AUDIT#DISCONNECT#${at}#${personId}` };
|
|
375508
375470
|
try {
|
|
375509
375471
|
await send3(new import_lib_dynamodb5.TransactWriteCommand({ TransactItems: [
|
|
375510
|
-
{ ConditionCheck: { TableName: this.tableName, Key: backfillKey, ConditionExpression: "attribute_exists(pk)" } },
|
|
375511
375472
|
{ Delete: { TableName: this.tableName, Key: bindingKey(installationId), ...fence } },
|
|
375512
375473
|
{ Delete: { TableName: this.tableName, Key: companyInstallationKey(companyId, installationId) } },
|
|
375513
375474
|
{ Put: { TableName: this.tableName, Item: {
|
|
@@ -375535,18 +375496,8 @@ var GithubInstallationBindings = class _GithubInstallationBindings {
|
|
|
375535
375496
|
return { outcome: "disconnected", accountLogin: row2.accountLogin, ...row2.accountType === void 0 ? {} : { accountType: row2.accountType } };
|
|
375536
375497
|
});
|
|
375537
375498
|
}
|
|
375538
|
-
|
|
375539
|
-
|
|
375540
|
-
OrgIdSchema.parse(companyId);
|
|
375541
|
-
installationSchema.parse({ installationId, accountLogin });
|
|
375542
|
-
bindingText.parse(by);
|
|
375543
|
-
if (!await this.marker(send3) && companyId !== IMPLICIT_COMPANY_ID)
|
|
375544
|
-
throw githubBindingRefusal();
|
|
375545
|
-
await this.put(send3, companyId, installationId, accountLogin, by);
|
|
375546
|
-
});
|
|
375547
|
-
}
|
|
375548
|
-
/** Only the direct operator event calls this; the conditional transaction is the
|
|
375549
|
-
* claim and its durable audit record. Replays, including same-company, refuse. */
|
|
375499
|
+
/** The direct operator event and the install's connections step call this; the conditional transaction is the
|
|
375500
|
+
* claim and its durable audit record. Replays, including same-company, refuse. #1650: a binding to the built-in placeholder is replaced, as no binding. */
|
|
375550
375501
|
async claimOperator(companyId, installation) {
|
|
375551
375502
|
return this.run(async (send3) => {
|
|
375552
375503
|
OrgIdSchema.parse(companyId);
|
|
@@ -375560,7 +375511,7 @@ var GithubInstallationBindings = class _GithubInstallationBindings {
|
|
|
375560
375511
|
companyId,
|
|
375561
375512
|
boundAt: at,
|
|
375562
375513
|
boundBy: "operator-lambda"
|
|
375563
|
-
},
|
|
375514
|
+
}, ...unboundCondition } },
|
|
375564
375515
|
{ Put: { TableName: this.tableName, Item: {
|
|
375565
375516
|
pk: `GITHUB_INSTALLATION#${installation.installationId}`,
|
|
375566
375517
|
sk: "AUDIT#CLAIM",
|
|
@@ -375576,8 +375527,7 @@ var GithubInstallationBindings = class _GithubInstallationBindings {
|
|
|
375576
375527
|
}
|
|
375577
375528
|
/**
|
|
375578
375529
|
* Guided onboarding PR 1: a company owner or admin binds an installation they proved they control (the route checked that against GitHub first).
|
|
375579
|
-
* First binder wins with one conditional transaction: the binding (absent), its audit row naming the person, the company's list row
|
|
375580
|
-
* backfill marker (present: before backfill every unbound installation is the implicit company's, so the person path never binds then).
|
|
375530
|
+
* First binder wins with one conditional transaction: the binding (absent, or #1650 the built-in placeholder's), its audit row naming the person, and the company's list row.
|
|
375581
375531
|
* Already this company's: nothing is overwritten (the company's list row is put back if it is missing, only while that binding still stands). Another company's: "taken", nothing written.
|
|
375582
375532
|
* Guided onboarding PR 3: this company's binding that GitHub said is uninstalled or suspended is reconnected by the claim alone (`reconnected`): its state moves to what the
|
|
375583
375533
|
* person's GitHub check saw (active, or suspended if GitHub still says so), conditionally on what was read, with an audit row naming the person. A webhook never re-activates
|
|
@@ -375637,8 +375587,6 @@ var GithubInstallationBindings = class _GithubInstallationBindings {
|
|
|
375637
375587
|
}
|
|
375638
375588
|
return "reconnected";
|
|
375639
375589
|
}
|
|
375640
|
-
if (!await this.marker(send3))
|
|
375641
|
-
return companyId === IMPLICIT_COMPANY_ID ? "already_bound" : "taken";
|
|
375642
375590
|
return void 0;
|
|
375643
375591
|
};
|
|
375644
375592
|
const before = await decide2();
|
|
@@ -375647,7 +375595,6 @@ var GithubInstallationBindings = class _GithubInstallationBindings {
|
|
|
375647
375595
|
const at = new Date(this.clock()).toISOString();
|
|
375648
375596
|
try {
|
|
375649
375597
|
await send3(new import_lib_dynamodb5.TransactWriteCommand({ TransactItems: [
|
|
375650
|
-
{ ConditionCheck: { TableName: this.tableName, Key: backfillKey, ConditionExpression: "attribute_exists(pk)" } },
|
|
375651
375598
|
{ Put: { TableName: this.tableName, Item: {
|
|
375652
375599
|
...bindingKey(installation.installationId),
|
|
375653
375600
|
...fields,
|
|
@@ -375656,7 +375603,7 @@ var GithubInstallationBindings = class _GithubInstallationBindings {
|
|
|
375656
375603
|
boundAt: at,
|
|
375657
375604
|
boundBy: personId,
|
|
375658
375605
|
...target3 === "active" ? {} : { state: target3, stateAt: at }
|
|
375659
|
-
},
|
|
375606
|
+
}, ...unboundCondition } },
|
|
375660
375607
|
{ Put: { TableName: this.tableName, Item: {
|
|
375661
375608
|
pk: `GITHUB_INSTALLATION#${installation.installationId}`,
|
|
375662
375609
|
sk: `AUDIT#CLAIM#${at}#${personId}`,
|
|
@@ -375715,106 +375662,6 @@ var GithubInstallationBindings = class _GithubInstallationBindings {
|
|
|
375715
375662
|
return listed3;
|
|
375716
375663
|
});
|
|
375717
375664
|
}
|
|
375718
|
-
/** Each operator invocation reads one page and writes at most 25 bindings. The
|
|
375719
|
-
* durable page number prevents a forged/skipped continuation from sealing early. */
|
|
375720
|
-
async backfillPage(list3, page = 1) {
|
|
375721
|
-
const progressKey = { pk: "GITHUB_INSTALLATION_BINDING", sk: "PROGRESS" };
|
|
375722
|
-
const expected = await this.run(async (send3) => {
|
|
375723
|
-
external_exports.number().int().positive().max(1e6).parse(page);
|
|
375724
|
-
if (await this.marker(send3))
|
|
375725
|
-
return void 0;
|
|
375726
|
-
const saved = await send3(new import_lib_dynamodb5.GetCommand({ TableName: this.tableName, Key: progressKey, ConsistentRead: true }));
|
|
375727
|
-
return saved.Item === void 0 ? 1 : external_exports.object({ page: external_exports.number().int().positive().max(1e6) }).parse(saved.Item).page;
|
|
375728
|
-
});
|
|
375729
|
-
if (expected === void 0)
|
|
375730
|
-
return { more: false };
|
|
375731
|
-
if (page !== expected)
|
|
375732
|
-
throw githubBindingRefusal();
|
|
375733
|
-
let input2;
|
|
375734
|
-
try {
|
|
375735
|
-
const value = await list3(page);
|
|
375736
|
-
if (Buffer.byteLength(JSON.stringify(value) ?? "") > 1e6)
|
|
375737
|
-
throw githubBindingRefusal();
|
|
375738
|
-
input2 = external_exports.object({ installations: external_exports.array(installationSchema).max(25), more: external_exports.boolean() }).strict().parse(value);
|
|
375739
|
-
if (new Set(input2.installations.map((row2) => row2.installationId)).size !== input2.installations.length)
|
|
375740
|
-
throw githubBindingRefusal();
|
|
375741
|
-
} catch {
|
|
375742
|
-
throw githubBindingRefusal();
|
|
375743
|
-
}
|
|
375744
|
-
return this.run(async (send3) => {
|
|
375745
|
-
for (const installation of input2.installations) {
|
|
375746
|
-
if (await this.binding(send3, installation.installationId) === void 0) {
|
|
375747
|
-
try {
|
|
375748
|
-
await this.put(send3, IMPLICIT_COMPANY_ID, installation.installationId, installation.accountLogin, "operator-backfill");
|
|
375749
|
-
} catch {
|
|
375750
|
-
if (await this.binding(send3, installation.installationId) === void 0)
|
|
375751
|
-
throw githubBindingRefusal();
|
|
375752
|
-
}
|
|
375753
|
-
}
|
|
375754
|
-
}
|
|
375755
|
-
await send3(new import_lib_dynamodb5.TransactWriteCommand({ TransactItems: [
|
|
375756
|
-
{ Put: {
|
|
375757
|
-
TableName: this.tableName,
|
|
375758
|
-
Item: { ...progressKey, page: page + 1 },
|
|
375759
|
-
ConditionExpression: page === 1 ? "attribute_not_exists(pk)" : "#page = :page",
|
|
375760
|
-
...page === 1 ? {} : { ExpressionAttributeNames: { "#page": "page" }, ExpressionAttributeValues: { ":page": page } }
|
|
375761
|
-
} },
|
|
375762
|
-
...input2.more ? [] : [{ Put: { TableName: this.tableName, Item: backfillKey, ConditionExpression: "attribute_not_exists(pk)" } }]
|
|
375763
|
-
] }));
|
|
375764
|
-
return input2.more ? { more: true, continuation: page + 1 } : { more: false };
|
|
375765
|
-
});
|
|
375766
|
-
}
|
|
375767
|
-
async put(send3, companyId, installationId, accountLogin, by) {
|
|
375768
|
-
const existing = await this.binding(send3, installationId);
|
|
375769
|
-
if (existing !== void 0) {
|
|
375770
|
-
if (existing.companyId !== companyId)
|
|
375771
|
-
throw githubBindingRefusal();
|
|
375772
|
-
return;
|
|
375773
|
-
}
|
|
375774
|
-
try {
|
|
375775
|
-
await send3(new import_lib_dynamodb5.PutCommand({
|
|
375776
|
-
TableName: this.tableName,
|
|
375777
|
-
Item: {
|
|
375778
|
-
...bindingKey(installationId),
|
|
375779
|
-
entityType: "GITHUB_INSTALLATION_BINDING",
|
|
375780
|
-
installationId,
|
|
375781
|
-
companyId,
|
|
375782
|
-
accountLogin,
|
|
375783
|
-
boundAt: new Date(this.clock()).toISOString(),
|
|
375784
|
-
boundBy: by
|
|
375785
|
-
},
|
|
375786
|
-
ConditionExpression: "attribute_not_exists(pk)"
|
|
375787
|
-
}));
|
|
375788
|
-
} catch (error64) {
|
|
375789
|
-
if (!isConditional(error64) || (await this.binding(send3, installationId))?.companyId !== companyId)
|
|
375790
|
-
throw githubBindingRefusal();
|
|
375791
|
-
}
|
|
375792
|
-
}
|
|
375793
|
-
async backfill(listInstallations) {
|
|
375794
|
-
return this.run(async (send3, check4) => {
|
|
375795
|
-
if (await this.marker(send3))
|
|
375796
|
-
return { more: false };
|
|
375797
|
-
const input2 = await listInstallations();
|
|
375798
|
-
check4();
|
|
375799
|
-
if (!Array.isArray(input2))
|
|
375800
|
-
throw githubBindingRefusal();
|
|
375801
|
-
if (input2.length > 100)
|
|
375802
|
-
return { more: true };
|
|
375803
|
-
const installations2 = external_exports.array(installationSchema).max(100).parse(input2);
|
|
375804
|
-
if (new Set(installations2.map((row2) => row2.installationId)).size !== installations2.length)
|
|
375805
|
-
throw githubBindingRefusal();
|
|
375806
|
-
for (const installation of installations2)
|
|
375807
|
-
await this.put(send3, IMPLICIT_COMPANY_ID, installation.installationId, installation.accountLogin, "operator-backfill");
|
|
375808
|
-
check4();
|
|
375809
|
-
try {
|
|
375810
|
-
await send3(new import_lib_dynamodb5.PutCommand({ TableName: this.tableName, Item: backfillKey, ConditionExpression: "attribute_not_exists(pk)" }));
|
|
375811
|
-
} catch (error64) {
|
|
375812
|
-
if (!isConditional(error64) || !await this.marker(send3))
|
|
375813
|
-
throw githubBindingRefusal();
|
|
375814
|
-
}
|
|
375815
|
-
return { more: false };
|
|
375816
|
-
});
|
|
375817
|
-
}
|
|
375818
375665
|
};
|
|
375819
375666
|
var listedInstallationsSchema = external_exports.array(installationSchema.extend({
|
|
375820
375667
|
accountType: external_exports.enum(["User", "Organization"]),
|
|
@@ -375996,12 +375843,13 @@ async function linkInstallConnections(deps, input2) {
|
|
|
375996
375843
|
}
|
|
375997
375844
|
async function claimInstallation(deps, companyId, installation, apply, into) {
|
|
375998
375845
|
into.found++;
|
|
375999
|
-
const
|
|
375846
|
+
const stored = await get2(deps, { pk: `GITHUB_INSTALLATION#${installation.installationId}`, sk: "BINDING" });
|
|
375847
|
+
const binding = stored?.["companyId"] === IMPLICIT_COMPANY_ID ? void 0 : stored;
|
|
376000
375848
|
if (binding !== void 0) {
|
|
376001
375849
|
into[binding["companyId"] === companyId ? "existing" : "conflicts"]++;
|
|
376002
375850
|
return;
|
|
376003
375851
|
}
|
|
376004
|
-
if (await get2(deps, { pk: `GITHUB_INSTALLATION#${installation.installationId}`, sk: "AUDIT#CLAIM" }) !== void 0) {
|
|
375852
|
+
if (stored === void 0 && await get2(deps, { pk: `GITHUB_INSTALLATION#${installation.installationId}`, sk: "AUDIT#CLAIM" }) !== void 0) {
|
|
376005
375853
|
into.conflicts++;
|
|
376006
375854
|
return;
|
|
376007
375855
|
}
|
|
@@ -376424,7 +376272,7 @@ function vendorApi(fetchImplementation) {
|
|
|
376424
376272
|
|
|
376425
376273
|
// packages/cli/src/setup/project-files.ts
|
|
376426
376274
|
init_dist2();
|
|
376427
|
-
import { createHash as
|
|
376275
|
+
import { createHash as createHash29 } from "node:crypto";
|
|
376428
376276
|
var API2 = "https://api.github.com";
|
|
376429
376277
|
var SETUP_TIMEOUT = 900;
|
|
376430
376278
|
var TEST_TIMEOUT = 1800;
|
|
@@ -376539,11 +376387,11 @@ function githubRepositoryApi(fetchImplementation) {
|
|
|
376539
376387
|
if (normalizedBase64.length > encodedLimit || !/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(normalizedBase64)) throw agentXError("RUNTIME_UNAVAILABLE", `GitHub returned incomplete or mismatched immutable source bytes for ${path6}`);
|
|
376540
376388
|
const bytes5 = Buffer.from(normalizedBase64, "base64");
|
|
376541
376389
|
if (bytes5.byteLength !== entry.size) throw agentXError("RUNTIME_UNAVAILABLE", `GitHub source byte count did not match the immutable tree for ${path6}`);
|
|
376542
|
-
const gitObjectSha =
|
|
376390
|
+
const gitObjectSha = createHash29("sha1").update(Buffer.from(`blob ${bytes5.byteLength}\0`)).update(bytes5).digest("hex");
|
|
376543
376391
|
if (gitObjectSha !== entry.sha) throw agentXError("RUNTIME_UNAVAILABLE", `GitHub source bytes did not match the immutable Git blob identity for ${path6}`);
|
|
376544
376392
|
totalBytes += bytes5.byteLength;
|
|
376545
376393
|
if (totalBytes > MAX_SNAPSHOT_TOTAL_BYTES) throw agentXError("RUNTIME_UNAVAILABLE", "requested source snapshot exceeds the total byte limit");
|
|
376546
|
-
sources.push({ path: path6, sha256:
|
|
376394
|
+
sources.push({ path: path6, sha256: createHash29("sha256").update(bytes5).digest("hex"), bytes: bytes5, kind: "blob" });
|
|
376547
376395
|
}
|
|
376548
376396
|
const candidate = createCandidateManifest([{ repositoryId: fullName, commitSha, treeSha }]);
|
|
376549
376397
|
return { candidate, commitSha, treeSha, treeComplete: true, treePaths: [...treePaths], sources };
|
|
@@ -377136,7 +376984,7 @@ import { isDeepStrictEqual as isDeepStrictEqual3 } from "node:util";
|
|
|
377136
376984
|
|
|
377137
376985
|
// packages/cli/src/loop/enrollment-cli.ts
|
|
377138
376986
|
init_dist2();
|
|
377139
|
-
import { createHash as
|
|
376987
|
+
import { createHash as createHash31 } from "node:crypto";
|
|
377140
376988
|
import { realpath as realpath5 } from "node:fs/promises";
|
|
377141
376989
|
import { arch, hostname as hostname3 } from "node:os";
|
|
377142
376990
|
import { isDeepStrictEqual as isDeepStrictEqual2 } from "node:util";
|
|
@@ -377390,7 +377238,7 @@ ${body}` }) });
|
|
|
377390
377238
|
init_zod();
|
|
377391
377239
|
init_dist2();
|
|
377392
377240
|
import { randomUUID as randomUUID12 } from "node:crypto";
|
|
377393
|
-
import { createHash as
|
|
377241
|
+
import { createHash as createHash30 } from "node:crypto";
|
|
377394
377242
|
var ShaSchema = external_exports.string().regex(/^[a-f0-9]{40}$/u);
|
|
377395
377243
|
var DigestSchema5 = external_exports.string().regex(/^[a-f0-9]{64}$/u);
|
|
377396
377244
|
var RepoSlugSchema = external_exports.string().regex(/^[A-Za-z0-9_.-]{1,100}\/[A-Za-z0-9_.-]{1,100}$/u, "owner/name");
|
|
@@ -377453,7 +377301,7 @@ var NativeTaskEvidenceReceiptSchema = external_exports.object({
|
|
|
377453
377301
|
const proofDigest = receipt4.proofDigest;
|
|
377454
377302
|
delete semantic.importedAt;
|
|
377455
377303
|
delete semantic.proofDigest;
|
|
377456
|
-
const expected =
|
|
377304
|
+
const expected = createHash30("sha256").update(canonicalJson(semantic)).digest("hex");
|
|
377457
377305
|
if (expected !== proofDigest) context.addIssue({ code: "custom", path: ["proofDigest"], message: "native evidence receipt digest does not match its bound fields" });
|
|
377458
377306
|
});
|
|
377459
377307
|
var RegisteredPendingSourceSchema = external_exports.object({
|
|
@@ -377634,7 +377482,7 @@ function importNativeTaskEvidence(input2) {
|
|
|
377634
377482
|
const progress = workflow.e2e;
|
|
377635
377483
|
const qualified = progress?.qualifiedRound;
|
|
377636
377484
|
if (progress?.required !== true || qualified === void 0 || workflow.verification?.candidateDigest !== manifest.digest || workflow.e2e?.currentRoundId !== qualified.roundId || workflow.e2e.currentGroupRunIds.length !== qualified.groupRunIds.length || workflow.e2e.currentGroupRunIds.some((id12, index) => id12 !== qualified.groupRunIds[index]) || qualified.candidateDigest !== input2.join.candidateDigest || progress.contractDigest !== input2.join.contractDigest || progress.policyDigest !== input2.join.policyDigest || progress.executionPlanDigest !== input2.join.planDigest || qualified.contractDigest !== input2.join.contractDigest || qualified.policyDigest !== input2.join.policyDigest || qualified.executionPlanDigest !== input2.join.planDigest || qualified.roundId !== input2.join.roundId) return hold("e2e_round_binding_mismatch");
|
|
377637
|
-
const expectedEvidenceSetDigest =
|
|
377485
|
+
const expectedEvidenceSetDigest = createHash30("sha256").update(canonicalJson({
|
|
377638
377486
|
domain: "agentx-e2e-publication-context/v1",
|
|
377639
377487
|
taskId: task.taskId,
|
|
377640
377488
|
candidateDigest: input2.join.candidateDigest,
|
|
@@ -377673,7 +377521,7 @@ function importNativeTaskEvidence(input2) {
|
|
|
377673
377521
|
return hold("approved_graph_missing_or_changed");
|
|
377674
377522
|
}
|
|
377675
377523
|
if (graph !== void 0 && (graph.artifactDigest !== plan.sha256 || graph.workflowRevision !== approval.workflowRevision || graph.actorId !== approval.actorId || graph.graphDigest !== approval.workBreakdownDigest)) return hold("approved_graph_mismatch");
|
|
377676
|
-
const approvalDigest =
|
|
377524
|
+
const approvalDigest = createHash30("sha256").update(canonicalJson({
|
|
377677
377525
|
artifactDigest: plan.sha256,
|
|
377678
377526
|
workflowRevision: approval.workflowRevision,
|
|
377679
377527
|
actorId: approval.actorId,
|
|
@@ -377712,7 +377560,7 @@ function importNativeTaskEvidence(input2) {
|
|
|
377712
377560
|
approvalDigest,
|
|
377713
377561
|
...graph === void 0 ? {} : { graphDigest: graph.graphDigest }
|
|
377714
377562
|
};
|
|
377715
|
-
const proofDigest =
|
|
377563
|
+
const proofDigest = createHash30("sha256").update(canonicalJson(semantic)).digest("hex");
|
|
377716
377564
|
return NativeTaskEvidenceReceiptSchema.parse({ ...semantic, importedAt: input2.now.toISOString(), proofDigest });
|
|
377717
377565
|
}
|
|
377718
377566
|
function sameNativeTaskEvidenceReceipt(left, right) {
|
|
@@ -378355,7 +378203,7 @@ async function recordRegisteredLoopEnrollment(input2) {
|
|
|
378355
378203
|
return { recorded: false, reasonCode: "source_identity_unavailable" };
|
|
378356
378204
|
}
|
|
378357
378205
|
const checkoutPath = cwd;
|
|
378358
|
-
const sourceBindingRef = `cli-source:v1:${
|
|
378206
|
+
const sourceBindingRef = `cli-source:v1:${createHash31("sha256").update(JSON.stringify([
|
|
378359
378207
|
parsed.registeredBy,
|
|
378360
378208
|
namespace,
|
|
378361
378209
|
projectDefinition.name,
|
|
@@ -388764,7 +388612,7 @@ function parseComment(body) {
|
|
|
388764
388612
|
}
|
|
388765
388613
|
|
|
388766
388614
|
// packages/cli/src/loop/exit-checks.ts
|
|
388767
|
-
import { createHash as
|
|
388615
|
+
import { createHash as createHash36 } from "node:crypto";
|
|
388768
388616
|
import { readFile as readFile25 } from "node:fs/promises";
|
|
388769
388617
|
import { join as join27 } from "node:path";
|
|
388770
388618
|
|
|
@@ -389258,7 +389106,7 @@ async function readArtifact(worktree, issue2, artifact2) {
|
|
|
389258
389106
|
return readFile25(join27(worktree, artifactPath(issue2, artifact2)), "utf8").catch(() => void 0);
|
|
389259
389107
|
}
|
|
389260
389108
|
function artifactDigest(text11) {
|
|
389261
|
-
return
|
|
389109
|
+
return createHash36("sha256").update(text11).digest("hex");
|
|
389262
389110
|
}
|
|
389263
389111
|
function missingSections(text11, required4) {
|
|
389264
389112
|
const sections2 = /* @__PURE__ */ new Map();
|
|
@@ -391801,9 +391649,8 @@ ${url2}
|
|
|
391801
391649
|
throw agentXError("CONFIG_INVALID", "--task must be a task ID, such as 44444444-4444-4444-8444-444444444444; agentx admin turns export shows task IDs");
|
|
391802
391650
|
}
|
|
391803
391651
|
const globals = globalOptions2(command5);
|
|
391804
|
-
const
|
|
391805
|
-
|
|
391806
|
-
services.stdout.write(formatSuccess(result4, globals.json));
|
|
391652
|
+
const answer2 = await setTaskShareMode(developerSession(), developerEnv(command5), { taskId: options.task, mode: options.mode });
|
|
391653
|
+
services.stdout.write(globals.json ? formatSuccess({ env: answer2.env, url: answer2.url, ...answer2.data }, true) : answer2.text);
|
|
391807
391654
|
});
|
|
391808
391655
|
admin.command("changes").description("list admin change records (kept 30 days): who asked, the change, how it was confirmed and how it ended; --json writes JSON Lines").requiredOption("--since <duration>", "how far back, such as 30m, 12h or 7d (at most 30d)").action(async (options, command5) => {
|
|
391809
391656
|
const globals = globalOptions2(command5);
|