(input: {
client: any;
runtime: RuntimeMode;
planContent: string;
sharingEnabled: boolean;
shareBaseUrl?: string;
pasteApiUrl?: string;
htmlContent: string;
timeoutSeconds: number | null;
cwd?: string;
bridge: OpenCodeBridgeContext;
})
| 229 | } |
| 230 | |
| 231 | async function runPlanReview(input: { |
| 232 | client: any; |
| 233 | runtime: RuntimeMode; |
| 234 | planContent: string; |
| 235 | sharingEnabled: boolean; |
| 236 | shareBaseUrl?: string; |
| 237 | pasteApiUrl?: string; |
| 238 | htmlContent: string; |
| 239 | timeoutSeconds: number | null; |
| 240 | cwd?: string; |
| 241 | bridge: OpenCodeBridgeContext; |
| 242 | }): Promise<OpenCodePlanReviewResult> { |
| 243 | if (input.runtime === "embedded" && !hasEmbeddedRuntime()) { |
| 244 | throw new Error(getEmbeddedRuntimeError()); |
| 245 | } |
| 246 | |
| 247 | if (shouldUseEmbeddedRuntime(input.runtime)) { |
| 248 | try { |
| 249 | const embedded = await importEmbeddedRuntime(); |
| 250 | return await embedded.runEmbeddedPlanReview({ |
| 251 | client: input.client, |
| 252 | planContent: input.planContent, |
| 253 | sharingEnabled: input.sharingEnabled, |
| 254 | shareBaseUrl: input.shareBaseUrl, |
| 255 | pasteApiUrl: input.pasteApiUrl, |
| 256 | htmlContent: input.htmlContent, |
| 257 | timeoutSeconds: input.timeoutSeconds, |
| 258 | logReady: (url) => logPlannotatorReady(input.client, "plan review", url), |
| 259 | }); |
| 260 | } catch (error) { |
| 261 | if (input.runtime === "embedded") throw error; |
| 262 | try { |
| 263 | void input.client.app.log({ |
| 264 | level: "error", |
| 265 | message: `[Plannotator] Embedded runtime unavailable; falling back to CLI: ${error instanceof Error ? error.message : String(error)}`, |
| 266 | }); |
| 267 | } catch {} |
| 268 | } |
| 269 | } |
| 270 | |
| 271 | return await runCliPlanReview({ |
| 272 | client: input.client, |
| 273 | planContent: input.planContent, |
| 274 | cwd: input.cwd, |
| 275 | timeoutSeconds: input.timeoutSeconds, |
| 276 | bridge: input.bridge, |
| 277 | }); |
| 278 | } |
| 279 | |
| 280 | const PlannotatorPlugin: Plugin = async (ctx, rawOptions?: PlannotatorOpenCodeOptions) => { |
| 281 | const workflowOptions = normalizeWorkflowOptions(rawOptions); |
no test coverage detected