@adonis-agora/agent 0.55.0 → 0.56.0

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 (88) hide show
  1. package/CHANGELOG.md +49 -0
  2. package/dist/providers/agent_provider.d.ts.map +1 -1
  3. package/dist/providers/agent_provider.js +84 -10
  4. package/dist/providers/agent_provider.js.map +1 -1
  5. package/dist/src/agent-service.d.ts +22 -0
  6. package/dist/src/agent-service.d.ts.map +1 -1
  7. package/dist/src/agent-service.js +57 -5
  8. package/dist/src/agent-service.js.map +1 -1
  9. package/dist/src/ai-tool-ref.d.ts +26 -4
  10. package/dist/src/ai-tool-ref.d.ts.map +1 -1
  11. package/dist/src/ai-tool-ref.js +6 -1
  12. package/dist/src/ai-tool-ref.js.map +1 -1
  13. package/dist/src/confirmed-tool.d.ts +2 -2
  14. package/dist/src/confirmed-tool.d.ts.map +1 -1
  15. package/dist/src/confirmed-tool.js.map +1 -1
  16. package/dist/src/guardrails/agent.d.ts.map +1 -1
  17. package/dist/src/guardrails/agent.js +11 -0
  18. package/dist/src/guardrails/agent.js.map +1 -1
  19. package/dist/src/index.d.ts +4 -3
  20. package/dist/src/index.d.ts.map +1 -1
  21. package/dist/src/index.js +4 -3
  22. package/dist/src/index.js.map +1 -1
  23. package/dist/src/mcp-client/options.d.ts +12 -0
  24. package/dist/src/mcp-client/options.d.ts.map +1 -1
  25. package/dist/src/mcp-client/tool-source.d.ts.map +1 -1
  26. package/dist/src/mcp-client/tool-source.js +2 -0
  27. package/dist/src/mcp-client/tool-source.js.map +1 -1
  28. package/dist/src/media/index.d.ts +1 -1
  29. package/dist/src/media/index.d.ts.map +1 -1
  30. package/dist/src/media/index.js +1 -1
  31. package/dist/src/media/index.js.map +1 -1
  32. package/dist/src/media/media-attachment-staging.d.ts +107 -6
  33. package/dist/src/media/media-attachment-staging.d.ts.map +1 -1
  34. package/dist/src/media/media-attachment-staging.js +173 -21
  35. package/dist/src/media/media-attachment-staging.js.map +1 -1
  36. package/dist/src/react/ag-ui.d.ts +41 -0
  37. package/dist/src/react/ag-ui.d.ts.map +1 -0
  38. package/dist/src/react/ag-ui.js +63 -0
  39. package/dist/src/react/ag-ui.js.map +1 -0
  40. package/dist/src/react/client.d.ts +12 -0
  41. package/dist/src/react/client.d.ts.map +1 -0
  42. package/dist/src/react/client.js +21 -0
  43. package/dist/src/react/client.js.map +1 -0
  44. package/dist/src/react/index.d.ts +3 -8
  45. package/dist/src/react/index.d.ts.map +1 -1
  46. package/dist/src/react/index.js +4 -20
  47. package/dist/src/react/index.js.map +1 -1
  48. package/dist/src/react/media.d.ts +18 -0
  49. package/dist/src/react/media.d.ts.map +1 -0
  50. package/dist/src/react/media.js +18 -0
  51. package/dist/src/react/media.js.map +1 -0
  52. package/dist/src/spi/agent-store.d.ts +22 -0
  53. package/dist/src/spi/agent-store.d.ts.map +1 -1
  54. package/dist/src/spi/agent-store.js.map +1 -1
  55. package/dist/src/spi/attachment-staging.d.ts +5 -0
  56. package/dist/src/spi/attachment-staging.d.ts.map +1 -1
  57. package/dist/src/spi/tool.d.ts +24 -0
  58. package/dist/src/spi/tool.d.ts.map +1 -1
  59. package/dist/src/stores/factory.d.ts +8 -2
  60. package/dist/src/stores/factory.d.ts.map +1 -1
  61. package/dist/src/stores/factory.js +8 -2
  62. package/dist/src/stores/factory.js.map +1 -1
  63. package/dist/src/stores/lucid-schema.d.ts.map +1 -1
  64. package/dist/src/stores/lucid-schema.js +2 -0
  65. package/dist/src/stores/lucid-schema.js.map +1 -1
  66. package/dist/src/stores/lucid.d.ts +12 -0
  67. package/dist/src/stores/lucid.d.ts.map +1 -1
  68. package/dist/src/stores/lucid.js +47 -0
  69. package/dist/src/stores/lucid.js.map +1 -1
  70. package/dist/src/testing/in-memory-store.d.ts +7 -0
  71. package/dist/src/testing/in-memory-store.d.ts.map +1 -1
  72. package/dist/src/testing/in-memory-store.js +33 -0
  73. package/dist/src/testing/in-memory-store.js.map +1 -1
  74. package/dist/src/tool-discovery.d.ts.map +1 -1
  75. package/dist/src/tool-discovery.js +27 -9
  76. package/dist/src/tool-discovery.js.map +1 -1
  77. package/dist/src/tool-filters.d.ts +33 -0
  78. package/dist/src/tool-filters.d.ts.map +1 -0
  79. package/dist/src/tool-filters.js +45 -0
  80. package/dist/src/tool-filters.js.map +1 -0
  81. package/dist/src/tool-registry.d.ts +33 -5
  82. package/dist/src/tool-registry.d.ts.map +1 -1
  83. package/dist/src/tool-registry.js +55 -11
  84. package/dist/src/tool-registry.js.map +1 -1
  85. package/dist/src/types.d.ts +16 -0
  86. package/dist/src/types.d.ts.map +1 -1
  87. package/package.json +13 -3
  88. package/skills/agent-tools/SKILL.md +19 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adonis-agora/agent",
3
- "version": "0.55.0",
3
+ "version": "0.56.0",
4
4
  "description": "Governed, durable-backed AI agent (chat + tool-calling + governance) for AdonisJS — part of the Agora ecosystem.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -156,6 +156,11 @@
156
156
  "import": "./dist/src/react/genui/json-render.js",
157
157
  "default": "./dist/src/react/genui/json-render.js"
158
158
  },
159
+ "./react/media": {
160
+ "types": "./dist/src/react/media.d.ts",
161
+ "import": "./dist/src/react/media.js",
162
+ "default": "./dist/src/react/media.js"
163
+ },
159
164
  "./react/markdown": {
160
165
  "types": "./dist/src/react/markdown.d.ts",
161
166
  "import": "./dist/src/react/markdown.js",
@@ -200,7 +205,8 @@
200
205
  "@adonisjs/lucid": "^22.4.0",
201
206
  "@adonisjs/redis": "^9.2.0 || ^10.0.0 || ^11.0.0",
202
207
  "@dudousxd/nestjs-agent-core": ">=0.26.0 <1.0.0",
203
- "@dudousxd/nestjs-agent-react": ">=0.28.0 <1.0.0",
208
+ "@dudousxd/nestjs-agent-react": ">=0.30.0 <1.0.0",
209
+ "@dudousxd/nestjs-media-client": ">=0.3.0 <1.0.0",
204
210
  "@qdrant/js-client-rest": "^1.11.0",
205
211
  "ai": "^7.0.0",
206
212
  "node-sql-parser": "^5.3.0",
@@ -253,6 +259,9 @@
253
259
  "@dudousxd/nestjs-agent-react": {
254
260
  "optional": true
255
261
  },
262
+ "@dudousxd/nestjs-media-client": {
263
+ "optional": true
264
+ },
256
265
  "@adonis-agora/media": {
257
266
  "optional": true
258
267
  }
@@ -270,7 +279,8 @@
270
279
  "@ag-ui/core": "1.0.1",
271
280
  "@ai-sdk/react": "^4.0.125",
272
281
  "@dudousxd/nestjs-agent-core": "0.33.0",
273
- "@dudousxd/nestjs-agent-react": "0.28.0",
282
+ "@dudousxd/nestjs-agent-react": "0.31.0",
283
+ "@dudousxd/nestjs-media-client": "0.3.0",
274
284
  "@qdrant/js-client-rest": "1.19.0",
275
285
  "@tanstack/intent": "0.4.0",
276
286
  "@testing-library/dom": "10.4.2",
@@ -50,7 +50,7 @@ export default class GetWeather extends ReadTool<Input, { tempC: number }> {
50
50
  name: 'get_weather',
51
51
  description: 'Current weather for a city.',
52
52
  input,
53
- roles: ['MEMBER'], // omit → config.defaultRoles (['ADMIN'] by default)
53
+ roles: ['MEMBER'], // omit → config.defaultRoles ([] — open — by default)
54
54
  }
55
55
 
56
56
  async execute({ city }: Input, _ctx: AiToolCtx) {
@@ -209,6 +209,24 @@ arguments and expires (`ttlMs`, default 15 min).
209
209
  Source: `packages/adonis/docs/mcp.mdx` ("Writes with a human gate"),
210
210
  `packages/adonis/src/confirmed-tool.ts`.
211
211
 
212
+ ## Feature flags and per-user gates — `enabled`, `isEnabled()`, `canUse(actor)`
213
+
214
+ ```ts
215
+ // A flag with no service behind it: on the options (boolean, or a predicate re-read every turn).
216
+ static tool = { name: 'search_docs', description: '...', input, enabled: () => env.get('DOCS') === true }
217
+
218
+ // A flag or entitlement that needs a service: methods on the (container-resolved) class.
219
+ isEnabled() { return this.flags.on('docs') }
220
+ canUse(actor: Actor) { return this.plans.includesDocs(actor.tenantRef) }
221
+ ```
222
+
223
+ `defineTool` / `defineConfirmedTool` take `enabled` and `canUse` as options; `mcpServers[]`
224
+ takes both per server. Order on the offered list AND on invoke: allow-list → `enabled` →
225
+ `RolesPolicy` → `canUse`; none can widen. A disabled tool is never shown to the model and
226
+ invoking one throws `ToolDisabledError` (not `ToolForbiddenError`). Prefer these to registering a
227
+ tool conditionally, and to refusing inside `execute` (which costs the model a turn).
228
+ Source: `packages/adonis/docs/authoring/tools.mdx`, `packages/adonis/src/tool-filters.ts`.
229
+
212
230
  ## Common mistakes
213
231
 
214
232
  ### CRITICAL — shipping a privileged tool without `roles`