@jini-ai/agent-plugins 0.7.3-next.2 → 0.7.3-next.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (231) hide show
  1. package/README.md +22 -4
  2. package/calendly/README.md +29 -0
  3. package/calendly/mcp.json +1 -1
  4. package/cloudflare/lib/assets.mjs +1 -1
  5. package/cloudflare/lib/cms-forms.mjs +1 -1
  6. package/core/persistent-state.d.ts +4 -1
  7. package/core/persistent-state.js +55 -21
  8. package/dist/admin-surfaces/callback-field-inbox.d.ts +1 -6
  9. package/dist/admin-surfaces/connections/connections.d.ts +2 -6
  10. package/dist/admin-surfaces/connections/index.d.ts +3 -2
  11. package/dist/admin-surfaces/index.d.ts +3 -1
  12. package/dist/connect/access-token-tool.d.ts +1 -1
  13. package/dist/connect/access-token-tool.js +1 -1
  14. package/dist/connect/catalog.d.ts +26 -0
  15. package/dist/connect/catalog.js +42 -0
  16. package/dist/connect/connect-tool.d.ts +2 -294
  17. package/dist/connect/connect-tool.js +2 -53
  18. package/dist/connect/contracts.d.ts +257 -0
  19. package/dist/connect/contracts.js +2 -0
  20. package/dist/connect/credential-cards.d.ts +2 -0
  21. package/dist/connect/credential-cards.js +7 -4
  22. package/dist/connect/grant-signed-in-defaults.js +1 -1
  23. package/dist/connect/host-deps.d.ts +32 -0
  24. package/dist/connect/host-deps.js +35 -0
  25. package/dist/connect/import-access-token.js +1 -1
  26. package/dist/connect/index.d.ts +7 -2
  27. package/dist/connect/index.js +5 -2
  28. package/dist/connect/installed-plugin.d.ts +28 -0
  29. package/dist/connect/installed-plugin.js +19 -0
  30. package/dist/connect/new-site-agent-plugin-tokens.d.ts +88 -0
  31. package/dist/connect/new-site-agent-plugin-tokens.js +107 -0
  32. package/dist/connect/plugin-host/index.d.ts +1 -2
  33. package/dist/connect/plugin-host/index.js +18 -9
  34. package/dist/connect/token-sign-in.d.ts +1 -14
  35. package/dist/connect/token-sign-in.js +4 -23
  36. package/dist/core/export-props.d.ts +10 -0
  37. package/dist/core/export-props.js +31 -0
  38. package/dist/core/folder-zip-error.d.ts +5 -0
  39. package/dist/core/folder-zip-error.js +8 -0
  40. package/dist/core/host-incompatible-error.d.ts +8 -0
  41. package/dist/core/host-incompatible-error.js +9 -0
  42. package/dist/core/identity-namespace.d.ts +27 -16
  43. package/dist/core/identity-namespace.js +25 -22
  44. package/dist/core/plugin-display-name.d.ts +7 -0
  45. package/dist/core/plugin-display-name.js +11 -0
  46. package/dist/core/provider-plugin-link.d.ts +7 -0
  47. package/dist/core/provider-plugin-link.js +5 -0
  48. package/dist/{connect → core}/token-map.d.ts +11 -1
  49. package/dist/{connect → core}/token-map.js +15 -0
  50. package/dist/core/token-sign-in-list.d.ts +18 -0
  51. package/dist/core/token-sign-in-list.js +23 -0
  52. package/dist/core/update-error.d.ts +8 -0
  53. package/dist/core/update-error.js +9 -0
  54. package/dist/{lifecycle → core}/update-plan.d.ts +1 -1
  55. package/dist/ffmpeg-transcode/adapter.d.ts +74 -0
  56. package/dist/ffmpeg-transcode/adapter.js +155 -0
  57. package/dist/folder-zip-node.d.ts +2 -1
  58. package/dist/folder-zip-node.js +6 -5
  59. package/dist/folder-zip.d.ts +0 -4
  60. package/dist/folder-zip.js +1 -7
  61. package/dist/index.d.ts +3 -1
  62. package/dist/lifecycle/activation.d.ts +39 -3
  63. package/dist/lifecycle/activation.js +467 -418
  64. package/dist/lifecycle/automatic-use-offer.d.ts +62 -0
  65. package/dist/lifecycle/automatic-use-offer.js +52 -0
  66. package/dist/lifecycle/automatic-use.d.ts +33 -1
  67. package/dist/lifecycle/automatic-use.js +157 -38
  68. package/dist/lifecycle/bundled-source-archive.d.ts +1 -1
  69. package/dist/lifecycle/capability-projection.d.ts +0 -1
  70. package/dist/lifecycle/capability-projection.js +92 -23
  71. package/dist/lifecycle/compatibility-metadata.d.ts +1 -0
  72. package/dist/lifecycle/compatibility-metadata.js +6 -1
  73. package/dist/lifecycle/compatibility.d.ts +1 -8
  74. package/dist/lifecycle/compatibility.js +1 -8
  75. package/dist/lifecycle/credential-card-metadata.d.ts +2 -2
  76. package/dist/lifecycle/exports.d.ts +2 -45
  77. package/dist/lifecycle/exports.js +1 -30
  78. package/dist/lifecycle/host-tools/identity.d.ts +5 -4
  79. package/dist/lifecycle/host-tools/identity.js +5 -5
  80. package/dist/lifecycle/host-tools/ports.d.ts +10 -1
  81. package/dist/lifecycle/host-tools/search-tool.js +18 -8
  82. package/dist/lifecycle/host-tools/skill-tool.js +1 -1
  83. package/dist/lifecycle/index.d.ts +20 -17
  84. package/dist/lifecycle/index.js +5 -4
  85. package/dist/lifecycle/install-from-url.d.ts +1 -2
  86. package/dist/lifecycle/install.d.ts +4 -34
  87. package/dist/lifecycle/install.js +3 -3
  88. package/dist/lifecycle/installed-package-index.d.ts +1 -1
  89. package/dist/lifecycle/installed-package-index.js +4 -4
  90. package/dist/lifecycle/layout.d.ts +21 -25
  91. package/dist/lifecycle/layout.js +79 -0
  92. package/dist/lifecycle/manifest.d.ts +10 -7
  93. package/dist/lifecycle/manifest.js +20 -15
  94. package/dist/lifecycle/mcp-provisioning.d.ts +1 -1
  95. package/dist/lifecycle/metadata.d.ts +6 -3
  96. package/dist/lifecycle/metadata.js +2 -1
  97. package/dist/lifecycle/package-paths.js +59 -56
  98. package/dist/lifecycle/persistent-state.d.ts +10 -1
  99. package/dist/lifecycle/persistent-state.js +4 -2
  100. package/dist/lifecycle/ports.d.ts +18 -6
  101. package/dist/lifecycle/resolve-agent-plugin-refs.d.ts +2 -14
  102. package/dist/lifecycle/retire-bundled.d.ts +1 -1
  103. package/dist/lifecycle/search-projection.d.ts +3 -1
  104. package/dist/lifecycle/search-projection.js +7 -3
  105. package/dist/lifecycle/search.d.ts +1 -0
  106. package/dist/lifecycle/seed-bundled.d.ts +86 -1
  107. package/dist/lifecycle/seed-bundled.js +48 -84
  108. package/dist/lifecycle/set-enabled.d.ts +1 -13
  109. package/dist/lifecycle/set-enabled.js +11 -7
  110. package/dist/lifecycle/trusted-plugin-files.d.ts +1 -1
  111. package/dist/lifecycle/trusted-plugin-files.js +33 -30
  112. package/dist/lifecycle/types.d.ts +13 -34
  113. package/dist/lifecycle/uninstall.d.ts +1 -33
  114. package/dist/lifecycle/update-store.d.ts +0 -7
  115. package/dist/lifecycle/update-store.js +1 -8
  116. package/dist/lifecycle/update.d.ts +1 -1
  117. package/dist/lifecycle/update.js +60 -10
  118. package/dist/lifecycle/yauzl-archive-reader.d.ts +7 -2
  119. package/dist/lifecycle/yauzl-archive-reader.js +11 -6
  120. package/dist/manifest.d.ts +4 -8
  121. package/dist/react/AgentPluginDetailsModal.d.ts +187 -0
  122. package/dist/react/AgentPluginDetailsModal.js +29 -0
  123. package/dist/react/agent-plugin-install-port.d.ts +24 -0
  124. package/dist/react/agent-plugin-install-port.js +15 -0
  125. package/dist/react/installed-skills-composer-source.d.ts +60 -0
  126. package/dist/react/installed-skills-composer-source.js +111 -0
  127. package/dist/react/use-agent-plugins.hooks.d.ts +211 -0
  128. package/dist/react/use-agent-plugins.hooks.js +128 -0
  129. package/dist/site/activation-effects.d.ts +17 -0
  130. package/dist/site/activation-effects.js +31 -0
  131. package/dist/site/admin-surfaces/capabilities.d.ts +29 -0
  132. package/dist/site/admin-surfaces/capabilities.js +30 -0
  133. package/dist/site/admin-surfaces/delivery-bindings.d.ts +81 -0
  134. package/dist/site/admin-surfaces/delivery-bindings.js +161 -0
  135. package/dist/site/admin-surfaces/forms.d.ts +28 -0
  136. package/dist/site/admin-surfaces/forms.js +29 -0
  137. package/dist/site/admin-surfaces/handlers.d.ts +61 -0
  138. package/dist/site/admin-surfaces/handlers.js +35 -0
  139. package/dist/site/admin-surfaces/public-config.d.ts +12 -0
  140. package/dist/site/admin-surfaces/public-config.js +28 -0
  141. package/dist/site/analytics-provider-registry.d.ts +87 -0
  142. package/dist/site/analytics-provider-registry.js +87 -0
  143. package/dist/site/archive-reader-abi.d.ts +35 -0
  144. package/dist/site/archive-reader-abi.js +25 -0
  145. package/dist/site/auth-schemes.d.ts +110 -0
  146. package/dist/site/auth-schemes.js +119 -0
  147. package/dist/site/automatic-agent-plugins.d.ts +200 -0
  148. package/dist/site/automatic-agent-plugins.js +277 -0
  149. package/dist/site/bundled-contribution-sources.d.ts +24 -0
  150. package/dist/site/bundled-contribution-sources.js +17 -0
  151. package/dist/site/bundled-id-upgrade.d.ts +115 -0
  152. package/dist/site/bundled-id-upgrade.js +169 -0
  153. package/dist/site/customize-tool.d.ts +39 -0
  154. package/dist/site/customize-tool.js +31 -0
  155. package/dist/site/deploy-split-activation.d.ts +28 -0
  156. package/dist/site/deploy-split-activation.js +21 -0
  157. package/dist/site/exports/diagnostics.d.ts +37 -0
  158. package/dist/site/exports/diagnostics.js +55 -0
  159. package/dist/site/exports/runtime.d.ts +54 -0
  160. package/dist/site/exports/runtime.js +196 -0
  161. package/dist/site/exports/source.d.ts +42 -0
  162. package/dist/site/exports/source.js +58 -0
  163. package/dist/site/host-plugin-guidance.d.ts +137 -0
  164. package/dist/site/host-plugin-guidance.js +223 -0
  165. package/dist/site/host-signals.d.ts +78 -0
  166. package/dist/site/host-signals.js +83 -0
  167. package/dist/site/install-tool.d.ts +69 -0
  168. package/dist/site/install-tool.js +192 -0
  169. package/dist/site/install-upload.d.ts +175 -0
  170. package/dist/site/install-upload.js +324 -0
  171. package/dist/site/memory-i18n.d.ts +5 -0
  172. package/dist/site/memory-i18n.js +176 -0
  173. package/dist/site/memory.d.ts +80 -0
  174. package/dist/site/memory.js +83 -0
  175. package/dist/site/plugin-memory.d.ts +80 -0
  176. package/dist/site/plugin-memory.js +86 -0
  177. package/dist/site/provider-plugin-link.d.ts +112 -0
  178. package/dist/site/provider-plugin-link.js +100 -0
  179. package/dist/site/retired-plugin-tool-aliases.d.ts +40 -0
  180. package/dist/site/retired-plugin-tool-aliases.js +41 -0
  181. package/dist/site/service-ports.d.ts +108 -0
  182. package/dist/site/service-ports.js +2 -0
  183. package/dist/site/set-enabled.d.ts +80 -0
  184. package/dist/site/set-enabled.js +42 -0
  185. package/dist/site/soon-lock.d.ts +83 -0
  186. package/dist/site/soon-lock.js +78 -0
  187. package/dist/site/supersession.d.ts +61 -0
  188. package/dist/site/supersession.js +122 -0
  189. package/dist/site/uninstall-tool.d.ts +136 -0
  190. package/dist/site/uninstall-tool.js +203 -0
  191. package/dist/site/update-effects.d.ts +47 -0
  192. package/dist/site/update-effects.js +49 -0
  193. package/ffmpeg-transcode/plugin.json +16 -0
  194. package/github/source-control/backup-push.mjs +66 -46
  195. package/github/source-control/commit-site.mjs +112 -65
  196. package/github/source-control/write-files.mjs +86 -53
  197. package/github-pages/targets/github-pages.mjs +294 -233
  198. package/google-workspace/form-destinations/mapping.mjs +15 -7
  199. package/google-workspace/form-destinations/sheets.mjs +4 -2
  200. package/google-workspace/plugin.json +1 -0
  201. package/kuinetic/CHANGELOG.md +4 -0
  202. package/kuinetic/plugin.json +4 -1
  203. package/kuinetic/skills/kuinetic/SKILL.md +1 -2
  204. package/package.json +295 -18
  205. package/persistent-state.d.ts +4 -1
  206. package/resend/adapters/resend.mjs +5 -2
  207. package/resend/plugin.json +1 -1
  208. package/s3-compatible/jini-deploy-targets.json +1 -1
  209. package/s3-compatible/object-stores/s3-compatible.mjs +27 -4
  210. package/s3-compatible/targets/s3-compatible.mjs +3 -3
  211. package/site-import/plugin.json +3 -3
  212. package/site-import/skills/site-import/SKILL.md +62 -54
  213. package/site-import/skills/site-import/references/content-mapping.md +26 -20
  214. package/slide-design/plugin.json +1 -1
  215. package/slide-design/skills/slide-design/SKILL.md +8 -2
  216. package/ui-ux-design/CHANGELOG.md +6 -0
  217. package/ui-ux-design/plugin.json +1 -1
  218. package/ui-ux-design/skills/gstack-design/SKILL.md +6 -6
  219. package/ui-ux-design/skills/ui-ux-design/SKILL.md +3 -2
  220. package/ui-ux-design/skills/ui-ux-design/references/chrome-mobile-test-matrix.md +14 -12
  221. package/ui-ux-design/skills/ui-ux-design/references/ui-loop.md +16 -17
  222. package/vercel/NOTES.md +2 -1
  223. package/vercel/object-stores/vercel-blob.mjs +3 -4
  224. package/vercel/targets/vercel.mjs +425 -351
  225. package/core/commerce-server.d.ts +0 -2
  226. package/core/commerce-server.mjs +0 -2
  227. package/dist/admin-surfaces/connections/ports.d.ts +0 -110
  228. package/dist/admin-surfaces/connections/ports.js +0 -2
  229. /package/dist/{lifecycle → core}/install-errors.d.ts +0 -0
  230. /package/dist/{lifecycle → core}/install-errors.js +0 -0
  231. /package/dist/{lifecycle → core}/update-plan.js +0 -0
@@ -1,5 +1,5 @@
1
1
  import { resolveAgentPluginLifecycleNamespace } from '../core/identity-namespace.js';
2
- import { createPluginMemory, migratePluginLayout, assertPluginStatePath, withPluginStateLock } from '../../core/persistent-state.js';
2
+ import { createPluginMemory, migratePluginLayout, assertPluginStatePath, withPluginStateLock, withWorkspaceMigrationLock } from '../../core/persistent-state.js';
3
3
  import path from 'node:path';
4
4
  import { createPackagePathsModule } from './package-paths.js';
5
5
  import { parseAgentPluginManifest } from './manifest.js';
@@ -18,12 +18,14 @@ export function createPersistentStateModule(ports, _optional = {}) {
18
18
  };
19
19
  return {
20
20
  withIdentityLock: (required, _optional = {}) => effects.withLock({ lockPath: path.join(required.workspaceRoot, '.publisher-identity.lock'), run: required.run }),
21
+ // Outermost lock of the workspace ordering; see `withWorkspaceMigrationLock`.
22
+ withWorkspaceLock: (required, _optional = {}) => withWorkspaceMigrationLock({ ...effects, ...required }),
21
23
  withPluginLock: (required, optional = {}) => withPluginStateLock({ ...effects, ...required }, optional),
22
24
  memory: (required, optional = {}) => createPluginMemory({ ...effects, ...required }, optional),
23
25
  assertOwnedPath: (required, optional = {}) => assertPluginStatePath({ ...effects, ...required }, optional),
24
26
  migrate: (required, optional = {}) => migratePluginLayout({ ...effects, ...required,
25
27
  parsePluginId: ({ value }) => {
26
- const parsed = parseAgentPluginManifest({ value }, { identityNamespace: resolveAgentPluginLifecycleNamespace({ value, extensionNamespace: ports.extensionNamespace }) });
28
+ const parsed = parseAgentPluginManifest({ value }, { identityNamespace: resolveAgentPluginLifecycleNamespace({ value, extensionNamespace: ports.extensionNamespace }, { legacyIdentity: ports.legacyIdentity }), legacyIdentity: ports.legacyIdentity });
27
29
  if (!parsed.ok)
28
30
  throw new Error(parsed.errors.join('; '));
29
31
  return parsed.manifest.name;
@@ -1,8 +1,9 @@
1
+ import type { WorkspaceMigrationOwnership } from '../../core/persistent-state.js';
1
2
  import type { Clock, IdGenerator } from "@jini-ai/core/primitives";
2
3
  import type { AtomicFileWriterPort, BootIdentity, FileLockPort } from "@jini-ai/core/contracts/runtime";
3
- import type { AgentPluginServerMetadataReader } from './manifest.js';
4
- import type { AgentPluginLayoutPort } from './layout.js';
5
- import type { AgentPluginDeliveryMode, InstalledAgentPlugin } from './types.js';
4
+ import type { AgentPluginServerMetadataReader, LegacyAgentPluginIdentity, LegacyMcpAliases } from './manifest.js';
5
+ import type { AgentPluginDeliveryMode } from './types.js';
6
+ import type { AgentPluginLayoutPort, InstalledAgentPlugin } from "@jini-ai/core/contracts/site/agent-plugins-lifecycle";
6
7
  /** Native Node filesystem ABI, narrowed to the operations used by lifecycle.
7
8
  * Inject instrumented fs/promises effects directly; native handles are never rewrapped. */
8
9
  export type FilesystemPort = Pick<typeof import('node:fs/promises'), 'chmod' | 'mkdir' | 'mkdtemp' | 'open' | 'readdir' | 'readFile' | 'rename' | 'rm' | 'rmdir' | 'stat' | 'lstat' | 'realpath' | 'unlink'>;
@@ -14,6 +15,11 @@ export type AgentPluginClockPort = Clock & {
14
15
  sleep(required: {
15
16
  readonly ms: number;
16
17
  }): Promise<void>;
18
+ /** The pause between background recovery attempts. A host binds a wait that does not keep its process
19
+ * alive (an unref'd timer), so a retry never delays process exit; absent = `sleep`. */
20
+ sleepInBackground?(required: {
21
+ readonly ms: number;
22
+ }): Promise<void>;
17
23
  };
18
24
  export type AgentPluginIdsPort = IdGenerator & {
19
25
  random(): number;
@@ -102,10 +108,14 @@ export interface AgentPluginLifecyclePorts {
102
108
  readonly extensionNamespace: string;
103
109
  /** Host boot policy may migrate every workspace before seeding the requested workspace.
104
110
  * A failure refuses all publication; absent uses the owner's single-workspace migration. */
111
+ /** `ownership`, when present, proves the caller already holds this workspace's migration lock: run
112
+ * the migration under it (`migratePluginLayout`'s `ownership`), never acquire it again. */
105
113
  readonly migrateBeforeSeed?: ((required: {
106
114
  readonly layout: AgentPluginLayoutPort;
107
115
  readonly workspaceId: string;
108
- }, optional: Record<string, never>) => Promise<{
116
+ }, optional: {
117
+ readonly ownership?: WorkspaceMigrationOwnership;
118
+ }) => Promise<{
109
119
  readonly complete: boolean;
110
120
  }>) | undefined;
111
121
  /** Host-facing recovery instructions; the bundled refusal and its security gate remain owned here. */
@@ -113,12 +123,14 @@ export interface AgentPluginLifecyclePorts {
113
123
  readonly pluginId: string;
114
124
  }, optional: Record<string, never>) => string) | undefined;
115
125
  readonly readServerMetadata?: AgentPluginServerMetadataReader | undefined;
126
+ readonly legacyIdentity?: LegacyAgentPluginIdentity | undefined;
127
+ readonly legacyMcpAliases?: LegacyMcpAliases | undefined;
116
128
  readonly deliveryMode: AgentPluginDeliveryMode;
117
129
  readonly mcpProvisioning: AgentPluginMcpProvisioningPort;
118
130
  readonly fetch: AgentPluginFetchPort;
119
131
  readonly outboundGuard: AgentPluginOutboundGuardPort;
120
132
  }
121
133
  /** Application policy/effects are required; observers and metadata translators are optional. */
122
- export type AgentPluginLifecycleRequired = Omit<AgentPluginLifecyclePorts, 'onActivationChanged' | 'onEvent' | 'readServerMetadata' | 'migrateBeforeSeed' | 'formatBundledUninstallRecovery' | 'identityAdmission'>;
123
- export type AgentPluginLifecycleOptional = Pick<AgentPluginLifecyclePorts, 'onActivationChanged' | 'onEvent' | 'readServerMetadata' | 'migrateBeforeSeed' | 'formatBundledUninstallRecovery' | 'identityAdmission'>;
134
+ export type AgentPluginLifecycleRequired = Omit<AgentPluginLifecyclePorts, 'onActivationChanged' | 'onEvent' | 'readServerMetadata' | 'legacyMcpAliases' | 'legacyIdentity' | 'migrateBeforeSeed' | 'formatBundledUninstallRecovery' | 'identityAdmission'>;
135
+ export type AgentPluginLifecycleOptional = Pick<AgentPluginLifecyclePorts, 'onActivationChanged' | 'onEvent' | 'readServerMetadata' | 'legacyMcpAliases' | 'legacyIdentity' | 'migrateBeforeSeed' | 'formatBundledUninstallRecovery' | 'identityAdmission'>;
124
136
  //# sourceMappingURL=ports.d.ts.map
@@ -1,18 +1,6 @@
1
- import type { /**
2
- * How a pinned ref's content reaches the agent.
3
- *
4
- * - `inject` — the whole eponymous SKILL.md (~15KB for `ui-ux-design`) plus its readable supporting-file inventory
5
- * listed relative to the skill folder, in the run's prompt prefix. Today's shipped behaviour, and the default.
6
- * - `pointer` — ~400 bytes naming the exact tool call that returns that SAME SKILL.md, and nothing
7
- * else. The content is identical; only the delivery differs, which is what makes the two a
8
- * controlled comparison rather than two different experiments.
9
- *
10
- * Selected per-process by the host-supplied `deliveryMode` port. This is a MEASUREMENT AFFORDANCE, not a
11
- * migration flag: pointer and inject must coexist to compare delivery of identical content.
12
- * Selecting an unconditional mode requires the measurement result.
13
- */ AgentPluginDeliveryMode, InstalledAgentPlugin } from "./types.js";
14
- import type { AgentPluginWorkspaceLayout } from "./layout.js";
1
+ import type { AgentPluginDeliveryMode } from "./types.js";
15
2
  import type { AgentPluginLifecyclePorts } from "./ports.js";
3
+ import type { InstalledAgentPlugin, AgentPluginWorkspaceLayout } from "@jini-ai/core/contracts/site/agent-plugins-lifecycle";
16
4
  /** A declared skill and a file relative to that skill's folder; omitted file means SKILL.md. */
17
5
  export interface AgentPluginSkillRequest {
18
6
  readonly skill?: string;
@@ -1,6 +1,6 @@
1
1
  import type { BundledAgentPluginEnableOutcome } from "./activation.js";
2
- import type { AgentPluginLayout } from "./layout.js";
3
2
  import type { AgentPluginLifecyclePorts } from "./ports.js";
3
+ import type { AgentPluginLayout } from "@jini-ai/core/contracts/site/agent-plugins-lifecycle";
4
4
  /** What happened to the successor. `not-needed`: the retired plugin was off, so the successor was
5
5
  * left as it was. The other three are {@link BundledAgentPluginEnableOutcome}. */
6
6
  export type RetiredAgentPluginSuccessorOutcome = BundledAgentPluginEnableOutcome | "not-needed";
@@ -18,7 +18,9 @@ export interface AgentPluginDiscoveryPage {
18
18
  * @complexity O(1) bounded text work and shallow copy; no I/O or mutation.
19
19
  */
20
20
  export declare function agentVisiblePluginCandidate({ candidate }: {
21
- candidate: AgentPluginSearchCandidate;
21
+ candidate: AgentPluginSearchCandidate & {
22
+ readonly maturity?: string;
23
+ };
22
24
  }, _options?: {}): AgentPluginSearchCandidate;
23
25
  /** Page an already ordered catalog, bounding the complete serialized result, including JSON escaping.
24
26
  * @param required Ranked/listed candidates, a validated count window and the installed catalog size.
@@ -17,14 +17,18 @@ export function agentVisiblePluginCandidate({ candidate }, _options = {}) {
17
17
  return candidate;
18
18
  const purpose = shortDescription({ text: (candidate.summary ?? candidate.description ?? '').slice(0, 1024).replace(/\s+/g, ' ').trim() }, { maxBytes: 100 });
19
19
  const label = shortDescription({ text: (candidate.displayName ?? candidate.pluginId).slice(0, 1024).replace(/\s+/g, ' ').trim() }, { maxBytes: 80 });
20
- return { ...candidate, id: candidate.id ?? candidate.pluginId, enabled: false,
21
- description: `installed, off: ${label}: ${purpose} — read guidance; tools unavailable` };
20
+ // A Soon plugin is locked off, so it is described as coming soon: "installed, off" invites an enable offer.
21
+ const description = candidate.maturity === 'soon'
22
+ ? `coming soon: ${label}: ${purpose} — not ready yet; it cannot be turned on`
23
+ : `installed, off: ${label}: ${purpose} — read guidance; tools unavailable`;
24
+ return { ...candidate, id: candidate.id ?? candidate.pluginId, enabled: false, description };
22
25
  }
23
26
  /** Project one candidate without copying skills, keywords, credentials or host metadata. O(1). */
24
27
  function discoveryMatch({ candidate }, _options = {}) {
25
28
  if (!candidate.enabled) {
26
29
  const visible = agentVisiblePluginCandidate({ candidate });
27
- return { id: visible.id ?? visible.pluginId, pluginId: visible.pluginId, enabled: false, description: visible.description ?? '' };
30
+ return { id: visible.id ?? visible.pluginId, pluginId: visible.pluginId, enabled: false,
31
+ ...(candidate.maturity === 'soon' ? { maturity: 'soon' } : {}), description: visible.description ?? '' };
28
32
  }
29
33
  return { id: candidate.id ?? candidate.pluginId, pluginId: candidate.pluginId, enabled: candidate.enabled,
30
34
  ...(candidate.maturity ? { maturity: candidate.maturity } : {}),
@@ -75,6 +75,7 @@ export interface AgentPluginSearchCandidate {
75
75
  readonly id?: string | undefined;
76
76
  readonly provides?: readonly string[] | undefined;
77
77
  readonly requires?: readonly string[] | undefined;
78
+ readonly companions?: readonly string[] | undefined;
78
79
  /** Whether this workspace currently has the plugin enabled — reflects `activation.ts`'s
79
80
  * absent-means-active default, same as everywhere else this codebase reads activation state. */
80
81
  readonly enabled: boolean;
@@ -1,7 +1,87 @@
1
+ /**
2
+ * @file `seedBundledAgentPlugins()` — installs the Agent Plugins that ship WITH the host into a
3
+ * workspace's own package store, and records each one INACTIVE until an operator says otherwise
4
+ * (except the few core paths depend on, `BUNDLED_AGENT_PLUGINS_SEEDED_ENABLED`, which seed active).
5
+ *
6
+ * ---------------------------------------------------------------------------
7
+ * "Bundled but inactive", concretely
8
+ * ---------------------------------------------------------------------------
9
+ * Bundled: the package's real files are tracked in this repository under `content/agent-plugins/<id>/`
10
+ * and copied into `dist/` by `npm run build`, exactly like `content/themes/`. A fresh install has them
11
+ * without downloading anything.
12
+ *
13
+ * Inactive: seeding writes `{ enabled: false, origin: "bundled" }` into the workspace's activation
14
+ * record (`activation.ts`) BEFORE the package can be read by anything, and the two places that
15
+ * consume installed plugins both consult that record:
16
+ *
17
+ * - `tool-registrations.ts` — will not register its `agent_plugin_<id>` tool;
18
+ * - `resolve-agent-plugin-refs.ts` — refuses to inject it even if a composer chip pins it by id.
19
+ *
20
+ * (A third surface, `capability-source.ts`'s `capability_search` discovery, was gated here too
21
+ * until that tool pair was removed 2026-08-26 — see
22
+ * `ADS-memory/knowledge/2026-08-26-removed-capability-search.md`.)
23
+ *
24
+ * So "inactive" means genuinely unexecutable, not merely unadvertised: its skills never reach a
25
+ * prompt, and its tools and MCP servers are never registered.
26
+ *
27
+ * It does NOT mean hidden from the operator. The admin Agent Plugins screen lists every installed
28
+ * plugin, with an inactive one's switch shown off, so a bundled plugin can be found and turned on
29
+ * there (owner decision, 2026-09-13; before it, that screen's default tab listed only active ones).
30
+ * Listing only READS the activation record, so the "absent means active" hazard described below is
31
+ * unaffected.
32
+ *
33
+ * ---------------------------------------------------------------------------
34
+ * Why it runs on every boot
35
+ * ---------------------------------------------------------------------------
36
+ * Seeding is idempotent twice over: `installAgentPlugin` short-circuits when the content digest is
37
+ * already published, and `recordBundledAgentPluginIfAbsent` never overwrites an existing decision.
38
+ * Re-running it therefore costs one directory walk and one hash, and buys two things a one-shot
39
+ * first-run seed would not:
40
+ *
41
+ * 1. A product upgrade that ships a NEW bundled plugin, or a NEW VERSION of one, reaches existing
42
+ * workspaces without a migration step.
43
+ *
44
+ * The second half of that claim was FALSE IN EFFECT until 2026-09-18, and the correction is the
45
+ * reason `bundled-digests.ts` exists. The package store is content-addressed and nothing retires
46
+ * an entry, so a revised bundled plugin installs ALONGSIDE its predecessor rather than replacing
47
+ * it — after which both consumption surfaces refused the plugin outright as ambiguous
48
+ * (`resolve-agent-plugin-refs.ts`'s "refusing to guess which one to use",
49
+ * `tool-registrations.ts`'s `poisonedPluginIds`). An upgrade did reach the workspace; it also
50
+ * silently broke the plugin. What makes the claim true now is the ledger this function writes
51
+ * below: the seed RECORDS which digest this build published, so the read side has the build's own
52
+ * answer to "which one" instead of a guess. The superseded bytes stay on disk — see
53
+ * `bundled-digests.ts`'s header for why nothing is deleted, and this file's own report for what
54
+ * an operator still has to prune by hand.
55
+ * 2. Deleting `activations.json` re-creates the bundled plugin's DISABLED record. Without the
56
+ * re-run, deleting that file would silently promote every bundled plugin to active, because
57
+ * `isAgentPluginActive`'s "absent means active" default is what keeps operator-installed plugins
58
+ * working. The boot-time re-seed is what closes that direction.
59
+ *
60
+ * A file that is PRESENT but unreadable is a different case from a deleted one, and is not
61
+ * treated the same way (t91 F1.1, 2026-09-16): seeding refuses outright rather than install
62
+ * around the fault, and every bundled plugin comes back `failed` with the recovery text
63
+ * `activation.ts`'s `AgentPluginActivationsUnreadableError` gives — see this file's header,
64
+ * "Failure isolation" below, and `activation.ts`'s own header, "Writers never rewrite what they
65
+ * could not read".
66
+ *
67
+ * ---------------------------------------------------------------------------
68
+ * Failure isolation
69
+ * ---------------------------------------------------------------------------
70
+ * One unusable bundled package must never stop a workspace from booting or hide the others. Each is
71
+ * seeded independently and its failure is captured into the returned report, not thrown. The caller
72
+ * decides whether to log it; nothing here writes to the console, so this stays a pure-ish function
73
+ * a test can assert on directly.
74
+ *
75
+ * Architectural role:
76
+ * Composition over `bundled-source-archive.ts` (directory to archive), `install.ts`
77
+ * (`installAgentPlugin`, where every extraction guarantee lives), and `activation.ts` (the record).
78
+ * No guarantee of its own.
79
+ */
80
+ import type { WorkspaceMigrationOwnership } from '../../core/persistent-state.js';
1
81
  import type { PackAgentPluginDirectoryOptional } from "./bundled-source-archive.js";
2
- import type { AgentPluginLayout } from "./layout.js";
3
82
  import type { RetiredAgentPluginOutcome } from "./retire-bundled.js";
4
83
  import type { AgentPluginLifecyclePorts } from "./ports.js";
84
+ import type { AgentPluginLayout } from "@jini-ai/core/contracts/site/agent-plugins-lifecycle";
5
85
  export type SeededAgentPluginOutcome = {
6
86
  readonly pluginId: string;
7
87
  readonly status: "seeded";
@@ -22,6 +102,11 @@ export type PackingForSource = (required: {
22
102
  }, optional?: Record<string, never>) => PackAgentPluginDirectoryOptional | Promise<PackAgentPluginDirectoryOptional>;
23
103
  export interface SeedBundledAgentPluginsOptional {
24
104
  readonly packing?: PackAgentPluginDirectoryOptional | PackingForSource;
105
+ /** The caller holds this workspace's migration lock; the nested migration runs under it. */
106
+ readonly ownership?: WorkspaceMigrationOwnership;
107
+ /** Bundled ids a maintenance step refused to clear (id -> plain-words reason). Each is reported
108
+ * failed with that reason and never reaches install, so no alternate path can admit it. */
109
+ readonly heldPluginIds?: ReadonlyMap<string, string>;
25
110
  }
26
111
  export interface SeedBundledAgentPluginsResult {
27
112
  /** Directory holding one subdirectory per bundled plugin. `deps.ts`'s `bundledAgentPluginsDir()`
@@ -1,85 +1,7 @@
1
- /**
2
- * @file `seedBundledAgentPlugins()` — installs the Agent Plugins that ship WITH the host into a
3
- * workspace's own package store, and records each one INACTIVE until an operator says otherwise
4
- * (except the few core paths depend on, `BUNDLED_AGENT_PLUGINS_SEEDED_ENABLED`, which seed active).
5
- *
6
- * ---------------------------------------------------------------------------
7
- * "Bundled but inactive", concretely
8
- * ---------------------------------------------------------------------------
9
- * Bundled: the package's real files are tracked in this repository under `content/agent-plugins/<id>/`
10
- * and copied into `dist/` by `npm run build`, exactly like `content/themes/`. A fresh install has them
11
- * without downloading anything.
12
- *
13
- * Inactive: seeding writes `{ enabled: false, origin: "bundled" }` into the workspace's activation
14
- * record (`activation.ts`) BEFORE the package can be read by anything, and the two places that
15
- * consume installed plugins both consult that record:
16
- *
17
- * - `tool-registrations.ts` — will not register its `agent_plugin_<id>` tool;
18
- * - `resolve-agent-plugin-refs.ts` — refuses to inject it even if a composer chip pins it by id.
19
- *
20
- * (A third surface, `capability-source.ts`'s `capability_search` discovery, was gated here too
21
- * until that tool pair was removed 2026-08-26 — see
22
- * `ADS-memory/knowledge/2026-08-26-removed-capability-search.md`.)
23
- *
24
- * So "inactive" means genuinely unexecutable, not merely unadvertised: its skills never reach a
25
- * prompt, and its tools and MCP servers are never registered.
26
- *
27
- * It does NOT mean hidden from the operator. The admin Agent Plugins screen lists every installed
28
- * plugin, with an inactive one's switch shown off, so a bundled plugin can be found and turned on
29
- * there (owner decision, 2026-09-13; before it, that screen's default tab listed only active ones).
30
- * Listing only READS the activation record, so the "absent means active" hazard described below is
31
- * unaffected.
32
- *
33
- * ---------------------------------------------------------------------------
34
- * Why it runs on every boot
35
- * ---------------------------------------------------------------------------
36
- * Seeding is idempotent twice over: `installAgentPlugin` short-circuits when the content digest is
37
- * already published, and `recordBundledAgentPluginIfAbsent` never overwrites an existing decision.
38
- * Re-running it therefore costs one directory walk and one hash, and buys two things a one-shot
39
- * first-run seed would not:
40
- *
41
- * 1. A product upgrade that ships a NEW bundled plugin, or a NEW VERSION of one, reaches existing
42
- * workspaces without a migration step.
43
- *
44
- * The second half of that claim was FALSE IN EFFECT until 2026-09-18, and the correction is the
45
- * reason `bundled-digests.ts` exists. The package store is content-addressed and nothing retires
46
- * an entry, so a revised bundled plugin installs ALONGSIDE its predecessor rather than replacing
47
- * it — after which both consumption surfaces refused the plugin outright as ambiguous
48
- * (`resolve-agent-plugin-refs.ts`'s "refusing to guess which one to use",
49
- * `tool-registrations.ts`'s `poisonedPluginIds`). An upgrade did reach the workspace; it also
50
- * silently broke the plugin. What makes the claim true now is the ledger this function writes
51
- * below: the seed RECORDS which digest this build published, so the read side has the build's own
52
- * answer to "which one" instead of a guess. The superseded bytes stay on disk — see
53
- * `bundled-digests.ts`'s header for why nothing is deleted, and this file's own report for what
54
- * an operator still has to prune by hand.
55
- * 2. Deleting `activations.json` re-creates the bundled plugin's DISABLED record. Without the
56
- * re-run, deleting that file would silently promote every bundled plugin to active, because
57
- * `isAgentPluginActive`'s "absent means active" default is what keeps operator-installed plugins
58
- * working. The boot-time re-seed is what closes that direction.
59
- *
60
- * A file that is PRESENT but unreadable is a different case from a deleted one, and is not
61
- * treated the same way (t91 F1.1, 2026-09-16): seeding refuses outright rather than install
62
- * around the fault, and every bundled plugin comes back `failed` with the recovery text
63
- * `activation.ts`'s `AgentPluginActivationsUnreadableError` gives — see this file's header,
64
- * "Failure isolation" below, and `activation.ts`'s own header, "Writers never rewrite what they
65
- * could not read".
66
- *
67
- * ---------------------------------------------------------------------------
68
- * Failure isolation
69
- * ---------------------------------------------------------------------------
70
- * One unusable bundled package must never stop a workspace from booting or hide the others. Each is
71
- * seeded independently and its failure is captured into the returned report, not thrown. The caller
72
- * decides whether to log it; nothing here writes to the console, so this stays a pure-ish function
73
- * a test can assert on directly.
74
- *
75
- * Architectural role:
76
- * Composition over `bundled-source-archive.ts` (directory to archive), `install.ts`
77
- * (`installAgentPlugin`, where every extraction guarantee lives), and `activation.ts` (the record).
78
- * No guarantee of its own.
79
- */
80
1
  import { createPersistentStateModule } from "./persistent-state.js";
81
2
  import path from "node:path";
82
3
  import { describeErrorForLog } from "@jini-ai/core";
4
+ import { AgentPluginInstallError } from "../core/install-errors.js";
83
5
  import { createActivationModule } from "./activation.js";
84
6
  import { createBundledDigestsModule } from "./bundled-digests.js";
85
7
  import { createBundledSourceArchiveModule } from "./bundled-source-archive.js";
@@ -110,18 +32,27 @@ import { createRetireBundledModule } from "./retire-bundled.js";
110
32
  // its ledger entry exist by now, and the retirement only has to decide whether to switch it on.
111
33
  // A successor whose seed FAILED has neither; `retire-bundled.ts` then keeps the retired plugin
112
34
  // rather than remove it in favour of a switch with no code behind it (its header, step 1a).
35
+ /**
36
+ * Runs the layout migration that must precede seeding: the host's hook when it supplies one, else
37
+ * the default persistent-state migration. A caller already holding the workspace migration lock
38
+ * passes its ownership so the nested migration runs under it instead of reacquiring the lock.
39
+ * @complexity O(1) here; the migration itself is O(installed plugins).
40
+ */
41
+ function migrateBeforeSeeding({ ports, layout, workspaceId }, held = {}) {
42
+ return ports.migrateBeforeSeed
43
+ ? ports.migrateBeforeSeed({ layout, workspaceId }, held)
44
+ : createPersistentStateModule(ports).migrate({ workspaceRoot: layout.forWorkspace({ workspaceId }).root }, held);
45
+ }
113
46
  async function seedBundledAgentPlugins({ ports, required }, optional = {}) {
114
47
  const { layout, workspaceId, sourceRoot } = required;
115
48
  const pluginDirNames = await listBundledPluginDirs({ ports, sourceRoot });
116
49
  try {
117
- const migration = ports.migrateBeforeSeed
118
- ? await ports.migrateBeforeSeed({ layout, workspaceId }, {})
119
- : await createPersistentStateModule(ports).migrate({ workspaceRoot: layout.forWorkspace({ workspaceId }).root });
50
+ const migration = await migrateBeforeSeeding({ ports, layout, workspaceId }, optional.ownership ? { ownership: optional.ownership } : {});
120
51
  if (!migration.complete)
121
52
  throw new Error('Legacy plugin layout migration has unfinished filesystem moves; see boot log');
122
53
  }
123
54
  catch (error) {
124
- const reason = describeErrorForLog({ err: error });
55
+ const reason = describeSeedFailure({ err: error });
125
56
  return { sourceRoot, outcomes: pluginDirNames.map(pluginId => ({ pluginId, status: 'failed', reason })), retirements: [] };
126
57
  }
127
58
  const refusal = await activationsRefusal({ ports, layout, workspaceId });
@@ -134,6 +65,11 @@ async function seedBundledAgentPlugins({ ports, required }, optional = {}) {
134
65
  }
135
66
  const outcomes = [];
136
67
  for (const dirName of pluginDirNames) {
68
+ const heldReason = optional.heldPluginIds?.get(dirName);
69
+ if (heldReason !== undefined) {
70
+ outcomes.push({ pluginId: dirName, status: "failed", reason: heldReason });
71
+ continue;
72
+ }
137
73
  outcomes.push(await seedOne({
138
74
  ports,
139
75
  args: { layout, workspaceId, sourceDir: path.join(sourceRoot, dirName), dirName },
@@ -204,10 +140,38 @@ async function seedOne({ ports, args }, { optional = {} } = {}) {
204
140
  return {
205
141
  pluginId: args.dirName,
206
142
  status: "failed",
207
- reason: describeErrorForLog({ err: error }),
143
+ reason: describeSeedFailure({ err: error }),
208
144
  };
209
145
  }
210
146
  }
147
+ /** Safe, fixed boot-log copy per install error code. `AgentPluginInstallError.message` is written for
148
+ * the installing caller and can embed a local path (`PUBLISH_FAILED` names the publish target), so the
149
+ * log carries this copy instead; `Record` makes a newly added code a compile error until it has copy. */
150
+ const SAFE_INSTALL_FAILURE_COPY = {
151
+ PLUGIN_ID_CONFLICT: "The plugin id is already installed from different contents.",
152
+ ARCHIVE_TOO_LARGE: "The plugin archive is too large.",
153
+ DIGEST_MISMATCH: "The plugin archive does not match its expected digest.",
154
+ TOO_MANY_ENTRIES: "The plugin archive has too many entries.",
155
+ UNSAFE_ENTRY_PATH: "The plugin archive has an unsafe entry path.",
156
+ SYMLINK_ENTRY_REJECTED: "The plugin archive contains a symbolic link.",
157
+ UNSUPPORTED_ENTRY_KIND: "The plugin archive contains an unsupported entry.",
158
+ DUPLICATE_ENTRY: "The plugin archive has a duplicate entry.",
159
+ FILE_TOO_LARGE: "The plugin archive has a file that is too large.",
160
+ DECOMPRESSION_BOMB: "The plugin archive expands beyond its safe limit.",
161
+ TOTAL_SIZE_EXCEEDED: "The plugin archive expands beyond its total size limit.",
162
+ MANIFEST_MISSING: "The plugin manifest is missing.",
163
+ MANIFEST_INVALID: "The plugin manifest is invalid.",
164
+ PUBLISH_FAILED: "The plugin package could not be published.",
165
+ };
166
+ /** The reason a bundled plugin failed to seed, for the boot log. An install error logs its code with
167
+ * fixed safe copy for that code (never its message, which can carry a local path); the core describer
168
+ * has no vocabulary for this class and would print a bare "Error". Everything else keeps the core
169
+ * describer's class-only line. @complexity O(1). */
170
+ function describeSeedFailure({ err }, _optional = {}) {
171
+ if (err instanceof AgentPluginInstallError)
172
+ return `${err.code}: ${SAFE_INSTALL_FAILURE_COPY[err.code] ?? "The plugin could not be installed."}`;
173
+ return describeErrorForLog({ err });
174
+ }
211
175
  /**
212
176
  * Lists the subdirectories of `sourceRoot` that actually look like Agent Plugin packages (they hold
213
177
  * a `plugin.json` at their own root, which is where `indexInstalledRoot` looks for it).
@@ -1,4 +1,5 @@
1
1
  import type { AgentPluginLifecyclePorts } from "./ports.js";
2
+ import type { SetAgentPluginEnabledInput, SetAgentPluginEnabledResult } from "@jini-ai/core/contracts/site/agent-plugins-lifecycle";
2
3
  /**
3
4
  * The id named is not installed in this workspace. A distinct class rather than a bare `Error` so
4
5
  * each caller can map it to its own boundary's vocabulary — 404 `AGENT_PLUGIN_NOT_FOUND` at the
@@ -9,19 +10,6 @@ export declare class AgentPluginNotInstalledError extends Error {
9
10
  readonly pluginId: string;
10
11
  });
11
12
  }
12
- export interface SetAgentPluginEnabledInput {
13
- readonly workspaceId: string;
14
- readonly pluginId: string;
15
- readonly enabled: boolean;
16
- /** Recorded as the activation record's updatedBy. The authenticated principal, never a constant. */
17
- readonly actor: string;
18
- }
19
- export interface SetAgentPluginEnabledResult {
20
- readonly pluginId: string;
21
- /** As actually written and read back, not as requested. */
22
- readonly enabled: boolean;
23
- readonly warnings?: readonly string[];
24
- }
25
13
  /** Internal composition; one state/queue instance per injected host context. */
26
14
  export declare function createSetEnabledModule(ports: AgentPluginLifecyclePorts, _optional?: Record<string, never>): {
27
15
  setAgentPluginEnabled: (input: SetAgentPluginEnabledInput, optional?: {
@@ -1,6 +1,7 @@
1
1
  /** Extracted from the host plugin lifecycle. Effects are supplied per host context. */
2
2
  import { createPersistentStateModule } from './persistent-state.js';
3
- import { AgentPluginHostIncompatibleError, describeAgentPluginCompatibility, agentPluginDependentWarnings } from './compatibility.js';
3
+ import { describeAgentPluginCompatibility, agentPluginDependentWarnings } from './compatibility.js';
4
+ import { AgentPluginHostIncompatibleError } from '../core/host-incompatible-error.js';
4
5
  import { createActivationModule } from "./activation.js";
5
6
  import { createResolveAgentPluginRefsModule } from "./resolve-agent-plugin-refs.js";
6
7
  import { createAgentPluginUpdateStore, settleAgentPluginUpdateJournal } from "./update-store.js";
@@ -15,6 +16,14 @@ export class AgentPluginNotInstalledError extends Error {
15
16
  this.name = "AgentPluginNotInstalledError";
16
17
  }
17
18
  }
19
+ function notifyActivationChange({ ports, input, previous, enabled }) {
20
+ if ((previous.verdict === "active") !== enabled) {
21
+ try {
22
+ ports.onActivationChanged?.({ pluginId: input.pluginId, workspaceId: input.workspaceId, enabled, actor: input.actor }, {});
23
+ }
24
+ catch { /* An optional observer cannot undo the committed activation. */ }
25
+ }
26
+ }
18
27
  function buildModule(ports) {
19
28
  const { setAgentPluginActivation, readAgentPluginActivations, resolveAgentPluginActivation, enableBundledAgentPluginUnlessOperatorDisabled, isAgentPluginDisabledByOperator } = createActivationModule(ports);
20
29
  const { listInstalledPlugins } = createResolveAgentPluginRefsModule(ports);
@@ -69,12 +78,7 @@ function buildModule(ports) {
69
78
  // writes a boolean `enabled`, so the record it returns holds this entry (the former
70
79
  // `?? input.enabled` fallback was unreachable).
71
80
  const enabled = await writeDecision({ input, workspaceRoot, unlessOperatorDisabled, previous });
72
- if ((previous.verdict === "active") !== enabled) {
73
- try {
74
- ports.onActivationChanged?.({ pluginId: input.pluginId, workspaceId: input.workspaceId, enabled, actor: input.actor }, {});
75
- }
76
- catch { /* An optional observer cannot undo the committed activation. */ }
77
- }
81
+ notifyActivationChange({ ports, input, previous, enabled });
78
82
  return { pluginId: input.pluginId, enabled, ...(warnings.length ? { warnings } : {}) };
79
83
  }
80
84
  /**
@@ -58,10 +58,10 @@ export type TrustedPluginVerdict = {
58
58
  };
59
59
  /** Internal composition; one state/queue instance per injected host context. */
60
60
  export declare function createTrustedPluginFilesModule(ports: AgentPluginLifecyclePorts, _optional?: Record<string, never>): {
61
- findTrustedPluginPackages: (query: TrustedPluginPackagesQuery) => Promise<readonly TrustedPluginVerdict[]>;
62
61
  readTrustedPluginFile: (plugin: TrustedPluginPackage, filename: string) => Promise<string>;
63
62
  importContainedModule: (plugin: TrustedPluginPackage, modulePath: string) => Promise<{
64
63
  readonly exported: unknown;
65
64
  } | string>;
65
+ findTrustedPluginPackages: (query: TrustedPluginPackagesQuery) => Promise<readonly TrustedPluginVerdict[]>;
66
66
  };
67
67
  //# sourceMappingURL=trusted-plugin-files.d.ts.map
@@ -6,6 +6,38 @@ import { createBundledDigestsModule } from "./bundled-digests.js";
6
6
  import { PackagePathViolation } from "./package-paths.js";
7
7
  import { createPackagePathsModule } from "./package-paths.js";
8
8
  import { createResolveAgentPluginRefsModule } from "./resolve-agent-plugin-refs.js";
9
+ function createTrustedPluginReaders({ assertContainedOnDisk, readFile }) {
10
+ /** Reads one file at a trusted package's root as UTF-8. @complexity O(n) in the file size. */
11
+ async function readTrustedPluginFile(plugin, filename) {
12
+ const absolute = await assertContainedOnDisk(plugin.packageRoot, filename);
13
+ return readFile(absolute, "utf8");
14
+ }
15
+ /**
16
+ * Imports one module from a trusted package after the containment check. Returns the module's
17
+ * default export, or the refusal reason. The caller validates the export's shape.
18
+ *
19
+ * @complexity One `realpath` walk plus one dynamic import (cached by Node per file URL).
20
+ */
21
+ async function importContainedModule(plugin, modulePath) {
22
+ let resolved;
23
+ try {
24
+ resolved = await assertContainedOnDisk(plugin.packageRoot, modulePath);
25
+ }
26
+ catch (error) {
27
+ if (error instanceof PackagePathViolation)
28
+ return `module path '${modulePath}' escapes the plugin root`;
29
+ throw error;
30
+ }
31
+ try {
32
+ const imported = (await import(pathToFileURL(resolved).href));
33
+ return { exported: imported.default };
34
+ }
35
+ catch (error) {
36
+ return error instanceof Error ? error.message : String(error);
37
+ }
38
+ }
39
+ return { readTrustedPluginFile, importContainedModule };
40
+ }
9
41
  function buildModule(ports) {
10
42
  const readFile = ports.filesystem.readFile.bind(ports.filesystem);
11
43
  const { resolveAgentPluginActivation } = createActivationModule(ports);
@@ -56,36 +88,7 @@ function buildModule(ports) {
56
88
  }
57
89
  return null;
58
90
  }
59
- /** Reads one file at a trusted package's root as UTF-8. @complexity O(n) in the file size. */
60
- async function readTrustedPluginFile(plugin, filename) {
61
- const absolute = await assertContainedOnDisk(plugin.packageRoot, filename);
62
- return readFile(absolute, "utf8");
63
- }
64
- /**
65
- * Imports one module from a trusted package after the containment check. Returns the module's
66
- * default export, or the refusal reason. The caller validates the export's shape.
67
- *
68
- * @complexity One `realpath` walk plus one dynamic import (cached by Node per file URL).
69
- */
70
- async function importContainedModule(plugin, modulePath) {
71
- let resolved;
72
- try {
73
- resolved = await assertContainedOnDisk(plugin.packageRoot, modulePath);
74
- }
75
- catch (error) {
76
- if (error instanceof PackagePathViolation)
77
- return `module path '${modulePath}' escapes the plugin root`;
78
- throw error;
79
- }
80
- try {
81
- const imported = (await import(pathToFileURL(resolved).href));
82
- return { exported: imported.default };
83
- }
84
- catch (error) {
85
- return error instanceof Error ? error.message : String(error);
86
- }
87
- }
88
- return { findTrustedPluginPackages, readTrustedPluginFile, importContainedModule };
91
+ return { findTrustedPluginPackages, ...createTrustedPluginReaders({ assertContainedOnDisk, readFile }) };
89
92
  }
90
93
  const instances = new WeakMap();
91
94
  /** Internal composition; one state/queue instance per injected host context. */
@@ -1,37 +1,16 @@
1
- import type { PluginManifestAuthor } from "../manifest.js";
2
- import type { AgentPluginExportMetadata } from './exports.js';
3
1
  /** Lifecycle value contracts shared by host ports and implementations. */
2
+ /**
3
+ * How a pinned ref's content reaches the agent.
4
+ *
5
+ * - `inject` — the whole eponymous SKILL.md (~15KB for `ui-ux-design`) plus its readable supporting-file inventory
6
+ * listed relative to the skill folder, in the run's prompt prefix. Today's shipped behaviour, and the default.
7
+ * - `pointer` — ~400 bytes naming the exact tool call that returns that SAME SKILL.md, and nothing
8
+ * else. The content is identical; only the delivery differs, which is what makes the two a
9
+ * controlled comparison rather than two different experiments.
10
+ *
11
+ * Selected per-process by the host-supplied `deliveryMode` port. This is a MEASUREMENT AFFORDANCE, not a
12
+ * migration flag: pointer and inject must coexist to compare delivery of identical content.
13
+ * Selecting an unconditional mode requires the measurement result.
14
+ */
4
15
  export type AgentPluginDeliveryMode = "inject" | "pointer";
5
- export interface InstalledAgentPluginSkill {
6
- readonly name: string;
7
- readonly skillPath: string;
8
- }
9
- export interface InstalledAgentPlugin extends AgentPluginExportMetadata {
10
- readonly id?: string | undefined;
11
- readonly provides?: readonly string[] | undefined;
12
- readonly requires?: readonly string[] | undefined;
13
- readonly hostRange?: string | undefined;
14
- readonly pluginId: string;
15
- readonly version?: (string) | undefined;
16
- /** the host extension namespace in `plugin.json`: `displayName` — the human-facing title when the id alone reads
17
- * wrong ("deploy" shows as "Deploy Online"). Lives under the spec's host-extension namespace, not
18
- * a top-level field, because the spec has no title field and `name` is the stable id that
19
- * activations, tool ids and ledgers key on — renaming it would churn all of those. Absent means
20
- * callers title-case the id. */
21
- readonly displayName?: string | undefined;
22
- /** the host extension namespace in `plugin.json`: `summary` — a short plain-language explainer for the site owner,
23
- * shown in the admin in place of the spec `description`. That `description` stays the
24
- * agent-facing text (search ranks it and returns it to the model), so it can stay dense and
25
- * technical; this field is never ranked and never reaches the model. Blank lines separate
26
- * paragraphs. Absent means the admin shows the description. */
27
- readonly summary?: string | undefined;
28
- readonly description?: (string) | undefined;
29
- readonly keywords?: (readonly string[]) | undefined;
30
- readonly author?: string | PluginManifestAuthor | undefined;
31
- readonly license?: (string) | undefined;
32
- readonly archiveDigest: string;
33
- readonly packageRoot: string;
34
- readonly files: readonly string[];
35
- readonly skills: readonly InstalledAgentPluginSkill[];
36
- }
37
16
  //# sourceMappingURL=types.d.ts.map