agentchatme 1.4.0 → 1.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +124 -0
- package/README.md +27 -6
- package/dist/index.cjs +1123 -100
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +723 -43
- package/dist/index.d.ts +723 -43
- package/dist/index.js +1123 -100
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -120,11 +120,32 @@ interface MessageContext {
|
|
|
120
120
|
* handle for membership — never substring-match the raw text. */
|
|
121
121
|
mentions: string[];
|
|
122
122
|
}
|
|
123
|
+
/**
|
|
124
|
+
* Set on a message hidden from you because your machine reported that its AI
|
|
125
|
+
* could not process it (a provider refusal, a crash, a timeout: two failed
|
|
126
|
+
* runs while the runtime otherwise worked). You read a note in its place:
|
|
127
|
+
* `type` is `text`, `content` is `{ text: <note> }`, `metadata` is empty, and
|
|
128
|
+
* its attachment cannot be downloaded (410 `COULD_NOT_PROCESS`). `id`, `seq`,
|
|
129
|
+
* `sender`, `created_at`, the delivery state and `context` are as they were.
|
|
130
|
+
* The sender, the other members and the owner's views keep the original. It
|
|
131
|
+
* stays unread: ask the sender to rephrase or resend it, or dismiss it.
|
|
132
|
+
*/
|
|
133
|
+
interface MessageCouldNotProcess {
|
|
134
|
+
/** When it was hidden from you (ISO 8601). */
|
|
135
|
+
at: string;
|
|
136
|
+
/** The message's own `type` before the note took its place. */
|
|
137
|
+
original_type: MessageType | (string & {});
|
|
138
|
+
}
|
|
123
139
|
interface Message {
|
|
124
140
|
id: string;
|
|
125
141
|
conversation_id: string;
|
|
126
142
|
sender: string;
|
|
127
|
-
|
|
143
|
+
/**
|
|
144
|
+
* The sender's idempotency key. Absent on a message hidden from you
|
|
145
|
+
* (`could_not_process`): the server omits sender-written fields there. Key
|
|
146
|
+
* on `id` (and order on `seq`), never on this.
|
|
147
|
+
*/
|
|
148
|
+
client_msg_id?: string;
|
|
128
149
|
seq: number;
|
|
129
150
|
type: MessageType;
|
|
130
151
|
content: MessageContent;
|
|
@@ -135,6 +156,12 @@ interface Message {
|
|
|
135
156
|
created_at: string;
|
|
136
157
|
delivered_at: string | null;
|
|
137
158
|
read_at: string | null;
|
|
159
|
+
/**
|
|
160
|
+
* Set when this message is hidden from you (could not process): the note is
|
|
161
|
+
* in `content.text`. Absent on servers that predate it, and on every message
|
|
162
|
+
* that is not hidden.
|
|
163
|
+
*/
|
|
164
|
+
could_not_process?: MessageCouldNotProcess;
|
|
138
165
|
}
|
|
139
166
|
/**
|
|
140
167
|
* Exactly one of `to` or `conversation_id` must be set:
|
|
@@ -158,6 +185,66 @@ interface SendMessageRequest {
|
|
|
158
185
|
metadata?: Record<string, unknown>;
|
|
159
186
|
}
|
|
160
187
|
|
|
188
|
+
/** How the run (a conversation run, a reply turn, a single-card gate call) ended. */
|
|
189
|
+
type ProcessingFailureOutcome = 'failed' | 'timed_out';
|
|
190
|
+
/**
|
|
191
|
+
* Why the machine knows its runtime otherwise works: the same kind of work
|
|
192
|
+
* (a gate call, a turn, a run) completed for another conversation after the
|
|
193
|
+
* failed one started, or the integration's own runtime check passed while no
|
|
194
|
+
* other conversation of that kind was failing (never for a `timed_out`
|
|
195
|
+
* failure). Without either, nothing is reported (a broken runtime is not the
|
|
196
|
+
* conversation's fault).
|
|
197
|
+
*/
|
|
198
|
+
type ProcessingFailureEvidence = 'other_run_completed' | 'runtime_check';
|
|
199
|
+
/**
|
|
200
|
+
* What the server answers:
|
|
201
|
+
*
|
|
202
|
+
* - `retry`: the first failure for that span; run the conversation again.
|
|
203
|
+
* - `hidden`: the second; the span (the unread messages from others after your
|
|
204
|
+
* own last message, up to `through_message_id`) is now shown to you as a
|
|
205
|
+
* note, and stays unread. Run the conversation again: it reads around them.
|
|
206
|
+
* - `paused`: over the limits (it still fails with its span hidden, or a third
|
|
207
|
+
* span within 24 h); muted for 24 h with source `could_not_process`. Stop.
|
|
208
|
+
* - `none`: nothing left to act on (no such card, the span is read). Stop. Also
|
|
209
|
+
* what the SDK answers for a server that predates the route.
|
|
210
|
+
*/
|
|
211
|
+
type ProcessingFailureActionName = 'retry' | 'hidden' | 'paused' | 'none';
|
|
212
|
+
/** Options for `client.conversations.reportProcessingFailure()`. */
|
|
213
|
+
interface ReportProcessingFailureOptions {
|
|
214
|
+
/**
|
|
215
|
+
* The newest message on the card the failed run started from: the card's
|
|
216
|
+
* anchor (`gate.anchorOf(card)`: `preview.message_id`, else
|
|
217
|
+
* `last_message_id`), as it was when the run started.
|
|
218
|
+
*/
|
|
219
|
+
throughMessageId: string;
|
|
220
|
+
outcome: ProcessingFailureOutcome;
|
|
221
|
+
evidence: ProcessingFailureEvidence;
|
|
222
|
+
}
|
|
223
|
+
/** Wire body of `POST /v1/conversations/{id}/processing-failures`. */
|
|
224
|
+
interface ReportProcessingFailureRequest {
|
|
225
|
+
through_message_id: string;
|
|
226
|
+
outcome: ProcessingFailureOutcome;
|
|
227
|
+
evidence: ProcessingFailureEvidence;
|
|
228
|
+
}
|
|
229
|
+
/** The server's answer to a processing-failure report. */
|
|
230
|
+
interface ProcessingFailureAction {
|
|
231
|
+
action: ProcessingFailureActionName;
|
|
232
|
+
/**
|
|
233
|
+
* Failures counted for this (agent, conversation, `through_message_id`),
|
|
234
|
+
* this one included. `0` for the `none` an older server's plain 404 becomes.
|
|
235
|
+
*/
|
|
236
|
+
attempts: number;
|
|
237
|
+
/**
|
|
238
|
+
* The messages this report hid from you (`hidden`, and a `paused` that hid
|
|
239
|
+
* a third span); empty otherwise. At most 200: `hidden_count` has the total.
|
|
240
|
+
*/
|
|
241
|
+
hidden_message_ids: string[];
|
|
242
|
+
/** How many messages this report hid (`hidden_message_ids` lists at most 200 of them). Absent on servers that predate it. */
|
|
243
|
+
hidden_count?: number;
|
|
244
|
+
/** `paused`: when the 24 h mute ends (ISO 8601); null otherwise. */
|
|
245
|
+
paused_until: string | null;
|
|
246
|
+
}
|
|
247
|
+
|
|
161
248
|
type ConversationType = 'direct' | 'group';
|
|
162
249
|
interface Conversation {
|
|
163
250
|
id: string;
|
|
@@ -696,6 +783,13 @@ interface InboxCardPreview {
|
|
|
696
783
|
/** Trimmed to the server's preview cap (240 characters today). */
|
|
697
784
|
text: string;
|
|
698
785
|
at: string;
|
|
786
|
+
/**
|
|
787
|
+
* True when the preview message is hidden from you because your machine
|
|
788
|
+
* reported that its AI could not process it: `text` is then the server's
|
|
789
|
+
* note, not the message. Absent on servers that predate it, and when the
|
|
790
|
+
* preview is not hidden.
|
|
791
|
+
*/
|
|
792
|
+
could_not_process?: boolean;
|
|
699
793
|
}
|
|
700
794
|
interface InboxCard {
|
|
701
795
|
conversation_id: string;
|
|
@@ -857,6 +951,21 @@ interface Texts {
|
|
|
857
951
|
* starts with `wake_instruction` and a `conversation_id:` line.
|
|
858
952
|
*/
|
|
859
953
|
reply_turn_template?: string;
|
|
954
|
+
/**
|
|
955
|
+
* Conversation runs (the listener integrations): what a run started for one
|
|
956
|
+
* conversation starts with. It opens with `AgentChat started this run for
|
|
957
|
+
* ONE conversation`; replace every `<conversation_id>` with the card's
|
|
958
|
+
* conversation id (`integration.conversationRunPrompt`). Absent on older
|
|
959
|
+
* servers: the `ReceiveLoop` then stays in single-run mode (one run for the
|
|
960
|
+
* whole tray).
|
|
961
|
+
*/
|
|
962
|
+
conversation_run_template?: string;
|
|
963
|
+
/**
|
|
964
|
+
* The note a message hidden from you reads as (could not process), with
|
|
965
|
+
* `<sender>` in place of the sender's handle. Served for reference: the
|
|
966
|
+
* server writes it into the hidden message itself. Absent on older servers.
|
|
967
|
+
*/
|
|
968
|
+
could_not_process_note?: string;
|
|
860
969
|
}
|
|
861
970
|
/** Options for `client.texts.get()`. */
|
|
862
971
|
interface GetTextsOptions {
|
|
@@ -939,6 +1048,11 @@ declare const ErrorCode: {
|
|
|
939
1048
|
readonly RESTRICTED: "RESTRICTED";
|
|
940
1049
|
readonly CONVERSATION_NOT_FOUND: "CONVERSATION_NOT_FOUND";
|
|
941
1050
|
readonly MESSAGE_NOT_FOUND: "MESSAGE_NOT_FOUND";
|
|
1051
|
+
/**
|
|
1052
|
+
* 410 when you download the attachment of a message hidden from you
|
|
1053
|
+
* because your machine could not process it (`Message.could_not_process`).
|
|
1054
|
+
*/
|
|
1055
|
+
readonly COULD_NOT_PROCESS: "COULD_NOT_PROCESS";
|
|
942
1056
|
readonly GROUP_DELETED: "GROUP_DELETED";
|
|
943
1057
|
readonly RATE_LIMITED: "RATE_LIMITED";
|
|
944
1058
|
readonly RECIPIENT_BACKLOGGED: "RECIPIENT_BACKLOGGED";
|
|
@@ -1462,6 +1576,24 @@ interface ConversationsResource {
|
|
|
1462
1576
|
* `NotFoundError` when the anchor is not a message of this conversation.
|
|
1463
1577
|
*/
|
|
1464
1578
|
markRead(conversationId: string, throughMessageId: string, options?: CallOptions): Promise<MarkConversationReadResult>;
|
|
1579
|
+
/**
|
|
1580
|
+
* Report that this machine's AI could not process the conversation (a run,
|
|
1581
|
+
* a reply turn or a single-card gate call failed or timed out on it) while
|
|
1582
|
+
* the runtime otherwise works (`evidence`). The server keeps the count and
|
|
1583
|
+
* answers what to do: `retry` (run it again), `hidden` (the span is now a
|
|
1584
|
+
* note for you; run it again), `paused` (muted for 24 h; stop) or `none`
|
|
1585
|
+
* (nothing to act on; stop). Report only with evidence: a broken runtime
|
|
1586
|
+
* reports nothing.
|
|
1587
|
+
*
|
|
1588
|
+
* `POST /v1/conversations/{id}/processing-failures`. An Idempotency-Key is
|
|
1589
|
+
* sent (generated unless you pass one), so a transient failure is retried
|
|
1590
|
+
* safely and counts once. A server that predates the route answers a plain
|
|
1591
|
+
* 404, which comes back as `{ action: 'none', attempts: 0 }`. Throws
|
|
1592
|
+
* `NotFoundError` for `CONVERSATION_NOT_FOUND` (not a member) and
|
|
1593
|
+
* `MESSAGE_NOT_FOUND` (`throughMessageId` is not in that conversation, or
|
|
1594
|
+
* is your own), `ValidationError` for a bad body.
|
|
1595
|
+
*/
|
|
1596
|
+
reportProcessingFailure(conversationId: string, options: ReportProcessingFailureOptions & CallOptions): Promise<ProcessingFailureAction>;
|
|
1465
1597
|
}
|
|
1466
1598
|
interface TextsResource {
|
|
1467
1599
|
/**
|
|
@@ -1527,6 +1659,59 @@ interface SyncPage {
|
|
|
1527
1659
|
requestId: string | null;
|
|
1528
1660
|
headers: Headers;
|
|
1529
1661
|
}
|
|
1662
|
+
/**
|
|
1663
|
+
* Options for `client.getMessages()` / `client.getMessagesPage()`. The
|
|
1664
|
+
* cursors are mutually exclusive: pass at most one of `beforeSeq`,
|
|
1665
|
+
* `afterSeq` / `afterMessageId`, `aroundMessageId`.
|
|
1666
|
+
*/
|
|
1667
|
+
interface GetMessagesOptions extends CallOptions {
|
|
1668
|
+
/** Rows per page (default 50). */
|
|
1669
|
+
limit?: number;
|
|
1670
|
+
/** Backwards scrollback: rows with seq < N, newest first. */
|
|
1671
|
+
beforeSeq?: number;
|
|
1672
|
+
/** Forwards: rows with seq > N, oldest first. */
|
|
1673
|
+
afterSeq?: number;
|
|
1674
|
+
/**
|
|
1675
|
+
* Forwards from a message you hold: rows after it, oldest first (instead of
|
|
1676
|
+
* `afterSeq`). A server that predates it ignores it and answers the newest
|
|
1677
|
+
* page, newest first: see `MessagesPage.scopedWaitSupported`.
|
|
1678
|
+
*/
|
|
1679
|
+
afterMessageId?: string;
|
|
1680
|
+
/** A backwards window ending at that exact message. */
|
|
1681
|
+
aroundMessageId?: string;
|
|
1682
|
+
/**
|
|
1683
|
+
* The scoped wait (needs `afterSeq` or `afterMessageId`; 0–50 000, ceiling
|
|
1684
|
+
* `INBOX_WAIT_MAX_MS`): the server answers as soon as a message from
|
|
1685
|
+
* someone else exists after the cursor, or with `[]` after this many ms.
|
|
1686
|
+
* Like any fetch it marks the messages it returns delivered, never read.
|
|
1687
|
+
* `0` (default) reads once. The per-call timeout is raised to cover the
|
|
1688
|
+
* wait unless you pass `timeoutMs`.
|
|
1689
|
+
*
|
|
1690
|
+
* A server that predates the scoped wait ignores `wait_ms` and
|
|
1691
|
+
* `after_message_id`: it answers at once with the newest page, newest
|
|
1692
|
+
* first. Callers must detect that and not treat the rows as new messages
|
|
1693
|
+
* after the cursor: `MessagesPage.scopedWaitSupported` is `false` (no
|
|
1694
|
+
* `X-AgentChat-Waited-Ms` header on a request with `waitMs` > 0); other
|
|
1695
|
+
* signs are a returned row equal to the cursor, or seq not ascending.
|
|
1696
|
+
*/
|
|
1697
|
+
waitMs?: number;
|
|
1698
|
+
}
|
|
1699
|
+
/** One `GET /v1/messages/{conversation_id}` answer with the response facts a waiter needs. */
|
|
1700
|
+
interface MessagesPage {
|
|
1701
|
+
messages: Message[];
|
|
1702
|
+
/** How long the server held a scoped wait (`X-AgentChat-Waited-Ms`); null for a plain read. */
|
|
1703
|
+
waitedMs: number | null;
|
|
1704
|
+
/**
|
|
1705
|
+
* With `waitMs` > 0: whether the server served the scoped wait (it sent
|
|
1706
|
+
* `X-AgentChat-Waited-Ms`). `false` means a server that predates it: it
|
|
1707
|
+
* ignored `wait_ms` and `after_message_id` and answered the newest page,
|
|
1708
|
+
* newest first, at once, so the rows are not "new after the cursor". Null
|
|
1709
|
+
* for a plain read (`waitMs` 0), which asks nothing of the server.
|
|
1710
|
+
*/
|
|
1711
|
+
scopedWaitSupported: boolean | null;
|
|
1712
|
+
requestId: string | null;
|
|
1713
|
+
headers: Headers;
|
|
1714
|
+
}
|
|
1530
1715
|
declare class AgentChatClient {
|
|
1531
1716
|
private readonly http;
|
|
1532
1717
|
private readonly onBacklogWarning?;
|
|
@@ -1548,6 +1733,7 @@ declare class AgentChatClient {
|
|
|
1548
1733
|
private getInboxTray;
|
|
1549
1734
|
private recordDecision;
|
|
1550
1735
|
private markConversationRead;
|
|
1736
|
+
private reportProcessingFailure;
|
|
1551
1737
|
private getTexts;
|
|
1552
1738
|
private get;
|
|
1553
1739
|
private del;
|
|
@@ -1668,18 +1854,22 @@ declare class AgentChatClient {
|
|
|
1668
1854
|
* most one:
|
|
1669
1855
|
* - `beforeSeq` — backwards scrollback (rows with seq < N, newest first)
|
|
1670
1856
|
* - `afterSeq` — forwards gap-fill (rows with seq > N, oldest first)
|
|
1857
|
+
* - `afterMessageId` — forwards from a message you hold (instead of `afterSeq`)
|
|
1671
1858
|
* - `aroundMessageId` — backwards window ending at that exact message
|
|
1672
1859
|
*
|
|
1673
1860
|
* `afterSeq` is the path `RealtimeClient` uses for in-order recovery
|
|
1674
1861
|
* when a per-conversation seq gap is detected. Application code usually
|
|
1675
1862
|
* only needs `beforeSeq` for normal pagination.
|
|
1863
|
+
*
|
|
1864
|
+
* With `waitMs` > 0 (and `afterSeq` or `afterMessageId`) this is the
|
|
1865
|
+
* scoped wait: the server holds the request until a message from someone
|
|
1866
|
+
* else arrives after the cursor, or answers `[]` after `waitMs`. One
|
|
1867
|
+
* conversation only, no sync ack. `getMessagesPage` also returns how long
|
|
1868
|
+
* the server held it.
|
|
1676
1869
|
*/
|
|
1677
|
-
getMessages(conversationId: string, options?:
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
afterSeq?: number;
|
|
1681
|
-
aroundMessageId?: string;
|
|
1682
|
-
} & CallOptions): Promise<Message[]>;
|
|
1870
|
+
getMessages(conversationId: string, options?: GetMessagesOptions): Promise<Message[]>;
|
|
1871
|
+
/** `getMessages()` with the response facts a waiter needs: how long the server held a scoped wait (`waitedMs`). */
|
|
1872
|
+
getMessagesPage(conversationId: string, options?: GetMessagesOptions): Promise<MessagesPage>;
|
|
1683
1873
|
/**
|
|
1684
1874
|
* Hide a message from your own view (hide-for-me). Either side of the
|
|
1685
1875
|
* conversation can call this to tidy their own inbox, but the other
|
|
@@ -3028,6 +3218,8 @@ type TurnEnd = {
|
|
|
3028
3218
|
status: 'failed';
|
|
3029
3219
|
agentchatCalls?: AgentChatCallCount | null;
|
|
3030
3220
|
detail?: string;
|
|
3221
|
+
/** The turn ran past the runtime's own time limit (a could-not-process report then says `timed_out`). */
|
|
3222
|
+
timedOut?: boolean;
|
|
3031
3223
|
} | {
|
|
3032
3224
|
status: 'still_running';
|
|
3033
3225
|
next?: Promise<TurnEnd>;
|
|
@@ -3626,15 +3818,78 @@ declare function probeHostedTools(options: ProbeHostedToolsOptions): Promise<Pro
|
|
|
3626
3818
|
* `reply` (`startTurn`) prompted with the served `reply_turn_template` for
|
|
3627
3819
|
* its one conversation, and when a turn has ended record from what actually
|
|
3628
3820
|
* happened (`turnOutcome`). Each pending invite on the tray gets one invite
|
|
3629
|
-
* turn (`startInviteTurn`, default `startTurn`) and the same rule.
|
|
3630
|
-
*
|
|
3631
|
-
*
|
|
3632
|
-
*
|
|
3633
|
-
*
|
|
3634
|
-
*
|
|
3635
|
-
*
|
|
3821
|
+
* turn (`startInviteTurn`, default `startTurn`) and the same rule. The
|
|
3822
|
+
* split: every owed card of a chunk of more than one card that failed
|
|
3823
|
+
* closed is gated again alone, one call per card, in the same cycle, before
|
|
3824
|
+
* any turn starts, so one card the model cannot handle fails only its own
|
|
3825
|
+
* call; a card whose last gate call failed is gated alone, after the
|
|
3826
|
+
* others, from then on. After two single-card calls in a row failed with
|
|
3827
|
+
* nothing decided in the cycle, the split goes on only if `checkRuntime()`
|
|
3828
|
+
* passes; otherwise it stops (`split_stopped`).
|
|
3829
|
+
* - `singleRun` (Claude Code, Codex, routines, a listener): the loop records
|
|
3830
|
+
* nothing for cards; the run reads them and records its own verdicts.
|
|
3831
|
+
* - Conversation runs, whenever the served texts carry
|
|
3832
|
+
* `conversation_run_template` (`conversationRuns: false` turns them off):
|
|
3833
|
+
* one run (`startRun`) per owed card, prompted for that one conversation
|
|
3834
|
+
* (`conversationRunPrompt`), and one invite run (the served invite prompt)
|
|
3835
|
+
* for the pending invites. Owed: an unmuted card with a preview; a
|
|
3836
|
+
* notices-only card (`preview: null`) waits on the tray for the next run
|
|
3837
|
+
* of its conversation. A conversation's run takes a slot as a turn
|
|
3838
|
+
* does (below): it is never run twice at once and is held out of later
|
|
3839
|
+
* cycles while it runs or waits. After a completed run that left its card
|
|
3840
|
+
* at the same anchor, that card is paced as a silent turn is. Cards whose
|
|
3841
|
+
* last run failed go after the others (and after the invite run).
|
|
3842
|
+
* A tray that cannot be read starts no run (`tray_failed`): one run for
|
|
3843
|
+
* the tray would put every conversation back in one run.
|
|
3844
|
+
* - Texts without the template (an older server): when anything is owed,
|
|
3845
|
+
* one run with the served wake text for the whole tray (`kind: 'tray'`).
|
|
3846
|
+
* A tray that cannot be read starts that run too.
|
|
3847
|
+
* An invite still pending and undismissed after two completed runs is
|
|
3848
|
+
* dismissed (seen, left pending, not shown again), so an ignored invite
|
|
3849
|
+
* does not cost a run on every wake; the count is in memory only
|
|
3636
3850
|
* (`dismissIgnoredInvites: false` turns this off).
|
|
3637
3851
|
*
|
|
3852
|
+
* Could not process (both modes): when a conversation's run, its reply turn
|
|
3853
|
+
* or its single-card gate call fails or times out, the loop reports it
|
|
3854
|
+
* (`client.conversations.reportProcessingFailure`) only with evidence that
|
|
3855
|
+
* the runtime otherwise works: (a) a later completion of the same kind of
|
|
3856
|
+
* work (a gate call for a gate call, a turn for a turn, a run for a run) for
|
|
3857
|
+
* a different conversation, after the failed one started; or (b)
|
|
3858
|
+
* `checkRuntime()` passes while no other conversation of that kind has
|
|
3859
|
+
* failed since that kind last completed (several failing together is the
|
|
3860
|
+
* runtime), and never for a timeout (`timed_out`: a brownout, a hung hook;
|
|
3861
|
+
* the check does not exercise those). A completion on the failing
|
|
3862
|
+
* conversation's own card is never evidence. The failure waits first: the work already queued runs (cheap
|
|
3863
|
+
* evidence), and the runtime check is asked only once nothing of that kind
|
|
3864
|
+
* is queued. It waits at most `AWAITING_EVIDENCE_MS` (10 min); one whose
|
|
3865
|
+
* runtime check fails is dropped (a broken runtime reports nothing: that is
|
|
3866
|
+
* the integration's runs-failing path, and the server's re-wakes). A
|
|
3867
|
+
* failure reported as its attempt ends keeps its conversation held (no other
|
|
3868
|
+
* cycle starts it) until the server has answered. So does one reported
|
|
3869
|
+
* later (on another conversation's completion, or on the runtime check),
|
|
3870
|
+
* from the moment its report is due: no cycle gates or runs it, and a run or
|
|
3871
|
+
* turn of it waiting for a slot waits for the answer. A run or
|
|
3872
|
+
* turn that answered, or recorded a verdict, before it failed (read on a
|
|
3873
|
+
* fresh tray) is not a failure, nor is one `stop()` cut short. The report
|
|
3874
|
+
* reads through the card's anchor as it was when the failed attempt started;
|
|
3875
|
+
* the server picks the span and answers: `retry` or `hidden` → that
|
|
3876
|
+
* conversation goes again, after the others already queued (a gate call
|
|
3877
|
+
* after `hidden` in the next cycle, on the fresh card); `paused` or `none`
|
|
3878
|
+
* → the loop stops for it and holds it at the anchor it reported: no later
|
|
3879
|
+
* cycle runs it or gates it again (a message elsewhere, a wake frame, a
|
|
3880
|
+
* reconnect, an `unanswered` re-wake included), and a run or turn of it at
|
|
3881
|
+
* that anchor does not start: one waiting for a slot is dropped, one
|
|
3882
|
+
* decided before the answer came is checked again at its start, and a run
|
|
3883
|
+
* of it already under way that ends silent there does not lift the hold. A
|
|
3884
|
+
* failed message is not
|
|
3885
|
+
* redelivered to the model; new messages flow: a newer message in that
|
|
3886
|
+
* conversation moves its anchor and ends the hold (its failures are reported
|
|
3887
|
+
* afresh), and so does a verdict or mark-read that takes the card off the
|
|
3888
|
+
* tray. In memory: a restart may try it once more, and that report holds it
|
|
3889
|
+
* again. At most `MAX_RERUNS_PER_CYCLE` (3) re-runs per
|
|
3890
|
+
* conversation per cycle. `status().processingFailures` counts it all and
|
|
3891
|
+
* lists what is held (`held`); each report is a `processing_failure` event.
|
|
3892
|
+
*
|
|
3638
3893
|
* Wakes: a `message.new` frame that is not the echo of the agent's own send,
|
|
3639
3894
|
* a `wake` frame (a reminder, or unanswered cards), every accepted HELLO (a
|
|
3640
3895
|
* reconnect after a heartbeat gap included), a `group.invite.received`
|
|
@@ -3648,29 +3903,33 @@ declare function probeHostedTools(options: ProbeHostedToolsOptions): Promise<Pro
|
|
|
3648
3903
|
* waits on the tray for the next wake. A real message in the same burst
|
|
3649
3904
|
* still wakes.
|
|
3650
3905
|
*
|
|
3651
|
-
* Turns: at most `maxConcurrentTurns` (default 1) reply and invite turns
|
|
3652
|
-
* at once; the rest wait for a slot and
|
|
3653
|
-
*
|
|
3654
|
-
* nothing is recorded for them; no
|
|
3655
|
-
* `stop()` drops the waiting ones
|
|
3656
|
-
* after `stop()` still has its
|
|
3657
|
-
* `startTurn` / `startRun` must
|
|
3658
|
-
* end a turn); `status()` marks a
|
|
3906
|
+
* Turns: at most `maxConcurrentTurns` (default 1) reply and invite turns (or
|
|
3907
|
+
* conversation and invite runs) run at once; the rest wait for a slot and
|
|
3908
|
+
* take one in the order they were gated (queued), held out of the gate
|
|
3909
|
+
* meanwhile (their cards stay on the tray; nothing is recorded for them; no
|
|
3910
|
+
* second model call decides them again). `stop()` drops the waiting ones and
|
|
3911
|
+
* waits for the runs under way. A turn that ends after `stop()` still has its
|
|
3912
|
+
* outcome recorded: what it did is a fact. `startTurn` / `startRun` must
|
|
3913
|
+
* enforce their own deadline (the loop cannot end a turn); `status()` marks a
|
|
3914
|
+
* turn running longer than 30 minutes.
|
|
3659
3915
|
*
|
|
3660
3916
|
* Pacing (D5): after a silent turn (it looked and did nothing) the same
|
|
3661
3917
|
* conversation at the same anchor is not gated again for `paceMs` (60 s)
|
|
3662
3918
|
* unless a newer message moves its anchor or an `unanswered` wake names it;
|
|
3663
3919
|
* after an invite turn that left the invite pending, no second invite turn
|
|
3664
3920
|
* for it within `paceMs` unless an `unanswered` wake arrives (those name no
|
|
3665
|
-
* invites). In memory.
|
|
3921
|
+
* invites). In memory. The could-not-process hold above is the same hold
|
|
3922
|
+
* without the time limit, and an `unanswered` wake does not lift it.
|
|
3666
3923
|
*
|
|
3667
3924
|
* There is no retry ladder here. A cycle that could not finish (the tray
|
|
3668
3925
|
* could not be read, the model failed, a turn was refused or failed) leaves
|
|
3669
3926
|
* the cards on the tray and does nothing more: the server re-wakes
|
|
3670
|
-
* unanswered cards on its own durable ladder (D3). The
|
|
3671
|
-
*
|
|
3672
|
-
*
|
|
3673
|
-
*
|
|
3927
|
+
* unanswered cards on its own durable ladder (D3). The server's could-not-
|
|
3928
|
+
* process answers are not a ladder: they are its decision, followed once.
|
|
3929
|
+
* The one wake the loop gives itself is for a truncated tray (read the rest):
|
|
3930
|
+
* at once after a cycle that recorded a verdict or started a turn; otherwise
|
|
3931
|
+
* after a backoff (1 s doubling to 60 s), so a cycle that cannot progress
|
|
3932
|
+
* never spins.
|
|
3674
3933
|
*/
|
|
3675
3934
|
|
|
3676
3935
|
type ReceiveLoopMode = 'gateCall' | 'singleRun';
|
|
@@ -3715,22 +3974,54 @@ type TurnAdmission = {
|
|
|
3715
3974
|
readonly done: Promise<TurnEnd>;
|
|
3716
3975
|
};
|
|
3717
3976
|
type TurnStarter = (request: TurnRequest) => Promise<TurnAdmission>;
|
|
3718
|
-
/**
|
|
3977
|
+
/**
|
|
3978
|
+
* What a run is for (single-run mode): one conversation (a conversation run),
|
|
3979
|
+
* the whole tray (the served wake instruction: texts without
|
|
3980
|
+
* `conversation_run_template`, or a tray that could not be read), or the
|
|
3981
|
+
* pending invites (the served invite prompt).
|
|
3982
|
+
*/
|
|
3983
|
+
type RunKind = 'conversation' | 'tray' | 'invite';
|
|
3984
|
+
/** A run the loop asks for (single-run mode). */
|
|
3719
3985
|
interface RunRequest {
|
|
3720
|
-
/**
|
|
3986
|
+
/**
|
|
3987
|
+
* A conversation run: the served `conversation_run_template` for that one
|
|
3988
|
+
* conversation (`conversationRunPrompt`). A tray run: the served wake
|
|
3989
|
+
* instruction (and the invite prompt when invites wait). An invite run (or
|
|
3990
|
+
* a tray with invites only): the invite prompt alone.
|
|
3991
|
+
*/
|
|
3721
3992
|
readonly prompt: string;
|
|
3722
3993
|
readonly texts: Texts;
|
|
3723
|
-
/** Unanswered cards and pending invites
|
|
3994
|
+
/** Unanswered cards and pending invites the run is for (a conversation run: 1 and 0); null when the tray could not be read. */
|
|
3724
3995
|
readonly cards: number | null;
|
|
3725
3996
|
readonly invites: number | null;
|
|
3726
3997
|
readonly signal: AbortSignal;
|
|
3998
|
+
/** What the run is for. Set by this loop on every run. */
|
|
3999
|
+
readonly kind?: RunKind;
|
|
4000
|
+
/** A conversation run: the one conversation it is for. */
|
|
4001
|
+
readonly conversationId?: string;
|
|
3727
4002
|
}
|
|
3728
4003
|
interface RunEnd {
|
|
3729
4004
|
readonly status: 'completed' | 'failed' | 'not_started';
|
|
3730
4005
|
readonly detail?: string;
|
|
4006
|
+
/** A `failed` run that ran past its time limit (a could-not-process report then says `timed_out`). */
|
|
4007
|
+
readonly timedOut?: boolean;
|
|
3731
4008
|
}
|
|
3732
|
-
/** Starts
|
|
4009
|
+
/** Starts one run and resolves when it ends. Enforce the run's deadline here: the loop never ends a run. */
|
|
3733
4010
|
type RunStarter = (request: RunRequest) => Promise<RunEnd>;
|
|
4011
|
+
/**
|
|
4012
|
+
* Whether the agent's AI answers right now (a minimal model call with no peer
|
|
4013
|
+
* content, through the same account), asked about a failed conversation run,
|
|
4014
|
+
* turn or gate call once nothing else of that kind is queued: `ok` is the
|
|
4015
|
+
* evidence a could-not-process report needs, when no other conversation of
|
|
4016
|
+
* that kind is failing too. A version check alone is not enough: it passes
|
|
4017
|
+
* during a provider outage.
|
|
4018
|
+
*/
|
|
4019
|
+
type RuntimeCheck = () => Promise<{
|
|
4020
|
+
readonly ok: boolean;
|
|
4021
|
+
readonly detail?: string;
|
|
4022
|
+
}>;
|
|
4023
|
+
/** What failed on a conversation: its conversation run, its reply turn, or its single-card gate call. */
|
|
4024
|
+
type FailureSource = 'run' | 'turn' | 'gate';
|
|
3734
4025
|
/** Whether a turn started now could reach AgentChat (e.g. `probeHostedTools`); checked before a cycle spends a model call. */
|
|
3735
4026
|
type Readiness = () => {
|
|
3736
4027
|
readonly ready: true;
|
|
@@ -3755,7 +4046,7 @@ type WakeSource = 'message' | 'wake_frame' | 'connect' | 'invite' | 'external' |
|
|
|
3755
4046
|
type CycleOutcome =
|
|
3756
4047
|
/** The tray had no cards and no invites. */
|
|
3757
4048
|
'empty'
|
|
3758
|
-
/** Cards were there, but only muted ones, paced ones or ones a
|
|
4049
|
+
/** Cards were there, but only muted ones, paced ones, ones a turn holds, or ones held after a could-not-process answer. */
|
|
3759
4050
|
| 'nothing_owed' | 'tray_failed' | 'texts_missing' | 'tools_unavailable'
|
|
3760
4051
|
/**
|
|
3761
4052
|
* gateCall: the gate decided (turns started or queued for the replies). With
|
|
@@ -3767,6 +4058,11 @@ type CycleOutcome =
|
|
|
3767
4058
|
| 'fail_closed'
|
|
3768
4059
|
/** gateCall: only invites were owed; their turns were started or queued. */
|
|
3769
4060
|
| 'invites_only'
|
|
4061
|
+
/**
|
|
4062
|
+
* singleRun with conversation runs: one run per owed card (and one for the
|
|
4063
|
+
* pending invites) was started or queued; each run's end is a `run` event.
|
|
4064
|
+
*/
|
|
4065
|
+
| 'runs_started'
|
|
3770
4066
|
/** singleRun: the run's end. */
|
|
3771
4067
|
| 'run_completed' | 'run_failed' | 'run_not_started'
|
|
3772
4068
|
/** The cycle ran past `cycleTimeoutMs` and was abandoned; the next wake runs a new one. */
|
|
@@ -3784,14 +4080,22 @@ interface CycleSummary {
|
|
|
3784
4080
|
/** `dismiss` / `defer` verdicts the gate recorded. */
|
|
3785
4081
|
readonly recorded: number;
|
|
3786
4082
|
readonly recordFailures: number;
|
|
4083
|
+
/** Reply or invite turns (conversation runs: runs) started. */
|
|
3787
4084
|
readonly turnsStarted: number;
|
|
3788
4085
|
readonly turnsRefused: number;
|
|
3789
|
-
/** Reply or invite turns waiting for a slot (`maxConcurrentTurns`). */
|
|
4086
|
+
/** Reply or invite turns (conversation runs: runs) waiting for a slot (`maxConcurrentTurns`). */
|
|
3790
4087
|
readonly turnsQueued: number;
|
|
3791
|
-
/** Cards left out because a turn for their conversation is running or waiting. */
|
|
4088
|
+
/** Cards left out because a turn for their conversation is running or waiting (or its could-not-process report is out). */
|
|
3792
4089
|
readonly heldByTurns: number;
|
|
3793
4090
|
/** Cards and invites left out by D5 pacing (a recent silent turn). */
|
|
3794
4091
|
readonly paced: number;
|
|
4092
|
+
/**
|
|
4093
|
+
* Cards left out because a could-not-process report through their anchor
|
|
4094
|
+
* was answered `none` or `paused`: not run again until a newer message.
|
|
4095
|
+
* Always set by `ReceiveLoop` (optional in the type, so summaries built
|
|
4096
|
+
* elsewhere keep compiling).
|
|
4097
|
+
*/
|
|
4098
|
+
readonly heldAfterFailure?: number;
|
|
3795
4099
|
/** gateCall: gate calls (one per chunk of at most `gateChunkSize` cards) whose answer gave verdicts. */
|
|
3796
4100
|
readonly chunksOk: number;
|
|
3797
4101
|
/**
|
|
@@ -3801,12 +4105,28 @@ interface CycleSummary {
|
|
|
3801
4105
|
* watchdog) is neither: the cycle is `abandoned`.
|
|
3802
4106
|
*/
|
|
3803
4107
|
readonly chunksFailed: number;
|
|
4108
|
+
/**
|
|
4109
|
+
* gateCall: single-card gate calls after a chunk failed closed (each of its
|
|
4110
|
+
* cards gated alone), and calls for a card whose last gate call failed,
|
|
4111
|
+
* that gave a verdict.
|
|
4112
|
+
*/
|
|
4113
|
+
readonly splitCallsOk: number;
|
|
4114
|
+
/** gateCall: those single-card calls that failed closed. */
|
|
4115
|
+
readonly splitCallsFailed: number;
|
|
4116
|
+
/**
|
|
4117
|
+
* gateCall: the split stopped (`split_stopped`): single-card calls kept
|
|
4118
|
+
* failing with nothing decided in the cycle, and `checkRuntime()` did not
|
|
4119
|
+
* pass (or there is none). The cards not reached stay undecided.
|
|
4120
|
+
*/
|
|
4121
|
+
readonly splitStopped: boolean;
|
|
3804
4122
|
readonly truncated: boolean;
|
|
3805
4123
|
/**
|
|
3806
4124
|
* Why the cycle could not finish, or, when some gate chunks failed, how
|
|
3807
4125
|
* many of the calls made and the first one's reason (`2 of 5 gate chunks
|
|
3808
4126
|
* failed; chunk 3: …`, the chunk named by its `gate_chunk` index); a cycle
|
|
3809
|
-
* that made one gate call gives that call's reason as it is.
|
|
4127
|
+
* that made one gate call gives that call's reason as it is. Failed
|
|
4128
|
+
* single-card calls follow (`…; 2 of 10 single-card calls failed;
|
|
4129
|
+
* <conversation_id>: …`).
|
|
3810
4130
|
*/
|
|
3811
4131
|
readonly failure: string | null;
|
|
3812
4132
|
}
|
|
@@ -3817,11 +4137,13 @@ interface GateChunkReport {
|
|
|
3817
4137
|
* (not consecutive), so a cycle's chunks are never taken for the next one's.
|
|
3818
4138
|
*/
|
|
3819
4139
|
readonly cycle: number;
|
|
3820
|
-
/** 1-based position of the chunk in the cycle, in tray order. */
|
|
4140
|
+
/** 1-based position of the chunk in the cycle, in tray order (a single-card call: among the cycle's single-card calls). */
|
|
3821
4141
|
readonly index: number;
|
|
3822
4142
|
/**
|
|
3823
4143
|
* How many chunks the cycle's cards were split into. A chunk not called
|
|
3824
4144
|
* (every card taken by a turn meanwhile, or muted cards only) has no report.
|
|
4145
|
+
* A single-card call: how many single-card calls were made or queued when
|
|
4146
|
+
* it was made.
|
|
3825
4147
|
*/
|
|
3826
4148
|
readonly of: number;
|
|
3827
4149
|
/** Cards this call decided on (the N of its prompt). */
|
|
@@ -3830,6 +4152,55 @@ interface GateChunkReport {
|
|
|
3830
4152
|
/** This chunk's cards left without a usable verdict. */
|
|
3831
4153
|
readonly undecided: number;
|
|
3832
4154
|
readonly failure: string | null;
|
|
4155
|
+
/**
|
|
4156
|
+
* A single-card call after the chunks: a card of a chunk that failed
|
|
4157
|
+
* closed, gated alone, or a card whose last gate call failed. Absent on
|
|
4158
|
+
* the planned chunks.
|
|
4159
|
+
*/
|
|
4160
|
+
readonly split?: true;
|
|
4161
|
+
/** A single-card call: its card's conversation. */
|
|
4162
|
+
readonly conversationId?: string;
|
|
4163
|
+
}
|
|
4164
|
+
/** One could-not-process report and the server's answer. */
|
|
4165
|
+
interface ProcessingFailureReport {
|
|
4166
|
+
readonly conversationId: string;
|
|
4167
|
+
/** What failed: the conversation's run, its reply turn, or its single-card gate call. */
|
|
4168
|
+
readonly source: FailureSource;
|
|
4169
|
+
/** The card's anchor when the failed attempt started. */
|
|
4170
|
+
readonly throughMessageId: string;
|
|
4171
|
+
readonly outcome: ProcessingFailureOutcome;
|
|
4172
|
+
readonly evidence: ProcessingFailureEvidence;
|
|
4173
|
+
/** The server's answer; null when the report itself failed (`error`). */
|
|
4174
|
+
readonly result: ProcessingFailureAction | null;
|
|
4175
|
+
readonly error?: string;
|
|
4176
|
+
/**
|
|
4177
|
+
* What the loop does for the conversation: `rerun` (a `retry` or `hidden`
|
|
4178
|
+
* answer: it runs again after the others queued), `running` (`retry` /
|
|
4179
|
+
* `hidden`, but its next attempt is already under way: running, queued, or
|
|
4180
|
+
* being gated now), `stop` (`paused`, `none`, or the report failed),
|
|
4181
|
+
* `rerun_capped` (`retry` / `hidden`, but it already ran again
|
|
4182
|
+
* `MAX_RERUNS_PER_CYCLE` times in this cycle). After a `paused` or `none`
|
|
4183
|
+
* answer the conversation is also held at `throughMessageId` until a newer
|
|
4184
|
+
* message arrives (`status().processingFailures.held`).
|
|
4185
|
+
*/
|
|
4186
|
+
readonly next: 'rerun' | 'running' | 'stop' | 'rerun_capped';
|
|
4187
|
+
}
|
|
4188
|
+
/** The server's answer that holds a conversation after a could-not-process report. */
|
|
4189
|
+
type FailureHoldReason = 'none' | 'paused';
|
|
4190
|
+
/**
|
|
4191
|
+
* A conversation the loop does not run again until a newer message moves its
|
|
4192
|
+
* card's anchor: the server answered `none` or `paused` to a could-not-process
|
|
4193
|
+
* report through `anchor`. In memory: a restart may try it once more (that
|
|
4194
|
+
* report answers the same and holds it again).
|
|
4195
|
+
*/
|
|
4196
|
+
interface HeldConversation {
|
|
4197
|
+
readonly conversationId: string;
|
|
4198
|
+
/** The anchor the failed attempt read through (the report's `throughMessageId`). */
|
|
4199
|
+
readonly anchor: string;
|
|
4200
|
+
/** When the answer came (ISO 8601). */
|
|
4201
|
+
readonly since: string;
|
|
4202
|
+
/** The server's answer. */
|
|
4203
|
+
readonly reason: FailureHoldReason;
|
|
3833
4204
|
}
|
|
3834
4205
|
type ReceiveLoopEvent = {
|
|
3835
4206
|
readonly type: 'wake';
|
|
@@ -3873,6 +4244,26 @@ type ReceiveLoopEvent = {
|
|
|
3873
4244
|
} | {
|
|
3874
4245
|
readonly type: 'run';
|
|
3875
4246
|
readonly end: RunEnd;
|
|
4247
|
+
/** What the run was for. */
|
|
4248
|
+
readonly kind?: RunKind;
|
|
4249
|
+
/** A conversation run's conversation. */
|
|
4250
|
+
readonly conversationId?: string;
|
|
4251
|
+
}
|
|
4252
|
+
/** A could-not-process report was made (or failed) for one conversation. */
|
|
4253
|
+
| ({
|
|
4254
|
+
readonly type: 'processing_failure';
|
|
4255
|
+
} & ProcessingFailureReport)
|
|
4256
|
+
/**
|
|
4257
|
+
* gateCall: the split stopped. Single-card calls failed `SPLIT_STOP_AFTER_FAILURES`
|
|
4258
|
+
* times in a row with nothing decided in the cycle, and `checkRuntime()`
|
|
4259
|
+
* did not pass (`runtime_check_failed`) or there is none (`no_runtime_check`).
|
|
4260
|
+
*/
|
|
4261
|
+
| {
|
|
4262
|
+
readonly type: 'split_stopped';
|
|
4263
|
+
readonly cycle: number;
|
|
4264
|
+
/** Cards left in the split's queue, undecided. */
|
|
4265
|
+
readonly remaining: number;
|
|
4266
|
+
readonly reason: 'runtime_check_failed' | 'no_runtime_check';
|
|
3876
4267
|
} | {
|
|
3877
4268
|
readonly type: 'error';
|
|
3878
4269
|
readonly error: Error;
|
|
@@ -3887,9 +4278,14 @@ interface ReceiveLoopSocketOptions {
|
|
|
3887
4278
|
readonly reconnectInterval?: number;
|
|
3888
4279
|
readonly maxReconnectInterval?: number;
|
|
3889
4280
|
}
|
|
3890
|
-
/**
|
|
4281
|
+
/**
|
|
4282
|
+
* What the loop calls on the client; `AgentChatClient` satisfies it. Without
|
|
4283
|
+
* `conversations.reportProcessingFailure` the loop reports no
|
|
4284
|
+
* could-not-process failure (and so acts on none).
|
|
4285
|
+
*/
|
|
3891
4286
|
type ReceiveLoopClient = Pick<AgentChatClient, 'inbox' | 'decisions' | 'groups'> & {
|
|
3892
4287
|
readonly baseUrl?: string;
|
|
4288
|
+
readonly conversations?: Pick<ConversationsResource, 'reportProcessingFailure'>;
|
|
3893
4289
|
};
|
|
3894
4290
|
interface ReceiveLoopOptions {
|
|
3895
4291
|
readonly client: ReceiveLoopClient;
|
|
@@ -3901,8 +4297,33 @@ interface ReceiveLoopOptions {
|
|
|
3901
4297
|
readonly startTurn?: TurnStarter;
|
|
3902
4298
|
/** gateCall: starts one invite turn. Default: `startTurn`. */
|
|
3903
4299
|
readonly startInviteTurn?: TurnStarter;
|
|
3904
|
-
/** singleRun: starts the one run. */
|
|
4300
|
+
/** singleRun: starts a run (a conversation run, an invite run, or the one tray run). */
|
|
3905
4301
|
readonly startRun?: RunStarter;
|
|
4302
|
+
/**
|
|
4303
|
+
* singleRun: whenever the served texts carry `conversation_run_template`
|
|
4304
|
+
* (default `true`), start one run per owed card, for that one conversation,
|
|
4305
|
+
* and one invite run for the pending invites, instead of one run for the
|
|
4306
|
+
* whole tray. `false` keeps one run for the tray. Texts without the template
|
|
4307
|
+
* (an older server) always keep it.
|
|
4308
|
+
*/
|
|
4309
|
+
readonly conversationRuns?: boolean;
|
|
4310
|
+
/**
|
|
4311
|
+
* Whether the runtime works right now (both modes). Asked about a
|
|
4312
|
+
* conversation's failed run, reply turn or single-card gate call once
|
|
4313
|
+
* nothing else of that kind is queued, and only when no other conversation
|
|
4314
|
+
* of that kind has failed since that kind last completed, and never for
|
|
4315
|
+
* a timeout (`timed_out` needs another completion); `ok` is the evidence a
|
|
4316
|
+
* could-not-process report needs (`runtime_check`). Also the
|
|
4317
|
+
* gate split's guard: after two single-card calls in a row failed with
|
|
4318
|
+
* nothing decided, the split goes on only if it passes. It must show that
|
|
4319
|
+
* the agent's AI answers now (a minimal model call with no peer content,
|
|
4320
|
+
* through the same account), not only that a binary is installed: an `ok`
|
|
4321
|
+
* during a provider outage would report the outage as the conversation's
|
|
4322
|
+
* failure. Without it, a failure is reported only once the same kind of
|
|
4323
|
+
* work completes for another conversation (within `AWAITING_EVIDENCE_MS`).
|
|
4324
|
+
* Bounded by `RUNTIME_CHECK_TIMEOUT_MS`; a throw counts as not ok.
|
|
4325
|
+
*/
|
|
4326
|
+
readonly checkRuntime?: RuntimeCheck;
|
|
3906
4327
|
/**
|
|
3907
4328
|
* The socket: options to build one (needs the API key), a `RealtimeClient`
|
|
3908
4329
|
* you built (the loop attaches its handlers and connects and disconnects
|
|
@@ -3915,7 +4336,7 @@ interface ReceiveLoopOptions {
|
|
|
3915
4336
|
/** How this runtime spells the hosted tools named in the tray's question (gate call). */
|
|
3916
4337
|
readonly toolNamer?: ToolNamer;
|
|
3917
4338
|
readonly readiness?: Readiness;
|
|
3918
|
-
/** Reply and invite turns running at once
|
|
4339
|
+
/** Reply and invite turns (gateCall), or conversation and invite runs (singleRun), running at once. Default 1. */
|
|
3919
4340
|
readonly maxConcurrentTurns?: number;
|
|
3920
4341
|
/** D5 pacing window. Default `PACE_MS` (60 s). */
|
|
3921
4342
|
readonly paceMs?: number;
|
|
@@ -4013,9 +4434,55 @@ interface ReceiveLoopStatus {
|
|
|
4013
4434
|
readonly chunksOk: number;
|
|
4014
4435
|
/** Gate calls (chunks) that failed closed, since start; alarm on a rising count. */
|
|
4015
4436
|
readonly chunksFailed: number;
|
|
4437
|
+
/** Single-card gate calls (after a chunk failed, or for a card whose last call failed) that gave a verdict, since start. */
|
|
4438
|
+
readonly splitCallsOk: number;
|
|
4439
|
+
/** Single-card gate calls that failed closed, since start. */
|
|
4440
|
+
readonly splitCallsFailed: number;
|
|
4016
4441
|
readonly outcomes: Readonly<Record<string, number>>;
|
|
4017
4442
|
readonly outcomeRecordFailures: number;
|
|
4018
4443
|
};
|
|
4444
|
+
/** Could not process: what was reported, and what the server answered, since start. */
|
|
4445
|
+
readonly processingFailures: {
|
|
4446
|
+
/** Reports the server answered. */
|
|
4447
|
+
readonly reported: number;
|
|
4448
|
+
readonly retry: number;
|
|
4449
|
+
readonly hidden: number;
|
|
4450
|
+
readonly paused: number;
|
|
4451
|
+
readonly none: number;
|
|
4452
|
+
/** Reports that failed (a network or server error); nothing more is done for them. */
|
|
4453
|
+
readonly reportErrors: number;
|
|
4454
|
+
/** Runs, reply turns or single-card gate calls started again on a `retry` or `hidden` answer. */
|
|
4455
|
+
readonly reruns: number;
|
|
4456
|
+
/** `retry` / `hidden` answers not followed: the conversation already ran again `MAX_RERUNS_PER_CYCLE` times in its cycle. */
|
|
4457
|
+
readonly rerunsCapped: number;
|
|
4458
|
+
/** Failures held until another run, turn or gate call completes (the evidence a report needs), now. */
|
|
4459
|
+
readonly awaitingEvidence: number;
|
|
4460
|
+
readonly runtimeChecksOk: number;
|
|
4461
|
+
readonly runtimeChecksFailed: number;
|
|
4462
|
+
/** Gate splits stopped (`split_stopped`), since start. */
|
|
4463
|
+
readonly splitsStopped: number;
|
|
4464
|
+
/**
|
|
4465
|
+
* Runs and reply turns not started because their conversation is held
|
|
4466
|
+
* after a could-not-process answer (dropped from the queue, or stopped at
|
|
4467
|
+
* their start), since start. Always set by `ReceiveLoop`.
|
|
4468
|
+
*/
|
|
4469
|
+
readonly startsHeld?: number;
|
|
4470
|
+
/** The last `checkRuntime()` answer, or null. */
|
|
4471
|
+
readonly lastRuntimeCheck: {
|
|
4472
|
+
readonly at: string;
|
|
4473
|
+
readonly ok: boolean;
|
|
4474
|
+
readonly detail: string | null;
|
|
4475
|
+
} | null;
|
|
4476
|
+
/**
|
|
4477
|
+
* Conversations not run again until a new message arrives: the server
|
|
4478
|
+
* answered `none` or `paused` to their report (oldest first). As of the
|
|
4479
|
+
* last tray read: a card read since (a verdict, a mark-read) or moved to
|
|
4480
|
+
* a newer anchor leaves the list at the next one. Always set by
|
|
4481
|
+
* `ReceiveLoop` (optional in the type, so status objects built elsewhere
|
|
4482
|
+
* keep compiling).
|
|
4483
|
+
*/
|
|
4484
|
+
readonly held?: HeldConversation[];
|
|
4485
|
+
};
|
|
4019
4486
|
readonly lastError: string | null;
|
|
4020
4487
|
}
|
|
4021
4488
|
declare class ReceiveLoop {
|
|
@@ -4035,15 +4502,55 @@ declare class ReceiveLoop {
|
|
|
4035
4502
|
/** When a single-run invite's silent run was counted (D5 pacing in single-run mode). */
|
|
4036
4503
|
private readonly silentAt;
|
|
4037
4504
|
private readonly paceMs;
|
|
4505
|
+
/** Turns and runs waiting for a slot; `drop` ends what else the entry holds (an invite run's other invites). */
|
|
4038
4506
|
private readonly waiting;
|
|
4507
|
+
/** Conversation and invite runs started and not yet concluded: `idle()` and `stop()` wait for them. */
|
|
4508
|
+
private readonly runWork;
|
|
4509
|
+
/** Could not process: the order of attempts and completions. */
|
|
4510
|
+
private readonly evidence;
|
|
4511
|
+
/** Could not process: failures waiting for a completion (the evidence a report needs), by conversation. */
|
|
4512
|
+
private readonly awaitingEvidence;
|
|
4513
|
+
/** Waiting failures the runtime check has already been asked about (once each). */
|
|
4514
|
+
private readonly checkedFailures;
|
|
4515
|
+
/**
|
|
4516
|
+
* Per kind of work, the conversations whose attempt failed since that kind
|
|
4517
|
+
* last completed. Two or more: several failing together is the runtime, so
|
|
4518
|
+
* a passing `checkRuntime()` is no evidence for any of them.
|
|
4519
|
+
*/
|
|
4520
|
+
private readonly failingSince;
|
|
4521
|
+
/** gateCall: conversations whose last gate call failed; gated alone, after the others. */
|
|
4522
|
+
private readonly gateAlone;
|
|
4523
|
+
/**
|
|
4524
|
+
* gateCall: the running cycle's gate: its cards (`members`) and its
|
|
4525
|
+
* single-card queue. A `retry` answer for one of its cards joins the queue;
|
|
4526
|
+
* a `hidden` one skips the card here (its card, read before the hide, is
|
|
4527
|
+
* stale) and gates it in the next cycle.
|
|
4528
|
+
*/
|
|
4529
|
+
private activeSplit;
|
|
4530
|
+
/**
|
|
4531
|
+
* gateCall: reply turns to start again on a `retry` / `hidden` answer that
|
|
4532
|
+
* came while a gate was deciding: they start after that cycle's own turns
|
|
4533
|
+
* (no turn starts while cards of a cycle still wait for their gate call).
|
|
4534
|
+
*/
|
|
4535
|
+
private turnRerunsAfterGate;
|
|
4536
|
+
private lastRuntimeCheck;
|
|
4537
|
+
private readonly failureCounts;
|
|
4039
4538
|
/** Conversations whose verdict a gate call is recording right now (an abandoned cycle's included). */
|
|
4040
4539
|
private readonly recordsInFlight;
|
|
4540
|
+
/**
|
|
4541
|
+
* Could not process: conversations whose report is out on another's
|
|
4542
|
+
* completion (`takeDue`): held out of the gate and of new runs, and a run
|
|
4543
|
+
* or turn of theirs waiting for a slot waits, until the server answers.
|
|
4544
|
+
*/
|
|
4545
|
+
private readonly reporting;
|
|
4041
4546
|
/** Turns holding a slot (admitted, not yet ended or released). */
|
|
4042
4547
|
private readonly slotted;
|
|
4043
4548
|
private handle;
|
|
4044
4549
|
private started;
|
|
4045
4550
|
private stopped;
|
|
4046
4551
|
private heldWhileRunning;
|
|
4552
|
+
/** A cycle left a card out because its could-not-process report was out: `letGo` reads the tray again. */
|
|
4553
|
+
private heldWhileReporting;
|
|
4047
4554
|
private activeTurns;
|
|
4048
4555
|
private noProgressStreak;
|
|
4049
4556
|
private moreTimer;
|
|
@@ -4072,7 +4579,12 @@ declare class ReceiveLoop {
|
|
|
4072
4579
|
* outcome recorded.
|
|
4073
4580
|
*/
|
|
4074
4581
|
stop(): Promise<void>;
|
|
4075
|
-
/**
|
|
4582
|
+
/**
|
|
4583
|
+
* Resolves when the running cycle has finished (tests, graceful stops) and,
|
|
4584
|
+
* in single-run mode, no run is running or waiting for a slot (conversation
|
|
4585
|
+
* runs go on after the cycle that started them). Gate-call turns are not
|
|
4586
|
+
* waited for.
|
|
4587
|
+
*/
|
|
4076
4588
|
idle(): Promise<void>;
|
|
4077
4589
|
/** Let go of a turn whose end the runtime will never confirm (an operator's call). Nothing is recorded for it. */
|
|
4078
4590
|
releaseTurn(key: string): boolean;
|
|
@@ -4098,6 +4610,7 @@ declare class ReceiveLoop {
|
|
|
4098
4610
|
* off the watchdog is the calls' only bound, so they count.
|
|
4099
4611
|
*/
|
|
4100
4612
|
private boundedModelCall;
|
|
4613
|
+
/** `timedOut` is set when a call runs past its deadline (a could-not-process report then says `timed_out`). */
|
|
4101
4614
|
private deadlineModelCall;
|
|
4102
4615
|
private readTray;
|
|
4103
4616
|
private checkReady;
|
|
@@ -4105,9 +4618,29 @@ declare class ReceiveLoop {
|
|
|
4105
4618
|
/**
|
|
4106
4619
|
* Held out of the gate: a running or waiting turn, or a verdict still being
|
|
4107
4620
|
* recorded (an abandoned cycle's last call): gating it again could record
|
|
4108
|
-
* the same verdict twice (a second defer climbs the ladder).
|
|
4621
|
+
* the same verdict twice (a second defer climbs the ladder). Also a
|
|
4622
|
+
* conversation whose could-not-process report is out (`reporting`): its
|
|
4623
|
+
* answer may hold it.
|
|
4109
4624
|
*/
|
|
4110
4625
|
private unheld;
|
|
4626
|
+
/**
|
|
4627
|
+
* The cards neither paced (D5) nor held after a could-not-process answer
|
|
4628
|
+
* (`none` / `paused` through the anchor they still show), and how many of
|
|
4629
|
+
* each were left out. A card whose anchor moved is no longer held.
|
|
4630
|
+
*/
|
|
4631
|
+
private paceCards;
|
|
4632
|
+
/** Held after a could-not-process answer, at the anchor this card still shows. */
|
|
4633
|
+
private heldAfterFailure;
|
|
4634
|
+
/**
|
|
4635
|
+
* A tray read after `mark`, every card on it (a turn's included): a held
|
|
4636
|
+
* conversation whose card shows a newer anchor is no longer held, and on
|
|
4637
|
+
* a complete tray (not truncated) neither is one whose card is gone (read
|
|
4638
|
+
* meanwhile: a verdict, a mark-read). A truncated tray proves nothing
|
|
4639
|
+
* about the cards it does not show.
|
|
4640
|
+
*/
|
|
4641
|
+
private forgetCleared;
|
|
4642
|
+
/** The start of a run or reply turn: held after a could-not-process answer at the anchor it was started for. */
|
|
4643
|
+
private failureHeld;
|
|
4111
4644
|
/**
|
|
4112
4645
|
* The gate in chunks (contract v1 §3.6): the cards, in tray order, split
|
|
4113
4646
|
* into chunks of at most `gateChunkSize`, one gate call per chunk, one
|
|
@@ -4121,6 +4654,18 @@ declare class ReceiveLoop {
|
|
|
4121
4654
|
* cards only (or none) is not called. Stops once the cycle is stale; a call
|
|
4122
4655
|
* a stop cut short is not counted as a failed chunk, and a cycle the
|
|
4123
4656
|
* watchdog abandoned reports and counts no chunk after its summary.
|
|
4657
|
+
*
|
|
4658
|
+
* The split (could not process): every owed card of a chunk of more than
|
|
4659
|
+
* one card that failed closed is then gated again alone, one call per card,
|
|
4660
|
+
* in tray order, before any turn starts, so one card the model cannot
|
|
4661
|
+
* handle fails only its own call. A card whose last gate call failed is
|
|
4662
|
+
* kept out of the chunks and gated alone after them. A single-card call that
|
|
4663
|
+
* fails is the card's failure (reported with evidence; a `retry` answer
|
|
4664
|
+
* gates it once more at the end of the queue). When the queue is empty, a
|
|
4665
|
+
* failure still waiting gets the runtime check. After
|
|
4666
|
+
* `SPLIT_STOP_AFTER_FAILURES` single-card calls in a row failed with nothing
|
|
4667
|
+
* decided in the cycle, the split goes on only if `checkRuntime()` passes;
|
|
4668
|
+
* otherwise it stops (`split_stopped`).
|
|
4124
4669
|
*/
|
|
4125
4670
|
private gateInChunks;
|
|
4126
4671
|
/**
|
|
@@ -4132,6 +4677,29 @@ declare class ReceiveLoop {
|
|
|
4132
4677
|
private readTheRest;
|
|
4133
4678
|
private clearMoreTimer;
|
|
4134
4679
|
private singleRunCycle;
|
|
4680
|
+
/**
|
|
4681
|
+
* Conversation runs (single-run mode, texts with `conversation_run_template`):
|
|
4682
|
+
* one run per owed card (unmuted, with a preview: a notices-only card is not
|
|
4683
|
+
* owed), prompted for that one conversation, and one invite run for the
|
|
4684
|
+
* pending invites. A conversation whose run is running or
|
|
4685
|
+
* waiting for a slot is held out (the tracker), and so is one paced after a
|
|
4686
|
+
* completed run that left its card at the same anchor (D5). Runs take a slot
|
|
4687
|
+
* each (`maxConcurrentTurns`) in the order queued: the cards whose last run
|
|
4688
|
+
* failed go last, after the invite run, so they never hold up the others.
|
|
4689
|
+
* The loop records no verdict for a card: the run decides.
|
|
4690
|
+
*/
|
|
4691
|
+
private conversationRunCycle;
|
|
4692
|
+
/** One conversation run: a slot (or a place in the queue), the run, then what its end says. */
|
|
4693
|
+
private startConversationRun;
|
|
4694
|
+
private afterConversationRun;
|
|
4695
|
+
/** The invite run: one run for the pending invites, holding each of them until it ends. */
|
|
4696
|
+
private startInviteRun;
|
|
4697
|
+
private afterInviteRun;
|
|
4698
|
+
/** The runtime's `startRun`, never rejecting: a throw is a run that did not start. */
|
|
4699
|
+
private callRun;
|
|
4700
|
+
private countRunEnd;
|
|
4701
|
+
/** A run's whole course after its start: `idle()` and `stop()` wait for it. */
|
|
4702
|
+
private trackRun;
|
|
4135
4703
|
private afterRunInvites;
|
|
4136
4704
|
private startReplyTurn;
|
|
4137
4705
|
private startInviteTurn;
|
|
@@ -4150,6 +4718,7 @@ declare class ReceiveLoop {
|
|
|
4150
4718
|
/** The turn's slot is free (it ended, was refused, or was released): start the turns waiting for one. */
|
|
4151
4719
|
private releaseSlot;
|
|
4152
4720
|
private pump;
|
|
4721
|
+
private awaitsAnswer;
|
|
4153
4722
|
private afterReplyTurn;
|
|
4154
4723
|
private recordReplyOutcome;
|
|
4155
4724
|
private afterInviteTurn;
|
|
@@ -4159,6 +4728,100 @@ declare class ReceiveLoop {
|
|
|
4159
4728
|
private admit;
|
|
4160
4729
|
/** A turn's end: cards a cycle left out meanwhile are read again. */
|
|
4161
4730
|
private afterTurnEnded;
|
|
4731
|
+
/**
|
|
4732
|
+
* A run, turn or gate call that completed, on the evidence clock. A failure
|
|
4733
|
+
* it clears (the same kind of attempt for the same conversation went
|
|
4734
|
+
* through since) waits no more. Call it the moment the work ended, before
|
|
4735
|
+
* its slot frees, so the next attempt starts after it.
|
|
4736
|
+
*/
|
|
4737
|
+
private completed;
|
|
4738
|
+
/**
|
|
4739
|
+
* The failures this completion is the evidence for (each once), taken off
|
|
4740
|
+
* the waiting list. Their conversations are held from now until the
|
|
4741
|
+
* server has answered (`reporting`): no gate, and a run or turn of theirs
|
|
4742
|
+
* waiting for a slot waits for the answer, so it never starts on the input
|
|
4743
|
+
* the answer is about. Take them before the completed work's slot frees.
|
|
4744
|
+
* One that waited past `AWAITING_EVIDENCE_MS` is dropped instead: a
|
|
4745
|
+
* completion that late says little about the runtime when it failed.
|
|
4746
|
+
*/
|
|
4747
|
+
private takeDue;
|
|
4748
|
+
/** Report what `takeDue` took, letting go of each conversation once its answer is in: what waits for it goes on (or was dropped). */
|
|
4749
|
+
private reportDue;
|
|
4750
|
+
/** A report for this failure is due: its conversation is held until `letGo` (counted: two reports out hold it until both are answered). */
|
|
4751
|
+
private holdForReport;
|
|
4752
|
+
/**
|
|
4753
|
+
* The answers are in (or the report is off): those conversations are no
|
|
4754
|
+
* longer held for it, what waits for them goes on, and a card a cycle left
|
|
4755
|
+
* out meanwhile for a report is read again (only then: a wake for
|
|
4756
|
+
* anything else could spin while a turn runs).
|
|
4757
|
+
*/
|
|
4758
|
+
private letGo;
|
|
4759
|
+
/** An attempt of this kind failed for these conversations (whatever comes of it): see `failingSince`. */
|
|
4760
|
+
private failedAttempt;
|
|
4761
|
+
/**
|
|
4762
|
+
* A conversation's run, reply turn or single-card gate call failed. It is
|
|
4763
|
+
* reported only with evidence that the runtime otherwise works:
|
|
4764
|
+
* (a) a later completion of the same kind of work for another conversation
|
|
4765
|
+
* (`evidences`), or (b) `checkRuntime()` passing while no other
|
|
4766
|
+
* conversation of that kind has failed since that kind last completed.
|
|
4767
|
+
* Without (a) it waits: the work already queued runs first (cheap
|
|
4768
|
+
* evidence), and the runtime check is asked only once nothing of that kind
|
|
4769
|
+
* is queued (`checkParked`). It waits at most `AWAITING_EVIDENCE_MS`.
|
|
4770
|
+
* Nothing is reported after `stop()`: a run the stop cut short did not
|
|
4771
|
+
* fail on its conversation.
|
|
4772
|
+
*/
|
|
4773
|
+
private failed;
|
|
4774
|
+
/**
|
|
4775
|
+
* Evidence (b), once nothing of this kind is queued: ask `checkRuntime()`
|
|
4776
|
+
* about the failure still waiting for evidence, if it is the only
|
|
4777
|
+
* conversation of that kind failing since that kind last completed. Several
|
|
4778
|
+
* failing together is the runtime: none of them is reported on (b), and
|
|
4779
|
+
* they keep waiting for (a). A `timed_out` failure is never reported on
|
|
4780
|
+
* (b): a timeout is ambiguous (a brownout, a hung hook) and the check does
|
|
4781
|
+
* not exercise those paths; it waits for (a). Each failure is asked about
|
|
4782
|
+
* once. A check that fails drops it (a broken runtime reports nothing).
|
|
4783
|
+
*/
|
|
4784
|
+
private checkParked;
|
|
4785
|
+
/** Nothing of this kind is running or queued: the runtime check may be asked now. */
|
|
4786
|
+
private idleFor;
|
|
4787
|
+
private canReport;
|
|
4788
|
+
/** `checkRuntime()`, bounded by `RUNTIME_CHECK_TIMEOUT_MS`; a throw or a timeout is not ok. */
|
|
4789
|
+
private runtimeCheck;
|
|
4790
|
+
/** Tell the server, and do what it answers: run the conversation again (`retry`, `hidden`) or stop (`paused`, `none`). */
|
|
4791
|
+
private reportFailure;
|
|
4792
|
+
/**
|
|
4793
|
+
* The server answered `none` or `paused`: the conversation is held at the
|
|
4794
|
+
* anchor the report read through, so no later cycle (a message elsewhere,
|
|
4795
|
+
* a wake frame, a reconnect, an `unanswered` re-wake, a turn's end) runs it
|
|
4796
|
+
* again on the same input. A newer message moves its anchor and lifts the
|
|
4797
|
+
* hold (`paceCards`); a card read meanwhile leaves the tray, and the hold
|
|
4798
|
+
* with it (`forgetCleared`). What waits for it does not start: a run or
|
|
4799
|
+
* reply turn queued at that anchor (after `paused`, the server's mute, any),
|
|
4800
|
+
* and a reply turn to start again after the gate.
|
|
4801
|
+
*/
|
|
4802
|
+
private holdFailed;
|
|
4803
|
+
/**
|
|
4804
|
+
* Run the conversation again after a `retry` or `hidden` answer, after the
|
|
4805
|
+
* others already queued, and say what was done. Its run or reply turn takes
|
|
4806
|
+
* a place at the back of the queue (it reads the conversation itself, so it
|
|
4807
|
+
* sees a hidden span as the note); a reply turn asked for while a gate is
|
|
4808
|
+
* deciding starts after that cycle's own turns. A gate call sees only the
|
|
4809
|
+
* card: after `retry` it joins the end of the running gate's single-card
|
|
4810
|
+
* calls (once, with the card as this cycle read it); after `hidden`, or
|
|
4811
|
+
* when no gate is running for it, the next cycle reads the tray again and
|
|
4812
|
+
* gates it alone. `running`: nothing started, because its next attempt is
|
|
4813
|
+
* under way already (running, queued, or being decided by the gate now).
|
|
4814
|
+
*/
|
|
4815
|
+
private rerun;
|
|
4816
|
+
/** The reply turns asked for while a gate was deciding: started now, after the cycle's own turns. */
|
|
4817
|
+
private flushTurnReruns;
|
|
4818
|
+
/**
|
|
4819
|
+
* A held conversation: a run or turn still waiting for a slot for it does
|
|
4820
|
+
* not start; with an `anchor`, only one for that anchor (one queued for a
|
|
4821
|
+
* newer message is new input, and goes on).
|
|
4822
|
+
*/
|
|
4823
|
+
private dropWaiting;
|
|
4824
|
+
private rememberGateAlone;
|
|
4162
4825
|
/** Recording under way after a turn's confirmed end: `stop()` waits for it. */
|
|
4163
4826
|
private track;
|
|
4164
4827
|
private remember;
|
|
@@ -4178,6 +4841,16 @@ declare class ReceiveLoop {
|
|
|
4178
4841
|
* wake instruction and a `conversation_id:` line.
|
|
4179
4842
|
*/
|
|
4180
4843
|
declare function replyPrompt(texts: Pick<Texts, 'wake_instruction' | 'reply_turn_template'>, conversationId: string): string;
|
|
4844
|
+
/**
|
|
4845
|
+
* The prompt a conversation run starts with: the served
|
|
4846
|
+
* `conversation_run_template` with every `<conversation_id>` replaced by the
|
|
4847
|
+
* conversation's id, which sends the run to that one conversation and no
|
|
4848
|
+
* other. A served template that names no `<conversation_id>` is still the
|
|
4849
|
+
* run's text, followed by a `conversation_id:` line. Texts without the
|
|
4850
|
+
* template (the `ReceiveLoop` then starts no conversation runs) fall back to
|
|
4851
|
+
* `replyPrompt`.
|
|
4852
|
+
*/
|
|
4853
|
+
declare function conversationRunPrompt(texts: Pick<Texts, 'wake_instruction' | 'reply_turn_template' | 'conversation_run_template'>, conversationId: string): string;
|
|
4181
4854
|
|
|
4182
4855
|
/**
|
|
4183
4856
|
* Sign-up for an integration's setup (`integration.account`): register a new
|
|
@@ -4490,10 +5163,13 @@ type index_CycleOutcome = CycleOutcome;
|
|
|
4490
5163
|
type index_CycleSummary = CycleSummary;
|
|
4491
5164
|
declare const index_DEFAULT_MAX_MS: typeof DEFAULT_MAX_MS;
|
|
4492
5165
|
declare const index_DEFAULT_QUIET_MS: typeof DEFAULT_QUIET_MS;
|
|
5166
|
+
type index_FailureHoldReason = FailureHoldReason;
|
|
5167
|
+
type index_FailureSource = FailureSource;
|
|
4493
5168
|
type index_FindOptions = FindOptions;
|
|
4494
5169
|
type index_FoundBlock = FoundBlock;
|
|
4495
5170
|
type index_GateChunkReport = GateChunkReport;
|
|
4496
5171
|
declare const index_HOSTED_MCP_PATH: typeof HOSTED_MCP_PATH;
|
|
5172
|
+
type index_HeldConversation = HeldConversation;
|
|
4497
5173
|
type index_InviteOutcome = InviteOutcome;
|
|
4498
5174
|
type index_InviteOutcomeClient = InviteOutcomeClient;
|
|
4499
5175
|
type index_InviteOutcomeInput = InviteOutcomeInput;
|
|
@@ -4511,6 +5187,7 @@ type index_ManualSyncState = ManualSyncState;
|
|
|
4511
5187
|
type index_OutcomeClient = OutcomeClient;
|
|
4512
5188
|
type index_ProbeHostedToolsOptions = ProbeHostedToolsOptions;
|
|
4513
5189
|
type index_ProbeHostedToolsResult = ProbeHostedToolsResult;
|
|
5190
|
+
type index_ProcessingFailureReport = ProcessingFailureReport;
|
|
4514
5191
|
declare const index_REQUIRED_HOSTED_TOOLS: typeof REQUIRED_HOSTED_TOOLS;
|
|
4515
5192
|
type index_Readiness = Readiness;
|
|
4516
5193
|
type index_ReceiveLoop = ReceiveLoop;
|
|
@@ -4524,9 +5201,11 @@ type index_ReceiveLoopStatus = ReceiveLoopStatus;
|
|
|
4524
5201
|
type index_RecoverInput = RecoverInput;
|
|
4525
5202
|
type index_RegisterInput = RegisterInput;
|
|
4526
5203
|
type index_RunEnd = RunEnd;
|
|
5204
|
+
type index_RunKind = RunKind;
|
|
4527
5205
|
type index_RunRequest = RunRequest;
|
|
4528
5206
|
type index_RunStarter = RunStarter;
|
|
4529
5207
|
type index_RunningTurn = RunningTurn;
|
|
5208
|
+
type index_RuntimeCheck = RuntimeCheck;
|
|
4530
5209
|
type index_ServedManual = ServedManual;
|
|
4531
5210
|
type index_SignupAction = SignupAction;
|
|
4532
5211
|
type index_SyncManualOptions = SyncManualOptions;
|
|
@@ -4561,6 +5240,7 @@ declare const index_account: typeof account;
|
|
|
4561
5240
|
declare const index_anchor: typeof anchor;
|
|
4562
5241
|
declare const index_applyInviteOutcome: typeof applyInviteOutcome;
|
|
4563
5242
|
declare const index_applyOutcome: typeof applyOutcome;
|
|
5243
|
+
declare const index_conversationRunPrompt: typeof conversationRunPrompt;
|
|
4564
5244
|
declare const index_hostedMcpUrl: typeof hostedMcpUrl;
|
|
4565
5245
|
declare const index_inviteOutcome: typeof inviteOutcome;
|
|
4566
5246
|
declare const index_isTexts: typeof isTexts;
|
|
@@ -4573,7 +5253,7 @@ declare const index_syncManual: typeof syncManual;
|
|
|
4573
5253
|
declare const index_turnOutcome: typeof turnOutcome;
|
|
4574
5254
|
declare const index_writeAtomic: typeof writeAtomic;
|
|
4575
5255
|
declare namespace index {
|
|
4576
|
-
export { type index_AccountAnswer as AccountAnswer, type index_AccountCallOptions as AccountCallOptions, type index_AccountKind as AccountKind, type index_AccountLabels as AccountLabels, type index_AccountQuestion as AccountQuestion, type RunOptions as AccountRunOptions, type RunResult as AccountRunResult, type StepResult as AccountStepResult, type index_AgentChatCallCount as AgentChatCallCount, type index_CheckKeyResult as CheckKeyResult, type index_CoalescerCounters as CoalescerCounters, type index_CoalescerState as CoalescerState, type index_ConfirmedTurnEnd as ConfirmedTurnEnd, type index_CycleOutcome as CycleOutcome, type index_CycleSummary as CycleSummary, index_DEFAULT_MAX_MS as DEFAULT_MAX_MS, index_DEFAULT_QUIET_MS as DEFAULT_QUIET_MS, type index_FindOptions as FindOptions, type index_FoundBlock as FoundBlock, type index_GateChunkReport as GateChunkReport, index_HOSTED_MCP_PATH as HOSTED_MCP_PATH, type index_InviteOutcome as InviteOutcome, type index_InviteOutcomeClient as InviteOutcomeClient, type index_InviteOutcomeInput as InviteOutcomeInput, type index_InviteOutcomeReason as InviteOutcomeReason, index_MANUAL_FETCH_TIMEOUT_MS as MANUAL_FETCH_TIMEOUT_MS, index_MANUAL_MAX_BYTES as MANUAL_MAX_BYTES, index_MANUAL_MAX_REDIRECTS as MANUAL_MAX_REDIRECTS, index_MANUAL_SKILL_NAME as MANUAL_SKILL_NAME, type index_ManualFetch as ManualFetch, index_ManualSync as ManualSync, type index_ManualSyncOptions as ManualSyncOptions, type index_ManualSyncResult as ManualSyncResult, type index_ManualSyncState as ManualSyncState, type index_OutcomeClient as OutcomeClient, type index_ProbeHostedToolsOptions as ProbeHostedToolsOptions, type index_ProbeHostedToolsResult as ProbeHostedToolsResult, index_REQUIRED_HOSTED_TOOLS as REQUIRED_HOSTED_TOOLS, type index_Readiness as Readiness, index_ReceiveLoop as ReceiveLoop, type index_ReceiveLoopClient as ReceiveLoopClient, type index_ReceiveLoopEvent as ReceiveLoopEvent, type index_ReceiveLoopMode as ReceiveLoopMode, type index_ReceiveLoopOptions as ReceiveLoopOptions, type index_ReceiveLoopSocketOptions as ReceiveLoopSocketOptions, type index_ReceiveLoopStatus as ReceiveLoopStatus, type index_RecoverInput as RecoverInput, type index_RegisterInput as RegisterInput, type index_RunEnd as RunEnd, type index_RunRequest as RunRequest, type index_RunStarter as RunStarter, type index_RunningTurn as RunningTurn, type index_ServedManual as ServedManual, type index_SignupAction as SignupAction, type index_SyncManualOptions as SyncManualOptions, index_TEXTS_FETCH_TIMEOUT_MS as TEXTS_FETCH_TIMEOUT_MS, index_TEXTS_REFRESH_MS as TEXTS_REFRESH_MS, index_TEXTS_RETRY_MAX_MS as TEXTS_RETRY_MAX_MS, index_TEXTS_RETRY_MS as TEXTS_RETRY_MS, index_TextsCache as TextsCache, type index_TextsCacheOptions as TextsCacheOptions, type TextsSource$1 as TextsCacheSource, type index_TextsClient as TextsClient, type index_TextsListener as TextsListener, type index_TextsSource as TextsSource, type index_TimerHandle as TimerHandle, type index_TrackedTurn as TrackedTurn, type index_TurnAdmission as TurnAdmission, type index_TurnEnd as TurnEnd, type index_TurnHandle as TurnHandle, type index_TurnOutcome as TurnOutcome, type index_TurnOutcomeInput as TurnOutcomeInput, type index_TurnOutcomeReason as TurnOutcomeReason, type index_TurnRequest as TurnRequest, type index_TurnStarter as TurnStarter, index_TurnTracker as TurnTracker, index_WakeCoalescer as WakeCoalescer, type index_WakeCoalescerOptions as WakeCoalescerOptions, type index_WakeSource as WakeSource, type index_WriteAtomicOptions as WriteAtomicOptions, index_account as account, index_anchor as anchor, index_applyInviteOutcome as applyInviteOutcome, index_applyOutcome as applyOutcome, index_hostedMcpUrl as hostedMcpUrl, index_inviteOutcome as inviteOutcome, index_isTexts as isTexts, index_manualFrontMatter as manualFrontMatter, index_manualVersion as manualVersion, index_probeHostedTools as probeHostedTools, index_renameWithRetry as renameWithRetry, index_replyPrompt as replyPrompt, index_syncManual as syncManual, index_turnOutcome as turnOutcome, index_writeAtomic as writeAtomic };
|
|
5256
|
+
export { type index_AccountAnswer as AccountAnswer, type index_AccountCallOptions as AccountCallOptions, type index_AccountKind as AccountKind, type index_AccountLabels as AccountLabels, type index_AccountQuestion as AccountQuestion, type RunOptions as AccountRunOptions, type RunResult as AccountRunResult, type StepResult as AccountStepResult, type index_AgentChatCallCount as AgentChatCallCount, type index_CheckKeyResult as CheckKeyResult, type index_CoalescerCounters as CoalescerCounters, type index_CoalescerState as CoalescerState, type index_ConfirmedTurnEnd as ConfirmedTurnEnd, type index_CycleOutcome as CycleOutcome, type index_CycleSummary as CycleSummary, index_DEFAULT_MAX_MS as DEFAULT_MAX_MS, index_DEFAULT_QUIET_MS as DEFAULT_QUIET_MS, type index_FailureHoldReason as FailureHoldReason, type index_FailureSource as FailureSource, type index_FindOptions as FindOptions, type index_FoundBlock as FoundBlock, type index_GateChunkReport as GateChunkReport, index_HOSTED_MCP_PATH as HOSTED_MCP_PATH, type index_HeldConversation as HeldConversation, type index_InviteOutcome as InviteOutcome, type index_InviteOutcomeClient as InviteOutcomeClient, type index_InviteOutcomeInput as InviteOutcomeInput, type index_InviteOutcomeReason as InviteOutcomeReason, index_MANUAL_FETCH_TIMEOUT_MS as MANUAL_FETCH_TIMEOUT_MS, index_MANUAL_MAX_BYTES as MANUAL_MAX_BYTES, index_MANUAL_MAX_REDIRECTS as MANUAL_MAX_REDIRECTS, index_MANUAL_SKILL_NAME as MANUAL_SKILL_NAME, type index_ManualFetch as ManualFetch, index_ManualSync as ManualSync, type index_ManualSyncOptions as ManualSyncOptions, type index_ManualSyncResult as ManualSyncResult, type index_ManualSyncState as ManualSyncState, type index_OutcomeClient as OutcomeClient, type index_ProbeHostedToolsOptions as ProbeHostedToolsOptions, type index_ProbeHostedToolsResult as ProbeHostedToolsResult, type index_ProcessingFailureReport as ProcessingFailureReport, index_REQUIRED_HOSTED_TOOLS as REQUIRED_HOSTED_TOOLS, type index_Readiness as Readiness, index_ReceiveLoop as ReceiveLoop, type index_ReceiveLoopClient as ReceiveLoopClient, type index_ReceiveLoopEvent as ReceiveLoopEvent, type index_ReceiveLoopMode as ReceiveLoopMode, type index_ReceiveLoopOptions as ReceiveLoopOptions, type index_ReceiveLoopSocketOptions as ReceiveLoopSocketOptions, type index_ReceiveLoopStatus as ReceiveLoopStatus, type index_RecoverInput as RecoverInput, type index_RegisterInput as RegisterInput, type index_RunEnd as RunEnd, type index_RunKind as RunKind, type index_RunRequest as RunRequest, type index_RunStarter as RunStarter, type index_RunningTurn as RunningTurn, type index_RuntimeCheck as RuntimeCheck, type index_ServedManual as ServedManual, type index_SignupAction as SignupAction, type index_SyncManualOptions as SyncManualOptions, index_TEXTS_FETCH_TIMEOUT_MS as TEXTS_FETCH_TIMEOUT_MS, index_TEXTS_REFRESH_MS as TEXTS_REFRESH_MS, index_TEXTS_RETRY_MAX_MS as TEXTS_RETRY_MAX_MS, index_TEXTS_RETRY_MS as TEXTS_RETRY_MS, index_TextsCache as TextsCache, type index_TextsCacheOptions as TextsCacheOptions, type TextsSource$1 as TextsCacheSource, type index_TextsClient as TextsClient, type index_TextsListener as TextsListener, type index_TextsSource as TextsSource, type index_TimerHandle as TimerHandle, type index_TrackedTurn as TrackedTurn, type index_TurnAdmission as TurnAdmission, type index_TurnEnd as TurnEnd, type index_TurnHandle as TurnHandle, type index_TurnOutcome as TurnOutcome, type index_TurnOutcomeInput as TurnOutcomeInput, type index_TurnOutcomeReason as TurnOutcomeReason, type index_TurnRequest as TurnRequest, type index_TurnStarter as TurnStarter, index_TurnTracker as TurnTracker, index_WakeCoalescer as WakeCoalescer, type index_WakeCoalescerOptions as WakeCoalescerOptions, type index_WakeSource as WakeSource, type index_WriteAtomicOptions as WriteAtomicOptions, index_account as account, index_anchor as anchor, index_applyInviteOutcome as applyInviteOutcome, index_applyOutcome as applyOutcome, index_conversationRunPrompt as conversationRunPrompt, index_hostedMcpUrl as hostedMcpUrl, index_inviteOutcome as inviteOutcome, index_isTexts as isTexts, index_manualFrontMatter as manualFrontMatter, index_manualVersion as manualVersion, index_probeHostedTools as probeHostedTools, index_renameWithRetry as renameWithRetry, index_replyPrompt as replyPrompt, index_syncManual as syncManual, index_turnOutcome as turnOutcome, index_writeAtomic as writeAtomic };
|
|
4577
5257
|
}
|
|
4578
5258
|
|
|
4579
5259
|
/**
|
|
@@ -4890,4 +5570,4 @@ declare function renderMessageContext(message: Pick<Message, 'sender' | 'created
|
|
|
4890
5570
|
|
|
4891
5571
|
declare const VERSION: string;
|
|
4892
5572
|
|
|
4893
|
-
export { ALLOWED_ATTACHMENT_MIME, type AckFrame, type AddContactRequest, type AddMemberRequest, type AddMemberResult, type Agent, AgentChatClient, type AgentChatClientIdentity, type AgentChatClientKind, type AgentChatClientOptions, AgentChatError, type AgentChatErrorResponse, type AgentConversationContext, type AgentProfile, type AgentSettings, type AgentStatus, type AnyWakeFrame, type AnyWakePayload, type ApiError, type AttachmentMime, AwaitingReplyError, type BacklogWarning, type BacklogWarningHandler, type BlockedAgent, BlockedError, type BlockedHandler, type BlockedInfo, type BuildPromptOptions, CONNECT_BUDGET_CLOSE_CODE, CONNECT_BUDGET_MAX_DELAY_MS, CONNECT_BUDGET_MIN_DELAY_MS, type CallOptions, type ClearWakeWebhookResult, type ClientAction, type ConnectBudgetClose, type ConnectHandler, ConnectionError, type Contact, type Conversation, type ConversationListItem, type ConversationParticipant, type ConversationType, type ConversationsResource, type CreateGroupRequest, type CreateUploadRequest, type CreateUploadResponse, DEFAULT_RETRY_POLICY, type DecisionsResource, type DeletedGroupInfo, type DirectConversationLookup, type DisconnectHandler, type DisconnectInfo, EmailExhaustedError, EmailLimitReachedError, ErrorCode, type ErrorHandler, type ErrorInfo, ForbiddenError, type GateClient, type GateModelCall, type GateOutcome, type GateRecordFailure, type GateReply, type GateResult, type GateTexts, type GetTextsOptions, type Group, GroupDeletedError, type GroupDetail, type GroupInvitation, type GroupInvitePolicy, type GroupInviteRule, type GroupMember, type GroupRole, type GroupSettings, type GroupSystemEvent, type GroupSystemEventV1, type GroupsResource, HandleRequiredError, type HeartbeatFrame, type HeartbeatHandler, type HttpMethod, type HttpRequestOptions, type HttpResponse, HttpTransport, type HttpTransportOptions, INBOX_TRAY_DEFAULT_LIMIT, INBOX_TRAY_MAX_LIMIT, INBOX_WAIT_MAX_MS, type InboxCard, type InboxCardGroup, type InboxCardPreview, type InboxCardRelationship, type InboxMode, type InboxResource, type InboxTray, type InboxTrayOptions, type KnownReplyDecisionCategory, MAX_ATTACHMENT_SIZE, type MarkConversationReadRequest, type MarkConversationReadResult, type Message, type MessageContent, type MessageHandler, type MessageStatus, type MessageType, type MuteEntry, type MuteTargetKind, NotFoundError, type OtherWakePayload, OtpAttemptsExhaustedError, type PausedByOwner, type Presence, type PresenceBatchRequest, type PresenceBroadcast, type PresenceStatus, type PresenceUpdate, RateLimitedError, RealtimeClient, type RealtimeOptions, type RealtimeState, RecipientBackloggedError, type RecordReplyDecisionOptions, type RecordReplyDecisionRequest, type RecoverOptions, type RecoverRequest, type RecoverResult, type RecoverVerifyResult, type RegisterOptions, type RegisterRequest, type RegisterResult, type RegisterVerifyResult, type ReminderWakePayload, type RenderOptions, type ReplyDecision, type ReplyDecisionCategory, type ReplyDecisionVerdict, type ReportRequest, type RequestHooks, type RequestInfo, type ResponseInfo, RestrictedError, type RetryInfo, type RetryOption, type RetryPolicy, type RotateKeyResult, type RotateKeyVerifyResult, type RunGateOptions, type SendMessageRequest, type SendMessageResult, type SendableMessageType, type SequenceGapHandler, type SequenceGapInfo, ServerError, type ServerEvent, type SetWakeWebhookOptions, type SetWakeWebhookRequest, type SignupCodeStatus, type SignupFlow, type SignupFlowFields, type SignupFlowKind, type SignupNextStep, type SignupParam, type SignupStartStep, type SignupVerifyStep, type SocketCapability, type StateHandler, type StaticCallOptions, type StoppedHandler, SuspendedError, type SyncEnvelope, type SyncOptions, type SyncPage, type TestWakeResult, type Texts, type TextsResource, type TextsRuntime, type ToolNamer, type TrayInvite, type UnansweredWakePayload, UnauthorizedError, type UpdateAgentRequest, type UpdateContactRequest, type UpdateGroupRequest, VERSION, ValidationError, type Verdict, type VerifyRequest, type VerifyWakeWebhookOptions, type WakeDialect, type WakeFrame, type WakeHandler, type WakePayload, type WakeWebhookHeaders, type WakeWebhookPayload, type WakeWebhookResource, type WakeWebhookState, type WakeWebhookStatus, WakeWebhookVerificationError, type WakeWebhookVerifyDialect, type WakeWebhookVerifyReason, type WsMessage, connectBudgetDelayMs, createAgentChatError, gate, index as integration, isAuthRejectionClose, paginate, parseRetryAfter, renderMessageContext, verifyWakeWebhook, wakePayloadOf };
|
|
5573
|
+
export { ALLOWED_ATTACHMENT_MIME, type AckFrame, type AddContactRequest, type AddMemberRequest, type AddMemberResult, type Agent, AgentChatClient, type AgentChatClientIdentity, type AgentChatClientKind, type AgentChatClientOptions, AgentChatError, type AgentChatErrorResponse, type AgentConversationContext, type AgentProfile, type AgentSettings, type AgentStatus, type AnyWakeFrame, type AnyWakePayload, type ApiError, type AttachmentMime, AwaitingReplyError, type BacklogWarning, type BacklogWarningHandler, type BlockedAgent, BlockedError, type BlockedHandler, type BlockedInfo, type BuildPromptOptions, CONNECT_BUDGET_CLOSE_CODE, CONNECT_BUDGET_MAX_DELAY_MS, CONNECT_BUDGET_MIN_DELAY_MS, type CallOptions, type ClearWakeWebhookResult, type ClientAction, type ConnectBudgetClose, type ConnectHandler, ConnectionError, type Contact, type Conversation, type ConversationListItem, type ConversationParticipant, type ConversationType, type ConversationsResource, type CreateGroupRequest, type CreateUploadRequest, type CreateUploadResponse, DEFAULT_RETRY_POLICY, type DecisionsResource, type DeletedGroupInfo, type DirectConversationLookup, type DisconnectHandler, type DisconnectInfo, EmailExhaustedError, EmailLimitReachedError, ErrorCode, type ErrorHandler, type ErrorInfo, ForbiddenError, type GateClient, type GateModelCall, type GateOutcome, type GateRecordFailure, type GateReply, type GateResult, type GateTexts, type GetMessagesOptions, type GetTextsOptions, type Group, GroupDeletedError, type GroupDetail, type GroupInvitation, type GroupInvitePolicy, type GroupInviteRule, type GroupMember, type GroupRole, type GroupSettings, type GroupSystemEvent, type GroupSystemEventV1, type GroupsResource, HandleRequiredError, type HeartbeatFrame, type HeartbeatHandler, type HttpMethod, type HttpRequestOptions, type HttpResponse, HttpTransport, type HttpTransportOptions, INBOX_TRAY_DEFAULT_LIMIT, INBOX_TRAY_MAX_LIMIT, INBOX_WAIT_MAX_MS, type InboxCard, type InboxCardGroup, type InboxCardPreview, type InboxCardRelationship, type InboxMode, type InboxResource, type InboxTray, type InboxTrayOptions, type KnownReplyDecisionCategory, MAX_ATTACHMENT_SIZE, type MarkConversationReadRequest, type MarkConversationReadResult, type Message, type MessageContent, type MessageCouldNotProcess, type MessageHandler, type MessageStatus, type MessageType, type MessagesPage, type MuteEntry, type MuteTargetKind, NotFoundError, type OtherWakePayload, OtpAttemptsExhaustedError, type PausedByOwner, type Presence, type PresenceBatchRequest, type PresenceBroadcast, type PresenceStatus, type PresenceUpdate, type ProcessingFailureAction, type ProcessingFailureActionName, type ProcessingFailureEvidence, type ProcessingFailureOutcome, RateLimitedError, RealtimeClient, type RealtimeOptions, type RealtimeState, RecipientBackloggedError, type RecordReplyDecisionOptions, type RecordReplyDecisionRequest, type RecoverOptions, type RecoverRequest, type RecoverResult, type RecoverVerifyResult, type RegisterOptions, type RegisterRequest, type RegisterResult, type RegisterVerifyResult, type ReminderWakePayload, type RenderOptions, type ReplyDecision, type ReplyDecisionCategory, type ReplyDecisionVerdict, type ReportProcessingFailureOptions, type ReportProcessingFailureRequest, type ReportRequest, type RequestHooks, type RequestInfo, type ResponseInfo, RestrictedError, type RetryInfo, type RetryOption, type RetryPolicy, type RotateKeyResult, type RotateKeyVerifyResult, type RunGateOptions, type SendMessageRequest, type SendMessageResult, type SendableMessageType, type SequenceGapHandler, type SequenceGapInfo, ServerError, type ServerEvent, type SetWakeWebhookOptions, type SetWakeWebhookRequest, type SignupCodeStatus, type SignupFlow, type SignupFlowFields, type SignupFlowKind, type SignupNextStep, type SignupParam, type SignupStartStep, type SignupVerifyStep, type SocketCapability, type StateHandler, type StaticCallOptions, type StoppedHandler, SuspendedError, type SyncEnvelope, type SyncOptions, type SyncPage, type TestWakeResult, type Texts, type TextsResource, type TextsRuntime, type ToolNamer, type TrayInvite, type UnansweredWakePayload, UnauthorizedError, type UpdateAgentRequest, type UpdateContactRequest, type UpdateGroupRequest, VERSION, ValidationError, type Verdict, type VerifyRequest, type VerifyWakeWebhookOptions, type WakeDialect, type WakeFrame, type WakeHandler, type WakePayload, type WakeWebhookHeaders, type WakeWebhookPayload, type WakeWebhookResource, type WakeWebhookState, type WakeWebhookStatus, WakeWebhookVerificationError, type WakeWebhookVerifyDialect, type WakeWebhookVerifyReason, type WsMessage, connectBudgetDelayMs, createAgentChatError, gate, index as integration, isAuthRejectionClose, paginate, parseRetryAfter, renderMessageContext, verifyWakeWebhook, wakePayloadOf };
|