@sema-agent/core
Version:
Stateless, task-oriented AI agent core
27 lines (26 loc) • 1.94 kB
TypeScript
/**
* The provider echo shape — the ONE alphabet for upstream bytes the engine carries verbatim (#1204): visible ASCII
* (0x21–0x7E — no space, no control byte, no non-ASCII), 1–128 characters. The echo fields (`requestId`,
* `responseModel`) are carried or dropped by it, and a provider-minted tool-call id is admitted verbatim or folded
* by it (`tool-call-id.ts`).
*
* Zero-dependency leaf: `tool-call-id.ts` (itself a leaf, see its header) reads the shape from here. `errors.ts`
* re-exports the two public names, which is where the package root takes them from.
*/
/** The longest value the shape admits. */
export declare const PROVIDER_ECHO_MAX_CHARS = 128;
/**
* The shape a provider ECHO field must have to be carried: the request id a provider states on a response
* header (`AssistantMessage.requestId`, projected as `TaskResult.apiFailure.requestId`) and the model name it
* reports answering (`AssistantMessage.responseModel`). Both are UPSTREAM BYTES that end up persisted in a
* transcript and rendered by a UI, so one alphabet governs both: visible ASCII (0x21–0x7E — no space, no
* control byte, no non-ASCII), 1–128 characters. A value outside it is dropped (the field is absent), never
* truncated or rewritten; the empty string is outside it. No flags, so `test` is stateless. This object is the
* consumer's copy: the engine judges with its own instance built from the same source, so recompiling or
* otherwise mutating this one cannot change what the engine admits.
*/
export declare const PROVIDER_ECHO_SHAPE: RegExp;
/** Does `value` fit {@link PROVIDER_ECHO_SHAPE}? A non-string answers `false` (a JS caller's number is not an echo). */
export declare function isProviderEchoShape(value: string): boolean;
/** Is every character of `value` in the shape's alphabet, whatever its length? (`""` answers `true`.) */
export declare function fitsProviderEchoCharset(value: string): boolean;