@loucompanion/forge-bridge 0.1.3-dev.d46a8e73d03d → 0.1.3-dev.eeefdb0d19c1
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 +34 -0
- package/dist/bridge/bridge.base.d.ts +2 -1
- package/dist/bridge/bridge.service.d.ts +22 -3
- package/dist/bridge/bridge.service.js +416 -40
- package/dist/bridge/bridge.types.d.ts +59 -1
- package/dist/cleanup/cleanup.service.d.ts +13 -2
- package/dist/cleanup/cleanup.service.js +435 -3
- package/dist/cleanup/cleanup.types.d.ts +10 -0
- package/dist/cleanup/index.d.ts +1 -1
- package/dist/cleanup/index.js +1 -1
- package/dist/cleanup/internals.d.ts +2 -2
- package/dist/cleanup/internals.js +1 -1
- package/dist/cli/cli.help.js +37 -3
- package/dist/cli/cli.service.d.ts +30 -2
- package/dist/cli/cli.service.js +182 -23
- package/dist/cli/local-config.d.ts +4 -0
- package/dist/cli/local-config.js +41 -1
- package/dist/runtime/attempt-node-runtime-launcher.d.ts +17 -0
- package/dist/runtime/attempt-node-runtime-launcher.js +101 -0
- package/dist/runtime/attempt-process-supervisor-registry.d.ts +20 -0
- package/dist/runtime/attempt-process-supervisor-registry.js +64 -0
- package/dist/runtime/attempt-process-supervisor.d.ts +86 -0
- package/dist/runtime/attempt-process-supervisor.js +343 -0
- package/dist/runtime/generated-output-reset.d.ts +10 -0
- package/dist/runtime/generated-output-reset.js +103 -0
- package/dist/runtime/host-listener-inspector.d.ts +44 -0
- package/dist/runtime/host-listener-inspector.js +324 -0
- package/dist/runtime/host-port-broker.d.ts +76 -0
- package/dist/runtime/host-port-broker.js +333 -0
- package/dist/runtime/host-runtime-contract.d.ts +47 -0
- package/dist/runtime/host-runtime-contract.js +700 -0
- package/dist/runtime/host-runtime-lease.d.ts +133 -0
- package/dist/runtime/host-runtime-lease.js +1460 -0
- package/dist/runtime/host-runtime-promotion.d.ts +23 -0
- package/dist/runtime/host-runtime-promotion.js +159 -0
- package/dist/runtime/node-host-runtime-adapter.d.ts +51 -0
- package/dist/runtime/node-host-runtime-adapter.js +268 -0
- package/dist/runtime/playwright-host-runtime-adapter.d.ts +20 -0
- package/dist/runtime/playwright-host-runtime-adapter.js +220 -0
- package/dist/runtime/runtime-isolation-lease.d.ts +67 -0
- package/dist/runtime/runtime-isolation-lease.js +158 -0
- package/dist/sandbox/preflight.d.ts +14 -0
- package/dist/sandbox/preflight.js +91 -12
- package/dist/sandbox/process.js +125 -40
- package/dist/sandbox/repository-lock.js +37 -1
- package/dist/sandbox/runtime.d.ts +66 -3
- package/dist/sandbox/runtime.js +670 -105
- package/dist/sandbox/sandbox.types.d.ts +3 -0
- package/dist/sandbox/smoke.d.ts +76 -0
- package/dist/sandbox/smoke.js +380 -0
- package/dist/sandbox/worker-supervisor.js +1 -1
- package/dist/sandbox/worker.js +2 -5
- package/dist/sandbox/workspace.service.d.ts +1 -0
- package/dist/sandbox/workspace.service.js +28 -5
- package/dist/session/managed-attempt-tools.d.ts +12 -0
- package/dist/session/managed-attempt-tools.js +350 -0
- package/dist/session/phase-completion.artifacts.js +9 -2
- package/dist/session/phase-completion.d.ts +4 -2
- package/dist/session/phase-completion.helpers.js +27 -3
- package/dist/session/phase-completion.js +12 -3
- package/dist/session/phase-completion.prompts.d.ts +3 -3
- package/dist/session/phase-completion.prompts.js +19 -5
- package/dist/session/phase-completion.runtime.d.ts +12 -1
- package/dist/session/phase-completion.runtime.js +127 -7
- package/dist/session/phase-completion.schemas.js +108 -3
- package/dist/session/phase-completion.validation.d.ts +4 -1
- package/dist/session/phase-completion.validation.js +106 -2
- package/dist/session/provider-cli/ci-repair-readiness.d.ts +8 -0
- package/dist/session/provider-cli/ci-repair-readiness.js +90 -0
- package/dist/session/provider-cli/provider-cli.artifacts.d.ts +1 -1
- package/dist/session/provider-cli/provider-cli.artifacts.js +28 -4
- package/dist/session/provider-cli/provider-cli.deterministic.js +47 -1
- package/dist/session/provider-cli/provider-cli.process.d.ts +16 -0
- package/dist/session/provider-cli/provider-cli.process.js +212 -25
- package/dist/session/provider-cli/provider-cli.prompts.d.ts +4 -1
- package/dist/session/provider-cli/provider-cli.prompts.js +84 -17
- package/dist/session/provider-cli/provider-cli.qa-sidecars.js +1 -0
- package/dist/session/provider-cli/provider-cli.runtime.d.ts +1 -1
- package/dist/session/provider-cli/provider-cli.runtime.js +3 -2
- package/dist/session/provider-cli/provider-cli.service.d.ts +3 -2
- package/dist/session/provider-cli/provider-cli.service.js +254 -71
- package/dist/session/provider-cli/provider-cli.types.d.ts +5 -0
- package/dist/session/provider-cli/provider-output-state.d.ts +2 -0
- package/dist/session/provider-cli/provider-output-state.js +30 -2
- package/dist/session/session-redaction.d.ts +3 -0
- package/dist/session/session-redaction.js +23 -0
- package/dist/session/session.base.d.ts +6 -1
- package/dist/session/session.service.d.ts +8 -2
- package/dist/session/session.service.js +436 -41
- package/dist/session/session.types.d.ts +55 -0
- package/dist/session/session.types.js +69 -2
- package/dist/shared/path/path.js +3 -1
- package/dist/shared/process/host-process-recovery.d.ts +12 -0
- package/dist/shared/process/host-process-recovery.js +78 -0
- package/dist/shared/process/host-process-supervisor.d.ts +57 -0
- package/dist/shared/process/host-process-supervisor.js +282 -0
- package/dist/shared/process/process.d.ts +1 -0
- package/dist/shared/process/process.js +1 -0
- package/dist/shared/redaction/redaction.js +6 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/worktree/artifact-injector.d.ts +3 -2
- package/dist/worktree/artifact-injector.js +43 -4
- package/dist/worktree/dependency-warmer.d.ts +10 -1
- package/dist/worktree/dependency-warmer.js +94 -5
- package/dist/worktree/index.d.ts +1 -0
- package/dist/worktree/index.js +1 -0
- package/dist/worktree/prior-phase-artifact-hydrator.d.ts +2 -0
- package/dist/worktree/prior-phase-artifact-hydrator.js +136 -0
- package/dist/worktree/worktree-paths.d.ts +4 -0
- package/dist/worktree/worktree-paths.js +30 -0
- package/dist/worktree/worktree.base.d.ts +3 -0
- package/dist/worktree/worktree.service.d.ts +7 -2
- package/dist/worktree/worktree.service.js +72 -44
- package/dist/worktree/worktree.types.d.ts +3 -1
- package/package.json +3 -2
- package/runtime/windows-job-supervisor.ps1 +356 -0
- package/runtime/windows-listener-owner.ps1 +33 -0
|
@@ -25,12 +25,16 @@ class CursorStreamJsonState {
|
|
|
25
25
|
finalMessage = null;
|
|
26
26
|
emittedSession = false;
|
|
27
27
|
accumulatedUsage = null;
|
|
28
|
+
activeToolCallCount = 0;
|
|
28
29
|
get sessionLabel() {
|
|
29
30
|
return this.sessionId ? `session ${this.sessionId}` : null;
|
|
30
31
|
}
|
|
31
32
|
get usage() {
|
|
32
33
|
return this.accumulatedUsage;
|
|
33
34
|
}
|
|
35
|
+
get hasActiveToolCall() {
|
|
36
|
+
return this.activeToolCallCount > 0;
|
|
37
|
+
}
|
|
34
38
|
consume(line) {
|
|
35
39
|
const event = parseJsonLine(line);
|
|
36
40
|
if (!event) {
|
|
@@ -65,6 +69,7 @@ class CursorStreamJsonState {
|
|
|
65
69
|
const subtype = stringField(event, "subtype");
|
|
66
70
|
const toolCall = objectField(event, "tool_call");
|
|
67
71
|
if (subtype === "started") {
|
|
72
|
+
this.activeToolCallCount += 1;
|
|
68
73
|
const summary = formatCursorToolCallStarted(toolCall);
|
|
69
74
|
if (summary) {
|
|
70
75
|
return [{
|
|
@@ -76,6 +81,7 @@ class CursorStreamJsonState {
|
|
|
76
81
|
}
|
|
77
82
|
}
|
|
78
83
|
if (subtype === "completed") {
|
|
84
|
+
this.activeToolCallCount = Math.max(0, this.activeToolCallCount - 1);
|
|
79
85
|
const completed = formatCursorToolCallCompleted(toolCall);
|
|
80
86
|
if (completed) {
|
|
81
87
|
return [{
|
|
@@ -224,18 +230,23 @@ class CodexJsonState {
|
|
|
224
230
|
finalMessage = null;
|
|
225
231
|
emittedThread = false;
|
|
226
232
|
accumulatedUsage = null;
|
|
233
|
+
activeToolCallCount = 0;
|
|
227
234
|
get sessionLabel() {
|
|
228
235
|
return this.threadId ? `thread ${this.threadId}` : null;
|
|
229
236
|
}
|
|
230
237
|
get usage() {
|
|
231
238
|
return this.accumulatedUsage;
|
|
232
239
|
}
|
|
240
|
+
get hasActiveToolCall() {
|
|
241
|
+
return this.activeToolCallCount > 0;
|
|
242
|
+
}
|
|
233
243
|
consume(line) {
|
|
234
244
|
const event = parseJsonLine(line);
|
|
235
245
|
if (!event) {
|
|
236
246
|
return [];
|
|
237
247
|
}
|
|
238
248
|
const type = stringField(event, "type") ?? "";
|
|
249
|
+
this.trackToolActivity(type, event);
|
|
239
250
|
if (type === "thread.started") {
|
|
240
251
|
this.threadId = stringField(event, "thread_id");
|
|
241
252
|
if (this.threadId && !this.emittedThread) {
|
|
@@ -265,7 +276,7 @@ class CodexJsonState {
|
|
|
265
276
|
eventType: "provider_cli_error"
|
|
266
277
|
}];
|
|
267
278
|
}
|
|
268
|
-
if (type === "item.completed" || type === "item.updated") {
|
|
279
|
+
if (type === "item.started" || type === "item.completed" || type === "item.updated") {
|
|
269
280
|
const item = objectField(event, "item");
|
|
270
281
|
const itemType = stringField(item, "type");
|
|
271
282
|
if (itemType === "agent_message") {
|
|
@@ -287,7 +298,7 @@ class CodexJsonState {
|
|
|
287
298
|
return [{
|
|
288
299
|
role: "worker",
|
|
289
300
|
kind: "checkpoint",
|
|
290
|
-
content: `Codex command ${status || "completed"}: ${clip(command, 500)}`,
|
|
301
|
+
content: `Codex command ${status || (type === "item.started" ? "started" : "completed")}: ${clip(command, 500)}`,
|
|
291
302
|
eventType: "provider_command"
|
|
292
303
|
}];
|
|
293
304
|
}
|
|
@@ -299,6 +310,23 @@ class CodexJsonState {
|
|
|
299
310
|
}
|
|
300
311
|
return [];
|
|
301
312
|
}
|
|
313
|
+
trackToolActivity(type, event) {
|
|
314
|
+
if (type !== "item.started" && type !== "item.completed") {
|
|
315
|
+
return;
|
|
316
|
+
}
|
|
317
|
+
const item = objectField(event, "item");
|
|
318
|
+
const itemType = (stringField(item, "type") ?? "").toLowerCase();
|
|
319
|
+
const toolName = mcpToolName(item);
|
|
320
|
+
const isTool = itemType === "command_execution"
|
|
321
|
+
|| itemType.includes("mcp")
|
|
322
|
+
|| Boolean(toolName);
|
|
323
|
+
if (!isTool) {
|
|
324
|
+
return;
|
|
325
|
+
}
|
|
326
|
+
this.activeToolCallCount = type === "item.started"
|
|
327
|
+
? this.activeToolCallCount + 1
|
|
328
|
+
: Math.max(0, this.activeToolCallCount - 1);
|
|
329
|
+
}
|
|
302
330
|
accumulateUsage(event) {
|
|
303
331
|
const usage = objectField(event, "usage");
|
|
304
332
|
if (Object.keys(usage).length === 0) {
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { RunOnceResultPacket, RunnerDispatchEvent } from "./session.types.js";
|
|
2
|
+
export declare function redactRunnerDispatchEvent(event: RunnerDispatchEvent, exactSecrets?: readonly string[]): RunnerDispatchEvent;
|
|
3
|
+
export declare function redactRunOnceResultPacket(result: RunOnceResultPacket, exactSecrets?: readonly string[]): RunOnceResultPacket;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { redactSecrets } from "../shared/redaction/redaction.js";
|
|
2
|
+
const integrityProtectedEventDataTypes = new Set(["sandbox_started"]);
|
|
3
|
+
export function redactRunnerDispatchEvent(event, exactSecrets = []) {
|
|
4
|
+
if (!event.data || !integrityProtectedEventDataTypes.has(event.eventType)) {
|
|
5
|
+
return redactSecrets(event, exactSecrets);
|
|
6
|
+
}
|
|
7
|
+
// sandbox_started data is runner-authored protocol metadata. Its runtime
|
|
8
|
+
// lease repeats the dispatch fence so the API can validate ownership. The
|
|
9
|
+
// transcript redactor treats any serialized `*Token` field as a secret and
|
|
10
|
+
// must not rewrite that identity before transport or result persistence.
|
|
11
|
+
const { data, ...transcript } = event;
|
|
12
|
+
return {
|
|
13
|
+
...redactSecrets(transcript, exactSecrets),
|
|
14
|
+
data,
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export function redactRunOnceResultPacket(result, exactSecrets = []) {
|
|
18
|
+
const { events, ...payload } = result;
|
|
19
|
+
return {
|
|
20
|
+
...redactSecrets(payload, exactSecrets),
|
|
21
|
+
events: events.map(event => redactRunnerDispatchEvent(event, exactSecrets)),
|
|
22
|
+
};
|
|
23
|
+
}
|
|
@@ -1,7 +1,12 @@
|
|
|
1
|
-
import type { RunOnceDispatchPacket, RunOnceResultPacket, RunnerDispatchEvent } from "./session.types.js";
|
|
1
|
+
import type { HostRuntimeReadinessProbeRequest, HostRuntimeReadinessProbeResult, RunOnceDispatchPacket, RunOnceResultPacket, RunnerDispatchEvent } from "./session.types.js";
|
|
2
|
+
import type { HostRuntimeCapacitySnapshot, HostRuntimeReapOptions, HostRuntimeReapReport } from "../runtime/host-runtime-lease.js";
|
|
2
3
|
export interface SessionEventSink {
|
|
3
4
|
emit(event: RunnerDispatchEvent): Promise<void>;
|
|
4
5
|
}
|
|
5
6
|
export interface SessionService {
|
|
6
7
|
runOnce(dispatch: RunOnceDispatchPacket, sink: SessionEventSink, signal?: AbortSignal): Promise<RunOnceResultPacket>;
|
|
8
|
+
updateLease?(dispatchAttemptId: string, fencingToken: string, expiresAt: string): Promise<void>;
|
|
9
|
+
reapHostRuntime?(options: HostRuntimeReapOptions): Promise<HostRuntimeReapReport | null>;
|
|
10
|
+
runtimeCapacity?(): HostRuntimeCapacitySnapshot | null;
|
|
11
|
+
probeHostRuntime?(request: HostRuntimeReadinessProbeRequest, signal?: AbortSignal): Promise<HostRuntimeReadinessProbeResult>;
|
|
7
12
|
}
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import type { ProviderCliService } from "./provider-cli/provider-cli.base.js";
|
|
2
2
|
import type { SessionEventSink, SessionService } from "./session.base.js";
|
|
3
|
-
import type { RunOnceDispatchPacket, RunOnceResultPacket } from "./session.types.js";
|
|
3
|
+
import type { HostRuntimeReadinessProbeRequest, HostRuntimeReadinessProbeResult, RunOnceDispatchPacket, RunOnceResultPacket } from "./session.types.js";
|
|
4
4
|
import type { WorktreeService } from "../worktree/worktree.base.js";
|
|
5
|
+
import { type HostRuntimeCapacitySnapshot, type HostRuntimeLeaseRuntime, type HostRuntimeReapOptions, type HostRuntimeReapReport } from "../runtime/host-runtime-lease.js";
|
|
5
6
|
export declare class BridgeSessionService implements SessionService {
|
|
6
7
|
private readonly worktrees;
|
|
7
8
|
private readonly providerCli;
|
|
8
|
-
|
|
9
|
+
private readonly hostRuntime?;
|
|
10
|
+
constructor(worktrees?: WorktreeService, providerCli?: ProviderCliService, hostRuntime?: HostRuntimeLeaseRuntime | undefined);
|
|
11
|
+
updateLease(dispatchAttemptId: string, fencingToken: string, expiresAt: string): Promise<void>;
|
|
12
|
+
reapHostRuntime(options: HostRuntimeReapOptions): Promise<HostRuntimeReapReport | null>;
|
|
13
|
+
runtimeCapacity(): HostRuntimeCapacitySnapshot | null;
|
|
14
|
+
probeHostRuntime(request: HostRuntimeReadinessProbeRequest, signal?: AbortSignal): Promise<HostRuntimeReadinessProbeResult>;
|
|
9
15
|
runOnce(dispatch: RunOnceDispatchPacket, sink: SessionEventSink, signal?: AbortSignal): Promise<RunOnceResultPacket>;
|
|
10
16
|
}
|