api or storage; pure transformation belongs to util; reusable domain behavior is addressed through lib.LibraryName.ElementKey.member.
Use lib for shared-library calls and exported type references.
Libraries use named exports in JS and TS. The permanent @default element exposes lib.LibraryName.member, with lib.LibraryName['@default'].member as the same binding. Unexported declarations stay local to their element. @default export names cannot match any element key, including exported types. Use named export declarations or local named export clauses; ES default exports, module imports, external re-exports and source CommonJS exports are unsupported.
Context and control
api.getExecutionId() to correlate the current execution with traces, logs, and operations history.
Nested execution
options: { executionHost: 'remote' } when the child must run through the separate Sandbox host.
Calls inherit the caller’s remaining deadline and nesting is limited to five levels. A local child also receives the caller’s cancellation signal. Remote calls require at least one second of remaining time. Use a library when you only need shared business logic within the current execution.
To execute one independent JavaScript or TypeScript element, pass the optional selector:
elementKey must exactly match one unique existing key, including case. Only that element runs; predecessors, dependencies and earlier results are not supplied implicitly. Omitting executionMode, or choosing all, preserves ordered execution of all elements even if elementKey is present. Selection is available for local and remote child execution on supporting backends and retains full-Component authorization, approval and artifact identity. It does not change the child isolation or deadline rules above. See Sandbox selection and widget source selection.
Utilities
randomBytes, randomInt and timing-safe
comparisons return values synchronously. They do not require await.
String byte limits use UTF-8. Invalid types/options throw
TypeError; size/range
violations throw RangeError. Unsupported extra arguments are rejected for these
bounded helpers. Limits apply to individual calls; they do not guarantee a total
CPU or memory budget for the Component. UUID, JWT and base64 helpers also remain
synchronous.
Asynchronous crypto can reduce time spent blocking request processing; it does not
limit CPU consumption. Key import and data conversion still have a cost,
especially for encrypted private keys or large payloads.
Agents
Theagent namespace exposes Agent, run, inbox, plugin, and Assistant-thread operations to approved runtime code. Exact operations and authorization are shown in the generated editor declarations and Platform API reference.
The technical key @default is available only in JS/TS libraries. Ordinary DEFAULT nodes keep their existing qualified paths and order. TypeScript type names use the short namespace; the bracket alias exposes runtime values. Primitive exports are captured at initialization; expose functions for mutable state.
Every JS/TS library includes a permanent @default, initially a documentation comment only. The API rejects renaming, deleting or replacing it. Node order affects editor sorting; proxy dependency resolution does not require an earlier node. See Libraries for complete authoring and consumption examples.
