@jini-ai/agent-plugins 0.7.2 → 0.7.3-next.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 (235) hide show
  1. package/CHANGELOG.md +4 -6
  2. package/NOTICE +2 -0
  3. package/README.md +11 -15
  4. package/calendly/plugin.json +3 -3
  5. package/cloudflare/lib/forms.mjs +9 -10
  6. package/cloudflare/lib/target.mjs +1 -1
  7. package/cloudflare/plugin.json +3 -3
  8. package/cloudflare/worker/forms-receiver.mjs +9 -9
  9. package/composio/plugin.json +3 -3
  10. package/core/persistent-state.js +227 -163
  11. package/dist/admin-surfaces/connections/connections.d.ts +11 -6
  12. package/dist/admin-surfaces/connections/connections.js +102 -85
  13. package/dist/admin-surfaces/node.d.ts +27 -0
  14. package/dist/admin-surfaces/node.js +32 -0
  15. package/dist/admin-surfaces/plugin-state.js +21 -18
  16. package/dist/admin-surfaces/surface-client.d.ts +4 -0
  17. package/dist/admin-surfaces/surface-client.js +124 -117
  18. package/dist/admin-surfaces/surface-handlers.js +21 -17
  19. package/dist/admin-surfaces/theme.d.ts +5 -1
  20. package/dist/admin-surfaces/theme.js +3 -3
  21. package/dist/connect/access-token-tool.d.ts +3 -1
  22. package/dist/connect/access-token-tool.js +3 -2
  23. package/dist/connect/apply-connect-defaults.js +2 -2
  24. package/dist/connect/apply-tool-renames.js +9 -8
  25. package/dist/connect/connect-tool.d.ts +2 -0
  26. package/dist/connect/connect-tool.js +3 -2
  27. package/dist/connect/credential-cards.js +3 -2
  28. package/dist/connect/credential-save-tool.d.ts +14 -11
  29. package/dist/connect/credential-save-tool.js +128 -121
  30. package/dist/connect/enable-access.d.ts +2 -2
  31. package/dist/connect/enable-access.js +6 -6
  32. package/dist/connect/executable/register.js +40 -34
  33. package/dist/connect/federate-mcp.d.ts +21 -11
  34. package/dist/connect/federate-mcp.js +28 -21
  35. package/dist/connect/grant-signed-in-defaults.js +3 -3
  36. package/dist/connect/import-access-token.js +2 -1
  37. package/dist/connect/index.d.ts +1 -0
  38. package/dist/connect/index.js +1 -0
  39. package/dist/connect/plugin-credential-card.js +2 -1
  40. package/dist/connect/plugin-host/index.d.ts +9 -5
  41. package/dist/connect/plugin-host/index.js +113 -100
  42. package/dist/connect/ports.d.ts +1 -1
  43. package/dist/connect/row-update.d.ts +22 -0
  44. package/dist/connect/row-update.js +18 -0
  45. package/dist/connect/switch-on-saved-token.d.ts +4 -2
  46. package/dist/connect/switch-on-saved-token.js +1 -1
  47. package/dist/connect/token-map.d.ts +44 -0
  48. package/dist/connect/token-map.js +49 -0
  49. package/dist/core/identity-namespace.js +5 -0
  50. package/dist/folder-zip.d.ts +3 -1
  51. package/dist/folder-zip.js +2 -2
  52. package/dist/lifecycle/activation.d.ts +4 -4
  53. package/dist/lifecycle/activation.js +4 -5
  54. package/dist/lifecycle/automatic-use.js +236 -210
  55. package/dist/lifecycle/bundled-digests.d.ts +75 -12
  56. package/dist/lifecycle/bundled-digests.js +213 -212
  57. package/dist/lifecycle/bundled-source-archive.d.ts +1 -1
  58. package/dist/lifecycle/bundled-source-archive.js +263 -264
  59. package/dist/lifecycle/capability-projection.d.ts +1 -1
  60. package/dist/lifecycle/capability-projection.js +1 -1
  61. package/dist/lifecycle/credential-card-metadata.d.ts +1 -1
  62. package/dist/lifecycle/credential-card-metadata.js +27 -3
  63. package/dist/lifecycle/exports.js +9 -4
  64. package/dist/lifecycle/fetch-archive.d.ts +1 -1
  65. package/dist/lifecycle/fetch-archive.js +1 -1
  66. package/dist/lifecycle/host-tools/identity.js +3 -2
  67. package/dist/lifecycle/host-tools/ports.d.ts +2 -0
  68. package/dist/lifecycle/host-tools/search-tool.js +8 -8
  69. package/dist/lifecycle/host-tools/skill-tool.d.ts +18 -2
  70. package/dist/lifecycle/host-tools/skill-tool.js +16 -8
  71. package/dist/lifecycle/index.d.ts +118 -110
  72. package/dist/lifecycle/index.js +45 -12
  73. package/dist/lifecycle/install-errors.d.ts +1 -1
  74. package/dist/lifecycle/install-from-url.d.ts +1 -1
  75. package/dist/lifecycle/install-from-url.js +1 -1
  76. package/dist/lifecycle/install.d.ts +7 -2
  77. package/dist/lifecycle/install.js +414 -396
  78. package/dist/lifecycle/installed-package-index.js +45 -42
  79. package/dist/lifecycle/layout.d.ts +1 -1
  80. package/dist/lifecycle/layout.js +1 -1
  81. package/dist/lifecycle/mail/catalog.d.ts +8 -32
  82. package/dist/lifecycle/mail/catalog.js +25 -20
  83. package/dist/lifecycle/mail/contribution.d.ts +2 -2
  84. package/dist/lifecycle/mail/contribution.js +34 -34
  85. package/dist/lifecycle/mail/selection.js +6 -2
  86. package/dist/lifecycle/manifest.d.ts +3 -3
  87. package/dist/lifecycle/manifest.js +4 -4
  88. package/dist/lifecycle/mcp-provisioning.d.ts +3 -3
  89. package/dist/lifecycle/mcp-provisioning.js +3 -3
  90. package/dist/lifecycle/package-paths.d.ts +1 -1
  91. package/dist/lifecycle/package-paths.js +1 -1
  92. package/dist/lifecycle/persistent-state.js +1 -2
  93. package/dist/lifecycle/ports.d.ts +5 -1
  94. package/dist/lifecycle/resolve-agent-plugin-refs.d.ts +30 -8
  95. package/dist/lifecycle/resolve-agent-plugin-refs.js +227 -228
  96. package/dist/lifecycle/retire-bundled.d.ts +1 -52
  97. package/dist/lifecycle/retire-bundled.js +134 -84
  98. package/dist/lifecycle/search.d.ts +2 -1
  99. package/dist/lifecycle/search.js +1 -1
  100. package/dist/lifecycle/seed-bundled.d.ts +1 -1
  101. package/dist/lifecycle/seed-bundled.js +154 -155
  102. package/dist/lifecycle/set-enabled.d.ts +1 -1
  103. package/dist/lifecycle/set-enabled.js +1 -1
  104. package/dist/lifecycle/skill-file-reader.js +53 -50
  105. package/dist/lifecycle/tools/projection.d.ts +4 -7
  106. package/dist/lifecycle/tools/projection.js +109 -108
  107. package/dist/lifecycle/trusted-plugin-files.d.ts +2 -2
  108. package/dist/lifecycle/trusted-plugin-files.js +1 -1
  109. package/dist/lifecycle/uninstall.d.ts +1 -1
  110. package/dist/lifecycle/uninstall.js +237 -241
  111. package/dist/lifecycle/update-store.js +20 -17
  112. package/dist/lifecycle/update.js +287 -281
  113. package/dist/lifecycle/yauzl-archive-reader.d.ts +2 -2
  114. package/dist/lifecycle/yauzl-archive-reader.js +8 -2
  115. package/dist/manifest.d.ts +11 -3
  116. package/dist/manifest.js +9 -9
  117. package/fly/jini-credential-schemes.json +11 -0
  118. package/fly/plugin.json +3 -4
  119. package/github/plugin.json +3 -3
  120. package/github/source-control/backup-push.mjs +11 -11
  121. package/github/source-control/commit-site.mjs +3 -3
  122. package/github/source-control/github.mjs +12 -6
  123. package/github/source-control/write-files.mjs +27 -28
  124. package/github-pages/{tovu-deploy-targets.json → jini-deploy-targets.json} +22 -22
  125. package/github-pages/plugin.json +3 -3
  126. package/github-pages/targets/github-pages.mjs +3 -3
  127. package/google-login/plugin.json +3 -3
  128. package/google-workspace/README.md +14 -14
  129. package/google-workspace/form-destinations/README.md +3 -3
  130. package/google-workspace/form-destinations/dedupe.mjs +1 -1
  131. package/google-workspace/form-destinations/mapping.mjs +8 -9
  132. package/google-workspace/form-destinations/sheets.mjs +1 -1
  133. package/google-workspace/{tovu-admin-surfaces.json → jini-admin-surfaces.json} +2 -2
  134. package/google-workspace/{tovu-agent-tools.json → jini-agent-tools.json} +28 -28
  135. package/google-workspace/{tovu-connections.json → jini-connections.json} +2 -2
  136. package/google-workspace/lib/auth.mjs +2 -2
  137. package/google-workspace/lib/form-destination-settings.mjs +1 -1
  138. package/google-workspace/lib/picker-flow.mjs +2 -2
  139. package/google-workspace/lib/request-policy.mjs +1 -1
  140. package/google-workspace/lib/surface-actions.mjs +1 -1
  141. package/google-workspace/plugin.json +3 -3
  142. package/google-workspace/tools/sheets/README.md +3 -3
  143. package/google-workspace/tools/sheets-admin/README.md +3 -3
  144. package/google-workspace/ui/README.md +4 -4
  145. package/google-workspace/ui/connection-panel.mjs +51 -51
  146. package/google-workspace/ui/destination-panel.mjs +34 -34
  147. package/google-workspace/ui/dom.mjs +15 -16
  148. package/google-workspace/ui/picker-flow.mjs +2 -2
  149. package/google-workspace/ui/picker.mjs +19 -19
  150. package/google-workspace/ui/surface-client.mjs +96 -69
  151. package/higgsfield-media/plugin.json +3 -3
  152. package/jev/plugin.json +3 -3
  153. package/kuinetic/CHANGELOG.md +12 -0
  154. package/kuinetic/mcp.json +4 -0
  155. package/kuinetic/plugin.json +27 -0
  156. package/kuinetic/skills/kuinetic/SKILL.md +120 -0
  157. package/kuinetic/skills/kuinetic/references/effects-by-family.md +32 -0
  158. package/kuinetic/skills/kuinetic/references/opt-in-tiers.md +12 -0
  159. package/kuinetic/skills/kuinetic/references/reserved-keys.md +36 -0
  160. package/meilisearch/plugin.json +5 -5
  161. package/netlify/plugin.json +3 -3
  162. package/netlify/targets/netlify.mjs +14 -4
  163. package/opentelemetry/plugin.json +3 -3
  164. package/package.json +25 -20
  165. package/posthog/plugin.json +3 -3
  166. package/railway/plugin.json +3 -3
  167. package/render/plugin.json +3 -3
  168. package/resend/NOTES.md +2 -2
  169. package/resend/adapters/resend.mjs +1 -1
  170. package/resend/{tovu-mail-adapters.json → jini-mail-adapters.json} +1 -1
  171. package/resend/lib/domains.mjs +8 -8
  172. package/resend/plugin.json +3 -3
  173. package/s3-compatible/{tovu-deploy-targets.json → jini-deploy-targets.json} +68 -68
  174. package/s3-compatible/jini-object-stores.json +29 -0
  175. package/s3-compatible/object-stores/s3-compatible.mjs +19 -13
  176. package/s3-compatible/plugin.json +3 -3
  177. package/s3-compatible/targets/s3-compatible.mjs +25 -25
  178. package/sentry/plugin.json +3 -3
  179. package/shadcn-ui/CHANGELOG.md +7 -0
  180. package/shadcn-ui/LICENSE +201 -0
  181. package/shadcn-ui/NOTICE +10 -0
  182. package/shadcn-ui/mcp.json +4 -0
  183. package/shadcn-ui/plugin.json +26 -0
  184. package/shopify/plugin.json +3 -3
  185. package/site-compliance/plugin.json +3 -3
  186. package/site-import/plugin.json +3 -3
  187. package/supabase/mcp.json +1 -4
  188. package/supabase/plugin.json +3 -3
  189. package/ui-ux-design/CHANGELOG.md +13 -0
  190. package/ui-ux-design/NOTICE +2 -0
  191. package/ui-ux-design/README.md +17 -7
  192. package/ui-ux-design/plugin.json +6 -3
  193. package/ui-ux-design/skills/ui-ux-design/SKILL.md +38 -152
  194. package/ui-ux-design/skills/ui-ux-design/references/full-workflow.md +156 -0
  195. package/ui-ux-design/skills/ui-ux-design/references/ui-animation.md +4 -4
  196. package/vercel/NOTES.md +1 -1
  197. package/vercel/object-stores/vercel-blob.mjs +12 -2
  198. package/vercel/plugin.json +3 -3
  199. package/vercel/targets/vercel.mjs +3 -3
  200. package/wordpress/plugin.json +3 -3
  201. package/dist/lifecycle/node.d.ts +0 -11
  202. package/dist/lifecycle/node.js +0 -38
  203. package/fly/tovu-credential-schemes.json +0 -11
  204. package/github/deployments/github.mjs +0 -415
  205. package/s3-compatible/tovu-object-stores.json +0 -29
  206. package/ui-ux-design/skills/ui-ux-design/references/kuinetic-reference.md +0 -184
  207. /package/cloudflare/{tovu-consent.json → jini-consent.json} +0 -0
  208. /package/cloudflare/{tovu-deploy-targets.json → jini-deploy-targets.json} +0 -0
  209. /package/cloudflare/{tovu-form-destinations.json → jini-form-destinations.json} +0 -0
  210. /package/fly/{tovu-deploy-configs.json → jini-deploy-configs.json} +0 -0
  211. /package/fly/{tovu-deploy-ops.json → jini-deploy-ops.json} +0 -0
  212. /package/github/{tovu-deploy-ops.json → jini-deploy-ops.json} +0 -0
  213. /package/github/{tovu-source-control.json → jini-source-control.json} +0 -0
  214. /package/google-login/{tovu-login-providers.json → jini-login-providers.json} +0 -0
  215. /package/google-workspace/{tovu-form-destinations.json → jini-form-destinations.json} +0 -0
  216. /package/meilisearch/{tovu-search-providers.json → jini-search-providers.json} +0 -0
  217. /package/netlify/{tovu-consent.json → jini-consent.json} +0 -0
  218. /package/netlify/{tovu-deploy-targets.json → jini-deploy-targets.json} +0 -0
  219. /package/railway/{tovu-deploy-configs.json → jini-deploy-configs.json} +0 -0
  220. /package/railway/{tovu-deploy-ops.json → jini-deploy-ops.json} +0 -0
  221. /package/render/{tovu-deploy-configs.json → jini-deploy-configs.json} +0 -0
  222. /package/render/{tovu-deploy-ops.json → jini-deploy-ops.json} +0 -0
  223. /package/{ui-ux-design → shadcn-ui}/skills/shadcn-ui/README.md +0 -0
  224. /package/{ui-ux-design → shadcn-ui}/skills/shadcn-ui/SKILL.md +0 -0
  225. /package/{ui-ux-design → shadcn-ui}/skills/shadcn-ui/examples/auth-layout.tsx +0 -0
  226. /package/{ui-ux-design → shadcn-ui}/skills/shadcn-ui/examples/data-table.tsx +0 -0
  227. /package/{ui-ux-design → shadcn-ui}/skills/shadcn-ui/examples/form-pattern.tsx +0 -0
  228. /package/{ui-ux-design → shadcn-ui}/skills/shadcn-ui/resources/component-catalog.md +0 -0
  229. /package/{ui-ux-design → shadcn-ui}/skills/shadcn-ui/resources/customization-guide.md +0 -0
  230. /package/{ui-ux-design → shadcn-ui}/skills/shadcn-ui/resources/migration-guide.md +0 -0
  231. /package/{ui-ux-design → shadcn-ui}/skills/shadcn-ui/resources/setup-guide.md +0 -0
  232. /package/{ui-ux-design → shadcn-ui}/skills/shadcn-ui/scripts/verify-setup.sh +0 -0
  233. /package/vercel/{tovu-consent.json → jini-consent.json} +0 -0
  234. /package/vercel/{tovu-deploy-targets.json → jini-deploy-targets.json} +0 -0
  235. /package/vercel/{tovu-object-stores.json → jini-object-stores.json} +0 -0
@@ -45,291 +45,290 @@ import { createHash } from "node:crypto";
45
45
  import { constants } from "node:fs";
46
46
  import path from "node:path";
47
47
  import { createPackagePathsModule } from "./package-paths.js";
48
- function buildModule(ports) {
49
- const readdir = ports.filesystem.readdir.bind(ports.filesystem);
50
- const readFile = ports.filesystem.readFile.bind(ports.filesystem);
51
- const MAGIC = ports.bundledArchiveMagic;
52
- const MAX_SOURCE_FILES = 2048;
53
- const { normalizePackageEntryPath } = createPackagePathsModule(ports);
54
- /**
55
- * Serialises runtime regular files under `sourceDir` into one deterministic archive.
56
- *
57
- * By default, symlinks and any other non-regular entry are skipped rather than followed: a bundled package is
58
- * this repository's own tracked content, so a symlink in it would be a mistake, and following one
59
- * is the exact vector `install.ts` refuses on the extraction side. Skipping keeps the two sides
60
- * agreeing instead of producing an archive the installer would then reject.
61
- * Optional policies can reject these entries; supplied limits bound traversal and handle reads.
62
- *
63
- * @throws {Error} If the tree holds more than {@link MAX_SOURCE_FILES} files.
64
- * @throws Propagates `readdir`/`readFile` errors — a bundled package that cannot be read is a build
65
- * defect, not a runtime condition to degrade around.
66
- * @complexity O(f log f + b) for sorting f selected files and reading b bytes, plus traversal.
67
- * Supplied limits bound source I/O; `install.ts` independently retains its extraction ceilings.
68
- */
69
- async function packAgentPluginDirectory(sourceDir, options = {}) {
70
- const state = createPackingState({ options });
71
- assertPackingLimit({ state, name: 'maxArchiveBytes', value: state.archiveBytes });
72
- await refuseRoot({ sourceDir, state });
73
- const relativePaths = (await listRegularFiles({ dir: sourceDir, prefix: '', depth: 0, state })).sort();
74
- assertSourceFileCount({ relativePaths, sourceDir });
75
- const chunks = [Buffer.from(MAGIC, "utf8")];
76
- const snapshot = [];
77
- const canonical = options.digestEncoding === 'canonical-files-v1';
78
- const digest = createHash('sha256');
79
- for (const relativePath of relativePaths) {
80
- const content = options.limits
81
- ? await readBoundedFile({ sourceDir, relativePath, state })
82
- : await readFile(path.join(sourceDir, relativePath));
83
- const pathBytes = Buffer.from(relativePath, "utf8");
84
- if (canonical) {
85
- digest.update(JSON.stringify([relativePath, content.byteLength]), 'utf8').update(content);
86
- snapshot.push({ entryPath: relativePath, content });
87
- }
88
- else {
89
- chunks.push(Buffer.from(`F ${pathBytes.byteLength} ${content.byteLength}\n`, "utf8"), pathBytes, content);
90
- }
91
- state.totalBytes += content.byteLength;
92
- if (!canonical)
93
- state.archiveBytes += encodedFileBytes({ relativePath, fileBytes: content.byteLength });
94
- }
95
- const bytes = canonical ? digest.digest() : Buffer.concat(chunks);
96
- return {
97
- bytes: new Uint8Array(bytes),
98
- sha256: createHash("sha256").update(bytes).digest("hex"),
99
- files: relativePaths,
100
- ...(canonical ? { archiveReader: createSnapshotReader({ token: bytes, snapshot }) } : {}),
101
- };
102
- }
103
- function assertSourceFileCount({ relativePaths, sourceDir }) {
104
- if (relativePaths.length > MAX_SOURCE_FILES) {
105
- throw new Error(`bundled agent plugin at '${sourceDir}' has ${relativePaths.length} files, over the ${MAX_SOURCE_FILES}-file cap — is this the right directory?`);
48
+ const MAX_SOURCE_FILES = 2048;
49
+ /**
50
+ * Serialises runtime regular files under `sourceDir` into one deterministic archive.
51
+ *
52
+ * By default, symlinks and any other non-regular entry are skipped rather than followed: a bundled package is
53
+ * this repository's own tracked content, so a symlink in it would be a mistake, and following one
54
+ * is the exact vector `install.ts` refuses on the extraction side. Skipping keeps the two sides
55
+ * agreeing instead of producing an archive the installer would then reject.
56
+ * Optional policies can reject these entries; supplied limits bound traversal and handle reads.
57
+ *
58
+ * @throws {Error} If the tree holds more than {@link MAX_SOURCE_FILES} files.
59
+ * @throws Propagates `ports.filesystem.readdir`/`ports.filesystem.readFile` errors — a bundled package that cannot be read is a build
60
+ * defect, not a runtime condition to degrade around.
61
+ * @complexity O(f log f + b) for sorting f selected files and reading b bytes, plus traversal.
62
+ * Supplied limits bound source I/O; `install.ts` independently retains its extraction ceilings.
63
+ */
64
+ async function packAgentPluginDirectory({ ports, sourceDir }, options = {}) {
65
+ const state = createPackingState(ports, { options });
66
+ assertPackingLimit({ state, name: 'maxArchiveBytes', value: state.archiveBytes });
67
+ await refuseRoot(ports, { sourceDir, state });
68
+ const relativePaths = (await listRegularFiles(ports, { dir: sourceDir, prefix: '', depth: 0, state })).sort();
69
+ assertSourceFileCount({ relativePaths, sourceDir });
70
+ const chunks = [Buffer.from(ports.bundledArchiveMagic, "utf8")];
71
+ const snapshot = [];
72
+ const canonical = options.digestEncoding === 'canonical-files-v1';
73
+ const digest = createHash('sha256');
74
+ for (const relativePath of relativePaths) {
75
+ const content = options.limits
76
+ ? await readBoundedFile(ports, { sourceDir, relativePath, state })
77
+ : await ports.filesystem.readFile(path.join(sourceDir, relativePath));
78
+ const pathBytes = Buffer.from(relativePath, "utf8");
79
+ if (canonical) {
80
+ digest.update(JSON.stringify([relativePath, content.byteLength]), 'utf8').update(content);
81
+ snapshot.push({ entryPath: relativePath, content });
106
82
  }
107
- }
108
- /** Validate caller bounds before I/O and normalize selection through the package path owner. */
109
- function createPackingState({ options }) {
110
- if (options.limits) {
111
- for (const name of ['maxEntries', 'maxDepth', 'maxFiles', 'maxFileBytes', 'maxTotalBytes', 'maxArchiveBytes']) {
112
- const value = options.limits[name];
113
- if (!Number.isSafeInteger(value) || value < 0)
114
- throw new Error(`Invalid packing limit ${name}`);
115
- }
83
+ else {
84
+ chunks.push(Buffer.from(`F ${pathBytes.byteLength} ${content.byteLength}\n`, "utf8"), pathBytes, content);
116
85
  }
117
- return {
118
- options,
119
- // A directory written as 'dist/' selects the same subtree as 'dist' (normalize already collapsed '//').
120
- allowPaths: options.allowPaths?.map(value => normalizePackageEntryPath(value).replace(/\/$/, '')),
121
- excluded: new Set(options.excludeNames ?? []),
122
- files: new Set(), entries: 0, totalBytes: 0,
123
- archiveBytes: options.digestEncoding === 'canonical-files-v1' ? 32 : Buffer.byteLength(MAGIC),
124
- };
125
- }
126
- /** Only a reject policy refuses a non-directory root. Otherwise the root is read as before:
127
- * readdir follows a symlinked root, so any options object (even all-undefined) keeps legacy output. */
128
- async function refuseRoot({ sourceDir, state }) {
129
- if (state.options.symlinkPolicy !== 'reject' && state.options.specialFilePolicy !== 'reject')
130
- return;
131
- const stat = await ports.filesystem.lstat(sourceDir);
132
- if (!stat.isDirectory())
133
- refuseEntry({ state, entryPath: sourceDir, symlink: stat.isSymbolicLink() });
134
- }
135
- function assertPackingLimit({ state, name, value }) {
136
- const limit = state.options.limits?.[name];
137
- if (limit !== undefined && value > limit)
138
- throw new Error(`bundled agent plugin exceeds packing ${name} (${limit})`);
139
- }
140
- function encodedFileBytes({ relativePath, fileBytes }) {
141
- const pathBytes = Buffer.byteLength(relativePath);
142
- return Buffer.byteLength(`F ${pathBytes} ${fileBytes}\n`) + pathBytes + fileBytes;
86
+ state.totalBytes += content.byteLength;
87
+ if (!canonical)
88
+ state.archiveBytes += encodedFileBytes({ relativePath, fileBytes: content.byteLength });
143
89
  }
144
- /** Check actual read bytes before retaining a chunk, including the bundled header/path overhead. */
145
- function checkFileBudget({ state, relativePath, fileBytes }) {
146
- assertPackingLimit({ state, name: 'maxFileBytes', value: fileBytes });
147
- assertPackingLimit({ state, name: 'maxTotalBytes', value: state.totalBytes + fileBytes });
148
- const archiveBytes = state.options.digestEncoding === 'canonical-files-v1'
149
- ? state.archiveBytes : state.archiveBytes + encodedFileBytes({ relativePath, fileBytes });
150
- assertPackingLimit({ state, name: 'maxArchiveBytes', value: archiveBytes });
90
+ const bytes = canonical ? digest.digest() : Buffer.concat(chunks);
91
+ return {
92
+ bytes: new Uint8Array(bytes),
93
+ sha256: createHash("sha256").update(bytes).digest("hex"),
94
+ files: relativePaths,
95
+ ...(canonical ? { archiveReader: createSnapshotReader({ token: bytes, snapshot }) } : {}),
96
+ };
97
+ }
98
+ function assertSourceFileCount({ relativePaths, sourceDir }) {
99
+ if (relativePaths.length > MAX_SOURCE_FILES) {
100
+ throw new Error(`bundled agent plugin at '${sourceDir}' has ${relativePaths.length} files, over the ${MAX_SOURCE_FILES}-file cap — is this the right directory?`);
151
101
  }
152
- /** Bounded handle reads also detect growing files; every success/failure closes the handle.
153
- * @throws Propagates filesystem failures and rejects a changed file kind or any exceeded cap.
154
- * @complexity O(b) bytes read, O(b) captured bytes within the supplied file/total/archive caps. */
155
- async function readBoundedFile({ sourceDir, relativePath, state }) {
156
- const { handle, stat } = await openWalkedFile({ target: path.join(sourceDir, relativePath), relativePath });
157
- try {
158
- checkFileBudget({ state, relativePath, fileBytes: stat.size });
159
- const chunks = [];
160
- let fileBytes = 0;
161
- for (;;) {
162
- const limits = state.options.limits;
163
- const remaining = Math.min(limits.maxFileBytes - fileBytes, limits.maxTotalBytes - state.totalBytes - fileBytes);
164
- const buffer = Buffer.alloc(Math.min(64 * 1024, remaining + 1));
165
- const { bytesRead } = await handle.read(buffer, 0, buffer.byteLength, null);
166
- if (bytesRead === 0)
167
- return Buffer.concat(chunks, fileBytes);
168
- fileBytes += bytesRead;
169
- checkFileBudget({ state, relativePath, fileBytes });
170
- chunks.push(buffer.subarray(0, bytesRead));
171
- }
172
- }
173
- finally {
174
- await handle.close();
102
+ }
103
+ /** Validate caller bounds before I/O and normalize selection through the package path owner. */
104
+ function createPackingState(ports, { options }) {
105
+ if (options.limits) {
106
+ for (const name of ['maxEntries', 'maxDepth', 'maxFiles', 'maxFileBytes', 'maxTotalBytes', 'maxArchiveBytes']) {
107
+ const value = options.limits[name];
108
+ if (!Number.isSafeInteger(value) || value < 0)
109
+ throw new Error(`Invalid packing limit ${name}`);
175
110
  }
176
111
  }
177
- /** O_NOFOLLOW/O_NONBLOCK do not exist on Windows, so no-follow cannot rest on open flags alone:
178
- * the opened object must also be the regular file the walk lstat'ed (same dev/ino). A link or file
179
- * swapped in between is refused, failing closed on every platform. Refusals close the handle. */
180
- async function openWalkedFile({ target, relativePath }) {
181
- const walked = await ports.filesystem.lstat(target);
182
- const handle = await ports.filesystem.open(target, constants.O_RDONLY | (constants.O_NOFOLLOW ?? 0) | (constants.O_NONBLOCK ?? 0));
183
- try {
184
- const stat = await handle.stat();
185
- if (!walked.isFile() || !stat.isFile() || stat.dev !== walked.dev || stat.ino !== walked.ino) {
186
- throw new Error(`bundled agent plugin source is no longer a regular file: '${relativePath}'`);
187
- }
188
- return { handle, stat };
189
- }
190
- catch (error) {
191
- await handle.close();
192
- throw error;
112
+ return {
113
+ options,
114
+ // A directory written as 'dist/' selects the same subtree as 'dist' (normalize already collapsed '//').
115
+ allowPaths: options.allowPaths?.map(value => createPackagePathsModule(ports).normalizePackageEntryPath(value).replace(/\/$/, '')),
116
+ excluded: new Set(options.excludeNames ?? []),
117
+ files: new Set(), entries: 0, totalBytes: 0,
118
+ archiveBytes: options.digestEncoding === 'canonical-files-v1' ? 32 : Buffer.byteLength(ports.bundledArchiveMagic),
119
+ };
120
+ }
121
+ /** Only a reject policy refuses a non-directory root. Otherwise the root is read as before:
122
+ * ports.filesystem.readdir follows a symlinked root, so any options object (even all-undefined) keeps legacy output. */
123
+ async function refuseRoot(ports, { sourceDir, state }) {
124
+ if (state.options.symlinkPolicy !== 'reject' && state.options.specialFilePolicy !== 'reject')
125
+ return;
126
+ const stat = await ports.filesystem.lstat(sourceDir);
127
+ if (!stat.isDirectory())
128
+ refuseEntry({ state, entryPath: sourceDir, symlink: stat.isSymbolicLink() });
129
+ }
130
+ function assertPackingLimit({ state, name, value }) {
131
+ const limit = state.options.limits?.[name];
132
+ if (limit !== undefined && value > limit)
133
+ throw new Error(`bundled agent plugin exceeds packing ${name} (${limit})`);
134
+ }
135
+ function encodedFileBytes({ relativePath, fileBytes }) {
136
+ const pathBytes = Buffer.byteLength(relativePath);
137
+ return Buffer.byteLength(`F ${pathBytes} ${fileBytes}\n`) + pathBytes + fileBytes;
138
+ }
139
+ /** Check actual read bytes before retaining a chunk, including the bundled header/path overhead. */
140
+ function checkFileBudget({ state, relativePath, fileBytes }) {
141
+ assertPackingLimit({ state, name: 'maxFileBytes', value: fileBytes });
142
+ assertPackingLimit({ state, name: 'maxTotalBytes', value: state.totalBytes + fileBytes });
143
+ const archiveBytes = state.options.digestEncoding === 'canonical-files-v1'
144
+ ? state.archiveBytes : state.archiveBytes + encodedFileBytes({ relativePath, fileBytes });
145
+ assertPackingLimit({ state, name: 'maxArchiveBytes', value: archiveBytes });
146
+ }
147
+ /** Bounded handle reads also detect growing files; every success/failure closes the handle.
148
+ * @throws Propagates filesystem failures and rejects a changed file kind or any exceeded cap.
149
+ * @complexity O(b) bytes read, O(b) captured bytes within the supplied file/total/archive caps. */
150
+ async function readBoundedFile(ports, { sourceDir, relativePath, state }) {
151
+ const { handle, stat } = await openWalkedFile(ports, { target: path.join(sourceDir, relativePath), relativePath });
152
+ try {
153
+ checkFileBudget({ state, relativePath, fileBytes: stat.size });
154
+ const chunks = [];
155
+ let fileBytes = 0;
156
+ for (;;) {
157
+ const limits = state.options.limits;
158
+ const remaining = Math.min(limits.maxFileBytes - fileBytes, limits.maxTotalBytes - state.totalBytes - fileBytes);
159
+ const buffer = Buffer.alloc(Math.min(64 * 1024, remaining + 1));
160
+ const { bytesRead } = await handle.read(buffer, 0, buffer.byteLength, null);
161
+ if (bytesRead === 0)
162
+ return Buffer.concat(chunks, fileBytes);
163
+ fileBytes += bytesRead;
164
+ checkFileBudget({ state, relativePath, fileBytes });
165
+ chunks.push(buffer.subarray(0, bytesRead));
193
166
  }
194
167
  }
195
- /** A token identifies only this snapshot. Copy yielded bytes so a reader cannot mutate later reads. */
196
- function createSnapshotReader({ token, snapshot }) {
197
- return {
198
- async *entries({ archive }) {
199
- if (!token.equals(archive))
200
- throw new Error('bundled agent plugin archive: snapshot token mismatch');
201
- for (const { entryPath, content } of snapshot) {
202
- yield { kind: 'file', entryPath, declaredSize: content.byteLength,
203
- openReadStream: () => onceAsyncIterable(new Uint8Array(content)) };
204
- }
205
- },
206
- };
168
+ finally {
169
+ await handle.close();
207
170
  }
208
- /**
209
- * Reads the format {@link packAgentPluginDirectory} writes, as an `AgentPluginArchiveReaderPort`.
210
- *
211
- * Yields only `kind: "file"` entries — the format has no directory, symlink, or device entries to
212
- * represent, which is itself a small safety property: the whole class of entry `install.ts` rejects
213
- * cannot be expressed in an archive this reader produces.
214
- *
215
- * @complexity O(n) in the archive's byte length; each file's bytes are yielded once, not copied
216
- * into an intermediate list.
217
- */
218
- function createBundledSourceArchiveReader() {
219
- return {
220
- entries({ archive }) {
221
- return readEntries(archive);
222
- },
223
- };
224
- }
225
- async function* readEntries(archive) {
226
- const buffer = Buffer.from(archive.buffer, archive.byteOffset, archive.byteLength);
227
- const magic = Buffer.from(MAGIC, "utf8");
228
- if (buffer.byteLength < magic.byteLength || !buffer.subarray(0, magic.byteLength).equals(magic)) {
229
- throw new Error("bundled agent plugin archive: bad magic — this reader only understands the configured bundled archive format");
230
- }
231
- let offset = magic.byteLength;
232
- while (offset < buffer.byteLength) {
233
- const newlineIndex = buffer.indexOf(0x0a, offset);
234
- if (newlineIndex === -1)
235
- throw new Error("bundled agent plugin archive: truncated entry header");
236
- const header = buffer.subarray(offset, newlineIndex).toString("utf8");
237
- const match = /^F (\d+) (\d+)$/.exec(header);
238
- if (!match)
239
- throw new Error(`bundled agent plugin archive: malformed entry header '${header}'`);
240
- const pathLength = Number(match[1]);
241
- const contentLength = Number(match[2]);
242
- const pathStart = newlineIndex + 1;
243
- const contentStart = pathStart + pathLength;
244
- const contentEnd = contentStart + contentLength;
245
- if (contentEnd > buffer.byteLength)
246
- throw new Error("bundled agent plugin archive: truncated entry body");
247
- const entryPath = buffer.subarray(pathStart, contentStart).toString("utf8");
248
- const content = buffer.subarray(contentStart, contentEnd);
249
- yield {
250
- kind: "file",
251
- entryPath,
252
- declaredSize: contentLength,
253
- openReadStream: () => onceAsyncIterable(new Uint8Array(content)),
254
- };
255
- offset = contentEnd;
171
+ }
172
+ /** O_NOFOLLOW/O_NONBLOCK do not exist on Windows, so no-follow cannot rest on open flags alone:
173
+ * the opened object must also be the regular file the walk lstat'ed (same dev/ino). A link or file
174
+ * swapped in between is refused, failing closed on every platform. Refusals close the handle. */
175
+ async function openWalkedFile(ports, { target, relativePath }) {
176
+ const walked = await ports.filesystem.lstat(target);
177
+ const handle = await ports.filesystem.open(target, constants.O_RDONLY | (constants.O_NOFOLLOW ?? 0) | (constants.O_NONBLOCK ?? 0));
178
+ try {
179
+ const stat = await handle.stat();
180
+ if (!walked.isFile() || !stat.isFile() || stat.dev !== walked.dev || stat.ino !== walked.ino) {
181
+ throw new Error(`bundled agent plugin source is no longer a regular file: '${relativePath}'`);
256
182
  }
183
+ return { handle, stat };
257
184
  }
258
- /** One-shot async iterable over a single chunk — the shape `AgentPluginArchiveEntry.openReadStream`
259
- * wants, without pulling in a stream implementation for an already-in-memory buffer. */
260
- async function* onceAsyncIterable(chunk) {
261
- yield chunk;
185
+ catch (error) {
186
+ await handle.close();
187
+ throw error;
262
188
  }
263
- /**
264
- * Lists runtime regular files under `dir`, as POSIX-style package-relative paths.
265
- * By default, test directories and test/spec files are excluded so test-only edits cannot change installed
266
- * runtime contents or their content-addressed digest.
267
- *
268
- * @complexity O(e * (a + s)) selection checks for e entries, a allowlist paths and s suffixes.
269
- * Path comparison cost scales with path length; selection uses O(1) auxiliary space per entry.
270
- */
271
- async function listRegularFiles({ dir, prefix, depth, state }) {
272
- const entries = await readdir(dir, { withFileTypes: true });
273
- state.entries += entries.length;
274
- assertPackingLimit({ state, name: 'maxEntries', value: state.entries });
275
- const files = [];
276
- for (const entry of entries) {
277
- const relative = prefix ? `${prefix}/${entry.name}` : entry.name;
278
- const directory = entry.isDirectory();
279
- if (isNameExcluded({ name: entry.name, relative, directory, state }) || !selectPath({ relative, directory, state }))
280
- continue;
281
- if (entry.isDirectory()) {
282
- files.push(...await directoryEntryFiles({ name: entry.name, dir, relative, depth, state }));
283
- }
284
- else {
285
- files.push(...regularEntryFiles({ entry, relative, state }));
189
+ }
190
+ /** A token identifies only this snapshot. Copy yielded bytes so a reader cannot mutate later reads. */
191
+ function createSnapshotReader({ token, snapshot }) {
192
+ return {
193
+ async *entries({ archive }) {
194
+ if (!token.equals(archive))
195
+ throw new Error('bundled agent plugin archive: snapshot token mismatch');
196
+ for (const { entryPath, content } of snapshot) {
197
+ yield { kind: 'file', entryPath, declaredSize: content.byteLength,
198
+ openReadStream: () => onceAsyncIterable(new Uint8Array(content)) };
286
199
  }
287
- // Symlinks and everything else: skipped by default. See this function's own doc.
288
- }
289
- return files;
200
+ },
201
+ };
202
+ }
203
+ /**
204
+ * Reads the format {@link packAgentPluginDirectory} writes, as an `AgentPluginArchiveReaderPort`.
205
+ *
206
+ * Yields only `kind: "file"` entries — the format has no directory, symlink, or device entries to
207
+ * represent, which is itself a small safety property: the whole class of entry `install.ts` rejects
208
+ * cannot be expressed in an archive this reader produces.
209
+ *
210
+ * @complexity O(n) in the archive's byte length; each file's bytes are yielded once, not copied
211
+ * into an intermediate list.
212
+ */
213
+ function createBundledSourceArchiveReader(ports) {
214
+ return {
215
+ entries({ archive }) {
216
+ return readEntries(ports, archive);
217
+ },
218
+ };
219
+ }
220
+ async function* readEntries(ports, archive) {
221
+ const buffer = Buffer.from(archive.buffer, archive.byteOffset, archive.byteLength);
222
+ const magic = Buffer.from(ports.bundledArchiveMagic, "utf8");
223
+ if (buffer.byteLength < magic.byteLength || !buffer.subarray(0, magic.byteLength).equals(magic)) {
224
+ throw new Error("bundled agent plugin archive: bad magic — this reader only understands the configured bundled archive format");
290
225
  }
291
- async function directoryEntryFiles({ name, dir, relative, depth, state }) {
292
- if (name === '__tests__' && !state.options.includeTests)
293
- return [];
294
- assertPackingLimit({ state, name: 'maxDepth', value: depth + 1 });
295
- return listRegularFiles({ dir: path.join(dir, name), prefix: relative, depth: depth + 1, state });
226
+ let offset = magic.byteLength;
227
+ while (offset < buffer.byteLength) {
228
+ const newlineIndex = buffer.indexOf(0x0a, offset);
229
+ if (newlineIndex === -1)
230
+ throw new Error("bundled agent plugin archive: truncated entry header");
231
+ const header = buffer.subarray(offset, newlineIndex).toString("utf8");
232
+ const match = /^F (\d+) (\d+)$/.exec(header);
233
+ if (!match)
234
+ throw new Error(`bundled agent plugin archive: malformed entry header '${header}'`);
235
+ const pathLength = Number(match[1]);
236
+ const contentLength = Number(match[2]);
237
+ const pathStart = newlineIndex + 1;
238
+ const contentStart = pathStart + pathLength;
239
+ const contentEnd = contentStart + contentLength;
240
+ if (contentEnd > buffer.byteLength)
241
+ throw new Error("bundled agent plugin archive: truncated entry body");
242
+ const entryPath = buffer.subarray(pathStart, contentStart).toString("utf8");
243
+ const content = buffer.subarray(contentStart, contentEnd);
244
+ yield {
245
+ kind: "file",
246
+ entryPath,
247
+ declaredSize: contentLength,
248
+ openReadStream: () => onceAsyncIterable(new Uint8Array(content)),
249
+ };
250
+ offset = contentEnd;
296
251
  }
297
- function regularEntryFiles({ entry, relative, state }) {
298
- if (entry.isFile() && (state.options.includeTests || !/\.(test|spec)\./.test(entry.name))) {
299
- recordFile({ relative, state });
300
- return [relative];
252
+ }
253
+ /** One-shot async iterable over a single chunk — the shape `AgentPluginArchiveEntry.openReadStream`
254
+ * wants, without pulling in a stream implementation for an already-in-memory buffer. */
255
+ async function* onceAsyncIterable(chunk) {
256
+ yield chunk;
257
+ }
258
+ /**
259
+ * Lists runtime regular files under `dir`, as POSIX-style package-relative paths.
260
+ * By default, test directories and test/spec files are excluded so test-only edits cannot change installed
261
+ * runtime contents or their content-addressed digest.
262
+ *
263
+ * @complexity O(e * (a + s)) selection checks for e entries, a allowlist paths and s suffixes.
264
+ * Path comparison cost scales with path length; selection uses O(1) auxiliary space per entry.
265
+ */
266
+ async function listRegularFiles(ports, { dir, prefix, depth, state }) {
267
+ const entries = await ports.filesystem.readdir(dir, { withFileTypes: true });
268
+ state.entries += entries.length;
269
+ assertPackingLimit({ state, name: 'maxEntries', value: state.entries });
270
+ const files = [];
271
+ for (const entry of entries) {
272
+ const relative = prefix ? `${prefix}/${entry.name}` : entry.name;
273
+ const directory = entry.isDirectory();
274
+ if (isNameExcluded({ name: entry.name, relative, directory, state }) || !selectPath({ relative, directory, state }))
275
+ continue;
276
+ if (entry.isDirectory()) {
277
+ files.push(...await directoryEntryFiles(ports, { name: entry.name, dir, relative, depth, state }));
301
278
  }
302
- if (!entry.isFile())
303
- refuseEntry({ state, entryPath: relative, symlink: entry.isSymbolicLink() });
304
- return [];
305
- }
306
- function recordFile({ relative, state }) {
307
- state.files.add(relative);
308
- assertPackingLimit({ state, name: 'maxFiles', value: state.files.size });
309
- }
310
- /** An exact allow-path reopens excluded ancestors without reopening unrelated siblings.
311
- * A selected subtree does not implicitly override name exclusions farther down that subtree.
312
- * @complexity O(a * p) time for a allow-paths of length p, O(1) space. No I/O or mutation. */
313
- function isNameExcluded({ name, relative, directory, state }) {
314
- return state.excluded.has(name) && !state.allowPaths?.some(allowed => relative === allowed || (directory && allowed.startsWith(`${relative}/`)));
315
- }
316
- /** Ancestors of an allowed path must be traversed, but their unrelated siblings are pruned.
317
- * Suffix exclusions always win. O((a + s) * p) time, O(1) space; no I/O or mutation. */
318
- function selectPath({ relative, directory, state }) {
319
- if (state.options.excludeSuffixes?.some(suffix => relative.endsWith(suffix)))
320
- return false;
321
- return state.allowPaths === undefined || state.allowPaths.some(allowed => relative === allowed || relative.startsWith(`${allowed}/`) || (directory && allowed.startsWith(`${relative}/`)));
279
+ else {
280
+ files.push(...regularEntryFiles({ entry, relative, state }));
281
+ }
282
+ // Symlinks and everything else: skipped by default. See this function's own doc.
322
283
  }
323
- function refuseEntry({ state, entryPath, symlink }) {
324
- const policy = symlink ? state.options.symlinkPolicy : state.options.specialFilePolicy;
325
- if (policy === 'reject')
326
- throw new Error(`bundled agent plugin refuses ${symlink ? 'symlink' : 'special file'} '${entryPath}'`);
284
+ return files;
285
+ }
286
+ async function directoryEntryFiles(ports, { name, dir, relative, depth, state }) {
287
+ if (name === '__tests__' && !state.options.includeTests)
288
+ return [];
289
+ assertPackingLimit({ state, name: 'maxDepth', value: depth + 1 });
290
+ return listRegularFiles(ports, { dir: path.join(dir, name), prefix: relative, depth: depth + 1, state });
291
+ }
292
+ function regularEntryFiles({ entry, relative, state }) {
293
+ if (entry.isFile() && (state.options.includeTests || !/\.(test|spec)\./.test(entry.name))) {
294
+ recordFile({ relative, state });
295
+ return [relative];
327
296
  }
328
- return { packAgentPluginDirectory, createBundledSourceArchiveReader };
297
+ if (!entry.isFile())
298
+ refuseEntry({ state, entryPath: relative, symlink: entry.isSymbolicLink() });
299
+ return [];
300
+ }
301
+ function recordFile({ relative, state }) {
302
+ state.files.add(relative);
303
+ assertPackingLimit({ state, name: 'maxFiles', value: state.files.size });
304
+ }
305
+ /** An exact allow-path reopens excluded ancestors without reopening unrelated siblings.
306
+ * A selected subtree does not implicitly override name exclusions farther down that subtree.
307
+ * @complexity O(a * p) time for a allow-paths of length p, O(1) space. No I/O or mutation. */
308
+ function isNameExcluded({ name, relative, directory, state }) {
309
+ return state.excluded.has(name) && !state.allowPaths?.some(allowed => relative === allowed || (directory && allowed.startsWith(`${relative}/`)));
310
+ }
311
+ /** Ancestors of an allowed path must be traversed, but their unrelated siblings are pruned.
312
+ * Suffix exclusions always win. O((a + s) * p) time, O(1) space; no I/O or mutation. */
313
+ function selectPath({ relative, directory, state }) {
314
+ if (state.options.excludeSuffixes?.some(suffix => relative.endsWith(suffix)))
315
+ return false;
316
+ return state.allowPaths === undefined || state.allowPaths.some(allowed => relative === allowed || relative.startsWith(`${allowed}/`) || (directory && allowed.startsWith(`${relative}/`)));
317
+ }
318
+ function refuseEntry({ state, entryPath, symlink }) {
319
+ const policy = symlink ? state.options.symlinkPolicy : state.options.specialFilePolicy;
320
+ if (policy === 'reject')
321
+ throw new Error(`bundled agent plugin refuses ${symlink ? 'symlink' : 'special file'} '${entryPath}'`);
322
+ }
323
+ function buildModule(ports) {
324
+ return {
325
+ packAgentPluginDirectory: (sourceDir, options = {}) => packAgentPluginDirectory({ ports, sourceDir }, options),
326
+ createBundledSourceArchiveReader: () => createBundledSourceArchiveReader(ports),
327
+ };
329
328
  }
330
329
  const instances = new WeakMap();
331
330
  /** Internal composition; one state/queue instance per injected host context. */
332
- export function createBundledSourceArchiveModule(ports) {
331
+ export function createBundledSourceArchiveModule(ports, _optional = {}) {
333
332
  let instance = instances.get(ports);
334
333
  if (!instance) {
335
334
  instance = buildModule(ports);
@@ -3,7 +3,7 @@ import type { McpServerConfig } from "./manifest.js";
3
3
  import type { AgentPluginLifecyclePorts } from "./ports.js";
4
4
  import { type SkillFileResult } from "./skill-file-reader.js";
5
5
  /** Internal composition; one state/queue instance per injected host context. */
6
- export declare function createCapabilityProjectionModule(ports: AgentPluginLifecyclePorts): {
6
+ export declare function createCapabilityProjectionModule(ports: AgentPluginLifecyclePorts, _optional?: Record<string, never>): {
7
7
  classifyAgentPluginMcpServerTrust: (server: Pick<McpServerConfig, "type">) => "auto-admit" | "requires-confirmation";
8
8
  readInstalledSkillMarkdown: (packageRoot: string, skillPath: string) => Promise<string>;
9
9
  readInstalledSkillFile: ({ packageRoot, skillPath }: {
@@ -66,7 +66,7 @@ function buildModule(ports) {
66
66
  }
67
67
  const instances = new WeakMap();
68
68
  /** Internal composition; one state/queue instance per injected host context. */
69
- export function createCapabilityProjectionModule(ports) {
69
+ export function createCapabilityProjectionModule(ports, _optional = {}) {
70
70
  let instance = instances.get(ports);
71
71
  if (!instance) {
72
72
  instance = buildModule(ports);
@@ -10,7 +10,7 @@ export declare function parseCredentialCardUsedFor({ value }: {
10
10
  }, _options?: {}): readonly string[] | undefined;
11
11
  /** Parse portable connection-card declarations without executing plugin modules.
12
12
  * Refuse the whole batch on invalid or duplicate targets; absent declarations remain compatible.
13
- * Legacy namespace reads warn through the host callback (console by default).
13
+ * Legacy namespace reads warn through the host callback (safe logger by default).
14
14
  * @returns Normalized display/form metadata or a declaration-specific refusal reason.
15
15
  * @complexity O(c + f), capped at 32 cards × 16 fields; no I/O or input mutation.
16
16
  */