@jini-ai/capability-providers 0.4.0 → 0.4.2
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 +10 -0
- package/dist/auth.d.ts +1 -5
- package/dist/auth.js +1 -5
- package/dist/comments/definitions.d.ts +25 -0
- package/dist/comments/definitions.js +14 -0
- package/dist/comments/index.d.ts +6 -0
- package/dist/comments/index.js +6 -0
- package/dist/comments/ports.d.ts +122 -0
- package/dist/comments/ports.js +2 -0
- package/dist/comments/registry.d.ts +43 -0
- package/dist/comments/registry.js +40 -0
- package/dist/comments/tokens.d.ts +8 -0
- package/dist/comments/tokens.js +7 -0
- package/dist/db.d.ts +1 -6
- package/dist/db.js +1 -6
- package/dist/index.d.ts +8 -66
- package/dist/index.js +8 -66
- package/dist/payments.d.ts +1 -5
- package/dist/payments.js +1 -5
- package/dist/realtime.d.ts +2 -7
- package/dist/realtime.js +2 -7
- package/dist/storage.d.ts +5 -4
- package/dist/storage.js +5 -4
- package/dist/tokens.js +2 -11
- package/package.json +26 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @jini-ai/capability-providers
|
|
2
2
|
|
|
3
|
+
## 0.4.2 — 2026-10-22
|
|
4
|
+
|
|
5
|
+
- 2026-10-22: Comments provider registry and ports; storage contracts marked as views of ObjectStore.
|
|
6
|
+
|
|
7
|
+
## 0.4.1
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- 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).
|
|
12
|
+
|
|
3
13
|
## 0.4.0 — 2026-10-02
|
|
4
14
|
|
|
5
15
|
### BREAKING
|
package/dist/auth.d.ts
CHANGED
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* port-design exploration (see `archived provenance ledger`): Zana and a fleet orchestrator each
|
|
4
|
-
* independently built an explicit capability-provider layer with auth as one
|
|
5
|
-
* of the swappable capabilities (Supabase/sqlite-backed) — this is the
|
|
6
|
-
* engine-level shape that convergence points at, not a lift from either.
|
|
2
|
+
* Swappable identity/session port. See index.ts for capability-provider ownership and adoption scope.
|
|
7
3
|
*
|
|
8
4
|
* This file defines the port's stable interface/type surface and nothing else —
|
|
9
5
|
* it has no imports at all, so a consumer implementing `AuthProvider`
|
package/dist/auth.js
CHANGED
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* port-design exploration (see `archived provenance ledger`): Zana and a fleet orchestrator each
|
|
4
|
-
* independently built an explicit capability-provider layer with auth as one
|
|
5
|
-
* of the swappable capabilities (Supabase/sqlite-backed) — this is the
|
|
6
|
-
* engine-level shape that convergence points at, not a lift from either.
|
|
2
|
+
* Swappable identity/session port. See index.ts for capability-provider ownership and adoption scope.
|
|
7
3
|
*
|
|
8
4
|
* This file defines the port's stable interface/type surface and nothing else —
|
|
9
5
|
* it has no imports at all, so a consumer implementing `AuthProvider`
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export interface CommentsSettingField {
|
|
2
|
+
readonly key: string;
|
|
3
|
+
readonly label: string;
|
|
4
|
+
readonly kind: 'public' | 'secret';
|
|
5
|
+
readonly required: boolean;
|
|
6
|
+
}
|
|
7
|
+
export interface CommentsProviderDefinition {
|
|
8
|
+
readonly id: string;
|
|
9
|
+
readonly label: string;
|
|
10
|
+
readonly kind: 'stored' | 'embedded';
|
|
11
|
+
readonly consentCategory: 'functional' | 'marketing';
|
|
12
|
+
readonly csp: {
|
|
13
|
+
readonly scriptSrc: readonly string[];
|
|
14
|
+
readonly frameSrc: readonly string[];
|
|
15
|
+
readonly connectSrc: readonly string[];
|
|
16
|
+
readonly styleSrc: readonly string[];
|
|
17
|
+
};
|
|
18
|
+
readonly settingsSchema: readonly CommentsSettingField[];
|
|
19
|
+
readonly implementation: 'metadata-only' | 'adapter';
|
|
20
|
+
}
|
|
21
|
+
/** Returns an immutable, isolated definition; malformed metadata is refused before registration. */
|
|
22
|
+
export declare function freezeCommentsDefinition({ definition }: {
|
|
23
|
+
definition: CommentsProviderDefinition;
|
|
24
|
+
}, _options?: {}): CommentsProviderDefinition;
|
|
25
|
+
//# sourceMappingURL=definitions.d.ts.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** Returns an immutable, isolated definition; malformed metadata is refused before registration. */
|
|
2
|
+
export function freezeCommentsDefinition({ definition }, _options = {}) {
|
|
3
|
+
if (!/^[a-z0-9][a-z0-9._-]*$/.test(definition.id) || !definition.label.trim())
|
|
4
|
+
throw new Error('Invalid comments provider identity');
|
|
5
|
+
if (!['stored', 'embedded'].includes(definition.kind) || !['functional', 'marketing'].includes(definition.consentCategory)
|
|
6
|
+
|| !['metadata-only', 'adapter'].includes(definition.implementation))
|
|
7
|
+
throw new Error('Invalid comments provider metadata');
|
|
8
|
+
return Object.freeze({ ...definition,
|
|
9
|
+
csp: Object.freeze({ scriptSrc: Object.freeze([...definition.csp.scriptSrc]), frameSrc: Object.freeze([...definition.csp.frameSrc]),
|
|
10
|
+
connectSrc: Object.freeze([...definition.csp.connectSrc]), styleSrc: Object.freeze([...definition.csp.styleSrc]) }),
|
|
11
|
+
settingsSchema: Object.freeze(definition.settingsSchema.map(field => Object.freeze({ ...field }))),
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=definitions.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** Neutral comments contracts, metadata and site-scoped resolution. Hosts bind their own adapters. */
|
|
2
|
+
export * from './definitions.js';
|
|
3
|
+
export * from './ports.js';
|
|
4
|
+
export * from './registry.js';
|
|
5
|
+
export * from './tokens.js';
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/** Provider-neutral comments boundaries. Private moderation data never enters thread rendering. */
|
|
2
|
+
export type CommentStatus = 'pending' | 'approved' | 'spam' | 'trash';
|
|
3
|
+
export interface CommentThreadRendererPort {
|
|
4
|
+
renderThread(required: {
|
|
5
|
+
siteId: string;
|
|
6
|
+
entry: {
|
|
7
|
+
id: string;
|
|
8
|
+
slug: string;
|
|
9
|
+
title: string;
|
|
10
|
+
canonicalUrl: string;
|
|
11
|
+
};
|
|
12
|
+
locale: string;
|
|
13
|
+
}, optional?: {
|
|
14
|
+
nonce?: string;
|
|
15
|
+
cursor?: string;
|
|
16
|
+
}): Promise<{
|
|
17
|
+
html: string;
|
|
18
|
+
}>;
|
|
19
|
+
}
|
|
20
|
+
export interface CommentModerationPort {
|
|
21
|
+
listQueue(required: {
|
|
22
|
+
siteId: string;
|
|
23
|
+
status: CommentStatus;
|
|
24
|
+
limit: number;
|
|
25
|
+
cursor?: string | null;
|
|
26
|
+
}, optional?: Record<string, never>): Promise<{
|
|
27
|
+
items: readonly {
|
|
28
|
+
id: string;
|
|
29
|
+
entryId: string;
|
|
30
|
+
status: CommentStatus;
|
|
31
|
+
authorName: string;
|
|
32
|
+
bodyText: string;
|
|
33
|
+
version: number;
|
|
34
|
+
}[];
|
|
35
|
+
nextCursor: string | null;
|
|
36
|
+
}>;
|
|
37
|
+
get(required: {
|
|
38
|
+
siteId: string;
|
|
39
|
+
id: string;
|
|
40
|
+
}, optional?: Record<string, never>): Promise<{
|
|
41
|
+
id: string;
|
|
42
|
+
entryId: string;
|
|
43
|
+
status: CommentStatus;
|
|
44
|
+
authorName: string;
|
|
45
|
+
bodyText: string;
|
|
46
|
+
version: number;
|
|
47
|
+
} | null>;
|
|
48
|
+
apply(required: {
|
|
49
|
+
siteId: string;
|
|
50
|
+
id: string;
|
|
51
|
+
expectedVersion: number;
|
|
52
|
+
action: 'approve' | 'mark_spam' | 'trash' | 'restore';
|
|
53
|
+
actorPrincipalId: string;
|
|
54
|
+
actorPluginId?: string | null;
|
|
55
|
+
note: string | null;
|
|
56
|
+
}, optional?: Record<string, never>): Promise<{
|
|
57
|
+
ok: true;
|
|
58
|
+
} | {
|
|
59
|
+
ok: false;
|
|
60
|
+
reason: 'not-found' | 'conflict';
|
|
61
|
+
currentVersion?: number;
|
|
62
|
+
}>;
|
|
63
|
+
purge(required: {
|
|
64
|
+
siteId: string;
|
|
65
|
+
id: string;
|
|
66
|
+
actorPrincipalId: string;
|
|
67
|
+
note: string | null;
|
|
68
|
+
}, optional?: Record<string, never>): Promise<{
|
|
69
|
+
ok: true;
|
|
70
|
+
} | {
|
|
71
|
+
ok: false;
|
|
72
|
+
reason: 'not-found' | 'conflict';
|
|
73
|
+
}>;
|
|
74
|
+
}
|
|
75
|
+
export interface CommentSubmissionPort {
|
|
76
|
+
submit(required: {
|
|
77
|
+
siteId: string;
|
|
78
|
+
entryId: string;
|
|
79
|
+
parentId: string | null;
|
|
80
|
+
authorName: string;
|
|
81
|
+
authorEmail: string | null;
|
|
82
|
+
authorUrl: string | null;
|
|
83
|
+
bodyRaw: string;
|
|
84
|
+
authorIpHash: string;
|
|
85
|
+
honeypotValue: string;
|
|
86
|
+
}, optional?: Record<string, never>): Promise<{
|
|
87
|
+
ok: true;
|
|
88
|
+
id: string;
|
|
89
|
+
status: CommentStatus;
|
|
90
|
+
} | {
|
|
91
|
+
ok: false;
|
|
92
|
+
reason: string;
|
|
93
|
+
}>;
|
|
94
|
+
}
|
|
95
|
+
/** Separate bindings preserve the difference between stored and embedded providers. */
|
|
96
|
+
export type CommentsProviderAdapter = {
|
|
97
|
+
kind: 'stored';
|
|
98
|
+
renderer: CommentThreadRendererPort;
|
|
99
|
+
moderation: CommentModerationPort;
|
|
100
|
+
submission: CommentSubmissionPort;
|
|
101
|
+
} | {
|
|
102
|
+
kind: 'embedded';
|
|
103
|
+
renderer: CommentThreadRendererPort;
|
|
104
|
+
dashboardUrl: string;
|
|
105
|
+
};
|
|
106
|
+
export interface CommentsSelection {
|
|
107
|
+
providerId: string | null;
|
|
108
|
+
revision: number;
|
|
109
|
+
}
|
|
110
|
+
/** compareAndSet must compare and persist inside ONE storage transaction, including the revision. */
|
|
111
|
+
export interface CommentsSelectionStorePort {
|
|
112
|
+
read(required: {
|
|
113
|
+
siteId: string;
|
|
114
|
+
}, optional?: Record<string, never>): Promise<CommentsSelection>;
|
|
115
|
+
compareAndSet(required: {
|
|
116
|
+
siteId: string;
|
|
117
|
+
expectedRevision: number;
|
|
118
|
+
providerId: string | null;
|
|
119
|
+
actorPrincipalId: string;
|
|
120
|
+
}, optional?: Record<string, never>): Promise<boolean>;
|
|
121
|
+
}
|
|
122
|
+
//# sourceMappingURL=ports.d.ts.map
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { type CommentsProviderDefinition } from './definitions.js';
|
|
2
|
+
import type { CommentsProviderAdapter, CommentsSelectionStorePort } from './ports.js';
|
|
3
|
+
export interface CommentsProviderBinding {
|
|
4
|
+
definition: CommentsProviderDefinition;
|
|
5
|
+
/** Resolves only this site's adapter; undefined explicitly means not ready. No executable metadata loading. */
|
|
6
|
+
resolve(required: {
|
|
7
|
+
siteId: string;
|
|
8
|
+
}, optional?: Record<string, never>): Promise<CommentsProviderAdapter | undefined>;
|
|
9
|
+
}
|
|
10
|
+
export interface CommentsProviderRegistry {
|
|
11
|
+
register(required: CommentsProviderBinding, optional?: Record<string, never>): void;
|
|
12
|
+
get(required: {
|
|
13
|
+
providerId: string;
|
|
14
|
+
}, optional?: Record<string, never>): CommentsProviderDefinition | undefined;
|
|
15
|
+
has(required: {
|
|
16
|
+
providerId: string;
|
|
17
|
+
}, optional?: Record<string, never>): boolean;
|
|
18
|
+
list(required: Record<string, never>, optional?: Record<string, never>): readonly CommentsProviderDefinition[];
|
|
19
|
+
resolve(required: {
|
|
20
|
+
siteId: string;
|
|
21
|
+
providerId: string;
|
|
22
|
+
}, optional?: Record<string, never>): Promise<CommentsProviderAdapter | undefined>;
|
|
23
|
+
active(required: {
|
|
24
|
+
siteId: string;
|
|
25
|
+
}, optional?: Record<string, never>): Promise<{
|
|
26
|
+
providerId: string | null;
|
|
27
|
+
revision: number;
|
|
28
|
+
adapter: CommentsProviderAdapter | undefined;
|
|
29
|
+
}>;
|
|
30
|
+
select(required: {
|
|
31
|
+
siteId: string;
|
|
32
|
+
providerId: string | null;
|
|
33
|
+
expectedRevision: number;
|
|
34
|
+
actorPrincipalId: string;
|
|
35
|
+
}, optional?: Record<string, never>): Promise<void>;
|
|
36
|
+
}
|
|
37
|
+
/** Definition registry plus site-scoped executable resolution; core bindings still own DI.
|
|
38
|
+
* Selection commits only after readiness, with storage CAS refusing stale confirmations.
|
|
39
|
+
* @complexity O(1) lookups; list is O(p) for p registered providers. */
|
|
40
|
+
export declare function createCommentsProviderRegistry({ selections }: {
|
|
41
|
+
selections: CommentsSelectionStorePort;
|
|
42
|
+
}, _options?: {}): CommentsProviderRegistry;
|
|
43
|
+
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { freezeCommentsDefinition } from './definitions.js';
|
|
2
|
+
/** Definition registry plus site-scoped executable resolution; core bindings still own DI.
|
|
3
|
+
* Selection commits only after readiness, with storage CAS refusing stale confirmations.
|
|
4
|
+
* @complexity O(1) lookups; list is O(p) for p registered providers. */
|
|
5
|
+
export function createCommentsProviderRegistry({ selections }, _options = {}) {
|
|
6
|
+
const providers = new Map();
|
|
7
|
+
const registry = {
|
|
8
|
+
register({ definition, resolve }, _optional = {}) {
|
|
9
|
+
const copy = freezeCommentsDefinition({ definition });
|
|
10
|
+
if (providers.has(copy.id))
|
|
11
|
+
throw new Error('Duplicate comments provider');
|
|
12
|
+
providers.set(copy.id, { definition: copy, resolve });
|
|
13
|
+
},
|
|
14
|
+
get: ({ providerId }, _optional = {}) => providers.get(providerId)?.definition,
|
|
15
|
+
has: ({ providerId }, _optional = {}) => providers.has(providerId),
|
|
16
|
+
list: (_required, _optional = {}) => Object.freeze([...providers.values()].map(binding => binding.definition)),
|
|
17
|
+
async resolve({ siteId, providerId }, _optional = {}) {
|
|
18
|
+
const binding = providers.get(providerId);
|
|
19
|
+
if (!binding || binding.definition.implementation !== 'adapter')
|
|
20
|
+
return undefined;
|
|
21
|
+
const adapter = await binding.resolve({ siteId });
|
|
22
|
+
if (adapter && adapter.kind !== binding.definition.kind)
|
|
23
|
+
throw new Error('Comments adapter kind mismatch');
|
|
24
|
+
return adapter;
|
|
25
|
+
},
|
|
26
|
+
async active({ siteId }, _optional = {}) {
|
|
27
|
+
const selection = await selections.read({ siteId });
|
|
28
|
+
const adapter = selection.providerId === null ? undefined : await registry.resolve({ siteId, providerId: selection.providerId });
|
|
29
|
+
return { ...selection, adapter };
|
|
30
|
+
},
|
|
31
|
+
async select(input, _optional = {}) {
|
|
32
|
+
if (input.providerId !== null && !await registry.resolve({ siteId: input.siteId, providerId: input.providerId }))
|
|
33
|
+
throw new Error('Comments provider is not ready');
|
|
34
|
+
if (!await selections.compareAndSet(input))
|
|
35
|
+
throw new Error('Comments selection changed; read the provider again');
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
return registry;
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=registry.js.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { CommentThreadRendererPort, CommentModerationPort, CommentSubmissionPort, CommentsSelectionStorePort } from './ports.js';
|
|
2
|
+
import type { CommentsProviderRegistry } from './registry.js';
|
|
3
|
+
export declare const CommentsProviderRegistryToken: import("@jini-ai/core").Token<CommentsProviderRegistry, string>;
|
|
4
|
+
export declare const CommentThreadRendererToken: import("@jini-ai/core").Token<CommentThreadRendererPort, string>;
|
|
5
|
+
export declare const CommentModerationToken: import("@jini-ai/core").Token<CommentModerationPort, string>;
|
|
6
|
+
export declare const CommentSubmissionToken: import("@jini-ai/core").Token<CommentSubmissionPort, string>;
|
|
7
|
+
export declare const CommentsSelectionStoreToken: import("@jini-ai/core").Token<CommentsSelectionStorePort, string>;
|
|
8
|
+
//# sourceMappingURL=tokens.d.ts.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { token } from '@jini-ai/core';
|
|
2
|
+
export const CommentsProviderRegistryToken = token({ id: 'jini.capabilityProviders.comments.registry' });
|
|
3
|
+
export const CommentThreadRendererToken = token({ id: 'jini.capabilityProviders.comments.renderer' });
|
|
4
|
+
export const CommentModerationToken = token({ id: 'jini.capabilityProviders.comments.moderation' });
|
|
5
|
+
export const CommentSubmissionToken = token({ id: 'jini.capabilityProviders.comments.submission' });
|
|
6
|
+
export const CommentsSelectionStoreToken = token({ id: 'jini.capabilityProviders.comments.selectionStore' });
|
|
7
|
+
//# sourceMappingURL=tokens.js.map
|
package/dist/db.d.ts
CHANGED
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* record id, not a query language). Speculative port-design exploration
|
|
4
|
-
* (see `archived provenance ledger`) — no OD source; the capability
|
|
5
|
-
* `ADS-memory/reports/jini-port/recon/r5b-consumers-matrix.md` §3.3 names as the one Zana
|
|
6
|
-
* (Supabase→db+auth+storage+realtime) and a fleet orchestrator (ports+sqlite/memory)
|
|
7
|
-
* both built explicitly.
|
|
2
|
+
* Swappable minimal document-store port: collections and record ids, not a query language. See index.ts for capability-provider ownership and adoption scope.
|
|
8
3
|
*
|
|
9
4
|
* This file defines the port's stable interface/type surface and nothing else —
|
|
10
5
|
* it has no imports at all, so a consumer implementing `DbProvider` themselves
|
package/dist/db.js
CHANGED
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* record id, not a query language). Speculative port-design exploration
|
|
4
|
-
* (see `archived provenance ledger`) — no OD source; the capability
|
|
5
|
-
* `ADS-memory/reports/jini-port/recon/r5b-consumers-matrix.md` §3.3 names as the one Zana
|
|
6
|
-
* (Supabase→db+auth+storage+realtime) and a fleet orchestrator (ports+sqlite/memory)
|
|
7
|
-
* both built explicitly.
|
|
2
|
+
* Swappable minimal document-store port: collections and record ids, not a query language. See index.ts for capability-provider ownership and adoption scope.
|
|
8
3
|
*
|
|
9
4
|
* This file defines the port's stable interface/type surface and nothing else —
|
|
10
5
|
* it has no imports at all, so a consumer implementing `DbProvider` themselves
|
package/dist/index.d.ts
CHANGED
|
@@ -1,70 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* ports
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* reference stubs that prove each port is genuinely implementable
|
|
11
|
-
* (`createInMemoryAuthProvider` and friends) live under
|
|
12
|
-
* `src/unsafe-reference/` and are exported only from the separate
|
|
13
|
-
* `@jini-ai/capability-providers/unsafe-reference` entry point — see that
|
|
14
|
-
* directory's `index.ts` header before importing anything from it.
|
|
15
|
-
|
|
16
|
-
* Archived provenance rationale:
|
|
17
|
-
* ## Why this exists (the gap it names)
|
|
18
|
-
*
|
|
19
|
-
* `ADS-memory/reports/jini-port/recon/r5b-consumers-matrix.md` §2 (the capability matrix) and
|
|
20
|
-
* §3.3 identify a **capability-provider registry with auth / storage /
|
|
21
|
-
* payments / db / realtime as Zana + a fleet orchestrator convergent** — both consumers
|
|
22
|
-
* independently built an explicit port+provider layer (Zana: `app-chassis`'s
|
|
23
|
-
* "rigid core, flexible edges" thesis, `packages/{core,ai,db,auth,storage,
|
|
24
|
-
* payments}` + `providers/supabase` declaring which capabilities it
|
|
25
|
-
* implements; the fleet orchestrator: "ports+sqlite/memory"), while Open Design itself
|
|
26
|
-
* only models these capabilities thinly. §3.3 states this "should be an engine
|
|
27
|
-
* primitive... so products swap Supabase/SQLite/Stripe without touching core"
|
|
28
|
-
* — that is the shape this package builds: 5 independent ports (not one
|
|
29
|
-
* umbrella "CapabilityProvider" interface — see "Design decisions" below) each
|
|
30
|
-
* with a typed DI token (`packages/core/src/token.ts`'s pattern) and a minimal
|
|
31
|
-
* in-memory reference implementation proving the port is genuinely
|
|
32
|
-
* implementable.
|
|
33
|
-
*
|
|
34
|
-
* ## Design decisions
|
|
35
|
-
*
|
|
36
|
-
* **Five separate port interfaces, not one `CapabilityProvider` union.** Zana's
|
|
37
|
-
* own model has a single adapter (Supabase) implementing multiple capabilities
|
|
38
|
-
* at once, which might suggest one umbrella interface with optional methods.
|
|
39
|
-
* Rejected: extraction-plan.md §2.2's core lesson (the reason typed tokens beat
|
|
40
|
-
* a structural dependency object in the first place) is that a union/bag
|
|
41
|
-
* interface is exactly the shape that decays into an OD-`ServerContext`-style
|
|
42
|
-
* god-object as capabilities accrete. Five independently bindable tokens means
|
|
43
|
-
* a consumer wiring only `DbProviderToken` + `StorageProviderToken` never sees
|
|
44
|
-
* `AuthProvider`/`PaymentsProvider`/`RealtimeProvider` in its type surface. A
|
|
45
|
-
* real adapter that happens to implement several (a future `SupabaseAdapter`)
|
|
46
|
-
* is free to be one class satisfying multiple interfaces and bound to multiple
|
|
47
|
-
* tokens — that composition happens at the binding site, not in this package.
|
|
48
|
-
*
|
|
49
|
-
* **No registry/discovery module.** The task brief's scope constraint says
|
|
50
|
-
* "abstract port/interface definitions... plus at minimum one trivial
|
|
51
|
-
* reference/stub implementation" and explicitly forbids wiring this into any
|
|
52
|
-
* other package. `@jini/core`'s existing typed-token + `bindings()` mechanism
|
|
53
|
-
* already *is* the registration/discovery layer (extraction-plan.md §2.2) —
|
|
54
|
-
* building a second, parallel registry inside this package would duplicate
|
|
55
|
-
* that machinery for no reason and blur the "zero other package depends on
|
|
56
|
-
* this" boundary the brief asked for. A consumer registers these tokens in its
|
|
57
|
-
* own `createDaemon({ bindings: bindings().bind(AuthProviderToken, ...) })`
|
|
58
|
-
* call; this package supplies only the tokens and the interfaces they carry.
|
|
59
|
-
*
|
|
60
|
-
* **In-memory reference stubs, not "the obvious real adapter."** The brief is
|
|
61
|
-
* explicit: interfaces + minimal stubs only, no full per-provider-type
|
|
62
|
-
* implementations (no real Stripe/Auth0/Supabase integration). Every stub here
|
|
63
|
-
* optimizes for proving the port's shape is satisfiable and unit-testable, not
|
|
64
|
-
* for production use — see each file's header comment for the specific corners
|
|
65
|
-
* cut (plaintext passwords, deterministic always-succeeding charges, no
|
|
66
|
-
* cross-process realtime fan-out, no query language beyond exact-match
|
|
67
|
-
* `where`).
|
|
2
|
+
* @jini-ai/capability-providers supplies independently bindable auth/storage/payment/db/realtime
|
|
3
|
+
* ports and tokens, with no current consumer commitment. Avoid an optional-method umbrella bag:
|
|
4
|
+
* a consumer should see only the capabilities it binds. One adapter can implement several ports
|
|
5
|
+
* and bind to several tokens at the composition site.
|
|
6
|
+
* @jini-ai/core's bindings already own registration; this package must not create a second registry.
|
|
7
|
+
* Concrete implementations are separate entries. unsafe-reference stubs prove the interfaces are
|
|
8
|
+
* implementable, with non-cryptographic/non-production behavior; never infer production guarantees
|
|
9
|
+
* from them. See that entry's index header for its specific limitations.
|
|
68
10
|
*/
|
|
69
11
|
export * from './auth.js';
|
|
70
12
|
export * from './storage.js';
|
package/dist/index.js
CHANGED
|
@@ -1,70 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* ports
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* reference stubs that prove each port is genuinely implementable
|
|
11
|
-
* (`createInMemoryAuthProvider` and friends) live under
|
|
12
|
-
* `src/unsafe-reference/` and are exported only from the separate
|
|
13
|
-
* `@jini-ai/capability-providers/unsafe-reference` entry point — see that
|
|
14
|
-
* directory's `index.ts` header before importing anything from it.
|
|
15
|
-
|
|
16
|
-
* Archived provenance rationale:
|
|
17
|
-
* ## Why this exists (the gap it names)
|
|
18
|
-
*
|
|
19
|
-
* `ADS-memory/reports/jini-port/recon/r5b-consumers-matrix.md` §2 (the capability matrix) and
|
|
20
|
-
* §3.3 identify a **capability-provider registry with auth / storage /
|
|
21
|
-
* payments / db / realtime as Zana + a fleet orchestrator convergent** — both consumers
|
|
22
|
-
* independently built an explicit port+provider layer (Zana: `app-chassis`'s
|
|
23
|
-
* "rigid core, flexible edges" thesis, `packages/{core,ai,db,auth,storage,
|
|
24
|
-
* payments}` + `providers/supabase` declaring which capabilities it
|
|
25
|
-
* implements; the fleet orchestrator: "ports+sqlite/memory"), while Open Design itself
|
|
26
|
-
* only models these capabilities thinly. §3.3 states this "should be an engine
|
|
27
|
-
* primitive... so products swap Supabase/SQLite/Stripe without touching core"
|
|
28
|
-
* — that is the shape this package builds: 5 independent ports (not one
|
|
29
|
-
* umbrella "CapabilityProvider" interface — see "Design decisions" below) each
|
|
30
|
-
* with a typed DI token (`packages/core/src/token.ts`'s pattern) and a minimal
|
|
31
|
-
* in-memory reference implementation proving the port is genuinely
|
|
32
|
-
* implementable.
|
|
33
|
-
*
|
|
34
|
-
* ## Design decisions
|
|
35
|
-
*
|
|
36
|
-
* **Five separate port interfaces, not one `CapabilityProvider` union.** Zana's
|
|
37
|
-
* own model has a single adapter (Supabase) implementing multiple capabilities
|
|
38
|
-
* at once, which might suggest one umbrella interface with optional methods.
|
|
39
|
-
* Rejected: extraction-plan.md §2.2's core lesson (the reason typed tokens beat
|
|
40
|
-
* a structural dependency object in the first place) is that a union/bag
|
|
41
|
-
* interface is exactly the shape that decays into an OD-`ServerContext`-style
|
|
42
|
-
* god-object as capabilities accrete. Five independently bindable tokens means
|
|
43
|
-
* a consumer wiring only `DbProviderToken` + `StorageProviderToken` never sees
|
|
44
|
-
* `AuthProvider`/`PaymentsProvider`/`RealtimeProvider` in its type surface. A
|
|
45
|
-
* real adapter that happens to implement several (a future `SupabaseAdapter`)
|
|
46
|
-
* is free to be one class satisfying multiple interfaces and bound to multiple
|
|
47
|
-
* tokens — that composition happens at the binding site, not in this package.
|
|
48
|
-
*
|
|
49
|
-
* **No registry/discovery module.** The task brief's scope constraint says
|
|
50
|
-
* "abstract port/interface definitions... plus at minimum one trivial
|
|
51
|
-
* reference/stub implementation" and explicitly forbids wiring this into any
|
|
52
|
-
* other package. `@jini/core`'s existing typed-token + `bindings()` mechanism
|
|
53
|
-
* already *is* the registration/discovery layer (extraction-plan.md §2.2) —
|
|
54
|
-
* building a second, parallel registry inside this package would duplicate
|
|
55
|
-
* that machinery for no reason and blur the "zero other package depends on
|
|
56
|
-
* this" boundary the brief asked for. A consumer registers these tokens in its
|
|
57
|
-
* own `createDaemon({ bindings: bindings().bind(AuthProviderToken, ...) })`
|
|
58
|
-
* call; this package supplies only the tokens and the interfaces they carry.
|
|
59
|
-
*
|
|
60
|
-
* **In-memory reference stubs, not "the obvious real adapter."** The brief is
|
|
61
|
-
* explicit: interfaces + minimal stubs only, no full per-provider-type
|
|
62
|
-
* implementations (no real Stripe/Auth0/Supabase integration). Every stub here
|
|
63
|
-
* optimizes for proving the port's shape is satisfiable and unit-testable, not
|
|
64
|
-
* for production use — see each file's header comment for the specific corners
|
|
65
|
-
* cut (plaintext passwords, deterministic always-succeeding charges, no
|
|
66
|
-
* cross-process realtime fan-out, no query language beyond exact-match
|
|
67
|
-
* `where`).
|
|
2
|
+
* @jini-ai/capability-providers supplies independently bindable auth/storage/payment/db/realtime
|
|
3
|
+
* ports and tokens, with no current consumer commitment. Avoid an optional-method umbrella bag:
|
|
4
|
+
* a consumer should see only the capabilities it binds. One adapter can implement several ports
|
|
5
|
+
* and bind to several tokens at the composition site.
|
|
6
|
+
* @jini-ai/core's bindings already own registration; this package must not create a second registry.
|
|
7
|
+
* Concrete implementations are separate entries. unsafe-reference stubs prove the interfaces are
|
|
8
|
+
* implementable, with non-cryptographic/non-production behavior; never infer production guarantees
|
|
9
|
+
* from them. See that entry's index header for its specific limitations.
|
|
68
10
|
*/
|
|
69
11
|
export * from './auth.js';
|
|
70
12
|
export * from './storage.js';
|
package/dist/payments.d.ts
CHANGED
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* port-design exploration (see `archived provenance ledger`) — no OD source; named
|
|
4
|
-
* explicitly in `ADS-memory/reports/jini-port/recon/r5b-consumers-matrix.md` §3.3 as one
|
|
5
|
-
* of the capabilities Zana's and a fleet orchestrator's independent provider
|
|
6
|
-
* layers converge on (alongside auth/storage/db/realtime).
|
|
2
|
+
* Swappable payment-charge port. See index.ts for capability-provider ownership and adoption scope.
|
|
7
3
|
*
|
|
8
4
|
* This file defines the port's stable interface/type surface and nothing else —
|
|
9
5
|
* it has no imports at all, so a consumer implementing `PaymentsProvider`
|
package/dist/payments.js
CHANGED
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* port-design exploration (see `archived provenance ledger`) — no OD source; named
|
|
4
|
-
* explicitly in `ADS-memory/reports/jini-port/recon/r5b-consumers-matrix.md` §3.3 as one
|
|
5
|
-
* of the capabilities Zana's and a fleet orchestrator's independent provider
|
|
6
|
-
* layers converge on (alongside auth/storage/db/realtime).
|
|
2
|
+
* Swappable payment-charge port. See index.ts for capability-provider ownership and adoption scope.
|
|
7
3
|
*
|
|
8
4
|
* This file defines the port's stable interface/type surface and nothing else —
|
|
9
5
|
* it has no imports at all, so a consumer implementing `PaymentsProvider`
|
package/dist/realtime.d.ts
CHANGED
|
@@ -1,15 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* subscribers). Speculative port-design exploration (see `archived provenance ledger`) —
|
|
4
|
-
* no OD source; named in `ADS-memory/reports/jini-port/recon/r5b-consumers-matrix.md` §3.3
|
|
5
|
-
* as part of the capability set Zana and a fleet orchestrator converge on
|
|
6
|
-
* (Supabase Realtime is Zana's reference adapter).
|
|
2
|
+
* Swappable pub/sub port for live updates. See index.ts for capability-provider ownership and adoption scope.
|
|
7
3
|
*
|
|
8
4
|
* This file defines only the port's stable interface/type surface. The one
|
|
9
5
|
* real, production-quality adapter (`WebSocketRealtimeProvider` +
|
|
10
6
|
* `createWebSocketRealtimeProvider`, using the `ws` package) lives at the
|
|
11
|
-
* separate `@jini-ai/capability-providers/adapters/ws` entry point
|
|
12
|
-
* there (2026-07-29) so this package's main barrel, which imports this
|
|
7
|
+
* separate `@jini-ai/capability-providers/adapters/ws` entry point so the main barrel, which imports this
|
|
13
8
|
* module, is never forced to resolve `ws` just for the port type. The
|
|
14
9
|
* in-memory reference implementation (`createInMemoryRealtimeProvider`) is a
|
|
15
10
|
* separate, non-production stub that lives under `src/unsafe-reference/`,
|
package/dist/realtime.js
CHANGED
|
@@ -1,15 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* subscribers). Speculative port-design exploration (see `archived provenance ledger`) —
|
|
4
|
-
* no OD source; named in `ADS-memory/reports/jini-port/recon/r5b-consumers-matrix.md` §3.3
|
|
5
|
-
* as part of the capability set Zana and a fleet orchestrator converge on
|
|
6
|
-
* (Supabase Realtime is Zana's reference adapter).
|
|
2
|
+
* Swappable pub/sub port for live updates. See index.ts for capability-provider ownership and adoption scope.
|
|
7
3
|
*
|
|
8
4
|
* This file defines only the port's stable interface/type surface. The one
|
|
9
5
|
* real, production-quality adapter (`WebSocketRealtimeProvider` +
|
|
10
6
|
* `createWebSocketRealtimeProvider`, using the `ws` package) lives at the
|
|
11
|
-
* separate `@jini-ai/capability-providers/adapters/ws` entry point
|
|
12
|
-
* there (2026-07-29) so this package's main barrel, which imports this
|
|
7
|
+
* separate `@jini-ai/capability-providers/adapters/ws` entry point so the main barrel, which imports this
|
|
13
8
|
* module, is never forced to resolve `ws` just for the port type. The
|
|
14
9
|
* in-memory reference implementation (`createInMemoryRealtimeProvider`) is a
|
|
15
10
|
* separate, non-production stub that lives under `src/unsafe-reference/`,
|
package/dist/storage.d.ts
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* assets). Speculative port-design exploration (see `archived provenance ledger`) — no OD
|
|
4
|
-
* source; the shape is the object-storage capability Zana's `app-chassis`
|
|
5
|
-
* (`packages/storage`) and a fleet orchestrator's ports layer both name explicitly.
|
|
2
|
+
* Swappable blob-storage port for uploads and generated assets. See index.ts for capability-provider ownership and adoption scope.
|
|
6
3
|
*
|
|
7
4
|
* This file defines the port's stable interface/type surface and nothing else —
|
|
8
5
|
* it has no imports at all, so a consumer implementing `StorageProvider`
|
|
@@ -12,6 +9,10 @@
|
|
|
12
9
|
* entry point; the non-production in-memory reference stub
|
|
13
10
|
* (`createInMemoryStorageProvider`) lives under `src/unsafe-reference/`,
|
|
14
11
|
* exported only from `@jini-ai/capability-providers/unsafe-reference`.
|
|
12
|
+
*
|
|
13
|
+
* Superseded (2026-10-21) by the one object-storage contract, `@jini-ai/core/object-store`
|
|
14
|
+
* (`ObjectStore`, keyed providers, default `local`). Kept until a consumer moves; new code
|
|
15
|
+
* implements `ObjectStore` instead of adding to this port.
|
|
15
16
|
*/
|
|
16
17
|
export interface StorageObjectMeta {
|
|
17
18
|
readonly key: string;
|
package/dist/storage.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* assets). Speculative port-design exploration (see `archived provenance ledger`) — no OD
|
|
4
|
-
* source; the shape is the object-storage capability Zana's `app-chassis`
|
|
5
|
-
* (`packages/storage`) and a fleet orchestrator's ports layer both name explicitly.
|
|
2
|
+
* Swappable blob-storage port for uploads and generated assets. See index.ts for capability-provider ownership and adoption scope.
|
|
6
3
|
*
|
|
7
4
|
* This file defines the port's stable interface/type surface and nothing else —
|
|
8
5
|
* it has no imports at all, so a consumer implementing `StorageProvider`
|
|
@@ -12,6 +9,10 @@
|
|
|
12
9
|
* entry point; the non-production in-memory reference stub
|
|
13
10
|
* (`createInMemoryStorageProvider`) lives under `src/unsafe-reference/`,
|
|
14
11
|
* exported only from `@jini-ai/capability-providers/unsafe-reference`.
|
|
12
|
+
*
|
|
13
|
+
* Superseded (2026-10-21) by the one object-storage contract, `@jini-ai/core/object-store`
|
|
14
|
+
* (`ObjectStore`, keyed providers, default `local`). Kept until a consumer moves; new code
|
|
15
|
+
* implements `ObjectStore` instead of adding to this port.
|
|
15
16
|
*/
|
|
16
17
|
export {};
|
|
17
18
|
//# sourceMappingURL=storage.js.map
|
package/dist/tokens.js
CHANGED
|
@@ -1,14 +1,5 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
* pattern `@jini-ai/core`'s `token()` establishes (see
|
|
4
|
-
* `packages/core/src/token.ts`) and the naming convention `@jini-ai/daemon`'s
|
|
5
|
-
* `src/tokens.ts` / `@jini-ai/media`'s `src/tokens.ts` already set
|
|
6
|
-
* (bare-interface-name-suffixed-`Token`).
|
|
7
|
-
*
|
|
8
|
-
* These tokens are exported for a future consumer to `bind()` in its own
|
|
9
|
-
* composition — this package itself does not bind them anywhere, and
|
|
10
|
-
* nothing else in this repo imports this package (see `archived provenance ledger`).
|
|
11
|
-
*/
|
|
1
|
+
/** Typed capability-provider DI tokens built with core's token() owner. Names use the
|
|
2
|
+
* bare-interface-name + Token convention. Hosts bind each port in their own composition. */
|
|
12
3
|
import { token } from '@jini-ai/core';
|
|
13
4
|
export const AuthProviderToken = token({ id: 'jini.capabilityProviders.auth' });
|
|
14
5
|
export const StorageProviderToken = token({ id: 'jini.capabilityProviders.storage' });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jini-ai/capability-providers",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.2",
|
|
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": {
|
|
@@ -20,7 +20,17 @@
|
|
|
20
20
|
"./adapters/sqlite": "node",
|
|
21
21
|
"./adapters/blob-storage": "node",
|
|
22
22
|
"./adapters/jwt-auth": "node",
|
|
23
|
-
"./adapters/stripe": "universal"
|
|
23
|
+
"./adapters/stripe": "universal",
|
|
24
|
+
"./comments": "universal"
|
|
25
|
+
},
|
|
26
|
+
"isolation": {
|
|
27
|
+
"entries": {
|
|
28
|
+
"./adapters/ws": "realtime",
|
|
29
|
+
"./adapters/sqlite": "db",
|
|
30
|
+
"./adapters/blob-storage": "storage",
|
|
31
|
+
"./adapters/jwt-auth": "auth",
|
|
32
|
+
"./adapters/stripe": "payments"
|
|
33
|
+
}
|
|
24
34
|
}
|
|
25
35
|
},
|
|
26
36
|
"type": "module",
|
|
@@ -67,6 +77,11 @@
|
|
|
67
77
|
"types": "./dist/adapters/stripe/index.d.ts",
|
|
68
78
|
"import": "./dist/adapters/stripe/index.js",
|
|
69
79
|
"default": "./dist/adapters/stripe/index.js"
|
|
80
|
+
},
|
|
81
|
+
"./comments": {
|
|
82
|
+
"types": "./dist/comments/index.d.ts",
|
|
83
|
+
"import": "./dist/comments/index.js",
|
|
84
|
+
"default": "./dist/comments/index.js"
|
|
70
85
|
}
|
|
71
86
|
},
|
|
72
87
|
"files": [
|
|
@@ -86,12 +101,12 @@
|
|
|
86
101
|
"registry": "https://registry.npmjs.org"
|
|
87
102
|
},
|
|
88
103
|
"dependencies": {
|
|
89
|
-
"@jini-ai/core": "0.4.
|
|
90
|
-
"@jini-ai/platform": "0.5.0"
|
|
104
|
+
"@jini-ai/core": "^0.4.9"
|
|
91
105
|
},
|
|
92
106
|
"peerDependencies": {
|
|
93
107
|
"better-sqlite3": "^13.0.0",
|
|
94
|
-
"ws": "^8.18.0"
|
|
108
|
+
"ws": "^8.18.0",
|
|
109
|
+
"@jini-ai/platform": "^0.5.1"
|
|
95
110
|
},
|
|
96
111
|
"peerDependenciesMeta": {
|
|
97
112
|
"better-sqlite3": {
|
|
@@ -99,6 +114,9 @@
|
|
|
99
114
|
},
|
|
100
115
|
"ws": {
|
|
101
116
|
"optional": true
|
|
117
|
+
},
|
|
118
|
+
"@jini-ai/platform": {
|
|
119
|
+
"optional": true
|
|
102
120
|
}
|
|
103
121
|
},
|
|
104
122
|
"devDependencies": {
|
|
@@ -106,7 +124,9 @@
|
|
|
106
124
|
"@types/ws": "^8.18.0",
|
|
107
125
|
"@vitest/coverage-v8": "^2.1.9",
|
|
108
126
|
"better-sqlite3": "^13.0.0",
|
|
109
|
-
"ws": "^8.18.0"
|
|
127
|
+
"ws": "^8.18.0",
|
|
128
|
+
"@jini-ai/core": "0.4.9",
|
|
129
|
+
"@jini-ai/platform": "0.5.10"
|
|
110
130
|
},
|
|
111
131
|
"scripts": {
|
|
112
132
|
"build": "tsc -p tsconfig.json",
|