@remnic/core 9.3.645 → 9.3.646

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 (95) hide show
  1. package/dist/access-cli.js +18 -17
  2. package/dist/access-cli.js.map +1 -1
  3. package/dist/access-http.js +13 -13
  4. package/dist/access-mcp.js +10 -10
  5. package/dist/access-schema.js +3 -3
  6. package/dist/access-service.js +8 -8
  7. package/dist/adapters/index.js +4 -4
  8. package/dist/adapters/registry.js +2 -2
  9. package/dist/{capsule-crypto-YO5QJ6L3.js → capsule-crypto-GWVG7LGC.js} +2 -2
  10. package/dist/{chunk-6YLJZ2EU.js → chunk-3JSWINVD.js} +92 -29
  11. package/dist/chunk-3JSWINVD.js.map +1 -0
  12. package/dist/{chunk-AGNBY3VG.js → chunk-APJQ6UEA.js} +4 -4
  13. package/dist/{chunk-HRXCPKN4.js → chunk-APWJRJFW.js} +2 -2
  14. package/dist/{chunk-VDX2J7OX.js → chunk-BUKK5SWA.js} +2 -2
  15. package/dist/{chunk-T22TZJWJ.js → chunk-DC66QVL2.js} +2 -2
  16. package/dist/chunk-EVWIEEKZ.js +315 -0
  17. package/dist/chunk-EVWIEEKZ.js.map +1 -0
  18. package/dist/{chunk-IZXOO6NP.js → chunk-FAYDM5WD.js} +2 -2
  19. package/dist/{chunk-MBT3ASYV.js → chunk-H67ZTMTL.js} +12 -12
  20. package/dist/{chunk-3SF7QNKF.js → chunk-I3IWTRYB.js} +2 -2
  21. package/dist/{chunk-Y2XKJJEI.js → chunk-IMWFHBG2.js} +10 -33
  22. package/dist/chunk-IMWFHBG2.js.map +1 -0
  23. package/dist/{chunk-IHG27THY.js → chunk-JLOJ5RJ7.js} +68 -59
  24. package/dist/chunk-JLOJ5RJ7.js.map +1 -0
  25. package/dist/{chunk-W5ISYSIL.js → chunk-L7W5YW6Y.js} +4 -4
  26. package/dist/{chunk-DGNQRNLL.js → chunk-NT5TINK5.js} +2 -2
  27. package/dist/{chunk-BXLOS5AJ.js → chunk-OWHERGF2.js} +2 -2
  28. package/dist/{chunk-CDHRUNBX.js → chunk-QKE4LHNR.js} +2 -2
  29. package/dist/{chunk-BTRL6GG7.js → chunk-RAELB5NX.js} +5 -5
  30. package/dist/{chunk-2QSZNTDO.js → chunk-RKNJBZ55.js} +4 -4
  31. package/dist/chunk-S4DDLTPX.js +140 -0
  32. package/dist/chunk-S4DDLTPX.js.map +1 -0
  33. package/dist/{chunk-KVUG7FF7.js → chunk-U55D5UD5.js} +7 -7
  34. package/dist/{chunk-DQEMWVMT.js → chunk-UVYI6VIX.js} +1 -1
  35. package/dist/{chunk-D2B22JDF.js → chunk-WEPMT6SC.js} +7 -7
  36. package/dist/{chunk-YOXCJP3A.js → chunk-ZPPFKVSD.js} +3 -3
  37. package/dist/cli.js +30 -28
  38. package/dist/{first-start-migration-FF7YFGRP.js → first-start-migration-PG5HBC3K.js} +4 -4
  39. package/dist/index.d.ts +2 -0
  40. package/dist/index.js +77 -63
  41. package/dist/index.js.map +1 -1
  42. package/dist/lcm/engine.js +3 -3
  43. package/dist/lcm/index.js +11 -11
  44. package/dist/namespaces/migrate.js +5 -5
  45. package/dist/namespaces/search.js +4 -4
  46. package/dist/operator-toolkit.js +6 -6
  47. package/dist/orchestrator.js +14 -13
  48. package/dist/resume-bundles.js +3 -2
  49. package/dist/search/factory.js +3 -3
  50. package/dist/search/index.js +7 -7
  51. package/dist/session-identity.d.ts +118 -0
  52. package/dist/session-identity.js +21 -0
  53. package/dist/session-identity.js.map +1 -0
  54. package/dist/session-transcript-migration.d.ts +65 -0
  55. package/dist/session-transcript-migration.js +16 -0
  56. package/dist/session-transcript-migration.js.map +1 -0
  57. package/dist/summarizer.js +2 -1
  58. package/dist/transcript.d.ts +12 -6
  59. package/dist/transcript.js +2 -1
  60. package/dist/transfer/backup.js +2 -2
  61. package/dist/transfer/capsule-export.js +2 -2
  62. package/dist/transfer/capsule-import.js +2 -2
  63. package/dist/transfer/import-sqlite.js +2 -2
  64. package/package.json +1 -1
  65. package/src/cli.ts +79 -0
  66. package/src/index.ts +18 -0
  67. package/src/session-identity.test.ts +130 -0
  68. package/src/session-identity.ts +281 -0
  69. package/src/session-transcript-migration.test.ts +350 -0
  70. package/src/session-transcript-migration.ts +527 -0
  71. package/src/summarizer.ts +15 -35
  72. package/src/transcript-session-identity.test.ts +424 -0
  73. package/src/transcript.ts +100 -70
  74. package/dist/chunk-6YLJZ2EU.js.map +0 -1
  75. package/dist/chunk-IHG27THY.js.map +0 -1
  76. package/dist/chunk-Y2XKJJEI.js.map +0 -1
  77. /package/dist/{capsule-crypto-YO5QJ6L3.js.map → capsule-crypto-GWVG7LGC.js.map} +0 -0
  78. /package/dist/{chunk-AGNBY3VG.js.map → chunk-APJQ6UEA.js.map} +0 -0
  79. /package/dist/{chunk-HRXCPKN4.js.map → chunk-APWJRJFW.js.map} +0 -0
  80. /package/dist/{chunk-VDX2J7OX.js.map → chunk-BUKK5SWA.js.map} +0 -0
  81. /package/dist/{chunk-T22TZJWJ.js.map → chunk-DC66QVL2.js.map} +0 -0
  82. /package/dist/{chunk-IZXOO6NP.js.map → chunk-FAYDM5WD.js.map} +0 -0
  83. /package/dist/{chunk-MBT3ASYV.js.map → chunk-H67ZTMTL.js.map} +0 -0
  84. /package/dist/{chunk-3SF7QNKF.js.map → chunk-I3IWTRYB.js.map} +0 -0
  85. /package/dist/{chunk-W5ISYSIL.js.map → chunk-L7W5YW6Y.js.map} +0 -0
  86. /package/dist/{chunk-DGNQRNLL.js.map → chunk-NT5TINK5.js.map} +0 -0
  87. /package/dist/{chunk-BXLOS5AJ.js.map → chunk-OWHERGF2.js.map} +0 -0
  88. /package/dist/{chunk-CDHRUNBX.js.map → chunk-QKE4LHNR.js.map} +0 -0
  89. /package/dist/{chunk-BTRL6GG7.js.map → chunk-RAELB5NX.js.map} +0 -0
  90. /package/dist/{chunk-2QSZNTDO.js.map → chunk-RKNJBZ55.js.map} +0 -0
  91. /package/dist/{chunk-KVUG7FF7.js.map → chunk-U55D5UD5.js.map} +0 -0
  92. /package/dist/{chunk-DQEMWVMT.js.map → chunk-UVYI6VIX.js.map} +0 -0
  93. /package/dist/{chunk-D2B22JDF.js.map → chunk-WEPMT6SC.js.map} +0 -0
  94. /package/dist/{chunk-YOXCJP3A.js.map → chunk-ZPPFKVSD.js.map} +0 -0
  95. /package/dist/{first-start-migration-FF7YFGRP.js.map → first-start-migration-PG5HBC3K.js.map} +0 -0
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  LcmEngine,
3
3
  extractLcmConfig
4
- } from "../chunk-D2B22JDF.js";
4
+ } from "../chunk-WEPMT6SC.js";
5
+ import "../chunk-5VDJMYTF.js";
6
+ import "../chunk-HP5FMB6L.js";
5
7
  import "../chunk-7N4KAIGN.js";
6
8
  import "../chunk-TPDBFYEG.js";
7
9
  import "../chunk-KCYE2MZM.js";
8
10
  import "../chunk-MAV46GWQ.js";
9
- import "../chunk-5VDJMYTF.js";
10
- import "../chunk-HP5FMB6L.js";
11
11
  import "../chunk-4RA3C3EV.js";
12
12
  import "../chunk-CI7RKSRE.js";
13
13
  import "../chunk-6KYMPV2O.js";
package/dist/lcm/index.js CHANGED
@@ -1,8 +1,18 @@
1
1
  import "../chunk-HHLLAQGZ.js";
2
+ import {
3
+ registerLcmTools
4
+ } from "../chunk-UWK5OXUJ.js";
2
5
  import {
3
6
  LcmEngine,
4
7
  extractLcmConfig
5
- } from "../chunk-D2B22JDF.js";
8
+ } from "../chunk-WEPMT6SC.js";
9
+ import {
10
+ LcmSummarizer
11
+ } from "../chunk-5VDJMYTF.js";
12
+ import {
13
+ LcmArchive,
14
+ estimateTokens
15
+ } from "../chunk-HP5FMB6L.js";
6
16
  import {
7
17
  LcmDag
8
18
  } from "../chunk-7N4KAIGN.js";
@@ -14,16 +24,6 @@ import {
14
24
  ensureLcmStateDir,
15
25
  openLcmDatabase
16
26
  } from "../chunk-MAV46GWQ.js";
17
- import {
18
- LcmSummarizer
19
- } from "../chunk-5VDJMYTF.js";
20
- import {
21
- registerLcmTools
22
- } from "../chunk-UWK5OXUJ.js";
23
- import {
24
- LcmArchive,
25
- estimateTokens
26
- } from "../chunk-HP5FMB6L.js";
27
27
  import "../chunk-4RA3C3EV.js";
28
28
  import "../chunk-CI7RKSRE.js";
29
29
  import "../chunk-6KYMPV2O.js";
@@ -2,16 +2,16 @@ import {
2
2
  listNamespaces,
3
3
  runNamespaceMigration,
4
4
  verifyNamespaces
5
- } from "../chunk-IZXOO6NP.js";
5
+ } from "../chunk-FAYDM5WD.js";
6
6
  import "../chunk-D6WVJIS3.js";
7
- import "../chunk-HRXCPKN4.js";
8
- import "../chunk-KVUG7FF7.js";
7
+ import "../chunk-APWJRJFW.js";
8
+ import "../chunk-U55D5UD5.js";
9
+ import "../chunk-CYEPCZN5.js";
10
+ import "../chunk-DCGT4FPP.js";
9
11
  import "../chunk-JOASJWQR.js";
10
12
  import "../chunk-RN7MUWON.js";
11
13
  import "../chunk-3MAONBX3.js";
12
14
  import "../chunk-RG3LBSGH.js";
13
- import "../chunk-CYEPCZN5.js";
14
- import "../chunk-DCGT4FPP.js";
15
15
  import "../chunk-Q4CAQGKQ.js";
16
16
  import "../chunk-CINZGPSJ.js";
17
17
  import "../chunk-ZFXCQPNO.js";
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  NamespaceSearchRouter,
3
3
  namespaceCollectionName
4
- } from "../chunk-HRXCPKN4.js";
5
- import "../chunk-KVUG7FF7.js";
4
+ } from "../chunk-APWJRJFW.js";
5
+ import "../chunk-U55D5UD5.js";
6
+ import "../chunk-CYEPCZN5.js";
7
+ import "../chunk-DCGT4FPP.js";
6
8
  import "../chunk-JOASJWQR.js";
7
9
  import "../chunk-RN7MUWON.js";
8
10
  import "../chunk-3MAONBX3.js";
9
11
  import "../chunk-RG3LBSGH.js";
10
- import "../chunk-CYEPCZN5.js";
11
- import "../chunk-DCGT4FPP.js";
12
12
  import "../chunk-Q4CAQGKQ.js";
13
13
  import "../chunk-CINZGPSJ.js";
14
14
  import "../chunk-ZFXCQPNO.js";
@@ -11,8 +11,8 @@ import {
11
11
  summarizeMemoryWorthLegacyCounters,
12
12
  summarizeObservationThroughput,
13
13
  summarizeTierDistribution
14
- } from "./chunk-T22TZJWJ.js";
15
- import "./chunk-IZXOO6NP.js";
14
+ } from "./chunk-DC66QVL2.js";
15
+ import "./chunk-FAYDM5WD.js";
16
16
  import "./chunk-AL4RAJL5.js";
17
17
  import "./chunk-YBPYIAA5.js";
18
18
  import "./chunk-D6WVJIS3.js";
@@ -26,14 +26,14 @@ import "./chunk-PHK3HARR.js";
26
26
  import "./chunk-NDAH7BJ5.js";
27
27
  import "./chunk-Z5LAYHGJ.js";
28
28
  import "./chunk-UMTG2BN2.js";
29
- import "./chunk-HRXCPKN4.js";
30
- import "./chunk-KVUG7FF7.js";
29
+ import "./chunk-APWJRJFW.js";
30
+ import "./chunk-U55D5UD5.js";
31
+ import "./chunk-CYEPCZN5.js";
32
+ import "./chunk-DCGT4FPP.js";
31
33
  import "./chunk-JOASJWQR.js";
32
34
  import "./chunk-RN7MUWON.js";
33
35
  import "./chunk-3MAONBX3.js";
34
36
  import "./chunk-RG3LBSGH.js";
35
- import "./chunk-CYEPCZN5.js";
36
- import "./chunk-DCGT4FPP.js";
37
37
  import "./chunk-Q4CAQGKQ.js";
38
38
  import "./chunk-CINZGPSJ.js";
39
39
  import "./chunk-ZFXCQPNO.js";
@@ -28,33 +28,33 @@ import {
28
28
  sanitizeSessionKeyForFilename,
29
29
  shouldFilterLifecycleRecallCandidate,
30
30
  summarizeGraphShadowComparison
31
- } from "./chunk-MBT3ASYV.js";
31
+ } from "./chunk-H67ZTMTL.js";
32
32
  import "./chunk-DDRNDPX4.js";
33
33
  import "./chunk-7HYPN2GC.js";
34
34
  import "./chunk-666A3MOW.js";
35
35
  import "./chunk-HHLLAQGZ.js";
36
- import "./chunk-D2B22JDF.js";
36
+ import "./chunk-UWK5OXUJ.js";
37
+ import "./chunk-WEPMT6SC.js";
38
+ import "./chunk-5VDJMYTF.js";
39
+ import "./chunk-HP5FMB6L.js";
37
40
  import "./chunk-7N4KAIGN.js";
38
41
  import "./chunk-TPDBFYEG.js";
39
42
  import "./chunk-KCYE2MZM.js";
40
43
  import "./chunk-MAV46GWQ.js";
41
- import "./chunk-5VDJMYTF.js";
42
- import "./chunk-UWK5OXUJ.js";
43
44
  import "./chunk-TECVW3JP.js";
44
45
  import "./chunk-T2PO5MUF.js";
45
- import "./chunk-HP5FMB6L.js";
46
46
  import "./chunk-Z3PZRDLW.js";
47
47
  import "./chunk-DRD2Q7HQ.js";
48
48
  import "./chunk-LXOM6IQU.js";
49
+ import "./chunk-VOUOLGIP.js";
49
50
  import "./chunk-S75M5ZRK.js";
50
51
  import "./chunk-ECZU5BJH.js";
51
52
  import "./chunk-UHGBNIOS.js";
53
+ import "./chunk-IMWFHBG2.js";
54
+ import "./chunk-XJNBEDFE.js";
52
55
  import "./chunk-VWT3F4IV.js";
53
56
  import "./chunk-YTWNKQ2G.js";
54
57
  import "./chunk-MDYG7VI7.js";
55
- import "./chunk-VOUOLGIP.js";
56
- import "./chunk-Y2XKJJEI.js";
57
- import "./chunk-XJNBEDFE.js";
58
58
  import "./chunk-MHQC2WU2.js";
59
59
  import "./chunk-OZKZ2TRP.js";
60
60
  import "./chunk-6GC5SGFE.js";
@@ -107,7 +107,8 @@ import "./chunk-UMKPSD35.js";
107
107
  import "./chunk-W4RVMTHR.js";
108
108
  import "./chunk-4BISW7RX.js";
109
109
  import "./chunk-ZRWB5D4H.js";
110
- import "./chunk-IHG27THY.js";
110
+ import "./chunk-JLOJ5RJ7.js";
111
+ import "./chunk-S4DDLTPX.js";
111
112
  import "./chunk-SFQ6QNL7.js";
112
113
  import "./chunk-D6WVJIS3.js";
113
114
  import "./chunk-KFY3SGN7.js";
@@ -145,14 +146,14 @@ import "./chunk-5RIRL3XL.js";
145
146
  import "./chunk-JGSKJHF7.js";
146
147
  import "./chunk-FF4KLI5W.js";
147
148
  import "./chunk-BEMWL2FZ.js";
148
- import "./chunk-HRXCPKN4.js";
149
- import "./chunk-KVUG7FF7.js";
149
+ import "./chunk-APWJRJFW.js";
150
+ import "./chunk-U55D5UD5.js";
151
+ import "./chunk-CYEPCZN5.js";
152
+ import "./chunk-DCGT4FPP.js";
150
153
  import "./chunk-JOASJWQR.js";
151
154
  import "./chunk-RN7MUWON.js";
152
155
  import "./chunk-3MAONBX3.js";
153
156
  import "./chunk-RG3LBSGH.js";
154
- import "./chunk-CYEPCZN5.js";
155
- import "./chunk-DCGT4FPP.js";
156
157
  import "./chunk-Q4CAQGKQ.js";
157
158
  import "./chunk-CINZGPSJ.js";
158
159
  import "./chunk-ZFXCQPNO.js";
@@ -4,9 +4,10 @@ import {
4
4
  recordResumeBundle,
5
5
  resolveResumeBundleDir,
6
6
  validateResumeBundle
7
- } from "./chunk-3SF7QNKF.js";
7
+ } from "./chunk-I3IWTRYB.js";
8
8
  import "./chunk-ZRWB5D4H.js";
9
- import "./chunk-IHG27THY.js";
9
+ import "./chunk-JLOJ5RJ7.js";
10
+ import "./chunk-S4DDLTPX.js";
10
11
  import "./chunk-KFY3SGN7.js";
11
12
  import "./chunk-LMDRGRJ2.js";
12
13
  import "./chunk-C63WC454.js";
@@ -2,13 +2,13 @@ import {
2
2
  createConversationIndexRuntime,
3
3
  createConversationSearchBackend,
4
4
  createSearchBackend
5
- } from "../chunk-KVUG7FF7.js";
5
+ } from "../chunk-U55D5UD5.js";
6
+ import "../chunk-CYEPCZN5.js";
7
+ import "../chunk-DCGT4FPP.js";
6
8
  import "../chunk-JOASJWQR.js";
7
9
  import "../chunk-RN7MUWON.js";
8
10
  import "../chunk-3MAONBX3.js";
9
11
  import "../chunk-RG3LBSGH.js";
10
- import "../chunk-CYEPCZN5.js";
11
- import "../chunk-DCGT4FPP.js";
12
12
  import "../chunk-Q4CAQGKQ.js";
13
13
  import "../chunk-CINZGPSJ.js";
14
14
  import "../chunk-7OGJQP7T.js";
@@ -2,7 +2,13 @@ import {
2
2
  createConversationIndexRuntime,
3
3
  createConversationSearchBackend,
4
4
  createSearchBackend
5
- } from "../chunk-KVUG7FF7.js";
5
+ } from "../chunk-U55D5UD5.js";
6
+ import {
7
+ NoopSearchBackend
8
+ } from "../chunk-CYEPCZN5.js";
9
+ import {
10
+ OramaBackend
11
+ } from "../chunk-DCGT4FPP.js";
6
12
  import {
7
13
  RemoteSearchBackend
8
14
  } from "../chunk-JOASJWQR.js";
@@ -15,12 +21,6 @@ import {
15
21
  import {
16
22
  MeilisearchBackend
17
23
  } from "../chunk-RG3LBSGH.js";
18
- import {
19
- NoopSearchBackend
20
- } from "../chunk-CYEPCZN5.js";
21
- import {
22
- OramaBackend
23
- } from "../chunk-DCGT4FPP.js";
24
24
  import {
25
25
  scanMemoryDir
26
26
  } from "../chunk-Q4CAQGKQ.js";
@@ -0,0 +1,118 @@
1
+ /**
2
+ * Shared session-identity / transcript-pathing layer (issue #1496).
3
+ *
4
+ * This module is the SINGLE source of truth for turning a `sessionKey` into a
5
+ * channel identity and a set of deterministic, collision-resistant storage
6
+ * paths. Every subsystem that previously re-parsed session keys (transcript
7
+ * pathing, tool-usage pathing, hourly summaries, session auditing, conversation
8
+ * indexing) MUST route through `parseSessionIdentity()` / `sessionStoragePaths()`
9
+ * so behavior stays identical across paths (rule #22, #39).
10
+ *
11
+ * Two shapes are recognized:
12
+ *
13
+ * 1. Legacy `agent:<agentId>:<channelType>:...` keys keep their existing
14
+ * readable channel identity:
15
+ * - agent:<id>:main → type="main", id="default"
16
+ * - agent:<id>:discord:channel:<chanId> → type="discord", id="<chanId>"
17
+ * - agent:<id>:slack:channel:<chanId> → type="slack", id="<chanId>"
18
+ * - agent:<id>:cron:<jobId> → type="cron", id="<jobId>"
19
+ * - agent:<id>:<other>[:<id>] → type="<other>", id="<id?>"
20
+ *
21
+ * 2. Arbitrary / non-legacy keys (e.g. `pi-geek:abc123`) become first-class
22
+ * from the FIRST write — they NEVER start life under `other/default`:
23
+ * channelType = "session"
24
+ * channelId = storagePathHash(sessionKey) (collision-resistant)
25
+ * yielding `transcripts/session/<hash>/YYYY-MM-DD.jsonl`.
26
+ *
27
+ * The reserved `"session"` channel type is what makes arbitrary keys isolated
28
+ * and auditable. Legacy data under `other/default` (and any legacy channel
29
+ * directory) remains READABLE via `legacyDir` / `alternateDir` candidates.
30
+ */
31
+ /** Channel type reserved for first-class arbitrary (non-legacy) session keys. */
32
+ declare const SESSION_CHANNEL_TYPE = "session";
33
+ /** Legacy fallback channel identity for un-parseable keys (read-back only). */
34
+ declare const LEGACY_FALLBACK_CHANNEL_TYPE = "other";
35
+ declare const LEGACY_FALLBACK_CHANNEL_ID = "default";
36
+ interface SessionIdentity {
37
+ /** Channel type — legacy channel type for known shapes, else `"session"`. */
38
+ channelType: string;
39
+ /** Channel id — legacy channel id for known shapes, else the key hash. */
40
+ channelId: string;
41
+ /** Human-readable, non-authoritative label derived from the raw key. */
42
+ displayLabel: string;
43
+ /** The original session key, unchanged. */
44
+ canonicalSessionKey: string;
45
+ /** True when the key matched a known legacy `agent:<id>:...` shape. */
46
+ legacy: boolean;
47
+ }
48
+ interface SessionStoragePaths {
49
+ /** Channel type (mirrors {@link SessionIdentity.channelType}). */
50
+ channelType: string;
51
+ /** Channel id (mirrors {@link SessionIdentity.channelId}). */
52
+ channelId: string;
53
+ /** Primary encoded storage subdirectory: `<encodedType>/<encodedId>`. */
54
+ dir: string;
55
+ /**
56
+ * Collision-resistant alternate subdirectory that always embeds the full
57
+ * session-key hash. Used both as a write-time collision escape hatch and as a
58
+ * read-back candidate for data written before this layer existed.
59
+ */
60
+ alternateDir: string;
61
+ /**
62
+ * Un-encoded `<type>/<id>` directory for reading data written by older
63
+ * builds that did not URL-encode path segments. Undefined when it would be
64
+ * identical to `dir` or when either segment is path-unsafe.
65
+ */
66
+ legacyDir?: string;
67
+ /**
68
+ * Ordered, de-duplicated list of READ-BACK-ONLY directories where an older
69
+ * build may have stranded this key's data. NEW writes never target these —
70
+ * they exist purely so pre-#1496 transcripts/tool-usage stay discoverable
71
+ * (and migratable). Populated only for non-legacy keys. Includes:
72
+ * 1. the shared `other/default` fallback (every arbitrary key landed here);
73
+ * 2. the directory the OLD `parts.length >= 3` parser would have chosen
74
+ * (e.g. `foo:bar:baz` → `baz/default`, `foo:bar:baz:qux` → `baz/qux`).
75
+ * See {@link legacyParserReadbackDir}.
76
+ */
77
+ readbackDirs: string[];
78
+ }
79
+ /**
80
+ * Parse a session key into a stable channel identity.
81
+ *
82
+ * Pure and deterministic — no filesystem access. Same input always yields the
83
+ * same identity, which is what makes arbitrary keys collision-resistant from
84
+ * the first write.
85
+ */
86
+ declare function parseSessionIdentity(sessionKey: string): SessionIdentity;
87
+ /**
88
+ * Resolve the storage path pieces for a session key. Wraps
89
+ * {@link parseSessionIdentity} so transcript, tool-usage, and summary writers
90
+ * share one implementation (rule #22).
91
+ */
92
+ declare function sessionStoragePaths(sessionKey: string): SessionStoragePaths;
93
+ /**
94
+ * The shared `other/default` directory every arbitrary key was routed into by
95
+ * builds predating issue #1496. Exposed so transcript/tool-usage/summary read
96
+ * paths and the migration scanner all agree on the same fallback location.
97
+ */
98
+ declare const OTHER_DEFAULT_READBACK_DIR: string;
99
+ /**
100
+ * Reconstruct the transcript/tool-usage directory the OLD `getTranscriptPath`
101
+ * parser (pre-#1496) would have produced for a key the NEW parser reclassifies
102
+ * as a first-class `session/<hash>` identity.
103
+ *
104
+ * The OLD parser treated ANY key with `parts.length >= 3` as legacy — it did
105
+ * NOT require a leading `agent` segment — so an arbitrary key like
106
+ * `foo:bar:baz` was stored under `baz/default` and `foo:bar:baz:qux` under
107
+ * `baz/qux`. Those directories must stay readable (and migratable) for existing
108
+ * installs even though the key now writes to `session/<hash>` (Thread B / codex
109
+ * review on PR #1504). Path segments are encoded exactly as the old `dir` was
110
+ * built (`encodeStoragePathSegment`) so the candidate matches the bytes on disk.
111
+ *
112
+ * Returns `undefined` when the key has fewer than three colon parts (the old
113
+ * parser would have used the `other/default` fallback, already covered), when
114
+ * the channel type is empty, or when the result is unsafe.
115
+ */
116
+ declare function legacyParserReadbackDir(sessionKey: string): string | undefined;
117
+
118
+ export { LEGACY_FALLBACK_CHANNEL_ID, LEGACY_FALLBACK_CHANNEL_TYPE, OTHER_DEFAULT_READBACK_DIR, SESSION_CHANNEL_TYPE, type SessionIdentity, type SessionStoragePaths, legacyParserReadbackDir, parseSessionIdentity, sessionStoragePaths };
@@ -0,0 +1,21 @@
1
+ import {
2
+ LEGACY_FALLBACK_CHANNEL_ID,
3
+ LEGACY_FALLBACK_CHANNEL_TYPE,
4
+ OTHER_DEFAULT_READBACK_DIR,
5
+ SESSION_CHANNEL_TYPE,
6
+ legacyParserReadbackDir,
7
+ parseSessionIdentity,
8
+ sessionStoragePaths
9
+ } from "./chunk-S4DDLTPX.js";
10
+ import "./chunk-FF4KLI5W.js";
11
+ import "./chunk-PZ5AY32C.js";
12
+ export {
13
+ LEGACY_FALLBACK_CHANNEL_ID,
14
+ LEGACY_FALLBACK_CHANNEL_TYPE,
15
+ OTHER_DEFAULT_READBACK_DIR,
16
+ SESSION_CHANNEL_TYPE,
17
+ legacyParserReadbackDir,
18
+ parseSessionIdentity,
19
+ sessionStoragePaths
20
+ };
21
+ //# sourceMappingURL=session-identity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,65 @@
1
+ interface SessionMigrationEntryGroup {
2
+ /** The distinct session key these lines belong to. */
3
+ sessionKey: string;
4
+ /** Whether this key is a recognized legacy `agent:<id>:...` shape. */
5
+ legacy: boolean;
6
+ /** Destination directory (relative to the transcripts root). */
7
+ destDir: string;
8
+ /** Number of JSONL entries that will move. */
9
+ entryCount: number;
10
+ }
11
+ interface SessionMigrationFilePlan {
12
+ /** Source file path (relative to transcripts root). */
13
+ sourceRelPath: string;
14
+ /** The date-stamped file name (e.g. `2026-06-29.jsonl`). */
15
+ fileName: string;
16
+ /** Distinct session groups discovered inside this source file. */
17
+ groups: SessionMigrationEntryGroup[];
18
+ /** Lines that could not be parsed as JSON or lacked a sessionKey. */
19
+ unmovableLines: number;
20
+ /**
21
+ * True when EVERY entry in the file already belongs in the source directory
22
+ * (nothing to do). Such files are skipped.
23
+ */
24
+ alreadyHomed: boolean;
25
+ }
26
+ interface SessionMigrationPlan {
27
+ generatedAt: string;
28
+ dryRun: boolean;
29
+ transcriptsDir: string;
30
+ /** Per-file plans that have at least one entry to move. */
31
+ files: SessionMigrationFilePlan[];
32
+ /** Distinct destination session keys across all files. */
33
+ distinctSessions: number;
34
+ /** Total entries that will be re-homed. */
35
+ movedEntries: number;
36
+ }
37
+ interface SessionMigrationResult {
38
+ plan: SessionMigrationPlan;
39
+ applied: boolean;
40
+ filesRewritten: number;
41
+ filesRemoved: number;
42
+ errors: string[];
43
+ manifestPath?: string;
44
+ }
45
+ interface MigrateSessionTranscriptsOptions {
46
+ /** The memory directory root (transcripts live under `<memoryDir>/transcripts`). */
47
+ memoryDir: string;
48
+ /** When true, perform the migration; otherwise produce a dry-run plan only. */
49
+ apply?: boolean;
50
+ }
51
+ /**
52
+ * Compute the migration plan without modifying anything.
53
+ */
54
+ declare function planSessionTranscriptMigration(options: MigrateSessionTranscriptsOptions): Promise<SessionMigrationPlan>;
55
+ /**
56
+ * Run the migration. Dry-run by default; pass `apply: true` to mutate.
57
+ */
58
+ declare function migrateSessionTranscripts(options: MigrateSessionTranscriptsOptions): Promise<SessionMigrationResult>;
59
+ /** Best-effort byte-size summary for reporting (used by CLI output). */
60
+ declare function summarizeMigrationSources(memoryDir: string): Promise<{
61
+ files: number;
62
+ bytes: number;
63
+ }>;
64
+
65
+ export { type MigrateSessionTranscriptsOptions, type SessionMigrationEntryGroup, type SessionMigrationFilePlan, type SessionMigrationPlan, type SessionMigrationResult, migrateSessionTranscripts, planSessionTranscriptMigration, summarizeMigrationSources };
@@ -0,0 +1,16 @@
1
+ import {
2
+ migrateSessionTranscripts,
3
+ planSessionTranscriptMigration,
4
+ summarizeMigrationSources
5
+ } from "./chunk-EVWIEEKZ.js";
6
+ import "./chunk-S4DDLTPX.js";
7
+ import "./chunk-FF4KLI5W.js";
8
+ import "./chunk-6KYMPV2O.js";
9
+ import "./chunk-2ODBA7MQ.js";
10
+ import "./chunk-PZ5AY32C.js";
11
+ export {
12
+ migrateSessionTranscripts,
13
+ planSessionTranscriptMigration,
14
+ summarizeMigrationSources
15
+ };
16
+ //# sourceMappingURL=session-transcript-migration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1,9 +1,10 @@
1
1
  import {
2
2
  HourlySummarizer
3
- } from "./chunk-Y2XKJJEI.js";
3
+ } from "./chunk-IMWFHBG2.js";
4
4
  import "./chunk-XJNBEDFE.js";
5
5
  import "./chunk-XZ4WBBB5.js";
6
6
  import "./chunk-H3HDXD3U.js";
7
+ import "./chunk-S4DDLTPX.js";
7
8
  import "./chunk-A3BS64GV.js";
8
9
  import "./chunk-B5XMS73R.js";
9
10
  import "./chunk-7SI52C65.js";
@@ -26,13 +26,17 @@ declare class TranscriptManager {
26
26
  private static readonly CHARS_PER_TOKEN;
27
27
  constructor(config: PluginConfig);
28
28
  /**
29
- * Parse a sessionKey to extract channel type and ID.
29
+ * Resolve the storage path pieces for a sessionKey via the shared
30
+ * {@link sessionStoragePaths} helper (issue #1496, rule #22).
30
31
  *
31
- * SessionKey patterns:
32
- * - agent:<agent-id>:main type="main", id="default"
33
- * - agent:<agent-id>:discord:channel:<channel-id> type="discord", id="<channel-id>"
34
- * - agent:<agent-id>:cron:<job-id> type="cron", id="<job-id>"
35
- * - agent:<agent-id>:slack:channel:<channel-id> type="slack", id="<channel-id>"
32
+ * Legacy `agent:<id>:...` shapes keep their existing readable channel paths.
33
+ * Arbitrary / non-legacy keys (e.g. `pi-geek:abc123`) route to
34
+ * `transcripts/session/<hash>/YYYY-MM-DD.jsonl` from the FIRST write — they
35
+ * never start life in `other/default`. For those keys a list of
36
+ * read-back-only `readbackDirs` is returned so data written by older builds
37
+ * (under `other/default`, or under an old `parts.length >= 3` directory such
38
+ * as `baz/default`) stays discoverable until migrated. New writes never
39
+ * target read-back dirs. See `session-identity.ts`.
36
40
  *
37
41
  * @returns Object with raw channel identifiers and encoded storage path pieces.
38
42
  */
@@ -43,6 +47,7 @@ declare class TranscriptManager {
43
47
  channelId: string;
44
48
  alternateDir: string;
45
49
  legacyDir?: string;
50
+ readbackDirs: string[];
46
51
  };
47
52
  /**
48
53
  * Initialize the transcript manager by ensuring directories exist.
@@ -59,6 +64,7 @@ declare class TranscriptManager {
59
64
  file: string;
60
65
  alternateDir: string;
61
66
  legacyDir?: string;
67
+ readbackDirs: string[];
62
68
  };
63
69
  private selectStorageDirForWrite;
64
70
  private directorySessionStatus;
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  TranscriptManager
3
- } from "./chunk-IHG27THY.js";
3
+ } from "./chunk-JLOJ5RJ7.js";
4
+ import "./chunk-S4DDLTPX.js";
4
5
  import "./chunk-KFY3SGN7.js";
5
6
  import "./chunk-FF4KLI5W.js";
6
7
  import "./chunk-2ODBA7MQ.js";
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  backupMemoryDir
3
- } from "../chunk-BXLOS5AJ.js";
3
+ } from "../chunk-OWHERGF2.js";
4
4
  import "../chunk-765K3SAT.js";
5
- import "../chunk-DQEMWVMT.js";
5
+ import "../chunk-UVYI6VIX.js";
6
6
  import "../chunk-J4EB7DNW.js";
7
7
  import "../chunk-BJMBJZ2Y.js";
8
8
  import "../chunk-UKJAGEXH.js";
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  exportCapsule,
3
3
  isValidCapsuleSince
4
- } from "../chunk-VDX2J7OX.js";
4
+ } from "../chunk-BUKK5SWA.js";
5
5
  import "../chunk-WEHSQBFR.js";
6
- import "../chunk-DQEMWVMT.js";
6
+ import "../chunk-UVYI6VIX.js";
7
7
  import "../chunk-J4EB7DNW.js";
8
8
  import "../chunk-BJMBJZ2Y.js";
9
9
  import "../chunk-UKJAGEXH.js";
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  importCapsule
3
- } from "../chunk-DGNQRNLL.js";
3
+ } from "../chunk-NT5TINK5.js";
4
4
  import "../chunk-ALEPI75L.js";
5
5
  import "../chunk-WEHSQBFR.js";
6
- import "../chunk-DQEMWVMT.js";
6
+ import "../chunk-UVYI6VIX.js";
7
7
  import "../chunk-BJMBJZ2Y.js";
8
8
  import "../chunk-UKJAGEXH.js";
9
9
  import "../chunk-FP2373TW.js";
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  importSqlite
3
- } from "../chunk-AGNBY3VG.js";
4
- import "../chunk-Z734BLO3.js";
3
+ } from "../chunk-APJQ6UEA.js";
5
4
  import "../chunk-G4IAEX6D.js";
5
+ import "../chunk-Z734BLO3.js";
6
6
  import "../chunk-6KYMPV2O.js";
7
7
  import "../chunk-GCGJW34D.js";
8
8
  import "../chunk-PZ5AY32C.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remnic/core",
3
- "version": "9.3.645",
3
+ "version": "9.3.646",
4
4
  "description": "Framework-agnostic Remnic memory engine — orchestrator, storage, extraction, search, trust zones",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",