@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
package/dist/records.d.ts CHANGED
@@ -21,6 +21,38 @@ export declare function isNonArrayRecord(required: {
21
21
  }, _optional?: Record<string, never>): required is {
22
22
  value: Record<string, unknown>;
23
23
  };
24
+ /** A shallow copy of `source` minus `keys`: what `const { a: _a, ...rest } = source` does,
25
+ * without binding a throwaway name for every dropped key. */
26
+ export declare function omitKeys<T extends object, K extends keyof T>({ source, keys }: {
27
+ source: T;
28
+ keys: readonly K[];
29
+ }, _optional?: Record<string, never>): Omit<T, K>;
30
+ /** Parse a plugin contribution file and require `schemaVersion: 1`; callers validate their own list key. */
31
+ export declare function parseSchemaV1Document({ raw }: {
32
+ raw: string;
33
+ }, _optional?: Record<string, never>): {
34
+ ok: true;
35
+ document: Readonly<Record<string, unknown>>;
36
+ } | {
37
+ ok: false;
38
+ reason: string;
39
+ };
40
+ /** Defined-only view of `T`: every key optional, and present only when its value is not `undefined`. */
41
+ export type DefinedFields<T> = {
42
+ [K in keyof T]?: Exclude<T[K], undefined>;
43
+ };
44
+ /**
45
+ * Copies the own enumerable string fields of `source` without their `undefined` values,
46
+ * keeping key order — the
47
+ * `...(x === undefined ? {} : { x })` spread pattern for many fields at once, so an absent
48
+ * optional field is omitted from the result rather than carried as `undefined`.
49
+ * Under `exactOptionalPropertyTypes`, omission is required when an optional field does not
50
+ * accept `undefined`; it also keeps built option objects byte-identical to the
51
+ * pre-injection shape when nothing is overridden.
52
+ */
53
+ export declare function withoutUndefined<T extends object>({ source }: {
54
+ source: T;
55
+ }, _optional?: Record<string, never>): DefinedFields<T>;
24
56
  /** Strict equality over the supplied own, enumerable string fields; omitted fields are unconstrained.
25
57
  * Memory adapters keep their scope and identity fields in this selector, including on deletes.
26
58
  * @complexity O(k) time and space for k selector fields.
@@ -63,19 +95,20 @@ export declare class CanonicalJsonError extends TypeError {
63
95
  export declare function canonicalJson(required: {
64
96
  readonly value: unknown;
65
97
  }, _optional?: Record<string, never>): string;
98
+ /** The slice of WebCrypto the argument digest needs. */
99
+ export type DigestCryptoPort = {
100
+ readonly subtle: Pick<typeof globalThis.crypto.subtle, 'digest'>;
101
+ };
66
102
  /**
67
103
  * SHA-256 lowercase hex over canonical UTF-8 tool arguments, shared by plugins and host gates.
68
104
  * @param required.args JSON arguments; validation completes before hashing starts.
69
- * @param optional.crypto Host WebCrypto port; defaults to the runtime's global WebCrypto.
105
+ * @param required.crypto Host WebCrypto port; the caller supplies it, core never reads a global.
70
106
  * @returns An asynchronous digest, usable in browsers and Node without Node imports.
71
107
  * @throws CanonicalJsonError for invalid arguments; WebCrypto failures propagate.
72
108
  * @complexity Canonical serialization cost plus O(s) hashing time and space for s UTF-8 bytes.
73
109
  */
74
- export declare function canonicalArgumentDigest(required: {
110
+ export declare function canonicalArgumentDigest({ args, crypto }: {
75
111
  readonly args: unknown;
76
- }, { crypto }?: {
77
- readonly crypto?: {
78
- readonly subtle: Pick<typeof globalThis.crypto.subtle, 'digest'>;
79
- };
80
- }): Promise<string>;
112
+ readonly crypto: DigestCryptoPort;
113
+ }, _optional?: Record<string, never>): Promise<string>;
81
114
  //# sourceMappingURL=records.d.ts.map
package/dist/records.js CHANGED
@@ -18,6 +18,40 @@ export function isRecord(required, _optional = {}) {
18
18
  export function isNonArrayRecord(required, _optional = {}) {
19
19
  return isRecord(required) && !Array.isArray(required.value);
20
20
  }
21
+ /** A shallow copy of `source` minus `keys`: what `const { a: _a, ...rest } = source` does,
22
+ * without binding a throwaway name for every dropped key. */
23
+ export function omitKeys({ source, keys }, _optional = {}) {
24
+ const copy = { ...source };
25
+ for (const key of keys)
26
+ delete copy[key];
27
+ return copy;
28
+ }
29
+ /** Parse a plugin contribution file and require `schemaVersion: 1`; callers validate their own list key. */
30
+ export function parseSchemaV1Document({ raw }, _optional = {}) {
31
+ let value;
32
+ try {
33
+ value = JSON.parse(raw);
34
+ }
35
+ catch {
36
+ return { ok: false, reason: "not valid JSON" };
37
+ }
38
+ const holder = { value };
39
+ if (!isNonArrayRecord(holder) || holder.value.schemaVersion !== 1)
40
+ return { ok: false, reason: "schemaVersion must be 1" };
41
+ return { ok: true, document: holder.value };
42
+ }
43
+ /**
44
+ * Copies the own enumerable string fields of `source` without their `undefined` values,
45
+ * keeping key order — the
46
+ * `...(x === undefined ? {} : { x })` spread pattern for many fields at once, so an absent
47
+ * optional field is omitted from the result rather than carried as `undefined`.
48
+ * Under `exactOptionalPropertyTypes`, omission is required when an optional field does not
49
+ * accept `undefined`; it also keeps built option objects byte-identical to the
50
+ * pre-injection shape when nothing is overridden.
51
+ */
52
+ export function withoutUndefined({ source }, _optional = {}) {
53
+ return Object.fromEntries(Object.entries(source).filter(([, value]) => value !== undefined));
54
+ }
21
55
  /** Strict equality over the supplied own, enumerable string fields; omitted fields are unconstrained.
22
56
  * Memory adapters keep their scope and identity fields in this selector, including on deletes.
23
57
  * @complexity O(k) time and space for k selector fields.
@@ -142,13 +176,13 @@ export function canonicalJson(required, _optional = {}) {
142
176
  /**
143
177
  * SHA-256 lowercase hex over canonical UTF-8 tool arguments, shared by plugins and host gates.
144
178
  * @param required.args JSON arguments; validation completes before hashing starts.
145
- * @param optional.crypto Host WebCrypto port; defaults to the runtime's global WebCrypto.
179
+ * @param required.crypto Host WebCrypto port; the caller supplies it, core never reads a global.
146
180
  * @returns An asynchronous digest, usable in browsers and Node without Node imports.
147
181
  * @throws CanonicalJsonError for invalid arguments; WebCrypto failures propagate.
148
182
  * @complexity Canonical serialization cost plus O(s) hashing time and space for s UTF-8 bytes.
149
183
  */
150
- export async function canonicalArgumentDigest(required, { crypto = globalThis.crypto } = {}) {
151
- const json = canonicalJson({ value: required.args });
184
+ export async function canonicalArgumentDigest({ args, crypto }, _optional = {}) {
185
+ const json = canonicalJson({ value: args });
152
186
  const digest = await crypto.subtle.digest('SHA-256', new TextEncoder().encode(json));
153
187
  return Array.from(new Uint8Array(digest), byte => byte.toString(16).padStart(2, '0')).join('');
154
188
  }
package/dist/redact.d.ts CHANGED
@@ -31,77 +31,7 @@
31
31
  * - AWS access key shape: 'AKIA' + 16 uppercase alphanumerics.
32
32
  * - Luhn algorithm (credit cards): https://en.wikipedia.org/wiki/Luhn_algorithm
33
33
  */
34
- /** Credential-shape vocabulary for secret-only redaction; no I/O or host dependencies. */
35
- export interface SecretShapePattern {
36
- readonly name: string;
37
- readonly pattern: RegExp;
38
- }
39
- export declare const PEM_PATTERN_NAME = "PEM private key block";
40
- export declare const SECRET_SHAPE_PATTERNS: readonly SecretShapePattern[];
41
- /**
42
- * Suppress PEM bodies across complete, ordered text lines before other redactors run.
43
- * @param _required No ambient state; create one instance per framed output stream.
44
- * @param _options Reserved optional policy inputs.
45
- * @returns A line redactor and an EOF reset. Call reset after flushing the final line so a
46
- * replacement child cannot inherit an unterminated block. Does not frame raw chunks or do I/O.
47
- * @complexity O(n) per line; O(h) retained state for the open header's key type of length h.
48
- * @example const keys = createPrivateKeyLineRedactor({}, {}); keys.redact({ text: line }, {});
49
- */
50
- export declare function createPrivateKeyLineRedactor(_required: Record<string, never>, _options?: {}): {
51
- redact(required: {
52
- text: string;
53
- }, optional?: Record<string, never>): string;
54
- reset(required: Record<string, never>, optional?: Record<string, never>): void;
55
- };
56
- export declare const AGENT_FAILURE_SECRET_SHAPE_RE: RegExp;
57
- /**
58
- * Exact path SEGMENT names refused at any depth, matched case-insensitively against each segment
59
- * of the caller-supplied path (never a substring — a directory named `not-secrets-actually` is not
60
- * a match). `secrets` is the owner's explicit example: whatever a site or app tree names its
61
- * credentials folder (`sites/**\/secrets/`, `app/**\/secrets/`, or anywhere else), it never
62
- * becomes reachable through this domain. A denied segment is refused by the guarded reader
63
- * AND skipped entirely by the `fs_list_files` walk — its contents are never even enumerated,
64
- * not merely refused once named. Besides `secrets`, the set names the
65
- * well-known credential-store directories a home-directory `custom` root can expose: `.aws`
66
- * (`credentials`), `.docker` (`config.json` with registry auth), `.kube` (`config`), and
67
- * `gcloud`/`gh` for `.config/gcloud/application_default_credentials.json` and
68
- * `.config/gh/hosts.yml`. Denied by SEGMENT rather than by leaf filename on purpose: `config`,
69
- * `config.json`, and `hosts.yml` are generic names that appear harmlessly elsewhere, so denying the
70
- * directory is the narrower of the two mistakes.
71
- *
72
- * A host's install-wide site-key directory (2026-09-24) needs the same protection; the host appends it.
73
- * Production stores it beside individual site folders on a durable volume; local/dev stores
74
- * it below the home directory, reachable through an operator-set `custom` root. Its key backs
75
- * site-key administration, webhook/newsletter signing secrets, and permission checks, so the
76
- * agent must never read it from disk. Denying the whole directory segment, rather than only
77
- * a generated key filename, also prevents `fs_list_files` from enumerating its contents — the
78
- * same "never even advertise it" property `secrets` gets above.
79
- */
80
- export declare const CREDENTIAL_FILE_DENY_SEGMENTS: readonly string[];
81
- export declare const LOCAL_OWNER_PROXY_MARKER_PREFIXES: readonly string[];
82
- export declare const LOCAL_OWNER_PROXY_MARKER_HEADERS: readonly string[];
83
- export interface SecretRedactionPattern {
84
- name: string;
85
- regex: RegExp;
86
- }
87
- /** Every marker redact can generate from its built-in categories; consumers normalize only these. */
88
- export declare const GENERATED_MARKER_RE: RegExp;
89
- /** Optional caller-owned secrets and named lexical rules, without ambient credential lookup. */
90
- export interface SecretRedactionOptions {
91
- /** Diagnostic text can retain addresses/numbers while using the same credential rules. Default true. */
92
- redactPii?: boolean;
93
- /** Exact trusted registration IDs; credential patterns always take precedence. */
94
- diagnosticToolIds?: readonly string[];
95
- /** Conservative by default; aggressive masks opaque runs; exact-only replaces only supplied secrets. */
96
- policy?: 'conservative' | 'aggressive' | 'exact-only';
97
- /** Literal replacement under exact-only. Defaults to '[REDACTED:exact_secret]'; ignored otherwise. */
98
- marker?: string;
99
- exactSecrets?: ReadonlyArray<string | undefined | null>;
100
- extraPatterns?: readonly SecretRedactionPattern[];
101
- }
102
- export declare const LABELED_SECRET_RE: RegExp;
103
- export declare const OPAQUE_TOKEN_RE: RegExp;
104
- export declare const NON_SECRET_TOKEN_RE: RegExp;
34
+ import type { SecretRedactionOptions } from './redaction-patterns.js';
105
35
  /**
106
36
  * Returns `input` with every recognised secret / PII pattern replaced by a
107
37
  * `[REDACTED:<kind>]` marker. Under the default policies, idempotent — re-running on already redacted
@@ -118,19 +48,6 @@ export declare const NON_SECRET_TOKEN_RE: RegExp;
118
48
  export declare function redactSecrets({ input }: {
119
49
  input: string;
120
50
  }, options?: SecretRedactionOptions): string;
121
- /**
122
- * Universal diagnostic text for any thrown value. Keeps native stacks and structured metadata,
123
- * then applies the shared credential policy (PII stays readable unless explicitly requested).
124
- * Diagnostic getters, serialization and coercion can themselves fail; fixed fallback text keeps
125
- * those failures from replacing the original error or interrupting the caller's recovery.
126
- * @param required.error - Untrusted thrown value; never mutated.
127
- * @param options - Shared redaction options, including caller-owned exact secrets.
128
- * @returns Redacted text; never throws, including for circular objects and hostile accessors.
129
- * @complexity O(n) serialization in the diagnostic's fields/characters, plus shared redaction passes.
130
- */
131
- export declare function formatErrorForLog(required: {
132
- error: unknown;
133
- }, options?: SecretRedactionOptions): string;
134
51
  /**
135
52
  * Same as {@link redactSecrets} but also returns per-category counts so the
136
53
  * caller can attach an audit summary to the trace metadata ('we stripped 2