@jini-ai/core 0.7.1 → 0.7.3-next.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 (339) hide show
  1. package/README.md +40 -12
  2. package/dist/admin-runtime/admin-api-error.d.ts +68 -0
  3. package/dist/admin-runtime/admin-api-error.js +72 -0
  4. package/dist/admin-runtime/admin-config-error.d.ts +8 -0
  5. package/dist/admin-runtime/admin-config-error.js +11 -0
  6. package/dist/admin-runtime/controller-store.d.ts +20 -0
  7. package/dist/admin-runtime/controller-store.js +32 -0
  8. package/dist/admin-runtime/index.d.ts +13 -0
  9. package/dist/admin-runtime/index.js +12 -0
  10. package/dist/admin-runtime/panel-access.d.ts +88 -0
  11. package/dist/admin-runtime/panel-access.js +76 -0
  12. package/dist/admin-runtime/query-suffix.d.ts +5 -0
  13. package/dist/admin-runtime/query-suffix.js +5 -0
  14. package/dist/agent-handles/element-handles.d.ts +134 -0
  15. package/dist/agent-handles/element-handles.js +45 -0
  16. package/dist/agent-handles/field-descriptor.d.ts +28 -0
  17. package/dist/agent-handles/field-descriptor.js +3 -0
  18. package/dist/agent-handles/handle.d.ts +109 -0
  19. package/dist/agent-handles/handle.js +109 -0
  20. package/dist/agent-handles/index.d.ts +9 -0
  21. package/dist/agent-handles/index.js +6 -0
  22. package/dist/agent-handles/list-handles.d.ts +46 -0
  23. package/dist/agent-handles/list-handles.js +67 -0
  24. package/dist/agent-handles/secret-attrs.d.ts +14 -0
  25. package/dist/agent-handles/secret-attrs.js +13 -0
  26. package/dist/approval-batch-chain.d.ts +45 -0
  27. package/dist/approval-batch-chain.js +75 -0
  28. package/dist/approval.d.ts +33 -14
  29. package/dist/approval.js +57 -43
  30. package/dist/batch-tool-inputs.js +24 -20
  31. package/dist/contracts/admin-module.d.ts +166 -0
  32. package/dist/contracts/admin-module.js +14 -0
  33. package/dist/contracts/agents/definition.d.ts +459 -0
  34. package/dist/contracts/agents/definition.js +2 -0
  35. package/dist/contracts/agents/index.d.ts +7 -0
  36. package/dist/contracts/agents/index.js +2 -0
  37. package/dist/contracts/agents/launch.d.ts +64 -0
  38. package/dist/contracts/agents/launch.js +2 -0
  39. package/dist/contracts/agents/model-catalog.d.ts +213 -0
  40. package/dist/contracts/agents/model-catalog.js +4 -0
  41. package/dist/contracts/agents/native-tool-policy.d.ts +42 -0
  42. package/dist/contracts/agents/native-tool-policy.js +2 -0
  43. package/dist/contracts/ai-trace/capture.d.ts +17 -0
  44. package/dist/contracts/ai-trace/capture.js +43 -0
  45. package/dist/contracts/ai-trace/classify.d.ts +12 -0
  46. package/dist/contracts/ai-trace/classify.js +16 -0
  47. package/dist/contracts/ai-trace/index.d.ts +13 -0
  48. package/dist/contracts/ai-trace/index.js +6 -0
  49. package/dist/contracts/ai-trace/recorder.d.ts +64 -0
  50. package/dist/contracts/ai-trace/recorder.js +283 -0
  51. package/dist/contracts/ai-trace/sinks.d.ts +51 -0
  52. package/dist/contracts/ai-trace/sinks.js +153 -0
  53. package/dist/contracts/ai-trace/types.d.ts +123 -0
  54. package/dist/contracts/ai-trace/types.js +17 -0
  55. package/dist/contracts/ai-trace/usage.d.ts +16 -0
  56. package/dist/contracts/ai-trace/usage.js +45 -0
  57. package/dist/contracts/blob.d.ts +31 -0
  58. package/dist/contracts/blob.js +10 -0
  59. package/dist/contracts/capabilities.d.ts +95 -0
  60. package/dist/contracts/capabilities.js +111 -0
  61. package/dist/contracts/charts.d.ts +75 -0
  62. package/dist/contracts/charts.js +4 -0
  63. package/dist/contracts/env.d.ts +96 -0
  64. package/dist/contracts/env.js +6 -0
  65. package/dist/contracts/events/change-set.d.ts +106 -0
  66. package/dist/contracts/events/change-set.js +2 -0
  67. package/dist/contracts/events/command.d.ts +118 -0
  68. package/dist/contracts/events/command.js +2 -0
  69. package/dist/contracts/events/ports.d.ts +172 -0
  70. package/dist/contracts/events/ports.js +2 -0
  71. package/dist/contracts/events.d.ts +5 -0
  72. package/dist/contracts/events.js +2 -0
  73. package/dist/contracts/forms.d.ts +110 -0
  74. package/dist/contracts/forms.js +4 -0
  75. package/dist/contracts/hosted-mcp/config.d.ts +19 -0
  76. package/dist/contracts/hosted-mcp/record.d.ts +61 -4
  77. package/dist/contracts/mail/email-sender.d.ts +118 -0
  78. package/dist/contracts/mail/email-sender.js +20 -0
  79. package/dist/contracts/mail/smtp-payload.d.ts +32 -0
  80. package/dist/contracts/mail/smtp-payload.js +2 -0
  81. package/dist/contracts/mail.d.ts +2 -0
  82. package/dist/contracts/mail.js +1 -1
  83. package/dist/contracts/observability.d.ts +232 -0
  84. package/dist/contracts/observability.js +27 -0
  85. package/dist/contracts/plugin-sdk.d.ts +186 -0
  86. package/dist/contracts/plugin-sdk.js +39 -0
  87. package/dist/contracts/runtime/command.d.ts +41 -0
  88. package/dist/contracts/runtime/command.js +60 -0
  89. package/dist/contracts/runtime/environment.d.ts +18 -0
  90. package/dist/contracts/runtime/environment.js +26 -0
  91. package/dist/contracts/runtime/file-lock.d.ts +94 -0
  92. package/dist/contracts/runtime/file-lock.js +25 -0
  93. package/dist/contracts/runtime/fs.d.ts +33 -0
  94. package/dist/contracts/runtime/fs.js +2 -0
  95. package/dist/contracts/runtime/http.d.ts +89 -0
  96. package/dist/contracts/runtime/http.js +2 -0
  97. package/dist/contracts/runtime/platform.d.ts +3 -0
  98. package/dist/contracts/runtime/platform.js +2 -0
  99. package/dist/contracts/runtime/process.d.ts +40 -0
  100. package/dist/contracts/runtime/process.js +31 -0
  101. package/dist/contracts/runtime/reader.d.ts +11 -0
  102. package/dist/contracts/runtime/reader.js +2 -0
  103. package/dist/contracts/runtime/terminal.d.ts +99 -0
  104. package/dist/contracts/runtime/terminal.js +2 -0
  105. package/dist/contracts/runtime/testing.d.ts +84 -0
  106. package/dist/contracts/runtime/testing.js +116 -0
  107. package/dist/contracts/runtime.d.ts +10 -0
  108. package/dist/contracts/runtime.js +10 -0
  109. package/dist/contracts/server/api-error.d.ts +43 -0
  110. package/dist/contracts/server/api-error.js +49 -0
  111. package/dist/contracts/server/auth.d.ts +20 -0
  112. package/dist/contracts/server/auth.js +21 -0
  113. package/dist/contracts/server/conformance.d.ts +25 -0
  114. package/dist/contracts/server/conformance.js +50 -0
  115. package/dist/contracts/server/json-route.d.ts +176 -0
  116. package/dist/contracts/server/json-route.js +155 -0
  117. package/dist/contracts/server/middleware.d.ts +35 -0
  118. package/dist/contracts/server/middleware.js +56 -0
  119. package/dist/contracts/server/origin.d.ts +44 -0
  120. package/dist/contracts/server/origin.js +32 -0
  121. package/dist/contracts/server/query.d.ts +16 -0
  122. package/dist/contracts/server/query.js +69 -0
  123. package/dist/contracts/server/rate-limit.d.ts +20 -0
  124. package/dist/contracts/server/rate-limit.js +8 -0
  125. package/dist/contracts/server/request-body.d.ts +26 -0
  126. package/dist/contracts/server/request-body.js +82 -0
  127. package/dist/contracts/server/result.d.ts +17 -0
  128. package/dist/contracts/server/result.js +5 -0
  129. package/dist/contracts/server/route-table.d.ts +54 -0
  130. package/dist/contracts/server/route-table.js +119 -0
  131. package/dist/contracts/server/same-origin-write.d.ts +18 -0
  132. package/dist/contracts/server/same-origin-write.js +31 -0
  133. package/dist/contracts/server/security-headers.d.ts +30 -0
  134. package/dist/contracts/server/security-headers.js +35 -0
  135. package/dist/contracts/server/sse.d.ts +82 -0
  136. package/dist/contracts/server/sse.js +103 -0
  137. package/dist/contracts/server/testing.d.ts +59 -0
  138. package/dist/contracts/server/testing.js +68 -0
  139. package/dist/contracts/server/verified-origin/configured-origin.d.ts +37 -0
  140. package/dist/contracts/server/verified-origin/configured-origin.js +103 -0
  141. package/dist/contracts/server/verified-origin/index.d.ts +7 -0
  142. package/dist/contracts/server/verified-origin/index.js +6 -0
  143. package/dist/contracts/server/verified-origin/loopback-host.d.ts +9 -0
  144. package/dist/contracts/server/verified-origin/loopback-host.js +17 -0
  145. package/dist/contracts/server/verified-origin/origin.d.ts +64 -0
  146. package/dist/contracts/server/verified-origin/origin.js +162 -0
  147. package/dist/contracts/server/verified-origin/ports.d.ts +38 -0
  148. package/dist/contracts/server/verified-origin/ports.js +2 -0
  149. package/dist/contracts/server/verified-origin/repo.memory.d.ts +32 -0
  150. package/dist/contracts/server/verified-origin/repo.memory.js +34 -0
  151. package/dist/contracts/server/verified-origin/site-path.d.ts +113 -0
  152. package/dist/contracts/server/verified-origin/site-path.js +188 -0
  153. package/dist/contracts/server/verified-origin/types.d.ts +33 -0
  154. package/dist/contracts/server/verified-origin/types.js +30 -0
  155. package/dist/contracts/server.d.ts +46 -2
  156. package/dist/contracts/server.js +17 -3
  157. package/dist/contracts/storage/kernel.d.ts +86 -0
  158. package/dist/contracts/storage/kernel.js +38 -0
  159. package/dist/contracts/storage/migration.d.ts +32 -0
  160. package/dist/contracts/storage/migration.js +2 -0
  161. package/dist/contracts/storage/rows.d.ts +33 -0
  162. package/dist/contracts/storage/rows.js +42 -0
  163. package/dist/contracts/storage/sqlite.d.ts +113 -0
  164. package/dist/contracts/storage/sqlite.js +8 -0
  165. package/dist/contracts/storage/values.d.ts +25 -0
  166. package/dist/contracts/storage/values.js +25 -0
  167. package/dist/contracts/storage.d.ts +8 -0
  168. package/dist/contracts/storage.js +6 -0
  169. package/dist/contracts/vault/invariants.d.ts +26 -0
  170. package/dist/contracts/vault/invariants.js +49 -0
  171. package/dist/contracts/vault.d.ts +1 -0
  172. package/dist/contracts/vault.js +1 -1
  173. package/dist/env/coercers.d.ts +21 -0
  174. package/dist/env/coercers.js +68 -0
  175. package/dist/env/describe-env-for-diagnostics.d.ts +16 -0
  176. package/dist/env/describe-env-for-diagnostics.js +23 -0
  177. package/dist/env/format-env-issue.d.ts +13 -0
  178. package/dist/env/format-env-issue.js +22 -0
  179. package/dist/env/parse-env.d.ts +24 -0
  180. package/dist/env/parse-env.js +102 -0
  181. package/dist/env/value-echo.d.ts +17 -0
  182. package/dist/env/value-echo.js +42 -0
  183. package/dist/errors/approved-cause.d.ts +36 -0
  184. package/dist/errors/approved-cause.js +17 -0
  185. package/dist/errors/bindings.d.ts +61 -0
  186. package/dist/errors/bindings.js +57 -0
  187. package/dist/errors/catalog.d.ts +84 -0
  188. package/dist/errors/catalog.js +151 -0
  189. package/dist/errors/disclosure.d.ts +48 -0
  190. package/dist/errors/disclosure.js +27 -0
  191. package/dist/errors/error-id.d.ts +26 -0
  192. package/dist/errors/error-id.js +23 -0
  193. package/dist/errors/idioms.d.ts +73 -0
  194. package/dist/errors/idioms.js +85 -0
  195. package/dist/errors/incident-text.d.ts +16 -0
  196. package/dist/errors/incident-text.js +77 -0
  197. package/dist/errors/reporter.d.ts +94 -0
  198. package/dist/errors/reporter.js +152 -0
  199. package/dist/errors/sentences.d.ts +68 -0
  200. package/dist/errors/sentences.js +93 -0
  201. package/dist/errors/testing.d.ts +50 -0
  202. package/dist/errors/testing.js +44 -0
  203. package/dist/fetch/cache.d.ts +12 -5
  204. package/dist/fetch/cache.js +46 -47
  205. package/dist/fetch/index.d.ts +1 -1
  206. package/dist/fetch/loader-read.d.ts +6 -2
  207. package/dist/fetch/loader-read.js +4 -4
  208. package/dist/format-error-for-log.d.ts +15 -0
  209. package/dist/format-error-for-log.js +55 -0
  210. package/dist/host-read-vocabulary.d.ts +47 -0
  211. package/dist/host-read-vocabulary.js +44 -0
  212. package/dist/index.d.ts +5 -1
  213. package/dist/index.js +4 -0
  214. package/dist/list-page.d.ts +93 -0
  215. package/dist/list-page.js +154 -0
  216. package/dist/model-facing-tool-errors.d.ts +67 -5
  217. package/dist/model-facing-tool-errors.js +155 -19
  218. package/dist/net/endpoint-policy.d.ts +39 -0
  219. package/dist/net/endpoint-policy.js +218 -0
  220. package/dist/net/fetch-timeouts.d.ts +38 -0
  221. package/dist/net/fetch-timeouts.js +31 -0
  222. package/dist/net/index.d.ts +4 -0
  223. package/dist/net/index.js +4 -0
  224. package/dist/net/loopback.d.ts +13 -0
  225. package/dist/net/loopback.js +39 -0
  226. package/dist/optimistic-concurrency.d.ts +183 -0
  227. package/dist/optimistic-concurrency.js +222 -0
  228. package/dist/primitives/errors.d.ts +9 -0
  229. package/dist/primitives/errors.js +12 -0
  230. package/dist/primitives/ids.d.ts +0 -2
  231. package/dist/primitives/ids.js +1 -4
  232. package/dist/primitives/index.d.ts +3 -0
  233. package/dist/primitives/index.js +2 -0
  234. package/dist/primitives/logger.d.ts +36 -1
  235. package/dist/primitives/logger.js +125 -9
  236. package/dist/primitives/node-shape.d.ts +24 -0
  237. package/dist/primitives/node-shape.js +21 -0
  238. package/dist/primitives/time.d.ts +9 -2
  239. package/dist/primitives/time.js +4 -3
  240. package/dist/provider-registry.js +26 -20
  241. package/dist/records.d.ts +40 -7
  242. package/dist/records.js +37 -3
  243. package/dist/redact.d.ts +1 -84
  244. package/dist/redact.js +2 -826
  245. package/dist/redaction-collectors.d.ts +7 -0
  246. package/dist/redaction-collectors.js +152 -0
  247. package/dist/redaction-exact-secrets.d.ts +14 -0
  248. package/dist/redaction-exact-secrets.js +115 -0
  249. package/dist/redaction-labels.d.ts +14 -0
  250. package/dist/redaction-labels.js +156 -0
  251. package/dist/redaction-patterns.d.ts +54 -0
  252. package/dist/redaction-patterns.js +178 -0
  253. package/dist/redaction-spans.d.ts +31 -0
  254. package/dist/redaction-spans.js +83 -0
  255. package/dist/registration-kit.d.ts +1 -1
  256. package/dist/revision-conflict-error.d.ts +18 -0
  257. package/dist/revision-conflict-error.js +20 -0
  258. package/dist/secret-shapes.d.ts +50 -0
  259. package/dist/secret-shapes.js +105 -0
  260. package/dist/settings/agent-tools.js +22 -8
  261. package/dist/settings/agent-value-write-tools.d.ts +4 -1
  262. package/dist/settings/agent-value-write-tools.js +7 -6
  263. package/dist/settings/agent-writable-preferences.d.ts +3 -1
  264. package/dist/settings/agent-writable-preferences.js +1 -1
  265. package/dist/settings/agent-write-denylist.d.ts +7 -4
  266. package/dist/settings/agent-write-denylist.js +1 -1
  267. package/dist/settings/{express/cms-adapter.d.ts → cms-adapter.d.ts} +3 -2
  268. package/dist/settings/{express/cms-adapter.js → cms-adapter.js} +21 -11
  269. package/dist/settings/definitions-dispatch.js +3 -1
  270. package/dist/settings/ensure-definitions.js +3 -1
  271. package/dist/settings/errors.d.ts +1 -13
  272. package/dist/settings/errors.js +2 -15
  273. package/dist/settings/index.d.ts +11 -2
  274. package/dist/settings/index.js +10 -2
  275. package/dist/settings/purge-service.js +63 -86
  276. package/dist/settings/{express/contracts.d.ts → route-policy.d.ts} +53 -47
  277. package/dist/settings/{express/shared.js → route-policy.js} +1 -16
  278. package/dist/settings/settings.d.ts +19 -11
  279. package/dist/settings/settings.js +9 -11
  280. package/dist/settings/tool-registrations.d.ts +3 -3
  281. package/dist/settings/tool-registrations.js +130 -125
  282. package/dist/settings/types.d.ts +1 -1
  283. package/dist/settings/write-definition-rename.d.ts +37 -0
  284. package/dist/settings/write-definition-rename.js +119 -0
  285. package/dist/settings/write-definition-retype.d.ts +61 -0
  286. package/dist/settings/write-definition-retype.js +109 -0
  287. package/dist/settings/write-definition-status.d.ts +81 -0
  288. package/dist/settings/write-definition-status.js +121 -0
  289. package/dist/settings/write-reset.d.ts +34 -0
  290. package/dist/settings/write-reset.js +73 -0
  291. package/dist/settings/write-service.d.ts +16 -287
  292. package/dist/settings/write-service.js +49 -681
  293. package/dist/settings/write-value-revisions.d.ts +68 -0
  294. package/dist/settings/write-value-revisions.js +124 -0
  295. package/dist/settings/write-values.d.ts +96 -0
  296. package/dist/settings/write-values.js +83 -0
  297. package/dist/surface-exchanges.d.ts +2 -2
  298. package/dist/text/dictionary-translator.d.ts +19 -0
  299. package/dist/text/dictionary-translator.js +14 -0
  300. package/dist/text/format-byte-size.d.ts +25 -0
  301. package/dist/text/format-byte-size.js +25 -0
  302. package/dist/text/format-timestamp.d.ts +22 -0
  303. package/dist/text/format-timestamp.js +57 -0
  304. package/dist/text/index.d.ts +12 -0
  305. package/dist/text/index.js +9 -0
  306. package/dist/text/is-abort-error.d.ts +5 -0
  307. package/dist/text/is-abort-error.js +5 -0
  308. package/dist/text/mime.d.ts +5 -0
  309. package/dist/text/mime.js +21 -0
  310. package/dist/text/redact-urls.d.ts +7 -0
  311. package/dist/text/redact-urls.js +5 -0
  312. package/dist/text/resolve-active-tab-id.d.ts +13 -0
  313. package/dist/text/resolve-active-tab-id.js +15 -0
  314. package/dist/text/sanitize-untrusted-text.d.ts +1 -1
  315. package/dist/text/sanitize-untrusted-text.js +2 -1
  316. package/dist/text/tagged-text-suppression.d.ts +103 -0
  317. package/dist/text/tagged-text-suppression.js +143 -0
  318. package/dist/text/template-i18n.d.ts +37 -0
  319. package/dist/text/template-i18n.js +48 -0
  320. package/dist/tool-call-text.d.ts +59 -0
  321. package/dist/tool-call-text.js +62 -0
  322. package/dist/tool-input-envelope.js +8 -4
  323. package/dist/tool-input-normalization.js +8 -1
  324. package/dist/tool-input-repairs.d.ts +58 -0
  325. package/dist/tool-input-repairs.js +154 -0
  326. package/dist/tool-tokens.js +1 -1
  327. package/dist/user-facing-error.d.ts +1 -1
  328. package/dist/user-facing-error.js +3 -1
  329. package/package.json +234 -13
  330. package/dist/settings/express/contracts.js +0 -2
  331. package/dist/settings/express/http-request.d.ts +0 -33
  332. package/dist/settings/express/http-request.js +0 -50
  333. package/dist/settings/express/http.d.ts +0 -10
  334. package/dist/settings/express/http.js +0 -196
  335. package/dist/settings/express/index.d.ts +0 -5
  336. package/dist/settings/express/index.js +0 -4
  337. package/dist/settings/express/shared.d.ts +0 -68
  338. package/dist/settings/express/stream.d.ts +0 -24
  339. package/dist/settings/express/stream.js +0 -171
@@ -0,0 +1,45 @@
1
+ // Dotted paths reach OpenAI's nested `*_details` objects. Order matters only when a provider
2
+ // reports two spellings of the same counter, which none of the normalizers do today.
3
+ const USAGE_ALIASES = {
4
+ inputTokens: ['input_tokens', 'inputTokens', 'prompt_tokens', 'promptTokenCount'],
5
+ outputTokens: ['output_tokens', 'outputTokens', 'completion_tokens', 'candidatesTokenCount'],
6
+ cacheReadTokens: ['cache_read_input_tokens', 'cached_read_tokens', 'cachedReadTokens', 'cacheReadTokens', 'prompt_tokens_details.cached_tokens', 'cachedContentTokenCount'],
7
+ cacheWriteTokens: ['cache_creation_input_tokens', 'cached_write_tokens', 'cacheWriteTokens'],
8
+ reasoningTokens: ['thought_tokens', 'thoughtTokens', 'reasoningTokens', 'completion_tokens_details.reasoning_tokens', 'thoughtsTokenCount', 'reasoning_tokens'],
9
+ };
10
+ function isRecord(value) {
11
+ return value !== null && typeof value === 'object' && !Array.isArray(value);
12
+ }
13
+ function readPath(source, path) {
14
+ let current = source;
15
+ for (const part of path.split('.'))
16
+ current = isRecord(current) ? current[part] : undefined;
17
+ return current;
18
+ }
19
+ function firstNumber(source, aliases) {
20
+ for (const alias of aliases) {
21
+ const value = readPath(source, alias);
22
+ if (typeof value === 'number' && Number.isFinite(value))
23
+ return value;
24
+ }
25
+ return null;
26
+ }
27
+ /** Returns `null` when the input is not a usage object or carries no recognised counter. */
28
+ export function normalizeAiUsage({ usage }, _options = {}) {
29
+ if (!isRecord(usage))
30
+ return null;
31
+ const out = {};
32
+ let found = false;
33
+ for (const key of Object.keys(USAGE_ALIASES)) {
34
+ out[key] = firstNumber(usage, USAGE_ALIASES[key]);
35
+ found ||= out[key] !== null;
36
+ }
37
+ return found ? out : null;
38
+ }
39
+ /** Adds two nullable counters; `null + null` stays `null` so "never reported" survives totals. */
40
+ export function addNullable({ a, b }, _optional = {}) {
41
+ if (a === null && b === null)
42
+ return null;
43
+ return (a ?? 0) + (b ?? 0);
44
+ }
45
+ //# sourceMappingURL=usage.js.map
@@ -0,0 +1,31 @@
1
+ /** Metadata for a single stored blob. */
2
+ export interface BlobFileMeta {
3
+ /** Path relative to the namespace root. Always uses forward slashes. */
4
+ path: string;
5
+ /** Total size in bytes. */
6
+ size: number;
7
+ /** Unix epoch milliseconds of last modification. */
8
+ mtimeMs: number;
9
+ }
10
+ /** The narrow contract every blob storage backend implements. */
11
+ export interface BlobStorage<Bytes extends Uint8Array = Uint8Array> {
12
+ /** Reads `<namespace>/<relpath>` into bytes. Throws a `StorageError('NOT_FOUND', ...)` when missing. */
13
+ readFile(namespace: string, relpath: string): Promise<Bytes>;
14
+ /** Writes `<namespace>/<relpath>`, creating parent directories/prefixes as needed. */
15
+ writeFile(namespace: string, relpath: string, body: Bytes): Promise<BlobFileMeta>;
16
+ /**
17
+ * Lists every file under `<namespace>/` recursively. The order is implementation-defined;
18
+ * callers that need deterministic order sort by `path`.
19
+ */
20
+ listFiles(namespace: string): Promise<BlobFileMeta[]>;
21
+ /** Deletes a single file under `<namespace>/`. Idempotent — missing files do not throw. */
22
+ deleteFile(namespace: string, relpath: string): Promise<void>;
23
+ /** Reports metadata for a single file without reading its bytes. Returns `null` when missing. */
24
+ statFile(namespace: string, relpath: string): Promise<BlobFileMeta | null>;
25
+ }
26
+ /** Error thrown by {@link BlobStorage} implementations, distinguishing not-found/traversal/IO failures. */
27
+ export declare class StorageError extends Error {
28
+ readonly code: 'NOT_FOUND' | 'TRAVERSAL' | 'IO';
29
+ constructor(code: 'NOT_FOUND' | 'TRAVERSAL' | 'IO', message: string);
30
+ }
31
+ //# sourceMappingURL=blob.d.ts.map
@@ -0,0 +1,10 @@
1
+ /** Error thrown by {@link BlobStorage} implementations, distinguishing not-found/traversal/IO failures. */
2
+ export class StorageError extends Error {
3
+ code;
4
+ constructor(code, message) {
5
+ super(message);
6
+ this.code = code;
7
+ this.name = 'StorageError';
8
+ }
9
+ }
10
+ //# sourceMappingURL=blob.js.map
@@ -0,0 +1,95 @@
1
+ /**
2
+ * @module capability
3
+ *
4
+ * The vocabulary every agent-drivable surface shares: what an outside caller may ask a
5
+ * frontend to do, described as pure data with no transport, DOM, or framework attached.
6
+ *
7
+ * One noun, deliberately: **capability**. The chat pane's first draft used `tool` in its
8
+ * type names and `capability` in its ids, which forked the vocabulary across four files.
9
+ * `tool` stays reserved for the engine's own `ToolRegistry`/`ToolExecutor` nouns; anything
10
+ * an outside caller asks a *frontend* to do is a capability. Transports may of course
11
+ * present capabilities as MCP tools — that is a projection, not a rename.
12
+ */
13
+ /** How much damage a capability can do. `requiresConfirmation` is the enforcement; this is the label. */
14
+ export type CapabilityRisk = 'read' | 'write';
15
+ /**
16
+ * Whether a capability means anything without a live UI session attached.
17
+ *
18
+ * - `session` — needs a connected frontend. "Highlight this field" is meaningless with no
19
+ * tab open, and must fail closed with a distinct error rather than hanging on a timeout.
20
+ * - `server` — a product outcome the backend can satisfy headlessly. Sending a chat message
21
+ * is the same outcome whether a tab is open or not.
22
+ *
23
+ * This decides *availability*, so a caller can be told "no eligible frontend is connected"
24
+ * instead of waiting for a timeout that will never resolve.
25
+ */
26
+ export type CapabilitySurface = 'session' | 'server';
27
+ export interface CapabilityInputProperty {
28
+ readonly type: string;
29
+ readonly description?: string;
30
+ readonly enum?: readonly string[];
31
+ readonly properties?: Record<string, CapabilityInputProperty>;
32
+ readonly required?: readonly string[];
33
+ readonly additionalProperties?: boolean | CapabilityInputProperty;
34
+ }
35
+ export interface CapabilityInputSchema {
36
+ readonly type: 'object';
37
+ readonly properties: Record<string, CapabilityInputProperty>;
38
+ readonly required?: readonly string[];
39
+ readonly additionalProperties?: boolean;
40
+ }
41
+ export interface CapabilityDef {
42
+ readonly id: string;
43
+ readonly description: string;
44
+ readonly inputSchema: CapabilityInputSchema;
45
+ readonly risk: CapabilityRisk;
46
+ readonly surface: CapabilitySurface;
47
+ /**
48
+ * Destructive or otherwise irreversible — the caller must acknowledge before it runs. A host
49
+ * with a real confirmation gate (`@jini-ai/daemon`'s `ToolExecutor` has a resumable one) should
50
+ * enforce it there; surfaces without one enforce it in-band by requiring `confirm: true`, so
51
+ * no transport can execute it by accident.
52
+ */
53
+ readonly requiresConfirmation?: boolean;
54
+ }
55
+ /**
56
+ * Looks a capability up by id.
57
+ *
58
+ * @param capabilities - The manifest to search.
59
+ * @param id - Capability id to resolve.
60
+ * @returns The definition, or `undefined` when the id is not in the manifest.
61
+ */
62
+ export declare function findCapability({ capabilities, id }: {
63
+ capabilities: readonly CapabilityDef[];
64
+ id: string;
65
+ }, _optional?: Record<string, never>): CapabilityDef | undefined;
66
+ /**
67
+ * Checks caller input against a capability's declared schema.
68
+ *
69
+ * Manifests advertise `additionalProperties: false` and a `required` list, but nothing was
70
+ * enforcing either — handlers read the fields they knew about and ignored the rest, so a
71
+ * misnamed argument silently became a missing one. This closes that for any surface that calls
72
+ * it. Intentionally a shallow check, not a JSON Schema engine. Nested schemas describe the public
73
+ * contract; the owning executor enforces their shape before any effect (for example navigation
74
+ * entity/query inputs). This check enforces top-level types, required and unknown arguments.
75
+ *
76
+ * @param capability - The capability being invoked.
77
+ * @param input - Raw caller-supplied arguments.
78
+ * @returns An error message, or `null` when the input is acceptable.
79
+ */
80
+ export declare function findCapabilityInputError({ capability, input }: {
81
+ capability: CapabilityDef;
82
+ input: Record<string, unknown>;
83
+ }, _optional?: Record<string, never>): string | null;
84
+ /**
85
+ * The capabilities a caller may use given what is currently connected.
86
+ *
87
+ * @param capabilities - The full manifest.
88
+ * @param hasSession - Whether a live frontend session is attached.
89
+ * @returns Only the capabilities that can actually be satisfied right now.
90
+ */
91
+ export declare function availableCapabilities({ capabilities, hasSession }: {
92
+ capabilities: readonly CapabilityDef[];
93
+ hasSession: boolean;
94
+ }, _optional?: Record<string, never>): readonly CapabilityDef[];
95
+ //# sourceMappingURL=capabilities.d.ts.map
@@ -0,0 +1,111 @@
1
+ /**
2
+ * @module capability
3
+ *
4
+ * The vocabulary every agent-drivable surface shares: what an outside caller may ask a
5
+ * frontend to do, described as pure data with no transport, DOM, or framework attached.
6
+ *
7
+ * One noun, deliberately: **capability**. The chat pane's first draft used `tool` in its
8
+ * type names and `capability` in its ids, which forked the vocabulary across four files.
9
+ * `tool` stays reserved for the engine's own `ToolRegistry`/`ToolExecutor` nouns; anything
10
+ * an outside caller asks a *frontend* to do is a capability. Transports may of course
11
+ * present capabilities as MCP tools — that is a projection, not a rename.
12
+ */
13
+ /**
14
+ * Looks a capability up by id.
15
+ *
16
+ * @param capabilities - The manifest to search.
17
+ * @param id - Capability id to resolve.
18
+ * @returns The definition, or `undefined` when the id is not in the manifest.
19
+ */
20
+ export function findCapability({ capabilities, id }, _optional = {}) {
21
+ return capabilities.find((capability) => capability.id === id);
22
+ }
23
+ /**
24
+ * Checks caller input against a capability's declared schema.
25
+ *
26
+ * Manifests advertise `additionalProperties: false` and a `required` list, but nothing was
27
+ * enforcing either — handlers read the fields they knew about and ignored the rest, so a
28
+ * misnamed argument silently became a missing one. This closes that for any surface that calls
29
+ * it. Intentionally a shallow check, not a JSON Schema engine. Nested schemas describe the public
30
+ * contract; the owning executor enforces their shape before any effect (for example navigation
31
+ * entity/query inputs). This check enforces top-level types, required and unknown arguments.
32
+ *
33
+ * @param capability - The capability being invoked.
34
+ * @param input - Raw caller-supplied arguments.
35
+ * @returns An error message, or `null` when the input is acceptable.
36
+ */
37
+ export function findCapabilityInputError({ capability, input }, _optional = {}) {
38
+ const { properties, required, additionalProperties } = capability.inputSchema;
39
+ for (const name of required ?? []) {
40
+ if (input[name] === undefined)
41
+ return `"${name}" is required`;
42
+ }
43
+ if (additionalProperties === false) {
44
+ const unknownError = findUnknownArgumentError({ properties, input });
45
+ if (unknownError !== null)
46
+ return unknownError;
47
+ }
48
+ return findPropertyInputError({ properties, input });
49
+ }
50
+ function findUnknownArgumentError({ properties, input }, _optional = {}) {
51
+ // `key in properties` walks the whole prototype chain, so a key that happens to be inherited
52
+ // from Object.prototype (`__proto__`, `constructor`, `toString`, `valueOf`, …) reads as
53
+ // "known" regardless of whether the schema actually lists it — `'constructor' in {}` is
54
+ // true even on an empty object. `JSON.parse('{"__proto__":...}')` creates a real own data
55
+ // property (not the accessor), so this was a live way for such a key to escape the
56
+ // "unknown argument" refusal entirely. hasOwnProperty ignores the prototype chain, so only
57
+ // keys the schema actually declares count as known.
58
+ const unknown = Object.keys(input)
59
+ .filter((key) => !Object.prototype.hasOwnProperty.call(properties, key));
60
+ if (unknown.length > 0) {
61
+ return `unknown ${unknown.length === 1 ? 'argument' : 'arguments'}: ${unknown.sort().join(', ')}`;
62
+ }
63
+ return null;
64
+ }
65
+ /** Checks one shallow schema type without coercion; JSON objects exclude null and JSON numbers must be finite. */
66
+ function matchesPropertyType({ value, actual, expected }, _optional = {}) {
67
+ if (expected === 'integer')
68
+ return Number.isInteger(value);
69
+ if (expected === 'number')
70
+ return Number.isFinite(value);
71
+ return actual === expected;
72
+ }
73
+ function findPropertyInputError({ properties, input }, _optional = {}) {
74
+ for (const [name, schema] of Object.entries(properties)) {
75
+ const value = input[name];
76
+ if (value === undefined)
77
+ continue;
78
+ const error = propertyInputError({ name, schema, value });
79
+ if (error !== null)
80
+ return error;
81
+ }
82
+ return null;
83
+ }
84
+ /** `typeof`, except `null` and arrays get their own names. */
85
+ function valueKind(value) {
86
+ if (value === null)
87
+ return 'null';
88
+ return Array.isArray(value) ? 'array' : typeof value;
89
+ }
90
+ function propertyInputError({ name, schema, value }) {
91
+ const actual = valueKind(value);
92
+ if (!matchesPropertyType({ value, actual, expected: schema.type })) {
93
+ const received = typeof value === 'number' && !Number.isFinite(value) ? String(value) : actual;
94
+ return `"${name}" must be a ${schema.type}, received ${received}`;
95
+ }
96
+ if (schema.enum !== undefined && !schema.enum.includes(value)) {
97
+ return `"${name}" must be one of: ${schema.enum.join(', ')}`;
98
+ }
99
+ return null;
100
+ }
101
+ /**
102
+ * The capabilities a caller may use given what is currently connected.
103
+ *
104
+ * @param capabilities - The full manifest.
105
+ * @param hasSession - Whether a live frontend session is attached.
106
+ * @returns Only the capabilities that can actually be satisfied right now.
107
+ */
108
+ export function availableCapabilities({ capabilities, hasSession }, _optional = {}) {
109
+ return hasSession ? capabilities : capabilities.filter((c) => c.surface === 'server');
110
+ }
111
+ //# sourceMappingURL=capabilities.js.map
@@ -0,0 +1,75 @@
1
+ /** @agent-note Types only. What chart providers implement; generic over the host element type
2
+ * so this entry carries no DOM lib. */
3
+ export type ChartKind = 'bar' | 'line' | 'pie' | (string & {});
4
+ export type ChartValue = string | number | boolean | null | ChartValue[] | {
5
+ [key: string]: ChartValue;
6
+ };
7
+ interface ChartFormat {
8
+ locale?: string | undefined;
9
+ notation?: 'standard' | 'compact' | undefined;
10
+ }
11
+ interface ChartAxis {
12
+ label?: string | undefined;
13
+ format?: ChartFormat | undefined;
14
+ }
15
+ /** Serializable, provider-neutral specification; kind admission belongs to each provider. */
16
+ export interface ChartSpec {
17
+ readonly kind: ChartKind;
18
+ data: Record<string, ChartValue>[];
19
+ categoryKey?: string | undefined;
20
+ series: {
21
+ key: string;
22
+ label?: string | undefined;
23
+ color?: string | undefined;
24
+ }[];
25
+ title?: string | undefined;
26
+ description?: string | undefined;
27
+ axes?: {
28
+ x?: ChartAxis | undefined;
29
+ y?: ChartAxis | undefined;
30
+ } | undefined;
31
+ format?: ChartFormat | undefined;
32
+ provider?: string | undefined;
33
+ }
34
+ /** CSS token names are common across providers; no library props cross this boundary. */
35
+ export interface ChartTheme {
36
+ readonly mode: 'light' | 'dark' | 'auto';
37
+ readonly tokens?: Readonly<Record<string, string>>;
38
+ }
39
+ export interface ChartRenderInput {
40
+ readonly spec: ChartSpec;
41
+ readonly theme: ChartTheme;
42
+ }
43
+ export interface ChartMountOptions {
44
+ /** Reports errors occurring after mount returns (for example a React commit failure). */
45
+ readonly onError?: (error: unknown) => void;
46
+ }
47
+ export interface ChartInstance {
48
+ /** Hosts retain the fallback until an asynchronous first render completes. */
49
+ readonly ready?: Promise<void>;
50
+ update(input: ChartRenderInput, options?: Record<string, never>): void | Promise<void>;
51
+ destroy(input: Record<string, never>, options?: Record<string, never>): void;
52
+ }
53
+ /** Applies the theme's tokens to the element a provider draws into; the host supplies it at mount. */
54
+ export type ChartThemeApplier<E = unknown> = (input: {
55
+ element: E;
56
+ theme: ChartTheme;
57
+ }, options?: Record<string, never>) => void;
58
+ export interface ChartProvider<E = unknown> {
59
+ mount(input: ChartRenderInput & {
60
+ readonly element: E;
61
+ readonly applyTheme: ChartThemeApplier<E>;
62
+ }, options?: ChartMountOptions): ChartInstance;
63
+ }
64
+ export interface ChartProviderEntry<E = unknown> {
65
+ readonly id: string;
66
+ readonly kinds: readonly ChartKind[];
67
+ readonly enabled: boolean;
68
+ /** Optional stricter admission, e.g. rejecting multi-series specs until implemented. */
69
+ readonly supports?: (input: {
70
+ readonly spec: ChartSpec;
71
+ }, options?: Record<string, never>) => boolean;
72
+ load(input: Record<string, never>, options?: Record<string, never>): Promise<ChartProvider<E>>;
73
+ }
74
+ export {};
75
+ //# sourceMappingURL=charts.d.ts.map
@@ -0,0 +1,4 @@
1
+ /** @agent-note Types only. What chart providers implement; generic over the host element type
2
+ * so this entry carries no DOM lib. */
3
+ export {};
4
+ //# sourceMappingURL=charts.js.map
@@ -0,0 +1,96 @@
1
+ /** Environment-variable contract shared by every host: what a variable is, who may show its
2
+ * value, and what a problem with it looks like. Types only; the pure parser lives in `src/env/`.
3
+ * A host owns its schema (the list of specs); no engine package reads the ambient environment.
4
+ */
5
+ export type EnvValueType = 'string' | 'int' | 'flag' | 'enum' | 'url' | 'origin' | 'path' | 'list' | 'json' | 'duration-ms';
6
+ /** The variable's role only. Confidentiality is its own axis (`secret`). */
7
+ export type EnvKind = 'config' | 'launch-binding' | 'dev-flag' | 'test-hook' | 'ambient' | 'vendor' | 'external' | 'build';
8
+ /** What a host hands to anything that needs environment data: a plain map, never the ambient object. */
9
+ export type HostEnvironment = Readonly<Record<string, string | undefined>>;
10
+ export interface EnvVarDoc {
11
+ readonly section: string;
12
+ readonly summary: string;
13
+ readonly fix: string;
14
+ readonly example?: string;
15
+ }
16
+ export interface EnvVarSpec<Field extends string = string> {
17
+ readonly name: string;
18
+ readonly field: Field;
19
+ readonly kind: EnvKind;
20
+ readonly secret: boolean;
21
+ readonly type: EnvValueType;
22
+ /** The words and ranges accepted today. `on`/`off` and `values` are compared with the raw text, exactly. */
23
+ readonly accepts?: {
24
+ readonly on?: readonly string[];
25
+ readonly off?: readonly string[];
26
+ readonly values?: readonly string[];
27
+ readonly min?: number;
28
+ readonly max?: number;
29
+ };
30
+ readonly default?: string;
31
+ readonly readers: readonly string[];
32
+ /** `import` = consumed while a module is being evaluated, before any entry statement runs. */
33
+ readonly phase: 'build' | 'import' | 'boot' | 'live';
34
+ readonly setBy: 'operator' | 'launcher' | 'platform' | 'ci';
35
+ /** `owner` = an existing validator judges the value; the parser hands the raw text on, unjudged. */
36
+ readonly validation: 'schema' | 'owner';
37
+ /** File of the validator that owns the value (required for `owner`). */
38
+ readonly owner?: string;
39
+ /** The variable only matters while another one has one of these values. */
40
+ readonly activeWhen?: {
41
+ readonly name: string;
42
+ readonly in: readonly string[];
43
+ };
44
+ /** A command-line flag that wins over the variable. Documentation only: precedence is the entry point's job. */
45
+ readonly overriddenBy?: string;
46
+ /** Never deleted, renamed, re-defaulted or given a new accepted word by a migration. */
47
+ readonly security?: 'deny-switch' | 'trust-widening';
48
+ /** Only `env` fields exist in the parsed config; the others stay behind their owner's accessor. */
49
+ readonly delivery?: 'env' | 'startup-ipc' | 'consume-at-import';
50
+ /** What a diagnostic may show. Absent means `presence`. */
51
+ readonly display?: 'value' | 'presence';
52
+ readonly deploy?: 'boot-blocking' | 'recommended';
53
+ readonly locksSetting?: string;
54
+ readonly doc: EnvVarDoc;
55
+ }
56
+ /** Names a schema cannot list in advance; each family has exactly one reader. */
57
+ export interface EnvFamily {
58
+ readonly id: string;
59
+ readonly source: 'pattern' | 'declaration' | 'saved-data';
60
+ readonly secret: boolean;
61
+ readonly reader: string;
62
+ readonly doc: EnvVarDoc;
63
+ }
64
+ export interface EnvSchema<Config> {
65
+ readonly specs: readonly EnvVarSpec<Extract<keyof Config, string>>[];
66
+ /** Name prefixes this host owns. A set name with one of them and no spec is reported as unknown. */
67
+ readonly ownedPrefixes: readonly string[];
68
+ }
69
+ /** What a diagnostic may say about a value. It never holds a raw secret or an unlisted value. */
70
+ export type EnvValueEcho = {
71
+ readonly kind: 'unset';
72
+ } | {
73
+ readonly kind: 'hidden';
74
+ readonly length: number;
75
+ } | {
76
+ readonly kind: 'shown';
77
+ readonly text: string;
78
+ };
79
+ export interface EnvIssue {
80
+ readonly name: string;
81
+ readonly problem: 'missing' | 'invalid' | 'unknown-name';
82
+ readonly received: EnvValueEcho;
83
+ readonly expected: string;
84
+ /** The default that is in use because the value was rejected. Absent for a secret or when there is none. */
85
+ readonly usedInstead?: string;
86
+ /** The nearest known name, for an unknown one. */
87
+ readonly suggestion?: string;
88
+ readonly fix: string;
89
+ }
90
+ export interface ParsedEnv<Config> {
91
+ readonly config: Config;
92
+ /** Config field → the variable that set it. Absent when the default is in use. */
93
+ readonly sources: Readonly<Record<string, string>>;
94
+ readonly issues: readonly EnvIssue[];
95
+ }
96
+ //# sourceMappingURL=env.d.ts.map
@@ -0,0 +1,6 @@
1
+ /** Environment-variable contract shared by every host: what a variable is, who may show its
2
+ * value, and what a problem with it looks like. Types only; the pure parser lives in `src/env/`.
3
+ * A host owns its schema (the list of specs); no engine package reads the ambient environment.
4
+ */
5
+ export {};
6
+ //# sourceMappingURL=env.js.map
@@ -0,0 +1,106 @@
1
+ import type { ISODateTime, JsonObject, UUID } from "../../primitives/index.js";
2
+ import type { DomainEvent } from "./ports.js";
3
+ /**
4
+ * @file Change-set vocabulary and persistence contract.
5
+ *
6
+ * Purpose:
7
+ * Defines the durable rows that make every mutation auditable and revertible,
8
+ * for human and AI actors alike.
9
+ *
10
+ * How it relates to the project:
11
+ * - `command.ts` records one change set per executed command.
12
+ * - `revert.ts` walks items in reverse to undo an applied change set.
13
+ * - `repo.memory.ts` provides the in-memory adapter for local dev/tests.
14
+ *
15
+ * Architectural role:
16
+ * This is the storage shape required to land with the first persistent
17
+ * schema. SQLite/Postgres adapters must satisfy `ChangeSetRepoPort` unchanged.
18
+ *
19
+ * `insert()`'s optional event in its second object lets the caller pass the fully-formed outbox event through
20
+ * the SAME call, so a durable adapter can co-persist it inside the same transaction as the header
21
+ * + items. This does NOT bring the domain write (`mutation.execute()`) into the transaction — that
22
+ * remains covered by `executeCommand()`'s existing compensating-rollback path. See
23
+ * `docs/decisions/change-set-outbox-transaction-boundary.md` for the full rationale, including why
24
+ * this shape was chosen over threading a transaction handle through `OutboxPort`/`mutation.execute()`.
25
+ */
26
+ export type ChangeSetStatus = "proposed" | "applied" | "reverted" | "discarded";
27
+ export type ChangeSetOperation = "create" | "update" | "delete" | "activate";
28
+ /** Durable header row for one reviewable, revertible unit of change. */
29
+ export interface ChangeSetRecord {
30
+ id: UUID;
31
+ workspaceId: UUID;
32
+ /** Principal (user or agent) that caused the change. */
33
+ actorId?: UUID | undefined;
34
+ status: ChangeSetStatus;
35
+ /** Human-readable description shown in audit/review UIs. */
36
+ summary: string;
37
+ /** Client-supplied key that makes retried commands safe to reject. */
38
+ idempotencyKey?: string | undefined;
39
+ /** Link back to the chat message / plan step that motivated the change. */
40
+ intentRef?: string | undefined;
41
+ createdAt: ISODateTime;
42
+ appliedAt?: ISODateTime | undefined;
43
+ revertedAt?: ISODateTime | undefined;
44
+ }
45
+ /** One entity mutation inside a change set. */
46
+ export interface ChangeSetItemRecord {
47
+ id: UUID;
48
+ changeSetId: UUID;
49
+ /** Entity type key used to resolve an inverse applier, e.g. `post`. */
50
+ entityType: string;
51
+ entityId: UUID;
52
+ operation: ChangeSetOperation;
53
+ /** Revision pointers for revisioned entity types. */
54
+ beforeRevisionId?: UUID | undefined;
55
+ afterRevisionId?: UUID | undefined;
56
+ /**
57
+ * Inline inverse for non-revisioned entities. An item with neither revision
58
+ * pointers nor an inverse payload cannot be reverted — and such
59
+ * entities must not be mutated by agents.
60
+ */
61
+ inversePayload?: JsonObject | undefined;
62
+ /**
63
+ * Entity version *after* the mutation ( guard input). Revert refuses
64
+ * unless the entity's current version still equals this — otherwise the entity
65
+ * has moved on since. Undefined for entity types without a version.
66
+ * See docs/decisions/DR-006-mutation-audit-atomicity.md.
67
+ */
68
+ entityVersionAtApply?: number | undefined;
69
+ /** Apply order; revert walks positions in reverse. */
70
+ position: number;
71
+ }
72
+ /** Change set header plus its ordered items. */
73
+ export interface ChangeSetWithItems {
74
+ changeSet: ChangeSetRecord;
75
+ items: ChangeSetItemRecord[];
76
+ }
77
+ /** Persistence contract for change sets. */
78
+ export interface ChangeSetRepoPort {
79
+ /**
80
+ * `event`, when present, must be durably recorded atomically with `record`/`items` ( —
81
+ * see this file's header). A SQLite adapter co-persists it inside the same transaction; the
82
+ * in-memory adapter forwards it to its injected event bus/outbox. Omit `event` for a change set
83
+ * that has no associated domain event to deliver.
84
+ * See docs/decisions/DR-006-mutation-audit-atomicity.md.
85
+ */
86
+ insert(required: {
87
+ record: ChangeSetRecord;
88
+ items: ChangeSetItemRecord[];
89
+ }, optional?: {
90
+ event?: DomainEvent | undefined;
91
+ }): Promise<void>;
92
+ findById(required: {
93
+ workspaceId: UUID;
94
+ id: UUID;
95
+ }): Promise<ChangeSetWithItems | null>;
96
+ findByIdempotencyKey(required: {
97
+ workspaceId: UUID;
98
+ idempotencyKey: string;
99
+ }): Promise<ChangeSetRecord | null>;
100
+ listByWorkspace(required: {
101
+ workspaceId: UUID;
102
+ }): Promise<ChangeSetRecord[]>;
103
+ /** Persist status transitions (applied -> reverted, proposed -> discarded, …). */
104
+ save(record: ChangeSetRecord): Promise<void>;
105
+ }
106
+ //# sourceMappingURL=change-set.d.ts.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=change-set.js.map