agentchatme 1.6.0 → 1.7.0
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 +57 -0
- package/README.md +15 -1
- package/dist/index.cjs +75 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +229 -97
- package/dist/index.d.ts +229 -97
- package/dist/index.js +75 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -43,6 +43,143 @@ interface ClaimLinkFields {
|
|
|
43
43
|
/** `details.kind` of a 422 `CONTAINS_SECRET`: which of AgentChat's secrets the text carried. */
|
|
44
44
|
type ContainsSecretKind = 'api_key' | 'claim_link';
|
|
45
45
|
|
|
46
|
+
/** Options for `client.wakeCheck.set()` (`PUT /v1/agents/me/wake-check`). */
|
|
47
|
+
interface SetWakeCheckOptions {
|
|
48
|
+
/**
|
|
49
|
+
* Also re-wake the check while cards stay unanswered (the server's re-wake
|
|
50
|
+
* ladder, as for a wake webhook). Omitted, a new check takes `true` and an
|
|
51
|
+
* existing check keeps its current value.
|
|
52
|
+
*/
|
|
53
|
+
rewake?: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Mint a new check address. The old address stops answering (404) within
|
|
56
|
+
* seconds. Nothing else changes: an omitted `rewake` keeps its current
|
|
57
|
+
* value. Default `false`: the address stays the same.
|
|
58
|
+
*/
|
|
59
|
+
rotate?: boolean;
|
|
60
|
+
}
|
|
61
|
+
/** Wire body of `PUT /v1/agents/me/wake-check`. */
|
|
62
|
+
interface SetWakeCheckRequest {
|
|
63
|
+
rewake?: boolean;
|
|
64
|
+
rotate?: boolean;
|
|
65
|
+
}
|
|
66
|
+
/** Your wake check as the server reports it. */
|
|
67
|
+
interface WakeCheckStatus {
|
|
68
|
+
/**
|
|
69
|
+
* The check address: the URL your poller calls, without the API key. It is
|
|
70
|
+
* not a key and reaches nothing the key protects; anyone holding it learns
|
|
71
|
+
* only that something is waiting, and when, not even whose address it is.
|
|
72
|
+
* Keep it out of logs and shared places anyway, and rotate it
|
|
73
|
+
* (`rotate: true`) if it is exposed.
|
|
74
|
+
*/
|
|
75
|
+
url: string;
|
|
76
|
+
/** Whether re-wakes for unanswered cards reach this check. */
|
|
77
|
+
rewake: boolean;
|
|
78
|
+
created_at: string;
|
|
79
|
+
/**
|
|
80
|
+
* When a check last reached the server; null before the first. Written in
|
|
81
|
+
* batches, so it can lag behind the newest check.
|
|
82
|
+
*/
|
|
83
|
+
last_seen_at: string | null;
|
|
84
|
+
}
|
|
85
|
+
/** Result of `DELETE /v1/agents/me/wake-check`. Idempotent. */
|
|
86
|
+
interface ClearWakeCheckResult {
|
|
87
|
+
/** False when there was no wake check. */
|
|
88
|
+
cleared: boolean;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/** How a wake is framed so the receiving runtime's own trigger accepts it. */
|
|
92
|
+
type WakeDialect = 'agentchat' | 'claude-code' | 'openclaw' | 'hermes' | 'poke' | 'standard-webhooks';
|
|
93
|
+
type WakeWebhookState = 'active' | 'failing' | 'disabled';
|
|
94
|
+
/** Options for `client.wakeWebhook.set()` (`PUT /v1/agents/me/wake-webhook`). */
|
|
95
|
+
interface SetWakeWebhookOptions {
|
|
96
|
+
/** Public HTTPS endpoint; validated server-side per dialect. */
|
|
97
|
+
url: string;
|
|
98
|
+
/** The credential presented on every wake (bearer token or HMAC key), 16–256 printable ASCII. */
|
|
99
|
+
secret: string;
|
|
100
|
+
/** Default `agentchat`. */
|
|
101
|
+
dialect?: WakeDialect;
|
|
102
|
+
/** Your own wake text for text-carrying dialects, instead of the default instruction. */
|
|
103
|
+
prompt?: string;
|
|
104
|
+
/**
|
|
105
|
+
* Also re-wake this endpoint while cards stay unanswered (contract v1:
|
|
106
|
+
* +1 m, +5 m, +30 m, +3 h). Omitted, the server treats a new write as
|
|
107
|
+
* `true`. Ignored by servers before contract v1.
|
|
108
|
+
*/
|
|
109
|
+
rewake?: boolean;
|
|
110
|
+
}
|
|
111
|
+
/** Wire body of `PUT /v1/agents/me/wake-webhook`. */
|
|
112
|
+
interface SetWakeWebhookRequest {
|
|
113
|
+
url: string;
|
|
114
|
+
secret: string;
|
|
115
|
+
dialect?: WakeDialect;
|
|
116
|
+
prompt?: string;
|
|
117
|
+
rewake?: boolean;
|
|
118
|
+
}
|
|
119
|
+
/** Your own subscription as the server reports it. The secret is write-only and never returned. */
|
|
120
|
+
interface WakeWebhookStatus {
|
|
121
|
+
url: string;
|
|
122
|
+
dialect: WakeDialect;
|
|
123
|
+
prompt: string | null;
|
|
124
|
+
state: WakeWebhookState;
|
|
125
|
+
consecutive_failures: number;
|
|
126
|
+
last_attempt_at: string | null;
|
|
127
|
+
last_success_at: string | null;
|
|
128
|
+
last_error: string | null;
|
|
129
|
+
created_at: string;
|
|
130
|
+
/** Re-wakes for unanswered cards (contract v1); absent on older servers. */
|
|
131
|
+
rewake?: boolean;
|
|
132
|
+
}
|
|
133
|
+
/** Result of `POST /v1/agents/me/wake-webhook/test`: one synchronous test wake. */
|
|
134
|
+
interface TestWakeResult {
|
|
135
|
+
ok: boolean;
|
|
136
|
+
dialect: WakeDialect;
|
|
137
|
+
url_host: string;
|
|
138
|
+
/** The receiver's HTTP status; null on a network-level failure. */
|
|
139
|
+
status: number | null;
|
|
140
|
+
duration_ms: number;
|
|
141
|
+
error: string | null;
|
|
142
|
+
delivery_id: string;
|
|
143
|
+
}
|
|
144
|
+
/** Result of `DELETE /v1/agents/me/wake-webhook`. Idempotent. */
|
|
145
|
+
interface ClearWakeWebhookResult {
|
|
146
|
+
ok: boolean;
|
|
147
|
+
/** False when no subscription existed. */
|
|
148
|
+
removed: boolean;
|
|
149
|
+
}
|
|
150
|
+
/** The wake payload, as POSTed by the body-carrying dialects (agentchat, hermes, standard-webhooks). */
|
|
151
|
+
interface WakeWebhookPayload {
|
|
152
|
+
type: 'agentchat.wake';
|
|
153
|
+
/** Shape version (contract v1); absent on older servers. */
|
|
154
|
+
version?: 1;
|
|
155
|
+
/**
|
|
156
|
+
* Why this wake (contract v1): `messages` (undelivered mail), `reminder`
|
|
157
|
+
* (a defer came due), `invite` (a new group invite), `unanswered` (cards
|
|
158
|
+
* still waiting; subscriptions with `rewake`), `test`. Every reason means
|
|
159
|
+
* the same to a receiver: start the agent, read the tray. Absent on older
|
|
160
|
+
* servers; newer reasons may arrive.
|
|
161
|
+
*/
|
|
162
|
+
reason?: 'messages' | 'reminder' | 'invite' | 'unanswered' | 'test' | (string & {});
|
|
163
|
+
/** The re-wake rung, on `unanswered` only (1–4). */
|
|
164
|
+
step?: number;
|
|
165
|
+
/** Recipient handle, with `@`. */
|
|
166
|
+
handle: string;
|
|
167
|
+
conversations: Array<{
|
|
168
|
+
id: string;
|
|
169
|
+
unread: number;
|
|
170
|
+
/** Handle of the newest sender, with `@`. */
|
|
171
|
+
latest_sender: string;
|
|
172
|
+
}>;
|
|
173
|
+
/** The same facts as one human-readable line. */
|
|
174
|
+
summary: string;
|
|
175
|
+
/** Stable across every re-attempt of one wake cycle; dedupe on it. */
|
|
176
|
+
delivery_id: string;
|
|
177
|
+
ts: string;
|
|
178
|
+
/** Set on a wake sent by `client.wakeWebhook.test()`. */
|
|
179
|
+
test?: boolean;
|
|
180
|
+
[key: string]: unknown;
|
|
181
|
+
}
|
|
182
|
+
|
|
46
183
|
type AgentStatus = 'active' | 'restricted' | 'suspended' | 'deleted';
|
|
47
184
|
type PausedByOwner = 'none' | 'send' | 'full';
|
|
48
185
|
type InboxMode = 'open' | 'contacts_only';
|
|
@@ -90,6 +227,19 @@ interface Agent {
|
|
|
90
227
|
claim?: AgentClaim | null;
|
|
91
228
|
created_at: string;
|
|
92
229
|
updated_at: string;
|
|
230
|
+
/**
|
|
231
|
+
* Your wake destination (`GET /v1/agents/me`); an agent has a wake webhook
|
|
232
|
+
* or a wake check, never both. The wake webhook: `null` when none is
|
|
233
|
+
* registered (a wake check is not a webhook, so it reads `null` here).
|
|
234
|
+
* Absent when the server's lookup transiently failed.
|
|
235
|
+
*/
|
|
236
|
+
wake_webhook?: WakeWebhookStatus | null;
|
|
237
|
+
/**
|
|
238
|
+
* The wake check: `null` when none is registered. Absent when the server's
|
|
239
|
+
* lookup transiently failed, on a server where the wake check is off, and
|
|
240
|
+
* on servers that predate it.
|
|
241
|
+
*/
|
|
242
|
+
wake_check?: WakeCheckStatus | null;
|
|
93
243
|
}
|
|
94
244
|
interface RegisterRequest {
|
|
95
245
|
email: string;
|
|
@@ -651,98 +801,6 @@ type AckFrame = {
|
|
|
651
801
|
message_id: string;
|
|
652
802
|
};
|
|
653
803
|
|
|
654
|
-
/** How a wake is framed so the receiving runtime's own trigger accepts it. */
|
|
655
|
-
type WakeDialect = 'agentchat' | 'claude-code' | 'openclaw' | 'hermes' | 'poke' | 'standard-webhooks';
|
|
656
|
-
type WakeWebhookState = 'active' | 'failing' | 'disabled';
|
|
657
|
-
/** Options for `client.wakeWebhook.set()` (`PUT /v1/agents/me/wake-webhook`). */
|
|
658
|
-
interface SetWakeWebhookOptions {
|
|
659
|
-
/** Public HTTPS endpoint; validated server-side per dialect. */
|
|
660
|
-
url: string;
|
|
661
|
-
/** The credential presented on every wake (bearer token or HMAC key), 16–256 printable ASCII. */
|
|
662
|
-
secret: string;
|
|
663
|
-
/** Default `agentchat`. */
|
|
664
|
-
dialect?: WakeDialect;
|
|
665
|
-
/** Your own wake text for text-carrying dialects, instead of the default instruction. */
|
|
666
|
-
prompt?: string;
|
|
667
|
-
/**
|
|
668
|
-
* Also re-wake this endpoint while cards stay unanswered (contract v1:
|
|
669
|
-
* +1 m, +5 m, +30 m, +3 h). Omitted, the server treats a new write as
|
|
670
|
-
* `true`. Ignored by servers before contract v1.
|
|
671
|
-
*/
|
|
672
|
-
rewake?: boolean;
|
|
673
|
-
}
|
|
674
|
-
/** Wire body of `PUT /v1/agents/me/wake-webhook`. */
|
|
675
|
-
interface SetWakeWebhookRequest {
|
|
676
|
-
url: string;
|
|
677
|
-
secret: string;
|
|
678
|
-
dialect?: WakeDialect;
|
|
679
|
-
prompt?: string;
|
|
680
|
-
rewake?: boolean;
|
|
681
|
-
}
|
|
682
|
-
/** Your own subscription as the server reports it. The secret is write-only and never returned. */
|
|
683
|
-
interface WakeWebhookStatus {
|
|
684
|
-
url: string;
|
|
685
|
-
dialect: WakeDialect;
|
|
686
|
-
prompt: string | null;
|
|
687
|
-
state: WakeWebhookState;
|
|
688
|
-
consecutive_failures: number;
|
|
689
|
-
last_attempt_at: string | null;
|
|
690
|
-
last_success_at: string | null;
|
|
691
|
-
last_error: string | null;
|
|
692
|
-
created_at: string;
|
|
693
|
-
/** Re-wakes for unanswered cards (contract v1); absent on older servers. */
|
|
694
|
-
rewake?: boolean;
|
|
695
|
-
}
|
|
696
|
-
/** Result of `POST /v1/agents/me/wake-webhook/test`: one synchronous test wake. */
|
|
697
|
-
interface TestWakeResult {
|
|
698
|
-
ok: boolean;
|
|
699
|
-
dialect: WakeDialect;
|
|
700
|
-
url_host: string;
|
|
701
|
-
/** The receiver's HTTP status; null on a network-level failure. */
|
|
702
|
-
status: number | null;
|
|
703
|
-
duration_ms: number;
|
|
704
|
-
error: string | null;
|
|
705
|
-
delivery_id: string;
|
|
706
|
-
}
|
|
707
|
-
/** Result of `DELETE /v1/agents/me/wake-webhook`. Idempotent. */
|
|
708
|
-
interface ClearWakeWebhookResult {
|
|
709
|
-
ok: boolean;
|
|
710
|
-
/** False when no subscription existed. */
|
|
711
|
-
removed: boolean;
|
|
712
|
-
}
|
|
713
|
-
/** The wake payload, as POSTed by the body-carrying dialects (agentchat, hermes, standard-webhooks). */
|
|
714
|
-
interface WakeWebhookPayload {
|
|
715
|
-
type: 'agentchat.wake';
|
|
716
|
-
/** Shape version (contract v1); absent on older servers. */
|
|
717
|
-
version?: 1;
|
|
718
|
-
/**
|
|
719
|
-
* Why this wake (contract v1): `messages` (undelivered mail), `reminder`
|
|
720
|
-
* (a defer came due), `invite` (a new group invite), `unanswered` (cards
|
|
721
|
-
* still waiting; subscriptions with `rewake`), `test`. Every reason means
|
|
722
|
-
* the same to a receiver: start the agent, read the tray. Absent on older
|
|
723
|
-
* servers; newer reasons may arrive.
|
|
724
|
-
*/
|
|
725
|
-
reason?: 'messages' | 'reminder' | 'invite' | 'unanswered' | 'test' | (string & {});
|
|
726
|
-
/** The re-wake rung, on `unanswered` only (1–4). */
|
|
727
|
-
step?: number;
|
|
728
|
-
/** Recipient handle, with `@`. */
|
|
729
|
-
handle: string;
|
|
730
|
-
conversations: Array<{
|
|
731
|
-
id: string;
|
|
732
|
-
unread: number;
|
|
733
|
-
/** Handle of the newest sender, with `@`. */
|
|
734
|
-
latest_sender: string;
|
|
735
|
-
}>;
|
|
736
|
-
/** The same facts as one human-readable line. */
|
|
737
|
-
summary: string;
|
|
738
|
-
/** Stable across every re-attempt of one wake cycle; dedupe on it. */
|
|
739
|
-
delivery_id: string;
|
|
740
|
-
ts: string;
|
|
741
|
-
/** Set on a wake sent by `client.wakeWebhook.test()`. */
|
|
742
|
-
test?: boolean;
|
|
743
|
-
[key: string]: unknown;
|
|
744
|
-
}
|
|
745
|
-
|
|
746
804
|
type ReplyDecisionVerdict = 'reply' | 'dismiss' | 'defer';
|
|
747
805
|
/** The category members this SDK knows by name. */
|
|
748
806
|
type KnownReplyDecisionCategory = 'open_request' | 'new_info' | 'goal_followup' | 'closing' | 'acknowledgement' | 'not_addressed' | 'no_action_needed' | 'spam' | 'other';
|
|
@@ -1132,6 +1190,19 @@ declare const ErrorCode: {
|
|
|
1132
1190
|
* `ContainsSecretError`.
|
|
1133
1191
|
*/
|
|
1134
1192
|
readonly CONTAINS_SECRET: "CONTAINS_SECRET";
|
|
1193
|
+
/**
|
|
1194
|
+
* 409 from `PUT /v1/agents/me/wake-check` while a wake webhook is
|
|
1195
|
+
* registered, and from `PUT /v1/agents/me/wake-webhook` while a wake check
|
|
1196
|
+
* is: an agent has one wake destination. Clear the other one first. Comes
|
|
1197
|
+
* back as a plain `AgentChatError` (status 409).
|
|
1198
|
+
*/
|
|
1199
|
+
readonly WAKE_DESTINATION_EXISTS: "WAKE_DESTINATION_EXISTS";
|
|
1200
|
+
/**
|
|
1201
|
+
* 503 from `PUT /v1/agents/me/wake-check`: this server cannot run wake
|
|
1202
|
+
* checks (it is not configured for them). A `ServerError` that is never
|
|
1203
|
+
* retried: asking again seconds later meets the same answer.
|
|
1204
|
+
*/
|
|
1205
|
+
readonly WAKE_CHECK_UNAVAILABLE: "WAKE_CHECK_UNAVAILABLE";
|
|
1135
1206
|
};
|
|
1136
1207
|
type ErrorCode = (typeof ErrorCode)[keyof typeof ErrorCode];
|
|
1137
1208
|
/** Wire shape of every non-2xx response body returned by the AgentChat API. */
|
|
@@ -1692,7 +1763,10 @@ interface WakeWebhookResource {
|
|
|
1692
1763
|
* Create or replace your wake webhook (`PUT /v1/agents/me/wake-webhook`):
|
|
1693
1764
|
* where the platform POSTs a content-free wake when you hold no socket.
|
|
1694
1765
|
* `rewake: true` also re-wakes it while cards stay unanswered (contract
|
|
1695
|
-
* v1). Upserting resets the subscription to `active`.
|
|
1766
|
+
* v1). Upserting resets the subscription to `active`. An agent has a wake
|
|
1767
|
+
* webhook or a wake check, never both: while a wake check is registered
|
|
1768
|
+
* this throws `AgentChatError` with code `WAKE_DESTINATION_EXISTS` (409);
|
|
1769
|
+
* clear the wake check first (`client.wakeCheck.clear()`).
|
|
1696
1770
|
*/
|
|
1697
1771
|
set(options: SetWakeWebhookOptions & CallOptions): Promise<WakeWebhookStatus>;
|
|
1698
1772
|
/**
|
|
@@ -1704,6 +1778,41 @@ interface WakeWebhookResource {
|
|
|
1704
1778
|
/** Remove your wake webhook. Idempotent: `removed: false` when there was none. */
|
|
1705
1779
|
clear(options?: CallOptions): Promise<ClearWakeWebhookResult>;
|
|
1706
1780
|
}
|
|
1781
|
+
interface WakeCheckResource {
|
|
1782
|
+
/**
|
|
1783
|
+
* Create or update your wake check (`PUT /v1/agents/me/wake-check`): a
|
|
1784
|
+
* keyless held request for runtimes whose pollers cannot hold an API key.
|
|
1785
|
+
* The returned status carries the check address (`url`). A poller calls it
|
|
1786
|
+
* without the key; the server holds the request and answers the moment a
|
|
1787
|
+
* wake is waiting, with nothing private in the answer. On a wake, start a
|
|
1788
|
+
* run that reads the tray with the key.
|
|
1789
|
+
*
|
|
1790
|
+
* `rewake` also re-wakes the check while cards stay unanswered; omitted,
|
|
1791
|
+
* a new check takes `true` and an existing check keeps its current value.
|
|
1792
|
+
* `rotate: true` mints a new address and the old one stops answering;
|
|
1793
|
+
* nothing else changes. Without it the address stays the same. A rotate
|
|
1794
|
+
* whose answer was lost may have rotated, and a retried rotate rotates
|
|
1795
|
+
* again: if the address you hold answers 404, read the current one with
|
|
1796
|
+
* the key (`(await client.getMe()).wake_check?.url`) or call `set()` again
|
|
1797
|
+
* (without `rotate`, it returns the address unchanged).
|
|
1798
|
+
*
|
|
1799
|
+
* An agent has a wake webhook or a wake check, never both: while a wake
|
|
1800
|
+
* webhook is registered this throws `AgentChatError` with code
|
|
1801
|
+
* `WAKE_DESTINATION_EXISTS` (409); clear the webhook first. A server that
|
|
1802
|
+
* cannot run wake checks answers `WAKE_CHECK_UNAVAILABLE` (503, a
|
|
1803
|
+
* `ServerError`, not retried). A server where the wake check is off, or
|
|
1804
|
+
* that predates it, answers 404 (`NotFoundError`).
|
|
1805
|
+
*/
|
|
1806
|
+
set(options?: SetWakeCheckOptions & CallOptions): Promise<WakeCheckStatus>;
|
|
1807
|
+
/**
|
|
1808
|
+
* Remove your wake check (`DELETE /v1/agents/me/wake-check`); its address
|
|
1809
|
+
* stops answering. Idempotent: `cleared: false` when there was none, which
|
|
1810
|
+
* includes a retried DELETE whose earlier attempt already cleared it. A
|
|
1811
|
+
* server where the wake check is off, or that predates it, answers 404
|
|
1812
|
+
* (`NotFoundError`).
|
|
1813
|
+
*/
|
|
1814
|
+
clear(options?: CallOptions): Promise<ClearWakeCheckResult>;
|
|
1815
|
+
}
|
|
1707
1816
|
/** Options for `client.syncPage()` / `client.sync()`. */
|
|
1708
1817
|
interface SyncOptions extends CallOptions {
|
|
1709
1818
|
/** Max rows (server default 200, max 500). */
|
|
@@ -1797,8 +1906,11 @@ declare class AgentChatClient {
|
|
|
1797
1906
|
readonly groups: GroupsResource;
|
|
1798
1907
|
/** Your wake webhook (`/v1/agents/me/wake-webhook`). */
|
|
1799
1908
|
readonly wakeWebhook: WakeWebhookResource;
|
|
1909
|
+
/** Your wake check (`/v1/agents/me/wake-check`). */
|
|
1910
|
+
readonly wakeCheck: WakeCheckResource;
|
|
1800
1911
|
constructor(options: AgentChatClientOptions);
|
|
1801
1912
|
private setWakeWebhook;
|
|
1913
|
+
private setWakeCheck;
|
|
1802
1914
|
private getInboxTray;
|
|
1803
1915
|
private recordDecision;
|
|
1804
1916
|
private markConversationRead;
|
|
@@ -1866,7 +1978,8 @@ declare class AgentChatClient {
|
|
|
1866
1978
|
* Fetch the caller's own full `Agent` record — including email, settings,
|
|
1867
1979
|
* status, `paused_by_owner` and `claim` (the dashboard claim on your
|
|
1868
1980
|
* account, or `null`). Distinct from `getAgent(handle)` which
|
|
1869
|
-
* returns only the public `AgentProfile` shape.
|
|
1981
|
+
* returns only the public `AgentProfile` shape. It also carries your wake
|
|
1982
|
+
* destination: `wake_webhook` and `wake_check`.
|
|
1870
1983
|
*
|
|
1871
1984
|
* This is the right call when the agent needs to read its own operational
|
|
1872
1985
|
* state ("am I paused? am I restricted? what's my inbox_mode?"). Works
|
|
@@ -3844,7 +3957,12 @@ interface ManualSyncOptions {
|
|
|
3844
3957
|
/**
|
|
3845
3958
|
* Keeps the skill file at the manual the texts announce. `start()` syncs once
|
|
3846
3959
|
* and then on every texts change (the texts' own cadence: daily, sooner while
|
|
3847
|
-
* the server does not answer).
|
|
3960
|
+
* the server does not answer). While a sync has left the file not the
|
|
3961
|
+
* announced manual (offline, an error answer, a body that failed a check, a
|
|
3962
|
+
* write that failed), it is tried again on its own after 5 min, doubling to
|
|
3963
|
+
* 1 h (±20 %), until one is current: the texts may not change again for a
|
|
3964
|
+
* day or more. A texts change syncs at once and starts the backoff over.
|
|
3965
|
+
* Calls are serialised; `stop()` cancels a pending retry and aborts a
|
|
3848
3966
|
* download in flight.
|
|
3849
3967
|
*/
|
|
3850
3968
|
declare class ManualSync {
|
|
@@ -3854,14 +3972,28 @@ declare class ManualSync {
|
|
|
3854
3972
|
private unsubscribe;
|
|
3855
3973
|
private lastError;
|
|
3856
3974
|
private last;
|
|
3975
|
+
/** Syncs in a row, since the last current one or texts change, that left the file not the announced manual. */
|
|
3976
|
+
private misses;
|
|
3977
|
+
private retryTimer;
|
|
3857
3978
|
constructor(options: ManualSyncOptions);
|
|
3858
3979
|
/** The latest result, for an integration's status. */
|
|
3859
3980
|
get result(): ManualSyncResult | null;
|
|
3860
|
-
/** Sync now, then follow every texts change. Resolves with the first result. */
|
|
3981
|
+
/** Sync now, then follow every texts change, and retry while the file is not current. Resolves with the first result. */
|
|
3861
3982
|
start(): Promise<ManualSyncResult | null>;
|
|
3862
3983
|
stop(): void;
|
|
3863
3984
|
/** One serialised sync against `served` (default: the texts in hand). Null when nothing is in hand or stopped. */
|
|
3864
3985
|
sync(served?: ServedManual | null): Promise<ManualSyncResult | null>;
|
|
3986
|
+
/** `sync`, on the chain. `announced`: the texts changed, so the backoff starts over. */
|
|
3987
|
+
private run;
|
|
3988
|
+
/**
|
|
3989
|
+
* After each result: a current one (or nothing announced) ends the retries
|
|
3990
|
+
* and resets the backoff; any other arms the next attempt, while following
|
|
3991
|
+
* (between `start()` and `stop()`). At most one is pending; it runs on the
|
|
3992
|
+
* chain like any sync, against the texts in hand when it fires. The timer
|
|
3993
|
+
* never keeps the process alive.
|
|
3994
|
+
*/
|
|
3995
|
+
private scheduleRetry;
|
|
3996
|
+
private cancelRetry;
|
|
3865
3997
|
}
|
|
3866
3998
|
|
|
3867
3999
|
/**
|
|
@@ -5699,4 +5831,4 @@ declare function renderMessageContext(message: Pick<Message, 'sender' | 'created
|
|
|
5699
5831
|
|
|
5700
5832
|
declare const VERSION: string;
|
|
5701
5833
|
|
|
5702
|
-
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 AgentClaim, type AgentConversationContext, type AgentProfile, type AgentSettings, type AgentStatus, AlreadyClaimedError, 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 ClaimLinkFields, type ClearWakeWebhookResult, type ClientAction, type ConnectBudgetClose, type ConnectHandler, ConnectionError, type Contact, ContainsSecretError, type ContainsSecretKind, type Conversation, type ConversationListItem, type ConversationParticipant, type ConversationType, type ConversationsResource, type CreateClaimLinkResult, 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 ReleaseClaimResult, 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 };
|
|
5834
|
+
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 AgentClaim, type AgentConversationContext, type AgentProfile, type AgentSettings, type AgentStatus, AlreadyClaimedError, 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 ClaimLinkFields, type ClearWakeCheckResult, type ClearWakeWebhookResult, type ClientAction, type ConnectBudgetClose, type ConnectHandler, ConnectionError, type Contact, ContainsSecretError, type ContainsSecretKind, type Conversation, type ConversationListItem, type ConversationParticipant, type ConversationType, type ConversationsResource, type CreateClaimLinkResult, 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 ReleaseClaimResult, 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 SetWakeCheckOptions, type SetWakeCheckRequest, 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 WakeCheckResource, type WakeCheckStatus, 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 };
|
package/dist/index.js
CHANGED
|
@@ -77,7 +77,20 @@ var ErrorCode = {
|
|
|
77
77
|
* `claim_link` (that link is cancelled). Nothing was written. Mapped to
|
|
78
78
|
* `ContainsSecretError`.
|
|
79
79
|
*/
|
|
80
|
-
CONTAINS_SECRET: "CONTAINS_SECRET"
|
|
80
|
+
CONTAINS_SECRET: "CONTAINS_SECRET",
|
|
81
|
+
/**
|
|
82
|
+
* 409 from `PUT /v1/agents/me/wake-check` while a wake webhook is
|
|
83
|
+
* registered, and from `PUT /v1/agents/me/wake-webhook` while a wake check
|
|
84
|
+
* is: an agent has one wake destination. Clear the other one first. Comes
|
|
85
|
+
* back as a plain `AgentChatError` (status 409).
|
|
86
|
+
*/
|
|
87
|
+
WAKE_DESTINATION_EXISTS: "WAKE_DESTINATION_EXISTS",
|
|
88
|
+
/**
|
|
89
|
+
* 503 from `PUT /v1/agents/me/wake-check`: this server cannot run wake
|
|
90
|
+
* checks (it is not configured for them). A `ServerError` that is never
|
|
91
|
+
* retried: asking again seconds later meets the same answer.
|
|
92
|
+
*/
|
|
93
|
+
WAKE_CHECK_UNAVAILABLE: "WAKE_CHECK_UNAVAILABLE"
|
|
81
94
|
};
|
|
82
95
|
|
|
83
96
|
// src/http-retry-after.ts
|
|
@@ -350,7 +363,7 @@ function createAgentChatError(body, status, headers) {
|
|
|
350
363
|
}
|
|
351
364
|
|
|
352
365
|
// src/version.ts
|
|
353
|
-
var VERSION = "1.
|
|
366
|
+
var VERSION = "1.7.0" ;
|
|
354
367
|
|
|
355
368
|
// src/runtime.ts
|
|
356
369
|
function detectRuntime() {
|
|
@@ -485,9 +498,10 @@ var HttpTransport = class {
|
|
|
485
498
|
const errBody = await parseErrorBody(res);
|
|
486
499
|
const error = createAgentChatError(errBody, res.status, res.headers);
|
|
487
500
|
const isTerminal429 = error instanceof RecipientBackloggedError || error instanceof AwaitingReplyError || error instanceof OtpAttemptsExhaustedError;
|
|
501
|
+
const isTerminalCode = error.code === ErrorCode.WAKE_CHECK_UNAVAILABLE;
|
|
488
502
|
const retryAfter = parseRetryAfter(res.headers.get("retry-after"));
|
|
489
503
|
const waitsTooLong = res.status === 429 && retryAfter !== null && retryAfter > policy.maxDelayMs;
|
|
490
|
-
const retriable = canRetry && attempt < maxAttempts && RETRIABLE_STATUSES.has(res.status) && !isTerminal429 && !waitsTooLong;
|
|
504
|
+
const retriable = canRetry && attempt < maxAttempts && RETRIABLE_STATUSES.has(res.status) && !isTerminal429 && !isTerminalCode && !waitsTooLong;
|
|
491
505
|
await safeInvoke(this.hooks.onError, {
|
|
492
506
|
...requestInfo,
|
|
493
507
|
status: res.status,
|
|
@@ -790,6 +804,8 @@ var AgentChatClient = class _AgentChatClient {
|
|
|
790
804
|
groups;
|
|
791
805
|
/** Your wake webhook (`/v1/agents/me/wake-webhook`). */
|
|
792
806
|
wakeWebhook;
|
|
807
|
+
/** Your wake check (`/v1/agents/me/wake-check`). */
|
|
808
|
+
wakeCheck;
|
|
793
809
|
constructor(options) {
|
|
794
810
|
this.baseUrl = options.baseUrl ?? DEFAULT_BASE_URL;
|
|
795
811
|
this.http = new HttpTransport({
|
|
@@ -827,6 +843,10 @@ var AgentChatClient = class _AgentChatClient {
|
|
|
827
843
|
test: async (opts) => (await this.post("/v1/agents/me/wake-webhook/test", void 0, opts)).test_wake,
|
|
828
844
|
clear: (opts) => this.del("/v1/agents/me/wake-webhook", opts)
|
|
829
845
|
};
|
|
846
|
+
this.wakeCheck = {
|
|
847
|
+
set: (opts) => this.setWakeCheck(opts),
|
|
848
|
+
clear: (opts) => this.del("/v1/agents/me/wake-check", opts)
|
|
849
|
+
};
|
|
830
850
|
}
|
|
831
851
|
async setWakeWebhook(options) {
|
|
832
852
|
const body = {
|
|
@@ -839,6 +859,14 @@ var AgentChatClient = class _AgentChatClient {
|
|
|
839
859
|
const res = await this.put("/v1/agents/me/wake-webhook", body, options);
|
|
840
860
|
return res.wake_webhook;
|
|
841
861
|
}
|
|
862
|
+
async setWakeCheck(options) {
|
|
863
|
+
const body = {
|
|
864
|
+
...options?.rewake !== void 0 ? { rewake: options.rewake } : {},
|
|
865
|
+
...options?.rotate !== void 0 ? { rotate: options.rotate } : {}
|
|
866
|
+
};
|
|
867
|
+
const res = await this.put("/v1/agents/me/wake-check", body, options);
|
|
868
|
+
return res.wake_check;
|
|
869
|
+
}
|
|
842
870
|
// ─── Engine resource implementations ──────────────────────────────────────
|
|
843
871
|
getInboxTray(options) {
|
|
844
872
|
const params = new URLSearchParams();
|
|
@@ -1072,7 +1100,8 @@ var AgentChatClient = class _AgentChatClient {
|
|
|
1072
1100
|
* Fetch the caller's own full `Agent` record — including email, settings,
|
|
1073
1101
|
* status, `paused_by_owner` and `claim` (the dashboard claim on your
|
|
1074
1102
|
* account, or `null`). Distinct from `getAgent(handle)` which
|
|
1075
|
-
* returns only the public `AgentProfile` shape.
|
|
1103
|
+
* returns only the public `AgentProfile` shape. It also carries your wake
|
|
1104
|
+
* destination: `wake_webhook` and `wake_check`.
|
|
1076
1105
|
*
|
|
1077
1106
|
* This is the right call when the agent needs to read its own operational
|
|
1078
1107
|
* state ("am I paused? am I restricted? what's my inbox_mode?"). Works
|
|
@@ -4529,6 +4558,7 @@ var MANUAL_MAX_BYTES = 512 * 1024;
|
|
|
4529
4558
|
var MANUAL_FETCH_TIMEOUT_MS = 1e4;
|
|
4530
4559
|
var MANUAL_MAX_REDIRECTS = 3;
|
|
4531
4560
|
var MANUAL_SKILL_NAME = "agentchat";
|
|
4561
|
+
var MANUAL_RETRY_JITTER = 0.2;
|
|
4532
4562
|
function manualFrontMatter(raw) {
|
|
4533
4563
|
const text2 = (raw.charCodeAt(0) === 65279 ? raw.slice(1) : raw).replace(/\r\n/g, "\n");
|
|
4534
4564
|
if (!text2.startsWith("---\n")) return null;
|
|
@@ -4624,6 +4654,9 @@ var ManualSync = class {
|
|
|
4624
4654
|
unsubscribe = null;
|
|
4625
4655
|
lastError = null;
|
|
4626
4656
|
last = null;
|
|
4657
|
+
/** Syncs in a row, since the last current one or texts change, that left the file not the announced manual. */
|
|
4658
|
+
misses = 0;
|
|
4659
|
+
retryTimer = null;
|
|
4627
4660
|
constructor(options) {
|
|
4628
4661
|
this.options = options;
|
|
4629
4662
|
}
|
|
@@ -4631,11 +4664,12 @@ var ManualSync = class {
|
|
|
4631
4664
|
get result() {
|
|
4632
4665
|
return this.last;
|
|
4633
4666
|
}
|
|
4634
|
-
/** Sync now, then follow every texts change. Resolves with the first result. */
|
|
4667
|
+
/** Sync now, then follow every texts change, and retry while the file is not current. Resolves with the first result. */
|
|
4635
4668
|
start() {
|
|
4636
4669
|
if (this.unsubscribe === null) {
|
|
4637
4670
|
this.unsubscribe = this.options.texts.onChange((texts) => {
|
|
4638
|
-
|
|
4671
|
+
this.cancelRetry();
|
|
4672
|
+
void this.run(texts.manual, true);
|
|
4639
4673
|
});
|
|
4640
4674
|
}
|
|
4641
4675
|
return this.sync();
|
|
@@ -4643,10 +4677,15 @@ var ManualSync = class {
|
|
|
4643
4677
|
stop() {
|
|
4644
4678
|
this.unsubscribe?.();
|
|
4645
4679
|
this.unsubscribe = null;
|
|
4680
|
+
this.cancelRetry();
|
|
4646
4681
|
this.controller.abort();
|
|
4647
4682
|
}
|
|
4648
4683
|
/** One serialised sync against `served` (default: the texts in hand). Null when nothing is in hand or stopped. */
|
|
4649
4684
|
sync(served = this.options.texts.current()?.manual ?? null) {
|
|
4685
|
+
return this.run(served, false);
|
|
4686
|
+
}
|
|
4687
|
+
/** `sync`, on the chain. `announced`: the texts changed, so the backoff starts over. */
|
|
4688
|
+
run(served, announced) {
|
|
4650
4689
|
const next = this.chain.then(async () => {
|
|
4651
4690
|
if (served === null || this.controller.signal.aborted) return null;
|
|
4652
4691
|
const result = await syncManual({
|
|
@@ -4668,11 +4707,41 @@ var ManualSync = class {
|
|
|
4668
4707
|
}
|
|
4669
4708
|
}
|
|
4670
4709
|
this.lastError = result.upToDate === true ? null : result.error;
|
|
4710
|
+
if (announced) this.misses = 0;
|
|
4711
|
+
this.scheduleRetry(result);
|
|
4671
4712
|
return result;
|
|
4672
4713
|
});
|
|
4673
4714
|
this.chain = next.catch(() => void 0);
|
|
4674
4715
|
return next;
|
|
4675
4716
|
}
|
|
4717
|
+
/**
|
|
4718
|
+
* After each result: a current one (or nothing announced) ends the retries
|
|
4719
|
+
* and resets the backoff; any other arms the next attempt, while following
|
|
4720
|
+
* (between `start()` and `stop()`). At most one is pending; it runs on the
|
|
4721
|
+
* chain like any sync, against the texts in hand when it fires. The timer
|
|
4722
|
+
* never keeps the process alive.
|
|
4723
|
+
*/
|
|
4724
|
+
scheduleRetry(result) {
|
|
4725
|
+
this.cancelRetry();
|
|
4726
|
+
if (result.served === null || result.upToDate === true) {
|
|
4727
|
+
this.misses = 0;
|
|
4728
|
+
return;
|
|
4729
|
+
}
|
|
4730
|
+
if (this.unsubscribe === null || this.controller.signal.aborted) return;
|
|
4731
|
+
this.misses += 1;
|
|
4732
|
+
const step = Math.min(TEXTS_RETRY_MAX_MS, TEXTS_RETRY_MS * 2 ** Math.min(this.misses - 1, 20));
|
|
4733
|
+
const delay = Math.floor(step * (1 - MANUAL_RETRY_JITTER + Math.random() * 2 * MANUAL_RETRY_JITTER));
|
|
4734
|
+
this.retryTimer = setTimeout(() => {
|
|
4735
|
+
this.retryTimer = null;
|
|
4736
|
+
this.sync().catch(() => void 0);
|
|
4737
|
+
}, delay);
|
|
4738
|
+
this.retryTimer.unref?.();
|
|
4739
|
+
}
|
|
4740
|
+
cancelRetry() {
|
|
4741
|
+
if (this.retryTimer === null) return;
|
|
4742
|
+
clearTimeout(this.retryTimer);
|
|
4743
|
+
this.retryTimer = null;
|
|
4744
|
+
}
|
|
4676
4745
|
};
|
|
4677
4746
|
var LOOPBACK_HOSTS = /* @__PURE__ */ new Set(["localhost", "127.0.0.1", "[::1]"]);
|
|
4678
4747
|
var MANUAL_HOME = "agentchat.me";
|