@akasecurity/ai-tc-codex 0.9.18 → 0.9.19
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/.codex-plugin/plugin.json +1 -1
- package/package.json +4 -4
- package/scripts/apply-suppressions.js +3633 -3439
- package/scripts/backfill.js +38358 -38143
- package/scripts/content-retention.js +95 -23
- package/scripts/filescan.js +39297 -39082
- package/scripts/firstrun.js +2857 -2654
- package/scripts/history-sync.js +103 -25
- package/scripts/intro.js +45 -0
- package/scripts/onboard.js +2804 -2610
- package/scripts/post-tool-use.js +3734 -3519
- package/scripts/pre-tool-use.js +38345 -38130
- package/scripts/query.js +2927 -2724
- package/scripts/reconcile.js +38137 -37934
- package/scripts/remediate.js +3705 -3490
- package/scripts/scan-worker.js +45 -0
- package/scripts/session-start.js +3833 -3630
- package/scripts/start-light.js +45 -0
- package/scripts/stop.js +112 -42
- package/scripts/sync.js +4912 -4501
- package/scripts/user-prompt-submit.js +38352 -38137
|
@@ -23163,6 +23163,31 @@ var DeviceCommandAckBody = external_exports.discriminatedUnion("outcome", [
|
|
|
23163
23163
|
projectsScanned: external_exports.number().int().nonnegative()
|
|
23164
23164
|
}).strict()
|
|
23165
23165
|
]);
|
|
23166
|
+
var SIGHTING_KEY_MATERIAL = /^[A-Za-z0-9_-]{42}[AEIMQUYcgkosw048]$/;
|
|
23167
|
+
var sightingKeyMaterial = external_exports.string().regex(SIGHTING_KEY_MATERIAL, "must be the base64url encoding of exactly 32 bytes");
|
|
23168
|
+
var sightingKeyVersion = external_exports.number().int().min(1);
|
|
23169
|
+
var SightingKeyVersion = external_exports.object({
|
|
23170
|
+
keyVersion: sightingKeyVersion,
|
|
23171
|
+
key: sightingKeyMaterial
|
|
23172
|
+
});
|
|
23173
|
+
var SightingKeyResponse = external_exports.object({
|
|
23174
|
+
keyVersion: sightingKeyVersion,
|
|
23175
|
+
algorithm: external_exports.literal("hmac-sha256"),
|
|
23176
|
+
key: sightingKeyMaterial,
|
|
23177
|
+
previous: external_exports.array(SightingKeyVersion).optional()
|
|
23178
|
+
}).refine(
|
|
23179
|
+
(body) => {
|
|
23180
|
+
const versions = [body.keyVersion, ...(body.previous ?? []).map((p) => p.keyVersion)];
|
|
23181
|
+
return new Set(versions).size === versions.length;
|
|
23182
|
+
},
|
|
23183
|
+
{ message: "key versions must be distinct", path: ["previous"] }
|
|
23184
|
+
);
|
|
23185
|
+
var StoredSightingKeys = SightingKeyResponse.and(
|
|
23186
|
+
external_exports.object({
|
|
23187
|
+
fetchedAtMs: external_exports.number().int().nonnegative(),
|
|
23188
|
+
endpointFingerprint: external_exports.string().regex(/^[0-9a-f]{64}$/)
|
|
23189
|
+
})
|
|
23190
|
+
);
|
|
23166
23191
|
|
|
23167
23192
|
// ../../packages/schema/src/zod/registry.ts
|
|
23168
23193
|
var Namespace = external_exports.string().regex(/^[a-z][a-z0-9-]*$/);
|
|
@@ -25156,6 +25181,26 @@ var ManagedSettings = external_exports.object({
|
|
|
25156
25181
|
};
|
|
25157
25182
|
}).meta({ id: "ManagedSettings" });
|
|
25158
25183
|
|
|
25184
|
+
// ../../packages/schema/src/zod/mod-finding.ts
|
|
25185
|
+
var MOD_FINDINGS_MAX_BYTES = 4 * 1024 * 1024;
|
|
25186
|
+
var ModFindingAction = external_exports.enum(["redacted", "vaulted", "blocked", "warned", "logged"]).meta({ id: "ModFindingAction" });
|
|
25187
|
+
var ModFindingWhere = external_exports.enum(["prompt", "attachment", "tool-input", "tool-output", "memory", "subagent"]).meta({ id: "ModFindingWhere" });
|
|
25188
|
+
var ModFinding = external_exports.strictObject({
|
|
25189
|
+
v: external_exports.literal(1),
|
|
25190
|
+
id: external_exports.string().regex(/^[0-9a-f]{16}$/),
|
|
25191
|
+
at: external_exports.iso.datetime(),
|
|
25192
|
+
ruleId: external_exports.string().min(1),
|
|
25193
|
+
shortName: external_exports.string().min(1).max(64).optional(),
|
|
25194
|
+
category: DetectionCategory,
|
|
25195
|
+
severity: Severity,
|
|
25196
|
+
action: ModFindingAction,
|
|
25197
|
+
where: ModFindingWhere,
|
|
25198
|
+
pointer: external_exports.string().regex(POINTER_TOKEN_ANCHORED).optional()
|
|
25199
|
+
}).refine((f) => f.action === "vaulted" === (f.pointer !== void 0), {
|
|
25200
|
+
path: ["pointer"],
|
|
25201
|
+
message: "pointer is present only for a vaulted finding, and a vaulted finding has one"
|
|
25202
|
+
}).meta({ id: "ModFinding" });
|
|
25203
|
+
|
|
25159
25204
|
// ../../packages/schema/src/zod/mod-policy-snapshot.ts
|
|
25160
25205
|
var MOD_POLICY_SNAPSHOT_VERSION = 1;
|
|
25161
25206
|
var MOD_POLICY_SNAPSHOT_MAX_BYTES = 4 * 1024 * 1024;
|
|
@@ -27930,12 +27975,21 @@ var TIMELINE_COLUMNS = `
|
|
|
27930
27975
|
json_extract(attributes, '$.targetId') AS target_id,
|
|
27931
27976
|
json_extract(attributes, '$.internal') AS internal,
|
|
27932
27977
|
json_extract(attributes, '$.flagged') AS flagged`;
|
|
27978
|
+
var CALL_WRITE_SPLIT = `(coalesce(ephemeral_1h_input_tokens, 0) + coalesce(ephemeral_5m_input_tokens, 0))`;
|
|
27933
27979
|
var CALL_PROMPT_TOKENS = `(coalesce(input_tokens, 0) + coalesce(cache_read_input_tokens, 0)
|
|
27934
|
-
+ max(coalesce(cache_creation_input_tokens, 0),
|
|
27935
|
-
|
|
27936
|
-
|
|
27937
|
-
" + "
|
|
27980
|
+
+ max(coalesce(cache_creation_input_tokens, 0), ${CALL_WRITE_SPLIT}))`;
|
|
27981
|
+
var CALL_BAND = LONG_CONTEXT_THRESHOLDS.map(
|
|
27982
|
+
(t) => `(${CALL_PROMPT_TOKENS} > ${String(Math.trunc(t))})`
|
|
27938
27983
|
);
|
|
27984
|
+
var CALL_USAGE_SHAPE = [
|
|
27985
|
+
"coalesce(input_tokens, 0) > 0",
|
|
27986
|
+
"coalesce(output_tokens, 0) > 0",
|
|
27987
|
+
"coalesce(cache_read_input_tokens, 0) > 0",
|
|
27988
|
+
"coalesce(ephemeral_1h_input_tokens, 0) > 0",
|
|
27989
|
+
"coalesce(ephemeral_5m_input_tokens, 0) > 0",
|
|
27990
|
+
`coalesce(cache_creation_input_tokens, 0) > ${CALL_WRITE_SPLIT}`,
|
|
27991
|
+
"coalesce(web_search_requests, 0) > 0"
|
|
27992
|
+
].map((condition) => `(${condition})`);
|
|
27939
27993
|
var LLM_USAGE_SELECT = `
|
|
27940
27994
|
SELECT root_session_id AS sessionId,
|
|
27941
27995
|
provider,
|
|
@@ -27950,7 +28004,14 @@ var LLM_USAGE_SELECT = `
|
|
|
27950
28004
|
coalesce(sum(web_search_requests), 0) AS webSearchRequests,
|
|
27951
28005
|
coalesce(max(${CALL_PROMPT_TOKENS}), 0) AS promptTokens`;
|
|
27952
28006
|
var LLM_USAGE_SCOPE = `event_type = 'llm_call' AND attributes IS NOT NULL AND root_session_id IS NOT NULL`;
|
|
27953
|
-
var LLM_USAGE_GROUP = `GROUP BY
|
|
28007
|
+
var LLM_USAGE_GROUP = `GROUP BY ${[
|
|
28008
|
+
"root_session_id",
|
|
28009
|
+
"provider",
|
|
28010
|
+
"model",
|
|
28011
|
+
"service_tier",
|
|
28012
|
+
...CALL_BAND.length === 0 ? [] : [CALL_BAND.join(" + ")],
|
|
28013
|
+
...CALL_USAGE_SHAPE
|
|
28014
|
+
].join(", ")}`;
|
|
27954
28015
|
function usageLeaves(rows) {
|
|
27955
28016
|
return rows.map((row) => {
|
|
27956
28017
|
const attributes = {
|
|
@@ -28236,7 +28297,9 @@ var SqliteActivityRepository = class {
|
|
|
28236
28297
|
* store carries, since opening runs the migrations, so the hard requirement
|
|
28237
28298
|
* `INDEXED BY` introduces is already met; token-rollup-plans.test.ts pins
|
|
28238
28299
|
* the plan. All-time is a scan of the whole index — still one narrow entry
|
|
28239
|
-
* per call, no bag parsed.
|
|
28300
|
+
* per call, no bag parsed. The usage-shape terms in the key cost the
|
|
28301
|
+
* all-time read ~9 ms at 50k calls (34 → 43 ms, fastest of the run), against
|
|
28302
|
+
* 68 ms for folding the bags in JS.
|
|
28240
28303
|
*/
|
|
28241
28304
|
tokenReports(fromMs) {
|
|
28242
28305
|
const rows = allRows(
|
|
@@ -28251,8 +28314,8 @@ var SqliteActivityRepository = class {
|
|
|
28251
28314
|
return Promise.resolve(buildTokenReports(usageLeaves(rows), defaultCostModel));
|
|
28252
28315
|
}
|
|
28253
28316
|
/**
|
|
28254
|
-
* One session's token report — its `llm_call`s grouped
|
|
28255
|
-
*
|
|
28317
|
+
* One session's token report — its `llm_call`s grouped as `tokenReports`
|
|
28318
|
+
* groups them (see LlmUsageRow) with derived cost, or `null` when the session made no
|
|
28256
28319
|
* `llm_call`s (an empty/tool-only session). Feeds the session-detail pane's
|
|
28257
28320
|
* per-model breakdown + estimated cost. The same rollup as `tokenReports`,
|
|
28258
28321
|
* seeking one root through a root-led `llm_call` index; the bag-reading fold
|
|
@@ -35189,21 +35252,27 @@ import {
|
|
|
35189
35252
|
createDecipheriv,
|
|
35190
35253
|
createHmac as createHmac2,
|
|
35191
35254
|
hkdfSync,
|
|
35255
|
+
randomBytes as randomBytes2,
|
|
35192
35256
|
timingSafeEqual
|
|
35193
35257
|
} from "crypto";
|
|
35194
35258
|
|
|
35195
35259
|
// ../../packages/persistence/src/vault/key-provider.ts
|
|
35196
35260
|
import { execFileSync } from "child_process";
|
|
35197
|
-
import { randomBytes as
|
|
35261
|
+
import { randomBytes as randomBytes3 } from "crypto";
|
|
35198
35262
|
import { chmodSync as chmodSync3, readFileSync as readFileSync10, renameSync as renameSync4, rmSync as rmSync6, statSync as statSync5, writeFileSync as writeFileSync3 } from "fs";
|
|
35199
35263
|
import { join as join15 } from "path";
|
|
35200
35264
|
|
|
35265
|
+
// ../../packages/persistence/src/vault/sighting-keys.ts
|
|
35266
|
+
import { createHash as createHash6 } from "crypto";
|
|
35267
|
+
import { readFileSync as readFileSync11, rmSync as rmSync7 } from "fs";
|
|
35268
|
+
import { join as join16 } from "path";
|
|
35269
|
+
|
|
35201
35270
|
// ../../packages/persistence/src/vault/vault.ts
|
|
35202
|
-
import { randomBytes as
|
|
35271
|
+
import { randomBytes as randomBytes4, randomUUID as randomUUID12 } from "crypto";
|
|
35203
35272
|
|
|
35204
35273
|
// ../../packages/persistence/src/warn-era-cap.ts
|
|
35205
35274
|
import { existsSync as existsSync7, writeFileSync as writeFileSync4 } from "fs";
|
|
35206
|
-
import { join as
|
|
35275
|
+
import { join as join17 } from "path";
|
|
35207
35276
|
|
|
35208
35277
|
// ../../packages/remote/src/http.ts
|
|
35209
35278
|
import { request as httpRequest } from "http";
|
|
@@ -35217,16 +35286,16 @@ var SLASH2 = "/".charCodeAt(0);
|
|
|
35217
35286
|
var REQUEST_TIMEOUT_MS = 2e3;
|
|
35218
35287
|
|
|
35219
35288
|
// ../../packages/plugin-runtime/src/attached/forward-drops.ts
|
|
35220
|
-
import { readFileSync as
|
|
35221
|
-
import { join as
|
|
35289
|
+
import { readFileSync as readFileSync12 } from "fs";
|
|
35290
|
+
import { join as join18 } from "path";
|
|
35222
35291
|
|
|
35223
35292
|
// ../../packages/plugin-runtime/src/attached/forward-policy.ts
|
|
35224
35293
|
import { randomUUID as randomUUID13 } from "crypto";
|
|
35225
35294
|
import { readFile, rename, writeFile } from "fs/promises";
|
|
35226
|
-
import { join as
|
|
35295
|
+
import { join as join19 } from "path";
|
|
35227
35296
|
|
|
35228
35297
|
// ../../packages/plugin-runtime/src/attached/history-sync.ts
|
|
35229
|
-
import { createHash as
|
|
35298
|
+
import { createHash as createHash7 } from "crypto";
|
|
35230
35299
|
import { hostname as hostname4 } from "os";
|
|
35231
35300
|
|
|
35232
35301
|
// ../../packages/plugin-runtime/src/attached/capture-rebuild.ts
|
|
@@ -35246,16 +35315,16 @@ var HISTORY_SYNC_THROTTLE_MS = 5 * 60 * 1e3;
|
|
|
35246
35315
|
|
|
35247
35316
|
// ../../packages/plugin-runtime/src/attached/install-record.ts
|
|
35248
35317
|
import { readFile as readFile2, stat } from "fs/promises";
|
|
35249
|
-
import { basename as basename2, dirname as dirname4, join as
|
|
35318
|
+
import { basename as basename2, dirname as dirname4, join as join20, resolve as resolve2 } from "path";
|
|
35250
35319
|
|
|
35251
35320
|
// ../../packages/plugin-runtime/src/attached/plugin-block.ts
|
|
35252
|
-
import { readFileSync as
|
|
35321
|
+
import { readFileSync as readFileSync13 } from "fs";
|
|
35253
35322
|
var INSTALL_RECORD_READ_TIMEOUT_MS = REQUEST_TIMEOUT_MS / 2;
|
|
35254
35323
|
|
|
35255
35324
|
// ../../packages/plugin-runtime/src/attached/policy-store.ts
|
|
35256
35325
|
import { randomUUID as randomUUID14 } from "crypto";
|
|
35257
35326
|
import { readFile as readFile3, rm, writeFile as writeFile2 } from "fs/promises";
|
|
35258
|
-
import { join as
|
|
35327
|
+
import { join as join21 } from "path";
|
|
35259
35328
|
|
|
35260
35329
|
// ../../packages/plugin-runtime/src/attached/atomic-publish.ts
|
|
35261
35330
|
import { rename as rename2 } from "fs/promises";
|
|
@@ -35264,8 +35333,8 @@ var TIMED_RETRIES = 4;
|
|
|
35264
35333
|
var ATTEMPTS = 1 + IMMEDIATE_RETRIES + TIMED_RETRIES;
|
|
35265
35334
|
|
|
35266
35335
|
// ../../packages/plugin-runtime/src/attached/posture-report-state.ts
|
|
35267
|
-
import { readFileSync as
|
|
35268
|
-
import { join as
|
|
35336
|
+
import { readFileSync as readFileSync14 } from "fs";
|
|
35337
|
+
import { join as join22 } from "path";
|
|
35269
35338
|
var OUTCOME_KEYS = {
|
|
35270
35339
|
ok: true,
|
|
35271
35340
|
unauthorized: true,
|
|
@@ -35288,11 +35357,11 @@ import { DatabaseSync as DatabaseSync3 } from "node:sqlite";
|
|
|
35288
35357
|
// ../../packages/plugin-runtime/src/attached/posture-store.ts
|
|
35289
35358
|
import { randomUUID as randomUUID15 } from "crypto";
|
|
35290
35359
|
import { readFile as readFile4, rm as rm2, writeFile as writeFile3 } from "fs/promises";
|
|
35291
|
-
import { join as
|
|
35360
|
+
import { join as join23 } from "path";
|
|
35292
35361
|
|
|
35293
35362
|
// ../../packages/plugin-runtime/src/attached/sync-state.ts
|
|
35294
|
-
import { readFileSync as
|
|
35295
|
-
import { join as
|
|
35363
|
+
import { readFileSync as readFileSync15 } from "fs";
|
|
35364
|
+
import { join as join24 } from "path";
|
|
35296
35365
|
|
|
35297
35366
|
// ../../packages/plugin-runtime/src/attached/status.ts
|
|
35298
35367
|
var REFUSAL_LINES = {
|
|
@@ -35308,6 +35377,9 @@ var OUTCOME_LINES = {
|
|
|
35308
35377
|
"invalid-bundle": "control plane sent a policy bundle this build cannot read"
|
|
35309
35378
|
};
|
|
35310
35379
|
|
|
35380
|
+
// ../../packages/plugin-runtime/src/attached/sighting-key-sync.ts
|
|
35381
|
+
var SIGHTING_KEY_MAX_AGE_MS = 24 * 60 * 60 * 1e3;
|
|
35382
|
+
|
|
35311
35383
|
// ../../packages/plugin-runtime/src/attached/sync-trigger.ts
|
|
35312
35384
|
import { spawn as spawn2 } from "child_process";
|
|
35313
35385
|
import { fileURLToPath as fileURLToPath2 } from "url";
|