@abstractframework/monitor-flow 0.1.0 → 0.1.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/README.md +10 -6
- package/dist/AgentCyclesPanel.d.ts.map +1 -1
- package/dist/AgentCyclesPanel.js +7 -3
- package/package.json +3 -1
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# @
|
|
1
|
+
# @abstractframework/monitor-flow
|
|
2
2
|
|
|
3
3
|
React components to inspect **agent execution cycles** (think → act → observe) from per-effect trace records.
|
|
4
4
|
|
|
@@ -18,8 +18,8 @@ Declared in `monitor-flow/package.json`:
|
|
|
18
18
|
|
|
19
19
|
## Install
|
|
20
20
|
|
|
21
|
-
- Workspace: add a dependency on `@
|
|
22
|
-
- npm (once published): `npm i @
|
|
21
|
+
- Workspace: add a dependency on `@abstractframework/monitor-flow`
|
|
22
|
+
- npm (once published): `npm i @abstractframework/monitor-flow`
|
|
23
23
|
|
|
24
24
|
## Expected data
|
|
25
25
|
|
|
@@ -43,7 +43,7 @@ Cycles start whenever `step.effect.type === "llm_call"` (see the cycle builder i
|
|
|
43
43
|
If you already have `TraceItem[]`, pass it directly:
|
|
44
44
|
|
|
45
45
|
```tsx
|
|
46
|
-
import { AgentCyclesPanel } from "@
|
|
46
|
+
import { AgentCyclesPanel } from "@abstractframework/monitor-flow";
|
|
47
47
|
|
|
48
48
|
<AgentCyclesPanel items={items} />;
|
|
49
49
|
```
|
|
@@ -51,7 +51,7 @@ import { AgentCyclesPanel } from "@abstractuic/monitor-flow";
|
|
|
51
51
|
If you have “ledger-like” records, adapt them with `build_agent_trace`:
|
|
52
52
|
|
|
53
53
|
```tsx
|
|
54
|
-
import { AgentCyclesPanel, build_agent_trace } from "@
|
|
54
|
+
import { AgentCyclesPanel, build_agent_trace } from "@abstractframework/monitor-flow";
|
|
55
55
|
|
|
56
56
|
const { items } = build_agent_trace(ledgerItems, { run_id: "run_123" });
|
|
57
57
|
<AgentCyclesPanel items={items} />;
|
|
@@ -59,9 +59,13 @@ const { items } = build_agent_trace(ledgerItems, { run_id: "run_123" });
|
|
|
59
59
|
|
|
60
60
|
## Styling
|
|
61
61
|
|
|
62
|
-
|
|
62
|
+
Import CSS in your app entrypoint (recommended):
|
|
63
|
+
|
|
64
|
+
- `import "@abstractframework/monitor-flow/agent_cycles.css";`
|
|
65
|
+
- `import "@abstractframework/ui-kit/theme.css";` (shared tokens)
|
|
63
66
|
|
|
64
67
|
## Related docs
|
|
65
68
|
|
|
66
69
|
- Getting started: [`docs/getting-started.md`](../docs/getting-started.md)
|
|
70
|
+
- API reference: [`docs/api.md`](../docs/api.md)
|
|
67
71
|
- Architecture: [`docs/architecture.md`](../docs/architecture.md)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgentCyclesPanel.d.ts","sourceRoot":"","sources":["../src/AgentCyclesPanel.tsx"],"names":[],"mappings":"AAEA,OAAO,oBAAoB,CAAC;AAI5B,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAEhD,MAAM,MAAM,SAAS,GAAG;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,SAAS,CAAC;CACjB,CAAC;AA8BF,MAAM,MAAM,qBAAqB,GAAG;IAClC,KAAK,EAAE,SAAS,EAAE,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B,CAAC;
|
|
1
|
+
{"version":3,"file":"AgentCyclesPanel.d.ts","sourceRoot":"","sources":["../src/AgentCyclesPanel.tsx"],"names":[],"mappings":"AAEA,OAAO,oBAAoB,CAAC;AAI5B,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAEhD,MAAM,MAAM,SAAS,GAAG;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,SAAS,CAAC;CACjB,CAAC;AA8BF,MAAM,MAAM,qBAAqB,GAAG;IAClC,KAAK,EAAE,SAAS,EAAE,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B,CAAC;AA6hBF,wBAAgB,gBAAgB,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,iBAAwB,EAAE,EAAE,qBAAqB,GAAG,KAAK,CAAC,YAAY,GAAG,IAAI,CAgKzK"}
|
package/dist/AgentCyclesPanel.js
CHANGED
|
@@ -369,12 +369,13 @@ function trace_step_time_label(item) {
|
|
|
369
369
|
return "";
|
|
370
370
|
}
|
|
371
371
|
}
|
|
372
|
-
function TraceStepCard({ item, label, toolDefs }) {
|
|
372
|
+
function TraceStepCard({ item, label, toolDefs, defaultOpen = false, }) {
|
|
373
373
|
const step = item.step;
|
|
374
374
|
const kind = effect_type_of(step);
|
|
375
375
|
const tabs = tabs_for_step(step);
|
|
376
376
|
const default_tab = default_tab_for_step(step);
|
|
377
377
|
const [tab, set_tab] = useState(default_tab);
|
|
378
|
+
const [is_open, set_is_open] = useState(Boolean(defaultOpen));
|
|
378
379
|
const payload = payload_of(step);
|
|
379
380
|
const res = result_of(step);
|
|
380
381
|
const errs = error_text_of(step);
|
|
@@ -454,7 +455,7 @@ function TraceStepCard({ item, label, toolDefs }) {
|
|
|
454
455
|
const preview = preview_for_step(step);
|
|
455
456
|
const status = effective_status_for_item(item);
|
|
456
457
|
const badge = status === "completed" ? "OK" : status === "failed" ? "ERROR" : status === "waiting" ? "WAITING" : status.toUpperCase();
|
|
457
|
-
return (_jsxs("details", { className: `agent-trace-entry ${status}`, open:
|
|
458
|
+
return (_jsxs("details", { className: `agent-trace-entry ${status}`, open: is_open, onToggle: (e) => set_is_open(e.currentTarget.open), children: [_jsxs("summary", { className: "agent-trace-summary", children: [_jsx("span", { className: `agent-trace-status ${status}`, children: badge }), _jsx("span", { className: "agent-cycle-stage", children: label }), _jsx("span", { className: "agent-trace-kind", children: kind }), time_label ? _jsx("span", { className: "agent-trace-node", children: time_label }) : null, node ? _jsx("span", { className: "agent-trace-node", children: node }) : null, run ? _jsx("span", { className: "agent-trace-run", children: run }) : null] }), preview ? _jsx("div", { className: "agent-trace-preview", children: preview }) : null, _jsxs("div", { className: "agent-trace-body", children: [_jsx("div", { className: "agent-trace-tabs", children: tabs.map((t) => (_jsx("button", { type: "button", className: `agent-trace-tab ${t.id === tab ? "active" : ""}`, onClick: () => set_tab(t.id), children: t.label }, t.id))) }), _jsx(AutoValue, { value: output })] })] }));
|
|
458
459
|
}
|
|
459
460
|
function ObserveCard({ acts }) {
|
|
460
461
|
const all = acts.flatMap((a) => tool_results_for_step(a.step));
|
|
@@ -543,6 +544,9 @@ export function AgentCyclesPanel({ items: items_in, subRunId, title, subtitle, o
|
|
|
543
544
|
const cycle_tool_calls = c.acts.flatMap((a) => tool_calls_for_step(a.step));
|
|
544
545
|
const cycle_tool_sigs = cycle_tool_calls.map((tc) => format_tool_signature(tc.name, tc.args, tool_defs.get(tc.name) || null));
|
|
545
546
|
const open_by_default = defaultOpenLatest && c.index === cycles.length;
|
|
546
|
-
return (_jsxs("details", { className: `agent-cycle ${status_raw}`, open: open_by_default, children: [_jsxs("summary", { className: "agent-cycle-summary", children: [_jsx("span", { className: `agent-trace-status ${status_raw}`, children: status_text }), _jsx("span", { className: "agent-cycle-label", children: "cycle" }), _jsxs("span", { className: "agent-cycle-index", children: ["#", c.index] }), cycle_tool_sigs.length ? (_jsxs("span", { className: "agent-trace-badges", children: [cycle_tool_sigs.slice(0, 3).map((sig) => (_jsx("span", { className: "run-metric-badge metric-tool", title: sig, children: clamp_inline(sig, 62) }, sig))), cycle_tool_sigs.length > 3 ? _jsxs("span", { className: "run-metric-badge metric-tool", children: ["+", cycle_tool_sigs.length - 3] }) : null] })) : null, _jsx("span", { className: "agent-cycle-spacer" }), think_preview ? _jsx("span", { className: "agent-cycle-preview", children: think_preview }) : null] }), _jsxs("div", { className: "agent-cycle-body", children: [c.think ? _jsx(TraceStepCard, { item: c.think, label: "think", toolDefs: tool_defs }) : null, c.acts.map((a) => (_jsx(TraceStepCard, { item: a, label: "act", toolDefs: tool_defs }, a.id))), _jsx(ObserveCard, { acts: c.acts }), c.others.length ? (_jsxs("div", { className: "agent-cycle-others", children: [_jsx("div", { className: "agent-cycle-others-title", children: "other" }), c.others.map((o) =>
|
|
547
|
+
return (_jsxs("details", { className: `agent-cycle ${status_raw}`, open: open_by_default, children: [_jsxs("summary", { className: "agent-cycle-summary", children: [_jsx("span", { className: `agent-trace-status ${status_raw}`, children: status_text }), _jsx("span", { className: "agent-cycle-label", children: "cycle" }), _jsxs("span", { className: "agent-cycle-index", children: ["#", c.index] }), cycle_tool_sigs.length ? (_jsxs("span", { className: "agent-trace-badges", children: [cycle_tool_sigs.slice(0, 3).map((sig) => (_jsx("span", { className: "run-metric-badge metric-tool", title: sig, children: clamp_inline(sig, 62) }, sig))), cycle_tool_sigs.length > 3 ? _jsxs("span", { className: "run-metric-badge metric-tool", children: ["+", cycle_tool_sigs.length - 3] }) : null] })) : null, _jsx("span", { className: "agent-cycle-spacer" }), think_preview ? _jsx("span", { className: "agent-cycle-preview", children: think_preview }) : null] }), _jsxs("div", { className: "agent-cycle-body", children: [c.think ? _jsx(TraceStepCard, { item: c.think, label: "think", toolDefs: tool_defs, defaultOpen: open_by_default }) : null, c.acts.map((a) => (_jsx(TraceStepCard, { item: a, label: "act", toolDefs: tool_defs }, a.id))), _jsx(ObserveCard, { acts: c.acts }), c.others.length ? (_jsxs("div", { className: "agent-cycle-others", children: [_jsx("div", { className: "agent-cycle-others-title", children: "other" }), c.others.map((o) => {
|
|
548
|
+
const open_other_by_default = open_by_default && effect_type_of(o.step) === "answer_user";
|
|
549
|
+
return _jsx(TraceStepCard, { item: o, label: "other", toolDefs: tool_defs, defaultOpen: open_other_by_default }, o.id);
|
|
550
|
+
})] })) : null] })] }, c.id));
|
|
547
551
|
})] }))] }));
|
|
548
552
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abstractframework/monitor-flow",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "Shared flow/agent monitoring UI components for AbstractFramework (used by AbstractFlow and AbstractObserver).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": "Laurent-Philippe Albou",
|
|
@@ -45,6 +45,8 @@
|
|
|
45
45
|
"react-dom": "^18.0.0"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
+
"react": "^18.0.0",
|
|
49
|
+
"react-dom": "^18.0.0",
|
|
48
50
|
"@types/react": "^18.2.48",
|
|
49
51
|
"@types/react-dom": "^18.2.18",
|
|
50
52
|
"typescript": "^5.3.3"
|