@squadrules/mcp 5.0.0-beta.1 → 5.0.0

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 (162) hide show
  1. package/README.md +23 -20
  2. package/dist/.tsbuildinfo +1 -1
  3. package/dist/config/embedding-fastembed.d.ts +9 -0
  4. package/dist/config/embedding-fastembed.d.ts.map +1 -0
  5. package/dist/config/embedding-fastembed.js +20 -0
  6. package/dist/config/embedding-fastembed.js.map +1 -0
  7. package/dist/config.d.ts +8 -4
  8. package/dist/config.d.ts.map +1 -1
  9. package/dist/config.js +10 -4
  10. package/dist/config.js.map +1 -1
  11. package/dist/embed-docs/mem/adapter-migration.md +1 -1
  12. package/dist/embed-docs/mem/bulk-insert-adapters-via-cli.md +1 -1
  13. package/dist/embed-docs/mem/challenge-type-guide.md +1 -1
  14. package/dist/embed-docs/mem/create-new-protocol.md +1 -1
  15. package/dist/embed-docs/mem/phase-critic-guide.md +1 -1
  16. package/dist/embed-docs/mem/phase-critic.md +1 -1
  17. package/dist/embed-docs/mem/protocol-linking-guide.md +1 -1
  18. package/dist/embed-docs/mem/refine-search.md +1 -1
  19. package/dist/embed-docs/mem/skill-format-guide.md +1 -1
  20. package/dist/http/http-api-snapshot.d.ts.map +1 -1
  21. package/dist/http/http-api-snapshot.js +13 -1
  22. package/dist/http/http-api-snapshot.js.map +1 -1
  23. package/dist/http/http-health-routes.d.ts.map +1 -1
  24. package/dist/http/http-health-routes.js +6 -3
  25. package/dist/http/http-health-routes.js.map +1 -1
  26. package/dist/index.d.ts.map +1 -1
  27. package/dist/index.js +15 -5
  28. package/dist/index.js.map +1 -1
  29. package/dist/resources/embedded-mcp-resources.js +9 -9
  30. package/dist/resources/embedded-mcp-resources.js.map +1 -1
  31. package/dist/resources/mem-resources-boot.d.ts.map +1 -1
  32. package/dist/resources/mem-resources-boot.js +2 -28
  33. package/dist/resources/mem-resources-boot.js.map +1 -1
  34. package/dist/resources/mem-uuid-mapper.d.ts.map +1 -1
  35. package/dist/resources/mem-uuid-mapper.js +8 -23
  36. package/dist/resources/mem-uuid-mapper.js.map +1 -1
  37. package/dist/server.d.ts.map +1 -1
  38. package/dist/server.js +9 -7
  39. package/dist/server.js.map +1 -1
  40. package/dist/services/embedding/fastembed-provider.d.ts +2 -0
  41. package/dist/services/embedding/fastembed-provider.d.ts.map +1 -0
  42. package/dist/services/embedding/fastembed-provider.js +78 -0
  43. package/dist/services/embedding/fastembed-provider.js.map +1 -0
  44. package/dist/services/embedding/health.d.ts.map +1 -1
  45. package/dist/services/embedding/health.js +99 -96
  46. package/dist/services/embedding/health.js.map +1 -1
  47. package/dist/services/embedding/provider-audit.d.ts +15 -0
  48. package/dist/services/embedding/provider-audit.d.ts.map +1 -0
  49. package/dist/services/embedding/provider-audit.js +28 -0
  50. package/dist/services/embedding/provider-audit.js.map +1 -0
  51. package/dist/services/embedding/providers.d.ts +2 -1
  52. package/dist/services/embedding/providers.d.ts.map +1 -1
  53. package/dist/services/embedding/providers.js +21 -23
  54. package/dist/services/embedding/providers.js.map +1 -1
  55. package/dist/services/embedding/service.d.ts +2 -2
  56. package/dist/services/embedding/service.d.ts.map +1 -1
  57. package/dist/services/embedding/service.js +13 -16
  58. package/dist/services/embedding/service.js.map +1 -1
  59. package/dist/services/execution-trace-store.d.ts +5 -29
  60. package/dist/services/execution-trace-store.d.ts.map +1 -1
  61. package/dist/services/execution-trace-store.js +10 -2
  62. package/dist/services/execution-trace-store.js.map +1 -1
  63. package/dist/services/memory/store.d.ts +23 -0
  64. package/dist/services/memory/store.d.ts.map +1 -1
  65. package/dist/services/memory/store.js +110 -3
  66. package/dist/services/memory/store.js.map +1 -1
  67. package/dist/services/memory-store.d.ts +5 -0
  68. package/dist/services/memory-store.d.ts.map +1 -1
  69. package/dist/services/memory-store.js +5 -0
  70. package/dist/services/memory-store.js.map +1 -1
  71. package/dist/services/qdrant/service.d.ts.map +1 -1
  72. package/dist/services/qdrant/service.js +11 -2
  73. package/dist/services/qdrant/service.js.map +1 -1
  74. package/dist/services/vector-store/IExecutionTraceStore.d.ts +25 -0
  75. package/dist/services/vector-store/IExecutionTraceStore.d.ts.map +1 -0
  76. package/dist/services/vector-store/IExecutionTraceStore.js +2 -0
  77. package/dist/services/vector-store/IExecutionTraceStore.js.map +1 -0
  78. package/dist/services/vector-store/IVectorRecordStore.d.ts +58 -0
  79. package/dist/services/vector-store/IVectorRecordStore.d.ts.map +1 -0
  80. package/dist/services/vector-store/IVectorRecordStore.js +2 -0
  81. package/dist/services/vector-store/IVectorRecordStore.js.map +1 -0
  82. package/dist/services/vector-store/commit-retry.d.ts +21 -0
  83. package/dist/services/vector-store/commit-retry.d.ts.map +1 -0
  84. package/dist/services/vector-store/commit-retry.js +58 -0
  85. package/dist/services/vector-store/commit-retry.js.map +1 -0
  86. package/dist/services/vector-store/embedded-store-singleton.d.ts +12 -0
  87. package/dist/services/vector-store/embedded-store-singleton.d.ts.map +1 -0
  88. package/dist/services/vector-store/embedded-store-singleton.js +17 -0
  89. package/dist/services/vector-store/embedded-store-singleton.js.map +1 -0
  90. package/dist/services/vector-store/lancedb/LanceExecutionTraceStore.d.ts +28 -0
  91. package/dist/services/vector-store/lancedb/LanceExecutionTraceStore.d.ts.map +1 -0
  92. package/dist/services/vector-store/lancedb/LanceExecutionTraceStore.js +222 -0
  93. package/dist/services/vector-store/lancedb/LanceExecutionTraceStore.js.map +1 -0
  94. package/dist/services/vector-store/lancedb/LanceVectorRecordStore.d.ts +77 -0
  95. package/dist/services/vector-store/lancedb/LanceVectorRecordStore.d.ts.map +1 -0
  96. package/dist/services/vector-store/lancedb/LanceVectorRecordStore.js +136 -0
  97. package/dist/services/vector-store/lancedb/LanceVectorRecordStore.js.map +1 -0
  98. package/dist/services/vector-store/lancedb/lance-records-engine.d.ts +41 -0
  99. package/dist/services/vector-store/lancedb/lance-records-engine.d.ts.map +1 -0
  100. package/dist/services/vector-store/lancedb/lance-records-engine.js +102 -0
  101. package/dist/services/vector-store/lancedb/lance-records-engine.js.map +1 -0
  102. package/dist/services/vector-store/lancedb/lance-records-mutations.d.ts +22 -0
  103. package/dist/services/vector-store/lancedb/lance-records-mutations.d.ts.map +1 -0
  104. package/dist/services/vector-store/lancedb/lance-records-mutations.js +211 -0
  105. package/dist/services/vector-store/lancedb/lance-records-mutations.js.map +1 -0
  106. package/dist/services/vector-store/lancedb/lance-records-reads.d.ts +64 -0
  107. package/dist/services/vector-store/lancedb/lance-records-reads.d.ts.map +1 -0
  108. package/dist/services/vector-store/lancedb/lance-records-reads.js +237 -0
  109. package/dist/services/vector-store/lancedb/lance-records-reads.js.map +1 -0
  110. package/dist/services/vector-store/lancedb/lance-records-schema.d.ts +48 -0
  111. package/dist/services/vector-store/lancedb/lance-records-schema.d.ts.map +1 -0
  112. package/dist/services/vector-store/lancedb/lance-records-schema.js +159 -0
  113. package/dist/services/vector-store/lancedb/lance-records-schema.js.map +1 -0
  114. package/dist/services/vector-store/lancedb/lance-records-search.d.ts +30 -0
  115. package/dist/services/vector-store/lancedb/lance-records-search.d.ts.map +1 -0
  116. package/dist/services/vector-store/lancedb/lance-records-search.js +112 -0
  117. package/dist/services/vector-store/lancedb/lance-records-search.js.map +1 -0
  118. package/dist/services/vector-store/lancedb/lance-records-write-artifact.d.ts +11 -0
  119. package/dist/services/vector-store/lancedb/lance-records-write-artifact.d.ts.map +1 -0
  120. package/dist/services/vector-store/lancedb/lance-records-write-artifact.js +121 -0
  121. package/dist/services/vector-store/lancedb/lance-records-write-artifact.js.map +1 -0
  122. package/dist/services/vector-store/lancedb/lance-records-write-helpers.d.ts +52 -0
  123. package/dist/services/vector-store/lancedb/lance-records-write-helpers.d.ts.map +1 -0
  124. package/dist/services/vector-store/lancedb/lance-records-write-helpers.js +216 -0
  125. package/dist/services/vector-store/lancedb/lance-records-write-helpers.js.map +1 -0
  126. package/dist/services/vector-store/lancedb/lance-records-writes.d.ts +21 -0
  127. package/dist/services/vector-store/lancedb/lance-records-writes.d.ts.map +1 -0
  128. package/dist/services/vector-store/lancedb/lance-records-writes.js +294 -0
  129. package/dist/services/vector-store/lancedb/lance-records-writes.js.map +1 -0
  130. package/dist/services/vector-store/lancedb-connection.d.ts +12 -0
  131. package/dist/services/vector-store/lancedb-connection.d.ts.map +1 -0
  132. package/dist/services/vector-store/lancedb-connection.js +28 -0
  133. package/dist/services/vector-store/lancedb-connection.js.map +1 -0
  134. package/dist/services/vector-store/types.d.ts +85 -0
  135. package/dist/services/vector-store/types.d.ts.map +1 -0
  136. package/dist/services/vector-store/types.js +2 -0
  137. package/dist/services/vector-store/types.js.map +1 -0
  138. package/dist/tools/artifact-catalog.d.ts.map +1 -1
  139. package/dist/tools/artifact-catalog.js +6 -33
  140. package/dist/tools/artifact-catalog.js.map +1 -1
  141. package/dist/tools/search.d.ts.map +1 -1
  142. package/dist/tools/search.js +6 -20
  143. package/dist/tools/search.js.map +1 -1
  144. package/dist/tools/search_schema.d.ts +1 -1
  145. package/dist/tools/skill-export/enumerate-space-adapters.d.ts +1 -1
  146. package/dist/tools/skill-export/enumerate-space-adapters.d.ts.map +1 -1
  147. package/dist/tools/skill-export/enumerate-space-adapters.js +11 -27
  148. package/dist/tools/skill-export/enumerate-space-adapters.js.map +1 -1
  149. package/dist/tools/spaces.d.ts.map +1 -1
  150. package/dist/tools/spaces.js +2 -15
  151. package/dist/tools/spaces.js.map +1 -1
  152. package/dist/ui/assets/{AccountPage-B0ali9jz.js → AccountPage-BJm56sur.js} +1 -1
  153. package/dist/ui/assets/{ProtocolEditPage-DIySo-F_.js → ProtocolEditPage-mChBe3JY.js} +1 -1
  154. package/dist/ui/assets/{RichTextEditor-uun0UIVc.js → RichTextEditor-Bj6JxHM5.js} +1 -1
  155. package/dist/ui/assets/{SkillBundlePage-DtOlpupj.js → SkillBundlePage-D1OPKJzA.js} +1 -1
  156. package/dist/ui/assets/{index-BlCipoHI.js → index-PouLvU1c.js} +2 -2
  157. package/dist/ui/index.html +1 -1
  158. package/dist/utils/squadrules-user-dirs.d.ts +10 -0
  159. package/dist/utils/squadrules-user-dirs.d.ts.map +1 -1
  160. package/dist/utils/squadrules-user-dirs.js +12 -0
  161. package/dist/utils/squadrules-user-dirs.js.map +1 -1
  162. package/package.json +18 -11
@@ -1 +1 @@
1
- {"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../src/services/qdrant/service.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,SAAS,MAAM,uBAAuB,CAAC;AAQnD,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAItE,qBAAa,aAAa;IACxB,OAAO,CAAC,IAAI,CAAmB;gBAG7B,SAAS,GAAE,MAAuB,EAClC,MAAM,GAAE,MAAuB,EAC/B,cAAc,GAAE,MAA8B,EAC9C,UAAU,CAAC,EAAE,MAAM;IAQrB,IAAW,MAAM,IAAI,GAAG,CAEvB;IAED,IAAW,cAAc,IAAI,MAAM,CAElC;IAED,IAAW,SAAS,IAAI,MAAM,CAE7B;IAED,IAAW,MAAM,IAAI,MAAM,CAE1B;IAED,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAI3B,WAAW,CACT,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,IAAI,CAAC,EAAE,MAAM,EACb,IAAI,CAAC,EAAE,MAAM,EAAE,EACf,SAAS,CAAC,EAAE,MAAM,EAAE,EACpB,QAAQ,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,YAAY,GAAG,UAAU,CAAC;QAAC,YAAY,EAAE,OAAO,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE,EAC/I,IAAI,CAAC,EAAE,MAAM;;;IAKf,eAAe,CAAC,KAAK,EAAE,kBAAkB,EAAE,GAAG,OAAO,CAAC,oBAAo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MAAM;;;;;;;;;;;;IAI9D,iBAAiB,CAAC,MAAM,EAAE,MAAM;;;;;;;;;CAGjC;AAQD,eAAO,MAAM,aAAa,EAAE,aAE8B,CAAC"}
@@ -10,7 +10,8 @@ import * as protocol from './protocol.js';
10
10
  import * as listing from './listing.js';
11
11
  import * as rewardPropagation from './reward-propagation.js';
12
12
  import { logger } from '../../utils/structured-logger.js';
13
- import { getQdrantUrl, QDRANT_API_KEY, getQdrantCollection } from '../../config.js';
13
+ import { getQdrantUrl, QDRANT_API_KEY, getQdrantCollection, isQdrantConfigured } from '../../config.js';
14
+ import { getEmbeddedRecordStore } from '../vector-store/embedded-store-singleton.js';
14
15
  export class QdrantService {
15
16
  conn;
16
17
  constructor(qdrantUrl = getQdrantUrl(), apiKey = QDRANT_API_KEY, collectionName = getQdrantCollection(), caCertPath) {
@@ -103,5 +104,13 @@ export class QdrantService {
103
104
  return listing.getDomainOverview(this.conn, domain);
104
105
  }
105
106
  }
106
- export const qdrantService = new QdrantService();
107
+ // Backend-selected singleton. Constructing `QdrantService` resolves `getQdrantUrl()`
108
+ // (throws when `QDRANT_URL` is unset) and would crash import for the ~dozens of
109
+ // modules that reach for `qdrantService` even on the embedded path. So on the
110
+ // LanceDB path we hand them the shared embedded store double-cast to this shape —
111
+ // only the methods actually called at runtime must exist, and the integration
112
+ // suite is the gate that proves the used surface is covered.
113
+ export const qdrantService = isQdrantConfigured
114
+ ? new QdrantService()
115
+ : getEmbeddedRecordStore();
107
116
  //# sourceMappingURL=service.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"service.js","sourceRoot":"","sources":["../../../src/services/qdrant/service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,KAAK,IAAI,MAAM,qBAAqB,CAAC;AAC5C,OAAO,KAAK,KAAK,MAAM,mBAAmB,CAAC;AAC3C,OAAO,KAAK,SAAS,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,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,CAAC,IAAI,CAAC,CAAC;IACxC,CAAC;IAED,cAAc,CAAC,IAAY;QACzB,OAAO,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAC9C,CAAC;IAED,mBAAmB,CAAC,MAAc,EAAE,IAAY,EAAE,IAAY;QAC5D,OAAO,OAAO,CAAC,mBAAmB,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;IACpE,CAAC;IAED,iBAAiB,CAAC,MAAc;QAC9B,OAAO,OAAO,CAAC,iBAAiB,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACtD,CAAC;CACF;AAED,qFAAqF;AACrF,gFAAgF;AAChF,8EAA8E;AAC9E,kFAAkF;AAClF,8EAA8E;AAC9E,6DAA6D;AAC7D,MAAM,CAAC,MAAM,aAAa,GAAkB,kBAAkB;IAC5D,CAAC,CAAC,IAAI,aAAa,EAAE;IACrB,CAAC,CAAE,sBAAsB,EAA+B,CAAC"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Port: execution-trace persistence (no vectors).
3
+ *
4
+ * Signatures mirror the current `ExecutionTraceStore` exactly, so a Qdrant
5
+ * adapter can satisfy this by delegation with no behavior change while a
6
+ * LanceDB adapter maps the same calls onto its own storage.
7
+ */
8
+ import type { ExecutionTrace, RewardRecord, StartExecutionParams, StoredExecutionTrace, TrainingPair } from './types.js';
9
+ export interface IExecutionTraceStore {
10
+ /** Open (or re-open) an execution, preserving prior reward and traces. */
11
+ startExecution(params: StartExecutionParams): Promise<void>;
12
+ /** Append one layer trace to its execution. */
13
+ appendTrace(trace: ExecutionTrace): Promise<void>;
14
+ /** Attach a reward record to a completed execution. */
15
+ setReward(executionId: string, reward: RewardRecord): Promise<void>;
16
+ /** Read a full execution, or null when absent. */
17
+ getExecution(executionId: string): Promise<StoredExecutionTrace | null>;
18
+ /** List execution ids recorded for an adapter. */
19
+ listAdapterExecutions(adapterId: string): Promise<string[]>;
20
+ /** Build supervised-fine-tuning pairs for an adapter. */
21
+ buildTrainingPairsForAdapter(adapterId: string, includeReward?: boolean): Promise<TrainingPair[]>;
22
+ /** Delete an execution and its traces. */
23
+ deleteExecution(executionId: string): Promise<void>;
24
+ }
25
+ //# sourceMappingURL=IExecutionTraceStore.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IExecutionTraceStore.d.ts","sourceRoot":"","sources":["../../../src/services/vector-store/IExecutionTraceStore.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAEzH,MAAM,WAAW,oBAAoB;IACnC,0EAA0E;IAC1E,cAAc,CAAC,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE5D,+CAA+C;IAC/C,WAAW,CAAC,KAAK,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAElD,uDAAuD;IACvD,SAAS,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEpE,kDAAkD;IAClD,YAAY,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC,CAAC;IAExE,kDAAkD;IAClD,qBAAqB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAE5D,yDAAyD;IACzD,4BAA4B,CAAC,SAAS,EAAE,MAAM,EAAE,aAAa,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC,CAAC;IAElG,0CAA0C;IAC1C,eAAe,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACrD"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=IExecutionTraceStore.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IExecutionTraceStore.js","sourceRoot":"","sources":["../../../src/services/vector-store/IExecutionTraceStore.ts"],"names":[],"mappings":""}
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Port: memory / adapter / artifact record storage (the vector-bearing store).
3
+ *
4
+ * Split from `IExecutionTraceStore` (no vectors) so each backend implements
5
+ * focused capabilities rather than one wide god-interface. Records are the
6
+ * neutral `Memory`; layers are
7
+ * `LayerRecord` (id + payload), matching the shape the tune tools already read.
8
+ *
9
+ * Methods marked [delegated] map onto signatures already present on the
10
+ * injected `MemoryQdrantStore`. Methods marked [neutralize] are the target
11
+ * contract for callers that today reach for raw `getQdrantAccess()` or
12
+ * `QdrantService`; their return shapes mirror what those facades actually
13
+ * return today (outcome objects, `{uuid, payload}` layers) so migrating a
14
+ * caller is behavior-preserving and gated by the Qdrant integration suite.
15
+ */
16
+ import type { Memory } from './types.js';
17
+ import type { ArtifactResolveOutcome, GetMemoryOptions, LayerRecord, MemorySearchResult, SlugResolveOutcome, StoreAdapterOptions } from './types.js';
18
+ import type { StoreArtifactOptions } from '../memory/store-adapter.js';
19
+ export interface IVectorRecordStore {
20
+ init(): Promise<void>;
21
+ checkHealth(timeoutMs?: number): Promise<boolean>;
22
+ /** [delegated] Store an adapter chain as linked layer records. */
23
+ storeAdapter(docs: string[], llmModelId: string, options?: StoreAdapterOptions): Promise<Memory[]>;
24
+ /** [delegated] Store a single artifact document. */
25
+ storeArtifact(content: string, options: StoreArtifactOptions): Promise<Memory[]>;
26
+ /** [delegated] Read one memory by uuid; `fresh` bypasses the read cache. */
27
+ getMemory(memoryUuid: string, options?: GetMemoryOptions): Promise<Memory | null>;
28
+ /** [delegated] Semantic search over memory text. */
29
+ searchMemories(query: string, limit: number, collapse?: boolean): Promise<MemorySearchResult>;
30
+ /** Layers of one adapter, optionally widened across extra spaces. */
31
+ getAdapterLayers(adapterId: string, extraSpaceIds?: string[]): Promise<LayerRecord[]>;
32
+ /** Exact slug lookup of an adapter's first-layer entry point. */
33
+ findFirstStepMemoryUuidBySlug(slug: string): Promise<SlugResolveOutcome>;
34
+ /** Exact slug lookup of an artifact point (null when ambiguous). */
35
+ findArtifactMemoryUuidBySlug(slug: string): Promise<ArtifactResolveOutcome>;
36
+ /** Apply a payload patch to one memory (idempotent upsert of changed fields). */
37
+ updateMemory(memoryUuid: string, patch: Record<string, unknown>): Promise<void>;
38
+ /** Delete one memory by uuid. */
39
+ deleteMemory(memoryUuid: string): Promise<void>;
40
+ /** Every layer point in one space. `paginate` walks all pages. */
41
+ scrollSpace(spaceId: string, options?: {
42
+ paginate?: boolean;
43
+ limit?: number;
44
+ }): Promise<LayerRecord[]>;
45
+ /** Artifact layer points attached to an adapter, across searchable spaces. */
46
+ listAdapterArtifacts(adapterId: string): Promise<LayerRecord[]>;
47
+ /** First-layer footer points for the refining/creation protocol slugs. */
48
+ findProtocolFooterLayers(refineSlug: string, createSlug: string): Promise<LayerRecord[]>;
49
+ /** Protocol version already stored for an app-space adapter slug, or undefined. */
50
+ getStoredAdapterVersion(slug: string): Promise<string | undefined>;
51
+ /** Attach a payload patch (e.g. content hash) to a set of layer points. */
52
+ setPayloadOnLayers(layerIds: string[], patch: Record<string, unknown>): Promise<void>;
53
+ /** Delete app-space points matching a slug. */
54
+ deleteAppSpaceBySlug(slug: string): Promise<void>;
55
+ /** Delete app-space points matching an adapter id. */
56
+ deleteAppSpaceByAdapterId(adapterId: string): Promise<void>;
57
+ }
58
+ //# sourceMappingURL=IVectorRecordStore.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IVectorRecordStore.d.ts","sourceRoot":"","sources":["../../../src/services/vector-store/IVectorRecordStore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,KAAK,EACV,sBAAsB,EACtB,gBAAgB,EAChB,WAAW,E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AAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAChF,iCAAiC;IACjC,YAAY,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAGhD,kEAAkE;IAClE,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,OAAO,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC;IACvG,8EAA8E;IAC9E,oBAAoB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC;IAChE,0EAA0E;IAC1E,wBAAwB,CAAC,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC;IACzF,mFAAmF;IACnF,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IACnE,2EAA2E;IAC3E,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACtF,+CAA+C;IAC/C,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAClD,sDAAsD;IACtD,yBAAyB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC7D"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=IVectorRecordStore.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IVectorRecordStore.js","sourceRoot":"","sources":["../../../src/services/vector-store/IVectorRecordStore.ts"],"names":[],"mappings":""}
@@ -0,0 +1,21 @@
1
+ export interface CommitRetryOptions {
2
+ /** Total attempts including the first. Default 8. */
3
+ maxAttempts?: number;
4
+ /** Base backoff in ms (doubles per attempt). Default 20. */
5
+ baseDelayMs?: number;
6
+ /** Cap for the exponential term before jitter. Default 1000. */
7
+ maxDelayMs?: number;
8
+ }
9
+ /**
10
+ * True when an error looks like a Lance/LanceDB commit conflict (safe to retry)
11
+ * rather than a real failure. Matches the conflict/version wording emitted by
12
+ * the format; refine against exact SDK messages as the adapter lands.
13
+ */
14
+ export declare function isCommitConflictError(err: unknown): boolean;
15
+ /**
16
+ * Run `write`, retrying only commit conflicts with exponential backoff + jitter.
17
+ * `label` names the operation for debug logs. Throws the first non-conflict
18
+ * error immediately, and the last conflict error once attempts are exhausted.
19
+ */
20
+ export declare function withCommitRetry<T>(write: () => Promise<T>, label: string, options?: CommitRetryOptions): Promise<T>;
21
+ //# sourceMappingURL=commit-retry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"commit-retry.d.ts","sourceRoot":"","sources":["../../../src/services/vector-store/commit-retry.ts"],"names":[],"mappings":"AAYA,MAAM,WAAW,kBAAkB;IACjC,qDAAqD;IACrD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,4DAA4D;IAC5D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gEAAgE;IAChE,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAMD;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAK3D;AAYD;;;;GAIG;AACH,wBAAsB,eAAe,CAAC,CAAC,EACrC,KAAK,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EACvB,KAAK,EAAE,MAAM,EACb,OAAO,GAAE,kBAAuB,GAC/B,OAAO,CAAC,CAAC,CAAC,CAuBZ"}
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Bounded optimistic-concurrency retry for embedded vector-store commits.
3
+ *
4
+ * Lance/LanceDB use MVCC: concurrent writers to the same table version can
5
+ * conflict and the loser must re-read the latest manifest and re-issue the
6
+ * write. At the target scale (2-3 local processes) conflicts are rare, so this
7
+ * is a defensive layer, not the primary safety mechanism. Non-conflict errors
8
+ * are surfaced unchanged - a commit must never be silently dropped or routed to
9
+ * a different store.
10
+ */
11
+ import { logger } from '../../utils/structured-logger.js';
12
+ const DEFAULT_MAX_ATTEMPTS = 8;
13
+ const DEFAULT_BASE_DELAY_MS = 20;
14
+ const DEFAULT_MAX_DELAY_MS = 1000;
15
+ /**
16
+ * True when an error looks like a Lance/LanceDB commit conflict (safe to retry)
17
+ * rather than a real failure. Matches the conflict/version wording emitted by
18
+ * the format; refine against exact SDK messages as the adapter lands.
19
+ */
20
+ export function isCommitConflictError(err) {
21
+ const msg = err instanceof Error ? err.message : String(err);
22
+ return /commit conflict|version conflict|conflict during commit|committed version|compare-and-swap|\bCAS\b|transaction commit/i.test(msg);
23
+ }
24
+ function delayFor(attempt, baseMs, maxMs) {
25
+ const exp = Math.min(maxMs, baseMs * 2 ** attempt);
26
+ const jitter = Math.floor(Math.random() * (exp / 2));
27
+ return exp + jitter;
28
+ }
29
+ function sleep(ms) {
30
+ return new Promise((resolve) => setTimeout(resolve, ms));
31
+ }
32
+ /**
33
+ * Run `write`, retrying only commit conflicts with exponential backoff + jitter.
34
+ * `label` names the operation for debug logs. Throws the first non-conflict
35
+ * error immediately, and the last conflict error once attempts are exhausted.
36
+ */
37
+ export async function withCommitRetry(write, label, options = {}) {
38
+ const maxAttempts = options.maxAttempts ?? DEFAULT_MAX_ATTEMPTS;
39
+ const baseDelayMs = options.baseDelayMs ?? DEFAULT_BASE_DELAY_MS;
40
+ const maxDelayMs = options.maxDelayMs ?? DEFAULT_MAX_DELAY_MS;
41
+ for (let attempt = 0; attempt < maxAttempts; attempt++) {
42
+ try {
43
+ return await write();
44
+ }
45
+ catch (err) {
46
+ const lastAttempt = attempt === maxAttempts - 1;
47
+ if (!isCommitConflictError(err) || lastAttempt) {
48
+ throw err;
49
+ }
50
+ const waitMs = delayFor(attempt, baseDelayMs, maxDelayMs);
51
+ logger.debug(`[vector-store] commit conflict on "${label}" (attempt ${attempt + 1}/${maxAttempts}); retrying in ${waitMs}ms`);
52
+ await sleep(waitMs);
53
+ }
54
+ }
55
+ // Unreachable: the loop always returns or throws before exhausting attempts.
56
+ throw new Error(`withCommitRetry("${label}") exited without a result`);
57
+ }
58
+ //# sourceMappingURL=commit-retry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"commit-retry.js","sourceRoot":"","sources":["../../../src/services/vector-store/commit-retry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,kCAAkC,CAAC;AAW1D,MAAM,oBAAoB,GAAG,CAAC,CAAC;AAC/B,MAAM,qBAAqB,GAAG,EAAE,CAAC;AACjC,MAAM,oBAAoB,GAAG,IAAI,CAAC;AAElC;;;;GAIG;AACH,MAAM,UAAU,qBAAqB,CAAC,GAAY;IAChD,MAAM,GAAG,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IAC7D,OAAO,wHAAwH,CAAC,IAAI,CAClI,GAAG,CACJ,CAAC;AACJ,CAAC;AAED,SAAS,QAAQ,CAAC,OAAe,EAAE,MAAc,EAAE,KAAa;IAC9D,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,CAAC,IAAI,OAAO,CAAC,CAAC;IACnD,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;IACrD,OAAO,GAAG,GAAG,MAAM,CAAC;AACtB,CAAC;AAED,SAAS,KAAK,CAAC,EAAU;IACvB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;AAC3D,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,KAAuB,EACvB,KAAa,EACb,UAA8B,EAAE;IAEhC,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,IAAI,oBAAoB,CAAC;IAChE,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,IAAI,qBAAqB,CAAC;IACjE,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,IAAI,oBAAoB,CAAC;IAE9D,KAAK,IAAI,OAAO,GAAG,CAAC,EAAE,OAAO,GAAG,WAAW,EAAE,OAAO,EAAE,EAAE,CAAC;QACvD,IAAI,CAAC;YACH,OAAO,MAAM,KAAK,EAAE,CAAC;QACvB,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,MAAM,WAAW,GAAG,OAAO,KAAK,WAAW,GAAG,CAAC,CAAC;YAChD,IAAI,CAAC,qBAAqB,CAAC,GAAG,CAAC,IAAI,WAAW,EAAE,CAAC;gBAC/C,MAAM,GAAG,CAAC;YACZ,CAAC;YACD,MAAM,MAAM,GAAG,QAAQ,CAAC,OAAO,EAAE,WAAW,EAAE,UAAU,CAAC,CAAC;YAC1D,MAAM,CAAC,KAAK,CACV,sCAAsC,KAAK,cAAc,OAAO,GAAG,CAAC,IAAI,WAAW,kBAAkB,MAAM,IAAI,CAChH,CAAC;YACF,MAAM,KAAK,CAAC,MAAM,CAAC,CAAC;QACtB,CAAC;IACH,CAAC;IAED,6EAA6E;IAC7E,MAAM,IAAI,KAAK,CAAC,oBAAoB,KAAK,4BAA4B,CAAC,CAAC;AACzE,CAAC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Shared embedded record store.
3
+ *
4
+ * The embedded path injects ONE `LanceVectorRecordStore` into both the
5
+ * `memoryStore` (DI) and `qdrantService` (module singleton) slots, so they share
6
+ * a single Lance connection/engine and stay internally consistent (a write via
7
+ * one facade is visible through the other). Memoized here so both selectors
8
+ * resolve the same instance regardless of import order.
9
+ */
10
+ import { LanceVectorRecordStore } from './lancedb/LanceVectorRecordStore.js';
11
+ export declare function getEmbeddedRecordStore(): LanceVectorRecordStore;
12
+ //# sourceMappingURL=embedded-store-singleton.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"embedded-store-singleton.d.ts","sourceRoot":"","sources":["../../../src/services/vector-store/embedded-store-singleton.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAI7E,wBAAgB,sBAAsB,IAAI,sBAAsB,CAG/D"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Shared embedded record store.
3
+ *
4
+ * The embedded path injects ONE `LanceVectorRecordStore` into both the
5
+ * `memoryStore` (DI) and `qdrantService` (module singleton) slots, so they share
6
+ * a single Lance connection/engine and stay internally consistent (a write via
7
+ * one facade is visible through the other). Memoized here so both selectors
8
+ * resolve the same instance regardless of import order.
9
+ */
10
+ import { LanceVectorRecordStore } from './lancedb/LanceVectorRecordStore.js';
11
+ let instance = null;
12
+ export function getEmbeddedRecordStore() {
13
+ if (!instance)
14
+ instance = new LanceVectorRecordStore();
15
+ return instance;
16
+ }
17
+ //# sourceMappingURL=embedded-store-singleton.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"embedded-store-singleton.js","sourceRoot":"","sources":["../../../src/services/vector-store/embedded-store-singleton.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAE7E,IAAI,QAAQ,GAAkC,IAAI,CAAC;AAEnD,MAAM,UAAU,sBAAsB;IACpC,IAAI,CAAC,QAAQ;QAAE,QAAQ,GAAG,IAAI,sBAAsB,EAAE,CAAC;IACvD,OAAO,QAAQ,CAAC;AAClB,CAAC"}
@@ -0,0 +1,28 @@
1
+ import type { ExecutionTrace, RewardRecord } from '../../../types/memory.js';
2
+ import type { IExecutionTraceStore } from '../IExecutionTraceStore.js';
3
+ import type { StoredExecutionTrace, TrainingPair } from '../types.js';
4
+ export declare class LanceExecutionTraceStore implements IExecutionTraceStore {
5
+ private connectionPromise;
6
+ private readonly mutationChains;
7
+ private getConnection;
8
+ /** Open the trace table, or return null when nothing has been written yet. */
9
+ private openTableIfPresent;
10
+ /** Open-or-create the trace table from a first row (schema inferred from data). */
11
+ private ensureTableForWrite;
12
+ private toRow;
13
+ private persist;
14
+ private withMutationLock;
15
+ startExecution(params: {
16
+ executionId: string;
17
+ adapterId: string;
18
+ adapterUri: string;
19
+ activationQuery?: string;
20
+ }): Promise<void>;
21
+ appendTrace(trace: ExecutionTrace): Promise<void>;
22
+ setReward(executionId: string, reward: RewardRecord): Promise<void>;
23
+ getExecution(executionId: string): Promise<StoredExecutionTrace | null>;
24
+ listAdapterExecutions(adapterId: string): Promise<string[]>;
25
+ buildTrainingPairsForAdapter(adapterId: string, includeReward?: boolean): Promise<TrainingPair[]>;
26
+ deleteExecution(executionId: string): Promise<void>;
27
+ }
28
+ //# sourceMappingURL=LanceExecutionTraceStore.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LanceExecutionTraceStore.d.ts","sourceRoot":"","sources":["../../../../src/services/vector-store/lancedb/LanceExecutionTraceStore.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAE7E,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AACvE,OAAO,KAAK,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAkCtE,qBAAa,wBAAyB,YAAW,oBAAoB;IACnE,OAAO,CAAC,iBAAiB,CAAyC;IAClE,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAoC;IAEnE,OAAO,CAAC,aAAa;IAOrB,8EAA8E;YAChE,kBAAkB;IAOhC,mFAAmF;YACrE,mBAAmB;IASjC,OAAO,CAAC,KAAK;YASC,OAAO;YAcP,gBAAgB;IAmBxB,cAAc,CAAC,MAAM,EAAE;QAC3B,WAAW,EAAE,MAAM,CAAC;QACpB,SAAS,EAAE,MAAM,CAAC;QAClB,UAAU,EAAE,MAAM,CAAC;QACnB,eAAe,CAAC,EAAE,MAAM,CAAC;KAC1B,GAAG,OAAO,CAAC,IAAI,CAAC;IAsBX,WAAW,CAAC,KAAK,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IA0BjD,SAAS,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAWnE,YAAY,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC;IAmBvE,qBAAqB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAW3D,4BAA4B,CAAC,SAAS,EAAE,MAAM,EAAE,aAAa,GAAE,OAAc,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC;IA+BvG,eAAe,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAU1D"}
@@ -0,0 +1,222 @@
1
+ /**
2
+ * LanceDB implementation of the execution-trace port (`IExecutionTraceStore`).
3
+ *
4
+ * Traces carry no vectors, so this is the simplest backend slice: one row per
5
+ * execution, keyed by a stable id, with the whole `StoredExecutionTrace` kept as
6
+ * a JSON string. Reads that run before any write treat the absent table as empty
7
+ * rather than creating it, so a cold start never touches the disk for a read.
8
+ *
9
+ * The in-process per-execution mutation lock mirrors `ExecutionTraceStore` so
10
+ * concurrent forwards in this process serialize exactly as the Qdrant path does;
11
+ * cross-process durability comes from the SDK's MVCC plus `withCommitRetry`.
12
+ */
13
+ import crypto from 'node:crypto';
14
+ import { logger } from '../../../utils/structured-logger.js';
15
+ import { openLanceConnection } from '../lancedb-connection.js';
16
+ import { withCommitRetry } from '../commit-retry.js';
17
+ const TRACE_TABLE = 'execution_traces';
18
+ const UUID_REGEX = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
19
+ /** Stable primary key for an execution: reuse UUIDs, hash anything else to a UUID shape. */
20
+ function toRowId(executionId) {
21
+ if (UUID_REGEX.test(executionId))
22
+ return executionId;
23
+ return crypto
24
+ .createHash('md5')
25
+ .update(executionId)
26
+ .digest('hex')
27
+ .replace(/^(.{8})(.{4})(.{4})(.{4})(.{12})$/, '$1-$2-$3-$4-$5');
28
+ }
29
+ /** Escape a string for a LanceQL equality literal. */
30
+ function sqlLiteral(value) {
31
+ return `'${value.replace(/'/g, "''")}'`;
32
+ }
33
+ function adapterIdFromUri(adapterUri) {
34
+ return adapterUri.split('/').pop() ?? adapterUri;
35
+ }
36
+ export class LanceExecutionTraceStore {
37
+ connectionPromise = null;
38
+ mutationChains = new Map();
39
+ getConnection() {
40
+ if (!this.connectionPromise) {
41
+ this.connectionPromise = openLanceConnection();
42
+ }
43
+ return this.connectionPromise;
44
+ }
45
+ /** Open the trace table, or return null when nothing has been written yet. */
46
+ async openTableIfPresent() {
47
+ const connection = await this.getConnection();
48
+ const names = await connection.tableNames();
49
+ if (!names.includes(TRACE_TABLE))
50
+ return null;
51
+ return connection.openTable(TRACE_TABLE);
52
+ }
53
+ /** Open-or-create the trace table from a first row (schema inferred from data). */
54
+ async ensureTableForWrite(firstRow) {
55
+ const connection = await this.getConnection();
56
+ const names = await connection.tableNames();
57
+ if (names.includes(TRACE_TABLE)) {
58
+ return connection.openTable(TRACE_TABLE);
59
+ }
60
+ return connection.createTable(TRACE_TABLE, [firstRow], { mode: 'create' });
61
+ }
62
+ toRow(data) {
63
+ return {
64
+ id: toRowId(data.execution_id),
65
+ execution_id: data.execution_id,
66
+ adapter_id: data.adapter_id,
67
+ data: JSON.stringify(data)
68
+ };
69
+ }
70
+ async persist(data) {
71
+ const row = this.toRow(data);
72
+ const table = await this.ensureTableForWrite(row);
73
+ await withCommitRetry(() => table
74
+ .mergeInsert('id')
75
+ .whenMatchedUpdateAll()
76
+ .whenNotMatchedInsertAll()
77
+ .execute([row]), `trace:${data.execution_id}`);
78
+ }
79
+ async withMutationLock(key, task) {
80
+ const previous = this.mutationChains.get(key) ?? Promise.resolve();
81
+ let release;
82
+ const gate = new Promise((resolve) => {
83
+ release = resolve;
84
+ });
85
+ const next = previous.catch(() => undefined).then(() => gate);
86
+ this.mutationChains.set(key, next);
87
+ await previous.catch(() => undefined);
88
+ try {
89
+ return await task();
90
+ }
91
+ finally {
92
+ release?.();
93
+ if (this.mutationChains.get(key) === next) {
94
+ this.mutationChains.delete(key);
95
+ }
96
+ }
97
+ }
98
+ async startExecution(params) {
99
+ const { executionId, adapterId, adapterUri, activationQuery } = params;
100
+ await this.withMutationLock(`execution:${executionId}`, async () => {
101
+ const existing = await this.getExecution(executionId);
102
+ const resolvedActivationQuery = activationQuery ?? existing?.activation_query;
103
+ if (existing && existing.adapter_id !== adapterId) {
104
+ throw new Error(`Execution ${executionId} already belongs to adapter ${existing.adapter_id}; refusing to reassign it to ${adapterId}`);
105
+ }
106
+ const stored = {
107
+ execution_id: executionId,
108
+ adapter_id: adapterId,
109
+ adapter_uri: adapterUri,
110
+ ...(resolvedActivationQuery ? { activation_query: resolvedActivationQuery } : {}),
111
+ ...(existing?.reward ? { reward: existing.reward } : {}),
112
+ traces: existing?.traces ?? []
113
+ };
114
+ await this.persist(stored);
115
+ });
116
+ }
117
+ async appendTrace(trace) {
118
+ const adapterId = adapterIdFromUri(trace.adapter_uri);
119
+ await this.withMutationLock(`execution:${trace.execution_id}`, async () => {
120
+ const existing = await this.getExecution(trace.execution_id);
121
+ if (existing && existing.adapter_uri !== trace.adapter_uri) {
122
+ throw new Error(`Execution ${trace.execution_id} already points at ${existing.adapter_uri}; refusing to append a trace for ${trace.adapter_uri}`);
123
+ }
124
+ const stored = existing ?? {
125
+ execution_id: trace.execution_id,
126
+ adapter_id: adapterId,
127
+ adapter_uri: trace.adapter_uri,
128
+ ...(trace.activation_query ? { activation_query: trace.activation_query } : {}),
129
+ traces: []
130
+ };
131
+ const key = `${trace.layer_index}:${trace.layer_uri}`;
132
+ const tracesByKey = new Map(stored.traces.map((t) => [`${t.layer_index}:${t.layer_uri}`, t]));
133
+ tracesByKey.set(key, trace);
134
+ await this.persist({
135
+ ...stored,
136
+ traces: Array.from(tracesByKey.values()).sort((a, b) => a.layer_index - b.layer_index)
137
+ });
138
+ });
139
+ }
140
+ async setReward(executionId, reward) {
141
+ await this.withMutationLock(`execution:${executionId}`, async () => {
142
+ const existing = await this.getExecution(executionId);
143
+ if (!existing) {
144
+ logger.warn(`[LanceExecutionTraceStore] Skipping reward for missing execution ${executionId}`);
145
+ return;
146
+ }
147
+ await this.persist({ ...existing, reward });
148
+ });
149
+ }
150
+ async getExecution(executionId) {
151
+ const table = await this.openTableIfPresent();
152
+ if (!table)
153
+ return null;
154
+ const rows = (await table
155
+ .query()
156
+ .where(`execution_id = ${sqlLiteral(executionId)}`)
157
+ .limit(1)
158
+ .toArray());
159
+ const row = rows[0];
160
+ if (!row)
161
+ return null;
162
+ try {
163
+ const parsed = JSON.parse(row.data);
164
+ parsed.traces = (parsed.traces ?? []).sort((a, b) => a.layer_index - b.layer_index);
165
+ return parsed;
166
+ }
167
+ catch {
168
+ return null;
169
+ }
170
+ }
171
+ async listAdapterExecutions(adapterId) {
172
+ const table = await this.openTableIfPresent();
173
+ if (!table)
174
+ return [];
175
+ const rows = (await table
176
+ .query()
177
+ .where(`adapter_id = ${sqlLiteral(adapterId)}`)
178
+ .select(['execution_id'])
179
+ .toArray());
180
+ return rows.map((row) => row.execution_id).filter(Boolean);
181
+ }
182
+ async buildTrainingPairsForAdapter(adapterId, includeReward = true) {
183
+ const executionIds = await this.listAdapterExecutions(adapterId);
184
+ const pairs = [];
185
+ for (const executionId of executionIds) {
186
+ const execution = await this.getExecution(executionId);
187
+ if (!execution)
188
+ continue;
189
+ for (const trace of execution.traces) {
190
+ pairs.push({
191
+ id: `${execution.execution_id}:${trace.layer_index}`,
192
+ execution_id: execution.execution_id,
193
+ adapter_uri: execution.adapter_uri,
194
+ layer_uri: trace.layer_uri,
195
+ layer_index: trace.layer_index,
196
+ timestamp: trace.created_at,
197
+ instruction: {
198
+ tensor_in: trace.tensor_in,
199
+ ...(execution.activation_query ? { activation_query: execution.activation_query } : {}),
200
+ layer_instructions: trace.layer_instructions ?? ''
201
+ },
202
+ response: {
203
+ ...(trace.tensor_out ? { tensor_out: trace.tensor_out } : {}),
204
+ ...(trace.trace ? { trace: trace.trace } : {}),
205
+ ...(trace.raw_solution !== undefined ? { raw_solution: trace.raw_solution } : {})
206
+ },
207
+ ...(includeReward && execution.reward ? { reward: execution.reward } : {})
208
+ });
209
+ }
210
+ }
211
+ return pairs.sort((a, b) => a.timestamp.localeCompare(b.timestamp));
212
+ }
213
+ async deleteExecution(executionId) {
214
+ await this.withMutationLock(`execution:${executionId}`, async () => {
215
+ const table = await this.openTableIfPresent();
216
+ if (!table)
217
+ return;
218
+ await withCommitRetry(() => table.delete(`id = ${sqlLiteral(toRowId(executionId))}`), `trace-delete:${executionId}`);
219
+ });
220
+ }
221
+ }
222
+ //# sourceMappingURL=LanceExecutionTraceStore.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LanceExecutionTraceStore.js","sourceRoot":"","sources":["../../../../src/services/vector-store/lancedb/LanceExecutionTraceStore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,MAAM,MAAM,aAAa,CAAC;AAEjC,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAG7D,OAAO,EAAE,mBAAmB,EAAyC,MAAM,0BAA0B,CAAC;AACtG,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,MAAM,WAAW,GAAG,kBAAkB,CAAC;AACvC,MAAM,UAAU,GAAG,iEAAiE,CAAC;AAErF,4FAA4F;AAC5F,SAAS,OAAO,CAAC,WAAmB;IAClC,IAAI,UAAU,CAAC,IAAI,CAAC,WAA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