@jini-ai/agent-plugins 0.7.1 → 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.
- 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 +9 -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.js +8 -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 +3 -3
- 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 +25 -20
- 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
|
@@ -23,7 +23,7 @@ export interface SetAgentPluginEnabledResult {
|
|
|
23
23
|
readonly warnings?: readonly string[];
|
|
24
24
|
}
|
|
25
25
|
/** Internal composition; one state/queue instance per injected host context. */
|
|
26
|
-
export declare function createSetEnabledModule(ports: AgentPluginLifecyclePorts): {
|
|
26
|
+
export declare function createSetEnabledModule(ports: AgentPluginLifecyclePorts, _optional?: Record<string, never>): {
|
|
27
27
|
setAgentPluginEnabled: (input: SetAgentPluginEnabledInput, optional?: {
|
|
28
28
|
readonly unlessOperatorDisabled?: boolean;
|
|
29
29
|
}) => Promise<SetAgentPluginEnabledResult>;
|
|
@@ -98,7 +98,7 @@ function buildModule(ports) {
|
|
|
98
98
|
}
|
|
99
99
|
const instances = new WeakMap();
|
|
100
100
|
/** Internal composition; one state/queue instance per injected host context. */
|
|
101
|
-
export function createSetEnabledModule(ports) {
|
|
101
|
+
export function createSetEnabledModule(ports, _optional = {}) {
|
|
102
102
|
let instance = instances.get(ports);
|
|
103
103
|
if (!instance) {
|
|
104
104
|
instance = buildModule(ports);
|
|
@@ -41,59 +41,29 @@ function decodeText(bytes) {
|
|
|
41
41
|
return { refusal: "File request refused: binary or invalid UTF-8 content cannot be read as text." };
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
|
-
/**
|
|
45
|
-
*
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
export function createSkillFileReader({ skillRoot, filesystem }, _options = {}) {
|
|
51
|
-
const { assertContainedOnDisk } = createPackagePathsModule({ filesystem });
|
|
52
|
-
/** Reject traversal even when normalization would leave it inside the folder.
|
|
53
|
-
* @returns The refusal message, or `undefined` for an admissible name. */
|
|
54
|
-
function validateFile(file) {
|
|
55
|
-
const absolute = path.posix.isAbsolute(file) || /^[a-zA-Z]:/.test(file);
|
|
56
|
-
if (!file || /[\0\\]/.test(file) || absolute || file.split("/").some(segment => segment === "..")) {
|
|
57
|
-
return "File request refused: use a path relative to this skill folder, without traversal or absolute paths.";
|
|
58
|
-
}
|
|
59
|
-
if (!TEXT_EXTENSIONS.has(path.extname(file).toLowerCase())) {
|
|
60
|
-
return "File request refused: only supported text extensions are readable.";
|
|
61
|
-
}
|
|
62
|
-
return undefined;
|
|
44
|
+
/** Reject traversal even when normalization would leave it inside the folder.
|
|
45
|
+
* @returns The refusal message, or `undefined` for an admissible name. */
|
|
46
|
+
function validateFile(file) {
|
|
47
|
+
const absolute = path.posix.isAbsolute(file) || /^[a-zA-Z]:/.test(file);
|
|
48
|
+
if (!file || /[\0\\]/.test(file) || absolute || file.split("/").some(segment => segment === "..")) {
|
|
49
|
+
return "File request refused: use a path relative to this skill folder, without traversal or absolute paths.";
|
|
63
50
|
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
try {
|
|
67
|
-
const absolute = await filesystem.realpath(await assertContainedOnDisk(skillRoot, file));
|
|
68
|
-
// Recheck the canonical target through the same owner before opening it.
|
|
69
|
-
const relative = path.relative(await filesystem.realpath(skillRoot), absolute);
|
|
70
|
-
await assertContainedOnDisk(skillRoot, relative);
|
|
71
|
-
return validateFile(relative.split(path.sep).join("/")) === undefined ? absolute : undefined;
|
|
72
|
-
}
|
|
73
|
-
catch {
|
|
74
|
-
return undefined;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
/** Validate, resolve, then read one file; every refusal is a value, never a thrown native error. */
|
|
78
|
-
async function readText(file) {
|
|
79
|
-
const invalid = validateFile(file);
|
|
80
|
-
if (invalid !== undefined)
|
|
81
|
-
return { refusal: invalid };
|
|
82
|
-
const absolute = await resolveTarget(file);
|
|
83
|
-
if (absolute === undefined)
|
|
84
|
-
return { refusal: "File request refused: file is missing, unreadable, or resolves outside this skill folder." };
|
|
85
|
-
return readContained(absolute);
|
|
86
|
-
}
|
|
87
|
-
/** Open the resolved target with no-follow and read at most cap + 1, including growing files. */
|
|
88
|
-
async function readContained(absolute) {
|
|
89
|
-
const handle = await filesystem.open(absolute, constants.O_RDONLY | constants.O_NOFOLLOW | constants.O_NONBLOCK).catch(() => undefined);
|
|
90
|
-
if (!handle)
|
|
91
|
-
return { refusal: UNREADABLE };
|
|
92
|
-
// Never reflect native errors or caller paths: either can contain an absolute host path.
|
|
93
|
-
return readOpened(handle).catch(() => ({ refusal: UNREADABLE })).finally(() => handle.close().catch(() => { }));
|
|
51
|
+
if (!TEXT_EXTENSIONS.has(path.extname(file).toLowerCase())) {
|
|
52
|
+
return "File request refused: only supported text extensions are readable.";
|
|
94
53
|
}
|
|
54
|
+
return undefined;
|
|
55
|
+
}
|
|
56
|
+
/** Open the resolved target with no-follow and read at most cap + 1, including growing files. */
|
|
57
|
+
async function readContained(filesystem, absolute) {
|
|
58
|
+
const handle = await filesystem.open(absolute, constants.O_RDONLY | constants.O_NOFOLLOW | constants.O_NONBLOCK).catch(() => undefined);
|
|
59
|
+
if (!handle)
|
|
60
|
+
return { refusal: UNREADABLE };
|
|
61
|
+
// Never reflect native errors or caller paths: either can contain an absolute host path.
|
|
62
|
+
return readOpened(handle).catch(() => ({ refusal: UNREADABLE })).finally(() => handle.close().catch(() => { }));
|
|
63
|
+
}
|
|
64
|
+
function createSkillFileInventory(readDirectory, readText) {
|
|
95
65
|
/** Skip directory symlinks (including cycles); contained file symlinks use the same read guard. */
|
|
96
|
-
async function listFiles() {
|
|
66
|
+
return async function listFiles() {
|
|
97
67
|
const files = [];
|
|
98
68
|
let remaining = MAX_WALK_ENTRIES;
|
|
99
69
|
let incomplete = false;
|
|
@@ -130,7 +100,40 @@ export function createSkillFileReader({ skillRoot, filesystem }, _options = {})
|
|
|
130
100
|
}
|
|
131
101
|
await walk("", 0);
|
|
132
102
|
return { files: files.sort(), ...(incomplete ? { note: "Supporting-file inventory is incomplete: traversal limit reached or a directory is unreadable." } : {}) };
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Progressive disclosure for plugin AND standalone skills, with a skill-folder trust boundary.
|
|
107
|
+
* Uses the lifecycle containment owner, native bounded reads and injected async filesystem effects.
|
|
108
|
+
* The default file is SKILL.md; supporting files are discovered recursively, never inlined.
|
|
109
|
+
* @complexity O(entries + readable bytes), bounded by 4096 entries, depth 32 and 256 KiB per file.
|
|
110
|
+
*/
|
|
111
|
+
export function createSkillFileReader({ skillRoot, filesystem }, _options = {}) {
|
|
112
|
+
const { assertContainedOnDisk } = createPackagePathsModule({ filesystem });
|
|
113
|
+
/** The canonical contained target of `file`, or `undefined` when it is missing or escapes the folder. */
|
|
114
|
+
async function resolveTarget(file) {
|
|
115
|
+
try {
|
|
116
|
+
const absolute = await filesystem.realpath(await assertContainedOnDisk(skillRoot, file));
|
|
117
|
+
// Recheck the canonical target through the same owner before opening it.
|
|
118
|
+
const relative = path.relative(await filesystem.realpath(skillRoot), absolute);
|
|
119
|
+
await assertContainedOnDisk(skillRoot, relative);
|
|
120
|
+
return validateFile(relative.split(path.sep).join("/")) === undefined ? absolute : undefined;
|
|
121
|
+
}
|
|
122
|
+
catch {
|
|
123
|
+
return undefined;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
/** Validate, resolve, then read one file; every refusal is a value, never a thrown native error. */
|
|
127
|
+
async function readText(file) {
|
|
128
|
+
const invalid = validateFile(file);
|
|
129
|
+
if (invalid !== undefined)
|
|
130
|
+
return { refusal: invalid };
|
|
131
|
+
const absolute = await resolveTarget(file);
|
|
132
|
+
if (absolute === undefined)
|
|
133
|
+
return { refusal: "File request refused: file is missing, unreadable, or resolves outside this skill folder." };
|
|
134
|
+
return readContained(filesystem, absolute);
|
|
133
135
|
}
|
|
136
|
+
const listFiles = createSkillFileInventory(readDirectory, readText);
|
|
134
137
|
/** One directory's entries in code-unit name order, or `undefined` when it cannot be read. */
|
|
135
138
|
async function readDirectory(relative) {
|
|
136
139
|
try {
|
|
@@ -76,19 +76,16 @@ export interface AgentPluginToolDisclosure {
|
|
|
76
76
|
* @complexity sync is O(t) tools plus schema compilation; disclosure lookup is O(1).
|
|
77
77
|
*/
|
|
78
78
|
export declare function createAgentPluginToolProjection(required: AgentPluginToolProjectionPorts, _optional?: Record<string, never>): {
|
|
79
|
-
|
|
80
|
-
sync(input: {
|
|
79
|
+
sync: (input: {
|
|
81
80
|
readonly loaded: readonly LoadedAgentPluginTool[];
|
|
82
81
|
readonly refusals: readonly string[];
|
|
83
82
|
readonly additionalTools?: readonly AgentPluginAdditionalTool[];
|
|
84
|
-
}, _options?: Record<string, never>)
|
|
83
|
+
}, _options?: Record<string, never>) => {
|
|
85
84
|
readonly refusals: readonly string[];
|
|
86
85
|
};
|
|
87
|
-
|
|
88
|
-
* @throws ToolInputError for input that fails the schema; Error for an invalid hook answer. */
|
|
89
|
-
describeAffectedResources(input: {
|
|
86
|
+
describeAffectedResources: (input: {
|
|
90
87
|
readonly toolId: string;
|
|
91
88
|
readonly input: unknown;
|
|
92
|
-
}, _options?: Record<string, never>)
|
|
89
|
+
}, _options?: Record<string, never>) => Promise<AgentPluginToolDisclosure | null>;
|
|
93
90
|
};
|
|
94
91
|
//# sourceMappingURL=projection.d.ts.map
|
|
@@ -157,6 +157,112 @@ function countProjectionClaims({ loaded, additionalTools, refusals, idFor }, _op
|
|
|
157
157
|
}
|
|
158
158
|
return counts;
|
|
159
159
|
}
|
|
160
|
+
/** One contract tool whose handler validates, scopes capabilities and gates the result. */
|
|
161
|
+
function contractTool({ required, tool, generationOf }) {
|
|
162
|
+
const { isLive, issued } = generationOf;
|
|
163
|
+
const { descriptor, module } = tool.loaded;
|
|
164
|
+
const contribution = {
|
|
165
|
+
name: descriptor.name, description: descriptor.description, inputSchema: descriptor.inputSchema, effect: descriptor.effect,
|
|
166
|
+
async handler({ pluginId, auth, input, signal }) {
|
|
167
|
+
// Defense in depth: the registry rechecks enablement, but a retained handler must not run either.
|
|
168
|
+
if (!isLive())
|
|
169
|
+
throw new Error(REVOKED_MESSAGE);
|
|
170
|
+
const checked = validatedInput(tool, input);
|
|
171
|
+
const host = required.capabilities({ pluginId, workspaceId: auth.workspaceId,
|
|
172
|
+
...(auth.principalId === undefined ? {} : { principalId: auth.principalId }), ...(signal === undefined ? {} : { signal }) });
|
|
173
|
+
const session = openCapabilitySession({ capabilities: host, isLive, issued, connections: callConnections(checked) }, signal === undefined ? {} : { signal });
|
|
174
|
+
return runInCapabilitySession({ session, run: async () => session.release({
|
|
175
|
+
value: await module.invoke({ input: checked, capabilities: session.capabilities, ...(signal === undefined ? {} : { signal }) }),
|
|
176
|
+
}) });
|
|
177
|
+
},
|
|
178
|
+
};
|
|
179
|
+
return Object.freeze(contribution);
|
|
180
|
+
}
|
|
181
|
+
/** A fresh generation for one plugin; its tools are live only while the registry holds it. */
|
|
182
|
+
function generation({ required, pluginId, tools, additional }) {
|
|
183
|
+
const { registry } = required;
|
|
184
|
+
let snapshot;
|
|
185
|
+
const isLive = () => snapshot !== undefined && registry.list({}).includes(snapshot);
|
|
186
|
+
const issued = required.issuedTokens.forPlugin({ pluginId });
|
|
187
|
+
snapshot = Object.freeze({ pluginId, sdk: INERT_SDK, routes: Object.freeze([]), widgets: Object.freeze([]),
|
|
188
|
+
tools: Object.freeze([...tools.map(tool => contractTool({ required, tool, generationOf: { isLive, issued } })), ...additional.map(({ tool }) => Object.freeze({
|
|
189
|
+
...tool,
|
|
190
|
+
handler(input) {
|
|
191
|
+
if (!isLive())
|
|
192
|
+
throw new Error(REVOKED_MESSAGE);
|
|
193
|
+
return tool.handler(input);
|
|
194
|
+
},
|
|
195
|
+
}))]) });
|
|
196
|
+
return { snapshot, tools, additional };
|
|
197
|
+
}
|
|
198
|
+
/** Replaces one plugin's generation unless it is unchanged; a refused replacement detaches it. */
|
|
199
|
+
function place({ required, state, pluginId, tools, additional, refusals }) {
|
|
200
|
+
const { registry } = required;
|
|
201
|
+
const previous = state.projected.get(pluginId);
|
|
202
|
+
if (sameTools(previous, tools, additional))
|
|
203
|
+
return previous;
|
|
204
|
+
const next = generation({ required, pluginId, tools, additional });
|
|
205
|
+
try {
|
|
206
|
+
registry.replace({ contributions: next.snapshot });
|
|
207
|
+
return next;
|
|
208
|
+
}
|
|
209
|
+
catch (error) {
|
|
210
|
+
registry.detach({ pluginId });
|
|
211
|
+
refusals.push(`agent tools from '${pluginId}' were not loaded: ${error instanceof Error ? error.message : String(error)}`);
|
|
212
|
+
return undefined;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
/** Projects one load result. @returns The loader's refusals plus this seam's own, in order. */
|
|
216
|
+
function syncProjection({ required, state, input }) {
|
|
217
|
+
const refusals = [...input.refusals];
|
|
218
|
+
const { grouped, additional } = groupProjectionTools({
|
|
219
|
+
loaded: input.loaded, additionalTools: input.additionalTools, refusals, toolIdFor: required.toolIdFor,
|
|
220
|
+
});
|
|
221
|
+
const idFor = required.toolIdFor;
|
|
222
|
+
const counts = countProjectionClaims({ loaded: input.loaded, additionalTools: input.additionalTools, refusals, idFor });
|
|
223
|
+
const nextProjected = new Map();
|
|
224
|
+
for (const [pluginId, tools] of grouped) {
|
|
225
|
+
const unique = tools.filter(tool => counts.get(tool.toolId) === 1);
|
|
226
|
+
const extras = (additional.get(pluginId) ?? []).filter(entry => counts.get(idFor({ pluginId, name: entry.tool.name })) === 1);
|
|
227
|
+
const placed = place({ required, state, pluginId, tools: unique, additional: extras, refusals });
|
|
228
|
+
if (placed)
|
|
229
|
+
nextProjected.set(pluginId, placed);
|
|
230
|
+
}
|
|
231
|
+
for (const pluginId of state.projected.keys())
|
|
232
|
+
if (!grouped.has(pluginId))
|
|
233
|
+
required.registry.detach({ pluginId });
|
|
234
|
+
state.projected = nextProjected;
|
|
235
|
+
state.additionalById = new Map([...nextProjected.values()].flatMap(plugin => plugin.additional.map(entry => [idFor({ pluginId: entry.pluginId, name: entry.tool.name }), { entry, snapshot: plugin.snapshot }])));
|
|
236
|
+
state.byToolId = new Map([...nextProjected.values()].flatMap(plugin => plugin.tools.map(tool => [tool.toolId, { tool, snapshot: plugin.snapshot }])));
|
|
237
|
+
return { refusals };
|
|
238
|
+
}
|
|
239
|
+
/** What a call would change, for the confirmation prompt; null for an unknown or withdrawn tool.
|
|
240
|
+
* @throws ToolInputError for input that fails the schema; Error for an invalid hook answer. */
|
|
241
|
+
async function describeProjectedResources({ required, state, input }) {
|
|
242
|
+
const extra = state.additionalById.get(input.toolId);
|
|
243
|
+
if (extra && required.registry.list({}).includes(extra.snapshot)) {
|
|
244
|
+
return describeAdditionalResources({ entry: extra.entry, input: input.input, toolId: input.toolId, issuedTokens: required.issuedTokens });
|
|
245
|
+
}
|
|
246
|
+
const entry = state.byToolId.get(input.toolId);
|
|
247
|
+
if (!entry || !required.registry.list({}).includes(entry.snapshot))
|
|
248
|
+
return null;
|
|
249
|
+
const { tool } = entry;
|
|
250
|
+
const checked = validatedInput(tool, input.input);
|
|
251
|
+
const connections = callConnections(checked);
|
|
252
|
+
const describe = tool.loaded.module.describeAffectedResources;
|
|
253
|
+
if (!describe)
|
|
254
|
+
return { effect: tool.loaded.descriptor.effect, resources: [], connections };
|
|
255
|
+
// The same per-plugin token memory the plugin's calls feed: its answers and errors are scanned alike.
|
|
256
|
+
const scan = openCredentialScan({ issued: required.issuedTokens.forPlugin({ pluginId: tool.loaded.pluginId }) });
|
|
257
|
+
let answer;
|
|
258
|
+
try {
|
|
259
|
+
answer = await describe({ input: checked });
|
|
260
|
+
}
|
|
261
|
+
catch (error) {
|
|
262
|
+
throw scan.sanitize({ error });
|
|
263
|
+
}
|
|
264
|
+
return { effect: tool.loaded.descriptor.effect, resources: checkedResources(tool.toolId, answer, scan), connections };
|
|
265
|
+
}
|
|
160
266
|
/**
|
|
161
267
|
* Creates the projection for one dedicated contribution registry (keyed by plugin id, so it must not
|
|
162
268
|
* be shared with site plugins whose ids could match). Call `sync` after every load: on boot and on
|
|
@@ -169,115 +275,10 @@ function countProjectionClaims({ loaded, additionalTools, refusals, idFor }, _op
|
|
|
169
275
|
* @complexity sync is O(t) tools plus schema compilation; disclosure lookup is O(1).
|
|
170
276
|
*/
|
|
171
277
|
export function createAgentPluginToolProjection(required, _optional = {}) {
|
|
172
|
-
const {
|
|
173
|
-
let projected = new Map();
|
|
174
|
-
let additionalById = new Map();
|
|
175
|
-
let byToolId = new Map();
|
|
176
|
-
/** One contract tool whose handler validates, scopes capabilities and gates the result. */
|
|
177
|
-
function contractTool(tool, generationOf) {
|
|
178
|
-
const { isLive, issued } = generationOf;
|
|
179
|
-
const { descriptor, module } = tool.loaded;
|
|
180
|
-
const contribution = {
|
|
181
|
-
name: descriptor.name, description: descriptor.description, inputSchema: descriptor.inputSchema, effect: descriptor.effect,
|
|
182
|
-
async handler({ pluginId, auth, input, signal }) {
|
|
183
|
-
// Defense in depth: the registry rechecks enablement, but a retained handler must not run either.
|
|
184
|
-
if (!isLive())
|
|
185
|
-
throw new Error(REVOKED_MESSAGE);
|
|
186
|
-
const checked = validatedInput(tool, input);
|
|
187
|
-
const host = required.capabilities({ pluginId, workspaceId: auth.workspaceId,
|
|
188
|
-
...(auth.principalId === undefined ? {} : { principalId: auth.principalId }), ...(signal === undefined ? {} : { signal }) });
|
|
189
|
-
const session = openCapabilitySession({ capabilities: host, isLive, issued, connections: callConnections(checked) }, signal === undefined ? {} : { signal });
|
|
190
|
-
return runInCapabilitySession({ session, run: async () => session.release({
|
|
191
|
-
value: await module.invoke({ input: checked, capabilities: session.capabilities, ...(signal === undefined ? {} : { signal }) }),
|
|
192
|
-
}) });
|
|
193
|
-
},
|
|
194
|
-
};
|
|
195
|
-
return Object.freeze(contribution);
|
|
196
|
-
}
|
|
197
|
-
/** A fresh generation for one plugin; its tools are live only while the registry holds it. */
|
|
198
|
-
function generation(pluginId, tools, additional) {
|
|
199
|
-
let snapshot;
|
|
200
|
-
const isLive = () => snapshot !== undefined && registry.list({}).includes(snapshot);
|
|
201
|
-
const issued = required.issuedTokens.forPlugin({ pluginId });
|
|
202
|
-
snapshot = Object.freeze({ pluginId, sdk: INERT_SDK, routes: Object.freeze([]), widgets: Object.freeze([]),
|
|
203
|
-
tools: Object.freeze([...tools.map(tool => contractTool(tool, { isLive, issued })), ...additional.map(({ tool }) => Object.freeze({
|
|
204
|
-
...tool,
|
|
205
|
-
handler(input) {
|
|
206
|
-
if (!isLive())
|
|
207
|
-
throw new Error(REVOKED_MESSAGE);
|
|
208
|
-
return tool.handler(input);
|
|
209
|
-
},
|
|
210
|
-
}))]) });
|
|
211
|
-
return { snapshot, tools, additional };
|
|
212
|
-
}
|
|
213
|
-
/** Replaces one plugin's generation unless it is unchanged; a refused replacement detaches it. */
|
|
214
|
-
function place(pluginId, tools, additional, refusals) {
|
|
215
|
-
const previous = projected.get(pluginId);
|
|
216
|
-
if (sameTools(previous, tools, additional))
|
|
217
|
-
return previous;
|
|
218
|
-
const next = generation(pluginId, tools, additional);
|
|
219
|
-
try {
|
|
220
|
-
registry.replace({ contributions: next.snapshot });
|
|
221
|
-
return next;
|
|
222
|
-
}
|
|
223
|
-
catch (error) {
|
|
224
|
-
registry.detach({ pluginId });
|
|
225
|
-
refusals.push(`agent tools from '${pluginId}' were not loaded: ${error instanceof Error ? error.message : String(error)}`);
|
|
226
|
-
return undefined;
|
|
227
|
-
}
|
|
228
|
-
}
|
|
278
|
+
const state = { projected: new Map(), additionalById: new Map(), byToolId: new Map() };
|
|
229
279
|
return {
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
const refusals = [...input.refusals];
|
|
233
|
-
const { grouped, additional } = groupProjectionTools({
|
|
234
|
-
loaded: input.loaded, additionalTools: input.additionalTools, refusals, toolIdFor: required.toolIdFor,
|
|
235
|
-
});
|
|
236
|
-
const idFor = required.toolIdFor;
|
|
237
|
-
const counts = countProjectionClaims({ loaded: input.loaded, additionalTools: input.additionalTools, refusals, idFor });
|
|
238
|
-
const nextProjected = new Map();
|
|
239
|
-
for (const [pluginId, tools] of grouped) {
|
|
240
|
-
const unique = tools.filter(tool => counts.get(tool.toolId) === 1);
|
|
241
|
-
const extras = (additional.get(pluginId) ?? []).filter(entry => counts.get(idFor({ pluginId, name: entry.tool.name })) === 1);
|
|
242
|
-
const placed = place(pluginId, unique, extras, refusals);
|
|
243
|
-
if (placed)
|
|
244
|
-
nextProjected.set(pluginId, placed);
|
|
245
|
-
}
|
|
246
|
-
for (const pluginId of projected.keys())
|
|
247
|
-
if (!grouped.has(pluginId))
|
|
248
|
-
registry.detach({ pluginId });
|
|
249
|
-
projected = nextProjected;
|
|
250
|
-
additionalById = new Map([...nextProjected.values()].flatMap(plugin => plugin.additional.map(entry => [idFor({ pluginId: entry.pluginId, name: entry.tool.name }), { entry, snapshot: plugin.snapshot }])));
|
|
251
|
-
byToolId = new Map([...nextProjected.values()].flatMap(plugin => plugin.tools.map(tool => [tool.toolId, { tool, snapshot: plugin.snapshot }])));
|
|
252
|
-
return { refusals };
|
|
253
|
-
},
|
|
254
|
-
/** What a call would change, for the confirmation prompt; null for an unknown or withdrawn tool.
|
|
255
|
-
* @throws ToolInputError for input that fails the schema; Error for an invalid hook answer. */
|
|
256
|
-
async describeAffectedResources(input, _options = {}) {
|
|
257
|
-
const extra = additionalById.get(input.toolId);
|
|
258
|
-
if (extra && registry.list({}).includes(extra.snapshot)) {
|
|
259
|
-
return describeAdditionalResources({ entry: extra.entry, input: input.input, toolId: input.toolId, issuedTokens: required.issuedTokens });
|
|
260
|
-
}
|
|
261
|
-
const entry = byToolId.get(input.toolId);
|
|
262
|
-
if (!entry || !registry.list({}).includes(entry.snapshot))
|
|
263
|
-
return null;
|
|
264
|
-
const { tool } = entry;
|
|
265
|
-
const checked = validatedInput(tool, input.input);
|
|
266
|
-
const connections = callConnections(checked);
|
|
267
|
-
const describe = tool.loaded.module.describeAffectedResources;
|
|
268
|
-
if (!describe)
|
|
269
|
-
return { effect: tool.loaded.descriptor.effect, resources: [], connections };
|
|
270
|
-
// The same per-plugin token memory the plugin's calls feed: its answers and errors are scanned alike.
|
|
271
|
-
const scan = openCredentialScan({ issued: required.issuedTokens.forPlugin({ pluginId: tool.loaded.pluginId }) });
|
|
272
|
-
let answer;
|
|
273
|
-
try {
|
|
274
|
-
answer = await describe({ input: checked });
|
|
275
|
-
}
|
|
276
|
-
catch (error) {
|
|
277
|
-
throw scan.sanitize({ error });
|
|
278
|
-
}
|
|
279
|
-
return { effect: tool.loaded.descriptor.effect, resources: checkedResources(tool.toolId, answer, scan), connections };
|
|
280
|
-
},
|
|
280
|
+
sync: (input, _options = {}) => syncProjection({ required, state, input }),
|
|
281
|
+
describeAffectedResources: (input, _options = {}) => describeProjectedResources({ required, state, input }),
|
|
281
282
|
};
|
|
282
283
|
}
|
|
283
284
|
async function describeAdditionalResources({ entry, input, toolId, issuedTokens }) {
|
|
@@ -2,7 +2,7 @@ import type { AgentPluginLifecyclePorts } from "./ports.js";
|
|
|
2
2
|
/**
|
|
3
3
|
* @file The shared trust gate for plugin-contributed files that core reads or runs: deploy targets
|
|
4
4
|
* (`features/deployments/deploy-targets/registry.ts`), deploy-config generators, credential
|
|
5
|
-
* scheme rules, mail adapters (
|
|
5
|
+
* scheme rules, mail adapters (`packages/agent-plugins/src/lifecycle/mail/contribution.ts`) and git-host providers
|
|
6
6
|
* (`features/source-control/provider-registry.ts`). One place decides which installed Agent Plugin packages core may take a contribution
|
|
7
7
|
* from, so every seam applies the same rules.
|
|
8
8
|
*
|
|
@@ -57,7 +57,7 @@ export type TrustedPluginVerdict = {
|
|
|
57
57
|
readonly refusal: string;
|
|
58
58
|
};
|
|
59
59
|
/** Internal composition; one state/queue instance per injected host context. */
|
|
60
|
-
export declare function createTrustedPluginFilesModule(ports: AgentPluginLifecyclePorts): {
|
|
60
|
+
export declare function createTrustedPluginFilesModule(ports: AgentPluginLifecyclePorts, _optional?: Record<string, never>): {
|
|
61
61
|
findTrustedPluginPackages: (query: TrustedPluginPackagesQuery) => Promise<readonly TrustedPluginVerdict[]>;
|
|
62
62
|
readTrustedPluginFile: (plugin: TrustedPluginPackage, filename: string) => Promise<string>;
|
|
63
63
|
importContainedModule: (plugin: TrustedPluginPackage, modulePath: string) => Promise<{
|
|
@@ -89,7 +89,7 @@ function buildModule(ports) {
|
|
|
89
89
|
}
|
|
90
90
|
const instances = new WeakMap();
|
|
91
91
|
/** Internal composition; one state/queue instance per injected host context. */
|
|
92
|
-
export function createTrustedPluginFilesModule(ports) {
|
|
92
|
+
export function createTrustedPluginFilesModule(ports, _optional = {}) {
|
|
93
93
|
let instance = instances.get(ports);
|
|
94
94
|
if (!instance) {
|
|
95
95
|
instance = buildModule(ports);
|
|
@@ -61,7 +61,7 @@ export interface StagedTree {
|
|
|
61
61
|
readonly originalMode: number;
|
|
62
62
|
}
|
|
63
63
|
/** Internal composition; one state/queue instance per injected host context. */
|
|
64
|
-
export declare function createUninstallModule(ports: AgentPluginLifecyclePorts): {
|
|
64
|
+
export declare function createUninstallModule(ports: AgentPluginLifecyclePorts, _optional?: Record<string, never>): {
|
|
65
65
|
previewAgentPluginUninstall: (required: UninstallAgentPluginRequired) => Promise<AgentPluginUninstallPreview>;
|
|
66
66
|
uninstallAgentPlugin: (required: UninstallAgentPluginRequired, optional?: UninstallAgentPluginOptional) => Promise<UninstallAgentPluginResult>;
|
|
67
67
|
stageForRemoval: (packagesDir: string, packageRoot: string, optional?: {
|