@ponraaj/dimple-sdk 0.0.0-alpha.1

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 (101) hide show
  1. package/dist/config.d.ts +13 -0
  2. package/dist/dimple.d.ts +101 -0
  3. package/dist/errors.d.ts +63 -0
  4. package/dist/index.d.ts +4 -0
  5. package/dist/index.js +8430 -0
  6. package/dist/indexer.d.ts +43 -0
  7. package/dist/internal/config/index.d.ts +4 -0
  8. package/dist/internal/config/loader.d.ts +9 -0
  9. package/dist/internal/config/schema.d.ts +176 -0
  10. package/dist/internal/config/service.d.ts +10 -0
  11. package/dist/internal/core/core.d.ts +95 -0
  12. package/dist/internal/core/index.d.ts +3 -0
  13. package/dist/internal/core/layer.d.ts +21 -0
  14. package/dist/internal/embedder/index.d.ts +4 -0
  15. package/dist/internal/embedder/openai.d.ts +8 -0
  16. package/dist/internal/embedder/provider.d.ts +29 -0
  17. package/dist/internal/embedder/registry.d.ts +10 -0
  18. package/dist/internal/embedder/transformers.d.ts +18 -0
  19. package/dist/internal/extractor/code-extractor.d.ts +15 -0
  20. package/dist/internal/extractor/content-handler.d.ts +17 -0
  21. package/dist/internal/extractor/index.d.ts +4 -0
  22. package/dist/internal/extractor/languages/index.d.ts +24 -0
  23. package/dist/internal/extractor/languages/javascript.d.ts +22 -0
  24. package/dist/internal/extractor/languages/typescript.d.ts +20 -0
  25. package/dist/internal/extractor/models/extraction.d.ts +53 -0
  26. package/dist/internal/llm/dream-classifier.d.ts +14 -0
  27. package/dist/internal/llm/index.d.ts +4 -0
  28. package/dist/internal/llm/llm.d.ts +54 -0
  29. package/dist/internal/llm/provider.d.ts +14 -0
  30. package/dist/internal/llm/service.d.ts +29 -0
  31. package/dist/internal/logger/format.d.ts +6 -0
  32. package/dist/internal/logger/index.d.ts +4 -0
  33. package/dist/internal/logger/ring.d.ts +33 -0
  34. package/dist/internal/logger/service.d.ts +50 -0
  35. package/dist/internal/logger/types.d.ts +39 -0
  36. package/dist/internal/parser/code-parser.d.ts +12 -0
  37. package/dist/internal/parser/index.d.ts +7 -0
  38. package/dist/internal/parser/language-store.d.ts +12 -0
  39. package/dist/internal/parser/models/parseRequest.d.ts +17 -0
  40. package/dist/internal/parser/models/treeHandle.d.ts +23 -0
  41. package/dist/internal/parser/tree-sitter-engine.d.ts +15 -0
  42. package/dist/internal/retriever/hybrid.d.ts +48 -0
  43. package/dist/internal/retriever/index.d.ts +3 -0
  44. package/dist/internal/retriever/rrf.d.ts +11 -0
  45. package/dist/internal/shared/errors/index.d.ts +2 -0
  46. package/dist/internal/shared/errors/parser.d.ts +21 -0
  47. package/dist/internal/shared/errors/wasm.d.ts +28 -0
  48. package/dist/internal/shared/types/index.d.ts +1 -0
  49. package/dist/internal/shared/types/language.d.ts +3 -0
  50. package/dist/internal/store/audit.d.ts +21 -0
  51. package/dist/internal/store/db-backend.d.ts +111 -0
  52. package/dist/internal/store/drizzle-schema.d.ts +1 -0
  53. package/dist/internal/store/error.d.ts +19 -0
  54. package/dist/internal/store/fnv1a32.d.ts +14 -0
  55. package/dist/internal/store/generated-migrations.d.ts +15 -0
  56. package/dist/internal/store/graph/candidates.d.ts +93 -0
  57. package/dist/internal/store/graph/concepts.d.ts +169 -0
  58. package/dist/internal/store/graph/dream.d.ts +171 -0
  59. package/dist/internal/store/graph/errors.d.ts +25 -0
  60. package/dist/internal/store/graph/index.d.ts +15 -0
  61. package/dist/internal/store/graph/observability.d.ts +37 -0
  62. package/dist/internal/store/graph/repair.d.ts +85 -0
  63. package/dist/internal/store/graph/retrieval-post-pass.d.ts +58 -0
  64. package/dist/internal/store/graph/traversal.d.ts +39 -0
  65. package/dist/internal/store/index.d.ts +38 -0
  66. package/dist/internal/store/libsql-backend.d.ts +18 -0
  67. package/dist/internal/store/models.d.ts +122 -0
  68. package/dist/internal/store/schema/graph.d.ts +970 -0
  69. package/dist/internal/store/schema/index.d.ts +7 -0
  70. package/dist/internal/store/schema/libsql.d.ts +2356 -0
  71. package/dist/internal/store/schema/metadata.d.ts +51 -0
  72. package/dist/internal/store/schema/topics.d.ts +1966 -0
  73. package/dist/internal/store/service.d.ts +162 -0
  74. package/dist/internal/store/store.d.ts +70 -0
  75. package/dist/internal/store/topics/errors.d.ts +39 -0
  76. package/dist/internal/store/topics/index.d.ts +24 -0
  77. package/dist/internal/store/topics/jobs.d.ts +149 -0
  78. package/dist/internal/store/topics/lifecycle.d.ts +126 -0
  79. package/dist/internal/store/topics/maintenance.d.ts +110 -0
  80. package/dist/internal/store/topics/observability.d.ts +102 -0
  81. package/dist/internal/store/topics/query.d.ts +43 -0
  82. package/dist/internal/store/topics/routing.d.ts +90 -0
  83. package/dist/internal/store/topics/topic-vectors.d.ts +24 -0
  84. package/dist/internal/store/topics/tree.d.ts +181 -0
  85. package/dist/internal/wasm/grammar-store.d.ts +14 -0
  86. package/dist/internal/wasm/index.d.ts +5 -0
  87. package/dist/internal/wasm/wasm-cache.d.ts +17 -0
  88. package/dist/internal/wasm/wasm-downloader.d.ts +10 -0
  89. package/dist/internal/wasm/wasm-registry.d.ts +16 -0
  90. package/dist/internal/workflow/config.d.ts +39 -0
  91. package/dist/internal/workflow/engine.d.ts +54 -0
  92. package/dist/internal/workflow/errors.d.ts +77 -0
  93. package/dist/internal/workflow/executor.d.ts +53 -0
  94. package/dist/internal/workflow/index.d.ts +13 -0
  95. package/dist/internal/workflow/persistence.d.ts +122 -0
  96. package/dist/internal/workflow/queue-store.d.ts +5 -0
  97. package/dist/internal/workflow/queue.d.ts +298 -0
  98. package/dist/internal/workflow/registry.d.ts +57 -0
  99. package/dist/internal/workflow/runtime.d.ts +161 -0
  100. package/dist/make.d.ts +27 -0
  101. package/package.json +45 -0
@@ -0,0 +1,43 @@
1
+ import type { LanguageId } from "./internal/parser/index.js";
2
+ /**
3
+ * The platform side of `Dimple.index` — directory walking + capped reads
4
+ * + extension→language mapping. Isolated here (and exempted from the
5
+ * no-node-apis lint rule as platform code) so the facade stays pure.
6
+ *
7
+ * `walkFiles` is SYNC on purpose: indexing is an offline batch operation,
8
+ * and a sync walk keeps per-file ordering deterministic. It never throws —
9
+ * stat/read failures become per-file entries the facade surfaces.
10
+ */
11
+ /** Extensions mapped to tree-sitter languages the extractor understands. */
12
+ export declare const INDEXABLE_EXTENSIONS: readonly string[];
13
+ export declare const languageForPath: (path: string) => LanguageId | undefined;
14
+ export interface WalkResult {
15
+ /** Files that will be parsed (supported extension, within included dirs). */
16
+ readonly files: readonly string[];
17
+ /** Files skipped because the extension is not indexable (count only). */
18
+ readonly unsupported: number;
19
+ /** Files that could not be stat'd/read (broken symlinks, permissions). */
20
+ readonly errors: readonly {
21
+ readonly filePath: string;
22
+ readonly message: string;
23
+ }[];
24
+ /** Key root — keys are made relative to it. Anchored at the CWD so the
25
+ * SAME file always gets the SAME key regardless of which path list was
26
+ * passed (idempotent re-indexing across invocation shapes). */
27
+ readonly root: string;
28
+ }
29
+ /** Recursively collect indexable files from paths (dirs or files). */
30
+ export declare const walkFiles: (paths: readonly string[], extensions: readonly string[]) => WalkResult;
31
+ /** Read a file's text, capped at `maxBytes` (string slice = char-safe). */
32
+ export declare const readCapped: (path: string, maxBytes: number) => string;
33
+ /** Resolve a file's relative import specifiers to indexed-tree files
34
+ * (bare/absolute specifiers are external modules — no node_modules
35
+ * resolution). */
36
+ export declare const resolveImports: (filePath: string, sources: readonly string[], extensions: readonly string[]) => readonly string[];
37
+ /** Longest common ancestor of the resolved input paths — keys are made
38
+ * relative to it so they stay stable across runs and cwds (indexing the
39
+ * same tree twice yields the same keys → idempotent re-index). */
40
+ export declare const commonRoot: (paths: readonly string[]) => string;
41
+ /** Relative path for keys: strip the common root so keys are stable across
42
+ * runs (indexing the same tree from a different cwd yields the same keys). */
43
+ export declare const keyForPath: (root: string, filePath: string) => string;
@@ -0,0 +1,4 @@
1
+ export { DimpleConfig, EmbeddingModelConfig, EmbeddingConfig, IndexConfig, JobsConfig, TopicsConfig, } from "./schema.ts";
2
+ export type { DimpleConfig as DimpleConfigType, EmbeddingModelConfig as EmbeddingModelConfigType, EmbeddingConfig as EmbeddingConfigType, IndexConfig as IndexConfigType, JobsConfig as JobsConfigType, TopicsConfig as TopicsConfigType, } from "./schema.ts";
3
+ export { Service, layer } from "./service.ts";
4
+ export { loadConfig, loadConfigFromFile } from "./loader.ts";
@@ -0,0 +1,9 @@
1
+ import { Effect } from "effect";
2
+ import { type DimpleConfig as DimpleConfigType } from "./schema.ts";
3
+ /** Resolve a config from an EXPLICIT file path — the SDK's `config:
4
+ * "path/to/dimple.jsonc"` input. Merges the standard defaults and
5
+ * `${ENV_VAR}` resolution over the file's content. Strict JSONC: parser
6
+ * errors (missing braces, trailing garbage) reject the file instead of
7
+ * silently booting from the valid prefix. */
8
+ export declare const loadConfigFromFile: (path: string) => Effect.Effect<DimpleConfigType, Error>;
9
+ export declare const loadConfig: (overrides?: Partial<DimpleConfigType>) => Effect.Effect<DimpleConfigType, Error>;
@@ -0,0 +1,176 @@
1
+ import { Schema } from "effect";
2
+ export declare const IndexConfig: Schema.Struct<{
3
+ readonly compressNeighbors: Schema.optional<Schema.String>;
4
+ readonly maxNeighbors: Schema.optional<Schema.Number>;
5
+ readonly searchL: Schema.optional<Schema.Number>;
6
+ }>;
7
+ export interface IndexConfig extends Schema.Schema.Type<typeof IndexConfig> {
8
+ }
9
+ export declare const EmbeddingModelConfig: Schema.Struct<{
10
+ readonly id: Schema.String;
11
+ readonly provider: Schema.String;
12
+ readonly model: Schema.String;
13
+ readonly dimensions: Schema.Number;
14
+ readonly vectorType: Schema.optional<Schema.String>;
15
+ readonly apiKey: Schema.optional<Schema.String>;
16
+ readonly indexConfig: Schema.optional<Schema.Struct<{
17
+ readonly compressNeighbors: Schema.optional<Schema.String>;
18
+ readonly maxNeighbors: Schema.optional<Schema.Number>;
19
+ readonly searchL: Schema.optional<Schema.Number>;
20
+ }>>;
21
+ }>;
22
+ export interface EmbeddingModelConfig extends Schema.Schema.Type<typeof EmbeddingModelConfig> {
23
+ }
24
+ export declare const EmbeddingConfig: Schema.Struct<{
25
+ readonly defaultModel: Schema.String;
26
+ readonly models: Schema.$Array<Schema.Struct<{
27
+ readonly id: Schema.String;
28
+ readonly provider: Schema.String;
29
+ readonly model: Schema.String;
30
+ readonly dimensions: Schema.Number;
31
+ readonly vectorType: Schema.optional<Schema.String>;
32
+ readonly apiKey: Schema.optional<Schema.String>;
33
+ readonly indexConfig: Schema.optional<Schema.Struct<{
34
+ readonly compressNeighbors: Schema.optional<Schema.String>;
35
+ readonly maxNeighbors: Schema.optional<Schema.Number>;
36
+ readonly searchL: Schema.optional<Schema.Number>;
37
+ }>>;
38
+ }>>;
39
+ }>;
40
+ export interface EmbeddingConfig extends Schema.Schema.Type<typeof EmbeddingConfig> {
41
+ }
42
+ export declare const JobsConfig: Schema.Struct<{
43
+ readonly dbUrl: Schema.optional<Schema.String>;
44
+ readonly execution: Schema.optional<Schema.Literals<readonly ["background", "inline", "external"]>>;
45
+ readonly concurrency: Schema.optional<Schema.Number>;
46
+ readonly leaseTimeoutMs: Schema.optional<Schema.Number>;
47
+ readonly maxAttempts: Schema.optional<Schema.refine<number, Schema.Number>>;
48
+ readonly pollIntervalMs: Schema.optional<Schema.Number>;
49
+ }>;
50
+ export interface JobsConfig extends Schema.Schema.Type<typeof JobsConfig> {
51
+ }
52
+ /**
53
+ * Topic-tree configuration. `@dimple/config` cannot import
54
+ * `@dimple/store` (dependency direction: store → config), so this is a
55
+ * structurally-identical mirror of `packages/store/src/schema/topics.ts`
56
+ * `TopicConfig` — keep the two in sync. Decoding fills the same defaults, so
57
+ * a decoded `TopicsConfig` is assignable to the store's `TopicConfig`.
58
+ */
59
+ export declare const TopicsConfig: Schema.Struct<{
60
+ readonly maxLeafItems: Schema.withDecodingDefaultType<Schema.optional<Schema.Number>, never>;
61
+ readonly minLeafItems: Schema.withDecodingDefaultType<Schema.optional<Schema.Number>, never>;
62
+ readonly maxChildren: Schema.withDecodingDefaultType<Schema.optional<Schema.Number>, never>;
63
+ readonly minChildren: Schema.withDecodingDefaultType<Schema.optional<Schema.Number>, never>;
64
+ readonly maxDepth: Schema.withDecodingDefaultType<Schema.optional<Schema.Number>, never>;
65
+ readonly beamWidth: Schema.withDecodingDefaultType<Schema.optional<Schema.Number>, never>;
66
+ readonly splitDeferredHardLimit: Schema.withDecodingDefaultType<Schema.optional<Schema.Number>, never>;
67
+ readonly rebalanceCooldownMs: Schema.withDecodingDefaultType<Schema.optional<Schema.Number>, never>;
68
+ readonly lloydPasses: Schema.withDecodingDefaultType<Schema.optional<Schema.Number>, never>;
69
+ }>;
70
+ export interface TopicsConfig extends Schema.Schema.Type<typeof TopicsConfig> {
71
+ }
72
+ /**
73
+ * Topic-tree configuration mirror (structural — @dimple/config cannot
74
+ * import the store). Decoded by the store layer into its own GraphConfig
75
+ * schema, which fills every default.
76
+ */
77
+ export declare const GraphConfig: Schema.Struct<{
78
+ readonly enabled: Schema.optional<Schema.Boolean>;
79
+ readonly maxDepth: Schema.optional<Schema.Number>;
80
+ readonly maxNeighbors: Schema.optional<Schema.Number>;
81
+ readonly maxTotal: Schema.optional<Schema.Number>;
82
+ readonly supersedeDemotion: Schema.optional<Schema.Number>;
83
+ readonly conflictBands: Schema.optional<Schema.Struct<{
84
+ readonly nearDuplicate: Schema.Number;
85
+ readonly conflictLow: Schema.Number;
86
+ }>>;
87
+ readonly clusterK: Schema.optional<Schema.Number>;
88
+ readonly clusterMinSize: Schema.optional<Schema.Number>;
89
+ }>;
90
+ export interface GraphConfig extends Schema.Schema.Type<typeof GraphConfig> {
91
+ }
92
+ export declare const LLMConfig: Schema.Struct<{
93
+ readonly baseURL: Schema.String;
94
+ readonly apiKey: Schema.String;
95
+ readonly modelId: Schema.String;
96
+ readonly temperature: Schema.optional<Schema.refine<number, Schema.Number>>;
97
+ readonly maxOutputTokens: Schema.optional<Schema.refine<number, Schema.Number>>;
98
+ readonly reasoningEffort: Schema.optional<Schema.Literals<readonly ["low", "medium", "high"]>>;
99
+ }>;
100
+ export interface LLMConfig extends Schema.Schema.Type<typeof LLMConfig> {
101
+ }
102
+ export declare const DimpleConfig: Schema.Struct<{
103
+ readonly storeUrl: Schema.String;
104
+ readonly embedding: Schema.optional<Schema.Struct<{
105
+ readonly defaultModel: Schema.String;
106
+ readonly models: Schema.$Array<Schema.Struct<{
107
+ readonly id: Schema.String;
108
+ readonly provider: Schema.String;
109
+ readonly model: Schema.String;
110
+ readonly dimensions: Schema.Number;
111
+ readonly vectorType: Schema.optional<Schema.String>;
112
+ readonly apiKey: Schema.optional<Schema.String>;
113
+ readonly indexConfig: Schema.optional<Schema.Struct<{
114
+ readonly compressNeighbors: Schema.optional<Schema.String>;
115
+ readonly maxNeighbors: Schema.optional<Schema.Number>;
116
+ readonly searchL: Schema.optional<Schema.Number>;
117
+ }>>;
118
+ }>>;
119
+ }>>;
120
+ readonly jobs: Schema.optional<Schema.Struct<{
121
+ readonly dbUrl: Schema.optional<Schema.String>;
122
+ readonly execution: Schema.optional<Schema.Literals<readonly ["background", "inline", "external"]>>;
123
+ readonly concurrency: Schema.optional<Schema.Number>;
124
+ readonly leaseTimeoutMs: Schema.optional<Schema.Number>;
125
+ readonly maxAttempts: Schema.optional<Schema.refine<number, Schema.Number>>;
126
+ readonly pollIntervalMs: Schema.optional<Schema.Number>;
127
+ }>>;
128
+ readonly topics: Schema.optional<Schema.Struct<{
129
+ readonly maxLeafItems: Schema.withDecodingDefaultType<Schema.optional<Schema.Number>, never>;
130
+ readonly minLeafItems: Schema.withDecodingDefaultType<Schema.optional<Schema.Number>, never>;
131
+ readonly maxChildren: Schema.withDecodingDefaultType<Schema.optional<Schema.Number>, never>;
132
+ readonly minChildren: Schema.withDecodingDefaultType<Schema.optional<Schema.Number>, never>;
133
+ readonly maxDepth: Schema.withDecodingDefaultType<Schema.optional<Schema.Number>, never>;
134
+ readonly beamWidth: Schema.withDecodingDefaultType<Schema.optional<Schema.Number>, never>;
135
+ readonly splitDeferredHardLimit: Schema.withDecodingDefaultType<Schema.optional<Schema.Number>, never>;
136
+ readonly rebalanceCooldownMs: Schema.withDecodingDefaultType<Schema.optional<Schema.Number>, never>;
137
+ readonly lloydPasses: Schema.withDecodingDefaultType<Schema.optional<Schema.Number>, never>;
138
+ }>>;
139
+ readonly graph: Schema.optional<Schema.Struct<{
140
+ readonly enabled: Schema.optional<Schema.Boolean>;
141
+ readonly maxDepth: Schema.optional<Schema.Number>;
142
+ readonly maxNeighbors: Schema.optional<Schema.Number>;
143
+ readonly maxTotal: Schema.optional<Schema.Number>;
144
+ readonly supersedeDemotion: Schema.optional<Schema.Number>;
145
+ readonly conflictBands: Schema.optional<Schema.Struct<{
146
+ readonly nearDuplicate: Schema.Number;
147
+ readonly conflictLow: Schema.Number;
148
+ }>>;
149
+ readonly clusterK: Schema.optional<Schema.Number>;
150
+ readonly clusterMinSize: Schema.optional<Schema.Number>;
151
+ }>>;
152
+ readonly llm: Schema.optional<Schema.Struct<{
153
+ readonly baseURL: Schema.String;
154
+ readonly apiKey: Schema.String;
155
+ readonly modelId: Schema.String;
156
+ readonly temperature: Schema.optional<Schema.refine<number, Schema.Number>>;
157
+ readonly maxOutputTokens: Schema.optional<Schema.refine<number, Schema.Number>>;
158
+ readonly reasoningEffort: Schema.optional<Schema.Literals<readonly ["low", "medium", "high"]>>;
159
+ }>>;
160
+ /** Structured-logging section — the logger's own `LogConfig` (leaf
161
+ * dependency, no mirror needed). */
162
+ readonly logging: Schema.optional<Schema.Struct<{
163
+ readonly enabled: Schema.withDecodingDefaultType<Schema.optional<Schema.Boolean>, never>;
164
+ readonly level: Schema.withDecodingDefaultType<Schema.optional<Schema.Literals<readonly ["trace", "debug", "info", "warn", "error"]>>, never>;
165
+ readonly format: Schema.withDecodingDefaultType<Schema.optional<Schema.Literals<readonly ["jsonl", "pretty"]>>, never>;
166
+ readonly file: Schema.optionalKey<Schema.String>;
167
+ readonly scopes: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Literals<readonly ["trace", "debug", "info", "warn", "error"]>>>;
168
+ readonly ringSize: Schema.withDecodingDefaultType<Schema.optional<Schema.Number>, never>;
169
+ }>>;
170
+ readonly defaultK: Schema.optional<Schema.Number>;
171
+ readonly defaultLimit: Schema.optional<Schema.Number>;
172
+ readonly defaultTtlSecs: Schema.optional<Schema.Number>;
173
+ readonly sweepIntervalMs: Schema.optional<Schema.Number>;
174
+ }>;
175
+ export interface DimpleConfig extends Schema.Schema.Type<typeof DimpleConfig> {
176
+ }
@@ -0,0 +1,10 @@
1
+ import { Context, Layer } from "effect";
2
+ import type { DimpleConfig as DimpleConfigType } from "./schema.ts";
3
+ export interface Interface {
4
+ readonly config: DimpleConfigType;
5
+ }
6
+ declare const Service_base: Context.ServiceClass<Service, "@dimple/Config", Interface>;
7
+ export declare class Service extends Service_base {
8
+ }
9
+ export declare const layer: (overrides?: Partial<DimpleConfigType>) => Layer.Layer<Service, Error>;
10
+ export {};
@@ -0,0 +1,95 @@
1
+ import { Context, Effect, Schema } from "effect";
2
+ import type { EmbeddingModelConfig } from "./internal/config/index.js";
3
+ import type { LLM } from "./internal/llm/index.js";
4
+ import { EmbeddingError, type EmbeddingModel } from "./internal/embedder/index.js";
5
+ import type { LogConfig, Logging } from "./internal/logger/index.js";
6
+ import { Store, graph, type TopicConfig } from "./internal/store/index.js";
7
+ import { HybridRetrieval } from "./internal/retriever/index.js";
8
+ import { JobRuntime, JobRegistry, type Handler, type JobDefinition } from "./internal/workflow/index.js";
9
+ /** Topic-tree config (the store's schema, defaults decoded by the layer). */
10
+ export type { TopicConfig } from "./internal/store/index.js";
11
+ /** Graph config (the store's schema — `graph.GraphConfig`). */
12
+ export type GraphConfig = graph.GraphConfig;
13
+ /**
14
+ * Everything `@dimple/core` needs to compose the full system — one option
15
+ * set, resolved once at construction (no env reads past this boundary).
16
+ * The SDK builds these options from `dimple.jsonc`; power users can pass
17
+ * them directly.
18
+ */
19
+ export interface CoreOptions {
20
+ /** Store database (file: or remote libsql URL). */
21
+ readonly storeUrl: string;
22
+ /** Jobs database — always a SEPARATE file/URL (the worker's own db). */
23
+ readonly jobsUrl: string;
24
+ readonly migrationFolder?: string;
25
+ /** The model registry — every model the store can embed/route with. */
26
+ readonly models: readonly EmbeddingModelConfig[];
27
+ readonly defaultModelId: string;
28
+ /** Injectable model factory (tests use synthetic embedders; production
29
+ * uses `makeTransformersModel` / the embedder registry's providers). */
30
+ readonly embedderFor: (model: EmbeddingModelConfig) => Effect.Effect<EmbeddingModel, EmbeddingError>;
31
+ /** Topic-tree section: enabled by default with `TopicConfig` defaults. */
32
+ readonly topics?: {
33
+ readonly enabled?: boolean;
34
+ readonly config?: TopicConfig;
35
+ };
36
+ readonly graph?: GraphConfig;
37
+ /** Structured-logging config (`@dimple/logger`); absent = silent. */
38
+ readonly logging?: LogConfig;
39
+ /** Optional LLM — enables the dream job's classifier (without it,
40
+ * `memory.dream` fails with an explicit "LLM not configured" error). */
41
+ readonly llm?: LLM;
42
+ /** Target model id stamped into the dream classifier prompt. */
43
+ readonly llmModelId?: string;
44
+ readonly concurrency?: number;
45
+ /** Bounded handler retries per job (default 1 = no retry; the config
46
+ * path threads `jobs.maxAttempts`, default 10). */
47
+ readonly maxAttempts?: number;
48
+ /** Config scalars: retrieval defaults + write TTL default (the config
49
+ * path threads `defaultK`/`defaultLimit`/`defaultTtlSecs`). */
50
+ readonly defaultK?: number;
51
+ readonly defaultLimit?: number;
52
+ readonly defaultTtlSecs?: number;
53
+ /** Route `retrieval_log` writes through `audit.write` jobs (default
54
+ * true) — the query path never blocks on audit writes. */
55
+ readonly audit?: boolean;
56
+ /** Custom durable job definitions ADDED to the worker (extensibility):
57
+ * the SDK's users can run their own jobs on the same runtime. */
58
+ readonly extraDefs?: readonly JobDefinition.Any[];
59
+ /** Custom handlers registered alongside the built-ins; a name that
60
+ * collides with a built-in OVERRIDES it (the registry otherwise fails
61
+ * on duplicates). */
62
+ readonly extraHandlers?: ReadonlyArray<{
63
+ readonly name: string;
64
+ readonly handler: Handler;
65
+ }>;
66
+ }
67
+ /** The composed system — the SDK's (and app's) handle to everything.
68
+ * Fields are the service SHAPES (`Tag["Service"]`) — the classes used as
69
+ * types would demand the tag members the yielded instances don't carry. */
70
+ export interface Interface {
71
+ readonly store: Store["Service"];
72
+ readonly hybrid: HybridRetrieval["Service"];
73
+ readonly runtime: JobRuntime["Service"];
74
+ readonly registry: JobRegistry["Service"];
75
+ readonly models: ReadonlyMap<string, EmbeddingModelConfig>;
76
+ readonly defaultModel: EmbeddingModelConfig;
77
+ /** The default model's embedder instance (resolved from
78
+ * `embedderFor` at construction) — the SDK's `write` path embeds with
79
+ * it. */
80
+ readonly defaultEmbedder: EmbeddingModel;
81
+ readonly logging: Logging["Service"];
82
+ readonly llm?: LLM;
83
+ }
84
+ declare const CoreConfigError_base: Schema.Class<CoreConfigError, Schema.TaggedStruct<"core.ConfigError", {
85
+ readonly message: Schema.String;
86
+ }>, import("effect/Cause").YieldableError>;
87
+ /** The dimple.jsonc `embedding` section is mandatory for the
88
+ * config-driven variant (`coreLayerConfig`) — without models there is
89
+ * nothing to embed or route. */
90
+ export declare class CoreConfigError extends CoreConfigError_base {
91
+ }
92
+ declare const Service_base: Context.ServiceClass<Service, "@dimple/core/Core", Interface>;
93
+ export declare class Service extends Service_base {
94
+ }
95
+ export declare const make: (impl: Interface) => Interface;
@@ -0,0 +1,3 @@
1
+ export { Service as Core, make as makeCore, type Interface as CoreInterface, type CoreOptions, } from "./core.ts";
2
+ export { layer as coreLayer, layerConfig as coreLayerConfig } from "./layer.ts";
3
+ export { CoreConfigError } from "./core.ts";
@@ -0,0 +1,21 @@
1
+ import { Layer } from "effect";
2
+ import { Store, DbBackend } from "./internal/store/index.js";
3
+ import { EmbeddingError, EmbeddingModelRegistry } from "./internal/embedder/index.js";
4
+ import { HybridRetrieval } from "./internal/retriever/index.js";
5
+ import { JobRuntime, JobRegistry } from "./internal/workflow/index.js";
6
+ import { Logging } from "./internal/logger/index.js";
7
+ import { Service as ConfigService } from "./internal/config/index.js";
8
+ import type { CoreOptions } from "./core.ts";
9
+ import { CoreConfigError } from "./core.ts";
10
+ import { Service } from "./core.ts";
11
+ export declare const layer: (options: CoreOptions) => Layer.Layer<import("effect/unstable/persistence/PersistedQueue").PersistedQueueFactory | import("effect/unstable/persistence/Persistence").Persistence | Logging | DbBackend | JobRuntime | JobRegistry | Store | EmbeddingModelRegistry | HybridRetrieval | Service | import("effect/unstable/workflow/WorkflowEngine").WorkflowEngine, CoreConfigError | EmbeddingError | import("./internal/retriever/index.js").HybridError | import("./internal/workflow/index.js").RegistryError | import("effect/unstable/sql/SqlError").SqlError | import("./internal/store/index.js").StoreError, import("effect/Scope").Scope>;
12
+ /**
13
+ * Config-driven variant — the `dimple.jsonc` path (the SDK's
14
+ * `makeDimple({ config })`): reads the resolved `DimpleConfig` from
15
+ * `@dimple/config` and builds the same composition as `layer`:
16
+ * store/jobs URLs, the `embedding` section (models + default model +
17
+ * provider-built embedders), topics/graph/logging/llm sections.
18
+ */
19
+ export declare const layerConfig: (options?: {
20
+ readonly migrationFolder?: string;
21
+ }) => Layer.Layer<import("effect/unstable/persistence/PersistedQueue").PersistedQueueFactory | import("effect/unstable/persistence/Persistence").Persistence | Logging | DbBackend | JobRuntime | JobRegistry | Store | EmbeddingModelRegistry | HybridRetrieval | Service | import("effect/unstable/workflow/WorkflowEngine").WorkflowEngine, CoreConfigError | EmbeddingError | import("./internal/retriever/index.js").HybridError | import("./internal/workflow/index.js").RegistryError | import("effect/unstable/sql/SqlError").SqlError | import("./internal/store/index.js").StoreError, import("effect/Scope").Scope | ConfigService>;
@@ -0,0 +1,4 @@
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";
4
+ export { layer as registryLayer, type ModelSpec } from "./registry.ts";
@@ -0,0 +1,8 @@
1
+ import { type EmbeddingModel } from "./provider.ts";
2
+ export interface OpenAIOptions {
3
+ readonly modelId: string;
4
+ readonly model: string;
5
+ readonly dimensions: number;
6
+ readonly apiKey: string;
7
+ }
8
+ export declare const makeOpenAIModel: (options: OpenAIOptions) => EmbeddingModel;
@@ -0,0 +1,29 @@
1
+ import { Context, Effect, Schema } from "effect";
2
+ declare const EmbeddingError_base: Schema.Class<EmbeddingError, Schema.TaggedStruct<"EmbeddingProvider.EmbeddingError", {
3
+ readonly message: Schema.String;
4
+ readonly cause: Schema.optional<Schema.Defect>;
5
+ }>, import("effect/Cause").YieldableError>;
6
+ export declare class EmbeddingError extends EmbeddingError_base {
7
+ }
8
+ export interface EmbeddingModel {
9
+ readonly modelId: string;
10
+ readonly provider: string;
11
+ readonly dimensions: number;
12
+ readonly embed: (texts: readonly string[]) => Effect.Effect<readonly Float32Array[], EmbeddingError>;
13
+ readonly embedSingle: (text: string) => Effect.Effect<Float32Array, EmbeddingError>;
14
+ }
15
+ export interface Interface {
16
+ readonly getModel: (modelId: string) => Effect.Effect<EmbeddingModel, EmbeddingError>;
17
+ readonly defaultModelId: Effect.Effect<string, EmbeddingError>;
18
+ readonly registerModel: (spec: {
19
+ id: string;
20
+ provider: string;
21
+ model: string;
22
+ dimensions: number;
23
+ apiKey?: string;
24
+ }) => Effect.Effect<void, EmbeddingError>;
25
+ }
26
+ declare const Service_base: Context.ServiceClass<Service, "@dimple/embedder/EmbeddingModelRegistry", Interface>;
27
+ export declare class Service extends Service_base {
28
+ }
29
+ export {};
@@ -0,0 +1,10 @@
1
+ import { Layer } from "effect";
2
+ import { EmbeddingError, Service } from "./provider.ts";
3
+ export interface ModelSpec {
4
+ readonly id: string;
5
+ readonly provider: string;
6
+ readonly model: string;
7
+ readonly dimensions: number;
8
+ readonly apiKey?: string;
9
+ }
10
+ export declare const layer: (...models: ModelSpec[]) => Layer.Layer<Service, EmbeddingError>;
@@ -0,0 +1,18 @@
1
+ import { Config, Layer } from "effect";
2
+ import type { DeviceType } from "@huggingface/transformers";
3
+ import { Service, type EmbeddingModel } from "./provider.ts";
4
+ interface TransformersOptions {
5
+ readonly modelId?: string;
6
+ readonly device?: DeviceType;
7
+ readonly dtype?: "fp32" | "fp16" | "q8" | "q4";
8
+ readonly pooling?: "mean" | "cls" | "none";
9
+ readonly normalize?: boolean;
10
+ readonly cacheDir?: string;
11
+ /** Declared output dimension — validated against the model's actual
12
+ * output on first embed (a mismatch fails typed, precisely). */
13
+ readonly dimensions?: number;
14
+ }
15
+ export declare const makeTransformersModel: (options?: TransformersOptions) => EmbeddingModel;
16
+ export declare const layer: (options?: TransformersOptions) => Layer.Layer<Service>;
17
+ export declare const layerConfig: (config: Config.Wrap<TransformersOptions>) => Layer.Layer<Service, Config.ConfigError>;
18
+ export {};
@@ -0,0 +1,15 @@
1
+ import { Context, Effect, Layer } from "effect";
2
+ import type { TreeHandle } from "./internal/parser/index.js";
3
+ import { ExtractedFile, ExtractionError } from "./models/extraction";
4
+ export interface ExtractRequest {
5
+ readonly filePath: string;
6
+ readonly tree: TreeHandle;
7
+ }
8
+ export interface Interface {
9
+ readonly extract: (request: ExtractRequest) => Effect.Effect<ExtractedFile, ExtractionError>;
10
+ }
11
+ declare const Service_base: Context.ServiceClass<Service, "@dimple/extractor/CodeExtractor", Interface>;
12
+ export declare class Service extends Service_base {
13
+ }
14
+ export declare const layer: Layer.Layer<Service, never, never>;
15
+ export {};
@@ -0,0 +1,17 @@
1
+ import { Context, Layer, Schema } from "effect";
2
+ declare const ContentError_base: Schema.Class<ContentError, Schema.TaggedStruct<"Content.ContentError", {
3
+ readonly contentType: Schema.String;
4
+ readonly message: Schema.String;
5
+ }>, import("effect/Cause").YieldableError>;
6
+ export declare class ContentError extends ContentError_base {
7
+ }
8
+ export interface Interface {
9
+ readonly contentType: string;
10
+ readonly renderText: (content: string) => string;
11
+ readonly extractText: (content: string) => string;
12
+ }
13
+ declare const Service_base: Context.ServiceClass<Service, "@dimple/extractor/ContentHandler", Interface>;
14
+ export declare class Service extends Service_base {
15
+ }
16
+ export declare const layer: Layer.Layer<Service, never, never>;
17
+ export {};
@@ -0,0 +1,4 @@
1
+ export { Service as CodeExtractor, layer as codeExtractorLayer } from "./code-extractor";
2
+ export type { ExtractRequest } from "./code-extractor";
3
+ export { ExtractedFile, ExtractedChunk, ImportInfo, ExtractionError } from "./models/extraction";
4
+ export { Service as ContentHandler, layer as contentHandlerLayer, ContentError, } from "./content-handler";
@@ -0,0 +1,24 @@
1
+ import type { TreeHandle } from "./internal/parser/index.js";
2
+ import type { ExtractedChunk, ImportInfo } from "../models/extraction";
3
+ import { ExtractionError } from "../models/extraction";
4
+ /**
5
+ * Extract chunks and imports from a parsed tree-sitter tree.
6
+ *
7
+ * Dispatches to the language-specific extractor based on the tree's
8
+ * language identifier. Both tsx and jsx use their base language extractors
9
+ * since the AST node types for definitions and imports are identical.
10
+ * The parser (via @dimple/parser + @dimple/wasm) loads the correct grammar WASM.
11
+ *
12
+ * Returns a discriminated result: an unknown language yields an
13
+ * `ExtractionError` VALUE (never a throw — the caller fails its effect
14
+ * typed).
15
+ */
16
+ export type ExtractionResult = {
17
+ readonly ok: true;
18
+ readonly chunks: ExtractedChunk[];
19
+ readonly imports: ImportInfo[];
20
+ } | {
21
+ readonly ok: false;
22
+ readonly error: ExtractionError;
23
+ };
24
+ export declare function extract(filePath: string, tree: TreeHandle): ExtractionResult;
@@ -0,0 +1,22 @@
1
+ import type { TreeHandle } from "./internal/parser/index.js";
2
+ import type { ExtractedChunk, ImportInfo } from "../models/extraction";
3
+ /**
4
+ * Extract chunks and imports from a JavaScript/JSX file.
5
+ *
6
+ * Walks top-level children of the tree-sitter AST. For each node:
7
+ * - import_statement: collect import info (source, specifiers)
8
+ * - export_statement: unwrap to inner declaration, emit with export prefix
9
+ * - definition type: emit a chunk
10
+ * - class: emit methods as separate chunks + the class itself
11
+ *
12
+ * Unlike TypeScript, JS does not have interfaces, type aliases, enums,
13
+ * abstract classes, or declare/ambient patterns.
14
+ *
15
+ * Returns an object with:
16
+ * - chunks: extracted definition nodes ready for embedding
17
+ * - imports: extracted import statement metadata for dependency tracking
18
+ */
19
+ export declare function extract(filePath: string, tree: TreeHandle): {
20
+ chunks: ExtractedChunk[];
21
+ imports: ImportInfo[];
22
+ };
@@ -0,0 +1,20 @@
1
+ import type { TreeHandle } from "./internal/parser/index.js";
2
+ import type { ExtractedChunk, ImportInfo } from "../models/extraction";
3
+ /**
4
+ * Extract chunks and imports from a TypeScript/TSX file.
5
+ *
6
+ * Walks top-level children of the tree-sitter AST. For each node:
7
+ * - import_statement: collect import info (source, specifiers)
8
+ * - export_statement: unwrap to inner declaration, emit with export prefix
9
+ * - ambient_declaration: unwrap to inner declaration (declare class/module/etc.)
10
+ * - definition type: emit a chunk
11
+ * - class: emit methods as separate chunks + the class itself
12
+ *
13
+ * Returns an object with:
14
+ * - chunks: extracted definition nodes ready for embedding
15
+ * - imports: extracted import statement metadata for dependency tracking
16
+ */
17
+ export declare function extract(filePath: string, tree: TreeHandle): {
18
+ chunks: ExtractedChunk[];
19
+ imports: ImportInfo[];
20
+ };
@@ -0,0 +1,53 @@
1
+ import { Schema } from "effect";
2
+ declare const ExtractionError_base: Schema.Class<ExtractionError, Schema.TaggedStruct<"ExtractionError", {
3
+ readonly message: Schema.String;
4
+ readonly cause: Schema.optional<Schema.Defect>;
5
+ }>, import("effect/Cause").YieldableError>;
6
+ export declare class ExtractionError extends ExtractionError_base {
7
+ }
8
+ export declare const ExtractedChunk: Schema.Struct<{
9
+ readonly id: Schema.String;
10
+ readonly filePath: Schema.String;
11
+ readonly sourceText: Schema.String;
12
+ readonly kind: Schema.String;
13
+ readonly name: Schema.String;
14
+ readonly startLine: Schema.Number;
15
+ readonly endLine: Schema.Number;
16
+ readonly language: Schema.String;
17
+ readonly docstring: Schema.optional<Schema.String>;
18
+ }>;
19
+ export interface ExtractedChunk extends Schema.Schema.Type<typeof ExtractedChunk> {
20
+ }
21
+ export declare const ImportInfo: Schema.Struct<{
22
+ readonly source: Schema.String;
23
+ readonly specifiers: Schema.$Array<Schema.String>;
24
+ readonly startLine: Schema.Number;
25
+ readonly endLine: Schema.Number;
26
+ }>;
27
+ export interface ImportInfo extends Schema.Schema.Type<typeof ImportInfo> {
28
+ }
29
+ export declare const ExtractedFile: Schema.Struct<{
30
+ readonly filePath: Schema.String;
31
+ readonly language: Schema.String;
32
+ readonly source: Schema.String;
33
+ readonly chunks: Schema.$Array<Schema.Struct<{
34
+ readonly id: Schema.String;
35
+ readonly filePath: Schema.String;
36
+ readonly sourceText: Schema.String;
37
+ readonly kind: Schema.String;
38
+ readonly name: Schema.String;
39
+ readonly startLine: Schema.Number;
40
+ readonly endLine: Schema.Number;
41
+ readonly language: Schema.String;
42
+ readonly docstring: Schema.optional<Schema.String>;
43
+ }>>;
44
+ readonly imports: Schema.optional<Schema.$Array<Schema.Struct<{
45
+ readonly source: Schema.String;
46
+ readonly specifiers: Schema.$Array<Schema.String>;
47
+ readonly startLine: Schema.Number;
48
+ readonly endLine: Schema.Number;
49
+ }>>>;
50
+ }>;
51
+ export interface ExtractedFile extends Schema.Schema.Type<typeof ExtractedFile> {
52
+ }
53
+ export {};
@@ -0,0 +1,14 @@
1
+ import type { LLM } from "./llm.ts";
2
+ import type { DreamClassifier } from "./internal/store/index.js";
3
+ /**
4
+ * Builds a `DreamClassifier` from a generic `LLM`. `modelId` (when given)
5
+ * is mentioned in the system prompt so the model knows which embedding
6
+ * model's space it is judging — the ids in each pair are opaque to the
7
+ * judge either way. Classifier failures surface as `LLMError` on the
8
+ * error channel; the dream handler logs and swallows them (the watermark
9
+ * stays put, so the batch is judged again on the next run).
10
+ */
11
+ export declare const makeDreamClassifier: (deps: {
12
+ readonly llm: LLM;
13
+ readonly modelId?: string;
14
+ }) => DreamClassifier;
@@ -0,0 +1,4 @@
1
+ export { LLMError, makeLLM, type GenerateTextInput, type GenerateObjectInput, type LLM, } from "./llm.ts";
2
+ export { openAICompatible, type OpenAICompatibleOptions } from "./provider.ts";
3
+ export { makeDreamClassifier } from "./dream-classifier.ts";
4
+ export { Service as LLMService, type Interface as LLMServiceInterface, type LLMOptions, layer as llmLayer, layerConfig as llmLayerConfig, layerFromConfig as llmLayerFromConfig, } from "./service.ts";