@nocobase/app-plugin-agents 2.0.0-beta.10 → 2.0.0-beta.12

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 (149) hide show
  1. package/CHANGELOG.md +51 -0
  2. package/README.md +5 -1
  3. package/dist/client/chat/controller.d.ts +7 -0
  4. package/dist/client/chat/controller.d.ts.map +1 -1
  5. package/dist/client/chat/controller.js +28 -7
  6. package/dist/client/chat/controller.js.map +1 -1
  7. package/dist/client/lib/format.d.ts.map +1 -1
  8. package/dist/client/lib/format.js +11 -2
  9. package/dist/client/lib/format.js.map +1 -1
  10. package/dist/client/locales/de-DE.d.ts.map +1 -1
  11. package/dist/client/locales/de-DE.js +12 -1
  12. package/dist/client/locales/de-DE.js.map +1 -1
  13. package/dist/client/locales/es-ES.d.ts.map +1 -1
  14. package/dist/client/locales/es-ES.js +13 -1
  15. package/dist/client/locales/es-ES.js.map +1 -1
  16. package/dist/client/locales/fr-FR.d.ts.map +1 -1
  17. package/dist/client/locales/fr-FR.js +13 -1
  18. package/dist/client/locales/fr-FR.js.map +1 -1
  19. package/dist/client/locales/id-ID.d.ts.map +1 -1
  20. package/dist/client/locales/id-ID.js +12 -1
  21. package/dist/client/locales/id-ID.js.map +1 -1
  22. package/dist/client/locales/ja-JP.d.ts.map +1 -1
  23. package/dist/client/locales/ja-JP.js +12 -1
  24. package/dist/client/locales/ja-JP.js.map +1 -1
  25. package/dist/client/locales/ko-KR.d.ts.map +1 -1
  26. package/dist/client/locales/ko-KR.js +12 -1
  27. package/dist/client/locales/ko-KR.js.map +1 -1
  28. package/dist/client/locales/pt-BR.d.ts.map +1 -1
  29. package/dist/client/locales/pt-BR.js +13 -1
  30. package/dist/client/locales/pt-BR.js.map +1 -1
  31. package/dist/client/locales/ru-RU.d.ts.map +1 -1
  32. package/dist/client/locales/ru-RU.js +14 -1
  33. package/dist/client/locales/ru-RU.js.map +1 -1
  34. package/dist/client/locales/runtimes.en-US.d.ts +12 -1
  35. package/dist/client/locales/runtimes.en-US.d.ts.map +1 -1
  36. package/dist/client/locales/runtimes.en-US.js +12 -1
  37. package/dist/client/locales/runtimes.en-US.js.map +1 -1
  38. package/dist/client/locales/runtimes.zh-CN.d.ts.map +1 -1
  39. package/dist/client/locales/runtimes.zh-CN.js +12 -1
  40. package/dist/client/locales/runtimes.zh-CN.js.map +1 -1
  41. package/dist/client/locales/vi-VN.d.ts.map +1 -1
  42. package/dist/client/locales/vi-VN.js +12 -1
  43. package/dist/client/locales/vi-VN.js.map +1 -1
  44. package/dist/client/locales/zh-TW.d.ts.map +1 -1
  45. package/dist/client/locales/zh-TW.js +12 -1
  46. package/dist/client/locales/zh-TW.js.map +1 -1
  47. package/dist/client/pages/runtimes/index.js +3 -3
  48. package/dist/client/pages/runtimes/index.js.map +1 -1
  49. package/dist/client/pages/runtimes/quota-limit-setting.d.ts +12 -0
  50. package/dist/client/pages/runtimes/quota-limit-setting.d.ts.map +1 -0
  51. package/dist/client/pages/runtimes/quota-limit-setting.js +56 -0
  52. package/dist/client/pages/runtimes/quota-limit-setting.js.map +1 -0
  53. package/dist/client/pages/runtimes/quota-view.d.ts +22 -0
  54. package/dist/client/pages/runtimes/quota-view.d.ts.map +1 -0
  55. package/dist/client/pages/runtimes/quota-view.js +33 -0
  56. package/dist/client/pages/runtimes/quota-view.js.map +1 -0
  57. package/dist/client/pages/runtimes/quota.d.ts.map +1 -1
  58. package/dist/client/pages/runtimes/quota.js +8 -22
  59. package/dist/client/pages/runtimes/quota.js.map +1 -1
  60. package/dist/client/pages/runtimes/runner-cells.d.ts +8 -5
  61. package/dist/client/pages/runtimes/runner-cells.d.ts.map +1 -1
  62. package/dist/client/pages/runtimes/runner-cells.js +31 -11
  63. package/dist/client/pages/runtimes/runner-cells.js.map +1 -1
  64. package/dist/client/pages/runtimes/tool-quota.d.ts +9 -0
  65. package/dist/client/pages/runtimes/tool-quota.d.ts.map +1 -0
  66. package/dist/client/pages/runtimes/tool-quota.js +78 -0
  67. package/dist/client/pages/runtimes/tool-quota.js.map +1 -0
  68. package/dist/database/migrations/.manifest.json +4 -0
  69. package/dist/database/migrations/202611110001_ag_runner_quota_limits.d.ts +4 -0
  70. package/dist/database/migrations/202611110001_ag_runner_quota_limits.d.ts.map +1 -0
  71. package/dist/database/migrations/202611110001_ag_runner_quota_limits.js +17 -0
  72. package/dist/database/migrations/202611110001_ag_runner_quota_limits.js.map +1 -0
  73. package/dist/package.json +4 -2
  74. package/dist/server/composition.d.ts +2 -0
  75. package/dist/server/composition.d.ts.map +1 -1
  76. package/dist/server/composition.js +17 -0
  77. package/dist/server/composition.js.map +1 -1
  78. package/dist/server/core/conversations/attachments.d.ts +15 -3
  79. package/dist/server/core/conversations/attachments.d.ts.map +1 -1
  80. package/dist/server/core/conversations/attachments.js +10 -8
  81. package/dist/server/core/conversations/attachments.js.map +1 -1
  82. package/dist/server/core/reports/report.service.d.ts.map +1 -1
  83. package/dist/server/core/reports/report.service.js +24 -13
  84. package/dist/server/core/reports/report.service.js.map +1 -1
  85. package/dist/server/core/runs/access.d.ts +7 -1
  86. package/dist/server/core/runs/access.d.ts.map +1 -1
  87. package/dist/server/core/runs/access.js +51 -2
  88. package/dist/server/core/runs/access.js.map +1 -1
  89. package/dist/server/core/runs/eligibility.d.ts.map +1 -1
  90. package/dist/server/core/runs/eligibility.js +1 -0
  91. package/dist/server/core/runs/eligibility.js.map +1 -1
  92. package/dist/server/core/runs/index.d.ts +1 -1
  93. package/dist/server/core/runs/index.d.ts.map +1 -1
  94. package/dist/server/core/runs/index.js.map +1 -1
  95. package/dist/server/core/runs/ports.d.ts +5 -1
  96. package/dist/server/core/runs/ports.d.ts.map +1 -1
  97. package/dist/server/core/runs/ports.js.map +1 -1
  98. package/dist/server/core/runs/run.service.d.ts +3 -1
  99. package/dist/server/core/runs/run.service.d.ts.map +1 -1
  100. package/dist/server/core/runs/run.service.js +35 -26
  101. package/dist/server/core/runs/run.service.js.map +1 -1
  102. package/dist/server/online/files/input.d.ts +2 -2
  103. package/dist/server/online/files/input.d.ts.map +1 -1
  104. package/dist/server/online/files/input.js +5 -6
  105. package/dist/server/online/files/input.js.map +1 -1
  106. package/dist/server/online/files/kimi.d.ts.map +1 -1
  107. package/dist/server/online/files/kimi.js +2 -2
  108. package/dist/server/online/files/kimi.js.map +1 -1
  109. package/dist/server/online/files/service.d.ts +2 -1
  110. package/dist/server/online/files/service.d.ts.map +1 -1
  111. package/dist/server/online/files/service.js +11 -10
  112. package/dist/server/online/files/service.js.map +1 -1
  113. package/dist/server/providers/agents.d.ts.map +1 -1
  114. package/dist/server/providers/agents.js +5 -2
  115. package/dist/server/providers/agents.js.map +1 -1
  116. package/dist/server/routes/admin.d.ts.map +1 -1
  117. package/dist/server/routes/admin.js +10 -13
  118. package/dist/server/routes/admin.js.map +1 -1
  119. package/dist/server/routes/chat.d.ts.map +1 -1
  120. package/dist/server/routes/chat.js +8 -8
  121. package/dist/server/routes/chat.js.map +1 -1
  122. package/dist/server/routes/runners/admin.d.ts.map +1 -1
  123. package/dist/server/routes/runners/admin.js +3 -2
  124. package/dist/server/routes/runners/admin.js.map +1 -1
  125. package/dist/server/routes/schemas.d.ts.map +1 -1
  126. package/dist/server/routes/schemas.js +3 -0
  127. package/dist/server/routes/schemas.js.map +1 -1
  128. package/dist/server/runners/runner.service.d.ts.map +1 -1
  129. package/dist/server/runners/runner.service.js +16 -4
  130. package/dist/server/runners/runner.service.js.map +1 -1
  131. package/dist/server/runners/runner.store.d.ts +1 -0
  132. package/dist/server/runners/runner.store.d.ts.map +1 -1
  133. package/dist/server/runners/runner.store.js +1 -0
  134. package/dist/server/runners/runner.store.js.map +1 -1
  135. package/dist/server/tokens.d.ts +1 -1
  136. package/dist/server/tokens.d.ts.map +1 -1
  137. package/dist/server/tokens.js.map +1 -1
  138. package/dist/shared/conversations.d.ts +0 -2
  139. package/dist/shared/conversations.d.ts.map +1 -1
  140. package/dist/shared/conversations.js +0 -2
  141. package/dist/shared/conversations.js.map +1 -1
  142. package/dist/shared/runners.d.ts +23 -5
  143. package/dist/shared/runners.d.ts.map +1 -1
  144. package/dist/shared/runners.js +40 -6
  145. package/dist/shared/runners.js.map +1 -1
  146. package/package.json +17 -15
  147. package/skills/nocobase-app-plugin-agents/SKILL.md +5 -1
  148. package/skills/nocobase-app-plugin-agents/references/extension-points.md +3 -1
  149. package/skills/nocobase-app-plugin-agents/references/online-agent.md +6 -6
@@ -130,18 +130,18 @@ Use `abort()` for explicit Stop. Native execution waits for terminal persistence
130
130
 
131
131
  Native `POST /api/agents/conversations/:id/messages` accepts only the current SDK user message (`id`, `role: "user"`, text `parts`) plus authorized attachment IDs, page context and optional selected model. It returns a standard SDK UI message stream. Use a `DefaultChatTransport.prepareSendMessagesRequest` mapper; do not submit browser history or trusted metadata. Tool input/output, assistant/system messages and configuration cannot be supplied as history. Creation starts no model. Detail, list, history, config, attachment and Stop retain ownership checks.
132
132
 
133
- Native realtime sessions can resend or text-edit an existing user message with `chat.resend({ messageId, input: { text } })`; omitted options select the latest saved user. Admission updates that message, permanently deletes its suffix and preserves original files/context. Completed business effects are not undone. Runner refuses this capability and Background does not expose it. Browser UI uses `useResendMessage` and the official SDK regenerate/edit flow, never an automatic retry of unknown admission. See [resend and edit](../../../docs/message-resend.md) for transaction, stream, authorization and recovery contracts.
133
+ Native realtime sessions can resend or text-edit an existing user message with `chat.resend({ messageId, input: { text } })`; omitted options select the latest saved user. Admission updates that message, permanently deletes its suffix and preserves original files/context. Completed business effects are not undone. Runner refuses this capability and Background does not expose it. Browser UI uses `useResendMessage` and the official SDK regenerate/edit flow, never an automatic retry of unknown admission. See resend and edit (`docs/message-resend.md` in the `@nocobase/app-plugin-agents` package) for transaction, stream, authorization and recovery contracts.
134
134
  In both native realtime and background modes, `content.original` is the only complete internal UIMessage, with the same ID as its record and raw JSON tool inputs/results, reasoning and provider/approval evidence. Both modes share the same original-message storage and raw tool JSON, not a separate background ModelMessage codec. Public tools require explicit `public.input`/`public.output` projections. All public history reads, including background `history()`, and realtime streams use current projections; current `toModelOutput` rules separately derive internal model input from the original when it is read. Both conversions use detached copies and never execute tools. Missing or failed projections never expose the raw original. No duplicate full message, migration, compatibility fallback or format version is used. SDK `needsApproval` tools require these projections. The approval endpoint accepts only `{ messageId, executionId, approval: { id, approved, reason? } }` and resumes from trusted persisted history. Waiting approvals, denials and outcomes update the same message with increasing metadata revision; use message revision notifications and `GET messages?ids=...` to reread changes. Approval retains its owner/execution/message binding and does not bypass active execution occupancy. Background structured execution stays separate.
135
135
 
136
136
  Native public history and realtime streams include actual model-provided SDK reasoning, including previously saved parts. Expose only `type`/`text`/optional `state` in history and the SDK routing fields (`type`, `id`, and `delta` for reasoning deltas) in the stream; never expose provider metadata or signatures. Installed Registry/Examples render nonempty parts in order with sanitized Markdown, automatically open only the active streaming part and otherwise collapse by default. A user's manual choice wins for that mounted message/part across incremental updates, part end and history revisions. Reasoning counts as visible output, but does not become answer text, a search/copy value or an execution outcome. Models and Runner responses without genuine reasoning remain ordinary text-only chat.
137
137
 
138
- Native and Runner realtime receive use the standard SDK stream with optional shared Redis recovery. Background sessions have no browser receive transport and do not require Redis. Browser disconnect never cancels generation. Finish ends the HTTP response, possibly while waiting for approval; execution detail and saved history determine business state. Failed persistence keeps occupancy and supports explicit finalization without reexecution. Missing streams require history/status reconciliation, never automatic resend. A lost producer remains interrupted and is not automatically restarted. The public ChatProvider and installed Registry/Examples consumers use SDK Chat ownership and GET recovery. See [UI messages](../../../docs/ui-messages.md) and [client coordination](../../../docs/ui-message-clients.md) for configuration, costs and limits.
138
+ Native and Runner realtime receive use the standard SDK stream with optional shared Redis recovery. Background sessions have no browser receive transport and do not require Redis. Browser disconnect never cancels generation. Finish ends the HTTP response, possibly while waiting for approval; execution detail and saved history determine business state. Failed persistence keeps occupancy and supports explicit finalization without reexecution. Missing streams require history/status reconciliation, never automatic resend. A lost producer remains interrupted and is not automatically restarted. The public ChatProvider and installed Registry/Examples consumers use SDK Chat ownership and GET recovery. See UI messages (`docs/ui-messages.md` in the `@nocobase/app-plugin-agents` package) and client coordination (`docs/ui-message-clients.md` in the `@nocobase/app-plugin-agents` package) for configuration, costs and limits.
139
139
 
140
- Permission-restricted configuration and custom permission/approval protocols remain unsupported. New native sessions enable bash and skill by default; scopes may select Skills or explicitly replace the tool list; follow [Native Skills and application CLI](../../../docs/native-sandbox.md) for current support trees, VFS-only inputs, lazy `context.execution`, existing business authorization and approval/new-environment boundaries. SDK approval is native-only; Runner remote tool approval is refused. Verify with isolated model fixtures and authorized application services, never real business writes.
140
+ Permission-restricted configuration and custom permission/approval protocols remain unsupported. New native sessions enable bash and skill by default; scopes may select Skills or explicitly replace the tool list; follow Native Skills and application CLI (`docs/native-sandbox.md` in the `@nocobase/app-plugin-agents` package) for current support trees, VFS-only inputs, lazy `context.execution`, existing business authorization and approval/new-environment boundaries. SDK approval is native-only; Runner remote tool approval is refused. Verify with isolated model fixtures and authorized application services, never real business writes.
141
141
 
142
142
  ## Open UI context, custom tool cards and local form drafts
143
143
 
144
- Use the public `@nocobase/app-plugin-agents/client/chat` exports for these capabilities; the full contracts and integrated application wiring are in [UI context, tool cards and AI form adapters](../../../docs/ai-forms.md). The plugin supplies infrastructure only. Applications own tool names/schemas, fields, permissions, proposal cards and browser adapters. The Examples application's `examples_form_proposal`, `examples-form-fill` scope and `/ai-form-fill` page are application demonstrations, not plugin defaults or APIs to import into another application.
144
+ Use the public `@nocobase/app-plugin-agents/client/chat` exports for these capabilities; the full contracts and integrated application wiring are in UI context, tool cards and AI form adapters (`docs/ai-forms.md` in the `@nocobase/app-plugin-agents` package). The plugin supplies infrastructure only. Applications own tool names/schemas, fields, permissions, proposal cards and browser adapters. The Examples application's `examples_form_proposal`, `examples-form-fill` scope and `/ai-form-fill` page are application demonstrations, not plugin defaults or APIs to import into another application.
145
145
 
146
146
  `PageContext.ui = { version: 1, items: [...] }` is open JSON data: every `PageUIItem` has required `kind`/`id` and arbitrary accepted `AppUIJson` fields, including unknown kinds and nested values. This is separate from server-resolved/authorized `context.items`. UI items grant no server record access or tool permission and enter Native/Runner model context as explicitly untrusted data, never instructions. Accepted fields survive public user metadata, saved history and recovery. Budgets in `PAGE_UI_CONTEXT_LIMITS` reject non-JSON, dangerous keys, duplicate identities and oversized snapshots without truncation; applications must minimize data and exclude secrets.
147
147
 
@@ -211,13 +211,13 @@ Resolvers remain responsible for business authorization and their own database r
211
211
 
212
212
  Native and Runner realtime history is `AppUIMessage[]`, and HTTP input for both is the current `{ message: { id, role: "user", parts }, attachmentIds?, context?, selectedModel? }`. Responses use the SDK UI message stream, not the old block events. Runner assistant ID is `runner:<runId>`; `metadata.sourceRecords` retains real saved record IDs, source sequences and stable part IDs/indices. Display segments must interleave independent notifications by source sequence without duplicating the logical assistant message. Registry and application consumers use `chatMessageSegments` to retain that source ordering. Forward history readers must drain `meta.nextAfter` before advancing to the conversation watermark.
213
213
 
214
- For multiple instances configure `agents.uiRecovery: { namespace, redis: { host, port, ... } }` with an application-specific namespace and a shared Redis deployment. The plugin owns the connections. `DefaultChatTransport.prepareReconnectToStreamRequest` points to `/api/agents/conversations/:id/events`. Without configuration there is one live response and history only, reported as `x-online-agent-recovery: live`; configured failures never fall back. Replay requires the live producer: process death does not restart inference, tools or Runner work. Stop remains a separate authenticated action and can signal a live native producer on another instance; read execution and saved history until termination is confirmed. Approval waiting and a missing stream are not business success. See [UI messages and recovery](../../../docs/ui-messages.md) for identity, lifecycle, limits, costs and validation boundaries.
214
+ For multiple instances configure `agents.uiRecovery: { namespace, redis: { host, port, ... } }` with an application-specific namespace and a shared Redis deployment. The plugin owns the connections. `DefaultChatTransport.prepareReconnectToStreamRequest` points to `/api/agents/conversations/:id/events`. Without configuration there is one live response and history only, reported as `x-online-agent-recovery: live`; configured failures never fall back. Replay requires the live producer: process death does not restart inference, tools or Runner work. Stop remains a separate authenticated action and can signal a live native producer on another instance; read execution and saved history until termination is confirmed. Approval waiting and a missing stream are not business success. See UI messages and recovery (`docs/ui-messages.md` in the `@nocobase/app-plugin-agents` package) for identity, lifecycle, limits, costs and validation boundaries.
215
215
 
216
216
  Existing system notices are delivered through `ConversationService.deliver()` in the caller's business transaction. OnlineAgent bindings persist them without starting another execution, unless a Runner binding's news passes `wake: true`, and rollback removes them with the business changes. Native notices use standard public data parts and remain readable after a response closes. Independent application timeline content should use the authorized business subscription and rendering extensions; OnlineAgent has no separate notification-injection API.
217
217
 
218
218
  ## Public UI messages
219
219
 
220
- Browser consumers use the SDK-owned `AppUIMessage` and `ChatProvider` from `client/chat`. Render ordered parts and use `chatMessageSegments` to preserve Runner source ordering around independent notifications. The public extension hooks receive the complete SDK message, and approval uses only a bound server-validated control. Follow [the client contract](../../../docs/ui-message-clients.md) for identity lifetimes, unknown admission, revision rereads, durable notification polling and independent Stop. A standard response finish or a missing recovery stream never implies saved business completion.
220
+ Browser consumers use the SDK-owned `AppUIMessage` and `ChatProvider` from `client/chat`. Render ordered parts and use `chatMessageSegments` to preserve Runner source ordering around independent notifications. The public extension hooks receive the complete SDK message, and approval uses only a bound server-validated control. Follow the client contract (`docs/ui-message-clients.md` in the `@nocobase/app-plugin-agents` package) for identity lifetimes, unknown admission, revision rereads, durable notification polling and independent Stop. A standard response finish or a missing recovery stream never implies saved business completion.
221
221
 
222
222
  ## Single-instance startup and visibility
223
223