@akasecurity/cli 0.9.9 → 0.9.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -12
- package/dist/cli.js +3959 -1818
- package/extension/manifest.json +1 -1
- package/native-host/host.js +2495 -1461
- package/native-host/scan-worker.js +425 -228
- package/native-host/sync.js +1195 -750
- package/package.json +3 -3
- package/web-ui/package.json +2 -2
- package/web-ui/packages/dashboard-ui/package.json +1 -0
- package/web-ui/web-ui/.next/BUILD_ID +1 -1
- package/web-ui/web-ui/.next/app-build-manifest.json +65 -65
- package/web-ui/web-ui/.next/app-path-routes-manifest.json +6 -6
- package/web-ui/web-ui/.next/build-manifest.json +2 -2
- package/web-ui/web-ui/.next/prerender-manifest.json +18 -18
- package/web-ui/web-ui/.next/server/app/(app)/activity/page.js +2 -2
- package/web-ui/web-ui/.next/server/app/(app)/activity/page.js.nft.json +1 -1
- package/web-ui/web-ui/.next/server/app/(app)/activity/page_client-reference-manifest.js +1 -1
- package/web-ui/web-ui/.next/server/app/(app)/data-shares/page.js +2 -2
- package/web-ui/web-ui/.next/server/app/(app)/data-shares/page.js.nft.json +1 -1
- package/web-ui/web-ui/.next/server/app/(app)/data-shares/page_client-reference-manifest.js +1 -1
- package/web-ui/web-ui/.next/server/app/(app)/detections/page.js +2 -2
- package/web-ui/web-ui/.next/server/app/(app)/detections/page.js.nft.json +1 -1
- package/web-ui/web-ui/.next/server/app/(app)/detections/page_client-reference-manifest.js +1 -1
- package/web-ui/web-ui/.next/server/app/(app)/exceptions/[id]/page.js +2 -2
- package/web-ui/web-ui/.next/server/app/(app)/exceptions/[id]/page.js.nft.json +1 -1
- package/web-ui/web-ui/.next/server/app/(app)/exceptions/[id]/page_client-reference-manifest.js +1 -1
- package/web-ui/web-ui/.next/server/app/(app)/exceptions/new/page.js +1 -1
- package/web-ui/web-ui/.next/server/app/(app)/exceptions/new/page.js.nft.json +1 -1
- package/web-ui/web-ui/.next/server/app/(app)/exceptions/new/page_client-reference-manifest.js +1 -1
- package/web-ui/web-ui/.next/server/app/(app)/exceptions/page.js +1 -1
- package/web-ui/web-ui/.next/server/app/(app)/exceptions/page.js.nft.json +1 -1
- package/web-ui/web-ui/.next/server/app/(app)/exceptions/page_client-reference-manifest.js +1 -1
- package/web-ui/web-ui/.next/server/app/(app)/findings/page.js +2 -2
- package/web-ui/web-ui/.next/server/app/(app)/findings/page.js.nft.json +1 -1
- package/web-ui/web-ui/.next/server/app/(app)/findings/page_client-reference-manifest.js +1 -1
- package/web-ui/web-ui/.next/server/app/(app)/inventory/page.js +2 -2
- package/web-ui/web-ui/.next/server/app/(app)/inventory/page.js.nft.json +1 -1
- package/web-ui/web-ui/.next/server/app/(app)/inventory/page_client-reference-manifest.js +1 -1
- package/web-ui/web-ui/.next/server/app/(app)/policies/page.js +2 -2
- package/web-ui/web-ui/.next/server/app/(app)/policies/page.js.nft.json +1 -1
- package/web-ui/web-ui/.next/server/app/(app)/policies/page_client-reference-manifest.js +1 -1
- package/web-ui/web-ui/.next/server/app/(app)/scan/page.js +3 -3
- package/web-ui/web-ui/.next/server/app/(app)/scan/page.js.nft.json +1 -1
- package/web-ui/web-ui/.next/server/app/(app)/scan/page_client-reference-manifest.js +1 -1
- package/web-ui/web-ui/.next/server/app/(app)/security/page.js +2 -2
- package/web-ui/web-ui/.next/server/app/(app)/security/page.js.nft.json +1 -1
- package/web-ui/web-ui/.next/server/app/(app)/security/page_client-reference-manifest.js +1 -1
- package/web-ui/web-ui/.next/server/app/(app)/settings/page.js +2 -2
- package/web-ui/web-ui/.next/server/app/(app)/settings/page.js.nft.json +1 -1
- package/web-ui/web-ui/.next/server/app/(app)/settings/page_client-reference-manifest.js +1 -1
- package/web-ui/web-ui/.next/server/app/(app)/updates/page.js +2 -2
- package/web-ui/web-ui/.next/server/app/(app)/updates/page.js.nft.json +1 -1
- package/web-ui/web-ui/.next/server/app/(app)/updates/page_client-reference-manifest.js +1 -1
- package/web-ui/web-ui/.next/server/app/(app)/vault/page.js +2 -2
- package/web-ui/web-ui/.next/server/app/(app)/vault/page.js.nft.json +1 -1
- package/web-ui/web-ui/.next/server/app/(app)/vault/page_client-reference-manifest.js +1 -1
- package/web-ui/web-ui/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/web-ui/web-ui/.next/server/app/_not-found.html +1 -1
- package/web-ui/web-ui/.next/server/app/_not-found.rsc +2 -2
- package/web-ui/web-ui/.next/server/app/index.html +1 -1
- package/web-ui/web-ui/.next/server/app/index.rsc +2 -2
- package/web-ui/web-ui/.next/server/app/page_client-reference-manifest.js +1 -1
- package/web-ui/web-ui/.next/server/app-paths-manifest.json +6 -6
- package/web-ui/web-ui/.next/server/chunks/471.js +950 -0
- package/web-ui/web-ui/.next/server/chunks/475.js +1 -1
- package/web-ui/web-ui/.next/server/chunks/7.js +1 -1
- package/web-ui/web-ui/.next/server/chunks/739.js +1 -0
- package/web-ui/web-ui/.next/server/chunks/766.js +6 -0
- package/web-ui/web-ui/.next/server/chunks/851.js +1 -0
- package/web-ui/web-ui/.next/server/chunks/905.js +959 -0
- package/web-ui/web-ui/.next/server/functions-config-manifest.json +6 -6
- package/web-ui/web-ui/.next/server/middleware-manifest.json +5 -5
- package/web-ui/web-ui/.next/server/pages/404.html +1 -1
- package/web-ui/web-ui/.next/server/pages/500.html +1 -1
- package/web-ui/web-ui/.next/server/server-reference-manifest.js +1 -1
- package/web-ui/web-ui/.next/server/server-reference-manifest.json +1 -1
- package/web-ui/web-ui/.next/static/chunks/907-2ba9428e7818b656.js +1 -0
- package/web-ui/web-ui/.next/static/chunks/app/(app)/activity/page-c5a55618d187c906.js +1 -0
- package/web-ui/web-ui/.next/static/chunks/app/(app)/data-shares/page-b1c76b8c00e1ae2a.js +1 -0
- package/web-ui/web-ui/.next/static/chunks/app/(app)/detections/page-159167b47a005b33.js +1 -0
- package/web-ui/web-ui/.next/static/chunks/app/(app)/error-dead9507fc349f26.js +1 -0
- package/web-ui/web-ui/.next/static/chunks/app/(app)/exceptions/[id]/page-5e872a82af85ef64.js +1 -0
- package/web-ui/web-ui/.next/static/chunks/app/(app)/exceptions/new/{page-9792760d5acc2de1.js → page-0695d0006518b2cb.js} +1 -1
- package/web-ui/web-ui/.next/static/chunks/app/(app)/exceptions/page-adec99f2f4bbc180.js +1 -0
- package/web-ui/web-ui/.next/static/chunks/app/(app)/findings/page-d013384d2ddb3036.js +1 -0
- package/web-ui/web-ui/.next/static/chunks/app/(app)/inventory/page-42c1b48a01fdecb0.js +1 -0
- package/web-ui/web-ui/.next/static/chunks/app/(app)/layout-dc7ae7664dcdc3c5.js +1 -0
- package/web-ui/web-ui/.next/static/chunks/app/(app)/policies/page-9b6d7cc4ce9fb33e.js +1 -0
- package/web-ui/web-ui/.next/static/chunks/app/(app)/scan/page-f3ee9ecde06df153.js +1 -0
- package/web-ui/web-ui/.next/static/chunks/app/(app)/security/page-24a003c709776317.js +1 -0
- package/web-ui/web-ui/.next/static/chunks/app/(app)/settings/page-4ea49ce2e765fffb.js +1 -0
- package/web-ui/web-ui/.next/static/chunks/app/(app)/updates/page-6c7b94b070de8986.js +1 -0
- package/web-ui/web-ui/.next/static/chunks/app/(app)/vault/page-f37ab8e1edc67663.js +1 -0
- package/web-ui/web-ui/.next/static/css/c6954dd65f2115e6.css +2 -0
- package/web-ui/web-ui/dist/scan-worker.js +425 -228
- package/web-ui/web-ui/package.json +1 -0
- package/web-ui/web-ui/.next/server/chunks/237.js +0 -884
- package/web-ui/web-ui/.next/server/chunks/318.js +0 -6
- package/web-ui/web-ui/.next/server/chunks/793.js +0 -893
- package/web-ui/web-ui/.next/server/chunks/83.js +0 -1
- package/web-ui/web-ui/.next/static/chunks/907-b6ee7720ac5bf516.js +0 -1
- package/web-ui/web-ui/.next/static/chunks/app/(app)/activity/page-0f1263f7b62606c9.js +0 -1
- package/web-ui/web-ui/.next/static/chunks/app/(app)/data-shares/page-39fd8cad4b6b709f.js +0 -1
- package/web-ui/web-ui/.next/static/chunks/app/(app)/detections/page-b8386e543b783552.js +0 -1
- package/web-ui/web-ui/.next/static/chunks/app/(app)/error-14165283b00c8626.js +0 -1
- package/web-ui/web-ui/.next/static/chunks/app/(app)/exceptions/[id]/page-62c9e95207311f3d.js +0 -1
- package/web-ui/web-ui/.next/static/chunks/app/(app)/exceptions/page-807c39bb900256bd.js +0 -1
- package/web-ui/web-ui/.next/static/chunks/app/(app)/findings/page-e3a531d9590a623b.js +0 -1
- package/web-ui/web-ui/.next/static/chunks/app/(app)/inventory/page-11d47cdf3619126f.js +0 -1
- package/web-ui/web-ui/.next/static/chunks/app/(app)/layout-83072d434c6b6b0e.js +0 -1
- package/web-ui/web-ui/.next/static/chunks/app/(app)/policies/page-15e6d747c4e794c7.js +0 -1
- package/web-ui/web-ui/.next/static/chunks/app/(app)/scan/page-b390a81c67dd6d32.js +0 -1
- package/web-ui/web-ui/.next/static/chunks/app/(app)/security/page-07913f82a7e29f67.js +0 -1
- package/web-ui/web-ui/.next/static/chunks/app/(app)/settings/page-0898d0d22c14bb45.js +0 -1
- package/web-ui/web-ui/.next/static/chunks/app/(app)/updates/page-ad9483e25680d8b4.js +0 -1
- package/web-ui/web-ui/.next/static/chunks/app/(app)/vault/page-04450aa587f0d5ef.js +0 -1
- package/web-ui/web-ui/.next/static/css/81a7ed955b02c959.css +0 -2
- /package/web-ui/web-ui/.next/static/{MbmJUh_qusg2UF-ZJLjuR → osEmGZG6yEV-XkQlklt-B}/_buildManifest.js +0 -0
- /package/web-ui/web-ui/.next/static/{MbmJUh_qusg2UF-ZJLjuR → osEmGZG6yEV-XkQlklt-B}/_ssgManifest.js +0 -0
package/native-host/sync.js
CHANGED
|
@@ -491,9 +491,6 @@ var require_ignore = __commonJS({
|
|
|
491
491
|
}
|
|
492
492
|
});
|
|
493
493
|
|
|
494
|
-
// ../../packages/plugin-runtime/src/attached/egress-wire.ts
|
|
495
|
-
import { createHash as createHash4 } from "crypto";
|
|
496
|
-
|
|
497
494
|
// ../../packages/persistence/src/attached-derived.ts
|
|
498
495
|
import { rmSync } from "fs";
|
|
499
496
|
import { join } from "path";
|
|
@@ -20385,13 +20382,11 @@ var FindingGroup = external_exports.object({
|
|
|
20385
20382
|
latestDetectedAt: external_exports.iso.datetime(),
|
|
20386
20383
|
instances: external_exports.array(FindingInstance),
|
|
20387
20384
|
// Derived from instances' statuses with open-dominates precedence (see
|
|
20388
|
-
//
|
|
20385
|
+
// foldGroupStatus). Undefined only when no instance carries a status.
|
|
20389
20386
|
status: FindingStatus.optional(),
|
|
20390
|
-
// The distinct people across the WHOLE group, not just the
|
|
20391
|
-
//
|
|
20392
|
-
//
|
|
20393
|
-
// instance carries a user, or when the store supplied whole-group folds
|
|
20394
|
-
// without one.
|
|
20387
|
+
// The distinct people across the WHOLE group, not just the instances
|
|
20388
|
+
// carried here. Undefined when no instance carries a user, or when the
|
|
20389
|
+
// store supplied whole-group folds without one.
|
|
20395
20390
|
users: external_exports.array(FindingUser).optional()
|
|
20396
20391
|
}).meta({ id: "FindingGroup" });
|
|
20397
20392
|
var FindingStats = external_exports.object({
|
|
@@ -20420,20 +20415,30 @@ var FindingFacets = external_exports.object({
|
|
|
20420
20415
|
// counted under no value.
|
|
20421
20416
|
status: external_exports.array(FindingFacetItem),
|
|
20422
20417
|
// Host tool (attributes.tool_name). Present only on the instance-level
|
|
20423
|
-
// reads, which can filter by it; the
|
|
20418
|
+
// reads, which can filter by it; the type-level read omits the dimension
|
|
20424
20419
|
// because a group spans tools.
|
|
20425
20420
|
tool: external_exports.array(FindingFacetItem).optional()
|
|
20426
20421
|
}).meta({ id: "FindingFacets" });
|
|
20427
|
-
var
|
|
20422
|
+
var FindingTypeSummary = FindingGroup.omit({ instances: true, match: true }).meta({
|
|
20423
|
+
id: "FindingTypeSummary"
|
|
20424
|
+
});
|
|
20425
|
+
var MAX_FINDING_TYPES_LIMIT = 100;
|
|
20426
|
+
var ListFindingTypesQuery = external_exports.object({
|
|
20428
20427
|
// NOTE: severity filters by Severity (critical/high/medium/low), not by
|
|
20429
|
-
// FindingAction.
|
|
20428
|
+
// FindingAction. It narrows TYPES: a type's severity is the one its newest
|
|
20429
|
+
// firing version carries, and this list pages types.
|
|
20430
|
+
//
|
|
20431
|
+
// That is NOT a claim the findings of a type share it. A rule can hold several
|
|
20432
|
+
// definition versions at different severities, so a type kept by this filter
|
|
20433
|
+
// can hold findings that individually do not match — see totals.findings on
|
|
20434
|
+
// ListFindingTypesResponse, which counts them all.
|
|
20430
20435
|
severity: external_exports.array(Severity).optional(),
|
|
20431
20436
|
subtype: external_exports.array(external_exports.string()).optional(),
|
|
20432
20437
|
provider: external_exports.array(FindingProvider).optional(),
|
|
20433
20438
|
action: external_exports.array(FindingAction).optional(),
|
|
20434
|
-
// Matches a
|
|
20435
|
-
// individual
|
|
20436
|
-
//
|
|
20439
|
+
// Matches a type's DERIVED status (see FindingGroup.status), not its
|
|
20440
|
+
// individual findings' — so a filtered row's status always reads one of the
|
|
20441
|
+
// requested values.
|
|
20437
20442
|
status: external_exports.array(FindingStatus).optional(),
|
|
20438
20443
|
q: external_exports.string().optional(),
|
|
20439
20444
|
// Scope to findings whose event carries this session id (the Activity page's
|
|
@@ -20443,23 +20448,37 @@ var ListGroupedFindingsQuery = external_exports.object({
|
|
|
20443
20448
|
// from a time-scoped page (Activity's range) can carry that scope. Absent
|
|
20444
20449
|
// means all time — this list has no default window.
|
|
20445
20450
|
from: external_exports.iso.datetime().optional(),
|
|
20446
|
-
// A
|
|
20447
|
-
//
|
|
20448
|
-
//
|
|
20449
|
-
//
|
|
20450
|
-
//
|
|
20451
|
+
// A RULE id that must appear in the page even when the cursor has already
|
|
20452
|
+
// advanced past its sort position. This is what keeps the selected type
|
|
20453
|
+
// visible in the list once it paginates: the target is appended out of sort
|
|
20454
|
+
// order rather than scanned forward for. Never affects totals, facets or the
|
|
20455
|
+
// cursor. Unlike the grouped read this replaces, it names a rule only — an
|
|
20456
|
+
// instance id is resolved by `findingInstance`, which is a primary-key seek
|
|
20457
|
+
// and so is not bounded by what any page happens to hold.
|
|
20451
20458
|
includeId: external_exports.string().optional(),
|
|
20452
|
-
|
|
20453
|
-
limit: external_exports.coerce.number().int().min(1).max(100).optional(),
|
|
20459
|
+
limit: external_exports.coerce.number().int().min(1).max(MAX_FINDING_TYPES_LIMIT).optional(),
|
|
20454
20460
|
cursor: external_exports.string().optional()
|
|
20455
20461
|
});
|
|
20456
|
-
var
|
|
20462
|
+
var ListFindingTypesResponse = external_exports.object({
|
|
20457
20463
|
totals: external_exports.object({
|
|
20464
|
+
// Findings belonging to the matching TYPES — not findings that each match
|
|
20465
|
+
// the filters. The filters here select types, so a type that survives
|
|
20466
|
+
// contributes its whole instanceCount.
|
|
20467
|
+
//
|
|
20468
|
+
// `status` is the one exception, narrowed per finding via
|
|
20469
|
+
// countInstancesByStatus. `severity`, `provider` and `action` are not, so
|
|
20470
|
+
// this can exceed what the instance read reports for the same filters: a
|
|
20471
|
+
// rule whose severity moved between versions is kept on its newest and
|
|
20472
|
+
// still counts its older findings. Narrowing the other three needs
|
|
20473
|
+
// per-dimension counts the aggregate does not carry today.
|
|
20458
20474
|
findings: external_exports.number().int().nonnegative(),
|
|
20459
|
-
|
|
20475
|
+
// Counts TYPES, which is the unit this read pages. The instance read's
|
|
20476
|
+
// own totals count findings; the two deliberately answer different
|
|
20477
|
+
// questions and are never summed.
|
|
20478
|
+
types: external_exports.number().int().nonnegative()
|
|
20460
20479
|
}),
|
|
20461
20480
|
facets: FindingFacets,
|
|
20462
|
-
items: external_exports.array(
|
|
20481
|
+
items: external_exports.array(FindingTypeSummary),
|
|
20463
20482
|
nextCursor: external_exports.string().nullable(),
|
|
20464
20483
|
// Present only on session-scoped queries (`sessionId` set): per ruleId, how
|
|
20465
20484
|
// many times that rule fired in the session's persisted transcript. Findings
|
|
@@ -20467,7 +20486,7 @@ var ListGroupedFindingsResponse = external_exports.object({
|
|
|
20467
20486
|
// every firing, so the two numbers legitimately differ — this map lets a
|
|
20468
20487
|
// session-scoped view show both.
|
|
20469
20488
|
sessionFirings: external_exports.record(external_exports.string(), external_exports.number().int().nonnegative()).optional()
|
|
20470
|
-
}).meta({ id: "
|
|
20489
|
+
}).meta({ id: "ListFindingTypesResponse" });
|
|
20471
20490
|
var ApplyFindingActionRequest = external_exports.object({
|
|
20472
20491
|
// 'quarantined' is system-assigned (see FindingAction) — clients may not set
|
|
20473
20492
|
// it, so it is excluded from the request contract. The mapping helper
|
|
@@ -20496,12 +20515,13 @@ var FindingInstanceDetail = FindingInstance.extend({
|
|
|
20496
20515
|
var MAX_FLAT_FINDINGS_LIMIT = 200;
|
|
20497
20516
|
var ListFindingInstancesQuery = external_exports.object({
|
|
20498
20517
|
severity: external_exports.array(Severity).optional(),
|
|
20499
|
-
// Rule ids, the same vocabulary the
|
|
20518
|
+
// Rule ids, the same vocabulary the types list's `subtype` carries. Pinning
|
|
20519
|
+
// ONE of them is how the master/detail view scopes its right-hand panel.
|
|
20500
20520
|
subtype: external_exports.array(external_exports.string()).optional(),
|
|
20501
20521
|
provider: external_exports.array(FindingProvider).optional(),
|
|
20502
20522
|
action: external_exports.array(FindingAction).optional(),
|
|
20503
20523
|
// Matches each instance's OWN derived status (deriveFindingStatus), unlike
|
|
20504
|
-
// the
|
|
20524
|
+
// the types query's type-level fold.
|
|
20505
20525
|
status: external_exports.array(FindingStatus).optional(),
|
|
20506
20526
|
// Exact host-tool names (attributes.tool_name, e.g. 'Bash'). A real filter,
|
|
20507
20527
|
// where the free-text `q` can only match the rendered "via Bash" label.
|
|
@@ -20518,37 +20538,46 @@ var ListFindingInstancesQuery = external_exports.object({
|
|
|
20518
20538
|
});
|
|
20519
20539
|
var ListFindingInstancesResponse = external_exports.object({
|
|
20520
20540
|
// Instances matching the filters across the whole scope, not just this
|
|
20521
|
-
// page — cursor-independent, like the
|
|
20541
|
+
// page — cursor-independent, like the types list's totals.
|
|
20522
20542
|
totals: external_exports.object({ findings: external_exports.number().int().nonnegative() }),
|
|
20523
|
-
// Counts in INSTANCES here, where the
|
|
20543
|
+
// Counts in INSTANCES here, where the types response counts types. Each
|
|
20524
20544
|
// dimension still excludes its own filter.
|
|
20525
20545
|
facets: FindingFacets,
|
|
20526
20546
|
items: external_exports.array(FindingInstanceDetail),
|
|
20527
20547
|
nextCursor: external_exports.string().nullable()
|
|
20528
20548
|
}).meta({ id: "ListFindingInstancesResponse" });
|
|
20529
|
-
var
|
|
20530
|
-
//
|
|
20531
|
-
//
|
|
20532
|
-
|
|
20533
|
-
|
|
20534
|
-
|
|
20535
|
-
|
|
20536
|
-
// Folded from the instances' derived statuses with the same
|
|
20537
|
-
// open-dominates precedence a group uses.
|
|
20538
|
-
status: FindingStatus.optional(),
|
|
20539
|
-
// Distinct rules seen at this location, capped — the row shows them as
|
|
20540
|
-
// chips, and the count is what conveys scale.
|
|
20541
|
-
ruleIds: external_exports.array(external_exports.string())
|
|
20542
|
-
}).meta({ id: "FindingLocationFile" });
|
|
20543
|
-
var FindingLocationRepo = external_exports.object({
|
|
20549
|
+
var FindingLocationSummary = external_exports.object({
|
|
20550
|
+
// Opaque, stable, minted from the pair by encodeLocationId. It exists
|
|
20551
|
+
// because a location's identity is two values and a URL param carries one:
|
|
20552
|
+
// `?loc=` names a location the way `?rule=` names a type. Only ever compared
|
|
20553
|
+
// for EQUALITY — the page's selection check, this read's `includeId`, the
|
|
20554
|
+
// client's page dedupe — never decoded, and never a sort key.
|
|
20555
|
+
id: external_exports.string(),
|
|
20544
20556
|
/** Empty when the instances carried no repo attribute. */
|
|
20545
20557
|
repo: external_exports.string(),
|
|
20558
|
+
// Empty when the instances carried no file path (a prompt, or a tool call
|
|
20559
|
+
// with no file attribution). Both halves empty is a real location — usually
|
|
20560
|
+
// the largest one in a store — and is selectable like any other.
|
|
20561
|
+
file: external_exports.string(),
|
|
20546
20562
|
instanceCount: external_exports.number().int().nonnegative(),
|
|
20563
|
+
// The WORST severity present, not the first row's. It is this list's primary
|
|
20564
|
+
// sort key, so it is also what explains why a row is where it is, and it is
|
|
20565
|
+
// how a reader decides what to open without opening everything.
|
|
20547
20566
|
maxSeverity: Severity,
|
|
20548
20567
|
latestDetectedAt: external_exports.iso.datetime(),
|
|
20568
|
+
// Folded from the instances' derived statuses with the same open-dominates
|
|
20569
|
+
// precedence a group uses, so it answers "is anything left to do here" and
|
|
20570
|
+
// not much more: a location holding 1 open among 40 resolved reads like one
|
|
20571
|
+
// holding 40 open. That loss is accepted — the panel beside this list
|
|
20572
|
+
// carries each finding's own status, and instanceCount sits next to the
|
|
20573
|
+
// badge.
|
|
20549
20574
|
status: FindingStatus.optional(),
|
|
20550
|
-
|
|
20551
|
-
|
|
20575
|
+
// Every distinct rule seen at this location, UNCAPPED — so the length is a
|
|
20576
|
+
// tally rather than a sample and a row can say how many there are. Bounded
|
|
20577
|
+
// by the ruleset, not by the store. The view bounds what it DISPLAYS.
|
|
20578
|
+
ruleIds: external_exports.array(external_exports.string())
|
|
20579
|
+
}).meta({ id: "FindingLocationSummary" });
|
|
20580
|
+
var MAX_FINDING_LOCATIONS_LIMIT = 100;
|
|
20552
20581
|
var ListFindingLocationsQuery = external_exports.object({
|
|
20553
20582
|
severity: external_exports.array(Severity).optional(),
|
|
20554
20583
|
subtype: external_exports.array(external_exports.string()).optional(),
|
|
@@ -20561,18 +20590,42 @@ var ListFindingLocationsQuery = external_exports.object({
|
|
|
20561
20590
|
q: external_exports.string().optional(),
|
|
20562
20591
|
sessionId: external_exports.string().optional(),
|
|
20563
20592
|
from: external_exports.iso.datetime().optional(),
|
|
20564
|
-
|
|
20593
|
+
// A LOCATION id (see FindingLocationSummary.id) that must appear in the page
|
|
20594
|
+
// even when the cursor has already advanced past its sort position — the
|
|
20595
|
+
// counterpart of ListFindingTypesQuery.includeId, and needed far more often
|
|
20596
|
+
// here. Selecting a row pushes the URL, which re-renders the server and resets
|
|
20597
|
+
// the client's page cache to page 0; with distinct (repo, file) pairs running
|
|
20598
|
+
// into the thousands, a selection sitting off page 0 is the ordinary case
|
|
20599
|
+
// rather than a deep-link corner. Never affects totals, facets or the cursor.
|
|
20600
|
+
includeId: external_exports.string().optional(),
|
|
20601
|
+
limit: external_exports.coerce.number().int().min(1).max(MAX_FINDING_LOCATIONS_LIMIT).optional(),
|
|
20602
|
+
cursor: external_exports.string().optional()
|
|
20565
20603
|
});
|
|
20566
20604
|
var ListFindingLocationsResponse = external_exports.object({
|
|
20567
20605
|
totals: external_exports.object({
|
|
20606
|
+
// Findings matching the filters across the whole scope. Unlike the types
|
|
20607
|
+
// read's same-named field this needs no caveat: the filters here narrow
|
|
20608
|
+
// per finding, so this is the sum of every row's instanceCount.
|
|
20568
20609
|
findings: external_exports.number().int().nonnegative(),
|
|
20569
|
-
|
|
20570
|
-
|
|
20610
|
+
// Counts LOCATIONS, the unit this read pages — the number the paginator
|
|
20611
|
+
// states. The facets beside it count FINDINGS (see below); a surface
|
|
20612
|
+
// showing both says which is which.
|
|
20613
|
+
locations: external_exports.number().int().nonnegative()
|
|
20571
20614
|
}),
|
|
20572
|
-
|
|
20573
|
-
|
|
20574
|
-
|
|
20575
|
-
|
|
20615
|
+
// Counts in FINDINGS, where the types response counts types, each dimension
|
|
20616
|
+
// still excluding its own filter. Deliberately not locations: counting those
|
|
20617
|
+
// needs a set of location keys per dimension per value — memory tracking the
|
|
20618
|
+
// store times the vocabulary, in a read whose scan promises flat memory —
|
|
20619
|
+
// and the cheap per-location version is not an approximation but WRONG. A
|
|
20620
|
+
// location holding {claudecode, block} and {codex, warn} would survive
|
|
20621
|
+
// provider=claudecode AND action=warn, under which no single finding
|
|
20622
|
+
// matches, so the facet would contradict the instanceCount this whole view
|
|
20623
|
+
// rests on. Findings also keep the toolbar in the same unit as the page
|
|
20624
|
+
// tally and the panel it sits above.
|
|
20625
|
+
facets: FindingFacets,
|
|
20626
|
+
/** Sorted by max severity, then most recent, then (repo, file). */
|
|
20627
|
+
items: external_exports.array(FindingLocationSummary),
|
|
20628
|
+
nextCursor: external_exports.string().nullable()
|
|
20576
20629
|
}).meta({ id: "ListFindingLocationsResponse" });
|
|
20577
20630
|
|
|
20578
20631
|
// ../../packages/schema/src/zod/meta.ts
|
|
@@ -21738,6 +21791,14 @@ var ControlPlaneErrorBody = external_exports.object({
|
|
|
21738
21791
|
message: external_exports.string().optional()
|
|
21739
21792
|
}).optional()
|
|
21740
21793
|
});
|
|
21794
|
+
var RemoteFailureKind = external_exports.enum([
|
|
21795
|
+
"unauthorized",
|
|
21796
|
+
"forbidden",
|
|
21797
|
+
"route-absent",
|
|
21798
|
+
"invalid-request",
|
|
21799
|
+
"rejected",
|
|
21800
|
+
"unreachable"
|
|
21801
|
+
]);
|
|
21741
21802
|
var AttachDeviceRequest = external_exports.object({
|
|
21742
21803
|
// This machine's own continuity id, so re-attaching ROTATES the credential
|
|
21743
21804
|
// on one machine record instead of producing a second one. Client-minted
|
|
@@ -21799,6 +21860,26 @@ var AttachTokenResponse = external_exports.union([
|
|
|
21799
21860
|
AttachTokenExpired,
|
|
21800
21861
|
external_exports.object({ status: printable(64) })
|
|
21801
21862
|
]);
|
|
21863
|
+
var DeviceCommandKind = external_exports.enum(["shares_rescan"]);
|
|
21864
|
+
var DeviceCommand = external_exports.object({
|
|
21865
|
+
id: printable(128).min(1),
|
|
21866
|
+
kind: DeviceCommandKind,
|
|
21867
|
+
issuedAt: printable(64).min(1),
|
|
21868
|
+
expiresAt: printable(64).min(1)
|
|
21869
|
+
}).strict();
|
|
21870
|
+
var DeviceCommandPollResponse = external_exports.object({ command: DeviceCommand.nullable() });
|
|
21871
|
+
var DeviceCommandFailureReason = external_exports.enum(["scan_failed", "no_projects", "expired"]);
|
|
21872
|
+
var DeviceCommandAckBody = external_exports.discriminatedUnion("outcome", [
|
|
21873
|
+
external_exports.object({
|
|
21874
|
+
outcome: external_exports.literal("reported"),
|
|
21875
|
+
projectsScanned: external_exports.number().int().nonnegative()
|
|
21876
|
+
}).strict(),
|
|
21877
|
+
external_exports.object({
|
|
21878
|
+
outcome: external_exports.literal("failed"),
|
|
21879
|
+
reason: DeviceCommandFailureReason,
|
|
21880
|
+
projectsScanned: external_exports.number().int().nonnegative()
|
|
21881
|
+
}).strict()
|
|
21882
|
+
]);
|
|
21802
21883
|
|
|
21803
21884
|
// ../../packages/schema/src/zod/registry.ts
|
|
21804
21885
|
var Namespace = external_exports.string().regex(/^[a-z][a-z0-9-]*$/);
|
|
@@ -21965,7 +22046,7 @@ var PackManifest = external_exports.object({
|
|
|
21965
22046
|
}).meta({ id: "PackManifest" });
|
|
21966
22047
|
|
|
21967
22048
|
// ../../packages/schema/src/zod/detection.ts
|
|
21968
|
-
var OriginEnum = external_exports.enum(["library"]).meta({ id: "OriginEnum" });
|
|
22049
|
+
var OriginEnum = external_exports.enum(["library", "custom"]).meta({ id: "OriginEnum" });
|
|
21969
22050
|
var DetectionFilterEnum = external_exports.enum(["all", "library", "custom", "customized", "updates"]);
|
|
21970
22051
|
var LibraryStateEnum = external_exports.enum(["new", "imported", "update"]).meta({ id: "LibraryStateEnum" });
|
|
21971
22052
|
var DetectionCounts = external_exports.object({
|
|
@@ -22160,8 +22241,9 @@ var Event = external_exports.object({
|
|
|
22160
22241
|
metadata: EventMetadata.optional()
|
|
22161
22242
|
}).meta({ id: "Event" });
|
|
22162
22243
|
var IngestEvent = Event.meta({ id: "IngestEvent" });
|
|
22244
|
+
var INGEST_BATCH_MAX = 100;
|
|
22163
22245
|
var IngestBatch = external_exports.object({
|
|
22164
|
-
events: external_exports.array(IngestEvent).min(1).max(
|
|
22246
|
+
events: external_exports.array(IngestEvent).min(1).max(INGEST_BATCH_MAX),
|
|
22165
22247
|
// Dedup policy for this batch. Id-dedup ALWAYS applies. 'content-hash'
|
|
22166
22248
|
// additionally rejects any event whose contentHash the store has already
|
|
22167
22249
|
// recorded — for re-runnable bulk ingest (worktree scan, transcript
|
|
@@ -22287,6 +22369,225 @@ var PatchInstalledPackRequest = external_exports.object({
|
|
|
22287
22369
|
message: "At least one field must be provided"
|
|
22288
22370
|
}).meta({ id: "PatchInstalledPackRequest" });
|
|
22289
22371
|
|
|
22372
|
+
// ../../packages/schema/src/zod/policy.ts
|
|
22373
|
+
var PolicyScope = external_exports.enum(["global", "repo", "user"]).meta({ id: "PolicyScope" });
|
|
22374
|
+
var PolicyTarget = external_exports.union([external_exports.object({ ruleId: external_exports.string() }), external_exports.object({ category: DetectionCategory })]).meta({ id: "PolicyTarget" });
|
|
22375
|
+
var PolicyKind = external_exports.enum(["builtin", "custom"]).meta({ id: "PolicyKind" });
|
|
22376
|
+
var PolicyProvenance = external_exports.enum(["builtin", "authored"]).meta({ id: "PolicyProvenance" });
|
|
22377
|
+
var Policy = external_exports.object({
|
|
22378
|
+
id: external_exports.guid(),
|
|
22379
|
+
scope: PolicyScope,
|
|
22380
|
+
target: PolicyTarget,
|
|
22381
|
+
action: ActionTaken,
|
|
22382
|
+
enabled: external_exports.boolean().default(true),
|
|
22383
|
+
customKeywords: external_exports.array(external_exports.string()).optional(),
|
|
22384
|
+
// Display name — optional so older policy rows without name still parse.
|
|
22385
|
+
// Added for the findings API (policy.name column migration).
|
|
22386
|
+
name: external_exports.string().optional(),
|
|
22387
|
+
// Whether an AUTHORED policy governs this row's target — not a claim about
|
|
22388
|
+
// which row this is. A producer that collapses several rows onto one target
|
|
22389
|
+
// must carry the marker onto whichever row survives, or the collapse decides
|
|
22390
|
+
// the answer; a survivor may therefore be a built-in expansion still marked
|
|
22391
|
+
// 'authored' because an authored sibling targeted the same thing.
|
|
22392
|
+
// Optional so an older producer — and an older on-disk cache — still parses;
|
|
22393
|
+
// absent reads as 'builtin', which is the behaviour that predates the field.
|
|
22394
|
+
//
|
|
22395
|
+
// Deliberately NOT `kind`/PolicyKind: that name and that enum answer which
|
|
22396
|
+
// built-in archetype catalog entry a policy is, which every catalog surface
|
|
22397
|
+
// reads and which a caller may state. This one is a statement the PRODUCER
|
|
22398
|
+
// of a bundle makes about a row, and only the bundle builder ever stamps it
|
|
22399
|
+
// — the CRUD routes neither accept nor set it.
|
|
22400
|
+
//
|
|
22401
|
+
// A device consumes this in exactly one direction: an 'authored' policy
|
|
22402
|
+
// arriving from a control plane marks the rules it targets as not
|
|
22403
|
+
// locally re-assignable. That can only ever ADD a refusal, never relax one,
|
|
22404
|
+
// which is what makes it safe to honour from an unsigned cache — the same
|
|
22405
|
+
// test `prohibitedModels` passes and `reversibleRuleIds` fails.
|
|
22406
|
+
provenance: PolicyProvenance.optional()
|
|
22407
|
+
}).meta({ id: "Policy" });
|
|
22408
|
+
var PolicyBundle = external_exports.object({
|
|
22409
|
+
version: external_exports.string(),
|
|
22410
|
+
policies: external_exports.array(Policy),
|
|
22411
|
+
// Rules from the installed marketplace packs (snapshotted by the
|
|
22412
|
+
// control plane). The plugin registers these in addition to its bundled
|
|
22413
|
+
// packs. Optional so older backends — and older on-disk caches — that omit
|
|
22414
|
+
// the field still parse; consumers read `bundle.rules ?? []`.
|
|
22415
|
+
rules: external_exports.array(Rule).optional(),
|
|
22416
|
+
// When true, `rules` IS the complete effective ruleset and the runtime must
|
|
22417
|
+
// NOT merge its compiled-in bundled packs — the standalone gateway sets this
|
|
22418
|
+
// after reading the user's installed snapshot (installed_packs, enabled
|
|
22419
|
+
// packs only), which is how detection updates stay manual: new bundled
|
|
22420
|
+
// rules run only after the user applies the pack update. Absent/false keeps
|
|
22421
|
+
// the historical composition (bundled packs + rules) — older caches.
|
|
22422
|
+
rulesComplete: external_exports.boolean().optional(),
|
|
22423
|
+
// Active detection exceptions, evaluation subset only (see
|
|
22424
|
+
// ExceptionBundleEntry). Optional so older bundle producers — and older
|
|
22425
|
+
// on-disk caches — that omit the field still parse; consumers read
|
|
22426
|
+
// `bundle.exceptions ?? []`.
|
|
22427
|
+
exceptions: external_exports.array(ExceptionBundleEntry).optional(),
|
|
22428
|
+
// Rule ids whose pack is assigned a REVERSIBLE archetype (Redact & Vault).
|
|
22429
|
+
// A second axis over the same `redact` action, carried beside the policies
|
|
22430
|
+
// rather than on them: nothing writes ruleId-targeted policies to disk, so
|
|
22431
|
+
// widening Policy itself would change a persisted shape to express something
|
|
22432
|
+
// only the in-memory bundle needs. Optional so an older producer — or an
|
|
22433
|
+
// older on-disk cache — still parses; consumers read `?? []` and get the
|
|
22434
|
+
// pre-existing one-way behaviour, which is the safe direction to default.
|
|
22435
|
+
reversibleRuleIds: external_exports.array(external_exports.string()).optional(),
|
|
22436
|
+
// Installed pack version, keyed by ruleId, for rules in `rules` that came
|
|
22437
|
+
// from a versioned installed pack. Optional so older backends — and older
|
|
22438
|
+
// on-disk caches — that omit the field still parse; consumers fall back to
|
|
22439
|
+
// the rule's own spec version. NOT the bundle version above — see
|
|
22440
|
+
// installedRuleset's ruleVersions for the source of truth.
|
|
22441
|
+
ruleVersions: external_exports.record(external_exports.string(), external_exports.string()).optional(),
|
|
22442
|
+
// Model ids (the raw `model` string a harness reports, e.g.
|
|
22443
|
+
// `claude-opus-4-1`) the tenant has PROHIBITED. The plugin refuses to switch
|
|
22444
|
+
// a session onto one (PreModelSwitch) and refuses a turn that would run on
|
|
22445
|
+
// one (UserPromptSubmit). Optional so an older backend — and an older
|
|
22446
|
+
// on-disk cache — still parses; consumers read `?? []`, which is the
|
|
22447
|
+
// unenforced behaviour that predates this field and the safe direction to
|
|
22448
|
+
// default.
|
|
22449
|
+
//
|
|
22450
|
+
// Ids, not display names: the governance decision is keyed on the exact
|
|
22451
|
+
// string the harness reports (`model_status_override.versionId` in the
|
|
22452
|
+
// control plane), so no name resolution stands between the decision and the
|
|
22453
|
+
// comparison.
|
|
22454
|
+
prohibitedModels: external_exports.array(external_exports.string()).optional(),
|
|
22455
|
+
customKeywords: external_exports.array(external_exports.string()),
|
|
22456
|
+
fetchedAt: external_exports.iso.datetime()
|
|
22457
|
+
}).meta({ id: "PolicyBundle" });
|
|
22458
|
+
var POLICY_BUNDLE_SHAPE_ID = [
|
|
22459
|
+
...Object.keys(PolicyBundle.shape),
|
|
22460
|
+
...Object.keys(Policy.shape).map((key) => `policies.${key}`),
|
|
22461
|
+
...PolicyTarget.options.flatMap((member) => "shape" in member ? Object.keys(member.shape) : []).map((key) => `policies.target.${key}`),
|
|
22462
|
+
...Object.keys(ExceptionBundleEntry.shape).map((key) => `exceptions.${key}`)
|
|
22463
|
+
].sort().join(",");
|
|
22464
|
+
var OBSERVE_ONLY_CATEGORIES = ["config"];
|
|
22465
|
+
var ENFORCEABLE_CATEGORIES = DetectionCategory.options.filter((c) => !OBSERVE_ONLY_CATEGORIES.includes(c));
|
|
22466
|
+
var CATEGORY_PEAK_SEVERITY = {
|
|
22467
|
+
secret: "critical",
|
|
22468
|
+
financial: "critical",
|
|
22469
|
+
// core-financial/credit-card
|
|
22470
|
+
code_flaw: "critical",
|
|
22471
|
+
pii: "high",
|
|
22472
|
+
phi: "high",
|
|
22473
|
+
custom: "high",
|
|
22474
|
+
// user-defined; conservative
|
|
22475
|
+
code_context: "low",
|
|
22476
|
+
config: "low"
|
|
22477
|
+
// observe-only; floors to monitor regardless
|
|
22478
|
+
};
|
|
22479
|
+
function severityFloorPolicy(category) {
|
|
22480
|
+
if (OBSERVE_ONLY_CATEGORIES.includes(category)) return "monitor";
|
|
22481
|
+
const peak = CATEGORY_PEAK_SEVERITY[category];
|
|
22482
|
+
return peak === "critical" || peak === "high" ? "warn" : "monitor";
|
|
22483
|
+
}
|
|
22484
|
+
var KNOWN_BUILTIN_IDS = ["monitor", "warn", "redact", "vault", "block"];
|
|
22485
|
+
var BuiltinPolicyId = external_exports.enum(KNOWN_BUILTIN_IDS).meta({ id: "BuiltinPolicyId" });
|
|
22486
|
+
var RedactFallback = BuiltinPolicyId.extract(["monitor", "warn", "block"]).meta({
|
|
22487
|
+
id: "RedactFallback"
|
|
22488
|
+
});
|
|
22489
|
+
var BUILTIN_POLICY_SPECS = {
|
|
22490
|
+
monitor: {
|
|
22491
|
+
name: "Monitor",
|
|
22492
|
+
action: "log",
|
|
22493
|
+
reversible: false,
|
|
22494
|
+
description: "Log every match for audit. The request is allowed through untouched."
|
|
22495
|
+
},
|
|
22496
|
+
warn: {
|
|
22497
|
+
name: "Warn",
|
|
22498
|
+
action: "warn",
|
|
22499
|
+
reversible: false,
|
|
22500
|
+
description: "Allow the request, but warn the user inline before it is sent."
|
|
22501
|
+
},
|
|
22502
|
+
redact: {
|
|
22503
|
+
name: "Redact",
|
|
22504
|
+
action: "redact",
|
|
22505
|
+
reversible: false,
|
|
22506
|
+
description: "Strip the matched value from the request and destroy it, then continue. What was removed cannot be recovered."
|
|
22507
|
+
},
|
|
22508
|
+
vault: {
|
|
22509
|
+
name: "Redact & Vault",
|
|
22510
|
+
action: "redact",
|
|
22511
|
+
reversible: true,
|
|
22512
|
+
description: "Strip the matched value from the request and keep an encrypted, recoverable copy in the local vault, leaving a pointer in its place. Needs the vault consent granted under Settings; without it this behaves as Redact."
|
|
22513
|
+
},
|
|
22514
|
+
block: {
|
|
22515
|
+
name: "Block",
|
|
22516
|
+
action: "block",
|
|
22517
|
+
reversible: false,
|
|
22518
|
+
description: "Refuse the request entirely whenever any rule in this detection matches."
|
|
22519
|
+
}
|
|
22520
|
+
};
|
|
22521
|
+
function builtinPolicyToAction(id) {
|
|
22522
|
+
return BUILTIN_POLICY_SPECS[id].action;
|
|
22523
|
+
}
|
|
22524
|
+
var PALETTE_WEAKEST_FIRST = [
|
|
22525
|
+
...new Set(KNOWN_BUILTIN_IDS.map(builtinPolicyToAction))
|
|
22526
|
+
];
|
|
22527
|
+
var BELOW_PALETTE = ACTION_TAKEN_KEYS.filter(
|
|
22528
|
+
(action) => !PALETTE_WEAKEST_FIRST.includes(action)
|
|
22529
|
+
);
|
|
22530
|
+
var ACTION_STRENGTH_ORDER = [
|
|
22531
|
+
...BELOW_PALETTE,
|
|
22532
|
+
...PALETTE_WEAKEST_FIRST
|
|
22533
|
+
];
|
|
22534
|
+
var PackPolicyFloor = external_exports.object({
|
|
22535
|
+
/**
|
|
22536
|
+
* The weakest archetype the device may assign. Stated as a BuiltinPolicyId
|
|
22537
|
+
* rather than a raw ActionTaken because that is the vocabulary the user
|
|
22538
|
+
* picks from — a floor a UI cannot name is one it cannot explain.
|
|
22539
|
+
*/
|
|
22540
|
+
floor: BuiltinPolicyId,
|
|
22541
|
+
/**
|
|
22542
|
+
* True when the organization AUTHORED a policy governing this pack rather
|
|
22543
|
+
* than stating a minimum: it gave the answer, so the pack is not
|
|
22544
|
+
* re-assignable locally in either direction.
|
|
22545
|
+
*/
|
|
22546
|
+
locked: external_exports.boolean()
|
|
22547
|
+
}).describe("PackPolicyFloor");
|
|
22548
|
+
var CATEGORY_EXPRESSIBLE_IDS = KNOWN_BUILTIN_IDS.filter(
|
|
22549
|
+
(id) => !BUILTIN_POLICY_SPECS[id].reversible
|
|
22550
|
+
);
|
|
22551
|
+
var CATEGORY_INEXPRESSIBLE_IDS = KNOWN_BUILTIN_IDS.filter(
|
|
22552
|
+
(id) => BUILTIN_POLICY_SPECS[id].reversible
|
|
22553
|
+
);
|
|
22554
|
+
var CategoryPolicyId = external_exports.enum(CATEGORY_EXPRESSIBLE_IDS).meta({ id: "CategoryPolicyId" });
|
|
22555
|
+
var DEFAULT_ACTIONS = Object.fromEntries(
|
|
22556
|
+
DetectionCategory.options.map((c) => [c, builtinPolicyToAction(severityFloorPolicy(c))])
|
|
22557
|
+
);
|
|
22558
|
+
var BUILTIN_POLICIES = Object.fromEntries(
|
|
22559
|
+
KNOWN_BUILTIN_IDS.map((id) => [id, { id, ...BUILTIN_POLICY_SPECS[id] }])
|
|
22560
|
+
);
|
|
22561
|
+
var UsedByItem = external_exports.object({
|
|
22562
|
+
id: external_exports.string(),
|
|
22563
|
+
name: external_exports.string(),
|
|
22564
|
+
ruleCount: external_exports.number().int().nonnegative(),
|
|
22565
|
+
enabled: external_exports.boolean()
|
|
22566
|
+
}).meta({ id: "UsedByItem" });
|
|
22567
|
+
var PolicyListItem = external_exports.object({
|
|
22568
|
+
id: external_exports.string(),
|
|
22569
|
+
kind: PolicyKind,
|
|
22570
|
+
name: external_exports.string(),
|
|
22571
|
+
enabled: external_exports.boolean(),
|
|
22572
|
+
usedByCount: external_exports.number().int().nonnegative()
|
|
22573
|
+
}).meta({ id: "PolicyListItem" });
|
|
22574
|
+
var ListPoliciesResponse = external_exports.object({ items: external_exports.array(PolicyListItem) }).meta({ id: "ListPoliciesResponse" });
|
|
22575
|
+
var PolicyDetail = external_exports.object({
|
|
22576
|
+
specVersion: external_exports.literal(1),
|
|
22577
|
+
id: external_exports.string(),
|
|
22578
|
+
kind: PolicyKind,
|
|
22579
|
+
name: external_exports.string(),
|
|
22580
|
+
enabled: external_exports.boolean(),
|
|
22581
|
+
description: external_exports.string(),
|
|
22582
|
+
usedBy: external_exports.array(UsedByItem)
|
|
22583
|
+
}).meta({ id: "PolicyDetail" });
|
|
22584
|
+
var PolicyStatsResponse = external_exports.object({
|
|
22585
|
+
policies: external_exports.number().int().nonnegative(),
|
|
22586
|
+
builtin: external_exports.number().int().nonnegative(),
|
|
22587
|
+
custom: external_exports.number().int().nonnegative(),
|
|
22588
|
+
detectionsGoverned: external_exports.number().int().nonnegative()
|
|
22589
|
+
}).meta({ id: "PolicyStatsResponse" });
|
|
22590
|
+
|
|
22290
22591
|
// ../../packages/schema/src/zod/vault.ts
|
|
22291
22592
|
var CATEGORY_ALTERNATION = DetectionCategory.options.join("|");
|
|
22292
22593
|
var POINTER_TOKEN_PATTERN = new RegExp(
|
|
@@ -22323,6 +22624,14 @@ var VaultEntry = external_exports.object({
|
|
|
22323
22624
|
// How many times this value has been detected on this machine — the reuse
|
|
22324
22625
|
// signal the vault dashboard reads. Distinct from VaultDeref.pointerCount.
|
|
22325
22626
|
occurrenceCount: external_exports.number().int().nonnegative(),
|
|
22627
|
+
// True when a PERSON asked for this value to be replaced — the surfaced-
|
|
22628
|
+
// secrets strike — rather than a pack enforcing its assignment. One value is
|
|
22629
|
+
// one row however many paths vault it, so this is what tells a policy sweep
|
|
22630
|
+
// that the row carries somebody's own instruction and not just an assignment
|
|
22631
|
+
// that has since been lowered. STICKY and MONOTONIC: a later automatic
|
|
22632
|
+
// vaulting of the same value must never clear it — what the user said about
|
|
22633
|
+
// the value does not expire.
|
|
22634
|
+
userAuthorized: external_exports.boolean(),
|
|
22326
22635
|
firstSeen: external_exports.string(),
|
|
22327
22636
|
lastSeen: external_exports.string()
|
|
22328
22637
|
});
|
|
@@ -22439,7 +22748,7 @@ var VaultConsent = external_exports.object({
|
|
|
22439
22748
|
});
|
|
22440
22749
|
|
|
22441
22750
|
// ../../packages/schema/src/zod/local.ts
|
|
22442
|
-
var WORKSPACE_SETTINGS_SPEC_VERSION =
|
|
22751
|
+
var WORKSPACE_SETTINGS_SPEC_VERSION = 7;
|
|
22443
22752
|
var MODEL_JUDGE_PAYLOAD_VERSION = 1;
|
|
22444
22753
|
var RunMode = external_exports.enum(["standalone", "attached"]);
|
|
22445
22754
|
var ControlPlaneConnection = external_exports.object({
|
|
@@ -22481,6 +22790,19 @@ var WorkspaceSettings = external_exports.object({
|
|
|
22481
22790
|
vaultKeyCustody: VaultKeyCustody.default("file"),
|
|
22482
22791
|
// How a pointer renders in assistant prose on screen (see VaultInlineReveal).
|
|
22483
22792
|
vaultInlineReveal: VaultInlineReveal.default("masked"),
|
|
22793
|
+
// What a `redact` policy degrades to on a FIELD the host cannot rewrite in
|
|
22794
|
+
// place. Not a handling policy: the policy has already resolved to redact,
|
|
22795
|
+
// and this only says what happens when the host offers no channel to carry it
|
|
22796
|
+
// out — Antigravity's PreToolUse has no updatedInput at all, and Codex and
|
|
22797
|
+
// Claude Code decline to mask a field that EXECUTES because masking would
|
|
22798
|
+
// change what runs. Per FIELD rather than per host, so a host that can
|
|
22799
|
+
// rewrite some inputs keeps true redaction on those.
|
|
22800
|
+
//
|
|
22801
|
+
// Spelled in the built-in policy vocabulary rather than as a fresh enum, so
|
|
22802
|
+
// an attached machine's merge is `strongerAction` over the one action ladder
|
|
22803
|
+
// and no second rank order exists to drift from it. 'deny' is a host wire
|
|
22804
|
+
// word and stays out of the stored value.
|
|
22805
|
+
redactFallback: RedactFallback.default("warn"),
|
|
22484
22806
|
// Absent until /aka:setup completes; its presence is what "onboarded" means.
|
|
22485
22807
|
onboardedAt: external_exports.iso.datetime().optional(),
|
|
22486
22808
|
// Records that the user consented to sending findings to the model API for
|
|
@@ -22488,10 +22810,12 @@ var WorkspaceSettings = external_exports.object({
|
|
|
22488
22810
|
// Absent until granted; a stale payloadVersion means the consent no longer
|
|
22489
22811
|
// covers the current payload and must be re-granted.
|
|
22490
22812
|
modelJudgeConsent: ModelJudgeConsent.optional(),
|
|
22491
|
-
// Records that the user consented to
|
|
22492
|
-
//
|
|
22493
|
-
//
|
|
22494
|
-
//
|
|
22813
|
+
// Records that the user consented to the DEFERRED send — the outbox — along
|
|
22814
|
+
// with the payload shape and the endpoint they agreed to. Since payload v3
|
|
22815
|
+
// that covers the pre-attach backlog AND undelivered captures alike, and both
|
|
22816
|
+
// carry prompt/reply/tool-output text in `content`; the key name predates
|
|
22817
|
+
// both widenings. Absent until granted, and a grant for a different endpoint
|
|
22818
|
+
// or an older payload no longer counts.
|
|
22495
22819
|
historySyncConsent: HistorySyncConsent.optional()
|
|
22496
22820
|
});
|
|
22497
22821
|
function defaultWorkspaceSettings() {
|
|
@@ -22511,8 +22835,12 @@ var ManagedSettingKey = external_exports.enum([
|
|
|
22511
22835
|
"vaultKeyCustody",
|
|
22512
22836
|
"vaultInlineReveal",
|
|
22513
22837
|
"modelJudgeConsent",
|
|
22514
|
-
"dataSharesInPlace"
|
|
22838
|
+
"dataSharesInPlace",
|
|
22839
|
+
"redactFallback"
|
|
22515
22840
|
]).meta({ id: "ManagedSettingKey" });
|
|
22841
|
+
function isManagedSettingKey(value) {
|
|
22842
|
+
return ManagedSettingKey.safeParse(value).success;
|
|
22843
|
+
}
|
|
22516
22844
|
var ManagedSettingsValues = external_exports.object({
|
|
22517
22845
|
runMode: external_exports.enum(["standalone", "attached"]).optional(),
|
|
22518
22846
|
controlPlane: external_exports.object({
|
|
@@ -22524,7 +22852,8 @@ var ManagedSettingsValues = external_exports.object({
|
|
|
22524
22852
|
vaultKeyCustody: external_exports.enum(["file", "keychain"]).optional(),
|
|
22525
22853
|
vaultInlineReveal: external_exports.enum(["masked", "full", "off"]).optional(),
|
|
22526
22854
|
modelJudgeConsent: external_exports.boolean().optional(),
|
|
22527
|
-
dataSharesInPlace: external_exports.boolean().optional()
|
|
22855
|
+
dataSharesInPlace: external_exports.boolean().optional(),
|
|
22856
|
+
redactFallback: RedactFallback.optional()
|
|
22528
22857
|
}).meta({ id: "ManagedSettingsValues" });
|
|
22529
22858
|
var ManagedSettings = external_exports.object({
|
|
22530
22859
|
specVersion: external_exports.number().int().positive().default(MANAGED_SETTINGS_SPEC_VERSION),
|
|
@@ -22536,174 +22865,29 @@ var ManagedSettings = external_exports.object({
|
|
|
22536
22865
|
// Which of those the user may not change. A key here with no matching value
|
|
22537
22866
|
// freezes whatever the user last chose; a value with no lock is a DEFAULT
|
|
22538
22867
|
// the user may still override. The two are separable on purpose.
|
|
22539
|
-
|
|
22868
|
+
//
|
|
22869
|
+
// Parsed as NAMES rather than as the enum, and split below: a name this
|
|
22870
|
+
// build does not know is dropped from the locked set and reported, never a
|
|
22871
|
+
// reason to refuse the file. The same shape reaches an older build whenever
|
|
22872
|
+
// an administrator locks a key a newer build added, and refusing it there
|
|
22873
|
+
// ran that build entirely unmanaged — every pin and lock gone — on exactly
|
|
22874
|
+
// the fleets most likely to carry a version skew. A name outside the enum
|
|
22875
|
+
// is still never HONOURED: the lockable set stays explicit above.
|
|
22876
|
+
lockedFields: external_exports.array(external_exports.string()).default([])
|
|
22877
|
+
}).transform(({ lockedFields, ...rest }) => {
|
|
22878
|
+
const known = [];
|
|
22879
|
+
const unknown2 = [];
|
|
22880
|
+
for (const name of lockedFields) {
|
|
22881
|
+
if (isManagedSettingKey(name)) known.push(name);
|
|
22882
|
+
else unknown2.push(name);
|
|
22883
|
+
}
|
|
22884
|
+
return {
|
|
22885
|
+
...rest,
|
|
22886
|
+
lockedFields: known,
|
|
22887
|
+
...unknown2.length > 0 ? { unknownLockedFields: unknown2 } : {}
|
|
22888
|
+
};
|
|
22540
22889
|
}).meta({ id: "ManagedSettings" });
|
|
22541
22890
|
|
|
22542
|
-
// ../../packages/schema/src/zod/policy.ts
|
|
22543
|
-
var PolicyScope = external_exports.enum(["global", "repo", "user"]).meta({ id: "PolicyScope" });
|
|
22544
|
-
var PolicyTarget = external_exports.union([external_exports.object({ ruleId: external_exports.string() }), external_exports.object({ category: DetectionCategory })]).meta({ id: "PolicyTarget" });
|
|
22545
|
-
var Policy = external_exports.object({
|
|
22546
|
-
id: external_exports.guid(),
|
|
22547
|
-
scope: PolicyScope,
|
|
22548
|
-
target: PolicyTarget,
|
|
22549
|
-
action: ActionTaken,
|
|
22550
|
-
enabled: external_exports.boolean().default(true),
|
|
22551
|
-
customKeywords: external_exports.array(external_exports.string()).optional(),
|
|
22552
|
-
// Display name — optional so older policy rows without name still parse.
|
|
22553
|
-
// Added for the findings API (policy.name column migration).
|
|
22554
|
-
name: external_exports.string().optional()
|
|
22555
|
-
}).meta({ id: "Policy" });
|
|
22556
|
-
var PolicyBundle = external_exports.object({
|
|
22557
|
-
version: external_exports.string(),
|
|
22558
|
-
policies: external_exports.array(Policy),
|
|
22559
|
-
// Rules from the installed marketplace packs (snapshotted by the
|
|
22560
|
-
// control plane). The plugin registers these in addition to its bundled
|
|
22561
|
-
// packs. Optional so older backends — and older on-disk caches — that omit
|
|
22562
|
-
// the field still parse; consumers read `bundle.rules ?? []`.
|
|
22563
|
-
rules: external_exports.array(Rule).optional(),
|
|
22564
|
-
// When true, `rules` IS the complete effective ruleset and the runtime must
|
|
22565
|
-
// NOT merge its compiled-in bundled packs — the standalone gateway sets this
|
|
22566
|
-
// after reading the user's installed snapshot (installed_packs, enabled
|
|
22567
|
-
// packs only), which is how detection updates stay manual: new bundled
|
|
22568
|
-
// rules run only after the user applies the pack update. Absent/false keeps
|
|
22569
|
-
// the historical composition (bundled packs + rules) — older caches.
|
|
22570
|
-
rulesComplete: external_exports.boolean().optional(),
|
|
22571
|
-
// Active detection exceptions, evaluation subset only (see
|
|
22572
|
-
// ExceptionBundleEntry). Optional so older bundle producers — and older
|
|
22573
|
-
// on-disk caches — that omit the field still parse; consumers read
|
|
22574
|
-
// `bundle.exceptions ?? []`.
|
|
22575
|
-
exceptions: external_exports.array(ExceptionBundleEntry).optional(),
|
|
22576
|
-
// Rule ids whose pack is assigned a REVERSIBLE archetype (Redact & Vault).
|
|
22577
|
-
// A second axis over the same `redact` action, carried beside the policies
|
|
22578
|
-
// rather than on them: nothing writes ruleId-targeted policies to disk, so
|
|
22579
|
-
// widening Policy itself would change a persisted shape to express something
|
|
22580
|
-
// only the in-memory bundle needs. Optional so an older producer — or an
|
|
22581
|
-
// older on-disk cache — still parses; consumers read `?? []` and get the
|
|
22582
|
-
// pre-existing one-way behaviour, which is the safe direction to default.
|
|
22583
|
-
reversibleRuleIds: external_exports.array(external_exports.string()).optional(),
|
|
22584
|
-
// Installed pack version, keyed by ruleId, for rules in `rules` that came
|
|
22585
|
-
// from a versioned installed pack. Optional so older backends — and older
|
|
22586
|
-
// on-disk caches — that omit the field still parse; consumers fall back to
|
|
22587
|
-
// the rule's own spec version. NOT the bundle version above — see
|
|
22588
|
-
// installedRuleset's ruleVersions for the source of truth.
|
|
22589
|
-
ruleVersions: external_exports.record(external_exports.string(), external_exports.string()).optional(),
|
|
22590
|
-
// Model ids (the raw `model` string a harness reports, e.g.
|
|
22591
|
-
// `claude-opus-4-1`) the tenant has PROHIBITED. The plugin refuses to switch
|
|
22592
|
-
// a session onto one (PreModelSwitch) and refuses a turn that would run on
|
|
22593
|
-
// one (UserPromptSubmit). Optional so an older backend — and an older
|
|
22594
|
-
// on-disk cache — still parses; consumers read `?? []`, which is the
|
|
22595
|
-
// unenforced behaviour that predates this field and the safe direction to
|
|
22596
|
-
// default.
|
|
22597
|
-
//
|
|
22598
|
-
// Ids, not display names: the governance decision is keyed on the exact
|
|
22599
|
-
// string the harness reports (`model_status_override.versionId` in the
|
|
22600
|
-
// control plane), so no name resolution stands between the decision and the
|
|
22601
|
-
// comparison.
|
|
22602
|
-
prohibitedModels: external_exports.array(external_exports.string()).optional(),
|
|
22603
|
-
customKeywords: external_exports.array(external_exports.string()),
|
|
22604
|
-
fetchedAt: external_exports.iso.datetime()
|
|
22605
|
-
}).meta({ id: "PolicyBundle" });
|
|
22606
|
-
var OBSERVE_ONLY_CATEGORIES = ["config"];
|
|
22607
|
-
var ENFORCEABLE_CATEGORIES = DetectionCategory.options.filter((c) => !OBSERVE_ONLY_CATEGORIES.includes(c));
|
|
22608
|
-
var CATEGORY_PEAK_SEVERITY = {
|
|
22609
|
-
secret: "critical",
|
|
22610
|
-
financial: "critical",
|
|
22611
|
-
// core-financial/credit-card
|
|
22612
|
-
code_flaw: "critical",
|
|
22613
|
-
pii: "high",
|
|
22614
|
-
phi: "high",
|
|
22615
|
-
custom: "high",
|
|
22616
|
-
// user-defined; conservative
|
|
22617
|
-
code_context: "low",
|
|
22618
|
-
config: "low"
|
|
22619
|
-
// observe-only; floors to monitor regardless
|
|
22620
|
-
};
|
|
22621
|
-
function severityFloorPolicy(category) {
|
|
22622
|
-
if (OBSERVE_ONLY_CATEGORIES.includes(category)) return "monitor";
|
|
22623
|
-
const peak = CATEGORY_PEAK_SEVERITY[category];
|
|
22624
|
-
return peak === "critical" || peak === "high" ? "warn" : "monitor";
|
|
22625
|
-
}
|
|
22626
|
-
var PolicyKind = external_exports.enum(["builtin", "custom"]).meta({ id: "PolicyKind" });
|
|
22627
|
-
var KNOWN_BUILTIN_IDS = ["monitor", "warn", "redact", "vault", "block"];
|
|
22628
|
-
var BuiltinPolicyId = external_exports.enum(KNOWN_BUILTIN_IDS).meta({ id: "BuiltinPolicyId" });
|
|
22629
|
-
var BUILTIN_POLICY_SPECS = {
|
|
22630
|
-
monitor: {
|
|
22631
|
-
name: "Monitor",
|
|
22632
|
-
action: "log",
|
|
22633
|
-
reversible: false,
|
|
22634
|
-
description: "Log every match for audit. The request is allowed through untouched."
|
|
22635
|
-
},
|
|
22636
|
-
warn: {
|
|
22637
|
-
name: "Warn",
|
|
22638
|
-
action: "warn",
|
|
22639
|
-
reversible: false,
|
|
22640
|
-
description: "Allow the request, but warn the user inline before it is sent."
|
|
22641
|
-
},
|
|
22642
|
-
redact: {
|
|
22643
|
-
name: "Redact",
|
|
22644
|
-
action: "redact",
|
|
22645
|
-
reversible: false,
|
|
22646
|
-
description: "Strip the matched value from the request and destroy it, then continue. What was removed cannot be recovered."
|
|
22647
|
-
},
|
|
22648
|
-
vault: {
|
|
22649
|
-
name: "Redact & Vault",
|
|
22650
|
-
action: "redact",
|
|
22651
|
-
reversible: true,
|
|
22652
|
-
description: "Strip the matched value from the request and keep an encrypted, recoverable copy in the local vault, leaving a pointer in its place. Needs the vault consent granted under Settings; without it this behaves as Redact."
|
|
22653
|
-
},
|
|
22654
|
-
block: {
|
|
22655
|
-
name: "Block",
|
|
22656
|
-
action: "block",
|
|
22657
|
-
reversible: false,
|
|
22658
|
-
description: "Refuse the request entirely whenever any rule in this detection matches."
|
|
22659
|
-
}
|
|
22660
|
-
};
|
|
22661
|
-
function builtinPolicyToAction(id) {
|
|
22662
|
-
return BUILTIN_POLICY_SPECS[id].action;
|
|
22663
|
-
}
|
|
22664
|
-
var CATEGORY_EXPRESSIBLE_IDS = KNOWN_BUILTIN_IDS.filter(
|
|
22665
|
-
(id) => !BUILTIN_POLICY_SPECS[id].reversible
|
|
22666
|
-
);
|
|
22667
|
-
var CATEGORY_INEXPRESSIBLE_IDS = KNOWN_BUILTIN_IDS.filter(
|
|
22668
|
-
(id) => BUILTIN_POLICY_SPECS[id].reversible
|
|
22669
|
-
);
|
|
22670
|
-
var CategoryPolicyId = external_exports.enum(CATEGORY_EXPRESSIBLE_IDS).meta({ id: "CategoryPolicyId" });
|
|
22671
|
-
var DEFAULT_ACTIONS = Object.fromEntries(
|
|
22672
|
-
DetectionCategory.options.map((c) => [c, builtinPolicyToAction(severityFloorPolicy(c))])
|
|
22673
|
-
);
|
|
22674
|
-
var BUILTIN_POLICIES = Object.fromEntries(
|
|
22675
|
-
KNOWN_BUILTIN_IDS.map((id) => [id, { id, ...BUILTIN_POLICY_SPECS[id] }])
|
|
22676
|
-
);
|
|
22677
|
-
var UsedByItem = external_exports.object({
|
|
22678
|
-
id: external_exports.string(),
|
|
22679
|
-
name: external_exports.string(),
|
|
22680
|
-
ruleCount: external_exports.number().int().nonnegative(),
|
|
22681
|
-
enabled: external_exports.boolean()
|
|
22682
|
-
}).meta({ id: "UsedByItem" });
|
|
22683
|
-
var PolicyListItem = external_exports.object({
|
|
22684
|
-
id: external_exports.string(),
|
|
22685
|
-
kind: PolicyKind,
|
|
22686
|
-
name: external_exports.string(),
|
|
22687
|
-
enabled: external_exports.boolean(),
|
|
22688
|
-
usedByCount: external_exports.number().int().nonnegative()
|
|
22689
|
-
}).meta({ id: "PolicyListItem" });
|
|
22690
|
-
var ListPoliciesResponse = external_exports.object({ items: external_exports.array(PolicyListItem) }).meta({ id: "ListPoliciesResponse" });
|
|
22691
|
-
var PolicyDetail = external_exports.object({
|
|
22692
|
-
specVersion: external_exports.literal(1),
|
|
22693
|
-
id: external_exports.string(),
|
|
22694
|
-
kind: PolicyKind,
|
|
22695
|
-
name: external_exports.string(),
|
|
22696
|
-
enabled: external_exports.boolean(),
|
|
22697
|
-
description: external_exports.string(),
|
|
22698
|
-
usedBy: external_exports.array(UsedByItem)
|
|
22699
|
-
}).meta({ id: "PolicyDetail" });
|
|
22700
|
-
var PolicyStatsResponse = external_exports.object({
|
|
22701
|
-
policies: external_exports.number().int().nonnegative(),
|
|
22702
|
-
builtin: external_exports.number().int().nonnegative(),
|
|
22703
|
-
custom: external_exports.number().int().nonnegative(),
|
|
22704
|
-
detectionsGoverned: external_exports.number().int().nonnegative()
|
|
22705
|
-
}).meta({ id: "PolicyStatsResponse" });
|
|
22706
|
-
|
|
22707
22891
|
// ../../packages/schema/src/zod/project-files.ts
|
|
22708
22892
|
var ProjectFileInput = external_exports.object({
|
|
22709
22893
|
path: external_exports.string().min(1),
|
|
@@ -22819,7 +23003,11 @@ var FindingsTimeseriesPoint = external_exports.object({
|
|
|
22819
23003
|
timestamp: external_exports.iso.date(),
|
|
22820
23004
|
critical: external_exports.number().int().nonnegative(),
|
|
22821
23005
|
high: external_exports.number().int().nonnegative(),
|
|
22822
|
-
medium: external_exports.number().int().nonnegative()
|
|
23006
|
+
medium: external_exports.number().int().nonnegative(),
|
|
23007
|
+
// Optional and additive, so a producer written against the earlier
|
|
23008
|
+
// three-series contract keeps validating. A consumer plotting it resolves the
|
|
23009
|
+
// absent case itself — the chart point requires a number.
|
|
23010
|
+
low: external_exports.number().int().nonnegative().optional()
|
|
22823
23011
|
}).meta({ id: "FindingsTimeseriesPoint" });
|
|
22824
23012
|
var FindingsTimeseriesResponse = external_exports.object({
|
|
22825
23013
|
range: TimeRange,
|
|
@@ -22845,6 +23033,10 @@ var ResolvedFeedItem = external_exports.object({
|
|
|
22845
23033
|
findingKey: external_exports.string(),
|
|
22846
23034
|
ruleId: external_exports.string(),
|
|
22847
23035
|
severity: Severity,
|
|
23036
|
+
// Repository slug, and the file path RELATIVE to it. The pair is what
|
|
23037
|
+
// identifies the file: a bare path matches the same name in every repo.
|
|
23038
|
+
// Optional and additive; empty when the event carried no repo.
|
|
23039
|
+
repo: external_exports.string().optional(),
|
|
22848
23040
|
path: external_exports.string(),
|
|
22849
23041
|
// ISO-8601 datetime (matches FindingInstance.detectedAt / the rest of the
|
|
22850
23042
|
// findings domain). The reader `.toISOString()`s the DB epoch-ms values.
|
|
@@ -22943,10 +23135,12 @@ var DismissRecommendedActionResponse = external_exports.object({ id: external_ex
|
|
|
22943
23135
|
var RecommendedActionIdParam = external_exports.object({ id: external_exports.string() });
|
|
22944
23136
|
|
|
22945
23137
|
// ../../packages/schema/src/zod/settings-action.ts
|
|
23138
|
+
var HistorySyncConsentChoice = external_exports.enum(["granted", "revoked", "unchanged"]).meta({ id: "HistorySyncConsentChoice" });
|
|
23139
|
+
var ModelJudgeConsentChoice = external_exports.enum(["granted", "revoked", "unchanged"]).meta({ id: "ModelJudgeConsentChoice" });
|
|
22946
23140
|
var SaveSettingsInput = external_exports.object({
|
|
22947
23141
|
historicalAccess: external_exports.string(),
|
|
22948
|
-
modelJudgeConsent:
|
|
22949
|
-
historySyncConsent:
|
|
23142
|
+
modelJudgeConsent: ModelJudgeConsentChoice,
|
|
23143
|
+
historySyncConsent: HistorySyncConsentChoice,
|
|
22950
23144
|
vaultConsent: external_exports.string(),
|
|
22951
23145
|
vaultInlineReveal: external_exports.string()
|
|
22952
23146
|
});
|
|
@@ -23202,8 +23396,8 @@ function readControlPlaneCredentialFile(settingsDir2, connection) {
|
|
|
23202
23396
|
}
|
|
23203
23397
|
|
|
23204
23398
|
// ../../packages/persistence/src/database.ts
|
|
23205
|
-
import { randomUUID as
|
|
23206
|
-
import { join as
|
|
23399
|
+
import { randomUUID as randomUUID11 } from "crypto";
|
|
23400
|
+
import { dirname as dirname2, join as join7, sep } from "path";
|
|
23207
23401
|
import { DatabaseSync } from "node:sqlite";
|
|
23208
23402
|
|
|
23209
23403
|
// ../../packages/persistence/src/ids.ts
|
|
@@ -23230,6 +23424,20 @@ function parseJsonObject(s) {
|
|
|
23230
23424
|
|
|
23231
23425
|
// ../../packages/persistence/src/repositories/activity.ts
|
|
23232
23426
|
var LIVE_ACTIVITY_WINDOW_MS = 30 * 6e4;
|
|
23427
|
+
var DB_EVENT_TYPE_TO_KIND = {
|
|
23428
|
+
session: "session",
|
|
23429
|
+
prompt: "prompt",
|
|
23430
|
+
response: "response",
|
|
23431
|
+
tool_call: "tool",
|
|
23432
|
+
hook: "hook",
|
|
23433
|
+
detection: "detection",
|
|
23434
|
+
share: "share",
|
|
23435
|
+
permission: "permission",
|
|
23436
|
+
commit: "commit",
|
|
23437
|
+
error: "error",
|
|
23438
|
+
active: "active"
|
|
23439
|
+
};
|
|
23440
|
+
var TIMELINE_EVENT_TYPES = Object.keys(DB_EVENT_TYPE_TO_KIND).map((kind) => `'${kind}'`).join(", ");
|
|
23233
23441
|
var DEFAULT_HARNESS = HARNESS.ClaudeCode;
|
|
23234
23442
|
|
|
23235
23443
|
// ../../packages/persistence/src/repositories/exceptions.ts
|
|
@@ -23243,107 +23451,84 @@ var ACTIVE_REVEAL_GRANT_PREDICATE = `capability = 'reveal_to_model'
|
|
|
23243
23451
|
AND conditions IS NULL
|
|
23244
23452
|
AND ${ACTIVE_PREDICATE}`;
|
|
23245
23453
|
|
|
23454
|
+
// ../../packages/persistence/src/repositories/resolution-sql.ts
|
|
23455
|
+
function latestResolutionColumnSql(column, findingsAlias) {
|
|
23456
|
+
return `(
|
|
23457
|
+
SELECT fr.${column} FROM finding_resolution fr
|
|
23458
|
+
WHERE fr.finding_key = ${findingsAlias}.finding_key
|
|
23459
|
+
ORDER BY fr.created_at DESC, fr.rowid DESC
|
|
23460
|
+
LIMIT 1
|
|
23461
|
+
)`;
|
|
23462
|
+
}
|
|
23463
|
+
function latestResolutionStatusSql(findingsAlias) {
|
|
23464
|
+
return latestResolutionColumnSql("status", findingsAlias);
|
|
23465
|
+
}
|
|
23466
|
+
|
|
23467
|
+
// ../../packages/persistence/src/repositories/findings.ts
|
|
23468
|
+
var FINDING_ROW_COLUMNS_SQL = `f.id AS id, d.rule_id AS rule_id, d.category AS category,
|
|
23469
|
+
d.severity AS severity, f.masked_match AS masked_match,
|
|
23470
|
+
f.action_taken AS action_taken, f.confidence AS confidence,
|
|
23471
|
+
e.started_at AS occurred_at,
|
|
23472
|
+
e.source_tool AS source_tool,
|
|
23473
|
+
e.repo AS repo,
|
|
23474
|
+
e.file_path AS file,
|
|
23475
|
+
e.tool_name AS tool_name,
|
|
23476
|
+
f.audit_event_id AS event_id, e.root_session_id AS session_id,
|
|
23477
|
+
e.event_type AS kind, f.finding_key AS finding_key,
|
|
23478
|
+
${latestResolutionStatusSql("f")} AS latest_status`;
|
|
23479
|
+
|
|
23246
23480
|
// ../../packages/persistence/src/repositories/history-sync.ts
|
|
23247
23481
|
var STRUCTURAL_EVENT_TYPES = ["session", "llm_call", "tool_call"];
|
|
23248
23482
|
var TYPE_LIST = STRUCTURAL_EVENT_TYPES.map((t) => `'${t}'`).join(", ");
|
|
23483
|
+
var OUTBOX_CAPTURE_EVENT_TYPES = ["prompt", "response", "tool_use"];
|
|
23484
|
+
var CAPTURE_TYPE_LIST = OUTBOX_CAPTURE_EVENT_TYPES.map((t) => `'${t}'`).join(", ");
|
|
23249
23485
|
|
|
23250
23486
|
// ../../packages/persistence/src/repositories/installed-packs.ts
|
|
23251
|
-
import { createHash as createHash2, randomUUID as
|
|
23252
|
-
|
|
23253
|
-
// ../../packages/persistence/src/repositories/inventory-assets.ts
|
|
23254
|
-
import { randomUUID as randomUUID4 } from "crypto";
|
|
23255
|
-
var VALID_HARNESS_IDS = new Set(HarnessId.options);
|
|
23256
|
-
var HARNESS_LABELS = {
|
|
23257
|
-
[HARNESS.ClaudeCode]: "Claude Code",
|
|
23258
|
-
[HARNESS.Cursor]: "Cursor",
|
|
23259
|
-
[HARNESS.Codex]: "Codex",
|
|
23260
|
-
[HARNESS.Antigravity]: "Antigravity"
|
|
23261
|
-
};
|
|
23262
|
-
var HARNESS_LIVENESS_WINDOW_MS = 30 * 24 * 60 * 60 * 1e3;
|
|
23263
|
-
var stripSeparators = (value) => value.toLowerCase().replace(/[\s-]/g, "");
|
|
23264
|
-
var TITLE_NEEDLES = {
|
|
23265
|
-
ClaudeCode: stripSeparators(SOURCE_TOOL.ClaudeCode),
|
|
23266
|
-
Cursor: stripSeparators(SOURCE_TOOL.Cursor),
|
|
23267
|
-
Codex: stripSeparators(SOURCE_TOOL.Codex),
|
|
23268
|
-
Antigravity: stripSeparators(SOURCE_TOOL.Antigravity)
|
|
23269
|
-
};
|
|
23270
|
-
|
|
23271
|
-
// ../../packages/persistence/src/repositories/policies.ts
|
|
23272
|
-
import { randomUUID as randomUUID5 } from "crypto";
|
|
23273
|
-
|
|
23274
|
-
// ../../packages/persistence/src/repositories/project-files.ts
|
|
23275
|
-
import { randomUUID as randomUUID6 } from "crypto";
|
|
23276
|
-
|
|
23277
|
-
// ../../packages/persistence/src/repositories/resolutions.ts
|
|
23278
|
-
import { randomUUID as randomUUID7 } from "crypto";
|
|
23279
|
-
|
|
23280
|
-
// ../../packages/persistence/src/repositories/secret-vault.ts
|
|
23281
|
-
import { randomUUID as randomUUID8 } from "crypto";
|
|
23282
|
-
|
|
23283
|
-
// ../../packages/persistence/src/repositories/security.ts
|
|
23284
|
-
var SCAN_COVERAGE = {
|
|
23285
|
-
[HARNESS.Antigravity]: { coverage: 60, supported: true },
|
|
23286
|
-
[HARNESS.Api]: { coverage: 0, supported: false },
|
|
23287
|
-
[HARNESS.ChatGpt]: { coverage: 40, supported: true },
|
|
23288
|
-
[HARNESS.ClaudeAi]: { coverage: 40, supported: true },
|
|
23289
|
-
[HARNESS.ClaudeCode]: { coverage: 100, supported: true },
|
|
23290
|
-
[HARNESS.Codex]: { coverage: 80, supported: true },
|
|
23291
|
-
[HARNESS.Copilot]: { coverage: 0, supported: false },
|
|
23292
|
-
[HARNESS.Cursor]: { coverage: 0, supported: false }
|
|
23293
|
-
};
|
|
23487
|
+
import { createHash as createHash2, randomUUID as randomUUID4 } from "crypto";
|
|
23294
23488
|
|
|
23295
|
-
// ../../packages/persistence/src/
|
|
23296
|
-
import {
|
|
23297
|
-
|
|
23298
|
-
// ../../packages/persistence/src/file-lock.ts
|
|
23299
|
-
import { randomUUID as randomUUID11 } from "crypto";
|
|
23300
|
-
import {
|
|
23301
|
-
closeSync,
|
|
23302
|
-
existsSync as existsSync2,
|
|
23303
|
-
openSync,
|
|
23304
|
-
readFileSync as readFileSync2,
|
|
23305
|
-
rmSync as rmSync5,
|
|
23306
|
-
statSync as statSync3,
|
|
23307
|
-
writeFileSync as writeFileSync2
|
|
23308
|
-
} from "fs";
|
|
23309
|
-
import { hostname as hostname3 } from "os";
|
|
23310
|
-
var PARK = new Int32Array(new SharedArrayBuffer(4));
|
|
23311
|
-
|
|
23312
|
-
// ../../packages/persistence/src/finding-key.ts
|
|
23313
|
-
import { createHash as createHash3 } from "crypto";
|
|
23314
|
-
|
|
23315
|
-
// ../../packages/persistence/src/fingerprint.ts
|
|
23316
|
-
import { createHmac, randomBytes } from "crypto";
|
|
23317
|
-
import { existsSync as existsSync3, readFileSync as readFileSync3 } from "fs";
|
|
23318
|
-
import { join as join5 } from "path";
|
|
23319
|
-
import { DatabaseSync as DatabaseSync2 } from "node:sqlite";
|
|
23320
|
-
|
|
23321
|
-
// ../../packages/persistence/src/history-preview.ts
|
|
23322
|
-
import { existsSync as existsSync4 } from "fs";
|
|
23489
|
+
// ../../packages/persistence/src/policy-floor.ts
|
|
23490
|
+
import { readFileSync as readFileSync5 } from "fs";
|
|
23323
23491
|
import { join as join6 } from "path";
|
|
23324
|
-
import { DatabaseSync as DatabaseSync3 } from "node:sqlite";
|
|
23325
23492
|
|
|
23326
23493
|
// ../../packages/persistence/src/local-layout.ts
|
|
23327
23494
|
import { renameSync as renameSync3 } from "fs";
|
|
23328
23495
|
import { mkdir } from "fs/promises";
|
|
23329
23496
|
import { homedir } from "os";
|
|
23330
|
-
import { join as
|
|
23497
|
+
import { join as join4 } from "path";
|
|
23331
23498
|
function defaultDataDir() {
|
|
23332
|
-
return
|
|
23499
|
+
return join4(homedir(), ".aka");
|
|
23333
23500
|
}
|
|
23334
23501
|
function settingsDir(base = defaultDataDir()) {
|
|
23335
|
-
return
|
|
23502
|
+
return join4(base, "settings");
|
|
23336
23503
|
}
|
|
23337
23504
|
function dataDir(base = defaultDataDir()) {
|
|
23338
|
-
return
|
|
23505
|
+
return join4(base, "data");
|
|
23339
23506
|
}
|
|
23340
23507
|
async function ensureDataDir(dir = defaultDataDir()) {
|
|
23341
23508
|
await mkdir(dir, { recursive: true, mode: DATA_DIR_MODE });
|
|
23342
23509
|
tightenDir(dir);
|
|
23343
23510
|
}
|
|
23344
23511
|
|
|
23345
|
-
// ../../packages/persistence/src/
|
|
23512
|
+
// ../../packages/persistence/src/settings.ts
|
|
23346
23513
|
import { readFileSync as readFileSync4 } from "fs";
|
|
23514
|
+
import { join as join5 } from "path";
|
|
23515
|
+
|
|
23516
|
+
// ../../packages/persistence/src/file-lock.ts
|
|
23517
|
+
import { randomUUID as randomUUID3 } from "crypto";
|
|
23518
|
+
import {
|
|
23519
|
+
closeSync,
|
|
23520
|
+
existsSync as existsSync2,
|
|
23521
|
+
openSync,
|
|
23522
|
+
readFileSync as readFileSync2,
|
|
23523
|
+
rmSync as rmSync5,
|
|
23524
|
+
statSync as statSync3,
|
|
23525
|
+
writeFileSync as writeFileSync2
|
|
23526
|
+
} from "fs";
|
|
23527
|
+
import { hostname as hostname3 } from "os";
|
|
23528
|
+
var PARK = new Int32Array(new SharedArrayBuffer(4));
|
|
23529
|
+
|
|
23530
|
+
// ../../packages/persistence/src/managed-settings.ts
|
|
23531
|
+
import { readFileSync as readFileSync3 } from "fs";
|
|
23347
23532
|
import { posix, win32 } from "path";
|
|
23348
23533
|
function managedSettingsPaths(platform2 = process.platform) {
|
|
23349
23534
|
if (platform2 === "darwin") {
|
|
@@ -23357,11 +23542,12 @@ function managedSettingsPaths(platform2 = process.platform) {
|
|
|
23357
23542
|
}
|
|
23358
23543
|
return [posix.join("/etc", "aka", MANAGED_SETTINGS_FILENAME)];
|
|
23359
23544
|
}
|
|
23360
|
-
|
|
23545
|
+
var testOnlyManagedPaths = null;
|
|
23546
|
+
function readManagedSettings(paths = testOnlyManagedPaths ?? managedSettingsPaths()) {
|
|
23361
23547
|
for (const path of paths) {
|
|
23362
23548
|
let text;
|
|
23363
23549
|
try {
|
|
23364
|
-
text =
|
|
23550
|
+
text = readFileSync3(path, "utf8");
|
|
23365
23551
|
} catch {
|
|
23366
23552
|
continue;
|
|
23367
23553
|
}
|
|
@@ -23391,6 +23577,7 @@ function overlayManagedSettings(settings, managed, now = () => /* @__PURE__ */ n
|
|
|
23391
23577
|
if (values.vaultKeyCustody !== void 0) merged.vaultKeyCustody = values.vaultKeyCustody;
|
|
23392
23578
|
if (values.vaultInlineReveal !== void 0) merged.vaultInlineReveal = values.vaultInlineReveal;
|
|
23393
23579
|
if (values.dataSharesInPlace !== void 0) merged.dataSharesInPlace = values.dataSharesInPlace;
|
|
23580
|
+
if (values.redactFallback !== void 0) merged.redactFallback = values.redactFallback;
|
|
23394
23581
|
if (values.vaultConsent !== void 0) {
|
|
23395
23582
|
merged.vaultConsent = values.vaultConsent ? (
|
|
23396
23583
|
// Keep an existing valid grant so its acknowledgedAt survives; mint one
|
|
@@ -23408,14 +23595,12 @@ function overlayManagedSettings(settings, managed, now = () => /* @__PURE__ */ n
|
|
|
23408
23595
|
}
|
|
23409
23596
|
|
|
23410
23597
|
// ../../packages/persistence/src/settings.ts
|
|
23411
|
-
import { readFileSync as readFileSync5 } from "fs";
|
|
23412
|
-
import { join as join8 } from "path";
|
|
23413
23598
|
var SETTINGS_FILENAME = "settings.json";
|
|
23414
23599
|
function readWorkspaceSettings(base = defaultDataDir()) {
|
|
23415
23600
|
return overlayManagedSettings(readUserSettings(base), readManagedSettings());
|
|
23416
23601
|
}
|
|
23417
23602
|
function readUserSettings(base) {
|
|
23418
|
-
const record2 = readJson(
|
|
23603
|
+
const record2 = readJson(join5(settingsDir(base), SETTINGS_FILENAME));
|
|
23419
23604
|
if (!record2) return defaultWorkspaceSettings();
|
|
23420
23605
|
try {
|
|
23421
23606
|
return WorkspaceSettings.parse(record2);
|
|
@@ -23426,70 +23611,546 @@ function readUserSettings(base) {
|
|
|
23426
23611
|
function readJson(file2) {
|
|
23427
23612
|
let text;
|
|
23428
23613
|
try {
|
|
23429
|
-
text =
|
|
23614
|
+
text = readFileSync4(file2, "utf8");
|
|
23430
23615
|
} catch {
|
|
23431
23616
|
return null;
|
|
23432
23617
|
}
|
|
23433
23618
|
return parseJsonObject(text) ?? null;
|
|
23434
23619
|
}
|
|
23435
23620
|
|
|
23436
|
-
// ../../packages/persistence/src/
|
|
23437
|
-
import {
|
|
23438
|
-
|
|
23621
|
+
// ../../packages/persistence/src/repositories/inventory-assets.ts
|
|
23622
|
+
import { randomUUID as randomUUID5 } from "crypto";
|
|
23623
|
+
var VALID_HARNESS_IDS = new Set(HarnessId.options);
|
|
23624
|
+
var HARNESS_LABELS = {
|
|
23625
|
+
[HARNESS.ClaudeCode]: "Claude Code",
|
|
23626
|
+
[HARNESS.Cursor]: "Cursor",
|
|
23627
|
+
[HARNESS.Codex]: "Codex",
|
|
23628
|
+
[HARNESS.Antigravity]: "Antigravity"
|
|
23629
|
+
};
|
|
23630
|
+
var HARNESS_LIVENESS_WINDOW_MS = 30 * 24 * 60 * 60 * 1e3;
|
|
23631
|
+
var stripSeparators = (value) => value.toLowerCase().replace(/[\s-]/g, "");
|
|
23632
|
+
var TITLE_NEEDLES = {
|
|
23633
|
+
ClaudeCode: stripSeparators(SOURCE_TOOL.ClaudeCode),
|
|
23634
|
+
Cursor: stripSeparators(SOURCE_TOOL.Cursor),
|
|
23635
|
+
Codex: stripSeparators(SOURCE_TOOL.Codex),
|
|
23636
|
+
Antigravity: stripSeparators(SOURCE_TOOL.Antigravity)
|
|
23637
|
+
};
|
|
23439
23638
|
|
|
23440
|
-
// ../../packages/persistence/src/
|
|
23441
|
-
import {
|
|
23442
|
-
createCipheriv,
|
|
23443
|
-
createDecipheriv,
|
|
23444
|
-
createHmac as createHmac2,
|
|
23445
|
-
hkdfSync,
|
|
23446
|
-
timingSafeEqual
|
|
23447
|
-
} from "crypto";
|
|
23639
|
+
// ../../packages/persistence/src/repositories/policies.ts
|
|
23640
|
+
import { randomUUID as randomUUID6 } from "crypto";
|
|
23448
23641
|
|
|
23449
|
-
// ../../packages/persistence/src/
|
|
23450
|
-
import {
|
|
23451
|
-
import { randomBytes as randomBytes2 } from "crypto";
|
|
23452
|
-
import { chmodSync as chmodSync3, readFileSync as readFileSync6, renameSync as renameSync4, rmSync as rmSync6, statSync as statSync5, writeFileSync as writeFileSync3 } from "fs";
|
|
23453
|
-
import { join as join10 } from "path";
|
|
23642
|
+
// ../../packages/persistence/src/repositories/project-files.ts
|
|
23643
|
+
import { randomUUID as randomUUID7 } from "crypto";
|
|
23454
23644
|
|
|
23455
|
-
// ../../packages/persistence/src/
|
|
23456
|
-
import {
|
|
23645
|
+
// ../../packages/persistence/src/repositories/resolutions.ts
|
|
23646
|
+
import { randomUUID as randomUUID8 } from "crypto";
|
|
23457
23647
|
|
|
23458
|
-
// ../../packages/persistence/src/
|
|
23459
|
-
import {
|
|
23460
|
-
import { join as join11 } from "path";
|
|
23648
|
+
// ../../packages/persistence/src/repositories/secret-vault.ts
|
|
23649
|
+
import { randomUUID as randomUUID9 } from "crypto";
|
|
23461
23650
|
|
|
23462
|
-
// ../../packages/
|
|
23463
|
-
|
|
23464
|
-
|
|
23465
|
-
|
|
23466
|
-
|
|
23467
|
-
|
|
23651
|
+
// ../../packages/persistence/src/repositories/security.ts
|
|
23652
|
+
var SCAN_COVERAGE = {
|
|
23653
|
+
[HARNESS.Antigravity]: { coverage: 60, supported: true },
|
|
23654
|
+
[HARNESS.Api]: { coverage: 0, supported: false },
|
|
23655
|
+
[HARNESS.ChatGpt]: { coverage: 40, supported: true },
|
|
23656
|
+
[HARNESS.ClaudeAi]: { coverage: 40, supported: true },
|
|
23657
|
+
[HARNESS.ClaudeCode]: { coverage: 100, supported: true },
|
|
23658
|
+
[HARNESS.Codex]: { coverage: 80, supported: true },
|
|
23659
|
+
[HARNESS.Copilot]: { coverage: 0, supported: false },
|
|
23660
|
+
[HARNESS.Cursor]: { coverage: 0, supported: false }
|
|
23661
|
+
};
|
|
23662
|
+
|
|
23663
|
+
// ../../packages/persistence/src/repositories/shares.ts
|
|
23664
|
+
import { randomUUID as randomUUID10 } from "crypto";
|
|
23665
|
+
|
|
23666
|
+
// ../../packages/persistence/src/database.ts
|
|
23667
|
+
var CAPTURE_GRAIN = new Set(EventKind.options);
|
|
23668
|
+
|
|
23669
|
+
// ../../packages/persistence/src/egress-wire.ts
|
|
23670
|
+
import { createHash as createHash3 } from "crypto";
|
|
23671
|
+
|
|
23672
|
+
// ../../packages/persistence/src/finding-key.ts
|
|
23673
|
+
import { createHash as createHash4 } from "crypto";
|
|
23674
|
+
|
|
23675
|
+
// ../../packages/persistence/src/fingerprint.ts
|
|
23676
|
+
import { createHmac, randomBytes } from "crypto";
|
|
23677
|
+
import { existsSync as existsSync3, readFileSync as readFileSync6 } from "fs";
|
|
23678
|
+
import { join as join8 } from "path";
|
|
23679
|
+
import { DatabaseSync as DatabaseSync2 } from "node:sqlite";
|
|
23680
|
+
|
|
23681
|
+
// ../../packages/persistence/src/history-backfill.ts
|
|
23682
|
+
import { existsSync as existsSync4 } from "fs";
|
|
23683
|
+
import { join as join9 } from "path";
|
|
23684
|
+
|
|
23685
|
+
// ../../packages/persistence/src/history-preview.ts
|
|
23686
|
+
import { existsSync as existsSync5 } from "fs";
|
|
23687
|
+
import { join as join10 } from "path";
|
|
23688
|
+
import { DatabaseSync as DatabaseSync3 } from "node:sqlite";
|
|
23689
|
+
|
|
23690
|
+
// ../../packages/persistence/src/store-symlinks.ts
|
|
23691
|
+
import { existsSync as existsSync6, lstatSync as lstatSync3, readlinkSync, realpathSync, statSync as statSync4 } from "fs";
|
|
23692
|
+
import { dirname as dirname3, join as join11, resolve } from "path";
|
|
23693
|
+
|
|
23694
|
+
// ../../packages/persistence/src/vault/crypto.ts
|
|
23695
|
+
import {
|
|
23696
|
+
createCipheriv,
|
|
23697
|
+
createDecipheriv,
|
|
23698
|
+
createHmac as createHmac2,
|
|
23699
|
+
hkdfSync,
|
|
23700
|
+
timingSafeEqual
|
|
23701
|
+
} from "crypto";
|
|
23702
|
+
|
|
23703
|
+
// ../../packages/persistence/src/vault/key-provider.ts
|
|
23704
|
+
import { execFileSync } from "child_process";
|
|
23705
|
+
import { randomBytes as randomBytes2 } from "crypto";
|
|
23706
|
+
import { chmodSync as chmodSync3, readFileSync as readFileSync7, renameSync as renameSync4, rmSync as rmSync6, statSync as statSync5, writeFileSync as writeFileSync3 } from "fs";
|
|
23707
|
+
import { join as join12 } from "path";
|
|
23708
|
+
|
|
23709
|
+
// ../../packages/persistence/src/vault/vault.ts
|
|
23710
|
+
import { randomBytes as randomBytes3, randomUUID as randomUUID12 } from "crypto";
|
|
23711
|
+
|
|
23712
|
+
// ../../packages/persistence/src/warn-era-cap.ts
|
|
23713
|
+
import { existsSync as existsSync7, writeFileSync as writeFileSync4 } from "fs";
|
|
23714
|
+
import { join as join13 } from "path";
|
|
23715
|
+
|
|
23716
|
+
// ../../packages/remote/src/http.ts
|
|
23717
|
+
import { request as httpRequest } from "http";
|
|
23718
|
+
import { request as httpsRequest } from "https";
|
|
23719
|
+
var DEFAULT_TIMEOUT_MS = 1e4;
|
|
23720
|
+
var MAX_RESPONSE_BYTES = 8 * 1024 * 1024;
|
|
23721
|
+
var RemoteRequestError = class extends Error {
|
|
23722
|
+
constructor(status) {
|
|
23723
|
+
super(`control-plane request failed with status ${String(status)}`);
|
|
23724
|
+
this.status = status;
|
|
23725
|
+
this.name = "RemoteRequestError";
|
|
23726
|
+
}
|
|
23727
|
+
status;
|
|
23728
|
+
};
|
|
23729
|
+
var RemoteRouteAbsent = class extends Error {
|
|
23730
|
+
constructor(route) {
|
|
23731
|
+
super(`control plane does not serve ${route}`);
|
|
23732
|
+
this.route = route;
|
|
23733
|
+
this.name = "RemoteRouteAbsent";
|
|
23734
|
+
}
|
|
23735
|
+
route;
|
|
23736
|
+
};
|
|
23737
|
+
var RemoteRequestInvalid = class extends Error {
|
|
23738
|
+
constructor(route, cause) {
|
|
23739
|
+
super(`refusing to send a malformed body to ${route}`);
|
|
23740
|
+
this.cause = cause;
|
|
23741
|
+
this.name = "RemoteRequestInvalid";
|
|
23742
|
+
}
|
|
23743
|
+
cause;
|
|
23744
|
+
};
|
|
23745
|
+
var RemoteResponseInvalid = class extends Error {
|
|
23746
|
+
constructor(route, detail) {
|
|
23747
|
+
super(`control plane answered ${route} with ${detail}`);
|
|
23748
|
+
this.name = "RemoteResponseInvalid";
|
|
23749
|
+
}
|
|
23750
|
+
};
|
|
23751
|
+
var RemoteTransportError = class extends Error {
|
|
23752
|
+
/**
|
|
23753
|
+
* The status the peer sent, when headers arrived and only the BODY was
|
|
23754
|
+
* refused.
|
|
23755
|
+
*
|
|
23756
|
+
* Undefined for the ordinary case this class was written for — no answer at
|
|
23757
|
+
* all. It exists because two paths reject after a status has already been
|
|
23758
|
+
* delivered: an oversized body and an aborted response. Discarding it there
|
|
23759
|
+
* reported a deployment answering 401 with a verbose body as a network
|
|
23760
|
+
* outage, which sends the reader to look at their network instead of their
|
|
23761
|
+
* credential.
|
|
23762
|
+
*/
|
|
23763
|
+
constructor(reason, status) {
|
|
23764
|
+
super(`control-plane request did not complete: ${reason}`);
|
|
23765
|
+
this.status = status;
|
|
23766
|
+
this.name = "RemoteTransportError";
|
|
23767
|
+
}
|
|
23768
|
+
status;
|
|
23769
|
+
};
|
|
23770
|
+
async function send(options) {
|
|
23771
|
+
const url2 = new URL(options.url);
|
|
23772
|
+
const timeoutMs = options.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
23773
|
+
const send_ = url2.protocol === "http:" ? httpRequest : httpsRequest;
|
|
23774
|
+
const requestOptions = {
|
|
23775
|
+
method: options.method,
|
|
23776
|
+
headers: {
|
|
23777
|
+
// CALLER HEADERS FIRST, so this module's own are not overridable. Spread
|
|
23778
|
+
// last they win, and two of the values below are ones no caller may
|
|
23779
|
+
// replace: `x-api-key` is the credential, and `content-length` is the
|
|
23780
|
+
// byte count that stops a multi-byte body being truncated by the
|
|
23781
|
+
// receiver. `SendOptions.headers` is a free-form record on an exported
|
|
23782
|
+
// function, so "no caller does that today" is not the guarantee to rely
|
|
23783
|
+
// on. The one header any caller actually passes — `if-none-match` on the
|
|
23784
|
+
// conditional GET — is untouched by this order.
|
|
23785
|
+
...options.headers,
|
|
23786
|
+
// The credential. One header, matching what the deployment authenticates
|
|
23787
|
+
// on; a second copy in an `Authorization` header would be one more place
|
|
23788
|
+
// it can be logged by an intermediary for no gain.
|
|
23789
|
+
//
|
|
23790
|
+
// Spread conditionally rather than assigned as `undefined`: Node's header
|
|
23791
|
+
// handling and `content-length` bookkeeping treat a present-but-undefined
|
|
23792
|
+
// key differently from an absent one, and "the header is not there" is
|
|
23793
|
+
// the property the attach flow needs.
|
|
23794
|
+
...options.apiKey === void 0 ? {} : { "x-api-key": options.apiKey },
|
|
23795
|
+
accept: "application/json",
|
|
23796
|
+
...options.body === void 0 ? {} : {
|
|
23797
|
+
"content-type": "application/json",
|
|
23798
|
+
// Byte length, not string length: a multi-byte body sent with a
|
|
23799
|
+
// character count is truncated by the receiver.
|
|
23800
|
+
"content-length": String(Buffer.byteLength(options.body))
|
|
23801
|
+
}
|
|
23802
|
+
}
|
|
23803
|
+
};
|
|
23804
|
+
return new Promise((resolve2, reject) => {
|
|
23805
|
+
let settled = false;
|
|
23806
|
+
const fail = (reason, status) => {
|
|
23807
|
+
if (settled) return;
|
|
23808
|
+
settled = true;
|
|
23809
|
+
reject(new RemoteTransportError(reason, status));
|
|
23810
|
+
};
|
|
23811
|
+
const req = send_(url2, requestOptions, (res) => {
|
|
23812
|
+
const chunks = [];
|
|
23813
|
+
let size = 0;
|
|
23814
|
+
res.on("data", (chunk) => {
|
|
23815
|
+
size += chunk.length;
|
|
23816
|
+
if (size > MAX_RESPONSE_BYTES) {
|
|
23817
|
+
fail(`response exceeded ${String(MAX_RESPONSE_BYTES)} bytes`, res.statusCode);
|
|
23818
|
+
res.destroy();
|
|
23819
|
+
req.destroy();
|
|
23820
|
+
return;
|
|
23821
|
+
}
|
|
23822
|
+
chunks.push(chunk);
|
|
23823
|
+
});
|
|
23824
|
+
res.on("aborted", () => {
|
|
23825
|
+
fail("the response was aborted", res.statusCode);
|
|
23826
|
+
});
|
|
23827
|
+
res.on("end", () => {
|
|
23828
|
+
if (settled) return;
|
|
23829
|
+
settled = true;
|
|
23830
|
+
resolve2({
|
|
23831
|
+
status: res.statusCode ?? 0,
|
|
23832
|
+
headers: res.headers,
|
|
23833
|
+
body: Buffer.concat(chunks).toString("utf8")
|
|
23834
|
+
});
|
|
23835
|
+
});
|
|
23836
|
+
});
|
|
23837
|
+
const deadline = setTimeout(() => {
|
|
23838
|
+
fail(`no response within ${String(timeoutMs)}ms`);
|
|
23839
|
+
req.destroy();
|
|
23840
|
+
}, timeoutMs);
|
|
23841
|
+
deadline.unref();
|
|
23842
|
+
req.on("upgrade", (_res, socket) => {
|
|
23843
|
+
fail("the deployment answered with a protocol upgrade");
|
|
23844
|
+
socket.destroy();
|
|
23845
|
+
});
|
|
23846
|
+
req.on("close", () => {
|
|
23847
|
+
fail("the connection closed before a response was read");
|
|
23848
|
+
clearTimeout(deadline);
|
|
23849
|
+
});
|
|
23850
|
+
req.on("error", (err) => {
|
|
23851
|
+
fail(err.message);
|
|
23852
|
+
});
|
|
23853
|
+
if (options.body !== void 0) req.write(options.body);
|
|
23854
|
+
req.end();
|
|
23855
|
+
});
|
|
23468
23856
|
}
|
|
23469
|
-
|
|
23470
|
-
|
|
23857
|
+
|
|
23858
|
+
// ../../packages/remote/src/client.ts
|
|
23859
|
+
var ROUTES = {
|
|
23860
|
+
events: "/v1/events",
|
|
23861
|
+
auditEvents: "/v1/audit-events",
|
|
23862
|
+
auditEventsBatch: "/v1/audit-events/batch",
|
|
23863
|
+
inventory: "/v1/inventory",
|
|
23864
|
+
storePosture: "/v1/store-posture",
|
|
23865
|
+
policyBundle: "/v1/policy-bundle",
|
|
23866
|
+
whoami: "/v1/plugin/whoami",
|
|
23867
|
+
shares: "/v1/shares",
|
|
23868
|
+
commands: "/v1/plugin/commands"
|
|
23869
|
+
};
|
|
23870
|
+
function ackRoute(id) {
|
|
23871
|
+
return `${ROUTES.commands}/${encodeURIComponent(id)}/ack`;
|
|
23872
|
+
}
|
|
23873
|
+
function headerValue(response, name) {
|
|
23874
|
+
const raw = response.headers[name];
|
|
23875
|
+
if (raw === void 0) return void 0;
|
|
23876
|
+
return Array.isArray(raw) ? raw[0] : raw;
|
|
23877
|
+
}
|
|
23878
|
+
function okBody(response) {
|
|
23879
|
+
if (response.status < 200 || response.status >= 300) {
|
|
23880
|
+
throw new RemoteRequestError(response.status);
|
|
23881
|
+
}
|
|
23882
|
+
return response.body;
|
|
23883
|
+
}
|
|
23884
|
+
function parsed(schema, body, route) {
|
|
23885
|
+
let json2;
|
|
23886
|
+
try {
|
|
23887
|
+
json2 = JSON.parse(body);
|
|
23888
|
+
} catch {
|
|
23889
|
+
throw new RemoteResponseInvalid(route, "a body that is not JSON");
|
|
23890
|
+
}
|
|
23891
|
+
const result = schema.safeParse(json2);
|
|
23892
|
+
if (!result.success) {
|
|
23893
|
+
throw new RemoteResponseInvalid(route, "a body this client cannot read");
|
|
23894
|
+
}
|
|
23895
|
+
return result.data;
|
|
23896
|
+
}
|
|
23897
|
+
function withoutTrailingSlashes(endpoint) {
|
|
23898
|
+
let end = endpoint.length;
|
|
23899
|
+
while (end > 0 && endpoint.charCodeAt(end - 1) === SLASH) end -= 1;
|
|
23900
|
+
return endpoint.slice(0, end);
|
|
23901
|
+
}
|
|
23902
|
+
var SLASH = "/".charCodeAt(0);
|
|
23903
|
+
function createRemoteClient(options) {
|
|
23904
|
+
const base = withoutTrailingSlashes(options.endpoint);
|
|
23905
|
+
const url2 = (route) => `${base}${route}`;
|
|
23906
|
+
const common = { apiKey: options.apiKey, timeoutMs: options.timeoutMs };
|
|
23907
|
+
const sendOne = async (event) => {
|
|
23908
|
+
const validated = RecordAuditEventRequest.safeParse(event);
|
|
23909
|
+
if (!validated.success) throw new RemoteRequestInvalid(ROUTES.auditEvents, validated.error);
|
|
23910
|
+
const response = await send({
|
|
23911
|
+
...common,
|
|
23912
|
+
method: "POST",
|
|
23913
|
+
url: url2(ROUTES.auditEvents),
|
|
23914
|
+
body: JSON.stringify(validated.data)
|
|
23915
|
+
});
|
|
23916
|
+
okBody(response);
|
|
23917
|
+
};
|
|
23918
|
+
return {
|
|
23919
|
+
async ingestEvents(batch) {
|
|
23920
|
+
const response = await send({
|
|
23921
|
+
...common,
|
|
23922
|
+
method: "POST",
|
|
23923
|
+
url: url2(ROUTES.events),
|
|
23924
|
+
body: JSON.stringify(batch)
|
|
23925
|
+
});
|
|
23926
|
+
return parsed(IngestAck, okBody(response), ROUTES.events);
|
|
23927
|
+
},
|
|
23928
|
+
async ingestInventory(context) {
|
|
23929
|
+
const response = await send({
|
|
23930
|
+
...common,
|
|
23931
|
+
method: "POST",
|
|
23932
|
+
url: url2(ROUTES.inventory),
|
|
23933
|
+
body: JSON.stringify(context)
|
|
23934
|
+
});
|
|
23935
|
+
return parsed(ResolvedInventory, okBody(response), ROUTES.inventory);
|
|
23936
|
+
},
|
|
23937
|
+
async recordAuditEvent(event) {
|
|
23938
|
+
await sendOne(event);
|
|
23939
|
+
},
|
|
23940
|
+
async recordAuditEvents(events, opts) {
|
|
23941
|
+
const validated = RecordAuditEventBatch.safeParse({ events });
|
|
23942
|
+
if (!validated.success) {
|
|
23943
|
+
throw new RemoteRequestInvalid(ROUTES.auditEventsBatch, validated.error);
|
|
23944
|
+
}
|
|
23945
|
+
const response = await send({
|
|
23946
|
+
...common,
|
|
23947
|
+
method: "POST",
|
|
23948
|
+
url: url2(ROUTES.auditEventsBatch),
|
|
23949
|
+
body: JSON.stringify(validated.data)
|
|
23950
|
+
});
|
|
23951
|
+
if (response.status === 404) {
|
|
23952
|
+
if (opts?.fallbackToSingleEvents !== true) {
|
|
23953
|
+
throw new RemoteRouteAbsent(ROUTES.auditEventsBatch);
|
|
23954
|
+
}
|
|
23955
|
+
for (const event of validated.data.events) await sendOne(event);
|
|
23956
|
+
return { accepted: validated.data.events.length };
|
|
23957
|
+
}
|
|
23958
|
+
return parsed(AuditEventBatchAck, okBody(response), ROUTES.auditEventsBatch);
|
|
23959
|
+
},
|
|
23960
|
+
async reportStorePosture(snapshot) {
|
|
23961
|
+
const response = await send({
|
|
23962
|
+
...common,
|
|
23963
|
+
method: "POST",
|
|
23964
|
+
url: url2(ROUTES.storePosture),
|
|
23965
|
+
body: JSON.stringify(snapshot)
|
|
23966
|
+
});
|
|
23967
|
+
okBody(response);
|
|
23968
|
+
},
|
|
23969
|
+
async getPolicyBundle(etag) {
|
|
23970
|
+
const response = await send({
|
|
23971
|
+
...common,
|
|
23972
|
+
method: "GET",
|
|
23973
|
+
url: url2(ROUTES.policyBundle),
|
|
23974
|
+
...etag === void 0 ? {} : { headers: { "if-none-match": etag } }
|
|
23975
|
+
});
|
|
23976
|
+
if (response.status === 304) {
|
|
23977
|
+
return { changed: false, etag: headerValue(response, "etag") ?? etag };
|
|
23978
|
+
}
|
|
23979
|
+
const bundle = parsed(PolicyBundle, okBody(response), ROUTES.policyBundle);
|
|
23980
|
+
return { changed: true, bundle, etag: headerValue(response, "etag") };
|
|
23981
|
+
},
|
|
23982
|
+
async whoami() {
|
|
23983
|
+
const response = await send({ ...common, method: "GET", url: url2(ROUTES.whoami) });
|
|
23984
|
+
return parsed(PluginWhoami, okBody(response), ROUTES.whoami);
|
|
23985
|
+
},
|
|
23986
|
+
async recordProjectEgress(request) {
|
|
23987
|
+
const validated = EgressIngestRequest.safeParse(request);
|
|
23988
|
+
if (!validated.success) throw new RemoteRequestInvalid(ROUTES.shares, validated.error);
|
|
23989
|
+
const response = await send({
|
|
23990
|
+
...common,
|
|
23991
|
+
method: "POST",
|
|
23992
|
+
url: url2(ROUTES.shares),
|
|
23993
|
+
body: JSON.stringify(validated.data)
|
|
23994
|
+
});
|
|
23995
|
+
if (response.status === 404) throw new RemoteRouteAbsent(ROUTES.shares);
|
|
23996
|
+
okBody(response);
|
|
23997
|
+
},
|
|
23998
|
+
async pollCommand() {
|
|
23999
|
+
const response = await send({ ...common, method: "GET", url: url2(ROUTES.commands) });
|
|
24000
|
+
if (response.status === 404) return null;
|
|
24001
|
+
return parsed(DeviceCommandPollResponse, okBody(response), ROUTES.commands).command;
|
|
24002
|
+
},
|
|
24003
|
+
async ackCommand(id, body) {
|
|
24004
|
+
const validated = DeviceCommandAckBody.safeParse(body);
|
|
24005
|
+
const route = ackRoute(id);
|
|
24006
|
+
if (!validated.success) throw new RemoteRequestInvalid(route, validated.error);
|
|
24007
|
+
const response = await send({
|
|
24008
|
+
...common,
|
|
24009
|
+
method: "POST",
|
|
24010
|
+
url: url2(route),
|
|
24011
|
+
body: JSON.stringify(validated.data)
|
|
24012
|
+
});
|
|
24013
|
+
okBody(response);
|
|
24014
|
+
}
|
|
24015
|
+
};
|
|
24016
|
+
}
|
|
24017
|
+
|
|
24018
|
+
// ../../packages/remote/src/failure-kind.ts
|
|
24019
|
+
function statusOf(err) {
|
|
24020
|
+
if (typeof err !== "object" || err === null || !("status" in err)) return null;
|
|
24021
|
+
const { status } = err;
|
|
24022
|
+
if (typeof status !== "number" || !Number.isInteger(status)) return null;
|
|
24023
|
+
return status >= 100 && status <= 599 ? status : null;
|
|
24024
|
+
}
|
|
24025
|
+
function nameOf(err) {
|
|
24026
|
+
if (typeof err !== "object" || err === null || !("name" in err)) return null;
|
|
24027
|
+
return typeof err.name === "string" ? err.name : null;
|
|
24028
|
+
}
|
|
24029
|
+
function classifyRemoteFailure(err) {
|
|
24030
|
+
switch (nameOf(err)) {
|
|
24031
|
+
case "RemoteRouteAbsent":
|
|
24032
|
+
return "route-absent";
|
|
24033
|
+
case "RemoteRequestInvalid":
|
|
24034
|
+
return "invalid-request";
|
|
24035
|
+
case "RemoteResponseInvalid":
|
|
24036
|
+
return "rejected";
|
|
24037
|
+
default:
|
|
24038
|
+
break;
|
|
24039
|
+
}
|
|
24040
|
+
const status = statusOf(err);
|
|
24041
|
+
if (status === null) return "unreachable";
|
|
24042
|
+
switch (status) {
|
|
23471
24043
|
case 401:
|
|
23472
24044
|
return "unauthorized";
|
|
23473
24045
|
case 403:
|
|
23474
24046
|
return "forbidden";
|
|
24047
|
+
case 429:
|
|
24048
|
+
return "unreachable";
|
|
24049
|
+
case 404:
|
|
24050
|
+
return "unreachable";
|
|
24051
|
+
default:
|
|
24052
|
+
return status >= 400 && status <= 499 ? "rejected" : "unreachable";
|
|
24053
|
+
}
|
|
24054
|
+
}
|
|
24055
|
+
|
|
24056
|
+
// ../../packages/plugin-runtime/src/attached/failure.ts
|
|
24057
|
+
function classifyFailure(err) {
|
|
24058
|
+
switch (classifyRemoteFailure(err)) {
|
|
24059
|
+
case "unauthorized":
|
|
24060
|
+
return "unauthorized";
|
|
24061
|
+
case "forbidden":
|
|
24062
|
+
return "forbidden";
|
|
23475
24063
|
default:
|
|
23476
24064
|
return "unreachable";
|
|
23477
24065
|
}
|
|
23478
24066
|
}
|
|
23479
24067
|
|
|
24068
|
+
// ../../packages/plugin-runtime/src/attached/with-timeout.ts
|
|
24069
|
+
function withTimeout(promise2, ms) {
|
|
24070
|
+
let timer;
|
|
24071
|
+
const timeout = new Promise((_, reject) => {
|
|
24072
|
+
timer = setTimeout(() => {
|
|
24073
|
+
reject(new Error("attached gateway request timed out"));
|
|
24074
|
+
}, ms);
|
|
24075
|
+
});
|
|
24076
|
+
promise2.catch(() => void 0);
|
|
24077
|
+
return Promise.race([promise2, timeout]).finally(() => {
|
|
24078
|
+
clearTimeout(timer);
|
|
24079
|
+
});
|
|
24080
|
+
}
|
|
24081
|
+
|
|
24082
|
+
// ../../packages/plugin-runtime/src/attached/command-sync.ts
|
|
24083
|
+
var COMMAND_REQUEST_TIMEOUT_MS = 3e4;
|
|
24084
|
+
var SCAN_THREW = "scan_failed";
|
|
24085
|
+
var SCAN_FOUND_NOTHING = "no_projects";
|
|
24086
|
+
var COMMAND_EXPIRED = "expired";
|
|
24087
|
+
function hasExpired(expiresAt, atMs) {
|
|
24088
|
+
const deadlineMs = Date.parse(expiresAt);
|
|
24089
|
+
return Number.isFinite(deadlineMs) && deadlineMs <= atMs;
|
|
24090
|
+
}
|
|
24091
|
+
var SERVICE = {
|
|
24092
|
+
shares_rescan: (scan2) => scan2()
|
|
24093
|
+
};
|
|
24094
|
+
async function runCommandSync(deps) {
|
|
24095
|
+
if (deps.scan === void 0) return null;
|
|
24096
|
+
const settings = readWorkspaceSettings(deps.base);
|
|
24097
|
+
const connection = isAttached(settings) ? settings.controlPlane : void 0;
|
|
24098
|
+
const state = connection === void 0 ? void 0 : readControlPlaneCredentialFile(deps.settingsDir, connection);
|
|
24099
|
+
if (connection === void 0 || !state?.usable) return null;
|
|
24100
|
+
const client = createRemoteClient({
|
|
24101
|
+
endpoint: connection.endpoint,
|
|
24102
|
+
apiKey: state.credential.apiKey,
|
|
24103
|
+
timeoutMs: COMMAND_REQUEST_TIMEOUT_MS
|
|
24104
|
+
});
|
|
24105
|
+
let command;
|
|
24106
|
+
try {
|
|
24107
|
+
command = await withTimeout(client.pollCommand(), COMMAND_REQUEST_TIMEOUT_MS);
|
|
24108
|
+
} catch (err) {
|
|
24109
|
+
const failure = classifyFailure(err);
|
|
24110
|
+
return failure === "unreachable" ? "unreachable" : failure;
|
|
24111
|
+
}
|
|
24112
|
+
if (command === null) return "none";
|
|
24113
|
+
let projects = 0;
|
|
24114
|
+
let reason = null;
|
|
24115
|
+
if (hasExpired(command.expiresAt, (deps.now ?? Date.now)())) {
|
|
24116
|
+
reason = COMMAND_EXPIRED;
|
|
24117
|
+
} else {
|
|
24118
|
+
try {
|
|
24119
|
+
projects = (await SERVICE[command.kind](deps.scan)).projects;
|
|
24120
|
+
if (projects === 0) reason = SCAN_FOUND_NOTHING;
|
|
24121
|
+
} catch {
|
|
24122
|
+
reason = SCAN_THREW;
|
|
24123
|
+
}
|
|
24124
|
+
}
|
|
24125
|
+
try {
|
|
24126
|
+
await withTimeout(
|
|
24127
|
+
reason === null ? client.ackCommand(command.id, { outcome: "reported", projectsScanned: projects }) : client.ackCommand(command.id, {
|
|
24128
|
+
outcome: "failed",
|
|
24129
|
+
reason,
|
|
24130
|
+
projectsScanned: projects
|
|
24131
|
+
}),
|
|
24132
|
+
COMMAND_REQUEST_TIMEOUT_MS
|
|
24133
|
+
);
|
|
24134
|
+
} catch (err) {
|
|
24135
|
+
const failure = classifyFailure(err);
|
|
24136
|
+
return failure === "unreachable" ? "unreachable" : failure;
|
|
24137
|
+
}
|
|
24138
|
+
return reason === null ? "reported" : "failed";
|
|
24139
|
+
}
|
|
24140
|
+
|
|
23480
24141
|
// ../../packages/plugin-runtime/src/attached/forward-drops.ts
|
|
23481
|
-
import { readFileSync as
|
|
23482
|
-
import { join as
|
|
24142
|
+
import { readFileSync as readFileSync8 } from "fs";
|
|
24143
|
+
import { join as join14 } from "path";
|
|
23483
24144
|
|
|
23484
24145
|
// ../../packages/plugin-runtime/src/attached/forward-policy.ts
|
|
23485
24146
|
import { randomUUID as randomUUID15 } from "crypto";
|
|
23486
|
-
import { readFileSync as
|
|
24147
|
+
import { readFileSync as readFileSync15 } from "fs";
|
|
23487
24148
|
import { readFile, rename, writeFile } from "fs/promises";
|
|
23488
|
-
import { join as
|
|
24149
|
+
import { join as join24 } from "path";
|
|
23489
24150
|
|
|
23490
24151
|
// ../../packages/plugin-sdk/src/config.ts
|
|
23491
|
-
import { existsSync as
|
|
23492
|
-
import { join as
|
|
24152
|
+
import { existsSync as existsSync8 } from "fs";
|
|
24153
|
+
import { join as join15 } from "path";
|
|
23493
24154
|
|
|
23494
24155
|
// ../../packages/plugin-sdk/src/provider-env.ts
|
|
23495
24156
|
var booleanish = external_exports.string().optional().transform((v) => {
|
|
@@ -23510,9 +24171,9 @@ var providerEnvShape = {
|
|
|
23510
24171
|
var ProviderEnvSchema = external_exports.object(providerEnvShape);
|
|
23511
24172
|
|
|
23512
24173
|
// ../../packages/plugin-sdk/src/config-inventory.ts
|
|
23513
|
-
import { readdirSync as readdirSync2, readFileSync as
|
|
24174
|
+
import { readdirSync as readdirSync2, readFileSync as readFileSync10, realpathSync as realpathSync2, statSync as statSync7 } from "fs";
|
|
23514
24175
|
import { homedir as homedir2 } from "os";
|
|
23515
|
-
import { basename as basename3, join as
|
|
24176
|
+
import { basename as basename3, join as join17 } from "path";
|
|
23516
24177
|
|
|
23517
24178
|
// ../../packages/detections/src/egress/registry.ts
|
|
23518
24179
|
var EXTRACTOR_VERSION = "1";
|
|
@@ -24259,387 +24920,131 @@ var EXPONENTIAL_UNITS = [
|
|
|
24259
24920
|
"a;",
|
|
24260
24921
|
"aA0",
|
|
24261
24922
|
" "
|
|
24262
|
-
];
|
|
24263
|
-
var EXPONENTIAL_PROBES = EXPONENTIAL_UNITS.flatMap(
|
|
24264
|
-
(unit) => [23, 25].map((len) => unit.repeat(Math.ceil(len / unit.length)).slice(0, len) + "!")
|
|
24265
|
-
);
|
|
24266
|
-
var POLYNOMIAL_PROBES = ["abc-", "a.", "a ", "a=", "x", "0", "a@", "a/", "ab"].map(
|
|
24267
|
-
(unit) => unit.repeat(1e4).slice(0, 4e4) + "!"
|
|
24268
|
-
);
|
|
24269
|
-
var CPU_CORROBORATION_SHARE = 0.2;
|
|
24270
|
-
var CORROBORATION_FLOOR_MS = BUDGET_MS * CPU_CORROBORATION_SHARE;
|
|
24271
|
-
|
|
24272
|
-
// ../../packages/plugin-sdk/src/repo.ts
|
|
24273
|
-
import { existsSync as existsSync8, readFileSync as readFileSync8, statSync as statSync6 } from "fs";
|
|
24274
|
-
import { basename as basename2, dirname as dirname3, isAbsolute, join as join14, sep as sep2 } from "path";
|
|
24275
|
-
|
|
24276
|
-
// ../../packages/plugin-sdk/src/events.ts
|
|
24277
|
-
import { createHash as createHash5, randomUUID as randomUUID13 } from "crypto";
|
|
24278
|
-
|
|
24279
|
-
// ../../packages/plugin-sdk/src/isolated-scan.ts
|
|
24280
|
-
import { existsSync as existsSync9 } from "fs";
|
|
24281
|
-
import { fileURLToPath } from "url";
|
|
24282
|
-
import { Worker } from "worker_threads";
|
|
24283
|
-
|
|
24284
|
-
// ../../packages/plugin-sdk/src/ignore-layers.ts
|
|
24285
|
-
var import_ignore = __toESM(require_ignore(), 1);
|
|
24286
|
-
import { readFileSync as readFileSync10 } from "fs";
|
|
24287
|
-
import { join as join16 } from "path";
|
|
24288
|
-
|
|
24289
|
-
// ../../packages/plugin-sdk/src/inventory-resolver.ts
|
|
24290
|
-
import { arch, hostname as hostname4, platform, release } from "os";
|
|
24291
|
-
|
|
24292
|
-
// ../../packages/plugin-sdk/src/model-governance.ts
|
|
24293
|
-
import {
|
|
24294
|
-
closeSync as closeSync2,
|
|
24295
|
-
fstatSync,
|
|
24296
|
-
mkdirSync as mkdirSync2,
|
|
24297
|
-
openSync as openSync2,
|
|
24298
|
-
readFileSync as readFileSync11,
|
|
24299
|
-
readSync,
|
|
24300
|
-
writeFileSync as writeFileSync5
|
|
24301
|
-
} from "fs";
|
|
24302
|
-
import { join as join17 } from "path";
|
|
24303
|
-
var TAIL_BYTES = 256 * 1024;
|
|
24304
|
-
|
|
24305
|
-
// ../../packages/plugin-sdk/src/nudge.ts
|
|
24306
|
-
import { mkdirSync as mkdirSync3, readFileSync as readFileSync12, writeFileSync as writeFileSync6 } from "fs";
|
|
24307
|
-
import { join as join18 } from "path";
|
|
24308
|
-
|
|
24309
|
-
// ../../packages/plugin-sdk/src/paths.ts
|
|
24310
|
-
import { readdirSync as readdirSync3, realpathSync as realpathSync3 } from "fs";
|
|
24311
|
-
import { basename as basename4, dirname as dirname4, sep as sep3 } from "path";
|
|
24312
|
-
|
|
24313
|
-
// ../../packages/plugin-sdk/src/project-files.ts
|
|
24314
|
-
import { existsSync as existsSync10, readdirSync as readdirSync4 } from "fs";
|
|
24315
|
-
import { basename as basename5, join as join19 } from "path";
|
|
24316
|
-
|
|
24317
|
-
// ../../packages/plugin-sdk/src/provider-env-antigravity.ts
|
|
24318
|
-
var optionalBaseUrl2 = external_exports.preprocess((v) => {
|
|
24319
|
-
if (typeof v === "string" && v.trim() === "") return void 0;
|
|
24320
|
-
return v;
|
|
24321
|
-
}, external_exports.string().optional()).catch(void 0);
|
|
24322
|
-
var optionalFlag = external_exports.preprocess((v) => {
|
|
24323
|
-
if (typeof v !== "string") return false;
|
|
24324
|
-
const normalized = v.trim().toLowerCase();
|
|
24325
|
-
return normalized !== "" && normalized !== "0" && normalized !== "false";
|
|
24326
|
-
}, external_exports.boolean()).catch(false);
|
|
24327
|
-
var antigravityProviderEnvShape = {
|
|
24328
|
-
GOOGLE_GENAI_USE_VERTEXAI: optionalFlag,
|
|
24329
|
-
GOOGLE_GEMINI_BASE_URL: optionalBaseUrl2
|
|
24330
|
-
};
|
|
24331
|
-
var AntigravityProviderEnvSchema = external_exports.object(antigravityProviderEnvShape);
|
|
24332
|
-
|
|
24333
|
-
// ../../packages/plugin-sdk/src/provider-env-codex.ts
|
|
24334
|
-
var optionalBaseUrl3 = external_exports.preprocess((v) => {
|
|
24335
|
-
if (typeof v === "string" && v.trim() === "") return void 0;
|
|
24336
|
-
return v;
|
|
24337
|
-
}, external_exports.string().optional()).catch(void 0);
|
|
24338
|
-
var codexProviderEnvShape = {
|
|
24339
|
-
OPENAI_BASE_URL: optionalBaseUrl3
|
|
24340
|
-
};
|
|
24341
|
-
var CodexProviderEnvSchema = external_exports.object(codexProviderEnvShape);
|
|
24342
|
-
|
|
24343
|
-
// ../../packages/plugin-sdk/src/runtime.ts
|
|
24344
|
-
import { randomUUID as randomUUID14 } from "crypto";
|
|
24345
|
-
|
|
24346
|
-
// ../../packages/plugin-sdk/src/suppressions.ts
|
|
24347
|
-
var THIRTY_DAYS_MS = 30 * 24 * 60 * 60 * 1e3;
|
|
24348
|
-
|
|
24349
|
-
// ../../packages/plugin-sdk/src/throttle.ts
|
|
24350
|
-
import { mkdirSync as mkdirSync4, statSync as statSync8, writeFileSync as writeFileSync7 } from "fs";
|
|
24351
|
-
import { join as join20 } from "path";
|
|
24352
|
-
|
|
24353
|
-
// ../../packages/plugin-runtime/src/attached/with-timeout.ts
|
|
24354
|
-
function withTimeout(promise2, ms) {
|
|
24355
|
-
let timer;
|
|
24356
|
-
const timeout = new Promise((_, reject) => {
|
|
24357
|
-
timer = setTimeout(() => {
|
|
24358
|
-
reject(new Error("attached gateway request timed out"));
|
|
24359
|
-
}, ms);
|
|
24360
|
-
});
|
|
24361
|
-
promise2.catch(() => void 0);
|
|
24362
|
-
return Promise.race([promise2, timeout]).finally(() => {
|
|
24363
|
-
clearTimeout(timer);
|
|
24364
|
-
});
|
|
24365
|
-
}
|
|
24366
|
-
|
|
24367
|
-
// ../../packages/plugin-runtime/src/attached/history-state.ts
|
|
24368
|
-
import { readFileSync as readFileSync14 } from "fs";
|
|
24369
|
-
import { join as join22 } from "path";
|
|
24370
|
-
|
|
24371
|
-
// ../../packages/plugin-runtime/src/attached/history-sync.ts
|
|
24372
|
-
import { createHash as createHash6 } from "crypto";
|
|
24373
|
-
import { hostname as hostname5 } from "os";
|
|
24374
|
-
|
|
24375
|
-
// ../../packages/remote/src/http.ts
|
|
24376
|
-
import { request as httpRequest } from "http";
|
|
24377
|
-
import { request as httpsRequest } from "https";
|
|
24378
|
-
var DEFAULT_TIMEOUT_MS = 1e4;
|
|
24379
|
-
var MAX_RESPONSE_BYTES = 8 * 1024 * 1024;
|
|
24380
|
-
var RemoteRequestError = class extends Error {
|
|
24381
|
-
constructor(status) {
|
|
24382
|
-
super(`control-plane request failed with status ${String(status)}`);
|
|
24383
|
-
this.status = status;
|
|
24384
|
-
this.name = "RemoteRequestError";
|
|
24385
|
-
}
|
|
24386
|
-
status;
|
|
24387
|
-
};
|
|
24388
|
-
var RemoteRequestInvalid = class extends Error {
|
|
24389
|
-
constructor(route, cause) {
|
|
24390
|
-
super(`refusing to send a malformed body to ${route}`);
|
|
24391
|
-
this.cause = cause;
|
|
24392
|
-
this.name = "RemoteRequestInvalid";
|
|
24393
|
-
}
|
|
24394
|
-
cause;
|
|
24395
|
-
};
|
|
24396
|
-
var RemoteResponseInvalid = class extends Error {
|
|
24397
|
-
constructor(route, detail) {
|
|
24398
|
-
super(`control plane answered ${route} with ${detail}`);
|
|
24399
|
-
this.name = "RemoteResponseInvalid";
|
|
24400
|
-
}
|
|
24401
|
-
};
|
|
24402
|
-
var RemoteTransportError = class extends Error {
|
|
24403
|
-
/**
|
|
24404
|
-
* The status the peer sent, when headers arrived and only the BODY was
|
|
24405
|
-
* refused.
|
|
24406
|
-
*
|
|
24407
|
-
* Undefined for the ordinary case this class was written for — no answer at
|
|
24408
|
-
* all. It exists because two paths reject after a status has already been
|
|
24409
|
-
* delivered: an oversized body and an aborted response. Discarding it there
|
|
24410
|
-
* reported a deployment answering 401 with a verbose body as a network
|
|
24411
|
-
* outage, which sends the reader to look at their network instead of their
|
|
24412
|
-
* credential.
|
|
24413
|
-
*/
|
|
24414
|
-
constructor(reason, status) {
|
|
24415
|
-
super(`control-plane request did not complete: ${reason}`);
|
|
24416
|
-
this.status = status;
|
|
24417
|
-
this.name = "RemoteTransportError";
|
|
24418
|
-
}
|
|
24419
|
-
status;
|
|
24420
|
-
};
|
|
24421
|
-
async function send(options) {
|
|
24422
|
-
const url2 = new URL(options.url);
|
|
24423
|
-
const timeoutMs = options.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
24424
|
-
const send_ = url2.protocol === "http:" ? httpRequest : httpsRequest;
|
|
24425
|
-
const requestOptions = {
|
|
24426
|
-
method: options.method,
|
|
24427
|
-
headers: {
|
|
24428
|
-
// CALLER HEADERS FIRST, so this module's own are not overridable. Spread
|
|
24429
|
-
// last they win, and two of the values below are ones no caller may
|
|
24430
|
-
// replace: `x-api-key` is the credential, and `content-length` is the
|
|
24431
|
-
// byte count that stops a multi-byte body being truncated by the
|
|
24432
|
-
// receiver. `SendOptions.headers` is a free-form record on an exported
|
|
24433
|
-
// function, so "no caller does that today" is not the guarantee to rely
|
|
24434
|
-
// on. The one header any caller actually passes — `if-none-match` on the
|
|
24435
|
-
// conditional GET — is untouched by this order.
|
|
24436
|
-
...options.headers,
|
|
24437
|
-
// The credential. One header, matching what the deployment authenticates
|
|
24438
|
-
// on; a second copy in an `Authorization` header would be one more place
|
|
24439
|
-
// it can be logged by an intermediary for no gain.
|
|
24440
|
-
//
|
|
24441
|
-
// Spread conditionally rather than assigned as `undefined`: Node's header
|
|
24442
|
-
// handling and `content-length` bookkeeping treat a present-but-undefined
|
|
24443
|
-
// key differently from an absent one, and "the header is not there" is
|
|
24444
|
-
// the property the attach flow needs.
|
|
24445
|
-
...options.apiKey === void 0 ? {} : { "x-api-key": options.apiKey },
|
|
24446
|
-
accept: "application/json",
|
|
24447
|
-
...options.body === void 0 ? {} : {
|
|
24448
|
-
"content-type": "application/json",
|
|
24449
|
-
// Byte length, not string length: a multi-byte body sent with a
|
|
24450
|
-
// character count is truncated by the receiver.
|
|
24451
|
-
"content-length": String(Buffer.byteLength(options.body))
|
|
24452
|
-
}
|
|
24453
|
-
}
|
|
24454
|
-
};
|
|
24455
|
-
return new Promise((resolve2, reject) => {
|
|
24456
|
-
let settled = false;
|
|
24457
|
-
const fail = (reason, status) => {
|
|
24458
|
-
if (settled) return;
|
|
24459
|
-
settled = true;
|
|
24460
|
-
reject(new RemoteTransportError(reason, status));
|
|
24461
|
-
};
|
|
24462
|
-
const req = send_(url2, requestOptions, (res) => {
|
|
24463
|
-
const chunks = [];
|
|
24464
|
-
let size = 0;
|
|
24465
|
-
res.on("data", (chunk) => {
|
|
24466
|
-
size += chunk.length;
|
|
24467
|
-
if (size > MAX_RESPONSE_BYTES) {
|
|
24468
|
-
fail(`response exceeded ${String(MAX_RESPONSE_BYTES)} bytes`, res.statusCode);
|
|
24469
|
-
res.destroy();
|
|
24470
|
-
req.destroy();
|
|
24471
|
-
return;
|
|
24472
|
-
}
|
|
24473
|
-
chunks.push(chunk);
|
|
24474
|
-
});
|
|
24475
|
-
res.on("aborted", () => {
|
|
24476
|
-
fail("the response was aborted", res.statusCode);
|
|
24477
|
-
});
|
|
24478
|
-
res.on("end", () => {
|
|
24479
|
-
if (settled) return;
|
|
24480
|
-
settled = true;
|
|
24481
|
-
resolve2({
|
|
24482
|
-
status: res.statusCode ?? 0,
|
|
24483
|
-
headers: res.headers,
|
|
24484
|
-
body: Buffer.concat(chunks).toString("utf8")
|
|
24485
|
-
});
|
|
24486
|
-
});
|
|
24487
|
-
});
|
|
24488
|
-
const deadline = setTimeout(() => {
|
|
24489
|
-
fail(`no response within ${String(timeoutMs)}ms`);
|
|
24490
|
-
req.destroy();
|
|
24491
|
-
}, timeoutMs);
|
|
24492
|
-
deadline.unref();
|
|
24493
|
-
req.on("upgrade", (_res, socket) => {
|
|
24494
|
-
fail("the deployment answered with a protocol upgrade");
|
|
24495
|
-
socket.destroy();
|
|
24496
|
-
});
|
|
24497
|
-
req.on("close", () => {
|
|
24498
|
-
fail("the connection closed before a response was read");
|
|
24499
|
-
clearTimeout(deadline);
|
|
24500
|
-
});
|
|
24501
|
-
req.on("error", (err) => {
|
|
24502
|
-
fail(err.message);
|
|
24503
|
-
});
|
|
24504
|
-
if (options.body !== void 0) req.write(options.body);
|
|
24505
|
-
req.end();
|
|
24506
|
-
});
|
|
24507
|
-
}
|
|
24923
|
+
];
|
|
24924
|
+
var EXPONENTIAL_PROBES = EXPONENTIAL_UNITS.flatMap(
|
|
24925
|
+
(unit) => [23, 25].map((len) => unit.repeat(Math.ceil(len / unit.length)).slice(0, len) + "!")
|
|
24926
|
+
);
|
|
24927
|
+
var POLYNOMIAL_PROBES = ["abc-", "a.", "a ", "a=", "x", "0", "a@", "a/", "ab"].map(
|
|
24928
|
+
(unit) => unit.repeat(1e4).slice(0, 4e4) + "!"
|
|
24929
|
+
);
|
|
24930
|
+
var CPU_CORROBORATION_SHARE = 0.2;
|
|
24931
|
+
var CORROBORATION_FLOOR_MS = BUDGET_MS * CPU_CORROBORATION_SHARE;
|
|
24508
24932
|
|
|
24509
|
-
// ../../packages/
|
|
24510
|
-
|
|
24511
|
-
|
|
24512
|
-
|
|
24513
|
-
|
|
24514
|
-
|
|
24515
|
-
|
|
24516
|
-
|
|
24517
|
-
|
|
24518
|
-
|
|
24933
|
+
// ../../packages/plugin-sdk/src/repo.ts
|
|
24934
|
+
import { existsSync as existsSync9, readFileSync as readFileSync9, statSync as statSync6 } from "fs";
|
|
24935
|
+
import { basename as basename2, dirname as dirname4, isAbsolute, join as join16, sep as sep2 } from "path";
|
|
24936
|
+
|
|
24937
|
+
// ../../packages/plugin-sdk/src/events.ts
|
|
24938
|
+
import { createHash as createHash5, randomUUID as randomUUID13 } from "crypto";
|
|
24939
|
+
|
|
24940
|
+
// ../../packages/plugin-sdk/src/isolated-scan.ts
|
|
24941
|
+
import { existsSync as existsSync10 } from "fs";
|
|
24942
|
+
import { fileURLToPath } from "url";
|
|
24943
|
+
import { Worker } from "worker_threads";
|
|
24944
|
+
|
|
24945
|
+
// ../../packages/plugin-sdk/src/host-floor.ts
|
|
24946
|
+
import { readFileSync as readFileSync12 } from "fs";
|
|
24947
|
+
import { join as join19 } from "path";
|
|
24948
|
+
|
|
24949
|
+
// ../../packages/plugin-sdk/src/model-governance.ts
|
|
24950
|
+
import {
|
|
24951
|
+
closeSync as closeSync2,
|
|
24952
|
+
fstatSync,
|
|
24953
|
+
mkdirSync as mkdirSync2,
|
|
24954
|
+
openSync as openSync2,
|
|
24955
|
+
readFileSync as readFileSync11,
|
|
24956
|
+
readSync,
|
|
24957
|
+
writeFileSync as writeFileSync5
|
|
24958
|
+
} from "fs";
|
|
24959
|
+
import { join as join18 } from "path";
|
|
24960
|
+
var TAIL_BYTES = 256 * 1024;
|
|
24961
|
+
|
|
24962
|
+
// ../../packages/plugin-sdk/src/host-floor.ts
|
|
24963
|
+
var HOST_FEATURE = {
|
|
24964
|
+
ModelSwitch: "model-switch",
|
|
24965
|
+
VaultPointerDisplay: "vault-pointer-display"
|
|
24519
24966
|
};
|
|
24520
|
-
|
|
24521
|
-
|
|
24522
|
-
|
|
24523
|
-
|
|
24524
|
-
|
|
24525
|
-
|
|
24526
|
-
|
|
24527
|
-
|
|
24528
|
-
|
|
24529
|
-
|
|
24530
|
-
}
|
|
24531
|
-
function parsed(schema, body, route) {
|
|
24532
|
-
let json2;
|
|
24533
|
-
try {
|
|
24534
|
-
json2 = JSON.parse(body);
|
|
24535
|
-
} catch {
|
|
24536
|
-
throw new RemoteResponseInvalid(route, "a body that is not JSON");
|
|
24537
|
-
}
|
|
24538
|
-
const result = schema.safeParse(json2);
|
|
24539
|
-
if (!result.success) {
|
|
24540
|
-
throw new RemoteResponseInvalid(route, "a body this client cannot read");
|
|
24967
|
+
var HOST_FLOORS = {
|
|
24968
|
+
[HOST_FEATURE.ModelSwitch]: {
|
|
24969
|
+
label: "model-switch protection",
|
|
24970
|
+
hookEvents: ["PreModelSwitch", "PostModelSwitch"],
|
|
24971
|
+
since: "2.1.251"
|
|
24972
|
+
},
|
|
24973
|
+
[HOST_FEATURE.VaultPointerDisplay]: {
|
|
24974
|
+
label: "vault pointer display",
|
|
24975
|
+
hookEvents: ["MessageDisplay"],
|
|
24976
|
+
since: "2.1.152"
|
|
24541
24977
|
}
|
|
24542
|
-
|
|
24543
|
-
|
|
24544
|
-
|
|
24545
|
-
|
|
24546
|
-
|
|
24547
|
-
|
|
24548
|
-
|
|
24549
|
-
|
|
24550
|
-
|
|
24551
|
-
|
|
24552
|
-
|
|
24553
|
-
|
|
24554
|
-
|
|
24555
|
-
|
|
24556
|
-
|
|
24557
|
-
|
|
24558
|
-
|
|
24559
|
-
|
|
24560
|
-
|
|
24561
|
-
|
|
24562
|
-
|
|
24563
|
-
|
|
24564
|
-
|
|
24565
|
-
|
|
24566
|
-
|
|
24567
|
-
|
|
24568
|
-
|
|
24569
|
-
|
|
24570
|
-
|
|
24571
|
-
|
|
24572
|
-
|
|
24573
|
-
|
|
24574
|
-
|
|
24575
|
-
|
|
24576
|
-
|
|
24577
|
-
|
|
24578
|
-
|
|
24579
|
-
|
|
24580
|
-
|
|
24581
|
-
|
|
24582
|
-
|
|
24583
|
-
|
|
24584
|
-
|
|
24585
|
-
|
|
24586
|
-
|
|
24587
|
-
|
|
24588
|
-
|
|
24589
|
-
|
|
24590
|
-
|
|
24591
|
-
|
|
24592
|
-
|
|
24593
|
-
|
|
24594
|
-
|
|
24595
|
-
|
|
24596
|
-
|
|
24597
|
-
|
|
24598
|
-
|
|
24599
|
-
|
|
24600
|
-
|
|
24601
|
-
|
|
24602
|
-
|
|
24603
|
-
|
|
24604
|
-
|
|
24605
|
-
|
|
24606
|
-
|
|
24607
|
-
|
|
24608
|
-
|
|
24609
|
-
|
|
24610
|
-
|
|
24611
|
-
|
|
24612
|
-
},
|
|
24613
|
-
async getPolicyBundle(etag) {
|
|
24614
|
-
const response = await send({
|
|
24615
|
-
...common,
|
|
24616
|
-
method: "GET",
|
|
24617
|
-
url: url2(ROUTES.policyBundle),
|
|
24618
|
-
...etag === void 0 ? {} : { headers: { "if-none-match": etag } }
|
|
24619
|
-
});
|
|
24620
|
-
if (response.status === 304) {
|
|
24621
|
-
return { changed: false, etag: headerValue(response, "etag") ?? etag };
|
|
24622
|
-
}
|
|
24623
|
-
const bundle = parsed(PolicyBundle, okBody(response), ROUTES.policyBundle);
|
|
24624
|
-
return { changed: true, bundle, etag: headerValue(response, "etag") };
|
|
24625
|
-
},
|
|
24626
|
-
async whoami() {
|
|
24627
|
-
const response = await send({ ...common, method: "GET", url: url2(ROUTES.whoami) });
|
|
24628
|
-
return parsed(PluginWhoami, okBody(response), ROUTES.whoami);
|
|
24629
|
-
},
|
|
24630
|
-
async recordProjectEgress(request) {
|
|
24631
|
-
const validated = EgressIngestRequest.safeParse(request);
|
|
24632
|
-
if (!validated.success) throw new RemoteRequestInvalid(ROUTES.shares, validated.error);
|
|
24633
|
-
const response = await send({
|
|
24634
|
-
...common,
|
|
24635
|
-
method: "POST",
|
|
24636
|
-
url: url2(ROUTES.shares),
|
|
24637
|
-
body: JSON.stringify(validated.data)
|
|
24638
|
-
});
|
|
24639
|
-
okBody(response);
|
|
24640
|
-
}
|
|
24641
|
-
};
|
|
24642
|
-
}
|
|
24978
|
+
};
|
|
24979
|
+
|
|
24980
|
+
// ../../packages/plugin-sdk/src/ignore-layers.ts
|
|
24981
|
+
var import_ignore = __toESM(require_ignore(), 1);
|
|
24982
|
+
import { readFileSync as readFileSync13 } from "fs";
|
|
24983
|
+
import { join as join20 } from "path";
|
|
24984
|
+
|
|
24985
|
+
// ../../packages/plugin-sdk/src/inventory-resolver.ts
|
|
24986
|
+
import { arch, hostname as hostname4, platform, release } from "os";
|
|
24987
|
+
|
|
24988
|
+
// ../../packages/plugin-sdk/src/nudge.ts
|
|
24989
|
+
import { mkdirSync as mkdirSync3, readFileSync as readFileSync14, writeFileSync as writeFileSync6 } from "fs";
|
|
24990
|
+
import { join as join21 } from "path";
|
|
24991
|
+
|
|
24992
|
+
// ../../packages/plugin-sdk/src/paths.ts
|
|
24993
|
+
import { readdirSync as readdirSync3, realpathSync as realpathSync3 } from "fs";
|
|
24994
|
+
import { basename as basename4, dirname as dirname5, sep as sep3 } from "path";
|
|
24995
|
+
|
|
24996
|
+
// ../../packages/plugin-sdk/src/project-files.ts
|
|
24997
|
+
import { existsSync as existsSync11, readdirSync as readdirSync4 } from "fs";
|
|
24998
|
+
import { basename as basename5, join as join22 } from "path";
|
|
24999
|
+
|
|
25000
|
+
// ../../packages/plugin-sdk/src/provider-env-antigravity.ts
|
|
25001
|
+
var optionalBaseUrl2 = external_exports.preprocess((v) => {
|
|
25002
|
+
if (typeof v === "string" && v.trim() === "") return void 0;
|
|
25003
|
+
return v;
|
|
25004
|
+
}, external_exports.string().optional()).catch(void 0);
|
|
25005
|
+
var optionalFlag = external_exports.preprocess((v) => {
|
|
25006
|
+
if (typeof v !== "string") return false;
|
|
25007
|
+
const normalized = v.trim().toLowerCase();
|
|
25008
|
+
return normalized !== "" && normalized !== "0" && normalized !== "false";
|
|
25009
|
+
}, external_exports.boolean()).catch(false);
|
|
25010
|
+
var antigravityProviderEnvShape = {
|
|
25011
|
+
GOOGLE_GENAI_USE_VERTEXAI: optionalFlag,
|
|
25012
|
+
GOOGLE_GEMINI_BASE_URL: optionalBaseUrl2
|
|
25013
|
+
};
|
|
25014
|
+
var AntigravityProviderEnvSchema = external_exports.object(antigravityProviderEnvShape);
|
|
25015
|
+
|
|
25016
|
+
// ../../packages/plugin-sdk/src/provider-env-codex.ts
|
|
25017
|
+
var optionalBaseUrl3 = external_exports.preprocess((v) => {
|
|
25018
|
+
if (typeof v === "string" && v.trim() === "") return void 0;
|
|
25019
|
+
return v;
|
|
25020
|
+
}, external_exports.string().optional()).catch(void 0);
|
|
25021
|
+
var codexProviderEnvShape = {
|
|
25022
|
+
OPENAI_BASE_URL: optionalBaseUrl3
|
|
25023
|
+
};
|
|
25024
|
+
var CodexProviderEnvSchema = external_exports.object(codexProviderEnvShape);
|
|
25025
|
+
|
|
25026
|
+
// ../../packages/plugin-sdk/src/runtime.ts
|
|
25027
|
+
import { randomUUID as randomUUID14 } from "crypto";
|
|
25028
|
+
|
|
25029
|
+
// ../../packages/plugin-sdk/src/suppressions.ts
|
|
25030
|
+
var THIRTY_DAYS_MS = 30 * 24 * 60 * 60 * 1e3;
|
|
25031
|
+
|
|
25032
|
+
// ../../packages/plugin-sdk/src/throttle.ts
|
|
25033
|
+
import { mkdirSync as mkdirSync4, statSync as statSync8, writeFileSync as writeFileSync7 } from "fs";
|
|
25034
|
+
import { join as join23 } from "path";
|
|
25035
|
+
|
|
25036
|
+
// ../../packages/plugin-runtime/src/attached/history-state.ts
|
|
25037
|
+
import { readFileSync as readFileSync16 } from "fs";
|
|
25038
|
+
import { join as join25 } from "path";
|
|
25039
|
+
|
|
25040
|
+
// ../../packages/plugin-runtime/src/attached/history-sync.ts
|
|
25041
|
+
import { createHash as createHash6 } from "crypto";
|
|
25042
|
+
import { hostname as hostname5 } from "os";
|
|
25043
|
+
|
|
25044
|
+
// ../../packages/plugin-runtime/src/attached/capture-rebuild.ts
|
|
25045
|
+
var CORRELATION_ID = EventMetadata.shape.correlationId;
|
|
25046
|
+
var TRACE_ID = EventMetadata.shape.traceId;
|
|
25047
|
+
var EXCEPTION_ID = EventMetadata.shape.exceptionIds.unwrap().element;
|
|
24643
25048
|
|
|
24644
25049
|
// ../../packages/plugin-runtime/src/attached/history-sync-trigger.ts
|
|
24645
25050
|
import { spawn } from "child_process";
|
|
@@ -24647,12 +25052,12 @@ import { fileURLToPath as fileURLToPath2 } from "url";
|
|
|
24647
25052
|
var HISTORY_SYNC_THROTTLE_MS = 5 * 60 * 1e3;
|
|
24648
25053
|
|
|
24649
25054
|
// ../../packages/plugin-runtime/src/attached/plugin-block.ts
|
|
24650
|
-
import { readFileSync as
|
|
25055
|
+
import { readFileSync as readFileSync17 } from "fs";
|
|
24651
25056
|
|
|
24652
25057
|
// ../../packages/plugin-runtime/src/attached/policy-store.ts
|
|
24653
25058
|
import { randomUUID as randomUUID16 } from "crypto";
|
|
24654
25059
|
import { readFile as readFile2, rm, writeFile as writeFile2 } from "fs/promises";
|
|
24655
|
-
import { join as
|
|
25060
|
+
import { join as join26 } from "path";
|
|
24656
25061
|
|
|
24657
25062
|
// ../../packages/plugin-runtime/src/attached/atomic-publish.ts
|
|
24658
25063
|
import { rename as rename2 } from "fs/promises";
|
|
@@ -24676,7 +25081,7 @@ async function publishByRename(tmp, file2, move = rename2) {
|
|
|
24676
25081
|
|
|
24677
25082
|
// ../../packages/plugin-runtime/src/attached/policy-store.ts
|
|
24678
25083
|
function createPolicyStore(dir = dataDir()) {
|
|
24679
|
-
const file2 =
|
|
25084
|
+
const file2 = join26(dir, "policy-cache.json");
|
|
24680
25085
|
async function read() {
|
|
24681
25086
|
try {
|
|
24682
25087
|
const raw = await readFile2(file2, "utf8");
|
|
@@ -24685,22 +25090,32 @@ function createPolicyStore(dir = dataDir()) {
|
|
|
24685
25090
|
const record2 = parsed2;
|
|
24686
25091
|
const bundle = PolicyBundle.parse(record2.bundle);
|
|
24687
25092
|
const fetchedAtMs = typeof record2.fetchedAtMs === "number" ? record2.fetchedAtMs : 0;
|
|
24688
|
-
const
|
|
25093
|
+
const stored = typeof record2.etag === "string" ? record2.etag : void 0;
|
|
25094
|
+
const replayable = record2.shapeId === POLICY_BUNDLE_SHAPE_ID || knowsMoreThanThisBuild(record2.shapeId);
|
|
25095
|
+
const etag = replayable ? stored : void 0;
|
|
24689
25096
|
return { bundle, fetchedAtMs, ...etag === void 0 ? {} : { etag } };
|
|
24690
25097
|
} catch {
|
|
24691
25098
|
return null;
|
|
24692
25099
|
}
|
|
24693
25100
|
}
|
|
24694
|
-
|
|
24695
|
-
|
|
24696
|
-
const
|
|
24697
|
-
|
|
24698
|
-
|
|
24699
|
-
|
|
24700
|
-
|
|
25101
|
+
function knowsMoreThanThisBuild(shapeId) {
|
|
25102
|
+
if (typeof shapeId !== "string" || shapeId === "") return false;
|
|
25103
|
+
const theirs = new Set(shapeId.split(","));
|
|
25104
|
+
const ours = new Set(POLICY_BUNDLE_SHAPE_ID.split(","));
|
|
25105
|
+
return theirs.size > ours.size && [...ours].every((key) => theirs.has(key));
|
|
25106
|
+
}
|
|
25107
|
+
async function priorRecord() {
|
|
25108
|
+
try {
|
|
25109
|
+
const parsed2 = JSON.parse(await readFile2(file2, "utf8"));
|
|
25110
|
+
return typeof parsed2 === "object" && parsed2 !== null ? parsed2 : null;
|
|
25111
|
+
} catch {
|
|
25112
|
+
return null;
|
|
25113
|
+
}
|
|
25114
|
+
}
|
|
25115
|
+
async function publishRecord(record2) {
|
|
24701
25116
|
const tmp = `${file2}.${randomUUID16()}.tmp`;
|
|
24702
25117
|
try {
|
|
24703
|
-
await writeFile2(tmp, JSON.stringify(
|
|
25118
|
+
await writeFile2(tmp, JSON.stringify(record2), {
|
|
24704
25119
|
encoding: "utf8",
|
|
24705
25120
|
mode: DATA_FILE_MODE,
|
|
24706
25121
|
flag: "wx"
|
|
@@ -24711,6 +25126,27 @@ function createPolicyStore(dir = dataDir()) {
|
|
|
24711
25126
|
throw err;
|
|
24712
25127
|
}
|
|
24713
25128
|
}
|
|
25129
|
+
async function write(bundle, etag) {
|
|
25130
|
+
await ensureDataDir(dir);
|
|
25131
|
+
const prior = await priorRecord();
|
|
25132
|
+
const priorVersion = prior?.bundle?.version;
|
|
25133
|
+
if (prior !== null && knowsMoreThanThisBuild(prior.shapeId) && priorVersion === bundle.version) {
|
|
25134
|
+
await publishRecord({
|
|
25135
|
+
...prior,
|
|
25136
|
+
fetchedAtMs: Date.now()
|
|
25137
|
+
});
|
|
25138
|
+
return;
|
|
25139
|
+
}
|
|
25140
|
+
await publishRecord({
|
|
25141
|
+
bundle,
|
|
25142
|
+
fetchedAtMs: Date.now(),
|
|
25143
|
+
// Stamped on EVERY write, the 304 arm's included: that arm hands back the
|
|
25144
|
+
// bundle it already holds, and the point of the stamp is to describe the
|
|
25145
|
+
// build that last narrowed those bytes, which is this one.
|
|
25146
|
+
shapeId: POLICY_BUNDLE_SHAPE_ID,
|
|
25147
|
+
...etag === void 0 ? {} : { etag }
|
|
25148
|
+
});
|
|
25149
|
+
}
|
|
24714
25150
|
return { read, write, file: file2 };
|
|
24715
25151
|
}
|
|
24716
25152
|
|
|
@@ -24773,14 +25209,14 @@ import { DatabaseSync as DatabaseSync4 } from "node:sqlite";
|
|
|
24773
25209
|
// ../../packages/plugin-runtime/src/attached/posture-store.ts
|
|
24774
25210
|
import { randomUUID as randomUUID17 } from "crypto";
|
|
24775
25211
|
import { readFile as readFile3, rm as rm2, writeFile as writeFile3 } from "fs/promises";
|
|
24776
|
-
import { join as
|
|
25212
|
+
import { join as join27 } from "path";
|
|
24777
25213
|
|
|
24778
25214
|
// ../../packages/plugin-runtime/src/attached/sync-state.ts
|
|
24779
|
-
import { readFileSync as
|
|
24780
|
-
import { join as
|
|
25215
|
+
import { readFileSync as readFileSync18 } from "fs";
|
|
25216
|
+
import { join as join28 } from "path";
|
|
24781
25217
|
var SYNC_STATE_FILENAME = ATTACHED_SYNC_STATE_FILENAME;
|
|
24782
25218
|
function syncStatePath(dataDir2) {
|
|
24783
|
-
return
|
|
25219
|
+
return join28(dataDir2, SYNC_STATE_FILENAME);
|
|
24784
25220
|
}
|
|
24785
25221
|
function writeSyncState(dataDir2, result) {
|
|
24786
25222
|
try {
|
|
@@ -24807,14 +25243,23 @@ var OUTCOME_LINES = {
|
|
|
24807
25243
|
};
|
|
24808
25244
|
|
|
24809
25245
|
// ../../packages/plugin-runtime/src/attached/sync-entry.ts
|
|
24810
|
-
async function runAttachedSync(base = defaultDataDir()) {
|
|
25246
|
+
async function runAttachedSync(base = defaultDataDir(), deps = {}) {
|
|
25247
|
+
let policyOutcome = null;
|
|
24811
25248
|
try {
|
|
24812
25249
|
const result = await runPolicySync({
|
|
24813
25250
|
base,
|
|
24814
25251
|
settingsDir: settingsDir(base),
|
|
24815
25252
|
dataDir: dataDir(base)
|
|
24816
25253
|
});
|
|
24817
|
-
if (result !== null)
|
|
25254
|
+
if (result !== null) {
|
|
25255
|
+
policyOutcome = result.outcome;
|
|
25256
|
+
writeSyncState(dataDir(base), result);
|
|
25257
|
+
}
|
|
25258
|
+
} catch {
|
|
25259
|
+
}
|
|
25260
|
+
if (policyOutcome === "unauthorized") return;
|
|
25261
|
+
try {
|
|
25262
|
+
await runCommandSync({ base, settingsDir: settingsDir(base), scan: deps.scan });
|
|
24818
25263
|
} catch {
|
|
24819
25264
|
}
|
|
24820
25265
|
}
|