@remnic/core 9.3.518 → 9.3.520

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.
@@ -104,9 +104,9 @@ declare const recallRequestSchema: z.ZodObject<{
104
104
  includeLowConfidence: z.ZodOptional<z.ZodBoolean>;
105
105
  }, "strip", z.ZodTypeAny, {
106
106
  query: string;
107
+ namespace?: string | undefined;
107
108
  sessionKey?: string | undefined;
108
109
  tags?: string[] | undefined;
109
- namespace?: string | undefined;
110
110
  topK?: number | undefined;
111
111
  mode?: "no_recall" | "minimal" | "full" | "graph_mode" | "auto" | undefined;
112
112
  cwd?: string | undefined;
@@ -125,9 +125,9 @@ declare const recallRequestSchema: z.ZodObject<{
125
125
  tagMatch?: "all" | "any" | undefined;
126
126
  }, {
127
127
  query: string;
128
+ namespace?: string | undefined;
128
129
  sessionKey?: string | undefined;
129
130
  tags?: string[] | undefined;
130
- namespace?: string | undefined;
131
131
  topK?: number | undefined;
132
132
  mode?: "no_recall" | "minimal" | "full" | "graph_mode" | "auto" | undefined;
133
133
  cwd?: string | undefined;
@@ -149,11 +149,11 @@ declare const recallExplainRequestSchema: z.ZodObject<{
149
149
  sessionKey: z.ZodOptional<z.ZodString>;
150
150
  namespace: z.ZodOptional<z.ZodString>;
151
151
  }, "strip", z.ZodTypeAny, {
152
- sessionKey?: string | undefined;
153
152
  namespace?: string | undefined;
154
- }, {
155
153
  sessionKey?: string | undefined;
154
+ }, {
156
155
  namespace?: string | undefined;
156
+ sessionKey?: string | undefined;
157
157
  }>;
158
158
  /**
159
159
  * Standalone "set coding context" request. Used by the HTTP endpoint
@@ -363,28 +363,28 @@ declare const memoryStoreRequestSchema: z.ZodObject<{
363
363
  sourceReason: z.ZodOptional<z.ZodString>;
364
364
  }, "strip", z.ZodTypeAny, {
365
365
  content: string;
366
+ namespace?: string | undefined;
367
+ category?: "fact" | "preference" | "correction" | "entity" | "decision" | "relationship" | "principle" | "commitment" | "moment" | "skill" | "rule" | "procedure" | "reasoning_trace" | undefined;
368
+ confidence?: number | undefined;
369
+ ttl?: string | undefined;
366
370
  schemaVersion?: number | undefined;
367
371
  sessionKey?: string | undefined;
368
372
  tags?: string[] | undefined;
369
373
  dryRun?: boolean | undefined;
370
- namespace?: string | undefined;
371
- category?: "fact" | "preference" | "correction" | "entity" | "decision" | "relationship" | "principle" | "commitment" | "moment" | "skill" | "rule" | "procedure" | "reasoning_trace" | undefined;
372
- confidence?: number | undefined;
373
374
  entityRef?: string | undefined;
374
- ttl?: string | undefined;
375
375
  sourceReason?: string | undefined;
376
376
  idempotencyKey?: string | undefined;
377
377
  }, {
378
378
  content: string;
379
+ namespace?: string | undefined;
380
+ category?: "fact" | "preference" | "correction" | "entity" | "decision" | "relationship" | "principle" | "commitment" | "moment" | "skill" | "rule" | "procedure" | "reasoning_trace" | undefined;
381
+ confidence?: number | undefined;
382
+ ttl?: string | undefined;
379
383
  schemaVersion?: number | undefined;
380
384
  sessionKey?: string | undefined;
381
385
  tags?: string[] | undefined;
382
386
  dryRun?: boolean | undefined;
383
- namespace?: string | undefined;
384
- category?: "fact" | "preference" | "correction" | "entity" | "decision" | "relationship" | "principle" | "commitment" | "moment" | "skill" | "rule" | "procedure" | "reasoning_trace" | undefined;
385
- confidence?: number | undefined;
386
387
  entityRef?: string | undefined;
387
- ttl?: string | undefined;
388
388
  sourceReason?: string | undefined;
389
389
  idempotencyKey?: string | undefined;
390
390
  }>;
@@ -403,28 +403,28 @@ declare const suggestionSubmitRequestSchema: z.ZodObject<{
403
403
  sourceReason: z.ZodOptional<z.ZodString>;
404
404
  }, "strip", z.ZodTypeAny, {
405
405
  content: string;
406
+ namespace?: string | undefined;
407
+ category?: "fact" | "preference" | "correction" | "entity" | "decision" | "relationship" | "principle" | "commitment" | "moment" | "skill" | "rule" | "procedure" | "reasoning_trace" | undefined;
408
+ confidence?: number | undefined;
409
+ ttl?: string | undefined;
406
410
  schemaVersion?: number | undefined;
407
411
  sessionKey?: string | undefined;
408
412
  tags?: string[] | undefined;
409
413
  dryRun?: boolean | undefined;
410
- namespace?: string | undefined;
411
- category?: "fact" | "preference" | "correction" | "entity" | "decision" | "relationship" | "principle" | "commitment" | "moment" | "skill" | "rule" | "procedure" | "reasoning_trace" | undefined;
412
- confidence?: number | undefined;
413
414
  entityRef?: string | undefined;
414
- ttl?: string | undefined;
415
415
  sourceReason?: string | undefined;
416
416
  idempotencyKey?: string | undefined;
417
417
  }, {
418
418
  content: string;
419
+ namespace?: string | undefined;
420
+ category?: "fact" | "preference" | "correction" | "entity" | "decision" | "relationship" | "principle" | "commitment" | "moment" | "skill" | "rule" | "procedure" | "reasoning_trace" | undefined;
421
+ confidence?: number | undefined;
422
+ ttl?: string | undefined;
419
423
  schemaVersion?: number | undefined;
420
424
  sessionKey?: string | undefined;
421
425
  tags?: string[] | undefined;
422
426
  dryRun?: boolean | undefined;
423
- namespace?: string | undefined;
424
- category?: "fact" | "preference" | "correction" | "entity" | "decision" | "relationship" | "principle" | "commitment" | "moment" | "skill" | "rule" | "procedure" | "reasoning_trace" | undefined;
425
- confidence?: number | undefined;
426
427
  entityRef?: string | undefined;
427
- ttl?: string | undefined;
428
428
  sourceReason?: string | undefined;
429
429
  idempotencyKey?: string | undefined;
430
430
  }>;
@@ -456,18 +456,18 @@ declare const trustZonePromoteRequestSchema: z.ZodObject<{
456
456
  recordId: string;
457
457
  targetZone: "working" | "trusted";
458
458
  promotionReason: string;
459
+ namespace?: string | undefined;
459
460
  recordedAt?: string | undefined;
460
461
  summary?: string | undefined;
461
462
  dryRun?: boolean | undefined;
462
- namespace?: string | undefined;
463
463
  }, {
464
464
  recordId: string;
465
465
  targetZone: "working" | "trusted";
466
466
  promotionReason: string;
467
+ namespace?: string | undefined;
467
468
  recordedAt?: string | undefined;
468
469
  summary?: string | undefined;
469
470
  dryRun?: boolean | undefined;
470
- namespace?: string | undefined;
471
471
  }>;
472
472
  declare const trustZoneDemoSeedRequestSchema: z.ZodObject<{
473
473
  scenario: z.ZodOptional<z.ZodString>;
@@ -475,14 +475,14 @@ declare const trustZoneDemoSeedRequestSchema: z.ZodObject<{
475
475
  dryRun: z.ZodOptional<z.ZodBoolean>;
476
476
  namespace: z.ZodOptional<z.ZodString>;
477
477
  }, "strip", z.ZodTypeAny, {
478
+ namespace?: string | undefined;
478
479
  recordedAt?: string | undefined;
479
480
  dryRun?: boolean | undefined;
480
- namespace?: string | undefined;
481
481
  scenario?: string | undefined;
482
482
  }, {
483
+ namespace?: string | undefined;
483
484
  recordedAt?: string | undefined;
484
485
  dryRun?: boolean | undefined;
485
- namespace?: string | undefined;
486
486
  scenario?: string | undefined;
487
487
  }>;
488
488
  declare const lcmSearchRequestSchema: z.ZodObject<{
@@ -493,15 +493,15 @@ declare const lcmSearchRequestSchema: z.ZodObject<{
493
493
  limit: z.ZodOptional<z.ZodNumber>;
494
494
  }, "strip", z.ZodTypeAny, {
495
495
  query: string;
496
- sessionKey?: string | undefined;
497
496
  namespace?: string | undefined;
498
497
  limit?: number | undefined;
498
+ sessionKey?: string | undefined;
499
499
  sessionPrefix?: string | undefined;
500
500
  }, {
501
501
  query: string;
502
- sessionKey?: string | undefined;
503
502
  namespace?: string | undefined;
504
503
  limit?: number | undefined;
504
+ sessionKey?: string | undefined;
505
505
  sessionPrefix?: string | undefined;
506
506
  }>;
507
507
  declare const lcmCompactionFlushRequestSchema: z.ZodObject<{
@@ -535,12 +535,12 @@ declare const daySummaryRequestSchema: z.ZodObject<{
535
535
  sessionKey: z.ZodOptional<z.ZodString>;
536
536
  namespace: z.ZodOptional<z.ZodString>;
537
537
  }, "strip", z.ZodTypeAny, {
538
- sessionKey?: string | undefined;
539
538
  namespace?: string | undefined;
539
+ sessionKey?: string | undefined;
540
540
  memories?: string | undefined;
541
541
  }, {
542
- sessionKey?: string | undefined;
543
542
  namespace?: string | undefined;
543
+ sessionKey?: string | undefined;
544
544
  memories?: string | undefined;
545
545
  }>;
546
546
  declare const capsuleExportRequestSchema: z.ZodObject<{
@@ -730,11 +730,11 @@ declare const actionConfidenceRequestSchema: z.ZodObject<{
730
730
  safety: z.ZodEffects<z.ZodNullable<z.ZodOptional<z.ZodEnum<["safe", "requires-review", "blocked"]>>>, NonNullable<"safe" | "requires-review" | "blocked"> | undefined, "safe" | "requires-review" | "blocked" | null | undefined>;
731
731
  safetyReasons: z.ZodEffects<z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>, string[] | undefined, string[] | null | undefined>;
732
732
  }, "strict", z.ZodTypeAny, {
733
+ confidence?: number | undefined;
733
734
  source?: string | undefined;
734
735
  stale?: boolean | undefined;
735
736
  created?: string | undefined;
736
737
  updated?: string | undefined;
737
- confidence?: number | undefined;
738
738
  scope?: string | undefined;
739
739
  retrievalReason?: string | undefined;
740
740
  safety?: NonNullable<"safe" | "requires-review" | "blocked"> | undefined;
@@ -744,11 +744,11 @@ declare const actionConfidenceRequestSchema: z.ZodObject<{
744
744
  safetyReasons?: string[] | undefined;
745
745
  userContextScopes?: string[] | undefined;
746
746
  }, {
747
+ confidence?: number | null | undefined;
747
748
  source?: string | null | undefined;
748
749
  stale?: boolean | null | undefined;
749
750
  created?: string | null | undefined;
750
751
  updated?: string | null | undefined;
751
- confidence?: number | null | undefined;
752
752
  scope?: string | null | undefined;
753
753
  retrievalReason?: string | null | undefined;
754
754
  safety?: "safe" | "requires-review" | "blocked" | null | undefined;
@@ -758,11 +758,11 @@ declare const actionConfidenceRequestSchema: z.ZodObject<{
758
758
  safetyReasons?: string[] | null | undefined;
759
759
  userContextScopes?: string[] | null | undefined;
760
760
  }>, "many">>>, {
761
+ confidence?: number | undefined;
761
762
  source?: string | undefined;
762
763
  stale?: boolean | undefined;
763
764
  created?: string | undefined;
764
765
  updated?: string | undefined;
765
- confidence?: number | undefined;
766
766
  scope?: string | undefined;
767
767
  retrievalReason?: string | undefined;
768
768
  safety?: NonNullable<"safe" | "requires-review" | "blocked"> | undefined;
@@ -772,11 +772,11 @@ declare const actionConfidenceRequestSchema: z.ZodObject<{
772
772
  safetyReasons?: string[] | undefined;
773
773
  userContextScopes?: string[] | undefined;
774
774
  }[] | undefined, {
775
+ confidence?: number | null | undefined;
775
776
  source?: string | null | undefined;
776
777
  stale?: boolean | null | undefined;
777
778
  created?: string | null | undefined;
778
779
  updated?: string | null | undefined;
779
- confidence?: number | null | undefined;
780
780
  scope?: string | null | undefined;
781
781
  retrievalReason?: string | null | undefined;
782
782
  safety?: "safe" | "requires-review" | "blocked" | null | undefined;
@@ -798,11 +798,11 @@ declare const actionConfidenceRequestSchema: z.ZodObject<{
798
798
  matched?: boolean | undefined;
799
799
  }[] | undefined;
800
800
  retrievedMemories?: {
801
+ confidence?: number | undefined;
801
802
  source?: string | undefined;
802
803
  stale?: boolean | undefined;
803
804
  created?: string | undefined;
804
805
  updated?: string | undefined;
805
- confidence?: number | undefined;
806
806
  scope?: string | undefined;
807
807
  retrievalReason?: string | undefined;
808
808
  safety?: NonNullable<"safe" | "requires-review" | "blocked"> | undefined;
@@ -824,11 +824,11 @@ declare const actionConfidenceRequestSchema: z.ZodObject<{
824
824
  matched?: boolean | null | undefined;
825
825
  }[] | null | undefined;
826
826
  retrievedMemories?: {
827
+ confidence?: number | null | undefined;
827
828
  source?: string | null | undefined;
828
829
  stale?: boolean | null | undefined;
829
830
  created?: string | null | undefined;
830
831
  updated?: string | null | undefined;
831
- confidence?: number | null | undefined;
832
832
  scope?: string | null | undefined;
833
833
  retrievalReason?: string | null | undefined;
834
834
  safety?: "safe" | "requires-review" | "blocked" | null | undefined;
package/dist/index.d.ts CHANGED
@@ -924,6 +924,8 @@ interface BinaryAssetRecord {
924
924
  originalPath: string;
925
925
  /** Path (or URL) in the backend storage. */
926
926
  mirroredPath: string;
927
+ /** Optional user-resolvable target to write into markdown links. */
928
+ redirectPath?: string;
927
929
  /** SHA-256 hex digest of file content. */
928
930
  contentHash: string;
929
931
  /** File size in bytes. */
@@ -976,15 +978,23 @@ interface BinaryStorageBackend {
976
978
  exists(remotePath: string): Promise<boolean>;
977
979
  /** Delete a file from the backend. */
978
980
  delete(remotePath: string): Promise<void>;
981
+ /** Return the user-resolvable markdown target for a stored backend path. */
982
+ getRedirectTarget?(remotePath: string): string;
979
983
  }
980
984
  declare class FilesystemBackend implements BinaryStorageBackend {
981
985
  readonly type = "filesystem";
982
986
  private readonly basePath;
983
987
  constructor(basePath: string);
984
988
  private resolveRemotePath;
989
+ private isInsideBase;
990
+ private realBasePathIfExists;
991
+ private ensureBaseDirectory;
992
+ private ensureSafeParentDirectory;
993
+ private resolveExistingRemotePath;
985
994
  upload(localPath: string, remotePath: string): Promise<string>;
986
995
  exists(remotePath: string): Promise<boolean>;
987
996
  delete(remotePath: string): Promise<void>;
997
+ getRedirectTarget(remotePath: string): string;
988
998
  }
989
999
  declare class NoneBackend implements BinaryStorageBackend {
990
1000
  readonly type = "none";
@@ -1026,7 +1036,8 @@ declare function manifestDir(memoryDir: string): string;
1026
1036
  declare function manifestPath(memoryDir: string): string;
1027
1037
  /**
1028
1038
  * Read the manifest from disk. Returns a fresh empty manifest if the file
1029
- * does not exist or contains invalid JSON (CLAUDE.md #18).
1039
+ * does not exist. Existing invalid manifests fail closed so the pipeline does
1040
+ * not overwrite state needed for safe cleanup.
1030
1041
  */
1031
1042
  declare function readManifest(memoryDir: string): Promise<BinaryLifecycleManifest>;
1032
1043
  /**
@@ -1051,10 +1062,16 @@ interface PipelineLogger {
1051
1062
  warn(msg: string): void;
1052
1063
  error(msg: string): void;
1053
1064
  }
1065
+ type ReadMarkdownFile = (filePath: string) => Promise<string>;
1066
+ type WriteMarkdownFile = (filePath: string, content: string) => Promise<void>;
1054
1067
  interface PipelineOptions {
1055
1068
  dryRun?: boolean;
1056
1069
  /** Force-clean all files past grace period, ignoring redirect status. */
1057
1070
  forceClean?: boolean;
1071
+ /** Test hook for deterministic markdown read failures. */
1072
+ readMarkdownFile?: ReadMarkdownFile;
1073
+ /** Test hook for deterministic markdown write failures. */
1074
+ writeMarkdownFile?: WriteMarkdownFile;
1058
1075
  }
1059
1076
  /**
1060
1077
  * Run the binary lifecycle pipeline: scan, mirror, redirect, clean.