@poolzin/pool-bot 2026.2.23 → 2026.2.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +29 -0
- package/dist/acp/client.js +207 -18
- package/dist/acp/secret-file.js +22 -0
- package/dist/agents/agent-scope.js +10 -0
- package/dist/agents/bash-process-registry.test-helpers.js +29 -0
- package/dist/agents/bash-tools.exec-approval-request.js +20 -0
- package/dist/agents/bash-tools.exec-host-gateway.js +230 -0
- package/dist/agents/bash-tools.exec-host-node.js +235 -0
- package/dist/agents/bash-tools.exec-types.js +1 -0
- package/dist/agents/bash-tools.process.js +224 -218
- package/dist/agents/content-blocks.js +16 -0
- package/dist/agents/model-fallback.js +96 -101
- package/dist/agents/models-config.providers.js +299 -182
- package/dist/agents/pi-embedded-payloads.js +1 -0
- package/dist/agents/pi-embedded-runner/run.overflow-compaction.fixture.js +34 -0
- package/dist/agents/skills.test-helpers.js +13 -0
- package/dist/agents/stable-stringify.js +12 -0
- package/dist/agents/subagent-registry.mocks.shared.js +12 -0
- package/dist/agents/test-helpers/assistant-message-fixtures.js +29 -0
- package/dist/agents/test-helpers/pi-tools-sandbox-context.js +27 -0
- package/dist/agents/tool-policy-shared.js +108 -0
- package/dist/agents/tools/browser-tool.js +160 -54
- package/dist/agents/tools/cron-tool.test-helpers.js +12 -0
- package/dist/agents/tools/discord-actions-moderation-shared.js +27 -0
- package/dist/agents/tools/image-tool.js +214 -99
- package/dist/agents/tools/sessions-history-tool.js +140 -108
- package/dist/agents/workspace.js +222 -46
- package/dist/auto-reply/commands-registry.js +15 -18
- package/dist/auto-reply/fallback-state.js +114 -0
- package/dist/auto-reply/model-runtime.js +68 -0
- package/dist/auto-reply/reply/agent-runner-execution.js +36 -4
- package/dist/auto-reply/reply/agent-runner.js +165 -39
- package/dist/auto-reply/reply/commands-setunset-standard.js +13 -0
- package/dist/browser/config.js +26 -0
- package/dist/browser/navigation-guard.js +31 -0
- package/dist/browser/routes/agent.act.js +431 -424
- package/dist/browser/routes/agent.shared.js +47 -3
- package/dist/browser/routes/agent.snapshot.js +122 -116
- package/dist/browser/routes/agent.storage.js +303 -297
- package/dist/browser/routes/tabs.js +154 -100
- package/dist/browser/server-lifecycle.js +37 -0
- package/dist/build-info.json +3 -3
- package/dist/channels/allow-from.js +25 -0
- package/dist/channels/plugins/account-action-gate.js +13 -0
- package/dist/channels/plugins/message-actions.js +10 -0
- package/dist/channels/telegram/api.js +18 -0
- package/dist/cli/argv.js +84 -21
- package/dist/cli/banner.js +2 -1
- package/dist/cli/exec-approvals-cli.js +92 -124
- package/dist/cli/memory-cli.js +158 -61
- package/dist/cli/nodes-cli/register.push.js +63 -0
- package/dist/cli/nodes-media-utils.js +21 -0
- package/dist/cli/plugins-cli.js +245 -61
- package/dist/cli/program/build-program.js +3 -1
- package/dist/cli/program/command-registry.js +223 -136
- package/dist/cli/program/help.js +43 -12
- package/dist/cli/route.js +1 -1
- package/dist/cli/test-runtime-capture.js +24 -0
- package/dist/commands/agent.js +163 -87
- package/dist/commands/channels.mock-harness.js +23 -0
- package/dist/commands/daemon-install-runtime-warning.js +11 -0
- package/dist/commands/onboard-helpers.js +4 -4
- package/dist/commands/sessions.test-helpers.js +61 -0
- package/dist/compat/legacy-names.js +2 -2
- package/dist/config/commands.js +3 -0
- package/dist/config/config.js +1 -1
- package/dist/config/env-substitution.js +62 -34
- package/dist/config/env-vars.js +9 -0
- package/dist/config/io.js +571 -171
- package/dist/config/merge-patch.js +50 -4
- package/dist/config/redact-snapshot.js +404 -76
- package/dist/config/schema.js +58 -570
- package/dist/config/validation.js +140 -85
- package/dist/config/zod-schema.hooks.js +40 -11
- package/dist/config/zod-schema.installs.js +20 -0
- package/dist/config/zod-schema.js +8 -7
- package/dist/control-ui/assets/{index-HRr1grwl.js → index-Dvkl4Xlx.js} +2 -1
- package/dist/control-ui/assets/{index-HRr1grwl.js.map → index-Dvkl4Xlx.js.map} +1 -1
- package/dist/control-ui/index.html +1 -1
- package/dist/daemon/cmd-argv.js +21 -0
- package/dist/daemon/cmd-set.js +58 -0
- package/dist/daemon/service-types.js +1 -0
- package/dist/discord/monitor/exec-approvals.js +357 -162
- package/dist/gateway/auth.js +38 -3
- package/dist/gateway/call.js +149 -68
- package/dist/gateway/canvas-capability.js +75 -0
- package/dist/gateway/control-plane-audit.js +28 -0
- package/dist/gateway/control-plane-rate-limit.js +53 -0
- package/dist/gateway/events.js +1 -0
- package/dist/gateway/hooks.js +109 -54
- package/dist/gateway/http-common.js +22 -0
- package/dist/gateway/method-scopes.js +169 -0
- package/dist/gateway/net.js +23 -0
- package/dist/gateway/openresponses-http.js +120 -110
- package/dist/gateway/probe-auth.js +2 -0
- package/dist/gateway/protocol/index.js +3 -2
- package/dist/gateway/protocol/schema/protocol-schemas.js +2 -0
- package/dist/gateway/protocol/schema/push.js +18 -0
- package/dist/gateway/protocol/schema.js +1 -0
- package/dist/gateway/server-http.js +236 -52
- package/dist/gateway/server-methods/agent.js +162 -24
- package/dist/gateway/server-methods/chat.js +461 -130
- package/dist/gateway/server-methods/config.js +193 -150
- package/dist/gateway/server-methods/nodes.helpers.js +12 -0
- package/dist/gateway/server-methods/nodes.js +251 -69
- package/dist/gateway/server-methods/push.js +53 -0
- package/dist/gateway/server-reload-handlers.js +2 -3
- package/dist/gateway/server-runtime-config.js +5 -0
- package/dist/gateway/server-runtime-state.js +2 -0
- package/dist/gateway/server-ws-runtime.js +1 -0
- package/dist/gateway/server.impl.js +296 -139
- package/dist/gateway/session-preview.test-helpers.js +11 -0
- package/dist/gateway/startup-auth.js +126 -0
- package/dist/gateway/test-helpers.agent-results.js +15 -0
- package/dist/gateway/test-helpers.mocks.js +37 -14
- package/dist/gateway/test-helpers.server.js +161 -77
- package/dist/hooks/bundled/session-memory/handler.js +165 -34
- package/dist/hooks/gmail-watcher-lifecycle.js +23 -0
- package/dist/infra/archive-path.js +49 -0
- package/dist/infra/device-pairing.js +148 -167
- package/dist/infra/exec-approvals-allowlist.js +19 -70
- package/dist/infra/exec-approvals-analysis.js +44 -17
- package/dist/infra/exec-safe-bin-policy.js +269 -0
- package/dist/infra/fixed-window-rate-limit.js +33 -0
- package/dist/infra/git-root.js +61 -0
- package/dist/infra/heartbeat-active-hours.js +2 -2
- package/dist/infra/heartbeat-reason.js +40 -0
- package/dist/infra/heartbeat-runner.js +72 -32
- package/dist/infra/install-source-utils.js +91 -7
- package/dist/infra/node-pairing.js +50 -105
- package/dist/infra/npm-integrity.js +45 -0
- package/dist/infra/npm-pack-install.js +40 -0
- package/dist/infra/outbound/channel-adapters.js +20 -7
- package/dist/infra/outbound/message-action-runner.js +107 -327
- package/dist/infra/outbound/message.js +59 -36
- package/dist/infra/outbound/outbound-policy.js +52 -25
- package/dist/infra/outbound/outbound-send-service.js +58 -71
- package/dist/infra/pairing-files.js +10 -0
- package/dist/infra/plain-object.js +9 -0
- package/dist/infra/push-apns.js +365 -0
- package/dist/infra/restart-sentinel.js +16 -1
- package/dist/infra/restart.js +229 -26
- package/dist/infra/scp-host.js +54 -0
- package/dist/infra/update-startup.js +86 -9
- package/dist/media/inbound-path-policy.js +114 -0
- package/dist/media/input-files.js +16 -0
- package/dist/memory/test-manager.js +8 -0
- package/dist/plugin-sdk/temp-path.js +47 -0
- package/dist/plugins/discovery.js +217 -23
- package/dist/plugins/hook-runner-global.js +16 -0
- package/dist/plugins/loader.js +192 -26
- package/dist/plugins/logger.js +8 -0
- package/dist/plugins/manifest-registry.js +3 -0
- package/dist/plugins/path-safety.js +34 -0
- package/dist/plugins/registry.js +5 -2
- package/dist/plugins/runtime/index.js +271 -206
- package/dist/providers/github-copilot-models.js +4 -1
- package/dist/security/audit-channel.js +8 -19
- package/dist/security/audit-extra.async.js +354 -182
- package/dist/security/audit-extra.js +11 -1
- package/dist/security/audit-extra.sync.js +340 -33
- package/dist/security/audit-fs.js +31 -13
- package/dist/security/audit.js +145 -371
- package/dist/security/dm-policy-shared.js +24 -0
- package/dist/security/external-content.js +20 -8
- package/dist/security/fix.js +49 -85
- package/dist/security/scan-paths.js +20 -0
- package/dist/security/secret-equal.js +3 -7
- package/dist/security/windows-acl.js +30 -15
- package/dist/shared/node-list-parse.js +13 -0
- package/dist/shared/operator-scope-compat.js +37 -0
- package/dist/shared/text-chunking.js +29 -0
- package/dist/slack/blocks.test-helpers.js +31 -0
- package/dist/slack/monitor/mrkdwn.js +8 -0
- package/dist/telegram/bot-message-dispatch.js +366 -164
- package/dist/telegram/draft-stream.js +30 -7
- package/dist/telegram/reasoning-lane-coordinator.js +128 -0
- package/dist/terminal/prompt-select-styled.js +9 -0
- package/dist/test-utils/command-runner.js +6 -0
- package/dist/test-utils/internal-hook-event-payload.js +10 -0
- package/dist/test-utils/model-auth-mock.js +12 -0
- package/dist/test-utils/provider-usage-fetch.js +14 -0
- package/dist/test-utils/temp-home.js +33 -0
- package/dist/tui/components/chat-log.js +9 -0
- package/dist/tui/tui-command-handlers.js +36 -27
- package/dist/tui/tui-event-handlers.js +122 -32
- package/dist/tui/tui.js +181 -45
- package/dist/utils/mask-api-key.js +10 -0
- package/dist/utils/run-with-concurrency.js +39 -0
- package/dist/web/media.js +4 -0
- package/docs/tools/slash-commands.md +5 -1
- package/extensions/bluebubbles/package.json +1 -1
- package/extensions/copilot-proxy/package.json +1 -1
- package/extensions/diagnostics-otel/package.json +1 -1
- package/extensions/discord/package.json +1 -1
- package/extensions/feishu/package.json +1 -1
- package/extensions/feishu/src/external-keys.ts +19 -0
- package/extensions/google-antigravity-auth/package.json +1 -1
- package/extensions/google-gemini-cli-auth/package.json +1 -1
- package/extensions/googlechat/package.json +1 -1
- package/extensions/imessage/package.json +1 -1
- package/extensions/irc/package.json +1 -1
- package/extensions/line/package.json +1 -1
- package/extensions/llm-task/package.json +1 -1
- package/extensions/lobster/package.json +1 -1
- package/extensions/lobster/src/windows-spawn.ts +193 -0
- package/extensions/matrix/CHANGELOG.md +5 -0
- package/extensions/matrix/package.json +1 -1
- package/extensions/matrix/src/matrix/actions/limits.ts +6 -0
- package/extensions/mattermost/package.json +1 -1
- package/extensions/mattermost/src/mattermost/reactions.test-helpers.ts +83 -0
- package/extensions/memory-core/package.json +1 -1
- package/extensions/memory-lancedb/package.json +1 -1
- package/extensions/minimax-portal-auth/package.json +1 -1
- package/extensions/msteams/CHANGELOG.md +5 -0
- package/extensions/msteams/package.json +1 -1
- package/extensions/nextcloud-talk/package.json +1 -1
- package/extensions/nostr/CHANGELOG.md +5 -0
- package/extensions/nostr/package.json +1 -1
- package/extensions/open-prose/package.json +1 -1
- package/extensions/openai-codex-auth/package.json +1 -1
- package/extensions/signal/package.json +1 -1
- package/extensions/slack/package.json +1 -1
- package/extensions/telegram/package.json +1 -1
- package/extensions/tlon/package.json +1 -1
- package/extensions/twitch/CHANGELOG.md +5 -0
- package/extensions/twitch/package.json +1 -1
- package/extensions/voice-call/CHANGELOG.md +5 -0
- package/extensions/voice-call/package.json +1 -1
- package/extensions/whatsapp/package.json +1 -1
- package/extensions/zalo/CHANGELOG.md +5 -0
- package/extensions/zalo/package.json +1 -1
- package/extensions/zalouser/CHANGELOG.md +5 -0
- package/extensions/zalouser/package.json +1 -1
- package/package.json +1 -1
|
@@ -1,60 +1,69 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* OpenResponses HTTP Handler
|
|
3
3
|
*
|
|
4
|
-
* Implements the OpenResponses `/v1/responses` endpoint for
|
|
4
|
+
* Implements the OpenResponses `/v1/responses` endpoint for Pool Bot Gateway.
|
|
5
5
|
*
|
|
6
6
|
* @see https://www.open-responses.com/
|
|
7
7
|
*/
|
|
8
8
|
import { randomUUID } from "node:crypto";
|
|
9
|
-
import { buildHistoryContextFromEntries } from "../auto-reply/reply/history.js";
|
|
10
9
|
import { createDefaultDeps } from "../cli/deps.js";
|
|
11
10
|
import { agentCommand } from "../commands/agent.js";
|
|
12
11
|
import { emitAgentEvent, onAgentEvent } from "../infra/agent-events.js";
|
|
12
|
+
import { logWarn } from "../logger.js";
|
|
13
|
+
import { DEFAULT_INPUT_IMAGE_MAX_BYTES, DEFAULT_INPUT_IMAGE_MIMES, DEFAULT_INPUT_MAX_REDIRECTS, DEFAULT_INPUT_TIMEOUT_MS, extractFileContentFromSource, extractImageContentFromSource, normalizeMimeList, resolveInputFileLimits, } from "../media/input-files.js";
|
|
13
14
|
import { defaultRuntime } from "../runtime.js";
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
15
|
+
import { resolveAssistantStreamDeltaText } from "./agent-event-assistant-text.js";
|
|
16
|
+
import { buildAgentMessageFromConversationEntries, } from "./agent-prompt.js";
|
|
17
|
+
import { sendJson, setSseHeaders, writeDone } from "./http-common.js";
|
|
18
|
+
import { handleGatewayPostJsonEndpoint } from "./http-endpoint-helpers.js";
|
|
19
|
+
import { resolveAgentIdForRequest, resolveSessionKey } from "./http-utils.js";
|
|
17
20
|
import { CreateResponseBodySchema, } from "./open-responses.schema.js";
|
|
18
|
-
import { DEFAULT_INPUT_FILE_MAX_BYTES, DEFAULT_INPUT_FILE_MAX_CHARS, DEFAULT_INPUT_FILE_MIMES, DEFAULT_INPUT_IMAGE_MAX_BYTES, DEFAULT_INPUT_IMAGE_MIMES, DEFAULT_INPUT_MAX_REDIRECTS, DEFAULT_INPUT_PDF_MAX_PAGES, DEFAULT_INPUT_PDF_MAX_PIXELS, DEFAULT_INPUT_PDF_MIN_TEXT_CHARS, DEFAULT_INPUT_TIMEOUT_MS, extractFileContentFromSource, extractImageContentFromSource, normalizeMimeList, } from "../media/input-files.js";
|
|
19
21
|
const DEFAULT_BODY_BYTES = 20 * 1024 * 1024;
|
|
22
|
+
const DEFAULT_MAX_URL_PARTS = 8;
|
|
20
23
|
function writeSseEvent(res, event) {
|
|
21
24
|
res.write(`event: ${event.type}\n`);
|
|
22
25
|
res.write(`data: ${JSON.stringify(event)}\n\n`);
|
|
23
26
|
}
|
|
24
27
|
function extractTextContent(content) {
|
|
25
|
-
if (typeof content === "string")
|
|
28
|
+
if (typeof content === "string") {
|
|
26
29
|
return content;
|
|
30
|
+
}
|
|
27
31
|
return content
|
|
28
32
|
.map((part) => {
|
|
29
|
-
if (part.type === "input_text")
|
|
33
|
+
if (part.type === "input_text") {
|
|
30
34
|
return part.text;
|
|
31
|
-
|
|
35
|
+
}
|
|
36
|
+
if (part.type === "output_text") {
|
|
32
37
|
return part.text;
|
|
38
|
+
}
|
|
33
39
|
return "";
|
|
34
40
|
})
|
|
35
41
|
.filter(Boolean)
|
|
36
42
|
.join("\n");
|
|
37
43
|
}
|
|
44
|
+
function normalizeHostnameAllowlist(values) {
|
|
45
|
+
if (!values || values.length === 0) {
|
|
46
|
+
return undefined;
|
|
47
|
+
}
|
|
48
|
+
const normalized = values.map((value) => value.trim()).filter((value) => value.length > 0);
|
|
49
|
+
return normalized.length > 0 ? normalized : undefined;
|
|
50
|
+
}
|
|
38
51
|
function resolveResponsesLimits(config) {
|
|
39
52
|
const files = config?.files;
|
|
40
53
|
const images = config?.images;
|
|
54
|
+
const fileLimits = resolveInputFileLimits(files);
|
|
41
55
|
return {
|
|
42
56
|
maxBodyBytes: config?.maxBodyBytes ?? DEFAULT_BODY_BYTES,
|
|
57
|
+
maxUrlParts: typeof config?.maxUrlParts === "number"
|
|
58
|
+
? Math.max(0, Math.floor(config.maxUrlParts))
|
|
59
|
+
: DEFAULT_MAX_URL_PARTS,
|
|
43
60
|
files: {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
maxBytes: files?.maxBytes ?? DEFAULT_INPUT_FILE_MAX_BYTES,
|
|
47
|
-
maxChars: files?.maxChars ?? DEFAULT_INPUT_FILE_MAX_CHARS,
|
|
48
|
-
maxRedirects: files?.maxRedirects ?? DEFAULT_INPUT_MAX_REDIRECTS,
|
|
49
|
-
timeoutMs: files?.timeoutMs ?? DEFAULT_INPUT_TIMEOUT_MS,
|
|
50
|
-
pdf: {
|
|
51
|
-
maxPages: files?.pdf?.maxPages ?? DEFAULT_INPUT_PDF_MAX_PAGES,
|
|
52
|
-
maxPixels: files?.pdf?.maxPixels ?? DEFAULT_INPUT_PDF_MAX_PIXELS,
|
|
53
|
-
minTextChars: files?.pdf?.minTextChars ?? DEFAULT_INPUT_PDF_MIN_TEXT_CHARS,
|
|
54
|
-
},
|
|
61
|
+
...fileLimits,
|
|
62
|
+
urlAllowlist: normalizeHostnameAllowlist(files?.urlAllowlist),
|
|
55
63
|
},
|
|
56
64
|
images: {
|
|
57
65
|
allowUrl: images?.allowUrl ?? true,
|
|
66
|
+
urlAllowlist: normalizeHostnameAllowlist(images?.urlAllowlist),
|
|
58
67
|
allowedMimes: normalizeMimeList(images?.allowedMimes, DEFAULT_INPUT_IMAGE_MIMES),
|
|
59
68
|
maxBytes: images?.maxBytes ?? DEFAULT_INPUT_IMAGE_MAX_BYTES,
|
|
60
69
|
maxRedirects: images?.maxRedirects ?? DEFAULT_INPUT_MAX_REDIRECTS,
|
|
@@ -67,8 +76,9 @@ function extractClientTools(body) {
|
|
|
67
76
|
}
|
|
68
77
|
function applyToolChoice(params) {
|
|
69
78
|
const { tools, toolChoice } = params;
|
|
70
|
-
if (!toolChoice)
|
|
79
|
+
if (!toolChoice) {
|
|
71
80
|
return { tools };
|
|
81
|
+
}
|
|
72
82
|
if (toolChoice === "none") {
|
|
73
83
|
return { tools: [] };
|
|
74
84
|
}
|
|
@@ -106,8 +116,9 @@ export function buildAgentPrompt(input) {
|
|
|
106
116
|
for (const item of input) {
|
|
107
117
|
if (item.type === "message") {
|
|
108
118
|
const content = extractTextContent(item.content).trim();
|
|
109
|
-
if (!content)
|
|
119
|
+
if (!content) {
|
|
110
120
|
continue;
|
|
121
|
+
}
|
|
111
122
|
if (item.role === "system" || item.role === "developer") {
|
|
112
123
|
systemParts.push(content);
|
|
113
124
|
continue;
|
|
@@ -127,35 +138,7 @@ export function buildAgentPrompt(input) {
|
|
|
127
138
|
}
|
|
128
139
|
// Skip reasoning and item_reference for prompt building (Phase 1)
|
|
129
140
|
}
|
|
130
|
-
|
|
131
|
-
if (conversationEntries.length > 0) {
|
|
132
|
-
// Find the last user or tool message as the current message
|
|
133
|
-
let currentIndex = -1;
|
|
134
|
-
for (let i = conversationEntries.length - 1; i >= 0; i -= 1) {
|
|
135
|
-
const entryRole = conversationEntries[i]?.role;
|
|
136
|
-
if (entryRole === "user" || entryRole === "tool") {
|
|
137
|
-
currentIndex = i;
|
|
138
|
-
break;
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
if (currentIndex < 0)
|
|
142
|
-
currentIndex = conversationEntries.length - 1;
|
|
143
|
-
const currentEntry = conversationEntries[currentIndex]?.entry;
|
|
144
|
-
if (currentEntry) {
|
|
145
|
-
const historyEntries = conversationEntries.slice(0, currentIndex).map((entry) => entry.entry);
|
|
146
|
-
if (historyEntries.length === 0) {
|
|
147
|
-
message = currentEntry.body;
|
|
148
|
-
}
|
|
149
|
-
else {
|
|
150
|
-
const formatEntry = (entry) => `${entry.sender}: ${entry.body}`;
|
|
151
|
-
message = buildHistoryContextFromEntries({
|
|
152
|
-
entries: [...historyEntries, currentEntry],
|
|
153
|
-
currentMessage: formatEntry(currentEntry),
|
|
154
|
-
formatEntry,
|
|
155
|
-
});
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
}
|
|
141
|
+
const message = buildAgentMessageFromConversationEntries(conversationEntries);
|
|
159
142
|
return {
|
|
160
143
|
message,
|
|
161
144
|
extraSystemPrompt: systemParts.length > 0 ? systemParts.join("\n\n") : undefined,
|
|
@@ -168,8 +151,9 @@ function createEmptyUsage() {
|
|
|
168
151
|
return { input_tokens: 0, output_tokens: 0, total_tokens: 0 };
|
|
169
152
|
}
|
|
170
153
|
function toUsage(value) {
|
|
171
|
-
if (!value)
|
|
154
|
+
if (!value) {
|
|
172
155
|
return createEmptyUsage();
|
|
156
|
+
}
|
|
173
157
|
const input = value.input ?? 0;
|
|
174
158
|
const output = value.output ?? 0;
|
|
175
159
|
const cacheRead = value.cacheRead ?? 0;
|
|
@@ -207,35 +191,41 @@ function createAssistantOutputItem(params) {
|
|
|
207
191
|
status: params.status,
|
|
208
192
|
};
|
|
209
193
|
}
|
|
194
|
+
async function runResponsesAgentCommand(params) {
|
|
195
|
+
return agentCommand({
|
|
196
|
+
message: params.message,
|
|
197
|
+
images: params.images.length > 0 ? params.images : undefined,
|
|
198
|
+
clientTools: params.clientTools.length > 0 ? params.clientTools : undefined,
|
|
199
|
+
extraSystemPrompt: params.extraSystemPrompt || undefined,
|
|
200
|
+
streamParams: params.streamParams ?? undefined,
|
|
201
|
+
sessionKey: params.sessionKey,
|
|
202
|
+
runId: params.runId,
|
|
203
|
+
deliver: false,
|
|
204
|
+
messageChannel: "webchat",
|
|
205
|
+
bestEffortDeliver: false,
|
|
206
|
+
}, defaultRuntime, params.deps);
|
|
207
|
+
}
|
|
210
208
|
export async function handleOpenResponsesHttpRequest(req, res, opts) {
|
|
211
|
-
const url = new URL(req.url ?? "/", `http://${req.headers.host || "localhost"}`);
|
|
212
|
-
if (url.pathname !== "/v1/responses")
|
|
213
|
-
return false;
|
|
214
|
-
if (req.method !== "POST") {
|
|
215
|
-
sendMethodNotAllowed(res);
|
|
216
|
-
return true;
|
|
217
|
-
}
|
|
218
|
-
const token = getBearerToken(req);
|
|
219
|
-
const authResult = await authorizeGatewayConnect({
|
|
220
|
-
auth: opts.auth,
|
|
221
|
-
connectAuth: { token, password: token },
|
|
222
|
-
req,
|
|
223
|
-
trustedProxies: opts.trustedProxies,
|
|
224
|
-
});
|
|
225
|
-
if (!authResult.ok) {
|
|
226
|
-
sendUnauthorized(res);
|
|
227
|
-
return true;
|
|
228
|
-
}
|
|
229
209
|
const limits = resolveResponsesLimits(opts.config);
|
|
230
210
|
const maxBodyBytes = opts.maxBodyBytes ??
|
|
231
211
|
(opts.config?.maxBodyBytes
|
|
232
212
|
? limits.maxBodyBytes
|
|
233
213
|
: Math.max(limits.maxBodyBytes, limits.files.maxBytes * 2, limits.images.maxBytes * 2));
|
|
234
|
-
const
|
|
235
|
-
|
|
214
|
+
const handled = await handleGatewayPostJsonEndpoint(req, res, {
|
|
215
|
+
pathname: "/v1/responses",
|
|
216
|
+
auth: opts.auth,
|
|
217
|
+
trustedProxies: opts.trustedProxies,
|
|
218
|
+
rateLimiter: opts.rateLimiter,
|
|
219
|
+
maxBodyBytes,
|
|
220
|
+
});
|
|
221
|
+
if (handled === false) {
|
|
222
|
+
return false;
|
|
223
|
+
}
|
|
224
|
+
if (!handled) {
|
|
236
225
|
return true;
|
|
226
|
+
}
|
|
237
227
|
// Validate request body with Zod
|
|
238
|
-
const parseResult = CreateResponseBodySchema.safeParse(body);
|
|
228
|
+
const parseResult = CreateResponseBodySchema.safeParse(handled.body);
|
|
239
229
|
if (!parseResult.success) {
|
|
240
230
|
const issue = parseResult.error.issues[0];
|
|
241
231
|
const message = issue ? `${issue.path.join(".")}: ${issue.message}` : "Invalid request body";
|
|
@@ -251,6 +241,13 @@ export async function handleOpenResponsesHttpRequest(req, res, opts) {
|
|
|
251
241
|
// Extract images + files from input (Phase 2)
|
|
252
242
|
let images = [];
|
|
253
243
|
let fileContexts = [];
|
|
244
|
+
let urlParts = 0;
|
|
245
|
+
const markUrlPart = () => {
|
|
246
|
+
urlParts += 1;
|
|
247
|
+
if (urlParts > limits.maxUrlParts) {
|
|
248
|
+
throw new Error(`Too many URL-based input sources: ${urlParts} (limit: ${limits.maxUrlParts})`);
|
|
249
|
+
}
|
|
250
|
+
};
|
|
254
251
|
try {
|
|
255
252
|
if (Array.isArray(payload.input)) {
|
|
256
253
|
for (const item of payload.input) {
|
|
@@ -262,6 +259,9 @@ export async function handleOpenResponsesHttpRequest(req, res, opts) {
|
|
|
262
259
|
if (!sourceType) {
|
|
263
260
|
throw new Error("input_image must have 'source.url' or 'source.data'");
|
|
264
261
|
}
|
|
262
|
+
if (sourceType === "url") {
|
|
263
|
+
markUrlPart();
|
|
264
|
+
}
|
|
265
265
|
const imageSource = {
|
|
266
266
|
type: sourceType,
|
|
267
267
|
url: source.url,
|
|
@@ -278,6 +278,9 @@ export async function handleOpenResponsesHttpRequest(req, res, opts) {
|
|
|
278
278
|
if (!sourceType) {
|
|
279
279
|
throw new Error("input_file must have 'source.url' or 'source.data'");
|
|
280
280
|
}
|
|
281
|
+
if (sourceType === "url") {
|
|
282
|
+
markUrlPart();
|
|
283
|
+
}
|
|
281
284
|
const file = await extractFileContentFromSource({
|
|
282
285
|
source: {
|
|
283
286
|
type: sourceType,
|
|
@@ -304,8 +307,9 @@ export async function handleOpenResponsesHttpRequest(req, res, opts) {
|
|
|
304
307
|
}
|
|
305
308
|
}
|
|
306
309
|
catch (err) {
|
|
310
|
+
logWarn(`openresponses: request parsing failed: ${String(err)}`);
|
|
307
311
|
sendJson(res, 400, {
|
|
308
|
-
error: { message:
|
|
312
|
+
error: { message: "invalid request", type: "invalid_request_error" },
|
|
309
313
|
});
|
|
310
314
|
return true;
|
|
311
315
|
}
|
|
@@ -321,8 +325,9 @@ export async function handleOpenResponsesHttpRequest(req, res, opts) {
|
|
|
321
325
|
toolChoicePrompt = toolChoiceResult.extraSystemPrompt;
|
|
322
326
|
}
|
|
323
327
|
catch (err) {
|
|
328
|
+
logWarn(`openresponses: tool configuration failed: ${String(err)}`);
|
|
324
329
|
sendJson(res, 400, {
|
|
325
|
-
error: { message:
|
|
330
|
+
error: { message: "invalid tool configuration", type: "invalid_request_error" },
|
|
326
331
|
});
|
|
327
332
|
return true;
|
|
328
333
|
}
|
|
@@ -358,18 +363,16 @@ export async function handleOpenResponsesHttpRequest(req, res, opts) {
|
|
|
358
363
|
: undefined;
|
|
359
364
|
if (!stream) {
|
|
360
365
|
try {
|
|
361
|
-
const result = await
|
|
366
|
+
const result = await runResponsesAgentCommand({
|
|
362
367
|
message: prompt.message,
|
|
363
|
-
images
|
|
364
|
-
clientTools: resolvedClientTools
|
|
365
|
-
extraSystemPrompt
|
|
366
|
-
streamParams
|
|
368
|
+
images,
|
|
369
|
+
clientTools: resolvedClientTools,
|
|
370
|
+
extraSystemPrompt,
|
|
371
|
+
streamParams,
|
|
367
372
|
sessionKey,
|
|
368
373
|
runId: responseId,
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
bestEffortDeliver: false,
|
|
372
|
-
}, defaultRuntime, deps);
|
|
374
|
+
deps,
|
|
375
|
+
});
|
|
373
376
|
const payloads = result?.payloads;
|
|
374
377
|
const usage = extractUsageFromResult(result);
|
|
375
378
|
const meta = result?.meta;
|
|
@@ -405,7 +408,7 @@ export async function handleOpenResponsesHttpRequest(req, res, opts) {
|
|
|
405
408
|
.map((p) => (typeof p.text === "string" ? p.text : ""))
|
|
406
409
|
.filter(Boolean)
|
|
407
410
|
.join("\n\n")
|
|
408
|
-
: "No response from
|
|
411
|
+
: "No response from Pool Bot.";
|
|
409
412
|
const response = createResponseResource({
|
|
410
413
|
id: responseId,
|
|
411
414
|
model,
|
|
@@ -418,12 +421,13 @@ export async function handleOpenResponsesHttpRequest(req, res, opts) {
|
|
|
418
421
|
sendJson(res, 200, response);
|
|
419
422
|
}
|
|
420
423
|
catch (err) {
|
|
424
|
+
logWarn(`openresponses: non-stream response failed: ${String(err)}`);
|
|
421
425
|
const response = createResponseResource({
|
|
422
426
|
id: responseId,
|
|
423
427
|
model,
|
|
424
428
|
status: "failed",
|
|
425
429
|
output: [],
|
|
426
|
-
error: { code: "api_error", message:
|
|
430
|
+
error: { code: "api_error", message: "internal error" },
|
|
427
431
|
});
|
|
428
432
|
sendJson(res, 500, response);
|
|
429
433
|
}
|
|
@@ -440,12 +444,15 @@ export async function handleOpenResponsesHttpRequest(req, res, opts) {
|
|
|
440
444
|
let finalUsage;
|
|
441
445
|
let finalizeRequested = null;
|
|
442
446
|
const maybeFinalize = () => {
|
|
443
|
-
if (closed)
|
|
447
|
+
if (closed) {
|
|
444
448
|
return;
|
|
445
|
-
|
|
449
|
+
}
|
|
450
|
+
if (!finalizeRequested) {
|
|
446
451
|
return;
|
|
447
|
-
|
|
452
|
+
}
|
|
453
|
+
if (!finalUsage) {
|
|
448
454
|
return;
|
|
455
|
+
}
|
|
449
456
|
const usage = finalUsage;
|
|
450
457
|
closed = true;
|
|
451
458
|
unsubscribe();
|
|
@@ -485,8 +492,9 @@ export async function handleOpenResponsesHttpRequest(req, res, opts) {
|
|
|
485
492
|
res.end();
|
|
486
493
|
};
|
|
487
494
|
const requestFinalize = (status, text) => {
|
|
488
|
-
if (finalizeRequested)
|
|
495
|
+
if (finalizeRequested) {
|
|
489
496
|
return;
|
|
497
|
+
}
|
|
490
498
|
finalizeRequested = { status, text };
|
|
491
499
|
maybeFinalize();
|
|
492
500
|
};
|
|
@@ -519,16 +527,17 @@ export async function handleOpenResponsesHttpRequest(req, res, opts) {
|
|
|
519
527
|
part: { type: "output_text", text: "" },
|
|
520
528
|
});
|
|
521
529
|
unsubscribe = onAgentEvent((evt) => {
|
|
522
|
-
if (evt.runId !== responseId)
|
|
530
|
+
if (evt.runId !== responseId) {
|
|
523
531
|
return;
|
|
524
|
-
|
|
532
|
+
}
|
|
533
|
+
if (closed) {
|
|
525
534
|
return;
|
|
535
|
+
}
|
|
526
536
|
if (evt.stream === "assistant") {
|
|
527
|
-
const
|
|
528
|
-
|
|
529
|
-
const content = typeof delta === "string" ? delta : typeof text === "string" ? text : "";
|
|
530
|
-
if (!content)
|
|
537
|
+
const content = resolveAssistantStreamDeltaText(evt);
|
|
538
|
+
if (!content) {
|
|
531
539
|
return;
|
|
540
|
+
}
|
|
532
541
|
sawAssistantDelta = true;
|
|
533
542
|
accumulatedText += content;
|
|
534
543
|
writeSseEvent(res, {
|
|
@@ -543,7 +552,7 @@ export async function handleOpenResponsesHttpRequest(req, res, opts) {
|
|
|
543
552
|
if (evt.stream === "lifecycle") {
|
|
544
553
|
const phase = evt.data?.phase;
|
|
545
554
|
if (phase === "end" || phase === "error") {
|
|
546
|
-
const finalText = accumulatedText || "No response from
|
|
555
|
+
const finalText = accumulatedText || "No response from Pool Bot.";
|
|
547
556
|
const finalStatus = phase === "error" ? "failed" : "completed";
|
|
548
557
|
requestFinalize(finalStatus, finalText);
|
|
549
558
|
}
|
|
@@ -555,22 +564,21 @@ export async function handleOpenResponsesHttpRequest(req, res, opts) {
|
|
|
555
564
|
});
|
|
556
565
|
void (async () => {
|
|
557
566
|
try {
|
|
558
|
-
const result = await
|
|
567
|
+
const result = await runResponsesAgentCommand({
|
|
559
568
|
message: prompt.message,
|
|
560
|
-
images
|
|
561
|
-
clientTools: resolvedClientTools
|
|
562
|
-
extraSystemPrompt
|
|
563
|
-
streamParams
|
|
569
|
+
images,
|
|
570
|
+
clientTools: resolvedClientTools,
|
|
571
|
+
extraSystemPrompt,
|
|
572
|
+
streamParams,
|
|
564
573
|
sessionKey,
|
|
565
574
|
runId: responseId,
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
bestEffortDeliver: false,
|
|
569
|
-
}, defaultRuntime, deps);
|
|
575
|
+
deps,
|
|
576
|
+
});
|
|
570
577
|
finalUsage = extractUsageFromResult(result);
|
|
571
578
|
maybeFinalize();
|
|
572
|
-
if (closed)
|
|
579
|
+
if (closed) {
|
|
573
580
|
return;
|
|
581
|
+
}
|
|
574
582
|
// Fallback: if no streaming deltas were received, send the full response
|
|
575
583
|
if (!sawAssistantDelta) {
|
|
576
584
|
const resultAny = result;
|
|
@@ -647,7 +655,7 @@ export async function handleOpenResponsesHttpRequest(req, res, opts) {
|
|
|
647
655
|
.map((p) => (typeof p.text === "string" ? p.text : ""))
|
|
648
656
|
.filter(Boolean)
|
|
649
657
|
.join("\n\n")
|
|
650
|
-
: "No response from
|
|
658
|
+
: "No response from Pool Bot.";
|
|
651
659
|
accumulatedText = content;
|
|
652
660
|
sawAssistantDelta = true;
|
|
653
661
|
writeSseEvent(res, {
|
|
@@ -660,15 +668,17 @@ export async function handleOpenResponsesHttpRequest(req, res, opts) {
|
|
|
660
668
|
}
|
|
661
669
|
}
|
|
662
670
|
catch (err) {
|
|
663
|
-
|
|
671
|
+
logWarn(`openresponses: streaming response failed: ${String(err)}`);
|
|
672
|
+
if (closed) {
|
|
664
673
|
return;
|
|
674
|
+
}
|
|
665
675
|
finalUsage = finalUsage ?? createEmptyUsage();
|
|
666
676
|
const errorResponse = createResponseResource({
|
|
667
677
|
id: responseId,
|
|
668
678
|
model,
|
|
669
679
|
status: "failed",
|
|
670
680
|
output: [],
|
|
671
|
-
error: { code: "api_error", message:
|
|
681
|
+
error: { code: "api_error", message: "internal error" },
|
|
672
682
|
usage: finalUsage,
|
|
673
683
|
});
|
|
674
684
|
writeSseEvent(res, { type: "response.failed", response: errorResponse });
|
|
@@ -8,8 +8,10 @@ export function resolveGatewayProbeAuth(params) {
|
|
|
8
8
|
? remote.token.trim()
|
|
9
9
|
: undefined
|
|
10
10
|
: env.POOLBOT_GATEWAY_TOKEN?.trim() ||
|
|
11
|
+
env.CLAWDBOT_GATEWAY_TOKEN?.trim() ||
|
|
11
12
|
(typeof authToken === "string" && authToken.trim() ? authToken.trim() : undefined);
|
|
12
13
|
const password = env.POOLBOT_GATEWAY_PASSWORD?.trim() ||
|
|
14
|
+
env.CLAWDBOT_GATEWAY_PASSWORD?.trim() ||
|
|
13
15
|
(params.mode === "remote"
|
|
14
16
|
? typeof remote?.password === "string" && remote.password.trim()
|
|
15
17
|
? remote.password.trim()
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import AjvPkg from "ajv";
|
|
2
|
-
import { AgentEventSchema, AgentIdentityParamsSchema, AgentIdentityResultSchema, AgentParamsSchema, AgentSummarySchema, AgentsFileEntrySchema, AgentsCreateParamsSchema, AgentsCreateResultSchema, AgentsUpdateParamsSchema, AgentsUpdateResultSchema, AgentsDeleteParamsSchema, AgentsDeleteResultSchema, AgentsFilesGetParamsSchema, AgentsFilesGetResultSchema, AgentsFilesListParamsSchema, AgentsFilesListResultSchema, AgentsFilesSetParamsSchema, AgentsFilesSetResultSchema, AgentsListParamsSchema, AgentsListResultSchema, AgentWaitParamsSchema, ChannelsLogoutParamsSchema, TalkConfigParamsSchema, TalkConfigResultSchema, ChannelsStatusParamsSchema, ChannelsStatusResultSchema, ChatAbortParamsSchema, ChatEventSchema, ChatHistoryParamsSchema, ChatInjectParamsSchema, ChatSendParamsSchema, ConfigApplyParamsSchema, ConfigGetParamsSchema, ConfigPatchParamsSchema, ConfigSchemaParamsSchema, ConfigSchemaResponseSchema, ConfigSetParamsSchema, ConnectParamsSchema, CronAddParamsSchema, CronJobSchema, CronListParamsSchema, CronRemoveParamsSchema, CronRunParamsSchema, CronRunsParamsSchema, CronStatusParamsSchema, CronUpdateParamsSchema, DevicePairApproveParamsSchema, DevicePairListParamsSchema, DevicePairRejectParamsSchema, DeviceTokenRevokeParamsSchema, DeviceTokenRotateParamsSchema, ExecApprovalsGetParamsSchema, ExecApprovalsNodeGetParamsSchema, ExecApprovalsNodeSetParamsSchema, ExecApprovalsSetParamsSchema, ExecApprovalRequestParamsSchema, ExecApprovalResolveParamsSchema, ErrorCodes, ErrorShapeSchema, EventFrameSchema, errorShape, GatewayFrameSchema, HelloOkSchema, LogsTailParamsSchema, LogsTailResultSchema, ModelsListParamsSchema, NodeDescribeParamsSchema, NodeEventParamsSchema, NodeInvokeParamsSchema, NodeInvokeResultParamsSchema, NodeListParamsSchema, NodePairApproveParamsSchema, NodePairListParamsSchema, NodePairRejectParamsSchema, NodePairRequestParamsSchema, NodePairVerifyParamsSchema, NodeRenameParamsSchema, PollParamsSchema, PROTOCOL_VERSION, PresenceEntrySchema, ProtocolSchemas, RequestFrameSchema, ResponseFrameSchema, SendParamsSchema, SessionsCompactParamsSchema, SessionsDeleteParamsSchema, SessionsListParamsSchema, SessionsPatchParamsSchema, SessionsPreviewParamsSchema, SessionsResetParamsSchema, SessionsResolveParamsSchema, SessionsUsageParamsSchema, ShutdownEventSchema, SkillsBinsParamsSchema, SkillsInstallParamsSchema, SkillsStatusParamsSchema, SkillsUpdateParamsSchema, SnapshotSchema, StateVersionSchema, TalkModeParamsSchema, TickEventSchema, UpdateRunParamsSchema, WakeParamsSchema, WebLoginStartParamsSchema, WebLoginWaitParamsSchema, WizardCancelParamsSchema, WizardNextParamsSchema, WizardNextResultSchema, WizardStartParamsSchema, WizardStartResultSchema, WizardStatusParamsSchema, WizardStatusResultSchema, WizardStepSchema, } from "./schema.js";
|
|
2
|
+
import { AgentEventSchema, AgentIdentityParamsSchema, AgentIdentityResultSchema, AgentParamsSchema, AgentSummarySchema, AgentsFileEntrySchema, AgentsCreateParamsSchema, AgentsCreateResultSchema, AgentsUpdateParamsSchema, AgentsUpdateResultSchema, AgentsDeleteParamsSchema, AgentsDeleteResultSchema, AgentsFilesGetParamsSchema, AgentsFilesGetResultSchema, AgentsFilesListParamsSchema, AgentsFilesListResultSchema, AgentsFilesSetParamsSchema, AgentsFilesSetResultSchema, AgentsListParamsSchema, AgentsListResultSchema, AgentWaitParamsSchema, ChannelsLogoutParamsSchema, TalkConfigParamsSchema, TalkConfigResultSchema, ChannelsStatusParamsSchema, ChannelsStatusResultSchema, ChatAbortParamsSchema, ChatEventSchema, ChatHistoryParamsSchema, ChatInjectParamsSchema, ChatSendParamsSchema, ConfigApplyParamsSchema, ConfigGetParamsSchema, ConfigPatchParamsSchema, ConfigSchemaParamsSchema, ConfigSchemaResponseSchema, ConfigSetParamsSchema, ConnectParamsSchema, CronAddParamsSchema, CronJobSchema, CronListParamsSchema, CronRemoveParamsSchema, CronRunParamsSchema, CronRunsParamsSchema, CronStatusParamsSchema, CronUpdateParamsSchema, DevicePairApproveParamsSchema, DevicePairListParamsSchema, DevicePairRejectParamsSchema, DeviceTokenRevokeParamsSchema, DeviceTokenRotateParamsSchema, ExecApprovalsGetParamsSchema, ExecApprovalsNodeGetParamsSchema, ExecApprovalsNodeSetParamsSchema, ExecApprovalsSetParamsSchema, ExecApprovalRequestParamsSchema, ExecApprovalResolveParamsSchema, ErrorCodes, ErrorShapeSchema, EventFrameSchema, errorShape, GatewayFrameSchema, HelloOkSchema, LogsTailParamsSchema, LogsTailResultSchema, ModelsListParamsSchema, NodeDescribeParamsSchema, NodeEventParamsSchema, NodeInvokeParamsSchema, NodeInvokeResultParamsSchema, NodeListParamsSchema, NodePairApproveParamsSchema, NodePairListParamsSchema, NodePairRejectParamsSchema, NodePairRequestParamsSchema, NodePairVerifyParamsSchema, NodeRenameParamsSchema, PollParamsSchema, PROTOCOL_VERSION, PresenceEntrySchema, ProtocolSchemas, PushTestParamsSchema, RequestFrameSchema, ResponseFrameSchema, SendParamsSchema, SessionsCompactParamsSchema, SessionsDeleteParamsSchema, SessionsListParamsSchema, SessionsPatchParamsSchema, SessionsPreviewParamsSchema, SessionsResetParamsSchema, SessionsResolveParamsSchema, SessionsUsageParamsSchema, ShutdownEventSchema, SkillsBinsParamsSchema, SkillsInstallParamsSchema, SkillsStatusParamsSchema, SkillsUpdateParamsSchema, SnapshotSchema, StateVersionSchema, TalkModeParamsSchema, TickEventSchema, UpdateRunParamsSchema, WakeParamsSchema, WebLoginStartParamsSchema, WebLoginWaitParamsSchema, WizardCancelParamsSchema, WizardNextParamsSchema, WizardNextResultSchema, WizardStartParamsSchema, WizardStartResultSchema, WizardStatusParamsSchema, WizardStatusResultSchema, WizardStepSchema, } from "./schema.js";
|
|
3
3
|
const ajv = new AjvPkg({
|
|
4
4
|
allErrors: true,
|
|
5
5
|
strict: false,
|
|
@@ -84,6 +84,7 @@ export const validateChatAbortParams = ajv.compile(ChatAbortParamsSchema);
|
|
|
84
84
|
export const validateChatInjectParams = ajv.compile(ChatInjectParamsSchema);
|
|
85
85
|
export const validateChatEvent = ajv.compile(ChatEventSchema);
|
|
86
86
|
export const validateUpdateRunParams = ajv.compile(UpdateRunParamsSchema);
|
|
87
|
+
export const validatePushTestParams = ajv.compile(PushTestParamsSchema);
|
|
87
88
|
export const validateWebLoginStartParams = ajv.compile(WebLoginStartParamsSchema);
|
|
88
89
|
export const validateWebLoginWaitParams = ajv.compile(WebLoginWaitParamsSchema);
|
|
89
90
|
export function formatValidationErrors(errors) {
|
|
@@ -115,4 +116,4 @@ export function formatValidationErrors(errors) {
|
|
|
115
116
|
}
|
|
116
117
|
return unique.join("; ");
|
|
117
118
|
}
|
|
118
|
-
export { ConnectParamsSchema, HelloOkSchema, RequestFrameSchema, ResponseFrameSchema, EventFrameSchema, GatewayFrameSchema, PresenceEntrySchema, SnapshotSchema, ErrorShapeSchema, StateVersionSchema, AgentEventSchema, ChatEventSchema, SendParamsSchema, PollParamsSchema, AgentParamsSchema, AgentIdentityParamsSchema, AgentIdentityResultSchema, WakeParamsSchema, NodePairRequestParamsSchema, NodePairListParamsSchema, NodePairApproveParamsSchema, NodePairRejectParamsSchema, NodePairVerifyParamsSchema, NodeListParamsSchema, NodeInvokeParamsSchema, SessionsListParamsSchema, SessionsPreviewParamsSchema, SessionsPatchParamsSchema, SessionsResetParamsSchema, SessionsDeleteParamsSchema, SessionsCompactParamsSchema, SessionsUsageParamsSchema, ConfigGetParamsSchema, ConfigSetParamsSchema, ConfigApplyParamsSchema, ConfigPatchParamsSchema, ConfigSchemaParamsSchema, ConfigSchemaResponseSchema, WizardStartParamsSchema, WizardNextParamsSchema, WizardCancelParamsSchema, WizardStatusParamsSchema, WizardStepSchema, WizardNextResultSchema, WizardStartResultSchema, WizardStatusResultSchema, TalkConfigParamsSchema, TalkConfigResultSchema, ChannelsStatusParamsSchema, ChannelsStatusResultSchema, ChannelsLogoutParamsSchema, WebLoginStartParamsSchema, WebLoginWaitParamsSchema, AgentSummarySchema, AgentsFileEntrySchema, AgentsCreateParamsSchema, AgentsCreateResultSchema, AgentsUpdateParamsSchema, AgentsUpdateResultSchema, AgentsDeleteParamsSchema, AgentsDeleteResultSchema, AgentsFilesListParamsSchema, AgentsFilesListResultSchema, AgentsFilesGetParamsSchema, AgentsFilesGetResultSchema, AgentsFilesSetParamsSchema, AgentsFilesSetResultSchema, AgentsListParamsSchema, AgentsListResultSchema, ModelsListParamsSchema, SkillsStatusParamsSchema, SkillsInstallParamsSchema, SkillsUpdateParamsSchema, CronJobSchema, CronListParamsSchema, CronStatusParamsSchema, CronAddParamsSchema, CronUpdateParamsSchema, CronRemoveParamsSchema, CronRunParamsSchema, CronRunsParamsSchema, LogsTailParamsSchema, LogsTailResultSchema, ChatHistoryParamsSchema, ChatSendParamsSchema, ChatInjectParamsSchema, UpdateRunParamsSchema, TickEventSchema, ShutdownEventSchema, ProtocolSchemas, PROTOCOL_VERSION, ErrorCodes, errorShape, };
|
|
119
|
+
export { ConnectParamsSchema, HelloOkSchema, RequestFrameSchema, ResponseFrameSchema, EventFrameSchema, GatewayFrameSchema, PresenceEntrySchema, SnapshotSchema, ErrorShapeSchema, StateVersionSchema, AgentEventSchema, ChatEventSchema, SendParamsSchema, PollParamsSchema, AgentParamsSchema, AgentIdentityParamsSchema, AgentIdentityResultSchema, WakeParamsSchema, NodePairRequestParamsSchema, NodePairListParamsSchema, NodePairApproveParamsSchema, NodePairRejectParamsSchema, NodePairVerifyParamsSchema, NodeListParamsSchema, NodeInvokeParamsSchema, SessionsListParamsSchema, SessionsPreviewParamsSchema, SessionsPatchParamsSchema, SessionsResetParamsSchema, SessionsDeleteParamsSchema, SessionsCompactParamsSchema, SessionsUsageParamsSchema, ConfigGetParamsSchema, ConfigSetParamsSchema, ConfigApplyParamsSchema, ConfigPatchParamsSchema, ConfigSchemaParamsSchema, ConfigSchemaResponseSchema, WizardStartParamsSchema, WizardNextParamsSchema, WizardCancelParamsSchema, WizardStatusParamsSchema, WizardStepSchema, WizardNextResultSchema, WizardStartResultSchema, WizardStatusResultSchema, TalkConfigParamsSchema, TalkConfigResultSchema, ChannelsStatusParamsSchema, ChannelsStatusResultSchema, ChannelsLogoutParamsSchema, WebLoginStartParamsSchema, WebLoginWaitParamsSchema, AgentSummarySchema, AgentsFileEntrySchema, AgentsCreateParamsSchema, AgentsCreateResultSchema, AgentsUpdateParamsSchema, AgentsUpdateResultSchema, AgentsDeleteParamsSchema, AgentsDeleteResultSchema, AgentsFilesListParamsSchema, AgentsFilesListResultSchema, AgentsFilesGetParamsSchema, AgentsFilesGetResultSchema, AgentsFilesSetParamsSchema, AgentsFilesSetResultSchema, AgentsListParamsSchema, AgentsListResultSchema, ModelsListParamsSchema, SkillsStatusParamsSchema, SkillsInstallParamsSchema, SkillsUpdateParamsSchema, CronJobSchema, CronListParamsSchema, CronStatusParamsSchema, CronAddParamsSchema, CronUpdateParamsSchema, CronRemoveParamsSchema, CronRunParamsSchema, CronRunsParamsSchema, LogsTailParamsSchema, LogsTailResultSchema, ChatHistoryParamsSchema, ChatSendParamsSchema, ChatInjectParamsSchema, UpdateRunParamsSchema, PushTestParamsSchema, TickEventSchema, ShutdownEventSchema, ProtocolSchemas, PROTOCOL_VERSION, ErrorCodes, errorShape, };
|
|
@@ -8,6 +8,7 @@ import { ExecApprovalsGetParamsSchema, ExecApprovalsNodeGetParamsSchema, ExecApp
|
|
|
8
8
|
import { ConnectParamsSchema, ErrorShapeSchema, EventFrameSchema, GatewayFrameSchema, HelloOkSchema, RequestFrameSchema, ResponseFrameSchema, ShutdownEventSchema, TickEventSchema, } from "./frames.js";
|
|
9
9
|
import { ChatAbortParamsSchema, ChatEventSchema, ChatHistoryParamsSchema, ChatInjectParamsSchema, ChatSendParamsSchema, LogsTailParamsSchema, LogsTailResultSchema, } from "./logs-chat.js";
|
|
10
10
|
import { NodeDescribeParamsSchema, NodeEventParamsSchema, NodeInvokeParamsSchema, NodeInvokeResultParamsSchema, NodeInvokeRequestEventSchema, NodeListParamsSchema, NodePairApproveParamsSchema, NodePairListParamsSchema, NodePairRejectParamsSchema, NodePairRequestParamsSchema, NodePairVerifyParamsSchema, NodeRenameParamsSchema, } from "./nodes.js";
|
|
11
|
+
import { PushTestParamsSchema } from "./push.js";
|
|
11
12
|
import { SessionsCompactParamsSchema, SessionsDeleteParamsSchema, SessionsListParamsSchema, SessionsPatchParamsSchema, SessionsPreviewParamsSchema, SessionsResetParamsSchema, SessionsResolveParamsSchema, SessionsUsageParamsSchema, } from "./sessions.js";
|
|
12
13
|
import { PresenceEntrySchema, SnapshotSchema, StateVersionSchema } from "./snapshot.js";
|
|
13
14
|
import { WizardCancelParamsSchema, WizardNextParamsSchema, WizardNextResultSchema, WizardStartParamsSchema, WizardStartResultSchema, WizardStatusParamsSchema, WizardStatusResultSchema, WizardStepSchema, } from "./wizard.js";
|
|
@@ -127,6 +128,7 @@ export const ProtocolSchemas = {
|
|
|
127
128
|
ChatInjectParams: ChatInjectParamsSchema,
|
|
128
129
|
ChatEvent: ChatEventSchema,
|
|
129
130
|
UpdateRunParams: UpdateRunParamsSchema,
|
|
131
|
+
PushTestParams: PushTestParamsSchema,
|
|
130
132
|
TickEvent: TickEventSchema,
|
|
131
133
|
ShutdownEvent: ShutdownEventSchema,
|
|
132
134
|
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Type } from "@sinclair/typebox";
|
|
2
|
+
import { NonEmptyString } from "./primitives.js";
|
|
3
|
+
const ApnsEnvironmentSchema = Type.String({ enum: ["sandbox", "production"] });
|
|
4
|
+
export const PushTestParamsSchema = Type.Object({
|
|
5
|
+
nodeId: NonEmptyString,
|
|
6
|
+
title: Type.Optional(Type.String()),
|
|
7
|
+
body: Type.Optional(Type.String()),
|
|
8
|
+
environment: Type.Optional(ApnsEnvironmentSchema),
|
|
9
|
+
}, { additionalProperties: false });
|
|
10
|
+
export const PushTestResultSchema = Type.Object({
|
|
11
|
+
ok: Type.Boolean(),
|
|
12
|
+
status: Type.Integer(),
|
|
13
|
+
apnsId: Type.Optional(Type.String()),
|
|
14
|
+
reason: Type.Optional(Type.String()),
|
|
15
|
+
tokenSuffix: Type.String(),
|
|
16
|
+
topic: Type.String(),
|
|
17
|
+
environment: ApnsEnvironmentSchema,
|
|
18
|
+
}, { additionalProperties: false });
|
|
@@ -9,6 +9,7 @@ export * from "./schema/devices.js";
|
|
|
9
9
|
export * from "./schema/frames.js";
|
|
10
10
|
export * from "./schema/logs-chat.js";
|
|
11
11
|
export * from "./schema/nodes.js";
|
|
12
|
+
export * from "./schema/push.js";
|
|
12
13
|
export * from "./schema/protocol-schemas.js";
|
|
13
14
|
export * from "./schema/sessions.js";
|
|
14
15
|
export * from "./schema/snapshot.js";
|