bailinghub 0.9.4 → 0.10.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/README.en.md +6 -6
- package/README.md +6 -6
- package/THIRD_PARTY_NOTICES.md +1 -1
- package/docker-compose.images.yml +2 -2
- package/docs/AGENT_CLIENT_QUICKSTART.en.md +1 -3
- package/docs/AGENT_CLIENT_QUICKSTART.md +1 -1
- package/docs/AGENT_CLIENT_RUNTIME_API.en.md +87 -2
- package/docs/AGENT_CLIENT_RUNTIME_API.md +36 -2
- package/docs/AGENT_KNOWLEDGE_API.en.md +77 -0
- package/docs/AGENT_KNOWLEDGE_API.md +86 -0
- package/docs/AGENT_TASK_CONTROL.md +4 -4
- package/docs/AGENT_TASK_CONTROL_FOUNDATION.md +1 -1
- package/docs/ARCHITECTURE.md +4 -0
- package/docs/CHANGELOG.en.md +12 -0
- package/docs/CHANGELOG.md +12 -0
- package/docs/COMPATIBILITY.en.md +27 -1
- package/docs/CONTRACT.en.md +1 -1
- package/docs/CONTRACT.md +1 -1
- package/docs/IMPLEMENTATION_STATUS.en.md +19 -15
- package/docs/IMPLEMENTATION_STATUS.md +19 -15
- package/docs/INDEPENDENT_VALIDATION.en.md +6 -4
- package/docs/INDEPENDENT_VALIDATION.md +6 -4
- package/docs/INTEGRATION_WALKTHROUGH.md +65 -0
- package/docs/MODEL_BILLING.en.md +2 -0
- package/docs/MODEL_BILLING.md +6 -2
- package/docs/MODEL_CONTINUATION.en.md +54 -0
- package/docs/MODEL_CONTINUATION.md +54 -0
- package/docs/MODEL_OUTPUT_BUDGET.en.md +69 -0
- package/docs/MODEL_OUTPUT_BUDGET.md +69 -0
- package/docs/OPERATIONS.en.md +16 -4
- package/docs/OPERATIONS.md +16 -4
- package/docs/QUICKSTART.md +1 -1
- package/docs/README.en.md +5 -0
- package/docs/README.md +5 -0
- package/docs/RELEASE_NOTES_NEXT.en.md +3 -3
- package/docs/RELEASE_NOTES_NEXT.md +3 -3
- package/docs/RELEASE_NOTES_v0.10.0.en.md +58 -0
- package/docs/RELEASE_NOTES_v0.10.0.md +58 -0
- package/docs/UPGRADE_PLAN.en.md +118 -0
- package/docs/UPGRADE_PLAN.md +124 -0
- package/docs/UPGRADE_v0.10.0.en.md +47 -0
- package/docs/UPGRADE_v0.10.0.md +47 -0
- package/docs//345/205/274/345/256/271/346/200/247/344/270/216/345/215/207/347/272/247.md +38 -22
- package/package.json +8 -5
- package/schemas/tool-definition.schema.json +13 -0
- package/scripts/check-doc-links.mjs +4 -0
- package/scripts/check-image-tags.sh +1 -1
- package/scripts/check-release-consistency.test.mjs +2 -2
- package/scripts/doctor-upgrade-plan.test.ts +205 -0
- package/scripts/doctor-upgrade-plan.ts +276 -0
- package/scripts/doctor.ts +4 -1
- package/scripts/e2e-console-approval-details.mjs +134 -0
- package/scripts/e2e-console-config-races.mjs +180 -0
- package/scripts/e2e-console-kb-audit.mjs +170 -0
- package/scripts/e2e-console-operations-audit.mjs +152 -0
- package/scripts/e2e-console-runtime-audit.mjs +179 -0
- package/scripts/e2e-console-settings-audit.mjs +125 -0
- package/scripts/e2e-console-troubleshooting-extra.mjs +267 -0
- package/scripts/e2e-console.mjs +476 -7
- package/scripts/install.sh +1 -1
- package/scripts/publish-images.sh +1 -1
- package/scripts/release-audit.mjs +4 -0
- package/scripts/verify-github-repo.mjs +4 -0
- package/src/app/agent-client-runtime.test.ts +115 -2
- package/src/app/agent-client-runtime.ts +40 -11
- package/src/app/agent-knowledge.test.ts +171 -0
- package/src/app/agent-knowledge.ts +233 -0
- package/src/app/agent-tool-catalog-revision.test.ts +31 -0
- package/src/app/agent-tool-invocations.test.ts +7 -2
- package/src/app/agent-tool-invocations.ts +67 -7
- package/src/app/approval-continuations.test.ts +49 -1
- package/src/app/http.test.ts +16 -1
- package/src/app/http.ts +3 -3
- package/src/app/kernel-boot-recovery.mysql.test.ts +132 -0
- package/src/app/kernel-boot-recovery.test.ts +157 -0
- package/src/app/kernel.ts +12 -8
- package/src/app/readiness.mysql.test.ts +120 -0
- package/src/app/readiness.test.ts +111 -26
- package/src/app/readiness.ts +26 -22
- package/src/app/runtime-lifecycle.ts +34 -3
- package/src/app/tool-approvals.test.ts +83 -0
- package/src/app/tool-approvals.ts +25 -7
- package/src/app/tool-proxy-payload.test.ts +81 -0
- package/src/app/tool-proxy.ts +24 -2
- package/src/core/config/console-diagnostic-location.test.ts +36 -0
- package/src/core/config/console-form-guard.test.ts +69 -0
- package/src/core/config/console-task-location.test.ts +64 -0
- package/src/core/contracts/openapi-tools.ts +16 -5
- package/src/core/contracts/schema-readiness.ts +11 -0
- package/src/core/contracts/tool-definition.ts +26 -0
- package/src/core/contracts/tool-guidance.test.ts +77 -0
- package/src/core/contracts/tool-guidance.ts +31 -0
- package/src/core/contracts/tool-input-limits.ts +15 -0
- package/src/core/contracts/tools-idempotency.test.ts +90 -0
- package/src/core/contracts/tools.ts +52 -9
- package/src/core/runtime/agent-execution-memory.test.ts +64 -0
- package/src/core/runtime/agent-execution-memory.ts +63 -0
- package/src/core/state/state-contracts.ts +3 -0
- package/src/infrastructure/config/config-observability-ledger.ts +2 -0
- package/src/infrastructure/schema/schema-readiness.ts +29 -0
- package/src/infrastructure/state/state-mysql.ts +3 -0
- package/src/modules/usage/contracts.ts +7 -0
- package/src/modules/usage/http.ts +2 -0
- package/src/modules/usage/model-continuation.test.ts +109 -0
- package/src/modules/usage/model-gateway.ts +5 -1
- package/src/modules/usage/output-budget.mysql.test.ts +84 -0
- package/src/modules/usage/output-budget.test.ts +167 -0
- package/src/modules/usage/output-budget.ts +73 -0
- package/src/modules/usage/provider-stream.test.ts +22 -0
- package/src/modules/usage/provider.ts +2 -3
- package/src/modules/usage/repository.ts +6 -0
- package/src/modules/usage/test-harness.ts +4 -2
- package/src/routes/admin-approval-view.test.ts +109 -0
- package/src/routes/admin-approval-view.ts +36 -0
- package/src/routes/admin-readiness.test.ts +52 -0
- package/src/routes/admin-runtime-ux.test.ts +51 -0
- package/src/routes/admin-runtime-ux.ts +25 -0
- package/src/routes/admin-runtime.ts +36 -8
- package/src/routes/admin.ts +9 -0
- package/src/routes/agent-api.test.ts +80 -1
- package/src/routes/agent-api.ts +63 -4
- package/src/routes/agent-tool-detail.test.ts +140 -0
- package/src/routes/public-default.ts +1 -1
- package/src/services/kb-agent.test.ts +84 -0
- package/src/services/kb.ts +73 -0
- package/web/console/assets/Accounts-CjIBO3sU.css +1 -0
- package/web/console/assets/Accounts-Dhyw-7wF.js +3 -0
- package/web/console/assets/AgentClients-BA0M26-I.css +1 -0
- package/web/console/assets/AgentClients-DWxb8-ko.js +1 -0
- package/web/console/assets/AgentTasks-DOyxANnx.css +1 -0
- package/web/console/assets/AgentTasks-DUHD4dzr.js +2 -0
- package/web/console/assets/Approvals-Brl-2uJq.css +1 -0
- package/web/console/assets/Approvals-CQx1YWxW.js +1 -0
- package/web/console/assets/Audit--QcdVlMh.js +1 -0
- package/web/console/assets/Audit-DAdmOnIs.css +1 -0
- package/web/console/assets/{BrandLockup-CffORQse.js → BrandLockup-DQcaW4Nt.js} +1 -1
- package/web/console/assets/Channels-DJJU3ksE.css +1 -0
- package/web/console/assets/Channels-cGS5WfQ-.js +105 -0
- package/web/console/assets/ChatEntries-BYpji27B.css +1 -0
- package/web/console/assets/ChatEntries-nh23Iz5O.js +7 -0
- package/web/console/assets/Clients-CX5EeYio.js +3 -0
- package/web/console/assets/Clients-CbZAou8E.css +1 -0
- package/web/console/assets/Cost-C6oQvz9P.css +1 -0
- package/web/console/assets/Cost-DOZfdNS9.js +1 -0
- package/web/console/assets/Credentials--aHs57yV.css +1 -0
- package/web/console/assets/Credentials-sy6W9Sac.js +1 -0
- package/web/console/assets/Diagnostics-CKs27Dnv.css +1 -0
- package/web/console/assets/Diagnostics-CyoM1XrZ.js +1 -0
- package/web/console/assets/Executors-2Upi6bOS.css +1 -0
- package/web/console/assets/Executors-BQqqiFwt.js +1 -0
- package/web/console/assets/HelpTip-DLlhaGQp.js +1 -0
- package/web/console/assets/HelpTip-bbDEyuqV.css +1 -0
- package/web/console/assets/Kb-5R3ce4UU.js +5 -0
- package/web/console/assets/Kb-BM_PYi11.css +1 -0
- package/web/console/assets/{Login-CGgLGTE1.js → Login-YKeUwdgo.js} +1 -1
- package/web/console/assets/Projects-DHwHrPT9.css +1 -0
- package/web/console/assets/Projects-Grgb6fOv.js +1 -0
- package/web/console/assets/Routes-DR_Yf02e.css +1 -0
- package/web/console/assets/Routes-DYgrXlRJ.js +138 -0
- package/web/console/assets/Runs-CwTddJJj.js +3 -0
- package/web/console/assets/Runs-D4FOvNfu.css +1 -0
- package/web/console/assets/Setup-Ca0b1d1-.css +1 -0
- package/web/console/assets/Setup-D_xUPNDq.js +1 -0
- package/web/console/assets/Shell-BTg8Vw_L.css +1 -0
- package/web/console/assets/Shell-Dfam2Uoj.js +1 -0
- package/web/console/assets/StorageBuckets-7QLBpV4a.css +1 -0
- package/web/console/assets/StorageBuckets-CP6e50wI.js +1 -0
- package/web/console/assets/SystemSettings-BRYKyJNa.js +1 -0
- package/web/console/assets/SystemSettings-HsXGx0aH.css +1 -0
- package/web/console/assets/SystemStatus-B-VfRsQd.css +1 -0
- package/web/console/assets/SystemStatus-CbPsDsGt.js +1 -0
- package/web/console/assets/Targets-1j4-g6rC.css +1 -0
- package/web/console/assets/Targets-C2LkR2AF.js +1 -0
- package/web/console/assets/Tools-C9HPJqJb.css +1 -0
- package/web/console/assets/Tools-C9JNJUS0.js +2 -0
- package/web/console/assets/Usage-D1Mv6vGY.js +1 -0
- package/web/console/assets/Usage-DMOzUsqh.css +1 -0
- package/web/console/assets/UsageAccess-77LmGCm6.js +1 -0
- package/web/console/assets/UsageAccess-C6ZGxEgJ.css +1 -0
- package/web/console/assets/{UsageHelp-CzS2gI40.js → UsageHelp-BmuiE1Ew.js} +1 -1
- package/web/console/assets/client-route-draft-DxZRxKPT.js +1 -0
- package/web/console/assets/console-location-Csv-xsnl.js +1 -0
- package/web/console/assets/form-guard-8GrFpry0.js +1 -0
- package/web/console/assets/{index-65JiiUr4.js → index-B_5UfiTw.js} +1 -1
- package/web/console/assets/index-MjZJEFIN.js +2 -0
- package/web/console/assets/{request-DKycpD7z.js → request-rqm6MT0s.js} +1 -1
- package/web/console/assets/runtime-feedback-gPfZVNvY.js +1 -0
- package/web/console/assets/{schema-SCiNxBlR.js → schema-o3mK4mid.js} +1 -1
- package/web/console/assets/task-page-location-DWiGtAln.js +1 -0
- package/web/console/assets/use-list-location-FvLFt0Tq.css +1 -0
- package/web/console/assets/use-list-location-cIPy2cKM.js +1 -0
- package/web/console/assets/use-unsaved-form-DScKD0h9.js +1 -0
- package/web/console/assets/{util-DZYfJ5Zo.js → util-B40VqOwl.js} +1 -1
- package/web/console/assets/{vendor-element-8cVcdt5T.js → vendor-element-BT8tHCFk.js} +1 -1
- package/web/console/assets/{vendor-mammoth-CnDA23N0.js → vendor-mammoth-CVIXVxTN.js} +1 -1
- package/web/console/assets/{vendor-vue-Co7x2FW6.js → vendor-vue-DhbG0vd4.js} +7 -7
- package/web/console/index.html +3 -3
- package/web-admin/package-lock.json +4 -4
- package/web-admin/package.json +1 -1
- package/web-admin/src/client-route-draft.ts +25 -0
- package/web-admin/src/components/AgentSetupPanel.vue +54 -41
- package/web-admin/src/components/HelpTip.vue +4 -1
- package/web-admin/src/components/ListLocationBar.vue +22 -0
- package/web-admin/src/components/NotificationOutboxPanel.vue +35 -7
- package/web-admin/src/console-entry.test.ts +26 -0
- package/web-admin/src/console-entry.ts +20 -0
- package/web-admin/src/console-location.ts +35 -0
- package/web-admin/src/form-guard.ts +35 -0
- package/web-admin/src/layout/Shell.vue +18 -65
- package/web-admin/src/onboarding-state.test.ts +174 -0
- package/web-admin/src/onboarding-state.ts +122 -0
- package/web-admin/src/pages/Accounts.vue +44 -24
- package/web-admin/src/pages/AgentClients.vue +47 -29
- package/web-admin/src/pages/AgentTasks.vue +57 -12
- package/web-admin/src/pages/Approvals.vue +105 -25
- package/web-admin/src/pages/Audit.vue +15 -6
- package/web-admin/src/pages/Channels.vue +136 -43
- package/web-admin/src/pages/ChatEntries.vue +96 -41
- package/web-admin/src/pages/Clients.vue +87 -26
- package/web-admin/src/pages/Cost.vue +15 -4
- package/web-admin/src/pages/Credentials.vue +63 -32
- package/web-admin/src/pages/Diagnostics.vue +103 -54
- package/web-admin/src/pages/Executors.vue +103 -40
- package/web-admin/src/pages/Kb.vue +278 -128
- package/web-admin/src/pages/Projects.vue +44 -16
- package/web-admin/src/pages/Routes.vue +168 -247
- package/web-admin/src/pages/Runs.vue +163 -91
- package/web-admin/src/pages/Setup.vue +182 -291
- package/web-admin/src/pages/StorageBuckets.vue +61 -25
- package/web-admin/src/pages/SystemSettings.vue +76 -51
- package/web-admin/src/pages/SystemStatus.vue +54 -30
- package/web-admin/src/pages/Targets.vue +45 -17
- package/web-admin/src/pages/Tools.vue +133 -68
- package/web-admin/src/pages/Usage.vue +64 -25
- package/web-admin/src/pages/UsageAccess.vue +11 -8
- package/web-admin/src/route-call-snippets.test.ts +82 -0
- package/web-admin/src/route-call-snippets.ts +178 -0
- package/web-admin/src/router.ts +11 -29
- package/web-admin/src/runtime-feedback.ts +43 -0
- package/web-admin/src/task-page-location.ts +66 -0
- package/web-admin/src/usage-output-budget.test.ts +26 -0
- package/web-admin/src/usage-output-budget.ts +46 -0
- package/web-admin/src/use-list-location.ts +24 -0
- package/web-admin/src/use-unsaved-form.ts +38 -0
- package/web-admin/tests/model-output-budget.browser.mjs +69 -0
- package/web/console/assets/Accounts-Bervi5JU.css +0 -1
- package/web/console/assets/Accounts-Dhj6PjXP.js +0 -3
- package/web/console/assets/AgentClients-CMy8StAH.js +0 -1
- package/web/console/assets/AgentClients-i52AI6YV.css +0 -1
- package/web/console/assets/AgentTasks-BsG850Il.css +0 -1
- package/web/console/assets/AgentTasks-DA1xZdmP.js +0 -2
- package/web/console/assets/Approvals-DIsd7R8N.js +0 -1
- package/web/console/assets/Approvals-DlTSHl_7.css +0 -1
- package/web/console/assets/Audit-AUDABLTX.js +0 -1
- package/web/console/assets/Audit-CSu6_3oD.css +0 -1
- package/web/console/assets/Channels-B8rjsM0S.js +0 -105
- package/web/console/assets/Channels-CCn0L1jg.css +0 -1
- package/web/console/assets/ChatEntries-DsYtcXN6.css +0 -1
- package/web/console/assets/ChatEntries-iZjJMEUZ.js +0 -7
- package/web/console/assets/Clients-CSHIsaWU.css +0 -1
- package/web/console/assets/Clients-CwgpGCSD.js +0 -3
- package/web/console/assets/Cost-B2tNxu71.js +0 -1
- package/web/console/assets/Cost-CjT39DSZ.css +0 -1
- package/web/console/assets/Credentials-BuwFB-fV.js +0 -1
- package/web/console/assets/Credentials-ioLP0qYN.css +0 -1
- package/web/console/assets/Diagnostics-Ya05PTDp.css +0 -1
- package/web/console/assets/Diagnostics-z5glms11.js +0 -1
- package/web/console/assets/Executors-Bc4SvjeH.js +0 -1
- package/web/console/assets/Executors-CjhEM54c.css +0 -1
- package/web/console/assets/HelpTip-CA6Bm7Nx.css +0 -1
- package/web/console/assets/HelpTip-Dtdt2tKR.js +0 -1
- package/web/console/assets/Kb-BRbRHxLy.js +0 -5
- package/web/console/assets/Kb-CzIzd9xr.css +0 -1
- package/web/console/assets/Projects-Bm8AjsNx.css +0 -1
- package/web/console/assets/Projects-CPWw3con.js +0 -1
- package/web/console/assets/Routes-CMIaE0Bx.js +0 -124
- package/web/console/assets/Routes-CyXV4Pba.css +0 -1
- package/web/console/assets/Runs-B8HuE700.js +0 -3
- package/web/console/assets/Runs-Bv6CV_Hk.css +0 -1
- package/web/console/assets/Setup-D7nxgn-9.css +0 -1
- package/web/console/assets/Setup-G8RKzliR.js +0 -1
- package/web/console/assets/Shell-DimHgraJ.js +0 -1
- package/web/console/assets/Shell-ykb-tUfo.css +0 -1
- package/web/console/assets/StorageBuckets-CVgpZRWY.css +0 -1
- package/web/console/assets/StorageBuckets-CiVYXIE2.js +0 -1
- package/web/console/assets/SystemSettings-BjiHyrXO.css +0 -1
- package/web/console/assets/SystemSettings-DF8sZNen.js +0 -1
- package/web/console/assets/SystemStatus-BlHywK13.js +0 -1
- package/web/console/assets/SystemStatus-I11I67rw.css +0 -1
- package/web/console/assets/Targets-BXaoPoAJ.js +0 -1
- package/web/console/assets/Targets-DTb5tn6z.css +0 -1
- package/web/console/assets/Tools-B22lNHXq.js +0 -2
- package/web/console/assets/Tools-DU8ei6sd.css +0 -1
- package/web/console/assets/Usage-C02EzoI2.js +0 -1
- package/web/console/assets/Usage-CAeDGjrb.css +0 -1
- package/web/console/assets/UsageAccess-CGGaWTuj.css +0 -1
- package/web/console/assets/UsageAccess-DOb-cyPE.js +0 -1
- package/web/console/assets/index-CK0ZCTZv.js +0 -2
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
<p>「<b>调度流</b>」按时间倒序审计<b>每一次派发</b>,点行看任务全详情(输入 / 组装上下文 / 工具 / 回复)。</p>
|
|
8
8
|
<p>「<b>追溯</b>」按 job_id、request_id、client_id、thread_id 或 principal_id 查单次任务完整生命周期,用于接入排障和审批/送达/工具调用对账。</p>
|
|
9
9
|
</HelpTip></span>
|
|
10
|
-
<el-button :loading="loading || threadsLoading" @click="refresh">刷新</el-button>
|
|
10
|
+
<div><el-button v-if="returnPath" @click="router.push(returnPath)">返回来源页面</el-button><el-button :loading="loading || threadsLoading" @click="refresh">刷新</el-button></div>
|
|
11
11
|
</div>
|
|
12
12
|
</template>
|
|
13
13
|
|
|
@@ -22,16 +22,17 @@
|
|
|
22
22
|
</el-radio-group>
|
|
23
23
|
<span class="muted">{{ conversationView === 'audit' ? '按客户端会话汇总正文;授权执行保持独立可追溯。' : '保留单授权、历史会话与业务接入记录;执行摘要不等于客户端完整答复。' }}</span>
|
|
24
24
|
</div>
|
|
25
|
-
<ClientConversations v-show="conversationView === 'audit'" ref="clientConversations" :selected-id="auditConversationId" :focus-turn="auditTurnId"
|
|
25
|
+
<ClientConversations v-show="conversationView === 'audit'" :key="auditConversationId ? 'selected' : 'unselected'" ref="clientConversations" :selected-id="auditConversationId" :focus-turn="auditTurnId"
|
|
26
26
|
@select="selectAuditConversation" @open-thread="gotoThread" @open-job="openDetail({ job_id: $event })" />
|
|
27
27
|
<div v-show="conversationView === 'legacy'" class="convo">
|
|
28
28
|
<!-- 左:会话列表 -->
|
|
29
29
|
<div class="rail">
|
|
30
|
-
<el-
|
|
30
|
+
<el-alert v-if="threadsError" :title="threadsError" type="error" :closable="false" show-icon />
|
|
31
|
+
<el-input v-model="threadQ" size="default" placeholder="搜会话:身份 / 接入方 / 内容 / 路由" clearable class="railsearch" @input="persistThreadSearch">
|
|
31
32
|
<template #prefix><el-icon><Search /></el-icon></template>
|
|
32
33
|
</el-input>
|
|
33
34
|
<div v-loading="threadsLoading" class="raillist">
|
|
34
|
-
<el-empty v-if="!threadsLoading && !filteredThreads.length" :image-size="56"
|
|
35
|
+
<el-empty v-if="!threadsLoading && !threadsError && !filteredThreads.length" :image-size="56"
|
|
35
36
|
:description="threadQ ? '没有匹配的会话' : '还没有会话:业务/聊天接入后这里会出现'" />
|
|
36
37
|
<div v-for="t in filteredThreads" :key="t.thread_id" class="threaditem"
|
|
37
38
|
:class="{ active: curThread === t.thread_id }" @click="openThread(t.thread_id)">
|
|
@@ -49,7 +50,8 @@
|
|
|
49
50
|
|
|
50
51
|
<!-- 右:完整对话(聊天记录)+ 逐轮执行轨迹 -->
|
|
51
52
|
<div ref="paneRef" class="pane" v-loading="threadDataLoading">
|
|
52
|
-
<el-
|
|
53
|
+
<el-alert v-if="threadDataError" :title="threadDataError" type="error" :closable="false" show-icon />
|
|
54
|
+
<el-empty v-if="!threadData && !threadDataLoading && !threadDataError" :image-size="90" description="选择左侧记录,查看该授权或业务入口保存的消息与轨迹" />
|
|
53
55
|
<template v-if="threadData">
|
|
54
56
|
<div class="paneHead">
|
|
55
57
|
<div class="ph1">
|
|
@@ -138,14 +140,24 @@
|
|
|
138
140
|
<!-- ============ 调度流:原有平铺列表,按时间审计每一次派发 ============ -->
|
|
139
141
|
<el-tab-pane name="runs">
|
|
140
142
|
<template #label><span><el-icon style="vertical-align:-2px"><List /></el-icon> 调度流</span></template>
|
|
141
|
-
<
|
|
142
|
-
|
|
143
|
+
<div class="run-filters">
|
|
144
|
+
<el-select v-model="runFilters.status" aria-label="任务状态筛选" style="width:170px" @change="persistRunFilters"><el-option value="" label="全部状态" /><el-option v-for="status in RUN_FILTER_STATUSES" :key="status" :value="status" :label="`${runStatusLabels[status]} · ${status}`" /></el-select>
|
|
145
|
+
<el-select v-model="runFilters.route" aria-label="任务路由筛选" style="width:240px" filterable allow-create clearable placeholder="全部路由(输入精确标识)" @change="persistRunFilters"><el-option v-for="key in runRouteOptions" :key="key" :value="key" :label="key" /></el-select>
|
|
146
|
+
<el-select v-model="runFilters.period" aria-label="任务时间筛选" style="width:150px" @change="persistRunFilters"><el-option value="all" label="全部时间" /><el-option value="24h" label="最近 24 小时" /><el-option value="7d" label="最近 7 天" /></el-select>
|
|
147
|
+
<el-button v-if="hasRunFilters" @click="clearRunFilters">清除筛选</el-button>
|
|
148
|
+
</div>
|
|
149
|
+
<el-alert type="info" :closable="false" show-icon :title="`筛选已加载 ${list.length} 条,当前匹配 ${filteredRuns.length} 条${runsMore ? ',可加载更多' : ''}。这是当前已加载记录的筛选,不是全库查询。`" />
|
|
150
|
+
<el-alert v-if="runFilters.route && list.length && !list.some(row => runRouteKey(row))" type="warning" :closable="false" title="已加载记录未提供路由标识,无法据此确认该路由是否有任务。可清除路由筛选或继续加载核对。" />
|
|
151
|
+
<el-alert v-if="runsError" :title="runsError" :description="list.length ? `正在展示旧快照,上次成功读取:${fmtTime(runsLoadedAt, true)}。` : '尚未取得任务列表,不能据此判断没有任务。'" type="error" :closable="false" show-icon />
|
|
152
|
+
<el-empty v-if="!filteredRuns.length && !loading && !runsError" :description="hasRunFilters ? '已加载记录中没有匹配项;可清除筛选或加载更多。' : '还没有任务:业务系统接入后,触发记录会出现在这里'"><el-button v-if="hasRunFilters" @click="clearRunFilters">清除筛选</el-button></el-empty>
|
|
153
|
+
<el-table v-else :data="filteredRuns" v-loading="loading" @row-click="openDetail" style="cursor: pointer">
|
|
143
154
|
<el-table-column label="时间" width="130">
|
|
144
155
|
<template #default="{ row }"><span class="muted">{{ fmtTime(row.created_at, true) }}</span></template>
|
|
145
156
|
</el-table-column>
|
|
146
157
|
<el-table-column label="调度目标" width="120">
|
|
147
158
|
<template #default="{ row }"><el-tag effect="plain" type="info">{{ row.target }}</el-tag></template>
|
|
148
159
|
</el-table-column>
|
|
160
|
+
<el-table-column label="路由" min-width="140" show-overflow-tooltip><template #default="{ row }"><span class="mono">{{ runRouteKey(row) || '未记录' }}</span></template></el-table-column>
|
|
149
161
|
<el-table-column label="触发方" min-width="150">
|
|
150
162
|
<template #default="{ row }">
|
|
151
163
|
<span v-if="row.client_app_id" class="mono">{{ row.client_app_id }}</span>
|
|
@@ -183,7 +195,8 @@
|
|
|
183
195
|
<template #append><el-button :loading="traceLookupLoading" @click="lookupJobTrace">追溯</el-button></template>
|
|
184
196
|
</el-input>
|
|
185
197
|
</div>
|
|
186
|
-
<el-
|
|
198
|
+
<el-alert v-if="traceLookupError" :title="traceLookupError" :description="traceLookupResult || traceLookupMatches.length ? `正在展示旧快照,上次成功读取:${fmtTime(traceLoadedAt, true)}。` : '此次未取得追溯结果,请刷新重试。'" type="error" :closable="false" show-icon />
|
|
199
|
+
<el-empty v-if="!traceLookupResult && !traceLookupLoading && !traceLookupMatches.length && !traceLookupError" description="输入 job_id、request_id 或 client/thread/principal 查询一次任务" />
|
|
187
200
|
<el-table v-if="!traceLookupResult && traceLookupMatches.length" :data="traceLookupMatches" size="small" class="traceMatches" @row-click="openTraceMatch">
|
|
188
201
|
<el-table-column label="时间" width="130"><template #default="{ row }">{{ fmtTime(row.created_at, true) }}</template></el-table-column>
|
|
189
202
|
<el-table-column prop="request_id" label="request_id" min-width="180" show-overflow-tooltip />
|
|
@@ -265,12 +278,15 @@
|
|
|
265
278
|
</div>
|
|
266
279
|
</el-tab-pane>
|
|
267
280
|
<el-tab-pane label="通知送达" name="notifications">
|
|
268
|
-
<NotificationOutboxPanel v-if="activeTab === 'notifications'" ref="notificationPanel" />
|
|
281
|
+
<NotificationOutboxPanel v-if="activeTab === 'notifications'" ref="notificationPanel" @open-job="openDetail({ job_id: $event })" />
|
|
269
282
|
</el-tab-pane>
|
|
270
283
|
</el-tabs>
|
|
271
284
|
</el-card>
|
|
272
285
|
|
|
273
|
-
<el-drawer
|
|
286
|
+
<el-drawer :model-value="detailOpen" size="min(920px, 92vw)" class="runDetailDrawer" :title="'任务详情 · ' + (detail?.request_id || detail?.job_id || '')" @update:model-value="setDetailOpen">
|
|
287
|
+
<el-alert v-if="detailError" :title="detailError" :description="detail ? `当前保留旧快照(${fmtTime(detailLoadedAt, true)}),刷新成功前不能重新执行。` : '未取得任务详情,请重试。'" type="error" :closable="false" show-icon />
|
|
288
|
+
<div v-if="detailLoading" class="muted">正在读取任务详情…</div>
|
|
289
|
+
<el-button v-if="!detail && detailJobId && !detailLoading" @click="openDetail({ job_id: detailJobId })">重试读取任务</el-button>
|
|
274
290
|
<template v-if="detail">
|
|
275
291
|
<div class="detailHero">
|
|
276
292
|
<div class="detailHeroMain">
|
|
@@ -290,13 +306,16 @@
|
|
|
290
306
|
</div>
|
|
291
307
|
</div>
|
|
292
308
|
<div class="detailActions">
|
|
309
|
+
<el-button plain size="small" :loading="detailLoading" @click="openDetail(detail)">刷新快照</el-button>
|
|
310
|
+
<el-button plain size="small" @click="copyJobId(detail.job_id)">复制原 Job ID</el-button>
|
|
293
311
|
<el-button v-if="detail.conversation_audit_id" plain size="small" type="primary" @click="gotoAuditConversation(detail.conversation_audit_id, detail.client_turn_id)">客户端完整对话</el-button>
|
|
294
312
|
<el-button v-if="detail.thread_id" plain size="small" @click="gotoThread(detail.thread_id)">原会话记录</el-button>
|
|
295
|
-
<el-popconfirm v-if="canRerun" title="
|
|
296
|
-
<template #reference><el-button type="primary" size="small"
|
|
313
|
+
<el-popconfirm v-if="canRerun" title="重新执行会复用原始输入和参数,可能再次调用模型、产生费用或业务写入;不会撤销上次结果。请先核对原任务确需重新执行。" width="350" @confirm="rerun">
|
|
314
|
+
<template #reference><el-button type="primary" size="small" :disabled="detailLoading || Boolean(detailError)" :loading="rerunning">重新执行任务</el-button></template>
|
|
297
315
|
</el-popconfirm>
|
|
298
316
|
</div>
|
|
299
317
|
</div>
|
|
318
|
+
<el-alert v-if="detailRerunHint" :title="detailRerunHint" :type="detail.console_execution?.rerun?.reason === 'outcome_unknown' ? 'warning' : 'info'" :closable="false" show-icon />
|
|
300
319
|
<el-alert v-if="detail.error" :title="detail.error" type="error" :closable="false" style="margin-bottom: 12px" />
|
|
301
320
|
|
|
302
321
|
<div class="detailStats">
|
|
@@ -455,9 +474,13 @@ import RichText from '../components/RichText.vue';
|
|
|
455
474
|
import HelpTip from '../components/HelpTip.vue';
|
|
456
475
|
import ClientConversations from '../components/ClientConversations.vue';
|
|
457
476
|
import NotificationOutboxPanel from '../components/NotificationOutboxPanel.vue';
|
|
477
|
+
import { canOfferRerun, rerunHint } from '../runtime-feedback';
|
|
478
|
+
import { filterLoadedRuns, patchTaskQuery, readRunFilters, readRunsLocation, RUN_FILTER_STATUSES, runRouteKey, runsTabQuery, safeTaskReturnPath, type RunsTab } from '../task-page-location';
|
|
458
479
|
|
|
459
480
|
const route = useRoute();
|
|
460
481
|
const router = useRouter();
|
|
482
|
+
const returnPath = computed(() => safeTaskReturnPath(route.query.return_to));
|
|
483
|
+
const initialLocation = readRunsLocation(route.query);
|
|
461
484
|
|
|
462
485
|
type TraceSeverity = 'info' | 'warning' | 'error';
|
|
463
486
|
type TraceStage = 'launch' | 'context' | 'execution' | 'tool' | 'approval' | 'delivery' | 'summary' | 'recovery' | 'channel' | 'config' | 'system' | string;
|
|
@@ -528,37 +551,52 @@ interface DetailTraceGroup {
|
|
|
528
551
|
}
|
|
529
552
|
|
|
530
553
|
const s = useMe();
|
|
531
|
-
const activeTab = ref<
|
|
554
|
+
const activeTab = ref<RunsTab>(initialLocation.tab);
|
|
532
555
|
const notificationPanel = ref<InstanceType<typeof NotificationOutboxPanel> | null>(null);
|
|
533
|
-
const conversationView = ref<'audit' | 'legacy'>(
|
|
534
|
-
const auditConversationId = ref(
|
|
556
|
+
const conversationView = ref<'audit' | 'legacy'>(initialLocation.view);
|
|
557
|
+
const auditConversationId = ref(initialLocation.conversation), auditTurnId = ref(initialLocation.turn);
|
|
535
558
|
const clientConversations = ref<InstanceType<typeof ClientConversations> | null>(null);
|
|
536
559
|
const list = ref<any[]>([]);
|
|
560
|
+
const runFilters = reactive(readRunFilters(route.query));
|
|
561
|
+
const runFilterTime = ref(Date.now());
|
|
562
|
+
const runStatusLabels: Record<string, string> = { queued: '等待执行', running: '执行中', dispatched: '已派发', done: '已完成', error: '执行错误', rejected: '已拒绝' };
|
|
563
|
+
const hasRunFilters = computed(() => Boolean(runFilters.status || runFilters.route || runFilters.period !== 'all'));
|
|
564
|
+
const filteredRuns = computed(() => filterLoadedRuns(list.value, runFilters, runFilterTime.value));
|
|
565
|
+
const runRouteOptions = computed(() => [...new Set([...list.value.map(runRouteKey).filter(Boolean), ...(runFilters.route ? [runFilters.route] : [])])].sort());
|
|
537
566
|
const loading = ref(false);
|
|
567
|
+
const runsError = ref(''), runsLoadedAt = ref('');
|
|
568
|
+
let runsGeneration = 0;
|
|
538
569
|
// 调度流分页:服务端按 offset 取,前端「加载更多」累加。每页 RUNS_PAGE 条;满页即推断还有更多。
|
|
539
570
|
const RUNS_PAGE = 50;
|
|
540
571
|
const runsMore = ref(false);
|
|
541
572
|
const moreLoading = ref(false);
|
|
542
573
|
const detailOpen = ref(false);
|
|
543
574
|
const detail = ref<any | null>(null);
|
|
575
|
+
const detailLoading = ref(false), detailError = ref(''), detailLoadedAt = ref(''), detailJobId = ref(''), rerunning = ref(false);
|
|
576
|
+
let detailGeneration = 0;
|
|
544
577
|
const traceEvents = ref<TraceEvent[]>([]);
|
|
545
578
|
const traceSummary = ref<any | null>(null);
|
|
546
|
-
const traceJobInput = ref(
|
|
579
|
+
const traceJobInput = ref(initialLocation.traceQ);
|
|
547
580
|
const traceLookupLoading = ref(false);
|
|
548
581
|
const traceLookupResult = ref<TracePayload | null>(null);
|
|
549
582
|
const traceLookupMatches = ref<any[]>([]);
|
|
583
|
+
const traceLookupError = ref(''), traceLoadedAt = ref('');
|
|
584
|
+
let traceGeneration = 0, traceLoadedQuery = '', traceRequestedRaw = '';
|
|
550
585
|
|
|
551
586
|
// ---- 会话视图状态 ----
|
|
552
587
|
const threads = ref<any[]>([]);
|
|
553
588
|
const threadsLoading = ref(false);
|
|
589
|
+
const threadsError = ref('');
|
|
590
|
+
let threadsGeneration = 0;
|
|
554
591
|
const threadsLoaded = ref(false);
|
|
555
592
|
const THREADS_PAGE = 80;
|
|
556
593
|
const threadsMore = ref(false);
|
|
557
594
|
const threadsMoreLoading = ref(false);
|
|
558
|
-
const threadQ = ref(
|
|
595
|
+
const threadQ = ref(initialLocation.threadQ);
|
|
559
596
|
const curThread = ref<number | null>(null);
|
|
560
597
|
const threadData = ref<{ thread: any; messages: ThreadMessage[] } | null>(null);
|
|
561
598
|
const threadDataLoading = ref(false);
|
|
599
|
+
const threadDataError = ref('');
|
|
562
600
|
let threadLoadGeneration = 0;
|
|
563
601
|
const paneRef = ref<HTMLElement | null>(null);
|
|
564
602
|
// 逐轮执行轨迹缓存:job:<id> / agent-run:<id> 分开命名,避免两类 UUID 语义混淆。
|
|
@@ -708,8 +746,8 @@ const toolInjectSummary = computed(() => {
|
|
|
708
746
|
const kbRefs = computed<any[]>(() => (Array.isArray(detail.value?.dispatch?.kb_refs) ? detail.value.dispatch.kb_refs : []));
|
|
709
747
|
const assembledLen = computed(() => String(detail.value?.input || detail.value?.input_preview || '').length);
|
|
710
748
|
const toolsSummary = computed(() => fmtTools(detail.value?.dispatch?.tools));
|
|
711
|
-
const canRerun = computed(() =>
|
|
712
|
-
|
|
749
|
+
const canRerun = computed(() => s.can('runs:write') && canOfferRerun(detail.value?.console_execution));
|
|
750
|
+
const detailRerunHint = computed(() => detail.value ? rerunHint(detail.value.console_execution) : '');
|
|
713
751
|
const detailTraceCount = computed(() => Number(traceSummary.value?.event_count ?? traceEvents.value.length ?? 0));
|
|
714
752
|
const detailWarningCount = computed(() => Number(traceSummary.value?.warning_count ?? traceEvents.value.filter((a) => a.severity === 'warning').length));
|
|
715
753
|
const detailErrorCount = computed(() => Number(traceSummary.value?.error_count ?? traceEvents.value.filter((a) => a.severity === 'error').length));
|
|
@@ -880,34 +918,43 @@ function traceTokenCount(key: string): number {
|
|
|
880
918
|
}
|
|
881
919
|
|
|
882
920
|
async function load(): Promise<void> {
|
|
883
|
-
|
|
921
|
+
const generation = ++runsGeneration;
|
|
922
|
+
loading.value = true; runsError.value = '';
|
|
884
923
|
try {
|
|
885
924
|
const rows = await api<any[]>(`/admin/api/runs?limit=${RUNS_PAGE}&offset=0`);
|
|
886
|
-
|
|
887
|
-
|
|
925
|
+
if (generation !== runsGeneration) return;
|
|
926
|
+
list.value = rows; runsMore.value = rows.length === RUNS_PAGE; runsLoadedAt.value = new Date().toISOString(); runFilterTime.value = Date.now();
|
|
927
|
+
} catch { if (generation === runsGeneration) runsError.value = '暂时无法读取任务列表,请刷新重试。'; }
|
|
928
|
+
finally { if (generation === runsGeneration) loading.value = false; }
|
|
888
929
|
}
|
|
889
930
|
async function loadMoreRuns(): Promise<void> {
|
|
931
|
+
if (loading.value || moreLoading.value) return;
|
|
932
|
+
const generation = runsGeneration;
|
|
890
933
|
moreLoading.value = true;
|
|
891
934
|
try {
|
|
892
935
|
const rows = await api<any[]>(`/admin/api/runs?limit=${RUNS_PAGE}&offset=${list.value.length}`);
|
|
893
|
-
list.value = list.value.concat(rows); runsMore.value = rows.length === RUNS_PAGE;
|
|
936
|
+
if (generation === runsGeneration) { list.value = list.value.concat(rows); runsMore.value = rows.length === RUNS_PAGE; runFilterTime.value = Date.now(); }
|
|
894
937
|
} catch (e) { ElMessage.error((e as Error).message); }
|
|
895
938
|
finally { moreLoading.value = false; }
|
|
896
939
|
}
|
|
897
940
|
async function loadThreads(): Promise<void> {
|
|
898
|
-
|
|
941
|
+
const generation = ++threadsGeneration;
|
|
942
|
+
threadsLoading.value = true; threadsError.value = '';
|
|
899
943
|
try {
|
|
900
944
|
const rows = await api<any[]>(`/admin/api/threads?limit=${THREADS_PAGE}&offset=0`);
|
|
945
|
+
if (generation !== threadsGeneration) return;
|
|
901
946
|
threads.value = rows; threadsLoaded.value = true; threadsMore.value = rows.length === THREADS_PAGE;
|
|
902
947
|
}
|
|
903
|
-
catch (
|
|
904
|
-
finally { threadsLoading.value = false; }
|
|
948
|
+
catch { if (generation === threadsGeneration) threadsError.value = threads.value.length ? '会话列表刷新失败,当前保留旧快照。' : '暂时无法读取会话列表,请刷新重试。'; }
|
|
949
|
+
finally { if (generation === threadsGeneration) threadsLoading.value = false; }
|
|
905
950
|
}
|
|
906
951
|
async function loadMoreThreads(): Promise<void> {
|
|
952
|
+
if (threadsLoading.value || threadsMoreLoading.value) return;
|
|
953
|
+
const generation = threadsGeneration;
|
|
907
954
|
threadsMoreLoading.value = true;
|
|
908
955
|
try {
|
|
909
956
|
const rows = await api<any[]>(`/admin/api/threads?limit=${THREADS_PAGE}&offset=${threads.value.length}`);
|
|
910
|
-
threads.value = threads.value.concat(rows); threadsMore.value = rows.length === THREADS_PAGE;
|
|
957
|
+
if (generation === threadsGeneration) { threads.value = threads.value.concat(rows); threadsMore.value = rows.length === THREADS_PAGE; }
|
|
911
958
|
} catch (e) { ElMessage.error((e as Error).message); }
|
|
912
959
|
finally { threadsMoreLoading.value = false; }
|
|
913
960
|
}
|
|
@@ -916,17 +963,18 @@ function scrollPaneToBottom(): void {
|
|
|
916
963
|
const el = paneRef.value;
|
|
917
964
|
if (el) el.scrollTop = el.scrollHeight;
|
|
918
965
|
}
|
|
919
|
-
async function
|
|
966
|
+
async function loadThread(id: number): Promise<void> {
|
|
920
967
|
const generation = ++threadLoadGeneration;
|
|
968
|
+
if (curThread.value !== id) threadData.value = null;
|
|
921
969
|
curThread.value = id;
|
|
922
|
-
|
|
970
|
+
threadDataLoading.value = true; threadDataError.value = '';
|
|
923
971
|
// 切会话清空轨迹缓存(避免不同会话的 job 串台占内存)
|
|
924
972
|
for (const k of Object.keys(traces)) delete traces[k];
|
|
925
973
|
try {
|
|
926
974
|
const data = await api<{ thread: any; messages: ThreadMessage[] }>('/admin/api/threads/' + id);
|
|
927
975
|
if (generation === threadLoadGeneration) threadData.value = data;
|
|
928
976
|
}
|
|
929
|
-
catch
|
|
977
|
+
catch { if (generation === threadLoadGeneration) threadDataError.value = threadData.value ? '会话读取失败,当前展示旧快照,请刷新重试。' : '未能读取此会话,请刷新重试。'; }
|
|
930
978
|
finally { if (generation === threadLoadGeneration) threadDataLoading.value = false; }
|
|
931
979
|
if (generation === threadLoadGeneration && threadData.value) {
|
|
932
980
|
await nextTick();
|
|
@@ -961,33 +1009,61 @@ async function toggleTrace(message: ThreadMessage): Promise<void> {
|
|
|
961
1009
|
}
|
|
962
1010
|
}
|
|
963
1011
|
function onTab(name: string): void {
|
|
964
|
-
if (name ===
|
|
1012
|
+
if (name === readRunsLocation(route.query).tab) return;
|
|
1013
|
+
void router.push({ query: patchTaskQuery(route.query, { tab: runsTabQuery(name as RunsTab), view: conversationView.value }) });
|
|
965
1014
|
}
|
|
966
1015
|
function onConversationView(): void {
|
|
967
|
-
|
|
1016
|
+
void router.push({ query: patchTaskQuery(route.query, { tab: 'conversations', view: conversationView.value }) });
|
|
1017
|
+
}
|
|
1018
|
+
function persistThreadSearch(): void { void router.replace({ query: patchTaskQuery(route.query, { thread_q: threadQ.value || undefined }) }); }
|
|
1019
|
+
function persistRunFilters(): void {
|
|
1020
|
+
runFilterTime.value = Date.now();
|
|
1021
|
+
void router.replace({ query: patchTaskQuery(route.query, { tab: 'jobs', run_status: runFilters.status || undefined,
|
|
1022
|
+
run_route: runFilters.route.trim() || undefined, run_period: runFilters.period === 'all' ? undefined : runFilters.period }) });
|
|
1023
|
+
}
|
|
1024
|
+
function clearRunFilters(): void { Object.assign(runFilters, { status: '', route: '', period: 'all' }); persistRunFilters(); }
|
|
1025
|
+
async function openThread(id: number): Promise<void> {
|
|
1026
|
+
if (curThread.value === id && conversationView.value === 'legacy') { await loadThread(id); return; }
|
|
1027
|
+
await router.push({ query: patchTaskQuery(route.query, { tab: 'conversations', view: 'legacy', thread: String(id), detail: undefined }) });
|
|
968
1028
|
}
|
|
969
1029
|
function refresh(): void {
|
|
970
1030
|
if (activeTab.value === 'notifications') void notificationPanel.value?.refresh();
|
|
971
1031
|
else if (activeTab.value === 'threads' && conversationView.value === 'audit') void clientConversations.value?.refresh();
|
|
972
|
-
else if (activeTab.value === 'threads') { void loadThreads(); if (curThread.value) void
|
|
1032
|
+
else if (activeTab.value === 'threads') { void loadThreads(); if (curThread.value) void loadThread(curThread.value); }
|
|
973
1033
|
else if (activeTab.value === 'trace') { if (traceJobInput.value.trim()) void lookupJobTrace(); }
|
|
974
1034
|
else void load();
|
|
975
1035
|
}
|
|
976
1036
|
|
|
977
1037
|
async function openDetail(row: any): Promise<void> {
|
|
978
|
-
detailOpen.value
|
|
1038
|
+
if (detailOpen.value && detailJobId.value === row.job_id) { await loadDetail(row.job_id); return; }
|
|
1039
|
+
await router.push({ query: patchTaskQuery(route.query, { tab: runsTabQuery(activeTab.value), detail: row.job_id }) });
|
|
1040
|
+
}
|
|
1041
|
+
async function loadDetail(jobId: string): Promise<void> {
|
|
1042
|
+
const generation = ++detailGeneration;
|
|
1043
|
+
if (detail.value?.job_id !== jobId) { detail.value = null; traceEvents.value = []; traceSummary.value = null; detailLoadedAt.value = ''; }
|
|
1044
|
+
detailJobId.value = jobId; detailOpen.value = true; detailLoading.value = true; detailError.value = '';
|
|
1045
|
+
detailPanels.value = ['chain', 'result'];
|
|
979
1046
|
try {
|
|
980
|
-
const t = await api<TracePayload>('/admin/api/runs/' +
|
|
1047
|
+
const t = await api<TracePayload>('/admin/api/runs/' + encodeURIComponent(jobId) + '/trace');
|
|
1048
|
+
if (generation !== detailGeneration) return;
|
|
981
1049
|
detail.value = t.job; traceEvents.value = normalizeTraceEvents(t); traceSummary.value = t.trace.summary ?? null;
|
|
982
|
-
|
|
1050
|
+
detailLoadedAt.value = new Date().toISOString();
|
|
1051
|
+
} catch { if (generation === detailGeneration) detailError.value = '暂时无法读取任务详情,请刷新重试。'; }
|
|
1052
|
+
finally { if (generation === detailGeneration) detailLoading.value = false; }
|
|
983
1053
|
}
|
|
984
|
-
async function lookupJobTrace(): Promise<void> {
|
|
1054
|
+
async function lookupJobTrace(persist = true): Promise<void> {
|
|
985
1055
|
const raw = traceJobInput.value.trim();
|
|
986
1056
|
if (!raw) { ElMessage.error('请输入要追溯的标识'); return; }
|
|
1057
|
+
traceRequestedRaw = raw;
|
|
1058
|
+
if (persist) void router.replace({ query: patchTaskQuery(route.query, { tab: 'trace', trace_q: raw, job: undefined }) });
|
|
987
1059
|
const q = traceLookupQuery(raw);
|
|
988
|
-
|
|
1060
|
+
const generation = ++traceGeneration;
|
|
1061
|
+
if (q !== traceLoadedQuery) { traceLookupResult.value = null; traceLookupMatches.value = []; }
|
|
1062
|
+
traceLookupLoading.value = true; traceLookupError.value = '';
|
|
989
1063
|
try {
|
|
990
1064
|
const got = await api<TracePayload & { matches?: any[]; count?: number }>('/admin/api/runs/trace?' + q);
|
|
1065
|
+
if (generation !== traceGeneration) return;
|
|
1066
|
+
traceLoadedQuery = q; traceLoadedAt.value = new Date().toISOString();
|
|
991
1067
|
if (got.job) {
|
|
992
1068
|
traceLookupResult.value = got;
|
|
993
1069
|
traceLookupMatches.value = [];
|
|
@@ -996,11 +1072,8 @@ async function lookupJobTrace(): Promise<void> {
|
|
|
996
1072
|
traceLookupMatches.value = got.matches ?? [];
|
|
997
1073
|
if (!traceLookupMatches.value.length) ElMessage.warning('没有匹配的任务');
|
|
998
1074
|
}
|
|
999
|
-
} catch (
|
|
1000
|
-
|
|
1001
|
-
traceLookupMatches.value = [];
|
|
1002
|
-
ElMessage.error((e as Error).message);
|
|
1003
|
-
} finally { traceLookupLoading.value = false; }
|
|
1075
|
+
} catch { if (generation === traceGeneration) traceLookupError.value = '暂时无法读取追溯结果,请刷新重试。'; }
|
|
1076
|
+
finally { if (generation === traceGeneration) traceLookupLoading.value = false; }
|
|
1004
1077
|
}
|
|
1005
1078
|
function traceLookupQuery(raw: string): string {
|
|
1006
1079
|
const p = new URLSearchParams();
|
|
@@ -1017,11 +1090,26 @@ async function openTraceMatch(row: any): Promise<void> {
|
|
|
1017
1090
|
}
|
|
1018
1091
|
function openTraceLookupDetail(): void {
|
|
1019
1092
|
if (!traceLookupResult.value) return;
|
|
1093
|
+
detailGeneration++; detailLoading.value = false;
|
|
1020
1094
|
detail.value = traceLookupResult.value.job;
|
|
1095
|
+
detailJobId.value = detail.value.job_id; detailLoadedAt.value = traceLoadedAt.value;
|
|
1096
|
+
detailError.value = traceLookupError.value ? '追溯刷新失败,当前详情来自旧快照,请刷新核对。' : '';
|
|
1021
1097
|
traceEvents.value = normalizeTraceEvents(traceLookupResult.value);
|
|
1022
1098
|
traceSummary.value = traceLookupResult.value.trace.summary ?? null;
|
|
1023
1099
|
detailPanels.value = ['chain', 'result'];
|
|
1024
1100
|
detailOpen.value = true;
|
|
1101
|
+
void router.push({ query: patchTaskQuery(route.query, { tab: 'trace', detail: detailJobId.value }) });
|
|
1102
|
+
}
|
|
1103
|
+
function setDetailOpen(value: boolean): void {
|
|
1104
|
+
detailOpen.value = value;
|
|
1105
|
+
if (!value) {
|
|
1106
|
+
detailGeneration++; detailLoading.value = false; detailJobId.value = '';
|
|
1107
|
+
void router.replace({ query: patchTaskQuery(route.query, { tab: runsTabQuery(activeTab.value), detail: undefined }) });
|
|
1108
|
+
}
|
|
1109
|
+
}
|
|
1110
|
+
async function copyJobId(jobId: string): Promise<void> {
|
|
1111
|
+
try { await navigator.clipboard.writeText(jobId); ElMessage.success('已复制原 Job ID,可用于核对原调用结果'); }
|
|
1112
|
+
catch { ElMessage.warning('复制失败,请选中上方 Job ID 手工复制。'); }
|
|
1025
1113
|
}
|
|
1026
1114
|
function traceDebugJson(): string {
|
|
1027
1115
|
return JSON.stringify({
|
|
@@ -1076,67 +1164,51 @@ async function copyTraceDebugReport(): Promise<void> {
|
|
|
1076
1164
|
}
|
|
1077
1165
|
// 从某个 job 跳到它所属的完整会话
|
|
1078
1166
|
function gotoThread(threadId: number): void {
|
|
1079
|
-
|
|
1080
|
-
activeTab.value = 'threads';
|
|
1081
|
-
conversationView.value = 'legacy';
|
|
1082
|
-
if (!threadsLoaded.value) void loadThreads();
|
|
1083
|
-
void openThread(threadId);
|
|
1084
|
-
void router.replace({ query: { ...route.query, job: undefined, conversation: undefined, turn: undefined, thread: String(threadId) } });
|
|
1167
|
+
void router.push({ query: patchTaskQuery(route.query, { tab: 'conversations', view: 'legacy', detail: undefined, job: undefined, thread: String(threadId) }) });
|
|
1085
1168
|
}
|
|
1086
1169
|
function selectAuditConversation(id: string): void {
|
|
1087
1170
|
gotoAuditConversation(id);
|
|
1088
1171
|
}
|
|
1089
1172
|
function gotoAuditConversation(id: string, turnId?: string): void {
|
|
1090
|
-
|
|
1091
|
-
activeTab.value = 'threads'; conversationView.value = 'audit';
|
|
1092
|
-
auditConversationId.value = id; auditTurnId.value = turnId || '';
|
|
1093
|
-
void router.replace({ query: { ...route.query, job: undefined, thread: undefined, conversation: id, turn: turnId || undefined } });
|
|
1173
|
+
void router.push({ query: patchTaskQuery(route.query, { tab: 'conversations', view: 'audit', detail: undefined, job: undefined, conversation: id, turn: turnId || undefined }) });
|
|
1094
1174
|
}
|
|
1095
1175
|
async function rerun(): Promise<void> {
|
|
1176
|
+
if (!canRerun.value || detailLoading.value || detailError.value || rerunning.value) return;
|
|
1177
|
+
const jobId = detail.value.job_id;
|
|
1178
|
+
rerunning.value = true;
|
|
1096
1179
|
try {
|
|
1097
|
-
await api('/admin/api/runs/' +
|
|
1098
|
-
ElMessage.success('
|
|
1099
|
-
|
|
1100
|
-
|
|
1180
|
+
await api('/admin/api/runs/' + jobId + '/rerun', { method: 'POST', body: '{}' });
|
|
1181
|
+
ElMessage.success('原任务已重新入队,尚未确认执行结果');
|
|
1182
|
+
if (detailOpen.value && detailJobId.value === jobId) await openDetail({ job_id: jobId });
|
|
1183
|
+
await load();
|
|
1184
|
+
} catch (e) {
|
|
1185
|
+
if (detailJobId.value === jobId) detailError.value = `重新执行请求未得到完整确认:${(e as Error).message}。请先刷新核对原任务状态,不要重复提交。`;
|
|
1186
|
+
} finally { rerunning.value = false; }
|
|
1101
1187
|
}
|
|
1102
|
-
|
|
1103
|
-
if (
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
if (
|
|
1116
|
-
|
|
1117
|
-
if (
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
watch(() => route.query['job'], (v) => {
|
|
1122
|
-
void openJobFromQuery(String(v ?? ''));
|
|
1123
|
-
});
|
|
1124
|
-
watch(() => [route.query['conversation'], route.query['turn']], ([id, turn]) => {
|
|
1125
|
-
if (!id) return;
|
|
1126
|
-
activeTab.value = 'threads'; conversationView.value = 'audit';
|
|
1127
|
-
auditConversationId.value = String(id); auditTurnId.value = String(turn || '');
|
|
1128
|
-
});
|
|
1129
|
-
watch(() => route.query['thread'], (value) => {
|
|
1130
|
-
const id = String(value || '');
|
|
1131
|
-
if (!/^\d+$/.test(id) || (curThread.value === Number(id) && conversationView.value === 'legacy')) return;
|
|
1132
|
-
activeTab.value = 'threads'; conversationView.value = 'legacy';
|
|
1133
|
-
if (!threadsLoaded.value) void loadThreads();
|
|
1134
|
-
void openThread(Number(id));
|
|
1135
|
-
});
|
|
1188
|
+
function applyLocation(): void {
|
|
1189
|
+
if (route.path !== '/runs') return;
|
|
1190
|
+
const location = readRunsLocation(route.query);
|
|
1191
|
+
Object.assign(runFilters, readRunFilters(route.query)); runFilterTime.value = Date.now();
|
|
1192
|
+
activeTab.value = location.tab; conversationView.value = location.view;
|
|
1193
|
+
auditConversationId.value = location.conversation; auditTurnId.value = location.turn;
|
|
1194
|
+
threadQ.value = location.threadQ; traceJobInput.value = location.traceQ;
|
|
1195
|
+
if (location.tab === 'threads' && location.view === 'legacy') {
|
|
1196
|
+
if (!threadsLoaded.value && !threadsLoading.value) void loadThreads();
|
|
1197
|
+
if (location.thread && curThread.value !== location.thread) void loadThread(location.thread);
|
|
1198
|
+
else if (!location.thread && curThread.value) { threadLoadGeneration++; curThread.value = null; threadData.value = null; threadDataError.value = ''; threadDataLoading.value = false; }
|
|
1199
|
+
}
|
|
1200
|
+
if (location.tab === 'trace' && location.traceQ && location.traceQ !== traceRequestedRaw) void lookupJobTrace(false);
|
|
1201
|
+
else if (!location.traceQ) { traceGeneration++; traceRequestedRaw = ''; traceLoadedQuery = ''; traceLookupResult.value = null; traceLookupMatches.value = []; traceLookupError.value = ''; traceLookupLoading.value = false; }
|
|
1202
|
+
if (location.detail && (!detailOpen.value || detailJobId.value !== location.detail)) void loadDetail(location.detail);
|
|
1203
|
+
else if (!location.detail && detailOpen.value) { detailGeneration++; detailOpen.value = false; detailLoading.value = false; detailJobId.value = ''; }
|
|
1204
|
+
}
|
|
1205
|
+
onMounted(() => { void load(); applyLocation(); });
|
|
1206
|
+
watch(() => route.query, applyLocation);
|
|
1136
1207
|
</script>
|
|
1137
1208
|
|
|
1138
1209
|
<style scoped>
|
|
1139
1210
|
.muted { color: var(--el-text-color-secondary); font-size: 12px; }
|
|
1211
|
+
.run-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 4px 0 14px; }
|
|
1140
1212
|
.conversationViewSwitch { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 14px; }
|
|
1141
1213
|
.dangerText { color: var(--el-color-danger); }
|
|
1142
1214
|
.warningText { color: var(--el-color-warning); }
|