@adonis-agora/agent 0.62.0 → 0.64.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.
- package/CHANGELOG.md +40 -0
- package/dist/providers/agent_provider.d.ts.map +1 -1
- package/dist/providers/agent_provider.js +1 -12
- package/dist/providers/agent_provider.js.map +1 -1
- package/dist/src/action-proposal-service.d.ts +3 -2
- package/dist/src/action-proposal-service.d.ts.map +1 -1
- package/dist/src/action-proposal-service.js +1 -0
- package/dist/src/action-proposal-service.js.map +1 -1
- package/dist/src/action-proposal-text.d.ts +5 -0
- package/dist/src/action-proposal-text.d.ts.map +1 -1
- package/dist/src/action-proposal-text.js +1 -0
- package/dist/src/action-proposal-text.js.map +1 -1
- package/dist/src/actor-resolver.d.ts +12 -4
- package/dist/src/actor-resolver.d.ts.map +1 -1
- package/dist/src/actor-resolver.js +24 -7
- package/dist/src/actor-resolver.js.map +1 -1
- package/dist/src/ag-ui/adapter.d.ts.map +1 -1
- package/dist/src/ag-ui/adapter.js +32 -6
- package/dist/src/ag-ui/adapter.js.map +1 -1
- package/dist/src/ag-ui/core/encoder.d.ts +2 -1
- package/dist/src/ag-ui/core/encoder.d.ts.map +1 -1
- package/dist/src/ag-ui/core/encoder.js +16 -5
- package/dist/src/ag-ui/core/encoder.js.map +1 -1
- package/dist/src/ag-ui/core/index.d.ts +2 -2
- package/dist/src/ag-ui/core/index.d.ts.map +1 -1
- package/dist/src/ag-ui/core/index.js +2 -2
- package/dist/src/ag-ui/core/index.js.map +1 -1
- package/dist/src/ag-ui/core/input.d.ts +21 -3
- package/dist/src/ag-ui/core/input.d.ts.map +1 -1
- package/dist/src/ag-ui/core/input.js +24 -6
- package/dist/src/ag-ui/core/input.js.map +1 -1
- package/dist/src/ag-ui/core/stream.d.ts +24 -2
- package/dist/src/ag-ui/core/stream.d.ts.map +1 -1
- package/dist/src/ag-ui/core/stream.js +25 -3
- package/dist/src/ag-ui/core/stream.js.map +1 -1
- package/dist/src/ag-ui/core/types.d.ts +2 -2
- package/dist/src/ag-ui/core/types.d.ts.map +1 -1
- package/dist/src/ag-ui/core/types.js +2 -2
- package/dist/src/ag-ui/core/types.js.map +1 -1
- package/dist/src/ag-ui/frames.d.ts +5 -1
- package/dist/src/ag-ui/frames.d.ts.map +1 -1
- package/dist/src/ag-ui/frames.js +13 -3
- package/dist/src/ag-ui/frames.js.map +1 -1
- package/dist/src/ag-ui/index.d.ts +1 -1
- package/dist/src/ag-ui/index.d.ts.map +1 -1
- package/dist/src/ag-ui/index.js +1 -1
- package/dist/src/ag-ui/index.js.map +1 -1
- package/dist/src/agent-service.d.ts +36 -3
- package/dist/src/agent-service.d.ts.map +1 -1
- package/dist/src/agent-service.js +65 -1
- package/dist/src/agent-service.js.map +1 -1
- package/dist/src/attachment-limits.d.ts +10 -0
- package/dist/src/attachment-limits.d.ts.map +1 -0
- package/dist/src/attachment-limits.js +13 -0
- package/dist/src/attachment-limits.js.map +1 -0
- package/dist/src/channels/adapters/evolution_api.d.ts +58 -0
- package/dist/src/channels/adapters/evolution_api.d.ts.map +1 -0
- package/dist/src/channels/adapters/evolution_api.js +256 -0
- package/dist/src/channels/adapters/evolution_api.js.map +1 -0
- package/dist/src/channels/adapters/telegram.d.ts +34 -0
- package/dist/src/channels/adapters/telegram.d.ts.map +1 -0
- package/dist/src/channels/adapters/telegram.js +196 -0
- package/dist/src/channels/adapters/telegram.js.map +1 -0
- package/dist/src/channels/adapters/whatsapp_cloud.d.ts +31 -0
- package/dist/src/channels/adapters/whatsapp_cloud.d.ts.map +1 -0
- package/dist/src/channels/adapters/whatsapp_cloud.js +177 -0
- package/dist/src/channels/adapters/whatsapp_cloud.js.map +1 -0
- package/dist/src/channels/adapters/whatsmiau.d.ts +26 -0
- package/dist/src/channels/adapters/whatsmiau.d.ts.map +1 -0
- package/dist/src/channels/adapters/whatsmiau.js +18 -0
- package/dist/src/channels/adapters/whatsmiau.js.map +1 -0
- package/dist/src/channels/handler.d.ts +190 -0
- package/dist/src/channels/handler.d.ts.map +1 -0
- package/dist/src/channels/handler.js +626 -0
- package/dist/src/channels/handler.js.map +1 -0
- package/dist/src/channels/http.d.ts +45 -0
- package/dist/src/channels/http.d.ts.map +1 -0
- package/dist/src/channels/http.js +147 -0
- package/dist/src/channels/http.js.map +1 -0
- package/dist/src/channels/index.d.ts +17 -0
- package/dist/src/channels/index.d.ts.map +1 -0
- package/dist/src/channels/index.js +16 -0
- package/dist/src/channels/index.js.map +1 -0
- package/dist/src/channels/markdown.d.ts +12 -0
- package/dist/src/channels/markdown.d.ts.map +1 -0
- package/dist/src/channels/markdown.js +120 -0
- package/dist/src/channels/markdown.js.map +1 -0
- package/dist/src/channels/questions.d.ts +45 -0
- package/dist/src/channels/questions.d.ts.map +1 -0
- package/dist/src/channels/questions.js +131 -0
- package/dist/src/channels/questions.js.map +1 -0
- package/dist/src/channels/split.d.ts +8 -0
- package/dist/src/channels/split.d.ts.map +1 -0
- package/dist/src/channels/split.js +45 -0
- package/dist/src/channels/split.js.map +1 -0
- package/dist/src/channels/store.d.ts +78 -0
- package/dist/src/channels/store.d.ts.map +1 -0
- package/dist/src/channels/store.js +151 -0
- package/dist/src/channels/store.js.map +1 -0
- package/dist/src/channels/types.d.ts +145 -0
- package/dist/src/channels/types.d.ts.map +1 -0
- package/dist/src/channels/types.js +7 -0
- package/dist/src/channels/types.js.map +1 -0
- package/dist/src/genui/builtins.d.ts.map +1 -1
- package/dist/src/genui/builtins.js +65 -6
- package/dist/src/genui/builtins.js.map +1 -1
- package/dist/src/genui/catalog.d.ts +11 -2
- package/dist/src/genui/catalog.d.ts.map +1 -1
- package/dist/src/genui/catalog.js +8 -0
- package/dist/src/genui/catalog.js.map +1 -1
- package/dist/src/genui/text.d.ts +4 -3
- package/dist/src/genui/text.d.ts.map +1 -1
- package/dist/src/genui/text.js +25 -24
- package/dist/src/genui/text.js.map +1 -1
- package/dist/src/genui/tools.d.ts +2 -1
- package/dist/src/genui/tools.d.ts.map +1 -1
- package/dist/src/genui/tools.js +6 -7
- package/dist/src/genui/tools.js.map +1 -1
- package/dist/src/index.d.ts +3 -2
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +3 -2
- package/dist/src/index.js.map +1 -1
- package/dist/src/opencode/turns.d.ts +4 -2
- package/dist/src/opencode/turns.d.ts.map +1 -1
- package/dist/src/opencode/turns.js.map +1 -1
- package/dist/src/react/core/ag-ui-backend.d.ts +38 -14
- package/dist/src/react/core/ag-ui-backend.d.ts.map +1 -1
- package/dist/src/react/core/ag-ui-backend.js +182 -17
- package/dist/src/react/core/ag-ui-backend.js.map +1 -1
- package/dist/src/react/core/agent-chat-transport.d.ts.map +1 -1
- package/dist/src/react/core/agent-chat-transport.js +22 -1
- package/dist/src/react/core/agent-chat-transport.js.map +1 -1
- package/dist/src/react/core/backend.d.ts +11 -0
- package/dist/src/react/core/backend.d.ts.map +1 -1
- package/dist/src/react/core/backend.js.map +1 -1
- package/dist/src/react/core/index.d.ts +1 -1
- package/dist/src/react/core/index.d.ts.map +1 -1
- package/dist/src/react/core/index.js.map +1 -1
- package/dist/src/stores/lucid-schema.d.ts +24 -6
- package/dist/src/stores/lucid-schema.d.ts.map +1 -1
- package/dist/src/stores/lucid-schema.js +47 -6
- package/dist/src/stores/lucid-schema.js.map +1 -1
- package/dist/src/stores/lucid.d.ts +2 -0
- package/dist/src/stores/lucid.d.ts.map +1 -1
- package/dist/src/stores/lucid.js +4 -0
- package/dist/src/stores/lucid.js.map +1 -1
- package/package.json +6 -1
- package/skills/agent-setup/SKILL.md +40 -3
- package/skills/agent-tools/SKILL.md +3 -0
|
@@ -21,6 +21,7 @@ sources:
|
|
|
21
21
|
- "DavideCarvalho/adonis-agent:packages/adonis/src/stores/factory.ts"
|
|
22
22
|
- "DavideCarvalho/adonis-agent:packages/adonis/docs/react.mdx"
|
|
23
23
|
- "DavideCarvalho/adonis-agent:packages/adonis/src/react/index.ts"
|
|
24
|
+
- "DavideCarvalho/adonis-agent:packages/adonis/docs/channels.mdx"
|
|
24
25
|
---
|
|
25
26
|
|
|
26
27
|
# Setting up @adonis-agora/agent
|
|
@@ -78,10 +79,10 @@ export default defineConfig({
|
|
|
78
79
|
})
|
|
79
80
|
```
|
|
80
81
|
|
|
81
|
-
Run the published migrations for the
|
|
82
|
+
Run the published migrations for the agent tables (`agent_action_proposal`,
|
|
82
83
|
`agent_thread`, `agent_message`, `agent_tool_call`, `agent_token_usage`,
|
|
83
84
|
`agent_model_pricing`, `agent_run`, `agent_queued_message`, `agent_confirm_token`, plus the
|
|
84
|
-
`agent_stream_frame` buffer):
|
|
85
|
+
`agent_stream_frame` buffer and the text channels' `agent_channel_state`):
|
|
85
86
|
|
|
86
87
|
```bash
|
|
87
88
|
node ace migration:run
|
|
@@ -265,6 +266,41 @@ token sink any replica serves the resume. The native stream is unchanged.
|
|
|
265
266
|
|
|
266
267
|
Source: `packages/adonis/docs/ag-ui.mdx`, `packages/adonis/src/ag-ui/`.
|
|
267
268
|
|
|
269
|
+
### Pattern 6 — answer on WhatsApp / Telegram with `channels.handle()`
|
|
270
|
+
|
|
271
|
+
```ts
|
|
272
|
+
// start/routes.ts
|
|
273
|
+
import { channels, evolutionApi } from '@adonis-agora/agent/channels'
|
|
274
|
+
|
|
275
|
+
router.post(
|
|
276
|
+
'/webhooks/whatsapp',
|
|
277
|
+
channels.handle(
|
|
278
|
+
evolutionApi({ url, instance, apiKey, webhookToken }), // or whatsappCloud({…}) / telegram({…})
|
|
279
|
+
{
|
|
280
|
+
actor: (message) => actorForPhone(message.from), // null → not answered
|
|
281
|
+
thread: (actor, message) => threadFor(message.conversation), // null → new thread
|
|
282
|
+
onThreadCreated: (threadId, actor, message) => saveThread(message.conversation, threadId),
|
|
283
|
+
},
|
|
284
|
+
),
|
|
285
|
+
)
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
The handler verifies the webhook (token / HMAC / secret header), dedupes by provider message id,
|
|
289
|
+
answers `200` at once and runs the turn in the background (`await handler.drain()` in tests).
|
|
290
|
+
Replies are text-only (components → `fallbackText`), converted to the channel's markdown and split
|
|
291
|
+
at its length limit. Media is downloaded and attached when `attachments` is configured (else the
|
|
292
|
+
person is told why not). `ask` questions go out as numbered text, one at a time; the next messages
|
|
293
|
+
answer them. State (message ids, questions in progress, relayed outcomes) lives in
|
|
294
|
+
`agent_channel_state` via `lucidChannelStore()` when the agent store is Lucid, else memory —
|
|
295
|
+
`store: redisChannelStore(redis)` otherwise on several replicas. Use
|
|
296
|
+
`actionApprovalMode: 'independent'`: pending proposals go out as Confirm/Cancel buttons where the
|
|
297
|
+
adapter enables them, else a text instruction in the `actionProposalText` vocabulary (a buttons
|
|
298
|
+
message carries that instruction too, so a phone that shows no buttons can still answer by text), and `actionProposalWorker: { onSettled:
|
|
299
|
+
channels.onSettled }` relays outcomes that settle later. In blocking mode the channel can only say
|
|
300
|
+
the approval must happen in the app. Exclude webhook routes from Shield's CSRF check.
|
|
301
|
+
|
|
302
|
+
Source: `packages/adonis/docs/channels.mdx`, `packages/adonis/src/channels/`.
|
|
303
|
+
|
|
268
304
|
## Component rendering entries
|
|
269
305
|
|
|
270
306
|
Agora owns its catalog (`@adonis-agora/agent/genui`), browser rendering
|
|
@@ -289,7 +325,8 @@ Source: `packages/adonis/docs/authoring/component-rendering.mdx`,
|
|
|
289
325
|
|
|
290
326
|
The route answers the LAST user message of `messages`; the thread's history is the one the server
|
|
291
327
|
stored under `threadId`. Media parts must be inline (`source.type: 'data'`) and need
|
|
292
|
-
`attachments:` configured — a `url` or `file` source is dropped with an `agora.warning`.
|
|
328
|
+
`attachments:` configured — a `url` or a `file` source from another provider is dropped with an `agora.warning`.
|
|
329
|
+
A `file` handle with `provider: 'agora'` naming an upload this agent staged is resolved for the caller instead.
|
|
293
330
|
|
|
294
331
|
Source: `packages/adonis/docs/ag-ui.mdx`.
|
|
295
332
|
|
|
@@ -238,6 +238,9 @@ export const listRecords = defineTool({
|
|
|
238
238
|
})
|
|
239
239
|
```
|
|
240
240
|
|
|
241
|
+
`table` and `chart` present the builtin `DataTable` and `Chart` definitions: put them in the
|
|
242
|
+
genui catalog (`BUILTIN_COMPONENTS` from `@adonis-agora/agent/genui/builtins`, or the two
|
|
243
|
+
definitions) and register app renderers under those names. Builtins carry no visuals.
|
|
241
244
|
Use `createComponent` for custom definitions and one `createComponentRegistry` per app
|
|
242
245
|
or tenant. Input `props` may transform; if the transform changes shape or is not
|
|
243
246
|
idempotent, declare `outputProps` to validate the normalized JSON persisted in frames.
|