@remnic/core 9.3.672 → 9.3.673
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/access-audit.js +2 -2
- package/dist/access-cli.js +25 -23
- package/dist/access-cli.js.map +1 -1
- package/dist/access-http.js +12 -12
- package/dist/access-mcp.js +11 -11
- package/dist/access-schema.d.ts +36 -36
- package/dist/access-schema.js +3 -3
- package/dist/access-service.js +9 -9
- package/dist/active-recall.js +3 -1
- package/dist/active-recall.js.map +1 -1
- package/dist/chunk-3BQOQYRB.js +33 -0
- package/dist/chunk-3BQOQYRB.js.map +1 -0
- package/dist/{chunk-KJOYHNS7.js → chunk-7OGJQP7T.js} +4 -4
- package/dist/{chunk-EJYFPRED.js → chunk-B55KFEGS.js} +2 -2
- package/dist/{chunk-BTLNC5YM.js → chunk-GNAMDNGT.js} +5 -13
- package/dist/chunk-GNAMDNGT.js.map +1 -0
- package/dist/{chunk-KQAFEZQX.js → chunk-IPLYGWQF.js} +5 -5
- package/dist/{chunk-MLVMBV2C.js → chunk-IUZWBCJX.js} +8 -40
- package/dist/chunk-IUZWBCJX.js.map +1 -0
- package/dist/{chunk-PYTATYUV.js → chunk-ODWI5XU2.js} +2 -2
- package/dist/{chunk-AYGT6VBC.js → chunk-OG7A6AZX.js} +4 -4
- package/dist/{chunk-4QZ7H6FN.js → chunk-Q6MIDQEL.js} +2 -2
- package/dist/{chunk-UDJLF3BO.js → chunk-QLRYXOAD.js} +2 -2
- package/dist/chunk-QO3AILZN.js +89 -0
- package/dist/chunk-QO3AILZN.js.map +1 -0
- package/dist/{chunk-M3WF2AB6.js → chunk-R37A3BEW.js} +25 -25
- package/dist/{chunk-FP4ISXI3.js → chunk-SDLJ2W7S.js} +6 -6
- package/dist/{chunk-CXKETYZ7.js → chunk-SF45RQDX.js} +3 -3
- package/dist/{chunk-ZUPFMHJA.js → chunk-T2AOOHDA.js} +2 -2
- package/dist/{chunk-7K5Q6COX.js → chunk-TVVEYCNW.js} +4 -4
- package/dist/{chunk-ZQJHKN7J.js → chunk-XVVEKF5I.js} +17 -17
- package/dist/{chunk-7O5CFNN4.js → chunk-ZLINDOBG.js} +4 -4
- package/dist/cli.js +23 -21
- package/dist/config.d.ts +1 -1
- package/dist/config.js +3 -1
- package/dist/connectors/index.d.ts +6 -2
- package/dist/connectors/index.js +6 -2
- package/dist/conversation-index/backend.js +2 -2
- package/dist/emit-legacy-tools.d.ts +61 -0
- package/dist/emit-legacy-tools.js +12 -0
- package/dist/emit-legacy-tools.js.map +1 -0
- package/dist/index.js +45 -43
- package/dist/index.js.map +1 -1
- package/dist/namespaces/migrate.js +5 -5
- package/dist/namespaces/search.js +4 -4
- package/dist/operator-toolkit.js +10 -8
- package/dist/orchestrator.js +14 -14
- package/dist/resume-bundles.js +4 -2
- package/dist/schemas.d.ts +42 -42
- package/dist/search/factory.js +3 -3
- package/dist/search/index.js +3 -3
- package/dist/shared-context/manager.d.ts +2 -2
- package/dist/transfer/autodetect.js +1 -1
- package/dist/transfer/backup.js +1 -1
- package/dist/transfer/capsule-export.js +2 -2
- package/package.json +2 -2
- package/src/config.test.ts +408 -6
- package/src/config.ts +12 -56
- package/src/connectors/index.ts +2 -15
- package/src/connectors/paths.ts +50 -0
- package/src/emit-legacy-tools.test.ts +297 -0
- package/src/emit-legacy-tools.ts +204 -0
- package/dist/chunk-BTLNC5YM.js.map +0 -1
- package/dist/chunk-MLVMBV2C.js.map +0 -1
- /package/dist/{chunk-KJOYHNS7.js.map → chunk-7OGJQP7T.js.map} +0 -0
- /package/dist/{chunk-EJYFPRED.js.map → chunk-B55KFEGS.js.map} +0 -0
- /package/dist/{chunk-KQAFEZQX.js.map → chunk-IPLYGWQF.js.map} +0 -0
- /package/dist/{chunk-PYTATYUV.js.map → chunk-ODWI5XU2.js.map} +0 -0
- /package/dist/{chunk-AYGT6VBC.js.map → chunk-OG7A6AZX.js.map} +0 -0
- /package/dist/{chunk-4QZ7H6FN.js.map → chunk-Q6MIDQEL.js.map} +0 -0
- /package/dist/{chunk-UDJLF3BO.js.map → chunk-QLRYXOAD.js.map} +0 -0
- /package/dist/{chunk-M3WF2AB6.js.map → chunk-R37A3BEW.js.map} +0 -0
- /package/dist/{chunk-FP4ISXI3.js.map → chunk-SDLJ2W7S.js.map} +0 -0
- /package/dist/{chunk-CXKETYZ7.js.map → chunk-SF45RQDX.js.map} +0 -0
- /package/dist/{chunk-ZUPFMHJA.js.map → chunk-T2AOOHDA.js.map} +0 -0
- /package/dist/{chunk-7K5Q6COX.js.map → chunk-TVVEYCNW.js.map} +0 -0
- /package/dist/{chunk-ZQJHKN7J.js.map → chunk-XVVEKF5I.js.map} +0 -0
- /package/dist/{chunk-7O5CFNN4.js.map → chunk-ZLINDOBG.js.map} +0 -0
package/dist/access-schema.d.ts
CHANGED
|
@@ -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?: "auto" | "no_recall" | "minimal" | "full" | "graph_mode" | 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?: "auto" | "no_recall" | "minimal" | "full" | "graph_mode" | 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
|
|
@@ -365,30 +365,30 @@ declare const memoryStoreRequestSchema: z.ZodObject<{
|
|
|
365
365
|
projectTag: z.ZodOptional<z.ZodString>;
|
|
366
366
|
}, "strip", z.ZodTypeAny, {
|
|
367
367
|
content: string;
|
|
368
|
+
namespace?: string | undefined;
|
|
369
|
+
category?: "fact" | "preference" | "correction" | "entity" | "decision" | "relationship" | "principle" | "commitment" | "moment" | "skill" | "rule" | "procedure" | "reasoning_trace" | undefined;
|
|
370
|
+
confidence?: number | undefined;
|
|
371
|
+
ttl?: string | undefined;
|
|
368
372
|
schemaVersion?: number | undefined;
|
|
369
373
|
sessionKey?: string | undefined;
|
|
370
374
|
tags?: string[] | undefined;
|
|
371
375
|
dryRun?: boolean | undefined;
|
|
372
|
-
namespace?: string | undefined;
|
|
373
|
-
category?: "fact" | "preference" | "correction" | "entity" | "decision" | "relationship" | "principle" | "commitment" | "moment" | "skill" | "rule" | "procedure" | "reasoning_trace" | undefined;
|
|
374
|
-
confidence?: number | undefined;
|
|
375
376
|
entityRef?: string | undefined;
|
|
376
|
-
ttl?: string | undefined;
|
|
377
377
|
sourceReason?: string | undefined;
|
|
378
378
|
cwd?: string | undefined;
|
|
379
379
|
idempotencyKey?: string | undefined;
|
|
380
380
|
projectTag?: string | undefined;
|
|
381
381
|
}, {
|
|
382
382
|
content: string;
|
|
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
|
+
ttl?: string | undefined;
|
|
383
387
|
schemaVersion?: number | undefined;
|
|
384
388
|
sessionKey?: string | undefined;
|
|
385
389
|
tags?: string[] | undefined;
|
|
386
390
|
dryRun?: boolean | undefined;
|
|
387
|
-
namespace?: string | undefined;
|
|
388
|
-
category?: "fact" | "preference" | "correction" | "entity" | "decision" | "relationship" | "principle" | "commitment" | "moment" | "skill" | "rule" | "procedure" | "reasoning_trace" | undefined;
|
|
389
|
-
confidence?: number | undefined;
|
|
390
391
|
entityRef?: string | undefined;
|
|
391
|
-
ttl?: string | undefined;
|
|
392
392
|
sourceReason?: string | undefined;
|
|
393
393
|
cwd?: string | undefined;
|
|
394
394
|
idempotencyKey?: string | undefined;
|
|
@@ -411,30 +411,30 @@ declare const suggestionSubmitRequestSchema: z.ZodObject<{
|
|
|
411
411
|
projectTag: z.ZodOptional<z.ZodString>;
|
|
412
412
|
}, "strip", z.ZodTypeAny, {
|
|
413
413
|
content: string;
|
|
414
|
+
namespace?: string | undefined;
|
|
415
|
+
category?: "fact" | "preference" | "correction" | "entity" | "decision" | "relationship" | "principle" | "commitment" | "moment" | "skill" | "rule" | "procedure" | "reasoning_trace" | undefined;
|
|
416
|
+
confidence?: number | undefined;
|
|
417
|
+
ttl?: string | undefined;
|
|
414
418
|
schemaVersion?: number | undefined;
|
|
415
419
|
sessionKey?: string | undefined;
|
|
416
420
|
tags?: string[] | undefined;
|
|
417
421
|
dryRun?: boolean | undefined;
|
|
418
|
-
namespace?: string | undefined;
|
|
419
|
-
category?: "fact" | "preference" | "correction" | "entity" | "decision" | "relationship" | "principle" | "commitment" | "moment" | "skill" | "rule" | "procedure" | "reasoning_trace" | undefined;
|
|
420
|
-
confidence?: number | undefined;
|
|
421
422
|
entityRef?: string | undefined;
|
|
422
|
-
ttl?: string | undefined;
|
|
423
423
|
sourceReason?: string | undefined;
|
|
424
424
|
cwd?: string | undefined;
|
|
425
425
|
idempotencyKey?: string | undefined;
|
|
426
426
|
projectTag?: string | undefined;
|
|
427
427
|
}, {
|
|
428
428
|
content: string;
|
|
429
|
+
namespace?: string | undefined;
|
|
430
|
+
category?: "fact" | "preference" | "correction" | "entity" | "decision" | "relationship" | "principle" | "commitment" | "moment" | "skill" | "rule" | "procedure" | "reasoning_trace" | undefined;
|
|
431
|
+
confidence?: number | undefined;
|
|
432
|
+
ttl?: string | undefined;
|
|
429
433
|
schemaVersion?: number | undefined;
|
|
430
434
|
sessionKey?: string | undefined;
|
|
431
435
|
tags?: string[] | undefined;
|
|
432
436
|
dryRun?: boolean | undefined;
|
|
433
|
-
namespace?: string | undefined;
|
|
434
|
-
category?: "fact" | "preference" | "correction" | "entity" | "decision" | "relationship" | "principle" | "commitment" | "moment" | "skill" | "rule" | "procedure" | "reasoning_trace" | undefined;
|
|
435
|
-
confidence?: number | undefined;
|
|
436
437
|
entityRef?: string | undefined;
|
|
437
|
-
ttl?: string | undefined;
|
|
438
438
|
sourceReason?: string | undefined;
|
|
439
439
|
cwd?: string | undefined;
|
|
440
440
|
idempotencyKey?: string | undefined;
|
|
@@ -468,18 +468,18 @@ declare const trustZonePromoteRequestSchema: z.ZodObject<{
|
|
|
468
468
|
recordId: string;
|
|
469
469
|
targetZone: "working" | "trusted";
|
|
470
470
|
promotionReason: string;
|
|
471
|
+
namespace?: string | undefined;
|
|
471
472
|
recordedAt?: string | undefined;
|
|
472
473
|
summary?: string | undefined;
|
|
473
474
|
dryRun?: boolean | undefined;
|
|
474
|
-
namespace?: string | undefined;
|
|
475
475
|
}, {
|
|
476
476
|
recordId: string;
|
|
477
477
|
targetZone: "working" | "trusted";
|
|
478
478
|
promotionReason: string;
|
|
479
|
+
namespace?: string | undefined;
|
|
479
480
|
recordedAt?: string | undefined;
|
|
480
481
|
summary?: string | undefined;
|
|
481
482
|
dryRun?: boolean | undefined;
|
|
482
|
-
namespace?: string | undefined;
|
|
483
483
|
}>;
|
|
484
484
|
declare const trustZoneDemoSeedRequestSchema: z.ZodObject<{
|
|
485
485
|
scenario: z.ZodOptional<z.ZodString>;
|
|
@@ -487,14 +487,14 @@ declare const trustZoneDemoSeedRequestSchema: z.ZodObject<{
|
|
|
487
487
|
dryRun: z.ZodOptional<z.ZodBoolean>;
|
|
488
488
|
namespace: z.ZodOptional<z.ZodString>;
|
|
489
489
|
}, "strip", z.ZodTypeAny, {
|
|
490
|
+
namespace?: string | undefined;
|
|
490
491
|
recordedAt?: string | undefined;
|
|
491
492
|
dryRun?: boolean | undefined;
|
|
492
|
-
namespace?: string | undefined;
|
|
493
493
|
scenario?: string | undefined;
|
|
494
494
|
}, {
|
|
495
|
+
namespace?: string | undefined;
|
|
495
496
|
recordedAt?: string | undefined;
|
|
496
497
|
dryRun?: boolean | undefined;
|
|
497
|
-
namespace?: string | undefined;
|
|
498
498
|
scenario?: string | undefined;
|
|
499
499
|
}>;
|
|
500
500
|
declare const lcmSearchRequestSchema: z.ZodObject<{
|
|
@@ -505,15 +505,15 @@ declare const lcmSearchRequestSchema: z.ZodObject<{
|
|
|
505
505
|
limit: z.ZodOptional<z.ZodNumber>;
|
|
506
506
|
}, "strip", z.ZodTypeAny, {
|
|
507
507
|
query: string;
|
|
508
|
-
sessionKey?: string | undefined;
|
|
509
508
|
namespace?: string | undefined;
|
|
510
509
|
limit?: number | undefined;
|
|
510
|
+
sessionKey?: string | undefined;
|
|
511
511
|
sessionPrefix?: string | undefined;
|
|
512
512
|
}, {
|
|
513
513
|
query: string;
|
|
514
|
-
sessionKey?: string | undefined;
|
|
515
514
|
namespace?: string | undefined;
|
|
516
515
|
limit?: number | undefined;
|
|
516
|
+
sessionKey?: string | undefined;
|
|
517
517
|
sessionPrefix?: string | undefined;
|
|
518
518
|
}>;
|
|
519
519
|
declare const lcmCompactionFlushRequestSchema: z.ZodObject<{
|
|
@@ -548,14 +548,14 @@ declare const daySummaryRequestSchema: z.ZodObject<{
|
|
|
548
548
|
namespace: z.ZodOptional<z.ZodString>;
|
|
549
549
|
timeZone: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
550
550
|
}, "strip", z.ZodTypeAny, {
|
|
551
|
+
namespace?: string | undefined;
|
|
551
552
|
sessionKey?: string | undefined;
|
|
552
553
|
timeZone?: string | undefined;
|
|
553
|
-
namespace?: string | undefined;
|
|
554
554
|
memories?: string | undefined;
|
|
555
555
|
}, {
|
|
556
|
+
namespace?: string | undefined;
|
|
556
557
|
sessionKey?: string | undefined;
|
|
557
558
|
timeZone?: string | undefined;
|
|
558
|
-
namespace?: string | undefined;
|
|
559
559
|
memories?: string | undefined;
|
|
560
560
|
}>;
|
|
561
561
|
declare const capsuleExportRequestSchema: z.ZodObject<{
|
|
@@ -603,11 +603,11 @@ declare const capsuleListRequestSchema: z.ZodObject<{
|
|
|
603
603
|
namespace: z.ZodOptional<z.ZodString>;
|
|
604
604
|
sessionKey: z.ZodOptional<z.ZodString>;
|
|
605
605
|
}, "strip", z.ZodTypeAny, {
|
|
606
|
-
sessionKey?: string | undefined;
|
|
607
606
|
namespace?: string | undefined;
|
|
608
|
-
}, {
|
|
609
607
|
sessionKey?: string | undefined;
|
|
608
|
+
}, {
|
|
610
609
|
namespace?: string | undefined;
|
|
610
|
+
sessionKey?: string | undefined;
|
|
611
611
|
}>;
|
|
612
612
|
declare const offlineSyncSnapshotRequestSchema: z.ZodObject<{
|
|
613
613
|
namespace: z.ZodOptional<z.ZodString>;
|
|
@@ -748,11 +748,11 @@ declare const actionConfidenceRequestSchema: z.ZodObject<{
|
|
|
748
748
|
safety: z.ZodEffects<z.ZodNullable<z.ZodOptional<z.ZodEnum<["safe", "requires-review", "blocked"]>>>, NonNullable<"blocked" | "safe" | "requires-review"> | undefined, "blocked" | "safe" | "requires-review" | null | undefined>;
|
|
749
749
|
safetyReasons: z.ZodEffects<z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>, string[] | undefined, string[] | null | undefined>;
|
|
750
750
|
}, "strict", z.ZodTypeAny, {
|
|
751
|
+
confidence?: number | undefined;
|
|
751
752
|
source?: string | undefined;
|
|
752
753
|
stale?: boolean | undefined;
|
|
753
754
|
created?: string | undefined;
|
|
754
755
|
updated?: string | undefined;
|
|
755
|
-
confidence?: number | undefined;
|
|
756
756
|
scope?: string | undefined;
|
|
757
757
|
retrievalReason?: string | undefined;
|
|
758
758
|
safety?: NonNullable<"blocked" | "safe" | "requires-review"> | undefined;
|
|
@@ -762,11 +762,11 @@ declare const actionConfidenceRequestSchema: z.ZodObject<{
|
|
|
762
762
|
safetyReasons?: string[] | undefined;
|
|
763
763
|
userContextScopes?: string[] | undefined;
|
|
764
764
|
}, {
|
|
765
|
+
confidence?: number | null | undefined;
|
|
765
766
|
source?: string | null | undefined;
|
|
766
767
|
stale?: boolean | null | undefined;
|
|
767
768
|
created?: string | null | undefined;
|
|
768
769
|
updated?: string | null | undefined;
|
|
769
|
-
confidence?: number | null | undefined;
|
|
770
770
|
scope?: string | null | undefined;
|
|
771
771
|
retrievalReason?: string | null | undefined;
|
|
772
772
|
safety?: "blocked" | "safe" | "requires-review" | null | undefined;
|
|
@@ -776,11 +776,11 @@ declare const actionConfidenceRequestSchema: z.ZodObject<{
|
|
|
776
776
|
safetyReasons?: string[] | null | undefined;
|
|
777
777
|
userContextScopes?: string[] | null | undefined;
|
|
778
778
|
}>, "many">>>, {
|
|
779
|
+
confidence?: number | undefined;
|
|
779
780
|
source?: string | undefined;
|
|
780
781
|
stale?: boolean | undefined;
|
|
781
782
|
created?: string | undefined;
|
|
782
783
|
updated?: string | undefined;
|
|
783
|
-
confidence?: number | undefined;
|
|
784
784
|
scope?: string | undefined;
|
|
785
785
|
retrievalReason?: string | undefined;
|
|
786
786
|
safety?: NonNullable<"blocked" | "safe" | "requires-review"> | undefined;
|
|
@@ -790,11 +790,11 @@ declare const actionConfidenceRequestSchema: z.ZodObject<{
|
|
|
790
790
|
safetyReasons?: string[] | undefined;
|
|
791
791
|
userContextScopes?: string[] | undefined;
|
|
792
792
|
}[] | undefined, {
|
|
793
|
+
confidence?: number | null | undefined;
|
|
793
794
|
source?: string | null | undefined;
|
|
794
795
|
stale?: boolean | null | undefined;
|
|
795
796
|
created?: string | null | undefined;
|
|
796
797
|
updated?: string | null | undefined;
|
|
797
|
-
confidence?: number | null | undefined;
|
|
798
798
|
scope?: string | null | undefined;
|
|
799
799
|
retrievalReason?: string | null | undefined;
|
|
800
800
|
safety?: "blocked" | "safe" | "requires-review" | null | undefined;
|
|
@@ -816,11 +816,11 @@ declare const actionConfidenceRequestSchema: z.ZodObject<{
|
|
|
816
816
|
matched?: boolean | undefined;
|
|
817
817
|
}[] | undefined;
|
|
818
818
|
retrievedMemories?: {
|
|
819
|
+
confidence?: number | undefined;
|
|
819
820
|
source?: string | undefined;
|
|
820
821
|
stale?: boolean | undefined;
|
|
821
822
|
created?: string | undefined;
|
|
822
823
|
updated?: string | undefined;
|
|
823
|
-
confidence?: number | undefined;
|
|
824
824
|
scope?: string | undefined;
|
|
825
825
|
retrievalReason?: string | undefined;
|
|
826
826
|
safety?: NonNullable<"blocked" | "safe" | "requires-review"> | undefined;
|
|
@@ -842,11 +842,11 @@ declare const actionConfidenceRequestSchema: z.ZodObject<{
|
|
|
842
842
|
matched?: boolean | null | undefined;
|
|
843
843
|
}[] | null | undefined;
|
|
844
844
|
retrievedMemories?: {
|
|
845
|
+
confidence?: number | null | undefined;
|
|
845
846
|
source?: string | null | undefined;
|
|
846
847
|
stale?: boolean | null | undefined;
|
|
847
848
|
created?: string | null | undefined;
|
|
848
849
|
updated?: string | null | undefined;
|
|
849
|
-
confidence?: number | null | undefined;
|
|
850
850
|
scope?: string | null | undefined;
|
|
851
851
|
retrievalReason?: string | null | undefined;
|
|
852
852
|
safety?: "blocked" | "safe" | "requires-review" | null | undefined;
|
package/dist/access-schema.js
CHANGED
|
@@ -25,11 +25,11 @@ import {
|
|
|
25
25
|
trustZoneDemoSeedRequestSchema,
|
|
26
26
|
trustZonePromoteRequestSchema,
|
|
27
27
|
validateRequest
|
|
28
|
-
} from "./chunk-
|
|
29
|
-
import "./chunk-
|
|
28
|
+
} from "./chunk-QLRYXOAD.js";
|
|
29
|
+
import "./chunk-IPLYGWQF.js";
|
|
30
|
+
import "./chunk-J4EB7DNW.js";
|
|
30
31
|
import "./chunk-WEHSQBFR.js";
|
|
31
32
|
import "./chunk-X7Y7WX73.js";
|
|
32
|
-
import "./chunk-J4EB7DNW.js";
|
|
33
33
|
import "./chunk-PWWWLD7D.js";
|
|
34
34
|
import "./chunk-UI3NYK34.js";
|
|
35
35
|
import "./chunk-GCGJW34D.js";
|
package/dist/access-service.js
CHANGED
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
EngramAccessInputError,
|
|
4
4
|
EngramAccessService,
|
|
5
5
|
shapeMemorySummary
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-ZLINDOBG.js";
|
|
7
7
|
import "./chunk-GDASG7NC.js";
|
|
8
8
|
import "./chunk-GDB4J2H3.js";
|
|
9
9
|
import "./chunk-ARV3AUOM.js";
|
|
@@ -17,8 +17,8 @@ import "./chunk-RS25QOKZ.js";
|
|
|
17
17
|
import "./chunk-JGSKJHF7.js";
|
|
18
18
|
import "./chunk-FF4KLI5W.js";
|
|
19
19
|
import "./chunk-6VP3YUCS.js";
|
|
20
|
-
import "./chunk-
|
|
21
|
-
import "./chunk-
|
|
20
|
+
import "./chunk-Q6MIDQEL.js";
|
|
21
|
+
import "./chunk-B55KFEGS.js";
|
|
22
22
|
import "./chunk-OUWAQVDJ.js";
|
|
23
23
|
import "./chunk-DOCTITOP.js";
|
|
24
24
|
import "./chunk-CYEPCZN5.js";
|
|
@@ -28,10 +28,10 @@ import "./chunk-AER6MT24.js";
|
|
|
28
28
|
import "./chunk-RN7MUWON.js";
|
|
29
29
|
import "./chunk-CINZGPSJ.js";
|
|
30
30
|
import "./chunk-ZFXCQPNO.js";
|
|
31
|
-
import "./chunk-
|
|
31
|
+
import "./chunk-7OGJQP7T.js";
|
|
32
|
+
import "./chunk-E6ZDCOHM.js";
|
|
32
33
|
import "./chunk-OIF36KGD.js";
|
|
33
34
|
import "./chunk-7DTASS5T.js";
|
|
34
|
-
import "./chunk-E6ZDCOHM.js";
|
|
35
35
|
import "./chunk-6RHNCKHG.js";
|
|
36
36
|
import "./chunk-YNQ6DFSV.js";
|
|
37
37
|
import "./chunk-EIR5VLIH.js";
|
|
@@ -81,14 +81,14 @@ import "./chunk-2ODBA7MQ.js";
|
|
|
81
81
|
import "./chunk-PVGDJXVK.js";
|
|
82
82
|
import "./chunk-A2IYSXDQ.js";
|
|
83
83
|
import "./chunk-LPSF4OQH.js";
|
|
84
|
-
import "./chunk-
|
|
85
|
-
import "./chunk-LBLXEFWK.js";
|
|
84
|
+
import "./chunk-TVVEYCNW.js";
|
|
86
85
|
import "./chunk-RFYAYKTD.js";
|
|
86
|
+
import "./chunk-LBLXEFWK.js";
|
|
87
87
|
import "./chunk-VFUEZZBS.js";
|
|
88
|
-
import "./chunk-
|
|
88
|
+
import "./chunk-IPLYGWQF.js";
|
|
89
|
+
import "./chunk-J4EB7DNW.js";
|
|
89
90
|
import "./chunk-WEHSQBFR.js";
|
|
90
91
|
import "./chunk-X7Y7WX73.js";
|
|
91
|
-
import "./chunk-J4EB7DNW.js";
|
|
92
92
|
import "./chunk-PWWWLD7D.js";
|
|
93
93
|
import "./chunk-UI3NYK34.js";
|
|
94
94
|
import "./chunk-GCGJW34D.js";
|
package/dist/active-recall.js
CHANGED
|
@@ -4,10 +4,12 @@ import {
|
|
|
4
4
|
} from "./chunk-6MKAMLQL.js";
|
|
5
5
|
import {
|
|
6
6
|
DEFAULT_REASONING_MODEL
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-IUZWBCJX.js";
|
|
8
8
|
import "./chunk-PHK3HARR.js";
|
|
9
9
|
import "./chunk-NDAH7BJ5.js";
|
|
10
10
|
import "./chunk-Z5LAYHGJ.js";
|
|
11
|
+
import "./chunk-QO3AILZN.js";
|
|
12
|
+
import "./chunk-3BQOQYRB.js";
|
|
11
13
|
import "./chunk-4DJQYKMN.js";
|
|
12
14
|
import "./chunk-EYIEWJNI.js";
|
|
13
15
|
import "./chunk-JUC24CTX.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/active-recall.ts"],"sourcesContent":["import { appendFile, mkdir } from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { DEFAULT_REASONING_MODEL } from \"./config.js\";\nimport { collapseWhitespace, truncateCodePointSafe } from \"./whitespace.js\";\nimport type {\n ActiveRecallChatType,\n ActiveRecallModelFallbackPolicy,\n ActiveRecallPromptStyle,\n ActiveRecallQueryMode,\n ActiveRecallThinking,\n} from \"./types.js\";\n\nexport interface ActiveRecallTurn {\n role: \"user\" | \"assistant\";\n content: string;\n}\n\nexport interface ActiveRecallInput {\n sessionKey: string;\n agentId: string;\n chatType: ActiveRecallChatType;\n recentTurns: ActiveRecallTurn[];\n currentMessage: string;\n}\n\nexport interface ActiveRecallConfig {\n enabled: boolean;\n agents: string[] | null;\n allowedChatTypes: ActiveRecallChatType[];\n queryMode: ActiveRecallQueryMode;\n promptStyle: ActiveRecallPromptStyle;\n customInstruction: string | null;\n promptAppend: string | null;\n maxSummaryChars: number;\n recentUserTurns: number;\n recentAssistantTurns: number;\n recentUserChars: number;\n recentAssistantChars: number;\n thinking: ActiveRecallThinking;\n timeoutMs: number;\n cacheTtlMs: number;\n persistTranscripts: boolean;\n transcriptDir: string;\n entityGraphDepth: number;\n includeCausalTrajectories: boolean;\n includeDaySummary: boolean;\n attachRecallExplain: boolean;\n modelOverride: string | null;\n modelFallbackPolicy: ActiveRecallModelFallbackPolicy;\n}\n\nexport interface ActiveRecallResult {\n summary: string | null;\n citations: Array<{ memoryId: string; relevance: number }>;\n latencyMs: number;\n cacheHit: boolean;\n modelUsed: string;\n transcriptPath: string | null;\n}\n\nexport interface ActiveRecallDependencies {\n recall(query: string, sessionKey: string): Promise<string | null>;\n getLastRecallSnapshot?(sessionKey: string): { memoryIds?: string[] } | null;\n walkEntityGraph?(params: {\n sessionKey: string;\n query: string;\n depth: number;\n }): Promise<string[]>;\n loadCausalTrajectories?(params: {\n sessionKey: string;\n query: string;\n }): Promise<string[]>;\n loadDaySummary?(sessionKey: string): Promise<string | null>;\n explainLastRecall?(sessionKey: string): Promise<string | null>;\n generateSummary?(params: {\n prompt: string;\n sessionKey: string;\n agentId: string;\n model: string;\n timeoutMs: number;\n thinking: ActiveRecallThinking;\n fallbackPolicy: ActiveRecallModelFallbackPolicy;\n }): Promise<{ text: string | null; modelUsed?: string; cacheHit?: boolean }>;\n now?: () => number;\n}\n\ninterface CachedRecallResult {\n expiresAt: number;\n value: ActiveRecallResult;\n}\n\ninterface ActiveRecallTurnWithIndex {\n index: number;\n role: ActiveRecallTurn[\"role\"];\n content: string;\n}\n\nconst ACTIVE_RECALL_CACHE_MAX_ENTRIES = 256;\n\nconst NONE_SET = new Set([\n \"\",\n \"none\",\n \"no_reply\",\n \"nothing useful\",\n \"no relevant memory\",\n \"timeout\",\n \"[]\",\n \"{}\",\n \"null\",\n \"n/a\",\n]);\n\nconst STYLE_INSTRUCTIONS: Record<ActiveRecallPromptStyle, string> = {\n balanced: \"Summarize the most relevant memory context in a compact, neutral way.\",\n strict: \"Only include memory that is directly supported by the retrieved context.\",\n contextual: \"Prefer concise context that helps the next reply stay grounded in recent work.\",\n \"recall-heavy\": \"Bias toward richer recall coverage when multiple retrieved items reinforce each other.\",\n \"precision-heavy\": \"Bias toward precision. Omit anything uncertain or weakly supported.\",\n \"preference-only\": \"Only surface user preference or operating-style memory when present.\",\n};\n\nfunction cloneRecallResult(value: ActiveRecallResult): ActiveRecallResult {\n return {\n ...value,\n citations: [...value.citations],\n };\n}\n\nfunction buildCacheKey(input: ActiveRecallInput, config: ActiveRecallConfig, queryBundle: string): string {\n return JSON.stringify({\n sessionKey: input.sessionKey,\n agentId: input.agentId,\n queryMode: config.queryMode,\n promptStyle: config.promptStyle,\n customInstruction: config.customInstruction,\n promptAppend: config.promptAppend,\n maxSummaryChars: config.maxSummaryChars,\n entityGraphDepth: config.entityGraphDepth,\n includeCausalTrajectories: config.includeCausalTrajectories,\n includeDaySummary: config.includeDaySummary,\n attachRecallExplain: config.attachRecallExplain,\n modelOverride: config.modelOverride,\n modelFallbackPolicy: config.modelFallbackPolicy,\n thinking: config.thinking,\n queryBundle,\n });\n}\n\nfunction pruneExpiredCache(\n cache: Map<string, CachedRecallResult>,\n currentTime: number,\n): void {\n for (const [key, entry] of cache.entries()) {\n if (entry.expiresAt <= currentTime) {\n cache.delete(key);\n }\n }\n}\n\nfunction enforceCacheLimit(cache: Map<string, CachedRecallResult>): void {\n while (cache.size > ACTIVE_RECALL_CACHE_MAX_ENTRIES) {\n const oldestKey = cache.keys().next().value;\n if (typeof oldestKey !== \"string\") {\n break;\n }\n cache.delete(oldestKey);\n }\n}\n\nfunction cropTurns(\n turns: ActiveRecallTurn[],\n role: \"user\" | \"assistant\",\n maxTurns: number,\n maxChars: number,\n): ActiveRecallTurnWithIndex[] {\n if (maxTurns <= 0) {\n return [];\n }\n\n const selected: ActiveRecallTurnWithIndex[] = [];\n for (let index = turns.length - 1; index >= 0 && selected.length < maxTurns; index -= 1) {\n const turn = turns[index];\n if (turn?.role === role) {\n selected.push({\n index,\n role: turn.role,\n content: collapseWhitespace(truncateCodePointSafe(turn.content, maxChars)),\n });\n }\n }\n\n return selected.reverse();\n}\n\nfunction mergeChronologicalTurns(\n userTurns: ActiveRecallTurnWithIndex[],\n assistantTurns: ActiveRecallTurnWithIndex[],\n): ActiveRecallTurnWithIndex[] {\n return [...userTurns, ...assistantTurns]\n .sort((left, right) => left.index - right.index)\n .filter((value) => value.content.length > 0);\n}\n\nexport function buildActiveRecallQueryBundle(\n input: ActiveRecallInput,\n config: ActiveRecallConfig,\n): string {\n if (config.queryMode === \"message\") {\n return collapseWhitespace(input.currentMessage);\n }\n\n const userTurns = cropTurns(\n input.recentTurns,\n \"user\",\n config.recentUserTurns,\n config.recentUserChars,\n );\n const assistantTurns = cropTurns(\n input.recentTurns,\n \"assistant\",\n config.recentAssistantTurns,\n config.recentAssistantChars,\n );\n const mergedTurns = mergeChronologicalTurns(userTurns, assistantTurns);\n\n const parts = [\n ...mergedTurns.map((turn) => `${turn.role}: ${turn.content}`),\n ];\n\n if (config.queryMode === \"full\") {\n return [...parts, `current: ${collapseWhitespace(input.currentMessage)}`]\n .filter((value) => value.trim().length > 0)\n .join(\"\\n\");\n }\n\n return [`current: ${collapseWhitespace(input.currentMessage)}`, ...parts]\n .filter((value) => value.trim().length > 0)\n .join(\"\\n\");\n}\n\nexport function normalizeActiveRecallSummary(value: string | null, maxChars: number): string | null {\n if (value == null) return null;\n const compact = collapseWhitespace(value);\n if (NONE_SET.has(compact.toLowerCase())) return null;\n return truncateCodePointSafe(compact, maxChars);\n}\n\nfunction sanitizeTranscriptPathSegment(value: string): string {\n const normalized = collapseWhitespace(value);\n return encodeURIComponent(normalized.length > 0 ? normalized : \"unknown\").replaceAll(\n \".\",\n \"%2E\",\n );\n}\n\nexport function buildActiveRecallPrompt(params: {\n config: ActiveRecallConfig;\n queryBundle: string;\n recallContext: string | null;\n graphContext: string[];\n causalContext: string[];\n daySummary: string | null;\n recallExplain: string | null;\n}): string {\n const sections = [\n params.config.customInstruction?.trim() || STYLE_INSTRUCTIONS[params.config.promptStyle],\n `Query bundle:\\n${params.queryBundle}`,\n params.recallContext ? `Retrieved memory:\\n${params.recallContext}` : null,\n params.graphContext.length > 0 ? `Entity graph:\\n${params.graphContext.join(\"\\n\")}` : null,\n params.causalContext.length > 0 ? `Causal trajectories:\\n${params.causalContext.join(\"\\n\")}` : null,\n params.daySummary ? `Day summary:\\n${params.daySummary}` : null,\n params.recallExplain ? `Recall explain:\\n${params.recallExplain}` : null,\n params.config.promptAppend?.trim() || null,\n \"Return either NONE or a compact summary grounded only in the supplied context.\",\n ];\n return sections.filter((value): value is string => !!value && value.trim().length > 0).join(\"\\n\\n\");\n}\n\nasync function appendActiveRecallTranscript(\n transcriptRoot: string,\n input: ActiveRecallInput,\n config: ActiveRecallConfig,\n result: ActiveRecallResult,\n queryBundle: string,\n): Promise<string> {\n const date = new Date().toISOString().slice(0, 10);\n const filePath = path.join(\n transcriptRoot,\n \"agents\",\n sanitizeTranscriptPathSegment(input.agentId),\n date,\n `${sanitizeTranscriptPathSegment(input.sessionKey)}.jsonl`,\n );\n await mkdir(path.dirname(filePath), { recursive: true });\n await appendFile(\n filePath,\n `${JSON.stringify({\n ts: new Date().toISOString(),\n sessionKey: input.sessionKey,\n agentId: input.agentId,\n queryMode: config.queryMode,\n promptStyle: config.promptStyle,\n queryBundle,\n summary: result.summary,\n citations: result.citations,\n latencyMs: result.latencyMs,\n cacheHit: result.cacheHit,\n modelUsed: result.modelUsed,\n })}\\n`,\n \"utf8\",\n );\n return filePath;\n}\n\nexport function createActiveRecallEngine(\n deps: ActiveRecallDependencies,\n config: ActiveRecallConfig,\n) {\n const cache = new Map<string, CachedRecallResult>();\n const now = deps.now ?? (() => Date.now());\n\n return {\n async run(input: ActiveRecallInput): Promise<ActiveRecallResult> {\n if (!config.enabled) {\n return {\n summary: null,\n citations: [],\n latencyMs: 0,\n cacheHit: false,\n modelUsed: config.modelOverride ?? \"disabled\",\n transcriptPath: null,\n };\n }\n if (config.agents && !config.agents.includes(input.agentId)) {\n return {\n summary: null,\n citations: [],\n latencyMs: 0,\n cacheHit: false,\n modelUsed: config.modelOverride ?? \"filtered\",\n transcriptPath: null,\n };\n }\n if (!config.allowedChatTypes.includes(input.chatType)) {\n return {\n summary: null,\n citations: [],\n latencyMs: 0,\n cacheHit: false,\n modelUsed: config.modelOverride ?? \"filtered\",\n transcriptPath: null,\n };\n }\n\n const queryBundle = buildActiveRecallQueryBundle(input, config);\n const cacheKey = buildCacheKey(input, config, queryBundle);\n const currentTime = now();\n const cacheEnabled = config.cacheTtlMs > 0;\n if (cacheEnabled) {\n pruneExpiredCache(cache, currentTime);\n }\n const cached = cache.get(cacheKey);\n if (cacheEnabled && cached) {\n const result: ActiveRecallResult = {\n ...cloneRecallResult(cached.value),\n latencyMs: Math.max(0, now() - currentTime),\n cacheHit: true,\n };\n result.transcriptPath = null;\n if (config.persistTranscripts) {\n try {\n result.transcriptPath = await appendActiveRecallTranscript(\n config.transcriptDir,\n input,\n config,\n result,\n queryBundle,\n );\n } catch {\n result.transcriptPath = null;\n }\n }\n return result;\n }\n\n const start = currentTime;\n const recallContext = await deps.recall(queryBundle, input.sessionKey);\n const graphContext =\n config.entityGraphDepth > 0 && deps.walkEntityGraph\n ? await deps.walkEntityGraph({\n sessionKey: input.sessionKey,\n query: queryBundle,\n depth: config.entityGraphDepth,\n })\n : [];\n const causalContext =\n config.includeCausalTrajectories && deps.loadCausalTrajectories\n ? await deps.loadCausalTrajectories({\n sessionKey: input.sessionKey,\n query: queryBundle,\n })\n : [];\n const daySummary =\n config.includeDaySummary && deps.loadDaySummary\n ? await deps.loadDaySummary(input.sessionKey)\n : null;\n const recallExplain =\n config.attachRecallExplain && deps.explainLastRecall\n ? await deps.explainLastRecall(input.sessionKey)\n : null;\n const prompt = buildActiveRecallPrompt({\n config,\n queryBundle,\n recallContext,\n graphContext,\n causalContext,\n daySummary,\n recallExplain,\n });\n\n const generated = deps.generateSummary\n ? await deps.generateSummary({\n prompt,\n sessionKey: input.sessionKey,\n agentId: input.agentId,\n model: config.modelOverride ?? DEFAULT_REASONING_MODEL,\n timeoutMs: config.timeoutMs,\n thinking: config.thinking,\n fallbackPolicy: config.modelFallbackPolicy,\n })\n : {\n text: recallContext,\n modelUsed: config.modelOverride ?? DEFAULT_REASONING_MODEL,\n cacheHit: false,\n };\n const summary = normalizeActiveRecallSummary(\n generated.text,\n config.maxSummaryChars,\n );\n const snapshot = deps.getLastRecallSnapshot?.(input.sessionKey);\n const citations = (snapshot?.memoryIds ?? []).map((memoryId, index) => ({\n memoryId,\n relevance: Number((1 / (index + 1)).toFixed(3)),\n }));\n const result: ActiveRecallResult = {\n summary,\n citations,\n latencyMs: Math.max(0, now() - start),\n cacheHit: generated.cacheHit === true,\n modelUsed: generated.modelUsed ?? config.modelOverride ?? DEFAULT_REASONING_MODEL,\n transcriptPath: null,\n };\n if (config.persistTranscripts) {\n try {\n result.transcriptPath = await appendActiveRecallTranscript(\n config.transcriptDir,\n input,\n config,\n result,\n queryBundle,\n );\n } catch {\n result.transcriptPath = null;\n }\n }\n\n if (cacheEnabled) {\n const completedAt = now();\n const cachedValue = cloneRecallResult(result);\n cachedValue.transcriptPath = null;\n cache.set(cacheKey, {\n expiresAt: completedAt + config.cacheTtlMs,\n value: cachedValue,\n });\n enforceCacheLimit(cache);\n }\n return result;\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA,SAAS,YAAY,aAAa;AAClC,OAAO,UAAU;AAgGjB,IAAM,kCAAkC;AAExC,IAAM,WAAW,oBAAI,IAAI;AAAA,EACvB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAED,IAAM,qBAA8D;AAAA,EAClE,UAAU;AAAA,EACV,QAAQ;AAAA,EACR,YAAY;AAAA,EACZ,gBAAgB;AAAA,EAChB,mBAAmB;AAAA,EACnB,mBAAmB;AACrB;AAEA,SAAS,kBAAkB,OAA+C;AACxE,SAAO;AAAA,IACL,GAAG;AAAA,IACH,WAAW,CAAC,GAAG,MAAM,SAAS;AAAA,EAChC;AACF;AAEA,SAAS,cAAc,OAA0B,QAA4B,aAA6B;AACxG,SAAO,KAAK,UAAU;AAAA,IACpB,YAAY,MAAM;AAAA,IAClB,SAAS,MAAM;AAAA,IACf,WAAW,OAAO;AAAA,IAClB,aAAa,OAAO;AAAA,IACpB,mBAAmB,OAAO;AAAA,IAC1B,cAAc,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AAAA,QACnC,UAAU;AAAA,MACZ;AACJ,YAAM,UAAU;AAAA,QACd,UAAU;AAAA,QACV,OAAO;AAAA,MACT;AACA,YAAM,WAAW,KAAK,wBAAwB,MAAM,UAAU;AAC9D,YAAM,aAAa,UAAU,aAAa,CAAC,GAAG,IAAI,CAAC,UAAU,WAAW;AAAA,QACtE;AAAA,QACA,WAAW,QAAQ,KAAK,QAAQ,IAAI,QAAQ,CAAC,CAAC;AAAA,MAChD,EAAE;AACF,YAAM,SAA6B;AAAA,QACjC;AAAA,QACA;AAAA,QACA,WAAW,KAAK,IAAI,GAAG,IAAI,IAAI,KAAK;AAAA,QACpC,UAAU,UAAU,aAAa;AAAA,QACjC,WAAW,UAAU,aAAa,OAAO,iBAAiB;AAAA,QAC1D,gBAAgB;AAAA,MAClB;AACA,UAAI,OAAO,oBAAoB;AAC7B,YAAI;AACF,iBAAO,iBAAiB,MAAM;AAAA,YAC5B,OAAO;AAAA,YACP;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,UACF;AAAA,QACF,QAAQ;AACN,iBAAO,iBAAiB;AAAA,QAC1B;AAAA,MACF;AAEA,UAAI,cAAc;AAChB,cAAM,cAAc,IAAI;AACxB,cAAM,cAAc,kBAAkB,MAAM;AAC5C,oBAAY,iBAAiB;AAC7B,cAAM,IAAI,UAAU;AAAA,UAClB,WAAW,cAAc,OAAO;AAAA,UAChC,OAAO;AAAA,QACT,CAAC;AACD,0BAAkB,KAAK;AAAA,MACzB;AACA,aAAO;AAAA,IACT;AAAA,EACF;AACF;","names":["result"]}
|
|
1
|
+
{"version":3,"sources":["../src/active-recall.ts"],"sourcesContent":["import { appendFile, mkdir } from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { DEFAULT_REASONING_MODEL } from \"./config.js\";\nimport { collapseWhitespace, truncateCodePointSafe } from \"./whitespace.js\";\nimport type {\n ActiveRecallChatType,\n ActiveRecallModelFallbackPolicy,\n ActiveRecallPromptStyle,\n ActiveRecallQueryMode,\n ActiveRecallThinking,\n} from \"./types.js\";\n\nexport interface ActiveRecallTurn {\n role: \"user\" | \"assistant\";\n content: string;\n}\n\nexport interface ActiveRecallInput {\n sessionKey: string;\n agentId: string;\n chatType: ActiveRecallChatType;\n recentTurns: ActiveRecallTurn[];\n currentMessage: string;\n}\n\nexport interface ActiveRecallConfig {\n enabled: boolean;\n agents: string[] | null;\n allowedChatTypes: ActiveRecallChatType[];\n queryMode: ActiveRecallQueryMode;\n promptStyle: ActiveRecallPromptStyle;\n customInstruction: string | null;\n promptAppend: string | null;\n maxSummaryChars: number;\n recentUserTurns: number;\n recentAssistantTurns: number;\n recentUserChars: number;\n recentAssistantChars: number;\n thinking: ActiveRecallThinking;\n timeoutMs: number;\n cacheTtlMs: number;\n persistTranscripts: boolean;\n transcriptDir: string;\n entityGraphDepth: number;\n includeCausalTrajectories: boolean;\n includeDaySummary: boolean;\n attachRecallExplain: boolean;\n modelOverride: string | null;\n modelFallbackPolicy: ActiveRecallModelFallbackPolicy;\n}\n\nexport interface ActiveRecallResult {\n summary: string | null;\n citations: Array<{ memoryId: string; relevance: number }>;\n latencyMs: number;\n cacheHit: boolean;\n modelUsed: string;\n transcriptPath: string | null;\n}\n\nexport interface ActiveRecallDependencies {\n recall(query: string, sessionKey: string): Promise<string | null>;\n getLastRecallSnapshot?(sessionKey: string): { memoryIds?: string[] } | null;\n walkEntityGraph?(params: {\n sessionKey: string;\n query: string;\n depth: number;\n }): Promise<string[]>;\n loadCausalTrajectories?(params: {\n sessionKey: string;\n query: string;\n }): Promise<string[]>;\n loadDaySummary?(sessionKey: string): Promise<string | null>;\n explainLastRecall?(sessionKey: string): Promise<string | null>;\n generateSummary?(params: {\n prompt: string;\n sessionKey: string;\n agentId: string;\n model: string;\n timeoutMs: number;\n thinking: ActiveRecallThinking;\n fallbackPolicy: ActiveRecallModelFallbackPolicy;\n }): Promise<{ text: string | null; modelUsed?: string; cacheHit?: boolean }>;\n now?: () => number;\n}\n\ninterface CachedRecallResult {\n expiresAt: number;\n value: ActiveRecallResult;\n}\n\ninterface ActiveRecallTurnWithIndex {\n index: number;\n role: ActiveRecallTurn[\"role\"];\n content: string;\n}\n\nconst ACTIVE_RECALL_CACHE_MAX_ENTRIES = 256;\n\nconst NONE_SET = new Set([\n \"\",\n \"none\",\n \"no_reply\",\n \"nothing useful\",\n \"no relevant memory\",\n \"timeout\",\n \"[]\",\n \"{}\",\n \"null\",\n \"n/a\",\n]);\n\nconst STYLE_INSTRUCTIONS: Record<ActiveRecallPromptStyle, string> = {\n balanced: \"Summarize the most relevant memory context in a compact, neutral way.\",\n strict: \"Only include memory that is directly supported by the retrieved context.\",\n contextual: \"Prefer concise context that helps the next reply stay grounded in recent work.\",\n \"recall-heavy\": \"Bias toward richer recall coverage when multiple retrieved items reinforce each other.\",\n \"precision-heavy\": \"Bias toward precision. Omit anything uncertain or weakly supported.\",\n \"preference-only\": \"Only surface user preference or operating-style memory when present.\",\n};\n\nfunction cloneRecallResult(value: ActiveRecallResult): ActiveRecallResult {\n return {\n ...value,\n citations: [...value.citations],\n };\n}\n\nfunction buildCacheKey(input: ActiveRecallInput, config: ActiveRecallConfig, queryBundle: string): string {\n return JSON.stringify({\n sessionKey: input.sessionKey,\n agentId: input.agentId,\n queryMode: config.queryMode,\n promptStyle: config.promptStyle,\n customInstruction: config.customInstruction,\n promptAppend: config.promptAppend,\n maxSummaryChars: config.maxSummaryChars,\n entityGraphDepth: config.entityGraphDepth,\n includeCausalTrajectories: config.includeCausalTrajectories,\n includeDaySummary: config.includeDaySummary,\n attachRecallExplain: config.attachRecallExplain,\n modelOverride: config.modelOverride,\n modelFallbackPolicy: config.modelFallbackPolicy,\n thinking: config.thinking,\n queryBundle,\n });\n}\n\nfunction pruneExpiredCache(\n cache: Map<string, CachedRecallResult>,\n currentTime: number,\n): void {\n for (const [key, entry] of cache.entries()) {\n if (entry.expiresAt <= currentTime) {\n cache.delete(key);\n }\n }\n}\n\nfunction enforceCacheLimit(cache: Map<string, CachedRecallResult>): void {\n while (cache.size > ACTIVE_RECALL_CACHE_MAX_ENTRIES) {\n const oldestKey = cache.keys().next().value;\n if (typeof oldestKey !== \"string\") {\n break;\n }\n cache.delete(oldestKey);\n }\n}\n\nfunction cropTurns(\n turns: ActiveRecallTurn[],\n role: \"user\" | \"assistant\",\n maxTurns: number,\n maxChars: number,\n): ActiveRecallTurnWithIndex[] {\n if (maxTurns <= 0) {\n return [];\n }\n\n const selected: ActiveRecallTurnWithIndex[] = [];\n for (let index = turns.length - 1; index >= 0 && selected.length < maxTurns; index -= 1) {\n const turn = turns[index];\n if (turn?.role === role) {\n selected.push({\n index,\n role: turn.role,\n content: collapseWhitespace(truncateCodePointSafe(turn.content, maxChars)),\n });\n }\n }\n\n return selected.reverse();\n}\n\nfunction mergeChronologicalTurns(\n userTurns: ActiveRecallTurnWithIndex[],\n assistantTurns: ActiveRecallTurnWithIndex[],\n): ActiveRecallTurnWithIndex[] {\n return [...userTurns, ...assistantTurns]\n .sort((left, right) => left.index - right.index)\n .filter((value) => value.content.length > 0);\n}\n\nexport function buildActiveRecallQueryBundle(\n input: ActiveRecallInput,\n config: ActiveRecallConfig,\n): string {\n if (config.queryMode === \"message\") {\n return collapseWhitespace(input.currentMessage);\n }\n\n const userTurns = cropTurns(\n input.recentTurns,\n \"user\",\n config.recentUserTurns,\n config.recentUserChars,\n );\n const assistantTurns = cropTurns(\n input.recentTurns,\n \"assistant\",\n config.recentAssistantTurns,\n config.recentAssistantChars,\n );\n const mergedTurns = mergeChronologicalTurns(userTurns, assistantTurns);\n\n const parts = [\n ...mergedTurns.map((turn) => `${turn.role}: ${turn.content}`),\n ];\n\n if (config.queryMode === \"full\") {\n return [...parts, `current: ${collapseWhitespace(input.currentMessage)}`]\n .filter((value) => value.trim().length > 0)\n .join(\"\\n\");\n }\n\n return [`current: ${collapseWhitespace(input.currentMessage)}`, ...parts]\n .filter((value) => value.trim().length > 0)\n .join(\"\\n\");\n}\n\nexport function normalizeActiveRecallSummary(value: string | null, maxChars: number): string | null {\n if (value == null) return null;\n const compact = collapseWhitespace(value);\n if (NONE_SET.has(compact.toLowerCase())) return null;\n return truncateCodePointSafe(compact, maxChars);\n}\n\nfunction sanitizeTranscriptPathSegment(value: string): string {\n const normalized = collapseWhitespace(value);\n return encodeURIComponent(normalized.length > 0 ? normalized : \"unknown\").replaceAll(\n \".\",\n \"%2E\",\n );\n}\n\nexport function buildActiveRecallPrompt(params: {\n config: ActiveRecallConfig;\n queryBundle: string;\n recallContext: string | null;\n graphContext: string[];\n causalContext: string[];\n daySummary: string | null;\n recallExplain: string | null;\n}): string {\n const sections = [\n params.config.customInstruction?.trim() || STYLE_INSTRUCTIONS[params.config.promptStyle],\n `Query bundle:\\n${params.queryBundle}`,\n params.recallContext ? `Retrieved memory:\\n${params.recallContext}` : null,\n params.graphContext.length > 0 ? `Entity graph:\\n${params.graphContext.join(\"\\n\")}` : null,\n params.causalContext.length > 0 ? `Causal trajectories:\\n${params.causalContext.join(\"\\n\")}` : null,\n params.daySummary ? `Day summary:\\n${params.daySummary}` : null,\n params.recallExplain ? `Recall explain:\\n${params.recallExplain}` : null,\n params.config.promptAppend?.trim() || null,\n \"Return either NONE or a compact summary grounded only in the supplied context.\",\n ];\n return sections.filter((value): value is string => !!value && value.trim().length > 0).join(\"\\n\\n\");\n}\n\nasync function appendActiveRecallTranscript(\n transcriptRoot: string,\n input: ActiveRecallInput,\n config: ActiveRecallConfig,\n result: ActiveRecallResult,\n queryBundle: string,\n): Promise<string> {\n const date = new Date().toISOString().slice(0, 10);\n const filePath = path.join(\n transcriptRoot,\n \"agents\",\n sanitizeTranscriptPathSegment(input.agentId),\n date,\n `${sanitizeTranscriptPathSegment(input.sessionKey)}.jsonl`,\n );\n await mkdir(path.dirname(filePath), { recursive: true });\n await appendFile(\n filePath,\n `${JSON.stringify({\n ts: new Date().toISOString(),\n sessionKey: input.sessionKey,\n agentId: input.agentId,\n queryMode: config.queryMode,\n promptStyle: config.promptStyle,\n queryBundle,\n summary: result.summary,\n citations: result.citations,\n latencyMs: result.latencyMs,\n cacheHit: result.cacheHit,\n modelUsed: result.modelUsed,\n })}\\n`,\n \"utf8\",\n );\n return filePath;\n}\n\nexport function createActiveRecallEngine(\n deps: ActiveRecallDependencies,\n config: ActiveRecallConfig,\n) {\n const cache = new Map<string, CachedRecallResult>();\n const now = deps.now ?? (() => Date.now());\n\n return {\n async run(input: ActiveRecallInput): Promise<ActiveRecallResult> {\n if (!config.enabled) {\n return {\n summary: null,\n citations: [],\n latencyMs: 0,\n cacheHit: false,\n modelUsed: config.modelOverride ?? \"disabled\",\n transcriptPath: null,\n };\n }\n if (config.agents && !config.agents.includes(input.agentId)) {\n return {\n summary: null,\n citations: [],\n latencyMs: 0,\n cacheHit: false,\n modelUsed: config.modelOverride ?? \"filtered\",\n transcriptPath: null,\n };\n }\n if (!config.allowedChatTypes.includes(input.chatType)) {\n return {\n summary: null,\n citations: [],\n latencyMs: 0,\n cacheHit: false,\n modelUsed: config.modelOverride ?? \"filtered\",\n transcriptPath: null,\n };\n }\n\n const queryBundle = buildActiveRecallQueryBundle(input, config);\n const cacheKey = buildCacheKey(input, config, queryBundle);\n const currentTime = now();\n const cacheEnabled = config.cacheTtlMs > 0;\n if (cacheEnabled) {\n pruneExpiredCache(cache, currentTime);\n }\n const cached = cache.get(cacheKey);\n if (cacheEnabled && cached) {\n const result: ActiveRecallResult = {\n ...cloneRecallResult(cached.value),\n latencyMs: Math.max(0, now() - currentTime),\n cacheHit: true,\n };\n result.transcriptPath = null;\n if (config.persistTranscripts) {\n try {\n result.transcriptPath = await appendActiveRecallTranscript(\n config.transcriptDir,\n input,\n config,\n result,\n queryBundle,\n );\n } catch {\n result.transcriptPath = null;\n }\n }\n return result;\n }\n\n const start = currentTime;\n const recallContext = await deps.recall(queryBundle, input.sessionKey);\n const graphContext =\n config.entityGraphDepth > 0 && deps.walkEntityGraph\n ? await deps.walkEntityGraph({\n sessionKey: input.sessionKey,\n query: queryBundle,\n depth: config.entityGraphDepth,\n })\n : [];\n const causalContext =\n config.includeCausalTrajectories && deps.loadCausalTrajectories\n ? await deps.loadCausalTrajectories({\n sessionKey: input.sessionKey,\n query: queryBundle,\n })\n : [];\n const daySummary =\n config.includeDaySummary && deps.loadDaySummary\n ? await deps.loadDaySummary(input.sessionKey)\n : null;\n const recallExplain =\n config.attachRecallExplain && deps.explainLastRecall\n ? await deps.explainLastRecall(input.sessionKey)\n : null;\n const prompt = buildActiveRecallPrompt({\n config,\n queryBundle,\n recallContext,\n graphContext,\n causalContext,\n daySummary,\n recallExplain,\n });\n\n const generated = deps.generateSummary\n ? await deps.generateSummary({\n prompt,\n sessionKey: input.sessionKey,\n agentId: input.agentId,\n model: config.modelOverride ?? DEFAULT_REASONING_MODEL,\n timeoutMs: config.timeoutMs,\n thinking: config.thinking,\n fallbackPolicy: config.modelFallbackPolicy,\n })\n : {\n text: recallContext,\n modelUsed: config.modelOverride ?? DEFAULT_REASONING_MODEL,\n cacheHit: false,\n };\n const summary = normalizeActiveRecallSummary(\n generated.text,\n config.maxSummaryChars,\n );\n const snapshot = deps.getLastRecallSnapshot?.(input.sessionKey);\n const citations = (snapshot?.memoryIds ?? []).map((memoryId, index) => ({\n memoryId,\n relevance: Number((1 / (index + 1)).toFixed(3)),\n }));\n const result: ActiveRecallResult = {\n summary,\n citations,\n latencyMs: Math.max(0, now() - start),\n cacheHit: generated.cacheHit === true,\n modelUsed: generated.modelUsed ?? config.modelOverride ?? DEFAULT_REASONING_MODEL,\n transcriptPath: null,\n };\n if (config.persistTranscripts) {\n try {\n result.transcriptPath = await appendActiveRecallTranscript(\n config.transcriptDir,\n input,\n config,\n result,\n queryBundle,\n );\n } catch {\n result.transcriptPath = null;\n }\n }\n\n if (cacheEnabled) {\n const completedAt = now();\n const cachedValue = cloneRecallResult(result);\n cachedValue.transcriptPath = null;\n cache.set(cacheKey, {\n expiresAt: completedAt + config.cacheTtlMs,\n value: cachedValue,\n });\n enforceCacheLimit(cache);\n }\n return result;\n },\n };\n}\n"],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B,YAAI;AACF,iBAAO,iBAAiB,MAAM;AAAA,YAC5B,OAAO;AAAA,YACP;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,UACF;AAAA,QACF,QAAQ;AACN,iBAAO,iBAAiB;AAAA,QAC1B;AAAA,MACF;AAEA,UAAI,cAAc;AAChB,cAAM,cAAc,IAAI;AACxB,cAAM,cAAc,kBAAkB,MAAM;AAC5C,oBAAY,iBAAiB;AAC7B,cAAM,IAAI,UAAU;AAAA,UAClB,WAAW,cAAc,OAAO;AAAA,UAChC,OAAO;AAAA,QACT,CAAC;AACD,0BAAkB,KAAK;AAAA,MACzB;AACA,aAAO;AAAA,IACT;AAAA,EACF;AACF;","names":["result"]}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import {
|
|
2
|
+
readEnvVar,
|
|
3
|
+
resolveHomeDir
|
|
4
|
+
} from "./chunk-JUC24CTX.js";
|
|
5
|
+
|
|
6
|
+
// src/connectors/paths.ts
|
|
7
|
+
import fs from "fs";
|
|
8
|
+
import path from "path";
|
|
9
|
+
var REGISTRY_DIR_NAME = ".engram-connectors";
|
|
10
|
+
function getConnectorsConfigRoot() {
|
|
11
|
+
const xdgConfigHome = readEnvVar("XDG_CONFIG_HOME");
|
|
12
|
+
return xdgConfigHome ? path.join(xdgConfigHome, "engram") : path.join(resolveHomeDir(), ".config", "engram");
|
|
13
|
+
}
|
|
14
|
+
function getRegistryPath() {
|
|
15
|
+
return path.join(getConnectorsConfigRoot(), REGISTRY_DIR_NAME, "registry.json");
|
|
16
|
+
}
|
|
17
|
+
function getConnectorsDir() {
|
|
18
|
+
return path.join(getConnectorsConfigRoot(), REGISTRY_DIR_NAME, "connectors");
|
|
19
|
+
}
|
|
20
|
+
function hasLegacyConnectorEntries() {
|
|
21
|
+
try {
|
|
22
|
+
return fs.readdirSync(getConnectorsDir()).some((name) => name.endsWith(".json"));
|
|
23
|
+
} catch {
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export {
|
|
29
|
+
getRegistryPath,
|
|
30
|
+
getConnectorsDir,
|
|
31
|
+
hasLegacyConnectorEntries
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=chunk-3BQOQYRB.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/connectors/paths.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport path from \"node:path\";\n\nimport { readEnvVar, resolveHomeDir } from \"../runtime/env.js\";\n\n/**\n * Connector registry directory name. Kept under the legacy `engram` config\n * root for backward compatibility with existing installs; the rename to a\n * `remnic` path (with a legacy read-fallback) is tracked in #1518.\n */\nexport const REGISTRY_DIR_NAME = \".engram-connectors\";\n\n/**\n * Single source of truth for the connectors config root\n * (`$XDG_CONFIG_HOME/engram` or `~/.config/engram`). Issue #1527 flagged this\n * derivation as previously duplicated across call sites — add new callers\n * here, never re-derive the path inline.\n */\nexport function getConnectorsConfigRoot(): string {\n const xdgConfigHome = readEnvVar(\"XDG_CONFIG_HOME\");\n return xdgConfigHome\n ? path.join(xdgConfigHome, \"engram\")\n : path.join(resolveHomeDir(), \".config\", \"engram\");\n}\n\n/** Path of the connector registry manifest file. */\nexport function getRegistryPath(): string {\n return path.join(getConnectorsConfigRoot(), REGISTRY_DIR_NAME, \"registry.json\");\n}\n\n/** Directory holding one `<connector-id>.json` per installed connector. */\nexport function getConnectorsDir(): string {\n return path.join(getConnectorsConfigRoot(), REGISTRY_DIR_NAME, \"connectors\");\n}\n\n/**\n * Sticky-legacy evidence for `emitLegacyTools` (issue #1550): any persisted\n * connector entry under the legacy engram connectors dir means an existing\n * install whose clients may still address engram_* aliases. Missing or\n * unreadable dir means fresh install — no evidence, no aliases.\n */\nexport function hasLegacyConnectorEntries(): boolean {\n try {\n return fs\n .readdirSync(getConnectorsDir())\n .some((name) => name.endsWith(\".json\"));\n } catch {\n return false;\n }\n}\n"],"mappings":";;;;;;AAAA,OAAO,QAAQ;AACf,OAAO,UAAU;AASV,IAAM,oBAAoB;AAQ1B,SAAS,0BAAkC;AAChD,QAAM,gBAAgB,WAAW,iBAAiB;AAClD,SAAO,gBACH,KAAK,KAAK,eAAe,QAAQ,IACjC,KAAK,KAAK,eAAe,GAAG,WAAW,QAAQ;AACrD;AAGO,SAAS,kBAA0B;AACxC,SAAO,KAAK,KAAK,wBAAwB,GAAG,mBAAmB,eAAe;AAChF;AAGO,SAAS,mBAA2B;AACzC,SAAO,KAAK,KAAK,wBAAwB,GAAG,mBAAmB,YAAY;AAC7E;AAQO,SAAS,4BAAqC;AACnD,MAAI;AACF,WAAO,GACJ,YAAY,iBAAiB,CAAC,EAC9B,KAAK,CAAC,SAAS,KAAK,SAAS,OAAO,CAAC;AAAA,EAC1C,QAAQ;AACN,WAAO;AAAA,EACT;AACF;","names":[]}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import {
|
|
2
|
+
failOpenFaissHealth
|
|
3
|
+
} from "./chunk-E6ZDCOHM.js";
|
|
1
4
|
import {
|
|
2
5
|
rebuildConversationChunksFailOpen,
|
|
3
6
|
upsertConversationChunksFailOpen
|
|
@@ -6,9 +9,6 @@ import {
|
|
|
6
9
|
searchConversationIndex,
|
|
7
10
|
searchConversationIndexFaissFailOpen
|
|
8
11
|
} from "./chunk-7DTASS5T.js";
|
|
9
|
-
import {
|
|
10
|
-
failOpenFaissHealth
|
|
11
|
-
} from "./chunk-E6ZDCOHM.js";
|
|
12
12
|
|
|
13
13
|
// src/conversation-index/backend.ts
|
|
14
14
|
function createConversationIndexBackend(options) {
|
|
@@ -235,4 +235,4 @@ function createFaissBackend(getFaiss) {
|
|
|
235
235
|
export {
|
|
236
236
|
createConversationIndexBackend
|
|
237
237
|
};
|
|
238
|
-
//# sourceMappingURL=chunk-
|
|
238
|
+
//# sourceMappingURL=chunk-7OGJQP7T.js.map
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
} from "./chunk-RN7MUWON.js";
|
|
19
19
|
import {
|
|
20
20
|
createConversationIndexBackend
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-7OGJQP7T.js";
|
|
22
22
|
import {
|
|
23
23
|
FaissConversationIndexAdapter
|
|
24
24
|
} from "./chunk-E6ZDCOHM.js";
|
|
@@ -170,4 +170,4 @@ export {
|
|
|
170
170
|
createConversationSearchBackend,
|
|
171
171
|
createConversationIndexRuntime
|
|
172
172
|
};
|
|
173
|
-
//# sourceMappingURL=chunk-
|
|
173
|
+
//# sourceMappingURL=chunk-B55KFEGS.js.map
|
|
@@ -9,6 +9,10 @@ import {
|
|
|
9
9
|
import {
|
|
10
10
|
coerceInstallExtension
|
|
11
11
|
} from "./chunk-PHK3HARR.js";
|
|
12
|
+
import {
|
|
13
|
+
getConnectorsDir,
|
|
14
|
+
getRegistryPath
|
|
15
|
+
} from "./chunk-3BQOQYRB.js";
|
|
12
16
|
import {
|
|
13
17
|
launchProcessSync
|
|
14
18
|
} from "./chunk-O75CRYGF.js";
|
|
@@ -626,7 +630,6 @@ var BUILTIN_CONNECTORS = [
|
|
|
626
630
|
requiresToken: true
|
|
627
631
|
}
|
|
628
632
|
];
|
|
629
|
-
var REGISTRY_DIR_NAME = ".engram-connectors";
|
|
630
633
|
var CONNECTOR_ID_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._-]*$/;
|
|
631
634
|
function isValidConnectorId(connectorId) {
|
|
632
635
|
return typeof connectorId === "string" && CONNECTOR_ID_PATTERN.test(connectorId);
|
|
@@ -634,11 +637,6 @@ function isValidConnectorId(connectorId) {
|
|
|
634
637
|
function isConnectorManifest(value) {
|
|
635
638
|
return typeof value === "object" && value !== null && !Array.isArray(value) && isValidConnectorId(value.id);
|
|
636
639
|
}
|
|
637
|
-
function getRegistryPath() {
|
|
638
|
-
const xdgConfigHome = readEnvVar("XDG_CONFIG_HOME");
|
|
639
|
-
const configDir = xdgConfigHome ? path2.join(xdgConfigHome, "engram") : path2.join(resolveHomeDir(), ".config", "engram");
|
|
640
|
-
return path2.join(configDir, REGISTRY_DIR_NAME, "registry.json");
|
|
641
|
-
}
|
|
642
640
|
function loadRegistry() {
|
|
643
641
|
const regPath = getRegistryPath();
|
|
644
642
|
if (!fs2.existsSync(regPath)) {
|
|
@@ -2092,11 +2090,6 @@ function removeCodexMemoryExtension(options = {}) {
|
|
|
2092
2090
|
}
|
|
2093
2091
|
return { ...paths, removed };
|
|
2094
2092
|
}
|
|
2095
|
-
function getConnectorsDir() {
|
|
2096
|
-
const xdgConfigHome = readEnvVar("XDG_CONFIG_HOME");
|
|
2097
|
-
const configDir = xdgConfigHome ? path2.join(xdgConfigHome, "engram") : path2.join(resolveHomeDir(), ".config", "engram");
|
|
2098
|
-
return path2.join(configDir, REGISTRY_DIR_NAME, "connectors");
|
|
2099
|
-
}
|
|
2100
2093
|
var WECLONE_PROXY_CONFIG_DIRNAME = ".remnic";
|
|
2101
2094
|
var WECLONE_PROXY_CONFIG_FILENAME = "weclone.json";
|
|
2102
2095
|
function resolveWeCloneProxyConfigPath() {
|
|
@@ -2244,7 +2237,6 @@ export {
|
|
|
2244
2237
|
checkMarketplaceManifest,
|
|
2245
2238
|
writeMarketplaceManifest,
|
|
2246
2239
|
installFromMarketplace,
|
|
2247
|
-
getRegistryPath,
|
|
2248
2240
|
loadRegistry,
|
|
2249
2241
|
saveRegistry,
|
|
2250
2242
|
listConnectors,
|
|
@@ -2262,4 +2254,4 @@ export {
|
|
|
2262
2254
|
resolveWeCloneProxyConfigPath,
|
|
2263
2255
|
buildWeCloneProxyConfig
|
|
2264
2256
|
};
|
|
2265
|
-
//# sourceMappingURL=chunk-
|
|
2257
|
+
//# sourceMappingURL=chunk-GNAMDNGT.js.map
|