yiyan-browser-agent 1.5.2 → 1.5.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.
Files changed (2) hide show
  1. package/README.md +81 -0
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -166,6 +166,26 @@ ya --debug "build a calculator"
166
166
 
167
167
  When interactive mode (`-i`) is running, an HTTP server starts on port **9527**, allowing external services to send tasks.
168
168
 
169
+ ### Task Queue (v1.5.2+)
170
+
171
+ **多客户端并发支持:** 所有请求进入队列串行处理,确保每个客户端收到正确的响应。
172
+
173
+ ```
174
+ 客户端A → 请求"北京天气" → 队列位置1 → 处理 → 返回"北京天气答案"
175
+ 客户端B → 请求"上海天气" → 队列位置2 → 等待 → 处理 → 返回"上海天气答案"
176
+ 客户端C → 请求"广州天气" → 队列位置3 → 等待 → 处理 → 返回"广州天气答案"
177
+ ```
178
+
179
+ ### API Endpoints
180
+
181
+ | Endpoint | Method | Description |
182
+ |----------|--------|-------------|
183
+ | `/task` | POST | 提交任务 |
184
+ | `/status` | GET | 获取队列状态 |
185
+ | `/queue` | GET | 获取队列详情 |
186
+ | `/task/:id` | GET | 获取单个任务状态 |
187
+ | `/` | GET | 服务信息 |
188
+
169
189
  ### Process Communication
170
190
 
171
191
  ```bash
@@ -239,6 +259,67 @@ curl -X POST http://localhost:9527/task -H "Content-Type: application/json" -d '
239
259
  - 第二次请求 (`newChat=false`):AI 回答"小明"
240
260
  - 第三次请求 (`newChat=true`):AI 回答"不知道"或"你没有告诉我"
241
261
 
262
+ ### GET /status - 队列状态查询
263
+
264
+ ```bash
265
+ curl http://localhost:9527/status
266
+ ```
267
+
268
+ **Response:**
269
+ ```json
270
+ {
271
+ "queueLength": 2,
272
+ "isProcessing": true,
273
+ "currentTask": {
274
+ "id": "abc123",
275
+ "task": "北京天气",
276
+ "elapsed": 3000
277
+ },
278
+ "pendingTasks": [
279
+ { "id": "def456", "task": "上海天气", "waitTime": 2000 },
280
+ { "id": "ghi789", "task": "广州天气", "waitTime": 1000 }
281
+ ],
282
+ "stats": {
283
+ "totalProcessed": 10,
284
+ "averageProcessTime": 5000
285
+ }
286
+ }
287
+ ```
288
+
289
+ ### GET /queue - 队列详情
290
+
291
+ ```bash
292
+ curl http://localhost:9527/queue
293
+ ```
294
+
295
+ ### GET /task/:id - 单个任务状态
296
+
297
+ ```bash
298
+ curl http://localhost:9527/task/abc123
299
+ ```
300
+
301
+ **Response (processing):**
302
+ ```json
303
+ {
304
+ "id": "abc123",
305
+ "task": "北京天气",
306
+ "status": "processing",
307
+ "startedAt": 1735001234,
308
+ "elapsed": 3000
309
+ }
310
+ ```
311
+
312
+ **Response (pending):**
313
+ ```json
314
+ {
315
+ "id": "def456",
316
+ "task": "上海天气",
317
+ "status": "pending",
318
+ "queuePosition": 2,
319
+ "waitTime": 5000
320
+ }
321
+ ```
322
+
242
323
  ### Windows CMD (curl)
243
324
 
244
325
  ```cmd
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yiyan-browser-agent",
3
- "version": "1.5.2",
3
+ "version": "1.5.3",
4
4
  "description": "AI coding agent powered by Yiyan (文心一言) via browser automation — no API key needed",
5
5
  "main": "src/index.js",
6
6
  "bin": {