@clawos-dev/clawd 0.2.521 → 0.2.523
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/dist/cli.cjs +20 -23
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -67647,9 +67647,8 @@ var LoginFlow = class {
|
|
|
67647
67647
|
try {
|
|
67648
67648
|
await this.deps.upsertBinding({
|
|
67649
67649
|
deviceId: this.deps.getDeviceId(),
|
|
67650
|
-
|
|
67651
|
-
|
|
67652
|
-
avatarUrl: identity.avatarUrl ?? null
|
|
67650
|
+
ttcToken: params.token,
|
|
67651
|
+
identity
|
|
67653
67652
|
});
|
|
67654
67653
|
} catch (err) {
|
|
67655
67654
|
return {
|
|
@@ -67736,22 +67735,19 @@ async function upsertDeviceBinding(opts) {
|
|
|
67736
67735
|
const doFetch = opts.fetchImpl ?? fetch;
|
|
67737
67736
|
const ac = new AbortController();
|
|
67738
67737
|
const timer = setTimeout(() => ac.abort(), opts.timeoutMs ?? DEFAULT_TIMEOUT_MS4);
|
|
67739
|
-
const body = { unionId: opts.unionId };
|
|
67740
|
-
if (opts.avatarUrl != null) body.avatarUrl = opts.avatarUrl;
|
|
67741
67738
|
let res;
|
|
67742
67739
|
try {
|
|
67743
|
-
res = await doFetch(
|
|
67744
|
-
|
|
67745
|
-
|
|
67746
|
-
|
|
67747
|
-
|
|
67748
|
-
|
|
67749
|
-
|
|
67750
|
-
|
|
67751
|
-
|
|
67752
|
-
}
|
|
67753
|
-
|
|
67754
|
-
});
|
|
67740
|
+
res = await doFetch(
|
|
67741
|
+
`${opts.apiUrl}/api/device-bindings/self?provider=${encodeURIComponent(opts.provider)}`,
|
|
67742
|
+
{
|
|
67743
|
+
method: "PUT",
|
|
67744
|
+
signal: ac.signal,
|
|
67745
|
+
headers: {
|
|
67746
|
+
authorization: `Bearer ${opts.ttcToken}`,
|
|
67747
|
+
"x-did": encodeURIComponent(opts.deviceId)
|
|
67748
|
+
}
|
|
67749
|
+
}
|
|
67750
|
+
);
|
|
67755
67751
|
} catch (err) {
|
|
67756
67752
|
clearTimeout(timer);
|
|
67757
67753
|
throw new DeviceBindingClientError(
|
|
@@ -70380,7 +70376,7 @@ function computeMethodAccess(args) {
|
|
|
70380
70376
|
}
|
|
70381
70377
|
|
|
70382
70378
|
// src/version.ts
|
|
70383
|
-
var version = "0.2.
|
|
70379
|
+
var version = "0.2.523".length > 0 ? "0.2.523" : "dev";
|
|
70384
70380
|
|
|
70385
70381
|
// src/cli-probe/probe.ts
|
|
70386
70382
|
var fs77 = __toESM(require("fs"), 1);
|
|
@@ -73821,24 +73817,25 @@ async function startDaemon(config) {
|
|
|
73821
73817
|
ttcAuthBase: TTC_HOSTS.auth,
|
|
73822
73818
|
getCallbackUrl: () => `http://127.0.0.1:${config.port}/auth/callback`,
|
|
73823
73819
|
// device_bindings upsert(did ↔ 飞书 unionId 映射):
|
|
73824
|
-
// deviceId 从 auth.json 稳定读;apiUrl 走同一份 clawosApi
|
|
73820
|
+
// deviceId 从 auth.json 稳定读;apiUrl 走同一份 clawosApi;鉴权 = 刚登录拿到的 TTC JWT。
|
|
73825
73821
|
// 失败即登录失败(fail-hard,login-flow.spec §upsert 失败)。
|
|
73826
73822
|
getDeviceId: () => authFile.deviceId,
|
|
73827
73823
|
upsertBinding: async (opts) => {
|
|
73828
73824
|
try {
|
|
73829
73825
|
await upsertDeviceBinding({
|
|
73830
73826
|
apiUrl: config.clawosApi ?? DEFAULT_CLAWOS_API,
|
|
73831
|
-
|
|
73832
|
-
|
|
73827
|
+
ttcToken: opts.ttcToken,
|
|
73828
|
+
provider: opts.identity.provider,
|
|
73829
|
+
deviceId: opts.deviceId
|
|
73833
73830
|
});
|
|
73834
73831
|
logger.info("device-binding upsert succeeded", {
|
|
73835
73832
|
deviceId: opts.deviceId,
|
|
73836
|
-
unionId: opts.unionId
|
|
73833
|
+
unionId: opts.identity.unionId
|
|
73837
73834
|
});
|
|
73838
73835
|
} catch (err) {
|
|
73839
73836
|
logger.warn("device-binding upsert failed", {
|
|
73840
73837
|
deviceId: opts.deviceId,
|
|
73841
|
-
unionId: opts.unionId,
|
|
73838
|
+
unionId: opts.identity.unionId,
|
|
73842
73839
|
error: err instanceof Error ? err.message : String(err)
|
|
73843
73840
|
});
|
|
73844
73841
|
throw err;
|