@akasecurity/ai-tc-claude-code 0.9.4 → 0.9.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/plugin.json +1 -1
- package/README.md +4 -0
- package/package.json +4 -3
- package/scripts/apply-suppressions.js +1607 -534
- package/scripts/backfill.js +1969 -390
- package/scripts/filescan.js +1863 -346
- package/scripts/firstrun.js +1307 -223
- package/scripts/intro.js +370 -54
- package/scripts/message-display.js +1406 -297
- package/scripts/onboard.js +1532 -245
- package/scripts/post-tool-use.js +1885 -356
- package/scripts/pre-tool-use.js +1900 -365
- package/scripts/query.js +1306 -222
- package/scripts/reconcile.js +1435 -326
- package/scripts/remediate.js +2121 -546
- package/scripts/scan-worker.js +18006 -0
- package/scripts/session-start.js +1350 -312
- package/scripts/start-light.js +390 -74
- package/scripts/statusline.js +1306 -222
- package/scripts/stop.js +352 -79
- package/scripts/user-prompt-submit.js +1897 -368
package/scripts/stop.js
CHANGED
|
@@ -492,13 +492,12 @@ var require_ignore = __commonJS({
|
|
|
492
492
|
});
|
|
493
493
|
|
|
494
494
|
// ../../packages/plugin-sdk/src/config.ts
|
|
495
|
-
import { existsSync as
|
|
496
|
-
import { join as
|
|
495
|
+
import { existsSync as existsSync5 } from "fs";
|
|
496
|
+
import { join as join8 } from "path";
|
|
497
497
|
|
|
498
498
|
// ../../packages/persistence/src/database.ts
|
|
499
|
-
import { randomUUID as
|
|
500
|
-
import {
|
|
501
|
-
import { join, sep } from "path";
|
|
499
|
+
import { randomUUID as randomUUID10 } from "crypto";
|
|
500
|
+
import { join as join2, sep } from "path";
|
|
502
501
|
import { DatabaseSync } from "node:sqlite";
|
|
503
502
|
|
|
504
503
|
// ../../packages/schema/src/exception-scope.ts
|
|
@@ -15093,7 +15092,17 @@ var Finding = external_exports.object({
|
|
|
15093
15092
|
}).meta({ id: "Finding" });
|
|
15094
15093
|
var DetectedFinding = Finding.meta({ id: "DetectedFinding" });
|
|
15095
15094
|
var FindingAction = external_exports.enum(["blocked", "redacted", "warned", "allowed", "quarantined", "monitored"]).meta({ id: "FindingAction" });
|
|
15096
|
-
var FindingProvider = external_exports.enum([
|
|
15095
|
+
var FindingProvider = external_exports.enum([
|
|
15096
|
+
"claudecode",
|
|
15097
|
+
"claudedesktop",
|
|
15098
|
+
"cursor",
|
|
15099
|
+
"copilot",
|
|
15100
|
+
"chatgpt",
|
|
15101
|
+
"claudeai",
|
|
15102
|
+
"codex",
|
|
15103
|
+
"antigravity",
|
|
15104
|
+
"api"
|
|
15105
|
+
]).meta({ id: "FindingProvider" });
|
|
15097
15106
|
var FindingCategory = external_exports.enum([
|
|
15098
15107
|
"secret",
|
|
15099
15108
|
"pii",
|
|
@@ -15147,7 +15156,16 @@ var FindingInstance = external_exports.object({
|
|
|
15147
15156
|
confidence: external_exports.number().min(0).max(1),
|
|
15148
15157
|
// Lifecycle status (see FindingStatus). Optional so legacy callers/rows
|
|
15149
15158
|
// that predate the resolution feature stay valid.
|
|
15150
|
-
status: FindingStatus.optional()
|
|
15159
|
+
status: FindingStatus.optional(),
|
|
15160
|
+
// The audit event this finding was captured from. Optional so callers that
|
|
15161
|
+
// do not project it stay valid. An at-rest finding is content-addressed by
|
|
15162
|
+
// finding_key and its row is upserted on re-detection, so this names the
|
|
15163
|
+
// MOST RECENT detection event, not the first.
|
|
15164
|
+
eventId: external_exports.string().optional(),
|
|
15165
|
+
// The session that event belongs to, when it has one — the seam a
|
|
15166
|
+
// per-instance "view session" link needs. Absent for events captured
|
|
15167
|
+
// outside a session.
|
|
15168
|
+
sessionId: external_exports.string().optional()
|
|
15151
15169
|
}).meta({ id: "FindingInstance" });
|
|
15152
15170
|
var FindingGroup = external_exports.object({
|
|
15153
15171
|
id: external_exports.string(),
|
|
@@ -15191,7 +15209,11 @@ var FindingFacets = external_exports.object({
|
|
|
15191
15209
|
// for every instance, so every group lands in a bucket; a status-less
|
|
15192
15210
|
// group (possible only for callers whose rows carry no statuses) is
|
|
15193
15211
|
// counted under no value.
|
|
15194
|
-
status: external_exports.array(FindingFacetItem)
|
|
15212
|
+
status: external_exports.array(FindingFacetItem),
|
|
15213
|
+
// Host tool (attributes.tool_name). Present only on the instance-level
|
|
15214
|
+
// reads, which can filter by it; the grouped read omits the dimension
|
|
15215
|
+
// because a group spans tools.
|
|
15216
|
+
tool: external_exports.array(FindingFacetItem).optional()
|
|
15195
15217
|
}).meta({ id: "FindingFacets" });
|
|
15196
15218
|
var ListGroupedFindingsQuery = external_exports.object({
|
|
15197
15219
|
// NOTE: severity filters by Severity (critical/high/medium/low), not by
|
|
@@ -15208,6 +15230,16 @@ var ListGroupedFindingsQuery = external_exports.object({
|
|
|
15208
15230
|
// Scope to findings whose event carries this session id (the Activity page's
|
|
15209
15231
|
// session → findings drilldown). Findings without a session never match.
|
|
15210
15232
|
sessionId: external_exports.string().optional(),
|
|
15233
|
+
// Inclusive lower bound on the parent event's timestamp, so a caller arriving
|
|
15234
|
+
// from a time-scoped page (Activity's range) can carry that scope. Absent
|
|
15235
|
+
// means all time — this list has no default window.
|
|
15236
|
+
from: external_exports.iso.datetime().optional(),
|
|
15237
|
+
// A group or instance id that must appear in the page even when the cursor
|
|
15238
|
+
// has already advanced past its sort position. This is what keeps the
|
|
15239
|
+
// Findings page's one-shot ?finding= deep link resolving once the list
|
|
15240
|
+
// paginates: the target group is appended out of sort order rather than
|
|
15241
|
+
// scanning forward for it. Never affects totals, facets or the cursor.
|
|
15242
|
+
includeId: external_exports.string().optional(),
|
|
15211
15243
|
groupBy: external_exports.literal("type").optional(),
|
|
15212
15244
|
limit: external_exports.coerce.number().int().min(1).max(100).optional(),
|
|
15213
15245
|
cursor: external_exports.string().optional()
|
|
@@ -15252,9 +15284,100 @@ var FindingInstanceDetail = FindingInstance.extend({
|
|
|
15252
15284
|
detection: FindingDetectionRef,
|
|
15253
15285
|
policy: FindingPolicyRef
|
|
15254
15286
|
}).meta({ id: "FindingInstanceDetail" });
|
|
15287
|
+
var ListFindingInstancesQuery = external_exports.object({
|
|
15288
|
+
severity: external_exports.array(Severity).optional(),
|
|
15289
|
+
// Rule ids, the same vocabulary the grouped list's `subtype` carries.
|
|
15290
|
+
subtype: external_exports.array(external_exports.string()).optional(),
|
|
15291
|
+
provider: external_exports.array(FindingProvider).optional(),
|
|
15292
|
+
action: external_exports.array(FindingAction).optional(),
|
|
15293
|
+
// Matches each instance's OWN derived status (deriveFindingStatus), unlike
|
|
15294
|
+
// the grouped query's group-level fold.
|
|
15295
|
+
status: external_exports.array(FindingStatus).optional(),
|
|
15296
|
+
// Exact host-tool names (attributes.tool_name, e.g. 'Bash'). A real filter,
|
|
15297
|
+
// where the free-text `q` can only match the rendered "via Bash" label.
|
|
15298
|
+
tool: external_exports.array(external_exports.string()).optional(),
|
|
15299
|
+
// Exact repository / file-path matches, for the drill-down out of the
|
|
15300
|
+
// locations view. A row whose event carries no repo/file matches neither.
|
|
15301
|
+
repo: external_exports.string().optional(),
|
|
15302
|
+
file: external_exports.string().optional(),
|
|
15303
|
+
q: external_exports.string().optional(),
|
|
15304
|
+
sessionId: external_exports.string().optional(),
|
|
15305
|
+
from: external_exports.iso.datetime().optional(),
|
|
15306
|
+
limit: external_exports.coerce.number().int().min(1).max(200).optional(),
|
|
15307
|
+
cursor: external_exports.string().optional()
|
|
15308
|
+
});
|
|
15309
|
+
var ListFindingInstancesResponse = external_exports.object({
|
|
15310
|
+
// Instances matching the filters across the whole scope, not just this
|
|
15311
|
+
// page — cursor-independent, like the grouped list's totals.
|
|
15312
|
+
totals: external_exports.object({ findings: external_exports.number().int().nonnegative() }),
|
|
15313
|
+
// Counts in INSTANCES here, where the grouped response counts groups. Each
|
|
15314
|
+
// dimension still excludes its own filter.
|
|
15315
|
+
facets: FindingFacets,
|
|
15316
|
+
items: external_exports.array(FindingInstanceDetail),
|
|
15317
|
+
nextCursor: external_exports.string().nullable()
|
|
15318
|
+
}).meta({ id: "ListFindingInstancesResponse" });
|
|
15319
|
+
var FindingLocationFile = external_exports.object({
|
|
15320
|
+
// Empty when the instances carried no file path (a prompt or a tool call
|
|
15321
|
+
// with no file attribution).
|
|
15322
|
+
file: external_exports.string(),
|
|
15323
|
+
instanceCount: external_exports.number().int().nonnegative(),
|
|
15324
|
+
maxSeverity: Severity,
|
|
15325
|
+
latestDetectedAt: external_exports.iso.datetime(),
|
|
15326
|
+
// Folded from the instances' derived statuses with the same
|
|
15327
|
+
// open-dominates precedence a group uses.
|
|
15328
|
+
status: FindingStatus.optional(),
|
|
15329
|
+
// Distinct rules seen at this location, capped — the row shows them as
|
|
15330
|
+
// chips, and the count is what conveys scale.
|
|
15331
|
+
ruleIds: external_exports.array(external_exports.string())
|
|
15332
|
+
}).meta({ id: "FindingLocationFile" });
|
|
15333
|
+
var FindingLocationRepo = external_exports.object({
|
|
15334
|
+
/** Empty when the instances carried no repo attribute. */
|
|
15335
|
+
repo: external_exports.string(),
|
|
15336
|
+
instanceCount: external_exports.number().int().nonnegative(),
|
|
15337
|
+
maxSeverity: Severity,
|
|
15338
|
+
latestDetectedAt: external_exports.iso.datetime(),
|
|
15339
|
+
status: FindingStatus.optional(),
|
|
15340
|
+
files: external_exports.array(FindingLocationFile)
|
|
15341
|
+
}).meta({ id: "FindingLocationRepo" });
|
|
15342
|
+
var ListFindingLocationsQuery = external_exports.object({
|
|
15343
|
+
severity: external_exports.array(Severity).optional(),
|
|
15344
|
+
subtype: external_exports.array(external_exports.string()).optional(),
|
|
15345
|
+
provider: external_exports.array(FindingProvider).optional(),
|
|
15346
|
+
action: external_exports.array(FindingAction).optional(),
|
|
15347
|
+
// Per-instance, as in ListFindingInstancesQuery: a location keeps the
|
|
15348
|
+
// instances that match, and folds its status from those.
|
|
15349
|
+
status: external_exports.array(FindingStatus).optional(),
|
|
15350
|
+
tool: external_exports.array(external_exports.string()).optional(),
|
|
15351
|
+
q: external_exports.string().optional(),
|
|
15352
|
+
sessionId: external_exports.string().optional(),
|
|
15353
|
+
from: external_exports.iso.datetime().optional(),
|
|
15354
|
+
limit: external_exports.coerce.number().int().min(1).max(500).optional()
|
|
15355
|
+
});
|
|
15356
|
+
var ListFindingLocationsResponse = external_exports.object({
|
|
15357
|
+
totals: external_exports.object({
|
|
15358
|
+
findings: external_exports.number().int().nonnegative(),
|
|
15359
|
+
repos: external_exports.number().int().nonnegative(),
|
|
15360
|
+
files: external_exports.number().int().nonnegative()
|
|
15361
|
+
}),
|
|
15362
|
+
/** Sorted by max severity, then most recent. */
|
|
15363
|
+
items: external_exports.array(FindingLocationRepo),
|
|
15364
|
+
/** Whether `limit` truncated the repo list. */
|
|
15365
|
+
hasMore: external_exports.boolean()
|
|
15366
|
+
}).meta({ id: "ListFindingLocationsResponse" });
|
|
15255
15367
|
|
|
15256
15368
|
// ../../packages/schema/src/zod/harness-map.ts
|
|
15257
|
-
var Harness = external_exports.enum([
|
|
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" });
|
|
15258
15381
|
|
|
15259
15382
|
// ../../packages/schema/src/zod/meta.ts
|
|
15260
15383
|
var InventoryObjectType = external_exports.enum(["host", "harness", "user", "skill", "hook", "mcp_server", "config_file"]).meta({ id: "InventoryObjectType" });
|
|
@@ -15708,7 +15831,18 @@ var ActivityOverviewResponse = external_exports.object({
|
|
|
15708
15831
|
// ../../packages/schema/src/zod/event.ts
|
|
15709
15832
|
var EventKind = external_exports.enum(["prompt", "response", "code_change", "tool_use"]).meta({ id: "EventKind" });
|
|
15710
15833
|
var CAPTURE_EVENT_TYPES_SQL = EventKind.options.map((k) => `'${k}'`).join(",");
|
|
15711
|
-
var SourceTool = external_exports.enum([
|
|
15834
|
+
var SourceTool = external_exports.enum([
|
|
15835
|
+
"claude-code",
|
|
15836
|
+
"claude-desktop",
|
|
15837
|
+
"cursor",
|
|
15838
|
+
"chatgpt",
|
|
15839
|
+
"claude-ai",
|
|
15840
|
+
"github-copilot",
|
|
15841
|
+
"codex",
|
|
15842
|
+
"antigravity",
|
|
15843
|
+
"cli",
|
|
15844
|
+
"unknown"
|
|
15845
|
+
]).meta({ id: "SourceTool" });
|
|
15712
15846
|
var EventMetadata = external_exports.object({
|
|
15713
15847
|
sessionId: external_exports.string().optional(),
|
|
15714
15848
|
repo: external_exports.string().optional(),
|
|
@@ -15779,7 +15913,7 @@ var TrustLevel = external_exports.enum(["known-good", "risky", "unapproved"]).me
|
|
|
15779
15913
|
var Flag = external_exports.enum(["update", "stale", "conflict", "unknown", "change", "untracked", "risk", "findings"]).meta({ id: "Flag" });
|
|
15780
15914
|
var Visibility = external_exports.enum(["public", "private"]).meta({ id: "Visibility" });
|
|
15781
15915
|
var HarnessEventKind = external_exports.enum(["block", "redact", "warn"]).meta({ id: "HarnessEventKind" });
|
|
15782
|
-
var HarnessId = external_exports.enum(["claudecode", "cursor", "codex"]).meta({ id: "HarnessId" });
|
|
15916
|
+
var HarnessId = external_exports.enum(["claudecode", "cursor", "codex", "antigravity"]).meta({ id: "HarnessId" });
|
|
15783
15917
|
var AccessCounts = external_exports.object({
|
|
15784
15918
|
open: external_exports.number().int().nonnegative(),
|
|
15785
15919
|
approved: external_exports.number().int().nonnegative(),
|
|
@@ -16048,6 +16182,7 @@ var ExceptionBundleEntry = DetectionException.pick({
|
|
|
16048
16182
|
useCount: true,
|
|
16049
16183
|
conditions: true
|
|
16050
16184
|
});
|
|
16185
|
+
var ExceptionDescriptor = DetectionException.omit({ valueFingerprint: true });
|
|
16051
16186
|
|
|
16052
16187
|
// ../../packages/schema/src/zod/rule.ts
|
|
16053
16188
|
var MatcherType = external_exports.enum(["keyword", "regex", "validator"]).meta({ id: "MatcherType" });
|
|
@@ -16773,6 +16908,35 @@ var EgressWriteSummary = external_exports.object({
|
|
|
16773
16908
|
droppedFiles: external_exports.array(external_exports.string()).default([])
|
|
16774
16909
|
}).meta({ id: "EgressWriteSummary" });
|
|
16775
16910
|
|
|
16911
|
+
// ../../packages/schema/src/zod/exception-action.ts
|
|
16912
|
+
var confirmation = external_exports.string().optional();
|
|
16913
|
+
var ApproveBlockedInput = external_exports.object({
|
|
16914
|
+
reference: external_exports.string(),
|
|
16915
|
+
scope: external_exports.string(),
|
|
16916
|
+
reason: external_exports.string(),
|
|
16917
|
+
confirmation
|
|
16918
|
+
});
|
|
16919
|
+
var AddExceptionInput = external_exports.object({
|
|
16920
|
+
ruleId: external_exports.string(),
|
|
16921
|
+
value: external_exports.string(),
|
|
16922
|
+
scope: external_exports.string(),
|
|
16923
|
+
reason: external_exports.string(),
|
|
16924
|
+
confirmation
|
|
16925
|
+
});
|
|
16926
|
+
var GrantRevealInput = external_exports.object({
|
|
16927
|
+
pointer: external_exports.string(),
|
|
16928
|
+
scope: external_exports.string(),
|
|
16929
|
+
justification: external_exports.string(),
|
|
16930
|
+
confirmation
|
|
16931
|
+
});
|
|
16932
|
+
var RevokeExceptionInput = external_exports.object({
|
|
16933
|
+
id: external_exports.string(),
|
|
16934
|
+
reason: external_exports.string()
|
|
16935
|
+
});
|
|
16936
|
+
var RotateKeyInput = external_exports.object({
|
|
16937
|
+
confirmation: external_exports.string()
|
|
16938
|
+
});
|
|
16939
|
+
|
|
16776
16940
|
// ../../packages/schema/src/zod/installed-pack.ts
|
|
16777
16941
|
var InstalledPack = external_exports.object({
|
|
16778
16942
|
id: external_exports.guid(),
|
|
@@ -16904,6 +17068,48 @@ var VaultInventoryEntry = external_exports.object({
|
|
|
16904
17068
|
revealGrantId: external_exports.string().nullable(),
|
|
16905
17069
|
sightings: external_exports.array(VaultSighting)
|
|
16906
17070
|
});
|
|
17071
|
+
var MAX_VAULT_PAGE_LIMIT = 200;
|
|
17072
|
+
var ListVaultInventoryQuery = external_exports.object({
|
|
17073
|
+
limit: external_exports.coerce.number().int().min(1).max(MAX_VAULT_PAGE_LIMIT).optional(),
|
|
17074
|
+
// Opaque; names the last row of the page just served.
|
|
17075
|
+
cursor: external_exports.string().optional()
|
|
17076
|
+
});
|
|
17077
|
+
var ListVaultInventoryResponse = external_exports.object({
|
|
17078
|
+
// Vaulted values across the whole store, not just this page — cursor-
|
|
17079
|
+
// independent, so paging never changes what the count claims.
|
|
17080
|
+
totals: external_exports.object({ values: external_exports.number().int().nonnegative() }),
|
|
17081
|
+
items: external_exports.array(VaultInventoryEntry),
|
|
17082
|
+
// `null` once the last page is reached.
|
|
17083
|
+
nextCursor: external_exports.string().nullable()
|
|
17084
|
+
});
|
|
17085
|
+
var ListVaultReuseQuery = external_exports.object({
|
|
17086
|
+
limit: external_exports.coerce.number().int().min(1).max(MAX_VAULT_PAGE_LIMIT).optional(),
|
|
17087
|
+
cursor: external_exports.string().optional()
|
|
17088
|
+
});
|
|
17089
|
+
var ListVaultReuseResponse = external_exports.object({
|
|
17090
|
+
// Reused values across the whole store — the number the section's claim
|
|
17091
|
+
// ("values detected in more than one place") is about.
|
|
17092
|
+
totals: external_exports.object({ reused: external_exports.number().int().nonnegative() }),
|
|
17093
|
+
items: external_exports.array(VaultInventoryEntry),
|
|
17094
|
+
nextCursor: external_exports.string().nullable()
|
|
17095
|
+
});
|
|
17096
|
+
var ListVaultDerefsQuery = external_exports.object({
|
|
17097
|
+
// Include the batched, high-volume reasons (display, view-render). Omitted
|
|
17098
|
+
// hides them and counts them into `hiddenBatched` instead, so the model
|
|
17099
|
+
// crossings stay visible. A real boolean, not `z.stringbool()`: this arrives
|
|
17100
|
+
// over a Server Action, which preserves the type, never as a URL param.
|
|
17101
|
+
includeBatched: external_exports.boolean().optional(),
|
|
17102
|
+
limit: external_exports.coerce.number().int().min(1).max(MAX_VAULT_PAGE_LIMIT).optional(),
|
|
17103
|
+
cursor: external_exports.string().optional()
|
|
17104
|
+
});
|
|
17105
|
+
var ListVaultDerefsResponse = external_exports.object({
|
|
17106
|
+
items: external_exports.array(VaultDeref),
|
|
17107
|
+
nextCursor: external_exports.string().nullable(),
|
|
17108
|
+
// Display/view-render rows the query hid, over the WHOLE trail rather than
|
|
17109
|
+
// this page — it is the count the "N hidden" line and its toggle speak for.
|
|
17110
|
+
// Always 0 when `includeBatched` was set, since nothing was hidden.
|
|
17111
|
+
hiddenBatched: external_exports.number().int().nonnegative()
|
|
17112
|
+
});
|
|
16907
17113
|
var VaultKeyCustody = external_exports.string();
|
|
16908
17114
|
var VaultInlineReveal = external_exports.enum(["masked", "full", "off"]);
|
|
16909
17115
|
var VaultConsent = external_exports.object({
|
|
@@ -17163,7 +17369,7 @@ var TopSourcesQuery = external_exports.object({
|
|
|
17163
17369
|
// Omit for both kinds.
|
|
17164
17370
|
kind: external_exports.enum(SOURCE_KINDS).optional()
|
|
17165
17371
|
});
|
|
17166
|
-
var Provider = external_exports.enum(["claudecode", "cursor", "codex", "chatgpt", "copilot", "api"]).meta({ id: "Provider" });
|
|
17372
|
+
var Provider = external_exports.enum(["claudecode", "cursor", "codex", "antigravity", "claudeai", "chatgpt", "copilot", "api"]).meta({ id: "Provider" });
|
|
17167
17373
|
var ScanCoverageProvider = external_exports.object({
|
|
17168
17374
|
provider: Provider,
|
|
17169
17375
|
// Percent of that provider's traffic scanned in the window. 0 when unsupported.
|
|
@@ -17331,11 +17537,33 @@ var SetupHandoffOffer = external_exports.object({
|
|
|
17331
17537
|
// ../../packages/persistence/src/ids.ts
|
|
17332
17538
|
import { createHash } from "crypto";
|
|
17333
17539
|
|
|
17540
|
+
// ../../packages/persistence/src/internal/snapshot.ts
|
|
17541
|
+
import { randomUUID } from "crypto";
|
|
17542
|
+
import { existsSync, readdirSync, renameSync as renameSync2, rmSync as rmSync2, statSync } from "fs";
|
|
17543
|
+
import { basename, dirname, join } from "path";
|
|
17544
|
+
|
|
17334
17545
|
// ../../packages/persistence/src/paths.ts
|
|
17335
|
-
import {
|
|
17546
|
+
import {
|
|
17547
|
+
chmodSync,
|
|
17548
|
+
linkSync,
|
|
17549
|
+
lstatSync,
|
|
17550
|
+
mkdirSync,
|
|
17551
|
+
renameSync,
|
|
17552
|
+
rmSync,
|
|
17553
|
+
writeFileSync
|
|
17554
|
+
} from "fs";
|
|
17555
|
+
import { threadId } from "worker_threads";
|
|
17336
17556
|
var DATA_DIR_MODE = 448;
|
|
17337
17557
|
var DATA_FILE_MODE = 384;
|
|
17558
|
+
function isSymlink(path) {
|
|
17559
|
+
try {
|
|
17560
|
+
return lstatSync(path).isSymbolicLink();
|
|
17561
|
+
} catch {
|
|
17562
|
+
return false;
|
|
17563
|
+
}
|
|
17564
|
+
}
|
|
17338
17565
|
function chmodBestEffort(path, mode) {
|
|
17566
|
+
if (isSymlink(path)) return;
|
|
17339
17567
|
try {
|
|
17340
17568
|
chmodSync(path, mode);
|
|
17341
17569
|
} catch {
|
|
@@ -17349,13 +17577,12 @@ function ensureDataDirSync(dir) {
|
|
|
17349
17577
|
tightenDir(dir);
|
|
17350
17578
|
}
|
|
17351
17579
|
function tightenFile(file2) {
|
|
17352
|
-
try {
|
|
17353
|
-
if (lstatSync(file2).isSymbolicLink()) return;
|
|
17354
|
-
} catch {
|
|
17355
|
-
}
|
|
17356
17580
|
chmodBestEffort(file2, DATA_FILE_MODE);
|
|
17357
17581
|
}
|
|
17358
17582
|
|
|
17583
|
+
// ../../packages/persistence/src/internal/snapshot.ts
|
|
17584
|
+
var STALE_PARTIAL_MS = 5 * 6e4;
|
|
17585
|
+
|
|
17359
17586
|
// ../../packages/persistence/src/internal/json.ts
|
|
17360
17587
|
function parseJsonObject(s) {
|
|
17361
17588
|
if (s == null) return void 0;
|
|
@@ -17371,7 +17598,7 @@ function parseJsonObject(s) {
|
|
|
17371
17598
|
var LIVE_ACTIVITY_WINDOW_MS = 30 * 6e4;
|
|
17372
17599
|
|
|
17373
17600
|
// ../../packages/persistence/src/repositories/exceptions.ts
|
|
17374
|
-
import { randomUUID } from "crypto";
|
|
17601
|
+
import { randomUUID as randomUUID2 } from "crypto";
|
|
17375
17602
|
var BLOCKED_DETECTIONS_TTL_MS = 30 * 60 * 1e3;
|
|
17376
17603
|
var BLOCKED_DETECTIONS_RETENTION_MS = 24 * 60 * 60 * 1e3;
|
|
17377
17604
|
var ACTIVE_PREDICATE = `revoked_at IS NULL
|
|
@@ -17382,53 +17609,67 @@ var ACTIVE_REVEAL_GRANT_PREDICATE = `capability = 'reveal_to_model'
|
|
|
17382
17609
|
AND ${ACTIVE_PREDICATE}`;
|
|
17383
17610
|
|
|
17384
17611
|
// ../../packages/persistence/src/repositories/installed-packs.ts
|
|
17385
|
-
import { createHash as createHash2, randomUUID as
|
|
17612
|
+
import { createHash as createHash2, randomUUID as randomUUID3 } from "crypto";
|
|
17386
17613
|
|
|
17387
17614
|
// ../../packages/persistence/src/repositories/inventory-assets.ts
|
|
17388
|
-
import { randomUUID as
|
|
17615
|
+
import { randomUUID as randomUUID4 } from "crypto";
|
|
17389
17616
|
var VALID_HARNESS_IDS = new Set(HarnessId.options);
|
|
17390
17617
|
var HARNESS_LIVENESS_WINDOW_MS = 30 * 24 * 60 * 60 * 1e3;
|
|
17391
17618
|
|
|
17392
17619
|
// ../../packages/persistence/src/repositories/policies.ts
|
|
17393
|
-
import { randomUUID as
|
|
17620
|
+
import { randomUUID as randomUUID5 } from "crypto";
|
|
17394
17621
|
|
|
17395
17622
|
// ../../packages/persistence/src/repositories/project-files.ts
|
|
17396
|
-
import { randomUUID as
|
|
17623
|
+
import { randomUUID as randomUUID6 } from "crypto";
|
|
17397
17624
|
|
|
17398
17625
|
// ../../packages/persistence/src/repositories/resolutions.ts
|
|
17399
|
-
import { randomUUID as
|
|
17626
|
+
import { randomUUID as randomUUID7 } from "crypto";
|
|
17400
17627
|
|
|
17401
17628
|
// ../../packages/persistence/src/repositories/secret-vault.ts
|
|
17402
|
-
import { randomUUID as
|
|
17629
|
+
import { randomUUID as randomUUID8 } from "crypto";
|
|
17403
17630
|
|
|
17404
17631
|
// ../../packages/persistence/src/repositories/shares.ts
|
|
17405
|
-
import { randomUUID as
|
|
17632
|
+
import { randomUUID as randomUUID9 } from "crypto";
|
|
17633
|
+
|
|
17634
|
+
// ../../packages/persistence/src/file-lock.ts
|
|
17635
|
+
import { randomUUID as randomUUID11 } from "crypto";
|
|
17636
|
+
import {
|
|
17637
|
+
closeSync,
|
|
17638
|
+
existsSync as existsSync2,
|
|
17639
|
+
openSync,
|
|
17640
|
+
readFileSync,
|
|
17641
|
+
rmSync as rmSync3,
|
|
17642
|
+
statSync as statSync2,
|
|
17643
|
+
writeFileSync as writeFileSync2
|
|
17644
|
+
} from "fs";
|
|
17645
|
+
import { hostname as hostname3 } from "os";
|
|
17646
|
+
var PARK = new Int32Array(new SharedArrayBuffer(4));
|
|
17406
17647
|
|
|
17407
17648
|
// ../../packages/persistence/src/finding-key.ts
|
|
17408
17649
|
import { createHash as createHash3 } from "crypto";
|
|
17409
17650
|
|
|
17410
17651
|
// ../../packages/persistence/src/fingerprint.ts
|
|
17411
17652
|
import { createHmac, randomBytes } from "crypto";
|
|
17412
|
-
import { existsSync as
|
|
17413
|
-
import { join as
|
|
17653
|
+
import { existsSync as existsSync3, readFileSync as readFileSync2 } from "fs";
|
|
17654
|
+
import { join as join3 } from "path";
|
|
17414
17655
|
import { DatabaseSync as DatabaseSync2 } from "node:sqlite";
|
|
17415
17656
|
|
|
17416
17657
|
// ../../packages/persistence/src/local-layout.ts
|
|
17417
17658
|
import { renameSync as renameSync3 } from "fs";
|
|
17418
17659
|
import { mkdir } from "fs/promises";
|
|
17419
17660
|
import { homedir } from "os";
|
|
17420
|
-
import { join as
|
|
17661
|
+
import { join as join4 } from "path";
|
|
17421
17662
|
function defaultDataDir() {
|
|
17422
|
-
return
|
|
17663
|
+
return join4(homedir(), ".aka");
|
|
17423
17664
|
}
|
|
17424
17665
|
function settingsDir(base = defaultDataDir()) {
|
|
17425
|
-
return
|
|
17666
|
+
return join4(base, "settings");
|
|
17426
17667
|
}
|
|
17427
17668
|
function dataDir(base = defaultDataDir()) {
|
|
17428
|
-
return
|
|
17669
|
+
return join4(base, "data");
|
|
17429
17670
|
}
|
|
17430
17671
|
function dbPath(base = defaultDataDir()) {
|
|
17431
|
-
return
|
|
17672
|
+
return join4(dataDir(base), "aka.db");
|
|
17432
17673
|
}
|
|
17433
17674
|
function ensureLayoutDirSync(dir = defaultDataDir()) {
|
|
17434
17675
|
ensureDataDirSync(dir);
|
|
@@ -17441,8 +17682,8 @@ function migrateLegacyLayout(base = defaultDataDir()) {
|
|
|
17441
17682
|
for (const { name, dest } of moves) {
|
|
17442
17683
|
try {
|
|
17443
17684
|
ensureDataDirSync(dest);
|
|
17444
|
-
const moved =
|
|
17445
|
-
renameSync3(
|
|
17685
|
+
const moved = join4(dest, name);
|
|
17686
|
+
renameSync3(join4(base, name), moved);
|
|
17446
17687
|
tightenFile(moved);
|
|
17447
17688
|
} catch {
|
|
17448
17689
|
}
|
|
@@ -17450,10 +17691,11 @@ function migrateLegacyLayout(base = defaultDataDir()) {
|
|
|
17450
17691
|
}
|
|
17451
17692
|
|
|
17452
17693
|
// ../../packages/persistence/src/settings.ts
|
|
17453
|
-
import { readFileSync as
|
|
17454
|
-
import { join as
|
|
17694
|
+
import { readFileSync as readFileSync3 } from "fs";
|
|
17695
|
+
import { join as join5 } from "path";
|
|
17696
|
+
var SETTINGS_FILENAME = "settings.json";
|
|
17455
17697
|
function readWorkspaceSettings(base = defaultDataDir()) {
|
|
17456
|
-
const record2 = readJson(
|
|
17698
|
+
const record2 = readJson(join5(settingsDir(base), SETTINGS_FILENAME));
|
|
17457
17699
|
if (!record2) return defaultWorkspaceSettings();
|
|
17458
17700
|
try {
|
|
17459
17701
|
return WorkspaceSettings.parse(record2);
|
|
@@ -17464,7 +17706,7 @@ function readWorkspaceSettings(base = defaultDataDir()) {
|
|
|
17464
17706
|
function readJson(file2) {
|
|
17465
17707
|
let text;
|
|
17466
17708
|
try {
|
|
17467
|
-
text =
|
|
17709
|
+
text = readFileSync3(file2, "utf8");
|
|
17468
17710
|
} catch {
|
|
17469
17711
|
return null;
|
|
17470
17712
|
}
|
|
@@ -17486,20 +17728,20 @@ import { randomBytes as randomBytes2 } from "crypto";
|
|
|
17486
17728
|
import {
|
|
17487
17729
|
chmodSync as chmodSync2,
|
|
17488
17730
|
mkdirSync as mkdirSync2,
|
|
17489
|
-
readFileSync as
|
|
17731
|
+
readFileSync as readFileSync4,
|
|
17490
17732
|
renameSync as renameSync4,
|
|
17491
|
-
rmSync as
|
|
17492
|
-
statSync,
|
|
17493
|
-
writeFileSync as
|
|
17733
|
+
rmSync as rmSync4,
|
|
17734
|
+
statSync as statSync3,
|
|
17735
|
+
writeFileSync as writeFileSync3
|
|
17494
17736
|
} from "fs";
|
|
17495
|
-
import { join as
|
|
17737
|
+
import { join as join6 } from "path";
|
|
17496
17738
|
|
|
17497
17739
|
// ../../packages/persistence/src/vault/vault.ts
|
|
17498
|
-
import { randomBytes as randomBytes3, randomUUID as
|
|
17740
|
+
import { randomBytes as randomBytes3, randomUUID as randomUUID12 } from "crypto";
|
|
17499
17741
|
|
|
17500
17742
|
// ../../packages/persistence/src/warn-era-cap.ts
|
|
17501
|
-
import { existsSync as
|
|
17502
|
-
import { join as
|
|
17743
|
+
import { existsSync as existsSync4, writeFileSync as writeFileSync4 } from "fs";
|
|
17744
|
+
import { join as join7 } from "path";
|
|
17503
17745
|
|
|
17504
17746
|
// ../../packages/plugin-sdk/src/provider-env.ts
|
|
17505
17747
|
var DEFAULT_ANTHROPIC_HOST = "api.anthropic.com";
|
|
@@ -17550,11 +17792,11 @@ function resolveProvider() {
|
|
|
17550
17792
|
}
|
|
17551
17793
|
|
|
17552
17794
|
// ../../packages/plugin-sdk/src/config.ts
|
|
17553
|
-
function loadConfig(base = defaultDataDir()) {
|
|
17795
|
+
function loadConfig(base = defaultDataDir(), resolveProviderFn = resolveProvider) {
|
|
17554
17796
|
try {
|
|
17555
17797
|
ensureLayoutDirSync(base);
|
|
17556
|
-
const settingsFile =
|
|
17557
|
-
if (
|
|
17798
|
+
const settingsFile = join8(settingsDir(base), "settings.json");
|
|
17799
|
+
if (existsSync5(settingsFile)) tightenFile(settingsFile);
|
|
17558
17800
|
} catch {
|
|
17559
17801
|
}
|
|
17560
17802
|
migrateLegacyLayout(base);
|
|
@@ -17565,21 +17807,21 @@ function loadConfig(base = defaultDataDir()) {
|
|
|
17565
17807
|
dbPath: dbPath(base),
|
|
17566
17808
|
settingsDir: settingsDir(base),
|
|
17567
17809
|
onboarded: settings.onboardedAt != null,
|
|
17568
|
-
provider: resolveProviderSafe()
|
|
17810
|
+
provider: resolveProviderSafe(resolveProviderFn)
|
|
17569
17811
|
};
|
|
17570
17812
|
}
|
|
17571
|
-
function resolveProviderSafe() {
|
|
17813
|
+
function resolveProviderSafe(resolveProviderFn) {
|
|
17572
17814
|
try {
|
|
17573
|
-
return
|
|
17815
|
+
return resolveProviderFn();
|
|
17574
17816
|
} catch {
|
|
17575
17817
|
return { provider: "anthropic" };
|
|
17576
17818
|
}
|
|
17577
17819
|
}
|
|
17578
17820
|
|
|
17579
17821
|
// ../../packages/plugin-sdk/src/config-inventory.ts
|
|
17580
|
-
import { readdirSync, readFileSync as
|
|
17822
|
+
import { readdirSync as readdirSync2, readFileSync as readFileSync6, realpathSync, statSync as statSync5 } from "fs";
|
|
17581
17823
|
import { homedir as homedir2 } from "os";
|
|
17582
|
-
import { basename as
|
|
17824
|
+
import { basename as basename3, join as join10 } from "path";
|
|
17583
17825
|
|
|
17584
17826
|
// ../../packages/detections/src/egress/registry.ts
|
|
17585
17827
|
var EXTRACTOR_VERSION = "1";
|
|
@@ -18290,46 +18532,77 @@ var POLYNOMIAL_PROBES = ["abc-", "a.", "a ", "a=", "x", "0", "a@", "a/", "ab"].m
|
|
|
18290
18532
|
);
|
|
18291
18533
|
|
|
18292
18534
|
// ../../packages/plugin-sdk/src/repo.ts
|
|
18293
|
-
import { existsSync as
|
|
18294
|
-
import { basename, dirname, isAbsolute, join as
|
|
18535
|
+
import { existsSync as existsSync6, readFileSync as readFileSync5, statSync as statSync4 } from "fs";
|
|
18536
|
+
import { basename as basename2, dirname as dirname2, isAbsolute, join as join9, sep as sep2 } from "path";
|
|
18295
18537
|
|
|
18296
18538
|
// ../../packages/plugin-sdk/src/events.ts
|
|
18297
|
-
import { createHash as createHash4, randomUUID as
|
|
18539
|
+
import { createHash as createHash4, randomUUID as randomUUID13 } from "crypto";
|
|
18540
|
+
|
|
18541
|
+
// ../../packages/plugin-sdk/src/isolated-scan.ts
|
|
18542
|
+
import { existsSync as existsSync7 } from "fs";
|
|
18543
|
+
import { fileURLToPath } from "url";
|
|
18544
|
+
import { Worker } from "worker_threads";
|
|
18298
18545
|
|
|
18299
18546
|
// ../../packages/plugin-sdk/src/inventory-resolver.ts
|
|
18300
|
-
import { arch, hostname as
|
|
18547
|
+
import { arch, hostname as hostname4, platform, release } from "os";
|
|
18301
18548
|
|
|
18302
18549
|
// ../../packages/plugin-sdk/src/nudge.ts
|
|
18303
|
-
import { mkdirSync as mkdirSync3, readFileSync as
|
|
18304
|
-
import { join as
|
|
18550
|
+
import { mkdirSync as mkdirSync3, readFileSync as readFileSync7, writeFileSync as writeFileSync5 } from "fs";
|
|
18551
|
+
import { join as join11 } from "path";
|
|
18305
18552
|
|
|
18306
18553
|
// ../../packages/plugin-sdk/src/paths.ts
|
|
18307
|
-
import { readdirSync as
|
|
18308
|
-
import { basename as
|
|
18554
|
+
import { readdirSync as readdirSync3, realpathSync as realpathSync2 } from "fs";
|
|
18555
|
+
import { basename as basename4, dirname as dirname3, sep as sep3 } from "path";
|
|
18309
18556
|
|
|
18310
18557
|
// ../../packages/plugin-sdk/src/project-files.ts
|
|
18311
18558
|
var import_ignore = __toESM(require_ignore(), 1);
|
|
18312
|
-
import { existsSync as
|
|
18313
|
-
import { basename as
|
|
18559
|
+
import { existsSync as existsSync8, readdirSync as readdirSync4, readFileSync as readFileSync8 } from "fs";
|
|
18560
|
+
import { basename as basename5, join as join12, relative, sep as sep4 } from "path";
|
|
18561
|
+
|
|
18562
|
+
// ../../packages/plugin-sdk/src/provider-env-antigravity.ts
|
|
18563
|
+
var optionalBaseUrl2 = external_exports.preprocess((v) => {
|
|
18564
|
+
if (typeof v === "string" && v.trim() === "") return void 0;
|
|
18565
|
+
return v;
|
|
18566
|
+
}, external_exports.string().optional()).catch(void 0);
|
|
18567
|
+
var optionalFlag = external_exports.preprocess((v) => {
|
|
18568
|
+
if (typeof v !== "string") return false;
|
|
18569
|
+
const normalized = v.trim().toLowerCase();
|
|
18570
|
+
return normalized !== "" && normalized !== "0" && normalized !== "false";
|
|
18571
|
+
}, external_exports.boolean()).catch(false);
|
|
18572
|
+
var antigravityProviderEnvShape = {
|
|
18573
|
+
GOOGLE_GENAI_USE_VERTEXAI: optionalFlag,
|
|
18574
|
+
GOOGLE_GEMINI_BASE_URL: optionalBaseUrl2
|
|
18575
|
+
};
|
|
18576
|
+
var AntigravityProviderEnvSchema = external_exports.object(antigravityProviderEnvShape);
|
|
18577
|
+
|
|
18578
|
+
// ../../packages/plugin-sdk/src/provider-env-codex.ts
|
|
18579
|
+
var optionalBaseUrl3 = external_exports.preprocess((v) => {
|
|
18580
|
+
if (typeof v === "string" && v.trim() === "") return void 0;
|
|
18581
|
+
return v;
|
|
18582
|
+
}, external_exports.string().optional()).catch(void 0);
|
|
18583
|
+
var codexProviderEnvShape = {
|
|
18584
|
+
OPENAI_BASE_URL: optionalBaseUrl3
|
|
18585
|
+
};
|
|
18586
|
+
var CodexProviderEnvSchema = external_exports.object(codexProviderEnvShape);
|
|
18314
18587
|
|
|
18315
18588
|
// ../../packages/plugin-sdk/src/runtime.ts
|
|
18316
|
-
import { randomUUID as
|
|
18589
|
+
import { randomUUID as randomUUID14 } from "crypto";
|
|
18317
18590
|
|
|
18318
18591
|
// ../../packages/plugin-sdk/src/suppressions.ts
|
|
18319
18592
|
var THIRTY_DAYS_MS = 30 * 24 * 60 * 60 * 1e3;
|
|
18320
18593
|
|
|
18321
18594
|
// ../../packages/plugin-sdk/src/throttle.ts
|
|
18322
|
-
import { mkdirSync as mkdirSync4, statSync as
|
|
18323
|
-
import { join as
|
|
18595
|
+
import { mkdirSync as mkdirSync4, statSync as statSync6, writeFileSync as writeFileSync6 } from "fs";
|
|
18596
|
+
import { join as join13 } from "path";
|
|
18324
18597
|
function throttled(dataDir2, markerName, windowMs) {
|
|
18325
|
-
const marker =
|
|
18598
|
+
const marker = join13(dataDir2, markerName);
|
|
18326
18599
|
try {
|
|
18327
|
-
if (Date.now() -
|
|
18600
|
+
if (Date.now() - statSync6(marker).mtimeMs < windowMs) return true;
|
|
18328
18601
|
} catch {
|
|
18329
18602
|
}
|
|
18330
18603
|
try {
|
|
18331
18604
|
mkdirSync4(dataDir2, { recursive: true, mode: DATA_DIR_MODE });
|
|
18332
|
-
|
|
18605
|
+
writeFileSync6(marker, String(Date.now()), { mode: DATA_FILE_MODE });
|
|
18333
18606
|
} catch {
|
|
18334
18607
|
}
|
|
18335
18608
|
return false;
|
|
@@ -18337,21 +18610,21 @@ function throttled(dataDir2, markerName, windowMs) {
|
|
|
18337
18610
|
|
|
18338
18611
|
// src/history/reconcile-trigger.ts
|
|
18339
18612
|
import { spawn } from "child_process";
|
|
18340
|
-
import { dirname as
|
|
18341
|
-
import { fileURLToPath } from "url";
|
|
18613
|
+
import { dirname as dirname4, join as join15 } from "path";
|
|
18614
|
+
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
18342
18615
|
|
|
18343
18616
|
// src/history/tail.ts
|
|
18344
18617
|
import { createHash as createHash5 } from "crypto";
|
|
18345
18618
|
import {
|
|
18346
|
-
closeSync,
|
|
18619
|
+
closeSync as closeSync2,
|
|
18347
18620
|
fstatSync,
|
|
18348
18621
|
mkdirSync as mkdirSync5,
|
|
18349
|
-
openSync,
|
|
18350
|
-
readFileSync as
|
|
18622
|
+
openSync as openSync2,
|
|
18623
|
+
readFileSync as readFileSync9,
|
|
18351
18624
|
readSync,
|
|
18352
|
-
writeFileSync as
|
|
18625
|
+
writeFileSync as writeFileSync7
|
|
18353
18626
|
} from "fs";
|
|
18354
|
-
import { join as
|
|
18627
|
+
import { join as join14 } from "path";
|
|
18355
18628
|
var SAFE_SESSION_ID = /^[A-Za-z0-9._-]+$/;
|
|
18356
18629
|
function safeSessionId(sessionId) {
|
|
18357
18630
|
if (SAFE_SESSION_ID.test(sessionId) && sessionId !== "." && sessionId !== "..") {
|
|
@@ -18367,8 +18640,8 @@ function triggerReconcile(dataDir2, sessionId, transcriptPath) {
|
|
|
18367
18640
|
try {
|
|
18368
18641
|
const marker = `${RECONCILE_MARKER_PREFIX}-${safeSessionId(sessionId)}`;
|
|
18369
18642
|
if (throttled(dataDir2, marker, RECONCILE_THROTTLE_MS)) return;
|
|
18370
|
-
const here =
|
|
18371
|
-
const child = spawn(process.execPath, [
|
|
18643
|
+
const here = dirname4(fileURLToPath2(import.meta.url));
|
|
18644
|
+
const child = spawn(process.execPath, [join15(here, "reconcile.js"), sessionId, transcriptPath], {
|
|
18372
18645
|
detached: true,
|
|
18373
18646
|
stdio: "ignore"
|
|
18374
18647
|
});
|