@clawos-dev/clawd 0.2.237 → 0.2.239
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 +51 -6
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -50506,7 +50506,10 @@ var EXPOSED_RPC_METHODS = [
|
|
|
50506
50506
|
// 查当前 turn caller —— cc 长驻 + owner/guest 交替驱动同一 session 时不能靠启动时 env
|
|
50507
50507
|
// 写死身份,必须运行时 fetch。header X-Clawd-Session-Id 作 session 定位,handler 内查
|
|
50508
50508
|
// manager.tryGetState(sid).currentTurnSender 返 SenderInfo | null。
|
|
50509
|
-
"session.currentTurnSender"
|
|
50509
|
+
"session.currentTurnSender",
|
|
50510
|
+
// 建联交换(T-32):本机 cc 拨号前查对端 osUser 拼 `<osUser>@127.0.0.1`。窄读——handler
|
|
50511
|
+
// 只返 deviceId / displayName / osUser(无 connectToken 等敏感字段),见 handlers/contact.ts dialInfo。
|
|
50512
|
+
"contact.dialInfo"
|
|
50510
50513
|
];
|
|
50511
50514
|
async function handleRpcRequest(input) {
|
|
50512
50515
|
const { method, body, sessionId, dispatcher } = input;
|
|
@@ -53594,17 +53597,46 @@ function ensureJailScript(dataDir) {
|
|
|
53594
53597
|
// src/sshd/clawd-shim.ts
|
|
53595
53598
|
var import_node_fs38 = __toESM(require("fs"), 1);
|
|
53596
53599
|
var import_node_path38 = __toESM(require("path"), 1);
|
|
53600
|
+
var DEFAULT_FALLBACK_APPS = ["/Applications/Clawd.app", "$HOME/Applications/Clawd.app"];
|
|
53597
53601
|
function shellQuote(s) {
|
|
53598
53602
|
return `'${s.replace(/'/g, "'\\''")}'`;
|
|
53599
53603
|
}
|
|
53600
|
-
function
|
|
53604
|
+
function fallbackWord(app) {
|
|
53605
|
+
if (app.startsWith("$HOME/")) return `"$HOME"/${shellQuote(app.slice("$HOME/".length))}`;
|
|
53606
|
+
return shellQuote(app);
|
|
53607
|
+
}
|
|
53608
|
+
function buildClawdShim(execPath, cliPath, fallbackApps = DEFAULT_FALLBACK_APPS) {
|
|
53609
|
+
const candidates = fallbackApps.map(fallbackWord).join(" ");
|
|
53601
53610
|
return `#!/usr/bin/env bash
|
|
53602
53611
|
# clawd shim (managed by clawd; do not edit)
|
|
53603
53612
|
#
|
|
53604
|
-
# \
|
|
53605
|
-
#
|
|
53606
|
-
#
|
|
53607
|
-
|
|
53613
|
+
# primary = seed \u672C\u6587\u4EF6\u7684 daemon \u7684 execPath + cliPath\uFF1Bdaemon \u91CD\u542F\u4F1A\u8986\u5199\u672C\u6587\u4EF6\uFF08\u5E42\u7B49 seed\uFF09\u3002
|
|
53614
|
+
# primary \u5931\u6548\uFF08npx \u7F13\u5B58 GC / OTA bundle GC / app \u79FB\u52A8\uFF09\u65F6\u56DE\u9000 installer \u81EA\u5E26 CLI\uFF1B
|
|
53615
|
+
# \u5168\u706D\u7ED9\u53EF\u8BFB\u9519\u8BEF\u3002guest CC \u7528 SSH ProxyCommand \u8D70 ~/.clawd/bin/clawd ssh-relay \u65F6\u547D\u4E2D\u672C shim\u3002
|
|
53616
|
+
#
|
|
53617
|
+
# ELECTRON_RUN_AS_NODE \u663E\u5F0F\u5BFC\u51FA\uFF1Aprimary/fallback \u90FD\u53EF\u80FD\u662F Electron \u4E8C\u8FDB\u5236\uFF08plain node \u5FFD\u7565
|
|
53618
|
+
# \u8BE5\u53D8\u91CF\uFF0C\u65E0\u5BB3\uFF09\u2014\u2014\u4E0D\u518D\u4F9D\u8D56 desktop \u73AF\u5883\u53D8\u91CF\u6070\u597D\u6CC4\u6F0F\u5230 CC \u5B50\u8FDB\u7A0B\u3002
|
|
53619
|
+
export ELECTRON_RUN_AS_NODE=1
|
|
53620
|
+
EXEC=${shellQuote(execPath)}
|
|
53621
|
+
CLI=${shellQuote(cliPath)}
|
|
53622
|
+
if [ ! -x "$EXEC" ] || [ ! -f "$CLI" ]; then
|
|
53623
|
+
for APP in ${candidates}; do
|
|
53624
|
+
FCLI="$APP/Contents/Resources/daemon/dist/cli.cjs"
|
|
53625
|
+
[ -f "$FCLI" ] || continue
|
|
53626
|
+
for FEXE in "$APP"/Contents/MacOS/*; do
|
|
53627
|
+
if [ -f "$FEXE" ] && [ -x "$FEXE" ]; then
|
|
53628
|
+
EXEC="$FEXE"
|
|
53629
|
+
CLI="$FCLI"
|
|
53630
|
+
break 2
|
|
53631
|
+
fi
|
|
53632
|
+
done
|
|
53633
|
+
done
|
|
53634
|
+
fi
|
|
53635
|
+
if [ ! -x "$EXEC" ] || [ ! -f "$CLI" ]; then
|
|
53636
|
+
echo "clawd shim: daemon CLI not found ($CLI); \u91CD\u542F clawd daemon \u53EF\u91CD\u65B0\u751F\u6210\u672C\u6587\u4EF6" >&2
|
|
53637
|
+
exit 127
|
|
53638
|
+
fi
|
|
53639
|
+
exec "$EXEC" "$CLI" "$@"
|
|
53608
53640
|
`;
|
|
53609
53641
|
}
|
|
53610
53642
|
function ensureClawdShim(dataDir, execPath, cliPath) {
|
|
@@ -55845,6 +55877,18 @@ function buildContactHandlers(deps) {
|
|
|
55845
55877
|
}
|
|
55846
55878
|
};
|
|
55847
55879
|
};
|
|
55880
|
+
const dialInfo = async () => {
|
|
55881
|
+
return {
|
|
55882
|
+
response: {
|
|
55883
|
+
type: "contact:dialInfo:ok",
|
|
55884
|
+
contacts: deps.store.list().map((c) => ({
|
|
55885
|
+
deviceId: c.deviceId,
|
|
55886
|
+
displayName: c.displayName,
|
|
55887
|
+
...c.osUser ? { osUser: c.osUser } : {}
|
|
55888
|
+
}))
|
|
55889
|
+
}
|
|
55890
|
+
};
|
|
55891
|
+
};
|
|
55848
55892
|
const pin = async (frame, _client, ctx) => {
|
|
55849
55893
|
ensureOwner(ctx);
|
|
55850
55894
|
const { type: _t, requestId: _r, ...rest } = frame;
|
|
@@ -55888,6 +55932,7 @@ function buildContactHandlers(deps) {
|
|
|
55888
55932
|
};
|
|
55889
55933
|
return {
|
|
55890
55934
|
"contact:list": list,
|
|
55935
|
+
"contact:dialInfo": dialInfo,
|
|
55891
55936
|
"contact:pin": pin,
|
|
55892
55937
|
"contact:remove": remove
|
|
55893
55938
|
};
|