@qoniai/qoni 0.4.4 → 0.5.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,19 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.5.0 - 2026-09-17
4
+
5
+ ### Added
6
+
7
+ - Let Do Anything callers select a server-managed Browserbase proxy by ID, choose
8
+ `off`, `all`, or `scoped` routing, and select a supported Browserbase compute
9
+ region with `browserProxy`.
10
+
11
+ ### Security
12
+
13
+ - Reject proxy URLs, usernames, passwords, and any unknown proxy option locally.
14
+ Proxy credentials remain in the backend's private registry and never cross the
15
+ public SDK API.
16
+
3
17
  ## 0.4.4
4
18
 
5
19
  - Populate Do Anything `result.artifacts` from durable run files, including attached runs.
package/README.md CHANGED
@@ -391,12 +391,22 @@ const context = await qoni.gumem.recall({
391
391
  const run = await qoni.doAnything.run({
392
392
  token,
393
393
  prompt: "Open https://en.wikipedia.org/wiki/Solid-state_battery and summarize its key advantages over lithium-ion.",
394
+ browserProxy: {
395
+ proxyId: "sg-static", // server-side registry id; never pass credentials here
396
+ mode: "scoped", // off | all | scoped
397
+ region: "ap-southeast-1",
398
+ },
394
399
  });
395
400
 
396
401
  const status = await run.status(); // refresh the run's current state
397
402
  await run.cancel("User stopped the task"); // idempotent
398
403
  ```
399
404
 
405
+ `browserProxy` affects only newly created Browserbase sessions. `region` selects
406
+ Browserbase compute, while the registered proxy controls network egress. The SDK
407
+ accepts only a proxy ID, mode, and region; operators manage proxy credentials in
408
+ OpsConsole.
409
+
400
410
  ### Web Search
401
411
 
402
412
  ```ts
package/README.zh-CN.md CHANGED
@@ -362,12 +362,21 @@ const context = await qoni.gumem.recall({
362
362
  const run = await qoni.doAnything.run({
363
363
  token,
364
364
  prompt: "打开 https://en.wikipedia.org/wiki/Solid-state_battery ,总结它相对锂离子电池的主要优势。",
365
+ browserProxy: {
366
+ proxyId: "sg-static", // 服务端代理注册表 ID;这里绝不传凭据
367
+ mode: "scoped", // off | all | scoped
368
+ region: "ap-southeast-1",
369
+ },
365
370
  });
366
371
 
367
372
  const status = await run.status(); // 刷新并返回当前状态
368
373
  await run.cancel("用户停止任务"); // 幂等
369
374
  ```
370
375
 
376
+ `browserProxy` 只影响新建的 Browserbase 会话。`region` 选择 Browserbase
377
+ 计算区域,注册代理决定网络出口。SDK 只接受代理 ID、模式和区域;代理账号密码由
378
+ 运维人员在 OpsConsole 管理。
379
+
371
380
  ### Web Search
372
381
 
373
382
  ```ts
package/dist/index.cjs CHANGED
@@ -1194,6 +1194,34 @@ var PLATFORM_DECIDED_RUN_OPTIONS = [
1194
1194
  "outputSchema",
1195
1195
  "cacheScript"
1196
1196
  ];
1197
+ var BROWSERBASE_REGIONS = /* @__PURE__ */ new Set([
1198
+ "us-west-2",
1199
+ "us-east-1",
1200
+ "eu-central-1",
1201
+ "ap-southeast-1"
1202
+ ]);
1203
+ function validateBrowserProxyOptions(value) {
1204
+ if (value === void 0) return;
1205
+ if (!isJsonObject(value)) {
1206
+ throw new QoniValidationError("browserProxy must be an object");
1207
+ }
1208
+ const allowed = /* @__PURE__ */ new Set(["proxyId", "mode", "region"]);
1209
+ const extras = Object.keys(value).filter((key) => !allowed.has(key));
1210
+ if (extras.length > 0) {
1211
+ throw new QoniValidationError(
1212
+ `browserProxy does not accept ${extras.join(", ")} \u2014 credentials stay server-side`
1213
+ );
1214
+ }
1215
+ if (value.proxyId !== void 0 && (typeof value.proxyId !== "string" || !/^[a-z0-9][a-z0-9._-]{0,63}$/.test(value.proxyId))) {
1216
+ throw new QoniValidationError("browserProxy.proxyId is invalid");
1217
+ }
1218
+ if (value.mode !== void 0 && !["off", "all", "scoped"].includes(String(value.mode))) {
1219
+ throw new QoniValidationError("browserProxy.mode must be off, all, or scoped");
1220
+ }
1221
+ if (value.region !== void 0 && (typeof value.region !== "string" || !BROWSERBASE_REGIONS.has(value.region))) {
1222
+ throw new QoniValidationError("browserProxy.region is not supported");
1223
+ }
1224
+ }
1197
1225
  function createDoAnythingNamespace(transport) {
1198
1226
  const api = {
1199
1227
  createSession: (input) => transport.webAgentJson("POST", "/do_anything/sessions", input.token, {
@@ -1356,6 +1384,7 @@ function createDoAnythingNamespace(transport) {
1356
1384
  if (!prompt || typeof prompt !== "string") {
1357
1385
  throw new QoniValidationError("doAnything.run requires a prompt string");
1358
1386
  }
1387
+ validateBrowserProxyOptions(rest.browserProxy);
1359
1388
  const unsupported = PLATFORM_DECIDED_RUN_OPTIONS.filter(
1360
1389
  (key) => rest[key] !== void 0
1361
1390
  );
@@ -1407,8 +1436,13 @@ function normalizeDoAnythingRunInput(input) {
1407
1436
  profileId: "profile_id",
1408
1437
  keepAlive: "keep_alive",
1409
1438
  allowedActions: "allowed_actions",
1410
- maxDurationMinutes: "max_duration_minutes"
1439
+ maxDurationMinutes: "max_duration_minutes",
1440
+ browserProxy: "browser_proxy"
1411
1441
  });
1442
+ const browserProxy = body.browser_proxy;
1443
+ if (isJsonObject(browserProxy)) {
1444
+ body.browser_proxy = renameKeys2(browserProxy, { proxyId: "proxy_id" });
1445
+ }
1412
1446
  return body;
1413
1447
  }
1414
1448
  function normalizeDoAnythingInterveneInput(input) {