kith-coord 0.1.9 → 0.2.1
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/CHANGELOG.md +25 -0
- package/README.md +83 -141
- package/assets/brand/readme-header.png +0 -0
- package/assets/brand/readme-header.svg +1 -1
- package/assets/brand/social-preview.png +0 -0
- package/assets/brand/social-preview.svg +1 -1
- package/assets/demo/claim.jq +5 -0
- package/assets/demo/claims.gif +0 -0
- package/assets/demo/claims.tape +59 -0
- package/assets/demo/prepare.sh +63 -0
- package/dist/chunk-6ORNHRPG.js +47 -0
- package/dist/chunk-6ORNHRPG.js.map +1 -0
- package/dist/chunk-QLLTQNDL.js +6104 -0
- package/dist/chunk-QLLTQNDL.js.map +1 -0
- package/dist/chunk-SAHFIOEQ.js +13927 -0
- package/dist/chunk-SAHFIOEQ.js.map +1 -0
- package/dist/chunk-WYEINJKJ.js +44 -0
- package/dist/chunk-WYEINJKJ.js.map +1 -0
- package/dist/chunk-YIMAR7VS.js +9599 -0
- package/dist/chunk-YIMAR7VS.js.map +1 -0
- package/dist/cli/index.js +854 -33883
- package/dist/cli/index.js.map +1 -1
- package/dist/client-77BNXEAH.js +708 -0
- package/dist/client-77BNXEAH.js.map +1 -0
- package/dist/command-worker.js +34 -2
- package/dist/command-worker.js.map +1 -1
- package/dist/index.d.ts +199 -14
- package/dist/index.js +87 -7998
- package/dist/index.js.map +1 -1
- package/dist/server-V52W56AG.js +3116 -0
- package/dist/server-V52W56AG.js.map +1 -0
- package/dist/stdio-3NHW7PIO.js +692 -0
- package/dist/stdio-3NHW7PIO.js.map +1 -0
- package/docs/architecture.md +4 -1
- package/docs/install.md +183 -0
- package/docs/integrations.md +7 -3
- package/docs/protocol/tools.v1.json +53 -0
- package/docs/protocol.md +13 -2
- package/docs/reliability.md +1 -1
- package/docs/roadmap.md +2 -0
- package/docs/sessions-and-mutexes.md +1 -1
- package/docs/usage.md +45 -0
- package/package.json +10 -10
- package/server.json +3 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.2_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/src/experimental/tasks/client.ts","../node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.2_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/src/client/index.ts"],"sourcesContent":[null,null],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyCM,IAAO,0BAAP,MAA8B;EAKhC,YAA6B,SAAiD;AAAjD,SAAA,UAAA;EAAoD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsCjF,OAAO,eACH,QACA,eAAkB,sBAClB,SAAwB;AAGxB,UAAM,iBAAiB,KAAK;AAG5B,UAAM,kBAAkB;MACpB,GAAG;;;MAGH,MAAM,SAAS,SAAS,eAAe,WAAW,OAAO,IAAI,IAAI,CAAA,IAAK;;AAG1E,UAAM,SAAS,eAAe,cAAc,EAAE,QAAQ,cAAc,OAAM,GAAI,cAAc,eAAe;AAG3G,UAAM,YAAY,eAAe,uBAAuB,OAAO,IAAI;AAGnE,qBAAiB,WAAW,QAAQ;AAEhC,UAAI,QAAQ,SAAS,YAAY,WAAW;AACxC,cAAM,SAAS,QAAQ;AAGvB,YAAI,CAAC,OAAO,qBAAqB,CAAC,OAAO,SAAS;AAC9C,gBAAM;YACF,MAAM;YACN,OAAO,IAAI,SACP,UAAU,gBACV,QAAQ,OAAO,IAAI,6DAA6D;;AAGxF;QACJ;AAGA,YAAI,OAAO,mBAAmB;AAC1B,cAAI;AAEA,kBAAM,mBAAmB,UAAU,OAAO,iBAAiB;AAE3D,gBAAI,CAAC,iBAAiB,OAAO;AACzB,oBAAM;gBACF,MAAM;gBACN,OAAO,IAAI,SACP,UAAU,eACV,+DAA+D,iBAAiB,YAAY,EAAE;;AAGtG;YACJ;UACJ,SAAS,OAAO;AACZ,gBAAI,iBAAiB,UAAU;AAC3B,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AK;AACjB,UAAI,YAAY;AAEZ,cAAM,gBAAgB,KAAK,2BAA2B,IAAI,QAAQ;AAClE,YAAI,eAAe;AACf,uBAAa,aAAa;QAC9B;AAGA,cAAM,QAAQ,WAAW,SAAS,UAAU;AAC5C,aAAK,2BAA2B,IAAI,UAAU,KAAK;MACvD,OAAO;AAEH,gBAAO;MACX;IACJ;AAGA,SAAK,uBAAuB,oBAAuC,OAAO;EAC9E;EAEA,MAAM,uBAAoB;AACtB,WAAO,KAAK,aAAa,EAAE,QAAQ,mCAAkC,CAAE;EAC3E;;","names":[]}
|
package/dist/command-worker.js
CHANGED
|
@@ -4,6 +4,26 @@ import { createRequire as __kithRequire } from 'node:module'; const require = __
|
|
|
4
4
|
import os from "os";
|
|
5
5
|
import { spawn } from "child_process";
|
|
6
6
|
var started = false;
|
|
7
|
+
var shuttingDown = false;
|
|
8
|
+
var child;
|
|
9
|
+
var hello;
|
|
10
|
+
process.on("SIGHUP", () => {
|
|
11
|
+
});
|
|
12
|
+
function shutdown() {
|
|
13
|
+
if (shuttingDown) return;
|
|
14
|
+
shuttingDown = true;
|
|
15
|
+
if (hello) clearInterval(hello);
|
|
16
|
+
if (!child || child.exitCode !== null || child.signalCode !== null) {
|
|
17
|
+
if (!started) process.exit(1);
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
try {
|
|
21
|
+
child.kill("SIGKILL");
|
|
22
|
+
} catch {
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
process.on("SIGTERM", shutdown);
|
|
26
|
+
process.on("SIGINT", shutdown);
|
|
7
27
|
process.on("disconnect", () => {
|
|
8
28
|
try {
|
|
9
29
|
process.kill(-process.pid, "SIGKILL");
|
|
@@ -11,12 +31,23 @@ process.on("disconnect", () => {
|
|
|
11
31
|
process.exit(1);
|
|
12
32
|
}
|
|
13
33
|
});
|
|
34
|
+
hello = setInterval(() => {
|
|
35
|
+
if (started || !process.connected) {
|
|
36
|
+
clearInterval(hello);
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
process.send?.({ ready: true });
|
|
40
|
+
}, 50);
|
|
14
41
|
process.once("message", (message) => {
|
|
15
|
-
|
|
42
|
+
clearInterval(hello);
|
|
43
|
+
if (started || shuttingDown) return;
|
|
16
44
|
started = true;
|
|
17
45
|
let finished = false;
|
|
18
46
|
const env = { ...process.env, ...message.env, ...message.mutexName === "package-install" ? { KITH_PACKAGE_INSTALL_GUARDED: "1" } : {} };
|
|
19
|
-
const
|
|
47
|
+
const supplied = message.env ?? {};
|
|
48
|
+
if (!Object.prototype.hasOwnProperty.call(supplied, "KITH_SESSION_TOKEN")) delete env.KITH_SESSION_TOKEN;
|
|
49
|
+
if (!Object.prototype.hasOwnProperty.call(supplied, "KITH_AGENT_ID")) delete env.KITH_AGENT_ID;
|
|
50
|
+
child = Array.isArray(message.command) ? spawn(message.command[0], message.command.slice(1), { cwd: message.cwd, env, stdio: ["ignore", "inherit", "inherit"] }) : spawn(message.command, { cwd: message.cwd, env, stdio: ["ignore", "inherit", "inherit"], shell: true });
|
|
20
51
|
child.once("error", (err) => {
|
|
21
52
|
if (finished) return;
|
|
22
53
|
finished = true;
|
|
@@ -26,6 +57,7 @@ process.once("message", (message) => {
|
|
|
26
57
|
if (finished) return;
|
|
27
58
|
finished = true;
|
|
28
59
|
if (process.connected) process.send?.({ exitCode: code ?? (signal ? 128 + (os.constants.signals[signal] ?? 1) : 1), signal }, () => process.exit(0));
|
|
60
|
+
else process.exit(code === 0 ? 0 : 1);
|
|
29
61
|
});
|
|
30
62
|
});
|
|
31
63
|
process.send?.({ ready: true });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/core/command-worker.ts"],"sourcesContent":["// A detached process-group leader. The command cannot start until its supervisor\n// has durably recorded this group and sent the start message over private IPC.\nimport os from 'node:os';\nimport { spawn } from 'node:child_process';\n\nlet started = false;\nprocess.on('disconnect', () => {\n try { process.kill(-process.pid, 'SIGKILL'); } catch { process.exit(1); }\n});\nprocess.once('message', (message: { command: string | string[]; cwd: string; mutexName: string; env?: Record<string, string> }) => {\n if (started) return;\n started = true;\n let finished = false;\n const env = { ...process.env, ...message.env, ...(message.mutexName === 'package-install' ? { KITH_PACKAGE_INSTALL_GUARDED: '1' } : {}) };\n const child = Array.isArray(message.command)\n ? spawn(message.command[0], message.command.slice(1), { cwd: message.cwd, env, stdio: ['ignore', 'inherit', 'inherit'] })\n : spawn(message.command, { cwd: message.cwd, env, stdio: ['ignore', 'inherit', 'inherit'], shell: true });\n child.once('error', (err) => {\n if (finished) return;\n finished = true;\n process.send?.({ error: err.message }, () => process.exit(1));\n });\n child.once('close', (code, signal) => {\n if (finished) return;\n finished = true;\n if (process.connected) process.send?.({ exitCode: code ?? (signal ? 128 + (os.constants.signals[signal] ?? 1) : 1), signal }, () => process.exit(0));\n });\n});\nprocess.send?.({ ready: true });\n"],"mappings":";;;AAEA,OAAO,QAAQ;AACf,SAAS,
|
|
1
|
+
{"version":3,"sources":["../src/core/command-worker.ts"],"sourcesContent":["// A detached process-group leader. The command cannot start until its supervisor\n// has durably recorded this group and sent the start message over private IPC.\nimport os from 'node:os';\nimport { spawn, type ChildProcess } from 'node:child_process';\n\nlet started = false;\nlet shuttingDown = false;\nlet child: ChildProcess | undefined;\nlet hello: ReturnType<typeof setInterval> | undefined;\n\n// Detaching into a new session can deliver SIGHUP on macOS. The supervisor\n// stops this process with SIGTERM or by closing IPC, not with a hangup.\nprocess.on('SIGHUP', () => {});\n\nfunction shutdown(): void {\n if (shuttingDown) return;\n shuttingDown = true;\n if (hello) clearInterval(hello);\n if (!child || child.exitCode !== null || child.signalCode !== null) {\n if (!started) process.exit(1);\n return;\n }\n // Kill the direct child, not this process group. SIGKILL of the group would\n // kill us before we can reap, and macOS then reports the child as alive\n // until launchd collects the zombie. A failed kill means the child has\n // already exited; its close handler reaps it and exits this process.\n try { child.kill('SIGKILL'); } catch { /* already gone */ }\n}\n\nprocess.on('SIGTERM', shutdown);\nprocess.on('SIGINT', shutdown);\nprocess.on('disconnect', () => {\n try { process.kill(-process.pid, 'SIGKILL'); } catch { process.exit(1); }\n});\n\n// Repeat ready until the parent sends the command. A single IPC message can be\n// dropped when its length header is split across reads (Node 22.13) or when it\n// arrives before the parent is listening.\nhello = setInterval(() => {\n if (started || !process.connected) { clearInterval(hello); return; }\n process.send?.({ ready: true });\n}, 50);\n\nprocess.once('message', (message: { command: string | string[]; cwd: string; mutexName: string; env?: Record<string, string> }) => {\n clearInterval(hello);\n if (started || shuttingDown) return;\n started = true;\n let finished = false;\n const env: NodeJS.ProcessEnv = { ...process.env, ...message.env, ...(message.mutexName === 'package-install' ? { KITH_PACKAGE_INSTALL_GUARDED: '1' } : {}) };\n const supplied = message.env ?? {};\n if (!Object.prototype.hasOwnProperty.call(supplied, 'KITH_SESSION_TOKEN')) delete env.KITH_SESSION_TOKEN;\n if (!Object.prototype.hasOwnProperty.call(supplied, 'KITH_AGENT_ID')) delete env.KITH_AGENT_ID;\n child = Array.isArray(message.command)\n ? spawn(message.command[0], message.command.slice(1), { cwd: message.cwd, env, stdio: ['ignore', 'inherit', 'inherit'] })\n : spawn(message.command, { cwd: message.cwd, env, stdio: ['ignore', 'inherit', 'inherit'], shell: true });\n child.once('error', (err) => {\n if (finished) return;\n finished = true;\n process.send?.({ error: err.message }, () => process.exit(1));\n });\n child.once('close', (code, signal) => {\n if (finished) return;\n finished = true;\n if (process.connected) process.send?.({ exitCode: code ?? (signal ? 128 + (os.constants.signals[signal] ?? 1) : 1), signal }, () => process.exit(0));\n else process.exit(code === 0 ? 0 : 1);\n });\n});\nprocess.send?.({ ready: true });\n"],"mappings":";;;AAEA,OAAO,QAAQ;AACf,SAAS,aAAgC;AAEzC,IAAI,UAAU;AACd,IAAI,eAAe;AACnB,IAAI;AACJ,IAAI;AAIJ,QAAQ,GAAG,UAAU,MAAM;AAAC,CAAC;AAE7B,SAAS,WAAiB;AACxB,MAAI,aAAc;AAClB,iBAAe;AACf,MAAI,MAAO,eAAc,KAAK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AAK,QAAQ,KAAK,KAAK,OAAO,CAAC,UAAU,WAAW,SAAS,GAAG,OAAO,KAAK,CAAC;AAC1G,QAAM,KAAK,SAAS,CAAC,QAAQ;AAC3B,QAAI,SAAU;AACd,eAAW;AACX,YAAQ,OAAO,EAAE,OAAO,IAAI,QAAQ,GAAG,MAAM,QAAQ,KAAK,CAAC,CAAC;AAAA,EAC9D,CAAC;AACD,QAAM,KAAK,SAAS,CAAC,MAAM,WAAW;AACpC,QAAI,SAAU;AACd,eAAW;AACX,QAAI,QAAQ,UAAW,SAAQ,OAAO,EAAE,UAAU,SAAS,SAAS,OAAO,GAAG,UAAU,QAAQ,MAAM,KAAK,KAAK,IAAI,OAAO,GAAG,MAAM,QAAQ,KAAK,CAAC,CAAC;AAAA,QAC9I,SAAQ,KAAK,SAAS,IAAI,IAAI,CAAC;AAAA,EACtC,CAAC;AACH,CAAC;AACD,QAAQ,OAAO,EAAE,OAAO,KAAK,CAAC;","names":[]}
|
package/dist/index.d.ts
CHANGED
|
@@ -81,11 +81,24 @@ declare class FencingAndAgentManager {
|
|
|
81
81
|
private readonly capabilities;
|
|
82
82
|
private static ownWindowsStart;
|
|
83
83
|
private static inspectionFailure;
|
|
84
|
+
/** Confirmed start times. Heartbeats must not spawn `ps` on every 100ms tick: on macOS that blocks the event loop longer than a short mutex lease and the lease is lost before the command starts. */
|
|
85
|
+
private static confirmedStarts;
|
|
86
|
+
private static rechecking;
|
|
84
87
|
constructor(coordDb: CoordDatabase);
|
|
85
88
|
static validateLease(duration: number): number;
|
|
86
89
|
/** A real kernel process identity; tests must not supply liveness sentinels. */
|
|
87
90
|
static getProcessStartTime(pid: number): string | null;
|
|
91
|
+
/**
|
|
92
|
+
* Resolve a start time without blocking lease renewal. A just-forked pid can be
|
|
93
|
+
* invisible to `ps` for a moment, and a single timed-out `ps` must not abort the command.
|
|
94
|
+
*/
|
|
95
|
+
static waitForProcessStartTime(pid: number, budgetMs: number, aborted?: () => boolean): Promise<string | null>;
|
|
88
96
|
static isProcessAlive(pid: number, expectedStartTime: string): boolean;
|
|
97
|
+
private static linuxProcessState;
|
|
98
|
+
private static rememberStart;
|
|
99
|
+
/** Refresh identity in the background so a slow `ps` cannot stall mutex renewal. */
|
|
100
|
+
private static scheduleStartRecheck;
|
|
101
|
+
private static readDarwinStartTime;
|
|
89
102
|
registerAgent(params: {
|
|
90
103
|
id: string;
|
|
91
104
|
name?: string;
|
|
@@ -115,6 +128,12 @@ declare class FencingAndAgentManager {
|
|
|
115
128
|
conflicts: number;
|
|
116
129
|
locks: number;
|
|
117
130
|
};
|
|
131
|
+
/**
|
|
132
|
+
* Push this session's claims out to `newExpiry`. A lock or port that already expired
|
|
133
|
+
* while the session lease was still valid stays expired. One that lapsed together with
|
|
134
|
+
* the session is renewed only when nobody else holds it now.
|
|
135
|
+
*/
|
|
136
|
+
private extendOwnedClaims;
|
|
118
137
|
reapDeadAgents(): string[];
|
|
119
138
|
/**
|
|
120
139
|
* Operator escape hatch: release an agent's claims and mark it dead without its session token.
|
|
@@ -130,13 +149,126 @@ declare class FencingAndAgentManager {
|
|
|
130
149
|
private hash;
|
|
131
150
|
}
|
|
132
151
|
|
|
133
|
-
|
|
152
|
+
type WorktreeProvenance = 'created' | 'adopted';
|
|
153
|
+
type WorktreeSource = 'kith' | 'claude-code' | 'external';
|
|
154
|
+
interface ListedWorktree {
|
|
155
|
+
path: string;
|
|
156
|
+
head: string;
|
|
157
|
+
branch: string | null;
|
|
158
|
+
detached: boolean;
|
|
159
|
+
locked: boolean;
|
|
160
|
+
lockReason: string | null;
|
|
161
|
+
}
|
|
162
|
+
interface WorktreeRegistration {
|
|
163
|
+
agentId: string;
|
|
164
|
+
worktreePath: string;
|
|
165
|
+
provenance: WorktreeProvenance;
|
|
166
|
+
source: WorktreeSource;
|
|
167
|
+
branch: string | null;
|
|
168
|
+
head: string | null;
|
|
169
|
+
detached: boolean;
|
|
170
|
+
dirty: boolean;
|
|
171
|
+
branchCheckedOutElsewhere: boolean;
|
|
172
|
+
registeredAt: number;
|
|
173
|
+
}
|
|
174
|
+
/** A workspace binding stored for the agent. `branch` is null when HEAD is detached. */
|
|
175
|
+
interface WorktreeBinding {
|
|
176
|
+
agentId: string;
|
|
177
|
+
worktreePath: string;
|
|
178
|
+
branch: string | null;
|
|
179
|
+
hydrationMethod: 'apfs-cow' | 'reflink-cow' | 'copy' | 'none';
|
|
180
|
+
hydratedDirs: string[];
|
|
181
|
+
durationMs: number;
|
|
182
|
+
provenance: WorktreeProvenance;
|
|
183
|
+
source: WorktreeSource;
|
|
184
|
+
detached: boolean;
|
|
185
|
+
dirty: boolean;
|
|
186
|
+
branchCheckedOutElsewhere: boolean;
|
|
187
|
+
alreadyRegistered: boolean;
|
|
188
|
+
notes: string[];
|
|
189
|
+
}
|
|
190
|
+
interface LiveAdoption {
|
|
191
|
+
worktreePath: string;
|
|
192
|
+
branch: string | null;
|
|
193
|
+
detached: boolean;
|
|
194
|
+
dirty: boolean;
|
|
195
|
+
branchCheckedOutElsewhere: boolean;
|
|
196
|
+
source: WorktreeSource;
|
|
197
|
+
provenance: 'adopted';
|
|
198
|
+
/** Set when integration must not run. The worktree is left unchanged. */
|
|
199
|
+
integrationError: string | null;
|
|
200
|
+
/** Set when `kith commit` must not move a branch another checkout is using. */
|
|
201
|
+
commitError: string | null;
|
|
202
|
+
}
|
|
203
|
+
declare function detachedIntegrationError(): string;
|
|
204
|
+
declare function branchElsewhereError(branch: string): string;
|
|
205
|
+
declare function parseWorktreePorcelain(output: string): ListedWorktree[];
|
|
206
|
+
declare class WorktreeListError extends Error {
|
|
207
|
+
constructor(repoRoot: string);
|
|
208
|
+
}
|
|
209
|
+
declare function listGitWorktrees(repoRoot: string): ListedWorktree[];
|
|
210
|
+
declare function branchIsCheckedOutElsewhere(entries: ListedWorktree[], worktreePath: string, branch: string | null): boolean;
|
|
211
|
+
declare function kithWorktreesRoot(coord: CoordDatabase): string;
|
|
212
|
+
declare function isKithOwnedWorktree(coord: CoordDatabase, worktreePath: string): boolean;
|
|
213
|
+
/** The non-linked checkout of the repository that contains `start`. */
|
|
214
|
+
declare function primaryCheckoutOf(start: string): string;
|
|
215
|
+
declare function registrationFromRow(row: {
|
|
216
|
+
agent_id: string;
|
|
217
|
+
worktree_path: string;
|
|
218
|
+
provenance: string;
|
|
219
|
+
source: string;
|
|
220
|
+
branch: string | null;
|
|
221
|
+
head: string | null;
|
|
222
|
+
detached: number | boolean;
|
|
223
|
+
dirty: number | boolean;
|
|
224
|
+
branch_elsewhere: number | boolean;
|
|
225
|
+
registered_at: number;
|
|
226
|
+
}): WorktreeRegistration;
|
|
227
|
+
declare function readRegistration(coord: CoordDatabase, agentId: string): WorktreeRegistration | null;
|
|
228
|
+
declare function listRegistrations(coord: CoordDatabase): WorktreeRegistration[];
|
|
229
|
+
declare function clearRegistration(coord: CoordDatabase, agentId: string): void;
|
|
230
|
+
declare function adoptWorktree(coord: CoordDatabase, fencing: FencingAndAgentManager, params: {
|
|
231
|
+
agentId: string;
|
|
232
|
+
path?: string;
|
|
233
|
+
explicit: boolean;
|
|
234
|
+
}): WorktreeBinding;
|
|
235
|
+
declare function recordCreatedWorktree(coord: CoordDatabase, fencing: FencingAndAgentManager, params: {
|
|
134
236
|
agentId: string;
|
|
135
237
|
worktreePath: string;
|
|
136
238
|
branch: string;
|
|
239
|
+
head: string | null;
|
|
240
|
+
}): void;
|
|
241
|
+
/** Fill provenance for a checkout the session already recorded, without switching worktrees. */
|
|
242
|
+
declare function syncRegistration(coord: CoordDatabase, fencing: FencingAndAgentManager, agentId: string): WorktreeRegistration | null;
|
|
243
|
+
/**
|
|
244
|
+
* Adopt when the hook cwd is exactly one linked worktree of this repository and the session
|
|
245
|
+
* does not already own a different checkout. Anything else is left alone.
|
|
246
|
+
*/
|
|
247
|
+
declare function adoptIfUnambiguous(coord: CoordDatabase, fencing: FencingAndAgentManager, params: {
|
|
248
|
+
agentId: string;
|
|
249
|
+
cwd: string;
|
|
250
|
+
}): WorktreeBinding | null;
|
|
251
|
+
declare function liveAdoption(coord: CoordDatabase, fencing: FencingAndAgentManager, agent: AgentRecord | null | undefined): LiveAdoption | null;
|
|
252
|
+
/** Move an adopted or created workspace from one agent onto another, leaving the directory in place. */
|
|
253
|
+
declare function transferWorktreeRegistration(coord: CoordDatabase, fromId: string, toId: string): boolean;
|
|
254
|
+
declare function forgetWorktree(coord: CoordDatabase, fencing: FencingAndAgentManager, agentId: string): boolean;
|
|
255
|
+
|
|
256
|
+
/** Copy a dependency directory so the destination cannot add, remove, or rewrite the source tree. */
|
|
257
|
+
declare function cloneDirectoryIsolated(srcDir: string, destDir: string): 'apfs-cow' | 'reflink-cow' | 'copy';
|
|
258
|
+
interface SpawnedWorktree {
|
|
259
|
+
agentId: string;
|
|
260
|
+
worktreePath: string;
|
|
261
|
+
branch: string | null;
|
|
137
262
|
hydrationMethod: 'apfs-cow' | 'reflink-cow' | 'copy' | 'none';
|
|
138
263
|
hydratedDirs: string[];
|
|
139
264
|
durationMs: number;
|
|
265
|
+
provenance?: WorktreeBinding['provenance'];
|
|
266
|
+
source?: WorktreeBinding['source'];
|
|
267
|
+
detached?: boolean;
|
|
268
|
+
dirty?: boolean;
|
|
269
|
+
branchCheckedOutElsewhere?: boolean;
|
|
270
|
+
alreadyRegistered?: boolean;
|
|
271
|
+
notes?: string[];
|
|
140
272
|
}
|
|
141
273
|
declare class CoWWorktreeManager {
|
|
142
274
|
private readonly coordDb;
|
|
@@ -153,13 +285,31 @@ declare class CoWWorktreeManager {
|
|
|
153
285
|
branch?: string;
|
|
154
286
|
baseRef?: string;
|
|
155
287
|
}): SpawnedWorktree;
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
288
|
+
removeWorktree(agentId: string, options?: {
|
|
289
|
+
deleteAdopted?: boolean;
|
|
290
|
+
}): boolean;
|
|
291
|
+
private removeCheckout;
|
|
292
|
+
private clearAgentWorktree;
|
|
293
|
+
listWorktrees(): ListedWorktree[];
|
|
294
|
+
registrationFor(agentId: string): WorktreeRegistration | null;
|
|
295
|
+
listRegistrations(): WorktreeRegistration[];
|
|
296
|
+
adoptWorktree(params: {
|
|
297
|
+
agentId: string;
|
|
298
|
+
path?: string;
|
|
299
|
+
explicit?: boolean;
|
|
300
|
+
}): WorktreeBinding;
|
|
301
|
+
adoptIfUnambiguous(params: {
|
|
302
|
+
agentId: string;
|
|
303
|
+
cwd: string;
|
|
304
|
+
}): WorktreeBinding | null;
|
|
305
|
+
syncRegistration(agentId: string): WorktreeRegistration | null;
|
|
306
|
+
liveAdoption(agent: {
|
|
307
|
+
id: string;
|
|
308
|
+
worktree_path?: string | null;
|
|
309
|
+
branch?: string | null;
|
|
310
|
+
status?: string;
|
|
311
|
+
} | null | undefined): LiveAdoption | null;
|
|
312
|
+
forgetWorktree(agentId: string): boolean;
|
|
163
313
|
}
|
|
164
314
|
|
|
165
315
|
interface WorktreeChange {
|
|
@@ -386,6 +536,13 @@ declare class LockEngine {
|
|
|
386
536
|
static normalizeFile(repoRoot: string, file: string): string;
|
|
387
537
|
static literalScope(file: string): string;
|
|
388
538
|
private rootForAgent;
|
|
539
|
+
/** Case-insensitive volumes must see every lock; the SQL filter below is byte-exact. */
|
|
540
|
+
private foldsLockPaths;
|
|
541
|
+
/**
|
|
542
|
+
* Locks that can overlap `patterns`. Literal file claims are matched in SQLite.
|
|
543
|
+
* Glob and symbol claims stay in the candidate set because overlap is not equality.
|
|
544
|
+
*/
|
|
545
|
+
private locksVisibleFor;
|
|
389
546
|
private activeWorktreeRoots;
|
|
390
547
|
private wildcardHasAliases;
|
|
391
548
|
/** Exact overlap for the documented scope grammar; legacy unsupported locks block conservatively. */
|
|
@@ -618,6 +775,8 @@ declare function refUpdateResyncRoots(command: string, startDir: string): string
|
|
|
618
775
|
* and contains no file-redirection or write primitives.
|
|
619
776
|
*/
|
|
620
777
|
declare function isReadOnlyShellCommand(command: string): boolean;
|
|
778
|
+
/** A command that can change files it does not name, so a live peer lock is not an excuse to ignore the diff. */
|
|
779
|
+
declare function isUnscopedShellMutation(command: string): boolean;
|
|
621
780
|
/**
|
|
622
781
|
* True when `command` explicitly references `relPath` (or its filename) and contains a write/mutation
|
|
623
782
|
* indicator. Prevents blaming unrelated or read-only commands for concurrent edits made by the live
|
|
@@ -1119,6 +1278,7 @@ declare class KithEngine {
|
|
|
1119
1278
|
mutexWaiters: Record<string, node_sqlite.SQLOutputValue>[];
|
|
1120
1279
|
commandGuards: Record<string, node_sqlite.SQLOutputValue>[];
|
|
1121
1280
|
workspaces: WorkspaceObservation[];
|
|
1281
|
+
worktreeRegistrations: WorktreeRegistration[];
|
|
1122
1282
|
};
|
|
1123
1283
|
previewIntegration(agentId: string): {
|
|
1124
1284
|
ok: boolean;
|
|
@@ -1147,6 +1307,8 @@ declare class KithEngine {
|
|
|
1147
1307
|
};
|
|
1148
1308
|
beginWork(params: Parameters<IntentAndTaskEngine['declareIntent']>[0] & {
|
|
1149
1309
|
isolateWorktree?: boolean;
|
|
1310
|
+
adoptWorktree?: boolean;
|
|
1311
|
+
worktreePath?: string;
|
|
1150
1312
|
}): {
|
|
1151
1313
|
worktree: SpawnedWorktree | null;
|
|
1152
1314
|
workflowMode: "worktrees" | "main";
|
|
@@ -1169,6 +1331,8 @@ declare class KithEngine {
|
|
|
1169
1331
|
claimNextTask(params: {
|
|
1170
1332
|
agentId: string;
|
|
1171
1333
|
isolateWorktree?: boolean;
|
|
1334
|
+
adoptWorktree?: boolean;
|
|
1335
|
+
worktreePath?: string;
|
|
1172
1336
|
}): {
|
|
1173
1337
|
worktree: SpawnedWorktree | null;
|
|
1174
1338
|
workflowMode: "worktrees" | "main";
|
|
@@ -1194,6 +1358,8 @@ declare class KithEngine {
|
|
|
1194
1358
|
claimNextTaskWhenAvailable(params: {
|
|
1195
1359
|
agentId: string;
|
|
1196
1360
|
isolateWorktree?: boolean;
|
|
1361
|
+
adoptWorktree?: boolean;
|
|
1362
|
+
worktreePath?: string;
|
|
1197
1363
|
waitTimeoutMs: number;
|
|
1198
1364
|
signal?: AbortSignal;
|
|
1199
1365
|
}): Promise<{
|
|
@@ -1262,19 +1428,28 @@ declare class KithEngine {
|
|
|
1262
1428
|
waitTimeoutMs?: number;
|
|
1263
1429
|
}): {
|
|
1264
1430
|
ok: boolean;
|
|
1265
|
-
mergeResult:
|
|
1431
|
+
mergeResult: null;
|
|
1266
1432
|
error: string;
|
|
1267
1433
|
completedTasks?: undefined;
|
|
1434
|
+
notes?: undefined;
|
|
1268
1435
|
} | {
|
|
1269
1436
|
ok: boolean;
|
|
1437
|
+
completedTasks: TaskRecord[];
|
|
1270
1438
|
mergeResult: null;
|
|
1439
|
+
notes: string[];
|
|
1440
|
+
error?: undefined;
|
|
1441
|
+
} | {
|
|
1442
|
+
ok: boolean;
|
|
1443
|
+
mergeResult: SpeculativeMergeResult;
|
|
1271
1444
|
error: string;
|
|
1272
1445
|
completedTasks?: undefined;
|
|
1446
|
+
notes?: undefined;
|
|
1273
1447
|
} | {
|
|
1274
1448
|
ok: boolean;
|
|
1275
1449
|
completedTasks: TaskRecord[];
|
|
1276
1450
|
mergeResult: SpeculativeMergeResult | null;
|
|
1277
1451
|
error?: undefined;
|
|
1452
|
+
notes?: undefined;
|
|
1278
1453
|
};
|
|
1279
1454
|
close(): void;
|
|
1280
1455
|
}
|
|
@@ -1342,12 +1517,14 @@ declare function readCoordinationState(directory?: string, options?: {
|
|
|
1342
1517
|
handoffs: HandoffRecord[];
|
|
1343
1518
|
workflowMode: WorkflowMode;
|
|
1344
1519
|
workflowModeConfigured: boolean;
|
|
1520
|
+
worktreeRegistrations: WorktreeRegistration[];
|
|
1345
1521
|
} | {
|
|
1346
1522
|
state: "ready";
|
|
1347
1523
|
schemaVersion: number;
|
|
1348
1524
|
handoffs: HandoffRecord[];
|
|
1349
1525
|
workflowMode: "worktrees" | "main";
|
|
1350
1526
|
workflowModeConfigured: boolean;
|
|
1527
|
+
worktreeRegistrations: WorktreeRegistration[];
|
|
1351
1528
|
fencingEpoch: number;
|
|
1352
1529
|
agents: AgentRecord[];
|
|
1353
1530
|
tasks: {
|
|
@@ -1407,6 +1584,7 @@ declare function readCoordinationState(directory?: string, options?: {
|
|
|
1407
1584
|
commandGuards: Record<string, unknown>[];
|
|
1408
1585
|
mergeQueue: Record<string, unknown>[];
|
|
1409
1586
|
recentAgentFiles: Record<string, string[]>;
|
|
1587
|
+
worktreeRegistrations: WorktreeRegistration[];
|
|
1410
1588
|
truncated: boolean;
|
|
1411
1589
|
protocolVersion: string;
|
|
1412
1590
|
observedAt: number;
|
|
@@ -1482,6 +1660,7 @@ declare function recoveryReport(directory?: string): {
|
|
|
1482
1660
|
handoffs: HandoffRecord[];
|
|
1483
1661
|
workflowMode: WorkflowMode;
|
|
1484
1662
|
workflowModeConfigured: boolean;
|
|
1663
|
+
worktreeRegistrations: WorktreeRegistration[];
|
|
1485
1664
|
} | {
|
|
1486
1665
|
retainedWorktrees: {
|
|
1487
1666
|
path: string;
|
|
@@ -1503,6 +1682,7 @@ declare function recoveryReport(directory?: string): {
|
|
|
1503
1682
|
handoffs: HandoffRecord[];
|
|
1504
1683
|
workflowMode: "worktrees" | "main";
|
|
1505
1684
|
workflowModeConfigured: boolean;
|
|
1685
|
+
worktreeRegistrations: WorktreeRegistration[];
|
|
1506
1686
|
fencingEpoch: number;
|
|
1507
1687
|
agents: AgentRecord[];
|
|
1508
1688
|
tasks: {
|
|
@@ -1577,6 +1757,7 @@ declare function recoveryReport(directory?: string): {
|
|
|
1577
1757
|
commandGuards: Record<string, unknown>[];
|
|
1578
1758
|
mergeQueue: Record<string, unknown>[];
|
|
1579
1759
|
recentAgentFiles: Record<string, string[]>;
|
|
1760
|
+
worktreeRegistrations: WorktreeRegistration[];
|
|
1580
1761
|
truncated: boolean;
|
|
1581
1762
|
protocolVersion: string;
|
|
1582
1763
|
observedAt: number;
|
|
@@ -1604,7 +1785,7 @@ interface GcOptions {
|
|
|
1604
1785
|
interface GcPreservedItem {
|
|
1605
1786
|
path: string;
|
|
1606
1787
|
branch: string | null;
|
|
1607
|
-
reason: 'active-session' | 'open-handoff' | 'dirty' | 'unmerged';
|
|
1788
|
+
reason: 'active-session' | 'open-handoff' | 'dirty' | 'unmerged' | 'adopted';
|
|
1608
1789
|
}
|
|
1609
1790
|
interface GcReport {
|
|
1610
1791
|
ok: boolean;
|
|
@@ -1622,15 +1803,19 @@ interface GcReport {
|
|
|
1622
1803
|
prunedOldEvents: number;
|
|
1623
1804
|
prunedDeadAgents: number;
|
|
1624
1805
|
prunedArtifacts: number;
|
|
1806
|
+
/** Set when Git could not list worktrees, so no worktree directory was removed. */
|
|
1807
|
+
warning?: string;
|
|
1808
|
+
recoveredRefUpdates: number;
|
|
1625
1809
|
}
|
|
1626
1810
|
/**
|
|
1627
|
-
*
|
|
1628
|
-
* without
|
|
1811
|
+
* Refresh index entries that still describe the pre-commit tree after a temporary-index
|
|
1812
|
+
* `update-ref`, without unstaging other work. A path is stale only when the index differs
|
|
1813
|
+
* from HEAD and the worktree already matches HEAD. Staged blobs that differ from both are kept.
|
|
1629
1814
|
*/
|
|
1630
1815
|
declare function resyncStaleIndexEntries(repoRoot: string): number;
|
|
1631
1816
|
declare function gcCoordination(directory?: string, options?: GcOptions): GcReport;
|
|
1632
1817
|
|
|
1633
|
-
declare const KITH_VERSION = "0.1
|
|
1818
|
+
declare const KITH_VERSION = "0.2.1";
|
|
1634
1819
|
declare const KITH_PROTOCOL_VERSION = "1.6.0";
|
|
1635
1820
|
|
|
1636
|
-
export { type AcquireLockResult, type AgentRecord, type AgentUnreadDelta, AstAnalyzer, type BashGuardPostReport, BashMerkleGuard, type BlastRadiusAlert, CoWWorktreeManager, type CommitParams, type CommitResult, type ConflictRecord, type ContractRecord, CoordDatabase, type CoordEvent, type DeclareIntentResult, DependencyAndContractEngine, type DirtyMergeProbeResult, type ExtractedImport, type ExtractedSymbol, FencingAndAgentManager, type FileAstAnalysis, type FileModificationReport, type FileSnapshotEntry, type GcOptions, type GcPreservedItem, type GcReport, IntentAndTaskEngine, KITH_PROTOCOL_VERSION, KITH_VERSION, KithEngine, type LinkedWorkspaceContract, type LockConflict, LockEngine, type LockRecord, type MergeTrainEntry, type PostFileEditHookResult, type QuarantineRecord, type RepositoryLayout, ResourceBroker, type ResourceRecord, SessionOwnershipError, type SessionRegistration, ShadowGitEngine, type SpawnedWorktree, type SpeculativeMergeResult, SpeculativeMergeTrain, StaleFencingTokenError, type SupervisedCommandOptions, type SwarmPrompts, type SymbolKind, type TaskRecord, type WorkspaceContractReport, type WorkspaceObservation, type WorktreeChange, buildSwarmPrompts, caseSensitivePaths, commandTargetsFileForWrite, commitScopedFiles, discoverChildRepositories, discoverRepository, extractRecentAgentFiles, gcCoordination, inspectWorkspaceContracts, isReadOnlyShellCommand, isWithin, observeWorkspaces, physicalPath, previewIntegration, readBrief, readCoordinationState, recoveryReport, refUpdateResyncRoots, repositoryFile, resyncStaleIndexEntries, runVerificationCommand, sqliteDatabase, verifyCrossRepoImportsForFile, worktreeChanges };
|
|
1821
|
+
export { type AcquireLockResult, type AgentRecord, type AgentUnreadDelta, AstAnalyzer, type BashGuardPostReport, BashMerkleGuard, type BlastRadiusAlert, CoWWorktreeManager, type CommitParams, type CommitResult, type ConflictRecord, type ContractRecord, CoordDatabase, type CoordEvent, type DeclareIntentResult, DependencyAndContractEngine, type DirtyMergeProbeResult, type ExtractedImport, type ExtractedSymbol, FencingAndAgentManager, type FileAstAnalysis, type FileModificationReport, type FileSnapshotEntry, type GcOptions, type GcPreservedItem, type GcReport, IntentAndTaskEngine, KITH_PROTOCOL_VERSION, KITH_VERSION, KithEngine, type LinkedWorkspaceContract, type ListedWorktree, type LiveAdoption, type LockConflict, LockEngine, type LockRecord, type MergeTrainEntry, type PostFileEditHookResult, type QuarantineRecord, type RepositoryLayout, ResourceBroker, type ResourceRecord, SessionOwnershipError, type SessionRegistration, ShadowGitEngine, type SpawnedWorktree, type SpeculativeMergeResult, SpeculativeMergeTrain, StaleFencingTokenError, type SupervisedCommandOptions, type SwarmPrompts, type SymbolKind, type TaskRecord, type WorkspaceContractReport, type WorkspaceObservation, type WorktreeBinding, type WorktreeChange, WorktreeListError, type WorktreeProvenance, type WorktreeRegistration, type WorktreeSource, adoptIfUnambiguous, adoptWorktree, branchElsewhereError, branchIsCheckedOutElsewhere, buildSwarmPrompts, caseSensitivePaths, clearRegistration, cloneDirectoryIsolated, commandTargetsFileForWrite, commitScopedFiles, detachedIntegrationError, discoverChildRepositories, discoverRepository, extractRecentAgentFiles, forgetWorktree, gcCoordination, inspectWorkspaceContracts, isKithOwnedWorktree, isReadOnlyShellCommand, isUnscopedShellMutation, isWithin, kithWorktreesRoot, listGitWorktrees, listRegistrations, liveAdoption, observeWorkspaces, parseWorktreePorcelain, physicalPath, previewIntegration, primaryCheckoutOf, readBrief, readCoordinationState, readRegistration, recordCreatedWorktree, recoveryReport, refUpdateResyncRoots, registrationFromRow, repositoryFile, resyncStaleIndexEntries, runVerificationCommand, sqliteDatabase, syncRegistration, transferWorktreeRegistration, verifyCrossRepoImportsForFile, worktreeChanges };
|