@ponraaj/dimple-sdk 0.0.0-alpha.1 → 0.0.0-alpha.10
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 +98 -0
- package/dist/dimple.d.ts +113 -5
- package/dist/errors.d.ts +24 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +3055 -1524
- package/dist/indexer.d.ts +9 -0
- package/dist/internal/config/schema.d.ts +87 -0
- package/dist/internal/core/hosted-embedding.d.ts +33 -0
- package/dist/internal/embedder/auto-install.d.ts +10 -0
- package/dist/internal/embedder/index.d.ts +1 -2
- package/dist/internal/embedder/transformers.d.ts +40 -2
- package/dist/internal/extractor/models/extraction.d.ts +14 -0
- package/dist/internal/installer/index.d.ts +26 -0
- package/dist/internal/logger/index.d.ts +1 -1
- package/dist/internal/logger/service.d.ts +31 -12
- package/dist/internal/logger/types.d.ts +15 -3
- package/dist/internal/store/audit.d.ts +7 -1
- package/dist/internal/store/db-backend.d.ts +46 -8
- package/dist/internal/store/graph/candidates.d.ts +3 -1
- package/dist/internal/store/graph/concepts.d.ts +14 -5
- package/dist/internal/store/graph/dream.d.ts +7 -1
- package/dist/internal/store/graph/repair.d.ts +7 -1
- package/dist/internal/store/graph/traversal.d.ts +1 -1
- package/dist/internal/store/index.d.ts +1 -0
- 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/service.d.ts +83 -4
- package/dist/internal/store/topics/jobs.d.ts +7 -1
- package/dist/internal/store/topics/lifecycle.d.ts +7 -1
- package/dist/internal/store/topics/maintenance.d.ts +8 -2
- package/dist/internal/store/topics/routing.d.ts +33 -0
- package/dist/internal/store/topics/topic-vectors.d.ts +10 -3
- package/dist/internal/store/topics/tree.d.ts +15 -9
- package/dist/internal/workflow/executor.d.ts +1 -1
- package/dist/internal/workflow/persistence.d.ts +1 -1
- package/dist/internal/workflow/queue.d.ts +6 -3
- package/dist/internal/workflow/registry.d.ts +1 -1
- package/dist/internal/workflow/signals.d.ts +21 -0
- package/dist/make.d.ts +27 -0
- package/package.json +12 -4
- package/dist/internal/embedder/openai.d.ts +0 -8
package/dist/indexer.d.ts
CHANGED
|
@@ -25,11 +25,20 @@ export interface WalkResult {
|
|
|
25
25
|
* SAME file always gets the SAME key regardless of which path list was
|
|
26
26
|
* passed (idempotent re-indexing across invocation shapes). */
|
|
27
27
|
readonly root: string;
|
|
28
|
+
/** The resolved input paths — the reconcile DOMAIN: units whose file
|
|
29
|
+
* path is outside every root are untouched by subtree runs. */
|
|
30
|
+
readonly roots: readonly string[];
|
|
28
31
|
}
|
|
29
32
|
/** Recursively collect indexable files from paths (dirs or files). */
|
|
30
33
|
export declare const walkFiles: (paths: readonly string[], extensions: readonly string[]) => WalkResult;
|
|
31
34
|
/** Read a file's text, capped at `maxBytes` (string slice = char-safe). */
|
|
32
35
|
export declare const readCapped: (path: string, maxBytes: number) => string;
|
|
36
|
+
/** The repository's HEAD commit for provenance stamping — soft-failed
|
|
37
|
+
* (non-git trees, missing git, permission errors → null). Walks UP from
|
|
38
|
+
* the first indexed file (git finds the enclosing repo), so it works for
|
|
39
|
+
* absolute-path trees whose key root is "/". Platform side; the facade
|
|
40
|
+
* never touches node APIs. */
|
|
41
|
+
export declare const currentCommit: (firstFile: string | undefined) => string | null;
|
|
33
42
|
/** Resolve a file's relative import specifiers to indexed-tree files
|
|
34
43
|
* (bare/absolute specifiers are external modules — no node_modules
|
|
35
44
|
* resolution). */
|
|
@@ -13,11 +13,40 @@ export declare const EmbeddingModelConfig: Schema.Struct<{
|
|
|
13
13
|
readonly dimensions: Schema.Number;
|
|
14
14
|
readonly vectorType: Schema.optional<Schema.String>;
|
|
15
15
|
readonly apiKey: Schema.optional<Schema.String>;
|
|
16
|
+
/** Hosted providers: OpenAI-compatible endpoint override (default
|
|
17
|
+
* `https://api.openai.com/v1`). */
|
|
18
|
+
readonly baseURL: Schema.optional<Schema.String>;
|
|
16
19
|
readonly indexConfig: Schema.optional<Schema.Struct<{
|
|
17
20
|
readonly compressNeighbors: Schema.optional<Schema.String>;
|
|
18
21
|
readonly maxNeighbors: Schema.optional<Schema.Number>;
|
|
19
22
|
readonly searchL: Schema.optional<Schema.Number>;
|
|
20
23
|
}>>;
|
|
24
|
+
/** Transformers.js runtime options — per-model, all optional (defaults:
|
|
25
|
+
* device "cpu", dtype "q8", pooling "mean", normalize true). `dtype`
|
|
26
|
+
* quantizes the MODEL WEIGHTS (inference memory/speed), never the
|
|
27
|
+
* output vectors; unsupported devices fail typed at first use. */
|
|
28
|
+
readonly device: Schema.optional<Schema.Literals<readonly ["auto", "gpu", "cpu", "wasm", "webgpu", "cuda", "dml", "coreml", "webnn"]>>;
|
|
29
|
+
readonly dtype: Schema.optional<Schema.Literals<readonly ["fp32", "fp16", "q8", "int8", "uint8", "q4", "bnb4", "q4f16", "q2", "q2f16", "q1", "q1f16"]>>;
|
|
30
|
+
readonly pooling: Schema.optional<Schema.Literals<readonly ["mean", "cls", "none"]>>;
|
|
31
|
+
readonly normalize: Schema.optional<Schema.Boolean>;
|
|
32
|
+
readonly cacheDir: Schema.optional<Schema.String>;
|
|
33
|
+
/** ONNX Runtime CUDA session options — the verified fix for GPUs with
|
|
34
|
+
* limited VRAM (≤8GB): ORT's default arena is unbounded and grows by
|
|
35
|
+
* powers of two, so batch inference OOMs mid-run and poisons the
|
|
36
|
+
* process for later queries. `gpuMemLimit` caps the arena (bytes);
|
|
37
|
+
* `arenaExtendStrategy` picks the growth policy (0 = kNextPowerOfTwo,
|
|
38
|
+
* 1 = kSameAsRequested). CPU / ample-VRAM GPUs are unaffected (ORT
|
|
39
|
+
* defaults preserved when absent). */
|
|
40
|
+
readonly sessionOptions: Schema.optional<Schema.Struct<{
|
|
41
|
+
readonly gpuMemLimit: Schema.optional<Schema.Number>;
|
|
42
|
+
readonly arenaExtendStrategy: Schema.optional<Schema.Literals<readonly [0, 1]>>;
|
|
43
|
+
}>>;
|
|
44
|
+
/** First-use auto-install of the optional `@huggingface/transformers`
|
|
45
|
+
* peer (default true) — the package is installed with the project's
|
|
46
|
+
* own package manager on the first local-embed use (scripts skipped,
|
|
47
|
+
* proven unnecessary for embedding). Set false to require a manual
|
|
48
|
+
* install. */
|
|
49
|
+
readonly autoInstall: Schema.optional<Schema.Boolean>;
|
|
21
50
|
}>;
|
|
22
51
|
export interface EmbeddingModelConfig extends Schema.Schema.Type<typeof EmbeddingModelConfig> {
|
|
23
52
|
}
|
|
@@ -30,11 +59,40 @@ export declare const EmbeddingConfig: Schema.Struct<{
|
|
|
30
59
|
readonly dimensions: Schema.Number;
|
|
31
60
|
readonly vectorType: Schema.optional<Schema.String>;
|
|
32
61
|
readonly apiKey: Schema.optional<Schema.String>;
|
|
62
|
+
/** Hosted providers: OpenAI-compatible endpoint override (default
|
|
63
|
+
* `https://api.openai.com/v1`). */
|
|
64
|
+
readonly baseURL: Schema.optional<Schema.String>;
|
|
33
65
|
readonly indexConfig: Schema.optional<Schema.Struct<{
|
|
34
66
|
readonly compressNeighbors: Schema.optional<Schema.String>;
|
|
35
67
|
readonly maxNeighbors: Schema.optional<Schema.Number>;
|
|
36
68
|
readonly searchL: Schema.optional<Schema.Number>;
|
|
37
69
|
}>>;
|
|
70
|
+
/** Transformers.js runtime options — per-model, all optional (defaults:
|
|
71
|
+
* device "cpu", dtype "q8", pooling "mean", normalize true). `dtype`
|
|
72
|
+
* quantizes the MODEL WEIGHTS (inference memory/speed), never the
|
|
73
|
+
* output vectors; unsupported devices fail typed at first use. */
|
|
74
|
+
readonly device: Schema.optional<Schema.Literals<readonly ["auto", "gpu", "cpu", "wasm", "webgpu", "cuda", "dml", "coreml", "webnn"]>>;
|
|
75
|
+
readonly dtype: Schema.optional<Schema.Literals<readonly ["fp32", "fp16", "q8", "int8", "uint8", "q4", "bnb4", "q4f16", "q2", "q2f16", "q1", "q1f16"]>>;
|
|
76
|
+
readonly pooling: Schema.optional<Schema.Literals<readonly ["mean", "cls", "none"]>>;
|
|
77
|
+
readonly normalize: Schema.optional<Schema.Boolean>;
|
|
78
|
+
readonly cacheDir: Schema.optional<Schema.String>;
|
|
79
|
+
/** ONNX Runtime CUDA session options — the verified fix for GPUs with
|
|
80
|
+
* limited VRAM (≤8GB): ORT's default arena is unbounded and grows by
|
|
81
|
+
* powers of two, so batch inference OOMs mid-run and poisons the
|
|
82
|
+
* process for later queries. `gpuMemLimit` caps the arena (bytes);
|
|
83
|
+
* `arenaExtendStrategy` picks the growth policy (0 = kNextPowerOfTwo,
|
|
84
|
+
* 1 = kSameAsRequested). CPU / ample-VRAM GPUs are unaffected (ORT
|
|
85
|
+
* defaults preserved when absent). */
|
|
86
|
+
readonly sessionOptions: Schema.optional<Schema.Struct<{
|
|
87
|
+
readonly gpuMemLimit: Schema.optional<Schema.Number>;
|
|
88
|
+
readonly arenaExtendStrategy: Schema.optional<Schema.Literals<readonly [0, 1]>>;
|
|
89
|
+
}>>;
|
|
90
|
+
/** First-use auto-install of the optional `@huggingface/transformers`
|
|
91
|
+
* peer (default true) — the package is installed with the project's
|
|
92
|
+
* own package manager on the first local-embed use (scripts skipped,
|
|
93
|
+
* proven unnecessary for embedding). Set false to require a manual
|
|
94
|
+
* install. */
|
|
95
|
+
readonly autoInstall: Schema.optional<Schema.Boolean>;
|
|
38
96
|
}>>;
|
|
39
97
|
}>;
|
|
40
98
|
export interface EmbeddingConfig extends Schema.Schema.Type<typeof EmbeddingConfig> {
|
|
@@ -110,11 +168,40 @@ export declare const DimpleConfig: Schema.Struct<{
|
|
|
110
168
|
readonly dimensions: Schema.Number;
|
|
111
169
|
readonly vectorType: Schema.optional<Schema.String>;
|
|
112
170
|
readonly apiKey: Schema.optional<Schema.String>;
|
|
171
|
+
/** Hosted providers: OpenAI-compatible endpoint override (default
|
|
172
|
+
* `https://api.openai.com/v1`). */
|
|
173
|
+
readonly baseURL: Schema.optional<Schema.String>;
|
|
113
174
|
readonly indexConfig: Schema.optional<Schema.Struct<{
|
|
114
175
|
readonly compressNeighbors: Schema.optional<Schema.String>;
|
|
115
176
|
readonly maxNeighbors: Schema.optional<Schema.Number>;
|
|
116
177
|
readonly searchL: Schema.optional<Schema.Number>;
|
|
117
178
|
}>>;
|
|
179
|
+
/** Transformers.js runtime options — per-model, all optional (defaults:
|
|
180
|
+
* device "cpu", dtype "q8", pooling "mean", normalize true). `dtype`
|
|
181
|
+
* quantizes the MODEL WEIGHTS (inference memory/speed), never the
|
|
182
|
+
* output vectors; unsupported devices fail typed at first use. */
|
|
183
|
+
readonly device: Schema.optional<Schema.Literals<readonly ["auto", "gpu", "cpu", "wasm", "webgpu", "cuda", "dml", "coreml", "webnn"]>>;
|
|
184
|
+
readonly dtype: Schema.optional<Schema.Literals<readonly ["fp32", "fp16", "q8", "int8", "uint8", "q4", "bnb4", "q4f16", "q2", "q2f16", "q1", "q1f16"]>>;
|
|
185
|
+
readonly pooling: Schema.optional<Schema.Literals<readonly ["mean", "cls", "none"]>>;
|
|
186
|
+
readonly normalize: Schema.optional<Schema.Boolean>;
|
|
187
|
+
readonly cacheDir: Schema.optional<Schema.String>;
|
|
188
|
+
/** ONNX Runtime CUDA session options — the verified fix for GPUs with
|
|
189
|
+
* limited VRAM (≤8GB): ORT's default arena is unbounded and grows by
|
|
190
|
+
* powers of two, so batch inference OOMs mid-run and poisons the
|
|
191
|
+
* process for later queries. `gpuMemLimit` caps the arena (bytes);
|
|
192
|
+
* `arenaExtendStrategy` picks the growth policy (0 = kNextPowerOfTwo,
|
|
193
|
+
* 1 = kSameAsRequested). CPU / ample-VRAM GPUs are unaffected (ORT
|
|
194
|
+
* defaults preserved when absent). */
|
|
195
|
+
readonly sessionOptions: Schema.optional<Schema.Struct<{
|
|
196
|
+
readonly gpuMemLimit: Schema.optional<Schema.Number>;
|
|
197
|
+
readonly arenaExtendStrategy: Schema.optional<Schema.Literals<readonly [0, 1]>>;
|
|
198
|
+
}>>;
|
|
199
|
+
/** First-use auto-install of the optional `@huggingface/transformers`
|
|
200
|
+
* peer (default true) — the package is installed with the project's
|
|
201
|
+
* own package manager on the first local-embed use (scripts skipped,
|
|
202
|
+
* proven unnecessary for embedding). Set false to require a manual
|
|
203
|
+
* install. */
|
|
204
|
+
readonly autoInstall: Schema.optional<Schema.Boolean>;
|
|
118
205
|
}>>;
|
|
119
206
|
}>>;
|
|
120
207
|
readonly jobs: Schema.optional<Schema.Struct<{
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type EmbeddingModel } from "./internal/embedder/index.js";
|
|
2
|
+
export interface HostedEmbeddingOptions {
|
|
3
|
+
readonly modelId: string;
|
|
4
|
+
readonly model: string;
|
|
5
|
+
readonly dimensions: number;
|
|
6
|
+
readonly apiKey: string;
|
|
7
|
+
/** The AI SDK provider family — see
|
|
8
|
+
* https://ai-sdk.dev/providers for the full provider list. */
|
|
9
|
+
readonly provider?: "openai" | "google" | "cohere" | "bedrock";
|
|
10
|
+
/** OpenAI-compatible endpoint override — ONLY needed for custom
|
|
11
|
+
* endpoints (vLLM/ollama/…). The preconfigured providers have their
|
|
12
|
+
* base URL baked in. */
|
|
13
|
+
readonly baseURL?: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Hosted embeddings — the `ai` SDK IS the implementation (`embedMany`),
|
|
17
|
+
* this adapter only bridges it to the dimple `EmbeddingModel` interface.
|
|
18
|
+
*
|
|
19
|
+
* Provider mapping (config `provider` field):
|
|
20
|
+
* - `"openai"` — openai-compatible provider; `baseURL` defaults to
|
|
21
|
+
* `https://api.openai.com/v1`, override for any compatible endpoint
|
|
22
|
+
* - `"google"` — native `@ai-sdk/google` (gemini-embedding-*), no baseURL
|
|
23
|
+
* - `"cohere"` — native `@ai-sdk/cohere` (embed-*-v3.0), no baseURL
|
|
24
|
+
* - `"bedrock"` — native `@ai-sdk/amazon-bedrock` (titan/nova/cohere
|
|
25
|
+
* models), no baseURL — credentials come from AWS env (or the provider
|
|
26
|
+
* settings)
|
|
27
|
+
*
|
|
28
|
+
* `dimensions` is sent as a provider option where the API supports it
|
|
29
|
+
* (openaiCompatible.dimensions / google.outputDimensionality /
|
|
30
|
+
* cohere.outputDimension) and ALWAYS enforced on the output (some
|
|
31
|
+
* endpoints ignore the option).
|
|
32
|
+
*/
|
|
33
|
+
export declare const makeHostedEmbeddingModel: (options: HostedEmbeddingOptions) => EmbeddingModel;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type PackageManager } from "./internal/installer/index.js";
|
|
2
|
+
export type { InstallTarget, PackageManager } from "./internal/installer/index.js";
|
|
3
|
+
export { detectPackageManager } from "./internal/installer/index.js";
|
|
4
|
+
/** The install argv for a manager with the transformers package (kept for
|
|
5
|
+
* callers/tests that assert the shape). */
|
|
6
|
+
export declare const installCommand: (pm: PackageManager) => readonly [string, ...string[]];
|
|
7
|
+
/** Install transformers at the project root detected from `cwd`. The
|
|
8
|
+
* shared installer kills the child on timeout and dedups concurrent
|
|
9
|
+
* first-use installs; failures reject with the manual command. */
|
|
10
|
+
export declare const installTransformers: (cwd: string) => Promise<void>;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
export { Service as EmbeddingModelRegistry, type Interface as EmbeddingModelRegistryInterface, type EmbeddingModel, EmbeddingError, } from "./provider.ts";
|
|
2
|
-
export { layer as transformersEmbeddingLayer, layerConfig as transformersEmbeddingLayerConfig, makeTransformersModel, } from "./transformers.ts";
|
|
3
|
-
export { makeOpenAIModel } from "./openai.ts";
|
|
2
|
+
export { layer as transformersEmbeddingLayer, layerConfig as transformersEmbeddingLayerConfig, makeTransformersModel, buildSessionOptions, } from "./transformers.ts";
|
|
4
3
|
export { layer as registryLayer, type ModelSpec } from "./registry.ts";
|
|
@@ -1,16 +1,54 @@
|
|
|
1
1
|
import { Config, Layer } from "effect";
|
|
2
|
-
import type { DeviceType } from "@huggingface/transformers";
|
|
3
2
|
import { Service, type EmbeddingModel } from "./provider.ts";
|
|
3
|
+
/** Mirror of transformers.js's `DeviceType` (the config schema carries the
|
|
4
|
+
* same literals) — kept local so the optional peer's types never appear
|
|
5
|
+
* in this module's surface. */
|
|
6
|
+
type DeviceType = "auto" | "gpu" | "cpu" | "wasm" | "webgpu" | "cuda" | "dml" | "coreml" | "webnn";
|
|
7
|
+
/** The ORT session-options shape transformers.js forwards to
|
|
8
|
+
* onnxruntime-node (executionProviders with a bounded CUDA arena). */
|
|
9
|
+
interface OrtSessionOptions {
|
|
10
|
+
readonly executionProviders: readonly [
|
|
11
|
+
{
|
|
12
|
+
readonly name: string;
|
|
13
|
+
readonly device_id: number;
|
|
14
|
+
readonly gpu_mem_limit?: number;
|
|
15
|
+
readonly arena_extend_strategy?: 0 | 1;
|
|
16
|
+
}
|
|
17
|
+
];
|
|
18
|
+
}
|
|
19
|
+
/** Map the focused dimple-level pair to ORT's snake_case session keys.
|
|
20
|
+
* Both fields absent → `undefined`, so the caller can skip the whole
|
|
21
|
+
* sessionOptions (ORT defaults preserved). */
|
|
22
|
+
export declare const buildSessionOptions: (opts: {
|
|
23
|
+
readonly gpuMemLimit?: number | undefined;
|
|
24
|
+
readonly arenaExtendStrategy?: 0 | 1 | undefined;
|
|
25
|
+
}) => OrtSessionOptions;
|
|
4
26
|
interface TransformersOptions {
|
|
5
27
|
readonly modelId?: string;
|
|
6
28
|
readonly device?: DeviceType;
|
|
7
|
-
readonly dtype?: "fp32" | "fp16" | "q8" | "q4";
|
|
29
|
+
readonly dtype?: "fp32" | "fp16" | "q8" | "int8" | "uint8" | "q4" | "bnb4" | "q4f16" | "q2" | "q2f16" | "q1" | "q1f16";
|
|
8
30
|
readonly pooling?: "mean" | "cls" | "none";
|
|
9
31
|
readonly normalize?: boolean;
|
|
10
32
|
readonly cacheDir?: string;
|
|
33
|
+
/** ONNX Runtime CUDA session options — the verified fix for GPUs with
|
|
34
|
+
* limited VRAM (≤8GB): ORT's default arena is unbounded (grows by
|
|
35
|
+
* powers of two), so batch inference OOMs mid-run and leaves the
|
|
36
|
+
* process unable to allocate even a cublas handle afterwards. Forwarded
|
|
37
|
+
* to the pipeline's sessionOptions; absent = ORT defaults (CPU and
|
|
38
|
+
* ample-VRAM GPUs unaffected). */
|
|
39
|
+
readonly sessionOptions?: {
|
|
40
|
+
readonly gpuMemLimit?: number | undefined;
|
|
41
|
+
readonly arenaExtendStrategy?: 0 | 1 | undefined;
|
|
42
|
+
};
|
|
11
43
|
/** Declared output dimension — validated against the model's actual
|
|
12
44
|
* output on first embed (a mismatch fails typed, precisely). */
|
|
13
45
|
readonly dimensions?: number;
|
|
46
|
+
/** First-use auto-install of the optional `@huggingface/transformers`
|
|
47
|
+
* peer (default true): the config declaring a transformers provider is
|
|
48
|
+
* explicit intent — the missing package is installed with the project's
|
|
49
|
+
* own package manager (scripts skipped; proven unnecessary for
|
|
50
|
+
* embedding). Set false to require a manual install. */
|
|
51
|
+
readonly autoInstall?: boolean;
|
|
14
52
|
}
|
|
15
53
|
export declare const makeTransformersModel: (options?: TransformersOptions) => EmbeddingModel;
|
|
16
54
|
export declare const layer: (options?: TransformersOptions) => Layer.Layer<Service>;
|
|
@@ -15,6 +15,13 @@ export declare const ExtractedChunk: Schema.Struct<{
|
|
|
15
15
|
readonly endLine: Schema.Number;
|
|
16
16
|
readonly language: Schema.String;
|
|
17
17
|
readonly docstring: Schema.optional<Schema.String>;
|
|
18
|
+
/** Call sites inside this definition — the code_calls edge source:
|
|
19
|
+
* `[{ name, line }]`, callee names only (member/property calls unwrap
|
|
20
|
+
* to the property name). */
|
|
21
|
+
readonly calls: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
22
|
+
readonly name: Schema.String;
|
|
23
|
+
readonly line: Schema.Number;
|
|
24
|
+
}>>>;
|
|
18
25
|
}>;
|
|
19
26
|
export interface ExtractedChunk extends Schema.Schema.Type<typeof ExtractedChunk> {
|
|
20
27
|
}
|
|
@@ -40,6 +47,13 @@ export declare const ExtractedFile: Schema.Struct<{
|
|
|
40
47
|
readonly endLine: Schema.Number;
|
|
41
48
|
readonly language: Schema.String;
|
|
42
49
|
readonly docstring: Schema.optional<Schema.String>;
|
|
50
|
+
/** Call sites inside this definition — the code_calls edge source:
|
|
51
|
+
* `[{ name, line }]`, callee names only (member/property calls unwrap
|
|
52
|
+
* to the property name). */
|
|
53
|
+
readonly calls: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
54
|
+
readonly name: Schema.String;
|
|
55
|
+
readonly line: Schema.Number;
|
|
56
|
+
}>>>;
|
|
43
57
|
}>>;
|
|
44
58
|
readonly imports: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
45
59
|
readonly source: Schema.String;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export type PackageManager = "bun" | "npm" | "pnpm" | "yarn";
|
|
2
|
+
export interface InstallTarget {
|
|
3
|
+
readonly pm: PackageManager;
|
|
4
|
+
readonly root: string;
|
|
5
|
+
}
|
|
6
|
+
export declare class InstallerError extends Error {
|
|
7
|
+
constructor(message: string);
|
|
8
|
+
}
|
|
9
|
+
/** Detect the project's package manager by walking UP from `cwd` for a
|
|
10
|
+
* lockfile. NO lockfile → npm (the most universal — a bun fallback broke
|
|
11
|
+
* Node-only machines with ENOENT). */
|
|
12
|
+
export declare const detectPackageManager: (cwd: string) => InstallTarget;
|
|
13
|
+
/** The executable name for a manager. win32 ships `.cmd` shims for
|
|
14
|
+
* npm/pnpm/yarn — the bare names fail with ENOENT. */
|
|
15
|
+
export declare const resolveExecutable: (pm: PackageManager, platform?: NodeJS.Platform) => string;
|
|
16
|
+
/** The base install argv for a manager. Scripts are skipped everywhere;
|
|
17
|
+
* pnpm at a workspace root additionally gets `-w`. */
|
|
18
|
+
export declare const installArgs: (pm: PackageManager, packages: readonly string[], root: string) => string[];
|
|
19
|
+
export interface InstallOptions {
|
|
20
|
+
readonly cwd?: string;
|
|
21
|
+
/** Hard deadline; the child is SIGKILLed when it trips (default 5 min). */
|
|
22
|
+
readonly timeoutMs?: number;
|
|
23
|
+
/** Injectable for tests (defaults to process.platform). */
|
|
24
|
+
readonly platform?: NodeJS.Platform;
|
|
25
|
+
}
|
|
26
|
+
export declare const installOptionalPeers: (packages: readonly string[], opts?: InstallOptions) => Promise<void>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { Service as Logging, layer as loggingLayer, layerConfig as loggingLayerConfig,
|
|
1
|
+
export { Service as Logging, layer as loggingLayer, layerConfig as loggingLayerConfig, makeEffect as makeLogging, consoleSink, fileSink, effectLogger, type Sink, type Interface as LoggingInterface, type StructuredOutput, } from "./service.ts";
|
|
2
2
|
export { LogConfig, LogLevel, SEV_NUM, LEVEL_ORDER, type LogEntry } from "./types.ts";
|
|
3
3
|
export { RingBuffer, type RingFrame, type Subscriber } from "./ring.ts";
|
|
4
4
|
export { renderJson, renderPretty } from "./format.ts";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Config, Context, Layer, Logger } from "effect";
|
|
1
|
+
import { Config, Context, Effect, Layer, Logger, Schema } from "effect";
|
|
2
2
|
import type { Scope } from "effect/Scope";
|
|
3
3
|
import { RingBuffer } from "./ring.ts";
|
|
4
4
|
import { type LogConfig, type LogEntry } from "./types.ts";
|
|
@@ -9,35 +9,54 @@ export interface Sink {
|
|
|
9
9
|
/** Receives the ENTRY — each sink renders it its own way (pretty on the
|
|
10
10
|
* console, JSONL in the file and ring). */
|
|
11
11
|
readonly write: (entry: LogEntry) => void;
|
|
12
|
-
readonly dispose: () => void
|
|
12
|
+
readonly dispose: () => void | Promise<void>;
|
|
13
13
|
}
|
|
14
14
|
export declare const consoleSink: (pretty: boolean) => Sink;
|
|
15
|
-
/**
|
|
15
|
+
/**
|
|
16
|
+
* Append-per-event file sink (the pino model): each rendered line goes
|
|
16
17
|
* straight to the fd and the OS page cache does the buffering; `fsync`
|
|
17
18
|
* runs on process exit and on dispose. NOT sync-flush-per-event (kills
|
|
18
|
-
* throughput), NOT end-of-run dumps (lose everything on crash).
|
|
19
|
-
|
|
19
|
+
* throughput), NOT end-of-run dumps (lose everything on crash).
|
|
20
|
+
*
|
|
21
|
+
* `node:fs` loads LAZILY (dynamic import) — the module stays free of
|
|
22
|
+
* static node imports, so the worker bundle builds anywhere; a file sink
|
|
23
|
+
* is never configured on edge.
|
|
24
|
+
*/
|
|
25
|
+
export declare const fileSink: (path: string) => Effect.Effect<Sink>;
|
|
20
26
|
export interface Interface {
|
|
21
27
|
readonly emit: (entry: LogEntry) => void;
|
|
22
28
|
/** Live tail mirror: pre-rendered JSONL lines, drop-oldest, NOT durable. */
|
|
23
29
|
readonly ring: RingBuffer;
|
|
24
|
-
readonly dispose: () => void
|
|
30
|
+
readonly dispose: () => void | Promise<void>;
|
|
25
31
|
}
|
|
26
32
|
declare const Service_base: Context.ServiceClass<Service, "@dimple/logger/Logging", Interface>;
|
|
27
33
|
export declare class Service extends Service_base {
|
|
28
34
|
}
|
|
29
|
-
|
|
30
|
-
|
|
35
|
+
/** Effect variant of `make` — builds the file sink through lazy `node:fs`
|
|
36
|
+
* (see `fileSink`; the console sink is sync). */
|
|
37
|
+
export declare const makeEffect: (config: LogConfig) => Effect.Effect<Interface>;
|
|
38
|
+
/** Effect log messages: strings pass through, arrays are joined, anything
|
|
39
|
+
* else renders as JSON (the `Logger.formatStructured` message contract).
|
|
40
|
+
* The schema is total for the values Effect actually emits; the caller
|
|
41
|
+
* supplies the JSON fallback when decoding fails. */
|
|
42
|
+
declare const LogMessage: Schema.Union<readonly [Schema.String, Schema.$Array<Schema.Unknown>]>;
|
|
43
|
+
type LogMessage = Schema.Schema.Type<typeof LogMessage>;
|
|
44
|
+
/** The structured shape after boundary decoding of Effect's raw
|
|
45
|
+
* `Logger.formatStructured` output (annotations carry arbitrary JSON
|
|
46
|
+
* values; the decode happens in `effectLogger` before `toEntry`). */
|
|
31
47
|
export interface StructuredOutput {
|
|
32
48
|
readonly level: string;
|
|
33
49
|
readonly fiberId: string;
|
|
34
50
|
readonly timestamp: string;
|
|
35
|
-
readonly message:
|
|
51
|
+
readonly message: LogMessage;
|
|
36
52
|
readonly cause: string | undefined;
|
|
37
|
-
readonly annotations: Record<string,
|
|
38
|
-
readonly spans: Record<string, number
|
|
53
|
+
readonly annotations: Readonly<Record<string, Schema.Json>>;
|
|
54
|
+
readonly spans: Readonly<Record<string, number>>;
|
|
39
55
|
}
|
|
40
|
-
/** The Effect `Logger` that feeds the Logging service.
|
|
56
|
+
/** The Effect `Logger` that feeds the Logging service. The raw structured
|
|
57
|
+
* output is decoded at this boundary: annotations may carry arbitrary
|
|
58
|
+
* values, so each is decoded as JSON (non-JSON payloads degrade to their
|
|
59
|
+
* JSON rendering, keeping the JSONL sink lossless). */
|
|
41
60
|
export declare const effectLogger: (logging: Interface) => Logger.Logger<unknown, void>;
|
|
42
61
|
/** Installs the Logging service AND replaces Effect's default logger with
|
|
43
62
|
* the adapter feeding it. `mergeWithExisting: false` — one logger
|
|
@@ -6,8 +6,20 @@ export type LogLevel = "trace" | "debug" | "info" | "warn" | "error";
|
|
|
6
6
|
export declare const LogLevel: Schema.Literals<readonly ["trace", "debug", "info", "warn", "error"]>;
|
|
7
7
|
/** OTel severity numbers (logs data model): TRACE=1, DEBUG=5, INFO=9,
|
|
8
8
|
* WARN=13, ERROR=17. */
|
|
9
|
-
export declare const SEV_NUM:
|
|
10
|
-
|
|
9
|
+
export declare const SEV_NUM: {
|
|
10
|
+
trace: number;
|
|
11
|
+
debug: number;
|
|
12
|
+
info: number;
|
|
13
|
+
warn: number;
|
|
14
|
+
error: number;
|
|
15
|
+
};
|
|
16
|
+
export declare const LEVEL_ORDER: {
|
|
17
|
+
trace: number;
|
|
18
|
+
debug: number;
|
|
19
|
+
info: number;
|
|
20
|
+
warn: number;
|
|
21
|
+
error: number;
|
|
22
|
+
};
|
|
11
23
|
export declare const LogConfig: Schema.Struct<{
|
|
12
24
|
readonly enabled: Schema.withDecodingDefaultType<Schema.optional<Schema.Boolean>, never>;
|
|
13
25
|
readonly level: Schema.withDecodingDefaultType<Schema.optional<Schema.Literals<readonly ["trace", "debug", "info", "warn", "error"]>>, never>;
|
|
@@ -34,6 +46,6 @@ export interface LogEntry {
|
|
|
34
46
|
readonly fiber: string;
|
|
35
47
|
readonly traceId?: string;
|
|
36
48
|
readonly spanId?: string;
|
|
37
|
-
readonly attrs: Record<string,
|
|
49
|
+
readonly attrs: Record<string, Schema.Json>;
|
|
38
50
|
readonly cause?: string;
|
|
39
51
|
}
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import { Effect } from "effect";
|
|
2
|
+
import type { RetrievalAuditRow } from "./models.ts";
|
|
2
3
|
import { JobFailure, type Handler, type JobContext } from "./internal/workflow/index.js";
|
|
3
4
|
import { Service as DbBackend } from "./db-backend.ts";
|
|
4
5
|
import type { Interface as DbBackendInterface } from "./db-backend.ts";
|
|
6
|
+
/** The decoded `audit.write` payload — mirrors the queue definition's
|
|
7
|
+
* schema (`{ rows }`); the executor decodes before calling. */
|
|
8
|
+
export interface AuditWritePayload {
|
|
9
|
+
readonly rows: ReadonlyArray<RetrievalAuditRow>;
|
|
10
|
+
}
|
|
5
11
|
/** The `audit.write` handler shape (see queue.ts). */
|
|
6
|
-
export type AuditWriteHandler = (payload:
|
|
12
|
+
export type AuditWriteHandler = (payload: AuditWritePayload, ctx: JobContext) => Effect.Effect<unknown, JobFailure, DbBackend>;
|
|
7
13
|
/**
|
|
8
14
|
* Factory for the `audit.write` job handler. Payload: `{ rows }` — one or
|
|
9
15
|
* more `retrieval_log` rows enqueued by the store's `enqueueAudit` seam
|
|
@@ -54,12 +54,23 @@ export interface GraphNeighborsOptions {
|
|
|
54
54
|
readonly maxNeighbors?: number;
|
|
55
55
|
readonly maxTotal?: number;
|
|
56
56
|
readonly includePending?: boolean;
|
|
57
|
+
/** Restrict traversal to these edge kinds (default: all). The common
|
|
58
|
+
* ask is memory-only navigation: pass the three `memory_*` kinds to
|
|
59
|
+
* keep the topic/concept legs out of the answer. */
|
|
60
|
+
readonly edgeKinds?: readonly string[];
|
|
57
61
|
/** Optional scope for the topic legs of the view (topic edges are
|
|
58
62
|
* model-scoped by PK). `undefined` unions every model's topic edges —
|
|
59
63
|
* the intended default (topic edges are retrieval context regardless
|
|
60
64
|
* of the model that wrote them). */
|
|
61
65
|
readonly modelKey?: string;
|
|
62
66
|
}
|
|
67
|
+
/** Metadata filter keys for `queryByMetadata` — `topic` (LIKE on
|
|
68
|
+
* `$.topics`) and `sourceType` (equality on `$.sourceType`); unknown keys
|
|
69
|
+
* are ignored (see the SQL in libsql-backend). */
|
|
70
|
+
export interface MetadataFilter {
|
|
71
|
+
readonly topic?: string;
|
|
72
|
+
readonly sourceType?: string;
|
|
73
|
+
}
|
|
63
74
|
export interface Interface {
|
|
64
75
|
readonly runMigrations: () => Effect.Effect<void, StoreError>;
|
|
65
76
|
/**
|
|
@@ -77,31 +88,58 @@ export interface Interface {
|
|
|
77
88
|
* `limit` bounds the rows (0 = unbounded); `modelKey` optionally scopes
|
|
78
89
|
* to the model's active population.
|
|
79
90
|
*/
|
|
80
|
-
readonly listIsolatedMemories: (limit: number, modelKey?: string) => Effect.Effect<readonly
|
|
91
|
+
readonly listIsolatedMemories: (limit: number, modelKey?: string) => Effect.Effect<readonly unknown[], StoreError>;
|
|
81
92
|
readonly db: DrizzleDB;
|
|
82
93
|
readonly tables: StoreTables;
|
|
83
|
-
readonly ftsSearch: (query: string, namespace: string, limit: number, topicKeys?: ReadonlyArray<string>, modelKey?: string
|
|
84
|
-
|
|
94
|
+
readonly ftsSearch: (query: string, namespace: string, limit: number, topicKeys?: ReadonlyArray<string>, modelKey?: string, contentType?: string | ReadonlyArray<string>,
|
|
95
|
+
/** Include the 384-float `embedding` blob per row (default false —
|
|
96
|
+
* search results never need vectors; write paths read them via
|
|
97
|
+
* fetchMemoryVectors). */
|
|
98
|
+
includeEmbedding?: boolean) => Effect.Effect<readonly unknown[], StoreError>;
|
|
99
|
+
readonly vectorSearch: (query: ReadonlyArray<number>, namespace: string, limit: number, model: EmbeddingModelConfig, topicKeys?: ReadonlyArray<string>, contentType?: string | ReadonlyArray<string>, includeEmbedding?: boolean) => Effect.Effect<readonly unknown[], StoreError>;
|
|
85
100
|
readonly sweep: (namespace: string) => Effect.Effect<SweepResult, StoreError>;
|
|
101
|
+
/** The DB's tables + columns (`dimple db-schema` surface). */
|
|
102
|
+
readonly listSchema: () => Effect.Effect<ReadonlyArray<{
|
|
103
|
+
readonly table: string;
|
|
104
|
+
readonly columns: ReadonlyArray<{
|
|
105
|
+
readonly name: string;
|
|
106
|
+
readonly type: string;
|
|
107
|
+
}>;
|
|
108
|
+
}>, StoreError>;
|
|
86
109
|
/** Persist retrieval-audit rows (`retrieval_log`). Owned by the backend
|
|
87
110
|
* so the `audit.write` job handler stays dialect-neutral. */
|
|
88
111
|
readonly writeAuditRows: (rows: readonly RetrievalAuditRow[]) => Effect.Effect<void, StoreError>;
|
|
89
112
|
/** Metadata-filtered memory lookup (the one
|
|
90
113
|
* `json_extract` (SQLite) / `->` (PG) portability wart, now backend-owned
|
|
91
|
-
* like `ftsSearch`). Raw SQL, returns
|
|
92
|
-
*
|
|
93
|
-
*
|
|
114
|
+
* like `ftsSearch`). Raw SQL, returns raw rows — the store casts once at
|
|
115
|
+
* the boundary. Supported filter keys mirror the old store-level SQL
|
|
116
|
+
* exactly: `topic` (LIKE on `$.topics`) and `sourceType`
|
|
94
117
|
* (equality on `$.sourceType`); unknown keys are ignored. `limit` is
|
|
95
118
|
* optional — omitted means no LIMIT. */
|
|
96
|
-
readonly queryByMetadata: (filter:
|
|
97
|
-
readonly graphNeighbors: (kind: "memory" | "topic" | "concept", id: string, opts?: GraphNeighborsOptions) => Effect.Effect<readonly
|
|
119
|
+
readonly queryByMetadata: (filter: MetadataFilter, limit?: number) => Effect.Effect<readonly unknown[], StoreError>;
|
|
120
|
+
readonly graphNeighbors: (kind: "memory" | "topic" | "concept", id: string, opts?: GraphNeighborsOptions) => Effect.Effect<readonly unknown[], StoreError>;
|
|
98
121
|
readonly ensureVectorTable: (model: EmbeddingModelConfig) => Effect.Effect<void, StoreError>;
|
|
99
122
|
readonly insertVector: (memoryId: string, vector: ReadonlyArray<number>, model: EmbeddingModelConfig) => Effect.Effect<void, StoreError>;
|
|
123
|
+
/** Batch variant of `insertVector` — one multi-row statement (bulk
|
|
124
|
+
* ingest: per-memory statements dominate the write path). */
|
|
125
|
+
readonly insertVectors: (entries: ReadonlyArray<{
|
|
126
|
+
readonly memoryId: string;
|
|
127
|
+
readonly vector: ReadonlyArray<number>;
|
|
128
|
+
}>, model: EmbeddingModelConfig) => Effect.Effect<void, StoreError>;
|
|
100
129
|
readonly deleteVector: (memoryId: string, dimensions: number) => Effect.Effect<void, StoreError>;
|
|
101
130
|
readonly ensureTopicVectorTable: (model: EmbeddingModelConfig) => Effect.Effect<void, StoreError>;
|
|
102
131
|
readonly upsertTopicVector: (topicKey: string, sumVector: ReadonlyArray<number>, model: EmbeddingModelConfig) => Effect.Effect<void, StoreError>;
|
|
132
|
+
/** Batch variant of `upsertTopicVector` — one multi-row statement (the
|
|
133
|
+
* bulk-routing path: sequential per-key upserts dominate batch ingest). */
|
|
134
|
+
readonly upsertTopicVectors: (entries: ReadonlyArray<{
|
|
135
|
+
readonly topicKey: string;
|
|
136
|
+
readonly sumVector: ReadonlyArray<number>;
|
|
137
|
+
}>, model: EmbeddingModelConfig) => Effect.Effect<void, StoreError>;
|
|
103
138
|
readonly deleteTopicVectors: (model: EmbeddingModelConfig) => Effect.Effect<void, StoreError>;
|
|
104
139
|
readonly fetchTopicVectors: (model: EmbeddingModelConfig) => Effect.Effect<ReadonlyArray<TopicVectorRow>, StoreError>;
|
|
140
|
+
/** Single-row variant — the forget path's per-ancestor maintenance
|
|
141
|
+
* re-read the WHOLE table per level before (O(depth × N) decodes). */
|
|
142
|
+
readonly fetchTopicVector: (topicKey: string, model: EmbeddingModelConfig) => Effect.Effect<TopicVectorRow | undefined, StoreError>;
|
|
105
143
|
readonly fetchMemoryVectors: (memoryIds: ReadonlyArray<string>, model: EmbeddingModelConfig) => Effect.Effect<ReadonlyArray<MemoryVectorRow>, StoreError>;
|
|
106
144
|
readonly listMemoryIds: (model: EmbeddingModelConfig) => Effect.Effect<ReadonlyArray<string>, StoreError>;
|
|
107
145
|
}
|
|
@@ -42,7 +42,7 @@ export interface CandidateMember {
|
|
|
42
42
|
readonly metadata?: string | null;
|
|
43
43
|
}
|
|
44
44
|
/** Which rule produced a candidate (the provenance on `EdgeCandidate`). */
|
|
45
|
-
export type CandidateKind = "near-duplicate" | "conflict-band" | "identity";
|
|
45
|
+
export type CandidateKind = "near-duplicate" | "conflict-band" | "identity" | "rename";
|
|
46
46
|
/** One rule-derived edge proposal from `leafLocalCandidates`. */
|
|
47
47
|
export interface EdgeCandidate {
|
|
48
48
|
readonly fromMemoryId: string;
|
|
@@ -81,6 +81,8 @@ export interface GraphCandidatesOptions {
|
|
|
81
81
|
/** Max pending candidates returned (clamped to [1, 200]; default 50). */
|
|
82
82
|
readonly limit?: number;
|
|
83
83
|
}
|
|
84
|
+
/** Cosine similarity of two vectors (equal-length; zero norm ⇒ 0). */
|
|
85
|
+
export declare const cosineSimilarity: (a: Float32Array, b: Float32Array) => number;
|
|
84
86
|
/**
|
|
85
87
|
* The leaf-local candidate scan: compare the new memory against its
|
|
86
88
|
* leaf-mates (per the module rules) and return at most one candidate per
|
|
@@ -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:
|
|
@@ -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
|
|
@@ -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[];
|