openclaw-multi-auto 1.6.0 → 1.6.2
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/{audio-preflight-DpxQCpsA.js → audio-preflight-DoPfNXDz.js} +4 -4
- package/dist/{audio-transcription-runner-28fcRNNi.js → audio-transcription-runner-CzjuH3uL.js} +1 -1
- package/dist/build-info.json +3 -3
- package/dist/bundled/boot-md/handler.js +6 -6
- package/dist/bundled/session-memory/handler.js +6 -6
- package/dist/canvas-host/a2ui/.bundle.hash +1 -1
- package/dist/{chrome-DwizpzOC.js → chrome-DlhJHqj8.js} +8 -8
- package/dist/{deliver-D4o6VIur.js → deliver-CApVJA_l.js} +1 -1
- package/dist/{deliver-runtime-P-G3bPjW.js → deliver-runtime-D1z-h5eg.js} +3 -3
- package/dist/{deps-send-whatsapp.runtime-CJkTHkah.js → deps-send-whatsapp.runtime-Dz_4fi2D.js} +7 -7
- package/dist/{image-Bbn53mzj.js → image-B3Mz7N5I.js} +1 -1
- package/dist/{image-runtime-CVv2ra9J.js → image-runtime-DWjhow2W.js} +3 -3
- package/dist/llm-slug-generator.js +6 -6
- package/dist/{pi-embedded-BaGj07T0.js → pi-embedded-bcjMe3wj.js} +24 -24
- package/dist/{pi-embedded-helpers-wy0DZvx1.js → pi-embedded-helpers-D5yyGEvA.js} +3 -3
- package/dist/plugin-sdk/accounts-CJWOBzwB.js +35 -0
- package/dist/plugin-sdk/accounts-DP1-L-QS.js +288 -0
- package/dist/plugin-sdk/accounts-DZhWlEg3.js +46 -0
- package/dist/plugin-sdk/active-listener-B_sLJTXM.js +50 -0
- package/dist/plugin-sdk/api-key-rotation-BRE4X2tf.js +181 -0
- package/dist/plugin-sdk/audio-preflight-DGEUDxxR.js +69 -0
- package/dist/plugin-sdk/audio-transcription-runner-DkoPNPYt.js +2176 -0
- package/dist/plugin-sdk/audit-membership-runtime-DSBHHw7o.js +58 -0
- package/dist/plugin-sdk/channel-activity-F3d0yUwy.js +94 -0
- package/dist/plugin-sdk/channel-web-QF7EpjeP.js +2256 -0
- package/dist/plugin-sdk/chrome-BXoCyCkY.js +2415 -0
- package/dist/plugin-sdk/commands-registry-t7cXBTfN.js +1125 -0
- package/dist/plugin-sdk/compat.js +50 -50
- package/dist/plugin-sdk/config-BkEnz2Po.js +17913 -0
- package/dist/plugin-sdk/deliver-B6AG_l67.js +1694 -0
- package/dist/plugin-sdk/deliver-runtime-D585kJZc.js +32 -0
- package/dist/plugin-sdk/deps-send-discord.runtime-a_OKY2js.js +23 -0
- package/dist/plugin-sdk/deps-send-imessage.runtime-Baxy9TD4.js +22 -0
- package/dist/plugin-sdk/deps-send-signal.runtime-BwXoCrFl.js +21 -0
- package/dist/plugin-sdk/deps-send-slack.runtime-CLmKjgso.js +19 -0
- package/dist/plugin-sdk/deps-send-telegram.runtime-BKfdBKnZ.js +24 -0
- package/dist/plugin-sdk/deps-send-whatsapp.runtime-BOTwkbx_.js +57 -0
- package/dist/plugin-sdk/diagnostic-CsP-lEkI.js +319 -0
- package/dist/plugin-sdk/discord.js +6 -6
- package/dist/plugin-sdk/errors-DaiAM-yU.js +54 -0
- package/dist/plugin-sdk/fetch-guard-DETCcJzQ.js +156 -0
- package/dist/plugin-sdk/fs-safe-B8y811FR.js +352 -0
- package/dist/plugin-sdk/image-DjTEkYZE.js +2310 -0
- package/dist/plugin-sdk/image-ops-BSiMpAw4.js +584 -0
- package/dist/plugin-sdk/image-runtime-6xPp8m5a.js +25 -0
- package/dist/plugin-sdk/imessage.js +2 -2
- package/dist/plugin-sdk/ir-DQ7_HbvK.js +1296 -0
- package/dist/plugin-sdk/local-roots-BUP4YBmR.js +186 -0
- package/dist/plugin-sdk/logger-CZY9KIoY.js +1163 -0
- package/dist/plugin-sdk/login-BxEKLlCo.js +57 -0
- package/dist/plugin-sdk/login-qr-BQIpMPr9.js +320 -0
- package/dist/plugin-sdk/manager-I6KbPihW.js +3917 -0
- package/dist/plugin-sdk/manager-runtime-CFfYYWIQ.js +15 -0
- package/dist/plugin-sdk/outbound-NS6UHnB6.js +212 -0
- package/dist/plugin-sdk/outbound-attachment-Dy6fyf6H.js +19 -0
- package/dist/plugin-sdk/path-alias-guards-DBjLbIX_.js +43 -0
- package/dist/plugin-sdk/paths-vTM3Lh3X.js +166 -0
- package/dist/plugin-sdk/pi-embedded-helpers-1R1gu7eX.js +9627 -0
- package/dist/plugin-sdk/pi-model-discovery-runtime-Do9o-dUd.js +8 -0
- package/dist/plugin-sdk/pi-model-discovery-v-XPUOOf.js +134 -0
- package/dist/plugin-sdk/pi-tools.before-tool-call.runtime-D4sFsIks.js +354 -0
- package/dist/plugin-sdk/plugins-DeBZB9l_.js +864 -0
- package/dist/plugin-sdk/proxy-fetch-ChxOhWF4.js +38 -0
- package/dist/plugin-sdk/pw-ai-DEOmCSSC.js +1938 -0
- package/dist/plugin-sdk/qmd-manager-HyYKoEch.js +1448 -0
- package/dist/plugin-sdk/query-expansion-CeyKUeDW.js +1011 -0
- package/dist/plugin-sdk/redact-DjVX-1N3.js +319 -0
- package/dist/plugin-sdk/reply-DAo_Jt8K.js +97916 -0
- package/dist/plugin-sdk/resolve-outbound-target-B42qgQS9.js +40 -0
- package/dist/plugin-sdk/run-with-concurrency-Bt_ks0Qa.js +1994 -0
- package/dist/plugin-sdk/runtime-whatsapp-login.runtime-B6W989eF.js +10 -0
- package/dist/plugin-sdk/runtime-whatsapp-outbound.runtime-c_GDFy37.js +19 -0
- package/dist/plugin-sdk/send-CQpMudwO.js +2587 -0
- package/dist/plugin-sdk/send-DQHLzVyO.js +414 -0
- package/dist/plugin-sdk/send-DTB24bEF.js +3135 -0
- package/dist/plugin-sdk/send-DfHadjZ_.js +503 -0
- package/dist/plugin-sdk/send-XXlW2iny.js +540 -0
- package/dist/plugin-sdk/session-6TF6MyaC.js +169 -0
- package/dist/plugin-sdk/skill-commands-CkGeFUMl.js +342 -0
- package/dist/plugin-sdk/skills-CBkHBYPq.js +1428 -0
- package/dist/plugin-sdk/slack.js +2 -2
- package/dist/plugin-sdk/slash-commands.runtime-CxliuGaP.js +13 -0
- package/dist/plugin-sdk/slash-dispatch.runtime-DFaeYlJQ.js +52 -0
- package/dist/plugin-sdk/slash-skill-commands.runtime-0M0OLCxq.js +16 -0
- package/dist/plugin-sdk/ssrf-cFtplYtS.js +202 -0
- package/dist/plugin-sdk/store-5nyxY3WU.js +81 -0
- package/dist/plugin-sdk/subagent-registry-runtime-DCtmDwna.js +52 -0
- package/dist/plugin-sdk/tables-C47P4GTN.js +55 -0
- package/dist/plugin-sdk/target-errors-Blia4S69.js +195 -0
- package/dist/plugin-sdk/thinking-Bo2eosVa.js +1206 -0
- package/dist/plugin-sdk/tokens-DgNRBwIg.js +52 -0
- package/dist/plugin-sdk/tool-images-Gk_-0y2N.js +274 -0
- package/dist/plugin-sdk/web-CVxZbXyH.js +56 -0
- package/dist/plugin-sdk/whatsapp-actions-Bw0H9g-n.js +80 -0
- package/dist/{pw-ai-Cl1Lc7RC.js → pw-ai-CDQDCfUa.js} +1 -1
- package/dist/{slash-dispatch.runtime-DoBAQBU5.js → slash-dispatch.runtime-CWbpp23S.js} +6 -6
- package/dist/{subagent-registry-runtime-ppWS3tVu.js → subagent-registry-runtime-DEVpAaAP.js} +6 -6
- package/dist/{web-CzWRVmFt.js → web-NWKn8ABz.js} +6 -6
- package/package.json +1 -1
- package/scripts/create-instance.sh +37 -125
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
import { c as detectMime } from "./image-ops-BSiMpAw4.js";
|
|
2
|
+
import { r as sanitizeToolResultImages } from "./tool-images-Gk_-0y2N.js";
|
|
3
|
+
import fs from "node:fs/promises";
|
|
4
|
+
|
|
5
|
+
//#region src/agents/tools/common.ts
|
|
6
|
+
var ToolInputError = class extends Error {
|
|
7
|
+
constructor(message) {
|
|
8
|
+
super(message);
|
|
9
|
+
this.status = 400;
|
|
10
|
+
this.name = "ToolInputError";
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
var ToolAuthorizationError = class extends ToolInputError {
|
|
14
|
+
constructor(message) {
|
|
15
|
+
super(message);
|
|
16
|
+
this.status = 403;
|
|
17
|
+
this.name = "ToolAuthorizationError";
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
function createActionGate(actions) {
|
|
21
|
+
return (key, defaultValue = true) => {
|
|
22
|
+
const value = actions?.[key];
|
|
23
|
+
if (value === void 0) return defaultValue;
|
|
24
|
+
return value !== false;
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
function toSnakeCaseKey(key) {
|
|
28
|
+
return key.replace(/([A-Z]+)([A-Z][a-z])/g, "$1_$2").replace(/([a-z0-9])([A-Z])/g, "$1_$2").toLowerCase();
|
|
29
|
+
}
|
|
30
|
+
function readParamRaw(params, key) {
|
|
31
|
+
if (Object.hasOwn(params, key)) return params[key];
|
|
32
|
+
const snakeKey = toSnakeCaseKey(key);
|
|
33
|
+
if (snakeKey !== key && Object.hasOwn(params, snakeKey)) return params[snakeKey];
|
|
34
|
+
}
|
|
35
|
+
function readStringParam(params, key, options = {}) {
|
|
36
|
+
const { required = false, trim = true, label = key, allowEmpty = false } = options;
|
|
37
|
+
const raw = readParamRaw(params, key);
|
|
38
|
+
if (typeof raw !== "string") {
|
|
39
|
+
if (required) throw new ToolInputError(`${label} required`);
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
const value = trim ? raw.trim() : raw;
|
|
43
|
+
if (!value && !allowEmpty) {
|
|
44
|
+
if (required) throw new ToolInputError(`${label} required`);
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
return value;
|
|
48
|
+
}
|
|
49
|
+
function readStringOrNumberParam(params, key, options = {}) {
|
|
50
|
+
const { required = false, label = key } = options;
|
|
51
|
+
const raw = readParamRaw(params, key);
|
|
52
|
+
if (typeof raw === "number" && Number.isFinite(raw)) return String(raw);
|
|
53
|
+
if (typeof raw === "string") {
|
|
54
|
+
const value = raw.trim();
|
|
55
|
+
if (value) return value;
|
|
56
|
+
}
|
|
57
|
+
if (required) throw new ToolInputError(`${label} required`);
|
|
58
|
+
}
|
|
59
|
+
function readNumberParam(params, key, options = {}) {
|
|
60
|
+
const { required = false, label = key, integer = false } = options;
|
|
61
|
+
const raw = readParamRaw(params, key);
|
|
62
|
+
let value;
|
|
63
|
+
if (typeof raw === "number" && Number.isFinite(raw)) value = raw;
|
|
64
|
+
else if (typeof raw === "string") {
|
|
65
|
+
const trimmed = raw.trim();
|
|
66
|
+
if (trimmed) {
|
|
67
|
+
const parsed = Number.parseFloat(trimmed);
|
|
68
|
+
if (Number.isFinite(parsed)) value = parsed;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
if (value === void 0) {
|
|
72
|
+
if (required) throw new ToolInputError(`${label} required`);
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
return integer ? Math.trunc(value) : value;
|
|
76
|
+
}
|
|
77
|
+
function readStringArrayParam(params, key, options = {}) {
|
|
78
|
+
const { required = false, label = key } = options;
|
|
79
|
+
const raw = readParamRaw(params, key);
|
|
80
|
+
if (Array.isArray(raw)) {
|
|
81
|
+
const values = raw.filter((entry) => typeof entry === "string").map((entry) => entry.trim()).filter(Boolean);
|
|
82
|
+
if (values.length === 0) {
|
|
83
|
+
if (required) throw new ToolInputError(`${label} required`);
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
return values;
|
|
87
|
+
}
|
|
88
|
+
if (typeof raw === "string") {
|
|
89
|
+
const value = raw.trim();
|
|
90
|
+
if (!value) {
|
|
91
|
+
if (required) throw new ToolInputError(`${label} required`);
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
return [value];
|
|
95
|
+
}
|
|
96
|
+
if (required) throw new ToolInputError(`${label} required`);
|
|
97
|
+
}
|
|
98
|
+
function readReactionParams(params, options) {
|
|
99
|
+
const emojiKey = options.emojiKey ?? "emoji";
|
|
100
|
+
const removeKey = options.removeKey ?? "remove";
|
|
101
|
+
const remove = typeof params[removeKey] === "boolean" ? params[removeKey] : false;
|
|
102
|
+
const emoji = readStringParam(params, emojiKey, {
|
|
103
|
+
required: true,
|
|
104
|
+
allowEmpty: true
|
|
105
|
+
});
|
|
106
|
+
if (remove && !emoji) throw new ToolInputError(options.removeErrorMessage);
|
|
107
|
+
return {
|
|
108
|
+
emoji,
|
|
109
|
+
remove,
|
|
110
|
+
isEmpty: !emoji
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
function jsonResult(payload) {
|
|
114
|
+
return {
|
|
115
|
+
content: [{
|
|
116
|
+
type: "text",
|
|
117
|
+
text: JSON.stringify(payload, null, 2)
|
|
118
|
+
}],
|
|
119
|
+
details: payload
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
async function imageResult(params) {
|
|
123
|
+
return await sanitizeToolResultImages({
|
|
124
|
+
content: [{
|
|
125
|
+
type: "text",
|
|
126
|
+
text: params.extraText ?? `MEDIA:${params.path}`
|
|
127
|
+
}, {
|
|
128
|
+
type: "image",
|
|
129
|
+
data: params.base64,
|
|
130
|
+
mimeType: params.mimeType
|
|
131
|
+
}],
|
|
132
|
+
details: {
|
|
133
|
+
path: params.path,
|
|
134
|
+
...params.details
|
|
135
|
+
}
|
|
136
|
+
}, params.label, params.imageSanitization);
|
|
137
|
+
}
|
|
138
|
+
async function imageResultFromFile(params) {
|
|
139
|
+
const buf = await fs.readFile(params.path);
|
|
140
|
+
const mimeType = await detectMime({ buffer: buf.slice(0, 256) }) ?? "image/png";
|
|
141
|
+
return await imageResult({
|
|
142
|
+
label: params.label,
|
|
143
|
+
path: params.path,
|
|
144
|
+
base64: buf.toString("base64"),
|
|
145
|
+
mimeType,
|
|
146
|
+
extraText: params.extraText,
|
|
147
|
+
details: params.details,
|
|
148
|
+
imageSanitization: params.imageSanitization
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Validate and parse an `availableTags` parameter from untrusted input.
|
|
153
|
+
* Returns `undefined` when the value is missing or not an array.
|
|
154
|
+
* Entries that lack a string `name` are silently dropped.
|
|
155
|
+
*/
|
|
156
|
+
function parseAvailableTags(raw) {
|
|
157
|
+
if (raw === void 0 || raw === null) return;
|
|
158
|
+
if (!Array.isArray(raw)) return;
|
|
159
|
+
const result = raw.filter((t) => typeof t === "object" && t !== null && typeof t.name === "string").map((t) => ({
|
|
160
|
+
...t.id !== void 0 && typeof t.id === "string" ? { id: t.id } : {},
|
|
161
|
+
name: t.name,
|
|
162
|
+
...typeof t.moderated === "boolean" ? { moderated: t.moderated } : {},
|
|
163
|
+
...t.emoji_id === null || typeof t.emoji_id === "string" ? { emoji_id: t.emoji_id } : {},
|
|
164
|
+
...t.emoji_name === null || typeof t.emoji_name === "string" ? { emoji_name: t.emoji_name } : {}
|
|
165
|
+
}));
|
|
166
|
+
return result.length ? result : void 0;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
//#endregion
|
|
170
|
+
//#region src/infra/outbound/target-errors.ts
|
|
171
|
+
function missingTargetMessage(provider, hint) {
|
|
172
|
+
return `Delivering to ${provider} requires target${formatTargetHint(hint)}`;
|
|
173
|
+
}
|
|
174
|
+
function missingTargetError(provider, hint) {
|
|
175
|
+
return new Error(missingTargetMessage(provider, hint));
|
|
176
|
+
}
|
|
177
|
+
function ambiguousTargetMessage(provider, raw, hint) {
|
|
178
|
+
return `Ambiguous target "${raw}" for ${provider}. Provide a unique name or an explicit id.${formatTargetHint(hint, true)}`;
|
|
179
|
+
}
|
|
180
|
+
function ambiguousTargetError(provider, raw, hint) {
|
|
181
|
+
return new Error(ambiguousTargetMessage(provider, raw, hint));
|
|
182
|
+
}
|
|
183
|
+
function unknownTargetMessage(provider, raw, hint) {
|
|
184
|
+
return `Unknown target "${raw}" for ${provider}.${formatTargetHint(hint, true)}`;
|
|
185
|
+
}
|
|
186
|
+
function unknownTargetError(provider, raw, hint) {
|
|
187
|
+
return new Error(unknownTargetMessage(provider, raw, hint));
|
|
188
|
+
}
|
|
189
|
+
function formatTargetHint(hint, withLabel = false) {
|
|
190
|
+
if (!hint) return "";
|
|
191
|
+
return withLabel ? ` Hint: ${hint}` : ` ${hint}`;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
//#endregion
|
|
195
|
+
export { ToolInputError as a, imageResultFromFile as c, readNumberParam as d, readReactionParams as f, readStringParam as h, ToolAuthorizationError as i, jsonResult as l, readStringOrNumberParam as m, missingTargetError as n, createActionGate as o, readStringArrayParam as p, unknownTargetError as r, imageResult as s, ambiguousTargetError as t, parseAvailableTags as u };
|