elanous 0.3.2 → 0.3.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 (214) hide show
  1. package/apps/pwa/out/404/index.html +1 -1
  2. package/apps/pwa/out/404.html +1 -1
  3. package/apps/pwa/out/_next/static/chunks/{280-f880696e14bc1032.js → 280-53fe7ab5dbd19607.js} +1 -1
  4. package/apps/pwa/out/_next/static/chunks/{5359-11952bdf39bae0c7.js → 5359-7aa498ded308ea17.js} +1 -1
  5. package/apps/pwa/out/_next/static/chunks/app/approvals/{page-822c5395a88eb1e5.js → page-c9e997416c86c8dd.js} +1 -1
  6. package/apps/pwa/out/_next/static/chunks/app/autopilot/page-4e24912975188223.js +1 -0
  7. package/apps/pwa/out/_next/static/chunks/app/board/{page-26941f067e899ed3.js → page-b117b7ee316afe86.js} +1 -1
  8. package/apps/pwa/out/_next/static/chunks/app/botlab/{page-3c29b0e0d681e33d.js → page-a447a17fd887c68e.js} +1 -1
  9. package/apps/pwa/out/_next/static/chunks/app/bots/page-2b3e0df385eba76f.js +1 -0
  10. package/apps/pwa/out/_next/static/chunks/app/ceo/{page-1224ce11e2a2eef5.js → page-409ed1d2f2c5f706.js} +1 -1
  11. package/apps/pwa/out/_next/static/chunks/app/chat/{page-940b44876305fac2.js → page-1e90543da0a66b63.js} +1 -1
  12. package/apps/pwa/out/_next/static/chunks/app/consult/{page-c5b8f3b77568a8e9.js → page-f68c84b50dee9796.js} +1 -1
  13. package/apps/pwa/out/_next/static/chunks/app/control/page-afefb7fac0047855.js +1 -0
  14. package/apps/pwa/out/_next/static/chunks/app/decisions/{page-3048505d466ec98a.js → page-79f9d6ae042c07b4.js} +1 -1
  15. package/apps/pwa/out/_next/static/chunks/app/design-check/{page-8d97da172a2cd552.js → page-9726864cd21303a2.js} +1 -1
  16. package/apps/pwa/out/_next/static/chunks/app/editor/page-ab0febcc6695f4e4.js +1 -0
  17. package/apps/pwa/out/_next/static/chunks/app/exec/page-6f6b157c52869db0.js +1 -0
  18. package/apps/pwa/out/_next/static/chunks/app/field/{page-c4f1095489266f97.js → page-78aef36734ddd588.js} +1 -1
  19. package/apps/pwa/out/_next/static/chunks/app/inside/page-6a634383e6247c6b.js +1 -0
  20. package/apps/pwa/out/_next/static/chunks/app/intake/{page-111a4245428caa84.js → page-66f0dc569bce5230.js} +1 -1
  21. package/apps/pwa/out/_next/static/chunks/app/{layout-956789c8340e289e.js → layout-fda2f39e4d21744c.js} +1 -1
  22. package/apps/pwa/out/_next/static/chunks/app/live/page-a6fd7cb710d80092.js +1 -0
  23. package/apps/pwa/out/_next/static/chunks/app/live-run/page-2a7c714e7f65229d.js +1 -0
  24. package/apps/pwa/out/_next/static/chunks/app/loops/page-a71ad5f5b075be8d.js +1 -0
  25. package/apps/pwa/out/_next/static/chunks/app/market/page-df7f2d252ff836b5.js +1 -0
  26. package/apps/pwa/out/_next/static/chunks/app/missions/[id]/page-7f38deb0998488bf.js +1 -0
  27. package/apps/pwa/out/_next/static/chunks/app/morning/{page-afa5068541a55cd1.js → page-7e80f3b354be205e.js} +1 -1
  28. package/apps/pwa/out/_next/static/chunks/app/not-found-5ea0e042882e87de.js +1 -0
  29. package/apps/pwa/out/_next/static/chunks/app/observatory/{page-527a398eac0b4699.js → page-f3df76408c930b99.js} +1 -1
  30. package/apps/pwa/out/_next/static/chunks/app/ops/checklist/page-88996ccc31edf06c.js +1 -0
  31. package/apps/pwa/out/_next/static/chunks/app/ops/release/page-d95db9df4a907fe1.js +1 -0
  32. package/apps/pwa/out/_next/static/chunks/app/ops/resources/{page-da8f855dc25cae3d.js → page-5a518950f4136aad.js} +1 -1
  33. package/apps/pwa/out/_next/static/chunks/app/ops/seats/page-d9e070e009e1a521.js +1 -0
  34. package/apps/pwa/out/_next/static/chunks/app/outputs/{page-905013106f55daad.js → page-167c44a8ff378706.js} +1 -1
  35. package/apps/pwa/out/_next/static/chunks/app/page-4763cf1b0e52e28b.js +1 -0
  36. package/apps/pwa/out/_next/static/chunks/app/reflection/{page-3b0434a6fc1154e1.js → page-a5bcd883385064d4.js} +1 -1
  37. package/apps/pwa/out/_next/static/chunks/app/scheduler/{page-9deae0524ce7a7e2.js → page-f9ef43f59ba98937.js} +1 -1
  38. package/apps/pwa/out/_next/static/chunks/app/sessions/{page-4f4f0858754f73a4.js → page-43c5d7004582f888.js} +1 -1
  39. package/apps/pwa/out/_next/static/chunks/app/settings/devices/page-20dfe2b5bca855eb.js +1 -0
  40. package/apps/pwa/out/_next/static/chunks/app/settings/page-7c022f7edf3203d5.js +1 -0
  41. package/apps/pwa/out/_next/static/chunks/app/setup/done/{page-2e8cc4d212f1ca01.js → page-adc6daed842128e6.js} +1 -1
  42. package/apps/pwa/out/_next/static/chunks/app/setup/page-683c175da53e9ec3.js +1 -0
  43. package/apps/pwa/out/_next/static/chunks/app/share/page-a91d9cbaf50cc8b4.js +1 -0
  44. package/apps/pwa/out/_next/static/chunks/app/showroom/page-376f3a03f4d31706.js +1 -0
  45. package/apps/pwa/out/_next/static/chunks/app/tasks/{page-aedaede687cc293d.js → page-256d83e84ed55191.js} +1 -1
  46. package/apps/pwa/out/_next/static/chunks/app/term/{page-bb5c95ce68358be2.js → page-5e1fb7a8e0927cf6.js} +1 -1
  47. package/apps/pwa/out/_next/static/chunks/app/today/page-95994b2b507ee120.js +1 -0
  48. package/apps/pwa/out/_next/static/chunks/app/trace/{page-45967d78c1748112.js → page-486b1d3605dbd5f3.js} +1 -1
  49. package/apps/pwa/out/_next/static/chunks/app/vault/{page-9a1cdd7c5a50bf73.js → page-0159591688c45cae.js} +1 -1
  50. package/apps/pwa/out/_next/static/chunks/app/workflows/chat-ui/page-e640489e459c2789.js +1 -0
  51. package/apps/pwa/out/_next/static/chunks/app/workflows/page-89c00bebfb27b5d5.js +1 -0
  52. package/apps/pwa/out/_next/static/chunks/app/workspace/{page-8f291522cb3d91a6.js → page-edf90eaa6d354fee.js} +1 -1
  53. package/apps/pwa/out/_next/static/chunks/app/worktrees/page-2f2bd38085305ef0.js +1 -0
  54. package/apps/pwa/out/approvals/index.html +1 -1
  55. package/apps/pwa/out/approvals/index.txt +13 -13
  56. package/apps/pwa/out/autopilot/index.html +1 -1
  57. package/apps/pwa/out/autopilot/index.txt +13 -13
  58. package/apps/pwa/out/board/index.html +1 -1
  59. package/apps/pwa/out/board/index.txt +13 -13
  60. package/apps/pwa/out/botlab/index.html +1 -1
  61. package/apps/pwa/out/botlab/index.txt +13 -13
  62. package/apps/pwa/out/bots/index.html +1 -1
  63. package/apps/pwa/out/bots/index.txt +13 -13
  64. package/apps/pwa/out/ceo/index.html +1 -1
  65. package/apps/pwa/out/ceo/index.txt +13 -13
  66. package/apps/pwa/out/chat/index.html +1 -1
  67. package/apps/pwa/out/chat/index.txt +13 -13
  68. package/apps/pwa/out/consult/index.html +1 -1
  69. package/apps/pwa/out/consult/index.txt +13 -13
  70. package/apps/pwa/out/control/index.html +1 -1
  71. package/apps/pwa/out/control/index.txt +13 -13
  72. package/apps/pwa/out/decisions/index.html +1 -1
  73. package/apps/pwa/out/decisions/index.txt +13 -13
  74. package/apps/pwa/out/design-check/index.html +1 -1
  75. package/apps/pwa/out/design-check/index.txt +13 -13
  76. package/apps/pwa/out/editor/index.html +1 -1
  77. package/apps/pwa/out/editor/index.txt +13 -13
  78. package/apps/pwa/out/exec/index.html +1 -1
  79. package/apps/pwa/out/exec/index.txt +13 -13
  80. package/apps/pwa/out/field/index.html +1 -1
  81. package/apps/pwa/out/field/index.txt +13 -13
  82. package/apps/pwa/out/healthz +1 -1
  83. package/apps/pwa/out/index.html +1 -1
  84. package/apps/pwa/out/index.txt +13 -13
  85. package/apps/pwa/out/inside/index.html +1 -1
  86. package/apps/pwa/out/inside/index.txt +13 -13
  87. package/apps/pwa/out/intake/index.html +1 -1
  88. package/apps/pwa/out/intake/index.txt +13 -13
  89. package/apps/pwa/out/live/index.html +1 -1
  90. package/apps/pwa/out/live/index.txt +13 -13
  91. package/apps/pwa/out/live-run/index.html +1 -1
  92. package/apps/pwa/out/live-run/index.txt +13 -13
  93. package/apps/pwa/out/loops/index.html +1 -1
  94. package/apps/pwa/out/loops/index.txt +13 -13
  95. package/apps/pwa/out/market/index.html +1 -1
  96. package/apps/pwa/out/market/index.txt +13 -13
  97. package/apps/pwa/out/missions/placeholder/index.html +1 -1
  98. package/apps/pwa/out/missions/placeholder/index.txt +13 -13
  99. package/apps/pwa/out/morning/index.html +1 -1
  100. package/apps/pwa/out/morning/index.txt +13 -13
  101. package/apps/pwa/out/observatory/index.html +1 -1
  102. package/apps/pwa/out/observatory/index.txt +13 -13
  103. package/apps/pwa/out/ops/checklist/index.html +1 -1
  104. package/apps/pwa/out/ops/checklist/index.txt +13 -13
  105. package/apps/pwa/out/ops/release/index.html +1 -1
  106. package/apps/pwa/out/ops/release/index.txt +13 -13
  107. package/apps/pwa/out/ops/resources/index.html +1 -1
  108. package/apps/pwa/out/ops/resources/index.txt +13 -13
  109. package/apps/pwa/out/ops/seats/index.html +1 -1
  110. package/apps/pwa/out/ops/seats/index.txt +13 -13
  111. package/apps/pwa/out/outputs/index.html +1 -1
  112. package/apps/pwa/out/outputs/index.txt +13 -13
  113. package/apps/pwa/out/reflection/index.html +1 -1
  114. package/apps/pwa/out/reflection/index.txt +14 -14
  115. package/apps/pwa/out/scheduler/index.html +1 -1
  116. package/apps/pwa/out/scheduler/index.txt +13 -13
  117. package/apps/pwa/out/sessions/index.html +1 -1
  118. package/apps/pwa/out/sessions/index.txt +13 -13
  119. package/apps/pwa/out/settings/devices/index.html +1 -1
  120. package/apps/pwa/out/settings/devices/index.txt +13 -13
  121. package/apps/pwa/out/settings/index.html +1 -1
  122. package/apps/pwa/out/settings/index.txt +13 -13
  123. package/apps/pwa/out/setup/done/index.html +1 -1
  124. package/apps/pwa/out/setup/done/index.txt +13 -13
  125. package/apps/pwa/out/setup/index.html +1 -1
  126. package/apps/pwa/out/setup/index.txt +13 -13
  127. package/apps/pwa/out/share/index.html +1 -1
  128. package/apps/pwa/out/share/index.txt +13 -13
  129. package/apps/pwa/out/showroom/index.html +1 -1
  130. package/apps/pwa/out/showroom/index.txt +13 -13
  131. package/apps/pwa/out/tasks/index.html +1 -1
  132. package/apps/pwa/out/tasks/index.txt +13 -13
  133. package/apps/pwa/out/term/index.html +1 -1
  134. package/apps/pwa/out/term/index.txt +13 -13
  135. package/apps/pwa/out/today/index.html +1 -1
  136. package/apps/pwa/out/today/index.txt +13 -13
  137. package/apps/pwa/out/trace/index.html +1 -1
  138. package/apps/pwa/out/trace/index.txt +13 -13
  139. package/apps/pwa/out/vault/index.html +1 -1
  140. package/apps/pwa/out/vault/index.txt +13 -13
  141. package/apps/pwa/out/workflows/chat-ui/index.html +1 -1
  142. package/apps/pwa/out/workflows/chat-ui/index.txt +13 -13
  143. package/apps/pwa/out/workflows/index.html +1 -1
  144. package/apps/pwa/out/workflows/index.txt +13 -13
  145. package/apps/pwa/out/workspace/index.html +1 -1
  146. package/apps/pwa/out/workspace/index.txt +13 -13
  147. package/apps/pwa/out/worktrees/index.html +1 -1
  148. package/apps/pwa/out/worktrees/index.txt +13 -13
  149. package/graphs/natural-language-research.yaml +38 -0
  150. package/package.json +1 -1
  151. package/personas/botlab-4.yaml +8 -0
  152. package/src/auto-research/research-turn.ts +120 -5
  153. package/src/cli/intake-source-cli.ts +9 -4
  154. package/src/cli/release-cli.ts +7 -2
  155. package/src/cli/setup-cli.ts +2 -2
  156. package/src/cli/setup-keys.ts +8 -5
  157. package/src/core-turn/run-core-turn.ts +93 -14
  158. package/src/dashboard/first-screen-band.ts +2 -6
  159. package/src/dashboard/index.ts +41 -13
  160. package/src/dashboard/plugin-wizard-runtime.ts +15 -1
  161. package/src/dashboard/plugin-wizard-tool.ts +16 -2
  162. package/src/dashboard/turn-preamble.ts +8 -0
  163. package/src/index.ts +26 -0
  164. package/src/intake-plane/actions.ts +20 -12
  165. package/src/intake-plane/intake-sources.ts +32 -11
  166. package/src/intake-plane/items.ts +1 -1
  167. package/src/mcp/server.ts +7 -2
  168. package/src/native-tool-catalog.ts +3 -0
  169. package/src/nexus/api/harness-traversal.ts +3 -3
  170. package/src/nexus/api/meta-api.ts +3 -1
  171. package/src/nexus/api/research-run-observer.ts +59 -0
  172. package/src/onboarding/first-run-doctor-test-control.ts +42 -0
  173. package/src/onboarding/first-run-doctor.ts +1 -0
  174. package/src/prompt-library/session-guidance.ts +7 -6
  175. package/src/self-implement/run-ledger.ts +1 -1
  176. package/src/self-implement/run-step-projection.ts +10 -2
  177. package/src/session/chat.ts +2 -0
  178. package/src/session-runtime/index.ts +47 -5
  179. package/src/setup/service-key-catalog.ts +4 -2
  180. package/src/setup/service-keys.ts +34 -10
  181. package/src/terminal/coding-agent.ts +12 -1
  182. package/src/tool-hints/gate.ts +7 -3
  183. package/src/tool-hints/signals.ts +43 -1
  184. package/src/tui.ts +97 -4
  185. package/src/ux-sim/classic-tui-seat-scenarios.ts +54 -4
  186. package/src/ux-sim/mock-scenario-catalog.json +8 -3
  187. package/src/version/packed-revision.json +1 -1
  188. package/apps/pwa/out/_next/static/chunks/app/autopilot/page-9d7432ad7cb155ce.js +0 -1
  189. package/apps/pwa/out/_next/static/chunks/app/bots/page-d1cdb65c4ceb5c33.js +0 -1
  190. package/apps/pwa/out/_next/static/chunks/app/control/page-77db1e47b120b94e.js +0 -1
  191. package/apps/pwa/out/_next/static/chunks/app/editor/page-6a36535d413596b1.js +0 -1
  192. package/apps/pwa/out/_next/static/chunks/app/exec/page-8696a777c88bacc2.js +0 -1
  193. package/apps/pwa/out/_next/static/chunks/app/inside/page-ea374796ca2317b9.js +0 -1
  194. package/apps/pwa/out/_next/static/chunks/app/live/page-7645ef6d17d2314b.js +0 -1
  195. package/apps/pwa/out/_next/static/chunks/app/live-run/page-3448160192777209.js +0 -1
  196. package/apps/pwa/out/_next/static/chunks/app/loops/page-e911bcd2bfb5c305.js +0 -1
  197. package/apps/pwa/out/_next/static/chunks/app/market/page-52b55f54c9d8e0fb.js +0 -1
  198. package/apps/pwa/out/_next/static/chunks/app/missions/[id]/page-6a904a7d1b3aee11.js +0 -1
  199. package/apps/pwa/out/_next/static/chunks/app/not-found-3eb72a4f6788a903.js +0 -1
  200. package/apps/pwa/out/_next/static/chunks/app/ops/checklist/page-c9e4ca5025534239.js +0 -1
  201. package/apps/pwa/out/_next/static/chunks/app/ops/release/page-63c8938149254e9d.js +0 -1
  202. package/apps/pwa/out/_next/static/chunks/app/ops/seats/page-f48403ffee4c4b77.js +0 -1
  203. package/apps/pwa/out/_next/static/chunks/app/page-f95beb047d743d09.js +0 -1
  204. package/apps/pwa/out/_next/static/chunks/app/settings/devices/page-73857fa536e7c832.js +0 -1
  205. package/apps/pwa/out/_next/static/chunks/app/settings/page-c0bdee145df0f6c9.js +0 -1
  206. package/apps/pwa/out/_next/static/chunks/app/setup/page-fe67b4e66f496b3a.js +0 -1
  207. package/apps/pwa/out/_next/static/chunks/app/share/page-b8c0c73c2e5a8917.js +0 -1
  208. package/apps/pwa/out/_next/static/chunks/app/showroom/page-2e8ed69b1a70c746.js +0 -1
  209. package/apps/pwa/out/_next/static/chunks/app/today/page-c6b096777f73c43a.js +0 -1
  210. package/apps/pwa/out/_next/static/chunks/app/workflows/chat-ui/page-c54c8b957ebf94e2.js +0 -1
  211. package/apps/pwa/out/_next/static/chunks/app/workflows/page-9dc19aee0932542a.js +0 -1
  212. package/apps/pwa/out/_next/static/chunks/app/worktrees/page-52b36e1c8acd087f.js +0 -1
  213. /package/apps/pwa/out/_next/static/{5URFQKPO21SIgTlLvb1Jv → K-ckEB9hu9tXQ6iqnl27L}/_buildManifest.js +0 -0
  214. /package/apps/pwa/out/_next/static/{5URFQKPO21SIgTlLvb1Jv → K-ckEB9hu9tXQ6iqnl27L}/_ssgManifest.js +0 -0
@@ -25,7 +25,7 @@ import { drainPendingUserInput } from '../session/pending-input.js';
25
25
  import type { StreamWithToolsHandlers } from '../llm.js';
26
26
  import { debug, redactSecretText, withAmbientSessionScope } from '../debug/log.js';
27
27
  import { applyDeferredTools } from '../session-runtime/tier-flip.js';
28
- import { isResearchAgentIntent } from '../tool-hints/signals.js';
28
+ import { isOrderedLinearIssueStep, isOrderedLinearResearchWorkflow, isOrderedNonResearchWorkflow, isResearchAgentIntent } from '../tool-hints/signals.js';
29
29
  import { buildResearchDateSystemMessage, resolveSessionSurfaceProfile } from '../session-runtime/index.js';
30
30
  import { ensureResearchAnswerHasSourceUrl } from '../research/evidence-attribution.js';
31
31
  import {
@@ -167,6 +167,14 @@ export interface RunCoreTurnOptions {
167
167
  timers?: { setTimeout(callback: () => void, delayMs: number): ReturnType<typeof setTimeout>; clearTimeout(handle: ReturnType<typeof setTimeout>): void };
168
168
  firstReplyBudgetMs?: number;
169
169
  researchWallClockBudgetMs?: number;
170
+ /** Injectable lower-level runner for core/live-run integration tests; production uses the lazy-loaded research ladder. */
171
+ researchQuestionLadderRunner?: (
172
+ request: string,
173
+ options: import('../auto-research/research-turn.js').ResearchQuestionLadderRunOptions,
174
+ ) => Promise<import('../auto-research/research-turn.js').ResearchGroundingResult>;
175
+ researchRunObserverFactory?: (
176
+ runId: string,
177
+ ) => import('../nexus/api/research-run-observer.js').ResearchRunObserver;
170
178
  runResearch?: (
171
179
  request: string,
172
180
  signal: AbortSignal,
@@ -320,6 +328,15 @@ export async function runCoreTurn(
320
328
  debug.log('session.link', 'core-turn', { parentSessionId: ctx.originSessionId, childSessionId: ctx.sessionId });
321
329
  });
322
330
  }
331
+ let researchRunObserver: import('../nexus/api/research-run-observer.js').ResearchRunObserver | undefined;
332
+ let researchSynthesisStarted = false;
333
+ let researchSynthesisOutcome = 'failed';
334
+ let researchRunOutcome: 'completed' | 'failed' = 'failed';
335
+ const beginResearchSynthesis = (): void => {
336
+ if (!researchRunObserver || researchSynthesisStarted) return;
337
+ researchSynthesisStarted = true;
338
+ researchRunObserver.event({ type: 'enter', node: 'synthesis' });
339
+ };
323
340
  return withAmbientSessionScope(ctx.sessionId, async () => {
324
341
  if (ctx.signal.aborted) {
325
342
  return { stopReason: 'aborted', finalText: '' };
@@ -336,6 +353,9 @@ export async function runCoreTurn(
336
353
  let researchToolCallCount = 0;
337
354
  let researchAxisCount = 0;
338
355
  let researchStopReason: string | undefined;
356
+ let orderedLinearIssueStep = false;
357
+ let orderedLinearResearchWorkflow = false;
358
+ let releaseOrderedLinearResearch: (() => void) | undefined;
339
359
  const loggedResearchStops = new Set<string>();
340
360
  const logResearchStop = (reason: string, extra: Record<string, unknown> = {}): void => {
341
361
  if (loggedResearchStops.has(reason)) return;
@@ -463,6 +483,7 @@ export async function runCoreTurn(
463
483
  success = true;
464
484
  return result;
465
485
  } finally {
486
+ if (orderedLinearResearchWorkflow && name === 'elanous_linear_issue') releaseOrderedLinearResearch?.();
466
487
  if (name === 'Agent' && enforceResearchToolAllowlist) {
467
488
  debug.log('research.turn', 'subagent-completed', {
468
489
  sessionId: ctx.sessionId,
@@ -542,7 +563,11 @@ export async function runCoreTurn(
542
563
  const surface = ctx.surfaceProfile ?? resolveSessionSurfaceProfile({ userText: surfaceUserText });
543
564
  // Use the shared #31663 research-intent verdict. Surface labels are a
544
565
  // presentation/routing result and may remain `chat` for a research turn.
545
- const researchTurn = isResearchAgentIntent(surfaceUserText);
566
+ orderedLinearIssueStep = isOrderedLinearIssueStep(surfaceUserText)
567
+ && ctx.tools.some((tool) => tool.name === 'elanous_linear_issue');
568
+ orderedLinearResearchWorkflow = orderedLinearIssueStep && isOrderedLinearResearchWorkflow(surfaceUserText);
569
+ const researchTurn = isResearchAgentIntent(surfaceUserText)
570
+ && (!isOrderedNonResearchWorkflow(surfaceUserText) || orderedLinearResearchWorkflow);
546
571
  const { selectDeepBloom } = await import('./deep-turn-bloom.js');
547
572
  const deepBloomDecision = selectDeepBloom(surfaceUserText, {
548
573
  researchIntent: researchTurn,
@@ -565,7 +590,8 @@ export async function runCoreTurn(
565
590
  const namedSkillRequest = requestsNamedSkill(surfaceUserText, installedSkillNames);
566
591
  // A named skill only skips the research prepass when its executor is active.
567
592
  const explicitSkillToolRequest = namedSkillRequest
568
- && tieredTools.some((tool) => tool.name === 'skill_exec');
593
+ && tieredTools.some((tool) => tool.name === 'skill_exec')
594
+ && !orderedLinearResearchWorkflow;
569
595
  const constrainDeepNonResearchTools = deepBloomDecision.apply && !researchTurn;
570
596
  // ToolSearch routes against the surface's full live pool, so hiding a tool
571
597
  // from the model alone is insufficient. Remove the summoner from the
@@ -586,12 +612,17 @@ export async function runCoreTurn(
586
612
  });
587
613
  }
588
614
  enforceResearchToolBudget = researchTurn;
589
- enforceResearchToolAllowlist = researchTurn && !namedSkillRequest;
615
+ enforceResearchToolAllowlist = researchTurn && !namedSkillRequest && !orderedLinearIssueStep;
590
616
  enforceResearchDocumentWrite = enforceResearchToolAllowlist && requestsResearchDocumentWrite(surfaceUserText);
591
617
  // Codex Responses only supports tool_choice="required" (not a named
592
618
  // function choice). Make the first request deterministic by exposing only
593
619
  // skill_exec there; streamLLMWithTools restores the full pool on later turns.
594
- const routedSkillTools = explicitSkillToolRequest
620
+ const routedLinearTool = orderedLinearIssueStep
621
+ ? bloomFilteredTools.find((tool) => tool.name === 'elanous_linear_issue')
622
+ : undefined;
623
+ const routedSkillTools = routedLinearTool
624
+ ? [routedLinearTool]
625
+ : explicitSkillToolRequest
595
626
  ? bloomFilteredTools.filter((tool) => tool.name === 'skill_exec')
596
627
  : [];
597
628
  const tools = enforceResearchToolAllowlist
@@ -599,6 +630,11 @@ export async function runCoreTurn(
599
630
  : bloomFilteredTools;
600
631
  // Preserve the ordinary pool if a later filter removes the executor.
601
632
  const firstTurnTools = routedSkillTools.length > 0 ? routedSkillTools : undefined;
633
+ // Keep the forced first-turn target in the model-visible pool too. The
634
+ // research allowlist and toolChoice must never describe different sets.
635
+ const turnTools = firstTurnTools
636
+ ? [...firstTurnTools, ...tools.filter((tool) => !firstTurnTools.some((first) => first.name === tool.name))]
637
+ : tools;
602
638
  const maxToolTurns = researchTurn
603
639
  ? Math.min(ctx.maxToolTurns ?? RESEARCH_TURN_MAX_TOOL_TURNS, RESEARCH_TURN_MAX_TOOL_TURNS)
604
640
  : ctx.maxToolTurns;
@@ -678,6 +714,9 @@ export async function runCoreTurn(
678
714
  try { ctx.callbacks?.onStatus?.(plan); } catch { /* UI feedback is fail-soft. */ }
679
715
  }
680
716
  if (researchTurn && surfaceUserText?.trim() && !explicitSkillToolRequest) {
717
+ const orderedResearchGate = orderedLinearResearchWorkflow
718
+ ? new Promise<void>((resolve) => { releaseOrderedLinearResearch = resolve; })
719
+ : undefined;
681
720
  turnStartedAt = now();
682
721
  researchStartedAt = turnStartedAt;
683
722
  debug.log('research.turn', 'tui-research-started', {
@@ -714,16 +753,38 @@ export async function runCoreTurn(
714
753
  }
715
754
  researchResultPromise = (async () => {
716
755
  try {
756
+ if (orderedResearchGate) {
757
+ await Promise.race([orderedResearchGate, new Promise<void>((resolve) => {
758
+ researchController.signal.addEventListener('abort', () => resolve(), { once: true });
759
+ })]);
760
+ if (researchController.signal.aborted) return null;
761
+ }
762
+ if (!options.runResearch && ctx.runId) {
763
+ try {
764
+ researchRunObserver = options.researchRunObserverFactory
765
+ ? options.researchRunObserverFactory(ctx.runId)
766
+ : (await import('../nexus/api/research-run-observer.js')).registerResearchRun(ctx.runId);
767
+ }
768
+ catch (error) {
769
+ debug.log('research.turn', 'nexus-run-registration-failed', {
770
+ runId: ctx.runId, reason: error instanceof Error ? error.message : String(error),
771
+ }, { level: 'warn' });
772
+ }
773
+ }
717
774
  const work = (options.runResearch ?? (async (request, signal, admitToolCall, providerRouting) => {
718
775
  // Keep the Bloom/skill pipeline out of ordinary and packaged TUI startup graphs.
719
776
  const { researchTurnForGrounding, runResearchQuestionLadder } = await import('../auto-research/research-turn.js');
720
- return researchTurnForGrounding(await runResearchQuestionLadder(request, {
777
+ const researchOptions = {
721
778
  ...providerRouting,
779
+ ...(ctx.runId ? { runId: ctx.runId } : {}),
780
+ onGraphEvent: researchRunObserver?.event,
722
781
  signal, admitToolCall, allowPartialOnAbort: true, allowOutputSkill: false,
723
782
  deadlineMs: deepBloomDecision.apply
724
783
  ? RESEARCH_TURN_FINAL_ANSWER_DEADLINE_MS
725
784
  : Math.min(RESEARCH_TURN_SHALLOW_FINAL_ANSWER_DEADLINE_MS, Math.max(1, researchWallClockBudgetMs - 1)),
726
- }));
785
+ } satisfies import('../auto-research/research-turn.js').ResearchQuestionLadderRunOptions;
786
+ if (options.researchQuestionLadderRunner) return options.researchQuestionLadderRunner(request, researchOptions);
787
+ return researchTurnForGrounding(await runResearchQuestionLadder(request, researchOptions));
727
788
  }))(surfaceUserText, researchController.signal, admitResearchToolCall, {
728
789
  ...(ctx.initialProvider ? { initialProvider: ctx.initialProvider } : {}),
729
790
  ...(ctx.skipProviders ? { skipProviders: ctx.skipProviders } : {}),
@@ -761,11 +822,11 @@ export async function runCoreTurn(
761
822
  }
762
823
  })();
763
824
  }
764
- const streamOptions = (turnTools: typeof tools, signal: AbortSignal = ctx.signal) => ({
765
- tools: turnTools,
825
+ const streamOptions = (availableTools: typeof tools, signal: AbortSignal = ctx.signal) => ({
826
+ tools: availableTools,
766
827
  ...(firstTurnTools ? { firstTurnTools } : {}),
767
828
  researchTurn,
768
- ...(firstTurnTools ? { toolChoice: { name: 'skill_exec' } } : {}),
829
+ ...(firstTurnTools?.[0] ? { toolChoice: { name: firstTurnTools[0].name } } : {}),
769
830
  signal,
770
831
  ...(ctx.requestSizeGuard ? { requestSizeGuard: ctx.requestSizeGuard } : {}),
771
832
  ...(ctx.reasoningEffort !== undefined ? { reasoningEffort: ctx.reasoningEffort } : {}),
@@ -865,7 +926,7 @@ export async function runCoreTurn(
865
926
  firstReplyTimer = timers.setTimeout(() => resolve({ timedOut: true }), firstReplyBudgetMs);
866
927
  });
867
928
  try {
868
- const firstPass = streamLLMWithTools(firstPassMessages, firstPassHandlers, streamOptions(tools, firstPassController.signal))
929
+ const firstPass = streamLLMWithTools(firstPassMessages, firstPassHandlers, streamOptions(turnTools, firstPassController.signal))
869
930
  .then(text => ({ timedOut: false as const, text }));
870
931
  const outcome = await Promise.race([firstPass, deadline]);
871
932
  if (outcome.timedOut) {
@@ -884,7 +945,7 @@ export async function runCoreTurn(
884
945
  ctx.signal.removeEventListener('abort', abortFirstPassFromParent);
885
946
  }
886
947
  } else {
887
- finalText = await streamLLMWithTools(firstPassMessages, firstPassHandlers, streamOptions(tools));
948
+ finalText = await streamLLMWithTools(firstPassMessages, firstPassHandlers, streamOptions(turnTools));
888
949
  }
889
950
  if (researchResultPromise && firstPassStartedAt !== undefined) {
890
951
  debug.log('research.turn', 'first-pass-answer-ready', {
@@ -911,6 +972,7 @@ export async function runCoreTurn(
911
972
  commitProvisionalTurn(provisionalTurnMessages, handlers, value => { finalPhaseAnswer = value; });
912
973
  return { stopReason: 'aborted', finalText };
913
974
  }
975
+ beginResearchSynthesis();
914
976
  const forcedSynthesis = researchStopReason === 'wall-clock-budget' || researchStopReason === 'tool-budget';
915
977
  const hasUsableResearch = Boolean(result?.output.trim())
916
978
  && (result?.ok === true || result?.error === RESEARCH_TURN_DEADLINE_STOP_ERROR);
@@ -947,6 +1009,8 @@ export async function runCoreTurn(
947
1009
  }
948
1010
  finalText = ensureResearchAnswerHasSourceUrl(synthesizedText || staged.text() || provisionalText, result.sourceUrls ?? []);
949
1011
  accumulatedText = finalText;
1012
+ researchSynthesisOutcome = 'ok';
1013
+ if (result.ok) researchRunOutcome = 'completed';
950
1014
  debug.log('research.turn', 'synthesis-completed', {
951
1015
  sessionId: ctx.sessionId,
952
1016
  elapsedMs: now() - synthesisStartedAt,
@@ -959,14 +1023,16 @@ export async function runCoreTurn(
959
1023
  } catch (error) {
960
1024
  commitProvisionalTurn(provisionalTurnMessages, handlers, value => { finalPhaseAnswer = value; });
961
1025
  const stopReason = classifyStopReason(error, ctx.signal);
962
- if (stopReason === 'aborted') return { stopReason, finalText: provisionalText };
1026
+ if (stopReason === 'aborted') { researchSynthesisOutcome = 'aborted'; researchRunOutcome = 'failed'; return { stopReason, finalText: provisionalText }; }
963
1027
  if (stopReason === 'auth_rejected') {
1028
+ researchSynthesisOutcome = 'failed'; researchRunOutcome = 'failed';
964
1029
  return {
965
1030
  stopReason,
966
1031
  finalText: provisionalText,
967
1032
  errorMessage: redactSecretText(error instanceof Error ? error.message : String(error)),
968
1033
  };
969
1034
  }
1035
+ researchSynthesisOutcome = 'fallback';
970
1036
  try { ctx.callbacks?.onStatus?.('근거 반영에 실패해 첫 답변을 유지합니다.'); } catch { /* UI feedback is fail-soft. */ }
971
1037
  return { stopReason: 'end_turn', finalText: provisionalText, ...(handlers.onTurnComplete ? { finalPhaseAnswer } : {}) };
972
1038
  }
@@ -993,19 +1059,23 @@ export async function runCoreTurn(
993
1059
  }
994
1060
  finalText = ensureResearchAnswerHasSourceUrl(fallbackText || staged.text() || provisionalText, result?.sourceUrls ?? []);
995
1061
  accumulatedText = finalText;
1062
+ researchSynthesisOutcome = 'ok';
1063
+ if (result?.ok) researchRunOutcome = 'completed';
996
1064
  commitSynthesizedTurn(staged, provisionalTurnMessages, handlers, finalText, provisionalText,
997
1065
  value => { finalPhaseAnswer = value; }, ctx.callbacks?.onReplaceText);
998
1066
  } catch (error) {
999
1067
  commitProvisionalTurn(provisionalTurnMessages, handlers, value => { finalPhaseAnswer = value; });
1000
1068
  const stopReason = classifyStopReason(error, ctx.signal);
1001
- if (stopReason === 'aborted') return { stopReason, finalText: provisionalText };
1069
+ if (stopReason === 'aborted') { researchSynthesisOutcome = 'aborted'; researchRunOutcome = 'failed'; return { stopReason, finalText: provisionalText }; }
1002
1070
  if (stopReason === 'auth_rejected') {
1071
+ researchSynthesisOutcome = 'failed'; researchRunOutcome = 'failed';
1003
1072
  return {
1004
1073
  stopReason,
1005
1074
  finalText: provisionalText,
1006
1075
  errorMessage: redactSecretText(error instanceof Error ? error.message : String(error)),
1007
1076
  };
1008
1077
  }
1078
+ researchSynthesisOutcome = 'fallback';
1009
1079
  try { ctx.callbacks?.onStatus?.('도구 fallback이 실패해 첫 답변을 유지합니다.'); } catch { /* UI feedback is fail-soft. */ }
1010
1080
  return { stopReason: 'end_turn', finalText: provisionalText, ...(handlers.onTurnComplete ? { finalPhaseAnswer } : {}) };
1011
1081
  }
@@ -1013,6 +1083,8 @@ export async function runCoreTurn(
1013
1083
  const lastAssistant = [...provisionalTurnMessages].reverse().find(message => message.role === 'assistant');
1014
1084
  finalPhaseAnswer = lastAssistant?.phase === 'final_answer';
1015
1085
  ctx.callbacks.onTurnComplete(provisionalTurnMessages);
1086
+ researchSynthesisOutcome = 'ok';
1087
+ if (result?.ok) researchRunOutcome = 'completed';
1016
1088
  }
1017
1089
  }
1018
1090
  try {
@@ -1030,6 +1102,7 @@ export async function runCoreTurn(
1030
1102
  };
1031
1103
  } catch (err) {
1032
1104
  const stopReason = classifyStopReason(err, ctx.signal);
1105
+ researchRunOutcome = stopReason === 'end_turn' ? researchRunOutcome : 'failed';
1033
1106
  if (stopReason === 'aborted') {
1034
1107
  return { stopReason, finalText: accumulatedText };
1035
1108
  }
@@ -1041,6 +1114,12 @@ export async function runCoreTurn(
1041
1114
  };
1042
1115
  }
1043
1116
  throw err;
1117
+ } finally {
1118
+ if (ctx.signal.aborted) researchRunOutcome = 'failed';
1119
+ if (researchRunObserver) {
1120
+ if (researchSynthesisStarted) researchRunObserver.event({ type: 'exit', node: 'synthesis', outcome: researchSynthesisOutcome });
1121
+ researchRunObserver.finish(researchRunOutcome);
1122
+ }
1044
1123
  }
1045
1124
  });
1046
1125
  }
@@ -207,12 +207,8 @@ export function buildFirstScreenBand(input: FirstScreenBandInput): string[] {
207
207
  if (link.status === 'error') {
208
208
  return linkKorean ? `elanous | 데몬: ${link.stage} 조회 오류` : `elanous | daemon: ${link.stage} lookup error`;
209
209
  }
210
- const bare = linkKorean
211
- ? `elanous | 데몬: ${link.status === 'absent' ? '없음' : '응답 없음'}`
212
- : `elanous | daemon: ${link.status === 'absent' ? 'absent' : 'unhealthy'}`;
213
- if (!link.startCommand || CONTROL_CHARS.test(link.startCommand)) return bare;
214
- const line = `${bare} · ${linkKorean ? '시작' : 'start'}: ${link.startCommand}`;
215
- return cellWidth(line) <= width ? line : bare;
210
+ // Startup commands are operator detail. Keep the first screen focused on the user's next step.
211
+ return linkKorean ? '웹 화면을 여는 중…' : 'Opening web setup…';
216
212
  })();
217
213
 
218
214
  const hintLine = 'Type a message to begin | /help for commands';
@@ -14,6 +14,7 @@ import { spawn, spawnSync } from 'node:child_process';
14
14
  import { $ } from 'bun';
15
15
  import { LOCAL_SKILLS_DIR, DATA_DIR, OBSIDIAN_VAULT } from '../config.js';
16
16
  import { dispatchDashboardSessionRuntimeTool } from './session-runtime-dispatch.js';
17
+ import { dispatchToolSearch } from '../skills/tools/tool-search.js';
17
18
  import { nextChatScrollOffset } from '../chat/log-scroll-key.js';
18
19
  import { suggestProjectForFolder } from '../project/project-store.js';
19
20
  import { createProjectSuggester } from '../project/project-suggestion.js';
@@ -975,11 +976,13 @@ import { createDashboardTerminalPopupRuntime } from './terminal-popup-runtime.js
975
976
  import { createDashboardSidetabRuntime, mergeLocalAgentSessions, runDashboardAgentMission } from './sidetab-runtime.js';
976
977
  import { visibleMissionFailureLogData } from './visible-mission-diagnostics.js';
977
978
  import { CLASSIC_SIDETAB_MISSION_TOOL_NAME, createClassicSidetabMissionIntegration, createClassicSidetabMissionPairSessionRegistry, type ClassicSidetabHandReplyInput, type ClassicSidetabMissionAgent, type ClassicSidetabMissionDispatchContext, type ClassicSidetabMissionIntegration, type ClassicSidetabMissionPairResult, type ClassicSidetabMissionResult, type ClassicSidetabMissionTrioResult } from './classic-sidetab-mission.js';
979
+ import type { ClassicSidetabMissionPairCompletionResult } from './classic-sidetab-mission-job.js';
980
+ import type { HandTaskOptions } from '../task-agent/task-hand.js';
978
981
  import { cancelClassicMissionCli, startClassicMissionCli } from './mission-cli-consumer.js';
979
982
  import { enqueueClassicSidetabMissionCompletion, runPreparedClassicSidetabVisibleMission } from './classic-sidetab-mission-job.js';
980
983
  import { startClassicSidetabMissionPair } from './classic-sidetab-mission-pair.js';
981
984
  import { captureClassicMissionExitObservation, createClassicSidetabMissionTrioVisibleRunner, startClassicSidetabMissionTrio } from './classic-sidetab-mission-trio.js';
982
- import { createDashboardPluginWizardRuntimeFromSidetab } from './plugin-wizard-runtime.js';
985
+ import { createDashboardPluginWizardRuntimeFromSidetab, searchAvailablePluginWizardTools } from './plugin-wizard-runtime.js';
983
986
 
984
987
  /** Public dashboard composition seam used by the TUI entrypoint and its integration test. */
985
988
  export const createDashboardTuiPluginWizard = createDashboardPluginWizardRuntimeFromSidetab;
@@ -1646,6 +1649,16 @@ export interface ShowDashboardOptions {
1646
1649
  * effect in in-process mode (use TUI's `/session load` for that
1647
1650
  * path). */
1648
1651
  resumeSessionId?: string;
1652
+ /** Internal integration-test seam. Exercises showDashboard boot and the registered RunSidetabMission dispatcher
1653
+ * while replacing only visible child-process execution and the downstream task hand. Never set by the CLI. */
1654
+ pluginWizardTestOverrides?: {
1655
+ findAvailableTools?: (capability: string) => readonly string[];
1656
+ runPair: (agent: 'codex' | 'claude', mission: string, parallelMission: string, context?: ClassicSidetabMissionDispatchContext) => Promise<{
1657
+ result: ClassicSidetabMissionPairResult;
1658
+ completion: Promise<ClassicSidetabMissionPairCompletionResult>;
1659
+ }>;
1660
+ taskHand: (options: HandTaskOptions) => Promise<unknown>;
1661
+ };
1649
1662
  }
1650
1663
 
1651
1664
  // FileIndex cache keyed by absolute cwd. A single elanous session can
@@ -1711,6 +1724,7 @@ export function renderDashboardCoordinatorModalOverlay(display: Pick<DisplayCoor
1711
1724
  * 그 값을 쓰고, 아니면 **프롬프트 caret** 을 쓴다. 프롬프트가 감춰졌으면 숨긴다. */
1712
1725
  export interface DashboardFrameInput {
1713
1726
  overlay: string;
1727
+ preserveBounds?: { row: number; col: number; width: number; height: number };
1714
1728
  force: boolean;
1715
1729
  /** ⭐ Z축이 **실제로 누구에게** 커서를 준 결정. essential 은 `modal`·`terminal` 일 때만
1716
1730
  * 그 값에 양보한다 — `coordinator` fallback 은 소유자가 없다는 뜻이지 claim 이 아니다. */
@@ -1765,6 +1779,7 @@ export function renderDashboardFrame(
1765
1779
  });
1766
1780
  renderFrame(lines, {
1767
1781
  overlay: input.overlay,
1782
+ preserveBounds: input.preserveBounds,
1768
1783
  force: input.force,
1769
1784
  cursor: paintCursor(essentialDecision.cursor ?? input.coordinatorCursor ?? null),
1770
1785
  onWriteComplete: input.onFrameWriteComplete,
@@ -1783,9 +1798,15 @@ export function composeDashboardFrameWithCoordinatorModal(
1783
1798
  display: Pick<DisplayCoordinator, 'snapshot'>,
1784
1799
  input: DashboardFrameInput,
1785
1800
  ): DashboardFrameInput {
1801
+ const snapshot = display.snapshot();
1802
+ const modal = topModalSurface({
1803
+ focusStack: snapshot.focus.stack,
1804
+ surfaceAt: (id) => snapshot.surfaces.get(id) ?? null,
1805
+ });
1786
1806
  return {
1787
1807
  ...input,
1788
- overlay: input.overlay + renderDashboardCoordinatorModalOverlay(display),
1808
+ overlay: input.overlay + renderDashboardCoordinatorModalOverlay({ snapshot: () => snapshot }),
1809
+ ...(modal ? { preserveBounds: modal.bounds } : {}),
1789
1810
  };
1790
1811
  }
1791
1812
 
@@ -4375,20 +4396,12 @@ Mode- and sync-specific instructions are injected per-turn when relevant — do
4375
4396
 
4376
4397
  // AU7 — seed the prompt bank with the three default fragments
4377
4398
  // (ambiguous / destructive / multi-file). Idempotent: re-boot
4378
- // refreshes content in place, doesn't duplicate. Silent on a
4379
- // clean run; one muted chat line when something was created /
4380
- // updated so the user knows their prompt bank gained shipped
4381
- // fragments.
4399
+ // refreshes content in place, doesn't duplicate. Internal seed details belong in debug.log,
4400
+ // never in the user's conversation transcript.
4382
4401
  try {
4383
4402
  const { seedAu7Fragments } = await import('../prompt-bank/index.js');
4384
4403
  const seedRes = seedAu7Fragments(getPromptBankStore());
4385
- if (seedRes.created > 0 || seedRes.updated > 0) {
4386
- const parts: string[] = [];
4387
- if (seedRes.created > 0) parts.push(`${seedRes.created} created`);
4388
- if (seedRes.updated > 0) parts.push(`${seedRes.updated} updated`);
4389
- chatLines.push(C.muted(` [prompt-bank] AU7 fragments: ${parts.join(', ')}`));
4390
- chatScrollOffset = -1;
4391
- }
4404
+ debug.log('dashboard.prompt-bank', 'seeded', { created: seedRes.created, updated: seedRes.updated });
4392
4405
  } catch { /* non-fatal — prompt bank may be disabled / locked */ }
4393
4406
 
4394
4407
  // Periodic dirty refresh — every 5s the pill picks up any
@@ -13996,6 +14009,14 @@ Mode- and sync-specific instructions are injected per-turn when relevant — do
13996
14009
  content: 'Independent sidetab job started; this conversation can continue.',
13997
14010
  };
13998
14011
  }, cancelClassicSidetabMission, async (agent, mission, parallelMission, context) => {
14012
+ const testPair = opts.pluginWizardTestOverrides?.runPair;
14013
+ if (testPair) {
14014
+ const started = await testPair(agent, mission, parallelMission, context);
14015
+ if (context?.callId?.startsWith('plugin-wizard:')) {
14016
+ pluginWizardPairCompletions.set(context.callId, started.completion);
14017
+ }
14018
+ return started.result;
14019
+ }
13999
14020
  for (const member of ['codex', 'claude'] as const) {
14000
14021
  const prepared = await prepareClassicSidetabAgentCli(member);
14001
14022
  if (!prepared.ready) {
@@ -14181,6 +14202,13 @@ Mode- and sync-specific instructions are injected per-turn when relevant — do
14181
14202
  });
14182
14203
  const tuiPluginWizard = createDashboardTuiPluginWizard(classicSidetabMission, pluginWizardPairCompletions, {
14183
14204
  getWorkspace: () => getSessionCwd(),
14205
+ findAvailableTools: opts.pluginWizardTestOverrides?.findAvailableTools ?? ((capability) => {
14206
+ const runtimeSpecs = acpToolRuntime?.listToolRuntimes('tui').map(runtime => runtime.spec) ?? [];
14207
+ const hostSpecs = pluginHost.hostLLMTools();
14208
+ return searchAvailablePluginWizardTools(capability, [...new Map([...runtimeSpecs, ...hostSpecs]
14209
+ .map(spec => [spec.name, spec] as const)).values()]);
14210
+ }),
14211
+ ...(opts.pluginWizardTestOverrides ? { taskHand: opts.pluginWizardTestOverrides.taskHand } : {}),
14184
14212
  });
14185
14213
  disposeClassicSigquit = registerClassicSigquitHandler(() => {
14186
14214
  classicSidetabRuntime.beginPrefix();
@@ -9,7 +9,20 @@ import type { ClassicSidetabMissionPairCompletionResult } from './classic-sideta
9
9
  import type { PluginMaker, PluginWizardDeps, PluginWizardPairDecomposition } from '../graph-wizard/mission-compose.js';
10
10
  import { createTuiPluginWizardTool, type TuiPluginWizardTool } from './plugin-wizard-tool.js';
11
11
  import type { TuiPluginWizardRequest } from './plugin-wizard-tool.js';
12
+ import { dispatchToolSearch } from '../skills/tools/tool-search.js';
13
+ import { filterAvailableToolSpecs } from '../session-runtime/index.js';
14
+ import type { LLMToolSpec } from '../llm.js';
12
15
 
16
+ /** Search only the tools that pass the session runtime's availability guard. */
17
+ export function searchAvailablePluginWizardTools(
18
+ capability: string,
19
+ specs: readonly LLMToolSpec[],
20
+ toolAvailability?: Readonly<Record<string, boolean>>,
21
+ ): string[] {
22
+ const searchable = filterAvailableToolSpecs(specs, toolAvailability)
23
+ .filter(spec => spec.name !== 'ToolSearch' && spec.name !== 'StartPluginWizard');
24
+ return dispatchToolSearch({ query: capability, max_results: 25 }, { specs: searchable }).matched;
25
+ }
13
26
  export interface DashboardPluginWizardRuntimePorts {
14
27
  pair: {
15
28
  dispatchTool: ClassicSidetabMissionIntegration['dispatchTool'];
@@ -19,6 +32,7 @@ export interface DashboardPluginWizardRuntimePorts {
19
32
  taskHand?: (options: HandTaskOptions) => Promise<unknown>;
20
33
  launcher?: HandTaskOptions['launcher'];
21
34
  onEvent?: PluginWizardDeps['onEvent'];
35
+ findAvailableTools?: (capability: string) => readonly string[];
22
36
  }
23
37
 
24
38
  type PluginWizardPairRequest = {
@@ -81,7 +95,7 @@ export function createDashboardPluginWizardRuntime(ports: DashboardPluginWizardR
81
95
  },
82
96
  pluginWizardDeps,
83
97
  });
84
- });
98
+ }, { findAvailableTools: ports.findAvailableTools });
85
99
  }
86
100
 
87
101
  /** Build the dashboard wizard with the same classic sidetab wiring used by the TUI entrypoint. */
@@ -17,11 +17,21 @@ export interface TuiPluginWizardTool {
17
17
  dispatchTool(name: string, args: unknown, context?: ClassicSidetabMissionDispatchContext): Promise<unknown> | undefined;
18
18
  }
19
19
 
20
+ export interface TuiPluginWizardToolOptions {
21
+ createId?: () => string;
22
+ findAvailableTools?: (capability: string) => readonly string[];
23
+ }
24
+
20
25
  /** Add a non-blocking TUI entry point; the injected host runs the shared task/plugin-wizard path. */
21
- export function createTuiPluginWizardTool(start: (request: TuiPluginWizardRequest) => Promise<void>, createId: () => string = randomUUID): TuiPluginWizardTool {
26
+ export function createTuiPluginWizardTool(
27
+ start: (request: TuiPluginWizardRequest) => Promise<void>,
28
+ createIdOrOptions: (() => string) | TuiPluginWizardToolOptions = randomUUID,
29
+ ): TuiPluginWizardTool {
30
+ const createId = typeof createIdOrOptions === 'function' ? createIdOrOptions : createIdOrOptions.createId ?? randomUUID;
31
+ const findAvailableTools = typeof createIdOrOptions === 'function' ? undefined : createIdOrOptions.findAvailableTools;
22
32
  const spec: LLMToolSpec = {
23
33
  name: TUI_PLUGIN_WIZARD_TOOL_NAME,
24
- description: 'When a needed capability is missing, start the plugin wizard in this TUI session. It asks a short question, searches trusted plugins, and if needed launches the visible Codex and Claude side-tab pair. Returns a run ID immediately; check the task notification for completion.',
34
+ description: 'Only when ToolSearch confirms no available tool can perform the requested capability, start the plugin wizard in this TUI session. If a matching tool is found, call that tool instead. The wizard asks a short question, searches trusted plugins, and if needed launches the visible Codex and Claude side-tab pair. Returns a run ID immediately; check the task notification for completion.',
25
35
  parameters: {
26
36
  type: 'object',
27
37
  properties: {
@@ -44,6 +54,10 @@ export function createTuiPluginWizardTool(start: (request: TuiPluginWizardReques
44
54
  const mission = typeof input.mission === 'string' ? input.mission.trim() : '';
45
55
  const missing = typeof input.missing === 'string' ? input.missing.trim() : '';
46
56
  if (!mission || !missing) return Promise.resolve(output('error', 'mission and missing capability are required'));
57
+ const matches = findAvailableTools?.(missing) ?? [];
58
+ if (matches.length > 0) {
59
+ return Promise.resolve(output('error', `Plugin wizard was not started: ToolSearch found matching available tool(s): ${matches.join(', ')}. Call a matching tool directly to complete the request.`));
60
+ }
47
61
  const runId = createId();
48
62
  void Promise.resolve().then(() => start({ runId, mission, missing, ...(context ? { context } : {}) })).catch((error) => {
49
63
  try { debug.log('plugin-wizard.tool', 'start-failed', { runId, reason: error instanceof Error ? error.message : String(error) }, { level: 'error' }); }
@@ -47,6 +47,9 @@ import { effectiveInstanceRoot, prodInstanceRoot } from '../instance/resolve.js'
47
47
  import { buildSelfHealthLine, type InstalledRecord, type SelfHealthErrors } from '../pty-shell/tui-run-state.js';
48
48
  import type { PtyBuildIdentity } from '../pty-shell/pty-manifest.js';
49
49
 
50
+ const TUI_INTEGRATION_TOOL_SELECTION_GUIDANCE =
51
+ 'For one explicit action in an external service, choose the narrow direct-action integration tool over any secretary or multi-step workflow tool. Use a secretary or workflow tool only when the user asks for its multi-step workflow. If no matching integration tool is active, use `ToolSearch` before inspecting local plugin, config, or CLI files. When ToolSearch finds a matching tool, call it directly. Start `StartPluginWizard` only after ToolSearch finds no matching tool for the requested capability.';
52
+
50
53
  type UserConfig = ReturnType<typeof getUserConfig>;
51
54
 
52
55
  export interface DashboardTurnPreambleContext {
@@ -326,6 +329,7 @@ function buildDashboardTurnPreambleUnmeasured(
326
329
  const preamble: LLMMessage[] = [
327
330
  ...skillCatalogSystemMsgs,
328
331
  ...universalPreamble,
332
+ { role: 'system', content: TUI_INTEGRATION_TOOL_SELECTION_GUIDANCE },
329
333
  ...markCacheVolatile([
330
334
  ...seatBootSystemMsgs,
331
335
  ...planModeSystemMsgs,
@@ -340,6 +344,10 @@ function buildDashboardTurnPreambleUnmeasured(
340
344
  ...controllerSystemMsgs,
341
345
  ...implDisciplineSystemMsgs,
342
346
  ...concisenessSystemMsgs,
347
+ {
348
+ role: 'system' as const,
349
+ content: '## Response language\nAnswer entirely in the primary natural language of the user’s latest message. Determine it from the user’s grammar and request, not from quoted text, proper nouns, or isolated foreign words. For a Korean request containing Japanese or other foreign text, answer in Korean. Preserve foreign names, quotes, and tool names as written without switching the response language.',
350
+ },
343
351
  ]),
344
352
  ];
345
353
  // Capture exactly what the ACP path's getPreamble emits so we can
package/src/index.ts CHANGED
@@ -11564,6 +11564,23 @@ const nexusPwaCmd = nexusCmd
11564
11564
  .command('pwa')
11565
11565
  .description('PWA operational helpers — stop / show / global / share / restart / dev. (start/test/build are deprecated → use `nexus run` / `nexus run --test` / `nexus build`.)');
11566
11566
 
11567
+ nexusPwaCmd
11568
+ .command('connect-link')
11569
+ .description('Issue a one-use 10-minute link to connect a remote PWA device.')
11570
+ .action(async () => {
11571
+ const { runNexusShow } = await import('./cli/nexus-show.js');
11572
+ const shown = await runNexusShow({ format: 'json', out: { log: () => {}, error: () => {} } });
11573
+ const pwaUrl = shown.urls?.pwa.tailnet;
11574
+ if (!pwaUrl) {
11575
+ console.error('elanous nexus pwa connect-link: 원격 접속 URL이 없습니다. nexus pwa share enable 후 다시 시도하세요.');
11576
+ process.exit(1);
11577
+ }
11578
+ const { issueSetupLinkToken } = await import('./auth/setup-link-tokens.js');
11579
+ const { token } = issueSetupLinkToken();
11580
+ const base = pwaUrl.replace(/\/app\/?$/, '').replace(/\/$/, '');
11581
+ console.log(`${base}/app/live-run#t=${encodeURIComponent(token)}`);
11582
+ });
11583
+
11567
11584
  // Deprecation forward: `nexus pwa build` → `nexus build`.
11568
11585
  nexusPwaCmd
11569
11586
  .command('build')
@@ -13308,6 +13325,15 @@ async function defaultTuiSelfRestartSpawn(command: string, argv: readonly string
13308
13325
  * 회귀 방어 = `src/cli-entry.test.ts`(실물 `bin/elanous.mjs` 를 spawn 한다).
13309
13326
  */
13310
13327
  export function runCli(): void {
13328
+ if (process.env.NODE_ENV === 'test' && process.env.ELANOUS_TEST_FIRSTRUN_DOCTOR_PROBE === '1') {
13329
+ void import('./onboarding/first-run-doctor-test-control.js').then(({ runFirstRunDoctorTestControl }) => {
13330
+ runFirstRunDoctorTestControl();
13331
+ }).catch((error) => {
13332
+ console.error(error instanceof Error ? error.message : String(error));
13333
+ process.exit(1);
13334
+ });
13335
+ return;
13336
+ }
13311
13337
  main().catch(async (err) => {
13312
13338
  closeTui();
13313
13339
  if (isCliUserError(err)) {
@@ -96,6 +96,13 @@ export function isDecisionImpactingTopicEvidence(items: readonly BriefItem[]): b
96
96
  return items.some(item => decisionTerms.test(item.text));
97
97
  }
98
98
 
99
+ function formatRelatedIssueBriefing(input: { linearIssueId: string; issueLabel?: string; summary: string; items: readonly BriefItem[] }): string {
100
+ const related = input.items.filter(item => item.linearIssueId?.toLowerCase() === input.linearIssueId.toLowerCase());
101
+ if (related.length === 0) return '';
102
+ const sources = related.map(item => item.evidence).filter((url): url is string => !!url);
103
+ return `관련 이슈: ${input.issueLabel?.trim() || input.linearIssueId}\n\n${input.summary.trim()}${sources.length ? `\n\n출처\n${sources.map(url => `- ${url}`).join('\n')}` : ''}`;
104
+ }
105
+
99
106
  /** Project only issue-linked findings; scheduled callers may invoke this after every run, including after Done. */
100
107
  export async function deliverTopicBriefing(input: {
101
108
  linearIssueId: string;
@@ -105,15 +112,14 @@ export async function deliverTopicBriefing(input: {
105
112
  }, deps: TopicBriefingDeliveryDeps): Promise<{ related: number; reopened: boolean }> {
106
113
  const related = input.items.filter(item => item.linearIssueId?.toLowerCase() === input.linearIssueId.toLowerCase());
107
114
  if (related.length === 0) return { related: 0, reopened: false };
108
- const sources = related.map(item => item.evidence).filter((url): url is string => !!url);
109
- const text = `관련 이슈 · ${input.issueLabel?.trim() || input.linearIssueId}\n\n${input.summary.trim()}${sources.length ? `\n\n출처\n${sources.map(url => `- ${url}`).join('\n')}` : ''}`;
115
+ const text = formatRelatedIssueBriefing(input);
110
116
  await deps.sendIssueCard({ linearIssueId: input.linearIssueId, text });
111
117
  await deps.commentIssue(input.linearIssueId, text);
112
118
  const reopened = await deps.issueIsDone(input.linearIssueId) && await deps.isDecisionImpacting(related);
113
119
  if (reopened) {
114
120
  await deps.reopenIssue(input.linearIssueId);
115
121
  await deps.sendMemoUpdateCard({ linearIssueId: input.linearIssueId,
116
- text: `관련 이슈 · ${input.issueLabel?.trim() || input.linearIssueId}\n메모 갱신?\n\n${input.summary.trim()}` });
122
+ text: `관련 이슈: ${input.issueLabel?.trim() || input.linearIssueId}\n메모 갱신?\n\n${input.summary.trim()}` });
117
123
  }
118
124
  return { related: related.length, reopened };
119
125
  }
@@ -127,31 +133,33 @@ export function appendTopicBriefingTelegramDryRun(file: string, input: { linearI
127
133
  export async function projectTopicBriefing(source: RegisteredIntakeSource, items: BriefItem[], stateDir = effectiveInstanceRoot(),
128
134
  options: { telegramDryRunFile?: string } = {}): Promise<void> {
129
135
  if (!source.linearIssueId || items.length === 0) return;
136
+ const input = { linearIssueId: source.linearIssueId, issueLabel: source.briefingTopic ?? source.spec,
137
+ summary: items.map(item => item.text).join('\n'), items };
138
+ if (options.telegramDryRunFile) {
139
+ const text = formatRelatedIssueBriefing(input);
140
+ if (text) appendTopicBriefingTelegramDryRun(options.telegramDryRunFile, { linearIssueId: source.linearIssueId, text, kind: 'issue' });
141
+ return;
142
+ }
130
143
  const [{ getSecretAsync }, { commentLinearIssue, fetchLinearIssueStateType, moveLinearIssueToStateType },
131
144
  { kindRouteTarget }, { getUserConfig }, { sendTelegramTo }] = await Promise.all([
132
145
  import('../nexus/config/secrets/index.js'), import('../connectors/linear.js'), import('../domains/telegram-kind-route.js'),
133
146
  import('../user-config.js'), import('../autopilot/mission-notify.js'),
134
147
  ]);
135
- const target = options.telegramDryRunFile ? undefined : kindRouteTarget(getUserConfig(), 'ops-report');
136
- if (!options.telegramDryRunFile && !target) throw new Error('관련 이슈 브리핑 Telegram ops-report 대상이 없습니다');
148
+ const target = kindRouteTarget(getUserConfig(), 'ops-report');
149
+ if (!target) throw new Error('관련 이슈 브리핑 Telegram ops-report 대상이 없습니다');
137
150
  const send = async (text: string, kind: 'issue' | 'memo'): Promise<void> => {
138
- if (options.telegramDryRunFile) {
139
- appendTopicBriefingTelegramDryRun(options.telegramDryRunFile, { linearIssueId: source.linearIssueId!, text, kind });
140
- return;
141
- }
142
151
  if (!target || !sendTelegramTo(target.botToken, target.chatId, text)) throw new Error('관련 이슈 브리핑 Telegram 발송 실패');
143
152
  };
144
153
  const apiKey = await getSecretAsync('connector.linear.apiKey');
145
154
  if (!apiKey) throw new Error('Linear 키가 없습니다');
146
- await deliverTopicBriefingWithReceipts({ linearIssueId: source.linearIssueId, issueLabel: source.spec,
147
- summary: items.map(item => item.text).join('\n'), items }, stateDir, {
155
+ await deliverTopicBriefingWithReceipts(input, stateDir, {
148
156
  sendIssueCard: async ({ text }) => send(text, 'issue'),
149
157
  commentIssue: async (issueId, body) => commentLinearIssue({ apiKey, issueId, body }),
150
158
  issueIsDone: async issueId => await fetchLinearIssueStateType({ apiKey, issueId }) === 'completed',
151
159
  isDecisionImpacting: async related => isDecisionImpactingTopicEvidence(related),
152
160
  reopenIssue: async issueId => moveLinearIssueToStateType({ apiKey, issueId, type: 'started' }),
153
161
  sendMemoUpdateCard: async ({ text }) => send(text, 'memo'),
154
- }, options.telegramDryRunFile ? 'telegram-dry-run' : 'live');
162
+ }, 'live');
155
163
  }
156
164
 
157
165
  export interface SubscribeTopicSearchInput {