flowviant 0.103.0 → 0.105.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (141) hide show
  1. package/bin/cli.mjs +87 -474
  2. package/bin/lib/admission.mjs +19 -3
  3. package/bin/lib/agentPlan.mjs +2 -2
  4. package/bin/lib/agentTaskKinds.mjs +130 -0
  5. package/bin/lib/agySessions.mjs +158 -0
  6. package/bin/lib/artifactContracts.mjs +153 -0
  7. package/bin/lib/artifactPolicy.mjs +45 -0
  8. package/bin/lib/artifactPreview.mjs +52 -0
  9. package/bin/lib/artifactReporter.mjs +163 -0
  10. package/bin/lib/artifacts.mjs +49 -228
  11. package/bin/lib/authReject.mjs +16 -4
  12. package/bin/lib/authproxy.mjs +47 -304
  13. package/bin/lib/boxIdentity.mjs +245 -0
  14. package/bin/lib/childEnv.mjs +11 -9
  15. package/bin/lib/claude.mjs +14 -851
  16. package/bin/lib/claudeAuth.mjs +3 -3
  17. package/bin/lib/claudePosture.mjs +370 -0
  18. package/bin/lib/claudeSessions.mjs +411 -0
  19. package/bin/lib/claudeStream.mjs +207 -0
  20. package/bin/lib/cliLimit.mjs +34 -0
  21. package/bin/lib/commandSpecs.mjs +173 -0
  22. package/bin/lib/config.mjs +11 -42
  23. package/bin/lib/credentialDate.mjs +22 -0
  24. package/bin/lib/credentials.mjs +21 -26
  25. package/bin/lib/daemonLogging.mjs +55 -0
  26. package/bin/lib/daemonState.mjs +64 -0
  27. package/bin/lib/deploy.mjs +148 -647
  28. package/bin/lib/deployCheckout.mjs +265 -0
  29. package/bin/lib/deployConfig.mjs +142 -0
  30. package/bin/lib/deployRunner.mjs +311 -0
  31. package/bin/lib/deployWire.mjs +41 -0
  32. package/bin/lib/desktopContract.mjs +56 -105
  33. package/bin/lib/env.mjs +49 -484
  34. package/bin/lib/fleet.mjs +183 -2383
  35. package/bin/lib/fleetJobs.mjs +120 -0
  36. package/bin/lib/fleetPost.mjs +40 -0
  37. package/bin/lib/fleetReports.mjs +392 -0
  38. package/bin/lib/fleetRoster.mjs +470 -0
  39. package/bin/lib/fleetStartup.mjs +196 -0
  40. package/bin/lib/fleetWake.mjs +45 -0
  41. package/bin/lib/fleetWire.mjs +46 -0
  42. package/bin/lib/git.mjs +2 -2
  43. package/bin/lib/gitMergeIdentity.mjs +51 -0
  44. package/bin/lib/grant.mjs +5 -3
  45. package/bin/lib/help.mjs +3 -125
  46. package/bin/lib/holder.mjs +482 -0
  47. package/bin/lib/instance.mjs +124 -46
  48. package/bin/lib/knowledge.mjs +16 -799
  49. package/bin/lib/knowledgeFetch.mjs +38 -0
  50. package/bin/lib/knowledgeFileSync.mjs +112 -0
  51. package/bin/lib/knowledgeFiles.mjs +489 -0
  52. package/bin/lib/knowledgeLibrary.mjs +299 -0
  53. package/bin/lib/landed.mjs +2 -1
  54. package/bin/lib/listeners.mjs +99 -141
  55. package/bin/lib/localSessions.mjs +30 -555
  56. package/bin/lib/login.mjs +3 -2
  57. package/bin/lib/loginPath.mjs +3 -5
  58. package/bin/lib/machineDisconnect.mjs +203 -0
  59. package/bin/lib/machineEnv.mjs +22 -0
  60. package/bin/lib/machineLimits.mjs +61 -0
  61. package/bin/lib/machineListing.mjs +338 -0
  62. package/bin/lib/machines.mjs +78 -455
  63. package/bin/lib/machinesCommand.mjs +214 -0
  64. package/bin/lib/mcp-cli.mjs +2 -1
  65. package/bin/lib/patchRevert.mjs +60 -0
  66. package/bin/lib/prWorkflow.mjs +157 -0
  67. package/bin/lib/preflight.mjs +2 -1
  68. package/bin/lib/pressurePolicy.mjs +104 -0
  69. package/bin/lib/preview.mjs +2 -272
  70. package/bin/lib/previewFramePolicy.mjs +112 -0
  71. package/bin/lib/previewGatePolicy.mjs +236 -0
  72. package/bin/lib/previewRegistry.mjs +235 -0
  73. package/bin/lib/printable.mjs +2 -2
  74. package/bin/lib/procRegistry.mjs +28 -18
  75. package/bin/lib/procScan.mjs +146 -0
  76. package/bin/lib/processes.mjs +29 -37
  77. package/bin/lib/projectToolRuntimes.mjs +138 -0
  78. package/bin/lib/projectTools.mjs +13 -88
  79. package/bin/lib/prompts.mjs +105 -139
  80. package/bin/lib/repoPath.mjs +26 -0
  81. package/bin/lib/resources.mjs +7 -69
  82. package/bin/lib/resumeLost.mjs +107 -0
  83. package/bin/lib/runTurn.mjs +324 -0
  84. package/bin/lib/runtimeAntigravity.mjs +230 -0
  85. package/bin/lib/runtimeCapabilities.mjs +334 -0
  86. package/bin/lib/runtimeClaude.mjs +126 -0
  87. package/bin/lib/runtimeCodex.mjs +217 -0
  88. package/bin/lib/runtimeDetection.mjs +121 -0
  89. package/bin/lib/runtimeEvents.mjs +482 -0
  90. package/bin/lib/runtimeOfferings.mjs +4 -1
  91. package/bin/lib/runtimes.mjs +42 -1402
  92. package/bin/lib/safeFileName.mjs +74 -0
  93. package/bin/lib/standDownExit.mjs +181 -0
  94. package/bin/lib/standDownGate.mjs +48 -0
  95. package/bin/lib/startProject.mjs +279 -0
  96. package/bin/lib/trace.mjs +3 -3
  97. package/bin/lib/turnLock.mjs +68 -0
  98. package/bin/lib/turnProfile.mjs +77 -0
  99. package/bin/lib/uninstall.mjs +55 -45
  100. package/bin/lib/uninstallCopies.mjs +112 -0
  101. package/bin/lib/update.mjs +30 -17
  102. package/bin/lib/uplinkScrub.mjs +265 -0
  103. package/bin/lib/vault.mjs +22 -151
  104. package/bin/lib/vaultDiff.mjs +183 -0
  105. package/bin/lib/versionOrder.mjs +42 -0
  106. package/bin/lib/views.mjs +17 -17
  107. package/bin/lib/wikiRunner.mjs +630 -0
  108. package/bin/lib/work.mjs +188 -3034
  109. package/bin/lib/workAdoptCarry.mjs +94 -0
  110. package/bin/lib/workAgentCheck.mjs +278 -0
  111. package/bin/lib/workAgentMerges.mjs +54 -142
  112. package/bin/lib/workAgentPlans.mjs +14 -12
  113. package/bin/lib/workAgentPrecheck.mjs +393 -0
  114. package/bin/lib/workAgentPublish.mjs +177 -0
  115. package/bin/lib/workAgentReview.mjs +8 -666
  116. package/bin/lib/workAgentTurnBegun.mjs +109 -0
  117. package/bin/lib/workAgentTurnExecution.mjs +604 -0
  118. package/bin/lib/workAgentTurnOutcome.mjs +219 -0
  119. package/bin/lib/workAgentTurnReports.mjs +189 -0
  120. package/bin/lib/workAgentTurns.mjs +91 -898
  121. package/bin/lib/workAttachments.mjs +93 -0
  122. package/bin/lib/workBrain.mjs +53 -0
  123. package/bin/lib/workChildren.mjs +110 -0
  124. package/bin/lib/workCommandAudit.mjs +62 -0
  125. package/bin/lib/workDiffs.mjs +2 -1
  126. package/bin/lib/workNarration.mjs +152 -0
  127. package/bin/lib/workPlaceReports.mjs +426 -0
  128. package/bin/lib/workPlaces.mjs +228 -0
  129. package/bin/lib/workPreviews.mjs +31 -9
  130. package/bin/lib/workProcesses.mjs +4 -5
  131. package/bin/lib/workPullRequests.mjs +52 -126
  132. package/bin/lib/workReportQueue.mjs +254 -0
  133. package/bin/lib/workRetire.mjs +185 -0
  134. package/bin/lib/workSessionGroups.mjs +166 -0
  135. package/bin/lib/workSessionRuntime.mjs +164 -0
  136. package/bin/lib/workSessionTokens.mjs +68 -0
  137. package/bin/lib/workSessionTurns.mjs +892 -0
  138. package/bin/lib/workShip.mjs +9 -29
  139. package/bin/lib/workToolLog.mjs +76 -0
  140. package/package.json +3 -2
  141. package/bin/lib/patch.mjs +0 -363
@@ -0,0 +1,42 @@
1
+ /**
2
+ * VERSION ORDER — the one parser and comparator every version decision on this
3
+ * box uses: the takeover downgrade guard (instance.mjs), the self-update
4
+ * signals (update.mjs, fleet.mjs), the behind marks in the read-only views
5
+ * (views.mjs) and the newest nvm Node (loginPath.mjs).
6
+ *
7
+ * Split out (SOLID F005) because four hand-written rules disagreed on a
8
+ * version they could not read: one called it EQUAL, one called each
9
+ * unreadable part ZERO, one called it "not older", one never asked. A
10
+ * comparison now answers UNKNOWN (`null`) out loud, and each caller states its
11
+ * own policy for it. Every policy so far is the house one: unknown gates
12
+ * nothing (the takeover guard refuses only a measured downgrade).
13
+ *
14
+ * What parses: an optional leading `v`, one to three dot-separated decimal
15
+ * parts (a missing minor or patch reads as zero — `0.57` is `0.57.0`, the
16
+ * legacy shape the update tests pin), and an optional `-prerelease`/`+build`
17
+ * tail, which orders nothing (every rule this replaced ignored it too).
18
+ * Anything else — a letter inside a part, a fourth part, an empty string — is
19
+ * unknown.
20
+ */
21
+ const VERSION_RE = /^v?(\d+)(?:\.(\d+))?(?:\.(\d+))?(?:[-+][0-9A-Za-z.+-]*)?$/;
22
+
23
+ /** `[major, minor, patch]`, or null when the text is not a version. */
24
+ export function parseVersion(v) {
25
+ if (typeof v !== 'string' && typeof v !== 'number') return null;
26
+ const m = VERSION_RE.exec(String(v).trim());
27
+ if (!m) return null;
28
+ const parts = [m[1], m[2] ?? '0', m[3] ?? '0'].map(Number);
29
+ return parts.every(Number.isSafeInteger) ? parts : null;
30
+ }
31
+
32
+ /** -1 | 0 | 1, or null (UNKNOWN) when either side does not parse. */
33
+ export function compareVersions(a, b) {
34
+ const x = parseVersion(a);
35
+ const y = parseVersion(b);
36
+ if (!x || !y) return null;
37
+ for (let i = 0; i < 3; i++) if (x[i] !== y[i]) return x[i] > y[i] ? 1 : -1;
38
+ return 0;
39
+ }
40
+
41
+ /** True only when BOTH parse and `a` is strictly older. Unknown is not older. */
42
+ export const versionBelow = (a, b) => compareVersions(a, b) === -1;
package/bin/lib/views.mjs CHANGED
@@ -11,22 +11,19 @@ import { execFileSync, spawn } from 'node:child_process';
11
11
  import { closeSync, existsSync, openSync, readSync, statSync } from 'node:fs';
12
12
  import { FLEET_URL, USER_AGENT, VERSION } from './config.mjs';
13
13
  import { detectRepoRoot, listStoredProjects, projectLabel, resolveStoredCredential } from './credentials.mjs';
14
- import { daemonLogPath, desktopStatusRemote, installChannel } from './desktopContract.mjs';
14
+ import { desktopStatusRemote, installChannel } from './desktopContract.mjs';
15
+ import { daemonLogPath } from './daemonState.mjs';
15
16
  import { daemonRunningFor } from './instance.mjs';
16
- import { agoFrom } from './machines.mjs';
17
- import { detectRuntimes } from './runtimes.mjs';
17
+ import { agoFrom } from './machineListing.mjs';
18
+ import { detectRuntimes } from './runtimeDetection.mjs';
18
19
  import { c } from './ui.mjs';
20
+ import { versionBelow } from './versionOrder.mjs';
19
21
 
20
22
  const APP_URL = process.env.FLOWVIANT_APP_URL || 'https://app.flowviant.com';
21
23
 
22
- function olderVersion(version, latest) {
23
- const parse = (v) => /^v?(\d+)\.(\d+)\.(\d+)/.exec(String(v ?? ''))?.slice(1, 4).map(Number);
24
- const a = parse(version);
25
- const b = parse(latest);
26
- if (!a || !b) return false;
27
- for (let i = 0; i < 3; i++) if (a[i] !== b[i]) return a[i] < b[i];
28
- return false;
29
- }
24
+ // "Behind" in these views is versionBelow (versionOrder.mjs): an unreadable
25
+ // version is never marked older — a read-only view states nothing it cannot
26
+ // measure.
30
27
 
31
28
  function agentLine(agent, now) {
32
29
  if (agent.asks) return `${agent.name} · ${c.yellow('asks you a question')}`;
@@ -69,7 +66,7 @@ export function renderStatus(status, { now = Date.now() } = {}) {
69
66
  if (rt.parkedByLimit && rt.message) lines.push(label('limit', `${rt.id} hit its limit: “${rt.message}”`));
70
67
  }
71
68
  const version = remote?.daemonVersion ?? status.version;
72
- if (remote?.latest && olderVersion(version, remote.latest)) {
69
+ if (remote?.latest && versionBelow(version, remote.latest)) {
73
70
  lines.push(label('update', `flowviant ${remote.latest} is out; this computer runs ${version}. It updates itself when idle.`));
74
71
  }
75
72
  lines.push('');
@@ -200,17 +197,20 @@ export async function runDoctor({ cwd = process.cwd(), fetchImpl = fetch } = {})
200
197
  // and a global npm install that needed sudo cannot update itself.
201
198
  try {
202
199
  const { buildUninstallPlan } = await import('./uninstall.mjs');
200
+ const { copyKind } = await import('./uninstallCopies.mjs');
203
201
  const plan = await buildUninstallPlan();
204
- const copies = plan.copies.filter((copy) => copy.kind !== 'path-line');
202
+ // Copies a daemon can run from; an rc file's PATH line is not one.
203
+ const copies = plan.copies.filter((copy) => copyKind(copy.kind).runsFrom);
205
204
  for (const copy of copies) {
206
- const where = copy.kind === 'npm-global' ? 'npm global' : copy.kind === 'npx-cache' ? 'npx cache' : 'binary';
205
+ const kind = copyKind(copy.kind);
206
+ const where = kind.label;
207
207
  const running = copy.runningPid ? `, a daemon runs from it (pid ${copy.runningPid})` : '';
208
- const older = copy.version && olderVersion(copy.version, VERSION);
208
+ const older = copy.version && versionBelow(copy.version, VERSION);
209
209
  const text = `flowviant ${copy.version ?? '(unknown version)'} · ${where} · ${copy.path}${copy.current ? ' (this one)' : ''}${running}`;
210
210
  if (older && copy.runningPid) {
211
- add(false, text, `An older daemon is serving. Run \`flowviant stop\`, then \`flowviant uninstall --others\`${copy.kind === 'npm-global' ? ' (if npm refuses, `sudo npm uninstall -g flowviant`)' : ''}, then start flowviant again.`);
211
+ add(false, text, `An older daemon is serving. Run \`flowviant stop\`, then \`flowviant uninstall --others\`${kind.removeHint}, then start flowviant again.`);
212
212
  } else if (older) {
213
- add(false, text, `An older copy. Remove it with \`flowviant uninstall --others\`${copy.kind === 'npm-global' ? ' (if npm refuses, `sudo npm uninstall -g flowviant`)' : ''}.`);
213
+ add(false, text, `An older copy. Remove it with \`flowviant uninstall --others\`${kind.removeHint}.`);
214
214
  } else {
215
215
  add(true, text);
216
216
  }