@clawos-dev/clawd 0.2.495 → 0.2.497
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.
|
@@ -24513,8 +24513,11 @@ var RpcMethodInfoSchema = external_exports.object({
|
|
|
24513
24513
|
argsSchema: external_exports.record(external_exports.unknown()).optional(),
|
|
24514
24514
|
/**
|
|
24515
24515
|
* `denied` 必带:daemon error code(`UNAUTHORIZED` / `FEISHU_LOGIN_REQUIRED` /
|
|
24516
|
-
* `METHOD_NOT_IMPLEMENTED
|
|
24517
|
-
* `
|
|
24516
|
+
* `METHOD_NOT_IMPLEMENTED`),外加一个不是 error code 的 `HUMAN_ONLY`——
|
|
24517
|
+
* 「这条只认人手,去界面上点」(daemon `HUMAN_ONLY_METHODS`)。
|
|
24518
|
+
* 它**故意**不复用 `UNAUTHORIZED`:这个字段是给 agent 看的,报 UNAUTHORIZED 它会去找
|
|
24519
|
+
* 「我缺哪个授权」,而正确的反应是「让人来点」,两者该分得开。
|
|
24520
|
+
* `conditional` 必带:谁来做二次校验。`allowed` 恒无。
|
|
24518
24521
|
*/
|
|
24519
24522
|
reason: external_exports.string().optional()
|
|
24520
24523
|
});
|
package/dist/cli.cjs
CHANGED
|
@@ -9473,8 +9473,11 @@ var init_methods = __esm({
|
|
|
9473
9473
|
argsSchema: external_exports.record(external_exports.unknown()).optional(),
|
|
9474
9474
|
/**
|
|
9475
9475
|
* `denied` 必带:daemon error code(`UNAUTHORIZED` / `FEISHU_LOGIN_REQUIRED` /
|
|
9476
|
-
* `METHOD_NOT_IMPLEMENTED
|
|
9477
|
-
* `
|
|
9476
|
+
* `METHOD_NOT_IMPLEMENTED`),外加一个不是 error code 的 `HUMAN_ONLY`——
|
|
9477
|
+
* 「这条只认人手,去界面上点」(daemon `HUMAN_ONLY_METHODS`)。
|
|
9478
|
+
* 它**故意**不复用 `UNAUTHORIZED`:这个字段是给 agent 看的,报 UNAUTHORIZED 它会去找
|
|
9479
|
+
* 「我缺哪个授权」,而正确的反应是「让人来点」,两者该分得开。
|
|
9480
|
+
* `conditional` 必带:谁来做二次校验。`allowed` 恒无。
|
|
9478
9481
|
*/
|
|
9479
9482
|
reason: external_exports.string().optional()
|
|
9480
9483
|
});
|
|
@@ -55469,9 +55472,17 @@ async function ensureRepo(exec, args) {
|
|
|
55469
55472
|
}
|
|
55470
55473
|
throw new RepoError(`\u5EFA\u4ED3\u5E93\u6CA1\u6210\uFF08gh repo create \u9000\u51FA\u7801 ${r.code}\uFF09\uFF1A${err}`);
|
|
55471
55474
|
}
|
|
55475
|
+
await enableActions(exec, slug);
|
|
55472
55476
|
const info = await repoInfo(exec, dir);
|
|
55473
55477
|
return { created: true, url: info?.url ?? `https://github.com/${slug}` };
|
|
55474
55478
|
}
|
|
55479
|
+
async function enableActions(exec, slug) {
|
|
55480
|
+
await exec(
|
|
55481
|
+
"gh",
|
|
55482
|
+
["api", "--method", "PUT", `repos/${slug}/actions/permissions`, "-F", "enabled=true", "-f", "allowed_actions=all"],
|
|
55483
|
+
{ timeoutMs: 3e4 }
|
|
55484
|
+
);
|
|
55485
|
+
}
|
|
55475
55486
|
async function setSecret(exec, args) {
|
|
55476
55487
|
const info = await repoInfo(exec, args.dir);
|
|
55477
55488
|
if (!info) throw new RepoError("\u8FD8\u6CA1\u6709\u4ED3\u5E93\uFF0CSecrets \u6CA1\u5730\u65B9\u5199");
|
|
@@ -55521,6 +55532,7 @@ async function commitAndPush(exec, args) {
|
|
|
55521
55532
|
async function release(exec, args) {
|
|
55522
55533
|
const info = await repoInfo(exec, args.dir);
|
|
55523
55534
|
if (!info) throw new RepoError("\u8FD8\u6CA1\u6709\u4ED3\u5E93\uFF0C\u5148\u70B9\u4E00\u6B21\u300C\u53D1\u5E03\u5230\u4E91\u4E0A\u300D\u5EFA\u4ED3");
|
|
55535
|
+
await enableActions(exec, repoSlug(info.url));
|
|
55524
55536
|
await writeTemplates(args.dir);
|
|
55525
55537
|
const identity = await identityArgs(exec, args.dir);
|
|
55526
55538
|
await mustGit(exec, args.dir, ["add", "-A"], "\u6682\u5B58\u6587\u4EF6");
|
|
@@ -59873,6 +59885,8 @@ var LocalWsServer = class {
|
|
|
59873
59885
|
const subscribedSessions = /* @__PURE__ */ new Map();
|
|
59874
59886
|
const handle = {
|
|
59875
59887
|
id,
|
|
59888
|
+
// 界面(桌面 UI / 安卓 / iOS)都从这里进来——人手入口
|
|
59889
|
+
transport: "ws",
|
|
59876
59890
|
subscribedSessions,
|
|
59877
59891
|
send: (frame) => this.safeSend(socket, frame),
|
|
59878
59892
|
close: (reason) => socket.close(1e3, reason ?? "closed")
|
|
@@ -65577,6 +65591,16 @@ var METHOD_GRANT_MAP = {
|
|
|
65577
65591
|
"appBuilder:publish": CAPABILITY_SCOPED,
|
|
65578
65592
|
"appBuilder:dismissPublishJob": CAPABILITY_SCOPED
|
|
65579
65593
|
};
|
|
65594
|
+
var HUMAN_ONLY_METHODS = [
|
|
65595
|
+
"deploy:start",
|
|
65596
|
+
"deploy:release",
|
|
65597
|
+
"deploy:putSecret",
|
|
65598
|
+
"deploy:rerunJob"
|
|
65599
|
+
];
|
|
65600
|
+
var HUMAN_ONLY = new Set(HUMAN_ONLY_METHODS);
|
|
65601
|
+
function isHumanOnlyDenied(method, transport) {
|
|
65602
|
+
return transport === "http" && HUMAN_ONLY.has(method);
|
|
65603
|
+
}
|
|
65580
65604
|
function computeGrant(method) {
|
|
65581
65605
|
const rule = METHOD_GRANT_MAP[method];
|
|
65582
65606
|
if (!rule) return { kind: "public" };
|
|
@@ -65585,7 +65609,7 @@ function computeGrant(method) {
|
|
|
65585
65609
|
return { kind: "check", resource: rule.resource, action: rule.action };
|
|
65586
65610
|
}
|
|
65587
65611
|
function computeMethodAccess(args) {
|
|
65588
|
-
const { method, grants, feishuActive, isImplemented } = args;
|
|
65612
|
+
const { method, grants, feishuActive, isImplemented, transport } = args;
|
|
65589
65613
|
const description = METHOD_DOCS[method].summary;
|
|
65590
65614
|
const argFields = methodArgFields(method);
|
|
65591
65615
|
if (!isImplemented(method)) {
|
|
@@ -65594,6 +65618,9 @@ function computeMethodAccess(args) {
|
|
|
65594
65618
|
if (!feishuActive && FEISHU_GATED_METHODS.includes(method)) {
|
|
65595
65619
|
return { name: method, description, args: argFields, status: "denied", reason: "FEISHU_LOGIN_REQUIRED" };
|
|
65596
65620
|
}
|
|
65621
|
+
if (isHumanOnlyDenied(method, transport)) {
|
|
65622
|
+
return { name: method, description, args: argFields, status: "denied", reason: "HUMAN_ONLY" };
|
|
65623
|
+
}
|
|
65597
65624
|
if (METHOD_GRANT_MAP[method]?.kind === "capability-scoped") {
|
|
65598
65625
|
return {
|
|
65599
65626
|
name: method,
|
|
@@ -65611,7 +65638,7 @@ function computeMethodAccess(args) {
|
|
|
65611
65638
|
}
|
|
65612
65639
|
|
|
65613
65640
|
// src/version.ts
|
|
65614
|
-
var version = "0.2.
|
|
65641
|
+
var version = "0.2.497".length > 0 ? "0.2.497" : "dev";
|
|
65615
65642
|
|
|
65616
65643
|
// src/cli-probe/probe.ts
|
|
65617
65644
|
var fs72 = __toESM(require("fs"), 1);
|
|
@@ -65708,14 +65735,17 @@ function buildMetaHandlers(deps) {
|
|
|
65708
65735
|
};
|
|
65709
65736
|
}
|
|
65710
65737
|
function buildMetaMethodsHandler(deps) {
|
|
65711
|
-
return async (frame,
|
|
65738
|
+
return async (frame, client, ctx) => {
|
|
65712
65739
|
const grants = ctx?.grants ?? [];
|
|
65713
65740
|
const { method } = MetaMethodsArgs.parse(frame);
|
|
65714
65741
|
const compute = (m2) => computeMethodAccess({
|
|
65715
65742
|
method: m2,
|
|
65716
65743
|
grants,
|
|
65717
65744
|
feishuActive: deps.feishuActive(),
|
|
65718
|
-
isImplemented: deps.isImplemented
|
|
65745
|
+
isImplemented: deps.isImplemented,
|
|
65746
|
+
// 只认人手的 method 对程序调用方报 denied(HUMAN_ONLY)——`list` tool 唯一的消费场景
|
|
65747
|
+
// 就是 agent,让它一开始就看不见,省掉「先发现再撞墙」那一轮。
|
|
65748
|
+
transport: client.transport
|
|
65719
65749
|
});
|
|
65720
65750
|
if (method !== void 0) {
|
|
65721
65751
|
if (!isMethodName(method)) {
|
|
@@ -69261,6 +69291,12 @@ async function dispatchRpc(method, frame, client, ctx, deps) {
|
|
|
69261
69291
|
`${method} requires feishu login (People/remote identity)`
|
|
69262
69292
|
);
|
|
69263
69293
|
}
|
|
69294
|
+
if (isHumanOnlyDenied(method, client.transport)) {
|
|
69295
|
+
throw new ClawdError(
|
|
69296
|
+
ERROR_CODES.UNAUTHORIZED,
|
|
69297
|
+
`${method} \u53EA\u80FD\u4ECE\u754C\u9762\u4E0A\u70B9\u2014\u2014\u5B83\u4F1A\u5728\u7EC4\u7EC7\u91CC\u5EFA\u4ED3\u5E93 / \u628A\u955C\u50CF\u63A8\u4E0A\u7EBF / \u5199\u51ED\u636E\uFF0C\u4E0D\u63A5\u53D7\u7A0B\u5E8F\u8C03\u7528`
|
|
69298
|
+
);
|
|
69299
|
+
}
|
|
69264
69300
|
const verdict = computeGrant(method);
|
|
69265
69301
|
if (verdict.kind === "check") {
|
|
69266
69302
|
const ok = assertGrant(ctx.grants, verdict.resource, verdict.action);
|
|
@@ -70960,6 +70996,8 @@ async function startDaemon(config) {
|
|
|
70960
70996
|
dispatch: (method, body, ctx) => {
|
|
70961
70997
|
const client = {
|
|
70962
70998
|
id: "http-rpc",
|
|
70999
|
+
// 本机 MCP server / 跨设备 peer / web 应用都从这条进来——程序入口,不是人手
|
|
71000
|
+
transport: "http",
|
|
70963
71001
|
subscribedSessions: /* @__PURE__ */ new Map(),
|
|
70964
71002
|
send() {
|
|
70965
71003
|
},
|
|
@@ -24505,8 +24505,11 @@ var RpcMethodInfoSchema = external_exports.object({
|
|
|
24505
24505
|
argsSchema: external_exports.record(external_exports.unknown()).optional(),
|
|
24506
24506
|
/**
|
|
24507
24507
|
* `denied` 必带:daemon error code(`UNAUTHORIZED` / `FEISHU_LOGIN_REQUIRED` /
|
|
24508
|
-
* `METHOD_NOT_IMPLEMENTED
|
|
24509
|
-
* `
|
|
24508
|
+
* `METHOD_NOT_IMPLEMENTED`),外加一个不是 error code 的 `HUMAN_ONLY`——
|
|
24509
|
+
* 「这条只认人手,去界面上点」(daemon `HUMAN_ONLY_METHODS`)。
|
|
24510
|
+
* 它**故意**不复用 `UNAUTHORIZED`:这个字段是给 agent 看的,报 UNAUTHORIZED 它会去找
|
|
24511
|
+
* 「我缺哪个授权」,而正确的反应是「让人来点」,两者该分得开。
|
|
24512
|
+
* `conditional` 必带:谁来做二次校验。`allowed` 恒无。
|
|
24510
24513
|
*/
|
|
24511
24514
|
reason: external_exports.string().optional()
|
|
24512
24515
|
});
|