(input: {
target: ServerTarget;
connection: ExecutorServerConnection;
outcome: ExecuteCodeOutcome;
})
| 1024 | : `--base-url ${shellQuoteArg(target.baseUrl ?? connection.origin)}`; |
| 1025 | |
| 1026 | const printExecutionOutcome = (input: { |
| 1027 | target: ServerTarget; |
| 1028 | connection: ExecutorServerConnection; |
| 1029 | outcome: ExecuteCodeOutcome; |
| 1030 | }) => |
| 1031 | Effect.sync(() => { |
| 1032 | if (input.outcome.status === "paused") { |
| 1033 | console.log(input.outcome.text); |
| 1034 | if (input.outcome.executionId) { |
| 1035 | if (input.outcome.approvalUrl) { |
| 1036 | console.log("\nApprove in browser:"); |
| 1037 | console.log(` ${input.outcome.approvalUrl}`); |
| 1038 | } |
| 1039 | const commandPrefix = `${cliPrefix} resume --execution-id ${input.outcome.executionId} ${serverTargetResumeFlag(input.target, input.connection)}`; |
| 1040 | if (input.outcome.interaction?.kind === "form") { |
| 1041 | const requestedSchema = input.outcome.interaction.requestedSchema; |
| 1042 | if (requestedSchema && Object.keys(requestedSchema).length > 0) { |
| 1043 | console.log(`\nRequested schema:\n${JSON.stringify(requestedSchema, null, 2)}`); |
| 1044 | } |
| 1045 | const template = buildResumeContentTemplate(requestedSchema); |
| 1046 | const contentArg = shellQuoteArg(JSON.stringify(template)); |
| 1047 | console.log("\nCLI fallback:"); |
| 1048 | console.log(` ${commandPrefix} --action accept --content ${contentArg}`); |
| 1049 | console.log(` ${commandPrefix} --action decline`); |
| 1050 | console.log(` ${commandPrefix} --action cancel`); |
| 1051 | } else { |
| 1052 | console.log("\nCLI fallback:"); |
| 1053 | console.log(` ${commandPrefix} --action accept`); |
| 1054 | } |
| 1055 | } |
| 1056 | return; |
| 1057 | } |
| 1058 | |
| 1059 | if (typeof input.outcome.result === "string") { |
| 1060 | console.log(input.outcome.result); |
| 1061 | return; |
| 1062 | } |
| 1063 | |
| 1064 | console.log(JSON.stringify(input.outcome.result, null, 2)); |
| 1065 | }); |
| 1066 | |
| 1067 | // --------------------------------------------------------------------------- |
| 1068 | // Typed API client |
no test coverage detected