@akasecurity/ai-tc-copilot 0.9.20 → 0.9.21

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/README.md CHANGED
@@ -73,7 +73,7 @@ Then point VS Code at the unpacked folder in your user settings:
73
73
  The setup skill's [Known limitations](https://github.com/akasecurity/ai-tc/blob/main/plugins/copilot/skills/setup/SKILL.md#known-limitations) section is the authority on what AKA can do on each surface. In brief:
74
74
 
75
75
  - **Only a tool call can be stopped.** Prompts and tool results are captured, scanned and recorded, so a secret in either shows up as a finding, but neither is ever blocked or rewritten.
76
- - **AKA's notices are not shown to you.** On the Copilot CLI in `-p` mode they appeared only in the debug log; in VS Code, only in the "GitHub Copilot Chat Hooks" output channel.
76
+ - **AKA's notices may not be shown to you.** On the Copilot CLI they are sent as hook progress lines, which the Copilot hooks reference documents as shown in the CLI timeline; that has not yet been observed on a real install, and an earlier build's notices appeared only in the debug log in `-p` mode. In VS Code they appear only in the "GitHub Copilot Chat Hooks" output channel. A deny is the one message that carries its own reason, so set `redactFallback` to `block` where a flagged command must not pass silently.
77
77
  - **No setup wizard and no history backfill yet.** Use the `aka` CLI directly (`aka init`, `aka detections`, `aka scan`), and nothing reads the sessions that happened before the plugin was installed.
78
78
 
79
79
  ## Where your data lives
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@akasecurity/ai-tc-copilot",
3
- "version": "0.9.20",
3
+ "version": "0.9.21",
4
4
  "description": "AI Traffic Control — inspect and govern AI prompts in GitHub Copilot",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -22,17 +22,17 @@
22
22
  },
23
23
  "devDependencies": {
24
24
  "@types/node": "^25.9.9",
25
- "@vitest/coverage-v8": "^4.1.11",
25
+ "@vitest/coverage-v8": "^4.1.12",
26
26
  "eslint": "^9.39.5",
27
27
  "tsup": "^9.0.0",
28
28
  "typescript": "^5.8.0",
29
- "vitest": "^4.1.11",
30
- "@akasecurity/eslint-config": "0.8.0",
29
+ "vitest": "^4.1.12",
31
30
  "@akasecurity/persistence": "0.8.0",
32
- "@akasecurity/plugin-sdk": "0.8.0",
33
- "@akasecurity/scanner": "0.8.0",
34
31
  "@akasecurity/plugin-runtime": "0.8.0",
32
+ "@akasecurity/scanner": "0.8.0",
35
33
  "@akasecurity/schema": "0.8.0",
34
+ "@akasecurity/plugin-sdk": "0.8.0",
35
+ "@akasecurity/eslint-config": "0.8.0",
36
36
  "@akasecurity/setup-wizard": "0.8.0"
37
37
  },
38
38
  "scripts": {
package/plugin.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aka-copilot",
3
- "version": "0.9.20",
3
+ "version": "0.9.21",
4
4
  "description": "AI Traffic Control — inspect and govern AI prompts in GitHub Copilot. Detection runs locally; events are recorded to a local SQLite store on your machine.",
5
5
  "hooks": "./hooks.json",
6
6
  "skills": "./skills",
@@ -11462,7 +11462,7 @@ var DetectedWebAccounts = object({
11462
11462
  var DetectedWebAccountsEnvelope = DetectedWebAccounts.extend({ accounts: array(unknown()) });
11463
11463
 
11464
11464
  // ../../packages/schema/src/zod/local.ts
11465
- var WORKSPACE_SETTINGS_SPEC_VERSION = 10;
11465
+ var WORKSPACE_SETTINGS_SPEC_VERSION = 11;
11466
11466
  var MODEL_JUDGE_PAYLOAD_VERSION = 1;
11467
11467
  var RunMode = _enum(["standalone", "attached"]);
11468
11468
  var ControlPlaneConnection = object({
@@ -11622,6 +11622,15 @@ var BodyRetention = object({
11622
11622
  // candidate set that is already bounded by "delivered, or never owed".
11623
11623
  retainDays: number2().int().min(1).max(3650).default(BODY_RETENTION_DEFAULT_DAYS)
11624
11624
  }).meta({ id: "BodyRetention" });
11625
+ var MAX_PROTECTED_PATH_ENTRIES = 256;
11626
+ var MAX_PROTECTED_PATH_ENTRY_CHARS = 1024;
11627
+ var ProtectedPathEntry = string2().trim().min(1).max(MAX_PROTECTED_PATH_ENTRY_CHARS);
11628
+ var ProtectedPaths = array(unknown()).transform(
11629
+ (entries) => entries.flatMap((entry) => {
11630
+ const parsed = ProtectedPathEntry.safeParse(entry);
11631
+ return parsed.success ? [parsed.data] : [];
11632
+ }).slice(0, MAX_PROTECTED_PATH_ENTRIES)
11633
+ );
11625
11634
  var WorkspaceSettings = object({
11626
11635
  specVersion: number2().int().positive().default(WORKSPACE_SETTINGS_SPEC_VERSION),
11627
11636
  runMode: RunMode.default("standalone"),
@@ -11712,7 +11721,18 @@ var WorkspaceSettings = object({
11712
11721
  bodyRetention: BodyRetention.default({
11713
11722
  enabled: false,
11714
11723
  retainDays: BODY_RETENTION_DEFAULT_DAYS
11715
- })
11724
+ }),
11725
+ // Folders and file name globs whose files a tool call may not touch
11726
+ // unflagged: a Read, Grep, Glob or Bash naming one becomes a finding under
11727
+ // the command-risk pack's policy. Absent means none are protected, and
11728
+ // protectedPathsOf is the one reader.
11729
+ //
11730
+ // A bad entry is dropped on its own (see ProtectedPaths); `.catch(undefined)`
11731
+ // reads a value that is not a list at all as no list. A settings.json that
11732
+ // fails this schema reads as the unonboarded defaults, and the next save
11733
+ // writes those back over it, so a malformed value must not cost every other
11734
+ // setting. Not a ManagedSettingKey.
11735
+ protectedPaths: ProtectedPaths.optional().catch(void 0)
11716
11736
  });
11717
11737
  function defaultWorkspaceSettings() {
11718
11738
  return WorkspaceSettings.parse({});
@@ -12059,6 +12079,9 @@ var ConfigInventoryAck = object({
12059
12079
  accepted: number2().int().nonnegative()
12060
12080
  });
12061
12081
 
12082
+ // ../../packages/schema/src/zod/credential-status.ts
12083
+ var CredentialStatus = _enum(["rotation_overdue", "exposed"]).meta({ id: "CredentialStatus" });
12084
+
12062
12085
  // ../../packages/schema/src/zod/registry.ts
12063
12086
  var Namespace = string2().regex(/^[a-z][a-z0-9-]*$/);
12064
12087
  var PackId = string2().regex(/^[a-z][a-z0-9-]*$/);
@@ -13868,6 +13891,44 @@ function codingScopeExtras(dataDir2, settings, credential) {
13868
13891
  }
13869
13892
  }
13870
13893
 
13894
+ // ../../packages/persistence/src/repo-key.ts
13895
+ import { createHash as createHash2 } from "crypto";
13896
+ var SCP_FORM = /^(?:[^@/]+@)?([^/:]+):(.+)$/;
13897
+ var DOS_DRIVE = /^[A-Za-z]:[\\/]/;
13898
+ var FILE_URL = /^file:\/\//i;
13899
+ var SCHEME_FORM = /^[a-z][a-z0-9+.-]*:\/\/(?:[^@/]+@)?([^/:]+)(?::\d+)?(\/.*)?$/i;
13900
+ var SLASH = "/".charCodeAt(0);
13901
+ var GIT_SUFFIX = ".git";
13902
+ function trimSlashes(path) {
13903
+ let start = 0;
13904
+ let end = path.length;
13905
+ while (start < end && path.charCodeAt(start) === SLASH) start += 1;
13906
+ while (end > start && path.charCodeAt(end - 1) === SLASH) end -= 1;
13907
+ return path.slice(start, end);
13908
+ }
13909
+ function parseGitRemote(url2) {
13910
+ const trimmed = url2.trim();
13911
+ if (DOS_DRIVE.test(trimmed) || FILE_URL.test(trimmed)) return void 0;
13912
+ const scheme = SCHEME_FORM.exec(trimmed);
13913
+ const scp = scheme === null ? SCP_FORM.exec(trimmed) : null;
13914
+ const host = (scheme?.[1] ?? scp?.[1])?.toLowerCase();
13915
+ if (host === void 0) return void 0;
13916
+ const bare = trimSlashes((scheme === null ? scp?.[2] : scheme[2]) ?? "");
13917
+ const path = bare.endsWith(GIT_SUFFIX) ? bare.slice(0, -GIT_SUFFIX.length) : bare;
13918
+ return { host, path: CASE_INSENSITIVE_FORGES.has(host) ? path.toLowerCase() : path };
13919
+ }
13920
+ var CASE_INSENSITIVE_FORGES = /* @__PURE__ */ new Set([
13921
+ "github.com",
13922
+ "gitlab.com",
13923
+ "bitbucket.org"
13924
+ ]);
13925
+ function canonicalGitUrl(url2) {
13926
+ const remote = parseGitRemote(url2);
13927
+ if (remote === void 0) return url2.trim();
13928
+ return remote.path === "" ? remote.host : `${remote.host}/${remote.path}`;
13929
+ }
13930
+ var SCOPE_KEY = printable(ATTACHMENT_SCOPE_IDENTITY_MAX_LENGTH);
13931
+
13871
13932
  // ../../packages/persistence/src/capture-id-key.ts
13872
13933
  import { randomBytes } from "crypto";
13873
13934
  import { readFileSync as readFileSync4 } from "fs";
@@ -14062,9 +14123,6 @@ import { createHash as createHash4, randomUUID as randomUUID3 } from "crypto";
14062
14123
  import { homedir as homedir2 } from "os";
14063
14124
  import { isAbsolute as isAbsolute2, relative as relative2, sep as sep2 } from "path";
14064
14125
 
14065
- // ../../packages/persistence/src/egress-wire.ts
14066
- import { createHash as createHash2 } from "crypto";
14067
-
14068
14126
  // ../../packages/persistence/src/repositories/shares.ts
14069
14127
  import { randomUUID as randomUUID2 } from "crypto";
14070
14128
 
@@ -14887,10 +14945,6 @@ var SqliteSharesRepository = class {
14887
14945
  }
14888
14946
  };
14889
14947
 
14890
- // ../../packages/persistence/src/egress-wire.ts
14891
- var SLASH = "/".charCodeAt(0);
14892
- var SCOPE_KEY = printable(ATTACHMENT_SCOPE_IDENTITY_MAX_LENGTH);
14893
-
14894
14948
  // ../../packages/persistence/src/git-index.ts
14895
14949
  import { readFileSync as readFileSync5, statSync as statSync3 } from "fs";
14896
14950
  import { dirname, isAbsolute, join as join6, relative, resolve, sep } from "path";
@@ -15040,7 +15094,7 @@ function inventoryId(objectType, identityKey) {
15040
15094
  return sha256Hex(canonicalIdentity(["inventory", objectType, identityKey]));
15041
15095
  }
15042
15096
  function sourceProjectId(url2) {
15043
- return sha256Hex(canonicalIdentity(["source_project", url2]));
15097
+ return sha256Hex(canonicalIdentity(["source_project", canonicalGitUrl(url2)]));
15044
15098
  }
15045
15099
  function classifiedDataId(cls) {
15046
15100
  return sha256Hex(canonicalIdentity(["classified_data", cls]));
@@ -20386,7 +20440,7 @@ var SqliteInventoryRepository = class {
20386
20440
  import { randomUUID as randomUUID7 } from "crypto";
20387
20441
  var CATEGORY_ORDER = ["config", "skill", "mcp", "hook"];
20388
20442
  var VALID_HARNESS_IDS = new Set(HarnessId.options);
20389
- var WORKTREE_CHECKOUT_FILTER = "(url IS NULL OR (url NOT LIKE '%/.claude/worktrees/%' AND url NOT LIKE '%\\.claude\\worktrees\\%'))";
20443
+ var GHOST_PROJECT_FILTER = "(url IS NULL OR (url NOT LIKE '%/.claude/worktrees/%' AND url NOT LIKE '%\\.claude\\worktrees\\%' AND url NOT LIKE '%/.git/worktrees/%' AND url NOT LIKE '%\\.git\\worktrees\\%'))";
20390
20444
  var HARNESS_LABELS = {
20391
20445
  [HARNESS.ClaudeCode]: "Claude Code",
20392
20446
  [HARNESS.Cursor]: "Cursor",
@@ -20537,7 +20591,7 @@ var SqliteInventoryAssetsRepository = class {
20537
20591
  };
20538
20592
  byType.project = countScalar(
20539
20593
  this.db,
20540
- `SELECT count(*) AS n FROM source_project WHERE ${WORKTREE_CHECKOUT_FILTER}`
20594
+ `SELECT count(*) AS n FROM source_project WHERE ${GHOST_PROJECT_FILTER}`
20541
20595
  );
20542
20596
  const mcpTrustCounts = countBy(
20543
20597
  this.db,
@@ -20566,7 +20620,7 @@ var SqliteInventoryAssetsRepository = class {
20566
20620
  const flaggedProjects = countScalar(
20567
20621
  this.db,
20568
20622
  `SELECT count(*) AS n FROM source_project p
20569
- WHERE ${WORKTREE_CHECKOUT_FILTER}
20623
+ WHERE ${GHOST_PROJECT_FILTER}
20570
20624
  AND EXISTS (SELECT 1 FROM ${PROJECT_FINDINGS_FROM}
20571
20625
  WHERE s.source_project_id = p.id AND ${PROJECT_FINDINGS_JOIN})`,
20572
20626
  [this.findingsSince()]
@@ -21031,7 +21085,7 @@ var SqliteInventoryAssetsRepository = class {
21031
21085
  }
21032
21086
  fetchProjects(q) {
21033
21087
  let sql = `SELECT id, url, name, attributes, last_seen AS lastSeen FROM source_project
21034
- WHERE ${WORKTREE_CHECKOUT_FILTER}`;
21088
+ WHERE ${GHOST_PROJECT_FILTER}`;
21035
21089
  const params = [];
21036
21090
  if (q) {
21037
21091
  const pat = containsPattern(q);
@@ -23332,17 +23386,30 @@ function openLocalDatabase(dir, options = {}) {
23332
23386
  throw err;
23333
23387
  }
23334
23388
  }
23335
- function reconcileWorktreeProjects(canonicalId, headRoot, worktreeRoot) {
23389
+ function reconcileWorktreeProjects(canonicalId, headRoot, worktreeRoot, supersededUrls = []) {
23336
23390
  try {
23337
23391
  const headPosix = headRoot.split(sep3).join("/");
23338
23392
  const worktreePosix = worktreeRoot.split(sep3).join("/");
23339
23393
  const exactArm = worktreeRoot === headRoot ? "" : "url IN (:worktreePosix, :worktreeWin) OR ";
23394
+ const superseded = [
23395
+ ...new Set(
23396
+ supersededUrls.flatMap((url2) => {
23397
+ const posix2 = url2.split(sep3).join("/");
23398
+ return [posix2, posix2.split("/").join("\\")];
23399
+ })
23400
+ )
23401
+ ];
23402
+ const supersededParams = Object.fromEntries(
23403
+ superseded.map((url2, i) => [`superseded${String(i)}`, url2])
23404
+ );
23405
+ const supersededArm = superseded.length === 0 ? "" : `url IN (${superseded.map((_, i) => `:superseded${String(i)}`).join(", ")}) OR `;
23340
23406
  const stale = db.prepare(
23341
23407
  `SELECT id FROM source_project
23342
23408
  WHERE id <> :canonicalId
23343
- AND (${exactArm}url LIKE :pattern ESCAPE '\\' OR url LIKE :patternWin ESCAPE '\\')`
23409
+ AND (${supersededArm}${exactArm}url LIKE :pattern ESCAPE '\\' OR url LIKE :patternWin ESCAPE '\\')`
23344
23410
  ).all({
23345
23411
  canonicalId,
23412
+ ...supersededParams,
23346
23413
  ...worktreeRoot === headRoot ? {} : { worktreePosix, worktreeWin: worktreePosix.split("/").join("\\") },
23347
23414
  pattern: `${escapeLikePattern(headPosix)}/.claude/worktrees/%`,
23348
23415
  patternWin: `${escapeLikePattern(headPosix.split("/").join("\\"))}\\\\.claude\\\\worktrees\\\\%`
@@ -10948,7 +10948,7 @@ var DetectedWebAccounts = object({
10948
10948
  var DetectedWebAccountsEnvelope = DetectedWebAccounts.extend({ accounts: array(unknown()) });
10949
10949
 
10950
10950
  // ../../packages/schema/src/zod/local.ts
10951
- var WORKSPACE_SETTINGS_SPEC_VERSION = 10;
10951
+ var WORKSPACE_SETTINGS_SPEC_VERSION = 11;
10952
10952
  var RunMode = _enum(["standalone", "attached"]);
10953
10953
  var ControlPlaneConnection = object({
10954
10954
  endpoint: string2().min(1),
@@ -11050,6 +11050,15 @@ var BodyRetention = object({
11050
11050
  // candidate set that is already bounded by "delivered, or never owed".
11051
11051
  retainDays: number2().int().min(1).max(3650).default(BODY_RETENTION_DEFAULT_DAYS)
11052
11052
  }).meta({ id: "BodyRetention" });
11053
+ var MAX_PROTECTED_PATH_ENTRIES = 256;
11054
+ var MAX_PROTECTED_PATH_ENTRY_CHARS = 1024;
11055
+ var ProtectedPathEntry = string2().trim().min(1).max(MAX_PROTECTED_PATH_ENTRY_CHARS);
11056
+ var ProtectedPaths = array(unknown()).transform(
11057
+ (entries) => entries.flatMap((entry) => {
11058
+ const parsed = ProtectedPathEntry.safeParse(entry);
11059
+ return parsed.success ? [parsed.data] : [];
11060
+ }).slice(0, MAX_PROTECTED_PATH_ENTRIES)
11061
+ );
11053
11062
  var WorkspaceSettings = object({
11054
11063
  specVersion: number2().int().positive().default(WORKSPACE_SETTINGS_SPEC_VERSION),
11055
11064
  runMode: RunMode.default("standalone"),
@@ -11140,7 +11149,18 @@ var WorkspaceSettings = object({
11140
11149
  bodyRetention: BodyRetention.default({
11141
11150
  enabled: false,
11142
11151
  retainDays: BODY_RETENTION_DEFAULT_DAYS
11143
- })
11152
+ }),
11153
+ // Folders and file name globs whose files a tool call may not touch
11154
+ // unflagged: a Read, Grep, Glob or Bash naming one becomes a finding under
11155
+ // the command-risk pack's policy. Absent means none are protected, and
11156
+ // protectedPathsOf is the one reader.
11157
+ //
11158
+ // A bad entry is dropped on its own (see ProtectedPaths); `.catch(undefined)`
11159
+ // reads a value that is not a list at all as no list. A settings.json that
11160
+ // fails this schema reads as the unonboarded defaults, and the next save
11161
+ // writes those back over it, so a malformed value must not cost every other
11162
+ // setting. Not a ManagedSettingKey.
11163
+ protectedPaths: ProtectedPaths.optional().catch(void 0)
11144
11164
  });
11145
11165
 
11146
11166
  // ../../packages/schema/src/zod/agent-scope.ts
@@ -11304,6 +11324,9 @@ var ConfigInventoryAck = object({
11304
11324
  accepted: number2().int().nonnegative()
11305
11325
  });
11306
11326
 
11327
+ // ../../packages/schema/src/zod/credential-status.ts
11328
+ var CredentialStatus = _enum(["rotation_overdue", "exposed"]).meta({ id: "CredentialStatus" });
11329
+
11307
11330
  // ../../packages/schema/src/zod/registry.ts
11308
11331
  var Namespace = string2().regex(/^[a-z][a-z0-9-]*$/);
11309
11332
  var PackId = string2().regex(/^[a-z][a-z0-9-]*$/);
@@ -13280,6 +13303,11 @@ var CODING_AGENT_PROVIDERS = new Set(
13280
13303
  )
13281
13304
  );
13282
13305
 
13306
+ // ../../packages/persistence/src/repo-key.ts
13307
+ import { createHash as createHash2 } from "crypto";
13308
+ var SLASH = "/".charCodeAt(0);
13309
+ var SCOPE_KEY = printable(ATTACHMENT_SCOPE_IDENTITY_MAX_LENGTH);
13310
+
13283
13311
  // ../../packages/persistence/src/capture-id-key.ts
13284
13312
  import { randomBytes } from "crypto";
13285
13313
  import { readFileSync as readFileSync4 } from "fs";
@@ -13290,16 +13318,9 @@ import { createHash as createHash4, randomUUID as randomUUID3 } from "crypto";
13290
13318
  import { homedir as homedir2 } from "os";
13291
13319
  import { isAbsolute as isAbsolute2, relative as relative2, sep as sep2 } from "path";
13292
13320
 
13293
- // ../../packages/persistence/src/egress-wire.ts
13294
- import { createHash as createHash2 } from "crypto";
13295
-
13296
13321
  // ../../packages/persistence/src/repositories/shares.ts
13297
13322
  import { randomUUID as randomUUID2 } from "crypto";
13298
13323
 
13299
- // ../../packages/persistence/src/egress-wire.ts
13300
- var SLASH = "/".charCodeAt(0);
13301
- var SCOPE_KEY = printable(ATTACHMENT_SCOPE_IDENTITY_MAX_LENGTH);
13302
-
13303
13324
  // ../../packages/persistence/src/git-index.ts
13304
13325
  import { readFileSync as readFileSync5, statSync as statSync3 } from "fs";
13305
13326
  import { dirname, isAbsolute, join as join6, relative, resolve, sep } from "path";