@bridge4dev/runner 0.26.0 → 0.29.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/adapters/claude.js +136 -8
- package/dist/adapters/codex.js +96 -2
- package/dist/adapters/types.d.ts +60 -1
- package/dist/agent-auth.d.ts +29 -0
- package/dist/agent-auth.js +136 -0
- package/dist/attachments.d.ts +27 -0
- package/dist/attachments.js +150 -8
- package/dist/auth-relay.d.ts +29 -1
- package/dist/auth-relay.js +228 -13
- package/dist/checkpoints.d.ts +175 -0
- package/dist/checkpoints.js +816 -0
- package/dist/config.d.ts +25 -0
- package/dist/config.js +17 -0
- package/dist/environment.d.ts +15 -0
- package/dist/environment.js +25 -1
- package/dist/index.js +176 -10
- package/dist/journal.d.ts +34 -1
- package/dist/journal.js +51 -2
- package/dist/paths.d.ts +10 -0
- package/dist/paths.js +12 -0
- package/dist/policy.js +15 -0
- package/dist/protocol.d.ts +10 -10
- package/dist/recipe-schema.d.ts +1 -1
- package/dist/self-update.d.ts +43 -2
- package/dist/self-update.js +137 -43
- package/dist/supervisor.d.ts +86 -0
- package/dist/supervisor.js +555 -17
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
/** Retention: nothing older than this survives, whatever the ordinal. */
|
|
2
|
+
export declare const CHECKPOINT_MAX_AGE_MS: number;
|
|
3
|
+
/** Retention: the newest N per session. */
|
|
4
|
+
export declare const CHECKPOINT_MAX_PER_SESSION = 200;
|
|
5
|
+
/**
|
|
6
|
+
* How long the points of a session nobody mentions are kept anyway.
|
|
7
|
+
*
|
|
8
|
+
* The list of live sessions arrives capped, so absence from it is weak
|
|
9
|
+
* evidence. A day of silence is strong evidence — and until then the cost of
|
|
10
|
+
* being wrong is disk, while the cost of being wrong the other way is the only
|
|
11
|
+
* copy of somebody's uncommitted work.
|
|
12
|
+
*/
|
|
13
|
+
export declare const ORPHAN_GRACE_MS: number;
|
|
14
|
+
export type CheckpointKind = 'TURN' | 'SAFETY' | 'MANUAL';
|
|
15
|
+
export interface CheckpointRecord {
|
|
16
|
+
ordinal: number;
|
|
17
|
+
commit: string;
|
|
18
|
+
kind: CheckpointKind;
|
|
19
|
+
/** HEAD of the worktree when the checkpoint was taken. */
|
|
20
|
+
headSha: string;
|
|
21
|
+
/** Paths that were staged in the project's index at that moment. */
|
|
22
|
+
stagedPaths: string[];
|
|
23
|
+
createdAt: number;
|
|
24
|
+
fileCount: number;
|
|
25
|
+
byteCount: number;
|
|
26
|
+
/**
|
|
27
|
+
* The agent's own name for the conversation at this instant (ticket #126) —
|
|
28
|
+
* a Claude message uuid or a Codex turn id.
|
|
29
|
+
*
|
|
30
|
+
* Kept HERE and never sent to the API: it is an identifier internal to a CLI
|
|
31
|
+
* on this machine, it is worth nothing to anybody else, and a database is a
|
|
32
|
+
* poor place for a value whose meaning only one process understands. The
|
|
33
|
+
* rewind command carries an ordinal; the runner looks the anchor up itself.
|
|
34
|
+
*/
|
|
35
|
+
agentAnchor?: string;
|
|
36
|
+
/**
|
|
37
|
+
* The provider conversation the anchor belongs to.
|
|
38
|
+
*
|
|
39
|
+
* A conversation rewind FORKS, and a fork remaps every message id — so an
|
|
40
|
+
* anchor recorded against the old thread names nothing in the new one.
|
|
41
|
+
* Comparing this against the session's current provider id is what stops the
|
|
42
|
+
* button from offering a rewind that would silently do nothing.
|
|
43
|
+
*/
|
|
44
|
+
agentSession?: string;
|
|
45
|
+
/** Feed seq of the user message this point sits in front of. */
|
|
46
|
+
messageSeq?: number;
|
|
47
|
+
}
|
|
48
|
+
export interface CreateCheckpointInput {
|
|
49
|
+
worktreePath: string;
|
|
50
|
+
sessionId: string;
|
|
51
|
+
kind: CheckpointKind;
|
|
52
|
+
/** Feed seq of the user message this point sits in front of (TURN only). */
|
|
53
|
+
messageSeq?: number;
|
|
54
|
+
agentAnchor?: string;
|
|
55
|
+
agentSession?: string;
|
|
56
|
+
}
|
|
57
|
+
export type CreateCheckpointResult = {
|
|
58
|
+
created: true;
|
|
59
|
+
record: CheckpointRecord;
|
|
60
|
+
messageSeq?: number;
|
|
61
|
+
skippedFiles: string[];
|
|
62
|
+
} | {
|
|
63
|
+
created: false;
|
|
64
|
+
reason: 'not-a-repo' | 'too-large' | 'failed';
|
|
65
|
+
detail?: string;
|
|
66
|
+
};
|
|
67
|
+
export interface RewindPreview {
|
|
68
|
+
/** Files whose content goes back to the checkpoint. */
|
|
69
|
+
restore: string[];
|
|
70
|
+
/** Files that exist now and did not then — a rewind DELETES these. */
|
|
71
|
+
delete: string[];
|
|
72
|
+
/** Files that existed then and are gone now — a rewind recreates them. */
|
|
73
|
+
recreate: string[];
|
|
74
|
+
headSha: string;
|
|
75
|
+
checkpointHeadSha: string;
|
|
76
|
+
/**
|
|
77
|
+
* The git tree of the worktree AS THIS PREVIEW SAW IT (QA-120 B1).
|
|
78
|
+
*
|
|
79
|
+
* Echoed back with the rewind and re-derived on this side: any byte that
|
|
80
|
+
* moves in any covered file changes this oid, so it is a signature over the
|
|
81
|
+
* whole state the person was shown, not just over the list of deletions.
|
|
82
|
+
*
|
|
83
|
+
* The delete echo alone was half a guarantee. `read-tree --reset -u` writes
|
|
84
|
+
* the RESTORE list too, recomputed at apply time — so a file saved from an
|
|
85
|
+
* editor while the dialog sat open was overwritten from the checkpoint
|
|
86
|
+
* without ever appearing on any list. The dialog exists to make «nothing
|
|
87
|
+
* changes that was not named» true, and it was true of one half of the tree.
|
|
88
|
+
*/
|
|
89
|
+
treeOid: string;
|
|
90
|
+
/** Set when a rewind must be refused; the UI shows this instead of a button. */
|
|
91
|
+
blockedReason?: 'head-moved' | 'merge-in-progress' | 'checkpoint-lost' | 'too-many-changes';
|
|
92
|
+
/** Commits made since the checkpoint, when `head-moved` is why we refuse. */
|
|
93
|
+
commitsSince?: Array<{
|
|
94
|
+
sha: string;
|
|
95
|
+
subject: string;
|
|
96
|
+
}>;
|
|
97
|
+
/** The change is larger than the dialog can honestly list — see `blockedReason`. */
|
|
98
|
+
truncated?: boolean;
|
|
99
|
+
totalChanges?: number;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Take a restore point for this worktree.
|
|
103
|
+
*
|
|
104
|
+
* Never throws for an ordinary failure: a checkpoint that could not be taken
|
|
105
|
+
* must not stop the message it was taken for from reaching the agent.
|
|
106
|
+
*/
|
|
107
|
+
export declare function createCheckpoint(input: CreateCheckpointInput): Promise<CreateCheckpointResult>;
|
|
108
|
+
export declare function listCheckpoints(worktreePath: string, sessionId: string): Promise<CheckpointRecord[]>;
|
|
109
|
+
/** What a rewind to this checkpoint would do, without doing any of it. */
|
|
110
|
+
export declare function previewRewind(input: {
|
|
111
|
+
worktreePath: string;
|
|
112
|
+
sessionId: string;
|
|
113
|
+
ordinal: number;
|
|
114
|
+
}): Promise<RewindPreview>;
|
|
115
|
+
export interface ApplyRewindResult {
|
|
116
|
+
restored: number;
|
|
117
|
+
deleted: number;
|
|
118
|
+
recreated: number;
|
|
119
|
+
/** The point taken immediately before this rewind, so it can be undone. */
|
|
120
|
+
safety: CheckpointRecord;
|
|
121
|
+
/**
|
|
122
|
+
* What kind of point this rewind went TO.
|
|
123
|
+
*
|
|
124
|
+
* `SAFETY` means the rewind was itself an undo — and an undo of an undo is a
|
|
125
|
+
* redo, not an undo. The interface reads this to stop offering the same
|
|
126
|
+
* button forever under a name that stops being true after the first press.
|
|
127
|
+
*/
|
|
128
|
+
rewoundToKind: CheckpointKind;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Put the working tree back to a checkpoint.
|
|
132
|
+
*
|
|
133
|
+
* The SAFETY point is taken FIRST and its ref is on disk before a single byte
|
|
134
|
+
* of the worktree changes — kill the process between the two steps and the way
|
|
135
|
+
* back still exists. `read-tree --reset -u` restores content but does NOT
|
|
136
|
+
* delete files created after the checkpoint (verified on live git), so the
|
|
137
|
+
* deletions are done explicitly from a list the caller echoed back. There is no
|
|
138
|
+
* `git clean` anywhere in this file, on purpose: it deletes by rule rather than
|
|
139
|
+
* by list, and a rule is exactly what nobody confirmed.
|
|
140
|
+
*/
|
|
141
|
+
export declare function applyRewind(input: {
|
|
142
|
+
worktreePath: string;
|
|
143
|
+
sessionId: string;
|
|
144
|
+
ordinal: number;
|
|
145
|
+
/** Echo of `preview.delete` — a mismatch means the tree moved under the user. */
|
|
146
|
+
confirmDeletes: string[];
|
|
147
|
+
/**
|
|
148
|
+
* Echo of `preview.treeOid` — the whole state the user was shown (QA-120 B1).
|
|
149
|
+
*
|
|
150
|
+
* Optional only for the wire: a dashboard newer than the runner will send it
|
|
151
|
+
* and an older one will not, and refusing the older one would break a client
|
|
152
|
+
* that is doing nothing wrong. Present ⇒ checked.
|
|
153
|
+
*/
|
|
154
|
+
expectedTreeOid?: string;
|
|
155
|
+
}): Promise<ApplyRewindResult>;
|
|
156
|
+
export declare function rewindBlockMessage(reason: NonNullable<RewindPreview['blockedReason']>): string;
|
|
157
|
+
/** Drop every restore point of one session (session deleted or purged). */
|
|
158
|
+
export declare function dropCheckpoints(worktreePath: string, sessionId: string): Promise<void>;
|
|
159
|
+
/**
|
|
160
|
+
* Garbage collection.
|
|
161
|
+
*
|
|
162
|
+
* Two jobs, and the second one is the reason this exists: deleting a session
|
|
163
|
+
* while its dev server is switched off leaves refs — a full copy of a working
|
|
164
|
+
* tree — with no row anywhere to point at them. The reconciliation on `hello`
|
|
165
|
+
* is what eventually removes those, so this takes a list of the sessions that
|
|
166
|
+
* still exist rather than a list of the ones that do not.
|
|
167
|
+
*/
|
|
168
|
+
export declare function pruneCheckpoints(input: {
|
|
169
|
+
liveSessionIds: ReadonlySet<string>;
|
|
170
|
+
now?: number;
|
|
171
|
+
}): Promise<{
|
|
172
|
+
droppedSessions: string[];
|
|
173
|
+
droppedRefs: number;
|
|
174
|
+
}>;
|
|
175
|
+
//# sourceMappingURL=checkpoints.d.ts.map
|