@qoniai/qoni 0.5.2 → 0.6.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/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.6.0 - 2026-09-23
4
+
5
+ ### Added
6
+
7
+ - Deliver `browserLiveUrlChanged` on semantic run streams when the browser
8
+ viewer URL changes. Applications can follow the active tab instead of
9
+ remaining on the initial blank page. The event includes the live viewer URL
10
+ and refresh hint, without exposing the private CDP URL in `event.data`.
11
+
3
12
  ## 0.5.2 - 2026-09-23
4
13
 
5
14
  ### Fixed
package/README.md CHANGED
@@ -687,6 +687,7 @@ that type:
687
687
  // "message" { text, role }
688
688
  // "interaction" the typed Interaction object (HITL) — see Interactions
689
689
  // "screenshot" { pageUrl?, step? } + the decoded image on event.image
690
+ // "browserLiveUrlChanged" { liveUrl, supportsLivePump, forceViewerReload, providerSessionId? }
690
691
  // "done" { output, succeeded, terminalReason }
691
692
  // Common to every event: runId, at (ISO 8601), isTerminal (true only for "done"),
692
693
  // raw (the original wire event — escape hatch).
@@ -696,11 +697,17 @@ Each product handle is typed to its own subset:
696
697
 
697
698
  | Product | `event.type` set |
698
699
  |---|---|
699
- | Do Anything | core: `progress` / `message` / `interaction` / `screenshot` / `done` |
700
+ | Do Anything | core: `progress` / `message` / `interaction` / `screenshot` / `browserLiveUrlChanged` / `done` |
700
701
  | Web Search | core + `resultsReady` |
701
702
  | Deep Research | core + `phase` / `sectionReady` (the outline gate arrives as an `interaction`) |
702
703
  | Track (`MonitorHandle`) | core + `monitorCreated` / `triggered` / `checkCompleted` |
703
704
 
705
+ For a live browser preview, listen for `browserLiveUrlChanged` and show
706
+ `event.data.liveUrl` in your viewer. A run can switch browser tabs after its
707
+ first URL arrives, so update the viewer on later events too. Remount an
708
+ existing viewer when `forceViewerReload` is true. The URL grants access to the
709
+ browser view; keep it out of public logs.
710
+
704
711
  Dropped connections reconnect automatically with `Last-Event-ID` catch-up; the iterator ends at the run's terminal (`done`) event.
705
712
  For complete audit/observability capture, `onWireEvent` receives every original
706
713
  SSE frame before semantic normalization or filtering; `onReconnect` receives
package/README.zh-CN.md CHANGED
@@ -620,6 +620,7 @@ type QoniResponse<T> = {
620
620
  // "message" { text, role }
621
621
  // "interaction" 带类型的 Interaction 对象(HITL)—— 见「交互」一节
622
622
  // "screenshot" { pageUrl?, step? } + 解码后的图在 event.image
623
+ // "browserLiveUrlChanged" { liveUrl, supportsLivePump, forceViewerReload, providerSessionId? }
623
624
  // "done" { output, succeeded, terminalReason }
624
625
  // 公共字段:runId、at(ISO 8601)、isTerminal(仅 "done" 为 true)、raw(原始 wire 事件,逃生舱)。
625
626
  ```
@@ -628,11 +629,13 @@ type QoniResponse<T> = {
628
629
 
629
630
  | 产品 | `event.type` 集合 |
630
631
  |---|---|
631
- | Do Anything | 核心:`progress` / `message` / `interaction` / `screenshot` / `done` |
632
+ | Do Anything | 核心:`progress` / `message` / `interaction` / `screenshot` / `browserLiveUrlChanged` / `done` |
632
633
  | Web Search | 核心 + `resultsReady` |
633
634
  | Deep Research | 核心 + `phase` / `sectionReady`(大纲审批走 `interaction`) |
634
635
  | Track(`MonitorHandle`) | 核心 + `monitorCreated` / `triggered` / `checkCompleted` |
635
636
 
637
+ 展示实时浏览器时,监听 `browserLiveUrlChanged`,用 `event.data.liveUrl` 更新预览地址。任务执行期间可能切换标签页,因此不能只使用第一次收到的地址。`forceViewerReload` 为 true 时重载已有预览。live URL 可访问浏览器画面,不要写入公开日志。
638
+
636
639
  断线会带 `Last-Event-ID` 自动重连续传;迭代器在终态事件后自动结束。
637
640
  需要完整审计/可观测性证据时,`onWireEvent` 会在语义归一化和过滤之前收到每一个原始 SSE 帧;
638
641
  `onReconnect` 会收到重试次数和最后事件 id。应用逻辑继续使用稳定的 `RunEvent`,原始回调只用于证据与诊断。
package/dist/index.cjs CHANGED
@@ -278,6 +278,8 @@ var QoniEventTypes = {
278
278
  Interaction: "interaction",
279
279
  /** A live screenshot frame (opt in with `capture: { screenshots: true }`); image on `event.image`. */
280
280
  Screenshot: "screenshot",
281
+ /** The browser viewer moved to a new page or needs a fresh attachment. Use `event.data.liveUrl` for the live preview. */
282
+ BrowserLiveUrlChanged: "browserLiveUrlChanged",
281
283
  /** Terminal — the run finished; outcome + output in `event.data` (cost is on the `RunResult`). */
282
284
  Done: "done",
283
285
  // --- Web Search ---
@@ -408,7 +410,6 @@ var WIRE_TO_SEMANTIC = {
408
410
  "run.recording_started": "progress",
409
411
  "run.recording_paused": "progress",
410
412
  "run.recording_finalized": "progress",
411
- "run.browser_live_url_changed": "progress",
412
413
  // side-channel
413
414
  "run.feedback_submitted": "progress"
414
415
  };
@@ -470,6 +471,18 @@ function normalizeRunEvent(wire, options = {}) {
470
471
  return { ...base, type: "screenshot", data: sData, image, isTerminal: false };
471
472
  }
472
473
  }
474
+ if (wireType === "run.browser_live_url_changed") {
475
+ const liveUrl = asString(c.liveUrl);
476
+ if (!liveUrl) return null;
477
+ const data2 = {
478
+ liveUrl,
479
+ supportsLivePump: c.supportsLivePump === true,
480
+ forceViewerReload: c.forceViewerReload === true
481
+ };
482
+ const providerSessionId = asString(c.providerSessionId);
483
+ if (providerSessionId) data2.providerSessionId = providerSessionId;
484
+ return { ...base, type: "browserLiveUrlChanged", data: data2, isTerminal: false };
485
+ }
473
486
  if (wireType === INTERACTION) {
474
487
  const interaction = normalizeInteraction(payload);
475
488
  if (interaction) {