@jini-ai/integrations 0.4.1 → 0.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (146) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/api-connections/access-token.d.ts +9 -0
  3. package/dist/api-connections/access-token.js +92 -0
  4. package/dist/api-connections/account-actions.d.ts +40 -0
  5. package/dist/api-connections/account-actions.js +110 -0
  6. package/dist/api-connections/attempt-state.d.ts +28 -0
  7. package/dist/api-connections/attempt-state.js +73 -0
  8. package/dist/api-connections/authorization.d.ts +45 -0
  9. package/dist/api-connections/authorization.js +120 -0
  10. package/dist/api-connections/deps.d.ts +41 -0
  11. package/dist/api-connections/deps.js +13 -0
  12. package/dist/api-connections/descriptor.d.ts +6 -0
  13. package/dist/api-connections/descriptor.js +111 -0
  14. package/dist/api-connections/errors.d.ts +23 -0
  15. package/dist/api-connections/errors.js +24 -0
  16. package/dist/api-connections/finish-authorization.d.ts +24 -0
  17. package/dist/api-connections/finish-authorization.js +117 -0
  18. package/dist/api-connections/index.d.ts +18 -0
  19. package/dist/api-connections/index.js +10 -0
  20. package/dist/api-connections/install-credential.d.ts +19 -0
  21. package/dist/api-connections/install-credential.js +12 -0
  22. package/dist/api-connections/keys.d.ts +27 -0
  23. package/dist/api-connections/keys.js +22 -0
  24. package/dist/api-connections/ports.d.ts +73 -0
  25. package/dist/api-connections/ports.js +2 -0
  26. package/dist/api-connections/records.d.ts +27 -0
  27. package/dist/api-connections/records.js +52 -0
  28. package/dist/api-connections/request-checks.d.ts +18 -0
  29. package/dist/api-connections/request-checks.js +67 -0
  30. package/dist/api-connections/service.d.ts +25 -0
  31. package/dist/api-connections/service.js +26 -0
  32. package/dist/api-connections/status.d.ts +28 -0
  33. package/dist/api-connections/status.js +36 -0
  34. package/dist/api-connections/token-store/errors.d.ts +20 -0
  35. package/dist/api-connections/token-store/errors.js +38 -0
  36. package/dist/api-connections/token-store/index.d.ts +6 -0
  37. package/dist/api-connections/token-store/index.js +6 -0
  38. package/dist/api-connections/token-store/record.d.ts +69 -0
  39. package/dist/api-connections/token-store/record.js +97 -0
  40. package/dist/api-connections/token-store/vault-token-store.d.ts +26 -0
  41. package/dist/api-connections/token-store/vault-token-store.js +215 -0
  42. package/dist/api-connections/types.d.ts +101 -0
  43. package/dist/api-connections/types.js +9 -0
  44. package/dist/credentialed-http/auth-schemes.js +8 -4
  45. package/dist/credentialed-http/credentialed-request.js +47 -77
  46. package/dist/credentialed-http/response-redaction.d.ts +5 -0
  47. package/dist/credentialed-http/response-redaction.js +62 -0
  48. package/dist/media-providers/catalog.d.ts +3 -1
  49. package/dist/media-providers/catalog.js +3 -1
  50. package/dist/media-providers/dispatch/async-operation-store.d.ts +31 -0
  51. package/dist/media-providers/dispatch/async-operation-store.js +75 -37
  52. package/dist/media-providers/dispatch/builtin-vendors.d.ts +1 -1
  53. package/dist/media-providers/dispatch/context.js +10 -2
  54. package/dist/media-providers/dispatch/credentials.d.ts +1 -1
  55. package/dist/media-providers/dispatch/credentials.js +3 -3
  56. package/dist/media-providers/dispatch/engine.d.ts +6 -3
  57. package/dist/media-providers/dispatch/engine.js +102 -109
  58. package/dist/media-providers/dispatch/index.d.ts +4 -2
  59. package/dist/media-providers/dispatch/index.js +3 -1
  60. package/dist/media-providers/dispatch/media-provider-registry.d.ts +62 -0
  61. package/dist/media-providers/dispatch/media-provider-registry.js +141 -0
  62. package/dist/media-providers/dispatch/node.d.ts +13 -0
  63. package/dist/media-providers/dispatch/node.js +24 -0
  64. package/dist/media-providers/dispatch/openai-compatible.d.ts +1 -1
  65. package/dist/media-providers/dispatch/openai-compatible.js +90 -87
  66. package/dist/media-providers/dispatch/operation-runtime.js +116 -89
  67. package/dist/media-providers/dispatch/outbound.d.ts +8 -4
  68. package/dist/media-providers/dispatch/outbound.js +27 -26
  69. package/dist/media-providers/dispatch/providers/aihubmix.d.ts +1 -1
  70. package/dist/media-providers/dispatch/providers/aihubmix.js +61 -56
  71. package/dist/media-providers/dispatch/providers/custom-image.d.ts +1 -1
  72. package/dist/media-providers/dispatch/providers/elevenlabs.d.ts +1 -1
  73. package/dist/media-providers/dispatch/providers/fishaudio.d.ts +1 -1
  74. package/dist/media-providers/dispatch/providers/grok.d.ts +1 -1
  75. package/dist/media-providers/dispatch/providers/imagerouter-video-async.d.ts +1 -1
  76. package/dist/media-providers/dispatch/providers/imagerouter-video-async.js +53 -49
  77. package/dist/media-providers/dispatch/providers/imagerouter.d.ts +1 -1
  78. package/dist/media-providers/dispatch/providers/imagerouter.js +11 -24
  79. package/dist/media-providers/dispatch/providers/minimax.d.ts +1 -1
  80. package/dist/media-providers/dispatch/providers/nanobanana.d.ts +1 -1
  81. package/dist/media-providers/dispatch/providers/nanobanana.js +22 -30
  82. package/dist/media-providers/dispatch/providers/openai.d.ts +1 -1
  83. package/dist/media-providers/dispatch/providers/openai.js +51 -47
  84. package/dist/media-providers/dispatch/providers/openrouter.d.ts +1 -1
  85. package/dist/media-providers/dispatch/providers/openrouter.js +52 -37
  86. package/dist/media-providers/dispatch/providers/senseaudio.d.ts +1 -1
  87. package/dist/media-providers/dispatch/providers/senseaudio.js +47 -28
  88. package/dist/media-providers/dispatch/providers/volcengine.d.ts +1 -1
  89. package/dist/media-providers/dispatch/response-parsers.js +37 -21
  90. package/dist/media-providers/dispatch/sqlite-async-operation-store.d.ts +35 -1
  91. package/dist/media-providers/dispatch/sqlite-async-operation-store.js +13 -32
  92. package/dist/media-providers/dispatch/ssrf-guard.d.ts +3 -2
  93. package/dist/media-providers/dispatch/ssrf-guard.js +6 -5
  94. package/dist/media-providers/dispatch/types.d.ts +76 -2
  95. package/dist/media-providers/dispatch/vendor-adapter.d.ts +2 -43
  96. package/dist/media-providers/dispatch/vendor-adapter.js +2 -2
  97. package/dist/media-providers/dispatch/vendor-registry-core.d.ts +24 -0
  98. package/dist/media-providers/dispatch/vendor-registry-core.js +34 -0
  99. package/dist/media-providers/dispatch/vendor-registry.d.ts +10 -36
  100. package/dist/media-providers/dispatch/vendor-registry.js +14 -42
  101. package/dist/media-providers/policy.js +25 -17
  102. package/dist/media-providers/providers.d.ts +39 -0
  103. package/dist/media-providers/providers.js +50 -18
  104. package/dist/media-providers/sqlite-driver.adapter.d.ts +4 -0
  105. package/dist/media-providers/sqlite-driver.adapter.js +5 -0
  106. package/dist/media-providers/sqlite-task-store.d.ts +50 -2
  107. package/dist/media-providers/sqlite-task-store.js +20 -84
  108. package/dist/media-providers/staging.js +77 -58
  109. package/dist/media-providers/task-lifecycle.d.ts +33 -0
  110. package/dist/media-providers/task-lifecycle.js +124 -0
  111. package/dist/media-providers/task-store.js +8 -86
  112. package/dist/media-providers/ui-defaults.d.ts +10 -0
  113. package/dist/media-providers/ui-defaults.js +167 -0
  114. package/dist/media-providers/video-request.js +112 -90
  115. package/dist/webhooks/delivery.d.ts +14 -0
  116. package/dist/webhooks/delivery.js +41 -10
  117. package/dist/webhooks/index.d.ts +1 -0
  118. package/dist/webhooks/index.js +1 -0
  119. package/dist/webhooks/ports.d.ts +23 -0
  120. package/dist/webhooks/subscriptions.d.ts +1 -1
  121. package/dist/webhooks/subscriptions.js +5 -1
  122. package/dist/webhooks/worker.d.ts +83 -0
  123. package/dist/webhooks/worker.js +105 -0
  124. package/package.json +35 -7
  125. package/dist/composio/bounded-data.d.ts +0 -36
  126. package/dist/composio/bounded-data.js +0 -181
  127. package/dist/composio/catalog.d.ts +0 -147
  128. package/dist/composio/catalog.js +0 -126
  129. package/dist/composio/composio-config.d.ts +0 -42
  130. package/dist/composio/composio-config.js +0 -145
  131. package/dist/composio/composio-descriptions.d.ts +0 -16
  132. package/dist/composio/composio-descriptions.js +0 -766
  133. package/dist/composio/composio.d.ts +0 -364
  134. package/dist/composio/composio.js +0 -1902
  135. package/dist/composio/errors.d.ts +0 -15
  136. package/dist/composio/errors.js +0 -16
  137. package/dist/composio/file-lock.d.ts +0 -13
  138. package/dist/composio/file-lock.js +0 -92
  139. package/dist/composio/index.d.ts +0 -18
  140. package/dist/composio/index.js +0 -7
  141. package/dist/composio/json-schema.d.ts +0 -93
  142. package/dist/composio/json-schema.js +0 -498
  143. package/dist/composio/output-protection.d.ts +0 -32
  144. package/dist/composio/output-protection.js +0 -105
  145. package/dist/composio/service.d.ts +0 -181
  146. package/dist/composio/service.js +0 -758
@@ -1,39 +1,13 @@
1
- /**
2
- * `VendorAdapterRegistry` — the registration surface a vendor module calls
3
- * at import time instead of `engine.ts`'s `ROUTES` table pointing directly
4
- * at a hand-written render function. A migrated vendor registers its
5
- * `VendorAdapter` here, keyed by `(providerId, routeKey)` — the same
6
- * `routeKey` shape `engine.ts`'s internal `routeKeyFor` already produces
7
- * (`'image'`, `'video'`, `'audio:speech'`, ...). `engine.ts` consults this
8
- * registry first when resolving a renderer, falling back to the static
9
- * `ROUTES` table for vendors not yet migrated onto the generic engine — see
10
- * `archived provenance ledger`'s 2026-07-21 dispatch-engine-generalization section for
11
- * exactly which vendors are registered here today, and why the rest
12
- * legitimately aren't (yet).
13
- */
14
- import type { VendorAdapter } from './vendor-adapter.js';
15
- export declare class VendorAdapterRegistry {
16
- private readonly table;
17
- /** Registers `adapter` for `(providerId, routeKey)`. Throws if that pair is already registered — a vendor module should register each of its (provider, surface) pairs exactly once, at module load. */
18
- register<Meta>({ providerId, routeKey, adapter }: {
19
- providerId: string;
20
- routeKey: string;
21
- adapter: VendorAdapter<Meta>;
22
- }): void;
23
- /** Looks up the adapter registered for `(providerId, routeKey)`, or `undefined` if none is registered. */
24
- get({ providerId, routeKey }: {
25
- providerId: string;
26
- routeKey: string;
27
- }): VendorAdapter<never> | undefined;
28
- /** Whether an adapter is registered for `(providerId, routeKey)`. */
29
- has({ providerId, routeKey }: {
30
- providerId: string;
31
- routeKey: string;
32
- }): boolean;
33
- /** Every `(providerId, routeKey)` pair currently registered — used by tests (and any diagnostics a host wants) to enumerate exactly which vendors run through the generic engine. */
34
- list(): ReadonlyArray<readonly [providerId: string, routeKey: string]>;
35
- }
36
- /** Creates a fresh, empty registry — mainly useful for tests that want isolation from the shared `mediaVendorRegistry` singleton. */
1
+ import { VendorAdapterRegistry } from './vendor-registry-core.js';
2
+ export { VendorAdapterRegistry } from './vendor-registry-core.js';
3
+ /** Creates a fresh, empty registry for host-owned registrations. */
37
4
  export declare function createVendorAdapterRegistry(): VendorAdapterRegistry;
5
+ /** Creates a fresh registry populated by the existing builtin-registration owner.
6
+ * @deprecated Adapters only, no catalogue: plugin vendors cannot validate through it. Build one
7
+ * `createMediaProviderRegistry()` at composition and pass it as `registry` and `catalog`.
8
+ * @returns An independent registry; duplicate route registration still throws.
9
+ */
10
+ export declare function createBuiltinVendorAdapterRegistry(_required?: Record<string, never>, _options?: Record<string, never>): VendorAdapterRegistry;
11
+ /** @deprecated Build one createMediaProviderRegistry() per host composition and inject it instead. */
38
12
  export declare const mediaVendorRegistry: VendorAdapterRegistry;
39
13
  //# sourceMappingURL=vendor-registry.d.ts.map
@@ -1,50 +1,21 @@
1
+ import { VendorAdapterRegistry } from './vendor-registry-core.js';
2
+ export { VendorAdapterRegistry } from './vendor-registry-core.js';
1
3
  import { registerBuiltinVendorAdapters } from './builtin-vendors.js';
2
- export class VendorAdapterRegistry {
3
- table = new Map();
4
- /** Registers `adapter` for `(providerId, routeKey)`. Throws if that pair is already registered — a vendor module should register each of its (provider, surface) pairs exactly once, at module load. */
5
- register({ providerId, routeKey, adapter }) {
6
- let bySurface = this.table.get(providerId);
7
- if (!bySurface) {
8
- bySurface = new Map();
9
- this.table.set(providerId, bySurface);
10
- }
11
- if (bySurface.has(routeKey)) {
12
- throw new Error(`a vendor adapter is already registered for "${providerId}" / "${routeKey}"`);
13
- }
14
- bySurface.set(routeKey, adapter);
15
- }
16
- /** Looks up the adapter registered for `(providerId, routeKey)`, or `undefined` if none is registered. */
17
- get({ providerId, routeKey }) {
18
- return this.table.get(providerId)?.get(routeKey);
19
- }
20
- /** Whether an adapter is registered for `(providerId, routeKey)`. */
21
- has({ providerId, routeKey }) {
22
- return this.table.get(providerId)?.has(routeKey) ?? false;
23
- }
24
- /** Every `(providerId, routeKey)` pair currently registered — used by tests (and any diagnostics a host wants) to enumerate exactly which vendors run through the generic engine. */
25
- list() {
26
- const out = [];
27
- for (const [providerId, bySurface] of this.table) {
28
- for (const routeKey of bySurface.keys()) {
29
- out.push([providerId, routeKey]);
30
- }
31
- }
32
- return out;
33
- }
34
- }
35
- /** Creates a fresh, empty registry — mainly useful for tests that want isolation from the shared `mediaVendorRegistry` singleton. */
4
+ /** Creates a fresh, empty registry for host-owned registrations. */
36
5
  export function createVendorAdapterRegistry() {
37
6
  return new VendorAdapterRegistry();
38
7
  }
39
- /**
40
- * The shared registry every migrated vendor module registers into at import
41
- * time, and `engine.ts` consults for dispatch. A host embedding
42
- * `@jini-ai/integrations/media-providers` that wants a clean, isolated registry (e.g. to register its
43
- * own vendor adapters without touching this module's set) can still call
44
- * `createVendorAdapterRegistry()` directly instead of using this singleton.
8
+ /** Creates a fresh registry populated by the existing builtin-registration owner.
9
+ * @deprecated Adapters only, no catalogue: plugin vendors cannot validate through it. Build one
10
+ * `createMediaProviderRegistry()` at composition and pass it as `registry` and `catalog`.
11
+ * @returns An independent registry; duplicate route registration still throws.
45
12
  */
46
- // Import-time registration used to mutate this shared instance from vendor modules. Lazy
47
- // composition keeps the published singleton's built-in contents while eliminating that effect.
13
+ export function createBuiltinVendorAdapterRegistry(_required = {}, _options = {}) {
14
+ const registry = createVendorAdapterRegistry();
15
+ registerBuiltinVendorAdapters({ registry });
16
+ return registry;
17
+ }
18
+ // Preserve lazy singleton contents for existing callers; engines never consult it.
48
19
  class BuiltinVendorAdapterRegistry extends VendorAdapterRegistry {
49
20
  initialized = false;
50
21
  initialize() {
@@ -71,5 +42,6 @@ class BuiltinVendorAdapterRegistry extends VendorAdapterRegistry {
71
42
  return super.list();
72
43
  }
73
44
  }
45
+ /** @deprecated Build one createMediaProviderRegistry() per host composition and inject it instead. */
74
46
  export const mediaVendorRegistry = new BuiltinVendorAdapterRegistry();
75
47
  //# sourceMappingURL=vendor-registry.js.map
@@ -4,6 +4,30 @@
4
4
  // not passing a policy at all — media generation is a real-money, costly
5
5
  // capability, not something that should be on by default.
6
6
  export const DEFAULT_MEDIA_EXECUTION_POLICY = { mode: 'disabled' };
7
+ /** A missing or empty allowlist means "no restriction on that dimension". */
8
+ function isRestricted(allowlist) {
9
+ return allowlist !== undefined && allowlist.length > 0;
10
+ }
11
+ function surfaceDenial(policy, surface) {
12
+ if (!isRestricted(policy.allowedSurfaces) || policy.allowedSurfaces.includes(surface))
13
+ return null;
14
+ return { code: 'MEDIA_SURFACE_DENIED', message: `media surface "${surface}" is not allowed for this run` };
15
+ }
16
+ function modelDenial(policy, model) {
17
+ // SEC-RB-010: a model allowlist must not be bypassable by omitting the
18
+ // model field. If the host restricted models at all, an unspecified
19
+ // (or blank-after-normalization) model can't be verified against that
20
+ // allowlist and must be denied, not silently waved through.
21
+ const normalizedModel = model?.trim();
22
+ if (!isRestricted(policy.allowedModels))
23
+ return null;
24
+ if (normalizedModel && policy.allowedModels.includes(normalizedModel))
25
+ return null;
26
+ return {
27
+ code: 'MEDIA_MODEL_DENIED',
28
+ message: `media model ${normalizedModel ? `"${normalizedModel}"` : '(none specified)'} is not allowed for this run`,
29
+ };
30
+ }
7
31
  /**
8
32
  * Reference `MediaPolicy`: an enabled/disabled + surface/model allowlist
9
33
  * gate, ported verbatim from the origin's `mediaExecutionPolicyDenial`. A
@@ -18,23 +42,7 @@ export function createAllowlistMediaPolicy(_required, optional = {}) {
18
42
  if (policy.mode === 'disabled') {
19
43
  return { code: 'MEDIA_EXECUTION_DISABLED', message: 'media generation is disabled for this run' };
20
44
  }
21
- if (policy.allowedSurfaces && policy.allowedSurfaces.length > 0 && !policy.allowedSurfaces.includes(target.surface)) {
22
- return { code: 'MEDIA_SURFACE_DENIED', message: `media surface "${target.surface}" is not allowed for this run` };
23
- }
24
- // SEC-RB-010: a model allowlist must not be bypassable by omitting the
25
- // model field. If the host restricted models at all, an unspecified
26
- // (or blank-after-normalization) model can't be verified against that
27
- // allowlist and must be denied, not silently waved through.
28
- const normalizedModel = target.model?.trim();
29
- if (policy.allowedModels && policy.allowedModels.length > 0) {
30
- if (!normalizedModel || !policy.allowedModels.includes(normalizedModel)) {
31
- return {
32
- code: 'MEDIA_MODEL_DENIED',
33
- message: `media model ${normalizedModel ? `"${normalizedModel}"` : '(none specified)'} is not allowed for this run`,
34
- };
35
- }
36
- }
37
- return null;
45
+ return surfaceDenial(policy, target.surface) ?? modelDenial(policy, target.model);
38
46
  },
39
47
  };
40
48
  }
@@ -7,6 +7,45 @@
7
7
  * it ports as data. See `archived provenance ledger` for exactly what was dropped.
8
8
  */
9
9
  import type { AudioKind, MediaModel, MediaProvider, MediaSurface } from './types.js';
10
+ /** One adapter-owned endpoint catalog; protocols and UI presets project this data. */
11
+ export declare const VENDOR_API_BASE_URLS: {
12
+ readonly anthropic: "https://api.anthropic.com";
13
+ readonly openai: "https://api.openai.com/v1";
14
+ readonly azure: "";
15
+ readonly google: "https://generativelanguage.googleapis.com";
16
+ readonly openrouter: "https://openrouter.ai/api/v1";
17
+ readonly ollama: "http://localhost:11434/v1";
18
+ readonly volcengine: "https://ark.cn-beijing.volces.com/api/v3";
19
+ readonly grok: "https://api.x.ai/v1";
20
+ readonly imagerouter: "https://api.imagerouter.io/v1/openai";
21
+ readonly comfyui: "http://127.0.0.1:8188";
22
+ readonly bfl: "https://api.bfl.ai";
23
+ readonly fal: "https://fal.run";
24
+ readonly leonardo: "https://cloud.leonardo.ai/api/rest/v1";
25
+ readonly replicate: "https://api.replicate.com";
26
+ readonly minimax: "https://api.minimaxi.chat/v1";
27
+ readonly elevenlabs: "https://api.elevenlabs.io";
28
+ readonly fishaudio: "https://api.fish.audio";
29
+ readonly senseaudio: "https://api.senseaudio.cn";
30
+ readonly aihubmix: "https://aihubmix.com/v1";
31
+ readonly tavily: "https://api.tavily.com";
32
+ };
33
+ /** Old UI ids remain accepted at boundaries; canonical ids match the existing dispatch catalog. */
34
+ export declare const MEDIA_PROVIDER_ID_ALIASES: Readonly<Record<string, string>>;
35
+ /** Resolve legacy aliases without changing unknown extension IDs. @complexity O(1). */
36
+ export declare function canonicalMediaProviderId({ id }: {
37
+ id: string;
38
+ }, _optional?: Record<string, never>): string;
39
+ /** Canonical entries win conflicts, so an old alias can never replace a newer explicit edit.
40
+ * Returns a copy without changing supplied values or reading credentials. @complexity O(n) entries. */
41
+ export declare function normalizeMediaProviderMap<T>({ providers }: {
42
+ providers: Readonly<Record<string, T>>;
43
+ }, _optional?: Record<string, never>): Record<string, T>;
44
+ /** Host-injected UI policy; reuse the catalog's existing identity and normalization owner. */
45
+ export declare const mediaProviderCatalogPolicy: {
46
+ canonicalMediaProviderId: typeof canonicalMediaProviderId;
47
+ normalizeMediaProviderMap: typeof normalizeMediaProviderMap;
48
+ };
10
49
  export declare const MEDIA_PROVIDERS: readonly MediaProvider[];
11
50
  export declare const IMAGE_MODELS: readonly MediaModel[];
12
51
  export declare const VIDEO_MODELS: readonly MediaModel[];
@@ -1,26 +1,58 @@
1
+ /** One adapter-owned endpoint catalog; protocols and UI presets project this data. */
2
+ export const VENDOR_API_BASE_URLS = {
3
+ anthropic: 'https://api.anthropic.com', openai: 'https://api.openai.com/v1', azure: '',
4
+ google: 'https://generativelanguage.googleapis.com', openrouter: 'https://openrouter.ai/api/v1',
5
+ ollama: 'http://localhost:11434/v1', volcengine: 'https://ark.cn-beijing.volces.com/api/v3',
6
+ grok: 'https://api.x.ai/v1',
7
+ imagerouter: 'https://api.imagerouter.io/v1/openai', comfyui: 'http://127.0.0.1:8188',
8
+ bfl: 'https://api.bfl.ai', fal: 'https://fal.run', leonardo: 'https://cloud.leonardo.ai/api/rest/v1',
9
+ replicate: 'https://api.replicate.com', minimax: 'https://api.minimaxi.chat/v1',
10
+ elevenlabs: 'https://api.elevenlabs.io', fishaudio: 'https://api.fish.audio',
11
+ senseaudio: 'https://api.senseaudio.cn', aihubmix: 'https://aihubmix.com/v1', tavily: 'https://api.tavily.com',
12
+ };
13
+ /** Old UI ids remain accepted at boundaries; canonical ids match the existing dispatch catalog. */
14
+ export const MEDIA_PROVIDER_ID_ALIASES = {
15
+ 'nano-banana': 'nanobanana', 'custom-image-api': 'custom-image', 'fal-ai': 'fal',
16
+ 'leonardo-ai': 'leonardo', 'tavily-search': 'tavily', 'volcengine-ark': 'volcengine', 'xai-grok-imagine': 'grok',
17
+ };
18
+ /** Resolve legacy aliases without changing unknown extension IDs. @complexity O(1). */
19
+ export function canonicalMediaProviderId({ id }, _optional = {}) {
20
+ return Object.prototype.hasOwnProperty.call(MEDIA_PROVIDER_ID_ALIASES, id) ? MEDIA_PROVIDER_ID_ALIASES[id] : id;
21
+ }
22
+ /** Canonical entries win conflicts, so an old alias can never replace a newer explicit edit.
23
+ * Returns a copy without changing supplied values or reading credentials. @complexity O(n) entries. */
24
+ export function normalizeMediaProviderMap({ providers }, _optional = {}) {
25
+ const entries = Object.entries(providers);
26
+ return Object.fromEntries([
27
+ ...entries.filter(([id]) => canonicalMediaProviderId({ id }) !== id).map(([id, value]) => [canonicalMediaProviderId({ id }), value]),
28
+ ...entries.filter(([id]) => canonicalMediaProviderId({ id }) === id),
29
+ ]);
30
+ }
31
+ /** Host-injected UI policy; reuse the catalog's existing identity and normalization owner. */
32
+ export const mediaProviderCatalogPolicy = { canonicalMediaProviderId, normalizeMediaProviderMap };
1
33
  export const MEDIA_PROVIDERS = [
2
- { id: 'openai', label: 'OpenAI', hint: 'gpt-image-2 / dall-e-3', integrated: true, defaultBaseUrl: 'https://api.openai.com/v1' },
3
- { id: 'volcengine', label: 'Volcengine Ark (Doubao)', hint: 'Seedance 2.0 / Seedream', integrated: true, defaultBaseUrl: 'https://ark.cn-beijing.volces.com/api/v3' },
4
- { id: 'grok', label: 'xAI Grok Imagine', hint: 'grok-imagine — image + video with native audio', integrated: true, defaultBaseUrl: 'https://api.x.ai/v1' },
34
+ { id: 'openai', label: 'OpenAI', hint: 'gpt-image-2 / dall-e-3', integrated: true, defaultBaseUrl: VENDOR_API_BASE_URLS.openai },
35
+ { id: 'volcengine', label: 'Volcengine Ark (Doubao)', hint: 'Seedance 2.0 / Seedream', integrated: true, defaultBaseUrl: VENDOR_API_BASE_URLS.volcengine },
36
+ { id: 'grok', label: 'xAI Grok Imagine', hint: 'grok-imagine — image + video with native audio', integrated: true, defaultBaseUrl: VENDOR_API_BASE_URLS.grok },
5
37
  { id: 'hyperframes', label: 'HyperFrames', hint: 'Local HTML -> MP4 renderer', integrated: false, credentialsRequired: false, settingsVisible: false },
6
- { id: 'nanobanana', label: 'Nano Banana', hint: 'Google official by default; custom gateway configurable', integrated: true, defaultBaseUrl: 'https://generativelanguage.googleapis.com', supportsCustomModel: true },
7
- { id: 'imagerouter', label: 'ImageRouter', hint: 'OpenAI-compatible image + video routing', integrated: true, defaultBaseUrl: 'https://api.imagerouter.io/v1/openai', docsUrl: 'https://docs.imagerouter.io/api-reference/image-generation/', supportsCustomModel: true, customModelPlaceholder: 'openai/gpt-image-2 or xAI/grok-imagine-video' },
8
- { id: 'openrouter', label: 'OpenRouter', hint: 'Unified gateway for image + video models', integrated: true, credentialsRequired: true, settingsVisible: true, defaultBaseUrl: 'https://openrouter.ai/api/v1', docsUrl: 'https://openrouter.ai/settings/keys' },
38
+ { id: 'nanobanana', label: 'Nano Banana', hint: 'Google official by default; custom gateway configurable', integrated: true, defaultBaseUrl: VENDOR_API_BASE_URLS.google, supportsCustomModel: true },
39
+ { id: 'imagerouter', label: 'ImageRouter', hint: 'OpenAI-compatible image + video routing', integrated: true, defaultBaseUrl: VENDOR_API_BASE_URLS.imagerouter, docsUrl: 'https://docs.imagerouter.io/api-reference/image-generation/', supportsCustomModel: true, customModelPlaceholder: 'openai/gpt-image-2 or xAI/grok-imagine-video' },
40
+ { id: 'openrouter', label: 'OpenRouter', hint: 'Unified gateway for image + video models', integrated: true, credentialsRequired: true, settingsVisible: true, defaultBaseUrl: VENDOR_API_BASE_URLS.openrouter, docsUrl: 'https://openrouter.ai/settings/keys' },
9
41
  { id: 'custom-image', label: 'Custom Media API', hint: 'OpenAI-compatible images/generations + images/edits (local or cloud)', integrated: true, docsUrl: 'https://platform.openai.com/docs/api-reference/images', supportsCustomModel: true, customModelPlaceholder: 'my-image-model' },
10
- { id: 'comfyui', label: 'ComfyUI', hint: 'Local JSON workflow server (planned adapter)', integrated: false, defaultBaseUrl: 'http://127.0.0.1:8188', docsUrl: 'https://docs.comfy.org/development/core-concepts/workflow' },
11
- { id: 'bfl', label: 'Black Forest Labs', hint: 'FLUX 1.1 Pro / FLUX Pro / Dev', integrated: false, defaultBaseUrl: 'https://api.bfl.ai' },
12
- { id: 'fal', label: 'Fal.ai', hint: 'FLUX / Sora / Veo / Wan / Ideogram / Recraft and any fal-ai/* model', integrated: false, defaultBaseUrl: 'https://fal.run', supportsCustomModel: true },
13
- { id: 'leonardo', label: 'Leonardo.ai', hint: 'Phoenix / Kino XL / FLUX', integrated: false, credentialsRequired: true, settingsVisible: true, defaultBaseUrl: 'https://cloud.leonardo.ai/api/rest/v1' },
14
- { id: 'replicate', label: 'Replicate', hint: 'FLUX / SDXL / Ideogram', integrated: false, defaultBaseUrl: 'https://api.replicate.com' },
42
+ { id: 'comfyui', label: 'ComfyUI', hint: 'Local JSON workflow server (planned adapter)', integrated: false, defaultBaseUrl: VENDOR_API_BASE_URLS.comfyui, docsUrl: 'https://docs.comfy.org/development/core-concepts/workflow' },
43
+ { id: 'bfl', label: 'Black Forest Labs', hint: 'FLUX 1.1 Pro / FLUX Pro / Dev', integrated: false, defaultBaseUrl: VENDOR_API_BASE_URLS.bfl },
44
+ { id: 'fal', label: 'Fal.ai', hint: 'FLUX / Sora / Veo / Wan / Ideogram / Recraft and any fal-ai/* model', integrated: false, defaultBaseUrl: VENDOR_API_BASE_URLS.fal, supportsCustomModel: true },
45
+ { id: 'leonardo', label: 'Leonardo.ai', hint: 'Phoenix / Kino XL / FLUX', integrated: false, credentialsRequired: true, settingsVisible: true, defaultBaseUrl: VENDOR_API_BASE_URLS.leonardo },
46
+ { id: 'replicate', label: 'Replicate', hint: 'FLUX / SDXL / Ideogram', integrated: false, defaultBaseUrl: VENDOR_API_BASE_URLS.replicate },
15
47
  { id: 'google', label: 'Google AI / Vertex', hint: 'Imagen 4 / Veo 3 / Lyria', integrated: false },
16
48
  { id: 'kling', label: 'Kuaishou Kling', hint: 'Kling 1.6 / 2.0 video', integrated: false },
17
49
  { id: 'midjourney', label: 'Midjourney (proxy)', hint: 'midjourney-v7', integrated: false },
18
- { id: 'minimax', label: 'MiniMax', hint: 'TTS / video-01', integrated: true, defaultBaseUrl: 'https://api.minimaxi.chat/v1' },
50
+ { id: 'minimax', label: 'MiniMax', hint: 'TTS / video-01', integrated: true, defaultBaseUrl: VENDOR_API_BASE_URLS.minimax },
19
51
  { id: 'suno', label: 'Suno', hint: 'Music generation', integrated: false },
20
52
  { id: 'udio', label: 'Udio', hint: 'Music generation', integrated: false },
21
- { id: 'elevenlabs', label: 'ElevenLabs', hint: 'Voice / SFX', integrated: true, defaultBaseUrl: 'https://api.elevenlabs.io', docsUrl: 'https://elevenlabs.io/app/settings/api-keys' },
22
- { id: 'fishaudio', label: 'FishAudio', hint: 'Speech / voice clone', integrated: true, defaultBaseUrl: 'https://api.fish.audio' },
23
- { id: 'senseaudio', label: 'SenseAudio', hint: '', integrated: true, defaultBaseUrl: 'https://api.senseaudio.cn', docsUrl: 'https://docs.senseaudio.cn' },
53
+ { id: 'elevenlabs', label: 'ElevenLabs', hint: 'Voice / SFX', integrated: true, defaultBaseUrl: VENDOR_API_BASE_URLS.elevenlabs, docsUrl: 'https://elevenlabs.io/app/settings/api-keys' },
54
+ { id: 'fishaudio', label: 'FishAudio', hint: 'Speech / voice clone', integrated: true, defaultBaseUrl: VENDOR_API_BASE_URLS.fishaudio },
55
+ { id: 'senseaudio', label: 'SenseAudio', hint: '', integrated: true, defaultBaseUrl: VENDOR_API_BASE_URLS.senseaudio, docsUrl: 'https://docs.senseaudio.cn' },
24
56
  {
25
57
  id: 'aihubmix',
26
58
  label: 'AIHubMix',
@@ -28,12 +60,12 @@ export const MEDIA_PROVIDERS = [
28
60
  integrated: true,
29
61
  credentialsRequired: true,
30
62
  settingsVisible: true,
31
- defaultBaseUrl: 'https://aihubmix.com/v1',
63
+ defaultBaseUrl: VENDOR_API_BASE_URLS.aihubmix,
32
64
  docsUrl: 'https://docs.aihubmix.com',
33
65
  supportsCustomModel: true,
34
66
  customModelPlaceholder: 'gpt-image-2 or dall-e-3',
35
67
  },
36
- { id: 'tavily', label: 'Tavily Search', hint: 'Agent-callable web research', integrated: true, defaultBaseUrl: 'https://api.tavily.com' },
68
+ { id: 'tavily', label: 'Tavily Search', hint: 'Agent-callable web research', integrated: true, defaultBaseUrl: VENDOR_API_BASE_URLS.tavily },
37
69
  { id: 'stub', label: 'Stub (placeholder)', hint: 'Deterministic local placeholder bytes', integrated: true },
38
70
  ];
39
71
  export const IMAGE_MODELS = [
@@ -152,7 +184,7 @@ export function findMediaModel({ id }) {
152
184
  }
153
185
  /** Finds a provider by id in `MEDIA_PROVIDERS`. */
154
186
  export function findProvider({ id }) {
155
- return MEDIA_PROVIDERS.find((p) => p.id === id) ?? null;
187
+ return MEDIA_PROVIDERS.find((p) => p.id === canonicalMediaProviderId({ id })) ?? null;
156
188
  }
157
189
  /** Returns the model list for a surface; `audioKind` selects which audio sub-list (defaults to `'music'`). */
158
190
  export function modelsForSurface({ surface }, { audioKind } = {}) {
@@ -0,0 +1,4 @@
1
+ /** Native compatibility adapter, loaded only when a host did not inject its own SQLite opener. */
2
+ import type { SqliteSyncOpener } from '@jini-ai/db/sqlite';
3
+ export declare function loadMediaSqliteOpener(_required: Record<string, never>, _optional?: Record<string, never>): Promise<SqliteSyncOpener>;
4
+ //# sourceMappingURL=sqlite-driver.adapter.d.ts.map
@@ -0,0 +1,5 @@
1
+ export async function loadMediaSqliteOpener(_required, _optional = {}) {
2
+ const { default: Database } = await import('better-sqlite3');
3
+ return (file, options) => new Database(file, options);
4
+ }
5
+ //# sourceMappingURL=sqlite-driver.adapter.js.map
@@ -1,3 +1,45 @@
1
+ /**
2
+ * `createSqliteMediaTaskStore` — the durable `MediaTaskStore` adapter
3
+ * (added 2026-07-21, per the task brief's "durable task adapter" ask: many
4
+ * ported vendors are async submit-then-poll jobs, so a job's state must
5
+ * survive a process restart).
6
+ *
7
+ * Reuses this repo's existing durability pattern exactly —
8
+ * `packages/sqlite/src/event-log.ts`'s `createSqliteEventLog`, the durable
9
+ * adapter for `@jini-ai/daemon`'s `EventLog` port — rather than inventing a
10
+ * parallel one: `new Database(dbPath)`, `db.pragma('journal_mode = WAL')`,
11
+ * `CREATE TABLE IF NOT EXISTS` (idempotent — reopening the same file
12
+ * resumes from whatever was durably committed), `db.transaction()` for
13
+ * atomic multi-statement writes, every public method still `Promise`-
14
+ * returning despite `better-sqlite3` being fully synchronous under the
15
+ * hood (extraction-plan.md §2.6: "ports are async-only from day one... a
16
+ * real persistent adapter is a drop-in swap"), and a `close(): Promise<void>`
17
+ * addition beyond the port interface to release the file handle — the same
18
+ * shape `SqliteEventLog extends EventLog` already established.
19
+ *
20
+ * **Why this lives in `@jini-ai/media` itself, not `@jini-ai/sqlite-chat`** (the
21
+ * "natural" home per the `EventLog` precedent, where the durable adapter
22
+ * lives in a separate package from the port it implements): `@jini-ai/sqlite-chat`
23
+ * is one of `scripts/check-engine-boundaries.ts`'s 14 *locked* packages;
24
+ * `@jini-ai/media` is listed in `UNLOCKED.md` with `status: "incubating"`.
25
+ * `check-engine-boundaries.ts`'s R7 rule forbids a locked package from
26
+ * importing an unlocked, non-`"stable"` one — `@jini-ai/sqlite-chat` depending on
27
+ * `@jini-ai/media` for `MediaTaskStore`'s types would fail `pnpm guard`
28
+ * outright. Implementing the adapter inside `@jini-ai/media` (itself
29
+ * unlocked, so unrestricted in what it may depend on) keeps the exact same
30
+ * schema/transaction/WAL/`close()` conventions without a guard violation.
31
+ * See `ADS-memory/reports/proposals/PROP-media-durable-tasks-2026-07-21.md`
32
+ * for the open question of whether this should move to `@jini-ai/sqlite-chat` once
33
+ * `@jini-ai/media` is promoted to `"stable"`.
34
+ *
35
+ * Implements `task-store.ts`'s `MediaTaskStore` port exactly: same
36
+ * `queued -> running -> done|failed|interrupted` transition legality
37
+ * (`ALLOWED_TRANSITIONS`), same duplicate-id rejection, same
38
+ * `listByOwner` terminal-status filtering, same `reconcileOnBoot`
39
+ * two-phase boot reconciliation. See `createInMemoryMediaTaskStore` in
40
+ * `task-store.ts` for the reference behavior this mirrors.
41
+ */
42
+ import type { SqliteSyncOpener } from '@jini-ai/db/sqlite';
1
43
  import type { MediaTaskStore } from './task-store.js';
2
44
  /** A `MediaTaskStore` backed by a `better-sqlite3` database, plus a `close()` to release the file handle. */
3
45
  export interface SqliteMediaTaskStore extends MediaTaskStore {
@@ -15,7 +57,8 @@ export interface SqliteMediaTaskStore extends MediaTaskStore {
15
57
  * `reconcileOnBoot` can then mark anything still `queued`/`running` as
16
58
  * `interrupted`.
17
59
  *
18
- * `better-sqlite3` (a native compiled addon) is dynamically imported here
60
+ * `better-sqlite3` (a native compiled addon) is dynamically imported by the default
61
+ * adapter only when no host opener is supplied
19
62
  * rather than statically at module scope (mirroring `@jini-ai/daemon`'s
20
63
  * `loadRealSpawnPty`/`node-pty` pattern) — this package's root barrel
21
64
  * re-exports this module unconditionally, so a static top-level import would
@@ -25,5 +68,10 @@ export interface SqliteMediaTaskStore extends MediaTaskStore {
25
68
  * fails cleanly (a rejected promise) rather than crashing unrelated imports
26
69
  * if the platform/environment lacks a usable prebuild.
27
70
  */
28
- export declare function createSqliteMediaTaskStore(dbPath: string): Promise<SqliteMediaTaskStore>;
71
+ export declare function createSqliteMediaTaskStore(required: {
72
+ dbPath: string;
73
+ open?: SqliteSyncOpener;
74
+ } | string, options?: {
75
+ open?: SqliteSyncOpener;
76
+ }): Promise<SqliteMediaTaskStore>;
29
77
  //# sourceMappingURL=sqlite-task-store.d.ts.map
@@ -1,29 +1,9 @@
1
- const VALID_STATUSES = new Set([
2
- 'queued',
3
- 'running',
4
- 'done',
5
- 'failed',
6
- 'interrupted',
7
- ]);
8
- const TERMINAL_STATUSES = new Set(['done', 'failed', 'interrupted']);
9
- // Mirrors task-store.ts's own ALLOWED_TRANSITIONS exactly (CR-013: enum
10
- // membership alone doesn't prove a transition is legal, e.g. done -> running).
11
- const ALLOWED_TRANSITIONS = {
12
- queued: new Set(['queued', 'running', 'done', 'failed', 'interrupted']),
13
- running: new Set(['running', 'done', 'failed', 'interrupted']),
14
- done: new Set(['done']),
15
- failed: new Set(['failed']),
16
- interrupted: new Set(['interrupted']),
17
- };
18
- const INTERRUPTED_ERROR = {
19
- message: 'media task interrupted by daemon restart',
20
- code: 'DAEMON_RESTART',
21
- };
22
- function assertValidStatus(status) {
23
- if (!VALID_STATUSES.has(status)) {
24
- throw new RangeError(`Invalid media task status: "${status}"`);
25
- }
26
- }
1
+ import { loadMediaSqliteOpener } from './sqlite-driver.adapter.js';
2
+ // Shared with task-store.ts's in-memory adapter (task-lifecycle.ts), so the
3
+ // two cannot drift: CR-013's transition graph (enum membership alone doesn't
4
+ // prove a transition is legal, e.g. done -> running), duplicate-free status
5
+ // sets, and the create/patch/reconcile row arithmetic all live there once.
6
+ import { applyTaskPatch, assertValidTerminalTtl, buildNewTask, reconcileAction } from './task-lifecycle.js';
27
7
  /**
28
8
  * Reconstructs a `MediaTask` from a stored row. `surface`/`model` are
29
9
  * conditionally spread — matching `task-store.ts`'s own in-memory adapter,
@@ -60,7 +40,8 @@ function rowToTask(row) {
60
40
  * `reconcileOnBoot` can then mark anything still `queued`/`running` as
61
41
  * `interrupted`.
62
42
  *
63
- * `better-sqlite3` (a native compiled addon) is dynamically imported here
43
+ * `better-sqlite3` (a native compiled addon) is dynamically imported by the default
44
+ * adapter only when no host opener is supplied
64
45
  * rather than statically at module scope (mirroring `@jini-ai/daemon`'s
65
46
  * `loadRealSpawnPty`/`node-pty` pattern) — this package's root barrel
66
47
  * re-exports this module unconditionally, so a static top-level import would
@@ -70,9 +51,11 @@ function rowToTask(row) {
70
51
  * fails cleanly (a rejected promise) rather than crashing unrelated imports
71
52
  * if the platform/environment lacks a usable prebuild.
72
53
  */
73
- export async function createSqliteMediaTaskStore(dbPath) {
74
- const { default: Database } = await import('better-sqlite3');
75
- const db = new Database(dbPath);
54
+ export async function createSqliteMediaTaskStore(required, options = {}) {
55
+ // The string overload remains for published callers; new hosts supply an argument object.
56
+ const dbPath = typeof required === 'string' ? required : required.dbPath;
57
+ const open = (typeof required === 'string' ? undefined : required.open) ?? options.open ?? await loadMediaSqliteOpener({});
58
+ const db = open(dbPath, {});
76
59
  db.pragma('journal_mode = WAL');
77
60
  db.exec(`
78
61
  CREATE TABLE IF NOT EXISTS jini_media_tasks (
@@ -125,24 +108,7 @@ export async function createSqliteMediaTaskStore(dbPath) {
125
108
  if (getStmt.get(input.id)) {
126
109
  throw new Error(`media task "${input.id}" already exists`);
127
110
  }
128
- const status = input.status ?? 'queued';
129
- assertValidStatus(status);
130
- const now = Date.now();
131
- const startedAt = input.startedAt ?? now;
132
- const task = {
133
- id: input.id,
134
- ownerRef: input.ownerRef,
135
- status,
136
- progress: input.progress ? [...input.progress] : [],
137
- file: input.file == null ? null : structuredClone(input.file),
138
- error: input.error == null ? null : { ...input.error },
139
- startedAt,
140
- endedAt: null,
141
- createdAt: now,
142
- updatedAt: now,
143
- ...(input.surface !== undefined ? { surface: input.surface } : {}),
144
- ...(input.model !== undefined ? { model: input.model } : {}),
145
- };
111
+ const task = buildNewTask(input, Date.now());
146
112
  writeRow(task, true);
147
113
  return task;
148
114
  });
@@ -150,28 +116,7 @@ export async function createSqliteMediaTaskStore(dbPath) {
150
116
  const row = getStmt.get(id);
151
117
  if (!row)
152
118
  return null;
153
- const existing = rowToTask(row);
154
- const status = patch.status ?? existing.status;
155
- assertValidStatus(status);
156
- if (!ALLOWED_TRANSITIONS[existing.status].has(status)) {
157
- throw new RangeError(`Invalid media task transition: "${existing.status}" -> "${status}"`);
158
- }
159
- const surface = 'surface' in patch ? (patch.surface ?? undefined) : existing.surface;
160
- const model = 'model' in patch ? (patch.model ?? undefined) : existing.model;
161
- const next = {
162
- id: existing.id,
163
- ownerRef: existing.ownerRef,
164
- status,
165
- progress: patch.progress ? [...patch.progress] : existing.progress,
166
- file: 'file' in patch ? (patch.file == null ? null : structuredClone(patch.file)) : existing.file,
167
- error: 'error' in patch ? (patch.error == null ? null : { ...patch.error }) : existing.error,
168
- startedAt: existing.startedAt,
169
- endedAt: 'endedAt' in patch ? (patch.endedAt ?? null) : existing.endedAt,
170
- createdAt: existing.createdAt,
171
- updatedAt: Date.now(),
172
- ...(surface !== undefined ? { surface } : {}),
173
- ...(model !== undefined ? { model } : {}),
174
- };
119
+ const next = applyTaskPatch(rowToTask(row), patch, Date.now());
175
120
  writeRow(next, false);
176
121
  return next;
177
122
  });
@@ -182,19 +127,12 @@ export async function createSqliteMediaTaskStore(dbPath) {
182
127
  let deleted = 0;
183
128
  for (const row of selectAllStmt.all()) {
184
129
  const task = rowToTask(row);
185
- if (task.status === 'queued' || task.status === 'running') {
186
- const next = {
187
- ...task,
188
- status: 'interrupted',
189
- error: INTERRUPTED_ERROR,
190
- endedAt: task.endedAt ?? now,
191
- updatedAt: now,
192
- };
193
- writeRow(next, false);
130
+ const action = reconcileAction(task, now, cutoff);
131
+ if (action.kind === 'interrupt') {
132
+ writeRow(action.next, false);
194
133
  interrupted += 1;
195
- continue;
196
134
  }
197
- if (TERMINAL_STATUSES.has(task.status) && (task.endedAt ?? task.updatedAt) < cutoff) {
135
+ else if (action.kind === 'delete') {
198
136
  deleteStmt.run(task.id);
199
137
  deleted += 1;
200
138
  }
@@ -221,9 +159,7 @@ export async function createSqliteMediaTaskStore(dbPath) {
221
159
  deleteStmt.run(id);
222
160
  },
223
161
  async reconcileOnBoot(options) {
224
- if (!Number.isFinite(options.terminalTtlMs) || options.terminalTtlMs < 0) {
225
- throw new RangeError(`Invalid terminalTtlMs: ${options.terminalTtlMs} must be a non-negative finite number`);
226
- }
162
+ assertValidTerminalTtl(options.terminalTtlMs);
227
163
  return reconcileTxn(options);
228
164
  },
229
165
  async close() {