@jini-ai/agent-plugins 0.7.3-next.2 → 0.7.4
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 +7 -0
- package/README.md +22 -4
- package/calendly/README.md +29 -0
- package/calendly/mcp.json +1 -1
- package/cloudflare/lib/assets.mjs +1 -1
- package/cloudflare/lib/cms-forms.mjs +1 -1
- package/core/persistent-state.d.ts +4 -1
- package/core/persistent-state.js +55 -21
- package/dist/admin-surfaces/callback-field-inbox.d.ts +1 -6
- package/dist/admin-surfaces/connections/connections.d.ts +2 -6
- package/dist/admin-surfaces/connections/index.d.ts +3 -2
- package/dist/admin-surfaces/index.d.ts +3 -1
- package/dist/connect/access-token-tool.d.ts +1 -1
- package/dist/connect/access-token-tool.js +1 -1
- package/dist/connect/catalog.d.ts +26 -0
- package/dist/connect/catalog.js +42 -0
- package/dist/connect/connect-tool.d.ts +2 -294
- package/dist/connect/connect-tool.js +2 -53
- package/dist/connect/contracts.d.ts +257 -0
- package/dist/connect/contracts.js +2 -0
- package/dist/connect/credential-cards.d.ts +2 -0
- package/dist/connect/credential-cards.js +7 -4
- package/dist/connect/credential-save-tool.js +2 -3
- package/dist/connect/grant-signed-in-defaults.js +1 -1
- package/dist/connect/host-deps.d.ts +32 -0
- package/dist/connect/host-deps.js +35 -0
- package/dist/connect/import-access-token.js +1 -1
- package/dist/connect/index.d.ts +7 -2
- package/dist/connect/index.js +5 -2
- package/dist/connect/installed-plugin.d.ts +28 -0
- package/dist/connect/installed-plugin.js +19 -0
- package/dist/connect/new-site-agent-plugin-tokens.d.ts +88 -0
- package/dist/connect/new-site-agent-plugin-tokens.js +107 -0
- package/dist/connect/plugin-host/index.d.ts +1 -2
- package/dist/connect/plugin-host/index.js +18 -9
- package/dist/connect/token-sign-in.d.ts +1 -14
- package/dist/connect/token-sign-in.js +4 -23
- package/dist/core/export-props.d.ts +10 -0
- package/dist/core/export-props.js +31 -0
- package/dist/core/folder-zip-error.d.ts +5 -0
- package/dist/core/folder-zip-error.js +8 -0
- package/dist/core/host-incompatible-error.d.ts +8 -0
- package/dist/core/host-incompatible-error.js +9 -0
- package/dist/core/identity-namespace.d.ts +27 -16
- package/dist/core/identity-namespace.js +25 -22
- package/dist/core/plugin-display-name.d.ts +7 -0
- package/dist/core/plugin-display-name.js +11 -0
- package/dist/core/provider-plugin-link.d.ts +7 -0
- package/dist/core/provider-plugin-link.js +5 -0
- package/dist/{connect → core}/token-map.d.ts +11 -1
- package/dist/{connect → core}/token-map.js +15 -0
- package/dist/core/token-sign-in-list.d.ts +18 -0
- package/dist/core/token-sign-in-list.js +23 -0
- package/dist/core/update-error.d.ts +8 -0
- package/dist/core/update-error.js +9 -0
- package/dist/{lifecycle → core}/update-plan.d.ts +1 -1
- package/dist/ffmpeg-transcode/adapter.d.ts +74 -0
- package/dist/ffmpeg-transcode/adapter.js +155 -0
- package/dist/folder-zip-node.d.ts +2 -1
- package/dist/folder-zip-node.js +6 -5
- package/dist/folder-zip.d.ts +0 -4
- package/dist/folder-zip.js +1 -7
- package/dist/index.d.ts +3 -1
- package/dist/lifecycle/activation.d.ts +39 -3
- package/dist/lifecycle/activation.js +467 -418
- package/dist/lifecycle/automatic-use-offer.d.ts +62 -0
- package/dist/lifecycle/automatic-use-offer.js +52 -0
- package/dist/lifecycle/automatic-use.d.ts +33 -1
- package/dist/lifecycle/automatic-use.js +159 -38
- package/dist/lifecycle/bundled-source-archive.d.ts +1 -1
- package/dist/lifecycle/capability-projection.d.ts +0 -1
- package/dist/lifecycle/capability-projection.js +92 -23
- package/dist/lifecycle/compatibility-metadata.d.ts +1 -0
- package/dist/lifecycle/compatibility-metadata.js +6 -1
- package/dist/lifecycle/compatibility.d.ts +1 -8
- package/dist/lifecycle/compatibility.js +1 -8
- package/dist/lifecycle/credential-card-metadata.d.ts +2 -2
- package/dist/lifecycle/exports.d.ts +2 -45
- package/dist/lifecycle/exports.js +1 -30
- package/dist/lifecycle/host-tools/identity.d.ts +5 -4
- package/dist/lifecycle/host-tools/identity.js +5 -5
- package/dist/lifecycle/host-tools/ports.d.ts +10 -1
- package/dist/lifecycle/host-tools/search-tool.js +18 -8
- package/dist/lifecycle/host-tools/skill-tool.js +1 -1
- package/dist/lifecycle/index.d.ts +20 -17
- package/dist/lifecycle/index.js +5 -4
- package/dist/lifecycle/install-from-url.d.ts +1 -2
- package/dist/lifecycle/install.d.ts +4 -34
- package/dist/lifecycle/install.js +3 -3
- package/dist/lifecycle/installed-package-index.d.ts +1 -1
- package/dist/lifecycle/installed-package-index.js +4 -4
- package/dist/lifecycle/layout.d.ts +21 -25
- package/dist/lifecycle/layout.js +79 -0
- package/dist/lifecycle/manifest.d.ts +10 -7
- package/dist/lifecycle/manifest.js +20 -15
- package/dist/lifecycle/mcp-provisioning.d.ts +1 -1
- package/dist/lifecycle/metadata.d.ts +6 -3
- package/dist/lifecycle/metadata.js +2 -1
- package/dist/lifecycle/package-paths.js +59 -56
- package/dist/lifecycle/persistent-state.d.ts +10 -1
- package/dist/lifecycle/persistent-state.js +4 -2
- package/dist/lifecycle/ports.d.ts +18 -6
- package/dist/lifecycle/resolve-agent-plugin-refs.d.ts +2 -14
- package/dist/lifecycle/retire-bundled.d.ts +1 -1
- package/dist/lifecycle/search-projection.d.ts +17 -3
- package/dist/lifecycle/search-projection.js +8 -8
- package/dist/lifecycle/search.d.ts +1 -0
- package/dist/lifecycle/search.js +2 -2
- package/dist/lifecycle/seed-bundled.d.ts +86 -1
- package/dist/lifecycle/seed-bundled.js +48 -84
- package/dist/lifecycle/set-enabled.d.ts +1 -13
- package/dist/lifecycle/set-enabled.js +11 -7
- package/dist/lifecycle/trusted-plugin-files.d.ts +1 -1
- package/dist/lifecycle/trusted-plugin-files.js +33 -30
- package/dist/lifecycle/types.d.ts +13 -34
- package/dist/lifecycle/uninstall.d.ts +1 -33
- package/dist/lifecycle/update-store.d.ts +0 -7
- package/dist/lifecycle/update-store.js +1 -8
- package/dist/lifecycle/update.d.ts +1 -1
- package/dist/lifecycle/update.js +60 -10
- package/dist/lifecycle/yauzl-archive-reader.d.ts +7 -2
- package/dist/lifecycle/yauzl-archive-reader.js +11 -6
- package/dist/manifest.d.ts +4 -8
- package/dist/react/AgentPluginDetailsModal.d.ts +187 -0
- package/dist/react/AgentPluginDetailsModal.js +29 -0
- package/dist/react/agent-plugin-install-port.d.ts +24 -0
- package/dist/react/agent-plugin-install-port.js +15 -0
- package/dist/react/installed-skills-composer-source.d.ts +60 -0
- package/dist/react/installed-skills-composer-source.js +111 -0
- package/dist/react/use-agent-plugins.hooks.d.ts +211 -0
- package/dist/react/use-agent-plugins.hooks.js +128 -0
- package/dist/site/activation-effects.d.ts +17 -0
- package/dist/site/activation-effects.js +31 -0
- package/dist/site/admin-surfaces/capabilities.d.ts +29 -0
- package/dist/site/admin-surfaces/capabilities.js +30 -0
- package/dist/site/admin-surfaces/delivery-bindings.d.ts +81 -0
- package/dist/site/admin-surfaces/delivery-bindings.js +161 -0
- package/dist/site/admin-surfaces/forms.d.ts +28 -0
- package/dist/site/admin-surfaces/forms.js +29 -0
- package/dist/site/admin-surfaces/handlers.d.ts +61 -0
- package/dist/site/admin-surfaces/handlers.js +35 -0
- package/dist/site/admin-surfaces/public-config.d.ts +12 -0
- package/dist/site/admin-surfaces/public-config.js +28 -0
- package/dist/site/analytics-provider-registry.d.ts +87 -0
- package/dist/site/analytics-provider-registry.js +87 -0
- package/dist/site/archive-reader-abi.d.ts +35 -0
- package/dist/site/archive-reader-abi.js +25 -0
- package/dist/site/auth-schemes.d.ts +110 -0
- package/dist/site/auth-schemes.js +119 -0
- package/dist/site/automatic-agent-plugins.d.ts +200 -0
- package/dist/site/automatic-agent-plugins.js +277 -0
- package/dist/site/bundled-contribution-sources.d.ts +24 -0
- package/dist/site/bundled-contribution-sources.js +17 -0
- package/dist/site/bundled-id-upgrade.d.ts +115 -0
- package/dist/site/bundled-id-upgrade.js +169 -0
- package/dist/site/customize-tool.d.ts +39 -0
- package/dist/site/customize-tool.js +31 -0
- package/dist/site/deploy-split-activation.d.ts +28 -0
- package/dist/site/deploy-split-activation.js +21 -0
- package/dist/site/exports/diagnostics.d.ts +37 -0
- package/dist/site/exports/diagnostics.js +55 -0
- package/dist/site/exports/runtime.d.ts +54 -0
- package/dist/site/exports/runtime.js +196 -0
- package/dist/site/exports/source.d.ts +42 -0
- package/dist/site/exports/source.js +58 -0
- package/dist/site/host-plugin-guidance.d.ts +137 -0
- package/dist/site/host-plugin-guidance.js +223 -0
- package/dist/site/host-signals.d.ts +78 -0
- package/dist/site/host-signals.js +83 -0
- package/dist/site/install-tool.d.ts +69 -0
- package/dist/site/install-tool.js +192 -0
- package/dist/site/install-upload.d.ts +175 -0
- package/dist/site/install-upload.js +324 -0
- package/dist/site/memory-i18n.d.ts +5 -0
- package/dist/site/memory-i18n.js +176 -0
- package/dist/site/memory.d.ts +80 -0
- package/dist/site/memory.js +83 -0
- package/dist/site/plugin-memory.d.ts +80 -0
- package/dist/site/plugin-memory.js +86 -0
- package/dist/site/provider-plugin-link.d.ts +112 -0
- package/dist/site/provider-plugin-link.js +100 -0
- package/dist/site/retired-plugin-tool-aliases.d.ts +40 -0
- package/dist/site/retired-plugin-tool-aliases.js +41 -0
- package/dist/site/service-ports.d.ts +108 -0
- package/dist/site/service-ports.js +2 -0
- package/dist/site/set-enabled.d.ts +80 -0
- package/dist/site/set-enabled.js +42 -0
- package/dist/site/soon-lock.d.ts +83 -0
- package/dist/site/soon-lock.js +78 -0
- package/dist/site/supersession.d.ts +61 -0
- package/dist/site/supersession.js +122 -0
- package/dist/site/uninstall-tool.d.ts +136 -0
- package/dist/site/uninstall-tool.js +203 -0
- package/dist/site/update-effects.d.ts +47 -0
- package/dist/site/update-effects.js +49 -0
- package/ffmpeg-transcode/plugin.json +16 -0
- package/github/source-control/backup-push.mjs +66 -46
- package/github/source-control/commit-site.mjs +112 -65
- package/github/source-control/write-files.mjs +86 -53
- package/github-pages/targets/github-pages.mjs +294 -233
- package/google-workspace/form-destinations/mapping.mjs +15 -7
- package/google-workspace/form-destinations/sheets.mjs +4 -2
- package/google-workspace/plugin.json +1 -0
- package/kuinetic/CHANGELOG.md +4 -0
- package/kuinetic/plugin.json +4 -1
- package/kuinetic/skills/kuinetic/SKILL.md +1 -2
- package/package.json +295 -18
- package/persistent-state.d.ts +4 -1
- package/resend/adapters/resend.mjs +5 -2
- package/resend/plugin.json +1 -1
- package/s3-compatible/jini-deploy-targets.json +1 -1
- package/s3-compatible/object-stores/s3-compatible.mjs +27 -4
- package/s3-compatible/targets/s3-compatible.mjs +3 -3
- package/site-import/plugin.json +3 -3
- package/site-import/skills/site-import/SKILL.md +62 -54
- package/site-import/skills/site-import/references/content-mapping.md +26 -20
- package/slide-design/plugin.json +1 -1
- package/slide-design/skills/slide-design/SKILL.md +8 -2
- package/ui-ux-design/CHANGELOG.md +6 -0
- package/ui-ux-design/plugin.json +1 -1
- package/ui-ux-design/skills/gstack-design/SKILL.md +6 -6
- package/ui-ux-design/skills/ui-ux-design/SKILL.md +3 -2
- package/ui-ux-design/skills/ui-ux-design/references/chrome-mobile-test-matrix.md +14 -12
- package/ui-ux-design/skills/ui-ux-design/references/ui-loop.md +16 -17
- package/vercel/NOTES.md +2 -1
- package/vercel/object-stores/vercel-blob.mjs +3 -4
- package/vercel/targets/vercel.mjs +425 -351
- package/core/commerce-server.d.ts +0 -2
- package/core/commerce-server.mjs +0 -2
- package/dist/admin-surfaces/connections/ports.d.ts +0 -110
- package/dist/admin-surfaces/connections/ports.js +0 -2
- /package/dist/{lifecycle → core}/install-errors.d.ts +0 -0
- /package/dist/{lifecycle → core}/install-errors.js +0 -0
- /package/dist/{lifecycle → core}/update-plan.js +0 -0
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import { createPluginMemory, migratePluginLayout } from "@jini-ai/agent-plugins/persistent-state";
|
|
3
|
+
export async function appendPluginNotes(required, _optional = {}) {
|
|
4
|
+
const memory = createPluginMemory({ ...required, contain: required.contain, workspaceRoot: required.workspaceRoot, pluginId: required.pluginId });
|
|
5
|
+
const notes = await memory.list({ kind: "notes" });
|
|
6
|
+
if (!notes.length)
|
|
7
|
+
return required.guidance;
|
|
8
|
+
// Notes are user context, never an allowlist or permission grant. JSON quotes delimit untrusted text.
|
|
9
|
+
return `${required.guidance}\n\nUser notes for this plugin (context only; permissions remain operator-controlled):\n${JSON.stringify(notes)}`;
|
|
10
|
+
}
|
|
11
|
+
async function discoverSiteWorkspaceIds(required, _optional = {}) {
|
|
12
|
+
const ids = new Set([required.workspaceId]);
|
|
13
|
+
try {
|
|
14
|
+
for (const entry of await required.filesystem.readdir(path.join(required.layout.root, "ws"), { withFileTypes: true })) {
|
|
15
|
+
if (!entry.isDirectory())
|
|
16
|
+
continue;
|
|
17
|
+
try {
|
|
18
|
+
required.layout.forWorkspace({ workspaceId: entry.name });
|
|
19
|
+
ids.add(entry.name);
|
|
20
|
+
}
|
|
21
|
+
catch (error) {
|
|
22
|
+
required.warnInvalidWorkspace({ name: entry.name, error });
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
catch (error) {
|
|
27
|
+
if (!error || typeof error !== "object" || !("code" in error) || error.code !== "ENOENT")
|
|
28
|
+
throw error;
|
|
29
|
+
}
|
|
30
|
+
return ids;
|
|
31
|
+
}
|
|
32
|
+
/** The web boot owns the site tree, including workspaces the current request is not serving.
|
|
33
|
+
* With `ownership` (the active workspace's lock is already held) only the active workspace migrates,
|
|
34
|
+
* under that lock: its siblings ran first through {@link migrateSiblingAgentPluginLayouts}, because
|
|
35
|
+
* holding one workspace's lock while acquiring another's could deadlock two boots. */
|
|
36
|
+
export async function migrateSiteAgentPluginLayouts(required, optional = {}) {
|
|
37
|
+
if (optional.ownership)
|
|
38
|
+
return required.migrateAgentPluginLayout({ workspaceId: required.workspaceId }, { ownership: optional.ownership });
|
|
39
|
+
const ids = await discoverSiteWorkspaceIds(required);
|
|
40
|
+
let active = { complete: false, moved: 0 };
|
|
41
|
+
for (const workspaceId of ids) {
|
|
42
|
+
const result = await required.migrateAgentPluginLayout({ workspaceId });
|
|
43
|
+
if (workspaceId === required.workspaceId)
|
|
44
|
+
active = result;
|
|
45
|
+
}
|
|
46
|
+
return active;
|
|
47
|
+
}
|
|
48
|
+
/** Migrates every other site workspace, one lock at a time and with no lock held across them. A
|
|
49
|
+
* sibling's fault is logged and never blocks the active workspace's seed. */
|
|
50
|
+
export async function migrateSiblingAgentPluginLayouts(required, _optional = {}) {
|
|
51
|
+
for (const workspaceId of await discoverSiteWorkspaceIds(required)) {
|
|
52
|
+
if (workspaceId === required.workspaceId)
|
|
53
|
+
continue;
|
|
54
|
+
try {
|
|
55
|
+
await required.migrateAgentPluginLayout({ workspaceId });
|
|
56
|
+
}
|
|
57
|
+
catch (error) {
|
|
58
|
+
required.warnMigration({ workspaceId, error });
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
export function createPluginMemoryBindings(required, _optional = {}) {
|
|
63
|
+
const { filesystem, withLock, parseManifest, onEvent, warnInvalidWorkspace, warnMigration } = required;
|
|
64
|
+
const effects = { filesystem, withLock };
|
|
65
|
+
const migrateAgentPluginLayout = (input, optional = {}) => migratePluginLayout({
|
|
66
|
+
...effects, contain: input.contain, workspaceRoot: input.layout.forWorkspace({ workspaceId: input.workspaceId }).root,
|
|
67
|
+
parsePluginId: ({ value }) => {
|
|
68
|
+
const result = parseManifest({ value });
|
|
69
|
+
if (!result.ok)
|
|
70
|
+
throw new Error(result.errors.join("; "));
|
|
71
|
+
return result.manifest.name;
|
|
72
|
+
},
|
|
73
|
+
onEvent,
|
|
74
|
+
}, optional.ownership ? { ownership: optional.ownership } : {});
|
|
75
|
+
return {
|
|
76
|
+
pluginMemory: (input, _optional = {}) => createPluginMemory({ ...effects, contain: input.contain, workspaceRoot: input.layout.forWorkspace({ workspaceId: input.workspaceId }).root, pluginId: input.pluginId }),
|
|
77
|
+
migrateAgentPluginLayout,
|
|
78
|
+
appendPluginNotes: (input, _optional = {}) => appendPluginNotes({ ...effects, ...input }),
|
|
79
|
+
migrateSiteAgentPluginLayouts: (input, optional = {}) => migrateSiteAgentPluginLayouts({ ...input, filesystem, migrateAgentPluginLayout: (request, options) => migrateAgentPluginLayout({ layout: input.layout, contain: input.contain, ...request }, options), warnInvalidWorkspace, warnMigration }, optional),
|
|
80
|
+
migrateSiblingAgentPluginLayouts: (input, _optional = {}) => migrateSiblingAgentPluginLayouts({ ...input, filesystem, migrateAgentPluginLayout: (request, options) => migrateAgentPluginLayout({ layout: input.layout, contain: input.contain, ...request }, options), warnInvalidWorkspace, warnMigration }),
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=memory.js.map
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { type PluginStateEffects, type WorkspaceMigrationOwnership } from '@jini-ai/agent-plugins/persistent-state';
|
|
2
|
+
import type { AgentPluginLayout } from '@jini-ai/core/contracts/headless/plugin-host';
|
|
3
|
+
export declare function bindAgentPluginMemory(effects: Pick<PluginStateEffects, 'filesystem' | 'withLock'> & {
|
|
4
|
+
workspaceDirectory(required: {
|
|
5
|
+
layout: AgentPluginLayout;
|
|
6
|
+
}): string;
|
|
7
|
+
parseManifest(required: {
|
|
8
|
+
value: unknown;
|
|
9
|
+
}): {
|
|
10
|
+
ok: true;
|
|
11
|
+
manifest: {
|
|
12
|
+
name: string;
|
|
13
|
+
};
|
|
14
|
+
} | {
|
|
15
|
+
ok: false;
|
|
16
|
+
errors: readonly string[];
|
|
17
|
+
};
|
|
18
|
+
onEvent(required: {
|
|
19
|
+
event: string;
|
|
20
|
+
message: string;
|
|
21
|
+
}): void;
|
|
22
|
+
invalidWorkspace(required: {
|
|
23
|
+
workspaceId: string;
|
|
24
|
+
error: unknown;
|
|
25
|
+
}): void;
|
|
26
|
+
siblingFailure(required: {
|
|
27
|
+
workspaceId: string;
|
|
28
|
+
error: unknown;
|
|
29
|
+
}): void;
|
|
30
|
+
}, _optional?: {}): {
|
|
31
|
+
pluginMemory: (required: Pick<PluginStateEffects, "contain"> & {
|
|
32
|
+
workspaceId: string;
|
|
33
|
+
pluginId: string;
|
|
34
|
+
layout: AgentPluginLayout;
|
|
35
|
+
}, _optional?: {}) => import("@jini-ai/agent-plugins/persistent-state").PluginMemory;
|
|
36
|
+
migrateAgentPluginLayout: (required: Pick<PluginStateEffects, "contain"> & {
|
|
37
|
+
layout: AgentPluginLayout;
|
|
38
|
+
workspaceId: string;
|
|
39
|
+
}, optional?: {
|
|
40
|
+
ownership?: WorkspaceMigrationOwnership;
|
|
41
|
+
}) => Promise<{
|
|
42
|
+
complete: boolean;
|
|
43
|
+
moved: number;
|
|
44
|
+
}>;
|
|
45
|
+
/** Holds one workspace's layout-migration lock (the outermost lock; Jini owns the ordering) with this host's real file lock. */
|
|
46
|
+
withAgentPluginWorkspaceLock: <T>(required: {
|
|
47
|
+
workspaceRoot: string;
|
|
48
|
+
run(held: {
|
|
49
|
+
ownership: WorkspaceMigrationOwnership;
|
|
50
|
+
}): Promise<T>;
|
|
51
|
+
}, _optional?: {}) => Promise<T>;
|
|
52
|
+
appendPluginNotes: (required: Pick<PluginStateEffects, "contain"> & {
|
|
53
|
+
workspaceRoot: string;
|
|
54
|
+
pluginId: string;
|
|
55
|
+
guidance: string;
|
|
56
|
+
}, _optional?: {}) => Promise<string>;
|
|
57
|
+
assertOwnedPluginPath: (required: Pick<PluginStateEffects, "contain"> & {
|
|
58
|
+
workspaceRoot: string;
|
|
59
|
+
entryPath: string;
|
|
60
|
+
}, _optional?: {}) => Promise<string>;
|
|
61
|
+
withAgentPluginStateLock: <T>(required: Pick<PluginStateEffects, "contain"> & {
|
|
62
|
+
workspaceRoot: string;
|
|
63
|
+
pluginId: string;
|
|
64
|
+
run(): Promise<T>;
|
|
65
|
+
}, _optional?: {}) => Promise<T>;
|
|
66
|
+
migrateSiteAgentPluginLayouts: (required: Pick<PluginStateEffects, "contain"> & {
|
|
67
|
+
layout: AgentPluginLayout;
|
|
68
|
+
workspaceId: string;
|
|
69
|
+
}, optional?: {
|
|
70
|
+
ownership?: WorkspaceMigrationOwnership;
|
|
71
|
+
}) => Promise<{
|
|
72
|
+
complete: boolean;
|
|
73
|
+
moved: number;
|
|
74
|
+
}>;
|
|
75
|
+
migrateSiblingAgentPluginLayouts: (required: Pick<PluginStateEffects, "contain"> & {
|
|
76
|
+
layout: AgentPluginLayout;
|
|
77
|
+
workspaceId: string;
|
|
78
|
+
}, _optional?: {}) => Promise<void>;
|
|
79
|
+
};
|
|
80
|
+
//# sourceMappingURL=plugin-memory.d.ts.map
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { createPluginMemory, migratePluginLayout, assertPluginStatePath, withPluginStateLock, withWorkspaceMigrationLock } from '@jini-ai/agent-plugins/persistent-state';
|
|
2
|
+
export function bindAgentPluginMemory(effects, _optional = {}) {
|
|
3
|
+
return {
|
|
4
|
+
pluginMemory: (required, _optional = {}) => createPluginMemory({ ...effects, contain: required.contain, workspaceRoot: required.layout.forWorkspace({ workspaceId: required.workspaceId }).root, pluginId: required.pluginId }),
|
|
5
|
+
migrateAgentPluginLayout: (required, optional = {}) => migrateAgentPluginLayout(required, optional, effects),
|
|
6
|
+
/** Holds one workspace's layout-migration lock (the outermost lock; Jini owns the ordering) with this host's real file lock. */
|
|
7
|
+
withAgentPluginWorkspaceLock: (required, _optional = {}) => withWorkspaceMigrationLock({ ...effects, ...required }),
|
|
8
|
+
appendPluginNotes: (required, _optional = {}) => appendPluginNotes(required, effects),
|
|
9
|
+
assertOwnedPluginPath: (required, _optional = {}) => assertPluginStatePath({ ...effects, ...required }),
|
|
10
|
+
withAgentPluginStateLock: (required, _optional = {}) => withPluginStateLock({ ...effects, ...required }),
|
|
11
|
+
migrateSiteAgentPluginLayouts: (required, optional = {}) => migrateSiteAgentPluginLayouts(required, optional, effects),
|
|
12
|
+
migrateSiblingAgentPluginLayouts: (required, _optional = {}) => migrateSiblingAgentPluginLayouts(required, effects),
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
/** `ownership`: the caller holds this workspace's migration lock (`withAgentPluginWorkspaceLock`); run under it. */
|
|
16
|
+
async function migrateAgentPluginLayout(required, optional, effects) {
|
|
17
|
+
return migratePluginLayout({ ...effects, contain: required.contain, workspaceRoot: required.layout.forWorkspace({ workspaceId: required.workspaceId }).root,
|
|
18
|
+
parsePluginId: ({ value }) => {
|
|
19
|
+
const result = effects.parseManifest({ value });
|
|
20
|
+
if (!result.ok)
|
|
21
|
+
throw new Error(result.errors.join('; '));
|
|
22
|
+
return result.manifest.name;
|
|
23
|
+
},
|
|
24
|
+
onEvent: effects.onEvent,
|
|
25
|
+
}, optional.ownership ? { ownership: optional.ownership } : {});
|
|
26
|
+
}
|
|
27
|
+
async function appendPluginNotes(required, effects) {
|
|
28
|
+
const memory = createPluginMemory({ ...effects, contain: required.contain, workspaceRoot: required.workspaceRoot, pluginId: required.pluginId });
|
|
29
|
+
const notes = await memory.list({ kind: 'notes' });
|
|
30
|
+
if (!notes.length)
|
|
31
|
+
return required.guidance;
|
|
32
|
+
// Notes are user context, never an allowlist or permission grant. JSON quotes delimit untrusted text.
|
|
33
|
+
return `${required.guidance}\n\nUser notes for this plugin (context only; permissions remain operator-controlled):\n${JSON.stringify(notes)}`;
|
|
34
|
+
}
|
|
35
|
+
async function discoverSiteWorkspaceIds(required, effects) {
|
|
36
|
+
const ids = new Set([required.workspaceId]);
|
|
37
|
+
try {
|
|
38
|
+
for (const entry of await effects.filesystem.readdir(effects.workspaceDirectory({ layout: required.layout }), { withFileTypes: true })) {
|
|
39
|
+
if (!entry.isDirectory())
|
|
40
|
+
continue;
|
|
41
|
+
try {
|
|
42
|
+
required.layout.forWorkspace({ workspaceId: entry.name });
|
|
43
|
+
ids.add(entry.name);
|
|
44
|
+
}
|
|
45
|
+
catch (error) {
|
|
46
|
+
effects.invalidWorkspace({ workspaceId: entry.name, error });
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
catch (error) {
|
|
51
|
+
if (!error || typeof error !== 'object' || !('code' in error) || error.code !== 'ENOENT')
|
|
52
|
+
throw error;
|
|
53
|
+
}
|
|
54
|
+
return ids;
|
|
55
|
+
}
|
|
56
|
+
/** The web boot owns the site tree, including workspaces the current request is not serving.
|
|
57
|
+
* With `ownership` (the active workspace's lock is already held) only the active workspace migrates,
|
|
58
|
+
* under that lock: its siblings ran first through {@link migrateSiblingAgentPluginLayouts}, because
|
|
59
|
+
* holding one workspace's lock while acquiring another's could deadlock two boots. */
|
|
60
|
+
async function migrateSiteAgentPluginLayouts(required, optional, effects) {
|
|
61
|
+
if (optional.ownership)
|
|
62
|
+
return migrateAgentPluginLayout({ contain: required.contain, layout: required.layout, workspaceId: required.workspaceId }, { ownership: optional.ownership }, effects);
|
|
63
|
+
const ids = await discoverSiteWorkspaceIds(required, effects);
|
|
64
|
+
let active = { complete: false, moved: 0 };
|
|
65
|
+
for (const workspaceId of ids) {
|
|
66
|
+
const result = await migrateAgentPluginLayout({ contain: required.contain, layout: required.layout, workspaceId }, {}, effects);
|
|
67
|
+
if (workspaceId === required.workspaceId)
|
|
68
|
+
active = result;
|
|
69
|
+
}
|
|
70
|
+
return active;
|
|
71
|
+
}
|
|
72
|
+
/** Migrates every other site workspace, one lock at a time and with no lock held across them. A
|
|
73
|
+
* sibling's fault is logged and never blocks the active workspace's seed. */
|
|
74
|
+
async function migrateSiblingAgentPluginLayouts(required, effects) {
|
|
75
|
+
for (const workspaceId of await discoverSiteWorkspaceIds(required, effects)) {
|
|
76
|
+
if (workspaceId === required.workspaceId)
|
|
77
|
+
continue;
|
|
78
|
+
try {
|
|
79
|
+
await migrateAgentPluginLayout({ contain: required.contain, layout: required.layout, workspaceId }, {}, effects);
|
|
80
|
+
}
|
|
81
|
+
catch (error) {
|
|
82
|
+
effects.siblingFailure({ workspaceId, error });
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=plugin-memory.js.map
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import type { AgentPluginIdentityReadOptions } from "../core/identity-namespace.js";
|
|
2
|
+
import type { PluginActivationRepoPort } from "@jini-ai/core/contracts/site/plugins-host";
|
|
3
|
+
/**
|
|
4
|
+
* @file One vendor, one plugin (owner 2026-10-25): a provider plugin (the Plugins screen, its Settings
|
|
5
|
+
* card, the code that sends events) and the agent plugin that is its assistant face (the chat key card
|
|
6
|
+
* and know-how) are switched by ONE switch — the provider plugin's. The agent plugin declares the link
|
|
7
|
+
* in its own manifest (`extensions.jini.providerPlugin`, read by `identity.ts`); core names no vendor.
|
|
8
|
+
*
|
|
9
|
+
* Why the face follows rather than both toggling each other: the provider plugin's activation row is
|
|
10
|
+
* already the durable, permission-gated, approval-recorded decision (`setPluginEnabled`), and its
|
|
11
|
+
* enable path carries capability approvals the agent-plugin switch has no business re-implementing.
|
|
12
|
+
* So the provider row is the one source of truth; the face's activation record is a mirror of it:
|
|
13
|
+
* - every write of the provider row (admin switch, `plugins_set_enabled`, reload, quarantine, rollback,
|
|
14
|
+
* uninstall) goes through the activation repo, which {@link followProviderActivations} wraps;
|
|
15
|
+
* - boot runs {@link syncProviderFaces} after seeding, which also absorbs faces seeded inactive and any
|
|
16
|
+
* mirror write that failed;
|
|
17
|
+
* - switching the face on its own is refused by the host (its linked-face error, which names the real
|
|
18
|
+
* switch; {@link linkedProviderOf} finds it).
|
|
19
|
+
*/
|
|
20
|
+
/** Recorded as the face's `updatedBy`, so an audit shows the provider plugin decided it. */
|
|
21
|
+
export declare const PROVIDER_LINK_ACTOR = "system:provider-plugin";
|
|
22
|
+
/** The face activation calls this module makes, bound to one workspace. */
|
|
23
|
+
export interface ProviderFacePorts {
|
|
24
|
+
/** Installed agent plugins that declare a provider plugin: agent plugin id → provider plugin id. */
|
|
25
|
+
readonly links: (required: Record<string, never>) => Promise<ReadonlyMap<string, string>>;
|
|
26
|
+
/** Read canonical state and compare/write within the activation owner's serialized operation. */
|
|
27
|
+
readonly reconcileFace: (required: {
|
|
28
|
+
readonly pluginId: string;
|
|
29
|
+
readonly resolveEnabled: () => Promise<boolean>;
|
|
30
|
+
}) => Promise<boolean>;
|
|
31
|
+
readonly isFaceActive: (required: {
|
|
32
|
+
readonly pluginId: string;
|
|
33
|
+
}) => Promise<boolean>;
|
|
34
|
+
}
|
|
35
|
+
/** The host's lifecycle-owner activation calls (one shared queue); `A` is its activations snapshot. */
|
|
36
|
+
export interface ProviderFaceActivations<A> {
|
|
37
|
+
reconcileAgentPluginActivation(required: {
|
|
38
|
+
workspaceRoot: string;
|
|
39
|
+
pluginId: string;
|
|
40
|
+
resolveEnabled: () => Promise<boolean>;
|
|
41
|
+
actor: string;
|
|
42
|
+
}): Promise<boolean>;
|
|
43
|
+
readAgentPluginActivations(required: {
|
|
44
|
+
readonly workspaceRoot: string;
|
|
45
|
+
}): Promise<A>;
|
|
46
|
+
isAgentPluginActive(required: {
|
|
47
|
+
readonly activations: A;
|
|
48
|
+
readonly pluginId: string;
|
|
49
|
+
}): boolean;
|
|
50
|
+
}
|
|
51
|
+
/** The host's lifecycle-owner catalog reads; `P` is its trusted package, `B` its bundled digests. */
|
|
52
|
+
export interface ProviderFaceCatalog<P extends {
|
|
53
|
+
readonly pluginId: string;
|
|
54
|
+
readonly archiveDigest: string;
|
|
55
|
+
}, B> {
|
|
56
|
+
list(required: {
|
|
57
|
+
workspaceRoot: string;
|
|
58
|
+
}): Promise<readonly P[]>;
|
|
59
|
+
bundled(required: {
|
|
60
|
+
workspaceRoot: string;
|
|
61
|
+
}): Promise<B>;
|
|
62
|
+
preferBundled(installed: readonly NoInfer<P>[], bundled: NoInfer<B>): readonly NoInfer<P>[];
|
|
63
|
+
read(required: {
|
|
64
|
+
plugin: NoInfer<P>;
|
|
65
|
+
filename: string;
|
|
66
|
+
}): Promise<string>;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Brings each linked face in line with its provider plugin's enabled state; only differing faces are
|
|
70
|
+
* written. `providerId` limits it to one provider's faces.
|
|
71
|
+
* @returns The face ids it switched. @complexity O(l) links, one activation read each.
|
|
72
|
+
*/
|
|
73
|
+
export declare function syncProviderFaces({ ports, providerEnabled }: {
|
|
74
|
+
ports: ProviderFacePorts;
|
|
75
|
+
providerEnabled: (required: {
|
|
76
|
+
readonly pluginId: string;
|
|
77
|
+
}) => Promise<boolean>;
|
|
78
|
+
}, optional?: {
|
|
79
|
+
readonly providerId?: string;
|
|
80
|
+
}): Promise<readonly string[]>;
|
|
81
|
+
/**
|
|
82
|
+
* The provider activation repo, with every write of THIS workspace's rows mirrored onto the linked
|
|
83
|
+
* faces. A mirror failure is reported to the host's `reportFollowFailure` port, never thrown: the provider decision
|
|
84
|
+
* already stands, and the next boot's {@link syncProviderFaces} repairs the face. The sink gets the
|
|
85
|
+
* provider id and the raw failure; the host formats (and redacts) its own log line.
|
|
86
|
+
* @complexity As the wrapped write, plus {@link syncProviderFaces} for that one provider.
|
|
87
|
+
*/
|
|
88
|
+
export declare function followProviderActivations({ repo, workspaceId, ports, reportFollowFailure }: {
|
|
89
|
+
repo: PluginActivationRepoPort;
|
|
90
|
+
workspaceId: string;
|
|
91
|
+
ports: ProviderFacePorts;
|
|
92
|
+
reportFollowFailure: (required: {
|
|
93
|
+
readonly pluginId: string;
|
|
94
|
+
readonly error: unknown;
|
|
95
|
+
}) => void;
|
|
96
|
+
}, _optional?: Record<string, never>): PluginActivationRepoPort;
|
|
97
|
+
/**
|
|
98
|
+
* Production ports over one workspace's installed agent plugins and activation record. The root is
|
|
99
|
+
* resolved per call, so binding before a site is chosen is safe. An unreadable manifest links nothing.
|
|
100
|
+
* The host injects its lifecycle owner's `activations` and `catalog` calls.
|
|
101
|
+
* @throws Unresolved multiple revisions refuse link discovery rather than picking a switch.
|
|
102
|
+
* @complexity `links`: O(p) installed packages, one trusted manifest read per selected revision.
|
|
103
|
+
*/
|
|
104
|
+
export declare function bindProviderFacePorts<A, P extends {
|
|
105
|
+
readonly pluginId: string;
|
|
106
|
+
readonly archiveDigest: string;
|
|
107
|
+
}, B>({ workspaceRoot, activations, catalog }: {
|
|
108
|
+
workspaceRoot: () => string;
|
|
109
|
+
activations: ProviderFaceActivations<A>;
|
|
110
|
+
catalog: ProviderFaceCatalog<P, B>;
|
|
111
|
+
}, optional?: Pick<AgentPluginIdentityReadOptions, "legacyIdentity">): ProviderFacePorts;
|
|
112
|
+
//# sourceMappingURL=provider-plugin-link.d.ts.map
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { orFallback } from "@jini-ai/core/errors/idioms";
|
|
2
|
+
import { readProviderPluginLink } from "@jini-ai/agent-plugins/lifecycle/host-tools";
|
|
3
|
+
/**
|
|
4
|
+
* @file One vendor, one plugin (owner 2026-10-25): a provider plugin (the Plugins screen, its Settings
|
|
5
|
+
* card, the code that sends events) and the agent plugin that is its assistant face (the chat key card
|
|
6
|
+
* and know-how) are switched by ONE switch — the provider plugin's. The agent plugin declares the link
|
|
7
|
+
* in its own manifest (`extensions.jini.providerPlugin`, read by `identity.ts`); core names no vendor.
|
|
8
|
+
*
|
|
9
|
+
* Why the face follows rather than both toggling each other: the provider plugin's activation row is
|
|
10
|
+
* already the durable, permission-gated, approval-recorded decision (`setPluginEnabled`), and its
|
|
11
|
+
* enable path carries capability approvals the agent-plugin switch has no business re-implementing.
|
|
12
|
+
* So the provider row is the one source of truth; the face's activation record is a mirror of it:
|
|
13
|
+
* - every write of the provider row (admin switch, `plugins_set_enabled`, reload, quarantine, rollback,
|
|
14
|
+
* uninstall) goes through the activation repo, which {@link followProviderActivations} wraps;
|
|
15
|
+
* - boot runs {@link syncProviderFaces} after seeding, which also absorbs faces seeded inactive and any
|
|
16
|
+
* mirror write that failed;
|
|
17
|
+
* - switching the face on its own is refused by the host (its linked-face error, which names the real
|
|
18
|
+
* switch; {@link linkedProviderOf} finds it).
|
|
19
|
+
*/
|
|
20
|
+
/** Recorded as the face's `updatedBy`, so an audit shows the provider plugin decided it. */
|
|
21
|
+
export const PROVIDER_LINK_ACTOR = "system:provider-plugin";
|
|
22
|
+
/**
|
|
23
|
+
* Brings each linked face in line with its provider plugin's enabled state; only differing faces are
|
|
24
|
+
* written. `providerId` limits it to one provider's faces.
|
|
25
|
+
* @returns The face ids it switched. @complexity O(l) links, one activation read each.
|
|
26
|
+
*/
|
|
27
|
+
export async function syncProviderFaces({ ports, providerEnabled }, optional = {}) {
|
|
28
|
+
const switched = [];
|
|
29
|
+
for (const [face, provider] of await ports.links({})) {
|
|
30
|
+
if (optional.providerId !== undefined && provider !== optional.providerId)
|
|
31
|
+
continue;
|
|
32
|
+
if (await ports.reconcileFace({ pluginId: face, resolveEnabled: () => providerEnabled({ pluginId: provider }) }))
|
|
33
|
+
switched.push(face);
|
|
34
|
+
}
|
|
35
|
+
return switched;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* The provider activation repo, with every write of THIS workspace's rows mirrored onto the linked
|
|
39
|
+
* faces. A mirror failure is reported to the host's `reportFollowFailure` port, never thrown: the provider decision
|
|
40
|
+
* already stands, and the next boot's {@link syncProviderFaces} repairs the face. The sink gets the
|
|
41
|
+
* provider id and the raw failure; the host formats (and redacts) its own log line.
|
|
42
|
+
* @complexity As the wrapped write, plus {@link syncProviderFaces} for that one provider.
|
|
43
|
+
*/
|
|
44
|
+
export function followProviderActivations({ repo, workspaceId, ports, reportFollowFailure }, _optional = {}) {
|
|
45
|
+
const mirror = async ({ row }) => {
|
|
46
|
+
if (row.workspaceId !== workspaceId)
|
|
47
|
+
return;
|
|
48
|
+
try {
|
|
49
|
+
await syncProviderFaces({ ports, providerEnabled: async ({ pluginId }) => (await repo.getActivation({ workspaceId, pluginId }))?.enabled ?? false }, { providerId: row.pluginId });
|
|
50
|
+
}
|
|
51
|
+
catch (error) {
|
|
52
|
+
reportFollowFailure({ pluginId: row.pluginId, error });
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
return {
|
|
56
|
+
getActivation: (required, opts) => repo.getActivation(required, opts),
|
|
57
|
+
listAll: (required, opts) => repo.listAll(required, opts),
|
|
58
|
+
save: async (record, opts) => { await repo.save(record, opts); await mirror({ row: record }); },
|
|
59
|
+
deleteActivation: async (required, opts) => { await repo.deleteActivation(required, opts); await mirror({ row: required }); },
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Production ports over one workspace's installed agent plugins and activation record. The root is
|
|
64
|
+
* resolved per call, so binding before a site is chosen is safe. An unreadable manifest links nothing.
|
|
65
|
+
* The host injects its lifecycle owner's `activations` and `catalog` calls.
|
|
66
|
+
* @throws Unresolved multiple revisions refuse link discovery rather than picking a switch.
|
|
67
|
+
* @complexity `links`: O(p) installed packages, one trusted manifest read per selected revision.
|
|
68
|
+
*/
|
|
69
|
+
export function bindProviderFacePorts({ workspaceRoot, activations, catalog }, optional = {}) {
|
|
70
|
+
return {
|
|
71
|
+
links: async () => {
|
|
72
|
+
const root = workspaceRoot();
|
|
73
|
+
const selected = catalog.preferBundled(await catalog.list({ workspaceRoot: root }), await catalog.bundled({ workspaceRoot: root }));
|
|
74
|
+
const counts = new Map();
|
|
75
|
+
for (const plugin of selected)
|
|
76
|
+
counts.set(plugin.pluginId, (counts.get(plugin.pluginId) ?? 0) + 1);
|
|
77
|
+
const links = new Map();
|
|
78
|
+
for (const plugin of selected) {
|
|
79
|
+
// The lifecycle refuses ambiguous non-bundled revisions; none may decide a current switch.
|
|
80
|
+
if (counts.get(plugin.pluginId) !== 1)
|
|
81
|
+
throw new Error(`Agent Plugin '${plugin.pluginId}' matches ${counts.get(plugin.pluginId)} installed packages — refusing to guess which one to use`);
|
|
82
|
+
const provider = await orFallback({
|
|
83
|
+
work: async () => readProviderPluginLink({ manifest: JSON.parse(await catalog.read({ plugin, filename: "plugin.json" })) }, optional),
|
|
84
|
+
fallback: undefined,
|
|
85
|
+
step: "read provider face link",
|
|
86
|
+
}); // An unreadable manifest links nothing.
|
|
87
|
+
if (provider !== undefined)
|
|
88
|
+
links.set(plugin.pluginId, provider);
|
|
89
|
+
}
|
|
90
|
+
return links;
|
|
91
|
+
},
|
|
92
|
+
reconcileFace: ({ pluginId, resolveEnabled }) => activations.reconcileAgentPluginActivation({
|
|
93
|
+
workspaceRoot: workspaceRoot(), pluginId, resolveEnabled, actor: PROVIDER_LINK_ACTOR
|
|
94
|
+
}),
|
|
95
|
+
isFaceActive: async ({ pluginId }) => activations.isAgentPluginActive({
|
|
96
|
+
activations: await activations.readAgentPluginActivations({ workspaceRoot: workspaceRoot() }), pluginId
|
|
97
|
+
}),
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
//# sourceMappingURL=provider-plugin-link.js.map
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { ToolRegistration } from "@jini-ai/core";
|
|
2
|
+
/**
|
|
3
|
+
* @file Keeps a retired plugin's tool name callable (Phase B7, 2026-10-12): `agent_plugin_deploy`
|
|
4
|
+
* answers with its successor's registration (the host's `replacements` catalog) — the same handler and the
|
|
5
|
+
* same policy, so the successor's activation/digest/revocation gate decides every call; switching the
|
|
6
|
+
* successor off or uninstalling it silences the alias too. An agent, a saved conversation or a skill that still names the old tool
|
|
7
|
+
* then reaches the guidance that replaced it instead of an unknown-tool error.
|
|
8
|
+
*
|
|
9
|
+
* Aliases are registered only AFTER the family's own registrations, and only for an id nothing
|
|
10
|
+
* registered: while retirement keeps an old `deploy` package (a successor not yet usable), that
|
|
11
|
+
* package's own `agent_plugin_deploy` wins, and the registry's duplicate-id refusal can never take
|
|
12
|
+
* the whole agent-plugin family down.
|
|
13
|
+
*/
|
|
14
|
+
type Registrar = {
|
|
15
|
+
readonly register: (registration: ToolRegistration) => void;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Wraps `registry` for one registration pass and collects the aliases owed to it.
|
|
19
|
+
*
|
|
20
|
+
* @param required.registry - The registrar the family's registrations pass through.
|
|
21
|
+
* @param required.replacements - The host's retired plugin id -> successor plugin id catalog.
|
|
22
|
+
* @param required.toToolId - The host's plugin id -> tool id rule (the same one its registrar mints ids with).
|
|
23
|
+
* @returns `registry`, the pass-through to hand the family's registrar; `registerAliases`, called
|
|
24
|
+
* once that registrar has finished, registers each owed alias whose id is still free.
|
|
25
|
+
* @complexity O(1) per registration; O(a) for `registerAliases` over the a retired names.
|
|
26
|
+
*/
|
|
27
|
+
export declare function createRetiredPluginToolAliases(required: {
|
|
28
|
+
readonly registry: Registrar;
|
|
29
|
+
readonly replacements: ReadonlyMap<string, string>;
|
|
30
|
+
readonly toToolId: (input: {
|
|
31
|
+
readonly pluginId: string;
|
|
32
|
+
}) => string;
|
|
33
|
+
}, _optional?: Record<string, never>): {
|
|
34
|
+
registry: {
|
|
35
|
+
register(registration: ToolRegistration): void;
|
|
36
|
+
};
|
|
37
|
+
registerAliases(): void;
|
|
38
|
+
};
|
|
39
|
+
export {};
|
|
40
|
+
//# sourceMappingURL=retired-plugin-tool-aliases.d.ts.map
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wraps `registry` for one registration pass and collects the aliases owed to it.
|
|
3
|
+
*
|
|
4
|
+
* @param required.registry - The registrar the family's registrations pass through.
|
|
5
|
+
* @param required.replacements - The host's retired plugin id -> successor plugin id catalog.
|
|
6
|
+
* @param required.toToolId - The host's plugin id -> tool id rule (the same one its registrar mints ids with).
|
|
7
|
+
* @returns `registry`, the pass-through to hand the family's registrar; `registerAliases`, called
|
|
8
|
+
* once that registrar has finished, registers each owed alias whose id is still free.
|
|
9
|
+
* @complexity O(1) per registration; O(a) for `registerAliases` over the a retired names.
|
|
10
|
+
*/
|
|
11
|
+
export function createRetiredPluginToolAliases(required, _optional = {}) {
|
|
12
|
+
const { toToolId } = required;
|
|
13
|
+
const aliasIdByToolId = new Map([...required.replacements].map(([retired, successor]) => [toToolId({ pluginId: successor }), toToolId({ pluginId: retired })]));
|
|
14
|
+
const registered = new Set();
|
|
15
|
+
const owed = [];
|
|
16
|
+
return {
|
|
17
|
+
registry: {
|
|
18
|
+
register(registration) {
|
|
19
|
+
required.registry.register(registration);
|
|
20
|
+
registered.add(registration.descriptor.id);
|
|
21
|
+
const aliasId = aliasIdByToolId.get(registration.descriptor.id);
|
|
22
|
+
if (aliasId === undefined)
|
|
23
|
+
return;
|
|
24
|
+
owed.push({
|
|
25
|
+
...registration,
|
|
26
|
+
descriptor: {
|
|
27
|
+
...registration.descriptor,
|
|
28
|
+
id: aliasId,
|
|
29
|
+
description: `Former name of ${registration.descriptor.id}; returns the same guidance. ${registration.descriptor.description ?? ""}`.trimEnd(),
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
registerAliases() {
|
|
35
|
+
for (const alias of owed)
|
|
36
|
+
if (!registered.has(alias.descriptor.id))
|
|
37
|
+
required.registry.register(alias);
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=retired-plugin-tool-aliases.js.map
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/** Consumer-owned service boundaries. Composition binds concrete services and secret stores. */
|
|
2
|
+
import type { ChatAgentPlugins } from "@jini-ai/agent-plugins/lifecycle";
|
|
3
|
+
import type { SurfaceCardSecretForm as SecretCardForm } from "@jini-ai/core/contracts/cards";
|
|
4
|
+
import type { ExternalMcpConnectStart } from "@jini-ai/core/contracts/hosted-mcp";
|
|
5
|
+
import type { AgentPluginMcpPort as PortableAgentPluginMcpPort, AgentPluginMcpProjectionPorts, AgentPluginMcpServicesPort as PortableAgentPluginMcpServicesPort } from "@jini-ai/agent-plugins/connect";
|
|
6
|
+
/** The MCP ports live in `@jini-ai/agent-plugins/connect`; these two bind them to the site daemon's tool-access change record. */
|
|
7
|
+
export type AgentPluginMcpPort = PortableAgentPluginMcpPort<import("@jini-ai/core/contracts/site/daemon").ToolAccessChange>;
|
|
8
|
+
export type AgentPluginMcpServicesPort = PortableAgentPluginMcpServicesPort<import("@jini-ai/core/contracts/site/daemon").ToolAccessChange>;
|
|
9
|
+
import type { PluginCredentialCard } from "@jini-ai/core/contracts/credentials";
|
|
10
|
+
import type { ApiConnectionConnectStatus } from "@jini-ai/core/contracts/site/integrations-api-connections";
|
|
11
|
+
/** Connect-time OAuth discovery and the existing validation error identity, adapted by composition. */
|
|
12
|
+
export interface AgentPluginOAuthPort {
|
|
13
|
+
beginConnect(input: {
|
|
14
|
+
serverId: string;
|
|
15
|
+
redirectUri?: string;
|
|
16
|
+
delivery?: "hosted";
|
|
17
|
+
}, options?: Record<string, never>): Promise<ExternalMcpConnectStart>;
|
|
18
|
+
/** @agent-note Same rule as {@link AgentPluginSignInPort.isSignInRefusal}: true only for a refusal
|
|
19
|
+
* that opened no card (the key-card fallback is offered); every other fault propagates unchanged. */
|
|
20
|
+
isSignInRefusal(input: {
|
|
21
|
+
error: unknown;
|
|
22
|
+
}, options?: Record<string, never>): boolean;
|
|
23
|
+
}
|
|
24
|
+
/** Plugin-declared credential cards and the guarded, read-only token probe. */
|
|
25
|
+
export interface PluginCredentialsPort {
|
|
26
|
+
apply(input: {
|
|
27
|
+
card?: PluginCredentialCard;
|
|
28
|
+
form: SecretCardForm;
|
|
29
|
+
}, options?: Record<string, never>): SecretCardForm;
|
|
30
|
+
loadSafe(input: {
|
|
31
|
+
workspaceId: string;
|
|
32
|
+
}, options?: Record<string, never>): Promise<readonly PluginCredentialCard[]>;
|
|
33
|
+
find(input: {
|
|
34
|
+
workspaceId: string;
|
|
35
|
+
saveKind: PluginCredentialCard["saveKind"];
|
|
36
|
+
target: string;
|
|
37
|
+
}, options?: Record<string, never>): Promise<PluginCredentialCard | undefined>;
|
|
38
|
+
probe(input: {
|
|
39
|
+
probeUrl: string;
|
|
40
|
+
token: string;
|
|
41
|
+
}, options?: Record<string, never>): Promise<"ok" | "refused" | "unavailable">;
|
|
42
|
+
}
|
|
43
|
+
/** Effective operator preferences with principal resolution supplied by the host. */
|
|
44
|
+
export interface AgentPluginPreferencesPort {
|
|
45
|
+
locale(input: {
|
|
46
|
+
workspaceId: string;
|
|
47
|
+
principalId: string;
|
|
48
|
+
}, options?: Record<string, never>): Promise<string>;
|
|
49
|
+
/** Anything but the stored Ask or Off preference (including no value) resolves to Auto. */
|
|
50
|
+
mode(input: {
|
|
51
|
+
workspaceId: string;
|
|
52
|
+
principalId: string;
|
|
53
|
+
}, options?: Record<string, never>): Promise<ChatAgentPlugins>;
|
|
54
|
+
/** Effective mode plus the addressed personal layer's revision, fixed before the approval. */
|
|
55
|
+
snapshot(input: {
|
|
56
|
+
workspaceId: string;
|
|
57
|
+
principalId: string;
|
|
58
|
+
}, options?: Record<string, never>): Promise<{
|
|
59
|
+
mode: ChatAgentPlugins;
|
|
60
|
+
revisionSeq: number;
|
|
61
|
+
}>;
|
|
62
|
+
saveAuto(input: {
|
|
63
|
+
workspaceId: string;
|
|
64
|
+
principalId: string;
|
|
65
|
+
expectedRevisionSeq?: number;
|
|
66
|
+
}, options?: Record<string, never>): Promise<void>;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Declared API connections; the host retains OAuth clients, browser binding and token custody.
|
|
70
|
+
* `TConnection` is the host's declared-connection record: this port only passes it through.
|
|
71
|
+
*/
|
|
72
|
+
export interface AgentPluginApiConnectionsPort<TConnection> {
|
|
73
|
+
readonly sharingAvailable?: boolean;
|
|
74
|
+
listConnections(input: {
|
|
75
|
+
pluginId: string;
|
|
76
|
+
}, options?: Record<string, never>): Promise<readonly TConnection[]>;
|
|
77
|
+
connect(input: {
|
|
78
|
+
destination?: 'site' | 'shared';
|
|
79
|
+
connection: TConnection;
|
|
80
|
+
actorId: string;
|
|
81
|
+
signal: AbortSignal;
|
|
82
|
+
pollIntervalMs: number;
|
|
83
|
+
waitTimeoutMs: number;
|
|
84
|
+
showSignIn: (input: {
|
|
85
|
+
readonly signInUrl: string;
|
|
86
|
+
}) => Promise<void>;
|
|
87
|
+
}, options?: Record<string, never>): Promise<ApiConnectionConnectStatus>;
|
|
88
|
+
}
|
|
89
|
+
/** Resolved host paths; consumers take only the facts they need. */
|
|
90
|
+
export interface AgentPluginPathsPort {
|
|
91
|
+
readonly siteDir: string;
|
|
92
|
+
readonly bundledSourceRoot: string;
|
|
93
|
+
}
|
|
94
|
+
/** Old host entry signatures only: custom projections always come with their classifier. */
|
|
95
|
+
export type AgentPluginMcpContext = AgentPluginMcpProjectionPorts | {
|
|
96
|
+
readonly projections?: undefined;
|
|
97
|
+
readonly classifyError?: AgentPluginMcpPort['classifyError'];
|
|
98
|
+
};
|
|
99
|
+
export interface AgentPluginSignInPort {
|
|
100
|
+
readonly beginConnect: AgentPluginOAuthPort['beginConnect'];
|
|
101
|
+
/** @agent-note True only for a refusal that opened NO card, so chat offers the key-card fallback;
|
|
102
|
+
* any other fault returns false and propagates unchanged. Matching does not make a message safe:
|
|
103
|
+
* the consumer passes model-facing text through the core redaction boundary. */
|
|
104
|
+
isSignInRefusal(required: {
|
|
105
|
+
error: unknown;
|
|
106
|
+
}, optional?: Record<string, never>): boolean;
|
|
107
|
+
}
|
|
108
|
+
//# sourceMappingURL=service-ports.d.ts.map
|