@jay-framework/runtime-automation 0.13.0 → 0.14.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.
Files changed (2) hide show
  1. package/package.json +5 -5
  2. package/readme.md +35 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jay-framework/runtime-automation",
3
- "version": "0.13.0",
3
+ "version": "0.14.0",
4
4
  "type": "module",
5
5
  "license": "Apache-2.0",
6
6
  "description": "Automation API for Jay components - enables programmatic state inspection and interaction triggering",
@@ -21,12 +21,12 @@
21
21
  "test:watch": "vitest"
22
22
  },
23
23
  "dependencies": {
24
- "@jay-framework/runtime": "^0.13.0",
25
- "@jay-framework/view-state-merge": "^0.13.0"
24
+ "@jay-framework/runtime": "^0.14.0",
25
+ "@jay-framework/view-state-merge": "^0.14.0"
26
26
  },
27
27
  "devDependencies": {
28
- "@jay-framework/component": "^0.13.0",
29
- "@jay-framework/dev-environment": "^0.13.0",
28
+ "@jay-framework/component": "^0.14.0",
29
+ "@jay-framework/dev-environment": "^0.14.0",
30
30
  "@types/node": "^20.11.5",
31
31
  "rimraf": "^5.0.5",
32
32
  "tsup": "^8.0.1",
package/readme.md CHANGED
@@ -69,6 +69,41 @@ Wraps a Jay component with automation capabilities.
69
69
  - `onComponentEvent(name, callback)` - Subscribe to a custom component event
70
70
  - `dispose()` - Clean up listeners
71
71
 
72
+ ## Jay-Stack Integration
73
+
74
+ In jay-stack dev mode, the generated client script automatically wraps the page component with automation and exposes it on `window.__jay.automation`. A `jay:automation-ready` event is dispatched on `window` immediately after the automation instance is set.
75
+
76
+ ### Accessing automation from plugins
77
+
78
+ Plugin client inits run **before** the page component is created, so `window.__jay.automation` is not yet available during init. Listen for the ready event:
79
+
80
+ ```typescript
81
+ // In a plugin's client init
82
+ const automation = (window as any).__jay?.automation;
83
+ if (automation) {
84
+ // Already available
85
+ setup(automation);
86
+ } else {
87
+ window.addEventListener(
88
+ 'jay:automation-ready',
89
+ () => {
90
+ setup((window as any).__jay.automation);
91
+ },
92
+ { once: true },
93
+ );
94
+ }
95
+ ```
96
+
97
+ ### Accessing automation from interactive components
98
+
99
+ Component interactive phases run after the page is mounted and automation is set. Access it directly:
100
+
101
+ ```typescript
102
+ const automation: AutomationAPI | null = (window as any).__jay?.automation || null;
103
+ ```
104
+
105
+ If the component may initialize before automation is ready (e.g. in a plugin), use the event pattern above.
106
+
72
107
  ## Design
73
108
 
74
109
  See [Design Log #76 - AI Agent Integration](../../../design-log/76%20-%20AI%20Agent%20Integration.md) for full design documentation.