@loucompanion/forge-bridge 0.1.3-dev.b6be5e7f9668 → 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.
Files changed (91) hide show
  1. package/README.md +44 -0
  2. package/dist/bridge/bridge.base.d.ts +5 -1
  3. package/dist/bridge/bridge.service.d.ts +36 -2
  4. package/dist/bridge/bridge.service.js +588 -18
  5. package/dist/bridge/bridge.types.d.ts +114 -1
  6. package/dist/cli/cli.help.d.ts +2 -0
  7. package/dist/cli/cli.help.js +183 -0
  8. package/dist/cli/cli.service.d.ts +12 -0
  9. package/dist/cli/cli.service.js +176 -184
  10. package/dist/cli/local-config.d.ts +2 -0
  11. package/dist/cli/local-config.js +6 -2
  12. package/dist/sandbox/command-runner.d.ts +4 -0
  13. package/dist/sandbox/command-runner.js +47 -0
  14. package/dist/sandbox/contract.d.ts +5 -0
  15. package/dist/sandbox/contract.js +276 -0
  16. package/dist/sandbox/event-budget.d.ts +11 -0
  17. package/dist/sandbox/event-budget.js +27 -0
  18. package/dist/sandbox/image-policy.d.ts +33 -0
  19. package/dist/sandbox/image-policy.js +245 -0
  20. package/dist/sandbox/index.d.ts +5 -0
  21. package/dist/sandbox/index.js +5 -0
  22. package/dist/sandbox/lease-watchdog.d.ts +18 -0
  23. package/dist/sandbox/lease-watchdog.js +67 -0
  24. package/dist/sandbox/preflight.d.ts +36 -0
  25. package/dist/sandbox/preflight.js +239 -0
  26. package/dist/sandbox/process.d.ts +20 -0
  27. package/dist/sandbox/process.js +124 -0
  28. package/dist/sandbox/provider-auth/codex.d.ts +26 -0
  29. package/dist/sandbox/provider-auth/codex.js +212 -0
  30. package/dist/sandbox/repository-lock.d.ts +5 -0
  31. package/dist/sandbox/repository-lock.js +83 -0
  32. package/dist/sandbox/runtime.d.ts +216 -0
  33. package/dist/sandbox/runtime.js +1658 -0
  34. package/dist/sandbox/sandbox.types.d.ts +83 -0
  35. package/dist/sandbox/sandbox.types.js +1 -0
  36. package/dist/sandbox/worker-supervisor.d.ts +13 -0
  37. package/dist/sandbox/worker-supervisor.js +36 -0
  38. package/dist/sandbox/worker.d.ts +1 -0
  39. package/dist/sandbox/worker.js +228 -0
  40. package/dist/sandbox/workspace.service.d.ts +12 -0
  41. package/dist/sandbox/workspace.service.js +49 -0
  42. package/dist/session/phase-completion.artifacts.d.ts +10 -0
  43. package/dist/session/phase-completion.artifacts.js +620 -0
  44. package/dist/session/phase-completion.d.ts +32 -44
  45. package/dist/session/phase-completion.helpers.d.ts +112 -0
  46. package/dist/session/phase-completion.helpers.js +660 -0
  47. package/dist/session/phase-completion.js +28 -3485
  48. package/dist/session/phase-completion.prompts.d.ts +14 -0
  49. package/dist/session/phase-completion.prompts.js +220 -0
  50. package/dist/session/phase-completion.runtime.d.ts +36 -0
  51. package/dist/session/phase-completion.runtime.js +609 -0
  52. package/dist/session/phase-completion.schemas.d.ts +3 -0
  53. package/dist/session/phase-completion.schemas.js +707 -0
  54. package/dist/session/phase-completion.validation.d.ts +34 -0
  55. package/dist/session/phase-completion.validation.js +724 -0
  56. package/dist/session/provider-cli/provider-cli.artifacts.d.ts +93 -0
  57. package/dist/session/provider-cli/provider-cli.artifacts.js +754 -0
  58. package/dist/session/provider-cli/provider-cli.base.d.ts +1 -0
  59. package/dist/session/provider-cli/provider-cli.deterministic-payloads.d.ts +12 -0
  60. package/dist/session/provider-cli/provider-cli.deterministic-payloads.js +279 -0
  61. package/dist/session/provider-cli/provider-cli.deterministic.d.ts +14 -0
  62. package/dist/session/provider-cli/provider-cli.deterministic.js +329 -0
  63. package/dist/session/provider-cli/provider-cli.process.d.ts +32 -0
  64. package/dist/session/provider-cli/provider-cli.process.js +287 -0
  65. package/dist/session/provider-cli/provider-cli.prompts.d.ts +44 -0
  66. package/dist/session/provider-cli/provider-cli.prompts.js +528 -0
  67. package/dist/session/provider-cli/provider-cli.qa-sidecars.d.ts +11 -0
  68. package/dist/session/provider-cli/provider-cli.qa-sidecars.js +65 -0
  69. package/dist/session/provider-cli/provider-cli.runtime.d.ts +9 -0
  70. package/dist/session/provider-cli/provider-cli.runtime.js +40 -0
  71. package/dist/session/provider-cli/provider-cli.service.d.ts +9 -53
  72. package/dist/session/provider-cli/provider-cli.service.js +161 -2527
  73. package/dist/session/provider-cli/provider-cli.types.d.ts +1 -0
  74. package/dist/session/provider-cli/provider-output-state.d.ts +20 -0
  75. package/dist/session/provider-cli/provider-output-state.js +445 -0
  76. package/dist/session/session.service.js +34 -24
  77. package/dist/session/session.types.d.ts +106 -1
  78. package/dist/session/session.types.js +248 -3
  79. package/dist/shared/process/windows-launch.d.ts +8 -0
  80. package/dist/shared/process/windows-launch.js +41 -0
  81. package/dist/shared/provider-capabilities.d.ts +1 -0
  82. package/dist/shared/provider-capabilities.js +3 -0
  83. package/dist/shared/redaction/redaction.js +4 -2
  84. package/dist/version.d.ts +1 -1
  85. package/dist/version.js +1 -1
  86. package/dist/worktree/artifact-injector.js +39 -6
  87. package/dist/worktree/dependency-warmer.d.ts +11 -0
  88. package/dist/worktree/dependency-warmer.js +45 -1
  89. package/dist/worktree/worktree.service.d.ts +2 -1
  90. package/dist/worktree/worktree.service.js +32 -12
  91. package/package.json +4 -2
@@ -1,5 +1,9 @@
1
- import type { RunOnceDispatchPacket, RunnerDispatchArtifact } from "./session.types.js";
1
+ import type { RunOnceDispatchPacket } from "./session.types.js";
2
2
  import type { WorktreeHandle } from "../worktree/worktree.types.js";
3
+ export { isDebugCompletionPhase } from "./phase-completion.validation.js";
4
+ export { readCompletionArtifact, writeCompletionArtifact } from "./phase-completion.artifacts.js";
5
+ export * from "./phase-completion.prompts.js";
6
+ export * from "./phase-completion.runtime.js";
3
7
  export type DevelopCompletionPhase = "implementation" | "self_review" | "validation";
4
8
  export type DebugCompletionPhase = "debug_repro" | "debug_root_cause" | "debug_fix" | "debug_regression";
5
9
  export type ArchitectCompletionPhase = "architect";
@@ -68,10 +72,37 @@ export interface CompletionArtifactReference {
68
72
  readonly status: string;
69
73
  readonly producedBy: string;
70
74
  }
75
+ export interface CompletionArtifactFiles {
76
+ readonly jsonFileName: string;
77
+ readonly reportFileName: string;
78
+ }
79
+ export declare const toolServerName = "forge";
80
+ export declare const completionRedactionSecretsEnv = "FORGE_COMPLETION_REDACTION_SECRETS";
81
+ export declare const completionPhaseOrder: readonly DevelopCompletionPhase[];
71
82
  export declare const debugCompletionPhaseOrder: readonly DebugCompletionPhase[];
72
83
  export declare const qaCompletionGateOrder: readonly QaCompletionGate[];
73
84
  export declare const draftCompletionGateOrder: readonly DraftCompletionGate[];
74
85
  export declare const decomposeCompletionGateOrder: readonly DecomposeCompletionGate[];
86
+ export declare const decomposeGateFileNames: Record<DecomposeCompletionGate, string>;
87
+ export declare const decomposeGateToolNames: Record<DecomposeCompletionGate, string>;
88
+ export declare const draftGateFileNames: Record<DraftCompletionGate, string>;
89
+ export declare const draftGateToolNames: Record<DraftCompletionGate, string>;
90
+ export declare const qaGateFileNames: Record<QaCompletionGate, string>;
91
+ export declare const qaGateToolNames: Record<QaCompletionGate, string>;
92
+ export declare const debugGateToolNames: Record<DebugCompletionPhase, string>;
93
+ export declare const qaBlockerReasons: Set<string>;
94
+ export declare const resolvedFindingStatusValues: readonly ["resolved", "disputed", "not_reproduced"];
95
+ export declare const resolvedFindingStatuses: Set<string>;
96
+ export declare const qaFindingSeverities: Set<string>;
97
+ export declare const qaFindingScopes: Set<string>;
98
+ export declare const qaCandidateBugActions: Set<string>;
99
+ export declare const qaScopeSurfaces: Set<string>;
100
+ export declare const qaScopeEvidence: Set<string>;
101
+ export declare const qaScopeSources: Set<string>;
102
+ export declare const qaScopeAuthorities: Set<string>;
103
+ export declare const qaScopeConfidence: Set<string>;
104
+ export declare const qaScopeFields: Set<string>;
105
+ export declare const phaseFiles: Record<CompletionPhase, CompletionArtifactFiles>;
75
106
  export declare function completionPhaseFromDispatch(dispatch: RunOnceDispatchPacket): CompletionPhase;
76
107
  export declare function normalizeCompletionPhase(value: string | null | undefined): CompletionPhase;
77
108
  export declare function usesDevelopCycleCompletion(dispatch: RunOnceDispatchPacket): boolean;
@@ -92,46 +123,3 @@ export declare function artifactRootFor(worktreePath: string, workItemId: string
92
123
  export declare function artifactRootForOwner(worktreePath: string, ownerType: string, ownerId: string): string;
93
124
  export declare function completionArtifactJsonPath(worktreePath: string, workItemId: string, phase: CompletionPhase, ownerType?: string | null, ownerId?: string | null): string;
94
125
  export declare function completionArtifactReportPath(worktreePath: string, workItemId: string, phase: CompletionPhase, ownerType?: string | null, ownerId?: string | null): string;
95
- export declare function prepareCompletionToolRuntime(options: CompletionToolRuntimeOptions): Promise<CompletionToolRuntime>;
96
- export declare function buildCompletionToolServerArgs(config: CompletionToolServerConfig): readonly string[];
97
- export declare function codexMcpConfigArgs(runtime: CompletionToolRuntime): readonly string[];
98
- export declare function cursorMcpServerConfig(runtime: CompletionToolRuntime): unknown;
99
- export declare function completionPromptForPhase(phase: CompletionPhase): string;
100
- export declare function completionPromptForDevelopCycle(phase: CompletionPhase): string;
101
- export declare function completionPromptForQaCycle(currentGate?: QaCompletionGate): string;
102
- export declare function completionPromptForDraftCycle(currentGate?: DraftCompletionGate): string;
103
- export declare function completionPromptForDecomposeCycle(currentGate?: DecomposeCompletionGate): string;
104
- export declare function completionPromptForDebugCycle(currentGate?: DebugCompletionPhase): string;
105
- export declare function completionToolNamesForServer(config: CompletionToolServerConfig): readonly string[];
106
- export declare class CompletionToolServerSession {
107
- private readonly config;
108
- private currentPhase;
109
- private currentQaGate;
110
- private currentDraftGate;
111
- private currentDecomposeGate;
112
- private completed;
113
- constructor(config: CompletionToolServerConfig);
114
- get instructions(): string;
115
- toolDefinitions(): readonly unknown[];
116
- callTool(toolName: string, input: unknown): Promise<CompletionToolCallResult>;
117
- private callDecomposeGateTool;
118
- private callDraftGateTool;
119
- private callDebugGateTool;
120
- private callQaGateTool;
121
- private advanceAfterPass;
122
- private advanceAfterDecomposeGate;
123
- private advanceAfterDraftGate;
124
- private advanceAfterQaGate;
125
- private advanceAfterDebugGate;
126
- }
127
- export declare function writeCompletionArtifact(config: CompletionToolServerConfig, toolName: string, input: unknown): Promise<CompletionArtifactReference>;
128
- export declare function readCompletionArtifact(worktreePath: string, workItemId: string, phase: CompletionPhase, ownerType?: string | null, ownerId?: string | null): Promise<RunnerDispatchArtifact | null>;
129
- export declare function runCompletionMcpServer(config: CompletionToolServerConfig): Promise<void>;
130
- export declare function parseCompletionMcpArgs(argv: readonly string[]): {
131
- readonly ok: true;
132
- readonly config: CompletionToolServerConfig;
133
- } | {
134
- readonly ok: false;
135
- readonly error: string;
136
- };
137
- export declare function completionRedactionEnv(secrets: readonly string[]): Readonly<Record<string, string>>;
@@ -0,0 +1,112 @@
1
+ import type { RunOnceDispatchPacket } from "./session.types.js";
2
+ import { type CompletionPhase, type DebugCompletionPhase, type DecomposeCompletionGate, type DevelopCompletionPhase, type DraftCompletionGate, type QaCompletionGate } from "./phase-completion.js";
3
+ export declare function normalizeArtifactPayload(payload: Record<string, unknown>, defaults: {
4
+ readonly phase: CompletionPhase;
5
+ readonly workItemId: string;
6
+ readonly ownerType?: string;
7
+ readonly ownerId?: string;
8
+ readonly producedBy: string;
9
+ readonly status: string;
10
+ }): Record<string, unknown>;
11
+ export declare function normalizeQaGateArtifactPayload(payload: Record<string, unknown>, defaults: {
12
+ readonly gate: QaCompletionGate;
13
+ readonly workItemId: string;
14
+ readonly ownerType?: string;
15
+ readonly ownerId?: string;
16
+ readonly producedBy: string;
17
+ readonly status: string;
18
+ }): Record<string, unknown>;
19
+ export declare function reportMarkdown(payload: Record<string, unknown>, phase: CompletionPhase, status: string, producedBy: string, contentHash: string): string;
20
+ export declare function parseStrictCompletionPhase(value: string | null | undefined): CompletionPhase | null;
21
+ export declare function normalizeDebugCompletionPhase(value: string | null | undefined): DebugCompletionPhase | null;
22
+ export declare function isDevelopCompletionPhase(phase: CompletionPhase): phase is DevelopCompletionPhase;
23
+ export declare function isDebugCompletionPhase(phase: string | null | undefined): phase is DebugCompletionPhase;
24
+ export declare function asDebugCompletionPhase(phase: CompletionPhase): DebugCompletionPhase;
25
+ export declare function parseCompletionRedactionSecrets(raw: string | undefined): readonly string[];
26
+ export declare function phaseFromToolName(toolName: string): CompletionPhase;
27
+ export declare function draftGateFromToolName(toolName: string): DraftCompletionGate | null;
28
+ export declare function decomposeGateFromToolName(toolName: string): DecomposeCompletionGate | null;
29
+ export declare function isDecomposeDispatch(dispatch: RunOnceDispatchPacket): boolean;
30
+ export declare function debugGateFromToolName(toolName: string): DebugCompletionPhase | null;
31
+ export declare function qaGateFromToolName(toolName: string): QaCompletionGate | null;
32
+ export declare function requireField(payload: Record<string, unknown>, key: string): void;
33
+ export declare function requireNonPassEvidence(payload: Record<string, unknown>): void;
34
+ export declare function requireImplementationEvidence(payload: Record<string, unknown>): void;
35
+ export declare function requirePassingCommands(payload: Record<string, unknown>): void;
36
+ export declare function requireArray(payload: Record<string, unknown>, key: string): void;
37
+ export declare function requireNonEmptyArray(payload: Record<string, unknown>, key: string): void;
38
+ export declare function arrayLength(payload: Record<string, unknown>, key: string): number;
39
+ export declare function requireAllowedStatus(payload: Record<string, unknown>, key: string, allowed: readonly string[]): void;
40
+ export declare function requireObject(payload: Record<string, unknown>, key: string): void;
41
+ export declare function requiredRecord(payload: Record<string, unknown>, key: string): Record<string, unknown>;
42
+ export declare function requireBoolean(payload: Record<string, unknown>, key: string): void;
43
+ export declare function requireNumericOne(payload: Record<string, unknown>, key: string, pathLabel: string): void;
44
+ export declare function requireSatisfiedAcceptanceCriteria(payload: Record<string, unknown>): void;
45
+ export declare function validateResolvedFindings(payload: Record<string, unknown>): void;
46
+ export declare function qaEvidenceSource(payload: Record<string, unknown>): Record<string, unknown>;
47
+ export declare function qaArray(payload: Record<string, unknown>, key: string, fallback?: Record<string, unknown>): readonly unknown[];
48
+ export declare function qaObjectArray(payload: Record<string, unknown>, key: string): Record<string, unknown>[];
49
+ export declare function qaPolicyWarnings(payload: Record<string, unknown>): Record<string, unknown>[];
50
+ export declare function qaStringArray(payload: Record<string, unknown>, key: string): string[];
51
+ export declare function requireEvidenceRecord(value: unknown, label: string): void;
52
+ export declare function requireNonEmptyStringRecord(source: Record<string, unknown>, key: string, prefix?: string): void;
53
+ export declare function requireArrayRecord(source: Record<string, unknown>, key: string, prefix?: string): void;
54
+ export declare function requireKnownStringRecord(source: Record<string, unknown>, key: string, allowed: ReadonlySet<string>, prefix?: string): void;
55
+ export declare function requireNonEmptyStringArrayRecord(source: Record<string, unknown>, key: string, prefix?: string): void;
56
+ export declare function requireSubstantiveValueRecord(source: Record<string, unknown>, key: string, prefix?: string): void;
57
+ export declare function requireSubstantiveEvidenceRecord(source: Record<string, unknown>, prefix?: string): void;
58
+ export declare function hasSubstantiveJsonValue(value: unknown): boolean;
59
+ export declare function normalizedString(value: unknown): string;
60
+ export declare function normalizedOwnerType(value: unknown): "work_item" | "story" | undefined;
61
+ export declare function artifactOwnerFields(config: {
62
+ readonly workItemId: string;
63
+ readonly ownerType?: string;
64
+ readonly ownerId?: string;
65
+ }): {
66
+ readonly owner_type?: string;
67
+ readonly owner_id?: string;
68
+ };
69
+ export declare function artifactReferenceOwnerFields(config: {
70
+ readonly workItemId: string;
71
+ readonly ownerType?: string;
72
+ readonly ownerId?: string;
73
+ }): {
74
+ readonly ownerType?: string;
75
+ readonly ownerId?: string;
76
+ };
77
+ export declare function artifactOwnerDirectory(ownerType: string): string;
78
+ export declare function artifactOwnerRelativeRoot(ownerType: string | undefined, ownerId: string | undefined, workItemId: string): string;
79
+ export declare function defaultQaChecklist(status: string): string[];
80
+ export declare function qaArtifactRelativePath(workItemId: string, fileName: string): string;
81
+ export declare function qaArtifactRelativePathForOwner(ownerType: string, ownerId: string, fileName: string): string;
82
+ export declare function jsonText(value: unknown): string;
83
+ export declare function fallbackReport(parsed: Record<string, unknown>, phase: CompletionPhase, artifactPath: string): string;
84
+ export declare function parseJsonObject(content: string, label: string): Record<string, unknown>;
85
+ export declare function parseOptionalJsonObject(content: string, label: string): Record<string, unknown>;
86
+ export declare function asRecord(value: unknown, label: string): Record<string, unknown>;
87
+ export declare function asMutableRecord(value: unknown): Record<string, unknown>;
88
+ export declare function requiredString(source: Record<string, unknown>, key: string): string;
89
+ export declare function optionalString(source: Record<string, unknown>, key: string): string | null;
90
+ export declare function numberOrDefault(value: unknown, fallback: number): number;
91
+ export declare function stripUndefined(value: Record<string, unknown>): Record<string, unknown>;
92
+ export declare function safePathSegment(value: string, label: string): string;
93
+ export declare function readOptionalFile(filePath: string): Promise<string | null>;
94
+ export declare function writeFileAtomic(filePath: string, content: string): Promise<void>;
95
+ export declare function stableStringify(value: unknown): string;
96
+ export declare function sortJson(value: unknown): unknown;
97
+ export declare function sha256(content: string): string;
98
+ export declare function forgeBridgeCliBinPath(): string;
99
+ export declare function tomlString(value: string): string;
100
+ export declare function tomlStringArray(values: readonly string[]): string;
101
+ export declare function writeJsonRpc(message: unknown): void;
102
+ export declare function rpcError(code: number, message: string): {
103
+ readonly code: number;
104
+ readonly message: string;
105
+ };
106
+ export declare function asJsonRpcMessage(value: unknown): {
107
+ readonly id?: string | number | null;
108
+ readonly method: string;
109
+ readonly params?: unknown;
110
+ } | null;
111
+ export declare function errorMessage(error: unknown): string;
112
+ export declare function isNodeError(error: unknown): error is NodeJS.ErrnoException;