@akasecurity/ai-tc-claude-code 0.9.5 → 0.9.7
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/package.json +7 -6
- package/scripts/apply-suppressions.js +1480 -974
- package/scripts/backfill.js +1589 -1023
- package/scripts/dashboard.js +131 -10
- package/scripts/filescan.js +1519 -1021
- package/scripts/firstrun.js +1358 -908
- package/scripts/intro.js +1048 -898
- package/scripts/message-display.js +1453 -980
- package/scripts/onboard.js +1378 -895
- package/scripts/post-tool-use.js +1575 -1009
- package/scripts/pre-tool-use.js +1580 -1014
- package/scripts/query.js +1420 -965
- package/scripts/reconcile.js +1538 -1013
- package/scripts/remediate.js +1585 -1019
- package/scripts/scan-worker.js +1056 -927
- package/scripts/session-start.js +1499 -1014
- package/scripts/start-light.js +1058 -909
- package/scripts/statusline.js +1357 -907
- package/scripts/stop.js +1113 -898
- package/scripts/user-prompt-submit.js +1791 -1207
package/scripts/stop.js
CHANGED
|
@@ -15070,6 +15070,47 @@ function date4(params) {
|
|
|
15070
15070
|
// ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/external.js
|
|
15071
15071
|
config(en_default());
|
|
15072
15072
|
|
|
15073
|
+
// ../../packages/schema/src/zod/harness-map.ts
|
|
15074
|
+
var HARNESS = {
|
|
15075
|
+
ClaudeCode: "claudecode",
|
|
15076
|
+
Cursor: "cursor",
|
|
15077
|
+
Copilot: "copilot",
|
|
15078
|
+
Codex: "codex",
|
|
15079
|
+
Antigravity: "antigravity",
|
|
15080
|
+
Windsurf: "windsurf",
|
|
15081
|
+
ClaudeDesktop: "claudedesktop",
|
|
15082
|
+
ChatGpt: "chatgpt",
|
|
15083
|
+
ClaudeAi: "claudeai",
|
|
15084
|
+
Api: "api"
|
|
15085
|
+
};
|
|
15086
|
+
var Harness = external_exports.enum(HARNESS).meta({ id: "Harness" });
|
|
15087
|
+
var SOURCE_TOOL = {
|
|
15088
|
+
ClaudeCode: "claude-code",
|
|
15089
|
+
ClaudeDesktop: "claude-desktop",
|
|
15090
|
+
Cursor: "cursor",
|
|
15091
|
+
ChatGpt: "chatgpt",
|
|
15092
|
+
ClaudeAi: "claude-ai",
|
|
15093
|
+
Copilot: "github-copilot",
|
|
15094
|
+
Codex: "codex",
|
|
15095
|
+
Antigravity: "antigravity",
|
|
15096
|
+
// No harness counterpart, deliberately: the CLI's own captures and a capture
|
|
15097
|
+
// whose tool could not be identified both render through the read side's
|
|
15098
|
+
// miss path rather than as a harness of their own.
|
|
15099
|
+
Cli: "cli",
|
|
15100
|
+
Unknown: "unknown"
|
|
15101
|
+
};
|
|
15102
|
+
var SourceTool = external_exports.enum(SOURCE_TOOL).meta({ id: "SourceTool" });
|
|
15103
|
+
var TOOL_TO_HARNESS = {
|
|
15104
|
+
[SOURCE_TOOL.ClaudeCode]: HARNESS.ClaudeCode,
|
|
15105
|
+
[SOURCE_TOOL.ClaudeDesktop]: HARNESS.ClaudeDesktop,
|
|
15106
|
+
[SOURCE_TOOL.Copilot]: HARNESS.Copilot,
|
|
15107
|
+
[SOURCE_TOOL.Cursor]: HARNESS.Cursor,
|
|
15108
|
+
[SOURCE_TOOL.ChatGpt]: HARNESS.ChatGpt,
|
|
15109
|
+
[SOURCE_TOOL.Codex]: HARNESS.Codex,
|
|
15110
|
+
[SOURCE_TOOL.Antigravity]: HARNESS.Antigravity,
|
|
15111
|
+
[SOURCE_TOOL.ClaudeAi]: HARNESS.ClaudeAi
|
|
15112
|
+
};
|
|
15113
|
+
|
|
15073
15114
|
// ../../packages/schema/src/zod/finding.ts
|
|
15074
15115
|
var DetectionCategory = external_exports.enum(["pii", "financial", "secret", "phi", "code_context", "code_flaw", "custom", "config"]).meta({ id: "DetectionCategory" });
|
|
15075
15116
|
var Severity = external_exports.enum(["critical", "high", "medium", "low"]).meta({ id: "Severity" });
|
|
@@ -15092,21 +15133,22 @@ var Finding = external_exports.object({
|
|
|
15092
15133
|
}).meta({ id: "Finding" });
|
|
15093
15134
|
var DetectedFinding = Finding.meta({ id: "DetectedFinding" });
|
|
15094
15135
|
var FindingAction = external_exports.enum(["blocked", "redacted", "warned", "allowed", "quarantined", "monitored"]).meta({ id: "FindingAction" });
|
|
15095
|
-
var FindingProvider =
|
|
15096
|
-
"
|
|
15097
|
-
"
|
|
15098
|
-
"
|
|
15099
|
-
"
|
|
15100
|
-
"
|
|
15101
|
-
"
|
|
15102
|
-
"
|
|
15103
|
-
"
|
|
15104
|
-
"
|
|
15136
|
+
var FindingProvider = Harness.extract([
|
|
15137
|
+
"ClaudeCode",
|
|
15138
|
+
"ClaudeDesktop",
|
|
15139
|
+
"Cursor",
|
|
15140
|
+
"Copilot",
|
|
15141
|
+
"ChatGpt",
|
|
15142
|
+
"ClaudeAi",
|
|
15143
|
+
"Codex",
|
|
15144
|
+
"Antigravity",
|
|
15145
|
+
"Api"
|
|
15105
15146
|
]).meta({ id: "FindingProvider" });
|
|
15106
15147
|
var FindingCategory = external_exports.enum([
|
|
15107
15148
|
"secret",
|
|
15108
15149
|
"pii",
|
|
15109
15150
|
"source_code",
|
|
15151
|
+
"code_flaw",
|
|
15110
15152
|
"external_share",
|
|
15111
15153
|
"mcp_server",
|
|
15112
15154
|
"customer_data",
|
|
@@ -15284,6 +15326,7 @@ var FindingInstanceDetail = FindingInstance.extend({
|
|
|
15284
15326
|
detection: FindingDetectionRef,
|
|
15285
15327
|
policy: FindingPolicyRef
|
|
15286
15328
|
}).meta({ id: "FindingInstanceDetail" });
|
|
15329
|
+
var MAX_FLAT_FINDINGS_LIMIT = 200;
|
|
15287
15330
|
var ListFindingInstancesQuery = external_exports.object({
|
|
15288
15331
|
severity: external_exports.array(Severity).optional(),
|
|
15289
15332
|
// Rule ids, the same vocabulary the grouped list's `subtype` carries.
|
|
@@ -15303,7 +15346,7 @@ var ListFindingInstancesQuery = external_exports.object({
|
|
|
15303
15346
|
q: external_exports.string().optional(),
|
|
15304
15347
|
sessionId: external_exports.string().optional(),
|
|
15305
15348
|
from: external_exports.iso.datetime().optional(),
|
|
15306
|
-
limit: external_exports.coerce.number().int().min(1).max(
|
|
15349
|
+
limit: external_exports.coerce.number().int().min(1).max(MAX_FLAT_FINDINGS_LIMIT).optional(),
|
|
15307
15350
|
cursor: external_exports.string().optional()
|
|
15308
15351
|
});
|
|
15309
15352
|
var ListFindingInstancesResponse = external_exports.object({
|
|
@@ -15365,20 +15408,6 @@ var ListFindingLocationsResponse = external_exports.object({
|
|
|
15365
15408
|
hasMore: external_exports.boolean()
|
|
15366
15409
|
}).meta({ id: "ListFindingLocationsResponse" });
|
|
15367
15410
|
|
|
15368
|
-
// ../../packages/schema/src/zod/harness-map.ts
|
|
15369
|
-
var Harness = external_exports.enum([
|
|
15370
|
-
"claudecode",
|
|
15371
|
-
"cursor",
|
|
15372
|
-
"copilot",
|
|
15373
|
-
"codex",
|
|
15374
|
-
"antigravity",
|
|
15375
|
-
"windsurf",
|
|
15376
|
-
"claudedesktop",
|
|
15377
|
-
"chatgpt",
|
|
15378
|
-
"claudeai",
|
|
15379
|
-
"api"
|
|
15380
|
-
]).meta({ id: "Harness" });
|
|
15381
|
-
|
|
15382
15411
|
// ../../packages/schema/src/zod/meta.ts
|
|
15383
15412
|
var InventoryObjectType = external_exports.enum(["host", "harness", "user", "skill", "hook", "mcp_server", "config_file"]).meta({ id: "InventoryObjectType" });
|
|
15384
15413
|
var AuditEventType = external_exports.enum([
|
|
@@ -15828,366 +15857,122 @@ var ActivityOverviewResponse = external_exports.object({
|
|
|
15828
15857
|
sessions: ListActivitySessionsResponse
|
|
15829
15858
|
}).meta({ id: "ActivityOverviewResponse" });
|
|
15830
15859
|
|
|
15831
|
-
// ../../packages/schema/src/zod/
|
|
15832
|
-
var
|
|
15833
|
-
var
|
|
15834
|
-
|
|
15835
|
-
|
|
15836
|
-
|
|
15837
|
-
|
|
15838
|
-
|
|
15839
|
-
|
|
15840
|
-
|
|
15841
|
-
|
|
15842
|
-
|
|
15843
|
-
|
|
15844
|
-
|
|
15845
|
-
|
|
15846
|
-
|
|
15847
|
-
|
|
15848
|
-
|
|
15849
|
-
filePath: external_exports.string().optional(),
|
|
15850
|
-
// The host tool whose input/output was scanned (e.g. 'Bash', 'WebFetch'),
|
|
15851
|
-
// set by the tool-scanning hooks. The tool NAME only — never the tool's
|
|
15852
|
-
// arguments or output, which can carry the very value a finding masked
|
|
15853
|
-
// (metadata is stored unredacted). Gives findings on non-file captures a
|
|
15854
|
-
// display location ("via Bash") when no filePath exists.
|
|
15855
|
-
toolName: external_exports.string().optional(),
|
|
15856
|
-
// Set (true) by the worktree scanner when the file is excluded by the
|
|
15857
|
-
// repo's .gitignore. Gitignored files ARE still scanned — local scratch and
|
|
15858
|
-
// generated code can leak real secrets — but the provenance is recorded so
|
|
15859
|
-
// policy/dashboards can treat those findings as informational rather than
|
|
15860
|
-
// blocking. Omitted (not false) for tracked files and non-scan events.
|
|
15861
|
-
gitignored: external_exports.boolean().optional(),
|
|
15862
|
-
// Set (true) ONLY when the event's `content` is the COMPLETE file at
|
|
15863
|
-
// capture time (a worktree scan reading from disk). Hook-captured edits
|
|
15864
|
-
// (e.g. an Edit tool's new_string) are partial fragments and MUST NOT set
|
|
15865
|
-
// this. The resolver-on-ingest keys its fixed-at-source dropout
|
|
15866
|
-
// diff on this marker: only a whole-file snapshot can prove a previously
|
|
15867
|
-
// open finding is gone; a fragment's absence proves nothing (the secret
|
|
15868
|
-
// may live outside the hunk). Omitted (not false) for fragments and
|
|
15869
|
-
// non-scan events, so pre-marker clients safely default to the
|
|
15870
|
-
// non-authoritative path.
|
|
15871
|
-
wholeFile: external_exports.boolean().optional(),
|
|
15872
|
-
model: external_exports.string().optional(),
|
|
15873
|
-
turnIndex: external_exports.number().int().nonnegative().optional(),
|
|
15874
|
-
// Distributed-tracing correlation. `correlationId` ties a recorded event back
|
|
15875
|
-
// to the request that captured/ingested it (a UUID, generated independently of
|
|
15876
|
-
// the trace id); `traceId` is the W3C trace id (32 lowercase hex chars) of the
|
|
15877
|
-
// originating span when telemetry is enabled. Both optional + backward
|
|
15878
|
-
// compatible — populated by the plugin (see @akasecurity/plugin-sdk).
|
|
15879
|
-
correlationId: external_exports.uuid().optional(),
|
|
15880
|
-
traceId: external_exports.string().regex(/^[0-9a-f]{32}$/).optional(),
|
|
15881
|
-
// Ids of the detection exceptions that downgraded findings in this capture
|
|
15882
|
-
// to 'allow' — the enforcement audit trail's link back to the grant that
|
|
15883
|
-
// authorized the bypass. Absent on captures where no exception applied.
|
|
15884
|
-
exceptionIds: external_exports.array(external_exports.guid()).optional()
|
|
15885
|
-
}).meta({ id: "EventMetadata" });
|
|
15886
|
-
var Event = external_exports.object({
|
|
15887
|
-
id: external_exports.guid(),
|
|
15888
|
-
sourceTool: SourceTool,
|
|
15889
|
-
kind: EventKind,
|
|
15890
|
-
occurredAt: external_exports.iso.datetime(),
|
|
15891
|
-
contentHash: external_exports.string(),
|
|
15892
|
-
content: external_exports.string(),
|
|
15893
|
-
metadata: EventMetadata.optional()
|
|
15894
|
-
}).meta({ id: "Event" });
|
|
15895
|
-
var IngestEvent = Event.meta({ id: "IngestEvent" });
|
|
15896
|
-
var IngestBatch = external_exports.object({
|
|
15897
|
-
events: external_exports.array(IngestEvent).min(1).max(100),
|
|
15898
|
-
// Dedup policy for this batch. Id-dedup ALWAYS applies. 'content-hash'
|
|
15899
|
-
// additionally rejects any event whose contentHash the store has already
|
|
15900
|
-
// recorded — for re-runnable bulk ingest (worktree scan, transcript
|
|
15901
|
-
// backfill), where a re-run mints fresh event ids for identical content and
|
|
15902
|
-
// would otherwise accumulate duplicates. Live hook traffic must NOT set it:
|
|
15903
|
-
// two genuinely separate prompts can be byte-identical and both belong on
|
|
15904
|
-
// the timeline.
|
|
15905
|
-
dedupe: external_exports.literal("content-hash").optional()
|
|
15906
|
-
}).meta({ id: "IngestBatch" });
|
|
15907
|
-
|
|
15908
|
-
// ../../packages/schema/src/zod/inventory.ts
|
|
15909
|
-
var AssetType = external_exports.enum(["project", "skill", "mcp", "hook", "config"]).meta({ id: "AssetType" });
|
|
15910
|
-
var AccessLevel = external_exports.enum(["open", "approved", "blocked"]).meta({ id: "AccessLevel" });
|
|
15911
|
-
var Origin = external_exports.enum(["source", "public-dep", "vendored", "config", "data", "docs", "generated"]).meta({ id: "Origin" });
|
|
15912
|
-
var TrustLevel = external_exports.enum(["known-good", "risky", "unapproved"]).meta({ id: "TrustLevel" });
|
|
15913
|
-
var Flag = external_exports.enum(["update", "stale", "conflict", "unknown", "change", "untracked", "risk", "findings"]).meta({ id: "Flag" });
|
|
15914
|
-
var Visibility = external_exports.enum(["public", "private"]).meta({ id: "Visibility" });
|
|
15915
|
-
var HarnessEventKind = external_exports.enum(["block", "redact", "warn"]).meta({ id: "HarnessEventKind" });
|
|
15916
|
-
var HarnessId = external_exports.enum(["claudecode", "cursor", "codex", "antigravity"]).meta({ id: "HarnessId" });
|
|
15917
|
-
var AccessCounts = external_exports.object({
|
|
15918
|
-
open: external_exports.number().int().nonnegative(),
|
|
15919
|
-
approved: external_exports.number().int().nonnegative(),
|
|
15920
|
-
blocked: external_exports.number().int().nonnegative(),
|
|
15921
|
-
total: external_exports.number().int().nonnegative()
|
|
15922
|
-
}).meta({ id: "AccessCounts" });
|
|
15923
|
-
var AssetSummary = external_exports.object({
|
|
15924
|
-
id: external_exports.string(),
|
|
15925
|
-
type: AssetType,
|
|
15926
|
-
name: external_exports.string(),
|
|
15927
|
-
sub: external_exports.string(),
|
|
15928
|
-
flags: external_exports.array(Flag),
|
|
15929
|
-
/** MCP servers only — omitted for all other types. */
|
|
15930
|
-
trust: TrustLevel.optional()
|
|
15931
|
-
}).meta({ id: "AssetSummary" });
|
|
15932
|
-
var ProjectSummary = external_exports.object({
|
|
15933
|
-
id: external_exports.string(),
|
|
15934
|
-
name: external_exports.string(),
|
|
15935
|
-
repo: external_exports.string(),
|
|
15936
|
-
visibility: Visibility,
|
|
15937
|
-
language: external_exports.string(),
|
|
15938
|
-
policyDefault: AccessLevel,
|
|
15939
|
-
updatedAt: external_exports.iso.datetime(),
|
|
15940
|
-
accessCounts: AccessCounts,
|
|
15941
|
-
findingsCount: external_exports.number().int().nonnegative()
|
|
15942
|
-
}).meta({ id: "ProjectSummary" });
|
|
15943
|
-
var HarnessCategory = external_exports.object({
|
|
15944
|
-
/** One of config/skill/mcp/hook — never project (enforced at service layer). */
|
|
15945
|
-
type: AssetType,
|
|
15946
|
-
assets: external_exports.array(AssetSummary)
|
|
15860
|
+
// ../../packages/schema/src/zod/config-inventory.ts
|
|
15861
|
+
var ConfigScope = external_exports.enum(["user", "project", "local", "plugin"]);
|
|
15862
|
+
var SkillScanEntry = external_exports.object({
|
|
15863
|
+
name: external_exports.string().min(1),
|
|
15864
|
+
// The identity source: a marketplace repo for plugin skills (e.g.
|
|
15865
|
+
// 'anthropics/skills'), 'local' for personal ~/.claude/skills, or
|
|
15866
|
+
// 'project:<repo-identity>' for checked-in project skills. The surrogate keeps
|
|
15867
|
+
// a personal skill named 'pdf' from colliding with the marketplace 'pdf'.
|
|
15868
|
+
source: external_exports.string().min(1),
|
|
15869
|
+
scope: ConfigScope,
|
|
15870
|
+
pluginName: external_exports.string().optional(),
|
|
15871
|
+
// Volatile — rides the attribute bag, never the identity hash.
|
|
15872
|
+
version: external_exports.string().optional(),
|
|
15873
|
+
description: external_exports.string().optional(),
|
|
15874
|
+
// Skill directory mtime (ISO) — the "updated Nd ago" freshness signal.
|
|
15875
|
+
updatedAt: external_exports.iso.datetime().optional(),
|
|
15876
|
+
// Filesystem path — the promoted inventory `location` column.
|
|
15877
|
+
location: external_exports.string().optional()
|
|
15947
15878
|
});
|
|
15948
|
-
var
|
|
15949
|
-
|
|
15950
|
-
|
|
15951
|
-
|
|
15952
|
-
|
|
15953
|
-
|
|
15954
|
-
|
|
15955
|
-
|
|
15956
|
-
|
|
15957
|
-
|
|
15958
|
-
|
|
15959
|
-
|
|
15960
|
-
var AssetGroup = external_exports.object({
|
|
15961
|
-
/** Group key — never project (enforced at service layer). */
|
|
15962
|
-
type: AssetType,
|
|
15963
|
-
total: external_exports.number().int().nonnegative(),
|
|
15964
|
-
/**
|
|
15965
|
-
* MCP group only — omitted for all other types.
|
|
15966
|
-
* Partial: only TrustLevel keys with non-zero counts are included.
|
|
15967
|
-
* Strict: unknown keys are rejected — only TrustLevel values are valid keys.
|
|
15968
|
-
*/
|
|
15969
|
-
trustRollup: external_exports.object({
|
|
15970
|
-
"known-good": external_exports.number().int().nonnegative(),
|
|
15971
|
-
risky: external_exports.number().int().nonnegative(),
|
|
15972
|
-
unapproved: external_exports.number().int().nonnegative()
|
|
15973
|
-
}).partial().strict().optional(),
|
|
15974
|
-
/**
|
|
15975
|
-
* Partial: only Flag keys with non-zero counts are included.
|
|
15976
|
-
* Strict: unknown keys are rejected — only Flag values are valid keys.
|
|
15977
|
-
*/
|
|
15978
|
-
flagRollup: external_exports.object({
|
|
15979
|
-
update: external_exports.number().int().nonnegative(),
|
|
15980
|
-
stale: external_exports.number().int().nonnegative(),
|
|
15981
|
-
conflict: external_exports.number().int().nonnegative(),
|
|
15982
|
-
unknown: external_exports.number().int().nonnegative(),
|
|
15983
|
-
change: external_exports.number().int().nonnegative(),
|
|
15984
|
-
untracked: external_exports.number().int().nonnegative(),
|
|
15985
|
-
risk: external_exports.number().int().nonnegative(),
|
|
15986
|
-
findings: external_exports.number().int().nonnegative()
|
|
15987
|
-
}).partial().strict(),
|
|
15988
|
-
items: external_exports.array(AssetSummary)
|
|
15989
|
-
}).meta({ id: "AssetGroup" });
|
|
15990
|
-
var ListAssetsResponse = external_exports.object({ groups: external_exports.array(AssetGroup) }).meta({ id: "ListAssetsResponse" });
|
|
15991
|
-
var McpTool = external_exports.object({
|
|
15992
|
-
name: external_exports.string(),
|
|
15993
|
-
signature: external_exports.string(),
|
|
15994
|
-
description: external_exports.string(),
|
|
15995
|
-
write: external_exports.boolean(),
|
|
15996
|
-
/** Non-null string when tool is dangerous / blocked; null otherwise. */
|
|
15997
|
-
risk: external_exports.string().nullable()
|
|
15998
|
-
}).meta({ id: "McpTool" });
|
|
15999
|
-
var AssetFindingRef = external_exports.object({
|
|
16000
|
-
id: external_exports.string(),
|
|
16001
|
-
title: external_exports.string(),
|
|
16002
|
-
note: external_exports.string()
|
|
15879
|
+
var HookScanEntry = external_exports.object({
|
|
15880
|
+
// Hook event name (PreToolUse, PostToolUse, …). Open string, not an enum: the
|
|
15881
|
+
// set is harness-defined and grows without a schema change.
|
|
15882
|
+
event: external_exports.string().min(1),
|
|
15883
|
+
// The tool matcher ('Bash', 'Edit|Write', …). Absent = matches all tools.
|
|
15884
|
+
matcher: external_exports.string().optional(),
|
|
15885
|
+
command: external_exports.string().min(1),
|
|
15886
|
+
timeout: external_exports.number().optional(),
|
|
15887
|
+
scope: ConfigScope,
|
|
15888
|
+
pluginName: external_exports.string().optional(),
|
|
15889
|
+
// The settings file / hooks.json the entry came from.
|
|
15890
|
+
location: external_exports.string().optional()
|
|
16003
15891
|
});
|
|
16004
|
-
var
|
|
16005
|
-
|
|
16006
|
-
|
|
16007
|
-
|
|
16008
|
-
|
|
16009
|
-
|
|
16010
|
-
|
|
16011
|
-
|
|
16012
|
-
|
|
16013
|
-
|
|
16014
|
-
|
|
16015
|
-
|
|
16016
|
-
|
|
16017
|
-
|
|
16018
|
-
|
|
16019
|
-
|
|
16020
|
-
|
|
16021
|
-
|
|
16022
|
-
|
|
16023
|
-
|
|
16024
|
-
|
|
16025
|
-
|
|
16026
|
-
|
|
16027
|
-
|
|
16028
|
-
|
|
16029
|
-
|
|
16030
|
-
|
|
16031
|
-
|
|
16032
|
-
|
|
16033
|
-
|
|
16034
|
-
|
|
16035
|
-
path: external_exports.string(),
|
|
16036
|
-
name: external_exports.string(),
|
|
16037
|
-
origin: Origin,
|
|
16038
|
-
/** Effective access (override applied). */
|
|
16039
|
-
access: AccessLevel,
|
|
16040
|
-
/** True when a file_access_override differs from the computed default. */
|
|
16041
|
-
isCustom: external_exports.boolean(),
|
|
16042
|
-
findings: external_exports.number().int().nonnegative(),
|
|
16043
|
-
/** When the file was auto-blocked by a detection; null when not blocked. */
|
|
16044
|
-
blockedAt: external_exports.iso.datetime().nullable().optional(),
|
|
16045
|
-
/** Why the file was blocked; null when absent. */
|
|
16046
|
-
note: external_exports.string().nullable().optional()
|
|
16047
|
-
}).meta({ id: "FileSummary" });
|
|
16048
|
-
var FolderSummary = external_exports.object({
|
|
16049
|
-
name: external_exports.string(),
|
|
16050
|
-
path: external_exports.string(),
|
|
16051
|
-
/** Rollup of effective access across all descendants. */
|
|
16052
|
-
accessCounts: AccessCounts
|
|
16053
|
-
}).meta({ id: "FolderSummary" });
|
|
16054
|
-
var ProjectTreeResponse = external_exports.object({
|
|
16055
|
-
project: external_exports.object({
|
|
16056
|
-
id: external_exports.string(),
|
|
16057
|
-
repo: external_exports.string(),
|
|
16058
|
-
visibility: Visibility
|
|
16059
|
-
}),
|
|
16060
|
-
path: external_exports.string(),
|
|
16061
|
-
/** Browse mode: one-level folders at the current path. Omitted in search mode. */
|
|
16062
|
-
folders: external_exports.array(FolderSummary).optional(),
|
|
16063
|
-
files: external_exports.array(FileSummary)
|
|
16064
|
-
}).meta({ id: "ProjectTreeResponse" });
|
|
16065
|
-
var FileDetail = FileSummary.extend({
|
|
16066
|
-
project: external_exports.object({
|
|
16067
|
-
repo: external_exports.string(),
|
|
16068
|
-
visibility: Visibility,
|
|
16069
|
-
language: external_exports.string(),
|
|
16070
|
-
policyDefault: AccessLevel,
|
|
16071
|
-
updatedAt: external_exports.iso.datetime()
|
|
16072
|
-
}),
|
|
16073
|
-
findingsRefs: external_exports.array(external_exports.object({ id: external_exports.string(), title: external_exports.string() }))
|
|
16074
|
-
}).meta({ id: "FileDetail" });
|
|
16075
|
-
var SetFileAccessBody = external_exports.object({
|
|
16076
|
-
path: external_exports.string(),
|
|
16077
|
-
access: AccessLevel
|
|
16078
|
-
}).meta({ id: "SetFileAccessBody" });
|
|
16079
|
-
var SetFileAccessResponse = external_exports.object({
|
|
16080
|
-
file: FileSummary,
|
|
16081
|
-
accessCounts: AccessCounts
|
|
16082
|
-
}).meta({ id: "SetFileAccessResponse" });
|
|
16083
|
-
var SetMcpTrustBody = external_exports.object({ trust: TrustLevel }).meta({ id: "SetMcpTrustBody" });
|
|
16084
|
-
var HarnessEventItem = external_exports.object({
|
|
16085
|
-
kind: HarnessEventKind,
|
|
16086
|
-
title: external_exports.string(),
|
|
16087
|
-
detail: external_exports.string(),
|
|
16088
|
-
occurredAt: external_exports.iso.datetime(),
|
|
16089
|
-
findingId: external_exports.string().nullable().optional()
|
|
16090
|
-
}).meta({ id: "HarnessEventItem" });
|
|
16091
|
-
var HarnessEventsResponse = external_exports.object({
|
|
16092
|
-
counts: external_exports.object({
|
|
16093
|
-
block: external_exports.number().int().nonnegative(),
|
|
16094
|
-
redact: external_exports.number().int().nonnegative(),
|
|
16095
|
-
warn: external_exports.number().int().nonnegative()
|
|
16096
|
-
}),
|
|
16097
|
-
items: external_exports.array(HarnessEventItem)
|
|
16098
|
-
}).meta({ id: "HarnessEventsResponse" });
|
|
16099
|
-
var RescanResponse = external_exports.object({
|
|
16100
|
-
jobId: external_exports.string(),
|
|
16101
|
-
startedAt: external_exports.iso.datetime()
|
|
16102
|
-
}).meta({ id: "RescanResponse" });
|
|
16103
|
-
var ConnectProjectBody = external_exports.object({ repo: external_exports.string() }).meta({ id: "ConnectProjectBody" });
|
|
16104
|
-
var ListAssetsQuery = external_exports.object({
|
|
16105
|
-
/** Filter by one or more AssetType values; absent means all types. */
|
|
16106
|
-
type: external_exports.array(AssetType).optional(),
|
|
16107
|
-
/** Free-text search term. */
|
|
16108
|
-
q: external_exports.string().optional()
|
|
16109
|
-
});
|
|
16110
|
-
var GetProjectTreeQuery = external_exports.object({
|
|
16111
|
-
/** Subtree root path; defaults to repository root when absent. */
|
|
16112
|
-
path: external_exports.string().optional(),
|
|
16113
|
-
/** Free-text filter applied to file paths. */
|
|
16114
|
-
q: external_exports.string().optional(),
|
|
16115
|
-
/**
|
|
16116
|
-
* Special listing mode. `blocked` returns every effectively-blocked, auto-blocked
|
|
16117
|
-
* file across the whole repo (folders omitted, most-recent first), ignoring
|
|
16118
|
-
* `path`/`q` — powers the project-wide "recently blocked" strip.
|
|
16119
|
-
*/
|
|
16120
|
-
filter: external_exports.enum(["blocked"]).optional()
|
|
15892
|
+
var McpServerScanEntry = external_exports.object({
|
|
15893
|
+
// The server's config key ("github", "filesystem", …) — identity, with the
|
|
15894
|
+
// qualified scope (see mcpServerIdentityKey).
|
|
15895
|
+
name: external_exports.string().min(1),
|
|
15896
|
+
scope: ConfigScope,
|
|
15897
|
+
pluginName: external_exports.string().optional(),
|
|
15898
|
+
// The owning plugin's marketplace — part of PLUGIN-scope identity: two
|
|
15899
|
+
// marketplaces can each ship a plugin named `guard`, and without this their
|
|
15900
|
+
// same-named servers would collapse to one row (the second silently dropped,
|
|
15901
|
+
// inheriting the first's trust).
|
|
15902
|
+
marketplace: external_exports.string().optional(),
|
|
15903
|
+
// The repo identity (remote url, or the cwd for un-remoted repos) — part of
|
|
15904
|
+
// PROJECT/LOCAL-scope identity: a server named `github` in repo A and one in
|
|
15905
|
+
// repo B are different servers with different commands, and MUST NOT share a
|
|
15906
|
+
// row — a shared row would let a cloned repo's .mcp.json inherit the trust
|
|
15907
|
+
// the user granted elsewhere.
|
|
15908
|
+
project: external_exports.string().optional(),
|
|
15909
|
+
// 'stdio' when the entry carries a command; otherwise the config's `type`
|
|
15910
|
+
// ('http' / 'sse' / …). Open string — the transport set is harness-defined.
|
|
15911
|
+
transport: external_exports.string().min(1),
|
|
15912
|
+
// Volatile on purpose (unlike hook `command`): a changed command/url is drift
|
|
15913
|
+
// on a stable row — visible across config_scan snapshots and preserving the
|
|
15914
|
+
// user's trust decision — never a quiet new row. One of the two is present.
|
|
15915
|
+
// Secret-masked at collection time (the scanner runs the bundled detection
|
|
15916
|
+
// packs over both — tokens routinely ride command args and URLs).
|
|
15917
|
+
command: external_exports.string().optional(),
|
|
15918
|
+
url: external_exports.string().optional(),
|
|
15919
|
+
// Env var NAMES only, never values (the no-secrets rule).
|
|
15920
|
+
envKeys: external_exports.array(external_exports.string()).optional(),
|
|
15921
|
+
// The config file the entry came from.
|
|
15922
|
+
location: external_exports.string().optional()
|
|
16121
15923
|
});
|
|
16122
|
-
var
|
|
16123
|
-
|
|
16124
|
-
|
|
15924
|
+
var ConfigFileScanEntry = external_exports.object({
|
|
15925
|
+
// Basename (settings.json, CLAUDE.md) or dir name (commands/, agents/).
|
|
15926
|
+
name: external_exports.string().min(1),
|
|
15927
|
+
// The absolute path — identity (with scope) and the promoted `location`.
|
|
15928
|
+
path: external_exports.string().min(1),
|
|
15929
|
+
scope: ConfigScope,
|
|
15930
|
+
// Human label: "User settings", "Project memory", "Slash commands", …
|
|
15931
|
+
kind: external_exports.string().min(1),
|
|
15932
|
+
// Derived SHAPE summary — top-level key names, entry counts, line counts.
|
|
15933
|
+
// Never file content or values (memory files can carry sensitive detail).
|
|
15934
|
+
detail: external_exports.string().optional(),
|
|
15935
|
+
// Dir configs (commands/, agents/) and .mcp.json: how many entries.
|
|
15936
|
+
entryCount: external_exports.number().optional(),
|
|
15937
|
+
// File mtime (ISO) — the freshness signal.
|
|
15938
|
+
updatedAt: external_exports.iso.datetime().optional()
|
|
16125
15939
|
});
|
|
16126
|
-
var
|
|
16127
|
-
|
|
16128
|
-
|
|
15940
|
+
var ConfigScanResult = external_exports.object({
|
|
15941
|
+
scannedAt: external_exports.iso.datetime(),
|
|
15942
|
+
skills: external_exports.array(SkillScanEntry),
|
|
15943
|
+
hooks: external_exports.array(HookScanEntry),
|
|
15944
|
+
mcpServers: external_exports.array(McpServerScanEntry),
|
|
15945
|
+
configFiles: external_exports.array(ConfigFileScanEntry),
|
|
15946
|
+
errors: external_exports.array(external_exports.object({ source: external_exports.string(), reason: external_exports.string() }))
|
|
16129
15947
|
});
|
|
16130
|
-
|
|
16131
|
-
|
|
16132
|
-
|
|
16133
|
-
|
|
16134
|
-
|
|
16135
|
-
|
|
16136
|
-
|
|
16137
|
-
|
|
16138
|
-
|
|
16139
|
-
|
|
16140
|
-
id: external_exports.guid(),
|
|
16141
|
-
ruleId: external_exports.string(),
|
|
16142
|
-
// Denormalized from the rule, for reporting — never matched on.
|
|
16143
|
-
category: DetectionCategory,
|
|
16144
|
-
// HMAC-SHA256 hex of the raw match under a machine-local key: a KEYED
|
|
16145
|
-
// fingerprint, never the raw value, and never reversible. Matching recomputes
|
|
16146
|
-
// the fingerprint from a fresh capture; the value itself is never stored.
|
|
16147
|
-
// Shape-constrained so a malformed — or accidentally raw — value is rejected
|
|
16148
|
-
// at the boundary rather than persisted.
|
|
16149
|
-
valueFingerprint: external_exports.string().regex(/^[0-9a-f]{64}$/),
|
|
16150
|
-
// Version of the fingerprint key the grant was written under; a rotated key
|
|
16151
|
-
// invalidates old grants rather than silently mismatching them.
|
|
16152
|
-
keyVersion: external_exports.number().int().positive(),
|
|
16153
|
-
// maskMatch() preview of the approved value — never the raw value.
|
|
16154
|
-
maskedValue: external_exports.string(),
|
|
16155
|
-
capability: ExceptionCapability.default("suppress"),
|
|
16156
|
-
scope: ExceptionScope,
|
|
16157
|
-
expiresAt: external_exports.iso.datetime().nullable(),
|
|
16158
|
-
maxUses: external_exports.number().int().positive().nullable(),
|
|
16159
|
-
useCount: external_exports.number().int().nonnegative(),
|
|
16160
|
-
lastUsedAt: external_exports.iso.datetime().nullable(),
|
|
16161
|
-
// Mandatory: every grant carries the human reason it exists.
|
|
16162
|
-
justification: external_exports.string().min(1),
|
|
16163
|
-
conditions: ExceptionConditions.nullable(),
|
|
16164
|
-
createdBy: external_exports.string(),
|
|
16165
|
-
createdVia: external_exports.enum(["cli-approve", "cli-add", "web-approve", "web-add", "api", "setup-triage"]),
|
|
16166
|
-
createdAt: external_exports.iso.datetime(),
|
|
16167
|
-
updatedAt: external_exports.iso.datetime(),
|
|
16168
|
-
// Revocation is terminal and retained — consumed/expired/revoked rows are
|
|
16169
|
-
// audit evidence; nothing in the exception lifecycle hard-deletes.
|
|
16170
|
-
revokedAt: external_exports.iso.datetime().nullable(),
|
|
16171
|
-
revokedBy: external_exports.string().nullable(),
|
|
16172
|
-
revokeReason: external_exports.string().nullable()
|
|
15948
|
+
var ConfigPostureFindingInput = external_exports.object({
|
|
15949
|
+
ruleId: external_exports.string().min(1),
|
|
15950
|
+
version: external_exports.string().min(1),
|
|
15951
|
+
span: Span,
|
|
15952
|
+
// For posture rules this is the offending COMMAND (config the user already
|
|
15953
|
+
// holds locally, not captured secret content) — it is also the correlation
|
|
15954
|
+
// key the read surface matches back to a hook row.
|
|
15955
|
+
maskedMatch: external_exports.string(),
|
|
15956
|
+
actionTaken: ActionTaken,
|
|
15957
|
+
confidence: external_exports.number().min(0).max(1)
|
|
16173
15958
|
});
|
|
16174
|
-
var
|
|
16175
|
-
|
|
16176
|
-
|
|
16177
|
-
|
|
16178
|
-
|
|
16179
|
-
capability: true,
|
|
16180
|
-
expiresAt: true,
|
|
16181
|
-
maxUses: true,
|
|
16182
|
-
useCount: true,
|
|
16183
|
-
conditions: true
|
|
15959
|
+
var ConfigScanRecord = external_exports.object({
|
|
15960
|
+
items: external_exports.array(InventoryInput),
|
|
15961
|
+
scanEvent: AuditEventInput,
|
|
15962
|
+
definitions: external_exports.array(InspectionDefinitionInput).optional(),
|
|
15963
|
+
findings: external_exports.array(ConfigPostureFindingInput).optional()
|
|
16184
15964
|
});
|
|
16185
|
-
|
|
15965
|
+
|
|
15966
|
+
// ../../packages/schema/src/zod/registry.ts
|
|
15967
|
+
var Namespace = external_exports.string().regex(/^[a-z][a-z0-9-]*$/);
|
|
15968
|
+
var PackId = external_exports.string().regex(/^[a-z][a-z0-9-]*$/);
|
|
15969
|
+
var SemVer = external_exports.string().regex(/^\d+\.\d+\.\d+(?:-[0-9A-Za-z-.]+)?$/);
|
|
15970
|
+
var PublisherKind = external_exports.enum(["labs", "user", "org"]);
|
|
16186
15971
|
|
|
16187
15972
|
// ../../packages/schema/src/zod/rule.ts
|
|
16188
|
-
var MatcherType = external_exports.enum(["keyword", "regex"
|
|
15973
|
+
var MatcherType = external_exports.enum(["keyword", "regex"]).meta({ id: "MatcherType" });
|
|
16189
15974
|
var RuleProbeVerdict = external_exports.enum(["safe", "quarantined"]).meta({ id: "RuleProbeVerdict" });
|
|
16190
|
-
var KeywordMatcher = external_exports.
|
|
15975
|
+
var KeywordMatcher = external_exports.strictObject({
|
|
16191
15976
|
type: external_exports.literal("keyword"),
|
|
16192
15977
|
// An empty keyword matches at every position, yielding one zero-length span
|
|
16193
15978
|
// per character. Rejected here because a keyword that matches everything is
|
|
@@ -16203,16 +15988,31 @@ function isValidRegex(pattern, flags) {
|
|
|
16203
15988
|
return false;
|
|
16204
15989
|
}
|
|
16205
15990
|
}
|
|
15991
|
+
function probeFlags(flags) {
|
|
15992
|
+
return flags.replace(/[gy]/g, "");
|
|
15993
|
+
}
|
|
16206
15994
|
function matchesEmptyString(pattern, flags) {
|
|
16207
15995
|
try {
|
|
16208
|
-
const re = new RegExp(pattern, flags
|
|
15996
|
+
const re = new RegExp(pattern, probeFlags(flags));
|
|
16209
15997
|
return re.exec("")?.[0].length === 0;
|
|
16210
15998
|
} catch {
|
|
16211
15999
|
return false;
|
|
16212
16000
|
}
|
|
16213
16001
|
}
|
|
16002
|
+
function spansWholeMatch(captureGroup) {
|
|
16003
|
+
return captureGroup === void 0 || captureGroup === 0;
|
|
16004
|
+
}
|
|
16005
|
+
function captureGroupCount(pattern, flags) {
|
|
16006
|
+
try {
|
|
16007
|
+
const probe = new RegExp(`${pattern}|`, probeFlags(flags));
|
|
16008
|
+
const result = probe.exec("");
|
|
16009
|
+
return result ? result.length - 1 : void 0;
|
|
16010
|
+
} catch {
|
|
16011
|
+
return void 0;
|
|
16012
|
+
}
|
|
16013
|
+
}
|
|
16214
16014
|
var MAX_PATTERN_LENGTH = 2e3;
|
|
16215
|
-
var RegexMatcher = external_exports.
|
|
16015
|
+
var RegexMatcher = external_exports.strictObject({
|
|
16216
16016
|
type: external_exports.literal("regex"),
|
|
16217
16017
|
pattern: external_exports.string().min(1).max(MAX_PATTERN_LENGTH),
|
|
16218
16018
|
flags: external_exports.string().default("gi"),
|
|
@@ -16220,28 +16020,47 @@ var RegexMatcher = external_exports.object({
|
|
|
16220
16020
|
}).refine((v) => isValidRegex(v.pattern, v.flags), {
|
|
16221
16021
|
message: "pattern/flags do not form a valid JavaScript regular expression",
|
|
16222
16022
|
path: ["pattern"]
|
|
16223
|
-
}).refine((v) => v.captureGroup
|
|
16023
|
+
}).refine((v) => !spansWholeMatch(v.captureGroup) || !matchesEmptyString(v.pattern, v.flags), {
|
|
16224
16024
|
message: 'a whole-match regex that can match the empty string (e.g. "\\d*", "a?", "(?:)") can hang the matcher \u2014 scope the quantifier to a captureGroup, or require at least one character',
|
|
16225
16025
|
path: ["pattern"]
|
|
16026
|
+
}).superRefine((v, ctx) => {
|
|
16027
|
+
if (v.captureGroup === void 0) return;
|
|
16028
|
+
const groups = captureGroupCount(v.pattern, v.flags);
|
|
16029
|
+
if (groups === void 0 || v.captureGroup <= groups) return;
|
|
16030
|
+
ctx.addIssue({
|
|
16031
|
+
code: "custom",
|
|
16032
|
+
path: ["captureGroup"],
|
|
16033
|
+
message: `captureGroup ${String(v.captureGroup)} is out of range \u2014 the pattern declares ${String(groups)} capture group(s), so valid values are 0-${String(groups)}. An out-of-range group never matches, which would make the rule silently never fire.`
|
|
16034
|
+
});
|
|
16226
16035
|
});
|
|
16227
|
-
var
|
|
16228
|
-
|
|
16229
|
-
|
|
16230
|
-
config: external_exports.record(external_exports.string(), external_exports.unknown()).optional()
|
|
16231
|
-
});
|
|
16232
|
-
var Matcher = external_exports.discriminatedUnion("type", [KeywordMatcher, RegexMatcher, ValidatorMatcher]).meta({ id: "Matcher" });
|
|
16233
|
-
var AppliesTo = external_exports.object({
|
|
16036
|
+
var Matcher = external_exports.discriminatedUnion("type", [KeywordMatcher, RegexMatcher]).meta({ id: "Matcher" });
|
|
16037
|
+
var MATCHER_TYPES = MatcherType.options;
|
|
16038
|
+
var AppliesTo = external_exports.strictObject({
|
|
16234
16039
|
// Dot-prefixed, e.g. ".py" — matches the scanner's SOURCE_EXTENSIONS shape.
|
|
16235
16040
|
extensions: external_exports.array(external_exports.string().regex(/^\.[A-Za-z0-9]+$/)).min(1)
|
|
16236
16041
|
}).meta({ id: "AppliesTo" });
|
|
16237
|
-
var
|
|
16238
|
-
|
|
16239
|
-
|
|
16240
|
-
|
|
16241
|
-
|
|
16242
|
-
|
|
16243
|
-
|
|
16244
|
-
|
|
16042
|
+
var PostValidatorName = external_exports.enum(["entropy", "luhn"]).meta({ id: "PostValidatorName" });
|
|
16043
|
+
var PostValidatorRef = external_exports.union(
|
|
16044
|
+
[
|
|
16045
|
+
PostValidatorName,
|
|
16046
|
+
external_exports.strictObject({
|
|
16047
|
+
name: PostValidatorName,
|
|
16048
|
+
config: external_exports.record(external_exports.string(), external_exports.unknown()).optional()
|
|
16049
|
+
})
|
|
16050
|
+
],
|
|
16051
|
+
{
|
|
16052
|
+
// A union reports one collapsed issue for every way its arms can fail, so
|
|
16053
|
+
// this has to describe the whole shape rather than just the name — it is
|
|
16054
|
+
// what an author sees for a misspelled name AND for a stray key in the
|
|
16055
|
+
// object form. The names come from the enum so the message cannot go
|
|
16056
|
+
// stale. Without it Zod says only "Invalid input", which is precisely the
|
|
16057
|
+
// no-feedback outcome this schema exists to remove.
|
|
16058
|
+
error: () => `not a valid post-validator: use a bare name (${PostValidatorName.options.map((name) => JSON.stringify(name)).join(
|
|
16059
|
+
" or "
|
|
16060
|
+
)}) or { "name": ..., "config": { ... } }. An unrecognized name would be a false-positive guard that never runs.`
|
|
16061
|
+
}
|
|
16062
|
+
).meta({ id: "PostValidatorRef" });
|
|
16063
|
+
var RequiresNearby = external_exports.strictObject({
|
|
16245
16064
|
// Each array, when present, must be non-empty and contain non-empty strings —
|
|
16246
16065
|
// an empty/blank criterion would either never fire or (for labels) match
|
|
16247
16066
|
// everything.
|
|
@@ -16256,16 +16075,23 @@ var RequiresNearby = external_exports.object({
|
|
|
16256
16075
|
(v) => (v.categories?.length ?? 0) + (v.ruleIds?.length ?? 0) + (v.labels?.length ?? 0) > 0,
|
|
16257
16076
|
{ message: "requiresNearby needs at least one of categories, ruleIds, or labels" }
|
|
16258
16077
|
).meta({ id: "RequiresNearby" });
|
|
16259
|
-
var RuleFixture = external_exports.
|
|
16078
|
+
var RuleFixture = external_exports.strictObject({
|
|
16260
16079
|
label: external_exports.string(),
|
|
16261
16080
|
text: external_exports.string().max(5e4),
|
|
16262
16081
|
shouldMatch: external_exports.boolean(),
|
|
16263
16082
|
// Simulated file context for the scan, so fixtures can assert `appliesTo`
|
|
16264
16083
|
// gating (e.g. a Python-only pattern must NOT fire in a .ts file).
|
|
16265
16084
|
filePath: external_exports.string().optional(),
|
|
16266
|
-
expectedSpans: external_exports.array(external_exports.
|
|
16085
|
+
expectedSpans: external_exports.array(external_exports.strictObject({ start: external_exports.number(), end: external_exports.number() })).optional()
|
|
16267
16086
|
}).meta({ id: "RuleFixture" });
|
|
16268
|
-
var Rule = external_exports.
|
|
16087
|
+
var Rule = external_exports.strictObject({
|
|
16088
|
+
// A pinned literal over a STRICT object, and the two together decide how this
|
|
16089
|
+
// format may grow. A rule carrying a key not listed below is refused with
|
|
16090
|
+
// `unrecognized_keys`; a rule declaring `specVersion: 2` is refused with
|
|
16091
|
+
// `invalid_value`. So the only additive path is adding an OPTIONAL field here
|
|
16092
|
+
// — that keeps every rule authored before it valid — and a rule author has no
|
|
16093
|
+
// way to introduce a field of their own or to opt into a later version.
|
|
16094
|
+
// Widening the format means changing this literal and every consumer of it.
|
|
16269
16095
|
specVersion: external_exports.literal(1),
|
|
16270
16096
|
// `packId/ruleName` (e.g. `secrets/aws-access-key`). NOTE the first segment is
|
|
16271
16097
|
// the PACK id, NOT a namespace — this is a DIFFERENT slug space from a
|
|
@@ -16301,287 +16127,6 @@ var PackManifest = external_exports.object({
|
|
|
16301
16127
|
sourceUrl: external_exports.url().optional()
|
|
16302
16128
|
}).meta({ id: "PackManifest" });
|
|
16303
16129
|
|
|
16304
|
-
// ../../packages/schema/src/zod/policy.ts
|
|
16305
|
-
var PolicyScope = external_exports.enum(["global", "repo", "user"]).meta({ id: "PolicyScope" });
|
|
16306
|
-
var PolicyTarget = external_exports.union([external_exports.object({ ruleId: external_exports.string() }), external_exports.object({ category: DetectionCategory })]).meta({ id: "PolicyTarget" });
|
|
16307
|
-
var Policy = external_exports.object({
|
|
16308
|
-
id: external_exports.guid(),
|
|
16309
|
-
scope: PolicyScope,
|
|
16310
|
-
target: PolicyTarget,
|
|
16311
|
-
action: ActionTaken,
|
|
16312
|
-
enabled: external_exports.boolean().default(true),
|
|
16313
|
-
customKeywords: external_exports.array(external_exports.string()).optional(),
|
|
16314
|
-
// Display name — optional so older policy rows without name still parse.
|
|
16315
|
-
// Added for the findings API (policy.name column migration).
|
|
16316
|
-
name: external_exports.string().optional()
|
|
16317
|
-
}).meta({ id: "Policy" });
|
|
16318
|
-
var PolicyBundle = external_exports.object({
|
|
16319
|
-
version: external_exports.string(),
|
|
16320
|
-
policies: external_exports.array(Policy),
|
|
16321
|
-
// Rules from the installed marketplace packs (snapshotted by the
|
|
16322
|
-
// control plane). The plugin registers these in addition to its bundled
|
|
16323
|
-
// packs. Optional so older backends — and older on-disk caches — that omit
|
|
16324
|
-
// the field still parse; consumers read `bundle.rules ?? []`.
|
|
16325
|
-
rules: external_exports.array(Rule).optional(),
|
|
16326
|
-
// When true, `rules` IS the complete effective ruleset and the runtime must
|
|
16327
|
-
// NOT merge its compiled-in bundled packs — the standalone gateway sets this
|
|
16328
|
-
// after reading the user's installed snapshot (installed_packs, enabled
|
|
16329
|
-
// packs only), which is how detection updates stay manual: new bundled
|
|
16330
|
-
// rules run only after the user applies the pack update. Absent/false keeps
|
|
16331
|
-
// the historical composition (bundled packs + rules) — older caches.
|
|
16332
|
-
rulesComplete: external_exports.boolean().optional(),
|
|
16333
|
-
// Active detection exceptions, evaluation subset only (see
|
|
16334
|
-
// ExceptionBundleEntry). Optional so older bundle producers — and older
|
|
16335
|
-
// on-disk caches — that omit the field still parse; consumers read
|
|
16336
|
-
// `bundle.exceptions ?? []`.
|
|
16337
|
-
exceptions: external_exports.array(ExceptionBundleEntry).optional(),
|
|
16338
|
-
// Installed pack version, keyed by ruleId, for rules in `rules` that came
|
|
16339
|
-
// from a versioned installed pack. Optional so older backends — and older
|
|
16340
|
-
// on-disk caches — that omit the field still parse; consumers fall back to
|
|
16341
|
-
// the rule's own spec version. NOT the bundle version above — see
|
|
16342
|
-
// installedRuleset's ruleVersions for the source of truth.
|
|
16343
|
-
ruleVersions: external_exports.record(external_exports.string(), external_exports.string()).optional(),
|
|
16344
|
-
customKeywords: external_exports.array(external_exports.string()),
|
|
16345
|
-
fetchedAt: external_exports.iso.datetime()
|
|
16346
|
-
}).meta({ id: "PolicyBundle" });
|
|
16347
|
-
var OBSERVE_ONLY_CATEGORIES = ["config"];
|
|
16348
|
-
var ENFORCEABLE_CATEGORIES = DetectionCategory.options.filter((c) => !OBSERVE_ONLY_CATEGORIES.includes(c));
|
|
16349
|
-
var CATEGORY_PEAK_SEVERITY = {
|
|
16350
|
-
secret: "critical",
|
|
16351
|
-
financial: "critical",
|
|
16352
|
-
// core-financial/credit-card
|
|
16353
|
-
code_flaw: "critical",
|
|
16354
|
-
pii: "high",
|
|
16355
|
-
phi: "high",
|
|
16356
|
-
custom: "high",
|
|
16357
|
-
// user-defined; conservative
|
|
16358
|
-
code_context: "low",
|
|
16359
|
-
config: "low"
|
|
16360
|
-
// observe-only; floors to monitor regardless
|
|
16361
|
-
};
|
|
16362
|
-
function severityFloorPolicy(category) {
|
|
16363
|
-
if (OBSERVE_ONLY_CATEGORIES.includes(category)) return "monitor";
|
|
16364
|
-
const peak = CATEGORY_PEAK_SEVERITY[category];
|
|
16365
|
-
return peak === "critical" || peak === "high" ? "warn" : "monitor";
|
|
16366
|
-
}
|
|
16367
|
-
var PolicyKind = external_exports.enum(["builtin", "custom"]).meta({ id: "PolicyKind" });
|
|
16368
|
-
var KNOWN_BUILTIN_IDS = ["monitor", "warn", "redact", "block"];
|
|
16369
|
-
var BuiltinPolicyId = external_exports.enum(KNOWN_BUILTIN_IDS).meta({ id: "BuiltinPolicyId" });
|
|
16370
|
-
var BUILTIN_POLICY_SPECS = {
|
|
16371
|
-
monitor: {
|
|
16372
|
-
name: "Monitor",
|
|
16373
|
-
action: "log",
|
|
16374
|
-
description: "Log every match for audit. The request is allowed through untouched."
|
|
16375
|
-
},
|
|
16376
|
-
warn: {
|
|
16377
|
-
name: "Warn",
|
|
16378
|
-
action: "warn",
|
|
16379
|
-
description: "Allow the request, but warn the user inline before it is sent."
|
|
16380
|
-
},
|
|
16381
|
-
redact: {
|
|
16382
|
-
name: "Redact",
|
|
16383
|
-
action: "redact",
|
|
16384
|
-
description: "Automatically strip the matched value from the request, then continue."
|
|
16385
|
-
},
|
|
16386
|
-
block: {
|
|
16387
|
-
name: "Block",
|
|
16388
|
-
action: "block",
|
|
16389
|
-
description: "Refuse the request entirely whenever any rule in this detection matches."
|
|
16390
|
-
}
|
|
16391
|
-
};
|
|
16392
|
-
function builtinPolicyToAction(id) {
|
|
16393
|
-
return BUILTIN_POLICY_SPECS[id].action;
|
|
16394
|
-
}
|
|
16395
|
-
var DEFAULT_ACTIONS = Object.fromEntries(
|
|
16396
|
-
DetectionCategory.options.map((c) => [c, builtinPolicyToAction(severityFloorPolicy(c))])
|
|
16397
|
-
);
|
|
16398
|
-
var BUILTIN_POLICIES = Object.fromEntries(
|
|
16399
|
-
KNOWN_BUILTIN_IDS.map((id) => [id, { id, ...BUILTIN_POLICY_SPECS[id] }])
|
|
16400
|
-
);
|
|
16401
|
-
var UsedByItem = external_exports.object({
|
|
16402
|
-
id: external_exports.string(),
|
|
16403
|
-
name: external_exports.string(),
|
|
16404
|
-
ruleCount: external_exports.number().int().nonnegative(),
|
|
16405
|
-
enabled: external_exports.boolean()
|
|
16406
|
-
}).meta({ id: "UsedByItem" });
|
|
16407
|
-
var PolicyListItem = external_exports.object({
|
|
16408
|
-
id: external_exports.string(),
|
|
16409
|
-
kind: PolicyKind,
|
|
16410
|
-
name: external_exports.string(),
|
|
16411
|
-
enabled: external_exports.boolean(),
|
|
16412
|
-
usedByCount: external_exports.number().int().nonnegative()
|
|
16413
|
-
}).meta({ id: "PolicyListItem" });
|
|
16414
|
-
var PolicyDetail = external_exports.object({
|
|
16415
|
-
specVersion: external_exports.literal(1),
|
|
16416
|
-
id: external_exports.string(),
|
|
16417
|
-
kind: PolicyKind,
|
|
16418
|
-
name: external_exports.string(),
|
|
16419
|
-
enabled: external_exports.boolean(),
|
|
16420
|
-
description: external_exports.string(),
|
|
16421
|
-
usedBy: external_exports.array(UsedByItem)
|
|
16422
|
-
}).meta({ id: "PolicyDetail" });
|
|
16423
|
-
var PolicyStatsResponse = external_exports.object({
|
|
16424
|
-
policies: external_exports.number().int().nonnegative(),
|
|
16425
|
-
builtin: external_exports.number().int().nonnegative(),
|
|
16426
|
-
custom: external_exports.number().int().nonnegative(),
|
|
16427
|
-
detectionsGoverned: external_exports.number().int().nonnegative()
|
|
16428
|
-
}).meta({ id: "PolicyStatsResponse" });
|
|
16429
|
-
|
|
16430
|
-
// ../../packages/schema/src/zod/api.ts
|
|
16431
|
-
var LIST_QUERY_MAX_LIMIT = 200;
|
|
16432
|
-
var ListEventsQuery = external_exports.object({
|
|
16433
|
-
cursor: external_exports.string().optional(),
|
|
16434
|
-
limit: external_exports.coerce.number().int().min(1).max(LIST_QUERY_MAX_LIMIT).default(50),
|
|
16435
|
-
sourceTool: external_exports.string().optional(),
|
|
16436
|
-
kind: external_exports.string().optional(),
|
|
16437
|
-
from: external_exports.iso.datetime().optional(),
|
|
16438
|
-
to: external_exports.iso.datetime().optional()
|
|
16439
|
-
});
|
|
16440
|
-
var ListEventsResponse = external_exports.object({
|
|
16441
|
-
items: external_exports.array(Event),
|
|
16442
|
-
nextCursor: external_exports.string().nullable()
|
|
16443
|
-
}).meta({ id: "ListEventsResponse" });
|
|
16444
|
-
var IngestResponse = external_exports.object({
|
|
16445
|
-
accepted: external_exports.number().int().nonnegative(),
|
|
16446
|
-
duplicates: external_exports.number().int().nonnegative()
|
|
16447
|
-
}).meta({ id: "IngestResponse" });
|
|
16448
|
-
var ListFindingsQuery = external_exports.object({
|
|
16449
|
-
cursor: external_exports.string().optional(),
|
|
16450
|
-
limit: external_exports.coerce.number().int().min(1).max(LIST_QUERY_MAX_LIMIT).default(50),
|
|
16451
|
-
severity: external_exports.string().optional(),
|
|
16452
|
-
category: external_exports.string().optional(),
|
|
16453
|
-
eventId: external_exports.guid().optional()
|
|
16454
|
-
});
|
|
16455
|
-
var ListFindingsResponse = external_exports.object({
|
|
16456
|
-
items: external_exports.array(Finding),
|
|
16457
|
-
nextCursor: external_exports.string().nullable()
|
|
16458
|
-
}).meta({ id: "ListFindingsResponse" });
|
|
16459
|
-
var ListPoliciesResponse = external_exports.object({ items: external_exports.array(PolicyListItem) }).meta({ id: "ListPoliciesResponse" });
|
|
16460
|
-
var CreatePolicyRequest = Policy.omit({ id: true }).meta({
|
|
16461
|
-
id: "CreatePolicyRequest"
|
|
16462
|
-
});
|
|
16463
|
-
var UpdatePolicyRequest = Policy.partial().required({ id: true }).meta({ id: "UpdatePolicyRequest" });
|
|
16464
|
-
var RecordAuditEventResponse = external_exports.object({ accepted: external_exports.boolean() }).meta({ id: "RecordAuditEventResponse" });
|
|
16465
|
-
var ErrorResponse = external_exports.object({
|
|
16466
|
-
error: external_exports.object({
|
|
16467
|
-
code: external_exports.string(),
|
|
16468
|
-
message: external_exports.string(),
|
|
16469
|
-
details: external_exports.unknown().optional()
|
|
16470
|
-
})
|
|
16471
|
-
}).meta({ id: "ErrorResponse" });
|
|
16472
|
-
|
|
16473
|
-
// ../../packages/schema/src/zod/config-inventory.ts
|
|
16474
|
-
var ConfigScope = external_exports.enum(["user", "project", "local", "plugin"]);
|
|
16475
|
-
var SkillScanEntry = external_exports.object({
|
|
16476
|
-
name: external_exports.string().min(1),
|
|
16477
|
-
// The identity source: a marketplace repo for plugin skills (e.g.
|
|
16478
|
-
// 'anthropics/skills'), 'local' for personal ~/.claude/skills, or
|
|
16479
|
-
// 'project:<repo-identity>' for checked-in project skills. The surrogate keeps
|
|
16480
|
-
// a personal skill named 'pdf' from colliding with the marketplace 'pdf'.
|
|
16481
|
-
source: external_exports.string().min(1),
|
|
16482
|
-
scope: ConfigScope,
|
|
16483
|
-
pluginName: external_exports.string().optional(),
|
|
16484
|
-
// Volatile — rides the attribute bag, never the identity hash.
|
|
16485
|
-
version: external_exports.string().optional(),
|
|
16486
|
-
description: external_exports.string().optional(),
|
|
16487
|
-
// Skill directory mtime (ISO) — the "updated Nd ago" freshness signal.
|
|
16488
|
-
updatedAt: external_exports.iso.datetime().optional(),
|
|
16489
|
-
// Filesystem path — the promoted inventory `location` column.
|
|
16490
|
-
location: external_exports.string().optional()
|
|
16491
|
-
});
|
|
16492
|
-
var HookScanEntry = external_exports.object({
|
|
16493
|
-
// Hook event name (PreToolUse, PostToolUse, …). Open string, not an enum: the
|
|
16494
|
-
// set is harness-defined and grows without a schema change.
|
|
16495
|
-
event: external_exports.string().min(1),
|
|
16496
|
-
// The tool matcher ('Bash', 'Edit|Write', …). Absent = matches all tools.
|
|
16497
|
-
matcher: external_exports.string().optional(),
|
|
16498
|
-
command: external_exports.string().min(1),
|
|
16499
|
-
timeout: external_exports.number().optional(),
|
|
16500
|
-
scope: ConfigScope,
|
|
16501
|
-
pluginName: external_exports.string().optional(),
|
|
16502
|
-
// The settings file / hooks.json the entry came from.
|
|
16503
|
-
location: external_exports.string().optional()
|
|
16504
|
-
});
|
|
16505
|
-
var McpServerScanEntry = external_exports.object({
|
|
16506
|
-
// The server's config key ("github", "filesystem", …) — identity, with the
|
|
16507
|
-
// qualified scope (see mcpServerIdentityKey).
|
|
16508
|
-
name: external_exports.string().min(1),
|
|
16509
|
-
scope: ConfigScope,
|
|
16510
|
-
pluginName: external_exports.string().optional(),
|
|
16511
|
-
// The owning plugin's marketplace — part of PLUGIN-scope identity: two
|
|
16512
|
-
// marketplaces can each ship a plugin named `guard`, and without this their
|
|
16513
|
-
// same-named servers would collapse to one row (the second silently dropped,
|
|
16514
|
-
// inheriting the first's trust).
|
|
16515
|
-
marketplace: external_exports.string().optional(),
|
|
16516
|
-
// The repo identity (remote url, or the cwd for un-remoted repos) — part of
|
|
16517
|
-
// PROJECT/LOCAL-scope identity: a server named `github` in repo A and one in
|
|
16518
|
-
// repo B are different servers with different commands, and MUST NOT share a
|
|
16519
|
-
// row — a shared row would let a cloned repo's .mcp.json inherit the trust
|
|
16520
|
-
// the user granted elsewhere.
|
|
16521
|
-
project: external_exports.string().optional(),
|
|
16522
|
-
// 'stdio' when the entry carries a command; otherwise the config's `type`
|
|
16523
|
-
// ('http' / 'sse' / …). Open string — the transport set is harness-defined.
|
|
16524
|
-
transport: external_exports.string().min(1),
|
|
16525
|
-
// Volatile on purpose (unlike hook `command`): a changed command/url is drift
|
|
16526
|
-
// on a stable row — visible across config_scan snapshots and preserving the
|
|
16527
|
-
// user's trust decision — never a quiet new row. One of the two is present.
|
|
16528
|
-
// Secret-masked at collection time (the scanner runs the bundled detection
|
|
16529
|
-
// packs over both — tokens routinely ride command args and URLs).
|
|
16530
|
-
command: external_exports.string().optional(),
|
|
16531
|
-
url: external_exports.string().optional(),
|
|
16532
|
-
// Env var NAMES only, never values (the no-secrets rule).
|
|
16533
|
-
envKeys: external_exports.array(external_exports.string()).optional(),
|
|
16534
|
-
// The config file the entry came from.
|
|
16535
|
-
location: external_exports.string().optional()
|
|
16536
|
-
});
|
|
16537
|
-
var ConfigFileScanEntry = external_exports.object({
|
|
16538
|
-
// Basename (settings.json, CLAUDE.md) or dir name (commands/, agents/).
|
|
16539
|
-
name: external_exports.string().min(1),
|
|
16540
|
-
// The absolute path — identity (with scope) and the promoted `location`.
|
|
16541
|
-
path: external_exports.string().min(1),
|
|
16542
|
-
scope: ConfigScope,
|
|
16543
|
-
// Human label: "User settings", "Project memory", "Slash commands", …
|
|
16544
|
-
kind: external_exports.string().min(1),
|
|
16545
|
-
// Derived SHAPE summary — top-level key names, entry counts, line counts.
|
|
16546
|
-
// Never file content or values (memory files can carry sensitive detail).
|
|
16547
|
-
detail: external_exports.string().optional(),
|
|
16548
|
-
// Dir configs (commands/, agents/) and .mcp.json: how many entries.
|
|
16549
|
-
entryCount: external_exports.number().optional(),
|
|
16550
|
-
// File mtime (ISO) — the freshness signal.
|
|
16551
|
-
updatedAt: external_exports.iso.datetime().optional()
|
|
16552
|
-
});
|
|
16553
|
-
var ConfigScanResult = external_exports.object({
|
|
16554
|
-
scannedAt: external_exports.iso.datetime(),
|
|
16555
|
-
skills: external_exports.array(SkillScanEntry),
|
|
16556
|
-
hooks: external_exports.array(HookScanEntry),
|
|
16557
|
-
mcpServers: external_exports.array(McpServerScanEntry),
|
|
16558
|
-
configFiles: external_exports.array(ConfigFileScanEntry),
|
|
16559
|
-
errors: external_exports.array(external_exports.object({ source: external_exports.string(), reason: external_exports.string() }))
|
|
16560
|
-
});
|
|
16561
|
-
var ConfigPostureFindingInput = external_exports.object({
|
|
16562
|
-
ruleId: external_exports.string().min(1),
|
|
16563
|
-
version: external_exports.string().min(1),
|
|
16564
|
-
span: Span,
|
|
16565
|
-
// For posture rules this is the offending COMMAND (config the user already
|
|
16566
|
-
// holds locally, not captured secret content) — it is also the correlation
|
|
16567
|
-
// key the read surface matches back to a hook row.
|
|
16568
|
-
maskedMatch: external_exports.string(),
|
|
16569
|
-
actionTaken: ActionTaken,
|
|
16570
|
-
confidence: external_exports.number().min(0).max(1)
|
|
16571
|
-
});
|
|
16572
|
-
var ConfigScanRecord = external_exports.object({
|
|
16573
|
-
items: external_exports.array(InventoryInput),
|
|
16574
|
-
scanEvent: AuditEventInput,
|
|
16575
|
-
definitions: external_exports.array(InspectionDefinitionInput).optional(),
|
|
16576
|
-
findings: external_exports.array(ConfigPostureFindingInput).optional()
|
|
16577
|
-
});
|
|
16578
|
-
|
|
16579
|
-
// ../../packages/schema/src/zod/registry.ts
|
|
16580
|
-
var Namespace = external_exports.string().regex(/^[a-z][a-z0-9-]*$/);
|
|
16581
|
-
var PackId = external_exports.string().regex(/^[a-z][a-z0-9-]*$/);
|
|
16582
|
-
var SemVer = external_exports.string().regex(/^\d+\.\d+\.\d+(?:-[0-9A-Za-z-.]+)?$/);
|
|
16583
|
-
var PublisherKind = external_exports.enum(["labs", "user", "org"]);
|
|
16584
|
-
|
|
16585
16130
|
// ../../packages/schema/src/zod/detection.ts
|
|
16586
16131
|
var OriginEnum = external_exports.enum(["library"]).meta({ id: "OriginEnum" });
|
|
16587
16132
|
var DetectionFilterEnum = external_exports.enum(["all", "library", "custom", "customized", "updates"]);
|
|
@@ -16626,81 +16171,306 @@ var ListDetectionsQuery = external_exports.object({
|
|
|
16626
16171
|
filter: DetectionFilterEnum.optional().default("all"),
|
|
16627
16172
|
q: external_exports.string().optional()
|
|
16628
16173
|
});
|
|
16629
|
-
var DetectionStats = external_exports.object({
|
|
16630
|
-
detections: external_exports.number().int().nonnegative(),
|
|
16631
|
-
rules: external_exports.number().int().nonnegative(),
|
|
16632
|
-
active: external_exports.number().int().nonnegative(),
|
|
16633
|
-
findingsLast30d: external_exports.number().int().nonnegative()
|
|
16634
|
-
}).meta({ id: "DetectionStats" });
|
|
16635
|
-
var DetectionRule = external_exports.object({
|
|
16636
|
-
id: external_exports.string(),
|
|
16637
|
-
name: external_exports.string(),
|
|
16638
|
-
category: DetectionCategory,
|
|
16639
|
-
severity: Severity,
|
|
16640
|
-
matcher: Matcher
|
|
16641
|
-
}).meta({ id: "DetectionRule" });
|
|
16642
|
-
var DetectionUpdate = external_exports.object({
|
|
16643
|
-
available: external_exports.boolean(),
|
|
16644
|
-
latestVersion: SemVer,
|
|
16645
|
-
// Rule count of the latest snapshot. Lets the update UI show a meaningful
|
|
16646
|
-
// delta ("2 rules → 14 rules") when the version did NOT change but the rule
|
|
16647
|
-
// content did — the OSS store compares content, not just version. Optional:
|
|
16648
|
-
// registry-backed updates omit it.
|
|
16649
|
-
latestRuleCount: external_exports.number().int().nonnegative().optional()
|
|
16650
|
-
}).nullable().meta({ id: "DetectionUpdate" });
|
|
16651
|
-
var DetectionDetail = external_exports.object({
|
|
16652
|
-
id: external_exports.string(),
|
|
16653
|
-
name: external_exports.string(),
|
|
16654
|
-
version: SemVer,
|
|
16655
|
-
enabled: external_exports.boolean(),
|
|
16656
|
-
origin: OriginEnum,
|
|
16657
|
-
publisher: Namespace.optional(),
|
|
16658
|
-
publisherKind: PublisherKind.optional(),
|
|
16659
|
-
ruleCount: external_exports.number().int().nonnegative(),
|
|
16660
|
-
namespace: Namespace,
|
|
16661
|
-
packId: PackId,
|
|
16662
|
-
description: external_exports.string().optional(),
|
|
16663
|
-
editedAt: external_exports.iso.datetime(),
|
|
16664
|
-
findingsLast30d: external_exports.number().int().nonnegative(),
|
|
16665
|
-
latestVersion: SemVer.nullable().optional(),
|
|
16666
|
-
update: DetectionUpdate,
|
|
16667
|
-
rules: external_exports.array(DetectionRule),
|
|
16668
|
-
modified: external_exports.boolean(),
|
|
16669
|
-
// Per-pack enforcement-policy assignment. Holds a BuiltinPolicyId ARCHETYPE
|
|
16670
|
-
// (monitor|warn|redact|block) — NOT a policies-table Policy.id guid; a
|
|
16671
|
-
// detection is a PACK, and its policy is the archetype applied to all its
|
|
16672
|
-
// rules. Absent == unassigned, which resolves to Monitor everywhere
|
|
16673
|
-
// (DEFAULT_PACK_POLICY_ID). Every enforcement surface expands it into
|
|
16674
|
-
// per-rule policies (see policyIdToAction). Typed z.string() (not
|
|
16675
|
-
// the enum) to keep the OpenAPI response tolerant of a future custom id.
|
|
16676
|
-
policyId: external_exports.string().optional()
|
|
16677
|
-
}).meta({ id: "DetectionDetail" });
|
|
16678
|
-
var LibraryItem = external_exports.object({
|
|
16679
|
-
id: external_exports.string(),
|
|
16680
|
-
name: external_exports.string(),
|
|
16681
|
-
publisher: Namespace,
|
|
16682
|
-
publisherKind: PublisherKind.optional(),
|
|
16683
|
-
// LOSSY single-category view of a pack. A pack MAY span several categories;
|
|
16684
|
-
// this carries only the canonical-first one for display. Do NOT filter/facet
|
|
16685
|
-
// on it — the library filter matches a pack's full category set (see
|
|
16686
|
-
// ListLibraryResponse.categories).
|
|
16687
|
-
category: DetectionCategory.optional(),
|
|
16688
|
-
version: SemVer,
|
|
16689
|
-
ruleCount: external_exports.number().int().nonnegative(),
|
|
16690
|
-
description: external_exports.string().optional(),
|
|
16691
|
-
updatedAt: external_exports.iso.datetime(),
|
|
16692
|
-
state: LibraryStateEnum,
|
|
16693
|
-
importedAs: external_exports.string().nullable()
|
|
16694
|
-
}).meta({ id: "LibraryItem" });
|
|
16695
|
-
var ListLibraryResponse = external_exports.object({
|
|
16696
|
-
categories: external_exports.array(DetectionCategory),
|
|
16697
|
-
items: external_exports.array(LibraryItem)
|
|
16698
|
-
}).meta({ id: "ListLibraryResponse" });
|
|
16699
|
-
var ImportDetectionRequest = external_exports.object({
|
|
16700
|
-
libraryId: external_exports.string().refine((v) => /^[^/]+\/[^/]+$/.test(v), {
|
|
16701
|
-
message: "libraryId must be in namespace/packId format"
|
|
16702
|
-
})
|
|
16703
|
-
}).meta({ id: "ImportDetectionRequest" });
|
|
16174
|
+
var DetectionStats = external_exports.object({
|
|
16175
|
+
detections: external_exports.number().int().nonnegative(),
|
|
16176
|
+
rules: external_exports.number().int().nonnegative(),
|
|
16177
|
+
active: external_exports.number().int().nonnegative(),
|
|
16178
|
+
findingsLast30d: external_exports.number().int().nonnegative()
|
|
16179
|
+
}).meta({ id: "DetectionStats" });
|
|
16180
|
+
var DetectionRule = external_exports.object({
|
|
16181
|
+
id: external_exports.string(),
|
|
16182
|
+
name: external_exports.string(),
|
|
16183
|
+
category: DetectionCategory,
|
|
16184
|
+
severity: Severity,
|
|
16185
|
+
matcher: Matcher
|
|
16186
|
+
}).meta({ id: "DetectionRule" });
|
|
16187
|
+
var DetectionUpdate = external_exports.object({
|
|
16188
|
+
available: external_exports.boolean(),
|
|
16189
|
+
latestVersion: SemVer,
|
|
16190
|
+
// Rule count of the latest snapshot. Lets the update UI show a meaningful
|
|
16191
|
+
// delta ("2 rules → 14 rules") when the version did NOT change but the rule
|
|
16192
|
+
// content did — the OSS store compares content, not just version. Optional:
|
|
16193
|
+
// registry-backed updates omit it.
|
|
16194
|
+
latestRuleCount: external_exports.number().int().nonnegative().optional()
|
|
16195
|
+
}).nullable().meta({ id: "DetectionUpdate" });
|
|
16196
|
+
var DetectionDetail = external_exports.object({
|
|
16197
|
+
id: external_exports.string(),
|
|
16198
|
+
name: external_exports.string(),
|
|
16199
|
+
version: SemVer,
|
|
16200
|
+
enabled: external_exports.boolean(),
|
|
16201
|
+
origin: OriginEnum,
|
|
16202
|
+
publisher: Namespace.optional(),
|
|
16203
|
+
publisherKind: PublisherKind.optional(),
|
|
16204
|
+
ruleCount: external_exports.number().int().nonnegative(),
|
|
16205
|
+
namespace: Namespace,
|
|
16206
|
+
packId: PackId,
|
|
16207
|
+
description: external_exports.string().optional(),
|
|
16208
|
+
editedAt: external_exports.iso.datetime(),
|
|
16209
|
+
findingsLast30d: external_exports.number().int().nonnegative(),
|
|
16210
|
+
latestVersion: SemVer.nullable().optional(),
|
|
16211
|
+
update: DetectionUpdate,
|
|
16212
|
+
rules: external_exports.array(DetectionRule),
|
|
16213
|
+
modified: external_exports.boolean(),
|
|
16214
|
+
// Per-pack enforcement-policy assignment. Holds a BuiltinPolicyId ARCHETYPE
|
|
16215
|
+
// (monitor|warn|redact|block) — NOT a policies-table Policy.id guid; a
|
|
16216
|
+
// detection is a PACK, and its policy is the archetype applied to all its
|
|
16217
|
+
// rules. Absent == unassigned, which resolves to Monitor everywhere
|
|
16218
|
+
// (DEFAULT_PACK_POLICY_ID). Every enforcement surface expands it into
|
|
16219
|
+
// per-rule policies (see policyIdToAction). Typed z.string() (not
|
|
16220
|
+
// the enum) to keep the OpenAPI response tolerant of a future custom id.
|
|
16221
|
+
policyId: external_exports.string().optional()
|
|
16222
|
+
}).meta({ id: "DetectionDetail" });
|
|
16223
|
+
var LibraryItem = external_exports.object({
|
|
16224
|
+
id: external_exports.string(),
|
|
16225
|
+
name: external_exports.string(),
|
|
16226
|
+
publisher: Namespace,
|
|
16227
|
+
publisherKind: PublisherKind.optional(),
|
|
16228
|
+
// LOSSY single-category view of a pack. A pack MAY span several categories;
|
|
16229
|
+
// this carries only the canonical-first one for display. Do NOT filter/facet
|
|
16230
|
+
// on it — the library filter matches a pack's full category set (see
|
|
16231
|
+
// ListLibraryResponse.categories).
|
|
16232
|
+
category: DetectionCategory.optional(),
|
|
16233
|
+
version: SemVer,
|
|
16234
|
+
ruleCount: external_exports.number().int().nonnegative(),
|
|
16235
|
+
description: external_exports.string().optional(),
|
|
16236
|
+
updatedAt: external_exports.iso.datetime(),
|
|
16237
|
+
state: LibraryStateEnum,
|
|
16238
|
+
importedAs: external_exports.string().nullable()
|
|
16239
|
+
}).meta({ id: "LibraryItem" });
|
|
16240
|
+
var ListLibraryResponse = external_exports.object({
|
|
16241
|
+
categories: external_exports.array(DetectionCategory),
|
|
16242
|
+
items: external_exports.array(LibraryItem)
|
|
16243
|
+
}).meta({ id: "ListLibraryResponse" });
|
|
16244
|
+
var ImportDetectionRequest = external_exports.object({
|
|
16245
|
+
libraryId: external_exports.string().refine((v) => /^[^/]+\/[^/]+$/.test(v), {
|
|
16246
|
+
message: "libraryId must be in namespace/packId format"
|
|
16247
|
+
})
|
|
16248
|
+
}).meta({ id: "ImportDetectionRequest" });
|
|
16249
|
+
|
|
16250
|
+
// ../../packages/schema/src/zod/inventory.ts
|
|
16251
|
+
var AssetType = external_exports.enum(["project", "skill", "mcp", "hook", "config"]).meta({ id: "AssetType" });
|
|
16252
|
+
var AccessLevel = external_exports.enum(["open", "approved", "blocked"]).meta({ id: "AccessLevel" });
|
|
16253
|
+
var Origin = external_exports.enum(["source", "public-dep", "vendored", "config", "data", "docs", "generated"]).meta({ id: "Origin" });
|
|
16254
|
+
var TrustLevel = external_exports.enum(["known-good", "risky", "unapproved"]).meta({ id: "TrustLevel" });
|
|
16255
|
+
var Flag = external_exports.enum(["update", "stale", "conflict", "unknown", "change", "untracked", "risk", "findings"]).meta({ id: "Flag" });
|
|
16256
|
+
var Visibility = external_exports.enum(["public", "private"]).meta({ id: "Visibility" });
|
|
16257
|
+
var HarnessEventKind = external_exports.enum(["block", "redact", "warn"]).meta({ id: "HarnessEventKind" });
|
|
16258
|
+
var HarnessId = Harness.extract(["ClaudeCode", "Cursor", "Codex", "Antigravity"]).meta({
|
|
16259
|
+
id: "HarnessId"
|
|
16260
|
+
});
|
|
16261
|
+
var AccessCounts = external_exports.object({
|
|
16262
|
+
open: external_exports.number().int().nonnegative(),
|
|
16263
|
+
approved: external_exports.number().int().nonnegative(),
|
|
16264
|
+
blocked: external_exports.number().int().nonnegative(),
|
|
16265
|
+
total: external_exports.number().int().nonnegative()
|
|
16266
|
+
}).meta({ id: "AccessCounts" });
|
|
16267
|
+
var AssetSummary = external_exports.object({
|
|
16268
|
+
id: external_exports.string(),
|
|
16269
|
+
type: AssetType,
|
|
16270
|
+
name: external_exports.string(),
|
|
16271
|
+
sub: external_exports.string(),
|
|
16272
|
+
flags: external_exports.array(Flag),
|
|
16273
|
+
/** MCP servers only — omitted for all other types. */
|
|
16274
|
+
trust: TrustLevel.optional()
|
|
16275
|
+
}).meta({ id: "AssetSummary" });
|
|
16276
|
+
var ProjectSummary = external_exports.object({
|
|
16277
|
+
id: external_exports.string(),
|
|
16278
|
+
name: external_exports.string(),
|
|
16279
|
+
repo: external_exports.string(),
|
|
16280
|
+
visibility: Visibility,
|
|
16281
|
+
language: external_exports.string(),
|
|
16282
|
+
policyDefault: AccessLevel,
|
|
16283
|
+
updatedAt: external_exports.iso.datetime(),
|
|
16284
|
+
accessCounts: AccessCounts,
|
|
16285
|
+
findingsCount: external_exports.number().int().nonnegative()
|
|
16286
|
+
}).meta({ id: "ProjectSummary" });
|
|
16287
|
+
var HarnessCategory = external_exports.object({
|
|
16288
|
+
/** One of config/skill/mcp/hook — never project (enforced at service layer). */
|
|
16289
|
+
type: AssetType,
|
|
16290
|
+
assets: external_exports.array(AssetSummary)
|
|
16291
|
+
});
|
|
16292
|
+
var HarnessSummary = external_exports.object({
|
|
16293
|
+
id: HarnessId,
|
|
16294
|
+
label: external_exports.string(),
|
|
16295
|
+
kind: external_exports.string(),
|
|
16296
|
+
version: external_exports.string(),
|
|
16297
|
+
sessions: external_exports.number().int().nonnegative(),
|
|
16298
|
+
assetCount: external_exports.number().int().nonnegative(),
|
|
16299
|
+
flagCount: external_exports.number().int().nonnegative(),
|
|
16300
|
+
projects: external_exports.array(ProjectSummary),
|
|
16301
|
+
categories: external_exports.array(HarnessCategory)
|
|
16302
|
+
}).meta({ id: "HarnessSummary" });
|
|
16303
|
+
var ListHarnessesResponse = external_exports.object({ items: external_exports.array(HarnessSummary) }).meta({ id: "ListHarnessesResponse" });
|
|
16304
|
+
var AssetGroup = external_exports.object({
|
|
16305
|
+
/** Group key — never project (enforced at service layer). */
|
|
16306
|
+
type: AssetType,
|
|
16307
|
+
total: external_exports.number().int().nonnegative(),
|
|
16308
|
+
/**
|
|
16309
|
+
* MCP group only — omitted for all other types.
|
|
16310
|
+
* Partial: only TrustLevel keys with non-zero counts are included.
|
|
16311
|
+
* Strict: unknown keys are rejected — only TrustLevel values are valid keys.
|
|
16312
|
+
*/
|
|
16313
|
+
trustRollup: external_exports.object({
|
|
16314
|
+
"known-good": external_exports.number().int().nonnegative(),
|
|
16315
|
+
risky: external_exports.number().int().nonnegative(),
|
|
16316
|
+
unapproved: external_exports.number().int().nonnegative()
|
|
16317
|
+
}).partial().strict().optional(),
|
|
16318
|
+
/**
|
|
16319
|
+
* Partial: only Flag keys with non-zero counts are included.
|
|
16320
|
+
* Strict: unknown keys are rejected — only Flag values are valid keys.
|
|
16321
|
+
*/
|
|
16322
|
+
flagRollup: external_exports.object({
|
|
16323
|
+
update: external_exports.number().int().nonnegative(),
|
|
16324
|
+
stale: external_exports.number().int().nonnegative(),
|
|
16325
|
+
conflict: external_exports.number().int().nonnegative(),
|
|
16326
|
+
unknown: external_exports.number().int().nonnegative(),
|
|
16327
|
+
change: external_exports.number().int().nonnegative(),
|
|
16328
|
+
untracked: external_exports.number().int().nonnegative(),
|
|
16329
|
+
risk: external_exports.number().int().nonnegative(),
|
|
16330
|
+
findings: external_exports.number().int().nonnegative()
|
|
16331
|
+
}).partial().strict(),
|
|
16332
|
+
items: external_exports.array(AssetSummary)
|
|
16333
|
+
}).meta({ id: "AssetGroup" });
|
|
16334
|
+
var ListAssetsResponse = external_exports.object({ groups: external_exports.array(AssetGroup) }).meta({ id: "ListAssetsResponse" });
|
|
16335
|
+
var McpTool = external_exports.object({
|
|
16336
|
+
name: external_exports.string(),
|
|
16337
|
+
signature: external_exports.string(),
|
|
16338
|
+
description: external_exports.string(),
|
|
16339
|
+
write: external_exports.boolean(),
|
|
16340
|
+
/** Non-null string when tool is dangerous / blocked; null otherwise. */
|
|
16341
|
+
risk: external_exports.string().nullable()
|
|
16342
|
+
}).meta({ id: "McpTool" });
|
|
16343
|
+
var AssetFindingRef = external_exports.object({
|
|
16344
|
+
id: external_exports.string(),
|
|
16345
|
+
title: external_exports.string(),
|
|
16346
|
+
note: external_exports.string()
|
|
16347
|
+
});
|
|
16348
|
+
var AssetDetail = AssetSummary.extend({
|
|
16349
|
+
/** string | null — null when no description is available. */
|
|
16350
|
+
description: external_exports.string().nullable(),
|
|
16351
|
+
/** trustLevel | null — null for non-MCP assets. */
|
|
16352
|
+
trust: TrustLevel.nullable(),
|
|
16353
|
+
/** Type-specific raw key/values — FE renders the grid. */
|
|
16354
|
+
meta: external_exports.record(external_exports.string(), external_exports.unknown()),
|
|
16355
|
+
/** always present — object when there is an active finding, null when absent. */
|
|
16356
|
+
finding: AssetFindingRef.nullable(),
|
|
16357
|
+
/** MCP exposed-tools list — omitted for non-mcp. */
|
|
16358
|
+
tools: external_exports.array(McpTool).optional()
|
|
16359
|
+
}).meta({ id: "AssetDetail" });
|
|
16360
|
+
var ListProjectsResponse = external_exports.object({ items: external_exports.array(ProjectSummary) }).meta({ id: "ListProjectsResponse" });
|
|
16361
|
+
var InventoryStats = external_exports.object({
|
|
16362
|
+
/** Total assets/projects with ≥1 flag or finding (drives the attention header chip). */
|
|
16363
|
+
attention: external_exports.number().int().nonnegative(),
|
|
16364
|
+
byType: external_exports.object({
|
|
16365
|
+
project: external_exports.number().int().nonnegative(),
|
|
16366
|
+
skill: external_exports.number().int().nonnegative(),
|
|
16367
|
+
mcp: external_exports.number().int().nonnegative(),
|
|
16368
|
+
hook: external_exports.number().int().nonnegative(),
|
|
16369
|
+
config: external_exports.number().int().nonnegative()
|
|
16370
|
+
}),
|
|
16371
|
+
harnesses: external_exports.number().int().nonnegative(),
|
|
16372
|
+
mcpTrust: external_exports.object({
|
|
16373
|
+
"known-good": external_exports.number().int().nonnegative(),
|
|
16374
|
+
risky: external_exports.number().int().nonnegative(),
|
|
16375
|
+
unapproved: external_exports.number().int().nonnegative()
|
|
16376
|
+
})
|
|
16377
|
+
}).meta({ id: "InventoryStats" });
|
|
16378
|
+
var FileSummary = external_exports.object({
|
|
16379
|
+
path: external_exports.string(),
|
|
16380
|
+
name: external_exports.string(),
|
|
16381
|
+
origin: Origin,
|
|
16382
|
+
/** Effective access (override applied). */
|
|
16383
|
+
access: AccessLevel,
|
|
16384
|
+
/** True when a file_access_override differs from the computed default. */
|
|
16385
|
+
isCustom: external_exports.boolean(),
|
|
16386
|
+
findings: external_exports.number().int().nonnegative(),
|
|
16387
|
+
/** When the file was auto-blocked by a detection; null when not blocked. */
|
|
16388
|
+
blockedAt: external_exports.iso.datetime().nullable().optional(),
|
|
16389
|
+
/** Why the file was blocked; null when absent. */
|
|
16390
|
+
note: external_exports.string().nullable().optional()
|
|
16391
|
+
}).meta({ id: "FileSummary" });
|
|
16392
|
+
var FolderSummary = external_exports.object({
|
|
16393
|
+
name: external_exports.string(),
|
|
16394
|
+
path: external_exports.string(),
|
|
16395
|
+
/** Rollup of effective access across all descendants. */
|
|
16396
|
+
accessCounts: AccessCounts
|
|
16397
|
+
}).meta({ id: "FolderSummary" });
|
|
16398
|
+
var ProjectTreeResponse = external_exports.object({
|
|
16399
|
+
project: external_exports.object({
|
|
16400
|
+
id: external_exports.string(),
|
|
16401
|
+
repo: external_exports.string(),
|
|
16402
|
+
visibility: Visibility
|
|
16403
|
+
}),
|
|
16404
|
+
path: external_exports.string(),
|
|
16405
|
+
/** Browse mode: one-level folders at the current path. Omitted in search mode. */
|
|
16406
|
+
folders: external_exports.array(FolderSummary).optional(),
|
|
16407
|
+
files: external_exports.array(FileSummary)
|
|
16408
|
+
}).meta({ id: "ProjectTreeResponse" });
|
|
16409
|
+
var FileDetail = FileSummary.extend({
|
|
16410
|
+
project: external_exports.object({
|
|
16411
|
+
repo: external_exports.string(),
|
|
16412
|
+
visibility: Visibility,
|
|
16413
|
+
language: external_exports.string(),
|
|
16414
|
+
policyDefault: AccessLevel,
|
|
16415
|
+
updatedAt: external_exports.iso.datetime()
|
|
16416
|
+
}),
|
|
16417
|
+
findingsRefs: external_exports.array(external_exports.object({ id: external_exports.string(), title: external_exports.string() }))
|
|
16418
|
+
}).meta({ id: "FileDetail" });
|
|
16419
|
+
var SetFileAccessBody = external_exports.object({
|
|
16420
|
+
path: external_exports.string(),
|
|
16421
|
+
access: AccessLevel
|
|
16422
|
+
}).meta({ id: "SetFileAccessBody" });
|
|
16423
|
+
var SetFileAccessResponse = external_exports.object({
|
|
16424
|
+
file: FileSummary,
|
|
16425
|
+
accessCounts: AccessCounts
|
|
16426
|
+
}).meta({ id: "SetFileAccessResponse" });
|
|
16427
|
+
var SetMcpTrustBody = external_exports.object({ trust: TrustLevel }).meta({ id: "SetMcpTrustBody" });
|
|
16428
|
+
var HarnessEventItem = external_exports.object({
|
|
16429
|
+
kind: HarnessEventKind,
|
|
16430
|
+
title: external_exports.string(),
|
|
16431
|
+
detail: external_exports.string(),
|
|
16432
|
+
occurredAt: external_exports.iso.datetime(),
|
|
16433
|
+
findingId: external_exports.string().nullable().optional()
|
|
16434
|
+
}).meta({ id: "HarnessEventItem" });
|
|
16435
|
+
var HarnessEventsResponse = external_exports.object({
|
|
16436
|
+
counts: external_exports.object({
|
|
16437
|
+
block: external_exports.number().int().nonnegative(),
|
|
16438
|
+
redact: external_exports.number().int().nonnegative(),
|
|
16439
|
+
warn: external_exports.number().int().nonnegative()
|
|
16440
|
+
}),
|
|
16441
|
+
items: external_exports.array(HarnessEventItem)
|
|
16442
|
+
}).meta({ id: "HarnessEventsResponse" });
|
|
16443
|
+
var RescanResponse = external_exports.object({
|
|
16444
|
+
jobId: external_exports.string(),
|
|
16445
|
+
startedAt: external_exports.iso.datetime()
|
|
16446
|
+
}).meta({ id: "RescanResponse" });
|
|
16447
|
+
var ConnectProjectBody = external_exports.object({ repo: external_exports.string() }).meta({ id: "ConnectProjectBody" });
|
|
16448
|
+
var ListAssetsQuery = external_exports.object({
|
|
16449
|
+
/** Filter by one or more AssetType values; absent means all types. */
|
|
16450
|
+
type: external_exports.array(AssetType).optional(),
|
|
16451
|
+
/** Free-text search term. */
|
|
16452
|
+
q: external_exports.string().optional()
|
|
16453
|
+
});
|
|
16454
|
+
var GetProjectTreeQuery = external_exports.object({
|
|
16455
|
+
/** Subtree root path; defaults to repository root when absent. */
|
|
16456
|
+
path: external_exports.string().optional(),
|
|
16457
|
+
/** Free-text filter applied to file paths. */
|
|
16458
|
+
q: external_exports.string().optional(),
|
|
16459
|
+
/**
|
|
16460
|
+
* Special listing mode. `blocked` returns every effectively-blocked, auto-blocked
|
|
16461
|
+
* file across the whole repo (folders omitted, most-recent first), ignoring
|
|
16462
|
+
* `path`/`q` — powers the project-wide "recently blocked" strip.
|
|
16463
|
+
*/
|
|
16464
|
+
filter: external_exports.enum(["blocked"]).optional()
|
|
16465
|
+
});
|
|
16466
|
+
var GetProjectFileQuery = external_exports.object({
|
|
16467
|
+
/** Repository-relative file path; absent or empty → 400. */
|
|
16468
|
+
path: external_exports.string()
|
|
16469
|
+
});
|
|
16470
|
+
var GetHarnessEventsQuery = external_exports.object({
|
|
16471
|
+
/** Maximum number of events to return. Range: 1–50; default: 7. */
|
|
16472
|
+
limit: external_exports.coerce.number().int().min(1).max(50).default(7)
|
|
16473
|
+
});
|
|
16704
16474
|
|
|
16705
16475
|
// ../../packages/schema/src/zod/shares.ts
|
|
16706
16476
|
var DestinationKind = external_exports.enum(["provider", "internal", "external", "ip"]).meta({ id: "DestinationKind" });
|
|
@@ -16841,72 +16611,193 @@ var ExportSharesQuery = external_exports.object({
|
|
|
16841
16611
|
q: external_exports.string().optional(),
|
|
16842
16612
|
kind: external_exports.array(DestinationKind).optional()
|
|
16843
16613
|
});
|
|
16844
|
-
|
|
16845
|
-
// ../../packages/schema/src/zod/egress-extraction.ts
|
|
16846
|
-
var EgressEcosystem = external_exports.enum(["npm", "pypi", "go", "maven", "rubygems", "cargo", "composer", "nuget"]).meta({ id: "EgressEcosystem" });
|
|
16847
|
-
var ProviderRegistryEntry = external_exports.object({
|
|
16848
|
-
id: external_exports.string(),
|
|
16849
|
-
name: external_exports.string(),
|
|
16850
|
-
category: external_exports.string(),
|
|
16851
|
-
/** Suffix-matched: 'stripe.com' matches api.stripe.com, never evilstripe.com. */
|
|
16852
|
-
hostSuffixes: external_exports.array(external_exports.string()).min(1),
|
|
16853
|
-
/** Canonical API base URL recorded for manifest-derived (method 'SDK') endpoints. */
|
|
16854
|
-
apiBase: external_exports.string(),
|
|
16855
|
-
/** Most-sensitive first; index 0 becomes the endpoint dataClass. */
|
|
16856
|
-
defaultDataClasses: external_exports.array(DataClass).min(1),
|
|
16857
|
-
/** SDK identifiers per ecosystem ('go' prefix-matched by path, 'maven' by group-id prefix). */
|
|
16858
|
-
sdks: external_exports.partialRecord(EgressEcosystem, external_exports.array(external_exports.string()))
|
|
16859
|
-
}).meta({ id: "ProviderRegistryEntry" });
|
|
16860
|
-
var EgressCallSiteHit = external_exports.object({
|
|
16861
|
-
file: external_exports.string(),
|
|
16862
|
-
line: external_exports.number().int().positive(),
|
|
16863
|
-
snippet: external_exports.string(),
|
|
16864
|
-
dynamic: external_exports.boolean(),
|
|
16865
|
-
vendored: external_exports.boolean()
|
|
16866
|
-
}).meta({ id: "EgressCallSiteHit" });
|
|
16867
|
-
var ResolvedEgressHit = external_exports.object({
|
|
16868
|
-
host: external_exports.string(),
|
|
16869
|
-
kind: DestinationKind,
|
|
16870
|
-
name: external_exports.string(),
|
|
16871
|
-
category: external_exports.string(),
|
|
16872
|
-
trust: ShareTrustLevel,
|
|
16873
|
-
network: DestinationNetwork.nullable(),
|
|
16874
|
-
method: HttpMethod,
|
|
16875
|
-
transport: Transport,
|
|
16876
|
-
url: external_exports.string(),
|
|
16877
|
-
template: external_exports.boolean(),
|
|
16878
|
-
dataClass: DataClass,
|
|
16879
|
-
site: EgressCallSiteHit
|
|
16880
|
-
}).meta({ id: "ResolvedEgressHit" });
|
|
16881
|
-
var EgressReconcile = external_exports.discriminatedUnion("mode", [
|
|
16882
|
-
external_exports.object({ mode: external_exports.literal("walk"), walkedPrefix: external_exports.string() }),
|
|
16883
|
-
external_exports.object({
|
|
16884
|
-
mode: external_exports.literal("ledger"),
|
|
16885
|
-
scannedFiles: external_exports.array(external_exports.string()),
|
|
16886
|
-
deletedFiles: external_exports.array(external_exports.string())
|
|
16887
|
-
})
|
|
16888
|
-
]).meta({ id: "EgressReconcile" });
|
|
16889
|
-
var RecordProjectEgressInput = external_exports.object({
|
|
16890
|
-
/** Stable reconcile key: 'git:<repo identity>' or 'path:<abs root>' (non-git). */
|
|
16891
|
-
projectKey: external_exports.string().min(1),
|
|
16892
|
-
/** Display name only — never keys reconciliation. */
|
|
16893
|
-
project: external_exports.string(),
|
|
16894
|
-
projectId: external_exports.string().nullable(),
|
|
16895
|
-
reconcile: EgressReconcile,
|
|
16896
|
-
hits: external_exports.array(ResolvedEgressHit)
|
|
16897
|
-
}).meta({ id: "RecordProjectEgressInput" });
|
|
16898
|
-
var EgressWriteSummary = external_exports.object({
|
|
16899
|
-
destinations: external_exports.number().int().nonnegative(),
|
|
16900
|
-
endpoints: external_exports.number().int().nonnegative(),
|
|
16901
|
-
callSites: external_exports.number().int().nonnegative(),
|
|
16902
|
-
truncated: external_exports.boolean(),
|
|
16903
|
-
/**
|
|
16904
|
-
* Files the cap dropped whole. Their stored rows were left untouched, so a
|
|
16905
|
-
* ledger-keeping caller must withhold their ledger entries and read them
|
|
16906
|
-
* again next scan.
|
|
16907
|
-
*/
|
|
16908
|
-
droppedFiles: external_exports.array(external_exports.string()).default([])
|
|
16909
|
-
}).meta({ id: "EgressWriteSummary" });
|
|
16614
|
+
|
|
16615
|
+
// ../../packages/schema/src/zod/egress-extraction.ts
|
|
16616
|
+
var EgressEcosystem = external_exports.enum(["npm", "pypi", "go", "maven", "rubygems", "cargo", "composer", "nuget"]).meta({ id: "EgressEcosystem" });
|
|
16617
|
+
var ProviderRegistryEntry = external_exports.object({
|
|
16618
|
+
id: external_exports.string(),
|
|
16619
|
+
name: external_exports.string(),
|
|
16620
|
+
category: external_exports.string(),
|
|
16621
|
+
/** Suffix-matched: 'stripe.com' matches api.stripe.com, never evilstripe.com. */
|
|
16622
|
+
hostSuffixes: external_exports.array(external_exports.string()).min(1),
|
|
16623
|
+
/** Canonical API base URL recorded for manifest-derived (method 'SDK') endpoints. */
|
|
16624
|
+
apiBase: external_exports.string(),
|
|
16625
|
+
/** Most-sensitive first; index 0 becomes the endpoint dataClass. */
|
|
16626
|
+
defaultDataClasses: external_exports.array(DataClass).min(1),
|
|
16627
|
+
/** SDK identifiers per ecosystem ('go' prefix-matched by path, 'maven' by group-id prefix). */
|
|
16628
|
+
sdks: external_exports.partialRecord(EgressEcosystem, external_exports.array(external_exports.string()))
|
|
16629
|
+
}).meta({ id: "ProviderRegistryEntry" });
|
|
16630
|
+
var EgressCallSiteHit = external_exports.object({
|
|
16631
|
+
file: external_exports.string(),
|
|
16632
|
+
line: external_exports.number().int().positive(),
|
|
16633
|
+
snippet: external_exports.string(),
|
|
16634
|
+
dynamic: external_exports.boolean(),
|
|
16635
|
+
vendored: external_exports.boolean()
|
|
16636
|
+
}).meta({ id: "EgressCallSiteHit" });
|
|
16637
|
+
var ResolvedEgressHit = external_exports.object({
|
|
16638
|
+
host: external_exports.string(),
|
|
16639
|
+
kind: DestinationKind,
|
|
16640
|
+
name: external_exports.string(),
|
|
16641
|
+
category: external_exports.string(),
|
|
16642
|
+
trust: ShareTrustLevel,
|
|
16643
|
+
network: DestinationNetwork.nullable(),
|
|
16644
|
+
method: HttpMethod,
|
|
16645
|
+
transport: Transport,
|
|
16646
|
+
url: external_exports.string(),
|
|
16647
|
+
template: external_exports.boolean(),
|
|
16648
|
+
dataClass: DataClass,
|
|
16649
|
+
site: EgressCallSiteHit
|
|
16650
|
+
}).meta({ id: "ResolvedEgressHit" });
|
|
16651
|
+
var EgressReconcile = external_exports.discriminatedUnion("mode", [
|
|
16652
|
+
external_exports.object({ mode: external_exports.literal("walk"), walkedPrefix: external_exports.string() }),
|
|
16653
|
+
external_exports.object({
|
|
16654
|
+
mode: external_exports.literal("ledger"),
|
|
16655
|
+
scannedFiles: external_exports.array(external_exports.string()),
|
|
16656
|
+
deletedFiles: external_exports.array(external_exports.string())
|
|
16657
|
+
})
|
|
16658
|
+
]).meta({ id: "EgressReconcile" });
|
|
16659
|
+
var RecordProjectEgressInput = external_exports.object({
|
|
16660
|
+
/** Stable reconcile key: 'git:<repo identity>' or 'path:<abs root>' (non-git). */
|
|
16661
|
+
projectKey: external_exports.string().min(1),
|
|
16662
|
+
/** Display name only — never keys reconciliation. */
|
|
16663
|
+
project: external_exports.string(),
|
|
16664
|
+
projectId: external_exports.string().nullable(),
|
|
16665
|
+
reconcile: EgressReconcile,
|
|
16666
|
+
hits: external_exports.array(ResolvedEgressHit)
|
|
16667
|
+
}).meta({ id: "RecordProjectEgressInput" });
|
|
16668
|
+
var EgressWriteSummary = external_exports.object({
|
|
16669
|
+
destinations: external_exports.number().int().nonnegative(),
|
|
16670
|
+
endpoints: external_exports.number().int().nonnegative(),
|
|
16671
|
+
callSites: external_exports.number().int().nonnegative(),
|
|
16672
|
+
truncated: external_exports.boolean(),
|
|
16673
|
+
/**
|
|
16674
|
+
* Files the cap dropped whole. Their stored rows were left untouched, so a
|
|
16675
|
+
* ledger-keeping caller must withhold their ledger entries and read them
|
|
16676
|
+
* again next scan.
|
|
16677
|
+
*/
|
|
16678
|
+
droppedFiles: external_exports.array(external_exports.string()).default([])
|
|
16679
|
+
}).meta({ id: "EgressWriteSummary" });
|
|
16680
|
+
|
|
16681
|
+
// ../../packages/schema/src/zod/event.ts
|
|
16682
|
+
var EventKind = external_exports.enum(["prompt", "response", "code_change", "tool_use"]).meta({ id: "EventKind" });
|
|
16683
|
+
var CAPTURE_EVENT_TYPES_SQL = EventKind.options.map((k) => `'${k}'`).join(",");
|
|
16684
|
+
var EventMetadata = external_exports.object({
|
|
16685
|
+
sessionId: external_exports.string().optional(),
|
|
16686
|
+
repo: external_exports.string().optional(),
|
|
16687
|
+
filePath: external_exports.string().optional(),
|
|
16688
|
+
// The host tool whose input/output was scanned (e.g. 'Bash', 'WebFetch'),
|
|
16689
|
+
// set by the tool-scanning hooks. The tool NAME only — never the tool's
|
|
16690
|
+
// arguments or output, which can carry the very value a finding masked
|
|
16691
|
+
// (metadata is stored unredacted). Gives findings on non-file captures a
|
|
16692
|
+
// display location ("via Bash") when no filePath exists.
|
|
16693
|
+
toolName: external_exports.string().optional(),
|
|
16694
|
+
// Set (true) by the worktree scanner when the file is excluded by the
|
|
16695
|
+
// repo's .gitignore. Gitignored files ARE still scanned — local scratch and
|
|
16696
|
+
// generated code can leak real secrets — but the provenance is recorded so
|
|
16697
|
+
// policy/dashboards can treat those findings as informational rather than
|
|
16698
|
+
// blocking. Omitted (not false) for tracked files and non-scan events.
|
|
16699
|
+
gitignored: external_exports.boolean().optional(),
|
|
16700
|
+
// Set (true) ONLY when the event's `content` is the COMPLETE file at
|
|
16701
|
+
// capture time (a worktree scan reading from disk). Hook-captured edits
|
|
16702
|
+
// (e.g. an Edit tool's new_string) are partial fragments and MUST NOT set
|
|
16703
|
+
// this. The resolver-on-ingest keys its fixed-at-source dropout
|
|
16704
|
+
// diff on this marker: only a whole-file snapshot can prove a previously
|
|
16705
|
+
// open finding is gone; a fragment's absence proves nothing (the secret
|
|
16706
|
+
// may live outside the hunk). Omitted (not false) for fragments and
|
|
16707
|
+
// non-scan events, so pre-marker clients safely default to the
|
|
16708
|
+
// non-authoritative path.
|
|
16709
|
+
wholeFile: external_exports.boolean().optional(),
|
|
16710
|
+
model: external_exports.string().optional(),
|
|
16711
|
+
turnIndex: external_exports.number().int().nonnegative().optional(),
|
|
16712
|
+
// Distributed-tracing correlation. `correlationId` ties a recorded event back
|
|
16713
|
+
// to the request that captured/ingested it (a UUID, generated independently of
|
|
16714
|
+
// the trace id); `traceId` is the W3C trace id (32 lowercase hex chars) of the
|
|
16715
|
+
// originating span when telemetry is enabled. Both optional + backward
|
|
16716
|
+
// compatible — populated by the plugin (see @akasecurity/plugin-sdk).
|
|
16717
|
+
correlationId: external_exports.uuid().optional(),
|
|
16718
|
+
traceId: external_exports.string().regex(/^[0-9a-f]{32}$/).optional(),
|
|
16719
|
+
// Ids of the detection exceptions that downgraded findings in this capture
|
|
16720
|
+
// to 'allow' — the enforcement audit trail's link back to the grant that
|
|
16721
|
+
// authorized the bypass. Absent on captures where no exception applied.
|
|
16722
|
+
exceptionIds: external_exports.array(external_exports.guid()).optional()
|
|
16723
|
+
}).meta({ id: "EventMetadata" });
|
|
16724
|
+
var Event = external_exports.object({
|
|
16725
|
+
id: external_exports.guid(),
|
|
16726
|
+
sourceTool: SourceTool,
|
|
16727
|
+
kind: EventKind,
|
|
16728
|
+
occurredAt: external_exports.iso.datetime(),
|
|
16729
|
+
contentHash: external_exports.string(),
|
|
16730
|
+
content: external_exports.string(),
|
|
16731
|
+
metadata: EventMetadata.optional()
|
|
16732
|
+
}).meta({ id: "Event" });
|
|
16733
|
+
var IngestEvent = Event.meta({ id: "IngestEvent" });
|
|
16734
|
+
var IngestBatch = external_exports.object({
|
|
16735
|
+
events: external_exports.array(IngestEvent).min(1).max(100),
|
|
16736
|
+
// Dedup policy for this batch. Id-dedup ALWAYS applies. 'content-hash'
|
|
16737
|
+
// additionally rejects any event whose contentHash the store has already
|
|
16738
|
+
// recorded — for re-runnable bulk ingest (worktree scan, transcript
|
|
16739
|
+
// backfill), where a re-run mints fresh event ids for identical content and
|
|
16740
|
+
// would otherwise accumulate duplicates. Live hook traffic must NOT set it:
|
|
16741
|
+
// two genuinely separate prompts can be byte-identical and both belong on
|
|
16742
|
+
// the timeline.
|
|
16743
|
+
dedupe: external_exports.literal("content-hash").optional()
|
|
16744
|
+
}).meta({ id: "IngestBatch" });
|
|
16745
|
+
|
|
16746
|
+
// ../../packages/schema/src/zod/exception.ts
|
|
16747
|
+
var ExceptionScope = external_exports.enum(["once", "temporary", "permanent"]);
|
|
16748
|
+
var ExceptionConditions = external_exports.object({
|
|
16749
|
+
repo: external_exports.string().optional(),
|
|
16750
|
+
sourceTool: external_exports.string().optional(),
|
|
16751
|
+
provider: external_exports.string().optional()
|
|
16752
|
+
}).strict();
|
|
16753
|
+
var ExceptionCapability = external_exports.enum(["suppress", "reveal_to_model"]);
|
|
16754
|
+
var DetectionException = external_exports.object({
|
|
16755
|
+
id: external_exports.guid(),
|
|
16756
|
+
ruleId: external_exports.string(),
|
|
16757
|
+
// Denormalized from the rule, for reporting — never matched on.
|
|
16758
|
+
category: DetectionCategory,
|
|
16759
|
+
// HMAC-SHA256 hex of the raw match under a machine-local key: a KEYED
|
|
16760
|
+
// fingerprint, never the raw value, and never reversible. Matching recomputes
|
|
16761
|
+
// the fingerprint from a fresh capture; the value itself is never stored.
|
|
16762
|
+
// Shape-constrained so a malformed — or accidentally raw — value is rejected
|
|
16763
|
+
// at the boundary rather than persisted.
|
|
16764
|
+
valueFingerprint: external_exports.string().regex(/^[0-9a-f]{64}$/),
|
|
16765
|
+
// Version of the fingerprint key the grant was written under; a rotated key
|
|
16766
|
+
// invalidates old grants rather than silently mismatching them.
|
|
16767
|
+
keyVersion: external_exports.number().int().positive(),
|
|
16768
|
+
// maskMatch() preview of the approved value — never the raw value.
|
|
16769
|
+
maskedValue: external_exports.string(),
|
|
16770
|
+
capability: ExceptionCapability.default("suppress"),
|
|
16771
|
+
scope: ExceptionScope,
|
|
16772
|
+
expiresAt: external_exports.iso.datetime().nullable(),
|
|
16773
|
+
maxUses: external_exports.number().int().positive().nullable(),
|
|
16774
|
+
useCount: external_exports.number().int().nonnegative(),
|
|
16775
|
+
lastUsedAt: external_exports.iso.datetime().nullable(),
|
|
16776
|
+
// Mandatory: every grant carries the human reason it exists.
|
|
16777
|
+
justification: external_exports.string().min(1),
|
|
16778
|
+
conditions: ExceptionConditions.nullable(),
|
|
16779
|
+
createdBy: external_exports.string(),
|
|
16780
|
+
createdVia: external_exports.enum(["cli-approve", "cli-add", "web-approve", "web-add", "api", "setup-triage"]),
|
|
16781
|
+
createdAt: external_exports.iso.datetime(),
|
|
16782
|
+
updatedAt: external_exports.iso.datetime(),
|
|
16783
|
+
// Revocation is terminal and retained — consumed/expired/revoked rows are
|
|
16784
|
+
// audit evidence; nothing in the exception lifecycle hard-deletes.
|
|
16785
|
+
revokedAt: external_exports.iso.datetime().nullable(),
|
|
16786
|
+
revokedBy: external_exports.string().nullable(),
|
|
16787
|
+
revokeReason: external_exports.string().nullable()
|
|
16788
|
+
});
|
|
16789
|
+
var ExceptionBundleEntry = DetectionException.pick({
|
|
16790
|
+
id: true,
|
|
16791
|
+
ruleId: true,
|
|
16792
|
+
valueFingerprint: true,
|
|
16793
|
+
keyVersion: true,
|
|
16794
|
+
capability: true,
|
|
16795
|
+
expiresAt: true,
|
|
16796
|
+
maxUses: true,
|
|
16797
|
+
useCount: true,
|
|
16798
|
+
conditions: true
|
|
16799
|
+
});
|
|
16800
|
+
var ExceptionDescriptor = DetectionException.omit({ valueFingerprint: true });
|
|
16910
16801
|
|
|
16911
16802
|
// ../../packages/schema/src/zod/exception-action.ts
|
|
16912
16803
|
var confirmation = external_exports.string().optional();
|
|
@@ -17112,6 +17003,7 @@ var ListVaultDerefsResponse = external_exports.object({
|
|
|
17112
17003
|
});
|
|
17113
17004
|
var VaultKeyCustody = external_exports.string();
|
|
17114
17005
|
var VaultInlineReveal = external_exports.enum(["masked", "full", "off"]);
|
|
17006
|
+
var VAULT_CONSENT_VERSION = 1;
|
|
17115
17007
|
var VaultConsent = external_exports.object({
|
|
17116
17008
|
acknowledgedAt: external_exports.iso.datetime(),
|
|
17117
17009
|
version: external_exports.number().int().positive()
|
|
@@ -17119,7 +17011,14 @@ var VaultConsent = external_exports.object({
|
|
|
17119
17011
|
|
|
17120
17012
|
// ../../packages/schema/src/zod/local.ts
|
|
17121
17013
|
var WORKSPACE_SETTINGS_SPEC_VERSION = 5;
|
|
17122
|
-
var
|
|
17014
|
+
var MODEL_JUDGE_PAYLOAD_VERSION = 1;
|
|
17015
|
+
var RunMode = external_exports.enum(["standalone", "attached"]);
|
|
17016
|
+
var ControlPlaneConnection = external_exports.object({
|
|
17017
|
+
endpoint: external_exports.string().min(1),
|
|
17018
|
+
// Display name for the deployment, shown instead of the raw endpoint.
|
|
17019
|
+
label: external_exports.string().min(1).optional(),
|
|
17020
|
+
attachedAt: external_exports.iso.datetime()
|
|
17021
|
+
}).meta({ id: "ControlPlaneConnection" });
|
|
17123
17022
|
var SimpleDetectionPolicy = external_exports.enum(["redact", "warn"]);
|
|
17124
17023
|
var HistoricalAccess = external_exports.enum(["full", "session-only"]);
|
|
17125
17024
|
var ModelJudgeConsent = external_exports.object({
|
|
@@ -17128,12 +17027,10 @@ var ModelJudgeConsent = external_exports.object({
|
|
|
17128
17027
|
});
|
|
17129
17028
|
var WorkspaceSettings = external_exports.object({
|
|
17130
17029
|
specVersion: external_exports.number().int().positive().default(WORKSPACE_SETTINGS_SPEC_VERSION),
|
|
17131
|
-
|
|
17132
|
-
//
|
|
17133
|
-
runMode:
|
|
17134
|
-
|
|
17135
|
-
RunMode.default("standalone")
|
|
17136
|
-
),
|
|
17030
|
+
runMode: RunMode.default("standalone"),
|
|
17031
|
+
// Present only while attached; a detach clears it. Its presence is what makes
|
|
17032
|
+
// `runMode: 'attached'` mean anything — see isAttached.
|
|
17033
|
+
controlPlane: ControlPlaneConnection.optional(),
|
|
17137
17034
|
policy: SimpleDetectionPolicy.default("redact"),
|
|
17138
17035
|
// Consent for scanning pre-install surfaces; opt-in (see HistoricalAccess).
|
|
17139
17036
|
historicalAccess: HistoricalAccess.default("session-only"),
|
|
@@ -17162,6 +17059,196 @@ function defaultWorkspaceSettings() {
|
|
|
17162
17059
|
return WorkspaceSettings.parse({});
|
|
17163
17060
|
}
|
|
17164
17061
|
|
|
17062
|
+
// ../../packages/schema/src/zod/managed.ts
|
|
17063
|
+
var MANAGED_SETTINGS_FILENAME = "managed-settings.json";
|
|
17064
|
+
var MANAGED_SETTINGS_SPEC_VERSION = 1;
|
|
17065
|
+
var ManagedSettingKey = external_exports.enum([
|
|
17066
|
+
"runMode",
|
|
17067
|
+
"historicalAccess",
|
|
17068
|
+
"vaultConsent",
|
|
17069
|
+
"vaultKeyCustody",
|
|
17070
|
+
"vaultInlineReveal",
|
|
17071
|
+
"modelJudgeConsent",
|
|
17072
|
+
"dataSharesInPlace"
|
|
17073
|
+
]).meta({ id: "ManagedSettingKey" });
|
|
17074
|
+
var ManagedSettingsValues = external_exports.object({
|
|
17075
|
+
runMode: external_exports.enum(["standalone", "attached"]).optional(),
|
|
17076
|
+
controlPlane: external_exports.object({
|
|
17077
|
+
endpoint: external_exports.string().min(1),
|
|
17078
|
+
label: external_exports.string().min(1).optional()
|
|
17079
|
+
}).optional(),
|
|
17080
|
+
historicalAccess: external_exports.enum(["full", "session-only"]).optional(),
|
|
17081
|
+
vaultConsent: external_exports.boolean().optional(),
|
|
17082
|
+
vaultKeyCustody: external_exports.enum(["file", "keychain"]).optional(),
|
|
17083
|
+
vaultInlineReveal: external_exports.enum(["masked", "full", "off"]).optional(),
|
|
17084
|
+
modelJudgeConsent: external_exports.boolean().optional(),
|
|
17085
|
+
dataSharesInPlace: external_exports.boolean().optional()
|
|
17086
|
+
}).meta({ id: "ManagedSettingsValues" });
|
|
17087
|
+
var ManagedSettings = external_exports.object({
|
|
17088
|
+
specVersion: external_exports.number().int().positive().default(MANAGED_SETTINGS_SPEC_VERSION),
|
|
17089
|
+
// Shown on every locked control, so the user can tell an administrative
|
|
17090
|
+
// decision from a bug. Absent renders as a generic "your organization".
|
|
17091
|
+
organization: external_exports.string().min(1).optional(),
|
|
17092
|
+
// What the administrator pinned.
|
|
17093
|
+
values: ManagedSettingsValues.default({}),
|
|
17094
|
+
// Which of those the user may not change. A key here with no matching value
|
|
17095
|
+
// freezes whatever the user last chose; a value with no lock is a DEFAULT
|
|
17096
|
+
// the user may still override. The two are separable on purpose.
|
|
17097
|
+
lockedFields: external_exports.array(ManagedSettingKey).default([])
|
|
17098
|
+
}).meta({ id: "ManagedSettings" });
|
|
17099
|
+
|
|
17100
|
+
// ../../packages/schema/src/zod/policy.ts
|
|
17101
|
+
var PolicyScope = external_exports.enum(["global", "repo", "user"]).meta({ id: "PolicyScope" });
|
|
17102
|
+
var PolicyTarget = external_exports.union([external_exports.object({ ruleId: external_exports.string() }), external_exports.object({ category: DetectionCategory })]).meta({ id: "PolicyTarget" });
|
|
17103
|
+
var Policy = external_exports.object({
|
|
17104
|
+
id: external_exports.guid(),
|
|
17105
|
+
scope: PolicyScope,
|
|
17106
|
+
target: PolicyTarget,
|
|
17107
|
+
action: ActionTaken,
|
|
17108
|
+
enabled: external_exports.boolean().default(true),
|
|
17109
|
+
customKeywords: external_exports.array(external_exports.string()).optional(),
|
|
17110
|
+
// Display name — optional so older policy rows without name still parse.
|
|
17111
|
+
// Added for the findings API (policy.name column migration).
|
|
17112
|
+
name: external_exports.string().optional()
|
|
17113
|
+
}).meta({ id: "Policy" });
|
|
17114
|
+
var PolicyBundle = external_exports.object({
|
|
17115
|
+
version: external_exports.string(),
|
|
17116
|
+
policies: external_exports.array(Policy),
|
|
17117
|
+
// Rules from the installed marketplace packs (snapshotted by the
|
|
17118
|
+
// control plane). The plugin registers these in addition to its bundled
|
|
17119
|
+
// packs. Optional so older backends — and older on-disk caches — that omit
|
|
17120
|
+
// the field still parse; consumers read `bundle.rules ?? []`.
|
|
17121
|
+
rules: external_exports.array(Rule).optional(),
|
|
17122
|
+
// When true, `rules` IS the complete effective ruleset and the runtime must
|
|
17123
|
+
// NOT merge its compiled-in bundled packs — the standalone gateway sets this
|
|
17124
|
+
// after reading the user's installed snapshot (installed_packs, enabled
|
|
17125
|
+
// packs only), which is how detection updates stay manual: new bundled
|
|
17126
|
+
// rules run only after the user applies the pack update. Absent/false keeps
|
|
17127
|
+
// the historical composition (bundled packs + rules) — older caches.
|
|
17128
|
+
rulesComplete: external_exports.boolean().optional(),
|
|
17129
|
+
// Active detection exceptions, evaluation subset only (see
|
|
17130
|
+
// ExceptionBundleEntry). Optional so older bundle producers — and older
|
|
17131
|
+
// on-disk caches — that omit the field still parse; consumers read
|
|
17132
|
+
// `bundle.exceptions ?? []`.
|
|
17133
|
+
exceptions: external_exports.array(ExceptionBundleEntry).optional(),
|
|
17134
|
+
// Rule ids whose pack is assigned a REVERSIBLE archetype (Redact & Vault).
|
|
17135
|
+
// A second axis over the same `redact` action, carried beside the policies
|
|
17136
|
+
// rather than on them: nothing writes ruleId-targeted policies to disk, so
|
|
17137
|
+
// widening Policy itself would change a persisted shape to express something
|
|
17138
|
+
// only the in-memory bundle needs. Optional so an older producer — or an
|
|
17139
|
+
// older on-disk cache — still parses; consumers read `?? []` and get the
|
|
17140
|
+
// pre-existing one-way behaviour, which is the safe direction to default.
|
|
17141
|
+
reversibleRuleIds: external_exports.array(external_exports.string()).optional(),
|
|
17142
|
+
// Installed pack version, keyed by ruleId, for rules in `rules` that came
|
|
17143
|
+
// from a versioned installed pack. Optional so older backends — and older
|
|
17144
|
+
// on-disk caches — that omit the field still parse; consumers fall back to
|
|
17145
|
+
// the rule's own spec version. NOT the bundle version above — see
|
|
17146
|
+
// installedRuleset's ruleVersions for the source of truth.
|
|
17147
|
+
ruleVersions: external_exports.record(external_exports.string(), external_exports.string()).optional(),
|
|
17148
|
+
customKeywords: external_exports.array(external_exports.string()),
|
|
17149
|
+
fetchedAt: external_exports.iso.datetime()
|
|
17150
|
+
}).meta({ id: "PolicyBundle" });
|
|
17151
|
+
var OBSERVE_ONLY_CATEGORIES = ["config"];
|
|
17152
|
+
var ENFORCEABLE_CATEGORIES = DetectionCategory.options.filter((c) => !OBSERVE_ONLY_CATEGORIES.includes(c));
|
|
17153
|
+
var CATEGORY_PEAK_SEVERITY = {
|
|
17154
|
+
secret: "critical",
|
|
17155
|
+
financial: "critical",
|
|
17156
|
+
// core-financial/credit-card
|
|
17157
|
+
code_flaw: "critical",
|
|
17158
|
+
pii: "high",
|
|
17159
|
+
phi: "high",
|
|
17160
|
+
custom: "high",
|
|
17161
|
+
// user-defined; conservative
|
|
17162
|
+
code_context: "low",
|
|
17163
|
+
config: "low"
|
|
17164
|
+
// observe-only; floors to monitor regardless
|
|
17165
|
+
};
|
|
17166
|
+
function severityFloorPolicy(category) {
|
|
17167
|
+
if (OBSERVE_ONLY_CATEGORIES.includes(category)) return "monitor";
|
|
17168
|
+
const peak = CATEGORY_PEAK_SEVERITY[category];
|
|
17169
|
+
return peak === "critical" || peak === "high" ? "warn" : "monitor";
|
|
17170
|
+
}
|
|
17171
|
+
var PolicyKind = external_exports.enum(["builtin", "custom"]).meta({ id: "PolicyKind" });
|
|
17172
|
+
var KNOWN_BUILTIN_IDS = ["monitor", "warn", "redact", "vault", "block"];
|
|
17173
|
+
var BuiltinPolicyId = external_exports.enum(KNOWN_BUILTIN_IDS).meta({ id: "BuiltinPolicyId" });
|
|
17174
|
+
var BUILTIN_POLICY_SPECS = {
|
|
17175
|
+
monitor: {
|
|
17176
|
+
name: "Monitor",
|
|
17177
|
+
action: "log",
|
|
17178
|
+
reversible: false,
|
|
17179
|
+
description: "Log every match for audit. The request is allowed through untouched."
|
|
17180
|
+
},
|
|
17181
|
+
warn: {
|
|
17182
|
+
name: "Warn",
|
|
17183
|
+
action: "warn",
|
|
17184
|
+
reversible: false,
|
|
17185
|
+
description: "Allow the request, but warn the user inline before it is sent."
|
|
17186
|
+
},
|
|
17187
|
+
redact: {
|
|
17188
|
+
name: "Redact",
|
|
17189
|
+
action: "redact",
|
|
17190
|
+
reversible: false,
|
|
17191
|
+
description: "Strip the matched value from the request and destroy it, then continue. What was removed cannot be recovered."
|
|
17192
|
+
},
|
|
17193
|
+
vault: {
|
|
17194
|
+
name: "Redact & Vault",
|
|
17195
|
+
action: "redact",
|
|
17196
|
+
reversible: true,
|
|
17197
|
+
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."
|
|
17198
|
+
},
|
|
17199
|
+
block: {
|
|
17200
|
+
name: "Block",
|
|
17201
|
+
action: "block",
|
|
17202
|
+
reversible: false,
|
|
17203
|
+
description: "Refuse the request entirely whenever any rule in this detection matches."
|
|
17204
|
+
}
|
|
17205
|
+
};
|
|
17206
|
+
function builtinPolicyToAction(id) {
|
|
17207
|
+
return BUILTIN_POLICY_SPECS[id].action;
|
|
17208
|
+
}
|
|
17209
|
+
var CATEGORY_EXPRESSIBLE_IDS = KNOWN_BUILTIN_IDS.filter(
|
|
17210
|
+
(id) => !BUILTIN_POLICY_SPECS[id].reversible
|
|
17211
|
+
);
|
|
17212
|
+
var CATEGORY_INEXPRESSIBLE_IDS = KNOWN_BUILTIN_IDS.filter(
|
|
17213
|
+
(id) => BUILTIN_POLICY_SPECS[id].reversible
|
|
17214
|
+
);
|
|
17215
|
+
var CategoryPolicyId = external_exports.enum(CATEGORY_EXPRESSIBLE_IDS).meta({ id: "CategoryPolicyId" });
|
|
17216
|
+
var DEFAULT_ACTIONS = Object.fromEntries(
|
|
17217
|
+
DetectionCategory.options.map((c) => [c, builtinPolicyToAction(severityFloorPolicy(c))])
|
|
17218
|
+
);
|
|
17219
|
+
var BUILTIN_POLICIES = Object.fromEntries(
|
|
17220
|
+
KNOWN_BUILTIN_IDS.map((id) => [id, { id, ...BUILTIN_POLICY_SPECS[id] }])
|
|
17221
|
+
);
|
|
17222
|
+
var UsedByItem = external_exports.object({
|
|
17223
|
+
id: external_exports.string(),
|
|
17224
|
+
name: external_exports.string(),
|
|
17225
|
+
ruleCount: external_exports.number().int().nonnegative(),
|
|
17226
|
+
enabled: external_exports.boolean()
|
|
17227
|
+
}).meta({ id: "UsedByItem" });
|
|
17228
|
+
var PolicyListItem = external_exports.object({
|
|
17229
|
+
id: external_exports.string(),
|
|
17230
|
+
kind: PolicyKind,
|
|
17231
|
+
name: external_exports.string(),
|
|
17232
|
+
enabled: external_exports.boolean(),
|
|
17233
|
+
usedByCount: external_exports.number().int().nonnegative()
|
|
17234
|
+
}).meta({ id: "PolicyListItem" });
|
|
17235
|
+
var ListPoliciesResponse = external_exports.object({ items: external_exports.array(PolicyListItem) }).meta({ id: "ListPoliciesResponse" });
|
|
17236
|
+
var PolicyDetail = external_exports.object({
|
|
17237
|
+
specVersion: external_exports.literal(1),
|
|
17238
|
+
id: external_exports.string(),
|
|
17239
|
+
kind: PolicyKind,
|
|
17240
|
+
name: external_exports.string(),
|
|
17241
|
+
enabled: external_exports.boolean(),
|
|
17242
|
+
description: external_exports.string(),
|
|
17243
|
+
usedBy: external_exports.array(UsedByItem)
|
|
17244
|
+
}).meta({ id: "PolicyDetail" });
|
|
17245
|
+
var PolicyStatsResponse = external_exports.object({
|
|
17246
|
+
policies: external_exports.number().int().nonnegative(),
|
|
17247
|
+
builtin: external_exports.number().int().nonnegative(),
|
|
17248
|
+
custom: external_exports.number().int().nonnegative(),
|
|
17249
|
+
detectionsGoverned: external_exports.number().int().nonnegative()
|
|
17250
|
+
}).meta({ id: "PolicyStatsResponse" });
|
|
17251
|
+
|
|
17165
17252
|
// ../../packages/schema/src/zod/project-files.ts
|
|
17166
17253
|
var ProjectFileInput = external_exports.object({
|
|
17167
17254
|
path: external_exports.string().min(1),
|
|
@@ -17234,44 +17321,6 @@ var BatchedRemediation = external_exports.discriminatedUnion("kind", [
|
|
|
17234
17321
|
NoRemediationDecision
|
|
17235
17322
|
]);
|
|
17236
17323
|
|
|
17237
|
-
// ../../packages/schema/src/zod/rule-test.ts
|
|
17238
|
-
var TestRulesRequest = external_exports.object({
|
|
17239
|
-
rules: external_exports.array(Rule).min(1).max(100),
|
|
17240
|
-
text: external_exports.string().max(5e4).optional(),
|
|
17241
|
-
fixtures: external_exports.array(RuleFixture).max(200).optional()
|
|
17242
|
-
}).refine((v) => v.text !== void 0 || (v.fixtures?.length ?? 0) > 0, {
|
|
17243
|
-
message: "Provide `text`, `fixtures`, or both \u2014 there must be something to test"
|
|
17244
|
-
}).meta({ id: "TestRulesRequest" });
|
|
17245
|
-
var RuleTestMatch = external_exports.object({
|
|
17246
|
-
ruleId: external_exports.string(),
|
|
17247
|
-
category: DetectionCategory,
|
|
17248
|
-
severity: Severity,
|
|
17249
|
-
span: Span,
|
|
17250
|
-
confidence: external_exports.number().min(0).max(1),
|
|
17251
|
-
match: external_exports.string()
|
|
17252
|
-
}).meta({ id: "RuleTestMatch" });
|
|
17253
|
-
var FixtureResult = external_exports.object({
|
|
17254
|
-
label: external_exports.string(),
|
|
17255
|
-
shouldMatch: external_exports.boolean(),
|
|
17256
|
-
didMatch: external_exports.boolean(),
|
|
17257
|
-
passed: external_exports.boolean(),
|
|
17258
|
-
matches: external_exports.array(RuleTestMatch)
|
|
17259
|
-
}).meta({ id: "FixtureResult" });
|
|
17260
|
-
var TestRulesResponse = external_exports.object({
|
|
17261
|
-
// Present only when the request supplied `text`.
|
|
17262
|
-
adhoc: external_exports.object({ matches: external_exports.array(RuleTestMatch) }).optional(),
|
|
17263
|
-
fixtures: external_exports.array(FixtureResult),
|
|
17264
|
-
summary: external_exports.object({
|
|
17265
|
-
total: external_exports.number().int().nonnegative(),
|
|
17266
|
-
passed: external_exports.number().int().nonnegative(),
|
|
17267
|
-
failed: external_exports.number().int().nonnegative()
|
|
17268
|
-
}),
|
|
17269
|
-
// Ids of rules whose matcher type the engine cannot evaluate today (e.g.
|
|
17270
|
-
// `validator`), so they silently never match. Surfaced so an author is not
|
|
17271
|
-
// misled by a green run that actually skipped a rule.
|
|
17272
|
-
unsupportedRuleIds: external_exports.array(external_exports.string())
|
|
17273
|
-
}).meta({ id: "TestRulesResponse" });
|
|
17274
|
-
|
|
17275
17324
|
// ../../packages/schema/src/zod/security.ts
|
|
17276
17325
|
var SeveritySummaryItem = external_exports.object({
|
|
17277
17326
|
severity: Severity,
|
|
@@ -17369,10 +17418,22 @@ var TopSourcesQuery = external_exports.object({
|
|
|
17369
17418
|
// Omit for both kinds.
|
|
17370
17419
|
kind: external_exports.enum(SOURCE_KINDS).optional()
|
|
17371
17420
|
});
|
|
17372
|
-
var Provider =
|
|
17421
|
+
var Provider = Harness.extract([
|
|
17422
|
+
"ClaudeCode",
|
|
17423
|
+
"Cursor",
|
|
17424
|
+
"Codex",
|
|
17425
|
+
"Antigravity",
|
|
17426
|
+
"ClaudeAi",
|
|
17427
|
+
"ChatGpt",
|
|
17428
|
+
"Copilot",
|
|
17429
|
+
"Api"
|
|
17430
|
+
]).meta({ id: "Provider" });
|
|
17373
17431
|
var ScanCoverageProvider = external_exports.object({
|
|
17374
17432
|
provider: Provider,
|
|
17375
|
-
// Percent of that provider's traffic
|
|
17433
|
+
// Percent of that provider's traffic the shipped capture surface reaches.
|
|
17434
|
+
// A curated business fact, constant across every `range` — not a measured
|
|
17435
|
+
// per-window metric. 0 exactly when `supported` is false. See the comment
|
|
17436
|
+
// above the block for where these numbers are decided.
|
|
17376
17437
|
coverage: external_exports.number().int().min(0).max(100),
|
|
17377
17438
|
supported: external_exports.boolean()
|
|
17378
17439
|
}).meta({ id: "ScanCoverageProvider" });
|
|
@@ -17426,6 +17487,18 @@ var ApplyRecommendedActionResponse = external_exports.object({
|
|
|
17426
17487
|
var DismissRecommendedActionResponse = external_exports.object({ id: external_exports.string(), status: external_exports.literal("dismissed") }).meta({ id: "DismissRecommendedActionResponse" });
|
|
17427
17488
|
var RecommendedActionIdParam = external_exports.object({ id: external_exports.string() });
|
|
17428
17489
|
|
|
17490
|
+
// ../../packages/schema/src/zod/settings-action.ts
|
|
17491
|
+
var SaveSettingsInput = external_exports.object({
|
|
17492
|
+
historicalAccess: external_exports.string(),
|
|
17493
|
+
modelJudgeConsent: external_exports.boolean(),
|
|
17494
|
+
vaultConsent: external_exports.string(),
|
|
17495
|
+
vaultInlineReveal: external_exports.string()
|
|
17496
|
+
});
|
|
17497
|
+
var AttachInput = external_exports.object({
|
|
17498
|
+
endpoint: external_exports.string(),
|
|
17499
|
+
label: external_exports.string().optional()
|
|
17500
|
+
});
|
|
17501
|
+
|
|
17429
17502
|
// ../../packages/schema/src/zod/triage.ts
|
|
17430
17503
|
var TriageHit = external_exports.object({
|
|
17431
17504
|
ruleId: external_exports.string(),
|
|
@@ -17440,7 +17513,7 @@ var TriageHit = external_exports.object({
|
|
|
17440
17513
|
valueFingerprint: external_exports.string().optional(),
|
|
17441
17514
|
keyVersion: external_exports.number().int().nonnegative().optional()
|
|
17442
17515
|
});
|
|
17443
|
-
var TriagePolicy =
|
|
17516
|
+
var TriagePolicy = CategoryPolicyId;
|
|
17444
17517
|
var TriageCategoryRec = external_exports.object({
|
|
17445
17518
|
category: DetectionCategory,
|
|
17446
17519
|
action: TriagePolicy,
|
|
@@ -17572,8 +17645,11 @@ function chmodBestEffort(path, mode) {
|
|
|
17572
17645
|
function tightenDir(dir) {
|
|
17573
17646
|
chmodBestEffort(dir, DATA_DIR_MODE);
|
|
17574
17647
|
}
|
|
17648
|
+
function mkdirOwnerOnlySync(dir, recursive = false) {
|
|
17649
|
+
mkdirSync(dir, { recursive, mode: DATA_DIR_MODE });
|
|
17650
|
+
}
|
|
17575
17651
|
function ensureDataDirSync(dir) {
|
|
17576
|
-
|
|
17652
|
+
mkdirOwnerOnlySync(dir, true);
|
|
17577
17653
|
tightenDir(dir);
|
|
17578
17654
|
}
|
|
17579
17655
|
function tightenFile(file2) {
|
|
@@ -17582,6 +17658,8 @@ function tightenFile(file2) {
|
|
|
17582
17658
|
|
|
17583
17659
|
// ../../packages/persistence/src/internal/snapshot.ts
|
|
17584
17660
|
var STALE_PARTIAL_MS = 5 * 6e4;
|
|
17661
|
+
var SNAPSHOT_STAGING_SUFFIX = ".partial";
|
|
17662
|
+
var STAGED_NAME_SUFFIX = `.bak${SNAPSHOT_STAGING_SUFFIX}`;
|
|
17585
17663
|
|
|
17586
17664
|
// ../../packages/persistence/src/internal/json.ts
|
|
17587
17665
|
function parseJsonObject(s) {
|
|
@@ -17596,6 +17674,7 @@ function parseJsonObject(s) {
|
|
|
17596
17674
|
|
|
17597
17675
|
// ../../packages/persistence/src/repositories/activity.ts
|
|
17598
17676
|
var LIVE_ACTIVITY_WINDOW_MS = 30 * 6e4;
|
|
17677
|
+
var DEFAULT_HARNESS = HARNESS.ClaudeCode;
|
|
17599
17678
|
|
|
17600
17679
|
// ../../packages/persistence/src/repositories/exceptions.ts
|
|
17601
17680
|
import { randomUUID as randomUUID2 } from "crypto";
|
|
@@ -17614,7 +17693,20 @@ import { createHash as createHash2, randomUUID as randomUUID3 } from "crypto";
|
|
|
17614
17693
|
// ../../packages/persistence/src/repositories/inventory-assets.ts
|
|
17615
17694
|
import { randomUUID as randomUUID4 } from "crypto";
|
|
17616
17695
|
var VALID_HARNESS_IDS = new Set(HarnessId.options);
|
|
17696
|
+
var HARNESS_LABELS = {
|
|
17697
|
+
[HARNESS.ClaudeCode]: "Claude Code",
|
|
17698
|
+
[HARNESS.Cursor]: "Cursor",
|
|
17699
|
+
[HARNESS.Codex]: "Codex",
|
|
17700
|
+
[HARNESS.Antigravity]: "Antigravity"
|
|
17701
|
+
};
|
|
17617
17702
|
var HARNESS_LIVENESS_WINDOW_MS = 30 * 24 * 60 * 60 * 1e3;
|
|
17703
|
+
var stripSeparators = (value) => value.toLowerCase().replace(/[\s-]/g, "");
|
|
17704
|
+
var TITLE_NEEDLES = {
|
|
17705
|
+
ClaudeCode: stripSeparators(SOURCE_TOOL.ClaudeCode),
|
|
17706
|
+
Cursor: stripSeparators(SOURCE_TOOL.Cursor),
|
|
17707
|
+
Codex: stripSeparators(SOURCE_TOOL.Codex),
|
|
17708
|
+
Antigravity: stripSeparators(SOURCE_TOOL.Antigravity)
|
|
17709
|
+
};
|
|
17618
17710
|
|
|
17619
17711
|
// ../../packages/persistence/src/repositories/policies.ts
|
|
17620
17712
|
import { randomUUID as randomUUID5 } from "crypto";
|
|
@@ -17628,6 +17720,18 @@ import { randomUUID as randomUUID7 } from "crypto";
|
|
|
17628
17720
|
// ../../packages/persistence/src/repositories/secret-vault.ts
|
|
17629
17721
|
import { randomUUID as randomUUID8 } from "crypto";
|
|
17630
17722
|
|
|
17723
|
+
// ../../packages/persistence/src/repositories/security.ts
|
|
17724
|
+
var SCAN_COVERAGE = {
|
|
17725
|
+
[HARNESS.Antigravity]: { coverage: 60, supported: true },
|
|
17726
|
+
[HARNESS.Api]: { coverage: 0, supported: false },
|
|
17727
|
+
[HARNESS.ChatGpt]: { coverage: 40, supported: true },
|
|
17728
|
+
[HARNESS.ClaudeAi]: { coverage: 40, supported: true },
|
|
17729
|
+
[HARNESS.ClaudeCode]: { coverage: 100, supported: true },
|
|
17730
|
+
[HARNESS.Codex]: { coverage: 80, supported: true },
|
|
17731
|
+
[HARNESS.Copilot]: { coverage: 0, supported: false },
|
|
17732
|
+
[HARNESS.Cursor]: { coverage: 0, supported: false }
|
|
17733
|
+
};
|
|
17734
|
+
|
|
17631
17735
|
// ../../packages/persistence/src/repositories/shares.ts
|
|
17632
17736
|
import { randomUUID as randomUUID9 } from "crypto";
|
|
17633
17737
|
|
|
@@ -17690,11 +17794,79 @@ function migrateLegacyLayout(base = defaultDataDir()) {
|
|
|
17690
17794
|
}
|
|
17691
17795
|
}
|
|
17692
17796
|
|
|
17693
|
-
// ../../packages/persistence/src/settings.ts
|
|
17797
|
+
// ../../packages/persistence/src/managed-settings.ts
|
|
17694
17798
|
import { readFileSync as readFileSync3 } from "fs";
|
|
17799
|
+
import { posix, win32 } from "path";
|
|
17800
|
+
function managedSettingsPaths(platform2 = process.platform) {
|
|
17801
|
+
if (platform2 === "darwin") {
|
|
17802
|
+
return [
|
|
17803
|
+
posix.join("/Library", "Application Support", "AKASecurity", MANAGED_SETTINGS_FILENAME),
|
|
17804
|
+
posix.join("/Library", "Managed Preferences", MANAGED_SETTINGS_FILENAME)
|
|
17805
|
+
];
|
|
17806
|
+
}
|
|
17807
|
+
if (platform2 === "win32") {
|
|
17808
|
+
return [win32.join("C:\\", "ProgramData", "AKASecurity", MANAGED_SETTINGS_FILENAME)];
|
|
17809
|
+
}
|
|
17810
|
+
return [posix.join("/etc", "aka", MANAGED_SETTINGS_FILENAME)];
|
|
17811
|
+
}
|
|
17812
|
+
function readManagedSettings(paths = managedSettingsPaths()) {
|
|
17813
|
+
for (const path of paths) {
|
|
17814
|
+
let text;
|
|
17815
|
+
try {
|
|
17816
|
+
text = readFileSync3(path, "utf8");
|
|
17817
|
+
} catch {
|
|
17818
|
+
continue;
|
|
17819
|
+
}
|
|
17820
|
+
const record2 = parseJsonObject(text);
|
|
17821
|
+
if (!record2) continue;
|
|
17822
|
+
const parsed = ManagedSettings.safeParse(record2);
|
|
17823
|
+
if (parsed.success) return parsed.data;
|
|
17824
|
+
}
|
|
17825
|
+
return null;
|
|
17826
|
+
}
|
|
17827
|
+
function overlayManagedSettings(settings, managed, now = () => /* @__PURE__ */ new Date()) {
|
|
17828
|
+
if (!managed) return settings;
|
|
17829
|
+
const { values } = managed;
|
|
17830
|
+
const merged = { ...settings };
|
|
17831
|
+
if (values.runMode !== void 0) merged.runMode = values.runMode;
|
|
17832
|
+
if (values.controlPlane !== void 0) {
|
|
17833
|
+
merged.controlPlane = {
|
|
17834
|
+
...values.controlPlane,
|
|
17835
|
+
// The administrator pinned WHICH deployment, not WHEN this machine
|
|
17836
|
+
// joined it. Keep the user's own attach time when the endpoint is
|
|
17837
|
+
// unchanged, so a managed machine does not appear to re-attach on every
|
|
17838
|
+
// read; stamp a fresh one when the administrator moved it.
|
|
17839
|
+
attachedAt: settings.controlPlane?.endpoint === values.controlPlane.endpoint ? settings.controlPlane.attachedAt : now().toISOString()
|
|
17840
|
+
};
|
|
17841
|
+
}
|
|
17842
|
+
if (values.historicalAccess !== void 0) merged.historicalAccess = values.historicalAccess;
|
|
17843
|
+
if (values.vaultKeyCustody !== void 0) merged.vaultKeyCustody = values.vaultKeyCustody;
|
|
17844
|
+
if (values.vaultInlineReveal !== void 0) merged.vaultInlineReveal = values.vaultInlineReveal;
|
|
17845
|
+
if (values.dataSharesInPlace !== void 0) merged.dataSharesInPlace = values.dataSharesInPlace;
|
|
17846
|
+
if (values.vaultConsent !== void 0) {
|
|
17847
|
+
merged.vaultConsent = values.vaultConsent ? (
|
|
17848
|
+
// Keep an existing valid grant so its acknowledgedAt survives; mint one
|
|
17849
|
+
// at the current version otherwise.
|
|
17850
|
+
settings.vaultConsent?.version === VAULT_CONSENT_VERSION ? settings.vaultConsent : { acknowledgedAt: now().toISOString(), version: VAULT_CONSENT_VERSION }
|
|
17851
|
+
) : void 0;
|
|
17852
|
+
}
|
|
17853
|
+
if (values.modelJudgeConsent !== void 0) {
|
|
17854
|
+
merged.modelJudgeConsent = values.modelJudgeConsent ? settings.modelJudgeConsent?.payloadVersion === MODEL_JUDGE_PAYLOAD_VERSION ? settings.modelJudgeConsent : {
|
|
17855
|
+
acknowledgedAt: now().toISOString(),
|
|
17856
|
+
payloadVersion: MODEL_JUDGE_PAYLOAD_VERSION
|
|
17857
|
+
} : void 0;
|
|
17858
|
+
}
|
|
17859
|
+
return merged;
|
|
17860
|
+
}
|
|
17861
|
+
|
|
17862
|
+
// ../../packages/persistence/src/settings.ts
|
|
17863
|
+
import { readFileSync as readFileSync4 } from "fs";
|
|
17695
17864
|
import { join as join5 } from "path";
|
|
17696
17865
|
var SETTINGS_FILENAME = "settings.json";
|
|
17697
17866
|
function readWorkspaceSettings(base = defaultDataDir()) {
|
|
17867
|
+
return overlayManagedSettings(readUserSettings(base), readManagedSettings());
|
|
17868
|
+
}
|
|
17869
|
+
function readUserSettings(base) {
|
|
17698
17870
|
const record2 = readJson(join5(settingsDir(base), SETTINGS_FILENAME));
|
|
17699
17871
|
if (!record2) return defaultWorkspaceSettings();
|
|
17700
17872
|
try {
|
|
@@ -17706,7 +17878,7 @@ function readWorkspaceSettings(base = defaultDataDir()) {
|
|
|
17706
17878
|
function readJson(file2) {
|
|
17707
17879
|
let text;
|
|
17708
17880
|
try {
|
|
17709
|
-
text =
|
|
17881
|
+
text = readFileSync4(file2, "utf8");
|
|
17710
17882
|
} catch {
|
|
17711
17883
|
return null;
|
|
17712
17884
|
}
|
|
@@ -17725,15 +17897,7 @@ import {
|
|
|
17725
17897
|
// ../../packages/persistence/src/vault/key-provider.ts
|
|
17726
17898
|
import { execFileSync } from "child_process";
|
|
17727
17899
|
import { randomBytes as randomBytes2 } from "crypto";
|
|
17728
|
-
import {
|
|
17729
|
-
chmodSync as chmodSync2,
|
|
17730
|
-
mkdirSync as mkdirSync2,
|
|
17731
|
-
readFileSync as readFileSync4,
|
|
17732
|
-
renameSync as renameSync4,
|
|
17733
|
-
rmSync as rmSync4,
|
|
17734
|
-
statSync as statSync3,
|
|
17735
|
-
writeFileSync as writeFileSync3
|
|
17736
|
-
} from "fs";
|
|
17900
|
+
import { chmodSync as chmodSync2, readFileSync as readFileSync5, renameSync as renameSync4, rmSync as rmSync4, statSync as statSync3, writeFileSync as writeFileSync3 } from "fs";
|
|
17737
17901
|
import { join as join6 } from "path";
|
|
17738
17902
|
|
|
17739
17903
|
// ../../packages/persistence/src/vault/vault.ts
|
|
@@ -17819,7 +17983,7 @@ function resolveProviderSafe(resolveProviderFn) {
|
|
|
17819
17983
|
}
|
|
17820
17984
|
|
|
17821
17985
|
// ../../packages/plugin-sdk/src/config-inventory.ts
|
|
17822
|
-
import { readdirSync as readdirSync2, readFileSync as
|
|
17986
|
+
import { readdirSync as readdirSync2, readFileSync as readFileSync7, realpathSync, statSync as statSync5 } from "fs";
|
|
17823
17987
|
import { homedir as homedir2 } from "os";
|
|
17824
17988
|
import { basename as basename3, join as join10 } from "path";
|
|
17825
17989
|
|
|
@@ -18395,6 +18559,40 @@ function escapeRegExp2(value) {
|
|
|
18395
18559
|
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
18396
18560
|
}
|
|
18397
18561
|
|
|
18562
|
+
// ../../packages/detections/src/regex-cache.ts
|
|
18563
|
+
var singles = /* @__PURE__ */ new WeakMap();
|
|
18564
|
+
var keywordLists = /* @__PURE__ */ new WeakMap();
|
|
18565
|
+
var labelLists = /* @__PURE__ */ new WeakMap();
|
|
18566
|
+
function listCache(kind) {
|
|
18567
|
+
return kind === "keyword" ? keywordLists : labelLists;
|
|
18568
|
+
}
|
|
18569
|
+
function memoizedRegExp(owner, build) {
|
|
18570
|
+
const cached2 = singles.get(owner);
|
|
18571
|
+
if (cached2 !== void 0) {
|
|
18572
|
+
cached2.lastIndex = 0;
|
|
18573
|
+
return cached2;
|
|
18574
|
+
}
|
|
18575
|
+
const compiled = build();
|
|
18576
|
+
singles.set(owner, compiled);
|
|
18577
|
+
return compiled;
|
|
18578
|
+
}
|
|
18579
|
+
function memoizedRegExpList(kind, owner, build) {
|
|
18580
|
+
const cache = listCache(kind);
|
|
18581
|
+
const cached2 = cache.get(owner);
|
|
18582
|
+
if (cached2 !== void 0) {
|
|
18583
|
+
if (cached2.stateful) {
|
|
18584
|
+
for (const re of cached2.entries) if (re !== void 0) re.lastIndex = 0;
|
|
18585
|
+
}
|
|
18586
|
+
return cached2.entries;
|
|
18587
|
+
}
|
|
18588
|
+
const entries = build();
|
|
18589
|
+
cache.set(owner, {
|
|
18590
|
+
entries,
|
|
18591
|
+
stateful: entries.some((re) => re !== void 0 && (re.global || re.sticky))
|
|
18592
|
+
});
|
|
18593
|
+
return entries;
|
|
18594
|
+
}
|
|
18595
|
+
|
|
18398
18596
|
// ../../packages/detections/src/matchers/limits.ts
|
|
18399
18597
|
var MAX_MATCHES_PER_RULE = 1e4;
|
|
18400
18598
|
var MAX_REGEX_INPUT_LENGTH = 2e5;
|
|
@@ -18405,10 +18603,17 @@ var KeywordMatcher2 = class {
|
|
|
18405
18603
|
if (rule.matcher.type !== "keyword") return [];
|
|
18406
18604
|
const { keywords, caseSensitive } = rule.matcher;
|
|
18407
18605
|
const spans = [];
|
|
18408
|
-
|
|
18409
|
-
|
|
18606
|
+
const compiled = memoizedRegExpList(
|
|
18607
|
+
"keyword",
|
|
18608
|
+
rule.matcher,
|
|
18609
|
+
() => keywords.map((kw) => {
|
|
18610
|
+
if (kw.length === 0) return void 0;
|
|
18611
|
+
return new RegExp(escapeRegExp2(kw), caseSensitive ? "gu" : "giu");
|
|
18612
|
+
})
|
|
18613
|
+
);
|
|
18614
|
+
for (const re of compiled) {
|
|
18615
|
+
if (re === void 0) continue;
|
|
18410
18616
|
if (spans.length >= MAX_MATCHES_PER_RULE) break;
|
|
18411
|
-
const re = new RegExp(escapeRegExp2(kw), caseSensitive ? "gu" : "giu");
|
|
18412
18617
|
let m;
|
|
18413
18618
|
while ((m = re.exec(text)) !== null) {
|
|
18414
18619
|
spans.push({ start: m.index, end: m.index + m[0].length });
|
|
@@ -18424,7 +18629,10 @@ var RegexMatcher2 = class {
|
|
|
18424
18629
|
match(text, rule) {
|
|
18425
18630
|
if (rule.matcher.type !== "regex") return [];
|
|
18426
18631
|
const { pattern, flags, captureGroup } = rule.matcher;
|
|
18427
|
-
const re =
|
|
18632
|
+
const re = memoizedRegExp(
|
|
18633
|
+
rule.matcher,
|
|
18634
|
+
() => new RegExp(pattern, flags.includes("d") ? flags : `${flags}d`)
|
|
18635
|
+
);
|
|
18428
18636
|
const scanText2 = text.length > MAX_REGEX_INPUT_LENGTH ? text.slice(0, MAX_REGEX_INPUT_LENGTH) : text;
|
|
18429
18637
|
const spans = [];
|
|
18430
18638
|
let m;
|
|
@@ -18507,6 +18715,7 @@ var CONFIG_POSTURE_RULES = [
|
|
|
18507
18715
|
];
|
|
18508
18716
|
|
|
18509
18717
|
// ../../packages/detections/src/security/redos-probe.ts
|
|
18718
|
+
var BUDGET_MS = 100;
|
|
18510
18719
|
var EXPONENTIAL_UNITS = [
|
|
18511
18720
|
"a",
|
|
18512
18721
|
"0",
|
|
@@ -18530,9 +18739,11 @@ var EXPONENTIAL_PROBES = EXPONENTIAL_UNITS.flatMap(
|
|
|
18530
18739
|
var POLYNOMIAL_PROBES = ["abc-", "a.", "a ", "a=", "x", "0", "a@", "a/", "ab"].map(
|
|
18531
18740
|
(unit) => unit.repeat(1e4).slice(0, 4e4) + "!"
|
|
18532
18741
|
);
|
|
18742
|
+
var CPU_CORROBORATION_SHARE = 0.2;
|
|
18743
|
+
var CORROBORATION_FLOOR_MS = BUDGET_MS * CPU_CORROBORATION_SHARE;
|
|
18533
18744
|
|
|
18534
18745
|
// ../../packages/plugin-sdk/src/repo.ts
|
|
18535
|
-
import { existsSync as existsSync6, readFileSync as
|
|
18746
|
+
import { existsSync as existsSync6, readFileSync as readFileSync6, statSync as statSync4 } from "fs";
|
|
18536
18747
|
import { basename as basename2, dirname as dirname2, isAbsolute, join as join9, sep as sep2 } from "path";
|
|
18537
18748
|
|
|
18538
18749
|
// ../../packages/plugin-sdk/src/events.ts
|
|
@@ -18543,21 +18754,25 @@ import { existsSync as existsSync7 } from "fs";
|
|
|
18543
18754
|
import { fileURLToPath } from "url";
|
|
18544
18755
|
import { Worker } from "worker_threads";
|
|
18545
18756
|
|
|
18757
|
+
// ../../packages/plugin-sdk/src/ignore-layers.ts
|
|
18758
|
+
var import_ignore = __toESM(require_ignore(), 1);
|
|
18759
|
+
import { readFileSync as readFileSync8 } from "fs";
|
|
18760
|
+
import { join as join11 } from "path";
|
|
18761
|
+
|
|
18546
18762
|
// ../../packages/plugin-sdk/src/inventory-resolver.ts
|
|
18547
18763
|
import { arch, hostname as hostname4, platform, release } from "os";
|
|
18548
18764
|
|
|
18549
18765
|
// ../../packages/plugin-sdk/src/nudge.ts
|
|
18550
|
-
import { mkdirSync as
|
|
18551
|
-
import { join as
|
|
18766
|
+
import { mkdirSync as mkdirSync2, readFileSync as readFileSync9, writeFileSync as writeFileSync5 } from "fs";
|
|
18767
|
+
import { join as join12 } from "path";
|
|
18552
18768
|
|
|
18553
18769
|
// ../../packages/plugin-sdk/src/paths.ts
|
|
18554
18770
|
import { readdirSync as readdirSync3, realpathSync as realpathSync2 } from "fs";
|
|
18555
18771
|
import { basename as basename4, dirname as dirname3, sep as sep3 } from "path";
|
|
18556
18772
|
|
|
18557
18773
|
// ../../packages/plugin-sdk/src/project-files.ts
|
|
18558
|
-
|
|
18559
|
-
import {
|
|
18560
|
-
import { basename as basename5, join as join12, relative, sep as sep4 } from "path";
|
|
18774
|
+
import { existsSync as existsSync8, readdirSync as readdirSync4 } from "fs";
|
|
18775
|
+
import { basename as basename5, join as join13 } from "path";
|
|
18561
18776
|
|
|
18562
18777
|
// ../../packages/plugin-sdk/src/provider-env-antigravity.ts
|
|
18563
18778
|
var optionalBaseUrl2 = external_exports.preprocess((v) => {
|
|
@@ -18592,16 +18807,16 @@ import { randomUUID as randomUUID14 } from "crypto";
|
|
|
18592
18807
|
var THIRTY_DAYS_MS = 30 * 24 * 60 * 60 * 1e3;
|
|
18593
18808
|
|
|
18594
18809
|
// ../../packages/plugin-sdk/src/throttle.ts
|
|
18595
|
-
import { mkdirSync as
|
|
18596
|
-
import { join as
|
|
18810
|
+
import { mkdirSync as mkdirSync3, statSync as statSync6, writeFileSync as writeFileSync6 } from "fs";
|
|
18811
|
+
import { join as join14 } from "path";
|
|
18597
18812
|
function throttled(dataDir2, markerName, windowMs) {
|
|
18598
|
-
const marker =
|
|
18813
|
+
const marker = join14(dataDir2, markerName);
|
|
18599
18814
|
try {
|
|
18600
18815
|
if (Date.now() - statSync6(marker).mtimeMs < windowMs) return true;
|
|
18601
18816
|
} catch {
|
|
18602
18817
|
}
|
|
18603
18818
|
try {
|
|
18604
|
-
|
|
18819
|
+
mkdirSync3(dataDir2, { recursive: true, mode: DATA_DIR_MODE });
|
|
18605
18820
|
writeFileSync6(marker, String(Date.now()), { mode: DATA_FILE_MODE });
|
|
18606
18821
|
} catch {
|
|
18607
18822
|
}
|
|
@@ -18610,7 +18825,7 @@ function throttled(dataDir2, markerName, windowMs) {
|
|
|
18610
18825
|
|
|
18611
18826
|
// src/history/reconcile-trigger.ts
|
|
18612
18827
|
import { spawn } from "child_process";
|
|
18613
|
-
import { dirname as dirname4, join as
|
|
18828
|
+
import { dirname as dirname4, join as join16 } from "path";
|
|
18614
18829
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
18615
18830
|
|
|
18616
18831
|
// src/history/tail.ts
|
|
@@ -18618,13 +18833,13 @@ import { createHash as createHash5 } from "crypto";
|
|
|
18618
18833
|
import {
|
|
18619
18834
|
closeSync as closeSync2,
|
|
18620
18835
|
fstatSync,
|
|
18621
|
-
mkdirSync as
|
|
18836
|
+
mkdirSync as mkdirSync4,
|
|
18622
18837
|
openSync as openSync2,
|
|
18623
|
-
readFileSync as
|
|
18838
|
+
readFileSync as readFileSync10,
|
|
18624
18839
|
readSync,
|
|
18625
18840
|
writeFileSync as writeFileSync7
|
|
18626
18841
|
} from "fs";
|
|
18627
|
-
import { join as
|
|
18842
|
+
import { join as join15 } from "path";
|
|
18628
18843
|
var SAFE_SESSION_ID = /^[A-Za-z0-9._-]+$/;
|
|
18629
18844
|
function safeSessionId(sessionId) {
|
|
18630
18845
|
if (SAFE_SESSION_ID.test(sessionId) && sessionId !== "." && sessionId !== "..") {
|
|
@@ -18641,7 +18856,7 @@ function triggerReconcile(dataDir2, sessionId, transcriptPath) {
|
|
|
18641
18856
|
const marker = `${RECONCILE_MARKER_PREFIX}-${safeSessionId(sessionId)}`;
|
|
18642
18857
|
if (throttled(dataDir2, marker, RECONCILE_THROTTLE_MS)) return;
|
|
18643
18858
|
const here = dirname4(fileURLToPath2(import.meta.url));
|
|
18644
|
-
const child = spawn(process.execPath, [
|
|
18859
|
+
const child = spawn(process.execPath, [join16(here, "reconcile.js"), sessionId, transcriptPath], {
|
|
18645
18860
|
detached: true,
|
|
18646
18861
|
stdio: "ignore"
|
|
18647
18862
|
});
|