@theokit/sdk-memory 0.3.1 → 0.3.3

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 (88) hide show
  1. package/CHANGELOG.md +133 -0
  2. package/LICENSE +2 -2
  3. package/README.md +42 -0
  4. package/dist/index.cjs.map +1 -1
  5. package/dist/index.js.map +1 -1
  6. package/dist/internal/active-memory/active-memory-cache.d.ts +18 -0
  7. package/dist/internal/active-memory/active-memory-cache.d.ts.map +1 -1
  8. package/dist/internal/active-memory/active-memory-types.d.ts +25 -0
  9. package/dist/internal/active-memory/active-memory-types.d.ts.map +1 -1
  10. package/dist/internal/active-memory/active-memory.d.ts +54 -29
  11. package/dist/internal/active-memory/active-memory.d.ts.map +1 -1
  12. package/dist/internal/adapter-http-error.d.ts +18 -0
  13. package/dist/internal/adapter-http-error.d.ts.map +1 -1
  14. package/dist/internal/circuit-breaker.d.ts +17 -0
  15. package/dist/internal/circuit-breaker.d.ts.map +1 -1
  16. package/dist/internal/dreaming/dreaming-diary.d.ts +27 -0
  17. package/dist/internal/dreaming/dreaming-diary.d.ts.map +1 -1
  18. package/dist/internal/dreaming/dreaming-phases.d.ts +11 -0
  19. package/dist/internal/dreaming/dreaming-phases.d.ts.map +1 -1
  20. package/dist/internal/dreaming/dreaming-run.d.ts +34 -2
  21. package/dist/internal/dreaming/dreaming-run.d.ts.map +1 -1
  22. package/dist/internal/embedding/azure-openai-embedding.d.ts +22 -0
  23. package/dist/internal/embedding/azure-openai-embedding.d.ts.map +1 -1
  24. package/dist/internal/embedding/cohere-embedding.d.ts +18 -2
  25. package/dist/internal/embedding/cohere-embedding.d.ts.map +1 -1
  26. package/dist/internal/embedding/deepinfra-embedding.d.ts +13 -0
  27. package/dist/internal/embedding/deepinfra-embedding.d.ts.map +1 -1
  28. package/dist/internal/embedding/embedding-adapter.d.ts +36 -2
  29. package/dist/internal/embedding/embedding-adapter.d.ts.map +1 -1
  30. package/dist/internal/embedding/gemini-embedding.d.ts +9 -0
  31. package/dist/internal/embedding/gemini-embedding.d.ts.map +1 -1
  32. package/dist/internal/embedding/jina-embedding.d.ts +9 -0
  33. package/dist/internal/embedding/jina-embedding.d.ts.map +1 -1
  34. package/dist/internal/embedding/mistral-embedding.d.ts +8 -0
  35. package/dist/internal/embedding/mistral-embedding.d.ts.map +1 -1
  36. package/dist/internal/embedding/ollama-embedding.d.ts +21 -0
  37. package/dist/internal/embedding/ollama-embedding.d.ts.map +1 -1
  38. package/dist/internal/embedding/openai-embedding.d.ts +19 -12
  39. package/dist/internal/embedding/openai-embedding.d.ts.map +1 -1
  40. package/dist/internal/embedding/openrouter-embedding.d.ts +12 -0
  41. package/dist/internal/embedding/openrouter-embedding.d.ts.map +1 -1
  42. package/dist/internal/embedding/voyage-embedding.d.ts +9 -0
  43. package/dist/internal/embedding/voyage-embedding.d.ts.map +1 -1
  44. package/dist/internal/index/index-db.d.ts +25 -0
  45. package/dist/internal/index/index-db.d.ts.map +1 -1
  46. package/dist/internal/index/index-manager-contract.d.ts +28 -0
  47. package/dist/internal/index/index-manager-contract.d.ts.map +1 -1
  48. package/dist/internal/index/index-manager.d.ts +29 -0
  49. package/dist/internal/index/index-manager.d.ts.map +1 -1
  50. package/dist/internal/index/lance-index.d.ts +25 -0
  51. package/dist/internal/index/lance-index.d.ts.map +1 -1
  52. package/dist/internal/index/lance-memory-adapter.d.ts +27 -5
  53. package/dist/internal/index/lance-memory-adapter.d.ts.map +1 -1
  54. package/dist/internal/index/memory-index.d.ts +17 -2
  55. package/dist/internal/index/memory-index.d.ts.map +1 -1
  56. package/dist/internal/index/migrate-sqlite-to-lance.d.ts +12 -0
  57. package/dist/internal/index/migrate-sqlite-to-lance.d.ts.map +1 -1
  58. package/dist/internal/index/migration.d.ts +26 -0
  59. package/dist/internal/index/migration.d.ts.map +1 -1
  60. package/dist/internal/index/vec-index.d.ts +67 -16
  61. package/dist/internal/index/vec-index.d.ts.map +1 -1
  62. package/dist/internal/memory-types.d.ts +17 -1
  63. package/dist/internal/memory-types.d.ts.map +1 -1
  64. package/dist/internal/store/chunk-markdown.d.ts +17 -0
  65. package/dist/internal/store/chunk-markdown.d.ts.map +1 -1
  66. package/dist/internal/store/markdown-store.d.ts +26 -0
  67. package/dist/internal/store/markdown-store.d.ts.map +1 -1
  68. package/dist/internal/store/reader.d.ts +26 -3
  69. package/dist/internal/store/reader.d.ts.map +1 -1
  70. package/dist/internal/store/session-loader.d.ts +5 -0
  71. package/dist/internal/store/session-loader.d.ts.map +1 -1
  72. package/dist/internal/store/session-summary-writer.d.ts +14 -0
  73. package/dist/internal/store/session-summary-writer.d.ts.map +1 -1
  74. package/dist/internal/store/transcript-store.d.ts +12 -0
  75. package/dist/internal/store/transcript-store.d.ts.map +1 -1
  76. package/dist/internal/store/wiki-loader.d.ts +11 -0
  77. package/dist/internal/store/wiki-loader.d.ts.map +1 -1
  78. package/dist/internal/tools.d.ts +38 -0
  79. package/dist/internal/tools.d.ts.map +1 -1
  80. package/package.json +8 -7
  81. package/dist/internal/active-memory/composite-scorer.d.ts +0 -19
  82. package/dist/internal/active-memory/composite-scorer.d.ts.map +0 -1
  83. package/dist/internal/active-memory/query-analyzer.d.ts +0 -16
  84. package/dist/internal/active-memory/query-analyzer.d.ts.map +0 -1
  85. package/dist/internal/embedding/batch-encoder.d.ts +0 -30
  86. package/dist/internal/embedding/batch-encoder.d.ts.map +0 -1
  87. package/dist/internal/memory-scope.d.ts +0 -21
  88. package/dist/internal/memory-scope.d.ts.map +0 -1
@@ -21,6 +21,24 @@ export interface ActiveMemoryCacheOptions {
21
21
  capacity?: number;
22
22
  now?: () => number;
23
23
  }
24
+ /**
25
+ * A bounded, TTL-expiring cache of recall results, so two identical sends in
26
+ * quick succession run one search.
27
+ *
28
+ * Entries expire `ttlMs` after they were written (default 15s) and are dropped
29
+ * on the read that finds them expired. A read that hits also moves the entry to
30
+ * the most-recent position, so eviction under pressure removes the
31
+ * least-recently-read entry rather than the oldest write.
32
+ *
33
+ * The key covers the query text, the query mode, and the tenant triple
34
+ * (`namespace`, `userId`, `scope`) joined by NUL bytes. Passing no tenant
35
+ * context is allowed and hashes as three empty strings — safe only when the
36
+ * process serves a single tenant.
37
+ *
38
+ * Not process-wide: construct one per agent. Nothing here expires in the
39
+ * background, so an untouched entry occupies its slot until it is read or
40
+ * evicted.
41
+ */
24
42
  export declare class ActiveMemoryCache {
25
43
  private readonly opts;
26
44
  private readonly map;
@@ -1 +1 @@
1
- {"version":3,"file":"active-memory-cache.d.ts","sourceRoot":"","sources":["../../../src/internal/active-memory/active-memory-cache.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAEnE;;;;;;;;;;;;;;;;GAgBG;AAEH,MAAM,WAAW,wBAAwB;IACvC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;CACpB;AAUD,qBAAa,iBAAiB;IAGhB,OAAO,CAAC,QAAQ,CAAC,IAAI;IAFjC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAiC;gBAExB,IAAI,GAAE,wBAA6B;IAEhE,GAAG,CACD,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,SAAS,CAAC,EAAE,aAAa,GACxB,kBAAkB,GAAG,SAAS;IAcjC,GAAG,CACD,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,kBAAkB,EAC1B,SAAS,CAAC,EAAE,aAAa,GACxB,IAAI;IAYP,IAAI,IAAI,MAAM;IAId,OAAO,CAAC,GAAG;CAGZ;AAED;;;;;;;;;;GAUG;AACH,MAAM,WAAW,aAAa;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB"}
1
+ {"version":3,"file":"active-memory-cache.d.ts","sourceRoot":"","sources":["../../../src/internal/active-memory/active-memory-cache.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAEnE;;;;;;;;;;;;;;;;GAgBG;AAEH,MAAM,WAAW,wBAAwB;IACvC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;CACpB;AAUD;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAAa,iBAAiB;IAGhB,OAAO,CAAC,QAAQ,CAAC,IAAI;IAFjC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAiC;gBAExB,IAAI,GAAE,wBAA6B;IAEhE,GAAG,CACD,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,SAAS,CAAC,EAAE,aAAa,GACxB,kBAAkB,GAAG,SAAS;IAcjC,GAAG,CACD,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,kBAAkB,EAC1B,SAAS,CAAC,EAAE,aAAa,GACxB,IAAI;IAYP,IAAI,IAAI,MAAM;IAId,OAAO,CAAC,GAAG;CAGZ;AAED;;;;;;;;;;GAUG;AACH,MAAM,WAAW,aAAa;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB"}
@@ -19,8 +19,33 @@
19
19
  * @internal
20
20
  */
21
21
  import type { MemorySearchHit } from "../index/index-manager-contract.js";
22
+ /**
23
+ * How the recall query is built from the conversation.
24
+ *
25
+ * `message` uses only the incoming user text. `recent` (the default) prepends
26
+ * the last few user turns, so a follow-up like "and the other one?" still
27
+ * carries its subject. `full` prepends every prior user turn, which broadens
28
+ * recall but lets an old topic dominate a long conversation. Assistant turns are
29
+ * never included in any mode.
30
+ */
22
31
  export type ActiveMemoryQueryMode = "message" | "recent" | "full";
32
+ /**
33
+ * Outcome of one recall attempt.
34
+ *
35
+ * `ok` is the only status that carries a summary. `no-recall` means the search
36
+ * ran and matched nothing, or the built query was empty. `skipped` means no
37
+ * search was attempted at all — recall disabled, no index, or the circuit
38
+ * breaker open. `timeout` means the search outlived `timeoutMs`, and `error`
39
+ * that it threw. The four non-`ok` statuses are reported, never thrown: recall
40
+ * failing must not fail the agent run.
41
+ */
23
42
  export type ActiveMemoryStatus = "ok" | "timeout" | "skipped" | "no-recall" | "error";
43
+ /**
44
+ * Result of one recall attempt. `summary` is set only when `status` is `ok`, and
45
+ * is the text the system-prompt pipeline injects. `hits` carries the underlying
46
+ * matches so a caller can render its own block instead. `durationMs` covers the
47
+ * search only, and is 0 on the `skipped` paths.
48
+ */
24
49
  export interface ActiveMemoryResult {
25
50
  summary: string | undefined;
26
51
  durationMs: number;
@@ -1 +1 @@
1
- {"version":3,"file":"active-memory-types.d.ts","sourceRoot":"","sources":["../../../src/internal/active-memory/active-memory-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAE1E,MAAM,MAAM,qBAAqB,GAAG,SAAS,GAAG,QAAQ,GAAG,MAAM,CAAC;AAElE,MAAM,MAAM,kBAAkB,GAAG,IAAI,GAAG,SAAS,GAAG,SAAS,GAAG,WAAW,GAAG,OAAO,CAAC;AAEtF,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,kBAAkB,CAAC;IAC3B,IAAI,EAAE,aAAa,CAAC,eAAe,CAAC,CAAC;CACtC"}
1
+ {"version":3,"file":"active-memory-types.d.ts","sourceRoot":"","sources":["../../../src/internal/active-memory/active-memory-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAE1E;;;;;;;;GAQG;AACH,MAAM,MAAM,qBAAqB,GAAG,SAAS,GAAG,QAAQ,GAAG,MAAM,CAAC;AAElE;;;;;;;;;GASG;AACH,MAAM,MAAM,kBAAkB,GAAG,IAAI,GAAG,SAAS,GAAG,SAAS,GAAG,WAAW,GAAG,OAAO,CAAC;AAEtF;;;;;GAKG;AACH,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,kBAAkB,CAAC;IAC3B,IAAI,EAAE,aAAa,CAAC,eAAe,CAAC,CAAC;CACtC"}
@@ -21,43 +21,34 @@
21
21
  * iter 44-75; 2 inlined adapters added: adapter-http-error iter 73
22
22
  * + adapter-catalog renamed iter 74).
23
23
  *
24
- * **Cross-package telemetry contract:** sdk-core's `internal/telemetry/`
25
- * is not part of the public surface. sdk-memory inlines minimal
26
- * structural mirrors of `OTelSpan` + `TelemetryHandle` here AND the
27
- * 2 constant strings the file uses (`memory.recall` span name +
28
- * `theokit_memory_recall_duration_ms` histogram name). The runtime
29
- * still receives + emits the canonical types via consumer call sites
30
- * the structural mirrors only satisfy this file's local type
31
- * checking. When sdk-core exposes telemetry types publicly, these
32
- * mirrors MUST be replaced with the canonical imports.
24
+ * **Cross-package telemetry contract:** `OTelSpan` and `TelemetryHandle`
25
+ * are now imported from `@theokit/sdk`, which exports them since #295.
26
+ * This file previously inlined structural mirrors of both, with a note
27
+ * that they MUST be replaced once sdk-core made them public — and by
28
+ * the time anyone looked, the mirrors had drifted: they narrowed
29
+ * `setAttributes` to reject the `undefined` values the canonical type
30
+ * accepts, and declared `end()` without its `endTime` parameter. That
31
+ * is how a structural mirror fails: quietly, with both sides compiling.
32
+ *
33
+ * The 2 constant strings (`memory.recall` span name +
34
+ * `theokit_memory_recall_duration_ms` histogram name) are still inlined
35
+ * below, because sdk-core's `span-names.ts` remains private. They are
36
+ * values rather than types, so exporting them is a separate decision
37
+ * with a real bundle cost — unlike these two, which erase at build time.
33
38
  *
34
39
  * @internal
35
40
  */
41
+ import type { TelemetryHandle } from "@theokit/sdk";
36
42
  import type { CircuitBreaker } from "../circuit-breaker.js";
37
43
  import type { MemoryIndex } from "../index/memory-index.js";
38
44
  import type { ActiveMemoryCache } from "./active-memory-cache.js";
39
45
  import type { ActiveMemoryQueryMode, ActiveMemoryResult, ActiveMemoryStatus } from "./active-memory-types.js";
40
46
  export type { ActiveMemoryQueryMode, ActiveMemoryResult, ActiveMemoryStatus };
41
- interface OTelSpan {
42
- setAttribute(key: string, value: string | number | boolean): void;
43
- setAttributes(attrs: Record<string, string | number | boolean>): void;
44
- addEvent(name: string, attrs?: Record<string, string | number | boolean>): void;
45
- setStatus(status: {
46
- code: number;
47
- message?: string;
48
- }): void;
49
- recordException(exception: unknown): void;
50
- end(): void;
51
- spanContext(): {
52
- traceId: string;
53
- spanId: string;
54
- };
55
- isRecording(): boolean;
56
- }
57
- interface TelemetryHandle {
58
- startSpan(name: string, attrs?: Record<string, string | number | boolean>): OTelSpan;
59
- recordHistogram(name: string, value: number, attrs?: Record<string, string | number | boolean>): void;
60
- }
47
+ /**
48
+ * Tuning for one recall attempt. Recall is off unless `enabled` is exactly
49
+ * `true`, so an options object that omits it disables recall rather than
50
+ * enabling it with defaults.
51
+ */
61
52
  export interface ActiveMemoryOptions {
62
53
  /** Whether active recall is enabled. Default `false`. */
63
54
  enabled?: boolean;
@@ -70,6 +61,16 @@ export interface ActiveMemoryOptions {
70
61
  /** Number of recent user turns to include in `queryMode === "recent"`. Default `2`. */
71
62
  recentUserTurns?: number;
72
63
  }
64
+ /**
65
+ * Everything {@link runActiveMemory} needs for one attempt. Only `userText`,
66
+ * `priorMessages`, `index` and `options` are required; the rest add breaker,
67
+ * cache, transcript persistence and telemetry, each of which is inert when
68
+ * omitted.
69
+ *
70
+ * `index` is accepted as `undefined` on purpose — an agent with memory
71
+ * configured but no index open is a normal state, and it produces a `skipped`
72
+ * result rather than an error.
73
+ */
73
74
  export interface RunActiveMemoryArgs {
74
75
  userText: string;
75
76
  priorMessages: ReadonlyArray<{
@@ -104,5 +105,29 @@ export interface RunActiveMemoryArgs {
104
105
  /** Memory scope (`session` / `user` / `global`) for span/histogram dimensions. */
105
106
  scope?: string;
106
107
  }
108
+ /**
109
+ * Run one blocking recall before the system prompt is assembled, and report what
110
+ * happened. Never throws for a recall failure: a search that times out or
111
+ * rejects comes back as a `timeout` or `error` status with no summary, and the
112
+ * agent run continues without memory.
113
+ *
114
+ * The order of the short-circuits decides what a caller sees. Recall disabled or
115
+ * no index gives `skipped` with no search. An open circuit breaker gives
116
+ * `skipped` too. A cache hit returns the earlier result as-is, which means it
117
+ * also returns that result's `status` and `durationMs` — a cached `no-recall`
118
+ * looks exactly like a fresh one. An empty query gives `no-recall`.
119
+ *
120
+ * Only a real search reaches the breaker: `timeout` records a timeout, `ok` and
121
+ * `no-recall` record a success, and `error` records neither, so a provider that
122
+ * keeps throwing will not trip the breaker.
123
+ *
124
+ * `timeoutMs` bounds how long this waits, not how long the search runs — the
125
+ * underlying `index.search` is left running when the timer wins. The search asks
126
+ * the index for at most 5 hits regardless of options.
127
+ *
128
+ * Cache entries are keyed by tenant as well as by query text, so two callers
129
+ * with the same question and different `userId` / `namespace` / `scope` never
130
+ * share an entry.
131
+ */
107
132
  export declare function runActiveMemory(args: RunActiveMemoryArgs): Promise<ActiveMemoryResult>;
108
133
  //# sourceMappingURL=active-memory.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"active-memory.d.ts","sourceRoot":"","sources":["../../../src/internal/active-memory/active-memory.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAE5D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B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AkB,CAAC,EAAE,OAAO,CAAC;IAC7B,iEAAiE;IACjE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,yCAAyC;IACzC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;;OAKG;IACH,SAAS,CAAC,EAAE,eAAe,CAAC;IAC5B,8EAA8E;IAC9E,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,kFAAkF;IAClF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kFAAkF;IAClF,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AASD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAsB,eAAe,CAAC,IAAI,EAAE,mBAAmB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAsD5F"}
@@ -58,6 +58,24 @@ interface MapOpenAiErrorArgs {
58
58
  headers: Headers | undefined;
59
59
  endpoint: string;
60
60
  }
61
+ /**
62
+ * Turn a failed OpenAI-shaped HTTP response into the typed error the SDK throws.
63
+ * Builds the error, it does not throw it.
64
+ *
65
+ * The HTTP status picks the class: 401 and 403 give an `AuthenticationError`,
66
+ * 429 a `RateLimitError`, 400 a `ConfigurationError`, 408 and 5xx a
67
+ * `NetworkError`, and anything else an `UnknownAgentError`.
68
+ *
69
+ * The `code` on the metadata is finer than the class and is read from
70
+ * `body.error.code` (or `.type`) first, so a 400 that names a context-window
71
+ * problem carries `context_too_long` rather than `invalid_request`. A body code
72
+ * naming an exhausted quota, and HTTP 402, both map to `quota_exceeded` — note
73
+ * that a 402 keeps that code while still producing an `UnknownAgentError`,
74
+ * because no status branch claims it.
75
+ *
76
+ * The raw body rides along on the metadata, truncated to about 2KB and passed
77
+ * through secret redaction, so it is safe to log.
78
+ */
61
79
  export declare function mapOpenAICompatibleError(args: MapOpenAiErrorArgs): TheokitAgentError;
62
80
  export {};
63
81
  //# sourceMappingURL=adapter-http-error.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"adapter-http-error.d.ts","sourceRoot":"","sources":["../../src/internal/adapter-http-error.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,EAGL,KAAK,SAAS,EACd,KAAK,aAAa,EAGlB,KAAK,iBAAiB,EAEvB,MAAM,qBAAqB,CAAC;AAM7B;;;GAGG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,OAAO,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAOhF;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAKlD;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE;IACvC,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,SAAS,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,OAAO,GAAG,SAAS,CAAC;IAC7B,IAAI,EAAE,OAAO,CAAC;CACf,GAAG,aAAa,CAWhB;AAED,UAAU,kBAAkB;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,OAAO,GAAG,SAAS,CAAC;IAC7B,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,kBAAkB,GAAG,iBAAiB,CA6BpF"}
1
+ {"version":3,"file":"adapter-http-error.d.ts","sourceRoot":"","sources":["../../src/internal/adapter-http-error.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,EAGL,KAAK,SAAS,EACd,KAAK,aAAa,EAGlB,KAAK,iBAAiB,EAEvB,MAAM,qBAAqB,CAAC;AAM7B;;;GAGG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,OAAO,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAOhF;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAKlD;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE;IACvC,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,SAAS,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,OAAO,GAAG,SAAS,CAAC;IAC7B,IAAI,EAAE,OAAO,CAAC;CACf,GAAG,aAAa,CAWhB;AAED,UAAU,kBAAkB;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,OAAO,GAAG,SAAS,CAAC;IAC7B,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,kBAAkB,GAAG,iBAAiB,CA6BpF"}
@@ -20,6 +20,23 @@ interface KeyState {
20
20
  consecutiveTimeouts: number;
21
21
  cooldownUntilMs: number;
22
22
  }
23
+ /**
24
+ * Stops calling a recall path that keeps timing out.
25
+ *
26
+ * After `maxTimeouts` consecutive timeouts on a key (default 3) the breaker
27
+ * opens and {@link CircuitBreaker.shouldSkip} reports `true` until `cooldownMs`
28
+ * has elapsed (default 60s). The first `shouldSkip` after the cooldown closes
29
+ * the breaker and resets the counter, so it re-opens only after another full run
30
+ * of timeouts.
31
+ *
32
+ * It counts timeouts, not failures. An error recorded by neither
33
+ * `recordTimeout` nor `recordSuccess` leaves the counter where it was, so a call
34
+ * path that throws rather than hanging will never trip it.
35
+ *
36
+ * State is per key and held in this instance, which is what keeps two agents in
37
+ * one process from sharing a counter. Construct one per agent and pass a stable
38
+ * key.
39
+ */
23
40
  export declare class CircuitBreaker {
24
41
  private readonly opts;
25
42
  private readonly states;
@@ -1 +1 @@
1
- {"version":3,"file":"circuit-breaker.d.ts","sourceRoot":"","sources":["../../src/internal/circuit-breaker.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,MAAM,WAAW,qBAAqB;IACpC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,kCAAkC;IAClC,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;CACpB;AAED,UAAU,QAAQ;IAChB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,eAAe,EAAE,MAAM,CAAC;CACzB;AAKD,qBAAa,cAAc;IAGb,OAAO,CAAC,QAAQ,CAAC,IAAI;IAFjC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA+B;gBAEzB,IAAI,GAAE,qBAA0B;IAE7D,6EAA6E;IAC7E,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAWhC,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAOhC,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAShC,+CAA+C;IAC/C,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,QAAQ,CAAC,QAAQ,CAAC;IAIxC,OAAO,CAAC,GAAG;CAGZ"}
1
+ {"version":3,"file":"circuit-breaker.d.ts","sourceRoot":"","sources":["../../src/internal/circuit-breaker.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,MAAM,WAAW,qBAAqB;IACpC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,kCAAkC;IAClC,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;CACpB;AAED,UAAU,QAAQ;IAChB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,eAAe,EAAE,MAAM,CAAC;CACzB;AAKD;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,cAAc;IAGb,OAAO,CAAC,QAAQ,CAAC,IAAI;IAFjC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA+B;gBAEzB,IAAI,GAAE,qBAA0B;IAE7D,6EAA6E;IAC7E,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAWhC,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAOhC,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAShC,+CAA+C;IAC/C,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,QAAQ,CAAC,QAAQ,CAAC;IAIxC,OAAO,CAAC,GAAG;CAGZ"}
@@ -31,8 +31,35 @@ export interface DiaryEntry {
31
31
  clustersCreated: number;
32
32
  notesWritten: number;
33
33
  }
34
+ /** Path to the dream diary, `<memory root>/dream-diary.md`. Pure path computation. */
34
35
  export declare function diaryPath(cwd: string): string;
36
+ /**
37
+ * Render one entry as the markdown block {@link appendDiaryEntry} writes: an h2
38
+ * heading carrying the ISO timestamp, then a bullet list of the counts, prefixed
39
+ * by the first eight hex characters of {@link entryHash}.
40
+ */
35
41
  export declare function renderDiaryEntry(entry: DiaryEntry): string;
42
+ /**
43
+ * Append one entry to the dream diary, creating the file with a `# Dream Diary`
44
+ * header when it does not exist yet. The whole file is rewritten through an
45
+ * atomic replace, so a crash mid-write leaves the previous diary intact rather
46
+ * than a truncated one.
47
+ *
48
+ * The parent directory is not created here. Call this against a workspace whose
49
+ * memory directory already exists — a dreaming sweep does, because it has just
50
+ * read `MEMORY.md` from it.
51
+ *
52
+ * Appending is unconditional: passing an entry that was already written adds a
53
+ * second block. The hash identifies repeated content, it does not suppress it.
54
+ */
36
55
  export declare function appendDiaryEntry(cwd: string, entry: DiaryEntry): Promise<void>;
56
+ /**
57
+ * A sha256 over the five counts of an entry, as a hex string.
58
+ *
59
+ * The timestamp is deliberately NOT part of the hash, so two sweeps that changed
60
+ * nothing produce the same hash at different times — that is the signal the
61
+ * diary is meant to carry. It also means the hash does not identify an entry
62
+ * uniquely.
63
+ */
37
64
  export declare function entryHash(entry: DiaryEntry): string;
38
65
  //# sourceMappingURL=dreaming-diary.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"dreaming-diary.d.ts","sourceRoot":"","sources":["../../../src/internal/dreaming/dreaming-diary.ts"],"names":[],"mappings":"AAQA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,MAAM,WAAW,UAAU;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,eAAe,EAAE,MAAM,CAAC;IACxB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE7C;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAc1D;AAED,wBAAsB,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAUpF;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAYnD"}
1
+ {"version":3,"file":"dreaming-diary.d.ts","sourceRoot":"","sources":["../../../src/internal/dreaming/dreaming-diary.ts"],"names":[],"mappings":"AAQA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,MAAM,WAAW,UAAU;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,eAAe,EAAE,MAAM,CAAC;IACxB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,sFAAsF;AACtF,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE7C;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAc1D;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAUpF;AAED;;;;;;;GAOG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAYnD"}
@@ -27,10 +27,21 @@ export interface DedupResult {
27
27
  kept: MemoryFact[];
28
28
  duplicatesRemoved: number;
29
29
  }
30
+ /**
31
+ * A group of facts the REM phase judged related. `representativeText` is the
32
+ * text of the longest member, used as the cluster's heading in the consolidated
33
+ * note — longest, not most central, so it is a readable label rather than a
34
+ * centroid. `members` includes that fact as well.
35
+ */
30
36
  export interface Cluster {
31
37
  representativeText: string;
32
38
  members: ReadonlyArray<MemoryFact>;
33
39
  }
40
+ /**
41
+ * What {@link remPhase} produced. Every input fact appears in exactly one
42
+ * cluster, so a fact related to nothing comes back as a cluster of one — the
43
+ * count is not a count of *interesting* groupings.
44
+ */
34
45
  export interface ClusterResult {
35
46
  clusters: Cluster[];
36
47
  }
@@ -1 +1 @@
1
- {"version":3,"file":"dreaming-phases.d.ts","sourceRoot":"","sources":["../../../src/internal/dreaming/dreaming-phases.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAC1E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,UAAU,EAAE,CAAC;IACnB,iBAAiB,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,WAAW,OAAO;IACtB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,OAAO,EAAE,aAAa,CAAC,UAAU,CAAC,CAAC;CACpC;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,OAAO,EAAE,CAAC;CACrB;AAKD,mFAAmF;AACnF,wBAAsB,UAAU,CAC9B,KAAK,EAAE,aAAa,CAAC,UAAU,CAAC,EACh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AAgB,EAC3B,SAAS,GAAE,MAAkC,EAC7C,gBAAgB,GAAE,MAAoC,GACrD,OAAO,CAAC,aAAa,CAAC,CAQxB;AAoCD,sEAAsE;AACtE,wBAAgB,SAAS,CAAC,QAAQ,EAAE,aAAa,CAAC,OAAO,CAAC,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,CAavF"}
@@ -8,8 +8,12 @@ import type { EmbeddingRuntime } from "../embedding/embedding-adapter.js";
8
8
  * 3. **deep** — write a `notes/dreamed-<ts>.md` per sweep with consolidated
9
9
  * clusters; append a diary entry.
10
10
  *
11
- * All file writes go through `replaceFileAtomic` (EC-3) and the entire sweep
12
- * holds the per-cwd mutex so a `Remember:` append can't race it.
11
+ * All file writes go through `replaceFileAtomic` (EC-3). The sweep holds a
12
+ * mutex for the whole run, so two sweeps over the same workspace serialize.
13
+ * Note the key is `dream:<cwd>`, while `appendFactToMarkdown` locks on the
14
+ * memory directory — different keys, so a concurrent `Remember:` append is NOT
15
+ * excluded by this lock. It cannot corrupt a file (each write is atomic), but a
16
+ * fact appended after the sweep read `MEMORY.md` is simply not in the sweep.
13
17
  *
14
18
  * Iter 60 (Stage 3 source-move #17): hybrid copy from sdk-core's
15
19
  * `internal/memory/dreaming/run.ts`. sdk-core retains its copy for
@@ -36,6 +40,18 @@ export interface DreamingOptions {
36
40
  /** Test hook — fixed timestamp for the run. */
37
41
  now?: () => number;
38
42
  }
43
+ /**
44
+ * What one sweep did. `skipped` means `MEMORY.md` held no facts; `error` means
45
+ * the sweep threw and the counts are all zero.
46
+ *
47
+ * `factsAfter` is the count that survived in-memory deduplication, not a new
48
+ * size for `MEMORY.md` — the sweep does not rewrite it, so the duplicates it
49
+ * counted are still on disk and will be counted again next time. `notesWritten`
50
+ * is 0 or 1: one consolidated note per sweep, holding every cluster.
51
+ *
52
+ * `diaryEntryHash` is currently always `undefined`, on every path including
53
+ * success, even though the diary entry itself is written with a hash.
54
+ */
39
55
  export interface DreamingResult {
40
56
  status: "ok" | "skipped" | "error";
41
57
  factsBefore: number;
@@ -45,5 +61,21 @@ export interface DreamingResult {
45
61
  notesWritten: number;
46
62
  diaryEntryHash: string | undefined;
47
63
  }
64
+ /**
65
+ * Run one consolidation sweep over `MEMORY.md`: drop near-duplicate facts,
66
+ * cluster what is left, write a consolidated note under `notes/`, and append a
67
+ * diary entry.
68
+ *
69
+ * Every fact is embedded on each sweep, and clustering compares every pair, so
70
+ * cost grows with the square of the corpus. That is why the REM phase looks at
71
+ * the first 500 facts only.
72
+ *
73
+ * Never rejects: a failure is written to stderr and reported as
74
+ * `status: "error"`, so a sweep scheduled inside an agent run cannot break it.
75
+ *
76
+ * The sweep is read-only with respect to `MEMORY.md`. It produces a note beside
77
+ * it and leaves the fact list untouched, which means running it twice produces
78
+ * two notes over the same facts.
79
+ */
48
80
  export declare function runDreamingSweep(options: DreamingOptions): Promise<DreamingResult>;
49
81
  //# sourceMappingURL=dreaming-run.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"dreaming-run.d.ts","sourceRoot":"","sources":["../../../src/internal/dreaming/dreaming-run.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAK1E;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,MAAM,WAAW,eAAe;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,gBAAgB,CAAC;IAC5B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,+CAA+C;IAC/C,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,IAAI,GAAG,SAAS,GAAG,OAAO,CAAC;IACnC,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,eAAe,EAAE,MAAM,CAAC;IACxB,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,GAAG,SAAS,CAAC;CACpC;AAED,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,cAAc,CAAC,CAElF"}
1
+ {"version":3,"file":"dreaming-run.d.ts","sourceRoot":"","sources":["../../../src/internal/dreaming/dreaming-run.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAK1E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,MAAM,WAAW,eAAe;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,gBAAgB,CAAC;IAC5B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,+CAA+C;IAC/C,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;CACpB;AAED;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,IAAI,GAAG,SAAS,GAAG,OAAO,CAAC;IACnC,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,eAAe,EAAE,MAAM,CAAC;IACxB,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,GAAG,SAAS,CAAC;CACpC;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,cAAc,CAAC,CAElF"}
@@ -17,5 +17,27 @@ import type { MemoryEmbeddingProviderAdapter } from "./embedding-adapter.js";
17
17
  * @internal
18
18
  */
19
19
  export declare const DEFAULT_AZURE_OPENAI_EMBEDDING_MODEL = "text-embedding-3-small";
20
+ /**
21
+ * Azure OpenAI embeddings. Same models as the OpenAI adapter, addressed the
22
+ * Azure way, and the one adapter whose configuration is not just "set a key".
23
+ *
24
+ * Two things differ from every other adapter here. `model` names your Azure
25
+ * DEPLOYMENT, not an OpenAI model id — it is substituted into the path
26
+ * (`/openai/deployments/{model}/embeddings`) rather than sent in the body. And
27
+ * `AZURE_OPENAI_ENDPOINT` must be set to your resource URL, without the
28
+ * `/openai/...` suffix; the built-in default is a placeholder that resolves
29
+ * nowhere, so leaving it unset fails at the network rather than at
30
+ * configuration.
31
+ *
32
+ * Authentication uses the `api-key` header, which is what an Azure resource key
33
+ * expects; Entra ID bearer tokens are not supported by this adapter. Reads
34
+ * `AZURE_OPENAI_API_KEY`. The API version is pinned to `2024-02-01`.
35
+ *
36
+ * The deployment name still has to appear in the dimension table
37
+ * (`text-embedding-3-small`, `-3-large`, `ada-002`), so a deployment named
38
+ * anything else is refused with `embedding_unknown_model` — pass `model` as the
39
+ * matching id and point the base URL at the right deployment, or add the name to
40
+ * the table.
41
+ */
20
42
  export declare const azureOpenAiMemoryEmbeddingProviderAdapter: MemoryEmbeddingProviderAdapter;
21
43
  //# sourceMappingURL=azure-openai-embedding.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"azure-openai-embedding.d.ts","sourceRoot":"","sources":["../../../src/internal/embedding/azure-openai-embedding.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,wBAAwB,CAAC;AAK7E;;;;;;;;;;;;;;;;GAgBG;AAEH,eAAO,MAAM,oCAAoC,2BAA2B,CAAC;AAQ7E,eAAO,MAAM,yCAAyC,EAAE,8BA2BvD,CAAC"}
1
+ {"version":3,"file":"azure-openai-embedding.d.ts","sourceRoot":"","sources":["../../../src/internal/embedding/azure-openai-embedding.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,wBAAwB,CAAC;AAK7E;;;;;;;;;;;;;;;;GAgBG;AAEH,eAAO,MAAM,oCAAoC,2BAA2B,CAAC;AAQ7E;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,yCAAyC,EAAE,8BA2BvD,CAAC"}
@@ -1,7 +1,8 @@
1
1
  import type { MemoryEmbeddingProviderAdapter } from "./embedding-adapter.js";
2
2
  /**
3
- * Cohere embedding adapter — `POST /v2/embed` at `https://api.cohere.com`, which carries the
4
- * OpenAI-compatible `{ model, input }` request shape.
3
+ * Cohere embedding adapter — `POST /v2/embed` at `https://api.cohere.com`. Despite living beside
4
+ * the OpenAI-compatible adapters, this endpoint is NOT OpenAI-shaped in either direction; the
5
+ * `dialect` below is what makes it work.
5
6
  *
6
7
  * Honors `COHERE_API_KEY`.
7
8
  *
@@ -10,5 +11,20 @@ import type { MemoryEmbeddingProviderAdapter } from "./embedding-adapter.js";
10
11
  * @internal
11
12
  */
12
13
  export declare const DEFAULT_COHERE_EMBEDDING_MODEL = "embed-english-v3.0";
14
+ /**
15
+ * Cohere embeddings. Priority 30, so it is auto-selected ahead of OpenAI when
16
+ * both keys are present.
17
+ *
18
+ * Cohere does not speak the OpenAI wire, and this adapter supplies a dialect for
19
+ * it: the request names its payload `texts`, the response returns
20
+ * `{embeddings: {float: [...]}}`, and `input_type` is sent as
21
+ * `search_document`. That last choice matters — Cohere's v3 models embed
22
+ * documents and queries into different spaces, and this runtime always embeds as
23
+ * a document, including the query side of a search. Expect somewhat weaker
24
+ * retrieval than a Cohere-native setup that embeds queries as `search_query`.
25
+ *
26
+ * Reads `COHERE_API_KEY`; no base-URL environment override is declared. The
27
+ * light models are 384 dimensions and the others 1024.
28
+ */
13
29
  export declare const cohereMemoryEmbeddingProviderAdapter: MemoryEmbeddingProviderAdapter;
14
30
  //# sourceMappingURL=cohere-embedding.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"cohere-embedding.d.ts","sourceRoot":"","sources":["../../../src/internal/embedding/cohere-embedding.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,wBAAwB,CAAC;AAK7E;;;;;;;;;GASG;AAEH,eAAO,MAAM,8BAA8B,uBAAuB,CAAC;AASnE,eAAO,MAAM,oCAAoC,EAAE,8BAgClD,CAAC"}
1
+ {"version":3,"file":"cohere-embedding.d.ts","sourceRoot":"","sources":["../../../src/internal/embedding/cohere-embedding.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,wBAAwB,CAAC;AAK7E;;;;;;;;;;GAUG;AAEH,eAAO,MAAM,8BAA8B,uBAAuB,CAAC;AASnE;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,oCAAoC,EAAE,8BAgClD,CAAC"}
@@ -14,5 +14,18 @@ import type { MemoryEmbeddingProviderAdapter } from "./embedding-adapter.js";
14
14
  * @internal
15
15
  */
16
16
  export declare const DEFAULT_DEEPINFRA_EMBEDDING_MODEL = "BAAI/bge-large-en-v1.5";
17
+ /**
18
+ * Open-weight embedding models (BGE, E5, GTE, MiniLM) hosted by DeepInfra.
19
+ * Reach for it when you want a specific open model — particularly a multilingual
20
+ * one — behind a hosted API rather than running it yourself.
21
+ *
22
+ * Its endpoint is `/v1/openai/embeddings`, not the canonical `/v1/embeddings`;
23
+ * the wire format is otherwise OpenAI-shaped. Reads `DEEPINFRA_API_KEY` and
24
+ * honours `DEEPINFRA_API_BASE_URL`. Priority 13.
25
+ *
26
+ * Dimensions vary sharply across the ten models it knows (384 to 1024), and
27
+ * switching between them invalidates an existing vector index — the index drops
28
+ * every vector and re-embeds on the next sync.
29
+ */
17
30
  export declare const deepinfraMemoryEmbeddingProviderAdapter: MemoryEmbeddingProviderAdapter;
18
31
  //# sourceMappingURL=deepinfra-embedding.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"deepinfra-embedding.d.ts","sourceRoot":"","sources":["../../../src/internal/embedding/deepinfra-embedding.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,wBAAwB,CAAC;AAK7E;;;;;;;;;;;;;GAaG;AAEH,eAAO,MAAM,iCAAiC,2BAA2B,CAAC;AAe1E,eAAO,MAAM,uCAAuC,EAAE,8BAmBrD,CAAC"}
1
+ {"version":3,"file":"deepinfra-embedding.d.ts","sourceRoot":"","sources":["../../../src/internal/embedding/deepinfra-embedding.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,wBAAwB,CAAC;AAK7E;;;;;;;;;;;;;GAaG;AAEH,eAAO,MAAM,iCAAiC,2BAA2B,CAAC;AAe1E;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,uCAAuC,EAAE,8BAmBrD,CAAC"}
@@ -16,11 +16,21 @@ export interface MemoryEmbeddingProviderAdapter {
16
16
  readonly transport: "local" | "remote";
17
17
  /** Auth provider id used to resolve API keys (mirrors peer-project). */
18
18
  readonly authProviderId?: string;
19
- /** Higher priority = auto-select this provider first when multiple are available. */
19
+ /**
20
+ * Ranking hint — higher means "prefer this one" — for a provider auto-selection that is NOT
21
+ * implemented. Nothing reads this field today: the provider is the one the caller names in
22
+ * `embedding: { provider }`, and omitting it builds no embedding runtime at all. Kept because
23
+ * the values are pinned by tests and mirrored in sdk-core's catalog.
24
+ */
20
25
  readonly autoSelectPriority?: number;
21
26
  /** Factory — instantiate a per-agent runtime. */
22
27
  create(options: CreateAdapterOptions): Promise<EmbeddingRuntime>;
23
28
  }
29
+ /**
30
+ * Per-call overrides handed to {@link MemoryEmbeddingProviderAdapter.create}.
31
+ * Every field is optional; the adapter falls back to its own defaults and to
32
+ * the environment variables it declares.
33
+ */
24
34
  export interface CreateAdapterOptions {
25
35
  /** Override the adapter's `defaultModel`. */
26
36
  model?: string;
@@ -30,9 +40,19 @@ export interface CreateAdapterOptions {
30
40
  baseUrl?: string;
31
41
  /** Inject a fetch implementation (tests use this to stub HTTP). */
32
42
  fetch?: typeof fetch;
33
- /** Optional cache instance (else a default LRU is created). */
43
+ /** Override the embedding cache. Defaults to a process-wide LRU shared by every runtime. */
34
44
  cache?: EmbeddingCache;
35
45
  }
46
+ /**
47
+ * A live embedding provider, bound to one model. `dimension` is fixed at
48
+ * creation from the adapter's model table, which is what lets the SQLite vec0
49
+ * table and the Lance schema be created with the right width before the first
50
+ * vector arrives.
51
+ *
52
+ * `embed` resolves to one vector per input, in the same order. Whitespace-only
53
+ * inputs come back as an all-zero vector rather than an error, and downstream
54
+ * cosine similarity treats a zero-norm vector as similarity 0.
55
+ */
36
56
  export interface EmbeddingRuntime {
37
57
  readonly id: string;
38
58
  readonly model: string;
@@ -42,12 +62,26 @@ export interface EmbeddingRuntime {
42
62
  /** Observability — cache hit/miss + call counts. */
43
63
  stats(): EmbeddingRuntimeStats;
44
64
  }
65
+ /**
66
+ * Counters accumulated by a runtime since it was created. `httpCalls` counts
67
+ * every request sent, including the ones that were retried, so `httpCalls`
68
+ * minus `retries` is the number of distinct batches attempted.
69
+ */
45
70
  export interface EmbeddingRuntimeStats {
46
71
  cacheHits: number;
47
72
  cacheMisses: number;
48
73
  httpCalls: number;
49
74
  retries: number;
50
75
  }
76
+ /**
77
+ * The cache contract the shared runtime writes through. Keys are opaque — the
78
+ * runtime derives them from the model id and the text — so an implementation
79
+ * only has to behave like a bounded map.
80
+ *
81
+ * Pass one explicitly through {@link CreateAdapterOptions.cache} when entries
82
+ * must not be shared: the default is a single process-wide LRU, so two runtimes
83
+ * created in the same process see each other's entries.
84
+ */
51
85
  export interface EmbeddingCache {
52
86
  get(key: string): number[] | undefined;
53
87
  set(key: string, value: number[]): void;
@@ -1 +1 @@
1
- {"version":3,"file":"embedding-adapter.d.ts","sourceRoot":"","sources":["../../../src/internal/embedding/embedding-adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,MAAM,WAAW,8BAA8B;IAC7C,sFAAsF;IACtF,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,sFAAsF;IACtF,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,6EAA6E;IAC7E,QAAQ,CAAC,SAAS,EAAE,OAAO,GAAG,QAAQ,CAAC;IACvC,wEAAwE;IACx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ACpC,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,cAAc;IAC7B,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC;IACvC,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IACxC,oCAAoC;IACpC,IAAI,IAAI,MAAM,CAAC;CAChB"}
@@ -14,5 +14,14 @@ import type { MemoryEmbeddingProviderAdapter } from "./embedding-adapter.js";
14
14
  * @internal
15
15
  */
16
16
  export declare const DEFAULT_GEMINI_EMBEDDING_MODEL = "text-embedding-004";
17
+ /**
18
+ * Google Gemini embeddings through Google's OpenAI-compatible surface at
19
+ * `/v1beta/openai/embeddings`. Gemini's native embedding endpoint
20
+ * (`/v1beta/models/{model}:embedContent`) has a different shape and is
21
+ * deliberately not used, so this composes with the shared runtime like the rest.
22
+ *
23
+ * Both known models are 768 dimensions. Reads `GEMINI_API_KEY`; no base-URL
24
+ * environment override is declared. Priority 30.
25
+ */
17
26
  export declare const geminiMemoryEmbeddingProviderAdapter: MemoryEmbeddingProviderAdapter;
18
27
  //# sourceMappingURL=gemini-embedding.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"gemini-embedding.d.ts","sourceRoot":"","sources":["../../../src/internal/embedding/gemini-embedding.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,wBAAwB,CAAC;AAK7E;;;;;;;;;;;;;GAaG;AAEH,eAAO,MAAM,8BAA8B,uBAAuB,CAAC;AAOnE,eAAO,MAAM,oCAAoC,EAAE,8BAoBlD,CAAC"}
1
+ {"version":3,"file":"gemini-embedding.d.ts","sourceRoot":"","sources":["../../../src/internal/embedding/gemini-embedding.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,wBAAwB,CAAC;AAK7E;;;;;;;;;;;;;GAaG;AAEH,eAAO,MAAM,8BAA8B,uBAAuB,CAAC;AAOnE;;;;;;;;GAQG;AACH,eAAO,MAAM,oCAAoC,EAAE,8BAoBlD,CAAC"}
@@ -9,5 +9,14 @@ import type { MemoryEmbeddingProviderAdapter } from "./embedding-adapter.js";
9
9
  * @internal
10
10
  */
11
11
  export declare const DEFAULT_JINA_EMBEDDING_MODEL = "jina-embeddings-v3";
12
+ /**
13
+ * Jina AI embeddings, over the standard OpenAI wire. Highest auto-select
14
+ * priority in the catalog (35), so it wins over OpenAI when both keys are
15
+ * present.
16
+ *
17
+ * Default `jina-embeddings-v3` at 1024 dimensions; the v2 models are 768 and
18
+ * 512. Reads `JINA_API_KEY`. No base-URL environment override is declared —
19
+ * point it elsewhere by passing `baseUrl` to `create`.
20
+ */
12
21
  export declare const jinaMemoryEmbeddingProviderAdapter: MemoryEmbeddingProviderAdapter;
13
22
  //# sourceMappingURL=jina-embedding.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"jina-embedding.d.ts","sourceRoot":"","sources":["../../../src/internal/embedding/jina-embedding.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,wBAAwB,CAAC;AAK7E;;;;;;;;GAQG;AAEH,eAAO,MAAM,4BAA4B,uBAAuB,CAAC;AAQjE,eAAO,MAAM,kCAAkC,EAAE,8BAiBhD,CAAC"}
1
+ {"version":3,"file":"jina-embedding.d.ts","sourceRoot":"","sources":["../../../src/internal/embedding/jina-embedding.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,wBAAwB,CAAC;AAK7E;;;;;;;;GAQG;AAEH,eAAO,MAAM,4BAA4B,uBAAuB,CAAC;AAQjE;;;;;;;;GAQG;AACH,eAAO,MAAM,kCAAkC,EAAE,8BAiBhD,CAAC"}