@jini-ai/integrations 0.3.6 → 0.4.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.
- package/CHANGELOG.md +90 -0
- package/README.md +72 -24
- package/dist/args.d.ts +8 -0
- package/dist/args.js +10 -0
- package/dist/argument-error.d.ts +9 -0
- package/dist/argument-error.js +7 -0
- package/dist/credentialed-http/auth-schemes.d.ts +29 -0
- package/dist/credentialed-http/auth-schemes.js +60 -0
- package/dist/credentialed-http/credentialed-request.d.ts +132 -0
- package/dist/credentialed-http/credentialed-request.js +365 -0
- package/dist/credentialed-http/index.d.ts +4 -0
- package/dist/credentialed-http/index.js +4 -0
- package/dist/credentialed-http/ports.d.ts +42 -0
- package/dist/credentialed-http/ports.js +2 -0
- package/dist/media-providers/capability-registry.d.ts +13 -7
- package/dist/media-providers/capability-registry.js +6 -6
- package/dist/media-providers/dispatch/async-operation-store.d.ts +25 -8
- package/dist/media-providers/dispatch/async-operation-store.js +12 -32
- package/dist/media-providers/dispatch/builtin-vendors.d.ts +6 -0
- package/dist/media-providers/dispatch/builtin-vendors.js +30 -0
- package/dist/media-providers/dispatch/context.d.ts +7 -2
- package/dist/media-providers/dispatch/context.js +1 -1
- package/dist/media-providers/dispatch/credentials.d.ts +4 -1
- package/dist/media-providers/dispatch/credentials.js +1 -1
- package/dist/media-providers/dispatch/engine.d.ts +5 -13
- package/dist/media-providers/dispatch/engine.js +25 -26
- package/dist/media-providers/dispatch/index.d.ts +4 -1
- package/dist/media-providers/dispatch/index.js +4 -2
- package/dist/media-providers/dispatch/openai-compatible.d.ts +12 -2
- package/dist/media-providers/dispatch/openai-compatible.js +9 -5
- package/dist/media-providers/dispatch/operation-runtime.d.ts +16 -8
- package/dist/media-providers/dispatch/operation-runtime.js +93 -76
- package/dist/media-providers/dispatch/outbound.d.ts +31 -0
- package/dist/media-providers/dispatch/outbound.js +54 -0
- package/dist/media-providers/dispatch/polling-adapter.d.ts +26 -8
- package/dist/media-providers/dispatch/polling-adapter.js +2 -2
- package/dist/media-providers/dispatch/providers/aihubmix-shared.d.ts +2 -2
- package/dist/media-providers/dispatch/providers/aihubmix-shared.js +2 -2
- package/dist/media-providers/dispatch/providers/aihubmix.d.ts +13 -2
- package/dist/media-providers/dispatch/providers/aihubmix.js +18 -16
- package/dist/media-providers/dispatch/providers/custom-image.d.ts +16 -2
- package/dist/media-providers/dispatch/providers/custom-image.js +12 -9
- package/dist/media-providers/dispatch/providers/elevenlabs.d.ts +13 -2
- package/dist/media-providers/dispatch/providers/elevenlabs.js +16 -14
- package/dist/media-providers/dispatch/providers/fishaudio.d.ts +9 -1
- package/dist/media-providers/dispatch/providers/fishaudio.js +10 -8
- package/dist/media-providers/dispatch/providers/grok.d.ts +16 -3
- package/dist/media-providers/dispatch/providers/grok.js +19 -17
- package/dist/media-providers/dispatch/providers/imagerouter-video-async.d.ts +1 -1
- package/dist/media-providers/dispatch/providers/imagerouter-video-async.js +23 -22
- package/dist/media-providers/dispatch/providers/imagerouter.d.ts +17 -3
- package/dist/media-providers/dispatch/providers/imagerouter.js +21 -19
- package/dist/media-providers/dispatch/providers/minimax.d.ts +9 -1
- package/dist/media-providers/dispatch/providers/minimax.js +9 -7
- package/dist/media-providers/dispatch/providers/nanobanana.d.ts +9 -1
- package/dist/media-providers/dispatch/providers/nanobanana.js +10 -8
- package/dist/media-providers/dispatch/providers/openai.d.ts +13 -2
- package/dist/media-providers/dispatch/providers/openai.js +23 -28
- package/dist/media-providers/dispatch/providers/openrouter.d.ts +12 -2
- package/dist/media-providers/dispatch/providers/openrouter.js +14 -12
- package/dist/media-providers/dispatch/providers/senseaudio.d.ts +13 -2
- package/dist/media-providers/dispatch/providers/senseaudio.js +16 -14
- package/dist/media-providers/dispatch/providers/volcengine.d.ts +9 -1
- package/dist/media-providers/dispatch/providers/volcengine.js +11 -9
- package/dist/media-providers/dispatch/response-parsers.d.ts +21 -7
- package/dist/media-providers/dispatch/response-parsers.js +15 -11
- package/dist/media-providers/dispatch/sqlite-async-operation-store.d.ts +3 -1
- package/dist/media-providers/dispatch/sqlite-async-operation-store.js +30 -28
- package/dist/media-providers/dispatch/ssrf-guard.d.ts +27 -14
- package/dist/media-providers/dispatch/ssrf-guard.js +46 -105
- package/dist/media-providers/dispatch/stub.d.ts +7 -2
- package/dist/media-providers/dispatch/stub.js +4 -3
- package/dist/media-providers/dispatch/types.d.ts +17 -13
- package/dist/media-providers/dispatch/vendor-adapter.d.ts +22 -5
- package/dist/media-providers/dispatch/vendor-adapter.js +13 -10
- package/dist/media-providers/dispatch/vendor-registry.d.ts +14 -11
- package/dist/media-providers/dispatch/vendor-registry.js +33 -4
- package/dist/media-providers/index.d.ts +1 -1
- package/dist/media-providers/index.js +1 -1
- package/dist/media-providers/policy.d.ts +3 -2
- package/dist/media-providers/policy.js +4 -2
- package/dist/media-providers/providers.d.ts +12 -4
- package/dist/media-providers/providers.js +3 -3
- package/dist/media-providers/staging.d.ts +8 -2
- package/dist/media-providers/staging.js +13 -4
- package/dist/media-providers/task-store.d.ts +2 -2
- package/dist/media-providers/task-store.js +2 -2
- package/dist/media-providers/tokens.js +3 -3
- package/dist/media-providers/types.d.ts +4 -4
- package/dist/media-providers/types.js +1 -1
- package/dist/media-providers/video-request.d.ts +35 -15
- package/dist/media-providers/video-request.js +15 -15
- package/dist/webhooks/delivery.d.ts +76 -0
- package/dist/webhooks/delivery.js +222 -0
- package/dist/webhooks/index.d.ts +7 -0
- package/dist/webhooks/index.js +7 -0
- package/dist/webhooks/ports.d.ts +113 -0
- package/dist/webhooks/ports.js +2 -0
- package/dist/webhooks/signing.d.ts +38 -0
- package/dist/webhooks/signing.js +83 -0
- package/dist/webhooks/signing.keyring.d.ts +8 -0
- package/dist/webhooks/signing.keyring.js +18 -0
- package/dist/webhooks/subscriptions.d.ts +78 -0
- package/dist/webhooks/subscriptions.js +139 -0
- package/dist/webhooks/types.d.ts +103 -0
- package/dist/webhooks/types.js +2 -0
- package/package.json +36 -22
- package/dist/composio/bounded-data.d.ts.map +0 -1
- package/dist/composio/bounded-data.js.map +0 -1
- package/dist/composio/catalog.d.ts.map +0 -1
- package/dist/composio/catalog.js.map +0 -1
- package/dist/composio/composio-config.d.ts.map +0 -1
- package/dist/composio/composio-config.js.map +0 -1
- package/dist/composio/composio-descriptions.d.ts.map +0 -1
- package/dist/composio/composio-descriptions.js.map +0 -1
- package/dist/composio/composio.d.ts.map +0 -1
- package/dist/composio/composio.js.map +0 -1
- package/dist/composio/errors.d.ts.map +0 -1
- package/dist/composio/errors.js.map +0 -1
- package/dist/composio/file-lock.d.ts.map +0 -1
- package/dist/composio/file-lock.js.map +0 -1
- package/dist/composio/index.d.ts.map +0 -1
- package/dist/composio/index.js.map +0 -1
- package/dist/composio/json-schema.d.ts.map +0 -1
- package/dist/composio/json-schema.js.map +0 -1
- package/dist/composio/output-protection.d.ts.map +0 -1
- package/dist/composio/output-protection.js.map +0 -1
- package/dist/composio/service.d.ts.map +0 -1
- package/dist/composio/service.js.map +0 -1
- package/dist/media-providers/capability-registry.d.ts.map +0 -1
- package/dist/media-providers/capability-registry.js.map +0 -1
- package/dist/media-providers/catalog.d.ts.map +0 -1
- package/dist/media-providers/catalog.js.map +0 -1
- package/dist/media-providers/dispatch/async-operation-store.d.ts.map +0 -1
- package/dist/media-providers/dispatch/async-operation-store.js.map +0 -1
- package/dist/media-providers/dispatch/context.d.ts.map +0 -1
- package/dist/media-providers/dispatch/context.js.map +0 -1
- package/dist/media-providers/dispatch/credentials.d.ts.map +0 -1
- package/dist/media-providers/dispatch/credentials.js.map +0 -1
- package/dist/media-providers/dispatch/engine.d.ts.map +0 -1
- package/dist/media-providers/dispatch/engine.js.map +0 -1
- package/dist/media-providers/dispatch/index.d.ts.map +0 -1
- package/dist/media-providers/dispatch/index.js.map +0 -1
- package/dist/media-providers/dispatch/openai-compatible.d.ts.map +0 -1
- package/dist/media-providers/dispatch/openai-compatible.js.map +0 -1
- package/dist/media-providers/dispatch/operation-runtime.d.ts.map +0 -1
- package/dist/media-providers/dispatch/operation-runtime.js.map +0 -1
- package/dist/media-providers/dispatch/polling-adapter.d.ts.map +0 -1
- package/dist/media-providers/dispatch/polling-adapter.js.map +0 -1
- package/dist/media-providers/dispatch/providers/aihubmix-shared.d.ts.map +0 -1
- package/dist/media-providers/dispatch/providers/aihubmix-shared.js.map +0 -1
- package/dist/media-providers/dispatch/providers/aihubmix.d.ts.map +0 -1
- package/dist/media-providers/dispatch/providers/aihubmix.js.map +0 -1
- package/dist/media-providers/dispatch/providers/custom-image.d.ts.map +0 -1
- package/dist/media-providers/dispatch/providers/custom-image.js.map +0 -1
- package/dist/media-providers/dispatch/providers/elevenlabs.d.ts.map +0 -1
- package/dist/media-providers/dispatch/providers/elevenlabs.js.map +0 -1
- package/dist/media-providers/dispatch/providers/fishaudio.d.ts.map +0 -1
- package/dist/media-providers/dispatch/providers/fishaudio.js.map +0 -1
- package/dist/media-providers/dispatch/providers/grok.d.ts.map +0 -1
- package/dist/media-providers/dispatch/providers/grok.js.map +0 -1
- package/dist/media-providers/dispatch/providers/imagerouter-video-async.d.ts.map +0 -1
- package/dist/media-providers/dispatch/providers/imagerouter-video-async.js.map +0 -1
- package/dist/media-providers/dispatch/providers/imagerouter.d.ts.map +0 -1
- package/dist/media-providers/dispatch/providers/imagerouter.js.map +0 -1
- package/dist/media-providers/dispatch/providers/minimax.d.ts.map +0 -1
- package/dist/media-providers/dispatch/providers/minimax.js.map +0 -1
- package/dist/media-providers/dispatch/providers/nanobanana.d.ts.map +0 -1
- package/dist/media-providers/dispatch/providers/nanobanana.js.map +0 -1
- package/dist/media-providers/dispatch/providers/openai.d.ts.map +0 -1
- package/dist/media-providers/dispatch/providers/openai.js.map +0 -1
- package/dist/media-providers/dispatch/providers/openrouter.d.ts.map +0 -1
- package/dist/media-providers/dispatch/providers/openrouter.js.map +0 -1
- package/dist/media-providers/dispatch/providers/senseaudio.d.ts.map +0 -1
- package/dist/media-providers/dispatch/providers/senseaudio.js.map +0 -1
- package/dist/media-providers/dispatch/providers/volcengine.d.ts.map +0 -1
- package/dist/media-providers/dispatch/providers/volcengine.js.map +0 -1
- package/dist/media-providers/dispatch/response-parsers.d.ts.map +0 -1
- package/dist/media-providers/dispatch/response-parsers.js.map +0 -1
- package/dist/media-providers/dispatch/sqlite-async-operation-store.d.ts.map +0 -1
- package/dist/media-providers/dispatch/sqlite-async-operation-store.js.map +0 -1
- package/dist/media-providers/dispatch/ssrf-guard.d.ts.map +0 -1
- package/dist/media-providers/dispatch/ssrf-guard.js.map +0 -1
- package/dist/media-providers/dispatch/stub.d.ts.map +0 -1
- package/dist/media-providers/dispatch/stub.js.map +0 -1
- package/dist/media-providers/dispatch/types.d.ts.map +0 -1
- package/dist/media-providers/dispatch/types.js.map +0 -1
- package/dist/media-providers/dispatch/vendor-adapter.d.ts.map +0 -1
- package/dist/media-providers/dispatch/vendor-adapter.js.map +0 -1
- package/dist/media-providers/dispatch/vendor-registry.d.ts.map +0 -1
- package/dist/media-providers/dispatch/vendor-registry.js.map +0 -1
- package/dist/media-providers/index.d.ts.map +0 -1
- package/dist/media-providers/index.js.map +0 -1
- package/dist/media-providers/policy.d.ts.map +0 -1
- package/dist/media-providers/policy.js.map +0 -1
- package/dist/media-providers/providers.d.ts.map +0 -1
- package/dist/media-providers/providers.js.map +0 -1
- package/dist/media-providers/seed.d.ts.map +0 -1
- package/dist/media-providers/seed.js.map +0 -1
- package/dist/media-providers/sqlite-task-store.d.ts.map +0 -1
- package/dist/media-providers/sqlite-task-store.js.map +0 -1
- package/dist/media-providers/staging.d.ts.map +0 -1
- package/dist/media-providers/staging.js.map +0 -1
- package/dist/media-providers/task-store.d.ts.map +0 -1
- package/dist/media-providers/task-store.js.map +0 -1
- package/dist/media-providers/tokens.d.ts.map +0 -1
- package/dist/media-providers/tokens.js.map +0 -1
- package/dist/media-providers/types.d.ts.map +0 -1
- package/dist/media-providers/types.js.map +0 -1
- package/dist/media-providers/video-request.d.ts.map +0 -1
- package/dist/media-providers/video-request.js.map +0 -1
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.4.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Tovu clean-up release (2026-10-08): code Tovu moved into Jini, plus the Jini clean-up (see the commit log since 0.4.0).
|
|
8
|
+
|
|
9
|
+
## Unreleased — compilation repairs
|
|
10
|
+
|
|
11
|
+
### BREAKING
|
|
12
|
+
|
|
13
|
+
- `CredentialedRequestDeps.clock` now takes core `Clock.nowMs()`. Verification and request audit timestamps use `nowIso({ clock })` at the existing sampling points; request, audit and response behavior are unchanged.
|
|
14
|
+
|
|
15
|
+
### Fixed
|
|
16
|
+
|
|
17
|
+
- Media-provider DI tokens and browser catalog tests use the current object argument contracts.
|
|
18
|
+
- Policy/generation test fixtures retain literal types; SVG tests supply the full render context.
|
|
19
|
+
- Async video tests inject the existing HTTP client fixture instead of the removed raw fetch option.
|
|
20
|
+
- Restore native WAV header writes at offsets 0, 8, 12 and 36; preserve the original PCM bytes and add header regression assertions.
|
|
21
|
+
|
|
22
|
+
## 0.4.0 — 2026-10-02
|
|
23
|
+
|
|
24
|
+
### BREAKING
|
|
25
|
+
|
|
26
|
+
- HTTP, clocks, IDs and JSON types use core contracts; filesystem locks and SSRF classifiers use platform. Composio error protection and host messages no longer couple domain packages.
|
|
27
|
+
- Distribution includes runtime output, release documentation and required assets only. Process records and per-job neutrality checks are no longer part of the package surface.
|
|
28
|
+
|
|
29
|
+
## Unreleased — integration removal
|
|
30
|
+
|
|
31
|
+
### BREAKING
|
|
32
|
+
|
|
33
|
+
- Composio integration removed: delete the connector source/tests, the public subpath,
|
|
34
|
+
legacy type resolution and associated catalog/persistence messages. Future support
|
|
35
|
+
belongs in an Agent Plugin bundle with a manifest and hosted MCP endpoint.
|
|
36
|
+
|
|
37
|
+
## Unreleased — canonical contracts
|
|
38
|
+
|
|
39
|
+
### BREAKING
|
|
40
|
+
|
|
41
|
+
- Remove `./http-ports`, the credentialed-http/webhooks HTTP type re-exports and the local DTO declarations; import core primitives directly and use `HttpClientPort.send({ request }, { redirect? })`, with body inside request.
|
|
42
|
+
- Webhook clock/ID/JSON/time types and Composio JSON types come from core; webhook clocks expose `nowMs()`.
|
|
43
|
+
- Composio prose takes optional `messages`, exported as `defaultIntegrationsMessages`, instead of required `productName`.
|
|
44
|
+
- Remove local Composio lock and media hostname classifiers; import shared platform locks/network classifiers.
|
|
45
|
+
|
|
46
|
+
### Changed
|
|
47
|
+
|
|
48
|
+
- Composio retains 2000ms timeout, 10ms polling and no age/dead-owner stealing. Shared locking adds owned-create cleanup and inode/device snapshot checks.
|
|
49
|
+
- Native fetch ABIs and media egress paths remain unchanged; provider-host policy retains existing loopback allowance.
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
## Unreleased
|
|
53
|
+
|
|
54
|
+
- Add `./credentialed-http`: resolver, HTTP, scheme-registry and audit ports; origin binding,
|
|
55
|
+
Basic/Bearer/self-describing schemes, redacted responses and injectable auth diagnostics.
|
|
56
|
+
- Add `./webhooks`: subscription lifecycle, envelope/repository ports, delivery retries and
|
|
57
|
+
HMAC signing with required wire vocabulary and caller-supplied time.
|
|
58
|
+
- Existing subpaths and versions are unchanged. No default plugin loading or new dependencies.
|
|
59
|
+
|
|
60
|
+
### Integration merge and API convention
|
|
61
|
+
|
|
62
|
+
- New independent subpaths: `./credentialed-http` and `./webhooks`; transport contracts
|
|
63
|
+
come from core primitives. Retain Composio and media-provider/catalog entries.
|
|
64
|
+
- Export structural `ComposioConnectorProviderPort`, `ConnectorStatusServicePort`
|
|
65
|
+
and `ConnectorObjectOutputProtectionResult` through the Composio barrel.
|
|
66
|
+
- **BREAKING:** Composio public functions, provider/service constructors, service
|
|
67
|
+
methods, configuration/credential stores and errors use required and optional
|
|
68
|
+
argument objects; positional overloads are absent. Hosts can supply catalog `messages`.
|
|
69
|
+
Credential guards narrow the required object's `value`. Error constructors take
|
|
70
|
+
`{ code, message, status }`, then optional `{ details, options }`.
|
|
71
|
+
- **BREAKING:** Media catalog/video helpers, renderers, policies, staging, dispatch
|
|
72
|
+
factories/registries/adapters/parsers, DNS lookup ports and async-operation stores
|
|
73
|
+
use required and optional argument objects. Runtime entry points carry ports and
|
|
74
|
+
operation fields in object one; `clock` is the optional callback and recovery
|
|
75
|
+
keeps numeric `now`. Environment credential resolution requires `providerId` and `env`.
|
|
76
|
+
The protected task-store/SQLite factory conversion remains with its active owner.
|
|
77
|
+
- **BREAKING:** Shared HTTP sends take `{ request }` with optional body inside the request;
|
|
78
|
+
redirect controls occupy object two. Webhook `markFailed` puts optional `{ deadAtIso }`
|
|
79
|
+
in object two. Credential-store setters take
|
|
80
|
+
`{ credentialStore }`. Extracted credential/webhook error constructors take
|
|
81
|
+
`{ message }` and optional `{ options }` without changing messages or error identity.
|
|
82
|
+
- Correct the Composio output overload so only object inputs promise object results;
|
|
83
|
+
preserve scalar, array and null outputs. Immediate connections commit validated
|
|
84
|
+
credentials/account labels without reassigning constant caller options.
|
|
85
|
+
- Write merge regression and package-surface tests; strengthen the whole-source
|
|
86
|
+
neutrality guard to reject product names in comments as well as imports/defaults.
|
|
87
|
+
Verification deferred by owner directive. No version bump or dependency changes.
|
|
88
|
+
|
|
89
|
+
- **BREAKING:** Credentialed-request audit sinks take `{ entry }`; the injected console
|
|
90
|
+
logger takes `{ line }`. Stored entries and emitted diagnostic lines retain their formats.
|
package/README.md
CHANGED
|
@@ -1,36 +1,33 @@
|
|
|
1
1
|
# `@jini-ai/integrations`
|
|
2
2
|
|
|
3
|
-
Third-party vendor integrations
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
Third-party vendor integrations and outbound integration services with independent subpath
|
|
4
|
+
exports. Import the capability you need; each entry owns its dependencies and runtime boundary.
|
|
5
|
+
|
|
6
|
+
| Import subpath | Runtime | API |
|
|
7
|
+
|---|---|---|
|
|
8
|
+
| `./media-providers` | Node | Image/video/audio gateway, policy, staging and task stores |
|
|
9
|
+
| `./media-providers/catalog` | Universal | Browser-safe provider/model catalog |
|
|
10
|
+
| `./credentialed-http` | Node | Credential-origin binding, authentication, redacted responses and audit ports |
|
|
11
|
+
| `./webhooks` | Node | Subscriptions, delivery/retries and signing through host ports |
|
|
9
12
|
|
|
10
13
|
## No root `.` export
|
|
11
14
|
|
|
12
|
-
There is deliberately no `.` export and no `main`/`types` field pointing at a barrel.
|
|
13
|
-
subpath is "the default," and a root barrel re-exporting
|
|
14
|
-
into a
|
|
15
|
+
There is deliberately no `.` export and no `main`/`types` field pointing at a barrel. No
|
|
16
|
+
subpath is "the default," and a root barrel re-exporting every capability would pull media
|
|
17
|
+
dispatch code into a credentialed-HTTP or webhook consumer's bundle — exactly the coupling this
|
|
18
|
+
structure exists to avoid.
|
|
15
19
|
`typesVersions` covers legacy TypeScript `moduleResolution: "node"` (node10) consumers, which ignore
|
|
16
|
-
`package.json#exports` entirely and would otherwise fail to resolve
|
|
20
|
+
`package.json#exports` entirely and would otherwise fail to resolve a subpath's `.d.ts` even
|
|
17
21
|
though `exports` itself resolves fine at runtime — the same class of node10 gap several packages in
|
|
18
22
|
this workspace hit and fixed with a `main`/`types` pair (see their `CHANGELOG.md` 0.1.2 entries);
|
|
19
23
|
`typesVersions` is this package's equivalent fix for a package with no single default entry to point
|
|
20
24
|
`main`/`types` at.
|
|
21
25
|
|
|
22
|
-
## `./composio`
|
|
23
|
-
|
|
24
|
-
OAuth-authenticated Composio connector catalog discovery and execution. No runtime dependency
|
|
25
|
-
beyond `@jini-ai/protocol` (a devDependency only — every reference is `import type { JsonValue }`).
|
|
26
|
-
`npm install @jini-ai/integrations` is enough; nothing extra to add. See `src/composio/source-map.md`
|
|
27
|
-
for full provenance.
|
|
28
|
-
|
|
29
26
|
## `./media-providers`
|
|
30
27
|
|
|
31
28
|
A gateway for generating images, video, and audio across many vendors behind one call — capability
|
|
32
29
|
registry, multi-vendor REST dispatch, policy and staging ports, and an optional SQLite task store.
|
|
33
|
-
See `src/media-providers/README.md` for the full feature list and
|
|
30
|
+
See `src/media-providers/README.md` for the full feature list and the archived provenance ledger
|
|
34
31
|
for provenance.
|
|
35
32
|
|
|
36
33
|
`better-sqlite3` (a native compiled addon) is an **optional peer dependency**, not a regular one.
|
|
@@ -42,10 +39,61 @@ that one function, never a static import. Only a consumer that actually calls
|
|
|
42
39
|
convention `@jini-ai/admin`'s `react`/`react-dom` optional peers use (see its README's "Layers"
|
|
43
40
|
section) and `packages/README.md`'s "Optional peer dependencies" table documents workspace-wide.
|
|
44
41
|
|
|
45
|
-
##
|
|
42
|
+
## `./credentialed-http` and `./webhooks`
|
|
43
|
+
|
|
44
|
+
The HTTP service takes a workspace-scoped credential resolver, guarded HTTP client,
|
|
45
|
+
scheme registry, clock and audit sink. Plugin trust/loading, persistence and authorization
|
|
46
|
+
are bound by the host. See [Credentialed HTTP](src/credentialed-http/README.md).
|
|
47
|
+
|
|
48
|
+
Webhook services take subscription/delivery repositories, an envelope store, HTTP client,
|
|
49
|
+
signer, clock and IDs. Signature fields and delivery headers are required host vocabulary.
|
|
50
|
+
Key custody and durable claims remain behind ports. See [Webhooks](src/webhooks/README.md).
|
|
51
|
+
|
|
52
|
+
## Required and optional argument objects
|
|
53
|
+
|
|
54
|
+
Public calls take required arguments in object one and optional controls in object two.
|
|
55
|
+
Dependencies are fields of those objects or their typed `deps` records. DTO values such as
|
|
56
|
+
credentials, event records and execution contexts keep their existing wire fields.
|
|
57
|
+
The convention conversion is breaking: export names are retained, with no positional overloads.
|
|
58
|
+
|
|
59
|
+
```ts
|
|
60
|
+
import { makeCredentialedRequest } from '@jini-ai/integrations/credentialed-http';
|
|
61
|
+
import type { HttpClientPort } from '@jini-ai/core/primitives';
|
|
62
|
+
|
|
63
|
+
await makeCredentialedRequest(
|
|
64
|
+
{ deps: { resolver, httpClient, schemeRegistry, audit, clock },
|
|
65
|
+
input: { workspaceId, label, method: 'POST', url } },
|
|
66
|
+
{ body: JSON.stringify(payload), headers: { 'content-type': 'application/json' } },
|
|
67
|
+
);
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Core's `HttpClientPort.send({ request }, { redirect? })` is shared by both services.
|
|
71
|
+
Import `HttpClientPort`, `HttpRequest` and `HttpResponse` directly from
|
|
72
|
+
`@jini-ai/core/primitives`. `HttpRequest` holds all request fields, including body;
|
|
73
|
+
the second argument contains redirect controls. A native transport adapter receives
|
|
74
|
+
the unwrapped request and forwards those controls separately.
|
|
75
|
+
The host transport must still validate each peer/redirect, cap response reads and strip credentials
|
|
76
|
+
on cross-origin redirects. Public validation errors take `{ message }` and optional `{ options }`
|
|
77
|
+
for an `ErrorOptions` cause.
|
|
78
|
+
|
|
79
|
+
## Verification and ownership
|
|
80
|
+
|
|
81
|
+
No tests, typechecks, builds or pack commands were run in this merge pass (owner directive).
|
|
82
|
+
Exact per-file commands are in [integrate-NOT-RUN.md](integrate-NOT-RUN.md).
|
|
83
|
+
The protected media-provider lane still owns the task-store conversion recorded in
|
|
84
|
+
[w10e-api-inventory.md](w10e-api-inventory.md). Its completion and the later host rewiring
|
|
85
|
+
are required before publishing the convention changes. No versions or dependencies changed.
|
|
86
|
+
|
|
87
|
+
Credentialed-request audit ports use `record({ entry })`. The console audit adapter receives
|
|
88
|
+
`{ prefix, log }` and calls `log({ line })`; memory entries and console line formats are preserved.
|
|
89
|
+
|
|
90
|
+
## Design decisions
|
|
91
|
+
|
|
92
|
+
- [Webhook endpoints have independent bounded retry state](docs/decisions/DR-001-independent-webhook-retries.md).
|
|
46
93
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
94
|
+
HTTP transports implement `send({ request }, { redirect? })`; the complete request includes its
|
|
95
|
+
optional body. Webhooks use core `Clock.nowMs()` and `IdGenerator.newId()`.
|
|
96
|
+
Media dispatch and async operations take an optional guarded `httpClient`; raw
|
|
97
|
+
`fetchImpl` injection is unsupported. Catalog lookup uses `findProvider({ id })`,
|
|
98
|
+
and `svgPlaceholder` receives the full required render context. Native Node
|
|
99
|
+
buffer writes retain their positional ABI.
|
package/dist/args.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** Required and optional fields of an API argument record. */
|
|
2
|
+
export type RequiredArgs<T> = Pick<T, {
|
|
3
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? never : K;
|
|
4
|
+
}[keyof T]>;
|
|
5
|
+
export type OptionalArgs<T> = Pick<T, Exclude<keyof T, keyof RequiredArgs<T>>>;
|
|
6
|
+
/** Package-local composition helper; public APIs expose the two records directly. */
|
|
7
|
+
export declare function partitionArgs<T extends object, K extends keyof T>(value: T, requiredKeys: readonly K[]): [Pick<T, K>, Omit<T, K>];
|
|
8
|
+
//# sourceMappingURL=args.d.ts.map
|
package/dist/args.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** Package-local composition helper; public APIs expose the two records directly. */
|
|
2
|
+
export function partitionArgs(value, requiredKeys) {
|
|
3
|
+
const required = {};
|
|
4
|
+
const optional = {};
|
|
5
|
+
for (const key of Object.keys(value)) {
|
|
6
|
+
(requiredKeys.includes(key) ? required : optional)[key] = value[key];
|
|
7
|
+
}
|
|
8
|
+
return [required, optional];
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=args.js.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** Internal base preserving Error messages/causes with required and optional argument objects. */
|
|
2
|
+
export declare class IntegrationError extends Error {
|
|
3
|
+
constructor({ message }: {
|
|
4
|
+
message: string;
|
|
5
|
+
}, { options }?: {
|
|
6
|
+
options?: ErrorOptions;
|
|
7
|
+
});
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=argument-error.d.ts.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** Internal base preserving Error messages/causes with required and optional argument objects. */
|
|
2
|
+
export class IntegrationError extends Error {
|
|
3
|
+
constructor({ message }, { options } = {}) {
|
|
4
|
+
super(message, options);
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=argument-error.js.map
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export interface CredentialSchemeRule {
|
|
2
|
+
readonly id: string;
|
|
3
|
+
readonly prefix: string;
|
|
4
|
+
readonly scheme: string;
|
|
5
|
+
}
|
|
6
|
+
export interface SelfDescribingTokenMatch {
|
|
7
|
+
readonly scheme: string;
|
|
8
|
+
readonly value: string;
|
|
9
|
+
}
|
|
10
|
+
export interface CredentialSchemeRegistry {
|
|
11
|
+
readonly rules: readonly CredentialSchemeRule[];
|
|
12
|
+
readonly refusals: readonly string[];
|
|
13
|
+
}
|
|
14
|
+
/** Match self-describing tokens in supplied rule order; no host or vendor inference. */
|
|
15
|
+
export declare function detectSelfDescribingAuthScheme(required: {
|
|
16
|
+
token: string;
|
|
17
|
+
rules: readonly CredentialSchemeRule[];
|
|
18
|
+
}): SelfDescribingTokenMatch | null;
|
|
19
|
+
/** Parse schema-v1 rule data, rejecting malformed or duplicate entries atomically. */
|
|
20
|
+
export declare function parseCredentialSchemesFile(required: {
|
|
21
|
+
raw: string;
|
|
22
|
+
}): {
|
|
23
|
+
readonly ok: true;
|
|
24
|
+
readonly rules: readonly CredentialSchemeRule[];
|
|
25
|
+
} | {
|
|
26
|
+
readonly ok: false;
|
|
27
|
+
readonly reason: string;
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=auth-schemes.d.ts.map
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
const RULE_ID_PATTERN = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
|
|
2
|
+
// An HTTP authentication scheme is an RFC 9110 token, not arbitrary header text.
|
|
3
|
+
const HTTP_TOKEN_PATTERN = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;
|
|
4
|
+
const MAX_FIELD_LENGTH = 64;
|
|
5
|
+
const MAX_RULES = 32;
|
|
6
|
+
// A leading scheme prefix must leave a credential value: an exact-prefix token or a prefix
|
|
7
|
+
// appearing later in the token falls through to ordinary Bearer/Basic handling. First match
|
|
8
|
+
// wins, so rule prefixes should be disjoint. Infer from token content because proxy URLs need
|
|
9
|
+
// not identify the token's provider.
|
|
10
|
+
/** Match self-describing tokens in supplied rule order; no host or vendor inference. */
|
|
11
|
+
export function detectSelfDescribingAuthScheme(required) {
|
|
12
|
+
const { token, rules } = required;
|
|
13
|
+
for (const rule of rules) {
|
|
14
|
+
if (token.startsWith(rule.prefix) && token.length > rule.prefix.length) {
|
|
15
|
+
return { scheme: rule.scheme, value: token.slice(rule.prefix.length) };
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
/** Parse schema-v1 rule data, rejecting malformed or duplicate entries atomically. */
|
|
21
|
+
export function parseCredentialSchemesFile(required) {
|
|
22
|
+
let value;
|
|
23
|
+
try {
|
|
24
|
+
value = JSON.parse(required.raw);
|
|
25
|
+
}
|
|
26
|
+
catch {
|
|
27
|
+
return { ok: false, reason: "not valid JSON" };
|
|
28
|
+
}
|
|
29
|
+
if (!isPlainObject(value) || value.schemaVersion !== 1)
|
|
30
|
+
return { ok: false, reason: "schemaVersion must be 1" };
|
|
31
|
+
if (!Array.isArray(value.schemes) || value.schemes.length > MAX_RULES)
|
|
32
|
+
return { ok: false, reason: `schemes must be an array of at most ${MAX_RULES} rules` };
|
|
33
|
+
const rules = [];
|
|
34
|
+
for (const [index, entry] of value.schemes.entries()) {
|
|
35
|
+
const rule = parseRule(entry, `schemes[${index}]`);
|
|
36
|
+
if (typeof rule === "string")
|
|
37
|
+
return { ok: false, reason: rule };
|
|
38
|
+
if (rules.some((seen) => seen.id === rule.id))
|
|
39
|
+
return { ok: false, reason: `schemes[${index}].id '${rule.id}' is declared twice` };
|
|
40
|
+
rules.push(rule);
|
|
41
|
+
}
|
|
42
|
+
return { ok: true, rules };
|
|
43
|
+
}
|
|
44
|
+
function parseRule(entry, at) {
|
|
45
|
+
if (!isPlainObject(entry))
|
|
46
|
+
return `${at} must be an object`;
|
|
47
|
+
const { id, prefix, scheme } = entry;
|
|
48
|
+
if (typeof id !== "string" || id.length > MAX_FIELD_LENGTH || !RULE_ID_PATTERN.test(id))
|
|
49
|
+
return `${at}.id must be a lowercase hyphenated id`;
|
|
50
|
+
if (typeof prefix !== "string" || prefix.length === 0 || prefix.length > MAX_FIELD_LENGTH || !HTTP_TOKEN_PATTERN.test(prefix)) {
|
|
51
|
+
return `${at}.prefix must be a non-empty run of HTTP token characters`;
|
|
52
|
+
}
|
|
53
|
+
if (typeof scheme !== "string" || scheme.length > MAX_FIELD_LENGTH || !HTTP_TOKEN_PATTERN.test(scheme))
|
|
54
|
+
return `${at}.scheme must be an HTTP auth-scheme name`;
|
|
55
|
+
return { id, prefix, scheme };
|
|
56
|
+
}
|
|
57
|
+
function isPlainObject(value) {
|
|
58
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=auth-schemes.js.map
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Arbitrary operator-saved provider URLs require an injected guarded HTTP port, rather than raw
|
|
3
|
+
* fetch against an assumed-safe provider catalog. Composition owns DNS/address checks, connection
|
|
4
|
+
* pinning, per-hop redirect checks, response bounds, and cross-origin authorization stripping.
|
|
5
|
+
* This layer adds the credential's persisted origin binding; request input cannot widen it.
|
|
6
|
+
* Confirmation belongs to the calling host: this service executes an allowed verb uniformly and
|
|
7
|
+
* does not introduce a second approval ceremony or expose decrypted credentials to the caller.
|
|
8
|
+
*/
|
|
9
|
+
import { IntegrationError } from "../argument-error.js";
|
|
10
|
+
import { type Clock, type HttpClientPort, type UUID } from "@jini-ai/core/primitives";
|
|
11
|
+
import type { CredentialConnection, CredentialResolverPort, CredentialSchemeRegistryPort, CredentialedRequestErrorPolicyPort } from "./ports.js";
|
|
12
|
+
import { type CredentialSchemeRule } from "./auth-schemes.js";
|
|
13
|
+
export declare class CredentialNotFoundError extends IntegrationError {
|
|
14
|
+
}
|
|
15
|
+
export declare class CredentialedRequestValidationError extends IntegrationError {
|
|
16
|
+
}
|
|
17
|
+
export declare class CredentialedRequestTransportError extends IntegrationError {
|
|
18
|
+
}
|
|
19
|
+
/** Resolve self-describing, Basic, then Bearer precedence for trusted outbound-request executors.
|
|
20
|
+
* Returns a secret-bearing header to those executors only; never expose it in tool/model results,
|
|
21
|
+
* previews or logs. Callers needing only the target must use `resolveRequestTarget` instead. */
|
|
22
|
+
export declare function buildAuthorizationHeader(required: {
|
|
23
|
+
connection: CredentialConnection;
|
|
24
|
+
schemes: readonly CredentialSchemeRule[];
|
|
25
|
+
}): string;
|
|
26
|
+
export interface AuthFailureDiagnostic {
|
|
27
|
+
readonly schemeSent: string;
|
|
28
|
+
readonly usernameStored: boolean;
|
|
29
|
+
readonly hint?: string;
|
|
30
|
+
readonly remedyToolId?: string;
|
|
31
|
+
}
|
|
32
|
+
export interface CredentialedRequestAuditEntry {
|
|
33
|
+
readonly label: string;
|
|
34
|
+
readonly host: string;
|
|
35
|
+
readonly method: string;
|
|
36
|
+
readonly status: number;
|
|
37
|
+
readonly bodyBytes: number;
|
|
38
|
+
readonly at: string;
|
|
39
|
+
readonly egressRefusal?: string;
|
|
40
|
+
}
|
|
41
|
+
export interface CredentialedRequestAuditPort {
|
|
42
|
+
record(required: {
|
|
43
|
+
entry: CredentialedRequestAuditEntry;
|
|
44
|
+
}): void;
|
|
45
|
+
}
|
|
46
|
+
export declare class ConsoleCredentialedRequestAuditLog implements CredentialedRequestAuditPort {
|
|
47
|
+
private readonly required;
|
|
48
|
+
constructor(required: {
|
|
49
|
+
log: (required: {
|
|
50
|
+
line: string;
|
|
51
|
+
}) => void;
|
|
52
|
+
prefix: string;
|
|
53
|
+
});
|
|
54
|
+
record({ entry }: {
|
|
55
|
+
entry: CredentialedRequestAuditEntry;
|
|
56
|
+
}): void;
|
|
57
|
+
}
|
|
58
|
+
export declare class InMemoryCredentialedRequestAuditLog implements CredentialedRequestAuditPort {
|
|
59
|
+
readonly entries: CredentialedRequestAuditEntry[];
|
|
60
|
+
record({ entry }: {
|
|
61
|
+
entry: CredentialedRequestAuditEntry;
|
|
62
|
+
}): void;
|
|
63
|
+
}
|
|
64
|
+
/** Dependencies and identity are all required in argument one. No global store or plugin loading. */
|
|
65
|
+
export interface CredentialedRequestDeps {
|
|
66
|
+
readonly resolver: CredentialResolverPort;
|
|
67
|
+
readonly httpClient: HttpClientPort;
|
|
68
|
+
readonly clock: Clock;
|
|
69
|
+
readonly audit: CredentialedRequestAuditPort;
|
|
70
|
+
readonly schemeRegistry: CredentialSchemeRegistryPort;
|
|
71
|
+
}
|
|
72
|
+
export interface CredentialedRequestOptions {
|
|
73
|
+
readonly headers?: unknown;
|
|
74
|
+
readonly body?: unknown;
|
|
75
|
+
readonly errorPolicy?: CredentialedRequestErrorPolicyPort;
|
|
76
|
+
readonly diagnosticMapper?: (required: {
|
|
77
|
+
diagnostic: AuthFailureDiagnostic;
|
|
78
|
+
status: 401 | 403;
|
|
79
|
+
}) => AuthFailureDiagnostic;
|
|
80
|
+
}
|
|
81
|
+
/** Resolve an approved request target without decrypting credentials. */
|
|
82
|
+
export declare function resolveRequestTarget(required: {
|
|
83
|
+
resolver: Pick<CredentialResolverPort, "describe">;
|
|
84
|
+
input: {
|
|
85
|
+
workspaceId: string;
|
|
86
|
+
label: string;
|
|
87
|
+
url: unknown;
|
|
88
|
+
};
|
|
89
|
+
}): Promise<{
|
|
90
|
+
label: string;
|
|
91
|
+
url: URL;
|
|
92
|
+
}>;
|
|
93
|
+
export type CustomCredentialCheckStatus = "valid" | "invalid" | "unreachable";
|
|
94
|
+
export interface CustomCredentialVerificationResult {
|
|
95
|
+
readonly status: CustomCredentialCheckStatus;
|
|
96
|
+
readonly message: string;
|
|
97
|
+
readonly checkedAt: string;
|
|
98
|
+
readonly authDiagnostic?: AuthFailureDiagnostic;
|
|
99
|
+
}
|
|
100
|
+
/** Probe the saved origin root and classify 2xx/401/403/other outcomes; audit without returning response bodies. */
|
|
101
|
+
export declare function verifyCustomCredential(required: {
|
|
102
|
+
deps: CredentialedRequestDeps;
|
|
103
|
+
input: {
|
|
104
|
+
workspaceId: UUID;
|
|
105
|
+
label: unknown;
|
|
106
|
+
};
|
|
107
|
+
}, optional?: CredentialedRequestOptions): Promise<CustomCredentialVerificationResult>;
|
|
108
|
+
export interface CredentialedRequestExecutedResult {
|
|
109
|
+
readonly executed: true;
|
|
110
|
+
readonly status: number;
|
|
111
|
+
readonly headers: Record<string, string>;
|
|
112
|
+
readonly bodyText: string;
|
|
113
|
+
readonly authDiagnostic?: AuthFailureDiagnostic;
|
|
114
|
+
}
|
|
115
|
+
export interface CredentialedRequestDeclinedResult {
|
|
116
|
+
readonly executed: false;
|
|
117
|
+
readonly cancelled: boolean;
|
|
118
|
+
readonly reason?: "expired" | "abandoned";
|
|
119
|
+
}
|
|
120
|
+
export type CredentialedRequestOutcome = CredentialedRequestExecutedResult | CredentialedRequestDeclinedResult;
|
|
121
|
+
export interface MakeCredentialedRequestInput {
|
|
122
|
+
readonly workspaceId: UUID;
|
|
123
|
+
readonly label: unknown;
|
|
124
|
+
readonly method: unknown;
|
|
125
|
+
readonly url: unknown;
|
|
126
|
+
}
|
|
127
|
+
/** Validate caller shape and credential origins, send through the guarded HTTP port, then redact response secrets. Transport failures are audited; egress refusal identity is host-defined. */
|
|
128
|
+
export declare function makeCredentialedRequest(required: {
|
|
129
|
+
deps: CredentialedRequestDeps;
|
|
130
|
+
input: MakeCredentialedRequestInput;
|
|
131
|
+
}, optional?: CredentialedRequestOptions): Promise<CredentialedRequestExecutedResult>;
|
|
132
|
+
//# sourceMappingURL=credentialed-request.d.ts.map
|