scope-agent-workbench 0.2.0 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. package/CHANGELOG.md +41 -0
  2. package/bridge/agent-email-relay.mjs +160 -160
  3. package/bridge/app-server-websocket-transport.mjs +219 -219
  4. package/bridge/archive/service.mjs +130 -130
  5. package/bridge/auth-profile-failover.mjs +58 -58
  6. package/bridge/auth-profile-manager.mjs +215 -215
  7. package/bridge/capacity-recovery.mjs +90 -90
  8. package/bridge/gpu-usage-history.mjs +322 -322
  9. package/bridge/local/history.mjs +20 -5
  10. package/bridge/plugins/aliyun-dlc/monitor.mjs +236 -236
  11. package/bridge/plugins/aliyun-dlc/probe.mjs +701 -701
  12. package/bridge/private-gateway.mjs +371 -371
  13. package/bridge/private-start.mjs +22 -22
  14. package/bridge/probes/app-server-handoff-probe.mjs +87 -87
  15. package/bridge/probes/app-server-writer-probe.mjs +69 -69
  16. package/bridge/probes/assistant-search-probe.mjs +321 -321
  17. package/bridge/probes/dialogue-probe.mjs +462 -462
  18. package/bridge/probes/history-probe.mjs +430 -345
  19. package/bridge/probes/new-session-preflight.mjs +14 -14
  20. package/bridge/probes/profile-cancel-probe.mjs +17 -17
  21. package/bridge/probes/profile-delete-probe.mjs +26 -26
  22. package/bridge/probes/profile-list-probe.mjs +114 -114
  23. package/bridge/probes/profile-write-probe.mjs +109 -109
  24. package/bridge/probes/raw-context-probe.mjs +51 -51
  25. package/bridge/probes/remote-probe.mjs +627 -626
  26. package/bridge/probes/submission-probe.mjs +2 -2
  27. package/bridge/probes/takeover-probe.mjs +326 -326
  28. package/bridge/probes/vscode-open-preflight.mjs +21 -21
  29. package/bridge/providers/claude-interactive.py +463 -341
  30. package/bridge/providers/cli-command.mjs +103 -103
  31. package/bridge/providers/conversations.mjs +231 -231
  32. package/bridge/providers/native-commands.py +38 -38
  33. package/bridge/providers/native-session-state.mjs +14 -14
  34. package/bridge/providers/native-session-state.py +96 -96
  35. package/bridge/providers/remote-job.py +130 -130
  36. package/bridge/remote-app-server-command.mjs +121 -121
  37. package/bridge/remote-directory-listing.mjs +148 -148
  38. package/bridge/rollout-summary.mjs +20 -2
  39. package/bridge/routes/dialogue.mjs +48 -3
  40. package/bridge/routes/models.mjs +312 -312
  41. package/bridge/server.mjs +3357 -3332
  42. package/bridge/session-attachments.mjs +150 -150
  43. package/bridge/session-catalog/agy-history.py +141 -2
  44. package/bridge/session-catalog/catalog.mjs +17 -0
  45. package/bridge/session-catalog/probe.py +1207 -331
  46. package/bridge/session-catalog/routes.mjs +6 -0
  47. package/bridge/start.mjs +205 -205
  48. package/bridge/state-persistence.mjs +9 -1
  49. package/bridge/tmux-session-control.mjs +29 -29
  50. package/bridge/vscode-opener.mjs +157 -157
  51. package/bridge/web-terminal.mjs +52 -52
  52. package/bridge/workbench/manager-context.mjs +51 -51
  53. package/bridge/workbench/service.mjs +301 -301
  54. package/dist/client/.vite/manifest.json +4 -4
  55. package/dist/client/assets/{index-Enu1x0PS.js → index-BMior55c.js} +2 -2
  56. package/dist/client/assets/{layout-segment-context-CmJzExWq.js → layout-segment-context-DjGudgXn.js} +1 -1
  57. package/dist/client/assets/page-CJqXlhDs.js +551 -0
  58. package/dist/client/assets/page-LYzRz6_S.css +1 -0
  59. package/dist/client/favicon.svg +6 -6
  60. package/dist/server/__vite_rsc_assets_manifest.js +8 -8
  61. package/dist/server/index.js +7 -7
  62. package/dist/server/ssr/__vite_rsc_assets_manifest.js +8 -8
  63. package/dist/server/ssr/assets/{page-CYYyCnKD.js → page-BB9Dri2u.js} +2416 -271
  64. package/dist/server/ssr/assets/page-LYzRz6_S.css +1 -0
  65. package/dist/server/ssr/index.js +1 -1
  66. package/dist/server/ssr/vinext-server.json +1 -1
  67. package/dist/server/vinext-server.json +1 -1
  68. package/dist/server/wrangler.json +1 -1
  69. package/lib/browser-snapshot-cache.js +53 -53
  70. package/lib/formula-preview.js +1 -1
  71. package/lib/incremental-snapshot.js +300 -300
  72. package/lib/markdown-math.js +151 -151
  73. package/lib/remote-links.js +95 -95
  74. package/lib/runtime-config.js +70 -70
  75. package/lib/session-filters.js +38 -38
  76. package/lib/ssh-config.js +26 -26
  77. package/lib/stable-order.js +39 -39
  78. package/lib/subagent-display-prefs.ts +130 -0
  79. package/package.json +1 -1
  80. package/scripts/agent-email-relay.mjs +104 -104
  81. package/scripts/email-notification-cli.mjs +28 -28
  82. package/scripts/enable-private-access.ps1 +109 -109
  83. package/scripts/fixtures/native-conversations.mjs +164 -6
  84. package/scripts/fixtures/workbench-conversations.mjs +475 -352
  85. package/scripts/preview-workbench.mjs +669 -669
  86. package/dist/client/assets/page-COBv6VWj.css +0 -1
  87. package/dist/client/assets/page-DVjU6VG_.js +0 -550
  88. package/dist/server/ssr/assets/page-COBv6VWj.css +0 -1
@@ -9,6 +9,7 @@ export function dialogueRoutes(context) {
9
9
  RAW_CONTEXT_PROBE,
10
10
  cleanSshError,
11
11
  findAgent,
12
+ getSnapshot,
12
13
  historicalSessions,
13
14
  jsonResponse,
14
15
  readJsonBody,
@@ -19,9 +20,18 @@ export function dialogueRoutes(context) {
19
20
  if (url.pathname === "/api/dialogue" && request.method === "POST") {
20
21
  try {
21
22
  const body = await readJsonBody(request);
23
+ const subagentId =
24
+ typeof body.subagentId === "string" ? body.subagentId.trim() : "";
22
25
  if (body.host === LOCAL_HOST && localDialogue) {
23
26
  const dialogue = await localDialogue(body);
24
- jsonResponse(response, 200, { ok: true, host: body.host, sessionId: body.sessionId, loadedAt: new Date().toISOString(), ...dialogue });
27
+ jsonResponse(response, 200, {
28
+ ok: true,
29
+ host: body.host,
30
+ sessionId: body.sessionId,
31
+ ...(subagentId ? { subagentId } : {}),
32
+ loadedAt: new Date().toISOString(),
33
+ ...dialogue,
34
+ });
25
35
  return true;
26
36
  }
27
37
  const agent =
@@ -31,13 +41,47 @@ export function dialogueRoutes(context) {
31
41
  jsonResponse(response, 404, { error: "未找到对应的 rollout" });
32
42
  return true;
33
43
  }
34
- const limit = Math.max(1, Math.min(100, Number(body.limit) || 10));
44
+ let targetRollout = agent.rollout;
45
+ let subagentMeta = null;
46
+ if (subagentId) {
47
+ const hostEntry = getSnapshot?.()?.hosts?.find(
48
+ (item) => item.alias === agent.host,
49
+ );
50
+ const parentId = agent.rollout.id || body.sessionId;
51
+ const foundSub =
52
+ (agent.subagents || []).find((item) => item.id === subagentId) ||
53
+ (hostEntry?.sessions || []).find(
54
+ (item) =>
55
+ item.isSubagent &&
56
+ item.id === subagentId &&
57
+ item.parentThreadId === parentId,
58
+ );
59
+ if (!foundSub?.path) {
60
+ jsonResponse(response, 404, { error: "未找到对应的子代理 rollout" });
61
+ return true;
62
+ }
63
+ targetRollout = foundSub;
64
+ subagentMeta = {
65
+ id: foundSub.id,
66
+ agentNickname: foundSub.agentNickname || "",
67
+ agentPath: foundSub.agentPath || "",
68
+ agentRole: foundSub.agentRole || "",
69
+ model: foundSub.model || "",
70
+ turnState: foundSub.turnState || "idle",
71
+ lastAction: foundSub.lastAction || "",
72
+ lastEventAt: foundSub.lastEventAt || null,
73
+ };
74
+ }
75
+ const limit = Math.max(
76
+ 1,
77
+ Math.min(100, Number(body.limit) || (subagentId ? 40 : 10)),
78
+ );
35
79
  const before = Number.isFinite(Number(body.before))
36
80
  ? Math.max(0, Math.floor(Number(body.before)))
37
81
  : "";
38
82
  const command = [
39
83
  "python3 -",
40
- shellQuote(agent.rollout.path),
84
+ shellQuote(targetRollout.path),
41
85
  shellQuote(String(limit)),
42
86
  shellQuote(String(before)),
43
87
  shellQuote(body.dialogueOnly ? "dialogue-only" : "full"),
@@ -62,6 +106,7 @@ export function dialogueRoutes(context) {
62
106
  ok: true,
63
107
  host: agent.host,
64
108
  sessionId: agent.rollout.id,
109
+ ...(subagentMeta ? { subagentId: subagentMeta.id, subagent: subagentMeta } : {}),
65
110
  loadedAt: new Date().toISOString(),
66
111
  ...dialogue,
67
112
  });