@tablestore/tablestore-agent-cli 0.2.7 → 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 (172) 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_client-reference-manifest.js +1 -1
  14. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/chat/page_client-reference-manifest.js +1 -1
  15. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/knowledge-base/[name]/documents/page.js.nft.json +1 -1
  16. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/knowledge-base/[name]/documents/page_client-reference-manifest.js +1 -1
  17. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/knowledge-base/[name]/page_client-reference-manifest.js +1 -1
  18. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/knowledge-base/[name]/qa/page_client-reference-manifest.js +1 -1
  19. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/knowledge-base/[name]/retrieval/page_client-reference-manifest.js +1 -1
  20. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/knowledge-base/[name]/settings/page_client-reference-manifest.js +1 -1
  21. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/knowledge-base/create/page_client-reference-manifest.js +1 -1
  22. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/knowledge-base/page_client-reference-manifest.js +1 -1
  23. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/llm-providers/[id]/page_client-reference-manifest.js +1 -1
  24. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/llm-providers/new/page_client-reference-manifest.js +1 -1
  25. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/llm-providers/page_client-reference-manifest.js +1 -1
  26. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/dream/[dreamId]/page_client-reference-manifest.js +1 -1
  27. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/dream/page.js.nft.json +1 -1
  28. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/dream/page_client-reference-manifest.js +1 -1
  29. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/messages/page_client-reference-manifest.js +1 -1
  30. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/page_client-reference-manifest.js +1 -1
  31. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/requests/page_client-reference-manifest.js +1 -1
  32. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/search/page_client-reference-manifest.js +1 -1
  33. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/settings/page_client-reference-manifest.js +1 -1
  34. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/tasks/page_client-reference-manifest.js +1 -1
  35. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/units/page_client-reference-manifest.js +1 -1
  36. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/create/page_client-reference-manifest.js +1 -1
  37. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/page_client-reference-manifest.js +1 -1
  38. package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/projects/page_client-reference-manifest.js +1 -1
  39. package/dist/dashboard-runtime/dashboard/.next/server/app/_global-error.html +1 -1
  40. package/dist/dashboard-runtime/dashboard/.next/server/app/_global-error.rsc +1 -1
  41. package/dist/dashboard-runtime/dashboard/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  42. package/dist/dashboard-runtime/dashboard/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  43. package/dist/dashboard-runtime/dashboard/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  44. package/dist/dashboard-runtime/dashboard/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  45. package/dist/dashboard-runtime/dashboard/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  46. package/dist/dashboard-runtime/dashboard/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  47. package/dist/dashboard-runtime/dashboard/.next/server/app/_not-found.html +1 -1
  48. package/dist/dashboard-runtime/dashboard/.next/server/app/_not-found.rsc +2 -2
  49. package/dist/dashboard-runtime/dashboard/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
  50. package/dist/dashboard-runtime/dashboard/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  51. package/dist/dashboard-runtime/dashboard/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
  52. package/dist/dashboard-runtime/dashboard/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  53. package/dist/dashboard-runtime/dashboard/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  54. package/dist/dashboard-runtime/dashboard/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  55. package/dist/dashboard-runtime/dashboard/.next/server/app/index.html +1 -1
  56. package/dist/dashboard-runtime/dashboard/.next/server/app/index.rsc +2 -2
  57. package/dist/dashboard-runtime/dashboard/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
  58. package/dist/dashboard-runtime/dashboard/.next/server/app/index.segments/_full.segment.rsc +2 -2
  59. package/dist/dashboard-runtime/dashboard/.next/server/app/index.segments/_head.segment.rsc +1 -1
  60. package/dist/dashboard-runtime/dashboard/.next/server/app/index.segments/_index.segment.rsc +2 -2
  61. package/dist/dashboard-runtime/dashboard/.next/server/app/index.segments/_tree.segment.rsc +2 -2
  62. package/dist/dashboard-runtime/dashboard/.next/server/app/onboarding/page_client-reference-manifest.js +1 -1
  63. package/dist/dashboard-runtime/dashboard/.next/server/app/onboarding.html +1 -1
  64. package/dist/dashboard-runtime/dashboard/.next/server/app/onboarding.rsc +3 -3
  65. package/dist/dashboard-runtime/dashboard/.next/server/app/onboarding.segments/_full.segment.rsc +3 -3
  66. package/dist/dashboard-runtime/dashboard/.next/server/app/onboarding.segments/_head.segment.rsc +1 -1
  67. package/dist/dashboard-runtime/dashboard/.next/server/app/onboarding.segments/_index.segment.rsc +2 -2
  68. package/dist/dashboard-runtime/dashboard/.next/server/app/onboarding.segments/_tree.segment.rsc +2 -2
  69. package/dist/dashboard-runtime/dashboard/.next/server/app/onboarding.segments/onboarding/__PAGE__.segment.rsc +2 -2
  70. package/dist/dashboard-runtime/dashboard/.next/server/app/onboarding.segments/onboarding.segment.rsc +1 -1
  71. package/dist/dashboard-runtime/dashboard/.next/server/app/page_client-reference-manifest.js +1 -1
  72. package/dist/dashboard-runtime/dashboard/.next/server/chunks/[root-of-the-server]__0.y01v.._.js +8 -8
  73. package/dist/dashboard-runtime/dashboard/.next/server/chunks/[root-of-the-server]__04zbudf._.js +1 -1
  74. package/dist/dashboard-runtime/dashboard/.next/server/chunks/[root-of-the-server]__05eryp~._.js +1 -1
  75. package/dist/dashboard-runtime/dashboard/.next/server/chunks/[root-of-the-server]__06fva9g._.js +1 -1
  76. package/dist/dashboard-runtime/dashboard/.next/server/chunks/[root-of-the-server]__0cyd2qb._.js +1 -1
  77. package/dist/dashboard-runtime/dashboard/.next/server/chunks/[root-of-the-server]__0wa~r66._.js +8 -8
  78. package/dist/dashboard-runtime/dashboard/.next/server/chunks/[root-of-the-server]__10k~3sa._.js +8 -8
  79. package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/0b1r_app_(dashboard)_knowledge-base_[name]_documents_documents-client_tsx_0g2uxmt._.js +1 -1
  80. package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_0brqbty._.js +1 -1
  81. package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/{_0nmv74v._.js → _0l-4ms-._.js} +2 -2
  82. package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/{_0jl78rk._.js → _0x05u0y._.js} +2 -2
  83. package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_0~5g0_a._.js +1 -1
  84. package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/dashboard_src_0o9jhcn._.js +2 -2
  85. package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/dashboard_src_0y49vhd._.js +1 -1
  86. package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/dashboard_src_10dsqx~._.js +1 -1
  87. package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/dashboard_src_app_(dashboard)_memory_[store]_dream_page_tsx_0uzzpvs._.js +1 -1
  88. package/dist/dashboard-runtime/dashboard/.next/server/middleware-build-manifest.js +3 -3
  89. package/dist/dashboard-runtime/dashboard/.next/server/pages/404.html +1 -1
  90. package/dist/dashboard-runtime/dashboard/.next/server/pages/500.html +1 -1
  91. package/dist/dashboard-runtime/dashboard/.next/server/server-reference-manifest.js +1 -1
  92. package/dist/dashboard-runtime/dashboard/.next/server/server-reference-manifest.json +1 -1
  93. package/dist/dashboard-runtime/dashboard/.next/static/chunks/0-ldkvvj51n5..js +5 -0
  94. package/dist/dashboard-runtime/dashboard/.next/static/chunks/01ccz9pw1s5-1.js +1 -0
  95. package/dist/dashboard-runtime/dashboard/.next/static/chunks/{0ro5-~k1_6.ji.js → 0b2g7gajnlz-x.js} +2 -2
  96. package/dist/dashboard-runtime/dashboard/.next/static/chunks/{0u6g.bq1prqh8.js → 0eg702en0ykod.js} +1 -1
  97. package/dist/dashboard-runtime/dashboard/.next/static/chunks/0jwl.kgoaubdz.js +1 -0
  98. package/dist/dashboard-runtime/dashboard/.next/static/chunks/0o3sqa_d7_k15.js +1 -0
  99. package/dist/dashboard-runtime/dashboard/.next/static/chunks/0oatn7x1t1x~~.js +1 -0
  100. package/dist/dashboard-runtime/dashboard/.next/static/chunks/0zp_ao86_7617.js +1 -0
  101. package/dist/dashboard-runtime/dashboard/.next/static/chunks/{0ezfzygzl1hw8.css → 140~~66uc8843.css} +1 -1
  102. package/dist/dashboard-runtime/dashboard/.next/static/chunks/1692-f0t3ef~c.js +1 -0
  103. package/dist/dashboard-runtime/dashboard/src/app/(dashboard)/layout.tsx +7 -2
  104. package/dist/dashboard-runtime/dashboard/src/app/(dashboard)/memory/[store]/dream/page.tsx +138 -90
  105. package/dist/dashboard-runtime/dashboard/src/app/api/v1/instances/[name]/route.ts +3 -0
  106. package/dist/dashboard-runtime/dashboard/src/app/api/v1/instances/[name]/token/route.ts +1 -0
  107. package/dist/dashboard-runtime/dashboard/src/app/api/v1/instances/[name]/use/route.ts +1 -0
  108. package/dist/dashboard-runtime/dashboard/src/app/api/v1/instances/route.ts +2 -0
  109. package/dist/dashboard-runtime/dashboard/src/components/instance/connect-instance-form.tsx +49 -10
  110. package/dist/dashboard-runtime/dashboard/src/components/instance/edit-instance-dialog.tsx +8 -0
  111. package/dist/dashboard-runtime/dashboard/src/hooks/use-dream-tasks.ts +96 -13
  112. package/dist/dashboard-runtime/dashboard/src/lib/memory.ts +75 -1
  113. package/dist/dashboard-runtime/dashboard/src/lib/server/sdk-client.ts +17 -3
  114. package/dist/dashboard-runtime/dashboard/src/schemas/instance.ts +56 -4
  115. package/dist/dashboard-runtime/dashboard/src/types/instance.ts +10 -2
  116. package/dist/dashboard-runtime/node_modules/@tablestore/tablestore-agent-sdk/dist/internal/auth-options.d.ts +25 -0
  117. package/dist/dashboard-runtime/node_modules/@tablestore/tablestore-agent-sdk/dist/internal/auth-options.d.ts.map +1 -0
  118. package/dist/dashboard-runtime/node_modules/@tablestore/tablestore-agent-sdk/dist/internal/auth-options.js +29 -0
  119. package/dist/dashboard-runtime/node_modules/@tablestore/tablestore-agent-sdk/dist/internal/auth-options.js.map +1 -0
  120. package/dist/dashboard-runtime/node_modules/@tablestore/tablestore-agent-sdk/dist/kb-client.d.ts.map +1 -1
  121. package/dist/dashboard-runtime/node_modules/@tablestore/tablestore-agent-sdk/dist/kb-client.js +4 -5
  122. package/dist/dashboard-runtime/node_modules/@tablestore/tablestore-agent-sdk/dist/kb-client.js.map +1 -1
  123. package/dist/dashboard-runtime/node_modules/@tablestore/tablestore-agent-sdk/dist/managed-ots.d.ts.map +1 -1
  124. package/dist/dashboard-runtime/node_modules/@tablestore/tablestore-agent-sdk/dist/managed-ots.js +11 -2
  125. package/dist/dashboard-runtime/node_modules/@tablestore/tablestore-agent-sdk/dist/managed-ots.js.map +1 -1
  126. package/dist/dashboard-runtime/node_modules/@tablestore/tablestore-agent-sdk/dist/memory-client.d.ts.map +1 -1
  127. package/dist/dashboard-runtime/node_modules/@tablestore/tablestore-agent-sdk/dist/memory-client.js +2 -3
  128. package/dist/dashboard-runtime/node_modules/@tablestore/tablestore-agent-sdk/dist/memory-client.js.map +1 -1
  129. package/dist/dashboard-runtime/node_modules/@tablestore/tablestore-agent-sdk/dist/tsconfig.tsbuildinfo +1 -1
  130. package/dist/dashboard-runtime/node_modules/@tablestore/tablestore-agent-shared/dist/config.d.ts.map +1 -1
  131. package/dist/dashboard-runtime/node_modules/@tablestore/tablestore-agent-shared/dist/config.js +9 -1
  132. package/dist/dashboard-runtime/node_modules/@tablestore/tablestore-agent-shared/dist/config.js.map +1 -1
  133. package/dist/dashboard-runtime/node_modules/@tablestore/tablestore-agent-shared/dist/constants.d.ts +9 -1
  134. package/dist/dashboard-runtime/node_modules/@tablestore/tablestore-agent-shared/dist/constants.d.ts.map +1 -1
  135. package/dist/dashboard-runtime/node_modules/@tablestore/tablestore-agent-shared/dist/constants.js +18 -0
  136. package/dist/dashboard-runtime/node_modules/@tablestore/tablestore-agent-shared/dist/constants.js.map +1 -1
  137. package/dist/dashboard-runtime/node_modules/@tablestore/tablestore-agent-shared/dist/tsconfig.tsbuildinfo +1 -1
  138. package/dist/dashboard-runtime/node_modules/@tablestore/tablestore-agent-shared/dist/types.d.ts +9 -0
  139. package/dist/dashboard-runtime/node_modules/@tablestore/tablestore-agent-shared/dist/types.d.ts.map +1 -1
  140. package/dist/node_modules/@tablestore/tablestore-agent-sdk/dist/internal/auth-options.d.ts +25 -0
  141. package/dist/node_modules/@tablestore/tablestore-agent-sdk/dist/internal/auth-options.d.ts.map +1 -0
  142. package/dist/node_modules/@tablestore/tablestore-agent-sdk/dist/internal/auth-options.js +29 -0
  143. package/dist/node_modules/@tablestore/tablestore-agent-sdk/dist/internal/auth-options.js.map +1 -0
  144. package/dist/node_modules/@tablestore/tablestore-agent-sdk/dist/kb-client.d.ts.map +1 -1
  145. package/dist/node_modules/@tablestore/tablestore-agent-sdk/dist/kb-client.js +4 -5
  146. package/dist/node_modules/@tablestore/tablestore-agent-sdk/dist/kb-client.js.map +1 -1
  147. package/dist/node_modules/@tablestore/tablestore-agent-sdk/dist/managed-ots.d.ts.map +1 -1
  148. package/dist/node_modules/@tablestore/tablestore-agent-sdk/dist/managed-ots.js +11 -2
  149. package/dist/node_modules/@tablestore/tablestore-agent-sdk/dist/managed-ots.js.map +1 -1
  150. package/dist/node_modules/@tablestore/tablestore-agent-sdk/dist/memory-client.d.ts.map +1 -1
  151. package/dist/node_modules/@tablestore/tablestore-agent-sdk/dist/memory-client.js +2 -3
  152. package/dist/node_modules/@tablestore/tablestore-agent-sdk/dist/memory-client.js.map +1 -1
  153. package/dist/node_modules/@tablestore/tablestore-agent-sdk/dist/tsconfig.tsbuildinfo +1 -1
  154. package/dist/node_modules/@tablestore/tablestore-agent-shared/dist/config.d.ts.map +1 -1
  155. package/dist/node_modules/@tablestore/tablestore-agent-shared/dist/config.js +9 -1
  156. package/dist/node_modules/@tablestore/tablestore-agent-shared/dist/config.js.map +1 -1
  157. package/dist/node_modules/@tablestore/tablestore-agent-shared/dist/constants.d.ts +9 -1
  158. package/dist/node_modules/@tablestore/tablestore-agent-shared/dist/constants.d.ts.map +1 -1
  159. package/dist/node_modules/@tablestore/tablestore-agent-shared/dist/constants.js +18 -0
  160. package/dist/node_modules/@tablestore/tablestore-agent-shared/dist/constants.js.map +1 -1
  161. package/dist/node_modules/@tablestore/tablestore-agent-shared/dist/tsconfig.tsbuildinfo +1 -1
  162. package/dist/node_modules/@tablestore/tablestore-agent-shared/dist/types.d.ts +9 -0
  163. package/dist/node_modules/@tablestore/tablestore-agent-shared/dist/types.d.ts.map +1 -1
  164. package/package.json +2 -2
  165. package/dist/dashboard-runtime/dashboard/.next/static/chunks/0draec5luxua1.js +0 -1
  166. package/dist/dashboard-runtime/dashboard/.next/static/chunks/0f60fxsrh4wbq.js +0 -5
  167. package/dist/dashboard-runtime/dashboard/.next/static/chunks/0yqx-vizpechs.js +0 -1
  168. package/dist/dashboard-runtime/dashboard/.next/static/chunks/11fppb7wskgrx.js +0 -1
  169. package/dist/dashboard-runtime/dashboard/.next/static/chunks/17l3ij7h2.vna.js +0 -1
  170. /package/dist/dashboard-runtime/dashboard/.next/static/{-pCWSBA7OQIF0pN0Rem9H → sk6oO3r92_OgCvicmyYrR}/_buildManifest.js +0 -0
  171. /package/dist/dashboard-runtime/dashboard/.next/static/{-pCWSBA7OQIF0pN0Rem9H → sk6oO3r92_OgCvicmyYrR}/_clientMiddlewareManifest.js +0 -0
  172. /package/dist/dashboard-runtime/dashboard/.next/static/{-pCWSBA7OQIF0pN0Rem9H → sk6oO3r92_OgCvicmyYrR}/_ssgManifest.js +0 -0
@@ -0,0 +1 @@
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,882652,e=>{"use strict";let s=(0,e.i(801685).default)("copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);e.s(["Copy",0,s],882652)},533153,e=>{"use strict";let s=(0,e.i(801685).default)("pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);e.s(["Pencil",0,s],533153)},323516,e=>{"use strict";var s=e.i(44501),r=e.i(861403),a=e.i(465581),t=e.i(979980),n=e.i(876490);let i={"knowledge-base":"知识库",memory:"记忆库","llm-providers":"大模型",projects:"项目管理",documents:"文档",retrieval:"检索测试",qa:"问答测试",search:"记忆检索",units:"长期记忆",messages:"短期记忆",requests:"请求审计",settings:"设置",create:"新建",new:"新建",chat:"对话"};e.s(["PageHeader",0,function({title:e,description:l,hideBreadcrumb:o,children:c,className:d}){let m=(0,a.usePathname)()??"/",h=o?[]:function(e){if(/^\/knowledge-base\/[^/]+(?:\/.*)?$/.test(e)||/^\/memory\/[^/]+(?:\/.*)?$/.test(e))return[];let s=e.split("/").filter(Boolean);if(0===s.length)return[];let r=[],a="";return s.forEach((e,t)=>{a+=`/${e}`;let n=decodeURIComponent(e),l=i[n]??n;r.push({label:l,href:t<s.length-1?a:void 0})}),r}(m);return(0,s.jsxs)("div",{className:(0,n.cn)("mb-5 flex flex-col gap-2",d),children:[h.length>1&&(0,s.jsxs)("nav",{"aria-label":"面包屑",className:"flex items-center gap-1 text-[13px] text-[hsl(var(--muted-foreground))]",children:[(0,s.jsx)(r.default,{href:"/",className:"transition-colors hover:text-[hsl(var(--foreground))]",children:"主页"}),h.map((e,a)=>(0,s.jsxs)("span",{className:"flex items-center gap-1",children:[(0,s.jsx)(t.ChevronRight,{className:"h-3 w-3 opacity-60"}),e.href?(0,s.jsx)(r.default,{href:e.href,className:"transition-colors hover:text-[hsl(var(--foreground))]",children:e.label}):(0,s.jsx)("span",{className:"font-medium text-[hsl(var(--foreground))]",children:e.label})]},`${e.label}-${a}`))]}),(0,s.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,s.jsxs)("div",{className:"space-y-1",children:[(0,s.jsx)("h1",{className:"text-xl font-semibold leading-tight text-[hsl(var(--foreground))]",children:e}),l&&(0,s.jsx)("p",{className:"text-[13px] text-[hsl(var(--muted-foreground))]",children:l})]}),c&&(0,s.jsx)("div",{className:"flex shrink-0 items-center gap-2",children:c})]})]})}])},831211,e=>{"use strict";var s=e.i(44501),r=e.i(101685),a=e.i(876490);e.s(["Skeleton",0,function({className:e,delay:r,style:t,...n}){return(0,s.jsx)("div",{className:(0,a.cn)("animate-pulse rounded-md bg-primary/10",e),style:{animationDelay:r?`${r}ms`:void 0,...t},...n})},"SkeletonGroup",0,function({children:e,stagger:a=80,className:t,...n}){let i=r.Children.toArray(e);return(0,s.jsx)("div",{className:t,...n,children:i.map((e,s)=>{if(!r.isValidElement(e))return e;let t=e.props.delay??0;return r.cloneElement(e,{delay:t+s*a})})})}])},330363,e=>{"use strict";let s=(0,e.i(801685).default)("trash-2",[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]]);e.s(["Trash2",0,s],330363)},810414,e=>{"use strict";var s=e.i(44501),r=e.i(101685),a=e.i(876490);let t=r.forwardRef(({className:e,...r},t)=>(0,s.jsx)("div",{ref:t,className:(0,a.cn)("rounded-lg border border-[hsl(var(--border))] bg-[hsl(var(--card))] text-[hsl(var(--card-foreground))] shadow-sm",e),...r}));t.displayName="Card",r.forwardRef(({className:e,...r},t)=>(0,s.jsx)("div",{ref:t,className:(0,a.cn)("flex flex-col space-y-1 px-5 pt-5 pb-3 border-b border-[hsl(var(--border-light))]",e),...r})).displayName="CardHeader",r.forwardRef(({className:e,...r},t)=>(0,s.jsx)("div",{ref:t,className:(0,a.cn)("text-base font-semibold leading-tight",e),...r})).displayName="CardTitle",r.forwardRef(({className:e,...r},t)=>(0,s.jsx)("div",{ref:t,className:(0,a.cn)("text-sm text-[hsl(var(--muted-foreground))]",e),...r})).displayName="CardDescription";let n=r.forwardRef(({className:e,...r},t)=>(0,s.jsx)("div",{ref:t,className:(0,a.cn)("px-5 py-4",e),...r}));n.displayName="CardContent",r.forwardRef(({className:e,...r},t)=>(0,s.jsx)("div",{ref:t,className:(0,a.cn)("flex items-center px-5 py-3 border-t border-[hsl(var(--border-light))]",e),...r})).displayName="CardFooter";let i=r.forwardRef(({className:e,...r},t)=>(0,s.jsx)("div",{ref:t,className:(0,a.cn)("rounded-lg border border-[hsl(var(--border))] bg-[hsl(var(--card))] text-[hsl(var(--card-foreground))] shadow-sm","transition-[transform,box-shadow,border-color] duration-200 ease-[cubic-bezier(0.34,1.56,0.64,1)]","hover:border-[hsl(var(--primary))] hover:shadow-primary-soft",e),...r}));i.displayName="CardInteractive",e.s(["Card",0,t,"CardContent",0,n,"CardInteractive",0,i])},799877,e=>{"use strict";var s=e.i(44501);e.s(["EmptyState",0,function({icon:e,title:r,description:a,action:t,illustration:n}){return(0,s.jsxs)("div",{className:"flex flex-col items-center justify-center py-16 px-4 text-center",children:[n??(0,s.jsx)("div",{className:"mb-5 flex h-20 w-20 items-center justify-center rounded-full bg-[hsl(var(--primary)/0.08)] ring-8 ring-[hsl(var(--primary)/0.04)]",children:(0,s.jsx)(e,{className:"text-primary",size:36,strokeWidth:1.75})}),(0,s.jsx)("h3",{className:"mb-2 text-base font-semibold text-foreground",children:r}),(0,s.jsx)("p",{className:"mb-6 max-w-sm text-sm text-muted-foreground",children:a}),t&&(0,s.jsx)("div",{children:t})]})}])},666458,e=>{"use strict";var s=e.i(44501),r=e.i(294237),a=e.i(876490);let t=(0,r.cva)("inline-flex items-center rounded border px-2 py-0.5 text-xs font-medium transition-colors focus:outline-none focus:ring-2 focus:ring-[hsl(var(--primary)/0.3)] focus:ring-offset-1",{variants:{variant:{default:"border-transparent bg-[hsl(var(--primary))] text-[hsl(var(--primary-foreground))] hover:opacity-90",secondary:"border-transparent bg-[hsl(var(--secondary))] text-[hsl(var(--secondary-foreground))] hover:opacity-80",destructive:"border-transparent bg-[hsl(var(--destructive))] text-[hsl(var(--destructive-foreground))] hover:opacity-90",outline:"border-[hsl(var(--border))] text-[hsl(var(--foreground))] bg-[hsl(var(--card))]",primary:"border-transparent bg-[hsl(var(--primary-soft))] text-[hsl(var(--primary))]",success:"border-transparent bg-[hsl(var(--success-soft))] text-[hsl(var(--success))]",warning:"border-transparent bg-[hsl(var(--warning-soft))] text-[hsl(var(--warning))]",danger:"border-transparent bg-[hsl(var(--danger-soft))] text-[hsl(var(--danger))]",purple:"border-transparent bg-[hsl(var(--purple-soft))] text-[hsl(var(--purple))]"}},defaultVariants:{variant:"default"}});e.s(["Badge",0,function({className:e,variant:r,...n}){return(0,s.jsx)("div",{className:(0,a.cn)(t({variant:r}),e),...n})}])},486221,e=>{"use strict";let s=(0,e.i(801685).default)("ellipsis",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]]);e.s(["MoreHorizontal",0,s],486221)},221070,e=>{"use strict";var s=e.i(44501),r=e.i(101685),a=e.i(465581),t=e.i(377163),n=e.i(358204),i=e.i(187014),l=e.i(323516),o=e.i(68184),c=e.i(433253),d=e.i(831211),m=e.i(853859),h=e.i(847474);function u({name:e,open:r,onOpenChange:a,onSuccess:t}){let n=(0,m.useInstance)(r?e:null),i=(0,m.useUpdateInstance)(e??"");async function l(s){if(!e)return;let r=s.accessKeyId?.trim()??"",n=s.accessKeySecret?.trim()??"",l=s.apiKey?.trim()??"",o={...r&&n?{accessKeyId:r,accessKeySecret:n}:{},...l?{apiKey:l}:{},otsEndpoint:s.otsEndpoint,otsInstanceName:s.otsInstanceName,ossEndpoint:s.ossEndpoint??"",ossBucketName:s.ossBucketName??"",region:s.region},c=await i.mutateAsync(o);t?.(c),a(!1)}let o=n.data;return(0,s.jsx)(c.Dialog,{open:r,onOpenChange:a,children:(0,s.jsxs)(c.DialogContent,{className:"max-w-xl",children:[(0,s.jsxs)(c.DialogHeader,{children:[(0,s.jsxs)(c.DialogTitle,{children:["编辑项目",e?` \xb7 ${e}`:""]}),(0,s.jsx)(c.DialogDescription,{children:"修改连接凭证后会立即生效,其他会话可能需要刷新。"})]}),n.isLoading?(0,s.jsxs)(d.SkeletonGroup,{className:"space-y-3 py-2",children:[(0,s.jsx)(d.Skeleton,{className:"h-9 w-full"}),(0,s.jsx)(d.Skeleton,{className:"h-9 w-full"}),(0,s.jsx)(d.Skeleton,{className:"h-9 w-2/3"}),(0,s.jsx)(d.Skeleton,{className:"h-9 w-full"})]}):n.isError?(0,s.jsxs)("p",{className:"text-sm text-[hsl(var(--destructive))]",children:["加载项目详情失败:",n.error instanceof Error?n.error.message:"未知错误"]}):o?(0,s.jsx)(h.ConnectInstanceForm,{mode:"edit",lockName:!0,busy:i.isPending,defaultValues:{name:o.name,accessKeyId:"",accessKeySecret:"",apiKey:"",otsEndpoint:o.otsEndpoint??"",otsInstanceName:o.otsInstanceName??"",ossEndpoint:o.ossEndpoint??"",ossBucketName:o.ossBucketName??"",region:o.region??""},accessKeyIdPlaceholder:o.accessKeyIdMasked,accessKeySecretPlaceholder:o.accessKeySecretMasked,apiKeyPlaceholder:o.apiKeyMasked,onSubmit:l,submitLabel:"保存修改"}):null]})})}let x=(0,e.i(801685).default)("arrow-right-left",[["path",{d:"m16 3 4 4-4 4",key:"1x1c3m"}],["path",{d:"M20 7H4",key:"zbl0bi"}],["path",{d:"m8 21-4-4 4-4",key:"h9nckh"}],["path",{d:"M4 17h16",key:"g4d7ey"}]]);var p=e.i(506703),f=e.i(882652),g=e.i(486221),v=e.i(533153),y=e.i(330363),b=e.i(666458),j=e.i(942595),N=e.i(810414),w=e.i(801709),k=e.i(876490);function C({item:e,isActive:r,isSwitching:a,isExporting:n,onSwitch:i,onEdit:l,onExport:o,onDelete:c,index:d=0}){return(0,s.jsxs)(N.Card,{className:(0,k.cn)("group relative overflow-hidden","transition-[transform,box-shadow,border-color,background-color] duration-200 ease-[cubic-bezier(0.34,1.56,0.64,1)]","animate-in fade-in slide-in-from-bottom-2",r?["border-[hsl(var(--primary)/0.45)]","shadow-[0_10px_28px_-14px_hsl(var(--primary)/0.4)]","bg-[radial-gradient(circle_at_0%_0%,hsl(var(--primary)/0.08),transparent_55%)]"]:["hover:-translate-y-0.5","hover:border-primary/30","hover:shadow-md"]),style:{animationDelay:`${70*d}ms`,animationDuration:"480ms"},children:[r&&(0,s.jsx)("span",{"aria-hidden":!0,className:"pointer-events-none absolute left-0 top-0 h-full w-[3px] bg-gradient-to-b from-[hsl(var(--primary)/0.55)] via-primary to-[hsl(var(--primary)/0.55)]"}),(0,s.jsxs)(N.CardContent,{className:"flex flex-col p-5",children:[(0,s.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,s.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,s.jsx)(t.Database,{className:(0,k.cn)("h-4 w-4 shrink-0 transition-colors duration-200",r?"text-primary":"text-muted-foreground group-hover:text-primary")}),(0,s.jsx)("h3",{className:"truncate text-base font-semibold tracking-tight text-foreground",children:e.name})]}),(0,s.jsxs)("div",{className:"flex shrink-0 items-center gap-1",children:[r?(0,s.jsxs)(b.Badge,{variant:"secondary",className:"gap-1.5 border-0 bg-[hsl(var(--primary-50))] px-2 py-0.5 text-[11px] font-medium text-[hsl(var(--primary-700))]",children:[(0,s.jsxs)("span",{className:"relative flex h-1.5 w-1.5","aria-hidden":!0,children:[(0,s.jsx)("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-emerald-400 opacity-75"}),(0,s.jsx)("span",{className:"relative inline-flex h-1.5 w-1.5 rounded-full bg-emerald-500"})]}),"活跃中"]}):null,(0,s.jsxs)(w.DropdownMenu,{children:[(0,s.jsx)(w.DropdownMenuTrigger,{asChild:!0,children:(0,s.jsx)(j.Button,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-foreground","aria-label":`更多操作:${e.name}`,children:(0,s.jsx)(g.MoreHorizontal,{className:"h-4 w-4"})})}),(0,s.jsxs)(w.DropdownMenuContent,{align:"end",className:"w-40",children:[(0,s.jsxs)(w.DropdownMenuItem,{onClick:l,children:[(0,s.jsx)(v.Pencil,{className:"mr-2 h-4 w-4"}),"编辑"]}),(0,s.jsxs)(w.DropdownMenuItem,{onClick:o,disabled:n,children:[(0,s.jsx)(f.Copy,{className:"mr-2 h-4 w-4"}),"导出 Token"]}),(0,s.jsx)(w.DropdownMenuSeparator,{}),(0,s.jsxs)(w.DropdownMenuItem,{onClick:c,className:"text-[hsl(var(--destructive))] focus:bg-[hsl(var(--destructive)/0.1)] focus:text-[hsl(var(--destructive))]",children:[(0,s.jsx)(y.Trash2,{className:"mr-2 h-4 w-4"}),"删除"]})]})]})]})]}),(0,s.jsxs)("p",{className:"mt-1 truncate pl-6 text-xs text-muted-foreground",children:[e.otsInstanceName??"--",e.region?` \xb7 ${e.region}`:""]}),(0,s.jsxs)("div",{className:"mt-3 flex flex-wrap gap-1.5 pl-6",children:[(0,s.jsx)(b.Badge,{variant:"secondary",className:"rounded-md border-0 bg-[hsl(var(--primary-50))] px-2 py-0.5 text-[11px] font-normal text-[hsl(var(--primary-700))]",children:"OTS"}),e.hasOss?(0,s.jsx)(b.Badge,{variant:"secondary",className:"rounded-md border-0 bg-[hsl(var(--primary-50))] px-2 py-0.5 text-[11px] font-normal text-[hsl(var(--primary-700))]",children:"OSS"}):null]}),(0,s.jsx)("div",{className:"my-4 h-px bg-[hsl(var(--border))]"}),r?(0,s.jsxs)(j.Button,{size:"sm",variant:"secondary",disabled:!0,className:(0,k.cn)("w-full justify-center gap-2","bg-[hsl(var(--primary-50))] text-[hsl(var(--primary-700))]","disabled:opacity-100"),children:[(0,s.jsx)(p.Check,{className:"h-3.5 w-3.5"}),"当前项目"]}):(0,s.jsxs)(j.Button,{size:"sm",variant:"default",disabled:a,onClick:i,className:"w-full justify-center gap-2",children:[(0,s.jsx)(x,{className:"h-3.5 w-3.5"}),a?"切换中...":"切换为当前"]})]})]})}var D=e.i(799877);e.s(["default",0,function(){let e=(0,a.useRouter)(),{data:h,isLoading:x}=(0,m.useInstances)(),p=(0,m.useSwitchInstance)(),f=(0,m.useDeleteInstance)(),g=(0,m.useExportInstanceToken)(),[v,y]=(0,r.useState)(!1),[b,N]=(0,r.useState)(null),[w,k]=(0,r.useState)(null),S=h?.activeInstance??null,I=(h?.instances??[]).filter(e=>!e.isDefaultFallback);async function M(s){s!==S&&(await p.mutateAsync(s),e.refresh())}async function E(e){let s=await g.mutateAsync(e);try{await navigator.clipboard.writeText(s.token),i.toast.success(`已复制 ${e} 的 Token`)}catch{i.toast.message("请手动复制 Token",{description:s.token})}}async function B(){w&&(await f.mutateAsync(w),k(null),e.refresh())}return(0,s.jsxs)("div",{className:"space-y-6",children:[(0,s.jsx)(l.PageHeader,{title:"项目管理",description:"连接、切换与管理多个项目",children:(0,s.jsxs)(j.Button,{onClick:()=>y(!0),children:[(0,s.jsx)(n.Plus,{className:"mr-2 h-4 w-4"}),"创建新项目"]})}),x?(0,s.jsx)("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:Array.from({length:3}).map((e,r)=>(0,s.jsx)(d.Skeleton,{className:"h-[200px] rounded-lg",delay:80*r},r))}):0===I.length?(0,s.jsx)(D.EmptyState,{icon:t.Database,title:"还没有项目",description:"创建你的第一个项目,解锁多环境切换",action:(0,s.jsxs)(j.Button,{onClick:()=>y(!0),children:[(0,s.jsx)(n.Plus,{className:"mr-2 h-4 w-4"}),"创建新项目"]})}):(0,s.jsx)("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:I.map((e,r)=>{let a=e.name===S;return(0,s.jsx)(C,{item:e,isActive:a,isSwitching:p.isPending,isExporting:g.isPending,onSwitch:()=>M(e.name),onEdit:()=>N(e.name),onExport:()=>E(e.name),onDelete:()=>k(e.name),index:r},e.name)})}),(0,s.jsx)(o.ConnectInstanceDialog,{open:v,onOpenChange:y,onSuccess:()=>e.refresh()}),(0,s.jsx)(u,{name:b,open:!!b,onOpenChange:e=>{e||N(null)},onSuccess:()=>e.refresh()}),(0,s.jsx)(c.Dialog,{open:!!w,onOpenChange:e=>{e||k(null)},children:(0,s.jsxs)(c.DialogContent,{children:[(0,s.jsxs)(c.DialogHeader,{children:[(0,s.jsx)(c.DialogTitle,{children:"删除项目"}),(0,s.jsxs)(c.DialogDescription,{children:['确定要删除项目 "',w,'" 吗?此操作只影响本地配置,不会删除云端资源。']})]}),(0,s.jsxs)(c.DialogFooter,{children:[(0,s.jsx)(j.Button,{variant:"outline",onClick:()=>k(null),children:"取消"}),(0,s.jsx)(j.Button,{variant:"destructive",disabled:f.isPending,onClick:B,children:f.isPending?"删除中...":"确认删除"})]})]})})]})}],221070)}]);
@@ -18,9 +18,14 @@ export const dynamic = "force-dynamic";
18
18
  * broken dashboard.
19
19
  */
20
20
  function hasUsableCredentials(): boolean {
21
+ // A credential is either the AK/SK pair or an API Key; both need an
22
+ // endpoint + instance name to be usable.
23
+ const hasEnvCredential =
24
+ (!!process.env.TABLESTORE_ACCESS_KEY_ID &&
25
+ !!process.env.TABLESTORE_ACCESS_KEY_SECRET) ||
26
+ !!process.env.TABLESTORE_API_KEY;
21
27
  const envConfigured =
22
- !!process.env.TABLESTORE_ACCESS_KEY_ID &&
23
- !!process.env.TABLESTORE_ACCESS_KEY_SECRET &&
28
+ hasEnvCredential &&
24
29
  !!process.env.TABLESTORE_ENDPOINT &&
25
30
  !!process.env.TABLESTORE_INSTANCE_NAME;
26
31
  if (envConfigured) return true;
@@ -1,8 +1,8 @@
1
1
  "use client";
2
2
 
3
- import { useMemo, useState } from "react";
3
+ import { Fragment, useMemo, useState } from "react";
4
4
  import { useParams, useRouter, useSearchParams } from "next/navigation";
5
- import { Plus, Sparkles } from "lucide-react";
5
+ import { ChevronDown, ChevronRight, Plus, Sparkles } from "lucide-react";
6
6
 
7
7
  import { Button } from "@/components/ui/button";
8
8
  import { Skeleton } from "@/components/ui/skeleton";
@@ -25,7 +25,7 @@ import { RefreshButton } from "@/components/shared/refresh-button";
25
25
  import { EmptyState } from "@/components/shared/empty-state";
26
26
  import { RelativeTime } from "@/components/shared/relative-time";
27
27
  import { useDreamTasks } from "@/hooks/use-dream-tasks";
28
- import { buildMemoryScope } from "@/lib/memory";
28
+ import { buildMemoryScope, groupDreamTasksByScope } from "@/lib/memory";
29
29
  import type { DreamTask, DreamTaskStatus, DreamTaskType, MemoryScope } from "@/types/memory";
30
30
  import { MemoryDreamDisabled } from "@/components/memory/memory-dream-disabled";
31
31
  import { MemoryDreamCreateDialog } from "@/components/memory/memory-dream-create-dialog";
@@ -125,24 +125,108 @@ export default function DreamTasksPage() {
125
125
  );
126
126
  const [status, setStatus] = useState<string>("all");
127
127
  const [createOpen, setCreateOpen] = useState(false);
128
- const [nextToken, setNextToken] = useState<string | undefined>(undefined);
128
+ const [collapsed, setCollapsed] = useState<ReadonlySet<string>>(new Set());
129
129
 
130
130
  const query = useDreamTasks(memoryStoreName, scope, {
131
131
  limit: 50,
132
- nextToken,
133
132
  status: status === "all" ? undefined : status,
134
133
  });
135
134
 
136
- const isDreamingDisabled =
137
- query.error instanceof Error &&
138
- "code" in query.error &&
139
- (query.error as { code?: string }).code === "DREAMING_DISABLED";
140
-
141
- if (isDreamingDisabled) {
135
+ if (query.errorCode === "DREAMING_DISABLED") {
142
136
  return <MemoryDreamDisabled />;
143
137
  }
144
138
 
145
- const tasks = (query.data?.items ?? []) as DreamTask[];
139
+ const tasks = query.tasks;
140
+ // The Dream list API returns tasks scope-major (createdAt desc within a
141
+ // scope, but not globally). The hook eagerly loads every page; group the
142
+ // full set by scope so each block reads cleanly newest-first, and fall back
143
+ // to a flat list when there is only one scope.
144
+ const groups = groupDreamTasksByScope(tasks);
145
+ const showGroups = groups.length > 1;
146
+
147
+ const toggleGroup = (key: string) => {
148
+ setCollapsed((prev) => {
149
+ const next = new Set(prev);
150
+ if (next.has(key)) next.delete(key);
151
+ else next.add(key);
152
+ return next;
153
+ });
154
+ };
155
+
156
+ const renderTaskRow = (task: DreamTask) => {
157
+ const createdMs = new Date(task.createdAt).getTime();
158
+ return (
159
+ <TableRow
160
+ key={task.dreamId}
161
+ className="cursor-pointer hover:bg-[hsl(var(--accent))]"
162
+ onClick={() =>
163
+ router.push(
164
+ `/memory/${encodeURIComponent(memoryStoreName)}/dream/${encodeURIComponent(task.dreamId)}`,
165
+ )
166
+ }
167
+ >
168
+ <TableCell className="max-w-[220px] truncate font-mono text-xs">
169
+ {task.dreamId}
170
+ </TableCell>
171
+ <TableCell>
172
+ {(() => {
173
+ const tt = (task.taskType || "memory") as DreamTaskType;
174
+ return (
175
+ <span
176
+ className={cn(
177
+ "inline-flex rounded-full px-2 py-0.5 text-xs font-medium whitespace-nowrap",
178
+ TASK_TYPE_CLASS[tt] ?? "bg-muted text-muted-foreground",
179
+ )}
180
+ >
181
+ {TASK_TYPE_LABEL[tt] ?? tt}
182
+ </span>
183
+ );
184
+ })()}
185
+ </TableCell>
186
+ <TableCell>
187
+ <StatusPill status={task.status} />
188
+ </TableCell>
189
+ <TableCell className="text-xs">
190
+ {(task.taskType && task.taskType !== "memory") ? (
191
+ <span className="text-muted-foreground">—</span>
192
+ ) : (
193
+ <>
194
+ {task.applyMode === "safe_auto" ? "自动" : "建议"}
195
+ {task.scopeOutputMode === "promote_scope" && (
196
+ <span className="ml-1 text-muted-foreground">· 提升</span>
197
+ )}
198
+ </>
199
+ )}
200
+ </TableCell>
201
+ <TableCell className="text-right text-xs text-muted-foreground">
202
+ <span className="font-medium text-foreground">
203
+ {task.actionCount ?? 0}
204
+ </span>
205
+ {(task.taskType && task.taskType !== "memory") ? (
206
+ <span className="ml-1">
207
+ 条产出
208
+ {(task.failedCount ?? 0) > 0 && (
209
+ <span className="text-danger"> / {task.failedCount} 败</span>
210
+ )}
211
+ </span>
212
+ ) : (
213
+ <span className="ml-1">
214
+ ({task.proposedCount ?? 0} 待 / {task.appliedCount ?? 0} 应用 /
215
+ {" "}
216
+ {task.skippedCount ?? 0} 跳 / {task.failedCount ?? 0} 败)
217
+ </span>
218
+ )}
219
+ </TableCell>
220
+ <TableCell className="text-xs text-muted-foreground">
221
+ {Number.isFinite(createdMs) ? (
222
+ <RelativeTime timestamp={createdMs} />
223
+ ) : (
224
+ task.createdAt
225
+ )}
226
+ </TableCell>
227
+ </TableRow>
228
+ );
229
+ };
146
230
 
147
231
  return (
148
232
  <div className="space-y-4">
@@ -213,99 +297,63 @@ export default function DreamTasksPage() {
213
297
  </TableRow>
214
298
  </TableHeader>
215
299
  <TableBody>
216
- {tasks.map((task) => {
217
- const createdMs = new Date(task.createdAt).getTime();
218
- return (
219
- <TableRow
220
- key={task.dreamId}
221
- className="cursor-pointer hover:bg-[hsl(var(--accent))]"
222
- onClick={() =>
223
- router.push(
224
- `/memory/${encodeURIComponent(memoryStoreName)}/dream/${encodeURIComponent(task.dreamId)}`,
225
- )
226
- }
227
- >
228
- <TableCell className="max-w-[220px] truncate font-mono text-xs">
229
- {task.dreamId}
230
- </TableCell>
231
- <TableCell>
232
- {(() => {
233
- const tt = (task.taskType || "memory") as DreamTaskType;
234
- return (
235
- <span
236
- className={cn(
237
- "inline-flex rounded-full px-2 py-0.5 text-xs font-medium whitespace-nowrap",
238
- TASK_TYPE_CLASS[tt] ?? "bg-muted text-muted-foreground",
239
- )}
240
- >
241
- {TASK_TYPE_LABEL[tt] ?? tt}
242
- </span>
243
- );
244
- })()}
245
- </TableCell>
246
- <TableCell>
247
- <StatusPill status={task.status} />
248
- </TableCell>
249
- <TableCell className="text-xs">
250
- {(task.taskType && task.taskType !== "memory") ? (
251
- <span className="text-muted-foreground">—</span>
252
- ) : (
253
- <>
254
- {task.applyMode === "safe_auto" ? "自动" : "建议"}
255
- {task.scopeOutputMode === "promote_scope" && (
256
- <span className="ml-1 text-muted-foreground">· 提升</span>
257
- )}
258
- </>
259
- )}
260
- </TableCell>
261
- <TableCell className="text-right text-xs text-muted-foreground">
262
- <span className="font-medium text-foreground">
263
- {task.actionCount ?? 0}
264
- </span>
265
- {(task.taskType && task.taskType !== "memory") ? (
266
- <span className="ml-1">
267
- 条产出
268
- {(task.failedCount ?? 0) > 0 && (
269
- <span className="text-danger"> / {task.failedCount} 败</span>
270
- )}
271
- </span>
272
- ) : (
273
- <span className="ml-1">
274
- ({task.proposedCount ?? 0} 待 / {task.appliedCount ?? 0} 应用 /
275
- {" "}
276
- {task.skippedCount ?? 0} 跳 / {task.failedCount ?? 0} 败)
277
- </span>
278
- )}
279
- </TableCell>
280
- <TableCell className="text-xs text-muted-foreground">
281
- {Number.isFinite(createdMs) ? (
282
- <RelativeTime timestamp={createdMs} />
283
- ) : (
284
- task.createdAt
285
- )}
286
- </TableCell>
287
- </TableRow>
288
- );
289
- })}
300
+ {showGroups
301
+ ? groups.map((group) => {
302
+ const isCollapsed = collapsed.has(group.key);
303
+ return (
304
+ <Fragment key={group.key}>
305
+ <TableRow
306
+ className="cursor-pointer select-none bg-muted/40 hover:bg-muted/60"
307
+ onClick={() => toggleGroup(group.key)}
308
+ >
309
+ <TableCell colSpan={6} className="py-2">
310
+ <div className="flex items-center gap-2">
311
+ {isCollapsed ? (
312
+ <ChevronRight className="h-3.5 w-3.5 shrink-0 text-muted-foreground" />
313
+ ) : (
314
+ <ChevronDown className="h-3.5 w-3.5 shrink-0 text-muted-foreground" />
315
+ )}
316
+ <span className="break-all font-mono text-xs font-medium text-foreground">
317
+ {group.label}
318
+ </span>
319
+ <span className="shrink-0 rounded-full bg-muted px-2 py-0.5 text-[11px] text-muted-foreground">
320
+ {group.tasks.length} 个任务
321
+ </span>
322
+ </div>
323
+ </TableCell>
324
+ </TableRow>
325
+ {!isCollapsed && group.tasks.map(renderTaskRow)}
326
+ </Fragment>
327
+ );
328
+ })
329
+ : tasks.map(renderTaskRow)}
290
330
  </TableBody>
291
331
  </Table>
292
332
  </div>
293
333
  )}
294
334
 
295
- {query.data?.nextToken && (
296
- <div className="flex justify-end">
335
+ {query.isFetchingNextPage && (
336
+ <p className="text-center text-xs text-muted-foreground">
337
+ 正在加载更多任务…
338
+ </p>
339
+ )}
340
+
341
+ {query.truncated && !query.isFetchingNextPage && (
342
+ <div className="flex items-center justify-center gap-2 text-xs text-muted-foreground">
343
+ <span>任务较多,已先加载一部分</span>
297
344
  <Button
298
345
  variant="outline"
299
346
  size="sm"
300
- onClick={() => setNextToken(query.data?.nextToken)}
347
+ onClick={() => query.fetchNextPage()}
301
348
  >
302
- 加载下一页
349
+ 继续加载
303
350
  </Button>
304
351
  </div>
305
352
  )}
306
353
 
307
354
  <p className="text-xs text-muted-foreground">
308
355
  当前过滤 scope:{scopeLabel(scope)}
356
+ {showGroups && " · 已按 scope 分组,组内按创建时间倒序(新→旧)"}
309
357
  </p>
310
358
 
311
359
  <MemoryDreamCreateDialog
@@ -67,6 +67,7 @@ export async function GET(_request: NextRequest, context: RouteContext) {
67
67
  accessKeySecretMasked: detail.access_key_secret
68
68
  ? maskSecret(detail.access_key_secret)
69
69
  : undefined,
70
+ apiKeyMasked: detail.api_key ? maskSecret(detail.api_key) : undefined,
70
71
  memoryDefaults: {
71
72
  storeName: detail.memory_store_name || undefined,
72
73
  appId: detail.memory_app_id || undefined,
@@ -111,6 +112,7 @@ export async function PUT(request: NextRequest, context: RouteContext) {
111
112
  const d = parsed.data;
112
113
  if (d.accessKeyId) patch.access_key_id = d.accessKeyId;
113
114
  if (d.accessKeySecret) patch.access_key_secret = d.accessKeySecret;
115
+ if (d.apiKey) patch.api_key = d.apiKey;
114
116
  if (d.otsEndpoint) patch.ots_endpoint = d.otsEndpoint;
115
117
  if (d.otsInstanceName) patch.ots_instance_name = d.otsInstanceName;
116
118
  if (d.ossEndpoint !== undefined) patch.oss_endpoint = d.ossEndpoint;
@@ -128,6 +130,7 @@ export async function PUT(request: NextRequest, context: RouteContext) {
128
130
  const token = encodeTokenV2({
129
131
  access_key_id: updated.access_key_id,
130
132
  access_key_secret: updated.access_key_secret,
133
+ api_key: updated.api_key,
131
134
  ots_endpoint: updated.ots_endpoint || ots.ots_endpoint,
132
135
  ots_instance_name:
133
136
  updated.ots_instance_name || ots.ots_instance_name,
@@ -67,6 +67,7 @@ export async function GET(_request: NextRequest, context: RouteContext) {
67
67
  const token = encodeTokenV2({
68
68
  access_key_id: detail.access_key_id,
69
69
  access_key_secret: detail.access_key_secret,
70
+ api_key: detail.api_key,
70
71
  ots_endpoint: detail.ots_endpoint,
71
72
  ots_instance_name: detail.ots_instance_name,
72
73
  oss_endpoint: effectiveOssEndpoint,
@@ -65,6 +65,7 @@ export async function POST(_request: NextRequest, context: RouteContext) {
65
65
  const token = encodeTokenV2({
66
66
  access_key_id: detail.access_key_id,
67
67
  access_key_secret: detail.access_key_secret,
68
+ api_key: detail.api_key,
68
69
  ots_endpoint: detail.ots_endpoint || ots.ots_endpoint,
69
70
  ots_instance_name: detail.ots_instance_name || ots.ots_instance_name,
70
71
  oss_endpoint: detail.oss_endpoint || oss.oss_endpoint,
@@ -131,6 +131,7 @@ export async function POST(request: NextRequest) {
131
131
  const effective = loadConfig();
132
132
  const tokenFields = {
133
133
  ...fields,
134
+ api_key: fields.api_key || "",
134
135
  oss_endpoint: effective.oss_endpoint || fields.oss_endpoint || "",
135
136
  oss_bucket_name:
136
137
  effective.oss_bucket_name || fields.oss_bucket_name || "",
@@ -184,6 +185,7 @@ function createFromFields(raw: unknown): CreationPlan | NextResponse {
184
185
  fields: stripEmpty({
185
186
  access_key_id: data.accessKeyId,
186
187
  access_key_secret: data.accessKeySecret,
188
+ api_key: data.apiKey,
187
189
  ots_endpoint: data.otsEndpoint,
188
190
  ots_instance_name: data.otsInstanceName,
189
191
  oss_endpoint: data.ossEndpoint,
@@ -7,9 +7,10 @@ import { Info } from "lucide-react";
7
7
  import { z } from "zod";
8
8
 
9
9
  import {
10
- connectInstanceSchema,
10
+ connectInstanceBaseSchema,
11
11
  editInstanceFormSchema,
12
12
  importInstanceSchema,
13
+ withCredentialModeRules,
13
14
  } from "@/schemas/instance";
14
15
  import { Button } from "@/components/ui/button";
15
16
  import {
@@ -44,15 +45,17 @@ import { stripBucketPrefix } from "@/lib/normalize-oss-endpoint";
44
45
  * which the server-side schema cannot assert because tokens may ship bare
45
46
  * endpoints — is layered on via `.extend(...)` instead of a parallel copy.
46
47
  */
47
- const connectFormSchema = connectInstanceSchema.extend({
48
- otsEndpoint: z.string().trim().url("请输入合法的 OTS Endpoint URL"),
49
- ossEndpoint: z
50
- .string()
51
- .trim()
52
- .url("请输入合法的 OSS Endpoint URL")
53
- .optional()
54
- .or(z.literal("")),
55
- });
48
+ const connectFormSchema = withCredentialModeRules(
49
+ connectInstanceBaseSchema.extend({
50
+ otsEndpoint: z.string().trim().url("请输入合法的 OTS Endpoint URL"),
51
+ ossEndpoint: z
52
+ .string()
53
+ .trim()
54
+ .url("请输入合法的 OSS Endpoint URL")
55
+ .optional()
56
+ .or(z.literal("")),
57
+ }),
58
+ );
56
59
 
57
60
  // Token tab only needs the `token` field; omit everything else so the
58
61
  // submit handler receives a clean `{ token }` shape.
@@ -81,6 +84,10 @@ export interface ConnectInstanceFormProps {
81
84
  * placeholder so users can see "something is set" without exposing it.
82
85
  */
83
86
  accessKeySecretPlaceholder?: string;
87
+ /**
88
+ * Edit-mode hint: masked API Key surfaced as the input placeholder.
89
+ */
90
+ apiKeyPlaceholder?: string;
84
91
  onSubmit: (
85
92
  values: ConnectInstancePayload | ImportInstancePayload,
86
93
  ) => Promise<void>;
@@ -96,6 +103,7 @@ export function ConnectInstanceForm({
96
103
  defaultValues,
97
104
  accessKeyIdPlaceholder,
98
105
  accessKeySecretPlaceholder,
106
+ apiKeyPlaceholder,
99
107
  onSubmit,
100
108
  busy,
101
109
  lockName,
@@ -142,6 +150,8 @@ export function ConnectInstanceForm({
142
150
  // users still get the "something is set" affordance.
143
151
  accessKeyId: isEdit ? "" : (defaultValues?.accessKeyId ?? ""),
144
152
  accessKeySecret: isEdit ? "" : (defaultValues?.accessKeySecret ?? ""),
153
+ // Same masked-placeholder treatment as AK/SK in edit mode.
154
+ apiKey: isEdit ? "" : (defaultValues?.apiKey ?? ""),
145
155
  otsEndpoint: defaultValues?.otsEndpoint ?? "",
146
156
  otsInstanceName: defaultValues?.otsInstanceName ?? "",
147
157
  ossEndpoint: defaultValues?.ossEndpoint ?? "",
@@ -332,6 +342,35 @@ export function ConnectInstanceForm({
332
342
  />
333
343
  </div>
334
344
 
345
+ <FormField
346
+ control={manualForm.control}
347
+ name="apiKey"
348
+ render={({ field }) => (
349
+ <FormItem>
350
+ <FormLabel>API Key(可选)</FormLabel>
351
+ <FormControl>
352
+ <Input
353
+ {...field}
354
+ type="password"
355
+ autoComplete="new-password"
356
+ disabled={busy}
357
+ placeholder={
358
+ isEdit && apiKeyPlaceholder
359
+ ? `${apiKeyPlaceholder} · 留空表示保留`
360
+ : "sk-..."
361
+ }
362
+ />
363
+ </FormControl>
364
+ <FormDescription>
365
+ 可替代 AccessKey 作为数据面访问凭证;同时填写时 API Key 优先。
366
+ 需 HTTPS 端点,且无法自动创建实例 / 使用 OSS 上传(那些仍需
367
+ AK/SK)。
368
+ </FormDescription>
369
+ <FormMessage />
370
+ </FormItem>
371
+ )}
372
+ />
373
+
335
374
  <div className="grid gap-4 sm:grid-cols-2">
336
375
  <FormField
337
376
  control={manualForm.control}
@@ -49,8 +49,14 @@ export function EditInstanceDialog({
49
49
  const sk = manual.accessKeySecret?.trim() ?? "";
50
50
  const credentialPatch =
51
51
  ak && sk ? { accessKeyId: ak, accessKeySecret: sk } : {};
52
+ // API Key follows the same "blank = keep existing" rule: only forward it
53
+ // when the user typed a new value, so we never overwrite the stored key
54
+ // with an empty string.
55
+ const apiKey = manual.apiKey?.trim() ?? "";
56
+ const apiKeyPatch = apiKey ? { apiKey } : {};
52
57
  const patch: UpdateInstancePayload = {
53
58
  ...credentialPatch,
59
+ ...apiKeyPatch,
54
60
  otsEndpoint: manual.otsEndpoint,
55
61
  otsInstanceName: manual.otsInstanceName,
56
62
  // The form normalizes empty inputs to `undefined` (optional field).
@@ -107,6 +113,7 @@ export function EditInstanceDialog({
107
113
  // is currently configured.
108
114
  accessKeyId: "",
109
115
  accessKeySecret: "",
116
+ apiKey: "",
110
117
  otsEndpoint: detail.otsEndpoint ?? "",
111
118
  otsInstanceName: detail.otsInstanceName ?? "",
112
119
  ossEndpoint: detail.ossEndpoint ?? "",
@@ -115,6 +122,7 @@ export function EditInstanceDialog({
115
122
  }}
116
123
  accessKeyIdPlaceholder={detail.accessKeyIdMasked}
117
124
  accessKeySecretPlaceholder={detail.accessKeySecretMasked}
125
+ apiKeyPlaceholder={detail.apiKeyMasked}
118
126
  onSubmit={handleSubmit}
119
127
  submitLabel="保存修改"
120
128
  />