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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (234) hide show
  1. package/CHANGELOG.md +7 -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/credential-save-tool.js +2 -3
  24. package/dist/connect/grant-signed-in-defaults.js +1 -1
  25. package/dist/connect/host-deps.d.ts +32 -0
  26. package/dist/connect/host-deps.js +35 -0
  27. package/dist/connect/import-access-token.js +1 -1
  28. package/dist/connect/index.d.ts +7 -2
  29. package/dist/connect/index.js +5 -2
  30. package/dist/connect/installed-plugin.d.ts +28 -0
  31. package/dist/connect/installed-plugin.js +19 -0
  32. package/dist/connect/new-site-agent-plugin-tokens.d.ts +88 -0
  33. package/dist/connect/new-site-agent-plugin-tokens.js +107 -0
  34. package/dist/connect/plugin-host/index.d.ts +1 -2
  35. package/dist/connect/plugin-host/index.js +18 -9
  36. package/dist/connect/token-sign-in.d.ts +1 -14
  37. package/dist/connect/token-sign-in.js +4 -23
  38. package/dist/core/export-props.d.ts +10 -0
  39. package/dist/core/export-props.js +31 -0
  40. package/dist/core/folder-zip-error.d.ts +5 -0
  41. package/dist/core/folder-zip-error.js +8 -0
  42. package/dist/core/host-incompatible-error.d.ts +8 -0
  43. package/dist/core/host-incompatible-error.js +9 -0
  44. package/dist/core/identity-namespace.d.ts +27 -16
  45. package/dist/core/identity-namespace.js +25 -22
  46. package/dist/core/plugin-display-name.d.ts +7 -0
  47. package/dist/core/plugin-display-name.js +11 -0
  48. package/dist/core/provider-plugin-link.d.ts +7 -0
  49. package/dist/core/provider-plugin-link.js +5 -0
  50. package/dist/{connect → core}/token-map.d.ts +11 -1
  51. package/dist/{connect → core}/token-map.js +15 -0
  52. package/dist/core/token-sign-in-list.d.ts +18 -0
  53. package/dist/core/token-sign-in-list.js +23 -0
  54. package/dist/core/update-error.d.ts +8 -0
  55. package/dist/core/update-error.js +9 -0
  56. package/dist/{lifecycle → core}/update-plan.d.ts +1 -1
  57. package/dist/ffmpeg-transcode/adapter.d.ts +74 -0
  58. package/dist/ffmpeg-transcode/adapter.js +155 -0
  59. package/dist/folder-zip-node.d.ts +2 -1
  60. package/dist/folder-zip-node.js +6 -5
  61. package/dist/folder-zip.d.ts +0 -4
  62. package/dist/folder-zip.js +1 -7
  63. package/dist/index.d.ts +3 -1
  64. package/dist/lifecycle/activation.d.ts +39 -3
  65. package/dist/lifecycle/activation.js +467 -418
  66. package/dist/lifecycle/automatic-use-offer.d.ts +62 -0
  67. package/dist/lifecycle/automatic-use-offer.js +52 -0
  68. package/dist/lifecycle/automatic-use.d.ts +33 -1
  69. package/dist/lifecycle/automatic-use.js +159 -38
  70. package/dist/lifecycle/bundled-source-archive.d.ts +1 -1
  71. package/dist/lifecycle/capability-projection.d.ts +0 -1
  72. package/dist/lifecycle/capability-projection.js +92 -23
  73. package/dist/lifecycle/compatibility-metadata.d.ts +1 -0
  74. package/dist/lifecycle/compatibility-metadata.js +6 -1
  75. package/dist/lifecycle/compatibility.d.ts +1 -8
  76. package/dist/lifecycle/compatibility.js +1 -8
  77. package/dist/lifecycle/credential-card-metadata.d.ts +2 -2
  78. package/dist/lifecycle/exports.d.ts +2 -45
  79. package/dist/lifecycle/exports.js +1 -30
  80. package/dist/lifecycle/host-tools/identity.d.ts +5 -4
  81. package/dist/lifecycle/host-tools/identity.js +5 -5
  82. package/dist/lifecycle/host-tools/ports.d.ts +10 -1
  83. package/dist/lifecycle/host-tools/search-tool.js +18 -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 +17 -3
  106. package/dist/lifecycle/search-projection.js +8 -8
  107. package/dist/lifecycle/search.d.ts +1 -0
  108. package/dist/lifecycle/search.js +2 -2
  109. package/dist/lifecycle/seed-bundled.d.ts +86 -1
  110. package/dist/lifecycle/seed-bundled.js +48 -84
  111. package/dist/lifecycle/set-enabled.d.ts +1 -13
  112. package/dist/lifecycle/set-enabled.js +11 -7
  113. package/dist/lifecycle/trusted-plugin-files.d.ts +1 -1
  114. package/dist/lifecycle/trusted-plugin-files.js +33 -30
  115. package/dist/lifecycle/types.d.ts +13 -34
  116. package/dist/lifecycle/uninstall.d.ts +1 -33
  117. package/dist/lifecycle/update-store.d.ts +0 -7
  118. package/dist/lifecycle/update-store.js +1 -8
  119. package/dist/lifecycle/update.d.ts +1 -1
  120. package/dist/lifecycle/update.js +60 -10
  121. package/dist/lifecycle/yauzl-archive-reader.d.ts +7 -2
  122. package/dist/lifecycle/yauzl-archive-reader.js +11 -6
  123. package/dist/manifest.d.ts +4 -8
  124. package/dist/react/AgentPluginDetailsModal.d.ts +187 -0
  125. package/dist/react/AgentPluginDetailsModal.js +29 -0
  126. package/dist/react/agent-plugin-install-port.d.ts +24 -0
  127. package/dist/react/agent-plugin-install-port.js +15 -0
  128. package/dist/react/installed-skills-composer-source.d.ts +60 -0
  129. package/dist/react/installed-skills-composer-source.js +111 -0
  130. package/dist/react/use-agent-plugins.hooks.d.ts +211 -0
  131. package/dist/react/use-agent-plugins.hooks.js +128 -0
  132. package/dist/site/activation-effects.d.ts +17 -0
  133. package/dist/site/activation-effects.js +31 -0
  134. package/dist/site/admin-surfaces/capabilities.d.ts +29 -0
  135. package/dist/site/admin-surfaces/capabilities.js +30 -0
  136. package/dist/site/admin-surfaces/delivery-bindings.d.ts +81 -0
  137. package/dist/site/admin-surfaces/delivery-bindings.js +161 -0
  138. package/dist/site/admin-surfaces/forms.d.ts +28 -0
  139. package/dist/site/admin-surfaces/forms.js +29 -0
  140. package/dist/site/admin-surfaces/handlers.d.ts +61 -0
  141. package/dist/site/admin-surfaces/handlers.js +35 -0
  142. package/dist/site/admin-surfaces/public-config.d.ts +12 -0
  143. package/dist/site/admin-surfaces/public-config.js +28 -0
  144. package/dist/site/analytics-provider-registry.d.ts +87 -0
  145. package/dist/site/analytics-provider-registry.js +87 -0
  146. package/dist/site/archive-reader-abi.d.ts +35 -0
  147. package/dist/site/archive-reader-abi.js +25 -0
  148. package/dist/site/auth-schemes.d.ts +110 -0
  149. package/dist/site/auth-schemes.js +119 -0
  150. package/dist/site/automatic-agent-plugins.d.ts +200 -0
  151. package/dist/site/automatic-agent-plugins.js +277 -0
  152. package/dist/site/bundled-contribution-sources.d.ts +24 -0
  153. package/dist/site/bundled-contribution-sources.js +17 -0
  154. package/dist/site/bundled-id-upgrade.d.ts +115 -0
  155. package/dist/site/bundled-id-upgrade.js +169 -0
  156. package/dist/site/customize-tool.d.ts +39 -0
  157. package/dist/site/customize-tool.js +31 -0
  158. package/dist/site/deploy-split-activation.d.ts +28 -0
  159. package/dist/site/deploy-split-activation.js +21 -0
  160. package/dist/site/exports/diagnostics.d.ts +37 -0
  161. package/dist/site/exports/diagnostics.js +55 -0
  162. package/dist/site/exports/runtime.d.ts +54 -0
  163. package/dist/site/exports/runtime.js +196 -0
  164. package/dist/site/exports/source.d.ts +42 -0
  165. package/dist/site/exports/source.js +58 -0
  166. package/dist/site/host-plugin-guidance.d.ts +137 -0
  167. package/dist/site/host-plugin-guidance.js +223 -0
  168. package/dist/site/host-signals.d.ts +78 -0
  169. package/dist/site/host-signals.js +83 -0
  170. package/dist/site/install-tool.d.ts +69 -0
  171. package/dist/site/install-tool.js +192 -0
  172. package/dist/site/install-upload.d.ts +175 -0
  173. package/dist/site/install-upload.js +324 -0
  174. package/dist/site/memory-i18n.d.ts +5 -0
  175. package/dist/site/memory-i18n.js +176 -0
  176. package/dist/site/memory.d.ts +80 -0
  177. package/dist/site/memory.js +83 -0
  178. package/dist/site/plugin-memory.d.ts +80 -0
  179. package/dist/site/plugin-memory.js +86 -0
  180. package/dist/site/provider-plugin-link.d.ts +112 -0
  181. package/dist/site/provider-plugin-link.js +100 -0
  182. package/dist/site/retired-plugin-tool-aliases.d.ts +40 -0
  183. package/dist/site/retired-plugin-tool-aliases.js +41 -0
  184. package/dist/site/service-ports.d.ts +108 -0
  185. package/dist/site/service-ports.js +2 -0
  186. package/dist/site/set-enabled.d.ts +80 -0
  187. package/dist/site/set-enabled.js +42 -0
  188. package/dist/site/soon-lock.d.ts +83 -0
  189. package/dist/site/soon-lock.js +78 -0
  190. package/dist/site/supersession.d.ts +61 -0
  191. package/dist/site/supersession.js +122 -0
  192. package/dist/site/uninstall-tool.d.ts +136 -0
  193. package/dist/site/uninstall-tool.js +203 -0
  194. package/dist/site/update-effects.d.ts +47 -0
  195. package/dist/site/update-effects.js +49 -0
  196. package/ffmpeg-transcode/plugin.json +16 -0
  197. package/github/source-control/backup-push.mjs +66 -46
  198. package/github/source-control/commit-site.mjs +112 -65
  199. package/github/source-control/write-files.mjs +86 -53
  200. package/github-pages/targets/github-pages.mjs +294 -233
  201. package/google-workspace/form-destinations/mapping.mjs +15 -7
  202. package/google-workspace/form-destinations/sheets.mjs +4 -2
  203. package/google-workspace/plugin.json +1 -0
  204. package/kuinetic/CHANGELOG.md +4 -0
  205. package/kuinetic/plugin.json +4 -1
  206. package/kuinetic/skills/kuinetic/SKILL.md +1 -2
  207. package/package.json +295 -18
  208. package/persistent-state.d.ts +4 -1
  209. package/resend/adapters/resend.mjs +5 -2
  210. package/resend/plugin.json +1 -1
  211. package/s3-compatible/jini-deploy-targets.json +1 -1
  212. package/s3-compatible/object-stores/s3-compatible.mjs +27 -4
  213. package/s3-compatible/targets/s3-compatible.mjs +3 -3
  214. package/site-import/plugin.json +3 -3
  215. package/site-import/skills/site-import/SKILL.md +62 -54
  216. package/site-import/skills/site-import/references/content-mapping.md +26 -20
  217. package/slide-design/plugin.json +1 -1
  218. package/slide-design/skills/slide-design/SKILL.md +8 -2
  219. package/ui-ux-design/CHANGELOG.md +6 -0
  220. package/ui-ux-design/plugin.json +1 -1
  221. package/ui-ux-design/skills/gstack-design/SKILL.md +6 -6
  222. package/ui-ux-design/skills/ui-ux-design/SKILL.md +3 -2
  223. package/ui-ux-design/skills/ui-ux-design/references/chrome-mobile-test-matrix.md +14 -12
  224. package/ui-ux-design/skills/ui-ux-design/references/ui-loop.md +16 -17
  225. package/vercel/NOTES.md +2 -1
  226. package/vercel/object-stores/vercel-blob.mjs +3 -4
  227. package/vercel/targets/vercel.mjs +425 -351
  228. package/core/commerce-server.d.ts +0 -2
  229. package/core/commerce-server.mjs +0 -2
  230. package/dist/admin-surfaces/connections/ports.d.ts +0 -110
  231. package/dist/admin-surfaces/connections/ports.js +0 -2
  232. /package/dist/{lifecycle → core}/install-errors.d.ts +0 -0
  233. /package/dist/{lifecycle → core}/install-errors.js +0 -0
  234. /package/dist/{lifecycle → core}/update-plan.js +0 -0
@@ -1,7 +1,17 @@
1
+ /** Existing installed copies remain readable through at least this date; removal requires an
2
+ * explicit release decision, never a clock-based refusal to load a plugin. */
3
+ export interface LegacyAgentPluginIdentity {
4
+ readonly namespace: string;
5
+ readonly warning: string;
6
+ }
7
+ export interface AgentPluginIdentityReadOptions {
8
+ readonly identityNamespace?: string | undefined;
9
+ readonly legacyIdentity?: LegacyAgentPluginIdentity | undefined;
10
+ }
1
11
  /** Explicit unrelated namespaces retain their isolation; omitted names select portable metadata. */
2
12
  export declare function isPortableAgentPluginNamespace({ namespace }: {
3
13
  readonly namespace?: string | undefined;
4
- }, _optional?: {}): boolean;
14
+ }, { legacyIdentity }?: Pick<AgentPluginIdentityReadOptions, "legacyIdentity">): boolean;
5
15
  /** Selects the portable identity key without changing explicit host isolation.
6
16
  * Legacy manifests remain readable only when no namespace was requested and `jini` is absent.
7
17
  * A present malformed extension is left to the identity validator rather than bypassed.
@@ -10,42 +20,43 @@ export declare function isPortableAgentPluginNamespace({ namespace }: {
10
20
  */
11
21
  export declare function resolveAgentPluginIdentityNamespace({ value }: {
12
22
  readonly value: unknown;
13
- }, { identityNamespace }?: {
14
- readonly identityNamespace?: string;
15
- }): string;
16
- /** Existing installed copies remain readable through at least this date; removal requires an
17
- * explicit release decision, never a clock-based refusal to load a plugin. */
18
- export declare const legacyAgentPluginMetadataWarning = "Legacy extensions.tovu agent-plugin metadata is deprecated; compatibility is retained through at least 2027-05-06. Portable packages use extensions.jini and unprefixed MCP metadata.";
23
+ }, { identityNamespace, legacyIdentity }?: AgentPluginIdentityReadOptions): string;
19
24
  /** Select an extension without requiring a complete manifest, for preboot metadata readers.
20
25
  * @complexity O(1); no I/O or mutation. */
21
26
  export declare function readAgentPluginPortableExtension(required: {
22
27
  readonly value: unknown;
23
- }, optional?: {
24
- readonly identityNamespace?: string;
25
- }): Readonly<Record<string, unknown>> | undefined;
28
+ }, optional?: AgentPluginIdentityReadOptions): Readonly<Record<string, unknown>> | undefined;
26
29
  /** Diagnostics are returned to the host so it can choose its normal warning surface. */
27
30
  export declare function readAgentPluginCompatibilityWarnings(required: {
28
31
  readonly value: unknown;
29
- }, optional?: {
30
- readonly identityNamespace?: string;
31
- }): readonly string[];
32
+ }, optional?: AgentPluginIdentityReadOptions): readonly string[];
32
33
  /** Lifecycle host names identify effects and packaging; portable metadata remains portable.
33
34
  * A declared canonical key wins; explicit custom metadata keeps its isolation from legacy keys.
34
35
  * A valid legacy object remains the fallback for hosts without their own declaration. */
35
36
  export declare function resolveAgentPluginLifecycleNamespace({ value, extensionNamespace }: {
36
37
  readonly value: unknown;
37
38
  readonly extensionNamespace: string;
38
- }, _optional?: {}): string;
39
+ }, { legacyIdentity }?: Pick<AgentPluginIdentityReadOptions, "legacyIdentity">): string;
40
+ type LegacyMcpField = 'authMode' | 'defaultTools' | 'tokenAuth' | 'renamedTools';
41
+ export interface LegacyMcpAliases {
42
+ readonly names: Readonly<Partial<Record<LegacyMcpField, string>>>;
43
+ readonly warning: string;
44
+ }
39
45
  /** Translate installed legacy MCP entries without granting read trust from transport data.
40
46
  * Portable names take precedence even when malformed, leaving validation to the shared parser.
41
47
  * @complexity O(k), bounded by the default-tools declaration. */
42
48
  export declare function readCompatibleAgentPluginServerMetadata({ value, server }: {
43
49
  readonly value: Readonly<Record<string, unknown>>;
44
50
  readonly server: Readonly<Record<string, unknown>>;
45
- }, _optional?: {}): Readonly<Record<string, unknown>>;
51
+ }, { legacyMcpAliases }?: {
52
+ readonly legacyMcpAliases?: LegacyMcpAliases | undefined;
53
+ }): Readonly<Record<string, unknown>>;
46
54
  /** Whether compatibility aliases were read, for the MCP parser's returned diagnostics. */
47
55
  export declare function hasLegacyAgentPluginServerMetadata({ value, server }: {
48
56
  readonly value: Readonly<Record<string, unknown>>;
49
57
  readonly server: Readonly<Record<string, unknown>>;
50
- }, _optional?: {}): boolean;
58
+ }, { legacyMcpAliases }?: {
59
+ readonly legacyMcpAliases?: LegacyMcpAliases | undefined;
60
+ }): boolean;
61
+ export {};
51
62
  //# sourceMappingURL=identity-namespace.d.ts.map
@@ -1,7 +1,7 @@
1
1
  const isObject = (value) => typeof value === 'object' && value !== null && !Array.isArray(value);
2
2
  /** Explicit unrelated namespaces retain their isolation; omitted names select portable metadata. */
3
- export function isPortableAgentPluginNamespace({ namespace }, _optional = {}) {
4
- return namespace === undefined || namespace === 'jini' || namespace === 'tovu';
3
+ export function isPortableAgentPluginNamespace({ namespace }, { legacyIdentity } = {}) {
4
+ return namespace === undefined || namespace === 'jini' || namespace === legacyIdentity?.namespace;
5
5
  }
6
6
  /** Selects the portable identity key without changing explicit host isolation.
7
7
  * Legacy manifests remain readable only when no namespace was requested and `jini` is absent.
@@ -9,28 +9,25 @@ export function isPortableAgentPluginNamespace({ namespace }, _optional = {}) {
9
9
  * @returns The namespace to pass to the shared identity and metadata readers.
10
10
  * @complexity O(1) time and space; no I/O or manifest mutation.
11
11
  */
12
- export function resolveAgentPluginIdentityNamespace({ value }, { identityNamespace } = {}) {
12
+ export function resolveAgentPluginIdentityNamespace({ value }, { identityNamespace, legacyIdentity } = {}) {
13
13
  // The legacy key names the same portable metadata, so a declared canonical `jini` copy wins.
14
- if (identityNamespace === 'tovu' && isObject(value) && isObject(value.extensions) && Object.hasOwn(value.extensions, 'jini'))
14
+ if (legacyIdentity !== undefined && identityNamespace === legacyIdentity.namespace && isObject(value) && isObject(value.extensions) && Object.hasOwn(value.extensions, 'jini'))
15
15
  return 'jini';
16
16
  if (identityNamespace !== undefined)
17
17
  return identityNamespace;
18
- return defaultIdentityNamespace({ value });
18
+ return defaultIdentityNamespace({ value }, { legacyIdentity });
19
19
  }
20
20
  /** The namespace a manifest selects when the host requested none: `jini` unless only the legacy key is present.
21
21
  * @complexity O(1) time and space; no I/O or manifest mutation. */
22
- function defaultIdentityNamespace({ value }, _optional = {}) {
22
+ function defaultIdentityNamespace({ value }, { legacyIdentity } = {}) {
23
23
  if (!isObject(value) || !isObject(value.extensions))
24
24
  return 'jini';
25
25
  const extensions = value.extensions;
26
26
  if (Object.hasOwn(extensions, 'jini'))
27
27
  return 'jini';
28
28
  // Compatibility only: existing published manifests used this product's extension key.
29
- return Object.hasOwn(extensions, 'tovu') ? 'tovu' : 'jini';
29
+ return legacyIdentity !== undefined && Object.hasOwn(extensions, legacyIdentity.namespace) ? legacyIdentity.namespace : 'jini';
30
30
  }
31
- /** Existing installed copies remain readable through at least this date; removal requires an
32
- * explicit release decision, never a clock-based refusal to load a plugin. */
33
- export const legacyAgentPluginMetadataWarning = 'Legacy extensions.tovu agent-plugin metadata is deprecated; compatibility is retained through at least 2027-05-06. Portable packages use extensions.jini and unprefixed MCP metadata.';
34
31
  /** Select an extension without requiring a complete manifest, for preboot metadata readers.
35
32
  * @complexity O(1); no I/O or mutation. */
36
33
  export function readAgentPluginPortableExtension(required, optional = {}) {
@@ -43,37 +40,43 @@ export function readAgentPluginPortableExtension(required, optional = {}) {
43
40
  }
44
41
  /** Diagnostics are returned to the host so it can choose its normal warning surface. */
45
42
  export function readAgentPluginCompatibilityWarnings(required, optional = {}) {
46
- return isPortableAgentPluginNamespace({ namespace: optional.identityNamespace }) && resolveAgentPluginIdentityNamespace(required, optional) === 'tovu'
47
- ? [legacyAgentPluginMetadataWarning] : [];
43
+ return optional.legacyIdentity !== undefined && isPortableAgentPluginNamespace({ namespace: optional.identityNamespace }, optional) && resolveAgentPluginIdentityNamespace(required, optional) === optional.legacyIdentity.namespace
44
+ ? [optional.legacyIdentity.warning] : [];
48
45
  }
49
46
  /** Lifecycle host names identify effects and packaging; portable metadata remains portable.
50
47
  * A declared canonical key wins; explicit custom metadata keeps its isolation from legacy keys.
51
48
  * A valid legacy object remains the fallback for hosts without their own declaration. */
52
- export function resolveAgentPluginLifecycleNamespace({ value, extensionNamespace }, _optional = {}) {
49
+ export function resolveAgentPluginLifecycleNamespace({ value, extensionNamespace }, { legacyIdentity } = {}) {
53
50
  if (!isObject(value) || !isObject(value.extensions))
54
51
  return extensionNamespace;
55
52
  const extensions = value.extensions;
56
53
  if (Object.hasOwn(extensions, 'jini'))
57
54
  return 'jini';
58
- if (!isPortableAgentPluginNamespace({ namespace: extensionNamespace }) && (Object.hasOwn(extensions, extensionNamespace) || !isObject(extensions.tovu)))
55
+ if (keepsLifecycleNamespace({ extensions, extensionNamespace, legacyIdentity }))
59
56
  return extensionNamespace;
60
- return Object.hasOwn(extensions, 'tovu') ? 'tovu' : extensionNamespace;
57
+ return legacyIdentity !== undefined && Object.hasOwn(extensions, legacyIdentity.namespace) ? legacyIdentity.namespace : extensionNamespace;
61
58
  }
59
+ function keepsLifecycleNamespace({ extensions, extensionNamespace, legacyIdentity }) {
60
+ if (isPortableAgentPluginNamespace({ namespace: extensionNamespace }, { legacyIdentity }))
61
+ return false;
62
+ return Object.hasOwn(extensions, extensionNamespace) || legacyIdentity === undefined || !isObject(extensions[legacyIdentity.namespace]);
63
+ }
64
+ const CANONICAL_MCP_KEYS = ['authMode', 'defaultTools', 'tokenAuth', 'renamedTools'];
62
65
  /** Translate installed legacy MCP entries without granting read trust from transport data.
63
66
  * Portable names take precedence even when malformed, leaving validation to the shared parser.
64
67
  * @complexity O(k), bounded by the default-tools declaration. */
65
- export function readCompatibleAgentPluginServerMetadata({ value, server }, _optional = {}) {
66
- return Object.fromEntries(['authMode', 'defaultTools', 'tokenAuth', 'renamedTools'].map(key => {
67
- const legacyKey = `tovu${key[0].toUpperCase()}${key.slice(1)}`;
68
+ export function readCompatibleAgentPluginServerMetadata({ value, server }, { legacyMcpAliases } = {}) {
69
+ return Object.fromEntries(CANONICAL_MCP_KEYS.map(key => {
70
+ const legacyKey = legacyMcpAliases?.names[key];
68
71
  // Legacy adapters treated null aliases as absent; canonical null stays malformed.
69
- const declared = value[key] !== undefined ? value[key] : value[legacyKey] ?? undefined;
70
- const inline = server[key] !== undefined ? server[key] : server[legacyKey];
72
+ const declared = value[key] !== undefined ? value[key] : (legacyKey === undefined ? undefined : value[legacyKey] ?? undefined);
73
+ const inline = server[key] !== undefined ? server[key] : (legacyKey === undefined ? undefined : server[legacyKey]);
71
74
  return [key, declared !== undefined ? declared : inlineMetadata({ key, value: inline })];
72
75
  }));
73
76
  }
74
77
  /** Whether compatibility aliases were read, for the MCP parser's returned diagnostics. */
75
- export function hasLegacyAgentPluginServerMetadata({ value, server }, _optional = {}) {
76
- return ['tovuAuthMode', 'tovuDefaultTools', 'tovuTokenAuth', 'tovuRenamedTools'].some(key => Object.hasOwn(value, key) || Object.hasOwn(server, key));
78
+ export function hasLegacyAgentPluginServerMetadata({ value, server }, { legacyMcpAliases } = {}) {
79
+ return Object.values(legacyMcpAliases?.names ?? {}).some(k => k !== undefined && (Object.hasOwn(value, k) || Object.hasOwn(server, k)));
77
80
  }
78
81
  /** Transport declarations keep sign-in defaults, but reviewed reads require plugin.json metadata. */
79
82
  function inlineMetadata({ key, value }) {
@@ -0,0 +1,7 @@
1
+ /** "supabase" -> "Supabase", "higgsfield-media" -> "Higgsfield Media". There is no separate
2
+ * display-name field in `plugin.json` (agent-plugins.org has none) — `uninstall-confirmation-ui.ts`'s
3
+ * own dialog makes the identical choice, naming the plugin by its id. */
4
+ export declare function titleCaseFromPluginId(required: {
5
+ pluginId: string;
6
+ }, _optional?: Record<string, never>): string;
7
+ //# sourceMappingURL=plugin-display-name.d.ts.map
@@ -0,0 +1,11 @@
1
+ /** "supabase" -> "Supabase", "higgsfield-media" -> "Higgsfield Media". There is no separate
2
+ * display-name field in `plugin.json` (agent-plugins.org has none) — `uninstall-confirmation-ui.ts`'s
3
+ * own dialog makes the identical choice, naming the plugin by its id. */
4
+ export function titleCaseFromPluginId(required, _optional = {}) {
5
+ return required.pluginId
6
+ .split(/[-_]+/)
7
+ .filter((word) => word.length > 0)
8
+ .map((word) => word.charAt(0).toUpperCase() + word.slice(1))
9
+ .join(" ");
10
+ }
11
+ //# sourceMappingURL=plugin-display-name.js.map
@@ -0,0 +1,7 @@
1
+ import type { ProviderFacePorts } from "../site/provider-plugin-link.js";
2
+ /** The provider plugin `pluginId` is the face of, or undefined when it declares none. @complexity As `links`. */
3
+ export declare function linkedProviderOf({ ports, pluginId }: {
4
+ ports: Pick<ProviderFacePorts, "links">;
5
+ pluginId: string;
6
+ }, _optional?: Record<string, never>): Promise<string | undefined>;
7
+ //# sourceMappingURL=provider-plugin-link.d.ts.map
@@ -0,0 +1,5 @@
1
+ /** The provider plugin `pluginId` is the face of, or undefined when it declares none. @complexity As `links`. */
2
+ export async function linkedProviderOf({ ports, pluginId }, _optional = {}) {
3
+ return (await ports.links({})).get(pluginId);
4
+ }
5
+ //# sourceMappingURL=provider-plugin-link.js.map
@@ -1,4 +1,4 @@
1
- import type { TokenSignInPlugin } from './token-sign-in.js';
1
+ import type { TokenSignInPlugin } from '../connect/token-sign-in.js';
2
2
  /**
3
3
  * @file Bounded validation of access tokens handed over while a site is being CREATED, and of the
4
4
  * token-sign-in plugin rows a host lists for that form. Both inputs come from places the engine does
@@ -31,6 +31,16 @@ export declare function parsePluginTokenMap(required: {
31
31
  readonly raw: unknown;
32
32
  readonly limits: TokenMapLimits;
33
33
  }, _optional?: Record<string, never>): ParsedTokenMap;
34
+ /**
35
+ * The tokens a create form sends, from its `{ [pluginId]: typed value }` fields: trimmed, blanks
36
+ * dropped (a whitespace-only field means "skip", like an empty one), `undefined` when nothing was
37
+ * typed — so a create with no token sends exactly the input it always did. The client half of
38
+ * `parsePluginTokenMap`; the receiving side still validates with the host's limits.
39
+ * @complexity O(n) in the offered services.
40
+ */
41
+ export declare function tokensForCreate(required: {
42
+ readonly values: Readonly<Record<string, string>>;
43
+ }, _optional?: Record<string, never>): Record<string, string> | undefined;
34
44
  /**
35
45
  * The well-formed `{ pluginId, displayName, helpUrl }` entries of a host-supplied list. Rows are
36
46
  * rendered as links in a shell, so the help link must be `https:` (never `http:`/`javascript:`).
@@ -23,6 +23,21 @@ export function parsePluginTokenMap(required, _optional = {}) {
23
23
  }
24
24
  return { ok: true, tokens };
25
25
  }
26
+ /**
27
+ * The tokens a create form sends, from its `{ [pluginId]: typed value }` fields: trimmed, blanks
28
+ * dropped (a whitespace-only field means "skip", like an empty one), `undefined` when nothing was
29
+ * typed — so a create with no token sends exactly the input it always did. The client half of
30
+ * `parsePluginTokenMap`; the receiving side still validates with the host's limits.
31
+ * @complexity O(n) in the offered services.
32
+ */
33
+ export function tokensForCreate(required, _optional = {}) {
34
+ const out = {};
35
+ for (const [pluginId, value] of Object.entries(required.values)) {
36
+ if (value.trim() !== '')
37
+ out[pluginId] = value.trim();
38
+ }
39
+ return Object.keys(out).length > 0 ? out : undefined;
40
+ }
26
41
  /** A string token within the host's length limit, under an id the host's grammar admits. */
27
42
  function isAcceptableEntry(required, _optional = {}) {
28
43
  const { pluginId, value, limits } = required;
@@ -0,0 +1,18 @@
1
+ import type { AgentPluginTokenAuth, McpServerConfig } from "../lifecycle/manifest.js";
2
+ import type { TokenSignInPlugin } from "../connect/token-sign-in.js";
3
+ /** The plugin's one token-auth declaration, or `null` for none or more than one (the same rule
4
+ * `agent_plugin_set_access_token` refuses on). */
5
+ export declare function soleTokenAuth(servers: Readonly<Record<string, McpServerConfig>>): AgentPluginTokenAuth | null;
6
+ /**
7
+ * The installed plugins that take a pasted token, sorted by id.
8
+ * @complexity O(p·s) over installed plugins and their servers.
9
+ */
10
+ export declare function listTokenSignInPlugins(required: {
11
+ readonly workspaceId: string;
12
+ /** @agent-note Second host: your installed-plugin read (declared servers per plugin id); no filesystem default here. */
13
+ readonly listPlugins: (workspaceId: string) => Promise<readonly {
14
+ readonly pluginId: string;
15
+ readonly servers: Readonly<Record<string, McpServerConfig>>;
16
+ }[]>;
17
+ }, _optional?: Record<string, never>): Promise<readonly TokenSignInPlugin[]>;
18
+ //# sourceMappingURL=token-sign-in-list.d.ts.map
@@ -0,0 +1,23 @@
1
+ import { titleCaseFromPluginId } from "./plugin-display-name.js";
2
+ /** The plugin's one token-auth declaration, or `null` for none or more than one (the same rule
3
+ * `agent_plugin_set_access_token` refuses on). */
4
+ export function soleTokenAuth(servers) {
5
+ const declared = Object.values(servers).flatMap((config) => (config.type !== "stdio" && config.tokenAuth ? [config.tokenAuth] : []));
6
+ // Exactly one element was just checked, so `declared[0]` is present; the cast only narrows the
7
+ // index type (no fallback branch can ever run).
8
+ return declared.length === 1 ? declared[0] : null;
9
+ }
10
+ /**
11
+ * The installed plugins that take a pasted token, sorted by id.
12
+ * @complexity O(p·s) over installed plugins and their servers.
13
+ */
14
+ export async function listTokenSignInPlugins(required, _optional = {}) {
15
+ const plugins = await required.listPlugins(required.workspaceId);
16
+ return plugins
17
+ .flatMap(({ pluginId, servers }) => {
18
+ const auth = soleTokenAuth(servers);
19
+ return auth ? [{ pluginId, displayName: titleCaseFromPluginId({ pluginId }), helpUrl: auth.helpUrl }] : [];
20
+ })
21
+ .sort((a, b) => a.pluginId.localeCompare(b.pluginId));
22
+ }
23
+ //# sourceMappingURL=token-sign-in-list.js.map
@@ -0,0 +1,8 @@
1
+ export declare class AgentPluginUpdateError extends Error {
2
+ readonly code: string;
3
+ constructor(required: {
4
+ code: string;
5
+ message: string;
6
+ }, optional?: ErrorOptions);
7
+ }
8
+ //# sourceMappingURL=update-error.d.ts.map
@@ -0,0 +1,9 @@
1
+ export class AgentPluginUpdateError extends Error {
2
+ code;
3
+ constructor(required, optional = {}) {
4
+ super(required.message, optional);
5
+ this.code = required.code;
6
+ this.name = 'AgentPluginUpdateError';
7
+ }
8
+ }
9
+ //# sourceMappingURL=update-error.js.map
@@ -1,4 +1,4 @@
1
- import type { InstalledAgentPlugin } from './types.js';
1
+ import type { InstalledAgentPlugin } from "@jini-ai/core/contracts/site/agent-plugins-lifecycle";
2
2
  type Revision = Pick<InstalledAgentPlugin, 'pluginId' | 'archiveDigest' | 'version'> & {
3
3
  readonly enabled?: boolean;
4
4
  };
@@ -0,0 +1,74 @@
1
+ import type { MediaTranscoderPort, StagedMediaFile, StagedMediaTranscoderPort, VideoTranscodeFailureReason } from "@jini-ai/core/contracts/site/cms-media";
2
+ /** Local executables the converter needs; ffprobe ships with ffmpeg and is only located, never run here. */
3
+ export interface VideoBinaries {
4
+ readonly nice: string;
5
+ readonly ffmpeg: string;
6
+ readonly ffprobe: string;
7
+ }
8
+ export type VideoBinaryFinder = (required: Record<string, never>, optional: {
9
+ env?: NodeJS.ProcessEnv;
10
+ platform?: NodeJS.Platform;
11
+ }) => Promise<VideoBinaries | undefined>;
12
+ export type VideoProcessRunner = (required: {
13
+ command: string;
14
+ args: readonly string[];
15
+ }, optional: {
16
+ timeoutMs: number;
17
+ maxOutputBytes: number;
18
+ signal?: AbortSignal;
19
+ }) => Promise<Uint8Array>;
20
+ export interface VideoExtractionLock {
21
+ /** Synchronous acquisition prevents races before the first awaited step. */
22
+ tryAcquire(required: Record<string, never>, optional: Record<string, never>): (() => void) | undefined;
23
+ }
24
+ /** Long clips at nice 19 are slow; a hard bound still stops a stuck decoder. */
25
+ export declare const VIDEO_TRANSCODE_TIMEOUT_MS: number;
26
+ /**
27
+ * The exact ffmpeg argument list for a web-safe MP4. Pure, so it is tested without a binary.
28
+ * Beyond the planned codec flags: `-pix_fmt yuv420p` because phone HEVC is often 10-bit and a
29
+ * 10-bit H.264 stream does not play in browsers; `-maxrate/-bufsize` cap the bitrate of large
30
+ * videos; `-fs` stops writing past the output cap; `-n` never overwrites an existing file.
31
+ * @complexity O(1).
32
+ */
33
+ export declare function buildVideoTranscodeArgs({ input, output, maxOutputBytes }: {
34
+ input: string;
35
+ output: string;
36
+ maxOutputBytes: number;
37
+ }, _optional?: Record<string, never>): string[];
38
+ /** Everything the host must supply; none of it is optional so no ambient lookup can sneak in. */
39
+ export interface FfmpegMediaTranscoderRequired {
40
+ sealStagedFile: (required: {
41
+ root: string;
42
+ path: string;
43
+ maxBytes: number;
44
+ }, optional?: {
45
+ signal?: AbortSignal;
46
+ }) => Promise<StagedMediaFile>;
47
+ findBinaries: VideoBinaryFinder;
48
+ runProcess: VideoProcessRunner;
49
+ /** Share with the frame extractor's lock to keep one ffmpeg per process; defaults to a per-adapter lock. The host now supplies it, so there is no default here. */
50
+ lock: VideoExtractionLock;
51
+ /** Names the real type of the converted bytes; only an MP4 result is accepted. */
52
+ sniffContentType: (required: {
53
+ bytes: Uint8Array;
54
+ }) => string | undefined;
55
+ /** Largest original accepted, and the default cap on the converted output. */
56
+ maxInputBytes: number;
57
+ /** Plain-words message per failure reason, owned by the host's media policy. */
58
+ messages: Readonly<Record<VideoTranscodeFailureReason, string>>;
59
+ /** Environment handed to binary discovery. */
60
+ env: NodeJS.ProcessEnv;
61
+ }
62
+ export interface FfmpegMediaTranscoderOptional {
63
+ /** Directory for private per-conversion temp folders (defaults to the OS temp directory). */
64
+ tempDir?: string | undefined;
65
+ timeoutMs?: number | undefined;
66
+ }
67
+ /**
68
+ * Creates the ffmpeg-backed transcoder. Missing ffmpeg (or nice/ffprobe, which ship with it on
69
+ * supported hosts; Windows is never supported because nice is required) is reported with the
70
+ * host's own "unavailable" message. Temp files are removed in every outcome.
71
+ * @complexity O(n) in video bytes plus one ffmpeg process.
72
+ */
73
+ export declare function createFfmpegMediaTranscoder({ findBinaries, runProcess, lock, sniffContentType, maxInputBytes, messages, env, sealStagedFile }: FfmpegMediaTranscoderRequired, { tempDir, timeoutMs }?: FfmpegMediaTranscoderOptional): MediaTranscoderPort & StagedMediaTranscoderPort;
74
+ //# sourceMappingURL=adapter.d.ts.map
@@ -0,0 +1,155 @@
1
+ /**
2
+ * @file ffmpeg adapter for {@link MediaTranscoderPort}: a local ffmpeg binary, run at nice 19 on
3
+ * private temp files, one conversion at a time per lock.
4
+ *
5
+ * Reuses `video-frames.ffmpeg.ts`'s binary discovery, low-priority process runner (process-group
6
+ * kill, timeout, abort) and lock type. Arguments are always an array, never a shell string, and
7
+ * input parsing is restricted to local files and the container demuxers phones and browsers produce.
8
+ * Since the move out of the CMS package those three arrive as host-supplied ports rather than imports.
9
+ *
10
+ * Why-comment — conversion is a host capability with local process risk, not a dependency of
11
+ * portable media services. The host hands in binary discovery, the process runner (process-group
12
+ * kill, timeout, abort), the lock, the byte sniffer and the policy, so this file imports no media
13
+ * package. ffmpeg is never bundled.
14
+ */
15
+ import { mkdtemp, readFile, rm, stat, writeFile } from "node:fs/promises";
16
+ import { tmpdir } from "node:os";
17
+ import { join } from "node:path";
18
+ /** Long clips at nice 19 are slow; a hard bound still stops a stuck decoder. */
19
+ export const VIDEO_TRANSCODE_TIMEOUT_MS = 30 * 60_000;
20
+ const DIAGNOSTIC_OUTPUT_BYTES = 64 * 1024;
21
+ /**
22
+ * The exact ffmpeg argument list for a web-safe MP4. Pure, so it is tested without a binary.
23
+ * Beyond the planned codec flags: `-pix_fmt yuv420p` because phone HEVC is often 10-bit and a
24
+ * 10-bit H.264 stream does not play in browsers; `-maxrate/-bufsize` cap the bitrate of large
25
+ * videos; `-fs` stops writing past the output cap; `-n` never overwrites an existing file.
26
+ * @complexity O(1).
27
+ */
28
+ export function buildVideoTranscodeArgs({ input, output, maxOutputBytes }, _optional = {}) {
29
+ return [
30
+ "-hide_banner", "-loglevel", "error", "-nostdin", "-n",
31
+ "-protocol_whitelist", "file", "-format_whitelist", "mov,matroska,webm",
32
+ "-i", input,
33
+ // First video and (if any) first audio stream; subtitles/data tracks are dropped.
34
+ "-map", "0:v:0", "-map", "0:a:0?", "-sn", "-dn",
35
+ "-c:v", "libx264", "-preset", "veryfast", "-crf", "23", "-maxrate", "8M", "-bufsize", "16M",
36
+ "-vf", "scale='min(1920,iw)':-2", "-pix_fmt", "yuv420p",
37
+ "-c:a", "aac", "-b:a", "128k",
38
+ "-movflags", "+faststart", "-fs", String(maxOutputBytes), "-f", "mp4", output,
39
+ ];
40
+ }
41
+ const PROCESS_REASONS = new Set(["unavailable", "timeout", "canceled", "invalid"]);
42
+ /** Writes the input, runs ffmpeg, and reads back a size-checked MP4. Temp files are the caller's to remove. */
43
+ async function transcodeInDirectory({ binaries, directory, input, signal, maxOutputBytes, timeoutMs, runProcess, sniffContentType, failure }) {
44
+ const inputPath = join(directory, "input");
45
+ const outputPath = join(directory, "output.mp4");
46
+ await writeFile(inputPath, input, { mode: 0o600, flag: "wx" });
47
+ const args = buildVideoTranscodeArgs({ input: inputPath, output: outputPath, maxOutputBytes });
48
+ await runProcess({ command: binaries.nice, args: ["-n", "19", binaries.ffmpeg, ...args] }, { timeoutMs, maxOutputBytes: DIAGNOSTIC_OUTPUT_BYTES, ...(signal ? { signal } : {}) });
49
+ // -fs is packet-granular, so check the real size before loading the file.
50
+ if ((await stat(outputPath)).size > maxOutputBytes)
51
+ return failure("too-large");
52
+ const bytes = new Uint8Array(await readFile(outputPath));
53
+ return sniffContentType({ bytes }) === "video/mp4" ? { ok: true, bytes } : failure("invalid");
54
+ }
55
+ /** The shared runner rejects with an error carrying `reason`; anything else is an unreadable clip. */
56
+ function reasonOf(error) {
57
+ const reason = error?.reason;
58
+ return typeof reason === "string" && PROCESS_REASONS.has(reason) ? reason : "invalid";
59
+ }
60
+ /** Refusals that need neither a binary nor scratch space (an aborted call or an oversize input), checked before the lock. */
61
+ function earlyRefusal({ input, maxInputBytes }, { signal }) {
62
+ if (signal?.aborted)
63
+ return "canceled";
64
+ return input.byteLength > maxInputBytes ? "too-large" : undefined;
65
+ }
66
+ function stagedCommand({ input, maxOutputBytes, signal }) {
67
+ signal?.throwIfAborted();
68
+ const path = join(input.root, "output.mp4");
69
+ return { path, args: buildVideoTranscodeArgs({ input: input.path, output: path, maxOutputBytes }) };
70
+ }
71
+ function stagedSignalOptions(signal) {
72
+ return signal ? { signal } : {};
73
+ }
74
+ function stagedProcessFailureReason(error, signal) {
75
+ const reason = error?.reason;
76
+ if (signal?.aborted)
77
+ return "canceled";
78
+ return reason === "too-large" ? "too-large" : reasonOf(error);
79
+ }
80
+ function stagedAbortRequested(signal) {
81
+ return Boolean(signal?.aborted);
82
+ }
83
+ /** Runs one conversion in a fresh private temp folder; the folder and the held lock are released in every outcome. */
84
+ async function transcodeHoldingLock({ release, tempDir, run }, _optional = {}) {
85
+ let directory;
86
+ try {
87
+ directory = await mkdtemp(join(tempDir, "video-transcode-"));
88
+ return await transcodeInDirectory({ ...run, directory });
89
+ }
90
+ catch (error) {
91
+ return run.failure(reasonOf(error));
92
+ }
93
+ finally {
94
+ // Cleanup failure must not mask the result; the folder name is unique and private.
95
+ if (directory)
96
+ await rm(directory, { recursive: true, force: true }).catch(() => undefined);
97
+ release();
98
+ }
99
+ }
100
+ // Web-safe video conversion through a local ffmpeg binary (optional host codec).
101
+ /**
102
+ * Creates the ffmpeg-backed transcoder. Missing ffmpeg (or nice/ffprobe, which ship with it on
103
+ * supported hosts; Windows is never supported because nice is required) is reported with the
104
+ * host's own "unavailable" message. Temp files are removed in every outcome.
105
+ * @complexity O(n) in video bytes plus one ffmpeg process.
106
+ */
107
+ export function createFfmpegMediaTranscoder({ findBinaries, runProcess, lock, sniffContentType, maxInputBytes, messages, env, sealStagedFile }, { tempDir = tmpdir(), timeoutMs = VIDEO_TRANSCODE_TIMEOUT_MS } = {}) {
108
+ const failure = (reason) => ({ ok: false, reason, message: messages[reason] });
109
+ // Why-comment — conversion is a host capability with local process risk, not a dependency of portable media services.
110
+ return {
111
+ async transcodeStaged({ input, consume }, { signal, maxOutputBytes = maxInputBytes } = {}) {
112
+ const refused = earlyRefusal({ input, maxInputBytes }, { signal });
113
+ if (refused)
114
+ return failure(refused);
115
+ const binaries = await findBinaries({}, { env });
116
+ if (!binaries)
117
+ return failure("unavailable");
118
+ const release = lock.tryAcquire({}, {});
119
+ if (!release)
120
+ return failure("busy");
121
+ try {
122
+ let output;
123
+ try {
124
+ const { path, args } = stagedCommand({ input, maxOutputBytes, signal });
125
+ await runProcess({ command: binaries.nice, args: ["-n", "19", binaries.ffmpeg, ...args] }, { timeoutMs, maxOutputBytes: DIAGNOSTIC_OUTPUT_BYTES, ...stagedSignalOptions(signal) });
126
+ if (stagedAbortRequested(signal))
127
+ return failure("canceled");
128
+ output = await sealStagedFile({ root: input.root, path, maxBytes: maxOutputBytes }, stagedSignalOptions(signal));
129
+ }
130
+ catch (error) {
131
+ return failure(stagedProcessFailureReason(error, signal));
132
+ }
133
+ if (stagedAbortRequested(signal))
134
+ return failure("canceled");
135
+ return { ok: true, value: await consume(output) };
136
+ }
137
+ finally {
138
+ release();
139
+ }
140
+ },
141
+ async transcode({ input }, { signal, maxOutputBytes = maxInputBytes } = {}) {
142
+ const refused = earlyRefusal({ input, maxInputBytes }, { signal });
143
+ if (refused)
144
+ return failure(refused);
145
+ const binaries = await findBinaries({}, { env });
146
+ if (!binaries)
147
+ return failure("unavailable");
148
+ const release = lock.tryAcquire({}, {});
149
+ if (!release)
150
+ return failure("busy");
151
+ return transcodeHoldingLock({ release, tempDir, run: { binaries, input, signal, maxOutputBytes, timeoutMs, runProcess, sniffContentType, failure } });
152
+ },
153
+ };
154
+ }
155
+ //# sourceMappingURL=adapter.js.map
@@ -1,3 +1,4 @@
1
+ import { type AgentPluginIdentityReadOptions } from './core/identity-namespace.js';
1
2
  /** Reads a local folder into the browser upload encoder. Refuses links/special files and bounds
2
3
  * entries and bytes before allocation; the resulting ZIP still requires the install validator.
3
4
  * @throws {FolderZipError} Empty, unreadable, linked, or over-limit folders.
@@ -28,5 +29,5 @@ export interface CustomizeAgentPluginFolderInput {
28
29
  * @complexity O(e log e + b) time and O(e + b) space, bounded by upload entry/byte ceilings.
29
30
  * @example zipCustomizedAgentPluginFolder({ path, maxBytes, name: 'my-plugin', identityNamespace: 'host', edit })
30
31
  */
31
- export declare function zipCustomizedAgentPluginFolder(required: CustomizeAgentPluginFolderInput, _optional?: Record<string, never>): Promise<Uint8Array>;
32
+ export declare function zipCustomizedAgentPluginFolder(required: CustomizeAgentPluginFolderInput, optional?: Pick<AgentPluginIdentityReadOptions, "legacyIdentity">): Promise<Uint8Array>;
32
33
  //# sourceMappingURL=folder-zip-node.d.ts.map
@@ -1,7 +1,8 @@
1
1
  import * as fs from "node:fs/promises";
2
2
  import { constants } from "node:fs";
3
3
  import path from "node:path";
4
- import { FOLDER_MAX_FILES, FOLDER_UNREADABLE, FolderZipError, zipFolderFiles } from "./folder-zip.js";
4
+ import { FOLDER_MAX_FILES, FOLDER_UNREADABLE, zipFolderFiles } from "./folder-zip.js";
5
+ import { FolderZipError } from "./core/folder-zip-error.js";
5
6
  import { isAgentPluginName } from './core/plugin-name.js';
6
7
  import { readAgentPluginPortableExtension } from './core/identity-namespace.js';
7
8
  /** Code-unit order, independent of locale. */
@@ -147,7 +148,7 @@ function sanitizeHostIdentities({ extensions, localId }) {
147
148
  }
148
149
  /** A fork must not retain its publisher identity or historical aliases and supersession claims.
149
150
  * The requesting host always gets a fresh `local/<name>` id, even when the source declared none. */
150
- function customizeManifest({ text, name, identityNamespace }) {
151
+ function customizeManifest({ text, name, identityNamespace }, optional = {}) {
151
152
  const manifest = JSON.parse(text);
152
153
  if (!isAgentPluginName({ value: name }) || manifest.name === name) {
153
154
  throw new FolderZipError('unreadable', 'Choose a valid new Agent Plugin id different from the source.');
@@ -158,7 +159,7 @@ function customizeManifest({ text, name, identityNamespace }) {
158
159
  throw new FolderZipError('unreadable', 'plugin.json extensions must be an object.');
159
160
  const localId = `local/${name}`;
160
161
  // Creating the portable key must preserve the installed copy's capabilities and display copy.
161
- manifest.extensions[identityNamespace] ??= identityNamespace === 'jini' ? { ...readAgentPluginPortableExtension({ value: manifest }) } : {};
162
+ manifest.extensions[identityNamespace] ??= identityNamespace === 'jini' ? { ...readAgentPluginPortableExtension({ value: manifest }, optional) } : {};
162
163
  sanitizeHostIdentities({ extensions: manifest.extensions, localId });
163
164
  const host = manifest.extensions[identityNamespace];
164
165
  if (isPlainObject(host))
@@ -174,7 +175,7 @@ function customizeManifest({ text, name, identityNamespace }) {
174
175
  * @complexity O(e log e + b) time and O(e + b) space, bounded by upload entry/byte ceilings.
175
176
  * @example zipCustomizedAgentPluginFolder({ path, maxBytes, name: 'my-plugin', identityNamespace: 'host', edit })
176
177
  */
177
- export async function zipCustomizedAgentPluginFolder(required, _optional = {}) {
178
+ export async function zipCustomizedAgentPluginFolder(required, optional = {}) {
178
179
  const files = await collectLocalFiles(required);
179
180
  // Match captured package paths, never join a model-supplied edit path onto the filesystem.
180
181
  const target = files.findIndex(file => file.webkitRelativePath === `folder/${required.edit.path}`);
@@ -184,7 +185,7 @@ export async function zipCustomizedAgentPluginFolder(required, _optional = {}) {
184
185
  }
185
186
  const text = decodeEditableText(new Uint8Array(await files[target].arrayBuffer()));
186
187
  files[target] = replaceCapturedFile({ file: files[target], text: customizeText({ text, edit: required.edit }) });
187
- files[manifest] = replaceCapturedFile({ file: files[manifest], text: customizeManifest({ text: await files[manifest].text(), name: required.name, identityNamespace: required.identityNamespace }) });
188
+ files[manifest] = replaceCapturedFile({ file: files[manifest], text: customizeManifest({ text: await files[manifest].text(), name: required.name, identityNamespace: required.identityNamespace }, optional) });
188
189
  return encodeLocalFiles({ files, maxBytes: required.maxBytes });
189
190
  }
190
191
  //# sourceMappingURL=folder-zip-node.js.map
@@ -15,10 +15,6 @@ export declare const FOLDER_UNREADABLE = "Could not read that folder. Try again.
15
15
  /** The archive readers' entry cap (`install-archive.ts`, the Agent Plugins reader): refused here
16
16
  * before any bytes are read. */
17
17
  export declare const FOLDER_MAX_FILES = 4096;
18
- export declare class FolderZipError extends Error {
19
- readonly reason: "empty" | "too-large" | "too-many" | "unreadable";
20
- constructor(reason: "empty" | "too-large" | "too-many" | "unreadable", message: string);
21
- }
22
18
  /** @complexity O(n) in the byte count. */
23
19
  export declare function crc32({ bytes }: {
24
20
  bytes: Uint8Array;