@cortexkit/opencode-magic-context 0.49.34 → 0.49.35
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/dist/auto-search-worker.js +11 -6
- package/dist/chunk-embedding-write-worker.js +16 -14
- package/dist/{compaction-marker-candidates-31h86ph0.js → compaction-marker-candidates-g0p67ced.js} +3 -2
- package/dist/compaction-marker-candidates-worker.js +1 -1
- package/dist/{compartment-chunk-embedding-5q5gj67r.js → compartment-chunk-embedding-y4136are.js} +8 -7
- package/dist/{conflict-warning-hook-xgskea1v.js → conflict-warning-hook-hhw8z5ak.js} +9 -8
- package/dist/{context-p3xrarzt.js → context-fk8e3h9p.js} +1400 -701
- package/dist/{derive-budgets-pqybnx09.js → derive-budgets-htj16n4x.js} +3 -2
- package/dist/embedding-backfill-q6n72sy0.js +27 -0
- package/dist/embedding-worker-process.js +2 -1
- package/dist/embedding-worker.js +5 -4
- package/dist/expand-attachments-h33jbgyz.js +21 -0
- package/dist/features/magic-context/auto-search-diagnostics.d.ts +21 -0
- package/dist/features/magic-context/auto-search-diagnostics.d.ts.map +1 -0
- package/dist/features/magic-context/compartment-chunk-embedding.d.ts +1 -1
- package/dist/features/magic-context/compartment-chunk-embedding.d.ts.map +1 -1
- package/dist/features/magic-context/search.d.ts +4 -0
- package/dist/features/magic-context/search.d.ts.map +1 -1
- package/dist/features/magic-context/store-generation-rebase-labels.d.ts +6 -0
- package/dist/features/magic-context/store-generation-rebase-labels.d.ts.map +1 -0
- package/dist/features/magic-context/store-generation-rebase.d.ts.map +1 -1
- package/dist/{history-owner-36wp3mkb.js → history-owner-0z620wgz.js} +3 -2
- package/dist/hooks/magic-context/apply-operations.d.ts +20 -3
- package/dist/hooks/magic-context/apply-operations.d.ts.map +1 -1
- package/dist/hooks/magic-context/auto-search-observation.d.ts +13 -0
- package/dist/hooks/magic-context/auto-search-observation.d.ts.map +1 -0
- package/dist/hooks/magic-context/auto-search-runner.d.ts.map +1 -1
- package/dist/hooks/magic-context/auto-search-worker-client.d.ts +5 -1
- package/dist/hooks/magic-context/auto-search-worker-client.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-commit-hashes.d.ts +4 -0
- package/dist/hooks/magic-context/compartment-commit-hashes.d.ts.map +1 -0
- package/dist/hooks/magic-context/compartment-runner-validation.d.ts +1 -0
- package/dist/hooks/magic-context/compartment-runner-validation.d.ts.map +1 -1
- package/dist/hooks/magic-context/event-resolvers.d.ts.map +1 -1
- package/dist/hooks/magic-context/final-wire-completeness.d.ts +15 -0
- package/dist/hooks/magic-context/final-wire-completeness.d.ts.map +1 -0
- package/dist/hooks/magic-context/final-wire-token-estimate.d.ts.map +1 -1
- package/dist/hooks/magic-context/raw-ordinal-warmup.d.ts +1 -0
- package/dist/hooks/magic-context/raw-ordinal-warmup.d.ts.map +1 -1
- package/dist/hooks/magic-context/read-session-chunk.d.ts +11 -0
- package/dist/hooks/magic-context/read-session-chunk.d.ts.map +1 -1
- package/dist/hooks/magic-context/read-session-formatting.d.ts +2 -0
- package/dist/hooks/magic-context/read-session-formatting.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform-postprocess-phase.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform.d.ts.map +1 -1
- package/dist/{index-as2amvn3.js → index-0c7p8mq5.js} +6 -531
- package/dist/{index-51rdvtkz.js → index-1rhgxqs8.js} +2 -2
- package/dist/index-2amn2s73.js +123 -0
- package/dist/{index-c7phnbvk.js → index-2p37txes.js} +1 -1
- package/dist/index-2qbtqg1w.js +529 -0
- package/dist/{index-waktfbjy.js → index-2v6nvy3k.js} +4 -4
- package/dist/{index-ftr84kkv.js → index-3d3872c6.js} +7 -5
- package/dist/{index-0677w9sd.js → index-3j9t1v4n.js} +55 -21
- package/dist/{index-atekmqef.js → index-4bgk5ztz.js} +363 -5499
- package/dist/{index-b88dwwrh.js → index-4xyjr62e.js} +1 -1
- package/dist/index-66a50f3e.js +777 -0
- package/dist/{index-04z754rd.js → index-87ctnzz9.js} +33 -5
- package/dist/{index-xrnsygfq.js → index-9wnbnx8f.js} +1 -1
- package/dist/{index-97spytxq.js → index-b6xz3qbe.js} +246 -420
- package/dist/{index-7g9dr8gy.js → index-brg2w6qc.js} +113 -133
- package/dist/{index-spwjbkc7.js → index-dnqqqc5f.js} +1 -1
- package/dist/index-dy7w6wm4.js +194 -0
- package/dist/{index-m1x9ghk5.js → index-ezv6dz3y.js} +37 -7
- package/dist/index-f297z1n8.js +4557 -0
- package/dist/{index-qgh1qwjj.js → index-f9b3vtt1.js} +1 -1
- package/dist/{index-v15ne3a3.js → index-faxb7mck.js} +2 -2
- package/dist/{index-rrv26qjz.js → index-fw42ms3m.js} +1 -1
- package/dist/{index-t5pck3ss.js → index-fxbk7gk3.js} +1 -1
- package/dist/{index-wfybj1dw.js → index-g4t7850m.js} +2 -2
- package/dist/{index-fm36bjv4.js → index-gyaa159j.js} +18 -276
- package/dist/{index-4pnsgvfk.js → index-hacf2tyx.js} +1 -1
- package/dist/{index-s1n8dd2n.js → index-jkanybgq.js} +2 -2
- package/dist/{index-2743x98y.js → index-jn0ddrhp.js} +29 -138
- package/dist/{index-h7tgn49j.js → index-jrfre9ah.js} +5 -222
- package/dist/{index-kfyb3k6n.js → index-jz5bk7xd.js} +2 -2
- package/dist/{index-np3rgfw4.js → index-ksv0a31x.js} +3 -3
- package/dist/{index-7kkphb6c.js → index-nj360hcs.js} +4 -4
- package/dist/{index-gkee6p4g.js → index-p56dszfp.js} +3 -3
- package/dist/{index-9gpw8hrm.js → index-pq0dpwrc.js} +4 -4
- package/dist/{index-rfxzazzy.js → index-pswsyf1w.js} +4 -4
- package/dist/{index-y1qwzvxn.js → index-pztqab6k.js} +2 -2
- package/dist/{index-rverk2vz.js → index-qncw9hey.js} +1 -1
- package/dist/index-qx8j6kds.js +270 -0
- package/dist/{index-kq5w68dp.js → index-txs8tce6.js} +1 -1
- package/dist/index-vzhhr1ht.js +532 -0
- package/dist/index-wh9fxds5.js +265 -0
- package/dist/{index-hbx7m8he.js → index-x2mrq5xv.js} +170 -48
- package/dist/{index-07vskjn8.js → index-xwwsbsd3.js} +15 -13
- package/dist/index-z4p0ry94.js +222 -0
- package/dist/index-z9zygwse.js +89 -0
- package/dist/{index-v7287tzq.js → index-zhqwda72.js} +19 -8
- package/dist/index.js +83 -72
- package/dist/{logger-94kew5wm.js → logger-qwnbcfj9.js} +2 -1
- package/dist/{message-fts-rowid-map-va36knh4.js → message-fts-rowid-map-xg7hr0mk.js} +5 -4
- package/dist/{message-index-bounded-qh91fdr3.js → message-index-bounded-narw7bnz.js} +12 -11
- package/dist/{message-time-backfill-4qva0b4f.js → message-time-backfill-39bm498k.js} +3 -2
- package/dist/migration-worker.js +13 -11
- package/dist/{project-embedding-registry-6yex0r9f.js → project-embedding-registry-tdz7985n.js} +13 -11
- package/dist/raw-ordinal-warmup-worker.js +12 -7
- package/dist/{read-session-chunk-kaghtr75.js → read-session-chunk-vmg1zjg0.js} +15 -10
- package/dist/{read-session-raw-b2sd67v4.js → read-session-raw-mncmzbm9.js} +3 -2
- package/dist/recomp-orchestrator-qyyhnc9b.js +68 -0
- package/dist/render-c5p0k846.js +43 -0
- package/dist/{safe-notification-target-mkr9yzvr.js → safe-notification-target-wztd7bgk.js} +3 -2
- package/dist/{search-archive-1kw2rp19.js → search-archive-0ny7p3bw.js} +13 -11
- package/dist/{search-p684j8ww.js → search-f6hwvcxk.js} +26 -23
- package/dist/{send-session-notification-vz86nt79.js → send-session-notification-0gwcz3fw.js} +7 -6
- package/dist/{storage-tags-6hvkk01c.js → storage-tags-zx1023km.js} +5 -4
- package/dist/store-620rjzt9.js +21 -0
- package/dist/store-reader-yh19h38c.js +14 -0
- package/dist/tools/ctx-expand/render.d.ts +5 -3
- package/dist/tools/ctx-expand/render.d.ts.map +1 -1
- package/dist/tools/ctx-expand/search-archive.d.ts.map +1 -1
- package/dist/tools/ctx-expand/tools.d.ts +2 -0
- package/dist/tools/ctx-expand/tools.d.ts.map +1 -1
- package/dist/tools/ctx-expand/v2-archive-reader.d.ts +33 -0
- package/dist/tools/ctx-expand/v2-archive-reader.d.ts.map +1 -0
- package/dist/{transform-postprocess-phase-ph38mhrs.js → transform-postprocess-phase-807ff6t2.js} +36 -30
- package/dist/v2/auto-search-worker.js +11 -6
- package/dist/v2/chunk-embedding-write-worker.js +16 -14
- package/dist/v2/{compaction-marker-candidates-m4vmye3w.js → compaction-marker-candidates-t1aq6gsj.js} +3 -2
- package/dist/v2/compaction-marker-candidates-worker.js +1 -1
- package/dist/v2/{compartment-chunk-embedding-rc31e6md.js → compartment-chunk-embedding-ncsk0r9e.js} +8 -7
- package/dist/v2/{context-s60hcatx.js → context-znqfkap4.js} +1725 -1095
- package/dist/v2/{derive-budgets-knf763tt.js → derive-budgets-sa0v7bz0.js} +4 -3
- package/dist/v2/embedding-backfill-11j425e0.js +26 -0
- package/dist/v2/embedding-worker-process.js +2 -1
- package/dist/v2/embedding-worker.js +5 -4
- package/dist/v2/expand-attachments-h33jbgyz.js +21 -0
- package/dist/v2/fold/idle.d.ts +15 -0
- package/dist/v2/fold/idle.d.ts.map +1 -0
- package/dist/v2/fold/native-replay-v3.d.ts +68 -0
- package/dist/v2/fold/native-replay-v3.d.ts.map +1 -0
- package/dist/v2/fold/native-replay.d.ts +58 -2
- package/dist/v2/fold/native-replay.d.ts.map +1 -1
- package/dist/v2/fold/policy.d.ts +2 -1
- package/dist/v2/fold/policy.d.ts.map +1 -1
- package/dist/v2/{history-owner-ad0crnrn.js → history-owner-fpka43cn.js} +3 -2
- package/dist/v2/hooks/context.d.ts.map +1 -1
- package/dist/v2/hooks/expand-attachments.d.ts +8 -0
- package/dist/v2/hooks/expand-attachments.d.ts.map +1 -0
- package/dist/v2/hooks/overflow-recovery.d.ts +45 -0
- package/dist/v2/hooks/overflow-recovery.d.ts.map +1 -0
- package/dist/v2/hooks/store.d.ts +7 -2
- package/dist/v2/hooks/store.d.ts.map +1 -1
- package/dist/v2/{logger-p34mjtja.js → logger-4cj6d03m.js} +2 -1
- package/dist/v2/{message-fts-rowid-map-78awh03v.js → message-fts-rowid-map-rmk571mb.js} +5 -4
- package/dist/v2/{message-index-bounded-4htdr1j6.js → message-index-bounded-620bppw7.js} +12 -11
- package/dist/v2/{message-time-backfill-zvthw6xb.js → message-time-backfill-0c4h7sg6.js} +3 -2
- package/dist/v2/migration-worker.js +13 -11
- package/dist/v2/ordinal-range.fixture.d.ts +7 -0
- package/dist/v2/ordinal-range.fixture.d.ts.map +1 -0
- package/dist/v2/{project-embedding-registry-1x5qe2fy.js → project-embedding-registry-bm5fe1a8.js} +13 -11
- package/dist/v2/raw-ordinal-warmup-worker.js +12 -7
- package/dist/v2/{read-session-chunk-1fa9qzwb.js → read-session-chunk-qfwv1k71.js} +15 -10
- package/dist/v2/{read-session-raw-5x088amc.js → read-session-raw-q294t8xs.js} +3 -2
- package/dist/v2/recomp-orchestrator-fcnjref7.js +67 -0
- package/dist/v2/render-98a1qv0b.js +42 -0
- package/dist/v2/{safe-notification-target-khnzg57c.js → safe-notification-target-gphhast7.js} +3 -2
- package/dist/v2/{search-archive-xfp51s0g.js → search-archive-r0y1bafr.js} +13 -11
- package/dist/v2/{search-wf8rqxhm.js → search-z1zqzsmh.js} +25 -22
- package/dist/v2/{send-session-notification-x5nzy34v.js → send-session-notification-fst6hkg7.js} +7 -6
- package/dist/v2/{server-qvy4qavp.js → server-1xesqm5h.js} +113 -133
- package/dist/v2/server-2amn2s73.js +123 -0
- package/dist/v2/{server-6g98c227.js → server-3schkz95.js} +4 -4
- package/dist/v2/server-468mya5v.js +209 -0
- package/dist/v2/server-55v5hpth.js +270 -0
- package/dist/v2/server-5jp38p98.js +532 -0
- package/dist/v2/{server-qjvk4a9t.js → server-69m30b21.js} +1 -1
- package/dist/v2/{server-jw5qe9y8.js → server-7ccxt4nq.js} +14 -216
- package/dist/v2/{server-3mz2qh5a.js → server-969cdpmg.js} +1 -1
- package/dist/v2/{server-835q39kd.js → server-9k0mjef7.js} +2 -2
- package/dist/v2/{server-qc915kw2.js → server-bez34e60.js} +4 -4
- package/dist/v2/{server-nxas8v1d.js → server-bpvsvtph.js} +3 -3
- package/dist/v2/{server-ab8017gw.js → server-bxpz2dcn.js} +29 -138
- package/dist/v2/{server-bsgd4dk1.js → server-dcws5831.js} +2 -2
- package/dist/v2/server-ef1mskas.js +777 -0
- package/dist/v2/{server-1bw1wcbp.js → server-f0j864ma.js} +1 -1
- package/dist/v2/{server-z2wft9zv.js → server-fqj6ddpr.js} +402 -5497
- package/dist/v2/{server-grakwy1v.js → server-hnknwaz8.js} +37 -7
- package/dist/v2/{server-h1byrhwx.js → server-hsf0qsn5.js} +19 -8
- package/dist/v2/{server-6495nmn9.js → server-jb6tjyeb.js} +5 -222
- package/dist/v2/{server-2aasmpsp.js → server-kkxzwa6w.js} +4 -4
- package/dist/v2/{server-a7x00tw8.js → server-mfn1yf9d.js} +1 -1
- package/dist/v2/{server-tkdabx8q.js → server-q0z2q2dx.js} +5 -530
- package/dist/v2/{server-ajxhrgjv.js → server-qa74bj91.js} +77 -17
- package/dist/v2/server-qf2kzsh2.js +4513 -0
- package/dist/v2/{server-gyy4k6mf.js → server-qmmkhz2z.js} +1 -1
- package/dist/v2/{server-29qp8nz4.js → server-qxzbmtqt.js} +1 -1
- package/dist/v2/{server-m1pfg2d4.js → server-r3chnxs5.js} +4 -4
- package/dist/v2/{server-vr4szghm.js → server-rktnzs89.js} +2 -2
- package/dist/v2/{server-6vd2n183.js → server-s9xgyyj9.js} +1 -1
- package/dist/v2/{server-53eh1r8r.js → server-sd8hvzte.js} +2 -2
- package/dist/v2/{server-k3t06fxr.js → server-sefxj8k1.js} +1 -1
- package/dist/v2/{server-v77xa5wj.js → server-tpt7bwq8.js} +1 -1
- package/dist/v2/{server-awr8qa4c.js → server-ws5exe6q.js} +2 -2
- package/dist/v2/server-x4m6xcn4.js +194 -0
- package/dist/v2/{server-806rzhs6.js → server-xbtw0p9t.js} +1 -1
- package/dist/v2/{server-cqjvxyrp.js → server-xy7w7hrd.js} +2 -2
- package/dist/v2/server-ypf1ap0v.js +529 -0
- package/dist/v2/server-z4p0ry94.js +222 -0
- package/dist/v2/server-z9zygwse.js +89 -0
- package/dist/v2/{server-ab1g0wn9.js → server-zzgtgqmd.js} +2 -2
- package/dist/v2/server.js +6 -5
- package/dist/v2/{storage-tags-18nbaanf.js → storage-tags-19s0ebf0.js} +5 -4
- package/dist/v2/store-reader-cgx47zkp.js +14 -0
- package/dist/v2/store-reader.d.ts +9 -2
- package/dist/v2/store-reader.d.ts.map +1 -1
- package/dist/v2/store-vdm8v3jd.js +21 -0
- package/dist/v2/v2-archive-reader-t2c0eypn.js +11 -0
- package/dist/v2/{wrapup-orchestrator-wxf7n5k6.js → wrapup-orchestrator-aqpqsveg.js} +46 -39
- package/dist/v2-archive-reader-tm2eayp2.js +11 -0
- package/dist/wrapup-orchestrator-k5yp19a6.js +55 -0
- package/package.json +1 -1
- package/src/shared/sqlite-transaction-mode-guard.test.ts +2 -0
- package/dist/embedding-backfill-0jgtqxen.js +0 -25
- package/dist/recomp-orchestrator-0y983w7h.js +0 -62
- package/dist/v2/embedding-backfill-f43hd8y6.js +0 -24
- package/dist/v2/recomp-orchestrator-7q9nvxte.js +0 -61
- package/dist/wrapup-orchestrator-ys2nrkkb.js +0 -49
|
@@ -1,21 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
sessionLog2
|
|
3
|
-
} from "./index-
|
|
3
|
+
} from "./index-jrfre9ah.js";
|
|
4
4
|
import {
|
|
5
5
|
COMPARTMENT_LEASE_RENEWAL_MS,
|
|
6
6
|
acquireCompartmentLease,
|
|
7
7
|
renewCompartmentLease,
|
|
8
8
|
releaseCompartmentLeaseBestEffort,
|
|
9
9
|
getCompartments,
|
|
10
|
-
getLastCompartmentEndMessage
|
|
11
|
-
|
|
12
|
-
resolveWrapupProtectedTailBoundary,
|
|
13
|
-
hasRunnableCompartmentWindow,
|
|
14
|
-
runCompartmentAgent,
|
|
15
|
-
getActiveCompartmentRun,
|
|
16
|
-
markActiveCompartmentRunPublished,
|
|
17
|
-
registerActiveCompartmentRun
|
|
18
|
-
} from "./index-atekmqef.js";
|
|
10
|
+
getLastCompartmentEndMessage
|
|
11
|
+
} from "./index-f297z1n8.js";
|
|
19
12
|
import {
|
|
20
13
|
inRootAsyncContext2
|
|
21
14
|
} from "./index-gzy5w8ya.js";
|
|
@@ -27,17 +20,26 @@ import {
|
|
|
27
20
|
getHistorianFailureState,
|
|
28
21
|
clearEmergencyRecovery,
|
|
29
22
|
prepareRawSessionOrdinals2
|
|
30
|
-
} from "./index-
|
|
23
|
+
} from "./index-brg2w6qc.js";
|
|
31
24
|
import {
|
|
32
25
|
pushNotification2
|
|
33
26
|
} from "./index-x8a7jmkh.js";
|
|
27
|
+
import {
|
|
28
|
+
describeBoundaryDiagnostics,
|
|
29
|
+
resolveWrapupProtectedTailBoundary,
|
|
30
|
+
hasRunnableCompartmentWindow,
|
|
31
|
+
runCompartmentAgent,
|
|
32
|
+
getActiveCompartmentRun,
|
|
33
|
+
markActiveCompartmentRunPublished,
|
|
34
|
+
registerActiveCompartmentRun
|
|
35
|
+
} from "./index-4bgk5ztz.js";
|
|
34
36
|
import {
|
|
35
37
|
sendStatusNotification2
|
|
36
|
-
} from "./index-
|
|
38
|
+
} from "./index-2v6nvy3k.js";
|
|
37
39
|
import {
|
|
38
40
|
setRecompStarting2,
|
|
39
41
|
setRecompTerminal2
|
|
40
|
-
} from "./index-
|
|
42
|
+
} from "./index-3d3872c6.js";
|
|
41
43
|
|
|
42
44
|
// src/hooks/magic-context/wrapup-orchestrator.ts
|
|
43
45
|
import * as crypto from "node:crypto";
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
// src/shared/redaction.ts
|
|
2
|
+
import { homedir, userInfo } from "node:os";
|
|
3
|
+
function escapeRegex(value) {
|
|
4
|
+
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
5
|
+
}
|
|
6
|
+
var SECRET_WORDS = [
|
|
7
|
+
"key",
|
|
8
|
+
"token",
|
|
9
|
+
"secret",
|
|
10
|
+
"password",
|
|
11
|
+
"auth",
|
|
12
|
+
"authorization",
|
|
13
|
+
"bearer",
|
|
14
|
+
"credential"
|
|
15
|
+
];
|
|
16
|
+
var SECRET_SEGMENT_PATTERN = new RegExp(`^(?:${SECRET_WORDS.map((w) => `${w}s?`).join("|")})$`, "i");
|
|
17
|
+
var TRAILING_DESCRIPTORS = new Set(["id", "ids", "value", "values", "header", "headers"]);
|
|
18
|
+
function redactionTypeForKey(key) {
|
|
19
|
+
const normalized = key.trim().toLowerCase().replace(/[^a-z0-9_.-]+/g, "_");
|
|
20
|
+
const suffix = normalized.split(".").filter(Boolean).at(-1) ?? normalized;
|
|
21
|
+
return suffix || "secret";
|
|
22
|
+
}
|
|
23
|
+
function isNonSecretScalarValue(value) {
|
|
24
|
+
const v = value.trim();
|
|
25
|
+
if (v === "true" || v === "false" || v === "null" || v === "undefined")
|
|
26
|
+
return true;
|
|
27
|
+
return /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/.test(v);
|
|
28
|
+
}
|
|
29
|
+
var SECRET_QUALIFIERS = new Set([
|
|
30
|
+
"api",
|
|
31
|
+
"access",
|
|
32
|
+
"private",
|
|
33
|
+
"client",
|
|
34
|
+
"auth",
|
|
35
|
+
"authorization",
|
|
36
|
+
"secret",
|
|
37
|
+
"bearer",
|
|
38
|
+
"session",
|
|
39
|
+
"refresh",
|
|
40
|
+
"service",
|
|
41
|
+
"x",
|
|
42
|
+
"openai",
|
|
43
|
+
"anthropic",
|
|
44
|
+
"google",
|
|
45
|
+
"github",
|
|
46
|
+
"huggingface",
|
|
47
|
+
"aws",
|
|
48
|
+
"azure",
|
|
49
|
+
"id"
|
|
50
|
+
]);
|
|
51
|
+
var UNQUALIFIED_SECRET_SEGMENT_PATTERN = /^(?:password|secret|credential|bearer|authorization)s?$/;
|
|
52
|
+
function isSecretKey(key) {
|
|
53
|
+
const segments = key.replace(/([a-z0-9])([A-Z])/g, "$1_$2").toLowerCase().split(/[._-]+/).filter(Boolean);
|
|
54
|
+
if (segments.length === 0)
|
|
55
|
+
return false;
|
|
56
|
+
if (segments.length === 1) {
|
|
57
|
+
const first = segments[0];
|
|
58
|
+
return Boolean(first && SECRET_SEGMENT_PATTERN.test(first));
|
|
59
|
+
}
|
|
60
|
+
for (let i = 0;i < segments.length; i++) {
|
|
61
|
+
const seg = segments[i];
|
|
62
|
+
if (!seg || !SECRET_SEGMENT_PATTERN.test(seg))
|
|
63
|
+
continue;
|
|
64
|
+
let trailingOk = true;
|
|
65
|
+
for (let j = i + 1;j < segments.length; j++) {
|
|
66
|
+
const tail = segments[j];
|
|
67
|
+
if (!tail)
|
|
68
|
+
continue;
|
|
69
|
+
if (TRAILING_DESCRIPTORS.has(tail))
|
|
70
|
+
continue;
|
|
71
|
+
if (SECRET_SEGMENT_PATTERN.test(tail))
|
|
72
|
+
continue;
|
|
73
|
+
trailingOk = false;
|
|
74
|
+
break;
|
|
75
|
+
}
|
|
76
|
+
if (!trailingOk)
|
|
77
|
+
continue;
|
|
78
|
+
if (UNQUALIFIED_SECRET_SEGMENT_PATTERN.test(seg))
|
|
79
|
+
return true;
|
|
80
|
+
for (let k = i - 1;k >= 0; k--) {
|
|
81
|
+
const lead = segments[k];
|
|
82
|
+
if (lead && SECRET_QUALIFIERS.has(lead))
|
|
83
|
+
return true;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return false;
|
|
87
|
+
}
|
|
88
|
+
function sanitizePathString(value) {
|
|
89
|
+
const home = process.env.HOME || process.env.USERPROFILE || homedir();
|
|
90
|
+
const username = userInfo().username;
|
|
91
|
+
let sanitized = value;
|
|
92
|
+
if (home) {
|
|
93
|
+
sanitized = sanitized.replace(new RegExp(escapeRegex(home), "g"), "~");
|
|
94
|
+
}
|
|
95
|
+
sanitized = sanitized.replace(/\/Users\/[^/]+\//g, "/Users/<USER>/");
|
|
96
|
+
sanitized = sanitized.replace(/\/home\/[^/]+\//g, "/home/<USER>/");
|
|
97
|
+
sanitized = sanitized.replace(/C:\\Users\\[^\\]+\\/g, "C:\\Users\\<USER>\\");
|
|
98
|
+
if (username) {
|
|
99
|
+
sanitized = sanitized.replace(new RegExp(escapeRegex(username), "g"), "<USER>");
|
|
100
|
+
}
|
|
101
|
+
return sanitized;
|
|
102
|
+
}
|
|
103
|
+
var SECRET_TEXT_PATTERNS = [
|
|
104
|
+
{
|
|
105
|
+
pattern: /\bsk-ant-(?:api03-)?[A-Za-z0-9_-]{32,}/g,
|
|
106
|
+
replacement: "<ANTHROPIC_API_KEY_REDACTED>"
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
pattern: /\bsk-(?:proj-)?[A-Za-z0-9_-]{12,}/g,
|
|
110
|
+
replacement: "<OPENAI_API_KEY_REDACTED>"
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
pattern: /\bgithub_pat_[A-Za-z0-9_]{20,}/g,
|
|
114
|
+
replacement: "<GITHUB_PAT_REDACTED>"
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
pattern: /\b(?:gh[opsu]|ghr)_[A-Za-z0-9_-]{30,}/g,
|
|
118
|
+
replacement: "<GITHUB_TOKEN_REDACTED>"
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
pattern: /\bhf_[A-Za-z0-9]{30,}/g,
|
|
122
|
+
replacement: "<HUGGINGFACE_TOKEN_REDACTED>"
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
pattern: /\b(?:AKIA|ASIA)[0-9A-Z]{16}\b/g,
|
|
126
|
+
replacement: "<AWS_ACCESS_KEY_ID_REDACTED>"
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
pattern: /\bxox[abprsuvc]-[A-Za-z0-9-]{10,}/g,
|
|
130
|
+
replacement: "<SLACK_TOKEN_REDACTED>"
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
pattern: /\bAIza[A-Za-z0-9_-]{35}\b/g,
|
|
134
|
+
replacement: "<GOOGLE_API_KEY_REDACTED>"
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
pattern: /\b(Authorization\s*:\s*Bearer\s+)([A-Za-z0-9._~+/=-]{8,})/gi,
|
|
138
|
+
replacement: (_full, prefix) => `${prefix}<REDACTED:bearer>`
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
pattern: /\b((?:Proxy-)?Authorization\s*:\s*(?:Basic|Digest|Token|Negotiate|NTLM)\s+)([A-Za-z0-9._~+/=-]{4,})/gi,
|
|
142
|
+
replacement: (_full, prefix) => `${prefix}<REDACTED:authorization>`
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
pattern: /\b((?:x-)?(?:api-?key|api-?token|auth-?token|access-?token)\s*:\s*)([^\s'"`,;<>]{6,})/gi,
|
|
146
|
+
replacement: (full, prefix, value) => isNonSecretScalarValue(value) ? full : `${prefix}<REDACTED:api_key>`
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
pattern: /\b((?:api[_-]?key|client[_-]?secret|access[_-]?token|token|secret|password|passwd|pwd)\s*:\s*)([^\s'"`,;<>]{6,})/gi,
|
|
150
|
+
replacement: (full, prefix, value) => isNonSecretScalarValue(value) ? full : `${prefix}<REDACTED:credential>`
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
pattern: /\b([a-z][a-z0-9+.-]*:\/\/[^\s/:@]+:)([^\s/@]+)(@)/gi,
|
|
154
|
+
replacement: (_full, prefix, _password, at) => `${prefix}<REDACTED:password>${at}`
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
pattern: /\beyJ[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+/g,
|
|
158
|
+
replacement: "<JWT_REDACTED>"
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
pattern: /(["'])([^"']*(?:key|token|secret|password|auth|bearer|credential)[^"']*)\1(\s*:\s*)(["'])([^"']*)\4/gi,
|
|
162
|
+
replacement: (full, quote, key, separator, valueQuote, value) => isNonSecretScalarValue(value) ? full : `${quote}${key}${quote}${separator}${valueQuote}<REDACTED:${redactionTypeForKey(key)}>${valueQuote}`
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
pattern: /\b([A-Za-z0-9_.-]*(?:key|token|secret|password|auth|bearer|credential)[A-Za-z0-9_.-]*)\s*=\s*([^\s'"`]+)/gi,
|
|
166
|
+
replacement: (full, key, value) => isNonSecretScalarValue(value) ? full : `${key}=<REDACTED:${redactionTypeForKey(key)}>`
|
|
167
|
+
}
|
|
168
|
+
];
|
|
169
|
+
function redactSecretText(value) {
|
|
170
|
+
let redacted = value;
|
|
171
|
+
for (const { pattern, replacement } of SECRET_TEXT_PATTERNS) {
|
|
172
|
+
if (typeof replacement === "string") {
|
|
173
|
+
redacted = redacted.replace(pattern, replacement);
|
|
174
|
+
} else {
|
|
175
|
+
redacted = redacted.replace(pattern, replacement);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
return redacted;
|
|
179
|
+
}
|
|
180
|
+
function sanitizeDiagnosticText(value) {
|
|
181
|
+
return redactSecretText(sanitizePathString(value));
|
|
182
|
+
}
|
|
183
|
+
var SHAREABILITY_SENSITIVE_PATTERNS = [
|
|
184
|
+
/\bC:\/Users\/[^/\s]+/i,
|
|
185
|
+
/(?:^|\s)~\/[^\s]+/,
|
|
186
|
+
/\b(?:api[_-]?key|secret|token|password|passwd|pwd|client[_-]?secret|access[_-]?key)\b\s*[:=]\s*\S+/i,
|
|
187
|
+
/\b(?:localhost|127\.0\.0\.1|0\.0\.0\.0|\[::1\])(?::\d+)?\b/i,
|
|
188
|
+
/\b(?:10|127)\.\d{1,3}\.\d{1,3}\.\d{1,3}\b/,
|
|
189
|
+
/\b192\.168\.\d{1,3}\.\d{1,3}\b/,
|
|
190
|
+
/\b172\.(?:1[6-9]|2\d|3[01])\.\d{1,3}\.\d{1,3}\b/
|
|
191
|
+
];
|
|
192
|
+
function hasShareabilitySensitiveText(text) {
|
|
193
|
+
try {
|
|
194
|
+
if (sanitizeDiagnosticText(text) !== text)
|
|
195
|
+
return true;
|
|
196
|
+
return SHAREABILITY_SENSITIVE_PATTERNS.some((pattern) => pattern.test(text));
|
|
197
|
+
} catch {
|
|
198
|
+
return true;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
function sanitizeConfigValue(value, keyPath = []) {
|
|
202
|
+
if (value === null || typeof value === "number" || typeof value === "boolean")
|
|
203
|
+
return value;
|
|
204
|
+
const key = keyPath.at(-1) ?? "";
|
|
205
|
+
if (key && isSecretKey(key)) {
|
|
206
|
+
return `<REDACTED:${redactionTypeForKey(key)}>`;
|
|
207
|
+
}
|
|
208
|
+
if (typeof value === "string")
|
|
209
|
+
return sanitizeDiagnosticText(value);
|
|
210
|
+
if (Array.isArray(value)) {
|
|
211
|
+
return value.map((entry, index) => sanitizeConfigValue(entry, [...keyPath, String(index)]));
|
|
212
|
+
}
|
|
213
|
+
if (value && typeof value === "object") {
|
|
214
|
+
return Object.fromEntries(Object.entries(value).map(([entryKey, entry]) => [
|
|
215
|
+
entryKey,
|
|
216
|
+
sanitizeConfigValue(entry, [...keyPath, entryKey])
|
|
217
|
+
]));
|
|
218
|
+
}
|
|
219
|
+
return value;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
export { sanitizeDiagnosticText, hasShareabilitySensitiveText, sanitizeConfigValue };
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
// src/hooks/magic-context/host-served-rows.ts
|
|
2
|
+
var HOST_UNSERVED_ROW = "hostUnservedRow";
|
|
3
|
+
function markHostUnservedRow(target) {
|
|
4
|
+
Object.defineProperty(target, HOST_UNSERVED_ROW, {
|
|
5
|
+
value: true,
|
|
6
|
+
enumerable: false,
|
|
7
|
+
configurable: true
|
|
8
|
+
});
|
|
9
|
+
return target;
|
|
10
|
+
}
|
|
11
|
+
function isHostUnservedRow(value) {
|
|
12
|
+
return typeof value === "object" && value !== null && value[HOST_UNSERVED_ROW] === true;
|
|
13
|
+
}
|
|
14
|
+
function retreatPastHostUnservedRows(messages, exclusiveEnd, floor) {
|
|
15
|
+
if (!messages.some(isHostUnservedRow))
|
|
16
|
+
return exclusiveEnd;
|
|
17
|
+
const byOrdinal = new Map(messages.map((message) => [message.ordinal, message]));
|
|
18
|
+
let end = exclusiveEnd;
|
|
19
|
+
while (end - 1 >= floor && isHostUnservedRow(byOrdinal.get(end - 1)))
|
|
20
|
+
end -= 1;
|
|
21
|
+
return end;
|
|
22
|
+
}
|
|
23
|
+
function snapTerminalCompartmentToServedRow(compartments, lines) {
|
|
24
|
+
if (!lines.some(isHostUnservedRow))
|
|
25
|
+
return { compartments: [...compartments], snapped: false };
|
|
26
|
+
const byOrdinal = new Map(lines.map((line) => [line.ordinal, line]));
|
|
27
|
+
const result = [...compartments];
|
|
28
|
+
let snapped = false;
|
|
29
|
+
while (result.length > 0) {
|
|
30
|
+
const last = result[result.length - 1];
|
|
31
|
+
if (!isHostUnservedRow(byOrdinal.get(last.endMessage)))
|
|
32
|
+
break;
|
|
33
|
+
snapped = true;
|
|
34
|
+
let served;
|
|
35
|
+
for (let ordinal = last.endMessage - 1;ordinal >= last.startMessage; ordinal -= 1) {
|
|
36
|
+
const line = byOrdinal.get(ordinal);
|
|
37
|
+
if (line && !isHostUnservedRow(line)) {
|
|
38
|
+
served = line;
|
|
39
|
+
break;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
if (!served) {
|
|
43
|
+
result.pop();
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
result[result.length - 1] = {
|
|
47
|
+
...last,
|
|
48
|
+
endMessage: served.ordinal,
|
|
49
|
+
endMessageId: served.messageId
|
|
50
|
+
};
|
|
51
|
+
break;
|
|
52
|
+
}
|
|
53
|
+
return { compartments: result, snapped };
|
|
54
|
+
}
|
|
55
|
+
function isHostRenderedSystemMessage(message) {
|
|
56
|
+
const id = message.info.id;
|
|
57
|
+
return (typeof id !== "string" || id.length === 0) && message.info.role === "system";
|
|
58
|
+
}
|
|
59
|
+
var COVERED_INSTRUCTION_ROW = "coveredInstructionRow";
|
|
60
|
+
function markCoveredInstructionRow(target) {
|
|
61
|
+
Object.defineProperty(target, COVERED_INSTRUCTION_ROW, {
|
|
62
|
+
value: true,
|
|
63
|
+
enumerable: false,
|
|
64
|
+
configurable: true
|
|
65
|
+
});
|
|
66
|
+
return target;
|
|
67
|
+
}
|
|
68
|
+
function isCoveredInstructionRow(value) {
|
|
69
|
+
return typeof value === "object" && value !== null && value[COVERED_INSTRUCTION_ROW] === true;
|
|
70
|
+
}
|
|
71
|
+
function takeCoveredInstructionRows(messages) {
|
|
72
|
+
const taken = messages.filter((message) => isCoveredInstructionRow(message.info));
|
|
73
|
+
if (taken.length > 0) {
|
|
74
|
+
const kept = messages.filter((message) => !isCoveredInstructionRow(message.info));
|
|
75
|
+
messages.splice(0, messages.length, ...kept);
|
|
76
|
+
}
|
|
77
|
+
return taken;
|
|
78
|
+
}
|
|
79
|
+
function cloneKeepingCoveredInstructionMarks(messages) {
|
|
80
|
+
const copy = structuredClone(messages);
|
|
81
|
+
messages.forEach((message, index) => {
|
|
82
|
+
const copied = copy[index];
|
|
83
|
+
if (copied && isCoveredInstructionRow(message.info))
|
|
84
|
+
markCoveredInstructionRow(copied.info);
|
|
85
|
+
});
|
|
86
|
+
return copy;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export { markHostUnservedRow, isHostUnservedRow, retreatPastHostUnservedRows, snapTerminalCompartmentToServedRow, isHostRenderedSystemMessage, markCoveredInstructionRow, isCoveredInstructionRow, takeCoveredInstructionRows, cloneKeepingCoveredInstructionMarks };
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getTokenEstimatorFingerprint,
|
|
3
3
|
estimateTokens
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-4xyjr62e.js";
|
|
5
5
|
import {
|
|
6
6
|
getHarness2
|
|
7
7
|
} from "./index-pavzsdc6.js";
|
|
8
8
|
import {
|
|
9
9
|
log2
|
|
10
|
-
} from "./index-
|
|
10
|
+
} from "./index-jrfre9ah.js";
|
|
11
11
|
import {
|
|
12
12
|
isSynapseEmbeddingTruncated
|
|
13
|
-
} from "./index-
|
|
13
|
+
} from "./index-g4t7850m.js";
|
|
14
14
|
import {
|
|
15
15
|
messageFtsOrdinalRangeIsMapped2
|
|
16
|
-
} from "./index-
|
|
16
|
+
} from "./index-faxb7mck.js";
|
|
17
17
|
import {
|
|
18
18
|
isKnownAutocommit
|
|
19
19
|
} from "./index-8ajstryz.js";
|
|
@@ -975,15 +975,26 @@ var unretainedSearchPools = new WeakMap;
|
|
|
975
975
|
function getLastCompartmentChunkPoolWarm2() {
|
|
976
976
|
return lastChunkPoolWarm;
|
|
977
977
|
}
|
|
978
|
-
function peekCompartmentChunkSearchPool2(db, sessionId, projectPath, modelId, dateRange = null) {
|
|
979
|
-
if (!modelId)
|
|
978
|
+
function peekCompartmentChunkSearchPool2(db, sessionId, projectPath, modelId, dateRange = null, diagnostic) {
|
|
979
|
+
if (!modelId) {
|
|
980
|
+
if (diagnostic)
|
|
981
|
+
diagnostic.peek = "no-model";
|
|
980
982
|
return null;
|
|
983
|
+
}
|
|
981
984
|
trackSearchPool(db, sessionId, projectPath, modelId);
|
|
982
985
|
const entry = getDecodedSearchPool(db).get(searchPoolKey(sessionId, projectPath, modelId));
|
|
983
|
-
if (!entry || searchPoolInTransaction(db))
|
|
986
|
+
if (!entry || searchPoolInTransaction(db)) {
|
|
987
|
+
if (diagnostic)
|
|
988
|
+
diagnostic.peek = entry ? "transaction" : "missing";
|
|
984
989
|
return null;
|
|
985
|
-
|
|
990
|
+
}
|
|
991
|
+
if (!sameSessionSignature(readSessionChunkSignature(db, sessionId), entry.sessionSignature)) {
|
|
992
|
+
if (diagnostic)
|
|
993
|
+
diagnostic.peek = "signature-changed";
|
|
986
994
|
return null;
|
|
995
|
+
}
|
|
996
|
+
if (diagnostic)
|
|
997
|
+
diagnostic.peek = "hit";
|
|
987
998
|
touchDecodedSearchPoolEntry(entry);
|
|
988
999
|
return filterSearchPoolDates(entry.rows, dateRange);
|
|
989
1000
|
}
|