@jini-ai/agent-plugins 0.7.3-next.1 → 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 (233) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/README.md +22 -4
  3. package/calendly/README.md +29 -0
  4. package/calendly/mcp.json +1 -1
  5. package/cloudflare/lib/assets.mjs +1 -1
  6. package/cloudflare/lib/cms-forms.mjs +1 -1
  7. package/core/persistent-state.d.ts +4 -1
  8. package/core/persistent-state.js +55 -21
  9. package/dist/admin-surfaces/callback-field-inbox.d.ts +1 -6
  10. package/dist/admin-surfaces/connections/connections.d.ts +2 -6
  11. package/dist/admin-surfaces/connections/index.d.ts +3 -2
  12. package/dist/admin-surfaces/index.d.ts +3 -1
  13. package/dist/connect/access-token-tool.d.ts +1 -1
  14. package/dist/connect/access-token-tool.js +1 -1
  15. package/dist/connect/catalog.d.ts +26 -0
  16. package/dist/connect/catalog.js +42 -0
  17. package/dist/connect/connect-tool.d.ts +2 -294
  18. package/dist/connect/connect-tool.js +2 -53
  19. package/dist/connect/contracts.d.ts +257 -0
  20. package/dist/connect/contracts.js +2 -0
  21. package/dist/connect/credential-cards.d.ts +2 -0
  22. package/dist/connect/credential-cards.js +7 -4
  23. package/dist/connect/grant-signed-in-defaults.js +1 -1
  24. package/dist/connect/host-deps.d.ts +32 -0
  25. package/dist/connect/host-deps.js +35 -0
  26. package/dist/connect/import-access-token.js +1 -1
  27. package/dist/connect/index.d.ts +7 -2
  28. package/dist/connect/index.js +5 -2
  29. package/dist/connect/installed-plugin.d.ts +28 -0
  30. package/dist/connect/installed-plugin.js +19 -0
  31. package/dist/connect/new-site-agent-plugin-tokens.d.ts +88 -0
  32. package/dist/connect/new-site-agent-plugin-tokens.js +107 -0
  33. package/dist/connect/plugin-host/index.d.ts +2 -2
  34. package/dist/connect/plugin-host/index.js +19 -10
  35. package/dist/connect/token-sign-in.d.ts +1 -14
  36. package/dist/connect/token-sign-in.js +4 -23
  37. package/dist/core/export-props.d.ts +10 -0
  38. package/dist/core/export-props.js +31 -0
  39. package/dist/core/folder-zip-error.d.ts +5 -0
  40. package/dist/core/folder-zip-error.js +8 -0
  41. package/dist/core/host-incompatible-error.d.ts +8 -0
  42. package/dist/core/host-incompatible-error.js +9 -0
  43. package/dist/core/identity-namespace.d.ts +27 -16
  44. package/dist/core/identity-namespace.js +25 -22
  45. package/dist/core/plugin-display-name.d.ts +7 -0
  46. package/dist/core/plugin-display-name.js +11 -0
  47. package/dist/core/provider-plugin-link.d.ts +7 -0
  48. package/dist/core/provider-plugin-link.js +5 -0
  49. package/dist/{connect → core}/token-map.d.ts +11 -1
  50. package/dist/{connect → core}/token-map.js +15 -0
  51. package/dist/core/token-sign-in-list.d.ts +18 -0
  52. package/dist/core/token-sign-in-list.js +23 -0
  53. package/dist/core/update-error.d.ts +8 -0
  54. package/dist/core/update-error.js +9 -0
  55. package/dist/{lifecycle → core}/update-plan.d.ts +1 -1
  56. package/dist/ffmpeg-transcode/adapter.d.ts +74 -0
  57. package/dist/ffmpeg-transcode/adapter.js +155 -0
  58. package/dist/folder-zip-node.d.ts +2 -1
  59. package/dist/folder-zip-node.js +6 -5
  60. package/dist/folder-zip.d.ts +0 -4
  61. package/dist/folder-zip.js +1 -7
  62. package/dist/index.d.ts +3 -1
  63. package/dist/lifecycle/activation.d.ts +39 -3
  64. package/dist/lifecycle/activation.js +467 -418
  65. package/dist/lifecycle/automatic-use-offer.d.ts +62 -0
  66. package/dist/lifecycle/automatic-use-offer.js +52 -0
  67. package/dist/lifecycle/automatic-use.d.ts +33 -1
  68. package/dist/lifecycle/automatic-use.js +157 -38
  69. package/dist/lifecycle/bundled-source-archive.d.ts +1 -1
  70. package/dist/lifecycle/capability-projection.d.ts +0 -1
  71. package/dist/lifecycle/capability-projection.js +92 -23
  72. package/dist/lifecycle/compatibility-metadata.d.ts +1 -0
  73. package/dist/lifecycle/compatibility-metadata.js +6 -1
  74. package/dist/lifecycle/compatibility.d.ts +1 -8
  75. package/dist/lifecycle/compatibility.js +1 -8
  76. package/dist/lifecycle/credential-card-metadata.d.ts +2 -2
  77. package/dist/lifecycle/exports.d.ts +2 -45
  78. package/dist/lifecycle/exports.js +1 -30
  79. package/dist/lifecycle/host-tools/identity.d.ts +5 -4
  80. package/dist/lifecycle/host-tools/identity.js +5 -5
  81. package/dist/lifecycle/host-tools/ports.d.ts +10 -1
  82. package/dist/lifecycle/host-tools/search-tool.d.ts +4 -2
  83. package/dist/lifecycle/host-tools/search-tool.js +19 -8
  84. package/dist/lifecycle/host-tools/skill-tool.js +1 -1
  85. package/dist/lifecycle/index.d.ts +20 -17
  86. package/dist/lifecycle/index.js +5 -4
  87. package/dist/lifecycle/install-from-url.d.ts +1 -2
  88. package/dist/lifecycle/install.d.ts +4 -34
  89. package/dist/lifecycle/install.js +3 -3
  90. package/dist/lifecycle/installed-package-index.d.ts +1 -1
  91. package/dist/lifecycle/installed-package-index.js +4 -4
  92. package/dist/lifecycle/layout.d.ts +21 -25
  93. package/dist/lifecycle/layout.js +79 -0
  94. package/dist/lifecycle/manifest.d.ts +10 -7
  95. package/dist/lifecycle/manifest.js +20 -15
  96. package/dist/lifecycle/mcp-provisioning.d.ts +1 -1
  97. package/dist/lifecycle/metadata.d.ts +6 -3
  98. package/dist/lifecycle/metadata.js +2 -1
  99. package/dist/lifecycle/package-paths.js +59 -56
  100. package/dist/lifecycle/persistent-state.d.ts +10 -1
  101. package/dist/lifecycle/persistent-state.js +4 -2
  102. package/dist/lifecycle/ports.d.ts +18 -6
  103. package/dist/lifecycle/resolve-agent-plugin-refs.d.ts +2 -14
  104. package/dist/lifecycle/retire-bundled.d.ts +1 -1
  105. package/dist/lifecycle/search-projection.d.ts +3 -1
  106. package/dist/lifecycle/search-projection.js +7 -3
  107. package/dist/lifecycle/search.d.ts +1 -0
  108. package/dist/lifecycle/seed-bundled.d.ts +86 -1
  109. package/dist/lifecycle/seed-bundled.js +48 -84
  110. package/dist/lifecycle/set-enabled.d.ts +1 -13
  111. package/dist/lifecycle/set-enabled.js +11 -7
  112. package/dist/lifecycle/trusted-plugin-files.d.ts +1 -1
  113. package/dist/lifecycle/trusted-plugin-files.js +33 -30
  114. package/dist/lifecycle/types.d.ts +13 -34
  115. package/dist/lifecycle/uninstall.d.ts +1 -33
  116. package/dist/lifecycle/update-store.d.ts +0 -7
  117. package/dist/lifecycle/update-store.js +1 -8
  118. package/dist/lifecycle/update.d.ts +1 -1
  119. package/dist/lifecycle/update.js +60 -10
  120. package/dist/lifecycle/yauzl-archive-reader.d.ts +7 -2
  121. package/dist/lifecycle/yauzl-archive-reader.js +11 -6
  122. package/dist/manifest.d.ts +4 -8
  123. package/dist/react/AgentPluginDetailsModal.d.ts +187 -0
  124. package/dist/react/AgentPluginDetailsModal.js +29 -0
  125. package/dist/react/agent-plugin-install-port.d.ts +24 -0
  126. package/dist/react/agent-plugin-install-port.js +15 -0
  127. package/dist/react/installed-skills-composer-source.d.ts +60 -0
  128. package/dist/react/installed-skills-composer-source.js +111 -0
  129. package/dist/react/use-agent-plugins.hooks.d.ts +211 -0
  130. package/dist/react/use-agent-plugins.hooks.js +128 -0
  131. package/dist/site/activation-effects.d.ts +17 -0
  132. package/dist/site/activation-effects.js +31 -0
  133. package/dist/site/admin-surfaces/capabilities.d.ts +29 -0
  134. package/dist/site/admin-surfaces/capabilities.js +30 -0
  135. package/dist/site/admin-surfaces/delivery-bindings.d.ts +81 -0
  136. package/dist/site/admin-surfaces/delivery-bindings.js +161 -0
  137. package/dist/site/admin-surfaces/forms.d.ts +28 -0
  138. package/dist/site/admin-surfaces/forms.js +29 -0
  139. package/dist/site/admin-surfaces/handlers.d.ts +61 -0
  140. package/dist/site/admin-surfaces/handlers.js +35 -0
  141. package/dist/site/admin-surfaces/public-config.d.ts +12 -0
  142. package/dist/site/admin-surfaces/public-config.js +28 -0
  143. package/dist/site/analytics-provider-registry.d.ts +87 -0
  144. package/dist/site/analytics-provider-registry.js +87 -0
  145. package/dist/site/archive-reader-abi.d.ts +35 -0
  146. package/dist/site/archive-reader-abi.js +25 -0
  147. package/dist/site/auth-schemes.d.ts +110 -0
  148. package/dist/site/auth-schemes.js +119 -0
  149. package/dist/site/automatic-agent-plugins.d.ts +200 -0
  150. package/dist/site/automatic-agent-plugins.js +277 -0
  151. package/dist/site/bundled-contribution-sources.d.ts +24 -0
  152. package/dist/site/bundled-contribution-sources.js +17 -0
  153. package/dist/site/bundled-id-upgrade.d.ts +115 -0
  154. package/dist/site/bundled-id-upgrade.js +169 -0
  155. package/dist/site/customize-tool.d.ts +39 -0
  156. package/dist/site/customize-tool.js +31 -0
  157. package/dist/site/deploy-split-activation.d.ts +28 -0
  158. package/dist/site/deploy-split-activation.js +21 -0
  159. package/dist/site/exports/diagnostics.d.ts +37 -0
  160. package/dist/site/exports/diagnostics.js +55 -0
  161. package/dist/site/exports/runtime.d.ts +54 -0
  162. package/dist/site/exports/runtime.js +196 -0
  163. package/dist/site/exports/source.d.ts +42 -0
  164. package/dist/site/exports/source.js +58 -0
  165. package/dist/site/host-plugin-guidance.d.ts +137 -0
  166. package/dist/site/host-plugin-guidance.js +223 -0
  167. package/dist/site/host-signals.d.ts +78 -0
  168. package/dist/site/host-signals.js +83 -0
  169. package/dist/site/install-tool.d.ts +69 -0
  170. package/dist/site/install-tool.js +192 -0
  171. package/dist/site/install-upload.d.ts +175 -0
  172. package/dist/site/install-upload.js +324 -0
  173. package/dist/site/memory-i18n.d.ts +5 -0
  174. package/dist/site/memory-i18n.js +176 -0
  175. package/dist/site/memory.d.ts +80 -0
  176. package/dist/site/memory.js +83 -0
  177. package/dist/site/plugin-memory.d.ts +80 -0
  178. package/dist/site/plugin-memory.js +86 -0
  179. package/dist/site/provider-plugin-link.d.ts +112 -0
  180. package/dist/site/provider-plugin-link.js +100 -0
  181. package/dist/site/retired-plugin-tool-aliases.d.ts +40 -0
  182. package/dist/site/retired-plugin-tool-aliases.js +41 -0
  183. package/dist/site/service-ports.d.ts +108 -0
  184. package/dist/site/service-ports.js +2 -0
  185. package/dist/site/set-enabled.d.ts +80 -0
  186. package/dist/site/set-enabled.js +42 -0
  187. package/dist/site/soon-lock.d.ts +83 -0
  188. package/dist/site/soon-lock.js +78 -0
  189. package/dist/site/supersession.d.ts +61 -0
  190. package/dist/site/supersession.js +122 -0
  191. package/dist/site/uninstall-tool.d.ts +136 -0
  192. package/dist/site/uninstall-tool.js +203 -0
  193. package/dist/site/update-effects.d.ts +47 -0
  194. package/dist/site/update-effects.js +49 -0
  195. package/ffmpeg-transcode/plugin.json +16 -0
  196. package/github/source-control/backup-push.mjs +66 -46
  197. package/github/source-control/commit-site.mjs +124 -67
  198. package/github/source-control/write-files.mjs +86 -53
  199. package/github-pages/targets/github-pages.mjs +294 -233
  200. package/google-workspace/form-destinations/mapping.mjs +15 -7
  201. package/google-workspace/form-destinations/sheets.mjs +4 -2
  202. package/google-workspace/plugin.json +1 -0
  203. package/kuinetic/CHANGELOG.md +4 -0
  204. package/kuinetic/plugin.json +4 -1
  205. package/kuinetic/skills/kuinetic/SKILL.md +1 -2
  206. package/package.json +297 -20
  207. package/persistent-state.d.ts +4 -1
  208. package/resend/adapters/resend.mjs +5 -2
  209. package/resend/plugin.json +1 -1
  210. package/s3-compatible/jini-deploy-targets.json +1 -1
  211. package/s3-compatible/object-stores/s3-compatible.mjs +27 -4
  212. package/s3-compatible/targets/s3-compatible.mjs +3 -3
  213. package/site-import/plugin.json +3 -3
  214. package/site-import/skills/site-import/SKILL.md +62 -54
  215. package/site-import/skills/site-import/references/content-mapping.md +26 -20
  216. package/slide-design/plugin.json +1 -1
  217. package/slide-design/skills/slide-design/SKILL.md +8 -2
  218. package/ui-ux-design/CHANGELOG.md +6 -0
  219. package/ui-ux-design/plugin.json +1 -1
  220. package/ui-ux-design/skills/gstack-design/SKILL.md +6 -6
  221. package/ui-ux-design/skills/ui-ux-design/SKILL.md +3 -2
  222. package/ui-ux-design/skills/ui-ux-design/references/chrome-mobile-test-matrix.md +14 -12
  223. package/ui-ux-design/skills/ui-ux-design/references/ui-loop.md +16 -17
  224. package/vercel/NOTES.md +2 -1
  225. package/vercel/object-stores/vercel-blob.mjs +3 -4
  226. package/vercel/targets/vercel.mjs +425 -351
  227. package/core/commerce-server.d.ts +0 -2
  228. package/core/commerce-server.mjs +0 -2
  229. package/dist/admin-surfaces/connections/ports.d.ts +0 -110
  230. package/dist/admin-surfaces/connections/ports.js +0 -2
  231. /package/dist/{lifecycle → core}/install-errors.d.ts +0 -0
  232. /package/dist/{lifecycle → core}/install-errors.js +0 -0
  233. /package/dist/{lifecycle → core}/update-plan.js +0 -0
@@ -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
@@ -1,5 +1,5 @@
1
- import type { AgentPluginLayout } from "./layout.js";
2
1
  import type { AgentPluginLifecyclePorts } from "./ports.js";
2
+ import type { UninstallAgentPluginRequired, UninstallAgentPluginOptional, UninstallAgentPluginResult, AgentPluginUninstallPreview } from "@jini-ai/core/contracts/site/agent-plugins-lifecycle";
3
3
  /** The plugin id has no installed package on disk for this workspace. */
4
4
  export declare class AgentPluginNotFoundError extends Error {
5
5
  constructor({ message }: {
@@ -20,38 +20,6 @@ export declare class AgentPluginChangedSincePreviewError extends Error {
20
20
  readonly message: string;
21
21
  }, optional?: ErrorOptions);
22
22
  }
23
- export interface UninstallAgentPluginRequired {
24
- readonly layout: AgentPluginLayout;
25
- readonly workspaceId: string;
26
- readonly pluginId: string;
27
- }
28
- export interface UninstallAgentPluginOptional {
29
- /** The preview a human confirmed. When given, the uninstall refuses, removing nothing, unless the digests it
30
- * resolves now are exactly this preview's `archiveDigests`: a confirmation is consent to remove what was
31
- * resolved for the dialog, not whatever the id names by the time the answer arrives (t91 F2.2). */
32
- readonly confirmedPreview?: (AgentPluginUninstallPreview) | undefined;
33
- /** Only the browser-confirmed choice may delete persistent state. Off by default. */
34
- readonly deleteMemory?: boolean | undefined;
35
- /** INTERNAL — `retire-bundled.ts` only, never an agent tool or HTTP route. Skips the bundled refusal
36
- * (this file's header, item 2) and nothing else: that refusal exists because a bundled plugin is
37
- * re-seeded on every boot, which stops being true once the host no longer ships its source
38
- * (`RETIRED_BUNDLED_AGENT_PLUGINS`). The malformed-entry refusal still applies. */
39
- readonly retiredBundled?: (boolean) | undefined;
40
- }
41
- export interface UninstallAgentPluginResult {
42
- readonly pluginId: string;
43
- /** Every installed archive digest removed for this plugin id — normally exactly one. All matching
44
- * digests are removed: uninstall's job is to make the plugin genuinely gone, so unlike the tool
45
- * loader, which must pick ONE to serve, there is no "which one" question here. */
46
- readonly removedDigests: readonly string[];
47
- }
48
- /** What an uninstall of one plugin would remove, in a form safe to show a human: no host path. */
49
- export interface AgentPluginUninstallPreview {
50
- readonly pluginId: string;
51
- /** Distinct manifest versions across the matching digests; empty when none declares one. */
52
- readonly versions: readonly string[];
53
- readonly archiveDigests: readonly string[];
54
- }
55
23
  /** A reversible staged package and its original permissions; shared by uninstall and replacement. */
56
24
  /** One package root renamed aside, and what restoring it takes: the path it must go back to, and the
57
25
  * mode it carried before staging unfroze its root directory. */
@@ -17,13 +17,6 @@ export interface AgentPluginUpdateJournal {
17
17
  readonly startedAt: string;
18
18
  readonly result?: 'updated' | 'rolled-back';
19
19
  }
20
- export declare class AgentPluginUpdateError extends Error {
21
- readonly code: string;
22
- constructor(required: {
23
- code: string;
24
- message: string;
25
- }, optional?: ErrorOptions);
26
- }
27
20
  /** Durable per-plugin journal, audit history and frozen rollback area, all under the plugin's own
28
21
  * state root (never under `package/sha256`, so a rollback copy is never a live digest). Files use
29
22
  * the existing platform atomic writer. Settings snapshots are private (0600) and never returned to
@@ -1,13 +1,6 @@
1
+ import { AgentPluginUpdateError } from "../core/update-error.js";
1
2
  import path from 'node:path';
2
3
  import { createPersistentStateModule } from './persistent-state.js';
3
- export class AgentPluginUpdateError extends Error {
4
- code;
5
- constructor(required, optional = {}) {
6
- super(required.message, optional);
7
- this.code = required.code;
8
- this.name = 'AgentPluginUpdateError';
9
- }
10
- }
11
4
  const DIGEST_PATTERN = /^[a-f0-9]{64}$/;
12
5
  const TRANSACTION_PATTERN = /^[a-zA-Z0-9-]{1,100}$/;
13
6
  const JOURNAL_STATES = ['pending', 'published', 'committed'];
@@ -1,6 +1,6 @@
1
1
  import { type InstallAgentPluginOptional, type InstallAgentPluginRequired } from './install.js';
2
2
  import type { AgentPluginLifecyclePorts } from './ports.js';
3
- import type { InstalledAgentPlugin } from './types.js';
3
+ import type { InstalledAgentPlugin } from "@jini-ai/core/contracts/site/agent-plugins-lifecycle";
4
4
  export interface UpdateAgentPluginRequired extends InstallAgentPluginRequired {
5
5
  readonly pluginId: string;
6
6
  /** The digest the operator previewed; any other live revision refuses with PLUGIN_CHANGED. */
@@ -1,14 +1,17 @@
1
1
  import path from 'node:path';
2
2
  import { createInstallModule } from './install.js';
3
3
  import { createUninstallModule } from './uninstall.js';
4
- import { createActivationModule } from './activation.js';
4
+ import { AgentPluginActivationsBusyError, createActivationModule } from './activation.js';
5
+ import { FileLockTimeoutError, FileLockLostError } from "@jini-ai/core/contracts/runtime";
5
6
  import { createResolveAgentPluginRefsModule } from './resolve-agent-plugin-refs.js';
6
7
  import { createPersistentStateModule } from './persistent-state.js';
7
8
  import { createInstalledPackageIndex } from './installed-package-index.js';
8
9
  import { provisionAgentPluginMcp } from './mcp-provisioning.js';
9
- import { planAgentPluginUpdate } from './update-plan.js';
10
- import { AgentPluginHostIncompatibleError, describeAgentPluginCompatibility, agentPluginDependentWarnings } from './compatibility.js';
11
- import { AgentPluginUpdateError, createAgentPluginUpdateStore, isMissing, settleAgentPluginUpdateJournal } from './update-store.js';
10
+ import { planAgentPluginUpdate } from '../core/update-plan.js';
11
+ import { describeAgentPluginCompatibility, agentPluginDependentWarnings } from './compatibility.js';
12
+ import { AgentPluginHostIncompatibleError } from '../core/host-incompatible-error.js';
13
+ import { createAgentPluginUpdateStore, isMissing, settleAgentPluginUpdateJournal } from './update-store.js';
14
+ import { AgentPluginUpdateError } from '../core/update-error.js';
12
15
  const PLAN_REFUSALS = {
13
16
  'downgrade-refused': { code: 'PLUGIN_DOWNGRADE_REFUSED', message: 'Plugin downgrades are refused.' },
14
17
  'id-mismatch': { code: 'PLUGIN_ID_MISMATCH', message: 'Choose a candidate for this plugin.' },
@@ -204,37 +207,81 @@ async function restoreOldBytes({ scope, store, journal, oldRoot }) {
204
207
  await scope.ports.filesystem.chmod(oldRoot, 0o555);
205
208
  }
206
209
  /** @returns false when the old revision's MCP roster could not be re-provisioned; the bytes are
207
- * already back, so the caller degrades to "restored but off" instead of wedging the journal. */
210
+ * already back, so the caller degrades to "restored but off" instead of wedging the journal.
211
+ * @throws a lock wait ({@link isLockWait}) unchanged: it says nothing about the roster, so it must
212
+ * reach the retry path with the journal kept, never be turned into "restored but off". */
208
213
  async function reprovisionOld({ scope, workspaceId, journal, oldRoot }) {
209
214
  try {
210
215
  const installed = await scope.index.indexInstalledRoot({ packageRoot: oldRoot, archiveDigest: journal.fromDigest });
211
216
  await provisionAgentPluginMcp({ mcpProvisioning: scope.ports.mcpProvisioning, workspaceId, installed });
212
217
  return true;
213
218
  }
214
- catch {
219
+ catch (error) {
220
+ if (isLockWait({ error }))
221
+ throw error;
215
222
  return false;
216
223
  }
217
224
  }
225
+ /** How long background recovery waits before each new attempt after a lock wait at boot. */
226
+ const RECOVERY_RETRY_DELAYS_MS = [5_000, 30_000, 120_000, 600_000];
227
+ /** A wait on another process's lock (the plugin's own lock or the activations lock). It says nothing
228
+ * about whether the plugin is healthy, so it must never be treated as an unrecovered update. */
229
+ function isLockWait({ error }, _optional = {}) {
230
+ return error instanceof FileLockTimeoutError || error instanceof FileLockLostError || error instanceof AgentPluginActivationsBusyError;
231
+ }
218
232
  /** Boot only, before serving runs: recover incomplete switches, file committed audits, then
219
233
  * collect retained rollback bytes. One plugin's failure does not stop the others; the first
220
- * failure is rethrown afterwards. Bundled plugins have no update journal and get no decisions.
234
+ * failure is rethrown afterwards. A plugin whose lock could not be taken in time is never switched
235
+ * off for it: boot goes on and recovery retries in the background (named log lines).
236
+ * Bundled plugins have no update journal and get no decisions.
221
237
  * @complexity O(p + f) workspace entries and retained rollback files.
222
238
  */
223
239
  async function reconcileAgentPluginUpdates({ scope, workspaceId }) {
224
- const workspaceRoot = scope.ports.layout.forWorkspace({ workspaceId }).root;
225
240
  const failures = [];
241
+ const waiting = [];
226
242
  for (const pluginId of await listPluginStateIds({ scope, workspaceId })) {
227
243
  try {
228
- await scope.persistent.withPluginLock({ workspaceRoot, pluginId, run: () => reconcilePlugin({ scope, workspaceId, pluginId }) });
244
+ await reconcileUnderLock({ scope, workspaceId, pluginId });
229
245
  }
230
246
  catch (error) {
247
+ if (isLockWait({ error })) {
248
+ waiting.push(pluginId);
249
+ scope.ports.onEvent?.({ event: 'agent-plugin-update-recovery-waiting', pluginId, message: `Plugin '${pluginId}': another process is holding its lock, so finishing an interrupted update is waiting. The plugin keeps its current on/off setting and recovery will retry in the background.` });
250
+ continue;
251
+ }
231
252
  failures.push(error);
232
253
  scope.ports.onEvent?.({ event: 'agent-plugin-update-recovery-failed', message: `Plugin '${pluginId}': an interrupted update could not be recovered (${errorCode({ error })}); it is kept off until a later boot recovers it.` });
233
254
  }
234
255
  }
256
+ for (const pluginId of waiting)
257
+ void retryRecoveryInBackground({ scope, workspaceId, pluginId }).catch(() => undefined);
235
258
  if (failures.length)
236
259
  throw failures[0];
237
260
  }
261
+ async function reconcileUnderLock({ scope, workspaceId, pluginId }) {
262
+ const workspaceRoot = scope.ports.layout.forWorkspace({ workspaceId }).root;
263
+ await scope.persistent.withPluginLock({ workspaceRoot, pluginId, run: () => reconcilePlugin({ scope, workspaceId, pluginId }) });
264
+ }
265
+ /** Retries a recovery that waited on a lock, a few times with growing pauses. Never disables the
266
+ * plugin; a failure that is not a lock wait is logged and ends the retries (the journal stays for
267
+ * the next boot). @complexity O(r) attempts, each one a full recovery of one plugin. */
268
+ async function retryRecoveryInBackground({ scope, workspaceId, pluginId }) {
269
+ for (const delayMs of RECOVERY_RETRY_DELAYS_MS) {
270
+ await (scope.ports.clock.sleepInBackground ?? scope.ports.clock.sleep)({ ms: delayMs });
271
+ try {
272
+ await reconcileUnderLock({ scope, workspaceId, pluginId });
273
+ scope.ports.onEvent?.({ event: 'agent-plugin-update-recovery-resumed', pluginId, message: `Plugin '${pluginId}': the lock was released and the interrupted update has now been recovered.` });
274
+ return;
275
+ }
276
+ catch (error) {
277
+ if (isLockWait({ error }))
278
+ continue;
279
+ scope.ports.onEvent?.({ event: 'agent-plugin-update-recovery-failed', pluginId, message: `Plugin '${pluginId}': an interrupted update could not be recovered on retry (${errorCode({ error })}); it is kept off until a later boot recovers it.` });
280
+ return;
281
+ }
282
+ }
283
+ scope.ports.onEvent?.({ event: 'agent-plugin-update-recovery-gave-up', pluginId, message: `Plugin '${pluginId}': its lock stayed busy through every background retry. It keeps its current on/off setting and recovery will try again at the next boot.` });
284
+ }
238
285
  /** Workspace entries that can be plugin state roots. Reserved names (staging, packages, memory,
239
286
  * data) and invalid ids are rejected by the layout itself and are skipped, never locked. */
240
287
  async function listPluginStateIds({ scope, workspaceId }) {
@@ -272,11 +319,14 @@ async function reconcilePlugin({ scope, workspaceId, pluginId }) {
272
319
  for (const rollbackRoot of await store.listRollbackRoots({}))
273
320
  await scope.removal.removeFrozenPackageTree(rollbackRoot);
274
321
  }
275
- /** Unrecovered = off: an unreadable journal or a failed restore switches the plugin off (best
322
+ /** Unrecovered = off (except a lock wait, see below): an unreadable journal or a failed restore switches the plugin off (best
276
323
  * effort; the journal stays, so the next boot retries) and rethrows. A failure only filing a
277
324
  * committed audit or collecting rollback bytes never reaches here. Bundled plugins never get a
278
325
  * journal from this module and are never touched. */
279
326
  async function switchOffUnrecovered({ scope, workspaceId, pluginId, error }) {
327
+ // A busy lock proves nothing about the plugin: leave it as it is; the caller retries in the background.
328
+ if (isLockWait({ error }))
329
+ throw error;
280
330
  const workspaceRoot = scope.ports.layout.forWorkspace({ workspaceId }).root;
281
331
  try {
282
332
  if (!await scope.activation.isAgentPluginRecordedAsBundled(workspaceRoot, pluginId)) {
@@ -1,3 +1,4 @@
1
+ import type { AgentPluginArchiveReaderPort } from "@jini-ai/core/contracts/site/agent-plugins-lifecycle";
1
2
  /**
2
3
  * @file The real `AgentPluginArchiveReaderPort` adapter, backed by `yauzl`.
3
4
  *
@@ -54,8 +55,12 @@ export interface YauzlPort {
54
55
  validateEntrySizes: boolean;
55
56
  }): Promise<YauzlZipFile>;
56
57
  }
57
- import type { AgentPluginArchiveReaderPort } from "./install.js";
58
58
  export declare function createYauzlAgentPluginArchiveReader({ yauzl }: {
59
59
  readonly yauzl: YauzlPort;
60
- }, _optional?: Record<string, never>): AgentPluginArchiveReaderPort;
60
+ }, { rejectSpecialUnixEntry }?: {
61
+ rejectSpecialUnixEntry?: (required: {
62
+ entry: YauzlEntry;
63
+ kind: "symlink" | "fifo" | "device";
64
+ }) => void;
65
+ }): AgentPluginArchiveReaderPort;
61
66
  //# sourceMappingURL=yauzl-archive-reader.d.ts.map
@@ -14,7 +14,7 @@ const UNIX_HOST_SYSTEM = 3;
14
14
  * Any bit in the standard rwx-for-owner/group/other executable mask.
15
15
  */
16
16
  const EXECUTABLE_MODE_MASK = 0o111;
17
- export function createYauzlAgentPluginArchiveReader({ yauzl }, _optional = {}) {
17
+ export function createYauzlAgentPluginArchiveReader({ yauzl }, { rejectSpecialUnixEntry } = {}) {
18
18
  return {
19
19
  async *entries({ archive }) {
20
20
  /**
@@ -28,7 +28,7 @@ export function createYauzlAgentPluginArchiveReader({ yauzl }, _optional = {}) {
28
28
  });
29
29
  try {
30
30
  for await (const entry of zipfile.eachEntry())
31
- yield archiveEntryFor(zipfile, entry);
31
+ yield archiveEntryFor(zipfile, entry, { rejectSpecialUnixEntry });
32
32
  }
33
33
  finally {
34
34
  zipfile.close();
@@ -47,17 +47,22 @@ function readUnixMode(entry) {
47
47
  return null;
48
48
  return (entry.externalFileAttributes >>> 16) & 0xffff;
49
49
  }
50
- function archiveEntryFor(zipfile, entry) {
50
+ function archiveEntryFor(zipfile, entry, { rejectSpecialUnixEntry }) {
51
51
  /**
52
52
  * The entry's content (the link target text) is deliberately never read — see this
53
53
  * module's header. `install.ts` rejects every symlink entry unconditionally.
54
54
  */
55
55
  const unixMode = readUnixMode(entry);
56
56
  const fileType = unixMode === null ? 0 : unixMode & S_IFMT;
57
- if (fileType === S_IFLNK)
57
+ if (fileType === S_IFLNK) {
58
+ rejectSpecialUnixEntry?.({ entry, kind: "symlink" });
58
59
  return { kind: "symlink", entryPath: entry.fileName };
59
- if (![0, S_IFREG, S_IFDIR].includes(fileType))
60
- return { kind: fileType === S_IFIFO ? "fifo" : "device", entryPath: entry.fileName };
60
+ }
61
+ if (![0, S_IFREG, S_IFDIR].includes(fileType)) {
62
+ const kind = fileType === S_IFIFO ? "fifo" : "device";
63
+ rejectSpecialUnixEntry?.({ entry, kind });
64
+ return { kind, entryPath: entry.fileName };
65
+ }
61
66
  // File mode defines links even when a hostile filename masquerades as a directory.
62
67
  if (entry.fileName.endsWith("/"))
63
68
  return { kind: "directory", entryPath: entry.fileName };
@@ -1,3 +1,5 @@
1
+ import { type AgentPluginIdentityReadOptions } from './core/identity-namespace.js';
2
+ import type { PluginManifestAuthor } from "@jini-ai/core/contracts/site/agent-plugins-lifecycle";
1
3
  /**
2
4
  * Types for the Agent Plugins 1.0.0 open standard (published by a Technical Steering Committee
3
5
  * with maintainers from Amazon, Cursor, Google, Microsoft, OpenAI, and Vercel). A plugin is a
@@ -15,11 +17,6 @@ export declare const AGENT_PLUGINS_MCP_SCHEMA_URL = "https://agent-plugins.org/s
15
17
  export declare const PLUGIN_MANIFEST_FILENAME = "plugin.json";
16
18
  export declare const PLUGIN_SKILLS_DIRNAME = "skills";
17
19
  export declare const PLUGIN_MCP_MANIFEST_FILENAME = "mcp.json";
18
- export interface PluginManifestAuthor {
19
- readonly name?: string;
20
- readonly email?: string;
21
- readonly url?: string;
22
- }
23
20
  export type { PluginIdentityExtension } from "@jini-ai/core/plugin-directory";
24
21
  export interface PluginManifest {
25
22
  readonly $schema?: string;
@@ -70,11 +67,10 @@ export declare function isMcpManifest(required: {
70
67
  * Hosts inject identityNamespace; the default is `jini`, with a legacy-key fallback. */
71
68
  export declare function validatePluginManifest(required: {
72
69
  readonly value: unknown;
73
- }, optional?: {
74
- readonly identityNamespace?: string;
75
- }): boolean;
70
+ }, optional?: AgentPluginIdentityReadOptions): boolean;
76
71
  /** Object-argument facade for the legacy structural validator. */
77
72
  export declare function validateMcpManifest(required: {
78
73
  readonly value: unknown;
79
74
  }, _optional?: Record<string, never>): boolean;
75
+ export type { AgentPluginIdentityReadOptions, LegacyAgentPluginIdentity } from "./core/identity-namespace.js";
80
76
  //# sourceMappingURL=manifest.d.ts.map