@clawos-dev/clawd 0.2.546 → 0.2.547
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 +44 -15
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -62411,6 +62411,32 @@ async function centralGetApiKey(opts) {
|
|
|
62411
62411
|
gatewayUrl: typeof body.gatewayUrl === "string" ? body.gatewayUrl : null
|
|
62412
62412
|
};
|
|
62413
62413
|
}
|
|
62414
|
+
async function centralGetThread(opts) {
|
|
62415
|
+
const f2 = opts.fetchImpl ?? globalThis.fetch;
|
|
62416
|
+
const url = `${opts.api.replace(/\/+$/, "")}/api/persona-cloud/threads/${encodeURIComponent(opts.threadId)}`;
|
|
62417
|
+
const ctrl = new AbortController();
|
|
62418
|
+
const timer = setTimeout(() => ctrl.abort(), opts.timeoutMs ?? 15e3);
|
|
62419
|
+
let res;
|
|
62420
|
+
try {
|
|
62421
|
+
res = await f2(url, { method: "GET", headers: { authorization: `Bearer ${opts.loginPass}` }, signal: ctrl.signal });
|
|
62422
|
+
} catch (err) {
|
|
62423
|
+
clearTimeout(timer);
|
|
62424
|
+
throw new CentralClientError("NETWORK", `central server request failed: ${err.message}`, err);
|
|
62425
|
+
}
|
|
62426
|
+
clearTimeout(timer);
|
|
62427
|
+
if (res.status === 404) return null;
|
|
62428
|
+
if (res.status === 401) throw new CentralClientError("UNAUTHORIZED", "login pass rejected by center");
|
|
62429
|
+
if (!res.ok) {
|
|
62430
|
+
let detail = "";
|
|
62431
|
+
try {
|
|
62432
|
+
const body = await res.json();
|
|
62433
|
+
if (typeof body?.message === "string" && body.message) detail = `: ${body.message}`;
|
|
62434
|
+
} catch {
|
|
62435
|
+
}
|
|
62436
|
+
throw new CentralClientError("API_ERROR", `central server HTTP ${res.status}${detail}`);
|
|
62437
|
+
}
|
|
62438
|
+
return await res.text();
|
|
62439
|
+
}
|
|
62414
62440
|
async function centralIssueApiKey(opts) {
|
|
62415
62441
|
const body = await centralRequest(opts, "/api/persona-cloud/api-key", {
|
|
62416
62442
|
method: "POST",
|
|
@@ -62498,8 +62524,6 @@ var GATEWAY_ROUTES = {
|
|
|
62498
62524
|
healthz: () => "/healthz",
|
|
62499
62525
|
session: (personaId2) => `/p/${encodeURIComponent(personaId2)}/session`,
|
|
62500
62526
|
sessionSend: (personaId2, sessionId) => `/p/${encodeURIComponent(personaId2)}/session/${encodeURIComponent(sessionId)}`,
|
|
62501
|
-
// 历史文件不挂在 persona 下:使用者卷跨 persona 共用(design 2026-09-14-codex-native-memories §3.2f)
|
|
62502
|
-
thread: (threadId) => `/threads/${encodeURIComponent(threadId)}`,
|
|
62503
62527
|
// 调用方自己那块盘的用量(design 2026-09-19-cloud-volume-usage §3.3):同样按人、不挂 persona
|
|
62504
62528
|
volume: () => "/me/volume"
|
|
62505
62529
|
};
|
|
@@ -62614,16 +62638,6 @@ var CloudGatewayClient = class {
|
|
|
62614
62638
|
if (body.volume == null) return null;
|
|
62615
62639
|
return CloudVolumeUsageSchema.parse(body.volume);
|
|
62616
62640
|
}
|
|
62617
|
-
/** rollout 原文;404 = 没这条 thread(还没开过第一轮 / 卷被清)→ null */
|
|
62618
|
-
async fetchRollout(threadId) {
|
|
62619
|
-
const { apiKey, gatewayUrl } = await this.credentials();
|
|
62620
|
-
const res = await this.fetchImpl(gatewayUrl + GATEWAY_ROUTES.thread(threadId), {
|
|
62621
|
-
headers: { authorization: `Bearer ${apiKey}` }
|
|
62622
|
-
});
|
|
62623
|
-
if (res.status === 404) return null;
|
|
62624
|
-
if (!res.ok) throw new Error(`gateway threads \u8DEF\u7531\u56DE ${res.status}`);
|
|
62625
|
-
return await res.text();
|
|
62626
|
-
}
|
|
62627
62641
|
};
|
|
62628
62642
|
function parseControlLine(line) {
|
|
62629
62643
|
let o2;
|
|
@@ -63020,7 +63034,7 @@ var CloudCodexAdapter = class {
|
|
|
63020
63034
|
this.client = opts.client;
|
|
63021
63035
|
this.logger = opts.logger;
|
|
63022
63036
|
this.getSignSecret = opts.getSignSecret;
|
|
63023
|
-
this.historyReader = new CloudCodexHistoryReader(opts.
|
|
63037
|
+
this.historyReader = new CloudCodexHistoryReader(opts.history, opts.logger);
|
|
63024
63038
|
}
|
|
63025
63039
|
/** 可用 = 能拿到凭据(登了飞书、生成过 key、中心配了 gateway),与本机装没装 codex 无关 */
|
|
63026
63040
|
async probe() {
|
|
@@ -70997,7 +71011,7 @@ function computeMethodAccess(args) {
|
|
|
70997
71011
|
}
|
|
70998
71012
|
|
|
70999
71013
|
// src/version.ts
|
|
71000
|
-
var version = "0.2.
|
|
71014
|
+
var version = "0.2.547".length > 0 ? "0.2.547" : "dev";
|
|
71001
71015
|
|
|
71002
71016
|
// src/cli-probe/probe.ts
|
|
71003
71017
|
var fs78 = __toESM(require("fs"), 1);
|
|
@@ -74201,7 +74215,22 @@ async function startDaemon(config) {
|
|
|
74201
74215
|
getSignSecret: () => authFile.token
|
|
74202
74216
|
})
|
|
74203
74217
|
);
|
|
74204
|
-
registerAdapter(
|
|
74218
|
+
registerAdapter(
|
|
74219
|
+
CODEX_CLOUD_TOOL_ID,
|
|
74220
|
+
new CloudCodexAdapter({
|
|
74221
|
+
client: cloudGateway,
|
|
74222
|
+
// 历史副本从中心拉(design 2026-09-19-cloud-session-oss §3.4):没登录就没有历史,不抛
|
|
74223
|
+
history: {
|
|
74224
|
+
fetchRollout: (threadId) => {
|
|
74225
|
+
const loginPass = ownerIdentityStore.read()?.loginPass;
|
|
74226
|
+
if (!loginPass) return Promise.resolve(null);
|
|
74227
|
+
return centralGetThread({ api: config.clawosApi ?? DEFAULT_CLAWOS_API, loginPass, threadId });
|
|
74228
|
+
}
|
|
74229
|
+
},
|
|
74230
|
+
logger,
|
|
74231
|
+
getSignSecret: () => authFile.token
|
|
74232
|
+
})
|
|
74233
|
+
);
|
|
74205
74234
|
const piMcpBridgeCandidates = [
|
|
74206
74235
|
import_node_path80.default.join(here, "pi-mcp-bridge", "extension.cjs"),
|
|
74207
74236
|
import_node_path80.default.join(here, "..", "dist", "pi-mcp-bridge", "extension.cjs")
|