@akasecurity/ai-tc-copilot 0.9.20-bootstrap.0 → 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/LICENSE +201 -0
- package/README.md +1 -1
- package/package.json +18 -19
- package/plugin.json +1 -1
- package/scripts/content-retention.js +83 -16
- package/scripts/fail-open-count.js +33 -9
- package/scripts/history-sync.js +290 -26
- package/scripts/post-tool-use.js +482 -120
- package/scripts/pre-tool-use.js +473 -118
- package/scripts/scan-worker.js +28 -2
- package/scripts/session-start.js +431 -134
- package/scripts/sync.js +682 -138
- package/scripts/user-prompt-submit.js +483 -121
- package/skills/setup/SKILL.md +55 -30
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2026 AKA Security
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
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
|
|
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.
|
|
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",
|
|
@@ -20,27 +20,26 @@
|
|
|
20
20
|
"registry": "https://registry.npmjs.org",
|
|
21
21
|
"access": "public"
|
|
22
22
|
},
|
|
23
|
-
"scripts": {
|
|
24
|
-
"build": "tsup",
|
|
25
|
-
"dev": "tsup --watch",
|
|
26
|
-
"lint": "eslint src test *.config.*",
|
|
27
|
-
"test": "vitest run",
|
|
28
|
-
"typecheck": "tsc --noEmit",
|
|
29
|
-
"prepack": "tsup"
|
|
30
|
-
},
|
|
31
23
|
"devDependencies": {
|
|
32
|
-
"@akasecurity/eslint-config": "workspace:*",
|
|
33
|
-
"@akasecurity/persistence": "workspace:*",
|
|
34
|
-
"@akasecurity/plugin-runtime": "workspace:*",
|
|
35
|
-
"@akasecurity/plugin-sdk": "workspace:*",
|
|
36
|
-
"@akasecurity/scanner": "workspace:*",
|
|
37
|
-
"@akasecurity/schema": "workspace:*",
|
|
38
|
-
"@akasecurity/setup-wizard": "workspace:*",
|
|
39
24
|
"@types/node": "^25.9.9",
|
|
40
|
-
"@vitest/coverage-v8": "^4.1.
|
|
25
|
+
"@vitest/coverage-v8": "^4.1.12",
|
|
41
26
|
"eslint": "^9.39.5",
|
|
42
27
|
"tsup": "^9.0.0",
|
|
43
28
|
"typescript": "^5.8.0",
|
|
44
|
-
"vitest": "^4.1.
|
|
29
|
+
"vitest": "^4.1.12",
|
|
30
|
+
"@akasecurity/persistence": "0.8.0",
|
|
31
|
+
"@akasecurity/plugin-runtime": "0.8.0",
|
|
32
|
+
"@akasecurity/scanner": "0.8.0",
|
|
33
|
+
"@akasecurity/schema": "0.8.0",
|
|
34
|
+
"@akasecurity/plugin-sdk": "0.8.0",
|
|
35
|
+
"@akasecurity/eslint-config": "0.8.0",
|
|
36
|
+
"@akasecurity/setup-wizard": "0.8.0"
|
|
37
|
+
},
|
|
38
|
+
"scripts": {
|
|
39
|
+
"build": "tsup",
|
|
40
|
+
"dev": "tsup --watch",
|
|
41
|
+
"lint": "eslint src test *.config.*",
|
|
42
|
+
"test": "vitest run",
|
|
43
|
+
"typecheck": "tsc --noEmit"
|
|
45
44
|
}
|
|
46
|
-
}
|
|
45
|
+
}
|
package/plugin.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aka-copilot",
|
|
3
|
-
"version": "0.9.
|
|
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 =
|
|
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
|
|
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 ${
|
|
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 ${
|
|
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 ${
|
|
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 =
|
|
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-]*$/);
|
|
@@ -13103,6 +13126,7 @@ var POLYNOMIAL_PROBES = ["abc-", "a.", "a ", "a=", "x", "0", "a@", "a/", "ab"].m
|
|
|
13103
13126
|
);
|
|
13104
13127
|
var CPU_CORROBORATION_SHARE = 0.2;
|
|
13105
13128
|
var CORROBORATION_FLOOR_MS = BUDGET_MS * CPU_CORROBORATION_SHARE;
|
|
13129
|
+
var MAX_GROWTH_RATIO = 3;
|
|
13106
13130
|
function repeatTo(unit, length) {
|
|
13107
13131
|
return unit.repeat(Math.ceil(length / unit.length)).slice(0, length);
|
|
13108
13132
|
}
|
|
@@ -13139,6 +13163,8 @@ var GROWTH_CORPORA = [
|
|
|
13139
13163
|
build: (length) => repeatTo(unit, length)
|
|
13140
13164
|
}))
|
|
13141
13165
|
];
|
|
13166
|
+
var QUADRATIC_GROWTH = 4;
|
|
13167
|
+
var SAMPLED_GROWTH = MAX_GROWTH_RATIO ** 2 / QUADRATIC_GROWTH;
|
|
13142
13168
|
|
|
13143
13169
|
// ../../packages/detections/src/variable-name.ts
|
|
13144
13170
|
var VARIABLE_NAME_LOOKBEHIND = MAX_VARIABLE_NAME_LENGTH + 64;
|
|
@@ -13277,6 +13303,11 @@ var CODING_AGENT_PROVIDERS = new Set(
|
|
|
13277
13303
|
)
|
|
13278
13304
|
);
|
|
13279
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
|
+
|
|
13280
13311
|
// ../../packages/persistence/src/capture-id-key.ts
|
|
13281
13312
|
import { randomBytes } from "crypto";
|
|
13282
13313
|
import { readFileSync as readFileSync4 } from "fs";
|
|
@@ -13287,16 +13318,9 @@ import { createHash as createHash4, randomUUID as randomUUID3 } from "crypto";
|
|
|
13287
13318
|
import { homedir as homedir2 } from "os";
|
|
13288
13319
|
import { isAbsolute as isAbsolute2, relative as relative2, sep as sep2 } from "path";
|
|
13289
13320
|
|
|
13290
|
-
// ../../packages/persistence/src/egress-wire.ts
|
|
13291
|
-
import { createHash as createHash2 } from "crypto";
|
|
13292
|
-
|
|
13293
13321
|
// ../../packages/persistence/src/repositories/shares.ts
|
|
13294
13322
|
import { randomUUID as randomUUID2 } from "crypto";
|
|
13295
13323
|
|
|
13296
|
-
// ../../packages/persistence/src/egress-wire.ts
|
|
13297
|
-
var SLASH = "/".charCodeAt(0);
|
|
13298
|
-
var SCOPE_KEY = printable(ATTACHMENT_SCOPE_IDENTITY_MAX_LENGTH);
|
|
13299
|
-
|
|
13300
13324
|
// ../../packages/persistence/src/git-index.ts
|
|
13301
13325
|
import { readFileSync as readFileSync5, statSync as statSync3 } from "fs";
|
|
13302
13326
|
import { dirname, isAbsolute, join as join6, relative, resolve, sep } from "path";
|