agent-dealer 1.3.2 → 1.3.3
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/bundle/server/dist/adapters/agent-health.test.js +52 -0
- package/bundle/server/dist/capacity/service.js +66 -6
- package/bundle/server/dist/capacity/service.test.js +220 -0
- package/bundle/server/dist/db/index.js +8 -0
- package/bundle/server/dist/db/schema.sql +5 -1
- package/bundle/server/dist/repository/runtime-availability.js +29 -11
- package/bundle/server/dist/runners/usage-cap.js +66 -15
- package/bundle/server/dist/runners/usage-cap.test.js +96 -2
- package/bundle/server/package.json +2 -2
- package/bundle/server/static-ui/assets/index-B_pNUDRY.js +64 -0
- package/bundle/server/static-ui/index.html +1 -1
- package/bundle/shared/dist/runtime-capacity.d.ts +85 -0
- package/bundle/shared/dist/runtime-capacity.js +19 -0
- package/bundle/shared/package.json +1 -1
- package/package.json +1 -1
- package/bundle/server/static-ui/assets/index-DQ5ivcyg.js +0 -64
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
<link rel="apple-touch-icon" href="/apple-touch-icon.png" />
|
|
9
9
|
<meta name="theme-color" content="#0a0e14" />
|
|
10
10
|
<link rel="preload" href="/fonts/Monaco.ttf" as="font" type="font/ttf" crossorigin />
|
|
11
|
-
<script type="module" crossorigin src="/assets/index-
|
|
11
|
+
<script type="module" crossorigin src="/assets/index-B_pNUDRY.js"></script>
|
|
12
12
|
<link rel="stylesheet" crossorigin href="/assets/index-DL8mEXzN.css">
|
|
13
13
|
</head>
|
|
14
14
|
<body>
|
|
@@ -135,6 +135,33 @@ export declare const CapacityWindowSnapshot: z.ZodObject<{
|
|
|
135
135
|
} | null | undefined;
|
|
136
136
|
}>;
|
|
137
137
|
export type CapacityWindowSnapshot = z.infer<typeof CapacityWindowSnapshot>;
|
|
138
|
+
/**
|
|
139
|
+
* NOT-440: compact window an active hard cap exhausts — the tagged 5H/1W
|
|
140
|
+
* critical pair, or Cursor's `billing_cycle` window.
|
|
141
|
+
*/
|
|
142
|
+
export declare const CapacityCapWindowRole: z.ZodEnum<["five_hour", "weekly", "billing_cycle"]>;
|
|
143
|
+
export type CapacityCapWindowRole = z.infer<typeof CapacityCapWindowRole>;
|
|
144
|
+
/**
|
|
145
|
+
* NOT-440: the runtime's active hard cap (the same `runtime_availability` row
|
|
146
|
+
* that blocks admission and marks agent health). Stored snapshots stay raw
|
|
147
|
+
* provider observations; compact surfaces overlay this state on top of them.
|
|
148
|
+
* `windowRole` is null when no compact window can be proven from structured
|
|
149
|
+
* cap metadata or a reset match — the runtime then reads as capped outright.
|
|
150
|
+
*/
|
|
151
|
+
export declare const RuntimeCapacityActiveCap: z.ZodObject<{
|
|
152
|
+
unavailableUntil: z.ZodString;
|
|
153
|
+
reason: z.ZodString;
|
|
154
|
+
windowRole: z.ZodNullable<z.ZodEnum<["five_hour", "weekly", "billing_cycle"]>>;
|
|
155
|
+
}, "strip", z.ZodTypeAny, {
|
|
156
|
+
reason: string;
|
|
157
|
+
unavailableUntil: string;
|
|
158
|
+
windowRole: "five_hour" | "weekly" | "billing_cycle" | null;
|
|
159
|
+
}, {
|
|
160
|
+
reason: string;
|
|
161
|
+
unavailableUntil: string;
|
|
162
|
+
windowRole: "five_hour" | "weekly" | "billing_cycle" | null;
|
|
163
|
+
}>;
|
|
164
|
+
export type RuntimeCapacityActiveCap = z.infer<typeof RuntimeCapacityActiveCap>;
|
|
138
165
|
export declare const RuntimeCapacityEntry: z.ZodObject<{
|
|
139
166
|
runtime: z.ZodEnum<["claude_code", "cursor_local", "codex_local", "muse_code"]>;
|
|
140
167
|
/** All windows the provider reports for this runtime account. */
|
|
@@ -225,6 +252,20 @@ export declare const RuntimeCapacityEntry: z.ZodObject<{
|
|
|
225
252
|
}>, "many">;
|
|
226
253
|
/** Whole-entry fallback reason when no window carries a current value. */
|
|
227
254
|
unavailableReason: z.ZodNullable<z.ZodEnum<["unsupported", "missing", "expired", "unparsable", "stale"]>>;
|
|
255
|
+
/** NOT-440: active hard cap, or null/absent when the runtime is not capped. */
|
|
256
|
+
activeCap: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
257
|
+
unavailableUntil: z.ZodString;
|
|
258
|
+
reason: z.ZodString;
|
|
259
|
+
windowRole: z.ZodNullable<z.ZodEnum<["five_hour", "weekly", "billing_cycle"]>>;
|
|
260
|
+
}, "strip", z.ZodTypeAny, {
|
|
261
|
+
reason: string;
|
|
262
|
+
unavailableUntil: string;
|
|
263
|
+
windowRole: "five_hour" | "weekly" | "billing_cycle" | null;
|
|
264
|
+
}, {
|
|
265
|
+
reason: string;
|
|
266
|
+
unavailableUntil: string;
|
|
267
|
+
windowRole: "five_hour" | "weekly" | "billing_cycle" | null;
|
|
268
|
+
}>>>;
|
|
228
269
|
}, "strip", z.ZodTypeAny, {
|
|
229
270
|
runtime: "claude_code" | "cursor_local" | "codex_local" | "muse_code";
|
|
230
271
|
unavailableReason: "unsupported" | "missing" | "expired" | "unparsable" | "stale" | null;
|
|
@@ -250,6 +291,11 @@ export declare const RuntimeCapacityEntry: z.ZodObject<{
|
|
|
250
291
|
lastFailureAt: string;
|
|
251
292
|
} | null | undefined;
|
|
252
293
|
}[];
|
|
294
|
+
activeCap?: {
|
|
295
|
+
reason: string;
|
|
296
|
+
unavailableUntil: string;
|
|
297
|
+
windowRole: "five_hour" | "weekly" | "billing_cycle" | null;
|
|
298
|
+
} | null | undefined;
|
|
253
299
|
}, {
|
|
254
300
|
runtime: "claude_code" | "cursor_local" | "codex_local" | "muse_code";
|
|
255
301
|
unavailableReason: "unsupported" | "missing" | "expired" | "unparsable" | "stale" | null;
|
|
@@ -275,6 +321,11 @@ export declare const RuntimeCapacityEntry: z.ZodObject<{
|
|
|
275
321
|
lastFailureAt: string;
|
|
276
322
|
} | null | undefined;
|
|
277
323
|
}[];
|
|
324
|
+
activeCap?: {
|
|
325
|
+
reason: string;
|
|
326
|
+
unavailableUntil: string;
|
|
327
|
+
windowRole: "five_hour" | "weekly" | "billing_cycle" | null;
|
|
328
|
+
} | null | undefined;
|
|
278
329
|
}>;
|
|
279
330
|
export type RuntimeCapacityEntry = z.infer<typeof RuntimeCapacityEntry>;
|
|
280
331
|
export declare const RuntimeCapacityResponse: z.ZodObject<{
|
|
@@ -368,6 +419,20 @@ export declare const RuntimeCapacityResponse: z.ZodObject<{
|
|
|
368
419
|
}>, "many">;
|
|
369
420
|
/** Whole-entry fallback reason when no window carries a current value. */
|
|
370
421
|
unavailableReason: z.ZodNullable<z.ZodEnum<["unsupported", "missing", "expired", "unparsable", "stale"]>>;
|
|
422
|
+
/** NOT-440: active hard cap, or null/absent when the runtime is not capped. */
|
|
423
|
+
activeCap: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
424
|
+
unavailableUntil: z.ZodString;
|
|
425
|
+
reason: z.ZodString;
|
|
426
|
+
windowRole: z.ZodNullable<z.ZodEnum<["five_hour", "weekly", "billing_cycle"]>>;
|
|
427
|
+
}, "strip", z.ZodTypeAny, {
|
|
428
|
+
reason: string;
|
|
429
|
+
unavailableUntil: string;
|
|
430
|
+
windowRole: "five_hour" | "weekly" | "billing_cycle" | null;
|
|
431
|
+
}, {
|
|
432
|
+
reason: string;
|
|
433
|
+
unavailableUntil: string;
|
|
434
|
+
windowRole: "five_hour" | "weekly" | "billing_cycle" | null;
|
|
435
|
+
}>>>;
|
|
371
436
|
}, "strip", z.ZodTypeAny, {
|
|
372
437
|
runtime: "claude_code" | "cursor_local" | "codex_local" | "muse_code";
|
|
373
438
|
unavailableReason: "unsupported" | "missing" | "expired" | "unparsable" | "stale" | null;
|
|
@@ -393,6 +458,11 @@ export declare const RuntimeCapacityResponse: z.ZodObject<{
|
|
|
393
458
|
lastFailureAt: string;
|
|
394
459
|
} | null | undefined;
|
|
395
460
|
}[];
|
|
461
|
+
activeCap?: {
|
|
462
|
+
reason: string;
|
|
463
|
+
unavailableUntil: string;
|
|
464
|
+
windowRole: "five_hour" | "weekly" | "billing_cycle" | null;
|
|
465
|
+
} | null | undefined;
|
|
396
466
|
}, {
|
|
397
467
|
runtime: "claude_code" | "cursor_local" | "codex_local" | "muse_code";
|
|
398
468
|
unavailableReason: "unsupported" | "missing" | "expired" | "unparsable" | "stale" | null;
|
|
@@ -418,6 +488,11 @@ export declare const RuntimeCapacityResponse: z.ZodObject<{
|
|
|
418
488
|
lastFailureAt: string;
|
|
419
489
|
} | null | undefined;
|
|
420
490
|
}[];
|
|
491
|
+
activeCap?: {
|
|
492
|
+
reason: string;
|
|
493
|
+
unavailableUntil: string;
|
|
494
|
+
windowRole: "five_hour" | "weekly" | "billing_cycle" | null;
|
|
495
|
+
} | null | undefined;
|
|
421
496
|
}>, "many">;
|
|
422
497
|
generatedAt: z.ZodString;
|
|
423
498
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -447,6 +522,11 @@ export declare const RuntimeCapacityResponse: z.ZodObject<{
|
|
|
447
522
|
lastFailureAt: string;
|
|
448
523
|
} | null | undefined;
|
|
449
524
|
}[];
|
|
525
|
+
activeCap?: {
|
|
526
|
+
reason: string;
|
|
527
|
+
unavailableUntil: string;
|
|
528
|
+
windowRole: "five_hour" | "weekly" | "billing_cycle" | null;
|
|
529
|
+
} | null | undefined;
|
|
450
530
|
}[];
|
|
451
531
|
}, {
|
|
452
532
|
generatedAt: string;
|
|
@@ -475,6 +555,11 @@ export declare const RuntimeCapacityResponse: z.ZodObject<{
|
|
|
475
555
|
lastFailureAt: string;
|
|
476
556
|
} | null | undefined;
|
|
477
557
|
}[];
|
|
558
|
+
activeCap?: {
|
|
559
|
+
reason: string;
|
|
560
|
+
unavailableUntil: string;
|
|
561
|
+
windowRole: "five_hour" | "weekly" | "billing_cycle" | null;
|
|
562
|
+
} | null | undefined;
|
|
478
563
|
}[];
|
|
479
564
|
}>;
|
|
480
565
|
export type RuntimeCapacityResponse = z.infer<typeof RuntimeCapacityResponse>;
|
|
@@ -85,12 +85,31 @@ export const CapacityWindowSnapshot = z.object({
|
|
|
85
85
|
unavailableDetail: CapacityUnavailableDetail.nullable().optional(),
|
|
86
86
|
criticalRole: CapacityCriticalRole.nullable(),
|
|
87
87
|
});
|
|
88
|
+
/**
|
|
89
|
+
* NOT-440: compact window an active hard cap exhausts — the tagged 5H/1W
|
|
90
|
+
* critical pair, or Cursor's `billing_cycle` window.
|
|
91
|
+
*/
|
|
92
|
+
export const CapacityCapWindowRole = z.enum(["five_hour", "weekly", "billing_cycle"]);
|
|
93
|
+
/**
|
|
94
|
+
* NOT-440: the runtime's active hard cap (the same `runtime_availability` row
|
|
95
|
+
* that blocks admission and marks agent health). Stored snapshots stay raw
|
|
96
|
+
* provider observations; compact surfaces overlay this state on top of them.
|
|
97
|
+
* `windowRole` is null when no compact window can be proven from structured
|
|
98
|
+
* cap metadata or a reset match — the runtime then reads as capped outright.
|
|
99
|
+
*/
|
|
100
|
+
export const RuntimeCapacityActiveCap = z.object({
|
|
101
|
+
unavailableUntil: z.string(),
|
|
102
|
+
reason: z.string(),
|
|
103
|
+
windowRole: CapacityCapWindowRole.nullable(),
|
|
104
|
+
});
|
|
88
105
|
export const RuntimeCapacityEntry = z.object({
|
|
89
106
|
runtime: Runtime,
|
|
90
107
|
/** All windows the provider reports for this runtime account. */
|
|
91
108
|
windows: z.array(CapacityWindowSnapshot),
|
|
92
109
|
/** Whole-entry fallback reason when no window carries a current value. */
|
|
93
110
|
unavailableReason: CapacityUnavailableReason.nullable(),
|
|
111
|
+
/** NOT-440: active hard cap, or null/absent when the runtime is not capped. */
|
|
112
|
+
activeCap: RuntimeCapacityActiveCap.nullable().optional(),
|
|
94
113
|
});
|
|
95
114
|
export const RuntimeCapacityResponse = z.object({
|
|
96
115
|
runtimes: z.array(RuntimeCapacityEntry),
|