@adonis-agora/agent 0.91.6 → 0.93.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 (74) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/assets/spa/assets/index-DUq09Q_k.js +9 -0
  3. package/dist/assets/spa/index.html +1 -1
  4. package/dist/providers/agent_provider.d.ts.map +1 -1
  5. package/dist/providers/agent_provider.js +33 -0
  6. package/dist/providers/agent_provider.js.map +1 -1
  7. package/dist/src/agent-loop.d.ts +8 -0
  8. package/dist/src/agent-loop.d.ts.map +1 -1
  9. package/dist/src/agent-loop.js +196 -87
  10. package/dist/src/agent-loop.js.map +1 -1
  11. package/dist/src/agent-service.d.ts +73 -2
  12. package/dist/src/agent-service.d.ts.map +1 -1
  13. package/dist/src/agent-service.js +110 -2
  14. package/dist/src/agent-service.js.map +1 -1
  15. package/dist/src/diagnostics.d.ts +65 -0
  16. package/dist/src/diagnostics.d.ts.map +1 -1
  17. package/dist/src/diagnostics.js +18 -4
  18. package/dist/src/diagnostics.js.map +1 -1
  19. package/dist/src/durable/agent-run-workflow.d.ts.map +1 -1
  20. package/dist/src/durable/agent-run-workflow.js +11 -0
  21. package/dist/src/durable/agent-run-workflow.js.map +1 -1
  22. package/dist/src/index.d.ts +4 -3
  23. package/dist/src/index.d.ts.map +1 -1
  24. package/dist/src/index.js +3 -2
  25. package/dist/src/index.js.map +1 -1
  26. package/dist/src/opencode/turn.d.ts.map +1 -1
  27. package/dist/src/opencode/turn.js +4 -1
  28. package/dist/src/opencode/turn.js.map +1 -1
  29. package/dist/src/run-timings.d.ts +16 -0
  30. package/dist/src/run-timings.d.ts.map +1 -0
  31. package/dist/src/run-timings.js +59 -0
  32. package/dist/src/run-timings.js.map +1 -0
  33. package/dist/src/runners/inline-agent-runner.d.ts.map +1 -1
  34. package/dist/src/runners/inline-agent-runner.js +5 -1
  35. package/dist/src/runners/inline-agent-runner.js.map +1 -1
  36. package/dist/src/spi/agent-store.d.ts +98 -2
  37. package/dist/src/spi/agent-store.d.ts.map +1 -1
  38. package/dist/src/spi/agent-store.js +7 -0
  39. package/dist/src/spi/agent-store.js.map +1 -1
  40. package/dist/src/spi/governance-queries.d.ts +81 -0
  41. package/dist/src/spi/governance-queries.d.ts.map +1 -1
  42. package/dist/src/stores/lucid-governance-queries.d.ts +18 -1
  43. package/dist/src/stores/lucid-governance-queries.d.ts.map +1 -1
  44. package/dist/src/stores/lucid-governance-queries.js +176 -2
  45. package/dist/src/stores/lucid-governance-queries.js.map +1 -1
  46. package/dist/src/stores/lucid-schema.d.ts +20 -0
  47. package/dist/src/stores/lucid-schema.d.ts.map +1 -1
  48. package/dist/src/stores/lucid-schema.js +172 -20
  49. package/dist/src/stores/lucid-schema.js.map +1 -1
  50. package/dist/src/stores/lucid.d.ts +9 -2
  51. package/dist/src/stores/lucid.d.ts.map +1 -1
  52. package/dist/src/stores/lucid.js +41 -5
  53. package/dist/src/stores/lucid.js.map +1 -1
  54. package/dist/src/testing/in-memory-governance-queries.d.ts +11 -1
  55. package/dist/src/testing/in-memory-governance-queries.d.ts.map +1 -1
  56. package/dist/src/testing/in-memory-governance-queries.js +86 -2
  57. package/dist/src/testing/in-memory-governance-queries.js.map +1 -1
  58. package/dist/src/testing/in-memory-store.d.ts +15 -4
  59. package/dist/src/testing/in-memory-store.d.ts.map +1 -1
  60. package/dist/src/testing/in-memory-store.js +21 -4
  61. package/dist/src/testing/in-memory-store.js.map +1 -1
  62. package/dist/src/types.d.ts +6 -1
  63. package/dist/src/types.d.ts.map +1 -1
  64. package/dist/src/usage-attribution.d.ts +10 -0
  65. package/dist/src/usage-attribution.d.ts.map +1 -0
  66. package/dist/src/usage-attribution.js +12 -0
  67. package/dist/src/usage-attribution.js.map +1 -0
  68. package/dist/src/usage-ledger.d.ts +9 -0
  69. package/dist/src/usage-ledger.d.ts.map +1 -0
  70. package/dist/src/usage-ledger.js +35 -0
  71. package/dist/src/usage-ledger.js.map +1 -0
  72. package/package.json +1 -1
  73. package/skills/agent-governance/SKILL.md +1 -1
  74. package/dist/assets/spa/assets/index-BsGunSCg.js +0 -9
package/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # @adonis-agora/agent
2
2
 
3
+ ## 0.93.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#509](https://github.com/DavideCarvalho/adonis-agora-agent/pull/509) [`6dd2933`](https://github.com/DavideCarvalho/adonis-agora-agent/commit/6dd293330760da5ceddd03d4b3245a405ed2f109) Thanks [@DavideCarvalho](https://github.com/DavideCarvalho)! - One usage ledger for every AI cost, and where a run's time goes.
8
+
9
+ - `AgentService.recordUsage(input, { throwOnError? })` records AI spend from outside agent turns (transcription, TTS, batch embeddings, direct SDK calls) on `agent_token_usage`: `actorRef` (`null` → `PLATFORM_ACTOR_REF`, `'@platform'`), free-form `feature`, `modelId`, `provider`, tokens, `audioSeconds` / `characters` / `requests`, `costUsd` / `costSource`, optional `threadId` / `runId` / `tenantRef` / `metadata`. Never throws unless `throwOnError`; answers `{ recorded }`. Counts against the actor's quota (tokens in the token windows, cost in the USD windows, tokens bumped on the `QuotaStore`); platform cost counts against nobody.
10
+ - The ledger gains `feature`, `provider`, `tenant_ref`, `audio_seconds`, `characters`, `requests`, `metadata`, and a nullable `thread_id` (made nullable in place on Postgres/MySQL, by a table rebuild on SQLite; the foreign key and cascade stay). Agent-turn rows are labelled `agent:<agent name>`. `RecordUsageInput.threadId` is now optional and `UsagePurpose` gains `'external'`.
11
+ - Every ledger row is published as `agora:agent:usage.recorded` (amounts and attribution, never content).
12
+ - Governance: `spendByFeature` / `usageBreakdown` (cost by actor × feature) on `AgentGovernanceQueries`, `GET <path>/governance/spend/feature` and `/governance/usage/breakdown`; `RunUsageRow.feature`.
13
+ - Run timings: `agent_run` gains `queue_ms`, `model_ms`, `tools_ms`, `model_calls`, `tool_calls` and a per-step `timings` JSON. Queue time comes from the durable engine's run `createdAt` (≈0 inline), model time from the `llm.turn` span, tool time from the `tool.execution` measurement (`execution_ms`), wall-clock per step so parallel calls count once. Each figure is journaled with the step that measured it, so a resumed durable run counts every step once. `run.finished` carries `queueMs`, `modelMs`, `toolsMs`, `modelCalls`, `toolCalls`, `stepTimings`; `run.failed` / `run.cancelled` carry `queueMs` (and `run.failed` what it measured). `RunSummaryRow` and `RunDetail.timings` expose them.
14
+ - Dashboard: a "Spend by feature" panel on the Overview (agent turns and recorded usage side by side) and a "Where the time went" panel on the run trace (queue / model / tools / other, and each step).
15
+
16
+ ## 0.92.0
17
+
18
+ ### Minor Changes
19
+
20
+ - [#508](https://github.com/DavideCarvalho/adonis-agora-agent/pull/508) [`3bfb624`](https://github.com/DavideCarvalho/adonis-agora-agent/commit/3bfb62431c8233c569e38a17aa6258f52e7511ad) Thanks [@DavideCarvalho](https://github.com/DavideCarvalho)! - `forkThread(threadId, fromMessageId, options?)` takes `ForkThreadOptions` — `{ actorRef?, tenantRef? }` — to make the copy belong to someone else. That is "continue this conversation" from a shared link: the reader gets their own copy up to that point to go on from, and the original stays its owner's. Without options nothing changes (the copy is the source owner's), in `AgentService`, the Lucid store and the in-memory store. A custom `AgentStore` keeps compiling (the parameter is optional) and should honour it to support the feature.
21
+
3
22
  ## 0.91.6
4
23
 
5
24
  ### Patch Changes