harnery 0.45.0 → 0.45.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/dist/commander.js +0 -1
- package/dist/commands/files.d.ts +2 -2
- package/dist/commands/files.d.ts.map +1 -1
- package/dist/commands/files.js +4 -7
- package/dist/commands/servers.d.ts.map +1 -1
- package/dist/commands/servers.js +17 -11
- package/dist/commands/tunnel.d.ts +0 -15
- package/dist/commands/tunnel.d.ts.map +1 -1
- package/dist/commands/tunnel.js +153 -453
- package/dist/core/agents/live-authority-v3.d.ts +0 -1
- package/dist/core/agents/live-authority-v3.d.ts.map +1 -1
- package/dist/core/agents/live-authority-v3.js +0 -11
- package/dist/core/agents/live-lifecycle-v3.d.ts +2 -4
- package/dist/core/agents/live-lifecycle-v3.d.ts.map +1 -1
- package/dist/core/agents/live-lifecycle-v3.js +7 -28
- package/dist/core/agents/state/heartbeat-writer.d.ts.map +1 -1
- package/dist/core/agents/state/heartbeat-writer.js +14 -25
- package/dist/core/agents/state/live-coordination-writer.d.ts.map +1 -1
- package/dist/core/agents/state/live-coordination-writer.js +0 -5
- package/dist/core/agents/state/pidmap.d.ts.map +1 -1
- package/dist/core/agents/state/pidmap.js +0 -5
- package/dist/core/agents/state/stale-sweep.d.ts.map +1 -1
- package/dist/core/agents/state/stale-sweep.js +70 -180
- package/dist/core/artifacts/activity.d.ts +4 -1
- package/dist/core/artifacts/activity.d.ts.map +1 -1
- package/dist/core/artifacts/activity.js +8 -2
- package/dist/core/artifacts/delivery-card.d.ts.map +1 -1
- package/dist/core/artifacts/delivery-card.js +1 -2
- package/dist/core/artifacts/index.d.ts.map +1 -1
- package/dist/core/artifacts/index.js +38 -12
- package/dist/core/events/v3/authority-outbox.d.ts.map +1 -1
- package/dist/core/events/v3/authority-outbox.js +0 -29
- package/dist/core/events/v3/producers/coordination-recorder.d.ts +0 -1
- package/dist/core/events/v3/producers/coordination-recorder.d.ts.map +1 -1
- package/dist/core/events/v3/producers/coordination-recorder.js +0 -7
- package/dist/core/events/v3/producers/recorder.d.ts.map +1 -1
- package/dist/core/events/v3/producers/recorder.js +64 -77
- package/dist/core/hooks/cli.js +78 -48
- package/dist/core/servers/index.d.ts +13 -10
- package/dist/core/servers/index.d.ts.map +1 -1
- package/dist/core/servers/index.js +97 -192
- package/dist/core/servers/tunnels.d.ts +3 -5
- package/dist/core/servers/tunnels.d.ts.map +1 -1
- package/dist/core/servers/tunnels.js +2 -45
- package/dist/core/storage/durable-history.js +56 -22
- package/dist/core/storage/segments.d.ts.map +1 -1
- package/dist/core/storage/segments.js +73 -17
- package/dist/core/work/state.js +7 -7
- package/dist/core/workflow/engine.d.ts.map +1 -1
- package/dist/core/workflow/engine.js +21 -65
- package/dist/core/workflow/live-session-v3.d.ts +0 -6
- package/dist/core/workflow/live-session-v3.d.ts.map +1 -1
- package/dist/core/workflow/live-session-v3.js +5 -126
- package/dist/core/workflow/proof.d.ts +4 -4
- package/dist/core/workflow/proof.d.ts.map +1 -1
- package/dist/core/workflow/proof.js +4 -12
- package/dist/core/workflow/spawn-claude.d.ts.map +1 -1
- package/dist/core/workflow/spawn-claude.js +0 -19
- package/dist/core/workflow/spawn-codex.d.ts.map +1 -1
- package/dist/core/workflow/spawn-codex.js +0 -13
- package/dist/core/workflow/spawn-cursor.d.ts.map +1 -1
- package/dist/core/workflow/spawn-cursor.js +0 -19
- package/dist/core/workflow/spawn-opencode.d.ts.map +1 -1
- package/dist/core/workflow/spawn-opencode.js +0 -14
- package/dist/core/workflow/types.d.ts +11 -54
- package/dist/core/workflow/types.d.ts.map +1 -1
- package/dist/lib/identities/assume.d.ts.map +1 -1
- package/dist/lib/identities/assume.js +0 -4
- package/dist/lib/tunnel/state.d.ts +6 -13
- package/dist/lib/tunnel/state.d.ts.map +1 -1
- package/dist/lib/tunnel/state.js +12 -58
- package/package.json +1 -6
- package/src/commander.ts +0 -10
- package/src/commands/files.ts +5 -13
- package/src/commands/servers.ts +23 -12
- package/src/commands/tunnel.ts +166 -533
- package/src/core/agents/live-authority-v3.ts +0 -17
- package/src/core/agents/live-lifecycle-v3.ts +14 -52
- package/src/core/agents/state/heartbeat-writer.ts +12 -29
- package/src/core/agents/state/live-coordination-writer.ts +0 -29
- package/src/core/agents/state/pidmap.ts +0 -13
- package/src/core/agents/state/stale-sweep.ts +82 -247
- package/src/core/artifacts/activity.ts +9 -2
- package/src/core/artifacts/delivery-card.ts +1 -7
- package/src/core/artifacts/index.ts +45 -12
- package/src/core/events/v3/authority-outbox.ts +0 -56
- package/src/core/events/v3/producers/coordination-recorder.ts +0 -15
- package/src/core/events/v3/producers/recorder.ts +68 -94
- package/src/core/hooks/cli.ts +85 -47
- package/src/core/servers/index.ts +106 -228
- package/src/core/servers/tunnels.ts +3 -55
- package/src/core/storage/durable-history.ts +52 -20
- package/src/core/storage/segments.ts +79 -17
- package/src/core/work/state.ts +7 -7
- package/src/core/workflow/engine.ts +21 -73
- package/src/core/workflow/live-session-v3.ts +5 -146
- package/src/core/workflow/proof.ts +5 -21
- package/src/core/workflow/spawn-claude.ts +0 -18
- package/src/core/workflow/spawn-codex.ts +0 -13
- package/src/core/workflow/spawn-cursor.ts +0 -18
- package/src/core/workflow/spawn-opencode.ts +0 -14
- package/src/core/workflow/types.ts +11 -41
- package/src/lib/identities/assume.ts +0 -4
- package/src/lib/tunnel/state.ts +15 -70
- package/dist/commands/turn-rollback.d.ts +0 -5
- package/dist/commands/turn-rollback.d.ts.map +0 -1
- package/dist/commands/turn-rollback.js +0 -76
- package/dist/core/agents/state/unchanged-file.d.ts +0 -44
- package/dist/core/agents/state/unchanged-file.d.ts.map +0 -1
- package/dist/core/agents/state/unchanged-file.js +0 -390
- package/dist/core/events/v3/generation-custody.d.ts +0 -5
- package/dist/core/events/v3/generation-custody.d.ts.map +0 -1
- package/dist/core/events/v3/generation-custody.js +0 -50
- package/dist/core/turn-rollback/content.d.ts +0 -53
- package/dist/core/turn-rollback/content.d.ts.map +0 -1
- package/dist/core/turn-rollback/content.js +0 -396
- package/dist/core/turn-rollback/index.d.ts +0 -72
- package/dist/core/turn-rollback/index.d.ts.map +0 -1
- package/dist/core/turn-rollback/index.js +0 -443
- package/dist/core/workflow/failure-evidence.d.ts +0 -16
- package/dist/core/workflow/failure-evidence.d.ts.map +0 -1
- package/dist/core/workflow/failure-evidence.js +0 -114
- package/src/commands/turn-rollback.ts +0 -111
- package/src/core/agents/state/unchanged-file.ts +0 -456
- package/src/core/events/v3/generation-custody.ts +0 -59
- package/src/core/turn-rollback/content.ts +0 -499
- package/src/core/turn-rollback/index.ts +0 -580
- package/src/core/workflow/failure-evidence.ts +0 -141
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../../src/lib/tunnel/state.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../../src/lib/tunnel/state.ts"],"names":[],"mappings":"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"}
|
package/dist/lib/tunnel/state.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
// Tunnel config + state persistence + provider helpers. Commands default to
|
|
2
2
|
// <cwd>/.cache/tunnel/; gitignored, so the allowlist is per-machine.
|
|
3
3
|
import { spawnSync } from "node:child_process";
|
|
4
|
-
import {
|
|
5
|
-
import { accessSync, chmodSync, constants, existsSync, mkdirSync, readdirSync, readFileSync, renameSync, statSync, unlinkSync, writeFileSync, } from "node:fs";
|
|
4
|
+
import { accessSync, chmodSync, constants, existsSync, mkdirSync, readdirSync, readFileSync, statSync, unlinkSync, writeFileSync, } from "node:fs";
|
|
6
5
|
import { homedir } from "node:os";
|
|
7
6
|
import { delimiter, join, resolve } from "node:path";
|
|
8
7
|
import { isPathAllowed } from "./path-scope.js";
|
|
@@ -105,17 +104,7 @@ export function readState(name = DEFAULT_INSTANCE, root = process.cwd()) {
|
|
|
105
104
|
}
|
|
106
105
|
}
|
|
107
106
|
export function writeState(state, root = process.cwd()) {
|
|
108
|
-
|
|
109
|
-
const temporary = `${path}.${randomUUID()}.tmp`;
|
|
110
|
-
try {
|
|
111
|
-
writeFileSync(temporary, JSON.stringify(state, null, 2), { flag: "wx", mode: 0o600 });
|
|
112
|
-
renameSync(temporary, path);
|
|
113
|
-
}
|
|
114
|
-
catch (error) {
|
|
115
|
-
if (existsSync(temporary))
|
|
116
|
-
unlinkSync(temporary);
|
|
117
|
-
throw error;
|
|
118
|
-
}
|
|
107
|
+
writeFileSync(cachePath(stateFile(state.name), root), JSON.stringify(state, null, 2));
|
|
119
108
|
}
|
|
120
109
|
export function clearState(name = DEFAULT_INSTANCE, root = process.cwd()) {
|
|
121
110
|
const p = cachePath(stateFile(name), root);
|
|
@@ -150,49 +139,14 @@ export function isProcessAlive(pid) {
|
|
|
150
139
|
return false;
|
|
151
140
|
}
|
|
152
141
|
}
|
|
153
|
-
/**
|
|
154
|
-
export function
|
|
155
|
-
if (!state
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
!Number.isSafeInteger(state.gate_pid) ||
|
|
162
|
-
state.gate_pid < 1 ||
|
|
163
|
-
typeof state.gate_start_token !== "string" ||
|
|
164
|
-
!state.gate_start_token)
|
|
165
|
-
return "unknown";
|
|
166
|
-
const targets = [{ pid: state.gate_pid, token: state.gate_start_token }];
|
|
167
|
-
if (state.provider === "tailscale") {
|
|
168
|
-
if (state.provider_state !== "ready" ||
|
|
169
|
-
state.cloudflared_pid !== undefined ||
|
|
170
|
-
state.cloudflared_start_token !== undefined)
|
|
171
|
-
return "unknown";
|
|
172
|
-
}
|
|
173
|
-
else if (state.provider === "cloudflare") {
|
|
174
|
-
if (!Number.isSafeInteger(state.cloudflared_pid) ||
|
|
175
|
-
state.cloudflared_pid < 1 ||
|
|
176
|
-
typeof state.cloudflared_start_token !== "string" ||
|
|
177
|
-
!state.cloudflared_start_token)
|
|
178
|
-
return "unknown";
|
|
179
|
-
targets.push({ pid: state.cloudflared_pid, token: state.cloudflared_start_token });
|
|
180
|
-
}
|
|
181
|
-
else
|
|
182
|
-
return "unknown";
|
|
183
|
-
try {
|
|
184
|
-
return verifier.withRegistration(state, () => {
|
|
185
|
-
const observed = targets.map(({ pid, token }) => verifier.observeProcess(pid, token));
|
|
186
|
-
if (observed.every((value) => value === "absent"))
|
|
187
|
-
return "dead";
|
|
188
|
-
if (observed.every((value) => value === "same"))
|
|
189
|
-
return "ready";
|
|
190
|
-
return "unknown";
|
|
191
|
-
});
|
|
192
|
-
}
|
|
193
|
-
catch {
|
|
194
|
-
return "unknown";
|
|
195
|
-
}
|
|
142
|
+
/** True when both the local gate and its provider-side process are live. */
|
|
143
|
+
export function isTunnelStateLive(state, processAlive = isProcessAlive) {
|
|
144
|
+
if (!processAlive(state.gate_pid))
|
|
145
|
+
return false;
|
|
146
|
+
if (state.provider === "tailscale")
|
|
147
|
+
return true;
|
|
148
|
+
const providerPid = state.cloudflared_pid ?? state.provider_pid;
|
|
149
|
+
return typeof providerPid === "number" && processAlive(providerPid);
|
|
196
150
|
}
|
|
197
151
|
export function tunnelTargetPort(state) {
|
|
198
152
|
const value = /^[a-z][a-z\d+.-]*:\/\//i.test(state.target)
|
|
@@ -219,10 +173,10 @@ export function tunnelTargetPort(state) {
|
|
|
219
173
|
* link 400s. Matching the vhost too keeps the returned tunnel the one that
|
|
220
174
|
* actually serves the caller's origin.
|
|
221
175
|
*/
|
|
222
|
-
export function findLiveTunnelForOrigin(port, vhost, root,
|
|
176
|
+
export function findLiveTunnelForOrigin(port, vhost, root = process.cwd(), processAlive = isProcessAlive) {
|
|
223
177
|
return (listStates(root).find((state) => tunnelTargetPort(state) === port &&
|
|
224
178
|
state.vhost === vhost &&
|
|
225
|
-
|
|
179
|
+
isTunnelStateLive(state, processAlive)) ?? null);
|
|
226
180
|
}
|
|
227
181
|
/** True when the tunnel's path scope forwards every one of `paths`. */
|
|
228
182
|
export function tunnelServesPaths(state, paths) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "harnery",
|
|
3
|
-
"version": "0.45.
|
|
3
|
+
"version": "0.45.1",
|
|
4
4
|
"description": "Multi-agent coordination for AI coding agents - Claude Code, Cursor, and Codex.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Ryan Kelly",
|
|
@@ -67,11 +67,6 @@
|
|
|
67
67
|
"types": "./dist/core/context/index.d.ts",
|
|
68
68
|
"import": "./dist/core/context/index.js"
|
|
69
69
|
},
|
|
70
|
-
"./core/turn-rollback": {
|
|
71
|
-
"bun": "./src/core/turn-rollback/index.ts",
|
|
72
|
-
"types": "./dist/core/turn-rollback/index.d.ts",
|
|
73
|
-
"import": "./dist/core/turn-rollback/index.js"
|
|
74
|
-
},
|
|
75
70
|
"./core/workflow": {
|
|
76
71
|
"bun": "./src/core/workflow/index.ts",
|
|
77
72
|
"types": "./dist/core/workflow/index.d.ts",
|
package/src/commander.ts
CHANGED
|
@@ -795,16 +795,6 @@ function harneryCommandBundles({
|
|
|
795
795
|
load: async (program) =>
|
|
796
796
|
(await import("./commands/workflow.ts")).registerWorkflowCommand(program, emit),
|
|
797
797
|
},
|
|
798
|
-
lazy(
|
|
799
|
-
"turn-rollback",
|
|
800
|
-
"Capture and review exact turn paths before restoring owned content.",
|
|
801
|
-
async (program) =>
|
|
802
|
-
(await import("./commands/turn-rollback.ts")).registerTurnRollbackCommand(
|
|
803
|
-
program,
|
|
804
|
-
emit,
|
|
805
|
-
context,
|
|
806
|
-
),
|
|
807
|
-
),
|
|
808
798
|
lazy("work", "Track durable objectives across bounded workflow attempts.", async (program) =>
|
|
809
799
|
(await import("./commands/work.ts")).registerWorkCommand(program, emit),
|
|
810
800
|
),
|
package/src/commands/files.ts
CHANGED
|
@@ -4,7 +4,6 @@ import type { Command } from "commander";
|
|
|
4
4
|
import type { EmitContext, HarneryProgramContext } from "../commander.ts";
|
|
5
5
|
import { resolveCoordRoot } from "../core/agents/coord-client.ts";
|
|
6
6
|
import { DEFAULT_WEB_PORT, resolveWebPort } from "../core/config.ts";
|
|
7
|
-
import { createTunnelReadinessVerifier } from "../core/servers/index.ts";
|
|
8
7
|
import { coordRootId, localCoordRootIdUrl } from "../lib/coord-root-id.ts";
|
|
9
8
|
import {
|
|
10
9
|
encodedRepoPath,
|
|
@@ -15,10 +14,10 @@ import {
|
|
|
15
14
|
} from "../lib/local-file-url.ts";
|
|
16
15
|
import { isPathAllowed } from "../lib/tunnel/path-scope.ts";
|
|
17
16
|
import {
|
|
17
|
+
isTunnelStateLive,
|
|
18
18
|
listStates,
|
|
19
|
-
type
|
|
19
|
+
type ProcessAliveCheck,
|
|
20
20
|
type TunnelState,
|
|
21
|
-
tunnelReadiness,
|
|
22
21
|
tunnelTargetPort,
|
|
23
22
|
} from "../lib/tunnel/state.ts";
|
|
24
23
|
|
|
@@ -209,10 +208,10 @@ export function tunnelFileUrl(
|
|
|
209
208
|
local: LocalFileUrl,
|
|
210
209
|
port: number,
|
|
211
210
|
states: TunnelState[],
|
|
212
|
-
|
|
211
|
+
processAlive?: ProcessAliveCheck,
|
|
213
212
|
): string {
|
|
214
213
|
const live = states.filter(
|
|
215
|
-
(state) => tunnelTargetPort(state) === port &&
|
|
214
|
+
(state) => tunnelTargetPort(state) === port && isTunnelStateLive(state, processAlive),
|
|
216
215
|
);
|
|
217
216
|
if (local.mode === "raw") {
|
|
218
217
|
const path = `/${encodedRepoPath(local.relPath)}`;
|
|
@@ -310,14 +309,7 @@ export function registerFilesCommand(
|
|
|
310
309
|
mode: opts.raw ? "raw" : opts.viewer ? "viewer" : "auto",
|
|
311
310
|
});
|
|
312
311
|
if (opts.verify !== false) await verifyDashboardRoot(coordRoot, port);
|
|
313
|
-
const url = opts.tunnel
|
|
314
|
-
? tunnelFileUrl(
|
|
315
|
-
result,
|
|
316
|
-
port,
|
|
317
|
-
listStates(coordRoot),
|
|
318
|
-
createTunnelReadinessVerifier({ coordRoot }),
|
|
319
|
-
)
|
|
320
|
-
: result.url;
|
|
312
|
+
const url = opts.tunnel ? tunnelFileUrl(result, port, listStates(coordRoot)) : result.url;
|
|
321
313
|
emit.text(`${url}\n`);
|
|
322
314
|
} catch (error) {
|
|
323
315
|
if (error instanceof TunnelLinkError) {
|
package/src/commands/servers.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { existsSync, readFileSync, statSync } from "node:fs";
|
|
2
|
+
import { hostname } from "node:os";
|
|
2
3
|
import type { Command } from "commander";
|
|
3
4
|
import type { EmitContext, HarneryProgramContext } from "../commander.ts";
|
|
4
5
|
import { resolveCoordRoot } from "../core/agents/coord-client.ts";
|
|
@@ -110,13 +111,23 @@ export function registerServersCommand(
|
|
|
110
111
|
const preview = Boolean(options.type) && !options.yes;
|
|
111
112
|
const results: Array<StopResult | { id: string; would_stop: true }> = [];
|
|
112
113
|
for (const stray of strays) {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
114
|
+
results.push(
|
|
115
|
+
await stopServer(
|
|
116
|
+
{
|
|
117
|
+
schema_version: 1,
|
|
118
|
+
id: `pid-${stray.pid}`,
|
|
119
|
+
kind: "session",
|
|
120
|
+
type: "unregistered",
|
|
121
|
+
label: stray.command,
|
|
122
|
+
pid: stray.pid,
|
|
123
|
+
...(stray.start_token ? { start_token: stray.start_token } : {}),
|
|
124
|
+
host: hostname(),
|
|
125
|
+
started_at: new Date().toISOString(),
|
|
126
|
+
registered_at: new Date().toISOString(),
|
|
127
|
+
},
|
|
128
|
+
{ coordRoot },
|
|
129
|
+
),
|
|
130
|
+
);
|
|
120
131
|
}
|
|
121
132
|
for (const view of selected) {
|
|
122
133
|
if (preview && !ids.includes(view.record.id))
|
|
@@ -397,14 +408,14 @@ export function registerServersCommand(
|
|
|
397
408
|
|
|
398
409
|
cmd
|
|
399
410
|
.command("unregister <id>")
|
|
400
|
-
.description("Remove
|
|
411
|
+
.description("Remove a server's record (with --pid, only if the record still names that pid)")
|
|
401
412
|
.option("--pid <pid>", "Only remove when the record names this pid")
|
|
402
413
|
.action((id: string, options: { pid?: string }) => {
|
|
403
414
|
try {
|
|
404
|
-
const
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
415
|
+
const removed = unregisterServer(id, {
|
|
416
|
+
coordRoot: root(),
|
|
417
|
+
...(options.pid ? { pid: integer(options.pid, "--pid") } : {}),
|
|
418
|
+
});
|
|
408
419
|
emit.config({ format: "json" });
|
|
409
420
|
emit.data({ id, removed });
|
|
410
421
|
} catch (error) {
|