@ashx-j/lunr-dev 0.2.40-dev.61.1 → 0.2.40-dev.62.1

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.
Files changed (53) hide show
  1. package/dist/core/agent-session.d.ts +10 -0
  2. package/dist/core/agent-session.js +49 -1
  3. package/dist/core/auth-storage.d.ts +2 -0
  4. package/dist/core/auth-storage.js +5 -0
  5. package/dist/core/model-runtime.d.ts +3 -0
  6. package/dist/core/model-runtime.js +20 -5
  7. package/dist/core/resolve-config-value.d.ts +5 -0
  8. package/dist/core/resolve-config-value.js +16 -0
  9. package/dist/core/saved-login-redaction.d.ts +74 -0
  10. package/dist/core/saved-login-redaction.js +322 -0
  11. package/dist/core/session-manager.d.ts +13 -0
  12. package/dist/core/session-manager.js +19 -8
  13. package/dist/core/subscriptions.d.ts +2 -0
  14. package/dist/core/subscriptions.js +5 -0
  15. package/dist/node-runtime/{agent-session-services-ITD5IM37.js → agent-session-services-2MOVXNT5.js} +5 -5
  16. package/dist/node-runtime/{builtin-extensions-XXQB5IKI.js → builtin-extensions-S23KMP4W.js} +1 -1
  17. package/dist/node-runtime/{chunk-HQ5A4VVO.js → chunk-2EQL4TLM.js} +19 -8
  18. package/dist/node-runtime/{chunk-4OALPI3C.js → chunk-6NUWUTVC.js} +1 -1
  19. package/dist/node-runtime/{chunk-QNFPZIP3.js → chunk-C5PAMN7Y.js} +244 -17
  20. package/dist/node-runtime/{chunk-GX7UZDSI.js → chunk-EWYLZSES.js} +1 -1
  21. package/dist/node-runtime/{chunk-GAWWLIGY.js → chunk-FIDZY4JX.js} +4 -4
  22. package/dist/node-runtime/{chunk-HPZUPSXR.js → chunk-KV4RBM3L.js} +10 -10
  23. package/dist/node-runtime/{chunk-RXG6DWO2.js → chunk-S2BEWKPR.js} +3 -3
  24. package/dist/node-runtime/{chunk-2HWXHS3B.js → chunk-SJSWJWAT.js} +28 -9
  25. package/dist/node-runtime/{chunk-AYHDHGIW.js → chunk-TKN7VEZR.js} +10 -10
  26. package/dist/node-runtime/{chunk-OZAOEWH2.js → chunk-TYPA7FJQ.js} +1 -1
  27. package/dist/node-runtime/{chunk-WXC5RUA3.js → chunk-VBNMCUV2.js} +2 -2
  28. package/dist/node-runtime/{chunk-2B5RTZA4.js → chunk-XLGSGHTG.js} +1 -1
  29. package/dist/node-runtime/{chunk-2XLJRAYG.js → chunk-YVOU5W7H.js} +5 -5
  30. package/dist/node-runtime/{command-ITCOAWXU.js → command-ARYMXJF7.js} +3 -3
  31. package/dist/node-runtime/{commands-2UG5F4VT.js → commands-E3EQFYAC.js} +5 -5
  32. package/dist/node-runtime/{doctor-cli-TU4HVXWP.js → doctor-cli-DWI46VPW.js} +1 -1
  33. package/dist/node-runtime/{export-html-SW3CIZRJ.js → export-html-YM4QKDTD.js} +1 -1
  34. package/dist/node-runtime/{gateway-PVL3CM65.js → gateway-I7YA6MJ4.js} +9 -9
  35. package/dist/node-runtime/index.js +10 -10
  36. package/dist/node-runtime/{install-cli-YIIFVCFM.js → install-cli-A5HIEOOK.js} +1 -1
  37. package/dist/node-runtime/{interactive-mode-OQ3N64DI.js → interactive-mode-6UDD62TS.js} +7 -7
  38. package/dist/node-runtime/{lunr-cron-UKWWRJXT.js → lunr-cron-FYLIKLSZ.js} +4 -4
  39. package/dist/node-runtime/main.js +7 -7
  40. package/dist/node-runtime/{mobile-commands-HQXEYAF6.js → mobile-commands-CKQHQBEW.js} +2 -2
  41. package/dist/node-runtime/{model-runtime-T552YPXL.js → model-runtime-RFMIP23V.js} +1 -1
  42. package/dist/node-runtime/{pi-subagents-2ZE5BKGM.js → pi-subagents-C5FBVY72.js} +1 -1
  43. package/dist/node-runtime/{print-mode-LQS3GH3Y.js → print-mode-I6R6RWLJ.js} +6 -6
  44. package/dist/node-runtime/rpc-entry.js +7 -7
  45. package/dist/node-runtime/{session-handoff-TEOBWIFW.js → session-handoff-XCKL6SRJ.js} +2 -2
  46. package/dist/node-runtime/{session-manager-I6535F4R.js → session-manager-AGK72CRA.js} +1 -1
  47. package/dist/node-runtime/{setup-7IC2PQIB.js → setup-HF7HDJKG.js} +1 -1
  48. package/dist/node-runtime/{subagent-executor-LXYQ3RES.js → subagent-executor-N6FKWYCK.js} +1 -1
  49. package/docs/security.md +28 -0
  50. package/install-lock/package-lock.json +24 -24
  51. package/install-lock/package.json +2 -2
  52. package/npm-shrinkwrap.json +12 -12
  53. package/package.json +4 -4
@@ -174,6 +174,14 @@ export declare function loadEntriesFromFile(filePath: string): FileEntry[];
174
174
  /** Exported for testing */
175
175
  export declare function findMostRecentSession(sessionDir: string, cwd?: string): string | null;
176
176
  export type SessionListProgress = (loaded: number, total: number) => void;
177
+ /**
178
+ * Removes saved-login values (`core/saved-login-redaction.ts`): from each serialized JSONL line the
179
+ * manager writes, and from summary text before it enters the session and the model's context.
180
+ */
181
+ export interface SessionSavedLoginFilter {
182
+ redactSessionLine(line: string): string;
183
+ redactText(text: string): string;
184
+ }
177
185
  /**
178
186
  * Manages conversation sessions as append-only trees stored in JSONL files.
179
187
  *
@@ -193,6 +201,7 @@ export declare class SessionManager {
193
201
  private persist;
194
202
  private flushed;
195
203
  private needsAppendSeparator;
204
+ private savedLoginFilter;
196
205
  private fileEntries;
197
206
  private byId;
198
207
  private labelsById;
@@ -223,6 +232,10 @@ export declare class SessionManager {
223
232
  * Rename protects the previous log on write failure, not against every power-loss scenario.
224
233
  */
225
234
  private _rewriteFile;
235
+ /** Set by AgentSession, so every line this manager writes from now on is filtered. */
236
+ setSavedLoginFilter(filter: SessionSavedLoginFilter | undefined): void;
237
+ /** The one place an entry becomes a JSONL line. */
238
+ private serialize;
226
239
  private _appendToFile;
227
240
  isPersisted(): boolean;
228
241
  getCwd(): string;
@@ -536,7 +536,7 @@ function renameReplacing(from, to) {
536
536
  renameSync(from, to);
537
537
  }
538
538
  /** Atomically replace a log without changing the manager that owns it. */
539
- function writeSessionEntries(file, entries) {
539
+ function writeSessionEntries(file, entries, serialize) {
540
540
  const mode = existsSync(file) ? statSync(file).mode & 0o777 : SESSION_FILE_MODE;
541
541
  const temp = `${file}.${randomUUID()}.tmp`;
542
542
  const fd = openSync(temp, "wx", mode);
@@ -544,7 +544,7 @@ function writeSessionEntries(file, entries) {
544
544
  try {
545
545
  fchmodSync(fd, mode);
546
546
  for (const entry of entries) {
547
- writeFileSync(fd, `${JSON.stringify(entry)}\n`);
547
+ writeFileSync(fd, `${serialize(entry)}\n`);
548
548
  }
549
549
  fsyncSync(fd);
550
550
  }
@@ -578,6 +578,7 @@ export class SessionManager {
578
578
  persist;
579
579
  flushed = false;
580
580
  needsAppendSeparator = false;
581
+ savedLoginFilter;
581
582
  fileEntries = [];
582
583
  byId = new Map();
583
584
  labelsById = new Map();
@@ -826,13 +827,22 @@ export class SessionManager {
826
827
  if (!this.persist || !this.sessionFile)
827
828
  return;
828
829
  const file = this.ownership?.owner.file ?? this.sessionFile;
829
- writeSessionEntries(file, this.fileEntries);
830
+ writeSessionEntries(file, this.fileEntries, (entry) => this.serialize(entry));
830
831
  this.needsAppendSeparator = false;
831
832
  }
833
+ /** Set by AgentSession, so every line this manager writes from now on is filtered. */
834
+ setSavedLoginFilter(filter) {
835
+ this.savedLoginFilter = filter;
836
+ }
837
+ /** The one place an entry becomes a JSONL line. */
838
+ serialize(entry) {
839
+ const line = JSON.stringify(entry);
840
+ return this.savedLoginFilter ? this.savedLoginFilter.redactSessionLine(line) : line;
841
+ }
832
842
  _appendToFile(entry) {
833
843
  if (!this.sessionFile)
834
844
  return;
835
- appendFileSync(this.sessionFile, `${this.needsAppendSeparator ? "\n" : ""}${JSON.stringify(entry)}\n`, {
845
+ appendFileSync(this.sessionFile, `${this.needsAppendSeparator ? "\n" : ""}${this.serialize(entry)}\n`, {
836
846
  mode: SESSION_FILE_MODE,
837
847
  });
838
848
  this.needsAppendSeparator = false;
@@ -874,7 +884,7 @@ export class SessionManager {
874
884
  const fd = openSync(this.sessionFile, "wx", SESSION_FILE_MODE);
875
885
  try {
876
886
  for (const e of this.fileEntries) {
877
- writeFileSync(fd, `${JSON.stringify(e)}\n`);
887
+ writeFileSync(fd, `${this.serialize(e)}\n`);
878
888
  }
879
889
  }
880
890
  finally {
@@ -957,7 +967,8 @@ export class SessionManager {
957
967
  id: generateId(this.byId),
958
968
  parentId: this.leafId,
959
969
  timestamp: new Date(Math.max(Date.now(), this.newestTimestampFrom(firstKeptEntryId) + 1)).toISOString(),
960
- summary,
970
+ // The summary replaces history in the model's context, so it gets the text filter too.
971
+ summary: this.savedLoginFilter ? this.savedLoginFilter.redactText(summary) : summary,
961
972
  firstKeptEntryId,
962
973
  tokensBefore,
963
974
  details,
@@ -1249,7 +1260,7 @@ export class SessionManager {
1249
1260
  parentId: branchFromId,
1250
1261
  timestamp: new Date().toISOString(),
1251
1262
  fromId: branchFromId ?? "root",
1252
- summary,
1263
+ summary: this.savedLoginFilter ? this.savedLoginFilter.redactText(summary) : summary,
1253
1264
  details,
1254
1265
  fromHook,
1255
1266
  };
@@ -1325,7 +1336,7 @@ export class SessionManager {
1325
1336
  try {
1326
1337
  nextOwnership.bindSession(newSessionId);
1327
1338
  if (hasAssistant) {
1328
- writeSessionEntries(nextOwnership.owner.file, entries);
1339
+ writeSessionEntries(nextOwnership.owner.file, entries, (entry) => this.serialize(entry));
1329
1340
  wroteFork = true;
1330
1341
  }
1331
1342
  this.ownership?.release();
@@ -38,6 +38,8 @@ export declare class SubscriptionManager {
38
38
  private queue;
39
39
  private memoryExhausted;
40
40
  private constructor();
41
+ /** The pool keys loaded so far, for `SavedLoginRedactor`; the same array until they change. */
42
+ savedLoginValues(): readonly string[];
41
43
  static create(authStorage: CredentialStore, path?: string): SubscriptionManager;
42
44
  static fromStorage(authStorage: CredentialStore, storage: AuthStorageBackend): SubscriptionManager;
43
45
  static inMemory(authStorage: CredentialStore, data?: SubscriptionData): SubscriptionManager;
@@ -14,6 +14,7 @@ import { createHash } from "node:crypto";
14
14
  import { join } from "path";
15
15
  import { getAgentDir } from "../config.js";
16
16
  import { FileAuthStorageBackend, InMemoryAuthStorageBackend } from "./auth-storage.js";
17
+ import { poolValuesOf } from "./saved-login-redaction.js";
17
18
  import { parseResetTimeMs } from "./usage-limit.js";
18
19
  import { clearPlanUsageCache } from "./usage-service.js";
19
20
  /** Request identities are non-secret digests kept outside messages and storage. */
@@ -33,6 +34,10 @@ export class SubscriptionManager {
33
34
  this.authStorage = authStorage;
34
35
  this.storage = storage;
35
36
  }
37
+ /** The pool keys loaded so far, for `SavedLoginRedactor`; the same array until they change. */
38
+ savedLoginValues() {
39
+ return poolValuesOf(this.data);
40
+ }
36
41
  static create(authStorage, path) {
37
42
  return new SubscriptionManager(authStorage, new FileAuthStorageBackend(path ?? join(getAgentDir(), "subscriptions.json")));
38
43
  }
@@ -2,13 +2,13 @@ import { createRequire as __lunrRequire } from "node:module"; const require = __
2
2
  import {
3
3
  createAgentSessionFromServices,
4
4
  createAgentSessionServices
5
- } from "./chunk-2HWXHS3B.js";
5
+ } from "./chunk-SJSWJWAT.js";
6
6
  import "./chunk-QP4I6GEW.js";
7
7
  import "./chunk-KDBQKVNZ.js";
8
8
  import "./chunk-GLSX5WQB.js";
9
9
  import "./chunk-DVGWF6A2.js";
10
10
  import "./chunk-F5NKEKNO.js";
11
- import "./chunk-2B5RTZA4.js";
11
+ import "./chunk-XLGSGHTG.js";
12
12
  import "./chunk-3XBYDZWT.js";
13
13
  import "./chunk-AW6PDL4D.js";
14
14
  import "./chunk-6Z5EUITR.js";
@@ -23,7 +23,7 @@ import "./chunk-TCT6PCUR.js";
23
23
  import "./chunk-LGRRFSE7.js";
24
24
  import "./chunk-XPKOWSYN.js";
25
25
  import "./chunk-BDRGN3L2.js";
26
- import "./chunk-QNFPZIP3.js";
26
+ import "./chunk-C5PAMN7Y.js";
27
27
  import "./chunk-4SBPXNVV.js";
28
28
  import "./chunk-53YJI7JU.js";
29
29
  import "./chunk-V3AX7UT3.js";
@@ -34,8 +34,8 @@ import "./chunk-5ZDIECKE.js";
34
34
  import "./chunk-SJVCEPQS.js";
35
35
  import "./chunk-V4VKJDRA.js";
36
36
  import "./chunk-5UCVERGR.js";
37
- import "./chunk-4OALPI3C.js";
38
- import "./chunk-HQ5A4VVO.js";
37
+ import "./chunk-6NUWUTVC.js";
38
+ import "./chunk-2EQL4TLM.js";
39
39
  import "./chunk-FVDOXRUD.js";
40
40
  import "./chunk-MIWAGF3T.js";
41
41
  import "./chunk-SRCSFFDW.js";
@@ -6,7 +6,7 @@ import {
6
6
  lightBuiltinExtensions,
7
7
  loadAllBuiltinExtensions,
8
8
  loadDeferredBuiltinExtensions
9
- } from "./chunk-WXC5RUA3.js";
9
+ } from "./chunk-VBNMCUV2.js";
10
10
  import "./chunk-PDQLKTGM.js";
11
11
  import "./chunk-PKDES47T.js";
12
12
  import "./chunk-5ZH3ZFIZ.js";
@@ -342,13 +342,13 @@ function renameReplacing(from, to) {
342
342
  }
343
343
  renameSync(from, to);
344
344
  }
345
- function writeSessionEntries(file, entries) {
345
+ function writeSessionEntries(file, entries, serialize) {
346
346
  let mode = existsSync(file) ? statSync(file).mode & 511 : SESSION_FILE_MODE, temp = `${file}.${randomUUID()}.tmp`, fd = openSync(temp, "wx", mode);
347
347
  try {
348
348
  try {
349
349
  fchmodSync(fd, mode);
350
350
  for (let entry of entries)
351
- writeFileSync(fd, `${JSON.stringify(entry)}
351
+ writeFileSync(fd, `${serialize(entry)}
352
352
  `);
353
353
  fsyncSync(fd);
354
354
  } finally {
@@ -367,6 +367,7 @@ var SessionManager = class _SessionManager {
367
367
  persist;
368
368
  flushed = !1;
369
369
  needsAppendSeparator = !1;
370
+ savedLoginFilter;
370
371
  fileEntries = [];
371
372
  byId = /* @__PURE__ */ new Map();
372
373
  labelsById = /* @__PURE__ */ new Map();
@@ -510,11 +511,20 @@ var SessionManager = class _SessionManager {
510
511
  if (this.assertWritable(), !this.persist || !this.sessionFile)
511
512
  return;
512
513
  let file = this.ownership?.owner.file ?? this.sessionFile;
513
- writeSessionEntries(file, this.fileEntries), this.needsAppendSeparator = !1;
514
+ writeSessionEntries(file, this.fileEntries, (entry) => this.serialize(entry)), this.needsAppendSeparator = !1;
515
+ }
516
+ /** Set by AgentSession, so every line this manager writes from now on is filtered. */
517
+ setSavedLoginFilter(filter) {
518
+ this.savedLoginFilter = filter;
519
+ }
520
+ /** The one place an entry becomes a JSONL line. */
521
+ serialize(entry) {
522
+ let line = JSON.stringify(entry);
523
+ return this.savedLoginFilter ? this.savedLoginFilter.redactSessionLine(line) : line;
514
524
  }
515
525
  _appendToFile(entry) {
516
526
  this.sessionFile && (appendFileSync(this.sessionFile, `${this.needsAppendSeparator ? `
517
- ` : ""}${JSON.stringify(entry)}
527
+ ` : ""}${this.serialize(entry)}
518
528
  `, {
519
529
  mode: SESSION_FILE_MODE
520
530
  }), this.needsAppendSeparator = !1);
@@ -550,7 +560,7 @@ var SessionManager = class _SessionManager {
550
560
  let fd = openSync(this.sessionFile, "wx", SESSION_FILE_MODE);
551
561
  try {
552
562
  for (let e of this.fileEntries)
553
- writeFileSync(fd, `${JSON.stringify(e)}
563
+ writeFileSync(fd, `${this.serialize(e)}
554
564
  `);
555
565
  } finally {
556
566
  closeSync(fd);
@@ -621,7 +631,8 @@ var SessionManager = class _SessionManager {
621
631
  id: generateId(this.byId),
622
632
  parentId: this.leafId,
623
633
  timestamp: new Date(Math.max(Date.now(), this.newestTimestampFrom(firstKeptEntryId) + 1)).toISOString(),
624
- summary,
634
+ // The summary replaces history in the model's context, so it gets the text filter too.
635
+ summary: this.savedLoginFilter ? this.savedLoginFilter.redactText(summary) : summary,
625
636
  firstKeptEntryId,
626
637
  tokensBefore,
627
638
  details,
@@ -861,7 +872,7 @@ var SessionManager = class _SessionManager {
861
872
  parentId: branchFromId,
862
873
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
863
874
  fromId: branchFromId ?? "root",
864
- summary,
875
+ summary: this.savedLoginFilter ? this.savedLoginFilter.redactText(summary) : summary,
865
876
  details,
866
877
  fromHook
867
878
  };
@@ -907,7 +918,7 @@ var SessionManager = class _SessionManager {
907
918
  this.saveLeaf();
908
919
  let nextOwnership = new SessionOwnership(canonicalSessionPath(newSessionFile)), wroteFork = !1;
909
920
  try {
910
- nextOwnership.bindSession(newSessionId), hasAssistant && (writeSessionEntries(nextOwnership.owner.file, entries), wroteFork = !0), this.ownership?.release();
921
+ nextOwnership.bindSession(newSessionId), hasAssistant && (writeSessionEntries(nextOwnership.owner.file, entries, (entry) => this.serialize(entry)), wroteFork = !0), this.ownership?.release();
911
922
  } catch (error) {
912
923
  if (wroteFork)
913
924
  try {
@@ -1,7 +1,7 @@
1
1
  import { createRequire as __lunrRequire } from "node:module"; const require = __lunrRequire(import.meta.url);
2
2
  import {
3
3
  SessionManager
4
- } from "./chunk-HQ5A4VVO.js";
4
+ } from "./chunk-2EQL4TLM.js";
5
5
  import {
6
6
  SessionOwnership,
7
7
  canonicalSessionPath,