@loucompanion/forge-bridge 0.1.4-dev.c2f22d1dd395 → 0.1.4-dev.fb770705136a
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/session/provider-cli/provider-cli.artifacts.d.ts +2 -1
- package/dist/session/provider-cli/provider-cli.artifacts.js +20 -7
- package/dist/session/provider-cli/provider-cli.merge-integrity.d.ts +89 -0
- package/dist/session/provider-cli/provider-cli.merge-integrity.js +310 -0
- package/dist/session/provider-cli/provider-cli.process.d.ts +32 -1
- package/dist/session/provider-cli/provider-cli.process.js +120 -28
- package/dist/session/provider-cli/provider-cli.prompts.d.ts +5 -0
- package/dist/session/provider-cli/provider-cli.prompts.js +15 -0
- package/dist/session/provider-cli/provider-cli.service.js +51 -12
- package/dist/session/provider-cli/provider-in-flight-work.d.ts +6 -0
- package/dist/session/provider-cli/provider-in-flight-work.js +47 -0
- package/dist/session/provider-cli/provider-output-state.d.ts +6 -0
- package/dist/session/provider-cli/provider-output-state.js +9 -0
- package/dist/session/publishable-worktree-changes.d.ts +10 -1
- package/dist/session/publishable-worktree-changes.js +21 -5
- package/dist/session/session.types.js +9 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
|
@@ -9,6 +9,12 @@ export interface ProviderOutputState {
|
|
|
9
9
|
finalMessage: string | null;
|
|
10
10
|
/** True only while the provider has reported a tool/command start without a matching completion. */
|
|
11
11
|
readonly hasActiveToolCall: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Forgets tool calls a previous provider generation started but never completed. A
|
|
14
|
+
* generation that exits mid-call reports no completion, and the next generation must not
|
|
15
|
+
* inherit that call as still in flight.
|
|
16
|
+
*/
|
|
17
|
+
resetActiveToolCalls(): void;
|
|
12
18
|
/** Accumulated provider-reported token usage for this run, or null when none was reported. */
|
|
13
19
|
readonly usage: ProviderUsage | null;
|
|
14
20
|
consume(line: string): readonly RunnerDispatchEvent[];
|
|
@@ -43,6 +43,9 @@ class CursorStreamJsonState {
|
|
|
43
43
|
get hasActiveToolCall() {
|
|
44
44
|
return this.activeToolCallCount > 0;
|
|
45
45
|
}
|
|
46
|
+
resetActiveToolCalls() {
|
|
47
|
+
this.activeToolCallCount = 0;
|
|
48
|
+
}
|
|
46
49
|
consume(line) {
|
|
47
50
|
const event = parseJsonLine(line);
|
|
48
51
|
if (!event) {
|
|
@@ -264,6 +267,9 @@ class ClaudeStreamJsonState {
|
|
|
264
267
|
get hasActiveToolCall() {
|
|
265
268
|
return this.activeToolUses.size > 0;
|
|
266
269
|
}
|
|
270
|
+
resetActiveToolCalls() {
|
|
271
|
+
this.activeToolUses.clear();
|
|
272
|
+
}
|
|
267
273
|
consume(line) {
|
|
268
274
|
const event = parseJsonLine(line);
|
|
269
275
|
if (!event) {
|
|
@@ -544,6 +550,9 @@ class CodexJsonState {
|
|
|
544
550
|
get hasActiveToolCall() {
|
|
545
551
|
return this.activeToolCallCount > 0;
|
|
546
552
|
}
|
|
553
|
+
resetActiveToolCalls() {
|
|
554
|
+
this.activeToolCallCount = 0;
|
|
555
|
+
}
|
|
547
556
|
consume(line) {
|
|
548
557
|
const event = parseJsonLine(line);
|
|
549
558
|
if (!event) {
|
|
@@ -16,7 +16,16 @@ export interface PublishableWorktreeChangeSet {
|
|
|
16
16
|
* `.forge/` file that differs from HEAD is an author edit and must be published.
|
|
17
17
|
*/
|
|
18
18
|
export declare function isNonPublishableWorktreeChange(relativePath: string, status: string): boolean;
|
|
19
|
-
/**
|
|
19
|
+
/** `.local/`, `.forge/work-items/` and `.forge/stories/`: never published, even during a merge. */
|
|
20
|
+
export declare function isRuntimeOnlyPath(relativePath: string): boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Stages every publishable worktree change in the real index and returns both sets.
|
|
23
|
+
*
|
|
24
|
+
* During an in-progress merge it first refuses unresolved conflicts, and afterwards
|
|
25
|
+
* restores merge-owned paths that the exclusion unstaged back to HEAD (the story side),
|
|
26
|
+
* such as `.forge/` files the target branch added (#491). Runtime-only paths are never
|
|
27
|
+
* restored.
|
|
28
|
+
*/
|
|
20
29
|
export declare function stagePublishableWorktreeChangeSet(git: Pick<GitClient, "run">, worktreePath: string): Promise<PublishableWorktreeChangeSet>;
|
|
21
30
|
/**
|
|
22
31
|
* Computes the same change set as {@link stagePublishableWorktreeChangeSet} without
|
|
@@ -3,6 +3,7 @@ import os from "node:os";
|
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { GitClient } from "../shared/git/git.js";
|
|
5
5
|
import { NodeProcessRunner } from "../shared/process/process.js";
|
|
6
|
+
import { assertNoUnresolvedMergeConflicts, restoreMergeOwnedPaths } from "./provider-cli/provider-cli.merge-integrity.js";
|
|
6
7
|
/**
|
|
7
8
|
* Forge runtime output that is never published, whether or not the target repository
|
|
8
9
|
* tracks other `.forge/` content. Completion artifacts and evidence live here.
|
|
@@ -20,7 +21,7 @@ const resetBatchSize = 200;
|
|
|
20
21
|
*/
|
|
21
22
|
export function isNonPublishableWorktreeChange(relativePath, status) {
|
|
22
23
|
const normalized = relativePath.trim().replaceAll("\\", "/");
|
|
23
|
-
if (
|
|
24
|
+
if (isRuntimeOnlyPath(normalized)) {
|
|
24
25
|
return true;
|
|
25
26
|
}
|
|
26
27
|
if (normalized === ".forge" || normalized.startsWith(".forge/")) {
|
|
@@ -28,16 +29,31 @@ export function isNonPublishableWorktreeChange(relativePath, status) {
|
|
|
28
29
|
}
|
|
29
30
|
return false;
|
|
30
31
|
}
|
|
31
|
-
/**
|
|
32
|
+
/** `.local/`, `.forge/work-items/` and `.forge/stories/`: never published, even during a merge. */
|
|
33
|
+
export function isRuntimeOnlyPath(relativePath) {
|
|
34
|
+
const normalizedPath = normalizeChangedFilePath(relativePath);
|
|
35
|
+
return normalizedPath === ".local" || runtimeOnlyPathPrefixes.some(prefix => normalizedPath.startsWith(prefix));
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Stages every publishable worktree change in the real index and returns both sets.
|
|
39
|
+
*
|
|
40
|
+
* During an in-progress merge it first refuses unresolved conflicts, and afterwards
|
|
41
|
+
* restores merge-owned paths that the exclusion unstaged back to HEAD (the story side),
|
|
42
|
+
* such as `.forge/` files the target branch added (#491). Runtime-only paths are never
|
|
43
|
+
* restored.
|
|
44
|
+
*/
|
|
32
45
|
export async function stagePublishableWorktreeChangeSet(git, worktreePath) {
|
|
46
|
+
await assertNoUnresolvedMergeConflicts(git, worktreePath);
|
|
33
47
|
await git.run(worktreePath, ["add", "-A"]);
|
|
34
|
-
const
|
|
48
|
+
const excludedChanges = (await readStagedChanges(git, worktreePath))
|
|
35
49
|
.filter(change => isNonPublishableWorktreeChange(change.path, change.status))
|
|
36
50
|
.map(change => change.path);
|
|
37
|
-
for (let index = 0; index <
|
|
38
|
-
const batch =
|
|
51
|
+
for (let index = 0; index < excludedChanges.length; index += resetBatchSize) {
|
|
52
|
+
const batch = excludedChanges.slice(index, index + resetBatchSize).map(filePath => `:(literal)${filePath}`);
|
|
39
53
|
await git.run(worktreePath, ["reset", "-q", "--", ...batch]);
|
|
40
54
|
}
|
|
55
|
+
const restored = new Set(await restoreMergeOwnedPaths(git, worktreePath, excludedChanges.filter(filePath => !isRuntimeOnlyPath(filePath))));
|
|
56
|
+
const excluded = excludedChanges.filter(filePath => !restored.has(filePath));
|
|
41
57
|
const publishable = (await git.run(worktreePath, ["diff", "--cached", "--name-only"]))
|
|
42
58
|
.split(/\r?\n/)
|
|
43
59
|
.map(line => line.trim())
|
|
@@ -522,6 +522,12 @@ function unvalidatedFailureFactsForCode(code, source) {
|
|
|
522
522
|
if (code === "provider_capacity_unavailable") {
|
|
523
523
|
return facts(code, "resource", "offer", source, "retryable", "retry_dispatch");
|
|
524
524
|
}
|
|
525
|
+
if (code === "provider_completion_tool_missing") {
|
|
526
|
+
return facts(code, "provider", "agent", source, "non_retryable", "inspect_failure");
|
|
527
|
+
}
|
|
528
|
+
if (code === "provider_terminated_at_turn_ceiling") {
|
|
529
|
+
return facts(code, "provider", "agent", source, "retryable", "retry_with_policy");
|
|
530
|
+
}
|
|
525
531
|
if (code === "provider_context_window_exhausted") {
|
|
526
532
|
return facts(code, "provider", "agent", source, "retryable", "retry_dispatch");
|
|
527
533
|
}
|
|
@@ -566,6 +572,9 @@ function unvalidatedFailureFactsForCode(code, source) {
|
|
|
566
572
|
if (code === "worktree_branch_integration_conflict") {
|
|
567
573
|
return facts(code, "domain", "agent", source, "non_retryable", "fix_input");
|
|
568
574
|
}
|
|
575
|
+
if (["merge_resolution_reverts_upstream_changes", "merge_resolution_unresolved_conflict"].includes(code)) {
|
|
576
|
+
return facts(code, "domain", "validation", source, "non_retryable", "inspect_failure");
|
|
577
|
+
}
|
|
569
578
|
if (stableFailureFamilyCodes.has(code) && code.startsWith("sandbox_")) {
|
|
570
579
|
return facts(code, "provider", "agent", source, "non_retryable", "inspect_failure");
|
|
571
580
|
}
|
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.fb770705136a";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const forgeBridgeVersion = "0.1.4-dev.
|
|
1
|
+
export const forgeBridgeVersion = "0.1.4-dev.fb770705136a";
|
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.fb770705136a",
|
|
4
4
|
"description": "Forge runner bridge CLI for connecting local developer machines to Forge dispatch.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"type": "module",
|