@jini-ai/plugins 0.0.0-stage → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/LICENSE +201 -0
  3. package/README.md +60 -2
  4. package/dist/glue/attachment-points/content-lifecycle.d.ts +52 -0
  5. package/dist/glue/attachment-points/content-lifecycle.js +15 -0
  6. package/dist/glue/attachment-points/events.d.ts +12 -0
  7. package/dist/glue/attachment-points/events.js +5 -0
  8. package/dist/glue/attachment-points/tool-registration.d.ts +23 -0
  9. package/dist/glue/attachment-points/tool-registration.js +43 -0
  10. package/dist/glue/capability-gate.d.ts +73 -0
  11. package/dist/glue/capability-gate.js +41 -0
  12. package/dist/glue/dispatch.d.ts +20 -0
  13. package/dist/glue/dispatch.js +9 -0
  14. package/dist/glue/index.d.ts +8 -0
  15. package/dist/glue/index.js +8 -0
  16. package/dist/glue/manifest.d.ts +43 -0
  17. package/dist/glue/manifest.js +106 -0
  18. package/dist/glue/ports.d.ts +60 -0
  19. package/dist/glue/ports.js +2 -0
  20. package/dist/host/activation.d.ts +118 -0
  21. package/dist/host/activation.js +104 -0
  22. package/dist/host/attach-loaded-plugin.d.ts +37 -0
  23. package/dist/host/attach-loaded-plugin.js +19 -0
  24. package/dist/host/capability-sdk.d.ts +74 -0
  25. package/dist/host/capability-sdk.js +94 -0
  26. package/dist/host/claim-conflicts.d.ts +101 -0
  27. package/dist/host/claim-conflicts.js +139 -0
  28. package/dist/host/contributions.d.ts +129 -0
  29. package/dist/host/contributions.js +167 -0
  30. package/dist/host/declarative-enable.d.ts +43 -0
  31. package/dist/host/declarative-enable.js +73 -0
  32. package/dist/host/discovery-types.d.ts +55 -0
  33. package/dist/host/discovery-types.js +2 -0
  34. package/dist/host/errors.d.ts +20 -0
  35. package/dist/host/errors.js +22 -0
  36. package/dist/host/hook-registry.d.ts +113 -0
  37. package/dist/host/hook-registry.js +190 -0
  38. package/dist/host/index.d.ts +19 -0
  39. package/dist/host/index.js +19 -0
  40. package/dist/host/manifest.d.ts +159 -0
  41. package/dist/host/manifest.js +417 -0
  42. package/dist/host/node/discovery.d.ts +32 -0
  43. package/dist/host/node/discovery.js +241 -0
  44. package/dist/host/node/index.d.ts +8 -0
  45. package/dist/host/node/index.js +8 -0
  46. package/dist/host/node/install.d.ts +118 -0
  47. package/dist/host/node/install.js +431 -0
  48. package/dist/host/node/loader.d.ts +55 -0
  49. package/dist/host/node/loader.js +146 -0
  50. package/dist/host/node/module-snapshot.d.ts +25 -0
  51. package/dist/host/node/module-snapshot.js +53 -0
  52. package/dist/host/node/package-files.d.ts +52 -0
  53. package/dist/host/node/package-files.js +214 -0
  54. package/dist/host/node/source-drafts.d.ts +98 -0
  55. package/dist/host/node/source-drafts.js +323 -0
  56. package/dist/host/plugin-claims.d.ts +75 -0
  57. package/dist/host/plugin-claims.js +182 -0
  58. package/dist/host/ports.d.ts +208 -0
  59. package/dist/host/ports.js +2 -0
  60. package/dist/host/quarantine.d.ts +19 -0
  61. package/dist/host/quarantine.js +28 -0
  62. package/dist/host/repo.memory.d.ts +27 -0
  63. package/dist/host/repo.memory.js +33 -0
  64. package/dist/host/source-policy.d.ts +18 -0
  65. package/dist/host/source-policy.js +13 -0
  66. package/dist/host/sql/index.d.ts +4 -0
  67. package/dist/host/sql/index.js +4 -0
  68. package/dist/host/sql/repo.d.ts +38 -0
  69. package/dist/host/sql/repo.js +50 -0
  70. package/dist/host/sql/repo.rows.d.ts +28 -0
  71. package/dist/host/sql/repo.rows.js +28 -0
  72. package/dist/host/tool-contributions.d.ts +26 -0
  73. package/dist/host/tool-contributions.js +42 -0
  74. package/dist/host/uninstall.d.ts +88 -0
  75. package/dist/host/uninstall.js +112 -0
  76. package/dist/host/worker/import-seam.d.ts +45 -0
  77. package/dist/host/worker/import-seam.js +52 -0
  78. package/dist/host/worker/index.d.ts +5 -0
  79. package/dist/host/worker/index.js +5 -0
  80. package/dist/host/worker/protocol.d.ts +62 -0
  81. package/dist/host/worker/protocol.js +31 -0
  82. package/dist/host/worker/run-call.d.ts +27 -0
  83. package/dist/host/worker/run-call.js +76 -0
  84. package/package.json +107 -3
package/CHANGELOG.md ADDED
@@ -0,0 +1,27 @@
1
+ # @jini-ai/plugins
2
+
3
+ ## 0.4.0 — 2026-10-02
4
+
5
+ ### BREAKING
6
+
7
+ - Private glue package retains behavior and public barrels while process/source-grep artifacts are archived or consolidated.
8
+ - Distribution includes runtime output, release documentation and required assets only. Process records and per-job neutrality checks are no longer part of the package surface.
9
+
10
+ ## Unreleased
11
+
12
+ - Share publisher identity validation with core, retain the built-in incumbent on duplicate publisher IDs, and omit broken unrelated installed manifests from admission with warnings while preserving link refusals.
13
+
14
+ - Publish the plugin host runtime at universal `./host` and Node `./host/node`, `./host/worker`,
15
+ `./host/sql`; keep `./glue` unchanged. Require host SDK/catalog, declaration, tier, executable
16
+ import/digest, archive and storage-table ports; preserve package layout, diagnostics and states.
17
+ - Remove private-package status and configure public npm publishing without a version bump.
18
+ Host dependencies are optional peers under the 2026-10-07 install-isolation decision.
19
+ Copied behavior tests and entry-purity coverage await coordinator verification.
20
+
21
+
22
+ ### Integration of extracted APIs
23
+
24
+ - Complete the universal `./glue` surface: manifest validation, capability gates, dispatch resolution, content lifecycle/event attachment and isolated tool registration. Host vocabulary, wired sites, dispatcher and delegates remain required inputs; no new runtime dependencies.
25
+ - **BREAKING:** Empty glue attachment options use `Record<string, never>`, rejecting scalar options. Public functions, constructors and host delegates use required/optional argument objects; existing names are retained. See `API.md` for examples. Verification remains pending.
26
+
27
+ - Add host-independent glue validation, capability gates, dispatch and attachment delegates at `./glue`, with required vocabulary and host ports. The host runtime is now publishable; verification remains pending (owner directive).
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for describing the origin of the Work and
141
+ reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Support. While redistributing the Work or
166
+ Derivative Works thereof, You may choose to offer, and charge a
167
+ fee for, acceptance of support, warranty, indemnity, or other
168
+ liability obligations and/or rights consistent with this License.
169
+ However, in accepting such obligations, You may act only on Your
170
+ own behalf and on Your sole responsibility, not on behalf of any
171
+ other Contributor, and only if You agree to indemnify, defend,
172
+ and hold each Contributor harmless for any liability incurred by,
173
+ or claims asserted against, such Contributor by reason of your
174
+ accepting any such warranty or support.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 Open Design contributors
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md CHANGED
@@ -1,3 +1,61 @@
1
- # Temporary Holding Version
1
+ # `@jini-ai/plugins`
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ The `./glue` subpath provides host-independent manifest validation, capability gates, dispatch and attachment delegates. The package is publishable with public npm access.
4
+
5
+ Supply `vocabulary` to `validateGlueManifest`, `vocabulary` and `coreDelegates` to `buildGlueCapabilityGate`, and `wiredCallSites` to dispatch. Host delegates use required/optional argument objects. Content lifecycle and event failures propagate; tool contributions are quarantined independently. `registerTools` must mount a module atomically or throw without leaving a partial mount.
6
+
7
+ `./glue` is a universal runtime entry with no runtime dependencies. Every public callable takes
8
+ a required argument object and accepts an optional settings object; empty settings use
9
+ `Record<string, never>`. See [API.md](https://github.com/AINSEP/Jini/blob/main/packages/plugins/API.md) for the full glue surface and host-port examples.
10
+
11
+ ## What used to be here
12
+
13
+ Support for the third-party **Agent Plugins** open standard (types, validators) plus this
14
+ package's bundled plugins (`ui-ux-design`, `create-the host-theme`) lived here under a `./agent-plugins`
15
+ subpath through 2026-08-17. On 2026-08-18 all of that moved out to its own package,
16
+ **`@jini-ai/agent-plugins`**, since there was no longer a second plugin format sharing this
17
+ namespace to disambiguate against. See that package's README for everything Agent-Plugins-related.
18
+
19
+ ## Plugin host runtime
20
+
21
+ - `./host` is universal: manifest validation, claim conflicts, activation, quarantine, hook composition,
22
+ declarative-enable orchestration and uninstall policy. It has no Node imports or code evaluation.
23
+ - `./host/node` owns discovery, bounded package reads, installation and snapshots, and the ordered
24
+ integrity → SDK compatibility → injected import → setup pipeline.
25
+ - `./host/worker` provides the Tier-2 protocol, proxy importer and worker call orchestration.
26
+ - `./host/sql` adapts `StorageKernel` using required `tables: { activations }`; it retains the existing
27
+ `plugin_activations` columns without assuming a host table name.
28
+
29
+ All functions use `(required, optional = {})`. Registry methods take objects. Existing error
30
+ constructors and plugin SDK callbacks retain their established ABI. Bind `PluginSdkBinding` (hook
31
+ ids, semantics, runtime SDK version, export validation and SDK assembly), `capabilityVocabulary`,
32
+ `declarativeContentTypes`, and the host's `coreOwnerName`. Node loading requires `importModule`,
33
+ `verifyDigest` and `tierPolicy`; installation additionally requires `archiveReader`. These inputs
34
+ have no executable or product-policy defaults. The import port matches Phase 13's
35
+ `{ plugin, modulePath } → { exported } | refusal` contract structurally, without an L4 dependency.
36
+
37
+ The application owns contained executable import and fresh snapshot selection, including Tier-2
38
+ worker execution. Tier-1 never imports code, Tier-2 requires `tierPolicy.execution: 'worker'`, and
39
+ Tier-3 requires `tierPolicy.allowLoad` to allow it. Archive readers own ZIP parsing, zip-slip checks,
40
+ entry limits and bounded decompression; `readSitePluginArchive` remains the Tovu adapter.
41
+ The content-type grammar and create/write implementation remain host ports.
42
+
43
+ ```ts
44
+ import { validateManifest } from '@jini-ai/plugins/host';
45
+ const result = validateManifest({
46
+ manifest, folderName, builtInIds,
47
+ pluginSdkBinding, capabilityVocabulary, declarativeContentTypes, coreOwnerName,
48
+ }, {});
49
+ ```
50
+
51
+ Host-only packages are optional peers so installing the dependency-free `./glue` domain does not
52
+ install them. Hosts using `./host` must install `semver` and `@jini-ai/core`; SQL hosts also install
53
+ `kysely` and `@jini-ai/db`.
54
+
55
+ Historical note — 2026-08-18: [DR-005 portable package boundaries](../../docs/decisions/DR-005-portable-package-boundaries.md)
56
+ kept the host format reserved until a real consumer justified its implementation. The 2026-10-07
57
+ p6 extraction implements that format under the approved CMS/Jini modular design Rev 3.
58
+
59
+ ## Design decisions
60
+
61
+ - [Attachment vocabulary and failure containment are separate decisions](docs/decisions/DR-001-category-specific-glue-containment.md).
@@ -0,0 +1,52 @@
1
+ /**
2
+ * @file `attachGlueContentLifecycle()` — the content-lifecycle attachment point (SPEC-048 REQ-5;
3
+ * ADR-057 Decision 2's `content.entry.beforeSave` adapter row, Decision 2.1).
4
+ *
5
+ * Purpose:
6
+ * The wired adapter for the one category that stays **fail-closed, unchanged** (ADR-057 Decision 4
7
+ * — data-mutation call sites are never fail-isolated). This module owns none of that containment
8
+ * logic itself: it delegates straight to {@link GlueHostPort.attachContentLifecycleFilter}, whose
9
+ * real, host-specific implementation is expected to attach the given filter to a live
10
+ * `hook-registry.ts` instance via `Jini/packages/plugins/src/host/node/loader.ts`'s `attachLoadedPlugin()` — the shared
11
+ * extraction ADR-057 Decision 2.1 introduced, with the `"glue"` source. That composition (a real
12
+ * `HookRegistry` plus `attachLoadedPlugin`) is host-specific wiring and does not belong in this
13
+ * product-neutral module; see `__tests__/integration/content-lifecycle.integration.test.ts` for a
14
+ * worked example proving the two compose correctly end to end.
15
+ *
16
+ * Product-neutral core: depends only on `../ports` (the frozen `GlueHostPort` seam). No import of
17
+ * `plugin-runtime`, `hook-registry.ts`, or anything else host-specific — the fail-closed
18
+ * *mechanism* this category relies on lives entirely behind the port, not in this file.
19
+ *
20
+ * Architectural role:
21
+ * Implementation Outline slice 2 (ADR-057, Implementation Outline). Depends on slice 1's frozen
22
+ * `manifest.ts`/`ports.ts` contracts.
23
+ */
24
+ import type { GlueContentLifecycleFilter, GlueFieldDecl } from "../ports.js";
25
+ export interface AttachGlueContentLifecycleRequired<Filter = GlueContentLifecycleFilter> {
26
+ readonly moduleId: string;
27
+ /** The glue module's already-obtained `content.entry.beforeSave` filter — how it was obtained
28
+ * (a `setup()` call gated by this module's own granted `GlueCapability` set) is the loader's
29
+ * concern, not this attachment point's. */
30
+ readonly filter: Filter;
31
+ readonly declaredFields: readonly GlueFieldDecl[];
32
+ readonly hostPort: {
33
+ attachContentLifecycleFilter(required: {
34
+ moduleId: string;
35
+ filter: Filter;
36
+ declaredFields: readonly GlueFieldDecl[];
37
+ }): void;
38
+ };
39
+ }
40
+ export type AttachGlueContentLifecycleOptional = Record<string, never>;
41
+ /**
42
+ * Attaches one glue module's content-lifecycle filter via the host port. Pure delegation — this
43
+ * function adds no containment or validation of its own, matching ADR-057 Decision 4's explicit
44
+ * instruction that this category stays fail-closed and unchanged from `hook-registry.ts`'s existing
45
+ * discipline (a throw here is expected to propagate, not be caught).
46
+ *
47
+ * @throws Whatever `hostPort.attachContentLifecycleFilter()` itself throws — never caught here.
48
+ * @complexity O(1) — a single delegated call.
49
+ * @overallScore 100/100
50
+ */
51
+ export declare function attachGlueContentLifecycle<Filter = GlueContentLifecycleFilter>(required: AttachGlueContentLifecycleRequired<Filter>, _optional?: AttachGlueContentLifecycleOptional): void;
52
+ //# sourceMappingURL=content-lifecycle.d.ts.map
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Attaches one glue module's content-lifecycle filter via the host port. Pure delegation — this
3
+ * function adds no containment or validation of its own, matching ADR-057 Decision 4's explicit
4
+ * instruction that this category stays fail-closed and unchanged from `hook-registry.ts`'s existing
5
+ * discipline (a throw here is expected to propagate, not be caught).
6
+ *
7
+ * @throws Whatever `hostPort.attachContentLifecycleFilter()` itself throws — never caught here.
8
+ * @complexity O(1) — a single delegated call.
9
+ * @overallScore 100/100
10
+ */
11
+ export function attachGlueContentLifecycle(required, _optional = {}) {
12
+ const { moduleId, filter, declaredFields, hostPort } = required;
13
+ hostPort.attachContentLifecycleFilter({ moduleId, filter, declaredFields });
14
+ }
15
+ //# sourceMappingURL=content-lifecycle.js.map
@@ -0,0 +1,12 @@
1
+ import type { GlueHostPort } from "../ports.js";
2
+ export interface SubscribeGlueEventRequired {
3
+ readonly moduleId: string;
4
+ readonly eventName: string;
5
+ readonly handler: (required: {
6
+ payload: unknown;
7
+ }) => Promise<void> | void;
8
+ readonly hostPort: Pick<GlueHostPort, "subscribeEvent">;
9
+ }
10
+ export type SubscribeGlueEventOptional = Record<string, never>;
11
+ export declare function subscribeGlueEvent(required: SubscribeGlueEventRequired, _optional?: SubscribeGlueEventOptional): void;
12
+ //# sourceMappingURL=events.d.ts.map
@@ -0,0 +1,5 @@
1
+ export function subscribeGlueEvent(required, _optional = {}) {
2
+ const { moduleId, eventName, handler, hostPort } = required;
3
+ hostPort.subscribeEvent({ moduleId, eventName, handler });
4
+ }
5
+ //# sourceMappingURL=events.js.map
@@ -0,0 +1,23 @@
1
+ import type { GlueHostPort, GlueToolRegistration } from "../ports.js";
2
+ export interface GlueToolModuleContribution {
3
+ readonly moduleId: string;
4
+ readonly build: (required: Record<string, never>) => readonly GlueToolRegistration[];
5
+ }
6
+ export interface MergeGlueToolRegistrationsRequired {
7
+ readonly coreToolIds: readonly string[];
8
+ readonly glueModules: readonly GlueToolModuleContribution[];
9
+ readonly hostPort: Pick<GlueHostPort, "registerTools">;
10
+ }
11
+ export type MergeGlueToolRegistrationsOptional = Record<string, never>;
12
+ export type GlueToolQuarantineReason = "THROW" | "DUPLICATE_TOOL_ID";
13
+ export interface GlueToolQuarantineEntry {
14
+ readonly moduleId: string;
15
+ readonly reason: GlueToolQuarantineReason;
16
+ readonly detail: string;
17
+ }
18
+ export interface MergeGlueToolRegistrationsResult {
19
+ readonly registeredModuleIds: readonly string[];
20
+ readonly quarantined: readonly GlueToolQuarantineEntry[];
21
+ }
22
+ export declare function mergeGlueToolRegistrations(required: MergeGlueToolRegistrationsRequired, _optional?: MergeGlueToolRegistrationsOptional): MergeGlueToolRegistrationsResult;
23
+ //# sourceMappingURL=tool-registration.d.ts.map
@@ -0,0 +1,43 @@
1
+ export function mergeGlueToolRegistrations(required, _optional = {}) {
2
+ const { coreToolIds, glueModules, hostPort } = required;
3
+ const claimedToolIds = new Set(coreToolIds);
4
+ const registeredModuleIds = [];
5
+ const quarantined = [];
6
+ const quarantine = (moduleId, reason, detail) => {
7
+ quarantined.push({ moduleId, reason, detail });
8
+ };
9
+ const messageOf = (error) => (error instanceof Error ? error.message : String(error));
10
+ for (const module of glueModules) {
11
+ let registrations;
12
+ try {
13
+ registrations = module.build({});
14
+ }
15
+ catch (error) {
16
+ quarantine(module.moduleId, "THROW", `registration build failed: ${messageOf(error)}`);
17
+ continue;
18
+ }
19
+ const moduleToolIds = new Set();
20
+ const duplicate = registrations.find((registration) => {
21
+ if (claimedToolIds.has(registration.toolId) || moduleToolIds.has(registration.toolId))
22
+ return true;
23
+ moduleToolIds.add(registration.toolId);
24
+ return false;
25
+ });
26
+ if (duplicate) {
27
+ quarantine(module.moduleId, "DUPLICATE_TOOL_ID", `tool id '${duplicate.toolId}' is already registered by core or an earlier glue module`);
28
+ continue;
29
+ }
30
+ try {
31
+ hostPort.registerTools({ moduleId: module.moduleId, registrations });
32
+ }
33
+ catch (error) {
34
+ quarantine(module.moduleId, "THROW", `host port registration failed: ${messageOf(error)}`);
35
+ continue;
36
+ }
37
+ for (const registration of registrations)
38
+ claimedToolIds.add(registration.toolId);
39
+ registeredModuleIds.push(module.moduleId);
40
+ }
41
+ return { registeredModuleIds, quarantined };
42
+ }
43
+ //# sourceMappingURL=tool-registration.js.map
@@ -0,0 +1,73 @@
1
+ /**
2
+ * @file `buildGlueCapabilityGate()` — capability-scoped delegate handle for `GlueCapability`
3
+ * (SPEC-048 REQ-1/REQ-4; ADR-057 CIC-1, `ESCALATE_SECURITY`).
4
+ *
5
+ * Purpose:
6
+ * Extends the sibling plugin mechanism's own `gate()` pattern (always-present, granted-delegates,
7
+ * ungranted-throws) to the wider eight-member glue capability vocabulary. **Default-deny**: a
8
+ * capability absent from the granted set is never silently omitted from the returned handle — it
9
+ * is present as a callable stub that synchronously throws a classified `GlueCapabilityDeniedError`
10
+ * naming the missing capability. A bare `TypeError` on an absent property is exactly the wrong
11
+ * implementation this mirrors the sibling mechanism's own CIC in guarding against.
12
+ *
13
+ * **A module cannot grow its own capability set through this gate.** The granted set is a snapshot
14
+ * taken once, at build time, from a caller-supplied list — never read from anything the gated
15
+ * module itself holds a reference to or could write. The returned handle is frozen; there is no
16
+ * setter, no admin surface, and no code path from inside a delegate call back into the granted
17
+ * set. Widening what a module can do requires building a new gate from a re-approved manifest, not
18
+ * calling anything this module exports.
19
+ *
20
+ * Capabilities are exposed by handle only: every granted position is a plain closure the caller
21
+ * supplies (`coreDelegates`), never a raw filesystem, network, or process handle. This module has
22
+ * zero I/O of its own — it is pure wiring between "is this granted" and "which closure runs."
23
+ *
24
+ * Architectural role:
25
+ * Design-frozen contract for the extension-glue-tier work (ADR-057, Implementation Outline slice
26
+ * 1). Depends on `./manifest`'s `GlueCapability` type and `core/`'s shared capability vocabulary
27
+ * — no host-specific dependency.
28
+ */
29
+ import type { GlueCapability } from './manifest.js';
30
+ export declare class GlueCapabilityDeniedError extends Error {
31
+ readonly moduleId: string;
32
+ readonly capability: GlueCapability;
33
+ constructor(required: {
34
+ moduleId: string;
35
+ capability: GlueCapability;
36
+ }, _optional?: Record<string, never>);
37
+ }
38
+ /** Every capability position resolves to one of these once gated. Untyped args/return —
39
+ * each capability's real signature is owned by whichever attachment-point adapter backs it
40
+ * (later slices), never by this generic gate. */
41
+ export type GlueCapabilityDelegate = (required: Readonly<Record<string, unknown>>, optional?: Readonly<Record<string, unknown>>) => unknown;
42
+ export interface BuildGlueCapabilityGateRequired {
43
+ readonly moduleId: string;
44
+ /** The closed, eight-member vocabulary this gate always exposes a position for, regardless of
45
+ * grant set (CIC-1's "always present" property, made an iterable constant so the gate and its
46
+ * tests share one source of truth for "every position"). */
47
+ readonly vocabulary: readonly GlueCapability[];
48
+ /** The manifest's declared capability set (already validated against the v1 vocabulary by
49
+ * `validateGlueManifest()` — this function trusts its input is well-formed capability strings,
50
+ * same division of labor as the sibling mechanism's own capability-gate). */
51
+ readonly capabilities: readonly GlueCapability[];
52
+ /** The real backing implementation for every granted position, supplied by the caller (a later
53
+ * slice's loader, closing over that specific module load's host-port-backed state). This module
54
+ * never reaches into any host mechanism directly. */
55
+ readonly coreDelegates: Readonly<Record<GlueCapability, GlueCapabilityDelegate>>;
56
+ }
57
+ export type BuildGlueCapabilityGateOptional = Record<string, never>;
58
+ /**
59
+ * Builds one glue module's capability-scoped delegate handle. Every one of the eight
60
+ * `GlueCapability` positions is always present on the returned object (CIC-1) — granted positions
61
+ * delegate to `coreDelegates`, ungranted positions are stubs that throw `GlueCapabilityDeniedError`
62
+ * when invoked (never at build time — the stub itself is a normal, present function; only calling
63
+ * it throws). The returned object is frozen: no caller, including the gated module itself, can add,
64
+ * remove, or replace a position after the gate is built.
65
+ *
66
+ * @throws Nothing at build time. The returned handle's ungranted-position stubs throw
67
+ * `GlueCapabilityDeniedError` synchronously when invoked.
68
+ * @complexity O(1) — eight capability checks, fixed-size regardless of the caller-supplied
69
+ * `capabilities` array's length.
70
+ * @overallScore 100/100
71
+ */
72
+ export declare function buildGlueCapabilityGate(required: BuildGlueCapabilityGateRequired, _optional?: BuildGlueCapabilityGateOptional): Readonly<Record<GlueCapability, GlueCapabilityDelegate>>;
73
+ //# sourceMappingURL=capability-gate.d.ts.map
@@ -0,0 +1,41 @@
1
+ export class GlueCapabilityDeniedError extends Error {
2
+ moduleId;
3
+ capability;
4
+ constructor(required, _optional = {}) {
5
+ super(`module '${required.moduleId}' invoked '${required.capability}' without declaring it in its manifest capabilities`);
6
+ this.name = 'GlueCapabilityDeniedError';
7
+ this.moduleId = required.moduleId;
8
+ this.capability = required.capability;
9
+ }
10
+ }
11
+ /**
12
+ * Builds one glue module's capability-scoped delegate handle. Every one of the eight
13
+ * `GlueCapability` positions is always present on the returned object (CIC-1) — granted positions
14
+ * delegate to `coreDelegates`, ungranted positions are stubs that throw `GlueCapabilityDeniedError`
15
+ * when invoked (never at build time — the stub itself is a normal, present function; only calling
16
+ * it throws). The returned object is frozen: no caller, including the gated module itself, can add,
17
+ * remove, or replace a position after the gate is built.
18
+ *
19
+ * @throws Nothing at build time. The returned handle's ungranted-position stubs throw
20
+ * `GlueCapabilityDeniedError` synchronously when invoked.
21
+ * @complexity O(1) — eight capability checks, fixed-size regardless of the caller-supplied
22
+ * `capabilities` array's length.
23
+ * @overallScore 100/100
24
+ */
25
+ // The caller supplies the vocabulary; the preserved CIC rationale describes Tovu's eight-slot host.
26
+ // Capability-specific arguments remain owned by the supplied attachment-point delegates.
27
+ export function buildGlueCapabilityGate(required, _optional = {}) {
28
+ // Defensive copy: a caller-side mutation of the `capabilities` array after this call must never
29
+ // change what this already-built gate grants (part of CIC-1's "cannot grow its own capability
30
+ // set" property — the snapshot is taken once, here, and never re-read).
31
+ const granted = new Set(required.capabilities);
32
+ const handle = Object.create(null);
33
+ for (const capability of required.vocabulary) {
34
+ const delegate = Object.hasOwn(required.coreDelegates, capability) ? required.coreDelegates[capability] : undefined;
35
+ handle[capability] = granted.has(capability) && typeof delegate === 'function'
36
+ ? delegate
37
+ : (_required, _optional) => { throw new GlueCapabilityDeniedError({ moduleId: required.moduleId, capability }); };
38
+ }
39
+ return Object.freeze(handle);
40
+ }
41
+ //# sourceMappingURL=capability-gate.js.map
@@ -0,0 +1,20 @@
1
+ export type GlueDispatcherPort = (required: {
2
+ moduleId: string;
3
+ callSite: string;
4
+ payload: Readonly<Record<string, unknown>>;
5
+ }) => unknown;
6
+ /** Host delegates define what a wired call site does; unwired sites never silently dispatch. */
7
+ export declare function dispatchGlueAttachment(required: {
8
+ moduleId: string;
9
+ callSite: string;
10
+ payload: Readonly<Record<string, unknown>>;
11
+ wiredCallSites: readonly string[];
12
+ dispatch: GlueDispatcherPort;
13
+ }, _optional?: Record<string, never>): {
14
+ readonly wired: false;
15
+ readonly code: 'UNWIRED_CALL_SITE';
16
+ } | {
17
+ readonly wired: true;
18
+ readonly result: unknown;
19
+ };
20
+ //# sourceMappingURL=dispatch.d.ts.map
@@ -0,0 +1,9 @@
1
+ import { resolveCallSiteDispatch } from './manifest.js';
2
+ /** Host delegates define what a wired call site does; unwired sites never silently dispatch. */
3
+ export function dispatchGlueAttachment(required, _optional = {}) {
4
+ const status = resolveCallSiteDispatch(required);
5
+ if (!status.wired)
6
+ return status;
7
+ return { wired: true, result: required.dispatch({ moduleId: required.moduleId, callSite: required.callSite, payload: required.payload }) };
8
+ }
9
+ //# sourceMappingURL=dispatch.js.map
@@ -0,0 +1,8 @@
1
+ export * from './manifest.js';
2
+ export * from './ports.js';
3
+ export * from './capability-gate.js';
4
+ export * from './dispatch.js';
5
+ export * from './attachment-points/content-lifecycle.js';
6
+ export * from './attachment-points/events.js';
7
+ export * from './attachment-points/tool-registration.js';
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,8 @@
1
+ export * from './manifest.js';
2
+ export * from './ports.js';
3
+ export * from './capability-gate.js';
4
+ export * from './dispatch.js';
5
+ export * from './attachment-points/content-lifecycle.js';
6
+ export * from './attachment-points/events.js';
7
+ export * from './attachment-points/tool-registration.js';
8
+ //# sourceMappingURL=index.js.map