@cogitator-ai/bridge 0.6.0 → 0.7.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/README.md +43 -5
- package/dist/adapters/claude.d.ts +13 -0
- package/dist/adapters/claude.d.ts.map +1 -1
- package/dist/adapters/claude.js +11 -1
- package/dist/adapters/claude.js.map +1 -1
- package/dist/checks.d.ts +31 -0
- package/dist/checks.d.ts.map +1 -0
- package/dist/checks.js +202 -0
- package/dist/checks.js.map +1 -0
- package/dist/client.d.ts +7 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +14 -0
- package/dist/client.js.map +1 -1
- package/dist/dispatcher.d.ts +118 -2
- package/dist/dispatcher.d.ts.map +1 -1
- package/dist/dispatcher.js +570 -11
- package/dist/dispatcher.js.map +1 -1
- package/dist/errors.d.ts +1 -1
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/inputs.d.ts +89 -0
- package/dist/inputs.d.ts.map +1 -1
- package/dist/inputs.js +24 -0
- package/dist/inputs.js.map +1 -1
- package/dist/job-record.d.ts +41 -1
- package/dist/job-record.d.ts.map +1 -1
- package/dist/job-record.js +38 -1
- package/dist/job-record.js.map +1 -1
- package/dist/letters.d.ts +3 -1
- package/dist/letters.d.ts.map +1 -1
- package/dist/letters.js +38 -5
- package/dist/letters.js.map +1 -1
- package/dist/paths.d.ts +7 -0
- package/dist/paths.d.ts.map +1 -1
- package/dist/paths.js +9 -0
- package/dist/paths.js.map +1 -1
- package/dist/protocol.d.ts +3 -0
- package/dist/protocol.d.ts.map +1 -1
- package/dist/protocol.js +3 -0
- package/dist/protocol.js.map +1 -1
- package/dist/registry.d.ts +7 -2
- package/dist/registry.d.ts.map +1 -1
- package/dist/registry.js +8 -5
- package/dist/registry.js.map +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +3 -0
- package/dist/server.js.map +1 -1
- package/dist/tools/guidance.d.ts.map +1 -1
- package/dist/tools/guidance.js +2 -0
- package/dist/tools/guidance.js.map +1 -1
- package/dist/tools/index.d.ts +1 -1
- package/dist/tools/index.js +1 -1
- package/dist/tools/tools.d.ts +1 -1
- package/dist/tools/tools.d.ts.map +1 -1
- package/dist/tools/tools.js +168 -4
- package/dist/tools/tools.js.map +1 -1
- package/dist/types.d.ts +90 -5
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +23 -2
- package/dist/types.js.map +1 -1
- package/dist/worktree.d.ts +131 -0
- package/dist/worktree.d.ts.map +1 -0
- package/dist/worktree.js +278 -0
- package/dist/worktree.js.map +1 -0
- package/fakes/claude.mjs +53 -3
- package/fakes/lib.mjs +24 -9
- package/fakes/mcp.mjs +3 -2
- package/package.json +4 -4
package/dist/types.d.ts
CHANGED
|
@@ -135,6 +135,21 @@ export declare const JobBudgetSchema: z.ZodObject<{
|
|
|
135
135
|
durationMs: z.ZodNumber;
|
|
136
136
|
replyTimeoutMs: z.ZodNumber;
|
|
137
137
|
}, z.core.$strip>;
|
|
138
|
+
/** How one check of a job went. */
|
|
139
|
+
export interface JobCheckResult {
|
|
140
|
+
/** The name of the check, its command when it has none */
|
|
141
|
+
name: string;
|
|
142
|
+
command: string;
|
|
143
|
+
ok: boolean;
|
|
144
|
+
/** Why the bridge did not run it, when it did not */
|
|
145
|
+
skipped?: string;
|
|
146
|
+
/** The exit code, null when a signal ended the command */
|
|
147
|
+
code?: number | null;
|
|
148
|
+
timedOut?: boolean;
|
|
149
|
+
durationMs?: number;
|
|
150
|
+
/** The end of what the command printed */
|
|
151
|
+
output?: string;
|
|
152
|
+
}
|
|
138
153
|
/** Whether the checks of a job confirmed its result. Absent on a job nobody checked yet. */
|
|
139
154
|
export interface JobVerification {
|
|
140
155
|
verified: boolean;
|
|
@@ -142,6 +157,45 @@ export interface JobVerification {
|
|
|
142
157
|
checkedAt: string;
|
|
143
158
|
/** What the checks showed, in a few lines */
|
|
144
159
|
summary?: string;
|
|
160
|
+
/** Each check the bridge ran or left out, in the order of the job */
|
|
161
|
+
checks?: JobCheckResult[];
|
|
162
|
+
}
|
|
163
|
+
/** What a job changed in the worktree it was given, counted when it reported. */
|
|
164
|
+
export interface JobChanges {
|
|
165
|
+
files: number;
|
|
166
|
+
insertions: number;
|
|
167
|
+
deletions: number;
|
|
168
|
+
/** Commits the agent made in the worktree */
|
|
169
|
+
commits: number;
|
|
170
|
+
/** The changed files, the first of them when there are many */
|
|
171
|
+
paths: string[];
|
|
172
|
+
/** ISO 8601 */
|
|
173
|
+
at: string;
|
|
174
|
+
}
|
|
175
|
+
/** How the work in a job's worktree ended. */
|
|
176
|
+
export interface JobWorktreeEnd {
|
|
177
|
+
/**
|
|
178
|
+
* `accepted`: taken into a checkout, `branch`: left as a branch, `rejected`: dropped by the
|
|
179
|
+
* agent that handed the job over, `discarded`: put away by the bridge when nobody came for it
|
|
180
|
+
*/
|
|
181
|
+
how: 'accepted' | 'branch' | 'rejected' | 'discarded';
|
|
182
|
+
/** ISO 8601 */
|
|
183
|
+
at: string;
|
|
184
|
+
/** The commit that holds the work, when it held any */
|
|
185
|
+
commit?: string;
|
|
186
|
+
/** The checkout the work was taken into */
|
|
187
|
+
into?: string;
|
|
188
|
+
/** The branch or ref the work is kept under */
|
|
189
|
+
ref?: string;
|
|
190
|
+
}
|
|
191
|
+
/** The git worktree the bridge made for a job. */
|
|
192
|
+
export interface JobWorktreeRecord {
|
|
193
|
+
/** Its top folder, gone once the work ended */
|
|
194
|
+
path: string;
|
|
195
|
+
branch: string;
|
|
196
|
+
/** The commit it was made from, which the changes of the job are measured against */
|
|
197
|
+
base: string;
|
|
198
|
+
end?: JobWorktreeEnd;
|
|
145
199
|
}
|
|
146
200
|
/** What the bridge keeps about a job in the metadata of its A2A task. */
|
|
147
201
|
export interface BridgeJobRecord {
|
|
@@ -153,8 +207,20 @@ export interface BridgeJobRecord {
|
|
|
153
207
|
to: string;
|
|
154
208
|
project: string;
|
|
155
209
|
cwd: string;
|
|
156
|
-
/**
|
|
157
|
-
|
|
210
|
+
/** `worktree` on a job that is to be done in a git worktree of its own */
|
|
211
|
+
isolation?: 'worktree';
|
|
212
|
+
/** The git worktree the job is done in, once the bridge has made it */
|
|
213
|
+
worktree?: JobWorktreeRecord;
|
|
214
|
+
/** What the job changed in its worktree, counted when it reported */
|
|
215
|
+
changes?: JobChanges;
|
|
216
|
+
/**
|
|
217
|
+
* Set while the checks of the job run: the report that waits for them, and since when
|
|
218
|
+
* (ISO 8601). The report is handed over with their verdict
|
|
219
|
+
*/
|
|
220
|
+
checking?: {
|
|
221
|
+
letter: string;
|
|
222
|
+
since: string;
|
|
223
|
+
};
|
|
158
224
|
checks: JobCheck[];
|
|
159
225
|
budget: JobBudget;
|
|
160
226
|
lettersUsed: number;
|
|
@@ -165,6 +231,8 @@ export interface BridgeJobRecord {
|
|
|
165
231
|
createdAt: string;
|
|
166
232
|
/** ISO 8601 time the job fails at when it is still running */
|
|
167
233
|
deadlineAt: string;
|
|
234
|
+
/** ISO 8601 time the job was completed, failed or canceled */
|
|
235
|
+
endedAt?: string;
|
|
168
236
|
/**
|
|
169
237
|
* ISO 8601 time since which the job waits for the person, or a job handed over from inside
|
|
170
238
|
* it does. While it is set the deadline does not fail the job
|
|
@@ -236,9 +304,10 @@ export declare const LETTER_KINDS: readonly LetterKind[];
|
|
|
236
304
|
/**
|
|
237
305
|
* `queued`: the bridge has it, `delivered`: handed to the recipient's harness, `read`: the
|
|
238
306
|
* recipient took it, `handled`: the recipient answered it or said it is done with it. A letter
|
|
239
|
-
* only moves forward
|
|
307
|
+
* only moves forward. Before all of them comes `held`: the bridge has the letter and keeps it
|
|
308
|
+
* back, as it does with a report while the checks of its job run
|
|
240
309
|
*/
|
|
241
|
-
export type DeliveryState = 'queued' | 'delivered' | 'read' | 'handled';
|
|
310
|
+
export type DeliveryState = 'held' | 'queued' | 'delivered' | 'read' | 'handled';
|
|
242
311
|
export declare const DELIVERY_STATES: readonly DeliveryState[];
|
|
243
312
|
/** How a report ends its job. */
|
|
244
313
|
export type ReportOutcome = 'completed' | 'failed';
|
|
@@ -285,7 +354,7 @@ export interface Letter {
|
|
|
285
354
|
export interface RenderedLetter extends Letter {
|
|
286
355
|
text: string;
|
|
287
356
|
}
|
|
288
|
-
export type JournalEntryType = 'agent.registered' | 'agent.gone' | 'job.created' | 'job.state' | 'job.verified' | 'letter.queued' | 'letter.delivered' | 'letter.read' | 'letter.handled' | 'letter.rejected' | 'letter.undelivered' | 'letter.reminded' | 'letter.escalated';
|
|
357
|
+
export type JournalEntryType = 'agent.registered' | 'agent.gone' | 'job.created' | 'job.state' | 'job.verified' | 'job.worktree' | 'job.accepted' | 'job.rejected' | 'job.discarded' | 'letter.queued' | 'letter.delivered' | 'letter.read' | 'letter.handled' | 'letter.rejected' | 'letter.undelivered' | 'letter.reminded' | 'letter.escalated';
|
|
289
358
|
/** One line of the bridge's append-only journal. */
|
|
290
359
|
export interface JournalEntry {
|
|
291
360
|
seq: number;
|
|
@@ -341,6 +410,19 @@ export interface BridgeLimits {
|
|
|
341
410
|
* waits for a person at its own window, in ms
|
|
342
411
|
*/
|
|
343
412
|
windowNoticeMs: number;
|
|
413
|
+
/**
|
|
414
|
+
* How many jobs of one project may be in progress in a git worktree of their own. Each is an
|
|
415
|
+
* agent that builds and tests next to the others, and memory runs out before disk does
|
|
416
|
+
*/
|
|
417
|
+
worktreesPerProject: number;
|
|
418
|
+
/** How long one check of a job may run before the bridge ends it, when it names no time, in ms */
|
|
419
|
+
checkTimeoutMs: number;
|
|
420
|
+
/**
|
|
421
|
+
* How long the worktree of a finished job is kept for whoever handed the job over to take or
|
|
422
|
+
* drop its work, in ms. After that the bridge puts the work away under a ref and removes the
|
|
423
|
+
* worktree
|
|
424
|
+
*/
|
|
425
|
+
worktreeKeepMs: number;
|
|
344
426
|
}
|
|
345
427
|
export declare const BridgeLimitsSchema: z.ZodObject<{
|
|
346
428
|
maxDepth: z.ZodNumber;
|
|
@@ -367,6 +449,9 @@ export declare const BridgeLimitsSchema: z.ZodObject<{
|
|
|
367
449
|
presenceCheckMs: z.ZodNumber;
|
|
368
450
|
personReplyTimeoutMs: z.ZodNumber;
|
|
369
451
|
windowNoticeMs: z.ZodNumber;
|
|
452
|
+
worktreesPerProject: z.ZodNumber;
|
|
453
|
+
checkTimeoutMs: z.ZodNumber;
|
|
454
|
+
worktreeKeepMs: z.ZodNumber;
|
|
370
455
|
}, z.core.$strict>;
|
|
371
456
|
export declare const DEFAULT_LIMITS: BridgeLimits;
|
|
372
457
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,0EAA0E;AAC1E,eAAO,MAAM,cAAc,qBAAqB,CAAC;AAEjD,+FAA+F;AAC/F,eAAO,MAAM,aAAa,WAAW,CAAC;AAEtC;;;GAGG;AACH,eAAO,MAAM,MAAM,WAAW,CAAC;AAE/B,8FAA8F;AAC9F,eAAO,MAAM,SAAS;;;;;CAKZ,CAAC;AAEX,+DAA+D;AAC/D,MAAM,WAAW,mBAAmB;IAClC,gDAAgD;IAChD,aAAa,EAAE,OAAO,CAAC;IACvB,iFAAiF;IACjF,IAAI,EAAE,OAAO,CAAC;IACd,kDAAkD;IAClD,KAAK,EAAE,OAAO,CAAC;IACf,2FAA2F;IAC3F,YAAY,EAAE,OAAO,CAAC;CACvB;AAED,eAAO,MAAM,yBAAyB;;;;;iBAKpC,CAAC;AAEH,uFAAuF;AACvF,eAAO,MAAM,eAAe,EAAE,mBAK7B,CAAC;AAEF,4FAA4F;AAC5F,eAAO,MAAM,cAAc,UAAU,CAAC;AAEtC;;;;;GAKG;AACH,MAAM,MAAM,WAAW,GAAG,UAAU,GAAG,Q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WAAW,EAAE,MAAM,CAAC;IACpB,sDAAsD;IACtD,WAAW,EAAE,MAAM,CAAC;IACpB,yDAAyD;IACzD,mBAAmB,EAAE,MAAM,CAAC;IAC5B,wFAAwF;IACxF,eAAe,EAAE,MAAM,CAAC;IACxB;;;;OAIG;IACH,oBAAoB,EAAE,MAAM,CAAC;IAC7B;;;OAGG;IACH,cAAc,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,mBAAmB,EAAE,MAAM,CAAC;IAC5B,kGAAkG;IAClG,cAAc,EAAE,MAAM,CAAC;IACvB;;;;OAIG;IACH,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAgC7B,CAAC;AAEH,eAAO,MAAM,cAAc,EAAE,YAoB5B,CAAC"}
|
package/dist/types.js
CHANGED
|
@@ -73,7 +73,12 @@ export const JOB_STATES = [
|
|
|
73
73
|
];
|
|
74
74
|
export const JobCheckSchema = z.object({
|
|
75
75
|
name: z.string().trim().min(1).max(200).optional(),
|
|
76
|
-
command: z
|
|
76
|
+
command: z
|
|
77
|
+
.string()
|
|
78
|
+
.trim()
|
|
79
|
+
.min(1)
|
|
80
|
+
.max(4000)
|
|
81
|
+
.refine((command) => !command.includes('\0'), 'A command has no NUL character'),
|
|
77
82
|
cwd: z.string().min(1).max(4096).optional(),
|
|
78
83
|
timeoutMs: z.number().int().positive().max(86_400_000).optional(),
|
|
79
84
|
});
|
|
@@ -115,7 +120,13 @@ export const LETTER_KINDS = [
|
|
|
115
120
|
'note',
|
|
116
121
|
'permission',
|
|
117
122
|
];
|
|
118
|
-
export const DELIVERY_STATES = [
|
|
123
|
+
export const DELIVERY_STATES = [
|
|
124
|
+
'held',
|
|
125
|
+
'queued',
|
|
126
|
+
'delivered',
|
|
127
|
+
'read',
|
|
128
|
+
'handled',
|
|
129
|
+
];
|
|
119
130
|
export const BridgeLimitsSchema = z.strictObject({
|
|
120
131
|
maxDepth: z.number().int().min(1).max(100),
|
|
121
132
|
budget: JobBudgetSchema,
|
|
@@ -141,6 +152,13 @@ export const BridgeLimitsSchema = z.strictObject({
|
|
|
141
152
|
.positive()
|
|
142
153
|
.max(7 * 86_400_000),
|
|
143
154
|
windowNoticeMs: z.number().int().min(0).max(86_400_000),
|
|
155
|
+
worktreesPerProject: z.number().int().positive().max(100),
|
|
156
|
+
checkTimeoutMs: z.number().int().positive().max(86_400_000),
|
|
157
|
+
worktreeKeepMs: z
|
|
158
|
+
.number()
|
|
159
|
+
.int()
|
|
160
|
+
.positive()
|
|
161
|
+
.max(365 * 86_400_000),
|
|
144
162
|
});
|
|
145
163
|
export const DEFAULT_LIMITS = {
|
|
146
164
|
maxDepth: 3,
|
|
@@ -159,5 +177,8 @@ export const DEFAULT_LIMITS = {
|
|
|
159
177
|
presenceCheckMs: 60_000,
|
|
160
178
|
personReplyTimeoutMs: 4 * 3_600_000,
|
|
161
179
|
windowNoticeMs: 10 * 60_000,
|
|
180
|
+
worktreesPerProject: 2,
|
|
181
|
+
checkTimeoutMs: 10 * 60_000,
|
|
182
|
+
worktreeKeepMs: 7 * 86_400_000,
|
|
162
183
|
};
|
|
163
184
|
//# sourceMappingURL=types.js.map
|
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,0EAA0E;AAC1E,MAAM,CAAC,MAAM,cAAc,GAAG,kBAAkB,CAAC;AAEjD,+FAA+F;AAC/F,MAAM,CAAC,MAAM,aAAa,GAAG,QAAQ,CAAC;AAEtC;;;GAGG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,QAAQ,CAAC;AAE/B,8FAA8F;AAC9F,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,UAAU,EAAE,aAA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AAG,SAAS,EAAE,cAAc,EAAE,EAAE,GAAG,MAAM,EAAE;IAC/E,SAAS,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE,UAAU,EAAE,EAAE,GAAG,SAAS,EAAE,cAAc,EAAE,CAAC,GAAG,SAAS,EAAE;IACtF,gBAAgB,EAAE,CAAC;IACnB,iBAAiB,EAAE,KAAK;IACxB,oBAAoB,EAAE,MAAM;IAC5B,iBAAiB,EAAE,MAAM;IACzB,qBAAqB,EAAE,OAAO;IAC9B,aAAa,EAAE,OAAO;IACtB,WAAW,EAAE,EAAE,GAAG,SAAS;IAC3B,WAAW,EAAE,EAAE;IACf,WAAW,EAAE,EAAE;IACf,mBAAmB,EAAE,CAAC;IACtB,eAAe,EAAE,MAAM;IACvB,oBAAoB,EAAE,CAAC,GAAG,SAAS;IACnC,cAAc,EAAE,EAAE,GAAG,MAAM;IAC3B,mBAAmB,EAAE,CAAC;IACtB,cAAc,EAAE,EAAE,GAAG,MAAM;IAC3B,cAAc,EAAE,CAAC,GAAG,UAAU;CAC/B,CAAC"}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { JOB_WORKTREES_DIR } from './paths.js';
|
|
2
|
+
export { JOB_WORKTREES_DIR };
|
|
3
|
+
/** Where the work of a worktree nobody took or dropped is kept when the worktree goes. */
|
|
4
|
+
export declare const DISCARDED_REFS = "refs/cogitator/discarded";
|
|
5
|
+
/** A git command that did not do what it was run for. */
|
|
6
|
+
export declare class GitError extends Error {
|
|
7
|
+
readonly args: readonly string[];
|
|
8
|
+
readonly code: number | null;
|
|
9
|
+
readonly said: string;
|
|
10
|
+
constructor(args: readonly string[], code: number | null, said: string);
|
|
11
|
+
}
|
|
12
|
+
/** The worktree the bridge made for a job. */
|
|
13
|
+
export interface JobWorktree {
|
|
14
|
+
/** The top folder of the worktree */
|
|
15
|
+
path: string;
|
|
16
|
+
branch: string;
|
|
17
|
+
/** The commit it was made from: what the job's changes are measured against */
|
|
18
|
+
base: string;
|
|
19
|
+
/** The folder in it that matches the one the job was handed over for */
|
|
20
|
+
cwd: string;
|
|
21
|
+
}
|
|
22
|
+
export interface AddJobWorktreeOptions {
|
|
23
|
+
/** The main checkout of the project */
|
|
24
|
+
project: string;
|
|
25
|
+
/** The folder the job was handed over for, in the checkout whose commit the worktree starts from */
|
|
26
|
+
from: string;
|
|
27
|
+
number: number;
|
|
28
|
+
title: string;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Makes the git worktree of a job: `.cogitator/worktrees/job-<number>-<title>` under the main
|
|
32
|
+
* checkout of the project, on a branch `cogitator/job-<number>-<title>`, off the commit the
|
|
33
|
+
* checkout of `from` is at. History is shared with the project and only the working files are
|
|
34
|
+
* new, so what that checkout has not committed is not there, and neither is anything git
|
|
35
|
+
* ignores, such as installed dependencies and build output.
|
|
36
|
+
*
|
|
37
|
+
* @throws GitError when `from` is in no git repository, or the repository has no commit yet
|
|
38
|
+
*/
|
|
39
|
+
export declare function addJobWorktree(options: AddJobWorktreeOptions): Promise<JobWorktree>;
|
|
40
|
+
export type ChangeKind = 'added' | 'modified' | 'deleted';
|
|
41
|
+
export interface ChangedFile {
|
|
42
|
+
path: string;
|
|
43
|
+
kind: ChangeKind;
|
|
44
|
+
/** Lines added, undefined for a binary file */
|
|
45
|
+
insertions?: number;
|
|
46
|
+
deletions?: number;
|
|
47
|
+
}
|
|
48
|
+
/** What a worktree holds that the commit it started from does not. */
|
|
49
|
+
export interface WorktreeChanges {
|
|
50
|
+
files: ChangedFile[];
|
|
51
|
+
insertions: number;
|
|
52
|
+
deletions: number;
|
|
53
|
+
/** Commits made in the worktree since its base */
|
|
54
|
+
commits: number;
|
|
55
|
+
/** The commit the worktree is at */
|
|
56
|
+
head: string;
|
|
57
|
+
/** The tree of everything in the worktree: what is committed, what is not, and new files */
|
|
58
|
+
tree: string;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Reads what a worktree changed since `base`: its commits, what it has not committed and the
|
|
62
|
+
* files it added, without what git ignores. Nothing of the worktree is touched: the files are
|
|
63
|
+
* staged in an index of their own, not the worktree's, so an agent that cannot commit (a Codex
|
|
64
|
+
* thread in its sandbox cannot) and one that did are read the same way.
|
|
65
|
+
*/
|
|
66
|
+
export declare function changesOf(worktree: string, base: string): Promise<WorktreeChanges>;
|
|
67
|
+
export interface PatchOptions {
|
|
68
|
+
/** Only these files, paths from the top of the worktree */
|
|
69
|
+
paths?: readonly string[];
|
|
70
|
+
/** The most characters of the patch to return, 200 000 by default */
|
|
71
|
+
maxChars?: number;
|
|
72
|
+
}
|
|
73
|
+
/** The changes of a worktree as a patch, cut at `maxChars`. */
|
|
74
|
+
export declare function patchOf(worktree: string, base: string, tree: string, options?: PatchOptions): Promise<{
|
|
75
|
+
patch: string;
|
|
76
|
+
truncated: boolean;
|
|
77
|
+
}>;
|
|
78
|
+
/**
|
|
79
|
+
* The commit that holds everything a worktree has: its own last commit when nothing is left
|
|
80
|
+
* uncommitted, else a new commit on top of it with `message`. The new commit is on no branch and
|
|
81
|
+
* the worktree is not touched.
|
|
82
|
+
*/
|
|
83
|
+
export declare function snapshotOf(worktree: string, changes: Pick<WorktreeChanges, 'head' | 'tree'>, message: string): Promise<string>;
|
|
84
|
+
/**
|
|
85
|
+
* The files a merge of `commit` into what `target` is at would leave in conflict, none when it
|
|
86
|
+
* merges cleanly. Nothing of `target` is touched: git works the merge out without a checkout.
|
|
87
|
+
*
|
|
88
|
+
* @throws GitError on a git older than 2.38, which cannot
|
|
89
|
+
*/
|
|
90
|
+
export declare function conflictsOf(target: string, commit: string): Promise<string[]>;
|
|
91
|
+
/**
|
|
92
|
+
* Why nothing can be brought into the checkout `target` right now, undefined when it can: git
|
|
93
|
+
* is in the middle of something there, or changes are staged. Bringing work in stages it, so
|
|
94
|
+
* what was staged before could not be told from it afterwards, and git would refuse anyway.
|
|
95
|
+
*/
|
|
96
|
+
export declare function busyWith(target: string): Promise<string | undefined>;
|
|
97
|
+
/**
|
|
98
|
+
* Brings the changes of `commit` into the checkout `target` as one change that is staged and not
|
|
99
|
+
* committed (`git merge --squash`): the commit, with its message and the hooks of the project,
|
|
100
|
+
* is for whoever works there. Only for a checkout `busyWith` finds free: nothing is staged
|
|
101
|
+
* there, so when git gives up half way, taking back what the merge staged takes back nothing
|
|
102
|
+
* else, and what is changed there and not staged stays as it is.
|
|
103
|
+
*
|
|
104
|
+
* @throws GitError when the checkout is not free, or git refuses, as it does when files the
|
|
105
|
+
* merge changes have changes of their own in `target`. The checkout is then as it was
|
|
106
|
+
*/
|
|
107
|
+
export declare function squashInto(target: string, commit: string): Promise<void>;
|
|
108
|
+
/** Whether `ancestor` is `commit` or one of the commits it grew from. */
|
|
109
|
+
export declare function isAncestor(folder: string, ancestor: string, commit: string): Promise<boolean>;
|
|
110
|
+
/**
|
|
111
|
+
* Points `ref` (a branch as `refs/heads/<name>`, or any other ref) at `commit`. With `fresh` the
|
|
112
|
+
* ref must not be there yet.
|
|
113
|
+
*
|
|
114
|
+
* @throws GitError when a `fresh` ref exists already
|
|
115
|
+
*/
|
|
116
|
+
export declare function pointRef(project: string, ref: string, commit: string, options?: {
|
|
117
|
+
fresh?: boolean;
|
|
118
|
+
}): Promise<void>;
|
|
119
|
+
/**
|
|
120
|
+
* Removes the worktree of a job with everything in it, and its branch when one is named. When
|
|
121
|
+
* its folder is gone already, as after someone removed it by hand, git is told to forget the
|
|
122
|
+
* worktrees whose folders are missing, which is the only way it has to forget one.
|
|
123
|
+
*/
|
|
124
|
+
export declare function removeJobWorktree(project: string, path: string, branch?: string): Promise<void>;
|
|
125
|
+
/** The commit a branch is at, undefined when there is no such branch. */
|
|
126
|
+
export declare function branchTip(project: string, branch: string): Promise<string | undefined>;
|
|
127
|
+
/** The top folder of the checkout `folder` is in, undefined when it is in no git repository. */
|
|
128
|
+
export declare function checkoutOf(folder: string): Promise<string | undefined>;
|
|
129
|
+
/** A path of a changed file as a letter shows it, with `/` whatever the platform. */
|
|
130
|
+
export declare function shownPath(path: string): string;
|
|
131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