@poolzin/pool-bot 2026.2.23 → 2026.2.25
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 +29 -0
- package/dist/acp/client.js +207 -18
- package/dist/acp/secret-file.js +22 -0
- package/dist/agents/agent-scope.js +10 -0
- package/dist/agents/bash-process-registry.test-helpers.js +29 -0
- package/dist/agents/bash-tools.exec-approval-request.js +20 -0
- package/dist/agents/bash-tools.exec-host-gateway.js +230 -0
- package/dist/agents/bash-tools.exec-host-node.js +235 -0
- package/dist/agents/bash-tools.exec-types.js +1 -0
- package/dist/agents/bash-tools.process.js +224 -218
- package/dist/agents/content-blocks.js +16 -0
- package/dist/agents/model-fallback.js +96 -101
- package/dist/agents/models-config.providers.js +299 -182
- package/dist/agents/pi-embedded-payloads.js +1 -0
- package/dist/agents/pi-embedded-runner/run.overflow-compaction.fixture.js +34 -0
- package/dist/agents/skills.test-helpers.js +13 -0
- package/dist/agents/stable-stringify.js +12 -0
- package/dist/agents/subagent-registry.mocks.shared.js +12 -0
- package/dist/agents/test-helpers/assistant-message-fixtures.js +29 -0
- package/dist/agents/test-helpers/pi-tools-sandbox-context.js +27 -0
- package/dist/agents/tool-policy-shared.js +108 -0
- package/dist/agents/tools/browser-tool.js +160 -54
- package/dist/agents/tools/cron-tool.test-helpers.js +12 -0
- package/dist/agents/tools/discord-actions-moderation-shared.js +27 -0
- package/dist/agents/tools/image-tool.js +214 -99
- package/dist/agents/tools/sessions-history-tool.js +140 -108
- package/dist/agents/workspace.js +222 -46
- package/dist/auto-reply/commands-registry.js +15 -18
- package/dist/auto-reply/fallback-state.js +114 -0
- package/dist/auto-reply/model-runtime.js +68 -0
- package/dist/auto-reply/reply/agent-runner-execution.js +36 -4
- package/dist/auto-reply/reply/agent-runner.js +165 -39
- package/dist/auto-reply/reply/commands-setunset-standard.js +13 -0
- package/dist/browser/config.js +26 -0
- package/dist/browser/navigation-guard.js +31 -0
- package/dist/browser/routes/agent.act.js +431 -424
- package/dist/browser/routes/agent.shared.js +47 -3
- package/dist/browser/routes/agent.snapshot.js +122 -116
- package/dist/browser/routes/agent.storage.js +303 -297
- package/dist/browser/routes/tabs.js +154 -100
- package/dist/browser/server-lifecycle.js +37 -0
- package/dist/build-info.json +3 -3
- package/dist/channels/allow-from.js +25 -0
- package/dist/channels/plugins/account-action-gate.js +13 -0
- package/dist/channels/plugins/message-actions.js +10 -0
- package/dist/channels/telegram/api.js +18 -0
- package/dist/cli/argv.js +84 -21
- package/dist/cli/banner.js +2 -1
- package/dist/cli/exec-approvals-cli.js +92 -124
- package/dist/cli/memory-cli.js +158 -61
- package/dist/cli/nodes-cli/register.push.js +63 -0
- package/dist/cli/nodes-media-utils.js +21 -0
- package/dist/cli/plugins-cli.js +245 -61
- package/dist/cli/program/build-program.js +3 -1
- package/dist/cli/program/command-registry.js +223 -136
- package/dist/cli/program/help.js +43 -12
- package/dist/cli/route.js +1 -1
- package/dist/cli/test-runtime-capture.js +24 -0
- package/dist/commands/agent.js +163 -87
- package/dist/commands/channels.mock-harness.js +23 -0
- package/dist/commands/daemon-install-runtime-warning.js +11 -0
- package/dist/commands/onboard-helpers.js +4 -4
- package/dist/commands/sessions.test-helpers.js +61 -0
- package/dist/compat/legacy-names.js +2 -2
- package/dist/config/commands.js +3 -0
- package/dist/config/config.js +1 -1
- package/dist/config/env-substitution.js +62 -34
- package/dist/config/env-vars.js +9 -0
- package/dist/config/io.js +571 -171
- package/dist/config/merge-patch.js +50 -4
- package/dist/config/redact-snapshot.js +404 -76
- package/dist/config/schema.js +58 -570
- package/dist/config/validation.js +140 -85
- package/dist/config/zod-schema.hooks.js +40 -11
- package/dist/config/zod-schema.installs.js +20 -0
- package/dist/config/zod-schema.js +8 -7
- package/dist/control-ui/assets/{index-HRr1grwl.js → index-Dvkl4Xlx.js} +2 -1
- package/dist/control-ui/assets/{index-HRr1grwl.js.map → index-Dvkl4Xlx.js.map} +1 -1
- package/dist/control-ui/index.html +1 -1
- package/dist/daemon/cmd-argv.js +21 -0
- package/dist/daemon/cmd-set.js +58 -0
- package/dist/daemon/service-types.js +1 -0
- package/dist/discord/monitor/exec-approvals.js +357 -162
- package/dist/gateway/auth.js +38 -3
- package/dist/gateway/call.js +149 -68
- package/dist/gateway/canvas-capability.js +75 -0
- package/dist/gateway/control-plane-audit.js +28 -0
- package/dist/gateway/control-plane-rate-limit.js +53 -0
- package/dist/gateway/events.js +1 -0
- package/dist/gateway/hooks.js +109 -54
- package/dist/gateway/http-common.js +22 -0
- package/dist/gateway/method-scopes.js +169 -0
- package/dist/gateway/net.js +23 -0
- package/dist/gateway/openresponses-http.js +120 -110
- package/dist/gateway/probe-auth.js +2 -0
- package/dist/gateway/protocol/index.js +3 -2
- package/dist/gateway/protocol/schema/protocol-schemas.js +2 -0
- package/dist/gateway/protocol/schema/push.js +18 -0
- package/dist/gateway/protocol/schema.js +1 -0
- package/dist/gateway/server-http.js +236 -52
- package/dist/gateway/server-methods/agent.js +162 -24
- package/dist/gateway/server-methods/chat.js +461 -130
- package/dist/gateway/server-methods/config.js +193 -150
- package/dist/gateway/server-methods/nodes.helpers.js +12 -0
- package/dist/gateway/server-methods/nodes.js +251 -69
- package/dist/gateway/server-methods/push.js +53 -0
- package/dist/gateway/server-reload-handlers.js +2 -3
- package/dist/gateway/server-runtime-config.js +5 -0
- package/dist/gateway/server-runtime-state.js +2 -0
- package/dist/gateway/server-ws-runtime.js +1 -0
- package/dist/gateway/server.impl.js +296 -139
- package/dist/gateway/session-preview.test-helpers.js +11 -0
- package/dist/gateway/startup-auth.js +126 -0
- package/dist/gateway/test-helpers.agent-results.js +15 -0
- package/dist/gateway/test-helpers.mocks.js +37 -14
- package/dist/gateway/test-helpers.server.js +161 -77
- package/dist/hooks/bundled/session-memory/handler.js +165 -34
- package/dist/hooks/gmail-watcher-lifecycle.js +23 -0
- package/dist/infra/archive-path.js +49 -0
- package/dist/infra/device-pairing.js +148 -167
- package/dist/infra/exec-approvals-allowlist.js +19 -70
- package/dist/infra/exec-approvals-analysis.js +44 -17
- package/dist/infra/exec-safe-bin-policy.js +269 -0
- package/dist/infra/fixed-window-rate-limit.js +33 -0
- package/dist/infra/git-root.js +61 -0
- package/dist/infra/heartbeat-active-hours.js +2 -2
- package/dist/infra/heartbeat-reason.js +40 -0
- package/dist/infra/heartbeat-runner.js +72 -32
- package/dist/infra/install-source-utils.js +91 -7
- package/dist/infra/node-pairing.js +50 -105
- package/dist/infra/npm-integrity.js +45 -0
- package/dist/infra/npm-pack-install.js +40 -0
- package/dist/infra/outbound/channel-adapters.js +20 -7
- package/dist/infra/outbound/message-action-runner.js +107 -327
- package/dist/infra/outbound/message.js +59 -36
- package/dist/infra/outbound/outbound-policy.js +52 -25
- package/dist/infra/outbound/outbound-send-service.js +58 -71
- package/dist/infra/pairing-files.js +10 -0
- package/dist/infra/plain-object.js +9 -0
- package/dist/infra/push-apns.js +365 -0
- package/dist/infra/restart-sentinel.js +16 -1
- package/dist/infra/restart.js +229 -26
- package/dist/infra/scp-host.js +54 -0
- package/dist/infra/update-startup.js +86 -9
- package/dist/media/inbound-path-policy.js +114 -0
- package/dist/media/input-files.js +16 -0
- package/dist/memory/test-manager.js +8 -0
- package/dist/plugin-sdk/temp-path.js +47 -0
- package/dist/plugins/discovery.js +217 -23
- package/dist/plugins/hook-runner-global.js +16 -0
- package/dist/plugins/loader.js +192 -26
- package/dist/plugins/logger.js +8 -0
- package/dist/plugins/manifest-registry.js +3 -0
- package/dist/plugins/path-safety.js +34 -0
- package/dist/plugins/registry.js +5 -2
- package/dist/plugins/runtime/index.js +271 -206
- package/dist/providers/github-copilot-models.js +4 -1
- package/dist/security/audit-channel.js +8 -19
- package/dist/security/audit-extra.async.js +354 -182
- package/dist/security/audit-extra.js +11 -1
- package/dist/security/audit-extra.sync.js +340 -33
- package/dist/security/audit-fs.js +31 -13
- package/dist/security/audit.js +145 -371
- package/dist/security/dm-policy-shared.js +24 -0
- package/dist/security/external-content.js +20 -8
- package/dist/security/fix.js +49 -85
- package/dist/security/scan-paths.js +20 -0
- package/dist/security/secret-equal.js +3 -7
- package/dist/security/windows-acl.js +30 -15
- package/dist/shared/node-list-parse.js +13 -0
- package/dist/shared/operator-scope-compat.js +37 -0
- package/dist/shared/text-chunking.js +29 -0
- package/dist/slack/blocks.test-helpers.js +31 -0
- package/dist/slack/monitor/mrkdwn.js +8 -0
- package/dist/telegram/bot-message-dispatch.js +366 -164
- package/dist/telegram/draft-stream.js +30 -7
- package/dist/telegram/reasoning-lane-coordinator.js +128 -0
- package/dist/terminal/prompt-select-styled.js +9 -0
- package/dist/test-utils/command-runner.js +6 -0
- package/dist/test-utils/internal-hook-event-payload.js +10 -0
- package/dist/test-utils/model-auth-mock.js +12 -0
- package/dist/test-utils/provider-usage-fetch.js +14 -0
- package/dist/test-utils/temp-home.js +33 -0
- package/dist/tui/components/chat-log.js +9 -0
- package/dist/tui/tui-command-handlers.js +36 -27
- package/dist/tui/tui-event-handlers.js +122 -32
- package/dist/tui/tui.js +181 -45
- package/dist/utils/mask-api-key.js +10 -0
- package/dist/utils/run-with-concurrency.js +39 -0
- package/dist/web/media.js +4 -0
- package/docs/tools/slash-commands.md +5 -1
- package/extensions/bluebubbles/package.json +1 -1
- package/extensions/copilot-proxy/package.json +1 -1
- package/extensions/diagnostics-otel/package.json +1 -1
- package/extensions/discord/package.json +1 -1
- package/extensions/feishu/package.json +1 -1
- package/extensions/feishu/src/external-keys.ts +19 -0
- package/extensions/google-antigravity-auth/package.json +1 -1
- package/extensions/google-gemini-cli-auth/package.json +1 -1
- package/extensions/googlechat/package.json +1 -1
- package/extensions/imessage/package.json +1 -1
- package/extensions/irc/package.json +1 -1
- package/extensions/line/package.json +1 -1
- package/extensions/llm-task/package.json +1 -1
- package/extensions/lobster/package.json +1 -1
- package/extensions/lobster/src/windows-spawn.ts +193 -0
- package/extensions/matrix/CHANGELOG.md +5 -0
- package/extensions/matrix/package.json +1 -1
- package/extensions/matrix/src/matrix/actions/limits.ts +6 -0
- package/extensions/mattermost/package.json +1 -1
- package/extensions/mattermost/src/mattermost/reactions.test-helpers.ts +83 -0
- package/extensions/memory-core/package.json +1 -1
- package/extensions/memory-lancedb/package.json +1 -1
- package/extensions/minimax-portal-auth/package.json +1 -1
- package/extensions/msteams/CHANGELOG.md +5 -0
- package/extensions/msteams/package.json +1 -1
- package/extensions/nextcloud-talk/package.json +1 -1
- package/extensions/nostr/CHANGELOG.md +5 -0
- package/extensions/nostr/package.json +1 -1
- package/extensions/open-prose/package.json +1 -1
- package/extensions/openai-codex-auth/package.json +1 -1
- package/extensions/signal/package.json +1 -1
- package/extensions/slack/package.json +1 -1
- package/extensions/telegram/package.json +1 -1
- package/extensions/tlon/package.json +1 -1
- package/extensions/twitch/CHANGELOG.md +5 -0
- package/extensions/twitch/package.json +1 -1
- package/extensions/voice-call/CHANGELOG.md +5 -0
- package/extensions/voice-call/package.json +1 -1
- package/extensions/whatsapp/package.json +1 -1
- package/extensions/zalo/CHANGELOG.md +5 -0
- package/extensions/zalo/package.json +1 -1
- package/extensions/zalouser/CHANGELOG.md +5 -0
- package/extensions/zalouser/package.json +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
import crypto from "node:crypto";
|
|
2
|
+
import { evaluateShellAllowlist, maxAsk, minSecurity, requiresExecApproval, resolveExecApprovals, resolveExecApprovalsFromFile, } from "../infra/exec-approvals.js";
|
|
3
|
+
import { buildNodeShellCommand } from "../infra/node-shell.js";
|
|
4
|
+
import { requestExecApprovalDecision } from "./bash-tools.exec-approval-request.js";
|
|
5
|
+
import { DEFAULT_APPROVAL_TIMEOUT_MS, createApprovalSlug, emitExecSystemEvent, } from "./bash-tools.exec-runtime.js";
|
|
6
|
+
import { callGatewayTool } from "./tools/gateway.js";
|
|
7
|
+
import { listNodes, resolveNodeIdFromList } from "./tools/nodes-utils.js";
|
|
8
|
+
export async function executeNodeHostCommand(params) {
|
|
9
|
+
const approvals = resolveExecApprovals(params.agentId, {
|
|
10
|
+
security: params.security,
|
|
11
|
+
ask: params.ask,
|
|
12
|
+
});
|
|
13
|
+
const hostSecurity = minSecurity(params.security, approvals.agent.security);
|
|
14
|
+
const hostAsk = maxAsk(params.ask, approvals.agent.ask);
|
|
15
|
+
const askFallback = approvals.agent.askFallback;
|
|
16
|
+
if (hostSecurity === "deny") {
|
|
17
|
+
throw new Error("exec denied: host=node security=deny");
|
|
18
|
+
}
|
|
19
|
+
if (params.boundNode && params.requestedNode && params.boundNode !== params.requestedNode) {
|
|
20
|
+
throw new Error(`exec node not allowed (bound to ${params.boundNode})`);
|
|
21
|
+
}
|
|
22
|
+
const nodeQuery = params.boundNode || params.requestedNode;
|
|
23
|
+
const nodes = await listNodes({});
|
|
24
|
+
if (nodes.length === 0) {
|
|
25
|
+
throw new Error("exec host=node requires a paired node (none available). This requires a companion app or node host.");
|
|
26
|
+
}
|
|
27
|
+
let nodeId;
|
|
28
|
+
try {
|
|
29
|
+
nodeId = resolveNodeIdFromList(nodes, nodeQuery, !nodeQuery);
|
|
30
|
+
}
|
|
31
|
+
catch (err) {
|
|
32
|
+
if (!nodeQuery && String(err).includes("node required")) {
|
|
33
|
+
throw new Error("exec host=node requires a node id when multiple nodes are available (set tools.exec.node or exec.node).", { cause: err });
|
|
34
|
+
}
|
|
35
|
+
throw err;
|
|
36
|
+
}
|
|
37
|
+
const nodeInfo = nodes.find((entry) => entry.nodeId === nodeId);
|
|
38
|
+
const supportsSystemRun = Array.isArray(nodeInfo?.commands)
|
|
39
|
+
? nodeInfo?.commands?.includes("system.run")
|
|
40
|
+
: false;
|
|
41
|
+
if (!supportsSystemRun) {
|
|
42
|
+
throw new Error("exec host=node requires a node that supports system.run (companion app or node host).");
|
|
43
|
+
}
|
|
44
|
+
const argv = buildNodeShellCommand(params.command, nodeInfo?.platform);
|
|
45
|
+
const nodeEnv = params.requestedEnv ? { ...params.requestedEnv } : undefined;
|
|
46
|
+
const baseAllowlistEval = evaluateShellAllowlist({
|
|
47
|
+
command: params.command,
|
|
48
|
+
allowlist: [],
|
|
49
|
+
safeBins: new Set(),
|
|
50
|
+
cwd: params.workdir,
|
|
51
|
+
env: params.env,
|
|
52
|
+
platform: nodeInfo?.platform,
|
|
53
|
+
trustedSafeBinDirs: params.trustedSafeBinDirs,
|
|
54
|
+
});
|
|
55
|
+
let analysisOk = baseAllowlistEval.analysisOk;
|
|
56
|
+
let allowlistSatisfied = false;
|
|
57
|
+
if (hostAsk === "on-miss" && hostSecurity === "allowlist" && analysisOk) {
|
|
58
|
+
try {
|
|
59
|
+
const approvalsSnapshot = await callGatewayTool("exec.approvals.node.get", { timeoutMs: 10_000 }, { nodeId });
|
|
60
|
+
const approvalsFile = approvalsSnapshot && typeof approvalsSnapshot === "object"
|
|
61
|
+
? approvalsSnapshot.file
|
|
62
|
+
: undefined;
|
|
63
|
+
if (approvalsFile && typeof approvalsFile === "object") {
|
|
64
|
+
const resolved = resolveExecApprovalsFromFile({
|
|
65
|
+
file: approvalsFile,
|
|
66
|
+
agentId: params.agentId,
|
|
67
|
+
overrides: { security: "allowlist" },
|
|
68
|
+
});
|
|
69
|
+
// Allowlist-only precheck; safe bins are node-local and may diverge.
|
|
70
|
+
const allowlistEval = evaluateShellAllowlist({
|
|
71
|
+
command: params.command,
|
|
72
|
+
allowlist: resolved.allowlist,
|
|
73
|
+
safeBins: new Set(),
|
|
74
|
+
cwd: params.workdir,
|
|
75
|
+
env: params.env,
|
|
76
|
+
platform: nodeInfo?.platform,
|
|
77
|
+
trustedSafeBinDirs: params.trustedSafeBinDirs,
|
|
78
|
+
});
|
|
79
|
+
allowlistSatisfied = allowlistEval.allowlistSatisfied;
|
|
80
|
+
analysisOk = allowlistEval.analysisOk;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
catch {
|
|
84
|
+
// Fall back to requiring approval if node approvals cannot be fetched.
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
const requiresAsk = requiresExecApproval({
|
|
88
|
+
ask: hostAsk,
|
|
89
|
+
security: hostSecurity,
|
|
90
|
+
analysisOk,
|
|
91
|
+
allowlistSatisfied,
|
|
92
|
+
});
|
|
93
|
+
const invokeTimeoutMs = Math.max(10_000, (typeof params.timeoutSec === "number" ? params.timeoutSec : params.defaultTimeoutSec) * 1000 +
|
|
94
|
+
5_000);
|
|
95
|
+
const buildInvokeParams = (approvedByAsk, approvalDecision, runId) => ({
|
|
96
|
+
nodeId,
|
|
97
|
+
command: "system.run",
|
|
98
|
+
params: {
|
|
99
|
+
command: argv,
|
|
100
|
+
rawCommand: params.command,
|
|
101
|
+
cwd: params.workdir,
|
|
102
|
+
env: nodeEnv,
|
|
103
|
+
timeoutMs: typeof params.timeoutSec === "number" ? params.timeoutSec * 1000 : undefined,
|
|
104
|
+
agentId: params.agentId,
|
|
105
|
+
sessionKey: params.sessionKey,
|
|
106
|
+
approved: approvedByAsk,
|
|
107
|
+
approvalDecision: approvalDecision ?? undefined,
|
|
108
|
+
runId: runId ?? undefined,
|
|
109
|
+
},
|
|
110
|
+
idempotencyKey: crypto.randomUUID(),
|
|
111
|
+
});
|
|
112
|
+
if (requiresAsk) {
|
|
113
|
+
const approvalId = crypto.randomUUID();
|
|
114
|
+
const approvalSlug = createApprovalSlug(approvalId);
|
|
115
|
+
const expiresAtMs = Date.now() + DEFAULT_APPROVAL_TIMEOUT_MS;
|
|
116
|
+
const contextKey = `exec:${approvalId}`;
|
|
117
|
+
const noticeSeconds = Math.max(1, Math.round(params.approvalRunningNoticeMs / 1000));
|
|
118
|
+
const warningText = params.warnings.length ? `${params.warnings.join("\n")}\n\n` : "";
|
|
119
|
+
void (async () => {
|
|
120
|
+
let decision = null;
|
|
121
|
+
try {
|
|
122
|
+
decision = await requestExecApprovalDecision({
|
|
123
|
+
id: approvalId,
|
|
124
|
+
command: params.command,
|
|
125
|
+
cwd: params.workdir,
|
|
126
|
+
host: "node",
|
|
127
|
+
security: hostSecurity,
|
|
128
|
+
ask: hostAsk,
|
|
129
|
+
agentId: params.agentId,
|
|
130
|
+
sessionKey: params.sessionKey,
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
catch {
|
|
134
|
+
emitExecSystemEvent(`Exec denied (node=${nodeId} id=${approvalId}, approval-request-failed): ${params.command}`, { sessionKey: params.notifySessionKey, contextKey });
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
let approvedByAsk = false;
|
|
138
|
+
let approvalDecision = null;
|
|
139
|
+
let deniedReason = null;
|
|
140
|
+
if (decision === "deny") {
|
|
141
|
+
deniedReason = "user-denied";
|
|
142
|
+
}
|
|
143
|
+
else if (!decision) {
|
|
144
|
+
if (askFallback === "full") {
|
|
145
|
+
approvedByAsk = true;
|
|
146
|
+
approvalDecision = "allow-once";
|
|
147
|
+
}
|
|
148
|
+
else if (askFallback === "allowlist") {
|
|
149
|
+
// Defer allowlist enforcement to the node host.
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
deniedReason = "approval-timeout";
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
else if (decision === "allow-once") {
|
|
156
|
+
approvedByAsk = true;
|
|
157
|
+
approvalDecision = "allow-once";
|
|
158
|
+
}
|
|
159
|
+
else if (decision === "allow-always") {
|
|
160
|
+
approvedByAsk = true;
|
|
161
|
+
approvalDecision = "allow-always";
|
|
162
|
+
}
|
|
163
|
+
if (deniedReason) {
|
|
164
|
+
emitExecSystemEvent(`Exec denied (node=${nodeId} id=${approvalId}, ${deniedReason}): ${params.command}`, {
|
|
165
|
+
sessionKey: params.notifySessionKey,
|
|
166
|
+
contextKey,
|
|
167
|
+
});
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
let runningTimer = null;
|
|
171
|
+
if (params.approvalRunningNoticeMs > 0) {
|
|
172
|
+
runningTimer = setTimeout(() => {
|
|
173
|
+
emitExecSystemEvent(`Exec running (node=${nodeId} id=${approvalId}, >${noticeSeconds}s): ${params.command}`, { sessionKey: params.notifySessionKey, contextKey });
|
|
174
|
+
}, params.approvalRunningNoticeMs);
|
|
175
|
+
}
|
|
176
|
+
try {
|
|
177
|
+
await callGatewayTool("node.invoke", { timeoutMs: invokeTimeoutMs }, buildInvokeParams(approvedByAsk, approvalDecision, approvalId));
|
|
178
|
+
}
|
|
179
|
+
catch {
|
|
180
|
+
emitExecSystemEvent(`Exec denied (node=${nodeId} id=${approvalId}, invoke-failed): ${params.command}`, {
|
|
181
|
+
sessionKey: params.notifySessionKey,
|
|
182
|
+
contextKey,
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
finally {
|
|
186
|
+
if (runningTimer) {
|
|
187
|
+
clearTimeout(runningTimer);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
})();
|
|
191
|
+
return {
|
|
192
|
+
content: [
|
|
193
|
+
{
|
|
194
|
+
type: "text",
|
|
195
|
+
text: `${warningText}Approval required (id ${approvalSlug}). ` +
|
|
196
|
+
"Approve to run; updates will arrive after completion.",
|
|
197
|
+
},
|
|
198
|
+
],
|
|
199
|
+
details: {
|
|
200
|
+
status: "approval-pending",
|
|
201
|
+
approvalId,
|
|
202
|
+
approvalSlug,
|
|
203
|
+
expiresAtMs,
|
|
204
|
+
host: "node",
|
|
205
|
+
command: params.command,
|
|
206
|
+
cwd: params.workdir,
|
|
207
|
+
nodeId,
|
|
208
|
+
},
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
const startedAt = Date.now();
|
|
212
|
+
const raw = await callGatewayTool("node.invoke", { timeoutMs: invokeTimeoutMs }, buildInvokeParams(false, null));
|
|
213
|
+
const payload = raw && typeof raw === "object" ? raw.payload : undefined;
|
|
214
|
+
const payloadObj = payload && typeof payload === "object" ? payload : {};
|
|
215
|
+
const stdout = typeof payloadObj.stdout === "string" ? payloadObj.stdout : "";
|
|
216
|
+
const stderr = typeof payloadObj.stderr === "string" ? payloadObj.stderr : "";
|
|
217
|
+
const errorText = typeof payloadObj.error === "string" ? payloadObj.error : "";
|
|
218
|
+
const success = typeof payloadObj.success === "boolean" ? payloadObj.success : false;
|
|
219
|
+
const exitCode = typeof payloadObj.exitCode === "number" ? payloadObj.exitCode : null;
|
|
220
|
+
return {
|
|
221
|
+
content: [
|
|
222
|
+
{
|
|
223
|
+
type: "text",
|
|
224
|
+
text: stdout || stderr || errorText || "",
|
|
225
|
+
},
|
|
226
|
+
],
|
|
227
|
+
details: {
|
|
228
|
+
status: success ? "completed" : "failed",
|
|
229
|
+
exitCode,
|
|
230
|
+
durationMs: Date.now() - startedAt,
|
|
231
|
+
aggregated: [stdout, stderr, errorText].filter(Boolean).join("\n"),
|
|
232
|
+
cwd: params.workdir,
|
|
233
|
+
},
|
|
234
|
+
};
|
|
235
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|