openclaw-multi-auto 1.1.2 → 1.1.4
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/{accounts-C_lW3Ag9.js → accounts-BOzyfwW4.js} +2 -2
- package/dist/{accounts-C9HcPI9h.js → accounts-L9ByEpnP.js} +2 -2
- package/dist/{accounts-Tgelvk0C.js → accounts-yfBeCZtS.js} +17 -17
- package/dist/{active-listener-BEdprTkn.js → active-listener-D1yqT1cw.js} +2 -2
- package/dist/{api-key-rotation-BJpKWXy0.js → api-key-rotation-DtsNS2Nb.js} +2 -2
- package/dist/{audio-preflight-BMvgEQ5j.js → audio-preflight-DpxQCpsA.js} +32 -32
- package/dist/{audio-transcription-runner-gLFfz8fr.js → audio-transcription-runner-28fcRNNi.js} +12 -12
- package/dist/{audit-membership-runtime-Dntemq07.js → audit-membership-runtime-DWyHWAHM.js} +4 -4
- package/dist/build-info.json +3 -3
- package/dist/bundled/boot-md/handler.js +51 -51
- package/dist/bundled/bootstrap-extra-files/handler.js +6 -6
- package/dist/bundled/command-logger/handler.js +2 -2
- package/dist/bundled/session-memory/handler.js +51 -51
- package/dist/canvas-host/a2ui/.bundle.hash +1 -1
- package/dist/{channel-activity-BDnjYF7B.js → channel-activity-xHOMiarp.js} +3 -3
- package/dist/{chrome-DxxEKrY7.js → chrome-DwizpzOC.js} +18 -18
- package/dist/{commands-registry-D5qXbFJn.js → commands-registry-V1zZ5pPC.js} +4 -4
- package/dist/{deliver-DbdywYJE.js → deliver-D4o6VIur.js} +21 -21
- package/dist/deliver-runtime-P-G3bPjW.js +36 -0
- package/dist/deps-send-discord.runtime-DnbhTFX9.js +26 -0
- package/dist/deps-send-imessage.runtime-BOiQ6mDx.js +25 -0
- package/dist/deps-send-signal.runtime-CTcl388M.js +24 -0
- package/dist/deps-send-slack.runtime-CCqBz4Kg.js +22 -0
- package/dist/deps-send-telegram.runtime-DGSKTCpH.js +27 -0
- package/dist/deps-send-whatsapp.runtime-CJkTHkah.js +60 -0
- package/dist/{diagnostic-Co6Kghr-.js → diagnostic-Bn4PZjMZ.js} +2 -2
- package/dist/{errors-xt401nuk.js → errors-CCLeFWAg.js} +1 -1
- package/dist/{fetch-DuraYswo.js → fetch-BlJWzEP6.js} +5 -5
- package/dist/{fetch-guard-DWr0d00H.js → fetch-guard-ChYBwfiy.js} +2 -2
- package/dist/{frontmatter-BkTfEZ93.js → frontmatter-CvaMP376.js} +3 -3
- package/dist/{fs-safe-CTYUrIgQ.js → fs-safe-0jAo_Whb.js} +4 -4
- package/dist/{github-copilot-token-BDioPmd6.js → github-copilot-token-D13V9YBz.js} +7 -7
- package/dist/{image-eT7Y-nP5.js → image-Bbn53mzj.js} +6 -6
- package/dist/{image-ops-BuUnEOE0.js → image-ops-CehkHxmW.js} +2 -2
- package/dist/image-runtime-CVv2ra9J.js +29 -0
- package/dist/{ir-B83looB-.js → ir-DAP-B-Xw.js} +8 -8
- package/dist/{legacy-names-DOC03BkU.js → legacy-names-TyzbVqa_.js} +1 -1
- package/dist/llm-slug-generator.js +51 -51
- package/dist/{logger-BfjWMCSD.js → logger-DMZQQtxK.js} +7 -7
- package/dist/{login-CrIwcrVI.js → login-DiCctRo1.js} +5 -5
- package/dist/{login-qr-BpPDZdl_.js → login-qr-MUbXgjtd.js} +10 -10
- package/dist/{manager-1bvuGrNR.js → manager-BW_NSIMl.js} +13 -13
- package/dist/manager-runtime-BN6VevdC.js +18 -0
- package/dist/{model-selection-Dna0Gz1k.js → model-selection-idoqPmw0.js} +43 -43
- package/dist/{outbound-ChDjtuD6.js → outbound-C2kanETZ.js} +6 -6
- package/dist/{outbound-attachment-DqHlD21U.js → outbound-attachment-DBrYWX8h.js} +2 -2
- package/dist/{path-alias-guards-BzvdLvTI.js → path-alias-guards-DqXRZmsL.js} +1 -1
- package/dist/{paths-Cvc9EM8Y.js → paths-C6TxBCvO.js} +5 -5
- package/dist/{paths-Bkr-BCxW.js → paths-CCxysrzL.js} +4 -4
- package/dist/{pi-embedded-BQQa91aA.js → pi-embedded-BaGj07T0.js} +158 -158
- package/dist/{pi-embedded-helpers-CLXm10bV.js → pi-embedded-helpers-wy0DZvx1.js} +52 -52
- package/dist/{pi-model-discovery-Dymwdjt0.js → pi-model-discovery-BGgOlX8N.js} +7 -7
- package/dist/pi-model-discovery-runtime-Bwmi4Ev8.js +11 -0
- package/dist/{pi-tools.before-tool-call.runtime-Cwab_5W1.js → pi-tools.before-tool-call.runtime-BuLxSyx9.js} +9 -9
- package/dist/plugin-sdk/mattermost.js +3 -3
- package/dist/{plugins-4Rj4OjLY.js → plugins-CWkRQYDj.js} +11 -11
- package/dist/{proxy-env-DlmzDx8x.js → proxy-env-Cq5gdrbj.js} +1 -1
- package/dist/{proxy-fetch-B2pEfjbR.js → proxy-fetch-CCjEYbFm.js} +1 -1
- package/dist/{pw-ai-DNMjFMqH.js → pw-ai-Cl1Lc7RC.js} +14 -14
- package/dist/{qmd-manager-BtIKUaO9.js → qmd-manager-BsYsO9Ii.js} +10 -10
- package/dist/{query-expansion-CX-1fS52.js → query-expansion-DtLc3wjL.js} +6 -6
- package/dist/{redact-COik8ET1.js → redact-ClbcYG1J.js} +1 -1
- package/dist/{run-with-concurrency-BgYfgkXT.js → run-with-concurrency-D_ZpbgEG.js} +4 -4
- package/dist/runtime-whatsapp-login.runtime-IeylZEl4.js +13 -0
- package/dist/runtime-whatsapp-outbound.runtime-ClBRuLsq.js +22 -0
- package/dist/{send-dfu6_rgf.js → send-BQERFNyo.js} +5 -5
- package/dist/{send-L7gRiwyd.js → send-Bj776ESJ.js} +7 -7
- package/dist/{send-PE6cwoTe.js → send-DcxmcFi_.js} +8 -8
- package/dist/{send-6lz6rNVP.js → send-Dx2RkUOZ.js} +6 -6
- package/dist/{send-BHTiZcH3.js → send-vmONuVgL.js} +26 -26
- package/dist/{session-D8ImowSs.js → session-A4QhBRvH.js} +8 -8
- package/dist/{skill-commands-DNqJ-kwn.js → skill-commands-CMzBZKG2.js} +9 -9
- package/dist/{skills-7ODkHQYp.js → skills-CE_iqvM5.js} +22 -22
- package/dist/slash-commands.runtime-Cpn2tYW4.js +16 -0
- package/dist/slash-dispatch.runtime-DoBAQBU5.js +56 -0
- package/dist/slash-skill-commands.runtime-DKMvvdDW.js +20 -0
- package/dist/{store-D89wDcz9.js → store--eR1R_UX.js} +2 -2
- package/dist/subagent-registry-runtime-ppWS3tVu.js +56 -0
- package/dist/{subsystem-B45WV3qB.js → subsystem-Di1z8l0Z.js} +14 -14
- package/dist/{tables-mE4cJBN2.js → tables-d739Y1xW.js} +1 -1
- package/dist/{target-errors-mnlwhAjP.js → target-errors-CBI2Ga0y.js} +2 -2
- package/dist/{thinking-BeGmb5k6.js → thinking-DXYisHiZ.js} +7 -7
- package/dist/{tokens-q32vI39c.js → tokens-DxnY9ui_.js} +1 -1
- package/dist/{tool-images-RZdHiZcG.js → tool-images-2cBx1W8h.js} +2 -2
- package/dist/{web-Btj-e8kN.js → web-CzWRVmFt.js} +55 -55
- package/dist/{whatsapp-actions-BHbJJyqw.js → whatsapp-actions-iEArE_Ez.js} +21 -21
- package/dist/{workspace-U-DyR64O.js → workspace-CUVC6GX1.js} +20 -20
- package/package.json +1 -1
- package/scripts/create-instance.sh +34 -31
- package/scripts/install-maca.sh +30 -29
- package/dist/deliver-runtime-BFs7iAZF.js +0 -36
- package/dist/deps-send-discord.runtime-DZUccI6Z.js +0 -26
- package/dist/deps-send-imessage.runtime-CF3OpoqY.js +0 -25
- package/dist/deps-send-signal.runtime-Cw4-ozeO.js +0 -24
- package/dist/deps-send-slack.runtime-BDsDhS1P.js +0 -22
- package/dist/deps-send-telegram.runtime-D_4xVasO.js +0 -27
- package/dist/deps-send-whatsapp.runtime-DK8jqd14.js +0 -60
- package/dist/image-runtime-BcAK3n8a.js +0 -29
- package/dist/manager-runtime-FO1Sx3W8.js +0 -18
- package/dist/pi-model-discovery-runtime-BeY4EUPp.js +0 -11
- package/dist/runtime-whatsapp-login.runtime-DUb55byQ.js +0 -13
- package/dist/runtime-whatsapp-outbound.runtime-Bii_xSfI.js +0 -22
- package/dist/slash-commands.runtime-CVw6566g.js +0 -16
- package/dist/slash-dispatch.runtime-B9Ygtzi4.js +0 -56
- package/dist/slash-skill-commands.runtime-DxZ4z5h6.js +0 -20
- package/dist/subagent-registry-runtime-DL1Wv7nA.js +0 -56
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { r as resolveConfigPath } from "./paths-
|
|
1
|
+
import { r as resolveConfigPath } from "./paths-C6TxBCvO.js";
|
|
2
2
|
import os from "node:os";
|
|
3
3
|
import path from "node:path";
|
|
4
|
-
import
|
|
4
|
+
import syncFs from "node:fs";
|
|
5
5
|
import chalk, { Chalk } from "chalk";
|
|
6
6
|
import { Logger } from "tslog";
|
|
7
7
|
import JSON5 from "json5";
|
|
@@ -54,15 +54,15 @@ function getCommandPathInternal(argv, depth, opts) {
|
|
|
54
54
|
//#endregion
|
|
55
55
|
//#region src/infra/tmp-openclaw-dir.ts
|
|
56
56
|
const POSIX_OPENCLAW_TMP_DIR = process.env.OPENCLAW_TMP_DIR ?? "/tmp/openclaw";
|
|
57
|
-
const TMP_DIR_ACCESS_MODE =
|
|
57
|
+
const TMP_DIR_ACCESS_MODE = syncFs.constants.W_OK | syncFs.constants.X_OK;
|
|
58
58
|
function isNodeErrorWithCode(err, code) {
|
|
59
59
|
return typeof err === "object" && err !== null && "code" in err && err.code === code;
|
|
60
60
|
}
|
|
61
61
|
function resolvePreferredOpenClawTmpDir(options = {}) {
|
|
62
|
-
const accessSync = options.accessSync ??
|
|
63
|
-
const chmodSync = options.chmodSync ??
|
|
64
|
-
const lstatSync = options.lstatSync ??
|
|
65
|
-
const mkdirSync = options.mkdirSync ??
|
|
62
|
+
const accessSync = options.accessSync ?? syncFs.accessSync;
|
|
63
|
+
const chmodSync = options.chmodSync ?? syncFs.chmodSync;
|
|
64
|
+
const lstatSync = options.lstatSync ?? syncFs.lstatSync;
|
|
65
|
+
const mkdirSync = options.mkdirSync ?? syncFs.mkdirSync;
|
|
66
66
|
const warn = options.warn ?? ((message) => console.warn(message));
|
|
67
67
|
const getuid = options.getuid ?? (() => {
|
|
68
68
|
try {
|
|
@@ -155,8 +155,8 @@ function resolvePreferredOpenClawTmpDir(options = {}) {
|
|
|
155
155
|
function readLoggingConfig() {
|
|
156
156
|
const configPath = resolveConfigPath();
|
|
157
157
|
try {
|
|
158
|
-
if (!
|
|
159
|
-
const raw =
|
|
158
|
+
if (!syncFs.existsSync(configPath)) return;
|
|
159
|
+
const raw = syncFs.readFileSync(configPath, "utf-8");
|
|
160
160
|
const logging = JSON5.parse(raw)?.logging;
|
|
161
161
|
if (!logging || typeof logging !== "object" || Array.isArray(logging)) return;
|
|
162
162
|
return logging;
|
|
@@ -344,7 +344,7 @@ function buildLogger(settings) {
|
|
|
344
344
|
for (const transport of externalTransports) attachExternalTransport(logger, transport);
|
|
345
345
|
return logger;
|
|
346
346
|
}
|
|
347
|
-
|
|
347
|
+
syncFs.mkdirSync(path.dirname(settings.file), { recursive: true });
|
|
348
348
|
if (isRollingPath(settings.file)) pruneOldRollingLogs(path.dirname(settings.file));
|
|
349
349
|
let currentFileBytes = getCurrentLogFileBytes(settings.file);
|
|
350
350
|
let warnedAboutSizeCap = false;
|
|
@@ -383,14 +383,14 @@ function resolveMaxLogFileBytes(raw) {
|
|
|
383
383
|
}
|
|
384
384
|
function getCurrentLogFileBytes(file) {
|
|
385
385
|
try {
|
|
386
|
-
return
|
|
386
|
+
return syncFs.statSync(file).size;
|
|
387
387
|
} catch {
|
|
388
388
|
return 0;
|
|
389
389
|
}
|
|
390
390
|
}
|
|
391
391
|
function appendLogLine(file, line) {
|
|
392
392
|
try {
|
|
393
|
-
|
|
393
|
+
syncFs.appendFileSync(file, line, { encoding: "utf8" });
|
|
394
394
|
return true;
|
|
395
395
|
} catch {
|
|
396
396
|
return false;
|
|
@@ -442,14 +442,14 @@ function isRollingPath(file) {
|
|
|
442
442
|
}
|
|
443
443
|
function pruneOldRollingLogs(dir) {
|
|
444
444
|
try {
|
|
445
|
-
const entries =
|
|
445
|
+
const entries = syncFs.readdirSync(dir, { withFileTypes: true });
|
|
446
446
|
const cutoff = Date.now() - MAX_LOG_AGE_MS;
|
|
447
447
|
for (const entry of entries) {
|
|
448
448
|
if (!entry.isFile()) continue;
|
|
449
449
|
if (!entry.name.startsWith(`${LOG_PREFIX}-`) || !entry.name.endsWith(LOG_SUFFIX)) continue;
|
|
450
450
|
const fullPath = path.join(dir, entry.name);
|
|
451
451
|
try {
|
|
452
|
-
if (
|
|
452
|
+
if (syncFs.statSync(fullPath).mtimeMs < cutoff) syncFs.rmSync(fullPath, { force: true });
|
|
453
453
|
} catch {}
|
|
454
454
|
}
|
|
455
455
|
} catch {}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { b as detectMime } from "./image-ops-
|
|
2
|
-
import { r as sanitizeToolResultImages } from "./tool-images-
|
|
1
|
+
import { b as detectMime } from "./image-ops-CehkHxmW.js";
|
|
2
|
+
import { r as sanitizeToolResultImages } from "./tool-images-2cBx1W8h.js";
|
|
3
3
|
import fs from "node:fs/promises";
|
|
4
4
|
|
|
5
5
|
//#region src/agents/tools/common.ts
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { G as normalizeAccountId } from "./workspace-
|
|
2
|
-
import { h as normalizeE164, u as escapeRegExp } from "./logger-
|
|
3
|
-
import { Ht as CHAT_CHANNEL_ORDER, Ut as getChatChannelMeta, Zt as requireActivePluginRegistry } from "./model-selection-
|
|
4
|
-
import { a as normalizeWhatsAppTarget, b as resolveDiscordAccount, l as resolveTelegramAccount, m as resolveSlackReplyToMode, p as resolveSlackAccount } from "./plugins-
|
|
5
|
-
import { h as resolveAccountEntry, n as resolveWhatsAppAccount } from "./accounts-
|
|
6
|
-
import { n as resolveSignalAccount } from "./accounts-
|
|
7
|
-
import { t as resolveIMessageAccount } from "./accounts-
|
|
1
|
+
import { G as normalizeAccountId } from "./workspace-CUVC6GX1.js";
|
|
2
|
+
import { h as normalizeE164, u as escapeRegExp } from "./logger-DMZQQtxK.js";
|
|
3
|
+
import { Ht as CHAT_CHANNEL_ORDER, Ut as getChatChannelMeta, Zt as requireActivePluginRegistry } from "./model-selection-idoqPmw0.js";
|
|
4
|
+
import { a as normalizeWhatsAppTarget, b as resolveDiscordAccount, l as resolveTelegramAccount, m as resolveSlackReplyToMode, p as resolveSlackAccount } from "./plugins-CWkRQYDj.js";
|
|
5
|
+
import { h as resolveAccountEntry, n as resolveWhatsAppAccount } from "./accounts-yfBeCZtS.js";
|
|
6
|
+
import { n as resolveSignalAccount } from "./accounts-L9ByEpnP.js";
|
|
7
|
+
import { t as resolveIMessageAccount } from "./accounts-BOzyfwW4.js";
|
|
8
8
|
|
|
9
9
|
//#region src/config/types.tools.ts
|
|
10
10
|
const TOOLS_BY_SENDER_KEY_TYPES = [
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as createSubsystemLogger } from "./subsystem-
|
|
2
|
-
import { i as getImageMetadata, n as buildImageResizeSideGrid, s as resizeToJpeg, t as IMAGE_REDUCE_QUALITY_STEPS } from "./image-ops-
|
|
1
|
+
import { t as createSubsystemLogger } from "./subsystem-Di1z8l0Z.js";
|
|
2
|
+
import { i as getImageMetadata, n as buildImageResizeSideGrid, s as resizeToJpeg, t as IMAGE_REDUCE_QUALITY_STEPS } from "./image-ops-CehkHxmW.js";
|
|
3
3
|
|
|
4
4
|
//#region src/media/base64.ts
|
|
5
5
|
function estimateBase64DecodedBytes(base64) {
|
|
@@ -1,61 +1,61 @@
|
|
|
1
|
-
import "./run-with-concurrency-
|
|
2
|
-
import "./paths-
|
|
3
|
-
import { i as defaultRuntime, p as shouldLogVerbose, t as createSubsystemLogger, u as logVerbose, y as getChildLogger } from "./subsystem-
|
|
4
|
-
import { F as buildGroupHistoryKey, M as DEFAULT_MAIN_KEY, N as buildAgentMainSessionKey, R as normalizeAgentId } from "./workspace-
|
|
5
|
-
import { C as sleep, T as toWhatsappJid, h as normalizeE164, m as jidToE164, o as clamp, p as isSelfChatMode, v as resolveJidToE164 } from "./logger-
|
|
6
|
-
import { X as loadConfig, lr as formatCliCommand } from "./model-selection-
|
|
7
|
-
import "./github-copilot-token-
|
|
8
|
-
import "./legacy-names-
|
|
9
|
-
import { h as resolveChannelGroupRequireMention, m as resolveChannelGroupPolicy } from "./thinking-
|
|
10
|
-
import "./tokens-
|
|
11
|
-
import { A as normalizeGroupActivation, B as normalizeMentionText, C as createInboundDebouncer, D as getReplyFromConfig, E as createDedupeCache, F as enqueueSystemEvent, I as finalizeInboundContext, K as resolveIdentityNamePrefix, L as hasControlCommand, M as computeBackoff, N as sleepWithAbort, O as buildAgentSessionKey, P as formatDurationPrecise, R as shouldComputeCommandAuthorized, T as formatInboundEnvelope, _ as resolveDmGroupAccessWithCommandGate, b as shouldAckReactionForWhatsApp, c as buildPairingReply, d as buildHistoryContextFromEntries, f as recordPendingHistoryEntryIfEnabled, g as readStoreAllowFromForDmPolicy, h as warnMissingProviderGroupPolicyFallbackOnce, i as resolveInboundSessionEnvelopeContext, j as parseActivationCommand, k as resolveAgentRoute, l as resolveMentionGating, m as resolveOpenProviderRuntimeGroupPolicy, p as resolveDefaultGroupPolicy, q as resolveMessagePrefix, s as createReplyPrefixOptions, u as DEFAULT_GROUP_HISTORY_LIMIT, v as resolveDmGroupAccessWithLists, w as resolveInboundDebounceMs, x as dispatchReplyWithBufferedBlockDispatcher, y as resolvePinnedMainDmOwnerFromAllowlist, z as buildMentionRegexes } from "./pi-embedded-
|
|
12
|
-
import "./plugins-
|
|
13
|
-
import { a as logWebSelfId, c as pickWebChannel, i as getWebAuthAgeMs, m as webAuthExists, n as resolveWhatsAppAccount, r as WA_WEB_AUTH_DIR, u as readWebSelfId } from "./accounts-
|
|
14
|
-
import "./send-
|
|
15
|
-
import "./send-
|
|
16
|
-
import "./deliver-
|
|
17
|
-
import "./diagnostic-
|
|
18
|
-
import "./accounts-
|
|
19
|
-
import "./image-ops-
|
|
20
|
-
import { X as toLocationContext, Y as formatLocationText, et as upsertChannelPairingRequest } from "./send-
|
|
21
|
-
import "./pi-model-discovery-
|
|
22
|
-
import { At as resolveGroupSessionKey, K as recordSessionMetaFromInbound, W as loadSessionStore, q as updateLastRoute } from "./pi-embedded-helpers-
|
|
23
|
-
import "./chrome-
|
|
24
|
-
import "./frontmatter-
|
|
25
|
-
import "./skills-
|
|
26
|
-
import "./path-alias-guards-
|
|
27
|
-
import "./redact-
|
|
28
|
-
import "./errors-
|
|
29
|
-
import "./fs-safe-
|
|
30
|
-
import "./proxy-env-
|
|
31
|
-
import { i as saveMediaBuffer } from "./store
|
|
32
|
-
import "./accounts-
|
|
33
|
-
import { s as resolveStorePath } from "./paths-
|
|
34
|
-
import "./tool-images-
|
|
35
|
-
import "./image-
|
|
36
|
-
import { h as registerUnhandledRejectionHandler } from "./audio-transcription-runner-
|
|
37
|
-
import { i as getAgentScopedMediaLocalRoots } from "./fetch-
|
|
38
|
-
import "./fetch-guard-
|
|
39
|
-
import "./api-key-rotation-
|
|
40
|
-
import "./proxy-fetch-
|
|
41
|
-
import { a as loadWebMedia, d as chunkMarkdownTextWithMode, h as resolveTextChunkLimit, m as resolveChunkMode, s as resolveMarkdownTableMode } from "./ir-
|
|
1
|
+
import "./run-with-concurrency-D_ZpbgEG.js";
|
|
2
|
+
import "./paths-C6TxBCvO.js";
|
|
3
|
+
import { i as defaultRuntime, p as shouldLogVerbose, t as createSubsystemLogger, u as logVerbose, y as getChildLogger } from "./subsystem-Di1z8l0Z.js";
|
|
4
|
+
import { F as buildGroupHistoryKey, M as DEFAULT_MAIN_KEY, N as buildAgentMainSessionKey, R as normalizeAgentId } from "./workspace-CUVC6GX1.js";
|
|
5
|
+
import { C as sleep, T as toWhatsappJid, h as normalizeE164, m as jidToE164, o as clamp, p as isSelfChatMode, v as resolveJidToE164 } from "./logger-DMZQQtxK.js";
|
|
6
|
+
import { X as loadConfig, lr as formatCliCommand } from "./model-selection-idoqPmw0.js";
|
|
7
|
+
import "./github-copilot-token-D13V9YBz.js";
|
|
8
|
+
import "./legacy-names-TyzbVqa_.js";
|
|
9
|
+
import { h as resolveChannelGroupRequireMention, m as resolveChannelGroupPolicy } from "./thinking-DXYisHiZ.js";
|
|
10
|
+
import "./tokens-DxnY9ui_.js";
|
|
11
|
+
import { A as normalizeGroupActivation, B as normalizeMentionText, C as createInboundDebouncer, D as getReplyFromConfig, E as createDedupeCache, F as enqueueSystemEvent, I as finalizeInboundContext, K as resolveIdentityNamePrefix, L as hasControlCommand, M as computeBackoff, N as sleepWithAbort, O as buildAgentSessionKey, P as formatDurationPrecise, R as shouldComputeCommandAuthorized, T as formatInboundEnvelope, _ as resolveDmGroupAccessWithCommandGate, b as shouldAckReactionForWhatsApp, c as buildPairingReply, d as buildHistoryContextFromEntries, f as recordPendingHistoryEntryIfEnabled, g as readStoreAllowFromForDmPolicy, h as warnMissingProviderGroupPolicyFallbackOnce, i as resolveInboundSessionEnvelopeContext, j as parseActivationCommand, k as resolveAgentRoute, l as resolveMentionGating, m as resolveOpenProviderRuntimeGroupPolicy, p as resolveDefaultGroupPolicy, q as resolveMessagePrefix, s as createReplyPrefixOptions, u as DEFAULT_GROUP_HISTORY_LIMIT, v as resolveDmGroupAccessWithLists, w as resolveInboundDebounceMs, x as dispatchReplyWithBufferedBlockDispatcher, y as resolvePinnedMainDmOwnerFromAllowlist, z as buildMentionRegexes } from "./pi-embedded-BaGj07T0.js";
|
|
12
|
+
import "./plugins-CWkRQYDj.js";
|
|
13
|
+
import { a as logWebSelfId, c as pickWebChannel, i as getWebAuthAgeMs, m as webAuthExists, n as resolveWhatsAppAccount, r as WA_WEB_AUTH_DIR, u as readWebSelfId } from "./accounts-yfBeCZtS.js";
|
|
14
|
+
import "./send-Dx2RkUOZ.js";
|
|
15
|
+
import "./send-DcxmcFi_.js";
|
|
16
|
+
import "./deliver-D4o6VIur.js";
|
|
17
|
+
import "./diagnostic-Bn4PZjMZ.js";
|
|
18
|
+
import "./accounts-L9ByEpnP.js";
|
|
19
|
+
import "./image-ops-CehkHxmW.js";
|
|
20
|
+
import { X as toLocationContext, Y as formatLocationText, et as upsertChannelPairingRequest } from "./send-vmONuVgL.js";
|
|
21
|
+
import "./pi-model-discovery-BGgOlX8N.js";
|
|
22
|
+
import { At as resolveGroupSessionKey, K as recordSessionMetaFromInbound, W as loadSessionStore, q as updateLastRoute } from "./pi-embedded-helpers-wy0DZvx1.js";
|
|
23
|
+
import "./chrome-DwizpzOC.js";
|
|
24
|
+
import "./frontmatter-CvaMP376.js";
|
|
25
|
+
import "./skills-CE_iqvM5.js";
|
|
26
|
+
import "./path-alias-guards-DqXRZmsL.js";
|
|
27
|
+
import "./redact-ClbcYG1J.js";
|
|
28
|
+
import "./errors-CCLeFWAg.js";
|
|
29
|
+
import "./fs-safe-0jAo_Whb.js";
|
|
30
|
+
import "./proxy-env-Cq5gdrbj.js";
|
|
31
|
+
import { i as saveMediaBuffer } from "./store--eR1R_UX.js";
|
|
32
|
+
import "./accounts-BOzyfwW4.js";
|
|
33
|
+
import { s as resolveStorePath } from "./paths-CCxysrzL.js";
|
|
34
|
+
import "./tool-images-2cBx1W8h.js";
|
|
35
|
+
import "./image-Bbn53mzj.js";
|
|
36
|
+
import { h as registerUnhandledRejectionHandler } from "./audio-transcription-runner-28fcRNNi.js";
|
|
37
|
+
import { i as getAgentScopedMediaLocalRoots } from "./fetch-BlJWzEP6.js";
|
|
38
|
+
import "./fetch-guard-ChYBwfiy.js";
|
|
39
|
+
import "./api-key-rotation-DtsNS2Nb.js";
|
|
40
|
+
import "./proxy-fetch-CCjEYbFm.js";
|
|
41
|
+
import { a as loadWebMedia, d as chunkMarkdownTextWithMode, h as resolveTextChunkLimit, m as resolveChunkMode, s as resolveMarkdownTableMode } from "./ir-DAP-B-Xw.js";
|
|
42
42
|
import "./render-DW7AcFdD.js";
|
|
43
|
-
import "./target-errors-
|
|
44
|
-
import "./commands-registry-
|
|
45
|
-
import "./skill-commands-
|
|
43
|
+
import "./target-errors-CBI2Ga0y.js";
|
|
44
|
+
import "./commands-registry-V1zZ5pPC.js";
|
|
45
|
+
import "./skill-commands-CMzBZKG2.js";
|
|
46
46
|
import "./fetch-BfuG8uZ8.js";
|
|
47
|
-
import { n as recordChannelActivity } from "./channel-activity-
|
|
48
|
-
import { t as convertMarkdownTables } from "./tables-
|
|
49
|
-
import "./send-
|
|
50
|
-
import "./outbound-attachment-
|
|
51
|
-
import "./send-
|
|
52
|
-
import { r as setActiveWebListener } from "./active-listener-
|
|
47
|
+
import { n as recordChannelActivity } from "./channel-activity-xHOMiarp.js";
|
|
48
|
+
import { t as convertMarkdownTables } from "./tables-d739Y1xW.js";
|
|
49
|
+
import "./send-BQERFNyo.js";
|
|
50
|
+
import "./outbound-attachment-DBrYWX8h.js";
|
|
51
|
+
import "./send-Bj776ESJ.js";
|
|
52
|
+
import { r as setActiveWebListener } from "./active-listener-D1yqT1cw.js";
|
|
53
53
|
import "./proxy-CecQTx_Z.js";
|
|
54
|
-
import "./manager-
|
|
55
|
-
import "./query-expansion-
|
|
56
|
-
import { i as markdownToWhatsApp, r as sendReactionWhatsApp, t as sendMessageWhatsApp } from "./outbound-
|
|
57
|
-
import { i as waitForWaConnection, n as formatError, r as getStatusCode, t as createWaSocket } from "./session-
|
|
58
|
-
import { t as loginWeb } from "./login-
|
|
54
|
+
import "./manager-BW_NSIMl.js";
|
|
55
|
+
import "./query-expansion-DtLc3wjL.js";
|
|
56
|
+
import { i as markdownToWhatsApp, r as sendReactionWhatsApp, t as sendMessageWhatsApp } from "./outbound-C2kanETZ.js";
|
|
57
|
+
import { i as waitForWaConnection, n as formatError, r as getStatusCode, t as createWaSocket } from "./session-A4QhBRvH.js";
|
|
58
|
+
import { t as loginWeb } from "./login-DiCctRo1.js";
|
|
59
59
|
import { randomUUID } from "node:crypto";
|
|
60
60
|
import { DisconnectReason, downloadMediaMessage, extractMessageContent, getContentType, isJidGroup, normalizeMessageContent } from "@whiskeysockets/baileys";
|
|
61
61
|
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import "./run-with-concurrency-
|
|
2
|
-
import "./paths-
|
|
3
|
-
import "./subsystem-
|
|
4
|
-
import "./workspace-
|
|
5
|
-
import "./logger-
|
|
6
|
-
import "./model-selection-
|
|
7
|
-
import "./github-copilot-token-
|
|
8
|
-
import "./legacy-names-
|
|
9
|
-
import { a as normalizeWhatsAppTarget, i as isWhatsAppGroupJid } from "./plugins-
|
|
10
|
-
import { n as resolveWhatsAppAccount } from "./accounts-
|
|
11
|
-
import "./image-ops-
|
|
12
|
-
import "./path-alias-guards-
|
|
13
|
-
import "./fs-safe-
|
|
14
|
-
import "./proxy-env-
|
|
15
|
-
import "./tool-images-
|
|
16
|
-
import "./fetch-
|
|
17
|
-
import "./fetch-guard-
|
|
18
|
-
import "./ir-
|
|
1
|
+
import "./run-with-concurrency-D_ZpbgEG.js";
|
|
2
|
+
import "./paths-C6TxBCvO.js";
|
|
3
|
+
import "./subsystem-Di1z8l0Z.js";
|
|
4
|
+
import "./workspace-CUVC6GX1.js";
|
|
5
|
+
import "./logger-DMZQQtxK.js";
|
|
6
|
+
import "./model-selection-idoqPmw0.js";
|
|
7
|
+
import "./github-copilot-token-D13V9YBz.js";
|
|
8
|
+
import "./legacy-names-TyzbVqa_.js";
|
|
9
|
+
import { a as normalizeWhatsAppTarget, i as isWhatsAppGroupJid } from "./plugins-CWkRQYDj.js";
|
|
10
|
+
import { n as resolveWhatsAppAccount } from "./accounts-yfBeCZtS.js";
|
|
11
|
+
import "./image-ops-CehkHxmW.js";
|
|
12
|
+
import "./path-alias-guards-DqXRZmsL.js";
|
|
13
|
+
import "./fs-safe-0jAo_Whb.js";
|
|
14
|
+
import "./proxy-env-Cq5gdrbj.js";
|
|
15
|
+
import "./tool-images-2cBx1W8h.js";
|
|
16
|
+
import "./fetch-BlJWzEP6.js";
|
|
17
|
+
import "./fetch-guard-ChYBwfiy.js";
|
|
18
|
+
import "./ir-DAP-B-Xw.js";
|
|
19
19
|
import "./render-DW7AcFdD.js";
|
|
20
|
-
import { f as readReactionParams, h as readStringParam, i as ToolAuthorizationError, l as jsonResult, n as missingTargetError, o as createActionGate } from "./target-errors-
|
|
21
|
-
import "./tables-
|
|
22
|
-
import { r as sendReactionWhatsApp } from "./outbound-
|
|
20
|
+
import { f as readReactionParams, h as readStringParam, i as ToolAuthorizationError, l as jsonResult, n as missingTargetError, o as createActionGate } from "./target-errors-CBI2Ga0y.js";
|
|
21
|
+
import "./tables-d739Y1xW.js";
|
|
22
|
+
import { r as sendReactionWhatsApp } from "./outbound-C2kanETZ.js";
|
|
23
23
|
|
|
24
24
|
//#region src/whatsapp/resolve-outbound-target.ts
|
|
25
25
|
function resolveWhatsAppOutboundTarget(params) {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { d as resolveRequiredHomeDir } from "./paths-
|
|
2
|
-
import { c as danger, p as shouldLogVerbose } from "./subsystem-
|
|
3
|
-
import { g as pathExists$1, n as logError, t as logDebug, y as resolveUserPath } from "./logger-
|
|
1
|
+
import { d as resolveRequiredHomeDir } from "./paths-C6TxBCvO.js";
|
|
2
|
+
import { c as danger, p as shouldLogVerbose } from "./subsystem-Di1z8l0Z.js";
|
|
3
|
+
import { g as pathExists$1, n as logError, t as logDebug, y as resolveUserPath } from "./logger-DMZQQtxK.js";
|
|
4
4
|
import fs from "node:fs/promises";
|
|
5
5
|
import os from "node:os";
|
|
6
6
|
import path from "node:path";
|
|
7
|
-
import
|
|
7
|
+
import syncFs from "node:fs";
|
|
8
8
|
import { promisify } from "node:util";
|
|
9
9
|
import { execFile, spawn } from "node:child_process";
|
|
10
10
|
import process$1 from "node:process";
|
|
@@ -560,7 +560,7 @@ function resolveBoundaryPathLexicalSync(params) {
|
|
|
560
560
|
rootCanonicalPath: params.rootCanonicalPath,
|
|
561
561
|
resolveParams: params.params,
|
|
562
562
|
absolutePath: params.absolutePath,
|
|
563
|
-
read: (cursor) =>
|
|
563
|
+
read: (cursor) => syncFs.lstatSync(cursor)
|
|
564
564
|
});
|
|
565
565
|
if (isPromiseLike(maybeStat)) throw new Error("Unexpected async lexical stat");
|
|
566
566
|
const stat = maybeStat;
|
|
@@ -706,15 +706,15 @@ function resolvePathViaExistingAncestorSync(targetPath) {
|
|
|
706
706
|
const normalized = path.resolve(targetPath);
|
|
707
707
|
let cursor = normalized;
|
|
708
708
|
const missingSuffix = [];
|
|
709
|
-
while (!isFilesystemRoot(cursor) && !
|
|
709
|
+
while (!isFilesystemRoot(cursor) && !syncFs.existsSync(cursor)) {
|
|
710
710
|
missingSuffix.unshift(path.basename(cursor));
|
|
711
711
|
const parent = path.dirname(cursor);
|
|
712
712
|
if (parent === cursor) break;
|
|
713
713
|
cursor = parent;
|
|
714
714
|
}
|
|
715
|
-
if (!
|
|
715
|
+
if (!syncFs.existsSync(cursor)) return normalized;
|
|
716
716
|
try {
|
|
717
|
-
const resolvedAncestor = path.resolve(
|
|
717
|
+
const resolvedAncestor = path.resolve(syncFs.realpathSync(cursor));
|
|
718
718
|
if (missingSuffix.length === 0) return resolvedAncestor;
|
|
719
719
|
return path.resolve(resolvedAncestor, ...missingSuffix);
|
|
720
720
|
} catch {
|
|
@@ -739,7 +739,7 @@ function getPathKindSync(absolutePath, preserveFinalSymlink) {
|
|
|
739
739
|
try {
|
|
740
740
|
return {
|
|
741
741
|
exists: true,
|
|
742
|
-
kind: toResolvedKind(preserveFinalSymlink ?
|
|
742
|
+
kind: toResolvedKind(preserveFinalSymlink ? syncFs.lstatSync(absolutePath) : syncFs.statSync(absolutePath))
|
|
743
743
|
};
|
|
744
744
|
} catch (error) {
|
|
745
745
|
if (isNotFoundPathError(error)) return {
|
|
@@ -799,10 +799,10 @@ async function resolveSymlinkHopPath(symlinkPath) {
|
|
|
799
799
|
}
|
|
800
800
|
function resolveSymlinkHopPathSync(symlinkPath) {
|
|
801
801
|
try {
|
|
802
|
-
return path.resolve(
|
|
802
|
+
return path.resolve(syncFs.realpathSync(symlinkPath));
|
|
803
803
|
} catch (error) {
|
|
804
804
|
if (!isNotFoundPathError(error)) throw error;
|
|
805
|
-
const linkTarget =
|
|
805
|
+
const linkTarget = syncFs.readlinkSync(symlinkPath);
|
|
806
806
|
return resolvePathViaExistingAncestorSync(path.resolve(path.dirname(symlinkPath), linkTarget));
|
|
807
807
|
}
|
|
808
808
|
}
|
|
@@ -828,7 +828,7 @@ function sameFileIdentity(left, right) {
|
|
|
828
828
|
return sameFileIdentity$1(left, right);
|
|
829
829
|
}
|
|
830
830
|
function openVerifiedFileSync(params) {
|
|
831
|
-
const ioFs = params.ioFs ??
|
|
831
|
+
const ioFs = params.ioFs ?? syncFs;
|
|
832
832
|
const allowedType = params.allowedType ?? "file";
|
|
833
833
|
const openReadFlags = ioFs.constants.O_RDONLY | (typeof ioFs.constants.O_NOFOLLOW === "number" ? ioFs.constants.O_NOFOLLOW : 0);
|
|
834
834
|
let fd = null;
|
|
@@ -905,7 +905,7 @@ function canUseBoundaryFileOpen(ioFs) {
|
|
|
905
905
|
return typeof ioFs.openSync === "function" && typeof ioFs.closeSync === "function" && typeof ioFs.fstatSync === "function" && typeof ioFs.lstatSync === "function" && typeof ioFs.realpathSync === "function" && typeof ioFs.readFileSync === "function" && typeof ioFs.constants === "object" && ioFs.constants !== null;
|
|
906
906
|
}
|
|
907
907
|
function openBoundaryFileSync(params) {
|
|
908
|
-
const ioFs = params.ioFs ??
|
|
908
|
+
const ioFs = params.ioFs ?? syncFs;
|
|
909
909
|
const resolved = resolveBoundaryFilePathGeneric({
|
|
910
910
|
absolutePath: params.absolutePath,
|
|
911
911
|
resolve: (absolutePath) => resolveBoundaryPathSync({
|
|
@@ -956,7 +956,7 @@ function finalizeBoundaryFileOpen(params) {
|
|
|
956
956
|
});
|
|
957
957
|
}
|
|
958
958
|
async function openBoundaryFile(params) {
|
|
959
|
-
const ioFs = params.ioFs ??
|
|
959
|
+
const ioFs = params.ioFs ?? syncFs;
|
|
960
960
|
const maybeResolved = resolveBoundaryFilePathGeneric({
|
|
961
961
|
absolutePath: params.absolutePath,
|
|
962
962
|
resolve: (absolutePath) => resolveBoundaryPath({
|
|
@@ -1105,7 +1105,7 @@ function resolveNpmArgvForWindows(argv) {
|
|
|
1105
1105
|
if (!cliName) return null;
|
|
1106
1106
|
const nodeDir = path.dirname(process$1.execPath);
|
|
1107
1107
|
const cliPath = path.join(nodeDir, "node_modules", "npm", "bin", cliName);
|
|
1108
|
-
if (!
|
|
1108
|
+
if (!syncFs.existsSync(cliPath)) return null;
|
|
1109
1109
|
return [
|
|
1110
1110
|
process$1.execPath,
|
|
1111
1111
|
cliPath,
|
|
@@ -1307,7 +1307,7 @@ async function readPackageName(dir) {
|
|
|
1307
1307
|
}
|
|
1308
1308
|
function readPackageNameSync(dir) {
|
|
1309
1309
|
try {
|
|
1310
|
-
const raw =
|
|
1310
|
+
const raw = syncFs.readFileSync(path.join(dir, "package.json"), "utf-8");
|
|
1311
1311
|
const parsed = JSON.parse(raw);
|
|
1312
1312
|
return typeof parsed.name === "string" ? parsed.name : null;
|
|
1313
1313
|
} catch {
|
|
@@ -1341,7 +1341,7 @@ function candidateDirsFromArgv1(argv1) {
|
|
|
1341
1341
|
const normalized = path.resolve(argv1);
|
|
1342
1342
|
const candidates = [path.dirname(normalized)];
|
|
1343
1343
|
try {
|
|
1344
|
-
const resolved =
|
|
1344
|
+
const resolved = syncFs.realpathSync(normalized);
|
|
1345
1345
|
if (resolved !== normalized) candidates.push(path.dirname(resolved));
|
|
1346
1346
|
} catch {}
|
|
1347
1347
|
const parts = normalized.split(path.sep);
|
|
@@ -1453,14 +1453,14 @@ async function readWorkspaceFileWithGuards(params) {
|
|
|
1453
1453
|
const identity = workspaceFileIdentity(opened.stat, opened.path);
|
|
1454
1454
|
const cached = workspaceFileCache.get(params.filePath);
|
|
1455
1455
|
if (cached && cached.identity === identity) {
|
|
1456
|
-
|
|
1456
|
+
syncFs.closeSync(opened.fd);
|
|
1457
1457
|
return {
|
|
1458
1458
|
ok: true,
|
|
1459
1459
|
content: cached.content
|
|
1460
1460
|
};
|
|
1461
1461
|
}
|
|
1462
1462
|
try {
|
|
1463
|
-
const content =
|
|
1463
|
+
const content = syncFs.readFileSync(opened.fd, "utf-8");
|
|
1464
1464
|
workspaceFileCache.set(params.filePath, {
|
|
1465
1465
|
content,
|
|
1466
1466
|
identity
|
|
@@ -1477,7 +1477,7 @@ async function readWorkspaceFileWithGuards(params) {
|
|
|
1477
1477
|
error
|
|
1478
1478
|
};
|
|
1479
1479
|
} finally {
|
|
1480
|
-
|
|
1480
|
+
syncFs.closeSync(opened.fd);
|
|
1481
1481
|
}
|
|
1482
1482
|
}
|
|
1483
1483
|
function stripFrontMatter(content) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
2
|
# =================================================================
|
|
3
|
-
# OpenClaw 深度集成初始化工具 (
|
|
4
|
-
#
|
|
3
|
+
# OpenClaw 深度集成初始化工具 (create-instance.sh)
|
|
4
|
+
# 修复说明:移除 pnpm-workspace.yaml 避免干扰,强化依赖安装验证
|
|
5
5
|
# =================================================================
|
|
6
6
|
|
|
7
7
|
set -e
|
|
@@ -15,7 +15,6 @@ NC='\033[0m'
|
|
|
15
15
|
|
|
16
16
|
# --- 1. 路径溯源与环境检查 ---
|
|
17
17
|
GLOBAL_PREFIX=$(npm config get prefix)
|
|
18
|
-
# 强制转换为绝对路径,避免路径解析引发的偏移
|
|
19
18
|
INSTANCES_BASE=$(eval echo "$HOME/openclaws")
|
|
20
19
|
DEFAULT_SOURCE="${GLOBAL_PREFIX}/lib/node_modules/openclaw-multi-auto"
|
|
21
20
|
[ -d "$HOME/projects/openclaw" ] && DEFAULT_SOURCE=$(eval echo "$HOME/projects/openclaw")
|
|
@@ -59,7 +58,7 @@ fi
|
|
|
59
58
|
INSTANCE_DIR="$INSTANCES_BASE/${INSTANCE_NAME}"
|
|
60
59
|
DIST_DIR="${INSTANCE_DIR}/dist"
|
|
61
60
|
|
|
62
|
-
#
|
|
61
|
+
# 清理旧残留,防止隔离失效
|
|
63
62
|
if [ -d "$INSTANCE_DIR" ]; then
|
|
64
63
|
echo -e "${YELLOW}⚠️ 清理旧实例目录...${NC}"
|
|
65
64
|
rm -rf "$INSTANCE_DIR"
|
|
@@ -88,7 +87,6 @@ fi
|
|
|
88
87
|
DEFAULT_MODEL="zai/glm-5"
|
|
89
88
|
ZAI_KEY=""; DS_KEY=""; MX_KEY=""; KIMI_KEY=""; QWEN_KEY=""
|
|
90
89
|
|
|
91
|
-
# 根据选择设置 Primary 模型
|
|
92
90
|
case "$MODEL_PROVIDER" in
|
|
93
91
|
zai) PRIMARY_MODEL="zai/glm-5"; ZAI_KEY="$API_KEY" ;;
|
|
94
92
|
deepseek) PRIMARY_MODEL="deepseek/deepseek-chat"; DS_KEY="$API_KEY" ;;
|
|
@@ -181,51 +179,53 @@ rm -rf "$DIST_DIR" && mkdir -p "$DIST_DIR"
|
|
|
181
179
|
if [ -d "${SOURCE_CODE}/dist" ]; then
|
|
182
180
|
rsync -av --delete "${SOURCE_CODE}/dist/" "${DIST_DIR}/" 2>/dev/null | head -n 3
|
|
183
181
|
|
|
184
|
-
#
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
182
|
+
# 检查所有被引用的 utils 文件是否存在
|
|
183
|
+
for chunk in $(grep -oE "utils-[A-Za-z0-9]+\.js" "${DIST_DIR}/index.js" 2>/dev/null | sort -u); do
|
|
184
|
+
if [ ! -f "${DIST_DIR}/${chunk}" ]; then
|
|
185
|
+
echo -e "${RED}❌ 致命错误: dist 缺失关键模块 ${chunk}${NC}"
|
|
186
|
+
echo -e "${YELLOW}请在源码端执行: rm -rf dist && pnpm build && npm publish${NC}"
|
|
187
|
+
exit 1
|
|
188
|
+
fi
|
|
189
|
+
done
|
|
191
190
|
else
|
|
192
|
-
echo -e "${RED}❌ 错误: 母本 dist
|
|
191
|
+
echo -e "${RED}❌ 错误: 母本 dist 不存在${NC}"; exit 1
|
|
193
192
|
fi
|
|
194
193
|
|
|
195
194
|
cp "${SOURCE_CODE}/package.json" "${INSTANCE_DIR}/package.json"
|
|
196
195
|
[ -f "${SOURCE_CODE}/pnpm-lock.yaml" ] && cp "${SOURCE_CODE}/pnpm-lock.yaml" "${INSTANCE_DIR}/pnpm-lock.yaml"
|
|
197
196
|
|
|
198
|
-
# --- 6. 固化本地依赖 (
|
|
197
|
+
# --- 6. 固化本地依赖 (关键修复:确保安装执行) ---
|
|
199
198
|
echo -e "${BLUE}📦 正在固化运行环境 (pnpm)...${NC}"
|
|
200
199
|
export SHARP_BINARY_HOST="https://npmmirror.com/mirrors/sharp"
|
|
201
200
|
export SHARP_LIBVIPS_BINARY_HOST="https://npmmirror.com/mirrors/sharp-libvips"
|
|
202
201
|
|
|
203
|
-
# 🛑 关键修复:显式进入实例物理目录并创建路径锁
|
|
204
202
|
cd "${INSTANCE_DIR}"
|
|
205
|
-
touch pnpm-workspace.yaml # 强制 pnpm 将当前目录识别为根
|
|
206
203
|
echo -e "${YELLOW}📍 安装路径确认: $(pwd)${NC}"
|
|
207
204
|
|
|
208
|
-
|
|
205
|
+
# 强制安装依赖,捕获错误日志(注意:不创建 pnpm-workspace.yaml,避免干扰)
|
|
206
|
+
pnpm install --shamefully-hoist --registry=https://registry.npmmirror.com --no-frozen-lockfile
|
|
207
|
+
|
|
208
|
+
# 验证 node_modules 是否生成
|
|
209
|
+
if [ ! -d "node_modules" ]; then
|
|
210
|
+
echo -e "${RED}❌ 严重错误: pnpm install 完成但 node_modules 目录未创建!${NC}"
|
|
211
|
+
exit 1
|
|
212
|
+
fi
|
|
213
|
+
echo -e "${GREEN}✅ 依赖安装成功,node_modules 已生成${NC}"
|
|
209
214
|
|
|
210
|
-
# --- 7.
|
|
215
|
+
# --- 7. 预装可选技能 (修复:即使失败也不影响主流程) ---
|
|
211
216
|
echo -e "${BLUE}🤖 正在注入飞书运维机器人引导...${NC}"
|
|
212
217
|
SKILLS_DIR="${INSTANCE_DIR}/workspace/skills"
|
|
213
218
|
mkdir -p "$SKILLS_DIR/workspace-git"
|
|
214
219
|
mkdir -p "$SKILLS_DIR/feishu-config"
|
|
215
220
|
|
|
216
|
-
#
|
|
217
|
-
pnpm add jinyu-skill-git --prefix "$SKILLS_DIR/workspace-git" --registry=https://registry.npmmirror.com >/dev/null 2>&1 ||
|
|
218
|
-
pnpm add jinyu-skill-feishu-config --prefix "$SKILLS_DIR/feishu-config" --registry=https://registry.npmmirror.com >/dev/null 2>&1 ||
|
|
221
|
+
# 使用 || true 防止私有包不存在导致 set -e 中断脚本
|
|
222
|
+
pnpm add jinyu-skill-git --prefix "$SKILLS_DIR/workspace-git" --registry=https://registry.npmmirror.com >/dev/null 2>&1 || echo "⚠️ 技能 git 跳过"
|
|
223
|
+
pnpm add jinyu-skill-feishu-config --prefix "$SKILLS_DIR/feishu-config" --registry=https://registry.npmmirror.com >/dev/null 2>&1 || echo "⚠️ 技能 feishu 跳过"
|
|
219
224
|
|
|
220
225
|
cat > "${INSTANCE_DIR}/workspace/BOOTSTRAP.md" << 'EOF'
|
|
221
226
|
# 首次启动引导任务
|
|
222
|
-
|
|
223
|
-
## 任务:自动配置飞书运维机器人
|
|
224
|
-
由于这是实例首次启动,请执行以下步骤:
|
|
225
|
-
|
|
226
227
|
1. 调用 `feishu-config` 技能,开始飞书机器人自动配置流程。
|
|
227
228
|
2. 机器人名称设定为:**运维**。
|
|
228
|
-
3. 本引导文件(BOOTSTRAP.md)将在配置成功并完成首次对话后自动处理。
|
|
229
229
|
EOF
|
|
230
230
|
|
|
231
231
|
# --- 8. 生成增强型启动脚本 ---
|
|
@@ -247,7 +247,6 @@ if [[ "$OSTYPE" == "darwin"* ]]; then
|
|
|
247
247
|
PLIST_LABEL="ai.openclaw.$INSTANCE_NAME"
|
|
248
248
|
PLIST_PATH="$HOME/Library/LaunchAgents/$PLIST_LABEL.plist"
|
|
249
249
|
if [ ! -f "$PLIST_PATH" ]; then
|
|
250
|
-
echo "📦 注册 launchd 服务..."
|
|
251
250
|
cat > "$PLIST_PATH" <<EOP
|
|
252
251
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
253
252
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
@@ -265,22 +264,26 @@ EOP
|
|
|
265
264
|
fi
|
|
266
265
|
|
|
267
266
|
echo "🚀 启动 OpenClaw-$INSTANCE_NAME..."
|
|
267
|
+
# 启动前简单检查 dist 完整性
|
|
268
|
+
if ! node -e "require('${DIST_DIR}/index.js')" 2>/dev/null; then
|
|
269
|
+
echo "⚠️ dist 可能不完整,尝试重新构建..."
|
|
270
|
+
pnpm build
|
|
271
|
+
fi
|
|
268
272
|
exec node "./dist/index.js" gateway run --port $(node -e "console.log(require('$OPENCLAW_CONFIG_PATH').gateway.port)")
|
|
269
273
|
EOF
|
|
270
274
|
chmod +x "${INSTANCE_DIR}/start.sh"
|
|
271
275
|
|
|
272
276
|
# --- 9. 执行拉起 ---
|
|
273
277
|
echo -e "${BLUE}⚡ 正在后台启动服务...${NC}"
|
|
274
|
-
echo -e "${YELLOW}👉 请稍后查看飞书,看到“运维”机器人上线后发送“你好”完成配对。${NC}"
|
|
275
278
|
nohup ./start.sh > "${INSTANCE_DIR}/workspace/server.log" 2>&1 &
|
|
276
279
|
|
|
277
280
|
sleep 2
|
|
278
281
|
if ps -p $! > /dev/null; then
|
|
279
282
|
echo -e "${GREEN}================================================${NC}"
|
|
280
283
|
echo -e "${GREEN}🎉 实例 [${INSTANCE_NAME}] 初始化成功!${NC}"
|
|
281
|
-
echo -e "🌐 本地网关:
|
|
282
|
-
echo -e "📄 实时日志:
|
|
284
|
+
echo -e "🌐 本地网关: http://localhost:${PORT}"
|
|
285
|
+
echo -e "📄 实时日志: tail -f ${INSTANCE_DIR}/workspace/server.log"
|
|
283
286
|
echo -e "${GREEN}================================================${NC}"
|
|
284
287
|
else
|
|
285
|
-
echo -e "${RED}❌
|
|
288
|
+
echo -e "${RED}❌ 启动失败,请运行 tail -n 20 ${INSTANCE_DIR}/workspace/server.log 查看报错内容${NC}"
|
|
286
289
|
fi
|