@jini-ai/plugins 0.5.0 → 0.5.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.
Files changed (35) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/glue/capability-gate.js +1 -1
  3. package/dist/host/browser-providers.d.ts +2 -9
  4. package/dist/host/browser-providers.js +34 -18
  5. package/dist/host/capability-sdk.js +1 -1
  6. package/dist/host/claim-conflicts.d.ts +4 -4
  7. package/dist/host/claim-conflicts.js +4 -4
  8. package/dist/host/contributions.d.ts +4 -1
  9. package/dist/host/contributions.js +19 -8
  10. package/dist/host/discovery-types.d.ts +2 -2
  11. package/dist/host/hook-registry.js +7 -5
  12. package/dist/host/index.d.ts +1 -0
  13. package/dist/host/index.js +1 -0
  14. package/dist/host/manifest-types.d.ts +103 -0
  15. package/dist/host/manifest-types.js +2 -0
  16. package/dist/host/manifest.d.ts +5 -97
  17. package/dist/host/manifest.js +33 -24
  18. package/dist/host/node/discovery.js +27 -22
  19. package/dist/host/node/install.js +257 -192
  20. package/dist/host/node/loader.js +85 -67
  21. package/dist/host/node/module-snapshot.js +3 -2
  22. package/dist/host/node/open-flags.d.ts +18 -0
  23. package/dist/host/node/open-flags.js +14 -0
  24. package/dist/host/node/package-files.js +18 -12
  25. package/dist/host/node/source-drafts.d.ts +2 -0
  26. package/dist/host/node/source-drafts.js +93 -59
  27. package/dist/host/plugin-claims.js +6 -4
  28. package/dist/host/plugin-format.d.ts +14 -0
  29. package/dist/host/plugin-format.js +21 -0
  30. package/dist/host/ports.d.ts +4 -4
  31. package/dist/host/tool-contributions.js +3 -1
  32. package/dist/host/worker/protocol.js +8 -6
  33. package/dist/host/worker/run-call.d.ts +1 -1
  34. package/dist/host/worker/run-call.js +20 -17
  35. package/package.json +5 -5
package/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # @jini-ai/plugins
2
2
 
3
+ ## 0.5.2 — 2026-10-22
4
+
5
+ - 2026-10-22: Optional declared effect on plugin tool contributions, security fixes, complexity refactors, coverage.
6
+
7
+ ## 0.5.1 — 2026-10-13
8
+
9
+ - The plugin manifest is `jini.plugin.json` and the plugin SDK specifier is `@jini-ai/plugin-sdk`. `tovu.plugin.json` and `@tovu/sdk` are still read as legacy aliases (the new name wins when both exist); installs and drafts write only the new name. `./host` exports `PLUGIN_MANIFEST_FILENAME`, `PLUGIN_MANIFEST_FILENAMES`, `LEGACY_PLUGIN_MANIFEST_FILENAME`, `PLUGIN_SDK_SPECIFIER`, `PLUGIN_SDK_SPECIFIERS`, `LEGACY_PLUGIN_SDK_SPECIFIER` and `canonicalizePluginManifest`.
10
+ - **BREAKING (type and behavior):** `ManifestHostPorts.identityNamespace` is required. The `"tovu"` fallback is gone; hosts that omitted it must pass `identityNamespace: "tovu"` to keep reading publisher ids from `extensions.tovu`.
11
+ - `PluginSourceDeps.localInstallDisabledMessage` (optional) sets the hosted local-install refusal text. Without it the refusal reads "Local plugin install is disabled by the host."
12
+
3
13
  ## 0.5.0 — 2026-10-13
4
14
 
5
15
  - Admit reviewed digest-pinned compiled-in chart browser providers only, retain immutable asset bytes, and initialize bundled site plugins only when activation rows are absent.
@@ -22,7 +22,7 @@ export class GlueCapabilityDeniedError extends Error {
22
22
  * `capabilities` array's length.
23
23
  * @overallScore 100/100
24
24
  */
25
- // The caller supplies the vocabulary; the preserved CIC rationale describes Tovu's eight-slot host.
25
+ // The caller supplies the vocabulary; the preserved CIC rationale describes the original eight-slot host.
26
26
  // Capability-specific arguments remain owned by the supplied attachment-point delegates.
27
27
  export function buildGlueCapabilityGate(required, _optional = {}) {
28
28
  // Defensive copy: a caller-side mutation of the `capabilities` array after this call must never
@@ -1,13 +1,6 @@
1
1
  /** Bundled chart declarations only. ADR-025 trust comes from composition, never the manifest. */
2
- import type { PluginValidationError } from './manifest.js';
3
- export interface BrowserProviderDeclaration {
4
- readonly id: string;
5
- readonly kind: 'chart';
6
- readonly contractVersion: 1;
7
- readonly kinds: readonly string[];
8
- readonly javascript: string;
9
- readonly stylesheet?: string;
10
- }
2
+ import type { BrowserProviderDeclaration, PluginValidationError } from './manifest-types.js';
3
+ export type { BrowserProviderDeclaration } from './manifest-types.js';
11
4
  export interface BrowserProviderAsset {
12
5
  readonly path: string;
13
6
  readonly digest: string;
@@ -1,7 +1,38 @@
1
+ import { isNonArrayRecord } from '@jini-ai/core/records';
1
2
  /** Portable package-relative paths. Refuse dot segments, URL syntax and alternate separators. */
2
3
  export function isPluginRelativePath({ path }, _options = {}) {
3
4
  return path.length > 0 && !/[\\:\u0000-\u001f]/.test(path) && path.split('/').every((segment) => segment.length > 0 && segment !== '.' && segment !== '..');
4
5
  }
6
+ function validChartKinds({ kinds }, _options = {}) {
7
+ return Array.isArray(kinds) && kinds.length > 0
8
+ && !kinds.some((kind) => typeof kind !== 'string' || kind.trim() === '')
9
+ && new Set(kinds).size === kinds.length;
10
+ }
11
+ function validateBrowserProviderDeclaration({ provider, ids }, _options = {}) {
12
+ const errors = [];
13
+ if (Object.keys(provider).some((key) => !['id', 'kind', 'contractVersion', 'kinds', 'javascript', 'stylesheet'].includes(key)))
14
+ errors.push('Unknown browser provider field.');
15
+ if (typeof provider.id !== 'string' || !/^[a-z0-9][a-z0-9.-]*$/.test(provider.id) || ids.has(provider.id))
16
+ errors.push('Browser provider id must be unique and non-empty.');
17
+ if (typeof provider.id === 'string')
18
+ ids.add(provider.id);
19
+ if (provider.kind !== 'chart' || provider.contractVersion !== 1)
20
+ errors.push('Only chart contractVersion 1 is supported.');
21
+ if (!validChartKinds({ kinds: provider.kinds }))
22
+ errors.push('Chart kinds must be unique non-empty strings.');
23
+ return errors;
24
+ }
25
+ function validateBrowserProviderAssets({ provider, integrity }, _options = {}) {
26
+ const errors = [];
27
+ for (const [key, suffix] of [['javascript', /\.(?:m?js)$/], ['stylesheet', /\.css$/]]) {
28
+ const file = provider[key];
29
+ if (key === 'stylesheet' && file === undefined)
30
+ continue;
31
+ if (typeof file !== 'string' || !isPluginRelativePath({ path: file }) || !file.startsWith('client/') || !suffix.test(file) || !/^sha256-[0-9a-f]{64}$/.test(String(integrity[file])))
32
+ errors.push(`Browser provider ${key} must name a digest-covered client asset.`);
33
+ }
34
+ return errors;
35
+ }
5
36
  /** Collect static declaration errors; admission additionally requires compiled-in host pins.
6
37
  * @example validateBrowserProviders({ browserProviders, integrity })
7
38
  */
@@ -16,28 +47,13 @@ export function validateBrowserProviders({ browserProviders, integrity }, _optio
16
47
  }
17
48
  const ids = new Set();
18
49
  for (const value of browserProviders) {
19
- if (typeof value !== 'object' || value === null || Array.isArray(value)) {
50
+ if (!isNonArrayRecord({ value })) {
20
51
  invalid('Browser provider must be an object.');
21
52
  continue;
22
53
  }
23
54
  const provider = value;
24
- if (Object.keys(provider).some((key) => !['id', 'kind', 'contractVersion', 'kinds', 'javascript', 'stylesheet'].includes(key)))
25
- invalid('Unknown browser provider field.');
26
- if (typeof provider.id !== 'string' || !/^[a-z0-9][a-z0-9.-]*$/.test(provider.id) || ids.has(provider.id))
27
- invalid('Browser provider id must be unique and non-empty.');
28
- if (typeof provider.id === 'string')
29
- ids.add(provider.id);
30
- if (provider.kind !== 'chart' || provider.contractVersion !== 1)
31
- invalid('Only chart contractVersion 1 is supported.');
32
- if (!Array.isArray(provider.kinds) || provider.kinds.length === 0 || provider.kinds.some((kind) => typeof kind !== 'string' || kind.trim() === '') || new Set(provider.kinds).size !== provider.kinds.length)
33
- invalid('Chart kinds must be unique non-empty strings.');
34
- for (const [key, suffix] of [['javascript', /\.(?:m?js)$/], ['stylesheet', /\.css$/]]) {
35
- const file = provider[key];
36
- if (key === 'stylesheet' && file === undefined)
37
- continue;
38
- if (typeof file !== 'string' || !isPluginRelativePath({ path: file }) || !file.startsWith('client/') || !suffix.test(file) || !/^sha256-[0-9a-f]{64}$/.test(String(integrity[file])))
39
- invalid(`Browser provider ${key} must name a digest-covered client asset.`);
40
- }
55
+ validateBrowserProviderDeclaration({ provider, ids }).forEach(invalid);
56
+ validateBrowserProviderAssets({ provider, integrity }).forEach(invalid);
41
57
  }
42
58
  return errors;
43
59
  }
@@ -59,7 +59,7 @@ export function buildCapabilityScopedSdk(required, _optional = {}) {
59
59
  throw new Error('plugin widgets are not bound by this host');
60
60
  coreDeps.contributions.widgets.add(input, options);
61
61
  }) },
62
- // V1 rationale retained: `ActionHookName`/`ContributionHookName` (@tovu/sdk hooks.ts) have no
62
+ // V1 rationale retained: `ActionHookName`/`ContributionHookName` (@jini-ai/plugin-sdk hooks.ts) have no
63
63
  // catalog members yet (hooks v2 plan §3.3 Waves 1/2 land in a later slice), so no name
64
64
  // type-checks as an argument to either legacy surface. They remain present-but-unreachable,
65
65
  // following the same "always present" contract as addFilter, gated on hooks.attach. There
@@ -3,16 +3,16 @@
3
3
  * named thing (a route, a tool name, a table, a setting id, a widget id, a permission id, an
4
4
  * exclusive hook).
5
5
  *
6
- * JINI CANDIDATE: nothing in this file knows about Tovu, its manifest, its plugins or its storage —
6
+ * JINI CANDIDATE: nothing in this file knows about the host, its manifest, its plugins or its storage —
7
7
  * it takes owners and their claims as plain data and returns who keeps what. It belongs in
8
8
  * `@jini-ai/plugins` (or `@jini-ai/core`) beside the glue capability gates. Not moved yet because
9
- * Tovu's deploy build resolves `@jini-ai/*` from the published registry, so a Jini-side copy would be
9
+ * the host's deploy build resolves `@jini-ai/*` from the published registry, so a Jini-side copy would be
10
10
  * unreachable from production until the owner publishes; moving it is a file move plus one import.
11
11
  *
12
12
  * ## The rules (also in `ADS-memory/specs/005-plugin-system/conflicts.spec.md`)
13
13
  *
14
14
  * 1. Owners are processed in PRECEDENCE order — the caller's order, first wins. Core goes first;
15
- * after that the caller decides (Tovu: earliest-enabled first, so the NEWER plugin is the one
15
+ * after that the caller decides (the host uses earliest-enabled first, so the NEWER plugin is the one
16
16
  * refused — the plugin that was already working keeps working).
17
17
  * 2. A claim is `exclusive` (only one owner may hold it) or `shared` (any number of owners may hold
18
18
  * it together — a filter pipeline hook where every filter runs in a fixed order is the example).
@@ -87,7 +87,7 @@ export declare function normalizeIdentifier({ key }: {
87
87
  export declare function normalizeRoute({ key }: {
88
88
  key: string;
89
89
  }, _optional?: Record<string, never>): readonly string[];
90
- /** The kinds Tovu (and most hosts) need. A host adds or overrides kinds by spreading this. */
90
+ /** The kinds most hosts need. A host adds or overrides kinds by spreading this. */
91
91
  export declare const DEFAULT_CLAIM_KIND_RULES: Readonly<Record<string, ClaimKindRule>>;
92
92
  /**
93
93
  * Decides, owner by owner in precedence order, who keeps their claims (see this file's header for
@@ -3,16 +3,16 @@
3
3
  * named thing (a route, a tool name, a table, a setting id, a widget id, a permission id, an
4
4
  * exclusive hook).
5
5
  *
6
- * JINI CANDIDATE: nothing in this file knows about Tovu, its manifest, its plugins or its storage —
6
+ * JINI CANDIDATE: nothing in this file knows about the host, its manifest, its plugins or its storage —
7
7
  * it takes owners and their claims as plain data and returns who keeps what. It belongs in
8
8
  * `@jini-ai/plugins` (or `@jini-ai/core`) beside the glue capability gates. Not moved yet because
9
- * Tovu's deploy build resolves `@jini-ai/*` from the published registry, so a Jini-side copy would be
9
+ * the host's deploy build resolves `@jini-ai/*` from the published registry, so a Jini-side copy would be
10
10
  * unreachable from production until the owner publishes; moving it is a file move plus one import.
11
11
  *
12
12
  * ## The rules (also in `ADS-memory/specs/005-plugin-system/conflicts.spec.md`)
13
13
  *
14
14
  * 1. Owners are processed in PRECEDENCE order — the caller's order, first wins. Core goes first;
15
- * after that the caller decides (Tovu: earliest-enabled first, so the NEWER plugin is the one
15
+ * after that the caller decides (the host uses earliest-enabled first, so the NEWER plugin is the one
16
16
  * refused — the plugin that was already working keeps working).
17
17
  * 2. A claim is `exclusive` (only one owner may hold it) or `shared` (any number of owners may hold
18
18
  * it together — a filter pipeline hook where every filter runs in a fixed order is the example).
@@ -62,7 +62,7 @@ export function normalizeRoute({ key }, _optional = {}) {
62
62
  const methods = method === "*" || method === "ANY" ? HTTP_METHODS : [method];
63
63
  return methods.map((each) => `${each} ${path}`);
64
64
  }
65
- /** The kinds Tovu (and most hosts) need. A host adds or overrides kinds by spreading this. */
65
+ /** The kinds most hosts need. A host adds or overrides kinds by spreading this. */
66
66
  export const DEFAULT_CLAIM_KIND_RULES = {
67
67
  route: { normalize: (key) => normalizeRoute({ key }) },
68
68
  };
@@ -1,4 +1,4 @@
1
- import type { PluginManifest } from './manifest.js';
1
+ import type { PluginManifest } from './manifest-types.js';
2
2
  import type { PluginSdk } from './ports.js';
3
3
  export declare const PLUGIN_CONTRIBUTION_CAPABILITIES: readonly ["http.route.register", "tools.register", "render.contribute"];
4
4
  export type PluginRouteAccess = 'public' | 'member' | 'admin';
@@ -28,10 +28,13 @@ export interface PluginRouteContribution {
28
28
  readonly access: PluginRouteAccess;
29
29
  readonly handler: (required: PluginRouteInput, optional?: Record<string, never>) => PluginRouteResult | void | Promise<PluginRouteResult | void>;
30
30
  }
31
+ /** Declared change class. Only ever tightens host policy: `destructive` forces confirmation. */
32
+ export type PluginToolEffect = 'read' | 'write' | 'destructive';
31
33
  export interface PluginToolContribution {
32
34
  readonly name: string;
33
35
  readonly description: string;
34
36
  readonly inputSchema: Readonly<Record<string, unknown>>;
37
+ readonly effect?: PluginToolEffect;
35
38
  readonly handler: (required: PluginInvocationContext & {
36
39
  readonly input: unknown;
37
40
  }, optional?: Record<string, never>) => unknown | Promise<unknown>;
@@ -16,6 +16,21 @@ export function validatePluginRoute(required, _optional = {}) {
16
16
  if (!/^\/(?:[a-zA-Z0-9_-]+|:[a-zA-Z][a-zA-Z0-9_]*)(?:\/(?:[a-zA-Z0-9_-]+|:[a-zA-Z][a-zA-Z0-9_]*))*\/?$/.test(required.path) && required.path !== '/')
17
17
  throw new Error('unsafe plugin route path');
18
18
  }
19
+ /** Enforces the object-schema contract before and after plugin-controlled JSON serialization.
20
+ * Throws a fixed admission error. O(1) time/space. */
21
+ function requireObjectSchema({ schema }, _options = {}) {
22
+ if (!schema || typeof schema !== 'object' || Array.isArray(schema) || !('type' in schema) || schema.type !== 'object')
23
+ throw new Error('plugin tool input schema must describe an object');
24
+ return schema;
25
+ }
26
+ function serializePluginToolSchema({ schema }, _optional = {}) {
27
+ requireObjectSchema({ schema });
28
+ // Detach the JSON schema so later plugin mutations cannot alter the assistant contract.
29
+ const json = JSON.stringify(schema);
30
+ if (new TextEncoder().encode(json).byteLength > 65536)
31
+ throw new Error('plugin tool schema is too large');
32
+ return json;
33
+ }
19
34
  /** Bounded registration and detached snapshots; all runtime surfaces require a manifest claim.
20
35
  * SDK capability checks remain in buildCapabilityScopedSdk; this owner checks declarations too. */
21
36
  export function createPluginContributionCapture(required, optional = {}) {
@@ -60,14 +75,10 @@ export function createPluginContributionCapture(required, optional = {}) {
60
75
  throw new Error('duplicate plugin tool');
61
76
  if (typeof value.handler !== 'function' || typeof value.description !== 'string' || !value.description.trim() || value.description.length > 8000)
62
77
  throw new Error('plugin tool handler and description are required');
63
- const schema = value.inputSchema;
64
- if (!schema || typeof schema !== 'object' || Array.isArray(schema) || schema.type !== 'object')
65
- throw new Error('plugin tool input schema must describe an object');
66
- // Detach the JSON schema so later plugin mutations cannot alter the assistant contract.
67
- const json = JSON.stringify(schema);
68
- if (new TextEncoder().encode(json).byteLength > 65536)
69
- throw new Error('plugin tool schema is too large');
70
- tools.push(Object.freeze({ ...value, inputSchema: JSON.parse(json) }));
78
+ const json = serializePluginToolSchema({ schema: value.inputSchema });
79
+ const captured = { ...value };
80
+ const inputSchema = requireObjectSchema({ schema: JSON.parse(json) });
81
+ tools.push(Object.freeze({ ...captured, inputSchema }));
71
82
  } },
72
83
  widgets: { add(value, _optional = {}) {
73
84
  check();
@@ -1,4 +1,4 @@
1
- import type { PluginManifest, PluginValidationError } from "./manifest.js";
1
+ import type { PluginManifest, PluginValidationError } from "./manifest-types.js";
2
2
  /** A built-in plugin's in-code manifest-equivalent (ADR Decision item 4) — no tarball, no
3
3
  * integrity file (compiled-in code is definitionally not tampered), but still validated through
4
4
  * the same `validateManifest()` path as a site-installed plugin. */
@@ -36,7 +36,7 @@ export interface PluginDiscoveryRecord {
36
36
  *
37
37
  * Exists so a composition root's enable path (`server/plugin-runtime.ts`'s `onPluginEnabled()`)
38
38
  * can hand `loadPlugin()` the SAME manifest object this discovery pass already parsed, instead of
39
- * re-reading `tovu.plugin.json` a second time. This matters beyond avoiding duplicate I/O: every
39
+ * re-reading `jini.plugin.json` a second time. This matters beyond avoiding duplicate I/O: every
40
40
  * real caller of `onPluginEnabled` (`activation.ts`'s `setPluginEnabled`, BR-05 step 1) already
41
41
  * calls `discoverPlugins()` fresh, in the SAME request, immediately before invoking it (see
42
42
  * `routes/admin/plugins/set-enabled.ts`) — so reusing that record's manifest is not a staleness
@@ -20,7 +20,11 @@ function compareTb01(a, b) {
20
20
  return rankDiff;
21
21
  return a[0].localeCompare(b[0]);
22
22
  }
23
- /** The four JSON-primitive field types BR-06's declared-field vocabulary supports. */
23
+ /** The four JSON-primitive field types BR-06's declared-field vocabulary supports. The switch is
24
+ * exhaustive over `HookRegistryFieldDecl["type"]`, and `validateManifest` (`VALID_FIELD_TYPES`)
25
+ * refuses any other declared type before a plugin can attach, so there is no `default` arm: a type
26
+ * outside the union would fall through to `undefined`, which the only caller reads as a mismatch
27
+ * (still fail-closed). */
24
28
  function matchesDeclaredType(value, type) {
25
29
  switch (type) {
26
30
  case "integer":
@@ -31,15 +35,13 @@ function matchesDeclaredType(value, type) {
31
35
  return typeof value === "string";
32
36
  case "boolean":
33
37
  return typeof value === "boolean";
34
- default:
35
- return false;
36
38
  }
37
39
  }
38
40
  /** Last dot-segment of a declared `ext.{pluginId}.{field}` path — the field name a returned patch
39
41
  * key is checked against. */
40
42
  function fieldNameOf(declaredPath) {
41
- const segments = declaredPath.split(".");
42
- return segments[segments.length - 1] ?? declaredPath;
43
+ // `lastIndexOf` is -1 for a path with no dot, so the whole path is its own last segment.
44
+ return declaredPath.slice(declaredPath.lastIndexOf(".") + 1);
43
45
  }
44
46
  /** Calls one plugin's filter, re-shaping a thrown error into the module's own
45
47
  * `PluginHookFailedError` vocabulary — the ONE place `runBeforeSave`'s per-plugin work touches the
@@ -1,5 +1,6 @@
1
1
  /** Universal manifest, claims, activation and hook composition; never imports or evaluates a module. */
2
2
  export * from './ports.js';
3
+ export * from './plugin-format.js';
3
4
  export * from './errors.js';
4
5
  export * from './manifest.js';
5
6
  export * from './discovery-types.js';
@@ -1,5 +1,6 @@
1
1
  /** Universal manifest, claims, activation and hook composition; never imports or evaluates a module. */
2
2
  export * from './ports.js';
3
+ export * from './plugin-format.js';
3
4
  export * from './errors.js';
4
5
  export * from './manifest.js';
5
6
  export * from './discovery-types.js';
@@ -0,0 +1,103 @@
1
+ /** Manifest data contracts do not depend on validation or host composition. */
2
+ import type { PluginIdentityExtension } from '@jini-ai/core/plugin-directory';
3
+ export interface BrowserProviderDeclaration {
4
+ readonly id: string;
5
+ readonly kind: 'chart';
6
+ readonly contractVersion: 1;
7
+ readonly kinds: readonly string[];
8
+ readonly javascript: string;
9
+ readonly stylesheet?: string;
10
+ }
11
+ /** ADR-024 §1 trust-tier vocabulary (1.1.1 REQ-01 fix). Literal encoding reused verbatim from the
12
+ * existing, approved SPEC-032/ADR-023 precedent (`DataModuleDecl.pluginTier`). */
13
+ export type PluginTier = "tier-1" | "tier-2" | "tier-3";
14
+ /** REQ-04's exactly-three v1 capability vocabulary, as manifest-declared strings (validated
15
+ * against this set by `validateManifest`; `@jini-ai/plugin-sdk`'s `CONTENT_READ`/`CONTENT_EXTEND`/
16
+ * `HOOKS_ATTACH` constants are the same literal values, kept independent here so this module has
17
+ * no dependency on the SDK package per the Module Map). Sourced from `core/`'s
18
+ * `SharedExtensionCapability` — the sibling `site-glue` mechanism's own capability vocabulary
19
+ * declares this same three-member set as its first three members; both import the one shared
20
+ * declaration rather than each retyping the literals (2026-08-20 swarm-consensus synthesis,
21
+ * Result 1). */
22
+ export type PluginCapability = string;
23
+ /** REQ-06 field declaration — `ext.{pluginId}.{field}` (BR-06). `queryable` MUST be `false` in
24
+ * v1 (EC-04); a `true` value is a validation error (`QUERYABLE_UNSUPPORTED_V1`), not silently
25
+ * coerced. */
26
+ export interface PluginManifestFieldDecl {
27
+ readonly path: string;
28
+ readonly type: "string" | "integer" | "number" | "boolean";
29
+ readonly queryable: boolean;
30
+ /**
31
+ * Optional, human-readable, action-oriented description of what this field represents and how an
32
+ * agent should use it (2026-08-26 addition — `features/plugin-runtime/capability-tool-registrations.ts`
33
+ * is the sole consumer: it is folded into the indexed `search_tools` description for this plugin's
34
+ * capability-read tool when the plugin is enabled). Absent on every pre-existing manifest — this
35
+ * is additive, not a widened requirement, so no previously-valid manifest becomes invalid by
36
+ * omitting it; a plugin author who wants their capability to rank well against a real user query
37
+ * simply adds one.
38
+ */
39
+ readonly description?: string;
40
+ }
41
+ /** `jini.plugin.json` — the ecosystem compatibility surface (state.spec.md §2, ADR-004). */
42
+ export interface PluginManifest {
43
+ /** Storage/activation key. Publisher identity lives in extensions[identityNamespace].id. */
44
+ readonly id: string;
45
+ readonly keywords?: readonly string[];
46
+ readonly extensions?: Readonly<Record<string, PluginIdentityExtension>>;
47
+ readonly name: string;
48
+ readonly version: string;
49
+ readonly sdkRange: string;
50
+ readonly engine: number;
51
+ readonly tier: PluginTier;
52
+ readonly capabilities: readonly string[];
53
+ readonly hooks: readonly string[];
54
+ readonly fields: readonly PluginManifestFieldDecl[];
55
+ readonly integrity: Readonly<Record<string, string>>;
56
+ /** Parsed-and-stored, UNUSED in v1 (forward-compat, no behavior — state.spec.md §2). */
57
+ readonly adminSurfaces?: readonly unknown[] | null;
58
+ /** Reviewed bundled chart assets only; host admission supplies trust outside this manifest. */
59
+ readonly browserProviders?: readonly BrowserProviderDeclaration[];
60
+ /** Content types the plugin declares (AW-7 Tier 1, 2026-10-04) — no longer unused: validated by
61
+ * `declarative-content-types.ts`, claimed by key (`plugin-claims.ts`), created at enable. */
62
+ readonly contentTypes?: readonly unknown[] | null;
63
+ readonly provenance?: {
64
+ readonly sourceUrl?: string;
65
+ readonly signature?: string;
66
+ } | null;
67
+ readonly dependencies?: Readonly<Record<string, string>> | null;
68
+ /**
69
+ * What this plugin says it provides, by name (2026-10-04, conflict detection — see
70
+ * `plugin-claims.ts` and `ADS-memory/specs/005-plugin-system/conflicts.spec.md`). Optional and
71
+ * additive: a manifest without it claims only what its other fields already imply (its hooks and,
72
+ * when it declares `fields`, its generated capability tool). Each entry is a CLAIM: two enabled
73
+ * plugins, or a plugin and core, naming the same thing is refused at enable time and quarantined
74
+ * at boot rather than silently letting one overwrite the other. Declaring a surface the runtime
75
+ * does not mount yet (settings, widgets, routes — ADR-025/`adminSurfaces` are still unwired) is
76
+ * still binding for conflicts, so a plugin cannot squat a name today that a future mount would
77
+ * then have to arbitrate.
78
+ */
79
+ readonly contributes?: PluginContributions | null;
80
+ }
81
+ /** `jini.plugin.json`'s `contributes` block — every list optional, every entry a plain name. */
82
+ export interface PluginContributions {
83
+ /** `"METHOD /path"` or `"/path"` (every method). Parameter names do not distinguish routes. */
84
+ readonly routes?: readonly string[];
85
+ /** Agent tool ids. The generated prefixes `plugin_capability_`/`agent_plugin_` are reserved. */
86
+ readonly tools?: readonly string[];
87
+ /** Data-module tables — must sit in this plugin's own `p_{id}__` namespace (ADR-023 §5). */
88
+ readonly tables?: readonly string[];
89
+ readonly settings?: readonly string[];
90
+ readonly widgets?: readonly string[];
91
+ /** Permission ids this plugin DEFINES (not ones it merely requires). */
92
+ readonly permissions?: readonly string[];
93
+ }
94
+ /** One validation-vocabulary entry (errors.spec.md §3). `file` names the offending packaged file
95
+ * when applicable; `null` for manifest-level errors with no single implicated file. This is the
96
+ * shared shape used verbatim by both `PLUGINS_LIST.plugins[].errors[]` and
97
+ * `PLUGIN_INVALID.details.errors[]` (errors.spec.md §4 — "one validator, two surfaces"). */
98
+ export interface PluginValidationError {
99
+ readonly code: string;
100
+ readonly file: string | null;
101
+ readonly message: string;
102
+ }
103
+ //# sourceMappingURL=manifest-types.d.ts.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=manifest-types.js.map
@@ -3,7 +3,7 @@
3
3
  * (SPEC-005 REQ-01, BR-02/BR-03; ADR-024 `tier`, 1.1.1 fix).
4
4
  *
5
5
  * Purpose:
6
- * Pure, no-I/O validation of an already-parsed `tovu.plugin.json` object against the v1 required-
6
+ * Pure, no-I/O validation of an already-parsed `jini.plugin.json` object against the v1 required-
7
7
  * field set, id/folder match, capability vocabulary, hook vocabulary, and field-declaration rules.
8
8
  * Consumed by both `discovery.ts` (list-time, every discovery pass) and `loader.ts` (enable-time
9
9
  * re-validation, BR-05) — one validator, two call sites, never diverging (mirrors SPEC-004's theme
@@ -24,103 +24,11 @@
24
24
  * engine/tier, capabilities, hooks, fields) rather than stopping at the first, returning them in
25
25
  * `errors[]` — it never throws. Verified against `__tests__/unit/manifest.unit.test.ts`.
26
26
  */
27
- import { type BrowserProviderDeclaration } from "./browser-providers.js";
28
- import { type PluginIdentityExtension } from "@jini-ai/core/plugin-directory";
27
+ import type { PluginValidationError } from './manifest-types.js';
28
+ export type { PluginTier, PluginCapability, PluginManifestFieldDecl, PluginManifest, PluginContributions, PluginValidationError } from './manifest-types.js';
29
29
  import type { HookPoints, ManifestHostPorts } from "./ports.js";
30
- /** ADR-024 §1 trust-tier vocabulary (1.1.1 REQ-01 fix). Literal encoding reused verbatim from the
31
- * existing, approved SPEC-032/ADR-023 precedent (`DataModuleDecl.pluginTier`). */
32
- export type PluginTier = "tier-1" | "tier-2" | "tier-3";
33
- /** REQ-04's exactly-three v1 capability vocabulary, as manifest-declared strings (validated
34
- * against this set by `validateManifest`; `@tovu/sdk`'s `CONTENT_READ`/`CONTENT_EXTEND`/
35
- * `HOOKS_ATTACH` constants are the same literal values, kept independent here so this module has
36
- * no dependency on the SDK package per the Module Map). Sourced from `core/`'s
37
- * `SharedExtensionCapability` — the sibling `site-glue` mechanism's own capability vocabulary
38
- * declares this same three-member set as its first three members; both import the one shared
39
- * declaration rather than each retyping the literals (2026-08-20 swarm-consensus synthesis,
40
- * Result 1). */
41
- export type PluginCapability = string;
42
- /** REQ-06 field declaration — `ext.{pluginId}.{field}` (BR-06). `queryable` MUST be `false` in
43
- * v1 (EC-04); a `true` value is a validation error (`QUERYABLE_UNSUPPORTED_V1`), not silently
44
- * coerced. */
45
- export interface PluginManifestFieldDecl {
46
- readonly path: string;
47
- readonly type: "string" | "integer" | "number" | "boolean";
48
- readonly queryable: boolean;
49
- /**
50
- * Optional, human-readable, action-oriented description of what this field represents and how an
51
- * agent should use it (2026-08-26 addition — `features/plugin-runtime/capability-tool-registrations.ts`
52
- * is the sole consumer: it is folded into the indexed `search_tools` description for this plugin's
53
- * capability-read tool when the plugin is enabled). Absent on every pre-existing manifest — this
54
- * is additive, not a widened requirement, so no previously-valid manifest becomes invalid by
55
- * omitting it; a plugin author who wants their capability to rank well against a real user query
56
- * simply adds one.
57
- */
58
- readonly description?: string;
59
- }
60
- /** `tovu.plugin.json` — the ecosystem compatibility surface (state.spec.md §2, ADR-004). */
61
- export interface PluginManifest {
62
- /** Storage/activation key. Publisher identity lives in extensions[identityNamespace].id. */
63
- readonly id: string;
64
- readonly keywords?: readonly string[];
65
- readonly extensions?: Readonly<Record<string, PluginIdentityExtension>>;
66
- readonly name: string;
67
- readonly version: string;
68
- readonly sdkRange: string;
69
- readonly engine: number;
70
- readonly tier: PluginTier;
71
- readonly capabilities: readonly string[];
72
- readonly hooks: readonly string[];
73
- readonly fields: readonly PluginManifestFieldDecl[];
74
- readonly integrity: Readonly<Record<string, string>>;
75
- /** Parsed-and-stored, UNUSED in v1 (forward-compat, no behavior — state.spec.md §2). */
76
- readonly adminSurfaces?: readonly unknown[] | null;
77
- /** Reviewed bundled chart assets only; host admission supplies trust outside this manifest. */
78
- readonly browserProviders?: readonly BrowserProviderDeclaration[];
79
- /** Content types the plugin declares (AW-7 Tier 1, 2026-10-04) — no longer unused: validated by
80
- * `declarative-content-types.ts`, claimed by key (`plugin-claims.ts`), created at enable. */
81
- readonly contentTypes?: readonly unknown[] | null;
82
- readonly provenance?: {
83
- readonly sourceUrl?: string;
84
- readonly signature?: string;
85
- } | null;
86
- readonly dependencies?: Readonly<Record<string, string>> | null;
87
- /**
88
- * What this plugin says it provides, by name (2026-10-04, conflict detection — see
89
- * `plugin-claims.ts` and `ADS-memory/specs/005-plugin-system/conflicts.spec.md`). Optional and
90
- * additive: a manifest without it claims only what its other fields already imply (its hooks and,
91
- * when it declares `fields`, its generated capability tool). Each entry is a CLAIM: two enabled
92
- * plugins, or a plugin and core, naming the same thing is refused at enable time and quarantined
93
- * at boot rather than silently letting one overwrite the other. Declaring a surface the runtime
94
- * does not mount yet (settings, widgets, routes — ADR-025/`adminSurfaces` are still unwired) is
95
- * still binding for conflicts, so a plugin cannot squat a name today that a future mount would
96
- * then have to arbitrate.
97
- */
98
- readonly contributes?: PluginContributions | null;
99
- }
100
- /** `tovu.plugin.json`'s `contributes` block — every list optional, every entry a plain name. */
101
- export interface PluginContributions {
102
- /** `"METHOD /path"` or `"/path"` (every method). Parameter names do not distinguish routes. */
103
- readonly routes?: readonly string[];
104
- /** Agent tool ids. The generated prefixes `plugin_capability_`/`agent_plugin_` are reserved. */
105
- readonly tools?: readonly string[];
106
- /** Data-module tables — must sit in this plugin's own `p_{id}__` namespace (ADR-023 §5). */
107
- readonly tables?: readonly string[];
108
- readonly settings?: readonly string[];
109
- readonly widgets?: readonly string[];
110
- /** Permission ids this plugin DEFINES (not ones it merely requires). */
111
- readonly permissions?: readonly string[];
112
- }
113
- /** One validation-vocabulary entry (errors.spec.md §3). `file` names the offending packaged file
114
- * when applicable; `null` for manifest-level errors with no single implicated file. This is the
115
- * shared shape used verbatim by both `PLUGINS_LIST.plugins[].errors[]` and
116
- * `PLUGIN_INVALID.details.errors[]` (errors.spec.md §4 — "one validator, two surfaces"). */
117
- export interface PluginValidationError {
118
- readonly code: string;
119
- readonly file: string | null;
120
- readonly message: string;
121
- }
122
30
  export interface ValidateManifestRequired<H extends HookPoints = HookPoints> extends ManifestHostPorts<H> {
123
- /** An already-parsed `tovu.plugin.json` value (unparseable JSON is `discovery.ts`'s concern —
31
+ /** An already-parsed `jini.plugin.json` value (unparseable JSON is `discovery.ts`'s concern —
124
32
  * this function receives a JS value, never a file path or raw bytes). */
125
33
  readonly manifest: unknown;
126
34
  /** The install folder name this manifest was read from (EC-01: `id` must equal this). */
@@ -141,7 +49,7 @@ export interface ValidateManifestResult {
141
49
  export declare function validatePluginIdFormat(required: {
142
50
  id: string;
143
51
  }, _optional?: Record<string, never>): readonly PluginValidationError[];
144
- /** The owner id the claim system gives Tovu core (`plugin-claims.ts` re-exports it). Conflict
52
+ /** The owner id the claim system gives the host core (`plugin-claims.ts` re-exports it). Conflict
145
53
  * detection never compares an owner with itself, so a plugin with this id would never conflict with
146
54
  * core's reserved routes, tools or permissions — it is refused as an id instead. */
147
55
  export declare const CORE_OWNER_ID = "core";