@akasecurity/ai-tc-claude-code 0.9.11 → 0.9.13
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/commands/scan.md +1 -1
- package/commands/setup.md +31 -3
- package/package.json +2 -2
- package/scripts/apply-suppressions.js +1722 -791
- package/scripts/backfill.js +4428 -3403
- package/scripts/content-retention.js +34307 -0
- package/scripts/filescan.js +4615 -3458
- package/scripts/firstrun.js +4389 -3379
- package/scripts/history-sync.js +1916 -866
- package/scripts/intro.js +520 -68
- package/scripts/message-display.js +1704 -773
- package/scripts/onboard.js +1711 -772
- package/scripts/post-model-switch.js +546 -83
- package/scripts/post-tool-use.js +4433 -3408
- package/scripts/pre-model-switch.js +4412 -3380
- package/scripts/pre-tool-use.js +4464 -3412
- package/scripts/query.js +4497 -3375
- package/scripts/reconcile.js +4404 -3393
- package/scripts/remediate.js +4428 -3403
- package/scripts/scan-worker.js +441 -30
- package/scripts/session-start.js +4482 -3450
- package/scripts/start-light.js +518 -66
- package/scripts/statusline.js +4388 -3377
- package/scripts/stop.js +555 -92
- package/scripts/sync.js +4621 -3464
- package/scripts/user-prompt-submit.js +4452 -3406
package/scripts/stop.js
CHANGED
|
@@ -50,7 +50,7 @@ var require_ignore = __commonJS({
|
|
|
50
50
|
var REGEX_SPLITALL_CRLF = /\r?\n/g;
|
|
51
51
|
var REGEX_TEST_INVALID_PATH = /^\.{0,2}\/|^\.{1,2}$/;
|
|
52
52
|
var REGEX_TEST_TRAILING_SLASH = /\/$/;
|
|
53
|
-
var
|
|
53
|
+
var SLASH3 = "/";
|
|
54
54
|
var TMP_KEY_IGNORE = "node-ignore";
|
|
55
55
|
if (typeof Symbol !== "undefined") {
|
|
56
56
|
TMP_KEY_IGNORE = /* @__PURE__ */ Symbol.for("node-ignore");
|
|
@@ -422,11 +422,11 @@ var require_ignore = __commonJS({
|
|
|
422
422
|
if (!REGEX_TEST_TRAILING_SLASH.test(path)) {
|
|
423
423
|
return this.test(path);
|
|
424
424
|
}
|
|
425
|
-
const slices = path.split(
|
|
425
|
+
const slices = path.split(SLASH3).filter(Boolean);
|
|
426
426
|
slices.pop();
|
|
427
427
|
if (slices.length) {
|
|
428
428
|
const parent = this._t(
|
|
429
|
-
slices.join(
|
|
429
|
+
slices.join(SLASH3) + SLASH3,
|
|
430
430
|
this._testCache,
|
|
431
431
|
true,
|
|
432
432
|
slices
|
|
@@ -442,14 +442,14 @@ var require_ignore = __commonJS({
|
|
|
442
442
|
return cache[path];
|
|
443
443
|
}
|
|
444
444
|
if (!slices) {
|
|
445
|
-
slices = path.split(
|
|
445
|
+
slices = path.split(SLASH3).filter(Boolean);
|
|
446
446
|
}
|
|
447
447
|
slices.pop();
|
|
448
448
|
if (!slices.length) {
|
|
449
449
|
return cache[path] = this._rules.test(path, checkUnignored, MODE_IGNORE);
|
|
450
450
|
}
|
|
451
451
|
const parent = this._t(
|
|
452
|
-
slices.join(
|
|
452
|
+
slices.join(SLASH3) + SLASH3,
|
|
453
453
|
cache,
|
|
454
454
|
checkUnignored,
|
|
455
455
|
slices
|
|
@@ -493,7 +493,7 @@ var require_ignore = __commonJS({
|
|
|
493
493
|
|
|
494
494
|
// ../../packages/plugin-sdk/src/config.ts
|
|
495
495
|
import { existsSync as existsSync8 } from "fs";
|
|
496
|
-
import { join as
|
|
496
|
+
import { join as join16 } from "path";
|
|
497
497
|
|
|
498
498
|
// ../../packages/persistence/src/attached-derived.ts
|
|
499
499
|
import { rmSync } from "fs";
|
|
@@ -503,6 +503,14 @@ import { join } from "path";
|
|
|
503
503
|
import { chmodSync as chmodSync2, lstatSync as lstatSync2, readFileSync, rmSync as rmSync3, statSync } from "fs";
|
|
504
504
|
import { join as join2 } from "path";
|
|
505
505
|
|
|
506
|
+
// ../../packages/schema/src/drizzle/deferred-migrations.ts
|
|
507
|
+
var DEFERRED_MIGRATION_TAGS = [
|
|
508
|
+
"0031_audit_capture_by_time_index",
|
|
509
|
+
"0032_audit_capture_by_id_index",
|
|
510
|
+
"0033_audit_capture_location_index",
|
|
511
|
+
"0034_findings_read_indexes"
|
|
512
|
+
];
|
|
513
|
+
|
|
506
514
|
// ../../packages/schema/src/exception-scope.ts
|
|
507
515
|
var MINUTE_MS = 6e4;
|
|
508
516
|
var HOUR_MS = 60 * MINUTE_MS;
|
|
@@ -20215,7 +20223,17 @@ var UNPRICEABLE_PROVIDERS = Object.freeze([
|
|
|
20215
20223
|
"gateway",
|
|
20216
20224
|
"unknown",
|
|
20217
20225
|
"cli",
|
|
20218
|
-
"api"
|
|
20226
|
+
"api",
|
|
20227
|
+
// The browser extension's native host records these as `llm_call.provider`
|
|
20228
|
+
// for a web-chat turn — the web tool id, deliberately never the vendor id
|
|
20229
|
+
// (`openai`/`anthropic`) the session root carries. Subscription traffic
|
|
20230
|
+
// burns rate-limit budget, not dollar credits, and listing them here is
|
|
20231
|
+
// what keeps that true structurally: a later maintainer who wants to price
|
|
20232
|
+
// web-chat traffic at API rates has to delete this entry first, and meet
|
|
20233
|
+
// the reason on the way, rather than quietly adding one to
|
|
20234
|
+
// PROVIDER_PLATFORM.
|
|
20235
|
+
"chatgpt",
|
|
20236
|
+
"claude-ai"
|
|
20219
20237
|
]);
|
|
20220
20238
|
|
|
20221
20239
|
// ../../packages/schema/src/token/format.ts
|
|
@@ -20235,7 +20253,12 @@ var HARNESS = {
|
|
|
20235
20253
|
ClaudeDesktop: "claudedesktop",
|
|
20236
20254
|
ChatGpt: "chatgpt",
|
|
20237
20255
|
ClaudeAi: "claudeai",
|
|
20238
|
-
Api: "api"
|
|
20256
|
+
Api: "api",
|
|
20257
|
+
// Not a coding assistant a person drives — an in-process SDK embedded in an
|
|
20258
|
+
// application, so it has no IDE/CLI/desktop/web surface of its own. Carries
|
|
20259
|
+
// the same id as its SOURCE_TOOL counterpart, unlike every capture-side tool
|
|
20260
|
+
// whose wire spelling differs from its display spelling.
|
|
20261
|
+
AiTcSdk: "ai-tc-sdk"
|
|
20239
20262
|
};
|
|
20240
20263
|
var Harness = external_exports.enum(HARNESS).meta({ id: "Harness" });
|
|
20241
20264
|
var SOURCE_TOOL = {
|
|
@@ -20251,9 +20274,15 @@ var SOURCE_TOOL = {
|
|
|
20251
20274
|
// whose tool could not be identified both render through the read side's
|
|
20252
20275
|
// miss path rather than as a harness of their own.
|
|
20253
20276
|
Cli: "cli",
|
|
20254
|
-
Unknown: "unknown"
|
|
20277
|
+
Unknown: "unknown",
|
|
20278
|
+
// The wire id an in-process, request-path SDK stamps on its own structural
|
|
20279
|
+
// rows (`request_decision`) — never a capture of prompt/response/tool text,
|
|
20280
|
+
// since the SDK sits in front of a model call rather than inside a coding
|
|
20281
|
+
// assistant's own hook contract.
|
|
20282
|
+
AiTcSdk: "ai-tc-sdk"
|
|
20255
20283
|
};
|
|
20256
20284
|
var SourceTool = external_exports.enum(SOURCE_TOOL).meta({ id: "SourceTool" });
|
|
20285
|
+
var WebSourceTool = SourceTool.extract(["ChatGpt", "ClaudeAi"]);
|
|
20257
20286
|
var TOOL_TO_HARNESS = {
|
|
20258
20287
|
[SOURCE_TOOL.ClaudeCode]: HARNESS.ClaudeCode,
|
|
20259
20288
|
[SOURCE_TOOL.ClaudeDesktop]: HARNESS.ClaudeDesktop,
|
|
@@ -20262,7 +20291,12 @@ var TOOL_TO_HARNESS = {
|
|
|
20262
20291
|
[SOURCE_TOOL.ChatGpt]: HARNESS.ChatGpt,
|
|
20263
20292
|
[SOURCE_TOOL.Codex]: HARNESS.Codex,
|
|
20264
20293
|
[SOURCE_TOOL.Antigravity]: HARNESS.Antigravity,
|
|
20265
|
-
[SOURCE_TOOL.ClaudeAi]: HARNESS.ClaudeAi
|
|
20294
|
+
[SOURCE_TOOL.ClaudeAi]: HARNESS.ClaudeAi,
|
|
20295
|
+
// Wire and display id are the same string here, but the row still belongs:
|
|
20296
|
+
// both vocabularies carry the `AiTcSdk` member, and the join is exactly
|
|
20297
|
+
// their intersection — leaving a shared member out would read as an
|
|
20298
|
+
// uninstrumented tool on both surfaces, which this one is not.
|
|
20299
|
+
[SOURCE_TOOL.AiTcSdk]: HARNESS.AiTcSdk
|
|
20266
20300
|
};
|
|
20267
20301
|
|
|
20268
20302
|
// ../../packages/schema/src/zod/finding.ts
|
|
@@ -20296,7 +20330,8 @@ var FindingProvider = Harness.extract([
|
|
|
20296
20330
|
"ClaudeAi",
|
|
20297
20331
|
"Codex",
|
|
20298
20332
|
"Antigravity",
|
|
20299
|
-
"Api"
|
|
20333
|
+
"Api",
|
|
20334
|
+
"AiTcSdk"
|
|
20300
20335
|
]).meta({ id: "FindingProvider" });
|
|
20301
20336
|
var FindingCategory = external_exports.enum([
|
|
20302
20337
|
"secret",
|
|
@@ -20312,6 +20347,15 @@ var FindingCategory = external_exports.enum([
|
|
|
20312
20347
|
]).meta({ id: "FindingCategory" });
|
|
20313
20348
|
var FindingOrigin = external_exports.enum(["in-flight", "at-rest"]).meta({ id: "FindingOrigin" });
|
|
20314
20349
|
var FindingStatus = external_exports.enum(["open", "handled", "resolved", "dismissed"]).meta({ id: "FindingStatus" });
|
|
20350
|
+
var SyncFailureReason = external_exports.enum(["deployment_refused", "payload_invalid", "detached_undelivered"]).meta({ id: "SyncFailureReason" });
|
|
20351
|
+
var FindingDeliveryState = external_exports.enum(["sent", "queued", "not_sent", "never_offered", "local_scan"]).meta({ id: "FindingDeliveryState" });
|
|
20352
|
+
var FindingDelivery = external_exports.object({
|
|
20353
|
+
state: FindingDeliveryState,
|
|
20354
|
+
// The delivery time for `sent`; the failure time for `not_sent` when recorded.
|
|
20355
|
+
at: external_exports.iso.datetime().optional(),
|
|
20356
|
+
// Only on `not_sent`, and only when a known reason was recorded.
|
|
20357
|
+
reason: SyncFailureReason.optional()
|
|
20358
|
+
}).meta({ id: "FindingDelivery" });
|
|
20315
20359
|
var ResolutionMethod = external_exports.enum([
|
|
20316
20360
|
"enforced-in-flight",
|
|
20317
20361
|
"fixed-at-source",
|
|
@@ -20368,7 +20412,10 @@ var FindingInstance = external_exports.object({
|
|
|
20368
20412
|
// The session that event belongs to, when it has one — the seam a
|
|
20369
20413
|
// per-instance "view session" link needs. Absent for events captured
|
|
20370
20414
|
// outside a session.
|
|
20371
|
-
sessionId: external_exports.string().optional()
|
|
20415
|
+
sessionId: external_exports.string().optional(),
|
|
20416
|
+
// The delivery state of the event above (see FindingDelivery). Optional so
|
|
20417
|
+
// readers that do not project it stay valid.
|
|
20418
|
+
delivery: FindingDelivery.optional()
|
|
20372
20419
|
}).meta({ id: "FindingInstance" });
|
|
20373
20420
|
var FindingGroup = external_exports.object({
|
|
20374
20421
|
id: external_exports.string(),
|
|
@@ -20420,7 +20467,10 @@ var FindingFacets = external_exports.object({
|
|
|
20420
20467
|
// Host tool (attributes.tool_name). Present only on the instance-level
|
|
20421
20468
|
// reads, which can filter by it; the type-level read omits the dimension
|
|
20422
20469
|
// because a group spans tools.
|
|
20423
|
-
tool: external_exports.array(FindingFacetItem).optional()
|
|
20470
|
+
tool: external_exports.array(FindingFacetItem).optional(),
|
|
20471
|
+
// Delivery states (FindingDeliveryState). Present only on the
|
|
20472
|
+
// instance-level reads, like `tool`.
|
|
20473
|
+
deployment: external_exports.array(FindingFacetItem).optional()
|
|
20424
20474
|
}).meta({ id: "FindingFacets" });
|
|
20425
20475
|
var FindingTypeSummary = FindingGroup.omit({ instances: true, match: true }).meta({
|
|
20426
20476
|
id: "FindingTypeSummary"
|
|
@@ -20529,6 +20579,8 @@ var ListFindingInstancesQuery = external_exports.object({
|
|
|
20529
20579
|
// Exact host-tool names (attributes.tool_name, e.g. 'Bash'). A real filter,
|
|
20530
20580
|
// where the free-text `q` can only match the rendered "via Bash" label.
|
|
20531
20581
|
tool: external_exports.array(external_exports.string()).optional(),
|
|
20582
|
+
// The delivery state of each finding's event (see FindingDelivery).
|
|
20583
|
+
deployment: external_exports.array(FindingDeliveryState).optional(),
|
|
20532
20584
|
// Exact repository / file-path matches, for the drill-down out of the
|
|
20533
20585
|
// locations view. A row whose event carries no repo/file matches neither.
|
|
20534
20586
|
repo: external_exports.string().optional(),
|
|
@@ -20549,6 +20601,10 @@ var ListFindingInstancesResponse = external_exports.object({
|
|
|
20549
20601
|
items: external_exports.array(FindingInstanceDetail),
|
|
20550
20602
|
nextCursor: external_exports.string().nullable()
|
|
20551
20603
|
}).meta({ id: "ListFindingInstancesResponse" });
|
|
20604
|
+
var ListFindingInstancesPage = external_exports.object({
|
|
20605
|
+
items: external_exports.array(FindingInstanceDetail),
|
|
20606
|
+
nextCursor: external_exports.string().nullable()
|
|
20607
|
+
}).meta({ id: "ListFindingInstancesPage" });
|
|
20552
20608
|
var FindingLocationSummary = external_exports.object({
|
|
20553
20609
|
// Opaque, stable, minted from the pair by encodeLocationId. It exists
|
|
20554
20610
|
// because a location's identity is two values and a URL param carries one:
|
|
@@ -20590,6 +20646,8 @@ var ListFindingLocationsQuery = external_exports.object({
|
|
|
20590
20646
|
// instances that match, and folds its status from those.
|
|
20591
20647
|
status: external_exports.array(FindingStatus).optional(),
|
|
20592
20648
|
tool: external_exports.array(external_exports.string()).optional(),
|
|
20649
|
+
// The delivery state of each finding's event (see FindingDelivery).
|
|
20650
|
+
deployment: external_exports.array(FindingDeliveryState).optional(),
|
|
20593
20651
|
q: external_exports.string().optional(),
|
|
20594
20652
|
sessionId: external_exports.string().optional(),
|
|
20595
20653
|
from: external_exports.iso.datetime().optional(),
|
|
@@ -20647,18 +20705,41 @@ var AuditEventType = external_exports.enum([
|
|
|
20647
20705
|
// 'tool_call' is the reconciler's structural row for every call, while
|
|
20648
20706
|
// 'tool_use' exists only where a hook enforced against the arguments.
|
|
20649
20707
|
"tool_use",
|
|
20650
|
-
// One row per model REFUSAL
|
|
20651
|
-
//
|
|
20652
|
-
//
|
|
20653
|
-
//
|
|
20654
|
-
//
|
|
20655
|
-
//
|
|
20708
|
+
// One row per model REFUSAL, across all four seams a prohibited model can be
|
|
20709
|
+
// stopped at: a switch onto it, a turn already running on it, a subagent
|
|
20710
|
+
// spawn asking for it, or a request-path refusal an embedded request-path
|
|
20711
|
+
// SDK makes in-process before the call leaves the application. Which seam
|
|
20712
|
+
// rides `attributes.refusal_seam`, never this member name. A structural row
|
|
20713
|
+
// like the ones above rather than a capture — it carries the model that was
|
|
20714
|
+
// refused and nothing the user typed, because what is worth recording about
|
|
20715
|
+
// a governance decision is the decision, and prompt text is the thing this
|
|
20716
|
+
// product exists to keep from travelling.
|
|
20656
20717
|
"model_refusal",
|
|
20718
|
+
// One row per request-path DECISION: a policy check an embedded request-path
|
|
20719
|
+
// SDK performs in-process before a model call leaves the application, or
|
|
20720
|
+
// against that call's non-streamed response. A structural row like
|
|
20721
|
+
// 'model_refusal' rather than a capture — content-free in the same way:
|
|
20722
|
+
// which side, which seam, what action and which field are decided rides
|
|
20723
|
+
// `attributes`, never this member name, and the matched text itself never
|
|
20724
|
+
// travels.
|
|
20725
|
+
//
|
|
20726
|
+
// A prohibited-model refusal on the request path is deliberately NOT this
|
|
20727
|
+
// member: it stays 'model_refusal' with `refusal_seam: 'request'`, so it
|
|
20728
|
+
// shares one bucket with the plugin's switch/turn/spawn refusals rather
|
|
20729
|
+
// than splitting one governance concept across two event types. This
|
|
20730
|
+
// member carries every OTHER request-path decision.
|
|
20731
|
+
"request_decision",
|
|
20657
20732
|
// One row per config-inventory scan, hung off the session root. It is the
|
|
20658
20733
|
// fact the posture inspection findings reference (findings require an
|
|
20659
20734
|
// audit_event_id), and its started_at is the "scanned Nm ago" the read
|
|
20660
20735
|
// surface renders.
|
|
20661
|
-
"config_scan"
|
|
20736
|
+
"config_scan",
|
|
20737
|
+
// One row per reported browser-extension capture status, hung off the web
|
|
20738
|
+
// session root. The durable home of what one tab's network interception
|
|
20739
|
+
// is doing — a write-through of the native host's in-memory tracker, so a
|
|
20740
|
+
// second process (aka extension status) and a restarted host both have
|
|
20741
|
+
// somewhere to read it back from.
|
|
20742
|
+
"capture_status"
|
|
20662
20743
|
]).meta({ id: "AuditEventType" });
|
|
20663
20744
|
var AttributeBag = external_exports.record(external_exports.string(), external_exports.unknown());
|
|
20664
20745
|
var HostAttributes = external_exports.object({
|
|
@@ -20792,6 +20873,10 @@ var CaptureAttributes = external_exports.object({
|
|
|
20792
20873
|
// to 'allow' — the enforcement audit trail's link back to the grant that
|
|
20793
20874
|
// authorized the bypass.
|
|
20794
20875
|
exception_ids: external_exports.array(external_exports.guid()).optional(),
|
|
20876
|
+
// The persisted spellings of EventMetadata's messageId/conversationId — the
|
|
20877
|
+
// join back to the `llm_call` leaf for the same assistant turn.
|
|
20878
|
+
message_id: external_exports.string().optional(),
|
|
20879
|
+
conversation_id: external_exports.string().optional(),
|
|
20795
20880
|
// Whole milliseconds this capture's inspection blocked its caller — the
|
|
20796
20881
|
// plugin's own added latency (see EventMetadata.inspectionMs, whose value
|
|
20797
20882
|
// this is). Promoted to the `inspection_ms` generated column so the facet is
|
|
@@ -20800,7 +20885,33 @@ var CaptureAttributes = external_exports.object({
|
|
|
20800
20885
|
// inline json_extract and is not itself an optimization.
|
|
20801
20886
|
// ABSENT on replayed captures (backfill / worktree scan) and on rows written
|
|
20802
20887
|
// before the measurement shipped — never present as a placeholder 0.
|
|
20803
|
-
inspection_ms: external_exports.number().int().nonnegative().optional()
|
|
20888
|
+
inspection_ms: external_exports.number().int().nonnegative().optional(),
|
|
20889
|
+
// What a `redact` this capture could not carry out became instead (see
|
|
20890
|
+
// EventMetadata.redactDegradedTo, whose value this is). Present only when a
|
|
20891
|
+
// degrade actually happened, so absence is the ordinary case rather than a
|
|
20892
|
+
// reader having to distinguish it from a zero.
|
|
20893
|
+
//
|
|
20894
|
+
// PER CAPTURE, while `inspection_findings.action_taken` is per finding —
|
|
20895
|
+
// so on a multi-finding row this does not say which finding degraded, and
|
|
20896
|
+
// its presence does not mean the fallback decided the capture's action. A
|
|
20897
|
+
// capture denied by another finding's own Block policy carries `block`
|
|
20898
|
+
// here too. The full statement is on EventMetadata.redactDegradedTo; it is
|
|
20899
|
+
// repeated rather than referenced because a store reader opens this file.
|
|
20900
|
+
redact_degraded_to: ActionTaken.optional()
|
|
20901
|
+
}).catchall(external_exports.unknown());
|
|
20902
|
+
var CaptureStatusAttributes = external_exports.object({
|
|
20903
|
+
source_tool: external_exports.string().optional(),
|
|
20904
|
+
patched: external_exports.boolean().optional(),
|
|
20905
|
+
live: external_exports.boolean().optional(),
|
|
20906
|
+
blind: external_exports.boolean().optional(),
|
|
20907
|
+
sends_seen_dom: external_exports.number().int().nonnegative().optional(),
|
|
20908
|
+
exchanges_seen_net: external_exports.number().int().nonnegative().optional(),
|
|
20909
|
+
parse_failures: external_exports.number().int().nonnegative().optional(),
|
|
20910
|
+
unparsed_bodies: external_exports.number().int().nonnegative().optional(),
|
|
20911
|
+
shape_misses: external_exports.array(external_exports.string()).optional(),
|
|
20912
|
+
conversation_endpoints: external_exports.number().int().nonnegative().optional(),
|
|
20913
|
+
closed: external_exports.boolean().optional(),
|
|
20914
|
+
enforcement: external_exports.string().optional()
|
|
20804
20915
|
}).catchall(external_exports.unknown());
|
|
20805
20916
|
var ToolCallInspection = external_exports.object({
|
|
20806
20917
|
ruleId: external_exports.string().min(1),
|
|
@@ -20996,7 +21107,17 @@ var AuditEvent = external_exports.object({
|
|
|
20996
21107
|
/** `share` to a first-party/internal destination. */
|
|
20997
21108
|
internal: external_exports.boolean(),
|
|
20998
21109
|
/** Event needs review (e.g. unverified egress). */
|
|
20999
|
-
flagged: external_exports.boolean()
|
|
21110
|
+
flagged: external_exports.boolean(),
|
|
21111
|
+
/**
|
|
21112
|
+
* The body this event's `title` is drawn from was cleared by local body
|
|
21113
|
+
* expiry, so an EMPTY title here means "gone", not "never had one".
|
|
21114
|
+
*
|
|
21115
|
+
* A separate flag rather than a sentinel written into `title`: the title is
|
|
21116
|
+
* rendered text, and a store-layer module that invented display copy for it
|
|
21117
|
+
* would be choosing words the view is supposed to choose. Additive and
|
|
21118
|
+
* defaulted, so an older producer still validates.
|
|
21119
|
+
*/
|
|
21120
|
+
bodyExpired: external_exports.boolean().default(false)
|
|
21000
21121
|
}).meta({ id: "ActivityAuditEvent" });
|
|
21001
21122
|
var ActivitySessionSummary = external_exports.object({
|
|
21002
21123
|
id: external_exports.string(),
|
|
@@ -21801,6 +21922,11 @@ var RemoteFailureKind = external_exports.enum([
|
|
|
21801
21922
|
"rejected",
|
|
21802
21923
|
"unreachable"
|
|
21803
21924
|
]);
|
|
21925
|
+
var ControlPlaneFailure = RemoteFailureKind.extract([
|
|
21926
|
+
"unauthorized",
|
|
21927
|
+
"forbidden",
|
|
21928
|
+
"unreachable"
|
|
21929
|
+
]);
|
|
21804
21930
|
var AttachDeviceRequest = external_exports.object({
|
|
21805
21931
|
// This machine's own continuity id, so re-attaching ROTATES the credential
|
|
21806
21932
|
// on one machine record instead of producing a second one. Client-minted
|
|
@@ -22219,6 +22345,17 @@ var EventMetadata = external_exports.object({
|
|
|
22219
22345
|
// to 'allow' — the enforcement audit trail's link back to the grant that
|
|
22220
22346
|
// authorized the bypass. Absent on captures where no exception applied.
|
|
22221
22347
|
exceptionIds: external_exports.array(external_exports.guid()).optional(),
|
|
22348
|
+
// The assistant message this capture belongs to, and the conversation it sits
|
|
22349
|
+
// in — set by the browser extension's network capture so a stored `response`
|
|
22350
|
+
// row can be joined to the `llm_call` leaf describing the same turn. Absent
|
|
22351
|
+
// on every other capture path, which has no such id.
|
|
22352
|
+
//
|
|
22353
|
+
// Non-empty for the reason WebExchange.messageId is: it is the join key, and
|
|
22354
|
+
// a blank one matches no `llm_call` leaf. That refusal reaches only the
|
|
22355
|
+
// places an event is PARSED; the local write path types the event and parses
|
|
22356
|
+
// nothing, which is why `toCaptureAttributes` omits a blank one separately.
|
|
22357
|
+
messageId: external_exports.string().min(1).optional(),
|
|
22358
|
+
conversationId: external_exports.string().optional(),
|
|
22222
22359
|
// How long THIS capture's inspection blocked its caller, in whole
|
|
22223
22360
|
// milliseconds — the plugin's own added latency, NOT the LLM call it sat in
|
|
22224
22361
|
// front of. Measured inside `capture()` (@akasecurity/plugin-sdk) across
|
|
@@ -22231,7 +22368,37 @@ var EventMetadata = external_exports.object({
|
|
|
22231
22368
|
// Absent is also what every pre-measurement client writes, and what a
|
|
22232
22369
|
// clock failure degrades to — a reader must treat absence as "not measured"
|
|
22233
22370
|
// and never as a zero, which would read as "inspection is free".
|
|
22234
|
-
inspectionMs: external_exports.number().int().nonnegative().optional()
|
|
22371
|
+
inspectionMs: external_exports.number().int().nonnegative().optional(),
|
|
22372
|
+
// What a `redact` this capture COULD NOT CARRY OUT became instead — the
|
|
22373
|
+
// workspace's `redactFallback`, applied because the field could not be
|
|
22374
|
+
// masked in place (a shell command, a URL, or any argument on a host whose
|
|
22375
|
+
// hook contract offers no rewrite channel).
|
|
22376
|
+
//
|
|
22377
|
+
// It exists because the action alone cannot say why. A finding recorded as
|
|
22378
|
+
// `warn` reads identically whether its detection was ASSIGNED Warn or was
|
|
22379
|
+
// assigned Redact on a field that could not take one — and those are
|
|
22380
|
+
// different facts about the same row: the first is a policy the user chose,
|
|
22381
|
+
// the second is a masking the host could not perform. Absent means no
|
|
22382
|
+
// degrade happened, which is every ordinary capture.
|
|
22383
|
+
//
|
|
22384
|
+
// TWO LIMITS a reader of a stored row has to know, because the grain here
|
|
22385
|
+
// is the CAPTURE while `actionTaken` is per FINDING:
|
|
22386
|
+
//
|
|
22387
|
+
// - It does not say WHICH finding degraded. A capture carrying a degraded
|
|
22388
|
+
// `redact` alongside a finding ASSIGNED the same action stores both
|
|
22389
|
+
// identically and one reason for the pair; attributing it to both
|
|
22390
|
+
// describes the assigned one wrongly, and to neither loses the degrade.
|
|
22391
|
+
// - PRESENCE IS NOT CAUSATION. The value is the action the lost redact
|
|
22392
|
+
// became, not the reason the capture ended as it did — a capture denied
|
|
22393
|
+
// by some other finding's own Block policy still carries `block` here,
|
|
22394
|
+
// and clearing the workspace's fallback would not have let it through.
|
|
22395
|
+
// Gate on the value against what a fallback can produce; never read the
|
|
22396
|
+
// field's presence as "this was the fallback's doing".
|
|
22397
|
+
//
|
|
22398
|
+
// Both are pinned as behaviour in @akasecurity/plugin-sdk's runtime suite.
|
|
22399
|
+
// Closing either means moving the reason onto the finding row, which
|
|
22400
|
+
// already carries its own action.
|
|
22401
|
+
redactDegradedTo: ActionTaken.optional()
|
|
22235
22402
|
}).meta({ id: "EventMetadata" });
|
|
22236
22403
|
var Event = external_exports.object({
|
|
22237
22404
|
id: external_exports.guid(),
|
|
@@ -22341,6 +22508,15 @@ var RotateKeyInput = external_exports.object({
|
|
|
22341
22508
|
confirmation: external_exports.string()
|
|
22342
22509
|
});
|
|
22343
22510
|
|
|
22511
|
+
// ../../packages/schema/src/zod/finding-delivery.ts
|
|
22512
|
+
var KNOWN_REASONS = SyncFailureReason.options;
|
|
22513
|
+
|
|
22514
|
+
// ../../packages/schema/src/zod/findings-group-build.ts
|
|
22515
|
+
function rankByOrder(members2) {
|
|
22516
|
+
return Object.fromEntries(members2.map((member, index) => [member, index]));
|
|
22517
|
+
}
|
|
22518
|
+
var SEVERITY_RANK = rankByOrder(Severity.options);
|
|
22519
|
+
|
|
22344
22520
|
// ../../packages/schema/src/zod/installed-pack.ts
|
|
22345
22521
|
var InstalledPack = external_exports.object({
|
|
22346
22522
|
id: external_exports.guid(),
|
|
@@ -22407,6 +22583,11 @@ var Policy = external_exports.object({
|
|
|
22407
22583
|
// test `prohibitedModels` passes and `reversibleRuleIds` fails.
|
|
22408
22584
|
provenance: PolicyProvenance.optional()
|
|
22409
22585
|
}).meta({ id: "Policy" });
|
|
22586
|
+
var KNOWN_BUILTIN_IDS = ["monitor", "warn", "redact", "vault", "block"];
|
|
22587
|
+
var BuiltinPolicyId = external_exports.enum(KNOWN_BUILTIN_IDS).meta({ id: "BuiltinPolicyId" });
|
|
22588
|
+
var RedactFallback = BuiltinPolicyId.extract(["monitor", "warn", "block"]).meta({
|
|
22589
|
+
id: "RedactFallback"
|
|
22590
|
+
});
|
|
22410
22591
|
var PolicyBundle = external_exports.object({
|
|
22411
22592
|
version: external_exports.string(),
|
|
22412
22593
|
policies: external_exports.array(Policy),
|
|
@@ -22454,6 +22635,16 @@ var PolicyBundle = external_exports.object({
|
|
|
22454
22635
|
// control plane), so no name resolution stands between the decision and the
|
|
22455
22636
|
// comparison.
|
|
22456
22637
|
prohibitedModels: external_exports.array(external_exports.string()).optional(),
|
|
22638
|
+
// What a resolved `redact` becomes on a field the host cannot rewrite, as
|
|
22639
|
+
// the ORGANIZATION would have it. Merged raise-only against the device's own
|
|
22640
|
+
// `WorkspaceSettings.redactFallback` (see strongerRedactFallback below), so
|
|
22641
|
+
// a control plane can tighten a machine and never loosen one — the same
|
|
22642
|
+
// direction `mergeRaiseOnly` enforces for policies.
|
|
22643
|
+
//
|
|
22644
|
+
// Optional so an older backend, and an older on-disk cache, still parses;
|
|
22645
|
+
// absent leaves the device's own setting in force, which is the behaviour
|
|
22646
|
+
// that predates the field and the safe direction to default.
|
|
22647
|
+
redactFallback: RedactFallback.optional(),
|
|
22457
22648
|
customKeywords: external_exports.array(external_exports.string()),
|
|
22458
22649
|
fetchedAt: external_exports.iso.datetime()
|
|
22459
22650
|
}).meta({ id: "PolicyBundle" });
|
|
@@ -22483,11 +22674,6 @@ function severityFloorPolicy(category) {
|
|
|
22483
22674
|
const peak = CATEGORY_PEAK_SEVERITY[category];
|
|
22484
22675
|
return peak === "critical" || peak === "high" ? "warn" : "monitor";
|
|
22485
22676
|
}
|
|
22486
|
-
var KNOWN_BUILTIN_IDS = ["monitor", "warn", "redact", "vault", "block"];
|
|
22487
|
-
var BuiltinPolicyId = external_exports.enum(KNOWN_BUILTIN_IDS).meta({ id: "BuiltinPolicyId" });
|
|
22488
|
-
var RedactFallback = BuiltinPolicyId.extract(["monitor", "warn", "block"]).meta({
|
|
22489
|
-
id: "RedactFallback"
|
|
22490
|
-
});
|
|
22491
22677
|
var BUILTIN_POLICY_SPECS = {
|
|
22492
22678
|
monitor: {
|
|
22493
22679
|
name: "Monitor",
|
|
@@ -22750,7 +22936,7 @@ var VaultConsent = external_exports.object({
|
|
|
22750
22936
|
});
|
|
22751
22937
|
|
|
22752
22938
|
// ../../packages/schema/src/zod/local.ts
|
|
22753
|
-
var WORKSPACE_SETTINGS_SPEC_VERSION =
|
|
22939
|
+
var WORKSPACE_SETTINGS_SPEC_VERSION = 8;
|
|
22754
22940
|
var MODEL_JUDGE_PAYLOAD_VERSION = 1;
|
|
22755
22941
|
var RunMode = external_exports.enum(["standalone", "attached"]);
|
|
22756
22942
|
var ControlPlaneConnection = external_exports.object({
|
|
@@ -22770,6 +22956,27 @@ var HistorySyncConsent = external_exports.object({
|
|
|
22770
22956
|
payloadVersion: external_exports.number().int().positive(),
|
|
22771
22957
|
endpoint: external_exports.string()
|
|
22772
22958
|
});
|
|
22959
|
+
var WebChatCaptureConsent = external_exports.object({
|
|
22960
|
+
acknowledgedAt: external_exports.iso.datetime(),
|
|
22961
|
+
version: external_exports.number().int().positive()
|
|
22962
|
+
});
|
|
22963
|
+
var WebChatResponseCapture = external_exports.enum(["with-findings", "always", "never"]);
|
|
22964
|
+
var WebChatCapture = external_exports.object({
|
|
22965
|
+
responses: WebChatResponseCapture.default("with-findings"),
|
|
22966
|
+
account: external_exports.boolean().default(false),
|
|
22967
|
+
// Absent until granted. Presence alone does not authorize anything — see
|
|
22968
|
+
// isWebChatCaptureConsentValid.
|
|
22969
|
+
consent: WebChatCaptureConsent.optional()
|
|
22970
|
+
});
|
|
22971
|
+
var BODY_RETENTION_DEFAULT_DAYS = 30;
|
|
22972
|
+
var BodyRetention = external_exports.object({
|
|
22973
|
+
enabled: external_exports.boolean().default(false),
|
|
22974
|
+
// Never 0, and the ceiling is a fat-finger guard rather than a policy
|
|
22975
|
+
// limit — `enabled` is the real gate. A low value cannot reach a row the
|
|
22976
|
+
// sync ledger still owes: the sweep's age filter only ever NARROWS a
|
|
22977
|
+
// candidate set that is already bounded by "delivered, or never owed".
|
|
22978
|
+
retainDays: external_exports.number().int().min(1).max(3650).default(BODY_RETENTION_DEFAULT_DAYS)
|
|
22979
|
+
}).meta({ id: "BodyRetention" });
|
|
22773
22980
|
var WorkspaceSettings = external_exports.object({
|
|
22774
22981
|
specVersion: external_exports.number().int().positive().default(WORKSPACE_SETTINGS_SPEC_VERSION),
|
|
22775
22982
|
runMode: RunMode.default("standalone"),
|
|
@@ -22818,7 +23025,23 @@ var WorkspaceSettings = external_exports.object({
|
|
|
22818
23025
|
// carry prompt/reply/tool-output text in `content`; the key name predates
|
|
22819
23026
|
// both widenings. Absent until granted, and a grant for a different endpoint
|
|
22820
23027
|
// or an older payload no longer counts.
|
|
22821
|
-
historySyncConsent: HistorySyncConsent.optional()
|
|
23028
|
+
historySyncConsent: HistorySyncConsent.optional(),
|
|
23029
|
+
// What the browser extension may record from a web chat, and the grant that
|
|
23030
|
+
// authorizes it. Absent until the user answers: recording something that was
|
|
23031
|
+
// never recorded before is never an assumed grant on upgrade, so the whole
|
|
23032
|
+
// block is optional rather than defaulted in. What an absent block means is
|
|
23033
|
+
// webChatCaptureOf's answer, in one place.
|
|
23034
|
+
//
|
|
23035
|
+
// Enforcement is NOT gated on this. A machine that has never answered still
|
|
23036
|
+
// blocks, redacts and warns on what a user sends; the grant covers what is
|
|
23037
|
+
// written down.
|
|
23038
|
+
webChatCapture: WebChatCapture.optional(),
|
|
23039
|
+
// Local body expiry (see BodyRetention). Off until switched on; expiring a
|
|
23040
|
+
// body never removes the row or its findings.
|
|
23041
|
+
bodyRetention: BodyRetention.default({
|
|
23042
|
+
enabled: false,
|
|
23043
|
+
retainDays: BODY_RETENTION_DEFAULT_DAYS
|
|
23044
|
+
})
|
|
22822
23045
|
});
|
|
22823
23046
|
function defaultWorkspaceSettings() {
|
|
22824
23047
|
return WorkspaceSettings.parse({});
|
|
@@ -22835,13 +23058,22 @@ var ManagedSettingKey = external_exports.enum([
|
|
|
22835
23058
|
"vaultInlineReveal",
|
|
22836
23059
|
"modelJudgeConsent",
|
|
22837
23060
|
"dataSharesInPlace",
|
|
22838
|
-
"redactFallback"
|
|
23061
|
+
"redactFallback",
|
|
23062
|
+
// Pins the toggle and the day count together — see BodyRetention on why the
|
|
23063
|
+
// two are one unit. An administrator mandating a window wants the count
|
|
23064
|
+
// enforced with it, not one a user can widen while the toggle stays on.
|
|
23065
|
+
"bodyRetention"
|
|
22839
23066
|
]).meta({ id: "ManagedSettingKey" });
|
|
22840
23067
|
function isManagedSettingKey(value) {
|
|
22841
23068
|
return ManagedSettingKey.safeParse(value).success;
|
|
22842
23069
|
}
|
|
22843
23070
|
var ManagedSettingsValues = external_exports.object({
|
|
22844
23071
|
runMode: external_exports.enum(["standalone", "attached"]).optional(),
|
|
23072
|
+
// `controlPlane` and `bodyRetention` are the two nested values, and both are
|
|
23073
|
+
// plain, non-strict objects: a key under either that this build does not know
|
|
23074
|
+
// is stripped and nothing reports it. The unknown-value split in
|
|
23075
|
+
// ManagedSettings below classifies top-level names only, so it stops at
|
|
23076
|
+
// these boundaries.
|
|
22845
23077
|
controlPlane: external_exports.object({
|
|
22846
23078
|
endpoint: external_exports.string().min(1),
|
|
22847
23079
|
label: external_exports.string().min(1).optional()
|
|
@@ -22852,7 +23084,8 @@ var ManagedSettingsValues = external_exports.object({
|
|
|
22852
23084
|
vaultInlineReveal: external_exports.enum(["masked", "full", "off"]).optional(),
|
|
22853
23085
|
modelJudgeConsent: external_exports.boolean().optional(),
|
|
22854
23086
|
dataSharesInPlace: external_exports.boolean().optional(),
|
|
22855
|
-
redactFallback: RedactFallback.optional()
|
|
23087
|
+
redactFallback: RedactFallback.optional(),
|
|
23088
|
+
bodyRetention: BodyRetention.optional()
|
|
22856
23089
|
}).meta({ id: "ManagedSettingsValues" });
|
|
22857
23090
|
var ManagedSettings = external_exports.object({
|
|
22858
23091
|
specVersion: external_exports.number().int().positive().default(MANAGED_SETTINGS_SPEC_VERSION),
|
|
@@ -22860,7 +23093,21 @@ var ManagedSettings = external_exports.object({
|
|
|
22860
23093
|
// decision from a bug. Absent renders as a generic "your organization".
|
|
22861
23094
|
organization: external_exports.string().min(1).optional(),
|
|
22862
23095
|
// What the administrator pinned.
|
|
22863
|
-
|
|
23096
|
+
//
|
|
23097
|
+
// Parsed as a RECORD rather than as the nested schema, and split below for
|
|
23098
|
+
// the same reason `lockedFields` is parsed as names: a plain `z.object`
|
|
23099
|
+
// drops an unrecognised key and succeeds, so a pin this build does not know
|
|
23100
|
+
// vanished and nothing anywhere said so. A pin with no lock is a supported
|
|
23101
|
+
// shape — it is a DEFAULT the user may still change — so that silence hit
|
|
23102
|
+
// exactly the file an administrator is most likely to write while a fleet
|
|
23103
|
+
// is mid-upgrade.
|
|
23104
|
+
//
|
|
23105
|
+
// Splitting here rather than calling `.strict()`: strict would REFUSE the
|
|
23106
|
+
// file, which is the outcome the lock half already rejected — an older
|
|
23107
|
+
// build then runs entirely unmanaged, every pin and lock gone. A bad KNOWN
|
|
23108
|
+
// value still fails, because the nested schema is re-run over the known
|
|
23109
|
+
// subset and its issues are re-raised on this parse.
|
|
23110
|
+
values: external_exports.record(external_exports.string(), external_exports.unknown()).default({}),
|
|
22864
23111
|
// Which of those the user may not change. A key here with no matching value
|
|
22865
23112
|
// freezes whatever the user last chose; a value with no lock is a DEFAULT
|
|
22866
23113
|
// the user may still override. The two are separable on purpose.
|
|
@@ -22873,17 +23120,31 @@ var ManagedSettings = external_exports.object({
|
|
|
22873
23120
|
// the fleets most likely to carry a version skew. A name outside the enum
|
|
22874
23121
|
// is still never HONOURED: the lockable set stays explicit above.
|
|
22875
23122
|
lockedFields: external_exports.array(external_exports.string()).default([])
|
|
22876
|
-
}).transform(({ lockedFields, ...rest }) => {
|
|
23123
|
+
}).transform(({ lockedFields, values, ...rest }, ctx) => {
|
|
22877
23124
|
const known = [];
|
|
22878
23125
|
const unknown2 = [];
|
|
22879
23126
|
for (const name of lockedFields) {
|
|
22880
23127
|
if (isManagedSettingKey(name)) known.push(name);
|
|
22881
23128
|
else unknown2.push(name);
|
|
22882
23129
|
}
|
|
23130
|
+
const knownValues = /* @__PURE__ */ Object.create(null);
|
|
23131
|
+
const unknownValues = [];
|
|
23132
|
+
for (const [name, value] of Object.entries(values)) {
|
|
23133
|
+
if (Object.hasOwn(ManagedSettingsValues.shape, name)) knownValues[name] = value;
|
|
23134
|
+
else unknownValues.push(name);
|
|
23135
|
+
}
|
|
23136
|
+
const pinned = ManagedSettingsValues.safeParse(knownValues);
|
|
23137
|
+
if (!pinned.success) {
|
|
23138
|
+
for (const issue2 of pinned.error.issues)
|
|
23139
|
+
ctx.addIssue({ ...issue2, path: ["values", ...issue2.path] });
|
|
23140
|
+
return external_exports.NEVER;
|
|
23141
|
+
}
|
|
22883
23142
|
return {
|
|
22884
23143
|
...rest,
|
|
23144
|
+
values: pinned.data,
|
|
22885
23145
|
lockedFields: known,
|
|
22886
|
-
...unknown2.length > 0 ? { unknownLockedFields: unknown2 } : {}
|
|
23146
|
+
...unknown2.length > 0 ? { unknownLockedFields: unknown2 } : {},
|
|
23147
|
+
...unknownValues.length > 0 ? { unknownValueFields: unknownValues } : {}
|
|
22887
23148
|
};
|
|
22888
23149
|
}).meta({ id: "ManagedSettings" });
|
|
22889
23150
|
|
|
@@ -23136,12 +23397,30 @@ var RecommendedActionIdParam = external_exports.object({ id: external_exports.st
|
|
|
23136
23397
|
// ../../packages/schema/src/zod/settings-action.ts
|
|
23137
23398
|
var HistorySyncConsentChoice = external_exports.enum(["granted", "revoked", "unchanged"]).meta({ id: "HistorySyncConsentChoice" });
|
|
23138
23399
|
var ModelJudgeConsentChoice = external_exports.enum(["granted", "revoked", "unchanged"]).meta({ id: "ModelJudgeConsentChoice" });
|
|
23400
|
+
var WebChatCaptureConsentChoice = external_exports.enum(["granted", "revoked", "unchanged"]).meta({ id: "WebChatCaptureConsentChoice" });
|
|
23139
23401
|
var SaveSettingsInput = external_exports.object({
|
|
23140
23402
|
historicalAccess: external_exports.string(),
|
|
23141
23403
|
modelJudgeConsent: ModelJudgeConsentChoice,
|
|
23142
23404
|
historySyncConsent: HistorySyncConsentChoice,
|
|
23143
23405
|
vaultConsent: external_exports.string(),
|
|
23144
|
-
vaultInlineReveal: external_exports.string()
|
|
23406
|
+
vaultInlineReveal: external_exports.string(),
|
|
23407
|
+
webChatCaptureConsent: WebChatCaptureConsentChoice,
|
|
23408
|
+
// Widened to `string` like its neighbours rather than typed as
|
|
23409
|
+
// `RedactFallback`, on this module's own layering rule: shape here, VALUE at
|
|
23410
|
+
// the call site, so the domain check receives the type it was written for.
|
|
23411
|
+
//
|
|
23412
|
+
// NOT because a narrower schema would reject differently. `parseActionInput`
|
|
23413
|
+
// is a `safeParse` wrapper and throws for no field schema, so either spelling
|
|
23414
|
+
// reaches a recoverable `{ ok: false }` and there is no rejected promise to
|
|
23415
|
+
// trade against. The real cost runs the other way and is the part worth
|
|
23416
|
+
// knowing: a value this schema admits and the domain enum then rejects lands
|
|
23417
|
+
// on the action's shared refusal, which names NO field, where a shape
|
|
23418
|
+
// rejection reaches `malformedInput` and names the schema key.
|
|
23419
|
+
redactFallback: external_exports.string(),
|
|
23420
|
+
// Shape only, the way the enum fields above are strings only: the RANGE is
|
|
23421
|
+
// `BodyRetention`'s and the action checks it there, so there is one place
|
|
23422
|
+
// that decides what a legal horizon is rather than two that can drift.
|
|
23423
|
+
bodyRetention: external_exports.object({ enabled: external_exports.boolean(), retainDays: external_exports.number() })
|
|
23145
23424
|
});
|
|
23146
23425
|
var AttachInput = external_exports.object({
|
|
23147
23426
|
endpoint: external_exports.string(),
|
|
@@ -23267,6 +23546,96 @@ var SetupHandoffOffer = external_exports.object({
|
|
|
23267
23546
|
path: ["liveKeys"]
|
|
23268
23547
|
});
|
|
23269
23548
|
|
|
23549
|
+
// ../../packages/schema/src/zod/web-capture.ts
|
|
23550
|
+
var WebUsageSource = external_exports.enum(["site", "estimated", "none"]);
|
|
23551
|
+
var WebUsage = external_exports.object({
|
|
23552
|
+
inputTokens: external_exports.number().int().nonnegative().optional(),
|
|
23553
|
+
outputTokens: external_exports.number().int().nonnegative().optional(),
|
|
23554
|
+
cacheReadInputTokens: external_exports.number().int().nonnegative().optional(),
|
|
23555
|
+
cacheCreationInputTokens: external_exports.number().int().nonnegative().optional()
|
|
23556
|
+
});
|
|
23557
|
+
var WebToolCall = external_exports.object({
|
|
23558
|
+
toolUseId: external_exports.string().min(1),
|
|
23559
|
+
toolName: external_exports.string().min(1),
|
|
23560
|
+
target: external_exports.string().optional(),
|
|
23561
|
+
isError: external_exports.boolean().optional(),
|
|
23562
|
+
inputSize: external_exports.number().int().nonnegative().optional(),
|
|
23563
|
+
outputSize: external_exports.number().int().nonnegative().optional()
|
|
23564
|
+
});
|
|
23565
|
+
var WebExchange = external_exports.object({
|
|
23566
|
+
messageId: external_exports.string().min(1),
|
|
23567
|
+
startedAt: external_exports.iso.datetime(),
|
|
23568
|
+
model: external_exports.string().optional(),
|
|
23569
|
+
usage: WebUsage.optional(),
|
|
23570
|
+
usageSource: WebUsageSource,
|
|
23571
|
+
stopReason: external_exports.string().optional(),
|
|
23572
|
+
conversationId: external_exports.string().optional(),
|
|
23573
|
+
turnIndex: external_exports.number().int().nonnegative().optional(),
|
|
23574
|
+
toolCalls: external_exports.array(WebToolCall).default([]),
|
|
23575
|
+
// Absent when the adapter recovered no text. Capped by the caller at
|
|
23576
|
+
// RESPONSE_TEXT_MAX_BYTES, so a short capture is never mistaken for a short
|
|
23577
|
+
// reply.
|
|
23578
|
+
responseText: external_exports.string().optional(),
|
|
23579
|
+
// The stored text is short of the reply. It does NOT say which of the two
|
|
23580
|
+
// ceilings on this path cut it: the caller applies its own cap on the raw
|
|
23581
|
+
// bytes it reads off the wire, which can be reached by a stream whose
|
|
23582
|
+
// recovered text stays well under RESPONSE_TEXT_MAX_BYTES, and applies that
|
|
23583
|
+
// one to the text. A reader cannot tell them apart, and nothing downstream
|
|
23584
|
+
// should branch as though it could.
|
|
23585
|
+
truncated: external_exports.boolean().default(false)
|
|
23586
|
+
});
|
|
23587
|
+
var WebEnforcementState = external_exports.enum([
|
|
23588
|
+
"watching",
|
|
23589
|
+
"composer-only",
|
|
23590
|
+
"button-only",
|
|
23591
|
+
"unattached",
|
|
23592
|
+
"unknown"
|
|
23593
|
+
]);
|
|
23594
|
+
var RESPONSE_TEXT_MAX_BYTES = 2 * 1024 * 1024;
|
|
23595
|
+
var WebCaptureStatus = external_exports.object({
|
|
23596
|
+
patched: external_exports.boolean(),
|
|
23597
|
+
live: external_exports.boolean(),
|
|
23598
|
+
blind: external_exports.boolean(),
|
|
23599
|
+
sendsSeenDom: external_exports.number().int().nonnegative(),
|
|
23600
|
+
exchangesSeenNet: external_exports.number().int().nonnegative(),
|
|
23601
|
+
parseFailures: external_exports.number().int().nonnegative(),
|
|
23602
|
+
unparsedBodies: external_exports.number().int().nonnegative(),
|
|
23603
|
+
// The adapter-declared JSON key paths that were absent from a real payload —
|
|
23604
|
+
// the earliest signal that a site's contract moved.
|
|
23605
|
+
shapeMisses: external_exports.array(external_exports.string()).default([]),
|
|
23606
|
+
// How many `kind: 'conversation'` endpoints the reporting tab's adapter
|
|
23607
|
+
// compiled. Zero means this build declares none for the site, so observing
|
|
23608
|
+
// nothing is the design rather than a fault — the one fact that separates a
|
|
23609
|
+
// site nobody has surveyed yet from one whose contract moved. Defaulted so a
|
|
23610
|
+
// build predating the field is read as declaring nothing rather than refused.
|
|
23611
|
+
conversationEndpoints: external_exports.number().int().nonnegative().default(0),
|
|
23612
|
+
// The document that sent this report is going away. The bridge sets it on
|
|
23613
|
+
// its `pagehide` report and nowhere else.
|
|
23614
|
+
//
|
|
23615
|
+
// A property of the REPORT rather than of capture health, which is why
|
|
23616
|
+
// nothing in `deriveWebCaptureState` reads it and why it stays out of the
|
|
23617
|
+
// bridge's own report signature — a closing tab's last word must not be
|
|
23618
|
+
// suppressed for carrying the same health as the report before it. What
|
|
23619
|
+
// reads it is the per-site fold: a document that said it was unloading stops
|
|
23620
|
+
// voting on the site's state, so the reload the `blind` remediation asks for
|
|
23621
|
+
// can actually clear the verdict it was shown. A document that dies without
|
|
23622
|
+
// sending one is covered by CAPTURE_STATUS_DOCUMENT_QUIET_MS instead.
|
|
23623
|
+
//
|
|
23624
|
+
// Defaulted so a build predating the field reads as a document that never
|
|
23625
|
+
// said it was closing — which keeps it voting, the same as every report that
|
|
23626
|
+
// is not a final one.
|
|
23627
|
+
closed: external_exports.boolean().default(false),
|
|
23628
|
+
// What the DOM enforcement path is doing, which none of the counters above
|
|
23629
|
+
// can say: `sendsSeenDom` rises only once a send has COMPLETED, so a tab
|
|
23630
|
+
// whose watcher never bound reports zero exactly like a tab nobody typed in.
|
|
23631
|
+
// Defaulted to 'unknown' rather than 'watching' so a status from a build
|
|
23632
|
+
// predating the field is not read as reporting a healthy one.
|
|
23633
|
+
enforcement: WebEnforcementState.default("unknown")
|
|
23634
|
+
});
|
|
23635
|
+
var CAPTURE_STATUS_RECENCY_MS = 30 * 24 * 60 * 60 * 1e3;
|
|
23636
|
+
var CAPTURE_STATUS_RECENCY_DAYS = CAPTURE_STATUS_RECENCY_MS / (24 * 60 * 60 * 1e3);
|
|
23637
|
+
var CAPTURE_STATUS_DOCUMENT_QUIET_MS = 12 * 60 * 60 * 1e3;
|
|
23638
|
+
|
|
23270
23639
|
// ../../packages/persistence/src/paths.ts
|
|
23271
23640
|
import {
|
|
23272
23641
|
chmodSync,
|
|
@@ -23344,6 +23713,32 @@ var STALE_PARTIAL_MS = 5 * 6e4;
|
|
|
23344
23713
|
var SNAPSHOT_STAGING_SUFFIX = ".partial";
|
|
23345
23714
|
var STAGED_NAME_SUFFIX = `.bak${SNAPSHOT_STAGING_SUFFIX}`;
|
|
23346
23715
|
|
|
23716
|
+
// ../../packages/persistence/src/internal/sql-functions.ts
|
|
23717
|
+
var utf8 = new TextDecoder();
|
|
23718
|
+
|
|
23719
|
+
// ../../packages/persistence/src/internal/outbox-lane.ts
|
|
23720
|
+
var OUTBOX_CAPTURE_EVENT_TYPES = ["prompt", "response", "tool_use"];
|
|
23721
|
+
var OUTBOX_CAPTURE_TYPE_LIST = OUTBOX_CAPTURE_EVENT_TYPES.map((t) => `'${t}'`).join(", ");
|
|
23722
|
+
|
|
23723
|
+
// ../../packages/persistence/src/sync-failure.ts
|
|
23724
|
+
var SYNC_FAILURE_REASONS = SyncFailureReason.options;
|
|
23725
|
+
|
|
23726
|
+
// ../../packages/persistence/src/repositories/history-sync.ts
|
|
23727
|
+
var STRUCTURAL_EVENT_TYPES = ["session", "llm_call", "tool_call"];
|
|
23728
|
+
var TYPE_LIST = STRUCTURAL_EVENT_TYPES.map((t) => `'${t}'`).join(", ");
|
|
23729
|
+
var COUNTED_EVENT_TYPES = [
|
|
23730
|
+
...STRUCTURAL_EVENT_TYPES,
|
|
23731
|
+
...OUTBOX_CAPTURE_EVENT_TYPES
|
|
23732
|
+
];
|
|
23733
|
+
var COUNTED_TYPE_LIST = COUNTED_EVENT_TYPES.map((t) => `'${t}'`).join(", ");
|
|
23734
|
+
var COUNTED_SCOPE = `
|
|
23735
|
+
WHERE event_type IN (${COUNTED_TYPE_LIST})
|
|
23736
|
+
AND (
|
|
23737
|
+
event_type IN (${TYPE_LIST})
|
|
23738
|
+
OR synced_at IS NOT NULL
|
|
23739
|
+
OR outbox_owed = 1
|
|
23740
|
+
)`;
|
|
23741
|
+
|
|
23347
23742
|
// ../../packages/persistence/src/internal/json.ts
|
|
23348
23743
|
function parseJsonObject(s) {
|
|
23349
23744
|
if (s == null) return void 0;
|
|
@@ -23408,13 +23803,10 @@ var FINDING_ROW_COLUMNS_SQL = `f.id AS id, d.rule_id AS rule_id, d.category AS c
|
|
|
23408
23803
|
e.tool_name AS tool_name,
|
|
23409
23804
|
f.audit_event_id AS event_id, e.root_session_id AS session_id,
|
|
23410
23805
|
e.event_type AS kind, f.finding_key AS finding_key,
|
|
23411
|
-
${latestResolutionStatusSql("f")} AS latest_status
|
|
23412
|
-
|
|
23413
|
-
|
|
23414
|
-
|
|
23415
|
-
var TYPE_LIST = STRUCTURAL_EVENT_TYPES.map((t) => `'${t}'`).join(", ");
|
|
23416
|
-
var OUTBOX_CAPTURE_EVENT_TYPES = ["prompt", "response", "tool_use"];
|
|
23417
|
-
var CAPTURE_TYPE_LIST = OUTBOX_CAPTURE_EVENT_TYPES.map((t) => `'${t}'`).join(", ");
|
|
23806
|
+
${latestResolutionStatusSql("f")} AS latest_status,
|
|
23807
|
+
e.synced_at AS synced_at, e.sync_claimed_at AS sync_claimed_at,
|
|
23808
|
+
e.sync_failed_at AS sync_failed_at, e.sync_failure AS sync_failure,
|
|
23809
|
+
e.outbox_owed AS outbox_owed`;
|
|
23418
23810
|
|
|
23419
23811
|
// ../../packages/persistence/src/repositories/installed-packs.ts
|
|
23420
23812
|
import { createHash as createHash2, randomUUID as randomUUID4 } from "crypto";
|
|
@@ -23531,6 +23923,7 @@ function overlayManagedSettings(settings, managed, now = () => /* @__PURE__ */ n
|
|
|
23531
23923
|
if (values.vaultInlineReveal !== void 0) merged.vaultInlineReveal = values.vaultInlineReveal;
|
|
23532
23924
|
if (values.dataSharesInPlace !== void 0) merged.dataSharesInPlace = values.dataSharesInPlace;
|
|
23533
23925
|
if (values.redactFallback !== void 0) merged.redactFallback = values.redactFallback;
|
|
23926
|
+
if (values.bodyRetention !== void 0) merged.bodyRetention = values.bodyRetention;
|
|
23534
23927
|
if (values.vaultConsent !== void 0) {
|
|
23535
23928
|
merged.vaultConsent = values.vaultConsent ? (
|
|
23536
23929
|
// Keep an existing valid grant so its acknowledgedAt survives; mint one
|
|
@@ -23660,9 +24053,11 @@ import { randomUUID as randomUUID10 } from "crypto";
|
|
|
23660
24053
|
|
|
23661
24054
|
// ../../packages/persistence/src/database.ts
|
|
23662
24055
|
var CAPTURE_GRAIN = new Set(EventKind.options);
|
|
24056
|
+
var DEFERRED_TAGS = new Set(DEFERRED_MIGRATION_TAGS);
|
|
23663
24057
|
|
|
23664
24058
|
// ../../packages/persistence/src/egress-wire.ts
|
|
23665
24059
|
import { createHash as createHash3 } from "crypto";
|
|
24060
|
+
var SLASH = "/".charCodeAt(0);
|
|
23666
24061
|
|
|
23667
24062
|
// ../../packages/persistence/src/finding-key.ts
|
|
23668
24063
|
import { createHash as createHash4 } from "crypto";
|
|
@@ -23673,18 +24068,26 @@ import { existsSync as existsSync3, readFileSync as readFileSync6 } from "fs";
|
|
|
23673
24068
|
import { join as join8 } from "path";
|
|
23674
24069
|
import { DatabaseSync as DatabaseSync2 } from "node:sqlite";
|
|
23675
24070
|
|
|
24071
|
+
// ../../packages/persistence/src/forward-health.ts
|
|
24072
|
+
import { readFileSync as readFileSync7 } from "fs";
|
|
24073
|
+
import { join as join9 } from "path";
|
|
24074
|
+
|
|
23676
24075
|
// ../../packages/persistence/src/history-backfill.ts
|
|
23677
24076
|
import { existsSync as existsSync4 } from "fs";
|
|
23678
|
-
import { join as
|
|
24077
|
+
import { join as join10 } from "path";
|
|
23679
24078
|
|
|
23680
24079
|
// ../../packages/persistence/src/history-preview.ts
|
|
23681
24080
|
import { existsSync as existsSync5 } from "fs";
|
|
23682
|
-
import { join as
|
|
24081
|
+
import { join as join11 } from "path";
|
|
23683
24082
|
import { DatabaseSync as DatabaseSync3 } from "node:sqlite";
|
|
23684
24083
|
|
|
24084
|
+
// ../../packages/persistence/src/history-sync-state.ts
|
|
24085
|
+
import { readFileSync as readFileSync8 } from "fs";
|
|
24086
|
+
import { join as join12 } from "path";
|
|
24087
|
+
|
|
23685
24088
|
// ../../packages/persistence/src/store-symlinks.ts
|
|
23686
24089
|
import { existsSync as existsSync6, lstatSync as lstatSync3, readlinkSync, realpathSync, statSync as statSync4 } from "fs";
|
|
23687
|
-
import { dirname as dirname3, join as
|
|
24090
|
+
import { dirname as dirname3, join as join13, resolve } from "path";
|
|
23688
24091
|
var STORE_DB = "the store database (including the prompt corpus)";
|
|
23689
24092
|
var STORE_SETTINGS = "your settings file";
|
|
23690
24093
|
function storeContents(home) {
|
|
@@ -23693,7 +24096,7 @@ function storeContents(home) {
|
|
|
23693
24096
|
[settingsDir(home), STORE_SETTINGS],
|
|
23694
24097
|
[dataDir(home), STORE_DB],
|
|
23695
24098
|
[keysDir(home), "the vault key"],
|
|
23696
|
-
[
|
|
24099
|
+
[join13(settingsDir(home), "settings.json"), STORE_SETTINGS],
|
|
23697
24100
|
[dbPath(home), STORE_DB]
|
|
23698
24101
|
]);
|
|
23699
24102
|
}
|
|
@@ -23745,15 +24148,15 @@ import {
|
|
|
23745
24148
|
// ../../packages/persistence/src/vault/key-provider.ts
|
|
23746
24149
|
import { execFileSync } from "child_process";
|
|
23747
24150
|
import { randomBytes as randomBytes2 } from "crypto";
|
|
23748
|
-
import { chmodSync as chmodSync3, readFileSync as
|
|
23749
|
-
import { join as
|
|
24151
|
+
import { chmodSync as chmodSync3, readFileSync as readFileSync9, renameSync as renameSync4, rmSync as rmSync6, statSync as statSync5, writeFileSync as writeFileSync3 } from "fs";
|
|
24152
|
+
import { join as join14 } from "path";
|
|
23750
24153
|
|
|
23751
24154
|
// ../../packages/persistence/src/vault/vault.ts
|
|
23752
24155
|
import { randomBytes as randomBytes3, randomUUID as randomUUID12 } from "crypto";
|
|
23753
24156
|
|
|
23754
24157
|
// ../../packages/persistence/src/warn-era-cap.ts
|
|
23755
24158
|
import { existsSync as existsSync7, writeFileSync as writeFileSync4 } from "fs";
|
|
23756
|
-
import { join as
|
|
24159
|
+
import { join as join15 } from "path";
|
|
23757
24160
|
|
|
23758
24161
|
// ../../packages/plugin-sdk/src/provider-env.ts
|
|
23759
24162
|
var DEFAULT_ANTHROPIC_HOST = "api.anthropic.com";
|
|
@@ -23807,7 +24210,7 @@ function resolveProvider() {
|
|
|
23807
24210
|
function loadConfig(base = defaultDataDir(), resolveProviderFn = resolveProvider) {
|
|
23808
24211
|
try {
|
|
23809
24212
|
ensureLayoutDirSync(base);
|
|
23810
|
-
const settingsFile =
|
|
24213
|
+
const settingsFile = join16(settingsDir(base), "settings.json");
|
|
23811
24214
|
if (existsSync8(settingsFile)) tightenFile(settingsFile);
|
|
23812
24215
|
} catch {
|
|
23813
24216
|
}
|
|
@@ -23831,9 +24234,9 @@ function resolveProviderSafe(resolveProviderFn) {
|
|
|
23831
24234
|
}
|
|
23832
24235
|
|
|
23833
24236
|
// ../../packages/plugin-sdk/src/config-inventory.ts
|
|
23834
|
-
import { readdirSync as readdirSync2, readFileSync as
|
|
24237
|
+
import { readdirSync as readdirSync2, readFileSync as readFileSync11, realpathSync as realpathSync2, statSync as statSync7 } from "fs";
|
|
23835
24238
|
import { homedir as homedir2 } from "os";
|
|
23836
|
-
import { basename as basename3, join as
|
|
24239
|
+
import { basename as basename3, join as join18 } from "path";
|
|
23837
24240
|
|
|
23838
24241
|
// ../../packages/detections/src/egress/registry.ts
|
|
23839
24242
|
var EXTRACTOR_VERSION = "1";
|
|
@@ -24562,6 +24965,56 @@ var CONFIG_POSTURE_RULES = [
|
|
|
24562
24965
|
}
|
|
24563
24966
|
];
|
|
24564
24967
|
|
|
24968
|
+
// ../../packages/detections/src/posture/web-capture-posture.ts
|
|
24969
|
+
var RULE_VERSION2 = "1";
|
|
24970
|
+
var DRIFT_MIN_PARSE_FAILURES = 2;
|
|
24971
|
+
var WEB_CAPTURE_DRIFT_STATES = /* @__PURE__ */ new Set([
|
|
24972
|
+
"blind",
|
|
24973
|
+
"degraded"
|
|
24974
|
+
]);
|
|
24975
|
+
var WEB_CAPTURE_DRIFT_RULE = {
|
|
24976
|
+
ruleId: "web-capture-drift",
|
|
24977
|
+
version: RULE_VERSION2,
|
|
24978
|
+
name: "Web chat capture is not reading the site",
|
|
24979
|
+
category: "config",
|
|
24980
|
+
severity: "medium",
|
|
24981
|
+
definition: JSON.stringify({
|
|
24982
|
+
kind: "web-capture-drift",
|
|
24983
|
+
states: [...WEB_CAPTURE_DRIFT_STATES],
|
|
24984
|
+
minParseFailures: DRIFT_MIN_PARSE_FAILURES
|
|
24985
|
+
})
|
|
24986
|
+
};
|
|
24987
|
+
var STATIC_COPY = {
|
|
24988
|
+
active: { headline: "turns are being observed on this site" },
|
|
24989
|
+
unreported: {
|
|
24990
|
+
// Says "recently" rather than "yet": the store read is bounded to
|
|
24991
|
+
// CAPTURE_STATUS_RECENCY_MS, so this state covers a site nothing has ever
|
|
24992
|
+
// reported for AND one whose last report has aged out. The two are the
|
|
24993
|
+
// same fact to a reader — nobody has confirmed anything lately — and the
|
|
24994
|
+
// copy may not claim the stronger of them.
|
|
24995
|
+
headline: `no report in the last ${String(CAPTURE_STATUS_RECENCY_DAYS)} days \u2014 open the site in Chrome with the extension loaded`
|
|
24996
|
+
},
|
|
24997
|
+
standby: {
|
|
24998
|
+
headline: "this build declares no endpoints for the site, so nothing is observed yet"
|
|
24999
|
+
},
|
|
25000
|
+
unpatched: {
|
|
25001
|
+
// Says what the flags say and no more. `patched` is false both for a tap
|
|
25002
|
+
// that installed and hooked neither transport and for one that never ran
|
|
25003
|
+
// at all — a page reports the same status either way, so the copy may not
|
|
25004
|
+
// assert one of them.
|
|
25005
|
+
headline: "the page tap captured neither fetch nor XHR \u2014 it may not have installed; reload the extension at chrome://extensions"
|
|
25006
|
+
},
|
|
25007
|
+
idle: { headline: "watching; no turn has been observed yet" },
|
|
25008
|
+
blind: {
|
|
25009
|
+
headline: "messages were sent in the page that the network capture never saw",
|
|
25010
|
+
remediation: "reload the tab. If it persists after `aka update` and reloading the extension at chrome://extensions, the site's send path has changed and needs a new extension build."
|
|
25011
|
+
},
|
|
25012
|
+
degraded: {
|
|
25013
|
+
headline: "the site's payloads no longer carry the fields the extension reads",
|
|
25014
|
+
remediation: "run `aka update`, then reload the extension at chrome://extensions. If it stays degraded after an update, the site's contract has changed and needs a new extension build."
|
|
25015
|
+
}
|
|
25016
|
+
};
|
|
25017
|
+
|
|
24565
25018
|
// ../../packages/detections/src/security/redos-probe.ts
|
|
24566
25019
|
var BUDGET_MS = 100;
|
|
24567
25020
|
var EXPONENTIAL_UNITS = [
|
|
@@ -24591,8 +25044,8 @@ var CPU_CORROBORATION_SHARE = 0.2;
|
|
|
24591
25044
|
var CORROBORATION_FLOOR_MS = BUDGET_MS * CPU_CORROBORATION_SHARE;
|
|
24592
25045
|
|
|
24593
25046
|
// ../../packages/plugin-sdk/src/repo.ts
|
|
24594
|
-
import { existsSync as existsSync9, readFileSync as
|
|
24595
|
-
import { basename as basename2, dirname as dirname4, isAbsolute, join as
|
|
25047
|
+
import { existsSync as existsSync9, readFileSync as readFileSync10, statSync as statSync6 } from "fs";
|
|
25048
|
+
import { basename as basename2, dirname as dirname4, isAbsolute, join as join17, sep as sep2 } from "path";
|
|
24596
25049
|
|
|
24597
25050
|
// ../../packages/plugin-sdk/src/events.ts
|
|
24598
25051
|
import { createHash as createHash5, randomUUID as randomUUID13 } from "crypto";
|
|
@@ -24603,8 +25056,8 @@ import { fileURLToPath } from "url";
|
|
|
24603
25056
|
import { Worker } from "worker_threads";
|
|
24604
25057
|
|
|
24605
25058
|
// ../../packages/plugin-sdk/src/host-floor.ts
|
|
24606
|
-
import { readFileSync as
|
|
24607
|
-
import { join as
|
|
25059
|
+
import { readFileSync as readFileSync13 } from "fs";
|
|
25060
|
+
import { join as join20 } from "path";
|
|
24608
25061
|
|
|
24609
25062
|
// ../../packages/plugin-sdk/src/model-governance.ts
|
|
24610
25063
|
import {
|
|
@@ -24612,17 +25065,17 @@ import {
|
|
|
24612
25065
|
fstatSync,
|
|
24613
25066
|
mkdirSync as mkdirSync2,
|
|
24614
25067
|
openSync as openSync2,
|
|
24615
|
-
readFileSync as
|
|
25068
|
+
readFileSync as readFileSync12,
|
|
24616
25069
|
readSync,
|
|
24617
25070
|
writeFileSync as writeFileSync5
|
|
24618
25071
|
} from "fs";
|
|
24619
|
-
import { join as
|
|
25072
|
+
import { join as join19 } from "path";
|
|
24620
25073
|
var TAIL_BYTES = 256 * 1024;
|
|
24621
25074
|
function readTail(path) {
|
|
24622
25075
|
const fd = openSync2(path, "r");
|
|
24623
25076
|
try {
|
|
24624
25077
|
const { size } = fstatSync(fd);
|
|
24625
|
-
if (size <= TAIL_BYTES) return { text:
|
|
25078
|
+
if (size <= TAIL_BYTES) return { text: readFileSync12(fd, "utf8"), truncated: false };
|
|
24626
25079
|
const buffer = Buffer.allocUnsafe(TAIL_BYTES);
|
|
24627
25080
|
let filled = 0;
|
|
24628
25081
|
while (filled < TAIL_BYTES) {
|
|
@@ -24716,13 +25169,13 @@ function recordHostVersion(dataDir2, version2) {
|
|
|
24716
25169
|
if (current !== null && compareBinaryVersions(version2, current.version) <= 0) return;
|
|
24717
25170
|
const cache = { version: version2, observedAt: Date.now() };
|
|
24718
25171
|
ensureDataDirSync(dataDir2);
|
|
24719
|
-
writeOwnerOnlyFileSync(
|
|
25172
|
+
writeOwnerOnlyFileSync(join20(dataDir2, HOST_VERSION_MARKER), JSON.stringify(cache));
|
|
24720
25173
|
} catch {
|
|
24721
25174
|
}
|
|
24722
25175
|
}
|
|
24723
25176
|
function readHostVersionCache(dataDir2) {
|
|
24724
25177
|
try {
|
|
24725
|
-
const parsed = JSON.parse(
|
|
25178
|
+
const parsed = JSON.parse(readFileSync13(join20(dataDir2, HOST_VERSION_MARKER), "utf8"));
|
|
24726
25179
|
if (typeof parsed !== "object" || parsed === null) return null;
|
|
24727
25180
|
const { version: version2, observedAt } = parsed;
|
|
24728
25181
|
if (typeof version2 !== "string" || !isParseableBinaryVersion(version2)) return null;
|
|
@@ -24735,15 +25188,15 @@ function readHostVersionCache(dataDir2) {
|
|
|
24735
25188
|
|
|
24736
25189
|
// ../../packages/plugin-sdk/src/ignore-layers.ts
|
|
24737
25190
|
var import_ignore = __toESM(require_ignore(), 1);
|
|
24738
|
-
import { readFileSync as
|
|
24739
|
-
import { join as
|
|
25191
|
+
import { readFileSync as readFileSync14 } from "fs";
|
|
25192
|
+
import { join as join21 } from "path";
|
|
24740
25193
|
|
|
24741
25194
|
// ../../packages/plugin-sdk/src/inventory-resolver.ts
|
|
24742
25195
|
import { arch, hostname as hostname4, platform, release } from "os";
|
|
24743
25196
|
|
|
24744
25197
|
// ../../packages/plugin-sdk/src/nudge.ts
|
|
24745
|
-
import { mkdirSync as mkdirSync3, readFileSync as
|
|
24746
|
-
import { join as
|
|
25198
|
+
import { mkdirSync as mkdirSync3, readFileSync as readFileSync15, writeFileSync as writeFileSync6 } from "fs";
|
|
25199
|
+
import { join as join22 } from "path";
|
|
24747
25200
|
|
|
24748
25201
|
// ../../packages/plugin-sdk/src/paths.ts
|
|
24749
25202
|
import { readdirSync as readdirSync3, realpathSync as realpathSync3 } from "fs";
|
|
@@ -24751,7 +25204,7 @@ import { basename as basename4, dirname as dirname5, sep as sep3 } from "path";
|
|
|
24751
25204
|
|
|
24752
25205
|
// ../../packages/plugin-sdk/src/project-files.ts
|
|
24753
25206
|
import { existsSync as existsSync11, readdirSync as readdirSync4 } from "fs";
|
|
24754
|
-
import { basename as basename5, join as
|
|
25207
|
+
import { basename as basename5, join as join23 } from "path";
|
|
24755
25208
|
|
|
24756
25209
|
// ../../packages/plugin-sdk/src/provider-env-antigravity.ts
|
|
24757
25210
|
var optionalBaseUrl2 = external_exports.preprocess((v) => {
|
|
@@ -24787,9 +25240,9 @@ var THIRTY_DAYS_MS = 30 * 24 * 60 * 60 * 1e3;
|
|
|
24787
25240
|
|
|
24788
25241
|
// ../../packages/plugin-sdk/src/throttle.ts
|
|
24789
25242
|
import { mkdirSync as mkdirSync4, statSync as statSync8, writeFileSync as writeFileSync7 } from "fs";
|
|
24790
|
-
import { join as
|
|
25243
|
+
import { join as join24 } from "path";
|
|
24791
25244
|
function throttled(dataDir2, markerName, windowMs) {
|
|
24792
|
-
const marker =
|
|
25245
|
+
const marker = join24(dataDir2, markerName);
|
|
24793
25246
|
try {
|
|
24794
25247
|
if (Date.now() - statSync8(marker).mtimeMs < windowMs) return true;
|
|
24795
25248
|
} catch {
|
|
@@ -24804,7 +25257,7 @@ function throttled(dataDir2, markerName, windowMs) {
|
|
|
24804
25257
|
|
|
24805
25258
|
// src/history/reconcile-trigger.ts
|
|
24806
25259
|
import { spawn } from "child_process";
|
|
24807
|
-
import { dirname as dirname6, join as
|
|
25260
|
+
import { dirname as dirname6, join as join26 } from "path";
|
|
24808
25261
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
24809
25262
|
|
|
24810
25263
|
// src/history/tail.ts
|
|
@@ -24814,11 +25267,11 @@ import {
|
|
|
24814
25267
|
fstatSync as fstatSync2,
|
|
24815
25268
|
mkdirSync as mkdirSync5,
|
|
24816
25269
|
openSync as openSync3,
|
|
24817
|
-
readFileSync as
|
|
25270
|
+
readFileSync as readFileSync16,
|
|
24818
25271
|
readSync as readSync2,
|
|
24819
25272
|
writeFileSync as writeFileSync8
|
|
24820
25273
|
} from "fs";
|
|
24821
|
-
import { join as
|
|
25274
|
+
import { join as join25 } from "path";
|
|
24822
25275
|
var SAFE_SESSION_ID = /^[A-Za-z0-9._-]+$/;
|
|
24823
25276
|
function safeSessionId(sessionId) {
|
|
24824
25277
|
if (SAFE_SESSION_ID.test(sessionId) && sessionId !== "." && sessionId !== "..") {
|
|
@@ -24835,7 +25288,7 @@ function triggerReconcile(dataDir2, sessionId, transcriptPath) {
|
|
|
24835
25288
|
const marker = `${RECONCILE_MARKER_PREFIX}-${safeSessionId(sessionId)}`;
|
|
24836
25289
|
if (throttled(dataDir2, marker, RECONCILE_THROTTLE_MS)) return;
|
|
24837
25290
|
const here = dirname6(fileURLToPath2(import.meta.url));
|
|
24838
|
-
const child = spawn(process.execPath, [
|
|
25291
|
+
const child = spawn(process.execPath, [join26(here, "reconcile.js"), sessionId, transcriptPath], {
|
|
24839
25292
|
detached: true,
|
|
24840
25293
|
stdio: "ignore"
|
|
24841
25294
|
});
|
|
@@ -24846,14 +25299,14 @@ function triggerReconcile(dataDir2, sessionId, transcriptPath) {
|
|
|
24846
25299
|
|
|
24847
25300
|
// src/hooks/host-floor-notice.ts
|
|
24848
25301
|
import { mkdirSync as mkdirSync6, readdirSync as readdirSync5, rmSync as rmSync7, statSync as statSync9, writeFileSync as writeFileSync9 } from "fs";
|
|
24849
|
-
import { join as
|
|
25302
|
+
import { join as join27 } from "path";
|
|
24850
25303
|
var CLAIM_DIR = "host-floor-claims";
|
|
24851
25304
|
var CLAIM_TTL_MS = 12 * 60 * 60 * 1e3;
|
|
24852
25305
|
var CLAIM_SWEEP_MS = 7 * 24 * 60 * 60 * 1e3;
|
|
24853
25306
|
function sweep(dir) {
|
|
24854
25307
|
try {
|
|
24855
25308
|
for (const name of readdirSync5(dir)) {
|
|
24856
|
-
const path =
|
|
25309
|
+
const path = join27(dir, name);
|
|
24857
25310
|
try {
|
|
24858
25311
|
if (Date.now() - statSync9(path).mtimeMs > CLAIM_SWEEP_MS) rmSync7(path, { force: true });
|
|
24859
25312
|
} catch {
|
|
@@ -24864,8 +25317,8 @@ function sweep(dir) {
|
|
|
24864
25317
|
}
|
|
24865
25318
|
function tryClaim(dataDir2, sessionId) {
|
|
24866
25319
|
if (sessionId === void 0 || sessionId === "") return () => void 0;
|
|
24867
|
-
const dir =
|
|
24868
|
-
const path =
|
|
25320
|
+
const dir = join27(dataDir2, CLAIM_DIR);
|
|
25321
|
+
const path = join27(dir, encodeURIComponent(sessionId));
|
|
24869
25322
|
try {
|
|
24870
25323
|
if (Date.now() - statSync9(path).mtimeMs < CLAIM_TTL_MS) return null;
|
|
24871
25324
|
rmSync7(path, { force: true });
|
|
@@ -24953,7 +25406,7 @@ function parseStopPayload(input2) {
|
|
|
24953
25406
|
|
|
24954
25407
|
// src/hooks/store-health.ts
|
|
24955
25408
|
import { mkdirSync as mkdirSync7, readFileSync as readFileSync20, writeFileSync as writeFileSync10 } from "fs";
|
|
24956
|
-
import { dirname as dirname7, join as
|
|
25409
|
+
import { dirname as dirname7, join as join33 } from "path";
|
|
24957
25410
|
|
|
24958
25411
|
// ../../packages/remote/src/http.ts
|
|
24959
25412
|
import { request as httpRequest } from "http";
|
|
@@ -24961,21 +25414,16 @@ import { request as httpsRequest } from "https";
|
|
|
24961
25414
|
var MAX_RESPONSE_BYTES = 8 * 1024 * 1024;
|
|
24962
25415
|
|
|
24963
25416
|
// ../../packages/remote/src/client.ts
|
|
24964
|
-
var
|
|
25417
|
+
var SLASH2 = "/".charCodeAt(0);
|
|
24965
25418
|
|
|
24966
25419
|
// ../../packages/plugin-runtime/src/attached/forward-drops.ts
|
|
24967
|
-
import { readFileSync as
|
|
24968
|
-
import { join as
|
|
25420
|
+
import { readFileSync as readFileSync17 } from "fs";
|
|
25421
|
+
import { join as join28 } from "path";
|
|
24969
25422
|
|
|
24970
25423
|
// ../../packages/plugin-runtime/src/attached/forward-policy.ts
|
|
24971
25424
|
import { randomUUID as randomUUID15 } from "crypto";
|
|
24972
|
-
import { readFileSync as readFileSync16 } from "fs";
|
|
24973
25425
|
import { readFile, rename, writeFile } from "fs/promises";
|
|
24974
|
-
import { join as
|
|
24975
|
-
|
|
24976
|
-
// ../../packages/plugin-runtime/src/attached/history-state.ts
|
|
24977
|
-
import { readFileSync as readFileSync17 } from "fs";
|
|
24978
|
-
import { join as join28 } from "path";
|
|
25426
|
+
import { join as join29 } from "path";
|
|
24979
25427
|
|
|
24980
25428
|
// ../../packages/plugin-runtime/src/attached/history-sync.ts
|
|
24981
25429
|
import { createHash as createHash7 } from "crypto";
|
|
@@ -24985,6 +25433,10 @@ import { hostname as hostname5 } from "os";
|
|
|
24985
25433
|
var CORRELATION_ID = EventMetadata.shape.correlationId;
|
|
24986
25434
|
var TRACE_ID = EventMetadata.shape.traceId;
|
|
24987
25435
|
var EXCEPTION_ID = EventMetadata.shape.exceptionIds.unwrap().element;
|
|
25436
|
+
var REDACT_DEGRADED_TO = EventMetadata.shape.redactDegradedTo.unwrap();
|
|
25437
|
+
|
|
25438
|
+
// ../../packages/plugin-runtime/src/attached/history-sync.ts
|
|
25439
|
+
var CAPTURE_BATCH_BYTES = 1024 * 1024;
|
|
24988
25440
|
|
|
24989
25441
|
// ../../packages/plugin-runtime/src/attached/history-sync-trigger.ts
|
|
24990
25442
|
import { spawn as spawn2 } from "child_process";
|
|
@@ -24997,10 +25449,13 @@ import { readFileSync as readFileSync18 } from "fs";
|
|
|
24997
25449
|
// ../../packages/plugin-runtime/src/attached/policy-store.ts
|
|
24998
25450
|
import { randomUUID as randomUUID16 } from "crypto";
|
|
24999
25451
|
import { readFile as readFile2, rm, writeFile as writeFile2 } from "fs/promises";
|
|
25000
|
-
import { join as
|
|
25452
|
+
import { join as join30 } from "path";
|
|
25001
25453
|
|
|
25002
25454
|
// ../../packages/plugin-runtime/src/attached/atomic-publish.ts
|
|
25003
25455
|
import { rename as rename2 } from "fs/promises";
|
|
25456
|
+
var IMMEDIATE_RETRIES = 8;
|
|
25457
|
+
var TIMED_RETRIES = 4;
|
|
25458
|
+
var ATTEMPTS = 1 + IMMEDIATE_RETRIES + TIMED_RETRIES;
|
|
25004
25459
|
|
|
25005
25460
|
// ../../packages/plugin-runtime/src/attached/posture-reporter.ts
|
|
25006
25461
|
var POSTURE_REPORT_INTERVAL_MS = 60 * 60 * 1e3;
|
|
@@ -25012,11 +25467,11 @@ import { DatabaseSync as DatabaseSync4 } from "node:sqlite";
|
|
|
25012
25467
|
// ../../packages/plugin-runtime/src/attached/posture-store.ts
|
|
25013
25468
|
import { randomUUID as randomUUID17 } from "crypto";
|
|
25014
25469
|
import { readFile as readFile3, rm as rm2, writeFile as writeFile3 } from "fs/promises";
|
|
25015
|
-
import { join as
|
|
25470
|
+
import { join as join31 } from "path";
|
|
25016
25471
|
|
|
25017
25472
|
// ../../packages/plugin-runtime/src/attached/sync-state.ts
|
|
25018
25473
|
import { readFileSync as readFileSync19 } from "fs";
|
|
25019
|
-
import { join as
|
|
25474
|
+
import { join as join32 } from "path";
|
|
25020
25475
|
|
|
25021
25476
|
// ../../packages/plugin-runtime/src/attached/status.ts
|
|
25022
25477
|
var REFUSAL_LINES = {
|
|
@@ -25037,6 +25492,14 @@ import { spawn as spawn3 } from "child_process";
|
|
|
25037
25492
|
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
25038
25493
|
var SYNC_THROTTLE_MS = 15 * 60 * 1e3;
|
|
25039
25494
|
|
|
25495
|
+
// ../../packages/plugin-runtime/src/content-retention-pass.ts
|
|
25496
|
+
var MAX_ROWS_PER_SWEEP = 50 * 1e3;
|
|
25497
|
+
|
|
25498
|
+
// ../../packages/plugin-runtime/src/content-retention-trigger.ts
|
|
25499
|
+
import { spawn as spawn4 } from "child_process";
|
|
25500
|
+
import { fileURLToPath as fileURLToPath5 } from "url";
|
|
25501
|
+
var CONTENT_RETENTION_THROTTLE_MS = 60 * 60 * 1e3;
|
|
25502
|
+
|
|
25040
25503
|
// ../../packages/plugin-runtime/src/attached/factory.ts
|
|
25041
25504
|
import { hostname as hostname6 } from "os";
|
|
25042
25505
|
|
|
@@ -25055,7 +25518,7 @@ function markerDirs(dataDir2) {
|
|
|
25055
25518
|
function alreadyClaimed(dirs, marker, sessionId) {
|
|
25056
25519
|
return dirs.some((dir) => {
|
|
25057
25520
|
try {
|
|
25058
|
-
return readFileSync20(
|
|
25521
|
+
return readFileSync20(join33(dir, marker), "utf8") === sessionId;
|
|
25059
25522
|
} catch {
|
|
25060
25523
|
return false;
|
|
25061
25524
|
}
|
|
@@ -25065,7 +25528,7 @@ function recordClaim(dirs, marker, sessionId) {
|
|
|
25065
25528
|
for (const dir of dirs) {
|
|
25066
25529
|
try {
|
|
25067
25530
|
mkdirSync7(dir, { recursive: true, mode: DATA_DIR_MODE });
|
|
25068
|
-
writeFileSync10(
|
|
25531
|
+
writeFileSync10(join33(dir, marker), sessionId, { mode: DATA_FILE_MODE });
|
|
25069
25532
|
return;
|
|
25070
25533
|
} catch {
|
|
25071
25534
|
}
|