@uptimizr/agent-core 1.0.1 → 1.1.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/AGENTS.md +74 -8
- package/README.md +62 -14
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/registryTools.d.ts +54 -0
- package/dist/registryTools.d.ts.map +1 -0
- package/dist/registryTools.js +409 -0
- package/dist/registryTools.js.map +1 -0
- package/dist/tools.d.ts +44 -9
- package/dist/tools.d.ts.map +1 -1
- package/dist/tools.js +38 -328
- package/dist/tools.js.map +1 -1
- package/llms.txt +49 -1
- package/package.json +4 -2
package/AGENTS.md
CHANGED
|
@@ -9,7 +9,9 @@ The **framework-agnostic, browser-safe core** shared by every Uptimizr analytics
|
|
|
9
9
|
the agent tool surface **once** (ADR 0050 §1) so `@uptimizr/mcp`, the dashboard assistant, and the
|
|
10
10
|
demo assistant never drift apart. It owns:
|
|
11
11
|
|
|
12
|
-
- the **read-only tool catalog** (`readTools`) — one entry per documented collector query endpoint
|
|
12
|
+
- the **read-only tool catalog** (`readTools`) — one entry per documented collector query endpoint,
|
|
13
|
+
**generated** from the `@uptimizr/metrics` semantic metric registry (ADR 0051 §1), so coverage of the
|
|
14
|
+
collector's read surface cannot drift;
|
|
13
15
|
- a headless **LLM provider-adapter interface** (`LlmProvider`) — messages + tool schemas in, tool
|
|
14
16
|
calls or final text out;
|
|
15
17
|
- the headless **tool-calling loop** (`runAgent`) — LLM ↔ tools ↔ collector.
|
|
@@ -17,22 +19,86 @@ demo assistant never drift apart. It owns:
|
|
|
17
19
|
The core ships **no model and no key**. It only ever reads a consumer's **own** collector via the
|
|
18
20
|
`CollectorClient` (`GET`-only, `x-api-key`).
|
|
19
21
|
|
|
22
|
+
## Tool catalog (read-only)
|
|
23
|
+
|
|
24
|
+
<!-- generated:registry-tool-names:start — generated by `pnpm gen:docs`; edit the metric registry, not this list -->
|
|
25
|
+
|
|
26
|
+
`list_sessions`, `session_meta`, `scene_representation`, `list_scenes`, `timeseries`,
|
|
27
|
+
`event_counts`, `pointer_heatmap`, `mesh_uv_heatmap`, `world_heatmap`, `world_heatmap_stats`,
|
|
28
|
+
`gaze_heatmap`, `gaze_heatmap_stats`, `camera_heatmap`, `view_coverage_histogram`,
|
|
29
|
+
`position_heatmap`, `session_trajectory`, `aggregate_paths`, `scene_coverage`, `camera_distance`,
|
|
30
|
+
`click_rays`, `flow_links`, `top_meshes`, `mesh_sources`, `mesh_trend`, `mesh_dwell`,
|
|
31
|
+
`mesh_blind_spots`, `mesh_interaction_kinds`, `mesh_reachability`, `dead_clicks`, `rage_clicks`,
|
|
32
|
+
`hover_dwell`, `interaction_sources`, `top_input_actions`, `camera_gestures`, `navigation_stats`,
|
|
33
|
+
`backtrack_ratio`, `perf_summary`, `render_scale_truth`, `perf_distribution`, `fps_histogram`,
|
|
34
|
+
`frame_time_percentiles`, `jank_rate`, `perf_churn`, `perf_by_device`, `perf_by_scene`,
|
|
35
|
+
`perf_heatmap`, `compile_stalls`, `resource_summary`, `resource_percentiles`, `stability_counts`,
|
|
36
|
+
`graphics_diagnostics`, `error_heatmap`, `rendering_technology`, `capability_changes`,
|
|
37
|
+
`xr_rotation`, `xr_sources`, `xr_abandonment`, `xr_locomotion`, `xr_tracking_quality`,
|
|
38
|
+
`boundary_heatmap`, `boundary_heatmap_stats`, `xr_boundary_contacts`,
|
|
39
|
+
`ar_placement_time_to_place`, `ar_placement_attempts`, `ar_placement_surfaces`, `funnel`,
|
|
40
|
+
`scene_retention`, `load_bounce_funnel`, `variant_leaderboard`
|
|
41
|
+
|
|
42
|
+
<!-- generated:registry-tool-names:end -->
|
|
43
|
+
|
|
44
|
+
Each name is a metric in the collector's semantic metric registry (ADR 0051) and maps one-to-one to
|
|
45
|
+
a documented query endpoint. Most accept `since`/`until` (epoch ms) plus endpoint-specific filters.
|
|
46
|
+
|
|
47
|
+
## Result formats (`format`)
|
|
48
|
+
|
|
49
|
+
Every **aggregate** tool in the catalog declares a `format` argument — `full | table | summary`.
|
|
50
|
+
It picks the envelope the rows arrive in and filters nothing (ADR 0051 §2). The collector's
|
|
51
|
+
`preSerialization` hook does the shaping, so the tool definitions stay pure `buildRequest` functions.
|
|
52
|
+
|
|
53
|
+
| `format` | Returns | Use it when |
|
|
54
|
+
| --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------ |
|
|
55
|
+
| `summary` | A bounded digest — `ranked` top rows, a `series` trend, merged spatial `clusters` or a single `record` — with shares, a sample size, the metric's `caveats` and a templated `reading` sentence. | **The default choice when a model will read the result.** |
|
|
56
|
+
| `table` | `{ meta, rows }`: the rows plus metric, range, applied filters, sample size, row count, a truncation flag and the registry's limits. | You need every row _and_ the context to judge how far to trust it. |
|
|
57
|
+
| `full` | The bare rows, unchanged. | You are post-processing the rows yourself. Today's default. |
|
|
58
|
+
|
|
59
|
+
- `summary` is capped at the metric's `limits.maxSummaryRows`, which is what makes a heatmap, voxel
|
|
60
|
+
cloud or long leaderboard safe to hand a model at all. This matters most for the **local** backend:
|
|
61
|
+
a 4-bit 7–8B model's whole context can be filled by one `full` heatmap.
|
|
62
|
+
- `reading` and `caveats` are templated from the registry's column semantics by pure code — no model
|
|
63
|
+
— so identical rows always produce identical words. Quote them rather than re-deriving them.
|
|
64
|
+
- Shares appear only where the measure can honestly be summed; an FPS or ratio metric reports
|
|
65
|
+
`total: null` and no shares. Cluster coordinates are grid indices — multiply by the effective
|
|
66
|
+
`cellSize` for world space.
|
|
67
|
+
- `session_meta` and `scene_representation` are single stored records, not aggregations, and declare
|
|
68
|
+
no `format`.
|
|
69
|
+
- `full` remains the generated catalog's default so that existing consumers (the dashboard) are
|
|
70
|
+
unaffected. Pass `format: "summary"` explicitly from an agent path; the default flip is a separate,
|
|
71
|
+
documented change.
|
|
72
|
+
|
|
20
73
|
## Rules for agents
|
|
21
74
|
|
|
22
75
|
- **Read-only and privacy-preserving.** Never add ingestion, mutation, or raw per-session event
|
|
23
76
|
tools. The surface is aggregate-only; no data leaves the consumer's infrastructure (ADR 0003 /
|
|
24
|
-
ADR 0017). A new tool = a new entry in `
|
|
25
|
-
aggregation/business logic (that lives
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
77
|
+
ADR 0017). A new tool = a new **metric registry entry** in `@uptimizr/metrics` for a documented query
|
|
78
|
+
endpoint — never a hand-written catalog entry here — and no aggregation/business logic (that lives
|
|
79
|
+
in the collector, ADR 0005).
|
|
80
|
+
- **Browser-safe.** No Node dependencies, no `types: ["node"]`. At runtime this package uses `zod`
|
|
81
|
+
plus the pure, data-only `@uptimizr/metrics` package — **never** `@uptimizr/db`, which owns the
|
|
82
|
+
DuckDB store and its ~37 MB native binding. `src/__tests__/browserSafety.test.ts` bundles the
|
|
83
|
+
package for the browser and fails if that changes, and `src/__tests__/dependencies.test.ts` fails
|
|
84
|
+
if `@uptimizr/db` (or anything else with a native/optional binary dependency) reappears in the
|
|
85
|
+
manifest. Anything that needs `process.env`, stdio, or the filesystem belongs in a consumer
|
|
86
|
+
package (e.g. `@uptimizr/mcp`), not here.
|
|
29
87
|
- Tool definitions are pure (`buildRequest`) and must stay unit-testable without a live collector.
|
|
88
|
+
- The 20 tool names (and argument schemas) that shipped before the registry are a public contract:
|
|
89
|
+
`src/__tests__/shippedToolCompat.test.ts` pins them against a frozen fixture. Widening a tool with
|
|
90
|
+
a new **optional** argument is fine; renaming one or making an argument required is not.
|
|
30
91
|
- Keep provider adapters thin and out of this package: implement `LlmProvider` in the consumer.
|
|
31
92
|
|
|
32
93
|
## Programmatic API
|
|
33
94
|
|
|
34
|
-
`readTools`, `
|
|
35
|
-
`
|
|
95
|
+
`readTools`, `coreReadTools`, `selectReadTools(kind)`, `filterReadTools(names)`,
|
|
96
|
+
`registryToTools(metrics?)`, `createCollectorClient(config)`, `toToolSchemas(tools?)`,
|
|
97
|
+
`runAgent(options)`, plus the `LlmProvider` / `AgentMessage` / `AgentToolCall` /
|
|
98
|
+
`ProviderResponse` types.
|
|
99
|
+
|
|
100
|
+
The catalog is ~69 tools. A small local model cannot hold every schema in its function-calling
|
|
101
|
+
prompt — hand a run `coreReadTools` or `filterReadTools([...])` rather than the full catalog.
|
|
36
102
|
|
|
37
103
|
## More
|
|
38
104
|
|
package/README.md
CHANGED
|
@@ -61,23 +61,71 @@ console.log(result.content); // the model's final answer
|
|
|
61
61
|
|
|
62
62
|
## Tool catalog (read-only)
|
|
63
63
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
`
|
|
67
|
-
`
|
|
68
|
-
|
|
69
|
-
`
|
|
70
|
-
|
|
64
|
+
<!-- generated:registry-tool-names:start — generated by `pnpm gen:docs`; edit the metric registry, not this table -->
|
|
65
|
+
|
|
66
|
+
`list_sessions`, `session_meta`, `scene_representation`, `list_scenes`, `timeseries`,
|
|
67
|
+
`event_counts`, `pointer_heatmap`, `mesh_uv_heatmap`, `world_heatmap`, `world_heatmap_stats`,
|
|
68
|
+
`gaze_heatmap`, `gaze_heatmap_stats`, `camera_heatmap`, `view_coverage_histogram`,
|
|
69
|
+
`position_heatmap`, `session_trajectory`, `aggregate_paths`, `scene_coverage`, `camera_distance`,
|
|
70
|
+
`click_rays`, `flow_links`, `top_meshes`, `mesh_sources`, `mesh_trend`, `mesh_dwell`,
|
|
71
|
+
`mesh_blind_spots`, `mesh_interaction_kinds`, `mesh_reachability`, `dead_clicks`, `rage_clicks`,
|
|
72
|
+
`hover_dwell`, `interaction_sources`, `top_input_actions`, `camera_gestures`, `navigation_stats`,
|
|
73
|
+
`backtrack_ratio`, `perf_summary`, `render_scale_truth`, `perf_distribution`, `fps_histogram`,
|
|
74
|
+
`frame_time_percentiles`, `jank_rate`, `perf_churn`, `perf_by_device`, `perf_by_scene`,
|
|
75
|
+
`perf_heatmap`, `compile_stalls`, `resource_summary`, `resource_percentiles`, `stability_counts`,
|
|
76
|
+
`graphics_diagnostics`, `error_heatmap`, `rendering_technology`, `capability_changes`,
|
|
77
|
+
`xr_rotation`, `xr_sources`, `xr_abandonment`, `xr_locomotion`, `xr_tracking_quality`,
|
|
78
|
+
`boundary_heatmap`, `boundary_heatmap_stats`, `xr_boundary_contacts`,
|
|
79
|
+
`ar_placement_time_to_place`, `ar_placement_attempts`, `ar_placement_surfaces`, `funnel`,
|
|
80
|
+
`scene_retention`, `load_bounce_funnel`, `variant_leaderboard`
|
|
81
|
+
|
|
82
|
+
<!-- generated:registry-tool-names:end -->
|
|
83
|
+
|
|
84
|
+
`readTools` is **generated** from the semantic metric registry in `@uptimizr/metrics`
|
|
85
|
+
([ADR 0051](https://github.com/RaananW/Uptimizr/blob/main/docs/adr/0051-ai-first-analytics-layer.md) §1):
|
|
86
|
+
one tool per metric the collector serves on a read endpoint — **69** today, covering sessions and
|
|
87
|
+
scenes, pointer/world/gaze/camera heatmaps, mesh attention and blind spots, dead and rage clicks,
|
|
88
|
+
navigation and desire lines, performance (FPS distribution, jank, compile stalls, per-device and
|
|
89
|
+
per-scene), errors and stability, XR/AR comfort and placement, and conversion (funnel, scene
|
|
90
|
+
retention, load→bounce, variant leaderboard). The full table is in the
|
|
91
|
+
[MCP guide](https://uptimizr.com/docs/guides/mcp/), and each tool maps one-to-one to a documented
|
|
92
|
+
collector query endpoint (see the
|
|
93
|
+
[integration guide](https://github.com/RaananW/Uptimizr/blob/main/docs/integration.md)).
|
|
94
|
+
|
|
95
|
+
Each tool carries:
|
|
96
|
+
|
|
97
|
+
- a **name** that is the registry metric id (the 20 names shipped before the registry are
|
|
98
|
+
unchanged, and so are their argument schemas — a frozen-fixture test pins that);
|
|
99
|
+
- a **description** composed from the metric's description, how to read the result, and its
|
|
100
|
+
caveats (sample-size limits, which capture channel must be on);
|
|
101
|
+
- an **input schema** built from the endpoint's filters — most accept `since`/`until` (epoch ms)
|
|
102
|
+
plus `scene`, `session`, `source`, `bins`, `cellSize`, `limit`, `cameraMode`, `region`, …;
|
|
103
|
+
- an **output schema** (`{ rows: Row[] }`) derived from the metric's row schema, which
|
|
104
|
+
`@uptimizr/mcp` registers as the MCP `outputSchema`.
|
|
105
|
+
|
|
106
|
+
The registry lives in `@uptimizr/metrics`, a dependency-free package (`zod` +
|
|
107
|
+
`@uptimizr/schema`), so installing this one never downloads a database driver: `@uptimizr/db` and
|
|
108
|
+
its ~37 MB native DuckDB binding are **not** a dependency. Two tests keep that true — a bundle test
|
|
109
|
+
asserts no `node:` built-in or DuckDB driver can reach a browser build, and a manifest test fails
|
|
110
|
+
if any package with a native or optional binary dependency reappears.
|
|
71
111
|
|
|
72
112
|
## API
|
|
73
113
|
|
|
74
|
-
| Export | Purpose
|
|
75
|
-
| ------------------------------ |
|
|
76
|
-
| `readTools` | The read-only tool catalog (one entry per query endpoint).
|
|
77
|
-
| `
|
|
78
|
-
| `
|
|
79
|
-
| `
|
|
80
|
-
| `
|
|
114
|
+
| Export | Purpose |
|
|
115
|
+
| ------------------------------ | -------------------------------------------------------------------- |
|
|
116
|
+
| `readTools` | The read-only tool catalog (one entry per query endpoint). |
|
|
117
|
+
| `coreReadTools` | Focused subset for small local models (a filtered view, not a copy). |
|
|
118
|
+
| `selectReadTools(kind)` | Pick `"core"` or `"full"`. |
|
|
119
|
+
| `filterReadTools(names)` | Narrow the catalog to specific tool names, in catalog order. |
|
|
120
|
+
| `registryToTools(metrics?)` | Generate the catalog from metric-registry definitions. |
|
|
121
|
+
| `createCollectorClient(cfg)` | Thin `GET`-only collector client (`fetch`-based, injectable). |
|
|
122
|
+
| `toToolSchemas(tools?)` | Convert catalog tools to JSON-Schema tool descriptors for an LLM. |
|
|
123
|
+
| `runAgent(options)` | The headless tool-calling loop. |
|
|
124
|
+
| `LlmProvider` / `AgentMessage` | The provider-adapter interface and message types. |
|
|
125
|
+
|
|
126
|
+
A 69-tool catalog is more than a small local model can hold in its function-calling prompt — use
|
|
127
|
+
`coreReadTools` (what the `@uptimizr/react` assistant sends the WebLLM backend) or
|
|
128
|
+
`filterReadTools([...])` to hand a run a deliberate subset.
|
|
81
129
|
|
|
82
130
|
The loop stops when the provider returns a final answer or after `maxSteps` turns
|
|
83
131
|
(`DEFAULT_MAX_STEPS`, default 8). Unknown tools and invalid arguments are surfaced back to the model
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { createCollectorClient, CollectorError, type CollectorClient, type CollectorClientConfig, type QueryParams, } from "./client.js";
|
|
2
|
-
export { readTools, coreReadTools, selectReadTools, CORE_READ_TOOL_NAMES, type ReadTool, type ReadToolRequest, type ReadToolSetKind, } from "./tools.js";
|
|
2
|
+
export { readTools, coreReadTools, selectReadTools, filterReadTools, CORE_READ_TOOL_NAMES, type ReadTool, type ReadToolRequest, type ReadToolSetKind, } from "./tools.js";
|
|
3
|
+
export { registryToTools, metricToTool, describeMetric } from "./registryTools.js";
|
|
3
4
|
export type { AgentMessage, AgentToolCall, AgentToolSchema, LlmProvider, ProviderRequest, ProviderResponse, } from "./provider.js";
|
|
4
5
|
export { runAgent, toToolSchemas, truncateToolResult, DEFAULT_MAX_STEPS, DEFAULT_MAX_TOOL_RESULT_CHARS, type AgentStreamEvent, type RunAgentOptions, type RunAgentResult, } from "./loop.js";
|
|
5
6
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,cAAc,EACd,KAAK,eAAe,EACpB,KAAK,qBAAqB,EAC1B,KAAK,WAAW,GACjB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,SAAS,EACT,aAAa,EACb,eAAe,EACf,oBAAoB,EACpB,KAAK,QAAQ,EACb,KAAK,eAAe,EACpB,KAAK,eAAe,GACrB,MAAM,YAAY,CAAC;AACpB,YAAY,EACV,YAAY,EACZ,aAAa,EACb,eAAe,EACf,WAAW,EACX,eAAe,EACf,gBAAgB,GACjB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,QAAQ,EACR,aAAa,EACb,kBAAkB,EAClB,iBAAiB,EACjB,6BAA6B,EAC7B,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,cAAc,GACpB,MAAM,WAAW,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,cAAc,EACd,KAAK,eAAe,EACpB,KAAK,qBAAqB,EAC1B,KAAK,WAAW,GACjB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,SAAS,EACT,aAAa,EACb,eAAe,EACf,eAAe,EACf,oBAAoB,EACpB,KAAK,QAAQ,EACb,KAAK,eAAe,EACpB,KAAK,eAAe,GACrB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACnF,YAAY,EACV,YAAY,EACZ,aAAa,EACb,eAAe,EACf,WAAW,EACX,eAAe,EACf,gBAAgB,GACjB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,QAAQ,EACR,aAAa,EACb,kBAAkB,EAClB,iBAAiB,EACjB,6BAA6B,EAC7B,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,cAAc,GACpB,MAAM,WAAW,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { createCollectorClient, CollectorError, } from "./client.js";
|
|
2
|
-
export { readTools, coreReadTools, selectReadTools, CORE_READ_TOOL_NAMES, } from "./tools.js";
|
|
2
|
+
export { readTools, coreReadTools, selectReadTools, filterReadTools, CORE_READ_TOOL_NAMES, } from "./tools.js";
|
|
3
|
+
export { registryToTools, metricToTool, describeMetric } from "./registryTools.js";
|
|
3
4
|
export { runAgent, toToolSchemas, truncateToolResult, DEFAULT_MAX_STEPS, DEFAULT_MAX_TOOL_RESULT_CHARS, } from "./loop.js";
|
|
4
5
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,cAAc,GAIf,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,SAAS,EACT,aAAa,EACb,eAAe,EACf,oBAAoB,GAIrB,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,cAAc,GAIf,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,SAAS,EACT,aAAa,EACb,eAAe,EACf,eAAe,EACf,oBAAoB,GAIrB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AASnF,OAAO,EACL,QAAQ,EACR,aAAa,EACb,kBAAkB,EAClB,iBAAiB,EACjB,6BAA6B,GAI9B,MAAM,WAAW,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* **Generated tool catalog** (ADR 0051 §1, design sketch §A.2).
|
|
3
|
+
*
|
|
4
|
+
* `registryToTools()` turns the semantic metric registry in `@uptimizr/metrics`
|
|
5
|
+
* into the read-only {@link ReadTool} catalog this package exports. One registry
|
|
6
|
+
* entry with an `endpoint` becomes exactly one tool, so agent coverage of the
|
|
7
|
+
* collector's read surface is mechanical rather than hand-maintained: adding an
|
|
8
|
+
* aggregation + a registry entry adds the tool, and there is no second list to
|
|
9
|
+
* forget.
|
|
10
|
+
*
|
|
11
|
+
* What each part of a tool is derived from:
|
|
12
|
+
*
|
|
13
|
+
* | Tool field | Registry source |
|
|
14
|
+
* | -------------- | ---------------------------------------------------------- |
|
|
15
|
+
* | `name` | `id` (the 20 shipped tool names are registry ids verbatim) |
|
|
16
|
+
* | `title` | `title` |
|
|
17
|
+
* | `description` | `description` + `interpretation` + `caveats` |
|
|
18
|
+
* | `inputSchema` | `filters` + `endpoint.pathParams`, via {@link FILTER_FIELDS} |
|
|
19
|
+
* | `buildRequest` | `endpoint.path` (with `:param` substitution) + `filters` |
|
|
20
|
+
* | `outputSchema` | `row`, wrapped as `{ rows: Row[] }` |
|
|
21
|
+
*
|
|
22
|
+
* **Browser safety (ADR 0050).** This module imports `@uptimizr/metrics` — the
|
|
23
|
+
* registry's own dependency-free package, whose only runtime dependencies are
|
|
24
|
+
* `zod` and `@uptimizr/schema`. This package does not depend on `@uptimizr/db`
|
|
25
|
+
* at all: that package owns the DuckDB store and pulls in a ~37 MB native
|
|
26
|
+
* binding a browser can never use. `src/__tests__/browserSafety.test.ts` bundles
|
|
27
|
+
* this package for the browser and fails if any `node:` built-in or the DuckDB
|
|
28
|
+
* driver reaches the bundle, and `src/__tests__/dependencies.test.ts` fails if
|
|
29
|
+
* `@uptimizr/db` ever reappears in the manifest.
|
|
30
|
+
*/
|
|
31
|
+
import { type MetricDefinition } from "@uptimizr/metrics";
|
|
32
|
+
import type { ReadTool } from "./tools.js";
|
|
33
|
+
/**
|
|
34
|
+
* Compose the agent-facing tool description: what the metric measures, how to
|
|
35
|
+
* read the result, and the caveats that decide how far to trust it. All three
|
|
36
|
+
* come from the registry, so the prose an agent sees and the prose the docs and
|
|
37
|
+
* the capabilities resource show are the same text.
|
|
38
|
+
*/
|
|
39
|
+
export declare function describeMetric(metric: MetricDefinition): string;
|
|
40
|
+
/**
|
|
41
|
+
* Build the {@link ReadTool} for one registry metric. Returns `undefined` for a
|
|
42
|
+
* metric with no collector endpoint (the two daily rollups), which therefore
|
|
43
|
+
* cannot be called by an agent.
|
|
44
|
+
*/
|
|
45
|
+
export declare function metricToTool(metric: MetricDefinition): ReadTool | undefined;
|
|
46
|
+
/**
|
|
47
|
+
* Generate the read-only tool catalog from the metric registry: one tool per
|
|
48
|
+
* registry entry that has a collector endpoint, in registry declaration order.
|
|
49
|
+
*
|
|
50
|
+
* Pure — it reads definitions only and never touches a collector — so the whole
|
|
51
|
+
* catalog is unit-testable without a live server.
|
|
52
|
+
*/
|
|
53
|
+
export declare function registryToTools(metrics?: readonly MetricDefinition[]): readonly ReadTool[];
|
|
54
|
+
//# sourceMappingURL=registryTools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registryTools.d.ts","sourceRoot":"","sources":["../src/registryTools.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAGH,OAAO,EAA6B,KAAK,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAErF,OAAO,KAAK,EAAE,QAAQ,EAAmB,MAAM,YAAY,CAAC;AAkT5D;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,gBAAgB,GAAG,MAAM,CAO/D;AAYD;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,gBAAgB,GAAG,QAAQ,GAAG,SAAS,CA6D3E;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAC7B,OAAO,GAAE,SAAS,gBAAgB,EAAiB,GAClD,SAAS,QAAQ,EAAE,CAOrB"}
|