@you-agent-factory/factory-visualizers 0.0.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/LICENSE.md +21 -0
- package/README.md +106 -0
- package/examples/support-playback.factory-recording.v1.json +88 -0
- package/package.json +80 -0
package/LICENSE.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026-2026 Andreas Abdi
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
# `@you-agent-factory/factory-visualizers`
|
|
2
|
+
|
|
3
|
+
Controlled React components for rendering caller-prepared Factory replay
|
|
4
|
+
projections. The package exports `FactoryTopologyReplay`,
|
|
5
|
+
`FactoryRecordingTopologyReplay`, `FactoryTimelineScrubber`, and
|
|
6
|
+
`WorkProgressVisualizer`, and `FactoryEmulatorControls` together with their
|
|
7
|
+
message, formatting, status, callback, and structured error contracts.
|
|
8
|
+
|
|
9
|
+
See the [public package family guide](https://github.com/portpowered/you-agent-factory/blob/main/ui/packages/README.md)
|
|
10
|
+
for clean-install commands, static and interactive package examples, dependency
|
|
11
|
+
direction, and the precise hosted-runtime versus emulator support boundary.
|
|
12
|
+
|
|
13
|
+
`FactoryTopologyReplay` accepts a presentation-only `chrome` configuration.
|
|
14
|
+
Choose the `full`, `minimal`, or `none` preset, then override `legend`,
|
|
15
|
+
`background`, `viewportControls`, or `visibilityControls` individually. The
|
|
16
|
+
resolver starts from the selected preset and applies supplied overrides without
|
|
17
|
+
changing the caller-provided topology, activity, or Work-progress projection.
|
|
18
|
+
|
|
19
|
+
`FactoryEmulatorControls` composes the lower-level controlled playback toolbar
|
|
20
|
+
with `FactoryTimelineScrubber`. Hosts provide the current/history selection and
|
|
21
|
+
all callbacks. Selecting an earlier tick requests pause before selection; Play
|
|
22
|
+
and Step request follow-latest before their host command in history mode. It
|
|
23
|
+
never creates a timer, mutates replay data, or owns emulator state.
|
|
24
|
+
|
|
25
|
+
Hosts that autoplay should honor `prefers-reduced-motion` by starting paused and
|
|
26
|
+
stopping playback when that preference changes. Explicit Play, Step, submission,
|
|
27
|
+
and Restart actions can remain available. Manual Pause and historical timeline
|
|
28
|
+
selection stay authoritative until the user explicitly resumes playback or
|
|
29
|
+
returns to the current Factory.
|
|
30
|
+
|
|
31
|
+
`FactoryEmulatorView` vertically composes host-supplied controls, topology,
|
|
32
|
+
Work progress, and an optional submission region. Its `full` preset shows every
|
|
33
|
+
region; `compact` omits speed and submission; `display-only` renders topology
|
|
34
|
+
only. Pass `visibility` to override any individual playback, timeline, speed,
|
|
35
|
+
runtime-status, progress, or submission region. Hidden regions are not rendered.
|
|
36
|
+
|
|
37
|
+
Both emulator exports accept `onError` for sanitized structured render or
|
|
38
|
+
composition diagnostics and an optional `failure` for a safe host-provided
|
|
39
|
+
local failure message. A failure may include `recoveryAction` with a host-owned
|
|
40
|
+
callback; the visualizers render that action but never assume a retry,
|
|
41
|
+
transport, timer, or global error-state implementation.
|
|
42
|
+
|
|
43
|
+
The host always owns transport, persistence, and canonical Factory data. It can
|
|
44
|
+
either prepare controlled projections with `@you-agent-factory/factory-replay`
|
|
45
|
+
or pass an unknown recording directly to `FactoryRecordingTopologyReplay`,
|
|
46
|
+
which validates it through `@you-agent-factory/client` before deriving the
|
|
47
|
+
selected-tick projections. Import the package styles once:
|
|
48
|
+
|
|
49
|
+
```tsx
|
|
50
|
+
import {
|
|
51
|
+
FactoryTopologyReplay,
|
|
52
|
+
type FactoryTopologyReplayProps,
|
|
53
|
+
} from "@you-agent-factory/factory-visualizers";
|
|
54
|
+
import "@you-agent-factory/components/styles.css";
|
|
55
|
+
import "@you-agent-factory/factory-visualizers/styles.css";
|
|
56
|
+
|
|
57
|
+
export function Topology(props: FactoryTopologyReplayProps) {
|
|
58
|
+
return <FactoryTopologyReplay {...props} />;
|
|
59
|
+
}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
The package also ships a validated recording that can be imported through the
|
|
63
|
+
intentional example export:
|
|
64
|
+
|
|
65
|
+
```tsx
|
|
66
|
+
import supportPlayback from "@you-agent-factory/factory-visualizers/examples/support-playback.factory-recording.v1.json";
|
|
67
|
+
|
|
68
|
+
<FactoryRecordingTopologyReplay
|
|
69
|
+
defaultSelectedTick={1}
|
|
70
|
+
messages={messages}
|
|
71
|
+
recording={supportPlayback}
|
|
72
|
+
/>;
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
`FactoryRecordingTopologyReplay` reports invalid input as one sanitized
|
|
76
|
+
`recording-validation` diagnostic and renders the same accessible failed
|
|
77
|
+
presentation as the controlled topology component. It does not require a
|
|
78
|
+
router, data provider, store, browser persistence, network request, or backend.
|
|
79
|
+
Asynchronous hosts can pass a controlled `state` with `loading`, `ready`, or
|
|
80
|
+
`failed` status; a controlled state takes precedence over the direct `recording`
|
|
81
|
+
shorthand. Controlled failures report their structured visualizer diagnostic
|
|
82
|
+
once while keeping diagnostic details out of the localized presentation.
|
|
83
|
+
|
|
84
|
+
A validated recording whose selected projection has no topology nodes renders
|
|
85
|
+
the shared empty presentation. Loading, empty, validation failure, and
|
|
86
|
+
projection failure therefore remain distinct from a successfully rendered
|
|
87
|
+
closed local recording.
|
|
88
|
+
|
|
89
|
+
Recording playback opens in current mode at the latest accepted logical tick.
|
|
90
|
+
Pass a `defaultSelectedTick` that exists in the recording to open a fixed
|
|
91
|
+
historical projection instead. The shared timeline selects only recorded ticks,
|
|
92
|
+
keeps fixed history stable as later evidence arrives, and can return to current
|
|
93
|
+
mode with its follow-latest action. Current mode also incorporates newly
|
|
94
|
+
accepted same-tick events in canonical sequence order.
|
|
95
|
+
|
|
96
|
+
The installed-consumer verification uses the public client parser and public
|
|
97
|
+
replay projection functions before passing the prepared topology to
|
|
98
|
+
`FactoryTopologyReplay`. It imports the client recording fixture and both
|
|
99
|
+
package style entry points only through public package exports.
|
|
100
|
+
|
|
101
|
+
Run `make storybook` in this directory for package-local development. Use
|
|
102
|
+
`make storybook-build` and `make storybook-test` for deterministic static and
|
|
103
|
+
browser verification, or run `bun run verify` to typecheck, lint, and test the
|
|
104
|
+
components, exercise Storybook accessibility and responsive behavior, validate
|
|
105
|
+
the compiled dependency boundary and tarball inventory, and install, build,
|
|
106
|
+
and render the public recording composition in a clean temporary consumer.
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": "factory-recording/v1",
|
|
3
|
+
"id": "support-playback-example",
|
|
4
|
+
"title": "Support playback topology",
|
|
5
|
+
"summary": "A backend-free recording with current and historical projections.",
|
|
6
|
+
"factory": {
|
|
7
|
+
"name": "support-playback",
|
|
8
|
+
"workers": [{ "name": "support-agent" }],
|
|
9
|
+
"workTypes": [
|
|
10
|
+
{
|
|
11
|
+
"name": "support-request",
|
|
12
|
+
"states": [
|
|
13
|
+
{ "name": "queued", "type": "INITIAL" },
|
|
14
|
+
{ "name": "resolved", "type": "TERMINAL" }
|
|
15
|
+
]
|
|
16
|
+
}
|
|
17
|
+
],
|
|
18
|
+
"workstations": [
|
|
19
|
+
{
|
|
20
|
+
"name": "triage",
|
|
21
|
+
"worker": "support-agent",
|
|
22
|
+
"inputs": [{ "workType": "support-request", "state": "queued" }],
|
|
23
|
+
"outputs": [{ "workType": "support-request", "state": "resolved" }]
|
|
24
|
+
}
|
|
25
|
+
]
|
|
26
|
+
},
|
|
27
|
+
"events": [
|
|
28
|
+
{
|
|
29
|
+
"schemaVersion": "agent-factory.event.v1",
|
|
30
|
+
"id": "support-topology",
|
|
31
|
+
"type": "INITIAL_STRUCTURE_REQUEST",
|
|
32
|
+
"context": {
|
|
33
|
+
"sequence": 1,
|
|
34
|
+
"tick": 1,
|
|
35
|
+
"eventTime": "2026-07-18T20:00:01Z",
|
|
36
|
+
"sessionId": "support-playback-session",
|
|
37
|
+
"sessionSequence": 1
|
|
38
|
+
},
|
|
39
|
+
"payload": {
|
|
40
|
+
"factory": {
|
|
41
|
+
"name": "support-playback",
|
|
42
|
+
"workers": [{ "name": "support-agent" }],
|
|
43
|
+
"workTypes": [
|
|
44
|
+
{
|
|
45
|
+
"name": "support-request",
|
|
46
|
+
"states": [
|
|
47
|
+
{ "name": "queued", "type": "INITIAL" },
|
|
48
|
+
{ "name": "resolved", "type": "TERMINAL" }
|
|
49
|
+
]
|
|
50
|
+
}
|
|
51
|
+
],
|
|
52
|
+
"workstations": [
|
|
53
|
+
{
|
|
54
|
+
"name": "triage",
|
|
55
|
+
"worker": "support-agent",
|
|
56
|
+
"inputs": [{ "workType": "support-request", "state": "queued" }],
|
|
57
|
+
"outputs": [
|
|
58
|
+
{ "workType": "support-request", "state": "resolved" }
|
|
59
|
+
]
|
|
60
|
+
}
|
|
61
|
+
]
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"schemaVersion": "agent-factory.event.v1",
|
|
67
|
+
"id": "support-work",
|
|
68
|
+
"type": "WORK_REQUEST",
|
|
69
|
+
"context": {
|
|
70
|
+
"sequence": 2,
|
|
71
|
+
"tick": 2,
|
|
72
|
+
"eventTime": "2026-07-18T20:00:02Z",
|
|
73
|
+
"sessionId": "support-playback-session",
|
|
74
|
+
"sessionSequence": 2
|
|
75
|
+
},
|
|
76
|
+
"payload": {
|
|
77
|
+
"type": "FACTORY_REQUEST_BATCH",
|
|
78
|
+
"works": [
|
|
79
|
+
{
|
|
80
|
+
"name": "Support request 1",
|
|
81
|
+
"workId": "support-1",
|
|
82
|
+
"workTypeName": "support-request"
|
|
83
|
+
}
|
|
84
|
+
]
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
]
|
|
88
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@you-agent-factory/factory-visualizers",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"description": "Controlled React visualizers for caller-prepared Factory replay projections.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/portpowered/you-agent-factory.git",
|
|
9
|
+
"directory": "ui/packages/factory-visualizers"
|
|
10
|
+
},
|
|
11
|
+
"publishConfig": {
|
|
12
|
+
"access": "public"
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist",
|
|
16
|
+
"examples",
|
|
17
|
+
"LICENSE.md",
|
|
18
|
+
"README.md"
|
|
19
|
+
],
|
|
20
|
+
"type": "module",
|
|
21
|
+
"sideEffects": [
|
|
22
|
+
"*.css",
|
|
23
|
+
"**/*.css"
|
|
24
|
+
],
|
|
25
|
+
"exports": {
|
|
26
|
+
".": {
|
|
27
|
+
"types": "./dist/index.d.ts",
|
|
28
|
+
"import": "./dist/index.js",
|
|
29
|
+
"default": "./dist/index.js"
|
|
30
|
+
},
|
|
31
|
+
"./styles.css": "./dist/styles.css",
|
|
32
|
+
"./examples/support-playback.factory-recording.v1.json": "./examples/support-playback.factory-recording.v1.json"
|
|
33
|
+
},
|
|
34
|
+
"scripts": {
|
|
35
|
+
"build": "node scripts/build-package.mjs",
|
|
36
|
+
"build-storybook": "storybook build --loglevel warn",
|
|
37
|
+
"check:installed-consumer": "node scripts/verify-installed-consumer.mjs",
|
|
38
|
+
"check:pack": "node scripts/verify-package-pack.mjs",
|
|
39
|
+
"check:package-boundary": "node scripts/check-package-boundary.mjs",
|
|
40
|
+
"lint": "biome check .",
|
|
41
|
+
"prepare:dependencies": "bun run --cwd ../client build && bun run --cwd ../components build && bun run --cwd ../factory-replay build",
|
|
42
|
+
"storybook": "storybook dev -p 6027",
|
|
43
|
+
"test": "vitest run --config vitest.config.ts",
|
|
44
|
+
"test-storybook": "bun run build-storybook && bun run verify:accessibility-responsive",
|
|
45
|
+
"typecheck": "bun run prepare:dependencies && tsc -p tsconfig.json --noEmit --pretty false",
|
|
46
|
+
"verify:accessibility-responsive": "node scripts/verify-accessibility-responsive.mjs",
|
|
47
|
+
"verify": "bun run typecheck && bun run lint && bun run test && bun run build && bun run test-storybook && bun run check:package-boundary && bun run check:pack && bun run check:installed-consumer"
|
|
48
|
+
},
|
|
49
|
+
"dependencies": {
|
|
50
|
+
"@you-agent-factory/components": "0.0.0",
|
|
51
|
+
"@xyflow/react": "^12.10.2"
|
|
52
|
+
},
|
|
53
|
+
"peerDependencies": {
|
|
54
|
+
"@you-agent-factory/client": "0.0.0",
|
|
55
|
+
"@you-agent-factory/factory-replay": "0.0.0",
|
|
56
|
+
"react": "^19.0.0",
|
|
57
|
+
"react-dom": "^19.0.0"
|
|
58
|
+
},
|
|
59
|
+
"devDependencies": {
|
|
60
|
+
"@biomejs/biome": "^2.5.4",
|
|
61
|
+
"@storybook/react-vite": "^10.3.5",
|
|
62
|
+
"@testing-library/jest-dom": "^6.9.1",
|
|
63
|
+
"@testing-library/react": "^16.3.0",
|
|
64
|
+
"@testing-library/user-event": "^14.6.1",
|
|
65
|
+
"@types/react": "^19.2.2",
|
|
66
|
+
"@types/react-dom": "^19.2.2",
|
|
67
|
+
"@vitejs/plugin-react-swc": "^4.1.0",
|
|
68
|
+
"@you-agent-factory/client": "file:../client",
|
|
69
|
+
"@you-agent-factory/factory-replay": "file:../factory-replay",
|
|
70
|
+
"axe-core": "^4.10.2",
|
|
71
|
+
"happy-dom": "^20.9.0",
|
|
72
|
+
"jest-axe": "^10.0.0",
|
|
73
|
+
"react": "^19.0.0",
|
|
74
|
+
"react-dom": "^19.0.0",
|
|
75
|
+
"storybook": "^10.3.5",
|
|
76
|
+
"typescript": "~5.9.3",
|
|
77
|
+
"vite": "^7.1.7",
|
|
78
|
+
"vitest": "4.1.3"
|
|
79
|
+
}
|
|
80
|
+
}
|