@ponraaj/dimple-sdk 0.0.0-alpha.1 → 0.0.0-alpha.11
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/README.md +99 -0
- package/dist/dimple.d.ts +116 -5
- package/dist/errors.d.ts +24 -2
- package/dist/errors.js +8218 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.js +3584 -1999
- package/dist/indexer.d.ts +9 -0
- package/dist/internal/config/index.d.ts +1 -1
- package/dist/internal/config/schema.d.ts +87 -0
- package/dist/internal/config/service.d.ts +4 -0
- package/dist/internal/core/core.d.ts +8 -8
- package/dist/internal/core/hosted-embedding.d.ts +33 -0
- package/dist/internal/core/index.d.ts +6 -0
- package/dist/internal/core/layer.d.ts +17 -8
- package/dist/internal/embedder/auto-install.d.ts +28 -0
- package/dist/internal/embedder/index.d.ts +2 -3
- package/dist/internal/embedder/registry.d.ts +7 -0
- package/dist/internal/embedder/transformers.d.ts +40 -2
- package/dist/internal/extractor/code-extractor.d.ts +11 -1
- package/dist/internal/extractor/index.d.ts +1 -1
- package/dist/internal/extractor/languages/index.d.ts +1 -1
- package/dist/internal/extractor/languages/javascript.d.ts +1 -1
- package/dist/internal/extractor/languages/typescript.d.ts +1 -1
- package/dist/internal/extractor/models/extraction.d.ts +14 -0
- package/dist/internal/installer/index.d.ts +37 -0
- package/dist/internal/llm/dream-classifier.d.ts +1 -1
- package/dist/internal/llm/index.d.ts +1 -1
- package/dist/internal/llm/service.d.ts +7 -1
- package/dist/internal/logger/index.d.ts +1 -1
- package/dist/internal/logger/service.d.ts +44 -14
- package/dist/internal/logger/types.d.ts +15 -3
- package/dist/internal/parser/code-parser.d.ts +12 -2
- package/dist/internal/parser/index.d.ts +3 -3
- package/dist/internal/parser/language-store.d.ts +3 -3
- package/dist/internal/parser/tree-sitter-engine.d.ts +1 -1
- package/dist/internal/retriever/hybrid.d.ts +21 -7
- package/dist/internal/retriever/index.d.ts +1 -1
- package/dist/internal/shared/effect/node.d.ts +155 -0
- package/dist/internal/shared/file-database.d.ts +17 -0
- package/dist/internal/shared/file-lock.d.ts +20 -0
- package/dist/internal/shared/schema/defaults.d.ts +13 -0
- package/dist/internal/store/audit.d.ts +8 -2
- package/dist/internal/store/db-backend.d.ts +48 -10
- package/dist/internal/store/graph/candidates.d.ts +3 -1
- package/dist/internal/store/graph/concepts.d.ts +16 -7
- package/dist/internal/store/graph/dream.d.ts +9 -3
- package/dist/internal/store/graph/errors.d.ts +1 -1
- package/dist/internal/store/graph/repair.d.ts +9 -3
- package/dist/internal/store/graph/traversal.d.ts +1 -1
- package/dist/internal/store/index.d.ts +4 -3
- package/dist/internal/store/libsql-backend.d.ts +1 -1
- package/dist/internal/store/models.d.ts +4 -3
- package/dist/internal/store/schema/graph.d.ts +7 -7
- package/dist/internal/store/schema/libsql.d.ts +4 -4
- package/dist/internal/store/schema/metadata.d.ts +4 -1
- package/dist/internal/store/schema/topics.d.ts +0 -12
- package/dist/internal/store/service.d.ts +85 -5
- package/dist/internal/store/store.d.ts +24 -5
- package/dist/internal/store/topics/errors.d.ts +1 -1
- package/dist/internal/store/topics/jobs.d.ts +9 -3
- package/dist/internal/store/topics/lifecycle.d.ts +9 -3
- package/dist/internal/store/topics/maintenance.d.ts +10 -4
- package/dist/internal/store/topics/query.d.ts +1 -1
- package/dist/internal/store/topics/routing.d.ts +34 -1
- package/dist/internal/store/topics/topic-vectors.d.ts +11 -4
- package/dist/internal/store/topics/tree.d.ts +15 -9
- package/dist/internal/workflow/engine.d.ts +27 -3
- package/dist/internal/workflow/executor.d.ts +20 -6
- package/dist/internal/workflow/index.d.ts +4 -4
- package/dist/internal/workflow/persistence.d.ts +3 -3
- package/dist/internal/workflow/queue.d.ts +8 -5
- package/dist/internal/workflow/registry.d.ts +11 -1
- package/dist/internal/workflow/runtime.d.ts +22 -4
- package/dist/internal/workflow/signals.d.ts +21 -0
- package/dist/make.d.ts +27 -0
- package/package.json +34 -10
- package/dist/internal/embedder/openai.d.ts +0 -8
- package/dist/internal/wasm/grammar-store.d.ts +0 -14
- package/dist/internal/wasm/index.d.ts +0 -5
- package/dist/internal/wasm/wasm-cache.d.ts +0 -17
- package/dist/internal/wasm/wasm-downloader.d.ts +0 -10
- package/dist/internal/wasm/wasm-registry.d.ts +0 -16
- package/dist/internal/workflow/queue-store.d.ts +0 -5
|
@@ -39,8 +39,8 @@
|
|
|
39
39
|
* the active model stays 384-dim.
|
|
40
40
|
*/
|
|
41
41
|
import { Effect } from "effect";
|
|
42
|
-
import { JobFailure, type Handler, type JobContext } from "
|
|
43
|
-
import type { EmbeddingModelConfig } from "
|
|
42
|
+
import { JobFailure, type Handler, type JobContext } from "../../workflow/index.js";
|
|
43
|
+
import type { EmbeddingModelConfig } from "../../config/index.js";
|
|
44
44
|
import { Service as DbBackend } from "../db-backend.ts";
|
|
45
45
|
import type { Interface as DbBackendInterface } from "../db-backend.ts";
|
|
46
46
|
import { StoreError } from "../error.ts";
|
|
@@ -78,10 +78,13 @@ export declare const farthestPointSeeds: (vectors: readonly Float32Array[], k: n
|
|
|
78
78
|
* vectors themselves — the initial assignment is nearest-seed, not
|
|
79
79
|
* seed-region).
|
|
80
80
|
*/
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
81
|
+
/** Outcome of the k-means refinement — per-vector group assignment plus
|
|
82
|
+
* the final centroids. */
|
|
83
|
+
export interface KGroupResult {
|
|
84
|
+
readonly groups: Uint32Array;
|
|
85
|
+
readonly centroids: readonly Float32Array[];
|
|
86
|
+
}
|
|
87
|
+
export declare const kGroupLloyd: (vectors: readonly Float32Array[], seeds: readonly number[], passes: number) => KGroupResult;
|
|
85
88
|
/** Result of {@link clusterMembers}: per-vector group assignment + centroids. */
|
|
86
89
|
export interface ClusterResult {
|
|
87
90
|
/** `groups[i]` = the group of `vectors[i]` (caller index space). */
|
|
@@ -146,8 +149,14 @@ export interface ConceptClusterHandlerDeps {
|
|
|
146
149
|
/** Backend captured at registration (see {@link topicSplitHandler}). */
|
|
147
150
|
readonly backend?: DbBackendInterface;
|
|
148
151
|
}
|
|
152
|
+
/** The decoded `concept.cluster` payload — mirrors the queue definition's
|
|
153
|
+
* schema (`{ modelKey, topicKey? }`); the executor decodes before calling. */
|
|
154
|
+
export interface ConceptClusterPayload {
|
|
155
|
+
readonly modelKey: string;
|
|
156
|
+
readonly topicKey?: string;
|
|
157
|
+
}
|
|
149
158
|
/** The `concept.cluster` handler shape (see jobs.ts). */
|
|
150
|
-
export type ConceptClusterHandler = (payload:
|
|
159
|
+
export type ConceptClusterHandler = (payload: ConceptClusterPayload, ctx: JobContext) => Effect.Effect<unknown, JobFailure, DbBackend>;
|
|
151
160
|
/**
|
|
152
161
|
* Factory for the `concept.cluster` job handler. Two modes, selected by the
|
|
153
162
|
* payload:
|
|
@@ -58,8 +58,8 @@
|
|
|
58
58
|
* Effect Clock (observability only).
|
|
59
59
|
*/
|
|
60
60
|
import { Effect } from "effect";
|
|
61
|
-
import { JobFailure, type Handler, type JobContext } from "
|
|
62
|
-
import type { EmbeddingModelConfig } from "
|
|
61
|
+
import { JobFailure, type Handler, type JobContext } from "../../workflow/index.js";
|
|
62
|
+
import type { EmbeddingModelConfig } from "../../config/index.js";
|
|
63
63
|
import { Service as DbBackend } from "../db-backend.ts";
|
|
64
64
|
import type { Interface as DbBackendInterface } from "../db-backend.ts";
|
|
65
65
|
/** One memory pair judged by the classifier (older first — the direction
|
|
@@ -145,8 +145,14 @@ export interface DreamHandlerDeps {
|
|
|
145
145
|
/** Backend captured at registration (see {@link topicSplitHandler}). */
|
|
146
146
|
readonly backend?: DbBackendInterface;
|
|
147
147
|
}
|
|
148
|
+
/** The decoded `memory.dream` payload — mirrors the queue definition's
|
|
149
|
+
* schema (`{ modelKey, runId? }`); the executor decodes before calling. */
|
|
150
|
+
export interface DreamPayload {
|
|
151
|
+
readonly modelKey: string;
|
|
152
|
+
readonly runId?: string;
|
|
153
|
+
}
|
|
148
154
|
/** The `memory.dream` handler shape (see jobs.ts). */
|
|
149
|
-
export type DreamHandler = (payload:
|
|
155
|
+
export type DreamHandler = (payload: DreamPayload, ctx: JobContext) => Effect.Effect<unknown, JobFailure, DbBackend>;
|
|
150
156
|
/**
|
|
151
157
|
* Factory for the `memory.dream` job handler. Payload: `{ modelKey }`.
|
|
152
158
|
* Runs the four phases (orient → gather → consolidate → prune) for that
|
|
@@ -4,7 +4,7 @@ declare const EdgeNotFound_base: Schema.Class<EdgeNotFound, Schema.TaggedStruct<
|
|
|
4
4
|
}>, import("effect/Cause").YieldableError>;
|
|
5
5
|
/**
|
|
6
6
|
* Graph error types (mirror of `topics/errors.ts`). Each distinct failure
|
|
7
|
-
* mode gets its own `Schema.
|
|
7
|
+
* mode gets its own `Schema.TaggedError` so callers can `catchTag`
|
|
8
8
|
* precisely; they ride the public `Store` error channel alongside
|
|
9
9
|
* `StoreError`.
|
|
10
10
|
*/
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
* simply finds nothing to fix).
|
|
39
39
|
*/
|
|
40
40
|
import { Effect } from "effect";
|
|
41
|
-
import { JobFailure, type Handler, type JobContext } from "
|
|
42
|
-
import type { EmbeddingModelConfig } from "
|
|
41
|
+
import { JobFailure, type Handler, type JobContext } from "../../workflow/index.js";
|
|
42
|
+
import type { EmbeddingModelConfig } from "../../config/index.js";
|
|
43
43
|
import { Service as DbBackend } from "../db-backend.ts";
|
|
44
44
|
import type { Interface as DbBackendInterface } from "../db-backend.ts";
|
|
45
45
|
/** How many rows of each class one repair pass fixed. */
|
|
@@ -64,7 +64,13 @@ export interface GraphRepairHandlerDeps {
|
|
|
64
64
|
readonly expiredGraceMs?: number;
|
|
65
65
|
}
|
|
66
66
|
/** The `graph.repair` handler shape (see jobs.ts). */
|
|
67
|
-
|
|
67
|
+
/** The decoded `graph.repair` payload — mirrors the queue definition's
|
|
68
|
+
* schema (`{ modelKey, runId? }`); the executor decodes before calling. */
|
|
69
|
+
export interface RepairPayload {
|
|
70
|
+
readonly modelKey: string;
|
|
71
|
+
readonly runId?: string;
|
|
72
|
+
}
|
|
73
|
+
export type GraphRepairHandler = (payload: RepairPayload, ctx: JobContext) => Effect.Effect<unknown, JobFailure, DbBackend>;
|
|
68
74
|
/**
|
|
69
75
|
* Factory for the `graph.repair` job handler. Payload: `{ modelKey }`.
|
|
70
76
|
* Validates the model key, then runs the repair transaction: orphaned
|
|
@@ -36,4 +36,4 @@ export interface GraphNeighborRow extends Schema.Schema.Type<typeof GraphNeighbo
|
|
|
36
36
|
* does not match — the backend owns the query, so a mismatch is a real bug,
|
|
37
37
|
* not a runtime condition.
|
|
38
38
|
*/
|
|
39
|
-
export declare const fromNeighborRows: (rows: readonly
|
|
39
|
+
export declare const fromNeighborRows: (rows: readonly unknown[]) => readonly GraphNeighborRow[];
|
|
@@ -5,6 +5,7 @@ export { topics };
|
|
|
5
5
|
export { auditWriteHandler, type AuditWriteHandler } from "./audit.ts";
|
|
6
6
|
export { TopicConfig } from "./schema/topics.ts";
|
|
7
7
|
export type { AddEdgeInput, ExplainResult } from "./service.ts";
|
|
8
|
+
export type { ArtifactEdge, EdgeKind, EdgeSource } from "./schema/graph.ts";
|
|
8
9
|
export type { TopicHealth } from "./topics/observability.ts";
|
|
9
10
|
export type { TopicConfig as TopicConfigType } from "./schema/topics.ts";
|
|
10
11
|
export type { RetrievalAuditRow } from "./models.ts";
|
|
@@ -27,12 +28,12 @@ export { Service as DbBackend, type DrizzleDB } from "./db-backend.ts";
|
|
|
27
28
|
export { Service as Store } from "./service.ts";
|
|
28
29
|
export * from "./models.ts";
|
|
29
30
|
export { layer as dbBackendLayer, layerConfig as dbBackendLayerConfig, layerFromConfig as dbBackendLayerFromConfig, } from "./libsql-backend.ts";
|
|
30
|
-
export { layer as storeLayer, layerConfig as storeLayerConfig, layerFromConfig as storeLayerFromConfig, } from "./store.ts";
|
|
31
|
+
export { layer as storeLayer, layerConfig as storeLayerConfig, layerFromConfig as storeLayerFromConfig, configured as storeConfigured, node as storeNode, } from "./store.ts";
|
|
31
32
|
export declare const layer: (url: string, options?: {
|
|
32
33
|
migrationFolder?: string;
|
|
33
|
-
}) => import("effect/Layer").Layer<import("
|
|
34
|
+
}) => import("effect/Layer").Layer<import("../logger/index.js").Logging | import("./db-backend.ts").Service | import("./service.ts").Service, import("./error.ts").StoreError, never>;
|
|
34
35
|
export declare const layerConfig: (config: Config.Wrap<{
|
|
35
36
|
url: string;
|
|
36
37
|
}>, options?: {
|
|
37
38
|
migrationFolder?: string;
|
|
38
|
-
}) => import("effect/Layer").Layer<import("
|
|
39
|
+
}) => import("effect/Layer").Layer<import("../logger/index.js").Logging | import("./db-backend.ts").Service | import("./service.ts").Service, Config.ConfigError | import("./error.ts").StoreError, never>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Layer, Config, Scope } from "effect";
|
|
2
2
|
import { StoreError } from "./error.ts";
|
|
3
3
|
import { Service } from "./db-backend.ts";
|
|
4
|
-
import { Service as ConfigService } from "
|
|
4
|
+
import { Service as ConfigService } from "../config/index.js";
|
|
5
5
|
export declare const layer: (url: string, options?: {
|
|
6
6
|
migrationFolder?: string;
|
|
7
7
|
releaseClient?: boolean;
|
|
@@ -11,7 +11,7 @@ export declare const MemoryUnit: Schema.Struct<{
|
|
|
11
11
|
readonly contentType: Schema.String;
|
|
12
12
|
readonly state: Schema.Literals<readonly ["active", "superseded", "archived", "forgotten"]>;
|
|
13
13
|
readonly createdAt: Schema.Number;
|
|
14
|
-
readonly ttlSecs: Schema.Number
|
|
14
|
+
readonly ttlSecs: Schema.NullOr<Schema.Number>;
|
|
15
15
|
readonly namespace: Schema.String;
|
|
16
16
|
readonly metadata: Schema.optional<Schema.String>;
|
|
17
17
|
readonly embedding: Schema.optional<Schema.$Array<Schema.Number>>;
|
|
@@ -24,7 +24,7 @@ export declare const WriteMemoryInput: Schema.Struct<{
|
|
|
24
24
|
readonly content: Schema.String;
|
|
25
25
|
readonly contentType: Schema.optional<Schema.String>;
|
|
26
26
|
readonly namespace: Schema.optional<Schema.String>;
|
|
27
|
-
readonly ttlSecs: Schema.optional<Schema.Number
|
|
27
|
+
readonly ttlSecs: Schema.optional<Schema.NullOr<Schema.Number>>;
|
|
28
28
|
readonly metadata: Schema.optional<Schema.String>;
|
|
29
29
|
/** Typed overlay merged INTO the raw metadata blob on write (unknown blob
|
|
30
30
|
* keys preserved. Takes precedence over `metadata`. */
|
|
@@ -38,6 +38,7 @@ export declare const WriteMemoryInput: Schema.Struct<{
|
|
|
38
38
|
readonly confidence: Schema.Number;
|
|
39
39
|
readonly affordances: Schema.$Array<Schema.String>;
|
|
40
40
|
readonly language: Schema.optional<Schema.String>;
|
|
41
|
+
readonly codeVersion: Schema.optional<Schema.String>;
|
|
41
42
|
readonly pinned: Schema.optional<Schema.Boolean>;
|
|
42
43
|
}>>;
|
|
43
44
|
}>;
|
|
@@ -51,7 +52,7 @@ export declare const ScoredMemory: Schema.Struct<{
|
|
|
51
52
|
readonly contentType: Schema.String;
|
|
52
53
|
readonly state: Schema.Literals<readonly ["active", "superseded", "archived", "forgotten"]>;
|
|
53
54
|
readonly createdAt: Schema.Number;
|
|
54
|
-
readonly ttlSecs: Schema.Number
|
|
55
|
+
readonly ttlSecs: Schema.NullOr<Schema.Number>;
|
|
55
56
|
readonly namespace: Schema.String;
|
|
56
57
|
readonly metadata: Schema.optional<Schema.String>;
|
|
57
58
|
readonly embedding: Schema.optional<Schema.$Array<Schema.Number>>;
|
|
@@ -74,14 +74,14 @@ export declare const artifactEdges: import("drizzle-orm/sqlite-core").SQLiteTabl
|
|
|
74
74
|
name: string;
|
|
75
75
|
tableName: "artifact_edges";
|
|
76
76
|
dataType: "string enum";
|
|
77
|
-
data: "memory_contradicts" | "memory_supersedes" | "memory_supports";
|
|
77
|
+
data: "code_calls" | "memory_contradicts" | "memory_supersedes" | "memory_supports";
|
|
78
78
|
driverParam: string;
|
|
79
79
|
notNull: true;
|
|
80
80
|
hasDefault: false;
|
|
81
81
|
isPrimaryKey: false;
|
|
82
82
|
isAutoincrement: false;
|
|
83
83
|
hasRuntimeDefault: false;
|
|
84
|
-
enumValues: ["memory_supports", "memory_supersedes", "memory_contradicts"];
|
|
84
|
+
enumValues: ["memory_supports", "memory_supersedes", "memory_contradicts", "code_calls"];
|
|
85
85
|
baseColumn: never;
|
|
86
86
|
identity: undefined;
|
|
87
87
|
generated: undefined;
|
|
@@ -218,7 +218,7 @@ export declare const artifactEdges: import("drizzle-orm/sqlite-core").SQLiteTabl
|
|
|
218
218
|
dialect: 'sqlite';
|
|
219
219
|
}>;
|
|
220
220
|
/** The memory↔memory edge kinds `artifact_edges` can hold (the only kinds in the lean table). */
|
|
221
|
-
export type EdgeKind = "memory_supports" | "memory_supersedes" | "memory_contradicts";
|
|
221
|
+
export type EdgeKind = "memory_supports" | "memory_supersedes" | "memory_contradicts" | "code_calls";
|
|
222
222
|
/** Writers of edges (provenance on every row). */
|
|
223
223
|
export type EdgeSource = "rule" | "llm" | "agent";
|
|
224
224
|
export declare const ArtifactEdgeInsert: import("drizzle-orm/effect-schema").BuildSchema<"insert", {
|
|
@@ -274,14 +274,14 @@ export declare const ArtifactEdgeInsert: import("drizzle-orm/effect-schema").Bui
|
|
|
274
274
|
name: string;
|
|
275
275
|
tableName: "artifact_edges";
|
|
276
276
|
dataType: "string enum";
|
|
277
|
-
data: "memory_contradicts" | "memory_supersedes" | "memory_supports";
|
|
277
|
+
data: "code_calls" | "memory_contradicts" | "memory_supersedes" | "memory_supports";
|
|
278
278
|
driverParam: string;
|
|
279
279
|
notNull: true;
|
|
280
280
|
hasDefault: false;
|
|
281
281
|
isPrimaryKey: false;
|
|
282
282
|
isAutoincrement: false;
|
|
283
283
|
hasRuntimeDefault: false;
|
|
284
|
-
enumValues: ["memory_supports", "memory_supersedes", "memory_contradicts"];
|
|
284
|
+
enumValues: ["memory_supports", "memory_supersedes", "memory_contradicts", "code_calls"];
|
|
285
285
|
baseColumn: never;
|
|
286
286
|
identity: undefined;
|
|
287
287
|
generated: undefined;
|
|
@@ -468,14 +468,14 @@ export declare const ArtifactEdgeSelect: import("drizzle-orm/effect-schema").Bui
|
|
|
468
468
|
name: string;
|
|
469
469
|
tableName: "artifact_edges";
|
|
470
470
|
dataType: "string enum";
|
|
471
|
-
data: "memory_contradicts" | "memory_supersedes" | "memory_supports";
|
|
471
|
+
data: "code_calls" | "memory_contradicts" | "memory_supersedes" | "memory_supports";
|
|
472
472
|
driverParam: string;
|
|
473
473
|
notNull: true;
|
|
474
474
|
hasDefault: false;
|
|
475
475
|
isPrimaryKey: false;
|
|
476
476
|
isAutoincrement: false;
|
|
477
477
|
hasRuntimeDefault: false;
|
|
478
|
-
enumValues: ["memory_supports", "memory_supersedes", "memory_contradicts"];
|
|
478
|
+
enumValues: ["memory_supports", "memory_supersedes", "memory_contradicts", "code_calls"];
|
|
479
479
|
baseColumn: never;
|
|
480
480
|
identity: undefined;
|
|
481
481
|
generated: undefined;
|
|
@@ -104,7 +104,7 @@ export declare const memories: import("drizzle-orm/sqlite-core").SQLiteTableWith
|
|
|
104
104
|
dataType: "number int53";
|
|
105
105
|
data: number;
|
|
106
106
|
driverParam: number;
|
|
107
|
-
notNull:
|
|
107
|
+
notNull: false;
|
|
108
108
|
hasDefault: true;
|
|
109
109
|
isPrimaryKey: false;
|
|
110
110
|
isAutoincrement: false;
|
|
@@ -847,7 +847,7 @@ export declare const MemoryInsert: import("drizzle-orm/effect-schema").BuildSche
|
|
|
847
847
|
dataType: "number int53";
|
|
848
848
|
data: number;
|
|
849
849
|
driverParam: number;
|
|
850
|
-
notNull:
|
|
850
|
+
notNull: false;
|
|
851
851
|
hasDefault: true;
|
|
852
852
|
isPrimaryKey: false;
|
|
853
853
|
isAutoincrement: false;
|
|
@@ -1025,7 +1025,7 @@ export declare const MemorySelect: import("drizzle-orm/effect-schema").BuildSche
|
|
|
1025
1025
|
dataType: "number int53";
|
|
1026
1026
|
data: number;
|
|
1027
1027
|
driverParam: number;
|
|
1028
|
-
notNull:
|
|
1028
|
+
notNull: false;
|
|
1029
1029
|
hasDefault: true;
|
|
1030
1030
|
isPrimaryKey: false;
|
|
1031
1031
|
isAutoincrement: false;
|
|
@@ -1203,7 +1203,7 @@ export declare const MemoryUpdate: import("drizzle-orm/effect-schema").BuildSche
|
|
|
1203
1203
|
dataType: "number int53";
|
|
1204
1204
|
data: number;
|
|
1205
1205
|
driverParam: number;
|
|
1206
|
-
notNull:
|
|
1206
|
+
notNull: false;
|
|
1207
1207
|
hasDefault: true;
|
|
1208
1208
|
isPrimaryKey: false;
|
|
1209
1209
|
isAutoincrement: false;
|
|
@@ -27,6 +27,9 @@ export declare const MemoryMetadata: Schema.Struct<{
|
|
|
27
27
|
readonly affordances: Schema.$Array<Schema.String>;
|
|
28
28
|
/** Code-specific: "typescript" | "rust" | ... */
|
|
29
29
|
readonly language: Schema.optional<Schema.String>;
|
|
30
|
+
/** Code-specific: the repo HEAD at index time (the indexer's
|
|
31
|
+
* provenance stamp — which commit this unit came from). */
|
|
32
|
+
readonly codeVersion: Schema.optional<Schema.String>;
|
|
30
33
|
/** Writer-set pin: the memory is deliberately stable — automatic graph
|
|
31
34
|
* lifecycle moves should leave it alone. */
|
|
32
35
|
readonly pinned: Schema.optional<Schema.Boolean>;
|
|
@@ -48,4 +51,4 @@ export declare const encodeMetadata: (metadata: MemoryMetadata) => string;
|
|
|
48
51
|
* does not declare (producer-specific extensions) survives. A malformed
|
|
49
52
|
* existing blob is treated as empty — the merge never throws.
|
|
50
53
|
*/
|
|
51
|
-
export declare const mergeMetadataBlob: (existing: string | null | undefined, typed: MemoryMetadata) => string;
|
|
54
|
+
export declare const mergeMetadataBlob: (existing: string | null | undefined, typed: Partial<MemoryMetadata>) => string;
|
|
@@ -1,16 +1,4 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
|
-
/**
|
|
3
|
-
* Mirrors `Schema.optionalWith(schema, { default })` from newer Effect versions.
|
|
4
|
-
*
|
|
5
|
-
* Effect 4.0.0-beta.99 (the pinned version) does not ship `optionalWith`;
|
|
6
|
-
* `optional` + `withDecodingDefaultType` is semantically identical: the key
|
|
7
|
-
* may be absent or `undefined` on input, the default fills it during
|
|
8
|
-
* decoding, and the decoded type keeps the field required. Curried so the
|
|
9
|
-
* default thunk is contextually typed against the already-fixed schema type.
|
|
10
|
-
*/
|
|
11
|
-
export declare const optionalWithDefault: <S extends Schema.Constraint>(schema: S) => (options: {
|
|
12
|
-
default: () => Schema.Schema.Type<S>;
|
|
13
|
-
}) => Schema.withDecodingDefaultType<Schema.optional<S>>;
|
|
14
2
|
/**
|
|
15
3
|
* The deterministic topic hierarchy. One ACTIVE tree per model;
|
|
16
4
|
* retired trees keep their rows (status `inactive`) so the switch is
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { Context, Effect } from "effect";
|
|
2
|
-
import type { MemoryUnit, MemoryEvent, WriteMemoryInput, SweepResult, Concept } from "./models.ts";
|
|
2
|
+
import type { MemoryUnit, MemoryEvent, WriteMemoryInput, SweepResult, Concept, ScoredMemory } from "./models.ts";
|
|
3
3
|
import type { StoreError, NotFound, DuplicateActiveKey } from "./error.ts";
|
|
4
|
+
import type { MetadataFilter } from "./db-backend.ts";
|
|
4
5
|
import type { TopicError } from "./topics/errors.ts";
|
|
5
6
|
import type { MaintenanceOutcome, RebalanceOutcome } from "./topics/maintenance.ts";
|
|
6
|
-
import type { EmbeddingModelConfig } from "
|
|
7
|
+
import type { EmbeddingModelConfig } from "../config/index.js";
|
|
7
8
|
import type { Topic, TopicChangeLog } from "./schema/topics.ts";
|
|
8
9
|
import type { ArtifactEdge, EdgeKind, EdgeSource } from "./schema/graph.ts";
|
|
9
10
|
import type { AugmentedMemory } from "./graph/retrieval-post-pass.ts";
|
|
@@ -65,21 +66,84 @@ export interface ExplainResult {
|
|
|
65
66
|
}
|
|
66
67
|
export interface Interface {
|
|
67
68
|
readonly write: (input: WriteMemoryInput) => Effect.Effect<MemoryUnit, StoreError | DuplicateActiveKey>;
|
|
69
|
+
/** Bulk write: batch insert in ONE transaction (all-or-nothing; a
|
|
70
|
+
* duplicate logical key fails the whole batch with DuplicateActiveKey).
|
|
71
|
+
* The per-write graph candidate scan is NOT part of this — pair with
|
|
72
|
+
* `updateEmbedding(..., { scanCandidates: false })` for bulk ingest. */
|
|
73
|
+
readonly writeMany: (inputs: readonly WriteMemoryInput[]) => Effect.Effect<readonly MemoryUnit[], StoreError | DuplicateActiveKey>;
|
|
74
|
+
/** Upsert for the index path — the identity rule (same logical key ⇒
|
|
75
|
+
* confirmed `memory_supersedes`) made reachable for ACTIVE keys: demote
|
|
76
|
+
* the active holder of the key (if any), write the new unit, and link
|
|
77
|
+
* old → new with a confirmed rule edge, all in ONE transaction. Returns
|
|
78
|
+
* the new memory plus the superseded id (when a predecessor existed). */
|
|
79
|
+
readonly writeSuperseding: (input: WriteMemoryInput) => Effect.Effect<{
|
|
80
|
+
readonly memory: MemoryUnit;
|
|
81
|
+
readonly supersededId?: string;
|
|
82
|
+
}, StoreError | DuplicateActiveKey>;
|
|
83
|
+
/** Index reconciliation — demote every ACTIVE unit under `keyPrefix`
|
|
84
|
+
* that is (a) INSIDE the walked domain (its file path is under one of
|
|
85
|
+
* `walkedRoots`, joined against `keyRoot`) and (b) not among `keptKeys`
|
|
86
|
+
* (this run's unit keys — files AND chunks: a chunk the extractor no
|
|
87
|
+
* longer emits, e.g. a deleted function inside a surviving file, is
|
|
88
|
+
* vanished). Demotion is `source_removed` (one transaction). Returns the demoted
|
|
89
|
+
* rows for the rename-candidate scan. Units outside the walked domain
|
|
90
|
+
* (subtree runs) and normal (non-index) memories are never touched. */
|
|
91
|
+
readonly reconcile: (namespace: string, keyPrefix: string, keyRoot: string, walkedRoots: readonly string[], keptKeys: readonly string[]) => Effect.Effect<readonly {
|
|
92
|
+
readonly id: string;
|
|
93
|
+
readonly logicalKey: string;
|
|
94
|
+
readonly embedding: number[] | null;
|
|
95
|
+
}[], StoreError>;
|
|
96
|
+
/** Rename/move detection (human-gated): cosine each vanished unit's
|
|
97
|
+
* stored embedding against this run's new units; ≥ the near-duplicate
|
|
98
|
+
* band → a PENDING `memory_supersedes` candidate (source rule, never
|
|
99
|
+
* auto-confirms — a rename is a guess). Returns the new-candidate count. */
|
|
100
|
+
readonly reconcileRenameCandidates: (vanished: readonly {
|
|
101
|
+
readonly id: string;
|
|
102
|
+
readonly embedding: number[] | null;
|
|
103
|
+
}[], newUnitIds: readonly string[]) => Effect.Effect<number, StoreError>;
|
|
68
104
|
readonly get: (id: string) => Effect.Effect<MemoryUnit, NotFound | StoreError>;
|
|
69
105
|
readonly getByKey: (key: string, namespace: string) => Effect.Effect<MemoryUnit, NotFound | StoreError>;
|
|
70
106
|
readonly recency: (namespace: string, limit: number) => Effect.Effect<ReadonlyArray<AugmentedMemory>, StoreError>;
|
|
71
107
|
readonly searchFts5: (query: string, namespace: string, limit: number, opts?: {
|
|
72
108
|
readonly topicKeys?: ReadonlyArray<string>;
|
|
109
|
+
/** Content-type filter: one kind or a list (code-vs-message
|
|
110
|
+
* separation lever at query time). */
|
|
111
|
+
readonly contentType?: string | ReadonlyArray<string>;
|
|
73
112
|
/** `false` suppresses the per-leg audit row (fused-row callers). */
|
|
74
113
|
readonly audit?: boolean;
|
|
114
|
+
/** Include the 384-float embedding on results (default false). */
|
|
115
|
+
readonly includeEmbedding?: boolean;
|
|
116
|
+
/** `false` skips the per-leg graph augmentation (fused-row callers). */
|
|
117
|
+
readonly augment?: boolean;
|
|
75
118
|
}) => Effect.Effect<ReadonlyArray<AugmentedMemory>, StoreError>;
|
|
76
119
|
readonly searchVector: (query: ReadonlyArray<number>, namespace: string, limit: number, opts?: {
|
|
77
120
|
readonly topicKeys?: ReadonlyArray<string>;
|
|
78
121
|
/** Restrict to memories annotated with ANY of these concept ids. */
|
|
79
122
|
readonly conceptIds?: ReadonlyArray<string>;
|
|
123
|
+
/** Content-type filter: one kind or a list (code-vs-message
|
|
124
|
+
* separation lever at query time). */
|
|
125
|
+
readonly contentType?: string | ReadonlyArray<string>;
|
|
80
126
|
/** `false` suppresses the per-leg audit row (fused-row callers). */
|
|
81
127
|
readonly audit?: boolean;
|
|
128
|
+
/** Include the 384-float embedding on results (default false). */
|
|
129
|
+
readonly includeEmbedding?: boolean;
|
|
130
|
+
/** `false` skips the per-leg graph augmentation (fused-row callers). */
|
|
131
|
+
readonly augment?: boolean;
|
|
82
132
|
}) => Effect.Effect<ReadonlyArray<AugmentedMemory>, StoreError>;
|
|
133
|
+
/** One-pass graph augmentation over an already-ranked result set. The
|
|
134
|
+
* store exposes it for fused-row callers; the hybrid retriever does not
|
|
135
|
+
* call it yet, so fused results carry no graph fields. A wired caller
|
|
136
|
+
* gets one edge fetch + one concept fetch over the fused rows instead of
|
|
137
|
+
* two of each per leg. */
|
|
138
|
+
readonly augmentSearchResults: (results: ReadonlyArray<ScoredMemory>) => Effect.Effect<ReadonlyArray<AugmentedMemory>, StoreError>;
|
|
139
|
+
/** The DB's tables + columns (`dimple db-schema` surface). */
|
|
140
|
+
readonly listSchema: () => Effect.Effect<ReadonlyArray<{
|
|
141
|
+
readonly table: string;
|
|
142
|
+
readonly columns: ReadonlyArray<{
|
|
143
|
+
readonly name: string;
|
|
144
|
+
readonly type: string;
|
|
145
|
+
}>;
|
|
146
|
+
}>, StoreError>;
|
|
83
147
|
/** One fused retrieval-audit row (the hybrid path's audit contract). */
|
|
84
148
|
readonly logAudit: (input: {
|
|
85
149
|
readonly query: string;
|
|
@@ -95,16 +159,32 @@ export interface Interface {
|
|
|
95
159
|
readonly forget: (id: string) => Effect.Effect<void, NotFound | StoreError>;
|
|
96
160
|
readonly sweep: (namespace: string) => Effect.Effect<SweepResult, StoreError>;
|
|
97
161
|
readonly events: (memoryId: string) => Effect.Effect<readonly MemoryEvent[], StoreError>;
|
|
98
|
-
readonly updateEmbedding: (id: string, embedding: ReadonlyArray<number>, model: string
|
|
162
|
+
readonly updateEmbedding: (id: string, embedding: ReadonlyArray<number>, model: string, options?: {
|
|
163
|
+
readonly scanCandidates?: boolean;
|
|
164
|
+
}) => Effect.Effect<void, NotFound | StoreError>;
|
|
165
|
+
/** Bulk variant of `updateEmbedding` — the writeMany path. One
|
|
166
|
+
* transaction for all memory updates + events, batch vector insert,
|
|
167
|
+
* and `routeInsertMany` (tree read once, all insertions computed in
|
|
168
|
+
* memory, one transaction). For NEW memories: the idempotent re-embed
|
|
169
|
+
* decrement is deliberately NOT part of the batch (use
|
|
170
|
+
* `updateEmbedding` for re-embedding existing routed memories).
|
|
171
|
+
* `scanCandidates` defaults to false-ish via the config: it runs only
|
|
172
|
+
* when explicitly requested AND `graph.enabled` is not false. */
|
|
173
|
+
readonly updateEmbeddingMany: (entries: ReadonlyArray<{
|
|
174
|
+
readonly id: string;
|
|
175
|
+
readonly embedding: ReadonlyArray<number>;
|
|
176
|
+
}>, model: string, options?: {
|
|
177
|
+
readonly scanCandidates?: boolean;
|
|
178
|
+
}) => Effect.Effect<void, StoreError>;
|
|
99
179
|
readonly findStale: (model: string) => Effect.Effect<readonly string[], StoreError>;
|
|
100
180
|
readonly createConcept: (name: string, embedding: ReadonlyArray<number>) => Effect.Effect<Concept, StoreError>;
|
|
101
181
|
readonly getConcept: (id: string) => Effect.Effect<Concept, NotFound | StoreError>;
|
|
102
182
|
readonly listConcepts: () => Effect.Effect<readonly Concept[], StoreError>;
|
|
103
183
|
readonly annotateMemory: (memoryId: string, conceptId: string, confidence?: number) => Effect.Effect<void, NotFound | StoreError>;
|
|
104
184
|
readonly getMemoryAnnotations: (memoryId: string) => Effect.Effect<readonly string[], StoreError>;
|
|
105
|
-
readonly queryByMetadata: (filter:
|
|
185
|
+
readonly queryByMetadata: (filter: MetadataFilter) => Effect.Effect<readonly MemoryUnit[], StoreError>;
|
|
106
186
|
readonly getMemoryMetadata: (id: string) => Effect.Effect<MemoryMetadata | undefined, NotFound | StoreError>;
|
|
107
|
-
readonly setMemoryMetadata: (id: string, metadata: MemoryMetadata) => Effect.Effect<void, NotFound | StoreError>;
|
|
187
|
+
readonly setMemoryMetadata: (id: string, metadata: Partial<MemoryMetadata>) => Effect.Effect<void, NotFound | StoreError>;
|
|
108
188
|
readonly ensureTopicTree: (modelKey: string) => Effect.Effect<{
|
|
109
189
|
rootKey: string;
|
|
110
190
|
unassignedKey: string;
|
|
@@ -4,9 +4,9 @@ import type { RetrievalAuditRow } from "./models.ts";
|
|
|
4
4
|
import { Service as DbBackend } from "./db-backend.ts";
|
|
5
5
|
import { Service } from "./service.ts";
|
|
6
6
|
import { StoreError } from "./error.ts";
|
|
7
|
-
import { Service as ConfigService } from "
|
|
8
|
-
import { type LogConfig, type Logging } from "
|
|
9
|
-
import type { EmbeddingModelConfig } from "
|
|
7
|
+
import { Service as ConfigService } from "../config/index.js";
|
|
8
|
+
import { type LogConfig, type Logging } from "../logger/index.js";
|
|
9
|
+
import type { EmbeddingModelConfig } from "../config/index.js";
|
|
10
10
|
import type { TopicConfig as TopicConfigType } from "./schema/topics.ts";
|
|
11
11
|
import { GraphConfig } from "./schema/graph.ts";
|
|
12
12
|
/**
|
|
@@ -57,14 +57,33 @@ export declare const layer: (url: string, options?: {
|
|
|
57
57
|
/** Default TTL for writes that omit `ttlSecs` (the config's
|
|
58
58
|
* `defaultTtlSecs`; default 604800). */
|
|
59
59
|
defaultTtlSecs?: number;
|
|
60
|
-
}) => Layer.Layer<Logging | DbBackend | Service, StoreError,
|
|
60
|
+
}) => Layer.Layer<Logging | DbBackend | Service, StoreError, never>;
|
|
61
|
+
/**
|
|
62
|
+
* OpenCode-style node declaration for {@link layer} (the layer graph module
|
|
63
|
+
* at `@dimple/shared/effect`).
|
|
64
|
+
*
|
|
65
|
+
* `deps` stays empty on purpose: the store's production seams
|
|
66
|
+
* (`topics.enqueueSplit` / `enqueueMerge` / `enqueueAudit`) are effects
|
|
67
|
+
* built over `JobRuntime`, so the composition root owns the wiring — a node
|
|
68
|
+
* cannot own a dependency it is itself configured with. The options type is
|
|
69
|
+
* read off `layer` (`Parameters<typeof layer>[1]`) so the declaration can
|
|
70
|
+
* never drift from the layer it wraps.
|
|
71
|
+
*/
|
|
72
|
+
export declare const configured: (url: string, options?: Parameters<typeof layer>[1]) => import("../core/index.js").LayerProvider<Logging | DbBackend | Service, StoreError, undefined>;
|
|
73
|
+
/** The default store node — the local libSQL database under `.dimple/`. */
|
|
74
|
+
export declare const node: import("../core/index.js").LayerProvider<Logging | DbBackend | Service, StoreError, undefined>;
|
|
61
75
|
export declare const layerConfig: (config: Config.Wrap<{
|
|
62
76
|
url: string;
|
|
63
77
|
}>, options?: {
|
|
64
78
|
migrationFolder?: string;
|
|
65
79
|
embeddingModelConfig?: EmbeddingModelConfig;
|
|
66
|
-
}) => Layer.Layer<Logging | DbBackend | Service, Config.ConfigError | StoreError,
|
|
80
|
+
}) => Layer.Layer<Logging | DbBackend | Service, Config.ConfigError | StoreError, never>;
|
|
67
81
|
export declare const layerFromConfig: (options?: {
|
|
68
82
|
migrationFolder?: string;
|
|
69
83
|
}) => Layer.Layer<Service | DbBackend | Logging, StoreError, ConfigService | Scope>;
|
|
84
|
+
/** The dimple.jsonc `logging` section, installed unconditionally — a
|
|
85
|
+
* DISABLED config when the section is absent (silent-by-default: library
|
|
86
|
+
* logging is opt-in, and every `Effect.log*` in the system routes through
|
|
87
|
+
* `@dimple/logger` either way). The silent config itself comes from the
|
|
88
|
+
* logger package, the one source of truth. */
|
|
70
89
|
export declare const loggingFromConfig: Layer.Layer<Logging, never, ConfigService | Scope>;
|
|
@@ -4,7 +4,7 @@ declare const TopicNotFound_base: Schema.Class<TopicNotFound, Schema.TaggedStruc
|
|
|
4
4
|
}>, import("effect/Cause").YieldableError>;
|
|
5
5
|
/**
|
|
6
6
|
* Topic-tree error types. Each distinct failure mode gets its
|
|
7
|
-
* own `Schema.
|
|
7
|
+
* own `Schema.TaggedError` so callers can `catchTag` precisely.
|
|
8
8
|
* `TopicError` is the tagged union; individual classes are exported for
|
|
9
9
|
* pattern matching.
|
|
10
10
|
*/
|
|
@@ -46,8 +46,8 @@
|
|
|
46
46
|
* (the canonical source — keep both in sync).
|
|
47
47
|
*/
|
|
48
48
|
import { Effect } from "effect";
|
|
49
|
-
import { JobFailure, type Handler, type JobContext } from "
|
|
50
|
-
import type { EmbeddingModelConfig } from "
|
|
49
|
+
import { JobFailure, type Handler, type JobContext } from "../../workflow/index.js";
|
|
50
|
+
import type { EmbeddingModelConfig } from "../../config/index.js";
|
|
51
51
|
import { Service as DbBackend } from "../db-backend.ts";
|
|
52
52
|
import type { Interface as DbBackendInterface } from "../db-backend.ts";
|
|
53
53
|
import { StoreError } from "../error.ts";
|
|
@@ -127,8 +127,14 @@ export interface TopicSplitHandlerDeps {
|
|
|
127
127
|
*/
|
|
128
128
|
readonly backend?: DbBackendInterface;
|
|
129
129
|
}
|
|
130
|
+
/** The decoded `topic.split` payload — mirrors the queue definition's
|
|
131
|
+
* schema (`{ topicId, modelKey }`); the executor decodes before calling. */
|
|
132
|
+
export interface TopicSplitPayload {
|
|
133
|
+
readonly topicId: string;
|
|
134
|
+
readonly modelKey: string;
|
|
135
|
+
}
|
|
130
136
|
/** The `topic.split` handler shape — `unknown` success like `JobRegistry.Handler`. */
|
|
131
|
-
export type TopicSplitHandler = (payload:
|
|
137
|
+
export type TopicSplitHandler = (payload: TopicSplitPayload, ctx: JobContext) => Effect.Effect<unknown, JobFailure, DbBackend>;
|
|
132
138
|
/**
|
|
133
139
|
* Factory for the `topic.split` job handler.
|
|
134
140
|
*
|
|
@@ -56,12 +56,12 @@
|
|
|
56
56
|
* (observability only — never read by routing).
|
|
57
57
|
*/
|
|
58
58
|
import { Effect } from "effect";
|
|
59
|
-
import type { EmbeddingModelConfig } from "
|
|
59
|
+
import type { EmbeddingModelConfig } from "../../config/index.js";
|
|
60
60
|
import { Service as DbBackend } from "../db-backend.ts";
|
|
61
61
|
import type { TopicConfig } from "../schema/topics.ts";
|
|
62
62
|
import type { TopicError } from "./errors.ts";
|
|
63
63
|
import { NotFound, StoreError } from "../error.ts";
|
|
64
|
-
import { JobFailure, type Handler, type JobContext } from "
|
|
64
|
+
import { JobFailure, type Handler, type JobContext } from "../../workflow/index.js";
|
|
65
65
|
import type { Interface as DbBackendInterface } from "../db-backend.ts";
|
|
66
66
|
/** Result of {@link setActiveModel}. */
|
|
67
67
|
export interface SetActiveModelResult {
|
|
@@ -112,8 +112,14 @@ export interface MemoryEmbedHandlerDeps {
|
|
|
112
112
|
/** Backend captured at registration (see {@link topicSplitHandler}). */
|
|
113
113
|
readonly backend?: DbBackendInterface;
|
|
114
114
|
}
|
|
115
|
+
/** The decoded `memory.embed` payload — mirrors the queue definition's
|
|
116
|
+
* schema (`{ memoryId, modelKey }`); the executor decodes before calling. */
|
|
117
|
+
export interface MemoryEmbedPayload {
|
|
118
|
+
readonly memoryId: string;
|
|
119
|
+
readonly modelKey: string;
|
|
120
|
+
}
|
|
115
121
|
/** The `memory.embed` handler shape (see jobs.ts). */
|
|
116
|
-
export type MemoryEmbedHandler = (payload:
|
|
122
|
+
export type MemoryEmbedHandler = (payload: MemoryEmbedPayload, ctx: JobContext) => Effect.Effect<unknown, JobFailure, DbBackend>;
|
|
117
123
|
/**
|
|
118
124
|
* Factory for the `memory.embed` job handler: re-embeds one memory with the
|
|
119
125
|
* target model and routes it into that model's tree. The success schema is
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
* Effect Clock (captured outside the tx closure) — observability only.
|
|
32
32
|
*/
|
|
33
33
|
import { Effect } from "effect";
|
|
34
|
-
import { JobFailure, type Handler, type JobContext } from "
|
|
35
|
-
import type { EmbeddingModelConfig } from "
|
|
34
|
+
import { JobFailure, type Handler, type JobContext } from "../../workflow/index.js";
|
|
35
|
+
import type { EmbeddingModelConfig } from "../../config/index.js";
|
|
36
36
|
import { Service as DbBackend } from "../db-backend.ts";
|
|
37
37
|
import type { Interface as DbBackendInterface } from "../db-backend.ts";
|
|
38
38
|
import { StoreError } from "../error.ts";
|
|
@@ -89,8 +89,14 @@ export interface TopicMaintenanceHandlerDeps {
|
|
|
89
89
|
/** Backend captured at registration (see {@link topicSplitHandler}). */
|
|
90
90
|
readonly backend?: DbBackendInterface;
|
|
91
91
|
}
|
|
92
|
-
/** The `topic.merge` / `topic.rebalance`
|
|
93
|
-
|
|
92
|
+
/** The decoded `topic.merge` / `topic.rebalance` payload — mirrors the
|
|
93
|
+
* queue definitions' schema (`{ topicId, modelKey }`); the executor
|
|
94
|
+
* decodes before calling. */
|
|
95
|
+
export interface TopicMaintenancePayload {
|
|
96
|
+
readonly topicId: string;
|
|
97
|
+
readonly modelKey: string;
|
|
98
|
+
}
|
|
99
|
+
export type TopicMaintenanceHandler = (payload: TopicMaintenancePayload, ctx: JobContext) => Effect.Effect<unknown, JobFailure, DbBackend>;
|
|
94
100
|
/**
|
|
95
101
|
* Factory for the `topic.merge` job handler: resolves the model, runs
|
|
96
102
|
* {@link mergeOrBorrow}, returns `undefined` (the definition's success
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
* ranking still runs in libSQL (`vectorSearch` with `topic_key IN (...)`).
|
|
25
25
|
*/
|
|
26
26
|
import { Effect } from "effect";
|
|
27
|
-
import type { EmbeddingModelConfig } from "
|
|
27
|
+
import type { EmbeddingModelConfig } from "../../config/index.js";
|
|
28
28
|
import { Service as DbBackend } from "../db-backend.ts";
|
|
29
29
|
import type { TopicConfig } from "../schema/topics.ts";
|
|
30
30
|
import type { TopicError } from "./errors.ts";
|