@loucompanion/forge-bridge 0.1.1-dev.7d43998c4521 → 0.1.1-dev.ac486debe210
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 -0
- package/dist/bridge/bridge.service.js +16 -3
- package/dist/bridge/bridge.types.d.ts +7 -0
- package/dist/cli/cli.service.d.ts +27 -2
- package/dist/cli/cli.service.js +406 -16
- package/dist/cli/local-config.d.ts +4 -1
- package/dist/cli/local-config.js +42 -7
- package/dist/session/index.d.ts +2 -0
- package/dist/session/index.js +1 -0
- package/dist/session/internals.d.ts +4 -2
- package/dist/session/internals.js +2 -1
- package/dist/session/phase-completion.d.ts +86 -0
- package/dist/session/phase-completion.js +1018 -0
- package/dist/session/provider-cli/index.d.ts +2 -2
- package/dist/session/provider-cli/index.js +1 -1
- package/dist/session/provider-cli/provider-cli.base.d.ts +2 -2
- package/dist/session/provider-cli/provider-cli.service.d.ts +48 -3
- package/dist/session/provider-cli/provider-cli.service.js +1241 -42
- package/dist/session/provider-cli/provider-cli.types.d.ts +2 -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/session.service.js +51 -11
- package/dist/session/session.types.d.ts +18 -0
- package/dist/session/session.types.js +58 -1
- 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.d.ts +11 -0
- package/dist/worktree/artifact-injector.js +104 -0
- package/dist/worktree/dependency-warmer.d.ts +32 -0
- package/dist/worktree/dependency-warmer.js +297 -0
- package/dist/worktree/index.d.ts +2 -0
- package/dist/worktree/index.js +1 -0
- package/dist/worktree/worktree.service.d.ts +4 -0
- package/dist/worktree/worktree.service.js +173 -11
- package/dist/worktree/worktree.types.d.ts +5 -1
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { BridgeProviderStatus, BridgeRepoMapping, BridgeServiceConfig } from "../bridge/bridge.types.js";
|
|
2
2
|
export interface BridgeLocalConfig {
|
|
3
|
-
readonly schemaVersion: 1;
|
|
3
|
+
readonly schemaVersion: 1 | 2;
|
|
4
4
|
readonly serverUrl?: string;
|
|
5
5
|
readonly runnerId?: string;
|
|
6
6
|
readonly deviceToken?: string;
|
|
@@ -13,6 +13,9 @@ export interface BridgeLocalConfig {
|
|
|
13
13
|
readonly repoMappings?: readonly LocalRepoMapping[];
|
|
14
14
|
readonly sandboxProfiles?: readonly string[];
|
|
15
15
|
readonly supportsApiSecretGrant?: boolean;
|
|
16
|
+
readonly supportsManagedWorktrees?: boolean;
|
|
17
|
+
readonly supportsManagedForgeArtifacts?: boolean;
|
|
18
|
+
readonly supportsRunnerAuthoredPhaseArtifacts?: boolean;
|
|
16
19
|
}
|
|
17
20
|
export interface LocalRepoMapping extends BridgeRepoMapping {
|
|
18
21
|
readonly label: string;
|
package/dist/cli/local-config.js
CHANGED
|
@@ -46,11 +46,14 @@ export function applyLocalConfigDefaults(config, local) {
|
|
|
46
46
|
defaultRepoRoot: process.env.FORGE_REPO_ROOT ?? local.defaultRepoRoot ?? config.defaultRepoRoot,
|
|
47
47
|
cleanupWorktrees: local.cleanupWorktrees ?? config.cleanupWorktrees,
|
|
48
48
|
cliProviders,
|
|
49
|
-
providerStatuses: local.providerStatuses ?? providerStatusesFor(cliProviders),
|
|
49
|
+
providerStatuses: normalizeProviderStatuses(local.providerStatuses) ?? providerStatusesFor(cliProviders),
|
|
50
50
|
projectLabels: local.projectLabels ?? config.projectLabels,
|
|
51
51
|
repoMappings: local.repoMappings ?? config.repoMappings,
|
|
52
52
|
sandboxProfiles: local.sandboxProfiles ?? config.sandboxProfiles,
|
|
53
|
-
supportsApiSecretGrant: local.supportsApiSecretGrant ?? config.supportsApiSecretGrant
|
|
53
|
+
supportsApiSecretGrant: local.supportsApiSecretGrant ?? config.supportsApiSecretGrant,
|
|
54
|
+
supportsManagedWorktrees: local.supportsManagedWorktrees ?? config.supportsManagedWorktrees,
|
|
55
|
+
supportsManagedForgeArtifacts: local.supportsManagedForgeArtifacts ?? config.supportsManagedForgeArtifacts,
|
|
56
|
+
supportsRunnerAuthoredPhaseArtifacts: local.supportsRunnerAuthoredPhaseArtifacts ?? config.supportsRunnerAuthoredPhaseArtifacts
|
|
54
57
|
};
|
|
55
58
|
}
|
|
56
59
|
export async function addRepoMapping(label, repoPath) {
|
|
@@ -83,7 +86,7 @@ export async function removeRepoMapping(label) {
|
|
|
83
86
|
return { config: next, removed: after.length !== before.length };
|
|
84
87
|
}
|
|
85
88
|
export function providerStatusesFor(providers) {
|
|
86
|
-
return Object.fromEntries(providers.map((provider) => [provider, { signedIn: true, version: "" }]));
|
|
89
|
+
return Object.fromEntries(providers.map((provider) => [provider, { signedIn: true, version: "", models: configuredModelsFor(provider) }]));
|
|
87
90
|
}
|
|
88
91
|
function parseLocalConfig(raw) {
|
|
89
92
|
if (!raw.trim()) {
|
|
@@ -93,7 +96,7 @@ function parseLocalConfig(raw) {
|
|
|
93
96
|
}
|
|
94
97
|
function normalizeLocalConfig(config) {
|
|
95
98
|
return {
|
|
96
|
-
schemaVersion:
|
|
99
|
+
schemaVersion: 2,
|
|
97
100
|
serverUrl: cleanString(config.serverUrl),
|
|
98
101
|
runnerId: cleanString(config.runnerId),
|
|
99
102
|
deviceToken: cleanString(config.deviceToken),
|
|
@@ -101,19 +104,51 @@ function normalizeLocalConfig(config) {
|
|
|
101
104
|
defaultRepoRoot: cleanString(config.defaultRepoRoot),
|
|
102
105
|
cleanupWorktrees: config.cleanupWorktrees,
|
|
103
106
|
cliProviders: cleanList(config.cliProviders),
|
|
104
|
-
providerStatuses: config.providerStatuses,
|
|
107
|
+
providerStatuses: normalizeProviderStatuses(config.providerStatuses),
|
|
105
108
|
projectLabels: cleanList(config.projectLabels),
|
|
106
109
|
repoMappings: normalizeRepoMappings(config.repoMappings),
|
|
107
110
|
sandboxProfiles: cleanList(config.sandboxProfiles),
|
|
108
|
-
supportsApiSecretGrant: config.supportsApiSecretGrant
|
|
111
|
+
supportsApiSecretGrant: config.supportsApiSecretGrant,
|
|
112
|
+
supportsManagedWorktrees: config.supportsManagedWorktrees,
|
|
113
|
+
supportsManagedForgeArtifacts: config.supportsManagedForgeArtifacts,
|
|
114
|
+
supportsRunnerAuthoredPhaseArtifacts: config.supportsRunnerAuthoredPhaseArtifacts
|
|
109
115
|
};
|
|
110
116
|
}
|
|
111
117
|
function emptyConfig() {
|
|
112
118
|
return {
|
|
113
|
-
schemaVersion:
|
|
119
|
+
schemaVersion: 2,
|
|
114
120
|
repoMappings: []
|
|
115
121
|
};
|
|
116
122
|
}
|
|
123
|
+
function normalizeProviderStatuses(values) {
|
|
124
|
+
if (!values)
|
|
125
|
+
return undefined;
|
|
126
|
+
const entries = [];
|
|
127
|
+
for (const [provider, status] of Object.entries(values)) {
|
|
128
|
+
const key = provider.trim();
|
|
129
|
+
if (!key)
|
|
130
|
+
continue;
|
|
131
|
+
entries.push([
|
|
132
|
+
key,
|
|
133
|
+
{
|
|
134
|
+
signedIn: status?.signedIn ?? true,
|
|
135
|
+
version: cleanString(status?.version),
|
|
136
|
+
models: cleanList(status?.models) ?? configuredModelsFor(key)
|
|
137
|
+
}
|
|
138
|
+
]);
|
|
139
|
+
}
|
|
140
|
+
return entries.length > 0 ? Object.fromEntries(entries) : undefined;
|
|
141
|
+
}
|
|
142
|
+
function configuredModelsFor(provider) {
|
|
143
|
+
const envName = `FORGE_${provider.replace(/[^a-zA-Z0-9]/g, "_").toUpperCase()}_MODELS`;
|
|
144
|
+
return splitCsv(process.env[envName] ?? "");
|
|
145
|
+
}
|
|
146
|
+
function splitCsv(value) {
|
|
147
|
+
return value
|
|
148
|
+
.split(",")
|
|
149
|
+
.map((entry) => entry.trim())
|
|
150
|
+
.filter((entry) => entry.length > 0);
|
|
151
|
+
}
|
|
117
152
|
function normalizeRepoMappings(values) {
|
|
118
153
|
return (values ?? [])
|
|
119
154
|
.filter((mapping) => !!mapping.label?.trim() && !!mapping.localPath?.trim())
|
package/dist/session/index.d.ts
CHANGED
|
@@ -1,2 +1,4 @@
|
|
|
1
1
|
export { BridgeSessionService } from "./session.service.js";
|
|
2
|
+
export { buildCompletionToolServerArgs, codexMcpConfigArgs, completionPhaseFromDispatch, expectedCompletionToolName, prepareCompletionToolRuntime, readCompletionArtifact, writeCompletionArtifact } from "./phase-completion.js";
|
|
3
|
+
export type { CompletionArtifactReference, CompletionPhase, CompletionToolRuntime } from "./phase-completion.js";
|
|
2
4
|
export type { SessionService } from "./session.base.js";
|
package/dist/session/index.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
1
|
export { BridgeSessionService } from "./session.service.js";
|
|
2
|
+
export { buildCompletionToolServerArgs, codexMcpConfigArgs, completionPhaseFromDispatch, expectedCompletionToolName, prepareCompletionToolRuntime, readCompletionArtifact, writeCompletionArtifact } from "./phase-completion.js";
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
export { parseRunOnceDispatchPacket, failureResult } from "./session.types.js";
|
|
2
|
+
export { buildCompletionToolServerArgs, codexMcpConfigArgs, completionPhaseFromDispatch, expectedCompletionToolName, prepareCompletionToolRuntime, readCompletionArtifact, writeCompletionArtifact } from "./phase-completion.js";
|
|
3
|
+
export type { CompletionArtifactReference, CompletionPhase, CompletionToolRuntime } from "./phase-completion.js";
|
|
2
4
|
export type { SessionEventSink, SessionService } from "./session.base.js";
|
|
3
5
|
export type { ApiKeySecretGrant, DispatchCycleRun, DispatchExecution, DispatchLease, DispatchSession, DispatchRepo, DispatchServerLocalConfig, DispatchWorkItem, RunOnceDispatchPacket, RunOnceResultPacket, RunnerDispatchArtifact, RunnerDispatchEvent, RunnerDispatchSpec, RunnerEventLine } from "./session.types.js";
|
|
4
|
-
export { DeterministicProviderCliService, buildProviderCliCommand } from "./provider-cli/provider-cli.service.js";
|
|
6
|
+
export { DeterministicProviderCliService, ProcessBackedProviderCliService, RoutingProviderCliService, buildProviderCliCommand } from "./provider-cli/provider-cli.service.js";
|
|
5
7
|
export type { ProviderCliService } from "./provider-cli/provider-cli.base.js";
|
|
6
|
-
export type { ProviderCliCommand } from "./provider-cli/provider-cli.service.js";
|
|
8
|
+
export type { ProviderCliCommand, ProviderProcessRunner, ProviderProcessRunRequest, ProviderProcessRunResult } from "./provider-cli/provider-cli.service.js";
|
|
7
9
|
export type { ProviderCliRunContext, ProviderCliRunResult } from "./provider-cli/provider-cli.types.js";
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
export { parseRunOnceDispatchPacket, failureResult } from "./session.types.js";
|
|
2
|
-
export {
|
|
2
|
+
export { buildCompletionToolServerArgs, codexMcpConfigArgs, completionPhaseFromDispatch, expectedCompletionToolName, prepareCompletionToolRuntime, readCompletionArtifact, writeCompletionArtifact } from "./phase-completion.js";
|
|
3
|
+
export { DeterministicProviderCliService, ProcessBackedProviderCliService, RoutingProviderCliService, buildProviderCliCommand } from "./provider-cli/provider-cli.service.js";
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import type { RunOnceDispatchPacket, RunnerDispatchArtifact } from "./session.types.js";
|
|
2
|
+
import type { WorktreeHandle } from "../worktree/worktree.types.js";
|
|
3
|
+
export type CompletionPhase = "implementation" | "self_review" | "validation";
|
|
4
|
+
export interface CompletionToolRuntime {
|
|
5
|
+
readonly serverName: string;
|
|
6
|
+
readonly command: string;
|
|
7
|
+
readonly args: readonly string[];
|
|
8
|
+
readonly env: Readonly<Record<string, string>>;
|
|
9
|
+
readonly cursorMcpConfigPath?: string | null;
|
|
10
|
+
cleanup(): Promise<void>;
|
|
11
|
+
}
|
|
12
|
+
export interface CompletionToolRuntimeOptions {
|
|
13
|
+
readonly dispatch: RunOnceDispatchPacket;
|
|
14
|
+
readonly worktree: WorktreeHandle;
|
|
15
|
+
readonly phase?: CompletionPhase;
|
|
16
|
+
}
|
|
17
|
+
export interface CompletionToolServerConfig {
|
|
18
|
+
readonly worktreePath: string;
|
|
19
|
+
readonly workItemId: string;
|
|
20
|
+
readonly phase: CompletionPhase;
|
|
21
|
+
readonly producedBy?: string;
|
|
22
|
+
readonly redactionSecrets?: readonly string[];
|
|
23
|
+
readonly developCycle?: boolean;
|
|
24
|
+
}
|
|
25
|
+
export interface CompletionToolCallResult {
|
|
26
|
+
readonly content: readonly {
|
|
27
|
+
readonly type: "text";
|
|
28
|
+
readonly text: string;
|
|
29
|
+
}[];
|
|
30
|
+
readonly structuredContent: CompletionArtifactReference & {
|
|
31
|
+
readonly gate: {
|
|
32
|
+
readonly phase: CompletionPhase;
|
|
33
|
+
readonly status: string;
|
|
34
|
+
readonly allowed: boolean;
|
|
35
|
+
readonly reason: string;
|
|
36
|
+
};
|
|
37
|
+
readonly nextPhase: CompletionPhase | "dev_test_ready";
|
|
38
|
+
readonly nextInstruction: string;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
export interface CompletionArtifactReference {
|
|
42
|
+
readonly phase: CompletionPhase;
|
|
43
|
+
readonly workItemId: string;
|
|
44
|
+
readonly repoPath: string;
|
|
45
|
+
readonly path: string;
|
|
46
|
+
readonly reportPath: string;
|
|
47
|
+
readonly contentHash: string;
|
|
48
|
+
readonly status: string;
|
|
49
|
+
readonly producedBy: string;
|
|
50
|
+
}
|
|
51
|
+
export declare function completionPhaseFromDispatch(dispatch: RunOnceDispatchPacket): CompletionPhase;
|
|
52
|
+
export declare function normalizeCompletionPhase(value: string | null | undefined): CompletionPhase;
|
|
53
|
+
export declare function usesDevelopCycleCompletion(dispatch: RunOnceDispatchPacket): boolean;
|
|
54
|
+
export declare function completionToolNamesForPhase(phase: CompletionPhase): readonly string[];
|
|
55
|
+
export declare function expectedCompletionToolName(phase: CompletionPhase): string;
|
|
56
|
+
export declare function artifactRootFor(worktreePath: string, workItemId: string): string;
|
|
57
|
+
export declare function completionArtifactJsonPath(worktreePath: string, workItemId: string, phase: CompletionPhase): string;
|
|
58
|
+
export declare function completionArtifactReportPath(worktreePath: string, workItemId: string, phase: CompletionPhase): string;
|
|
59
|
+
export declare function prepareCompletionToolRuntime(options: CompletionToolRuntimeOptions): Promise<CompletionToolRuntime>;
|
|
60
|
+
export declare function buildCompletionToolServerArgs(config: CompletionToolServerConfig): readonly string[];
|
|
61
|
+
export declare function codexMcpConfigArgs(runtime: CompletionToolRuntime): readonly string[];
|
|
62
|
+
export declare function cursorMcpServerConfig(runtime: CompletionToolRuntime): unknown;
|
|
63
|
+
export declare function completionPromptForPhase(phase: CompletionPhase): string;
|
|
64
|
+
export declare function completionPromptForDevelopCycle(phase: CompletionPhase): string;
|
|
65
|
+
export declare function completionToolNamesForServer(config: CompletionToolServerConfig): readonly string[];
|
|
66
|
+
export declare class CompletionToolServerSession {
|
|
67
|
+
private readonly config;
|
|
68
|
+
private currentPhase;
|
|
69
|
+
private completed;
|
|
70
|
+
constructor(config: CompletionToolServerConfig);
|
|
71
|
+
get instructions(): string;
|
|
72
|
+
toolDefinitions(): readonly unknown[];
|
|
73
|
+
callTool(toolName: string, input: unknown): Promise<CompletionToolCallResult>;
|
|
74
|
+
private advanceAfterPass;
|
|
75
|
+
}
|
|
76
|
+
export declare function writeCompletionArtifact(config: CompletionToolServerConfig, toolName: string, input: unknown): Promise<CompletionArtifactReference>;
|
|
77
|
+
export declare function readCompletionArtifact(worktreePath: string, workItemId: string, phase: CompletionPhase): Promise<RunnerDispatchArtifact | null>;
|
|
78
|
+
export declare function runCompletionMcpServer(config: CompletionToolServerConfig): Promise<void>;
|
|
79
|
+
export declare function parseCompletionMcpArgs(argv: readonly string[]): {
|
|
80
|
+
readonly ok: true;
|
|
81
|
+
readonly config: CompletionToolServerConfig;
|
|
82
|
+
} | {
|
|
83
|
+
readonly ok: false;
|
|
84
|
+
readonly error: string;
|
|
85
|
+
};
|
|
86
|
+
export declare function completionRedactionEnv(secrets: readonly string[]): Readonly<Record<string, string>>;
|