@akasecurity/ai-tc-claude-code 0.9.12 → 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/scripts/intro.js CHANGED
@@ -20217,7 +20217,17 @@ var UNPRICEABLE_PROVIDERS = Object.freeze([
20217
20217
  "gateway",
20218
20218
  "unknown",
20219
20219
  "cli",
20220
- "api"
20220
+ "api",
20221
+ // The browser extension's native host records these as `llm_call.provider`
20222
+ // for a web-chat turn — the web tool id, deliberately never the vendor id
20223
+ // (`openai`/`anthropic`) the session root carries. Subscription traffic
20224
+ // burns rate-limit budget, not dollar credits, and listing them here is
20225
+ // what keeps that true structurally: a later maintainer who wants to price
20226
+ // web-chat traffic at API rates has to delete this entry first, and meet
20227
+ // the reason on the way, rather than quietly adding one to
20228
+ // PROVIDER_PLATFORM.
20229
+ "chatgpt",
20230
+ "claude-ai"
20221
20231
  ]);
20222
20232
 
20223
20233
  // ../../packages/schema/src/token/format.ts
@@ -20237,7 +20247,12 @@ var HARNESS = {
20237
20247
  ClaudeDesktop: "claudedesktop",
20238
20248
  ChatGpt: "chatgpt",
20239
20249
  ClaudeAi: "claudeai",
20240
- Api: "api"
20250
+ Api: "api",
20251
+ // Not a coding assistant a person drives — an in-process SDK embedded in an
20252
+ // application, so it has no IDE/CLI/desktop/web surface of its own. Carries
20253
+ // the same id as its SOURCE_TOOL counterpart, unlike every capture-side tool
20254
+ // whose wire spelling differs from its display spelling.
20255
+ AiTcSdk: "ai-tc-sdk"
20241
20256
  };
20242
20257
  var Harness = external_exports.enum(HARNESS).meta({ id: "Harness" });
20243
20258
  var SOURCE_TOOL = {
@@ -20253,9 +20268,15 @@ var SOURCE_TOOL = {
20253
20268
  // whose tool could not be identified both render through the read side's
20254
20269
  // miss path rather than as a harness of their own.
20255
20270
  Cli: "cli",
20256
- Unknown: "unknown"
20271
+ Unknown: "unknown",
20272
+ // The wire id an in-process, request-path SDK stamps on its own structural
20273
+ // rows (`request_decision`) — never a capture of prompt/response/tool text,
20274
+ // since the SDK sits in front of a model call rather than inside a coding
20275
+ // assistant's own hook contract.
20276
+ AiTcSdk: "ai-tc-sdk"
20257
20277
  };
20258
20278
  var SourceTool = external_exports.enum(SOURCE_TOOL).meta({ id: "SourceTool" });
20279
+ var WebSourceTool = SourceTool.extract(["ChatGpt", "ClaudeAi"]);
20259
20280
  var TOOL_TO_HARNESS = {
20260
20281
  [SOURCE_TOOL.ClaudeCode]: HARNESS.ClaudeCode,
20261
20282
  [SOURCE_TOOL.ClaudeDesktop]: HARNESS.ClaudeDesktop,
@@ -20264,7 +20285,12 @@ var TOOL_TO_HARNESS = {
20264
20285
  [SOURCE_TOOL.ChatGpt]: HARNESS.ChatGpt,
20265
20286
  [SOURCE_TOOL.Codex]: HARNESS.Codex,
20266
20287
  [SOURCE_TOOL.Antigravity]: HARNESS.Antigravity,
20267
- [SOURCE_TOOL.ClaudeAi]: HARNESS.ClaudeAi
20288
+ [SOURCE_TOOL.ClaudeAi]: HARNESS.ClaudeAi,
20289
+ // Wire and display id are the same string here, but the row still belongs:
20290
+ // both vocabularies carry the `AiTcSdk` member, and the join is exactly
20291
+ // their intersection — leaving a shared member out would read as an
20292
+ // uninstrumented tool on both surfaces, which this one is not.
20293
+ [SOURCE_TOOL.AiTcSdk]: HARNESS.AiTcSdk
20268
20294
  };
20269
20295
 
20270
20296
  // ../../packages/schema/src/zod/finding.ts
@@ -20298,7 +20324,8 @@ var FindingProvider = Harness.extract([
20298
20324
  "ClaudeAi",
20299
20325
  "Codex",
20300
20326
  "Antigravity",
20301
- "Api"
20327
+ "Api",
20328
+ "AiTcSdk"
20302
20329
  ]).meta({ id: "FindingProvider" });
20303
20330
  var FindingCategory = external_exports.enum([
20304
20331
  "secret",
@@ -20672,18 +20699,41 @@ var AuditEventType = external_exports.enum([
20672
20699
  // 'tool_call' is the reconciler's structural row for every call, while
20673
20700
  // 'tool_use' exists only where a hook enforced against the arguments.
20674
20701
  "tool_use",
20675
- // One row per model REFUSAL: a switch onto a prohibited model that was
20676
- // denied, or a turn refused because the session was already running on one.
20677
- // A structural row like the ones above rather than a capture — it carries
20678
- // the model that was refused and nothing the user typed, because what is
20679
- // worth recording about a governance decision is the decision, and prompt
20680
- // text is the thing this product exists to keep from travelling.
20702
+ // One row per model REFUSAL, across all four seams a prohibited model can be
20703
+ // stopped at: a switch onto it, a turn already running on it, a subagent
20704
+ // spawn asking for it, or a request-path refusal an embedded request-path
20705
+ // SDK makes in-process before the call leaves the application. Which seam
20706
+ // rides `attributes.refusal_seam`, never this member name. A structural row
20707
+ // like the ones above rather than a capture — it carries the model that was
20708
+ // refused and nothing the user typed, because what is worth recording about
20709
+ // a governance decision is the decision, and prompt text is the thing this
20710
+ // product exists to keep from travelling.
20681
20711
  "model_refusal",
20712
+ // One row per request-path DECISION: a policy check an embedded request-path
20713
+ // SDK performs in-process before a model call leaves the application, or
20714
+ // against that call's non-streamed response. A structural row like
20715
+ // 'model_refusal' rather than a capture — content-free in the same way:
20716
+ // which side, which seam, what action and which field are decided rides
20717
+ // `attributes`, never this member name, and the matched text itself never
20718
+ // travels.
20719
+ //
20720
+ // A prohibited-model refusal on the request path is deliberately NOT this
20721
+ // member: it stays 'model_refusal' with `refusal_seam: 'request'`, so it
20722
+ // shares one bucket with the plugin's switch/turn/spawn refusals rather
20723
+ // than splitting one governance concept across two event types. This
20724
+ // member carries every OTHER request-path decision.
20725
+ "request_decision",
20682
20726
  // One row per config-inventory scan, hung off the session root. It is the
20683
20727
  // fact the posture inspection findings reference (findings require an
20684
20728
  // audit_event_id), and its started_at is the "scanned Nm ago" the read
20685
20729
  // surface renders.
20686
- "config_scan"
20730
+ "config_scan",
20731
+ // One row per reported browser-extension capture status, hung off the web
20732
+ // session root. The durable home of what one tab's network interception
20733
+ // is doing — a write-through of the native host's in-memory tracker, so a
20734
+ // second process (aka extension status) and a restarted host both have
20735
+ // somewhere to read it back from.
20736
+ "capture_status"
20687
20737
  ]).meta({ id: "AuditEventType" });
20688
20738
  var AttributeBag = external_exports.record(external_exports.string(), external_exports.unknown());
20689
20739
  var HostAttributes = external_exports.object({
@@ -20843,6 +20893,20 @@ var CaptureAttributes = external_exports.object({
20843
20893
  // repeated rather than referenced because a store reader opens this file.
20844
20894
  redact_degraded_to: ActionTaken.optional()
20845
20895
  }).catchall(external_exports.unknown());
20896
+ var CaptureStatusAttributes = external_exports.object({
20897
+ source_tool: external_exports.string().optional(),
20898
+ patched: external_exports.boolean().optional(),
20899
+ live: external_exports.boolean().optional(),
20900
+ blind: external_exports.boolean().optional(),
20901
+ sends_seen_dom: external_exports.number().int().nonnegative().optional(),
20902
+ exchanges_seen_net: external_exports.number().int().nonnegative().optional(),
20903
+ parse_failures: external_exports.number().int().nonnegative().optional(),
20904
+ unparsed_bodies: external_exports.number().int().nonnegative().optional(),
20905
+ shape_misses: external_exports.array(external_exports.string()).optional(),
20906
+ conversation_endpoints: external_exports.number().int().nonnegative().optional(),
20907
+ closed: external_exports.boolean().optional(),
20908
+ enforcement: external_exports.string().optional()
20909
+ }).catchall(external_exports.unknown());
20846
20910
  var ToolCallInspection = external_exports.object({
20847
20911
  ruleId: external_exports.string().min(1),
20848
20912
  ruleName: external_exports.string(),
@@ -21852,6 +21916,11 @@ var RemoteFailureKind = external_exports.enum([
21852
21916
  "rejected",
21853
21917
  "unreachable"
21854
21918
  ]);
21919
+ var ControlPlaneFailure = RemoteFailureKind.extract([
21920
+ "unauthorized",
21921
+ "forbidden",
21922
+ "unreachable"
21923
+ ]);
21855
21924
  var AttachDeviceRequest = external_exports.object({
21856
21925
  // This machine's own continuity id, so re-attaching ROTATES the credential
21857
21926
  // on one machine record instead of producing a second one. Client-minted
@@ -22274,7 +22343,12 @@ var EventMetadata = external_exports.object({
22274
22343
  // in — set by the browser extension's network capture so a stored `response`
22275
22344
  // row can be joined to the `llm_call` leaf describing the same turn. Absent
22276
22345
  // on every other capture path, which has no such id.
22277
- messageId: external_exports.string().optional(),
22346
+ //
22347
+ // Non-empty for the reason WebExchange.messageId is: it is the join key, and
22348
+ // a blank one matches no `llm_call` leaf. That refusal reaches only the
22349
+ // places an event is PARSED; the local write path types the event and parses
22350
+ // nothing, which is why `toCaptureAttributes` omits a blank one separately.
22351
+ messageId: external_exports.string().min(1).optional(),
22278
22352
  conversationId: external_exports.string().optional(),
22279
22353
  // How long THIS capture's inspection blocked its caller, in whole
22280
22354
  // milliseconds — the plugin's own added latency, NOT the LLM call it sat in
@@ -22874,6 +22948,18 @@ var HistorySyncConsent = external_exports.object({
22874
22948
  payloadVersion: external_exports.number().int().positive(),
22875
22949
  endpoint: external_exports.string()
22876
22950
  });
22951
+ var WebChatCaptureConsent = external_exports.object({
22952
+ acknowledgedAt: external_exports.iso.datetime(),
22953
+ version: external_exports.number().int().positive()
22954
+ });
22955
+ var WebChatResponseCapture = external_exports.enum(["with-findings", "always", "never"]);
22956
+ var WebChatCapture = external_exports.object({
22957
+ responses: WebChatResponseCapture.default("with-findings"),
22958
+ account: external_exports.boolean().default(false),
22959
+ // Absent until granted. Presence alone does not authorize anything — see
22960
+ // isWebChatCaptureConsentValid.
22961
+ consent: WebChatCaptureConsent.optional()
22962
+ });
22877
22963
  var BODY_RETENTION_DEFAULT_DAYS = 30;
22878
22964
  var BodyRetention = external_exports.object({
22879
22965
  enabled: external_exports.boolean().default(false),
@@ -22932,6 +23018,16 @@ var WorkspaceSettings = external_exports.object({
22932
23018
  // both widenings. Absent until granted, and a grant for a different endpoint
22933
23019
  // or an older payload no longer counts.
22934
23020
  historySyncConsent: HistorySyncConsent.optional(),
23021
+ // What the browser extension may record from a web chat, and the grant that
23022
+ // authorizes it. Absent until the user answers: recording something that was
23023
+ // never recorded before is never an assumed grant on upgrade, so the whole
23024
+ // block is optional rather than defaulted in. What an absent block means is
23025
+ // webChatCaptureOf's answer, in one place.
23026
+ //
23027
+ // Enforcement is NOT gated on this. A machine that has never answered still
23028
+ // blocks, redacts and warns on what a user sends; the grant covers what is
23029
+ // written down.
23030
+ webChatCapture: WebChatCapture.optional(),
22935
23031
  // Local body expiry (see BodyRetention). Off until switched on; expiring a
22936
23032
  // body never removes the row or its findings.
22937
23033
  bodyRetention: BodyRetention.default({
@@ -23289,12 +23385,14 @@ var RecommendedActionIdParam = external_exports.object({ id: external_exports.st
23289
23385
  // ../../packages/schema/src/zod/settings-action.ts
23290
23386
  var HistorySyncConsentChoice = external_exports.enum(["granted", "revoked", "unchanged"]).meta({ id: "HistorySyncConsentChoice" });
23291
23387
  var ModelJudgeConsentChoice = external_exports.enum(["granted", "revoked", "unchanged"]).meta({ id: "ModelJudgeConsentChoice" });
23388
+ var WebChatCaptureConsentChoice = external_exports.enum(["granted", "revoked", "unchanged"]).meta({ id: "WebChatCaptureConsentChoice" });
23292
23389
  var SaveSettingsInput = external_exports.object({
23293
23390
  historicalAccess: external_exports.string(),
23294
23391
  modelJudgeConsent: ModelJudgeConsentChoice,
23295
23392
  historySyncConsent: HistorySyncConsentChoice,
23296
23393
  vaultConsent: external_exports.string(),
23297
23394
  vaultInlineReveal: external_exports.string(),
23395
+ webChatCaptureConsent: WebChatCaptureConsentChoice,
23298
23396
  // Widened to `string` like its neighbours rather than typed as
23299
23397
  // `RedactFallback`, on this module's own layering rule: shape here, VALUE at
23300
23398
  // the call site, so the domain check receives the type it was written for.
@@ -23463,11 +23561,24 @@ var WebExchange = external_exports.object({
23463
23561
  turnIndex: external_exports.number().int().nonnegative().optional(),
23464
23562
  toolCalls: external_exports.array(WebToolCall).default([]),
23465
23563
  // Absent when the adapter recovered no text. Capped by the caller at
23466
- // RESPONSE_TEXT_MAX_BYTES; `truncated` records that the cap was reached, so a
23467
- // short capture is never mistaken for a short reply.
23564
+ // RESPONSE_TEXT_MAX_BYTES, so a short capture is never mistaken for a short
23565
+ // reply.
23468
23566
  responseText: external_exports.string().optional(),
23567
+ // The stored text is short of the reply. It does NOT say which of the two
23568
+ // ceilings on this path cut it: the caller applies its own cap on the raw
23569
+ // bytes it reads off the wire, which can be reached by a stream whose
23570
+ // recovered text stays well under RESPONSE_TEXT_MAX_BYTES, and applies that
23571
+ // one to the text. A reader cannot tell them apart, and nothing downstream
23572
+ // should branch as though it could.
23469
23573
  truncated: external_exports.boolean().default(false)
23470
23574
  });
23575
+ var WebEnforcementState = external_exports.enum([
23576
+ "watching",
23577
+ "composer-only",
23578
+ "button-only",
23579
+ "unattached",
23580
+ "unknown"
23581
+ ]);
23471
23582
  var RESPONSE_TEXT_MAX_BYTES = 2 * 1024 * 1024;
23472
23583
  var WebCaptureStatus = external_exports.object({
23473
23584
  patched: external_exports.boolean(),
@@ -23479,8 +23590,39 @@ var WebCaptureStatus = external_exports.object({
23479
23590
  unparsedBodies: external_exports.number().int().nonnegative(),
23480
23591
  // The adapter-declared JSON key paths that were absent from a real payload —
23481
23592
  // the earliest signal that a site's contract moved.
23482
- shapeMisses: external_exports.array(external_exports.string()).default([])
23483
- });
23593
+ shapeMisses: external_exports.array(external_exports.string()).default([]),
23594
+ // How many `kind: 'conversation'` endpoints the reporting tab's adapter
23595
+ // compiled. Zero means this build declares none for the site, so observing
23596
+ // nothing is the design rather than a fault — the one fact that separates a
23597
+ // site nobody has surveyed yet from one whose contract moved. Defaulted so a
23598
+ // build predating the field is read as declaring nothing rather than refused.
23599
+ conversationEndpoints: external_exports.number().int().nonnegative().default(0),
23600
+ // The document that sent this report is going away. The bridge sets it on
23601
+ // its `pagehide` report and nowhere else.
23602
+ //
23603
+ // A property of the REPORT rather than of capture health, which is why
23604
+ // nothing in `deriveWebCaptureState` reads it and why it stays out of the
23605
+ // bridge's own report signature — a closing tab's last word must not be
23606
+ // suppressed for carrying the same health as the report before it. What
23607
+ // reads it is the per-site fold: a document that said it was unloading stops
23608
+ // voting on the site's state, so the reload the `blind` remediation asks for
23609
+ // can actually clear the verdict it was shown. A document that dies without
23610
+ // sending one is covered by CAPTURE_STATUS_DOCUMENT_QUIET_MS instead.
23611
+ //
23612
+ // Defaulted so a build predating the field reads as a document that never
23613
+ // said it was closing — which keeps it voting, the same as every report that
23614
+ // is not a final one.
23615
+ closed: external_exports.boolean().default(false),
23616
+ // What the DOM enforcement path is doing, which none of the counters above
23617
+ // can say: `sendsSeenDom` rises only once a send has COMPLETED, so a tab
23618
+ // whose watcher never bound reports zero exactly like a tab nobody typed in.
23619
+ // Defaulted to 'unknown' rather than 'watching' so a status from a build
23620
+ // predating the field is not read as reporting a healthy one.
23621
+ enforcement: WebEnforcementState.default("unknown")
23622
+ });
23623
+ var CAPTURE_STATUS_RECENCY_MS = 30 * 24 * 60 * 60 * 1e3;
23624
+ var CAPTURE_STATUS_RECENCY_DAYS = CAPTURE_STATUS_RECENCY_MS / (24 * 60 * 60 * 1e3);
23625
+ var CAPTURE_STATUS_DOCUMENT_QUIET_MS = 12 * 60 * 60 * 1e3;
23484
23626
 
23485
23627
  // src/provenance.ts
23486
23628
  import { execFileSync } from "child_process";
@@ -24500,6 +24642,56 @@ var CONFIG_POSTURE_RULES = [
24500
24642
  }
24501
24643
  ];
24502
24644
 
24645
+ // ../../packages/detections/src/posture/web-capture-posture.ts
24646
+ var RULE_VERSION2 = "1";
24647
+ var DRIFT_MIN_PARSE_FAILURES = 2;
24648
+ var WEB_CAPTURE_DRIFT_STATES = /* @__PURE__ */ new Set([
24649
+ "blind",
24650
+ "degraded"
24651
+ ]);
24652
+ var WEB_CAPTURE_DRIFT_RULE = {
24653
+ ruleId: "web-capture-drift",
24654
+ version: RULE_VERSION2,
24655
+ name: "Web chat capture is not reading the site",
24656
+ category: "config",
24657
+ severity: "medium",
24658
+ definition: JSON.stringify({
24659
+ kind: "web-capture-drift",
24660
+ states: [...WEB_CAPTURE_DRIFT_STATES],
24661
+ minParseFailures: DRIFT_MIN_PARSE_FAILURES
24662
+ })
24663
+ };
24664
+ var STATIC_COPY = {
24665
+ active: { headline: "turns are being observed on this site" },
24666
+ unreported: {
24667
+ // Says "recently" rather than "yet": the store read is bounded to
24668
+ // CAPTURE_STATUS_RECENCY_MS, so this state covers a site nothing has ever
24669
+ // reported for AND one whose last report has aged out. The two are the
24670
+ // same fact to a reader — nobody has confirmed anything lately — and the
24671
+ // copy may not claim the stronger of them.
24672
+ headline: `no report in the last ${String(CAPTURE_STATUS_RECENCY_DAYS)} days \u2014 open the site in Chrome with the extension loaded`
24673
+ },
24674
+ standby: {
24675
+ headline: "this build declares no endpoints for the site, so nothing is observed yet"
24676
+ },
24677
+ unpatched: {
24678
+ // Says what the flags say and no more. `patched` is false both for a tap
24679
+ // that installed and hooked neither transport and for one that never ran
24680
+ // at all — a page reports the same status either way, so the copy may not
24681
+ // assert one of them.
24682
+ headline: "the page tap captured neither fetch nor XHR \u2014 it may not have installed; reload the extension at chrome://extensions"
24683
+ },
24684
+ idle: { headline: "watching; no turn has been observed yet" },
24685
+ blind: {
24686
+ headline: "messages were sent in the page that the network capture never saw",
24687
+ 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."
24688
+ },
24689
+ degraded: {
24690
+ headline: "the site's payloads no longer carry the fields the extension reads",
24691
+ 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."
24692
+ }
24693
+ };
24694
+
24503
24695
  // ../../packages/detections/src/security/redos-probe.ts
24504
24696
  var BUDGET_MS = 100;
24505
24697
  var EXPONENTIAL_UNITS = [