flowviant 0.103.0 → 0.104.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.
- package/bin/cli.mjs +87 -474
- package/bin/lib/admission.mjs +19 -3
- package/bin/lib/agentPlan.mjs +2 -2
- package/bin/lib/agentTaskKinds.mjs +93 -0
- package/bin/lib/agySessions.mjs +158 -0
- package/bin/lib/artifactPolicy.mjs +44 -0
- package/bin/lib/artifactPreview.mjs +52 -0
- package/bin/lib/artifactReporter.mjs +163 -0
- package/bin/lib/artifacts.mjs +47 -227
- package/bin/lib/authReject.mjs +16 -4
- package/bin/lib/authproxy.mjs +47 -304
- package/bin/lib/boxIdentity.mjs +245 -0
- package/bin/lib/childEnv.mjs +11 -9
- package/bin/lib/claude.mjs +14 -851
- package/bin/lib/claudeAuth.mjs +3 -3
- package/bin/lib/claudePosture.mjs +367 -0
- package/bin/lib/claudeSessions.mjs +411 -0
- package/bin/lib/claudeStream.mjs +207 -0
- package/bin/lib/cliLimit.mjs +34 -0
- package/bin/lib/commandSpecs.mjs +173 -0
- package/bin/lib/config.mjs +11 -42
- package/bin/lib/credentialDate.mjs +22 -0
- package/bin/lib/credentials.mjs +21 -26
- package/bin/lib/daemonLogging.mjs +55 -0
- package/bin/lib/daemonState.mjs +64 -0
- package/bin/lib/deploy.mjs +148 -647
- package/bin/lib/deployCheckout.mjs +265 -0
- package/bin/lib/deployConfig.mjs +142 -0
- package/bin/lib/deployRunner.mjs +311 -0
- package/bin/lib/deployWire.mjs +41 -0
- package/bin/lib/desktopContract.mjs +56 -105
- package/bin/lib/env.mjs +49 -484
- package/bin/lib/fleet.mjs +183 -2383
- package/bin/lib/fleetJobs.mjs +120 -0
- package/bin/lib/fleetPost.mjs +40 -0
- package/bin/lib/fleetReports.mjs +392 -0
- package/bin/lib/fleetRoster.mjs +470 -0
- package/bin/lib/fleetStartup.mjs +196 -0
- package/bin/lib/fleetWake.mjs +45 -0
- package/bin/lib/fleetWire.mjs +46 -0
- package/bin/lib/git.mjs +2 -2
- package/bin/lib/gitMergeIdentity.mjs +51 -0
- package/bin/lib/grant.mjs +5 -3
- package/bin/lib/help.mjs +3 -125
- package/bin/lib/holder.mjs +482 -0
- package/bin/lib/instance.mjs +124 -46
- package/bin/lib/knowledge.mjs +16 -799
- package/bin/lib/knowledgeFetch.mjs +38 -0
- package/bin/lib/knowledgeFileSync.mjs +112 -0
- package/bin/lib/knowledgeFiles.mjs +487 -0
- package/bin/lib/knowledgeLibrary.mjs +249 -0
- package/bin/lib/landed.mjs +2 -1
- package/bin/lib/listeners.mjs +99 -141
- package/bin/lib/localSessions.mjs +30 -555
- package/bin/lib/login.mjs +3 -2
- package/bin/lib/loginPath.mjs +3 -5
- package/bin/lib/machineDisconnect.mjs +203 -0
- package/bin/lib/machineEnv.mjs +22 -0
- package/bin/lib/machineLimits.mjs +61 -0
- package/bin/lib/machineListing.mjs +338 -0
- package/bin/lib/machines.mjs +78 -455
- package/bin/lib/machinesCommand.mjs +214 -0
- package/bin/lib/mcp-cli.mjs +2 -1
- package/bin/lib/patchRevert.mjs +60 -0
- package/bin/lib/prWorkflow.mjs +157 -0
- package/bin/lib/preflight.mjs +2 -1
- package/bin/lib/pressurePolicy.mjs +104 -0
- package/bin/lib/preview.mjs +2 -272
- package/bin/lib/previewFramePolicy.mjs +112 -0
- package/bin/lib/previewGatePolicy.mjs +236 -0
- package/bin/lib/previewRegistry.mjs +235 -0
- package/bin/lib/printable.mjs +2 -2
- package/bin/lib/procRegistry.mjs +28 -18
- package/bin/lib/procScan.mjs +146 -0
- package/bin/lib/processes.mjs +29 -37
- package/bin/lib/projectToolRuntimes.mjs +138 -0
- package/bin/lib/projectTools.mjs +13 -88
- package/bin/lib/prompts.mjs +28 -42
- package/bin/lib/repoPath.mjs +26 -0
- package/bin/lib/resources.mjs +7 -69
- package/bin/lib/resumeLost.mjs +107 -0
- package/bin/lib/runTurn.mjs +324 -0
- package/bin/lib/runtimeAntigravity.mjs +230 -0
- package/bin/lib/runtimeCapabilities.mjs +334 -0
- package/bin/lib/runtimeClaude.mjs +126 -0
- package/bin/lib/runtimeCodex.mjs +217 -0
- package/bin/lib/runtimeDetection.mjs +121 -0
- package/bin/lib/runtimeEvents.mjs +482 -0
- package/bin/lib/runtimeOfferings.mjs +4 -1
- package/bin/lib/runtimes.mjs +42 -1402
- package/bin/lib/safeFileName.mjs +74 -0
- package/bin/lib/standDownExit.mjs +181 -0
- package/bin/lib/standDownGate.mjs +48 -0
- package/bin/lib/startProject.mjs +279 -0
- package/bin/lib/trace.mjs +3 -3
- package/bin/lib/turnLock.mjs +68 -0
- package/bin/lib/turnProfile.mjs +77 -0
- package/bin/lib/uninstall.mjs +55 -45
- package/bin/lib/uninstallCopies.mjs +112 -0
- package/bin/lib/update.mjs +30 -17
- package/bin/lib/uplinkScrub.mjs +265 -0
- package/bin/lib/vault.mjs +22 -151
- package/bin/lib/vaultDiff.mjs +183 -0
- package/bin/lib/versionOrder.mjs +42 -0
- package/bin/lib/views.mjs +17 -17
- package/bin/lib/wikiRunner.mjs +630 -0
- package/bin/lib/work.mjs +188 -3034
- package/bin/lib/workAdoptCarry.mjs +94 -0
- package/bin/lib/workAgentCheck.mjs +278 -0
- package/bin/lib/workAgentMerges.mjs +54 -142
- package/bin/lib/workAgentPlans.mjs +14 -12
- package/bin/lib/workAgentPrecheck.mjs +393 -0
- package/bin/lib/workAgentPublish.mjs +177 -0
- package/bin/lib/workAgentReview.mjs +8 -666
- package/bin/lib/workAgentTurnBegun.mjs +109 -0
- package/bin/lib/workAgentTurnExecution.mjs +604 -0
- package/bin/lib/workAgentTurnOutcome.mjs +207 -0
- package/bin/lib/workAgentTurnReports.mjs +189 -0
- package/bin/lib/workAgentTurns.mjs +91 -898
- package/bin/lib/workAttachments.mjs +93 -0
- package/bin/lib/workBrain.mjs +53 -0
- package/bin/lib/workChildren.mjs +110 -0
- package/bin/lib/workCommandAudit.mjs +62 -0
- package/bin/lib/workDiffs.mjs +2 -1
- package/bin/lib/workNarration.mjs +152 -0
- package/bin/lib/workPlaceReports.mjs +426 -0
- package/bin/lib/workPlaces.mjs +228 -0
- package/bin/lib/workPreviews.mjs +31 -9
- package/bin/lib/workProcesses.mjs +4 -5
- package/bin/lib/workPullRequests.mjs +52 -126
- package/bin/lib/workReportQueue.mjs +254 -0
- package/bin/lib/workRetire.mjs +185 -0
- package/bin/lib/workSessionGroups.mjs +166 -0
- package/bin/lib/workSessionRuntime.mjs +164 -0
- package/bin/lib/workSessionTokens.mjs +68 -0
- package/bin/lib/workSessionTurns.mjs +892 -0
- package/bin/lib/workShip.mjs +9 -29
- package/bin/lib/workToolLog.mjs +76 -0
- package/package.json +3 -2
- package/bin/lib/patch.mjs +0 -363
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* THE BEGUN-GUARD: may this box run a turn the server says has BEGUN?
|
|
3
|
+
*
|
|
4
|
+
* Split out of workAgentTurns.mjs (SOLID F036, 2026-09-26). It is one rule
|
|
5
|
+
* with its own measurements — the agent's directory, its branch ref read in
|
|
6
|
+
* three states, and the published branch fetched as the fallback — and none of
|
|
7
|
+
* it is about running a CLI or reporting one. It answers before a worktree can
|
|
8
|
+
* be cut, which is the whole point of it (`placeWtFor` would otherwise cut a
|
|
9
|
+
* rival branch of the same name), so the caller gates on `job.begun` and asks
|
|
10
|
+
* here before `placeWtFor`.
|
|
11
|
+
*
|
|
12
|
+
* It RETURNS the sentence and does not post it: the settle is the caller's,
|
|
13
|
+
* through the one turn-done wire (workAgentTurnReports.mjs). Null means go on.
|
|
14
|
+
*/
|
|
15
|
+
import { existsSync } from 'node:fs';
|
|
16
|
+
import { join } from 'node:path';
|
|
17
|
+
import { git } from './git.mjs';
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* WORK THAT HAS BEGUN LIVES ON EXACTLY ONE BOX, AND THIS MAY NOT BE IT.
|
|
21
|
+
*
|
|
22
|
+
* A project has ONE machine credential and every device is handed the same
|
|
23
|
+
* raw token, so two boxes can both be polling for the same agents. Nothing
|
|
24
|
+
* pushes an agent's branch before approve, so a turn that has already run
|
|
25
|
+
* somewhere has its worktree, its branch and its CONVERSATION on that box's
|
|
26
|
+
* disk and nowhere else. `placeWtFor` cannot tell the difference: it finds
|
|
27
|
+
* no directory, cuts a fresh `session/a-<id>` off base, and the CLI starts
|
|
28
|
+
* with no memory of the card — a confident, context-free redo of work
|
|
29
|
+
* somebody is in the middle of, on the operator's shared account, landing
|
|
30
|
+
* on a rival branch of the same name.
|
|
31
|
+
*
|
|
32
|
+
* So: if the server says this agent has BEGUN and this box holds neither
|
|
33
|
+
* its directory nor its branch, refuse before anything is cut. `nothing` is
|
|
34
|
+
* the honest outcome — this machine did not run the turn — and the sentence
|
|
35
|
+
* says what was measured (two absences here, and the box name only when the
|
|
36
|
+
* server recorded one; inferring where the work is would be invention).
|
|
37
|
+
*
|
|
38
|
+
* THE BRANCH ALONE IS ENOUGH TO CONTINUE. `placeWtFor`'s attach fallback
|
|
39
|
+
* re-attaches a worktree to a surviving branch, so a directory somebody
|
|
40
|
+
* cleaned up on THIS box is same-box recovery of real committed work and
|
|
41
|
+
* behaves exactly as it did before this guard existed.
|
|
42
|
+
*
|
|
43
|
+
* The remedy is the stop path and nothing else. "Reconnect the other
|
|
44
|
+
* machine" is not reachable from here once holdership has moved, and a
|
|
45
|
+
* remedy somebody cannot carry out is worse than none.
|
|
46
|
+
*/
|
|
47
|
+
export function begunTurnRefusal(job, place, { baseDir, repoRoot, fetchPublishedBranch }) {
|
|
48
|
+
const wtDir = join(baseDir, 'sessions', place);
|
|
49
|
+
let hasBranch = false;
|
|
50
|
+
/**
|
|
51
|
+
* THREE STATES, AND THE MIDDLE ONE IS WHY THIS IS NOT A BARE CATCH.
|
|
52
|
+
*
|
|
53
|
+
* `rev-parse --verify --quiet` exits 1 and prints nothing for a ref that
|
|
54
|
+
* is not there — that exit code IS the measurement, and it is the one
|
|
55
|
+
* this guard acts on. Any OTHER failure (128 for "not a repository",
|
|
56
|
+
* ENOENT for no git at all, a momentary index lock) measured nothing;
|
|
57
|
+
* collapsing it onto "the branch is absent" would make the daemon assert
|
|
58
|
+
* "this machine does not hold this agent's branch" off a repo it could
|
|
59
|
+
* not read — the guard inventing the very fact it exists to relay.
|
|
60
|
+
*
|
|
61
|
+
* So an unmeasured branch stands the guard DOWN. That re-enters the path
|
|
62
|
+
* this guard is a belt for, which is the fail-open direction it wants;
|
|
63
|
+
* `placeWtFor` is about to fail on the same unreadable repo and say so
|
|
64
|
+
* in its own words, which is the honest sentence.
|
|
65
|
+
*/
|
|
66
|
+
let branchMeasured = true;
|
|
67
|
+
try {
|
|
68
|
+
hasBranch = Boolean(
|
|
69
|
+
git(['rev-parse', '--verify', '--quiet', `refs/heads/session/${place}`], repoRoot)
|
|
70
|
+
);
|
|
71
|
+
} catch (e) {
|
|
72
|
+
if (e?.status === 1) hasBranch = false;
|
|
73
|
+
else branchMeasured = false;
|
|
74
|
+
}
|
|
75
|
+
if (branchMeasured && !existsSync(wtDir) && !hasBranch) {
|
|
76
|
+
/**
|
|
77
|
+
* …UNLESS THE WORK IS ON THE REMOTE (0.86.0).
|
|
78
|
+
*
|
|
79
|
+
* The guard's premise was "nothing pushes an agent's branch before
|
|
80
|
+
* approve", and a project that publishes has changed exactly that
|
|
81
|
+
* third of it: the COMMITS are on `origin` under `flowviant/`, so a
|
|
82
|
+
* box that holds neither the directory nor the branch can fetch them
|
|
83
|
+
* and continue the work instead of redoing it. The other two thirds
|
|
84
|
+
* are untouched — the conversation still does not move, which is why
|
|
85
|
+
* the kickoff re-prompts from the card either way.
|
|
86
|
+
*
|
|
87
|
+
* The refusal below is still the fallback, and it is the fallback for
|
|
88
|
+
* BOTH shapes of failure: a project that does not publish (no ref,
|
|
89
|
+
* sentence unchanged) and a fetch that could not land (sentence
|
|
90
|
+
* extended with git's own reason, because "this machine does not hold
|
|
91
|
+
* it" alone would hide that we tried and how it went).
|
|
92
|
+
*/
|
|
93
|
+
const fetched = fetchPublishedBranch(place, job.publishedRef);
|
|
94
|
+
if (!fetched?.ok) {
|
|
95
|
+
const on = typeof job.begunOn === 'string' && job.begunOn.trim()
|
|
96
|
+
? job.begunOn.trim().slice(0, 64)
|
|
97
|
+
: null;
|
|
98
|
+
return (
|
|
99
|
+
`This machine does not hold this agent's worktree or branch${on ? ` — its work is on ${on}` : ''}. ` +
|
|
100
|
+
'Stop the agent to re-plan it here.' +
|
|
101
|
+
(fetched ? ` Its published branch could not be fetched (${fetched.why}).` : '')
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
// The branch is here and measured. `placeWtFor`'s attach fallback
|
|
105
|
+
// opens a worktree on it below — the same path a directory somebody
|
|
106
|
+
// cleaned up already takes, on commits this box now genuinely holds.
|
|
107
|
+
}
|
|
108
|
+
return null;
|
|
109
|
+
}
|