@poolzin/pool-bot 2026.2.21 → 2026.2.23
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 +25 -0
- package/dist/agents/api-key-rotation.js +47 -0
- package/dist/agents/apply-patch-update.js +19 -9
- package/dist/agents/apply-patch.js +72 -47
- package/dist/agents/bash-tools.exec.js +141 -559
- package/dist/agents/cli-backends.js +49 -6
- package/dist/agents/cli-runner/helpers.js +69 -152
- package/dist/agents/cli-runner.js +70 -19
- package/dist/agents/identity.js +20 -1
- package/dist/agents/image-sanitization.js +9 -0
- package/dist/agents/live-auth-keys.js +123 -26
- package/dist/agents/live-model-filter.js +13 -4
- package/dist/agents/model-catalog.js +40 -9
- package/dist/agents/model-forward-compat.js +60 -23
- package/dist/agents/model-selection.js +134 -41
- package/dist/agents/pi-auth-json.js +2 -2
- package/dist/agents/pi-embedded-helpers/bootstrap.js +65 -15
- package/dist/agents/pi-embedded-helpers/errors.js +140 -15
- package/dist/agents/pi-embedded-helpers/images.js +22 -12
- package/dist/agents/pi-embedded-helpers.js +2 -2
- package/dist/agents/pi-embedded-runner/abort.js +10 -3
- package/dist/agents/pi-embedded-runner/compact.js +230 -32
- package/dist/agents/pi-embedded-runner/extra-params.js +203 -12
- package/dist/agents/pi-embedded-runner/google.js +109 -19
- package/dist/agents/pi-embedded-runner/history.js +35 -17
- package/dist/agents/pi-embedded-runner/run/attempt.js +386 -95
- package/dist/agents/pi-embedded-runner/run/images.js +81 -55
- package/dist/agents/pi-embedded-runner/run/payloads.js +89 -39
- package/dist/agents/pi-embedded-runner/run.js +193 -25
- package/dist/agents/pi-embedded-runner/run.overflow-compaction.mocks.shared.js +2 -2
- package/dist/agents/pi-embedded-runner/runs.js +17 -8
- package/dist/agents/pi-embedded-runner/tool-result-context-guard.js +262 -0
- package/dist/agents/pi-embedded-runner.js +1 -1
- package/dist/agents/pi-embedded-subscribe.handlers.tools.js +180 -10
- package/dist/agents/pi-embedded-subscribe.js +37 -0
- package/dist/agents/pi-embedded-subscribe.tools.js +127 -30
- package/dist/agents/pi-model-discovery.js +9 -2
- package/dist/agents/pi-tool-definition-adapter.js +60 -8
- package/dist/agents/pi-tools.before-tool-call.js +1 -1
- package/dist/agents/pi-tools.js +113 -94
- package/dist/agents/pi-tools.read.js +337 -38
- package/dist/agents/poolbot-tools.js +14 -5
- package/dist/agents/sandbox/docker.js +10 -5
- package/dist/agents/sandbox/registry.js +96 -46
- package/dist/agents/sandbox/sanitize-env-vars.js +82 -0
- package/dist/agents/sandbox-paths.js +43 -10
- package/dist/agents/session-tool-result-guard-wrapper.js +23 -11
- package/dist/agents/session-tool-result-guard.js +39 -39
- package/dist/agents/session-transcript-repair.js +36 -33
- package/dist/agents/session-write-lock.js +62 -44
- package/dist/agents/skills/frontmatter.js +49 -88
- package/dist/agents/skills/workspace.js +335 -28
- package/dist/agents/subagent-announce.js +508 -174
- package/dist/agents/subagent-registry.js +45 -4
- package/dist/agents/subagent-spawn.js +16 -33
- package/dist/agents/system-prompt-report.js +27 -10
- package/dist/agents/system-prompt.js +26 -32
- package/dist/agents/tool-call-id.js +69 -17
- package/dist/agents/tool-display-common.js +1 -1
- package/dist/agents/tool-images.js +64 -31
- package/dist/agents/tools/canvas-tool.js +17 -11
- package/dist/agents/tools/common.js +37 -19
- package/dist/agents/tools/cron-tool.js +40 -38
- package/dist/agents/tools/gateway.js +70 -2
- package/dist/agents/tools/message-tool.js +181 -40
- package/dist/agents/tools/nodes-tool.js +128 -36
- package/dist/agents/tools/nodes-utils.js +12 -38
- package/dist/agents/tools/session-status-tool.js +24 -71
- package/dist/agents/tools/sessions-helpers.js +38 -210
- package/dist/agents/tools/sessions-spawn-tool.js +28 -198
- package/dist/agents/tools/telegram-actions.js +58 -7
- package/dist/agents/tools/web-fetch-utils.js +112 -7
- package/dist/agents/tools/web-fetch.js +279 -175
- package/dist/agents/tools/web-shared.js +71 -8
- package/dist/agents/usage.js +25 -16
- package/dist/auto-reply/commands-registry.data.js +85 -11
- package/dist/auto-reply/dispatch.js +40 -21
- package/dist/auto-reply/reply/abort.js +102 -33
- package/dist/auto-reply/reply/commands-core.js +82 -33
- package/dist/auto-reply/reply/commands-export-session.js +1 -1
- package/dist/auto-reply/reply/commands-info.js +41 -12
- package/dist/auto-reply/reply/commands-subagents.js +352 -100
- package/dist/auto-reply/reply/commands-system-prompt.js +2 -2
- package/dist/auto-reply/reply/dispatch-from-config.js +100 -29
- package/dist/auto-reply/reply/elevated-unavailable.js +1 -1
- package/dist/auto-reply/reply/inbound-meta.js +12 -1
- package/dist/auto-reply/reply/mentions.js +18 -11
- package/dist/auto-reply/reply/normalize-reply.js +17 -8
- package/dist/auto-reply/reply/reply-dispatcher.js +62 -10
- package/dist/auto-reply/reply/session.js +102 -21
- package/dist/auto-reply/reply/streaming-directives.js +16 -5
- package/dist/auto-reply/status.js +73 -50
- package/dist/browser/extension-relay.js +3 -3
- package/dist/browser/http-auth.js +1 -1
- package/dist/browser/paths.js +2 -2
- package/dist/build-info.json +3 -3
- package/dist/channels/allowlist-match.js +20 -0
- package/dist/channels/allowlists/resolve-utils.js +65 -2
- package/dist/channels/chat-type.js +8 -4
- package/dist/channels/dock.js +127 -35
- package/dist/channels/draft-stream-loop.js +6 -2
- package/dist/channels/plugins/actions/telegram.js +42 -18
- package/dist/channels/plugins/allowlist-match.js +1 -1
- package/dist/channels/plugins/group-mentions.js +51 -41
- package/dist/channels/plugins/message-action-names.js +2 -0
- package/dist/channels/plugins/message-actions.js +24 -5
- package/dist/channels/plugins/normalize/discord.js +26 -4
- package/dist/channels/plugins/normalize/signal.js +35 -22
- package/dist/channels/plugins/onboarding/helpers.js +8 -26
- package/dist/channels/plugins/outbound/imessage.js +15 -14
- package/dist/channels/registry.js +20 -7
- package/dist/cli/acp-cli.js +7 -5
- package/dist/cli/browser-cli-extension.js +25 -12
- package/dist/cli/browser-cli-state.cookies-storage.js +25 -6
- package/dist/cli/browser-cli-state.js +101 -145
- package/dist/cli/command-options.js +28 -0
- package/dist/cli/completion-cli.js +6 -6
- package/dist/cli/cron-cli/register.cron-add.js +25 -1
- package/dist/cli/cron-cli/register.cron-edit.js +44 -0
- package/dist/cli/cron-cli/shared.js +7 -1
- package/dist/cli/daemon-cli/lifecycle-core.js +23 -21
- package/dist/cli/daemon-cli/lifecycle.js +23 -247
- package/dist/cli/daemon-cli/register-service-commands.js +25 -4
- package/dist/cli/daemon-cli.js +1 -0
- package/dist/cli/devices-cli.js +33 -20
- package/dist/cli/gateway-cli/register.js +37 -105
- package/dist/cli/gateway-cli/run.js +49 -11
- package/dist/cli/nodes-camera.js +59 -4
- package/dist/cli/nodes-cli/register.camera.js +27 -24
- package/dist/cli/nodes-cli/rpc.js +21 -38
- package/dist/cli/qr-cli.js +2 -2
- package/dist/cli/skills-cli.format.js +2 -2
- package/dist/cli/update-cli/progress.js +2 -2
- package/dist/cli/update-cli/restart-helper.js +28 -7
- package/dist/cli/update-cli/shared.js +7 -7
- package/dist/cli/update-cli/status.js +1 -1
- package/dist/cli/update-cli/update-command.js +14 -8
- package/dist/cli/update-cli/wizard.js +2 -2
- package/dist/cli/update-cli.js +21 -1027
- package/dist/commands/auth-choice.apply.anthropic.js +10 -2
- package/dist/commands/channels/add-mutators.js +3 -35
- package/dist/commands/channels/add.js +39 -51
- package/dist/commands/config-validation.js +1 -1
- package/dist/commands/configure.gateway-auth.js +52 -15
- package/dist/commands/configure.gateway.js +84 -40
- package/dist/commands/doctor-completion.js +3 -3
- package/dist/commands/doctor-config-flow.js +536 -16
- package/dist/commands/doctor-gateway-services.js +103 -79
- package/dist/commands/doctor-memory-search.js +9 -9
- package/dist/commands/doctor-platform-notes.js +57 -30
- package/dist/commands/doctor-prompter.js +26 -15
- package/dist/commands/doctor-session-locks.js +1 -1
- package/dist/commands/doctor.js +21 -9
- package/dist/commands/model-picker.js +120 -95
- package/dist/commands/models/set.js +2 -21
- package/dist/commands/models/shared.js +65 -37
- package/dist/commands/onboard-helpers.js +81 -39
- package/dist/commands/openai-codex-oauth.js +1 -1
- package/dist/commands/sessions.js +52 -53
- package/dist/commands/status.summary.js +52 -34
- package/dist/commands/test-wizard-helpers.js +2 -2
- package/dist/config/defaults.js +79 -42
- package/dist/config/group-policy.js +50 -18
- package/dist/config/includes.js +37 -10
- package/dist/config/schema.help.js +5 -4
- package/dist/config/schema.hints.js +2 -2
- package/dist/config/schema.labels.js +1 -0
- package/dist/config/sessions/group.js +12 -11
- package/dist/config/sessions/paths.js +137 -11
- package/dist/config/sessions/store.js +185 -65
- package/dist/config/sessions/types.js +15 -1
- package/dist/config/sessions.js +1 -0
- package/dist/config/telegram-custom-commands.js +3 -2
- package/dist/config/types.js +2 -0
- package/dist/config/zod-schema.agent-defaults.js +6 -27
- package/dist/config/zod-schema.agent-runtime.js +171 -79
- package/dist/config/zod-schema.providers-core.js +138 -65
- package/dist/config/zod-schema.session.js +49 -22
- package/dist/control-ui/assets/index-HRr1grwl.js.map +1 -1
- package/dist/cron/isolated-agent/run.js +224 -57
- package/dist/cron/normalize.js +48 -45
- package/dist/cron/run-log.js +14 -0
- package/dist/cron/service/jobs.js +190 -28
- package/dist/cron/service/normalize.js +29 -11
- package/dist/cron/service/store.js +30 -44
- package/dist/cron/service/timer.js +182 -96
- package/dist/cron/service.js +3 -0
- package/dist/cron/stagger.js +37 -0
- package/dist/daemon/inspect.js +132 -92
- package/dist/daemon/runtime-paths.js +25 -4
- package/dist/daemon/service-audit.js +47 -16
- package/dist/discord/accounts.js +23 -20
- package/dist/discord/monitor/agent-components.js +1115 -219
- package/dist/discord/monitor/allow-list.js +114 -34
- package/dist/discord/monitor/listeners.js +204 -97
- package/dist/discord/monitor/message-handler.js +21 -10
- package/dist/discord/monitor/message-handler.preflight.js +195 -101
- package/dist/discord/monitor/message-handler.process.js +384 -123
- package/dist/discord/monitor/message-utils.js +86 -23
- package/dist/discord/monitor/native-command.js +77 -57
- package/dist/discord/monitor/provider.js +122 -117
- package/dist/discord/monitor/reply-context.js +20 -16
- package/dist/discord/monitor/reply-delivery.js +40 -8
- package/dist/discord/monitor/rest-fetch.js +22 -0
- package/dist/discord/monitor/threading.js +117 -24
- package/dist/discord/send.js +2 -1
- package/dist/discord/send.outbound.js +124 -11
- package/dist/discord/send.shared.js +112 -72
- package/dist/discord/voice-message.js +3 -3
- package/dist/gateway/auth.js +119 -44
- package/dist/gateway/call.js +76 -34
- package/dist/gateway/channel-health-monitor.js +57 -50
- package/dist/gateway/client.js +63 -29
- package/dist/gateway/control-ui-contract.js +1 -1
- package/dist/gateway/gateway-config-prompts.shared.js +2 -2
- package/dist/gateway/net.js +109 -1
- package/dist/gateway/protocol/index.js +5 -8
- package/dist/gateway/protocol/schema/agent.js +19 -1
- package/dist/gateway/protocol/schema/channels.js +21 -0
- package/dist/gateway/protocol/schema/cron.js +43 -30
- package/dist/gateway/protocol/schema/protocol-schemas.js +6 -11
- package/dist/gateway/protocol/schema/sessions.js +5 -1
- package/dist/gateway/protocol/schema.js +0 -1
- package/dist/gateway/server/presence-events.js +12 -0
- package/dist/gateway/server/ws-connection/message-handler.js +203 -212
- package/dist/gateway/server/ws-connection.js +58 -21
- package/dist/gateway/server-broadcast.js +18 -13
- package/dist/gateway/server-cron.js +177 -10
- package/dist/gateway/server-methods/agent-job.js +131 -38
- package/dist/gateway/server-methods/send.js +60 -14
- package/dist/gateway/server-methods/sessions.js +160 -96
- package/dist/gateway/server-methods/system.js +5 -7
- package/dist/gateway/server-methods-list.js +8 -0
- package/dist/gateway/server-methods.js +24 -8
- package/dist/gateway/server-node-events.js +278 -68
- package/dist/gateway/session-utils.fs.js +316 -75
- package/dist/gateway/session-utils.js +224 -70
- package/dist/gateway/sessions-patch.js +63 -20
- package/dist/gateway/test-temp-config.js +1 -1
- package/dist/gateway/tools-invoke-http.js +118 -70
- package/dist/gateway/ws-log.js +135 -107
- package/dist/hooks/frontmatter.js +36 -82
- package/dist/hooks/install.js +149 -139
- package/dist/hooks/internal-hooks.js +29 -4
- package/dist/hooks/plugin-hooks.js +2 -1
- package/dist/imessage/monitor/deliver.js +10 -4
- package/dist/imessage/monitor/monitor-provider.js +138 -375
- package/dist/imessage/monitor/runtime.js +4 -8
- package/dist/imessage/send.js +65 -19
- package/dist/infra/exec-approvals-allowlist.js +7 -0
- package/dist/infra/exec-approvals.js +35 -920
- package/dist/infra/exec-safe-bin-trust.js +64 -0
- package/dist/infra/heartbeat-runner.js +207 -134
- package/dist/infra/heartbeat-wake.js +183 -22
- package/dist/infra/install-source-utils.js +47 -0
- package/dist/infra/net/ssrf.js +170 -36
- package/dist/infra/outbound/deliver.js +224 -58
- package/dist/infra/outbound/message-action-spec.js +12 -5
- package/dist/infra/outbound/outbound-session.js +27 -25
- package/dist/infra/poolbot-root.js +32 -22
- package/dist/infra/ports.js +14 -11
- package/dist/infra/skills-remote.js +48 -37
- package/dist/infra/system-events.js +25 -11
- package/dist/infra/system-presence.js +26 -33
- package/dist/infra/tmp-poolbot-dir.js +81 -2
- package/dist/infra/wsl.js +37 -1
- package/dist/line/bot-message-context.js +163 -191
- package/dist/logging/subsystem.js +59 -22
- package/dist/markdown/ir.js +124 -50
- package/dist/media/store.js +1 -1
- package/dist/media-understanding/runner.entries.js +42 -25
- package/dist/media-understanding/runner.js +53 -488
- package/dist/memory/embeddings-gemini.js +53 -38
- package/dist/memory/manager-embedding-ops.js +48 -69
- package/dist/pairing/pairing-store.js +178 -119
- package/dist/plugin-sdk/index.js +34 -6
- package/dist/plugins/hooks.js +135 -14
- package/dist/plugins/install.js +190 -152
- package/dist/polls.js +11 -0
- package/dist/routing/resolve-route.js +190 -56
- package/dist/routing/session-key.js +38 -22
- package/dist/runtime.js +35 -9
- package/dist/security/audit-channel.js +1 -1
- package/dist/sessions/session-key-utils.js +29 -11
- package/dist/shared/frontmatter.js +5 -5
- package/dist/shared/node-list-types.js +1 -0
- package/dist/shared/string-normalization.js +15 -0
- package/dist/signal/monitor/event-handler.js +68 -36
- package/dist/signal/send.js +29 -37
- package/dist/slack/monitor/allow-list.js +10 -11
- package/dist/slack/monitor/commands.js +14 -3
- package/dist/slack/monitor/events/interactions.js +4 -4
- package/dist/slack/monitor/media.js +224 -16
- package/dist/slack/monitor/message-handler/dispatch.js +247 -13
- package/dist/slack/monitor/message-handler/prepare.js +128 -45
- package/dist/slack/monitor/slash.js +357 -144
- package/dist/slack/streaming.js +77 -0
- package/dist/telegram/accounts.js +40 -13
- package/dist/telegram/allowed-updates.js +3 -0
- package/dist/telegram/bot/delivery.js +129 -66
- package/dist/telegram/bot/helpers.js +136 -122
- package/dist/telegram/bot-handlers.js +600 -339
- package/dist/telegram/bot-message-context.js +115 -73
- package/dist/telegram/bot-message-dispatch.js +235 -104
- package/dist/telegram/bot-native-command-menu.js +3 -1
- package/dist/telegram/bot-native-commands.js +213 -193
- package/dist/telegram/bot.js +24 -132
- package/dist/telegram/draft-stream.js +84 -75
- package/dist/telegram/format.js +150 -6
- package/dist/telegram/send.js +415 -255
- package/dist/telegram/targets.js +21 -2
- package/dist/telegram/update-offset-store.js +19 -3
- package/dist/terminal/restore.js +5 -2
- package/dist/test-utils/fetch-mock.js +5 -0
- package/dist/version.js +18 -5
- package/dist/web/auto-reply/monitor/broadcast.js +7 -3
- package/dist/web/auto-reply/monitor/on-message.js +6 -3
- package/dist/web/inbound/media.js +34 -8
- package/dist/web/inbound/monitor.js +34 -17
- package/dist/web/inbound/send-api.js +18 -17
- package/dist/web/outbound.js +12 -5
- package/dist/wizard/clack-prompter.js +40 -7
- package/extensions/bluebubbles/package.json +1 -1
- package/extensions/copilot-proxy/package.json +1 -1
- package/extensions/device-pair/index.ts +2 -2
- package/extensions/diagnostics-otel/package.json +1 -1
- package/extensions/discord/package.json +1 -1
- package/extensions/feishu/package.json +1 -1
- 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/irc/src/accounts.ts +1 -1
- package/extensions/irc/src/onboarding.ts +4 -4
- package/extensions/line/package.json +1 -1
- package/extensions/llm-task/package.json +1 -1
- package/extensions/lobster/package.json +1 -1
- package/extensions/matrix/CHANGELOG.md +10 -0
- package/extensions/matrix/package.json +1 -1
- package/extensions/mattermost/package.json +1 -1
- 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 +10 -0
- package/extensions/msteams/package.json +1 -1
- package/extensions/nextcloud-talk/package.json +1 -1
- package/extensions/nostr/CHANGELOG.md +10 -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 +10 -0
- package/extensions/twitch/package.json +1 -1
- package/extensions/voice-call/CHANGELOG.md +10 -0
- package/extensions/voice-call/package.json +1 -1
- package/extensions/whatsapp/package.json +1 -1
- package/extensions/zalo/CHANGELOG.md +10 -0
- package/extensions/zalo/package.json +1 -1
- package/extensions/zalouser/CHANGELOG.md +10 -0
- package/extensions/zalouser/package.json +1 -1
- package/package.json +1 -1
- package/skills/apple-reminders/SKILL.md +100 -49
- package/skills/coding-agent/SKILL.md +34 -28
- package/skills/github/SKILL.md +131 -16
- package/skills/imsg/SKILL.md +112 -15
- package/skills/openhue/SKILL.md +101 -19
- package/skills/tmux/SKILL.md +111 -79
- package/skills/weather/SKILL.md +88 -25
- package/dist/agents/openclaw-tools.js +0 -151
- package/dist/agents/tool-security.js +0 -96
- package/dist/gateway/url-validation.js +0 -94
- package/dist/infra/openclaw-root.js +0 -109
- package/dist/infra/tmp-openclaw-dir.js +0 -81
- package/dist/media/path-sanitization.js +0 -78
package/dist/gateway/ws-log.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import chalk from "chalk";
|
|
2
2
|
import { isVerbose } from "../globals.js";
|
|
3
|
-
import { parseAgentSessionKey } from "../routing/session-key.js";
|
|
4
3
|
import { shouldLogSubsystemToConsole } from "../logging/console.js";
|
|
5
|
-
import { createSubsystemLogger } from "../logging/subsystem.js";
|
|
6
4
|
import { getDefaultRedactPatterns, redactSensitiveText } from "../logging/redact.js";
|
|
5
|
+
import { createSubsystemLogger } from "../logging/subsystem.js";
|
|
6
|
+
import { parseAgentSessionKey } from "../routing/session-key.js";
|
|
7
7
|
import { DEFAULT_WS_SLOW_MS, getGatewayWsLogStyle } from "./ws-logging.js";
|
|
8
8
|
const LOG_VALUE_LIMIT = 240;
|
|
9
9
|
const UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
@@ -16,27 +16,78 @@ let wsLastCompactConnId;
|
|
|
16
16
|
const wsInflightOptimized = new Map();
|
|
17
17
|
const wsInflightSince = new Map();
|
|
18
18
|
const wsLog = createSubsystemLogger("gateway/ws");
|
|
19
|
+
const WS_META_SKIP_KEYS = new Set(["connId", "id", "method", "ok", "event"]);
|
|
20
|
+
function collectWsRestMeta(meta) {
|
|
21
|
+
const restMeta = [];
|
|
22
|
+
if (!meta) {
|
|
23
|
+
return restMeta;
|
|
24
|
+
}
|
|
25
|
+
for (const [key, value] of Object.entries(meta)) {
|
|
26
|
+
if (value === undefined) {
|
|
27
|
+
continue;
|
|
28
|
+
}
|
|
29
|
+
if (WS_META_SKIP_KEYS.has(key)) {
|
|
30
|
+
continue;
|
|
31
|
+
}
|
|
32
|
+
restMeta.push(`${chalk.dim(key)}=${formatForLog(value)}`);
|
|
33
|
+
}
|
|
34
|
+
return restMeta;
|
|
35
|
+
}
|
|
36
|
+
function buildWsHeadline(params) {
|
|
37
|
+
if ((params.kind === "req" || params.kind === "res") && params.method) {
|
|
38
|
+
return chalk.bold(params.method);
|
|
39
|
+
}
|
|
40
|
+
if (params.kind === "event" && params.event) {
|
|
41
|
+
return chalk.bold(params.event);
|
|
42
|
+
}
|
|
43
|
+
return undefined;
|
|
44
|
+
}
|
|
45
|
+
function buildWsStatusToken(kind, ok) {
|
|
46
|
+
if (kind !== "res" || ok === undefined) {
|
|
47
|
+
return undefined;
|
|
48
|
+
}
|
|
49
|
+
return ok ? chalk.greenBright("✓") : chalk.redBright("✗");
|
|
50
|
+
}
|
|
51
|
+
function logWsInfoLine(params) {
|
|
52
|
+
const tokens = [
|
|
53
|
+
params.prefix,
|
|
54
|
+
params.statusToken,
|
|
55
|
+
params.headline,
|
|
56
|
+
params.durationToken,
|
|
57
|
+
...params.restMeta,
|
|
58
|
+
...params.trailing,
|
|
59
|
+
].filter((t) => Boolean(t));
|
|
60
|
+
wsLog.info(tokens.join(" "));
|
|
61
|
+
}
|
|
62
|
+
export function shouldLogWs() {
|
|
63
|
+
return shouldLogSubsystemToConsole("gateway/ws");
|
|
64
|
+
}
|
|
19
65
|
export function shortId(value) {
|
|
20
66
|
const s = value.trim();
|
|
21
|
-
if (UUID_RE.test(s))
|
|
67
|
+
if (UUID_RE.test(s)) {
|
|
22
68
|
return `${s.slice(0, 8)}…${s.slice(-4)}`;
|
|
23
|
-
|
|
69
|
+
}
|
|
70
|
+
if (s.length <= 24) {
|
|
24
71
|
return s;
|
|
72
|
+
}
|
|
25
73
|
return `${s.slice(0, 12)}…${s.slice(-4)}`;
|
|
26
74
|
}
|
|
27
75
|
export function formatForLog(value) {
|
|
28
76
|
try {
|
|
29
77
|
if (value instanceof Error) {
|
|
30
78
|
const parts = [];
|
|
31
|
-
if (value.name)
|
|
79
|
+
if (value.name) {
|
|
32
80
|
parts.push(value.name);
|
|
33
|
-
|
|
81
|
+
}
|
|
82
|
+
if (value.message) {
|
|
34
83
|
parts.push(value.message);
|
|
84
|
+
}
|
|
35
85
|
const code = "code" in value && (typeof value.code === "string" || typeof value.code === "number")
|
|
36
86
|
? String(value.code)
|
|
37
87
|
: "";
|
|
38
|
-
if (code)
|
|
88
|
+
if (code) {
|
|
39
89
|
parts.push(`code=${code}`);
|
|
90
|
+
}
|
|
40
91
|
const combined = parts.filter(Boolean).join(": ").trim();
|
|
41
92
|
if (combined) {
|
|
42
93
|
return combined.length > LOG_VALUE_LIMIT
|
|
@@ -50,8 +101,9 @@ export function formatForLog(value) {
|
|
|
50
101
|
const name = typeof rec.name === "string" ? rec.name.trim() : "";
|
|
51
102
|
const code = typeof rec.code === "string" || typeof rec.code === "number" ? String(rec.code) : "";
|
|
52
103
|
const parts = [name, rec.message.trim()].filter(Boolean);
|
|
53
|
-
if (code)
|
|
104
|
+
if (code) {
|
|
54
105
|
parts.push(`code=${code}`);
|
|
106
|
+
}
|
|
55
107
|
const combined = parts.join(": ").trim();
|
|
56
108
|
return combined.length > LOG_VALUE_LIMIT
|
|
57
109
|
? `${combined.slice(0, LOG_VALUE_LIMIT)}...`
|
|
@@ -61,8 +113,9 @@ export function formatForLog(value) {
|
|
|
61
113
|
const str = typeof value === "string" || typeof value === "number"
|
|
62
114
|
? String(value)
|
|
63
115
|
: JSON.stringify(value);
|
|
64
|
-
if (!str)
|
|
116
|
+
if (!str) {
|
|
65
117
|
return "";
|
|
118
|
+
}
|
|
66
119
|
const redacted = redactSensitiveText(str, WS_LOG_REDACT_OPTIONS);
|
|
67
120
|
return redacted.length > LOG_VALUE_LIMIT
|
|
68
121
|
? `${redacted.slice(0, LOG_VALUE_LIMIT)}...`
|
|
@@ -74,13 +127,15 @@ export function formatForLog(value) {
|
|
|
74
127
|
}
|
|
75
128
|
function compactPreview(input, maxLen = 160) {
|
|
76
129
|
const oneLine = input.replace(/\s+/g, " ").trim();
|
|
77
|
-
if (oneLine.length <= maxLen)
|
|
130
|
+
if (oneLine.length <= maxLen) {
|
|
78
131
|
return oneLine;
|
|
132
|
+
}
|
|
79
133
|
return `${oneLine.slice(0, Math.max(0, maxLen - 1))}…`;
|
|
80
134
|
}
|
|
81
135
|
export function summarizeAgentEventForWsLog(payload) {
|
|
82
|
-
if (!payload || typeof payload !== "object")
|
|
136
|
+
if (!payload || typeof payload !== "object") {
|
|
83
137
|
return {};
|
|
138
|
+
}
|
|
84
139
|
const rec = payload;
|
|
85
140
|
const runId = typeof rec.runId === "string" ? rec.runId : undefined;
|
|
86
141
|
const stream = typeof rec.stream === "string" ? rec.stream : undefined;
|
|
@@ -88,8 +143,9 @@ export function summarizeAgentEventForWsLog(payload) {
|
|
|
88
143
|
const sessionKey = typeof rec.sessionKey === "string" ? rec.sessionKey : undefined;
|
|
89
144
|
const data = rec.data && typeof rec.data === "object" ? rec.data : undefined;
|
|
90
145
|
const extra = {};
|
|
91
|
-
if (runId)
|
|
146
|
+
if (runId) {
|
|
92
147
|
extra.run = shortId(runId);
|
|
148
|
+
}
|
|
93
149
|
if (sessionKey) {
|
|
94
150
|
const parsed = parseAgentSessionKey(sessionKey);
|
|
95
151
|
if (parsed) {
|
|
@@ -100,55 +156,69 @@ export function summarizeAgentEventForWsLog(payload) {
|
|
|
100
156
|
extra.session = sessionKey;
|
|
101
157
|
}
|
|
102
158
|
}
|
|
103
|
-
if (stream)
|
|
159
|
+
if (stream) {
|
|
104
160
|
extra.stream = stream;
|
|
105
|
-
|
|
161
|
+
}
|
|
162
|
+
if (seq !== undefined) {
|
|
106
163
|
extra.aseq = seq;
|
|
107
|
-
|
|
164
|
+
}
|
|
165
|
+
if (!data) {
|
|
108
166
|
return extra;
|
|
167
|
+
}
|
|
109
168
|
if (stream === "assistant") {
|
|
110
169
|
const text = typeof data.text === "string" ? data.text : undefined;
|
|
111
|
-
if (text?.trim())
|
|
170
|
+
if (text?.trim()) {
|
|
112
171
|
extra.text = compactPreview(text);
|
|
172
|
+
}
|
|
113
173
|
const mediaUrls = Array.isArray(data.mediaUrls) ? data.mediaUrls : undefined;
|
|
114
|
-
if (mediaUrls && mediaUrls.length > 0)
|
|
174
|
+
if (mediaUrls && mediaUrls.length > 0) {
|
|
115
175
|
extra.media = mediaUrls.length;
|
|
176
|
+
}
|
|
116
177
|
return extra;
|
|
117
178
|
}
|
|
118
179
|
if (stream === "tool") {
|
|
119
180
|
const phase = typeof data.phase === "string" ? data.phase : undefined;
|
|
120
181
|
const name = typeof data.name === "string" ? data.name : undefined;
|
|
121
|
-
if (phase || name)
|
|
182
|
+
if (phase || name) {
|
|
122
183
|
extra.tool = `${phase ?? "?"}:${name ?? "?"}`;
|
|
184
|
+
}
|
|
123
185
|
const toolCallId = typeof data.toolCallId === "string" ? data.toolCallId : undefined;
|
|
124
|
-
if (toolCallId)
|
|
186
|
+
if (toolCallId) {
|
|
125
187
|
extra.call = shortId(toolCallId);
|
|
188
|
+
}
|
|
126
189
|
const meta = typeof data.meta === "string" ? data.meta : undefined;
|
|
127
|
-
if (meta?.trim())
|
|
190
|
+
if (meta?.trim()) {
|
|
128
191
|
extra.meta = meta;
|
|
129
|
-
|
|
192
|
+
}
|
|
193
|
+
if (typeof data.isError === "boolean") {
|
|
130
194
|
extra.err = data.isError;
|
|
195
|
+
}
|
|
131
196
|
return extra;
|
|
132
197
|
}
|
|
133
198
|
if (stream === "lifecycle") {
|
|
134
199
|
const phase = typeof data.phase === "string" ? data.phase : undefined;
|
|
135
|
-
if (phase)
|
|
200
|
+
if (phase) {
|
|
136
201
|
extra.phase = phase;
|
|
137
|
-
|
|
202
|
+
}
|
|
203
|
+
if (typeof data.aborted === "boolean") {
|
|
138
204
|
extra.aborted = data.aborted;
|
|
205
|
+
}
|
|
139
206
|
const error = typeof data.error === "string" ? data.error : undefined;
|
|
140
|
-
if (error?.trim())
|
|
207
|
+
if (error?.trim()) {
|
|
141
208
|
extra.error = compactPreview(error, 120);
|
|
209
|
+
}
|
|
142
210
|
return extra;
|
|
143
211
|
}
|
|
144
212
|
const reason = typeof data.reason === "string" ? data.reason : undefined;
|
|
145
|
-
if (reason?.trim())
|
|
213
|
+
if (reason?.trim()) {
|
|
146
214
|
extra.reason = reason;
|
|
215
|
+
}
|
|
147
216
|
return extra;
|
|
148
217
|
}
|
|
149
218
|
export function logWs(direction, kind, meta) {
|
|
150
|
-
if (!shouldLogSubsystemToConsole("gateway/ws"))
|
|
219
|
+
if (!shouldLogSubsystemToConsole("gateway/ws")) {
|
|
151
220
|
return;
|
|
221
|
+
}
|
|
152
222
|
const style = getGatewayWsLogStyle();
|
|
153
223
|
if (!isVerbose()) {
|
|
154
224
|
logWsOptimized(direction, kind, meta);
|
|
@@ -171,8 +241,9 @@ export function logWs(direction, kind, meta) {
|
|
|
171
241
|
const durationMs = direction === "out" && kind === "res" && inflightKey
|
|
172
242
|
? (() => {
|
|
173
243
|
const startedAt = wsInflightSince.get(inflightKey);
|
|
174
|
-
if (startedAt === undefined)
|
|
244
|
+
if (startedAt === undefined) {
|
|
175
245
|
return undefined;
|
|
246
|
+
}
|
|
176
247
|
wsInflightSince.delete(inflightKey);
|
|
177
248
|
return now - startedAt;
|
|
178
249
|
})()
|
|
@@ -180,39 +251,18 @@ export function logWs(direction, kind, meta) {
|
|
|
180
251
|
const dirArrow = direction === "in" ? "←" : "→";
|
|
181
252
|
const dirColor = direction === "in" ? chalk.greenBright : chalk.cyanBright;
|
|
182
253
|
const prefix = `${dirColor(dirArrow)} ${chalk.bold(kind)}`;
|
|
183
|
-
const headline = (kind
|
|
184
|
-
|
|
185
|
-
: kind === "event" && event
|
|
186
|
-
? chalk.bold(event)
|
|
187
|
-
: undefined;
|
|
188
|
-
const statusToken = kind === "res" && ok !== undefined
|
|
189
|
-
? ok
|
|
190
|
-
? chalk.greenBright("✓")
|
|
191
|
-
: chalk.redBright("✗")
|
|
192
|
-
: undefined;
|
|
254
|
+
const headline = buildWsHeadline({ kind, method, event });
|
|
255
|
+
const statusToken = buildWsStatusToken(kind, ok);
|
|
193
256
|
const durationToken = typeof durationMs === "number" ? chalk.dim(`${durationMs}ms`) : undefined;
|
|
194
|
-
const restMeta =
|
|
195
|
-
if (meta) {
|
|
196
|
-
for (const [key, value] of Object.entries(meta)) {
|
|
197
|
-
if (value === undefined)
|
|
198
|
-
continue;
|
|
199
|
-
if (key === "connId" || key === "id")
|
|
200
|
-
continue;
|
|
201
|
-
if (key === "method" || key === "ok")
|
|
202
|
-
continue;
|
|
203
|
-
if (key === "event")
|
|
204
|
-
continue;
|
|
205
|
-
restMeta.push(`${chalk.dim(key)}=${formatForLog(value)}`);
|
|
206
|
-
}
|
|
207
|
-
}
|
|
257
|
+
const restMeta = collectWsRestMeta(meta);
|
|
208
258
|
const trailing = [];
|
|
209
259
|
if (connId) {
|
|
210
260
|
trailing.push(`${chalk.dim("conn")}=${chalk.gray(shortId(connId))}`);
|
|
211
261
|
}
|
|
212
|
-
if (id)
|
|
262
|
+
if (id) {
|
|
213
263
|
trailing.push(`${chalk.dim("id")}=${chalk.gray(shortId(id))}`);
|
|
214
|
-
|
|
215
|
-
|
|
264
|
+
}
|
|
265
|
+
logWsInfoLine({ prefix, statusToken, headline, durationToken, restMeta, trailing });
|
|
216
266
|
}
|
|
217
267
|
function logWsOptimized(direction, kind, meta) {
|
|
218
268
|
const connId = typeof meta?.connId === "string" ? meta.connId : undefined;
|
|
@@ -222,8 +272,9 @@ function logWsOptimized(direction, kind, meta) {
|
|
|
222
272
|
const inflightKey = connId && id ? `${connId}:${id}` : undefined;
|
|
223
273
|
if (direction === "in" && kind === "req" && inflightKey) {
|
|
224
274
|
wsInflightOptimized.set(inflightKey, Date.now());
|
|
225
|
-
if (wsInflightOptimized.size > 2000)
|
|
275
|
+
if (wsInflightOptimized.size > 2000) {
|
|
226
276
|
wsInflightOptimized.clear();
|
|
277
|
+
}
|
|
227
278
|
return;
|
|
228
279
|
}
|
|
229
280
|
if (kind === "parse-error") {
|
|
@@ -237,39 +288,32 @@ function logWsOptimized(direction, kind, meta) {
|
|
|
237
288
|
.join(" "));
|
|
238
289
|
return;
|
|
239
290
|
}
|
|
240
|
-
if (direction !== "out" || kind !== "res")
|
|
291
|
+
if (direction !== "out" || kind !== "res") {
|
|
241
292
|
return;
|
|
293
|
+
}
|
|
242
294
|
const startedAt = inflightKey ? wsInflightOptimized.get(inflightKey) : undefined;
|
|
243
|
-
if (inflightKey)
|
|
295
|
+
if (inflightKey) {
|
|
244
296
|
wsInflightOptimized.delete(inflightKey);
|
|
297
|
+
}
|
|
245
298
|
const durationMs = typeof startedAt === "number" ? Date.now() - startedAt : undefined;
|
|
246
299
|
const shouldLog = ok === false || (typeof durationMs === "number" && durationMs >= DEFAULT_WS_SLOW_MS);
|
|
247
|
-
if (!shouldLog)
|
|
300
|
+
if (!shouldLog) {
|
|
248
301
|
return;
|
|
249
|
-
const statusToken = ok === undefined ? undefined : ok ? chalk.greenBright("✓") : chalk.redBright("✗");
|
|
250
|
-
const durationToken = typeof durationMs === "number" ? chalk.dim(`${durationMs}ms`) : undefined;
|
|
251
|
-
const restMeta = [];
|
|
252
|
-
if (meta) {
|
|
253
|
-
for (const [key, value] of Object.entries(meta)) {
|
|
254
|
-
if (value === undefined)
|
|
255
|
-
continue;
|
|
256
|
-
if (key === "connId" || key === "id")
|
|
257
|
-
continue;
|
|
258
|
-
if (key === "method" || key === "ok")
|
|
259
|
-
continue;
|
|
260
|
-
restMeta.push(`${chalk.dim(key)}=${formatForLog(value)}`);
|
|
261
|
-
}
|
|
262
302
|
}
|
|
263
|
-
const
|
|
264
|
-
|
|
303
|
+
const statusToken = buildWsStatusToken("res", ok);
|
|
304
|
+
const durationToken = typeof durationMs === "number" ? chalk.dim(`${durationMs}ms`) : undefined;
|
|
305
|
+
const restMeta = collectWsRestMeta(meta);
|
|
306
|
+
logWsInfoLine({
|
|
307
|
+
prefix: `${chalk.yellowBright("⇄")} ${chalk.bold("res")}`,
|
|
265
308
|
statusToken,
|
|
266
|
-
method ? chalk.bold(method) : undefined,
|
|
309
|
+
headline: method ? chalk.bold(method) : undefined,
|
|
267
310
|
durationToken,
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
311
|
+
restMeta,
|
|
312
|
+
trailing: [
|
|
313
|
+
connId ? `${chalk.dim("conn")}=${chalk.gray(shortId(connId))}` : "",
|
|
314
|
+
id ? `${chalk.dim("id")}=${chalk.gray(shortId(id))}` : "",
|
|
315
|
+
].filter(Boolean),
|
|
316
|
+
});
|
|
273
317
|
}
|
|
274
318
|
function logWsCompact(direction, kind, meta) {
|
|
275
319
|
const now = Date.now();
|
|
@@ -283,8 +327,9 @@ function logWsCompact(direction, kind, meta) {
|
|
|
283
327
|
return;
|
|
284
328
|
}
|
|
285
329
|
const compactArrow = (() => {
|
|
286
|
-
if (kind === "req" || kind === "res")
|
|
330
|
+
if (kind === "req" || kind === "res") {
|
|
287
331
|
return "⇄";
|
|
332
|
+
}
|
|
288
333
|
return direction === "in" ? "←" : "→";
|
|
289
334
|
})();
|
|
290
335
|
const arrowColor = kind === "req" || kind === "res"
|
|
@@ -293,11 +338,7 @@ function logWsCompact(direction, kind, meta) {
|
|
|
293
338
|
? chalk.greenBright
|
|
294
339
|
: chalk.cyanBright;
|
|
295
340
|
const prefix = `${arrowColor(compactArrow)} ${chalk.bold(kind)}`;
|
|
296
|
-
const statusToken = kind
|
|
297
|
-
? ok
|
|
298
|
-
? chalk.greenBright("✓")
|
|
299
|
-
: chalk.redBright("✗")
|
|
300
|
-
: undefined;
|
|
341
|
+
const statusToken = buildWsStatusToken(kind, ok);
|
|
301
342
|
const startedAt = kind === "res" && direction === "out" && inflightKey
|
|
302
343
|
? wsInflightCompact.get(inflightKey)?.ts
|
|
303
344
|
: undefined;
|
|
@@ -305,32 +346,19 @@ function logWsCompact(direction, kind, meta) {
|
|
|
305
346
|
wsInflightCompact.delete(inflightKey);
|
|
306
347
|
}
|
|
307
348
|
const durationToken = typeof startedAt === "number" ? chalk.dim(`${now - startedAt}ms`) : undefined;
|
|
308
|
-
const headline = (
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
const restMeta =
|
|
314
|
-
if (meta) {
|
|
315
|
-
for (const [key, value] of Object.entries(meta)) {
|
|
316
|
-
if (value === undefined)
|
|
317
|
-
continue;
|
|
318
|
-
if (key === "connId" || key === "id")
|
|
319
|
-
continue;
|
|
320
|
-
if (key === "method" || key === "ok")
|
|
321
|
-
continue;
|
|
322
|
-
if (key === "event")
|
|
323
|
-
continue;
|
|
324
|
-
restMeta.push(`${chalk.dim(key)}=${formatForLog(value)}`);
|
|
325
|
-
}
|
|
326
|
-
}
|
|
349
|
+
const headline = buildWsHeadline({
|
|
350
|
+
kind,
|
|
351
|
+
method,
|
|
352
|
+
event: typeof meta?.event === "string" ? meta.event : undefined,
|
|
353
|
+
});
|
|
354
|
+
const restMeta = collectWsRestMeta(meta);
|
|
327
355
|
const trailing = [];
|
|
328
356
|
if (connId && connId !== wsLastCompactConnId) {
|
|
329
357
|
trailing.push(`${chalk.dim("conn")}=${chalk.gray(shortId(connId))}`);
|
|
330
358
|
wsLastCompactConnId = connId;
|
|
331
359
|
}
|
|
332
|
-
if (id)
|
|
360
|
+
if (id) {
|
|
333
361
|
trailing.push(`${chalk.dim("id")}=${chalk.gray(shortId(id))}`);
|
|
334
|
-
|
|
335
|
-
|
|
362
|
+
}
|
|
363
|
+
logWsInfoLine({ prefix, statusToken, headline, durationToken, restMeta, trailing });
|
|
336
364
|
}
|
|
@@ -1,104 +1,58 @@
|
|
|
1
|
-
import JSON5 from "json5";
|
|
2
|
-
import { LEGACY_MANIFEST_KEY } from "../compat/legacy-names.js";
|
|
3
1
|
import { parseFrontmatterBlock } from "../markdown/frontmatter.js";
|
|
4
|
-
import {
|
|
2
|
+
import { getFrontmatterString, normalizeStringList, parsePoolbotManifestInstallBase, parseFrontmatterBool, resolvePoolbotManifestBlock, resolvePoolbotManifestInstall, resolvePoolbotManifestOs, resolvePoolbotManifestRequires, } from "../shared/frontmatter.js";
|
|
5
3
|
export function parseFrontmatter(content) {
|
|
6
4
|
return parseFrontmatterBlock(content);
|
|
7
5
|
}
|
|
8
|
-
function normalizeStringList(input) {
|
|
9
|
-
if (!input)
|
|
10
|
-
return [];
|
|
11
|
-
if (Array.isArray(input)) {
|
|
12
|
-
return input.map((value) => String(value).trim()).filter(Boolean);
|
|
13
|
-
}
|
|
14
|
-
if (typeof input === "string") {
|
|
15
|
-
return input
|
|
16
|
-
.split(",")
|
|
17
|
-
.map((value) => value.trim())
|
|
18
|
-
.filter(Boolean);
|
|
19
|
-
}
|
|
20
|
-
return [];
|
|
21
|
-
}
|
|
22
6
|
function parseInstallSpec(input) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
const raw = input;
|
|
26
|
-
const kindRaw = typeof raw.kind === "string" ? raw.kind : typeof raw.type === "string" ? raw.type : "";
|
|
27
|
-
const kind = kindRaw.trim().toLowerCase();
|
|
28
|
-
if (kind !== "bundled" && kind !== "npm" && kind !== "git") {
|
|
7
|
+
const parsed = parsePoolbotManifestInstallBase(input, ["bundled", "npm", "git"]);
|
|
8
|
+
if (!parsed) {
|
|
29
9
|
return undefined;
|
|
30
10
|
}
|
|
11
|
+
const { raw } = parsed;
|
|
31
12
|
const spec = {
|
|
32
|
-
kind: kind,
|
|
13
|
+
kind: parsed.kind,
|
|
33
14
|
};
|
|
34
|
-
if (
|
|
35
|
-
spec.id =
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
15
|
+
if (parsed.id) {
|
|
16
|
+
spec.id = parsed.id;
|
|
17
|
+
}
|
|
18
|
+
if (parsed.label) {
|
|
19
|
+
spec.label = parsed.label;
|
|
20
|
+
}
|
|
21
|
+
if (parsed.bins) {
|
|
22
|
+
spec.bins = parsed.bins;
|
|
23
|
+
}
|
|
24
|
+
if (typeof raw.package === "string") {
|
|
42
25
|
spec.package = raw.package;
|
|
43
|
-
|
|
26
|
+
}
|
|
27
|
+
if (typeof raw.repository === "string") {
|
|
44
28
|
spec.repository = raw.repository;
|
|
29
|
+
}
|
|
45
30
|
return spec;
|
|
46
31
|
}
|
|
47
|
-
function getFrontmatterValue(frontmatter, key) {
|
|
48
|
-
const raw = frontmatter[key];
|
|
49
|
-
return typeof raw === "string" ? raw : undefined;
|
|
50
|
-
}
|
|
51
|
-
function parseFrontmatterBool(value, fallback) {
|
|
52
|
-
const parsed = parseBooleanValue(value);
|
|
53
|
-
return parsed === undefined ? fallback : parsed;
|
|
54
|
-
}
|
|
55
32
|
export function resolvePoolbotMetadata(frontmatter) {
|
|
56
|
-
const
|
|
57
|
-
if (!
|
|
58
|
-
return undefined;
|
|
59
|
-
try {
|
|
60
|
-
const parsed = JSON5.parse(raw);
|
|
61
|
-
if (!parsed || typeof parsed !== "object")
|
|
62
|
-
return undefined;
|
|
63
|
-
const metadataRaw = parsed.poolbot ?? parsed[LEGACY_MANIFEST_KEY];
|
|
64
|
-
if (!metadataRaw || typeof metadataRaw !== "object")
|
|
65
|
-
return undefined;
|
|
66
|
-
const metadataObj = metadataRaw;
|
|
67
|
-
const requiresRaw = typeof metadataObj.requires === "object" && metadataObj.requires !== null
|
|
68
|
-
? metadataObj.requires
|
|
69
|
-
: undefined;
|
|
70
|
-
const installRaw = Array.isArray(metadataObj.install) ? metadataObj.install : [];
|
|
71
|
-
const install = installRaw
|
|
72
|
-
.map((entry) => parseInstallSpec(entry))
|
|
73
|
-
.filter((entry) => Boolean(entry));
|
|
74
|
-
const osRaw = normalizeStringList(metadataObj.os);
|
|
75
|
-
const eventsRaw = normalizeStringList(metadataObj.events);
|
|
76
|
-
return {
|
|
77
|
-
always: typeof metadataObj.always === "boolean" ? metadataObj.always : undefined,
|
|
78
|
-
emoji: typeof metadataObj.emoji === "string" ? metadataObj.emoji : undefined,
|
|
79
|
-
homepage: typeof metadataObj.homepage === "string" ? metadataObj.homepage : undefined,
|
|
80
|
-
hookKey: typeof metadataObj.hookKey === "string" ? metadataObj.hookKey : undefined,
|
|
81
|
-
export: typeof metadataObj.export === "string" ? metadataObj.export : undefined,
|
|
82
|
-
os: osRaw.length > 0 ? osRaw : undefined,
|
|
83
|
-
events: eventsRaw.length > 0 ? eventsRaw : [],
|
|
84
|
-
requires: requiresRaw
|
|
85
|
-
? {
|
|
86
|
-
bins: normalizeStringList(requiresRaw.bins),
|
|
87
|
-
anyBins: normalizeStringList(requiresRaw.anyBins),
|
|
88
|
-
env: normalizeStringList(requiresRaw.env),
|
|
89
|
-
config: normalizeStringList(requiresRaw.config),
|
|
90
|
-
}
|
|
91
|
-
: undefined,
|
|
92
|
-
install: install.length > 0 ? install : undefined,
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
|
-
catch {
|
|
33
|
+
const metadataObj = resolvePoolbotManifestBlock({ frontmatter });
|
|
34
|
+
if (!metadataObj) {
|
|
96
35
|
return undefined;
|
|
97
36
|
}
|
|
37
|
+
const requires = resolvePoolbotManifestRequires(metadataObj);
|
|
38
|
+
const install = resolvePoolbotManifestInstall(metadataObj, parseInstallSpec);
|
|
39
|
+
const osRaw = resolvePoolbotManifestOs(metadataObj);
|
|
40
|
+
const eventsRaw = normalizeStringList(metadataObj.events);
|
|
41
|
+
return {
|
|
42
|
+
always: typeof metadataObj.always === "boolean" ? metadataObj.always : undefined,
|
|
43
|
+
emoji: typeof metadataObj.emoji === "string" ? metadataObj.emoji : undefined,
|
|
44
|
+
homepage: typeof metadataObj.homepage === "string" ? metadataObj.homepage : undefined,
|
|
45
|
+
hookKey: typeof metadataObj.hookKey === "string" ? metadataObj.hookKey : undefined,
|
|
46
|
+
export: typeof metadataObj.export === "string" ? metadataObj.export : undefined,
|
|
47
|
+
os: osRaw.length > 0 ? osRaw : undefined,
|
|
48
|
+
events: eventsRaw.length > 0 ? eventsRaw : [],
|
|
49
|
+
requires: requires,
|
|
50
|
+
install: install.length > 0 ? install : undefined,
|
|
51
|
+
};
|
|
98
52
|
}
|
|
99
53
|
export function resolveHookInvocationPolicy(frontmatter) {
|
|
100
54
|
return {
|
|
101
|
-
enabled: parseFrontmatterBool(
|
|
55
|
+
enabled: parseFrontmatterBool(getFrontmatterString(frontmatter, "enabled"), true),
|
|
102
56
|
};
|
|
103
57
|
}
|
|
104
58
|
export function resolveHookKey(hookName, entry) {
|