@gethelio/proxy 0.10.0 → 0.11.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/README.md +60 -19
- package/dist/cli.js +341 -102
- package/dist/dashboard-assets/assets/{index-DNjpdKac.css → index-CPoQ6xns.css} +1 -1
- package/dist/dashboard-assets/assets/{index-Ba99PYDi.js → index-D19fYKEH.js} +29 -29
- package/dist/dashboard-assets/index.html +2 -2
- package/dist/index.d.ts +73 -38
- package/dist/index.js +299 -134
- package/package.json +2 -2
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
<meta name="referrer" content="no-referrer" />
|
|
7
7
|
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
|
8
8
|
<title>Helio Dashboard</title>
|
|
9
|
-
<script type="module" crossorigin src="/assets/index-
|
|
10
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
9
|
+
<script type="module" crossorigin src="/assets/index-D19fYKEH.js"></script>
|
|
10
|
+
<link rel="stylesheet" crossorigin href="/assets/index-CPoQ6xns.css">
|
|
11
11
|
</head>
|
|
12
12
|
<body>
|
|
13
13
|
<div id="root"></div>
|
package/dist/index.d.ts
CHANGED
|
@@ -145,10 +145,22 @@ declare const budgetSchema: z.ZodObject<{
|
|
|
145
145
|
escalation_after: z.ZodOptional<z.ZodString>;
|
|
146
146
|
}, z.core.$strict>>;
|
|
147
147
|
idle_ttl: z.ZodOptional<z.ZodString>;
|
|
148
|
-
contributors: z.ZodArray<z.ZodObject<{
|
|
149
|
-
|
|
148
|
+
contributors: z.ZodArray<z.ZodPipe<z.ZodUnknown, z.ZodObject<{
|
|
149
|
+
match: z.ZodObject<{
|
|
150
|
+
tool: z.ZodString;
|
|
151
|
+
input: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
152
|
+
eq: z.ZodOptional<z.ZodUnknown>;
|
|
153
|
+
neq: z.ZodOptional<z.ZodUnknown>;
|
|
154
|
+
gt: z.ZodOptional<z.ZodNumber>;
|
|
155
|
+
gte: z.ZodOptional<z.ZodNumber>;
|
|
156
|
+
lt: z.ZodOptional<z.ZodNumber>;
|
|
157
|
+
lte: z.ZodOptional<z.ZodNumber>;
|
|
158
|
+
contains: z.ZodOptional<z.ZodString>;
|
|
159
|
+
regex: z.ZodOptional<z.ZodString>;
|
|
160
|
+
}, z.core.$strict>>>;
|
|
161
|
+
}, z.core.$strict>;
|
|
150
162
|
field: z.ZodString;
|
|
151
|
-
}, z.core.$strict
|
|
163
|
+
}, z.core.$strict>>>;
|
|
152
164
|
}, z.core.$strict>;
|
|
153
165
|
declare const approvalChannelSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
154
166
|
type: z.ZodLiteral<"slack">;
|
|
@@ -156,17 +168,17 @@ declare const approvalChannelSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
156
168
|
bot_token: z.ZodString;
|
|
157
169
|
signing_secret: z.ZodString;
|
|
158
170
|
channel: z.ZodString;
|
|
159
|
-
}, z.core.$
|
|
171
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
160
172
|
type: z.ZodLiteral<"webhook">;
|
|
161
173
|
name: z.ZodOptional<z.ZodString>;
|
|
162
174
|
url: z.ZodString;
|
|
163
175
|
secret: z.ZodOptional<z.ZodString>;
|
|
164
|
-
}, z.core.$
|
|
176
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
165
177
|
type: z.ZodLiteral<"dashboard">;
|
|
166
178
|
name: z.ZodOptional<z.ZodString>;
|
|
167
|
-
}, z.core.$
|
|
179
|
+
}, z.core.$strict>], "type">;
|
|
168
180
|
/** Zod schema for the complete `helio.yaml` configuration file. */
|
|
169
|
-
declare const helioConfigSchema: z.ZodObject<{
|
|
181
|
+
declare const helioConfigSchema: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodObject<{
|
|
170
182
|
version: z.ZodLiteral<"1">;
|
|
171
183
|
upstream: z.ZodObject<{
|
|
172
184
|
url: z.ZodString;
|
|
@@ -181,19 +193,11 @@ declare const helioConfigSchema: z.ZodObject<{
|
|
|
181
193
|
request_timeout: z.ZodDefault<z.ZodString>;
|
|
182
194
|
forward_headers: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
183
195
|
headers: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
184
|
-
}, z.core.$
|
|
196
|
+
}, z.core.$strict>;
|
|
185
197
|
listen: z.ZodPrefault<z.ZodObject<{
|
|
186
198
|
port: z.ZodDefault<z.ZodNumber>;
|
|
187
199
|
host: z.ZodDefault<z.ZodString>;
|
|
188
|
-
}, z.core.$
|
|
189
|
-
dashboard: z.ZodPrefault<z.ZodObject<{
|
|
190
|
-
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
191
|
-
port: z.ZodDefault<z.ZodNumber>;
|
|
192
|
-
host: z.ZodDefault<z.ZodString>;
|
|
193
|
-
api_secret: z.ZodOptional<z.ZodString>;
|
|
194
|
-
allow_open_mode: z.ZodDefault<z.ZodBoolean>;
|
|
195
|
-
sse_heartbeat_interval: z.ZodDefault<z.ZodString>;
|
|
196
|
-
}, z.core.$strip>>;
|
|
200
|
+
}, z.core.$strict>>;
|
|
197
201
|
environment: z.ZodOptional<z.ZodString>;
|
|
198
202
|
policies: z.ZodPrefault<z.ZodObject<{
|
|
199
203
|
default: z.ZodDefault<z.ZodEnum<{
|
|
@@ -334,10 +338,22 @@ declare const helioConfigSchema: z.ZodObject<{
|
|
|
334
338
|
escalation_after: z.ZodOptional<z.ZodString>;
|
|
335
339
|
}, z.core.$strict>>;
|
|
336
340
|
idle_ttl: z.ZodOptional<z.ZodString>;
|
|
337
|
-
contributors: z.ZodArray<z.ZodObject<{
|
|
338
|
-
|
|
341
|
+
contributors: z.ZodArray<z.ZodPipe<z.ZodUnknown, z.ZodObject<{
|
|
342
|
+
match: z.ZodObject<{
|
|
343
|
+
tool: z.ZodString;
|
|
344
|
+
input: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
345
|
+
eq: z.ZodOptional<z.ZodUnknown>;
|
|
346
|
+
neq: z.ZodOptional<z.ZodUnknown>;
|
|
347
|
+
gt: z.ZodOptional<z.ZodNumber>;
|
|
348
|
+
gte: z.ZodOptional<z.ZodNumber>;
|
|
349
|
+
lt: z.ZodOptional<z.ZodNumber>;
|
|
350
|
+
lte: z.ZodOptional<z.ZodNumber>;
|
|
351
|
+
contains: z.ZodOptional<z.ZodString>;
|
|
352
|
+
regex: z.ZodOptional<z.ZodString>;
|
|
353
|
+
}, z.core.$strict>>>;
|
|
354
|
+
}, z.core.$strict>;
|
|
339
355
|
field: z.ZodString;
|
|
340
|
-
}, z.core.$strict
|
|
356
|
+
}, z.core.$strict>>>;
|
|
341
357
|
}, z.core.$strict>>>;
|
|
342
358
|
approval: z.ZodPrefault<z.ZodObject<{
|
|
343
359
|
timeout: z.ZodDefault<z.ZodString>;
|
|
@@ -351,16 +367,16 @@ declare const helioConfigSchema: z.ZodObject<{
|
|
|
351
367
|
bot_token: z.ZodString;
|
|
352
368
|
signing_secret: z.ZodString;
|
|
353
369
|
channel: z.ZodString;
|
|
354
|
-
}, z.core.$
|
|
370
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
355
371
|
type: z.ZodLiteral<"webhook">;
|
|
356
372
|
name: z.ZodOptional<z.ZodString>;
|
|
357
373
|
url: z.ZodString;
|
|
358
374
|
secret: z.ZodOptional<z.ZodString>;
|
|
359
|
-
}, z.core.$
|
|
375
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
360
376
|
type: z.ZodLiteral<"dashboard">;
|
|
361
377
|
name: z.ZodOptional<z.ZodString>;
|
|
362
|
-
}, z.core.$
|
|
363
|
-
}, z.core.$
|
|
378
|
+
}, z.core.$strict>], "type">>>;
|
|
379
|
+
}, z.core.$strict>>;
|
|
364
380
|
audit: z.ZodPrefault<z.ZodObject<{
|
|
365
381
|
storage: z.ZodDefault<z.ZodEnum<{
|
|
366
382
|
sqlite: "sqlite";
|
|
@@ -368,14 +384,22 @@ declare const helioConfigSchema: z.ZodObject<{
|
|
|
368
384
|
path: z.ZodDefault<z.ZodString>;
|
|
369
385
|
retention: z.ZodDefault<z.ZodString>;
|
|
370
386
|
include_responses: z.ZodDefault<z.ZodBoolean>;
|
|
371
|
-
}, z.core.$
|
|
387
|
+
}, z.core.$strict>>;
|
|
388
|
+
dashboard: z.ZodPrefault<z.ZodObject<{
|
|
389
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
390
|
+
port: z.ZodDefault<z.ZodNumber>;
|
|
391
|
+
host: z.ZodDefault<z.ZodString>;
|
|
392
|
+
api_secret: z.ZodOptional<z.ZodString>;
|
|
393
|
+
allow_open_mode: z.ZodDefault<z.ZodBoolean>;
|
|
394
|
+
sse_heartbeat_interval: z.ZodDefault<z.ZodString>;
|
|
395
|
+
}, z.core.$strict>>;
|
|
372
396
|
sdk: z.ZodPrefault<z.ZodObject<{
|
|
373
397
|
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
374
398
|
port: z.ZodDefault<z.ZodNumber>;
|
|
375
399
|
host: z.ZodDefault<z.ZodString>;
|
|
376
400
|
evaluation_ttl: z.ZodDefault<z.ZodString>;
|
|
377
|
-
}, z.core.$
|
|
378
|
-
}, z.core.$
|
|
401
|
+
}, z.core.$strict>>;
|
|
402
|
+
}, z.core.$strict>>;
|
|
379
403
|
/** Fully validated and defaulted Helio configuration. */
|
|
380
404
|
type HelioConfig = z.infer<typeof helioConfigSchema>;
|
|
381
405
|
/** An approval channel configuration (slack, webhook, or dashboard). */
|
|
@@ -603,9 +627,13 @@ interface MatchContext {
|
|
|
603
627
|
readonly metadata?: Readonly<Record<string, unknown>>;
|
|
604
628
|
}
|
|
605
629
|
|
|
606
|
-
/** One compiled contributor: which
|
|
630
|
+
/** One compiled contributor: which calls feed the budget, and from which field. */
|
|
607
631
|
interface CompiledBudgetContributor {
|
|
608
|
-
readonly
|
|
632
|
+
readonly match: {
|
|
633
|
+
readonly tool: ToolMatcher;
|
|
634
|
+
/** Flattened conditions (one per path+operator); absent when unconditioned. */
|
|
635
|
+
readonly input?: readonly InputCondition[];
|
|
636
|
+
};
|
|
609
637
|
/** Dot-path into the tool arguments (e.g. "$.amount"), resolved per call. */
|
|
610
638
|
readonly field: string;
|
|
611
639
|
}
|
|
@@ -2179,10 +2207,14 @@ declare class BudgetEngine {
|
|
|
2179
2207
|
/**
|
|
2180
2208
|
* Resolve which budgets a call feeds and how much it charges each.
|
|
2181
2209
|
*
|
|
2182
|
-
* A
|
|
2183
|
-
*
|
|
2184
|
-
*
|
|
2185
|
-
*
|
|
2210
|
+
* A contributor participates when its tool glob matches the tool name AND
|
|
2211
|
+
* every `match.input` condition holds (absent conditions means the glob
|
|
2212
|
+
* alone decides); the FIRST participating contributor (config order, over
|
|
2213
|
+
* that combined predicate) supplies the amount field. A call that matches
|
|
2214
|
+
* the glob but not the conditions simply does not feed the budget — no
|
|
2215
|
+
* charge, no failure. Once a contributor is selected, a missing,
|
|
2216
|
+
* non-numeric, negative, or non-finite amount fails closed as a `failures`
|
|
2217
|
+
* entry — the caller must deny the call.
|
|
2186
2218
|
*/
|
|
2187
2219
|
resolveCharges(ctx: BudgetChargeContext): {
|
|
2188
2220
|
charges: BudgetCharge[];
|
|
@@ -2995,11 +3027,13 @@ interface DashboardAppDeps {
|
|
|
2995
3027
|
listAdapters(): AdapterLivenessEntry[];
|
|
2996
3028
|
};
|
|
2997
3029
|
/**
|
|
2998
|
-
* Budget read surface for `GET /api/budgets
|
|
2999
|
-
* `GET /api/budgets/:name/events
|
|
3000
|
-
*
|
|
3001
|
-
*
|
|
3002
|
-
*
|
|
3030
|
+
* Budget read surface for `GET /api/budgets`,
|
|
3031
|
+
* `GET /api/budgets/:name/events`, and
|
|
3032
|
+
* `GET /api/budgets/:name/events/export` (issues #14, #155) — narrow
|
|
3033
|
+
* views of the BudgetEngine (live pot states) and BudgetLedger (spend
|
|
3034
|
+
* history). Optional on the adapterLiveness pattern: absent (direct
|
|
3035
|
+
* embedders), the listings serve empty lists and the export serves an
|
|
3036
|
+
* empty artifact, all with 200.
|
|
3003
3037
|
*/
|
|
3004
3038
|
readonly budgets?: {
|
|
3005
3039
|
listStates(): BudgetState[];
|
|
@@ -3007,6 +3041,7 @@ interface DashboardAppDeps {
|
|
|
3007
3041
|
limit: number;
|
|
3008
3042
|
offset: number;
|
|
3009
3043
|
}): BudgetEventsPage;
|
|
3044
|
+
listEventsForExport(name: string, limit: number): BudgetEventsPage;
|
|
3010
3045
|
};
|
|
3011
3046
|
}
|
|
3012
3047
|
/** Options for the dashboard API. */
|