Interfaces
HttpErrorRespond
An HTTP error capture pasted whole: status + the wire error body.
Properties
ScriptEntry
Properties
| Property | Type | Description |
|---|---|---|
match? | ScriptMatcher | Absent ⇒ unconditional next-in-queue. |
respond | ScriptRespond | - |
ScriptingEntry
A script entry as authored: broker entries plus the HTTP-capture error form.
Properties
| Property | Type |
|---|---|
match? | ScriptMatcher |
respond | | HttpErrorRespond | ScriptRespond |
Type Aliases
ScriptMatcher
type ScriptMatcher = string | RegExp | (req: GenerateContentRequest) => boolean;
Matcher: substring / regex against the last user turn text, or a predicate on the request.
ScriptRespond
type ScriptRespond = ScriptShorthand | RawEnvelope;
Functions
encodeSse()
function encodeSse(envelopes: WireResponse[]): string;
Encode complete response envelopes as the captured SSE framing bytes:
every event is data: <complete JSON>, events separated by CRLF CRLF
(ai-generate-stream-framing: allEventsDataPrefixed, separatorIsCrlfCrlf).
Parameters
| Parameter | Type |
|---|---|
envelopes | WireResponse[] |
Returns
string
script()
function script(ai: AI, entries: ScriptingEntry[]): void;
Append entries to the scripted engine behind a sandbox AI handle. Entries are consumed at most once, first unconsumed match wins, matcher-less entries are unconditional FIFO (broker semantics).
Parameters
| Parameter | Type |
|---|---|
ai | AI |
entries | ScriptingEntry[] |
Returns
void