@tangle-network/agent-app 0.60.82 → 0.60.83

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.
@@ -84,7 +84,7 @@ import {
84
84
  warmBinOf,
85
85
  warmWeekdayOf,
86
86
  writeProfileFilesToBox
87
- } from "../chunk-A5CZ2X6C.js";
87
+ } from "../chunk-QJNMYG5H.js";
88
88
  import {
89
89
  EGRESS_PROXY_RECOVERY_PHASE,
90
90
  EGRESS_PROXY_RECOVERY_REQUIRED,
@@ -35,8 +35,8 @@
35
35
  * hour, within the budget. The threshold tunes itself: a predicted warm that is used lowers it,
36
36
  * one that is wasted raises it.
37
37
  *
38
- * EVENTS. `warm_started`, `warm_hit`, `warm_wasted`, `warm_declined` and
39
- * `warm_failed` each carry the key and the reason, so a product can compute hit
38
+ * EVENTS. `warm_started`, `warm_hit`, `warm_wasted`, `warm_declined`,
39
+ * `warm_failed` and `warm_abandoned` each carry the key and the reason, so a product can compute hit
40
40
  * rate and wasted minutes per workspace from its logs alone.
41
41
  */
42
42
  /** Why a warm was requested. Products may add their own reasons. */
@@ -75,6 +75,14 @@ export type WarmLeaseEvent = {
75
75
  key: string;
76
76
  reason: WarmReason;
77
77
  error: string;
78
+ }
79
+ /** The lease ended without its warm ever reporting: the request running it was
80
+ * cancelled or the isolate died. Whether the box resumed is unknown, so it is
81
+ * counted here rather than charged or dropped. */
82
+ | {
83
+ type: 'warm_abandoned';
84
+ key: string;
85
+ reason: WarmReason;
78
86
  };
79
87
  export type WarmSignalOutcome =
80
88
  /** This call started a lease and ran the product's warm. */
@@ -94,6 +102,8 @@ export interface WarmTurnResult {
94
102
  export interface WarmSweepReport {
95
103
  ended: number;
96
104
  wasted: number;
105
+ /** Expired leases whose warm never reported an outcome. */
106
+ abandoned: number;
97
107
  pinged: number;
98
108
  predicted: number;
99
109
  /** Keys whose ping or predicted warm threw; the rest of the batch still ran. */
@@ -124,10 +134,13 @@ export interface WarmLeaseStore {
124
134
  read(key: string): Promise<WarmLeaseRow | null>;
125
135
  /**
126
136
  * Start a lease with `leaseId` when none is live, otherwise extend the live
127
- * one's hold to at least `holdUntil`. Returns the live lease id after the
128
- * write; the caller started the lease exactly when it equals `leaseId`.
137
+ * one's hold to at least `holdUntil`. A lease whose warm has not reported by
138
+ * `staleBefore` counts as not live and is taken over, so a warm killed with
139
+ * its request is retried instead of blocking every later signal. Returns the
140
+ * live lease id after the write; the caller started the lease exactly when
141
+ * it equals `leaseId`.
129
142
  */
130
- begin(key: string, leaseId: string, reason: string, now: number, holdUntil: number): Promise<string>;
143
+ begin(key: string, leaseId: string, reason: string, now: number, holdUntil: number, staleBefore: number): Promise<string>;
131
144
  /** Record the result of this lease's warm. No-op for a superseded lease. */
132
145
  markWarm(key: string, leaseId: string, warmAt: number, resumed: boolean): Promise<void>;
133
146
  /**
@@ -168,6 +181,11 @@ export interface WarmLeasesOptions {
168
181
  burstHoldMs?: number;
169
182
  /** Unused-warm box time allowed per key per UTC day. Default 30 min. */
170
183
  dailyBudgetMs?: number;
184
+ /**
185
+ * How long a started warm may go without reporting before the next signal
186
+ * takes the lease over and warms again. Default 2 min, past a slow resume.
187
+ */
188
+ warmDeadlineMs?: number;
171
189
  /** Reasons subject to the budget. Default page-open, member-activity, predicted, scheduled. */
172
190
  budgetedReasons?: readonly string[];
173
191
  /** Starting predicted-warm threshold, a probability. Default 0.25. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangle-network/agent-app",
3
- "version": "0.60.82",
3
+ "version": "0.60.83",
4
4
  "packageManager": "pnpm@11.24.0",
5
5
  "description": "Build agent applications with typed chat, tools, sandboxes, integrations, billing, and evaluation.",
6
6
  "keywords": [