MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / printExecutionOutcome

Function printExecutionOutcome

apps/cli/src/main.ts:1012–1051  ·  view source on GitHub ↗
(input: {
  target: ServerTarget;
  connection: ExecutorServerConnection;
  outcome: ExecuteCodeOutcome;
})

Source from the content-addressed store, hash-verified

1010 : `--base-url ${shellQuoteArg(target.baseUrl ?? connection.origin)}`;
1011
1012const printExecutionOutcome = (input: {
1013 target: ServerTarget;
1014 connection: ExecutorServerConnection;
1015 outcome: ExecuteCodeOutcome;
1016}) =>
1017 Effect.sync(() => {
1018 if (input.outcome.status === "paused") {
1019 console.log(input.outcome.text);
1020 if (input.outcome.executionId) {
1021 if (input.outcome.approvalUrl) {
1022 console.log("\nApprove in browser:");
1023 console.log(` ${input.outcome.approvalUrl}`);
1024 }
1025 const commandPrefix = `${cliPrefix} resume --execution-id ${input.outcome.executionId} ${serverTargetResumeFlag(input.target, input.connection)}`;
1026 if (input.outcome.interaction?.kind === "form") {
1027 const requestedSchema = input.outcome.interaction.requestedSchema;
1028 if (requestedSchema && Object.keys(requestedSchema).length > 0) {
1029 console.log(`\nRequested schema:\n${JSON.stringify(requestedSchema, null, 2)}`);
1030 }
1031 const template = buildResumeContentTemplate(requestedSchema);
1032 const contentArg = shellQuoteArg(JSON.stringify(template));
1033 console.log("\nCLI fallback:");
1034 console.log(` ${commandPrefix} --action accept --content ${contentArg}`);
1035 console.log(` ${commandPrefix} --action decline`);
1036 console.log(` ${commandPrefix} --action cancel`);
1037 } else {
1038 console.log("\nCLI fallback:");
1039 console.log(` ${commandPrefix} --action accept`);
1040 }
1041 }
1042 return;
1043 }
1044
1045 if (typeof input.outcome.result === "string") {
1046 console.log(input.outcome.result);
1047 return;
1048 }
1049
1050 console.log(JSON.stringify(input.outcome.result, null, 2));
1051 });
1052
1053// ---------------------------------------------------------------------------
1054// Typed API client

Callers 1

main.tsFile · 0.85

Calls 5

shellQuoteArgFunction · 0.90
serverTargetResumeFlagFunction · 0.85
logMethod · 0.80
syncMethod · 0.65

Tested by

no test coverage detected