flowviant 0.125.7 → 0.125.9

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 (55) hide show
  1. package/README.md +80 -1
  2. package/bin/cli.mjs +7 -1
  3. package/bin/lib/activityFeed.mjs +69 -0
  4. package/bin/lib/agentMergeReports.mjs +46 -0
  5. package/bin/lib/agentMergeResolution.mjs +44 -0
  6. package/bin/lib/agentPlan.mjs +6 -2
  7. package/bin/lib/claudePosture.mjs +21 -0
  8. package/bin/lib/claudeStream.mjs +25 -4
  9. package/bin/lib/codexResearch.mjs +33 -5
  10. package/bin/lib/commandSpecs.mjs +8 -5
  11. package/bin/lib/daemonJournal.mjs +102 -0
  12. package/bin/lib/daemonLogging.mjs +22 -18
  13. package/bin/lib/fleet.mjs +16 -6
  14. package/bin/lib/fleetReports.mjs +12 -5
  15. package/bin/lib/hooks/orchestrator.mjs +3 -1
  16. package/bin/lib/logReplay.mjs +133 -0
  17. package/bin/lib/nativeAgentTools.mjs +20 -3
  18. package/bin/lib/observedLines.mjs +63 -0
  19. package/bin/lib/orchestrator.mjs +40 -7
  20. package/bin/lib/orchestratorNative.mjs +133 -3
  21. package/bin/lib/orchestratorPrompt.mjs +50 -4
  22. package/bin/lib/postureTools.mjs +14 -6
  23. package/bin/lib/printable.mjs +1 -1
  24. package/bin/lib/repositoryMerge.mjs +1 -1
  25. package/bin/lib/researchHandoff.mjs +144 -0
  26. package/bin/lib/researchHandoffText.mjs +3 -0
  27. package/bin/lib/researchKnowledge.mjs +60 -0
  28. package/bin/lib/researchRestoration.mjs +38 -0
  29. package/bin/lib/runTurn.mjs +76 -43
  30. package/bin/lib/runtimeClaude.mjs +9 -4
  31. package/bin/lib/runtimeCodex.mjs +51 -22
  32. package/bin/lib/runtimeEvents.mjs +17 -7
  33. package/bin/lib/turnDiagnostics.mjs +2 -1
  34. package/bin/lib/turnOutput.mjs +63 -0
  35. package/bin/lib/turnRecord.mjs +11 -0
  36. package/bin/lib/turnSubagents.mjs +13 -3
  37. package/bin/lib/ui.mjs +2 -2
  38. package/bin/lib/uplinkScrub.mjs +49 -0
  39. package/bin/lib/views.mjs +49 -58
  40. package/bin/lib/wikiRunner.mjs +2 -2
  41. package/bin/lib/work.mjs +2 -2
  42. package/bin/lib/workActivity.mjs +65 -0
  43. package/bin/lib/workAgentBriefRunner.mjs +2 -2
  44. package/bin/lib/workAgentMerges.mjs +57 -52
  45. package/bin/lib/workAgentPlans.mjs +76 -27
  46. package/bin/lib/workAgentPrecheck.mjs +1 -1
  47. package/bin/lib/workAgentTurnExecution.mjs +42 -8
  48. package/bin/lib/workAgentTurnReports.mjs +17 -3
  49. package/bin/lib/workAgentTurnShape.mjs +6 -4
  50. package/bin/lib/workAgentTurns.mjs +8 -6
  51. package/bin/lib/workIntake.mjs +8 -2
  52. package/bin/lib/workMergeBatch.mjs +7 -1
  53. package/bin/lib/workPlanRecovery.mjs +50 -0
  54. package/bin/lib/workSessionTurns.mjs +5 -2
  55. package/package.json +1 -1
@@ -0,0 +1,50 @@
1
+ /** The person's own CLI diagnoses planning, under the ordinary consult fence. */
2
+ import { candidateObjects } from './modelJson.mjs';
3
+ import { scrub } from './uplinkScrub.mjs';
4
+ import { fleetRequest } from './fleetPost.mjs';
5
+ import { DAEMON_INSTANCE } from './config.mjs';
6
+
7
+ export const PLAN_RECOVERY_SYSTEM = `You are recovering the person's retained Plan press.
8
+ Read the original selection, failure, retained evidence, answers and repository.
9
+ Establish the cause before claiming a repair. Diagnose/debug the planning failure
10
+ with the available read-only tools. Repair the planning approach, context or output
11
+ instructions. Do not change repository files, start agents or approve work.
12
+ Retry count is never a reason to ask the person to click Plan again.
13
+ Only ask for an answer, credential action or changed-scope decision that reading
14
+ and diagnosis cannot supply. Ask one specific question and explain what it settles.
15
+ Return one JSON object: {"status":"repaired","summary":"cause and corrected approach"}
16
+ or {"status":"question","question":"specific question","context":"findings"}.
17
+ A repaired result is followed automatically by a fresh planning turn on the same
18
+ selection and chosen CLI/model/effort. The result is a proposal for human review. When recovery.start is present, the person
19
+ already approved only that Start group: diagnose its admission or pickup failure,
20
+ preserve its exact ordered selection, CLI and creation/attachment choice, and
21
+ repair only its planning context. A valid same-scope repair continues that approval
22
+ automatically; any genuine scope decision needs a specific question first.`;
23
+
24
+ export function parsePlanDiagnosis(out) {
25
+ for (const v of candidateObjects(String(out ?? ''))) {
26
+ if (v.status === 'repaired' && typeof v.summary === 'string' && v.summary.trim())
27
+ return { status: 'repaired', summary: scrub(v.summary) };
28
+ if (v.status === 'question' && typeof v.question === 'string' && v.question.trim())
29
+ return { status: 'question', question: scrub(v.question), ...(typeof v.context === 'string' ? { context: scrub(v.context) } : {}) };
30
+ }
31
+ return null;
32
+ }
33
+
34
+ /** Unknown transport state never means Stop. Only an answered holder read does. */
35
+ export async function watchPlanAttempt(url, job) {
36
+ const controller = new AbortController();
37
+ let busy = false;
38
+ const check = async () => {
39
+ if (busy) return;
40
+ busy = true;
41
+ try {
42
+ const r = await fleetRequest(url, { body: { id: job.id, attempt: job.attempt, instance: DAEMON_INSTANCE }, timeoutMs: 15_000 });
43
+ if (r.ok && r.json?.data?.active === false) controller.abort();
44
+ } finally { busy = false; }
45
+ };
46
+ await check();
47
+ const timer = setInterval(check, 5_000);
48
+ timer.unref?.();
49
+ return { signal: controller.signal, check, stop: () => clearInterval(timer) };
50
+ }
@@ -1,3 +1,4 @@
1
+ import { sessionWork, reportWorkOutcome } from './workActivity.mjs';
1
2
  /**
2
3
  * A WORKBENCH TAB'S TURN — offered, admitted, placed, adopted, pinned to its
3
4
  * CLI, credentialed, resumed, run, persisted and settled.
@@ -149,6 +150,8 @@ export function createWorkSessionTurns({
149
150
  return settledHere.has(turnId);
150
151
  };
151
152
  const settleTurn = (turnId, payload) => {
153
+ const run = runs.get(turnId);
154
+ if (run?.job) reportWorkOutcome(sessionWork(run.job), { ...payload, outcome: payload.ok ? 'replied' : 'nothing' });
152
155
  const at = now();
153
156
  settledHere.delete(turnId); // re-inserted at the end: the map stays in time order
154
157
  settledHere.set(turnId, at);
@@ -223,7 +226,7 @@ export function createWorkSessionTurns({
223
226
  const releaseSlot = admit.reserve();
224
227
  lastDeferSaid.delete(job.sessionId);
225
228
  workAnswering.add(job.id);
226
- const run = { interrupted: false, spawned: [], sessionId: job.sessionId, live: null };
229
+ const run = { interrupted: false, spawned: [], sessionId: job.sessionId, live: null, job };
227
230
  runs.set(job.id, run);
228
231
  /** The execution generation the server handed, echoed on every settle
229
232
  * so the server can tell this execution's answer from an older one's. */
@@ -819,7 +822,7 @@ export function createWorkSessionTurns({
819
822
  // chat does not (workTurnShape.mjs).
820
823
  display: shape.display,
821
824
  runtime: rt.id,
822
- label: c.cyan('[tab]'),
825
+ work: sessionWork(job),
823
826
  // Only codex announces one (thread.started); held here so the id
824
827
  // this turn actually SPOKE under is what gets persisted after it
825
828
  // ends. Last write wins on purpose: a failed resume that fell
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flowviant",
3
- "version": "0.125.7",
3
+ "version": "0.125.9",
4
4
  "description": "Run your own coding CLIs as build agents for Flowviant \u2014 Claude Code, Codex or Antigravity, on your own credentials. Holds your sessions, keeps a worktree per tab, and ships branches on your word.",
5
5
  "type": "module",
6
6
  "bin": {