@poolzin/pool-bot 2026.1.39 → 2026.2.1
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/assets/chrome-extension/README.md +3 -3
- package/assets/chrome-extension/background.js +5 -5
- package/assets/chrome-extension/manifest.json +3 -3
- package/assets/chrome-extension/options.html +4 -4
- package/assets/chrome-extension/options.js +1 -1
- package/dist/acp/client.js +3 -3
- package/dist/acp/types.js +1 -1
- package/dist/agents/agent-paths.js +3 -3
- package/dist/agents/auth-profiles/paths.js +3 -3
- package/dist/agents/bash-tools.exec.js +76 -25
- package/dist/agents/cli-runner/helpers.js +10 -12
- package/dist/agents/cli-runner.js +2 -2
- package/dist/agents/cloudflare-ai-gateway.js +31 -0
- package/dist/agents/compaction.js +16 -2
- package/dist/agents/context-window-guard.js +13 -10
- package/dist/agents/context.js +4 -4
- package/dist/agents/docs-path.js +1 -1
- package/dist/agents/identity.js +47 -7
- package/dist/agents/memory-search.js +25 -8
- package/dist/agents/minimax-vlm.js +1 -1
- package/dist/agents/model-auth.js +12 -1
- package/dist/agents/model-catalog.js +4 -4
- package/dist/agents/model-selection.js +31 -4
- package/dist/agents/models-config.js +3 -3
- package/dist/agents/models-config.providers.js +147 -39
- package/dist/agents/pi-embedded-block-chunker.js +117 -42
- package/dist/agents/pi-embedded-helpers/errors.js +183 -78
- package/dist/agents/pi-embedded-helpers/openai.js +1 -1
- package/dist/agents/pi-embedded-helpers.js +1 -1
- package/dist/agents/pi-embedded-runner/compact.js +9 -8
- package/dist/agents/pi-embedded-runner/model.js +63 -4
- package/dist/agents/pi-embedded-runner/run/attempt.js +27 -17
- package/dist/agents/pi-embedded-runner/run.js +203 -50
- package/dist/agents/pi-embedded-runner/system-prompt.js +10 -2
- package/dist/agents/pi-embedded-runner/tool-result-truncation.js +275 -0
- package/dist/agents/pi-embedded-runner/utils.js +1 -1
- package/dist/agents/pi-embedded-subscribe.js +118 -29
- package/dist/agents/pi-model-discovery.js +10 -0
- package/dist/agents/pi-tool-definition-adapter.js +50 -9
- package/dist/agents/pi-tools.before-tool-call.js +67 -0
- package/dist/agents/pi-tools.js +20 -10
- package/dist/agents/pi-tools.read.js +2 -2
- package/dist/agents/poolbot-tools.js +15 -10
- package/dist/agents/sandbox-paths.js +31 -0
- package/dist/agents/session-file-repair.js +83 -0
- package/dist/agents/session-tool-result-guard.js +94 -15
- package/dist/agents/session-transcript-repair.js +68 -0
- package/dist/agents/shell-utils.js +51 -0
- package/dist/agents/skills/bundled-context.js +23 -0
- package/dist/agents/skills/bundled-dir.js +41 -7
- package/dist/agents/skills/frontmatter.js +1 -1
- package/dist/agents/skills/workspace.js +2 -2
- package/dist/agents/skills-install.js +60 -23
- package/dist/agents/subagent-announce.js +79 -34
- package/dist/agents/system-prompt.js +28 -4
- package/dist/agents/together-models.js +127 -0
- package/dist/agents/tool-images.js +1 -1
- package/dist/agents/tool-policy.conformance.js +14 -0
- package/dist/agents/tool-policy.js +25 -1
- package/dist/agents/tools/browser-tool.js +3 -3
- package/dist/agents/tools/cron-tool.js +166 -19
- package/dist/agents/tools/discord-actions-presence.js +78 -0
- package/dist/agents/tools/image-tool.js +2 -2
- package/dist/agents/tools/memory-tool.js +93 -5
- package/dist/agents/tools/message-tool.js +56 -2
- package/dist/agents/tools/sessions-history-tool.js +69 -1
- package/dist/agents/tools/web-search.js +211 -42
- package/dist/agents/usage.js +23 -1
- package/dist/agents/workspace-run.js +67 -0
- package/dist/agents/workspace-templates.js +44 -0
- package/dist/auto-reply/command-auth.js +121 -6
- package/dist/auto-reply/commands-registry.data.js +1 -1
- package/dist/auto-reply/envelope.js +50 -72
- package/dist/auto-reply/reply/commands-compact.js +1 -0
- package/dist/auto-reply/reply/commands-context-report.js +3 -2
- package/dist/auto-reply/reply/commands-context.js +1 -0
- package/dist/auto-reply/reply/commands-models.js +107 -60
- package/dist/auto-reply/reply/commands-ptt.js +171 -0
- package/dist/auto-reply/reply/commands-session.js +2 -2
- package/dist/auto-reply/reply/get-reply-run.js +16 -5
- package/dist/auto-reply/reply/groups.js +1 -1
- package/dist/auto-reply/reply/inbound-context.js +9 -1
- package/dist/auto-reply/reply/inbound-meta.js +130 -0
- package/dist/auto-reply/reply/model-selection.js +3 -3
- package/dist/auto-reply/reply/untrusted-context.js +15 -0
- package/dist/auto-reply/status.js +1 -1
- package/dist/auto-reply/thinking.js +88 -43
- package/dist/browser/bridge-server.js +13 -0
- package/dist/browser/cdp.helpers.js +38 -24
- package/dist/browser/client-fetch.js +51 -8
- package/dist/browser/config.js +2 -11
- package/dist/browser/extension-relay.js +104 -43
- package/dist/browser/pw-ai.js +1 -1
- package/dist/browser/pw-session.js +143 -8
- package/dist/browser/pw-tools-core.interactions.js +125 -27
- package/dist/browser/pw-tools-core.responses.js +1 -1
- package/dist/browser/pw-tools-core.state.js +1 -1
- package/dist/browser/routes/agent.act.js +86 -41
- package/dist/browser/routes/dispatcher.js +4 -4
- package/dist/browser/screenshot.js +1 -1
- package/dist/browser/server-context.js +2 -2
- package/dist/browser/server.js +13 -0
- package/dist/build-info.json +3 -3
- package/dist/canvas-host/a2ui.js +3 -3
- package/dist/channels/plugins/catalog.js +2 -2
- package/dist/channels/plugins/onboarding/imessage.js +1 -1
- package/dist/channels/plugins/onboarding/signal.js +1 -1
- package/dist/channels/plugins/onboarding/slack.js +4 -4
- package/dist/channels/plugins/onboarding/whatsapp.js +3 -3
- package/dist/channels/plugins/pairing-message.js +1 -1
- package/dist/channels/reply-prefix.js +8 -1
- package/dist/cli/browser-cli-extension.js +2 -2
- package/dist/cli/cron-cli/register.cron-add.js +61 -40
- package/dist/cli/cron-cli/register.cron-edit.js +60 -34
- package/dist/cli/cron-cli/shared.js +56 -41
- package/dist/cli/dns-cli.js +26 -14
- package/dist/cli/docs-cli.js +1 -1
- package/dist/cli/gateway-cli/dev.js +1 -1
- package/dist/cli/gateway-cli/register.js +37 -19
- package/dist/cli/memory-cli.js +30 -20
- package/dist/cli/nodes-cli/register.canvas.js +1 -1
- package/dist/cli/parse-bytes.js +37 -0
- package/dist/cli/plugins-cli.js +1 -1
- package/dist/cli/run-main.js +2 -2
- package/dist/cli/security-cli.js +1 -1
- package/dist/cli/tagline.js +1 -1
- package/dist/cli/update-cli.js +173 -52
- package/dist/cli/webhooks-cli.js +5 -5
- package/dist/commands/agent.js +1 -0
- package/dist/commands/agents.commands.add.js +1 -1
- package/dist/commands/auth-choice.apply.api-providers.js +305 -17
- package/dist/commands/auth-choice.apply.js +4 -1
- package/dist/commands/auth-choice.apply.plugin-provider.js +2 -2
- package/dist/commands/auth-choice.apply.xai.js +63 -0
- package/dist/commands/auth-choice.preferred-provider.js +7 -1
- package/dist/commands/configure.wizard.js +1 -1
- package/dist/commands/dashboard.js +1 -1
- package/dist/commands/docs.js +1 -1
- package/dist/commands/doctor-config-flow.js +61 -5
- package/dist/commands/doctor-gateway-services.js +3 -3
- package/dist/commands/doctor-state-migrations.js +1 -1
- package/dist/commands/doctor-update.js +3 -3
- package/dist/commands/doctor.js +1 -1
- package/dist/commands/health.js +1 -1
- package/dist/commands/model-allowlist.js +29 -0
- package/dist/commands/model-picker.js +2 -1
- package/dist/commands/models/list.probe.js +2 -2
- package/dist/commands/models/list.registry.js +4 -4
- package/dist/commands/models/list.status-command.js +44 -24
- package/dist/commands/models/shared.js +15 -0
- package/dist/commands/onboard-auth.config-core.js +366 -28
- package/dist/commands/onboard-auth.credentials.js +71 -9
- package/dist/commands/onboard-auth.js +3 -3
- package/dist/commands/onboard-auth.models.js +26 -24
- package/dist/commands/onboard-custom.js +384 -0
- package/dist/commands/onboard-non-interactive/local/auth-choice-inference.js +35 -0
- package/dist/commands/onboard-non-interactive/local/auth-choice.js +146 -9
- package/dist/commands/onboard-skills.js +63 -38
- package/dist/commands/openai-model-default.js +41 -0
- package/dist/commands/status-all/report-lines.js +1 -1
- package/dist/commands/status.command.js +1 -1
- package/dist/commands/uninstall.js +3 -3
- package/dist/compat/legacy-names.js +1 -1
- package/dist/config/defaults.js +3 -2
- package/dist/config/io.js +3 -3
- package/dist/config/paths.js +136 -35
- package/dist/config/plugin-auto-enable.js +21 -5
- package/dist/config/redact-snapshot.js +153 -0
- package/dist/config/schema.field-metadata.js +590 -0
- package/dist/config/schema.js +3 -3
- package/dist/config/sessions/store.js +291 -23
- package/dist/config/types.memory.js +1 -0
- package/dist/config/version.js +4 -4
- package/dist/config/zod-schema.agent-defaults.js +3 -0
- package/dist/config/zod-schema.agent-runtime.js +13 -2
- package/dist/config/zod-schema.providers-core.js +142 -0
- package/dist/config/zod-schema.session.js +3 -0
- package/dist/cron/delivery.js +57 -0
- package/dist/cron/isolated-agent/delivery-target.js +18 -3
- package/dist/cron/isolated-agent/helpers.js +22 -5
- package/dist/cron/isolated-agent/run.js +171 -63
- package/dist/cron/isolated-agent/session.js +2 -0
- package/dist/cron/normalize.js +356 -28
- package/dist/cron/parse.js +10 -5
- package/dist/cron/run-log.js +35 -10
- package/dist/cron/schedule.js +41 -6
- package/dist/cron/service/jobs.js +208 -35
- package/dist/cron/service/ops.js +72 -16
- package/dist/cron/service/state.js +2 -0
- package/dist/cron/service/store.js +386 -14
- package/dist/cron/service/timer.js +390 -147
- package/dist/cron/session-reaper.js +86 -0
- package/dist/cron/store.js +23 -8
- package/dist/cron/validate-timestamp.js +43 -0
- package/dist/daemon/constants.js +7 -7
- package/dist/daemon/inspect.js +6 -6
- package/dist/daemon/systemd-unit.js +1 -1
- package/dist/discord/monitor/agent-components.js +438 -0
- package/dist/discord/monitor/allow-list.js +28 -5
- package/dist/discord/monitor/gateway-registry.js +29 -0
- package/dist/discord/monitor/native-command.js +44 -23
- package/dist/discord/monitor/sender-identity.js +45 -0
- package/dist/discord/pluralkit.js +27 -0
- package/dist/discord/send.outbound.js +92 -5
- package/dist/discord/send.shared.js +60 -23
- package/dist/discord/targets.js +84 -1
- package/dist/entry.js +15 -9
- package/dist/extensionAPI.js +8 -0
- package/dist/gateway/control-ui.js +8 -1
- package/dist/gateway/hooks-mapping.js +3 -0
- package/dist/gateway/hooks.js +65 -0
- package/dist/gateway/live-image-probe.js +1 -66
- package/dist/gateway/net.js +96 -31
- package/dist/gateway/node-command-policy.js +50 -15
- package/dist/gateway/openai-http.js +2 -2
- package/dist/gateway/openresponses-http.js +4 -4
- package/dist/gateway/origin-check.js +56 -0
- package/dist/gateway/protocol/client-info.js +9 -0
- package/dist/gateway/protocol/index.js +9 -2
- package/dist/gateway/protocol/schema/agents-models-skills.js +71 -1
- package/dist/gateway/protocol/schema/cron.js +22 -10
- package/dist/gateway/protocol/schema/protocol-schemas.js +16 -2
- package/dist/gateway/protocol/schema/sessions.js +12 -0
- package/dist/gateway/server/hooks.js +1 -1
- package/dist/gateway/server-broadcast.js +26 -9
- package/dist/gateway/server-chat.js +112 -23
- package/dist/gateway/server-discovery-runtime.js +10 -2
- package/dist/gateway/server-discovery.js +2 -2
- package/dist/gateway/server-http.js +110 -12
- package/dist/gateway/server-methods/agent-timestamp.js +60 -0
- package/dist/gateway/server-methods/agents.js +321 -2
- package/dist/gateway/server-methods/usage.js +559 -16
- package/dist/gateway/server-runtime-state.js +22 -8
- package/dist/gateway/server-startup-memory.js +16 -0
- package/dist/gateway/server.impl.js +7 -3
- package/dist/gateway/session-utils.fs.js +23 -25
- package/dist/gateway/session-utils.js +20 -10
- package/dist/gateway/sessions-patch.js +7 -22
- package/dist/gateway/test-helpers.server.js +35 -2
- package/dist/hooks/frontmatter.js +1 -1
- package/dist/hooks/hooks-status.js +1 -1
- package/dist/hooks/install.js +2 -2
- package/dist/hooks/loader.js +1 -1
- package/dist/hooks/workspace.js +3 -3
- package/dist/imessage/constants.js +2 -0
- package/dist/imessage/monitor/deliver.js +4 -1
- package/dist/imessage/monitor/monitor-provider.js +51 -1
- package/dist/index.js +2 -2
- package/dist/infra/bonjour-discovery.js +131 -70
- package/dist/infra/bonjour.js +3 -3
- package/dist/infra/control-ui-assets.js +134 -12
- package/dist/infra/errors.js +12 -0
- package/dist/infra/exec-approvals.js +266 -57
- package/dist/infra/format-time/format-datetime.js +79 -0
- package/dist/infra/format-time/format-duration.js +81 -0
- package/dist/infra/format-time/format-relative.js +80 -0
- package/dist/infra/heartbeat-runner.js +140 -49
- package/dist/infra/home-dir.js +54 -0
- package/dist/infra/net/fetch-guard.js +122 -0
- package/dist/infra/net/ssrf.js +65 -29
- package/dist/infra/outbound/abort.js +14 -0
- package/dist/infra/outbound/message-action-runner.js +77 -13
- package/dist/infra/outbound/outbound-session.js +143 -37
- package/dist/infra/path-env.js +3 -3
- package/dist/infra/poolbot-root.js +43 -1
- package/dist/infra/provider-usage.fetch.minimax.js +1 -1
- package/dist/infra/restart.js +1 -1
- package/dist/infra/session-cost-usage.js +631 -41
- package/dist/infra/state-migrations.js +317 -47
- package/dist/infra/tailscale.js +1 -1
- package/dist/infra/update-global.js +35 -0
- package/dist/infra/update-runner.js +149 -43
- package/dist/infra/warning-filter.js +65 -0
- package/dist/infra/widearea-dns.js +30 -9
- package/dist/logging/redact-identifier.js +12 -0
- package/dist/macos/relay.js +2 -2
- package/dist/media/fetch.js +81 -58
- package/dist/media/input-files.js +1 -1
- package/dist/media/mime.js +4 -0
- package/dist/media/png-encode.js +74 -0
- package/dist/media-understanding/apply.js +403 -3
- package/dist/media-understanding/attachments.js +38 -27
- package/dist/media-understanding/defaults.js +16 -0
- package/dist/media-understanding/providers/deepgram/audio.js +22 -14
- package/dist/media-understanding/providers/google/audio.js +24 -17
- package/dist/media-understanding/providers/google/video.js +24 -17
- package/dist/media-understanding/providers/image.js +4 -4
- package/dist/media-understanding/providers/index.js +4 -1
- package/dist/media-understanding/providers/openai/audio.js +22 -14
- package/dist/media-understanding/providers/shared.js +16 -11
- package/dist/media-understanding/providers/zai/index.js +6 -0
- package/dist/media-understanding/runner.js +158 -90
- package/dist/memory/backend-config.js +207 -0
- package/dist/memory/batch-voyage.js +277 -0
- package/dist/memory/embeddings-voyage.js +75 -0
- package/dist/memory/embeddings.js +29 -17
- package/dist/memory/internal.js +101 -18
- package/dist/memory/manager.js +155 -48
- package/dist/memory/search-manager.js +173 -0
- package/dist/memory/session-files.js +9 -3
- package/dist/memory/types.js +1 -0
- package/dist/node-host/runner.js +36 -26
- package/dist/node-host/with-timeout.js +27 -0
- package/dist/pairing/pairing-messages.js +1 -1
- package/dist/plugins/commands.js +5 -1
- package/dist/plugins/config-state.js +86 -7
- package/dist/plugins/discovery.js +1 -1
- package/dist/plugins/install.js +2 -2
- package/dist/plugins/source-display.js +51 -0
- package/dist/plugins/update.js +1 -1
- package/dist/process/exec.js +20 -2
- package/dist/routing/resolve-route.js +12 -0
- package/dist/routing/session-key.js +15 -0
- package/dist/runtime.js +2 -0
- package/dist/security/audit-extra.async.js +601 -0
- package/dist/security/audit-extra.js +2 -830
- package/dist/security/audit-extra.sync.js +505 -0
- package/dist/security/audit.js +2 -2
- package/dist/security/channel-metadata.js +34 -0
- package/dist/security/external-content.js +88 -6
- package/dist/security/skill-scanner.js +330 -0
- package/dist/sessions/session-key-utils.js +7 -0
- package/dist/shared/text/reasoning-tags.js +52 -7
- package/dist/signal/monitor/event-handler.js +80 -1
- package/dist/slack/monitor/media.js +85 -15
- package/dist/tailscale/detect.js +145 -0
- package/dist/telegram/bot/helpers.js +109 -28
- package/dist/telegram/bot-handlers.js +144 -3
- package/dist/telegram/bot-message-context.js +38 -11
- package/dist/telegram/bot-message-dispatch.js +48 -15
- package/dist/telegram/bot-native-commands.js +86 -29
- package/dist/telegram/bot.js +30 -29
- package/dist/telegram/model-buttons.js +163 -0
- package/dist/telegram/monitor.js +110 -85
- package/dist/telegram/send.js +129 -47
- package/dist/terminal/restore.js +45 -0
- package/dist/test-helpers/state-dir-env.js +16 -0
- package/dist/test-helpers/workspace.js +11 -0
- package/dist/test-utils/channel-plugins.js +82 -0
- package/dist/test-utils/ports.js +73 -0
- package/dist/tts/tts.js +12 -6
- package/dist/tui/tui-session-actions.js +166 -54
- package/dist/utils/fetch-timeout.js +20 -0
- package/dist/utils/normalize-secret-input.js +19 -0
- package/dist/utils/shell-argv.js +61 -0
- package/dist/utils/transcript-tools.js +58 -0
- package/dist/utils.js +55 -14
- package/dist/version.js +42 -5
- package/dist/web/qr-image.js +1 -61
- package/dist/wizard/onboarding.finalize.js +7 -7
- package/dist/wizard/onboarding.js +3 -3
- package/docs/RELEASE_WORKFOTS_COMPARISON.md +3 -3
- package/docs/_config.yml +2 -2
- package/docs/_layouts/default.html +9 -9
- package/docs/concepts/typebox.md +1 -1
- package/docs/docs.json +1 -1
- package/docs/northflank.mdx +7 -7
- package/docs/railway.mdx +3 -3
- package/docs/render.mdx +5 -5
- package/docs/start/lore.md +2 -2
- package/extensions/bluebubbles/index.ts +2 -2
- package/extensions/bluebubbles/package.json +1 -1
- package/extensions/bluebubbles/src/accounts.ts +8 -8
- package/extensions/bluebubbles/src/actions.test.ts +22 -22
- package/extensions/bluebubbles/src/actions.ts +5 -5
- package/extensions/bluebubbles/src/attachments.ts +2 -2
- package/extensions/bluebubbles/src/channel.ts +16 -16
- package/extensions/bluebubbles/src/chat.ts +2 -2
- package/extensions/bluebubbles/src/media-send.ts +2 -2
- package/extensions/bluebubbles/src/monitor.test.ts +46 -46
- package/extensions/bluebubbles/src/monitor.ts +5 -5
- package/extensions/bluebubbles/src/onboarding.ts +7 -7
- package/extensions/bluebubbles/src/reactions.ts +2 -2
- package/extensions/bluebubbles/src/send.ts +2 -2
- package/extensions/copilot-proxy/README.md +1 -1
- package/extensions/copilot-proxy/package.json +1 -1
- package/extensions/diagnostics-otel/index.ts +2 -2
- package/extensions/diagnostics-otel/package.json +1 -1
- package/extensions/diagnostics-otel/src/service.ts +3 -3
- package/extensions/discord/index.ts +2 -2
- package/extensions/discord/package.json +1 -1
- package/extensions/google-antigravity-auth/README.md +1 -1
- package/extensions/google-antigravity-auth/index.ts +1 -1
- package/extensions/google-antigravity-auth/package.json +1 -1
- package/extensions/google-gemini-cli-auth/README.md +1 -1
- package/extensions/google-gemini-cli-auth/oauth.ts +1 -1
- package/extensions/google-gemini-cli-auth/package.json +1 -1
- package/extensions/googlechat/index.ts +3 -3
- package/extensions/googlechat/package.json +1 -1
- package/extensions/googlechat/src/accounts.ts +8 -8
- package/extensions/googlechat/src/actions.ts +6 -6
- package/extensions/googlechat/src/channel.ts +21 -21
- package/extensions/googlechat/src/monitor.ts +8 -8
- package/extensions/googlechat/src/onboarding.ts +10 -10
- package/extensions/imessage/index.ts +2 -2
- package/extensions/imessage/package.json +1 -1
- package/extensions/line/index.ts +2 -2
- package/extensions/line/package.json +1 -1
- package/extensions/line/src/card-command.ts +2 -2
- package/extensions/line/src/channel.logout.test.ts +4 -4
- package/extensions/line/src/channel.sendPayload.test.ts +8 -8
- package/extensions/line/src/channel.ts +3 -3
- package/extensions/llm-task/README.md +3 -3
- package/extensions/llm-task/index.ts +2 -2
- package/extensions/llm-task/package.json +1 -1
- package/extensions/llm-task/src/llm-task-tool.ts +4 -4
- package/extensions/lobster/README.md +6 -6
- package/extensions/lobster/index.ts +2 -2
- package/extensions/lobster/src/lobster-tool.test.ts +4 -4
- package/extensions/lobster/src/lobster-tool.ts +2 -2
- package/extensions/matrix/index.ts +2 -2
- package/extensions/matrix/package.json +1 -1
- package/extensions/matrix/src/matrix/client/config.ts +1 -1
- package/extensions/matrix/src/matrix/monitor/handler.ts +1 -1
- package/extensions/matrix/src/onboarding.ts +1 -1
- package/extensions/mattermost/index.ts +2 -2
- package/extensions/mattermost/package.json +1 -1
- package/extensions/mattermost/src/mattermost/accounts.ts +8 -8
- package/extensions/mattermost/src/mattermost/monitor-helpers.ts +5 -5
- package/extensions/mattermost/src/mattermost/monitor.ts +2 -2
- package/extensions/mattermost/src/onboarding-helpers.ts +3 -3
- package/extensions/mattermost/src/onboarding.ts +2 -2
- package/extensions/memory-core/index.ts +2 -2
- package/extensions/memory-core/package.json +1 -1
- package/extensions/memory-lancedb/index.ts +3 -3
- package/extensions/memory-lancedb/package.json +1 -1
- package/extensions/msteams/index.ts +2 -2
- package/extensions/msteams/package.json +1 -1
- package/extensions/msteams/src/channel.directory.test.ts +2 -2
- package/extensions/msteams/src/channel.ts +2 -2
- package/extensions/msteams/src/graph-upload.ts +4 -4
- package/extensions/msteams/src/monitor-handler.ts +2 -2
- package/extensions/msteams/src/monitor.ts +2 -2
- package/extensions/msteams/src/onboarding.ts +9 -9
- package/extensions/msteams/src/reply-dispatcher.ts +2 -2
- package/extensions/msteams/src/send-context.ts +2 -2
- package/extensions/msteams/src/send.ts +4 -4
- package/extensions/nextcloud-talk/index.ts +2 -2
- package/extensions/nextcloud-talk/package.json +1 -1
- package/extensions/nextcloud-talk/src/channel.ts +7 -7
- package/extensions/nextcloud-talk/src/inbound.ts +7 -7
- package/extensions/nextcloud-talk/src/onboarding.ts +1 -1
- package/extensions/nostr/README.md +2 -2
- package/extensions/nostr/index.ts +5 -5
- package/extensions/nostr/package.json +1 -1
- package/extensions/nostr/src/types.ts +4 -4
- package/extensions/open-prose/index.ts +2 -2
- package/extensions/qwen-portal-auth/README.md +1 -1
- package/extensions/signal/index.ts +2 -2
- package/extensions/signal/package.json +1 -1
- package/extensions/slack/index.ts +2 -2
- package/extensions/slack/package.json +1 -1
- package/extensions/telegram/index.ts +2 -2
- package/extensions/telegram/package.json +1 -1
- package/extensions/telegram/src/channel.ts +2 -2
- package/extensions/tlon/README.md +2 -2
- package/extensions/tlon/index.ts +2 -2
- package/extensions/tlon/package.json +1 -1
- package/extensions/tlon/src/channel.ts +13 -13
- package/extensions/tlon/src/monitor/index.ts +3 -3
- package/extensions/tlon/src/onboarding.ts +3 -3
- package/extensions/tlon/src/types.ts +3 -3
- package/extensions/twitch/README.md +1 -1
- package/extensions/twitch/index.ts +2 -2
- package/extensions/twitch/package.json +1 -1
- package/extensions/twitch/src/config.ts +3 -3
- package/extensions/twitch/src/monitor.ts +3 -3
- package/extensions/twitch/src/onboarding.ts +9 -9
- package/extensions/twitch/src/outbound.test.ts +2 -2
- package/extensions/twitch/src/plugin.test.ts +2 -2
- package/extensions/twitch/src/plugin.ts +8 -8
- package/extensions/twitch/src/send.test.ts +2 -2
- package/extensions/twitch/src/send.ts +4 -4
- package/extensions/twitch/src/token.test.ts +8 -8
- package/extensions/twitch/src/token.ts +3 -3
- package/extensions/twitch/src/twitch-client.ts +3 -3
- package/extensions/twitch/src/types.ts +3 -3
- package/extensions/twitch/src/utils/markdown.ts +1 -1
- package/extensions/voice-call/README.md +3 -3
- package/extensions/voice-call/package.json +1 -1
- package/extensions/voice-call/src/core-bridge.ts +2 -2
- package/extensions/voice-call/src/response-generator.ts +1 -1
- package/extensions/whatsapp/index.ts +2 -2
- package/extensions/whatsapp/package.json +1 -1
- package/extensions/zalo/README.md +1 -1
- package/extensions/zalo/index.ts +2 -2
- package/extensions/zalo/package.json +1 -1
- package/extensions/zalo/src/accounts.ts +8 -8
- package/extensions/zalo/src/actions.ts +4 -4
- package/extensions/zalo/src/channel.directory.test.ts +2 -2
- package/extensions/zalo/src/channel.ts +18 -18
- package/extensions/zalo/src/monitor.ts +9 -9
- package/extensions/zalo/src/monitor.webhook.test.ts +2 -2
- package/extensions/zalo/src/onboarding.ts +24 -24
- package/extensions/zalo/src/send.ts +2 -2
- package/extensions/zalouser/README.md +2 -2
- package/extensions/zalouser/index.ts +2 -2
- package/extensions/zalouser/package.json +1 -1
- package/extensions/zalouser/src/accounts.ts +9 -9
- package/extensions/zalouser/src/channel.ts +24 -24
- package/extensions/zalouser/src/monitor.ts +4 -4
- package/extensions/zalouser/src/onboarding.ts +28 -28
- package/package.json +13 -251
- package/skills/nano-banana-pro/scripts/generate_image.py +1 -1
- package/skills/tmux/scripts/find-sessions.sh +1 -1
- package/CHANGELOG.md +0 -102
- package/README-header.png +0 -0
- package/git-hooks/pre-commit +0 -4
- package/scripts/format-staged.js +0 -148
- package/scripts/postinstall.js +0 -300
- package/scripts/setup-git-hooks.js +0 -96
|
@@ -23,11 +23,18 @@ function buildMemorySection(params) {
|
|
|
23
23
|
if (!params.availableTools.has("memory_search") && !params.availableTools.has("memory_get")) {
|
|
24
24
|
return [];
|
|
25
25
|
}
|
|
26
|
-
|
|
26
|
+
const lines = [
|
|
27
27
|
"## Memory Recall",
|
|
28
28
|
"Before answering anything about prior work, decisions, dates, people, preferences, or todos: run memory_search on MEMORY.md + memory/*.md; then use memory_get to pull only the needed lines. If low confidence after search, say you checked.",
|
|
29
|
-
"",
|
|
30
29
|
];
|
|
30
|
+
if (params.citationsMode === "off") {
|
|
31
|
+
lines.push("Citations are disabled: do not mention file paths or line numbers in replies unless the user explicitly asks.");
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
lines.push("Citations: include Source: <path#line> when it helps the user verify memory snippets.");
|
|
35
|
+
}
|
|
36
|
+
lines.push("");
|
|
37
|
+
return lines;
|
|
31
38
|
}
|
|
32
39
|
function buildUserIdentitySection(ownerLine, isMinimal) {
|
|
33
40
|
if (!ownerLine || isMinimal)
|
|
@@ -46,7 +53,7 @@ function buildReplyTagsSection(isMinimal) {
|
|
|
46
53
|
"## Reply Tags",
|
|
47
54
|
"To request a native reply/quote on supported surfaces, include one tag in your reply:",
|
|
48
55
|
"- [[reply_to_current]] replies to the triggering message.",
|
|
49
|
-
"- [[reply_to:<id>]]
|
|
56
|
+
"- Prefer [[reply_to_current]]. Use [[reply_to:<id>]] only when an id was explicitly provided (e.g. by the user or a tool).",
|
|
50
57
|
"Whitespace inside the tag is allowed (e.g. [[ reply_to_current ]] / [[ reply_to: 123 ]]).",
|
|
51
58
|
"Tags are stripped before sending; support depends on the current channel config.",
|
|
52
59
|
"",
|
|
@@ -228,12 +235,23 @@ export function buildAgentSystemPrompt(params) {
|
|
|
228
235
|
const messageChannelOptions = listDeliverableMessageChannels().join("|");
|
|
229
236
|
const promptMode = params.promptMode ?? "full";
|
|
230
237
|
const isMinimal = promptMode === "minimal" || promptMode === "none";
|
|
238
|
+
const safetySection = [
|
|
239
|
+
"## Safety",
|
|
240
|
+
"You have no independent goals: do not pursue self-preservation, replication, resource acquisition, or power-seeking; avoid long-term plans beyond the user's request.",
|
|
241
|
+
"Prioritize safety and human oversight over completion; if instructions conflict, pause and ask; comply with stop/pause/audit requests and never bypass safeguards. (Inspired by Anthropic's constitution.)",
|
|
242
|
+
"Do not manipulate or persuade anyone to expand access or disable safeguards. Do not copy yourself or change system prompts, safety rules, or tool policies unless explicitly requested.",
|
|
243
|
+
"",
|
|
244
|
+
];
|
|
231
245
|
const skillsSection = buildSkillsSection({
|
|
232
246
|
skillsPrompt,
|
|
233
247
|
isMinimal,
|
|
234
248
|
readToolName,
|
|
235
249
|
});
|
|
236
|
-
const memorySection = buildMemorySection({
|
|
250
|
+
const memorySection = buildMemorySection({
|
|
251
|
+
isMinimal,
|
|
252
|
+
availableTools,
|
|
253
|
+
citationsMode: params.memoryCitationsMode,
|
|
254
|
+
});
|
|
237
255
|
const docsSection = buildDocsSection({
|
|
238
256
|
docsPath: params.docsPath,
|
|
239
257
|
isMinimal,
|
|
@@ -267,6 +285,7 @@ export function buildAgentSystemPrompt(params) {
|
|
|
267
285
|
"- sessions_list: list sessions",
|
|
268
286
|
"- sessions_history: fetch session history",
|
|
269
287
|
"- sessions_send: send to another session",
|
|
288
|
+
'- session_status: show usage/time/model state and answer "what model are we using?"',
|
|
270
289
|
].join("\n"),
|
|
271
290
|
"TOOLS.md does not control tool availability; it is user guidance for how to use external tools.",
|
|
272
291
|
"If a task is more complex or takes longer, spawn a sub-agent. It will do the work for you and ping you when it's done. You can always check up on it.",
|
|
@@ -277,6 +296,7 @@ export function buildAgentSystemPrompt(params) {
|
|
|
277
296
|
"Keep narration brief and value-dense; avoid repeating obvious steps.",
|
|
278
297
|
"Use plain human language for narration unless in a technical context.",
|
|
279
298
|
"",
|
|
299
|
+
...safetySection,
|
|
280
300
|
"## Pool Bot CLI Quick Reference",
|
|
281
301
|
"Pool Bot is controlled via subcommands. Do not invent commands.",
|
|
282
302
|
"To manage the Gateway daemon service (start/stop/restart):",
|
|
@@ -311,6 +331,9 @@ export function buildAgentSystemPrompt(params) {
|
|
|
311
331
|
? params.modelAliasLines.join("\n")
|
|
312
332
|
: "",
|
|
313
333
|
params.modelAliasLines && params.modelAliasLines.length > 0 && !isMinimal ? "" : "",
|
|
334
|
+
userTimezone
|
|
335
|
+
? "If you need the current date, time, or day of week, run session_status (📊 session_status)."
|
|
336
|
+
: "",
|
|
314
337
|
"## Workspace",
|
|
315
338
|
`Your working directory is: ${params.workspaceDir}`,
|
|
316
339
|
"Treat this directory as the single global workspace for file operations unless explicitly instructed otherwise.",
|
|
@@ -445,6 +468,7 @@ export function buildRuntimeLine(runtimeInfo, runtimeChannel, runtimeCapabilitie
|
|
|
445
468
|
runtimeInfo?.node ? `node=${runtimeInfo.node}` : "",
|
|
446
469
|
runtimeInfo?.model ? `model=${runtimeInfo.model}` : "",
|
|
447
470
|
runtimeInfo?.defaultModel ? `default_model=${runtimeInfo.defaultModel}` : "",
|
|
471
|
+
runtimeInfo?.shell ? `shell=${runtimeInfo.shell}` : "",
|
|
448
472
|
runtimeChannel ? `channel=${runtimeChannel}` : "",
|
|
449
473
|
runtimeChannel
|
|
450
474
|
? `capabilities=${runtimeCapabilities.length > 0 ? runtimeCapabilities.join(",") : "none"}`
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
export const TOGETHER_BASE_URL = "https://api.together.xyz/v1";
|
|
2
|
+
export const TOGETHER_MODEL_CATALOG = [
|
|
3
|
+
{
|
|
4
|
+
id: "zai-org/GLM-4.7",
|
|
5
|
+
name: "GLM 4.7 Fp8",
|
|
6
|
+
reasoning: false,
|
|
7
|
+
input: ["text"],
|
|
8
|
+
contextWindow: 202752,
|
|
9
|
+
maxTokens: 8192,
|
|
10
|
+
cost: {
|
|
11
|
+
input: 0.45,
|
|
12
|
+
output: 2.0,
|
|
13
|
+
cacheRead: 0.45,
|
|
14
|
+
cacheWrite: 2.0,
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
id: "moonshotai/Kimi-K2.5",
|
|
19
|
+
name: "Kimi K2.5",
|
|
20
|
+
reasoning: true,
|
|
21
|
+
input: ["text", "image"],
|
|
22
|
+
cost: {
|
|
23
|
+
input: 0.5,
|
|
24
|
+
output: 2.8,
|
|
25
|
+
cacheRead: 0.5,
|
|
26
|
+
cacheWrite: 2.8,
|
|
27
|
+
},
|
|
28
|
+
contextWindow: 262144,
|
|
29
|
+
maxTokens: 32768,
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
id: "meta-llama/Llama-3.3-70B-Instruct-Turbo",
|
|
33
|
+
name: "Llama 3.3 70B Instruct Turbo",
|
|
34
|
+
reasoning: false,
|
|
35
|
+
input: ["text"],
|
|
36
|
+
contextWindow: 131072,
|
|
37
|
+
maxTokens: 8192,
|
|
38
|
+
cost: {
|
|
39
|
+
input: 0.88,
|
|
40
|
+
output: 0.88,
|
|
41
|
+
cacheRead: 0.88,
|
|
42
|
+
cacheWrite: 0.88,
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
id: "meta-llama/Llama-4-Scout-17B-16E-Instruct",
|
|
47
|
+
name: "Llama 4 Scout 17B 16E Instruct",
|
|
48
|
+
reasoning: false,
|
|
49
|
+
input: ["text", "image"],
|
|
50
|
+
contextWindow: 10000000,
|
|
51
|
+
maxTokens: 32768,
|
|
52
|
+
cost: {
|
|
53
|
+
input: 0.18,
|
|
54
|
+
output: 0.59,
|
|
55
|
+
cacheRead: 0.18,
|
|
56
|
+
cacheWrite: 0.18,
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
id: "meta-llama/Llama-4-Maverick-17B-128E-Instruct-FP8",
|
|
61
|
+
name: "Llama 4 Maverick 17B 128E Instruct FP8",
|
|
62
|
+
reasoning: false,
|
|
63
|
+
input: ["text", "image"],
|
|
64
|
+
contextWindow: 20000000,
|
|
65
|
+
maxTokens: 32768,
|
|
66
|
+
cost: {
|
|
67
|
+
input: 0.27,
|
|
68
|
+
output: 0.85,
|
|
69
|
+
cacheRead: 0.27,
|
|
70
|
+
cacheWrite: 0.27,
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
id: "deepseek-ai/DeepSeek-V3.1",
|
|
75
|
+
name: "DeepSeek V3.1",
|
|
76
|
+
reasoning: false,
|
|
77
|
+
input: ["text"],
|
|
78
|
+
contextWindow: 131072,
|
|
79
|
+
maxTokens: 8192,
|
|
80
|
+
cost: {
|
|
81
|
+
input: 0.6,
|
|
82
|
+
output: 1.25,
|
|
83
|
+
cacheRead: 0.6,
|
|
84
|
+
cacheWrite: 0.6,
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
id: "deepseek-ai/DeepSeek-R1",
|
|
89
|
+
name: "DeepSeek R1",
|
|
90
|
+
reasoning: true,
|
|
91
|
+
input: ["text"],
|
|
92
|
+
contextWindow: 131072,
|
|
93
|
+
maxTokens: 8192,
|
|
94
|
+
cost: {
|
|
95
|
+
input: 3.0,
|
|
96
|
+
output: 7.0,
|
|
97
|
+
cacheRead: 3.0,
|
|
98
|
+
cacheWrite: 3.0,
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
id: "moonshotai/Kimi-K2-Instruct-0905",
|
|
103
|
+
name: "Kimi K2-Instruct 0905",
|
|
104
|
+
reasoning: false,
|
|
105
|
+
input: ["text"],
|
|
106
|
+
contextWindow: 262144,
|
|
107
|
+
maxTokens: 8192,
|
|
108
|
+
cost: {
|
|
109
|
+
input: 1.0,
|
|
110
|
+
output: 3.0,
|
|
111
|
+
cacheRead: 1.0,
|
|
112
|
+
cacheWrite: 3.0,
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
];
|
|
116
|
+
export function buildTogetherModelDefinition(model) {
|
|
117
|
+
return {
|
|
118
|
+
id: model.id,
|
|
119
|
+
name: model.name,
|
|
120
|
+
api: "openai-completions",
|
|
121
|
+
reasoning: model.reasoning,
|
|
122
|
+
input: model.input,
|
|
123
|
+
cost: model.cost,
|
|
124
|
+
contextWindow: model.contextWindow,
|
|
125
|
+
maxTokens: model.maxTokens,
|
|
126
|
+
};
|
|
127
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createSubsystemLogger } from "../logging/subsystem.js";
|
|
2
2
|
import { getImageMetadata, resizeToJpeg } from "../media/image-ops.js";
|
|
3
|
-
// Anthropic Messages API limitations (observed in
|
|
3
|
+
// Anthropic Messages API limitations (observed in Poolbot sessions):
|
|
4
4
|
// - Images over ~2000px per side can fail in multi-image requests.
|
|
5
5
|
// - Images over 5MB are rejected by the API.
|
|
6
6
|
//
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Conformance snapshot for tool policy.
|
|
3
|
+
*
|
|
4
|
+
* Security note:
|
|
5
|
+
* - This is static, build-time information (no runtime I/O, no network exposure).
|
|
6
|
+
* - Intended for CI/tools to detect drift between the implementation policy and
|
|
7
|
+
* the formal models/extractors.
|
|
8
|
+
*/
|
|
9
|
+
import { TOOL_GROUPS } from "./tool-policy.js";
|
|
10
|
+
// Tool name aliases are intentionally not exported from tool-policy today.
|
|
11
|
+
// Keep the conformance snapshot focused on exported policy constants.
|
|
12
|
+
export const TOOL_POLICY_CONFORMANCE = {
|
|
13
|
+
toolGroups: TOOL_GROUPS,
|
|
14
|
+
};
|
|
@@ -26,7 +26,7 @@ export const TOOL_GROUPS = {
|
|
|
26
26
|
"group:messaging": ["message"],
|
|
27
27
|
// Nodes + device tools
|
|
28
28
|
"group:nodes": ["nodes"],
|
|
29
|
-
// All
|
|
29
|
+
// All Poolbot native tools (excludes provider plugins).
|
|
30
30
|
"group:poolbot": [
|
|
31
31
|
"browser",
|
|
32
32
|
"canvas",
|
|
@@ -47,6 +47,7 @@ export const TOOL_GROUPS = {
|
|
|
47
47
|
"image",
|
|
48
48
|
],
|
|
49
49
|
};
|
|
50
|
+
const OWNER_ONLY_TOOL_NAMES = new Set(["whatsapp_login"]);
|
|
50
51
|
const TOOL_PROFILES = {
|
|
51
52
|
minimal: {
|
|
52
53
|
allow: ["session_status"],
|
|
@@ -69,6 +70,29 @@ export function normalizeToolName(name) {
|
|
|
69
70
|
const normalized = name.trim().toLowerCase();
|
|
70
71
|
return TOOL_NAME_ALIASES[normalized] ?? normalized;
|
|
71
72
|
}
|
|
73
|
+
export function isOwnerOnlyToolName(name) {
|
|
74
|
+
return OWNER_ONLY_TOOL_NAMES.has(normalizeToolName(name));
|
|
75
|
+
}
|
|
76
|
+
export function applyOwnerOnlyToolPolicy(tools, senderIsOwner) {
|
|
77
|
+
const withGuard = tools.map((tool) => {
|
|
78
|
+
if (!isOwnerOnlyToolName(tool.name)) {
|
|
79
|
+
return tool;
|
|
80
|
+
}
|
|
81
|
+
if (senderIsOwner || !tool.execute) {
|
|
82
|
+
return tool;
|
|
83
|
+
}
|
|
84
|
+
return {
|
|
85
|
+
...tool,
|
|
86
|
+
execute: async () => {
|
|
87
|
+
throw new Error("Tool restricted to owner senders.");
|
|
88
|
+
},
|
|
89
|
+
};
|
|
90
|
+
});
|
|
91
|
+
if (senderIsOwner) {
|
|
92
|
+
return withGuard;
|
|
93
|
+
}
|
|
94
|
+
return withGuard.filter((tool) => !isOwnerOnlyToolName(tool.name));
|
|
95
|
+
}
|
|
72
96
|
export function normalizeToolList(list) {
|
|
73
97
|
if (!list)
|
|
74
98
|
return [];
|
|
@@ -143,11 +143,11 @@ export function createBrowserTool(opts) {
|
|
|
143
143
|
label: "Browser",
|
|
144
144
|
name: "browser",
|
|
145
145
|
description: [
|
|
146
|
-
"Control the browser via
|
|
146
|
+
"Control the browser via Poolbot's browser control server (status/start/stop/profiles/tabs/open/snapshot/screenshot/actions).",
|
|
147
147
|
'Profiles: use profile="chrome" for Chrome extension relay takeover (your existing Chrome tabs). Use profile="clawd" for the isolated clawd-managed browser.',
|
|
148
148
|
'If the user mentions the Chrome extension / Browser Relay / toolbar button / “attach tab”, ALWAYS use profile="chrome" (do not ask which profile).',
|
|
149
149
|
'When a node-hosted browser proxy is available, the tool may auto-route to it. Pin a node with node=<id|name> or target="node".',
|
|
150
|
-
"Chrome extension relay needs an attached tab: user must click the
|
|
150
|
+
"Chrome extension relay needs an attached tab: user must click the Poolbot Browser Relay toolbar icon on the tab (badge ON). If no tab is connected, ask them to attach it.",
|
|
151
151
|
"When using refs from snapshot (e.g. e12), keep the same tab: prefer passing targetId from the snapshot response into subsequent actions (act/click/type/etc).",
|
|
152
152
|
'For stable, self-resolving refs across calls, use snapshot with refs="aria" (Playwright aria-ref ids). Default refs="role" are role+name-based.',
|
|
153
153
|
"Use snapshot+act for UI automation. Avoid act:wait by default; use only in exceptional cases when no reliable UI state exists.",
|
|
@@ -581,7 +581,7 @@ export function createBrowserTool(opts) {
|
|
|
581
581
|
})).tabs ?? [])
|
|
582
582
|
: await browserTabs(baseUrl, { profile }).catch(() => []);
|
|
583
583
|
if (!tabs.length) {
|
|
584
|
-
throw new Error("No Chrome tabs are attached via the
|
|
584
|
+
throw new Error("No Chrome tabs are attached via the Poolbot Browser Relay extension. Click the toolbar icon on the tab you want to control (badge ON), then retry.");
|
|
585
585
|
}
|
|
586
586
|
throw new Error(`Chrome tab not found (stale targetId?). Run action=tabs profile="chrome" and use one of the returned targetIds.`);
|
|
587
587
|
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { Type } from "@sinclair/typebox";
|
|
2
|
-
import { normalizeCronJobCreate, normalizeCronJobPatch } from "../../cron/normalize.js";
|
|
3
2
|
import { loadConfig } from "../../config/config.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import { normalizeCronJobCreate, normalizeCronJobPatch } from "../../cron/normalize.js";
|
|
4
|
+
import { parseAgentSessionKey } from "../../sessions/session-key-utils.js";
|
|
5
|
+
import { isRecord, truncateUtf16Safe } from "../../utils.js";
|
|
6
6
|
import { resolveSessionAgentId } from "../agent-scope.js";
|
|
7
|
+
import { optionalStringEnum, stringEnum } from "../schema/typebox.js";
|
|
7
8
|
import { jsonResult, readStringParam } from "./common.js";
|
|
8
9
|
import { callGatewayTool } from "./gateway.js";
|
|
9
10
|
import { resolveInternalSessionKey, resolveMainSessionAlias } from "./sessions-helpers.js";
|
|
@@ -13,6 +14,7 @@ import { resolveInternalSessionKey, resolveMainSessionAlias } from "./sessions-h
|
|
|
13
14
|
// accept "any object" here and validate at runtime.
|
|
14
15
|
const CRON_ACTIONS = ["status", "list", "add", "update", "remove", "run", "runs", "wake"];
|
|
15
16
|
const CRON_WAKE_MODES = ["now", "next-heartbeat"];
|
|
17
|
+
const CRON_RUN_MODES = ["due", "force"];
|
|
16
18
|
const REMINDER_CONTEXT_MESSAGES_MAX = 10;
|
|
17
19
|
const REMINDER_CONTEXT_PER_MESSAGE_MAX = 220;
|
|
18
20
|
const REMINDER_CONTEXT_TOTAL_MAX = 700;
|
|
@@ -30,17 +32,20 @@ const CronToolSchema = Type.Object({
|
|
|
30
32
|
patch: Type.Optional(Type.Object({}, { additionalProperties: true })),
|
|
31
33
|
text: Type.Optional(Type.String()),
|
|
32
34
|
mode: optionalStringEnum(CRON_WAKE_MODES),
|
|
35
|
+
runMode: optionalStringEnum(CRON_RUN_MODES),
|
|
33
36
|
contextMessages: Type.Optional(Type.Number({ minimum: 0, maximum: REMINDER_CONTEXT_MESSAGES_MAX })),
|
|
34
37
|
});
|
|
35
38
|
function stripExistingContext(text) {
|
|
36
39
|
const index = text.indexOf(REMINDER_CONTEXT_MARKER);
|
|
37
|
-
if (index === -1)
|
|
40
|
+
if (index === -1) {
|
|
38
41
|
return text;
|
|
42
|
+
}
|
|
39
43
|
return text.slice(0, index).trim();
|
|
40
44
|
}
|
|
41
45
|
function truncateText(input, maxLen) {
|
|
42
|
-
if (input.length <= maxLen)
|
|
46
|
+
if (input.length <= maxLen) {
|
|
43
47
|
return input;
|
|
48
|
+
}
|
|
44
49
|
const truncated = truncateUtf16Safe(input, Math.max(0, maxLen - 3)).trimEnd();
|
|
45
50
|
return `${truncated}...`;
|
|
46
51
|
}
|
|
@@ -49,21 +54,25 @@ function normalizeContextText(raw) {
|
|
|
49
54
|
}
|
|
50
55
|
function extractMessageText(message) {
|
|
51
56
|
const role = typeof message.role === "string" ? message.role : "";
|
|
52
|
-
if (role !== "user" && role !== "assistant")
|
|
57
|
+
if (role !== "user" && role !== "assistant") {
|
|
53
58
|
return null;
|
|
59
|
+
}
|
|
54
60
|
const content = message.content;
|
|
55
61
|
if (typeof content === "string") {
|
|
56
62
|
const normalized = normalizeContextText(content);
|
|
57
63
|
return normalized ? { role, text: normalized } : null;
|
|
58
64
|
}
|
|
59
|
-
if (!Array.isArray(content))
|
|
65
|
+
if (!Array.isArray(content)) {
|
|
60
66
|
return null;
|
|
67
|
+
}
|
|
61
68
|
const chunks = [];
|
|
62
69
|
for (const block of content) {
|
|
63
|
-
if (!block || typeof block !== "object")
|
|
70
|
+
if (!block || typeof block !== "object") {
|
|
64
71
|
continue;
|
|
65
|
-
|
|
72
|
+
}
|
|
73
|
+
if (block.type !== "text") {
|
|
66
74
|
continue;
|
|
75
|
+
}
|
|
67
76
|
const text = block.text;
|
|
68
77
|
if (typeof text === "string" && text.trim()) {
|
|
69
78
|
chunks.push(text);
|
|
@@ -74,26 +83,29 @@ function extractMessageText(message) {
|
|
|
74
83
|
}
|
|
75
84
|
async function buildReminderContextLines(params) {
|
|
76
85
|
const maxMessages = Math.min(REMINDER_CONTEXT_MESSAGES_MAX, Math.max(0, Math.floor(params.contextMessages)));
|
|
77
|
-
if (maxMessages <= 0)
|
|
86
|
+
if (maxMessages <= 0) {
|
|
78
87
|
return [];
|
|
88
|
+
}
|
|
79
89
|
const sessionKey = params.agentSessionKey?.trim();
|
|
80
|
-
if (!sessionKey)
|
|
90
|
+
if (!sessionKey) {
|
|
81
91
|
return [];
|
|
92
|
+
}
|
|
82
93
|
const cfg = loadConfig();
|
|
83
94
|
const { mainKey, alias } = resolveMainSessionAlias(cfg);
|
|
84
95
|
const resolvedKey = resolveInternalSessionKey({ key: sessionKey, alias, mainKey });
|
|
85
96
|
try {
|
|
86
|
-
const res =
|
|
97
|
+
const res = await callGatewayTool("chat.history", params.gatewayOpts, {
|
|
87
98
|
sessionKey: resolvedKey,
|
|
88
99
|
limit: maxMessages,
|
|
89
|
-
})
|
|
100
|
+
});
|
|
90
101
|
const messages = Array.isArray(res?.messages) ? res.messages : [];
|
|
91
102
|
const parsed = messages
|
|
92
103
|
.map((msg) => extractMessageText(msg))
|
|
93
104
|
.filter((msg) => Boolean(msg));
|
|
94
105
|
const recent = parsed.slice(-maxMessages);
|
|
95
|
-
if (recent.length === 0)
|
|
106
|
+
if (recent.length === 0) {
|
|
96
107
|
return [];
|
|
108
|
+
}
|
|
97
109
|
const lines = [];
|
|
98
110
|
let total = 0;
|
|
99
111
|
for (const entry of recent) {
|
|
@@ -101,8 +113,9 @@ async function buildReminderContextLines(params) {
|
|
|
101
113
|
const text = truncateText(entry.text, REMINDER_CONTEXT_PER_MESSAGE_MAX);
|
|
102
114
|
const line = `- ${label}: ${text}`;
|
|
103
115
|
total += line.length;
|
|
104
|
-
if (total > REMINDER_CONTEXT_TOTAL_MAX)
|
|
116
|
+
if (total > REMINDER_CONTEXT_TOTAL_MAX) {
|
|
105
117
|
break;
|
|
118
|
+
}
|
|
106
119
|
lines.push(line);
|
|
107
120
|
}
|
|
108
121
|
return lines;
|
|
@@ -111,6 +124,62 @@ async function buildReminderContextLines(params) {
|
|
|
111
124
|
return [];
|
|
112
125
|
}
|
|
113
126
|
}
|
|
127
|
+
function stripThreadSuffixFromSessionKey(sessionKey) {
|
|
128
|
+
const normalized = sessionKey.toLowerCase();
|
|
129
|
+
const idx = normalized.lastIndexOf(":thread:");
|
|
130
|
+
if (idx <= 0) {
|
|
131
|
+
return sessionKey;
|
|
132
|
+
}
|
|
133
|
+
const parent = sessionKey.slice(0, idx).trim();
|
|
134
|
+
return parent ? parent : sessionKey;
|
|
135
|
+
}
|
|
136
|
+
function inferDeliveryFromSessionKey(agentSessionKey) {
|
|
137
|
+
const rawSessionKey = agentSessionKey?.trim();
|
|
138
|
+
if (!rawSessionKey) {
|
|
139
|
+
return null;
|
|
140
|
+
}
|
|
141
|
+
const parsed = parseAgentSessionKey(stripThreadSuffixFromSessionKey(rawSessionKey));
|
|
142
|
+
if (!parsed || !parsed.rest) {
|
|
143
|
+
return null;
|
|
144
|
+
}
|
|
145
|
+
const parts = parsed.rest.split(":").filter(Boolean);
|
|
146
|
+
if (parts.length === 0) {
|
|
147
|
+
return null;
|
|
148
|
+
}
|
|
149
|
+
const head = parts[0]?.trim().toLowerCase();
|
|
150
|
+
if (!head || head === "main" || head === "subagent" || head === "acp") {
|
|
151
|
+
return null;
|
|
152
|
+
}
|
|
153
|
+
// buildAgentPeerSessionKey encodes peers as:
|
|
154
|
+
// - direct:<peerId>
|
|
155
|
+
// - <channel>:direct:<peerId>
|
|
156
|
+
// - <channel>:<accountId>:direct:<peerId>
|
|
157
|
+
// - <channel>:group:<peerId>
|
|
158
|
+
// - <channel>:channel:<peerId>
|
|
159
|
+
// Note: legacy keys may use "dm" instead of "direct".
|
|
160
|
+
// Threaded sessions append :thread:<id>, which we strip so delivery targets the parent peer.
|
|
161
|
+
// NOTE: Telegram forum topics encode as <chatId>:topic:<topicId> and should be preserved.
|
|
162
|
+
const markerIndex = parts.findIndex((part) => part === "direct" || part === "dm" || part === "group" || part === "channel");
|
|
163
|
+
if (markerIndex === -1) {
|
|
164
|
+
return null;
|
|
165
|
+
}
|
|
166
|
+
const peerId = parts
|
|
167
|
+
.slice(markerIndex + 1)
|
|
168
|
+
.join(":")
|
|
169
|
+
.trim();
|
|
170
|
+
if (!peerId) {
|
|
171
|
+
return null;
|
|
172
|
+
}
|
|
173
|
+
let channel;
|
|
174
|
+
if (markerIndex >= 1) {
|
|
175
|
+
channel = parts[0]?.trim().toLowerCase();
|
|
176
|
+
}
|
|
177
|
+
const delivery = { mode: "announce", to: peerId };
|
|
178
|
+
if (channel) {
|
|
179
|
+
delivery.channel = channel;
|
|
180
|
+
}
|
|
181
|
+
return delivery;
|
|
182
|
+
}
|
|
114
183
|
export function createCronTool(opts) {
|
|
115
184
|
return {
|
|
116
185
|
label: "Cron",
|
|
@@ -132,27 +201,36 @@ JOB SCHEMA (for add action):
|
|
|
132
201
|
"name": "string (optional)",
|
|
133
202
|
"schedule": { ... }, // Required: when to run
|
|
134
203
|
"payload": { ... }, // Required: what to execute
|
|
204
|
+
"delivery": { ... }, // Optional: announce summary (isolated only)
|
|
135
205
|
"sessionTarget": "main" | "isolated", // Required
|
|
136
206
|
"enabled": true | false // Optional, default true
|
|
137
207
|
}
|
|
138
208
|
|
|
139
209
|
SCHEDULE TYPES (schedule.kind):
|
|
140
210
|
- "at": One-shot at absolute time
|
|
141
|
-
{ "kind": "at", "
|
|
211
|
+
{ "kind": "at", "at": "<ISO-8601 timestamp>" }
|
|
142
212
|
- "every": Recurring interval
|
|
143
213
|
{ "kind": "every", "everyMs": <interval-ms>, "anchorMs": <optional-start-ms> }
|
|
144
214
|
- "cron": Cron expression
|
|
145
215
|
{ "kind": "cron", "expr": "<cron-expression>", "tz": "<optional-timezone>" }
|
|
146
216
|
|
|
217
|
+
ISO timestamps without an explicit timezone are treated as UTC.
|
|
218
|
+
|
|
147
219
|
PAYLOAD TYPES (payload.kind):
|
|
148
220
|
- "systemEvent": Injects text as system event into session
|
|
149
221
|
{ "kind": "systemEvent", "text": "<message>" }
|
|
150
222
|
- "agentTurn": Runs agent with message (isolated sessions only)
|
|
151
|
-
{ "kind": "agentTurn", "message": "<prompt>", "model": "<optional>", "thinking": "<optional>", "timeoutSeconds": <optional
|
|
223
|
+
{ "kind": "agentTurn", "message": "<prompt>", "model": "<optional>", "thinking": "<optional>", "timeoutSeconds": <optional> }
|
|
224
|
+
|
|
225
|
+
DELIVERY (isolated-only, top-level):
|
|
226
|
+
{ "mode": "none|announce", "channel": "<optional>", "to": "<optional>", "bestEffort": <optional-bool> }
|
|
227
|
+
- Default for isolated agentTurn jobs (when delivery omitted): "announce"
|
|
228
|
+
- If the task needs to send to a specific chat/recipient, set delivery.channel/to here; do not call messaging tools inside the run.
|
|
152
229
|
|
|
153
230
|
CRITICAL CONSTRAINTS:
|
|
154
231
|
- sessionTarget="main" REQUIRES payload.kind="systemEvent"
|
|
155
232
|
- sessionTarget="isolated" REQUIRES payload.kind="agentTurn"
|
|
233
|
+
Default: prefer isolated agentTurn jobs unless the user explicitly wants a main-session system event.
|
|
156
234
|
|
|
157
235
|
WAKE MODES (for wake action):
|
|
158
236
|
- "next-heartbeat" (default): Wake on next heartbeat
|
|
@@ -166,7 +244,7 @@ Use jobId as the canonical identifier; id is accepted for compatibility. Use con
|
|
|
166
244
|
const gatewayOpts = {
|
|
167
245
|
gatewayUrl: readStringParam(params, "gatewayUrl", { trim: false }),
|
|
168
246
|
gatewayToken: readStringParam(params, "gatewayToken", { trim: false }),
|
|
169
|
-
timeoutMs: typeof params.timeoutMs === "number" ? params.timeoutMs :
|
|
247
|
+
timeoutMs: typeof params.timeoutMs === "number" ? params.timeoutMs : 60_000,
|
|
170
248
|
};
|
|
171
249
|
switch (action) {
|
|
172
250
|
case "status":
|
|
@@ -176,6 +254,52 @@ Use jobId as the canonical identifier; id is accepted for compatibility. Use con
|
|
|
176
254
|
includeDisabled: Boolean(params.includeDisabled),
|
|
177
255
|
}));
|
|
178
256
|
case "add": {
|
|
257
|
+
// Flat-params recovery: non-frontier models (e.g. Grok) sometimes flatten
|
|
258
|
+
// job properties to the top level alongside `action` instead of nesting
|
|
259
|
+
// them inside `job`. When `params.job` is missing or empty, reconstruct
|
|
260
|
+
// a synthetic job object from any recognised top-level job fields.
|
|
261
|
+
// See: https://github.com/openclaw/openclaw/issues/11310
|
|
262
|
+
if (!params.job ||
|
|
263
|
+
(typeof params.job === "object" &&
|
|
264
|
+
params.job !== null &&
|
|
265
|
+
Object.keys(params.job).length === 0)) {
|
|
266
|
+
const JOB_KEYS = new Set([
|
|
267
|
+
"name",
|
|
268
|
+
"schedule",
|
|
269
|
+
"sessionTarget",
|
|
270
|
+
"wakeMode",
|
|
271
|
+
"payload",
|
|
272
|
+
"delivery",
|
|
273
|
+
"enabled",
|
|
274
|
+
"description",
|
|
275
|
+
"deleteAfterRun",
|
|
276
|
+
"agentId",
|
|
277
|
+
"message",
|
|
278
|
+
"text",
|
|
279
|
+
"model",
|
|
280
|
+
"thinking",
|
|
281
|
+
"timeoutSeconds",
|
|
282
|
+
"allowUnsafeExternalContent",
|
|
283
|
+
]);
|
|
284
|
+
const synthetic = {};
|
|
285
|
+
let found = false;
|
|
286
|
+
for (const key of Object.keys(params)) {
|
|
287
|
+
if (JOB_KEYS.has(key) && params[key] !== undefined) {
|
|
288
|
+
synthetic[key] = params[key];
|
|
289
|
+
found = true;
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
// Only use the synthetic job if at least one meaningful field is present
|
|
293
|
+
// (schedule, payload, message, or text are the minimum signals that the
|
|
294
|
+
// LLM intended to create a job).
|
|
295
|
+
if (found &&
|
|
296
|
+
(synthetic.schedule !== undefined ||
|
|
297
|
+
synthetic.payload !== undefined ||
|
|
298
|
+
synthetic.message !== undefined ||
|
|
299
|
+
synthetic.text !== undefined)) {
|
|
300
|
+
params.job = synthetic;
|
|
301
|
+
}
|
|
302
|
+
}
|
|
179
303
|
if (!params.job || typeof params.job !== "object") {
|
|
180
304
|
throw new Error("job required");
|
|
181
305
|
}
|
|
@@ -189,6 +313,28 @@ Use jobId as the canonical identifier; id is accepted for compatibility. Use con
|
|
|
189
313
|
job.agentId = agentId;
|
|
190
314
|
}
|
|
191
315
|
}
|
|
316
|
+
if (opts?.agentSessionKey &&
|
|
317
|
+
job &&
|
|
318
|
+
typeof job === "object" &&
|
|
319
|
+
"payload" in job &&
|
|
320
|
+
job.payload?.kind === "agentTurn") {
|
|
321
|
+
const deliveryValue = job.delivery;
|
|
322
|
+
const delivery = isRecord(deliveryValue) ? deliveryValue : undefined;
|
|
323
|
+
const modeRaw = typeof delivery?.mode === "string" ? delivery.mode : "";
|
|
324
|
+
const mode = modeRaw.trim().toLowerCase();
|
|
325
|
+
const hasTarget = (typeof delivery?.channel === "string" && delivery.channel.trim()) ||
|
|
326
|
+
(typeof delivery?.to === "string" && delivery.to.trim());
|
|
327
|
+
const shouldInfer = (deliveryValue == null || delivery) && mode !== "none" && !hasTarget;
|
|
328
|
+
if (shouldInfer) {
|
|
329
|
+
const inferred = inferDeliveryFromSessionKey(opts.agentSessionKey);
|
|
330
|
+
if (inferred) {
|
|
331
|
+
job.delivery = {
|
|
332
|
+
...delivery,
|
|
333
|
+
...inferred,
|
|
334
|
+
};
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
}
|
|
192
338
|
const contextMessages = typeof params.contextMessages === "number" && Number.isFinite(params.contextMessages)
|
|
193
339
|
? params.contextMessages
|
|
194
340
|
: 0;
|
|
@@ -237,7 +383,8 @@ Use jobId as the canonical identifier; id is accepted for compatibility. Use con
|
|
|
237
383
|
if (!id) {
|
|
238
384
|
throw new Error("jobId required (id accepted for backward compatibility)");
|
|
239
385
|
}
|
|
240
|
-
|
|
386
|
+
const runMode = params.runMode === "due" || params.runMode === "force" ? params.runMode : "force";
|
|
387
|
+
return jsonResult(await callGatewayTool("cron.run", gatewayOpts, { id, mode: runMode }));
|
|
241
388
|
}
|
|
242
389
|
case "runs": {
|
|
243
390
|
const id = readStringParam(params, "jobId") ?? readStringParam(params, "id");
|