@loucompanion/forge-bridge 0.1.3-dev.bd0c67bbf352 → 0.1.3-dev.bf78fdcaa623
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 +44 -0
- package/dist/bridge/bridge.base.d.ts +5 -1
- package/dist/bridge/bridge.service.d.ts +36 -2
- package/dist/bridge/bridge.service.js +588 -18
- package/dist/bridge/bridge.types.d.ts +114 -1
- package/dist/cli/cli.help.d.ts +2 -0
- package/dist/cli/cli.help.js +183 -0
- package/dist/cli/cli.service.d.ts +12 -0
- package/dist/cli/cli.service.js +176 -184
- package/dist/cli/local-config.d.ts +2 -0
- package/dist/cli/local-config.js +6 -2
- package/dist/sandbox/command-runner.d.ts +4 -0
- package/dist/sandbox/command-runner.js +47 -0
- package/dist/sandbox/contract.d.ts +5 -0
- package/dist/sandbox/contract.js +276 -0
- package/dist/sandbox/event-budget.d.ts +11 -0
- package/dist/sandbox/event-budget.js +27 -0
- package/dist/sandbox/image-policy.d.ts +33 -0
- package/dist/sandbox/image-policy.js +245 -0
- package/dist/sandbox/index.d.ts +5 -0
- package/dist/sandbox/index.js +5 -0
- package/dist/sandbox/lease-watchdog.d.ts +18 -0
- package/dist/sandbox/lease-watchdog.js +67 -0
- package/dist/sandbox/preflight.d.ts +36 -0
- package/dist/sandbox/preflight.js +239 -0
- package/dist/sandbox/process.d.ts +20 -0
- package/dist/sandbox/process.js +124 -0
- package/dist/sandbox/provider-auth/codex.d.ts +26 -0
- package/dist/sandbox/provider-auth/codex.js +212 -0
- package/dist/sandbox/repository-lock.d.ts +5 -0
- package/dist/sandbox/repository-lock.js +83 -0
- package/dist/sandbox/runtime.d.ts +216 -0
- package/dist/sandbox/runtime.js +1658 -0
- package/dist/sandbox/sandbox.types.d.ts +83 -0
- package/dist/sandbox/sandbox.types.js +1 -0
- package/dist/sandbox/worker-supervisor.d.ts +13 -0
- package/dist/sandbox/worker-supervisor.js +36 -0
- package/dist/sandbox/worker.d.ts +1 -0
- package/dist/sandbox/worker.js +228 -0
- package/dist/sandbox/workspace.service.d.ts +12 -0
- package/dist/sandbox/workspace.service.js +49 -0
- package/dist/session/phase-completion.artifacts.d.ts +10 -0
- package/dist/session/phase-completion.artifacts.js +620 -0
- package/dist/session/phase-completion.d.ts +32 -44
- package/dist/session/phase-completion.helpers.d.ts +112 -0
- package/dist/session/phase-completion.helpers.js +660 -0
- package/dist/session/phase-completion.js +28 -3501
- package/dist/session/phase-completion.prompts.d.ts +14 -0
- package/dist/session/phase-completion.prompts.js +220 -0
- package/dist/session/phase-completion.runtime.d.ts +36 -0
- package/dist/session/phase-completion.runtime.js +609 -0
- package/dist/session/phase-completion.schemas.d.ts +3 -0
- package/dist/session/phase-completion.schemas.js +707 -0
- package/dist/session/phase-completion.validation.d.ts +34 -0
- package/dist/session/phase-completion.validation.js +724 -0
- package/dist/session/provider-cli/provider-cli.artifacts.d.ts +93 -0
- package/dist/session/provider-cli/provider-cli.artifacts.js +754 -0
- package/dist/session/provider-cli/provider-cli.base.d.ts +1 -0
- package/dist/session/provider-cli/provider-cli.deterministic-payloads.d.ts +12 -0
- package/dist/session/provider-cli/provider-cli.deterministic-payloads.js +279 -0
- package/dist/session/provider-cli/provider-cli.deterministic.d.ts +14 -0
- package/dist/session/provider-cli/provider-cli.deterministic.js +329 -0
- package/dist/session/provider-cli/provider-cli.process.d.ts +32 -0
- package/dist/session/provider-cli/provider-cli.process.js +287 -0
- package/dist/session/provider-cli/provider-cli.prompts.d.ts +44 -0
- package/dist/session/provider-cli/provider-cli.prompts.js +528 -0
- package/dist/session/provider-cli/provider-cli.qa-sidecars.d.ts +11 -0
- package/dist/session/provider-cli/provider-cli.qa-sidecars.js +65 -0
- package/dist/session/provider-cli/provider-cli.runtime.d.ts +9 -0
- package/dist/session/provider-cli/provider-cli.runtime.js +40 -0
- package/dist/session/provider-cli/provider-cli.service.d.ts +9 -53
- package/dist/session/provider-cli/provider-cli.service.js +161 -2561
- package/dist/session/provider-cli/provider-cli.types.d.ts +1 -0
- package/dist/session/provider-cli/provider-output-state.d.ts +20 -0
- package/dist/session/provider-cli/provider-output-state.js +445 -0
- package/dist/session/session.service.js +34 -24
- package/dist/session/session.types.d.ts +89 -1
- package/dist/session/session.types.js +209 -3
- package/dist/shared/process/windows-launch.d.ts +8 -0
- package/dist/shared/process/windows-launch.js +41 -0
- package/dist/shared/provider-capabilities.d.ts +1 -0
- package/dist/shared/provider-capabilities.js +3 -0
- package/dist/shared/redaction/redaction.js +4 -2
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/worktree/dependency-warmer.d.ts +11 -0
- package/dist/worktree/dependency-warmer.js +45 -1
- package/package.json +4 -2
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { type LaunchCommand } from "../../shared/process/windows-launch.js";
|
|
2
|
+
export type ProviderCliCommand = LaunchCommand;
|
|
3
|
+
export interface ProviderProcessRunRequest {
|
|
4
|
+
readonly command: string;
|
|
5
|
+
readonly args: readonly string[];
|
|
6
|
+
readonly cwd: string;
|
|
7
|
+
readonly env?: Readonly<Record<string, string>>;
|
|
8
|
+
readonly stdin?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface ProviderProcessRunResult {
|
|
11
|
+
readonly exitCode: number;
|
|
12
|
+
readonly stdout: string;
|
|
13
|
+
readonly stderr: string;
|
|
14
|
+
}
|
|
15
|
+
export interface ProviderProcessRunner {
|
|
16
|
+
run(request: ProviderProcessRunRequest, handlers?: ProviderProcessHandlers, signal?: AbortSignal): Promise<ProviderProcessRunResult>;
|
|
17
|
+
}
|
|
18
|
+
export interface ProviderProcessHandlers {
|
|
19
|
+
onStdoutLine?(line: string): Promise<void> | void;
|
|
20
|
+
onStderrLine?(line: string): Promise<void> | void;
|
|
21
|
+
}
|
|
22
|
+
interface ProviderChildEnvironmentOptions {
|
|
23
|
+
readonly parentEnv?: NodeJS.ProcessEnv;
|
|
24
|
+
readonly platform?: NodeJS.Platform;
|
|
25
|
+
readonly homeDir?: string;
|
|
26
|
+
}
|
|
27
|
+
export declare function buildProviderChildEnvironment(requestEnv?: Readonly<Record<string, string>>, options?: ProviderChildEnvironmentOptions): NodeJS.ProcessEnv;
|
|
28
|
+
export declare class StreamingProviderProcessRunner implements ProviderProcessRunner {
|
|
29
|
+
run(request: ProviderProcessRunRequest, handlers?: ProviderProcessHandlers, signal?: AbortSignal): Promise<ProviderProcessRunResult>;
|
|
30
|
+
}
|
|
31
|
+
export declare function chooseWindowsCommandCandidate(candidates: readonly string[]): string | null;
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
import { execFile, spawn } from "node:child_process";
|
|
2
|
+
import os from "node:os";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import readline from "node:readline";
|
|
5
|
+
import { promisify } from "node:util";
|
|
6
|
+
import { resolveCursorAgentDirectLaunch } from "../../shared/cursor-agent/cursor-agent.launch.js";
|
|
7
|
+
import { buildWindowsLaunchCommand } from "../../shared/process/windows-launch.js";
|
|
8
|
+
const execFileAsync = promisify(execFile);
|
|
9
|
+
const allowedProviderParentEnvNames = [
|
|
10
|
+
"PATH",
|
|
11
|
+
"HOME",
|
|
12
|
+
"USERPROFILE",
|
|
13
|
+
"TMPDIR",
|
|
14
|
+
"TEMP",
|
|
15
|
+
"TMP",
|
|
16
|
+
"LANG"
|
|
17
|
+
];
|
|
18
|
+
const windowsAllowedProviderParentEnvNames = [
|
|
19
|
+
"SystemRoot",
|
|
20
|
+
"SystemDrive",
|
|
21
|
+
"ComSpec",
|
|
22
|
+
"PATHEXT",
|
|
23
|
+
"APPDATA",
|
|
24
|
+
"LOCALAPPDATA",
|
|
25
|
+
"USERNAME",
|
|
26
|
+
"USERDOMAIN",
|
|
27
|
+
"HOMEDRIVE",
|
|
28
|
+
"HOMEPATH",
|
|
29
|
+
"ProgramData",
|
|
30
|
+
"ProgramFiles",
|
|
31
|
+
"ProgramFiles(x86)",
|
|
32
|
+
"ProgramW6432",
|
|
33
|
+
"DOTNET_ROOT",
|
|
34
|
+
"DOTNET_ROOT(x86)",
|
|
35
|
+
"DOTNET_CLI_HOME",
|
|
36
|
+
"NUGET_PACKAGES",
|
|
37
|
+
"NUGET_HTTP_CACHE_PATH"
|
|
38
|
+
];
|
|
39
|
+
export function buildProviderChildEnvironment(requestEnv, options = {}) {
|
|
40
|
+
const parentEnv = options.parentEnv ?? process.env;
|
|
41
|
+
const platform = options.platform ?? process.platform;
|
|
42
|
+
const env = {};
|
|
43
|
+
for (const [key, value] of Object.entries(parentEnv)) {
|
|
44
|
+
if (typeof value === "string" && isAllowedProviderParentEnv(key, platform)) {
|
|
45
|
+
env[key] = value;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
if (requestEnv) {
|
|
49
|
+
for (const [key, value] of Object.entries(requestEnv)) {
|
|
50
|
+
const trimmedKey = key.trim();
|
|
51
|
+
if (trimmedKey.length > 0) {
|
|
52
|
+
env[trimmedKey] = value;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
if (platform === "win32") {
|
|
57
|
+
normalizeWindowsDotNetEnvironment(env, parentEnv, options.homeDir ?? os.homedir());
|
|
58
|
+
}
|
|
59
|
+
return env;
|
|
60
|
+
}
|
|
61
|
+
function isAllowedProviderParentEnv(key, platform = process.platform) {
|
|
62
|
+
return isAllowedProviderParentEnvName(key, allowedProviderParentEnvNames)
|
|
63
|
+
|| key.toUpperCase().startsWith("LC_")
|
|
64
|
+
|| (platform === "win32" && isAllowedProviderParentEnvName(key, windowsAllowedProviderParentEnvNames));
|
|
65
|
+
}
|
|
66
|
+
function isAllowedProviderParentEnvName(key, allowedNames) {
|
|
67
|
+
return allowedNames.some((allowed) => allowed.toLowerCase() === key.toLowerCase());
|
|
68
|
+
}
|
|
69
|
+
function normalizeWindowsDotNetEnvironment(env, parentEnv, homeDir) {
|
|
70
|
+
const systemRoot = readEnvironmentValue(env, "SystemRoot") ?? readEnvironmentValue(parentEnv, "SystemRoot") ?? "C:\\Windows";
|
|
71
|
+
const systemDrive = path.win32.parse(systemRoot).root.replace(/\\$/, "") || "C:";
|
|
72
|
+
setEnvironmentValueIfMissing(env, "SystemRoot", systemRoot);
|
|
73
|
+
setEnvironmentValueIfMissing(env, "SystemDrive", readEnvironmentValue(parentEnv, "SystemDrive") ?? systemDrive);
|
|
74
|
+
setEnvironmentValueIfMissing(env, "ComSpec", readEnvironmentValue(parentEnv, "ComSpec") ?? path.win32.join(systemRoot, "System32", "cmd.exe"));
|
|
75
|
+
setEnvironmentValueIfMissing(env, "PATHEXT", readEnvironmentValue(parentEnv, "PATHEXT") ?? ".COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.CPL");
|
|
76
|
+
const userProfile = resolveWindowsUserProfile(env, parentEnv, homeDir);
|
|
77
|
+
if (userProfile) {
|
|
78
|
+
setEnvironmentValueIfMissing(env, "USERPROFILE", userProfile);
|
|
79
|
+
setEnvironmentValueIfMissing(env, "HOME", userProfile);
|
|
80
|
+
setEnvironmentValueIfMissing(env, "DOTNET_CLI_HOME", userProfile);
|
|
81
|
+
setEnvironmentValueIfMissing(env, "NUGET_PACKAGES", path.win32.join(userProfile, ".nuget", "packages"));
|
|
82
|
+
const parsed = path.win32.parse(userProfile);
|
|
83
|
+
if (parsed.root) {
|
|
84
|
+
setEnvironmentValueIfMissing(env, "HOMEDRIVE", parsed.root.replace(/\\$/, ""));
|
|
85
|
+
setEnvironmentValueIfMissing(env, "HOMEPATH", userProfile.slice(parsed.root.length - (parsed.root.endsWith("\\") ? 1 : 0)) || "\\");
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
const appData = readEnvironmentValue(env, "APPDATA")
|
|
89
|
+
?? readEnvironmentValue(parentEnv, "APPDATA")
|
|
90
|
+
?? (userProfile ? path.win32.join(userProfile, "AppData", "Roaming") : undefined);
|
|
91
|
+
const localAppData = readEnvironmentValue(env, "LOCALAPPDATA")
|
|
92
|
+
?? readEnvironmentValue(parentEnv, "LOCALAPPDATA")
|
|
93
|
+
?? (userProfile ? path.win32.join(userProfile, "AppData", "Local") : undefined);
|
|
94
|
+
if (appData) {
|
|
95
|
+
setEnvironmentValueIfMissing(env, "APPDATA", appData);
|
|
96
|
+
}
|
|
97
|
+
if (localAppData) {
|
|
98
|
+
setEnvironmentValueIfMissing(env, "LOCALAPPDATA", localAppData);
|
|
99
|
+
setEnvironmentValueIfMissing(env, "NUGET_HTTP_CACHE_PATH", path.win32.join(localAppData, "NuGet", "v3-cache"));
|
|
100
|
+
}
|
|
101
|
+
setEnvironmentValueIfMissing(env, "DOTNET_NOLOGO", "1");
|
|
102
|
+
setEnvironmentValueIfMissing(env, "DOTNET_CLI_TELEMETRY_OPTOUT", "1");
|
|
103
|
+
setEnvironmentValueIfMissing(env, "DOTNET_SKIP_FIRST_TIME_EXPERIENCE", "1");
|
|
104
|
+
setEnvironmentValueIfMissing(env, "NUGET_XMLDOC_MODE", "skip");
|
|
105
|
+
}
|
|
106
|
+
function resolveWindowsUserProfile(env, parentEnv, homeDir) {
|
|
107
|
+
const existing = readEnvironmentValue(env, "USERPROFILE") ?? readEnvironmentValue(parentEnv, "USERPROFILE");
|
|
108
|
+
if (existing) {
|
|
109
|
+
return existing;
|
|
110
|
+
}
|
|
111
|
+
const home = readEnvironmentValue(env, "HOME") ?? readEnvironmentValue(parentEnv, "HOME");
|
|
112
|
+
if (home && path.win32.isAbsolute(home)) {
|
|
113
|
+
return home;
|
|
114
|
+
}
|
|
115
|
+
const homeDrive = readEnvironmentValue(env, "HOMEDRIVE") ?? readEnvironmentValue(parentEnv, "HOMEDRIVE");
|
|
116
|
+
const homePath = readEnvironmentValue(env, "HOMEPATH") ?? readEnvironmentValue(parentEnv, "HOMEPATH");
|
|
117
|
+
if (homeDrive && homePath) {
|
|
118
|
+
return `${homeDrive}${homePath}`;
|
|
119
|
+
}
|
|
120
|
+
if (homeDir && path.win32.isAbsolute(homeDir)) {
|
|
121
|
+
return homeDir;
|
|
122
|
+
}
|
|
123
|
+
const systemDrive = readEnvironmentValue(env, "SystemDrive") ?? readEnvironmentValue(parentEnv, "SystemDrive") ?? "C:";
|
|
124
|
+
const username = readEnvironmentValue(env, "USERNAME") ?? readEnvironmentValue(parentEnv, "USERNAME");
|
|
125
|
+
return username ? path.win32.join(systemDrive, "Users", username) : undefined;
|
|
126
|
+
}
|
|
127
|
+
function readEnvironmentValue(env, name) {
|
|
128
|
+
const entry = Object.entries(env).find(([key]) => key.toLowerCase() === name.toLowerCase());
|
|
129
|
+
const value = entry?.[1];
|
|
130
|
+
return typeof value === "string" && value.trim().length > 0 ? value : undefined;
|
|
131
|
+
}
|
|
132
|
+
function setEnvironmentValueIfMissing(env, name, value) {
|
|
133
|
+
if (readEnvironmentValue(env, name)) {
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
env[name] = value;
|
|
137
|
+
}
|
|
138
|
+
export class StreamingProviderProcessRunner {
|
|
139
|
+
async run(request, handlers = {}, signal) {
|
|
140
|
+
const launch = await resolveProviderProcessLaunch(request.command, request.args);
|
|
141
|
+
return await new Promise((resolve, reject) => {
|
|
142
|
+
const child = spawn(launch.command, launch.args, {
|
|
143
|
+
cwd: request.cwd,
|
|
144
|
+
env: buildProviderChildEnvironment(request.env),
|
|
145
|
+
stdio: [request.stdin === undefined ? "ignore" : "pipe", "pipe", "pipe"],
|
|
146
|
+
windowsHide: true
|
|
147
|
+
});
|
|
148
|
+
const childStdout = child.stdout;
|
|
149
|
+
const childStderr = child.stderr;
|
|
150
|
+
if (!childStdout || !childStderr) {
|
|
151
|
+
child.kill("SIGTERM");
|
|
152
|
+
reject(new Error("Provider process stdout/stderr streams were not piped."));
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
let stdout = "";
|
|
156
|
+
let stderr = "";
|
|
157
|
+
let settled = false;
|
|
158
|
+
const cleanup = () => {
|
|
159
|
+
signal?.removeEventListener("abort", abort);
|
|
160
|
+
};
|
|
161
|
+
const fail = (error) => {
|
|
162
|
+
if (settled) {
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
settled = true;
|
|
166
|
+
cleanup();
|
|
167
|
+
reject(error);
|
|
168
|
+
};
|
|
169
|
+
const abort = () => {
|
|
170
|
+
try {
|
|
171
|
+
child.kill("SIGTERM");
|
|
172
|
+
}
|
|
173
|
+
catch {
|
|
174
|
+
// Best effort; close/error will settle the promise.
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
if (signal?.aborted) {
|
|
178
|
+
abort();
|
|
179
|
+
}
|
|
180
|
+
else {
|
|
181
|
+
signal?.addEventListener("abort", abort, { once: true });
|
|
182
|
+
}
|
|
183
|
+
child.on("error", fail);
|
|
184
|
+
if (request.stdin !== undefined) {
|
|
185
|
+
if (!child.stdin) {
|
|
186
|
+
try {
|
|
187
|
+
child.kill("SIGTERM");
|
|
188
|
+
}
|
|
189
|
+
catch {
|
|
190
|
+
// Best effort; the missing stdin pipe will fail the provider run.
|
|
191
|
+
}
|
|
192
|
+
fail(new Error("Provider process stdin stream was not piped."));
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
child.stdin.on("error", (error) => {
|
|
196
|
+
try {
|
|
197
|
+
child.kill("SIGTERM");
|
|
198
|
+
}
|
|
199
|
+
catch {
|
|
200
|
+
// Best effort; the stdin error will fail the provider run.
|
|
201
|
+
}
|
|
202
|
+
fail(error);
|
|
203
|
+
});
|
|
204
|
+
child.stdin.end(request.stdin, "utf8");
|
|
205
|
+
}
|
|
206
|
+
const readers = [
|
|
207
|
+
readProcessLines(childStdout, (line) => {
|
|
208
|
+
stdout += `${line}\n`;
|
|
209
|
+
return handlers.onStdoutLine?.(line);
|
|
210
|
+
}),
|
|
211
|
+
readProcessLines(childStderr, (line) => {
|
|
212
|
+
stderr += `${line}\n`;
|
|
213
|
+
return handlers.onStderrLine?.(line);
|
|
214
|
+
})
|
|
215
|
+
];
|
|
216
|
+
child.on("close", (code) => {
|
|
217
|
+
Promise.allSettled(readers).then((readerResults) => {
|
|
218
|
+
const rejected = readerResults.find((result) => result.status === "rejected");
|
|
219
|
+
if (rejected?.status === "rejected") {
|
|
220
|
+
fail(rejected.reason);
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
223
|
+
if (settled) {
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
226
|
+
settled = true;
|
|
227
|
+
cleanup();
|
|
228
|
+
resolve({
|
|
229
|
+
exitCode: code ?? 1,
|
|
230
|
+
stdout,
|
|
231
|
+
stderr
|
|
232
|
+
});
|
|
233
|
+
}).catch(fail);
|
|
234
|
+
});
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
async function resolveProviderProcessLaunch(command, args) {
|
|
239
|
+
if (process.platform !== "win32") {
|
|
240
|
+
return { command, args };
|
|
241
|
+
}
|
|
242
|
+
const cursorDirect = await resolveCursorAgentDirectLaunch(command, args);
|
|
243
|
+
if (cursorDirect) {
|
|
244
|
+
return cursorDirect;
|
|
245
|
+
}
|
|
246
|
+
const resolved = await resolveWindowsCommand(command);
|
|
247
|
+
return resolved ? buildWindowsLaunchCommand(resolved, args) : { command, args };
|
|
248
|
+
}
|
|
249
|
+
async function resolveWindowsCommand(command) {
|
|
250
|
+
if (path.isAbsolute(command)) {
|
|
251
|
+
return command;
|
|
252
|
+
}
|
|
253
|
+
try {
|
|
254
|
+
const result = await execFileAsync("where.exe", [command], { timeout: 2000 });
|
|
255
|
+
return chooseWindowsCommandCandidate(result.stdout.split(/\r?\n/));
|
|
256
|
+
}
|
|
257
|
+
catch {
|
|
258
|
+
return null;
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
export function chooseWindowsCommandCandidate(candidates) {
|
|
262
|
+
const normalized = candidates
|
|
263
|
+
.map((candidate) => candidate.trim())
|
|
264
|
+
.filter((candidate) => candidate.length > 0);
|
|
265
|
+
if (normalized.length === 0) {
|
|
266
|
+
return null;
|
|
267
|
+
}
|
|
268
|
+
const preferredExtensions = [".exe", ".ps1", ".cmd", ".bat", ""];
|
|
269
|
+
for (const extension of preferredExtensions) {
|
|
270
|
+
const candidate = normalized.find((entry) => path.extname(entry).toLowerCase() === extension);
|
|
271
|
+
if (candidate) {
|
|
272
|
+
return candidate;
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
return normalized[0];
|
|
276
|
+
}
|
|
277
|
+
async function readProcessLines(stream, onLine) {
|
|
278
|
+
const reader = readline.createInterface({ input: stream });
|
|
279
|
+
try {
|
|
280
|
+
for await (const line of reader) {
|
|
281
|
+
await onLine(line);
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
finally {
|
|
285
|
+
reader.close();
|
|
286
|
+
}
|
|
287
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { completionPhaseFromDispatch, type CompletionToolRuntime } from "../phase-completion.js";
|
|
2
|
+
import type { RunOnceDispatchPacket } from "../session.types.js";
|
|
3
|
+
import type { ProviderCliCommand } from "./provider-cli.process.js";
|
|
4
|
+
export declare function buildDraftSpec(dispatch: RunOnceDispatchPacket): string;
|
|
5
|
+
export interface DraftAttachmentPromptReference {
|
|
6
|
+
readonly index: number;
|
|
7
|
+
readonly path: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function buildDraftPrompt(dispatch: RunOnceDispatchPacket, options?: {
|
|
10
|
+
readonly attachmentReferences?: readonly DraftAttachmentPromptReference[];
|
|
11
|
+
}): string;
|
|
12
|
+
export declare function durableDraftInput(dispatch: RunOnceDispatchPacket): RunOnceDispatchPacket["draft"];
|
|
13
|
+
export declare function isDecomposeDraftKind(kind: string | null | undefined): boolean;
|
|
14
|
+
export declare function isDecomposeDraftDispatch(dispatch: RunOnceDispatchPacket): boolean;
|
|
15
|
+
export declare function formatProviderCliCommand(command: ProviderCliCommand): string;
|
|
16
|
+
export declare function formatProviderCliCommandForCheckpoint(command: ProviderCliCommand): string;
|
|
17
|
+
export declare function singleLine(value: string): string;
|
|
18
|
+
export declare function buildProviderCliCommand(dispatch: RunOnceDispatchPacket, run?: {
|
|
19
|
+
readonly prompt?: string;
|
|
20
|
+
readonly worktreePath?: string;
|
|
21
|
+
readonly completionTools?: CompletionToolRuntime;
|
|
22
|
+
readonly skipGitRepoCheck?: boolean;
|
|
23
|
+
readonly imagePaths?: readonly string[];
|
|
24
|
+
}): ProviderCliCommand;
|
|
25
|
+
export declare function codexSandboxModeForPlatform(platform?: NodeJS.Platform): "workspace-write" | "danger-full-access";
|
|
26
|
+
export declare function buildArchitectPrompt(dispatch: RunOnceDispatchPacket): string;
|
|
27
|
+
export declare function architectDependencyInstruction(dispatch: RunOnceDispatchPacket): string;
|
|
28
|
+
export declare function designerRefInstruction(dispatch: RunOnceDispatchPacket): string;
|
|
29
|
+
export declare function architectRevisionInstruction(dispatch: RunOnceDispatchPacket): string;
|
|
30
|
+
export declare function buildImplementationPrompt(dispatch: RunOnceDispatchPacket, phase?: import("../phase-completion.js").CompletionPhase): string;
|
|
31
|
+
export declare function buildDevelopCyclePrompt(dispatch: RunOnceDispatchPacket, phase?: import("../phase-completion.js").CompletionPhase): string;
|
|
32
|
+
export declare function buildDebugCyclePrompt(dispatch: RunOnceDispatchPacket, phase?: import("../phase-completion.js").CompletionPhase): string;
|
|
33
|
+
export declare function qaReworkImplementationInstruction(dispatch: RunOnceDispatchPacket): string;
|
|
34
|
+
export declare function debugQaReworkInstruction(dispatch: RunOnceDispatchPacket): string;
|
|
35
|
+
export declare function qaReworkRetestInstruction(dispatch: RunOnceDispatchPacket): string;
|
|
36
|
+
export declare function phaseWorkInstruction(phase: ReturnType<typeof completionPhaseFromDispatch>): string;
|
|
37
|
+
export declare function qaBrowserInstruction(dispatch: RunOnceDispatchPacket): string;
|
|
38
|
+
export declare function storyQaInstruction(dispatch: RunOnceDispatchPacket): string;
|
|
39
|
+
export declare function buildQaPrompt(dispatch: RunOnceDispatchPacket, laneSpec: string): string;
|
|
40
|
+
export declare function buildConflictResolvePrompt(dispatch: RunOnceDispatchPacket, branchName: string): string;
|
|
41
|
+
export declare function buildPullRequestCheckRepairPrompt(dispatch: RunOnceDispatchPacket, branchName: string): string;
|
|
42
|
+
export declare function buildPullRequestCommentsPrompt(dispatch: RunOnceDispatchPacket, branchName: string): string;
|
|
43
|
+
export declare function isPullRequestCheckRepairDispatch(dispatch: RunOnceDispatchPacket): boolean;
|
|
44
|
+
export declare function isPullRequestCommentsDispatch(dispatch: RunOnceDispatchPacket): boolean;
|