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