@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
|
@@ -1,170 +1,257 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { sessionsCommand } from "../../commands/sessions.js";
|
|
4
|
-
import { statusCommand } from "../../commands/status.js";
|
|
5
|
-
import { defaultRuntime } from "../../runtime.js";
|
|
6
|
-
import { getFlagValue, getPositiveIntFlagValue, getVerboseFlag, hasFlag } from "../argv.js";
|
|
7
|
-
import { registerBrowserCli } from "../browser-cli.js";
|
|
8
|
-
import { registerConfigCli } from "../config-cli.js";
|
|
9
|
-
import { registerMemoryCli, runMemoryStatus } from "../memory-cli.js";
|
|
10
|
-
import { registerAgentCommands } from "./register.agent.js";
|
|
11
|
-
import { registerCompletionCommand } from "./register.completion.js";
|
|
12
|
-
import { registerConfigureCommand } from "./register.configure.js";
|
|
13
|
-
import { registerMaintenanceCommands } from "./register.maintenance.js";
|
|
14
|
-
import { registerMessageCommands } from "./register.message.js";
|
|
15
|
-
import { registerOnboardCommand } from "./register.onboard.js";
|
|
16
|
-
import { registerSetupCommand } from "./register.setup.js";
|
|
17
|
-
import { registerStatusHealthSessionsCommands } from "./register.status-health-sessions.js";
|
|
1
|
+
import { getPrimaryCommand, hasHelpOrVersion } from "../argv.js";
|
|
2
|
+
import { reparseProgramFromActionArgs } from "./action-reparse.js";
|
|
18
3
|
import { registerSubCliCommands } from "./register.subclis.js";
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
const verbose = getVerboseFlag(argv, { includeDebug: true });
|
|
25
|
-
const timeoutMs = getPositiveIntFlagValue(argv, "--timeout");
|
|
26
|
-
if (timeoutMs === null)
|
|
27
|
-
return false;
|
|
28
|
-
await healthCommand({ json, timeoutMs, verbose }, defaultRuntime);
|
|
29
|
-
return true;
|
|
30
|
-
},
|
|
31
|
-
};
|
|
32
|
-
const routeStatus = {
|
|
33
|
-
match: (path) => path[0] === "status",
|
|
34
|
-
loadPlugins: true,
|
|
35
|
-
run: async (argv) => {
|
|
36
|
-
const json = hasFlag(argv, "--json");
|
|
37
|
-
const deep = hasFlag(argv, "--deep");
|
|
38
|
-
const all = hasFlag(argv, "--all");
|
|
39
|
-
const usage = hasFlag(argv, "--usage");
|
|
40
|
-
const verbose = getVerboseFlag(argv, { includeDebug: true });
|
|
41
|
-
const timeoutMs = getPositiveIntFlagValue(argv, "--timeout");
|
|
42
|
-
if (timeoutMs === null)
|
|
43
|
-
return false;
|
|
44
|
-
await statusCommand({ json, deep, all, usage, timeoutMs, verbose }, defaultRuntime);
|
|
45
|
-
return true;
|
|
46
|
-
},
|
|
47
|
-
};
|
|
48
|
-
const routeSessions = {
|
|
49
|
-
match: (path) => path[0] === "sessions",
|
|
50
|
-
run: async (argv) => {
|
|
51
|
-
const json = hasFlag(argv, "--json");
|
|
52
|
-
const store = getFlagValue(argv, "--store");
|
|
53
|
-
if (store === null)
|
|
54
|
-
return false;
|
|
55
|
-
const active = getFlagValue(argv, "--active");
|
|
56
|
-
if (active === null)
|
|
57
|
-
return false;
|
|
58
|
-
await sessionsCommand({ json, store, active }, defaultRuntime);
|
|
59
|
-
return true;
|
|
60
|
-
},
|
|
61
|
-
};
|
|
62
|
-
const routeAgentsList = {
|
|
63
|
-
match: (path) => path[0] === "agents" && path[1] === "list",
|
|
64
|
-
run: async (argv) => {
|
|
65
|
-
const json = hasFlag(argv, "--json");
|
|
66
|
-
const bindings = hasFlag(argv, "--bindings");
|
|
67
|
-
await agentsListCommand({ json, bindings }, defaultRuntime);
|
|
68
|
-
return true;
|
|
69
|
-
},
|
|
70
|
-
};
|
|
71
|
-
const routeMemoryStatus = {
|
|
72
|
-
match: (path) => path[0] === "memory" && path[1] === "status",
|
|
73
|
-
run: async (argv) => {
|
|
74
|
-
const agent = getFlagValue(argv, "--agent");
|
|
75
|
-
if (agent === null)
|
|
76
|
-
return false;
|
|
77
|
-
const json = hasFlag(argv, "--json");
|
|
78
|
-
const deep = hasFlag(argv, "--deep");
|
|
79
|
-
const index = hasFlag(argv, "--index");
|
|
80
|
-
const verbose = hasFlag(argv, "--verbose");
|
|
81
|
-
await runMemoryStatus({ agent, json, deep, index, verbose });
|
|
82
|
-
return true;
|
|
83
|
-
},
|
|
4
|
+
const shouldRegisterCorePrimaryOnly = (argv) => {
|
|
5
|
+
if (hasHelpOrVersion(argv)) {
|
|
6
|
+
return false;
|
|
7
|
+
}
|
|
8
|
+
return true;
|
|
84
9
|
};
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
},
|
|
90
|
-
{
|
|
91
|
-
id: "onboard",
|
|
92
|
-
register: ({ program }) => registerOnboardCommand(program),
|
|
93
|
-
},
|
|
10
|
+
// Note for humans and agents:
|
|
11
|
+
// If you update the list of commands, also check whether they have subcommands
|
|
12
|
+
// and set the flag accordingly.
|
|
13
|
+
const coreEntries = [
|
|
94
14
|
{
|
|
95
|
-
|
|
96
|
-
|
|
15
|
+
commands: [
|
|
16
|
+
{
|
|
17
|
+
name: "setup",
|
|
18
|
+
description: "Initialize local config and agent workspace",
|
|
19
|
+
hasSubcommands: false,
|
|
20
|
+
},
|
|
21
|
+
],
|
|
22
|
+
register: async ({ program }) => {
|
|
23
|
+
const mod = await import("./register.setup.js");
|
|
24
|
+
mod.registerSetupCommand(program);
|
|
25
|
+
},
|
|
97
26
|
},
|
|
98
27
|
{
|
|
99
|
-
|
|
100
|
-
|
|
28
|
+
commands: [
|
|
29
|
+
{
|
|
30
|
+
name: "onboard",
|
|
31
|
+
description: "Interactive onboarding wizard for gateway, workspace, and skills",
|
|
32
|
+
hasSubcommands: false,
|
|
33
|
+
},
|
|
34
|
+
],
|
|
35
|
+
register: async ({ program }) => {
|
|
36
|
+
const mod = await import("./register.onboard.js");
|
|
37
|
+
mod.registerOnboardCommand(program);
|
|
38
|
+
},
|
|
101
39
|
},
|
|
102
40
|
{
|
|
103
|
-
|
|
104
|
-
|
|
41
|
+
commands: [
|
|
42
|
+
{
|
|
43
|
+
name: "configure",
|
|
44
|
+
description: "Interactive setup wizard for credentials, channels, gateway, and agent defaults",
|
|
45
|
+
hasSubcommands: false,
|
|
46
|
+
},
|
|
47
|
+
],
|
|
48
|
+
register: async ({ program }) => {
|
|
49
|
+
const mod = await import("./register.configure.js");
|
|
50
|
+
mod.registerConfigureCommand(program);
|
|
51
|
+
},
|
|
105
52
|
},
|
|
106
53
|
{
|
|
107
|
-
|
|
108
|
-
|
|
54
|
+
commands: [
|
|
55
|
+
{
|
|
56
|
+
name: "config",
|
|
57
|
+
description: "Non-interactive config helpers (get/set/unset). Default: starts setup wizard.",
|
|
58
|
+
hasSubcommands: true,
|
|
59
|
+
},
|
|
60
|
+
],
|
|
61
|
+
register: async ({ program }) => {
|
|
62
|
+
const mod = await import("../config-cli.js");
|
|
63
|
+
mod.registerConfigCli(program);
|
|
64
|
+
},
|
|
109
65
|
},
|
|
110
66
|
{
|
|
111
|
-
|
|
112
|
-
|
|
67
|
+
commands: [
|
|
68
|
+
{
|
|
69
|
+
name: "doctor",
|
|
70
|
+
description: "Health checks + quick fixes for the gateway and channels",
|
|
71
|
+
hasSubcommands: false,
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
name: "dashboard",
|
|
75
|
+
description: "Open the Control UI with your current token",
|
|
76
|
+
hasSubcommands: false,
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
name: "reset",
|
|
80
|
+
description: "Reset local config/state (keeps the CLI installed)",
|
|
81
|
+
hasSubcommands: false,
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
name: "uninstall",
|
|
85
|
+
description: "Uninstall the gateway service + local data (CLI remains)",
|
|
86
|
+
hasSubcommands: false,
|
|
87
|
+
},
|
|
88
|
+
],
|
|
89
|
+
register: async ({ program }) => {
|
|
90
|
+
const mod = await import("./register.maintenance.js");
|
|
91
|
+
mod.registerMaintenanceCommands(program);
|
|
92
|
+
},
|
|
113
93
|
},
|
|
114
94
|
{
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
95
|
+
commands: [
|
|
96
|
+
{
|
|
97
|
+
name: "message",
|
|
98
|
+
description: "Send, read, and manage messages",
|
|
99
|
+
hasSubcommands: true,
|
|
100
|
+
},
|
|
101
|
+
],
|
|
102
|
+
register: async ({ program, ctx }) => {
|
|
103
|
+
const mod = await import("./register.message.js");
|
|
104
|
+
mod.registerMessageCommands(program, ctx);
|
|
105
|
+
},
|
|
118
106
|
},
|
|
119
107
|
{
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
108
|
+
commands: [
|
|
109
|
+
{
|
|
110
|
+
name: "memory",
|
|
111
|
+
description: "Search and reindex memory files",
|
|
112
|
+
hasSubcommands: true,
|
|
113
|
+
},
|
|
114
|
+
],
|
|
115
|
+
register: async ({ program }) => {
|
|
116
|
+
const mod = await import("../memory-cli.js");
|
|
117
|
+
mod.registerMemoryCli(program);
|
|
118
|
+
},
|
|
123
119
|
},
|
|
124
120
|
{
|
|
125
|
-
|
|
126
|
-
|
|
121
|
+
commands: [
|
|
122
|
+
{
|
|
123
|
+
name: "agent",
|
|
124
|
+
description: "Run one agent turn via the Gateway",
|
|
125
|
+
hasSubcommands: false,
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
name: "agents",
|
|
129
|
+
description: "Manage isolated agents (workspaces, auth, routing)",
|
|
130
|
+
hasSubcommands: true,
|
|
131
|
+
},
|
|
132
|
+
],
|
|
133
|
+
register: async ({ program, ctx }) => {
|
|
134
|
+
const mod = await import("./register.agent.js");
|
|
135
|
+
mod.registerAgentCommands(program, {
|
|
136
|
+
agentChannelOptions: ctx.agentChannelOptions,
|
|
137
|
+
});
|
|
138
|
+
},
|
|
127
139
|
},
|
|
128
140
|
{
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
141
|
+
commands: [
|
|
142
|
+
{
|
|
143
|
+
name: "status",
|
|
144
|
+
description: "Show channel health and recent session recipients",
|
|
145
|
+
hasSubcommands: false,
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
name: "health",
|
|
149
|
+
description: "Fetch health from the running gateway",
|
|
150
|
+
hasSubcommands: false,
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
name: "sessions",
|
|
154
|
+
description: "List stored conversation sessions",
|
|
155
|
+
hasSubcommands: false,
|
|
156
|
+
},
|
|
157
|
+
],
|
|
158
|
+
register: async ({ program }) => {
|
|
159
|
+
const mod = await import("./register.status-health-sessions.js");
|
|
160
|
+
mod.registerStatusHealthSessionsCommands(program);
|
|
161
|
+
},
|
|
132
162
|
},
|
|
133
163
|
{
|
|
134
|
-
|
|
135
|
-
|
|
164
|
+
commands: [
|
|
165
|
+
{
|
|
166
|
+
name: "browser",
|
|
167
|
+
description: "Manage Pool Bot's dedicated browser (Chrome/Chromium)",
|
|
168
|
+
hasSubcommands: true,
|
|
169
|
+
},
|
|
170
|
+
],
|
|
171
|
+
register: async ({ program }) => {
|
|
172
|
+
const mod = await import("../browser-cli.js");
|
|
173
|
+
mod.registerBrowserCli(program);
|
|
174
|
+
},
|
|
136
175
|
},
|
|
137
176
|
];
|
|
177
|
+
function collectCoreCliCommandNames(predicate) {
|
|
178
|
+
const seen = new Set();
|
|
179
|
+
const names = [];
|
|
180
|
+
for (const entry of coreEntries) {
|
|
181
|
+
for (const command of entry.commands) {
|
|
182
|
+
if (predicate && !predicate(command)) {
|
|
183
|
+
continue;
|
|
184
|
+
}
|
|
185
|
+
if (seen.has(command.name)) {
|
|
186
|
+
continue;
|
|
187
|
+
}
|
|
188
|
+
seen.add(command.name);
|
|
189
|
+
names.push(command.name);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
return names;
|
|
193
|
+
}
|
|
138
194
|
export function getCoreCliCommandNames() {
|
|
139
|
-
return
|
|
195
|
+
return collectCoreCliCommandNames();
|
|
196
|
+
}
|
|
197
|
+
export function getCoreCliCommandsWithSubcommands() {
|
|
198
|
+
return collectCoreCliCommandNames((command) => command.hasSubcommands);
|
|
199
|
+
}
|
|
200
|
+
function removeCommand(program, command) {
|
|
201
|
+
const commands = program.commands;
|
|
202
|
+
const index = commands.indexOf(command);
|
|
203
|
+
if (index >= 0) {
|
|
204
|
+
commands.splice(index, 1);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
function removeEntryCommands(program, entry) {
|
|
208
|
+
// Some registrars install multiple top-level commands (e.g. status/health/sessions).
|
|
209
|
+
// Remove placeholders/old registrations for all names in the entry before re-registering.
|
|
210
|
+
for (const cmd of entry.commands) {
|
|
211
|
+
const existing = program.commands.find((c) => c.name() === cmd.name);
|
|
212
|
+
if (existing) {
|
|
213
|
+
removeCommand(program, existing);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
function registerLazyCoreCommand(program, ctx, entry, command) {
|
|
218
|
+
const placeholder = program.command(command.name).description(command.description);
|
|
219
|
+
placeholder.allowUnknownOption(true);
|
|
220
|
+
placeholder.allowExcessArguments(true);
|
|
221
|
+
placeholder.action(async (...actionArgs) => {
|
|
222
|
+
removeEntryCommands(program, entry);
|
|
223
|
+
await entry.register({ program, ctx, argv: process.argv });
|
|
224
|
+
await reparseProgramFromActionArgs(program, actionArgs);
|
|
225
|
+
});
|
|
140
226
|
}
|
|
141
227
|
export async function registerCoreCliByName(program, ctx, name, argv = process.argv) {
|
|
142
|
-
const entry =
|
|
143
|
-
if (!entry)
|
|
228
|
+
const entry = coreEntries.find((candidate) => candidate.commands.some((cmd) => cmd.name === name));
|
|
229
|
+
if (!entry) {
|
|
144
230
|
return false;
|
|
145
|
-
const existing = program.commands.find((c) => c.name() === name);
|
|
146
|
-
if (existing) {
|
|
147
|
-
const commands = program.commands;
|
|
148
|
-
const index = commands.indexOf(existing);
|
|
149
|
-
if (index >= 0)
|
|
150
|
-
commands.splice(index, 1);
|
|
151
231
|
}
|
|
152
|
-
|
|
232
|
+
removeEntryCommands(program, entry);
|
|
233
|
+
await entry.register({ program, ctx, argv });
|
|
153
234
|
return true;
|
|
154
235
|
}
|
|
155
|
-
export function
|
|
156
|
-
|
|
157
|
-
|
|
236
|
+
export function registerCoreCliCommands(program, ctx, argv) {
|
|
237
|
+
const primary = getPrimaryCommand(argv);
|
|
238
|
+
if (primary && shouldRegisterCorePrimaryOnly(argv)) {
|
|
239
|
+
const entry = coreEntries.find((candidate) => candidate.commands.some((cmd) => cmd.name === primary));
|
|
240
|
+
if (entry) {
|
|
241
|
+
const cmd = entry.commands.find((c) => c.name === primary);
|
|
242
|
+
if (cmd) {
|
|
243
|
+
registerLazyCoreCommand(program, ctx, entry, cmd);
|
|
244
|
+
}
|
|
245
|
+
return;
|
|
246
|
+
}
|
|
158
247
|
}
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
if (!entry.routes)
|
|
163
|
-
continue;
|
|
164
|
-
for (const route of entry.routes) {
|
|
165
|
-
if (route.match(path))
|
|
166
|
-
return route;
|
|
248
|
+
for (const entry of coreEntries) {
|
|
249
|
+
for (const cmd of entry.commands) {
|
|
250
|
+
registerLazyCoreCommand(program, ctx, entry, cmd);
|
|
167
251
|
}
|
|
168
252
|
}
|
|
169
|
-
|
|
253
|
+
}
|
|
254
|
+
export function registerProgramCommands(program, ctx, argv = process.argv) {
|
|
255
|
+
registerCoreCliCommands(program, ctx, argv);
|
|
256
|
+
registerSubCliCommands(program, argv);
|
|
170
257
|
}
|
package/dist/cli/program/help.js
CHANGED
|
@@ -1,9 +1,20 @@
|
|
|
1
1
|
import { formatDocsLink } from "../../terminal/links.js";
|
|
2
2
|
import { isRich, theme } from "../../terminal/theme.js";
|
|
3
|
+
import { escapeRegExp } from "../../utils.js";
|
|
4
|
+
import { hasFlag, hasRootVersionAlias } from "../argv.js";
|
|
3
5
|
import { formatCliBannerLine, hasEmittedCliBanner } from "../banner.js";
|
|
4
6
|
import { replaceCliName, resolveCliName } from "../cli-name.js";
|
|
7
|
+
import { getCoreCliCommandsWithSubcommands } from "./command-registry.js";
|
|
8
|
+
import { getSubCliCommandsWithSubcommands } from "./register.subclis.js";
|
|
5
9
|
const CLI_NAME = resolveCliName();
|
|
10
|
+
const CLI_NAME_PATTERN = escapeRegExp(CLI_NAME);
|
|
11
|
+
const ROOT_COMMANDS_WITH_SUBCOMMANDS = new Set([
|
|
12
|
+
...getCoreCliCommandsWithSubcommands(),
|
|
13
|
+
...getSubCliCommandsWithSubcommands(),
|
|
14
|
+
]);
|
|
15
|
+
const ROOT_COMMANDS_HINT = "Hint: commands suffixed with * have subcommands. Run <command> --help for details.";
|
|
6
16
|
const EXAMPLES = [
|
|
17
|
+
["poolbot models --help", "Show detailed help for the models command."],
|
|
7
18
|
["poolbot channels login --verbose", "Link personal WhatsApp Web and show QR + connection logs."],
|
|
8
19
|
[
|
|
9
20
|
'poolbot message send --target +15555550123 --message "Hi" --json',
|
|
@@ -30,38 +41,58 @@ export function configureProgramHelp(program, ctx) {
|
|
|
30
41
|
.option("--dev", "Dev profile: isolate state under ~/.poolbot-dev, default gateway port 19001, and shift derived ports (browser/canvas)")
|
|
31
42
|
.option("--profile <name>", "Use a named profile (isolates POOLBOT_STATE_DIR/POOLBOT_CONFIG_PATH under ~/.poolbot-<name>)");
|
|
32
43
|
program.option("--no-color", "Disable ANSI colors", false);
|
|
44
|
+
program.helpOption("-h, --help", "Display help for command");
|
|
45
|
+
program.helpCommand("help [command]", "Display help for command");
|
|
33
46
|
program.configureHelp({
|
|
47
|
+
// sort options and subcommands alphabetically
|
|
48
|
+
sortSubcommands: true,
|
|
49
|
+
sortOptions: true,
|
|
34
50
|
optionTerm: (option) => theme.option(option.flags),
|
|
35
|
-
subcommandTerm: (cmd) =>
|
|
51
|
+
subcommandTerm: (cmd) => {
|
|
52
|
+
const isRootCommand = cmd.parent === program;
|
|
53
|
+
const hasSubcommands = isRootCommand && ROOT_COMMANDS_WITH_SUBCOMMANDS.has(cmd.name());
|
|
54
|
+
return theme.command(hasSubcommands ? `${cmd.name()} *` : cmd.name());
|
|
55
|
+
},
|
|
36
56
|
});
|
|
57
|
+
const formatHelpOutput = (str) => {
|
|
58
|
+
let output = str;
|
|
59
|
+
const isRootHelp = new RegExp(`^Usage:\\s+${CLI_NAME_PATTERN}\\s+\\[options\\]\\s+\\[command\\]\\s*$`, "m").test(output);
|
|
60
|
+
if (isRootHelp && /^Commands:/m.test(output)) {
|
|
61
|
+
output = output.replace(/^Commands:/m, `Commands:\n ${theme.muted(ROOT_COMMANDS_HINT)}`);
|
|
62
|
+
}
|
|
63
|
+
return output
|
|
64
|
+
.replace(/^Usage:/gm, theme.heading("Usage:"))
|
|
65
|
+
.replace(/^Options:/gm, theme.heading("Options:"))
|
|
66
|
+
.replace(/^Commands:/gm, theme.heading("Commands:"));
|
|
67
|
+
};
|
|
37
68
|
program.configureOutput({
|
|
38
69
|
writeOut: (str) => {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
process.stdout.write(colored);
|
|
70
|
+
process.stdout.write(formatHelpOutput(str));
|
|
71
|
+
},
|
|
72
|
+
writeErr: (str) => {
|
|
73
|
+
process.stderr.write(formatHelpOutput(str));
|
|
44
74
|
},
|
|
45
|
-
writeErr: (str) => process.stderr.write(str),
|
|
46
75
|
outputError: (str, write) => write(theme.error(str)),
|
|
47
76
|
});
|
|
48
|
-
if (process.argv
|
|
49
|
-
process.argv
|
|
50
|
-
process.argv
|
|
77
|
+
if (hasFlag(process.argv, "-V") ||
|
|
78
|
+
hasFlag(process.argv, "--version") ||
|
|
79
|
+
hasRootVersionAlias(process.argv)) {
|
|
51
80
|
console.log(ctx.programVersion);
|
|
52
81
|
process.exit(0);
|
|
53
82
|
}
|
|
54
83
|
program.addHelpText("beforeAll", () => {
|
|
55
|
-
if (hasEmittedCliBanner())
|
|
84
|
+
if (hasEmittedCliBanner()) {
|
|
56
85
|
return "";
|
|
86
|
+
}
|
|
57
87
|
const rich = isRich();
|
|
58
88
|
const line = formatCliBannerLine(ctx.programVersion, { richTty: rich });
|
|
59
89
|
return `\n${line}\n`;
|
|
60
90
|
});
|
|
61
91
|
const fmtExamples = EXAMPLES.map(([cmd, desc]) => ` ${theme.command(replaceCliName(cmd, CLI_NAME))}\n ${theme.muted(desc)}`).join("\n");
|
|
62
92
|
program.addHelpText("afterAll", ({ command }) => {
|
|
63
|
-
if (command !== program)
|
|
93
|
+
if (command !== program) {
|
|
64
94
|
return "";
|
|
95
|
+
}
|
|
65
96
|
const docs = formatDocsLink("/cli", "docs.molt.bot/cli");
|
|
66
97
|
return `\n${theme.heading("Examples:")}\n${fmtExamples}\n\n${theme.muted("Docs:")} ${docs}\n`;
|
|
67
98
|
});
|
package/dist/cli/route.js
CHANGED
|
@@ -5,7 +5,7 @@ import { emitCliBanner } from "./banner.js";
|
|
|
5
5
|
import { VERSION } from "../version.js";
|
|
6
6
|
import { getCommandPath, hasHelpOrVersion } from "./argv.js";
|
|
7
7
|
import { ensureConfigReady } from "./program/config-guard.js";
|
|
8
|
-
import { findRoutedCommand } from "./program/
|
|
8
|
+
import { findRoutedCommand } from "./program/routes.js";
|
|
9
9
|
async function prepareRoutedCommand(params) {
|
|
10
10
|
emitCliBanner(VERSION, { argv: params.argv });
|
|
11
11
|
await ensureConfigReady({ runtime: defaultRuntime, commandPath: params.commandPath });
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export function createCliRuntimeCapture() {
|
|
2
|
+
const runtimeLogs = [];
|
|
3
|
+
const runtimeErrors = [];
|
|
4
|
+
const stringifyArgs = (args) => args.map((value) => String(value)).join(" ");
|
|
5
|
+
return {
|
|
6
|
+
runtimeLogs,
|
|
7
|
+
runtimeErrors,
|
|
8
|
+
defaultRuntime: {
|
|
9
|
+
log: (...args) => {
|
|
10
|
+
runtimeLogs.push(stringifyArgs(args));
|
|
11
|
+
},
|
|
12
|
+
error: (...args) => {
|
|
13
|
+
runtimeErrors.push(stringifyArgs(args));
|
|
14
|
+
},
|
|
15
|
+
exit: (code) => {
|
|
16
|
+
throw new Error(`__exit__:${code}`);
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
resetRuntimeCapture: () => {
|
|
20
|
+
runtimeLogs.length = 0;
|
|
21
|
+
runtimeErrors.length = 0;
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
}
|