@jini-ai/capability-providers 0.4.1 → 0.6.10

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
@@ -1,5 +1,27 @@
1
1
  # @jini-ai/capability-providers
2
2
 
3
+ ## 0.6.10
4
+
5
+ ### Patch Changes
6
+
7
+ - e1b5b52: Add the universal `@jini-ai/capability-providers/visitor-auth` subpath for public-site
8
+ visitor/social login. It exposes provider-neutral Google, Facebook, and LinkedIn configuration
9
+ metadata, an extensible definition registry, typed host ports, and pure OAuth/OIDC state, nonce,
10
+ and PKCE lifecycle decisions.
11
+
12
+ The subpath deliberately ships no provider SDK or working provider adapter. Client secrets remain
13
+ opaque host-owned references, transaction persistence must be tenant-scoped and one-time, and
14
+ identity/session creation stays in the consuming application's authorization boundary.
15
+
16
+ - Updated dependencies [22f0619]
17
+ - Updated dependencies [82ed2d3]
18
+ - Updated dependencies [5a3de86]
19
+ - @jini-ai/core@0.6.10
20
+
21
+ ## 0.4.2 — 2026-10-22
22
+
23
+ - 2026-10-22: Comments provider registry and ports; storage contracts marked as views of ObjectStore.
24
+
3
25
  ## 0.4.1
4
26
 
5
27
  ### Patch Changes
@@ -31,7 +53,6 @@
31
53
  - Make Stripe Basic auth work without Node Buffer and inject its fallback timestamp clock.
32
54
  Strengthen package-wide production-source neutrality checks. Verification deferred by owner directive.
33
55
 
34
-
35
56
  - **BREAKING:** Convert the clean existing public APIs and provider methods to required argument objects plus separate optional settings. Inject transport, time, identity and filesystem dependencies through ports. No compatibility wrappers or version bump. Conversion of pre-existing dirty source files and their coupled APIs is deferred; see API-CONVERSION.md.
36
57
 
37
58
  ## 0.1.2
@@ -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,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.js.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,2 @@
1
+ export {};
2
+ //# sourceMappingURL=ports.js.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/storage.d.ts CHANGED
@@ -9,6 +9,10 @@
9
9
  * entry point; the non-production in-memory reference stub
10
10
  * (`createInMemoryStorageProvider`) lives under `src/unsafe-reference/`,
11
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.
12
16
  */
13
17
  export interface StorageObjectMeta {
14
18
  readonly key: string;
package/dist/storage.js CHANGED
@@ -9,6 +9,10 @@
9
9
  * entry point; the non-production in-memory reference stub
10
10
  * (`createInMemoryStorageProvider`) lives under `src/unsafe-reference/`,
11
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.
12
16
  */
13
17
  export {};
14
18
  //# sourceMappingURL=storage.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jini-ai/capability-providers",
3
- "version": "0.4.1",
3
+ "version": "0.6.10",
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,8 @@
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"
24
25
  },
25
26
  "isolation": {
26
27
  "entries": {
@@ -76,6 +77,11 @@
76
77
  "types": "./dist/adapters/stripe/index.d.ts",
77
78
  "import": "./dist/adapters/stripe/index.js",
78
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"
79
85
  }
80
86
  },
81
87
  "files": [
@@ -95,12 +101,12 @@
95
101
  "registry": "https://registry.npmjs.org"
96
102
  },
97
103
  "dependencies": {
98
- "@jini-ai/core": "^0.4.2"
104
+ "@jini-ai/core": "^0.6.10"
99
105
  },
100
106
  "peerDependencies": {
101
107
  "better-sqlite3": "^13.0.0",
102
108
  "ws": "^8.18.0",
103
- "@jini-ai/platform": "^0.5.1"
109
+ "@jini-ai/platform": "^0.6.10"
104
110
  },
105
111
  "peerDependenciesMeta": {
106
112
  "better-sqlite3": {
@@ -119,8 +125,8 @@
119
125
  "@vitest/coverage-v8": "^2.1.9",
120
126
  "better-sqlite3": "^13.0.0",
121
127
  "ws": "^8.18.0",
122
- "@jini-ai/core": "0.4.2",
123
- "@jini-ai/platform": "0.5.2"
128
+ "@jini-ai/core": "0.6.10",
129
+ "@jini-ai/platform": "0.6.10"
124
130
  },
125
131
  "scripts": {
126
132
  "build": "tsc -p tsconfig.json",