@axlsdk/studio 0.14.0 → 0.15.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/README.md +68 -10
- package/dist/chunk-IPDMFFTQ.js +2142 -0
- package/dist/chunk-IPDMFFTQ.js.map +1 -0
- package/dist/cli.cjs +1094 -117
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +1 -1
- package/dist/client/assets/index-CLKKOaE2.css +1 -0
- package/dist/client/assets/index-rvds50cZ.js +278 -0
- package/dist/client/index.html +2 -2
- package/dist/{connection-manager-B7AWpsCD.d.cts → connection-manager-BMPahDuY.d.cts} +63 -1
- package/dist/{connection-manager-B7AWpsCD.d.ts → connection-manager-BMPahDuY.d.ts} +63 -1
- package/dist/middleware.cjs +1123 -123
- package/dist/middleware.cjs.map +1 -1
- package/dist/middleware.d.cts +52 -5
- package/dist/middleware.d.ts +52 -5
- package/dist/middleware.js +30 -7
- package/dist/middleware.js.map +1 -1
- package/dist/server/index.cjs +1097 -116
- package/dist/server/index.cjs.map +1 -1
- package/dist/server/index.d.cts +165 -28
- package/dist/server/index.d.ts +165 -28
- package/dist/server/index.js +7 -3
- package/package.json +10 -6
- package/dist/chunk-HUKUQDYL.js +0 -1163
- package/dist/chunk-HUKUQDYL.js.map +0 -1
- package/dist/client/assets/index-7aDhMztu.css +0 -1
- package/dist/client/assets/index-Bzr3vDPz.js +0 -255
package/dist/client/index.html
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<title>Axl Studio</title>
|
|
7
|
-
<script type="module" crossorigin src="./assets/index-
|
|
8
|
-
<link rel="stylesheet" crossorigin href="./assets/index-
|
|
7
|
+
<script type="module" crossorigin src="./assets/index-rvds50cZ.js"></script>
|
|
8
|
+
<link rel="stylesheet" crossorigin href="./assets/index-CLKKOaE2.css">
|
|
9
9
|
</head>
|
|
10
10
|
<body>
|
|
11
11
|
<div id="root"></div>
|
|
@@ -24,6 +24,44 @@ type CostData = {
|
|
|
24
24
|
cost: number;
|
|
25
25
|
executions: number;
|
|
26
26
|
}>;
|
|
27
|
+
/**
|
|
28
|
+
* Cost decomposition by retry reason. `primary` accumulates cost from
|
|
29
|
+
* `agent_call` events WITHOUT a `retryReason` (first-attempt calls).
|
|
30
|
+
* The other buckets accumulate cost from retry calls — the extra money
|
|
31
|
+
* paid because a gate failed and the loop had to re-ask the LLM.
|
|
32
|
+
*
|
|
33
|
+
* Each bucket has a parallel `*Calls` counter so the UI can show exact
|
|
34
|
+
* call counts alongside cost. `retryCalls` is the sum across all retry
|
|
35
|
+
* reasons (not primary).
|
|
36
|
+
*/
|
|
37
|
+
retry: {
|
|
38
|
+
primary: number;
|
|
39
|
+
primaryCalls: number;
|
|
40
|
+
schema: number;
|
|
41
|
+
schemaCalls: number;
|
|
42
|
+
validate: number;
|
|
43
|
+
validateCalls: number;
|
|
44
|
+
guardrail: number;
|
|
45
|
+
guardrailCalls: number;
|
|
46
|
+
retryCalls: number;
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Embedder cost from `ctx.remember({embed: true})` and semantic
|
|
50
|
+
* `ctx.recall({query})`. Keyed by embedder model (e.g.
|
|
51
|
+
* `text-embedding-3-small`), or `'unknown'` if the embedder didn't
|
|
52
|
+
* report a model name. Tokens are a flat count because embedding
|
|
53
|
+
* APIs don't differentiate input/output — it's just "tokens fed in".
|
|
54
|
+
*
|
|
55
|
+
* These costs are *also* counted in `totalCost` (embedder cost rides
|
|
56
|
+
* the same top-level `event.cost` rail as agent cost), so the retry
|
|
57
|
+
* and byAgent/byModel/byWorkflow buckets will always sum to ≤
|
|
58
|
+
* totalCost; the difference is the embedder spend.
|
|
59
|
+
*/
|
|
60
|
+
byEmbedder: Record<string, {
|
|
61
|
+
cost: number;
|
|
62
|
+
calls: number;
|
|
63
|
+
tokens: number;
|
|
64
|
+
}>;
|
|
27
65
|
};
|
|
28
66
|
/** Hono app environment bindings */
|
|
29
67
|
type StudioEnv = {
|
|
@@ -41,6 +79,17 @@ interface BroadcastTarget {
|
|
|
41
79
|
send(data: string): void;
|
|
42
80
|
close?(): void;
|
|
43
81
|
}
|
|
82
|
+
/**
|
|
83
|
+
* Per-event, per-connection filter used by multi-tenant integrators to scope
|
|
84
|
+
* the trace firehose. Return `true` to deliver the event to this connection,
|
|
85
|
+
* `false` to skip it.
|
|
86
|
+
*
|
|
87
|
+
* `event` is the parsed payload (the same shape that was passed to `broadcast`);
|
|
88
|
+
* `metadata` is whatever the middleware attached via `setMetadata(ws, ...)`
|
|
89
|
+
* after a successful `verifyUpgrade` — typically `{ userId, tenantId }` or
|
|
90
|
+
* similar, sourced from the upgrade request's auth token.
|
|
91
|
+
*/
|
|
92
|
+
type BroadcastFilter = (event: unknown, metadata: unknown) => boolean;
|
|
44
93
|
/**
|
|
45
94
|
* Manages WebSocket connections and channel subscriptions.
|
|
46
95
|
* Supports channel multiplexing: clients subscribe/unsubscribe to channels
|
|
@@ -49,15 +98,28 @@ interface BroadcastTarget {
|
|
|
49
98
|
* Execution channels (`execution:*`) are replay-buffered: events are stored
|
|
50
99
|
* so that late subscribers receive the full event history. Buffers are cleaned
|
|
51
100
|
* up shortly after the stream completes.
|
|
101
|
+
*
|
|
102
|
+
* Multi-tenant deployments can attach per-connection metadata via
|
|
103
|
+
* `setMetadata(ws, data)` and register a `BroadcastFilter` to scope the
|
|
104
|
+
* trace firehose to the authenticated user/tenant.
|
|
52
105
|
*/
|
|
53
106
|
declare class ConnectionManager {
|
|
54
107
|
/** channel -> set of WS connections */
|
|
55
108
|
private channels;
|
|
56
|
-
/** ws ->
|
|
109
|
+
/** ws -> subscribed channels + optional integrator-supplied metadata */
|
|
57
110
|
private connections;
|
|
58
111
|
/** channel -> replay buffer for execution streams */
|
|
59
112
|
private buffers;
|
|
60
113
|
private maxConnections;
|
|
114
|
+
private filter?;
|
|
115
|
+
/**
|
|
116
|
+
* Register a broadcast filter. Called once at middleware construction.
|
|
117
|
+
* The filter runs on every outbound event and can drop or deliver based
|
|
118
|
+
* on the destination connection's metadata.
|
|
119
|
+
*/
|
|
120
|
+
setFilter(filter: BroadcastFilter | undefined): void;
|
|
121
|
+
/** Attach integrator-supplied metadata to an already-added connection. */
|
|
122
|
+
setMetadata(ws: BroadcastTarget, metadata: unknown): void;
|
|
61
123
|
/** Register a new WS connection. */
|
|
62
124
|
add(ws: BroadcastTarget): void;
|
|
63
125
|
/** Remove a WS connection and all its subscriptions. */
|
|
@@ -24,6 +24,44 @@ type CostData = {
|
|
|
24
24
|
cost: number;
|
|
25
25
|
executions: number;
|
|
26
26
|
}>;
|
|
27
|
+
/**
|
|
28
|
+
* Cost decomposition by retry reason. `primary` accumulates cost from
|
|
29
|
+
* `agent_call` events WITHOUT a `retryReason` (first-attempt calls).
|
|
30
|
+
* The other buckets accumulate cost from retry calls — the extra money
|
|
31
|
+
* paid because a gate failed and the loop had to re-ask the LLM.
|
|
32
|
+
*
|
|
33
|
+
* Each bucket has a parallel `*Calls` counter so the UI can show exact
|
|
34
|
+
* call counts alongside cost. `retryCalls` is the sum across all retry
|
|
35
|
+
* reasons (not primary).
|
|
36
|
+
*/
|
|
37
|
+
retry: {
|
|
38
|
+
primary: number;
|
|
39
|
+
primaryCalls: number;
|
|
40
|
+
schema: number;
|
|
41
|
+
schemaCalls: number;
|
|
42
|
+
validate: number;
|
|
43
|
+
validateCalls: number;
|
|
44
|
+
guardrail: number;
|
|
45
|
+
guardrailCalls: number;
|
|
46
|
+
retryCalls: number;
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Embedder cost from `ctx.remember({embed: true})` and semantic
|
|
50
|
+
* `ctx.recall({query})`. Keyed by embedder model (e.g.
|
|
51
|
+
* `text-embedding-3-small`), or `'unknown'` if the embedder didn't
|
|
52
|
+
* report a model name. Tokens are a flat count because embedding
|
|
53
|
+
* APIs don't differentiate input/output — it's just "tokens fed in".
|
|
54
|
+
*
|
|
55
|
+
* These costs are *also* counted in `totalCost` (embedder cost rides
|
|
56
|
+
* the same top-level `event.cost` rail as agent cost), so the retry
|
|
57
|
+
* and byAgent/byModel/byWorkflow buckets will always sum to ≤
|
|
58
|
+
* totalCost; the difference is the embedder spend.
|
|
59
|
+
*/
|
|
60
|
+
byEmbedder: Record<string, {
|
|
61
|
+
cost: number;
|
|
62
|
+
calls: number;
|
|
63
|
+
tokens: number;
|
|
64
|
+
}>;
|
|
27
65
|
};
|
|
28
66
|
/** Hono app environment bindings */
|
|
29
67
|
type StudioEnv = {
|
|
@@ -41,6 +79,17 @@ interface BroadcastTarget {
|
|
|
41
79
|
send(data: string): void;
|
|
42
80
|
close?(): void;
|
|
43
81
|
}
|
|
82
|
+
/**
|
|
83
|
+
* Per-event, per-connection filter used by multi-tenant integrators to scope
|
|
84
|
+
* the trace firehose. Return `true` to deliver the event to this connection,
|
|
85
|
+
* `false` to skip it.
|
|
86
|
+
*
|
|
87
|
+
* `event` is the parsed payload (the same shape that was passed to `broadcast`);
|
|
88
|
+
* `metadata` is whatever the middleware attached via `setMetadata(ws, ...)`
|
|
89
|
+
* after a successful `verifyUpgrade` — typically `{ userId, tenantId }` or
|
|
90
|
+
* similar, sourced from the upgrade request's auth token.
|
|
91
|
+
*/
|
|
92
|
+
type BroadcastFilter = (event: unknown, metadata: unknown) => boolean;
|
|
44
93
|
/**
|
|
45
94
|
* Manages WebSocket connections and channel subscriptions.
|
|
46
95
|
* Supports channel multiplexing: clients subscribe/unsubscribe to channels
|
|
@@ -49,15 +98,28 @@ interface BroadcastTarget {
|
|
|
49
98
|
* Execution channels (`execution:*`) are replay-buffered: events are stored
|
|
50
99
|
* so that late subscribers receive the full event history. Buffers are cleaned
|
|
51
100
|
* up shortly after the stream completes.
|
|
101
|
+
*
|
|
102
|
+
* Multi-tenant deployments can attach per-connection metadata via
|
|
103
|
+
* `setMetadata(ws, data)` and register a `BroadcastFilter` to scope the
|
|
104
|
+
* trace firehose to the authenticated user/tenant.
|
|
52
105
|
*/
|
|
53
106
|
declare class ConnectionManager {
|
|
54
107
|
/** channel -> set of WS connections */
|
|
55
108
|
private channels;
|
|
56
|
-
/** ws ->
|
|
109
|
+
/** ws -> subscribed channels + optional integrator-supplied metadata */
|
|
57
110
|
private connections;
|
|
58
111
|
/** channel -> replay buffer for execution streams */
|
|
59
112
|
private buffers;
|
|
60
113
|
private maxConnections;
|
|
114
|
+
private filter?;
|
|
115
|
+
/**
|
|
116
|
+
* Register a broadcast filter. Called once at middleware construction.
|
|
117
|
+
* The filter runs on every outbound event and can drop or deliver based
|
|
118
|
+
* on the destination connection's metadata.
|
|
119
|
+
*/
|
|
120
|
+
setFilter(filter: BroadcastFilter | undefined): void;
|
|
121
|
+
/** Attach integrator-supplied metadata to an already-added connection. */
|
|
122
|
+
setMetadata(ws: BroadcastTarget, metadata: unknown): void;
|
|
61
123
|
/** Register a new WS connection. */
|
|
62
124
|
add(ws: BroadcastTarget): void;
|
|
63
125
|
/** Remove a WS connection and all its subscriptions. */
|