@poolzin/pool-bot 2026.3.25 → 2026.3.27
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/agents/model-fallback.js +5 -4
- package/dist/agents/tools/common.js +16 -201
- package/dist/auto-reply/auto-reply/reply/agent-runner-execution.js +502 -0
- package/dist/auto-reply/auto-reply/reply/agent-runner-helpers.js +65 -0
- package/dist/auto-reply/auto-reply/reply/agent-runner-memory.js +160 -0
- package/dist/auto-reply/auto-reply/reply/agent-runner-payloads.js +85 -0
- package/dist/auto-reply/auto-reply/reply/agent-runner-utils.js +101 -0
- package/dist/auto-reply/auto-reply/reply/bash-command.js +338 -0
- package/dist/auto-reply/auto-reply/reply/block-streaming.js +91 -0
- package/dist/auto-reply/auto-reply/reply/commands-approve.js +88 -0
- package/dist/auto-reply/auto-reply/reply/commands-bash.js +26 -0
- package/dist/auto-reply/auto-reply/reply/commands-compact.js +107 -0
- package/dist/auto-reply/auto-reply/reply/commands-config.js +241 -0
- package/dist/auto-reply/auto-reply/reply/commands-context-report.js +295 -0
- package/dist/auto-reply/auto-reply/reply/commands-context.js +30 -0
- package/dist/auto-reply/auto-reply/reply/commands-core.js +151 -0
- package/dist/auto-reply/auto-reply/reply/commands-export-session.js +163 -0
- package/dist/auto-reply/auto-reply/reply/commands-info.js +184 -0
- package/dist/auto-reply/auto-reply/reply/commands-models.js +299 -0
- package/dist/auto-reply/auto-reply/reply/commands-plugin.js +35 -0
- package/dist/auto-reply/auto-reply/reply/commands-ptt.js +171 -0
- package/dist/auto-reply/auto-reply/reply/commands-setunset-standard.js +13 -0
- package/dist/auto-reply/auto-reply/reply/commands-setunset.js +73 -0
- package/dist/auto-reply/auto-reply/reply/commands-slash-parse.js +31 -0
- package/dist/auto-reply/auto-reply/reply/commands-status.js +178 -0
- package/dist/auto-reply/auto-reply/reply/commands-subagents.js +73 -0
- package/dist/auto-reply/auto-reply/reply/commands-system-prompt.js +117 -0
- package/dist/auto-reply/auto-reply/reply/commands-tts.js +231 -0
- package/dist/auto-reply/auto-reply/reply/directive-handling.impl.js +380 -0
- package/dist/auto-reply/auto-reply/reply/followup-runner.js +227 -0
- package/dist/auto-reply/auto-reply/reply/get-reply-directives-apply.js +201 -0
- package/dist/auto-reply/auto-reply/reply/get-reply-directives-utils.js +54 -0
- package/dist/auto-reply/auto-reply/reply/get-reply-directives.js +332 -0
- package/dist/auto-reply/auto-reply/reply/get-reply-inline-actions.js +258 -0
- package/dist/auto-reply/auto-reply/reply/get-reply-run.js +297 -0
- package/dist/auto-reply/auto-reply/reply/groups.js +102 -0
- package/dist/auto-reply/auto-reply/reply/mentions.js +129 -0
- package/dist/auto-reply/auto-reply/reply/reply-delivery.js +92 -0
- package/dist/auto-reply/auto-reply/reply/reply-directives.js +30 -0
- package/dist/auto-reply/auto-reply/reply/reply-dispatcher.js +152 -0
- package/dist/auto-reply/auto-reply/reply/reply-elevated.js +166 -0
- package/dist/auto-reply/auto-reply/reply/reply-inline.js +28 -0
- package/dist/auto-reply/auto-reply/reply/reply-payloads.js +114 -0
- package/dist/auto-reply/auto-reply/reply/reply-reference.js +36 -0
- package/dist/auto-reply/auto-reply/reply/reply-tags.js +13 -0
- package/dist/auto-reply/auto-reply/reply/reply-threading.js +41 -0
- package/dist/auto-reply/auto-reply/reply/session-updates.js +233 -0
- package/dist/auto-reply/auto-reply/reply/stage-sandbox-media.js +146 -0
- package/dist/build-info.json +3 -3
- package/dist/canvas-host/a2ui/.bundle.hash +1 -1
- package/dist/canvas-host/a2ui/a2ui.bundle.js +2 -17772
- package/dist/canvas-host/a2ui/index.html +1 -307
- package/dist/channels/channels/directory-config.js +185 -0
- package/dist/channels/channels/discord/handle-action.guild-admin.js +332 -0
- package/dist/channels/channels/discord/handle-action.js +165 -0
- package/dist/channels/channels/discord.js +413 -0
- package/dist/channels/channels/dock.js +436 -0
- package/dist/channels/channels/index.js +51 -0
- package/dist/channels/channels/plugins/outbound/discord.js +101 -0
- package/dist/channels/channels/whatsapp.js +17 -0
- package/dist/channels/plugins/types.js +1 -1
- package/dist/channels/run-state-machine.js +7 -0
- package/dist/commands/models/auth.js +47 -1
- package/dist/commands-subagents/action-agents.js +44 -0
- package/dist/commands-subagents/action-focus.js +64 -0
- package/dist/commands-subagents/action-help.js +4 -0
- package/dist/commands-subagents/action-info.js +45 -0
- package/dist/commands-subagents/action-kill.js +60 -0
- package/dist/commands-subagents/action-list.js +44 -0
- package/dist/commands-subagents/action-log.js +29 -0
- package/dist/commands-subagents/action-send.js +119 -0
- package/dist/commands-subagents/action-spawn.js +52 -0
- package/dist/commands-subagents/action-unfocus.js +30 -0
- package/dist/commands-subagents/shared.js +303 -0
- package/dist/config/config.js +1 -8
- package/dist/config/types.secrets.js +61 -0
- package/dist/control-ui/assets/{index-D7shnQwQ.js → index-umCsvrWy.js} +884 -741
- package/dist/control-ui/assets/index-umCsvrWy.js.map +1 -0
- package/dist/control-ui/assets/pt-BR-DedEVAvY.js +2 -0
- package/dist/control-ui/assets/pt-BR-DedEVAvY.js.map +1 -0
- package/dist/control-ui/assets/zh-CN-CDzeklK-.js +2 -0
- package/dist/control-ui/assets/zh-CN-CDzeklK-.js.map +1 -0
- package/dist/control-ui/assets/zh-TW-BJCRYNWH.js +2 -0
- package/dist/control-ui/assets/zh-TW-BJCRYNWH.js.map +1 -0
- package/dist/control-ui/index.html +1 -1
- package/dist/gateway/method-scopes.js +9 -1
- package/dist/gateway/node-pending-work.js +142 -0
- package/dist/gateway/protocol/index.js +5 -1
- package/dist/gateway/protocol/schema/nodes.js +18 -0
- package/dist/gateway/server-methods/nodes-pending.js +96 -0
- package/dist/gateway/server-methods-list.js +4 -0
- package/dist/gateway/server-methods.js +2 -0
- package/dist/imessage/channel.js +253 -0
- package/dist/imessage/monitor/echo-cache.js +70 -0
- package/dist/imessage/monitor/loop-rate-limiter.js +51 -0
- package/dist/imessage/monitor/reflection-guard.js +50 -0
- package/dist/imessage/monitor/sanitize-outbound.js +25 -0
- package/dist/imessage/monitor/self-chat-cache.js +75 -0
- package/dist/imessage/runtime.js +3 -0
- package/dist/infra/exec-approval-reply.js +7 -0
- package/dist/infra/tmp-openclaw-dir.js +84 -0
- package/dist/pairing/pairing-challenge.js +15 -0
- package/dist/plugin-sdk/account-id.d.ts +1 -0
- package/dist/plugin-sdk/agent-media-payload.d.ts +12 -0
- package/dist/plugin-sdk/allow-from.d.ts +27 -0
- package/dist/plugin-sdk/command-auth.d.ts +25 -0
- package/dist/plugin-sdk/command-auth.js +3 -1
- package/dist/plugin-sdk/config-paths.d.ts +6 -0
- package/dist/plugin-sdk/file-lock.d.ts +16 -0
- package/dist/plugin-sdk/index.d.ts +428 -0
- package/dist/plugin-sdk/index.js +237 -103
- package/dist/plugin-sdk/json-store.d.ts +5 -0
- package/dist/plugin-sdk/keyed-async-queue.d.ts +12 -0
- package/dist/plugin-sdk/onboarding.d.ts +11 -0
- package/dist/plugin-sdk/provider-auth-result.d.ts +14 -0
- package/dist/plugin-sdk/slack-message-actions.d.ts +11 -0
- package/dist/plugin-sdk/status-helpers.d.ts +25 -0
- package/dist/plugin-sdk/temp-path.d.ts +12 -0
- package/dist/plugin-sdk/text-chunking.d.ts +1 -0
- package/dist/plugin-sdk/tool-send.d.ts +4 -0
- package/dist/plugin-sdk/webhook-path.d.ts +6 -0
- package/dist/plugin-sdk/webhook-targets.d.ts +23 -0
- package/dist/plugin-sdk/windows-spawn.d.ts +39 -0
- package/dist/plugin-sdk-internal/accounts.js +6 -0
- package/dist/plugin-sdk-internal/discord.js +23 -0
- package/dist/plugin-sdk-internal/imessage.js +13 -0
- package/dist/plugin-sdk-internal/setup.js +9 -0
- package/dist/plugin-sdk-internal/signal.js +13 -0
- package/dist/plugin-sdk-internal/slack.js +22 -0
- package/dist/plugin-sdk-internal/telegram.js +32 -0
- package/dist/plugin-sdk-internal/whatsapp.js +29 -0
- package/dist/routing/session-key.js +4 -185
- package/dist/shared/pid-alive.js +2 -61
- package/dist/shared/process-scoped-map.js +5 -7
- package/dist/signal/channel.js +264 -0
- package/dist/signal/monitor/access-policy.js +60 -0
- package/dist/signal/runtime.js +3 -0
- package/dist/slack/account-inspect.js +135 -0
- package/dist/slack/blocks-input.js +7 -38
- package/dist/slack/channel.js +394 -0
- package/dist/slack/interactive-replies.js +28 -0
- package/dist/slack/monitor/channel-type.js +31 -0
- package/dist/slack/monitor/dm-auth.js +49 -0
- package/dist/slack/monitor/events/interactions.modal.js +137 -0
- package/dist/slack/monitor/events/message-subtype-handlers.js +68 -0
- package/dist/slack/monitor/events/system-event-context.js +29 -0
- package/dist/slack/monitor/events/system-event-test-harness.js +41 -0
- package/dist/slack/monitor/external-arg-menu-store.js +46 -0
- package/dist/slack/monitor/message-handler/prepare-content.js +69 -0
- package/dist/slack/monitor/message-handler/prepare-thread-context.js +91 -0
- package/dist/slack/monitor/message-handler/prepare.test-helpers.js +55 -0
- package/dist/slack/monitor/reconnect-policy.js +78 -0
- package/dist/slack/monitor/slash-commands.runtime.js +1 -0
- package/dist/slack/monitor/slash-dispatch.runtime.js +9 -0
- package/dist/slack/monitor/slash-skill-commands.runtime.js +1 -0
- package/dist/slack/resolve-allowlist-common.js +36 -0
- package/dist/slack/runtime.js +3 -0
- package/dist/slack/sent-thread-cache.js +61 -0
- package/dist/slack/truncate.js +10 -0
- package/dist/telegram/account-inspect.js +175 -0
- package/dist/telegram/allow-from.js +10 -0
- package/dist/telegram/api-fetch.js +18 -0
- package/dist/telegram/approval-buttons.js +30 -0
- package/dist/telegram/audit-membership-runtime.js +61 -0
- package/dist/telegram/bot/delivery.replies.js +508 -0
- package/dist/telegram/bot/delivery.resolve-media.js +227 -0
- package/dist/telegram/bot/delivery.send.js +132 -0
- package/dist/telegram/bot/reply-threading.js +46 -0
- package/dist/telegram/bot-message-context.body.js +186 -0
- package/dist/telegram/bot-message-context.session.js +207 -0
- package/dist/telegram/bot-message-context.types.js +1 -0
- package/dist/telegram/bot-native-commands.test-helpers.js +117 -0
- package/dist/telegram/bot.media.e2e-harness.js +81 -0
- package/dist/telegram/bot.media.test-utils.js +81 -0
- package/dist/telegram/channel-actions.js +225 -0
- package/dist/telegram/channel.js +515 -0
- package/dist/telegram/conversation-route.js +107 -0
- package/dist/telegram/delivery.js +2 -0
- package/dist/telegram/delivery.replies.js +508 -0
- package/dist/telegram/dm-access.js +86 -0
- package/dist/telegram/draft-stream.test-helpers.js +62 -0
- package/dist/telegram/exec-approvals-handler.js +281 -0
- package/dist/telegram/exec-approvals.js +62 -0
- package/dist/telegram/forum-service-message.js +22 -0
- package/dist/telegram/group-config-helpers.js +10 -0
- package/dist/telegram/lane-delivery-state.js +19 -0
- package/dist/telegram/lane-delivery-text-deliverer.js +357 -0
- package/dist/telegram/lane-delivery.js +2 -0
- package/dist/telegram/normalize.js +37 -0
- package/dist/telegram/onboarding.js +192 -0
- package/dist/telegram/outbound-adapter.js +100 -0
- package/dist/telegram/polling-session.js +275 -0
- package/dist/telegram/runtime.js +3 -0
- package/dist/telegram/sendchataction-401-backoff.js +71 -0
- package/dist/telegram/sequential-key.js +46 -0
- package/dist/telegram/status-issues.js +105 -0
- package/dist/telegram/target-writeback.js +165 -0
- package/dist/telegram/thread-bindings.js +560 -0
- package/dist/utils.js +32 -257
- package/dist/wizard/prompts.js +5 -5
- package/extensions/feishu/src/policy.ts +1 -1
- package/extensions/firecrawl/index.test.ts +82 -0
- package/extensions/firecrawl/index.ts +20 -0
- package/extensions/firecrawl/openclaw.plugin.json +8 -0
- package/extensions/firecrawl/package.json +12 -0
- package/extensions/firecrawl/src/config.ts +159 -0
- package/extensions/firecrawl/src/firecrawl-client.ts +446 -0
- package/extensions/firecrawl/src/firecrawl-scrape-tool.ts +89 -0
- package/extensions/firecrawl/src/firecrawl-search-provider.ts +63 -0
- package/extensions/firecrawl/src/firecrawl-search-tool.ts +76 -0
- package/package.json +1 -1
- package/dist/.buildstamp +0 -1
- package/dist/acp/bindings-store.js +0 -209
- package/dist/acp/control-plane/runtime-cache.js +0 -54
- package/dist/acp/control-plane/runtime-options.js +0 -215
- package/dist/acp/control-plane/session-actor-queue.js +0 -36
- package/dist/acp/index.js +0 -2
- package/dist/acp/runtime/errors.js +0 -47
- package/dist/acp/runtime/registry.js +0 -86
- package/dist/acp/secret-file.js +0 -22
- package/dist/agents/auth-profiles.resolve-auth-profile-order.fixtures.js +0 -23
- package/dist/agents/bash-process-registry.test-helpers.js +0 -29
- package/dist/agents/bash-tools.exec-approval-request.js +0 -20
- package/dist/agents/bash-tools.exec-host-gateway.js +0 -240
- package/dist/agents/bash-tools.exec-host-node.js +0 -235
- package/dist/agents/checkpoint-manager.js +0 -290
- package/dist/agents/claude-cli-runner.js +0 -3
- package/dist/agents/error-classifier.js +0 -251
- package/dist/agents/live-model-filter.js +0 -84
- package/dist/agents/nvidia-models.js +0 -228
- package/dist/agents/pi-embedded-runner/run.overflow-compaction.fixture.js +0 -34
- package/dist/agents/pi-embedded-runner/run.overflow-compaction.mocks.shared.js +0 -156
- package/dist/agents/pi-embedded-subscribe.handlers.tools.media.test-helpers.js +0 -30
- package/dist/agents/provider/config-loader.js +0 -76
- package/dist/agents/provider/index.js +0 -15
- package/dist/agents/provider/models-dev.js +0 -129
- package/dist/agents/provider/session-binding.js +0 -376
- package/dist/agents/queued-file-writer.js +0 -22
- package/dist/agents/skills/bundled-context.js +0 -23
- package/dist/agents/skills/security.js +0 -211
- package/dist/agents/skills/tools-dir.js +0 -9
- package/dist/agents/skills-install-download.js +0 -290
- package/dist/agents/skills-install-output.js +0 -30
- package/dist/agents/skills-install.download-test-utils.js +0 -36
- package/dist/agents/skills.test-helpers.js +0 -13
- package/dist/agents/subagent-announce-reliability.js +0 -160
- package/dist/agents/subagent-registry.mocks.shared.js +0 -12
- package/dist/agents/test-helpers/assistant-message-fixtures.js +0 -29
- package/dist/agents/test-helpers/fast-coding-tools.js +0 -1
- package/dist/agents/test-helpers/fast-core-tools.js +0 -8
- package/dist/agents/test-helpers/fast-tool-stubs.js +0 -18
- package/dist/agents/test-helpers/host-sandbox-fs-bridge.js +0 -74
- package/dist/agents/test-helpers/pi-tools-sandbox-context.js +0 -27
- package/dist/agents/tool-display-common.js +0 -915
- package/dist/agents/tool-policy-shared.js +0 -108
- package/dist/agents/tool-policy.conformance.js +0 -14
- package/dist/agents/tool-result-truncation.js +0 -299
- package/dist/agents/tools/cron-tool.test-helpers.js +0 -12
- package/dist/agents/tools/discord-actions-moderation-shared.js +0 -27
- package/dist/agents/tools/discord-actions-presence.js +0 -78
- package/dist/control-ui/assets/index-D7shnQwQ.js.map +0 -1
- package/dist/discord/discord-improvements.js +0 -167
- package/dist/discord/index.js +0 -2
- package/dist/hooks/bundled/boot-md/HOOK.md +0 -19
- package/dist/hooks/bundled/command-logger/HOOK.md +0 -122
- package/dist/hooks/bundled/session-memory/HOOK.md +0 -86
- package/dist/hooks/bundled/soul-evil/HOOK.md +0 -71
- package/dist/whatsapp/normalize.js +0 -66
- package/dist/whatsapp/resolve-outbound-target.js +0 -42
- /package/dist/{acp/runtime/types.js → auto-reply/auto-reply/reply/commands-types.js} +0 -0
- /package/dist/{agents/pi-embedded-payloads.js → slack/account-surface-fields.js} +0 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { parseSlashCommandWithSetUnset } from "./commands-setunset.js";
|
|
2
|
+
export function parseStandardSetUnsetSlashCommand(params) {
|
|
3
|
+
return parseSlashCommandWithSetUnset({
|
|
4
|
+
raw: params.raw,
|
|
5
|
+
slash: params.slash,
|
|
6
|
+
invalidMessage: params.invalidMessage,
|
|
7
|
+
usageMessage: params.usageMessage,
|
|
8
|
+
onKnownAction: params.onKnownAction,
|
|
9
|
+
onSet: params.onSet ?? ((path, value) => ({ action: "set", path, value })),
|
|
10
|
+
onUnset: params.onUnset ?? ((path) => ({ action: "unset", path })),
|
|
11
|
+
onError: params.onError ?? ((message) => ({ action: "error", message })),
|
|
12
|
+
});
|
|
13
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { parseSlashCommandOrNull } from "./commands-slash-parse.js";
|
|
2
|
+
import { parseConfigValue } from "./config-value.js";
|
|
3
|
+
export function parseSetUnsetCommand(params) {
|
|
4
|
+
const action = params.action;
|
|
5
|
+
const args = params.args.trim();
|
|
6
|
+
if (action === "unset") {
|
|
7
|
+
if (!args) {
|
|
8
|
+
return { kind: "error", message: `Usage: ${params.slash} unset path` };
|
|
9
|
+
}
|
|
10
|
+
return { kind: "unset", path: args };
|
|
11
|
+
}
|
|
12
|
+
if (!args) {
|
|
13
|
+
return { kind: "error", message: `Usage: ${params.slash} set path=value` };
|
|
14
|
+
}
|
|
15
|
+
const eqIndex = args.indexOf("=");
|
|
16
|
+
if (eqIndex <= 0) {
|
|
17
|
+
return { kind: "error", message: `Usage: ${params.slash} set path=value` };
|
|
18
|
+
}
|
|
19
|
+
const path = args.slice(0, eqIndex).trim();
|
|
20
|
+
const rawValue = args.slice(eqIndex + 1);
|
|
21
|
+
if (!path) {
|
|
22
|
+
return { kind: "error", message: `Usage: ${params.slash} set path=value` };
|
|
23
|
+
}
|
|
24
|
+
const parsed = parseConfigValue(rawValue);
|
|
25
|
+
if (parsed.error) {
|
|
26
|
+
return { kind: "error", message: parsed.error };
|
|
27
|
+
}
|
|
28
|
+
return { kind: "set", path, value: parsed.value };
|
|
29
|
+
}
|
|
30
|
+
export function parseSetUnsetCommandAction(params) {
|
|
31
|
+
if (params.action !== "set" && params.action !== "unset") {
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
const parsed = parseSetUnsetCommand({
|
|
35
|
+
slash: params.slash,
|
|
36
|
+
action: params.action,
|
|
37
|
+
args: params.args,
|
|
38
|
+
});
|
|
39
|
+
if (parsed.kind === "error") {
|
|
40
|
+
return params.onError(parsed.message);
|
|
41
|
+
}
|
|
42
|
+
return parsed.kind === "set"
|
|
43
|
+
? params.onSet(parsed.path, parsed.value)
|
|
44
|
+
: params.onUnset(parsed.path);
|
|
45
|
+
}
|
|
46
|
+
export function parseSlashCommandWithSetUnset(params) {
|
|
47
|
+
const parsed = parseSlashCommandOrNull(params.raw, params.slash, {
|
|
48
|
+
invalidMessage: params.invalidMessage,
|
|
49
|
+
});
|
|
50
|
+
if (!parsed) {
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
if (!parsed.ok) {
|
|
54
|
+
return params.onError(parsed.message);
|
|
55
|
+
}
|
|
56
|
+
const { action, args } = parsed;
|
|
57
|
+
const setUnset = parseSetUnsetCommandAction({
|
|
58
|
+
slash: params.slash,
|
|
59
|
+
action,
|
|
60
|
+
args,
|
|
61
|
+
onSet: params.onSet,
|
|
62
|
+
onUnset: params.onUnset,
|
|
63
|
+
onError: params.onError,
|
|
64
|
+
});
|
|
65
|
+
if (setUnset) {
|
|
66
|
+
return setUnset;
|
|
67
|
+
}
|
|
68
|
+
const knownAction = params.onKnownAction(action, args);
|
|
69
|
+
if (knownAction) {
|
|
70
|
+
return knownAction;
|
|
71
|
+
}
|
|
72
|
+
return params.onError(params.usageMessage);
|
|
73
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export function parseSlashCommandActionArgs(raw, slash) {
|
|
2
|
+
const trimmed = raw.trim();
|
|
3
|
+
const slashLower = slash.toLowerCase();
|
|
4
|
+
if (!trimmed.toLowerCase().startsWith(slashLower)) {
|
|
5
|
+
return { kind: "no-match" };
|
|
6
|
+
}
|
|
7
|
+
const rest = trimmed.slice(slash.length).trim();
|
|
8
|
+
if (!rest) {
|
|
9
|
+
return { kind: "empty" };
|
|
10
|
+
}
|
|
11
|
+
const match = rest.match(/^(\S+)(?:\s+([\s\S]+))?$/);
|
|
12
|
+
if (!match) {
|
|
13
|
+
return { kind: "invalid" };
|
|
14
|
+
}
|
|
15
|
+
const action = match[1]?.toLowerCase() ?? "";
|
|
16
|
+
const args = (match[2] ?? "").trim();
|
|
17
|
+
return { kind: "parsed", action, args };
|
|
18
|
+
}
|
|
19
|
+
export function parseSlashCommandOrNull(raw, slash, opts) {
|
|
20
|
+
const parsed = parseSlashCommandActionArgs(raw, slash);
|
|
21
|
+
if (parsed.kind === "no-match") {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
if (parsed.kind === "invalid") {
|
|
25
|
+
return { ok: false, message: opts.invalidMessage };
|
|
26
|
+
}
|
|
27
|
+
if (parsed.kind === "empty") {
|
|
28
|
+
return { ok: true, action: opts.defaultAction ?? "show", args: "" };
|
|
29
|
+
}
|
|
30
|
+
return { ok: true, action: parsed.action, args: parsed.args };
|
|
31
|
+
}
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import { resolveAgentDir, resolveDefaultAgentId, resolveSessionAgentId, } from "../../agents/agent-scope.js";
|
|
2
|
+
import { listSubagentRunsForRequester } from "../../agents/subagent-registry.js";
|
|
3
|
+
import { ensureAuthProfileStore, resolveAuthProfileDisplayLabel, resolveAuthProfileOrder, } from "../../agents/auth-profiles.js";
|
|
4
|
+
import { getCustomProviderApiKey, resolveEnvApiKey } from "../../agents/model-auth.js";
|
|
5
|
+
import { resolveInternalSessionKey, resolveMainSessionAlias, } from "../../agents/tools/sessions-helpers.js";
|
|
6
|
+
import { normalizeProviderId } from "../../agents/model-selection.js";
|
|
7
|
+
import { logVerbose } from "../../globals.js";
|
|
8
|
+
import { formatUsageWindowSummary, loadProviderUsageSummary, resolveUsageProviderId, } from "../../infra/provider-usage.js";
|
|
9
|
+
import { normalizeGroupActivation } from "../group-activation.js";
|
|
10
|
+
import { buildStatusMessage } from "../status.js";
|
|
11
|
+
import { getFollowupQueueDepth, resolveQueueSettings } from "./queue.js";
|
|
12
|
+
import { resolveSubagentLabel } from "./subagents-utils.js";
|
|
13
|
+
function formatApiKeySnippet(apiKey) {
|
|
14
|
+
const compact = apiKey.replace(/\s+/g, "");
|
|
15
|
+
if (!compact)
|
|
16
|
+
return "unknown";
|
|
17
|
+
const edge = compact.length >= 12 ? 6 : 4;
|
|
18
|
+
const head = compact.slice(0, edge);
|
|
19
|
+
const tail = compact.slice(-edge);
|
|
20
|
+
return `${head}…${tail}`;
|
|
21
|
+
}
|
|
22
|
+
function resolveModelAuthLabel(provider, cfg, sessionEntry, agentDir) {
|
|
23
|
+
const resolved = provider?.trim();
|
|
24
|
+
if (!resolved)
|
|
25
|
+
return undefined;
|
|
26
|
+
const providerKey = normalizeProviderId(resolved);
|
|
27
|
+
const store = ensureAuthProfileStore(agentDir, {
|
|
28
|
+
allowKeychainPrompt: false,
|
|
29
|
+
});
|
|
30
|
+
const profileOverride = sessionEntry?.authProfileOverride?.trim();
|
|
31
|
+
const order = resolveAuthProfileOrder({
|
|
32
|
+
cfg,
|
|
33
|
+
store,
|
|
34
|
+
provider: providerKey,
|
|
35
|
+
preferredProfile: profileOverride,
|
|
36
|
+
});
|
|
37
|
+
const candidates = [profileOverride, ...order].filter(Boolean);
|
|
38
|
+
for (const profileId of candidates) {
|
|
39
|
+
const profile = store.profiles[profileId];
|
|
40
|
+
if (!profile || normalizeProviderId(profile.provider) !== providerKey) {
|
|
41
|
+
continue;
|
|
42
|
+
}
|
|
43
|
+
const label = resolveAuthProfileDisplayLabel({ cfg, store, profileId });
|
|
44
|
+
if (profile.type === "oauth") {
|
|
45
|
+
return `oauth${label ? ` (${label})` : ""}`;
|
|
46
|
+
}
|
|
47
|
+
if (profile.type === "token") {
|
|
48
|
+
const snippet = formatApiKeySnippet(profile.token);
|
|
49
|
+
return `token ${snippet}${label ? ` (${label})` : ""}`;
|
|
50
|
+
}
|
|
51
|
+
const snippet = formatApiKeySnippet(profile.key);
|
|
52
|
+
return `api-key ${snippet}${label ? ` (${label})` : ""}`;
|
|
53
|
+
}
|
|
54
|
+
const envKey = resolveEnvApiKey(providerKey);
|
|
55
|
+
if (envKey?.apiKey) {
|
|
56
|
+
if (envKey.source.includes("OAUTH_TOKEN")) {
|
|
57
|
+
return `oauth (${envKey.source})`;
|
|
58
|
+
}
|
|
59
|
+
return `api-key ${formatApiKeySnippet(envKey.apiKey)} (${envKey.source})`;
|
|
60
|
+
}
|
|
61
|
+
const customKey = getCustomProviderApiKey(cfg, providerKey);
|
|
62
|
+
if (customKey) {
|
|
63
|
+
return `api-key ${formatApiKeySnippet(customKey)} (models.json)`;
|
|
64
|
+
}
|
|
65
|
+
return "unknown";
|
|
66
|
+
}
|
|
67
|
+
export async function buildStatusReply(params) {
|
|
68
|
+
const { cfg, command, sessionEntry, sessionKey, sessionScope, provider, model, contextTokens, resolvedThinkLevel, resolvedVerboseLevel, resolvedReasoningLevel, resolvedElevatedLevel, resolveDefaultThinkingLevel, isGroup, defaultGroupActivation, } = params;
|
|
69
|
+
if (!command.isAuthorizedSender) {
|
|
70
|
+
logVerbose(`Ignoring /status from unauthorized sender: ${command.senderId || "<unknown>"}`);
|
|
71
|
+
return undefined;
|
|
72
|
+
}
|
|
73
|
+
const statusAgentId = sessionKey
|
|
74
|
+
? resolveSessionAgentId({ sessionKey, config: cfg })
|
|
75
|
+
: resolveDefaultAgentId(cfg);
|
|
76
|
+
const statusAgentDir = resolveAgentDir(cfg, statusAgentId);
|
|
77
|
+
const currentUsageProvider = (() => {
|
|
78
|
+
try {
|
|
79
|
+
return resolveUsageProviderId(provider);
|
|
80
|
+
}
|
|
81
|
+
catch {
|
|
82
|
+
return undefined;
|
|
83
|
+
}
|
|
84
|
+
})();
|
|
85
|
+
let usageLine = null;
|
|
86
|
+
if (currentUsageProvider) {
|
|
87
|
+
try {
|
|
88
|
+
const usageSummary = await loadProviderUsageSummary({
|
|
89
|
+
timeoutMs: 3500,
|
|
90
|
+
providers: [currentUsageProvider],
|
|
91
|
+
agentDir: statusAgentDir,
|
|
92
|
+
});
|
|
93
|
+
const usageEntry = usageSummary.providers[0];
|
|
94
|
+
if (usageEntry && !usageEntry.error && usageEntry.windows.length > 0) {
|
|
95
|
+
const summaryLine = formatUsageWindowSummary(usageEntry, {
|
|
96
|
+
now: Date.now(),
|
|
97
|
+
maxWindows: 2,
|
|
98
|
+
includeResets: true,
|
|
99
|
+
});
|
|
100
|
+
if (summaryLine)
|
|
101
|
+
usageLine = `📊 Usage: ${summaryLine}`;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
catch {
|
|
105
|
+
usageLine = null;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
const queueSettings = resolveQueueSettings({
|
|
109
|
+
cfg,
|
|
110
|
+
channel: command.channel,
|
|
111
|
+
sessionEntry,
|
|
112
|
+
});
|
|
113
|
+
const queueKey = sessionKey ?? sessionEntry?.sessionId;
|
|
114
|
+
const queueDepth = queueKey ? getFollowupQueueDepth(queueKey) : 0;
|
|
115
|
+
const queueOverrides = Boolean(sessionEntry?.queueDebounceMs ?? sessionEntry?.queueCap ?? sessionEntry?.queueDrop);
|
|
116
|
+
let subagentsLine;
|
|
117
|
+
if (sessionKey) {
|
|
118
|
+
const { mainKey, alias } = resolveMainSessionAlias(cfg);
|
|
119
|
+
const requesterKey = resolveInternalSessionKey({ key: sessionKey, alias, mainKey });
|
|
120
|
+
const runs = listSubagentRunsForRequester(requesterKey);
|
|
121
|
+
const verboseEnabled = resolvedVerboseLevel && resolvedVerboseLevel !== "off";
|
|
122
|
+
if (runs.length > 0) {
|
|
123
|
+
const active = runs.filter((entry) => !entry.endedAt);
|
|
124
|
+
const done = runs.length - active.length;
|
|
125
|
+
if (verboseEnabled) {
|
|
126
|
+
const labels = active
|
|
127
|
+
.map((entry) => resolveSubagentLabel(entry, ""))
|
|
128
|
+
.filter(Boolean)
|
|
129
|
+
.slice(0, 3);
|
|
130
|
+
const labelText = labels.length ? ` (${labels.join(", ")})` : "";
|
|
131
|
+
subagentsLine = `🤖 Subagents: ${active.length} active${labelText} · ${done} done`;
|
|
132
|
+
}
|
|
133
|
+
else if (active.length > 0) {
|
|
134
|
+
subagentsLine = `🤖 Subagents: ${active.length} active`;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
const groupActivation = isGroup
|
|
139
|
+
? (normalizeGroupActivation(sessionEntry?.groupActivation) ?? defaultGroupActivation())
|
|
140
|
+
: undefined;
|
|
141
|
+
const agentDefaults = cfg.agents?.defaults ?? {};
|
|
142
|
+
const statusText = buildStatusMessage({
|
|
143
|
+
config: cfg,
|
|
144
|
+
agent: {
|
|
145
|
+
...agentDefaults,
|
|
146
|
+
model: {
|
|
147
|
+
...agentDefaults.model,
|
|
148
|
+
primary: `${provider}/${model}`,
|
|
149
|
+
},
|
|
150
|
+
contextTokens,
|
|
151
|
+
thinkingDefault: agentDefaults.thinkingDefault,
|
|
152
|
+
verboseDefault: agentDefaults.verboseDefault,
|
|
153
|
+
elevatedDefault: agentDefaults.elevatedDefault,
|
|
154
|
+
},
|
|
155
|
+
sessionEntry,
|
|
156
|
+
sessionKey,
|
|
157
|
+
sessionScope,
|
|
158
|
+
groupActivation,
|
|
159
|
+
resolvedThink: resolvedThinkLevel ?? (await resolveDefaultThinkingLevel()),
|
|
160
|
+
resolvedVerbose: resolvedVerboseLevel,
|
|
161
|
+
resolvedReasoning: resolvedReasoningLevel,
|
|
162
|
+
resolvedElevated: resolvedElevatedLevel,
|
|
163
|
+
modelAuth: resolveModelAuthLabel(provider, cfg, sessionEntry, statusAgentDir),
|
|
164
|
+
usageLine: usageLine ?? undefined,
|
|
165
|
+
queue: {
|
|
166
|
+
mode: queueSettings.mode,
|
|
167
|
+
depth: queueDepth,
|
|
168
|
+
debounceMs: queueSettings.debounceMs,
|
|
169
|
+
cap: queueSettings.cap,
|
|
170
|
+
dropPolicy: queueSettings.dropPolicy,
|
|
171
|
+
showDetails: queueOverrides,
|
|
172
|
+
},
|
|
173
|
+
subagentsLine,
|
|
174
|
+
mediaDecisions: params.mediaDecisions,
|
|
175
|
+
includeTranscriptUsage: false,
|
|
176
|
+
});
|
|
177
|
+
return { text: statusText };
|
|
178
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { listSubagentRunsForRequester } from "../../agents/subagent-registry.js";
|
|
2
|
+
import { logVerbose } from "../../globals.js";
|
|
3
|
+
import { handleSubagentsAgentsAction } from "./commands-subagents/action-agents.js";
|
|
4
|
+
import { handleSubagentsFocusAction } from "./commands-subagents/action-focus.js";
|
|
5
|
+
import { handleSubagentsHelpAction } from "./commands-subagents/action-help.js";
|
|
6
|
+
import { handleSubagentsInfoAction } from "./commands-subagents/action-info.js";
|
|
7
|
+
import { handleSubagentsKillAction } from "./commands-subagents/action-kill.js";
|
|
8
|
+
import { handleSubagentsListAction } from "./commands-subagents/action-list.js";
|
|
9
|
+
import { handleSubagentsLogAction } from "./commands-subagents/action-log.js";
|
|
10
|
+
import { handleSubagentsSendAction } from "./commands-subagents/action-send.js";
|
|
11
|
+
import { handleSubagentsSpawnAction } from "./commands-subagents/action-spawn.js";
|
|
12
|
+
import { handleSubagentsUnfocusAction } from "./commands-subagents/action-unfocus.js";
|
|
13
|
+
import { extractMessageText, resolveHandledPrefix, resolveRequesterSessionKey, resolveSubagentsAction, stopWithText, } from "./commands-subagents/shared.js";
|
|
14
|
+
export { extractMessageText };
|
|
15
|
+
export const handleSubagentsCommand = async (params, allowTextCommands) => {
|
|
16
|
+
if (!allowTextCommands) {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
const normalized = params.command.commandBodyNormalized;
|
|
20
|
+
const handledPrefix = resolveHandledPrefix(normalized);
|
|
21
|
+
if (!handledPrefix) {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
if (!params.command.isAuthorizedSender) {
|
|
25
|
+
logVerbose(`Ignoring ${handledPrefix} from unauthorized sender: ${params.command.senderId || "<unknown>"}`);
|
|
26
|
+
return { shouldContinue: false };
|
|
27
|
+
}
|
|
28
|
+
const rest = normalized.slice(handledPrefix.length).trim();
|
|
29
|
+
const restTokens = rest.split(/\s+/).filter(Boolean);
|
|
30
|
+
const action = resolveSubagentsAction({ handledPrefix, restTokens });
|
|
31
|
+
if (!action) {
|
|
32
|
+
return handleSubagentsHelpAction();
|
|
33
|
+
}
|
|
34
|
+
const requesterKey = resolveRequesterSessionKey(params, {
|
|
35
|
+
preferCommandTarget: action === "spawn",
|
|
36
|
+
});
|
|
37
|
+
if (!requesterKey) {
|
|
38
|
+
return stopWithText("⚠️ Missing session key.");
|
|
39
|
+
}
|
|
40
|
+
const ctx = {
|
|
41
|
+
params,
|
|
42
|
+
handledPrefix,
|
|
43
|
+
requesterKey,
|
|
44
|
+
runs: listSubagentRunsForRequester(requesterKey),
|
|
45
|
+
restTokens,
|
|
46
|
+
};
|
|
47
|
+
switch (action) {
|
|
48
|
+
case "help":
|
|
49
|
+
return handleSubagentsHelpAction();
|
|
50
|
+
case "agents":
|
|
51
|
+
return handleSubagentsAgentsAction(ctx);
|
|
52
|
+
case "focus":
|
|
53
|
+
return await handleSubagentsFocusAction(ctx);
|
|
54
|
+
case "unfocus":
|
|
55
|
+
return handleSubagentsUnfocusAction(ctx);
|
|
56
|
+
case "list":
|
|
57
|
+
return handleSubagentsListAction(ctx);
|
|
58
|
+
case "kill":
|
|
59
|
+
return await handleSubagentsKillAction(ctx);
|
|
60
|
+
case "info":
|
|
61
|
+
return handleSubagentsInfoAction(ctx);
|
|
62
|
+
case "log":
|
|
63
|
+
return await handleSubagentsLogAction(ctx);
|
|
64
|
+
case "send":
|
|
65
|
+
return await handleSubagentsSendAction(ctx, false);
|
|
66
|
+
case "steer":
|
|
67
|
+
return await handleSubagentsSendAction(ctx, true);
|
|
68
|
+
case "spawn":
|
|
69
|
+
return await handleSubagentsSpawnAction(ctx);
|
|
70
|
+
default:
|
|
71
|
+
return handleSubagentsHelpAction();
|
|
72
|
+
}
|
|
73
|
+
};
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { resolveSessionAgentIds } from "../../agents/agent-scope.js";
|
|
2
|
+
import { resolveBootstrapContextForRun } from "../../agents/bootstrap-files.js";
|
|
3
|
+
import { resolveDefaultModelForAgent } from "../../agents/model-selection.js";
|
|
4
|
+
import { createPoolbotCodingTools } from "../../agents/pi-tools.js";
|
|
5
|
+
import { resolveSandboxRuntimeStatus } from "../../agents/sandbox.js";
|
|
6
|
+
import { buildWorkspaceSkillSnapshot } from "../../agents/skills.js";
|
|
7
|
+
import { getSkillsSnapshotVersion } from "../../agents/skills/refresh.js";
|
|
8
|
+
import { buildSystemPromptParams } from "../../agents/system-prompt-params.js";
|
|
9
|
+
import { buildAgentSystemPrompt } from "../../agents/system-prompt.js";
|
|
10
|
+
import { buildToolSummaryMap } from "../../agents/tool-summaries.js";
|
|
11
|
+
import { getRemoteSkillEligibility } from "../../infra/skills-remote.js";
|
|
12
|
+
import { buildTtsSystemPromptHint } from "../../tts/tts.js";
|
|
13
|
+
export async function resolveCommandsSystemPromptBundle(params) {
|
|
14
|
+
const workspaceDir = params.workspaceDir;
|
|
15
|
+
const { bootstrapFiles, contextFiles: injectedFiles } = await resolveBootstrapContextForRun({
|
|
16
|
+
workspaceDir,
|
|
17
|
+
config: params.cfg,
|
|
18
|
+
sessionKey: params.sessionKey,
|
|
19
|
+
sessionId: params.sessionEntry?.sessionId,
|
|
20
|
+
});
|
|
21
|
+
const skillsSnapshot = (() => {
|
|
22
|
+
try {
|
|
23
|
+
return buildWorkspaceSkillSnapshot(workspaceDir, {
|
|
24
|
+
config: params.cfg,
|
|
25
|
+
eligibility: { remote: getRemoteSkillEligibility() },
|
|
26
|
+
snapshotVersion: getSkillsSnapshotVersion(workspaceDir),
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
catch {
|
|
30
|
+
return { prompt: "", skills: [], resolvedSkills: [] };
|
|
31
|
+
}
|
|
32
|
+
})();
|
|
33
|
+
const skillsPrompt = skillsSnapshot.prompt ?? "";
|
|
34
|
+
const sandboxRuntime = resolveSandboxRuntimeStatus({
|
|
35
|
+
cfg: params.cfg,
|
|
36
|
+
sessionKey: params.ctx.SessionKey ?? params.sessionKey,
|
|
37
|
+
});
|
|
38
|
+
const tools = (() => {
|
|
39
|
+
try {
|
|
40
|
+
return createPoolbotCodingTools({
|
|
41
|
+
config: params.cfg,
|
|
42
|
+
workspaceDir,
|
|
43
|
+
sessionKey: params.sessionKey,
|
|
44
|
+
messageProvider: params.command.channel,
|
|
45
|
+
groupId: params.sessionEntry?.groupId ?? undefined,
|
|
46
|
+
groupChannel: params.sessionEntry?.groupChannel ?? undefined,
|
|
47
|
+
groupSpace: params.sessionEntry?.space ?? undefined,
|
|
48
|
+
spawnedBy: params.sessionEntry?.spawnedBy ?? undefined,
|
|
49
|
+
senderIsOwner: params.command.senderIsOwner,
|
|
50
|
+
modelProvider: params.provider,
|
|
51
|
+
modelId: params.model,
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
catch {
|
|
55
|
+
return [];
|
|
56
|
+
}
|
|
57
|
+
})();
|
|
58
|
+
const toolSummaries = buildToolSummaryMap(tools);
|
|
59
|
+
const toolNames = tools.map((t) => t.name);
|
|
60
|
+
const { sessionAgentId } = resolveSessionAgentIds({
|
|
61
|
+
sessionKey: params.sessionKey,
|
|
62
|
+
config: params.cfg,
|
|
63
|
+
});
|
|
64
|
+
const defaultModelRef = resolveDefaultModelForAgent({
|
|
65
|
+
cfg: params.cfg,
|
|
66
|
+
agentId: sessionAgentId,
|
|
67
|
+
});
|
|
68
|
+
const defaultModelLabel = `${defaultModelRef.provider}/${defaultModelRef.model}`;
|
|
69
|
+
const { runtimeInfo, userTimezone, userTime, userTimeFormat } = buildSystemPromptParams({
|
|
70
|
+
config: params.cfg,
|
|
71
|
+
agentId: sessionAgentId,
|
|
72
|
+
workspaceDir,
|
|
73
|
+
cwd: process.cwd(),
|
|
74
|
+
runtime: {
|
|
75
|
+
host: "unknown",
|
|
76
|
+
os: "unknown",
|
|
77
|
+
arch: "unknown",
|
|
78
|
+
node: process.version,
|
|
79
|
+
model: `${params.provider}/${params.model}`,
|
|
80
|
+
defaultModel: defaultModelLabel,
|
|
81
|
+
},
|
|
82
|
+
});
|
|
83
|
+
const sandboxInfo = sandboxRuntime.sandboxed
|
|
84
|
+
? {
|
|
85
|
+
enabled: true,
|
|
86
|
+
workspaceDir,
|
|
87
|
+
workspaceAccess: "rw",
|
|
88
|
+
elevated: {
|
|
89
|
+
allowed: params.elevated.allowed,
|
|
90
|
+
defaultLevel: (params.resolvedElevatedLevel ?? "off"),
|
|
91
|
+
},
|
|
92
|
+
}
|
|
93
|
+
: { enabled: false };
|
|
94
|
+
const ttsHint = params.cfg ? buildTtsSystemPromptHint(params.cfg) : undefined;
|
|
95
|
+
const systemPrompt = buildAgentSystemPrompt({
|
|
96
|
+
workspaceDir,
|
|
97
|
+
defaultThinkLevel: params.resolvedThinkLevel,
|
|
98
|
+
reasoningLevel: params.resolvedReasoningLevel,
|
|
99
|
+
extraSystemPrompt: undefined,
|
|
100
|
+
ownerNumbers: undefined,
|
|
101
|
+
reasoningTagHint: false,
|
|
102
|
+
toolNames,
|
|
103
|
+
toolSummaries,
|
|
104
|
+
modelAliasLines: [],
|
|
105
|
+
userTimezone,
|
|
106
|
+
userTime,
|
|
107
|
+
userTimeFormat,
|
|
108
|
+
contextFiles: injectedFiles,
|
|
109
|
+
skillsPrompt,
|
|
110
|
+
heartbeatPrompt: undefined,
|
|
111
|
+
ttsHint,
|
|
112
|
+
runtimeInfo,
|
|
113
|
+
sandboxInfo,
|
|
114
|
+
memoryCitationsMode: params.cfg?.memory?.citations,
|
|
115
|
+
});
|
|
116
|
+
return { systemPrompt, tools, skillsPrompt, bootstrapFiles, injectedFiles, sandboxRuntime };
|
|
117
|
+
}
|