assistsx-js 0.2.3 → 0.2.4

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 CHANGED
@@ -69,15 +69,20 @@
69
69
  }
70
70
  ```
71
71
  ## 3. 编写脚本插件
72
- 写一个最简单的,点击微信搜索进入搜索页面
73
- ```agsl
72
+
73
+ 简单点击(同步 API):
74
+
75
+ ```typescript
76
+ import { AssistsX } from "assistsx-js";
77
+
74
78
  const handleClick = () => {
75
- AssistsX.findById("com.tencent.mm:id/jha")[0].click()
76
- }
79
+ AssistsX.findById("com.tencent.mm:id/jha")[0]?.click();
80
+ };
77
81
  ```
78
82
 
79
- 增加一个测试按钮调用这个方法
80
- ```agsl
83
+ 多步骤自动化(推荐)见 [step-basics.md](./docs/02-step-engine/step-basics.md)。
84
+
85
+ ```vue
81
86
  <button type="button" @click="handleClick">测试按钮</button>
82
87
  ```
83
88
 
@@ -108,53 +113,11 @@ export default defineConfig({
108
113
  <br/>
109
114
 
110
115
 
111
- **[API开发文档](https://github.com/ven-coder/assistsx-js/blob/main/README-DEV.md)**
112
-
113
- ## StepFlow(流程编排,`assistsx-js/step-flow`)
114
-
115
- 在保留原有 `Step.run` / `StepImpl` 的前提下,提供基于**状态 + 事件 + on 转移表**的流程编排,适合非线性跳转、多流程共用同一步骤实现。
116
-
117
- ```ts
118
- import { Step } from "assistsx-js";
119
- import {
120
- StepFlow,
121
- flowEvent,
122
- flowRepeat,
123
- flowEnd,
124
- createFlowDispatcher,
125
- buildFlowInitialData,
126
- createLaunchState,
127
- } from "assistsx-js/step-flow";
128
-
129
- // 1. 定义流程(launch 可衔接 legacy finishMethod)
130
- const config = {
131
- id: "my.flow",
132
- initial: "launch",
133
- states: {} as Record<string, import("assistsx-js/step-flow").FlowStateDef>,
134
- data: { appName: "抖音", packageName: "com.ss.android.ugc.aweme" },
135
- };
136
- const dispatcher = createFlowDispatcher(config);
137
- config.states = {
138
- launch: createLaunchState(dispatcher, appLaunch.launch, "mainPage"),
139
- mainPage: {
140
- run: async (step) => (isHome(step) ? flowEvent("home") : flowRepeat()),
141
- on: { home: "next", retry: "mainPage" },
142
- },
143
- next: { run: async () => flowEnd(), on: {} },
144
- };
145
-
146
- await Step.run(dispatcher, { data: buildFlowInitialData(config) });
147
- // 或使用:await StepFlow.run(config); // 需在 config.states 填充后再 run,见 createLaunchState 文档
148
- ```
149
-
150
- 要点:
116
+ **[完整开发文档](./docs/README.md)**(推荐,含 Step、子模块、生产模式与 AI 协作指南)
151
117
 
152
- - **步骤实现**(`FlowStepImpl`)只返回 `flowEvent` / `flowRepeat` / `flowEnd`,或 `legacy` 委托旧版 `StepImpl`。
153
- - **跳转**由当前状态的 `on` 表决定;同一 `run` 可在不同 Flow 中配置不同的 `on`。
154
- - **业务数据**建议放在 `step.data.payload`;`getFlowPayload` / `assignFlowPayload` 可读写。
155
- - **与 legacy 共存**:`import { Step } from "assistsx-js"` 不变;StepFlow 从 `assistsx-js/step-flow` 单独导入。
118
+ **[API开发文档(兼容)](https://github.com/ven-coder/assistsx-js/blob/main/README-DEV.md)**
156
119
 
157
- 完整示例见 [ais-douyin-simple](https://github.com/ven-coder/assists-examples) 中 `src/v1/flows/check-unread.ts`。
120
+ > 复杂自动化请使用 `Step.run` + `StepImpl` 链,详见 [docs/02-step-engine/step-basics.md](./docs/02-step-engine/step-basics.md)。
158
121
 
159
122
  ## 示例
160
123