Boundaries of synchronous invocation, cancellation, and receipts
The policy implementation follows.
ts
export function executeInvocation<Input, Context>(
invocation: InvocationHandler<Input, Context>,
input: Input,
context: Context,
ports: ToolInvocationPorts<Context> = {},
): void {
let logger: import('../structs/debug.js').SubFlowLogger | undefined;
try {
logger = ports.logger?.(context);
} catch {
/* Optional recording cannot block execution. */
}
const callId = invocationId();
return nativeSubFlowSync(
{
logger,
invocationId: callId,
get signal() {
return ports.signal?.(context);
},
},
'invocation',
invocation.id,
(scopedLogger) => runInvocation(invocation, input, context, ports, scopedLogger, callId),
);
}