@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,13 @@
1
+ import { Effect, Layer } from "effect";
2
+ import { Service as ConfigService } from "./internal/config/index.js";
3
+ import type { DimpleConfig as DimpleConfigType } from "./internal/config/index.js";
4
+ import { ConfigError } from "./errors.ts";
5
+ /**
6
+ * The SDK's config input: a `dimple.jsonc` FILE PATH or an inline object
7
+ * (typed as `DimpleConfig` — the SDK validates it and fills defaults).
8
+ */
9
+ export type ConfigInput = string | Partial<DimpleConfigType> | DimpleConfigType;
10
+ /** Resolve either input form to the validated config snapshot. */
11
+ export declare const resolveConfigInput: (input: ConfigInput) => Effect.Effect<DimpleConfigType, ConfigError, never>;
12
+ /** A `ConfigService` layer from the SDK's config input (path or object). */
13
+ export declare const configLayerFromInput: (input: ConfigInput) => Layer.Layer<ConfigService, ConfigError, never>;
@@ -0,0 +1,101 @@
1
+ import { ManagedRuntime } from "effect";
2
+ import type { QueryProfile } from "./internal/retriever/index.js";
3
+ import type { CoreInterface } from "./internal/core/index.js";
4
+ import type { CodeExtractor } from "./internal/extractor/index.js";
5
+ import type { CodeParser } from "./internal/parser/index.js";
6
+ import type { AddEdgeInput, AugmentedMemory, ExplainResult, GraphCandidatesResult, GraphCoverage, MemoryUnit, TopicHealth, WriteMemoryInput } from "./internal/store/index.js";
7
+ import { type DimpleError } from "./errors.ts";
8
+ /** Options for a `query` call — mirrors the hybrid retriever's options. */
9
+ export interface QueryOptions {
10
+ readonly namespace?: string;
11
+ readonly limit?: number;
12
+ readonly k?: number;
13
+ /** Fusion profile, or the mode-string shorthand
14
+ * (`"hybrid" | "semantic" | "keyword"`). */
15
+ readonly profile?: QueryProfile | "hybrid" | "semantic" | "keyword";
16
+ readonly topics?: {
17
+ readonly topicKeys?: ReadonlyArray<string>;
18
+ };
19
+ }
20
+ /** Options for a `write` call. */
21
+ export interface WriteOptions {
22
+ /** Embed the content with the default model and route it into the topic
23
+ * tree (default true). Pass `false` when embeddings are managed
24
+ * externally (backfill paths). */
25
+ readonly embed?: boolean;
26
+ }
27
+ /** Options for an `index` call — parse + extract real code into memories. */
28
+ export interface IndexOptions {
29
+ /** Directories (walked recursively) and/or files to index. */
30
+ readonly paths: readonly string[];
31
+ /** Logical-key prefix for every unit (default `"code-"`). Keys are
32
+ * `<prefix><relative-path>` (file unit) and
33
+ * `<prefix><relative-path>#<chunk-id>` (extracted unit) — stable across
34
+ * runs and cwds, so re-indexing the same tree SKIPS existing units. */
35
+ readonly keyPrefix?: string;
36
+ readonly namespace?: string;
37
+ /** Embed + topic-route every unit (default true). */
38
+ readonly embed?: boolean;
39
+ /** Cap for the whole-file memory content (default 64 KiB). */
40
+ readonly maxFileBytes?: number;
41
+ /** Cap for each extracted chunk's content (default 8 KiB). */
42
+ readonly maxChunkBytes?: number;
43
+ /** Extensions to index (default: the TypeScript/JavaScript family). */
44
+ readonly extensions?: readonly string[];
45
+ }
46
+ /** Result of an `index` call — per-file failures never abort the run. */
47
+ export interface IndexResult {
48
+ /** Files parsed (supported extension). */
49
+ readonly files: number;
50
+ /** Memory units written (file unit + extracted chunks). */
51
+ readonly indexed: number;
52
+ /** Units skipped as already-indexed (duplicate logical keys). */
53
+ readonly skipped: number;
54
+ /** Files skipped because the extension is not indexable. */
55
+ readonly unsupported: number;
56
+ /** Files that could not be walked/read/parsed/extracted/written. */
57
+ readonly failed: readonly {
58
+ readonly filePath: string;
59
+ readonly message: string;
60
+ }[];
61
+ }
62
+ /**
63
+ * The promise-based SDK facade — the ONLY surface app code touches.
64
+ * Every method runs the underlying Effect at the boundary, remaps errors
65
+ * onto the closed `DimpleError` hierarchy, and never leaks Effect types.
66
+ */
67
+ export interface Dimple {
68
+ readonly write: (input: WriteMemoryInput, options?: WriteOptions) => Promise<MemoryUnit>;
69
+ readonly get: (id: string) => Promise<MemoryUnit>;
70
+ readonly query: (text: string, options?: QueryOptions) => Promise<AugmentedMemory[]>;
71
+ readonly forget: (id: string) => Promise<void>;
72
+ /** Parse + extract a directory/files with tree-sitter and store the
73
+ * result as memories: one whole-file unit (with its import graph in
74
+ * metadata) + one unit per extracted definition (function/class/method/
75
+ * interface/type/enum/variable with JSDoc + line range). Re-indexing
76
+ * the same tree is idempotent (duplicate keys are skipped). */
77
+ readonly index: (options: IndexOptions) => Promise<IndexResult>;
78
+ /** Attach an externally-computed embedding (the `{ embed: false }`
79
+ * workflow's completion path): the memory becomes semantically
80
+ * retrievable and is routed into the model's topic tree. */
81
+ readonly updateEmbedding: (id: string, embedding: readonly number[], modelKey?: string) => Promise<void>;
82
+ /** Embed text with the default model (the SDK's own pipeline). */
83
+ readonly embed: (text: string) => Promise<number[]>;
84
+ readonly dream: (modelKey: string) => Promise<void>;
85
+ readonly repair: (modelKey: string) => Promise<void>;
86
+ readonly explain: (input: {
87
+ readonly kind: "memory" | "topic" | "concept";
88
+ readonly id: string;
89
+ }) => Promise<ExplainResult>;
90
+ readonly health: (modelKey: string) => Promise<TopicHealth>;
91
+ readonly graph: {
92
+ readonly addEdge: (input: AddEdgeInput) => Promise<unknown>;
93
+ readonly candidates: () => Promise<GraphCandidatesResult>;
94
+ readonly coverage: (modelKey: string) => Promise<GraphCoverage>;
95
+ };
96
+ /** Stops the worker, closes the sinks and the store — idempotent. */
97
+ readonly dispose: () => Promise<void>;
98
+ }
99
+ /** Build the promise facade over the booted core + runtime. */
100
+ export declare const makeFacade: <ER>(runtime: ManagedRuntime.ManagedRuntime<never, ER>, core: CoreInterface, parser: CodeParser["Service"], extractor: CodeExtractor["Service"], dispose: () => Promise<void>) => Dimple;
101
+ export type { DimpleError };
@@ -0,0 +1,63 @@
1
+ import { Schema } from "effect";
2
+ declare const ConfigError_base: Schema.Class<ConfigError, Schema.TaggedStruct<"Sdk.ConfigError", {
3
+ readonly message: Schema.String;
4
+ }>, import("effect/Cause").YieldableError>;
5
+ /**
6
+ * The SDK's CLOSED error hierarchy — the only errors consumers ever see.
7
+ * Effect's `Cause`/`FiberFailure` never leak past the facade: every
8
+ * underlying error is remapped at the boundary (see `remapError`).
9
+ */
10
+ export declare class ConfigError extends ConfigError_base {
11
+ }
12
+ declare const NotFoundError_base: Schema.Class<NotFoundError, Schema.TaggedStruct<"Sdk.NotFound", {
13
+ readonly id: Schema.optional<Schema.String>;
14
+ readonly message: Schema.String;
15
+ }>, import("effect/Cause").YieldableError>;
16
+ /** The requested memory (or topic/edge) does not exist. */
17
+ export declare class NotFoundError extends NotFoundError_base {
18
+ }
19
+ declare const DuplicateKeyError_base: Schema.Class<DuplicateKeyError, Schema.TaggedStruct<"Sdk.DuplicateKey", {
20
+ readonly logicalKey: Schema.String;
21
+ readonly namespace: Schema.String;
22
+ readonly message: Schema.String;
23
+ }>, import("effect/Cause").YieldableError>;
24
+ /** An active memory with the same logical key already exists. */
25
+ export declare class DuplicateKeyError extends DuplicateKeyError_base {
26
+ }
27
+ declare const LLMNotConfiguredError_base: Schema.Class<LLMNotConfiguredError, Schema.TaggedStruct<"Sdk.LLMNotConfigured", {
28
+ readonly message: Schema.String;
29
+ }>, import("effect/Cause").YieldableError>;
30
+ /** `memory.dream` was requested without an LLM configured. */
31
+ export declare class LLMNotConfiguredError extends LLMNotConfiguredError_base {
32
+ }
33
+ declare const JobFailedError_base: Schema.Class<JobFailedError, Schema.TaggedStruct<"Sdk.JobFailed", {
34
+ readonly message: Schema.String;
35
+ }>, import("effect/Cause").YieldableError>;
36
+ /** A durable job failed on the enqueue/wait path. */
37
+ export declare class JobFailedError extends JobFailedError_base {
38
+ }
39
+ declare const DuplicateEdgeError_base: Schema.Class<DuplicateEdgeError, Schema.TaggedStruct<"Sdk.DuplicateEdge", {
40
+ readonly fromMemoryId: Schema.String;
41
+ readonly toMemoryId: Schema.String;
42
+ readonly edgeKind: Schema.String;
43
+ readonly message: Schema.String;
44
+ }>, import("effect/Cause").YieldableError>;
45
+ /** A duplicate memory↔memory edge (same from/to/kind already exists). */
46
+ export declare class DuplicateEdgeError extends DuplicateEdgeError_base {
47
+ }
48
+ declare const StoreFailure_base: Schema.Class<StoreFailure, Schema.TaggedStruct<"Sdk.StoreFailure", {
49
+ readonly message: Schema.String;
50
+ }>, import("effect/Cause").YieldableError>;
51
+ /** Anything else — the typed fallback that keeps the union closed. */
52
+ export declare class StoreFailure extends StoreFailure_base {
53
+ }
54
+ declare const InputError_base: Schema.Class<InputError, Schema.TaggedStruct<"Sdk.InputError", {
55
+ readonly message: Schema.String;
56
+ }>, import("effect/Cause").YieldableError>;
57
+ /** Invalid SDK call input (bad `limit`, `k`, profile shape, …). */
58
+ export declare class InputError extends InputError_base {
59
+ }
60
+ export type DimpleError = ConfigError | NotFoundError | DuplicateKeyError | DuplicateEdgeError | LLMNotConfiguredError | JobFailedError | StoreFailure | InputError;
61
+ /** Map an underlying failure onto the closed SDK hierarchy. */
62
+ export declare const remapError: (error: unknown) => DimpleError;
63
+ export {};
@@ -0,0 +1,4 @@
1
+ export { makeDimple, type MakeDimpleOptions } from "./make.ts";
2
+ export { type ConfigInput } from "./config.ts";
3
+ export { type Dimple, type QueryOptions, type IndexOptions, type IndexResult } from "./dimple.ts";
4
+ export { ConfigError, NotFoundError, DuplicateKeyError, DuplicateEdgeError, LLMNotConfiguredError, JobFailedError, StoreFailure, InputError, remapError, type DimpleError, } from "./errors.ts";