@ordewell/core 0.9.1 → 0.10.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/dist/{IFileSystem-BjiyCQ8O.d.ts → IFileSystem-BCJBHFwB.d.ts} +1 -1
- package/dist/{IFileSystem-Cy-TAWvu.d.mts → IFileSystem-Bj6fy1cG.d.mts} +1 -1
- package/dist/{IRunner-Corods20.d.ts → IRunner-C7_SSpzG.d.ts} +228 -13
- package/dist/{IRunner-D6YfbmHn.d.mts → IRunner-hWAJC4hg.d.mts} +228 -13
- package/dist/ModeResolver-m1d8Cb-j.d.mts +35 -0
- package/dist/ModeResolver-u5ZhRC8x.d.ts +35 -0
- package/dist/{Task-1Q19y7sZ.d.mts → Task-CxwnCJLi.d.mts} +346 -127
- package/dist/{Task-1Q19y7sZ.d.ts → Task-CxwnCJLi.d.ts} +346 -127
- package/dist/{chunk-UUU46PVQ.mjs → chunk-2IIRSBEQ.mjs} +109 -142
- package/dist/chunk-2IIRSBEQ.mjs.map +1 -0
- package/dist/{chunk-OOZWSUIE.mjs → chunk-CH5IGWFS.mjs} +545 -966
- package/dist/chunk-CH5IGWFS.mjs.map +1 -0
- package/dist/chunk-DJAPDO6E.mjs +1358 -0
- package/dist/chunk-DJAPDO6E.mjs.map +1 -0
- package/dist/chunk-DNFT4SQG.mjs +97 -0
- package/dist/chunk-DNFT4SQG.mjs.map +1 -0
- package/dist/index.d.mts +3107 -3988
- package/dist/index.d.ts +3107 -3988
- package/dist/index.js +21576 -17642
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +19222 -15561
- package/dist/index.mjs.map +1 -1
- package/dist/parsing.d.mts +55 -3
- package/dist/parsing.d.ts +55 -3
- package/dist/parsing.js +311 -124
- package/dist/parsing.js.map +1 -1
- package/dist/parsing.mjs +86 -6
- package/dist/parsing.mjs.map +1 -1
- package/dist/plan-utils-B6yJdpgi.d.ts +2902 -0
- package/dist/plan-utils-CKXdD1AD.d.mts +2902 -0
- package/dist/plan-utils.d.mts +4 -5
- package/dist/plan-utils.d.ts +4 -5
- package/dist/plan-utils.js +471 -86
- package/dist/plan-utils.js.map +1 -1
- package/dist/plan-utils.mjs +68 -19
- package/dist/testing.d.mts +22 -4
- package/dist/testing.d.ts +22 -4
- package/dist/testing.js +45 -9
- package/dist/testing.js.map +1 -1
- package/dist/testing.mjs +46 -11
- package/dist/testing.mjs.map +1 -1
- package/package.json +2 -10
- package/skills/tdd/SKILL.md +0 -1
- package/dist/ModeResolver-DE-o2lRF.d.mts +0 -48
- package/dist/ModeResolver-EWlpmVAy.d.ts +0 -48
- package/dist/chunk-2M4X3VB7.mjs +0 -432
- package/dist/chunk-2M4X3VB7.mjs.map +0 -1
- package/dist/chunk-H5O74L77.mjs +0 -185
- package/dist/chunk-H5O74L77.mjs.map +0 -1
- package/dist/chunk-OOZWSUIE.mjs.map +0 -1
- package/dist/chunk-UUU46PVQ.mjs.map +0 -1
- package/dist/chunk-V3JHS7AX.mjs +0 -27
- package/dist/chunk-V3JHS7AX.mjs.map +0 -1
- package/dist/order-labels.d.mts +0 -30
- package/dist/order-labels.d.ts +0 -30
- package/dist/order-labels.js +0 -54
- package/dist/order-labels.js.map +0 -1
- package/dist/order-labels.mjs +0 -13
- package/dist/order-labels.mjs.map +0 -1
- package/dist/parsing-CZdp2p_n.d.ts +0 -154
- package/dist/parsing-GgUJoYKs.d.mts +0 -154
- package/dist/plan-utils-BmUp_Lko.d.mts +0 -1222
- package/dist/plan-utils-tWfH48YX.d.ts +0 -1222
package/dist/plan-utils.mjs
CHANGED
|
@@ -2,28 +2,29 @@ import {
|
|
|
2
2
|
CHECKPOINT_TRUNCATE_LENGTH,
|
|
3
3
|
EMPTY_CONVERSATION,
|
|
4
4
|
EMPTY_HOLD,
|
|
5
|
+
EMPTY_RUN,
|
|
5
6
|
EMPTY_TASK_LOG,
|
|
6
|
-
NOT_STARTED,
|
|
7
7
|
NO_TURN,
|
|
8
|
+
SUPERVISOR_LEVEL_LABEL,
|
|
9
|
+
addAttemptUsage,
|
|
10
|
+
addModelUsage,
|
|
11
|
+
addPlannerUsage,
|
|
12
|
+
addUsage,
|
|
13
|
+
addUsageTotals,
|
|
8
14
|
aheadOfDraft,
|
|
9
|
-
|
|
10
|
-
awaitingLabel,
|
|
11
|
-
canMergeTasks,
|
|
12
|
-
canSetDependencies,
|
|
13
|
-
canSplitTask,
|
|
15
|
+
blockingFailures,
|
|
14
16
|
capConflictFiles,
|
|
15
|
-
dependencyCandidates,
|
|
16
17
|
dependentsNotice,
|
|
17
|
-
dependentsOf,
|
|
18
18
|
diffRows,
|
|
19
19
|
diffStat,
|
|
20
20
|
diffSummary,
|
|
21
21
|
drainNext,
|
|
22
|
+
endAttemptUsage,
|
|
22
23
|
followTurn,
|
|
23
24
|
fromTranscript,
|
|
24
25
|
hasHiddenDetail,
|
|
25
26
|
holdPrompt,
|
|
26
|
-
|
|
27
|
+
isMeasured,
|
|
27
28
|
markAction,
|
|
28
29
|
markRequestFor,
|
|
29
30
|
namedRepos,
|
|
@@ -31,45 +32,77 @@ import {
|
|
|
31
32
|
opsEditable,
|
|
32
33
|
outputLines,
|
|
33
34
|
outputPreview,
|
|
35
|
+
parseCount,
|
|
36
|
+
partedPromptUsage,
|
|
34
37
|
pastGateConfirmation,
|
|
38
|
+
planUsage,
|
|
39
|
+
plannerContextFill,
|
|
35
40
|
reduceConversation,
|
|
36
41
|
reduceTaskLog,
|
|
37
42
|
replayTaskLog,
|
|
38
43
|
runnerToolSubject,
|
|
44
|
+
startAttemptUsage,
|
|
39
45
|
stopTurn,
|
|
40
46
|
summarizeToolCall,
|
|
47
|
+
takeAt,
|
|
41
48
|
taskRowActions,
|
|
42
49
|
taskRowView,
|
|
43
50
|
taskStartedNotice,
|
|
44
|
-
taskStatusKind,
|
|
45
51
|
titledRefs,
|
|
46
52
|
toolHeadline,
|
|
47
53
|
truncateCheckpointSummary,
|
|
48
54
|
unsendAll,
|
|
49
|
-
unsendLatest
|
|
50
|
-
|
|
51
|
-
|
|
55
|
+
unsendLatest,
|
|
56
|
+
usageLine
|
|
57
|
+
} from "./chunk-CH5IGWFS.mjs";
|
|
58
|
+
import {
|
|
59
|
+
NOT_STARTED,
|
|
60
|
+
approvalLabel,
|
|
61
|
+
awaitingLabel,
|
|
62
|
+
blockedByLabel,
|
|
63
|
+
canMergeTasks,
|
|
64
|
+
canSetDependencies,
|
|
65
|
+
canSplitTask,
|
|
66
|
+
dependencyCandidates,
|
|
67
|
+
dependentsOf,
|
|
68
|
+
isTaskRunning,
|
|
69
|
+
resumeLabel,
|
|
70
|
+
resumeTime,
|
|
71
|
+
skippedLabel,
|
|
72
|
+
taskStatusKind
|
|
73
|
+
} from "./chunk-DJAPDO6E.mjs";
|
|
52
74
|
import {
|
|
53
75
|
DEFAULT_RUNNERS,
|
|
54
76
|
loadedSkillTokens,
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
77
|
+
pausedOnLimit,
|
|
78
|
+
resolveTaskRef,
|
|
79
|
+
skillTokens,
|
|
58
80
|
taskOrderLabel,
|
|
59
81
|
taskRef,
|
|
60
|
-
|
|
61
|
-
|
|
82
|
+
taskRefOf,
|
|
83
|
+
titledTaskRef,
|
|
84
|
+
titledTaskRefOf
|
|
85
|
+
} from "./chunk-2IIRSBEQ.mjs";
|
|
62
86
|
export {
|
|
63
87
|
CHECKPOINT_TRUNCATE_LENGTH,
|
|
64
88
|
DEFAULT_RUNNERS,
|
|
65
89
|
EMPTY_CONVERSATION,
|
|
66
90
|
EMPTY_HOLD,
|
|
91
|
+
EMPTY_RUN,
|
|
67
92
|
EMPTY_TASK_LOG,
|
|
68
93
|
NOT_STARTED,
|
|
69
94
|
NO_TURN,
|
|
95
|
+
SUPERVISOR_LEVEL_LABEL,
|
|
96
|
+
addAttemptUsage,
|
|
97
|
+
addModelUsage,
|
|
98
|
+
addPlannerUsage,
|
|
99
|
+
addUsage,
|
|
100
|
+
addUsageTotals,
|
|
70
101
|
aheadOfDraft,
|
|
71
102
|
approvalLabel,
|
|
72
103
|
awaitingLabel,
|
|
104
|
+
blockedByLabel,
|
|
105
|
+
blockingFailures,
|
|
73
106
|
canMergeTasks,
|
|
74
107
|
canSetDependencies,
|
|
75
108
|
canSplitTask,
|
|
@@ -81,10 +114,12 @@ export {
|
|
|
81
114
|
diffStat,
|
|
82
115
|
diffSummary,
|
|
83
116
|
drainNext,
|
|
117
|
+
endAttemptUsage,
|
|
84
118
|
followTurn,
|
|
85
119
|
fromTranscript,
|
|
86
120
|
hasHiddenDetail,
|
|
87
121
|
holdPrompt,
|
|
122
|
+
isMeasured,
|
|
88
123
|
isTaskRunning,
|
|
89
124
|
loadedSkillTokens,
|
|
90
125
|
markAction,
|
|
@@ -94,25 +129,39 @@ export {
|
|
|
94
129
|
opsEditable,
|
|
95
130
|
outputLines,
|
|
96
131
|
outputPreview,
|
|
132
|
+
parseCount,
|
|
133
|
+
partedPromptUsage,
|
|
97
134
|
pastGateConfirmation,
|
|
135
|
+
pausedOnLimit,
|
|
136
|
+
planUsage,
|
|
137
|
+
plannerContextFill,
|
|
98
138
|
reduceConversation,
|
|
99
139
|
reduceTaskLog,
|
|
100
140
|
replayTaskLog,
|
|
141
|
+
resolveTaskRef,
|
|
142
|
+
resumeLabel,
|
|
143
|
+
resumeTime,
|
|
101
144
|
runnerToolSubject,
|
|
102
145
|
skillTokens,
|
|
146
|
+
skippedLabel,
|
|
147
|
+
startAttemptUsage,
|
|
103
148
|
stopTurn,
|
|
104
149
|
summarizeToolCall,
|
|
150
|
+
takeAt,
|
|
105
151
|
taskOrderLabel,
|
|
106
152
|
taskRef,
|
|
153
|
+
taskRefOf,
|
|
107
154
|
taskRowActions,
|
|
108
155
|
taskRowView,
|
|
109
156
|
taskStartedNotice,
|
|
110
157
|
taskStatusKind,
|
|
111
158
|
titledRefs,
|
|
112
159
|
titledTaskRef,
|
|
160
|
+
titledTaskRefOf,
|
|
113
161
|
toolHeadline,
|
|
114
162
|
truncateCheckpointSummary,
|
|
115
163
|
unsendAll,
|
|
116
|
-
unsendLatest
|
|
164
|
+
unsendLatest,
|
|
165
|
+
usageLine
|
|
117
166
|
};
|
|
118
167
|
//# sourceMappingURL=plan-utils.mjs.map
|
package/dist/testing.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { I as IFileSystem } from './IFileSystem-
|
|
3
|
-
import {
|
|
1
|
+
import { B as IRunnerSession, aa as QueuedTaskMessage, au as StructuredTurnEnd, at as StructuredEvent, az as TaskCompleteArgs, r as CheckpointAnswer, aB as TaskMessageFrom, ah as RunnerCommand, H as InvokedCommand, j as ApprovalDecision, y as IConfig } from './IRunner-hWAJC4hg.mjs';
|
|
2
|
+
import { I as IFileSystem } from './IFileSystem-Bj6fy1cG.mjs';
|
|
3
|
+
import { g as IntegrationDisposal, I as IWorktreeIsolation, i as IsolationAvailability, q as IsolationMergeResult, am as TreeSnapshot, a0 as SetupFailure, s as IsolationPruneResult, t as IsolationRemoval, r as IsolationOutcome, T as RepairEvidence, v as IsolationRun, ac as Task, Q as PreparedTask, j as IsolationHandoff } from './Task-CxwnCJLi.mjs';
|
|
4
4
|
import 'child_process';
|
|
5
5
|
import 'zod/v4';
|
|
6
6
|
|
|
@@ -29,6 +29,8 @@ declare class FakeRunnerSession implements IRunnerSession {
|
|
|
29
29
|
messages: QueuedTaskMessage[];
|
|
30
30
|
/** Every message a turn was started with, in order. */
|
|
31
31
|
delivered: string[];
|
|
32
|
+
/** The ones of {@link delivered} Ordewell sent: the completion reminder (ADR-0018, W1). */
|
|
33
|
+
fromOrdewell: string[];
|
|
32
34
|
interrupts: number;
|
|
33
35
|
private messageCount;
|
|
34
36
|
private turnEndCbs;
|
|
@@ -52,7 +54,7 @@ declare class FakeRunnerSession implements IRunnerSession {
|
|
|
52
54
|
onToolCheckpoint(handler: (question: string, signal: AbortSignal) => Promise<CheckpointAnswer>): void;
|
|
53
55
|
/** The runner calls `checkpoint`, as `StructuredSession` relays it; settles with the answer. */
|
|
54
56
|
callCheckpoint(question: string, signal?: AbortSignal): Promise<CheckpointAnswer>;
|
|
55
|
-
sendMessage(text: string): string;
|
|
57
|
+
sendMessage(text: string, from?: TaskMessageFrom): string;
|
|
56
58
|
/** Interrupts, and the turn that replaces the interrupted one opens with the forced message. */
|
|
57
59
|
forceSend(text: string): string;
|
|
58
60
|
forceSendQueued(id: string): boolean;
|
|
@@ -61,6 +63,13 @@ declare class FakeRunnerSession implements IRunnerSession {
|
|
|
61
63
|
queued(): QueuedTaskMessage[];
|
|
62
64
|
interrupt(): Promise<void>;
|
|
63
65
|
nativeSessionId(): string | null;
|
|
66
|
+
/** What `commands()` reports: the runner's own commands (#66). */
|
|
67
|
+
runnerCommands: RunnerCommand[];
|
|
68
|
+
/** Every runner command invoked, in order. */
|
|
69
|
+
invoked: InvokedCommand[];
|
|
70
|
+
commands(): RunnerCommand[];
|
|
71
|
+
/** Runs it as a message that starts with it, which is what a runner reads. */
|
|
72
|
+
invokeCommand(name: string, args?: string): string;
|
|
64
73
|
/** Every answer this session was given, in order. */
|
|
65
74
|
answers: Array<{
|
|
66
75
|
id: string;
|
|
@@ -75,6 +84,11 @@ declare class FakeRunnerSession implements IRunnerSession {
|
|
|
75
84
|
emitEvent(event: StructuredEvent): void;
|
|
76
85
|
/** The runner reads a queued message inside the running turn, as `StructuredSession` reports it (ADR-0023). */
|
|
77
86
|
deliverMidTurn(id: string): void;
|
|
87
|
+
/**
|
|
88
|
+
* The turn ends without a `task_complete` call, and so does the turn the
|
|
89
|
+
* completion reminder opens if one was sent (ADR-0018, W1): the task waits for input.
|
|
90
|
+
*/
|
|
91
|
+
waitForInput(): void;
|
|
78
92
|
emitTurnEnd(reason: StructuredTurnEnd): void;
|
|
79
93
|
private deliver;
|
|
80
94
|
}
|
|
@@ -135,6 +149,7 @@ declare class FakeWorktreeIsolation implements IWorktreeIsolation {
|
|
|
135
149
|
shared: string[];
|
|
136
150
|
sharedRepos: string[];
|
|
137
151
|
copied: string[];
|
|
152
|
+
setupFailed: SetupFailure[];
|
|
138
153
|
/** Set to make `startRun` throw, as git does when no repo of the group can be isolated. */
|
|
139
154
|
startRunError: Error | null;
|
|
140
155
|
/** Set to make `discard` / `sweep` throw after logging the call. */
|
|
@@ -153,12 +168,15 @@ declare class FakeWorktreeIsolation implements IWorktreeIsolation {
|
|
|
153
168
|
repairEvidence: Map<string, RepairEvidence>;
|
|
154
169
|
calls: FakeIsolationCall[];
|
|
155
170
|
private holds;
|
|
171
|
+
private verifyHolds;
|
|
156
172
|
private runCount;
|
|
157
173
|
private log;
|
|
158
174
|
/** Task ids in the order `op` was called for them. */
|
|
159
175
|
taskIdsFor(op: 'prepare' | 'reopen' | 'verifyRepair' | 'integrate' | 'release'): string[];
|
|
160
176
|
/** Make `integrate` for this task wait until the returned function is called. */
|
|
161
177
|
holdIntegration(taskId: string): () => void;
|
|
178
|
+
/** Make `verifyRepair` for this task wait until the returned function is called. */
|
|
179
|
+
holdVerification(taskId: string): () => void;
|
|
162
180
|
isActive(workspaceRoot: string): Promise<IsolationAvailability>;
|
|
163
181
|
/** Like git: once the tracked changes are stashed, the tree is no longer dirty. */
|
|
164
182
|
stash(workspaceRoot: string): Promise<void>;
|
package/dist/testing.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { I as IFileSystem } from './IFileSystem-
|
|
3
|
-
import {
|
|
1
|
+
import { B as IRunnerSession, aa as QueuedTaskMessage, au as StructuredTurnEnd, at as StructuredEvent, az as TaskCompleteArgs, r as CheckpointAnswer, aB as TaskMessageFrom, ah as RunnerCommand, H as InvokedCommand, j as ApprovalDecision, y as IConfig } from './IRunner-C7_SSpzG.js';
|
|
2
|
+
import { I as IFileSystem } from './IFileSystem-BCJBHFwB.js';
|
|
3
|
+
import { g as IntegrationDisposal, I as IWorktreeIsolation, i as IsolationAvailability, q as IsolationMergeResult, am as TreeSnapshot, a0 as SetupFailure, s as IsolationPruneResult, t as IsolationRemoval, r as IsolationOutcome, T as RepairEvidence, v as IsolationRun, ac as Task, Q as PreparedTask, j as IsolationHandoff } from './Task-CxwnCJLi.js';
|
|
4
4
|
import 'child_process';
|
|
5
5
|
import 'zod/v4';
|
|
6
6
|
|
|
@@ -29,6 +29,8 @@ declare class FakeRunnerSession implements IRunnerSession {
|
|
|
29
29
|
messages: QueuedTaskMessage[];
|
|
30
30
|
/** Every message a turn was started with, in order. */
|
|
31
31
|
delivered: string[];
|
|
32
|
+
/** The ones of {@link delivered} Ordewell sent: the completion reminder (ADR-0018, W1). */
|
|
33
|
+
fromOrdewell: string[];
|
|
32
34
|
interrupts: number;
|
|
33
35
|
private messageCount;
|
|
34
36
|
private turnEndCbs;
|
|
@@ -52,7 +54,7 @@ declare class FakeRunnerSession implements IRunnerSession {
|
|
|
52
54
|
onToolCheckpoint(handler: (question: string, signal: AbortSignal) => Promise<CheckpointAnswer>): void;
|
|
53
55
|
/** The runner calls `checkpoint`, as `StructuredSession` relays it; settles with the answer. */
|
|
54
56
|
callCheckpoint(question: string, signal?: AbortSignal): Promise<CheckpointAnswer>;
|
|
55
|
-
sendMessage(text: string): string;
|
|
57
|
+
sendMessage(text: string, from?: TaskMessageFrom): string;
|
|
56
58
|
/** Interrupts, and the turn that replaces the interrupted one opens with the forced message. */
|
|
57
59
|
forceSend(text: string): string;
|
|
58
60
|
forceSendQueued(id: string): boolean;
|
|
@@ -61,6 +63,13 @@ declare class FakeRunnerSession implements IRunnerSession {
|
|
|
61
63
|
queued(): QueuedTaskMessage[];
|
|
62
64
|
interrupt(): Promise<void>;
|
|
63
65
|
nativeSessionId(): string | null;
|
|
66
|
+
/** What `commands()` reports: the runner's own commands (#66). */
|
|
67
|
+
runnerCommands: RunnerCommand[];
|
|
68
|
+
/** Every runner command invoked, in order. */
|
|
69
|
+
invoked: InvokedCommand[];
|
|
70
|
+
commands(): RunnerCommand[];
|
|
71
|
+
/** Runs it as a message that starts with it, which is what a runner reads. */
|
|
72
|
+
invokeCommand(name: string, args?: string): string;
|
|
64
73
|
/** Every answer this session was given, in order. */
|
|
65
74
|
answers: Array<{
|
|
66
75
|
id: string;
|
|
@@ -75,6 +84,11 @@ declare class FakeRunnerSession implements IRunnerSession {
|
|
|
75
84
|
emitEvent(event: StructuredEvent): void;
|
|
76
85
|
/** The runner reads a queued message inside the running turn, as `StructuredSession` reports it (ADR-0023). */
|
|
77
86
|
deliverMidTurn(id: string): void;
|
|
87
|
+
/**
|
|
88
|
+
* The turn ends without a `task_complete` call, and so does the turn the
|
|
89
|
+
* completion reminder opens if one was sent (ADR-0018, W1): the task waits for input.
|
|
90
|
+
*/
|
|
91
|
+
waitForInput(): void;
|
|
78
92
|
emitTurnEnd(reason: StructuredTurnEnd): void;
|
|
79
93
|
private deliver;
|
|
80
94
|
}
|
|
@@ -135,6 +149,7 @@ declare class FakeWorktreeIsolation implements IWorktreeIsolation {
|
|
|
135
149
|
shared: string[];
|
|
136
150
|
sharedRepos: string[];
|
|
137
151
|
copied: string[];
|
|
152
|
+
setupFailed: SetupFailure[];
|
|
138
153
|
/** Set to make `startRun` throw, as git does when no repo of the group can be isolated. */
|
|
139
154
|
startRunError: Error | null;
|
|
140
155
|
/** Set to make `discard` / `sweep` throw after logging the call. */
|
|
@@ -153,12 +168,15 @@ declare class FakeWorktreeIsolation implements IWorktreeIsolation {
|
|
|
153
168
|
repairEvidence: Map<string, RepairEvidence>;
|
|
154
169
|
calls: FakeIsolationCall[];
|
|
155
170
|
private holds;
|
|
171
|
+
private verifyHolds;
|
|
156
172
|
private runCount;
|
|
157
173
|
private log;
|
|
158
174
|
/** Task ids in the order `op` was called for them. */
|
|
159
175
|
taskIdsFor(op: 'prepare' | 'reopen' | 'verifyRepair' | 'integrate' | 'release'): string[];
|
|
160
176
|
/** Make `integrate` for this task wait until the returned function is called. */
|
|
161
177
|
holdIntegration(taskId: string): () => void;
|
|
178
|
+
/** Make `verifyRepair` for this task wait until the returned function is called. */
|
|
179
|
+
holdVerification(taskId: string): () => void;
|
|
162
180
|
isActive(workspaceRoot: string): Promise<IsolationAvailability>;
|
|
163
181
|
/** Like git: once the tracked changes are stashed, the tree is no longer dirty. */
|
|
164
182
|
stash(workspaceRoot: string): Promise<void>;
|
package/dist/testing.js
CHANGED
|
@@ -142,6 +142,8 @@ var FakeRunnerSession = class {
|
|
|
142
142
|
messages = [];
|
|
143
143
|
/** Every message a turn was started with, in order. */
|
|
144
144
|
delivered = [];
|
|
145
|
+
/** The ones of {@link delivered} Ordewell sent: the completion reminder (ADR-0018, W1). */
|
|
146
|
+
fromOrdewell = [];
|
|
145
147
|
interrupts = 0;
|
|
146
148
|
messageCount = 0;
|
|
147
149
|
turnEndCbs = [];
|
|
@@ -196,11 +198,11 @@ var FakeRunnerSession = class {
|
|
|
196
198
|
if (!this.checkpointHandler) throw new Error("no checkpoint handler attached");
|
|
197
199
|
return this.checkpointHandler(question, signal);
|
|
198
200
|
}
|
|
199
|
-
sendMessage(text) {
|
|
201
|
+
sendMessage(text, from) {
|
|
200
202
|
this.messageCount += 1;
|
|
201
203
|
const id = `msg-${this.messageCount}`;
|
|
202
|
-
if (this.state === "idle") this.deliver(text);
|
|
203
|
-
else this.messages.push({ id, text });
|
|
204
|
+
if (this.state === "idle") this.deliver(text, from);
|
|
205
|
+
else this.messages.push({ id, text, ...from ? { from } : {} });
|
|
204
206
|
return id;
|
|
205
207
|
}
|
|
206
208
|
/** Interrupts, and the turn that replaces the interrupted one opens with the forced message. */
|
|
@@ -214,7 +216,8 @@ var FakeRunnerSession = class {
|
|
|
214
216
|
}
|
|
215
217
|
forceSendQueued(id) {
|
|
216
218
|
const message = this.messages.find((m) => m.id === id);
|
|
217
|
-
if (!message
|
|
219
|
+
if (!message) return false;
|
|
220
|
+
if (message.forced) return true;
|
|
218
221
|
this.messages = this.messages.filter((m) => m !== message);
|
|
219
222
|
this.putForced({ ...message, forced: true });
|
|
220
223
|
if (this.state === "working") void this.interrupt();
|
|
@@ -239,6 +242,18 @@ var FakeRunnerSession = class {
|
|
|
239
242
|
nativeSessionId() {
|
|
240
243
|
return this.sessionId;
|
|
241
244
|
}
|
|
245
|
+
/** What `commands()` reports: the runner's own commands (#66). */
|
|
246
|
+
runnerCommands = [];
|
|
247
|
+
/** Every runner command invoked, in order. */
|
|
248
|
+
invoked = [];
|
|
249
|
+
commands() {
|
|
250
|
+
return [...this.runnerCommands];
|
|
251
|
+
}
|
|
252
|
+
/** Runs it as a message that starts with it, which is what a runner reads. */
|
|
253
|
+
invokeCommand(name, args = "") {
|
|
254
|
+
this.invoked.push({ name, ...args.trim() ? { args: args.trim() } : {} });
|
|
255
|
+
return this.sendMessage(args.trim() ? `/${name} ${args.trim()}` : `/${name}`);
|
|
256
|
+
}
|
|
242
257
|
/** Every answer this session was given, in order. */
|
|
243
258
|
answers = [];
|
|
244
259
|
openPermissions = /* @__PURE__ */ new Set();
|
|
@@ -265,18 +280,28 @@ var FakeRunnerSession = class {
|
|
|
265
280
|
const message = this.messages.find((m) => m.id === id);
|
|
266
281
|
if (!message) return;
|
|
267
282
|
this.messages = this.messages.filter((m) => m !== message);
|
|
268
|
-
this.emitEvent({ type: "message_delivered", messageId: id, text: message.text });
|
|
283
|
+
this.emitEvent({ type: "message_delivered", messageId: id, text: message.text, ...message.from ? { from: message.from } : {} });
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* The turn ends without a `task_complete` call, and so does the turn the
|
|
287
|
+
* completion reminder opens if one was sent (ADR-0018, W1): the task waits for input.
|
|
288
|
+
*/
|
|
289
|
+
waitForInput() {
|
|
290
|
+
const reminders = this.fromOrdewell.length;
|
|
291
|
+
this.emitTurnEnd("completed");
|
|
292
|
+
if (this.fromOrdewell.length > reminders) this.emitTurnEnd("completed");
|
|
269
293
|
}
|
|
270
294
|
emitTurnEnd(reason) {
|
|
271
295
|
const next = this.messages.shift();
|
|
272
296
|
if (!next) this.state = "idle";
|
|
273
297
|
for (const cb of this.turnEndCbs) cb(reason);
|
|
274
|
-
if (next) this.deliver(next.text);
|
|
298
|
+
if (next) this.deliver(next.text, next.from);
|
|
275
299
|
}
|
|
276
|
-
deliver(text) {
|
|
300
|
+
deliver(text, from) {
|
|
277
301
|
this.state = "working";
|
|
278
302
|
this.delivered.push(text);
|
|
279
|
-
|
|
303
|
+
if (from === "ordewell") this.fromOrdewell.push(text);
|
|
304
|
+
this.emitEvent({ type: "turn_start", text, ...from ? { from } : {} });
|
|
280
305
|
}
|
|
281
306
|
};
|
|
282
307
|
var FakeWorktreeIsolation = class {
|
|
@@ -301,6 +326,7 @@ var FakeWorktreeIsolation = class {
|
|
|
301
326
|
shared = [];
|
|
302
327
|
sharedRepos = [];
|
|
303
328
|
copied = [];
|
|
329
|
+
setupFailed = [];
|
|
304
330
|
/** Set to make `startRun` throw, as git does when no repo of the group can be isolated. */
|
|
305
331
|
startRunError = null;
|
|
306
332
|
/** Set to make `discard` / `sweep` throw after logging the call. */
|
|
@@ -319,6 +345,7 @@ var FakeWorktreeIsolation = class {
|
|
|
319
345
|
repairEvidence = /* @__PURE__ */ new Map();
|
|
320
346
|
calls = [];
|
|
321
347
|
holds = /* @__PURE__ */ new Map();
|
|
348
|
+
verifyHolds = /* @__PURE__ */ new Map();
|
|
322
349
|
runCount = 0;
|
|
323
350
|
log(call) {
|
|
324
351
|
this.calls.push(call);
|
|
@@ -335,6 +362,14 @@ var FakeWorktreeIsolation = class {
|
|
|
335
362
|
}));
|
|
336
363
|
return open;
|
|
337
364
|
}
|
|
365
|
+
/** Make `verifyRepair` for this task wait until the returned function is called. */
|
|
366
|
+
holdVerification(taskId) {
|
|
367
|
+
let open;
|
|
368
|
+
this.verifyHolds.set(taskId, new Promise((resolve) => {
|
|
369
|
+
open = resolve;
|
|
370
|
+
}));
|
|
371
|
+
return open;
|
|
372
|
+
}
|
|
338
373
|
async isActive(workspaceRoot) {
|
|
339
374
|
this.log({ op: "isActive", workspaceRoot });
|
|
340
375
|
return this.availability;
|
|
@@ -377,7 +412,7 @@ var FakeWorktreeIsolation = class {
|
|
|
377
412
|
status: "active",
|
|
378
413
|
repos: Object.fromEntries(run.repos.map((r) => [r.path, { worktree: r.path === SELF_REPO ? cwd : `${cwd}/${r.path}`, linked: [] }]))
|
|
379
414
|
};
|
|
380
|
-
return { cwd, branch, copied: [...this.copied] };
|
|
415
|
+
return { cwd, branch, copied: [...this.copied], ...this.setupFailed.length > 0 ? { setupFailed: [...this.setupFailed] } : {} };
|
|
381
416
|
}
|
|
382
417
|
/** Like git: the same cwd, each changed repo's tip recorded, the repair counted. */
|
|
383
418
|
async reopen(task, run) {
|
|
@@ -394,6 +429,7 @@ var FakeWorktreeIsolation = class {
|
|
|
394
429
|
}
|
|
395
430
|
async verifyRepair(task, _run) {
|
|
396
431
|
this.log({ op: "verifyRepair", taskId: task.id });
|
|
432
|
+
await this.verifyHolds.get(task.id);
|
|
397
433
|
return this.repairEvidence.get(task.id) ?? { ok: true };
|
|
398
434
|
}
|
|
399
435
|
/** Like git: the landing is recorded and persisted before the (held) merge, and cleared once it settles. */
|