InteropContextView
Java-friendly view of a Context: each method except emit and runNodeBlocking calls the suspend method of the same name and returns a CompletableFuture of its result, so Java callers never pass a Continuation; those two instead block and work only in a Java FunctionNode body, and emit ignores the coroutine context given to of. Each future-returning call runs in the caller's OpenTelemetry context, on the calling thread until it first suspends (so runNode children get their run IDs in call order) and then on Dispatchers.IO, as PublisherRunner runs agents. Each future-returning call is canceled with its future and with the Job given to of, if any, or otherwise when the node run that owns the context, if any, ends, so await each call before the node finishes.
Functions
Calls Context.addEventsToMemory.
Calls Context.addMemory.
Calls Context.addSessionToMemory.
Sends event from this node's running Java FunctionNode body or a thread it uses, after earlier calls' events and before the output, or after it if a useAsOutput child already sent the output. A non-partial call returns once the run has stored the event and passed it on; a partial one returns at once, and its event is neither stored nor given state. The event carries the state written before the call, or with an event another thread sent just before it, so use state only on the thread that calls emit.
Calls Context.getAuthResponse. The future completes with null if the app has not sent the credential back yet.
Calls Context.getEvents.
Calls Context.listArtifacts.
Calls Context.loadArtifact, which loads the latest version when version is null. The future completes with null if there is no such artifact or no artifact service.
Calls Context.runNode with the options in config; the future completes with the child's output, or null when it has none. Catch only failures you handle, such as DynamicNodeFailedException: when node pauses for input, the future fails with an internal Throwable that must end the calling node's run, so that the calling node waits too. node starts when this is called, before the calling node's published events are stored, so pass any data node needs as nodeInput or write that data to state in an earlier node.
Runs node with the default RunNodeConfig and returns its output, or null if it produces none.
Runs node as a child of the current Java FunctionNode body and blocks until it finishes. Returns the child's output, or null if it produces none.
Calls Context.saveArtifact; the returned future completes with the saved version. Await it before the node emits another output or finishes, because only a later event from the node records the version in the session.