@loucompanion/forge-bridge 0.1.1-dev.af36c7fa102b → 0.1.1-dev.e52b249f07a8
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/bridge/bridge.service.js +29 -1
- package/dist/bridge/bridge.types.d.ts +9 -0
- package/dist/cli/cli.service.js +7 -0
- package/dist/cli/local-config.js +18 -1
- package/dist/session/phase-completion.d.ts +37 -1
- package/dist/session/phase-completion.js +1013 -83
- package/dist/session/provider-cli/provider-cli.base.d.ts +1 -2
- package/dist/session/provider-cli/provider-cli.service.d.ts +5 -4
- package/dist/session/provider-cli/provider-cli.service.js +1075 -116
- package/dist/session/provider-cli/provider-cli.types.d.ts +1 -0
- package/dist/session/provider-cli/provider-usage.d.ts +25 -0
- package/dist/session/provider-cli/provider-usage.js +64 -0
- package/dist/session/qa-sidecar-validation.d.ts +3 -0
- package/dist/session/qa-sidecar-validation.js +44 -0
- package/dist/session/session.service.js +12 -14
- package/dist/session/session.types.d.ts +38 -0
- package/dist/session/session.types.js +96 -2
- package/dist/shared/cursor-agent/cursor-agent.launch.d.ts +9 -0
- package/dist/shared/cursor-agent/cursor-agent.launch.js +66 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/worktree/artifact-injector.js +1 -4
- package/package.json +1 -1
|
@@ -123,6 +123,7 @@ export class ForgeBridgeService {
|
|
|
123
123
|
const mapping = findRepoMapping(dispatch, this.config.repoMappings);
|
|
124
124
|
const localPath = mapping?.localPath?.trim();
|
|
125
125
|
const repoRoot = localPath ? path.dirname(path.resolve(localPath)) : this.config.defaultRepoRoot;
|
|
126
|
+
const qaLaunchTarget = normalizeQaAppLaunchTarget(mapping?.qaAppLaunchTarget) ?? dispatch.qaBrowser?.launchTarget ?? null;
|
|
126
127
|
return {
|
|
127
128
|
...dispatch,
|
|
128
129
|
repo: {
|
|
@@ -133,7 +134,13 @@ export class ForgeBridgeService {
|
|
|
133
134
|
serverLocal: {
|
|
134
135
|
repoRoot,
|
|
135
136
|
cleanupWorktrees: this.config.cleanupWorktrees
|
|
136
|
-
}
|
|
137
|
+
},
|
|
138
|
+
qaBrowser: dispatch.qaBrowser
|
|
139
|
+
? {
|
|
140
|
+
...dispatch.qaBrowser,
|
|
141
|
+
launchTarget: qaLaunchTarget
|
|
142
|
+
}
|
|
143
|
+
: dispatch.qaBrowser
|
|
137
144
|
};
|
|
138
145
|
}
|
|
139
146
|
async sendResult(leaseId, fencingToken, result) {
|
|
@@ -323,6 +330,27 @@ function findRepoMapping(dispatch, mappings) {
|
|
|
323
330
|
(!!mapping.remoteUrl?.trim() && equalsIgnoreCase(mapping.remoteUrl, dispatch.repo.remoteUrl)));
|
|
324
331
|
});
|
|
325
332
|
}
|
|
333
|
+
function normalizeQaAppLaunchTarget(target) {
|
|
334
|
+
if (!target) {
|
|
335
|
+
return null;
|
|
336
|
+
}
|
|
337
|
+
const routes = [...new Set((target.routes ?? []).map((route) => route.trim()).filter(Boolean))];
|
|
338
|
+
const normalized = {
|
|
339
|
+
url: cleanString(target.url),
|
|
340
|
+
command: cleanString(target.command),
|
|
341
|
+
working_directory: cleanString(target.working_directory),
|
|
342
|
+
ready_url: cleanString(target.ready_url),
|
|
343
|
+
routes,
|
|
344
|
+
notes: cleanString(target.notes)
|
|
345
|
+
};
|
|
346
|
+
return normalized.url || normalized.command || normalized.ready_url || routes.length > 0
|
|
347
|
+
? normalized
|
|
348
|
+
: null;
|
|
349
|
+
}
|
|
350
|
+
function cleanString(value) {
|
|
351
|
+
const clean = value?.trim();
|
|
352
|
+
return clean ? clean : null;
|
|
353
|
+
}
|
|
326
354
|
function equalsIgnoreCase(left, right) {
|
|
327
355
|
return !!left?.trim() && !!right?.trim() && left.trim().toLowerCase() === right.trim().toLowerCase();
|
|
328
356
|
}
|
|
@@ -27,6 +27,15 @@ export interface BridgeRepoMapping {
|
|
|
27
27
|
readonly name?: string | null;
|
|
28
28
|
readonly remoteUrl?: string | null;
|
|
29
29
|
readonly localPath?: string | null;
|
|
30
|
+
readonly qaAppLaunchTarget?: QaAppLaunchTarget | null;
|
|
31
|
+
}
|
|
32
|
+
export interface QaAppLaunchTarget {
|
|
33
|
+
readonly url?: string | null;
|
|
34
|
+
readonly command?: string | null;
|
|
35
|
+
readonly working_directory?: string | null;
|
|
36
|
+
readonly ready_url?: string | null;
|
|
37
|
+
readonly routes?: readonly string[] | null;
|
|
38
|
+
readonly notes?: string | null;
|
|
30
39
|
}
|
|
31
40
|
export interface BridgeProviderStatus {
|
|
32
41
|
readonly signedIn?: boolean | null;
|
package/dist/cli/cli.service.js
CHANGED
|
@@ -4,6 +4,7 @@ import os from "node:os";
|
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import { createInterface } from "node:readline/promises";
|
|
6
6
|
import { promisify } from "node:util";
|
|
7
|
+
import { resolveCursorAgentDirectLaunch } from "../shared/cursor-agent/cursor-agent.launch.js";
|
|
7
8
|
import { redactSecrets, redactText } from "../shared/redaction/redaction.js";
|
|
8
9
|
import { defaultBridgeServiceConfig, ForgeBridgeService } from "../bridge/bridge.service.js";
|
|
9
10
|
import { addRepoMapping, applyLocalConfigDefaults, providerStatusesFor, readLocalConfigSync, removeRepoMapping, resolveLocalConfigPath, writeLocalConfig } from "./local-config.js";
|
|
@@ -633,6 +634,12 @@ function cliProbeCommandsFor(provider) {
|
|
|
633
634
|
];
|
|
634
635
|
}
|
|
635
636
|
async function execVersionCommand(probe, timeout = 2000) {
|
|
637
|
+
const directLaunch = process.platform === "win32"
|
|
638
|
+
? await resolveCursorAgentDirectLaunch(probe.command, probe.args)
|
|
639
|
+
: null;
|
|
640
|
+
if (directLaunch) {
|
|
641
|
+
return await execFileAsync(directLaunch.command, [...directLaunch.args], { timeout });
|
|
642
|
+
}
|
|
636
643
|
try {
|
|
637
644
|
return await execFileAsync(probe.command, probe.args, { timeout });
|
|
638
645
|
}
|
package/dist/cli/local-config.js
CHANGED
|
@@ -159,7 +159,8 @@ function normalizeRepoMappings(values) {
|
|
|
159
159
|
repoId: cleanString(mapping.repoId),
|
|
160
160
|
name: cleanString(mapping.name) ?? label,
|
|
161
161
|
remoteUrl: cleanString(mapping.remoteUrl),
|
|
162
|
-
localPath: path.resolve(mapping.localPath)
|
|
162
|
+
localPath: path.resolve(mapping.localPath),
|
|
163
|
+
qaAppLaunchTarget: normalizeQaAppLaunchTarget(mapping.qaAppLaunchTarget)
|
|
163
164
|
};
|
|
164
165
|
})
|
|
165
166
|
.sort((left, right) => left.label.localeCompare(right.label));
|
|
@@ -171,6 +172,22 @@ function normalizeLabel(value) {
|
|
|
171
172
|
}
|
|
172
173
|
return label;
|
|
173
174
|
}
|
|
175
|
+
function normalizeQaAppLaunchTarget(value) {
|
|
176
|
+
if (!value)
|
|
177
|
+
return undefined;
|
|
178
|
+
const routes = cleanList(value.routes);
|
|
179
|
+
const normalized = {
|
|
180
|
+
url: cleanString(value.url),
|
|
181
|
+
command: cleanString(value.command),
|
|
182
|
+
working_directory: cleanString(value.working_directory),
|
|
183
|
+
ready_url: cleanString(value.ready_url),
|
|
184
|
+
routes,
|
|
185
|
+
notes: cleanString(value.notes)
|
|
186
|
+
};
|
|
187
|
+
return normalized.url || normalized.command || normalized.ready_url || routes?.length
|
|
188
|
+
? normalized
|
|
189
|
+
: undefined;
|
|
190
|
+
}
|
|
174
191
|
function cleanString(value) {
|
|
175
192
|
const clean = value?.trim();
|
|
176
193
|
return clean ? clean : undefined;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { RunOnceDispatchPacket, RunnerDispatchArtifact } from "./session.types.js";
|
|
2
2
|
import type { WorktreeHandle } from "../worktree/worktree.types.js";
|
|
3
|
-
export type CompletionPhase = "implementation" | "self_review" | "validation";
|
|
3
|
+
export type CompletionPhase = "implementation" | "self_review" | "validation" | "qa";
|
|
4
4
|
export interface CompletionToolRuntime {
|
|
5
5
|
readonly serverName: string;
|
|
6
6
|
readonly command: string;
|
|
@@ -17,12 +17,34 @@ export interface CompletionToolRuntimeOptions {
|
|
|
17
17
|
export interface CompletionToolServerConfig {
|
|
18
18
|
readonly worktreePath: string;
|
|
19
19
|
readonly workItemId: string;
|
|
20
|
+
readonly ownerType?: string;
|
|
21
|
+
readonly ownerId?: string;
|
|
20
22
|
readonly phase: CompletionPhase;
|
|
21
23
|
readonly producedBy?: string;
|
|
24
|
+
readonly redactionSecrets?: readonly string[];
|
|
25
|
+
readonly developCycle?: boolean;
|
|
26
|
+
}
|
|
27
|
+
export interface CompletionToolCallResult {
|
|
28
|
+
readonly content: readonly {
|
|
29
|
+
readonly type: "text";
|
|
30
|
+
readonly text: string;
|
|
31
|
+
}[];
|
|
32
|
+
readonly structuredContent: CompletionArtifactReference & {
|
|
33
|
+
readonly gate: {
|
|
34
|
+
readonly phase: CompletionPhase;
|
|
35
|
+
readonly status: string;
|
|
36
|
+
readonly allowed: boolean;
|
|
37
|
+
readonly reason: string;
|
|
38
|
+
};
|
|
39
|
+
readonly nextPhase: CompletionPhase | "dev_test_ready" | "sign_off_ready";
|
|
40
|
+
readonly nextInstruction: string;
|
|
41
|
+
};
|
|
22
42
|
}
|
|
23
43
|
export interface CompletionArtifactReference {
|
|
24
44
|
readonly phase: CompletionPhase;
|
|
25
45
|
readonly workItemId: string;
|
|
46
|
+
readonly ownerType?: string;
|
|
47
|
+
readonly ownerId?: string;
|
|
26
48
|
readonly repoPath: string;
|
|
27
49
|
readonly path: string;
|
|
28
50
|
readonly reportPath: string;
|
|
@@ -32,6 +54,7 @@ export interface CompletionArtifactReference {
|
|
|
32
54
|
}
|
|
33
55
|
export declare function completionPhaseFromDispatch(dispatch: RunOnceDispatchPacket): CompletionPhase;
|
|
34
56
|
export declare function normalizeCompletionPhase(value: string | null | undefined): CompletionPhase;
|
|
57
|
+
export declare function usesDevelopCycleCompletion(dispatch: RunOnceDispatchPacket): boolean;
|
|
35
58
|
export declare function completionToolNamesForPhase(phase: CompletionPhase): readonly string[];
|
|
36
59
|
export declare function expectedCompletionToolName(phase: CompletionPhase): string;
|
|
37
60
|
export declare function artifactRootFor(worktreePath: string, workItemId: string): string;
|
|
@@ -42,6 +65,18 @@ export declare function buildCompletionToolServerArgs(config: CompletionToolServ
|
|
|
42
65
|
export declare function codexMcpConfigArgs(runtime: CompletionToolRuntime): readonly string[];
|
|
43
66
|
export declare function cursorMcpServerConfig(runtime: CompletionToolRuntime): unknown;
|
|
44
67
|
export declare function completionPromptForPhase(phase: CompletionPhase): string;
|
|
68
|
+
export declare function completionPromptForDevelopCycle(phase: CompletionPhase): string;
|
|
69
|
+
export declare function completionToolNamesForServer(config: CompletionToolServerConfig): readonly string[];
|
|
70
|
+
export declare class CompletionToolServerSession {
|
|
71
|
+
private readonly config;
|
|
72
|
+
private currentPhase;
|
|
73
|
+
private completed;
|
|
74
|
+
constructor(config: CompletionToolServerConfig);
|
|
75
|
+
get instructions(): string;
|
|
76
|
+
toolDefinitions(): readonly unknown[];
|
|
77
|
+
callTool(toolName: string, input: unknown): Promise<CompletionToolCallResult>;
|
|
78
|
+
private advanceAfterPass;
|
|
79
|
+
}
|
|
45
80
|
export declare function writeCompletionArtifact(config: CompletionToolServerConfig, toolName: string, input: unknown): Promise<CompletionArtifactReference>;
|
|
46
81
|
export declare function readCompletionArtifact(worktreePath: string, workItemId: string, phase: CompletionPhase): Promise<RunnerDispatchArtifact | null>;
|
|
47
82
|
export declare function runCompletionMcpServer(config: CompletionToolServerConfig): Promise<void>;
|
|
@@ -52,3 +87,4 @@ export declare function parseCompletionMcpArgs(argv: readonly string[]): {
|
|
|
52
87
|
readonly ok: false;
|
|
53
88
|
readonly error: string;
|
|
54
89
|
};
|
|
90
|
+
export declare function completionRedactionEnv(secrets: readonly string[]): Readonly<Record<string, string>>;
|