@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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { redactSecrets, ToolInputError } from '@jini-ai/core';
|
|
1
|
+
import { describeErrorForLog, redactSecrets, ToolInputError } from '@jini-ai/core';
|
|
2
2
|
import { createPluginLookup, readPluginIdentity, assertPluginIdentityAvailable } from '@jini-ai/core/plugin-directory';
|
|
3
3
|
import { provisionAgentPluginMcpServers, resolveAgentPluginMcpServers } from '../federate-mcp.js';
|
|
4
4
|
import { recordAgentPluginAccessDeclined } from '../apply-connect-defaults.js';
|
|
@@ -7,8 +7,9 @@ import { previewAgentPluginEnableAccess } from '../enable-access.js';
|
|
|
7
7
|
* report a partial failure to its caller. O(s) in failed declared servers, no extra I/O.
|
|
8
8
|
*/
|
|
9
9
|
function reportProvisioningFailures({ pluginId, failed, approved, warn, messages }) {
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
// Provisioning already reported caught exceptions; this callback sees only safe failure reasons.
|
|
11
|
+
for (const { serverKey, reason: why } of failed)
|
|
12
|
+
warn(redactSecrets({ input: `Plugin '${pluginId}': MCP provisioning for server '${serverKey}' failed — ${why}` }));
|
|
12
13
|
if (approved && failed.length)
|
|
13
14
|
throw new ToolInputError({ message: redactSecrets({ input: messages.provisioningFailed({ pluginId, failed }) }) });
|
|
14
15
|
}
|
|
@@ -18,6 +19,111 @@ function requireApprovedAccessKey(key, messages) {
|
|
|
18
19
|
throw new ToolInputError({ message: messages.approvedSnapshotMissing() });
|
|
19
20
|
return key;
|
|
20
21
|
}
|
|
22
|
+
async function listSiteProviders({ deps, forAdmission }) {
|
|
23
|
+
const { warn } = deps;
|
|
24
|
+
const providers = [];
|
|
25
|
+
for (const record of await deps.discoverPlugins()) {
|
|
26
|
+
if (record.status !== 'valid' || !record.manifest) {
|
|
27
|
+
warn(`Plugin '${record.id}': invalid installed manifest omitted from metadata lookup.`);
|
|
28
|
+
continue;
|
|
29
|
+
}
|
|
30
|
+
let parsed;
|
|
31
|
+
try {
|
|
32
|
+
parsed = readPluginIdentity({ manifest: record.manifest, name: record.id, namespace: deps.namespace });
|
|
33
|
+
}
|
|
34
|
+
catch {
|
|
35
|
+
warn(`Plugin '${record.id}': installed identity manifest is unreadable or invalid; omitted from metadata lookup.`);
|
|
36
|
+
}
|
|
37
|
+
if (parsed) {
|
|
38
|
+
const { warnings, ...identity } = parsed;
|
|
39
|
+
warnings.forEach(warn);
|
|
40
|
+
const activation = forAdmission ? null : await deps.getActivation({ workspaceId: deps.workspaceId, pluginId: record.id });
|
|
41
|
+
providers.push({ ...identity, version: record.version, enabled: activation?.enabled === true, family: 'site-runtime', localId: record.id });
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return providers;
|
|
45
|
+
}
|
|
46
|
+
async function resolveAgentProviders({ deps, agentProviders }) {
|
|
47
|
+
const { warn, lifecycle } = deps;
|
|
48
|
+
const providers = [];
|
|
49
|
+
for (const [pluginId, revisions] of agentProviders) {
|
|
50
|
+
// Multiple digests are revisions of one install, not duplicate provider registrations.
|
|
51
|
+
// Without a recorded winner the existing lifecycle refuses to guess; discovery follows it
|
|
52
|
+
// by omitting this plugin, while unrelated lookup and installation remain available.
|
|
53
|
+
if (revisions.length !== 1) {
|
|
54
|
+
const declaredIds = new Set(revisions.map(provider => provider.id).filter(id => id !== `unknown/${pluginId}`));
|
|
55
|
+
warn(`Plugin '${pluginId}': ${declaredIds.size > 1 ? 'conflicting publisher identities' : 'ambiguous installed revisions'}; omitted from metadata lookup.`);
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
providers.push({ ...revisions[0], enabled: await lifecycle.isEnabled({ pluginId }) });
|
|
59
|
+
}
|
|
60
|
+
return providers;
|
|
61
|
+
}
|
|
62
|
+
async function listAgentProviders({ deps, forAdmission }) {
|
|
63
|
+
const { warn, lifecycle } = deps;
|
|
64
|
+
const providers = [];
|
|
65
|
+
const agentProviders = new Map();
|
|
66
|
+
// A legacy revision may acquire its first publisher identity at upgrade; old frozen
|
|
67
|
+
// digests can remain present from older installs until successful publication prunes them.
|
|
68
|
+
// Reuse that owner's selection; metadata lookup must not invent a newest-version policy.
|
|
69
|
+
const installed = await lifecycle.listInstalled();
|
|
70
|
+
const preferred = forAdmission ? installed : await lifecycle.preferInstalled({ installed });
|
|
71
|
+
const preferredKeys = new Set(preferred.map(plugin => `${plugin.pluginId}:${plugin.archiveDigest}`));
|
|
72
|
+
for (const plugin of installed) {
|
|
73
|
+
let parsed;
|
|
74
|
+
try {
|
|
75
|
+
parsed = await lifecycle.readIdentity({ plugin });
|
|
76
|
+
}
|
|
77
|
+
catch {
|
|
78
|
+
warn(`Plugin '${plugin.pluginId}': installed identity manifest is unreadable or invalid; omitted from metadata lookup.`);
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
const { warnings, ...identity } = parsed;
|
|
82
|
+
warnings.forEach(warn);
|
|
83
|
+
const provider = { ...identity, version: plugin.version ?? null, enabled: false, family: 'agent-plugin', localId: plugin.pluginId };
|
|
84
|
+
if (forAdmission)
|
|
85
|
+
providers.push(provider);
|
|
86
|
+
else {
|
|
87
|
+
if (preferredKeys.has(`${plugin.pluginId}:${plugin.archiveDigest}`)) {
|
|
88
|
+
const revisions = agentProviders.get(plugin.pluginId) ?? [];
|
|
89
|
+
revisions.push(provider);
|
|
90
|
+
agentProviders.set(plugin.pluginId, revisions);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return providers.concat(await resolveAgentProviders({ deps, agentProviders }));
|
|
95
|
+
}
|
|
96
|
+
/** Provisioning must use the same two owners as the admin toggle. A failed connection never
|
|
97
|
+
* rolls back a successful activation; report fixed diagnostics without credential material. */
|
|
98
|
+
async function provisionPluginMcp({ deps, optional, pluginId, principalId, execution }) {
|
|
99
|
+
const { warn, mcp, mcpPorts } = deps;
|
|
100
|
+
const resolveServers = (id) => (optional.resolveMcpServers ?? resolveAgentPluginMcpServers)({ agentPluginLayout: deps.agentPluginLayout, lifecycle: deps.installedMcp, workspaceId: deps.workspaceId, pluginId: id });
|
|
101
|
+
try {
|
|
102
|
+
const approvedEnable = execution.approvedEnable ? { principalId, accessKey: requireApprovedAccessKey(execution.approvedEnableKey, deps.messages) } : undefined;
|
|
103
|
+
const servers = await resolveServers(pluginId);
|
|
104
|
+
const result = await (optional.provisionMcpServers ?? provisionAgentPluginMcpServers)({ deps: mcp, workspaceId: deps.workspaceId, pluginId, servers, principalId, classifyTrust: deps.classifyTrust, messages: deps.messages }, { report: deps.report });
|
|
105
|
+
reportProvisioningFailures({ pluginId, failed: result.failed, approved: execution.approvedEnable === true, warn, messages: deps.messages });
|
|
106
|
+
// Same as the admin toggle: an account signed in while the plugin was off gets the plugin's
|
|
107
|
+
// declared tools now (bug 2026-11-04, the host's sign-in grant owner).
|
|
108
|
+
await deps.grantSignedInDefaults({
|
|
109
|
+
deps: { workspaceId: deps.workspaceId, agentPluginLayout: deps.agentPluginLayout, repo: mcp.repo, applyAccess: mcp.applyAccess, clock: deps.clock, ...mcpPorts,
|
|
110
|
+
notifyRosterChanged: () => mcp.notifyRosterChanged({}, {}), warn: message => warn(redactSecrets({ input: message })) },
|
|
111
|
+
pluginId,
|
|
112
|
+
servers,
|
|
113
|
+
}, { skipServerKeys: result.failed.map(failure => failure.serverKey), ...(approvedEnable ? { approvedEnable } : {}) });
|
|
114
|
+
}
|
|
115
|
+
catch (error) {
|
|
116
|
+
const detail = describeErrorForLog({ err: error });
|
|
117
|
+
if (execution.approvedEnable)
|
|
118
|
+
throw new ToolInputError({ message: redactSecrets({ input: deps.messages.approvedLoadFailed({ detail }) }) });
|
|
119
|
+
// An injected reporter receives the caught value itself; the default channel logs its class only.
|
|
120
|
+
const logger = deps.report;
|
|
121
|
+
if (logger)
|
|
122
|
+
logger.warn({ message: `Plugin '${pluginId}': MCP provisioning could not run.` }, { error });
|
|
123
|
+
else
|
|
124
|
+
warn(redactSecrets({ input: `Plugin '${pluginId}': MCP provisioning could not run — ${detail}` }));
|
|
125
|
+
}
|
|
126
|
+
}
|
|
21
127
|
/** Bind both plugin families to one workspace. Read manifests through the same installed-package
|
|
22
128
|
* index.
|
|
23
129
|
* @throws Unreadable activation (fail closed).
|
|
@@ -27,80 +133,9 @@ function requireApprovedAccessKey(key, messages) {
|
|
|
27
133
|
*/
|
|
28
134
|
export function createPluginHost({ deps }, optional = {}) {
|
|
29
135
|
const { warn, lifecycle } = deps;
|
|
30
|
-
const listSiteProviders = async ({ forAdmission }, _options = {}) => {
|
|
31
|
-
const providers = [];
|
|
32
|
-
for (const record of await deps.discoverPlugins()) {
|
|
33
|
-
if (record.status !== 'valid' || !record.manifest) {
|
|
34
|
-
warn(`Plugin '${record.id}': invalid installed manifest omitted from metadata lookup.`);
|
|
35
|
-
continue;
|
|
36
|
-
}
|
|
37
|
-
let parsed;
|
|
38
|
-
try {
|
|
39
|
-
parsed = readPluginIdentity({ manifest: record.manifest, name: record.id, namespace: deps.namespace });
|
|
40
|
-
}
|
|
41
|
-
catch {
|
|
42
|
-
warn(`Plugin '${record.id}': installed identity manifest is unreadable or invalid; omitted from metadata lookup.`);
|
|
43
|
-
}
|
|
44
|
-
if (parsed) {
|
|
45
|
-
const { warnings, ...identity } = parsed;
|
|
46
|
-
warnings.forEach(warn);
|
|
47
|
-
const activation = forAdmission ? null : await deps.getActivation({ workspaceId: deps.workspaceId, pluginId: record.id });
|
|
48
|
-
providers.push({ ...identity, version: record.version, enabled: activation?.enabled === true, family: 'site-runtime', localId: record.id });
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
return providers;
|
|
52
|
-
};
|
|
53
|
-
const resolveAgentProviders = async ({ agentProviders }, _options = {}) => {
|
|
54
|
-
const providers = [];
|
|
55
|
-
for (const [pluginId, revisions] of agentProviders) {
|
|
56
|
-
// Multiple digests are revisions of one install, not duplicate provider registrations.
|
|
57
|
-
// Without a recorded winner the existing lifecycle refuses to guess; discovery follows it
|
|
58
|
-
// by omitting this plugin, while unrelated lookup and installation remain available.
|
|
59
|
-
if (revisions.length !== 1) {
|
|
60
|
-
const declaredIds = new Set(revisions.map(provider => provider.id).filter(id => id !== `unknown/${pluginId}`));
|
|
61
|
-
warn(`Plugin '${pluginId}': ${declaredIds.size > 1 ? 'conflicting publisher identities' : 'ambiguous installed revisions'}; omitted from metadata lookup.`);
|
|
62
|
-
continue;
|
|
63
|
-
}
|
|
64
|
-
providers.push({ ...revisions[0], enabled: await lifecycle.isEnabled({ pluginId }) });
|
|
65
|
-
}
|
|
66
|
-
return providers;
|
|
67
|
-
};
|
|
68
|
-
const listAgentProviders = async ({ forAdmission }, _options = {}) => {
|
|
69
|
-
const providers = [];
|
|
70
|
-
const agentProviders = new Map();
|
|
71
|
-
// A legacy revision may acquire its first publisher identity at upgrade; old frozen
|
|
72
|
-
// digests can remain present from older installs until successful publication prunes them.
|
|
73
|
-
// Reuse that owner's selection; metadata lookup must not invent a newest-version policy.
|
|
74
|
-
const installed = await lifecycle.listInstalled();
|
|
75
|
-
const preferred = forAdmission ? installed : await lifecycle.preferInstalled({ installed });
|
|
76
|
-
const preferredKeys = new Set(preferred.map(plugin => `${plugin.pluginId}:${plugin.archiveDigest}`));
|
|
77
|
-
for (const plugin of installed) {
|
|
78
|
-
let parsed;
|
|
79
|
-
try {
|
|
80
|
-
parsed = await lifecycle.readIdentity({ plugin });
|
|
81
|
-
}
|
|
82
|
-
catch {
|
|
83
|
-
warn(`Plugin '${plugin.pluginId}': installed identity manifest is unreadable or invalid; omitted from metadata lookup.`);
|
|
84
|
-
continue;
|
|
85
|
-
}
|
|
86
|
-
const { warnings, ...identity } = parsed;
|
|
87
|
-
warnings.forEach(warn);
|
|
88
|
-
const provider = { ...identity, version: plugin.version ?? null, enabled: false, family: 'agent-plugin', localId: plugin.pluginId };
|
|
89
|
-
if (forAdmission)
|
|
90
|
-
providers.push(provider);
|
|
91
|
-
else {
|
|
92
|
-
if (preferredKeys.has(`${plugin.pluginId}:${plugin.archiveDigest}`)) {
|
|
93
|
-
const revisions = agentProviders.get(plugin.pluginId) ?? [];
|
|
94
|
-
revisions.push(provider);
|
|
95
|
-
agentProviders.set(plugin.pluginId, revisions);
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
return providers.concat(await resolveAgentProviders({ agentProviders }));
|
|
100
|
-
};
|
|
101
136
|
const listProviders = async ({ forAdmission = false } = {}, _options = {}) => {
|
|
102
|
-
const providers = await listSiteProviders({ forAdmission });
|
|
103
|
-
return providers.concat(await listAgentProviders({ forAdmission }));
|
|
137
|
+
const providers = await listSiteProviders({ deps, forAdmission });
|
|
138
|
+
return providers.concat(await listAgentProviders({ deps, forAdmission }));
|
|
104
139
|
};
|
|
105
140
|
const lookup = createPluginLookup({ listPlugins: listProviders }, { warn });
|
|
106
141
|
const resolveServers = (pluginId) => (optional.resolveMcpServers ?? resolveAgentPluginMcpServers)({ agentPluginLayout: deps.agentPluginLayout, lifecycle: deps.installedMcp, workspaceId: deps.workspaceId, pluginId });
|
|
@@ -116,30 +151,8 @@ export function createPluginHost({ deps }, optional = {}) {
|
|
|
116
151
|
preferInstalled: input => lifecycle.preferInstalled(input),
|
|
117
152
|
assertWritable: () => lifecycle.assertWritable(),
|
|
118
153
|
setEnabled: input => lifecycle.setEnabled(input),
|
|
119
|
-
/** Provisioning must use the same two owners as the admin toggle
|
|
120
|
-
|
|
121
|
-
provisionMcp: async ({ pluginId, principalId }, execution = {}) => {
|
|
122
|
-
try {
|
|
123
|
-
const approvedEnable = execution.approvedEnable ? { principalId, accessKey: requireApprovedAccessKey(execution.approvedEnableKey, deps.messages) } : undefined;
|
|
124
|
-
const servers = await resolveServers(pluginId);
|
|
125
|
-
const result = await (optional.provisionMcpServers ?? provisionAgentPluginMcpServers)(mcp, { workspaceId: deps.workspaceId, pluginId, servers, principalId, classifyTrust: deps.classifyTrust, messages: deps.messages });
|
|
126
|
-
reportProvisioningFailures({ pluginId, failed: result.failed, approved: execution.approvedEnable === true, warn, messages: deps.messages });
|
|
127
|
-
// Same as the admin toggle: an account signed in while the plugin was off gets the plugin's
|
|
128
|
-
// declared tools now (bug 2026-11-04, the host's sign-in grant owner).
|
|
129
|
-
await deps.grantSignedInDefaults({
|
|
130
|
-
deps: { workspaceId: deps.workspaceId, agentPluginLayout: deps.agentPluginLayout, repo: mcp.repo, applyAccess: mcp.applyAccess, clock: deps.clock, ...mcpPorts,
|
|
131
|
-
notifyRosterChanged: () => mcp.notifyRosterChanged({}, {}), warn: message => warn(redactSecrets({ input: message })) },
|
|
132
|
-
pluginId,
|
|
133
|
-
servers,
|
|
134
|
-
}, { skipServerKeys: result.failed.map(failure => failure.serverKey), ...(approvedEnable ? { approvedEnable } : {}) });
|
|
135
|
-
}
|
|
136
|
-
catch (error) {
|
|
137
|
-
const detail = error instanceof Error ? error.message : String(error);
|
|
138
|
-
if (execution.approvedEnable)
|
|
139
|
-
throw new ToolInputError({ message: redactSecrets({ input: deps.messages.approvedLoadFailed({ detail }) }) });
|
|
140
|
-
warn(redactSecrets({ input: `Plugin '${pluginId}': MCP provisioning could not run — ${detail}` }));
|
|
141
|
-
}
|
|
142
|
-
},
|
|
154
|
+
/** Provisioning must use the same two owners as the admin toggle; see `provisionPluginMcp`. */
|
|
155
|
+
provisionMcp: ({ pluginId, principalId }, execution = {}) => provisionPluginMcp({ deps, optional, pluginId, principalId, execution }),
|
|
143
156
|
uninstall: input => lifecycle.uninstall(input),
|
|
144
157
|
};
|
|
145
158
|
return {
|
package/dist/connect/ports.d.ts
CHANGED
|
@@ -23,7 +23,7 @@ export type AgentPluginMcpRecord = ExternalMcpServerRecord;
|
|
|
23
23
|
export type AgentPluginMcpSave = SaveExternalMcpServerInput;
|
|
24
24
|
/** @agent-note The host's token-hint shape stays opaque here (`unknown`); this package never reads it. */
|
|
25
25
|
export type AgentPluginMcpView = ExternalMcpServerView<unknown>;
|
|
26
|
-
export type AgentPluginMcpRepo = Pick<ExternalMcpServerRepoPort, 'findByServerId' | '
|
|
26
|
+
export type AgentPluginMcpRepo = Pick<ExternalMcpServerRepoPort, 'findByServerId' | 'updateIfVersion' | 'deleteByServerId' | 'updateAccessIfCurrent'>;
|
|
27
27
|
export type AgentPluginMcpAccessSnapshot = ExternalMcpAccessSnapshot;
|
|
28
28
|
/** @agent-note A second host supplies all six projections together with the paired
|
|
29
29
|
* {@link AgentPluginMcpProjectionPorts.classifyError}; preview, provisioning, sign-in revalidation and
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { AgentPluginMcpRecord, AgentPluginMcpRepo } from "./ports.js";
|
|
2
|
+
/**
|
|
3
|
+
* Changes one provisioned external-MCP row without writing back anything this change did not decide
|
|
4
|
+
* (lost-update design S1, rules M4/M7): read the row, let `build` derive the next one, write it
|
|
5
|
+
* conditionally on the version and credentials that were read; once more from a fresh read if that
|
|
6
|
+
* missed, then a conflict. The whole-row upsert this replaces restored every column read earlier —
|
|
7
|
+
* including a token a refresh had just stored and an access decision an admin had just made.
|
|
8
|
+
*
|
|
9
|
+
* @param required.build - Derives the next row from the row just read; `null` means nothing to write.
|
|
10
|
+
* @returns the row as written, or `null` when it does not exist or `build` had nothing to write.
|
|
11
|
+
* @throws {RecordVersionConflictError} when the row changed again between the retry's read and write.
|
|
12
|
+
* @complexity O(1) writes; at most two reads and two builds.
|
|
13
|
+
*/
|
|
14
|
+
export declare function updateAgentPluginMcpRow({ repo, key, build }: {
|
|
15
|
+
repo: Pick<AgentPluginMcpRepo, "findByServerId" | "updateIfVersion">;
|
|
16
|
+
key: {
|
|
17
|
+
workspaceId: string;
|
|
18
|
+
serverId: string;
|
|
19
|
+
};
|
|
20
|
+
build: (current: AgentPluginMcpRecord) => AgentPluginMcpRecord | null;
|
|
21
|
+
}, _options?: {}): Promise<AgentPluginMcpRecord | null>;
|
|
22
|
+
//# sourceMappingURL=row-update.d.ts.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { applyInternalChange } from "@jini-ai/core/optimistic-concurrency";
|
|
2
|
+
/**
|
|
3
|
+
* Changes one provisioned external-MCP row without writing back anything this change did not decide
|
|
4
|
+
* (lost-update design S1, rules M4/M7): read the row, let `build` derive the next one, write it
|
|
5
|
+
* conditionally on the version and credentials that were read; once more from a fresh read if that
|
|
6
|
+
* missed, then a conflict. The whole-row upsert this replaces restored every column read earlier —
|
|
7
|
+
* including a token a refresh had just stored and an access decision an admin had just made.
|
|
8
|
+
*
|
|
9
|
+
* @param required.build - Derives the next row from the row just read; `null` means nothing to write.
|
|
10
|
+
* @returns the row as written, or `null` when it does not exist or `build` had nothing to write.
|
|
11
|
+
* @throws {RecordVersionConflictError} when the row changed again between the retry's read and write.
|
|
12
|
+
* @complexity O(1) writes; at most two reads and two builds.
|
|
13
|
+
*/
|
|
14
|
+
export async function updateAgentPluginMcpRow({ repo, key, build }, _options = {}) {
|
|
15
|
+
return applyInternalChange({ recordKind: "MCP server", recordId: key.serverId, read: () => repo.findByServerId(key), build: async (current) => build(current),
|
|
16
|
+
write: ({ current, next }) => repo.updateIfVersion({ record: next, expectedVersion: current.version, replaces: { sealedEnv: current.sealedEnv, sealedOAuth: current.sealedOAuth } }) });
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=row-update.js.map
|
|
@@ -41,8 +41,10 @@ export interface SwitchOnSavedTokenDeps {
|
|
|
41
41
|
* @throws Whatever the activation read or write, the connect-defaults write, or the row read throws.
|
|
42
42
|
* @complexity Two activation reads, at most one connect-defaults apply and one activation write, one row read.
|
|
43
43
|
*/
|
|
44
|
-
export declare function switchOnSavedTokenConnection(deps
|
|
44
|
+
export declare function switchOnSavedTokenConnection({ deps, ...target }: {
|
|
45
|
+
deps: SwitchOnSavedTokenDeps;
|
|
46
|
+
} & {
|
|
45
47
|
readonly pluginId: string;
|
|
46
48
|
readonly connectionId: string;
|
|
47
|
-
}): Promise<SavedTokenSwitchOutcome>;
|
|
49
|
+
}, _optional?: Record<string, never>): Promise<SavedTokenSwitchOutcome>;
|
|
48
50
|
//# sourceMappingURL=switch-on-saved-token.d.ts.map
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* @throws Whatever the activation read or write, the connect-defaults write, or the row read throws.
|
|
6
6
|
* @complexity Two activation reads, at most one connect-defaults apply and one activation write, one row read.
|
|
7
7
|
*/
|
|
8
|
-
export async function switchOnSavedTokenConnection(deps, target) {
|
|
8
|
+
export async function switchOnSavedTokenConnection({ deps, ...target }, _optional = {}) {
|
|
9
9
|
const isOff = deps.isPluginOffByOperator;
|
|
10
10
|
if (await isOff(target.pluginId))
|
|
11
11
|
return { state: "plugin-off-by-operator" };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { TokenSignInPlugin } from './token-sign-in.js';
|
|
2
|
+
/**
|
|
3
|
+
* @file Bounded validation of access tokens handed over while a site is being CREATED, and of the
|
|
4
|
+
* token-sign-in plugin rows a host lists for that form. Both inputs come from places the engine does
|
|
5
|
+
* not trust (a renderer, a child process's stdout), so every limit is supplied by the host and no
|
|
6
|
+
* rejection ever echoes a value. Generic: keyed by plugin id, no site, vendor or CLI vocabulary.
|
|
7
|
+
*/
|
|
8
|
+
/** The host's limits for one token map: its plugin-id grammar and how much it will read. */
|
|
9
|
+
export interface TokenMapLimits {
|
|
10
|
+
/** The host's own id grammar. Required: it differs between hosts (dots are legal in some), so no default. */
|
|
11
|
+
readonly pluginIdPattern: RegExp;
|
|
12
|
+
readonly maxTokens: number;
|
|
13
|
+
readonly maxTokenLength: number;
|
|
14
|
+
}
|
|
15
|
+
export type ParsedTokenMap = {
|
|
16
|
+
readonly ok: true;
|
|
17
|
+
readonly tokens: Readonly<Record<string, string>>;
|
|
18
|
+
} | {
|
|
19
|
+
readonly ok: false;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* `{ [pluginId]: token }` from untrusted input: values trimmed, blanks dropped, `null`/`undefined`
|
|
23
|
+
* meaning "none given". A refusal carries no input, so no token can leak through an error message.
|
|
24
|
+
*
|
|
25
|
+
* The entry limit counts BEFORE any entry is read (it bounds the work, blanks included) and the
|
|
26
|
+
* length limit is measured on the UNtrimmed value. The result has no prototype, so a plugin id such
|
|
27
|
+
* as `__proto__` is just a key and can never reach `Object.prototype`.
|
|
28
|
+
* @complexity O(n) in the entry count (bounded by `maxTokens`).
|
|
29
|
+
*/
|
|
30
|
+
export declare function parsePluginTokenMap(required: {
|
|
31
|
+
readonly raw: unknown;
|
|
32
|
+
readonly limits: TokenMapLimits;
|
|
33
|
+
}, _optional?: Record<string, never>): ParsedTokenMap;
|
|
34
|
+
/**
|
|
35
|
+
* The well-formed `{ pluginId, displayName, helpUrl }` entries of a host-supplied list. Rows are
|
|
36
|
+
* rendered as links in a shell, so the help link must be `https:` (never `http:`/`javascript:`).
|
|
37
|
+
* Anything that is not an array is no entries.
|
|
38
|
+
* @complexity O(n) in the entry count.
|
|
39
|
+
*/
|
|
40
|
+
export declare function decodeTokenSignInEntries(required: {
|
|
41
|
+
readonly entries: unknown;
|
|
42
|
+
readonly pluginIdPattern: RegExp;
|
|
43
|
+
}, _optional?: Record<string, never>): readonly TokenSignInPlugin[];
|
|
44
|
+
//# sourceMappingURL=token-map.d.ts.map
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `{ [pluginId]: token }` from untrusted input: values trimmed, blanks dropped, `null`/`undefined`
|
|
3
|
+
* meaning "none given". A refusal carries no input, so no token can leak through an error message.
|
|
4
|
+
*
|
|
5
|
+
* The entry limit counts BEFORE any entry is read (it bounds the work, blanks included) and the
|
|
6
|
+
* length limit is measured on the UNtrimmed value. The result has no prototype, so a plugin id such
|
|
7
|
+
* as `__proto__` is just a key and can never reach `Object.prototype`.
|
|
8
|
+
* @complexity O(n) in the entry count (bounded by `maxTokens`).
|
|
9
|
+
*/
|
|
10
|
+
export function parsePluginTokenMap(required, _optional = {}) {
|
|
11
|
+
const { raw, limits } = required;
|
|
12
|
+
const tokens = Object.create(null);
|
|
13
|
+
if (raw === undefined || raw === null)
|
|
14
|
+
return { ok: true, tokens };
|
|
15
|
+
if (typeof raw !== 'object' || Array.isArray(raw) || Object.keys(raw).length > limits.maxTokens)
|
|
16
|
+
return { ok: false };
|
|
17
|
+
for (const [pluginId, value] of Object.entries(raw)) {
|
|
18
|
+
if (!isAcceptableEntry({ pluginId, value, limits }))
|
|
19
|
+
return { ok: false };
|
|
20
|
+
const token = value.trim();
|
|
21
|
+
if (token !== '')
|
|
22
|
+
tokens[pluginId] = token;
|
|
23
|
+
}
|
|
24
|
+
return { ok: true, tokens };
|
|
25
|
+
}
|
|
26
|
+
/** A string token within the host's length limit, under an id the host's grammar admits. */
|
|
27
|
+
function isAcceptableEntry(required, _optional = {}) {
|
|
28
|
+
const { pluginId, value, limits } = required;
|
|
29
|
+
return typeof value === 'string' && limits.pluginIdPattern.test(pluginId) && value.length <= limits.maxTokenLength;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* The well-formed `{ pluginId, displayName, helpUrl }` entries of a host-supplied list. Rows are
|
|
33
|
+
* rendered as links in a shell, so the help link must be `https:` (never `http:`/`javascript:`).
|
|
34
|
+
* Anything that is not an array is no entries.
|
|
35
|
+
* @complexity O(n) in the entry count.
|
|
36
|
+
*/
|
|
37
|
+
export function decodeTokenSignInEntries(required, _optional = {}) {
|
|
38
|
+
if (!Array.isArray(required.entries))
|
|
39
|
+
return [];
|
|
40
|
+
return required.entries.flatMap((entry) => {
|
|
41
|
+
const { pluginId, displayName, helpUrl } = (entry ?? {});
|
|
42
|
+
if (typeof pluginId !== 'string' || !required.pluginIdPattern.test(pluginId))
|
|
43
|
+
return [];
|
|
44
|
+
if (typeof displayName !== 'string' || typeof helpUrl !== 'string' || !/^https:\/\//.test(helpUrl))
|
|
45
|
+
return [];
|
|
46
|
+
return [{ pluginId, displayName, helpUrl }];
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=token-map.js.map
|
|
@@ -15,6 +15,11 @@ export function resolveAgentPluginIdentityNamespace({ value }, { identityNamespa
|
|
|
15
15
|
return 'jini';
|
|
16
16
|
if (identityNamespace !== undefined)
|
|
17
17
|
return identityNamespace;
|
|
18
|
+
return defaultIdentityNamespace({ value });
|
|
19
|
+
}
|
|
20
|
+
/** The namespace a manifest selects when the host requested none: `jini` unless only the legacy key is present.
|
|
21
|
+
* @complexity O(1) time and space; no I/O or manifest mutation. */
|
|
22
|
+
function defaultIdentityNamespace({ value }, _optional = {}) {
|
|
18
23
|
if (!isObject(value) || !isObject(value.extensions))
|
|
19
24
|
return 'jini';
|
|
20
25
|
const extensions = value.extensions;
|
package/dist/folder-zip.d.ts
CHANGED
|
@@ -20,7 +20,9 @@ export declare class FolderZipError extends Error {
|
|
|
20
20
|
constructor(reason: "empty" | "too-large" | "too-many" | "unreadable", message: string);
|
|
21
21
|
}
|
|
22
22
|
/** @complexity O(n) in the byte count. */
|
|
23
|
-
export declare function crc32(bytes
|
|
23
|
+
export declare function crc32({ bytes }: {
|
|
24
|
+
bytes: Uint8Array;
|
|
25
|
+
}, _optional?: Record<string, never>): number;
|
|
24
26
|
/**
|
|
25
27
|
* Zips the files of one picked folder.
|
|
26
28
|
*
|
package/dist/folder-zip.js
CHANGED
|
@@ -36,7 +36,7 @@ const CRC_TABLE = (() => {
|
|
|
36
36
|
return table;
|
|
37
37
|
})();
|
|
38
38
|
/** @complexity O(n) in the byte count. */
|
|
39
|
-
export function crc32(bytes) {
|
|
39
|
+
export function crc32({ bytes }, _optional = {}) {
|
|
40
40
|
let c = 0xffffffff;
|
|
41
41
|
for (let i = 0; i < bytes.length; i++)
|
|
42
42
|
c = CRC_TABLE[(c ^ bytes[i]) & 0xff] ^ (c >>> 8);
|
|
@@ -86,7 +86,7 @@ export async function zipFolderFiles(required, _optional = {}) {
|
|
|
86
86
|
folder ||= entry.folder;
|
|
87
87
|
const data = await readFolderFile({ file });
|
|
88
88
|
const name = encoder.encode(entry.path);
|
|
89
|
-
const crc = crc32(data);
|
|
89
|
+
const crc = crc32({ bytes: data });
|
|
90
90
|
// Bit 11: the name is UTF-8, so a reader never decodes it as CP437.
|
|
91
91
|
const flags = name.some((b) => b > 0x7f) ? 0x0800 : 0;
|
|
92
92
|
const local = new Uint8Array(30 + name.length);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type FileLockHolder } from "@jini-ai/
|
|
1
|
+
import { type FileLockHolder } from "@jini-ai/core/contracts/runtime";
|
|
2
2
|
import type { AgentPluginLifecyclePorts } from "./ports.js";
|
|
3
3
|
/**
|
|
4
4
|
* Where a workspace's activation record lives, relative to its own agent-plugin root.
|
|
@@ -45,7 +45,7 @@ export declare class AgentPluginActivationsUnreadableError extends Error {
|
|
|
45
45
|
}
|
|
46
46
|
/**
|
|
47
47
|
* A WRITER could not take (or lost) the cross-process write lock in time — see this file's header,
|
|
48
|
-
* "Concurrency", ACROSS processes, and `
|
|
48
|
+
* "Concurrency", ACROSS processes, and `packages/platform/src/fs/file-lock.ts`. `lost: true` means the lock WAS
|
|
49
49
|
* acquired but was judged stale by another process before this writer's own rename; `lost: false`
|
|
50
50
|
* means the initial acquisition itself timed out. Either way NOTHING was written. `message` names
|
|
51
51
|
* the host lock path: keep it in a server-side log, never in a model- or user-facing payload.
|
|
@@ -93,9 +93,9 @@ export interface DeleteAgentPluginActivationRequired {
|
|
|
93
93
|
readonly workspaceRoot: string;
|
|
94
94
|
readonly pluginId: string;
|
|
95
95
|
}
|
|
96
|
-
type ActivationPorts = Pick<AgentPluginLifecyclePorts, "filesystem" | "clock" | "ids" | "process" | "onEvent">;
|
|
96
|
+
type ActivationPorts = Pick<AgentPluginLifecyclePorts, "filesystem" | "fileLock" | "clock" | "ids" | "process" | "onEvent">;
|
|
97
97
|
/** Internal composition; one state/queue instance per injected host context. */
|
|
98
|
-
export declare function createActivationModule(ports: ActivationPorts): {
|
|
98
|
+
export declare function createActivationModule(ports: ActivationPorts, _optional?: Record<string, never>): {
|
|
99
99
|
reconcileAgentPluginActivation: (required: Omit<SetAgentPluginActivationRequired, "enabled"> & {
|
|
100
100
|
resolveEnabled: () => Promise<boolean>;
|
|
101
101
|
}, optional?: SetAgentPluginActivationOptional) => Promise<boolean>;
|
|
@@ -43,8 +43,7 @@
|
|
|
43
43
|
* acquire within 15 seconds or loses the lock before rename reports busy and publishes nothing.
|
|
44
44
|
*/
|
|
45
45
|
import path from "node:path";
|
|
46
|
-
import { FileLockLostError, FileLockTimeoutError } from "@jini-ai/
|
|
47
|
-
import { withFileLock } from "@jini-ai/platform/fs/file-lock";
|
|
46
|
+
import { FileLockLostError, FileLockTimeoutError, } from "@jini-ai/core/contracts/runtime";
|
|
48
47
|
/**
|
|
49
48
|
* Where a workspace's activation record lives, relative to its own agent-plugin root.
|
|
50
49
|
*/
|
|
@@ -77,7 +76,7 @@ export class AgentPluginActivationsUnreadableError extends Error {
|
|
|
77
76
|
}
|
|
78
77
|
/**
|
|
79
78
|
* A WRITER could not take (or lost) the cross-process write lock in time — see this file's header,
|
|
80
|
-
* "Concurrency", ACROSS processes, and `
|
|
79
|
+
* "Concurrency", ACROSS processes, and `packages/platform/src/fs/file-lock.ts`. `lost: true` means the lock WAS
|
|
81
80
|
* acquired but was judged stale by another process before this writer's own rename; `lost: false`
|
|
82
81
|
* means the initial acquisition itself timed out. Either way NOTHING was written. `message` names
|
|
83
82
|
* the host lock path: keep it in a server-side log, never in a model- or user-facing payload.
|
|
@@ -654,7 +653,7 @@ function buildModule(ports) {
|
|
|
654
653
|
await mkdir(workspaceRoot, { recursive: true, mode: 0o700 });
|
|
655
654
|
const lockPath = path.join(workspaceRoot, ACTIVATIONS_LOCK_FILENAME);
|
|
656
655
|
try {
|
|
657
|
-
return await withFileLock({ lockPath, run: write }, {
|
|
656
|
+
return await ports.fileLock.withFileLock({ lockPath, run: write }, {
|
|
658
657
|
timeoutMs: 15_000, staleMs: 10_000, pollMs: 10,
|
|
659
658
|
filesystem: ports.filesystem, clock: ports.clock, monotonicMs: () => ports.clock.monotonicMs(),
|
|
660
659
|
process: ports.process,
|
|
@@ -741,7 +740,7 @@ function buildModule(ports) {
|
|
|
741
740
|
}
|
|
742
741
|
const instances = new WeakMap();
|
|
743
742
|
/** Internal composition; one state/queue instance per injected host context. */
|
|
744
|
-
export function createActivationModule(ports) {
|
|
743
|
+
export function createActivationModule(ports, _optional = {}) {
|
|
745
744
|
let instance = instances.get(ports);
|
|
746
745
|
if (!instance) {
|
|
747
746
|
instance = buildModule(ports);
|