@poolzin/pool-bot 2026.1.39 → 2026.2.0
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/cli-runner/helpers.js +1 -1
- 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/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 +10 -4
- package/dist/agents/models-config.js +3 -3
- package/dist/agents/models-config.providers.js +147 -39
- package/dist/agents/pi-embedded-helpers/openai.js +1 -1
- package/dist/agents/pi-embedded-runner/compact.js +8 -8
- package/dist/agents/pi-embedded-runner/model.js +2 -2
- package/dist/agents/pi-embedded-runner/run/attempt.js +6 -6
- package/dist/agents/pi-embedded-runner/run.js +4 -4
- 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-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 +10 -5
- package/dist/agents/pi-tools.read.js +2 -2
- package/dist/agents/session-file-repair.js +83 -0
- package/dist/agents/session-transcript-repair.js +68 -0
- package/dist/agents/skills/frontmatter.js +1 -1
- package/dist/agents/skills/workspace.js +2 -2
- 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.js +1 -1
- package/dist/agents/tools/browser-tool.js +3 -3
- package/dist/agents/tools/image-tool.js +2 -2
- package/dist/agents/tools/memory-tool.js +93 -5
- package/dist/agents/tools/web-search.js +1 -1
- package/dist/auto-reply/commands-registry.data.js +1 -1
- package/dist/auto-reply/reply/commands-context-report.js +2 -2
- package/dist/auto-reply/reply/commands-session.js +2 -2
- package/dist/auto-reply/reply/get-reply-run.js +14 -4
- package/dist/auto-reply/reply/groups.js +1 -1
- package/dist/auto-reply/reply/inbound-context.js +4 -0
- package/dist/auto-reply/reply/inbound-meta.js +130 -0
- package/dist/auto-reply/reply/untrusted-context.js +15 -0
- package/dist/auto-reply/status.js +1 -1
- package/dist/browser/client-fetch.js +1 -1
- package/dist/browser/config.js +1 -1
- package/dist/browser/extension-relay.js +3 -3
- package/dist/browser/server-context.js +2 -2
- 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/cli/browser-cli-extension.js +2 -2
- package/dist/cli/docs-cli.js +1 -1
- package/dist/cli/gateway-cli/dev.js +1 -1
- package/dist/cli/memory-cli.js +25 -15
- package/dist/cli/nodes-cli/register.canvas.js +1 -1
- 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 +4 -4
- package/dist/cli/webhooks-cli.js +5 -5
- 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-gateway-services.js +3 -3
- package/dist/commands/doctor-update.js +3 -3
- package/dist/commands/doctor.js +1 -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 +2 -2
- 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-non-interactive/local/auth-choice.js +140 -6
- 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/io.js +3 -3
- package/dist/config/schema.js +1 -1
- package/dist/config/types.memory.js +1 -0
- package/dist/config/version.js +4 -4
- package/dist/daemon/constants.js +7 -7
- package/dist/daemon/inspect.js +6 -6
- package/dist/daemon/systemd-unit.js +1 -1
- package/dist/gateway/live-image-probe.js +1 -66
- package/dist/gateway/openai-http.js +2 -2
- package/dist/gateway/openresponses-http.js +4 -4
- package/dist/gateway/server-discovery.js +2 -2
- package/dist/gateway/server-http.js +1 -1
- package/dist/gateway/server.impl.js +2 -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/index.js +2 -2
- package/dist/infra/bonjour.js +3 -3
- package/dist/infra/path-env.js +3 -3
- package/dist/infra/provider-usage.fetch.minimax.js +1 -1
- package/dist/infra/restart.js +1 -1
- package/dist/infra/tailscale.js +1 -1
- package/dist/macos/relay.js +2 -2
- 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/providers/image.js +2 -2
- package/dist/memory/backend-config.js +207 -0
- package/dist/memory/embeddings.js +1 -1
- package/dist/memory/manager.js +1 -0
- package/dist/memory/types.js +1 -0
- package/dist/node-host/runner.js +2 -2
- package/dist/pairing/pairing-messages.js +1 -1
- package/dist/plugins/discovery.js +1 -1
- package/dist/plugins/install.js +2 -2
- package/dist/plugins/update.js +1 -1
- package/dist/security/audit.js +2 -2
- package/dist/shared/text/reasoning-tags.js +52 -7
- package/dist/tailscale/detect.js +146 -0
- package/dist/telegram/bot-message-context.js +1 -1
- 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/utils/shell-argv.js +61 -0
- package/dist/utils.js +10 -0
- 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
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
const TOOL_CALL_TYPES = new Set(["toolCall", "toolUse", "functionCall"]);
|
|
1
2
|
function extractToolCallsFromAssistant(msg) {
|
|
2
3
|
const content = msg.content;
|
|
3
4
|
if (!Array.isArray(content))
|
|
@@ -18,6 +19,18 @@ function extractToolCallsFromAssistant(msg) {
|
|
|
18
19
|
}
|
|
19
20
|
return toolCalls;
|
|
20
21
|
}
|
|
22
|
+
function isToolCallBlock(block) {
|
|
23
|
+
if (!block || typeof block !== "object") {
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
const type = block.type;
|
|
27
|
+
return typeof type === "string" && TOOL_CALL_TYPES.has(type);
|
|
28
|
+
}
|
|
29
|
+
function hasToolCallInput(block) {
|
|
30
|
+
const hasInput = "input" in block ? block.input !== undefined && block.input !== null : false;
|
|
31
|
+
const hasArguments = "arguments" in block ? block.arguments !== undefined && block.arguments !== null : false;
|
|
32
|
+
return hasInput || hasArguments;
|
|
33
|
+
}
|
|
21
34
|
function extractToolResultId(msg) {
|
|
22
35
|
const toolCallId = msg.toolCallId;
|
|
23
36
|
if (typeof toolCallId === "string" && toolCallId)
|
|
@@ -43,6 +56,51 @@ function makeMissingToolResult(params) {
|
|
|
43
56
|
};
|
|
44
57
|
}
|
|
45
58
|
export { makeMissingToolResult };
|
|
59
|
+
export function repairToolCallInputs(messages) {
|
|
60
|
+
let droppedToolCalls = 0;
|
|
61
|
+
let droppedAssistantMessages = 0;
|
|
62
|
+
let changed = false;
|
|
63
|
+
const out = [];
|
|
64
|
+
for (const msg of messages) {
|
|
65
|
+
if (!msg || typeof msg !== "object") {
|
|
66
|
+
out.push(msg);
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
69
|
+
if (msg.role !== "assistant" || !Array.isArray(msg.content)) {
|
|
70
|
+
out.push(msg);
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
const nextContent = [];
|
|
74
|
+
let droppedInMessage = 0;
|
|
75
|
+
for (const block of msg.content) {
|
|
76
|
+
if (isToolCallBlock(block) && !hasToolCallInput(block)) {
|
|
77
|
+
droppedToolCalls += 1;
|
|
78
|
+
droppedInMessage += 1;
|
|
79
|
+
changed = true;
|
|
80
|
+
continue;
|
|
81
|
+
}
|
|
82
|
+
nextContent.push(block);
|
|
83
|
+
}
|
|
84
|
+
if (droppedInMessage > 0) {
|
|
85
|
+
if (nextContent.length === 0) {
|
|
86
|
+
droppedAssistantMessages += 1;
|
|
87
|
+
changed = true;
|
|
88
|
+
continue;
|
|
89
|
+
}
|
|
90
|
+
out.push({ ...msg, content: nextContent });
|
|
91
|
+
continue;
|
|
92
|
+
}
|
|
93
|
+
out.push(msg);
|
|
94
|
+
}
|
|
95
|
+
return {
|
|
96
|
+
messages: changed ? out : messages,
|
|
97
|
+
droppedToolCalls,
|
|
98
|
+
droppedAssistantMessages,
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
export function sanitizeToolCallInputs(messages) {
|
|
102
|
+
return repairToolCallInputs(messages).messages;
|
|
103
|
+
}
|
|
46
104
|
export function sanitizeToolUseResultPairing(messages) {
|
|
47
105
|
return repairToolUseResultPairing(messages).messages;
|
|
48
106
|
}
|
|
@@ -92,6 +150,16 @@ export function repairToolUseResultPairing(messages) {
|
|
|
92
150
|
continue;
|
|
93
151
|
}
|
|
94
152
|
const assistant = msg;
|
|
153
|
+
// Skip tool call extraction for aborted or errored assistant messages.
|
|
154
|
+
// When stopReason is "error" or "aborted", the tool_use blocks may be incomplete
|
|
155
|
+
// (e.g., partialJson: true) and should not have synthetic tool_results created.
|
|
156
|
+
// Creating synthetic results for incomplete tool calls causes API 400 errors:
|
|
157
|
+
// "unexpected tool_use_id found in tool_result blocks"
|
|
158
|
+
const stopReason = assistant.stopReason;
|
|
159
|
+
if (stopReason === "error" || stopReason === "aborted") {
|
|
160
|
+
out.push(msg);
|
|
161
|
+
continue;
|
|
162
|
+
}
|
|
95
163
|
const toolCalls = extractToolCallsFromAssistant(assistant);
|
|
96
164
|
if (toolCalls.length === 0) {
|
|
97
165
|
out.push(msg);
|
|
@@ -67,7 +67,7 @@ function parseFrontmatterBool(value, fallback) {
|
|
|
67
67
|
const parsed = parseBooleanValue(value);
|
|
68
68
|
return parsed === undefined ? fallback : parsed;
|
|
69
69
|
}
|
|
70
|
-
export function
|
|
70
|
+
export function resolvePoolbotMetadata(frontmatter) {
|
|
71
71
|
const raw = getFrontmatterValue(frontmatter, "metadata");
|
|
72
72
|
if (!raw)
|
|
73
73
|
return undefined;
|
|
@@ -5,7 +5,7 @@ import { createSubsystemLogger } from "../../logging/subsystem.js";
|
|
|
5
5
|
import { CONFIG_DIR, resolveUserPath } from "../../utils.js";
|
|
6
6
|
import { resolveBundledSkillsDir } from "./bundled-dir.js";
|
|
7
7
|
import { shouldIncludeSkill } from "./config.js";
|
|
8
|
-
import { parseFrontmatter,
|
|
8
|
+
import { parseFrontmatter, resolvePoolbotMetadata, resolveSkillInvocationPolicy, } from "./frontmatter.js";
|
|
9
9
|
import { resolvePluginSkillDirs } from "./plugin-skills.js";
|
|
10
10
|
import { serializeByKey } from "./serialize.js";
|
|
11
11
|
const fsp = fs.promises;
|
|
@@ -129,7 +129,7 @@ function loadSkillEntries(workspaceDir, opts) {
|
|
|
129
129
|
return {
|
|
130
130
|
skill,
|
|
131
131
|
frontmatter,
|
|
132
|
-
metadata:
|
|
132
|
+
metadata: resolvePoolbotMetadata(frontmatter),
|
|
133
133
|
invocation: resolveSkillInvocationPolicy(frontmatter),
|
|
134
134
|
};
|
|
135
135
|
});
|
|
@@ -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
|
//
|
|
@@ -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",
|
|
@@ -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
|
}
|
|
@@ -11,7 +11,7 @@ import { minimaxUnderstandImage } from "../minimax-vlm.js";
|
|
|
11
11
|
import { getApiKeyForModel, requireApiKey, resolveEnvApiKey } from "../model-auth.js";
|
|
12
12
|
import { runWithImageModelFallback } from "../model-fallback.js";
|
|
13
13
|
import { resolveConfiguredModelRef } from "../model-selection.js";
|
|
14
|
-
import {
|
|
14
|
+
import { ensurePoolbotModelsJson } from "../models-config.js";
|
|
15
15
|
import { assertSandboxPath } from "../sandbox-paths.js";
|
|
16
16
|
import { coerceImageAssistantText, coerceImageModelConfig, decodeDataUrl, resolveProviderVisionModelFromConfig, } from "./image-tool.helpers.js";
|
|
17
17
|
const DEFAULT_PROMPT = "Describe the image.";
|
|
@@ -187,7 +187,7 @@ async function runImagePrompt(params) {
|
|
|
187
187
|
},
|
|
188
188
|
}
|
|
189
189
|
: undefined;
|
|
190
|
-
await
|
|
190
|
+
await ensurePoolbotModelsJson(effectiveCfg, params.agentDir);
|
|
191
191
|
const authStorage = discoverAuthStorage(params.agentDir);
|
|
192
192
|
const modelRegistry = discoverModels(authStorage, params.agentDir);
|
|
193
193
|
const result = await runWithImageModelFallback({
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { Type } from "@sinclair/typebox";
|
|
2
|
+
import { resolveMemoryBackendConfig } from "../../memory/backend-config.js";
|
|
2
3
|
import { getMemorySearchManager } from "../../memory/index.js";
|
|
4
|
+
import { parseAgentSessionKey } from "../../routing/session-key.js";
|
|
3
5
|
import { resolveSessionAgentId } from "../agent-scope.js";
|
|
4
6
|
import { resolveMemorySearchConfig } from "../memory-search.js";
|
|
5
7
|
import { jsonResult, readNumberParam, readStringParam } from "./common.js";
|
|
@@ -15,14 +17,16 @@ const MemoryGetSchema = Type.Object({
|
|
|
15
17
|
});
|
|
16
18
|
export function createMemorySearchTool(options) {
|
|
17
19
|
const cfg = options.config;
|
|
18
|
-
if (!cfg)
|
|
20
|
+
if (!cfg) {
|
|
19
21
|
return null;
|
|
22
|
+
}
|
|
20
23
|
const agentId = resolveSessionAgentId({
|
|
21
24
|
sessionKey: options.agentSessionKey,
|
|
22
25
|
config: cfg,
|
|
23
26
|
});
|
|
24
|
-
if (!resolveMemorySearchConfig(cfg, agentId))
|
|
27
|
+
if (!resolveMemorySearchConfig(cfg, agentId)) {
|
|
25
28
|
return null;
|
|
29
|
+
}
|
|
26
30
|
return {
|
|
27
31
|
label: "Memory Search",
|
|
28
32
|
name: "memory_search",
|
|
@@ -40,17 +44,28 @@ export function createMemorySearchTool(options) {
|
|
|
40
44
|
return jsonResult({ results: [], disabled: true, error });
|
|
41
45
|
}
|
|
42
46
|
try {
|
|
43
|
-
const
|
|
47
|
+
const citationsMode = resolveMemoryCitationsMode(cfg);
|
|
48
|
+
const includeCitations = shouldIncludeCitations({
|
|
49
|
+
mode: citationsMode,
|
|
50
|
+
sessionKey: options.agentSessionKey,
|
|
51
|
+
});
|
|
52
|
+
const rawResults = await manager.search(query, {
|
|
44
53
|
maxResults,
|
|
45
54
|
minScore,
|
|
46
55
|
sessionKey: options.agentSessionKey,
|
|
47
56
|
});
|
|
48
57
|
const status = manager.status();
|
|
58
|
+
const decorated = decorateCitations(rawResults, includeCitations);
|
|
59
|
+
const resolved = resolveMemoryBackendConfig({ cfg, agentId });
|
|
60
|
+
const results = status.backend === "qmd"
|
|
61
|
+
? clampResultsByInjectedChars(decorated, resolved.qmd?.limits.maxInjectedChars)
|
|
62
|
+
: decorated;
|
|
49
63
|
return jsonResult({
|
|
50
64
|
results,
|
|
51
65
|
provider: status.provider,
|
|
52
66
|
model: status.model,
|
|
53
67
|
fallback: status.fallback,
|
|
68
|
+
citations: citationsMode,
|
|
54
69
|
});
|
|
55
70
|
}
|
|
56
71
|
catch (err) {
|
|
@@ -62,14 +77,16 @@ export function createMemorySearchTool(options) {
|
|
|
62
77
|
}
|
|
63
78
|
export function createMemoryGetTool(options) {
|
|
64
79
|
const cfg = options.config;
|
|
65
|
-
if (!cfg)
|
|
80
|
+
if (!cfg) {
|
|
66
81
|
return null;
|
|
82
|
+
}
|
|
67
83
|
const agentId = resolveSessionAgentId({
|
|
68
84
|
sessionKey: options.agentSessionKey,
|
|
69
85
|
config: cfg,
|
|
70
86
|
});
|
|
71
|
-
if (!resolveMemorySearchConfig(cfg, agentId))
|
|
87
|
+
if (!resolveMemorySearchConfig(cfg, agentId)) {
|
|
72
88
|
return null;
|
|
89
|
+
}
|
|
73
90
|
return {
|
|
74
91
|
label: "Memory Get",
|
|
75
92
|
name: "memory_get",
|
|
@@ -101,3 +118,74 @@ export function createMemoryGetTool(options) {
|
|
|
101
118
|
},
|
|
102
119
|
};
|
|
103
120
|
}
|
|
121
|
+
function resolveMemoryCitationsMode(cfg) {
|
|
122
|
+
const mode = cfg.memory?.citations;
|
|
123
|
+
if (mode === "on" || mode === "off" || mode === "auto") {
|
|
124
|
+
return mode;
|
|
125
|
+
}
|
|
126
|
+
return "auto";
|
|
127
|
+
}
|
|
128
|
+
function decorateCitations(results, include) {
|
|
129
|
+
if (!include) {
|
|
130
|
+
return results.map((entry) => ({ ...entry, citation: undefined }));
|
|
131
|
+
}
|
|
132
|
+
return results.map((entry) => {
|
|
133
|
+
const citation = formatCitation(entry);
|
|
134
|
+
const snippet = `${entry.snippet.trim()}\n\nSource: ${citation}`;
|
|
135
|
+
return { ...entry, citation, snippet };
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
function formatCitation(entry) {
|
|
139
|
+
const lineRange = entry.startLine === entry.endLine
|
|
140
|
+
? `#L${entry.startLine}`
|
|
141
|
+
: `#L${entry.startLine}-L${entry.endLine}`;
|
|
142
|
+
return `${entry.path}${lineRange}`;
|
|
143
|
+
}
|
|
144
|
+
function clampResultsByInjectedChars(results, budget) {
|
|
145
|
+
if (!budget || budget <= 0) {
|
|
146
|
+
return results;
|
|
147
|
+
}
|
|
148
|
+
let remaining = budget;
|
|
149
|
+
const clamped = [];
|
|
150
|
+
for (const entry of results) {
|
|
151
|
+
if (remaining <= 0) {
|
|
152
|
+
break;
|
|
153
|
+
}
|
|
154
|
+
const snippet = entry.snippet ?? "";
|
|
155
|
+
if (snippet.length <= remaining) {
|
|
156
|
+
clamped.push(entry);
|
|
157
|
+
remaining -= snippet.length;
|
|
158
|
+
}
|
|
159
|
+
else {
|
|
160
|
+
const trimmed = snippet.slice(0, Math.max(0, remaining));
|
|
161
|
+
clamped.push({ ...entry, snippet: trimmed });
|
|
162
|
+
break;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
return clamped;
|
|
166
|
+
}
|
|
167
|
+
function shouldIncludeCitations(params) {
|
|
168
|
+
if (params.mode === "on") {
|
|
169
|
+
return true;
|
|
170
|
+
}
|
|
171
|
+
if (params.mode === "off") {
|
|
172
|
+
return false;
|
|
173
|
+
}
|
|
174
|
+
// auto: show citations in direct chats; suppress in groups/channels by default.
|
|
175
|
+
const chatType = deriveChatTypeFromSessionKey(params.sessionKey);
|
|
176
|
+
return chatType === "direct";
|
|
177
|
+
}
|
|
178
|
+
function deriveChatTypeFromSessionKey(sessionKey) {
|
|
179
|
+
const parsed = parseAgentSessionKey(sessionKey);
|
|
180
|
+
if (!parsed?.rest) {
|
|
181
|
+
return "direct";
|
|
182
|
+
}
|
|
183
|
+
const tokens = new Set(parsed.rest.toLowerCase().split(":").filter(Boolean));
|
|
184
|
+
if (tokens.has("channel")) {
|
|
185
|
+
return "channel";
|
|
186
|
+
}
|
|
187
|
+
if (tokens.has("group")) {
|
|
188
|
+
return "group";
|
|
189
|
+
}
|
|
190
|
+
return "direct";
|
|
191
|
+
}
|
|
@@ -190,7 +190,7 @@ async function runPerplexitySearch(params) {
|
|
|
190
190
|
"Content-Type": "application/json",
|
|
191
191
|
Authorization: `Bearer ${params.apiKey}`,
|
|
192
192
|
"HTTP-Referer": "https://molt.bot",
|
|
193
|
-
"X-Title": "
|
|
193
|
+
"X-Title": "Poolbot Web Search",
|
|
194
194
|
},
|
|
195
195
|
body: JSON.stringify({
|
|
196
196
|
model: params.model,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { resolveSessionAgentIds } from "../../agents/agent-scope.js";
|
|
2
2
|
import { resolveBootstrapMaxChars } from "../../agents/pi-embedded-helpers.js";
|
|
3
|
-
import {
|
|
3
|
+
import { createPoolbotCodingTools } from "../../agents/pi-tools.js";
|
|
4
4
|
import { resolveSandboxRuntimeStatus } from "../../agents/sandbox.js";
|
|
5
5
|
import { buildWorkspaceSkillSnapshot } from "../../agents/skills.js";
|
|
6
6
|
import { getSkillsSnapshotVersion } from "../../agents/skills/refresh.js";
|
|
@@ -66,7 +66,7 @@ async function resolveContextReport(params) {
|
|
|
66
66
|
});
|
|
67
67
|
const tools = (() => {
|
|
68
68
|
try {
|
|
69
|
-
return
|
|
69
|
+
return createPoolbotCodingTools({
|
|
70
70
|
config: params.cfg,
|
|
71
71
|
workspaceDir,
|
|
72
72
|
sessionKey: params.sessionKey,
|
|
@@ -2,7 +2,7 @@ import { abortEmbeddedPiRun } from "../../agents/pi-embedded.js";
|
|
|
2
2
|
import { updateSessionStore } from "../../config/sessions.js";
|
|
3
3
|
import { logVerbose } from "../../globals.js";
|
|
4
4
|
import { createInternalHookEvent, triggerInternalHook } from "../../hooks/internal-hooks.js";
|
|
5
|
-
import { scheduleGatewaySigusr1Restart,
|
|
5
|
+
import { scheduleGatewaySigusr1Restart, triggerPoolbotRestart } from "../../infra/restart.js";
|
|
6
6
|
import { parseActivationCommand } from "../group-activation.js";
|
|
7
7
|
import { parseSendPolicyCommand } from "../send-policy.js";
|
|
8
8
|
import { normalizeUsageDisplay, resolveResponseUsageMode } from "../thinking.js";
|
|
@@ -214,7 +214,7 @@ export const handleRestartCommand = async (params, allowTextCommands) => {
|
|
|
214
214
|
},
|
|
215
215
|
};
|
|
216
216
|
}
|
|
217
|
-
const restartMethod =
|
|
217
|
+
const restartMethod = triggerPoolbotRestart();
|
|
218
218
|
if (!restartMethod.ok) {
|
|
219
219
|
const detail = restartMethod.detail ? ` Details: ${restartMethod.detail}` : "";
|
|
220
220
|
return {
|
|
@@ -17,7 +17,9 @@ import { buildGroupIntro } from "./groups.js";
|
|
|
17
17
|
import { resolveQueueSettings } from "./queue.js";
|
|
18
18
|
import { ensureSkillSnapshot, prependSystemEvents } from "./session-updates.js";
|
|
19
19
|
import { resolveTypingMode } from "./typing-mode.js";
|
|
20
|
-
|
|
20
|
+
import { buildInboundMetaSystemPrompt, buildInboundUserContextPrefix } from "./inbound-meta.js";
|
|
21
|
+
import { appendUntrustedContext } from "./untrusted-context.js";
|
|
22
|
+
const BARE_SESSION_RESET_PROMPT = "A new session was started via /new or /reset. Greet the user in your configured persona, if one is provided. Be yourself - use your defined voice, mannerisms, and mood. Keep it to 1-3 sentences and ask what they want to do. If the runtime model differs from default_model in the system prompt, mention the default model. Do not mention internal steps, files, tools, or reasoning.";
|
|
21
23
|
export async function runPreparedReply(params) {
|
|
22
24
|
const { ctx, sessionCtx, cfg, agentId, agentDir, agentCfg, sessionCfg, commandAuthorized, command, commandSource, allowTextCommands, directives, defaultActivation, elevatedEnabled, elevatedAllowed, blockStreamingEnabled, blockReplyChunking, resolvedBlockStreamingBreak, modelState, provider, model, perMessageQueueMode, perMessageQueueOptions, typing, opts, defaultProvider, defaultModel, timeoutMs, isNewSession, resetTriggered, systemSent, sessionKey, sessionId, storePath, workspaceDir, sessionStore, } = params;
|
|
23
25
|
let { sessionEntry, resolvedThinkLevel, resolvedVerboseLevel, resolvedReasoningLevel, resolvedElevatedLevel, execOverrides, abortedLastRun, } = params;
|
|
@@ -43,7 +45,10 @@ export async function runPreparedReply(params) {
|
|
|
43
45
|
})
|
|
44
46
|
: "";
|
|
45
47
|
const groupSystemPrompt = sessionCtx.GroupSystemPrompt?.trim() ?? "";
|
|
46
|
-
const
|
|
48
|
+
const inboundMetaPrompt = buildInboundMetaSystemPrompt(isNewSession ? sessionCtx : { ...sessionCtx, ThreadStarterBody: undefined });
|
|
49
|
+
const extraSystemPrompt = [inboundMetaPrompt, groupIntro, groupSystemPrompt]
|
|
50
|
+
.filter(Boolean)
|
|
51
|
+
.join("\n\n");
|
|
47
52
|
const baseBody = sessionCtx.BodyStripped ?? sessionCtx.Body ?? "";
|
|
48
53
|
// Use CommandBody/RawBody for bare reset detection (clean message without structural context).
|
|
49
54
|
const rawBodyTrimmed = (ctx.CommandBody ?? ctx.RawBody ?? ctx.Body ?? "").trim();
|
|
@@ -59,7 +64,11 @@ export async function runPreparedReply(params) {
|
|
|
59
64
|
const isBareSessionReset = isNewSession &&
|
|
60
65
|
((baseBodyTrimmedRaw.length === 0 && rawBodyTrimmed.length > 0) || isBareNewOrReset);
|
|
61
66
|
const baseBodyFinal = isBareSessionReset ? BARE_SESSION_RESET_PROMPT : baseBody;
|
|
62
|
-
const
|
|
67
|
+
const inboundUserContext = buildInboundUserContextPrefix(isNewSession ? sessionCtx : { ...sessionCtx, ThreadStarterBody: undefined });
|
|
68
|
+
const baseBodyForPrompt = isBareSessionReset
|
|
69
|
+
? baseBodyFinal
|
|
70
|
+
: [inboundUserContext, baseBodyFinal].filter(Boolean).join("\n\n");
|
|
71
|
+
const baseBodyTrimmed = baseBodyForPrompt.trim();
|
|
63
72
|
if (!baseBodyTrimmed) {
|
|
64
73
|
await typing.onReplyStart();
|
|
65
74
|
logVerbose("Inbound body empty after normalization; skipping agent run");
|
|
@@ -69,7 +78,7 @@ export async function runPreparedReply(params) {
|
|
|
69
78
|
};
|
|
70
79
|
}
|
|
71
80
|
let prefixedBodyBase = await applySessionHints({
|
|
72
|
-
baseBody:
|
|
81
|
+
baseBody: baseBodyForPrompt,
|
|
73
82
|
abortedLastRun,
|
|
74
83
|
sessionEntry,
|
|
75
84
|
sessionStore,
|
|
@@ -87,6 +96,7 @@ export async function runPreparedReply(params) {
|
|
|
87
96
|
isNewSession,
|
|
88
97
|
prefixedBodyBase,
|
|
89
98
|
});
|
|
99
|
+
prefixedBodyBase = appendUntrustedContext(prefixedBodyBase, sessionCtx.UntrustedContext);
|
|
90
100
|
const threadStarterBody = ctx.ThreadStarterBody?.trim();
|
|
91
101
|
const threadStarterNote = isNewSession && threadStarterBody
|
|
92
102
|
? `[Thread starter - for context]\n${threadStarterBody}`
|