osborn 0.9.291 → 0.9.292
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/.claude/skills/browser-apply/SKILL.md +5 -4
- package/.claude/skills/browser-apply/candidate.example.env +4 -1
- package/.claude/skills/browser-apply/fill.mjs +13 -2
- package/.claude/skills/meetings/SKILL.md +26 -7
- package/.env.example +6 -0
- package/dist/agent-store.d.ts +6 -0
- package/dist/agent-store.js +36 -6
- package/dist/approval-policy.d.ts +99 -0
- package/dist/approval-policy.js +196 -0
- package/dist/claude-llm.d.ts +3 -2
- package/dist/claude-llm.js +49 -19
- package/dist/config.d.ts +12 -16
- package/dist/config.js +75 -21
- package/dist/content/compaction-lens-worker.d.ts +5 -0
- package/dist/content/compaction-lens-worker.js +78 -7
- package/dist/content/content-llm.d.ts +14 -3
- package/dist/content/content-llm.js +33 -142
- package/dist/content/lens-db.d.ts +16 -5
- package/dist/content/lens-db.js +58 -11
- package/dist/content/lens-ingest.d.ts +1 -0
- package/dist/content/lens-ingest.js +1 -1
- package/dist/content/lens-launch.d.ts +42 -1
- package/dist/content/lens-launch.js +202 -40
- package/dist/content/lens-library-digest.d.ts +85 -0
- package/dist/content/lens-library-digest.js +305 -0
- package/dist/content/lens-library-index.d.ts +14 -3
- package/dist/content/lens-library-index.js +35 -8
- package/dist/content/lens-library-select.d.ts +1 -1
- package/dist/content/lens-library-select.js +1 -1
- package/dist/content/lens-library-sweep.d.ts +36 -0
- package/dist/content/lens-library-sweep.js +331 -0
- package/dist/content/lens-library.d.ts +29 -0
- package/dist/content/lens-library.js +130 -20
- package/dist/content/lens-model.d.ts +4 -0
- package/dist/content/lens-model.js +5 -0
- package/dist/content/lens-paths.d.ts +72 -0
- package/dist/content/lens-paths.js +248 -5
- package/dist/content/period-run.js +2 -2
- package/dist/content/secret-rules.d.ts +51 -0
- package/dist/content/secret-rules.js +185 -0
- package/dist/content/transcript-sanitizer.d.ts +1 -41
- package/dist/content/transcript-sanitizer.js +4 -171
- package/dist/data-sender-auth.d.ts +43 -6
- package/dist/data-sender-auth.js +61 -45
- package/dist/env-keys.d.ts +10 -2
- package/dist/env-keys.js +26 -5
- package/dist/index.js +499 -106
- package/dist/phone-code.d.ts +76 -0
- package/dist/phone-code.js +124 -0
- package/dist/phone-voice-actions.d.ts +132 -0
- package/dist/phone-voice-actions.js +223 -0
- package/dist/pipeline-direct-llm.d.ts +7 -1
- package/dist/pipeline-direct-llm.js +12 -1
- package/dist/prompts/library-digest.md +11 -0
- package/dist/prompts.js +2 -2
- package/dist/pushover.d.ts +2 -1
- package/dist/pushover.js +7 -6
- package/dist/risk-tier.d.ts +14 -0
- package/dist/risk-tier.js +140 -0
- package/dist/session-store.d.ts +1 -0
- package/dist/session-store.js +3 -2
- package/dist/session-switch.d.ts +22 -7
- package/dist/session-switch.js +58 -24
- package/dist/steward-verdict.d.ts +16 -3
- package/dist/steward-verdict.js +37 -18
- package/dist/watch-gateway.js +3 -1
- package/package.json +1 -1
- package/dist/bridge-llm.d.ts +0 -22
- package/dist/bridge-llm.js +0 -39
- package/dist/codex-handler.d.ts +0 -38
- package/dist/codex-handler.js +0 -83
- package/dist/codex-llm.d.ts +0 -40
- package/dist/codex-llm.js +0 -144
- package/dist/fast-brain.d.ts +0 -176
- package/dist/fast-brain.js +0 -1887
- package/dist/index-3-2-26-legacy.d.ts +0 -1
- package/dist/index-3-2-26-legacy.js +0 -2233
- package/dist/leagcyprompts2.d.ts +0 -0
- package/dist/leagcyprompts2.js +0 -573
- package/dist/prompts-2-25-26.d.ts +0 -0
- package/dist/prompts-2-25-26.js +0 -518
- package/dist/prompts-3-2-26.d.ts +0 -78
- package/dist/prompts-3-2-26.js +0 -1319
- package/dist/summary-index.d.ts +0 -90
- package/dist/summary-index.js +0 -585
|
@@ -41,3 +41,75 @@ export declare function readHwm(projectDir: string | null, sessionId: string): n
|
|
|
41
41
|
export declare function refuseOutPath(outPath: string | undefined, projectDir?: string | null): string | null;
|
|
42
42
|
/** Monotonic: never moves the mark backwards. Atomic write via rename. */
|
|
43
43
|
export declare function writeHwm(projectDir: string, sessionId: string, lastRowId: number, lastTs?: string): void;
|
|
44
|
+
/**
|
|
45
|
+
* Run `fn` under a short `wx` lock file holding a unique token (stale after 30s, claimed via
|
|
46
|
+
* rename so only one waiter can remove it). Returns false, without running `fn`, when the lock
|
|
47
|
+
* could not be taken in `tries` attempts; an fs error other than EEXIST throws.
|
|
48
|
+
*/
|
|
49
|
+
export declare function withFileLock(lock: string, fn: () => void, tries: number): boolean;
|
|
50
|
+
export declare const SWEEP_STATUS_FILE = "library-sweep-status.json";
|
|
51
|
+
/** <claudeDir>/osb-library: the sweep's lock (LOCK_FILE), log (LOG_FILE), status file and the daily digests. */
|
|
52
|
+
export declare function libraryHomeDir(): string;
|
|
53
|
+
export interface SweepError {
|
|
54
|
+
/** 'period' | 'digest' | 'scan' | 'worker' | 'timeout' | 'spawn' */
|
|
55
|
+
kind: string;
|
|
56
|
+
/** 8-char session id or a YYYY-MM-DD day. Never a path. */
|
|
57
|
+
ref?: string;
|
|
58
|
+
/** Redacted, one line. Kept in the file only; /health shows kind + ref. */
|
|
59
|
+
message?: string;
|
|
60
|
+
}
|
|
61
|
+
export interface SweepStatus {
|
|
62
|
+
status: 'running' | 'done' | 'disabled' | 'no-key' | 'cooldown' | 'error' | 'timeout' | 'died';
|
|
63
|
+
trigger: string;
|
|
64
|
+
at: string;
|
|
65
|
+
/** null while a sweep runs (the previous run's end is cleared, its backlog kept). */
|
|
66
|
+
finishedAt?: string | null;
|
|
67
|
+
pid?: number;
|
|
68
|
+
pagesWritten: number;
|
|
69
|
+
digestsWritten: number;
|
|
70
|
+
modelCalls: number;
|
|
71
|
+
costUsd: number;
|
|
72
|
+
/** True when the per-run cap or time budget stopped the run with work left. */
|
|
73
|
+
capHit?: boolean;
|
|
74
|
+
errors: SweepError[];
|
|
75
|
+
/** Unwritten work left after this run: eligible periods, past days with undigested short chats, and today's short chats (digested tomorrow). */
|
|
76
|
+
backlog?: {
|
|
77
|
+
periods: number;
|
|
78
|
+
digestDays: number;
|
|
79
|
+
todayChats: number;
|
|
80
|
+
};
|
|
81
|
+
/** Outcome of the last per-session Library step (session end / compaction), from the worker itself. */
|
|
82
|
+
lastStep?: {
|
|
83
|
+
at: string;
|
|
84
|
+
session: string;
|
|
85
|
+
status: string;
|
|
86
|
+
period?: number;
|
|
87
|
+
costUsd: number;
|
|
88
|
+
};
|
|
89
|
+
/** Last failure of ANY Library worker (crash, or a session-end page that failed). */
|
|
90
|
+
workerError?: {
|
|
91
|
+
at: string;
|
|
92
|
+
kind: string;
|
|
93
|
+
ref?: string;
|
|
94
|
+
message?: string;
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
export declare function readSweepStatus(home?: string): SweepStatus | null;
|
|
98
|
+
/**
|
|
99
|
+
* Merge `patch` into the status file (atomic). Only the patch's own fields change: the sweep and a
|
|
100
|
+
* session-end worker write different fields of the same file, so the read-merge-write runs under a
|
|
101
|
+
* short exclusive lock (withFileLock) and never loses the other's
|
|
102
|
+
* fields. Never throws.
|
|
103
|
+
*/
|
|
104
|
+
export declare function writeSweepStatus(patch: Partial<SweepStatus>, home?: string): void;
|
|
105
|
+
/** A sweep does not start within this long of the last one finishing (agent start and every session end launch one). */
|
|
106
|
+
export declare const SWEEP_COOLDOWN_MS: number;
|
|
107
|
+
/**
|
|
108
|
+
* True while the last sweep ended (done, timeout, error or died) less than `cooldownMs` ago,
|
|
109
|
+
* measured from its finishedAt, else its start (a sweep that died never wrote finishedAt).
|
|
110
|
+
*/
|
|
111
|
+
export declare function sweepCoolingDown(cooldownMs?: number, home?: string): boolean;
|
|
112
|
+
/** Record the live session ids for running sweeps. Rewritten only when the list changes (or to refresh its age). Never throws. */
|
|
113
|
+
export declare function writeLiveSessions(ids: string[], home?: string): void;
|
|
114
|
+
/** Live session ids the agent wrote within `maxAgeMs`, else null (no agent, or a stale file). */
|
|
115
|
+
export declare function readLiveSessions(maxAgeMs?: number, home?: string): string[] | null;
|
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
* lens-paths.ts — LIGHT path + lock helpers shared by the hook-side launcher
|
|
3
3
|
* and the background worker. node: builtins only (safe to import in the live agent).
|
|
4
4
|
*/
|
|
5
|
-
import { closeSync, existsSync, openSync, readFileSync, readdirSync, realpathSync, renameSync, rmSync, statSync, utimesSync, writeFileSync, writeSync, } from 'node:fs';
|
|
5
|
+
import { closeSync, existsSync, fstatSync, linkSync, mkdirSync, openSync, readFileSync, readdirSync, realpathSync, renameSync, rmSync, statSync, unlinkSync, utimesSync, writeFileSync, writeSync, } from 'node:fs';
|
|
6
6
|
import { basename, dirname, join, resolve, sep } from 'node:path';
|
|
7
7
|
import { homedir } from 'node:os';
|
|
8
|
+
import { randomBytes } from 'node:crypto';
|
|
8
9
|
export const PROFILE_FILE = 'content-profile.md';
|
|
9
10
|
export const LOCK_FILE = '.content-lens.lock';
|
|
10
11
|
export const LOG_FILE = 'content-lens.log';
|
|
@@ -153,14 +154,256 @@ export function refuseOutPath(outPath, projectDir) {
|
|
|
153
154
|
}
|
|
154
155
|
return null;
|
|
155
156
|
}
|
|
157
|
+
/** Owner-only file written via tmp + rename. */
|
|
158
|
+
function writePrivateAtomic(p, text) {
|
|
159
|
+
const tmp = `${p}.${process.pid}.tmp`;
|
|
160
|
+
writeFileSync(tmp, text, { mode: 0o600 });
|
|
161
|
+
renameSync(tmp, p);
|
|
162
|
+
}
|
|
156
163
|
/** Monotonic: never moves the mark backwards. Atomic write via rename. */
|
|
157
164
|
export function writeHwm(projectDir, sessionId, lastRowId, lastTs) {
|
|
158
165
|
const all = readHwmFile(projectDir);
|
|
159
166
|
if ((all[sessionId]?.lastRowId ?? 0) >= lastRowId)
|
|
160
167
|
return;
|
|
161
168
|
all[sessionId] = { lastRowId, lastTs, updatedAt: new Date().toISOString() };
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
169
|
+
writePrivateAtomic(join(projectDir, HWM_FILE), JSON.stringify(all, null, 2));
|
|
170
|
+
}
|
|
171
|
+
// ── Short read-modify-write lock on a shared file (the spend ledger, the sweep status) ──
|
|
172
|
+
const FILE_LOCK_STALE_MS = 30_000;
|
|
173
|
+
const FILE_LOCK_WAIT_MS = 50;
|
|
174
|
+
const sleepSync = (ms) => Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, ms);
|
|
175
|
+
const lockToken = () => `${process.pid}.${randomBytes(8).toString('hex')}`;
|
|
176
|
+
/**
|
|
177
|
+
* Remove `path` if it is stale: rename it to a unique name (only ONE caller's
|
|
178
|
+
* rename can succeed), check the renamed file is the same stale file we judged
|
|
179
|
+
* (inode, mtime, content), and put it back with link() if a fresh one was
|
|
180
|
+
* swapped in (link fails rather than clobbers). True only to the caller that
|
|
181
|
+
* removed a stale file; any error = keep waiting.
|
|
182
|
+
*/
|
|
183
|
+
function removeIfStale(path) {
|
|
184
|
+
let seen;
|
|
185
|
+
try {
|
|
186
|
+
const fd = openSync(path, 'r');
|
|
187
|
+
try {
|
|
188
|
+
const st = fstatSync(fd);
|
|
189
|
+
if (Date.now() - st.mtimeMs <= FILE_LOCK_STALE_MS)
|
|
190
|
+
return false;
|
|
191
|
+
seen = { ino: st.ino, mtimeMs: st.mtimeMs, body: readFileSync(fd, 'utf-8') };
|
|
192
|
+
}
|
|
193
|
+
finally {
|
|
194
|
+
closeSync(fd);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
catch {
|
|
198
|
+
return false; // vanished between calls
|
|
199
|
+
}
|
|
200
|
+
const claimed = `${path}.stale.${process.pid}.${randomBytes(6).toString('hex')}`;
|
|
201
|
+
try {
|
|
202
|
+
renameSync(path, claimed);
|
|
203
|
+
}
|
|
204
|
+
catch {
|
|
205
|
+
return false; // another caller claimed it first
|
|
206
|
+
}
|
|
207
|
+
let same = false;
|
|
208
|
+
try {
|
|
209
|
+
const st = statSync(claimed);
|
|
210
|
+
same = st.ino === seen.ino && st.mtimeMs === seen.mtimeMs && readFileSync(claimed, 'utf-8') === seen.body;
|
|
211
|
+
}
|
|
212
|
+
catch {
|
|
213
|
+
/* treat as not ours */
|
|
214
|
+
}
|
|
215
|
+
if (!same) {
|
|
216
|
+
try {
|
|
217
|
+
linkSync(claimed, path); // a live file was swapped in: restore it
|
|
218
|
+
}
|
|
219
|
+
catch {
|
|
220
|
+
/* a newer one already exists */
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
try {
|
|
224
|
+
unlinkSync(claimed);
|
|
225
|
+
}
|
|
226
|
+
catch {
|
|
227
|
+
/* already gone */
|
|
228
|
+
}
|
|
229
|
+
return same;
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Claim a stale ledger lock. The judge-then-rename step runs under a short
|
|
233
|
+
* `<lock>.reap` guard so two waiters can never both act on one stale lock (or
|
|
234
|
+
* rename away the fresh lock the other just created). A guard left by a crash
|
|
235
|
+
* goes stale too and is removed the same way.
|
|
236
|
+
*/
|
|
237
|
+
function claimStaleLock(lock) {
|
|
238
|
+
const guard = `${lock}.reap`;
|
|
239
|
+
let g;
|
|
240
|
+
try {
|
|
241
|
+
g = openSync(guard, 'wx');
|
|
242
|
+
}
|
|
243
|
+
catch {
|
|
244
|
+
removeIfStale(guard);
|
|
245
|
+
return false;
|
|
246
|
+
}
|
|
247
|
+
const token = lockToken();
|
|
248
|
+
try {
|
|
249
|
+
writeSync(g, token);
|
|
250
|
+
return removeIfStale(lock);
|
|
251
|
+
}
|
|
252
|
+
catch {
|
|
253
|
+
return false;
|
|
254
|
+
}
|
|
255
|
+
finally {
|
|
256
|
+
closeSync(g);
|
|
257
|
+
releaseOwnedLock(guard, token);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
/** Release only a lock this holder owns (its token is still in the file). */
|
|
261
|
+
function releaseOwnedLock(lock, token) {
|
|
262
|
+
try {
|
|
263
|
+
if (readFileSync(lock, 'utf-8') === token)
|
|
264
|
+
unlinkSync(lock);
|
|
265
|
+
}
|
|
266
|
+
catch {
|
|
267
|
+
/* already gone */
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* Run `fn` under a short `wx` lock file holding a unique token (stale after 30s, claimed via
|
|
272
|
+
* rename so only one waiter can remove it). Returns false, without running `fn`, when the lock
|
|
273
|
+
* could not be taken in `tries` attempts; an fs error other than EEXIST throws.
|
|
274
|
+
*/
|
|
275
|
+
export function withFileLock(lock, fn, tries) {
|
|
276
|
+
for (let i = 0; i < tries; i++) {
|
|
277
|
+
let fd;
|
|
278
|
+
try {
|
|
279
|
+
fd = openSync(lock, 'wx');
|
|
280
|
+
}
|
|
281
|
+
catch (e) {
|
|
282
|
+
if (e?.code !== 'EEXIST')
|
|
283
|
+
throw e;
|
|
284
|
+
if (claimStaleLock(lock))
|
|
285
|
+
continue; // we removed the stale lock: retry the wx create now
|
|
286
|
+
sleepSync(FILE_LOCK_WAIT_MS);
|
|
287
|
+
continue;
|
|
288
|
+
}
|
|
289
|
+
const token = lockToken();
|
|
290
|
+
try {
|
|
291
|
+
writeSync(fd, token);
|
|
292
|
+
fn();
|
|
293
|
+
return true;
|
|
294
|
+
}
|
|
295
|
+
finally {
|
|
296
|
+
closeSync(fd);
|
|
297
|
+
releaseOwnedLock(lock, token);
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
return false;
|
|
301
|
+
}
|
|
302
|
+
// ── Machine-wide Library sweep: lock, log and status (one dir per machine) ──
|
|
303
|
+
export const SWEEP_STATUS_FILE = 'library-sweep-status.json';
|
|
304
|
+
/** <claudeDir>/osb-library: the sweep's lock (LOCK_FILE), log (LOG_FILE), status file and the daily digests. */
|
|
305
|
+
export function libraryHomeDir() {
|
|
306
|
+
return join(claudeDir(), 'osb-library');
|
|
307
|
+
}
|
|
308
|
+
export function readSweepStatus(home = libraryHomeDir()) {
|
|
309
|
+
try {
|
|
310
|
+
const s = JSON.parse(readFileSync(join(home, SWEEP_STATUS_FILE), 'utf-8'));
|
|
311
|
+
if (!s || typeof s !== 'object')
|
|
312
|
+
return null;
|
|
313
|
+
// "running" with no live process: the worker crashed or was killed before writing its result.
|
|
314
|
+
if (s.status === 'running' && s.pid) {
|
|
315
|
+
try {
|
|
316
|
+
process.kill(s.pid, 0);
|
|
317
|
+
}
|
|
318
|
+
catch (e) {
|
|
319
|
+
if (e?.code === 'ESRCH')
|
|
320
|
+
return { ...s, status: 'died' };
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
return s;
|
|
324
|
+
}
|
|
325
|
+
catch {
|
|
326
|
+
return null;
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
/**
|
|
330
|
+
* Merge `patch` into the status file (atomic). Only the patch's own fields change: the sweep and a
|
|
331
|
+
* session-end worker write different fields of the same file, so the read-merge-write runs under a
|
|
332
|
+
* short exclusive lock (withFileLock) and never loses the other's
|
|
333
|
+
* fields. Never throws.
|
|
334
|
+
*/
|
|
335
|
+
export function writeSweepStatus(patch, home = libraryHomeDir()) {
|
|
336
|
+
const path = join(home, SWEEP_STATUS_FILE);
|
|
337
|
+
const merge = () => {
|
|
338
|
+
let prev = {};
|
|
339
|
+
try {
|
|
340
|
+
prev = JSON.parse(readFileSync(path, 'utf-8'));
|
|
341
|
+
}
|
|
342
|
+
catch {
|
|
343
|
+
/* first write */
|
|
344
|
+
}
|
|
345
|
+
// Only the fields the patch sets: an undefined one never wipes the previous value (e.g. the backlog while a sweep runs).
|
|
346
|
+
const set = Object.fromEntries(Object.entries(patch).filter(([, v]) => v !== undefined));
|
|
347
|
+
const next = { ...prev, ...set, errors: (patch.errors ?? prev.errors ?? []).slice(0, 20) };
|
|
348
|
+
writePrivateAtomic(path, JSON.stringify(next, null, 2) + '\n');
|
|
349
|
+
};
|
|
350
|
+
try {
|
|
351
|
+
mkdirSync(home, { recursive: true });
|
|
352
|
+
if (!withFileLock(`${path}.lock`, merge, 10))
|
|
353
|
+
merge(); // lock still held: write anyway, the status is best-effort
|
|
354
|
+
}
|
|
355
|
+
catch {
|
|
356
|
+
/* status is best-effort */
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
/** A sweep does not start within this long of the last one finishing (agent start and every session end launch one). */
|
|
360
|
+
export const SWEEP_COOLDOWN_MS = 30 * 60_000;
|
|
361
|
+
/**
|
|
362
|
+
* True while the last sweep ended (done, timeout, error or died) less than `cooldownMs` ago,
|
|
363
|
+
* measured from its finishedAt, else its start (a sweep that died never wrote finishedAt).
|
|
364
|
+
*/
|
|
365
|
+
export function sweepCoolingDown(cooldownMs = SWEEP_COOLDOWN_MS, home = libraryHomeDir()) {
|
|
366
|
+
const s = readSweepStatus(home);
|
|
367
|
+
if (!s || !['done', 'timeout', 'error', 'died'].includes(s.status))
|
|
368
|
+
return false;
|
|
369
|
+
const at = Date.parse(s.finishedAt ?? s.at);
|
|
370
|
+
return Number.isFinite(at) && Date.now() - at < cooldownMs;
|
|
371
|
+
}
|
|
372
|
+
// ── Live sessions, as the agent sees them now (read by a running sweep before each page) ──
|
|
373
|
+
const LIVE_FILE = 'live-sessions.json';
|
|
374
|
+
let lastLive = '';
|
|
375
|
+
/** Record the live session ids for running sweeps. Rewritten only when the list changes (or to refresh its age). Never throws. */
|
|
376
|
+
export function writeLiveSessions(ids, home = libraryHomeDir()) {
|
|
377
|
+
const list = [...new Set(ids.filter(Boolean))].sort();
|
|
378
|
+
const key = list.join(',');
|
|
379
|
+
const path = join(home, LIVE_FILE);
|
|
380
|
+
try {
|
|
381
|
+
const fresh = Date.now() - statSync(path).mtimeMs < 60_000;
|
|
382
|
+
if (key === lastLive && fresh)
|
|
383
|
+
return;
|
|
384
|
+
}
|
|
385
|
+
catch {
|
|
386
|
+
/* not written yet */
|
|
387
|
+
}
|
|
388
|
+
try {
|
|
389
|
+
mkdirSync(home, { recursive: true });
|
|
390
|
+
writePrivateAtomic(path, JSON.stringify({ at: new Date().toISOString(), ids: list }) + '\n');
|
|
391
|
+
lastLive = key;
|
|
392
|
+
}
|
|
393
|
+
catch {
|
|
394
|
+
/* best-effort */
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
/** Live session ids the agent wrote within `maxAgeMs`, else null (no agent, or a stale file). */
|
|
398
|
+
export function readLiveSessions(maxAgeMs = 3 * 60_000, home = libraryHomeDir()) {
|
|
399
|
+
try {
|
|
400
|
+
const path = join(home, LIVE_FILE);
|
|
401
|
+
if (Date.now() - statSync(path).mtimeMs > maxAgeMs)
|
|
402
|
+
return null;
|
|
403
|
+
const o = JSON.parse(readFileSync(path, 'utf-8'));
|
|
404
|
+
return Array.isArray(o?.ids) ? o.ids.map(String) : null;
|
|
405
|
+
}
|
|
406
|
+
catch {
|
|
407
|
+
return null;
|
|
408
|
+
}
|
|
166
409
|
}
|
|
@@ -15,7 +15,7 @@ import { mkdirSync, writeFileSync } from 'node:fs';
|
|
|
15
15
|
import { dirname, resolve } from 'node:path';
|
|
16
16
|
import { pathToFileURL } from 'node:url';
|
|
17
17
|
import { loadConversationRows, resolveSessionDb } from './lens-db.js';
|
|
18
|
-
import { Budget, chat, getModelInfo, windowTokensFor } from './lens-model.js';
|
|
18
|
+
import { Budget, chat, getModelInfo, modelCallFailed, windowTokensFor } from './lens-model.js';
|
|
19
19
|
import { loadClientRedactor } from './lens-redact.js';
|
|
20
20
|
import { redactSecrets } from './transcript-sanitizer.js';
|
|
21
21
|
import { readCompactionBoundaries } from './lens-period-boundaries.js';
|
|
@@ -95,7 +95,7 @@ export async function runPeriodMap(o) {
|
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
97
|
catch (e) {
|
|
98
|
-
r.errors.push(
|
|
98
|
+
r.errors.push(modelCallFailed(e));
|
|
99
99
|
}
|
|
100
100
|
r.calls = budget.calls;
|
|
101
101
|
r.costUsd = +budget.spentUsd.toFixed(4);
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* secret-rules.ts — the secret-redaction rules of the shared transcript
|
|
3
|
+
* sanitizer (./transcript-sanitizer.ts re-exports everything here). Pure, with no
|
|
4
|
+
* imports, so frontend/tests/redaction-parity.test.ts can run them against the
|
|
5
|
+
* Activity log's mirror (frontend/src/lib/redactSecrets.ts).
|
|
6
|
+
*/
|
|
7
|
+
interface SecretRule {
|
|
8
|
+
kind: string;
|
|
9
|
+
/** Global regex. Capture groups allowed; `replace` controls the substitution. */
|
|
10
|
+
re: RegExp;
|
|
11
|
+
replace: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Order matters. Specific, high-confidence token shapes run FIRST so their KIND
|
|
15
|
+
* label wins; the broad `*_API_KEY=/_SECRET=/_TOKEN=` assignment rule runs LAST
|
|
16
|
+
* to catch any leftover generic value assignment (and skips already-redacted
|
|
17
|
+
* values via a negative lookahead).
|
|
18
|
+
*
|
|
19
|
+
* The Activity log's gate (frontend/src/lib/redactSecrets.ts) mirrors every rule
|
|
20
|
+
* here; frontend/tests/redaction-parity.test.ts fails until a new rule has a
|
|
21
|
+
* sample there and a mirror in the gate.
|
|
22
|
+
*/
|
|
23
|
+
export declare const SECRET_RULES: SecretRule[];
|
|
24
|
+
/**
|
|
25
|
+
* Conservative high-entropy fallback, applied to ASSISTANT records only (the
|
|
26
|
+
* assistant echoes tool output, so unknown-vendor keys can leak there). Matches
|
|
27
|
+
* a standalone 32+ char token of [A-Za-z0-9_+=-] that has at least one
|
|
28
|
+
* uppercase, one lowercase, and four digits. Mixed-case + digit floor skips
|
|
29
|
+
* git SHAs / sha256 hex / UUIDs (lowercase) and CONSTANT_NAMES (no lowercase);
|
|
30
|
+
* the "/" and "." boundaries skip paths and dotted identifiers. Measured 0 hits
|
|
31
|
+
* across 2508 real assistant records in session c97588f4 (no false positives).
|
|
32
|
+
*/
|
|
33
|
+
export declare const HIGH_ENTROPY_RULE: SecretRule;
|
|
34
|
+
export interface SecretScanOptions {
|
|
35
|
+
/** Treat as an assistant record: also apply the high-entropy fallback. */
|
|
36
|
+
assistant?: boolean;
|
|
37
|
+
}
|
|
38
|
+
/** Mask every secret-shaped substring in `text`. Pure. */
|
|
39
|
+
export declare function redactSecrets(text: string, opts?: SecretScanOptions): string;
|
|
40
|
+
/**
|
|
41
|
+
* Detector used by the verification harness: returns the list of secret KINDs
|
|
42
|
+
* that STILL match `text`. The authoritative "no secret survives" invariant is
|
|
43
|
+
* `detectSecrets(output).length === 0`. This is precise (uses the same shapes
|
|
44
|
+
* as redaction) rather than a naive substring scan, which would false-positive
|
|
45
|
+
* on benign prose like "task-budgets" or "fo1_/sbp_/xox/Bearer patterns".
|
|
46
|
+
*/
|
|
47
|
+
export declare function detectSecrets(text: string, opts?: SecretScanOptions): {
|
|
48
|
+
kind: string;
|
|
49
|
+
match: string;
|
|
50
|
+
}[];
|
|
51
|
+
export {};
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* secret-rules.ts — the secret-redaction rules of the shared transcript
|
|
3
|
+
* sanitizer (./transcript-sanitizer.ts re-exports everything here). Pure, with no
|
|
4
|
+
* imports, so frontend/tests/redaction-parity.test.ts can run them against the
|
|
5
|
+
* Activity log's mirror (frontend/src/lib/redactSecrets.ts).
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Order matters. Specific, high-confidence token shapes run FIRST so their KIND
|
|
9
|
+
* label wins; the broad `*_API_KEY=/_SECRET=/_TOKEN=` assignment rule runs LAST
|
|
10
|
+
* to catch any leftover generic value assignment (and skips already-redacted
|
|
11
|
+
* values via a negative lookahead).
|
|
12
|
+
*
|
|
13
|
+
* The Activity log's gate (frontend/src/lib/redactSecrets.ts) mirrors every rule
|
|
14
|
+
* here; frontend/tests/redaction-parity.test.ts fails until a new rule has a
|
|
15
|
+
* sample there and a mirror in the gate.
|
|
16
|
+
*/
|
|
17
|
+
export const SECRET_RULES = [
|
|
18
|
+
// npm registry auth line (contains an npm_ token; redact the whole value).
|
|
19
|
+
{
|
|
20
|
+
kind: 'NPM-AUTH',
|
|
21
|
+
re: /\/\/registry\.npmjs\.org\/:_authToken=[^\s"'`]+/g,
|
|
22
|
+
replace: '//registry.npmjs.org/:_authToken=[REDACTED-NPM-AUTH]',
|
|
23
|
+
},
|
|
24
|
+
// npm granular/automation token: npm_ + 36 base62 chars.
|
|
25
|
+
{ kind: 'NPM-TOKEN', re: /npm_[A-Za-z0-9]{36}/g, replace: '[REDACTED-NPM-TOKEN]' },
|
|
26
|
+
// Fly.io macaroon tokens. A real token is a COMMA-SEPARATED list of
|
|
27
|
+
// segments ("FlyV1 fm2_<a>,fm2_<b>,fm2_<c>"); redact the WHOLE list, not just
|
|
28
|
+
// the first segment (the segment char class has no comma, so the old rule
|
|
29
|
+
// stopped at the first "," and leaked the rest).
|
|
30
|
+
{
|
|
31
|
+
kind: 'FLY-TOKEN',
|
|
32
|
+
re: /FlyV1\s+fm[12]_[A-Za-z0-9/+_=-]+(?:\s*,\s*fm[12]_[A-Za-z0-9/+_=-]+)*/g,
|
|
33
|
+
replace: '[REDACTED-FLY-TOKEN]',
|
|
34
|
+
},
|
|
35
|
+
// Standalone Fly macaroon segment without the FlyV1 prefix (floor skips bare
|
|
36
|
+
// "fm2_" word mentions).
|
|
37
|
+
{
|
|
38
|
+
kind: 'FLY-TOKEN',
|
|
39
|
+
re: /(?<![A-Za-z0-9])fm[12]_[A-Za-z0-9/+_=-]{20,}/g,
|
|
40
|
+
replace: '[REDACTED-FLY-TOKEN]',
|
|
41
|
+
},
|
|
42
|
+
// Fly GraphQL fo1_ token (floor skips bare "fo1_" word mentions).
|
|
43
|
+
{ kind: 'FLY-TOKEN', re: /fo1_[A-Za-z0-9/+_=-]{20,}/g, replace: '[REDACTED-FLY-TOKEN]' },
|
|
44
|
+
// Supabase personal access token (real = 40 hex; floor skips "sbp_/" prose).
|
|
45
|
+
{ kind: 'SUPABASE-PAT', re: /sbp_[A-Za-z0-9]{20,}/g, replace: '[REDACTED-SUPABASE-PAT]' },
|
|
46
|
+
// PEM private key blocks (multiline). Terminated block first, then a
|
|
47
|
+
// truncated/unterminated block (header + base64 body, literal "\n" allowed;
|
|
48
|
+
// a legacy encrypted key's Proc-Type/DEK-Info lines too). Both spans are
|
|
49
|
+
// bounded so a run of BEGIN lines cannot make each one rescan the text.
|
|
50
|
+
{
|
|
51
|
+
kind: 'PEM-PRIVATE-KEY',
|
|
52
|
+
re: /-----BEGIN [A-Z ]*PRIVATE KEY-----(?:[^-]|-(?!----)){0,8192}-----END [A-Z ]*PRIVATE KEY-----/g,
|
|
53
|
+
replace: '[REDACTED-PEM-PRIVATE-KEY]',
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
kind: 'PEM-PRIVATE-KEY',
|
|
57
|
+
re: /-----BEGIN [A-Z ]*PRIVATE KEY-----(?:[\s\w+/=:,]|-(?!----)|\\n){0,8192}/g,
|
|
58
|
+
replace: '[REDACTED-PEM-PRIVATE-KEY]',
|
|
59
|
+
},
|
|
60
|
+
// Anthropic keys: sk-ant-api03-…, sk-ant-oat01-… (MUST run before OPENAI-KEY).
|
|
61
|
+
{ kind: 'ANTHROPIC-KEY', re: /sk-ant-[A-Za-z0-9_-]{20,}/g, replace: '[REDACTED-ANTHROPIC-KEY]' },
|
|
62
|
+
// OpenRouter / OpenAI prefixed keys whose body contains _ or - (sk-or-v1-, sk-proj-, sk-svcacct-).
|
|
63
|
+
{
|
|
64
|
+
kind: 'OPENAI-KEY',
|
|
65
|
+
re: /\bsk-(?:or-v1-|or-|proj-|svcacct-)[A-Za-z0-9_-]{20,}/g,
|
|
66
|
+
replace: '[REDACTED-OPENAI-KEY]',
|
|
67
|
+
},
|
|
68
|
+
// OpenAI / OpenRouter keys (sk-, sk-or-, sk-proj-). Floor skips "task-budgets".
|
|
69
|
+
{ kind: 'OPENAI-KEY', re: /sk-(?:or-|proj-)?[A-Za-z0-9]{20,}/g, replace: '[REDACTED-OPENAI-KEY]' },
|
|
70
|
+
// GitHub tokens: ghp_/gho_/ghu_/ghs_/ghr_ (+ fine-grained github_pat_).
|
|
71
|
+
{ kind: 'GITHUB-TOKEN', re: /\bgh[pousr]_[A-Za-z0-9]{30,}/g, replace: '[REDACTED-GITHUB-TOKEN]' },
|
|
72
|
+
{ kind: 'GITHUB-TOKEN', re: /\bgithub_pat_[A-Za-z0-9_]{30,}/g, replace: '[REDACTED-GITHUB-TOKEN]' },
|
|
73
|
+
// Google API key.
|
|
74
|
+
{ kind: 'GOOGLE-API-KEY', re: /AIza[0-9A-Za-z_-]{35}/g, replace: '[REDACTED-GOOGLE-API-KEY]' },
|
|
75
|
+
// Fireworks AI key: fw_ + ~24 base62 chars. Floor of 20 pure alphanumerics
|
|
76
|
+
// skips snake_case identifiers like "fw_key" / "fw_test_script".
|
|
77
|
+
{
|
|
78
|
+
kind: 'FIREWORKS-KEY',
|
|
79
|
+
re: /(?<![A-Za-z0-9_])fw_[A-Za-z0-9]{20,}/g,
|
|
80
|
+
replace: '[REDACTED-FIREWORKS-KEY]',
|
|
81
|
+
},
|
|
82
|
+
// Soniox project key: snx_proj_ + key body (floor skips bare prefix mentions).
|
|
83
|
+
{
|
|
84
|
+
kind: 'SONIOX-KEY',
|
|
85
|
+
re: /(?<![A-Za-z0-9_])snx_proj_[A-Za-z0-9_-]{20,}/g,
|
|
86
|
+
replace: '[REDACTED-SONIOX-KEY]',
|
|
87
|
+
},
|
|
88
|
+
// Bare Soniox key (snx_<body>, no proj_ segment); the 16-char floor skips prefix mentions.
|
|
89
|
+
{
|
|
90
|
+
kind: 'SONIOX-KEY',
|
|
91
|
+
re: /(?<![A-Za-z0-9_])snx_(?!proj_)[A-Za-z0-9]{16,}/g,
|
|
92
|
+
replace: '[REDACTED-SONIOX-KEY]',
|
|
93
|
+
},
|
|
94
|
+
// JWTs (header.payload.signature, base64url). The lookbehind keeps a long
|
|
95
|
+
// `eyJeyJ…` run from restarting at every `eyJ`, yet still masks a token glued
|
|
96
|
+
// to a word character (`%20eyJ…`, an escaped `\neyJ…`).
|
|
97
|
+
{
|
|
98
|
+
kind: 'JWT',
|
|
99
|
+
re: /(?<!eyJ[A-Za-z0-9_-]*?)eyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}/g,
|
|
100
|
+
replace: '[REDACTED-JWT]',
|
|
101
|
+
},
|
|
102
|
+
// API-key headers: x-api-key, x-goog-api-key (Gemini REST), and generic api-key
|
|
103
|
+
// (Azure etc.) — curl -H, JSON headers, raw HTTP. Keeps the header name, masks
|
|
104
|
+
// the value. Floor of 8 skips prose like "x-api-key: header".
|
|
105
|
+
{
|
|
106
|
+
kind: 'X-API-KEY',
|
|
107
|
+
// (?!\$) skips $VAR / ${var} references — not secrets, just noise.
|
|
108
|
+
re: /(\b(?:x-goog-|x-)?api-key["'`]?\s*[:=]\s*["'`]?)(?!\[REDACTED|\$)[^\s"'`,;}]{8,}/gi,
|
|
109
|
+
replace: '$1[REDACTED-API-KEY]',
|
|
110
|
+
},
|
|
111
|
+
// Authorization header (optional Bearer/Basic/Token scheme). Keeps name +
|
|
112
|
+
// scheme, masks the credential.
|
|
113
|
+
{
|
|
114
|
+
kind: 'AUTH-HEADER',
|
|
115
|
+
re: /(Authorization["'`]?\s*:\s*["'`]?(?:(?:Bearer|Basic|Token)\s+)?)(?!\[REDACTED|\$)[^\s"'`,;}]{8,}/gi,
|
|
116
|
+
replace: '$1[REDACTED-AUTH]',
|
|
117
|
+
},
|
|
118
|
+
// Slack tokens xoxb-/xoxa-/xoxp-/xoxr-/xoxs- (floor skips "xox/" prose).
|
|
119
|
+
{ kind: 'SLACK-TOKEN', re: /xox[baprs]-[A-Za-z0-9-]{10,}/g, replace: '[REDACTED-SLACK-TOKEN]' },
|
|
120
|
+
// AWS access key id.
|
|
121
|
+
{ kind: 'AWS-KEY', re: /\bAKIA[0-9A-Z]{16}\b/g, replace: '[REDACTED-AWS-KEY]' },
|
|
122
|
+
// Generic Bearer token (keep the word "Bearer"; floor skips "Bearer patterns").
|
|
123
|
+
{ kind: 'BEARER', re: /Bearer\s+[A-Za-z0-9._\-+/=]{20,}/g, replace: 'Bearer [REDACTED-TOKEN]' },
|
|
124
|
+
// Generic *_API_KEY= / *_SECRET= / *_TOKEN= / *_ACCESS_KEY= / *_PASSWORD= assignments.
|
|
125
|
+
// Keeps NAME= and any surrounding quote; masks only the value. Skips values
|
|
126
|
+
// already replaced by a specific rule above (negative lookahead on [REDACTED).
|
|
127
|
+
{
|
|
128
|
+
kind: 'ENV-SECRET',
|
|
129
|
+
re: /\b([A-Za-z0-9_]*(?:API_KEY|SECRET|ACCESS_KEY|PASSWORD|TOKEN))(\s*=\s*)(["'`“”]?)(?!\[REDACTED)([^\s"'`“”]{6,})\3/g,
|
|
130
|
+
replace: '$1$2$3[REDACTED-ENV-SECRET]$3',
|
|
131
|
+
},
|
|
132
|
+
];
|
|
133
|
+
/**
|
|
134
|
+
* Conservative high-entropy fallback, applied to ASSISTANT records only (the
|
|
135
|
+
* assistant echoes tool output, so unknown-vendor keys can leak there). Matches
|
|
136
|
+
* a standalone 32+ char token of [A-Za-z0-9_+=-] that has at least one
|
|
137
|
+
* uppercase, one lowercase, and four digits. Mixed-case + digit floor skips
|
|
138
|
+
* git SHAs / sha256 hex / UUIDs (lowercase) and CONSTANT_NAMES (no lowercase);
|
|
139
|
+
* the "/" and "." boundaries skip paths and dotted identifiers. Measured 0 hits
|
|
140
|
+
* across 2508 real assistant records in session c97588f4 (no false positives).
|
|
141
|
+
*/
|
|
142
|
+
export const HIGH_ENTROPY_RULE = {
|
|
143
|
+
kind: 'HIGH-ENTROPY',
|
|
144
|
+
re: /(?<![A-Za-z0-9_+=\/.\[-])(?=[A-Za-z0-9_+=-]*[A-Z])(?=[A-Za-z0-9_+=-]*[a-z])(?=(?:[A-Za-z0-9_+=-]*\d){4})[A-Za-z0-9_+=-]{32,}(?![A-Za-z0-9_+=\/.\]-])/g,
|
|
145
|
+
replace: '[REDACTED-HIGH-ENTROPY]',
|
|
146
|
+
};
|
|
147
|
+
function rulesFor(opts = {}) {
|
|
148
|
+
return opts.assistant ? [...SECRET_RULES, HIGH_ENTROPY_RULE] : SECRET_RULES;
|
|
149
|
+
}
|
|
150
|
+
/** Mask every secret-shaped substring in `text`. Pure. */
|
|
151
|
+
export function redactSecrets(text, opts = {}) {
|
|
152
|
+
let out = text;
|
|
153
|
+
for (const rule of rulesFor(opts)) {
|
|
154
|
+
out = out.replace(rule.re, rule.replace);
|
|
155
|
+
}
|
|
156
|
+
return out;
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Detector used by the verification harness: returns the list of secret KINDs
|
|
160
|
+
* that STILL match `text`. The authoritative "no secret survives" invariant is
|
|
161
|
+
* `detectSecrets(output).length === 0`. This is precise (uses the same shapes
|
|
162
|
+
* as redaction) rather than a naive substring scan, which would false-positive
|
|
163
|
+
* on benign prose like "task-budgets" or "fo1_/sbp_/xox/Bearer patterns".
|
|
164
|
+
*/
|
|
165
|
+
export function detectSecrets(text, opts = {}) {
|
|
166
|
+
const hits = [];
|
|
167
|
+
for (const rule of rulesFor(opts)) {
|
|
168
|
+
// Fresh regex so lastIndex state never leaks between calls.
|
|
169
|
+
const re = new RegExp(rule.re.source, rule.re.flags);
|
|
170
|
+
let m;
|
|
171
|
+
while ((m = re.exec(text)) !== null) {
|
|
172
|
+
// The ENV-SECRET rule legitimately leaves a "NAME=[REDACTED-...]" shell;
|
|
173
|
+
// that is NOT a surviving secret, so ignore matches whose value is already redacted.
|
|
174
|
+
if (m[0].includes('[REDACTED')) {
|
|
175
|
+
if (m.index === re.lastIndex)
|
|
176
|
+
re.lastIndex++;
|
|
177
|
+
continue;
|
|
178
|
+
}
|
|
179
|
+
hits.push({ kind: rule.kind, match: m[0] });
|
|
180
|
+
if (m.index === re.lastIndex)
|
|
181
|
+
re.lastIndex++;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
return hits;
|
|
185
|
+
}
|
|
@@ -81,46 +81,7 @@ export interface SanitizeStats {
|
|
|
81
81
|
* transcribed audio/video — resolves to the SAME normalized record stream.
|
|
82
82
|
*/
|
|
83
83
|
export type TranscriptAdapter = () => RawRecord[];
|
|
84
|
-
|
|
85
|
-
kind: string;
|
|
86
|
-
/** Global regex. Capture groups allowed; `replace` controls the substitution. */
|
|
87
|
-
re: RegExp;
|
|
88
|
-
replace: string;
|
|
89
|
-
}
|
|
90
|
-
/**
|
|
91
|
-
* Order matters. Specific, high-confidence token shapes run FIRST so their KIND
|
|
92
|
-
* label wins; the broad `*_API_KEY=/_SECRET=/_TOKEN=` assignment rule runs LAST
|
|
93
|
-
* to catch any leftover generic value assignment (and skips already-redacted
|
|
94
|
-
* values via a negative lookahead).
|
|
95
|
-
*/
|
|
96
|
-
export declare const SECRET_RULES: SecretRule[];
|
|
97
|
-
/**
|
|
98
|
-
* Conservative high-entropy fallback, applied to ASSISTANT records only (the
|
|
99
|
-
* assistant echoes tool output, so unknown-vendor keys can leak there). Matches
|
|
100
|
-
* a standalone 32+ char token of [A-Za-z0-9_+=-] that has at least one
|
|
101
|
-
* uppercase, one lowercase, and four digits. Mixed-case + digit floor skips
|
|
102
|
-
* git SHAs / sha256 hex / UUIDs (lowercase) and CONSTANT_NAMES (no lowercase);
|
|
103
|
-
* the "/" and "." boundaries skip paths and dotted identifiers. Measured 0 hits
|
|
104
|
-
* across 2508 real assistant records in session c97588f4 (no false positives).
|
|
105
|
-
*/
|
|
106
|
-
export declare const HIGH_ENTROPY_RULE: SecretRule;
|
|
107
|
-
export interface SecretScanOptions {
|
|
108
|
-
/** Treat as an assistant record: also apply the high-entropy fallback. */
|
|
109
|
-
assistant?: boolean;
|
|
110
|
-
}
|
|
111
|
-
/** Mask every secret-shaped substring in `text`. Pure. */
|
|
112
|
-
export declare function redactSecrets(text: string, opts?: SecretScanOptions): string;
|
|
113
|
-
/**
|
|
114
|
-
* Detector used by the verification harness: returns the list of secret KINDs
|
|
115
|
-
* that STILL match `text`. The authoritative "no secret survives" invariant is
|
|
116
|
-
* `detectSecrets(output).length === 0`. This is precise (uses the same shapes
|
|
117
|
-
* as redaction) rather than a naive substring scan, which would false-positive
|
|
118
|
-
* on benign prose like "task-budgets" or "fo1_/sbp_/xox/Bearer patterns".
|
|
119
|
-
*/
|
|
120
|
-
export declare function detectSecrets(text: string, opts?: SecretScanOptions): {
|
|
121
|
-
kind: string;
|
|
122
|
-
match: string;
|
|
123
|
-
}[];
|
|
84
|
+
export { redactSecrets, detectSecrets } from './secret-rules.js';
|
|
124
85
|
/**
|
|
125
86
|
* CORE per-record sanitizer. Pure and source-independent: identical behavior
|
|
126
87
|
* whether `raw.text` came from JSONL, pasted text, or a future STT transcript.
|
|
@@ -206,4 +167,3 @@ export interface MediaAdapterOptions {
|
|
|
206
167
|
provider?: 'soniox' | 'deepgram';
|
|
207
168
|
}
|
|
208
169
|
export declare function mediaAdapter(_opts: MediaAdapterOptions): RawRecord[];
|
|
209
|
-
export {};
|