@loucompanion/forge-bridge 0.1.4-dev.41da3780c451 → 0.1.4-dev.86fc5d1208e6
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 +1 -1
- package/dist/cli/cli.help.js +2 -2
- package/dist/runtime/attempt-process-supervisor.d.ts +5 -0
- package/dist/runtime/attempt-process-supervisor.js +24 -1
- package/dist/session/provider-cli/provider-usage.d.ts +2 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -65,7 +65,7 @@ Show or change the saved server without editing `bridge.json`:
|
|
|
65
65
|
```bash
|
|
66
66
|
forge-bridge server show
|
|
67
67
|
forge-bridge server set http://localhost:5208
|
|
68
|
-
forge-bridge server set https://
|
|
68
|
+
forge-bridge server set https://forge.example.ts.net:8443
|
|
69
69
|
```
|
|
70
70
|
|
|
71
71
|
`FORGE_URL` overrides the saved server. Changing the saved URL retains runner credentials so aliases for the same deployment keep working; pair again with `--server` when switching to a different Forge deployment.
|
package/dist/cli/cli.help.js
CHANGED
|
@@ -28,7 +28,7 @@ export function helpText() {
|
|
|
28
28
|
"",
|
|
29
29
|
"Examples:",
|
|
30
30
|
" npm install -g @loucompanion/forge-bridge@next",
|
|
31
|
-
" forge-bridge pair 1234-5678 --server https://
|
|
31
|
+
" forge-bridge pair 1234-5678 --server https://forge.example.ts.net:8443 --repo-root \"%USERPROFILE%\\ForgeRepos\"",
|
|
32
32
|
" forge-bridge connect",
|
|
33
33
|
" forge-bridge status --check-updates",
|
|
34
34
|
" forge-bridge server set http://localhost:5208",
|
|
@@ -116,7 +116,7 @@ export function commandHelpText(command) {
|
|
|
116
116
|
"",
|
|
117
117
|
"Examples:",
|
|
118
118
|
" forge-bridge server set http://localhost:5208",
|
|
119
|
-
" forge-bridge server set https://
|
|
119
|
+
" forge-bridge server set https://forge.example.ts.net:8443",
|
|
120
120
|
"",
|
|
121
121
|
].join("\n");
|
|
122
122
|
case "add-repo":
|
|
@@ -46,6 +46,8 @@ export interface AttemptProcessChildHandle {
|
|
|
46
46
|
export interface AttemptProcessSupervisorOptions {
|
|
47
47
|
readonly metadataReadyTimeoutMs?: number;
|
|
48
48
|
readonly signal?: AbortSignal;
|
|
49
|
+
readonly replaceLedgerFile?: (temporaryPath: string, ledgerPath: string) => Promise<void>;
|
|
50
|
+
readonly ledgerReplaceRetryMs?: number;
|
|
49
51
|
}
|
|
50
52
|
export interface AttemptProcessChildReadyOptions {
|
|
51
53
|
readonly maxStartAttempts?: number;
|
|
@@ -62,6 +64,8 @@ export declare class AttemptProcessSupervisor {
|
|
|
62
64
|
readonly ledgerPath: string;
|
|
63
65
|
private readonly identity;
|
|
64
66
|
private readonly metadataReadyTimeoutMs;
|
|
67
|
+
private readonly replaceLedgerFile;
|
|
68
|
+
private readonly ledgerReplaceRetryMs;
|
|
65
69
|
private readonly records;
|
|
66
70
|
private readonly currentByName;
|
|
67
71
|
private readonly attemptController;
|
|
@@ -86,6 +90,7 @@ export declare class AttemptProcessSupervisor {
|
|
|
86
90
|
providerMemoryTelemetry(): AttemptProcessTreeMemoryTelemetry | null;
|
|
87
91
|
private observeChildReady;
|
|
88
92
|
private settleChild;
|
|
93
|
+
private replaceLedger;
|
|
89
94
|
private assertFence;
|
|
90
95
|
private persist;
|
|
91
96
|
}
|
|
@@ -5,6 +5,11 @@ import { ForgeFailureError, sanitizeFailureError } from "../session/session.type
|
|
|
5
5
|
import { monotonicNowMs } from "../shared/time/monotonic.js";
|
|
6
6
|
const terminalChildStatuses = new Set(["exited", "failed"]);
|
|
7
7
|
const defaultMetadataReadyTimeoutMs = process.platform === "win32" ? 60_000 : 10_000;
|
|
8
|
+
// Windows refuses to replace a file another process (a scanner or indexer) briefly holds
|
|
9
|
+
// open. One such refusal must not degrade the attempt, so the ledger replace is retried.
|
|
10
|
+
const ledgerReplaceAttempts = 40;
|
|
11
|
+
const defaultLedgerReplaceRetryMs = 25;
|
|
12
|
+
const transientLedgerReplaceCodes = new Set(["EPERM", "EACCES", "EBUSY"]);
|
|
8
13
|
/**
|
|
9
14
|
* Owns the independently supervised process trees that belong to one host
|
|
10
15
|
* dispatch attempt. Each named child gets a distinct Windows Job Object or
|
|
@@ -16,6 +21,8 @@ export class AttemptProcessSupervisor {
|
|
|
16
21
|
ledgerPath;
|
|
17
22
|
identity;
|
|
18
23
|
metadataReadyTimeoutMs;
|
|
24
|
+
replaceLedgerFile;
|
|
25
|
+
ledgerReplaceRetryMs;
|
|
19
26
|
records = [];
|
|
20
27
|
currentByName = new Map();
|
|
21
28
|
attemptController = new AbortController();
|
|
@@ -27,6 +34,8 @@ export class AttemptProcessSupervisor {
|
|
|
27
34
|
this.runner = runner;
|
|
28
35
|
this.identity = validateIdentity(identity);
|
|
29
36
|
this.metadataReadyTimeoutMs = boundedInteger(options.metadataReadyTimeoutMs ?? defaultMetadataReadyTimeoutMs, 100, 120_000, "metadataReadyTimeoutMs");
|
|
37
|
+
this.replaceLedgerFile = options.replaceLedgerFile ?? ((temporaryPath, ledgerPath) => fs.rename(temporaryPath, ledgerPath));
|
|
38
|
+
this.ledgerReplaceRetryMs = options.ledgerReplaceRetryMs ?? defaultLedgerReplaceRetryMs;
|
|
30
39
|
this.ledgerPath = path.join(this.identity.logDirectory, "attempt-process-supervisor.json");
|
|
31
40
|
if (options.signal?.aborted) {
|
|
32
41
|
this.status = "stopping";
|
|
@@ -291,6 +300,20 @@ export class AttemptProcessSupervisor {
|
|
|
291
300
|
this.status = "degraded";
|
|
292
301
|
});
|
|
293
302
|
}
|
|
303
|
+
async replaceLedger(temporary) {
|
|
304
|
+
for (let attempt = 1;; attempt += 1) {
|
|
305
|
+
try {
|
|
306
|
+
await this.replaceLedgerFile(temporary, this.ledgerPath);
|
|
307
|
+
return;
|
|
308
|
+
}
|
|
309
|
+
catch (error) {
|
|
310
|
+
const code = error.code;
|
|
311
|
+
if (attempt >= ledgerReplaceAttempts || !code || !transientLedgerReplaceCodes.has(code))
|
|
312
|
+
throw error;
|
|
313
|
+
await wait(this.ledgerReplaceRetryMs);
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
}
|
|
294
317
|
assertFence(fencingToken) {
|
|
295
318
|
if (fencingToken !== this.identity.fencingToken) {
|
|
296
319
|
throw new Error("attempt_process_supervisor_fenced: fencing token does not own this attempt.");
|
|
@@ -309,7 +332,7 @@ export class AttemptProcessSupervisor {
|
|
|
309
332
|
finally {
|
|
310
333
|
await handle.close();
|
|
311
334
|
}
|
|
312
|
-
await
|
|
335
|
+
await this.replaceLedger(temporary);
|
|
313
336
|
}
|
|
314
337
|
catch (error) {
|
|
315
338
|
await fs.rm(temporary, { force: true }).catch(() => undefined);
|
|
@@ -4,7 +4,8 @@ export type InputTokenSemantics = "includes_cached_input" | "excludes_cache_toke
|
|
|
4
4
|
export declare const PROVIDER_USAGE_SCHEMA_VERSION = 1;
|
|
5
5
|
/**
|
|
6
6
|
* Normalized, provider-agnostic token usage accumulated for a dispatch. Cost is never computed
|
|
7
|
-
* here; the API recomputes cost from these tokens x model rates (
|
|
7
|
+
* here; the API recomputes cost from these tokens x model rates (legacy
|
|
8
|
+
* ADR-0006, .forge-designer/decisions/legacy/0006-cost-capture.md).
|
|
8
9
|
*/
|
|
9
10
|
export interface ProviderUsage {
|
|
10
11
|
/** Normalized total input. Cached input is a subset, never an additive peer. */
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const forgeBridgeVersion = "0.1.4-dev.
|
|
1
|
+
export declare const forgeBridgeVersion = "0.1.4-dev.86fc5d1208e6";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const forgeBridgeVersion = "0.1.4-dev.
|
|
1
|
+
export const forgeBridgeVersion = "0.1.4-dev.86fc5d1208e6";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loucompanion/forge-bridge",
|
|
3
|
-
"version": "0.1.4-dev.
|
|
3
|
+
"version": "0.1.4-dev.86fc5d1208e6",
|
|
4
4
|
"description": "Forge runner bridge CLI for connecting local developer machines to Forge dispatch.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"type": "module",
|