@wirecat/zoom-cli 0.56.0 → 0.58.0
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 +1 -1
- package/dist/bin/zm.js +35 -5
- package/dist/bundle/all-profiles-RS5IWIGR.js +25 -0
- package/dist/bundle/answer-policy-R7VZMCGE.js +96 -0
- package/dist/bundle/anthropic-5QHQR4WF.js +70 -0
- package/dist/bundle/app-server-7LANSZGE.js +232 -0
- package/dist/bundle/bun-O6RL6LRQ.js +169 -0
- package/dist/bundle/bun-sqlite-PEJM6CS4.js +69 -0
- package/dist/bundle/chunk-24DLFGES.js +97 -0
- package/dist/bundle/chunk-27P22POE.js +1109 -0
- package/dist/bundle/chunk-3SCTDFNO.js +3398 -0
- package/dist/bundle/chunk-3SERIWJD.js +36139 -0
- package/dist/bundle/chunk-4AURKUDZ.js +60 -0
- package/dist/bundle/chunk-4NGLRHWO.js +24 -0
- package/dist/bundle/chunk-5D4AEUVA.js +24783 -0
- package/dist/bundle/chunk-5DVW77VC.js +789 -0
- package/dist/bundle/chunk-6CYLVFXM.js +9 -0
- package/dist/bundle/chunk-6FL25KC5.js +264 -0
- package/dist/bundle/chunk-7D2CD3E3.js +193 -0
- package/dist/bundle/chunk-7GVNQOV6.js +17 -0
- package/dist/bundle/chunk-7H3ZRDLW.js +630 -0
- package/dist/bundle/chunk-7Z4ANTAK.js +1095 -0
- package/dist/bundle/chunk-A6323R5P.js +22 -0
- package/dist/bundle/chunk-ADLS6FVG.js +24600 -0
- package/dist/bundle/chunk-AIXLOMH4.js +63 -0
- package/dist/bundle/chunk-AQDWGJZT.js +188 -0
- package/dist/bundle/chunk-B32SF7J3.js +18 -0
- package/dist/bundle/chunk-BAQLQIMI.js +1938 -0
- package/dist/bundle/chunk-BGILD4CI.js +1109 -0
- package/dist/bundle/chunk-BXZ6WSVF.js +100 -0
- package/dist/bundle/chunk-CTGI4ES2.js +138 -0
- package/dist/bundle/chunk-CVIKKIGE.js +76 -0
- package/dist/bundle/chunk-DDYR6DYL.js +78 -0
- package/dist/bundle/chunk-DFDN6AUB.js +21 -0
- package/dist/bundle/chunk-DP5DX45H.js +151 -0
- package/dist/bundle/chunk-DXKVEOSS.js +53 -0
- package/dist/bundle/chunk-DXZTLB24.js +120 -0
- package/dist/bundle/chunk-G27MRA24.js +82 -0
- package/dist/bundle/chunk-HTQTIKWP.js +928 -0
- package/dist/bundle/chunk-IYAGQXED.js +433 -0
- package/dist/bundle/chunk-K76WFW4I.js +124 -0
- package/dist/bundle/chunk-KVHRHBLY.js +884 -0
- package/dist/bundle/chunk-L2UIJDWB.js +31 -0
- package/dist/bundle/chunk-L3VS3H34.js +482 -0
- package/dist/bundle/chunk-MBT7GP7K.js +1970 -0
- package/dist/bundle/chunk-MFS52LTZ.js +570 -0
- package/dist/bundle/chunk-MMT46EN4.js +29 -0
- package/dist/bundle/chunk-MNUTWGSA.js +6094 -0
- package/dist/bundle/chunk-N7GAQ27N.js +82 -0
- package/dist/bundle/chunk-NDXAZB5Z.js +409 -0
- package/dist/bundle/chunk-NOKFJJPA.js +1028 -0
- package/dist/bundle/chunk-NW7IMGRR.js +6848 -0
- package/dist/bundle/chunk-O5EHUB2V.js +2 -0
- package/dist/bundle/chunk-OBZWUNO4.js +160 -0
- package/dist/bundle/chunk-PACC5N6T.js +240 -0
- package/dist/bundle/chunk-PF25S7L4.js +422 -0
- package/dist/bundle/chunk-PKTFZAXG.js +48 -0
- package/dist/bundle/chunk-PNBEREOU.js +35626 -0
- package/dist/bundle/chunk-POOGFSRA.js +385 -0
- package/dist/bundle/chunk-PP3JGQQE.js +3517 -0
- package/dist/bundle/chunk-Q2Z3VCM4.js +2 -0
- package/dist/bundle/chunk-QCFHL4ES.js +45 -0
- package/dist/bundle/chunk-QFGBMS67.js +492 -0
- package/dist/bundle/chunk-RUP467ZX.js +948 -0
- package/dist/bundle/chunk-RXDIG23Z.js +166 -0
- package/dist/bundle/chunk-SIA7HJE2.js +8192 -0
- package/dist/bundle/chunk-SL3SXQZ5.js +100 -0
- package/dist/bundle/chunk-SV5L36WK.js +19 -0
- package/dist/bundle/chunk-T6AAM7UT.js +846 -0
- package/dist/bundle/chunk-U6QW67SU.js +18673 -0
- package/dist/bundle/chunk-UKR7KH3H.js +288 -0
- package/dist/bundle/chunk-UOFOMU3T.js +836 -0
- package/dist/bundle/chunk-URO44C5T.js +3570 -0
- package/dist/bundle/chunk-UXM7I35J.js +281 -0
- package/dist/bundle/chunk-UYJUTZTT.js +73 -0
- package/dist/bundle/chunk-VOAVOK4I.js +1146 -0
- package/dist/bundle/chunk-VSUY7PDW.js +192 -0
- package/dist/bundle/chunk-VYUSEJE4.js +98 -0
- package/dist/bundle/chunk-XFCSPOLZ.js +25 -0
- package/dist/bundle/chunk-XT7XVPEM.js +538 -0
- package/dist/bundle/chunk-Y5E2WNWB.js +35 -0
- package/dist/bundle/chunk-YIFIY7ZE.js +58 -0
- package/dist/bundle/chunk-YIMI6O7R.js +5292 -0
- package/dist/bundle/chunk-YJRMMZI5.js +275 -0
- package/dist/bundle/chunk-YSHSCBPM.js +2315 -0
- package/dist/bundle/chunk-ZC5UXEIH.js +215 -0
- package/dist/bundle/chunk-ZHXIXDH5.js +161 -0
- package/dist/bundle/chunk-ZTOAAYFV.js +122 -0
- package/dist/bundle/chunk-ZVVMGPBJ.js +50 -0
- package/dist/bundle/cli-IQTASP44.js +831 -0
- package/dist/bundle/command-contract-WHZPF7NA.js +38 -0
- package/dist/bundle/config-IP5SGHKN.js +79 -0
- package/dist/bundle/dist-WT73DF46.js +136 -0
- package/dist/bundle/dist-XUFQCJXW.js +7577 -0
- package/dist/bundle/echarts-LD3AI55P.js +42501 -0
- package/dist/bundle/embed-XEMH4LNX.js +35 -0
- package/dist/bundle/embedder-ZCYKSKAE.js +108 -0
- package/dist/bundle/first-run-LGYDLIUM.js +23 -0
- package/dist/bundle/first-screen-LYQKPNF4.js +36 -0
- package/dist/bundle/folders-5ZBUQHAM.js +13 -0
- package/dist/bundle/instructions-RZMSW3OC.js +11 -0
- package/dist/bundle/main-NKY3JGXY.js +130 -0
- package/dist/bundle/mcp-7OXUHLTO.js +189 -0
- package/dist/bundle/mcp-OQBZXELQ.js +165 -0
- package/dist/bundle/mcp-VISEXTVC.js +92 -0
- package/dist/bundle/meetings-XPBHVZAU.js +215 -0
- package/dist/bundle/node-P4E63KXA.js +2340 -0
- package/dist/bundle/node-TLZSIHIJ.js +21 -0
- package/dist/bundle/node-ZRLYQL7J.js +176 -0
- package/dist/bundle/node-sqlite-BBEDYBWO.js +45 -0
- package/dist/bundle/oauth-UHVRGKZU.js +17 -0
- package/dist/bundle/open-J4FCAUAJ.js +19 -0
- package/dist/bundle/output-file-SXV2ANW7.js +63 -0
- package/dist/bundle/process-LL77573L.js +91 -0
- package/dist/bundle/program-EPMIJCGA.js +5845 -0
- package/dist/bundle/prompt-LUUMQTMY.js +12 -0
- package/dist/bundle/recognize-EMHQX4XF.js +190 -0
- package/dist/bundle/remote-ZXS6D7VB.js +26 -0
- package/dist/bundle/rerank-WP7RKZNB.js +49 -0
- package/dist/bundle/run-log-GS2L66G6.js +111 -0
- package/dist/bundle/serve-L6KLLXK2.js +19 -0
- package/dist/bundle/server-NOFYENP5.js +53 -0
- package/dist/bundle/server-P5TXAPBY.js +66 -0
- package/dist/bundle/services-SPOEWVK3.js +330 -0
- package/dist/bundle/speech-6OBAKMND.js +44 -0
- package/dist/bundle/state-HN5EJKXQ.js +33 -0
- package/dist/bundle/store-LEU3M6IN.js +124 -0
- package/dist/bundle/store-ZP2URKET.js +141 -0
- package/dist/bundle/store-connection-I53XZ2TS.js +76 -0
- package/dist/bundle/store-maintenance-command-PSCHEHHY.js +54 -0
- package/dist/bundle/streaming-AK6Q2ZGQ.js +15 -0
- package/dist/bundle/tokens-CCM3D4ZT.js +17 -0
- package/dist/bundle/zm.js +8 -0
- package/dist/contract-overrides.d.ts.map +1 -1
- package/dist/contract-overrides.js +29 -17
- package/dist/contract-overrides.js.map +1 -1
- package/dist/mcp-command.d.ts +3 -2
- package/dist/mcp-command.d.ts.map +1 -1
- package/dist/mcp-command.js +62 -10
- package/dist/mcp-command.js.map +1 -1
- package/dist/program-bindings.d.ts.map +1 -1
- package/dist/program-bindings.js +1 -0
- package/dist/program-bindings.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +7 -5
- package/skills/zoom-cli/SKILL.md +2 -0
|
@@ -0,0 +1,422 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
CliError
|
|
5
|
+
} from "./chunk-YIMI6O7R.js";
|
|
6
|
+
import {
|
|
7
|
+
__name
|
|
8
|
+
} from "./chunk-ZVVMGPBJ.js";
|
|
9
|
+
|
|
10
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.473.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_39633e3162553a2c86dde989a9811fcb/node_modules/@wirecat/cli-core/dist/sends/permissions.js
|
|
11
|
+
var LEVELS = ["deny", "readonly", "ask", "allow"];
|
|
12
|
+
var DANGEROUS = /* @__PURE__ */ new Set(["messages.delete", "bot.messages.delete", "topics.delete", "chats.delete", "chats.clear"]);
|
|
13
|
+
var skipFlagFor = /* @__PURE__ */ __name((key) => DANGEROUS.has(key) ? "--allow-dangerous" : "--yes", "skipFlagFor");
|
|
14
|
+
var DEFAULT_PERMISSIONS = {
|
|
15
|
+
"messages.delete": "ask",
|
|
16
|
+
"account.sessions.end": "ask",
|
|
17
|
+
"bot.messages.delete": "ask",
|
|
18
|
+
"topics.enable": "ask",
|
|
19
|
+
"topics.delete": "ask",
|
|
20
|
+
"chats.delete": "ask",
|
|
21
|
+
"chats.clear": "ask",
|
|
22
|
+
// NEED-568: a rule writes to people with nobody typing a command; it waits for the owner's own allow.
|
|
23
|
+
"replies.send": "deny",
|
|
24
|
+
// NEED-1662: an agent that changes settings, schedules or recipients could lift its own limits; the owner opts in.
|
|
25
|
+
"mcp.authority": "deny",
|
|
26
|
+
// NEED-1663: writes no level stopped before, so MCP could not offer them; over MCP `ask` goes ahead.
|
|
27
|
+
"store.backup": "ask",
|
|
28
|
+
"store.restore": "ask",
|
|
29
|
+
"store.migrate": "ask",
|
|
30
|
+
"store.repair": "ask",
|
|
31
|
+
"store.reset": "ask",
|
|
32
|
+
"store.clear": "ask",
|
|
33
|
+
"store.decrypt": "ask",
|
|
34
|
+
"store.copies.delete": "ask",
|
|
35
|
+
"server.start": "ask",
|
|
36
|
+
"server.stop": "ask",
|
|
37
|
+
"server.restart": "ask",
|
|
38
|
+
"models.download": "ask",
|
|
39
|
+
"images.models.download": "ask",
|
|
40
|
+
"schedule.run": "ask",
|
|
41
|
+
"schedule.exec": "ask",
|
|
42
|
+
"doctor.reports.create": "ask"
|
|
43
|
+
};
|
|
44
|
+
var KEYED_UNDER_HOUSEKEEPING = new Set(Object.keys(DEFAULT_PERMISSIONS).filter((key) => /^(store|server|models|images|schedule|doctor)\./.test(key)));
|
|
45
|
+
var AUTHORITY_KEY = "mcp.authority";
|
|
46
|
+
var authorityAllowed = /* @__PURE__ */ __name((levels) => {
|
|
47
|
+
const { level } = levelFor(levels, AUTHORITY_KEY);
|
|
48
|
+
return level === "allow" || level === "ask";
|
|
49
|
+
}, "authorityAllowed");
|
|
50
|
+
var BOT_API_KEY = "bot.api";
|
|
51
|
+
var isBotApi = /* @__PURE__ */ __name((path) => path[0] === "bot" && path[1] === "api", "isBotApi");
|
|
52
|
+
var botApiAllowed = /* @__PURE__ */ __name((levels) => {
|
|
53
|
+
const { level } = levelFor(levels, BOT_API_KEY, { ...DEFAULT_PERMISSIONS, [BOT_API_KEY]: "deny" });
|
|
54
|
+
return level === "allow" || level === "ask";
|
|
55
|
+
}, "botApiAllowed");
|
|
56
|
+
var RESOURCES = [
|
|
57
|
+
"messages",
|
|
58
|
+
"drafts",
|
|
59
|
+
"reactions",
|
|
60
|
+
"polls",
|
|
61
|
+
"topics",
|
|
62
|
+
"chats",
|
|
63
|
+
"contacts",
|
|
64
|
+
"account",
|
|
65
|
+
"bot",
|
|
66
|
+
"conversations",
|
|
67
|
+
"tags",
|
|
68
|
+
"mentions",
|
|
69
|
+
"search",
|
|
70
|
+
"searches",
|
|
71
|
+
"tasks",
|
|
72
|
+
"replies",
|
|
73
|
+
"attachments",
|
|
74
|
+
"stats",
|
|
75
|
+
"store",
|
|
76
|
+
"metadata",
|
|
77
|
+
"mcp",
|
|
78
|
+
"server",
|
|
79
|
+
"models",
|
|
80
|
+
"schedule",
|
|
81
|
+
"doctor",
|
|
82
|
+
"images"
|
|
83
|
+
];
|
|
84
|
+
var layerPermissions = /* @__PURE__ */ __name((layers) => {
|
|
85
|
+
const levels = {};
|
|
86
|
+
const sources = {};
|
|
87
|
+
for (const [from, layer] of layers) {
|
|
88
|
+
const nearer = Object.keys(levels);
|
|
89
|
+
for (const [key, level] of Object.entries(layer ?? {})) {
|
|
90
|
+
if (nearer.some((named) => key === named || key.startsWith(`${named}.`)))
|
|
91
|
+
continue;
|
|
92
|
+
levels[key] = level;
|
|
93
|
+
sources[key] = from;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
return { levels, sources };
|
|
97
|
+
}, "layerPermissions");
|
|
98
|
+
var CEILING_KEY = "*";
|
|
99
|
+
var ALLOWED = { level: "allow", key: null };
|
|
100
|
+
var ORDER = { deny: 0, readonly: 1, ask: 2, allow: 3 };
|
|
101
|
+
var nearest = /* @__PURE__ */ __name((levels, key) => {
|
|
102
|
+
for (let parts = key.split("."); parts.length > 0; parts = parts.slice(0, -1)) {
|
|
103
|
+
const named = parts.join(".");
|
|
104
|
+
const level = levels[named];
|
|
105
|
+
if (level)
|
|
106
|
+
return { level, key: named, depth: parts.length };
|
|
107
|
+
}
|
|
108
|
+
return void 0;
|
|
109
|
+
}, "nearest");
|
|
110
|
+
var levelFor = /* @__PURE__ */ __name((permissions, key, defaults = DEFAULT_PERMISSIONS) => {
|
|
111
|
+
const found = profileLevel(permissions, key, defaults);
|
|
112
|
+
const ceiling = permissions[CEILING_KEY];
|
|
113
|
+
return ceiling && ORDER[ceiling] < ORDER[found.level] ? { level: ceiling, key: CEILING_KEY } : found;
|
|
114
|
+
}, "levelFor");
|
|
115
|
+
var profileLevel = /* @__PURE__ */ __name((permissions, key, defaults) => {
|
|
116
|
+
const own = nearest(permissions, key);
|
|
117
|
+
const builtIn = nearest(defaults, key);
|
|
118
|
+
if (!builtIn || own && own.depth >= builtIn.depth)
|
|
119
|
+
return own ? { level: own.level, key: own.key } : ALLOWED;
|
|
120
|
+
if (!own || ORDER[builtIn.level] <= ORDER[own.level])
|
|
121
|
+
return { level: builtIn.level, key: builtIn.key };
|
|
122
|
+
return { level: own.level, key: own.key };
|
|
123
|
+
}, "profileLevel");
|
|
124
|
+
var CHAT_KEYS = {
|
|
125
|
+
settings: "chats.update",
|
|
126
|
+
"requests.accept": "chats.requests.confirm",
|
|
127
|
+
"requests.decline": "chats.requests.reject",
|
|
128
|
+
"link.create": "chats.links.create",
|
|
129
|
+
"link.reset": "chats.links.reset",
|
|
130
|
+
"link.revoke": "chats.links.remove",
|
|
131
|
+
"link.update": "chats.links.update"
|
|
132
|
+
};
|
|
133
|
+
var ACCOUNT_KEYS = {
|
|
134
|
+
"contact-add": "contacts.add",
|
|
135
|
+
"contact-remove": "contacts.remove",
|
|
136
|
+
"contact-import": "contacts.import",
|
|
137
|
+
"contact-rename": "contacts.rename",
|
|
138
|
+
"contact-block": "contacts.block",
|
|
139
|
+
"contact-unblock": "contacts.unblock",
|
|
140
|
+
profile: "account.update",
|
|
141
|
+
"folder-create": "chats.folders.create",
|
|
142
|
+
"folder-update": "chats.folders.update",
|
|
143
|
+
"folder-delete": "chats.folders.delete",
|
|
144
|
+
"folder-order": "chats.folders.order",
|
|
145
|
+
"folder-join": "chats.folders.join",
|
|
146
|
+
"sessions-end": "account.sessions.end",
|
|
147
|
+
"chat-mute": "chats.mute",
|
|
148
|
+
"chat-unmute": "chats.unmute",
|
|
149
|
+
"chat-archive": "chats.archive",
|
|
150
|
+
"chat-unarchive": "chats.unarchive",
|
|
151
|
+
"chat-pin": "chats.pin",
|
|
152
|
+
"chat-unpin": "chats.unpin",
|
|
153
|
+
"chat-mark-unread": "chats.mark-unread",
|
|
154
|
+
"message-star": "messages.star",
|
|
155
|
+
"message-unstar": "messages.unstar",
|
|
156
|
+
privacy: "account.privacy.set"
|
|
157
|
+
};
|
|
158
|
+
var KIND_KEYS = {
|
|
159
|
+
message: "messages.send",
|
|
160
|
+
forward: "messages.forward",
|
|
161
|
+
edit: "messages.edit",
|
|
162
|
+
pin: "messages.pin",
|
|
163
|
+
reaction: "reactions",
|
|
164
|
+
read: "chats.mark-read",
|
|
165
|
+
delete: "messages.delete"
|
|
166
|
+
};
|
|
167
|
+
var keyForWrite = /* @__PURE__ */ __name((kind, action) => {
|
|
168
|
+
if (kind === "chat")
|
|
169
|
+
return CHAT_KEYS[action] ?? `chats.${action ?? "update"}`;
|
|
170
|
+
if (kind === "account") {
|
|
171
|
+
const key = ACCOUNT_KEYS[action];
|
|
172
|
+
if (!key)
|
|
173
|
+
throw new Error(`an account change without a known action: ${action}`);
|
|
174
|
+
return key;
|
|
175
|
+
}
|
|
176
|
+
return KIND_KEYS[kind];
|
|
177
|
+
}, "keyForWrite");
|
|
178
|
+
var writeOfKey = /* @__PURE__ */ __name((key) => {
|
|
179
|
+
const account = Object.entries(ACCOUNT_KEYS).find(([, named]) => named === key)?.[0];
|
|
180
|
+
if (account)
|
|
181
|
+
return { kind: "account", action: account };
|
|
182
|
+
const kind = Object.entries(KIND_KEYS).find(([, named]) => named === key || key.startsWith(`${named}.`))?.[0];
|
|
183
|
+
if (kind)
|
|
184
|
+
return { kind };
|
|
185
|
+
if (key === "messages.unpin")
|
|
186
|
+
return { kind: "pin" };
|
|
187
|
+
if (key.startsWith("chats.")) {
|
|
188
|
+
const action = Object.entries(CHAT_KEYS).find(([, named]) => named === key)?.[0] ?? key.slice("chats.".length);
|
|
189
|
+
return { kind: "chat", action };
|
|
190
|
+
}
|
|
191
|
+
return {};
|
|
192
|
+
}, "writeOfKey");
|
|
193
|
+
var NAMED_WRITE_KEYS = [
|
|
194
|
+
"drafts",
|
|
195
|
+
"store.gaps.repair",
|
|
196
|
+
"messages.sync-first",
|
|
197
|
+
"messages.server-search",
|
|
198
|
+
"messages.press",
|
|
199
|
+
"chats.start",
|
|
200
|
+
"chats.app",
|
|
201
|
+
"stats.messages.counters.sync",
|
|
202
|
+
"stats.messages.show.sync-first",
|
|
203
|
+
"stats.messages.top.sync-first",
|
|
204
|
+
"stats.contacts.top.sync-first",
|
|
205
|
+
"account.sessions.list",
|
|
206
|
+
"attachments.extract",
|
|
207
|
+
"attachments.move",
|
|
208
|
+
"attachments.update",
|
|
209
|
+
"bot.callbacks.answer",
|
|
210
|
+
"bot.chats.action",
|
|
211
|
+
"bot.chats.admins.add",
|
|
212
|
+
"bot.chats.admins.remove",
|
|
213
|
+
"bot.chats.leave",
|
|
214
|
+
"bot.chats.members.remove",
|
|
215
|
+
"bot.chats.moderate",
|
|
216
|
+
"bot.messages.delete",
|
|
217
|
+
"bot.messages.edit",
|
|
218
|
+
"bot.messages.pin",
|
|
219
|
+
"bot.messages.send",
|
|
220
|
+
"bot.messages.unpin",
|
|
221
|
+
"chats.admins.add",
|
|
222
|
+
"chats.admins.remove",
|
|
223
|
+
"chats.links.create",
|
|
224
|
+
"chats.links.reset",
|
|
225
|
+
"chats.links.remove",
|
|
226
|
+
"chats.links.update",
|
|
227
|
+
"chats.members.add",
|
|
228
|
+
"chats.members.remove",
|
|
229
|
+
"chats.moderate",
|
|
230
|
+
"conversations.embeddings",
|
|
231
|
+
"conversations.links",
|
|
232
|
+
"polls.close",
|
|
233
|
+
"polls.create",
|
|
234
|
+
"polls.vote",
|
|
235
|
+
"searches.clear",
|
|
236
|
+
"searches.create",
|
|
237
|
+
"searches.delete",
|
|
238
|
+
"contacts.aliases.set",
|
|
239
|
+
"contacts.aliases.remove",
|
|
240
|
+
"contacts.notes.add",
|
|
241
|
+
"contacts.notes.edit",
|
|
242
|
+
"contacts.notes.remove",
|
|
243
|
+
"tags.rebuild",
|
|
244
|
+
"metadata.sync",
|
|
245
|
+
"mentions.rebuild",
|
|
246
|
+
"mentions.confirm",
|
|
247
|
+
"mentions.reject",
|
|
248
|
+
"tags.add",
|
|
249
|
+
"tags.remove",
|
|
250
|
+
"tasks.add",
|
|
251
|
+
"tasks.claim",
|
|
252
|
+
"tasks.close",
|
|
253
|
+
"tasks.duplicates.defer",
|
|
254
|
+
"tasks.duplicates.reject",
|
|
255
|
+
"tasks.link",
|
|
256
|
+
"tasks.merge",
|
|
257
|
+
"tasks.update",
|
|
258
|
+
"tasks.release",
|
|
259
|
+
"tasks.scan",
|
|
260
|
+
"tasks.unmerge",
|
|
261
|
+
"topics.create",
|
|
262
|
+
"topics.edit",
|
|
263
|
+
"topics.enable"
|
|
264
|
+
];
|
|
265
|
+
var WRITE_KEYS = [
|
|
266
|
+
.../* @__PURE__ */ new Set([
|
|
267
|
+
...NAMED_WRITE_KEYS,
|
|
268
|
+
...Object.keys(DEFAULT_PERMISSIONS),
|
|
269
|
+
...Object.values(KIND_KEYS),
|
|
270
|
+
...Object.values(ACCOUNT_KEYS),
|
|
271
|
+
...Object.values(CHAT_KEYS)
|
|
272
|
+
])
|
|
273
|
+
];
|
|
274
|
+
var HOUSEKEEPING = /* @__PURE__ */ new Set([
|
|
275
|
+
"help",
|
|
276
|
+
"guide",
|
|
277
|
+
"config",
|
|
278
|
+
"session",
|
|
279
|
+
"doctor",
|
|
280
|
+
"commands",
|
|
281
|
+
"complete",
|
|
282
|
+
"upgrade",
|
|
283
|
+
"skill",
|
|
284
|
+
"models",
|
|
285
|
+
"server",
|
|
286
|
+
// What a schedule runs is checked by its own key when it runs; an agent runs read-only.
|
|
287
|
+
"schedule",
|
|
288
|
+
"runs",
|
|
289
|
+
"sends",
|
|
290
|
+
"recipients",
|
|
291
|
+
"flood",
|
|
292
|
+
"mcp",
|
|
293
|
+
// Its commands read the rules or flip the pause switch; what a rule sends is checked as `replies.send`.
|
|
294
|
+
"replies"
|
|
295
|
+
]);
|
|
296
|
+
var BOT_HOUSEKEEPING = /* @__PURE__ */ new Set(["auth", "list", "sends", "recipients", "mcp"]);
|
|
297
|
+
var STORE_MAINTENANCE = /* @__PURE__ */ new Set(["info", "check", "copies"]);
|
|
298
|
+
var SHOW_MESSAGES = /* @__PURE__ */ new Set(["inbox", "review", "watch", "serve", "store", "conversations"]);
|
|
299
|
+
var readKeysForCommand = /* @__PURE__ */ __name((path) => {
|
|
300
|
+
if (path[0] === "bot")
|
|
301
|
+
return readKeysForCommand(path.slice(1)).map((key2) => `bot.${key2}`);
|
|
302
|
+
const key = keyForCommand(path);
|
|
303
|
+
if (!key)
|
|
304
|
+
return [];
|
|
305
|
+
if (path[0] === "attachments" && path[1] === "download")
|
|
306
|
+
return [key, "messages", "chats"];
|
|
307
|
+
if (path[0] === "attachments" && (path[1] === "extract" || path[1] === "show"))
|
|
308
|
+
return [key, "messages"];
|
|
309
|
+
if (path[0] === "store" && path[1] === "gaps" && path[2] === "repair")
|
|
310
|
+
return [key, "messages"];
|
|
311
|
+
if (path[0] === "store" && ["reset", "clear", "decrypt"].includes(path[1] ?? ""))
|
|
312
|
+
return [key, "messages"];
|
|
313
|
+
if (path[0] === "search") {
|
|
314
|
+
if (path[1] === "notes")
|
|
315
|
+
return [key];
|
|
316
|
+
if (path[1] === "topics")
|
|
317
|
+
return [key, "topics"];
|
|
318
|
+
if (path[1] === "conversations")
|
|
319
|
+
return [key, "messages", "conversations"];
|
|
320
|
+
return [key, "messages"];
|
|
321
|
+
}
|
|
322
|
+
if (path[0] !== "stats")
|
|
323
|
+
return [key];
|
|
324
|
+
const resource = path[1] === "charts" ? "chats" : path[1];
|
|
325
|
+
return [
|
|
326
|
+
.../* @__PURE__ */ new Set([
|
|
327
|
+
key,
|
|
328
|
+
"messages",
|
|
329
|
+
...["chats", "contacts", "tasks"].includes(resource ?? "") ? [resource] : []
|
|
330
|
+
])
|
|
331
|
+
];
|
|
332
|
+
}, "readKeysForCommand");
|
|
333
|
+
var keyForCommand = /* @__PURE__ */ __name((path) => {
|
|
334
|
+
if (path.length === 0)
|
|
335
|
+
return null;
|
|
336
|
+
const [top, next] = path;
|
|
337
|
+
if (top === "bot") {
|
|
338
|
+
if (next === void 0 || BOT_HOUSEKEEPING.has(next))
|
|
339
|
+
return null;
|
|
340
|
+
const inner = keyForCommand(path.slice(1));
|
|
341
|
+
return `bot.${inner ?? path.slice(1).join(".")}`;
|
|
342
|
+
}
|
|
343
|
+
if (KEYED_UNDER_HOUSEKEEPING.has(path.join(".")))
|
|
344
|
+
return path.join(".");
|
|
345
|
+
if (top === void 0 || HOUSEKEEPING.has(top) || top === "search" && next === "runs")
|
|
346
|
+
return null;
|
|
347
|
+
if (top === "images" && next === "models")
|
|
348
|
+
return null;
|
|
349
|
+
if (top === "attachments" && (next === "check" || next === "jobs"))
|
|
350
|
+
return null;
|
|
351
|
+
if (top === "attachments" && next === "download")
|
|
352
|
+
return "messages";
|
|
353
|
+
if (top === "store" && next !== void 0 && STORE_MAINTENANCE.has(next))
|
|
354
|
+
return null;
|
|
355
|
+
if (top === "conversations" && next === "links")
|
|
356
|
+
return path[2] === "rebuild" ? "conversations.links.rebuild" : "conversations.links";
|
|
357
|
+
if (top === "conversations" && (next === "embeddings" || next === "embed") || top === "images" && next === "embed" || top === "conversations" && next === "rebuild")
|
|
358
|
+
return "conversations.embeddings";
|
|
359
|
+
if (top === "attachments" && next === "list" || top === "chats" && next === "documents")
|
|
360
|
+
return "messages";
|
|
361
|
+
if (top === "mentions")
|
|
362
|
+
return next === "rebuild" || next === "confirm" || next === "reject" ? `mentions.${next}` : "messages";
|
|
363
|
+
if (top === "store" && (next === "gaps" || next === "jobs"))
|
|
364
|
+
return path.join(".");
|
|
365
|
+
if (SHOW_MESSAGES.has(top) || top === "contacts" && (next === "context" || next === "prepare" || next === "events"))
|
|
366
|
+
return "messages";
|
|
367
|
+
if (RESOURCES.includes(top))
|
|
368
|
+
return path.join(".");
|
|
369
|
+
return void 0;
|
|
370
|
+
}, "keyForCommand");
|
|
371
|
+
var RESOURCE_KEY = new RegExp(`^(${RESOURCES.join("|")})(\\.[a-z][a-z-]*)*$`);
|
|
372
|
+
var COMMAND_PATH_KEY = /^[a-z][a-z-]*(\.[a-zA-Z][a-zA-Z-]*)*$/;
|
|
373
|
+
var permissionOverrides = /* @__PURE__ */ __name((entries = [], shape = RESOURCE_KEY) => {
|
|
374
|
+
const levels = {};
|
|
375
|
+
const example = shape === RESOURCE_KEY ? "messages.send=allow" : "api=readonly";
|
|
376
|
+
for (const entry of entries) {
|
|
377
|
+
const [key = "", level = "", extra] = entry.split("=");
|
|
378
|
+
if (!shape.test(key) || !LEVELS.includes(level) || extra !== void 0)
|
|
379
|
+
throw new CliError("validation_error", `--permission takes a command path and level, e.g. ${example} (deny, readonly, ask, allow)`);
|
|
380
|
+
levels[key] = level;
|
|
381
|
+
}
|
|
382
|
+
return levels;
|
|
383
|
+
}, "permissionOverrides");
|
|
384
|
+
var assertOverridesTighten = /* @__PURE__ */ __name((overrides, profile, defaults = DEFAULT_PERMISSIONS) => {
|
|
385
|
+
for (const [key, level] of Object.entries(overrides)) {
|
|
386
|
+
const under = Object.keys(profile).filter((named) => named.startsWith(`${key}.`));
|
|
387
|
+
const lifted = [key, ...under].find((named) => ORDER[level] > ORDER[levelFor(profile, named, defaults).level]);
|
|
388
|
+
if (lifted !== void 0)
|
|
389
|
+
throw new CliError("validation_error", `--permission ${key}=${level} would loosen ${lifted} from ${levelFor(profile, lifted, defaults).level}; it only tightens \u2014 change the profile's permissions to loosen it`, { key, lifted });
|
|
390
|
+
}
|
|
391
|
+
}, "assertOverridesTighten");
|
|
392
|
+
var assertRetentionEvidenceRead = /* @__PURE__ */ __name((permissions) => {
|
|
393
|
+
for (const permission of ["stats.chats.retention", "chats"]) {
|
|
394
|
+
if (levelFor(permissions, permission).level === "deny")
|
|
395
|
+
throw new CliError("permission_error", `profile denies ${permission}`, { permission });
|
|
396
|
+
}
|
|
397
|
+
}, "assertRetentionEvidenceRead");
|
|
398
|
+
|
|
399
|
+
export {
|
|
400
|
+
LEVELS,
|
|
401
|
+
skipFlagFor,
|
|
402
|
+
DEFAULT_PERMISSIONS,
|
|
403
|
+
AUTHORITY_KEY,
|
|
404
|
+
authorityAllowed,
|
|
405
|
+
BOT_API_KEY,
|
|
406
|
+
isBotApi,
|
|
407
|
+
botApiAllowed,
|
|
408
|
+
RESOURCES,
|
|
409
|
+
layerPermissions,
|
|
410
|
+
CEILING_KEY,
|
|
411
|
+
levelFor,
|
|
412
|
+
keyForWrite,
|
|
413
|
+
writeOfKey,
|
|
414
|
+
WRITE_KEYS,
|
|
415
|
+
readKeysForCommand,
|
|
416
|
+
keyForCommand,
|
|
417
|
+
RESOURCE_KEY,
|
|
418
|
+
COMMAND_PATH_KEY,
|
|
419
|
+
permissionOverrides,
|
|
420
|
+
assertOverridesTighten,
|
|
421
|
+
assertRetentionEvidenceRead
|
|
422
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
CliError
|
|
5
|
+
} from "./chunk-YIMI6O7R.js";
|
|
6
|
+
import {
|
|
7
|
+
__name
|
|
8
|
+
} from "./chunk-ZVVMGPBJ.js";
|
|
9
|
+
|
|
10
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.473.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_39633e3162553a2c86dde989a9811fcb/node_modules/@wirecat/cli-core/dist/http/public-url.js
|
|
11
|
+
var EXAMPLE = "--public-url https://<name>.ts.net";
|
|
12
|
+
var publicUrlOf = /* @__PURE__ */ __name((given, { missing, reaches, path = false }) => {
|
|
13
|
+
if (!given)
|
|
14
|
+
throw new CliError("configuration_error", `${missing} needs the tunnel's address: ${EXAMPLE}`);
|
|
15
|
+
let url;
|
|
16
|
+
try {
|
|
17
|
+
url = new URL(given);
|
|
18
|
+
} catch {
|
|
19
|
+
throw new CliError("validation_error", `--public-url is not an address: ${EXAMPLE}`);
|
|
20
|
+
}
|
|
21
|
+
if (url.username || url.password)
|
|
22
|
+
throw new CliError("validation_error", "--public-url must not contain login credentials");
|
|
23
|
+
const local = url.protocol === "http:" && ["localhost", "127.0.0.1"].includes(url.hostname);
|
|
24
|
+
if (url.protocol !== "https:" && !local)
|
|
25
|
+
throw new CliError("validation_error", `--public-url must be https \u2014 ${reaches} through it`);
|
|
26
|
+
if (url.search || url.hash || !path && url.pathname !== "/")
|
|
27
|
+
throw new CliError("validation_error", path ? `--public-url is the tunnel's address, or a path of it, without a query: ${EXAMPLE}/tg` : `--public-url is the tunnel's address only, without a path: ${EXAMPLE}`);
|
|
28
|
+
if (path && !/^(\/[A-Za-z0-9_-][A-Za-z0-9._-]*)*\/?$/.test(url.pathname))
|
|
29
|
+
throw new CliError("validation_error", "--public-url's path takes letters, digits, dot, dash and underscore: /tg");
|
|
30
|
+
if (path)
|
|
31
|
+
url.pathname = url.pathname.replace(/\/+$/, "") || "/";
|
|
32
|
+
return url;
|
|
33
|
+
}, "publicUrlOf");
|
|
34
|
+
var portOf = /* @__PURE__ */ __name((given, fallback) => {
|
|
35
|
+
if (given === void 0)
|
|
36
|
+
return fallback;
|
|
37
|
+
const port = Number(given);
|
|
38
|
+
if (!Number.isInteger(port) || port < 1 || port > 65535)
|
|
39
|
+
throw new CliError("validation_error", "--port takes 1\u201365535");
|
|
40
|
+
return port;
|
|
41
|
+
}, "portOf");
|
|
42
|
+
var mcpUrlOf = /* @__PURE__ */ __name((publicUrl) => new URL(`${publicUrl.pathname.replace(/\/+$/, "")}/mcp`, publicUrl.origin), "mcpUrlOf");
|
|
43
|
+
|
|
44
|
+
export {
|
|
45
|
+
publicUrlOf,
|
|
46
|
+
portOf,
|
|
47
|
+
mcpUrlOf
|
|
48
|
+
};
|