@akasecurity/ai-tc-claude-code 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/.claude-plugin/plugin.json +1 -1
- package/README.md +2 -2
- package/hooks/hooks.json +1 -1
- package/package.json +4 -4
- package/scripts/apply-suppressions.js +1703 -982
- package/scripts/backfill.js +2669 -1576
- package/scripts/filescan.js +2463 -1429
- package/scripts/firstrun.js +2479 -1450
- package/scripts/history-sync.js +2544 -1498
- package/scripts/intro.js +577 -302
- package/scripts/message-display.js +1716 -974
- package/scripts/onboard.js +2136 -1411
- package/scripts/post-model-switch.js +663 -379
- package/scripts/post-tool-use.js +2655 -1441
- package/scripts/pre-model-switch.js +2371 -1372
- package/scripts/pre-tool-use.js +2698 -1457
- package/scripts/query.js +2557 -1465
- package/scripts/reconcile.js +2469 -1407
- package/scripts/remediate.js +2548 -1445
- package/scripts/scan-worker.js +425 -228
- package/scripts/session-start.js +2460 -1462
- package/scripts/start-light.js +580 -305
- package/scripts/statusline.js +2404 -1409
- package/scripts/stop.js +893 -391
- package/scripts/sync.js +17709 -2077
- package/scripts/user-prompt-submit.js +2506 -1445
package/scripts/scan-worker.js
CHANGED
|
@@ -20703,13 +20703,11 @@ var FindingGroup = external_exports.object({
|
|
|
20703
20703
|
latestDetectedAt: external_exports.iso.datetime(),
|
|
20704
20704
|
instances: external_exports.array(FindingInstance),
|
|
20705
20705
|
// Derived from instances' statuses with open-dominates precedence (see
|
|
20706
|
-
//
|
|
20706
|
+
// foldGroupStatus). Undefined only when no instance carries a status.
|
|
20707
20707
|
status: FindingStatus.optional(),
|
|
20708
|
-
// The distinct people across the WHOLE group, not just the
|
|
20709
|
-
//
|
|
20710
|
-
//
|
|
20711
|
-
// instance carries a user, or when the store supplied whole-group folds
|
|
20712
|
-
// without one.
|
|
20708
|
+
// The distinct people across the WHOLE group, not just the instances
|
|
20709
|
+
// carried here. Undefined when no instance carries a user, or when the
|
|
20710
|
+
// store supplied whole-group folds without one.
|
|
20713
20711
|
users: external_exports.array(FindingUser).optional()
|
|
20714
20712
|
}).meta({ id: "FindingGroup" });
|
|
20715
20713
|
var FindingStats = external_exports.object({
|
|
@@ -20738,20 +20736,30 @@ var FindingFacets = external_exports.object({
|
|
|
20738
20736
|
// counted under no value.
|
|
20739
20737
|
status: external_exports.array(FindingFacetItem),
|
|
20740
20738
|
// Host tool (attributes.tool_name). Present only on the instance-level
|
|
20741
|
-
// reads, which can filter by it; the
|
|
20739
|
+
// reads, which can filter by it; the type-level read omits the dimension
|
|
20742
20740
|
// because a group spans tools.
|
|
20743
20741
|
tool: external_exports.array(FindingFacetItem).optional()
|
|
20744
20742
|
}).meta({ id: "FindingFacets" });
|
|
20745
|
-
var
|
|
20743
|
+
var FindingTypeSummary = FindingGroup.omit({ instances: true, match: true }).meta({
|
|
20744
|
+
id: "FindingTypeSummary"
|
|
20745
|
+
});
|
|
20746
|
+
var MAX_FINDING_TYPES_LIMIT = 100;
|
|
20747
|
+
var ListFindingTypesQuery = external_exports.object({
|
|
20746
20748
|
// NOTE: severity filters by Severity (critical/high/medium/low), not by
|
|
20747
|
-
// FindingAction.
|
|
20749
|
+
// FindingAction. It narrows TYPES: a type's severity is the one its newest
|
|
20750
|
+
// firing version carries, and this list pages types.
|
|
20751
|
+
//
|
|
20752
|
+
// That is NOT a claim the findings of a type share it. A rule can hold several
|
|
20753
|
+
// definition versions at different severities, so a type kept by this filter
|
|
20754
|
+
// can hold findings that individually do not match — see totals.findings on
|
|
20755
|
+
// ListFindingTypesResponse, which counts them all.
|
|
20748
20756
|
severity: external_exports.array(Severity).optional(),
|
|
20749
20757
|
subtype: external_exports.array(external_exports.string()).optional(),
|
|
20750
20758
|
provider: external_exports.array(FindingProvider).optional(),
|
|
20751
20759
|
action: external_exports.array(FindingAction).optional(),
|
|
20752
|
-
// Matches a
|
|
20753
|
-
// individual
|
|
20754
|
-
//
|
|
20760
|
+
// Matches a type's DERIVED status (see FindingGroup.status), not its
|
|
20761
|
+
// individual findings' — so a filtered row's status always reads one of the
|
|
20762
|
+
// requested values.
|
|
20755
20763
|
status: external_exports.array(FindingStatus).optional(),
|
|
20756
20764
|
q: external_exports.string().optional(),
|
|
20757
20765
|
// Scope to findings whose event carries this session id (the Activity page's
|
|
@@ -20761,23 +20769,37 @@ var ListGroupedFindingsQuery = external_exports.object({
|
|
|
20761
20769
|
// from a time-scoped page (Activity's range) can carry that scope. Absent
|
|
20762
20770
|
// means all time — this list has no default window.
|
|
20763
20771
|
from: external_exports.iso.datetime().optional(),
|
|
20764
|
-
// A
|
|
20765
|
-
//
|
|
20766
|
-
//
|
|
20767
|
-
//
|
|
20768
|
-
//
|
|
20772
|
+
// A RULE id that must appear in the page even when the cursor has already
|
|
20773
|
+
// advanced past its sort position. This is what keeps the selected type
|
|
20774
|
+
// visible in the list once it paginates: the target is appended out of sort
|
|
20775
|
+
// order rather than scanned forward for. Never affects totals, facets or the
|
|
20776
|
+
// cursor. Unlike the grouped read this replaces, it names a rule only — an
|
|
20777
|
+
// instance id is resolved by `findingInstance`, which is a primary-key seek
|
|
20778
|
+
// and so is not bounded by what any page happens to hold.
|
|
20769
20779
|
includeId: external_exports.string().optional(),
|
|
20770
|
-
|
|
20771
|
-
limit: external_exports.coerce.number().int().min(1).max(100).optional(),
|
|
20780
|
+
limit: external_exports.coerce.number().int().min(1).max(MAX_FINDING_TYPES_LIMIT).optional(),
|
|
20772
20781
|
cursor: external_exports.string().optional()
|
|
20773
20782
|
});
|
|
20774
|
-
var
|
|
20783
|
+
var ListFindingTypesResponse = external_exports.object({
|
|
20775
20784
|
totals: external_exports.object({
|
|
20785
|
+
// Findings belonging to the matching TYPES — not findings that each match
|
|
20786
|
+
// the filters. The filters here select types, so a type that survives
|
|
20787
|
+
// contributes its whole instanceCount.
|
|
20788
|
+
//
|
|
20789
|
+
// `status` is the one exception, narrowed per finding via
|
|
20790
|
+
// countInstancesByStatus. `severity`, `provider` and `action` are not, so
|
|
20791
|
+
// this can exceed what the instance read reports for the same filters: a
|
|
20792
|
+
// rule whose severity moved between versions is kept on its newest and
|
|
20793
|
+
// still counts its older findings. Narrowing the other three needs
|
|
20794
|
+
// per-dimension counts the aggregate does not carry today.
|
|
20776
20795
|
findings: external_exports.number().int().nonnegative(),
|
|
20777
|
-
|
|
20796
|
+
// Counts TYPES, which is the unit this read pages. The instance read's
|
|
20797
|
+
// own totals count findings; the two deliberately answer different
|
|
20798
|
+
// questions and are never summed.
|
|
20799
|
+
types: external_exports.number().int().nonnegative()
|
|
20778
20800
|
}),
|
|
20779
20801
|
facets: FindingFacets,
|
|
20780
|
-
items: external_exports.array(
|
|
20802
|
+
items: external_exports.array(FindingTypeSummary),
|
|
20781
20803
|
nextCursor: external_exports.string().nullable(),
|
|
20782
20804
|
// Present only on session-scoped queries (`sessionId` set): per ruleId, how
|
|
20783
20805
|
// many times that rule fired in the session's persisted transcript. Findings
|
|
@@ -20785,7 +20807,7 @@ var ListGroupedFindingsResponse = external_exports.object({
|
|
|
20785
20807
|
// every firing, so the two numbers legitimately differ — this map lets a
|
|
20786
20808
|
// session-scoped view show both.
|
|
20787
20809
|
sessionFirings: external_exports.record(external_exports.string(), external_exports.number().int().nonnegative()).optional()
|
|
20788
|
-
}).meta({ id: "
|
|
20810
|
+
}).meta({ id: "ListFindingTypesResponse" });
|
|
20789
20811
|
var ApplyFindingActionRequest = external_exports.object({
|
|
20790
20812
|
// 'quarantined' is system-assigned (see FindingAction) — clients may not set
|
|
20791
20813
|
// it, so it is excluded from the request contract. The mapping helper
|
|
@@ -20814,12 +20836,13 @@ var FindingInstanceDetail = FindingInstance.extend({
|
|
|
20814
20836
|
var MAX_FLAT_FINDINGS_LIMIT = 200;
|
|
20815
20837
|
var ListFindingInstancesQuery = external_exports.object({
|
|
20816
20838
|
severity: external_exports.array(Severity).optional(),
|
|
20817
|
-
// Rule ids, the same vocabulary the
|
|
20839
|
+
// Rule ids, the same vocabulary the types list's `subtype` carries. Pinning
|
|
20840
|
+
// ONE of them is how the master/detail view scopes its right-hand panel.
|
|
20818
20841
|
subtype: external_exports.array(external_exports.string()).optional(),
|
|
20819
20842
|
provider: external_exports.array(FindingProvider).optional(),
|
|
20820
20843
|
action: external_exports.array(FindingAction).optional(),
|
|
20821
20844
|
// Matches each instance's OWN derived status (deriveFindingStatus), unlike
|
|
20822
|
-
// the
|
|
20845
|
+
// the types query's type-level fold.
|
|
20823
20846
|
status: external_exports.array(FindingStatus).optional(),
|
|
20824
20847
|
// Exact host-tool names (attributes.tool_name, e.g. 'Bash'). A real filter,
|
|
20825
20848
|
// where the free-text `q` can only match the rendered "via Bash" label.
|
|
@@ -20836,37 +20859,46 @@ var ListFindingInstancesQuery = external_exports.object({
|
|
|
20836
20859
|
});
|
|
20837
20860
|
var ListFindingInstancesResponse = external_exports.object({
|
|
20838
20861
|
// Instances matching the filters across the whole scope, not just this
|
|
20839
|
-
// page — cursor-independent, like the
|
|
20862
|
+
// page — cursor-independent, like the types list's totals.
|
|
20840
20863
|
totals: external_exports.object({ findings: external_exports.number().int().nonnegative() }),
|
|
20841
|
-
// Counts in INSTANCES here, where the
|
|
20864
|
+
// Counts in INSTANCES here, where the types response counts types. Each
|
|
20842
20865
|
// dimension still excludes its own filter.
|
|
20843
20866
|
facets: FindingFacets,
|
|
20844
20867
|
items: external_exports.array(FindingInstanceDetail),
|
|
20845
20868
|
nextCursor: external_exports.string().nullable()
|
|
20846
20869
|
}).meta({ id: "ListFindingInstancesResponse" });
|
|
20847
|
-
var
|
|
20848
|
-
//
|
|
20849
|
-
//
|
|
20850
|
-
|
|
20851
|
-
|
|
20852
|
-
|
|
20853
|
-
|
|
20854
|
-
// Folded from the instances' derived statuses with the same
|
|
20855
|
-
// open-dominates precedence a group uses.
|
|
20856
|
-
status: FindingStatus.optional(),
|
|
20857
|
-
// Distinct rules seen at this location, capped — the row shows them as
|
|
20858
|
-
// chips, and the count is what conveys scale.
|
|
20859
|
-
ruleIds: external_exports.array(external_exports.string())
|
|
20860
|
-
}).meta({ id: "FindingLocationFile" });
|
|
20861
|
-
var FindingLocationRepo = external_exports.object({
|
|
20870
|
+
var FindingLocationSummary = external_exports.object({
|
|
20871
|
+
// Opaque, stable, minted from the pair by encodeLocationId. It exists
|
|
20872
|
+
// because a location's identity is two values and a URL param carries one:
|
|
20873
|
+
// `?loc=` names a location the way `?rule=` names a type. Only ever compared
|
|
20874
|
+
// for EQUALITY — the page's selection check, this read's `includeId`, the
|
|
20875
|
+
// client's page dedupe — never decoded, and never a sort key.
|
|
20876
|
+
id: external_exports.string(),
|
|
20862
20877
|
/** Empty when the instances carried no repo attribute. */
|
|
20863
20878
|
repo: external_exports.string(),
|
|
20879
|
+
// Empty when the instances carried no file path (a prompt, or a tool call
|
|
20880
|
+
// with no file attribution). Both halves empty is a real location — usually
|
|
20881
|
+
// the largest one in a store — and is selectable like any other.
|
|
20882
|
+
file: external_exports.string(),
|
|
20864
20883
|
instanceCount: external_exports.number().int().nonnegative(),
|
|
20884
|
+
// The WORST severity present, not the first row's. It is this list's primary
|
|
20885
|
+
// sort key, so it is also what explains why a row is where it is, and it is
|
|
20886
|
+
// how a reader decides what to open without opening everything.
|
|
20865
20887
|
maxSeverity: Severity,
|
|
20866
20888
|
latestDetectedAt: external_exports.iso.datetime(),
|
|
20889
|
+
// Folded from the instances' derived statuses with the same open-dominates
|
|
20890
|
+
// precedence a group uses, so it answers "is anything left to do here" and
|
|
20891
|
+
// not much more: a location holding 1 open among 40 resolved reads like one
|
|
20892
|
+
// holding 40 open. That loss is accepted — the panel beside this list
|
|
20893
|
+
// carries each finding's own status, and instanceCount sits next to the
|
|
20894
|
+
// badge.
|
|
20867
20895
|
status: FindingStatus.optional(),
|
|
20868
|
-
|
|
20869
|
-
|
|
20896
|
+
// Every distinct rule seen at this location, UNCAPPED — so the length is a
|
|
20897
|
+
// tally rather than a sample and a row can say how many there are. Bounded
|
|
20898
|
+
// by the ruleset, not by the store. The view bounds what it DISPLAYS.
|
|
20899
|
+
ruleIds: external_exports.array(external_exports.string())
|
|
20900
|
+
}).meta({ id: "FindingLocationSummary" });
|
|
20901
|
+
var MAX_FINDING_LOCATIONS_LIMIT = 100;
|
|
20870
20902
|
var ListFindingLocationsQuery = external_exports.object({
|
|
20871
20903
|
severity: external_exports.array(Severity).optional(),
|
|
20872
20904
|
subtype: external_exports.array(external_exports.string()).optional(),
|
|
@@ -20879,18 +20911,42 @@ var ListFindingLocationsQuery = external_exports.object({
|
|
|
20879
20911
|
q: external_exports.string().optional(),
|
|
20880
20912
|
sessionId: external_exports.string().optional(),
|
|
20881
20913
|
from: external_exports.iso.datetime().optional(),
|
|
20882
|
-
|
|
20914
|
+
// A LOCATION id (see FindingLocationSummary.id) that must appear in the page
|
|
20915
|
+
// even when the cursor has already advanced past its sort position — the
|
|
20916
|
+
// counterpart of ListFindingTypesQuery.includeId, and needed far more often
|
|
20917
|
+
// here. Selecting a row pushes the URL, which re-renders the server and resets
|
|
20918
|
+
// the client's page cache to page 0; with distinct (repo, file) pairs running
|
|
20919
|
+
// into the thousands, a selection sitting off page 0 is the ordinary case
|
|
20920
|
+
// rather than a deep-link corner. Never affects totals, facets or the cursor.
|
|
20921
|
+
includeId: external_exports.string().optional(),
|
|
20922
|
+
limit: external_exports.coerce.number().int().min(1).max(MAX_FINDING_LOCATIONS_LIMIT).optional(),
|
|
20923
|
+
cursor: external_exports.string().optional()
|
|
20883
20924
|
});
|
|
20884
20925
|
var ListFindingLocationsResponse = external_exports.object({
|
|
20885
20926
|
totals: external_exports.object({
|
|
20927
|
+
// Findings matching the filters across the whole scope. Unlike the types
|
|
20928
|
+
// read's same-named field this needs no caveat: the filters here narrow
|
|
20929
|
+
// per finding, so this is the sum of every row's instanceCount.
|
|
20886
20930
|
findings: external_exports.number().int().nonnegative(),
|
|
20887
|
-
|
|
20888
|
-
|
|
20931
|
+
// Counts LOCATIONS, the unit this read pages — the number the paginator
|
|
20932
|
+
// states. The facets beside it count FINDINGS (see below); a surface
|
|
20933
|
+
// showing both says which is which.
|
|
20934
|
+
locations: external_exports.number().int().nonnegative()
|
|
20889
20935
|
}),
|
|
20890
|
-
|
|
20891
|
-
|
|
20892
|
-
|
|
20893
|
-
|
|
20936
|
+
// Counts in FINDINGS, where the types response counts types, each dimension
|
|
20937
|
+
// still excluding its own filter. Deliberately not locations: counting those
|
|
20938
|
+
// needs a set of location keys per dimension per value — memory tracking the
|
|
20939
|
+
// store times the vocabulary, in a read whose scan promises flat memory —
|
|
20940
|
+
// and the cheap per-location version is not an approximation but WRONG. A
|
|
20941
|
+
// location holding {claudecode, block} and {codex, warn} would survive
|
|
20942
|
+
// provider=claudecode AND action=warn, under which no single finding
|
|
20943
|
+
// matches, so the facet would contradict the instanceCount this whole view
|
|
20944
|
+
// rests on. Findings also keep the toolbar in the same unit as the page
|
|
20945
|
+
// tally and the panel it sits above.
|
|
20946
|
+
facets: FindingFacets,
|
|
20947
|
+
/** Sorted by max severity, then most recent, then (repo, file). */
|
|
20948
|
+
items: external_exports.array(FindingLocationSummary),
|
|
20949
|
+
nextCursor: external_exports.string().nullable()
|
|
20894
20950
|
}).meta({ id: "ListFindingLocationsResponse" });
|
|
20895
20951
|
|
|
20896
20952
|
// ../../packages/schema/src/zod/meta.ts
|
|
@@ -22055,6 +22111,14 @@ var ControlPlaneErrorBody = external_exports.object({
|
|
|
22055
22111
|
message: external_exports.string().optional()
|
|
22056
22112
|
}).optional()
|
|
22057
22113
|
});
|
|
22114
|
+
var RemoteFailureKind = external_exports.enum([
|
|
22115
|
+
"unauthorized",
|
|
22116
|
+
"forbidden",
|
|
22117
|
+
"route-absent",
|
|
22118
|
+
"invalid-request",
|
|
22119
|
+
"rejected",
|
|
22120
|
+
"unreachable"
|
|
22121
|
+
]);
|
|
22058
22122
|
var AttachDeviceRequest = external_exports.object({
|
|
22059
22123
|
// This machine's own continuity id, so re-attaching ROTATES the credential
|
|
22060
22124
|
// on one machine record instead of producing a second one. Client-minted
|
|
@@ -22116,6 +22180,26 @@ var AttachTokenResponse = external_exports.union([
|
|
|
22116
22180
|
AttachTokenExpired,
|
|
22117
22181
|
external_exports.object({ status: printable(64) })
|
|
22118
22182
|
]);
|
|
22183
|
+
var DeviceCommandKind = external_exports.enum(["shares_rescan"]);
|
|
22184
|
+
var DeviceCommand = external_exports.object({
|
|
22185
|
+
id: printable(128).min(1),
|
|
22186
|
+
kind: DeviceCommandKind,
|
|
22187
|
+
issuedAt: printable(64).min(1),
|
|
22188
|
+
expiresAt: printable(64).min(1)
|
|
22189
|
+
}).strict();
|
|
22190
|
+
var DeviceCommandPollResponse = external_exports.object({ command: DeviceCommand.nullable() });
|
|
22191
|
+
var DeviceCommandFailureReason = external_exports.enum(["scan_failed", "no_projects", "expired"]);
|
|
22192
|
+
var DeviceCommandAckBody = external_exports.discriminatedUnion("outcome", [
|
|
22193
|
+
external_exports.object({
|
|
22194
|
+
outcome: external_exports.literal("reported"),
|
|
22195
|
+
projectsScanned: external_exports.number().int().nonnegative()
|
|
22196
|
+
}).strict(),
|
|
22197
|
+
external_exports.object({
|
|
22198
|
+
outcome: external_exports.literal("failed"),
|
|
22199
|
+
reason: DeviceCommandFailureReason,
|
|
22200
|
+
projectsScanned: external_exports.number().int().nonnegative()
|
|
22201
|
+
}).strict()
|
|
22202
|
+
]);
|
|
22119
22203
|
|
|
22120
22204
|
// ../../packages/schema/src/zod/registry.ts
|
|
22121
22205
|
var Namespace = external_exports.string().regex(/^[a-z][a-z0-9-]*$/);
|
|
@@ -22282,7 +22366,7 @@ var PackManifest = external_exports.object({
|
|
|
22282
22366
|
}).meta({ id: "PackManifest" });
|
|
22283
22367
|
|
|
22284
22368
|
// ../../packages/schema/src/zod/detection.ts
|
|
22285
|
-
var OriginEnum = external_exports.enum(["library"]).meta({ id: "OriginEnum" });
|
|
22369
|
+
var OriginEnum = external_exports.enum(["library", "custom"]).meta({ id: "OriginEnum" });
|
|
22286
22370
|
var DetectionFilterEnum = external_exports.enum(["all", "library", "custom", "customized", "updates"]);
|
|
22287
22371
|
var LibraryStateEnum = external_exports.enum(["new", "imported", "update"]).meta({ id: "LibraryStateEnum" });
|
|
22288
22372
|
var DetectionCounts = external_exports.object({
|
|
@@ -22477,8 +22561,9 @@ var Event = external_exports.object({
|
|
|
22477
22561
|
metadata: EventMetadata.optional()
|
|
22478
22562
|
}).meta({ id: "Event" });
|
|
22479
22563
|
var IngestEvent = Event.meta({ id: "IngestEvent" });
|
|
22564
|
+
var INGEST_BATCH_MAX = 100;
|
|
22480
22565
|
var IngestBatch = external_exports.object({
|
|
22481
|
-
events: external_exports.array(IngestEvent).min(1).max(
|
|
22566
|
+
events: external_exports.array(IngestEvent).min(1).max(INGEST_BATCH_MAX),
|
|
22482
22567
|
// Dedup policy for this batch. Id-dedup ALWAYS applies. 'content-hash'
|
|
22483
22568
|
// additionally rejects any event whose contentHash the store has already
|
|
22484
22569
|
// recorded — for re-runnable bulk ingest (worktree scan, transcript
|
|
@@ -22604,6 +22689,225 @@ var PatchInstalledPackRequest = external_exports.object({
|
|
|
22604
22689
|
message: "At least one field must be provided"
|
|
22605
22690
|
}).meta({ id: "PatchInstalledPackRequest" });
|
|
22606
22691
|
|
|
22692
|
+
// ../../packages/schema/src/zod/policy.ts
|
|
22693
|
+
var PolicyScope = external_exports.enum(["global", "repo", "user"]).meta({ id: "PolicyScope" });
|
|
22694
|
+
var PolicyTarget = external_exports.union([external_exports.object({ ruleId: external_exports.string() }), external_exports.object({ category: DetectionCategory })]).meta({ id: "PolicyTarget" });
|
|
22695
|
+
var PolicyKind = external_exports.enum(["builtin", "custom"]).meta({ id: "PolicyKind" });
|
|
22696
|
+
var PolicyProvenance = external_exports.enum(["builtin", "authored"]).meta({ id: "PolicyProvenance" });
|
|
22697
|
+
var Policy = external_exports.object({
|
|
22698
|
+
id: external_exports.guid(),
|
|
22699
|
+
scope: PolicyScope,
|
|
22700
|
+
target: PolicyTarget,
|
|
22701
|
+
action: ActionTaken,
|
|
22702
|
+
enabled: external_exports.boolean().default(true),
|
|
22703
|
+
customKeywords: external_exports.array(external_exports.string()).optional(),
|
|
22704
|
+
// Display name — optional so older policy rows without name still parse.
|
|
22705
|
+
// Added for the findings API (policy.name column migration).
|
|
22706
|
+
name: external_exports.string().optional(),
|
|
22707
|
+
// Whether an AUTHORED policy governs this row's target — not a claim about
|
|
22708
|
+
// which row this is. A producer that collapses several rows onto one target
|
|
22709
|
+
// must carry the marker onto whichever row survives, or the collapse decides
|
|
22710
|
+
// the answer; a survivor may therefore be a built-in expansion still marked
|
|
22711
|
+
// 'authored' because an authored sibling targeted the same thing.
|
|
22712
|
+
// Optional so an older producer — and an older on-disk cache — still parses;
|
|
22713
|
+
// absent reads as 'builtin', which is the behaviour that predates the field.
|
|
22714
|
+
//
|
|
22715
|
+
// Deliberately NOT `kind`/PolicyKind: that name and that enum answer which
|
|
22716
|
+
// built-in archetype catalog entry a policy is, which every catalog surface
|
|
22717
|
+
// reads and which a caller may state. This one is a statement the PRODUCER
|
|
22718
|
+
// of a bundle makes about a row, and only the bundle builder ever stamps it
|
|
22719
|
+
// — the CRUD routes neither accept nor set it.
|
|
22720
|
+
//
|
|
22721
|
+
// A device consumes this in exactly one direction: an 'authored' policy
|
|
22722
|
+
// arriving from a control plane marks the rules it targets as not
|
|
22723
|
+
// locally re-assignable. That can only ever ADD a refusal, never relax one,
|
|
22724
|
+
// which is what makes it safe to honour from an unsigned cache — the same
|
|
22725
|
+
// test `prohibitedModels` passes and `reversibleRuleIds` fails.
|
|
22726
|
+
provenance: PolicyProvenance.optional()
|
|
22727
|
+
}).meta({ id: "Policy" });
|
|
22728
|
+
var PolicyBundle = external_exports.object({
|
|
22729
|
+
version: external_exports.string(),
|
|
22730
|
+
policies: external_exports.array(Policy),
|
|
22731
|
+
// Rules from the installed marketplace packs (snapshotted by the
|
|
22732
|
+
// control plane). The plugin registers these in addition to its bundled
|
|
22733
|
+
// packs. Optional so older backends — and older on-disk caches — that omit
|
|
22734
|
+
// the field still parse; consumers read `bundle.rules ?? []`.
|
|
22735
|
+
rules: external_exports.array(Rule).optional(),
|
|
22736
|
+
// When true, `rules` IS the complete effective ruleset and the runtime must
|
|
22737
|
+
// NOT merge its compiled-in bundled packs — the standalone gateway sets this
|
|
22738
|
+
// after reading the user's installed snapshot (installed_packs, enabled
|
|
22739
|
+
// packs only), which is how detection updates stay manual: new bundled
|
|
22740
|
+
// rules run only after the user applies the pack update. Absent/false keeps
|
|
22741
|
+
// the historical composition (bundled packs + rules) — older caches.
|
|
22742
|
+
rulesComplete: external_exports.boolean().optional(),
|
|
22743
|
+
// Active detection exceptions, evaluation subset only (see
|
|
22744
|
+
// ExceptionBundleEntry). Optional so older bundle producers — and older
|
|
22745
|
+
// on-disk caches — that omit the field still parse; consumers read
|
|
22746
|
+
// `bundle.exceptions ?? []`.
|
|
22747
|
+
exceptions: external_exports.array(ExceptionBundleEntry).optional(),
|
|
22748
|
+
// Rule ids whose pack is assigned a REVERSIBLE archetype (Redact & Vault).
|
|
22749
|
+
// A second axis over the same `redact` action, carried beside the policies
|
|
22750
|
+
// rather than on them: nothing writes ruleId-targeted policies to disk, so
|
|
22751
|
+
// widening Policy itself would change a persisted shape to express something
|
|
22752
|
+
// only the in-memory bundle needs. Optional so an older producer — or an
|
|
22753
|
+
// older on-disk cache — still parses; consumers read `?? []` and get the
|
|
22754
|
+
// pre-existing one-way behaviour, which is the safe direction to default.
|
|
22755
|
+
reversibleRuleIds: external_exports.array(external_exports.string()).optional(),
|
|
22756
|
+
// Installed pack version, keyed by ruleId, for rules in `rules` that came
|
|
22757
|
+
// from a versioned installed pack. Optional so older backends — and older
|
|
22758
|
+
// on-disk caches — that omit the field still parse; consumers fall back to
|
|
22759
|
+
// the rule's own spec version. NOT the bundle version above — see
|
|
22760
|
+
// installedRuleset's ruleVersions for the source of truth.
|
|
22761
|
+
ruleVersions: external_exports.record(external_exports.string(), external_exports.string()).optional(),
|
|
22762
|
+
// Model ids (the raw `model` string a harness reports, e.g.
|
|
22763
|
+
// `claude-opus-4-1`) the tenant has PROHIBITED. The plugin refuses to switch
|
|
22764
|
+
// a session onto one (PreModelSwitch) and refuses a turn that would run on
|
|
22765
|
+
// one (UserPromptSubmit). Optional so an older backend — and an older
|
|
22766
|
+
// on-disk cache — still parses; consumers read `?? []`, which is the
|
|
22767
|
+
// unenforced behaviour that predates this field and the safe direction to
|
|
22768
|
+
// default.
|
|
22769
|
+
//
|
|
22770
|
+
// Ids, not display names: the governance decision is keyed on the exact
|
|
22771
|
+
// string the harness reports (`model_status_override.versionId` in the
|
|
22772
|
+
// control plane), so no name resolution stands between the decision and the
|
|
22773
|
+
// comparison.
|
|
22774
|
+
prohibitedModels: external_exports.array(external_exports.string()).optional(),
|
|
22775
|
+
customKeywords: external_exports.array(external_exports.string()),
|
|
22776
|
+
fetchedAt: external_exports.iso.datetime()
|
|
22777
|
+
}).meta({ id: "PolicyBundle" });
|
|
22778
|
+
var POLICY_BUNDLE_SHAPE_ID = [
|
|
22779
|
+
...Object.keys(PolicyBundle.shape),
|
|
22780
|
+
...Object.keys(Policy.shape).map((key) => `policies.${key}`),
|
|
22781
|
+
...PolicyTarget.options.flatMap((member) => "shape" in member ? Object.keys(member.shape) : []).map((key) => `policies.target.${key}`),
|
|
22782
|
+
...Object.keys(ExceptionBundleEntry.shape).map((key) => `exceptions.${key}`)
|
|
22783
|
+
].sort().join(",");
|
|
22784
|
+
var OBSERVE_ONLY_CATEGORIES = ["config"];
|
|
22785
|
+
var ENFORCEABLE_CATEGORIES = DetectionCategory.options.filter((c) => !OBSERVE_ONLY_CATEGORIES.includes(c));
|
|
22786
|
+
var CATEGORY_PEAK_SEVERITY = {
|
|
22787
|
+
secret: "critical",
|
|
22788
|
+
financial: "critical",
|
|
22789
|
+
// core-financial/credit-card
|
|
22790
|
+
code_flaw: "critical",
|
|
22791
|
+
pii: "high",
|
|
22792
|
+
phi: "high",
|
|
22793
|
+
custom: "high",
|
|
22794
|
+
// user-defined; conservative
|
|
22795
|
+
code_context: "low",
|
|
22796
|
+
config: "low"
|
|
22797
|
+
// observe-only; floors to monitor regardless
|
|
22798
|
+
};
|
|
22799
|
+
function severityFloorPolicy(category) {
|
|
22800
|
+
if (OBSERVE_ONLY_CATEGORIES.includes(category)) return "monitor";
|
|
22801
|
+
const peak = CATEGORY_PEAK_SEVERITY[category];
|
|
22802
|
+
return peak === "critical" || peak === "high" ? "warn" : "monitor";
|
|
22803
|
+
}
|
|
22804
|
+
var KNOWN_BUILTIN_IDS = ["monitor", "warn", "redact", "vault", "block"];
|
|
22805
|
+
var BuiltinPolicyId = external_exports.enum(KNOWN_BUILTIN_IDS).meta({ id: "BuiltinPolicyId" });
|
|
22806
|
+
var RedactFallback = BuiltinPolicyId.extract(["monitor", "warn", "block"]).meta({
|
|
22807
|
+
id: "RedactFallback"
|
|
22808
|
+
});
|
|
22809
|
+
var BUILTIN_POLICY_SPECS = {
|
|
22810
|
+
monitor: {
|
|
22811
|
+
name: "Monitor",
|
|
22812
|
+
action: "log",
|
|
22813
|
+
reversible: false,
|
|
22814
|
+
description: "Log every match for audit. The request is allowed through untouched."
|
|
22815
|
+
},
|
|
22816
|
+
warn: {
|
|
22817
|
+
name: "Warn",
|
|
22818
|
+
action: "warn",
|
|
22819
|
+
reversible: false,
|
|
22820
|
+
description: "Allow the request, but warn the user inline before it is sent."
|
|
22821
|
+
},
|
|
22822
|
+
redact: {
|
|
22823
|
+
name: "Redact",
|
|
22824
|
+
action: "redact",
|
|
22825
|
+
reversible: false,
|
|
22826
|
+
description: "Strip the matched value from the request and destroy it, then continue. What was removed cannot be recovered."
|
|
22827
|
+
},
|
|
22828
|
+
vault: {
|
|
22829
|
+
name: "Redact & Vault",
|
|
22830
|
+
action: "redact",
|
|
22831
|
+
reversible: true,
|
|
22832
|
+
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."
|
|
22833
|
+
},
|
|
22834
|
+
block: {
|
|
22835
|
+
name: "Block",
|
|
22836
|
+
action: "block",
|
|
22837
|
+
reversible: false,
|
|
22838
|
+
description: "Refuse the request entirely whenever any rule in this detection matches."
|
|
22839
|
+
}
|
|
22840
|
+
};
|
|
22841
|
+
function builtinPolicyToAction(id) {
|
|
22842
|
+
return BUILTIN_POLICY_SPECS[id].action;
|
|
22843
|
+
}
|
|
22844
|
+
var PALETTE_WEAKEST_FIRST = [
|
|
22845
|
+
...new Set(KNOWN_BUILTIN_IDS.map(builtinPolicyToAction))
|
|
22846
|
+
];
|
|
22847
|
+
var BELOW_PALETTE = ACTION_TAKEN_KEYS.filter(
|
|
22848
|
+
(action) => !PALETTE_WEAKEST_FIRST.includes(action)
|
|
22849
|
+
);
|
|
22850
|
+
var ACTION_STRENGTH_ORDER = [
|
|
22851
|
+
...BELOW_PALETTE,
|
|
22852
|
+
...PALETTE_WEAKEST_FIRST
|
|
22853
|
+
];
|
|
22854
|
+
var PackPolicyFloor = external_exports.object({
|
|
22855
|
+
/**
|
|
22856
|
+
* The weakest archetype the device may assign. Stated as a BuiltinPolicyId
|
|
22857
|
+
* rather than a raw ActionTaken because that is the vocabulary the user
|
|
22858
|
+
* picks from — a floor a UI cannot name is one it cannot explain.
|
|
22859
|
+
*/
|
|
22860
|
+
floor: BuiltinPolicyId,
|
|
22861
|
+
/**
|
|
22862
|
+
* True when the organization AUTHORED a policy governing this pack rather
|
|
22863
|
+
* than stating a minimum: it gave the answer, so the pack is not
|
|
22864
|
+
* re-assignable locally in either direction.
|
|
22865
|
+
*/
|
|
22866
|
+
locked: external_exports.boolean()
|
|
22867
|
+
}).describe("PackPolicyFloor");
|
|
22868
|
+
var CATEGORY_EXPRESSIBLE_IDS = KNOWN_BUILTIN_IDS.filter(
|
|
22869
|
+
(id) => !BUILTIN_POLICY_SPECS[id].reversible
|
|
22870
|
+
);
|
|
22871
|
+
var CATEGORY_INEXPRESSIBLE_IDS = KNOWN_BUILTIN_IDS.filter(
|
|
22872
|
+
(id) => BUILTIN_POLICY_SPECS[id].reversible
|
|
22873
|
+
);
|
|
22874
|
+
var CategoryPolicyId = external_exports.enum(CATEGORY_EXPRESSIBLE_IDS).meta({ id: "CategoryPolicyId" });
|
|
22875
|
+
var DEFAULT_ACTIONS = Object.fromEntries(
|
|
22876
|
+
DetectionCategory.options.map((c) => [c, builtinPolicyToAction(severityFloorPolicy(c))])
|
|
22877
|
+
);
|
|
22878
|
+
var BUILTIN_POLICIES = Object.fromEntries(
|
|
22879
|
+
KNOWN_BUILTIN_IDS.map((id) => [id, { id, ...BUILTIN_POLICY_SPECS[id] }])
|
|
22880
|
+
);
|
|
22881
|
+
var UsedByItem = external_exports.object({
|
|
22882
|
+
id: external_exports.string(),
|
|
22883
|
+
name: external_exports.string(),
|
|
22884
|
+
ruleCount: external_exports.number().int().nonnegative(),
|
|
22885
|
+
enabled: external_exports.boolean()
|
|
22886
|
+
}).meta({ id: "UsedByItem" });
|
|
22887
|
+
var PolicyListItem = external_exports.object({
|
|
22888
|
+
id: external_exports.string(),
|
|
22889
|
+
kind: PolicyKind,
|
|
22890
|
+
name: external_exports.string(),
|
|
22891
|
+
enabled: external_exports.boolean(),
|
|
22892
|
+
usedByCount: external_exports.number().int().nonnegative()
|
|
22893
|
+
}).meta({ id: "PolicyListItem" });
|
|
22894
|
+
var ListPoliciesResponse = external_exports.object({ items: external_exports.array(PolicyListItem) }).meta({ id: "ListPoliciesResponse" });
|
|
22895
|
+
var PolicyDetail = external_exports.object({
|
|
22896
|
+
specVersion: external_exports.literal(1),
|
|
22897
|
+
id: external_exports.string(),
|
|
22898
|
+
kind: PolicyKind,
|
|
22899
|
+
name: external_exports.string(),
|
|
22900
|
+
enabled: external_exports.boolean(),
|
|
22901
|
+
description: external_exports.string(),
|
|
22902
|
+
usedBy: external_exports.array(UsedByItem)
|
|
22903
|
+
}).meta({ id: "PolicyDetail" });
|
|
22904
|
+
var PolicyStatsResponse = external_exports.object({
|
|
22905
|
+
policies: external_exports.number().int().nonnegative(),
|
|
22906
|
+
builtin: external_exports.number().int().nonnegative(),
|
|
22907
|
+
custom: external_exports.number().int().nonnegative(),
|
|
22908
|
+
detectionsGoverned: external_exports.number().int().nonnegative()
|
|
22909
|
+
}).meta({ id: "PolicyStatsResponse" });
|
|
22910
|
+
|
|
22607
22911
|
// ../../packages/schema/src/zod/vault.ts
|
|
22608
22912
|
var CATEGORY_ALTERNATION = DetectionCategory.options.join("|");
|
|
22609
22913
|
var POINTER_TOKEN_PATTERN = new RegExp(
|
|
@@ -22640,6 +22944,14 @@ var VaultEntry = external_exports.object({
|
|
|
22640
22944
|
// How many times this value has been detected on this machine — the reuse
|
|
22641
22945
|
// signal the vault dashboard reads. Distinct from VaultDeref.pointerCount.
|
|
22642
22946
|
occurrenceCount: external_exports.number().int().nonnegative(),
|
|
22947
|
+
// True when a PERSON asked for this value to be replaced — the surfaced-
|
|
22948
|
+
// secrets strike — rather than a pack enforcing its assignment. One value is
|
|
22949
|
+
// one row however many paths vault it, so this is what tells a policy sweep
|
|
22950
|
+
// that the row carries somebody's own instruction and not just an assignment
|
|
22951
|
+
// that has since been lowered. STICKY and MONOTONIC: a later automatic
|
|
22952
|
+
// vaulting of the same value must never clear it — what the user said about
|
|
22953
|
+
// the value does not expire.
|
|
22954
|
+
userAuthorized: external_exports.boolean(),
|
|
22643
22955
|
firstSeen: external_exports.string(),
|
|
22644
22956
|
lastSeen: external_exports.string()
|
|
22645
22957
|
});
|
|
@@ -22755,7 +23067,7 @@ var VaultConsent = external_exports.object({
|
|
|
22755
23067
|
});
|
|
22756
23068
|
|
|
22757
23069
|
// ../../packages/schema/src/zod/local.ts
|
|
22758
|
-
var WORKSPACE_SETTINGS_SPEC_VERSION =
|
|
23070
|
+
var WORKSPACE_SETTINGS_SPEC_VERSION = 7;
|
|
22759
23071
|
var RunMode = external_exports.enum(["standalone", "attached"]);
|
|
22760
23072
|
var ControlPlaneConnection = external_exports.object({
|
|
22761
23073
|
endpoint: external_exports.string().min(1),
|
|
@@ -22796,6 +23108,19 @@ var WorkspaceSettings = external_exports.object({
|
|
|
22796
23108
|
vaultKeyCustody: VaultKeyCustody.default("file"),
|
|
22797
23109
|
// How a pointer renders in assistant prose on screen (see VaultInlineReveal).
|
|
22798
23110
|
vaultInlineReveal: VaultInlineReveal.default("masked"),
|
|
23111
|
+
// What a `redact` policy degrades to on a FIELD the host cannot rewrite in
|
|
23112
|
+
// place. Not a handling policy: the policy has already resolved to redact,
|
|
23113
|
+
// and this only says what happens when the host offers no channel to carry it
|
|
23114
|
+
// out — Antigravity's PreToolUse has no updatedInput at all, and Codex and
|
|
23115
|
+
// Claude Code decline to mask a field that EXECUTES because masking would
|
|
23116
|
+
// change what runs. Per FIELD rather than per host, so a host that can
|
|
23117
|
+
// rewrite some inputs keeps true redaction on those.
|
|
23118
|
+
//
|
|
23119
|
+
// Spelled in the built-in policy vocabulary rather than as a fresh enum, so
|
|
23120
|
+
// an attached machine's merge is `strongerAction` over the one action ladder
|
|
23121
|
+
// and no second rank order exists to drift from it. 'deny' is a host wire
|
|
23122
|
+
// word and stays out of the stored value.
|
|
23123
|
+
redactFallback: RedactFallback.default("warn"),
|
|
22799
23124
|
// Absent until /aka:setup completes; its presence is what "onboarded" means.
|
|
22800
23125
|
onboardedAt: external_exports.iso.datetime().optional(),
|
|
22801
23126
|
// Records that the user consented to sending findings to the model API for
|
|
@@ -22803,10 +23128,12 @@ var WorkspaceSettings = external_exports.object({
|
|
|
22803
23128
|
// Absent until granted; a stale payloadVersion means the consent no longer
|
|
22804
23129
|
// covers the current payload and must be re-granted.
|
|
22805
23130
|
modelJudgeConsent: ModelJudgeConsent.optional(),
|
|
22806
|
-
// Records that the user consented to
|
|
22807
|
-
//
|
|
22808
|
-
//
|
|
22809
|
-
//
|
|
23131
|
+
// Records that the user consented to the DEFERRED send — the outbox — along
|
|
23132
|
+
// with the payload shape and the endpoint they agreed to. Since payload v3
|
|
23133
|
+
// that covers the pre-attach backlog AND undelivered captures alike, and both
|
|
23134
|
+
// carry prompt/reply/tool-output text in `content`; the key name predates
|
|
23135
|
+
// both widenings. Absent until granted, and a grant for a different endpoint
|
|
23136
|
+
// or an older payload no longer counts.
|
|
22810
23137
|
historySyncConsent: HistorySyncConsent.optional()
|
|
22811
23138
|
});
|
|
22812
23139
|
|
|
@@ -22819,8 +23146,12 @@ var ManagedSettingKey = external_exports.enum([
|
|
|
22819
23146
|
"vaultKeyCustody",
|
|
22820
23147
|
"vaultInlineReveal",
|
|
22821
23148
|
"modelJudgeConsent",
|
|
22822
|
-
"dataSharesInPlace"
|
|
23149
|
+
"dataSharesInPlace",
|
|
23150
|
+
"redactFallback"
|
|
22823
23151
|
]).meta({ id: "ManagedSettingKey" });
|
|
23152
|
+
function isManagedSettingKey(value) {
|
|
23153
|
+
return ManagedSettingKey.safeParse(value).success;
|
|
23154
|
+
}
|
|
22824
23155
|
var ManagedSettingsValues = external_exports.object({
|
|
22825
23156
|
runMode: external_exports.enum(["standalone", "attached"]).optional(),
|
|
22826
23157
|
controlPlane: external_exports.object({
|
|
@@ -22832,7 +23163,8 @@ var ManagedSettingsValues = external_exports.object({
|
|
|
22832
23163
|
vaultKeyCustody: external_exports.enum(["file", "keychain"]).optional(),
|
|
22833
23164
|
vaultInlineReveal: external_exports.enum(["masked", "full", "off"]).optional(),
|
|
22834
23165
|
modelJudgeConsent: external_exports.boolean().optional(),
|
|
22835
|
-
dataSharesInPlace: external_exports.boolean().optional()
|
|
23166
|
+
dataSharesInPlace: external_exports.boolean().optional(),
|
|
23167
|
+
redactFallback: RedactFallback.optional()
|
|
22836
23168
|
}).meta({ id: "ManagedSettingsValues" });
|
|
22837
23169
|
var ManagedSettings = external_exports.object({
|
|
22838
23170
|
specVersion: external_exports.number().int().positive().default(MANAGED_SETTINGS_SPEC_VERSION),
|
|
@@ -22844,173 +23176,28 @@ var ManagedSettings = external_exports.object({
|
|
|
22844
23176
|
// Which of those the user may not change. A key here with no matching value
|
|
22845
23177
|
// freezes whatever the user last chose; a value with no lock is a DEFAULT
|
|
22846
23178
|
// the user may still override. The two are separable on purpose.
|
|
22847
|
-
lockedFields: external_exports.array(ManagedSettingKey).default([])
|
|
22848
|
-
}).meta({ id: "ManagedSettings" });
|
|
22849
|
-
|
|
22850
|
-
// ../../packages/schema/src/zod/policy.ts
|
|
22851
|
-
var PolicyScope = external_exports.enum(["global", "repo", "user"]).meta({ id: "PolicyScope" });
|
|
22852
|
-
var PolicyTarget = external_exports.union([external_exports.object({ ruleId: external_exports.string() }), external_exports.object({ category: DetectionCategory })]).meta({ id: "PolicyTarget" });
|
|
22853
|
-
var Policy = external_exports.object({
|
|
22854
|
-
id: external_exports.guid(),
|
|
22855
|
-
scope: PolicyScope,
|
|
22856
|
-
target: PolicyTarget,
|
|
22857
|
-
action: ActionTaken,
|
|
22858
|
-
enabled: external_exports.boolean().default(true),
|
|
22859
|
-
customKeywords: external_exports.array(external_exports.string()).optional(),
|
|
22860
|
-
// Display name — optional so older policy rows without name still parse.
|
|
22861
|
-
// Added for the findings API (policy.name column migration).
|
|
22862
|
-
name: external_exports.string().optional()
|
|
22863
|
-
}).meta({ id: "Policy" });
|
|
22864
|
-
var PolicyBundle = external_exports.object({
|
|
22865
|
-
version: external_exports.string(),
|
|
22866
|
-
policies: external_exports.array(Policy),
|
|
22867
|
-
// Rules from the installed marketplace packs (snapshotted by the
|
|
22868
|
-
// control plane). The plugin registers these in addition to its bundled
|
|
22869
|
-
// packs. Optional so older backends — and older on-disk caches — that omit
|
|
22870
|
-
// the field still parse; consumers read `bundle.rules ?? []`.
|
|
22871
|
-
rules: external_exports.array(Rule).optional(),
|
|
22872
|
-
// When true, `rules` IS the complete effective ruleset and the runtime must
|
|
22873
|
-
// NOT merge its compiled-in bundled packs — the standalone gateway sets this
|
|
22874
|
-
// after reading the user's installed snapshot (installed_packs, enabled
|
|
22875
|
-
// packs only), which is how detection updates stay manual: new bundled
|
|
22876
|
-
// rules run only after the user applies the pack update. Absent/false keeps
|
|
22877
|
-
// the historical composition (bundled packs + rules) — older caches.
|
|
22878
|
-
rulesComplete: external_exports.boolean().optional(),
|
|
22879
|
-
// Active detection exceptions, evaluation subset only (see
|
|
22880
|
-
// ExceptionBundleEntry). Optional so older bundle producers — and older
|
|
22881
|
-
// on-disk caches — that omit the field still parse; consumers read
|
|
22882
|
-
// `bundle.exceptions ?? []`.
|
|
22883
|
-
exceptions: external_exports.array(ExceptionBundleEntry).optional(),
|
|
22884
|
-
// Rule ids whose pack is assigned a REVERSIBLE archetype (Redact & Vault).
|
|
22885
|
-
// A second axis over the same `redact` action, carried beside the policies
|
|
22886
|
-
// rather than on them: nothing writes ruleId-targeted policies to disk, so
|
|
22887
|
-
// widening Policy itself would change a persisted shape to express something
|
|
22888
|
-
// only the in-memory bundle needs. Optional so an older producer — or an
|
|
22889
|
-
// older on-disk cache — still parses; consumers read `?? []` and get the
|
|
22890
|
-
// pre-existing one-way behaviour, which is the safe direction to default.
|
|
22891
|
-
reversibleRuleIds: external_exports.array(external_exports.string()).optional(),
|
|
22892
|
-
// Installed pack version, keyed by ruleId, for rules in `rules` that came
|
|
22893
|
-
// from a versioned installed pack. Optional so older backends — and older
|
|
22894
|
-
// on-disk caches — that omit the field still parse; consumers fall back to
|
|
22895
|
-
// the rule's own spec version. NOT the bundle version above — see
|
|
22896
|
-
// installedRuleset's ruleVersions for the source of truth.
|
|
22897
|
-
ruleVersions: external_exports.record(external_exports.string(), external_exports.string()).optional(),
|
|
22898
|
-
// Model ids (the raw `model` string a harness reports, e.g.
|
|
22899
|
-
// `claude-opus-4-1`) the tenant has PROHIBITED. The plugin refuses to switch
|
|
22900
|
-
// a session onto one (PreModelSwitch) and refuses a turn that would run on
|
|
22901
|
-
// one (UserPromptSubmit). Optional so an older backend — and an older
|
|
22902
|
-
// on-disk cache — still parses; consumers read `?? []`, which is the
|
|
22903
|
-
// unenforced behaviour that predates this field and the safe direction to
|
|
22904
|
-
// default.
|
|
22905
23179
|
//
|
|
22906
|
-
//
|
|
22907
|
-
//
|
|
22908
|
-
//
|
|
22909
|
-
//
|
|
22910
|
-
|
|
22911
|
-
|
|
22912
|
-
|
|
22913
|
-
|
|
22914
|
-
|
|
22915
|
-
|
|
22916
|
-
|
|
22917
|
-
|
|
22918
|
-
|
|
22919
|
-
|
|
22920
|
-
code_flaw: "critical",
|
|
22921
|
-
pii: "high",
|
|
22922
|
-
phi: "high",
|
|
22923
|
-
custom: "high",
|
|
22924
|
-
// user-defined; conservative
|
|
22925
|
-
code_context: "low",
|
|
22926
|
-
config: "low"
|
|
22927
|
-
// observe-only; floors to monitor regardless
|
|
22928
|
-
};
|
|
22929
|
-
function severityFloorPolicy(category) {
|
|
22930
|
-
if (OBSERVE_ONLY_CATEGORIES.includes(category)) return "monitor";
|
|
22931
|
-
const peak = CATEGORY_PEAK_SEVERITY[category];
|
|
22932
|
-
return peak === "critical" || peak === "high" ? "warn" : "monitor";
|
|
22933
|
-
}
|
|
22934
|
-
var PolicyKind = external_exports.enum(["builtin", "custom"]).meta({ id: "PolicyKind" });
|
|
22935
|
-
var KNOWN_BUILTIN_IDS = ["monitor", "warn", "redact", "vault", "block"];
|
|
22936
|
-
var BuiltinPolicyId = external_exports.enum(KNOWN_BUILTIN_IDS).meta({ id: "BuiltinPolicyId" });
|
|
22937
|
-
var BUILTIN_POLICY_SPECS = {
|
|
22938
|
-
monitor: {
|
|
22939
|
-
name: "Monitor",
|
|
22940
|
-
action: "log",
|
|
22941
|
-
reversible: false,
|
|
22942
|
-
description: "Log every match for audit. The request is allowed through untouched."
|
|
22943
|
-
},
|
|
22944
|
-
warn: {
|
|
22945
|
-
name: "Warn",
|
|
22946
|
-
action: "warn",
|
|
22947
|
-
reversible: false,
|
|
22948
|
-
description: "Allow the request, but warn the user inline before it is sent."
|
|
22949
|
-
},
|
|
22950
|
-
redact: {
|
|
22951
|
-
name: "Redact",
|
|
22952
|
-
action: "redact",
|
|
22953
|
-
reversible: false,
|
|
22954
|
-
description: "Strip the matched value from the request and destroy it, then continue. What was removed cannot be recovered."
|
|
22955
|
-
},
|
|
22956
|
-
vault: {
|
|
22957
|
-
name: "Redact & Vault",
|
|
22958
|
-
action: "redact",
|
|
22959
|
-
reversible: true,
|
|
22960
|
-
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."
|
|
22961
|
-
},
|
|
22962
|
-
block: {
|
|
22963
|
-
name: "Block",
|
|
22964
|
-
action: "block",
|
|
22965
|
-
reversible: false,
|
|
22966
|
-
description: "Refuse the request entirely whenever any rule in this detection matches."
|
|
23180
|
+
// Parsed as NAMES rather than as the enum, and split below: a name this
|
|
23181
|
+
// build does not know is dropped from the locked set and reported, never a
|
|
23182
|
+
// reason to refuse the file. The same shape reaches an older build whenever
|
|
23183
|
+
// an administrator locks a key a newer build added, and refusing it there
|
|
23184
|
+
// ran that build entirely unmanaged — every pin and lock gone — on exactly
|
|
23185
|
+
// the fleets most likely to carry a version skew. A name outside the enum
|
|
23186
|
+
// is still never HONOURED: the lockable set stays explicit above.
|
|
23187
|
+
lockedFields: external_exports.array(external_exports.string()).default([])
|
|
23188
|
+
}).transform(({ lockedFields, ...rest }) => {
|
|
23189
|
+
const known = [];
|
|
23190
|
+
const unknown2 = [];
|
|
23191
|
+
for (const name of lockedFields) {
|
|
23192
|
+
if (isManagedSettingKey(name)) known.push(name);
|
|
23193
|
+
else unknown2.push(name);
|
|
22967
23194
|
}
|
|
22968
|
-
|
|
22969
|
-
|
|
22970
|
-
|
|
22971
|
-
}
|
|
22972
|
-
|
|
22973
|
-
|
|
22974
|
-
);
|
|
22975
|
-
var CATEGORY_INEXPRESSIBLE_IDS = KNOWN_BUILTIN_IDS.filter(
|
|
22976
|
-
(id) => BUILTIN_POLICY_SPECS[id].reversible
|
|
22977
|
-
);
|
|
22978
|
-
var CategoryPolicyId = external_exports.enum(CATEGORY_EXPRESSIBLE_IDS).meta({ id: "CategoryPolicyId" });
|
|
22979
|
-
var DEFAULT_ACTIONS = Object.fromEntries(
|
|
22980
|
-
DetectionCategory.options.map((c) => [c, builtinPolicyToAction(severityFloorPolicy(c))])
|
|
22981
|
-
);
|
|
22982
|
-
var BUILTIN_POLICIES = Object.fromEntries(
|
|
22983
|
-
KNOWN_BUILTIN_IDS.map((id) => [id, { id, ...BUILTIN_POLICY_SPECS[id] }])
|
|
22984
|
-
);
|
|
22985
|
-
var UsedByItem = external_exports.object({
|
|
22986
|
-
id: external_exports.string(),
|
|
22987
|
-
name: external_exports.string(),
|
|
22988
|
-
ruleCount: external_exports.number().int().nonnegative(),
|
|
22989
|
-
enabled: external_exports.boolean()
|
|
22990
|
-
}).meta({ id: "UsedByItem" });
|
|
22991
|
-
var PolicyListItem = external_exports.object({
|
|
22992
|
-
id: external_exports.string(),
|
|
22993
|
-
kind: PolicyKind,
|
|
22994
|
-
name: external_exports.string(),
|
|
22995
|
-
enabled: external_exports.boolean(),
|
|
22996
|
-
usedByCount: external_exports.number().int().nonnegative()
|
|
22997
|
-
}).meta({ id: "PolicyListItem" });
|
|
22998
|
-
var ListPoliciesResponse = external_exports.object({ items: external_exports.array(PolicyListItem) }).meta({ id: "ListPoliciesResponse" });
|
|
22999
|
-
var PolicyDetail = external_exports.object({
|
|
23000
|
-
specVersion: external_exports.literal(1),
|
|
23001
|
-
id: external_exports.string(),
|
|
23002
|
-
kind: PolicyKind,
|
|
23003
|
-
name: external_exports.string(),
|
|
23004
|
-
enabled: external_exports.boolean(),
|
|
23005
|
-
description: external_exports.string(),
|
|
23006
|
-
usedBy: external_exports.array(UsedByItem)
|
|
23007
|
-
}).meta({ id: "PolicyDetail" });
|
|
23008
|
-
var PolicyStatsResponse = external_exports.object({
|
|
23009
|
-
policies: external_exports.number().int().nonnegative(),
|
|
23010
|
-
builtin: external_exports.number().int().nonnegative(),
|
|
23011
|
-
custom: external_exports.number().int().nonnegative(),
|
|
23012
|
-
detectionsGoverned: external_exports.number().int().nonnegative()
|
|
23013
|
-
}).meta({ id: "PolicyStatsResponse" });
|
|
23195
|
+
return {
|
|
23196
|
+
...rest,
|
|
23197
|
+
lockedFields: known,
|
|
23198
|
+
...unknown2.length > 0 ? { unknownLockedFields: unknown2 } : {}
|
|
23199
|
+
};
|
|
23200
|
+
}).meta({ id: "ManagedSettings" });
|
|
23014
23201
|
|
|
23015
23202
|
// ../../packages/schema/src/zod/project-files.ts
|
|
23016
23203
|
var ProjectFileInput = external_exports.object({
|
|
@@ -23127,7 +23314,11 @@ var FindingsTimeseriesPoint = external_exports.object({
|
|
|
23127
23314
|
timestamp: external_exports.iso.date(),
|
|
23128
23315
|
critical: external_exports.number().int().nonnegative(),
|
|
23129
23316
|
high: external_exports.number().int().nonnegative(),
|
|
23130
|
-
medium: external_exports.number().int().nonnegative()
|
|
23317
|
+
medium: external_exports.number().int().nonnegative(),
|
|
23318
|
+
// Optional and additive, so a producer written against the earlier
|
|
23319
|
+
// three-series contract keeps validating. A consumer plotting it resolves the
|
|
23320
|
+
// absent case itself — the chart point requires a number.
|
|
23321
|
+
low: external_exports.number().int().nonnegative().optional()
|
|
23131
23322
|
}).meta({ id: "FindingsTimeseriesPoint" });
|
|
23132
23323
|
var FindingsTimeseriesResponse = external_exports.object({
|
|
23133
23324
|
range: TimeRange,
|
|
@@ -23153,6 +23344,10 @@ var ResolvedFeedItem = external_exports.object({
|
|
|
23153
23344
|
findingKey: external_exports.string(),
|
|
23154
23345
|
ruleId: external_exports.string(),
|
|
23155
23346
|
severity: Severity,
|
|
23347
|
+
// Repository slug, and the file path RELATIVE to it. The pair is what
|
|
23348
|
+
// identifies the file: a bare path matches the same name in every repo.
|
|
23349
|
+
// Optional and additive; empty when the event carried no repo.
|
|
23350
|
+
repo: external_exports.string().optional(),
|
|
23156
23351
|
path: external_exports.string(),
|
|
23157
23352
|
// ISO-8601 datetime (matches FindingInstance.detectedAt / the rest of the
|
|
23158
23353
|
// findings domain). The reader `.toISOString()`s the DB epoch-ms values.
|
|
@@ -23251,10 +23446,12 @@ var DismissRecommendedActionResponse = external_exports.object({ id: external_ex
|
|
|
23251
23446
|
var RecommendedActionIdParam = external_exports.object({ id: external_exports.string() });
|
|
23252
23447
|
|
|
23253
23448
|
// ../../packages/schema/src/zod/settings-action.ts
|
|
23449
|
+
var HistorySyncConsentChoice = external_exports.enum(["granted", "revoked", "unchanged"]).meta({ id: "HistorySyncConsentChoice" });
|
|
23450
|
+
var ModelJudgeConsentChoice = external_exports.enum(["granted", "revoked", "unchanged"]).meta({ id: "ModelJudgeConsentChoice" });
|
|
23254
23451
|
var SaveSettingsInput = external_exports.object({
|
|
23255
23452
|
historicalAccess: external_exports.string(),
|
|
23256
|
-
modelJudgeConsent:
|
|
23257
|
-
historySyncConsent:
|
|
23453
|
+
modelJudgeConsent: ModelJudgeConsentChoice,
|
|
23454
|
+
historySyncConsent: HistorySyncConsentChoice,
|
|
23258
23455
|
vaultConsent: external_exports.string(),
|
|
23259
23456
|
vaultInlineReveal: external_exports.string()
|
|
23260
23457
|
});
|