@jini-ai/agent-plugins 0.7.2 → 0.7.3-next.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -4
- package/NOTICE +2 -0
- package/README.md +11 -15
- package/calendly/plugin.json +3 -3
- package/cloudflare/lib/forms.mjs +9 -10
- package/cloudflare/lib/target.mjs +1 -1
- package/cloudflare/plugin.json +3 -3
- package/cloudflare/worker/forms-receiver.mjs +9 -9
- package/composio/plugin.json +3 -3
- package/core/persistent-state.js +227 -163
- package/dist/admin-surfaces/connections/connections.d.ts +11 -6
- package/dist/admin-surfaces/connections/connections.js +102 -85
- package/dist/admin-surfaces/node.d.ts +27 -0
- package/dist/admin-surfaces/node.js +32 -0
- package/dist/admin-surfaces/plugin-state.js +21 -18
- package/dist/admin-surfaces/surface-client.d.ts +4 -0
- package/dist/admin-surfaces/surface-client.js +124 -117
- package/dist/admin-surfaces/surface-handlers.js +21 -17
- package/dist/admin-surfaces/theme.d.ts +5 -1
- package/dist/admin-surfaces/theme.js +3 -3
- package/dist/connect/access-token-tool.d.ts +3 -1
- package/dist/connect/access-token-tool.js +3 -2
- package/dist/connect/apply-connect-defaults.js +2 -2
- package/dist/connect/apply-tool-renames.js +9 -8
- package/dist/connect/connect-tool.d.ts +2 -0
- package/dist/connect/connect-tool.js +3 -2
- package/dist/connect/credential-cards.js +3 -2
- package/dist/connect/credential-save-tool.d.ts +14 -11
- package/dist/connect/credential-save-tool.js +128 -121
- package/dist/connect/enable-access.d.ts +2 -2
- package/dist/connect/enable-access.js +6 -6
- package/dist/connect/executable/register.js +40 -34
- package/dist/connect/federate-mcp.d.ts +21 -11
- package/dist/connect/federate-mcp.js +28 -21
- package/dist/connect/grant-signed-in-defaults.js +3 -3
- package/dist/connect/import-access-token.js +2 -1
- package/dist/connect/index.d.ts +1 -0
- package/dist/connect/index.js +1 -0
- package/dist/connect/plugin-credential-card.js +2 -1
- package/dist/connect/plugin-host/index.d.ts +10 -5
- package/dist/connect/plugin-host/index.js +113 -100
- package/dist/connect/ports.d.ts +1 -1
- package/dist/connect/row-update.d.ts +22 -0
- package/dist/connect/row-update.js +18 -0
- package/dist/connect/switch-on-saved-token.d.ts +4 -2
- package/dist/connect/switch-on-saved-token.js +1 -1
- package/dist/connect/token-map.d.ts +44 -0
- package/dist/connect/token-map.js +49 -0
- package/dist/core/identity-namespace.js +5 -0
- package/dist/folder-zip.d.ts +3 -1
- package/dist/folder-zip.js +2 -2
- package/dist/lifecycle/activation.d.ts +4 -4
- package/dist/lifecycle/activation.js +4 -5
- package/dist/lifecycle/automatic-use.js +236 -210
- package/dist/lifecycle/bundled-digests.d.ts +75 -12
- package/dist/lifecycle/bundled-digests.js +213 -212
- package/dist/lifecycle/bundled-source-archive.d.ts +1 -1
- package/dist/lifecycle/bundled-source-archive.js +263 -264
- package/dist/lifecycle/capability-projection.d.ts +1 -1
- package/dist/lifecycle/capability-projection.js +1 -1
- package/dist/lifecycle/credential-card-metadata.d.ts +1 -1
- package/dist/lifecycle/credential-card-metadata.js +27 -3
- package/dist/lifecycle/exports.js +9 -4
- package/dist/lifecycle/fetch-archive.d.ts +1 -1
- package/dist/lifecycle/fetch-archive.js +1 -1
- package/dist/lifecycle/host-tools/identity.js +3 -2
- package/dist/lifecycle/host-tools/ports.d.ts +2 -0
- package/dist/lifecycle/host-tools/search-tool.d.ts +4 -2
- package/dist/lifecycle/host-tools/search-tool.js +9 -8
- package/dist/lifecycle/host-tools/skill-tool.d.ts +18 -2
- package/dist/lifecycle/host-tools/skill-tool.js +16 -8
- package/dist/lifecycle/index.d.ts +118 -110
- package/dist/lifecycle/index.js +45 -12
- package/dist/lifecycle/install-errors.d.ts +1 -1
- package/dist/lifecycle/install-from-url.d.ts +1 -1
- package/dist/lifecycle/install-from-url.js +1 -1
- package/dist/lifecycle/install.d.ts +7 -2
- package/dist/lifecycle/install.js +414 -396
- package/dist/lifecycle/installed-package-index.js +45 -42
- package/dist/lifecycle/layout.d.ts +1 -1
- package/dist/lifecycle/layout.js +1 -1
- package/dist/lifecycle/mail/catalog.d.ts +8 -32
- package/dist/lifecycle/mail/catalog.js +25 -20
- package/dist/lifecycle/mail/contribution.d.ts +2 -2
- package/dist/lifecycle/mail/contribution.js +34 -34
- package/dist/lifecycle/mail/selection.js +6 -2
- package/dist/lifecycle/manifest.d.ts +3 -3
- package/dist/lifecycle/manifest.js +4 -4
- package/dist/lifecycle/mcp-provisioning.d.ts +3 -3
- package/dist/lifecycle/mcp-provisioning.js +3 -3
- package/dist/lifecycle/package-paths.d.ts +1 -1
- package/dist/lifecycle/package-paths.js +1 -1
- package/dist/lifecycle/persistent-state.js +1 -2
- package/dist/lifecycle/ports.d.ts +5 -1
- package/dist/lifecycle/resolve-agent-plugin-refs.d.ts +30 -8
- package/dist/lifecycle/resolve-agent-plugin-refs.js +227 -228
- package/dist/lifecycle/retire-bundled.d.ts +1 -52
- package/dist/lifecycle/retire-bundled.js +134 -84
- package/dist/lifecycle/search.d.ts +2 -1
- package/dist/lifecycle/search.js +1 -1
- package/dist/lifecycle/seed-bundled.d.ts +1 -1
- package/dist/lifecycle/seed-bundled.js +154 -155
- package/dist/lifecycle/set-enabled.d.ts +1 -1
- package/dist/lifecycle/set-enabled.js +1 -1
- package/dist/lifecycle/skill-file-reader.js +53 -50
- package/dist/lifecycle/tools/projection.d.ts +4 -7
- package/dist/lifecycle/tools/projection.js +109 -108
- package/dist/lifecycle/trusted-plugin-files.d.ts +2 -2
- package/dist/lifecycle/trusted-plugin-files.js +1 -1
- package/dist/lifecycle/uninstall.d.ts +1 -1
- package/dist/lifecycle/uninstall.js +237 -241
- package/dist/lifecycle/update-store.js +20 -17
- package/dist/lifecycle/update.js +287 -281
- package/dist/lifecycle/yauzl-archive-reader.d.ts +2 -2
- package/dist/lifecycle/yauzl-archive-reader.js +8 -2
- package/dist/manifest.d.ts +11 -3
- package/dist/manifest.js +9 -9
- package/fly/jini-credential-schemes.json +11 -0
- package/fly/plugin.json +3 -4
- package/github/plugin.json +3 -3
- package/github/source-control/backup-push.mjs +11 -11
- package/github/source-control/commit-site.mjs +23 -13
- package/github/source-control/github.mjs +12 -6
- package/github/source-control/write-files.mjs +27 -28
- package/github-pages/{tovu-deploy-targets.json → jini-deploy-targets.json} +22 -22
- package/github-pages/plugin.json +3 -3
- package/github-pages/targets/github-pages.mjs +3 -3
- package/google-login/plugin.json +3 -3
- package/google-workspace/README.md +14 -14
- package/google-workspace/form-destinations/README.md +3 -3
- package/google-workspace/form-destinations/dedupe.mjs +1 -1
- package/google-workspace/form-destinations/mapping.mjs +8 -9
- package/google-workspace/form-destinations/sheets.mjs +1 -1
- package/google-workspace/{tovu-admin-surfaces.json → jini-admin-surfaces.json} +2 -2
- package/google-workspace/{tovu-agent-tools.json → jini-agent-tools.json} +28 -28
- package/google-workspace/{tovu-connections.json → jini-connections.json} +2 -2
- package/google-workspace/lib/auth.mjs +2 -2
- package/google-workspace/lib/form-destination-settings.mjs +1 -1
- package/google-workspace/lib/picker-flow.mjs +2 -2
- package/google-workspace/lib/request-policy.mjs +1 -1
- package/google-workspace/lib/surface-actions.mjs +1 -1
- package/google-workspace/plugin.json +3 -3
- package/google-workspace/tools/sheets/README.md +3 -3
- package/google-workspace/tools/sheets-admin/README.md +3 -3
- package/google-workspace/ui/README.md +4 -4
- package/google-workspace/ui/connection-panel.mjs +51 -51
- package/google-workspace/ui/destination-panel.mjs +34 -34
- package/google-workspace/ui/dom.mjs +15 -16
- package/google-workspace/ui/picker-flow.mjs +2 -2
- package/google-workspace/ui/picker.mjs +19 -19
- package/google-workspace/ui/surface-client.mjs +96 -69
- package/higgsfield-media/plugin.json +3 -3
- package/jev/plugin.json +3 -3
- package/kuinetic/CHANGELOG.md +12 -0
- package/kuinetic/mcp.json +4 -0
- package/kuinetic/plugin.json +27 -0
- package/kuinetic/skills/kuinetic/SKILL.md +120 -0
- package/kuinetic/skills/kuinetic/references/effects-by-family.md +32 -0
- package/kuinetic/skills/kuinetic/references/opt-in-tiers.md +12 -0
- package/kuinetic/skills/kuinetic/references/reserved-keys.md +36 -0
- package/meilisearch/plugin.json +5 -5
- package/netlify/plugin.json +3 -3
- package/netlify/targets/netlify.mjs +14 -4
- package/opentelemetry/plugin.json +3 -3
- package/package.json +27 -22
- package/posthog/plugin.json +3 -3
- package/railway/plugin.json +3 -3
- package/render/plugin.json +3 -3
- package/resend/NOTES.md +2 -2
- package/resend/adapters/resend.mjs +1 -1
- package/resend/{tovu-mail-adapters.json → jini-mail-adapters.json} +1 -1
- package/resend/lib/domains.mjs +8 -8
- package/resend/plugin.json +3 -3
- package/s3-compatible/{tovu-deploy-targets.json → jini-deploy-targets.json} +68 -68
- package/s3-compatible/jini-object-stores.json +29 -0
- package/s3-compatible/object-stores/s3-compatible.mjs +19 -13
- package/s3-compatible/plugin.json +3 -3
- package/s3-compatible/targets/s3-compatible.mjs +25 -25
- package/sentry/plugin.json +3 -3
- package/shadcn-ui/CHANGELOG.md +7 -0
- package/shadcn-ui/LICENSE +201 -0
- package/shadcn-ui/NOTICE +10 -0
- package/shadcn-ui/mcp.json +4 -0
- package/shadcn-ui/plugin.json +26 -0
- package/shopify/plugin.json +3 -3
- package/site-compliance/plugin.json +3 -3
- package/site-import/plugin.json +3 -3
- package/supabase/mcp.json +1 -4
- package/supabase/plugin.json +3 -3
- package/ui-ux-design/CHANGELOG.md +13 -0
- package/ui-ux-design/NOTICE +2 -0
- package/ui-ux-design/README.md +17 -7
- package/ui-ux-design/plugin.json +6 -3
- package/ui-ux-design/skills/ui-ux-design/SKILL.md +38 -152
- package/ui-ux-design/skills/ui-ux-design/references/full-workflow.md +156 -0
- package/ui-ux-design/skills/ui-ux-design/references/ui-animation.md +4 -4
- package/vercel/NOTES.md +1 -1
- package/vercel/object-stores/vercel-blob.mjs +12 -2
- package/vercel/plugin.json +3 -3
- package/vercel/targets/vercel.mjs +3 -3
- package/wordpress/plugin.json +3 -3
- package/dist/lifecycle/node.d.ts +0 -11
- package/dist/lifecycle/node.js +0 -38
- package/fly/tovu-credential-schemes.json +0 -11
- package/github/deployments/github.mjs +0 -415
- package/s3-compatible/tovu-object-stores.json +0 -29
- package/ui-ux-design/skills/ui-ux-design/references/kuinetic-reference.md +0 -184
- /package/cloudflare/{tovu-consent.json → jini-consent.json} +0 -0
- /package/cloudflare/{tovu-deploy-targets.json → jini-deploy-targets.json} +0 -0
- /package/cloudflare/{tovu-form-destinations.json → jini-form-destinations.json} +0 -0
- /package/fly/{tovu-deploy-configs.json → jini-deploy-configs.json} +0 -0
- /package/fly/{tovu-deploy-ops.json → jini-deploy-ops.json} +0 -0
- /package/github/{tovu-deploy-ops.json → jini-deploy-ops.json} +0 -0
- /package/github/{tovu-source-control.json → jini-source-control.json} +0 -0
- /package/google-login/{tovu-login-providers.json → jini-login-providers.json} +0 -0
- /package/google-workspace/{tovu-form-destinations.json → jini-form-destinations.json} +0 -0
- /package/meilisearch/{tovu-search-providers.json → jini-search-providers.json} +0 -0
- /package/netlify/{tovu-consent.json → jini-consent.json} +0 -0
- /package/netlify/{tovu-deploy-targets.json → jini-deploy-targets.json} +0 -0
- /package/railway/{tovu-deploy-configs.json → jini-deploy-configs.json} +0 -0
- /package/railway/{tovu-deploy-ops.json → jini-deploy-ops.json} +0 -0
- /package/render/{tovu-deploy-configs.json → jini-deploy-configs.json} +0 -0
- /package/render/{tovu-deploy-ops.json → jini-deploy-ops.json} +0 -0
- /package/{ui-ux-design → shadcn-ui}/skills/shadcn-ui/README.md +0 -0
- /package/{ui-ux-design → shadcn-ui}/skills/shadcn-ui/SKILL.md +0 -0
- /package/{ui-ux-design → shadcn-ui}/skills/shadcn-ui/examples/auth-layout.tsx +0 -0
- /package/{ui-ux-design → shadcn-ui}/skills/shadcn-ui/examples/data-table.tsx +0 -0
- /package/{ui-ux-design → shadcn-ui}/skills/shadcn-ui/examples/form-pattern.tsx +0 -0
- /package/{ui-ux-design → shadcn-ui}/skills/shadcn-ui/resources/component-catalog.md +0 -0
- /package/{ui-ux-design → shadcn-ui}/skills/shadcn-ui/resources/customization-guide.md +0 -0
- /package/{ui-ux-design → shadcn-ui}/skills/shadcn-ui/resources/migration-guide.md +0 -0
- /package/{ui-ux-design → shadcn-ui}/skills/shadcn-ui/resources/setup-guide.md +0 -0
- /package/{ui-ux-design → shadcn-ui}/skills/shadcn-ui/scripts/verify-setup.sh +0 -0
- /package/vercel/{tovu-consent.json → jini-consent.json} +0 -0
- /package/vercel/{tovu-deploy-targets.json → jini-deploy-targets.json} +0 -0
- /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
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
const
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
const
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
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
|
-
|
|
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
|
-
|
|
118
|
-
|
|
119
|
-
|
|
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
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
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
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
const
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
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
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
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
|
-
|
|
196
|
-
|
|
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
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
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
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
yield chunk;
|
|
185
|
+
catch (error) {
|
|
186
|
+
await handle.close();
|
|
187
|
+
throw error;
|
|
262
188
|
}
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
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
|
-
|
|
288
|
-
|
|
289
|
-
|
|
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
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
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
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
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
|
-
|
|
303
|
-
|
|
304
|
-
|
|
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
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
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
|
-
|
|
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 (
|
|
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
|
*/
|