@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
@@ -0,0 +1,25 @@
1
+ export function toObjectArgArchiveReader({ reader }, _optional = {}) {
2
+ return {
3
+ async *entries({ archive }) {
4
+ for await (const entry of reader.entries({ archive })) {
5
+ if (entry.kind !== 'file')
6
+ yield entry;
7
+ else
8
+ yield { ...entry, openReadStream: (_required) => entry.openReadStream() };
9
+ }
10
+ },
11
+ };
12
+ }
13
+ export function toZeroArgArchiveReader({ reader }, _optional = {}) {
14
+ return {
15
+ async *entries({ archive }) {
16
+ for await (const entry of reader.entries({ archive })) {
17
+ if (entry.kind !== 'file')
18
+ yield entry;
19
+ else
20
+ yield { ...entry, openReadStream: () => entry.openReadStream({}) };
21
+ }
22
+ },
23
+ };
24
+ }
25
+ //# sourceMappingURL=archive-reader-abi.js.map
@@ -0,0 +1,110 @@
1
+ import type { CredentialSchemeRule, CredentialSchemeRegistry } from "@jini-ai/core/contracts/site/integrations-credentialed-http";
2
+ import type { LoadPluginContributionsOptional, PluginContributionDefinition, PluginContributionResult, TrustedPluginPackage } from "@jini-ai/agent-plugins/lifecycle";
3
+ import type { BundledContributionSources } from "@jini-ai/agent-plugins/site/bundled-contribution-sources";
4
+ /**
5
+ * @file Self-describing token schemes: tokens that carry their own `Authorization` scheme word as a
6
+ * leading prefix (a vendor token such as `<Scheme><rest>` must be sent as `Authorization: <Scheme>
7
+ * <rest>`, and is rejected when sent as `Bearer <whole token>`). Core names no vendor: the rules are
8
+ * DATA that Agent Plugins ship in {@link CREDENTIAL_SCHEMES_FILENAME}, and Jini applies them.
9
+ * A bundled hosting plugin ships the one rule known today, with its live-verification
10
+ * evidence in the file's `note`.
11
+ *
12
+ * Recognition is by the token's own content, never by the credential's saved host: a
13
+ * `custom_credential_sets` row has no provider id (only an operator-typed label, base URL and token),
14
+ * and a credential saved with a proxied base URL still carries the same self-describing token.
15
+ * Dispatch is try-each-in-turn, first match wins, so rules should keep their prefixes disjoint.
16
+ *
17
+ * TRUST GATES (`Jini packages/agent-plugins/src/lifecycle/trusted-plugin-files.ts`). The bundled-digest gate applies:
18
+ * only a plugin package this build shipped may add a rule, since a rule decides how a saved secret is
19
+ * sent. The activation gate deliberately does NOT apply: a rule is inert data (no code runs), and a
20
+ * saved credential that already works must keep working unchanged when an operator switches the
21
+ * contributing plugin off. Switching that plugin off hides its deploy tools; it must not silently turn a
22
+ * working credential's header into one its provider rejects.
23
+ *
24
+ * Architectural role: read by the host's credentialed-request capability. The host injects its
25
+ * lifecycle owner's contribution loaders, its bundled-source policy (`sources`) and the integrations
26
+ * package's `parseCredentialSchemesFile`; see `README.md` `## Wiring`.
27
+ *
28
+ * Contract rationale for the Jini implementation and this host boundary:
29
+ *
30
+ * One scheme rule: a token starting with `prefix` (case-sensitive, with at least one character after
31
+ * it) is sent as `Authorization: <scheme> <rest of the token>`. `id` is bookkeeping only.
32
+ *
33
+ * One recognized self-describing token: the `scheme` word to send, and the `value` that follows it
34
+ * in the token (everything after the prefix, unmodified).
35
+ *
36
+ * The rules a workspace's trusted plugins contribute, plus every file or rule that was dropped.
37
+ *
38
+ * An HTTP auth-scheme name is an RFC 9110 `token`.
39
+ *
40
+ * Returns the first rule whose `prefix` is a genuine leading prefix of `token` (case-sensitive) with
41
+ * at least one character left after it, or `null`. A token that IS exactly the prefix has no
42
+ * credential value left to send and falls through to ordinary Bearer/Basic handling, as does a token
43
+ * that merely contains a prefix later in the string. Pure.
44
+ *
45
+ * @complexity O(r) rules, each one `startsWith`.
46
+ *
47
+ * Parses a plugin's {@link CREDENTIAL_SCHEMES_FILENAME}. Pure; the parser is exported by Jini for direct tests. Unknown
48
+ * keys (such as a rule's `note`) are ignored.
49
+ *
50
+ * @complexity O(r) in the declared rule count.
51
+ *
52
+ * One rule entry, or the reason it is invalid. @complexity O(1).
53
+ */
54
+ /** The file a plugin ships at its root to contribute self-describing token scheme rules. */
55
+ export declare const CREDENTIAL_SCHEMES_FILENAME = "jini-credential-schemes.json";
56
+ /** The integrations package's scheme-file parser (`@jini-ai/integrations/credentialed-http`), injected. */
57
+ export type ParseCredentialSchemesFile = (required: {
58
+ raw: string;
59
+ }) => {
60
+ readonly ok: true;
61
+ readonly rules: readonly CredentialSchemeRule[];
62
+ } | {
63
+ readonly ok: false;
64
+ readonly reason: string;
65
+ };
66
+ /** The lifecycle owner's trust-gated (installed) contribution loader. */
67
+ export type LoadCredentialSchemeContributions = <D, T>(input: {
68
+ readonly workspaceId: string;
69
+ readonly definition: PluginContributionDefinition<D, T>;
70
+ }, options?: LoadPluginContributionsOptional) => Promise<PluginContributionResult<T>>;
71
+ /** The lifecycle owner's explicitly trusted source-directory loader. */
72
+ export type LoadCredentialSchemeContributionsFromSource = <D, T>(input: {
73
+ readonly plugin: TrustedPluginPackage;
74
+ readonly definition: PluginContributionDefinition<D, T>;
75
+ }) => Promise<PluginContributionResult<T>>;
76
+ /** What a source-directory read needs from the host. */
77
+ export interface CredentialSchemeSourcePorts {
78
+ readonly loadFromSource: LoadCredentialSchemeContributionsFromSource;
79
+ readonly parseCredentialSchemesFile: ParseCredentialSchemesFile;
80
+ }
81
+ /**
82
+ * This workspace's scheme rules, from installed plugins that pass the bundled-digest gate (and NOT
83
+ * the activation gate, see this file's header). Read fresh on every call: a credentialed request is
84
+ * agent-triggered, not a hot path.
85
+ *
86
+ * @throws Nothing for a plugin-level fault; only a filesystem fault listing the workspace's package
87
+ * directory itself propagates.
88
+ * @param required - Contribution loader from this boot's lifecycle; no site-dependent module default.
89
+ * @complexity O(p) installed plugins, one small file read per contributing plugin.
90
+ */
91
+ export declare function loadCredentialSchemeRegistry(required: {
92
+ readonly workspaceId: string;
93
+ readonly loadContributions: LoadCredentialSchemeContributions;
94
+ readonly parseCredentialSchemesFile: ParseCredentialSchemesFile;
95
+ }, _optional?: Record<string, never>): Promise<CredentialSchemeRegistry>;
96
+ /**
97
+ * Rules read straight from a plugin's SOURCE directory, with no install or digest gate. For the
98
+ * hermetic composition root and tests only, where the directory is this product's own
99
+ * `content/agent-plugins/<id>/`: never point it at anything an operator or a third party can write.
100
+ *
101
+ * @complexity O(r) declared rules.
102
+ */
103
+ export declare function loadCredentialSchemeRegistryFromSource(plugin: TrustedPluginPackage & CredentialSchemeSourcePorts, _optional?: Record<string, never>): Promise<CredentialSchemeRegistry>;
104
+ /** Union of the host's bundled scheme data. Activation remains irrelevant to token recognition;
105
+ * installed loading still uses Jini's digest gate. @complexity O(p + rules). */
106
+ export declare function loadBundledCredentialSchemeRegistry(required: {
107
+ readonly sourceRoot: string;
108
+ readonly sources: BundledContributionSources;
109
+ } & CredentialSchemeSourcePorts, _optional?: Record<string, never>): Promise<CredentialSchemeRegistry>;
110
+ //# sourceMappingURL=auth-schemes.d.ts.map
@@ -0,0 +1,119 @@
1
+ // Token-prefix rationale: Jini/packages/integrations/src/credentialed-http/auth-schemes.ts; plugin trust stays here.
2
+ /**
3
+ * @file Self-describing token schemes: tokens that carry their own `Authorization` scheme word as a
4
+ * leading prefix (a vendor token such as `<Scheme><rest>` must be sent as `Authorization: <Scheme>
5
+ * <rest>`, and is rejected when sent as `Bearer <whole token>`). Core names no vendor: the rules are
6
+ * DATA that Agent Plugins ship in {@link CREDENTIAL_SCHEMES_FILENAME}, and Jini applies them.
7
+ * A bundled hosting plugin ships the one rule known today, with its live-verification
8
+ * evidence in the file's `note`.
9
+ *
10
+ * Recognition is by the token's own content, never by the credential's saved host: a
11
+ * `custom_credential_sets` row has no provider id (only an operator-typed label, base URL and token),
12
+ * and a credential saved with a proxied base URL still carries the same self-describing token.
13
+ * Dispatch is try-each-in-turn, first match wins, so rules should keep their prefixes disjoint.
14
+ *
15
+ * TRUST GATES (`Jini packages/agent-plugins/src/lifecycle/trusted-plugin-files.ts`). The bundled-digest gate applies:
16
+ * only a plugin package this build shipped may add a rule, since a rule decides how a saved secret is
17
+ * sent. The activation gate deliberately does NOT apply: a rule is inert data (no code runs), and a
18
+ * saved credential that already works must keep working unchanged when an operator switches the
19
+ * contributing plugin off. Switching that plugin off hides its deploy tools; it must not silently turn a
20
+ * working credential's header into one its provider rejects.
21
+ *
22
+ * Architectural role: read by the host's credentialed-request capability. The host injects its
23
+ * lifecycle owner's contribution loaders, its bundled-source policy (`sources`) and the integrations
24
+ * package's `parseCredentialSchemesFile`; see `README.md` `## Wiring`.
25
+ *
26
+ * Contract rationale for the Jini implementation and this host boundary:
27
+ *
28
+ * One scheme rule: a token starting with `prefix` (case-sensitive, with at least one character after
29
+ * it) is sent as `Authorization: <scheme> <rest of the token>`. `id` is bookkeeping only.
30
+ *
31
+ * One recognized self-describing token: the `scheme` word to send, and the `value` that follows it
32
+ * in the token (everything after the prefix, unmodified).
33
+ *
34
+ * The rules a workspace's trusted plugins contribute, plus every file or rule that was dropped.
35
+ *
36
+ * An HTTP auth-scheme name is an RFC 9110 `token`.
37
+ *
38
+ * Returns the first rule whose `prefix` is a genuine leading prefix of `token` (case-sensitive) with
39
+ * at least one character left after it, or `null`. A token that IS exactly the prefix has no
40
+ * credential value left to send and falls through to ordinary Bearer/Basic handling, as does a token
41
+ * that merely contains a prefix later in the string. Pure.
42
+ *
43
+ * @complexity O(r) rules, each one `startsWith`.
44
+ *
45
+ * Parses a plugin's {@link CREDENTIAL_SCHEMES_FILENAME}. Pure; the parser is exported by Jini for direct tests. Unknown
46
+ * keys (such as a rule's `note`) are ignored.
47
+ *
48
+ * @complexity O(r) in the declared rule count.
49
+ *
50
+ * One rule entry, or the reason it is invalid. @complexity O(1).
51
+ */
52
+ /** The file a plugin ships at its root to contribute self-describing token scheme rules. */
53
+ export const CREDENTIAL_SCHEMES_FILENAME = "jini-credential-schemes.json";
54
+ /** A package without the file (possible only on the source path) contributes nothing. @complexity O(1). */
55
+ function schemeContribution(parseCredentialSchemesFile) {
56
+ return {
57
+ filename: CREDENTIAL_SCHEMES_FILENAME, contribution: "credential schemes", kind: "data",
58
+ parse: ({ raw }) => {
59
+ const parsed = parseCredentialSchemesFile({ raw });
60
+ return parsed.ok ? { ok: true, descriptors: parsed.rules } : parsed;
61
+ },
62
+ load: ({ descriptor }) => descriptor,
63
+ onReadError: ({ error }) => error.code === "ENOENT" ? [] : undefined,
64
+ };
65
+ }
66
+ /**
67
+ * This workspace's scheme rules, from installed plugins that pass the bundled-digest gate (and NOT
68
+ * the activation gate, see this file's header). Read fresh on every call: a credentialed request is
69
+ * agent-triggered, not a hot path.
70
+ *
71
+ * @throws Nothing for a plugin-level fault; only a filesystem fault listing the workspace's package
72
+ * directory itself propagates.
73
+ * @param required - Contribution loader from this boot's lifecycle; no site-dependent module default.
74
+ * @complexity O(p) installed plugins, one small file read per contributing plugin.
75
+ */
76
+ export async function loadCredentialSchemeRegistry(required, _optional = {}) {
77
+ const load = await required.loadContributions({ workspaceId: required.workspaceId, definition: schemeContribution(required.parseCredentialSchemesFile) }, { requireActive: false });
78
+ return dropDuplicateIds(load.items, load.refusals);
79
+ }
80
+ /**
81
+ * Rules read straight from a plugin's SOURCE directory, with no install or digest gate. For the
82
+ * hermetic composition root and tests only, where the directory is this product's own
83
+ * `content/agent-plugins/<id>/`: never point it at anything an operator or a third party can write.
84
+ *
85
+ * @complexity O(r) declared rules.
86
+ */
87
+ export async function loadCredentialSchemeRegistryFromSource(plugin, _optional = {}) {
88
+ const load = await plugin.loadFromSource({
89
+ plugin: { pluginId: plugin.pluginId, packageRoot: plugin.packageRoot }, definition: schemeContribution(plugin.parseCredentialSchemesFile),
90
+ });
91
+ return dropDuplicateIds(load.items, load.refusals);
92
+ }
93
+ /** Union of the host's bundled scheme data. Activation remains irrelevant to token recognition;
94
+ * installed loading still uses Jini's digest gate. @complexity O(p + rules). */
95
+ export async function loadBundledCredentialSchemeRegistry(required, _optional = {}) {
96
+ const rules = [];
97
+ const refusals = [];
98
+ for (const plugin of required.sources({ sourceRoot: required.sourceRoot, filename: CREDENTIAL_SCHEMES_FILENAME })) {
99
+ const registry = await loadCredentialSchemeRegistryFromSource({
100
+ ...plugin, loadFromSource: required.loadFromSource, parseCredentialSchemesFile: required.parseCredentialSchemesFile,
101
+ });
102
+ rules.push(...registry.rules);
103
+ refusals.push(...registry.refusals);
104
+ }
105
+ return dropDuplicateIds(rules, refusals);
106
+ }
107
+ /** Drops every rule id more than one plugin declares ("refusing to guess"). Order of the survivors is
108
+ * kept, so first-match dispatch stays deterministic. @complexity O(r). */
109
+ function dropDuplicateIds(rules, refusals) {
110
+ const counts = new Map();
111
+ for (const rule of rules)
112
+ counts.set(rule.id, (counts.get(rule.id) ?? 0) + 1);
113
+ const duplicated = [...counts].filter(([, count]) => count > 1).map(([id]) => id);
114
+ return {
115
+ rules: rules.filter((rule) => counts.get(rule.id) === 1),
116
+ refusals: [...refusals, ...duplicated.map((id) => `credential scheme '${id}' was not loaded: more than one plugin declares it`)],
117
+ };
118
+ }
119
+ //# sourceMappingURL=auth-schemes.js.map
@@ -0,0 +1,200 @@
1
+ import type { createAutomaticAgentPluginUse, readChatAgentPluginState, AutomaticAgentPluginPorts, ChatAgentPluginState } from '../lifecycle/index.js';
2
+ import { buildDomainRegistrations, type AgentToolDefinition, type Principal, type SurfaceEmitter } from '@jini-ai/core';
3
+ import type { AgentPluginGuidanceAttempt, AgentPluginGuidanceOffer, PrepareToolGuidance } from '@jini-ai/core/contracts/site/daemon';
4
+ import type { ChatDeleteSurfaceDeps } from '@jini-ai/core/contracts/site/daemon-surface-exchanges';
5
+ import type { PluginMaturity } from '../lifecycle/host-tools/index.js';
6
+ import type { AgentPluginPreferencesPort } from './service-ports.js';
7
+ import type { AgentPluginWorkspaceLayout } from '@jini-ai/core/contracts/headless/plugin-host';
8
+ export interface AutomaticPluginDeps {
9
+ createAutomaticAgentPluginUse: typeof createAutomaticAgentPluginUse;
10
+ readChatAgentPluginState: typeof readChatAgentPluginState;
11
+ workspaceId: string;
12
+ preferences: Pick<AgentPluginPreferencesPort, 'mode' | 'snapshot' | 'saveAuto'>;
13
+ siteTitleReady: Promise<void>;
14
+ list: (required: Record<string, never>, optional?: Record<string, never>) => Promise<readonly (Awaited<ReturnType<AutomaticAgentPluginPorts['list']>>[number] & {
15
+ maturity?: PluginMaturity | undefined;
16
+ })[]>;
17
+ rank: (required: Parameters<AutomaticAgentPluginPorts['rank']>[0], optional: {
18
+ automatic: true;
19
+ }) => ReturnType<AutomaticAgentPluginPorts['rank']>;
20
+ resolve: AutomaticAgentPluginPorts['resolve'];
21
+ formatPluginToolPointer: NonNullable<AutomaticAgentPluginPorts['formatPluginToolPointer']>;
22
+ catalog: readonly AgentToolDefinition[];
23
+ metadata: NonNullable<Parameters<typeof buildDomainRegistrations>[0]['metadata']>;
24
+ derivedRisk: Parameters<typeof buildDomainRegistrations>[0]['derivedRisk'];
25
+ catalogModule: string;
26
+ copy: {
27
+ preferenceBeforeAnswer: string;
28
+ preferenceAfterAnswer: string;
29
+ loadNotes: (required: {
30
+ pluginId: string;
31
+ }) => Readonly<Record<string, string>>;
32
+ };
33
+ warn: (error: unknown) => void;
34
+ }
35
+ /** The feature's consent port; the assistant supplies its principal-bound exchange adapter. */
36
+ export type AskAgentPluginChoice = (required: {
37
+ surfaces: ChatDeleteSurfaceDeps;
38
+ principalId: string;
39
+ emitSurface: SurfaceEmitter;
40
+ signal: AbortSignal;
41
+ workspaceId: string;
42
+ conversationId: string;
43
+ preferenceRevisionSeq: number;
44
+ selected: readonly string[];
45
+ matches: Parameters<AutomaticAgentPluginPorts['ask']>[0]['matches'];
46
+ }, optional?: Record<string, never>) => ReturnType<AutomaticAgentPluginPorts['ask']>;
47
+ export interface AutomaticPluginRun {
48
+ principal: Principal;
49
+ conversationId: string;
50
+ state: ChatAgentPluginState;
51
+ query: string;
52
+ pinned: readonly string[];
53
+ signal: AbortSignal;
54
+ emitSurface: SurfaceEmitter;
55
+ maxPromptArgBytes?: number | undefined;
56
+ publish(input: {
57
+ conversationId: string;
58
+ state: ChatAgentPluginState;
59
+ plugins: readonly {
60
+ id: string;
61
+ name: string;
62
+ }[];
63
+ }): Promise<void>;
64
+ }
65
+ type Entry = {
66
+ turnId: string;
67
+ controller: ReturnType<typeof createAutomaticAgentPluginUse>;
68
+ context: AutomaticPluginRun;
69
+ abort: AbortController;
70
+ pending: boolean;
71
+ preflight?: Promise<string> | undefined;
72
+ attempts: Set<string>;
73
+ offerIds: Map<string, string>;
74
+ maturities: Map<string, PluginMaturity | undefined>;
75
+ };
76
+ type OfferLiveness = Parameters<ReturnType<typeof createAutomaticAgentPluginUse>['offer']>[0]['isAttemptLive'];
77
+ /** The automatic resolver port: rechecks activation and trust on every read. Off plugins are read
78
+ * only when Jini's explicit loader asks with `allowInactiveGuidance`; automatic delivery omits it,
79
+ * so a plugin switched off after ranking is never inlined. Read-only setup guidance is not activation,
80
+ * authorization or delivery. O(1) plus one resolver read.
81
+ */
82
+ export declare function bindAutomaticGuidanceResolver<Layout extends Pick<AgentPluginWorkspaceLayout, 'packages' | 'root'>>({ workspaceLayout, resolveGuidance }: {
83
+ workspaceLayout: Layout;
84
+ resolveGuidance: (required: {
85
+ pluginRefIds: readonly string[];
86
+ workspaceLayout: Layout;
87
+ }, optional: Omit<Parameters<AutomaticAgentPluginPorts['resolve']>[0], 'pluginId'> & {
88
+ deliveryMode: 'inject';
89
+ allowInactiveGuidance: boolean;
90
+ }) => ReturnType<AutomaticAgentPluginPorts['resolve']>;
91
+ }, _optional?: {}): AutomaticAgentPluginPorts['resolve'];
92
+ declare function start({ runId, messageId, context }: {
93
+ runId: string;
94
+ messageId?: string;
95
+ context: AutomaticPluginRun;
96
+ }, state: {
97
+ deps: Parameters<typeof createScopedAutomaticPluginRuns>[0]['deps'];
98
+ surfaces: ChatDeleteSurfaceDeps;
99
+ askAgentPluginChoice: AskAgentPluginChoice;
100
+ runs: Map<string, Entry>;
101
+ turns: Map<string, Entry>;
102
+ lateAnswers: Map<string, ChatAgentPluginState>;
103
+ }): Promise<string>;
104
+ /** Draft guidance for one live attempt without recording delivery. Ownership (principal, chat,
105
+ * turn) binds exactly as `start` does; the host owns the attempt scope, offer id and liveness.
106
+ * The first successful offer id is cached per attempt, so a repeated offer cannot re-key a receipt;
107
+ * a replacement attempt has another key and never inherits it. @complexity O(1) plus the owner's draft.
108
+ */
109
+ declare function offer({ runId, messageId, context, scope, offerId, isAttemptLive }: {
110
+ runId: string;
111
+ messageId?: string | undefined;
112
+ context: AutomaticPluginRun;
113
+ scope: AgentPluginGuidanceAttempt;
114
+ offerId: string;
115
+ isAttemptLive: OfferLiveness;
116
+ }, state: {
117
+ deps: Parameters<typeof createScopedAutomaticPluginRuns>[0]['deps'];
118
+ surfaces: ChatDeleteSurfaceDeps;
119
+ askAgentPluginChoice: AskAgentPluginChoice;
120
+ runs: Map<string, Entry>;
121
+ turns: Map<string, Entry>;
122
+ lateAnswers: Map<string, ChatAgentPluginState>;
123
+ }): Promise<AgentPluginGuidanceOffer>;
124
+ /** Record the delivered ids of this attempt's offer. Only a live alias of the same principal may
125
+ * commit; Jini refuses a retired, replaced or older attempt and replays a same-choice receipt. */
126
+ declare function commit({ scope, offerId, deliveredIds }: {
127
+ scope: AgentPluginGuidanceAttempt;
128
+ offerId: string;
129
+ deliveredIds: readonly string[];
130
+ }, { signal }: {
131
+ signal?: AbortSignal | undefined;
132
+ } | undefined, { runs, turns }: {
133
+ deps: Parameters<typeof createScopedAutomaticPluginRuns>[0]['deps'];
134
+ surfaces: ChatDeleteSurfaceDeps;
135
+ askAgentPluginChoice: AskAgentPluginChoice;
136
+ runs: Map<string, Entry>;
137
+ turns: Map<string, Entry>;
138
+ lateAnswers: Map<string, ChatAgentPluginState>;
139
+ }): Promise<{
140
+ readonly guidanceIds: readonly string[];
141
+ }>;
142
+ /** Dispose an attempt alias. Durable attempt replacement retains a pending exchange until its
143
+ * answer/normal exchange expiry; explicit disposal aborts it. O(1), no persistent writes.
144
+ */
145
+ declare function forget({ runId }: {
146
+ runId: string;
147
+ }, { preservePending }: {
148
+ preservePending?: boolean | undefined;
149
+ } | undefined, { runs, turns }: {
150
+ deps: Parameters<typeof createScopedAutomaticPluginRuns>[0]['deps'];
151
+ surfaces: ChatDeleteSurfaceDeps;
152
+ askAgentPluginChoice: AskAgentPluginChoice;
153
+ runs: Map<string, Entry>;
154
+ turns: Map<string, Entry>;
155
+ lateAnswers: Map<string, ChatAgentPluginState>;
156
+ }): void;
157
+ /** Logical-turn controllers share preflight and the actual authorized tool gate. Cleanup is explicit.
158
+ * @returns start/forget, the read-only guidance loader and the tool preparation hook.
159
+ * @complexity O(1) identity lookup; one controller per live turn, one late answer per chat.
160
+ */
161
+ export declare function createScopedAutomaticPluginRuns({ deps, surfaces, askAgentPluginChoice }: {
162
+ deps: Omit<AutomaticPluginDeps, 'resolve'> & {
163
+ resolveForEntry(required: {
164
+ workspaceId: string;
165
+ }): AutomaticPluginDeps['resolve'];
166
+ };
167
+ surfaces: ChatDeleteSurfaceDeps;
168
+ askAgentPluginChoice: AskAgentPluginChoice;
169
+ }, _options?: {}): {
170
+ start: (input: Parameters<typeof start>[0], _optional?: {}) => Promise<string>;
171
+ offer: (input: Parameters<typeof offer>[0], _optional?: {}) => Promise<AgentPluginGuidanceOffer>;
172
+ commit: (input: Parameters<typeof commit>[0], optional?: Parameters<typeof commit>[1]) => Promise<{
173
+ readonly guidanceIds: readonly string[];
174
+ }>;
175
+ prepareGuidance: (input: Parameters<PrepareToolGuidance>[0]) => Promise<string>;
176
+ loadRegistration: import("@jini-ai/core").ToolRegistration;
177
+ forget: (input: Parameters<typeof forget>[0], optional?: Parameters<typeof forget>[1]) => void;
178
+ guidanceIds: ({ runId }: {
179
+ runId: string;
180
+ }, _optional?: {}) => string[];
181
+ };
182
+ export declare function createAutomaticPluginRuns({ deps, surfaces, askAgentPluginChoice }: {
183
+ deps: AutomaticPluginDeps;
184
+ surfaces: ChatDeleteSurfaceDeps;
185
+ askAgentPluginChoice: AskAgentPluginChoice;
186
+ }, _options?: {}): {
187
+ start: (input: Parameters<typeof start>[0], _optional?: {}) => Promise<string>;
188
+ offer: (input: Parameters<typeof offer>[0], _optional?: {}) => Promise<AgentPluginGuidanceOffer>;
189
+ commit: (input: Parameters<typeof commit>[0], optional?: Parameters<typeof commit>[1]) => Promise<{
190
+ readonly guidanceIds: readonly string[];
191
+ }>;
192
+ prepareGuidance: (input: Parameters<PrepareToolGuidance>[0]) => Promise<string>;
193
+ loadRegistration: import("@jini-ai/core").ToolRegistration;
194
+ forget: (input: Parameters<typeof forget>[0], optional?: Parameters<typeof forget>[1]) => void;
195
+ guidanceIds: ({ runId }: {
196
+ runId: string;
197
+ }, _optional?: {}) => string[];
198
+ };
199
+ export {};
200
+ //# sourceMappingURL=automatic-agent-plugins.d.ts.map