gemi 0.135.0 → 0.137.0

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 (221) hide show
  1. package/dist/ai/Agent.d.ts +48 -5
  2. package/dist/ai/Agent.d.ts.map +1 -1
  3. package/dist/ai/AgentController.d.ts +42 -2
  4. package/dist/ai/AgentController.d.ts.map +1 -1
  5. package/dist/ai/index.d.ts +3 -1
  6. package/dist/ai/index.d.ts.map +1 -1
  7. package/dist/ai/index.js +85 -18
  8. package/dist/ai/index.js.map +5 -4
  9. package/dist/ai/memory/AgentMemories.d.ts +226 -0
  10. package/dist/ai/memory/AgentMemories.d.ts.map +1 -0
  11. package/dist/ai/memory/AgentMemoryStore.d.ts +182 -0
  12. package/dist/ai/memory/AgentMemoryStore.d.ts.map +1 -0
  13. package/dist/ai/memory/DatabaseAgentMemoryStore.d.ts +76 -0
  14. package/dist/ai/memory/DatabaseAgentMemoryStore.d.ts.map +1 -0
  15. package/dist/ai/memory/contextBlock.d.ts +32 -0
  16. package/dist/ai/memory/contextBlock.d.ts.map +1 -0
  17. package/dist/ai/memory/index.d.ts +6 -0
  18. package/dist/ai/memory/index.d.ts.map +1 -0
  19. package/dist/ai/memory/runMemory.d.ts +355 -0
  20. package/dist/ai/memory/runMemory.d.ts.map +1 -0
  21. package/dist/ai/memory/safety.d.ts +34 -0
  22. package/dist/ai/memory/safety.d.ts.map +1 -0
  23. package/dist/ai/memory/search.d.ts +23 -0
  24. package/dist/ai/memory/search.d.ts.map +1 -0
  25. package/dist/app/index.js +1 -1
  26. package/dist/bun/plugin.js +1 -1
  27. package/dist/bun/preload.js +1 -1
  28. package/dist/{chunk-rnp5k8m3.js → chunk-038xtqpm.js} +2 -2
  29. package/dist/{chunk-rnp5k8m3.js.map → chunk-038xtqpm.js.map} +1 -1
  30. package/dist/{chunk-5pdgh9a1.js → chunk-26yghzet.js} +2 -2
  31. package/dist/{chunk-5pdgh9a1.js.map → chunk-26yghzet.js.map} +1 -1
  32. package/dist/{chunk-ha15x5ns.js → chunk-27xv8kty.js} +2 -2
  33. package/dist/{chunk-ha15x5ns.js.map → chunk-27xv8kty.js.map} +1 -1
  34. package/dist/{chunk-k2xeskp6.js → chunk-3jkem5gq.js} +2 -2
  35. package/dist/{chunk-k2xeskp6.js.map → chunk-3jkem5gq.js.map} +1 -1
  36. package/dist/{chunk-q15f5g86.js → chunk-46bwknb5.js} +3 -3
  37. package/dist/{chunk-q15f5g86.js.map → chunk-46bwknb5.js.map} +1 -1
  38. package/dist/{chunk-8sde8337.js → chunk-4jc7wbet.js} +2 -2
  39. package/dist/{chunk-8sde8337.js.map → chunk-4jc7wbet.js.map} +1 -1
  40. package/dist/{chunk-rhjh79np.js → chunk-4zjtbgnr.js} +2 -2
  41. package/dist/{chunk-rhjh79np.js.map → chunk-4zjtbgnr.js.map} +1 -1
  42. package/dist/{chunk-feajsgns.js → chunk-5benn2ys.js} +3 -3
  43. package/dist/{chunk-feajsgns.js.map → chunk-5benn2ys.js.map} +1 -1
  44. package/dist/{chunk-rzqft8q8.js → chunk-6qzyq0g5.js} +2 -2
  45. package/dist/{chunk-rzqft8q8.js.map → chunk-6qzyq0g5.js.map} +1 -1
  46. package/dist/{chunk-6qty7at2.js → chunk-78zfqt54.js} +2 -2
  47. package/dist/{chunk-6qty7at2.js.map → chunk-78zfqt54.js.map} +1 -1
  48. package/dist/{chunk-ysc7ykss.js → chunk-7d26eqv1.js} +2 -2
  49. package/dist/{chunk-ysc7ykss.js.map → chunk-7d26eqv1.js.map} +1 -1
  50. package/dist/{chunk-6fr6j338.js → chunk-7t7jh8t2.js} +2 -2
  51. package/dist/{chunk-6fr6j338.js.map → chunk-7t7jh8t2.js.map} +1 -1
  52. package/dist/{chunk-xvvsc58s.js → chunk-7vxeqxxr.js} +2 -2
  53. package/dist/{chunk-xvvsc58s.js.map → chunk-7vxeqxxr.js.map} +1 -1
  54. package/dist/{chunk-zyhmn3hy.js → chunk-80fjsb26.js} +3 -3
  55. package/dist/{chunk-zyhmn3hy.js.map → chunk-80fjsb26.js.map} +1 -1
  56. package/dist/{chunk-xymr3asa.js → chunk-85k70cme.js} +3 -3
  57. package/dist/{chunk-xymr3asa.js.map → chunk-85k70cme.js.map} +1 -1
  58. package/dist/{chunk-ka991yx4.js → chunk-8dmhbj4m.js} +2 -2
  59. package/dist/{chunk-ka991yx4.js.map → chunk-8dmhbj4m.js.map} +1 -1
  60. package/dist/{chunk-8ryrjtn0.js → chunk-8ef5c93d.js} +2 -2
  61. package/dist/{chunk-8ryrjtn0.js.map → chunk-8ef5c93d.js.map} +1 -1
  62. package/dist/{chunk-t33yh84d.js → chunk-8p4t8x9c.js} +2 -2
  63. package/dist/{chunk-t33yh84d.js.map → chunk-8p4t8x9c.js.map} +1 -1
  64. package/dist/{chunk-7nxnyw7x.js → chunk-965gfa41.js} +2 -2
  65. package/dist/{chunk-7nxnyw7x.js.map → chunk-965gfa41.js.map} +1 -1
  66. package/dist/{chunk-swwkdm75.js → chunk-974p7em0.js} +2 -2
  67. package/dist/{chunk-swwkdm75.js.map → chunk-974p7em0.js.map} +1 -1
  68. package/dist/{chunk-krk880my.js → chunk-9s203ks3.js} +2 -2
  69. package/dist/{chunk-krk880my.js.map → chunk-9s203ks3.js.map} +1 -1
  70. package/dist/{chunk-0eamc2tr.js → chunk-9wc53ywv.js} +2 -2
  71. package/dist/{chunk-0eamc2tr.js.map → chunk-9wc53ywv.js.map} +1 -1
  72. package/dist/{chunk-hb9hm8za.js → chunk-a2fhbstt.js} +3 -3
  73. package/dist/{chunk-hb9hm8za.js.map → chunk-a2fhbstt.js.map} +1 -1
  74. package/dist/{chunk-cxsvzqd4.js → chunk-aj2sr77y.js} +2 -2
  75. package/dist/{chunk-cxsvzqd4.js.map → chunk-aj2sr77y.js.map} +1 -1
  76. package/dist/{chunk-0gg4e94v.js → chunk-an1nja68.js} +2 -2
  77. package/dist/{chunk-0gg4e94v.js.map → chunk-an1nja68.js.map} +1 -1
  78. package/dist/{chunk-jy9dkgt0.js → chunk-ant9ck0r.js} +2 -2
  79. package/dist/{chunk-jy9dkgt0.js.map → chunk-ant9ck0r.js.map} +1 -1
  80. package/dist/chunk-atmw5c0q.js +28 -0
  81. package/dist/chunk-atmw5c0q.js.map +27 -0
  82. package/dist/{chunk-sa6cxt3g.js → chunk-bg0e39dk.js} +2 -2
  83. package/dist/{chunk-sa6cxt3g.js.map → chunk-bg0e39dk.js.map} +1 -1
  84. package/dist/{chunk-1awxdnb6.js → chunk-c0m8pcbd.js} +1 -1
  85. package/dist/{chunk-65j32dtn.js → chunk-c6c7p43e.js} +2 -2
  86. package/dist/{chunk-65j32dtn.js.map → chunk-c6c7p43e.js.map} +1 -1
  87. package/dist/{chunk-x9bk5s21.js → chunk-c83e4ghx.js} +2 -2
  88. package/dist/{chunk-x9bk5s21.js.map → chunk-c83e4ghx.js.map} +1 -1
  89. package/dist/{chunk-jgx8ggbz.js → chunk-cedmppcy.js} +2 -2
  90. package/dist/{chunk-jgx8ggbz.js.map → chunk-cedmppcy.js.map} +1 -1
  91. package/dist/{chunk-wrsf2abe.js → chunk-chyt9th4.js} +2 -2
  92. package/dist/{chunk-wrsf2abe.js.map → chunk-chyt9th4.js.map} +1 -1
  93. package/dist/{chunk-qfra7gah.js → chunk-d368es1y.js} +2 -2
  94. package/dist/{chunk-qfra7gah.js.map → chunk-d368es1y.js.map} +1 -1
  95. package/dist/{chunk-dt95z6et.js → chunk-d492ae5e.js} +2 -2
  96. package/dist/{chunk-dt95z6et.js.map → chunk-d492ae5e.js.map} +1 -1
  97. package/dist/{chunk-beb265c9.js → chunk-e440f645.js} +2 -2
  98. package/dist/{chunk-beb265c9.js.map → chunk-e440f645.js.map} +1 -1
  99. package/dist/{chunk-njpnstck.js → chunk-eqzxvfvt.js} +2 -2
  100. package/dist/{chunk-njpnstck.js.map → chunk-eqzxvfvt.js.map} +1 -1
  101. package/dist/{chunk-99a4e6zf.js → chunk-f9w78tbd.js} +2 -2
  102. package/dist/{chunk-99a4e6zf.js.map → chunk-f9w78tbd.js.map} +1 -1
  103. package/dist/chunk-fjw51b91.js +10 -0
  104. package/dist/{chunk-sxcxmwbt.js.map → chunk-fjw51b91.js.map} +3 -3
  105. package/dist/chunk-fs4ntgdr.js +5 -0
  106. package/dist/{chunk-47e7fbsp.js.map → chunk-fs4ntgdr.js.map} +1 -1
  107. package/dist/{chunk-gng5e7pd.js → chunk-fwmmy0jn.js} +1 -1
  108. package/dist/{chunk-mw7ft5bs.js → chunk-g22q8j2s.js} +2 -2
  109. package/dist/{chunk-mw7ft5bs.js.map → chunk-g22q8j2s.js.map} +1 -1
  110. package/dist/{chunk-z9xxthp1.js → chunk-ghbzre7k.js} +3 -3
  111. package/dist/{chunk-z9xxthp1.js.map → chunk-ghbzre7k.js.map} +1 -1
  112. package/dist/{chunk-x5hj0mqp.js → chunk-gq4fr0zn.js} +3 -3
  113. package/dist/{chunk-x5hj0mqp.js.map → chunk-gq4fr0zn.js.map} +1 -1
  114. package/dist/{chunk-x51tegk3.js → chunk-gqcmnyc8.js} +2 -2
  115. package/dist/{chunk-x51tegk3.js.map → chunk-gqcmnyc8.js.map} +1 -1
  116. package/dist/{chunk-x16ckgq1.js → chunk-h0ydk8cc.js} +2 -2
  117. package/dist/{chunk-x16ckgq1.js.map → chunk-h0ydk8cc.js.map} +1 -1
  118. package/dist/{chunk-m9vwg9j1.js → chunk-jys3n8xv.js} +3 -3
  119. package/dist/{chunk-m9vwg9j1.js.map → chunk-jys3n8xv.js.map} +1 -1
  120. package/dist/{chunk-3h37f124.js → chunk-kpb8xvrv.js} +2 -2
  121. package/dist/{chunk-3h37f124.js.map → chunk-kpb8xvrv.js.map} +1 -1
  122. package/dist/{chunk-mpqvmge4.js → chunk-kzdkpz04.js} +1 -1
  123. package/dist/{chunk-0rhf4g12.js → chunk-md6wfc1h.js} +3 -3
  124. package/dist/{chunk-0rhf4g12.js.map → chunk-md6wfc1h.js.map} +1 -1
  125. package/dist/{chunk-s025aycr.js → chunk-n2czjpz9.js} +2 -2
  126. package/dist/{chunk-s025aycr.js.map → chunk-n2czjpz9.js.map} +1 -1
  127. package/dist/{chunk-ff60bzvf.js → chunk-n7576zsr.js} +3 -3
  128. package/dist/{chunk-ff60bzvf.js.map → chunk-n7576zsr.js.map} +1 -1
  129. package/dist/{chunk-s782bzeq.js → chunk-nbfksexg.js} +2 -2
  130. package/dist/{chunk-s782bzeq.js.map → chunk-nbfksexg.js.map} +1 -1
  131. package/dist/{chunk-p82868xx.js → chunk-p1y58p84.js} +2 -2
  132. package/dist/{chunk-p82868xx.js.map → chunk-p1y58p84.js.map} +1 -1
  133. package/dist/{chunk-zv5qyrqg.js → chunk-p2c7z2nr.js} +2 -2
  134. package/dist/{chunk-zv5qyrqg.js.map → chunk-p2c7z2nr.js.map} +1 -1
  135. package/dist/{chunk-vnw91fe1.js → chunk-pv2mtg8n.js} +2 -2
  136. package/dist/{chunk-vnw91fe1.js.map → chunk-pv2mtg8n.js.map} +1 -1
  137. package/dist/{chunk-jx5zx48j.js → chunk-qfhcec6q.js} +2 -2
  138. package/dist/{chunk-jx5zx48j.js.map → chunk-qfhcec6q.js.map} +1 -1
  139. package/dist/{chunk-6hz63ts4.js → chunk-qk6vmvr2.js} +4 -4
  140. package/dist/{chunk-6hz63ts4.js.map → chunk-qk6vmvr2.js.map} +1 -1
  141. package/dist/{chunk-w1cksc5z.js → chunk-qvx8473q.js} +3 -3
  142. package/dist/{chunk-w1cksc5z.js.map → chunk-qvx8473q.js.map} +1 -1
  143. package/dist/{chunk-4278e429.js → chunk-rqb52m93.js} +2 -2
  144. package/dist/{chunk-4278e429.js.map → chunk-rqb52m93.js.map} +1 -1
  145. package/dist/{chunk-py1twqh8.js → chunk-skmdmqv7.js} +2 -2
  146. package/dist/{chunk-py1twqh8.js.map → chunk-skmdmqv7.js.map} +1 -1
  147. package/dist/{chunk-n68a4r72.js → chunk-t0p6zb29.js} +2 -2
  148. package/dist/{chunk-n68a4r72.js.map → chunk-t0p6zb29.js.map} +1 -1
  149. package/dist/{chunk-53rr32zm.js → chunk-ted0qjps.js} +1 -1
  150. package/dist/{chunk-hj88dcss.js → chunk-v4dp93qv.js} +3 -3
  151. package/dist/{chunk-hj88dcss.js.map → chunk-v4dp93qv.js.map} +1 -1
  152. package/dist/{chunk-33hdxe7v.js → chunk-vmr4d6hc.js} +1 -1
  153. package/dist/{chunk-3g5q0cj5.js → chunk-vz5rrcnh.js} +2 -2
  154. package/dist/{chunk-3g5q0cj5.js.map → chunk-vz5rrcnh.js.map} +1 -1
  155. package/dist/{chunk-pm8wjatv.js → chunk-w17p2k8g.js} +3 -3
  156. package/dist/{chunk-pm8wjatv.js.map → chunk-w17p2k8g.js.map} +1 -1
  157. package/dist/{chunk-j5g7qc5f.js → chunk-wbvb1hcx.js} +2 -2
  158. package/dist/{chunk-j5g7qc5f.js.map → chunk-wbvb1hcx.js.map} +1 -1
  159. package/dist/{chunk-6hstj70n.js → chunk-x1j7e46e.js} +2 -2
  160. package/dist/{chunk-6hstj70n.js.map → chunk-x1j7e46e.js.map} +1 -1
  161. package/dist/{chunk-jx2mgvvt.js → chunk-xwmy6fby.js} +3 -3
  162. package/dist/{chunk-jx2mgvvt.js.map → chunk-xwmy6fby.js.map} +1 -1
  163. package/dist/{chunk-z61dj480.js → chunk-y6gr3stt.js} +3 -3
  164. package/dist/{chunk-z61dj480.js.map → chunk-y6gr3stt.js.map} +1 -1
  165. package/dist/{chunk-4t41m5f1.js → chunk-yhp70t40.js} +2 -2
  166. package/dist/{chunk-4t41m5f1.js.map → chunk-yhp70t40.js.map} +1 -1
  167. package/dist/{chunk-zypmy8yq.js → chunk-z0jazehw.js} +2 -2
  168. package/dist/{chunk-zypmy8yq.js.map → chunk-z0jazehw.js.map} +1 -1
  169. package/dist/{chunk-e2tjw0qx.js → chunk-z19rwc6x.js} +6 -6
  170. package/dist/{chunk-e2tjw0qx.js.map → chunk-z19rwc6x.js.map} +3 -3
  171. package/dist/{chunk-gqgpwb88.js → chunk-z969a4nt.js} +2 -2
  172. package/dist/{chunk-gqgpwb88.js.map → chunk-z969a4nt.js.map} +1 -1
  173. package/dist/{chunk-hf492gg2.js → chunk-zj8y4ak5.js} +1 -1
  174. package/dist/{chunk-qpwb3gnh.js → chunk-zvzvgrrn.js} +2 -2
  175. package/dist/{chunk-qpwb3gnh.js.map → chunk-zvzvgrrn.js.map} +1 -1
  176. package/dist/config/index.js +1 -1
  177. package/dist/console/run.js +2 -2
  178. package/dist/console/run.js.map +1 -1
  179. package/dist/container/index.js +2 -2
  180. package/dist/container/index.js.map +1 -1
  181. package/dist/database/index.js +2 -2
  182. package/dist/database/index.js.map +1 -1
  183. package/dist/email/index.js +2 -2
  184. package/dist/email/index.js.map +1 -1
  185. package/dist/facades/index.js +2 -2
  186. package/dist/facades/index.js.map +1 -1
  187. package/dist/foundation/index.js +2 -2
  188. package/dist/foundation/index.js.map +1 -1
  189. package/dist/http/index.js +2 -2
  190. package/dist/http/index.js.map +1 -1
  191. package/dist/i18n/dictionaryRuntime.js +2 -2
  192. package/dist/i18n/dictionaryRuntime.js.map +1 -1
  193. package/dist/i18n/index.js +2 -2
  194. package/dist/i18n/index.js.map +1 -1
  195. package/dist/kernel/index.js +2 -2
  196. package/dist/kernel/index.js.map +1 -1
  197. package/dist/orm/index.js +2 -2
  198. package/dist/orm/index.js.map +1 -1
  199. package/dist/server/index.js +2 -2
  200. package/dist/server/index.js.map +1 -1
  201. package/dist/services/index.js +2 -2
  202. package/dist/services/index.js.map +1 -1
  203. package/dist/services/mcp/McpRegistry.d.ts.map +1 -1
  204. package/dist/services/queue/work.js +2 -2
  205. package/dist/services/queue/work.js.map +1 -1
  206. package/dist/services/router/serverQueryFetcher.d.ts.map +1 -1
  207. package/dist/stats/route-table.js +1 -1
  208. package/dist/support/index.js +2 -2
  209. package/dist/support/index.js.map +1 -1
  210. package/dist/vitest/index.js +1 -1
  211. package/package.json +1 -1
  212. package/dist/chunk-2cnawkke.js +0 -22
  213. package/dist/chunk-2cnawkke.js.map +0 -21
  214. package/dist/chunk-47e7fbsp.js +0 -5
  215. package/dist/chunk-sxcxmwbt.js +0 -10
  216. /package/dist/{chunk-1awxdnb6.js.map → chunk-c0m8pcbd.js.map} +0 -0
  217. /package/dist/{chunk-gng5e7pd.js.map → chunk-fwmmy0jn.js.map} +0 -0
  218. /package/dist/{chunk-mpqvmge4.js.map → chunk-kzdkpz04.js.map} +0 -0
  219. /package/dist/{chunk-53rr32zm.js.map → chunk-ted0qjps.js.map} +0 -0
  220. /package/dist/{chunk-33hdxe7v.js.map → chunk-vmr4d6hc.js.map} +0 -0
  221. /package/dist/{chunk-hf492gg2.js.map → chunk-zj8y4ak5.js.map} +0 -0
@@ -0,0 +1,226 @@
1
+ import { type AgentMemoryKind, type AgentMemoryListOptions, type AgentMemoryRecord, type AgentMemorySearchOptions, type AgentMemorySource, type AgentMemoryStore, type AgentMemoryUpdate, type AgentMemoryWriteAction, InMemoryAgentMemoryStore } from "./AgentMemoryStore";
2
+ /**
3
+ * A memory about to be written, as `beforeWrite` sees it. Return it (changed
4
+ * or not) to let the write through, or `null` to refuse it.
5
+ */
6
+ export type AgentMemoryDraft = {
7
+ /** The scope key. Changing it is refused: a write stays in the scope it was made for. */
8
+ scope: string;
9
+ kind: AgentMemoryKind;
10
+ content: string;
11
+ key: string | null;
12
+ tags: string[];
13
+ pinned: boolean;
14
+ expiresAt: number | null;
15
+ source: AgentMemorySource;
16
+ };
17
+ /**
18
+ * What `onWrite` hears: a memory added, changed or deleted, or a whole scope
19
+ * erased. A write that changed nothing (`unchanged`) is not reported.
20
+ */
21
+ export type AgentMemoryWriteEvent = {
22
+ action: "added" | "updated";
23
+ memory: AgentMemoryRecord;
24
+ by: AgentMemorySource["by"];
25
+ } | {
26
+ action: "deleted";
27
+ memory: AgentMemoryRecord;
28
+ by: AgentMemorySource["by"];
29
+ /** What the agent gave as its reason, for a `forget`. */
30
+ reason?: string;
31
+ } | {
32
+ action: "scope-deleted";
33
+ scope: string;
34
+ count: number;
35
+ by: AgentMemorySource["by"];
36
+ };
37
+ export type AgentMemoriesHooks = {
38
+ /**
39
+ * Called before every write, the agent's and the app's: return the memory
40
+ * to store (changed or not), or `null` to refuse it. An agent is told its
41
+ * write was refused. Where an app adds its own rules: words it never keeps,
42
+ * a scope that is switched off, a stricter length.
43
+ */
44
+ beforeWrite?: (memory: AgentMemoryDraft, info: {
45
+ existing: AgentMemoryRecord | null;
46
+ }) => AgentMemoryDraft | null | void | Promise<AgentMemoryDraft | null | void>;
47
+ /**
48
+ * Called after every write that changed something, the agent's and the
49
+ * app's. For a live "what we remember" screen, or an audit log: deletes are
50
+ * hard, and this is the only record of them. A hook that throws is logged
51
+ * and does not undo the write.
52
+ */
53
+ onWrite?: (event: AgentMemoryWriteEvent) => void | Promise<void>;
54
+ };
55
+ /** What `AgentMemories.put` takes. */
56
+ export type AgentMemoryInput = {
57
+ kind: AgentMemoryKind;
58
+ content: string;
59
+ key?: string | null;
60
+ tags?: string[];
61
+ pinned?: boolean;
62
+ expiresAt?: number | null;
63
+ /** Default `{ by: "app" }`. A memory the user typed in a settings screen is `{ by: "user" }`. */
64
+ source?: AgentMemorySource;
65
+ };
66
+ /** What `AgentMemories.export` answers: everything a scope holds, for a data-access request. */
67
+ export type AgentMemoryExport = {
68
+ scope: string;
69
+ /** Epoch milliseconds. */
70
+ exportedAt: number;
71
+ memories: AgentMemoryRecord[];
72
+ };
73
+ /** `beforeWrite` said no. An agent's tool is told so; the app's own call throws this. */
74
+ export declare class AgentMemoryRefusedError extends Error {
75
+ constructor(message?: string);
76
+ }
77
+ /** `update` was given a `version` the memory is no longer at: someone else changed it first. */
78
+ export declare class AgentMemoryConflictError extends Error {
79
+ readonly current: AgentMemoryRecord;
80
+ constructor(current: AgentMemoryRecord, expected: number);
81
+ }
82
+ /**
83
+ * Agent memory outside a run (#936): where memories are kept, and the app's
84
+ * API over them.
85
+ *
86
+ * AgentMemories.use(new DatabaseAgentMemoryStore(app(DatabaseManager).connection()), {
87
+ * onWrite: (event) => Broadcast.to(…).emit("memory", event),
88
+ * });
89
+ *
90
+ * await AgentMemories.list(`project:${project.publicId}`);
91
+ * await AgentMemories.deleteScope(`user:${user.publicId}`);
92
+ *
93
+ * Process-wide, like `AgentJobs`, because a settings screen, an account
94
+ * deletion and a queued job have no run to reach it through.
95
+ *
96
+ * NOTHING HERE CHECKS WHO IS ASKING. A scope key is a capability, as a
97
+ * `threadId` is: the app's route decides whether the caller may read or
98
+ * change `project:<id>` before it calls any of these, the same way it does
99
+ * for threads. Inside a run, tools reach memory through `ctx.memory`, which
100
+ * only knows the scopes the server resolved for that run.
101
+ */
102
+ export declare const AgentMemories: {
103
+ /** The store every part of the feature reads and writes. */
104
+ readonly store: AgentMemoryStore;
105
+ /** The hooks given to `use`. */
106
+ readonly hooks: AgentMemoriesHooks;
107
+ /**
108
+ * Sets the store, and the hooks. Call it once, at boot, in every process
109
+ * that runs agents or reads memories. The default is an
110
+ * `InMemoryAgentMemoryStore`, which a restart empties.
111
+ */
112
+ use(store: AgentMemoryStore, hooks?: AgentMemoriesHooks): void;
113
+ /** A scope's memories (or several scopes'), oldest first. Paginate with `after`. */
114
+ list(scope: string | readonly string[], options?: AgentMemoryListOptions): Promise<AgentMemoryRecord[]>;
115
+ get(id: string): Promise<AgentMemoryRecord | null>;
116
+ /** Keyword search, best first, as the `recall` tool does it. */
117
+ search(scope: string | readonly string[], query: string, options?: AgentMemorySearchOptions): Promise<AgentMemoryRecord[]>;
118
+ /**
119
+ * Writes a memory into a scope, as the app (`source.by` defaults to
120
+ * `"app"`): a fact from a form the user filled in, a pin from a settings
121
+ * screen. With a `key` it replaces the memory at that key. Goes through
122
+ * `beforeWrite` and `onWrite`; throws `AgentMemoryRefusedError` when
123
+ * `beforeWrite` refuses it.
124
+ *
125
+ * Not held to the limits an agent's writes are (length, secrets, how many
126
+ * per scope): the app is trusted with its own data. Validate what a user
127
+ * types here as you would any input.
128
+ */
129
+ put(scope: string, input: AgentMemoryInput): Promise<{
130
+ record: AgentMemoryRecord;
131
+ action: AgentMemoryWriteAction;
132
+ }>;
133
+ /**
134
+ * Changes a memory. With `{ version }`, only when it is still at that
135
+ * version, which is what a settings screen editing a memory an agent may
136
+ * be changing at the same time passes: a conflict throws
137
+ * `AgentMemoryConflictError` carrying the current memory. `null` when there
138
+ * is no such memory. Goes through `beforeWrite` and `onWrite`.
139
+ */
140
+ update(id: string, patch: AgentMemoryUpdate, options?: {
141
+ version?: number;
142
+ by?: AgentMemorySource["by"];
143
+ }): Promise<AgentMemoryRecord | null>;
144
+ /**
145
+ * Hard-deletes memories, and answers how many there were. `onWrite` hears
146
+ * each one. There is no soft delete: what the user erases is gone.
147
+ */
148
+ delete(ids: string | readonly string[], options?: {
149
+ by?: AgentMemorySource["by"];
150
+ }): Promise<number>;
151
+ /**
152
+ * Hard-deletes everything a scope holds: an account deletion, an erasure
153
+ * request, "forget everything" in a settings screen.
154
+ */
155
+ deleteScope(scope: string, options?: {
156
+ by?: AgentMemorySource["by"];
157
+ }): Promise<number>;
158
+ /** Everything a scope holds, expired memories included: for a data-access or portability request. */
159
+ export(scope: string): Promise<AgentMemoryExport>;
160
+ /**
161
+ * Swaps in a `FakeAgentMemoryStore` for a test, and answers it: an
162
+ * in-memory store that records what was written, with assertions. Call
163
+ * `restore()` after the test; a second `fake()` before that answers the
164
+ * same fake.
165
+ */
166
+ fake(): FakeAgentMemoryStore;
167
+ };
168
+ /**
169
+ * One write, the agent's or the app's: `beforeWrite`, then the store, then
170
+ * `onWrite`. The run's checks (length, secrets, limits) come before this and
171
+ * only for an agent's writes.
172
+ */
173
+ export declare function writeMemory(draft: AgentMemoryDraft, options?: {
174
+ replaces?: AgentMemoryRecord;
175
+ }): Promise<{
176
+ record: AgentMemoryRecord;
177
+ action: AgentMemoryWriteAction;
178
+ }>;
179
+ /** Deletes by id, reporting each to `onWrite`. */
180
+ export declare function deleteMemories(ids: readonly string[], by: AgentMemorySource["by"], reason?: string): Promise<number>;
181
+ /** One write a fake saw. */
182
+ export type RecordedMemoryWrite = {
183
+ action: AgentMemoryWriteAction;
184
+ record: AgentMemoryRecord;
185
+ } | {
186
+ action: "deleted";
187
+ id: string;
188
+ } | {
189
+ action: "scope-deleted";
190
+ scope: string;
191
+ };
192
+ /**
193
+ * The store `AgentMemories.fake()` installs: an `InMemoryAgentMemoryStore`
194
+ * that also records every write, with assertions for a test. The assertions
195
+ * throw plain `Error`s naming what was written, so they work under any test
196
+ * runner.
197
+ */
198
+ export declare class FakeAgentMemoryStore extends InMemoryAgentMemoryStore {
199
+ private readonly previous;
200
+ private readonly previousHooks;
201
+ /** Every write since the fake was installed, in order. */
202
+ readonly writes: RecordedMemoryWrite[];
203
+ constructor(previous: AgentMemoryStore, previousHooks: AgentMemoriesHooks);
204
+ upsert(memory: Parameters<InMemoryAgentMemoryStore["upsert"]>[0]): Promise<{
205
+ record: AgentMemoryRecord;
206
+ action: AgentMemoryWriteAction;
207
+ }>;
208
+ update(id: string, patch: AgentMemoryUpdate, expectedVersion?: number): Promise<AgentMemoryRecord>;
209
+ delete(ids: readonly string[]): Promise<number>;
210
+ deleteScope(scope: string): Promise<number>;
211
+ /** Puts back the store and hooks that were there before `fake()`. */
212
+ restore(): void;
213
+ /**
214
+ * Fails unless a memory was added or updated in `scope` whose content
215
+ * matches: a string it contains, a regular expression, or a predicate over
216
+ * the whole record.
217
+ */
218
+ assertRemembered(scope: string, match?: string | RegExp | ((record: AgentMemoryRecord) => boolean)): void;
219
+ /** Fails unless the memory with this id was deleted. */
220
+ assertForgotten(id: string): void;
221
+ /** Fails if any memory was added or updated. */
222
+ assertNothingRemembered(): void;
223
+ private saved;
224
+ private summary;
225
+ }
226
+ //# sourceMappingURL=AgentMemories.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AgentMemories.d.ts","sourceRoot":"","sources":["../../../ai/memory/AgentMemories.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,sBAAsB,EAC3B,KAAK,iB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O;CAWhB"}
@@ -0,0 +1,182 @@
1
+ /**
2
+ * What a memory is about (#936). `fact`, `preference`, `episode` and `note`
3
+ * are the ones gemi knows; an app may use strings of its own.
4
+ *
5
+ * - `fact`: something true about the user or their project ("Open Tue–Sun 8–16").
6
+ * - `preference`: how they want things done ("never use stock photos of people").
7
+ * - `episode`: a summary of past work. Written by the extractor (a later phase).
8
+ * - `note`: a working note, usually in a thread scope.
9
+ */
10
+ export type AgentMemoryKind = "fact" | "preference" | "episode" | "note" | (string & {});
11
+ /** Who wrote a memory, and from where. Kept for the UI ("saved from this message") and for audits. */
12
+ export type AgentMemorySource = {
13
+ by: "agent" | "extractor" | "app" | "user";
14
+ /** The agent whose run wrote it. */
15
+ agent?: string;
16
+ runId?: string;
17
+ threadId?: string;
18
+ /** The assistant message holding the tool call that wrote it. */
19
+ messageId?: string;
20
+ };
21
+ /**
22
+ * One memory, as the store keeps it (#936).
23
+ *
24
+ * A short, self-contained note that belongs to exactly one scope. The scope is
25
+ * the app's key (`project:clx…`, `user:42`), decided on the server for each
26
+ * run; the model only ever sees the scope's label (`project`) and never this.
27
+ */
28
+ export type AgentMemoryRecord = {
29
+ /** `mem_…`. */
30
+ id: string;
31
+ /** The app's key, e.g. `project:clx…`. */
32
+ scope: string;
33
+ kind: AgentMemoryKind;
34
+ /** One sentence or a short paragraph. Agents' writes are capped (500 chars by default). */
35
+ content: string;
36
+ /**
37
+ * A stable slot in the scope, e.g. `business.hours`: a write with the same
38
+ * scope and key replaces the memory there rather than adding another one.
39
+ * `null` for a memory without one.
40
+ */
41
+ key: string | null;
42
+ /** The app's routing labels, e.g. `["pictures"]`. Empty when there are none. */
43
+ tags: string[];
44
+ /** Always listed first in the `<memory>` block. */
45
+ pinned: boolean;
46
+ source: AgentMemorySource;
47
+ /** Starts at 1 and goes up on every change. `update` compares against it. */
48
+ version: number;
49
+ /** Epoch milliseconds, on the store's clock. */
50
+ createdAt: number;
51
+ updatedAt: number;
52
+ /** When an agent last read it. Kept up to date in a later phase (#936 P2). */
53
+ lastUsedAt: number | null;
54
+ /** When it stops being listed, and `prune` may delete it. `null` for never. */
55
+ expiresAt: number | null;
56
+ };
57
+ /** What `upsert` is given: the record minus what the store stamps. */
58
+ export type NewAgentMemoryRecord = {
59
+ id: string;
60
+ scope: string;
61
+ kind: AgentMemoryKind;
62
+ content: string;
63
+ key?: string | null;
64
+ tags?: string[];
65
+ pinned?: boolean;
66
+ source: AgentMemorySource;
67
+ expiresAt?: number | null;
68
+ };
69
+ /** The fields `update` may change. The id, the scope and the source never change. */
70
+ export type AgentMemoryUpdate = Partial<Pick<AgentMemoryRecord, "kind" | "content" | "key" | "tags" | "pinned" | "expiresAt">>;
71
+ /** What a write did. `unchanged` when the memory was already there as written. */
72
+ export type AgentMemoryWriteAction = "added" | "updated" | "unchanged";
73
+ export type AgentMemoryListOptions = {
74
+ /** Only these kinds. */
75
+ kinds?: readonly string[];
76
+ /** Only memories carrying at least one of these tags. */
77
+ tags?: readonly string[];
78
+ /** At most this many. */
79
+ limit?: number;
80
+ /**
81
+ * The id of the last memory of the previous page: the list goes on after
82
+ * it. Ignored when that memory is gone or is in none of the scopes.
83
+ */
84
+ after?: string;
85
+ /** List memories past their `expiresAt` too. Default `false`. */
86
+ includeExpired?: boolean;
87
+ };
88
+ export type AgentMemorySearchOptions = {
89
+ kinds?: readonly string[];
90
+ tags?: readonly string[];
91
+ /** Default 8. */
92
+ limit?: number;
93
+ };
94
+ /**
95
+ * Where agent memories live (#936).
96
+ *
97
+ * `InMemoryAgentMemoryStore` is the default and is not durable.
98
+ * `DatabaseAgentMemoryStore` keeps them in a table of the app's database. An
99
+ * app with a table of its own can implement this over it; the conformance
100
+ * tests in `ai/memory/stores.test.ts` say what each method must do.
101
+ *
102
+ * Every method that lists takes scope keys, never labels. Turning a label
103
+ * into a key is the run's job, and nothing the model writes reaches here as
104
+ * a key.
105
+ */
106
+ export interface AgentMemoryStore {
107
+ /**
108
+ * The scopes' memories, oldest first (`createdAt`, then `id`). Expired ones
109
+ * are left out unless `includeExpired`.
110
+ */
111
+ list(scopes: readonly string[], options?: AgentMemoryListOptions): Promise<AgentMemoryRecord[]>;
112
+ get(id: string): Promise<AgentMemoryRecord | null>;
113
+ /**
114
+ * Writes a memory. With a `key`, it replaces the memory already at that
115
+ * scope and key (`updated`, its version bumped and its id kept), or answers
116
+ * `unchanged` when nothing differs. Without one it always adds.
117
+ */
118
+ upsert(memory: NewAgentMemoryRecord): Promise<{
119
+ record: AgentMemoryRecord;
120
+ action: AgentMemoryWriteAction;
121
+ }>;
122
+ /**
123
+ * Changes a memory and bumps its version. With `expectedVersion`, only when
124
+ * the memory is still at that version (compare-and-set). `null` when there
125
+ * is no such memory, or its version differs.
126
+ */
127
+ update(id: string, patch: AgentMemoryUpdate, expectedVersion?: number): Promise<AgentMemoryRecord | null>;
128
+ /** Hard-deletes them, and answers how many were there. */
129
+ delete(ids: readonly string[]): Promise<number>;
130
+ /** Hard-deletes every memory of a scope, and answers how many. */
131
+ deleteScope(scope: string): Promise<number>;
132
+ /**
133
+ * The scopes' memories that match `query` best, best first: keyword search
134
+ * (BM25 over the content, key and tags) in P1. A store may answer with a
135
+ * search of its own (full text, embeddings).
136
+ */
137
+ search(scopes: readonly string[], query: string, options?: AgentMemorySearchOptions): Promise<AgentMemoryRecord[]>;
138
+ /** How many unexpired memories a scope holds. */
139
+ count(scope: string): Promise<number>;
140
+ /** Stamps `lastUsedAt`. Optional; used by a later phase (#936 P2). */
141
+ touch?(ids: readonly string[], at: number): Promise<void>;
142
+ /** Deletes memories whose `expiresAt` is at or before `now`, and answers how many. */
143
+ prune?(now: number): Promise<number>;
144
+ }
145
+ /**
146
+ * A new memory id, ordered by creation within a process: the time in
147
+ * milliseconds (moved on by one when two ids land in the same one), then
148
+ * random characters. Ids are the tie-break when two memories share a
149
+ * `createdAt`, so this keeps "oldest first" in the order they were written.
150
+ */
151
+ export declare function newMemoryId(): string;
152
+ /** Oldest first, with the id as a tie-break so the order is stable. */
153
+ export declare function oldestFirst(a: AgentMemoryRecord, b: AgentMemoryRecord): number;
154
+ /** Whether `record` carries one of `tags`. No filter matches everything. */
155
+ export declare function hasAnyTag(record: AgentMemoryRecord, tags: readonly string[] | undefined): boolean;
156
+ /** Whether two writes would store the same memory. */
157
+ export declare function sameMemory(record: AgentMemoryRecord, memory: NewAgentMemoryRecord): boolean;
158
+ /**
159
+ * Memories in a map, for as long as the process lives.
160
+ *
161
+ * NOT DURABLE, like `MemoryAgentStore`: a restart forgets everything. It is
162
+ * the default so that memory works in development and tests without a table;
163
+ * use `DatabaseAgentMemoryStore` in production. (Named `InMemory…` rather
164
+ * than `Memory…`, which would make it a `MemoryAgentMemoryStore`.)
165
+ */
166
+ export declare class InMemoryAgentMemoryStore implements AgentMemoryStore {
167
+ private memories;
168
+ list(scopes: readonly string[], options?: AgentMemoryListOptions): Promise<AgentMemoryRecord[]>;
169
+ get(id: string): Promise<AgentMemoryRecord | null>;
170
+ upsert(memory: NewAgentMemoryRecord): Promise<{
171
+ record: AgentMemoryRecord;
172
+ action: AgentMemoryWriteAction;
173
+ }>;
174
+ update(id: string, patch: AgentMemoryUpdate, expectedVersion?: number): Promise<AgentMemoryRecord | null>;
175
+ delete(ids: readonly string[]): Promise<number>;
176
+ deleteScope(scope: string): Promise<number>;
177
+ search(scopes: readonly string[], query: string, options?: AgentMemorySearchOptions): Promise<AgentMemoryRecord[]>;
178
+ count(scope: string): Promise<number>;
179
+ touch(ids: readonly string[], at: number): Promise<void>;
180
+ prune(now: number): Promise<number>;
181
+ }
182
+ //# sourceMappingURL=AgentMemoryStore.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AgentMemoryStore.d.ts","sourceRoot":"","sources":["../../../ai/memory/AgentMemoryStore.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,YAAY,GAAG,SAAS,GAAG,MAAM,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC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BAAiB,EAAE,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAQ3F;AAMD;;;;;;;GAOG;AACH,qBAAa,wBAAyB,YAAW,gBAAgB;IAC/D,OAAO,CAAC,QAAQ,CAAwC;IAElD,IAAI,CACR,MAAM,EAAE,SAAS,MAAM,EAAE,EACzB,OAAO,GAAE,sBAA2B,GACnC,OAAO,CAAC,iBAAiB,EAAE,CAAC;IAmBzB,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC;IAKlD,MAAM,CACV,MAAM,EAAE,oBAAoB,GAC3B,OAAO,CAAC;QAAE,MAAM,EAAE,iBAAiB,CAAC;QAAC,MAAM,EAAE,sBAAsB,CAAA;KAAE,CAAC;IA6CnE,MAAM,CACV,EAAE,EAAE,MAAM,EACV,KAAK,EAAE,iBAAiB,EACxB,eAAe,CAAC,EAAE,MAAM,GACvB,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC;IAuB9B,MAAM,CAAC,GAAG,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC;IAM/C,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAQ3C,MAAM,CACV,MAAM,EAAE,SAAS,MAAM,EAAE,EACzB,KAAK,EAAE,MAAM,EACb,OAAO,GAAE,wBAA6B,GACrC,OAAO,CAAC,iBAAiB,EAAE,CAAC;IAKzB,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAIrC,KAAK,CAAC,GAAG,EAAE,SAAS,MAAM,EAAE,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAOxD,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAU1C"}
@@ -0,0 +1,76 @@
1
+ import type { DatabaseConnection } from "../../database/Connection";
2
+ import type { Dialect } from "../../database/dialect";
3
+ import { type AgentMemoryListOptions, type AgentMemoryRecord, type AgentMemorySearchOptions, type AgentMemoryStore, type AgentMemoryUpdate, type AgentMemoryWriteAction, type NewAgentMemoryRecord } from "./AgentMemoryStore";
4
+ export type DatabaseAgentMemoryStoreOptions = {
5
+ /**
6
+ * The table. Default `gemi_agent_memories`. A plain identifier (letters,
7
+ * digits and underscores), because it is spliced into every statement.
8
+ */
9
+ table?: string;
10
+ };
11
+ /**
12
+ * Agent memories (#936) in a table of the app's own database, so they outlive
13
+ * the process and every instance sees the same ones.
14
+ *
15
+ * AgentMemories.use(new DatabaseAgentMemoryStore(app(DatabaseManager).connection()));
16
+ *
17
+ * Written for SQLite, Postgres and MySQL 8 / MariaDB 10.6+ in raw SQL, like
18
+ * `DatabaseAgentJobStore`, and the table is the app's to create: add the
19
+ * Prisma model from docs/ai-memory.md, or call `createTable()`.
20
+ *
21
+ * - **One memory per scope and key**: a unique index on `(scope, key)`. A
22
+ * keyed write reads the slot and updates it by compare-and-set on
23
+ * `version`, or inserts; two writes racing on one key end with one memory.
24
+ * - **Time** is epoch milliseconds read from the database's clock.
25
+ * - **Search** loads the scopes' memories and ranks them in JavaScript
26
+ * (`rankMemories`), the same on every database. A scope is small.
27
+ * - **Deletes are hard.** Nothing is kept of a deleted memory; an app that
28
+ * wants a trail uses `AgentMemories.use(store, { onWrite })`.
29
+ */
30
+ export declare class DatabaseAgentMemoryStore implements AgentMemoryStore {
31
+ readonly table: string;
32
+ private readonly sql;
33
+ private readonly dialect;
34
+ private readonly connection;
35
+ constructor(connection: Pick<DatabaseConnection, "sql" | "dialect"> & Partial<Pick<DatabaseConnection, "name">>, options?: DatabaseAgentMemoryStoreOptions);
36
+ /**
37
+ * Creates the table and its indexes if they do not exist: the DDL Prisma
38
+ * generates for the model in the docs. For tests and for an app that does
39
+ * not manage its schema with Prisma.
40
+ */
41
+ createTable(): Promise<void>;
42
+ list(scopes: readonly string[], options?: AgentMemoryListOptions): Promise<AgentMemoryRecord[]>;
43
+ get(id: string): Promise<AgentMemoryRecord | null>;
44
+ upsert(memory: NewAgentMemoryRecord): Promise<{
45
+ record: AgentMemoryRecord;
46
+ action: AgentMemoryWriteAction;
47
+ }>;
48
+ update(id: string, patch: AgentMemoryUpdate, expectedVersion?: number): Promise<AgentMemoryRecord | null>;
49
+ delete(ids: readonly string[]): Promise<number>;
50
+ deleteScope(scope: string): Promise<number>;
51
+ search(scopes: readonly string[], query: string, options?: AgentMemorySearchOptions): Promise<AgentMemoryRecord[]>;
52
+ count(scope: string): Promise<number>;
53
+ touch(ids: readonly string[], at: number): Promise<void>;
54
+ prune(now: number): Promise<number>;
55
+ /** The store's clock, in epoch milliseconds. */
56
+ now(): Promise<number>;
57
+ private insert;
58
+ private atKey;
59
+ private mustGet;
60
+ /** The open ORM transaction, when it is on this store's connection. */
61
+ private joinable;
62
+ /** Read at each call and never kept: a stored transaction handle outlives its transaction. */
63
+ private q;
64
+ /** `key` is a reserved word in MySQL, so it is always quoted. */
65
+ private column;
66
+ private name;
67
+ /** The database's clock, in epoch milliseconds. As in `DatabaseAgentJobStore`. */
68
+ private clock;
69
+ private ms;
70
+ }
71
+ /**
72
+ * The table as Prisma generates it for the model in the docs, with
73
+ * `IF NOT EXISTS` added.
74
+ */
75
+ export declare function createAgentMemoriesTableStatements(dialect: Dialect, table: string): string[];
76
+ //# sourceMappingURL=DatabaseAgentMemoryStore.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DatabaseAgentMemoryStore.d.ts","sourceRoot":"","sources":["../../../ai/memory/DatabaseAgentMemoryStore.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAEtD,OAAO,EACL,KAAK,sBAAsB,EAC3B,KAAK,iBAAiB,EACtB,KAAK,wBAAwB,EAE7B,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,EA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AAM,CACV,MAAM,EAAE,SAAS,MAAM,EAAE,EACzB,KAAK,EAAE,MAAM,EACb,OAAO,GAAE,wBAA6B,GACrC,OAAO,CAAC,iBAAiB,EAAE,CAAC;IAKzB,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IASrC,KAAK,CAAC,GAAG,EAAE,SAAS,MAAM,EAAE,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IASxD,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAOzC,gDAAgD;IAC1C,GAAG,IAAI,OAAO,CAAC,MAAM,CAAC;YAMd,MAAM;YAmBN,KAAK;YAQL,OAAO;IAMrB,uEAAuE;IACvE,OAAO,CAAC,QAAQ;IAOhB,8FAA8F;IAC9F,OAAO,CAAC,CAAC;IAIT,iEAAiE;IACjE,OAAO,CAAC,MAAM;IAKd,OAAO,CAAC,IAAI;IAKZ,kFAAkF;IAClF,OAAO,CAAC,KAAK;IAYb,OAAO,CAAC,EAAE;CAMX;AA0CD;;;GAGG;AACH,wBAAgB,kCAAkC,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAmD5F"}
@@ -0,0 +1,32 @@
1
+ import type { AgentMemoryRecord } from "./AgentMemoryStore";
2
+ /** The `<memory>` block's budget, in tokens, when neither the agent nor the run says. */
3
+ export declare const DEFAULT_MEMORY_MAX_TOKENS = 1500;
4
+ export type MemoryBlockScope = {
5
+ /** What the model calls it: `project`, `user`. */
6
+ label: string;
7
+ /** Its memories, in any order. */
8
+ memories: readonly AgentMemoryRecord[];
9
+ };
10
+ /**
11
+ * The `<memory>` block (#936): what the model is told about the memories of
12
+ * the run's scopes, at the end of the system prompt.
13
+ *
14
+ * - **Order:** pinned memories first, then the rest, each in the order the
15
+ * scopes are declared and oldest first inside a scope. Nothing in the text
16
+ * depends on the time of the turn, so it is the same from one turn to the
17
+ * next until a memory changes, and the prompt cache holds.
18
+ * - **Budget:** `maxTokens`, at about four characters a token, the header
19
+ * included. What does not fit is counted per scope on a closing line that
20
+ * points at `recall` (when the run has it).
21
+ * - **Data, not instructions:** the header says so, and every memory is put
22
+ * on one line with anything tag-like escaped (`blockText`), so a stored
23
+ * `</memory>` cannot end the block.
24
+ *
25
+ * `null` when there is nothing to list or no budget.
26
+ */
27
+ export declare function renderMemoryBlock(scopes: readonly MemoryBlockScope[], options: {
28
+ maxTokens: number;
29
+ recall: boolean;
30
+ tools: boolean;
31
+ }): string | null;
32
+ //# sourceMappingURL=contextBlock.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contextBlock.d.ts","sourceRoot":"","sources":["../../../ai/memory/contextBlock.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAG5D,yFAAyF;AACzF,eAAO,MAAM,yBAAyB,OAAO,CAAC;AAW9C,MAAM,MAAM,gBAAgB,GAAG;IAC7B,kDAAkD;IAClD,KAAK,EAAE,MAAM,CAAC;IACd,kCAAkC;IAClC,QAAQ,EAAE,SAAS,iBAAiB,EAAE,CAAC;CACxC,CAAC;AAEF;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,SAAS,gBAAgB,EAAE,EACnC,OAAO,EAAE;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAE,GAC9D,MAAM,GAAG,IAAI,CAyDf"}
@@ -0,0 +1,6 @@
1
+ export { AgentMemories, type AgentMemoriesHooks, AgentMemoryConflictError, type AgentMemoryDraft, type AgentMemoryExport, type AgentMemoryInput, AgentMemoryRefusedError, type AgentMemoryWriteEvent, FakeAgentMemoryStore, type RecordedMemoryWrite, } from "./AgentMemories";
2
+ export { type AgentMemoryKind, type AgentMemoryListOptions, type AgentMemoryRecord, type AgentMemorySearchOptions, type AgentMemorySource, type AgentMemoryStore, type AgentMemoryUpdate, type AgentMemoryWriteAction, InMemoryAgentMemoryStore, type NewAgentMemoryRecord, } from "./AgentMemoryStore";
3
+ export { DEFAULT_MEMORY_MAX_TOKENS } from "./contextBlock";
4
+ export { DatabaseAgentMemoryStore, type DatabaseAgentMemoryStoreOptions, } from "./DatabaseAgentMemoryStore";
5
+ export { type AgentMemoryOptions, type AgentMemoryScopeOptions, type AgentMemoryScopes, type AgentMemoryToolOption, type AgentRunMemoryParams, type AppManagedResult, DEFAULT_MEMORY_LIMITS, type ForgetInput, type ForgetResult, MEMORY_NAMESPACE, type MemoryToolShapes, type RecallInput, type RecallResult, type RememberInput, type RememberResult, type ToolMemory, } from "./runMemory";
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../ai/memory/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,KAAK,kBAAkB,EACvB,wBAAwB,EACxB,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,uBAAuB,EACvB,KAAK,qBAAqB,EAC1B,oBAAoB,EACpB,KAAK,mBAAmB,GACzB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,sBAAsB,EAC3B,KAAK,iBAAiB,EACtB,KAAK,wBAAwB,EAC7B,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,EAC3B,wBAAwB,EACxB,KAAK,oBAAoB,GAC1B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,EACL,wBAAwB,EACxB,KAAK,+BAA+B,GACrC,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,uBAAuB,EAC5B,KAAK,iBAAiB,EACtB,KAAK,qBAAqB,EAC1B,KAAK,oBAAoB,EACzB,KAAK,gBAAgB,EACrB,qBAAqB,EACrB,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,gBAAgB,EAChB,KAAK,gBAAgB,EACrB,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,UAAU,GAChB,MAAM,aAAa,CAAC"}