@tablestore/tablestore-agent-cli 0.2.11 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/dashboard.d.ts.map +1 -1
- package/dist/commands/dashboard.js +3 -0
- package/dist/commands/dashboard.js.map +1 -1
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +10 -11
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/memory-items.d.ts +3 -0
- package/dist/commands/memory-items.d.ts.map +1 -0
- package/dist/commands/memory-items.js +375 -0
- package/dist/commands/memory-items.js.map +1 -0
- package/dist/commands/memory.d.ts.map +1 -1
- package/dist/commands/memory.js +135 -196
- package/dist/commands/memory.js.map +1 -1
- package/dist/dashboard-runtime/dashboard/.next/BUILD_ID +1 -1
- package/dist/dashboard-runtime/dashboard/.next/app-path-routes-manifest.json +11 -0
- package/dist/dashboard-runtime/dashboard/.next/build-manifest.json +3 -3
- package/dist/dashboard-runtime/dashboard/.next/prerender-manifest.json +3 -3
- package/dist/dashboard-runtime/dashboard/.next/required-server-files.json +4 -4
- package/dist/dashboard-runtime/dashboard/.next/routes-manifest.json +86 -0
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/api-keys/page.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/api-keys/page_client-reference-manifest.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/chat/page.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/chat/page_client-reference-manifest.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/knowledge-base/[name]/documents/page.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/knowledge-base/[name]/documents/page_client-reference-manifest.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/knowledge-base/[name]/page.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/knowledge-base/[name]/page_client-reference-manifest.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/knowledge-base/[name]/qa/page.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/knowledge-base/[name]/qa/page_client-reference-manifest.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/knowledge-base/[name]/retrieval/page.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/knowledge-base/[name]/retrieval/page_client-reference-manifest.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/knowledge-base/[name]/settings/page.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/knowledge-base/[name]/settings/page_client-reference-manifest.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/knowledge-base/create/page.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/knowledge-base/create/page_client-reference-manifest.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/knowledge-base/page.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/knowledge-base/page_client-reference-manifest.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/llm-providers/[id]/page.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/llm-providers/[id]/page_client-reference-manifest.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/llm-providers/new/page.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/llm-providers/new/page_client-reference-manifest.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/llm-providers/page.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/llm-providers/page_client-reference-manifest.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/dream/[dreamId]/page.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/dream/[dreamId]/page_client-reference-manifest.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/dream/page.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/dream/page_client-reference-manifest.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/messages/page.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/messages/page_client-reference-manifest.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/page.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/page_client-reference-manifest.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/requests/page.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/requests/page_client-reference-manifest.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/scope/page/app-paths-manifest.json +3 -0
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/scope/page/build-manifest.json +18 -0
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/scope/page/next-font-manifest.json +8 -0
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/scope/page/react-loadable-manifest.json +1 -0
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/scope/page/server-reference-manifest.json +4 -0
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/scope/page.js +23 -0
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/scope/page.js.map +5 -0
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/scope/page.js.nft.json +1 -0
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/scope/page_client-reference-manifest.js +3 -0
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/search/page.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/search/page_client-reference-manifest.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/settings/page.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/settings/page_client-reference-manifest.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/tasks/page.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/tasks/page_client-reference-manifest.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/units/page.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/units/page_client-reference-manifest.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/wiki/page/app-paths-manifest.json +3 -0
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/wiki/page/build-manifest.json +18 -0
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/wiki/page/next-font-manifest.json +8 -0
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/wiki/page/react-loadable-manifest.json +1 -0
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/wiki/page/server-reference-manifest.json +4 -0
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/wiki/page.js +23 -0
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/wiki/page.js.map +5 -0
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/wiki/page.js.nft.json +1 -0
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/[store]/wiki/page_client-reference-manifest.js +3 -0
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/create/page.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/create/page_client-reference-manifest.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/page.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/memory/page_client-reference-manifest.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/projects/page.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/(dashboard)/projects/page_client-reference-manifest.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/_global-error.html +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/_global-error.rsc +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/_not-found.html +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/_not-found.rsc +16 -16
- package/dist/dashboard-runtime/dashboard/.next/server/app/_not-found.segments/_full.segment.rsc +16 -16
- package/dist/dashboard-runtime/dashboard/.next/server/app/_not-found.segments/_head.segment.rsc +3 -3
- package/dist/dashboard-runtime/dashboard/.next/server/app/_not-found.segments/_index.segment.rsc +11 -11
- package/dist/dashboard-runtime/dashboard/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +4 -4
- package/dist/dashboard-runtime/dashboard/.next/server/app/_not-found.segments/_not-found.segment.rsc +3 -3
- package/dist/dashboard-runtime/dashboard/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/api-keys/[id]/custom-policy/route.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/api-keys/[id]/custom-policy/route.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/api-keys/[id]/effective-permissions/route.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/api-keys/[id]/effective-permissions/route.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/api-keys/[id]/policies/route.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/api-keys/[id]/policies/route.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/api-keys/[id]/route.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/api-keys/[id]/route.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/api-keys/filter-by-permission/route.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/api-keys/filter-by-permission/route.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/api-keys/route.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/api-keys/route.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/auth/status/route.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/auth/status/route.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/auth/token/route.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/auth/token/route.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/instances/[name]/route.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/instances/[name]/route.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/instances/[name]/token/route.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/instances/[name]/token/route.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/instances/[name]/use/route.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/instances/[name]/use/route.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/instances/connectivity/route/app-paths-manifest.json +3 -0
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/instances/connectivity/route/build-manifest.json +9 -0
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/instances/connectivity/route/server-reference-manifest.json +4 -0
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/instances/connectivity/route.js +6 -0
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/instances/connectivity/route.js.map +5 -0
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/instances/connectivity/route.js.nft.json +1 -0
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/instances/connectivity/route_client-reference-manifest.js +3 -0
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/instances/route.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/instances/route.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/knowledge-bases/[name]/chunks/route.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/knowledge-bases/[name]/chunks/route.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/knowledge-bases/[name]/documents/[docId]/chunks/route.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/knowledge-bases/[name]/documents/[docId]/chunks/route.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/knowledge-bases/[name]/documents/[docId]/route.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/knowledge-bases/[name]/documents/[docId]/route.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/knowledge-bases/[name]/documents/route.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/knowledge-bases/[name]/documents/route.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/knowledge-bases/[name]/documents/upload/route.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/knowledge-bases/[name]/documents/upload/route.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/knowledge-bases/[name]/retrieve/route.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/knowledge-bases/[name]/retrieve/route.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/knowledge-bases/[name]/route.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/knowledge-bases/[name]/route.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/knowledge-bases/route.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/knowledge-bases/route.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/llm/chat/route.js +2 -2
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/llm/chat/route.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/llm/providers/[id]/models/route.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/llm/providers/[id]/models/route.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/llm/providers/[id]/route.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/llm/providers/[id]/route.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/llm/providers/[id]/test/route.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/llm/providers/[id]/test/route.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/llm/providers/route.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/llm/providers/route.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/logs/client/route.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/logs/client/route.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/dream-kb-sync/route.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/dream-kb-sync/route.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/dream-tasks/[dreamId]/actions/apply/route.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/dream-tasks/[dreamId]/actions/apply/route.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/dream-tasks/[dreamId]/actions/route.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/dream-tasks/[dreamId]/actions/route.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/dream-tasks/[dreamId]/cancel/route.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/dream-tasks/[dreamId]/cancel/route.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/dream-tasks/[dreamId]/route.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/dream-tasks/[dreamId]/route.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/dream-tasks/route.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/dream-tasks/route.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/file-memory/[action]/route.js +2 -2
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/file-memory/[action]/route.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/messages/route.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/messages/route.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/requests/route.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/requests/route.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/route.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/route.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/scopes/route.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/scopes/route.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/search/route.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/search/route.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/tasks/[requestId]/route.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/tasks/[requestId]/route.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/tasks/route.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/tasks/route.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/units/[memoryId]/route.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/units/[memoryId]/route.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/units/route.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/units/route.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/wikis/artifacts/route/app-paths-manifest.json +3 -0
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/wikis/artifacts/route/build-manifest.json +9 -0
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/wikis/artifacts/route/server-reference-manifest.json +4 -0
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/wikis/artifacts/route.js +6 -0
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/wikis/artifacts/route.js.map +5 -0
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/wikis/artifacts/route.js.nft.json +1 -0
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/wikis/artifacts/route_client-reference-manifest.js +3 -0
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/wikis/ingest/route/app-paths-manifest.json +3 -0
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/wikis/ingest/route/build-manifest.json +9 -0
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/wikis/ingest/route/server-reference-manifest.json +4 -0
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/wikis/ingest/route.js +6 -0
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/wikis/ingest/route.js.map +5 -0
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/wikis/ingest/route.js.nft.json +1 -0
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/wikis/ingest/route_client-reference-manifest.js +3 -0
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/wikis/page/route/app-paths-manifest.json +3 -0
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/wikis/page/route/build-manifest.json +9 -0
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/wikis/page/route/server-reference-manifest.json +4 -0
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/wikis/page/route.js +6 -0
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/wikis/page/route.js.map +5 -0
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/wikis/page/route.js.nft.json +1 -0
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/wikis/page/route_client-reference-manifest.js +3 -0
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/wikis/pages/route/app-paths-manifest.json +3 -0
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/wikis/pages/route/build-manifest.json +9 -0
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/wikis/pages/route/server-reference-manifest.json +4 -0
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/wikis/pages/route.js +6 -0
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/wikis/pages/route.js.map +5 -0
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/wikis/pages/route.js.nft.json +1 -0
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/wikis/pages/route_client-reference-manifest.js +3 -0
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/wikis/route/app-paths-manifest.json +3 -0
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/wikis/route/build-manifest.json +9 -0
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/wikis/route/server-reference-manifest.json +4 -0
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/wikis/route.js +6 -0
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/wikis/route.js.map +5 -0
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/wikis/route.js.nft.json +1 -0
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/wikis/route_client-reference-manifest.js +3 -0
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/wikis/search/route/app-paths-manifest.json +3 -0
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/wikis/search/route/build-manifest.json +9 -0
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/wikis/search/route/server-reference-manifest.json +4 -0
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/wikis/search/route.js +6 -0
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/wikis/search/route.js.map +5 -0
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/wikis/search/route.js.nft.json +1 -0
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/wikis/search/route_client-reference-manifest.js +3 -0
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/wikis/source/route/app-paths-manifest.json +3 -0
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/wikis/source/route/build-manifest.json +9 -0
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/wikis/source/route/server-reference-manifest.json +4 -0
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/wikis/source/route.js +6 -0
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/wikis/source/route.js.map +5 -0
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/wikis/source/route.js.nft.json +1 -0
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/wikis/source/route_client-reference-manifest.js +3 -0
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/wikis/sources/route/app-paths-manifest.json +3 -0
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/wikis/sources/route/build-manifest.json +9 -0
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/wikis/sources/route/server-reference-manifest.json +4 -0
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/wikis/sources/route.js +6 -0
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/wikis/sources/route.js.map +5 -0
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/wikis/sources/route.js.nft.json +1 -0
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/[store]/wikis/sources/route_client-reference-manifest.js +3 -0
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/route.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/memory/stores/route.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/oss/list/route.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/oss/list/route.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/runtime/context/route.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/api/v1/runtime/context/route.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/index.html +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/index.rsc +15 -15
- package/dist/dashboard-runtime/dashboard/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
- package/dist/dashboard-runtime/dashboard/.next/server/app/index.segments/_full.segment.rsc +15 -15
- package/dist/dashboard-runtime/dashboard/.next/server/app/index.segments/_head.segment.rsc +3 -3
- package/dist/dashboard-runtime/dashboard/.next/server/app/index.segments/_index.segment.rsc +11 -11
- package/dist/dashboard-runtime/dashboard/.next/server/app/index.segments/_tree.segment.rsc +2 -2
- package/dist/dashboard-runtime/dashboard/.next/server/app/onboarding/page.js.nft.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/onboarding/page_client-reference-manifest.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/onboarding.html +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app/onboarding.rsc +18 -18
- package/dist/dashboard-runtime/dashboard/.next/server/app/onboarding.segments/_full.segment.rsc +18 -18
- package/dist/dashboard-runtime/dashboard/.next/server/app/onboarding.segments/_head.segment.rsc +3 -3
- package/dist/dashboard-runtime/dashboard/.next/server/app/onboarding.segments/_index.segment.rsc +11 -11
- package/dist/dashboard-runtime/dashboard/.next/server/app/onboarding.segments/_tree.segment.rsc +2 -2
- package/dist/dashboard-runtime/dashboard/.next/server/app/onboarding.segments/onboarding/__PAGE__.segment.rsc +4 -4
- package/dist/dashboard-runtime/dashboard/.next/server/app/onboarding.segments/onboarding.segment.rsc +4 -4
- package/dist/dashboard-runtime/dashboard/.next/server/app/page_client-reference-manifest.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/app-paths-manifest.json +11 -0
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/0e95__next-internal_server_app_api_v1_instances_connectivity_route_actions_0hc.k~w.js +3 -0
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/0ndq_server_app_api_v1_memory_stores_[store]_wikis_artifacts_route_actions_0doape5.js +3 -0
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/0ndq_server_app_api_v1_memory_stores_[store]_wikis_ingest_route_actions_0ppwgam.js +3 -0
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/0ndq_server_app_api_v1_memory_stores_[store]_wikis_page_route_actions_0odivj9.js +3 -0
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/0ndq_server_app_api_v1_memory_stores_[store]_wikis_pages_route_actions_0s15y9a.js +3 -0
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/0ndq_server_app_api_v1_memory_stores_[store]_wikis_route_actions_0dbjn9p.js +3 -0
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/0ndq_server_app_api_v1_memory_stores_[store]_wikis_search_route_actions_108iypz.js +3 -0
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/0ndq_server_app_api_v1_memory_stores_[store]_wikis_source_route_actions_0vmf0n5.js +3 -0
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/0ndq_server_app_api_v1_memory_stores_[store]_wikis_sources_route_actions_0i4~w4-.js +3 -0
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/0p91_next_dist_esm_build_templates_app-route_0n~ec7s.js +24 -17
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/[root-of-the-server]__0-pbmiq._.js +3 -0
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/[root-of-the-server]__0.hvkwy._.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/[root-of-the-server]__03~qmfv._.js +3 -0
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/[root-of-the-server]__0_g86ij._.js +3 -0
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/[root-of-the-server]__0db9xtg._.js +40 -0
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/[root-of-the-server]__0ejcow5._.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/[root-of-the-server]__0es0s_~._.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/[root-of-the-server]__0f~3a2d._.js +3 -0
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/[root-of-the-server]__0is6qso._.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/[root-of-the-server]__0n.tvh_._.js +3 -0
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/[root-of-the-server]__0ohui_o._.js +3 -0
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/[root-of-the-server]__0ssi0g0._.js +3 -0
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/[root-of-the-server]__0tc-.6s._.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/[root-of-the-server]__0u03tze._.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/[root-of-the-server]__0ua_nqs._.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/[root-of-the-server]__0wpch_g._.js +3 -0
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/[root-of-the-server]__0ypo~ko._.js +3 -0
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/{[root-of-the-server]__0w56nne._.js → [root-of-the-server]__0yqtnx6._.js} +9 -9
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/[root-of-the-server]__11rxx0.._.js +40 -0
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/[root-of-the-server]__11wq90l._.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/[root-of-the-server]__120vi1p._.js +3 -0
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/[root-of-the-server]__13q2wbt._.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/[root-of-the-server]__13~-fxp._.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/0b1r_app_(dashboard)_knowledge-base_[name]_documents_documents-client_tsx_0g2uxmt._.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/0e95__next-internal_server_app_(dashboard)_memory_[store]_scope_page_actions_0n2kkfu.js +3 -0
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/0e95__next-internal_server_app_(dashboard)_memory_[store]_wiki_page_actions_01zih-8.js +3 -0
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/0p91_next_dist_esm_build_templates_app-page_07x7aai.js +4 -0
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/0p91_next_dist_esm_build_templates_app-page_0u~m_xi.js +4 -0
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/[root-of-the-server]__05kcz99._.js +3 -0
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/[root-of-the-server]__06l7w~r._.js +3 -0
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/[root-of-the-server]__07fsbff._.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/[root-of-the-server]__0_6myqa._.js +3 -0
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/[root-of-the-server]__0cn05tt._.js +3 -0
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/[root-of-the-server]__0d-z.x1._.js +3 -0
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/[root-of-the-server]__0i9tlv5._.js +3 -0
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/[root-of-the-server]__0ov6305._.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_00.la1c._.js +3 -0
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_019ufsh._.js +3 -0
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_01r6jx1._.js +3 -0
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_0251rsp._.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_04rasxw._.js +3 -0
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_04wdnle._.js +3 -0
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_05__-74._.js +3 -0
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_05wwgdw._.js +3 -0
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_06.3nzk._.js +3 -0
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_06ofr7j._.js +3 -0
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_0bn79mh._.js +3 -0
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_0cpcl4p._.js +3 -0
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_0d_nd-j._.js +3 -0
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_0f.xs7l._.js +3 -0
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_0fz3kge._.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_0gyu-mm._.js +3 -0
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_0jt60z2._.js +3 -0
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_0k7q0ug._.js +3 -0
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_0kaclzw._.js +3 -0
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_0lstkpb._.js +3 -0
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_0qw41co._.js +3 -0
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_0vfgz-v._.js +3 -0
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_0ww5s91._.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_119lxvo._.js +3 -0
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/dashboard_src_0x60pxf._.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/dashboard_src_0xaihln._.js +3 -0
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/dashboard_src_0y49vhd._.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/dashboard_src_10dsqx~._.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/dashboard_src_app_(dashboard)_api-keys_page_tsx_0lb6fu7._.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/dashboard_src_app_(dashboard)_memory_[store]_dream_[dreamId]_page_tsx_0wy3tv6._.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/dashboard_src_app_(dashboard)_memory_[store]_dream_page_tsx_0uzzpvs._.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/dashboard_src_app_(dashboard)_memory_[store]_layout_tsx_0rbi41w._.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/dashboard_src_components_memory_memory-files-browser_tsx_0o2~94-._.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/dashboard_src_components_ui_01evqg6._.js +3 -0
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/dashboard_src_i18n_i18n-context_tsx_0c39ewr._.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/node_modules__pnpm_0..ymrl._.js +3 -0
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/node_modules__pnpm_12_d6fg._.js +3 -0
- package/dist/dashboard-runtime/dashboard/.next/server/functions-config-manifest.json +9 -0
- package/dist/dashboard-runtime/dashboard/.next/server/middleware-build-manifest.js +3 -3
- package/dist/dashboard-runtime/dashboard/.next/server/next-font-manifest.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/next-font-manifest.json +2 -0
- package/dist/dashboard-runtime/dashboard/.next/server/pages/404.html +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/pages/500.html +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/server-reference-manifest.js +1 -1
- package/dist/dashboard-runtime/dashboard/.next/server/server-reference-manifest.json +1 -1
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/01nixb3ddw4hy.js +1 -0
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/01u9hj_9~5-vg.js +1 -0
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/02q3tpry1ajx9.js +1 -0
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/03rx12c5dxw_4.js +1 -0
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/057-rg6~0wki8.css +1 -0
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/07q8af71w17xl.js +1 -0
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/07v6llp0fv6iq.js +1 -0
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/09hfvw~51z.9o.js +1 -0
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/0axnv6wy1_hr7.js +1 -0
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/0bbcwyy.xvpd0.js +1 -0
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/{0eafb9pun~54k.js → 0cfrd_r4jr_ip.js} +2 -2
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/0dpj.6wcf.qn8.js +1 -0
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/0f-mf~9z.~82q.js +1 -0
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/0gt8u.o_c_nix.js +1 -0
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/0hh2728tmgrdk.js +1 -0
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/0idn9fvygbi9d.js +1 -0
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/0idr-.ttn_21z.js +1 -0
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/0k6m5~gmu0f8w.js +1 -0
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/0k_rtgxnq8bsz.js +1 -0
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/0nq2xdnij7nqt.js +1 -0
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/0nw7q~w~vg.-y.js +1 -0
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/0o-j8g9gp_c1r.js +1 -0
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/0pm6vv5wntle..js +1 -0
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/0qr499bd44k.g.js +1 -0
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/0sx_fx5r7nq4b.js +1 -0
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/0tbu6y0a22ok8.js +1 -0
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/0u7fh6be6noif.js +1 -0
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/0vfuo2829nn25.js +4 -0
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/0wcf_hdt9arma.js +5 -0
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/0xash~4j8pl87.js +1 -0
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/0xi6y8g4l~vzr.js +1 -0
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/0y45-~ia9sqr0.js +1 -0
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/10684vn7g6wln.js +1 -0
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/1204oli3aouy7.js +1 -0
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/13gbu.62oz207.js +138 -0
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/14t.r5~ls3k0x.js +1 -0
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/15043qe~kvq-v.js +1 -0
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/168xs92lu3o~y.js +1 -0
- package/dist/dashboard-runtime/dashboard/package.json +1 -1
- package/dist/dashboard-runtime/dashboard/server.js +1 -1
- package/dist/dashboard-runtime/dashboard/src/app/(dashboard)/chat/page.tsx +14 -0
- package/dist/dashboard-runtime/dashboard/src/app/(dashboard)/memory/[store]/dream/[dreamId]/page.tsx +195 -2
- package/dist/dashboard-runtime/dashboard/src/app/(dashboard)/memory/[store]/dream/page.tsx +15 -2
- package/dist/dashboard-runtime/dashboard/src/app/(dashboard)/memory/[store]/layout.tsx +36 -9
- package/dist/dashboard-runtime/dashboard/src/app/(dashboard)/memory/[store]/scope/page.tsx +51 -0
- package/dist/dashboard-runtime/dashboard/src/app/(dashboard)/memory/[store]/wiki/page.tsx +157 -0
- package/dist/dashboard-runtime/dashboard/src/app/(dashboard)/projects/page.tsx +3 -0
- package/dist/dashboard-runtime/dashboard/src/app/api/v1/instances/connectivity/route.ts +66 -0
- package/dist/dashboard-runtime/dashboard/src/app/api/v1/llm/chat/file-memory-curator.ts +58 -56
- package/dist/dashboard-runtime/dashboard/src/app/api/v1/llm/chat/file-memory-helpers.ts +6 -6
- package/dist/dashboard-runtime/dashboard/src/app/api/v1/llm/chat/memory-helpers.ts +50 -0
- package/dist/dashboard-runtime/dashboard/src/app/api/v1/llm/chat/memory-retrieval.ts +160 -0
- package/dist/dashboard-runtime/dashboard/src/app/api/v1/llm/chat/memory-security.ts +26 -0
- package/dist/dashboard-runtime/dashboard/src/app/api/v1/llm/chat/route.ts +477 -285
- package/dist/dashboard-runtime/dashboard/src/app/api/v1/llm/chat/server-file-memory.ts +113 -0
- package/dist/dashboard-runtime/dashboard/src/app/api/v1/llm/chat/wiki-retrieval.ts +656 -0
- package/dist/dashboard-runtime/dashboard/src/app/api/v1/memory/stores/[store]/_scope.ts +67 -0
- package/dist/dashboard-runtime/dashboard/src/app/api/v1/memory/stores/[store]/dream-tasks/[dreamId]/actions/apply/route.ts +39 -6
- package/dist/dashboard-runtime/dashboard/src/app/api/v1/memory/stores/[store]/file-memory/[action]/route.ts +22 -28
- package/dist/dashboard-runtime/dashboard/src/app/api/v1/memory/stores/[store]/file-memory/_helpers.ts +5 -23
- package/dist/dashboard-runtime/dashboard/src/app/api/v1/memory/stores/[store]/wikis/_helpers.ts +317 -0
- package/dist/dashboard-runtime/dashboard/src/app/api/v1/memory/stores/[store]/wikis/artifacts/route.ts +194 -0
- package/dist/dashboard-runtime/dashboard/src/app/api/v1/memory/stores/[store]/wikis/ingest/route.ts +60 -0
- package/dist/dashboard-runtime/dashboard/src/app/api/v1/memory/stores/[store]/wikis/page/route.ts +55 -0
- package/dist/dashboard-runtime/dashboard/src/app/api/v1/memory/stores/[store]/wikis/pages/route.ts +61 -0
- package/dist/dashboard-runtime/dashboard/src/app/api/v1/memory/stores/[store]/wikis/route.ts +89 -0
- package/dist/dashboard-runtime/dashboard/src/app/api/v1/memory/stores/[store]/wikis/search/route.ts +58 -0
- package/dist/dashboard-runtime/dashboard/src/app/api/v1/memory/stores/[store]/wikis/source/route.ts +230 -0
- package/dist/dashboard-runtime/dashboard/src/app/api/v1/memory/stores/[store]/wikis/sources/route.ts +295 -0
- package/dist/dashboard-runtime/dashboard/src/app/onboarding/page.tsx +1 -3
- package/dist/dashboard-runtime/dashboard/src/components/api-keys/custom-policy-editor.tsx +2 -1
- package/dist/dashboard-runtime/dashboard/src/components/api-keys/permission-rule-dialog.tsx +17 -10
- package/dist/dashboard-runtime/dashboard/src/components/chat/chat-config-context.tsx +181 -32
- package/dist/dashboard-runtime/dashboard/src/components/chat/chat-scope-entry-hydrator.tsx +116 -0
- package/dist/dashboard-runtime/dashboard/src/components/chat/memory-bind-section.tsx +37 -15
- package/dist/dashboard-runtime/dashboard/src/components/chat/mount-picker.tsx +5 -1
- package/dist/dashboard-runtime/dashboard/src/components/chat/wiki-bind-section.tsx +153 -0
- package/dist/dashboard-runtime/dashboard/src/components/instance/instance-connectivity-dot.tsx +96 -0
- package/dist/dashboard-runtime/dashboard/src/components/instance/project-card.tsx +5 -1
- package/dist/dashboard-runtime/dashboard/src/components/knowledge-base/subspace-gate.tsx +23 -5
- package/dist/dashboard-runtime/dashboard/src/components/knowledge-base/subspace-switcher.tsx +23 -5
- package/dist/dashboard-runtime/dashboard/src/components/layout/instance-switcher.tsx +13 -1
- package/dist/dashboard-runtime/dashboard/src/components/layout/sidebar-instance-card.tsx +29 -4
- package/dist/dashboard-runtime/dashboard/src/components/memory/file-details-panel.tsx +4 -4
- package/dist/dashboard-runtime/dashboard/src/components/memory/file-editor.tsx +9 -4
- package/dist/dashboard-runtime/dashboard/src/components/memory/file-version-history.tsx +107 -57
- package/dist/dashboard-runtime/dashboard/src/components/memory/memory-dream-actions-table.tsx +13 -0
- package/dist/dashboard-runtime/dashboard/src/components/memory/memory-dream-create-dialog.tsx +539 -139
- package/dist/dashboard-runtime/dashboard/src/components/memory/memory-dream-plan-approval-dialog.tsx +172 -0
- package/dist/dashboard-runtime/dashboard/src/components/memory/memory-files-browser.tsx +104 -56
- package/dist/dashboard-runtime/dashboard/src/components/memory/memory-scope-bar.tsx +266 -82
- package/dist/dashboard-runtime/dashboard/src/components/memory/scope-combobox.tsx +184 -76
- package/dist/dashboard-runtime/dashboard/src/components/memory/scope-hierarchy-picker.tsx +274 -0
- package/dist/dashboard-runtime/dashboard/src/components/memory/scope-workspace-cards.tsx +475 -0
- package/dist/dashboard-runtime/dashboard/src/components/memory/scope-workspace.tsx +197 -0
- package/dist/dashboard-runtime/dashboard/src/components/qa/answer-evidence-block.tsx +145 -0
- package/dist/dashboard-runtime/dashboard/src/components/qa/memory-evidence-content.tsx +106 -0
- package/dist/dashboard-runtime/dashboard/src/components/qa/qa-message.tsx +72 -87
- package/dist/dashboard-runtime/dashboard/src/components/qa/wiki-evidence-block.tsx +326 -0
- package/dist/dashboard-runtime/dashboard/src/components/shared/llm-model-selector.tsx +5 -1
- package/dist/dashboard-runtime/dashboard/src/components/ui/dialog.tsx +1 -1
- package/dist/dashboard-runtime/dashboard/src/components/wiki/wiki-build-panel.tsx +640 -0
- package/dist/dashboard-runtime/dashboard/src/components/wiki/wiki-detail.tsx +302 -0
- package/dist/dashboard-runtime/dashboard/src/components/wiki/wiki-edit-dialog.tsx +195 -0
- package/dist/dashboard-runtime/dashboard/src/components/wiki/wiki-overview.tsx +104 -0
- package/dist/dashboard-runtime/dashboard/src/components/wiki/wiki-pages-panel.tsx +424 -0
- package/dist/dashboard-runtime/dashboard/src/components/wiki/wiki-sources-panel.tsx +506 -0
- package/dist/dashboard-runtime/dashboard/src/contexts/subspace-context.tsx +144 -30
- package/dist/dashboard-runtime/dashboard/src/hooks/use-approve-dream-plan.ts +25 -0
- package/dist/dashboard-runtime/dashboard/src/hooks/use-chat-history.ts +625 -44
- package/dist/dashboard-runtime/dashboard/src/hooks/use-file-memory.ts +73 -72
- package/dist/dashboard-runtime/dashboard/src/hooks/use-instances.ts +40 -0
- package/dist/dashboard-runtime/dashboard/src/hooks/use-qa-chat.ts +329 -94
- package/dist/dashboard-runtime/dashboard/src/hooks/use-subspace-history.ts +64 -75
- package/dist/dashboard-runtime/dashboard/src/hooks/use-wiki-build-polling.ts +151 -0
- package/dist/dashboard-runtime/dashboard/src/hooks/use-wikis.ts +291 -0
- package/dist/dashboard-runtime/dashboard/src/i18n/locales/en.ts +453 -24
- package/dist/dashboard-runtime/dashboard/src/i18n/locales/zh.ts +420 -16
- package/dist/dashboard-runtime/dashboard/src/lib/browser-file-memory.ts +53 -341
- package/dist/dashboard-runtime/dashboard/src/lib/chat-scope-entry.ts +59 -0
- package/dist/dashboard-runtime/dashboard/src/lib/dream-create-options.ts +27 -0
- package/dist/dashboard-runtime/dashboard/src/lib/file-memory-core.ts +744 -0
- package/dist/dashboard-runtime/dashboard/src/lib/memory-scope-history.ts +165 -0
- package/dist/dashboard-runtime/dashboard/src/lib/memory-storage-mode.ts +25 -4
- package/dist/dashboard-runtime/dashboard/src/lib/memory.ts +13 -0
- package/dist/dashboard-runtime/dashboard/src/lib/query-keys.ts +103 -14
- package/dist/dashboard-runtime/dashboard/src/lib/retrieval-security.ts +54 -0
- package/dist/dashboard-runtime/dashboard/src/lib/scope-hierarchy.ts +167 -0
- package/dist/dashboard-runtime/dashboard/src/lib/scope-workspace.ts +123 -0
- package/dist/dashboard-runtime/dashboard/src/lib/server/api-helpers.ts +51 -3
- package/dist/dashboard-runtime/dashboard/src/lib/server/instance-connectivity.ts +136 -0
- package/dist/dashboard-runtime/dashboard/src/lib/server/sdk-client.ts +28 -3
- package/dist/dashboard-runtime/dashboard/src/lib/subspace-history.ts +151 -0
- package/dist/dashboard-runtime/dashboard/src/lib/wiki-metadata-limits.ts +133 -0
- package/dist/dashboard-runtime/dashboard/src/lib/wiki-page-tree.ts +153 -0
- package/dist/dashboard-runtime/dashboard/src/schemas/llm-chat.ts +121 -21
- package/dist/dashboard-runtime/dashboard/src/services/file-memory.ts +48 -56
- package/dist/dashboard-runtime/dashboard/src/services/instances.ts +5 -0
- package/dist/dashboard-runtime/dashboard/src/services/memory.ts +45 -5
- package/dist/dashboard-runtime/dashboard/src/services/wiki.ts +145 -0
- package/dist/dashboard-runtime/dashboard/src/types/file-memory.ts +96 -43
- package/dist/dashboard-runtime/dashboard/src/types/instance.ts +17 -0
- package/dist/dashboard-runtime/dashboard/src/types/llm-chat.ts +72 -9
- package/dist/dashboard-runtime/dashboard/src/types/memory.ts +25 -3
- package/dist/dashboard-runtime/dashboard/src/types/wiki.ts +200 -0
- package/dist/dashboard-runtime/dashboard/tsconfig.tsbuildinfo +1 -1
- package/dist/dashboard-runtime/node_modules/@img/sharp-darwin-arm64/lib/sharp-darwin-arm64.node +0 -0
- package/dist/dashboard-runtime/node_modules/@img/{sharp-linux-x64 → sharp-darwin-arm64}/package.json +7 -13
- package/dist/dashboard-runtime/node_modules/@img/{sharp-libvips-linux-x64 → sharp-libvips-darwin-arm64}/README.md +2 -2
- package/dist/dashboard-runtime/node_modules/@img/{sharp-libvips-linux-x64 → sharp-libvips-darwin-arm64}/lib/glib-2.0/include/glibconfig.h +8 -9
- package/dist/dashboard-runtime/node_modules/@img/{sharp-libvips-linux-x64/lib/libvips-cpp.so.8.17.3 → sharp-libvips-darwin-arm64/lib/libvips-cpp.8.17.3.dylib} +0 -0
- package/dist/dashboard-runtime/node_modules/@img/{sharp-libvips-linux-x64 → sharp-libvips-darwin-arm64}/package.json +5 -11
- package/dist/dashboard-runtime/node_modules/@tablestore/agent-storage/CHANGELOG.md +175 -0
- package/dist/dashboard-runtime/node_modules/@tablestore/agent-storage/LICENSE +201 -0
- package/dist/dashboard-runtime/node_modules/@tablestore/agent-storage/README.md +203 -0
- package/dist/dashboard-runtime/node_modules/@tablestore/agent-storage/dist/cjs/package.json +3 -0
- package/dist/dashboard-runtime/node_modules/@tablestore/agent-storage/dist/cjs/src/core/auth/request-context.js +21 -0
- package/dist/dashboard-runtime/node_modules/@tablestore/agent-storage/dist/cjs/src/core/auth/sign-base.js +70 -0
- package/dist/dashboard-runtime/node_modules/@tablestore/agent-storage/dist/cjs/src/core/auth/sign-v2.js +13 -0
- package/dist/dashboard-runtime/node_modules/@tablestore/agent-storage/dist/cjs/src/core/auth/sign-v4.js +51 -0
- package/dist/dashboard-runtime/node_modules/@tablestore/agent-storage/dist/cjs/src/core/client/agent-storage-client.js +196 -0
- package/dist/dashboard-runtime/node_modules/@tablestore/agent-storage/dist/cjs/src/core/errors/client-error.js +10 -0
- package/dist/dashboard-runtime/node_modules/@tablestore/agent-storage/dist/cjs/src/core/errors/service-error.js +16 -0
- package/dist/dashboard-runtime/node_modules/@tablestore/agent-storage/dist/cjs/src/core/http/headers.js +31 -0
- package/dist/dashboard-runtime/node_modules/@tablestore/agent-storage/dist/cjs/src/core/http/md5.js +9 -0
- package/dist/dashboard-runtime/node_modules/@tablestore/agent-storage/dist/cjs/src/core/http/ots-json-client.js +155 -0
- package/dist/dashboard-runtime/node_modules/@tablestore/agent-storage/dist/cjs/src/core/models/base.js +19 -0
- package/dist/dashboard-runtime/node_modules/@tablestore/agent-storage/dist/cjs/src/core/models/chunk.js +67 -0
- package/dist/dashboard-runtime/node_modules/@tablestore/agent-storage/dist/cjs/src/core/models/document.js +163 -0
- package/dist/dashboard-runtime/node_modules/@tablestore/agent-storage/dist/cjs/src/core/models/enums.js +31 -0
- package/dist/dashboard-runtime/node_modules/@tablestore/agent-storage/dist/cjs/src/core/models/file.js +27 -0
- package/dist/dashboard-runtime/node_modules/@tablestore/agent-storage/dist/cjs/src/core/models/knowledge-base.js +118 -0
- package/dist/dashboard-runtime/node_modules/@tablestore/agent-storage/dist/cjs/src/core/models/memory.js +711 -0
- package/dist/dashboard-runtime/node_modules/@tablestore/agent-storage/dist/cjs/src/core/models/metadata-filter.js +123 -0
- package/dist/dashboard-runtime/node_modules/@tablestore/agent-storage/dist/cjs/src/core/models/retrieve.js +152 -0
- package/dist/dashboard-runtime/node_modules/@tablestore/agent-storage/dist/cjs/src/core/models/unset.js +8 -0
- package/dist/dashboard-runtime/node_modules/@tablestore/agent-storage/dist/cjs/src/core/models/wiki.js +2 -0
- package/dist/dashboard-runtime/node_modules/@tablestore/agent-storage/dist/cjs/src/core/serialization/to-json-request.js +9 -0
- package/dist/dashboard-runtime/node_modules/@tablestore/agent-storage/dist/cjs/src/core/version.js +5 -0
- package/dist/dashboard-runtime/node_modules/@tablestore/agent-storage/dist/cjs/src/index.js +93 -0
- package/dist/dashboard-runtime/node_modules/@tablestore/agent-storage/dist/cjs/src/node/client/node-agent-storage-client.js +134 -0
- package/dist/dashboard-runtime/node_modules/@tablestore/agent-storage/dist/cjs/src/node/fs/file-path.js +73 -0
- package/dist/dashboard-runtime/node_modules/@tablestore/agent-storage/dist/cjs/src/node/fs/file-reader.js +13 -0
- package/dist/dashboard-runtime/node_modules/@tablestore/agent-storage/dist/cjs/src/node/oss/oss-uploader.js +30 -0
- package/dist/dashboard-runtime/node_modules/@tablestore/agent-storage/dist/cjs/src/node.js +5 -0
- package/dist/dashboard-runtime/node_modules/@tablestore/agent-storage/dist/src/core/auth/request-context.d.ts +12 -0
- package/dist/dashboard-runtime/node_modules/@tablestore/agent-storage/dist/src/core/auth/request-context.js +17 -0
- package/dist/dashboard-runtime/node_modules/@tablestore/agent-storage/dist/src/core/auth/sign-base.d.ts +12 -0
- package/dist/dashboard-runtime/node_modules/@tablestore/agent-storage/dist/src/core/auth/sign-base.js +63 -0
- package/dist/dashboard-runtime/node_modules/@tablestore/agent-storage/dist/src/core/auth/sign-v2.d.ts +6 -0
- package/dist/dashboard-runtime/node_modules/@tablestore/agent-storage/dist/src/core/auth/sign-v2.js +9 -0
- package/dist/dashboard-runtime/node_modules/@tablestore/agent-storage/dist/src/core/auth/sign-v4.d.ts +15 -0
- package/dist/dashboard-runtime/node_modules/@tablestore/agent-storage/dist/src/core/auth/sign-v4.js +47 -0
- package/dist/dashboard-runtime/node_modules/@tablestore/agent-storage/dist/src/core/client/agent-storage-client.d.ts +78 -0
- package/dist/dashboard-runtime/node_modules/@tablestore/agent-storage/dist/src/core/client/agent-storage-client.js +192 -0
- package/dist/dashboard-runtime/node_modules/@tablestore/agent-storage/dist/src/core/errors/client-error.d.ts +3 -0
- package/dist/dashboard-runtime/node_modules/@tablestore/agent-storage/dist/src/core/errors/client-error.js +6 -0
- package/dist/dashboard-runtime/node_modules/@tablestore/agent-storage/dist/src/core/errors/service-error.d.ts +10 -0
- package/dist/dashboard-runtime/node_modules/@tablestore/agent-storage/dist/src/core/errors/service-error.js +12 -0
- package/dist/dashboard-runtime/node_modules/@tablestore/agent-storage/dist/src/core/http/headers.d.ts +14 -0
- package/dist/dashboard-runtime/node_modules/@tablestore/agent-storage/dist/src/core/http/headers.js +27 -0
- package/dist/dashboard-runtime/node_modules/@tablestore/agent-storage/dist/src/core/http/md5.d.ts +1 -0
- package/dist/dashboard-runtime/node_modules/@tablestore/agent-storage/dist/src/core/http/md5.js +6 -0
- package/dist/dashboard-runtime/node_modules/@tablestore/agent-storage/dist/src/core/http/ots-json-client.d.ts +27 -0
- package/dist/dashboard-runtime/node_modules/@tablestore/agent-storage/dist/src/core/http/ots-json-client.js +151 -0
- package/dist/dashboard-runtime/node_modules/@tablestore/agent-storage/dist/src/core/models/base.d.ts +5 -0
- package/dist/dashboard-runtime/node_modules/@tablestore/agent-storage/dist/src/core/models/base.js +15 -0
- package/dist/dashboard-runtime/node_modules/@tablestore/agent-storage/dist/src/core/models/chunk.d.ts +47 -0
- package/dist/dashboard-runtime/node_modules/@tablestore/agent-storage/dist/src/core/models/chunk.js +61 -0
- package/dist/dashboard-runtime/node_modules/@tablestore/agent-storage/dist/src/core/models/document.d.ts +107 -0
- package/dist/dashboard-runtime/node_modules/@tablestore/agent-storage/dist/src/core/models/document.js +151 -0
- package/dist/dashboard-runtime/node_modules/@tablestore/agent-storage/dist/src/core/models/enums.d.ts +24 -0
- package/dist/dashboard-runtime/node_modules/@tablestore/agent-storage/dist/src/core/models/enums.js +28 -0
- package/dist/dashboard-runtime/node_modules/@tablestore/agent-storage/dist/src/core/models/file.d.ts +364 -0
- package/dist/dashboard-runtime/node_modules/@tablestore/agent-storage/dist/src/core/models/file.js +24 -0
- package/dist/dashboard-runtime/node_modules/@tablestore/agent-storage/dist/src/core/models/knowledge-base.d.ts +97 -0
- package/dist/dashboard-runtime/node_modules/@tablestore/agent-storage/dist/src/core/models/knowledge-base.js +108 -0
- package/dist/dashboard-runtime/node_modules/@tablestore/agent-storage/dist/src/core/models/memory.d.ts +1018 -0
- package/dist/dashboard-runtime/node_modules/@tablestore/agent-storage/dist/src/core/models/memory.js +684 -0
- package/dist/dashboard-runtime/node_modules/@tablestore/agent-storage/dist/src/core/models/metadata-filter.d.ts +74 -0
- package/dist/dashboard-runtime/node_modules/@tablestore/agent-storage/dist/src/core/models/metadata-filter.js +118 -0
- package/dist/dashboard-runtime/node_modules/@tablestore/agent-storage/dist/src/core/models/retrieve.d.ts +113 -0
- package/dist/dashboard-runtime/node_modules/@tablestore/agent-storage/dist/src/core/models/retrieve.js +140 -0
- package/dist/dashboard-runtime/node_modules/@tablestore/agent-storage/dist/src/core/models/unset.d.ts +3 -0
- package/dist/dashboard-runtime/node_modules/@tablestore/agent-storage/dist/src/core/models/unset.js +4 -0
- package/dist/dashboard-runtime/node_modules/@tablestore/agent-storage/dist/src/core/models/wiki.d.ts +118 -0
- package/dist/dashboard-runtime/node_modules/@tablestore/agent-storage/dist/src/core/models/wiki.js +1 -0
- package/dist/dashboard-runtime/node_modules/@tablestore/agent-storage/dist/src/core/serialization/to-json-request.d.ts +2 -0
- package/dist/dashboard-runtime/node_modules/@tablestore/agent-storage/dist/src/core/serialization/to-json-request.js +6 -0
- package/dist/dashboard-runtime/node_modules/@tablestore/agent-storage/dist/src/core/version.d.ts +2 -0
- package/dist/dashboard-runtime/node_modules/@tablestore/agent-storage/dist/src/core/version.js +2 -0
- package/dist/dashboard-runtime/node_modules/@tablestore/agent-storage/dist/src/index.d.ts +17 -0
- package/dist/dashboard-runtime/node_modules/@tablestore/agent-storage/dist/src/index.js +16 -0
- package/dist/dashboard-runtime/node_modules/@tablestore/agent-storage/dist/src/node/client/node-agent-storage-client.d.ts +39 -0
- package/dist/dashboard-runtime/node_modules/@tablestore/agent-storage/dist/src/node/client/node-agent-storage-client.js +130 -0
- package/dist/dashboard-runtime/node_modules/@tablestore/agent-storage/dist/src/node/fs/file-path.d.ts +12 -0
- package/dist/dashboard-runtime/node_modules/@tablestore/agent-storage/dist/src/node/fs/file-path.js +34 -0
- package/dist/dashboard-runtime/node_modules/@tablestore/agent-storage/dist/src/node/fs/file-reader.d.ts +8 -0
- package/dist/dashboard-runtime/node_modules/@tablestore/agent-storage/dist/src/node/fs/file-reader.js +9 -0
- package/dist/dashboard-runtime/node_modules/@tablestore/agent-storage/dist/src/node/oss/oss-uploader.d.ts +17 -0
- package/dist/dashboard-runtime/node_modules/@tablestore/agent-storage/dist/src/node/oss/oss-uploader.js +23 -0
- package/dist/dashboard-runtime/node_modules/@tablestore/agent-storage/dist/src/node.d.ts +1 -0
- package/dist/dashboard-runtime/node_modules/@tablestore/agent-storage/dist/src/node.js +1 -0
- package/dist/dashboard-runtime/node_modules/@tablestore/agent-storage/package.json +67 -0
- package/dist/dashboard-runtime/node_modules/@tablestore/tablestore-agent-sdk/dist/index.d.ts +1 -0
- package/dist/dashboard-runtime/node_modules/@tablestore/tablestore-agent-sdk/dist/index.d.ts.map +1 -1
- package/dist/dashboard-runtime/node_modules/@tablestore/tablestore-agent-sdk/dist/index.js +1 -0
- package/dist/dashboard-runtime/node_modules/@tablestore/tablestore-agent-sdk/dist/index.js.map +1 -1
- package/dist/dashboard-runtime/node_modules/@tablestore/tablestore-agent-sdk/dist/internal/abortable-fetch.d.ts +13 -0
- package/dist/dashboard-runtime/node_modules/@tablestore/tablestore-agent-sdk/dist/internal/abortable-fetch.d.ts.map +1 -0
- package/dist/dashboard-runtime/node_modules/@tablestore/tablestore-agent-sdk/dist/internal/abortable-fetch.js +40 -0
- package/dist/dashboard-runtime/node_modules/@tablestore/tablestore-agent-sdk/dist/internal/abortable-fetch.js.map +1 -0
- package/dist/dashboard-runtime/node_modules/@tablestore/tablestore-agent-sdk/dist/kb-client.d.ts +1 -1
- package/dist/dashboard-runtime/node_modules/@tablestore/tablestore-agent-sdk/dist/kb-client.d.ts.map +1 -1
- package/dist/dashboard-runtime/node_modules/@tablestore/tablestore-agent-sdk/dist/kb-client.js +21 -9
- package/dist/dashboard-runtime/node_modules/@tablestore/tablestore-agent-sdk/dist/kb-client.js.map +1 -1
- package/dist/dashboard-runtime/node_modules/@tablestore/tablestore-agent-sdk/dist/memory-client.d.ts +11 -57
- package/dist/dashboard-runtime/node_modules/@tablestore/tablestore-agent-sdk/dist/memory-client.d.ts.map +1 -1
- package/dist/dashboard-runtime/node_modules/@tablestore/tablestore-agent-sdk/dist/memory-client.js +42 -103
- package/dist/dashboard-runtime/node_modules/@tablestore/tablestore-agent-sdk/dist/memory-client.js.map +1 -1
- package/dist/dashboard-runtime/node_modules/@tablestore/tablestore-agent-sdk/dist/response.d.ts.map +1 -1
- package/dist/dashboard-runtime/node_modules/@tablestore/tablestore-agent-sdk/dist/response.js +57 -36
- package/dist/dashboard-runtime/node_modules/@tablestore/tablestore-agent-sdk/dist/response.js.map +1 -1
- package/dist/dashboard-runtime/node_modules/@tablestore/tablestore-agent-sdk/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/dashboard-runtime/node_modules/@tablestore/tablestore-agent-sdk/dist/types.d.ts +6 -0
- package/dist/dashboard-runtime/node_modules/@tablestore/tablestore-agent-sdk/dist/types.d.ts.map +1 -1
- package/dist/dashboard-runtime/node_modules/@tablestore/tablestore-agent-sdk/dist/wiki-client.d.ts +18 -0
- package/dist/dashboard-runtime/node_modules/@tablestore/tablestore-agent-sdk/dist/wiki-client.d.ts.map +1 -0
- package/dist/dashboard-runtime/node_modules/@tablestore/tablestore-agent-sdk/dist/wiki-client.js +100 -0
- package/dist/dashboard-runtime/node_modules/@tablestore/tablestore-agent-sdk/dist/wiki-client.js.map +1 -0
- package/dist/dashboard-runtime/node_modules/@tablestore/tablestore-agent-sdk/package.json +1 -1
- package/dist/dashboard-runtime/node_modules/@tablestore/tablestore-agent-shared/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/main.js +0 -0
- package/dist/node_modules/@tablestore/tablestore-agent-sdk/dist/index.d.ts +1 -0
- package/dist/node_modules/@tablestore/tablestore-agent-sdk/dist/index.d.ts.map +1 -1
- package/dist/node_modules/@tablestore/tablestore-agent-sdk/dist/index.js +1 -0
- package/dist/node_modules/@tablestore/tablestore-agent-sdk/dist/index.js.map +1 -1
- package/dist/node_modules/@tablestore/tablestore-agent-sdk/dist/internal/abortable-fetch.d.ts +13 -0
- package/dist/node_modules/@tablestore/tablestore-agent-sdk/dist/internal/abortable-fetch.d.ts.map +1 -0
- package/dist/node_modules/@tablestore/tablestore-agent-sdk/dist/internal/abortable-fetch.js +40 -0
- package/dist/node_modules/@tablestore/tablestore-agent-sdk/dist/internal/abortable-fetch.js.map +1 -0
- package/dist/node_modules/@tablestore/tablestore-agent-sdk/dist/kb-client.d.ts +1 -1
- package/dist/node_modules/@tablestore/tablestore-agent-sdk/dist/kb-client.d.ts.map +1 -1
- package/dist/node_modules/@tablestore/tablestore-agent-sdk/dist/kb-client.js +21 -9
- package/dist/node_modules/@tablestore/tablestore-agent-sdk/dist/kb-client.js.map +1 -1
- package/dist/node_modules/@tablestore/tablestore-agent-sdk/dist/memory-client.d.ts +11 -57
- package/dist/node_modules/@tablestore/tablestore-agent-sdk/dist/memory-client.d.ts.map +1 -1
- package/dist/node_modules/@tablestore/tablestore-agent-sdk/dist/memory-client.js +42 -103
- package/dist/node_modules/@tablestore/tablestore-agent-sdk/dist/memory-client.js.map +1 -1
- package/dist/node_modules/@tablestore/tablestore-agent-sdk/dist/response.d.ts.map +1 -1
- package/dist/node_modules/@tablestore/tablestore-agent-sdk/dist/response.js +57 -36
- package/dist/node_modules/@tablestore/tablestore-agent-sdk/dist/response.js.map +1 -1
- package/dist/node_modules/@tablestore/tablestore-agent-sdk/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/node_modules/@tablestore/tablestore-agent-sdk/dist/types.d.ts +6 -0
- package/dist/node_modules/@tablestore/tablestore-agent-sdk/dist/types.d.ts.map +1 -1
- package/dist/node_modules/@tablestore/tablestore-agent-sdk/dist/wiki-client.d.ts +18 -0
- package/dist/node_modules/@tablestore/tablestore-agent-sdk/dist/wiki-client.d.ts.map +1 -0
- package/dist/node_modules/@tablestore/tablestore-agent-sdk/dist/wiki-client.js +100 -0
- package/dist/node_modules/@tablestore/tablestore-agent-sdk/dist/wiki-client.js.map +1 -0
- package/dist/node_modules/@tablestore/tablestore-agent-sdk/package.json +1 -1
- package/dist/node_modules/@tablestore/tablestore-agent-shared/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/output.d.ts.map +1 -1
- package/dist/output.js +1 -0
- package/dist/output.js.map +1 -1
- package/package.json +3 -3
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/[root-of-the-server]__0dzh4cj._.js +0 -40
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/[root-of-the-server]__0k7ex0r._.js +0 -40
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/[root-of-the-server]__0y0w3mg._.js +0 -3
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/[root-of-the-server]__0.ooo1s._.js +0 -3
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/[root-of-the-server]__01f7est._.js +0 -3
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/[root-of-the-server]__0b5cw4e._.js +0 -3
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/[root-of-the-server]__0cj2gsm._.js +0 -3
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_0.pa1e6._.js +0 -3
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_01snuz~._.js +0 -3
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_02waf76._.js +0 -3
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_05bw0~2._.js +0 -3
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_071hi50._.js +0 -3
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_0_aw2vr._.js +0 -3
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_0brqbty._.js +0 -3
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_0ez3yia._.js +0 -3
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_0hy21o9._.js +0 -3
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_0odjvc.._.js +0 -3
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_0wce254._.js +0 -3
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_0xrd8-1._.js +0 -3
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_0y7vx.d._.js +0 -3
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_12l8jkb._.js +0 -3
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/_13ctfae._.js +0 -3
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/dashboard_src_0_z9696._.js +0 -3
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/dashboard_src_0grv2wq._.js +0 -3
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/node_modules__pnpm_0jns_ph._.js +0 -3
- package/dist/dashboard-runtime/dashboard/.next/server/chunks/ssr/node_modules__pnpm_0sr_ner._.js +0 -3
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/0-~e5~2eoun8n.js +0 -1
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/01xcynczarvq~.js +0 -1
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/01xuyqw7ivp3n.js +0 -138
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/026lyw-ynx1og.js +0 -1
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/029zyc1pxa~4m.js +0 -1
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/05_iqjh-v2gej.js +0 -1
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/05vzt~ml0z7~9.js +0 -1
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/07twdccs42b_-.js +0 -1
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/08h7wustf~cl4.js +0 -4
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/08nzc9sye_0~h.js +0 -1
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/08o2~c-80nbla.js +0 -1
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/0_osn.dm_85jw.js +0 -1
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/0aj~rx1m.91ur.js +0 -5
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/0dx_8pb_z_xy6.css +0 -1
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/0hnqmb1a7y7x1.js +0 -138
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/0k9guaejnlc0r.js +0 -1
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/0ll488v66ycn1.js +0 -1
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/0ogrq_r43je48.js +0 -1
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/0pxisu-1mnehf.js +0 -1
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/0r6utd8g~.cc1.js +0 -1
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/0vn5pp.3keyh5.js +0 -1
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/0wbozn0wq-4ls.js +0 -1
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/0zatcw.k613lh.js +0 -1
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/0~a4ig2x9z8uq.js +0 -1
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/0~naqbx3873~r.js +0 -1
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/12iur8ibdfi5_.js +0 -1
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/13kxz9vygidrz.js +0 -1
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/14.8mq880kjoc.js +0 -1
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/165fwg-5at5cq.js +0 -1
- package/dist/dashboard-runtime/dashboard/.next/static/chunks/17b4md7atp39z.js +0 -1
- package/dist/dashboard-runtime/node_modules/@img/sharp-linux-x64/lib/sharp-linux-x64.node +0 -0
- package/dist/dashboard-runtime/node_modules/@tablestore/tablestore-agent-sdk/dist/file-memory.d.ts +0 -153
- package/dist/dashboard-runtime/node_modules/@tablestore/tablestore-agent-sdk/dist/file-memory.d.ts.map +0 -1
- package/dist/dashboard-runtime/node_modules/@tablestore/tablestore-agent-sdk/dist/file-memory.js +0 -451
- package/dist/dashboard-runtime/node_modules/@tablestore/tablestore-agent-sdk/dist/file-memory.js.map +0 -1
- package/dist/dashboard-runtime/node_modules/@tablestore/tablestore-agent-sdk/dist/oss-uploader.d.ts +0 -56
- package/dist/dashboard-runtime/node_modules/@tablestore/tablestore-agent-sdk/dist/oss-uploader.d.ts.map +0 -1
- package/dist/dashboard-runtime/node_modules/@tablestore/tablestore-agent-sdk/dist/oss-uploader.js +0 -120
- package/dist/dashboard-runtime/node_modules/@tablestore/tablestore-agent-sdk/dist/oss-uploader.js.map +0 -1
- package/dist/dashboard-runtime/node_modules/semver/node_modules/.bin/semver +0 -21
- package/dist/node_modules/@tablestore/tablestore-agent-sdk/dist/file-memory.d.ts +0 -153
- package/dist/node_modules/@tablestore/tablestore-agent-sdk/dist/file-memory.d.ts.map +0 -1
- package/dist/node_modules/@tablestore/tablestore-agent-sdk/dist/file-memory.js +0 -451
- package/dist/node_modules/@tablestore/tablestore-agent-sdk/dist/file-memory.js.map +0 -1
- package/dist/node_modules/@tablestore/tablestore-agent-sdk/dist/oss-uploader.d.ts +0 -56
- package/dist/node_modules/@tablestore/tablestore-agent-sdk/dist/oss-uploader.d.ts.map +0 -1
- package/dist/node_modules/@tablestore/tablestore-agent-sdk/dist/oss-uploader.js +0 -120
- package/dist/node_modules/@tablestore/tablestore-agent-sdk/dist/oss-uploader.js.map +0 -1
- /package/dist/dashboard-runtime/dashboard/.next/static/{AgybWIwFBY3-L1V2Copiq → bKUtNfKb47TOc1cpUk74A}/_buildManifest.js +0 -0
- /package/dist/dashboard-runtime/dashboard/.next/static/{AgybWIwFBY3-L1V2Copiq → bKUtNfKb47TOc1cpUk74A}/_clientMiddlewareManifest.js +0 -0
- /package/dist/dashboard-runtime/dashboard/.next/static/{AgybWIwFBY3-L1V2Copiq → bKUtNfKb47TOc1cpUk74A}/_ssgManifest.js +0 -0
- /package/dist/dashboard-runtime/node_modules/@img/{sharp-libvips-linux-x64 → sharp-libvips-darwin-arm64}/lib/index.js +0 -0
- /package/dist/dashboard-runtime/node_modules/@img/{sharp-libvips-linux-x64 → sharp-libvips-darwin-arm64}/versions.json +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,821122,550657,851024,109012,e=>{"use strict";var t=e.i(44501),r=e.i(101685),s=e.i(237769),a=e.i(801685);let n=(0,a.default)("send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]),i=(0,a.default)("square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);var l=e.i(942595),o=e.i(45123),c=e.i(799877),d=e.i(515793),m=e.i(876490),u=e.i(861403),p=e.i(732323),p=p,h=e.i(309823),x=e.i(192988),g=e.i(18722),f=e.i(487332),v=e.i(820268),y=e.i(882652),j=e.i(179297),b=e.i(229025);let w=(0,a.default)("graduation-cap",[["path",{d:"M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0z",key:"j76jl0"}],["path",{d:"M22 10v6",key:"1lu8f3"}],["path",{d:"M6 12.5V16a6 3 0 0 0 12 0v-3.5",key:"1r8lef"}]]);var k=e.i(51517),N=e.i(533153),C=e.i(983823),S=e.i(396416),I=e.i(330363);let q=(0,a.default)("user-round",[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]]);var M=e.i(187014),R=e.i(663630),F=e.i(64209),A=e.i(433253),E=e.i(12251),T=e.i(520647),D=e.i(136283),$=e.i(711836),P=e.i(218077);let _=(0,a.default)("book-marked",[["path",{d:"M10 2v8l3-3 3 3V2",key:"sqw3rj"}],["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}]]);function W({hits:e,memoryStoreName:r,scope:s}){return(0,t.jsx)("div",{className:"space-y-2",children:e.map((e,a)=>(0,t.jsx)(K,{hit:e,index:a+1,memoryStoreName:r,scope:s},e.unit.memcell_id??`${a}-${(e.unit.text??"").slice(0,16)}`))})}function K({hit:e,index:r,memoryStoreName:s,scope:a}){var n;let i,{t:l}=(0,d.useI18n)(),o=e.unit.memcell_id,c="number"==typeof e.score?e.score:void 0;return(0,t.jsxs)("div",{className:"rounded-md border border-[hsl(var(--border))] bg-[hsl(var(--muted)/0.3)] p-3",children:[(0,t.jsxs)("div",{className:"mb-1.5 flex items-center gap-2 text-xs text-muted-foreground",children:[(0,t.jsx)("span",{className:"inline-flex h-5 w-5 items-center justify-center rounded-full bg-[hsl(var(--primary-50))] font-semibold text-primary",children:r}),o?(0,t.jsx)("span",{className:"min-w-0 truncate font-mono text-foreground/80",title:o,children:o}):(0,t.jsx)("span",{className:"text-muted-foreground/70",children:l("qa.memory.unnamedMemory")}),e.source&&s&&a?(0,t.jsx)(u.default,{href:(n=e.source,i=new URLSearchParams({...a,view:"files",file:n}),`/memory/${encodeURIComponent(s)}/units?${i.toString()}`),className:"rounded bg-[hsl(var(--muted))] px-1.5 py-0.5 font-mono text-[10px] text-[hsl(var(--primary))] hover:underline",children:e.source}):e.source?(0,t.jsx)("span",{className:"rounded bg-[hsl(var(--muted))] px-1.5 py-0.5 font-mono text-[10px] text-muted-foreground",children:e.source}):null,(0,t.jsx)("span",{className:"ml-auto shrink-0 font-mono",children:void 0!==c?c.toFixed(4):"—"})]}),(0,t.jsx)("p",{className:"line-clamp-4 whitespace-pre-wrap text-xs text-foreground/80",children:e.unit.text})]})}function B({groups:e,memoryStoreName:r,scope:s}){return(0,t.jsx)("div",{className:"space-y-3",children:e.map((e,a)=>(0,t.jsx)(L,{group:e,memoryStoreName:r,scope:s},`${e.wikiName}-${a}`))})}function L({group:e,memoryStoreName:r,scope:s}){return(0,t.jsxs)("section",{className:"space-y-2","aria-label":e.wikiName,children:[(0,t.jsx)("div",{className:"flex items-center gap-2 text-xs font-medium text-muted-foreground",children:(0,t.jsx)("span",{className:"text-foreground/80",children:e.wikiName})}),(0,t.jsxs)("div",{className:"space-y-2 border-l-2 border-[hsl(var(--border))] pl-3",children:[(e.errors??[]).map((r,s)=>(0,t.jsx)(O,{error:r,wikiName:e.wikiName},`${r.stage}-${r.path??""}-${r.requestId??s}`)),e.pages.map(e=>(0,t.jsx)(z,{page:e,memoryStoreName:r,scope:s},`${e.reference}-${e.path}`))]})]})}function O({error:e,wikiName:r}){let{t:s}=(0,d.useI18n)();return(0,t.jsxs)("div",{className:"rounded-md border border-amber-500/30 bg-amber-500/5 px-3 py-2 text-xs text-amber-700 dark:text-amber-300",children:[(0,t.jsx)("div",{className:"font-medium",children:s("qa.message.wikiUnavailable",{name:r})}),(0,t.jsxs)("div",{className:"mt-1 space-y-0.5 font-mono text-[11px] text-amber-700/80 dark:text-amber-300/80",children:[(0,t.jsx)("div",{children:s("qa.message.wikiErrorCode",{code:e.code})}),(0,t.jsx)("div",{children:s("qa.message.wikiErrorMessage",{message:e.message})}),e.requestId?(0,t.jsx)("div",{children:s("qa.message.wikiRequestId",{requestId:e.requestId})}):null,void 0!==e.httpStatus?(0,t.jsx)("div",{children:s("qa.message.wikiHttpStatus",{httpStatus:e.httpStatus})}):null,(0,t.jsx)("div",{children:s("qa.message.wikiErrorStage",{stage:e.stage})}),e.path?(0,t.jsx)("div",{children:s("qa.message.wikiErrorPath",{path:e.path})}):null]})]})}function z({page:e,memoryStoreName:r,scope:s}){var a;let n,{t:i}=(0,d.useI18n)(),l=r&&s&&s.appId&&s.tenantId&&s.agentId&&s.runId?(0,t.jsx)(u.default,{href:(a=r??"",(n=new URLSearchParams([["appId",s.appId],["tenantId",s.tenantId],["agentId",s.agentId],["runId",s.runId]])).set("path",e.path),`/memory/${encodeURIComponent(a)}/wiki?${n.toString()}`),"aria-label":`${e.reference} ${e.path}`,className:"min-w-0 truncate rounded bg-[hsl(var(--muted))] px-1.5 py-0.5 font-mono text-[10px] text-[hsl(var(--primary))] hover:underline",children:e.path}):(0,t.jsx)("span",{className:"min-w-0 truncate rounded bg-[hsl(var(--muted))] px-1.5 py-0.5 font-mono text-[10px] text-muted-foreground",children:e.path});return(0,t.jsxs)("article",{className:"rounded-md border border-[hsl(var(--border))] bg-[hsl(var(--muted)/0.3)] p-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[(0,t.jsxs)("span",{className:"shrink-0 font-semibold text-primary",children:["[",e.reference,"]"]}),l,e.title?(0,t.jsx)("span",{className:"min-w-0 truncate font-medium text-foreground/80",children:e.title}):null,e.type?(0,t.jsx)("span",{className:"shrink-0 rounded bg-[hsl(var(--muted))] px-1.5 py-0.5 text-[10px] uppercase",children:e.type}):null]}),e.description?(0,t.jsx)("p",{className:"mt-1.5 text-xs text-foreground/80",children:e.description}):null,(0,t.jsxs)("div",{className:"mt-2 flex flex-wrap items-center gap-x-3 gap-y-1 text-[11px] text-muted-foreground",children:[void 0!==e.score?(0,t.jsx)("span",{className:"font-mono",children:i("qa.message.wikiScore",{score:String(e.score)})}):null,(0,t.jsx)("span",{children:i("qa.message.wikiInjectedChars",{count:e.injectedChars})}),e.truncated?(0,t.jsx)("span",{className:"text-amber-700 dark:text-amber-300",children:i("qa.message.wikiTruncated")}):null]}),e.sources&&e.sources.length>0?(0,t.jsx)("div",{className:"mt-1.5 break-all text-[11px] text-muted-foreground",children:i("qa.message.wikiSources",{sources:e.sources.join(", ")})}):null]})}function Q({memoryHits:e=[],memoryQuery:s,memoryStoreName:a,memoryScope:n,wikiQuery:i,wikiEvidence:l=[],wikiRetrievalGroups:o=[],wikiMemoryStoreName:c,wikiScope:u,wikiTotalContextChars:p}){let{t:h}=(0,d.useI18n)(),[x,f]=(0,r.useState)(!1),y=(o.length>0?o:function(e){let t=new Map;for(let r of e){let e=t.get(r.wikiName);if(e){e.pages.push(r);continue}t.set(r.wikiName,{wikiName:r.wikiName,pages:[r]})}return[...t.values()]}(l)).filter(e=>e.pages.length>0||(e.errors?.length??0)>0),j=e.length,b=y.reduce((e,t)=>e+t.pages.length,0),w=j>0,k=y.length>0;if(!w&&!k)return null;let N=h("qa.evidence.title",{memoryCount:j,wikiCount:b}),C=`${N} \xb7 ${h(x?"qa.chunks.collapse":"qa.chunks.expand")}`;return(0,t.jsxs)(F.Collapsible,{open:x,onOpenChange:f,children:[(0,t.jsx)(F.CollapsibleTrigger,{asChild:!0,children:(0,t.jsxs)("button",{type:"button","data-testid":"answer-evidence-trigger","aria-label":C,className:"inline-flex max-w-full items-center gap-1.5 rounded-md px-2 py-1 text-xs text-muted-foreground transition-colors hover:bg-[hsl(var(--accent))] hover:text-foreground",children:[(0,t.jsx)(_,{className:"h-3.5 w-3.5 shrink-0"}),(0,t.jsx)("span",{className:"truncate",children:N}),(0,t.jsx)(v.ChevronDown,{className:(0,m.cn)("h-3 w-3 shrink-0 transition-transform duration-200",x&&"rotate-180")})]})}),(0,t.jsx)(F.CollapsibleContent,{children:(0,t.jsxs)("div",{className:"mt-2 space-y-4",children:[w?(0,t.jsxs)("section",{className:"space-y-2","data-testid":"answer-evidence-memory",children:[(0,t.jsxs)("div",{className:"flex min-w-0 items-center gap-1.5 text-xs font-medium text-muted-foreground",children:[(0,t.jsx)(g.Brain,{className:"h-3.5 w-3.5 shrink-0"}),(0,t.jsx)("span",{className:"shrink-0",children:h("qa.memory.referenceCount",{count:j})}),s?(0,t.jsxs)("span",{className:"max-w-[240px] truncate text-muted-foreground/70",children:["· ",s]}):null]}),(0,t.jsx)(W,{hits:e,memoryStoreName:a,scope:n})]}):null,k?(0,t.jsxs)("section",{className:"space-y-2","data-testid":"answer-evidence-wiki",children:[(0,t.jsxs)("div",{className:"flex min-w-0 items-center gap-1.5 text-xs font-medium text-muted-foreground",children:[(0,t.jsx)(_,{className:"h-3.5 w-3.5 shrink-0"}),(0,t.jsx)("span",{className:"shrink-0",children:h("qa.message.wikiReferences",{count:b})}),i?(0,t.jsxs)("span",{className:"max-w-[240px] truncate text-muted-foreground/70",children:["· ",h("qa.message.wikiQuery",{query:i})]}):null,void 0!==p?(0,t.jsxs)("span",{className:"shrink-0 text-muted-foreground/70",children:["·",h("qa.message.wikiTotalContextChars",{count:p})]}):null]}),(0,t.jsx)(B,{groups:y,memoryStoreName:c,scope:u})]}):null]})})]})}function U(e,t){try{let r=document.createElement("textarea");r.value=e,r.style.position="fixed",r.style.opacity="0",document.body.appendChild(r),r.select(),document.execCommand("copy"),document.body.removeChild(r),M.toast.success(t("qa.message.copied"))}catch{M.toast.error(t("qa.message.copyFailed"))}}let G=(0,r.memo)(function({message:e,busy:r,onDelete:s,onResend:a,onRegenerate:n,onEditSave:i,dreamActions:l}){return"user"===e.role?(0,t.jsx)(Z,{message:e,busy:r,onDelete:s,onResend:a,onEditSave:i}):(0,t.jsx)(Y,{message:e,busy:r,onDelete:s,onRegenerate:n,dreamActions:l})},(e,t)=>e.message===t.message&&e.busy===t.busy&&e.dreamActions===t.dreamActions);function H({align:e,disabled:r,onCopy:s,onDelete:a,onEdit:i,onResend:l,onRegenerate:o,onSaveToFile:c,dreamActions:u}){let{t:p}=(0,d.useI18n)(),h=u?.running!=null;return(0,t.jsxs)("div",{className:(0,m.cn)("mt-1 flex items-center gap-0.5 opacity-0 transition-opacity duration-150","group-hover:opacity-100 group-focus-within:opacity-100","group-data-[touched=true]:opacity-100","right"===e?"justify-end":"justify-start"),children:[(0,t.jsx)(X,{title:p("qa.message.copy"),disabled:r,onClick:s,children:(0,t.jsx)(y.Copy,{className:"h-3.5 w-3.5"})}),i&&(0,t.jsx)(X,{title:p("qa.message.edit"),disabled:r,onClick:i,children:(0,t.jsx)(N.Pencil,{className:"h-3.5 w-3.5"})}),l&&(0,t.jsx)(X,{title:p("qa.message.resend"),disabled:r,onClick:l,children:(0,t.jsx)(n,{className:"h-3.5 w-3.5"})}),o&&(0,t.jsx)(X,{title:p("qa.message.regenerate"),disabled:r,onClick:o,children:(0,t.jsx)(C.RotateCcw,{className:"h-3.5 w-3.5"})}),c&&(0,t.jsx)(X,{title:p("qa.message.saveToFile"),disabled:r,onClick:c,children:(0,t.jsx)(b.FolderTree,{className:"h-3.5 w-3.5"})}),u&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(X,{title:p("qa.message.summarizeSkill"),disabled:r||h,onClick:u.onSummarizeSkill,children:"skill"===u.running?(0,t.jsx)(k.Loader2,{className:"h-3.5 w-3.5 animate-spin"}):(0,t.jsx)(w,{className:"h-3.5 w-3.5"})}),(0,t.jsx)(X,{title:p("qa.message.extractProfile"),disabled:r||h,onClick:u.onExtractProfile,children:"profile"===u.running?(0,t.jsx)(k.Loader2,{className:"h-3.5 w-3.5 animate-spin"}):(0,t.jsx)(q,{className:"h-3.5 w-3.5"})})]}),(0,t.jsx)(X,{title:p("qa.message.delete"),disabled:r,onClick:a,destructive:!0,children:(0,t.jsx)(I.Trash2,{className:"h-3.5 w-3.5"})})]})}function X({title:e,disabled:r,destructive:s,onClick:a,children:n}){return(0,t.jsx)(l.Button,{type:"button",variant:"ghost",size:"icon",title:e,"aria-label":e,disabled:r,onClick:a,className:(0,m.cn)("h-7 w-7 text-muted-foreground hover:text-foreground",s&&"hover:text-[hsl(var(--destructive))] hover:bg-[hsl(var(--destructive))]/10"),children:n})}function V({rewriteFailed:e,rewriteError:r,failedKbCount:s,failedKbDetails:a,failedWikiCount:n,failedWikiDetails:i}){let{t:l}=(0,d.useI18n)(),o=!!e,c=(s??0)>0,m=(n??0)>0;return o||c||m?(0,t.jsxs)("div",{className:"space-y-1.5",children:[o&&(0,t.jsx)(J,{label:l("qa.message.rewriteFailed"),detail:r??l("qa.message.rewriteFailedDetail")}),c&&a&&(0,t.jsx)(J,{label:l("qa.message.kbRetrievalFailed",{count:s??0}),detail:a.map(e=>`• ${e.name}: ${e.reason}`).join("\n")}),m&&i&&(0,t.jsx)(J,{label:l("qa.message.wikiRetrievalFailed",{count:n??0}),detail:i.map(e=>`• ${e.name}: ${e.reason}`).join("\n")})]}):null}function J({label:e,detail:s}){let[a,n]=(0,r.useState)(!1);return(0,t.jsxs)("div",{className:"rounded-md border border-amber-500/30 bg-amber-500/5",children:[(0,t.jsxs)("button",{type:"button",onClick:()=>n(e=>!e),className:(0,m.cn)("flex w-full items-center gap-1.5 px-2 py-1 text-xs","text-amber-700 hover:bg-amber-500/10 dark:text-amber-300"),children:[(0,t.jsx)(h.AlertTriangle,{className:"h-3.5 w-3.5 shrink-0"}),(0,t.jsx)("span",{className:"flex-1 text-left",children:e}),(0,t.jsx)(v.ChevronDown,{className:(0,m.cn)("h-3 w-3 opacity-60 transition-transform duration-150",a&&"rotate-180")})]}),a&&(0,t.jsx)("pre",{className:"border-t border-amber-500/20 px-2 py-1.5 text-[11px] leading-relaxed text-amber-700/80 dark:text-amber-300/80 whitespace-pre-wrap font-mono",children:s})]})}function Z({message:e,busy:s,onDelete:a,onResend:n,onEditSave:i}){let{t:c}=(0,d.useI18n)(),[m,u]=(0,r.useState)(!1),[p,h]=(0,r.useState)(!1),[x,g]=(0,r.useState)(e.content),[f,v]=(0,r.useState)(!1),[y,j]=(0,r.useState)(!1),[b,w]=(0,r.useState)(!0),k=(0,r.useCallback)(()=>{if(e.content)try{navigator.clipboard&&window.isSecureContext?navigator.clipboard.writeText(e.content).then(()=>M.toast.success(c("qa.message.copied")),()=>{U(e.content,c)}):U(e.content,c)}catch{U(e.content,c)}},[e.content,c]),N=(0,r.useCallback)(()=>{let t=x.trim();if(!t||t===e.content){h(!1),g(e.content);return}h(!1),i(e.id,t)},[x,e.content,e.id,i]),C=(0,r.useCallback)(()=>{g(e.content),h(!1)},[e.content]),S=(0,r.useCallback)(e=>{"Escape"===e.key?(e.preventDefault(),C()):"Enter"===e.key&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),N())},[N,C]);return(0,t.jsxs)("div",{className:"group flex justify-end","data-touched":m?"true":void 0,onClickCapture:()=>u(!0),children:[(0,t.jsxs)("div",{className:"flex max-w-[85%] flex-col items-end",children:[p?(0,t.jsxs)("div",{className:"w-full max-w-2xl rounded-2xl border border-[hsl(var(--primary))] bg-[hsl(var(--background))] p-2",children:[(0,t.jsx)(o.Textarea,{autoFocus:!0,value:x,onChange:e=>g(e.target.value),onKeyDown:S,className:"min-h-[80px] resize-y border-0 p-2 text-sm shadow-none focus-visible:ring-0"}),(0,t.jsxs)("div",{className:"mt-1 flex justify-end gap-2",children:[(0,t.jsx)(l.Button,{type:"button",variant:"ghost",size:"sm",onClick:C,children:c("qa.message.cancel")}),(0,t.jsx)(l.Button,{type:"button",size:"sm",disabled:!x.trim()||x.trim()===e.content,onClick:N,children:c("qa.message.saveAndResend")})]})]}):(0,t.jsx)("div",{className:"rounded-2xl rounded-tr-sm bg-[hsl(var(--muted)/0.7)] px-4 py-2.5 text-sm leading-relaxed text-foreground whitespace-pre-wrap",children:e.content}),!p&&(0,t.jsx)(H,{align:"right",disabled:s,onCopy:k,onEdit:()=>{g(e.content),h(!0)},onResend:()=>j(!0),onDelete:()=>v(!0)})]}),(0,t.jsx)(E.ConfirmDialog,{open:f,onOpenChange:v,title:c("qa.message.deleteMessageTitle"),description:c("qa.message.deleteMessageDesc"),confirmText:c("qa.message.deleteConfirm"),variant:"danger",onConfirm:()=>{a(e.id,{withNextAssistant:b}),v(!1)},children:(0,t.jsxs)("label",{className:"flex items-center gap-2 text-sm text-foreground",children:[(0,t.jsx)(R.Checkbox,{checked:b,onCheckedChange:e=>w(!0===e)}),c("qa.message.deleteWithAssistant")]})}),(0,t.jsx)(E.ConfirmDialog,{open:y,onOpenChange:j,title:c("qa.message.resendMessageTitle"),description:c("qa.message.resendMessageDesc"),confirmText:c("qa.message.resendConfirm"),onConfirm:()=>{j(!1),n(e.id)}})]})}function Y({message:e,busy:s,onDelete:a,onRegenerate:n,dreamActions:i}){let{t:l}=(0,d.useI18n)(),[o,c]=(0,r.useState)(!1),[m,u]=(0,r.useState)(!1),[h,x]=(0,r.useState)(!1),g=(0,T.useAddItem)(),f="streaming"===e.status,v="error"===e.status,y=(e.reasoning?.length??0)>0,j=(e.content?.length??0)>0,b=(e.wikiCount??0)>0&&!0!==e.wikiRetrievalDone,w=y||f&&(!j||b),k=!!e.usingRag&&!e.retrievalQuery,N=!!e.retrievalQuery&&!e.retrievedChunks&&!0!==e.wikiRetrievalDone,C=(e.retrievalGroups??[]).filter(e=>e.error).map(e=>({name:e.knowledgeBaseName,reason:e.error??""})),I=(e.wikiRetrievalGroups??[]).filter(e=>(e.errors?.length??0)>0),q=I.flatMap(e=>(e.errors??[]).map(t=>({name:e.wikiName,reason:`[${t.code}] ${t.message}${t.requestId?` (${t.requestId})`:""}`}))),R=(0,r.useCallback)(()=>{if(e.content)try{navigator.clipboard&&window.isSecureContext?navigator.clipboard.writeText(e.content).then(()=>M.toast.success(l("qa.message.copied")),()=>{U(e.content,l)}):U(e.content,l)}catch{U(e.content,l)}},[e.content,l]);async function F(){if(!e.memoryFilesWritable||!e.memoryFilesStoreName||!e.memoryFilesScope)return;let t=new Date(e.createdAt).toISOString().replace(/[:.]/g,"-"),r=`/conversations/${t}-${e.id.slice(0,8)}.md`,s=window.prompt(l("qa.message.savePathPrompt"),r);if(null===s)return;let a=(0,$.normalizeFileMemoryPath)(s);if((0,$.validateFileMemoryPath)(a)||(0,$.validateFileMemoryContent)(e.content))return void M.toast.error(l("qa.message.saveToFileInvalid"));try{await g.mutateAsync({memoryStoreName:e.memoryFilesStoreName,scope:e.memoryFilesScope,path:a,content:e.content,view:"full"}),M.toast.success(l("qa.message.savedToFile",{path:a}))}catch(e){M.toast.error(e instanceof Error?e.message:l("qa.message.saveToFileFailed"))}}return(0,t.jsxs)("div",{className:"group space-y-3 text-sm leading-relaxed","data-touched":o?"true":void 0,onClickCapture:()=>c(!0),children:[w?(0,t.jsx)(et,{reasoning:e.reasoning??"",streaming:f,startedAt:e.reasoningStartedAt,completedAt:e.reasoningCompletedAt,intentExtracting:k,retrievalInFlight:N,wikiInFlight:b,wikiCount:e.wikiCount}):null,(0,t.jsx)(V,{rewriteFailed:e.queryRewriteFailed,rewriteError:e.queryRewriteError,failedKbCount:C.length,failedKbDetails:C,failedWikiCount:I.length,failedWikiDetails:q}),e.retrievalQueryRewritten&&e.retrievalQuery?(0,t.jsxs)("div",{className:"inline-flex max-w-full items-center gap-1.5 rounded-md bg-[hsl(var(--muted)/0.4)] px-2 py-1 text-xs text-muted-foreground",children:[(0,t.jsx)(S.Search,{className:"h-3 w-3 shrink-0"}),(0,t.jsx)("span",{className:"font-medium shrink-0",children:l("qa.message.retrievalKeyword")}),(0,t.jsx)("span",{className:"truncate font-mono text-foreground/80",children:e.retrievalQuery})]}):null,e.retrievedChunks&&e.retrievedChunks.length>0?(0,t.jsx)(er,{chunks:e.retrievedChunks,groups:e.retrievalGroups}):null,(0,t.jsx)(Q,{memoryHits:e.memoryHits,memoryQuery:e.memoryQuery,memoryStoreName:e.memoryFilesStoreName,memoryScope:e.memoryFilesScope,wikiQuery:e.wikiQuery,wikiEvidence:e.wikiEvidence,wikiRetrievalGroups:e.wikiRetrievalGroups,wikiMemoryStoreName:e.wikiMemoryStoreName,wikiScope:e.wikiScope,wikiTotalContextChars:e.wikiTotalContextChars}),e.memoryFiles?(0,t.jsx)(ei,{files:e.memoryFiles,cache:e.memoryFilesCache,memoryStoreName:e.memoryFilesStoreName,scope:e.memoryFilesScope}):null,(0,t.jsx)(ee,{message:e}),v?(0,t.jsxs)("div",{className:"flex items-start gap-2 rounded-md border border-[hsl(var(--destructive))/0.3] bg-[hsl(var(--destructive))/0.05] px-3 py-2 text-[hsl(var(--destructive))]",children:[(0,t.jsx)(p.default,{className:"mt-0.5 h-4 w-4 shrink-0"}),(0,t.jsx)("span",{className:"text-xs",children:e.errorMessage??l("qa.message.generateFailed")})]}):(0,t.jsxs)("div",{className:"text-foreground/90",children:[(0,t.jsx)(P.Markdown,{children:e.content}),f?(0,t.jsx)("span",{className:"ml-0.5 inline-block h-3.5 w-1.5 animate-pulse bg-foreground align-baseline"}):null]}),(0,t.jsx)(H,{align:"left",disabled:s||f,onCopy:R,onSaveToFile:e.memoryFilesWritable?()=>void F():void 0,onRegenerate:()=>x(!0),onDelete:()=>u(!0),dreamActions:i}),(0,t.jsx)(E.ConfirmDialog,{open:m,onOpenChange:u,title:l("qa.message.deleteReplyTitle"),description:l("qa.message.deleteReplyDesc"),confirmText:l("qa.message.deleteConfirm"),variant:"danger",onConfirm:()=>{a(e.id),u(!1)}}),(0,t.jsx)(E.ConfirmDialog,{open:h,onOpenChange:x,title:l("qa.message.regenerateTitle"),description:l("qa.message.regenerateDesc"),confirmText:l("qa.message.regenerateConfirm"),onConfirm:()=>{x(!1),n(e.id)}})]})}function ee({message:e}){let{t:r}=(0,d.useI18n)(),s=e.memorySaveStatus;if(!s)return null;let a=(0,m.cn)("inline-flex max-w-full items-center gap-1.5 rounded-md border px-2 py-1 text-xs","error"===s?"border-[hsl(var(--destructive)/0.3)] bg-[hsl(var(--destructive)/0.05)] text-[hsl(var(--destructive))]":"border-[hsl(var(--border))] bg-[hsl(var(--muted)/0.35)] text-muted-foreground");if("saving"===s)return(0,t.jsxs)("div",{className:a,role:"status",children:[(0,t.jsx)(k.Loader2,{className:"h-3.5 w-3.5 animate-spin"}),r("qa.message.memorySaving")]});if("error"===s)return(0,t.jsxs)("div",{className:a,role:"status",children:[(0,t.jsx)(h.AlertTriangle,{className:"h-3.5 w-3.5 shrink-0"}),(0,t.jsx)("span",{className:"truncate",children:r("qa.message.memorySaveFailed",{error:e.memorySaveError??r("common.unknownError")})})]});if("unchanged"===s)return(0,t.jsxs)("div",{className:a,role:"status",children:[(0,t.jsx)(g.Brain,{className:"h-3.5 w-3.5"}),r("qa.message.memoryUnchanged")]});let n=(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(f.CheckCircle2,{className:"h-3.5 w-3.5 shrink-0 text-[hsl(var(--primary))]"}),(0,t.jsx)("span",{children:r("qa.message.memorySaved",{count:e.memorySaveCount??0})}),e.memorySavePath?(0,t.jsx)("code",{className:"max-w-[260px] truncate font-mono text-[10px] text-[hsl(var(--primary))]",children:e.memorySavePath}):null]});return e.memorySavePath&&e.memoryFilesStoreName&&e.memoryFilesScope?(0,t.jsx)(u.default,{href:en(e.memoryFilesStoreName,e.memoryFilesScope,e.memorySavePath),className:(0,m.cn)(a,"hover:bg-[hsl(var(--accent))]"),children:n}):(0,t.jsx)("div",{className:a,role:"status",children:n})}function et({reasoning:e,streaming:s,startedAt:a,completedAt:n,intentExtracting:i,retrievalInFlight:l,wikiInFlight:o,wikiCount:c}){var u,p,h;let x,f,y,{t:j}=(0,d.useI18n)(),[b,w]=(0,r.useState)(!1),k=function(e,t){let[s,a]=(0,r.useState)(()=>Date.now());return((0,r.useEffect)(()=>{if(!e||t)return;let r=window.setInterval(()=>a(Date.now()),250);return()=>window.clearInterval(r)},[e,t]),e)?Math.max(0,(t??s)-e):null}(a,n),N=null!=k?(u=k,p=!s||!!n,h=j,f=Math.floor((x=Math.floor(u/1e3))/60),y=x%60,p?0===f?h("qa.message.elapsedSeconds",{seconds:y}):h("qa.message.elapsedMinutes",{minutes:f,seconds:y}):`${f}:${String(y).padStart(2,"0")}`):null,C=s&&!n,S=e.length>0,I=j("qa.reasoning.thinking");return S?I=j("qa.reasoning.deepThinking"):o?I=j("qa.message.retrievingWikis",{count:c??0}):l?I=j("qa.reasoning.retrieving"):i&&(I=j("qa.reasoning.intentExtracting")),(0,t.jsxs)(F.Collapsible,{open:b,onOpenChange:w,children:[(0,t.jsx)(F.CollapsibleTrigger,{asChild:!0,children:(0,t.jsxs)("button",{type:"button",disabled:!S,className:(0,m.cn)("group inline-flex items-center gap-2 rounded-full pl-1.5 pr-2.5 py-1 text-xs font-medium transition-all duration-200",C?"bg-[hsl(var(--primary)/0.08)] text-[hsl(var(--primary))] ring-1 ring-[hsl(var(--primary)/0.25)] shadow-[0_0_0_4px_hsl(var(--primary)/0.06)]":"bg-[hsl(var(--muted)/0.6)] text-muted-foreground hover:bg-[hsl(var(--accent))] hover:text-foreground",!S&&"cursor-default"),"aria-live":C?"polite":"off",children:[(0,t.jsxs)("span",{className:"relative inline-flex h-5 w-5 items-center justify-center",children:[C&&(0,t.jsx)("span",{"aria-hidden":!0,className:"absolute inset-0 rounded-full bg-[hsl(var(--primary))] opacity-40 blur-[6px] animate-thinking-aurora"}),(0,t.jsx)(g.Brain,{className:(0,m.cn)("relative h-3.5 w-3.5",C&&"animate-thinking-icon text-[hsl(var(--primary))]")})]}),C?(0,t.jsx)("span",{className:"animate-text-shimmer bg-[linear-gradient(90deg,hsl(var(--primary)/0.55)_0%,hsl(var(--primary))_50%,hsl(var(--primary)/0.55)_100%)] bg-[length:200%_100%] bg-clip-text text-transparent",children:I}):(0,t.jsx)("span",{children:j("qa.reasoning.done")}),N&&(0,t.jsxs)("span",{className:(0,m.cn)("tabular-nums text-[11px]",C?"text-[hsl(var(--primary)/0.75)]":"text-muted-foreground/80"),children:["· ",N]}),S&&(0,t.jsx)(v.ChevronDown,{className:(0,m.cn)("h-3 w-3 opacity-60 transition-transform duration-200",b&&"rotate-180",C&&"text-[hsl(var(--primary))]")})]})}),S&&(0,t.jsx)(F.CollapsibleContent,{children:(0,t.jsx)("div",{className:"mt-2 border-l-2 border-[hsl(var(--border))] pl-3 text-xs leading-relaxed text-muted-foreground whitespace-pre-wrap",children:e})})]})}function er({chunks:e,groups:s}){let{t:a}=(0,d.useI18n)(),[n,i]=(0,r.useState)(!1),l=new Map;e.forEach((e,t)=>{l.set(`${e.docId}#${e.chunkId}`,t+1)});let o=(s??[]).filter(e=>!e.error),c=(s??[]).filter(e=>e.error),u=o.length>=2||c.length>0;return(0,t.jsxs)(F.Collapsible,{open:n,onOpenChange:i,children:[(0,t.jsx)(F.CollapsibleTrigger,{asChild:!0,children:(0,t.jsxs)("button",{type:"button",className:"inline-flex items-center gap-1.5 rounded-md px-2 py-1 text-xs text-muted-foreground transition-colors hover:bg-[hsl(var(--accent))] hover:text-foreground",children:[(0,t.jsx)(x.BookOpen,{className:"h-3.5 w-3.5"}),a("qa.chunks.viewCitations",{count:e.length}),u?(0,t.jsxs)("span",{className:"text-muted-foreground/70",children:["· ",a("qa.chunks.kbCount",{count:o.length}),c.length>0?a("qa.chunks.failedSuffix",{count:c.length}):""]}):null,(0,t.jsx)(v.ChevronDown,{className:(0,m.cn)("h-3 w-3 transition-transform duration-200",n&&"rotate-180")})]})}),(0,t.jsx)(F.CollapsibleContent,{children:(0,t.jsx)("div",{className:"mt-2 space-y-3",children:u?(0,t.jsxs)(t.Fragment,{children:[o.map(e=>(0,t.jsx)(es,{group:e,indexByKey:l},`ok-${e.knowledgeBaseName}`)),c.map(e=>(0,t.jsxs)("div",{className:"rounded-md border border-[hsl(var(--destructive))/0.3] bg-[hsl(var(--destructive))/0.05] px-3 py-2 text-xs text-[hsl(var(--destructive))]",children:[(0,t.jsx)("span",{className:"font-medium",children:e.knowledgeBaseName}),(0,t.jsx)("span",{className:"ml-2 text-[hsl(var(--destructive))/0.8]",children:a("qa.chunks.retrievalFailed",{error:e.error??""})})]},`err-${e.knowledgeBaseName}`))]}):(0,t.jsx)("div",{className:"space-y-2",children:e.map((e,r)=>(0,t.jsx)(ea,{chunk:e,index:r+1},`${e.docId}-${e.chunkId}`))})})})]})}function es({group:e,indexByKey:r}){let{t:s}=(0,d.useI18n)();return(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 text-xs font-medium text-muted-foreground",children:[(0,t.jsx)("span",{className:"text-foreground/80",children:e.knowledgeBaseName}),(0,t.jsxs)("span",{children:["· ",s("qa.chunks.chunkCount",{count:e.chunks.length})]})]}),(0,t.jsx)("div",{className:"space-y-2 border-l-2 border-[hsl(var(--border))] pl-3",children:e.chunks.map(e=>{let s=`${e.docId}#${e.chunkId}`,a=r.get(s)??0;return(0,t.jsx)(ea,{chunk:e,index:a},`${e.docId}-${e.chunkId}`)})})]})}function ea({chunk:e,index:s}){let{t:a}=(0,d.useI18n)(),[n,i]=(0,r.useState)(null),[l,o]=(0,r.useState)(!1),c=e.ossKey?(0,m.extractFileName)(e.ossKey):a("qa.chunks.unknownFile"),u=e.chunkType?.toLowerCase()==="image",p=e.imageBase64?e.imageBase64.startsWith("data:")?e.imageBase64:`${D.IMAGE_FALLBACK_DATA_PREFIX}${e.imageBase64}`:void 0;return(0,t.jsxs)("div",{className:"rounded-md border border-[hsl(var(--border))] bg-[hsl(var(--muted)/0.3)] p-3",children:[(0,t.jsxs)("div",{className:"mb-1.5 flex items-center gap-2 text-xs text-muted-foreground",children:[(0,t.jsx)("span",{className:"inline-flex h-5 w-5 items-center justify-center rounded-full bg-[hsl(var(--primary-50))] font-semibold text-primary",children:s>0?s:"–"}),(0,t.jsx)("span",{className:"font-medium text-foreground/80",children:c}),(0,t.jsxs)("span",{children:["Chunk #",e.chunkId]}),u&&(0,t.jsx)("span",{className:"rounded bg-primary/10 px-1 py-0.5 text-[10px] font-medium text-primary",children:"IMAGE"}),(0,t.jsx)("span",{className:"ml-auto font-mono",children:e.score.toFixed(4)})]}),u&&p&&(0,t.jsx)("img",{src:p,alt:`Image chunk #${e.chunkId}`,className:"mt-2 max-w-[180px] max-h-[180px] object-contain rounded border border-border cursor-pointer hover:opacity-80 transition-opacity",onClick:()=>i(p)}),e.content&&(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)("p",{className:(0,m.cn)("whitespace-pre-wrap text-xs text-foreground/80 cursor-pointer",!l&&"line-clamp-4",u&&"mt-2"),onClick:()=>o(e=>!e),children:e.content}),!l&&(0,t.jsx)("div",{className:"pointer-events-none absolute bottom-0 left-0 right-0 h-8 bg-gradient-to-t from-[hsl(var(--muted)/0.3)] to-transparent"}),(0,t.jsx)("button",{type:"button",className:"mt-1 text-[10px] text-muted-foreground hover:text-foreground",onClick:()=>o(e=>!e),children:a(l?"qa.chunks.collapse":"qa.chunks.expand")})]}),(0,t.jsx)(A.Dialog,{open:!!n,onOpenChange:()=>i(null),children:(0,t.jsxs)(A.DialogContent,{className:"max-w-[90vw] max-h-[90vh] p-2 flex items-center justify-center border-none bg-black/90 data-[state=open]:animate-none data-[state=closed]:animate-none duration-0",children:[(0,t.jsx)(A.DialogTitle,{className:"sr-only",children:a("qa.chunks.imageZoomTitle")}),n&&(0,t.jsx)("img",{src:n,alt:a("qa.chunks.imageZoomAlt"),className:"max-w-full max-h-[85vh] object-contain"})]})})]})}function en(e,t,r){let s=new URLSearchParams({...t,view:"files"});return r&&s.set("file",r),`/memory/${encodeURIComponent(e)}/units?${s.toString()}`}function ei({files:e,cache:s,memoryStoreName:a,scope:n}){let{t:i}=(0,d.useI18n)(),[l,o]=(0,r.useState)(!1),c=s?.error?i("qa.memory.cacheFailed",{error:s.error}):i("qa.memory.cacheSummary",{loaded:s?.loaded??0,reused:s?.reused??0,total:s?.listed??e.length});return(0,t.jsxs)(F.Collapsible,{open:l,onOpenChange:o,children:[(0,t.jsx)(F.CollapsibleTrigger,{asChild:!0,children:(0,t.jsxs)("button",{type:"button",className:"inline-flex max-w-full items-center gap-1.5 rounded-md px-2 py-1 text-xs text-muted-foreground transition-colors hover:bg-[hsl(var(--accent))] hover:text-foreground",children:[(0,t.jsx)(b.FolderTree,{className:"h-3.5 w-3.5 shrink-0"}),i("qa.memory.filesThisTurn",{count:e.length}),(0,t.jsxs)("span",{className:(0,m.cn)("max-w-[260px] truncate",s?.error?"text-[hsl(var(--destructive))]":"text-muted-foreground/70"),children:["· ",c]}),(0,t.jsx)(v.ChevronDown,{className:(0,m.cn)("h-3 w-3 shrink-0 transition-transform duration-200",l&&"rotate-180")})]})}),(0,t.jsx)(F.CollapsibleContent,{children:(0,t.jsxs)("div",{className:"mt-2 space-y-1 rounded-md border border-[hsl(var(--border))] bg-[hsl(var(--muted)/0.3)] p-3",children:[s?.truncated?(0,t.jsx)("p",{className:"mb-1.5 text-[10px] text-amber-700 dark:text-amber-300",children:i("qa.memory.cacheTruncated")}):null,0===e.length?(0,t.jsx)("p",{className:"text-xs text-muted-foreground/70",children:i("qa.memory.emptyFiles")}):e.map(e=>{let r=(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(j.FileText,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),(0,t.jsx)("span",{className:"min-w-0 truncate font-mono",title:e.rel,children:e.rel}),(0,t.jsx)("span",{className:"ml-auto shrink-0 font-mono text-muted-foreground",children:i("qa.memory.fileSize",{size:e.size})})]});return a&&n?(0,t.jsx)(u.default,{href:en(a,n,e.rel),className:"flex items-center gap-2 rounded px-1 py-0.5 text-xs text-foreground/80 hover:bg-[hsl(var(--accent))] hover:text-[hsl(var(--primary))]",children:r},e.rel):(0,t.jsx)("div",{className:"flex items-center gap-2 text-xs text-foreground/80",children:r},e.rel)})]})})]})}G.displayName="QaMessage",e.s(["QaChatPanel",0,function({messages:e,isStreaming:a,canSend:u,error:p,onSend:h,onStop:x,onDelete:g,onResend:f,onRegenerate:v,onEditSave:y,emptyState:j,disabledPlaceholder:b,dreamDeposit:w}){let{t:k}=(0,d.useI18n)(),[N,C]=(0,r.useState)(""),S=(0,r.useMemo)(()=>{for(let t=e.length-1;t>=0;t--)if("assistant"===e[t].role)return e[t].id;return null},[e]),I=(0,r.useMemo)(()=>{if(w?.eligible)return{running:w.running,onSummarizeSkill:w.onSummarizeSkill,onExtractProfile:w.onExtractProfile}},[w?.eligible,w?.running,w?.onSummarizeSkill,w?.onExtractProfile]),q=(0,r.useRef)(null),M=(0,r.useRef)(e.length);(0,r.useEffect)(()=>{let t=q.current;if(!t)return;let r=e.length>M.current;(M.current=e.length,r)?requestAnimationFrame(()=>{t.scrollTo({top:t.scrollHeight,behavior:"smooth"})}):t.scrollHeight-t.scrollTop-t.clientHeight<120&&t.scrollTo({top:t.scrollHeight,behavior:"smooth"})},[e]);let R=()=>{let e=N.trim();e&&u&&!a&&(h(e),C(""))};return(0,t.jsxs)("div",{className:"flex h-full min-h-0 flex-1 flex-col bg-[hsl(var(--card))]",children:[(0,t.jsx)("div",{ref:q,role:"log","aria-live":"polite","aria-relevant":"additions text","aria-busy":a,className:"flex-1 space-y-6 overflow-y-auto px-6 py-5",children:0===e.length?(0,t.jsx)("div",{className:"flex h-full min-h-[320px] items-center justify-center",children:(0,t.jsx)(c.EmptyState,{icon:s.MessageSquare,title:j?.title??k("qa.panel.emptyTitle"),description:j?.description??k("qa.panel.emptyDescription"),action:j?.actionLabel&&j?.onAction?(0,t.jsx)(l.Button,{type:"button",onClick:j.onAction,children:j.actionLabel}):void 0})}):e.map(e=>(0,t.jsx)(G,{message:e,busy:a,onDelete:g,onResend:f,onRegenerate:v,onEditSave:y,dreamActions:e.id===S?I:void 0},e.id))}),(0,t.jsxs)("div",{className:"border-t border-[hsl(var(--border))] bg-[hsl(var(--surface)/0.6)] px-4 py-3",children:[p&&(0,t.jsx)("p",{className:"mb-2 text-xs text-[hsl(var(--destructive))]",children:p}),(0,t.jsxs)("div",{className:"flex items-end gap-2",children:[(0,t.jsx)(o.Textarea,{value:N,onChange:e=>C(e.target.value),onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||e.nativeEvent.isComposing||(e.preventDefault(),R())},placeholder:u?k("qa.panel.composerPlaceholder"):b??k("qa.panel.composerDisabled"),disabled:!u,className:(0,m.cn)("min-h-[44px] max-h-40 resize-none text-sm"),rows:1}),a?(0,t.jsx)(l.Button,{type:"button",variant:"outline",size:"icon",onClick:x,title:k("qa.panel.stop"),children:(0,t.jsx)(i,{className:"h-4 w-4 fill-current"})}):(0,t.jsx)(l.Button,{type:"button",size:"icon",disabled:!u||!N.trim(),onClick:R,title:k("qa.panel.send"),children:(0,t.jsx)(n,{className:"h-4 w-4"})})]})]})]})}],821122);var el=e.i(506703),eo=e.i(497634),ec=e.i(358204),ed=e.i(730068),em=e.i(153139),eu=e.i(766476),ep=e.i(636766),eh=e.i(166473),ex=e.i(870036),eg=e.i(543876),ef=e.i(392820),ev=e.i(247570),ey=e.i(307166);function ej({value:e,options:s,onChange:a,disabled:n,fetching:i}){let{t:o}=(0,d.useI18n)(),[c,u]=(0,r.useState)(!1),[p,h]=(0,r.useState)(""),x=p.trim(),g=(0,r.useMemo)(()=>{if(!x)return s;let e=x.toLowerCase();return s.filter(t=>t.toLowerCase().includes(e))},[s,x]),f=s.some(e=>e.toLowerCase()===x.toLowerCase()),v=x.length>0&&!f,y=e=>{a(e),h(""),u(!1)};return(0,t.jsxs)(ep.Popover,{open:c,onOpenChange:u,modal:!0,children:[(0,t.jsx)(ep.PopoverTrigger,{asChild:!0,children:(0,t.jsxs)(l.Button,{type:"button",variant:"outline",role:"combobox","aria-expanded":c,disabled:n,className:"w-full justify-between font-normal",children:[(0,t.jsx)("span",{className:(0,m.cn)("truncate text-left",!e&&"text-[hsl(var(--subtle))]"),children:e||o("common.modelSelector.selectOrInputModel")}),(0,t.jsx)(eo.ChevronsUpDown,{className:"h-4 w-4 shrink-0 opacity-50"})]})}),(0,t.jsx)(ep.PopoverContent,{align:"start",className:"w-[var(--radix-popover-trigger-width)] p-0",children:(0,t.jsxs)(em.Command,{shouldFilter:!1,children:[(0,t.jsx)(em.CommandInput,{placeholder:o("common.modelSelector.searchOrInputModel"),value:p,onValueChange:h}),(0,t.jsxs)(em.CommandList,{children:[0!==g.length||v?null:(0,t.jsx)(em.CommandEmpty,{children:o(i?"common.modelSelector.fetchingModels":0===s.length?"common.modelSelector.emptyModels":"common.modelSelector.noMatch")}),g.length>0&&(0,t.jsx)(em.CommandGroup,{heading:v?o("common.modelSelector.availableModels"):void 0,children:g.map(r=>(0,t.jsxs)(em.CommandItem,{value:r,onSelect:()=>y(r),children:[(0,t.jsx)(el.Check,{className:(0,m.cn)("h-4 w-4",e===r?"opacity-100":"opacity-0")}),(0,t.jsx)("span",{className:"truncate",children:r})]},r))}),v&&(0,t.jsx)(em.CommandGroup,{heading:o("common.modelSelector.useCustom"),children:(0,t.jsxs)(em.CommandItem,{value:`__custom__${x}`,onSelect:()=>y(x),children:[(0,t.jsx)(ec.Plus,{className:"h-4 w-4 text-[hsl(var(--primary))]"}),(0,t.jsx)("span",{className:"truncate",children:o("common.modelSelector.useTyped",{value:x})})]})})]})]})})]})}e.s(["LLMModelSelector",0,function({providerId:e,model:s,onProviderChange:a,onModelChange:n,autoSelectFirst:i=!1,providerLabel:o="Provider",modelLabel:c="Model"}){let{t:m}=(0,d.useI18n)(),{data:u=[],isLoading:p}=(0,ex.useLLMProviders)(),{data:h,isFetching:x,refetch:g}=function(e,t={}){let{context:r,ready:s}=(0,ey.useRuntimeContext)();return(0,eg.useQuery)({queryKey:ev.queryKeys.llmProviderModels(r.dataScopeKey,e),queryFn:()=>(0,ef.fetchProviderModels)(e),enabled:s&&!!e&&(t.enabled??!0),staleTime:3e5,retry:!1})}(e||void 0,{enabled:!!e});(0,r.useEffect)(()=>{if(!i||e||0===u.length)return;let t=u[0];a(t.id,t.defaultModel??"")},[i,e,u]);let f=(0,r.useMemo)(()=>{let t=new Set;for(let e of(s&&t.add(s),h??[]))t.add(e.id);let r=u.find(t=>t.id===e);return r?.defaultModel&&t.add(r.defaultModel),Array.from(t)},[s,h,u,e]);return(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(eu.Label,{className:"text-sm font-medium",children:o}),(0,t.jsxs)(eh.Select,{value:e,onValueChange:e=>{let t=u.find(t=>t.id===e);a(e,t?.defaultModel??"")},disabled:p||0===u.length,children:[(0,t.jsx)(eh.SelectTrigger,{children:(0,t.jsx)(eh.SelectValue,{placeholder:m(p?"common.modelSelector.loading":0===u.length?"common.modelSelector.noProviders":"common.modelSelector.selectProvider")})}),(0,t.jsx)(eh.SelectContent,{children:u.map(e=>(0,t.jsx)(eh.SelectItem,{value:e.id,children:e.name},e.id))})]})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)(eu.Label,{className:"text-sm font-medium",children:c}),(0,t.jsxs)(l.Button,{type:"button",variant:"ghost",size:"sm",className:"h-6 px-2 text-xs",disabled:!e||x,onClick:()=>g(),children:[x?(0,t.jsx)(k.Loader2,{className:"mr-1 h-3 w-3 animate-spin"}):(0,t.jsx)(ed.RefreshCw,{className:"mr-1 h-3 w-3"}),m("common.modelSelector.refreshList")]})]}),(0,t.jsx)(ej,{value:s,options:f,onChange:n,disabled:!e,fetching:x})]})]})}],550657),e.s(["SystemPromptInput",0,function({value:e,onChange:r,placeholder:s,helperText:a,rows:n=3,label:i}){let{t:l}=(0,d.useI18n)();return(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(eu.Label,{className:"text-sm font-medium",children:i??l("common.systemPrompt")}),(0,t.jsx)(o.Textarea,{rows:n,value:e,onChange:e=>r(e.target.value),placeholder:s,className:"text-sm"}),a&&(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:a})]})}],851024);var eb=e.i(563805);e.s(["TemperatureSlider",0,function({value:e,onChange:r,min:s=0,max:a=2,step:n=.05,fallback:i=.7,label:l}){let{t:o}=(0,d.useI18n)(),c=(e??i).toFixed(2);return(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between text-sm",children:[(0,t.jsx)("span",{className:"font-medium",children:l??o("common.temperature")}),(0,t.jsx)("span",{className:"font-mono text-xs text-muted-foreground",children:c})]}),(0,t.jsx)(eb.Slider,{value:[e??i],min:s,max:a,step:n,onValueChange:e=>r(e[0]??i)})]})}],109012)},567730,e=>{"use strict";var t=e.i(307166);e.s(["useActiveInstance",0,function(){let{context:e,ready:r}=(0,t.useRuntimeContext)();return{activeInstance:e.activeInstance,ready:r,dataScopeKey:e.dataScopeKey,configRevision:e.configRevision}}])},84625,272601,e=>{"use strict";async function*t(e,t){let s=await fetch("/api/v1/llm/chat",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),signal:t});if(!s.ok||!s.body){let e=`Chat request failed with status ${s.status}`,t="STREAM_ERROR";try{let r=await s.json();e=r.message??e,t=r.code??t}catch{}yield{type:"error",code:t,message:e};return}let a=s.body.getReader(),n=new TextDecoder("utf-8"),i="";for(;;){let{value:e,done:t}=await a.read();if(t)break;let s=(i+=n.decode(e,{stream:!0})).indexOf("\n\n");for(;-1!==s;){let e=i.slice(0,s);i=i.slice(s+2);let t=r(e);t&&(yield t),s=i.indexOf("\n\n")}}if(i.trim()){let e=r(i);e&&(yield e)}}function r(e){let t=e.split("\n"),r=[];for(let e of t)!(!e||e.startsWith(":"))&&e.startsWith("data:")&&r.push(e.slice(5).trimStart());if(0===r.length)return null;try{return JSON.parse(r.join("\n"))}catch{return null}}e.s(["streamChat",0,t],84625),e.s(["devFlag",0,function(e){try{return"1"===window.localStorage.getItem("tsagent.dev."+e)}catch{return!1}}],272601)},16346,e=>{"use strict";function t(e,t){let r=Array.from(e);return r.length<=t?e:t<=0?"":`${r.slice(0,t-1).join("")}…`}function r(e){return{reference:e.reference,wikiName:t(e.wikiName,256),path:t(e.path,1024),...void 0===e.title?{}:{title:t(e.title,512)},...void 0===e.type?{}:{type:t(e.type,128)},...void 0===e.description?{}:{description:t(e.description,2048)},...void 0===e.score?{}:{score:e.score},...void 0===e.sources?{}:{sources:e.sources.slice(0,8).map(e=>t(e,1024))},truncated:e.truncated,injectedChars:e.injectedChars}}function s(e){return{code:t(e.code,128),message:t(e.message,1024),...void 0===e.requestId?{}:{requestId:t(e.requestId,256)},...void 0===e.httpStatus?{}:{httpStatus:e.httpStatus},stage:e.stage,...void 0===e.path?{}:{path:t(e.path,1024)}}}e.s(["MAX_WIKI_ERRORS",0,4,"MAX_WIKI_EVIDENCE",0,6,"MAX_WIKI_GROUPS",0,10,"MAX_WIKI_SOURCES",0,8,"clampWikiEvidence",0,r,"clampWikiRetrievalError",0,s,"clampWikiRetrievalGroup",0,function(e){return{wikiName:t(e.wikiName,256),pages:e.pages.slice(0,6).map(r),...void 0===e.errors?{}:{errors:e.errors.slice(0,4).map(s)}}},"normalizeRequiredWikiMetadata",0,function(e){if("string"!=typeof e)return;let t=e.trim();return t.length>0?t:void 0}])},440596,786196,e=>{"use strict";var t=e.i(101685),r=e.i(515793),s=e.i(84625),a=e.i(828772),n=e.i(906962),i=e.i(272601),l=e.i(16346);function o(e,t){let r=e.findIndex(e=>e.id===t);return r<0?e:e.slice(0,r+1)}function c(e,t){let r=e.findIndex(e=>e.id===t);if(r<0)return e;let s=e.slice();return s.splice(r,1),s}function d(e,t){let r=e.findIndex(e=>e.id===t);if(r<0)return e;let s=e.slice(),a=e[r+1]&&"assistant"===e[r+1].role?2:1;return s.splice(r,a),s}function m(e){if(e)return{memoryStoreName:e.memoryStoreName,scope:{appId:e.scope.appId,tenantId:e.scope.tenantId,agentId:e.scope.agentId,runId:e.scope.runId},topK:e.topK}}function u(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}function p(e){if(!u(e))return null;let t=(0,l.normalizeRequiredWikiMetadata)(e.wikiName),r=(0,l.normalizeRequiredWikiMetadata)(e.path);return"string"==typeof e.reference&&/^W[1-6]$/.test(e.reference)&&t&&r&&"boolean"==typeof e.truncated&&Number.isInteger(e.injectedChars)&&!(e.injectedChars<0)&&!(e.injectedChars>8e3)?(0,l.clampWikiEvidence)({reference:e.reference,wikiName:t,path:r,..."string"==typeof e.title?{title:e.title}:{},..."string"==typeof e.type?{type:e.type}:{},..."string"==typeof e.description?{description:e.description}:{},..."number"==typeof e.score&&Number.isFinite(e.score)?{score:e.score}:{},...Array.isArray(e.sources)?{sources:e.sources.slice(0,l.MAX_WIKI_SOURCES).filter(e=>"string"==typeof e)}:{},truncated:e.truncated,injectedChars:e.injectedChars}):null}function h(e){if(!u(e))return null;let t=(0,l.normalizeRequiredWikiMetadata)(e.code),r=(0,l.normalizeRequiredWikiMetadata)(e.message);return t&&r&&("validate"===e.stage||"search"===e.stage||"read"===e.stage||"budget"===e.stage)?(0,l.clampWikiRetrievalError)({code:t,message:r,..."string"==typeof e.requestId?{requestId:e.requestId}:{},..."number"==typeof e.httpStatus&&Number.isFinite(e.httpStatus)&&Number.isInteger(e.httpStatus)?{httpStatus:e.httpStatus}:{},stage:e.stage,..."string"==typeof e.path?{path:e.path}:{}}):null}function x(e){if(!u(e))return null;let t=(0,l.normalizeRequiredWikiMetadata)(e.wikiName);return t&&Array.isArray(e.pages)?(0,l.clampWikiRetrievalGroup)({wikiName:t,pages:e.pages.slice(0,l.MAX_WIKI_EVIDENCE).map(p).filter(e=>null!==e),...Array.isArray(e.errors)?{errors:e.errors.slice(0,l.MAX_WIKI_ERRORS).map(h).filter(e=>null!==e)}:{}}):null}async function g(e,t,r,s={}){var n,i;let l,o,c,d,u,p,h,{wireMemory:x,wireWiki:f}=(n=e.memory,i=e.wiki,l=!!n&&!!i&&n.memoryStoreName===i.memoryStoreName&&n.scope.appId===i.scope.appId&&n.scope.tenantId===i.scope.tenantId&&n.scope.agentId===i.scope.agentId&&n.scope.runId===i.scope.runId,o=function(e){if(!e)return;let t={...e,scope:{appId:e.scope.appId,tenantId:e.scope.tenantId,agentId:e.scope.agentId,runId:e.scope.runId}};return"filemem"!==t.storageMode?t:{...t,scope:{...t.scope,runId:a.FILEMEM_DEFAULT_RUN_ID},retrievalMode:"local"}}(n),c=n?{...n,scope:{appId:n.scope.appId,tenantId:n.scope.tenantId,agentId:n.scope.agentId,runId:n.scope.runId}}:void 0,d=n?.storageMode==="filemem"&&i&&!l?c:o,p=(u=m(i))&&o?.storageMode==="filemem"&&l?{...u,memoryStoreName:o.memoryStoreName,scope:{appId:o.scope.appId,tenantId:o.scope.tenantId,agentId:o.scope.agentId,runId:o.scope.runId}}:u,{normalizedMemory:o,wireMemory:d,wireWiki:p});return h=x?{...x,turnId:r}:void 0,{activeInstance:e.activeInstance,providerId:e.providerId,model:e.model,messages:t,systemPrompt:e.systemPrompt,temperature:e.temperature,rag:e.rag,...h?{memory:h}:{},...f?{wiki:f}:{}}}e.s(["findUserAnchorAbove",0,function(e,t){let r=e.findIndex(e=>e.id===t);if(r<0)return null;for(let t=r-1;t>=0;t-=1)if("user"===e[t].role)return e[t];return null},"removeAt",0,c,"removePair",0,d,"truncateUpToAndIncluding",0,o],786196),e.s(["useQaChat",0,function(e){let{t:a}=(0,r.useI18n)(),h=(0,t.useRef)(a);h.current=a;let[f,v]=(0,t.useState)([]),[y,j]=(0,t.useState)(!1),[b,w]=(0,t.useState)(null),k=(0,t.useRef)(null),N=(0,t.useRef)(e.onPersist);N.current=e.onPersist;let C=(0,t.useRef)(f);C.current=f;let S=(0,t.useRef)(e);S.current=e;let I=(0,t.useRef)(y);I.current=y;let q=(0,t.useRef)(new Map),M=(0,t.useRef)(null),R=(0,t.useCallback)(()=>{M.current=null;let e=q.current;if(0===e.size)return;let t=new Map(e);e.clear();let r=C.current.map(e=>{let r=t.get(e.id);return r?{...e,...r.content?{content:e.content+r.content}:null,...r.reasoning?{reasoning:(e.reasoning??"")+r.reasoning}:null}:e});C.current=r,v(r)},[]),F=(0,t.useCallback)(()=>{if(null===M.current){if("u"<typeof requestAnimationFrame)return void R();M.current=requestAnimationFrame(R)}},[R]),A=(0,t.useCallback)(()=>{null!==M.current&&"u">typeof cancelAnimationFrame&&cancelAnimationFrame(M.current),M.current=null},[]);(0,t.useEffect)(()=>A,[A]);let E=(0,t.useCallback)(()=>{k.current?.abort()},[]),T=(0,t.useCallback)(()=>{k.current?.abort(),C.current=[],v([]),w(null)},[]),D=(0,t.useCallback)(e=>{k.current?.abort(),C.current=e,v(e),w(null)},[]),$=(0,t.useCallback)(async(e,t,r)=>{var a;let n=S.current,o=m(n.wiki),c=new AbortController;k.current=c;let d={current:!1},h={current:!1},f=t=>{let r=C.current.map(r=>r.id===e?{...r,...t}:r);C.current=r,v(r)};try{let a=await g(n,t,r);for await(let r of((0,i.devFlag)("logChatRequest")&&(console.groupCollapsed("[chat] outgoing turn"),console.log("assistantId",e),console.log("messages",t),console.log("rag.knowledgeBases",n.rag?.knowledgeBases),console.groupEnd()),(0,s.streamChat)(a,c.signal)))if(u(r)){if("query.rewritten"===r.type)f({retrievalQuery:r.query,retrievalQueryRewritten:r.query!==r.original});else if("query.fallback"===r.type)f({retrievalQuery:r.original,retrievalQueryRewritten:!1,queryRewriteFailed:!0,queryRewriteError:r.reason});else if("retrieval.done"===r.type)f({retrievedChunks:r.chunks,retrievalGroups:r.byKnowledgeBase});else if("wiki.start"===r.type){let e=!u(r)||"wiki.start"!==r.type||"string"!=typeof r.query||!Number.isInteger(r.wikiCount)||r.wikiCount<1||r.wikiCount>10?null:{wikiQuery:r.query,wikiCount:r.wikiCount,wikiRetrievalDone:!1};e&&f(e)}else if("wiki.done"===r.type){let e=u(r)&&"wiki.done"===r.type&&"string"==typeof r.query&&Number.isInteger(r.totalContextChars)&&!(r.totalContextChars<0)&&!(r.totalContextChars>24e3)&&Array.isArray(r.pages)&&Array.isArray(r.byWiki)?{wikiQuery:r.query,wikiRetrievalDone:!0,wikiEvidence:r.pages.slice(0,l.MAX_WIKI_EVIDENCE).map(p).filter(e=>null!==e),wikiRetrievalGroups:r.byWiki.slice(0,l.MAX_WIKI_GROUPS).map(x).filter(e=>null!==e),wikiTotalContextChars:r.totalContextChars,...o?{wikiMemoryStoreName:o.memoryStoreName,wikiScope:{appId:o.scope.appId,tenantId:o.scope.tenantId,agentId:o.scope.agentId,runId:o.scope.runId}}:{}}:null;e&&f(e)}else if("memory.start"===r.type)f({memoryQuery:r.query});else if("memory.done"===r.type)f({memoryHits:r.hits});else if("memory.files"===r.type)f({memoryFiles:r.files,memoryFilesCache:r.cache,memoryFilesStoreName:r.memoryStoreName,memoryFilesWritable:r.writable,memoryFilesScope:r.scope});else if("memory.save.start"===r.type)f({memorySaveStatus:"saving",memorySavePath:void 0,memorySaveCount:void 0,memorySaveError:void 0});else if("memory.save.done"===r.type)f({memorySaveStatus:r.status,memorySavePath:r.path,memorySaveCount:r.count,memorySaveError:void 0});else if("memory.save.skipped"===r.type)f({memorySaveStatus:"error",memorySaveError:r.reason}),console.warn("[chat] memory.save.skipped:",r.reason);else if("reasoning.delta"===r.type){let t=q.current.get(e)??{};t.reasoning=(t.reasoning??"")+r.delta,q.current.set(e,t),d.current||(d.current=!0,f({reasoningStartedAt:Date.now()})),F()}else if("content.delta"===r.type){let t=q.current.get(e)??{};t.content=(t.content??"")+r.delta,q.current.set(e,t),d.current&&!h.current&&(h.current=!0,f({reasoningCompletedAt:Date.now()})),F()}else if("error"===r.type){A(),R();let e={status:"error",errorMessage:`${r.code}: ${r.message}`};d.current&&!h.current&&(e.reasoningCompletedAt=Date.now()),f(e),w(r.message);break}else if("done"===r.type){A(),R();let e={status:"done"};d.current&&!h.current&&(e.reasoningCompletedAt=Date.now()),f(e);break}}}catch(r){A(),R();let e=r instanceof DOMException&&"AbortError"===r.name,t=d.current&&!h.current?{reasoningCompletedAt:Date.now()}:void 0;if(e)f({status:"done",...t});else{let e=r instanceof Error?r.message:String(r);f({status:"error",errorMessage:e,...t}),w(e)}}finally{let t,r;A(),R();let s=(a=C.current,t=!1,r=a.map(r=>{if(r.id!==e||"saving"!==r.memorySaveStatus)return r;t=!0;let s={...r};return delete s.memorySaveStatus,delete s.memorySavePath,delete s.memorySaveCount,delete s.memorySaveError,s}),t?r:a);C.current=s,v(s),j(!1),k.current=null;let n=N.current;n&&n(s)}},[F,R,A]),P=(0,t.useCallback)(async e=>{let t=e.trim();if(!t||I.current)return;let r=S.current;if(!r.providerId||!r.model)return void w(h.current("qa.form.selectModelFirst"));w(null);let s=(0,n.newId)("turn"),a={id:(0,n.newId)(),role:"user",content:t,createdAt:Date.now(),status:"done",turnId:s},i=(0,n.newId)(),l=(r.rag?.knowledgeBases?.length??0)>0||!!r.wiki,o={id:i,role:"assistant",content:"",reasoning:"",createdAt:Date.now(),status:"streaming",usingRag:l},c=[...C.current,a].map(e=>({role:e.role,content:e.content})),d=[...C.current,a,o];C.current=d,v(d),j(!0),await $(i,c,s)},[$]),_=(0,t.useCallback)(async e=>{if(I.current)return;let t=S.current;if(!t.providerId||!t.model)return void w(h.current("qa.form.selectModelFirst"));let r=o(C.current,e),s=r[r.length-1];if(!s||"user"!==s.role)return;let a=s.turnId??(0,n.newId)("turn");if(!s.turnId){let e=r.length-1;r[e]={...s,turnId:a}}w(null);let i=(0,n.newId)(),l=(t.rag?.knowledgeBases?.length??0)>0||!!t.wiki,c={id:i,role:"assistant",content:"",reasoning:"",createdAt:Date.now(),status:"streaming",usingRag:l},d=r.map(e=>({role:e.role,content:e.content})),m=[...r,c];C.current=m,v(m),j(!0),await $(i,d,a)},[$]);return{messages:f,isStreaming:y,error:b,send:P,reissueTurn:_,deleteMessage:(0,t.useCallback)((e,t)=>{if(I.current)return;let r=C.current,s=r.find(t=>t.id===e);if(!s)return;let a="user"===s.role&&t?.withNextAssistant?d(r,e):c(r,e);C.current=a,v(a),N.current?.(a)},[]),editUserMessage:(0,t.useCallback)((e,t)=>{let r=C.current,s=r.findIndex(t=>t.id===e);if(s<0||"user"!==r[s].role)return null;let a=r.slice();return a[s]={...r[s],content:t},C.current=a,v(a),e},[]),stop:E,clear:T,setMessages:D}}],440596)}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,666458,e=>{"use strict";var r=e.i(44501),t=e.i(294237),s=e.i(876490);let a=(0,t.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:t,...i}){return(0,r.jsx)("div",{className:(0,s.cn)(a({variant:t}),e),...i})}])},124561,e=>{"use strict";var r=e.i(550458),t=e.i(792571),s=class extends r.QueryObserver{constructor(e,r){super(e,r)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){super.setOptions({...e,behavior:(0,t.infiniteQueryBehavior)()})}getOptimisticResult(e){return e.behavior=(0,t.infiniteQueryBehavior)(),super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"backward"}}})}createResult(e,r){let{state:s}=e,a=super.createResult(e,r),{isFetching:i,isRefetching:o,isError:n,isRefetchError:c}=a,d=s.fetchMeta?.fetchMore?.direction,l=n&&"forward"===d,u=i&&"forward"===d,p=n&&"backward"===d,m=i&&"backward"===d;return{...a,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:(0,t.hasNextPage)(r,s.data),hasPreviousPage:(0,t.hasPreviousPage)(r,s.data),isFetchNextPageError:l,isFetchingNextPage:u,isFetchPreviousPageError:p,isFetchingPreviousPage:m,isRefetchError:c&&!l&&!p,isRefetching:o&&!u&&!m}}},a=e.i(840870);e.s(["useInfiniteQuery",0,function(e,r){return(0,a.useBaseQuery)(e,s,r)}],124561)},858620,e=>{"use strict";var r=e.i(124561),t=e.i(137500),s=e.i(543876),a=e.i(712984),i=e.i(247570),o=e.i(307166),n=e.i(593321);function c(e){return`/api/v1/memory/stores/${encodeURIComponent(e)}/wikis`}function d(e,r={}){let t=new URLSearchParams;for(let[s,a]of(t.set("appId",e.appId),t.set("tenantId",e.tenantId),t.set("agentId",e.agentId),Object.entries(r)))void 0!==a&&t.set(s,String(a));return t.toString()}function l(e,r){return(0,n.apiPatch)(c(e),r)}function u(e,r){return(0,n.apiPost)(`${c(e)}/ingest`,r)}function p(e,r){return(0,n.apiPost)(`${c(e)}/sources`,r)}function m(e,r){return(0,n.apiPut)(`${c(e)}/source`,r)}function h(e,r){return(0,n.apiDelete)(`${c(e)}/source`,r)}function y(e){return!!e?.trim()}function x(e,r){return y(e)&&!!r&&[r.appId,r.tenantId,r.agentId].every(e=>y(e)&&"*"!==e.trim())}function f(e){let r=(0,o.useDataScopeKey)(),s=(0,a.useQueryClient)();return(0,t.useMutation)({mutationFn:({memoryStoreName:r,...t})=>e(r,t),onSuccess:(e,t)=>s.invalidateQueries({queryKey:i.wikiQueryKeys.root(r,t.memoryStoreName,t.scope)})})}e.s(["useAddWikiSources",0,function(){return f(p)},"useIngestWiki",0,function(){return f(u)},"useRemoveWikiSource",0,function(){return f(h)},"useSearchWikiPages",0,function(e,r,t){let a=(0,o.useDataScopeKey)();return(0,s.useQuery)({queryKey:i.wikiQueryKeys.search(a,e??"",r,t.query,t.limit),queryFn:()=>{var s;return s={scope:r,query:t.query,...void 0!==t.limit?{limit:t.limit}:{}},(0,n.apiPost)(`${c(e)}/search`,s)},enabled:!1!==t.enabled&&x(e,r)&&t.query.trim().length>0})},"useUpdateWiki",0,function(){return f(l)},"useUpdateWikiSource",0,function(){return f(m)},"useWiki",0,function(e,r){let t=(0,o.useDataScopeKey)();return(0,s.useQuery)({queryKey:i.wikiQueryKeys.detail(t,e??"",r),queryFn:()=>(0,n.apiGet)(`${c(e)}?${d(r)}`),enabled:x(e,r)})},"useWikiArtifacts",0,function(e,t,s){let a=(0,o.useDataScopeKey)();return(0,r.useInfiniteQuery)({queryKey:i.wikiQueryKeys.artifacts(a,e??"",t,s.kind,s.limit),queryFn:({pageParam:r})=>{var a;let i;return i=d((a={scope:t,kind:s.kind,...void 0!==s.limit?{limit:s.limit}:{},..."string"==typeof r?{nextToken:r}:{}}).scope,{kind:a.kind,limit:a.limit,nextToken:a.nextToken}),(0,n.apiGet)(`${c(e)}/artifacts?${i}`)},getNextPageParam:e=>e.nextToken??void 0,initialPageParam:void 0,enabled:!1!==s.enabled&&x(e,t)})},"useWikiPage",0,function(e,r,t){let a=(0,o.useDataScopeKey)();return(0,s.useQuery)({queryKey:i.wikiQueryKeys.page(a,e??"",r,t?.path??""),queryFn:()=>{var s;let a;return a=d((s={scope:r,path:t.path}).scope,{path:s.path}),(0,n.apiGet)(`${c(e)}/page?${a}`)},enabled:x(e,r)&&y(t?.path)})},"useWikiPages",0,function(e,t,s={}){let l=(0,o.useDataScopeKey)(),u=(0,a.useQueryClient)(),p=i.wikiQueryKeys.pages(l,e??"",t,s.limit);return{...(0,r.useInfiniteQuery)({queryKey:p,queryFn:({pageParam:r})=>{var a;let i;return i=d((a={scope:t,...void 0!==s.limit?{limit:s.limit}:{},..."string"==typeof r?{nextToken:r}:{}}).scope,{limit:a.limit,nextToken:a.nextToken}),(0,n.apiGet)(`${c(e)}/pages?${i}`)},getNextPageParam:e=>e.nextToken??void 0,initialPageParam:void 0,retry:!1,enabled:!1!==s.enabled&&x(e,t)}),resetWikiPages:()=>u.resetQueries({queryKey:p,exact:!0})}},"useWikiSource",0,function(e,r,t){let a=(0,o.useDataScopeKey)();return(0,s.useQuery)({queryKey:i.wikiQueryKeys.source(a,e??"",r,t??""),queryFn:()=>{var s;let a;return a=d((s={scope:r,path:t}).scope,{path:s.path}),(0,n.apiGet)(`${c(e)}/source?${a}`)},enabled:x(e,r)&&y(t)})},"useWikiSources",0,function(e,t,s={}){let a=(0,o.useDataScopeKey)();return(0,r.useInfiniteQuery)({queryKey:i.wikiQueryKeys.sources(a,e??"",t,s.limit),queryFn:({pageParam:r})=>{var a;let i;return i=d((a={scope:t,...void 0!==s.limit?{limit:s.limit}:{},..."string"==typeof r?{nextToken:r}:{}}).scope,{limit:a.limit,nextToken:a.nextToken}),(0,n.apiGet)(`${c(e)}/sources?${i}`)},getNextPageParam:e=>e.nextToken??void 0,initialPageParam:void 0,enabled:!1!==s.enabled&&x(e,t)})}],858620)},736816,e=>{"use strict";var r=e.i(44501),t=e.i(101685),s=e.i(465581),a=e.i(65958),i=e.i(340975),o=e.i(858620),n=e.i(515793),c=e.i(828772),d=e.i(749448),l=e.i(593321),u=e.i(861403),p=e.i(666458),m=e.i(942595),h=e.i(810414);let y=new Set(["draft","stale","failed_with_fallback","blocked"]),x={loading:"secondary",draft:"secondary",building:"warning",ready:"success",stale:"warning",failed_with_fallback:"warning",blocked:"danger"},f={loading:"memory.scopeWorkspace.statusDescription.loading",draft:"memory.scopeWorkspace.statusDescription.draft",building:"memory.scopeWorkspace.statusDescription.building",ready:"memory.scopeWorkspace.statusDescription.ready",stale:"memory.scopeWorkspace.statusDescription.stale",failed_with_fallback:"memory.scopeWorkspace.statusDescription.failed_with_fallback",blocked:"memory.scopeWorkspace.statusDescription.blocked"};function g({view:e,segment:t,label:s}){return(0,r.jsx)(m.Button,{asChild:!0,size:"sm",variant:"outline",children:(0,r.jsx)(u.default,{href:(0,d.buildScopeFeatureHref)(e.memoryStoreName,t,e.scope),children:s})})}function k(e){return void 0!==e.chatStorageMode&&!e.memory.loading&&!e.memory.error}function j({view:e,t}){let s=(0,d.buildScopeFeatureHref)(e.memoryStoreName,"wiki",e.scope,{tab:"build"}),a=[e.scope.appId,e.scope.tenantId,e.scope.agentId,e.scope.runId].join(" / "),i="building"!==e.status||e.chat.wikiEnabled?f[e.status]:"memory.scopeWorkspace.statusDescription.firstBuilding";return(0,r.jsxs)("header",{className:"flex flex-col gap-4 rounded-xl border bg-card p-5 sm:flex-row sm:items-start sm:justify-between","data-storage-mode":e.storageMode,"data-testid":"scope-workspace-header",children:[(0,r.jsxs)("div",{className:"min-w-0",children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,r.jsx)("h2",{className:"text-lg font-semibold",children:t("memory.scopeWorkspace.title")}),(0,r.jsx)(p.Badge,{variant:x[e.status],children:t(`memory.scopeWorkspace.status.${e.status}`)})]}),(0,r.jsx)("p",{className:"mt-1 text-sm text-muted-foreground",children:t("memory.scopeWorkspace.description")}),(0,r.jsxs)("dl",{className:"mt-3 grid gap-x-5 gap-y-1 text-sm sm:grid-cols-2",children:[(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)("dt",{className:"text-muted-foreground",children:t("memory.scopeWorkspace.store")}),(0,r.jsx)("dd",{className:"font-medium",children:e.memoryStoreName})]}),(0,r.jsxs)("div",{className:"flex min-w-0 gap-2",children:[(0,r.jsx)("dt",{className:"shrink-0 text-muted-foreground",children:t("memory.scopeWorkspace.scope")}),(0,r.jsx)("dd",{className:"truncate font-medium",children:a})]})]}),(0,r.jsx)("p",{className:"mt-2 text-xs text-muted-foreground",children:t(i)})]}),(0,r.jsxs)("div",{className:"flex shrink-0 flex-wrap gap-2",children:[y.has(e.status)?(0,r.jsx)(m.Button,{asChild:!0,size:"sm",children:(0,r.jsx)(u.default,{href:s,children:t("memory.scopeWorkspace.reviewBuild")})}):null,k(e)?(0,r.jsx)(m.Button,{asChild:!0,size:"sm",variant:"outline",children:(0,r.jsx)(u.default,{href:(0,d.buildScopeChatHref)(e.memoryStoreName,e.chatStorageMode,e.scope,"auto"),children:t("memory.scopeWorkspace.openChat")})}):null]})]})}function v({view:e,t}){return(0,r.jsxs)(h.Card,{"data-testid":"scope-workspace-memory",children:[(0,r.jsxs)(h.CardHeader,{children:[(0,r.jsx)(h.CardTitle,{children:t("memory.scopeWorkspace.memoryTitle")}),(0,r.jsx)(h.CardDescription,{children:t("memory.scopeWorkspace.memoryDescription")})]}),(0,r.jsxs)(h.CardContent,{className:"space-y-2 text-sm",children:[e.memory.loading?(0,r.jsx)("p",{children:t("memory.scopeWorkspace.loading")}):null,e.memory.loading||e.memory.error?null:(0,r.jsx)("p",{children:t(e.memory.exists?"memory.scopeWorkspace.exists":"memory.scopeWorkspace.notFound")}),e.memory.error?(0,r.jsx)("p",{className:"text-danger",children:e.memory.error}):null]}),(0,r.jsxs)(h.CardFooter,{className:"gap-2",children:[(0,r.jsx)(g,{view:e,segment:"units",label:t("memory.scopeWorkspace.openUnits")}),(0,r.jsx)(g,{view:e,segment:"search",label:t("memory.scopeWorkspace.openSearch")})]})]})}function b({view:e,t}){return(0,r.jsxs)(h.Card,{"data-testid":"scope-workspace-dream",children:[(0,r.jsxs)(h.CardHeader,{children:[(0,r.jsx)(h.CardTitle,{children:t("memory.scopeWorkspace.dreamTitle")}),(0,r.jsx)(h.CardDescription,{children:t("memory.scopeWorkspace.dreamDescription")})]}),(0,r.jsxs)(h.CardContent,{className:"space-y-2 text-sm",children:[(0,r.jsx)("p",{children:t("memory.scopeWorkspace.skillCount",{count:e.dream.skillCount})}),(0,r.jsx)("p",{children:t("memory.scopeWorkspace.profileCount",{count:e.dream.profileCount})}),e.dream.partial?(0,r.jsx)("p",{className:"text-warning",children:t("memory.scopeWorkspace.partial")}):null,e.dream.error?(0,r.jsx)("p",{className:"text-danger",children:e.dream.error}):null]}),(0,r.jsxs)(h.CardFooter,{className:"gap-2",children:[(0,r.jsx)(g,{view:e,segment:"dream",label:t("memory.scopeWorkspace.openDream")}),(0,r.jsx)(m.Button,{asChild:!0,size:"sm",variant:"outline",children:(0,r.jsx)(u.default,{href:(0,d.buildScopeFeatureHref)(e.memoryStoreName,"wiki",e.scope,{tab:"build"}),children:t("memory.scopeWorkspace.reviewBuild")})})]})]})}function W({view:e,t}){let s=e.wiki.quality,a=e.wiki.changes;return(0,r.jsxs)(h.Card,{"data-testid":"scope-workspace-wiki",children:[(0,r.jsxs)(h.CardHeader,{children:[(0,r.jsx)(h.CardTitle,{children:t("memory.scopeWorkspace.wikiTitle")}),(0,r.jsx)(h.CardDescription,{children:t("memory.scopeWorkspace.wikiDescription")})]}),(0,r.jsxs)(h.CardContent,{className:"space-y-2 text-sm",children:[void 0!==e.wiki.pageCount?(0,r.jsx)("p",{children:t("memory.scopeWorkspace.pageCount",{count:e.wiki.pageCount})}):null,e.wiki.latestStatus?(0,r.jsx)("p",{children:t("memory.scopeWorkspace.latestStage",{status:e.wiki.latestStatus})}):null,s?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("p",{children:t("memory.scopeWorkspace.qualitySourceCoverage",{percent:Math.round(100*s.sourceCoverage)})}),(0,r.jsx)("p",{children:t("memory.scopeWorkspace.qualityGroundedRate",{percent:Math.round(100*s.groundedPageRate)})})]}):null,a?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("p",{children:t("memory.scopeWorkspace.changesAdded",{count:a.added})}),(0,r.jsx)("p",{children:t("memory.scopeWorkspace.changesModified",{count:a.modified})}),(0,r.jsx)("p",{children:t("memory.scopeWorkspace.changesDeleted",{count:a.deleted})}),(0,r.jsx)("p",{children:t("memory.scopeWorkspace.changesAffectedPages",{count:a.affectedPages})})]}):null,"stale"===e.status?(0,r.jsx)("p",{className:"text-warning",children:t("memory.scopeWorkspace.staleGuidance")}):null,"failed_with_fallback"===e.status?(0,r.jsx)("p",{className:"text-warning",children:t("memory.scopeWorkspace.fallbackGuidance")}):null,"building"===e.status?(0,r.jsx)("p",{className:"text-muted-foreground",children:t(e.chat.wikiEnabled?"memory.scopeWorkspace.buildingGuidance":"memory.scopeWorkspace.firstBuildGuidance")}):null,"draft"===e.status?(0,r.jsx)("p",{className:"text-muted-foreground",children:t("memory.scopeWorkspace.draftGuidance")}):null,e.wiki.error?(0,r.jsx)("p",{className:"text-danger",children:e.wiki.error}):null]}),(0,r.jsx)(h.CardFooter,{children:(0,r.jsx)(g,{view:e,segment:"wiki",label:t("memory.scopeWorkspace.openWiki")})})]})}function w({view:e,t}){return(0,r.jsxs)(h.Card,{"data-testid":"scope-workspace-chat",children:[(0,r.jsxs)(h.CardHeader,{children:[(0,r.jsx)(h.CardTitle,{children:t("memory.scopeWorkspace.chatTitle")}),(0,r.jsx)(h.CardDescription,{children:t("memory.scopeWorkspace.chatDescription")})]}),(0,r.jsxs)(h.CardContent,{className:"space-y-2 text-sm",children:[(0,r.jsx)("p",{children:t("memory.scopeWorkspace.chatMemoryEnabled")}),(0,r.jsx)("p",{children:t(e.chat.wikiEnabled?"memory.scopeWorkspace.chatWikiEnabled":"memory.scopeWorkspace.chatWikiDisabled")}),e.chat.usesFallback?(0,r.jsx)("p",{className:"text-warning",children:t("memory.scopeWorkspace.chatFallback")}):null]}),(0,r.jsx)(h.CardFooter,{children:k(e)?(0,r.jsx)(m.Button,{asChild:!0,size:"sm",children:(0,r.jsx)(u.default,{href:(0,d.buildScopeChatHref)(e.memoryStoreName,e.chatStorageMode,e.scope,"auto"),children:t("memory.scopeWorkspace.openChat")})}):null})]})}function N({view:e,t}){return(0,r.jsxs)("div",{className:"grid gap-4 lg:grid-cols-2",children:[(0,r.jsx)(v,{view:e,t:t}),(0,r.jsx)(b,{view:e,t:t}),(0,r.jsx)(W,{view:e,t:t}),(0,r.jsx)(w,{view:e,t:t})]})}function C(e){return!!(e.isPending||e.isLoading)}function S(e,r){if(e)return e instanceof l.ApiClientError?[e.displayMessage,e.requestId].filter(Boolean).join(" · "):r}function P(e){return(e.data?.pages??[]).flatMap(e=>e.artifacts)}function I({memoryStoreName:e,scope:t}){let s=(0,a.useMemoryStore)(e);if(C(s))return(0,r.jsx)(D,{state:"loading"});if(s.error)return(0,r.jsx)(D,{state:"error"});let i=(0,c.parseKnownStorageMode)(s.data?.storageMode);return null===i||"filemem"===i?(0,r.jsx)(D,{state:"unsupported"}):(0,r.jsx)(K,{memoryStoreName:e,scope:t,storageMode:i})}function D({state:e}){let{t}=(0,n.useI18n)();return(0,r.jsx)("div",{className:"rounded-lg border border-dashed bg-card px-6 py-10 text-center text-sm text-muted-foreground",children:t("loading"===e?"memory.scopeWorkspace.loading":"error"===e?"memory.scopeWorkspace.loadFailed":"memory.scopeWorkspace.unsupported")})}function K({memoryStoreName:e,scope:t,storageMode:s}){let{t:a}=(0,n.useI18n)(),c=(0,i.useMemoryStoreScopes)(e,t,{limit:1}),l=(0,o.useWiki)(e,t),u=(0,o.useWikiArtifacts)(e,t,{kind:"skill",limit:100}),p=(0,o.useWikiArtifacts)(e,t,{kind:"profile",limit:100}),m=P(u),h=P(p),y=!u.error&&!1===u.hasNextPage&&!p.error&&!1===p.hasNextPage&&!C(u)&&!C(p),x=l.data?.latestBuild,f=a("memory.scopeWorkspace.loadFailed"),g=S(l.error,f),k=S(c.error,f),v=(0,d.deriveScopeWorkspaceStatus)({loading:C(c)||C(l)||C(u)||C(p),error:l.error,wiki:l.data}),b=c.data?.items.some(e=>e.appId===t.appId&&e.tenantId===t.tenantId&&e.agentId===t.agentId&&e.runId===t.runId),W=l.data?.status==="ready",w=[S(u.error,f),S(p.error,f)].filter(Boolean).join(" · ")||void 0,I={memoryStoreName:e,storageMode:s,chatStorageMode:s,scope:t,status:v,memory:{exists:b,loading:C(c),error:k},dream:{skillCount:m.length,profileCount:h.length,partial:!y,error:w},wiki:{pageCount:l.data?.pageCount,quality:x?.quality,changes:x?.changes,latestStatus:x?.status,error:g},chat:{memoryEnabled:!0,wikiEnabled:W,usesFallback:"failed_with_fallback"===v}};return(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsx)(j,{view:I,t:a}),(0,r.jsx)(N,{view:I,t:a})]})}function T({memoryStoreName:e,search:s}){let{t:a}=(0,n.useI18n)(),i=(0,t.useMemo)(()=>(0,d.parseExactScope)(new URLSearchParams(s)),[s]);return i?(0,r.jsx)(I,{memoryStoreName:e,scope:i}):(0,r.jsxs)("div",{className:"rounded-xl border border-dashed px-6 py-12 text-center","data-testid":"scope-workspace-invalid",children:[(0,r.jsx)("h2",{className:"font-semibold",children:a("memory.scopeWorkspace.invalidTitle")}),(0,r.jsx)("p",{className:"mt-2 text-sm text-muted-foreground",children:a("memory.scopeWorkspace.invalidDescription")})]})}e.s(["ScopeWorkspaceRouteBoundary",0,T,"default",0,function(){let e=(0,s.useParams)(),t=(0,s.useSearchParams)().toString(),a=decodeURIComponent(e.store);return(0,r.jsx)(T,{memoryStoreName:a,search:t})}],736816)}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,772883,e=>{"use strict";var a=e.i(44501),r=e.i(101685),s=e.i(861403),t=e.i(465581),n=e.i(187014),l=e.i(553552),o=e.i(309823),i=e.i(942595),d=e.i(831211),m=e.i(433253),c=e.i(431592),p=e.i(12251),u=e.i(490314),x=e.i(543876),h=e.i(164204),y=e.i(247570),f=e.i(307166),g=e.i(115210),j=e.i(137500),b=e.i(712984),v=e.i(234752),N=e.i(663630),S=e.i(166473),T=e.i(563805),I=e.i(144308),w=e.i(322740),E=e.i(12122),k=e.i(326042),D=e.i(876490),C=e.i(515793);let A={ADD:"bg-success-soft text-success",UPDATE:"bg-info-soft text-info",DELETE:"bg-danger-soft text-danger",MERGE:"bg-[hsl(var(--primary-soft))] text-[hsl(var(--primary))]",NOOP:"bg-muted text-muted-foreground",EMIT_SKILL:"bg-success-soft text-success",EMIT_PROFILE:"bg-[hsl(var(--primary-soft))] text-[hsl(var(--primary))]"};function M({open:e,onOpenChange:r,memoryStoreName:s,selected:t,onConfirm:n,busy:l}){let{t:o}=(0,C.useI18n)(),d={};for(let e of t)d[e.action]=(d[e.action]??0)+1;let c=(d.DELETE??0)>0,p=t.slice(0,6),u=t.length-p.length;return(0,a.jsx)(m.Dialog,{open:e,onOpenChange:r,children:(0,a.jsxs)(m.DialogContent,{className:"max-w-xl",children:[(0,a.jsxs)(m.DialogHeader,{children:[(0,a.jsx)(m.DialogTitle,{children:o("memory.dream.apply.title")}),(0,a.jsxs)(m.DialogDescription,{children:[o("memory.dream.apply.descPrefix")," ",(0,a.jsx)("span",{className:"font-mono",children:s})," ",o("memory.dream.apply.descSuffix",{count:t.length})]})]}),(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsx)("div",{className:"flex flex-wrap items-center gap-2 rounded border border-[hsl(var(--border-light))] bg-[hsl(var(--muted)/0.3)] p-2",children:Object.keys(d).map(e=>(0,a.jsxs)("span",{className:(0,D.cn)("inline-flex items-center gap-1 rounded px-2 py-0.5 text-xs font-mono font-semibold",A[e]??"bg-muted text-muted-foreground"),children:[e," ",(0,a.jsxs)("span",{className:"font-normal opacity-80",children:["×",d[e]]})]},e))}),c&&(0,a.jsx)("p",{className:"rounded border border-[hsl(var(--destructive)/0.3)] bg-danger-soft/40 px-3 py-2 text-xs text-danger",children:o("memory.dream.apply.hasDestructive")}),(0,a.jsxs)("ul",{className:"max-h-72 space-y-1.5 overflow-auto rounded border border-[hsl(var(--border-light))] p-2",children:[p.map(e=>(0,a.jsxs)("li",{className:"flex items-start gap-2 text-xs",children:[(0,a.jsx)("span",{className:(0,D.cn)("mt-0.5 shrink-0 rounded px-1.5 py-0.5 font-mono text-[10px] font-semibold",A[e.action]??"bg-muted text-muted-foreground"),children:e.action}),(0,a.jsx)("span",{className:"line-clamp-2 flex-1 text-foreground/85",children:e.newMemory?.text??e.reason??`(${e.actionId.slice(0,12)}…)`})]},e.actionId)),u>0&&(0,a.jsxs)("li",{className:"pt-1 text-center text-[11px] italic text-muted-foreground",children:[(0,a.jsx)(v.Sparkles,{className:"mr-1 inline-block h-3 w-3"}),o("memory.dream.apply.remaining",{count:u})]})]})]}),(0,a.jsxs)(m.DialogFooter,{children:[(0,a.jsx)(i.Button,{variant:"outline",onClick:()=>r(!1),disabled:l,children:o("common.cancel")}),(0,a.jsx)(i.Button,{variant:c?"destructive":"default",onClick:n,disabled:l,children:l?o("memory.dream.apply.applying"):o("memory.dream.apply.confirm",{count:t.length})})]})]})})}let P={proposed:"bg-info-soft text-info",applied:"bg-success-soft text-success",skipped:"bg-muted text-muted-foreground",failed:"bg-danger-soft text-danger"},_={proposed:"memory.actionStatus.proposed",applied:"memory.actionStatus.applied",skipped:"memory.actionStatus.skipped",failed:"memory.actionStatus.failed"},L={ADD:"bg-success-soft text-success",UPDATE:"bg-info-soft text-info",DELETE:"bg-danger-soft text-danger",MERGE:"bg-[hsl(var(--primary-soft))] text-[hsl(var(--primary))]",NOOP:"bg-muted text-muted-foreground",EMIT_SKILL:"bg-success-soft text-success",EMIT_PROFILE:"bg-[hsl(var(--primary-soft))] text-[hsl(var(--primary))]"};function R({action:e}){return(0,a.jsx)("span",{className:(0,D.cn)("inline-flex items-center rounded px-1.5 py-0.5 text-[10px] font-mono font-semibold",L[e]??"bg-muted text-muted-foreground"),children:e})}function O({action:e,memoryStoreName:r,t:s}){let{action:t,newMemory:n,newExtract:l,targetMemoryId:o,targetScope:i,reason:d}=e;if("EMIT_SKILL"===t||"EMIT_PROFILE"===t)return l?(0,a.jsxs)("span",{className:"line-clamp-2 text-xs",children:[(0,a.jsx)("span",{className:(0,D.cn)("mr-1 rounded px-1 py-px text-[10px] font-medium","EMIT_SKILL"===t?"bg-success-soft text-success":"bg-[hsl(var(--primary-soft))] text-[hsl(var(--primary))]"),children:s("EMIT_SKILL"===t?"memory.dream.actions.skill":"memory.dream.actions.profile")}),l.name,l.description&&(0,a.jsxs)("span",{className:"text-muted-foreground",children:[" ","— ",l.description]})]}):(0,a.jsx)("span",{className:"text-muted-foreground",children:"—"});if("ADD"===t||"UPDATE"===t){let e=n?.text;return e?(0,a.jsxs)("span",{className:"line-clamp-2 text-xs",children:["UPDATE"===t&&(0,a.jsx)("span",{className:"mr-1 rounded bg-info-soft px-1 py-px text-[10px] text-info",children:s("memory.dream.actions.new")}),e]}):(0,a.jsx)("span",{className:"text-muted-foreground",children:"—"})}return"NOOP"===t?(0,a.jsx)("span",{className:"line-clamp-2 text-xs italic text-muted-foreground",children:d||s("memory.dream.actions.noop")}):(0,a.jsx)(K,{memoryStoreName:r,memoryId:o,scope:i,verbPrefix:s("DELETE"===t?"memory.dream.actions.delete":"memory.dream.actions.merge"),t:s})}function K({memoryStoreName:e,memoryId:r,scope:s,verbPrefix:t,t:n}){let l=(0,k.useMemoryUnit)(e,r,s);if(!r)return(0,a.jsx)("span",{className:"text-muted-foreground",children:"—"});if(l.isLoading)return(0,a.jsx)(d.Skeleton,{className:"h-3 w-32"});let o=l.data?.memory?.text;return o?(0,a.jsxs)("span",{className:"line-clamp-2 text-xs",children:[(0,a.jsx)("span",{className:"mr-1 rounded bg-warning-soft px-1 py-px text-[10px] text-warning",children:t}),o]}):(0,a.jsx)("span",{className:"text-xs text-muted-foreground",children:n("memory.dream.actions.memoryUnreadable",{verb:t})})}function F({status:e,t:r}){let s=_[e];return(0,a.jsx)("span",{className:(0,D.cn)("inline-flex items-center rounded-full px-2 py-0.5 text-[11px] font-medium select-none whitespace-nowrap",P[e]??"bg-muted text-muted-foreground"),children:s?r(s):e})}function q(e){return e&&[e.appId,e.tenantId,e.agentId,e.runId].filter(Boolean).join(" / ")||"-"}function U({memoryStoreName:e,dreamId:t,taskType:l,artifactWikiHref:o}){let m,{t:c}=(0,C.useI18n)(),p=(0,r.useMemo)(()=>[{value:"all",label:c("memory.dream.actions.allStatus")},{value:"proposed",label:c("memory.actionStatus.proposed")},{value:"applied",label:c("memory.actionStatus.applied")},{value:"skipped",label:c("memory.actionStatus.skipped")},{value:"failed",label:c("memory.actionStatus.failed")}],[c]),u=(0,r.useMemo)(()=>[{value:"all",label:c("memory.dream.actions.allTypes")},{value:"ADD",label:"ADD"},{value:"UPDATE",label:"UPDATE"},{value:"DELETE",label:"DELETE"},{value:"MERGE",label:"MERGE"},{value:"NOOP",label:"NOOP"},{value:"EMIT_SKILL",label:"EMIT_SKILL"},{value:"EMIT_PROFILE",label:"EMIT_PROFILE"}],[c]),g=(0,r.useMemo)(()=>[{value:"created_at_asc",label:c("memory.dream.actions.orderCreatedAsc")},{value:"created_at_desc",label:c("memory.dream.actions.orderCreatedDesc")},{value:"confidence_desc",label:c("memory.dream.actions.orderConfidenceDesc")}],[c]),k="skill"===l||"profile"===l,[D,A]=(0,r.useState)("all"),[P,_]=(0,r.useState)("all"),[L,K]=(0,r.useState)("created_at_asc"),[B,z]=(0,r.useState)(0),Q=function(e,a,r,s){let{context:t,ready:n}=(0,f.useRuntimeContext)();return(0,x.useQuery)({queryKey:y.queryKeys.dreamActions(t.dataScopeKey,e,a,r,s?.nextToken,s?.limit),queryFn:()=>(0,h.listDreamActions)(e,a,r,s),enabled:n&&!!e&&!!a})}(e,t,(0,r.useMemo)(()=>{let e={orderBy:L};return"all"!==D&&(e.status=D),"all"!==P&&(e.action=P),B>0&&(e.minConfidence=B),e},[D,P,L,B]),{limit:100}),W=Q.data?.items??[],[G,V]=(0,r.useState)(new Set),[$,J]=(0,r.useState)(null),[X,Y]=(0,r.useState)(!1),Z=(m=(0,b.useQueryClient)(),(0,j.useMutation)({mutationFn:({actionIds:a,applier:r})=>(0,h.applyDreamActions)(e,t,a,r),onSuccess:()=>{m.invalidateQueries({queryKey:["memory"],predicate:a=>Array.isArray(a.queryKey)&&a.queryKey.includes(e)&&a.queryKey.includes(t)}),m.invalidateQueries({queryKey:["memory"],predicate:a=>Array.isArray(a.queryKey)&&a.queryKey.includes(e)&&(a.queryKey.includes("units")||a.queryKey.includes("scopes"))})}})),ee=e=>"proposed"===e.status&&"EMIT_SKILL"!==e.action&&"EMIT_PROFILE"!==e.action,ea=W.filter(ee).length,er=ea>0&&W.every(e=>!ee(e)||G.has(e.actionId)),es=async()=>{try{let e=await Z.mutateAsync({actionIds:Array.from(G)});n.toast.success(c("memory.dream.actions.applyResult",{applied:e.applied,failed:e.failed})),V(new Set),Y(!1)}catch(a){let e=a instanceof Error?a.message:c("memory.dream.actions.applyFailed");n.toast.error(e)}};return(0,a.jsx)(E.TooltipProvider,{children:(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-3 rounded-md border border-[hsl(var(--border-light))] p-3",children:[(0,a.jsxs)(S.Select,{value:D,onValueChange:A,children:[(0,a.jsx)(S.SelectTrigger,{className:"h-8 w-32 text-sm",children:(0,a.jsx)(S.SelectValue,{})}),(0,a.jsx)(S.SelectContent,{children:p.map(e=>(0,a.jsx)(S.SelectItem,{value:e.value,children:e.label},e.value))})]}),!k&&(0,a.jsxs)(S.Select,{value:P,onValueChange:_,children:[(0,a.jsx)(S.SelectTrigger,{className:"h-8 w-32 text-sm",children:(0,a.jsx)(S.SelectValue,{})}),(0,a.jsx)(S.SelectContent,{children:u.map(e=>(0,a.jsx)(S.SelectItem,{value:e.value,children:e.label},e.value))})]}),(0,a.jsxs)(S.Select,{value:L,onValueChange:e=>K(e),children:[(0,a.jsx)(S.SelectTrigger,{className:"h-8 w-32 text-sm",children:(0,a.jsx)(S.SelectValue,{})}),(0,a.jsx)(S.SelectContent,{children:g.map(e=>(0,a.jsx)(S.SelectItem,{value:e.value,children:e.label},e.value))})]}),!k&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"text-xs text-muted-foreground",children:c("memory.dream.actions.minConfidence")}),(0,a.jsx)(T.Slider,{value:[B],max:1,step:.05,onValueChange:e=>z(e[0]??0),className:"w-32"}),(0,a.jsx)("span",{className:"font-mono text-xs",children:B.toFixed(2)})]}),(0,a.jsxs)("div",{className:"ml-auto flex items-center gap-2",children:[(0,a.jsx)("span",{className:"text-xs text-muted-foreground",children:c("memory.dream.actions.selectedCount",{count:G.size})}),(0,a.jsx)(i.Button,{size:"sm",disabled:0===G.size||Z.isPending,onClick:()=>Y(!0),children:Z.isPending?c("memory.dream.actions.applying"):c("memory.dream.actions.applySelected",{count:G.size})})]})]})]}),Q.isLoading?(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)(d.Skeleton,{className:"h-10 w-full"}),(0,a.jsx)(d.Skeleton,{className:"h-10 w-full"})]}):0===W.length?(0,a.jsxs)("div",{className:"rounded-lg border border-dashed border-[hsl(var(--border))] py-10 text-center text-sm text-muted-foreground",children:[(0,a.jsx)(v.Sparkles,{className:"mx-auto mb-2 h-6 w-6 text-muted-foreground/60"}),k?c("memory.dream.actions.emptyExtract"):c("memory.dream.actions.emptyFiltered")]}):(0,a.jsx)("div",{className:"rounded-lg border border-[hsl(var(--border))]",children:(0,a.jsxs)(w.Table,{children:[(0,a.jsx)(w.TableHeader,{children:(0,a.jsxs)(w.TableRow,{children:[!k&&(0,a.jsx)(w.TableHead,{className:"w-8",children:(0,a.jsx)(N.Checkbox,{checked:er,onCheckedChange:()=>{er?V(new Set):V(new Set(W.filter(ee).map(e=>e.actionId)))},disabled:0===ea,"aria-label":c("memory.dream.actions.selectAll")})}),(0,a.jsx)(w.TableHead,{children:k?c("memory.dream.actions.colOutputType"):c("memory.dream.actions.colType")}),(0,a.jsx)(w.TableHead,{children:c("memory.dream.actions.colStatus")}),(0,a.jsx)(w.TableHead,{children:c("memory.common.targetScope")}),(0,a.jsx)(w.TableHead,{children:k?c("memory.dream.actions.colContent"):c("memory.dream.actions.colImpact")}),!k&&(0,a.jsx)(w.TableHead,{className:"text-right",children:c("memory.dream.actions.colConfidence")})]})}),(0,a.jsx)(w.TableBody,{children:W.map(r=>{let t=ee(r),n=o?.(r);return(0,a.jsxs)(w.TableRow,{className:"cursor-pointer hover:bg-[hsl(var(--accent))]",onClick:()=>J(r),children:[!k&&(0,a.jsx)(w.TableCell,{onClick:e=>e.stopPropagation(),children:t?(0,a.jsx)(N.Checkbox,{checked:G.has(r.actionId),onCheckedChange:()=>{var e;return e=r.actionId,void V(a=>{let r=new Set(a);return r.has(e)?r.delete(e):r.add(e),r})},"aria-label":c("memory.dream.actions.selectAction")}):(0,a.jsxs)(E.Tooltip,{children:[(0,a.jsx)(E.TooltipTrigger,{asChild:!0,children:(0,a.jsx)("span",{children:(0,a.jsx)(N.Checkbox,{checked:!1,disabled:!0,"aria-label":c("memory.dream.actions.notSelectable")})})}),(0,a.jsx)(E.TooltipContent,{children:c("memory.dream.actions.onlyProposedApply")})]})}),(0,a.jsx)(w.TableCell,{children:(0,a.jsx)(R,{action:r.action})}),(0,a.jsx)(w.TableCell,{children:(0,a.jsx)(F,{status:r.status,t:c})}),(0,a.jsx)(w.TableCell,{className:"text-xs",children:q(r.targetScope)}),(0,a.jsxs)(w.TableCell,{className:"max-w-md",children:[(0,a.jsx)(O,{action:r,memoryStoreName:e,t:c}),n?(0,a.jsx)(s.default,{href:n,className:"mt-1 inline-block text-xs text-primary hover:underline",onClick:e=>e.stopPropagation(),children:c("memory.dream.actions.openInWiki")}):null]}),!k&&(0,a.jsx)(w.TableCell,{className:"text-right font-mono text-xs",children:void 0!==r.confidence?r.confidence.toFixed(2):"-"})]},r.actionId)})})]})}),(0,a.jsx)(I.Sheet,{open:null!==$,onOpenChange:e=>!e&&J(null),children:(0,a.jsx)(I.SheetContent,{className:"w-[560px] sm:max-w-[560px]",children:$&&(0,a.jsx)(H,{detail:$,memoryStoreName:e,t:c})})}),(0,a.jsx)(M,{open:X,onOpenChange:Y,memoryStoreName:e,selected:W.filter(e=>G.has(e.actionId)),onConfirm:es,busy:Z.isPending})]})})}function B({detail:e,memoryStoreName:r,t:s}){let t="EMIT_SKILL"===e.action||"EMIT_PROFILE"===e.action,n=!t&&("UPDATE"===e.action||"DELETE"===e.action||"MERGE"===e.action),l=(0,k.useMemoryUnit)(r,n?e.targetMemoryId:void 0,n?e.targetScope:null,n),o=e.newMemory?.text;if(t){let r=e.newExtract;if(!r)return(0,a.jsx)("div",{className:"rounded border border-dashed border-[hsl(var(--border))] bg-[hsl(var(--muted)/0.2)] p-3 text-xs italic text-muted-foreground",children:s("memory.dream.actions.noExtractResult")});let t="EMIT_SKILL"===e.action||"skill"===r.kind;return(0,a.jsxs)("div",{className:"space-y-2 rounded border border-[hsl(var(--border-light))] p-3",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:(0,D.cn)("rounded px-1.5 py-px text-[10px] font-semibold",t?"bg-success-soft text-success":"bg-[hsl(var(--primary-soft))] text-[hsl(var(--primary))]"),children:s(t?"memory.dream.actions.skill":"memory.dream.actions.profile")}),(0,a.jsx)("span",{className:"text-sm font-medium",children:r.name})]}),r.description&&(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:r.description}),r.instructions&&(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:s("memory.dream.actions.instructions")}),(0,a.jsx)("pre",{className:"max-h-48 overflow-auto whitespace-pre-wrap rounded bg-[hsl(var(--muted)/0.4)] p-2 text-xs",children:r.instructions})]})]})}if("NOOP"===e.action)return(0,a.jsx)("div",{className:"rounded border border-dashed border-[hsl(var(--border))] bg-[hsl(var(--muted)/0.2)] p-3 text-xs italic text-muted-foreground",children:s("memory.dream.actions.noopNoChange")});let i=l.data?.memory?.text,m=l.data?.memory?.unit_type;return(0,a.jsxs)("div",{className:"space-y-3",children:[n&&(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsxs)("p",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[(0,a.jsx)("span",{className:"rounded bg-warning-soft px-1.5 py-px text-[10px] font-semibold text-warning",children:s("memory.dream.actions.beforeModify")}),s("memory.dream.actions.targetMemory"),m&&(0,a.jsxs)("span",{className:"font-mono text-[10px] text-muted-foreground",children:["· ",m]})]}),l.isLoading?(0,a.jsx)(d.Skeleton,{className:"h-16 w-full"}):i?(0,a.jsx)("pre",{className:"max-h-48 overflow-auto whitespace-pre-wrap rounded bg-[hsl(var(--muted)/0.4)] p-2 text-xs",children:i}):(0,a.jsx)("p",{className:"rounded border border-dashed border-[hsl(var(--border))] p-2 text-xs italic text-muted-foreground",children:s("memory.dream.actions.originalUnreadable")})]}),o&&(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsxs)("p",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[(0,a.jsx)("span",{className:(0,D.cn)("rounded px-1.5 py-px text-[10px] font-semibold","ADD"===e.action?"bg-success-soft text-success":"bg-info-soft text-info"),children:s("ADD"===e.action?"memory.dream.actions.willAdd":"memory.dream.actions.afterModify")}),s("memory.dream.actions.newMemory"),e.newMemory?.unitType&&(0,a.jsxs)("span",{className:"font-mono text-[10px] text-muted-foreground",children:["· ",e.newMemory.unitType]})]}),(0,a.jsx)("pre",{className:"max-h-48 overflow-auto whitespace-pre-wrap rounded bg-[hsl(var(--muted)/0.4)] p-2 text-xs",children:o})]}),"DELETE"===e.action&&(0,a.jsx)("p",{className:"rounded border border-dashed border-[hsl(var(--destructive)/0.3)] bg-danger-soft/40 p-2 text-xs text-danger",children:s("memory.dream.actions.willDelete")}),"MERGE"===e.action&&(0,a.jsx)("p",{className:"rounded border border-dashed border-[hsl(var(--border))] p-2 text-xs text-muted-foreground",children:s("memory.dream.actions.willMerge")})]})}function H({detail:e,memoryStoreName:r,t:s}){return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(I.SheetHeader,{children:[(0,a.jsxs)(I.SheetTitle,{children:[(0,a.jsx)(R,{action:e.action})," ",s("memory.dream.actions.detailTitle")]}),(0,a.jsx)(I.SheetDescription,{className:"font-mono text-xs break-all",children:e.actionId})]}),(0,a.jsxs)("div",{className:"space-y-4 overflow-auto py-4 text-sm",children:[(0,a.jsx)(B,{detail:e,memoryStoreName:r,t:s}),(0,a.jsxs)("div",{className:"space-y-2 rounded border border-[hsl(var(--border-light))] p-3",children:[(0,a.jsx)(z,{label:s("memory.dream.actions.detailStatus"),children:(0,a.jsx)(F,{status:e.status,t:s})}),(0,a.jsx)(z,{label:s("memory.dream.actions.detailConfidence"),value:void 0!==e.confidence?e.confidence.toFixed(2):"-"}),(0,a.jsx)(z,{label:s("memory.common.targetScope"),value:q(e.targetScope)}),e.targetMemoryId&&(0,a.jsx)(z,{label:s("memory.dream.actions.detailTargetMemoryId"),value:e.targetMemoryId,mono:!0}),e.resultMemoryId&&(0,a.jsx)(z,{label:s("memory.dream.actions.detailResultMemoryId"),value:e.resultMemoryId,mono:!0})]}),e.reason&&(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:s("memory.dream.actions.reason")}),(0,a.jsx)("pre",{className:"max-h-40 overflow-auto whitespace-pre-wrap rounded bg-[hsl(var(--muted)/0.4)] p-2 text-xs",children:e.reason})]}),e.skippedReason&&(0,a.jsx)(z,{label:s("memory.dream.actions.skippedReason"),value:e.skippedReasonDetail?s("memory.dream.actions.skippedReasonWithDetail",{reason:e.skippedReason,detail:e.skippedReasonDetail}):e.skippedReason}),e.error&&(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:s("memory.dream.actions.error")}),(0,a.jsx)("pre",{className:"max-h-40 overflow-auto whitespace-pre-wrap rounded bg-danger-soft p-2 text-xs text-danger",children:e.error})]})]})]})}function z({label:e,value:r,mono:s,children:t}){return(0,a.jsxs)("div",{className:"flex items-start gap-3",children:[(0,a.jsx)("p",{className:"w-28 shrink-0 text-xs text-muted-foreground",children:e}),t?(0,a.jsx)("div",{children:t}):(0,a.jsx)("p",{className:(0,D.cn)("flex-1 text-sm",s&&"font-mono"),children:r??"-"})]})}var Q=e.i(520244),W=e.i(723888),G=e.i(766476);function V(e,a,r){if("awaiting_plan_approval"!==e.status)throw Error(`Dream task must be awaiting_plan_approval; current status is ${e.status}`);if("reject"===a)return{kind:"cancel",dreamId:e.dreamId};if(!e.plan||"string"!=typeof e.plan.summary||""===e.plan.summary.trim()||!Array.isArray(e.plan.deleteMemoryIds)||!e.plan.deleteMemoryIds.every(e=>"string"==typeof e&&""!==e.trim()))throw Error("Dream task does not contain a valid plan");let s=r?.trim()??"";if(""===s)throw Error("Approver is required");return{kind:"approve",dreamId:e.dreamId,approver:s}}function $({memoryStoreName:e,task:s,open:t,onOpenChange:l}){let o,{t:d}=(0,C.useI18n)(),c=(o=(0,b.useQueryClient)(),(0,j.useMutation)({mutationFn:({dreamId:a,approver:r})=>(0,h.approveDreamPlan)(e,a,r),onSuccess:()=>{o.invalidateQueries({queryKey:["memory"],predicate:a=>Array.isArray(a.queryKey)&&a.queryKey.includes("dream-tasks")&&a.queryKey.includes(e)})}})),[p,u]=(0,r.useState)(""),x=e=>{e||u(""),l(e)},y=async()=>{try{let e=V(s,"approve",p);if("approve"!==e.kind)return;await c.mutateAsync({dreamId:e.dreamId,approver:e.approver}),n.toast.success(d("memory.dream.planApprovalSuccess")),x(!1)}catch(e){n.toast.error(e instanceof Error?e.message:d("memory.dream.planApprovalFailed"))}},f=s.plan;return(0,a.jsx)(m.Dialog,{open:t,onOpenChange:x,children:(0,a.jsxs)(m.DialogContent,{className:"max-w-2xl",children:[(0,a.jsxs)(m.DialogHeader,{children:[(0,a.jsx)(m.DialogTitle,{children:d("memory.dream.planApprovalTitle")}),(0,a.jsx)(m.DialogDescription,{children:d("memory.dream.planApprovalDescription")})]}),(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("section",{className:"rounded-md border border-[hsl(var(--border))] p-3",children:[(0,a.jsx)("h4",{className:"mb-1 text-xs font-semibold uppercase text-muted-foreground",children:d("memory.dream.planSummary")}),(0,a.jsx)("p",{className:"whitespace-pre-wrap text-sm",children:f?.summary})]}),(0,a.jsxs)("section",{className:"rounded-md border border-[hsl(var(--border))] p-3",children:[(0,a.jsx)("h4",{className:"mb-2 text-xs font-semibold uppercase text-muted-foreground",children:d("memory.dream.planDeletionWhitelist")}),f?.deleteMemoryIds.length?(0,a.jsx)("ul",{className:"space-y-1 font-mono text-xs",children:f.deleteMemoryIds.map(e=>(0,a.jsx)("li",{className:"break-all",children:e},e))}):(0,a.jsx)("p",{className:"text-sm text-muted-foreground",children:d("memory.dream.planNoDeletions")})]}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)(G.Label,{htmlFor:"dream-plan-approver",children:d("memory.dream.planApprover")}),(0,a.jsx)(W.Input,{id:"dream-plan-approver",value:p,onChange:e=>u(e.target.value),placeholder:d("memory.dream.planApproverPlaceholder")})]})]}),(0,a.jsxs)(m.DialogFooter,{children:[(0,a.jsx)(i.Button,{variant:"outline",onClick:()=>x(!1),children:d("common.cancel")}),(0,a.jsx)(i.Button,{onClick:y,disabled:c.isPending||""===p.trim(),children:c.isPending?d("memory.dream.planApproving"):d("memory.dream.planApprove")})]})]})})}var J=e.i(749448);function X(e,a){var r;let s="EMIT_SKILL"===a.action?"skill":"EMIT_PROFILE"===a.action?"profile":void 0;if("applied"!==a.status||!s||a.newExtract?.kind!==s||![(r=a.targetScope).appId,r.tenantId,r.agentId,r.runId].every(e=>"string"==typeof e&&e.length>0&&"*"!==e))return;let t=new URLSearchParams([["appId",a.targetScope.appId],["tenantId",a.targetScope.tenantId],["agentId",a.targetScope.agentId],["runId",a.targetScope.runId],["dreamId",a.dreamId],["actionId",a.actionId]]);return`/memory/${encodeURIComponent(e)}/wiki?${t.toString()}`}let Y={queued:"bg-info-soft text-info",running:"bg-info-soft text-info",planning:"bg-info-soft text-info",awaiting_plan_approval:"bg-warning-soft text-warning",applying:"bg-info-soft text-info",completed:"bg-success-soft text-success",completed_with_failures:"bg-warning-soft text-warning",failed:"bg-danger-soft text-danger",cancelled:"bg-muted text-muted-foreground"},Z={queued:"memory.dreamStatus.queued",running:"memory.dreamStatus.running",planning:"memory.dreamStatus.planning",awaiting_plan_approval:"memory.dreamStatus.awaitingPlanApproval",applying:"memory.dreamStatus.applying",completed:"memory.dreamStatus.completed",completed_with_failures:"memory.dreamStatus.completedWithFailures",failed:"memory.dreamStatus.failed",cancelled:"memory.dreamStatus.cancelled"};function ee({status:e,t:r}){let s=!g.DREAM_TERMINAL_STATUSES.has(e),t=Z[e];return(0,a.jsxs)("span",{className:(0,D.cn)("inline-flex items-center gap-1 rounded-full px-2.5 py-0.5 text-xs font-medium select-none whitespace-nowrap",Y[e]??"bg-muted text-muted-foreground"),children:[s&&(0,a.jsxs)("span",{className:"relative flex h-1.5 w-1.5",children:[(0,a.jsx)("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-current opacity-60"}),(0,a.jsx)("span",{className:"relative inline-flex h-1.5 w-1.5 rounded-full bg-current"})]}),t?r(t):e]})}let ea={memory:"memory.dreamType.consolidate",skill:"memory.dreamType.skill",profile:"memory.dreamType.profile"},er={memory:"bg-info-soft text-info",skill:"bg-success-soft text-success",profile:"bg-[hsl(var(--primary-soft,_220_90%_96%))] text-[hsl(var(--primary))]"};function es({label:e,value:r}){return(0,a.jsxs)("div",{className:"flex flex-col",children:[(0,a.jsx)("span",{className:"text-xs text-muted-foreground",children:e}),(0,a.jsx)("span",{className:"text-base font-semibold tabular-nums",children:r})]})}function et({label:e,value:r}){return(0,a.jsxs)("div",{children:[(0,a.jsx)("dt",{className:"text-muted-foreground",children:e}),(0,a.jsx)("dd",{className:"mt-0.5 break-all font-mono text-foreground",children:r??"—"})]})}e.s(["buildDreamArtifactWikiHref",0,X,"default",0,function(){let e,v,{t:N}=(0,C.useI18n)(),S=(0,t.useParams)(),T=(0,t.useRouter)(),I=decodeURIComponent(S.store),w=decodeURIComponent(S.dreamId),E=function(e,a){let{context:r,ready:s}=(0,f.useRuntimeContext)();return(0,x.useQuery)({queryKey:y.queryKeys.dreamTask(r.dataScopeKey,e,a),queryFn:()=>(0,h.getDreamTask)(e,a),enabled:s&&!!e&&!!a,refetchInterval:e=>{let a=e.state.data;return a?!g.DREAM_TERMINAL_STATUSES.has(a.status)&&5e3:5e3},refetchIntervalInBackground:!1})}(I,w),k=(e=(0,b.useQueryClient)(),(0,j.useMutation)({mutationFn:e=>(0,h.cancelDreamTask)(I,e),onSuccess:()=>{e.invalidateQueries({queryKey:["memory"],predicate:e=>Array.isArray(e.queryKey)&&e.queryKey.includes("dream-tasks")&&e.queryKey.includes(I)})}})),[A,M]=(0,r.useState)(!1),[P,_]=(0,r.useState)(!1),[L,R]=(0,r.useState)(!1),[O,K]=(0,r.useState)(!1);if(E.error instanceof Error&&"code"in E.error&&"DREAMING_DISABLED"===E.error.code)return(0,a.jsx)(Q.MemoryDreamDisabled,{});let F=E.data,q=F?.input.scopes??[],B=1===q.length?(0,J.toExactScope)(q[0]):null,H=F&&g.DREAM_TERMINAL_STATUSES.has(F.status),z=F?.taskType==="skill"||F?.taskType==="profile",W=F?.status==="awaiting_plan_approval",G=async()=>{try{await k.mutateAsync(w),n.toast.success(N("memory.dream.cancelSuccess")),M(!1)}catch(a){let e=a instanceof Error?a.message:N("memory.dream.cancelFailed");n.toast.error(e)}},Y=async()=>{if(F)try{let e=V(F,"reject");if("cancel"!==e.kind)return;await k.mutateAsync(e.dreamId),n.toast.success(N("memory.dream.rejectPlanSuccess")),R(!1)}catch(a){let e=a instanceof Error?a.message:N("memory.dream.rejectPlanFailed");n.toast.error(e)}};return(0,a.jsxs)("div",{className:"space-y-5",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsxs)(i.Button,{variant:"ghost",size:"sm",onClick:()=>T.push(`/memory/${encodeURIComponent(I)}/dream`),children:[(0,a.jsx)(l.ArrowLeft,{className:"mr-1 h-3.5 w-3.5"}),N("memory.dream.backToTaskList")]}),B?(0,a.jsx)(i.Button,{asChild:!0,variant:"ghost",size:"sm",children:(0,a.jsxs)(s.default,{href:(0,J.buildScopeWorkspaceHref)(I,B),children:[(0,a.jsx)(l.ArrowLeft,{className:"mr-1 h-3.5 w-3.5"}),N("memory.dream.backToScope")]})}):null]}),E.isLoading?(0,a.jsx)(d.Skeleton,{className:"h-32 w-full"}):F?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"rounded-lg border border-[hsl(var(--border))] p-5",children:[(0,a.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("h2",{className:"font-mono text-base",children:F.dreamId}),(v=F.taskType||"memory",(0,a.jsx)("span",{className:(0,D.cn)("inline-flex rounded-full px-2 py-0.5 text-xs font-medium whitespace-nowrap",er[v]??"bg-muted text-muted-foreground"),children:ea[v]?N(ea[v]):v}))]}),(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:[(0,a.jsx)(ee,{status:F.status,t:N}),(!F.taskType||"memory"===F.taskType)&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("span",{children:"safe_auto"===F.applyMode?N("memory.dream.applyModeAutoDetail"):"plan"===F.applyMode?N("memory.dream.applyModePlanDetail"):N("memory.dream.applyModeProposalDetail")}),(0,a.jsx)("span",{children:"·"})]}),(0,a.jsx)("span",{children:N("memory.dream.effortDetail",{value:F.effort})}),(!F.taskType||"memory"===F.taskType)&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("span",{children:"·"}),(0,a.jsx)("span",{children:N("memory.dream.scopeOutput",{value:"promote_scope"===F.scopeOutputMode?N("memory.dream.scopeOutputPromote"):N("memory.dream.scopeOutputPreserve")})})]}),!H&&(0,a.jsx)("span",{className:"ml-1 italic",children:N("memory.dream.autoRefresh")})]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(c.RefreshButton,{onClick:()=>E.refetch(),loading:E.isRefetching}),F.lastError&&(0,a.jsxs)(i.Button,{size:"sm",variant:"outline",onClick:()=>K(!0),className:"text-[hsl(var(--destructive))]",children:[(0,a.jsx)(o.AlertTriangle,{className:"mr-1 h-3.5 w-3.5"}),N("memory.dream.viewError")]}),W&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(i.Button,{size:"sm",onClick:()=>_(!0),children:N("memory.dream.approvePlan")}),(0,a.jsx)(i.Button,{size:"sm",variant:"destructive",onClick:()=>R(!0),disabled:k.isPending,children:N("memory.dream.rejectPlan")})]}),!H&&!W&&(0,a.jsx)(i.Button,{size:"sm",variant:"outline",onClick:()=>M(!0),disabled:k.isPending,children:N("memory.dream.cancelTask")})]})]}),(0,a.jsxs)("div",{className:"mt-5 grid grid-cols-2 gap-4 sm:grid-cols-4",children:[(0,a.jsx)(es,{label:N("memory.dream.statSessions"),value:F.input.sessionCount}),(0,a.jsx)(es,{label:N("memory.dream.statMessages"),value:F.input.messageCount}),(!F.taskType||"memory"===F.taskType)&&(0,a.jsx)(es,{label:N("memory.dream.statMemories"),value:F.input.memoryCount}),(0,a.jsx)(es,{label:z?N("memory.dream.statOutput"):N("memory.dream.statActionTotal"),value:F.actions.total}),z?(0,a.jsx)(es,{label:N("memory.dream.statApplied"),value:F.actions.applied}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(es,{label:N("memory.dream.statProposed"),value:F.actions.proposed}),(0,a.jsx)(es,{label:N("memory.dream.statAppliedShort"),value:F.actions.applied}),(0,a.jsx)(es,{label:N("memory.dream.statSkipped"),value:F.actions.skipped})]}),F.actions.failed>0&&(0,a.jsx)(es,{label:N("memory.dream.statFailed"),value:F.actions.failed})]}),(0,a.jsxs)("div",{className:"mt-5 flex flex-wrap gap-x-6 gap-y-1 text-xs text-muted-foreground",children:[(0,a.jsxs)("span",{children:[N("memory.dream.metaCreated"),(0,a.jsx)(u.RelativeTime,{timestamp:new Date(F.createdAt).getTime()})]}),(0,a.jsxs)("span",{children:[N("memory.dream.metaUpdated"),(0,a.jsx)(u.RelativeTime,{timestamp:new Date(F.updatedAt).getTime()})]}),F.finishedAt&&(0,a.jsxs)("span",{children:[N("memory.dream.metaFinished"),(0,a.jsx)(u.RelativeTime,{timestamp:new Date(F.finishedAt).getTime()})]}),F.input.scopes&&F.input.scopes.length>0&&(0,a.jsxs)("span",{children:[N("memory.dream.metaInputScopes"),F.input.scopes.map(e=>[e.appId,e.tenantId,e.agentId,e.runId].filter(Boolean).join(" / ")||"-").slice(0,3).join(" | "),F.input.scopes.length>3&&` +${F.input.scopes.length-3}`]})]})]}),(F.stage||void 0!==F.processedThroughMs||F.plan?.approvedAt||F.plan?.executionExpiresAt)&&(0,a.jsxs)("div",{className:"rounded-lg border border-[hsl(var(--border))] p-4",children:[(0,a.jsx)("h3",{className:"mb-3 text-sm font-semibold",children:N("memory.dream.publicRuntimeTitle")}),(0,a.jsxs)("dl",{className:"grid gap-3 text-xs sm:grid-cols-2 lg:grid-cols-4",children:[(0,a.jsx)(et,{label:N("memory.dream.detailStage"),value:F.stage}),(0,a.jsx)(et,{label:N("memory.dream.detailProcessedThrough"),value:F.processedThroughMs}),(0,a.jsx)(et,{label:N("memory.dream.detailPlanApproved"),value:F.plan?.approvedAt}),(0,a.jsx)(et,{label:N("memory.dream.detailExecutionExpires"),value:F.plan?.executionExpiresAt})]})]}),F.plan&&(0,a.jsxs)("div",{className:"rounded-lg border border-[hsl(var(--border))] p-4",children:[(0,a.jsx)("h3",{className:"mb-2 text-sm font-semibold",children:N("memory.dream.planSummary")}),(0,a.jsx)("p",{className:"whitespace-pre-wrap text-sm",children:F.plan.summary}),(0,a.jsx)("h4",{className:"mb-2 mt-4 text-xs font-semibold uppercase text-muted-foreground",children:N("memory.dream.planDeletionWhitelist")}),F.plan.deleteMemoryIds.length>0?(0,a.jsx)("ul",{className:"space-y-1 font-mono text-xs",children:F.plan.deleteMemoryIds.map(e=>(0,a.jsx)("li",{className:"break-all",children:e},e))}):(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:N("memory.dream.planNoDeletions")})]}),F.instructions&&(0,a.jsxs)("div",{className:"rounded-lg border border-[hsl(var(--border))] p-4",children:[(0,a.jsx)("h3",{className:"mb-2 text-sm font-semibold",children:"profile"===F.taskType?N("memory.dream.instructionsProfile"):"skill"===F.taskType?N("memory.dream.instructionsSkill"):N("memory.dream.instructionsMemory")}),(0,a.jsx)("pre",{className:"max-h-48 overflow-auto whitespace-pre-wrap rounded bg-[hsl(var(--muted)/0.4)] p-3 text-xs",children:F.instructions})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h3",{className:"mb-3 text-sm font-semibold",children:z?N("memory.dream.resultsExtract"):N("memory.dream.resultsActions")}),(0,a.jsx)(U,{memoryStoreName:I,dreamId:w,taskType:F.taskType,artifactWikiHref:e=>X(I,e)})]}),(0,a.jsx)(p.ConfirmDialog,{open:A,onOpenChange:M,title:N("memory.dream.cancelConfirmTitle"),description:N("memory.dream.cancelConfirmDesc"),variant:"danger",onConfirm:G}),W&&(0,a.jsx)($,{memoryStoreName:I,task:F,open:P,onOpenChange:_}),(0,a.jsx)(p.ConfirmDialog,{open:L,onOpenChange:R,title:N("memory.dream.rejectPlanConfirmTitle"),description:N("memory.dream.rejectPlanConfirmDesc"),confirmText:N("memory.dream.rejectPlan"),variant:"danger",onConfirm:Y}),(0,a.jsx)(m.Dialog,{open:O,onOpenChange:K,children:(0,a.jsxs)(m.DialogContent,{className:"max-w-2xl",children:[(0,a.jsx)(m.DialogHeader,{children:(0,a.jsx)(m.DialogTitle,{children:N("memory.dream.lastError")})}),(0,a.jsx)("pre",{className:"max-h-96 overflow-auto rounded bg-danger-soft p-3 text-xs text-danger",children:F.lastError})]})})]}):(0,a.jsx)("div",{className:"rounded-lg border border-dashed py-10 text-center text-sm text-muted-foreground",children:N("memory.dream.taskNotFound")})]})}],772883)}]);
|
package/dist/dashboard-runtime/dashboard/.next/static/chunks/{0eafb9pun~54k.js → 0cfrd_r4jr_ip.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,338309,e=>{"use strict";var s=e.i(44501),a=e.i(101685),t=e.i(736664),i=e.i(358204),r=e.i(801685);let n=(0,r.default)("shield-alert",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]]);var l=e.i(942595),c=e.i(831211),o=e.i(799877),d=e.i(323516),m=e.i(187014),u=e.i(192988);let p=(0,r.default)("brain-circuit",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M9 13a4.5 4.5 0 0 0 3-4",key:"10igwf"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M12 13h4",key:"1ku699"}],["path",{d:"M12 18h6a2 2 0 0 1 2 2v1",key:"105ag5"}],["path",{d:"M12 8h8",key:"1lhi5i"}],["path",{d:"M16 8V5a2 2 0 0 1 2-2",key:"u6izg6"}],["circle",{cx:"16",cy:"13",r:".5",key:"ry7gng"}],["circle",{cx:"18",cy:"3",r:".5",key:"1aiba7"}],["circle",{cx:"20",cy:"21",r:".5",key:"yhc1fs"}],["circle",{cx:"20",cy:"8",r:".5",key:"1e43v0"}]]);var x=e.i(51517);let y=(0,r.default)("shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]);var h=e.i(330363),j=e.i(322740),g=e.i(162769),N=e.i(666458),v=e.i(490314),f=e.i(515793),b=e.i(137500),K=e.i(712984),C=e.i(593321);async function w(){return(await (0,C.apiGet)("/api/v1/api-keys")).apiKeys}async function k(e){let s={};return e?.serviceCredentialName&&(s.serviceCredentialName=e.serviceCredentialName),e?.credentialAgeDays&&e.credentialAgeDays>0&&(s.credentialAgeDays=e.credentialAgeDays),(await (0,C.apiPost)("/api/v1/api-keys",Object.keys(s).length>0?s:void 0)).apiKey}async function S(e){await (0,C.apiDelete)(`/api/v1/api-keys/${encodeURIComponent(e.serviceCredentialId)}`,{userPrincipalName:e.userPrincipalName,deleteCustomPolicy:e.deleteCustomPolicy??!0,deleteRamUser:e.deleteRamUser??!0})}async function I(e){await (0,C.apiPatch)(`/api/v1/api-keys/${encodeURIComponent(e.serviceCredentialId)}`,{userPrincipalName:e.userPrincipalName,status:e.status})}async function T(e,s){return(await (0,C.apiGet)(`/api/v1/api-keys/${encodeURIComponent(e)}/policies?userName=${encodeURIComponent(s)}`)).policies}async function D(e,s){await (0,C.apiPost)(`/api/v1/api-keys/${encodeURIComponent(e)}/policies`,s)}async function P(e,s){await (0,C.apiDelete)(`/api/v1/api-keys/${encodeURIComponent(e)}/policies`,s)}async function A(e,s){return(0,C.apiGet)(`/api/v1/api-keys/${encodeURIComponent(e)}/custom-policy?userName=${encodeURIComponent(s)}`)}async function B(e,s){await (0,C.apiPut)(`/api/v1/api-keys/${encodeURIComponent(e)}/custom-policy`,s)}async function M(e,s){return(0,C.apiGet)(`/api/v1/api-keys/${encodeURIComponent(e)}/effective-permissions?userName=${encodeURIComponent(s)}`)}async function R(e){let s=new URLSearchParams({resourceType:e.resourceType,resourceName:e.resourceName,operationGroup:e.operationGroup});return(0,C.apiGet)(`/api/v1/api-keys/filter-by-permission?${s.toString()}`)}async function L(e,s){await (0,C.apiDelete)(`/api/v1/api-keys/${encodeURIComponent(e)}/custom-policy`,s)}var F=e.i(247570),O=e.i(543876),$=e.i(307166);function U(e,s){let{context:a,ready:t}=(0,$.useRuntimeContext)();return(0,O.useQuery)({queryKey:F.queryKeys.effectivePermissions(a.dataScopeKey,e??""),queryFn:()=>M(e,s),enabled:t&&!!e&&!!s,staleTime:15e3})}function E({apiKeys:e,onDelete:a,onDetail:t}){let{t:i}=(0,f.useI18n)();return(0,s.jsx)("div",{className:"rounded-lg border border-[hsl(var(--border))]",children:(0,s.jsxs)(j.Table,{children:[(0,s.jsx)(j.TableHeader,{children:(0,s.jsxs)(j.TableRow,{children:[(0,s.jsx)(j.TableHead,{children:i("apiKeys.table.credentialName")}),(0,s.jsx)(j.TableHead,{className:"w-[8rem]",children:i("apiKeys.table.status")}),(0,s.jsx)(j.TableHead,{children:i("apiKeys.table.accessibleKnowledgeBase")}),(0,s.jsx)(j.TableHead,{children:i("apiKeys.table.accessibleMemoryStore")}),(0,s.jsx)(j.TableHead,{className:"w-[10rem]",children:i("apiKeys.table.createdAt")}),(0,s.jsx)(j.TableHead,{className:"w-[11rem] text-right",children:i("apiKeys.table.actions")})]})}),(0,s.jsx)(j.TableBody,{children:e.map(e=>(0,s.jsx)(Q,{apiKey:e,onDelete:a,onDetail:t},e.serviceCredentialId))})]})})}function Q({apiKey:e,onDelete:t,onDetail:i}){let r,{t:n}=(0,f.useI18n)(),c=(r=(0,K.useQueryClient)(),(0,b.useMutation)({mutationFn:e=>I(e),onSuccess:()=>{(0,F.invalidateApiKeyQueries)(r)}})),[o,d]=(0,a.useState)(null),u=o??"Active"===e.status,p=Number.isFinite(Date.parse(e.createTime))?Date.parse(e.createTime):null;async function N(s){d(s);try{await c.mutateAsync({serviceCredentialId:e.serviceCredentialId,userPrincipalName:e.userPrincipalName,status:s?"Active":"Inactive"}),m.toast.success(s?n("apiKeys.table.enabled"):n("apiKeys.table.disabled"))}catch(e){d(null),m.toast.error(e instanceof Error?e.message:n("apiKeys.table.operationFailed"))}}return(0,s.jsxs)(j.TableRow,{className:"cursor-pointer",onClick:()=>i(e),children:[(0,s.jsx)(j.TableCell,{children:(0,s.jsxs)("div",{className:"flex flex-col",children:[(0,s.jsx)("span",{className:"text-sm font-medium text-foreground",children:e.serviceCredentialName}),(0,s.jsx)("span",{className:"text-xs text-muted-foreground",children:e.userPrincipalName})]})}),(0,s.jsx)(j.TableCell,{onClick:e=>e.stopPropagation(),children:(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[(0,s.jsx)(g.Switch,{checked:u,onCheckedChange:N,disabled:c.isPending,"aria-label":u?n("apiKeys.table.disable"):n("apiKeys.table.enable")}),(0,s.jsx)("span",{className:u?"text-xs font-medium text-success":"text-xs font-medium text-muted-foreground",children:c.isPending?(0,s.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,s.jsx)(x.Loader2,{className:"h-3 w-3 animate-spin"}),n("apiKeys.table.toggling")]}):u?n("apiKeys.table.statusActive"):n("apiKeys.table.statusInactive")})]})}),(0,s.jsx)(j.TableCell,{onClick:e=>e.stopPropagation(),children:(0,s.jsx)(H,{serviceCredentialId:e.serviceCredentialId,userName:e.userPrincipalName,resourceType:"knowledgebase"})}),(0,s.jsx)(j.TableCell,{onClick:e=>e.stopPropagation(),children:(0,s.jsx)(H,{serviceCredentialId:e.serviceCredentialId,userName:e.userPrincipalName,resourceType:"memorystore"})}),(0,s.jsx)(j.TableCell,{children:p?(0,s.jsx)(v.RelativeTime,{timestamp:p}):(0,s.jsx)("span",{className:"text-xs text-muted-foreground",children:"—"})}),(0,s.jsxs)(j.TableCell,{className:"text-right",children:[(0,s.jsxs)(l.Button,{variant:"ghost",size:"sm",className:"h-8",onClick:s=>{s.stopPropagation(),i(e)},children:[(0,s.jsx)(y,{className:"mr-1 h-3.5 w-3.5"}),n("apiKeys.table.permission")]}),(0,s.jsxs)(l.Button,{variant:"ghost",size:"sm",className:`h-8 text-[hsl(var(--destructive))] hover:bg-[hsl(var(--destructive))/0.08] hover:text-[hsl(var(--destructive))] ${u?"opacity-50 cursor-not-allowed":""}`,onClick:s=>{s.stopPropagation(),u?m.toast.info(n("apiKeys.table.disableBeforeDelete")):t(e)},children:[(0,s.jsx)(h.Trash2,{className:"mr-1 h-3.5 w-3.5"}),n("common.delete")]})]})]})}function H({serviceCredentialId:e,userName:a,resourceType:t}){let{t:i}=(0,f.useI18n)(),{data:r,isLoading:n,isError:l}=U(e,a);if(n)return(0,s.jsx)(x.Loader2,{className:"h-3.5 w-3.5 animate-spin text-muted-foreground"});if(l)return(0,s.jsx)("span",{className:"text-xs text-muted-foreground",children:"—"});let c=(r?.resources?.filter(e=>e.resourceType===t)??[]).filter(e=>e.permissions.read||e.permissions.write||e.permissions.manage);if(0===c.length)return(0,s.jsx)("span",{className:"text-xs text-muted-foreground",children:i("apiKeys.table.none")});let o="knowledgebase"===t?u.BookOpen:p;return(0,s.jsx)("div",{className:"flex flex-wrap gap-1",children:c.map(e=>(0,s.jsxs)(N.Badge,{variant:"secondary",className:"gap-1 text-[11px] font-normal",children:[(0,s.jsx)(o,{className:"h-3 w-3"}),e.resourceName]},e.resourceName))})}var q=e.i(309823),z=e.i(723888),G=e.i(766476),V=e.i(433253);function W({open:e,onOpenChange:t,onCreated:i}){let r,{t:n}=(0,f.useI18n)(),c=(r=(0,K.useQueryClient)(),(0,b.useMutation)({mutationFn:e=>k(e),onSuccess:()=>{(0,F.invalidateApiKeyQueries)(r)}})),[o,d]=(0,a.useState)(""),[u,p]=(0,a.useState)("");async function x(){let e=o.trim();if(!e)return void m.toast.error(n("apiKeys.create.nameRequired"));let s=u?Number(u):void 0;if(void 0!==s&&(s<1||s>365||!Number.isInteger(s)))return void m.toast.error(n("apiKeys.create.ageDaysInvalid"));try{let a=await c.mutateAsync({serviceCredentialName:e,credentialAgeDays:s});t(!1),i(a)}catch(e){m.toast.error(e instanceof Error?e.message:n("apiKeys.create.createFailed"))}}return(0,a.useEffect)(()=>{e&&(d("ots_apikey_"+Date.now().toString(36)+"_"+Math.random().toString(36).slice(2,6)),p(""))},[e]),(0,s.jsx)(V.Dialog,{open:e,onOpenChange:e=>{t(e)},children:(0,s.jsxs)(V.DialogContent,{className:"sm:max-w-md",children:[(0,s.jsx)(V.DialogHeader,{children:(0,s.jsx)(V.DialogTitle,{className:"text-xl",children:n("apiKeys.create.title")})}),(0,s.jsxs)("div",{className:"space-y-3 py-1 text-sm leading-relaxed text-muted-foreground",children:[(0,s.jsxs)("p",{children:[n("apiKeys.create.introPrefix"),(0,s.jsx)("code",{className:"rounded bg-muted px-1.5 py-0.5 font-mono text-xs text-foreground",children:"ots.aliyuncs.com"}),n("apiKeys.create.introSuffix")]}),(0,s.jsxs)("div",{className:"space-y-1.5",children:[(0,s.jsx)(G.Label,{className:"text-xs text-foreground",children:n("apiKeys.create.credentialName")}),(0,s.jsx)(z.Input,{value:o,onChange:e=>d(e.target.value),placeholder:n("apiKeys.create.credentialNamePlaceholder"),className:"h-9"}),(0,s.jsx)("p",{className:"text-[11px] text-muted-foreground",children:n("apiKeys.create.credentialNameHelp")})]}),(0,s.jsxs)("div",{className:"space-y-1.5",children:[(0,s.jsx)(G.Label,{className:"text-xs text-foreground",children:n("apiKeys.create.ageDays")}),(0,s.jsx)(z.Input,{type:"number",min:1,max:365,value:u,onChange:e=>p(e.target.value),placeholder:n("apiKeys.create.ageDaysPlaceholder"),className:"h-9"}),(0,s.jsx)("p",{className:"text-[11px] text-muted-foreground",children:n("apiKeys.create.ageDaysHelp")})]}),(0,s.jsx)("div",{className:"rounded-md border border-[hsl(var(--warning))/0.5] bg-[hsl(var(--warning))/0.08] px-4 py-3 text-sm",children:(0,s.jsxs)("p",{className:"text-foreground",children:[(0,s.jsx)(q.AlertTriangle,{className:"mr-1 -mt-0.5 inline h-4 w-4 text-warning"}),n("apiKeys.create.secretWarning")]})})]}),(0,s.jsxs)(V.DialogFooter,{children:[(0,s.jsx)(l.Button,{variant:"outline",onClick:()=>t(!1),disabled:c.isPending,children:n("common.cancel")}),(0,s.jsx)(l.Button,{onClick:x,disabled:c.isPending,children:c.isPending?n("common.creating"):n("apiKeys.create.confirm")})]})]})})}var _=e.i(663630);function X({apiKey:e,open:t,onOpenChange:i}){let r,{t:n}=(0,f.useI18n)(),c=(r=(0,K.useQueryClient)(),(0,b.useMutation)({mutationFn:e=>S(e),onSuccess:()=>{(0,F.invalidateApiKeyQueries)(r)}})),[o,d]=(0,a.useState)(!0),[u,p]=(0,a.useState)(!0);async function x(){if(e)try{await c.mutateAsync({serviceCredentialId:e.serviceCredentialId,userPrincipalName:e.userPrincipalName,deleteCustomPolicy:o,deleteRamUser:u}),m.toast.success(n("apiKeys.delete.deleteSuccess")),i(!1)}catch(e){m.toast.error(e instanceof Error?e.message:n("apiKeys.delete.deleteFailed"))}}return(0,a.useEffect)(()=>{t&&(d(!0),p(!0))},[t]),(0,s.jsx)(V.Dialog,{open:t,onOpenChange:i,children:(0,s.jsxs)(V.DialogContent,{className:"sm:max-w-md",children:[(0,s.jsx)(V.DialogHeader,{children:(0,s.jsx)(V.DialogTitle,{className:"text-xl",children:n("apiKeys.delete.title")})}),(0,s.jsxs)("div",{className:"rounded-md border border-[hsl(var(--destructive))] bg-[hsl(var(--destructive))/0.06] px-4 py-3 text-sm leading-relaxed",children:[(0,s.jsxs)("p",{children:[(0,s.jsx)(q.AlertTriangle,{className:"mr-1 -mt-0.5 inline h-4 w-4 text-destructive"}),n("apiKeys.delete.warning")]}),e?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("p",{className:"mt-3",children:[(0,s.jsx)("span",{className:"text-muted-foreground",children:n("apiKeys.delete.credentialNameLabel")}),(0,s.jsx)("code",{className:"font-mono text-xs",children:e.serviceCredentialName})]}),"Active"===e.status?(0,s.jsx)("p",{className:"mt-2 text-xs text-muted-foreground",children:n("apiKeys.delete.activeHint")}):null]}):null]}),(0,s.jsxs)("div",{className:"space-y-3",children:[(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:n("apiKeys.delete.cleanupHint")}),(0,s.jsxs)("label",{className:"flex items-start gap-2 cursor-pointer",children:[(0,s.jsx)(_.Checkbox,{checked:o,onCheckedChange:e=>d(!!e),className:"mt-0.5"}),(0,s.jsxs)("div",{children:[(0,s.jsx)(G.Label,{className:"text-sm cursor-pointer",children:n("apiKeys.delete.deleteCustomPolicy")}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:n("apiKeys.delete.deleteCustomPolicyDesc")})]})]}),(0,s.jsxs)("label",{className:"flex items-start gap-2 cursor-pointer",children:[(0,s.jsx)(_.Checkbox,{checked:u,onCheckedChange:e=>p(!!e),className:"mt-0.5"}),(0,s.jsxs)("div",{children:[(0,s.jsx)(G.Label,{className:"text-sm cursor-pointer",children:n("apiKeys.delete.deleteRamUser")}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:n("apiKeys.delete.deleteRamUserDesc")})]})]})]}),(0,s.jsxs)(V.DialogFooter,{children:[(0,s.jsx)(l.Button,{variant:"outline",onClick:()=>i(!1),disabled:c.isPending,children:n("common.cancel")}),(0,s.jsx)(l.Button,{variant:"destructive",disabled:c.isPending,onClick:x,children:c.isPending?n("common.deleting"):n("apiKeys.delete.confirm")})]})]})})}var Z=e.i(882652),J=e.i(103343),Y=e.i(144308);async function ee(e){if(navigator.clipboard&&window.isSecureContext)return void await navigator.clipboard.writeText(e);let s=document.createElement("textarea");s.value=e,s.style.position="fixed",s.style.opacity="0",document.body.appendChild(s),s.select(),document.execCommand("copy"),document.body.removeChild(s)}function es(){let e=(0,K.useQueryClient)();return(0,b.useMutation)({mutationFn:e=>D(e.serviceCredentialId,{userName:e.userName,policyName:e.policyName,policyType:e.policyType}),onSuccess:()=>{(0,F.invalidateApiKeyPolicyQueries)(e),(0,F.invalidateEffectivePermissionsQueries)(e)}})}function ea(){let e=(0,K.useQueryClient)();return(0,b.useMutation)({mutationFn:e=>P(e.serviceCredentialId,{userName:e.userName,policyName:e.policyName,policyType:e.policyType}),onSuccess:()=>{(0,F.invalidateApiKeyPolicyQueries)(e),(0,F.invalidateEffectivePermissionsQueries)(e)}})}let et="ts-ots-bearer-token-access";function ei({serviceCredentialId:e,userName:t,policies:i}){let{t:r}=(0,f.useI18n)(),n=es(),l=ea(),[c,o]=(0,a.useState)(!1),d=i?.some(e=>e.policyName===et)??!1;async function u(s){o(!0);try{s?(await n.mutateAsync({serviceCredentialId:e,userName:t,policyName:et,policyType:"Custom"}),m.toast.success(r("apiKeys.bearer.enableSuccess"))):(await l.mutateAsync({serviceCredentialId:e,userName:t,policyName:et,policyType:"Custom"}),m.toast.success(r("apiKeys.bearer.disableSuccess")))}catch(e){m.toast.error(e instanceof Error?e.message:r("apiKeys.bearer.operationFailed"))}finally{o(!1)}}return(0,s.jsxs)("div",{className:"flex items-center justify-between rounded-md border border-[hsl(var(--border))] px-3 py-2.5",children:[(0,s.jsxs)("div",{className:"space-y-0.5",children:[(0,s.jsx)("div",{className:"text-sm font-medium",children:r("apiKeys.bearer.title")}),(0,s.jsx)("div",{className:"text-xs text-muted-foreground",children:r("apiKeys.bearer.description")})]}),(0,s.jsxs)("div",{className:"flex items-center gap-2 shrink-0 ml-3",children:[c?(0,s.jsx)(x.Loader2,{className:"h-4 w-4 animate-spin text-muted-foreground"}):null,(0,s.jsx)(g.Switch,{checked:d,onCheckedChange:u,disabled:c||!i})]})]})}var er=e.i(18722),en=e.i(533153),el=e.i(843226),ec=e.i(166473),eo=e.i(247932),ed=e.i(754614),em=e.i(164204);let eu=["ots:DescribeKnowledgeBase","ots:ListKnowledgeBase","ots:GetDocument","ots:ListDocuments","ots:ListChunks","ots:Retrieve"],ep=["ots:AddDocuments","ots:UpdateDocument","ots:UpdateChunks","ots:DeleteDocuments","ots:UploadDocuments"],ex=["ots:CreateKnowledgeBase","ots:DeleteKnowledgeBase","ots:UpdateKnowledgeBase"],ey=["ots:GetMemoryStore","ots:ListMemoryStores","ots:SearchMemories","ots:ListMemories","ots:GetMemory","ots:ListMemoryStoreMessages","ots:ListMemoryStoreRequests","ots:ListMemoryStoreScopes","ots:GetMemoryTask","ots:ListMemoryTasks","ots:GetMemoryDreamTask","ots:ListMemoryDreamTasks","ots:ListMemoryDreamActions"],eh=["ots:AddMemories","ots:UpdateMemory","ots:DeleteMemory","ots:ApplyMemoryDreamActions","ots:CreateMemoryDreamTask","ots:CancelMemoryDreamTask"],ej=["ots:CreateMemoryStore","ots:DeleteMemoryStore","ots:UpdateMemoryStore"];function eg(e,s){return"knowledgebase"===e?"read"===s?eu:"write"===s?ep:ex:"read"===s?ey:"write"===s?eh:ej}[...eu,...ep,...ex],[...ey,...eh,...ej];let eN={read:"apiKeys.operations.read",write:"apiKeys.operations.write",manage:"apiKeys.operations.manage"},ev={knowledgebase:{read:"apiKeys.operations.knowledgeBaseReadDesc",write:"apiKeys.operations.knowledgeBaseWriteDesc",manage:"apiKeys.operations.knowledgeBaseManageDesc"},memorystore:{read:"apiKeys.operations.memoryStoreReadDesc",write:"apiKeys.operations.memoryStoreWriteDesc",manage:"apiKeys.operations.memoryStoreManageDesc"}};function ef(e){return[e.appId??"",e.tenantId??"",e.agentId??"",e.runId??""].join("|")}function eb({open:e,onOpenChange:t,onSave:i,initial:r}){let{t:n}=(0,f.useI18n)(),[c,o]=(0,a.useState)(r?.resourceType??"knowledgebase"),[d,m]=(0,a.useState)(r?.resourceName??"*"),[p,y]=(0,a.useState)(new Set(r?.operationGroups??["read"])),[h,j]=(0,a.useState)(r?.scope??{}),[g,N]=(0,a.useState)(r?.condition?.sourceIp?.join(", ")??""),[v,b]=(0,a.useState)(!!(r?.scope&&(r.scope.appId||r.scope.tenantId||r.scope.agentId||r.scope.runId))),[K,C]=(0,a.useState)("manual"),{data:w}=(0,eo.useKnowledgeBases)(),{data:k}=(0,ed.useMemoryStores)(),S=e&&"memorystore"===c&&"*"!==d&&v,{data:I,isLoading:T}=(0,O.useQuery)({queryKey:["memory-store-scopes-for-rule",d],queryFn:()=>(0,em.listMemoryStoreScopesUnfiltered)(d),enabled:S,staleTime:3e4}),D=I?.items??[];(0,a.useEffect)(()=>{e&&(o(r?.resourceType??"knowledgebase"),m(r?.resourceName??"*"),y(new Set(r?.operationGroups??["read"])),j(r?.scope??{}),N(r?.condition?.sourceIp?.join(", ")??""),b(!!(r?.scope&&(r.scope.appId||r.scope.tenantId||r.scope.agentId||r.scope.runId))),C("manual"))},[e,r]);let P="knowledgebase"===c?(w?.items??[]).map(e=>e.knowledgeBaseName):(k?.items??[]).map(e=>e.memoryStoreName);return(0,s.jsx)(V.Dialog,{open:e,onOpenChange:t,children:(0,s.jsxs)(V.DialogContent,{className:"sm:max-w-lg max-h-[85vh] overflow-y-auto",children:[(0,s.jsx)(V.DialogHeader,{children:(0,s.jsx)(V.DialogTitle,{children:r?n("apiKeys.rule.editTitle"):n("apiKeys.rule.addTitle")})}),(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"space-y-1.5",children:[(0,s.jsx)(G.Label,{className:"text-xs text-muted-foreground",children:n("apiKeys.rule.resourceType")}),(0,s.jsxs)(ec.Select,{value:c,onValueChange:e=>{o(e),m("*"),b(!1),j({})},children:[(0,s.jsx)(ec.SelectTrigger,{children:(0,s.jsx)(ec.SelectValue,{})}),(0,s.jsxs)(ec.SelectContent,{children:[(0,s.jsx)(ec.SelectItem,{value:"knowledgebase",children:(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(u.BookOpen,{className:"h-3.5 w-3.5"}),n("common.knowledgeBase")]})}),(0,s.jsx)(ec.SelectItem,{value:"memorystore",children:(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(er.Brain,{className:"h-3.5 w-3.5"}),n("common.memory")]})})]})]})]}),(0,s.jsxs)("div",{className:"space-y-1.5",children:[(0,s.jsx)(G.Label,{className:"text-xs text-muted-foreground",children:n("apiKeys.rule.resourceName")}),(0,s.jsxs)(ec.Select,{value:d,onValueChange:e=>{m(e),b(!1),j({})},children:[(0,s.jsx)(ec.SelectTrigger,{children:(0,s.jsx)(ec.SelectValue,{})}),(0,s.jsxs)(ec.SelectContent,{children:[(0,s.jsx)(ec.SelectItem,{value:"*",children:n("apiKeys.rule.allResource",{resource:"knowledgebase"===c?n("common.knowledgeBase"):n("common.memory")})}),P.map(e=>(0,s.jsx)(ec.SelectItem,{value:e,children:e},e))]})]})]}),"memorystore"===c&&"*"!==d&&(0,s.jsxs)("div",{className:"space-y-1.5",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(_.Checkbox,{checked:v,onCheckedChange:e=>{b(!!e),e||j({})}}),(0,s.jsx)(G.Label,{className:"text-xs text-muted-foreground",children:n("apiKeys.rule.scopeConfig")})]}),v&&(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(l.Button,{variant:"select"===K?"default":"outline",size:"sm",className:"h-7 text-xs",onClick:()=>C("select"),children:n("apiKeys.rule.selectFromExisting")}),(0,s.jsx)(l.Button,{variant:"manual"===K?"default":"outline",size:"sm",className:"h-7 text-xs",onClick:()=>C("manual"),children:n("apiKeys.rule.manualInput")})]}),"select"===K?(0,s.jsx)("div",{className:"rounded-md border border-[hsl(var(--border))] p-3 space-y-1.5",children:T?(0,s.jsxs)("div",{className:"flex items-center gap-2 py-2 text-xs text-muted-foreground",children:[(0,s.jsx)(x.Loader2,{className:"h-3.5 w-3.5 animate-spin"}),n("apiKeys.rule.loadingScopes")]}):0===D.length?(0,s.jsx)("p",{className:"py-2 text-xs text-muted-foreground",children:n("apiKeys.rule.noScopes")}):(0,s.jsx)("div",{className:"max-h-40 overflow-y-auto space-y-1",children:D.map(e=>{let a,t=ef(e),i=ef(h)===t;return(0,s.jsxs)("label",{className:`flex items-center gap-2 rounded px-2 py-1.5 cursor-pointer hover:bg-muted/50 ${i?"bg-muted":""}`,children:[(0,s.jsx)(_.Checkbox,{checked:i,onCheckedChange:()=>{if(i)j({});else j({appId:e.appId||void 0,tenantId:e.tenantId||void 0,agentId:e.agentId||void 0,runId:e.runId||void 0})}}),(0,s.jsx)("span",{className:"text-xs font-mono truncate",children:(a=[],e.appId&&a.push(`app:${e.appId}`),e.tenantId&&a.push(`tenant:${e.tenantId}`),e.agentId&&a.push(`agent:${e.agentId}`),e.runId&&a.push(`run:${e.runId}`),a.join(", "))})]},t)})})}):(0,s.jsxs)("div",{className:"grid grid-cols-2 gap-2 rounded-md border border-[hsl(var(--border))] p-3",children:[(0,s.jsxs)("div",{className:"space-y-1",children:[(0,s.jsx)(G.Label,{className:"text-[11px] text-muted-foreground",children:"App ID"}),(0,s.jsx)(z.Input,{value:h.appId??"",onChange:e=>j(s=>({...s,appId:e.target.value||void 0})),placeholder:n("apiKeys.rule.optional"),className:"h-8 text-xs"})]}),(0,s.jsxs)("div",{className:"space-y-1",children:[(0,s.jsx)(G.Label,{className:"text-[11px] text-muted-foreground",children:"Tenant ID"}),(0,s.jsx)(z.Input,{value:h.tenantId??"",onChange:e=>j(s=>({...s,tenantId:e.target.value||void 0})),placeholder:n("apiKeys.rule.optional"),className:"h-8 text-xs"})]}),(0,s.jsxs)("div",{className:"space-y-1",children:[(0,s.jsx)(G.Label,{className:"text-[11px] text-muted-foreground",children:"Agent ID"}),(0,s.jsx)(z.Input,{value:h.agentId??"",onChange:e=>j(s=>({...s,agentId:e.target.value||void 0})),placeholder:n("apiKeys.rule.optional"),className:"h-8 text-xs"})]}),(0,s.jsxs)("div",{className:"space-y-1",children:[(0,s.jsx)(G.Label,{className:"text-[11px] text-muted-foreground",children:"Run ID"}),(0,s.jsx)(z.Input,{value:h.runId??"",onChange:e=>j(s=>({...s,runId:e.target.value||void 0})),placeholder:n("apiKeys.rule.optional"),className:"h-8 text-xs"})]})]})]})]}),(0,s.jsxs)("div",{className:"space-y-1.5",children:[(0,s.jsx)(G.Label,{className:"text-xs text-muted-foreground",children:n("apiKeys.rule.operationPermission")}),(0,s.jsx)("div",{className:"space-y-2",children:["read","write","manage"].map(e=>{let a;return(0,s.jsxs)("label",{className:"flex items-start gap-2 rounded-md border border-[hsl(var(--border))] px-3 py-2 cursor-pointer hover:bg-muted/30",children:[(0,s.jsx)(_.Checkbox,{checked:p.has(e),onCheckedChange:()=>{y(s=>{let a=new Set(s);return a.has(e)?a.delete(e):a.add(e),a})},className:"mt-0.5"}),(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsx)("div",{className:"text-sm font-medium",children:n(eN[e])}),(0,s.jsx)("div",{className:"text-xs text-muted-foreground",children:(a=ev[c]?.[e])?n(a):null}),(0,s.jsx)("div",{className:"mt-1 text-[11px] text-muted-foreground/60",children:eg(c,e).map(e=>e.replace("ots:","")).join(", ")})]})]},e)})})]}),(0,s.jsxs)("div",{className:"space-y-1.5",children:[(0,s.jsx)(G.Label,{className:"text-xs text-muted-foreground",children:n("apiKeys.rule.ipWhitelist")}),(0,s.jsx)(z.Input,{value:g,onChange:e=>N(e.target.value),placeholder:n("apiKeys.rule.ipPlaceholder"),className:"text-xs"}),(0,s.jsx)("p",{className:"text-[11px] text-muted-foreground",children:n("apiKeys.rule.ipHelp")})]})]}),(0,s.jsxs)(V.DialogFooter,{children:[(0,s.jsx)(l.Button,{variant:"outline",onClick:()=>t(!1),children:n("common.cancel")}),(0,s.jsx)(l.Button,{disabled:0===p.size,onClick:function(){var e;let s=Array.from(p),a=function(e,s){let a=[];for(let t of s)a.push(...eg(e,t));return[...new Set(a)]}(c,s),r=g.split(/[,,\s]+/).map(e=>e.trim()).filter(Boolean);i({resourceType:c,resourceName:d,operationGroups:s,actions:a,..."memorystore"===c&&v&&((e=h).appId||e.tenantId||e.agentId||e.runId)?{scope:h}:{},...r.length>0?{condition:{sourceIp:r}}:{}}),t(!1)},children:r?n("apiKeys.rule.saveChanges"):n("apiKeys.rule.add")})]})]})})}let eK={read:"apiKeys.operations.read",write:"apiKeys.operations.write",manage:"apiKeys.operations.manage"};function eC({serviceCredentialId:e,userName:t}){let r,n,{t:o}=(0,f.useI18n)(),{data:d,isLoading:u}=function(e,s){let{context:a,ready:t}=(0,$.useRuntimeContext)();return(0,O.useQuery)({queryKey:F.queryKeys.customPolicy(a.dataScopeKey,e??""),queryFn:()=>A(e,s),enabled:t&&!!e&&!!s,staleTime:15e3})}(e,t),p=(r=(0,K.useQueryClient)(),(0,b.useMutation)({mutationFn:e=>B(e.serviceCredentialId,{userName:e.userName,rules:e.rules}),onSuccess:()=>{(0,F.invalidateCustomPolicyQueries)(r),(0,F.invalidateApiKeyPolicyQueries)(r),(0,F.invalidateEffectivePermissionsQueries)(r)}})),y=(n=(0,K.useQueryClient)(),(0,b.useMutation)({mutationFn:e=>L(e.serviceCredentialId,{userName:e.userName}),onSuccess:()=>{(0,F.invalidateCustomPolicyQueries)(n),(0,F.invalidateApiKeyPolicyQueries)(n),(0,F.invalidateEffectivePermissionsQueries)(n)}})),[j,g]=(0,a.useState)([]),[N,v]=(0,a.useState)(!1),[C,w]=(0,a.useState)(!1),[k,S]=(0,a.useState)(null);async function I(){try{await p.mutateAsync({serviceCredentialId:e,userName:t,rules:j}),v(!1),m.toast.success(o("apiKeys.customPolicy.saveSuccess"))}catch(e){m.toast.error(e instanceof Error?e.message:o("apiKeys.customPolicy.saveFailed"))}}async function T(){try{await y.mutateAsync({serviceCredentialId:e,userName:t}),g([]),v(!1),m.toast.success(o("apiKeys.customPolicy.deleteSuccess"))}catch(e){m.toast.error(e instanceof Error?e.message:o("apiKeys.customPolicy.deleteFailed"))}}return(0,a.useEffect)(()=>{d&&(g(d.rules),v(!1))},[d]),u?(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(c.Skeleton,{className:"h-8 w-full"}),(0,s.jsx)(c.Skeleton,{className:"h-8 w-full"})]}):(0,s.jsxs)("div",{className:"space-y-3",children:[0===j.length?(0,s.jsx)("p",{className:"py-3 text-center text-sm text-muted-foreground",children:o("apiKeys.customPolicy.empty")}):(0,s.jsx)("div",{className:"space-y-1.5",children:j.map((e,a)=>(0,s.jsx)(ew,{rule:e,t:o,onEdit:()=>{S(a),w(!0)},onRemove:()=>{g(e=>e.filter((e,s)=>s!==a)),v(!0)}},a))}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsxs)(l.Button,{variant:"outline",size:"sm",className:"h-8",onClick:()=>{S(null),w(!0)},children:[(0,s.jsx)(i.Plus,{className:"mr-1 h-3.5 w-3.5"}),o("apiKeys.customPolicy.addRule")]}),N&&(0,s.jsxs)(l.Button,{size:"sm",className:"h-8",disabled:p.isPending,onClick:I,children:[p.isPending?(0,s.jsx)(x.Loader2,{className:"mr-1 h-3.5 w-3.5 animate-spin"}):(0,s.jsx)(el.Save,{className:"mr-1 h-3.5 w-3.5"}),o("common.save")]}),d&&d.rules.length>0&&(0,s.jsxs)(l.Button,{variant:"ghost",size:"sm",className:"h-8 text-destructive hover:text-destructive",disabled:y.isPending,onClick:T,children:[y.isPending?(0,s.jsx)(x.Loader2,{className:"mr-1 h-3.5 w-3.5 animate-spin"}):(0,s.jsx)(h.Trash2,{className:"mr-1 h-3.5 w-3.5"}),o("apiKeys.customPolicy.clearAll")]})]}),(0,s.jsx)(eb,{open:C,onOpenChange:w,onSave:function(e){null!==k?(g(s=>{let a=[...s];return a[k]=e,a}),S(null)):g(s=>[...s,e]),v(!0)},initial:null!==k?j[k]:void 0})]})}function ew({rule:e,t:a,onEdit:t,onRemove:i}){let r="knowledgebase"===e.resourceType?u.BookOpen:er.Brain,n="knowledgebase"===e.resourceType?a("common.knowledgeBase"):a("common.memory"),c="*"===e.resourceName?a("apiKeys.rule.allResource",{resource:n}):e.resourceName,o="";if(e.scope){let s=[];e.scope.appId&&s.push(`app:${e.scope.appId}`),e.scope.tenantId&&s.push(`tenant:${e.scope.tenantId}`),e.scope.agentId&&s.push(`agent:${e.scope.agentId}`),e.scope.runId&&s.push(`run:${e.scope.runId}`),s.length>0&&(o=` (${s.join(", ")})`)}return(0,s.jsxs)("div",{className:"flex items-center justify-between rounded-md border border-[hsl(var(--border))] px-3 py-2",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,s.jsx)(r,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),(0,s.jsxs)("span",{className:"truncate text-sm font-medium",children:[c,o&&(0,s.jsx)("span",{className:"text-xs text-muted-foreground",children:o})]}),(0,s.jsxs)("div",{className:"flex items-center gap-1",children:[e.operationGroups.map(e=>(0,s.jsx)(N.Badge,{variant:"secondary",className:"text-[10px]",children:eK[e]?a(eK[e]):e},e)),e.condition?.sourceIp&&e.condition.sourceIp.length>0&&(0,s.jsx)(N.Badge,{variant:"outline",className:"text-[10px]",children:a("apiKeys.customPolicy.ipLimit")})]})]}),(0,s.jsxs)("div",{className:"flex items-center gap-1 shrink-0 ml-2",children:[(0,s.jsx)(l.Button,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-foreground",onClick:t,children:(0,s.jsx)(en.Pencil,{className:"h-3.5 w-3.5"})}),(0,s.jsx)(l.Button,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-destructive",onClick:i,children:(0,s.jsx)(h.Trash2,{className:"h-3.5 w-3.5"})})]})]})}var ek=e.i(506703),eS=e.i(546398);function eI({serviceCredentialId:e,userName:a}){let{t}=(0,f.useI18n)(),{data:i,isLoading:r,error:n}=U(e,a);if(r)return(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(c.Skeleton,{className:"h-10 w-full"}),(0,s.jsx)(c.Skeleton,{className:"h-10 w-full"}),(0,s.jsx)(c.Skeleton,{className:"h-10 w-full"})]});if(n)return(0,s.jsx)("p",{className:"py-3 text-center text-sm text-destructive",children:t("apiKeys.overview.loadFailed")});if(!i||0===i.resources.length)return(0,s.jsx)("p",{className:"py-3 text-center text-sm text-muted-foreground",children:t("apiKeys.overview.empty")});let l=i.resources.filter(e=>"knowledgebase"===e.resourceType),o=i.resources.filter(e=>"memorystore"===e.resourceType);return(0,s.jsxs)("div",{className:"space-y-4",children:[l.length>0&&(0,s.jsx)(eT,{icon:(0,s.jsx)(u.BookOpen,{className:"h-3.5 w-3.5"}),label:t("common.knowledgeBase"),resources:l}),o.length>0&&(0,s.jsx)(eT,{icon:(0,s.jsx)(er.Brain,{className:"h-3.5 w-3.5"}),label:t("common.memory"),resources:o})]})}function eT({icon:e,label:a,resources:t}){let{t:i}=(0,f.useI18n)();return(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"mb-1.5 flex items-center gap-1.5 text-xs font-medium text-muted-foreground",children:[e,a]}),(0,s.jsx)("div",{className:"rounded-md border border-[hsl(var(--border))]",children:(0,s.jsxs)(j.Table,{children:[(0,s.jsx)(j.TableHeader,{children:(0,s.jsxs)(j.TableRow,{children:[(0,s.jsx)(j.TableHead,{className:"text-xs",children:i("apiKeys.overview.name")}),(0,s.jsx)(j.TableHead,{className:"w-16 text-center text-xs",children:i("apiKeys.overview.read")}),(0,s.jsx)(j.TableHead,{className:"w-16 text-center text-xs",children:i("apiKeys.overview.write")}),(0,s.jsx)(j.TableHead,{className:"w-16 text-center text-xs",children:i("apiKeys.overview.manage")})]})}),(0,s.jsx)(j.TableBody,{children:t.map(e=>(0,s.jsxs)(j.TableRow,{children:[(0,s.jsx)(j.TableCell,{className:"py-1.5",children:(0,s.jsx)("code",{className:"font-mono text-xs",children:e.resourceName})}),(0,s.jsx)(j.TableCell,{className:"py-1.5 text-center",children:(0,s.jsx)(eD,{allowed:e.permissions.read})}),(0,s.jsx)(j.TableCell,{className:"py-1.5 text-center",children:(0,s.jsx)(eD,{allowed:e.permissions.write})}),(0,s.jsx)(j.TableCell,{className:"py-1.5 text-center",children:(0,s.jsx)(eD,{allowed:e.permissions.manage})})]},e.resourceName))})]})})]})}function eD({allowed:e}){return e?(0,s.jsx)(ek.Check,{className:"mx-auto h-4 w-4 text-success"}):(0,s.jsx)(eS.X,{className:"mx-auto h-4 w-4 text-muted-foreground/40"})}var eP=e.i(573581),eA=e.i(608984);let eB=["AliyunOTSFullAccess","AliyunOTSReadOnlyAccess","AliyunOTSWriteOnlyAccess"],eM=[{key:"readonly",labelKey:"apiKeys.presets.readonlyLabel",descriptionKey:"apiKeys.presets.readonlyDesc",icon:eP.Eye,attach:["AliyunOTSReadOnlyAccess"]},{key:"full",labelKey:"apiKeys.presets.fullLabel",descriptionKey:"apiKeys.presets.fullDesc",icon:y,attach:["AliyunOTSFullAccess"]}];function eR({serviceCredentialId:e,userName:t,policies:i}){let{t:r}=(0,f.useI18n)(),n=es(),c=ea(),[o,d]=(0,a.useState)(null),u=function(e){if(!e)return null;let s=new Set(e.filter(e=>eB.includes(e.policyName)).map(e=>e.policyName));return s.has("AliyunOTSFullAccess")?"full":s.has("AliyunOTSReadOnlyAccess")&&!s.has("AliyunOTSWriteOnlyAccess")?"readonly":null}(i);async function p(s){if(u===s.key)return void await y();d(s.key);try{let a=(i??[]).filter(e=>eB.includes(e.policyName));for(let i of a)s.attach.includes(i.policyName)||await c.mutateAsync({serviceCredentialId:e,userName:t,policyName:i.policyName,policyType:i.policyType});let l=new Set(a.map(e=>e.policyName));for(let a of s.attach)l.has(a)||await n.mutateAsync({serviceCredentialId:e,userName:t,policyName:a,policyType:"System"});m.toast.success(r("apiKeys.presets.applySuccess",{preset:r(s.labelKey)}))}catch(e){m.toast.error(e instanceof Error?e.message:r("apiKeys.presets.applyFailed"))}finally{d(null)}}async function y(){d("cancel");try{for(let s of(i??[]).filter(e=>eB.includes(e.policyName)))await c.mutateAsync({serviceCredentialId:e,userName:t,policyName:s.policyName,policyType:s.policyType});m.toast.success(r("apiKeys.presets.cancelSuccess"))}catch(e){m.toast.error(e instanceof Error?e.message:r("apiKeys.presets.cancelFailed"))}finally{d(null)}}return(0,s.jsx)("div",{className:"grid grid-cols-2 gap-2",children:eM.map(e=>{let a=u===e.key,t=o===e.key,i=e.icon;return(0,s.jsxs)(l.Button,{variant:"outline",className:`relative flex h-auto flex-col items-center gap-1.5 px-3 py-3 text-center ${a?"border-[hsl(var(--primary))] bg-[hsl(var(--primary))/0.06]":""}`,disabled:null!==o,onClick:()=>p(e),children:[t||"cancel"===o&&a?(0,s.jsx)(x.Loader2,{className:"h-5 w-5 animate-spin text-primary"}):a?(0,s.jsx)(ek.Check,{className:"h-5 w-5 text-primary"}):(0,s.jsx)(i,{className:"h-5 w-5 text-muted-foreground"}),(0,s.jsx)("span",{className:"text-xs font-medium",children:r(e.labelKey)}),(0,s.jsx)("span",{className:"text-[10px] text-muted-foreground leading-tight",children:r(e.descriptionKey)}),a?(0,s.jsx)(eA.Lock,{className:"absolute right-1.5 top-1.5 h-3 w-3 text-primary"}):null]},e.key)})})}function eL({apiKey:e,onClose:a}){let{t}=(0,f.useI18n)(),i=!!e,{data:r}=function(e,s){let{context:a,ready:t}=(0,$.useRuntimeContext)();return(0,O.useQuery)({queryKey:F.queryKeys.apiKeyPolicies(a.dataScopeKey,e??""),queryFn:()=>T(e,s),enabled:t&&!!e&&!!s,staleTime:15e3})}(e?.serviceCredentialId,e?.userPrincipalName);async function n(e,s){try{await ee(e),m.toast.success(`${t("common.copied")} ${s}`)}catch{m.toast.error(t("common.copyFailed"))}}let c=e&&Number.isFinite(Date.parse(e.createTime))?Date.parse(e.createTime):null;return(0,s.jsx)(Y.Sheet,{open:i,onOpenChange:e=>!e&&a(),children:(0,s.jsxs)(Y.SheetContent,{side:"right",className:"w-full max-w-xl overflow-y-auto",children:[(0,s.jsxs)(Y.SheetHeader,{children:[(0,s.jsx)(Y.SheetTitle,{children:t("apiKeys.detail.title")}),(0,s.jsx)(Y.SheetDescription,{children:t("apiKeys.detail.description")})]}),e?(0,s.jsxs)("div",{className:"space-y-5 mt-2",children:[(0,s.jsxs)("section",{className:"space-y-2.5",children:[(0,s.jsx)("h3",{className:"text-sm font-semibold text-foreground",children:t("apiKeys.detail.basicInfo")}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(eF,{label:t("apiKeys.detail.credentialId"),children:(0,s.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,s.jsx)("code",{className:"break-all font-mono text-xs",children:e.serviceCredentialId}),(0,s.jsx)(l.Button,{variant:"ghost",size:"icon",className:"h-5 w-5 shrink-0",onClick:()=>n(e.serviceCredentialId,t("apiKeys.detail.credentialId")),children:(0,s.jsx)(Z.Copy,{className:"h-3 w-3"})})]})}),(0,s.jsx)(eF,{label:t("apiKeys.detail.credentialName"),children:(0,s.jsx)("span",{className:"text-sm",children:e.serviceCredentialName})}),(0,s.jsx)(eF,{label:t("apiKeys.detail.status"),children:(0,s.jsx)(N.Badge,{variant:"Active"===e.status?"success":"secondary",children:e.status})}),(0,s.jsx)(eF,{label:t("apiKeys.detail.ramUser"),children:(0,s.jsx)("span",{className:"break-all font-mono text-xs text-muted-foreground",children:e.userPrincipalName})}),(0,s.jsx)(eF,{label:t("apiKeys.detail.createdAt"),children:c?(0,s.jsx)(v.RelativeTime,{timestamp:c}):(0,s.jsx)("span",{className:"text-xs text-muted-foreground",children:"—"})})]})]}),(0,s.jsx)(J.Separator,{}),(0,s.jsxs)("section",{className:"space-y-2.5",children:[(0,s.jsx)("h3",{className:"text-sm font-semibold text-foreground",children:t("apiKeys.detail.permissionOverview")}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:t("apiKeys.detail.permissionOverviewDesc")}),(0,s.jsx)(eI,{serviceCredentialId:e.serviceCredentialId,userName:e.userPrincipalName})]}),(0,s.jsx)(J.Separator,{}),(0,s.jsxs)("section",{className:"space-y-4",children:[(0,s.jsx)("h3",{className:"text-sm font-semibold text-foreground",children:t("apiKeys.detail.permissionConfig")}),(0,s.jsx)(ei,{serviceCredentialId:e.serviceCredentialId,userName:e.userPrincipalName,policies:r}),(0,s.jsxs)("div",{className:"space-y-2.5",children:[(0,s.jsx)("h4",{className:"text-xs font-medium text-foreground",children:t("apiKeys.detail.defaultAuth")}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:t("apiKeys.detail.defaultAuthDesc")}),(0,s.jsx)(eR,{serviceCredentialId:e.serviceCredentialId,userName:e.userPrincipalName,policies:r})]}),(0,s.jsxs)("div",{className:"space-y-2.5",children:[(0,s.jsx)("h4",{className:"text-xs font-medium text-foreground",children:t("apiKeys.detail.customAuth")}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:t("apiKeys.detail.customAuthDesc")}),(0,s.jsx)(eC,{serviceCredentialId:e.serviceCredentialId,userName:e.userPrincipalName})]})]})]}):null]})})}function eF({label:e,children:a}){return(0,s.jsxs)("div",{className:"flex items-start gap-3",children:[(0,s.jsx)(G.Label,{className:"w-20 shrink-0 pt-0.5 text-xs text-muted-foreground",children:e}),(0,s.jsx)("div",{className:"min-w-0 flex-1",children:a})]})}let eO=(0,r.default)("funnel",[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]]),e$={read:"apiKeys.operations.read",write:"apiKeys.operations.write",manage:"apiKeys.operations.manage"};function eU({onFilterResults:e}){let{t}=(0,f.useI18n)(),[i,r]=(0,a.useState)(!1),[n,c]=(0,a.useState)("knowledgebase"),[o,d]=(0,a.useState)(""),[m,p]=(0,a.useState)("read"),{data:y}=(0,eo.useKnowledgeBases)(),{data:h}=(0,ed.useMemoryStores)(),j="knowledgebase"===n?(y?.items??[]).map(e=>e.knowledgeBaseName):(h?.items??[]).map(e=>e.memoryStoreName),g=!!o,{data:v,isFetching:b,refetch:K}=(0,O.useQuery)({queryKey:["api-keys-filter-by-permission",n,o,m],queryFn:()=>R({resourceType:n,resourceName:o,operationGroup:m}),enabled:!1});return i?(0,s.jsxs)("div",{className:"rounded-lg border border-[hsl(var(--border))] p-3 space-y-3",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsx)("span",{className:"text-xs font-medium text-muted-foreground",children:t("apiKeys.filter.title")}),(0,s.jsx)(l.Button,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:function(){r(!1),d(""),e(null)},children:(0,s.jsx)(eS.X,{className:"h-3.5 w-3.5"})})]}),(0,s.jsxs)("div",{className:"flex items-end gap-2 flex-wrap",children:[(0,s.jsxs)("div",{className:"space-y-1 min-w-[120px]",children:[(0,s.jsx)("label",{className:"text-[11px] text-muted-foreground",children:t("apiKeys.common.resourceType")}),(0,s.jsxs)(ec.Select,{value:n,onValueChange:s=>{c(s),d(""),e(null)},children:[(0,s.jsx)(ec.SelectTrigger,{className:"h-8 text-xs",children:(0,s.jsx)(ec.SelectValue,{})}),(0,s.jsxs)(ec.SelectContent,{children:[(0,s.jsx)(ec.SelectItem,{value:"knowledgebase",children:(0,s.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,s.jsx)(u.BookOpen,{className:"h-3 w-3"}),t("common.knowledgeBase")]})}),(0,s.jsx)(ec.SelectItem,{value:"memorystore",children:(0,s.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,s.jsx)(er.Brain,{className:"h-3 w-3"}),t("common.memory")]})})]})]})]}),(0,s.jsxs)("div",{className:"space-y-1 min-w-[160px] flex-1",children:[(0,s.jsx)("label",{className:"text-[11px] text-muted-foreground",children:t("apiKeys.common.resourceName")}),(0,s.jsxs)(ec.Select,{value:o,onValueChange:s=>{d(s),e(null)},children:[(0,s.jsx)(ec.SelectTrigger,{className:"h-8 text-xs",children:(0,s.jsx)(ec.SelectValue,{placeholder:t("apiKeys.filter.selectResource")})}),(0,s.jsx)(ec.SelectContent,{children:j.map(e=>(0,s.jsx)(ec.SelectItem,{value:e,children:e},e))})]})]}),(0,s.jsxs)("div",{className:"space-y-1 min-w-[100px]",children:[(0,s.jsx)("label",{className:"text-[11px] text-muted-foreground",children:t("apiKeys.common.operationPermission")}),(0,s.jsxs)(ec.Select,{value:m,onValueChange:s=>{p(s),e(null)},children:[(0,s.jsx)(ec.SelectTrigger,{className:"h-8 text-xs",children:(0,s.jsx)(ec.SelectValue,{})}),(0,s.jsx)(ec.SelectContent,{children:["read","write","manage"].map(e=>(0,s.jsx)(ec.SelectItem,{value:e,children:t(e$[e])},e))})]})]}),(0,s.jsxs)(l.Button,{size:"sm",className:"h-8",disabled:!g||b,onClick:function(){g&&K().then(s=>{s.data&&e(new Set(s.data.apiKeys.map(e=>e.serviceCredentialId)))})},children:[b?(0,s.jsx)(x.Loader2,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}):(0,s.jsx)(eO,{className:"mr-1.5 h-3.5 w-3.5"}),t("apiKeys.filter.filter")]}),v?(0,s.jsx)(l.Button,{variant:"ghost",size:"sm",className:"h-8 text-xs",onClick:function(){d(""),e(null)},children:t("common.clearSearch")}):null]}),v?(0,s.jsxs)("div",{className:"text-xs text-muted-foreground",children:[t("apiKeys.filter.resultPrefix")," ",(0,s.jsx)(N.Badge,{variant:"secondary",className:"px-1.5 py-0 text-xs",children:v.apiKeys.length})," ",t("apiKeys.filter.resultSuffix",{resource:"knowledgebase"===n?t("common.knowledgeBase"):t("common.memory"),name:o,operation:t(e$[m])})]}):null]}):(0,s.jsxs)(l.Button,{variant:"outline",size:"sm",onClick:()=>r(!0),children:[(0,s.jsx)(eO,{className:"mr-2 h-3.5 w-3.5"}),t("apiKeys.filter.byPermission")]})}let eE=(0,r.default)("download",[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]]);function eQ({apiKey:e,onClose:t}){let{t:i}=(0,f.useI18n)(),[r,c]=(0,a.useState)(!1);(0,a.useEffect)(()=>{e&&c(!1)},[e]);let o=!!e;async function d(e,s){try{await ee(e),m.toast.success(`${i("common.copied")} ${s}`)}catch{m.toast.error(i("common.copyFailed"))}}return(0,s.jsx)(V.Dialog,{open:o,onOpenChange:function(e){(e||r)&&(e||t())},children:(0,s.jsxs)(V.DialogContent,{className:"sm:max-w-lg",onEscapeKeyDown:e=>{r||e.preventDefault()},onPointerDownOutside:e=>{r||e.preventDefault()},children:[(0,s.jsxs)(V.DialogHeader,{children:[(0,s.jsx)(V.DialogTitle,{className:"text-xl",children:i("apiKeys.secret.title")}),(0,s.jsx)(V.DialogDescription,{children:i("apiKeys.secret.description")})]}),e?(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"space-y-1.5",children:[(0,s.jsx)(G.Label,{className:"text-xs text-muted-foreground",children:i("apiKeys.secret.credentialIdLabel")}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("code",{className:"flex-1 break-all rounded border border-[hsl(var(--border))] bg-muted/40 px-3 py-2 font-mono text-[13px]",children:e.serviceCredentialId}),(0,s.jsx)(l.Button,{variant:"outline",size:"icon",onClick:()=>d(e.serviceCredentialId,i("apiKeys.common.credentialId")),"aria-label":i("apiKeys.secret.copyCredentialId"),children:(0,s.jsx)(Z.Copy,{className:"h-4 w-4"})})]})]}),(0,s.jsxs)("div",{className:"space-y-1.5",children:[(0,s.jsx)(G.Label,{className:"text-xs text-muted-foreground",children:i("apiKeys.secret.secretLabel")}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("code",{className:"flex-1 break-all rounded border border-[hsl(var(--warning))/0.5] bg-[hsl(var(--warning))/0.06] px-3 py-2 font-mono text-[13px]",children:e.serviceCredentialSecret}),(0,s.jsx)(l.Button,{variant:"outline",size:"icon",onClick:()=>d(e.serviceCredentialSecret,"Secret"),"aria-label":i("apiKeys.secret.copySecret"),children:(0,s.jsx)(Z.Copy,{className:"h-4 w-4"})})]})]}),(0,s.jsxs)(l.Button,{variant:"outline",className:"w-full",onClick:function(){if(!e)return;let s=e.serviceCredentialId.slice(-6),a=new Date().toISOString().replace(/[:.]/g,"-"),t=new Blob([`ServiceCredentialId: ${e.serviceCredentialId}
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,338309,e=>{"use strict";var s=e.i(44501),a=e.i(101685),t=e.i(736664),i=e.i(358204),r=e.i(801685);let n=(0,r.default)("shield-alert",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]]);var l=e.i(942595),c=e.i(831211),o=e.i(799877),d=e.i(323516),m=e.i(187014),u=e.i(192988);let p=(0,r.default)("brain-circuit",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M9 13a4.5 4.5 0 0 0 3-4",key:"10igwf"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M12 13h4",key:"1ku699"}],["path",{d:"M12 18h6a2 2 0 0 1 2 2v1",key:"105ag5"}],["path",{d:"M12 8h8",key:"1lhi5i"}],["path",{d:"M16 8V5a2 2 0 0 1 2-2",key:"u6izg6"}],["circle",{cx:"16",cy:"13",r:".5",key:"ry7gng"}],["circle",{cx:"18",cy:"3",r:".5",key:"1aiba7"}],["circle",{cx:"20",cy:"21",r:".5",key:"yhc1fs"}],["circle",{cx:"20",cy:"8",r:".5",key:"1e43v0"}]]);var x=e.i(51517);let y=(0,r.default)("shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]);var h=e.i(330363),j=e.i(322740),g=e.i(162769),N=e.i(666458),v=e.i(490314),f=e.i(515793),b=e.i(137500),K=e.i(712984),C=e.i(593321);async function w(){return(await (0,C.apiGet)("/api/v1/api-keys")).apiKeys}async function k(e){let s={};return e?.serviceCredentialName&&(s.serviceCredentialName=e.serviceCredentialName),e?.credentialAgeDays&&e.credentialAgeDays>0&&(s.credentialAgeDays=e.credentialAgeDays),(await (0,C.apiPost)("/api/v1/api-keys",Object.keys(s).length>0?s:void 0)).apiKey}async function S(e){await (0,C.apiDelete)(`/api/v1/api-keys/${encodeURIComponent(e.serviceCredentialId)}`,{userPrincipalName:e.userPrincipalName,deleteCustomPolicy:e.deleteCustomPolicy??!0,deleteRamUser:e.deleteRamUser??!0})}async function I(e){await (0,C.apiPatch)(`/api/v1/api-keys/${encodeURIComponent(e.serviceCredentialId)}`,{userPrincipalName:e.userPrincipalName,status:e.status})}async function T(e,s){return(await (0,C.apiGet)(`/api/v1/api-keys/${encodeURIComponent(e)}/policies?userName=${encodeURIComponent(s)}`)).policies}async function D(e,s){await (0,C.apiPost)(`/api/v1/api-keys/${encodeURIComponent(e)}/policies`,s)}async function P(e,s){await (0,C.apiDelete)(`/api/v1/api-keys/${encodeURIComponent(e)}/policies`,s)}async function A(e,s){return(0,C.apiGet)(`/api/v1/api-keys/${encodeURIComponent(e)}/custom-policy?userName=${encodeURIComponent(s)}`)}async function B(e,s){await (0,C.apiPut)(`/api/v1/api-keys/${encodeURIComponent(e)}/custom-policy`,s)}async function M(e,s){return(0,C.apiGet)(`/api/v1/api-keys/${encodeURIComponent(e)}/effective-permissions?userName=${encodeURIComponent(s)}`)}async function R(e){let s=new URLSearchParams({resourceType:e.resourceType,resourceName:e.resourceName,operationGroup:e.operationGroup});return(0,C.apiGet)(`/api/v1/api-keys/filter-by-permission?${s.toString()}`)}async function L(e,s){await (0,C.apiDelete)(`/api/v1/api-keys/${encodeURIComponent(e)}/custom-policy`,s)}var F=e.i(247570),$=e.i(543876),O=e.i(307166);function U(e,s){let{context:a,ready:t}=(0,O.useRuntimeContext)();return(0,$.useQuery)({queryKey:F.queryKeys.effectivePermissions(a.dataScopeKey,e??""),queryFn:()=>M(e,s),enabled:t&&!!e&&!!s,staleTime:15e3})}function E({apiKeys:e,onDelete:a,onDetail:t}){let{t:i}=(0,f.useI18n)();return(0,s.jsx)("div",{className:"rounded-lg border border-[hsl(var(--border))]",children:(0,s.jsxs)(j.Table,{children:[(0,s.jsx)(j.TableHeader,{children:(0,s.jsxs)(j.TableRow,{children:[(0,s.jsx)(j.TableHead,{children:i("apiKeys.table.credentialName")}),(0,s.jsx)(j.TableHead,{className:"w-[8rem]",children:i("apiKeys.table.status")}),(0,s.jsx)(j.TableHead,{children:i("apiKeys.table.accessibleKnowledgeBase")}),(0,s.jsx)(j.TableHead,{children:i("apiKeys.table.accessibleMemoryStore")}),(0,s.jsx)(j.TableHead,{className:"w-[10rem]",children:i("apiKeys.table.createdAt")}),(0,s.jsx)(j.TableHead,{className:"w-[11rem] text-right",children:i("apiKeys.table.actions")})]})}),(0,s.jsx)(j.TableBody,{children:e.map(e=>(0,s.jsx)(Q,{apiKey:e,onDelete:a,onDetail:t},e.serviceCredentialId))})]})})}function Q({apiKey:e,onDelete:t,onDetail:i}){let r,{t:n}=(0,f.useI18n)(),c=(r=(0,K.useQueryClient)(),(0,b.useMutation)({mutationFn:e=>I(e),onSuccess:()=>{(0,F.invalidateApiKeyQueries)(r)}})),[o,d]=(0,a.useState)(null),u=o??"Active"===e.status,p=Number.isFinite(Date.parse(e.createTime))?Date.parse(e.createTime):null;async function N(s){d(s);try{await c.mutateAsync({serviceCredentialId:e.serviceCredentialId,userPrincipalName:e.userPrincipalName,status:s?"Active":"Inactive"}),m.toast.success(s?n("apiKeys.table.enabled"):n("apiKeys.table.disabled"))}catch(e){d(null),m.toast.error(e instanceof Error?e.message:n("apiKeys.table.operationFailed"))}}return(0,s.jsxs)(j.TableRow,{className:"cursor-pointer",onClick:()=>i(e),children:[(0,s.jsx)(j.TableCell,{children:(0,s.jsxs)("div",{className:"flex flex-col",children:[(0,s.jsx)("span",{className:"text-sm font-medium text-foreground",children:e.serviceCredentialName}),(0,s.jsx)("span",{className:"text-xs text-muted-foreground",children:e.userPrincipalName})]})}),(0,s.jsx)(j.TableCell,{onClick:e=>e.stopPropagation(),children:(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[(0,s.jsx)(g.Switch,{checked:u,onCheckedChange:N,disabled:c.isPending,"aria-label":u?n("apiKeys.table.disable"):n("apiKeys.table.enable")}),(0,s.jsx)("span",{className:u?"text-xs font-medium text-success":"text-xs font-medium text-muted-foreground",children:c.isPending?(0,s.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,s.jsx)(x.Loader2,{className:"h-3 w-3 animate-spin"}),n("apiKeys.table.toggling")]}):u?n("apiKeys.table.statusActive"):n("apiKeys.table.statusInactive")})]})}),(0,s.jsx)(j.TableCell,{onClick:e=>e.stopPropagation(),children:(0,s.jsx)(H,{serviceCredentialId:e.serviceCredentialId,userName:e.userPrincipalName,resourceType:"knowledgebase"})}),(0,s.jsx)(j.TableCell,{onClick:e=>e.stopPropagation(),children:(0,s.jsx)(H,{serviceCredentialId:e.serviceCredentialId,userName:e.userPrincipalName,resourceType:"memorystore"})}),(0,s.jsx)(j.TableCell,{children:p?(0,s.jsx)(v.RelativeTime,{timestamp:p}):(0,s.jsx)("span",{className:"text-xs text-muted-foreground",children:"—"})}),(0,s.jsxs)(j.TableCell,{className:"text-right",children:[(0,s.jsxs)(l.Button,{variant:"ghost",size:"sm",className:"h-8",onClick:s=>{s.stopPropagation(),i(e)},children:[(0,s.jsx)(y,{className:"mr-1 h-3.5 w-3.5"}),n("apiKeys.table.permission")]}),(0,s.jsxs)(l.Button,{variant:"ghost",size:"sm",className:`h-8 text-[hsl(var(--destructive))] hover:bg-[hsl(var(--destructive))/0.08] hover:text-[hsl(var(--destructive))] ${u?"opacity-50 cursor-not-allowed":""}`,onClick:s=>{s.stopPropagation(),u?m.toast.info(n("apiKeys.table.disableBeforeDelete")):t(e)},children:[(0,s.jsx)(h.Trash2,{className:"mr-1 h-3.5 w-3.5"}),n("common.delete")]})]})]})}function H({serviceCredentialId:e,userName:a,resourceType:t}){let{t:i}=(0,f.useI18n)(),{data:r,isLoading:n,isError:l}=U(e,a);if(n)return(0,s.jsx)(x.Loader2,{className:"h-3.5 w-3.5 animate-spin text-muted-foreground"});if(l)return(0,s.jsx)("span",{className:"text-xs text-muted-foreground",children:"—"});let c=(r?.resources?.filter(e=>e.resourceType===t)??[]).filter(e=>e.permissions.read||e.permissions.write||e.permissions.manage);if(0===c.length)return(0,s.jsx)("span",{className:"text-xs text-muted-foreground",children:i("apiKeys.table.none")});let o="knowledgebase"===t?u.BookOpen:p;return(0,s.jsx)("div",{className:"flex flex-wrap gap-1",children:c.map(e=>(0,s.jsxs)(N.Badge,{variant:"secondary",className:"gap-1 text-[11px] font-normal",children:[(0,s.jsx)(o,{className:"h-3 w-3"}),e.resourceName]},e.resourceName))})}var q=e.i(309823),z=e.i(723888),G=e.i(766476),V=e.i(433253);function W({open:e,onOpenChange:t,onCreated:i}){let r,{t:n}=(0,f.useI18n)(),c=(r=(0,K.useQueryClient)(),(0,b.useMutation)({mutationFn:e=>k(e),onSuccess:()=>{(0,F.invalidateApiKeyQueries)(r)}})),[o,d]=(0,a.useState)(""),[u,p]=(0,a.useState)("");async function x(){let e=o.trim();if(!e)return void m.toast.error(n("apiKeys.create.nameRequired"));let s=u?Number(u):void 0;if(void 0!==s&&(s<1||s>365||!Number.isInteger(s)))return void m.toast.error(n("apiKeys.create.ageDaysInvalid"));try{let a=await c.mutateAsync({serviceCredentialName:e,credentialAgeDays:s});t(!1),i(a)}catch(e){m.toast.error(e instanceof Error?e.message:n("apiKeys.create.createFailed"))}}return(0,a.useEffect)(()=>{e&&(d("ots_apikey_"+Date.now().toString(36)+"_"+Math.random().toString(36).slice(2,6)),p(""))},[e]),(0,s.jsx)(V.Dialog,{open:e,onOpenChange:e=>{t(e)},children:(0,s.jsxs)(V.DialogContent,{className:"sm:max-w-md",children:[(0,s.jsx)(V.DialogHeader,{children:(0,s.jsx)(V.DialogTitle,{className:"text-xl",children:n("apiKeys.create.title")})}),(0,s.jsxs)("div",{className:"space-y-3 py-1 text-sm leading-relaxed text-muted-foreground",children:[(0,s.jsxs)("p",{children:[n("apiKeys.create.introPrefix"),(0,s.jsx)("code",{className:"rounded bg-muted px-1.5 py-0.5 font-mono text-xs text-foreground",children:"ots.aliyuncs.com"}),n("apiKeys.create.introSuffix")]}),(0,s.jsxs)("div",{className:"space-y-1.5",children:[(0,s.jsx)(G.Label,{className:"text-xs text-foreground",children:n("apiKeys.create.credentialName")}),(0,s.jsx)(z.Input,{value:o,onChange:e=>d(e.target.value),placeholder:n("apiKeys.create.credentialNamePlaceholder"),className:"h-9"}),(0,s.jsx)("p",{className:"text-[11px] text-muted-foreground",children:n("apiKeys.create.credentialNameHelp")})]}),(0,s.jsxs)("div",{className:"space-y-1.5",children:[(0,s.jsx)(G.Label,{className:"text-xs text-foreground",children:n("apiKeys.create.ageDays")}),(0,s.jsx)(z.Input,{type:"number",min:1,max:365,value:u,onChange:e=>p(e.target.value),placeholder:n("apiKeys.create.ageDaysPlaceholder"),className:"h-9"}),(0,s.jsx)("p",{className:"text-[11px] text-muted-foreground",children:n("apiKeys.create.ageDaysHelp")})]}),(0,s.jsx)("div",{className:"rounded-md border border-[hsl(var(--warning))/0.5] bg-[hsl(var(--warning))/0.08] px-4 py-3 text-sm",children:(0,s.jsxs)("p",{className:"text-foreground",children:[(0,s.jsx)(q.AlertTriangle,{className:"mr-1 -mt-0.5 inline h-4 w-4 text-warning"}),n("apiKeys.create.secretWarning")]})})]}),(0,s.jsxs)(V.DialogFooter,{children:[(0,s.jsx)(l.Button,{variant:"outline",onClick:()=>t(!1),disabled:c.isPending,children:n("common.cancel")}),(0,s.jsx)(l.Button,{onClick:x,disabled:c.isPending,children:c.isPending?n("common.creating"):n("apiKeys.create.confirm")})]})]})})}var _=e.i(663630);function X({apiKey:e,open:t,onOpenChange:i}){let r,{t:n}=(0,f.useI18n)(),c=(r=(0,K.useQueryClient)(),(0,b.useMutation)({mutationFn:e=>S(e),onSuccess:()=>{(0,F.invalidateApiKeyQueries)(r)}})),[o,d]=(0,a.useState)(!0),[u,p]=(0,a.useState)(!0);async function x(){if(e)try{await c.mutateAsync({serviceCredentialId:e.serviceCredentialId,userPrincipalName:e.userPrincipalName,deleteCustomPolicy:o,deleteRamUser:u}),m.toast.success(n("apiKeys.delete.deleteSuccess")),i(!1)}catch(e){m.toast.error(e instanceof Error?e.message:n("apiKeys.delete.deleteFailed"))}}return(0,a.useEffect)(()=>{t&&(d(!0),p(!0))},[t]),(0,s.jsx)(V.Dialog,{open:t,onOpenChange:i,children:(0,s.jsxs)(V.DialogContent,{className:"sm:max-w-md",children:[(0,s.jsx)(V.DialogHeader,{children:(0,s.jsx)(V.DialogTitle,{className:"text-xl",children:n("apiKeys.delete.title")})}),(0,s.jsxs)("div",{className:"rounded-md border border-[hsl(var(--destructive))] bg-[hsl(var(--destructive))/0.06] px-4 py-3 text-sm leading-relaxed",children:[(0,s.jsxs)("p",{children:[(0,s.jsx)(q.AlertTriangle,{className:"mr-1 -mt-0.5 inline h-4 w-4 text-destructive"}),n("apiKeys.delete.warning")]}),e?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("p",{className:"mt-3",children:[(0,s.jsx)("span",{className:"text-muted-foreground",children:n("apiKeys.delete.credentialNameLabel")}),(0,s.jsx)("code",{className:"font-mono text-xs",children:e.serviceCredentialName})]}),"Active"===e.status?(0,s.jsx)("p",{className:"mt-2 text-xs text-muted-foreground",children:n("apiKeys.delete.activeHint")}):null]}):null]}),(0,s.jsxs)("div",{className:"space-y-3",children:[(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:n("apiKeys.delete.cleanupHint")}),(0,s.jsxs)("label",{className:"flex items-start gap-2 cursor-pointer",children:[(0,s.jsx)(_.Checkbox,{checked:o,onCheckedChange:e=>d(!!e),className:"mt-0.5"}),(0,s.jsxs)("div",{children:[(0,s.jsx)(G.Label,{className:"text-sm cursor-pointer",children:n("apiKeys.delete.deleteCustomPolicy")}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:n("apiKeys.delete.deleteCustomPolicyDesc")})]})]}),(0,s.jsxs)("label",{className:"flex items-start gap-2 cursor-pointer",children:[(0,s.jsx)(_.Checkbox,{checked:u,onCheckedChange:e=>p(!!e),className:"mt-0.5"}),(0,s.jsxs)("div",{children:[(0,s.jsx)(G.Label,{className:"text-sm cursor-pointer",children:n("apiKeys.delete.deleteRamUser")}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:n("apiKeys.delete.deleteRamUserDesc")})]})]})]}),(0,s.jsxs)(V.DialogFooter,{children:[(0,s.jsx)(l.Button,{variant:"outline",onClick:()=>i(!1),disabled:c.isPending,children:n("common.cancel")}),(0,s.jsx)(l.Button,{variant:"destructive",disabled:c.isPending,onClick:x,children:c.isPending?n("common.deleting"):n("apiKeys.delete.confirm")})]})]})})}var Z=e.i(882652),J=e.i(103343),Y=e.i(144308);async function ee(e){if(navigator.clipboard&&window.isSecureContext)return void await navigator.clipboard.writeText(e);let s=document.createElement("textarea");s.value=e,s.style.position="fixed",s.style.opacity="0",document.body.appendChild(s),s.select(),document.execCommand("copy"),document.body.removeChild(s)}function es(){let e=(0,K.useQueryClient)();return(0,b.useMutation)({mutationFn:e=>D(e.serviceCredentialId,{userName:e.userName,policyName:e.policyName,policyType:e.policyType}),onSuccess:()=>{(0,F.invalidateApiKeyPolicyQueries)(e),(0,F.invalidateEffectivePermissionsQueries)(e)}})}function ea(){let e=(0,K.useQueryClient)();return(0,b.useMutation)({mutationFn:e=>P(e.serviceCredentialId,{userName:e.userName,policyName:e.policyName,policyType:e.policyType}),onSuccess:()=>{(0,F.invalidateApiKeyPolicyQueries)(e),(0,F.invalidateEffectivePermissionsQueries)(e)}})}let et="ts-ots-bearer-token-access";function ei({serviceCredentialId:e,userName:t,policies:i}){let{t:r}=(0,f.useI18n)(),n=es(),l=ea(),[c,o]=(0,a.useState)(!1),d=i?.some(e=>e.policyName===et)??!1;async function u(s){o(!0);try{s?(await n.mutateAsync({serviceCredentialId:e,userName:t,policyName:et,policyType:"Custom"}),m.toast.success(r("apiKeys.bearer.enableSuccess"))):(await l.mutateAsync({serviceCredentialId:e,userName:t,policyName:et,policyType:"Custom"}),m.toast.success(r("apiKeys.bearer.disableSuccess")))}catch(e){m.toast.error(e instanceof Error?e.message:r("apiKeys.bearer.operationFailed"))}finally{o(!1)}}return(0,s.jsxs)("div",{className:"flex items-center justify-between rounded-md border border-[hsl(var(--border))] px-3 py-2.5",children:[(0,s.jsxs)("div",{className:"space-y-0.5",children:[(0,s.jsx)("div",{className:"text-sm font-medium",children:r("apiKeys.bearer.title")}),(0,s.jsx)("div",{className:"text-xs text-muted-foreground",children:r("apiKeys.bearer.description")})]}),(0,s.jsxs)("div",{className:"flex items-center gap-2 shrink-0 ml-3",children:[c?(0,s.jsx)(x.Loader2,{className:"h-4 w-4 animate-spin text-muted-foreground"}):null,(0,s.jsx)(g.Switch,{checked:d,onCheckedChange:u,disabled:c||!i})]})]})}var er=e.i(18722),en=e.i(533153),el=e.i(843226),ec=e.i(166473),eo=e.i(247932),ed=e.i(754614),em=e.i(164204);let eu=["ots:DescribeKnowledgeBase","ots:ListKnowledgeBase","ots:GetDocument","ots:ListDocuments","ots:ListChunks","ots:Retrieve"],ep=["ots:AddDocuments","ots:UpdateDocument","ots:UpdateChunks","ots:DeleteDocuments","ots:UploadDocuments"],ex=["ots:CreateKnowledgeBase","ots:DeleteKnowledgeBase","ots:UpdateKnowledgeBase"],ey=["ots:GetMemoryStore","ots:ListMemoryStores","ots:SearchMemories","ots:ListMemories","ots:GetMemory","ots:ListMemoryStoreMessages","ots:ListMemoryStoreRequests","ots:ListMemoryStoreScopes","ots:GetMemoryTask","ots:ListMemoryTasks","ots:GetMemoryDreamTask","ots:ListMemoryDreamTasks","ots:ListMemoryDreamActions"],eh=["ots:AddMemories","ots:UpdateMemory","ots:DeleteMemory","ots:ApplyMemoryDreamActions","ots:CreateMemoryDreamTask","ots:CancelMemoryDreamTask"],ej=["ots:CreateMemoryStore","ots:DeleteMemoryStore","ots:UpdateMemoryStore"];function eg(e,s){return"knowledgebase"===e?"read"===s?eu:"write"===s?ep:ex:"read"===s?ey:"write"===s?eh:ej}[...eu,...ep,...ex],[...ey,...eh,...ej];let eN={read:"apiKeys.operations.read",write:"apiKeys.operations.write",manage:"apiKeys.operations.manage"},ev={knowledgebase:{read:"apiKeys.operations.knowledgeBaseReadDesc",write:"apiKeys.operations.knowledgeBaseWriteDesc",manage:"apiKeys.operations.knowledgeBaseManageDesc"},memorystore:{read:"apiKeys.operations.memoryStoreReadDesc",write:"apiKeys.operations.memoryStoreWriteDesc",manage:"apiKeys.operations.memoryStoreManageDesc"}};function ef(e){return[e.appId??"",e.tenantId??"",e.agentId??"",e.runId??""].join("|")}function eb({open:e,onOpenChange:t,onSave:i,initial:r}){let{t:n}=(0,f.useI18n)(),[c,o]=(0,a.useState)(r?.resourceType??"knowledgebase"),[d,m]=(0,a.useState)(r?.resourceName??"*"),[p,y]=(0,a.useState)(new Set(r?.operationGroups??["read"])),[h,j]=(0,a.useState)(r?.scope??{}),[g,N]=(0,a.useState)(r?.condition?.sourceIp?.join(", ")??""),[v,b]=(0,a.useState)(!!(r?.scope&&(r.scope.appId||r.scope.tenantId||r.scope.agentId||r.scope.runId))),[K,C]=(0,a.useState)("manual"),{data:w}=(0,eo.useKnowledgeBases)(),{data:k}=(0,ed.useMemoryStores)(),S=e&&"memorystore"===c&&"*"!==d&&v,{data:I,isLoading:T}=(0,$.useQuery)({queryKey:["memory-store-scopes-for-rule",d],queryFn:()=>(0,em.listMemoryStoreScopesUnfiltered)(d),enabled:S,staleTime:3e4}),D=I?.items??[];(0,a.useEffect)(()=>{e&&(o(r?.resourceType??"knowledgebase"),m(r?.resourceName??"*"),y(new Set(r?.operationGroups??["read"])),j(r?.scope??{}),N(r?.condition?.sourceIp?.join(", ")??""),b(!!(r?.scope&&(r.scope.appId||r.scope.tenantId||r.scope.agentId||r.scope.runId))),C("manual"))},[e,r]);let P="knowledgebase"===c?(w?.items??[]).map(e=>e.knowledgeBaseName):(k?.items??[]).map(e=>e.memoryStoreName);return(0,s.jsx)(V.Dialog,{open:e,onOpenChange:t,children:(0,s.jsxs)(V.DialogContent,{className:"sm:max-w-lg max-h-[85vh] overflow-y-auto",children:[(0,s.jsx)(V.DialogHeader,{children:(0,s.jsx)(V.DialogTitle,{children:r?n("apiKeys.rule.editTitle"):n("apiKeys.rule.addTitle")})}),(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"space-y-1.5",children:[(0,s.jsx)(G.Label,{className:"text-xs text-muted-foreground",children:n("apiKeys.rule.resourceType")}),(0,s.jsxs)(ec.Select,{value:c,onValueChange:e=>{o(e),m("*"),b(!1),j({})},children:[(0,s.jsx)(ec.SelectTrigger,{children:(0,s.jsx)(ec.SelectValue,{})}),(0,s.jsxs)(ec.SelectContent,{children:[(0,s.jsx)(ec.SelectItem,{value:"knowledgebase",children:(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(u.BookOpen,{className:"h-3.5 w-3.5"}),n("common.knowledgeBase")]})}),(0,s.jsx)(ec.SelectItem,{value:"memorystore",children:(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(er.Brain,{className:"h-3.5 w-3.5"}),n("common.memory")]})})]})]})]}),(0,s.jsxs)("div",{className:"space-y-1.5",children:[(0,s.jsx)(G.Label,{className:"text-xs text-muted-foreground",children:n("apiKeys.rule.resourceName")}),(0,s.jsxs)(ec.Select,{value:d,onValueChange:e=>{m(e),b(!1),j({})},children:[(0,s.jsx)(ec.SelectTrigger,{children:(0,s.jsx)(ec.SelectValue,{})}),(0,s.jsxs)(ec.SelectContent,{children:[(0,s.jsx)(ec.SelectItem,{value:"*",children:n("apiKeys.rule.allResource",{resource:"knowledgebase"===c?n("common.knowledgeBase"):n("common.memory")})}),P.map(e=>(0,s.jsx)(ec.SelectItem,{value:e,children:e},e))]})]})]}),"memorystore"===c&&"*"!==d&&(0,s.jsxs)("div",{className:"space-y-1.5",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(_.Checkbox,{checked:v,onCheckedChange:e=>{b(!!e),e||j({})}}),(0,s.jsx)(G.Label,{className:"text-xs text-muted-foreground",children:n("apiKeys.rule.scopeConfig")})]}),v&&(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(l.Button,{variant:"select"===K?"default":"outline",size:"sm",className:"h-7 text-xs",onClick:()=>C("select"),children:n("apiKeys.rule.selectFromExisting")}),(0,s.jsx)(l.Button,{variant:"manual"===K?"default":"outline",size:"sm",className:"h-7 text-xs",onClick:()=>C("manual"),children:n("apiKeys.rule.manualInput")})]}),"select"===K?(0,s.jsx)("div",{className:"rounded-md border border-[hsl(var(--border))] p-3 space-y-1.5",children:T?(0,s.jsxs)("div",{className:"flex items-center gap-2 py-2 text-xs text-muted-foreground",children:[(0,s.jsx)(x.Loader2,{className:"h-3.5 w-3.5 animate-spin"}),n("apiKeys.rule.loadingScopes")]}):0===D.length?(0,s.jsx)("p",{className:"py-2 text-xs text-muted-foreground",children:n("apiKeys.rule.noScopes")}):(0,s.jsx)("div",{className:"max-h-40 overflow-y-auto space-y-1",children:D.map(e=>{let a,t=ef(e),i=ef(h)===t;return(0,s.jsxs)("label",{className:`flex items-center gap-2 rounded px-2 py-1.5 cursor-pointer hover:bg-muted/50 ${i?"bg-muted":""}`,children:[(0,s.jsx)(_.Checkbox,{checked:i,onCheckedChange:()=>{if(i)j({});else j({appId:e.appId||void 0,tenantId:e.tenantId||void 0,agentId:e.agentId||void 0,runId:e.runId||void 0})}}),(0,s.jsx)("span",{className:"text-xs font-mono truncate",children:(a=[],e.appId&&a.push(`app:${e.appId}`),e.tenantId&&a.push(`tenant:${e.tenantId}`),e.agentId&&a.push(`agent:${e.agentId}`),e.runId&&a.push(`${n("memory.scopeField.run")}:${e.runId}`),a.join(", "))})]},t)})})}):(0,s.jsxs)("div",{className:"grid grid-cols-2 gap-2 rounded-md border border-[hsl(var(--border))] p-3",children:[(0,s.jsxs)("div",{className:"space-y-1",children:[(0,s.jsx)(G.Label,{className:"text-[11px] text-muted-foreground",children:"App ID"}),(0,s.jsx)(z.Input,{value:h.appId??"",onChange:e=>j(s=>({...s,appId:e.target.value||void 0})),placeholder:n("apiKeys.rule.optional"),className:"h-8 text-xs"})]}),(0,s.jsxs)("div",{className:"space-y-1",children:[(0,s.jsx)(G.Label,{className:"text-[11px] text-muted-foreground",children:"Tenant ID"}),(0,s.jsx)(z.Input,{value:h.tenantId??"",onChange:e=>j(s=>({...s,tenantId:e.target.value||void 0})),placeholder:n("apiKeys.rule.optional"),className:"h-8 text-xs"})]}),(0,s.jsxs)("div",{className:"space-y-1",children:[(0,s.jsx)(G.Label,{className:"text-[11px] text-muted-foreground",children:"Agent ID"}),(0,s.jsx)(z.Input,{value:h.agentId??"",onChange:e=>j(s=>({...s,agentId:e.target.value||void 0})),placeholder:n("apiKeys.rule.optional"),className:"h-8 text-xs"})]}),(0,s.jsxs)("div",{className:"space-y-1",children:[(0,s.jsx)(G.Label,{className:"text-[11px] text-muted-foreground",children:n("apiKeys.rule.sessionId")}),(0,s.jsx)(z.Input,{value:h.runId??"",onChange:e=>j(s=>({...s,runId:e.target.value||void 0})),placeholder:n("apiKeys.rule.optional"),className:"h-8 text-xs"})]})]})]})]}),(0,s.jsxs)("div",{className:"space-y-1.5",children:[(0,s.jsx)(G.Label,{className:"text-xs text-muted-foreground",children:n("apiKeys.rule.operationPermission")}),(0,s.jsx)("div",{className:"space-y-2",children:["read","write","manage"].map(e=>{let a;return(0,s.jsxs)("label",{className:"flex items-start gap-2 rounded-md border border-[hsl(var(--border))] px-3 py-2 cursor-pointer hover:bg-muted/30",children:[(0,s.jsx)(_.Checkbox,{checked:p.has(e),onCheckedChange:()=>{y(s=>{let a=new Set(s);return a.has(e)?a.delete(e):a.add(e),a})},className:"mt-0.5"}),(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsx)("div",{className:"text-sm font-medium",children:n(eN[e])}),(0,s.jsx)("div",{className:"text-xs text-muted-foreground",children:(a=ev[c]?.[e])?n(a):null}),(0,s.jsx)("div",{className:"mt-1 text-[11px] text-muted-foreground/60",children:eg(c,e).map(e=>e.replace("ots:","")).join(", ")})]})]},e)})})]}),(0,s.jsxs)("div",{className:"space-y-1.5",children:[(0,s.jsx)(G.Label,{className:"text-xs text-muted-foreground",children:n("apiKeys.rule.ipWhitelist")}),(0,s.jsx)(z.Input,{value:g,onChange:e=>N(e.target.value),placeholder:n("apiKeys.rule.ipPlaceholder"),className:"text-xs"}),(0,s.jsx)("p",{className:"text-[11px] text-muted-foreground",children:n("apiKeys.rule.ipHelp")})]})]}),(0,s.jsxs)(V.DialogFooter,{children:[(0,s.jsx)(l.Button,{variant:"outline",onClick:()=>t(!1),children:n("common.cancel")}),(0,s.jsx)(l.Button,{disabled:0===p.size,onClick:function(){var e;let s=Array.from(p),a=function(e,s){let a=[];for(let t of s)a.push(...eg(e,t));return[...new Set(a)]}(c,s),r=g.split(/[,,\s]+/).map(e=>e.trim()).filter(Boolean);i({resourceType:c,resourceName:d,operationGroups:s,actions:a,..."memorystore"===c&&v&&((e=h).appId||e.tenantId||e.agentId||e.runId)?{scope:h}:{},...r.length>0?{condition:{sourceIp:r}}:{}}),t(!1)},children:r?n("apiKeys.rule.saveChanges"):n("apiKeys.rule.add")})]})]})})}let eK={read:"apiKeys.operations.read",write:"apiKeys.operations.write",manage:"apiKeys.operations.manage"};function eC({serviceCredentialId:e,userName:t}){let r,n,{t:o}=(0,f.useI18n)(),{data:d,isLoading:u}=function(e,s){let{context:a,ready:t}=(0,O.useRuntimeContext)();return(0,$.useQuery)({queryKey:F.queryKeys.customPolicy(a.dataScopeKey,e??""),queryFn:()=>A(e,s),enabled:t&&!!e&&!!s,staleTime:15e3})}(e,t),p=(r=(0,K.useQueryClient)(),(0,b.useMutation)({mutationFn:e=>B(e.serviceCredentialId,{userName:e.userName,rules:e.rules}),onSuccess:()=>{(0,F.invalidateCustomPolicyQueries)(r),(0,F.invalidateApiKeyPolicyQueries)(r),(0,F.invalidateEffectivePermissionsQueries)(r)}})),y=(n=(0,K.useQueryClient)(),(0,b.useMutation)({mutationFn:e=>L(e.serviceCredentialId,{userName:e.userName}),onSuccess:()=>{(0,F.invalidateCustomPolicyQueries)(n),(0,F.invalidateApiKeyPolicyQueries)(n),(0,F.invalidateEffectivePermissionsQueries)(n)}})),[j,g]=(0,a.useState)([]),[N,v]=(0,a.useState)(!1),[C,w]=(0,a.useState)(!1),[k,S]=(0,a.useState)(null);async function I(){try{await p.mutateAsync({serviceCredentialId:e,userName:t,rules:j}),v(!1),m.toast.success(o("apiKeys.customPolicy.saveSuccess"))}catch(e){m.toast.error(e instanceof Error?e.message:o("apiKeys.customPolicy.saveFailed"))}}async function T(){try{await y.mutateAsync({serviceCredentialId:e,userName:t}),g([]),v(!1),m.toast.success(o("apiKeys.customPolicy.deleteSuccess"))}catch(e){m.toast.error(e instanceof Error?e.message:o("apiKeys.customPolicy.deleteFailed"))}}return(0,a.useEffect)(()=>{d&&(g(d.rules),v(!1))},[d]),u?(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(c.Skeleton,{className:"h-8 w-full"}),(0,s.jsx)(c.Skeleton,{className:"h-8 w-full"})]}):(0,s.jsxs)("div",{className:"space-y-3",children:[0===j.length?(0,s.jsx)("p",{className:"py-3 text-center text-sm text-muted-foreground",children:o("apiKeys.customPolicy.empty")}):(0,s.jsx)("div",{className:"space-y-1.5",children:j.map((e,a)=>(0,s.jsx)(ew,{rule:e,t:o,onEdit:()=>{S(a),w(!0)},onRemove:()=>{g(e=>e.filter((e,s)=>s!==a)),v(!0)}},a))}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsxs)(l.Button,{variant:"outline",size:"sm",className:"h-8",onClick:()=>{S(null),w(!0)},children:[(0,s.jsx)(i.Plus,{className:"mr-1 h-3.5 w-3.5"}),o("apiKeys.customPolicy.addRule")]}),N&&(0,s.jsxs)(l.Button,{size:"sm",className:"h-8",disabled:p.isPending,onClick:I,children:[p.isPending?(0,s.jsx)(x.Loader2,{className:"mr-1 h-3.5 w-3.5 animate-spin"}):(0,s.jsx)(el.Save,{className:"mr-1 h-3.5 w-3.5"}),o("common.save")]}),d&&d.rules.length>0&&(0,s.jsxs)(l.Button,{variant:"ghost",size:"sm",className:"h-8 text-destructive hover:text-destructive",disabled:y.isPending,onClick:T,children:[y.isPending?(0,s.jsx)(x.Loader2,{className:"mr-1 h-3.5 w-3.5 animate-spin"}):(0,s.jsx)(h.Trash2,{className:"mr-1 h-3.5 w-3.5"}),o("apiKeys.customPolicy.clearAll")]})]}),(0,s.jsx)(eb,{open:C,onOpenChange:w,onSave:function(e){null!==k?(g(s=>{let a=[...s];return a[k]=e,a}),S(null)):g(s=>[...s,e]),v(!0)},initial:null!==k?j[k]:void 0})]})}function ew({rule:e,t:a,onEdit:t,onRemove:i}){let r="knowledgebase"===e.resourceType?u.BookOpen:er.Brain,n="knowledgebase"===e.resourceType?a("common.knowledgeBase"):a("common.memory"),c="*"===e.resourceName?a("apiKeys.rule.allResource",{resource:n}):e.resourceName,o="";if(e.scope){let s=[];e.scope.appId&&s.push(`app:${e.scope.appId}`),e.scope.tenantId&&s.push(`tenant:${e.scope.tenantId}`),e.scope.agentId&&s.push(`agent:${e.scope.agentId}`),e.scope.runId&&s.push(`${a("memory.scopeField.run")}:${e.scope.runId}`),s.length>0&&(o=` (${s.join(", ")})`)}return(0,s.jsxs)("div",{className:"flex items-center justify-between rounded-md border border-[hsl(var(--border))] px-3 py-2",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,s.jsx)(r,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),(0,s.jsxs)("span",{className:"truncate text-sm font-medium",children:[c,o&&(0,s.jsx)("span",{className:"text-xs text-muted-foreground",children:o})]}),(0,s.jsxs)("div",{className:"flex items-center gap-1",children:[e.operationGroups.map(e=>(0,s.jsx)(N.Badge,{variant:"secondary",className:"text-[10px]",children:eK[e]?a(eK[e]):e},e)),e.condition?.sourceIp&&e.condition.sourceIp.length>0&&(0,s.jsx)(N.Badge,{variant:"outline",className:"text-[10px]",children:a("apiKeys.customPolicy.ipLimit")})]})]}),(0,s.jsxs)("div",{className:"flex items-center gap-1 shrink-0 ml-2",children:[(0,s.jsx)(l.Button,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-foreground",onClick:t,children:(0,s.jsx)(en.Pencil,{className:"h-3.5 w-3.5"})}),(0,s.jsx)(l.Button,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-destructive",onClick:i,children:(0,s.jsx)(h.Trash2,{className:"h-3.5 w-3.5"})})]})]})}var ek=e.i(506703),eS=e.i(546398);function eI({serviceCredentialId:e,userName:a}){let{t}=(0,f.useI18n)(),{data:i,isLoading:r,error:n}=U(e,a);if(r)return(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(c.Skeleton,{className:"h-10 w-full"}),(0,s.jsx)(c.Skeleton,{className:"h-10 w-full"}),(0,s.jsx)(c.Skeleton,{className:"h-10 w-full"})]});if(n)return(0,s.jsx)("p",{className:"py-3 text-center text-sm text-destructive",children:t("apiKeys.overview.loadFailed")});if(!i||0===i.resources.length)return(0,s.jsx)("p",{className:"py-3 text-center text-sm text-muted-foreground",children:t("apiKeys.overview.empty")});let l=i.resources.filter(e=>"knowledgebase"===e.resourceType),o=i.resources.filter(e=>"memorystore"===e.resourceType);return(0,s.jsxs)("div",{className:"space-y-4",children:[l.length>0&&(0,s.jsx)(eT,{icon:(0,s.jsx)(u.BookOpen,{className:"h-3.5 w-3.5"}),label:t("common.knowledgeBase"),resources:l}),o.length>0&&(0,s.jsx)(eT,{icon:(0,s.jsx)(er.Brain,{className:"h-3.5 w-3.5"}),label:t("common.memory"),resources:o})]})}function eT({icon:e,label:a,resources:t}){let{t:i}=(0,f.useI18n)();return(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"mb-1.5 flex items-center gap-1.5 text-xs font-medium text-muted-foreground",children:[e,a]}),(0,s.jsx)("div",{className:"rounded-md border border-[hsl(var(--border))]",children:(0,s.jsxs)(j.Table,{children:[(0,s.jsx)(j.TableHeader,{children:(0,s.jsxs)(j.TableRow,{children:[(0,s.jsx)(j.TableHead,{className:"text-xs",children:i("apiKeys.overview.name")}),(0,s.jsx)(j.TableHead,{className:"w-16 text-center text-xs",children:i("apiKeys.overview.read")}),(0,s.jsx)(j.TableHead,{className:"w-16 text-center text-xs",children:i("apiKeys.overview.write")}),(0,s.jsx)(j.TableHead,{className:"w-16 text-center text-xs",children:i("apiKeys.overview.manage")})]})}),(0,s.jsx)(j.TableBody,{children:t.map(e=>(0,s.jsxs)(j.TableRow,{children:[(0,s.jsx)(j.TableCell,{className:"py-1.5",children:(0,s.jsx)("code",{className:"font-mono text-xs",children:e.resourceName})}),(0,s.jsx)(j.TableCell,{className:"py-1.5 text-center",children:(0,s.jsx)(eD,{allowed:e.permissions.read})}),(0,s.jsx)(j.TableCell,{className:"py-1.5 text-center",children:(0,s.jsx)(eD,{allowed:e.permissions.write})}),(0,s.jsx)(j.TableCell,{className:"py-1.5 text-center",children:(0,s.jsx)(eD,{allowed:e.permissions.manage})})]},e.resourceName))})]})})]})}function eD({allowed:e}){return e?(0,s.jsx)(ek.Check,{className:"mx-auto h-4 w-4 text-success"}):(0,s.jsx)(eS.X,{className:"mx-auto h-4 w-4 text-muted-foreground/40"})}var eP=e.i(573581),eA=e.i(608984);let eB=["AliyunOTSFullAccess","AliyunOTSReadOnlyAccess","AliyunOTSWriteOnlyAccess"],eM=[{key:"readonly",labelKey:"apiKeys.presets.readonlyLabel",descriptionKey:"apiKeys.presets.readonlyDesc",icon:eP.Eye,attach:["AliyunOTSReadOnlyAccess"]},{key:"full",labelKey:"apiKeys.presets.fullLabel",descriptionKey:"apiKeys.presets.fullDesc",icon:y,attach:["AliyunOTSFullAccess"]}];function eR({serviceCredentialId:e,userName:t,policies:i}){let{t:r}=(0,f.useI18n)(),n=es(),c=ea(),[o,d]=(0,a.useState)(null),u=function(e){if(!e)return null;let s=new Set(e.filter(e=>eB.includes(e.policyName)).map(e=>e.policyName));return s.has("AliyunOTSFullAccess")?"full":s.has("AliyunOTSReadOnlyAccess")&&!s.has("AliyunOTSWriteOnlyAccess")?"readonly":null}(i);async function p(s){if(u===s.key)return void await y();d(s.key);try{let a=(i??[]).filter(e=>eB.includes(e.policyName));for(let i of a)s.attach.includes(i.policyName)||await c.mutateAsync({serviceCredentialId:e,userName:t,policyName:i.policyName,policyType:i.policyType});let l=new Set(a.map(e=>e.policyName));for(let a of s.attach)l.has(a)||await n.mutateAsync({serviceCredentialId:e,userName:t,policyName:a,policyType:"System"});m.toast.success(r("apiKeys.presets.applySuccess",{preset:r(s.labelKey)}))}catch(e){m.toast.error(e instanceof Error?e.message:r("apiKeys.presets.applyFailed"))}finally{d(null)}}async function y(){d("cancel");try{for(let s of(i??[]).filter(e=>eB.includes(e.policyName)))await c.mutateAsync({serviceCredentialId:e,userName:t,policyName:s.policyName,policyType:s.policyType});m.toast.success(r("apiKeys.presets.cancelSuccess"))}catch(e){m.toast.error(e instanceof Error?e.message:r("apiKeys.presets.cancelFailed"))}finally{d(null)}}return(0,s.jsx)("div",{className:"grid grid-cols-2 gap-2",children:eM.map(e=>{let a=u===e.key,t=o===e.key,i=e.icon;return(0,s.jsxs)(l.Button,{variant:"outline",className:`relative flex h-auto flex-col items-center gap-1.5 px-3 py-3 text-center ${a?"border-[hsl(var(--primary))] bg-[hsl(var(--primary))/0.06]":""}`,disabled:null!==o,onClick:()=>p(e),children:[t||"cancel"===o&&a?(0,s.jsx)(x.Loader2,{className:"h-5 w-5 animate-spin text-primary"}):a?(0,s.jsx)(ek.Check,{className:"h-5 w-5 text-primary"}):(0,s.jsx)(i,{className:"h-5 w-5 text-muted-foreground"}),(0,s.jsx)("span",{className:"text-xs font-medium",children:r(e.labelKey)}),(0,s.jsx)("span",{className:"text-[10px] text-muted-foreground leading-tight",children:r(e.descriptionKey)}),a?(0,s.jsx)(eA.Lock,{className:"absolute right-1.5 top-1.5 h-3 w-3 text-primary"}):null]},e.key)})})}function eL({apiKey:e,onClose:a}){let{t}=(0,f.useI18n)(),i=!!e,{data:r}=function(e,s){let{context:a,ready:t}=(0,O.useRuntimeContext)();return(0,$.useQuery)({queryKey:F.queryKeys.apiKeyPolicies(a.dataScopeKey,e??""),queryFn:()=>T(e,s),enabled:t&&!!e&&!!s,staleTime:15e3})}(e?.serviceCredentialId,e?.userPrincipalName);async function n(e,s){try{await ee(e),m.toast.success(`${t("common.copied")} ${s}`)}catch{m.toast.error(t("common.copyFailed"))}}let c=e&&Number.isFinite(Date.parse(e.createTime))?Date.parse(e.createTime):null;return(0,s.jsx)(Y.Sheet,{open:i,onOpenChange:e=>!e&&a(),children:(0,s.jsxs)(Y.SheetContent,{side:"right",className:"w-full max-w-xl overflow-y-auto",children:[(0,s.jsxs)(Y.SheetHeader,{children:[(0,s.jsx)(Y.SheetTitle,{children:t("apiKeys.detail.title")}),(0,s.jsx)(Y.SheetDescription,{children:t("apiKeys.detail.description")})]}),e?(0,s.jsxs)("div",{className:"space-y-5 mt-2",children:[(0,s.jsxs)("section",{className:"space-y-2.5",children:[(0,s.jsx)("h3",{className:"text-sm font-semibold text-foreground",children:t("apiKeys.detail.basicInfo")}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(eF,{label:t("apiKeys.detail.credentialId"),children:(0,s.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,s.jsx)("code",{className:"break-all font-mono text-xs",children:e.serviceCredentialId}),(0,s.jsx)(l.Button,{variant:"ghost",size:"icon",className:"h-5 w-5 shrink-0",onClick:()=>n(e.serviceCredentialId,t("apiKeys.detail.credentialId")),children:(0,s.jsx)(Z.Copy,{className:"h-3 w-3"})})]})}),(0,s.jsx)(eF,{label:t("apiKeys.detail.credentialName"),children:(0,s.jsx)("span",{className:"text-sm",children:e.serviceCredentialName})}),(0,s.jsx)(eF,{label:t("apiKeys.detail.status"),children:(0,s.jsx)(N.Badge,{variant:"Active"===e.status?"success":"secondary",children:e.status})}),(0,s.jsx)(eF,{label:t("apiKeys.detail.ramUser"),children:(0,s.jsx)("span",{className:"break-all font-mono text-xs text-muted-foreground",children:e.userPrincipalName})}),(0,s.jsx)(eF,{label:t("apiKeys.detail.createdAt"),children:c?(0,s.jsx)(v.RelativeTime,{timestamp:c}):(0,s.jsx)("span",{className:"text-xs text-muted-foreground",children:"—"})})]})]}),(0,s.jsx)(J.Separator,{}),(0,s.jsxs)("section",{className:"space-y-2.5",children:[(0,s.jsx)("h3",{className:"text-sm font-semibold text-foreground",children:t("apiKeys.detail.permissionOverview")}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:t("apiKeys.detail.permissionOverviewDesc")}),(0,s.jsx)(eI,{serviceCredentialId:e.serviceCredentialId,userName:e.userPrincipalName})]}),(0,s.jsx)(J.Separator,{}),(0,s.jsxs)("section",{className:"space-y-4",children:[(0,s.jsx)("h3",{className:"text-sm font-semibold text-foreground",children:t("apiKeys.detail.permissionConfig")}),(0,s.jsx)(ei,{serviceCredentialId:e.serviceCredentialId,userName:e.userPrincipalName,policies:r}),(0,s.jsxs)("div",{className:"space-y-2.5",children:[(0,s.jsx)("h4",{className:"text-xs font-medium text-foreground",children:t("apiKeys.detail.defaultAuth")}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:t("apiKeys.detail.defaultAuthDesc")}),(0,s.jsx)(eR,{serviceCredentialId:e.serviceCredentialId,userName:e.userPrincipalName,policies:r})]}),(0,s.jsxs)("div",{className:"space-y-2.5",children:[(0,s.jsx)("h4",{className:"text-xs font-medium text-foreground",children:t("apiKeys.detail.customAuth")}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:t("apiKeys.detail.customAuthDesc")}),(0,s.jsx)(eC,{serviceCredentialId:e.serviceCredentialId,userName:e.userPrincipalName})]})]})]}):null]})})}function eF({label:e,children:a}){return(0,s.jsxs)("div",{className:"flex items-start gap-3",children:[(0,s.jsx)(G.Label,{className:"w-20 shrink-0 pt-0.5 text-xs text-muted-foreground",children:e}),(0,s.jsx)("div",{className:"min-w-0 flex-1",children:a})]})}let e$=(0,r.default)("funnel",[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]]),eO={read:"apiKeys.operations.read",write:"apiKeys.operations.write",manage:"apiKeys.operations.manage"};function eU({onFilterResults:e}){let{t}=(0,f.useI18n)(),[i,r]=(0,a.useState)(!1),[n,c]=(0,a.useState)("knowledgebase"),[o,d]=(0,a.useState)(""),[m,p]=(0,a.useState)("read"),{data:y}=(0,eo.useKnowledgeBases)(),{data:h}=(0,ed.useMemoryStores)(),j="knowledgebase"===n?(y?.items??[]).map(e=>e.knowledgeBaseName):(h?.items??[]).map(e=>e.memoryStoreName),g=!!o,{data:v,isFetching:b,refetch:K}=(0,$.useQuery)({queryKey:["api-keys-filter-by-permission",n,o,m],queryFn:()=>R({resourceType:n,resourceName:o,operationGroup:m}),enabled:!1});return i?(0,s.jsxs)("div",{className:"rounded-lg border border-[hsl(var(--border))] p-3 space-y-3",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsx)("span",{className:"text-xs font-medium text-muted-foreground",children:t("apiKeys.filter.title")}),(0,s.jsx)(l.Button,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:function(){r(!1),d(""),e(null)},children:(0,s.jsx)(eS.X,{className:"h-3.5 w-3.5"})})]}),(0,s.jsxs)("div",{className:"flex items-end gap-2 flex-wrap",children:[(0,s.jsxs)("div",{className:"space-y-1 min-w-[120px]",children:[(0,s.jsx)("label",{className:"text-[11px] text-muted-foreground",children:t("apiKeys.common.resourceType")}),(0,s.jsxs)(ec.Select,{value:n,onValueChange:s=>{c(s),d(""),e(null)},children:[(0,s.jsx)(ec.SelectTrigger,{className:"h-8 text-xs",children:(0,s.jsx)(ec.SelectValue,{})}),(0,s.jsxs)(ec.SelectContent,{children:[(0,s.jsx)(ec.SelectItem,{value:"knowledgebase",children:(0,s.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,s.jsx)(u.BookOpen,{className:"h-3 w-3"}),t("common.knowledgeBase")]})}),(0,s.jsx)(ec.SelectItem,{value:"memorystore",children:(0,s.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,s.jsx)(er.Brain,{className:"h-3 w-3"}),t("common.memory")]})})]})]})]}),(0,s.jsxs)("div",{className:"space-y-1 min-w-[160px] flex-1",children:[(0,s.jsx)("label",{className:"text-[11px] text-muted-foreground",children:t("apiKeys.common.resourceName")}),(0,s.jsxs)(ec.Select,{value:o,onValueChange:s=>{d(s),e(null)},children:[(0,s.jsx)(ec.SelectTrigger,{className:"h-8 text-xs",children:(0,s.jsx)(ec.SelectValue,{placeholder:t("apiKeys.filter.selectResource")})}),(0,s.jsx)(ec.SelectContent,{children:j.map(e=>(0,s.jsx)(ec.SelectItem,{value:e,children:e},e))})]})]}),(0,s.jsxs)("div",{className:"space-y-1 min-w-[100px]",children:[(0,s.jsx)("label",{className:"text-[11px] text-muted-foreground",children:t("apiKeys.common.operationPermission")}),(0,s.jsxs)(ec.Select,{value:m,onValueChange:s=>{p(s),e(null)},children:[(0,s.jsx)(ec.SelectTrigger,{className:"h-8 text-xs",children:(0,s.jsx)(ec.SelectValue,{})}),(0,s.jsx)(ec.SelectContent,{children:["read","write","manage"].map(e=>(0,s.jsx)(ec.SelectItem,{value:e,children:t(eO[e])},e))})]})]}),(0,s.jsxs)(l.Button,{size:"sm",className:"h-8",disabled:!g||b,onClick:function(){g&&K().then(s=>{s.data&&e(new Set(s.data.apiKeys.map(e=>e.serviceCredentialId)))})},children:[b?(0,s.jsx)(x.Loader2,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}):(0,s.jsx)(e$,{className:"mr-1.5 h-3.5 w-3.5"}),t("apiKeys.filter.filter")]}),v?(0,s.jsx)(l.Button,{variant:"ghost",size:"sm",className:"h-8 text-xs",onClick:function(){d(""),e(null)},children:t("common.clearSearch")}):null]}),v?(0,s.jsxs)("div",{className:"text-xs text-muted-foreground",children:[t("apiKeys.filter.resultPrefix")," ",(0,s.jsx)(N.Badge,{variant:"secondary",className:"px-1.5 py-0 text-xs",children:v.apiKeys.length})," ",t("apiKeys.filter.resultSuffix",{resource:"knowledgebase"===n?t("common.knowledgeBase"):t("common.memory"),name:o,operation:t(eO[m])})]}):null]}):(0,s.jsxs)(l.Button,{variant:"outline",size:"sm",onClick:()=>r(!0),children:[(0,s.jsx)(e$,{className:"mr-2 h-3.5 w-3.5"}),t("apiKeys.filter.byPermission")]})}let eE=(0,r.default)("download",[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]]);function eQ({apiKey:e,onClose:t}){let{t:i}=(0,f.useI18n)(),[r,c]=(0,a.useState)(!1);(0,a.useEffect)(()=>{e&&c(!1)},[e]);let o=!!e;async function d(e,s){try{await ee(e),m.toast.success(`${i("common.copied")} ${s}`)}catch{m.toast.error(i("common.copyFailed"))}}return(0,s.jsx)(V.Dialog,{open:o,onOpenChange:function(e){(e||r)&&(e||t())},children:(0,s.jsxs)(V.DialogContent,{className:"sm:max-w-lg",onEscapeKeyDown:e=>{r||e.preventDefault()},onPointerDownOutside:e=>{r||e.preventDefault()},children:[(0,s.jsxs)(V.DialogHeader,{children:[(0,s.jsx)(V.DialogTitle,{className:"text-xl",children:i("apiKeys.secret.title")}),(0,s.jsx)(V.DialogDescription,{children:i("apiKeys.secret.description")})]}),e?(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"space-y-1.5",children:[(0,s.jsx)(G.Label,{className:"text-xs text-muted-foreground",children:i("apiKeys.secret.credentialIdLabel")}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("code",{className:"flex-1 break-all rounded border border-[hsl(var(--border))] bg-muted/40 px-3 py-2 font-mono text-[13px]",children:e.serviceCredentialId}),(0,s.jsx)(l.Button,{variant:"outline",size:"icon",onClick:()=>d(e.serviceCredentialId,i("apiKeys.common.credentialId")),"aria-label":i("apiKeys.secret.copyCredentialId"),children:(0,s.jsx)(Z.Copy,{className:"h-4 w-4"})})]})]}),(0,s.jsxs)("div",{className:"space-y-1.5",children:[(0,s.jsx)(G.Label,{className:"text-xs text-muted-foreground",children:i("apiKeys.secret.secretLabel")}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("code",{className:"flex-1 break-all rounded border border-[hsl(var(--warning))/0.5] bg-[hsl(var(--warning))/0.06] px-3 py-2 font-mono text-[13px]",children:e.serviceCredentialSecret}),(0,s.jsx)(l.Button,{variant:"outline",size:"icon",onClick:()=>d(e.serviceCredentialSecret,"Secret"),"aria-label":i("apiKeys.secret.copySecret"),children:(0,s.jsx)(Z.Copy,{className:"h-4 w-4"})})]})]}),(0,s.jsxs)(l.Button,{variant:"outline",className:"w-full",onClick:function(){if(!e)return;let s=e.serviceCredentialId.slice(-6),a=new Date().toISOString().replace(/[:.]/g,"-"),t=new Blob([`ServiceCredentialId: ${e.serviceCredentialId}
|
|
2
2
|
ServiceCredentialSecret: ${e.serviceCredentialSecret}
|
|
3
3
|
ServiceCredentialName: ${e.serviceCredentialName}
|
|
4
4
|
ServiceName: ${e.serviceName}
|
|
@@ -6,4 +6,4 @@ CreateTime: ${e.createTime}
|
|
|
6
6
|
UserPrincipalName: ${e.userPrincipalName}
|
|
7
7
|
|
|
8
8
|
WARNING: This secret cannot be retrieved again. Store it safely.
|
|
9
|
-
`],{type:"text/plain;charset=utf-8"}),i=URL.createObjectURL(t),r=document.createElement("a");r.href=i,r.download=`tablestore-api-key-${s}-${a}.txt`,document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(i)},children:[(0,s.jsx)(eE,{className:"mr-2 h-4 w-4"}),i("apiKeys.secret.download")]}),(0,s.jsxs)("div",{className:"flex items-start gap-2 rounded-md border border-[hsl(var(--destructive))/0.4] bg-[hsl(var(--destructive))/0.05] px-3 py-2.5",children:[(0,s.jsx)(n,{className:"mt-0.5 h-4 w-4 shrink-0 text-destructive"}),(0,s.jsxs)(G.Label,{className:"flex items-start gap-2 text-xs leading-relaxed text-foreground",children:[(0,s.jsx)(_.Checkbox,{checked:r,onCheckedChange:e=>c(!!e),className:"mt-0.5"}),(0,s.jsx)("span",{children:i("apiKeys.secret.confirmSaved")})]})]})]}):null,(0,s.jsx)(V.DialogFooter,{children:(0,s.jsx)(l.Button,{variant:"default",disabled:!r,onClick:()=>t(),children:i("common.done")})})]})})}function eH({message:e}){let{t:a}=(0,f.useI18n)();return(0,s.jsx)("div",{className:"rounded-lg border border-[hsl(var(--destructive))/0.5] bg-[hsl(var(--destructive))/0.05] p-6",children:(0,s.jsxs)("div",{className:"flex items-start gap-3",children:[(0,s.jsx)(n,{className:"mt-0.5 h-5 w-5 shrink-0 text-destructive"}),(0,s.jsxs)("div",{className:"space-y-2 text-sm leading-relaxed",children:[(0,s.jsx)("p",{className:"font-semibold text-foreground",children:a("apiKeys.page.forbiddenTitle")}),(0,s.jsx)("p",{className:"text-muted-foreground",children:a("apiKeys.page.forbiddenIntro")}),(0,s.jsxs)("ul",{className:"list-disc space-y-1 pl-5 text-muted-foreground",children:[(0,s.jsx)("li",{children:a("apiKeys.page.forbiddenSwitchAccount")}),(0,s.jsxs)("li",{children:[a("apiKeys.page.forbiddenAttachPrefix"),(0,s.jsx)("code",{className:"rounded bg-muted px-1.5 py-0.5 font-mono text-xs",children:"AliyunRAMReadOnlyAccess"}),a("apiKeys.page.forbiddenAttachMiddle"),(0,s.jsx)("code",{className:"rounded bg-muted px-1.5 py-0.5 font-mono text-xs",children:"AliyunRAMFullAccess"}),a("apiKeys.page.forbiddenAttachSuffix")]})]}),e?(0,s.jsx)("p",{className:"break-all rounded bg-muted/50 px-3 py-2 font-mono text-xs text-muted-foreground",children:e}):null]})]})})}e.s(["default",0,function(){let{t:e}=(0,f.useI18n)(),{data:r,isLoading:m,isError:u,error:p,refetch:x}=function(){let{context:e,ready:s}=(0
|
|
9
|
+
`],{type:"text/plain;charset=utf-8"}),i=URL.createObjectURL(t),r=document.createElement("a");r.href=i,r.download=`tablestore-api-key-${s}-${a}.txt`,document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(i)},children:[(0,s.jsx)(eE,{className:"mr-2 h-4 w-4"}),i("apiKeys.secret.download")]}),(0,s.jsxs)("div",{className:"flex items-start gap-2 rounded-md border border-[hsl(var(--destructive))/0.4] bg-[hsl(var(--destructive))/0.05] px-3 py-2.5",children:[(0,s.jsx)(n,{className:"mt-0.5 h-4 w-4 shrink-0 text-destructive"}),(0,s.jsxs)(G.Label,{className:"flex items-start gap-2 text-xs leading-relaxed text-foreground",children:[(0,s.jsx)(_.Checkbox,{checked:r,onCheckedChange:e=>c(!!e),className:"mt-0.5"}),(0,s.jsx)("span",{children:i("apiKeys.secret.confirmSaved")})]})]})]}):null,(0,s.jsx)(V.DialogFooter,{children:(0,s.jsx)(l.Button,{variant:"default",disabled:!r,onClick:()=>t(),children:i("common.done")})})]})})}function eH({message:e}){let{t:a}=(0,f.useI18n)();return(0,s.jsx)("div",{className:"rounded-lg border border-[hsl(var(--destructive))/0.5] bg-[hsl(var(--destructive))/0.05] p-6",children:(0,s.jsxs)("div",{className:"flex items-start gap-3",children:[(0,s.jsx)(n,{className:"mt-0.5 h-5 w-5 shrink-0 text-destructive"}),(0,s.jsxs)("div",{className:"space-y-2 text-sm leading-relaxed",children:[(0,s.jsx)("p",{className:"font-semibold text-foreground",children:a("apiKeys.page.forbiddenTitle")}),(0,s.jsx)("p",{className:"text-muted-foreground",children:a("apiKeys.page.forbiddenIntro")}),(0,s.jsxs)("ul",{className:"list-disc space-y-1 pl-5 text-muted-foreground",children:[(0,s.jsx)("li",{children:a("apiKeys.page.forbiddenSwitchAccount")}),(0,s.jsxs)("li",{children:[a("apiKeys.page.forbiddenAttachPrefix"),(0,s.jsx)("code",{className:"rounded bg-muted px-1.5 py-0.5 font-mono text-xs",children:"AliyunRAMReadOnlyAccess"}),a("apiKeys.page.forbiddenAttachMiddle"),(0,s.jsx)("code",{className:"rounded bg-muted px-1.5 py-0.5 font-mono text-xs",children:"AliyunRAMFullAccess"}),a("apiKeys.page.forbiddenAttachSuffix")]})]}),e?(0,s.jsx)("p",{className:"break-all rounded bg-muted/50 px-3 py-2 font-mono text-xs text-muted-foreground",children:e}):null]})]})})}e.s(["default",0,function(){let{t:e}=(0,f.useI18n)(),{data:r,isLoading:m,isError:u,error:p,refetch:x}=function(){let{context:e,ready:s}=(0,O.useRuntimeContext)();return(0,$.useQuery)({queryKey:F.queryKeys.apiKeys(e.dataScopeKey),queryFn:w,enabled:s,staleTime:3e4})}(),[y,h]=(0,a.useState)(!1),[j,g]=(0,a.useState)(null),[N,v]=(0,a.useState)(null),[b,K]=(0,a.useState)(null),[k,S]=(0,a.useState)(null),I=r??[],T=null!==k?I.filter(e=>k.has(e.serviceCredentialId)):I,D=u&&p instanceof C.ApiClientError&&"FORBIDDEN"===p.code;return(0,s.jsxs)("div",{className:"space-y-6",children:[(0,s.jsx)(d.PageHeader,{title:e("apiKeys.page.title"),description:e("apiKeys.page.description"),children:(0,s.jsxs)(l.Button,{onClick:()=>h(!0),disabled:u&&!D,children:[(0,s.jsx)(i.Plus,{className:"mr-2 h-4 w-4"}),e("apiKeys.page.create")]})}),m?(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(c.Skeleton,{className:"h-10 w-full"}),(0,s.jsx)(c.Skeleton,{className:"h-12 w-full"}),(0,s.jsx)(c.Skeleton,{className:"h-12 w-full"}),(0,s.jsx)(c.Skeleton,{className:"h-12 w-full"})]}):D?(0,s.jsx)(eH,{message:p instanceof Error?p.message:""}):u?(0,s.jsx)(o.EmptyState,{icon:n,title:e("apiKeys.page.loadFailed"),description:p instanceof Error?p.message:e("common.unknownError"),action:(0,s.jsx)(l.Button,{variant:"outline",onClick:()=>x(),children:e("common.retry")})}):0===I.length?(0,s.jsx)(o.EmptyState,{icon:t.KeyRound,title:e("apiKeys.page.emptyTitle"),description:e("apiKeys.page.emptyDescription"),action:(0,s.jsxs)(l.Button,{onClick:()=>h(!0),children:[(0,s.jsx)(i.Plus,{className:"mr-2 h-4 w-4"}),e("apiKeys.page.create")]})}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(eU,{onFilterResults:S}),(0,s.jsx)(E,{apiKeys:T,onDelete:e=>g(e),onDetail:e=>v(e)})]}),(0,s.jsx)(W,{open:y,onOpenChange:h,onCreated:e=>K(e)}),(0,s.jsx)(eQ,{apiKey:b,onClose:()=>K(null)}),(0,s.jsx)(eL,{apiKey:N,onClose:()=>v(null)}),(0,s.jsx)(X,{apiKey:j,open:!!j,onOpenChange:e=>{e||g(null)}})]})}],338309)}]);
|