@tangle-network/agent-app 0.60.93 → 0.60.94
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/dist/chat-routes/index.js +1 -1
- package/dist/{chunk-QJNMYG5H.js → chunk-BOEWSEGC.js} +18 -7
- package/dist/{chunk-QJNMYG5H.js.map → chunk-BOEWSEGC.js.map} +1 -1
- package/dist/sandbox/index.js +3 -1
- package/dist/sandbox/warm-lease-d1.d.ts +3 -1
- package/dist/sandbox/warm-lease.d.ts +15 -2
- package/package.json +1 -1
package/dist/sandbox/index.js
CHANGED
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
SandboxProvisioningFailedElsewhereError,
|
|
18
18
|
SandboxRecoveryFailedError,
|
|
19
19
|
SandboxRuntimeAuthRefreshError,
|
|
20
|
+
WARM_LEASE_DECLINED_UNTIL_DDL,
|
|
20
21
|
WARM_LEASE_TABLE_DDL,
|
|
21
22
|
WARM_SLOTS,
|
|
22
23
|
adaptSandboxStream,
|
|
@@ -84,7 +85,7 @@ import {
|
|
|
84
85
|
warmBinOf,
|
|
85
86
|
warmWeekdayOf,
|
|
86
87
|
writeProfileFilesToBox
|
|
87
|
-
} from "../chunk-
|
|
88
|
+
} from "../chunk-BOEWSEGC.js";
|
|
88
89
|
import {
|
|
89
90
|
EGRESS_PROXY_RECOVERY_PHASE,
|
|
90
91
|
EGRESS_PROXY_RECOVERY_REQUIRED,
|
|
@@ -157,6 +158,7 @@ export {
|
|
|
157
158
|
SandboxRecoveryFailedError,
|
|
158
159
|
SandboxRuntimeAuthRefreshError,
|
|
159
160
|
SandboxTransientDeadlineError,
|
|
161
|
+
WARM_LEASE_DECLINED_UNTIL_DDL,
|
|
160
162
|
WARM_LEASE_TABLE_DDL,
|
|
161
163
|
WARM_SLOTS,
|
|
162
164
|
WORKSPACE_SANDBOX_HOST_EXHAUSTED,
|
|
@@ -15,7 +15,9 @@ import { type WarmLeaseStore } from './warm-lease';
|
|
|
15
15
|
*/
|
|
16
16
|
export declare const DEFAULT_WARM_LEASE_TABLE = "sandbox_warm_lease";
|
|
17
17
|
/** Paste into a migration. Times are epoch milliseconds; 0 means never. */
|
|
18
|
-
export declare const WARM_LEASE_TABLE_DDL = "CREATE TABLE IF NOT EXISTS sandbox_warm_lease (\n key TEXT PRIMARY KEY,\n lease_id TEXT,\n reason TEXT,\n started_at INTEGER NOT NULL DEFAULT 0,\n hold_until INTEGER NOT NULL DEFAULT 0,\n warm_at INTEGER NOT NULL DEFAULT 0,\n used_at INTEGER NOT NULL DEFAULT 0,\n resumed INTEGER NOT NULL DEFAULT 0,\n ping_at INTEGER NOT NULL DEFAULT 0,\n last_turn_at INTEGER NOT NULL DEFAULT 0,\n day TEXT NOT NULL DEFAULT '',\n day_warm_ms INTEGER NOT NULL DEFAULT 0,\n threshold REAL NOT NULL DEFAULT 0,\n slots TEXT NOT NULL DEFAULT '',\n slots_at INTEGER NOT NULL DEFAULT 0,\n first_seen_at INTEGER NOT NULL DEFAULT 0,\n predicted_at INTEGER NOT NULL DEFAULT 0\n)";
|
|
18
|
+
export declare const WARM_LEASE_TABLE_DDL = "CREATE TABLE IF NOT EXISTS sandbox_warm_lease (\n key TEXT PRIMARY KEY,\n lease_id TEXT,\n reason TEXT,\n started_at INTEGER NOT NULL DEFAULT 0,\n hold_until INTEGER NOT NULL DEFAULT 0,\n warm_at INTEGER NOT NULL DEFAULT 0,\n used_at INTEGER NOT NULL DEFAULT 0,\n resumed INTEGER NOT NULL DEFAULT 0,\n ping_at INTEGER NOT NULL DEFAULT 0,\n last_turn_at INTEGER NOT NULL DEFAULT 0,\n day TEXT NOT NULL DEFAULT '',\n day_warm_ms INTEGER NOT NULL DEFAULT 0,\n threshold REAL NOT NULL DEFAULT 0,\n slots TEXT NOT NULL DEFAULT '',\n slots_at INTEGER NOT NULL DEFAULT 0,\n first_seen_at INTEGER NOT NULL DEFAULT 0,\n predicted_at INTEGER NOT NULL DEFAULT 0,\n declined_until INTEGER NOT NULL DEFAULT 0\n)";
|
|
19
|
+
/** For a table created from an earlier \`WARM_LEASE_TABLE_DDL\`: paste into a migration. */
|
|
20
|
+
export declare const WARM_LEASE_DECLINED_UNTIL_DDL = "ALTER TABLE sandbox_warm_lease ADD COLUMN declined_until INTEGER NOT NULL DEFAULT 0";
|
|
19
21
|
/** The D1 surface this store uses: `prepare().bind()` with `first`, `run` and `all`. A real `D1Database` satisfies it. */
|
|
20
22
|
export interface WarmLeaseD1Like {
|
|
21
23
|
prepare(query: string): {
|
|
@@ -48,7 +48,11 @@ export type WarmBoxOutcome =
|
|
|
48
48
|
/** The box was already running: nothing to warm, nothing charged. */
|
|
49
49
|
| 'running'
|
|
50
50
|
/** No box exists for this key. Leases never create boxes. */
|
|
51
|
-
| 'absent'
|
|
51
|
+
| 'absent'
|
|
52
|
+
/** The platform refused the resume for capacity (HTTP 429: the org is at its
|
|
53
|
+
* concurrent-box limit). A speculative warm must not compete with real work
|
|
54
|
+
* for the last slots, so the key cools down instead of retrying. */
|
|
55
|
+
| 'capacity';
|
|
52
56
|
export type WarmLeaseEvent = {
|
|
53
57
|
type: 'warm_started';
|
|
54
58
|
key: string;
|
|
@@ -69,7 +73,7 @@ export type WarmLeaseEvent = {
|
|
|
69
73
|
type: 'warm_declined';
|
|
70
74
|
key: string;
|
|
71
75
|
reason: WarmReason;
|
|
72
|
-
why: 'budget' | 'absent';
|
|
76
|
+
why: 'budget' | 'absent' | 'capacity';
|
|
73
77
|
} | {
|
|
74
78
|
type: 'warm_failed';
|
|
75
79
|
key: string;
|
|
@@ -128,6 +132,9 @@ export interface WarmLeaseRow {
|
|
|
128
132
|
slotsAt: number;
|
|
129
133
|
firstSeenAt: number;
|
|
130
134
|
predictedAt: number;
|
|
135
|
+
/** Signals are refused without calling the product's warm until this time:
|
|
136
|
+
* set after an 'absent' or 'capacity' outcome, cleared by a turn. */
|
|
137
|
+
declinedUntil: number;
|
|
131
138
|
}
|
|
132
139
|
/** Persistence for leases. `begin` and `markUsed` must be atomic across isolates. */
|
|
133
140
|
export interface WarmLeaseStore {
|
|
@@ -158,6 +165,8 @@ export interface WarmLeaseStore {
|
|
|
158
165
|
writeProfile(key: string, slots: number[], slotsAt: number, firstSeenAt: number): Promise<void>;
|
|
159
166
|
markPinged(key: string, at: number): Promise<void>;
|
|
160
167
|
markPredicted(key: string, at: number): Promise<void>;
|
|
168
|
+
/** Refuse signals for `key` until `until` (cleared by the next turn). */
|
|
169
|
+
markDeclined(key: string, until: number): Promise<void>;
|
|
161
170
|
/** Bounded batches for `sweep`. */
|
|
162
171
|
listExpired(now: number, limit: number): Promise<WarmLeaseRow[]>;
|
|
163
172
|
listHeld(now: number, limit: number): Promise<WarmLeaseRow[]>;
|
|
@@ -186,6 +195,10 @@ export interface WarmLeasesOptions {
|
|
|
186
195
|
* takes the lease over and warms again. Default 2 min, past a slow resume.
|
|
187
196
|
*/
|
|
188
197
|
warmDeadlineMs?: number;
|
|
198
|
+
/** After a warm finds no box, refuse that key's signals this long. Default 10 min. */
|
|
199
|
+
absentCooldownMs?: number;
|
|
200
|
+
/** After a capacity refusal, refuse that key's signals this long. Default 5 min. */
|
|
201
|
+
capacityCooldownMs?: number;
|
|
189
202
|
/** Reasons subject to the budget. Default page-open, member-activity, predicted, scheduled. */
|
|
190
203
|
budgetedReasons?: readonly string[];
|
|
191
204
|
/** Starting predicted-warm threshold, a probability. Default 0.25. */
|
package/package.json
CHANGED