@amaster.ai/client 1.1.73 → 1.1.75

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
@@ -943,6 +943,8 @@ Business tenants are application-defined customers, stores, projects or workspac
943
943
 
944
944
  ## 原引擎 HTTP 调用兼容
945
945
 
946
+ `client.tenancy.listAccessible()` 使用已有账号级请求通道,不因首次租户上下文初始化或切换租户取消读取;退出或更换账号仍丢弃原账号的迟到响应。不要求先调用 `getMe()` 或 `account()`,不自动重放业务写入。
947
+
946
948
  租户模式沿用 `client.bpm`、`client.workflow` 和 `client.function.invoke()` 的原参数;统一请求层核验并携带当前作用域,不需要业务增加租户参数。登录态恢复后可直接选择租户,不要求先调用 `account()`;临时初始化失败可在后续调用恢复。业务 JSON 包装、HTTP 状态和日期处理保留,写入失败不自动重放。知识库/文件保留原范围与权限,由业务决定共享或隔离。Chatflow 旧流在切换后失效。其余执行与部署入口的验证边界见 [当前支持范围](../../docs/app-tenancy-implementation.md)。
947
949
  ## Browser hosts on another origin
948
950
 
package/dist/index.cjs CHANGED
@@ -1484,6 +1484,7 @@ function createResolvedClient(options, beforeAuthInitialize) {
1484
1484
  };
1485
1485
  };
1486
1486
  const scopedHttp = scope ? createScopedHttpClient(baseHttpClient, scope, credentials, autoRefresh, onUnauthorized) : void 0;
1487
+ const accountBusinessTransport = accountScope && authTransport ? createScopedHttpClient(authTransport, accountScope, credentials, autoRefresh, onUnauthorized) : void 0;
1487
1488
  const consumerHint = options.tenancy ? authClient.createConsumerUIHint(options.tenancy, () => auth.getAccessToken()) : void 0;
1488
1489
  const authority = scope ? tenancy.createConsumerAuthorization(scope, consumerHint) : void 0;
1489
1490
  auth.on("credentialsChanged", (kind) => {
@@ -1494,6 +1495,10 @@ function createResolvedClient(options, beforeAuthInitialize) {
1494
1495
  const authenticatedHttpClient = scopedHttp && scope && consumerContext ? {
1495
1496
  async request(config) {
1496
1497
  const application = config.scopeLevel === "application" || /^\/api\/auth\//.test(config.url);
1498
+ if (accountBusinessTransport && application && !config.scopeCapture && config.url === "/api/tenancy/accessible" && String(config.method ?? "GET").toUpperCase() === "GET") {
1499
+ const result = await accountBusinessTransport.request({ ...config, scopeLevel: "application", preserveBusinessResponse: false });
1500
+ return result.error ? result : { ...result, scopeCapture: scope.capture("application") };
1501
+ }
1497
1502
  const selectedContextRead = config.url === "/api/tenancy/current" && !!scope.currentIdentity && !!scope.appTenantId;
1498
1503
  if (!application && (!selectedContextRead && consumerContext.pending || !scope.currentIdentity || !scope.appTenantId)) {
1499
1504
  const established = await consumerContext.ensure();
@@ -1545,7 +1550,6 @@ function createResolvedClient(options, beforeAuthInitialize) {
1545
1550
  } : void 0
1546
1551
  });
1547
1552
  const functionClient$1 = functionClient.createFunctionClient(authenticatedHttpClient);
1548
- const accountBusinessTransport = accountScope && authTransport ? createScopedHttpClient(authTransport, accountScope, credentials, autoRefresh, onUnauthorized) : void 0;
1549
1553
  const applicationHttp = accountBusinessTransport ? {
1550
1554
  async request(config) {
1551
1555
  return accountBusinessTransport.request({ ...config, scopeLevel: "application", preserveBusinessResponse: true });