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
@@ -7,6 +7,7 @@ import { formatResearchEvidenceAttribution, researchEvidenceSourceUrls } from '.
7
7
  import { routeResearchOutput } from '../research/output-router.js';
8
8
  import { planGapFollowup } from '../research/gap-followup.js';
9
9
  import type { ResearchGapFollowupInput, ResearchGapFollowupPlan, ResearchGapFollowupResult } from '../research/gap-followup.js';
10
+ import type { ResearchGraphEvent } from '../nexus/api/research-run-observer.js';
10
11
  import { debug, redactSecretText } from '../debug/log.js';
11
12
  import {
12
13
  buildWorkingBackwardsContractPrompt,
@@ -37,6 +38,8 @@ import {
37
38
  export interface ResearchQuestionLadderRunOptions {
38
39
  /** Explicit inherited run identity for diagnostics; omitted values are never fabricated here. */
39
40
  runId?: string;
41
+ /** Persist the actual adaptive research steps to the active Nexus run, when the caller owns a run. */
42
+ onGraphEvent?: (event: ResearchGraphEvent) => void;
40
43
  signal?: AbortSignal;
41
44
  /** Inherit the active turn's provider route; research must not pick its own default. */
42
45
  initialProvider?: LLMProvider;
@@ -78,6 +81,34 @@ export interface ResearchQuestionLadderRunOptions {
78
81
  secondOrderTriggerClassifier?: SecondOrderTriggerClassifier;
79
82
  }
80
83
 
84
+ function emitGraphEvent(options: ResearchQuestionLadderRunOptions, event: ResearchGraphEvent): void {
85
+ try { options.onGraphEvent?.(event); } catch { /* visualization is observational and fail-soft */ }
86
+ }
87
+
88
+ function researchNodeId(prefix: 'axis' | 'followup', questionId: string): string {
89
+ const safeId = questionId.replace(/[^A-Za-z0-9_-]/g, '-').replace(/^-+|-+$/g, '').slice(0, 40) || 'unknown';
90
+ return `${prefix}-${safeId}`;
91
+ }
92
+
93
+ function prioritizeGapFollowups(
94
+ plan: ResearchGapFollowupPlan,
95
+ input: ResearchGapFollowupInput,
96
+ ): { plan: ResearchGapFollowupPlan; changes: Array<{ node: string; from: number; to: number }> } {
97
+ const questionById = new Map(input.questions.map((question) => [question.id, question]));
98
+ const slotRank = new Map((input.blankSlots ?? []).map((slot, index) => [slot.id, index]));
99
+ const ranked = plan.followups.map((call, index) => ({ call, index })).sort((a, b) => {
100
+ const aSection = questionById.get(a.call.questionId)?.sectionId;
101
+ const bSection = questionById.get(b.call.questionId)?.sectionId;
102
+ return (slotRank.get(aSection ?? '') ?? Number.MAX_SAFE_INTEGER)
103
+ - (slotRank.get(bSection ?? '') ?? Number.MAX_SAFE_INTEGER)
104
+ || a.index - b.index;
105
+ });
106
+ const changes = ranked.flatMap(({ call, index }, nextIndex) => index === nextIndex ? [] : [{
107
+ node: researchNodeId('followup', call.questionId), from: index + 1, to: nextIndex + 1,
108
+ }]);
109
+ return { plan: { ...plan, followups: ranked.map(({ call }) => call) }, changes };
110
+ }
111
+
81
112
  export interface ResearchGroundingResult {
82
113
  ok: boolean;
83
114
  output: string;
@@ -156,12 +187,27 @@ async function runNativeResearchGapFollowup(
156
187
  }
157
188
  const budgetSignal = AbortSignal.timeout(plan.timeBudgetMs);
158
189
  const signal = input.signal ? AbortSignal.any([input.signal, budgetSignal]) : budgetSignal;
159
- const result = await (options.invokeAxes ?? invokeProductionResearchAxes)(
160
- planned, signal, options.admitToolCall,
161
- );
190
+ const followupEvidence: ResearchEvidenceEnvelope[] = [];
191
+ const followupNodes = planned.map((question) => researchNodeId('followup', question.id));
192
+ emitGraphEvent(options, { type: 'enter', node: 'followup' });
193
+ for (const node of followupNodes) emitGraphEvent(options, { type: 'enter', node });
194
+ try {
195
+ const result = await (options.invokeAxes ?? invokeProductionResearchAxes)(planned, signal, options.admitToolCall);
196
+ const byQuestion = new Map(result.axes.map((axis) => [axis.questionId, axis]));
197
+ for (const question of planned) {
198
+ const evidence = byQuestion.get(question.id)?.evidence ?? [];
199
+ followupEvidence.push(...evidence);
200
+ emitGraphEvent(options, { type: 'exit', node: researchNodeId('followup', question.id), outcome: evidence.some((item) => item.outcome !== 'failed') ? 'ok' : 'fail' });
201
+ }
202
+ emitGraphEvent(options, { type: 'exit', node: 'followup', outcome: result.axes.some((axis) => axis.evidence.some((item) => item.outcome !== 'failed')) ? 'ok' : 'fail' });
203
+ } catch (error) {
204
+ for (const node of followupNodes) emitGraphEvent(options, { type: 'exit', node, outcome: 'fail' });
205
+ emitGraphEvent(options, { type: 'exit', node: 'followup', outcome: 'fail' });
206
+ throw error;
207
+ }
162
208
  return {
163
209
  ...plan,
164
- followupEvidence: result.axes.flatMap((axis) => axis.evidence),
210
+ followupEvidence,
165
211
  discoveryCards: [],
166
212
  };
167
213
  }
@@ -478,6 +524,13 @@ export async function runResearchQuestionLadder(
478
524
  };
479
525
  const singlePreparation = Boolean(options.generatePreparation)
480
526
  || (!options.generateContract && !options.generate);
527
+ emitGraphEvent(options, { type: 'enter', node: 'question-plan' });
528
+ let questionPlanFinished = false;
529
+ const finishQuestionPlan = (outcome: string): void => {
530
+ if (questionPlanFinished) return;
531
+ questionPlanFinished = true;
532
+ emitGraphEvent(options, { type: 'exit', node: 'question-plan', outcome });
533
+ };
481
534
  let contractRaw: string;
482
535
  let raw = '';
483
536
  try {
@@ -512,12 +565,14 @@ export async function runResearchQuestionLadder(
512
565
  );
513
566
  }
514
567
  if (signal.aborted) {
568
+ finishQuestionPlan('aborted');
515
569
  return shouldReturnPartial()
516
570
  ? { ok: false, ladder: initial, output: partialResearchOutput(request, initial, 'before question generation'), error: RESEARCH_TURN_DEADLINE_STOP_ERROR }
517
571
  : { ok: false, ladder: initial, output: '', error: 'research aborted' };
518
572
  }
519
573
  } catch (error) {
520
574
  const reason = errorText(error);
575
+ finishQuestionPlan(signal.aborted ? 'aborted' : 'fail');
521
576
  if (signal.aborted) {
522
577
  return {
523
578
  ok: false, ladder: initial,
@@ -534,11 +589,13 @@ export async function runResearchQuestionLadder(
534
589
  generatedContract = JSON.parse(extractJson(contractRaw));
535
590
  } catch (error) {
536
591
  const reason = errorText(error);
592
+ finishQuestionPlan('fail');
537
593
  debug.log('research.lens', 'working-backwards-contract-invalid', { reason }, { level: 'warn' });
538
594
  return { ok: false, ladder: initial, output: '', error: `output contract returned invalid JSON: ${reason}` };
539
595
  }
540
596
  const parsedContract = parseWorkingBackwardsContract(generatedContract);
541
597
  if (!parsedContract.ok) {
598
+ finishQuestionPlan('fail');
542
599
  debug.log('research.lens', 'working-backwards-contract-invalid', { reason: parsedContract.reason }, { level: 'warn' });
543
600
  return { ok: false, ladder: initial, output: '', error: parsedContract.reason };
544
601
  }
@@ -568,12 +625,14 @@ export async function runResearchQuestionLadder(
568
625
  signal,
569
626
  );
570
627
  if (signal.aborted) {
628
+ finishQuestionPlan('aborted');
571
629
  return shouldReturnPartial()
572
630
  ? { ok: false, ladder: initial, outputContract, output: partialResearchOutput(request, initial, 'before axis searches'), error: RESEARCH_TURN_DEADLINE_STOP_ERROR }
573
631
  : { ok: false, ladder: initial, outputContract, output: '', error: 'research aborted' };
574
632
  }
575
633
  debug.log('research.turn', 'bloom-generated', { questionCount: 6 });
576
634
  } catch (error) {
635
+ finishQuestionPlan(signal.aborted ? 'aborted' : 'fail');
577
636
  if (signal.aborted) {
578
637
  return {
579
638
  ok: false, ladder: initial, outputContract,
@@ -589,6 +648,7 @@ export async function runResearchQuestionLadder(
589
648
  try {
590
649
  generated = JSON.parse(extractJson(raw));
591
650
  } catch (error) {
651
+ finishQuestionPlan('fail');
592
652
  debug.log('research.turn', 'bloom-validation-failed', { reason: errorText(error) }, { level: 'warn' });
593
653
  return { ok: false, ladder: initial, outputContract, output: '', error: `question generation returned invalid JSON: ${errorText(error)}` };
594
654
  }
@@ -596,11 +656,13 @@ export async function runResearchQuestionLadder(
596
656
  withRequest(generated, request), outputContract.sections.map((section) => section.id),
597
657
  );
598
658
  if (!parsed.ok) {
659
+ finishQuestionPlan('fail');
599
660
  debug.log('research.turn', 'bloom-validation-failed', { reason: parsed.reason }, { level: 'warn' });
600
661
  return { ok: false, ladder: initial, outputContract, output: '', error: parsed.reason };
601
662
  }
602
663
 
603
664
  const ladder = parsed.value;
665
+ finishQuestionPlan('ok');
604
666
  debug.log('research.turn', 'bloom-ladder-validated', { questionCount: ladder.questions.length });
605
667
  debug.log('research.turn', 'deep-bloom-applied', {
606
668
  levels: [4, 5], trigger: 'research-intent',
@@ -609,14 +671,37 @@ export async function runResearchQuestionLadder(
609
671
  });
610
672
  const observedAt = new Date().toISOString();
611
673
  let fanout: AxisFanoutResult;
674
+ for (const [index, question] of ladder.questions.entries()) {
675
+ const node = researchNodeId('axis', question.id);
676
+ emitGraphEvent(options, { type: 'node-added', node, kind: 'research', reason: 'Bloom question ladder generated this evidence axis' });
677
+ emitGraphEvent(options, {
678
+ type: 'edge-rerouted', from: 'axes', outcome: index === 0 ? '$default' : question.id,
679
+ to: node, was: index === 0 ? 'evidence-check' : '$absent',
680
+ reason: 'Question axes are collected concurrently as independent evidence paths',
681
+ });
682
+ emitGraphEvent(options, { type: 'edge-rerouted', from: node, outcome: '$default', to: 'evidence-check', was: '$absent', reason: 'Each evidence axis returns to the shared output contract check' });
683
+ emitGraphEvent(options, { type: 'enter', node });
684
+ }
685
+ let axesFinished = false;
686
+ const finishAxes = (outcome: string): void => {
687
+ if (axesFinished) return;
688
+ axesFinished = true;
689
+ emitGraphEvent(options, { type: 'exit', node: 'axes', outcome });
690
+ };
612
691
  try {
692
+ emitGraphEvent(options, { type: 'enter', node: 'axes' });
613
693
  fanout = await (options.invokeAxes ?? invokeProductionResearchAxes)(ladder.questions, signal, options.admitToolCall);
614
- if (signal.aborted && !shouldReturnPartial()) return { ok: false, ladder, outputContract, output: '', error: 'research aborted' };
694
+ if (signal.aborted && !shouldReturnPartial()) {
695
+ finishAxes('aborted');
696
+ for (const question of ladder.questions) emitGraphEvent(options, { type: 'exit', node: researchNodeId('axis', question.id), outcome: 'aborted' });
697
+ return { ok: false, ladder, outputContract, output: '', error: 'research aborted' };
698
+ }
615
699
  debug.log('research.turn', 'axis-evidence-collected', {
616
700
  axisCount: fanout.axes.length,
617
701
  evidenceCount: fanout.axes.reduce((count, axis) => count + axis.evidence.length, 0),
618
702
  });
619
703
  } catch (error) {
704
+ finishAxes('fail');
620
705
  debug.log('research.turn', 'axis-evidence-failed', { reason: errorText(error) }, { level: 'warn' });
621
706
  fanout = {
622
707
  plan: [],
@@ -628,6 +713,12 @@ export async function runResearchQuestionLadder(
628
713
  };
629
714
  }
630
715
 
716
+ const collectedAxes = new Map(fanout.axes.map((axis) => [axis.questionId, axis]));
717
+ for (const question of ladder.questions) {
718
+ const axis = collectedAxes.get(question.id);
719
+ emitGraphEvent(options, { type: 'exit', node: researchNodeId('axis', question.id), outcome: axis?.evidence.some((item) => item.outcome !== 'failed') ? 'ok' : 'fail' });
720
+ }
721
+
631
722
  let evidenceRejected = false;
632
723
  const sections: string[] = [`# Research: ${request}`, '', `## Output contract\n${ladderContext}`, ''];
633
724
  const byQuestion = new Map(fanout.axes.map((axis) => [axis.questionId, axis]));
@@ -678,6 +769,9 @@ export async function runResearchQuestionLadder(
678
769
 
679
770
  let finalBoundary = planWorkingBackwardsCompletion(outputContract, ladder.questions, ladder.evidence);
680
771
  logCompletionBoundary('axis-fanout', finalBoundary, options.runId);
772
+ finishAxes('ok');
773
+ emitGraphEvent(options, { type: 'enter', node: 'evidence-check' });
774
+ emitGraphEvent(options, { type: 'exit', node: 'evidence-check', outcome: finalBoundary.complete ? 'complete' : 'gap' });
681
775
  if (finalBoundary.complete) {
682
776
  debug.log('research.turn', 'completion-boundary-stop', {
683
777
  stage: 'axis-fanout', reason: 'every output-contract section slot is filled',
@@ -700,6 +794,27 @@ export async function runResearchQuestionLadder(
700
794
  if (options.planGapFollowup || !options.gapFollowup) {
701
795
  try {
702
796
  followupPlan = (options.planGapFollowup ?? planGapFollowup)(followupInput);
797
+ const prioritized = prioritizeGapFollowups(followupPlan, followupInput);
798
+ followupPlan = prioritized.plan;
799
+ if (followupPlan.followups.length > 0) {
800
+ const followupNodes = followupPlan.followups.map((call) => researchNodeId('followup', call.questionId));
801
+ for (const node of followupNodes) emitGraphEvent(options, { type: 'node-added', node, kind: 'research', reason: 'Output contract gap scheduled a bounded evidence follow-up' });
802
+ emitGraphEvent(options, {
803
+ type: 'edge-rerouted', from: 'evidence-check', outcome: 'gap', to: 'followup', was: 'synthesis',
804
+ reason: 'Missing contract evidence routes the run through follow-up fanout',
805
+ });
806
+ for (const node of followupNodes) {
807
+ emitGraphEvent(options, {
808
+ type: 'edge-rerouted', from: 'followup', outcome: node.slice('followup-'.length),
809
+ to: node, was: '$absent',
810
+ reason: 'Follow-up fanout dispatches prioritized evidence questions concurrently',
811
+ });
812
+ emitGraphEvent(options, { type: 'edge-rerouted', from: node, outcome: '$default', to: 'synthesis', was: '$absent', reason: 'Follow-up evidence returns to answer synthesis' });
813
+ }
814
+ }
815
+ for (const change of prioritized.changes) {
816
+ emitGraphEvent(options, { type: 'priority-changed', ...change, reason: 'Follow-up order now follows the unfilled output-contract sections' });
817
+ }
703
818
  debug.log('research.turn', 'gap-followup-planned', {
704
819
  rounds: followupPlan.rounds,
705
820
  classifications: followupPlan.classifications.length,
@@ -14,17 +14,21 @@ export function registerIntakeSourceCommands(intake: Command, root: () => string
14
14
  const fail = (error: unknown) => { console.error(error instanceof Error ? error.message : String(error)); process.exitCode = 2; };
15
15
  source.command('add')
16
16
  .requiredOption('--seat <id>', '자리 id 또는 별칭')
17
- .requiredOption('--kind <kind>', 'github-query | rss | command | topic-search')
17
+ .requiredOption('--kind <kind>', 'github-query | rss | command | topic-search | markdown')
18
18
  .requiredOption('--spec <spec>', 'GitHub 질의 · 피드 URL · 명령')
19
19
  .requiredOption('--every <cadence>', 'Nh | Nd | Nw')
20
20
  .option('--until <date>', '만료 시작 날짜 YYYY-MM-DD (UTC)')
21
21
  .option('--why <reason>', '등록 이유')
22
22
  .option('--id <id>', '원천 id')
23
- .option('--linear-issue-id <uuid>', 'topic-search parent Linear issue UUID')
23
+ .option('--linear-issue-id <uuid>', 'topic-search/markdown parent Linear issue UUID')
24
+ .option('--briefing-topic <label>', 'issue briefing display label')
24
25
  .option('--schedule-cron <expression>', 'topic-search schedule registry cron (e.g. 0 8 * * 1)')
25
- .option('--telegram-dry-run-file <path>', 'Telegram 브리핑 본문을 이 파일에 기록하고 실제 발송은 하지 않음 (topic-search)')
26
- .action(async (opts: { seat: string; kind: string; spec: string; every: string; until?: string; why?: string; id?: string; linearIssueId?: string; scheduleCron?: string; telegramDryRunFile?: string }) => {
26
+ .option('--telegram-dry-run-file <path>', 'topic-search 즉시 투영 본문을 이 파일에 기록하고 실제 발송은 하지 않음')
27
+ .action(async (opts: { seat: string; kind: string; spec: string; every: string; until?: string; why?: string; id?: string; linearIssueId?: string; briefingTopic?: string; scheduleCron?: string; telegramDryRunFile?: string }) => {
27
28
  try {
29
+ if (opts.telegramDryRunFile && opts.kind !== 'topic-search') {
30
+ throw new Error('--telegram-dry-run-file 은 topic-search add 에서만 사용한다; markdown 은 run-due 때 지정한다');
31
+ }
28
32
  if (opts.kind === 'topic-search') {
29
33
  if (!opts.linearIssueId || !opts.scheduleCron) throw new Error('topic-search 는 --linear-issue-id 와 --schedule-cron 이 필요하다');
30
34
  const telegramDryRunFile = opts.telegramDryRunFile ? resolve(opts.telegramDryRunFile) : undefined;
@@ -40,6 +44,7 @@ export function registerIntakeSourceCommands(intake: Command, root: () => string
40
44
  const added = addSource({ id: opts.id ?? `src-${randomUUID().slice(0, 8)}`, seat: opts.seat, kind: opts.kind as SourceKind,
41
45
  spec: opts.spec, every: opts.every, ...(opts.until ? { until: opts.until } : {}), ...(opts.why ? { why: opts.why } : {}),
42
46
  ...(opts.linearIssueId ? { linearIssueId: opts.linearIssueId } : {}),
47
+ ...(opts.briefingTopic ? { briefingTopic: opts.briefingTopic } : {}),
43
48
  ...(opts.scheduleCron ? { scheduleCron: opts.scheduleCron } : {}) }, root());
44
49
  console.log(`${added.id} ${added.seat} ${added.kind} ${added.every}`);
45
50
  } catch (error) { fail(error); }
@@ -71,6 +71,11 @@ export const DEFAULT_PUBLIC_REPO = 'ElanvitalAI/elanous';
71
71
  export interface RunResult { status: number | null; stdout: string; stderr: string }
72
72
  export type Runner = (command: string, args: readonly string[], cwd: string, opts?: { env?: NodeJS.ProcessEnv; input?: string }) => RunResult;
73
73
 
74
+ /** Installers require explicit consent even in isolated local release verification. */
75
+ export function runReleaseInstaller(script: string, cwd: string, env: NodeJS.ProcessEnv, run: Runner): RunResult {
76
+ return run('bash', ['-s', '--', '--yes', '--no-modify-path'], cwd, { env, input: script });
77
+ }
78
+
74
79
  export const defaultRunner: Runner = (command, args, cwd, opts = {}) => {
75
80
  const r = spawnSync(command, [...args], { cwd, encoding: 'utf8', env: opts.env ?? process.env, input: opts.input, maxBuffer: 256 * 1024 * 1024 });
76
81
  return { status: r.status, stdout: r.stdout ?? '', stderr: r.error ? String(r.error) : (r.stderr ?? '') };
@@ -203,7 +208,7 @@ export async function prepareRelease(opts: PrepareOptions, run: Runner = default
203
208
  const prefix = join(out, 'e2e-prefix');
204
209
  mkdirSync(home);
205
210
  const env = { ...process.env, HOME: home, ELANOUS_INSTALL_PREFIX: prefix, ELANOUS_RELEASE_BASE: `file://${join(out, 'e2e-release')}`, ELANOUS_INSTALL_SOURCE: '', ELANOUS_VERSION: '', SHELL: '/bin/zsh' };
206
- const install = run('bash', ['-s', '--', '--no-modify-path'], home, { env, input: readFileSync(join(distDir, 'install.sh'), 'utf8') });
211
+ const install = runReleaseInstaller(readFileSync(join(distDir, 'install.sh'), 'utf8'), home, env, run);
207
212
  const version = run(join(prefix, 'bin', 'elanous'), ['--version'], home, { env });
208
213
  const versionLine = version.stdout.trim();
209
214
  const ok = install.status === 0 && versionLine.startsWith(`${opts.version} ${publicCommit}`);
@@ -467,7 +472,7 @@ export async function verifyRelease(opts: { version?: string; publicRepo?: strin
467
472
  const inherited = Object.fromEntries(Object.entries(process.env).filter(([key]) => !key.startsWith('ELANOUS_') && !key.startsWith('XDG_')));
468
473
  const env = envLiteral({ ...inherited, HOME: home, ELANOUS_INSTALL_PREFIX: prefix, ELANOUS_INSTALL_SOURCE: '', ELANOUS_VERSION: opts.version ?? '', SHELL: '/bin/zsh' });
469
474
  const script = must(run('curl', ['-fsSL', installerUrl], home), `설치기 받기 ${installerUrl}`);
470
- const install = run('bash', ['-s', '--', '--no-modify-path'], home, { env, input: script });
475
+ const install = runReleaseInstaller(script, home, env, run);
471
476
  const versionLine = run(join(prefix, 'bin', 'elanous'), ['--version'], home, { env }).stdout.trim();
472
477
  const state = stateRoundTrip(join(prefix, 'bin', 'elanous'), home, env, run, startedAtMs);
473
478
  const update = run(join(prefix, 'bin', 'elanous'), ['self-update', '--json'], home, { env });
@@ -294,7 +294,7 @@ function formatDefaultPluginStatuses(statuses: readonly DefaultPluginStatus[]):
294
294
  async function readDefaultPluginStatuses(deps: SetupCliDeps): Promise<DefaultPluginStatus[]> {
295
295
  const catalogErrors = validateDefaultPluginServiceKeys();
296
296
  if (catalogErrors.length) throw new Error(`기본 플러그인 서비스 카탈로그 오류: ${catalogErrors.join('; ')}`);
297
- const keys = (deps.getServiceKeyStatus ?? serviceKeyStatus)()
297
+ const keys = (await (deps.getServiceKeyStatus ?? serviceKeyStatus)())
298
298
  .filter(item => item.configured).map(item => item.id);
299
299
  const providers = await (deps.detectProviders ?? detectProviders)();
300
300
  const prerequisites = new Set<string>();
@@ -528,7 +528,7 @@ export function registerSetupCommand(program: Command, deps: SetupCliDeps = {}):
528
528
  try {
529
529
  if (opts.status) {
530
530
  if (opts.all) throw new Error('--status already shows the full catalog; omit --all');
531
- for (const line of renderServiceKeyStatus()) out.log(line);
531
+ for (const line of await renderServiceKeyStatus()) out.log(line);
532
532
  for (const line of formatDefaultPluginStatuses(await readDefaultPluginStatuses(deps))) out.log(line);
533
533
  setExitCode(0);
534
534
  return;
@@ -80,12 +80,15 @@ function renderProviderProposal(config: UserConfig, providers: Awaited<ReturnTyp
80
80
  ];
81
81
  }
82
82
 
83
- export function renderServiceKeyStatus(options: { env?: NodeJS.ProcessEnv; cacheDir?: string } = {}): string[] {
84
- const status = serviceKeyStatus(options);
83
+ export async function renderServiceKeyStatus(options: { env?: NodeJS.ProcessEnv; cacheDir?: string; getSecret?: (id: string) => Promise<string | undefined> } = {}): Promise<string[]> {
84
+ const status = await serviceKeyStatus(options);
85
85
  return SERVICE_KEY_CATALOG.map(item => {
86
86
  const row = status.find(candidate => candidate.id === item.id);
87
87
  if (!row) return `${item.label}: 상태 확인 불가`;
88
- if (item.kind === 'api-key') return `${item.label}: ${row.configured ? '키 있음' : '키 필요'} (${item.envNames.join(', ')})`;
88
+ if (item.kind === 'api-key') {
89
+ const state = row.sourceCheckFailed && !row.configured ? '상태 확인 불가' : row.configured ? '키 있음' : '키 필요';
90
+ return `${item.label}: ${state} (${row.sources.join(', ') || '감지된 출처 없음'})`;
91
+ }
89
92
  return `${item.label}: ${item.kind === 'subscription' || item.kind === 'oauth' || item.kind === 'cli' ? '로그인/설치 상태는 별도 감지' : '로컬 도구 확인 필요'}`;
90
93
  });
91
94
  }
@@ -130,7 +133,7 @@ export async function runSetupKeys(io: SetupKeysIO, options: SetupKeysOptions):
130
133
  const { listCodexAccountsInStore } = await import('../oauth/codex-account-store.js');
131
134
  const codexAccounts = listCodexAccountsInStore().map(account => account.name);
132
135
  io.print(`Codex 계정: ${codexAccounts.length ? codexAccounts.join(', ') : '없음'} · 추가: 별도 CODEX_HOME에서 codex login 후 elanous provider codex account import <이름> --home <홈>`);
133
- const statuses = serviceKeyStatus({ env: options.env, cacheDir: options.cacheDir });
136
+ const statuses = await serviceKeyStatus({ env: options.env, cacheDir: options.cacheDir });
134
137
  const entries = SERVICE_KEY_CATALOG.filter(item => item.kind === 'api-key' && (item.demoRequired || options.includeOptional));
135
138
  const stored: string[] = [];
136
139
  const skipped: string[] = [];
@@ -152,7 +155,7 @@ export async function runSetupKeys(io: SetupKeysIO, options: SetupKeysOptions):
152
155
  if (result.stored.includes(envName)) stored.push(envName);
153
156
  else skipped.push(item.id);
154
157
  }
155
- for (const line of renderServiceKeyStatus({ env: options.env, cacheDir: options.cacheDir })) io.print(line);
158
+ for (const line of await renderServiceKeyStatus({ env: options.env, cacheDir: options.cacheDir })) io.print(line);
156
159
  return { stored, skipped };
157
160
  }
158
161