@tablestore/tablestore-agent-cli 0.2.6 → 0.2.8

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 (281) hide show
  1. package/dist/commands/configure.d.ts.map +1 -1
  2. package/dist/commands/configure.js +10 -5
  3. package/dist/commands/configure.js.map +1 -1
  4. package/dist/commands/dashboard.d.ts.map +1 -1
  5. package/dist/commands/dashboard.js +7 -1
  6. package/dist/commands/dashboard.js.map +1 -1
  7. package/dist/commands/doctor.d.ts.map +1 -1
  8. package/dist/commands/doctor.js +46 -11
  9. package/dist/commands/doctor.js.map +1 -1
  10. package/dist/dashboard-runtime/dashboard/.next/BUILD_ID +1 -1
  11. package/dist/dashboard-runtime/dashboard/.next/build-manifest.json +3 -3
  12. package/dist/dashboard-runtime/dashboard/.next/prerender-manifest.json +3 -3
  13. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/api-keys/page.js.nft.json +1 -1
  14. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/api-keys/page_client-reference-manifest.js +1 -1
  15. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/chat/page.js.nft.json +1 -1
  16. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/chat/page_client-reference-manifest.js +1 -1
  17. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/knowledge-base/[name]/documents/page.js.nft.json +1 -1
  18. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/knowledge-base/[name]/documents/page_client-reference-manifest.js +1 -1
  19. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/knowledge-base/[name]/page.js.nft.json +1 -1
  20. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/knowledge-base/[name]/page_client-reference-manifest.js +1 -1
  21. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/knowledge-base/[name]/qa/page.js.nft.json +1 -1
  22. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/knowledge-base/[name]/qa/page_client-reference-manifest.js +1 -1
  23. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/knowledge-base/[name]/retrieval/page.js.nft.json +1 -1
  24. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/knowledge-base/[name]/retrieval/page_client-reference-manifest.js +1 -1
  25. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/knowledge-base/[name]/settings/page.js.nft.json +1 -1
  26. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/knowledge-base/[name]/settings/page_client-reference-manifest.js +1 -1
  27. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/knowledge-base/create/page.js.nft.json +1 -1
  28. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/knowledge-base/create/page_client-reference-manifest.js +1 -1
  29. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/knowledge-base/page.js.nft.json +1 -1
  30. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/knowledge-base/page_client-reference-manifest.js +1 -1
  31. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/llm-providers/[id]/page.js.nft.json +1 -1
  32. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/llm-providers/[id]/page_client-reference-manifest.js +1 -1
  33. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/llm-providers/new/page.js.nft.json +1 -1
  34. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/llm-providers/new/page_client-reference-manifest.js +1 -1
  35. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/llm-providers/page.js.nft.json +1 -1
  36. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/llm-providers/page_client-reference-manifest.js +1 -1
  37. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/dream/[dreamId]/page.js.nft.json +1 -1
  38. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/dream/[dreamId]/page_client-reference-manifest.js +1 -1
  39. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/dream/page.js.nft.json +1 -1
  40. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/dream/page_client-reference-manifest.js +1 -1
  41. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/messages/page.js.nft.json +1 -1
  42. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/messages/page_client-reference-manifest.js +1 -1
  43. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/page.js.nft.json +1 -1
  44. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/page_client-reference-manifest.js +1 -1
  45. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/requests/page.js.nft.json +1 -1
  46. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/requests/page_client-reference-manifest.js +1 -1
  47. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/search/page.js.nft.json +1 -1
  48. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/search/page_client-reference-manifest.js +1 -1
  49. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/settings/page.js.nft.json +1 -1
  50. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/settings/page_client-reference-manifest.js +1 -1
  51. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/tasks/page.js.nft.json +1 -1
  52. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/tasks/page_client-reference-manifest.js +1 -1
  53. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/units/page.js.nft.json +1 -1
  54. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/units/page_client-reference-manifest.js +1 -1
  55. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/create/page.js.nft.json +1 -1
  56. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/create/page_client-reference-manifest.js +1 -1
  57. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/page.js.nft.json +1 -1
  58. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/page_client-reference-manifest.js +1 -1
  59. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/projects/page.js.nft.json +1 -1
  60. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/projects/page_client-reference-manifest.js +1 -1
  61. package/dist/dashboard-runtime/dashboard/.next/server/app/_global-error.html +1 -1
  62. package/dist/dashboard-runtime/dashboard/.next/server/app/_global-error.rsc +1 -1
  63. package/dist/dashboard-runtime/dashboard/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  64. package/dist/dashboard-runtime/dashboard/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  65. package/dist/dashboard-runtime/dashboard/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  66. package/dist/dashboard-runtime/dashboard/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  67. package/dist/dashboard-runtime/dashboard/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  68. package/dist/dashboard-runtime/dashboard/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  69. package/dist/dashboard-runtime/dashboard/.next/server/app/_not-found.html +1 -1
  70. package/dist/dashboard-runtime/dashboard/.next/server/app/_not-found.rsc +14 -14
  71. package/dist/dashboard-runtime/dashboard/.next/server/app/_not-found.segments/_full.segment.rsc +14 -14
  72. package/dist/dashboard-runtime/dashboard/.next/server/app/_not-found.segments/_head.segment.rsc +3 -3
  73. package/dist/dashboard-runtime/dashboard/.next/server/app/_not-found.segments/_index.segment.rsc +10 -10
  74. package/dist/dashboard-runtime/dashboard/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +3 -3
  75. package/dist/dashboard-runtime/dashboard/.next/server/app/_not-found.segments/_not-found.segment.rsc +3 -3
  76. package/dist/dashboard-runtime/dashboard/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  77. package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/api-keys/[id]/custom-policy/route.js.nft.json +1 -1
  78. package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/api-keys/[id]/effective-permissions/route.js.nft.json +1 -1
  79. package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/api-keys/[id]/policies/route.js.nft.json +1 -1
  80. package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/api-keys/[id]/route.js.nft.json +1 -1
  81. package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/api-keys/filter-by-permission/route.js.nft.json +1 -1
  82. package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/api-keys/route.js.nft.json +1 -1
  83. package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/auth/status/route.js.nft.json +1 -1
  84. package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/auth/token/route.js.nft.json +1 -1
  85. package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/instances/[name]/route.js.nft.json +1 -1
  86. package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/instances/[name]/token/route.js.nft.json +1 -1
  87. package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/instances/[name]/use/route.js.nft.json +1 -1
  88. package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/instances/route.js.nft.json +1 -1
  89. package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/knowledge-bases/[name]/chunks/route.js.nft.json +1 -1
  90. package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/knowledge-bases/[name]/documents/[docId]/chunks/route.js.nft.json +1 -1
  91. package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/knowledge-bases/[name]/documents/[docId]/route.js.nft.json +1 -1
  92. package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/knowledge-bases/[name]/documents/route.js.nft.json +1 -1
  93. package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/knowledge-bases/[name]/documents/upload/route.js.nft.json +1 -1
  94. package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/knowledge-bases/[name]/retrieve/route.js.nft.json +1 -1
  95. package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/knowledge-bases/[name]/route.js.nft.json +1 -1
  96. package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/knowledge-bases/route.js.nft.json +1 -1
  97. package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/llm/chat/route.js.nft.json +1 -1
  98. package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/llm/providers/[id]/models/route.js.nft.json +1 -1
  99. package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/llm/providers/[id]/route.js.nft.json +1 -1
  100. package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/llm/providers/[id]/test/route.js.nft.json +1 -1
  101. package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/llm/providers/route.js.nft.json +1 -1
  102. package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/logs/client/route.js.nft.json +1 -1
  103. package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/dream-tasks/[dreamId]/actions/apply/route.js.nft.json +1 -1
  104. package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/dream-tasks/[dreamId]/actions/route.js.nft.json +1 -1
  105. package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/dream-tasks/[dreamId]/cancel/route.js.nft.json +1 -1
  106. package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/dream-tasks/[dreamId]/route.js.nft.json +1 -1
  107. package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/dream-tasks/route.js.nft.json +1 -1
  108. package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/messages/route.js.nft.json +1 -1
  109. package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/requests/route.js.nft.json +1 -1
  110. package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/route.js.nft.json +1 -1
  111. package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/scopes/route.js.nft.json +1 -1
  112. package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/search/route.js.nft.json +1 -1
  113. package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/tasks/[requestId]/route.js.nft.json +1 -1
  114. package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/tasks/route.js.nft.json +1 -1
  115. package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/units/[memoryId]/route.js.nft.json +1 -1
  116. package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/units/route.js.nft.json +1 -1
  117. package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/route.js.nft.json +1 -1
  118. package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/oss/list/route.js.nft.json +1 -1
  119. package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/runtime/context/route.js.nft.json +1 -1
  120. package/dist/dashboard-runtime/dashboard/.next/server/app/index.html +1 -1
  121. package/dist/dashboard-runtime/dashboard/.next/server/app/index.rsc +14 -14
  122. package/dist/dashboard-runtime/dashboard/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
  123. package/dist/dashboard-runtime/dashboard/.next/server/app/index.segments/_full.segment.rsc +14 -14
  124. package/dist/dashboard-runtime/dashboard/.next/server/app/index.segments/_head.segment.rsc +3 -3
  125. package/dist/dashboard-runtime/dashboard/.next/server/app/index.segments/_index.segment.rsc +10 -10
  126. package/dist/dashboard-runtime/dashboard/.next/server/app/index.segments/_tree.segment.rsc +2 -2
  127. package/dist/dashboard-runtime/dashboard/.next/server/app/onboarding/page_client-reference-manifest.js +1 -1
  128. package/dist/dashboard-runtime/dashboard/.next/server/app/onboarding.html +1 -1
  129. package/dist/dashboard-runtime/dashboard/.next/server/app/onboarding.rsc +17 -17
  130. package/dist/dashboard-runtime/dashboard/.next/server/app/onboarding.segments/_full.segment.rsc +17 -17
  131. package/dist/dashboard-runtime/dashboard/.next/server/app/onboarding.segments/_head.segment.rsc +3 -3
  132. package/dist/dashboard-runtime/dashboard/.next/server/app/onboarding.segments/_index.segment.rsc +10 -10
  133. package/dist/dashboard-runtime/dashboard/.next/server/app/onboarding.segments/_tree.segment.rsc +2 -2
  134. package/dist/dashboard-runtime/dashboard/.next/server/app/onboarding.segments/onboarding/__PAGE__.segment.rsc +4 -4
  135. package/dist/dashboard-runtime/dashboard/.next/server/app/onboarding.segments/onboarding.segment.rsc +4 -4
  136. package/dist/dashboard-runtime/dashboard/.next/server/app/page_client-reference-manifest.js +1 -1
  137. package/dist/dashboard-runtime/dashboard/.next/server/chunks/[root-of-the-server]__0.y01v.._.js +8 -8
  138. package/dist/dashboard-runtime/dashboard/.next/server/chunks/[root-of-the-server]__04zbudf._.js +1 -1
  139. package/dist/dashboard-runtime/dashboard/.next/server/chunks/[root-of-the-server]__05eryp~._.js +1 -1
  140. package/dist/dashboard-runtime/dashboard/.next/server/chunks/[root-of-the-server]__06fva9g._.js +1 -1
  141. package/dist/dashboard-runtime/dashboard/.next/server/chunks/[root-of-the-server]__0cyd2qb._.js +1 -1
  142. package/dist/dashboard-runtime/dashboard/.next/server/chunks/[root-of-the-server]__0wa~r66._.js +8 -8
  143. package/dist/dashboard-runtime/dashboard/.next/server/chunks/[root-of-the-server]__10k~3sa._.js +8 -8
  144. package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/0b1r_app_(dashboard)_knowledge-base_[name]_documents_documents-client_tsx_0g2uxmt._.js +1 -1
  145. package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_0brqbty._.js +1 -1
  146. package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/{_0nmv74v._.js → _0l-4ms-._.js} +2 -2
  147. package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/{_0lf_p5l._.js → _0pe9ntc._.js} +2 -2
  148. package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_0tej2s.._.js +3 -0
  149. package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/{_0jl78rk._.js → _0x05u0y._.js} +2 -2
  150. package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_0~5g0_a._.js +1 -1
  151. package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/dashboard_src_00ofp7q._.js +1 -1
  152. package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/dashboard_src_0l1.0wg._.js +1 -1
  153. package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/dashboard_src_0o9jhcn._.js +2 -2
  154. package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/dashboard_src_0y49vhd._.js +1 -1
  155. package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/dashboard_src_10dsqx~._.js +1 -1
  156. package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/dashboard_src_app_(dashboard)_memory_[store]_dream_[dreamId]_page_tsx_0wy3tv6._.js +1 -1
  157. package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/dashboard_src_app_(dashboard)_memory_[store]_dream_page_tsx_0uzzpvs._.js +1 -1
  158. package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/dashboard_src_app_(dashboard)_memory_[store]_layout_tsx_0rbi41w._.js +1 -1
  159. package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/dashboard_src_app_(dashboard)_memory_[store]_settings_page_tsx_0y26.xu._.js +1 -1
  160. package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/dashboard_src_app_(dashboard)_memory_[store]_tasks_page_tsx_0a_bgx4._.js +1 -1
  161. package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/dashboard_src_app_(dashboard)_memory_[store]_units_page_tsx_0.6xnei._.js +1 -1
  162. package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/dashboard_src_providers_runtime-context-provider_tsx_0wmj66z._.js +1 -1
  163. package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/node_modules__pnpm_00arje5._.js +1 -1
  164. package/dist/dashboard-runtime/dashboard/.next/server/middleware-build-manifest.js +3 -3
  165. package/dist/dashboard-runtime/dashboard/.next/server/pages/404.html +1 -1
  166. package/dist/dashboard-runtime/dashboard/.next/server/pages/500.html +1 -1
  167. package/dist/dashboard-runtime/dashboard/.next/server/server-reference-manifest.js +1 -1
  168. package/dist/dashboard-runtime/dashboard/.next/server/server-reference-manifest.json +1 -1
  169. package/dist/dashboard-runtime/dashboard/.next/static/chunks/0-ldkvvj51n5..js +5 -0
  170. package/dist/dashboard-runtime/dashboard/.next/static/chunks/01ccz9pw1s5-1.js +1 -0
  171. package/dist/dashboard-runtime/dashboard/.next/static/chunks/05d8-45s941bx.js +1 -0
  172. package/dist/dashboard-runtime/dashboard/.next/static/chunks/{154l918khtf32.js → 076wjt8-f7ws0.js} +1 -1
  173. package/dist/dashboard-runtime/dashboard/.next/static/chunks/0axe89r5c7p_b.js +1 -0
  174. package/dist/dashboard-runtime/dashboard/.next/static/chunks/{0ro5-~k1_6.ji.js → 0b2g7gajnlz-x.js} +2 -2
  175. package/dist/dashboard-runtime/dashboard/.next/static/chunks/0czi-68m5cma3.js +1 -0
  176. package/dist/dashboard-runtime/dashboard/.next/static/chunks/{0u6g.bq1prqh8.js → 0eg702en0ykod.js} +1 -1
  177. package/dist/dashboard-runtime/dashboard/.next/static/chunks/0gqhfku~on4t1.js +1 -0
  178. package/dist/dashboard-runtime/dashboard/.next/static/chunks/0i_66eb3teu-..js +1 -0
  179. package/dist/dashboard-runtime/dashboard/.next/static/chunks/0jwl.kgoaubdz.js +1 -0
  180. package/dist/dashboard-runtime/dashboard/.next/static/chunks/0o3sqa_d7_k15.js +1 -0
  181. package/dist/dashboard-runtime/dashboard/.next/static/chunks/0oatn7x1t1x~~.js +1 -0
  182. package/dist/dashboard-runtime/dashboard/.next/static/chunks/0p7-v~ggg-k3s.js +1 -0
  183. package/dist/dashboard-runtime/dashboard/.next/static/chunks/0xnm11dm1-qw2.js +1 -0
  184. package/dist/dashboard-runtime/dashboard/.next/static/chunks/0zp_ao86_7617.js +1 -0
  185. package/dist/dashboard-runtime/dashboard/.next/static/chunks/11daw7hfc5lbv.js +1 -0
  186. package/dist/dashboard-runtime/dashboard/.next/static/chunks/140~~66uc8843.css +1 -0
  187. package/dist/dashboard-runtime/dashboard/.next/static/chunks/1692-f0t3ef~c.js +1 -0
  188. package/dist/dashboard-runtime/dashboard/src/app/(dashboard)/layout.tsx +7 -2
  189. package/dist/dashboard-runtime/dashboard/src/app/(dashboard)/memory/[store]/dream/[dreamId]/page.tsx +79 -19
  190. package/dist/dashboard-runtime/dashboard/src/app/(dashboard)/memory/[store]/dream/page.tsx +157 -66
  191. package/dist/dashboard-runtime/dashboard/src/app/(dashboard)/memory/[store]/layout.tsx +1 -1
  192. package/dist/dashboard-runtime/dashboard/src/app/(dashboard)/memory/[store]/search/page.tsx +4 -0
  193. package/dist/dashboard-runtime/dashboard/src/app/(dashboard)/memory/[store]/units/page.tsx +1 -2
  194. package/dist/dashboard-runtime/dashboard/src/app/api/v1/instances/[name]/route.ts +3 -0
  195. package/dist/dashboard-runtime/dashboard/src/app/api/v1/instances/[name]/token/route.ts +1 -0
  196. package/dist/dashboard-runtime/dashboard/src/app/api/v1/instances/[name]/use/route.ts +1 -0
  197. package/dist/dashboard-runtime/dashboard/src/app/api/v1/instances/route.ts +2 -0
  198. package/dist/dashboard-runtime/dashboard/src/components/instance/connect-instance-form.tsx +49 -10
  199. package/dist/dashboard-runtime/dashboard/src/components/instance/edit-instance-dialog.tsx +8 -0
  200. package/dist/dashboard-runtime/dashboard/src/components/memory/memory-create-form.tsx +35 -1
  201. package/dist/dashboard-runtime/dashboard/src/components/memory/memory-dream-actions-table.tsx +176 -82
  202. package/dist/dashboard-runtime/dashboard/src/components/memory/memory-dream-apply-confirm-dialog.tsx +2 -0
  203. package/dist/dashboard-runtime/dashboard/src/components/memory/memory-dream-create-dialog.tsx +130 -83
  204. package/dist/dashboard-runtime/dashboard/src/components/memory/memory-search-form.tsx +22 -0
  205. package/dist/dashboard-runtime/dashboard/src/components/memory/memory-search-results.tsx +4 -1
  206. package/dist/dashboard-runtime/dashboard/src/components/memory/memory-settings-form.tsx +52 -7
  207. package/dist/dashboard-runtime/dashboard/src/components/memory/memory-tasks-table.tsx +8 -37
  208. package/dist/dashboard-runtime/dashboard/src/hooks/use-dream-tasks.ts +96 -13
  209. package/dist/dashboard-runtime/dashboard/src/hooks/use-task-source-messages.ts +179 -0
  210. package/dist/dashboard-runtime/dashboard/src/lib/memory.ts +75 -1
  211. package/dist/dashboard-runtime/dashboard/src/lib/server/sdk-client.ts +17 -3
  212. package/dist/dashboard-runtime/dashboard/src/schemas/instance.ts +56 -4
  213. package/dist/dashboard-runtime/dashboard/src/types/instance.ts +10 -2
  214. package/dist/dashboard-runtime/dashboard/src/types/memory.ts +32 -2
  215. package/dist/dashboard-runtime/node_modules/@tablestore/tablestore-agent-sdk/dist/internal/auth-options.d.ts +25 -0
  216. package/dist/dashboard-runtime/node_modules/@tablestore/tablestore-agent-sdk/dist/internal/auth-options.d.ts.map +1 -0
  217. package/dist/dashboard-runtime/node_modules/@tablestore/tablestore-agent-sdk/dist/internal/auth-options.js +29 -0
  218. package/dist/dashboard-runtime/node_modules/@tablestore/tablestore-agent-sdk/dist/internal/auth-options.js.map +1 -0
  219. package/dist/dashboard-runtime/node_modules/@tablestore/tablestore-agent-sdk/dist/kb-client.d.ts.map +1 -1
  220. package/dist/dashboard-runtime/node_modules/@tablestore/tablestore-agent-sdk/dist/kb-client.js +4 -5
  221. package/dist/dashboard-runtime/node_modules/@tablestore/tablestore-agent-sdk/dist/kb-client.js.map +1 -1
  222. package/dist/dashboard-runtime/node_modules/@tablestore/tablestore-agent-sdk/dist/managed-ots.d.ts.map +1 -1
  223. package/dist/dashboard-runtime/node_modules/@tablestore/tablestore-agent-sdk/dist/managed-ots.js +11 -2
  224. package/dist/dashboard-runtime/node_modules/@tablestore/tablestore-agent-sdk/dist/managed-ots.js.map +1 -1
  225. package/dist/dashboard-runtime/node_modules/@tablestore/tablestore-agent-sdk/dist/memory-client.d.ts.map +1 -1
  226. package/dist/dashboard-runtime/node_modules/@tablestore/tablestore-agent-sdk/dist/memory-client.js +2 -3
  227. package/dist/dashboard-runtime/node_modules/@tablestore/tablestore-agent-sdk/dist/memory-client.js.map +1 -1
  228. package/dist/dashboard-runtime/node_modules/@tablestore/tablestore-agent-sdk/dist/tsconfig.tsbuildinfo +1 -1
  229. package/dist/dashboard-runtime/node_modules/@tablestore/tablestore-agent-shared/dist/config.d.ts.map +1 -1
  230. package/dist/dashboard-runtime/node_modules/@tablestore/tablestore-agent-shared/dist/config.js +9 -1
  231. package/dist/dashboard-runtime/node_modules/@tablestore/tablestore-agent-shared/dist/config.js.map +1 -1
  232. package/dist/dashboard-runtime/node_modules/@tablestore/tablestore-agent-shared/dist/constants.d.ts +9 -1
  233. package/dist/dashboard-runtime/node_modules/@tablestore/tablestore-agent-shared/dist/constants.d.ts.map +1 -1
  234. package/dist/dashboard-runtime/node_modules/@tablestore/tablestore-agent-shared/dist/constants.js +18 -0
  235. package/dist/dashboard-runtime/node_modules/@tablestore/tablestore-agent-shared/dist/constants.js.map +1 -1
  236. package/dist/dashboard-runtime/node_modules/@tablestore/tablestore-agent-shared/dist/tsconfig.tsbuildinfo +1 -1
  237. package/dist/dashboard-runtime/node_modules/@tablestore/tablestore-agent-shared/dist/types.d.ts +9 -0
  238. package/dist/dashboard-runtime/node_modules/@tablestore/tablestore-agent-shared/dist/types.d.ts.map +1 -1
  239. package/dist/node_modules/@tablestore/tablestore-agent-sdk/dist/internal/auth-options.d.ts +25 -0
  240. package/dist/node_modules/@tablestore/tablestore-agent-sdk/dist/internal/auth-options.d.ts.map +1 -0
  241. package/dist/node_modules/@tablestore/tablestore-agent-sdk/dist/internal/auth-options.js +29 -0
  242. package/dist/node_modules/@tablestore/tablestore-agent-sdk/dist/internal/auth-options.js.map +1 -0
  243. package/dist/node_modules/@tablestore/tablestore-agent-sdk/dist/kb-client.d.ts.map +1 -1
  244. package/dist/node_modules/@tablestore/tablestore-agent-sdk/dist/kb-client.js +4 -5
  245. package/dist/node_modules/@tablestore/tablestore-agent-sdk/dist/kb-client.js.map +1 -1
  246. package/dist/node_modules/@tablestore/tablestore-agent-sdk/dist/managed-ots.d.ts.map +1 -1
  247. package/dist/node_modules/@tablestore/tablestore-agent-sdk/dist/managed-ots.js +11 -2
  248. package/dist/node_modules/@tablestore/tablestore-agent-sdk/dist/managed-ots.js.map +1 -1
  249. package/dist/node_modules/@tablestore/tablestore-agent-sdk/dist/memory-client.d.ts.map +1 -1
  250. package/dist/node_modules/@tablestore/tablestore-agent-sdk/dist/memory-client.js +2 -3
  251. package/dist/node_modules/@tablestore/tablestore-agent-sdk/dist/memory-client.js.map +1 -1
  252. package/dist/node_modules/@tablestore/tablestore-agent-sdk/dist/tsconfig.tsbuildinfo +1 -1
  253. package/dist/node_modules/@tablestore/tablestore-agent-shared/dist/config.d.ts.map +1 -1
  254. package/dist/node_modules/@tablestore/tablestore-agent-shared/dist/config.js +9 -1
  255. package/dist/node_modules/@tablestore/tablestore-agent-shared/dist/config.js.map +1 -1
  256. package/dist/node_modules/@tablestore/tablestore-agent-shared/dist/constants.d.ts +9 -1
  257. package/dist/node_modules/@tablestore/tablestore-agent-shared/dist/constants.d.ts.map +1 -1
  258. package/dist/node_modules/@tablestore/tablestore-agent-shared/dist/constants.js +18 -0
  259. package/dist/node_modules/@tablestore/tablestore-agent-shared/dist/constants.js.map +1 -1
  260. package/dist/node_modules/@tablestore/tablestore-agent-shared/dist/tsconfig.tsbuildinfo +1 -1
  261. package/dist/node_modules/@tablestore/tablestore-agent-shared/dist/types.d.ts +9 -0
  262. package/dist/node_modules/@tablestore/tablestore-agent-shared/dist/types.d.ts.map +1 -1
  263. package/package.json +2 -2
  264. package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_0gep_x_._.js +0 -3
  265. package/dist/dashboard-runtime/dashboard/.next/static/chunks/0.b6bx-29l5e2.js +0 -1
  266. package/dist/dashboard-runtime/dashboard/.next/static/chunks/05ny4_cp6fkfu.js +0 -1
  267. package/dist/dashboard-runtime/dashboard/.next/static/chunks/097px3urt-4kr.js +0 -1
  268. package/dist/dashboard-runtime/dashboard/.next/static/chunks/0c08tbxyly68e.js +0 -1
  269. package/dist/dashboard-runtime/dashboard/.next/static/chunks/0draec5luxua1.js +0 -1
  270. package/dist/dashboard-runtime/dashboard/.next/static/chunks/0f60fxsrh4wbq.js +0 -5
  271. package/dist/dashboard-runtime/dashboard/.next/static/chunks/0frefg2bkdon0.css +0 -1
  272. package/dist/dashboard-runtime/dashboard/.next/static/chunks/0oh~.z3b9_qzy.js +0 -1
  273. package/dist/dashboard-runtime/dashboard/.next/static/chunks/0w6-j4p-7fybc.js +0 -1
  274. package/dist/dashboard-runtime/dashboard/.next/static/chunks/0za3q13g~ihb2.js +0 -1
  275. package/dist/dashboard-runtime/dashboard/.next/static/chunks/11fppb7wskgrx.js +0 -1
  276. package/dist/dashboard-runtime/dashboard/.next/static/chunks/126jyzsu33t60.js +0 -1
  277. package/dist/dashboard-runtime/dashboard/.next/static/chunks/12~tfkzir29.4.js +0 -1
  278. package/dist/dashboard-runtime/dashboard/.next/static/chunks/14teeoxc_1i46.js +0 -1
  279. /package/dist/dashboard-runtime/dashboard/.next/static/{pE-cQCmJ7b5_xgwqBJ7J3 → sk6oO3r92_OgCvicmyYrR}/_buildManifest.js +0 -0
  280. /package/dist/dashboard-runtime/dashboard/.next/static/{pE-cQCmJ7b5_xgwqBJ7J3 → sk6oO3r92_OgCvicmyYrR}/_clientMiddlewareManifest.js +0 -0
  281. /package/dist/dashboard-runtime/dashboard/.next/static/{pE-cQCmJ7b5_xgwqBJ7J3 → sk6oO3r92_OgCvicmyYrR}/_ssgManifest.js +0 -0
@@ -1,35 +1,118 @@
1
- import { useQuery } from "@tanstack/react-query";
1
+ import { useEffect } from "react";
2
+ import { useInfiniteQuery } from "@tanstack/react-query";
2
3
  import { listDreamTasks } from "@/services/memory";
3
4
  import { queryKeys } from "@/lib/query-keys";
4
5
  import { useRuntimeContext } from "@/providers/runtime-context-provider";
5
- import type { MemoryScope } from "@/types/memory";
6
+ import type { DreamTask, MemoryScope } from "@/types/memory";
7
+
8
+ /**
9
+ * Cap on eager auto-pagination. The Dream list API returns tasks scope-major
10
+ * (createdAt desc *within* a scope, but not globally), so to present a coherent
11
+ * scope-grouped view the hook walks every page and lets the UI group across the
12
+ * full result set. The cap keeps a scope with a very long history from fanning
13
+ * out unbounded; when it is hit the caller surfaces a "load more" affordance.
14
+ */
15
+ const MAX_AUTO_PAGES = 25;
16
+
17
+ interface DreamTasksPage {
18
+ items: DreamTask[];
19
+ totalCount: number;
20
+ scope: MemoryScope;
21
+ memoryStoreName: string;
22
+ nextToken?: string;
23
+ }
24
+
25
+ export interface UseDreamTasksResult {
26
+ /** All tasks loaded so far, flattened across auto-paginated pages. */
27
+ tasks: DreamTask[];
28
+ isLoading: boolean;
29
+ isRefetching: boolean;
30
+ isFetchingNextPage: boolean;
31
+ hasNextPage: boolean;
32
+ /** True when the auto-pagination cap was hit and more tasks remain unloaded. */
33
+ truncated: boolean;
34
+ fetchNextPage: () => void;
35
+ refetch: () => void;
36
+ error: Error | null;
37
+ errorCode: string | null;
38
+ }
6
39
 
7
40
  export function useDreamTasks(
8
41
  memoryStoreName: string,
9
42
  scope: MemoryScope | null,
10
43
  options?: {
11
44
  limit?: number;
12
- nextToken?: string;
13
45
  status?: string;
14
46
  minTimestamp?: string;
15
47
  maxTimestamp?: string;
16
48
  },
17
- ) {
49
+ ): UseDreamTasksResult {
18
50
  const { context, ready } = useRuntimeContext();
19
- return useQuery({
51
+ const limit = options?.limit ?? 50;
52
+ const filters = {
53
+ status: options?.status,
54
+ minTimestamp: options?.minTimestamp,
55
+ maxTimestamp: options?.maxTimestamp,
56
+ };
57
+
58
+ const query = useInfiniteQuery<DreamTasksPage, Error>({
59
+ // nextToken is intentionally omitted from the key — it is the pageParam,
60
+ // so all pages of one filter share a single cache entry.
20
61
  queryKey: queryKeys.dreamTasks(
21
62
  context.dataScopeKey,
22
63
  memoryStoreName,
23
64
  scope,
24
- options?.nextToken,
25
- options?.limit,
26
- {
27
- status: options?.status,
28
- minTimestamp: options?.minTimestamp,
29
- maxTimestamp: options?.maxTimestamp,
30
- },
65
+ undefined,
66
+ limit,
67
+ filters,
31
68
  ),
32
- queryFn: () => listDreamTasks(memoryStoreName, scope!, options),
69
+ queryFn: ({ pageParam }) =>
70
+ listDreamTasks(memoryStoreName, scope!, {
71
+ limit,
72
+ nextToken: typeof pageParam === "string" ? pageParam : undefined,
73
+ status: filters.status,
74
+ minTimestamp: filters.minTimestamp,
75
+ maxTimestamp: filters.maxTimestamp,
76
+ }),
77
+ getNextPageParam: (last) => last.nextToken ?? undefined,
78
+ initialPageParam: undefined as string | undefined,
33
79
  enabled: ready && !!memoryStoreName && !!scope?.appId,
34
80
  });
81
+
82
+ const pageCount = query.data?.pages?.length ?? 0;
83
+ const capReached = pageCount >= MAX_AUTO_PAGES;
84
+
85
+ // Eagerly load remaining pages (up to the cap) so grouping spans the full
86
+ // result set rather than a single page.
87
+ useEffect(() => {
88
+ if (query.hasNextPage && !query.isFetchingNextPage && !capReached) {
89
+ void query.fetchNextPage();
90
+ }
91
+ }, [query.hasNextPage, query.isFetchingNextPage, capReached, query]);
92
+
93
+ const tasks = (query.data?.pages ?? []).flatMap(
94
+ (page) => page.items ?? [],
95
+ ) as DreamTask[];
96
+
97
+ const errorCode =
98
+ query.error && "code" in query.error
99
+ ? ((query.error as { code?: string }).code ?? null)
100
+ : null;
101
+
102
+ return {
103
+ tasks,
104
+ isLoading: query.isLoading,
105
+ isRefetching: query.isRefetching,
106
+ isFetchingNextPage: query.isFetchingNextPage,
107
+ hasNextPage: Boolean(query.hasNextPage),
108
+ truncated: Boolean(query.hasNextPage) && capReached,
109
+ fetchNextPage: () => {
110
+ if (query.hasNextPage && !query.isFetchingNextPage) query.fetchNextPage();
111
+ },
112
+ refetch: () => {
113
+ void query.refetch();
114
+ },
115
+ error: query.error ?? null,
116
+ errorCode,
117
+ };
35
118
  }
@@ -0,0 +1,179 @@
1
+ import { useQueries, useQuery } from "@tanstack/react-query";
2
+ import { getMemoryUnit, listMemoryMessages } from "@/services/memory";
3
+ import { queryKeys } from "@/lib/query-keys";
4
+ import { useRuntimeContext } from "@/providers/runtime-context-provider";
5
+ import type { MemoryTask, MemoryUnit, SessionMessage } from "@/types/memory";
6
+
7
+ function toEpochMs(value: string | number | undefined): number | undefined {
8
+ if (value === undefined || value === null) return undefined;
9
+ if (typeof value === "number") return value;
10
+ const ms = new Date(value).getTime();
11
+ return Number.isFinite(ms) ? ms : undefined;
12
+ }
13
+
14
+ export interface SourceEvidence {
15
+ // Real message hashes the task's units cite. Empty when no unit carries refs.
16
+ refIds: Set<string>;
17
+ // Tight timestamp window implied by the refs; Infinity / -Infinity if none.
18
+ minTs: number;
19
+ maxTs: number;
20
+ }
21
+
22
+ /**
23
+ * Collect the REAL source-turn evidence from a task's derived units.
24
+ *
25
+ * Only source_turn_refs are read: they carry resolved message hashes (with
26
+ * timestamps). source_turn_ids are deliberately ignored — they can be LOGICAL
27
+ * turn labels like "D2:1" (dialogue 2, turn 1) that never equal a stored
28
+ * messageId, so using them as a filter would hide every real message behind a
29
+ * false "messages were cleaned up" empty state.
30
+ */
31
+ export function aggregateSourceEvidence(
32
+ memories: ReadonlyArray<MemoryUnit | undefined>,
33
+ ): SourceEvidence {
34
+ const refIds = new Set<string>();
35
+ let minTs = Infinity;
36
+ let maxTs = -Infinity;
37
+ for (const memory of memories) {
38
+ if (!memory) continue;
39
+ for (const ref of memory.source_turn_refs ?? []) {
40
+ if (ref?.messageId) refIds.add(ref.messageId);
41
+ const ts = ref?.timestampMs;
42
+ if (typeof ts === "number" && Number.isFinite(ts)) {
43
+ if (ts < minTs) minTs = ts;
44
+ if (ts > maxTs) maxTs = ts;
45
+ }
46
+ }
47
+ }
48
+ return { refIds, minTs, maxTs };
49
+ }
50
+
51
+ /**
52
+ * Pick the messages a task actually drew from. With real refs, filter to
53
+ * exactly those messageIds (precise). Without refs, show the fetched window in
54
+ * timestamp order (precise=false) instead of hiding everything.
55
+ */
56
+ export function selectSourceMessages(
57
+ allMessages: ReadonlyArray<SessionMessage>,
58
+ refIds: ReadonlySet<string>,
59
+ ): { messages: SessionMessage[]; precise: boolean } {
60
+ const precise = refIds.size > 0;
61
+ const filtered = precise
62
+ ? allMessages.filter((m) => m.messageId && refIds.has(m.messageId))
63
+ : [...allMessages];
64
+ filtered.sort(
65
+ (a, b) => (toEpochMs(a.timestamp) ?? 0) - (toEpochMs(b.timestamp) ?? 0),
66
+ );
67
+ return { messages: filtered, precise };
68
+ }
69
+
70
+ export interface TaskSourceMessages {
71
+ messages: SessionMessage[];
72
+ isLoading: boolean;
73
+ // True when the result is filtered to the exact source turns the task's
74
+ // derived units cite. False means we fell back to the task-lifetime window
75
+ // (e.g. the task produced no units, or the units carry no source refs).
76
+ precise: boolean;
77
+ }
78
+
79
+ /**
80
+ * Resolve the original conversation turns that actually fed an ingest task,
81
+ * by walking the task's derived units and reading their source-turn evidence.
82
+ *
83
+ * This is task-bound: it never bleeds into a neighboring AddMemories call that
84
+ * happened to write the same scope around the same time, which the old
85
+ * scope+time-window heuristic could not avoid (a unit's source_turn_refs name
86
+ * the precise messageIds). The time window is only used to bound the fetch;
87
+ * the messageId set is what makes the result exact.
88
+ */
89
+ export function useTaskSourceMessages(
90
+ memoryStoreName: string,
91
+ task: MemoryTask | null,
92
+ ): TaskSourceMessages {
93
+ const { context, ready } = useRuntimeContext();
94
+ const scope = task?.scope ?? null;
95
+ const unitIds = task?.derivedUnitIds ?? [];
96
+ const baseEnabled = ready && !!memoryStoreName && !!scope?.appId;
97
+
98
+ // 1. Fetch every derived unit in parallel. Shares cache keys with
99
+ // ExtractedMemoriesPanel's per-row useMemoryUnit, so no duplicate fetches.
100
+ const unitQueries = useQueries({
101
+ queries: unitIds.map((id) => ({
102
+ queryKey: queryKeys.memoryUnit(
103
+ context.dataScopeKey,
104
+ memoryStoreName,
105
+ id,
106
+ scope,
107
+ ),
108
+ queryFn: () =>
109
+ getMemoryUnit({ memoryStoreName, memoryId: id, scope: scope! }),
110
+ enabled: baseEnabled && !!id && id !== "-",
111
+ staleTime: 30_000,
112
+ })),
113
+ });
114
+
115
+ const unitsLoading =
116
+ unitIds.length > 0 && unitQueries.some((q) => q.isLoading);
117
+
118
+ // 2. Aggregate source-turn evidence across every derived unit. The filter
119
+ // set is built from source_turn_refs only — see aggregateSourceEvidence.
120
+ const { refIds, minTs, maxTs } = aggregateSourceEvidence(
121
+ unitQueries.map((q) => q.data?.memory),
122
+ );
123
+
124
+ // 3. Pick a fetch window. Prefer the tight window implied by source-turn
125
+ // timestamps; fall back to the task lifetime when refs lack timestamps
126
+ // (or there are no units at all).
127
+ const hasRefWindow = Number.isFinite(minTs) && Number.isFinite(maxTs);
128
+ const createdMs = toEpochMs(task?.createdAt);
129
+ const finishedMs = toEpochMs(task?.finishedAt) ?? toEpochMs(task?.updatedAt);
130
+ const fallbackMax = finishedMs ?? createdMs;
131
+ const winMin = hasRefWindow
132
+ ? minTs - 2_000
133
+ : createdMs !== undefined
134
+ ? createdMs - 60_000
135
+ : undefined;
136
+ const winMax = hasRefWindow
137
+ ? maxTs + 2_000
138
+ : fallbackMax !== undefined
139
+ ? fallbackMax + 60_000
140
+ : undefined;
141
+ const minTimestamp =
142
+ winMin !== undefined ? new Date(winMin).toISOString() : undefined;
143
+ const maxTimestamp =
144
+ winMax !== undefined ? new Date(winMax).toISOString() : undefined;
145
+
146
+ const messagesEnabled =
147
+ baseEnabled &&
148
+ !unitsLoading &&
149
+ (minTimestamp !== undefined || maxTimestamp !== undefined);
150
+
151
+ const messagesQuery = useQuery({
152
+ queryKey: queryKeys.memoryMessages(
153
+ context.dataScopeKey,
154
+ memoryStoreName,
155
+ scope,
156
+ undefined,
157
+ 100,
158
+ { minTimestamp, maxTimestamp },
159
+ ),
160
+ queryFn: () =>
161
+ listMemoryMessages(memoryStoreName, scope!, {
162
+ limit: 100,
163
+ minTimestamp,
164
+ maxTimestamp,
165
+ }),
166
+ enabled: messagesEnabled,
167
+ staleTime: 30_000,
168
+ });
169
+
170
+ // 4. Filter to the exact source turns; keep window order when we can't.
171
+ const allMessages = messagesQuery.data?.items ?? [];
172
+ const { messages, precise } = selectSourceMessages(allMessages, refIds);
173
+
174
+ return {
175
+ messages,
176
+ isLoading: unitsLoading || messagesQuery.isLoading,
177
+ precise,
178
+ };
179
+ }
@@ -1,4 +1,4 @@
1
- import type { MemoryScope } from "@/types/memory";
1
+ import type { DreamTask, MemoryScope } from "@/types/memory";
2
2
 
3
3
  export function buildMemoryScope(searchParams: URLSearchParams): MemoryScope {
4
4
  return {
@@ -50,6 +50,80 @@ export function formatScope(scope?: MemoryScope): string {
50
50
  ].filter(Boolean).join(" / ");
51
51
  }
52
52
 
53
+ /**
54
+ * A set of dream tasks that share the same input scope.
55
+ *
56
+ * The Dream list API returns tasks scope-major (grouped by scope partition,
57
+ * `createdAt` descending *within* each partition) but NOT globally time
58
+ * sorted across scopes. Under the default wildcard scope the raw list looks
59
+ * like its creation times jump around at every scope boundary. Grouping makes
60
+ * that structure explicit: one header per scope, `createdAt` descending
61
+ * inside, with the most recently active scope on top.
62
+ */
63
+ export interface DreamTaskGroup {
64
+ /** Stable identifier for the group (derived from the scope(s)). */
65
+ key: string;
66
+ /** Representative scope — the first input scope of the group's tasks. */
67
+ scope: MemoryScope;
68
+ /** Human-readable scope label, e.g. `app / tenant / agent / run`. */
69
+ label: string;
70
+ /** Tasks in the group, sorted by `createdAt` descending. */
71
+ tasks: DreamTask[];
72
+ /** Epoch ms of the newest task in the group (used to order groups). */
73
+ latest: number;
74
+ }
75
+
76
+ const MISSING_SCOPE_LABEL = "未知 scope";
77
+
78
+ function dreamTaskCreatedMs(task: DreamTask): number {
79
+ const ms = Date.parse(task.createdAt);
80
+ return Number.isFinite(ms) ? ms : 0;
81
+ }
82
+
83
+ /**
84
+ * Group dream tasks by their input scope for display.
85
+ *
86
+ * - Multi-scope dreams (more than one `inputScopes` entry) get their own
87
+ * combined group and never merge into a single-scope group.
88
+ * - Tasks within a group are sorted by `createdAt` descending (defensive —
89
+ * the backend already returns them that way within a scope).
90
+ * - Groups are ordered by their most recent task, descending, so the scope
91
+ * with the latest activity appears first.
92
+ */
93
+ export function groupDreamTasksByScope(tasks: DreamTask[]): DreamTaskGroup[] {
94
+ const groups = new Map<string, DreamTaskGroup>();
95
+
96
+ for (const task of tasks) {
97
+ const scopes = task.inputScopes ?? [];
98
+ const key =
99
+ scopes.length > 0
100
+ ? scopes.map((s) => formatScope(s)).join(" + ")
101
+ : MISSING_SCOPE_LABEL;
102
+ const label = key;
103
+
104
+ let group = groups.get(key);
105
+ if (!group) {
106
+ group = {
107
+ key,
108
+ scope: scopes[0] ?? { appId: "" },
109
+ label,
110
+ tasks: [],
111
+ latest: 0,
112
+ };
113
+ groups.set(key, group);
114
+ }
115
+ group.tasks.push(task);
116
+ group.latest = Math.max(group.latest, dreamTaskCreatedMs(task));
117
+ }
118
+
119
+ const result = Array.from(groups.values());
120
+ for (const group of result) {
121
+ group.tasks.sort((a, b) => dreamTaskCreatedMs(b) - dreamTaskCreatedMs(a));
122
+ }
123
+ result.sort((a, b) => b.latest - a.latest);
124
+ return result;
125
+ }
126
+
53
127
  export function parseJsonObject(value: string): Record<string, string> | undefined {
54
128
  if (!value.trim()) return undefined;
55
129
  const parsed = JSON.parse(value) as unknown;
@@ -185,6 +185,7 @@ export function configFromActiveInstance():
185
185
  const fields = {
186
186
  access_key_id: detail.access_key_id,
187
187
  access_key_secret: detail.access_key_secret,
188
+ api_key: detail.api_key,
188
189
  ots_endpoint: detail.ots_endpoint || ots.ots_endpoint,
189
190
  ots_instance_name: detail.ots_instance_name || ots.ots_instance_name,
190
191
  oss_endpoint: detail.oss_endpoint || oss.oss_endpoint,
@@ -192,9 +193,12 @@ export function configFromActiveInstance():
192
193
  region: detail.region || ots.region || oss.region,
193
194
  };
194
195
 
196
+ // A usable instance needs an endpoint/instance and at least one data-plane
197
+ // credential: the AK/SK pair, or an API Key (which takes precedence).
198
+ const hasAkSk = Boolean(fields.access_key_id && fields.access_key_secret);
199
+ const hasApiKey = Boolean(fields.api_key);
195
200
  if (
196
- !fields.access_key_id ||
197
- !fields.access_key_secret ||
201
+ (!hasAkSk && !hasApiKey) ||
198
202
  !fields.ots_endpoint ||
199
203
  !fields.ots_instance_name
200
204
  ) {
@@ -218,6 +222,7 @@ function buildAppConfig(fields: Record<string, string>): AppConfig {
218
222
  return {
219
223
  access_key_id: fields.access_key_id ?? "",
220
224
  access_key_secret: fields.access_key_secret ?? "",
225
+ api_key: fields.api_key ?? "",
221
226
  ots_endpoint: otsEndpoint,
222
227
  ots_instance_name: fields.ots_instance_name ?? "",
223
228
  oss_endpoint: fields.oss_endpoint ?? "",
@@ -243,16 +248,21 @@ function buildAppConfig(fields: Record<string, string>): AppConfig {
243
248
  function configFromEnv(): Record<string, string> | null {
244
249
  const accessKeyId = process.env.TABLESTORE_ACCESS_KEY_ID ?? "";
245
250
  const accessKeySecret = process.env.TABLESTORE_ACCESS_KEY_SECRET ?? "";
251
+ const apiKey = process.env.TABLESTORE_API_KEY ?? "";
246
252
  const endpoint = process.env.TABLESTORE_ENDPOINT ?? "";
247
253
  const instanceName = process.env.TABLESTORE_INSTANCE_NAME ?? "";
248
254
 
249
- if (!accessKeyId || !accessKeySecret || !endpoint || !instanceName) {
255
+ // Need an endpoint/instance and at least one credential (AK/SK or API Key).
256
+ const hasAkSk = Boolean(accessKeyId && accessKeySecret);
257
+ const hasApiKey = Boolean(apiKey);
258
+ if ((!hasAkSk && !hasApiKey) || !endpoint || !instanceName) {
250
259
  return null;
251
260
  }
252
261
 
253
262
  return {
254
263
  access_key_id: accessKeyId,
255
264
  access_key_secret: accessKeySecret,
265
+ api_key: apiKey,
256
266
  ots_endpoint: endpoint,
257
267
  ots_instance_name: instanceName,
258
268
  oss_endpoint: process.env.TABLESTORE_OSS_ENDPOINT ?? "",
@@ -288,6 +298,7 @@ function tokenFieldsForInstance(
288
298
  return {
289
299
  access_key_id: detail.access_key_id,
290
300
  access_key_secret: detail.access_key_secret,
301
+ api_key: detail.api_key,
291
302
  ots_endpoint: detail.ots_endpoint || ots.ots_endpoint,
292
303
  ots_instance_name: detail.ots_instance_name || ots.ots_instance_name,
293
304
  oss_endpoint: detail.oss_endpoint || oss.oss_endpoint,
@@ -316,6 +327,7 @@ function tokenMatchesInstance(
316
327
  const requiredKeys = [
317
328
  "access_key_id",
318
329
  "access_key_secret",
330
+ "api_key",
319
331
  "ots_endpoint",
320
332
  "ots_instance_name",
321
333
  "oss_endpoint",
@@ -444,6 +456,7 @@ function computeClientCacheKey(
444
456
  instanceName ?? "",
445
457
  fields.access_key_id ?? "",
446
458
  fields.access_key_secret ?? "",
459
+ fields.api_key ?? "",
447
460
  fields.ots_endpoint ?? "",
448
461
  fields.ots_instance_name ?? "",
449
462
  fields.oss_endpoint ?? "",
@@ -457,6 +470,7 @@ function computeCredentialFingerprint(fields: Record<string, string>): string {
457
470
  const raw = [
458
471
  fields.access_key_id ?? "",
459
472
  fields.access_key_secret ?? "",
473
+ fields.api_key ?? "",
460
474
  fields.ots_endpoint ?? "",
461
475
  fields.ots_instance_name ?? "",
462
476
  fields.oss_endpoint ?? "",
@@ -16,10 +16,52 @@ const trimmedNonEmpty = (label: string, max = 512) =>
16
16
  const optionalTrimmed = (max = 512) =>
17
17
  z.string().trim().max(max).optional().or(z.literal(""));
18
18
 
19
- export const connectInstanceSchema = z.object({
19
+ // Credential-mode rules shared by connect / update / edit schemas:
20
+ // 1. AccessKey ID and Secret must be supplied together (or both omitted).
21
+ // 2. At least one data-plane credential must be present — the AK/SK pair or
22
+ // an API Key. (Update/edit relax rule 2 to allow "keep existing".)
23
+ const akSkPaired = (v: {
24
+ accessKeyId?: string;
25
+ accessKeySecret?: string;
26
+ }): boolean => Boolean(v.accessKeyId) === Boolean(v.accessKeySecret);
27
+ const AK_SK_PAIR_ERROR = {
28
+ message: "AccessKey ID 与 Secret 必须成对填写",
29
+ path: ["accessKeySecret"],
30
+ };
31
+ const someCredential = (v: {
32
+ accessKeyId?: string;
33
+ accessKeySecret?: string;
34
+ apiKey?: string;
35
+ }): boolean =>
36
+ Boolean(v.accessKeyId && v.accessKeySecret) || Boolean(v.apiKey);
37
+ const CREDENTIAL_REQUIRED_ERROR = {
38
+ message: "请至少提供 API Key,或 AccessKey ID + Secret",
39
+ path: ["apiKey"],
40
+ };
41
+
42
+ /**
43
+ * Apply the credential-mode rules to any object schema that carries the
44
+ * `accessKeyId` / `accessKeySecret` / `apiKey` fields. Exposed so the
45
+ * interactive form can layer its own URL-shape overrides onto the base object
46
+ * (via `.extend`) and still inherit the exact same credential validation.
47
+ * The predicates read the parsed value loosely (`Record`) because the input
48
+ * type varies across the connect / form variants.
49
+ */
50
+ export function withCredentialModeRules<S extends z.ZodTypeAny>(schema: S) {
51
+ return schema
52
+ .refine((v) => akSkPaired(v as Record<string, string>), AK_SK_PAIR_ERROR)
53
+ .refine(
54
+ (v) => someCredential(v as Record<string, string>),
55
+ CREDENTIAL_REQUIRED_ERROR,
56
+ );
57
+ }
58
+
59
+ /** Base object (no refinements) so callers can `.extend` before refining. */
60
+ export const connectInstanceBaseSchema = z.object({
20
61
  name: instanceNameSchema,
21
- accessKeyId: trimmedNonEmpty("AccessKey ID", 128),
22
- accessKeySecret: trimmedNonEmpty("AccessKey Secret", 512),
62
+ accessKeyId: optionalTrimmed(128),
63
+ accessKeySecret: optionalTrimmed(512),
64
+ apiKey: optionalTrimmed(512),
23
65
  otsEndpoint: trimmedNonEmpty("OTS Endpoint", 256),
24
66
  otsInstanceName: trimmedNonEmpty("OTS 实例名", 128),
25
67
  ossEndpoint: optionalTrimmed(256),
@@ -28,10 +70,16 @@ export const connectInstanceSchema = z.object({
28
70
  activate: z.boolean().optional(),
29
71
  });
30
72
 
73
+ export const connectInstanceSchema = withCredentialModeRules(
74
+ connectInstanceBaseSchema,
75
+ );
76
+
31
77
  export const updateInstanceSchema = z
32
78
  .object({
33
79
  accessKeyId: optionalTrimmed(128),
34
80
  accessKeySecret: optionalTrimmed(512),
81
+ // Optional on update: omit/leave blank to keep the existing credential.
82
+ apiKey: optionalTrimmed(512),
35
83
  otsEndpoint: optionalTrimmed(256),
36
84
  otsInstanceName: optionalTrimmed(128),
37
85
  ossEndpoint: optionalTrimmed(256),
@@ -43,7 +91,9 @@ export const updateInstanceSchema = z
43
91
  // one of the pair previously sneaked past validation and later tripped a
44
92
  // generic 500 on the server side where the pair is encoded as a single
45
93
  // credential. Matching both at the schema layer surfaces the mistake in
46
- // the form itself with a field-targeted message.
94
+ // the form itself with a field-targeted message. (No "at least one
95
+ // credential" rule here: a partial update may touch only OSS/region and
96
+ // legitimately leave both credential fields blank to keep the current one.)
47
97
  .refine(
48
98
  (v) => {
49
99
  const hasId = Boolean(v.accessKeyId && v.accessKeyId.length > 0);
@@ -70,6 +120,8 @@ export const editInstanceFormSchema = z
70
120
  name: instanceNameSchema,
71
121
  accessKeyId: optionalTrimmed(128),
72
122
  accessKeySecret: optionalTrimmed(512),
123
+ // Leave blank to keep the existing API Key.
124
+ apiKey: optionalTrimmed(512),
73
125
  otsEndpoint: trimmedNonEmpty("OTS Endpoint", 256),
74
126
  otsInstanceName: trimmedNonEmpty("OTS 实例名", 128),
75
127
  ossEndpoint: optionalTrimmed(256),
@@ -25,6 +25,8 @@ export interface InstanceDetail extends InstanceSummary {
25
25
  accessKeyIdMasked?: string;
26
26
  /** Masked SK (first4****last4), safe for UI display. */
27
27
  accessKeySecretMasked?: string;
28
+ /** Masked API Key (first4****last4), safe for UI display. */
29
+ apiKeyMasked?: string;
28
30
  memoryDefaults?: {
29
31
  storeName?: string;
30
32
  appId?: string;
@@ -36,8 +38,14 @@ export interface InstanceDetail extends InstanceSummary {
36
38
 
37
39
  export interface ConnectInstancePayload {
38
40
  name: string;
39
- accessKeyId: string;
40
- accessKeySecret: string;
41
+ /** AccessKey pair. Optional when an API Key is supplied instead. */
42
+ accessKeyId?: string;
43
+ accessKeySecret?: string;
44
+ /**
45
+ * Tablestore API Key (data-plane credential). Takes precedence over AK/SK.
46
+ * Requires otsEndpoint/otsInstanceName since it cannot auto-provision.
47
+ */
48
+ apiKey?: string;
41
49
  otsEndpoint: string;
42
50
  otsInstanceName: string;
43
51
  ossEndpoint?: string;