@jini-ai/plugins 0.6.19 → 0.7.0

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 (46) hide show
  1. package/CHANGELOG.md +51 -0
  2. package/dist/host/admin-response.d.ts +93 -0
  3. package/dist/host/admin-response.js +32 -0
  4. package/dist/host/capability-tools.d.ts +369 -0
  5. package/dist/host/capability-tools.js +306 -0
  6. package/dist/host/declarative-content-types.d.ts +245 -0
  7. package/dist/host/declarative-content-types.js +270 -0
  8. package/dist/host/index.d.ts +3 -0
  9. package/dist/host/index.js +3 -0
  10. package/dist/host/manifest.d.ts +1 -4
  11. package/dist/host/manifest.js +2 -5
  12. package/dist/host/node/archive-policy.d.ts +57 -0
  13. package/dist/host/node/archive-policy.js +115 -0
  14. package/dist/host/node/index.d.ts +3 -0
  15. package/dist/host/node/index.js +3 -0
  16. package/dist/host/node/install.d.ts +1 -4
  17. package/dist/host/node/install.js +2 -8
  18. package/dist/host/node/invocation-binding.d.ts +45 -0
  19. package/dist/host/node/invocation-binding.js +69 -0
  20. package/dist/host/node/runtime-core.d.ts +273 -0
  21. package/dist/host/node/runtime-core.js +613 -0
  22. package/dist/host/node/source-drafts.d.ts +1 -5
  23. package/dist/host/node/source-drafts.js +2 -8
  24. package/dist/host/plugin-claims.d.ts +2 -1
  25. package/dist/host/plugin-claims.js +1 -1
  26. package/dist/host/plugin-format.d.ts +4 -0
  27. package/dist/host/plugin-format.js +4 -0
  28. package/dist/host/plugin-tool-errors.d.ts +11 -0
  29. package/dist/host/plugin-tool-errors.js +19 -0
  30. package/dist/host/source-policy.d.ts +2 -2
  31. package/dist/host/source-policy.js +3 -3
  32. package/dist/host/tools/contract.d.ts +397 -0
  33. package/dist/host/tools/contract.js +7 -0
  34. package/dist/host/tools/index.d.ts +7 -0
  35. package/dist/host/tools/index.js +6 -0
  36. package/dist/host/tools/install.d.ts +12 -0
  37. package/dist/host/tools/install.js +71 -0
  38. package/dist/host/tools/management.d.ts +51 -0
  39. package/dist/host/tools/management.js +607 -0
  40. package/dist/host/tools/source.d.ts +14 -0
  41. package/dist/host/tools/source.js +95 -0
  42. package/dist/host/worker/index.d.ts +1 -0
  43. package/dist/host/worker/index.js +1 -0
  44. package/dist/host/worker/start.d.ts +44 -0
  45. package/dist/host/worker/start.js +31 -0
  46. package/package.json +16 -9
@@ -0,0 +1,69 @@
1
+ /**
2
+ * @file `createPluginInvocationBinding()` — the per-load backing for a plugin's capability-scoped
3
+ * SDK (`content.read`, `content.extend`, `addFilter`), shared by every place that runs a plugin's
4
+ * `setup()`: the host's in-process enable path and the Tier-2 worker (`../worker/run-call.ts`).
5
+ * One implementation, so a Tier-2 plugin sees exactly the SDK semantics a Tier-3 plugin does
6
+ * (ADR-024 §3: the ABI is the same; only where the code runs differs).
7
+ *
8
+ * `content.read`/`content.extend` are bound to the filter invocation that is currently running
9
+ * (AsyncLocalStorage), never to load time: a plugin that calls them from `setup()` or from a timer
10
+ * after its filter returned gets a named error instead of another save's entry.
11
+ *
12
+ * Transported from the host's `invocation-core-deps.ts` (extract-s6 L1b); the only changed
13
+ * expressions are the host SDK's beforeSave hook id (now the required `beforeSaveHook`) and the
14
+ * entry/filter types (now the plugin-domain envelope from `../ports.ts`).
15
+ */
16
+ import { AsyncLocalStorage } from "node:async_hooks";
17
+ /**
18
+ * Builds one plugin load's SDK backing plus the slot its `setup()` fills with a beforeSave filter.
19
+ *
20
+ * @agent-note Invariants a second host relies on: ONE AsyncLocalStorage per load; `content.read`
21
+ * and `content.extend` work only inside the running filter (outside it they throw a named error);
22
+ * exactly one filter, and only for the declared `beforeSaveHook`; extend writes merge UNDER the
23
+ * filter's returned keys (returned keys win); a non-object return passes through untouched.
24
+ * Nothing here writes or persists — the host's hook registry owns save, preview and quarantine.
25
+ * @throws Nothing at build time. The returned handles throw when used outside a running filter,
26
+ * when an undeclared hook is attached, or when a second beforeSave filter is attached.
27
+ * @complexity O(1) per call; a wrapped filter adds O(extend-write count) to merge writes.
28
+ * @example createPluginInvocationBinding({ pluginId, declaredHooks: manifest.hooks, beforeSaveHook: binding.beforeSaveHook }, {})
29
+ */
30
+ export function createPluginInvocationBinding(required, _optional = {}) {
31
+ const { pluginId, declaredHooks, beforeSaveHook } = required;
32
+ const invocation = new AsyncLocalStorage();
33
+ let capturedFilter = null;
34
+ const coreDeps = {
35
+ getCurrentEntry() {
36
+ const state = invocation.getStore();
37
+ if (!state)
38
+ throw new Error(`plugin '${pluginId}' called content.read outside a beforeSave hook`);
39
+ return state.entry;
40
+ },
41
+ writeExtField(field, value) {
42
+ const state = invocation.getStore();
43
+ if (!state)
44
+ throw new Error(`plugin '${pluginId}' called content.extend outside a beforeSave hook`);
45
+ state.writes[field] = value;
46
+ },
47
+ attachFilter(hookName, filter) {
48
+ if (hookName !== beforeSaveHook || !declaredHooks.includes(hookName)) {
49
+ throw new Error(`plugin '${pluginId}' attempted to attach undeclared hook '${String(hookName)}'`);
50
+ }
51
+ if (capturedFilter) {
52
+ throw new Error(`plugin '${pluginId}' attempted to attach more than one beforeSave filter`);
53
+ }
54
+ capturedFilter = async (entry, ctx) => {
55
+ const state = { entry, writes: {} };
56
+ return invocation.run(state, async () => {
57
+ const returned = await filter(entry, ctx);
58
+ if (Object.keys(state.writes).length === 0)
59
+ return returned;
60
+ if (typeof returned !== "object" || returned === null || Array.isArray(returned))
61
+ return returned;
62
+ return { ...state.writes, ...returned };
63
+ });
64
+ };
65
+ },
66
+ };
67
+ return { coreDeps, capturedFilter: () => capturedFilter };
68
+ }
69
+ //# sourceMappingURL=invocation-binding.js.map
@@ -0,0 +1,273 @@
1
+ import { type PluginLookupPort } from "@jini-ai/core/plugin-directory";
2
+ import type { Clock as ClockPort } from "@jini-ai/core/primitives";
3
+ import { type PluginActivationRepoPort } from "../activation.js";
4
+ import { type PluginContributionRegistry } from "../contributions.js";
5
+ import type { AdmittedBrowserProvider } from "../browser-providers.js";
6
+ import type { ArchiveReaderPort, BundledBrowserProviderApproval, DeclarativeContentTypesPort, DeclaredContentTypePorts, PluginModuleImportPort, PluginSdkBinding, PluginTierPolicy, VerifyDigestPort } from "../ports.js";
7
+ import { type PluginSourcePolicyPort } from "../source-policy.js";
8
+ import type { BuiltInPluginSource, PluginDiscoveryRecord } from "../discovery-types.js";
9
+ import { type HookRegistry } from "../hook-registry.js";
10
+ import type { PluginManifest } from "../manifest-types.js";
11
+ import type { ExtensionClaim } from "../claim-conflicts.js";
12
+ import { type PluginConflict } from "../plugin-claims.js";
13
+ import { type PluginInstallerPort } from "./install.js";
14
+ import { createPluginModuleSnapshotLifecycle } from "./module-snapshot.js";
15
+ import { type PluginSourcePort } from "./source-drafts.js";
16
+ import { type PluginPackageFiles } from "./package-files.js";
17
+ import type { Tier2CallRunner } from "../worker/protocol.js";
18
+ import type { RunTier2CallRequired } from "../worker/run-call.js";
19
+ /** Executable metadata for one compiled-in plugin. Discovery consumes only `manifest`; the enable
20
+ * callback consumes the import seam after integrity/sdkRange checks. Site-artifact sources can use
21
+ * the same shape once their install-dir resolver is composed here.
22
+ * @agent-note `importModule` is reached only through `loadPlugin()` after integrity and `sdkRange`
23
+ * passed; the host owns the entry path and importer. */
24
+ export interface PluginRuntimeSource extends BuiltInPluginSource {
25
+ readonly source: "built-in";
26
+ readonly entryPath: string;
27
+ readonly importModule: (entryPath: string) => Promise<unknown>;
28
+ /** The built-in's own source folder, shown read-only by the admin Plugins screen's
29
+ * package-files viewer (a host route). Omitted ⇒ that viewer lists no files. */
30
+ readonly sourceDir?: string;
31
+ }
32
+ /** Thrown when `pluginId` is not safe to use as a filesystem path segment
33
+ * under `installDir` — either it fails {@link SAFE_PLUGIN_ID_SEGMENT}'s allowlist, or (defense in
34
+ * depth, in case some future caller's id validation elsewhere ever drifts) the resolved absolute
35
+ * path would land outside `installDir` after resolution. Deliberately fails closed on EITHER
36
+ * check independently, not just the one presumed sufficient.
37
+ * @agent-note Error identity: hosts re-export this ONE class (never a copy) so `instanceof` and
38
+ * `name === "PluginUninstallPathError"` hold across the host's routes and tests. */
39
+ export declare class PluginUninstallPathError extends Error {
40
+ constructor(pluginId: string);
41
+ }
42
+ /** What {@link createPluginRuntimeCore} returns: one runtime's shared handles.
43
+ * @agent-note Every member closes over the SAME repo, workspace, hook/contribution/provider registries
44
+ * and pending-attachment set; hosts adapt members (e.g. positional SDK types) without rebuilding them. */
45
+ export interface PluginRuntimeCoreBindings {
46
+ /** Call after provider teardown and stopped hook users; drains copies and releases owned graphs. */
47
+ readonly dispose: (required: Record<string, never>, optional?: Record<string, never>) => Promise<void>;
48
+ /** Successfully attached, admitted providers only; disable/quarantine retires their assets. */
49
+ readonly browserProviders: (input: Record<string, never>, options?: Record<string, never>) => {
50
+ generation: number;
51
+ providers: readonly AdmittedBrowserProvider[];
52
+ };
53
+ readonly pluginSource?: PluginSourcePort;
54
+ readonly pluginSourcePolicy: PluginSourcePolicyPort;
55
+ /** Actual loaded snapshot revision, used by the existing cross-process activation poll. */
56
+ readonly pluginLoadedVersion: (required: {
57
+ id: string;
58
+ }, optional?: Record<string, never>) => string | undefined;
59
+ readonly pluginInstaller?: PluginInstallerPort;
60
+ readonly hookRegistry: HookRegistry;
61
+ readonly pluginContributions: PluginContributionRegistry;
62
+ /** Provider factories of admitted provider plugins only (`createPluginProviderHost` reads this).
63
+ * Separate from `pluginContributions`, whose route/tool/widget snapshots carry no providers. */
64
+ readonly providerContributions: PluginContributionRegistry;
65
+ /**
66
+ * Boot-only: loads the given provider plugins when each is installed and enabled here, admitting
67
+ * their factories into `providerContributions`. Provider plugins are loaded nowhere else (boot
68
+ * re-attach and enable skip them), so a running provider is never replaced mid-process; enabling
69
+ * one takes effect at the next boot, disabling or quarantining one retires it immediately.
70
+ * @returns The ids actually loaded. Per-plugin failures are logged and skipped, never thrown.
71
+ */
72
+ readonly loadProviderPlugins: (required: {
73
+ pluginIds: readonly string[];
74
+ }, optional?: {
75
+ timeoutMs?: number;
76
+ }) => Promise<readonly string[]>;
77
+ /** Installed + enabled plugins here that declare providers, with their declarations (manifest only). */
78
+ readonly listProviderPlugins: (required: Record<string, never>, optional?: Record<string, never>) => Promise<readonly {
79
+ pluginId: string;
80
+ providers: NonNullable<NonNullable<PluginManifest["contributes"]>["providers"]>;
81
+ }[]>;
82
+ readonly discoverPlugins: () => Promise<readonly PluginDiscoveryRecord[]>;
83
+ /** Discovery with the enabled activations' version pins: the versions boot runs (a pin never falls forward). */
84
+ readonly discoverActivePlugins: () => Promise<readonly PluginDiscoveryRecord[]>;
85
+ readonly onPluginEnabled: (pluginId: string) => Promise<void>;
86
+ readonly onPluginDisabled: (pluginId: string) => void;
87
+ readonly locatePluginPackageDirs: (pluginId: string) => Promise<{
88
+ liveParent: string;
89
+ liveNames: readonly string[];
90
+ parkedDir: string;
91
+ }>;
92
+ /** Lists one discovered plugin's own files, read-only and bounded, for the admin Plugins
93
+ * screen's package-files viewer — see {@link resolvePackageLocation} and
94
+ * `Jini/packages/plugins/src/host/node/package-files.ts`. Rejects with `PluginPackagePathError` for an
95
+ * unsafe id/version or a directory that resolves outside its container. */
96
+ readonly readPluginPackageFiles: (record: PluginDiscoveryRecord) => Promise<PluginPackageFiles>;
97
+ /** @agent-note Positional adapter over the shared hook registry; the entry object is passed
98
+ * through untouched so every host payload field reaches each filter. */
99
+ readonly beforeSaveHook: (entry: Parameters<HookRegistry["runBeforeSave"]>[0]["entry"]) => ReturnType<HookRegistry["runBeforeSave"]>;
100
+ /** Admin preview (AW-7): one attached plugin's beforeSave patch for a draft, nothing saved or
101
+ * counted toward quarantine. `null` ⇒ not attached. See `HookRegistry.previewBeforeSave`.
102
+ * @agent-note Preview writes nothing and counts nothing toward quarantine. */
103
+ readonly previewPluginBeforeSave: (pluginId: string, entry: Parameters<HookRegistry["previewBeforeSave"]>[0]["entry"]) => ReturnType<HookRegistry["previewBeforeSave"]>;
104
+ /**
105
+ * P0a fix (2026-09-23): re-runs `onPluginEnabled` for every plugin `activationRepo` durably
106
+ * marks `enabled` for THIS composition's `workspaceId`. Before this existed, nothing replayed
107
+ * that durable state into a freshly-constructed (empty) `hookRegistry` — a plugin enabled in a
108
+ * prior process looked enabled in the admin UI and in `listAll()`, but its filter/action/
109
+ * contribution never fired again until an operator disabled and re-enabled it. Best-effort: one
110
+ * plugin failing to re-attach (e.g. its package was removed from disk) is logged and skipped, not
111
+ * thrown, so it can never block the rest of boot (mirrors `seedBundledAgentPlugins`'s own
112
+ * per-package isolation).
113
+ */
114
+ readonly attachEnabledPluginsAtBoot: () => Promise<void>;
115
+ /** Every discovered plugin that has a name conflict right now — an enabled loser, or a plugin that
116
+ * is off and WOULD be refused if turned on — for the admin screen and the host's plugin-list tool. See
117
+ * `Jini/packages/plugins/src/host/plugin-claims.ts`'s `resolvePluginConflicts`. */
118
+ readonly listPluginConflicts: () => Promise<ReadonlyMap<string, readonly PluginConflict[]>>;
119
+ }
120
+ /**
121
+ * The host bag spread into discovery, conflicts, enable, load, the Tier-2 seam, install and the
122
+ * source service. Extract-s6 L1b: a local port so the runtime core imports no host module.
123
+ * @agent-note Second-host rule: build ONE bag per runtime and keep it for the runtime's lifetime;
124
+ * every member is host-owned (capability vocabulary, declared content types, core owner name,
125
+ * identity namespace, install-disabled wording, tier policy, archive reader, digest format and the
126
+ * per-load invocation binding factory). The archive reader is always host-supplied (no fallback).
127
+ */
128
+ export interface PluginRuntimeHostBinding {
129
+ readonly capabilityVocabulary: readonly string[];
130
+ readonly declarativeContentTypes: DeclarativeContentTypesPort;
131
+ readonly coreOwnerName: string;
132
+ readonly identityNamespace: string;
133
+ readonly localInstallDisabledMessage: string;
134
+ readonly tierPolicy: PluginTierPolicy;
135
+ readonly archiveReader: ArchiveReaderPort;
136
+ readonly verifyDigest: VerifyDigestPort;
137
+ readonly createInvocationCoreDeps: RunTier2CallRequired["createInvocationCoreDeps"];
138
+ }
139
+ /** Only the tracker member the runtime calls. @agent-note The host supplies the event vocabulary
140
+ * through `quarantineTelemetry`; the runtime never names an event, user or property itself. */
141
+ export interface PluginRuntimeTracker<TEvent, TOptions> {
142
+ capture(event: TEvent, options: TOptions): unknown;
143
+ }
144
+ /** Install admission + plugin lookup. @agent-note `withInstallIdentity` must serialize admission
145
+ * of one candidate identity and run `run` at most once; it is read per install, never cached. */
146
+ export interface PluginRuntimeLookup extends PluginLookupPort {
147
+ /**
148
+ * Admits one site-runtime publisher identity, then publishes it by running `run`.
149
+ * @agent-note Second-host rule: the runtime only names the candidate; identity custody is the
150
+ * host's, and this port must perform the WHOLE sequence, in this order:
151
+ * 1. take ONE lock shared by every publisher of every plugin family the host runs, across all
152
+ * processes that can publish into the same install (a per-process or per-family mutex is not
153
+ * enough: two families could then both publish the same `publisher/local` identity);
154
+ * 2. under that lock, read a FRESH admission inventory of all families (never a cached list),
155
+ * including disabled installs, reserved/built-in identities and any other reservation;
156
+ * 3. assert the candidate identity is available against that inventory, refusing a clash with any
157
+ * other family or owner and allowing only a permitted upgrade of the same plugin's identity;
158
+ * 4. run `run` (which publishes the install) while STILL holding the same lock, at most once,
159
+ * and release the lock only after it settles. The site installer itself checks only its own
160
+ * install directory and built-ins; it cannot see another family's reservation.
161
+ */
162
+ withInstallIdentity<T>(required: {
163
+ candidate: {
164
+ id: string;
165
+ localId: string;
166
+ family: "site-runtime";
167
+ };
168
+ run: () => Promise<T>;
169
+ }): Promise<T>;
170
+ }
171
+ /** Host wording the runtime surfaces. @agent-note Exact host bytes; names of host tools, manifest
172
+ * file names and route prefixes live here, never in the runtime. */
173
+ export interface PluginRuntimeText {
174
+ /** Source written to a new local plugin draft. */
175
+ readonly scaffoldEntry: string;
176
+ /** Reload refusal when a re-sealed version widens capabilities (`added` in manifest order). */
177
+ readonly reloadApprovalRequired: (required: {
178
+ added: readonly string[];
179
+ }) => string;
180
+ /** Quarantine reason when a source reload and the restored-version reload both failed. */
181
+ readonly restoreFailedReason: string;
182
+ }
183
+ /**
184
+ * Required inputs of the plugin-owned runtime core (extract-s6 L1b seam; moved here in L1c).
185
+ * @agent-note Second-host rule: `pluginSourcePolicy`, `tier2CallRunner` and `pluginSdkBinding` have
186
+ * NO defaults here — the host owns env/policy, the worker entry/runner/timeout, and the SDK (hook
187
+ * ids, version, `beforeSaveHook`). `activationRepo` and the hook registry built here are shared by
188
+ * save AND preview of this one runtime. The Tier-2 runner must register its SDK resolver before
189
+ * importing. `createModuleImporter` is two-stage; see its own note.
190
+ */
191
+ export interface PluginRuntimeCoreRequired<TEvent = unknown, TOptions = unknown> {
192
+ readonly workspaceId: string;
193
+ readonly clock: ClockPort;
194
+ readonly activationRepo: PluginActivationRepoPort;
195
+ readonly sources: readonly PluginRuntimeSource[];
196
+ readonly pluginSourcePolicy: PluginSourcePolicyPort;
197
+ readonly tier2CallRunner: Tier2CallRunner;
198
+ readonly pluginSdkBinding: PluginSdkBinding;
199
+ readonly hostBinding: PluginRuntimeHostBinding;
200
+ /**
201
+ * Builds the module importer for one load target.
202
+ * @agent-note Second-host rule: two stages, with different guarantees.
203
+ * 1. Factory call: the runtime calls this while preparing the `loadPlugin` arguments, BEFORE that
204
+ * load's integrity and `sdkRange` checks run, and possibly for a package those checks then
205
+ * reject. The call must therefore only build a closure: no import, no snapshot, no file read,
206
+ * no executable loading of any kind.
207
+ * 2. Returned importer: invoked by the loader only AFTER admission (integrity, `sdkRange`). For a
208
+ * site package it must (a) enforce containment: the resolved entry stays inside the plugin's
209
+ * real package root, with links refused; (b) import a FRESH identity of the entire dependency
210
+ * graph on every load, never a cached module, so a replaced package never runs stale helpers;
211
+ * (c) keep any snapshot it takes, when `snapshots` is given, alive for late/lazy imports until
212
+ * that lifecycle is disposed. A plain cached `import()` adapter violates (b). An injected
213
+ * `importModule` seam (built-in, worker or test) keeps its original path.
214
+ */
215
+ readonly createModuleImporter: (required: {
216
+ manifest: PluginManifest;
217
+ source: "built-in" | "site";
218
+ }, optional?: {
219
+ importModule?: (entryPath: string) => Promise<unknown>;
220
+ snapshots?: NonNullable<ReturnType<typeof createPluginModuleSnapshotLifecycle>>;
221
+ }) => PluginModuleImportPort;
222
+ readonly text: PluginRuntimeText;
223
+ /** Host projection of one quarantine into its own telemetry event; called only when `tracker` is set. */
224
+ readonly quarantineTelemetry: (required: {
225
+ pluginId: string;
226
+ }) => {
227
+ event: TEvent;
228
+ options: TOptions;
229
+ };
230
+ }
231
+ /** Optional inputs; each omitted value keeps the documented default.
232
+ * @agent-note `dispose()` must run after provider teardown and stopped hook users; it drains
233
+ * pending attachments, then releases module snapshots. Load epochs retire stale generations. */
234
+ export interface PluginRuntimeCoreOptional<TEvent = unknown, TOptions = unknown> {
235
+ readonly tracker?: () => PluginRuntimeTracker<TEvent, TOptions>;
236
+ readonly lookup?: () => PluginRuntimeLookup | undefined;
237
+ readonly browserProviderApprovals?: readonly BundledBrowserProviderApproval[];
238
+ readonly bundledEnabledIds?: readonly string[];
239
+ readonly failureThreshold?: number;
240
+ readonly installDir?: string;
241
+ readonly coreClaims?: readonly ExtensionClaim[];
242
+ readonly declaredContentTypes?: DeclaredContentTypePorts;
243
+ }
244
+ /**
245
+ * The plugin-owned runtime algorithm behind the host's composition wrapper (extract-s6 L1b seam,
246
+ * moved here in L1c). Reads no host module: every host value arrives through
247
+ * {@link PluginRuntimeCoreRequired}/{@link PluginRuntimeCoreOptional}.
248
+ * @agent-note Callback order is unchanged: quarantine writes the activation row, then telemetry;
249
+ * enable loads (integrity, sdkRange, resolver, import, setup) before attach; a disable or newer
250
+ * load during import retires the older epoch.
251
+ * @agent-note Shared state: ONE `activationRepo`/`workspaceId`, ONE hook registry (save AND preview),
252
+ * ONE contribution and provider registry and ONE pending-attachment set per call; the host must not
253
+ * build a second registry or queue beside it. Each plugin load asks the host's
254
+ * `hostBinding.createInvocationCoreDeps` once, so there is exactly one invocation AsyncLocalStorage
255
+ * per load.
256
+ * @agent-note Lifecycle: `dispose()` sets closing, drains pending attachments, then releases module
257
+ * snapshots; attachments refused after that reject with `PluginSnapshotLifecycleError`. Load epochs
258
+ * retire stale generations; version pins come from enabled activation rows (never fall forward).
259
+ * @agent-note Reload: a source reload that widens capabilities throws the host's
260
+ * `text.reloadApprovalRequired` and keeps the approved version running; a failed reload re-enters the
261
+ * same loader for the restored row, and if that fails too the plugin is quarantined with
262
+ * `text.restoreFailedReason`.
263
+ * @agent-note Import order: `loadPlugin()` runs integrity and `sdkRange` before the importer; a Tier-2
264
+ * plugin is never imported in-process (the host runner registers its SDK resolver before importing).
265
+ * Preview (`previewPluginBeforeSave`) writes nothing and counts nothing toward quarantine.
266
+ * @agent-note The host owns the SDK binding, the Tier-2 worker entry/runner/timeout, env and source
267
+ * policy, telemetry vocabulary, lookup/admission and all wording. Errors keep their identity:
268
+ * `PluginLoadError`, `PluginConflictError`, `PluginSnapshotLifecycleError`, `PluginPackagePathError`
269
+ * and {@link PluginUninstallPathError} are thrown as the same classes the package exports.
270
+ * @example createPluginRuntimeCore({ workspaceId, clock, activationRepo, sources, pluginSourcePolicy, tier2CallRunner, pluginSdkBinding, hostBinding, createModuleImporter, text, quarantineTelemetry }, { installDir })
271
+ */
272
+ export declare function createPluginRuntimeCore<TEvent, TOptions>(required: PluginRuntimeCoreRequired<TEvent, TOptions>, optional?: PluginRuntimeCoreOptional<TEvent, TOptions>): PluginRuntimeCoreBindings;
273
+ //# sourceMappingURL=runtime-core.d.ts.map