@jini-ai/agent-plugins 0.4.7 → 0.6.10

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 (212) hide show
  1. package/CHANGELOG.md +24 -2
  2. package/README.md +46 -0
  3. package/dist/admin-surfaces/action-dispatcher.d.ts +37 -0
  4. package/dist/admin-surfaces/action-dispatcher.d.ts.map +1 -0
  5. package/dist/admin-surfaces/action-dispatcher.js +69 -0
  6. package/dist/admin-surfaces/action-dispatcher.js.map +1 -0
  7. package/dist/admin-surfaces/action-schema.d.ts +56 -0
  8. package/dist/admin-surfaces/action-schema.d.ts.map +1 -0
  9. package/dist/admin-surfaces/action-schema.js +167 -0
  10. package/dist/admin-surfaces/action-schema.js.map +1 -0
  11. package/dist/admin-surfaces/action-tools.d.ts +40 -0
  12. package/dist/admin-surfaces/action-tools.d.ts.map +1 -0
  13. package/dist/admin-surfaces/action-tools.js +52 -0
  14. package/dist/admin-surfaces/action-tools.js.map +1 -0
  15. package/dist/admin-surfaces/callback-field-inbox.d.ts +35 -0
  16. package/dist/admin-surfaces/callback-field-inbox.d.ts.map +1 -0
  17. package/dist/admin-surfaces/callback-field-inbox.js +53 -0
  18. package/dist/admin-surfaces/callback-field-inbox.js.map +1 -0
  19. package/dist/admin-surfaces/capability-declarations.d.ts +41 -0
  20. package/dist/admin-surfaces/capability-declarations.d.ts.map +1 -0
  21. package/dist/admin-surfaces/capability-declarations.js +102 -0
  22. package/dist/admin-surfaces/capability-declarations.js.map +1 -0
  23. package/dist/admin-surfaces/contribution.d.ts +49 -0
  24. package/dist/admin-surfaces/contribution.d.ts.map +1 -0
  25. package/dist/admin-surfaces/contribution.js +30 -0
  26. package/dist/admin-surfaces/contribution.js.map +1 -0
  27. package/dist/admin-surfaces/delivery-bindings.d.ts +76 -0
  28. package/dist/admin-surfaces/delivery-bindings.d.ts.map +1 -0
  29. package/dist/admin-surfaces/delivery-bindings.js +99 -0
  30. package/dist/admin-surfaces/delivery-bindings.js.map +1 -0
  31. package/dist/admin-surfaces/descriptor.d.ts +69 -0
  32. package/dist/admin-surfaces/descriptor.d.ts.map +1 -0
  33. package/dist/admin-surfaces/descriptor.js +196 -0
  34. package/dist/admin-surfaces/descriptor.js.map +1 -0
  35. package/dist/admin-surfaces/external-links.d.ts +45 -0
  36. package/dist/admin-surfaces/external-links.d.ts.map +1 -0
  37. package/dist/admin-surfaces/external-links.js +70 -0
  38. package/dist/admin-surfaces/external-links.js.map +1 -0
  39. package/dist/admin-surfaces/host-validator.d.ts +62 -0
  40. package/dist/admin-surfaces/host-validator.d.ts.map +1 -0
  41. package/dist/admin-surfaces/host-validator.js +87 -0
  42. package/dist/admin-surfaces/host-validator.js.map +1 -0
  43. package/dist/admin-surfaces/index.d.ts +23 -0
  44. package/dist/admin-surfaces/index.d.ts.map +1 -0
  45. package/dist/admin-surfaces/index.js +21 -0
  46. package/dist/admin-surfaces/index.js.map +1 -0
  47. package/dist/admin-surfaces/protocol.d.ts +103 -0
  48. package/dist/admin-surfaces/protocol.d.ts.map +1 -0
  49. package/dist/admin-surfaces/protocol.js +25 -0
  50. package/dist/admin-surfaces/protocol.js.map +1 -0
  51. package/dist/admin-surfaces/sandbox.d.ts +78 -0
  52. package/dist/admin-surfaces/sandbox.d.ts.map +1 -0
  53. package/dist/admin-surfaces/sandbox.js +92 -0
  54. package/dist/admin-surfaces/sandbox.js.map +1 -0
  55. package/dist/admin-surfaces/settings-value.d.ts +28 -0
  56. package/dist/admin-surfaces/settings-value.d.ts.map +1 -0
  57. package/dist/admin-surfaces/settings-value.js +45 -0
  58. package/dist/admin-surfaces/settings-value.js.map +1 -0
  59. package/dist/admin-surfaces/surface-capabilities.d.ts +167 -0
  60. package/dist/admin-surfaces/surface-capabilities.d.ts.map +1 -0
  61. package/dist/admin-surfaces/surface-capabilities.js +215 -0
  62. package/dist/admin-surfaces/surface-capabilities.js.map +1 -0
  63. package/dist/admin-surfaces/surface-client.d.ts +116 -0
  64. package/dist/admin-surfaces/surface-client.d.ts.map +1 -0
  65. package/dist/admin-surfaces/surface-client.js +219 -0
  66. package/dist/admin-surfaces/surface-client.js.map +1 -0
  67. package/dist/admin-surfaces/surface-handlers.d.ts +111 -0
  68. package/dist/admin-surfaces/surface-handlers.d.ts.map +1 -0
  69. package/dist/admin-surfaces/surface-handlers.js +172 -0
  70. package/dist/admin-surfaces/surface-handlers.js.map +1 -0
  71. package/dist/admin-surfaces/theme.d.ts +59 -0
  72. package/dist/admin-surfaces/theme.d.ts.map +1 -0
  73. package/dist/admin-surfaces/theme.js +57 -0
  74. package/dist/admin-surfaces/theme.js.map +1 -0
  75. package/dist/folder-zip-node.d.ts.map +1 -0
  76. package/dist/folder-zip-node.js +59 -49
  77. package/dist/folder-zip-node.js.map +1 -0
  78. package/dist/folder-zip.d.ts.map +1 -0
  79. package/dist/folder-zip.js +9 -7
  80. package/dist/folder-zip.js.map +1 -0
  81. package/dist/index.d.ts.map +1 -0
  82. package/dist/index.js.map +1 -0
  83. package/dist/lifecycle/activation.d.ts.map +1 -0
  84. package/dist/lifecycle/activation.js.map +1 -0
  85. package/dist/lifecycle/automatic-use.d.ts +79 -0
  86. package/dist/lifecycle/automatic-use.d.ts.map +1 -0
  87. package/dist/lifecycle/automatic-use.js +165 -0
  88. package/dist/lifecycle/automatic-use.js.map +1 -0
  89. package/dist/lifecycle/bundled-digests.d.ts.map +1 -0
  90. package/dist/lifecycle/bundled-digests.js.map +1 -0
  91. package/dist/lifecycle/bundled-source-archive.d.ts.map +1 -0
  92. package/dist/lifecycle/bundled-source-archive.js.map +1 -0
  93. package/dist/lifecycle/capability-projection.d.ts.map +1 -0
  94. package/dist/lifecycle/capability-projection.js.map +1 -0
  95. package/dist/lifecycle/compatibility-metadata.d.ts +19 -0
  96. package/dist/lifecycle/compatibility-metadata.d.ts.map +1 -0
  97. package/dist/lifecycle/compatibility-metadata.js +45 -0
  98. package/dist/lifecycle/compatibility-metadata.js.map +1 -0
  99. package/dist/lifecycle/compatibility.d.ts +52 -0
  100. package/dist/lifecycle/compatibility.d.ts.map +1 -0
  101. package/dist/lifecycle/compatibility.js +60 -0
  102. package/dist/lifecycle/compatibility.js.map +1 -0
  103. package/dist/lifecycle/contribution-loader.d.ts.map +1 -0
  104. package/dist/lifecycle/contribution-loader.js.map +1 -0
  105. package/dist/lifecycle/fetch-archive.d.ts.map +1 -0
  106. package/dist/lifecycle/fetch-archive.js +26 -24
  107. package/dist/lifecycle/fetch-archive.js.map +1 -0
  108. package/dist/lifecycle/index.d.ts +14 -2
  109. package/dist/lifecycle/index.d.ts.map +1 -0
  110. package/dist/lifecycle/index.js +8 -1
  111. package/dist/lifecycle/index.js.map +1 -0
  112. package/dist/lifecycle/install-errors.d.ts.map +1 -0
  113. package/dist/lifecycle/install-errors.js.map +1 -0
  114. package/dist/lifecycle/install-from-url.d.ts.map +1 -0
  115. package/dist/lifecycle/install-from-url.js.map +1 -0
  116. package/dist/lifecycle/install.d.ts.map +1 -0
  117. package/dist/lifecycle/install.js +7 -0
  118. package/dist/lifecycle/install.js.map +1 -0
  119. package/dist/lifecycle/installed-package-index.d.ts.map +1 -0
  120. package/dist/lifecycle/installed-package-index.js +41 -29
  121. package/dist/lifecycle/installed-package-index.js.map +1 -0
  122. package/dist/lifecycle/installed-package-roots.d.ts.map +1 -0
  123. package/dist/lifecycle/installed-package-roots.js +28 -20
  124. package/dist/lifecycle/installed-package-roots.js.map +1 -0
  125. package/dist/lifecycle/layout.d.ts.map +1 -0
  126. package/dist/lifecycle/layout.js.map +1 -0
  127. package/dist/lifecycle/manifest.d.ts +13 -0
  128. package/dist/lifecycle/manifest.d.ts.map +1 -0
  129. package/dist/lifecycle/manifest.js +115 -101
  130. package/dist/lifecycle/manifest.js.map +1 -0
  131. package/dist/lifecycle/mcp-provisioning.d.ts.map +1 -0
  132. package/dist/lifecycle/mcp-provisioning.js.map +1 -0
  133. package/dist/lifecycle/node.d.ts.map +1 -0
  134. package/dist/lifecycle/node.js.map +1 -0
  135. package/dist/lifecycle/package-paths.d.ts.map +1 -0
  136. package/dist/lifecycle/package-paths.js +3 -3
  137. package/dist/lifecycle/package-paths.js.map +1 -0
  138. package/dist/lifecycle/persistent-state.d.ts.map +1 -0
  139. package/dist/lifecycle/persistent-state.js.map +1 -0
  140. package/dist/lifecycle/ports.d.ts +1 -1
  141. package/dist/lifecycle/ports.d.ts.map +1 -0
  142. package/dist/lifecycle/ports.js.map +1 -0
  143. package/dist/lifecycle/provider-contribution.d.ts +65 -0
  144. package/dist/lifecycle/provider-contribution.d.ts.map +1 -0
  145. package/dist/lifecycle/provider-contribution.js +93 -0
  146. package/dist/lifecycle/provider-contribution.js.map +1 -0
  147. package/dist/lifecycle/resolve-agent-plugin-refs.d.ts.map +1 -0
  148. package/dist/lifecycle/resolve-agent-plugin-refs.js +15 -2
  149. package/dist/lifecycle/resolve-agent-plugin-refs.js.map +1 -0
  150. package/dist/lifecycle/retire-bundled.d.ts.map +1 -0
  151. package/dist/lifecycle/retire-bundled.js +20 -18
  152. package/dist/lifecycle/retire-bundled.js.map +1 -0
  153. package/dist/lifecycle/search.d.ts +6 -1
  154. package/dist/lifecycle/search.d.ts.map +1 -0
  155. package/dist/lifecycle/search.js +45 -7
  156. package/dist/lifecycle/search.js.map +1 -0
  157. package/dist/lifecycle/seed-bundled.d.ts.map +1 -0
  158. package/dist/lifecycle/seed-bundled.js.map +1 -0
  159. package/dist/lifecycle/set-enabled.d.ts +2 -1
  160. package/dist/lifecycle/set-enabled.d.ts.map +1 -0
  161. package/dist/lifecycle/set-enabled.js +52 -8
  162. package/dist/lifecycle/set-enabled.js.map +1 -0
  163. package/dist/lifecycle/skill-file-reader.d.ts.map +1 -0
  164. package/dist/lifecycle/skill-file-reader.js +85 -71
  165. package/dist/lifecycle/skill-file-reader.js.map +1 -0
  166. package/dist/lifecycle/tools/capabilities.d.ts +199 -0
  167. package/dist/lifecycle/tools/capabilities.d.ts.map +1 -0
  168. package/dist/lifecycle/tools/capabilities.js +213 -0
  169. package/dist/lifecycle/tools/capabilities.js.map +1 -0
  170. package/dist/lifecycle/tools/definition.d.ts +32 -0
  171. package/dist/lifecycle/tools/definition.d.ts.map +1 -0
  172. package/dist/lifecycle/tools/definition.js +33 -0
  173. package/dist/lifecycle/tools/definition.js.map +1 -0
  174. package/dist/lifecycle/tools/index.d.ts +10 -0
  175. package/dist/lifecycle/tools/index.d.ts.map +1 -0
  176. package/dist/lifecycle/tools/index.js +10 -0
  177. package/dist/lifecycle/tools/index.js.map +1 -0
  178. package/dist/lifecycle/tools/manifest.d.ts +33 -0
  179. package/dist/lifecycle/tools/manifest.d.ts.map +1 -0
  180. package/dist/lifecycle/tools/manifest.js +89 -0
  181. package/dist/lifecycle/tools/manifest.js.map +1 -0
  182. package/dist/lifecycle/tools/projection.d.ts +90 -0
  183. package/dist/lifecycle/tools/projection.d.ts.map +1 -0
  184. package/dist/lifecycle/tools/projection.js +283 -0
  185. package/dist/lifecycle/tools/projection.js.map +1 -0
  186. package/dist/lifecycle/trusted-plugin-files.d.ts.map +1 -0
  187. package/dist/lifecycle/trusted-plugin-files.js.map +1 -0
  188. package/dist/lifecycle/types.d.ts +2 -0
  189. package/dist/lifecycle/types.d.ts.map +1 -0
  190. package/dist/lifecycle/types.js.map +1 -0
  191. package/dist/lifecycle/uninstall.d.ts +3 -1
  192. package/dist/lifecycle/uninstall.d.ts.map +1 -0
  193. package/dist/lifecycle/uninstall.js +51 -27
  194. package/dist/lifecycle/uninstall.js.map +1 -0
  195. package/dist/lifecycle/update-plan.d.ts +18 -0
  196. package/dist/lifecycle/update-plan.d.ts.map +1 -0
  197. package/dist/lifecycle/update-plan.js +22 -0
  198. package/dist/lifecycle/update-plan.js.map +1 -0
  199. package/dist/lifecycle/update-store.d.ts +71 -0
  200. package/dist/lifecycle/update-store.d.ts.map +1 -0
  201. package/dist/lifecycle/update-store.js +150 -0
  202. package/dist/lifecycle/update-store.js.map +1 -0
  203. package/dist/lifecycle/update.d.ts +55 -0
  204. package/dist/lifecycle/update.d.ts.map +1 -0
  205. package/dist/lifecycle/update.js +321 -0
  206. package/dist/lifecycle/update.js.map +1 -0
  207. package/dist/lifecycle/yauzl-archive-reader.d.ts.map +1 -0
  208. package/dist/lifecycle/yauzl-archive-reader.js.map +1 -0
  209. package/dist/manifest.d.ts.map +1 -0
  210. package/dist/manifest.js.map +1 -0
  211. package/package.json +39 -7
  212. package/ui-ux-design/plugin.json +7 -2
@@ -0,0 +1 @@
1
+ {"version":3,"file":"skill-file-reader.js","sourceRoot":"","sources":["../../src/lifecycle/skill-file-reader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAe,MAAM,SAAS,CAAC;AACjD,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAG9D,MAAM,eAAe,GAAwB,IAAI,GAAG,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;AACrL,MAAM,cAAc,GAAG,GAAG,GAAG,IAAI,CAAC;AAClC,MAAM,gBAAgB,GAAG,IAAI,CAAC;AAC9B,MAAM,cAAc,GAAG,EAAE,CAAC;AAC1B,MAAM,SAAS,GAAG,4EAA4E,CAAC;AAE/F,MAAM,UAAU,GAAG,sDAAsD,CAAC;AAK1E,gHAAgH;AAChH,KAAK,UAAU,UAAU,CAAC,MAAkB;IAC1C,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC;IACjC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;QAAE,OAAO,EAAE,OAAO,EAAE,6DAA6D,EAAE,CAAC;IACtG,IAAI,IAAI,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AAI,CAAC,IAAI,CAAC,IAAI,QAAQ,kCAAkC,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QAChN,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,199 @@
1
+ /**
2
+ * @file Host capabilities a plugin tool receives at invocation, typed as ports: the host supplies
3
+ * every implementation (token store, guarded HTTP, limiter, artifact store) and Jini never names a
4
+ * provider. A per-call session wraps them so that (1) every capability stops working the moment the
5
+ * plugin's tools are revoked, even for a module that kept a reference, and (2) an access token the
6
+ * call obtained can never leave through the tool's result or error text. Those two gates are
7
+ * `openCapabilityGate`, shared with the admin-surface session so both enforce them identically.
8
+ *
9
+ * Plugin state reaches a tool read-only: the plugin's admin surface writes its settings (for example
10
+ * which of its products are on), and its tools must honor them, but an agent tool never changes them.
11
+ */
12
+ /** Options for guarded HTTP; mirrors `@jini-ai/platform`'s guarded fetch, buffered bodies only. */
13
+ export interface AgentPluginHttpOptions {
14
+ readonly method?: 'GET' | 'HEAD' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
15
+ readonly headers?: Readonly<Record<string, string>>;
16
+ readonly body?: string;
17
+ readonly signal?: AbortSignal;
18
+ }
19
+ /** Mirrors `@jini-ai/http-kit`'s `RateLimitResult`, so a host can pass its limiter straight through. */
20
+ export type AgentPluginLimitResult = {
21
+ readonly allowed: true;
22
+ } | {
23
+ readonly allowed: false;
24
+ readonly retryAfterSeconds: number;
25
+ };
26
+ /** Plain JSON a plugin keeps in its plugin- and workspace-scoped state. */
27
+ export type AgentPluginStateValue = null | boolean | number | string | readonly AgentPluginStateValue[] | {
28
+ readonly [key: string]: AgentPluginStateValue;
29
+ };
30
+ /**
31
+ * The read-only view of a plugin's own state: what its tools get, and what a host hands any other
32
+ * plugin execution context (form delivery, for example) that must honor the plugin's settings. A
33
+ * host handing it elsewhere passes an object with `get` only, never its whole store.
34
+ */
35
+ export interface AgentPluginStateReader {
36
+ get(required: {
37
+ readonly key: string;
38
+ }, optional?: Record<string, never>): Promise<AgentPluginStateValue | null>;
39
+ }
40
+ export interface AgentPluginToolCapabilities {
41
+ /** Resolves a fresh access token for a connection the host has scoped to this plugin and workspace.
42
+ * Never a refresh token. The host refuses a connectionRef the calling plugin does not own. */
43
+ readonly connections: {
44
+ getAccessToken(required: {
45
+ readonly connectionRef: string;
46
+ }, optional?: Record<string, never>): Promise<string>;
47
+ };
48
+ /** Outbound HTTP through the host's guarded client (allow-list, redirect refusal, deadlines). */
49
+ readonly http: {
50
+ fetch(required: {
51
+ readonly url: string;
52
+ }, optional?: AgentPluginHttpOptions): Promise<Response>;
53
+ };
54
+ /** Plugin-declared budgets; the host keys and sizes them. */
55
+ readonly limiter: {
56
+ check(required: {
57
+ readonly key: string;
58
+ }, optional?: Record<string, never>): Promise<AgentPluginLimitResult>;
59
+ };
60
+ /** Stores a file the run can hand to the user; returns an opaque reference, never a path. Absent
61
+ * when the host has no artifact store, so a tool checks `capabilities.artifacts` before relying on it. */
62
+ readonly artifacts?: {
63
+ write(required: {
64
+ readonly name: string;
65
+ readonly mediaType: string;
66
+ readonly content: string | Uint8Array;
67
+ }, optional?: Record<string, never>): Promise<{
68
+ readonly artifactRef: string;
69
+ }>;
70
+ };
71
+ /** The SAME store the plugin's admin-surface state writes, keyed by the same plugin and workspace
72
+ * scope. Read-only here: the session exposes `get` alone whatever object the host passes. */
73
+ readonly state: AgentPluginStateReader;
74
+ }
75
+ /** Context the host uses to scope capabilities: which plugin, which workspace/principal, which call. */
76
+ export interface AgentPluginToolCapabilityScope {
77
+ readonly pluginId: string;
78
+ readonly workspaceId: string;
79
+ readonly principalId?: string;
80
+ readonly signal?: AbortSignal;
81
+ }
82
+ /** Host port: builds the capabilities for one call. Called once per invocation. */
83
+ export type AgentPluginToolCapabilitiesPort = (required: AgentPluginToolCapabilityScope, optional?: Record<string, never>) => AgentPluginToolCapabilities;
84
+ /** One limit for every reader and writer of plugin state; the admin-surface limits reuse it. */
85
+ export declare const PLUGIN_STATE_MAX_KEY_LENGTH = 128;
86
+ export declare const REVOKED_MESSAGE = "This plugin tool was disabled; its capabilities are revoked. Re-enable the plugin and retry.";
87
+ export declare const WITHHELD_OUTPUT_MESSAGE = "The plugin tool result was withheld because it contained a connection credential.";
88
+ export declare const WITHHELD_ERROR_MESSAGE = "The plugin tool failed and its error was withheld because it contained a connection credential.";
89
+ /**
90
+ * Access tokens one plugin obtained, across all of its calls: plugin code that keeps a token in module
91
+ * scope must not be able to return or store it in a later call unseen.
92
+ */
93
+ export type IssuedTokenMemory = Set<string>;
94
+ /** Newest tokens kept; access tokens are short-lived, so older ones matter less than bounded memory. */
95
+ export declare const ISSUED_TOKEN_MEMORY_LIMIT = 64;
96
+ /** The host's one source of token memories, passed to its tool projection AND its admin-surface host. */
97
+ export interface IssuedTokenMemories {
98
+ forPlugin(required: {
99
+ readonly pluginId: string;
100
+ }, optional?: Record<string, never>): IssuedTokenMemory;
101
+ }
102
+ /**
103
+ * One token memory per plugin, shared by every context that runs that plugin's code: its tools, its
104
+ * surface handlers and their state writes. Why per plugin and not per context or generation: those
105
+ * contexts can share module scope (a common lib module), and Node caches an imported module, so its
106
+ * scope outlives a re-sync; a memory per context or per generation would let a token obtained in one
107
+ * leave through the other. A host creates ONE and passes it to both seams.
108
+ * @complexity O(1) per lookup; space O(plugins * ISSUED_TOKEN_MEMORY_LIMIT).
109
+ */
110
+ export declare function createIssuedTokenMemories(_required?: Record<string, never>, _optional?: Record<string, never>): IssuedTokenMemories;
111
+ /**
112
+ * The credential scans alone, for plugin answers that need no capabilities (a tool's
113
+ * affected-resources disclosure): `mentionsToken`, and `sanitize` (an error, or a credential-free
114
+ * replacement without `cause`, since the cause may hold the token).
115
+ * @param required.issued - The plugin's token memory (see `createIssuedTokenMemories`).
116
+ * @complexity O(1) to open; the scans are O(scanned size * remembered tokens).
117
+ */
118
+ export declare function openCredentialScan(required: {
119
+ readonly issued: IssuedTokenMemory;
120
+ }, _optional?: Record<string, never>): {
121
+ mentionsToken: ({ value }: {
122
+ readonly value: unknown;
123
+ }) => boolean;
124
+ sanitize({ error }: {
125
+ readonly error: unknown;
126
+ }): unknown;
127
+ };
128
+ export type AgentPluginCredentialScan = ReturnType<typeof openCredentialScan>;
129
+ /**
130
+ * The revocation and credential gates every capability session shares: this file's tool session and
131
+ * the admin-surface session (`../../admin-surfaces/surface-capabilities.ts`), so both revoke and scan
132
+ * the same way.
133
+ * @param required.isLive - False once the contributing plugin's contributions are revoked.
134
+ * @param required.issued - The plugin's token memory (see `createIssuedTokenMemories`).
135
+ * @returns `guard` (wraps a capability so it refuses once revoked), `noteToken` (records a token the
136
+ * call obtained), `mentionsToken`, and the `release` (result) and `sanitize` (error) gates.
137
+ * @complexity O(1) to open; the scans are O(serialized size * remembered tokens).
138
+ */
139
+ export declare function openCapabilityGate(required: {
140
+ readonly isLive: () => boolean;
141
+ readonly issued: IssuedTokenMemory;
142
+ }, _optional?: Record<string, never>): {
143
+ /** The result, unless it mentions a token this plugin obtained. */
144
+ release<T>({ value }: {
145
+ readonly value: T;
146
+ }): T;
147
+ mentionsToken: ({ value }: {
148
+ readonly value: unknown;
149
+ }) => boolean;
150
+ sanitize({ error }: {
151
+ readonly error: unknown;
152
+ }): unknown;
153
+ guard: <A extends unknown[], R>(call: (...args: A) => Promise<R>) => (...args: A) => Promise<R>;
154
+ noteToken({ token }: {
155
+ readonly token: string;
156
+ }): string;
157
+ };
158
+ export type AgentPluginCapabilityGate = ReturnType<typeof openCapabilityGate>;
159
+ /** The host capabilities every session wraps the same way: guarded HTTP, limiter and artifacts
160
+ * (artifacts only when the host gives a store: absent stays absent, never a wrapper that throws). @complexity O(1). */
161
+ export declare function guardSharedCapabilities(required: {
162
+ readonly gate: AgentPluginCapabilityGate;
163
+ readonly host: Pick<AgentPluginToolCapabilities, 'http' | 'limiter' | 'artifacts'>;
164
+ }, _optional?: Record<string, never>): Pick<AgentPluginToolCapabilities, 'http' | 'limiter' | 'artifacts'>;
165
+ /** The key shape every plugin state call shares, so a key never reaches the host as a path or a scope. */
166
+ export declare function checkedStateKey(required: {
167
+ readonly key: unknown;
168
+ }, _optional?: Record<string, never>): string;
169
+ /**
170
+ * The read-only state view a session hands out: `get` alone, the key checked and passed on by itself
171
+ * (so plugin code cannot add a scope the host might honor), revoked with the session's gate.
172
+ * @complexity O(1) plus the key check.
173
+ */
174
+ export declare function guardStateReader(required: {
175
+ readonly gate: AgentPluginCapabilityGate;
176
+ readonly state: AgentPluginStateReader;
177
+ }, _optional?: Record<string, never>): AgentPluginStateReader;
178
+ /**
179
+ * Opens the capability session for one tool call.
180
+ * @param required.capabilities - The host's capabilities for this call.
181
+ * @param required.isLive - False once the contributing plugin's tools are revoked.
182
+ * @param required.issued - The plugin's token memory, shared by all its calls and its surface handlers.
183
+ * @returns Wrapped capabilities plus `release` (result gate) and `sanitize` (error gate).
184
+ * @complexity O(1) to open; gates are O(serialized size).
185
+ */
186
+ export declare function openCapabilitySession(required: {
187
+ readonly capabilities: AgentPluginToolCapabilities;
188
+ readonly isLive: () => boolean;
189
+ readonly issued: IssuedTokenMemory;
190
+ }, _optional?: Record<string, never>): {
191
+ capabilities: AgentPluginToolCapabilities;
192
+ release: <T>({ value }: {
193
+ readonly value: T;
194
+ }) => T;
195
+ sanitize: ({ error }: {
196
+ readonly error: unknown;
197
+ }) => unknown;
198
+ };
199
+ //# sourceMappingURL=capabilities.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"capabilities.d.ts","sourceRoot":"","sources":["../../../src/lifecycle/tools/capabilities.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,mGAAmG;AACnG,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,MAAM,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,CAAC;IACvE,QAAQ,CAAC,OAAO,CAAC,EAAE,QAAQ,CAAC,MA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9L;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE;IAAE,QAAQ,CAAC,YAAY,EAAE,2BAA2B,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,OAAO,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,iBAAiB,CAAA;CAAE,EACpI,SAAS,GAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAM;;cApD3B,CAAC,aAAa;QAAE,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAA;KAAE,KAAG,CAAC;0BA/B3B;QAAE,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAA;KAAE,KAAG,OAAO;EA8F5D"}
@@ -0,0 +1,213 @@
1
+ /**
2
+ * @file Host capabilities a plugin tool receives at invocation, typed as ports: the host supplies
3
+ * every implementation (token store, guarded HTTP, limiter, artifact store) and Jini never names a
4
+ * provider. A per-call session wraps them so that (1) every capability stops working the moment the
5
+ * plugin's tools are revoked, even for a module that kept a reference, and (2) an access token the
6
+ * call obtained can never leave through the tool's result or error text. Those two gates are
7
+ * `openCapabilityGate`, shared with the admin-surface session so both enforce them identically.
8
+ *
9
+ * Plugin state reaches a tool read-only: the plugin's admin surface writes its settings (for example
10
+ * which of its products are on), and its tools must honor them, but an agent tool never changes them.
11
+ */
12
+ /** One limit for every reader and writer of plugin state; the admin-surface limits reuse it. */
13
+ export const PLUGIN_STATE_MAX_KEY_LENGTH = 128;
14
+ const STATE_KEY_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/;
15
+ export const REVOKED_MESSAGE = 'This plugin tool was disabled; its capabilities are revoked. Re-enable the plugin and retry.';
16
+ export const WITHHELD_OUTPUT_MESSAGE = 'The plugin tool result was withheld because it contained a connection credential.';
17
+ export const WITHHELD_ERROR_MESSAGE = 'The plugin tool failed and its error was withheld because it contained a connection credential.';
18
+ /** Newest tokens kept; access tokens are short-lived, so older ones matter less than bounded memory. */
19
+ export const ISSUED_TOKEN_MEMORY_LIMIT = 64;
20
+ /**
21
+ * One token memory per plugin, shared by every context that runs that plugin's code: its tools, its
22
+ * surface handlers and their state writes. Why per plugin and not per context or generation: those
23
+ * contexts can share module scope (a common lib module), and Node caches an imported module, so its
24
+ * scope outlives a re-sync; a memory per context or per generation would let a token obtained in one
25
+ * leave through the other. A host creates ONE and passes it to both seams.
26
+ * @complexity O(1) per lookup; space O(plugins * ISSUED_TOKEN_MEMORY_LIMIT).
27
+ */
28
+ export function createIssuedTokenMemories(_required = {}, _optional = {}) {
29
+ const byPlugin = new Map();
30
+ return Object.freeze({
31
+ forPlugin({ pluginId }) {
32
+ let issued = byPlugin.get(pluginId);
33
+ if (issued === undefined)
34
+ byPlugin.set(pluginId, issued = new Set());
35
+ return issued;
36
+ },
37
+ });
38
+ }
39
+ /** Records `token` as newest, dropping the oldest beyond the limit. @complexity O(1) amortized. */
40
+ function remember(issued, token) {
41
+ issued.delete(token);
42
+ issued.add(token);
43
+ if (issued.size > ISSUED_TOKEN_MEMORY_LIMIT)
44
+ issued.delete(issued.values().next().value);
45
+ }
46
+ /** True when `text` holds any issued token, raw or JSON-escaped. @complexity O(n * t). */
47
+ function textMentions(text, issued) {
48
+ for (const token of issued)
49
+ if (text.includes(token) || text.includes(JSON.stringify(token).slice(1, -1)))
50
+ return true;
51
+ return false;
52
+ }
53
+ /** True when `value` (serialized) mentions any issued token. Unserializable values fail closed.
54
+ * @complexity O(n * t) for serialized size n and t issued tokens (t ≤ ISSUED_TOKEN_MEMORY_LIMIT). */
55
+ function mentionsToken(value, issued) {
56
+ if (issued.size === 0)
57
+ return false;
58
+ let text;
59
+ try {
60
+ text = JSON.stringify(value);
61
+ }
62
+ catch {
63
+ return true;
64
+ }
65
+ return text !== undefined && textMentions(text, issued);
66
+ }
67
+ /**
68
+ * Objects an error scan visits before it gives up and withholds the error. Generous for any real
69
+ * error (a few causes, an `AggregateError` of a few dozen), small enough to bound a hostile graph.
70
+ */
71
+ const ERROR_SCAN_NODE_LIMIT = 256;
72
+ /**
73
+ * Everything one object can hold a token in: every own property, non-enumerable and symbol-keyed
74
+ * ones too (`message`, `stack`, `cause`, `AggregateError.errors`), plus Map and Set contents.
75
+ * Null when reading it threw (a hostile getter or proxy): the caller fails closed.
76
+ * @complexity O(own properties + entries).
77
+ */
78
+ function childrenOf(value) {
79
+ try {
80
+ const own = Reflect.ownKeys(value).map(key => value[key]);
81
+ if (value instanceof Map)
82
+ return [...own, ...value.keys(), ...value.values()];
83
+ return value instanceof Set ? [...own, ...value.values()] : own;
84
+ }
85
+ catch {
86
+ return null;
87
+ }
88
+ }
89
+ /**
90
+ * True when any string reachable from `error` mentions an issued token. JSON would miss the
91
+ * non-enumerable `cause` and `AggregateError.errors`, and errors held in plain objects, so this walks
92
+ * the object graph instead, to any depth. It fails closed: an unreadable object, or a graph past
93
+ * `ERROR_SCAN_NODE_LIMIT` objects, counts as mentioning a token.
94
+ * @complexity O(v * t) for v visited values (objects bounded by the node limit) and t issued tokens.
95
+ */
96
+ function errorMentionsToken(error, issued) {
97
+ if (issued.size === 0)
98
+ return false;
99
+ const seen = new Set();
100
+ const pending = [error];
101
+ while (pending.length > 0) {
102
+ const next = scanStep(pending.pop(), issued, seen);
103
+ if (next === true)
104
+ return true;
105
+ // A loop, not push(...next): a huge array would exceed the engine's argument limit.
106
+ for (const child of next)
107
+ pending.push(child);
108
+ }
109
+ return false;
110
+ }
111
+ /** One value of the scan: `true` when it mentions a token or cannot be scanned, else what it holds. */
112
+ function scanStep(value, issued, seen) {
113
+ if (typeof value === 'string')
114
+ return textMentions(value, issued) || [];
115
+ if (typeof value !== 'object' || value === null || seen.has(value))
116
+ return [];
117
+ seen.add(value);
118
+ return (seen.size > ERROR_SCAN_NODE_LIMIT ? null : childrenOf(value)) ?? true;
119
+ }
120
+ /**
121
+ * The credential scans alone, for plugin answers that need no capabilities (a tool's
122
+ * affected-resources disclosure): `mentionsToken`, and `sanitize` (an error, or a credential-free
123
+ * replacement without `cause`, since the cause may hold the token).
124
+ * @param required.issued - The plugin's token memory (see `createIssuedTokenMemories`).
125
+ * @complexity O(1) to open; the scans are O(scanned size * remembered tokens).
126
+ */
127
+ export function openCredentialScan(required, _optional = {}) {
128
+ const { issued } = required;
129
+ return {
130
+ mentionsToken: ({ value }) => mentionsToken(value, issued),
131
+ sanitize({ error }) {
132
+ return errorMentionsToken(error, issued) ? new Error(WITHHELD_ERROR_MESSAGE) : error;
133
+ },
134
+ };
135
+ }
136
+ /**
137
+ * The revocation and credential gates every capability session shares: this file's tool session and
138
+ * the admin-surface session (`../../admin-surfaces/surface-capabilities.ts`), so both revoke and scan
139
+ * the same way.
140
+ * @param required.isLive - False once the contributing plugin's contributions are revoked.
141
+ * @param required.issued - The plugin's token memory (see `createIssuedTokenMemories`).
142
+ * @returns `guard` (wraps a capability so it refuses once revoked), `noteToken` (records a token the
143
+ * call obtained), `mentionsToken`, and the `release` (result) and `sanitize` (error) gates.
144
+ * @complexity O(1) to open; the scans are O(serialized size * remembered tokens).
145
+ */
146
+ export function openCapabilityGate(required, _optional = {}) {
147
+ const { isLive, issued } = required;
148
+ return {
149
+ guard: (call) => async (...args) => {
150
+ if (!isLive())
151
+ throw new Error(REVOKED_MESSAGE);
152
+ return call(...args);
153
+ },
154
+ noteToken({ token }) {
155
+ if (token)
156
+ remember(issued, token);
157
+ return token;
158
+ },
159
+ ...openCredentialScan({ issued }),
160
+ /** The result, unless it mentions a token this plugin obtained. */
161
+ release({ value }) {
162
+ if (mentionsToken(value, issued))
163
+ throw new Error(WITHHELD_OUTPUT_MESSAGE);
164
+ return value;
165
+ },
166
+ };
167
+ }
168
+ /** The host capabilities every session wraps the same way: guarded HTTP, limiter and artifacts
169
+ * (artifacts only when the host gives a store: absent stays absent, never a wrapper that throws). @complexity O(1). */
170
+ export function guardSharedCapabilities(required, _optional = {}) {
171
+ const { gate: { guard }, host } = required;
172
+ const { artifacts } = host;
173
+ return {
174
+ http: Object.freeze({ fetch: guard((input, options) => host.http.fetch(input, options)) }),
175
+ limiter: Object.freeze({ check: guard((input) => host.limiter.check(input)) }),
176
+ ...(artifacts !== undefined && { artifacts: Object.freeze({ write: guard((input) => artifacts.write(input)) }) }),
177
+ };
178
+ }
179
+ /** The key shape every plugin state call shares, so a key never reaches the host as a path or a scope. */
180
+ export function checkedStateKey(required, _optional = {}) {
181
+ const { key } = required;
182
+ if (typeof key !== 'string' || !STATE_KEY_PATTERN.test(key))
183
+ throw new Error(`A settings key must be a short name of at most ${PLUGIN_STATE_MAX_KEY_LENGTH} characters.`);
184
+ return key;
185
+ }
186
+ /**
187
+ * The read-only state view a session hands out: `get` alone, the key checked and passed on by itself
188
+ * (so plugin code cannot add a scope the host might honor), revoked with the session's gate.
189
+ * @complexity O(1) plus the key check.
190
+ */
191
+ export function guardStateReader(required, _optional = {}) {
192
+ const { gate, state } = required;
193
+ return Object.freeze({ get: gate.guard(({ key }) => state.get({ key: checkedStateKey({ key }) })) });
194
+ }
195
+ /**
196
+ * Opens the capability session for one tool call.
197
+ * @param required.capabilities - The host's capabilities for this call.
198
+ * @param required.isLive - False once the contributing plugin's tools are revoked.
199
+ * @param required.issued - The plugin's token memory, shared by all its calls and its surface handlers.
200
+ * @returns Wrapped capabilities plus `release` (result gate) and `sanitize` (error gate).
201
+ * @complexity O(1) to open; gates are O(serialized size).
202
+ */
203
+ export function openCapabilitySession(required, _optional = {}) {
204
+ const { capabilities: host, isLive, issued } = required;
205
+ const gate = openCapabilityGate({ isLive, issued });
206
+ const capabilities = Object.freeze({
207
+ connections: Object.freeze({ getAccessToken: gate.guard(async (input) => gate.noteToken({ token: await host.connections.getAccessToken({ connectionRef: input.connectionRef }) })) }),
208
+ ...guardSharedCapabilities({ gate, host }),
209
+ state: guardStateReader({ gate, state: host.state }),
210
+ });
211
+ return { capabilities, release: gate.release, sanitize: gate.sanitize };
212
+ }
213
+ //# sourceMappingURL=capabilities.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"capabilities.js","sourceRoot":"","sources":["../../../src/lifecycle/tools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AK,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,eAAe,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;AACjI,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,qBAAqB,CACnC,QAAoI,EACpI,YAAmC,EAAE;IAErC,MAAM,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,QAAQ,CAAC;IACxD,MAAM,IAAI,GAAG,kBAAkB,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IACpD,MAAM,YAAY,GAAgC,MAAM,CAAC,MAAM,CAAC;QAC9D,WAAW,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,cAAc,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,KAAyC,EAAE,EAAE,CAC1G,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,MAAM,IAAI,CAAC,WAAW,CAAC,cAAc,CAAC,EAAE,aAAa,EAAE,KAAK,CAAC,aAAa,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;QAC9G,GAAG,uBAAuB,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;QAC1C,KAAK,EAAE,gBAAgB,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC;KACrD,CAAC,CAAC;IACH,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC;AAC1E,CAAC"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * @file The executable tool contribution, defined on the lifecycle's one executable loader
3
+ * (`defineExecutablePluginContribution`) so tool modules pass the same gates as every other seam
4
+ * that runs plugin code: active plugin, bundled digest, contained `.mjs` path. No second loader.
5
+ * The filename is the host's: Jini never names a product's contribution file.
6
+ */
7
+ import { type LoadedPluginContribution, type PluginContributionDefinition } from '../contribution-loader.js';
8
+ import type { AgentPluginToolCapabilities } from './capabilities.js';
9
+ import { type AgentPluginToolDescriptor } from './manifest.js';
10
+ /** What a tool module's default export must be. `input` has already passed the declared schema. */
11
+ export interface AgentPluginToolModule {
12
+ readonly invoke: (required: {
13
+ readonly input: Readonly<Record<string, unknown>>;
14
+ readonly capabilities: AgentPluginToolCapabilities;
15
+ readonly signal?: AbortSignal;
16
+ }, optional?: Record<string, never>) => unknown;
17
+ /** Human-readable resources the call would change, shown before confirmation. Required unless `read`. */
18
+ readonly describeAffectedResources?: (required: {
19
+ readonly input: Readonly<Record<string, unknown>>;
20
+ }, optional?: Record<string, never>) => unknown;
21
+ }
22
+ export type LoadedAgentPluginTool = LoadedPluginContribution<AgentPluginToolDescriptor, AgentPluginToolModule>;
23
+ /**
24
+ * Defines the tool contribution for a host-chosen filename (e.g. `<product>-agent-tools.json`).
25
+ * @param required.filename - The file a plugin ships at its package root to contribute tools.
26
+ * @returns A definition for `loadPluginContributions`; executable, so activation is always required.
27
+ * @complexity O(1); each load is one contained import per declared tool (Node caches per file URL).
28
+ */
29
+ export declare function defineAgentPluginToolContribution(required: {
30
+ readonly filename: string;
31
+ }, _optional?: Record<string, never>): PluginContributionDefinition<AgentPluginToolDescriptor, LoadedAgentPluginTool>;
32
+ //# sourceMappingURL=definition.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"definition.d.ts","sourceRoot":"","sources":["../../../src/lifecycle/tools/definition.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAsC,KAAK,wBAAwB,EAAE,KAAK,4BAA4B,EAAE,MAAM,2BAA2B,CAAC;AACjJ,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,mBAAmB,CAAC;AACrE,OAAO,EAA6B,KAAK,yBAAyB,EAAE,MAAM,eAAe,CAAC;AAE1F,mGAAmG;AACnG,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,MAAM,EAAE,CACf,QAAQ,EAAE;QAAE,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;QAAC,QAAQ,CAAC,YAAY,EAAE,2BAA2B,CAAC;QAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAA;KAAE,EAClJ,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,KAC7B,OAAO,CAAC;IACb,yGAAyG;IACzG,QAAQ,CAAC,yBAAyB,CAAC,EAAE,CAAC,QAAQ,EAAE;QAAE,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAA;KAAE,EAAE,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,KAAK,OAAO,CAAC;CACrJ;AAED,MAAM,MAAM,qBAAqB,GAAG,wBAAwB,CAAC,yBAAyB,EAAE,qBAAqB,CAAC,CAAC;AAW/G;;;;;GAKG;AACH,wBAAgB,iCAAiC,CAC/C,QAAQ,EAAE;IAAE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,EACvC,SAAS,GAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAM,GACpC,4BAA4B,CAAC,yBAAyB,EAAE,qBAAqB,CAAC,CAMhF"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * @file The executable tool contribution, defined on the lifecycle's one executable loader
3
+ * (`defineExecutablePluginContribution`) so tool modules pass the same gates as every other seam
4
+ * that runs plugin code: active plugin, bundled digest, contained `.mjs` path. No second loader.
5
+ * The filename is the host's: Jini never names a product's contribution file.
6
+ */
7
+ import { defineExecutablePluginContribution } from '../contribution-loader.js';
8
+ import { parseAgentPluginToolsFile } from './manifest.js';
9
+ /** The module's export as a tool module, or why not. Shape only; effect rules apply at projection. @complexity O(1). */
10
+ function validateToolModule({ exported }) {
11
+ if (typeof exported !== 'object' || exported === null)
12
+ return "its module's default export is not an object";
13
+ const candidate = exported;
14
+ if (typeof candidate.invoke !== 'function')
15
+ return "its module's default export has no invoke()";
16
+ if (candidate.describeAffectedResources !== undefined && typeof candidate.describeAffectedResources !== 'function')
17
+ return 'describeAffectedResources must be a function';
18
+ return exported;
19
+ }
20
+ /**
21
+ * Defines the tool contribution for a host-chosen filename (e.g. `<product>-agent-tools.json`).
22
+ * @param required.filename - The file a plugin ships at its package root to contribute tools.
23
+ * @returns A definition for `loadPluginContributions`; executable, so activation is always required.
24
+ * @complexity O(1); each load is one contained import per declared tool (Node caches per file URL).
25
+ */
26
+ export function defineAgentPluginToolContribution(required, _optional = {}) {
27
+ return defineExecutablePluginContribution({
28
+ filename: required.filename, contribution: 'agent tools',
29
+ parse: parseAgentPluginToolsFile, modulePath: ({ descriptor }) => descriptor.module, validate: validateToolModule,
30
+ refusal: ({ plugin, descriptor, reason }) => `agent tool '${descriptor.name}' from '${plugin.pluginId}' was not loaded: ${reason}`,
31
+ });
32
+ }
33
+ //# sourceMappingURL=definition.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"definition.js","sourceRoot":"","sources":["../../../src/lifecycle/tools/definition.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,kCAAkC,EAAoE,MAAM,2BAA2B,CAAC;AAEjJ,OAAO,EAAE,yBAAyB,EAAkC,MAAM,eAAe,CAAC;AAc1F,wHAAwH;AACxH,SAAS,kBAAkB,CAAC,EAAE,QAAQ,EAAkC;IACtE,IAAI,OAAO,QAAQ,KAAK,QAAQ,IAAI,QAAQ,KAAK,IAAI;QAAE,OAAO,8CAA8C,CAAC;IAC7G,MAAM,SAAS,GAAG,QAAiE,CAAC;IACpF,IAAI,OAAO,SAAS,CAAC,MAAM,KAAK,UAAU;QAAE,OAAO,6CAA6C,CAAC;IACjG,IAAI,SAAS,CAAC,yBAAyB,KAAK,SAAS,IAAI,OAAO,SAAS,CAAC,yBAAyB,KAAK,UAAU;QAAE,OAAO,8CAA8C,CAAC;IAC1K,OAAO,QAAiC,CAAC;AAC3C,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,iCAAiC,CAC/C,QAAuC,EACvC,YAAmC,EAAE;IAErC,OAAO,kCAAkC,CAAmD;QAC1F,QAAQ,EAAE,QAAQ,CAAC,QAAQ,EAAE,YAAY,EAAE,aAAa;QACxD,KAAK,EAAE,yBAAyB,EAAE,UAAU,EAAE,CAAC,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC,UAAU,CAAC,MAAM,EAAE,QAAQ,EAAE,kBAAkB;QACjH,OAAO,EAAE,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,eAAe,UAAU,CAAC,IAAI,WAAW,MAAM,CAAC,QAAQ,qBAAqB,MAAM,EAAE;KACnI,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @file Public surface of `@jini-ai/agent-plugins/lifecycle/tools`: executable Agent Plugin tools.
3
+ * A separate subpath because it needs the optional `@cfworker/json-schema` peer; consumers of
4
+ * `./lifecycle` alone do not. The plugin tool contract arrives as host ports, never an import. See this folder's README.md.
5
+ */
6
+ export { parseAgentPluginToolsFile, type AgentPluginToolDescriptor, type AgentPluginToolEffect } from './manifest.js';
7
+ export { defineAgentPluginToolContribution, type AgentPluginToolModule, type LoadedAgentPluginTool } from './definition.js';
8
+ export { WITHHELD_OUTPUT_MESSAGE, createIssuedTokenMemories, type IssuedTokenMemories, type AgentPluginToolCapabilities, type AgentPluginToolCapabilitiesPort, type AgentPluginToolCapabilityScope, type AgentPluginHttpOptions, type AgentPluginLimitResult, type AgentPluginStateReader, type AgentPluginStateValue, } from './capabilities.js';
9
+ export { createAgentPluginToolProjection, type AgentPluginToolDisclosure, type AgentPluginToolProjectionPorts, type AgentPluginAdditionalTool, type AgentPluginToolSnapshot, type AgentPluginContractTool, type AgentPluginToolInvocation, } from './projection.js';
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lifecycle/tools/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,yBAAyB,EAAE,KAAK,yBAAyB,EAAE,KAAK,qBAAqB,EAAE,MAAM,eAAe,CAAC;AACtH,OAAO,EAAE,iCAAiC,EAAE,KAAK,qBAAqB,EAAE,KAAK,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAC5H,OAAO,EACL,uBAAuB,EAAE,yBAAyB,EAAE,KAAK,mBAAmB,EAC5E,KAAK,2BAA2B,EAAE,KAAK,+BAA+B,EAAE,KAAK,8BAA8B,EAC3G,KAAK,sBAAsB,EAAE,KAAK,sBAAsB,EAAE,KAAK,sBAAsB,EAAE,KAAK,qBAAqB,GAClH,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,+BAA+B,EAAE,KAAK,yBAAyB,EAAE,KAAK,8BAA8B,EACpG,KAAK,yBAAyB,EAAE,KAAK,uBAAuB,EAAE,KAAK,uBAAuB,EAAE,KAAK,yBAAyB,GAC3H,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @file Public surface of `@jini-ai/agent-plugins/lifecycle/tools`: executable Agent Plugin tools.
3
+ * A separate subpath because it needs the optional `@cfworker/json-schema` peer; consumers of
4
+ * `./lifecycle` alone do not. The plugin tool contract arrives as host ports, never an import. See this folder's README.md.
5
+ */
6
+ export { parseAgentPluginToolsFile } from './manifest.js';
7
+ export { defineAgentPluginToolContribution } from './definition.js';
8
+ export { WITHHELD_OUTPUT_MESSAGE, createIssuedTokenMemories, } from './capabilities.js';
9
+ export { createAgentPluginToolProjection, } from './projection.js';
10
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lifecycle/tools/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,yBAAyB,EAA8D,MAAM,eAAe,CAAC;AACtH,OAAO,EAAE,iCAAiC,EAA0D,MAAM,iBAAiB,CAAC;AAC5H,OAAO,EACL,uBAAuB,EAAE,yBAAyB,GAGnD,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,+BAA+B,GAEhC,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * @file Parses an Agent Plugin's tool contribution file: the data half of an executable tool.
3
+ * Name, description, effect class and input schema are declared as reviewable data so the host can
4
+ * list, namespace and validate a tool without running plugin code; only `module` points at code.
5
+ * Pure: no I/O. A file that fails any rule is refused whole, so a plugin never ships half its tools.
6
+ */
7
+ import type { PluginContributionParseResult } from '../contribution-loader.js';
8
+ /**
9
+ * Declared change class; `write` and `destructive` tools must also disclose affected resources.
10
+ * The mirror of `PluginToolEffect` in `@jini-ai/plugins/host` (agent-plugins may not import it); the
11
+ * projection's contract tool reuses this type, so these two are the only declarations.
12
+ */
13
+ export type AgentPluginToolEffect = 'read' | 'write' | 'destructive';
14
+ /** One declared tool. `name` is local; the host namespaces it as `p_<plugin>__<name>`. */
15
+ export interface AgentPluginToolDescriptor {
16
+ readonly name: string;
17
+ readonly description: string;
18
+ readonly effect: AgentPluginToolEffect;
19
+ /** Plain-JS module inside the plugin root (`.mjs`); containment is checked on disk at import. */
20
+ readonly module: string;
21
+ /** JSON Schema (2020-12) for the tool input; must describe an object. */
22
+ readonly inputSchema: Readonly<Record<string, unknown>>;
23
+ }
24
+ /**
25
+ * Parses the raw contribution file. A local name declared twice is refused (duplicate id).
26
+ * @param required.raw - The file text as read from a trusted package.
27
+ * @returns Descriptors in declaration order, or the reason the whole file is refused.
28
+ * @complexity O(t^2 + s) for t declarations (t <= 128) and s total schema size.
29
+ */
30
+ export declare function parseAgentPluginToolsFile(required: {
31
+ readonly raw: string;
32
+ }, _optional?: Record<string, never>): PluginContributionParseResult<AgentPluginToolDescriptor>;
33
+ //# sourceMappingURL=manifest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../../../src/lifecycle/tools/manifest.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,2BAA2B,CAAC;AAE/E;;;;GAIG;AACH,MAAM,MAAM,qBAAqB,GAAG,MAAM,GAAG,OAAO,GAAG,aAAa,CAAC;AAErE,0FAA0F;AAC1F,MAAM,WAAW,yBAAyB;IACxC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,MAAM,EAAE,qBAAqB,CAAC;IACvC,iGAAiG;IACjG,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,yEAAyE;IACzE,QAAQ,CAAC,WAAW,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;CACzD;AA+DD;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,QAAQ,EAAE;IAAE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;CAAE,EAAE,SAAS,GAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAM,GAAG,6BAA6B,CAAC,yBAAyB,CAAC,CAW7K"}