@jini-ai/capability-providers 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.
package/CHANGELOG.md CHANGED
@@ -80,7 +80,7 @@
80
80
 
81
81
  ### Patch Changes
82
82
 
83
- - 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).
83
+ - Host clean-up release (2026-10-08): code the first host moved into Jini, plus the Jini clean-up (see the commit log since 0.4.0).
84
84
 
85
85
  ## 0.4.0 — 2026-10-02
86
86
 
@@ -15,7 +15,7 @@
15
15
  * separate, non-production stub under `src/unsafe-reference/` — see that
16
16
  * directory's `index.ts` header for the full warning.
17
17
  */
18
- import type { BlobStorage } from '@jini-ai/platform';
18
+ import type { BlobStorage } from '@jini-ai/core/contracts/blob';
19
19
  import type { StorageObjectMeta, StorageProvider, StoragePutOptions } from '../../storage.js';
20
20
  export interface BlobStorageProviderOptions {
21
21
  /**
@@ -1,4 +1,4 @@
1
- import { StorageError as BlobStorageError } from '@jini-ai/platform';
1
+ import { StorageError as BlobStorageError } from '@jini-ai/core/contracts/blob';
2
2
  /**
3
3
  * `StorageProvider` adapter that delegates to an injected `BlobStorage` instance
4
4
  * (`@jini-ai/platform`'s real, tested port — `LocalBlobStorage` or `S3BlobStorage`). A thin
@@ -1,19 +1,11 @@
1
1
  const DEFAULT_SESSION_TTL_MS = 60 * 60 * 1000;
2
- /** Creates the in-memory reference `AuthProvider`. No persistence — state is lost on process exit. */
3
- export function createInMemoryAuthProvider(_required, options = {}) {
4
- const sessionTtlMs = options.sessionTtlMs ?? DEFAULT_SESSION_TTL_MS;
5
- const now = options.now ?? Date.now;
6
- const usersByEmail = new Map();
7
- const sessions = new Map();
8
- let nextId = 1;
9
- let nextToken = 1;
2
+ function createMemorySignUp(usersByEmail, now, allocateId) {
10
3
  return {
11
4
  async signUp(credentials) {
12
5
  if (usersByEmail.has(credentials.email)) {
13
6
  throw new Error(`email already registered: ${credentials.email}`);
14
7
  }
15
- const id = nextId;
16
- nextId += 1;
8
+ const id = allocateId();
17
9
  const user = {
18
10
  id: `user-${id}`,
19
11
  email: credentials.email,
@@ -23,6 +15,18 @@ export function createInMemoryAuthProvider(_required, options = {}) {
23
15
  usersByEmail.set(credentials.email, user);
24
16
  return { id: user.id, email: user.email, createdAt: user.createdAt };
25
17
  },
18
+ };
19
+ }
20
+ /** Creates the in-memory reference `AuthProvider`. No persistence — state is lost on process exit. */
21
+ export function createInMemoryAuthProvider(_required, options = {}) {
22
+ const sessionTtlMs = options.sessionTtlMs ?? DEFAULT_SESSION_TTL_MS;
23
+ const now = options.now ?? Date.now;
24
+ const usersByEmail = new Map();
25
+ const sessions = new Map();
26
+ let nextId = 1;
27
+ let nextToken = 1;
28
+ return {
29
+ ...createMemorySignUp(usersByEmail, now, () => { const id = nextId; nextId += 1; return id; }),
26
30
  async signIn(credentials) {
27
31
  const user = usersByEmail.get(credentials.email);
28
32
  if (!user || user.password !== credentials.password) {
@@ -37,7 +37,7 @@
37
37
  * requires opting in to this path by name, so they can't be pulled in by
38
38
  * accident alongside the port interfaces/types and typed DI tokens (which
39
39
  * *are* stable, safe-to-depend-on exports of the normal entry point). See
40
- * `packages/capability-providers/archived provenance ledger` and
40
+ * `070311a07^:packages/capability-providers/source-map.md` and
41
41
  * `ADS-memory/reports/security/SEC-remaining-backend-audit-2026-07-21.md`
42
42
  * finding SEC-RB-006 for the audit that prompted this split.
43
43
  */
@@ -37,7 +37,7 @@
37
37
  * requires opting in to this path by name, so they can't be pulled in by
38
38
  * accident alongside the port interfaces/types and typed DI tokens (which
39
39
  * *are* stable, safe-to-depend-on exports of the normal entry point). See
40
- * `packages/capability-providers/archived provenance ledger` and
40
+ * `070311a07^:packages/capability-providers/source-map.md` and
41
41
  * `ADS-memory/reports/security/SEC-remaining-backend-audit-2026-07-21.md`
42
42
  * finding SEC-RB-006 for the audit that prompted this split.
43
43
  */
@@ -123,6 +123,27 @@ function configuredAuthorizationUrl(required) {
123
123
  authorizationUrl.searchParams.set('nonce', required.oidcNonce);
124
124
  return authorizationUrl.toString();
125
125
  }
126
+ function createAuthorizationTransaction(required, { oidcNonce, redirectUri, tokenEndpoint, ttlMs }) {
127
+ return Object.freeze({
128
+ tenantId: required.registration.tenantId,
129
+ providerId: required.provider.id,
130
+ flowBinding: required.flowBinding,
131
+ protocol: required.provider.protocol,
132
+ state: required.security.state,
133
+ ...(oidcNonce ? { nonce: oidcNonce } : {}),
134
+ codeVerifier: required.security.codeVerifier,
135
+ redirectUri,
136
+ clientId: required.registration.clientId,
137
+ ...(required.registration.clientSecretRef
138
+ ? { clientSecretRef: required.registration.clientSecretRef }
139
+ : {}),
140
+ tokenEndpoint: tokenEndpoint.toString(),
141
+ ...(required.server.issuer ? { expectedIssuer: required.server.issuer } : {}),
142
+ requiresAuthorizationResponseIssuer: required.server.requiresAuthorizationResponseIssuer ?? false,
143
+ createdAtMs: required.nowMs,
144
+ expiresAtMs: required.nowMs + ttlMs,
145
+ });
146
+ }
126
147
  /**
127
148
  * Produces a side-effect-free authorization plan. The host persists the
128
149
  * returned transaction before redirecting and must later consume it through
@@ -153,25 +174,7 @@ export function planVisitorAuthAuthorization(required, optional = {}) {
153
174
  });
154
175
  return {
155
176
  authorizationUrl,
156
- transaction: Object.freeze({
157
- tenantId: required.registration.tenantId,
158
- providerId: required.provider.id,
159
- flowBinding: required.flowBinding,
160
- protocol: required.provider.protocol,
161
- state: required.security.state,
162
- ...(oidcNonce ? { nonce: oidcNonce } : {}),
163
- codeVerifier: required.security.codeVerifier,
164
- redirectUri,
165
- clientId: required.registration.clientId,
166
- ...(required.registration.clientSecretRef
167
- ? { clientSecretRef: required.registration.clientSecretRef }
168
- : {}),
169
- tokenEndpoint: tokenEndpoint.toString(),
170
- ...(required.server.issuer ? { expectedIssuer: required.server.issuer } : {}),
171
- requiresAuthorizationResponseIssuer: required.server.requiresAuthorizationResponseIssuer ?? false,
172
- createdAtMs: required.nowMs,
173
- expiresAtMs: required.nowMs + ttlMs,
174
- }),
177
+ transaction: createAuthorizationTransaction(required, { oidcNonce, redirectUri, tokenEndpoint, ttlMs }),
175
178
  };
176
179
  }
177
180
  function callbackContextRejection(required) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jini-ai/capability-providers",
3
- "version": "0.7.1",
3
+ "version": "0.7.3-next.1",
4
4
  "description": "Swappable capability-provider ports (auth, storage, payments, db, realtime) as interfaces and DI tokens only; concrete adapters live behind ./adapters/* subpaths.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -32,8 +32,7 @@
32
32
  },
33
33
  "optionalPeers": {
34
34
  "better-sqlite3": "opt-in: sqlite storage — SQLite storage could not load better-sqlite3. Install better-sqlite3 to enable this feature, or check its installed version and native binaries.",
35
- "ws": "opt-in: websocket realtime adapter; import @jini-ai/capability-providers/adapters/ws — WebSocket realtime adapter could not load ws. Install ws to enable this feature, or check its installed version and native binaries.",
36
- "@jini-ai/platform": "opt-in: platform-backed adapters; import @jini-ai/capability-providers/adapters/blob-storage — Platform-backed adapters could not load @jini-ai/platform. Install @jini-ai/platform to enable this feature, or check its installed version and native binaries."
35
+ "ws": "opt-in: websocket realtime adapter; import @jini-ai/capability-providers/adapters/ws — WebSocket realtime adapter could not load ws. Install ws to enable this feature, or check its installed version and native binaries."
37
36
  }
38
37
  },
39
38
  "type": "module",
@@ -99,12 +98,11 @@
99
98
  "registry": "https://registry.npmjs.org"
100
99
  },
101
100
  "dependencies": {
102
- "@jini-ai/core": "^0.7.1"
101
+ "@jini-ai/core": "^0.7.3-next.1"
103
102
  },
104
103
  "peerDependencies": {
105
104
  "better-sqlite3": "^13.0.0",
106
- "ws": "^8.18.0",
107
- "@jini-ai/platform": "^0.7.0"
105
+ "ws": "^8.18.0"
108
106
  },
109
107
  "devDependencies": {
110
108
  "@types/better-sqlite3": "^7.6.11",
@@ -112,8 +110,7 @@
112
110
  "@vitest/coverage-v8": "^2.1.9",
113
111
  "better-sqlite3": "^13.0.0",
114
112
  "ws": "^8.18.0",
115
- "@jini-ai/platform": "0.7.1",
116
- "@jini-ai/core": "0.7.1"
113
+ "@jini-ai/core": "0.7.3-next.1"
117
114
  },
118
115
  "peerDependenciesMeta": {
119
116
  "better-sqlite3": {
@@ -121,9 +118,6 @@
121
118
  },
122
119
  "ws": {
123
120
  "optional": true
124
- },
125
- "@jini-ai/platform": {
126
- "optional": true
127
121
  }
128
122
  },
129
123
  "scripts": {