@agentchatme/openclaw 0.8.0 → 0.9.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/CHANGELOG.md +32 -1
- package/README.md +72 -70
- package/RUNBOOK.md +54 -41
- package/SECURITY.md +8 -5
- package/dist/binding/agents-anchor.cjs +24 -20
- package/dist/binding/agents-anchor.cjs.map +1 -1
- package/dist/binding/agents-anchor.d.cts +38 -31
- package/dist/binding/agents-anchor.d.ts +38 -31
- package/dist/binding/agents-anchor.js +24 -18
- package/dist/binding/agents-anchor.js.map +1 -1
- package/dist/credentials/read-env.cjs +16 -7
- package/dist/credentials/read-env.cjs.map +1 -1
- package/dist/credentials/read-env.d.cts +26 -10
- package/dist/credentials/read-env.d.ts +26 -10
- package/dist/credentials/read-env.js +12 -6
- package/dist/credentials/read-env.js.map +1 -1
- package/dist/index.cjs +978 -1421
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +155 -721
- package/dist/index.d.ts +155 -721
- package/dist/index.js +969 -1415
- package/dist/index.js.map +1 -1
- package/dist/openclaw-layout.cjs.map +1 -1
- package/dist/openclaw-layout.d.cts +1 -1
- package/dist/openclaw-layout.d.ts +1 -1
- package/dist/openclaw-layout.js.map +1 -1
- package/dist/setup-entry-Dq5Dwg8O.d.cts +655 -0
- package/dist/setup-entry-Dq5Dwg8O.d.ts +655 -0
- package/dist/setup-entry.cjs +967 -1427
- package/dist/setup-entry.cjs.map +1 -1
- package/dist/setup-entry.d.cts +2 -1
- package/dist/setup-entry.d.ts +2 -1
- package/dist/setup-entry.js +968 -1428
- package/dist/setup-entry.js.map +1 -1
- package/openclaw.plugin.json +6 -12
- package/package.json +6 -6
- package/skills/agentchat/SKILL.md +132 -78
- package/dist/setup-entry-DU51IFUF.d.cts +0 -154
- package/dist/setup-entry-DU51IFUF.d.ts +0 -154
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/credentials/read-env.ts"],"names":[],"mapp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Aa,CAAA;AAC9F;AAOO,IAAM,+BAAA,GAAkC;AAExC,SAAS,kCAAA,GAA8C;AAC5D,EAAA,OAAO,SAAA,CAAU,GAAA,CAAA,CAAK,OAAA,CAAQ,GAAA,CAAI,+BAA+B,KAAK,EAAA,EAAI,IAAA,EAAK,CAAE,WAAA,EAAa,CAAA;AAChG;AAGO,SAAS,6BAAA,GAAoD;AAClE,EAAA,MAAM,GAAA,GAAM,QAAQ,GAAA,CAAI,+BAAA;AACxB,EAAA,IAAI,QAAQ,MAAA,IAAa,GAAA,CAAI,IAAA,EAAK,KAAM,IAAI,OAAO,MAAA;AACnD,EAAA,MAAM,CAAA,GAAI,OAAO,GAAG,CAAA;AACpB,EAAA,OAAO,OAAO,QAAA,CAAS,CAAC,CAAA,IAAK,CAAA,GAAI,IAAI,CAAA,GAAI,MAAA;AAC3C","file":"read-env.cjs","sourcesContent":["/**\n * Environment variable readers — isolated from outbound networking.\n *\n * The wizard, runtime, and SDK consume the helpers below instead of\n * touching the host environment directly. The split keeps credential\n * lookup in a small audit-friendly module that imports nothing more\n * than its own typings: no SDK, no transport, no logging.\n *\n * See SECURITY.md (\"Defensive separation of credential lookup from\n * outbound I/O\") for the full rationale and the contract callers\n * must respect.\n */\n\n/** The variable the key lives under — the same name the hosted MCP server's bearer template references. */\nexport const API_KEY_ENV = 'AGENTCHAT_API_KEY'\n\n/**\n * Reads the AgentChat API key from `AGENTCHAT_API_KEY`.\n *\n * Returns the trimmed value when non-empty AND meeting `minLength`,\n * otherwise `undefined`. The min-length is supplied by the caller\n * (`MIN_API_KEY_LENGTH` from `channel-account.ts`) so this module\n * owns no domain constants.\n */\nexport function readApiKeyFromEnv(minLength: number): string | undefined {\n const raw = process.env[API_KEY_ENV]?.trim()\n if (!raw) return undefined\n if (raw.length < minLength) return undefined\n return raw\n}\n\n/**\n * Reads `OPENCLAW_PROFILE` for workspace path resolution. Mirrors\n * OpenClaw's own logic: non-default profile name →\n * `~/.openclaw/workspace-${profile}`.\n *\n * Returns the trimmed profile name only when it is set AND not equal\n * to \"default\" (case-insensitive). Returns `undefined` otherwise so\n * callers can fall through to the bare default.\n */\nexport function readOpenClawProfileFromEnv(): string | undefined {\n const raw = process.env.OPENCLAW_PROFILE?.trim()\n if (!raw) return undefined\n if (raw.toLowerCase() === 'default') return undefined\n return raw\n}\n\n/**\n * Reads `OPENCLAW_STATE_DIR` — OpenClaw's override for its state directory\n * (`~/.openclaw` by default; `resolveStateDir` in OpenClaw). The plugin\n * places the key in `<state dir>/.env`, which OpenClaw loads at start\n * (docs.openclaw.ai/gateway/configuration/environment-variables), and keeps\n * its own small state under `<state dir>/agentchat/`.\n */\nexport function readOpenClawStateDirFromEnv(): string | undefined {\n const raw = process.env.OPENCLAW_STATE_DIR?.trim()\n return raw ? raw : undefined\n}\n\n/**\n * Reads `OPENCLAW_WORKSPACE_DIR` — OpenClaw's explicit override for the\n * default agent workspace (`resolveDefaultAgentWorkspaceDir` in OpenClaw\n * checks it first).\n */\nexport function readOpenClawWorkspaceDirFromEnv(): string | undefined {\n const raw = process.env.OPENCLAW_WORKSPACE_DIR?.trim()\n return raw ? raw : undefined\n}\n\n/** `AGENTCHAT_WAKE=on|off` — the switch for the live receive path. */\nexport const WAKE_MODE_ENV = 'AGENTCHAT_WAKE'\n/** The old spelling (`AGENTCHAT_DOORBELL=v3|off`), still honoured. */\nexport const LEGACY_WAKE_MODE_ENV = 'AGENTCHAT_DOORBELL'\n\nexport type WakeMode = 'on' | 'off'\n\nexport interface WakeModeReading {\n readonly mode: WakeMode\n /** Which variable decided it (the new one wins when both are set). */\n readonly variable: typeof WAKE_MODE_ENV | typeof LEGACY_WAKE_MODE_ENV\n}\n\n/**\n * `AGENTCHAT_WAKE=off` keeps the hosted tools and the manual but opens no\n * socket, takes no wakes and starts no turns. Anything else (including\n * unset) is `on`. The old spelling `AGENTCHAT_DOORBELL=off` is accepted when\n * the new variable is unset; its old `v3` value reads as `on`.\n */\nexport function readWakeModeFromEnv(): WakeModeReading {\n const current = (process.env[WAKE_MODE_ENV] ?? '').trim().toLowerCase()\n if (current.length > 0) return { mode: current === 'off' ? 'off' : 'on', variable: WAKE_MODE_ENV }\n const legacy = (process.env[LEGACY_WAKE_MODE_ENV] ?? '').trim().toLowerCase()\n if (legacy.length > 0) return { mode: legacy === 'off' ? 'off' : 'on', variable: LEGACY_WAKE_MODE_ENV }\n return { mode: 'on', variable: WAKE_MODE_ENV }\n}\n\nconst OFF_TOKENS = new Set(['0', 'false', 'off', 'no'])\nconst ON_TOKENS = new Set(['1', 'true', 'on', 'yes'])\n\n/** `AGENTCHAT_REPLY_GATE_ENABLED=0` turns the gate step off; the agent then judges every card inside the turn. */\nexport function readReplyGateEnabledFromEnv(): boolean {\n return !OFF_TOKENS.has((process.env.AGENTCHAT_REPLY_GATE_ENABLED ?? '').trim().toLowerCase())\n}\n\n/**\n * `AGENTCHAT_REPLY_GATE_FAIL_OPEN` used to start the turn when the gate could\n * not run. The SDK's gate fails closed and the integration follows it; the\n * variable is read only to warn once that it is ignored.\n */\nexport const LEGACY_REPLY_GATE_FAIL_OPEN_ENV = 'AGENTCHAT_REPLY_GATE_FAIL_OPEN'\n\nexport function readLegacyReplyGateFailOpenFromEnv(): boolean {\n return ON_TOKENS.has((process.env[LEGACY_REPLY_GATE_FAIL_OPEN_ENV] ?? '').trim().toLowerCase())\n}\n\n/** `AGENTCHAT_REPLY_GATE_TIMEOUT_MS` — decision-call timeout override; `undefined` lets the gate apply its default. */\nexport function readReplyGateTimeoutMsFromEnv(): number | undefined {\n const raw = process.env.AGENTCHAT_REPLY_GATE_TIMEOUT_MS\n if (raw === undefined || raw.trim() === '') return undefined\n const n = Number(raw)\n return Number.isFinite(n) && n > 0 ? n : undefined\n}\n"]}
|
|
@@ -33,9 +33,10 @@ declare function readApiKeyFromEnv(minLength: number): string | undefined;
|
|
|
33
33
|
declare function readOpenClawProfileFromEnv(): string | undefined;
|
|
34
34
|
/**
|
|
35
35
|
* Reads `OPENCLAW_STATE_DIR` — OpenClaw's override for its state directory
|
|
36
|
-
* (`~/.openclaw` by default; `resolveStateDir` in OpenClaw). The
|
|
36
|
+
* (`~/.openclaw` by default; `resolveStateDir` in OpenClaw). The plugin
|
|
37
37
|
* places the key in `<state dir>/.env`, which OpenClaw loads at start
|
|
38
|
-
* (docs.openclaw.ai/gateway/configuration/environment-variables)
|
|
38
|
+
* (docs.openclaw.ai/gateway/configuration/environment-variables), and keeps
|
|
39
|
+
* its own small state under `<state dir>/agentchat/`.
|
|
39
40
|
*/
|
|
40
41
|
declare function readOpenClawStateDirFromEnv(): string | undefined;
|
|
41
42
|
/**
|
|
@@ -44,18 +45,33 @@ declare function readOpenClawStateDirFromEnv(): string | undefined;
|
|
|
44
45
|
* checks it first).
|
|
45
46
|
*/
|
|
46
47
|
declare function readOpenClawWorkspaceDirFromEnv(): string | undefined;
|
|
47
|
-
|
|
48
|
+
/** `AGENTCHAT_WAKE=on|off` — the switch for the live receive path. */
|
|
49
|
+
declare const WAKE_MODE_ENV = "AGENTCHAT_WAKE";
|
|
50
|
+
/** The old spelling (`AGENTCHAT_DOORBELL=v3|off`), still honoured. */
|
|
51
|
+
declare const LEGACY_WAKE_MODE_ENV = "AGENTCHAT_DOORBELL";
|
|
52
|
+
type WakeMode = 'on' | 'off';
|
|
53
|
+
interface WakeModeReading {
|
|
54
|
+
readonly mode: WakeMode;
|
|
55
|
+
/** Which variable decided it (the new one wins when both are set). */
|
|
56
|
+
readonly variable: typeof WAKE_MODE_ENV | typeof LEGACY_WAKE_MODE_ENV;
|
|
57
|
+
}
|
|
48
58
|
/**
|
|
49
|
-
* `
|
|
50
|
-
*
|
|
51
|
-
*
|
|
59
|
+
* `AGENTCHAT_WAKE=off` keeps the hosted tools and the manual but opens no
|
|
60
|
+
* socket, takes no wakes and starts no turns. Anything else (including
|
|
61
|
+
* unset) is `on`. The old spelling `AGENTCHAT_DOORBELL=off` is accepted when
|
|
62
|
+
* the new variable is unset; its old `v3` value reads as `on`.
|
|
52
63
|
*/
|
|
53
|
-
declare function
|
|
64
|
+
declare function readWakeModeFromEnv(): WakeModeReading;
|
|
54
65
|
/** `AGENTCHAT_REPLY_GATE_ENABLED=0` turns the gate step off; the agent then judges every card inside the turn. */
|
|
55
66
|
declare function readReplyGateEnabledFromEnv(): boolean;
|
|
56
|
-
/**
|
|
57
|
-
|
|
67
|
+
/**
|
|
68
|
+
* `AGENTCHAT_REPLY_GATE_FAIL_OPEN` used to start the turn when the gate could
|
|
69
|
+
* not run. The SDK's gate fails closed and the integration follows it; the
|
|
70
|
+
* variable is read only to warn once that it is ignored.
|
|
71
|
+
*/
|
|
72
|
+
declare const LEGACY_REPLY_GATE_FAIL_OPEN_ENV = "AGENTCHAT_REPLY_GATE_FAIL_OPEN";
|
|
73
|
+
declare function readLegacyReplyGateFailOpenFromEnv(): boolean;
|
|
58
74
|
/** `AGENTCHAT_REPLY_GATE_TIMEOUT_MS` — decision-call timeout override; `undefined` lets the gate apply its default. */
|
|
59
75
|
declare function readReplyGateTimeoutMsFromEnv(): number | undefined;
|
|
60
76
|
|
|
61
|
-
export { API_KEY_ENV, type
|
|
77
|
+
export { API_KEY_ENV, LEGACY_REPLY_GATE_FAIL_OPEN_ENV, LEGACY_WAKE_MODE_ENV, WAKE_MODE_ENV, type WakeMode, type WakeModeReading, readApiKeyFromEnv, readLegacyReplyGateFailOpenFromEnv, readOpenClawProfileFromEnv, readOpenClawStateDirFromEnv, readOpenClawWorkspaceDirFromEnv, readReplyGateEnabledFromEnv, readReplyGateTimeoutMsFromEnv, readWakeModeFromEnv };
|
|
@@ -33,9 +33,10 @@ declare function readApiKeyFromEnv(minLength: number): string | undefined;
|
|
|
33
33
|
declare function readOpenClawProfileFromEnv(): string | undefined;
|
|
34
34
|
/**
|
|
35
35
|
* Reads `OPENCLAW_STATE_DIR` — OpenClaw's override for its state directory
|
|
36
|
-
* (`~/.openclaw` by default; `resolveStateDir` in OpenClaw). The
|
|
36
|
+
* (`~/.openclaw` by default; `resolveStateDir` in OpenClaw). The plugin
|
|
37
37
|
* places the key in `<state dir>/.env`, which OpenClaw loads at start
|
|
38
|
-
* (docs.openclaw.ai/gateway/configuration/environment-variables)
|
|
38
|
+
* (docs.openclaw.ai/gateway/configuration/environment-variables), and keeps
|
|
39
|
+
* its own small state under `<state dir>/agentchat/`.
|
|
39
40
|
*/
|
|
40
41
|
declare function readOpenClawStateDirFromEnv(): string | undefined;
|
|
41
42
|
/**
|
|
@@ -44,18 +45,33 @@ declare function readOpenClawStateDirFromEnv(): string | undefined;
|
|
|
44
45
|
* checks it first).
|
|
45
46
|
*/
|
|
46
47
|
declare function readOpenClawWorkspaceDirFromEnv(): string | undefined;
|
|
47
|
-
|
|
48
|
+
/** `AGENTCHAT_WAKE=on|off` — the switch for the live receive path. */
|
|
49
|
+
declare const WAKE_MODE_ENV = "AGENTCHAT_WAKE";
|
|
50
|
+
/** The old spelling (`AGENTCHAT_DOORBELL=v3|off`), still honoured. */
|
|
51
|
+
declare const LEGACY_WAKE_MODE_ENV = "AGENTCHAT_DOORBELL";
|
|
52
|
+
type WakeMode = 'on' | 'off';
|
|
53
|
+
interface WakeModeReading {
|
|
54
|
+
readonly mode: WakeMode;
|
|
55
|
+
/** Which variable decided it (the new one wins when both are set). */
|
|
56
|
+
readonly variable: typeof WAKE_MODE_ENV | typeof LEGACY_WAKE_MODE_ENV;
|
|
57
|
+
}
|
|
48
58
|
/**
|
|
49
|
-
* `
|
|
50
|
-
*
|
|
51
|
-
*
|
|
59
|
+
* `AGENTCHAT_WAKE=off` keeps the hosted tools and the manual but opens no
|
|
60
|
+
* socket, takes no wakes and starts no turns. Anything else (including
|
|
61
|
+
* unset) is `on`. The old spelling `AGENTCHAT_DOORBELL=off` is accepted when
|
|
62
|
+
* the new variable is unset; its old `v3` value reads as `on`.
|
|
52
63
|
*/
|
|
53
|
-
declare function
|
|
64
|
+
declare function readWakeModeFromEnv(): WakeModeReading;
|
|
54
65
|
/** `AGENTCHAT_REPLY_GATE_ENABLED=0` turns the gate step off; the agent then judges every card inside the turn. */
|
|
55
66
|
declare function readReplyGateEnabledFromEnv(): boolean;
|
|
56
|
-
/**
|
|
57
|
-
|
|
67
|
+
/**
|
|
68
|
+
* `AGENTCHAT_REPLY_GATE_FAIL_OPEN` used to start the turn when the gate could
|
|
69
|
+
* not run. The SDK's gate fails closed and the integration follows it; the
|
|
70
|
+
* variable is read only to warn once that it is ignored.
|
|
71
|
+
*/
|
|
72
|
+
declare const LEGACY_REPLY_GATE_FAIL_OPEN_ENV = "AGENTCHAT_REPLY_GATE_FAIL_OPEN";
|
|
73
|
+
declare function readLegacyReplyGateFailOpenFromEnv(): boolean;
|
|
58
74
|
/** `AGENTCHAT_REPLY_GATE_TIMEOUT_MS` — decision-call timeout override; `undefined` lets the gate apply its default. */
|
|
59
75
|
declare function readReplyGateTimeoutMsFromEnv(): number | undefined;
|
|
60
76
|
|
|
61
|
-
export { API_KEY_ENV, type
|
|
77
|
+
export { API_KEY_ENV, LEGACY_REPLY_GATE_FAIL_OPEN_ENV, LEGACY_WAKE_MODE_ENV, WAKE_MODE_ENV, type WakeMode, type WakeModeReading, readApiKeyFromEnv, readLegacyReplyGateFailOpenFromEnv, readOpenClawProfileFromEnv, readOpenClawStateDirFromEnv, readOpenClawWorkspaceDirFromEnv, readReplyGateEnabledFromEnv, readReplyGateTimeoutMsFromEnv, readWakeModeFromEnv };
|
|
@@ -20,17 +20,23 @@ function readOpenClawWorkspaceDirFromEnv() {
|
|
|
20
20
|
const raw = process.env.OPENCLAW_WORKSPACE_DIR?.trim();
|
|
21
21
|
return raw ? raw : void 0;
|
|
22
22
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
var WAKE_MODE_ENV = "AGENTCHAT_WAKE";
|
|
24
|
+
var LEGACY_WAKE_MODE_ENV = "AGENTCHAT_DOORBELL";
|
|
25
|
+
function readWakeModeFromEnv() {
|
|
26
|
+
const current = (process.env[WAKE_MODE_ENV] ?? "").trim().toLowerCase();
|
|
27
|
+
if (current.length > 0) return { mode: current === "off" ? "off" : "on", variable: WAKE_MODE_ENV };
|
|
28
|
+
const legacy = (process.env[LEGACY_WAKE_MODE_ENV] ?? "").trim().toLowerCase();
|
|
29
|
+
if (legacy.length > 0) return { mode: legacy === "off" ? "off" : "on", variable: LEGACY_WAKE_MODE_ENV };
|
|
30
|
+
return { mode: "on", variable: WAKE_MODE_ENV };
|
|
26
31
|
}
|
|
27
32
|
var OFF_TOKENS = /* @__PURE__ */ new Set(["0", "false", "off", "no"]);
|
|
28
33
|
var ON_TOKENS = /* @__PURE__ */ new Set(["1", "true", "on", "yes"]);
|
|
29
34
|
function readReplyGateEnabledFromEnv() {
|
|
30
35
|
return !OFF_TOKENS.has((process.env.AGENTCHAT_REPLY_GATE_ENABLED ?? "").trim().toLowerCase());
|
|
31
36
|
}
|
|
32
|
-
|
|
33
|
-
|
|
37
|
+
var LEGACY_REPLY_GATE_FAIL_OPEN_ENV = "AGENTCHAT_REPLY_GATE_FAIL_OPEN";
|
|
38
|
+
function readLegacyReplyGateFailOpenFromEnv() {
|
|
39
|
+
return ON_TOKENS.has((process.env[LEGACY_REPLY_GATE_FAIL_OPEN_ENV] ?? "").trim().toLowerCase());
|
|
34
40
|
}
|
|
35
41
|
function readReplyGateTimeoutMsFromEnv() {
|
|
36
42
|
const raw = process.env.AGENTCHAT_REPLY_GATE_TIMEOUT_MS;
|
|
@@ -39,6 +45,6 @@ function readReplyGateTimeoutMsFromEnv() {
|
|
|
39
45
|
return Number.isFinite(n) && n > 0 ? n : void 0;
|
|
40
46
|
}
|
|
41
47
|
|
|
42
|
-
export { API_KEY_ENV, readApiKeyFromEnv,
|
|
48
|
+
export { API_KEY_ENV, LEGACY_REPLY_GATE_FAIL_OPEN_ENV, LEGACY_WAKE_MODE_ENV, WAKE_MODE_ENV, readApiKeyFromEnv, readLegacyReplyGateFailOpenFromEnv, readOpenClawProfileFromEnv, readOpenClawStateDirFromEnv, readOpenClawWorkspaceDirFromEnv, readReplyGateEnabledFromEnv, readReplyGateTimeoutMsFromEnv, readWakeModeFromEnv };
|
|
43
49
|
//# sourceMappingURL=read-env.js.map
|
|
44
50
|
//# sourceMappingURL=read-env.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/credentials/read-env.ts"],"names":[],"mappings":";AAcO,IAAM,WAAA,GAAc;AAUpB,SAAS,kBAAkB,SAAA,EAAuC;AACvE,EAAA,MAAM,GAAA,GAAM,OAAA,CAAQ,GAAA,CAAI,WAAW,GAAG,IAAA,EAAK;AAC3C,EAAA,IAAI,CAAC,KAAK,OAAO,MAAA;AACjB,EAAA,IAAI,GAAA,CAAI,MAAA,GAAS,SAAA,EAAW,OAAO,MAAA;AACnC,EAAA,OAAO,GAAA;AACT;AAWO,SAAS,0BAAA,GAAiD;AAC/D,EAAA,MAAM,GAAA,GAAM,OAAA,CAAQ,GAAA,CAAI,gBAAA,EAAkB,IAAA,EAAK;AAC/C,EAAA,IAAI,CAAC,KAAK,OAAO,MAAA;AACjB,EAAA,IAAI,GAAA,CAAI,WAAA,EAAY,KAAM,SAAA,EAAW,OAAO,MAAA;AAC5C,EAAA,OAAO,GAAA;AACT;
|
|
1
|
+
{"version":3,"sources":["../../src/credentials/read-env.ts"],"names":[],"mappings":";AAcO,IAAM,WAAA,GAAc;AAUpB,SAAS,kBAAkB,SAAA,EAAuC;AACvE,EAAA,MAAM,GAAA,GAAM,OAAA,CAAQ,GAAA,CAAI,WAAW,GAAG,IAAA,EAAK;AAC3C,EAAA,IAAI,CAAC,KAAK,OAAO,MAAA;AACjB,EAAA,IAAI,GAAA,CAAI,MAAA,GAAS,SAAA,EAAW,OAAO,MAAA;AACnC,EAAA,OAAO,GAAA;AACT;AAWO,SAAS,0BAAA,GAAiD;AAC/D,EAAA,MAAM,GAAA,GAAM,OAAA,CAAQ,GAAA,CAAI,gBAAA,EAAkB,IAAA,EAAK;AAC/C,EAAA,IAAI,CAAC,KAAK,OAAO,MAAA;AACjB,EAAA,IA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AQ,IAAA,EAAM,KAAK,CAAC,CAAA;AAG7C,SAAS,2BAAA,GAAuC;AACrD,EAAA,OAAO,CAAC,UAAA,CAAW,GAAA,CAAA,CAAK,OAAA,CAAQ,GAAA,CAAI,gCAAgC,EAAA,EAAI,IAAA,EAAK,CAAE,WAAA,EAAa,CAAA;AAC9F;AAOO,IAAM,+BAAA,GAAkC;AAExC,SAAS,kCAAA,GAA8C;AAC5D,EAAA,OAAO,SAAA,CAAU,GAAA,CAAA,CAAK,OAAA,CAAQ,GAAA,CAAI,+BAA+B,KAAK,EAAA,EAAI,IAAA,EAAK,CAAE,WAAA,EAAa,CAAA;AAChG;AAGO,SAAS,6BAAA,GAAoD;AAClE,EAAA,MAAM,GAAA,GAAM,QAAQ,GAAA,CAAI,+BAAA;AACxB,EAAA,IAAI,QAAQ,MAAA,IAAa,GAAA,CAAI,IAAA,EAAK,KAAM,IAAI,OAAO,MAAA;AACnD,EAAA,MAAM,CAAA,GAAI,OAAO,GAAG,CAAA;AACpB,EAAA,OAAO,OAAO,QAAA,CAAS,CAAC,CAAA,IAAK,CAAA,GAAI,IAAI,CAAA,GAAI,MAAA;AAC3C","file":"read-env.js","sourcesContent":["/**\n * Environment variable readers — isolated from outbound networking.\n *\n * The wizard, runtime, and SDK consume the helpers below instead of\n * touching the host environment directly. The split keeps credential\n * lookup in a small audit-friendly module that imports nothing more\n * than its own typings: no SDK, no transport, no logging.\n *\n * See SECURITY.md (\"Defensive separation of credential lookup from\n * outbound I/O\") for the full rationale and the contract callers\n * must respect.\n */\n\n/** The variable the key lives under — the same name the hosted MCP server's bearer template references. */\nexport const API_KEY_ENV = 'AGENTCHAT_API_KEY'\n\n/**\n * Reads the AgentChat API key from `AGENTCHAT_API_KEY`.\n *\n * Returns the trimmed value when non-empty AND meeting `minLength`,\n * otherwise `undefined`. The min-length is supplied by the caller\n * (`MIN_API_KEY_LENGTH` from `channel-account.ts`) so this module\n * owns no domain constants.\n */\nexport function readApiKeyFromEnv(minLength: number): string | undefined {\n const raw = process.env[API_KEY_ENV]?.trim()\n if (!raw) return undefined\n if (raw.length < minLength) return undefined\n return raw\n}\n\n/**\n * Reads `OPENCLAW_PROFILE` for workspace path resolution. Mirrors\n * OpenClaw's own logic: non-default profile name →\n * `~/.openclaw/workspace-${profile}`.\n *\n * Returns the trimmed profile name only when it is set AND not equal\n * to \"default\" (case-insensitive). Returns `undefined` otherwise so\n * callers can fall through to the bare default.\n */\nexport function readOpenClawProfileFromEnv(): string | undefined {\n const raw = process.env.OPENCLAW_PROFILE?.trim()\n if (!raw) return undefined\n if (raw.toLowerCase() === 'default') return undefined\n return raw\n}\n\n/**\n * Reads `OPENCLAW_STATE_DIR` — OpenClaw's override for its state directory\n * (`~/.openclaw` by default; `resolveStateDir` in OpenClaw). The plugin\n * places the key in `<state dir>/.env`, which OpenClaw loads at start\n * (docs.openclaw.ai/gateway/configuration/environment-variables), and keeps\n * its own small state under `<state dir>/agentchat/`.\n */\nexport function readOpenClawStateDirFromEnv(): string | undefined {\n const raw = process.env.OPENCLAW_STATE_DIR?.trim()\n return raw ? raw : undefined\n}\n\n/**\n * Reads `OPENCLAW_WORKSPACE_DIR` — OpenClaw's explicit override for the\n * default agent workspace (`resolveDefaultAgentWorkspaceDir` in OpenClaw\n * checks it first).\n */\nexport function readOpenClawWorkspaceDirFromEnv(): string | undefined {\n const raw = process.env.OPENCLAW_WORKSPACE_DIR?.trim()\n return raw ? raw : undefined\n}\n\n/** `AGENTCHAT_WAKE=on|off` — the switch for the live receive path. */\nexport const WAKE_MODE_ENV = 'AGENTCHAT_WAKE'\n/** The old spelling (`AGENTCHAT_DOORBELL=v3|off`), still honoured. */\nexport const LEGACY_WAKE_MODE_ENV = 'AGENTCHAT_DOORBELL'\n\nexport type WakeMode = 'on' | 'off'\n\nexport interface WakeModeReading {\n readonly mode: WakeMode\n /** Which variable decided it (the new one wins when both are set). */\n readonly variable: typeof WAKE_MODE_ENV | typeof LEGACY_WAKE_MODE_ENV\n}\n\n/**\n * `AGENTCHAT_WAKE=off` keeps the hosted tools and the manual but opens no\n * socket, takes no wakes and starts no turns. Anything else (including\n * unset) is `on`. The old spelling `AGENTCHAT_DOORBELL=off` is accepted when\n * the new variable is unset; its old `v3` value reads as `on`.\n */\nexport function readWakeModeFromEnv(): WakeModeReading {\n const current = (process.env[WAKE_MODE_ENV] ?? '').trim().toLowerCase()\n if (current.length > 0) return { mode: current === 'off' ? 'off' : 'on', variable: WAKE_MODE_ENV }\n const legacy = (process.env[LEGACY_WAKE_MODE_ENV] ?? '').trim().toLowerCase()\n if (legacy.length > 0) return { mode: legacy === 'off' ? 'off' : 'on', variable: LEGACY_WAKE_MODE_ENV }\n return { mode: 'on', variable: WAKE_MODE_ENV }\n}\n\nconst OFF_TOKENS = new Set(['0', 'false', 'off', 'no'])\nconst ON_TOKENS = new Set(['1', 'true', 'on', 'yes'])\n\n/** `AGENTCHAT_REPLY_GATE_ENABLED=0` turns the gate step off; the agent then judges every card inside the turn. */\nexport function readReplyGateEnabledFromEnv(): boolean {\n return !OFF_TOKENS.has((process.env.AGENTCHAT_REPLY_GATE_ENABLED ?? '').trim().toLowerCase())\n}\n\n/**\n * `AGENTCHAT_REPLY_GATE_FAIL_OPEN` used to start the turn when the gate could\n * not run. The SDK's gate fails closed and the integration follows it; the\n * variable is read only to warn once that it is ignored.\n */\nexport const LEGACY_REPLY_GATE_FAIL_OPEN_ENV = 'AGENTCHAT_REPLY_GATE_FAIL_OPEN'\n\nexport function readLegacyReplyGateFailOpenFromEnv(): boolean {\n return ON_TOKENS.has((process.env[LEGACY_REPLY_GATE_FAIL_OPEN_ENV] ?? '').trim().toLowerCase())\n}\n\n/** `AGENTCHAT_REPLY_GATE_TIMEOUT_MS` — decision-call timeout override; `undefined` lets the gate apply its default. */\nexport function readReplyGateTimeoutMsFromEnv(): number | undefined {\n const raw = process.env.AGENTCHAT_REPLY_GATE_TIMEOUT_MS\n if (raw === undefined || raw.trim() === '') return undefined\n const n = Number(raw)\n return Number.isFinite(n) && n > 0 ? n : undefined\n}\n"]}
|