looply-cli 0.5.4 → 0.5.6
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/dist/.src-hash +1 -1
- package/dist/autonomy-controller.d.ts +14 -1
- package/dist/autonomy-controller.d.ts.map +1 -1
- package/dist/autonomy-controller.js +55 -2
- package/dist/autonomy-controller.js.map +1 -1
- package/dist/autonomy-store.d.ts +35 -2
- package/dist/autonomy-store.d.ts.map +1 -1
- package/dist/autonomy-store.js +27 -2
- package/dist/autonomy-store.js.map +1 -1
- package/dist/autonomy-tick.d.ts +25 -2
- package/dist/autonomy-tick.d.ts.map +1 -1
- package/dist/autonomy-tick.js +122 -4
- package/dist/autonomy-tick.js.map +1 -1
- package/dist/bin.d.ts.map +1 -1
- package/dist/bin.js +2 -0
- package/dist/bin.js.map +1 -1
- package/dist/checkout-carry.d.ts +2 -0
- package/dist/checkout-carry.d.ts.map +1 -1
- package/dist/checkout-carry.js +37 -2
- package/dist/checkout-carry.js.map +1 -1
- package/dist/config.d.ts +41 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +40 -7
- package/dist/config.js.map +1 -1
- package/dist/coordinator-state.d.ts +14 -0
- package/dist/coordinator-state.d.ts.map +1 -1
- package/dist/coordinator-state.js +29 -0
- package/dist/coordinator-state.js.map +1 -1
- package/dist/daemon-cmd.d.ts +1 -1
- package/dist/daemon-cmd.d.ts.map +1 -1
- package/dist/daemon-cmd.js +56 -33
- package/dist/daemon-cmd.js.map +1 -1
- package/dist/git-driver.d.ts +6 -0
- package/dist/git-driver.d.ts.map +1 -1
- package/dist/git-driver.js +12 -0
- package/dist/git-driver.js.map +1 -1
- package/dist/goal-adaptive.d.ts +12 -0
- package/dist/goal-adaptive.d.ts.map +1 -1
- package/dist/goal-adaptive.js +19 -4
- package/dist/goal-adaptive.js.map +1 -1
- package/dist/goal-compile.d.ts +7 -0
- package/dist/goal-compile.d.ts.map +1 -1
- package/dist/goal-compile.js +3 -0
- package/dist/goal-compile.js.map +1 -1
- package/dist/goal-execution-evidence.d.ts +28 -2
- package/dist/goal-execution-evidence.d.ts.map +1 -1
- package/dist/goal-execution-evidence.js +30 -5
- package/dist/goal-execution-evidence.js.map +1 -1
- package/dist/goal-reproof.d.ts +42 -0
- package/dist/goal-reproof.d.ts.map +1 -0
- package/dist/goal-reproof.js +35 -0
- package/dist/goal-reproof.js.map +1 -0
- package/dist/index-for-head.js +1 -1
- package/dist/index-for-head.js.map +1 -1
- package/dist/machine-run-slots.d.ts +59 -0
- package/dist/machine-run-slots.d.ts.map +1 -0
- package/dist/machine-run-slots.js +140 -0
- package/dist/machine-run-slots.js.map +1 -0
- package/dist/plan-recovery.d.ts +70 -0
- package/dist/plan-recovery.d.ts.map +1 -0
- package/dist/plan-recovery.js +131 -0
- package/dist/plan-recovery.js.map +1 -0
- package/dist/programme-mode.d.ts +6 -0
- package/dist/programme-mode.d.ts.map +1 -1
- package/dist/programme-mode.js +23 -0
- package/dist/programme-mode.js.map +1 -1
- package/dist/project-index-store.d.ts +19 -1
- package/dist/project-index-store.d.ts.map +1 -1
- package/dist/project-index-store.js +40 -5
- package/dist/project-index-store.js.map +1 -1
- package/dist/project-terminal.d.ts +25 -0
- package/dist/project-terminal.d.ts.map +1 -0
- package/dist/project-terminal.js +46 -0
- package/dist/project-terminal.js.map +1 -0
- package/dist/pursuit-ending.d.ts +57 -0
- package/dist/pursuit-ending.d.ts.map +1 -0
- package/dist/pursuit-ending.js +128 -0
- package/dist/pursuit-ending.js.map +1 -0
- package/dist/run-base.d.ts +84 -0
- package/dist/run-base.d.ts.map +1 -0
- package/dist/run-base.js +142 -0
- package/dist/run-base.js.map +1 -0
- package/dist/run-cmd.d.ts.map +1 -1
- package/dist/run-cmd.js +110 -14
- package/dist/run-cmd.js.map +1 -1
- package/dist/run-ended.d.ts +16 -0
- package/dist/run-ended.d.ts.map +1 -1
- package/dist/run-ended.js +30 -0
- package/dist/run-ended.js.map +1 -1
- package/dist/run-ending-locator.d.ts +10 -0
- package/dist/run-ending-locator.d.ts.map +1 -1
- package/dist/run-ending-locator.js +45 -0
- package/dist/run-ending-locator.js.map +1 -1
- package/dist/run-launcher.d.ts +17 -1
- package/dist/run-launcher.d.ts.map +1 -1
- package/dist/run-launcher.js +36 -5
- package/dist/run-launcher.js.map +1 -1
- package/dist/server-client.d.ts +5 -1
- package/dist/server-client.d.ts.map +1 -1
- package/dist/server-client.js +1 -0
- package/dist/server-client.js.map +1 -1
- package/dist/setup.d.ts.map +1 -1
- package/dist/setup.js +17 -0
- package/dist/setup.js.map +1 -1
- package/dist/workspace-provisioner.d.ts +2 -0
- package/dist/workspace-provisioner.d.ts.map +1 -1
- package/dist/workspace-provisioner.js +27 -1
- package/dist/workspace-provisioner.js.map +1 -1
- package/package.json +54 -54
- package/win/HandleProbe.cs +116 -116
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import type { LaneClaimRecord } from './lane-claims';
|
|
2
|
+
/**
|
|
3
|
+
* WHERE A RUN IN A MACHINE-MADE CHECKOUT IS CUT FROM.
|
|
4
|
+
*
|
|
5
|
+
* ─────────────────────────────────────────────────────────────────────────────
|
|
6
|
+
* Without this a run's branch is cut from wherever HEAD is, and in a checkout
|
|
7
|
+
* the machine reuses HEAD is the PREVIOUS run's branch — so ticket N+1 stacked
|
|
8
|
+
* on ticket N, and nothing could be reviewed on its own. Now, in a checkout the
|
|
9
|
+
* machine made (never the person's own checkout), a run is cut from:
|
|
10
|
+
*
|
|
11
|
+
* 1. HEAD, when this checkout's last cut was for THE SAME GOAL — a goal's
|
|
12
|
+
* later Starts continue its own work (the coordinator keeps a goal's plan
|
|
13
|
+
* checkout for it, F28), and the goal-gap / "looks done" checks read this
|
|
14
|
+
* checkout, so they judge that goal's own tree;
|
|
15
|
+
* 1b. the goal's OWN recorded work (its newest delivered commit, else the branch
|
|
16
|
+
* its run claimed) when it lands in a different checkout — a retired home;
|
|
17
|
+
* 2. the delivered tip of the goal it depends on, when it depends on exactly
|
|
18
|
+
* ONE goal — B builds on A's work, not on a base that lacks it;
|
|
19
|
+
* 3. the project's base branch otherwise (`run.base_branch`, else the
|
|
20
|
+
* repository's default branch) — so independent tickets never stack;
|
|
21
|
+
* 4. HEAD as before, said out loud, when no base can be found.
|
|
22
|
+
*
|
|
23
|
+
* ⚠️ THE MARKER IS PER CHECKOUT (`checkout-goal.json` in its own state dir),
|
|
24
|
+
* written at the cut, and it is the only memory this needs: which goal this
|
|
25
|
+
* tree's HEAD belongs to.
|
|
26
|
+
*/
|
|
27
|
+
export declare const CHECKOUT_GOAL_MARKER = "checkout-goal.json";
|
|
28
|
+
export interface CheckoutGoal {
|
|
29
|
+
readonly goalId: string | null;
|
|
30
|
+
readonly branch: string;
|
|
31
|
+
readonly at: string;
|
|
32
|
+
}
|
|
33
|
+
export declare function readCheckoutGoal(stateDir: string): CheckoutGoal | null;
|
|
34
|
+
export declare function writeCheckoutGoal(stateDir: string, marker: CheckoutGoal): void;
|
|
35
|
+
/** The slice of git this needs; every verb is a read. */
|
|
36
|
+
export interface BaseGit {
|
|
37
|
+
remoteHeadBranch(): Promise<string | null>;
|
|
38
|
+
refExists(ref: string): Promise<boolean>;
|
|
39
|
+
isAncestor(ancestor: string, of: string): Promise<boolean>;
|
|
40
|
+
listWorktrees(): Promise<Array<{
|
|
41
|
+
path: string;
|
|
42
|
+
head: string;
|
|
43
|
+
branch: string | null;
|
|
44
|
+
}>>;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* The project's base branch: `configured` when it names a ref that exists; else
|
|
48
|
+
* the remote's default branch (`origin/HEAD`) — as the LOCAL branch of that name
|
|
49
|
+
* unless the remote one is strictly newer; else the branch the main checkout is
|
|
50
|
+
* on (unless that is one of looply's own). Null when none can be found.
|
|
51
|
+
*/
|
|
52
|
+
export declare function resolveBaseBranch(git: BaseGit, configured?: string): Promise<{
|
|
53
|
+
readonly ref: string;
|
|
54
|
+
readonly because: string;
|
|
55
|
+
} | null>;
|
|
56
|
+
export type CutPoint = {
|
|
57
|
+
readonly kind: 'continue';
|
|
58
|
+
readonly because: string;
|
|
59
|
+
} | {
|
|
60
|
+
readonly kind: 'dependency';
|
|
61
|
+
readonly ref: string;
|
|
62
|
+
readonly because: string;
|
|
63
|
+
} | {
|
|
64
|
+
readonly kind: 'base';
|
|
65
|
+
readonly ref: string;
|
|
66
|
+
readonly because: string;
|
|
67
|
+
} | {
|
|
68
|
+
readonly kind: 'head';
|
|
69
|
+
readonly because: string;
|
|
70
|
+
};
|
|
71
|
+
export interface CutInput {
|
|
72
|
+
/** The goal this run is bound to, if any. */
|
|
73
|
+
readonly goalId?: string;
|
|
74
|
+
/** That goal's dependencies, as the mirror holds them. */
|
|
75
|
+
readonly dependsOn?: readonly string[];
|
|
76
|
+
/** Which goal this checkout's HEAD belongs to (`readCheckoutGoal`). */
|
|
77
|
+
readonly checkout: CheckoutGoal | null;
|
|
78
|
+
/** The machine's lane-claim records (`readLaneClaims`). */
|
|
79
|
+
readonly claims: readonly LaneClaimRecord[];
|
|
80
|
+
readonly configuredBase?: string;
|
|
81
|
+
}
|
|
82
|
+
/** Decide where this run's branch starts. Never throws: an unreadable answer degrades to HEAD, said. */
|
|
83
|
+
export declare function cutPointFor(git: BaseGit, input: CutInput): Promise<CutPoint>;
|
|
84
|
+
//# sourceMappingURL=run-base.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-base.d.ts","sourceRoot":"","sources":["../src/run-base.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAErD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,eAAO,MAAM,oBAAoB,uBAAuB,CAAC;AAEzD,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,EAAE,EAAE,MAAM,CA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AAO,EAAE,MAAM,CAAA;CAAE,GACzE;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAExD,MAAM,WAAW,QAAQ;IACvB,6CAA6C;IAC7C,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,0DAA0D;IAC1D,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACvC,uEAAuE;IACvE,QAAQ,CAAC,QAAQ,EAAE,YAAY,GAAG,IAAI,CAAC;IACvC,2DAA2D;IAC3D,QAAQ,CAAC,MAAM,EAAE,SAAS,eAAe,EAAE,CAAC;IAC5C,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;CAClC;AAED,wGAAwG;AACxG,wBAAsB,WAAW,CAAC,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,CA6BlF"}
|
package/dist/run-base.js
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CHECKOUT_GOAL_MARKER = void 0;
|
|
4
|
+
exports.readCheckoutGoal = readCheckoutGoal;
|
|
5
|
+
exports.writeCheckoutGoal = writeCheckoutGoal;
|
|
6
|
+
exports.resolveBaseBranch = resolveBaseBranch;
|
|
7
|
+
exports.cutPointFor = cutPointFor;
|
|
8
|
+
const node_fs_1 = require("node:fs");
|
|
9
|
+
const node_path_1 = require("node:path");
|
|
10
|
+
/**
|
|
11
|
+
* WHERE A RUN IN A MACHINE-MADE CHECKOUT IS CUT FROM.
|
|
12
|
+
*
|
|
13
|
+
* ─────────────────────────────────────────────────────────────────────────────
|
|
14
|
+
* Without this a run's branch is cut from wherever HEAD is, and in a checkout
|
|
15
|
+
* the machine reuses HEAD is the PREVIOUS run's branch — so ticket N+1 stacked
|
|
16
|
+
* on ticket N, and nothing could be reviewed on its own. Now, in a checkout the
|
|
17
|
+
* machine made (never the person's own checkout), a run is cut from:
|
|
18
|
+
*
|
|
19
|
+
* 1. HEAD, when this checkout's last cut was for THE SAME GOAL — a goal's
|
|
20
|
+
* later Starts continue its own work (the coordinator keeps a goal's plan
|
|
21
|
+
* checkout for it, F28), and the goal-gap / "looks done" checks read this
|
|
22
|
+
* checkout, so they judge that goal's own tree;
|
|
23
|
+
* 1b. the goal's OWN recorded work (its newest delivered commit, else the branch
|
|
24
|
+
* its run claimed) when it lands in a different checkout — a retired home;
|
|
25
|
+
* 2. the delivered tip of the goal it depends on, when it depends on exactly
|
|
26
|
+
* ONE goal — B builds on A's work, not on a base that lacks it;
|
|
27
|
+
* 3. the project's base branch otherwise (`run.base_branch`, else the
|
|
28
|
+
* repository's default branch) — so independent tickets never stack;
|
|
29
|
+
* 4. HEAD as before, said out loud, when no base can be found.
|
|
30
|
+
*
|
|
31
|
+
* ⚠️ THE MARKER IS PER CHECKOUT (`checkout-goal.json` in its own state dir),
|
|
32
|
+
* written at the cut, and it is the only memory this needs: which goal this
|
|
33
|
+
* tree's HEAD belongs to.
|
|
34
|
+
*/
|
|
35
|
+
exports.CHECKOUT_GOAL_MARKER = 'checkout-goal.json';
|
|
36
|
+
function readCheckoutGoal(stateDir) {
|
|
37
|
+
try {
|
|
38
|
+
const raw = JSON.parse((0, node_fs_1.readFileSync)((0, node_path_1.join)(stateDir, exports.CHECKOUT_GOAL_MARKER), 'utf8'));
|
|
39
|
+
if (typeof raw.branch !== 'string' || typeof raw.at !== 'string')
|
|
40
|
+
return null;
|
|
41
|
+
return { goalId: typeof raw.goalId === 'string' ? raw.goalId : null, branch: raw.branch, at: raw.at };
|
|
42
|
+
}
|
|
43
|
+
catch {
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
function writeCheckoutGoal(stateDir, marker) {
|
|
48
|
+
(0, node_fs_1.mkdirSync)(stateDir, { recursive: true });
|
|
49
|
+
const target = (0, node_path_1.join)(stateDir, exports.CHECKOUT_GOAL_MARKER);
|
|
50
|
+
const tmp = `${target}.${process.pid}.tmp`;
|
|
51
|
+
(0, node_fs_1.writeFileSync)(tmp, `${JSON.stringify(marker)}\n`, 'utf8');
|
|
52
|
+
(0, node_fs_1.renameSync)(tmp, target);
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* The project's base branch: `configured` when it names a ref that exists; else
|
|
56
|
+
* the remote's default branch (`origin/HEAD`) — as the LOCAL branch of that name
|
|
57
|
+
* unless the remote one is strictly newer; else the branch the main checkout is
|
|
58
|
+
* on (unless that is one of looply's own). Null when none can be found.
|
|
59
|
+
*/
|
|
60
|
+
async function resolveBaseBranch(git, configured) {
|
|
61
|
+
if (configured !== undefined) {
|
|
62
|
+
return (await git.refExists(configured)) ? { ref: configured, because: 'run.base_branch' } : null;
|
|
63
|
+
}
|
|
64
|
+
const remote = await git.remoteHeadBranch().catch(() => null);
|
|
65
|
+
if (remote !== null) {
|
|
66
|
+
const local = remote.slice(remote.indexOf('/') + 1);
|
|
67
|
+
const hasLocal = local !== '' && (await git.refExists(`refs/heads/${local}`));
|
|
68
|
+
const hasRemote = await git.refExists(remote);
|
|
69
|
+
if (hasLocal && hasRemote) {
|
|
70
|
+
// The newer of the two when one contains the other; the person's own branch when they diverged.
|
|
71
|
+
const remoteNewer = (await git.isAncestor(local, remote)) && !(await git.isAncestor(remote, local));
|
|
72
|
+
return remoteNewer
|
|
73
|
+
? { ref: remote, because: `the remote default branch (${remote} is ahead of ${local})` }
|
|
74
|
+
: { ref: local, because: `the default branch (${remote})` };
|
|
75
|
+
}
|
|
76
|
+
if (hasLocal)
|
|
77
|
+
return { ref: local, because: `the default branch (${remote})` };
|
|
78
|
+
if (hasRemote)
|
|
79
|
+
return { ref: remote, because: 'the remote default branch' };
|
|
80
|
+
}
|
|
81
|
+
try {
|
|
82
|
+
const main = (await git.listWorktrees())[0];
|
|
83
|
+
const branch = main?.branch?.replace(/^refs\/heads\//, '') ?? null;
|
|
84
|
+
if (branch !== null && branch !== '' && !branch.startsWith('looply/') && (await git.refExists(`refs/heads/${branch}`))) {
|
|
85
|
+
return { ref: branch, because: 'the branch the main checkout is on' };
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
catch {
|
|
89
|
+
/* no worktree list: nothing more to try */
|
|
90
|
+
}
|
|
91
|
+
return null;
|
|
92
|
+
}
|
|
93
|
+
/** Decide where this run's branch starts. Never throws: an unreadable answer degrades to HEAD, said. */
|
|
94
|
+
async function cutPointFor(git, input) {
|
|
95
|
+
if (input.goalId !== undefined && input.checkout?.goalId === input.goalId) {
|
|
96
|
+
return { kind: 'continue', because: `this checkout holds ${input.goalId}'s own work (${input.checkout.branch})` };
|
|
97
|
+
}
|
|
98
|
+
if (input.goalId !== undefined) {
|
|
99
|
+
// This goal already has work on a branch — its home checkout was retired, or it was placed
|
|
100
|
+
// elsewhere: carry on from that work rather than redo it from the base.
|
|
101
|
+
const own = await dependencyTip(git, input.goalId, input.claims);
|
|
102
|
+
if (own !== null)
|
|
103
|
+
return { kind: 'dependency', ref: own.ref, because: `${input.goalId} already has work at ${own.ref} (${own.what}); continuing from it` };
|
|
104
|
+
}
|
|
105
|
+
const deps = input.dependsOn ?? [];
|
|
106
|
+
if (input.goalId !== undefined && deps.length === 1) {
|
|
107
|
+
const dep = deps[0];
|
|
108
|
+
const tip = await dependencyTip(git, dep, input.claims);
|
|
109
|
+
if (tip !== null)
|
|
110
|
+
return { kind: 'dependency', ref: tip.ref, because: `it depends on ${dep}, whose work is at ${tip.ref} (${tip.what})` };
|
|
111
|
+
}
|
|
112
|
+
try {
|
|
113
|
+
const base = await resolveBaseBranch(git, input.configuredBase);
|
|
114
|
+
if (base !== null)
|
|
115
|
+
return { kind: 'base', ref: base.ref, because: base.because };
|
|
116
|
+
}
|
|
117
|
+
catch {
|
|
118
|
+
/* fall through to HEAD */
|
|
119
|
+
}
|
|
120
|
+
return {
|
|
121
|
+
kind: 'head',
|
|
122
|
+
because: input.configuredBase !== undefined
|
|
123
|
+
? `run.base_branch ${input.configuredBase} does not exist here`
|
|
124
|
+
: 'no default branch could be found (no origin/HEAD, no main checkout branch)',
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
/** The newest delivered commit of `goalId`, else the tip of its newest claimed branch. */
|
|
128
|
+
async function dependencyTip(git, goalId, claims) {
|
|
129
|
+
const mine = claims.filter((c) => c.goalId === goalId);
|
|
130
|
+
for (const c of [...mine].reverse()) {
|
|
131
|
+
if (c.kind === 'delivery' && (await git.refExists(c.commitSha).catch(() => false))) {
|
|
132
|
+
return { ref: c.commitSha, what: `its delivered commit on ${c.branch}` };
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
for (const c of [...mine].reverse()) {
|
|
136
|
+
if (c.kind === 'claims' && (await git.refExists(`refs/heads/${c.branch}`).catch(() => false))) {
|
|
137
|
+
return { ref: c.branch, what: 'the branch its run worked on' };
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
return null;
|
|
141
|
+
}
|
|
142
|
+
//# sourceMappingURL=run-base.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-base.js","sourceRoot":"","sources":["../src/run-base.ts"],"names":[],"mappings":";;;AAsCA,4CAQC;AAED,8CAMC;AAgBD,8CAgCC;AAqBD,kCA6BC;AAxJD,qCAA6E;AAC7E,yCAAiC;AAGjC;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEU,QAAA,oBAAoB,GAAG,oBAAoB,CAAC;AAQzD,SAAgB,gBAAgB,CAAC,QAAgB;IAC/C,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,IAAA,sBAAY,EAAC,IAAA,gBAAI,EAAC,QAAQ,EAAE,4BAAoB,CAAC,EAAE,MAAM,CAAC,CAA0B,CAAC;QAC5G,IAAI,OAAO,GAAG,CAAC,MAAM,KAAK,QAAQ,IAAI,O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C,CAAC,CAAC,SAAS,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC;YACnF,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC,SAAS,EAAE,IAAI,EAAE,2BAA2B,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC;QAC3E,CAAC;IACH,CAAC;IACD,KAAK,MAAM,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC;QACpC,IAAI,CAAC,CAAC,IAAI,KAAK,QAAQ,IAAI,CAAC,MAAM,GAAG,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC;YAC9F,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,IAAI,EAAE,8BAA8B,EAAE,CAAC;QACjE,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
package/dist/run-cmd.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-cmd.d.ts","sourceRoot":"","sources":["../src/run-cmd.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAOvD,OAAO,EAGL,KAAK,cAAc,EAKnB,KAAK,IAAI,EAaT,KAAK,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAc,KAAK,YAAY,EAAE,MAAM,UAAU,CAAC;AACzD,OAAO,EAA6B,KAAK,aAAa,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"run-cmd.d.ts","sourceRoot":"","sources":["../src/run-cmd.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAOvD,OAAO,EAGL,KAAK,cAAc,EAKnB,KAAK,IAAI,E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
|
|
16
16
|
const ledger_store_1 = require("./ledger-store");
|
|
17
17
|
const run_ended_1 = require("./run-ended");
|
|
18
|
+
const pursuit_ending_1 = require("./pursuit-ending");
|
|
18
19
|
const exemption_store_1 = require("./exemption-store");
|
|
19
20
|
const queue_store_1 = require("./queue-store");
|
|
20
21
|
const lane_claims_1 = require("./lane-claims");
|
|
21
22
|
const run_delivery_1 = require("./run-delivery");
|
|
22
23
|
const goal_met_target_1 = require("./goal-met-target");
|
|
23
24
|
const reaper_1 = require("./reaper");
|
|
25
|
+
const run_base_1 = require("./run-base");
|
|
24
26
|
const requirement_claims_1 = require("./requirement-claims");
|
|
25
27
|
const evidence_cache_1 = require("./evidence-cache");
|
|
26
28
|
const control_file_1 = require("./control-file");
|
|
@@ -59,7 +61,9 @@ const programme_mode_1 = require("./programme-mode");
|
|
|
59
61
|
const partial_asker_1 = require("./partial-asker");
|
|
60
62
|
const goal_ownership_1 = require("./goal-ownership");
|
|
61
63
|
const goal_compile_1 = require("./goal-compile");
|
|
64
|
+
const plan_recovery_1 = require("./plan-recovery");
|
|
62
65
|
const goal_execution_evidence_1 = require("./goal-execution-evidence");
|
|
66
|
+
const goal_reproof_1 = require("./goal-reproof");
|
|
63
67
|
const round_records_1 = require("./round-records");
|
|
64
68
|
const goal_gap_1 = require("./goal-gap");
|
|
65
69
|
const goal_adaptive_1 = require("./goal-adaptive");
|
|
@@ -807,7 +811,7 @@ async function runLoop(opts) {
|
|
|
807
811
|
return;
|
|
808
812
|
try {
|
|
809
813
|
const tree = await git.headTreeSha();
|
|
810
|
-
const indexStore = new project_index_store_1.ProjectIndexStore(stateDir, ledger_store_1.nodeLedgerFs);
|
|
814
|
+
const indexStore = new project_index_store_1.ProjectIndexStore(stateDir, ledger_store_1.nodeLedgerFs, (0, git_driver_1.projectStateDir)(cwd));
|
|
811
815
|
/**
|
|
812
816
|
* ⚠️ THE PACKAGE SET IS PART OF THE KEY, NOT JUST OF THE BUILD. Passing
|
|
813
817
|
* it is what stops a config edit — which no tree sha covers — being
|
|
@@ -858,7 +862,7 @@ async function runLoop(opts) {
|
|
|
858
862
|
projectKey: memoryKey,
|
|
859
863
|
headTreeSha: () => git.headTreeSha(),
|
|
860
864
|
indexFor: async (tree) => {
|
|
861
|
-
const store = new project_index_store_1.ProjectIndexStore(stateDir, ledger_store_1.nodeLedgerFs);
|
|
865
|
+
const store = new project_index_store_1.ProjectIndexStore(stateDir, ledger_store_1.nodeLedgerFs, (0, git_driver_1.projectStateDir)(cwd));
|
|
862
866
|
const packages = (0, index_for_head_1.workspacePackages)(config);
|
|
863
867
|
// Same key as the block above, and for the same reason.
|
|
864
868
|
const cached = await store.load(tree, packages.map((pkg) => pkg.name));
|
|
@@ -2851,7 +2855,10 @@ async function runLoop(opts) {
|
|
|
2851
2855
|
if (verdict.compile && scope !== null && binding.kind === 'bound') {
|
|
2852
2856
|
compiledThisRun = true;
|
|
2853
2857
|
log(`compile : ${binding.goal.text}`);
|
|
2854
|
-
|
|
2858
|
+
// Read before the compile: the compiler is told not to change anything, and every check of its
|
|
2859
|
+
// answer (the first and any re-plan) is made against the same committed tree.
|
|
2860
|
+
const compiledAt = await git.headTreeSha().catch(() => null);
|
|
2861
|
+
const recovered = await (0, plan_recovery_1.compileWithRecovery)({
|
|
2855
2862
|
goalId: binding.goal.id,
|
|
2856
2863
|
goalVersion: binding.goal.version,
|
|
2857
2864
|
goalText: binding.goal.text,
|
|
@@ -2883,10 +2890,16 @@ async function runLoop(opts) {
|
|
|
2883
2890
|
// acceptance map `produceClaims` holds `provenBy` against.
|
|
2884
2891
|
checks: config.gates.map((g) => g.name),
|
|
2885
2892
|
}),
|
|
2886
|
-
}, {
|
|
2887
|
-
|
|
2888
|
-
|
|
2889
|
-
|
|
2893
|
+
}, {
|
|
2894
|
+
compile: (i) => (0, goal_compile_1.compileGoal)(i, { invoke: planAgent }),
|
|
2895
|
+
// M3-2: checked at the committed tree before any step becomes an item; the compile recorded either way.
|
|
2896
|
+
check: (steps) => (0, compile_check_1.checkCompiledPlan)(steps, compileReaders, compiledAt),
|
|
2897
|
+
log: (line) => log(`compile : ${line}`),
|
|
2898
|
+
}, goal_compile_1.COMPILE_MAX_STEPS);
|
|
2899
|
+
// A step whose citation did not hold is re-planned, an empty plan is asked again as an instruction,
|
|
2900
|
+
// and only then does a ticket get one direct step (`plan-recovery.ts`) — never a hand-back.
|
|
2901
|
+
const compiled = recovered.compiled;
|
|
2902
|
+
const checked = recovered.checked;
|
|
2890
2903
|
for (const r of checked?.refused ?? [])
|
|
2891
2904
|
log(`compile : ${(0, compile_check_1.describeRefusal)(r)}`);
|
|
2892
2905
|
await recordCompile(binding.goal.id, binding.goal.version, compiledAt, compiled, checked);
|
|
@@ -2920,7 +2933,8 @@ async function runLoop(opts) {
|
|
|
2920
2933
|
// and the next Start tries again.
|
|
2921
2934
|
log(`compile : every step was refused — ${checked.refused.length} step(s) cited evidence that does not hold at the tree. ` +
|
|
2922
2935
|
'Nothing queued, and this goal still has no plan.');
|
|
2923
|
-
|
|
2936
|
+
// Matched by pursuit-ending.ts to explain an ending to a person; keep the prefix.
|
|
2937
|
+
compileNote = `${pursuit_ending_1.COMPILE_REFUSED_NOTE} — ${checked.refused.length} step(s) cited evidence that does not hold at the tree`;
|
|
2924
2938
|
}
|
|
2925
2939
|
else if (!(stillOurs = await freshAuthority(binding.goal.id, binding.goal.version, binding.goal.text)).ok) {
|
|
2926
2940
|
/**
|
|
@@ -3019,7 +3033,7 @@ async function runLoop(opts) {
|
|
|
3019
3033
|
}
|
|
3020
3034
|
else if (!compiled.steps.length) {
|
|
3021
3035
|
log('compile : the plan came back empty — nothing to do for this goal.');
|
|
3022
|
-
compileNote =
|
|
3036
|
+
compileNote = pursuit_ending_1.COMPILE_EMPTY_NOTE;
|
|
3023
3037
|
}
|
|
3024
3038
|
else {
|
|
3025
3039
|
log(
|
|
@@ -3178,7 +3192,17 @@ async function runLoop(opts) {
|
|
|
3178
3192
|
.filter((i) => !(0, goal_compile_1.isPlanMarker)(i)),
|
|
3179
3193
|
}, {
|
|
3180
3194
|
evaluate: (i) => (0, goal_gap_1.evaluateGoalGap)(i, { invoke: planAgent }),
|
|
3181
|
-
|
|
3195
|
+
// The same recovery as the first plan: re-plan refused steps, read an empty answer as
|
|
3196
|
+
// an instruction, and fall back to one direct step before this revision is empty.
|
|
3197
|
+
compile: async (i, maxSteps) => {
|
|
3198
|
+
const at = await git.headTreeSha().catch(() => null);
|
|
3199
|
+
const recovered = await (0, plan_recovery_1.compileWithRecovery)(i, {
|
|
3200
|
+
compile: (j) => (0, goal_compile_1.compileGoal)(j, { invoke: planAgent, maxSteps }),
|
|
3201
|
+
check: (steps) => (0, compile_check_1.checkCompiledPlan)(steps, compileReaders, at),
|
|
3202
|
+
log: (line) => log(`goal : ${line}`),
|
|
3203
|
+
}, maxSteps);
|
|
3204
|
+
return recovered.compiled;
|
|
3205
|
+
},
|
|
3182
3206
|
changedPaths: () => git.changedPaths(),
|
|
3183
3207
|
headSha: () => git.headSha(),
|
|
3184
3208
|
/**
|
|
@@ -3196,14 +3220,33 @@ async function runLoop(opts) {
|
|
|
3196
3220
|
// retryable and says what actually happened.
|
|
3197
3221
|
if (!read.ok)
|
|
3198
3222
|
return { ok: false, reason: read.because, unknown: true };
|
|
3199
|
-
const
|
|
3223
|
+
const key2Input = {
|
|
3200
3224
|
scope: askedScope,
|
|
3201
3225
|
items: owned,
|
|
3202
3226
|
rounds: read.rounds,
|
|
3203
3227
|
// F27: a carried commit is confirmed as the round the lane carried.
|
|
3204
3228
|
currentHead: judged.kind === 'carried' ? judged.of : head,
|
|
3205
3229
|
requiredSteps: (0, gate_1.requiredSteps)(config.gates),
|
|
3206
|
-
}
|
|
3230
|
+
};
|
|
3231
|
+
let confirmed = (0, goal_execution_evidence_1.confirmGoalExecutionEvidence)(key2Input);
|
|
3232
|
+
/**
|
|
3233
|
+
* THE CODE MOVED ON: CHECK WHAT IS HERE NOW, DON'T HAND IT BACK (`goal-reproof.ts`).
|
|
3234
|
+
* Another ticket's run cut on top of this goal's commits is the common case in a
|
|
3235
|
+
* person's own checkout; the gates run again at HEAD, and KEY 2 is asked again.
|
|
3236
|
+
*/
|
|
3237
|
+
if (!confirmed.ok && confirmed.moved === true && judged.kind !== 'carried') {
|
|
3238
|
+
log('goal : the code moved on since this plan was delivered — running the gates again at the current tree');
|
|
3239
|
+
const again = await (0, goal_reproof_1.reproveAtHead)(head, (0, goal_execution_evidence_1.committedShasOf)(key2Input), {
|
|
3240
|
+
changedPaths: () => git.changedPaths(),
|
|
3241
|
+
isAncestor: (a, of) => git.isAncestor(a, of),
|
|
3242
|
+
changedPathsBetween: (from, to) => git.changedPathsBetween(from, to),
|
|
3243
|
+
runGates: async (paths) => (await (0, gate_1.runGate)({ steps: config.gates, changedPaths: paths, runner: (0, untrusted_gate_1.makeUntrustedGateRunner)(cwd) })).steps,
|
|
3244
|
+
});
|
|
3245
|
+
confirmed = again.ok
|
|
3246
|
+
? (0, goal_execution_evidence_1.confirmGoalExecutionEvidence)({ ...key2Input, rechecked: { contains: again.contains, steps: again.steps } })
|
|
3247
|
+
: { ok: false, because: `${goal_execution_evidence_1.CODE_MOVED_ON}, and it could not be checked again: ${again.because}` };
|
|
3248
|
+
log(`goal : ${confirmed.ok ? 'the gates pass at the current tree, and this plan’s work is in it' : confirmed.because}`);
|
|
3249
|
+
}
|
|
3207
3250
|
/**
|
|
3208
3251
|
* 🔴 WHAT KEY 2 SAW, KEPT FOR THE FOURTH KEY.
|
|
3209
3252
|
*
|
|
@@ -3219,7 +3262,7 @@ async function runLoop(opts) {
|
|
|
3219
3262
|
deliveringSha = confirmed.round.sha ?? null;
|
|
3220
3263
|
key2Saw = {
|
|
3221
3264
|
delivered: new Set(confirmed.delivered),
|
|
3222
|
-
checks: new Map((confirmed.round.gate?.steps ?? []).map((st) => [
|
|
3265
|
+
checks: new Map((confirmed.reproved ?? confirmed.round.gate?.steps ?? []).map((st) => [
|
|
3223
3266
|
st.step,
|
|
3224
3267
|
// A `when:` filter that matched nothing is SKIPPED, which
|
|
3225
3268
|
// is a different answer from passing — and the whole
|
|
@@ -3375,6 +3418,9 @@ async function runLoop(opts) {
|
|
|
3375
3418
|
const left = scope === null ? null : (0, core_1.workLeft)(runQueue.list());
|
|
3376
3419
|
if (left === 'finished')
|
|
3377
3420
|
return `this goal's work is done — ${(0, queue_summary_1.describeNoReady)(runQueue.list())}`;
|
|
3421
|
+
if (left === 'stalled' && compiledThisRun && !runQueue.list().some((i) => i.state === 'draft')) {
|
|
3422
|
+
return `nothing in the first plan is ready to work on — ${(0, queue_summary_1.describeNoReady)(runQueue.list())}; the next Start checks this goal against the code`;
|
|
3423
|
+
}
|
|
3378
3424
|
if (left === 'stalled')
|
|
3379
3425
|
return `nothing here can move without you — ${(0, queue_summary_1.describeNoReady)(runQueue.list())}`;
|
|
3380
3426
|
return `nothing to do — ${(0, queue_summary_1.describeNoReady)(runQueue.list())}`;
|
|
@@ -3505,7 +3551,19 @@ async function runLoop(opts) {
|
|
|
3505
3551
|
throw new RunRefused(`this goal's work is done — ${(0, queue_summary_1.describeNoReady)(runQueue.list())}`, 'run_refused');
|
|
3506
3552
|
}
|
|
3507
3553
|
if (left === 'stalled') {
|
|
3554
|
+
/**
|
|
3555
|
+
* NOT A PERSON'S YET, WHEN THIS START ONLY JUST MADE THE PLAN.
|
|
3556
|
+
*
|
|
3557
|
+
* The verify pass can set a fresh plan's steps aside (stale, duplicate, blocked) and leave
|
|
3558
|
+
* nothing to pick. Nobody has asked the goal check yet: the next Start does — it measures
|
|
3559
|
+
* the goal against the code and re-plans what is missing (TAB-B-45 ended here). Retryable.
|
|
3560
|
+
* Items that wait on a person's decision (an `unclear` draft) still say so.
|
|
3561
|
+
*/
|
|
3562
|
+
const firstPlanOnly = compiledThisRun && !runQueue.list().some((i) => i.state === 'draft');
|
|
3563
|
+
const stalledBecause = (0, queue_summary_1.describeNoReady)(runQueue.list());
|
|
3508
3564
|
await releaseHold();
|
|
3565
|
+
if (firstPlanOnly)
|
|
3566
|
+
throw new Error(`nothing in the first plan is ready to work on — ${stalledBecause}; the next Start checks this goal against the code`);
|
|
3509
3567
|
throw new RunRefused(`nothing here can move without you — ${(0, queue_summary_1.describeNoReady)(runQueue.list())}`, 'human_required');
|
|
3510
3568
|
}
|
|
3511
3569
|
await releaseHold();
|
|
@@ -3875,7 +3933,45 @@ async function runLoop(opts) {
|
|
|
3875
3933
|
}
|
|
3876
3934
|
},
|
|
3877
3935
|
}
|
|
3878
|
-
:
|
|
3936
|
+
: (0, reaper_1.hasProvisionedMarker)(cwd)
|
|
3937
|
+
? {
|
|
3938
|
+
/**
|
|
3939
|
+
* PARALLEL TICKETS: A RUN IN A CHECKOUT THE MACHINE MADE IS CUT FROM ITS OWN BASE,
|
|
3940
|
+
* never from whatever the previous run in that checkout left on HEAD — see
|
|
3941
|
+
* `run-base.ts`. Its own goal's earlier work continues on HEAD; a single
|
|
3942
|
+
* dependency's delivered tip comes next; the project's base branch otherwise. The
|
|
3943
|
+
* person's own checkout is never touched by this: there, HEAD stays the start.
|
|
3944
|
+
*/
|
|
3945
|
+
integrationBase: async () => {
|
|
3946
|
+
const goalId = binding.kind === 'bound' ? binding.goal.id : undefined;
|
|
3947
|
+
let cut;
|
|
3948
|
+
try {
|
|
3949
|
+
cut = await (0, run_base_1.cutPointFor)(git, {
|
|
3950
|
+
...(goalId === undefined ? {} : { goalId }),
|
|
3951
|
+
dependsOn: binding.kind === 'bound' ? (binding.goal.dependsOn ?? []) : [],
|
|
3952
|
+
checkout: (0, run_base_1.readCheckoutGoal)(stateDir),
|
|
3953
|
+
claims: (0, lane_claims_1.readLaneClaims)(cwd),
|
|
3954
|
+
...(config.run.baseBranch === undefined ? {} : { configuredBase: config.run.baseBranch }),
|
|
3955
|
+
});
|
|
3956
|
+
}
|
|
3957
|
+
catch (e) {
|
|
3958
|
+
cut = { kind: 'head', because: e.message };
|
|
3959
|
+
}
|
|
3960
|
+
log(cut.kind === 'continue'
|
|
3961
|
+
? `base : continuing on HEAD — ${cut.because}`
|
|
3962
|
+
: cut.kind === 'head'
|
|
3963
|
+
? `base : cutting from HEAD — ${cut.because}`
|
|
3964
|
+
: `base : cutting from ${cut.ref} — ${cut.because}`);
|
|
3965
|
+
try {
|
|
3966
|
+
(0, run_base_1.writeCheckoutGoal)(stateDir, { goalId: goalId ?? null, branch, at: new Date().toISOString() });
|
|
3967
|
+
}
|
|
3968
|
+
catch {
|
|
3969
|
+
// The marker is a memory, not a gate: without it the next run is cut from the base.
|
|
3970
|
+
}
|
|
3971
|
+
return cut.kind === 'base' || cut.kind === 'dependency' ? cut.ref : null;
|
|
3972
|
+
},
|
|
3973
|
+
}
|
|
3974
|
+
: {}),
|
|
3879
3975
|
// Attribution for this run's header event, passed as opaque values. The
|
|
3880
3976
|
// runner spreads them and knows nothing about what they mean — that is the
|
|
3881
3977
|
// whole point of the carrier, and why RoundRunner still contains no
|