glove-foundry 0.7.0 → 0.9.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/docs/inspector.md CHANGED
@@ -1,11 +1,56 @@
1
1
  # Foundry inspector
2
2
 
3
- Run detail includes a **Conversation guidance** card when goals, facts, forms or
4
- custom context providers are mounted. It shows the latest observed progress,
5
- fact/claim counts and pending form effects, not a live database query. Answer
6
- values and fact bodies are excluded from this summary. See [guidance](./guidance.md).
3
+ The development server includes a runtime inspector. Most pages follow Foundry's ownership boundaries: definitions, instances, conversations, automations, integrations and workspaces. A run opens as a workbench modelled on a browser's DevTools:
7
4
 
8
- The development server includes a read-oriented runtime inspector. It is organized around Foundry's actual ownership boundaries rather than presenting every event on one screen.
5
+ - **Network** lists every model request and tool call.
6
+ - **Console** is the run's log.
7
+ - **Context** shows what the agent had to work with.
8
+ - **Composition** shows what Foundry assembled the agent from, and which app or feature each tool came from.
9
+ - **Queues** lists everything that crossed the run's boundary, in and out.
10
+ - **Call chain** shows the runs this one came from and the runs it started.
11
+ - **Summary** gives the outcome.
12
+
13
+ ## Running it
14
+
15
+ The inspector is part of the Foundry server. Start your app with:
16
+
17
+ ```bash
18
+ pnpm glove foundry dev
19
+ ```
20
+
21
+ It prints the inspector's address (the port is `server.port` in `foundry.config.ts`). Open **Chat** to send a message, or **New run** from any page; each opens or links to its run. On a run, `1`–`7` switch between the views.
22
+
23
+ ### Try it without an API key
24
+
25
+ Two examples run offline on scripted models, so every view has something to show. From the repository root, build the examples' packages, then install again so pnpm links the `glove` command (it can only link it once `glove-foundry` is built):
26
+
27
+ ```bash
28
+ pnpm install
29
+ pnpm --filter "glove-foundry-layered-assistant^..." --filter "glove-foundry-example^..." build
30
+ pnpm install
31
+ ```
32
+
33
+ **A delegation across four runs** ([layered assistant](../../../examples/foundry-layered-assistant)):
34
+
35
+ ```bash
36
+ pnpm --filter glove-foundry-layered-assistant dev
37
+ ```
38
+
39
+ Open http://127.0.0.1:4142, then **Chat**, Maya's chat, and send `Write me a slugify function, please.` Without `ANTHROPIC_API_KEY` each agent runs a scripted model. The assistant delegates to a coder, the coder asks which language, the assistant answers, and the coder reports back: four runs. Open **Runs** and look at:
40
+
41
+ - the assistant's first run: **Call chain** (delegated, asked, replied, reported back) and **Queues** (the delegation it sent, and the coder's run it started);
42
+ - the coder's run: **Queues** (the task that started it, its question, and the answer handed to it while it ran);
43
+ - any run: **Composition** (the delegates and the tools each step added).
44
+
45
+ **Apps, MCP, a working environment, schedules and playbooks** ([reference app](../../../examples/foundry-agent)):
46
+
47
+ ```bash
48
+ pnpm --filter glove-foundry-example dev
49
+ ```
50
+
51
+ Open http://127.0.0.1:4242 and start a run of `release-planner` with **New run**. Without `OPENROUTER_API_KEY` it runs a deterministic model. **Composition** lists 47 tools under the steps and installations that added them, plus the playbooks and schedules it loaded.
52
+
53
+ For the waterfall and Timing panes you need a model with real latency: set the example's key, or run your own app.
9
54
 
10
55
  ## Navigation
11
56
 
@@ -17,18 +62,193 @@ The development server includes a read-oriented runtime inspector. It is organiz
17
62
  | Agent instance | Which context, installations, playbooks, conversations, and runs belong to this persisted identity? |
18
63
  | Chat | What has this exact instance/conversation said, and how can I continue, stop, or redirect it? |
19
64
  | Runs | Which invocations occurred and what status, source, and attempt count did each have? |
20
- | Run detail | What observable phases and events produced this outcome? |
65
+ | Run | What did the model see and do at each step: requests, tool calls, log, context and outcome? |
21
66
  | Automations | Which schedules, sleeping runs, playbook listeners, and inbound application workers exist? |
22
67
  | Integrations | Which transmissions, safe account references, routes, and agent bindings form the external topology? |
23
68
  | Workspaces | Which shared entries, inbox items, tasks, and non-secret environment values are available? |
24
69
 
25
- Every detail view has a real URL. For example, `/agents/support-lead`, `/instances/<agent-id>`, `/chat/<conversation-id>?agent=<agent-id>`, and `/runs/<run-id>` can be bookmarked or opened directly; the Foundry server returns the inspector shell for non-API paths.
70
+ Every view has a real URL that can be bookmarked or opened directly, for example:
71
+
72
+ - `/agents/support-lead`
73
+ - `/instances/<agent-id>`
74
+ - `/chat/<conversation-id>?agent=<agent-id>`
75
+ - `/runs/<run-id>?item=<request>&pane=context`
76
+
77
+ The Foundry server returns the inspector shell for every path outside the API.
78
+
79
+ The inspector and APIs share one authorization boundary:
80
+
81
+ - Loopback remains the development default.
82
+ - Foundry refuses a non-loopback bind without the application's `requestAuthorization` adapter.
83
+ - When that adapter is configured, every HTML, API, health and event stream request must pass it.
84
+ - The adapter owns credential and session validation and the browser challenge. Foundry keeps credential values out of state and traces.
85
+
86
+ ## Following a run
87
+
88
+ Open **Runs**, then a run. A strip at the top gives its status, duration, number of model requests and tool calls, tokens and agent instance. Below it are seven views:
89
+
90
+ - Switch between them with `1`–`7`.
91
+ - The view, the open request and its pane are all in the URL, so a link opens someone else on the same step.
92
+
93
+ The screenshots below are runs of Meta Muse, the [personal agent example](../../../examples/foundry-personal-agent), on Claude Sonnet 5.5 through OpenRouter. They use the example's sample accounts and its offline stand-in for Kuiper's browsers.
94
+
95
+ ### Network
96
+
97
+ ![The Network view: each model request and tool call of a run, with type, status, initiator, size, time and a waterfall](../../site/public/foundry/inspector/network.webp)
98
+
99
+ ![A tool call's Timing pane: queued behind an earlier call, checked, then run. The researcher subagent's requests and tool call sit indented under it](../../site/public/foundry/inspector/network-timing.webp)
100
+
101
+ In this run Muse tries to book a restaurant:
102
+
103
+ 1. The Sentinel blocks a site Rosa hasn't allowed (the first red row).
104
+ 2. Rosa allows it with `request_access`.
105
+ 3. The page still fails to load. The model asked for HTTPS, and the offline demo serves its sample sites over plain HTTP.
106
+ 4. Midway, at #5, Glove compacts the conversation.
107
+ 5. The calls a REPL program makes sit under the `execute_js` call that ran them.
108
+
109
+ Each row is one model request (a square), one tool call (a circle), or a subagent. A subagent's own requests and tool calls sit indented under it. When a run has more than one turn (it resumed after an approval, or events woke it), a divider marks where each turn began and how it ended. The columns:
110
+
111
+ | Column | Meaning |
112
+ | --- | --- |
113
+ | Name | `#1 request`, `#2 request`, … or the tool's name, with the model and message count, or the tool's input, underneath. |
114
+ | Type | `model`, `compaction`, `tool`, `repl call` (a tool called from inside a REPL program) or `subagent`. |
115
+ | Status | `ok`, `error`, `aborted`, `denied`, `pending`, or `approval` while a person hasn't decided. |
116
+ | Initiator | What led to the row. A request follows `run input` or the tools of the previous request (`after search`). A tool call comes from the request whose response asked for it. Click it to jump there. |
117
+ | Size | Tokens in → out for a model request; the size of the result for a tool. |
118
+ | Time and Waterfall | How long it took, and when, across the whole run. A model request's bar is light until its first token and solid while it streams. A tool call's bar is light while its permission is checked (or a person decides) and solid while it runs; a thin line before it is the time it waited behind the calls ahead of it in the same step. |
119
+
120
+ Filter rows by text (name, input, result or reply) and by **All**, **Model**, **Tools** or **Errors**. The footer totals requests, tool calls, tokens (and cache reads), and the time spent in the model and in tools.
121
+
122
+ Click a row, or walk them with `j` and `k`, to open it beside the list. `Esc` closes it. A model request has these panes:
123
+
124
+ | Pane | What it shows |
125
+ | --- | --- |
126
+ | Overview | Request id, model, status, start, duration, tokens and cache, stop reason, initiator, sizes, and links to the tool calls in its response. |
127
+ | Prompt | The system prompt this request was sent. |
128
+ | Messages | The conversation as this request sent it. Messages already sent earlier fold away, so what's new sits at the end. Tool calls and results show their JSON, and each links to its tool row. |
129
+ | Context | The runtime context added at the end of this request: memory, goals, forms, or any context provider. Each entry is marked new, changed or the same as the previous request. |
130
+ | Tools | Each tool the model was offered, with its description and input schema. |
131
+ | Response | What the model sent back, its stop reason and tokens, or the error that ended the request. |
132
+ | Timing | Like DevTools' Timing tab: waiting for the first token, then streaming, with the text it streamed. |
133
+ | Raw | The recorded events. |
134
+
135
+ **Copy request** copies the request as JSON: model, system prompt, messages, runtime context and tools. Use it to replay a step against a model, or to attach it to an issue.
136
+
137
+ ![A model request open beside the list: the Messages pane shows the conversation the model was sent, with new messages at the end](../../site/public/foundry/inspector/request-messages.webp)
138
+
139
+ ![The Context pane: runtime context, such as memory, added at the end of this request](../../site/public/foundry/inspector/request-context.webp)
140
+
141
+ A tool call has these panes:
142
+
143
+ - **Overview**: call id, duration, the request that made it, and its approval (who decided, and when).
144
+ - **Input**: what the model passed.
145
+ - **Result**: status, message and data. JSON held inside a string opens as a tree.
146
+ - **Timing**: when the model asked for the call, how long it was queued behind earlier calls, how long its permission check or approval took, and how long it ran.
147
+ - **Raw**: the recorded events.
148
+
149
+ ![A tool call that needed approval, open beside the list](../../site/public/foundry/inspector/tool-call.webp)
150
+
151
+ ### Console
152
+
153
+ ![The Console view: the run as a levelled log, with warnings and errors highlighted](../../site/public/foundry/inspector/console.webp)
154
+
155
+ The run as a log, one line per event:
156
+
157
+ - **Levels.** Errors and warnings are coloured: a failed tool, a run that failed or retried, stderr, an approval being waited on. **Default levels** hides verbose detail, such as assembly steps and streamed text. **All levels** shows it. You can also show only warnings and errors, or only errors.
158
+ - **Streamed text.** A streamed reply is one line per request, not one line per chunk, even when a subagent streams in between.
159
+ - **Turns and arrivals.** Lines mark each turn starting and how it ended (finished, failed, aborted, or suspended at an approval), events arriving and when they joined the conversation, and resolved inbox items joining it.
160
+ - **Filters.** Filter by text and by source (`run`, `model`, `tool`, `stdout`, `stderr`, `assembly`, …).
161
+ - **Expanding a line.** Click a line to see its data as a tree and to copy it. Lines about a request or tool call have **Open in Network**.
162
+ - **Live runs.** While the run is live, the console stays at the bottom unless you have scrolled up.
163
+
164
+ ### Context
165
+
166
+ ![The Context view: system prompt, runtime context, tools and messages per request, then the run's input and output, the agent instance, and memory](../../site/public/foundry/inspector/context.webp)
167
+
168
+ Like DevTools' Application panel, a tree on the left and the selected item on the right:
169
+
170
+ | Group | Items |
171
+ | --- | --- |
172
+ | Model request | System prompt, runtime context, tools and messages. **As of** chooses which request; the latest is the default. When the run used more than one system prompt (a subagent has its own), each is listed with the requests that used it. |
173
+ | Run | The input it was given, and its output or error. |
174
+ | Agent | The instance's stored context, installations and playbooks, with links to the instance, workspace and conversation. |
175
+ | Memory | Goals, facts and forms (see [guidance](./guidance.md)), and the memory events the run recorded. What memory put in front of the model is in each request's runtime context. |
176
+
177
+ ### Composition
178
+
179
+ ![The Composition view: each tool the agent had, grouped under the assembly step that added it](../../site/public/foundry/inspector/composition.webp)
26
180
 
27
- The inspector and APIs share one authorization boundary. Loopback remains the
28
- development default. Foundry refuses a non-loopback bind without the application's
29
- `requestAuthorization` adapter; when configured, every HTML, API, health, and event
30
- stream request must pass it. The adapter owns credential/session validation and the
31
- browser challenge, while Foundry keeps credential values out of state and traces.
181
+ What Foundry assembled the run's agent from, like DevTools' Sources panel. A tree on the left, the selected item on the right:
182
+
183
+ | Item | What it shows |
184
+ | --- | --- |
185
+ | Timeline | Each definition field resolving, then each assembly step (Foundry core tools, app transmissions, the definition's tools, delegation, mesh, working environment, guidance, calls, layers and subscribers, each installation, MCP servers, memory, `configure()`, the REPL, `build()`), with how long it took. |
186
+ | Tools by origin | Each tool the agent had, under the step that added it, with how many times it was called. Click a tool to see its calls in Network. |
187
+ | Apps and installations | What the instance has installed and the tools each installation gave this run; an app's tools that change things are marked. |
188
+ | Working environment and REPL | What the working environment and REPL mounted. |
189
+ | Playbooks | The playbooks the definition composed and the ones stored on the instance. |
190
+ | Schedules | The definition's schedules, the schedules and sleeps this run created, and the instance's activations with their next and last runs. |
191
+ | Delegates and workers | The agents this one can hand work to, its durable subagents, and, for a worker, the delegation it works on. |
192
+ | Mesh | Whether the hosted mesh or your own transport is mounted, and the open threads. |
193
+ | Memory, layers and subscribers; Hooks, skills, subagents and calls | The rest of the definition. |
194
+
195
+ A run records its assembly as one `foundry.assembly.composed` event, just before its first turn. It compares the agent's tools before and after each step, so every tool is listed under the step that folded it.
196
+
197
+ ### Queues
198
+
199
+ ![The Queues view: the delegated task that started a worker's run, its question to the delegator, and the answer handed to it while it ran](../../site/public/foundry/inspector/queues.webp)
200
+
201
+ Everything that crossed the run's boundary, like the Messages pane of a WebSocket in DevTools: one row per message, inbound (↓) or outbound (↑).
202
+
203
+ - **Inbound**: what started the run (a message, a transmission, a delegated task or result, a schedule or sleep firing, a spawn); events that arrived while it ran (transmission follow-ups, delegation updates, agent and mesh messages, approval decisions); deliveries handed to it live; and resolved inbox items.
204
+ - **Outbound**: transmissions, delegations and replies, questions to the delegator, agent and mesh messages, spawns, background runs, schedules and sleeps, inbox items posted, and approvals asked for.
205
+
206
+ **Status** follows each row: an event is queued, deferred, woke the agent or was dropped, then joined the conversation as the turn's message, before a request, or between tool steps. A command is sent, then accepted, delivered, scheduled or started. **Reached** is, for an inbound row, the model request that first saw it, and for an outbound one, the run it started. Click a row for its detail and the events behind it.
207
+
208
+ ### Call chain
209
+
210
+ ![The Call chain view: an assistant run delegates to a coder; the coder asks a question, the assistant's next run answers it, and the coder reports back](../../site/public/foundry/inspector/call-chain.webp)
211
+
212
+ The runs this one came from and the runs it started, like DevTools' initiator chain across runs. Above the run: what started its chain (a transmission, a schedule) and each run that led to it. Below: what it started, as a tree. The edges say how: delegated to a worker, the worker asked, the answer replied, the worker reported back, spawned, scheduled, woke from sleep, steered. Each run links to its own Call chain.
213
+
214
+ The chain is read from the runtime's retained events (`delegation.started`, `delegation.replied`, `core.command.accepted`, `run.steered` and the commands runs sent), so runs older than what the runtime keeps show as *not retained*.
215
+
216
+ ### Summary
217
+
218
+ The run's phases (accepted, assembled, agent work, outcome), its recorded output and input, the slowest steps and every failed request or tool call, each linking to its row in Network. A failed run states its error at the top of the page, and pending approvals show there with their exact input. **Export trace** downloads the run and every event as JSON. **Run again** reopens the run drawer with the same instance and message.
219
+
220
+ The inspector shows what was observable: what was sent, called and returned. It doesn't show a model's hidden reasoning, and reasoning a provider asks to have echoed back isn't recorded.
221
+
222
+ ### What each model request records
223
+
224
+ Glove reports every model call to subscribers that ask for it, as `model_request` and `model_request_end` events. These carry the system prompt, messages, tools, outcome, response and tokens. A run records them compactly, because a long conversation would otherwise be copied into every request:
225
+
226
+ - The system prompt and the tool list are recorded in full the first time a run sends them, then by hash.
227
+ - Messages are recorded as a change against the previous request with the same system prompt: how many leading messages were kept, then the rest. The inspector puts each request's full list back together.
228
+ - Runtime context is recorded with every request, since it is worked out again each time.
229
+ - Text is cut at 16,000 characters and JSON at 16,000 characters; the system prompt is cut at 64,000.
230
+ - Images, video and documents become a placeholder with their type and name. A request records at most about 400 KB of messages, newest first; older ones are counted.
231
+ - `renderData` (which the model never sees) and echoed provider reasoning are left out.
232
+
233
+ Events are kept in memory, 10,000 by default (`observability.maxEvents`). A message whose request has aged out shows as *not retained*. To keep model requests out of the event stream entirely, set this in `foundry.config.ts`:
234
+
235
+ ```ts
236
+ export default defineConfig({ observability: { modelRequests: false } });
237
+ ```
238
+
239
+ Runs recorded before this, or with model requests off, still list their tool calls, model responses and log.
240
+
241
+ ### What else a run records
242
+
243
+ The run's subscriber also records these Glove events, and the views above read them:
244
+
245
+ - `turn_start` and `turn_end` bracket each turn: a request, events waking the agent, or a resumed tool step, with how it ended.
246
+ - `tool_use_start` marks when a tool call starts running, after the calls ahead of it and its permission check. `tool_use` marks when the model asked for it.
247
+ - Streamed text and tool calls carry the `request_id` of the request they came from, which gives each request's time to first token.
248
+ - `subagent_invoked` and `subagent_completed` name the tool call that ran the subagent.
249
+ - `event_received` previews what arrived, and `inbox_injected` reports resolved inbox items joining the conversation.
250
+
251
+ Runs recorded before these events show a single bar per row and no turns.
32
252
 
33
253
  ## Talking to an agent
34
254
 
@@ -53,19 +273,6 @@ is explicit in the URL, and every refresh reloads history from the server. New
53
273
  conversations take the first text turn as their initial title and can be renamed
54
274
  later without changing their stable conversation identity.
55
275
 
56
- ## Following a run
57
-
58
- Open **Runs**, then choose one invocation. The run detail starts with a four-phase spine:
59
-
60
- 1. Accepted: Foundry persisted the invocation and its source.
61
- 2. Assembled: context-dependent agent components were resolved and mounted.
62
- 3. Agent work: observable model and tool work occurred.
63
- 4. Completed, failed, cancelled, or still in progress.
64
-
65
- The event trace below the spine is collapsed by default. Each row carries its wall-clock time and its offset from the start of the run, so a slow phase is visible without arithmetic. Filter the trace by event category, expand an event when you need its adapter payload, and copy a payload straight from the expanded row. The inspector shows observable intent, actions, and outcomes; it does not expose a model's private hidden chain-of-thought.
66
-
67
- A failed run states its error above the spine rather than only inside the recorded output. A run that is still going says so and keeps a running duration. **Run again** reopens the run drawer with the same instance and message.
68
-
69
276
  ## Starting work
70
277
 
71
278
  Use **New run** from any page. Select a definition and either:
@@ -91,7 +298,7 @@ The **Runs** page keeps its filters in the query string, so any view is a link y
91
298
 
92
299
  The inspector subscribes to `/api/events` with server-sent events and also performs a low-frequency reconciliation. A busy run emits many events, so they are coalesced into one refresh rather than one repaint each.
93
300
 
94
- A refresh preserves what you are doing: scroll position, an expanded event, an open `Output` panel, and the text and caret in a filter box all survive it. Relative timestamps and the duration of an in-flight run tick every second without a repaint.
301
+ A refresh preserves what you are doing: scroll position (including each pane of a run), expanded and collapsed sections, and the text and caret in a filter box all survive it. A run's page fetches that run's own events, then only the new ones (`/api/runs/:id/events?after=<sequence>`), so a long run isn't cut short by the global event list. Relative timestamps and the duration of an in-flight run tick every second without a repaint.
95
302
 
96
303
  Press `Command-K` or `Control-K` to search pages, definitions, instances, and retained runs.
97
304
 
@@ -99,17 +306,100 @@ Press `Command-K` or `Control-K` to search pages, definitions, instances, and re
99
306
 
100
307
  | Key | Action |
101
308
  | --- | --- |
102
- | `j` / `k` | Move down and up the current list |
309
+ | `j` / `k` | Move down and up the current list; on a run's Network view, open the next or previous request |
310
+ | `1`–`7` | On a run: Summary, Network, Console, Context, Composition, Queues, Call chain |
103
311
  | `Enter` or `o` | Open the highlighted row |
104
- | `/` | Focus the run filter, or open search elsewhere |
312
+ | `/` | Focus the filter (runs, Network, Console), or open search elsewhere |
105
313
  | `c` | Start a run |
106
314
  | `r` | Refresh runtime data |
107
315
  | `Command-K` / `Control-K` | Search |
108
- | `Escape` | Close the drawer or search |
316
+ | `Escape` | Close the drawer or search; on a run, close the open request or message, or leave a filter box |
109
317
  | `Command-Enter` | Submit the run drawer |
110
318
 
111
319
  Every truncated identifier in the inspector has a copy button, so the full run, instance, or conversation id is always retrievable.
112
320
 
321
+ ## Testing with it
322
+
323
+ ### Assert on what a run recorded
324
+
325
+ Everything the views show comes from the run's recorded events, so a test can read the same events. This passes against the layered assistant, offline:
326
+
327
+ ```ts
328
+ import assert from "node:assert/strict";
329
+
330
+ const run = await runtime.send("maya", "maya-chat", "Write me a slugify function, please.");
331
+ await runtime.waitForRun(run.id, { timeoutMs: 60_000 });
332
+ const events = runtime.observability.list({ runId: run.id });
333
+ const of = (type: string) => events.filter((event) => event.type === `agent.${type}`).map((event) => event.data as any);
334
+
335
+ // What Foundry assembled, and which step added each tool.
336
+ const [composed] = of("foundry.assembly.composed");
337
+ const attributed = new Set(composed.steps.flatMap((step: { tools: string[] }) => step.tools));
338
+ assert.deepEqual(composed.tools.filter((name: string) => !attributed.has(name)), []);
339
+ assert.ok(composed.delegates.some((delegate: { agent: string }) => delegate.agent === "coder"));
340
+
341
+ // How the turn ended, and the tool call that delegated.
342
+ assert.equal(of("turn_end").at(-1).status, "success");
343
+ assert.ok(of("tool_use_start").some((call) => call.name === "glove_foundry_delegate"));
344
+
345
+ // The delegation it started, recorded by the runtime under this run.
346
+ const started = events.find((event) => event.type === "delegation.started");
347
+ assert.equal((started?.data as { to: string }).to, "coder");
348
+ ```
349
+
350
+ Agent events are prefixed `agent.`. The runtime's own events about a run (`delegation.started`, `core.command.accepted`, `transmission.outbound.delivered`, `run.steered`) aren't. Over HTTP, the same list is `GET /api/runs/:id/events`.
351
+
352
+ ### Read the same events in your own subscriber
353
+
354
+ The Glove events the inspector reads reach any subscriber, with or without Foundry. This one logs each turn, each request's time to first token, and how long each tool call waited before it ran:
355
+
356
+ ```ts
357
+ import type { SubscriberAdapter } from "glove-core";
358
+
359
+ const sentAt = new Map<string, number>(); // request_id → when it was sent
360
+ const askedAt = new Map<string, number>(); // call id → when the model asked for it
361
+
362
+ export const timings: SubscriberAdapter = {
363
+ modelRequests: true, // also receive model_request and model_request_end
364
+ async record(type, data: any) {
365
+ const now = Date.now();
366
+ if (type === "turn_start") console.log(`turn (${data.trigger}) started`);
367
+ if (type === "turn_end") console.log(`turn ${data.status} after ${data.duration_ms}ms`);
368
+ if (type === "model_request") sentAt.set(data.request_id, now);
369
+ if ((type === "text_delta" || type === "tool_use") && sentAt.has(data.request_id)) {
370
+ console.log(`first token after ${now - sentAt.get(data.request_id)!}ms`);
371
+ sentAt.delete(data.request_id);
372
+ }
373
+ if (type === "tool_use") askedAt.set(data.id, now);
374
+ if (type === "tool_use_start") console.log(`${data.name} started ${now - (askedAt.get(data.id) ?? now)}ms after the model asked`);
375
+ if (type === "tool_use_result") console.log(`${data.name} ${data.result.status} after ${data.duration_ms}ms`);
376
+ },
377
+ };
378
+ ```
379
+
380
+ Add it with `glove.addSubscriber(timings)`, or list it in a Foundry definition's `subscribers`.
381
+
382
+ ### Test the inspector itself
383
+
384
+ The views are built by plain functions over `/api/runs/:id/events`: `buildRunTrace` and `buildConsole` in `src/dashboard-trace.ts`, and `buildComposition`, `buildQueues` and `buildRunChain` in `src/dashboard-foundry.ts`. Their tests evaluate the same source the browser runs:
385
+
386
+ ```ts
387
+ import { DASHBOARD_TRACE_SCRIPT } from "../src/dashboard-trace.js";
388
+ import { DASHBOARD_FOUNDRY_SCRIPT } from "../src/dashboard-foundry.js";
389
+
390
+ const kit = new Function(`${DASHBOARD_TRACE_SCRIPT}\n${DASHBOARD_FOUNDRY_SCRIPT}; return { buildRunTrace, buildQueues };`)();
391
+ const rows = kit.buildQueues(events, run, kit.buildRunTrace(events, run));
392
+ ```
393
+
394
+ Run them, then the integration test that checks a real run's assembly is fully attributed:
395
+
396
+ ```bash
397
+ pnpm --filter glove-foundry exec node --test --import tsx tests/dashboard-trace.test.ts tests/dashboard-foundry.test.ts
398
+ pnpm --filter glove-foundry exec node --test --import tsx tests/integration.test.ts
399
+ ```
400
+
401
+ `pnpm --filter glove-core test` covers the events themselves (`tests/observability-events.test.ts`).
402
+
113
403
  ## Operator API used by the inspector
114
404
 
115
405
  The inspector is an API client and adds no hidden runtime state. Its primary read surfaces are:
@@ -119,6 +409,8 @@ The inspector is an API client and adds no hidden runtime state. Its primary rea
119
409
  - `POST /api/conversations/:id/messages` and `/api/runs/:id/cancel|steer`
120
410
  - `PATCH /api/conversations/:id` for an instance-owned title or context update
121
411
  - `/api/runs`, `/api/runs/:id`, and `/api/events`
412
+ - `/api/runs/:id/events`, with `?after=<sequence>` for only what's new, for one run's trace
413
+ - `/api/events?category=system`, for the runs a run started or came from (Call chain)
122
414
  - `/api/activations` and `/api/playbook-subscriptions`
123
415
  - `/api/application-connections`
124
416
  - `/api/transmissions`, `/api/accounts`, `/api/routes`, and `/api/bindings`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "glove-foundry",
3
- "version": "0.7.0",
3
+ "version": "0.9.0",
4
4
  "description": "An Effect-native, file-routed framework for typed, observable Glove agent applications",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -77,18 +77,19 @@
77
77
  "station-client": "^3.0.0",
78
78
  "station-beacon": "^3.0.0",
79
79
  "station-broadcast": "^3.0.0",
80
- "glove-core": "4.6.0",
81
- "glove-facts": "0.1.7",
82
- "glove-lisp": "0.5.5",
83
- "glove-js": "0.5.5",
84
- "glove-mcp": "1.2.5",
85
- "glove-mesh": "0.2.2",
86
- "glove-memory": "2.3.2",
87
- "glove-python": "0.4.5",
80
+ "glove-lisp": "0.5.7",
81
+ "glove-core": "4.8.0",
82
+ "glove-facts": "0.1.9",
83
+ "glove-js": "0.5.7",
84
+ "glove-mcp": "1.2.7",
85
+ "glove-memory": "2.3.4",
86
+ "glove-mesh": "0.2.4",
88
87
  "glove-working-environment": "0.7.0",
89
- "glove-voice-s2s": "0.4.5"
88
+ "glove-voice-s2s": "0.4.7",
89
+ "glove-python": "0.4.7"
90
90
  },
91
91
  "devDependencies": {
92
+ "@modelcontextprotocol/sdk": "^1.29.0",
92
93
  "@types/node": "^25.2.3",
93
94
  "@types/ws": "8.18.1",
94
95
  "tsup": "^8.5.1",
@@ -213,7 +213,7 @@ console.log((await run.wait()).output);
213
213
  | Overview | Is the runtime healthy, what is running, what needs attention |
214
214
  | Agents | Which definitions exist and which instances were provisioned |
215
215
  | Runs | Every invocation, with status, duration, and source |
216
- | Run detail | The phase spine and the full observable event trace |
216
+ | Run | Each model request (system prompt, messages, memory, tools) and tool call, the log, and the outcome |
217
217
  | Automations | Schedules, sleeping runs, playbook listeners, inbound workers |
218
218
  | Integrations | Transmissions, accounts, routes, and bindings |
219
219
  | Workspaces | Shared entries, inbox, tasks, and non-secret environment values |