mainflow 0.42.0 → 0.43.0-alpha.2
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/cli.js +767 -155
- package/dist/{dist-zSabglPq.js → dist-D5rZ0MQH.js} +71 -23
- package/dist/facts.d.ts +67 -12
- package/dist/facts.js +62 -13
- package/dist/grant-commands.d.ts +1 -1
- package/dist/grant-commands.js +1 -1
- package/dist/hooks.d.ts +5 -540
- package/dist/hooks.js +126 -92
- package/dist/{host-BAMZmRy8.js → host-BJvqZy-i.js} +1374 -489
- package/dist/host.d.ts +3 -2
- package/dist/host.js +1 -1
- package/dist/{index-Dk4fCI7q.d.ts → index-BqPQp6TF.d.ts} +2 -8
- package/dist/index-DRpamPge.d.ts +550 -0
- package/dist/launch.d.ts +6 -5
- package/dist/launch.js +323 -1
- package/dist/native/mainflow-swap-darwin-arm64 +0 -0
- package/dist/native/mainflow-swap-darwin-x64 +0 -0
- package/dist/{operation-2wx2ex6x.js → operation-BhBbGauo.js} +395 -337
- package/dist/{ui-D1dg19Jw.js → ui-xxzmhAqF.js} +107 -98
- package/dist/version-Dvv4jwF1.js +6 -0
- package/dist/web/assets/{index-DvYj_6IC.js → index-B4w2iRCQ.js} +2 -2
- package/dist/web/index.html +1 -1
- package/package.json +2 -2
- package/dist/launch-DosYhbwc.js +0 -327
package/dist/hooks.d.ts
CHANGED
|
@@ -1,541 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { z } from "zod";
|
|
3
|
-
//#region ../core/dist/ids/allocators.d.ts
|
|
4
|
-
/** The letters ids start with. */
|
|
5
|
-
type IdPrefix = 'm' | 't' | 'd' | 'i' | 'f' | 'w' | 'c' | 'r' | 'a';
|
|
6
|
-
/** One id an operation needs. */
|
|
7
|
-
interface IdRequest {
|
|
8
|
-
prefix: IdPrefix;
|
|
9
|
-
/** Ids already used in the scope the new one goes into */
|
|
10
|
-
taken: readonly string[];
|
|
11
|
-
/** The reference an id makes in this scope, like id => `m001/t002#${id}`; allocations are reported as references */
|
|
12
|
-
ref: (id: string) => string;
|
|
13
|
-
}
|
|
14
|
-
interface Allocation {
|
|
15
|
-
id: string;
|
|
16
|
-
/** The reference the id makes, e.g. m001/t002#c003 */
|
|
17
|
-
ref: string;
|
|
18
|
-
/** Numbered while offline; the sync server confirms it or gives another when it is taken */
|
|
19
|
-
provisional: boolean;
|
|
20
|
-
/** The provisional reference this id replaces, when the sender's number was taken */
|
|
21
|
-
replaced?: string;
|
|
22
|
-
}
|
|
23
|
-
interface IdAllocator {
|
|
24
|
-
readonly mode: 'local' | 'server' | 'offline';
|
|
25
|
-
next(request: IdRequest): Allocation;
|
|
26
|
-
}
|
|
27
|
-
//#endregion
|
|
28
|
-
//#region ../core/dist/ops/document.d.ts
|
|
29
|
-
/** What an operation needs from its caller besides its input. */
|
|
30
|
-
interface OpContext {
|
|
31
|
-
/**
|
|
32
|
-
* The caller's local time to the minute with its offset from UTC, like 2026-09-24T15:30+08:00 (`Z` for UTC).
|
|
33
|
-
* Dates and times an operation writes come from it, so an operation run where the clock is in another time
|
|
34
|
-
* zone, such as UTC in Workers, writes the caller's dates, and its times keep the caller's offset.
|
|
35
|
-
*/
|
|
36
|
-
now: string;
|
|
37
|
-
/** Who numbers new entries (src/ids/); without one, the next free id, final at once */
|
|
38
|
-
ids?: IdAllocator;
|
|
39
|
-
}
|
|
40
|
-
//#endregion
|
|
41
|
-
//#region ../core/dist/storage/types.d.ts
|
|
42
|
-
/** One name inside a directory. */
|
|
43
|
-
interface Entry {
|
|
44
|
-
name: string;
|
|
45
|
-
dir: boolean;
|
|
46
|
-
}
|
|
47
|
-
/** What an operation may read. */
|
|
48
|
-
interface HubReader {
|
|
49
|
-
/** The text of a file, or null when it does not exist. */
|
|
50
|
-
read(path: string): string | null;
|
|
51
|
-
/** The files and directories directly inside `dir`, sorted by name; empty when `dir` does not exist. */
|
|
52
|
-
list(dir: string): Entry[];
|
|
53
|
-
/** How messages name a path, such as the absolute file path on disk. */
|
|
54
|
-
where(path: string): string;
|
|
55
|
-
}
|
|
56
|
-
//#endregion
|
|
57
|
-
//#region ../core/dist/ids/renumber.d.ts
|
|
58
|
-
/** One id the sync server replaced, as references: the provisional one and the one the entry has now. */
|
|
59
|
-
interface Renumbering {
|
|
60
|
-
from: string;
|
|
61
|
-
to: string;
|
|
62
|
-
}
|
|
63
|
-
//#endregion
|
|
64
|
-
//#region ../core/dist/ops/draft.d.ts
|
|
65
|
-
/** One change to a hub's storage. */
|
|
66
|
-
type Change = {
|
|
67
|
-
kind: 'write';
|
|
68
|
-
path: string;
|
|
69
|
-
text: string;
|
|
70
|
-
} | {
|
|
71
|
-
kind: 'append';
|
|
72
|
-
path: string;
|
|
73
|
-
text: string;
|
|
74
|
-
} | {
|
|
75
|
-
kind: 'makeDir';
|
|
76
|
-
path: string;
|
|
77
|
-
} | {
|
|
78
|
-
kind: 'remove';
|
|
79
|
-
path: string;
|
|
80
|
-
};
|
|
81
|
-
/** Something the writer should be told although the operation went through, such as a file kept against its request. */
|
|
82
|
-
interface Notice {
|
|
83
|
-
path: string;
|
|
84
|
-
message: string;
|
|
85
|
-
}
|
|
86
|
-
interface OpResult<T> {
|
|
87
|
-
/** What the operation reports back, such as the entry it created */
|
|
88
|
-
value: T;
|
|
89
|
-
/** The changes to apply, in order */
|
|
90
|
-
changes: Change[];
|
|
91
|
-
/** Ids this operation numbered, as references like m014, m001/t007 or claude-code-1a2b3c4d#a003, in the order it numbered them */
|
|
92
|
-
allocated: string[];
|
|
93
|
-
/** Provisional ids the allocator replaced because they were taken, with the ids the entries have instead */
|
|
94
|
-
renumbered: Renumbering[];
|
|
95
|
-
notices: Notice[];
|
|
96
|
-
}
|
|
97
|
-
//#endregion
|
|
98
|
-
//#region ../core/dist/ops/status.d.ts
|
|
99
|
-
/** What a new criterion or checklist item says: what to do and when it counts as done. */
|
|
100
|
-
interface ListItemInput {
|
|
101
|
-
text: string;
|
|
102
|
-
doneWhen: string;
|
|
103
|
-
}
|
|
104
|
-
//#endregion
|
|
105
|
-
//#region ../core/dist/ops/hub.d.ts
|
|
106
|
-
/** Register a repository the hub's tasks may point at; `path` is relative to the hub root. */
|
|
107
|
-
declare function addRepo(hub: HubReader, input: {
|
|
108
|
-
name: string;
|
|
109
|
-
path: string;
|
|
110
|
-
}): OpResult<string>;
|
|
111
|
-
/**
|
|
112
|
-
* Register another hub whose documents this hub's references may point at, as `{name}:m001`. `path` is relative
|
|
113
|
-
* to this hub's root; the caller checks that it holds that hub under the same name.
|
|
114
|
-
*/
|
|
115
|
-
declare function addHub(hub: HubReader, input: {
|
|
116
|
-
name: string;
|
|
117
|
-
path: string;
|
|
118
|
-
}): OpResult<string>;
|
|
119
|
-
//#endregion
|
|
120
|
-
//#region ../core/dist/ops/mainlines.d.ts
|
|
121
|
-
interface MainlineInput {
|
|
122
|
-
slug: string;
|
|
123
|
-
title: string;
|
|
124
|
-
/** A group of this hub the mainline belongs to */
|
|
125
|
-
group?: string;
|
|
126
|
-
priority?: string;
|
|
127
|
-
}
|
|
128
|
-
declare function createMainline(hub: HubReader, input: MainlineInput, ctx: OpContext): OpResult<{
|
|
129
|
-
id: string;
|
|
130
|
-
dir: string;
|
|
131
|
-
}>;
|
|
132
|
-
/** What `mainline set` changes; at least one. */
|
|
133
|
-
interface MainlinePatch {
|
|
134
|
-
id: string;
|
|
135
|
-
status?: string;
|
|
136
|
-
/** A group of this hub, or `none` (null) to leave every group */
|
|
137
|
-
group?: string | null;
|
|
138
|
-
priority?: string;
|
|
139
|
-
expectedVersion?: string;
|
|
140
|
-
}
|
|
141
|
-
/**
|
|
142
|
-
* Change a mainline's status, group or priority. Done is refused while criteria are open or decisions are
|
|
143
|
-
* proposed; the other fields change without conditions, in the same write.
|
|
144
|
-
*/
|
|
145
|
-
declare function setMainline(hub: HubReader, input: MainlinePatch, ctx: OpContext): OpResult<Mainline>;
|
|
146
|
-
/** Rename a mainline. References use its ID, so they keep resolving and show the new title. */
|
|
147
|
-
declare function setMainlineTitle(hub: HubReader, input: {
|
|
148
|
-
id: string;
|
|
149
|
-
title: string;
|
|
150
|
-
expectedVersion?: string;
|
|
151
|
-
}): OpResult<Mainline>;
|
|
152
|
-
declare function setMainlineArchived(hub: HubReader, input: {
|
|
153
|
-
id: string;
|
|
154
|
-
archived: boolean;
|
|
155
|
-
expectedVersion?: string;
|
|
156
|
-
}, ctx: OpContext): OpResult<Mainline>;
|
|
157
|
-
/** Add an open criterion at the end of the list of the mainline or group in `mainline`, numbered by the context's allocator. */
|
|
158
|
-
declare function addCriterion(hub: HubReader, input: ListItemInput & {
|
|
159
|
-
mainline: string;
|
|
160
|
-
}, ctx: OpContext): OpResult<{
|
|
161
|
-
ref: string;
|
|
162
|
-
}>;
|
|
163
|
-
declare function setCriterion(hub: HubReader, input: {
|
|
164
|
-
ref: string;
|
|
165
|
-
done: boolean;
|
|
166
|
-
evidence?: string;
|
|
167
|
-
expectedVersion?: string;
|
|
168
|
-
}, ctx: OpContext): OpResult<Mainline | Group>;
|
|
169
|
-
/** What `criterion set` rewrites; at least one must be given. `done` stays as it is; use criterion check/uncheck for that. */
|
|
170
|
-
interface CriterionTextPatch {
|
|
171
|
-
text?: string;
|
|
172
|
-
doneWhen?: string;
|
|
173
|
-
}
|
|
174
|
-
/** Rewrite a criterion's text or doneWhen, leaving done and evidence as they are. */
|
|
175
|
-
declare function setCriterionText(hub: HubReader, input: {
|
|
176
|
-
ref: string;
|
|
177
|
-
patch: CriterionTextPatch;
|
|
178
|
-
expectedVersion?: string;
|
|
179
|
-
}): OpResult<Mainline | Group>;
|
|
180
|
-
//#endregion
|
|
181
|
-
//#region ../core/dist/ops/tasks.d.ts
|
|
182
|
-
interface TaskInput {
|
|
183
|
-
slug: string;
|
|
184
|
-
title: string;
|
|
185
|
-
kind?: string;
|
|
186
|
-
parent?: string | null;
|
|
187
|
-
repo?: string | null;
|
|
188
|
-
}
|
|
189
|
-
declare function createTask(hub: HubReader, input: TaskInput & {
|
|
190
|
-
mainline: string;
|
|
191
|
-
}, ctx: OpContext): OpResult<{
|
|
192
|
-
ref: string;
|
|
193
|
-
dir: string;
|
|
194
|
-
}>;
|
|
195
|
-
/**
|
|
196
|
-
* What `task set` changes: the status with the fields a transition needs, and the repository and branch
|
|
197
|
-
* the task works on. Title, parent and prose are written in task.md directly.
|
|
198
|
-
*/
|
|
199
|
-
interface TaskPatch {
|
|
200
|
-
status?: string;
|
|
201
|
-
repo?: string | null;
|
|
202
|
-
/** Required with status blocked; cleared when the task leaves blocked */
|
|
203
|
-
blockedBy?: {
|
|
204
|
-
reason: string;
|
|
205
|
-
waitingFor?: string;
|
|
206
|
-
signal?: string;
|
|
207
|
-
};
|
|
208
|
-
branch?: string;
|
|
209
|
-
worktree?: string;
|
|
210
|
-
base?: string;
|
|
211
|
-
merge?: string;
|
|
212
|
-
}
|
|
213
|
-
declare function updateTask(hub: HubReader, input: {
|
|
214
|
-
ref: string;
|
|
215
|
-
patch: TaskPatch;
|
|
216
|
-
expectedVersion?: string;
|
|
217
|
-
}, ctx: OpContext): OpResult<Task>;
|
|
218
|
-
/** Add an open item at the end of the task's checklist, numbered by the context's allocator. */
|
|
219
|
-
declare function addChecklistItem(hub: HubReader, input: ListItemInput & {
|
|
220
|
-
task: string;
|
|
221
|
-
serves?: string[];
|
|
222
|
-
}, ctx: OpContext): OpResult<{
|
|
223
|
-
ref: string;
|
|
224
|
-
item: ChecklistItem;
|
|
225
|
-
}>;
|
|
226
|
-
declare function setChecklistItem(hub: HubReader, input: {
|
|
227
|
-
ref: string;
|
|
228
|
-
done: boolean;
|
|
229
|
-
evidence?: string;
|
|
230
|
-
expectedVersion?: string;
|
|
231
|
-
}, ctx: OpContext): OpResult<Task>;
|
|
232
|
-
/** Mark an item as no longer needed, naming what replaced it when something did. */
|
|
233
|
-
declare function dropChecklistItem(hub: HubReader, input: {
|
|
234
|
-
ref: string;
|
|
235
|
-
supersededBy?: string;
|
|
236
|
-
note?: string;
|
|
237
|
-
expectedVersion?: string;
|
|
238
|
-
}): OpResult<Task>;
|
|
239
|
-
/** Bring a dropped item back as an open one: clears dropped and supersededBy, keeps the note. */
|
|
240
|
-
declare function undropChecklistItem(hub: HubReader, input: {
|
|
241
|
-
ref: string;
|
|
242
|
-
expectedVersion?: string;
|
|
243
|
-
}): OpResult<Task>;
|
|
244
|
-
//#endregion
|
|
245
|
-
//#region ../core/dist/ops/decisions.d.ts
|
|
246
|
-
interface DecisionInput {
|
|
247
|
-
slug: string;
|
|
248
|
-
title: string;
|
|
249
|
-
/** proposed while the question is open; accepted by default */
|
|
250
|
-
status?: string;
|
|
251
|
-
by?: string;
|
|
252
|
-
/** explicit when the decider named an option, recommended when they went with the recommendation */
|
|
253
|
-
basis?: string;
|
|
254
|
-
/** Tasks and items the decision shapes; the checklist items among them wait while it is proposed */
|
|
255
|
-
affects?: string[];
|
|
256
|
-
}
|
|
257
|
-
declare function createDecision(hub: HubReader, input: DecisionInput & {
|
|
258
|
-
mainline: string;
|
|
259
|
-
}, ctx: OpContext): OpResult<{
|
|
260
|
-
ref: string;
|
|
261
|
-
file: string;
|
|
262
|
-
}>;
|
|
263
|
-
/** Who settled a decision, and whether they named an option or went with the recommendation. */
|
|
264
|
-
interface DecisionSettlement {
|
|
265
|
-
by?: string;
|
|
266
|
-
basis?: string;
|
|
267
|
-
}
|
|
268
|
-
/** Settle a proposed decision: record who decided, how and when; the items it affects stop waiting for it. */
|
|
269
|
-
declare function acceptDecision(hub: HubReader, input: {
|
|
270
|
-
ref: string;
|
|
271
|
-
expectedVersion?: string;
|
|
272
|
-
} & DecisionSettlement, ctx: OpContext): OpResult<Decision>;
|
|
273
|
-
declare function supersedeDecision(hub: HubReader, input: {
|
|
274
|
-
ref: string;
|
|
275
|
-
by: string;
|
|
276
|
-
expectedVersion?: string;
|
|
277
|
-
}, ctx: OpContext): OpResult<Decision>;
|
|
278
|
-
//#endregion
|
|
279
|
-
//#region ../core/dist/ops/hub-items.d.ts
|
|
280
|
-
interface HubItemInput {
|
|
281
|
-
slug: string;
|
|
282
|
-
title: string;
|
|
283
|
-
origin?: string;
|
|
284
|
-
labels?: string[];
|
|
285
|
-
}
|
|
286
|
-
declare function createIssue(hub: HubReader, input: HubItemInput & {
|
|
287
|
-
group?: string;
|
|
288
|
-
priority?: string;
|
|
289
|
-
}, ctx: OpContext): OpResult<{
|
|
290
|
-
id: string;
|
|
291
|
-
file: string;
|
|
292
|
-
}>;
|
|
293
|
-
/** What `issue set` changes: the group the issue is taken up with and its priority; at least one. */
|
|
294
|
-
interface IssuePatch {
|
|
295
|
-
/** A group of this hub, or `none` (null) to leave every group */
|
|
296
|
-
group?: string | null;
|
|
297
|
-
priority?: string;
|
|
298
|
-
}
|
|
299
|
-
declare function setIssue(hub: HubReader, input: {
|
|
300
|
-
id: string;
|
|
301
|
-
patch: IssuePatch;
|
|
302
|
-
expectedVersion?: string;
|
|
303
|
-
}): OpResult<Issue>;
|
|
304
|
-
/** Schedule an issue into the task that will carry it out. */
|
|
305
|
-
declare function planIssue(hub: HubReader, input: {
|
|
306
|
-
id: string;
|
|
307
|
-
task: string;
|
|
308
|
-
expectedVersion?: string;
|
|
309
|
-
}): OpResult<Issue>;
|
|
310
|
-
declare function closeIssue(hub: HubReader, input: {
|
|
311
|
-
id: string;
|
|
312
|
-
resolution: string;
|
|
313
|
-
expectedVersion?: string;
|
|
314
|
-
}, ctx: OpContext): OpResult<Issue>;
|
|
315
|
-
declare function reopenIssue(hub: HubReader, input: {
|
|
316
|
-
id: string;
|
|
317
|
-
expectedVersion?: string;
|
|
318
|
-
}): OpResult<Issue>;
|
|
319
|
-
/** Archive or unarchive an issue; the status stays as it is, so a closed issue is visible until archived. */
|
|
320
|
-
declare function setIssueArchived(hub: HubReader, input: {
|
|
321
|
-
id: string;
|
|
322
|
-
archived: boolean;
|
|
323
|
-
expectedVersion?: string;
|
|
324
|
-
}, ctx: OpContext): OpResult<Issue>;
|
|
325
|
-
declare function createFinding(hub: HubReader, input: HubItemInput, ctx: OpContext): OpResult<{
|
|
326
|
-
id: string;
|
|
327
|
-
file: string;
|
|
328
|
-
}>;
|
|
329
|
-
declare function setFindingStatus(hub: HubReader, input: {
|
|
330
|
-
id: string;
|
|
331
|
-
status: string;
|
|
332
|
-
expectedVersion?: string;
|
|
333
|
-
}, ctx: OpContext): OpResult<Finding>;
|
|
334
|
-
/** Archive or unarchive a finding; the status stays as it is, so an obsolete finding is visible until archived. */
|
|
335
|
-
declare function setFindingArchived(hub: HubReader, input: {
|
|
336
|
-
id: string;
|
|
337
|
-
archived: boolean;
|
|
338
|
-
expectedVersion?: string;
|
|
339
|
-
}, ctx: OpContext): OpResult<Finding>;
|
|
340
|
-
/**
|
|
341
|
-
* A group gathers mainlines and issues that are taken up together, apart from what depends on what. Its members name
|
|
342
|
-
* it in their own `group`, so creating a group writes only the group's file.
|
|
343
|
-
*/
|
|
344
|
-
declare function createGroup(hub: HubReader, input: HubItemInput & {
|
|
345
|
-
priority?: string;
|
|
346
|
-
trigger?: string;
|
|
347
|
-
}, ctx: OpContext): OpResult<{
|
|
348
|
-
id: string;
|
|
349
|
-
file: string;
|
|
350
|
-
}>;
|
|
351
|
-
/** What `group set` changes; at least one. An empty trigger removes it. */
|
|
352
|
-
interface GroupPatch {
|
|
353
|
-
status?: string;
|
|
354
|
-
priority?: string;
|
|
355
|
-
trigger?: string;
|
|
356
|
-
title?: string;
|
|
357
|
-
}
|
|
358
|
-
declare function setGroup(hub: HubReader, input: {
|
|
359
|
-
id: string;
|
|
360
|
-
patch: GroupPatch;
|
|
361
|
-
expectedVersion?: string;
|
|
362
|
-
}, ctx: OpContext): OpResult<Group>;
|
|
363
|
-
/** Append one external operation to ops/{YYYY-MM}.log; the log is never rewritten. `at` defaults to the context's time. */
|
|
364
|
-
declare function appendOps(hub: HubReader, input: Omit<OpsEntry, 'at'> & {
|
|
365
|
-
at?: string;
|
|
366
|
-
}, ctx: OpContext): OpResult<OpsEntry>;
|
|
367
|
-
//#endregion
|
|
368
|
-
//#region ../core/dist/ops/sections.d.ts
|
|
369
|
-
/** Add text at the end of a section of a document's body; the front matter is kept as it is written. */
|
|
370
|
-
declare function appendSection(hub: HubReader, input: {
|
|
371
|
-
ref: string;
|
|
372
|
-
section: string;
|
|
373
|
-
text: string;
|
|
374
|
-
}): OpResult<{
|
|
375
|
-
file: string;
|
|
376
|
-
}>;
|
|
377
|
-
//#endregion
|
|
378
|
-
//#region ../core/dist/ops/files.d.ts
|
|
379
|
-
type Removal = 'removed' | 'absent' | 'kept';
|
|
380
|
-
/**
|
|
381
|
-
* Remove the file at `path` when it is still the version the deleter had, given as its content hash (`base`).
|
|
382
|
-
* A deletion only takes away what the deleter saw: when the file changed since, such as an action another
|
|
383
|
-
* environment added to a session at the same time, removing it would lose that change unseen. The file is kept
|
|
384
|
-
* as it is now and a notice tells the deleter why. A file that is already gone stays gone.
|
|
385
|
-
*/
|
|
386
|
-
declare function removeFile(hub: HubReader, input: {
|
|
387
|
-
path: string;
|
|
388
|
-
base: string;
|
|
389
|
-
}): OpResult<Removal>;
|
|
390
|
-
//#endregion
|
|
391
|
-
//#region ../core/dist/ops/sessions.d.ts
|
|
392
|
-
interface SessionInput {
|
|
393
|
-
/** The caller picks the id, such as `{agent}-{8 random hex}`, since an operation draws no random numbers */
|
|
394
|
-
id: string;
|
|
395
|
-
agent: string;
|
|
396
|
-
cwd: string;
|
|
397
|
-
delegatedFrom?: string | null;
|
|
398
|
-
handoffFrom?: string | null;
|
|
399
|
-
}
|
|
400
|
-
/**
|
|
401
|
-
* Start a session. Taking over from another session moves its unfinished actions into this one and marks
|
|
402
|
-
* the other session handed-off, so the queue continues where it stopped.
|
|
403
|
-
*/
|
|
404
|
-
declare function startSession(hub: HubReader, input: SessionInput, ctx: OpContext): OpResult<Session>;
|
|
405
|
-
/**
|
|
406
|
-
* Start the session unless it already exists. An existing paused or ended session becomes active again, and
|
|
407
|
-
* an archived one comes back into view, since resumed work should not stay hidden.
|
|
408
|
-
*/
|
|
409
|
-
declare function ensureSession(hub: HubReader, input: SessionInput, ctx: OpContext): OpResult<{
|
|
410
|
-
session: Session;
|
|
411
|
-
created: boolean;
|
|
412
|
-
}>;
|
|
413
|
-
/**
|
|
414
|
-
* Take over another session's unfinished actions into a session that already exists, such as one a host hook
|
|
415
|
-
* created when the conversation opened. The receiving session must have nothing unfinished of its own, so the
|
|
416
|
-
* carried queue is not mixed into work already under way; its finished actions stay and the carried ones are
|
|
417
|
-
* numbered after them.
|
|
418
|
-
*/
|
|
419
|
-
declare function handoffSession(hub: HubReader, input: {
|
|
420
|
-
id: string;
|
|
421
|
-
from: string;
|
|
422
|
-
}, ctx: OpContext): OpResult<Session>;
|
|
423
|
-
/** Environment facts a platform adapter learns about a session; only the given fields change. */
|
|
424
|
-
type SessionInfo = Partial<Pick<Session, 'transcript' | 'worktree' | 'branch' | 'model' | 'effort' | 'description' | 'depth' | 'summary'>>;
|
|
425
|
-
declare function setSessionInfo(hub: HubReader, input: {
|
|
426
|
-
id: string;
|
|
427
|
-
info: SessionInfo;
|
|
428
|
-
}): OpResult<Session>;
|
|
429
|
-
/** Remember the digest of what the last turn reminder listed in full; null forgets it, so the next reminder lists everything again. */
|
|
430
|
-
declare function setReminderDigest(hub: HubReader, input: {
|
|
431
|
-
id: string;
|
|
432
|
-
digest: string | null;
|
|
433
|
-
}): OpResult<Session>;
|
|
434
|
-
declare function setSessionStatus(hub: HubReader, input: {
|
|
435
|
-
id: string;
|
|
436
|
-
status: string;
|
|
437
|
-
}): OpResult<Session>;
|
|
438
|
-
type Settled = 'removed' | 'ended' | 'kept';
|
|
439
|
-
/**
|
|
440
|
-
* Settle a session when its turn ends. A session that tracked no action, and whose subagents tracked none, leaves
|
|
441
|
-
* no record, since nothing in it points at the hub's work. Then every active main session with no action left to
|
|
442
|
-
* do and no subagent still running ends, the others as well as this one: another session may have finished its
|
|
443
|
-
* last action, or it was closed before its own turn could settle it. The next prompt or action brings it back.
|
|
444
|
-
*/
|
|
445
|
-
declare function settleSession(hub: HubReader, input: {
|
|
446
|
-
id: string;
|
|
447
|
-
}): OpResult<Settled>;
|
|
448
|
-
/** Archive or unarchive a session; the status stays as it is, so an ended session is visible until archived. */
|
|
449
|
-
declare function setSessionArchived(hub: HubReader, input: {
|
|
450
|
-
id: string;
|
|
451
|
-
archived: boolean;
|
|
452
|
-
}, ctx: OpContext): OpResult<Session>;
|
|
453
|
-
interface ActionInput {
|
|
454
|
-
session: string;
|
|
455
|
-
do: string;
|
|
456
|
-
serves: string[];
|
|
457
|
-
before?: string;
|
|
458
|
-
}
|
|
459
|
-
/** Queue an action; the value is its reference, like claude-code-1a2b3c4d#a003. */
|
|
460
|
-
declare function addAction(hub: HubReader, input: ActionInput, ctx: OpContext): OpResult<string>;
|
|
461
|
-
interface ActionPatch {
|
|
462
|
-
status?: string;
|
|
463
|
-
do?: string;
|
|
464
|
-
serves?: string[];
|
|
465
|
-
before?: string;
|
|
466
|
-
note?: string;
|
|
467
|
-
/** Required with status blocked; cleared when the action leaves blocked */
|
|
468
|
-
blockedBy?: ActionBlock;
|
|
469
|
-
}
|
|
470
|
-
declare function updateAction(hub: HubReader, input: {
|
|
471
|
-
ref: string;
|
|
472
|
-
patch: ActionPatch;
|
|
473
|
-
}, ctx: OpContext): OpResult<Action>;
|
|
474
|
-
//#endregion
|
|
475
|
-
//#region ../core/dist/ops/protocol.d.ts
|
|
476
|
-
/**
|
|
477
|
-
* Every operation by name. A name is the CLI command that sends it with the words joined by a dot, the noun
|
|
478
|
-
* first (`new task` sends `task.new`); a pair of commands that set and clear one thing shares an operation
|
|
479
|
-
* (`item check` and `item uncheck` send `item.check`, with done true or false). The operations no command sends
|
|
480
|
-
* are listed in COMMANDLESS_OPERATIONS with who sends them.
|
|
481
|
-
*/
|
|
482
|
-
declare const OPERATION_NAMES: readonly ['repo.add', 'hub.add', 'mainline.new', 'mainline.set', 'mainline.title', 'mainline.archive', 'criterion.add', 'criterion.check', 'criterion.set', 'task.new', 'task.set', 'item.add', 'item.check', 'item.drop', 'item.undrop', 'decision.new', 'decision.accept', 'decision.supersede', 'issue.new', 'issue.set', 'issue.plan', 'issue.close', 'issue.reopen', 'issue.archive', 'finding.new', 'finding.set', 'finding.archive', 'group.new', 'group.set', 'ops.add', 'section.append', 'session.start', 'session.ensure', 'session.handoff', 'session.info', 'session.reminder', 'session.set', 'session.settle', 'session.archive', 'action.add', 'action.set', 'file.remove'];
|
|
483
|
-
type OperationName = (typeof OPERATION_NAMES)[number];
|
|
484
|
-
//#endregion
|
|
485
|
-
//#region ../core/dist/ops/operations.d.ts
|
|
486
|
-
/**
|
|
487
|
-
* The operations by name, for a server that receives them from elsewhere. The names are the protocol's
|
|
488
|
-
* (OPERATION_NAMES in protocol.ts): the table must hold every one of them and nothing else. `migrate` and `init`
|
|
489
|
-
* are absent: migration rewrites the whole hub in one go and a new hub starts on the caller's machine, so neither
|
|
490
|
-
* is sent as an operation.
|
|
491
|
-
*/
|
|
492
|
-
declare const OPERATIONS: {
|
|
493
|
-
readonly 'repo.add': typeof addRepo;
|
|
494
|
-
readonly 'hub.add': typeof addHub;
|
|
495
|
-
readonly 'mainline.new': typeof createMainline;
|
|
496
|
-
readonly 'mainline.set': typeof setMainline;
|
|
497
|
-
readonly 'mainline.title': typeof setMainlineTitle;
|
|
498
|
-
readonly 'mainline.archive': typeof setMainlineArchived;
|
|
499
|
-
readonly 'criterion.add': typeof addCriterion;
|
|
500
|
-
readonly 'criterion.check': typeof setCriterion;
|
|
501
|
-
readonly 'criterion.set': typeof setCriterionText;
|
|
502
|
-
readonly 'task.new': typeof createTask;
|
|
503
|
-
readonly 'task.set': typeof updateTask;
|
|
504
|
-
readonly 'item.add': typeof addChecklistItem;
|
|
505
|
-
readonly 'item.check': typeof setChecklistItem;
|
|
506
|
-
readonly 'item.drop': typeof dropChecklistItem;
|
|
507
|
-
readonly 'item.undrop': typeof undropChecklistItem;
|
|
508
|
-
readonly 'decision.new': typeof createDecision;
|
|
509
|
-
readonly 'decision.accept': typeof acceptDecision;
|
|
510
|
-
readonly 'decision.supersede': typeof supersedeDecision;
|
|
511
|
-
readonly 'issue.new': typeof createIssue;
|
|
512
|
-
readonly 'issue.set': typeof setIssue;
|
|
513
|
-
readonly 'issue.plan': typeof planIssue;
|
|
514
|
-
readonly 'issue.close': typeof closeIssue;
|
|
515
|
-
readonly 'issue.reopen': typeof reopenIssue;
|
|
516
|
-
readonly 'issue.archive': typeof setIssueArchived;
|
|
517
|
-
readonly 'finding.new': typeof createFinding;
|
|
518
|
-
readonly 'finding.set': typeof setFindingStatus;
|
|
519
|
-
readonly 'finding.archive': typeof setFindingArchived;
|
|
520
|
-
readonly 'group.new': typeof createGroup;
|
|
521
|
-
readonly 'group.set': typeof setGroup;
|
|
522
|
-
readonly 'ops.add': typeof appendOps;
|
|
523
|
-
readonly 'section.append': typeof appendSection;
|
|
524
|
-
readonly 'session.start': typeof startSession;
|
|
525
|
-
readonly 'session.ensure': typeof ensureSession;
|
|
526
|
-
readonly 'session.handoff': typeof handoffSession;
|
|
527
|
-
readonly 'session.info': typeof setSessionInfo;
|
|
528
|
-
readonly 'session.reminder': typeof setReminderDigest;
|
|
529
|
-
readonly 'session.set': typeof setSessionStatus;
|
|
530
|
-
readonly 'session.settle': typeof settleSession;
|
|
531
|
-
readonly 'session.archive': typeof setSessionArchived;
|
|
532
|
-
readonly 'action.add': typeof addAction;
|
|
533
|
-
readonly 'action.set': typeof updateAction;
|
|
534
|
-
readonly 'file.remove': typeof removeFile;
|
|
535
|
-
};
|
|
536
|
-
type OperationInput<N extends OperationName> = Parameters<(typeof OPERATIONS)[N]>[1];
|
|
537
|
-
type OperationValue<N extends OperationName> = ReturnType<(typeof OPERATIONS)[N]>['value'];
|
|
538
|
-
//#endregion
|
|
1
|
+
import { a as Renumbering, i as Notice, n as OperationValue, o as HubDirs, r as OperationName, t as OperationInput } from "./index-DRpamPge.js";
|
|
539
2
|
//#region src/remote/operation.d.ts
|
|
540
3
|
/** What a write reports: the operation's value, and what its caller tells the user about it. */
|
|
541
4
|
interface Written<N extends OperationName = OperationName> {
|
|
@@ -587,11 +50,13 @@ export interface HookContext {
|
|
|
587
50
|
/** How the executor should invoke the CLI inside the hub, used in the texts it reads */
|
|
588
51
|
cli: string;
|
|
589
52
|
/** Start the hub's interface without waiting; given by the CLI entry point, left out by callers that must not spawn */
|
|
590
|
-
startUi?: (
|
|
53
|
+
startUi?: (dirs: HubDirs) => void;
|
|
591
54
|
/** Report something on stderr without changing what the hook prints; runHook sets it */
|
|
592
55
|
warn?: (message: string) => void;
|
|
593
56
|
/** $CLAUDE_PROJECT_DIR: where the session was opened; events in PROJECT_HUB_EVENTS find the hub from it first */
|
|
594
57
|
projectDir?: string;
|
|
58
|
+
/** The environment whose MAINFLOW_HOME holds the hub registry the hub is looked up in; process.env when left out */
|
|
59
|
+
env?: Record<string, string | undefined>;
|
|
595
60
|
/**
|
|
596
61
|
* How the hub a handler runs in is written; runHook sets it. In remote mode it applies the operation here and puts
|
|
597
62
|
* it in the hub's outbox, as the writing commands do, so a hook's write is never a direct edit (src/remote/operation.ts).
|
|
@@ -604,7 +69,7 @@ export interface HookContext {
|
|
|
604
69
|
*/
|
|
605
70
|
export declare function parsePayload(text: string): ClaudeCodePayload | null;
|
|
606
71
|
export declare const claudeCodeSessionId: (raw: string) => string;
|
|
607
|
-
type Handler = (
|
|
72
|
+
type Handler = (dirs: HubDirs, ctx: HookContext & {
|
|
608
73
|
write: HubWrite;
|
|
609
74
|
}) => Promise<string | null> | string | null;
|
|
610
75
|
/** How a hub's interface is linked from a reply: through its /open route, which shows the address in the app. */
|