@poolzin/pool-bot 2026.3.25 → 2026.3.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agents/model-fallback.js +5 -4
- package/dist/agents/tools/common.js +16 -201
- package/dist/auto-reply/auto-reply/reply/agent-runner-execution.js +502 -0
- package/dist/auto-reply/auto-reply/reply/agent-runner-helpers.js +65 -0
- package/dist/auto-reply/auto-reply/reply/agent-runner-memory.js +160 -0
- package/dist/auto-reply/auto-reply/reply/agent-runner-payloads.js +85 -0
- package/dist/auto-reply/auto-reply/reply/agent-runner-utils.js +101 -0
- package/dist/auto-reply/auto-reply/reply/bash-command.js +338 -0
- package/dist/auto-reply/auto-reply/reply/block-streaming.js +91 -0
- package/dist/auto-reply/auto-reply/reply/commands-approve.js +88 -0
- package/dist/auto-reply/auto-reply/reply/commands-bash.js +26 -0
- package/dist/auto-reply/auto-reply/reply/commands-compact.js +107 -0
- package/dist/auto-reply/auto-reply/reply/commands-config.js +241 -0
- package/dist/auto-reply/auto-reply/reply/commands-context-report.js +295 -0
- package/dist/auto-reply/auto-reply/reply/commands-context.js +30 -0
- package/dist/auto-reply/auto-reply/reply/commands-core.js +151 -0
- package/dist/auto-reply/auto-reply/reply/commands-export-session.js +163 -0
- package/dist/auto-reply/auto-reply/reply/commands-info.js +184 -0
- package/dist/auto-reply/auto-reply/reply/commands-models.js +299 -0
- package/dist/auto-reply/auto-reply/reply/commands-plugin.js +35 -0
- package/dist/auto-reply/auto-reply/reply/commands-ptt.js +171 -0
- package/dist/auto-reply/auto-reply/reply/commands-setunset-standard.js +13 -0
- package/dist/auto-reply/auto-reply/reply/commands-setunset.js +73 -0
- package/dist/auto-reply/auto-reply/reply/commands-slash-parse.js +31 -0
- package/dist/auto-reply/auto-reply/reply/commands-status.js +178 -0
- package/dist/auto-reply/auto-reply/reply/commands-subagents.js +73 -0
- package/dist/auto-reply/auto-reply/reply/commands-system-prompt.js +117 -0
- package/dist/auto-reply/auto-reply/reply/commands-tts.js +231 -0
- package/dist/auto-reply/auto-reply/reply/directive-handling.impl.js +380 -0
- package/dist/auto-reply/auto-reply/reply/followup-runner.js +227 -0
- package/dist/auto-reply/auto-reply/reply/get-reply-directives-apply.js +201 -0
- package/dist/auto-reply/auto-reply/reply/get-reply-directives-utils.js +54 -0
- package/dist/auto-reply/auto-reply/reply/get-reply-directives.js +332 -0
- package/dist/auto-reply/auto-reply/reply/get-reply-inline-actions.js +258 -0
- package/dist/auto-reply/auto-reply/reply/get-reply-run.js +297 -0
- package/dist/auto-reply/auto-reply/reply/groups.js +102 -0
- package/dist/auto-reply/auto-reply/reply/mentions.js +129 -0
- package/dist/auto-reply/auto-reply/reply/reply-delivery.js +92 -0
- package/dist/auto-reply/auto-reply/reply/reply-directives.js +30 -0
- package/dist/auto-reply/auto-reply/reply/reply-dispatcher.js +152 -0
- package/dist/auto-reply/auto-reply/reply/reply-elevated.js +166 -0
- package/dist/auto-reply/auto-reply/reply/reply-inline.js +28 -0
- package/dist/auto-reply/auto-reply/reply/reply-payloads.js +114 -0
- package/dist/auto-reply/auto-reply/reply/reply-reference.js +36 -0
- package/dist/auto-reply/auto-reply/reply/reply-tags.js +13 -0
- package/dist/auto-reply/auto-reply/reply/reply-threading.js +41 -0
- package/dist/auto-reply/auto-reply/reply/session-updates.js +233 -0
- package/dist/auto-reply/auto-reply/reply/stage-sandbox-media.js +146 -0
- package/dist/build-info.json +3 -3
- package/dist/canvas-host/a2ui/.bundle.hash +1 -1
- package/dist/canvas-host/a2ui/a2ui.bundle.js +2 -17772
- package/dist/canvas-host/a2ui/index.html +1 -307
- package/dist/channels/channels/directory-config.js +185 -0
- package/dist/channels/channels/discord/handle-action.guild-admin.js +332 -0
- package/dist/channels/channels/discord/handle-action.js +165 -0
- package/dist/channels/channels/discord.js +413 -0
- package/dist/channels/channels/dock.js +436 -0
- package/dist/channels/channels/index.js +51 -0
- package/dist/channels/channels/plugins/outbound/discord.js +101 -0
- package/dist/channels/channels/whatsapp.js +17 -0
- package/dist/channels/plugins/types.js +1 -1
- package/dist/channels/run-state-machine.js +7 -0
- package/dist/commands/models/auth.js +47 -1
- package/dist/commands-subagents/action-agents.js +44 -0
- package/dist/commands-subagents/action-focus.js +64 -0
- package/dist/commands-subagents/action-help.js +4 -0
- package/dist/commands-subagents/action-info.js +45 -0
- package/dist/commands-subagents/action-kill.js +60 -0
- package/dist/commands-subagents/action-list.js +44 -0
- package/dist/commands-subagents/action-log.js +29 -0
- package/dist/commands-subagents/action-send.js +119 -0
- package/dist/commands-subagents/action-spawn.js +52 -0
- package/dist/commands-subagents/action-unfocus.js +30 -0
- package/dist/commands-subagents/shared.js +303 -0
- package/dist/config/config.js +1 -8
- package/dist/config/types.secrets.js +61 -0
- package/dist/control-ui/assets/{index-D7shnQwQ.js → index-umCsvrWy.js} +884 -741
- package/dist/control-ui/assets/index-umCsvrWy.js.map +1 -0
- package/dist/control-ui/assets/pt-BR-DedEVAvY.js +2 -0
- package/dist/control-ui/assets/pt-BR-DedEVAvY.js.map +1 -0
- package/dist/control-ui/assets/zh-CN-CDzeklK-.js +2 -0
- package/dist/control-ui/assets/zh-CN-CDzeklK-.js.map +1 -0
- package/dist/control-ui/assets/zh-TW-BJCRYNWH.js +2 -0
- package/dist/control-ui/assets/zh-TW-BJCRYNWH.js.map +1 -0
- package/dist/control-ui/index.html +1 -1
- package/dist/gateway/method-scopes.js +9 -1
- package/dist/gateway/node-pending-work.js +142 -0
- package/dist/gateway/protocol/index.js +5 -1
- package/dist/gateway/protocol/schema/nodes.js +18 -0
- package/dist/gateway/server-methods/nodes-pending.js +96 -0
- package/dist/gateway/server-methods-list.js +4 -0
- package/dist/gateway/server-methods.js +2 -0
- package/dist/imessage/channel.js +253 -0
- package/dist/imessage/monitor/echo-cache.js +70 -0
- package/dist/imessage/monitor/loop-rate-limiter.js +51 -0
- package/dist/imessage/monitor/reflection-guard.js +50 -0
- package/dist/imessage/monitor/sanitize-outbound.js +25 -0
- package/dist/imessage/monitor/self-chat-cache.js +75 -0
- package/dist/imessage/runtime.js +3 -0
- package/dist/infra/exec-approval-reply.js +7 -0
- package/dist/infra/tmp-openclaw-dir.js +84 -0
- package/dist/pairing/pairing-challenge.js +15 -0
- package/dist/plugin-sdk/account-id.d.ts +1 -0
- package/dist/plugin-sdk/agent-media-payload.d.ts +12 -0
- package/dist/plugin-sdk/allow-from.d.ts +27 -0
- package/dist/plugin-sdk/command-auth.d.ts +25 -0
- package/dist/plugin-sdk/command-auth.js +3 -1
- package/dist/plugin-sdk/config-paths.d.ts +6 -0
- package/dist/plugin-sdk/file-lock.d.ts +16 -0
- package/dist/plugin-sdk/index.d.ts +428 -0
- package/dist/plugin-sdk/index.js +237 -103
- package/dist/plugin-sdk/json-store.d.ts +5 -0
- package/dist/plugin-sdk/keyed-async-queue.d.ts +12 -0
- package/dist/plugin-sdk/onboarding.d.ts +11 -0
- package/dist/plugin-sdk/provider-auth-result.d.ts +14 -0
- package/dist/plugin-sdk/slack-message-actions.d.ts +11 -0
- package/dist/plugin-sdk/status-helpers.d.ts +25 -0
- package/dist/plugin-sdk/temp-path.d.ts +12 -0
- package/dist/plugin-sdk/text-chunking.d.ts +1 -0
- package/dist/plugin-sdk/tool-send.d.ts +4 -0
- package/dist/plugin-sdk/webhook-path.d.ts +6 -0
- package/dist/plugin-sdk/webhook-targets.d.ts +23 -0
- package/dist/plugin-sdk/windows-spawn.d.ts +39 -0
- package/dist/plugin-sdk-internal/accounts.js +6 -0
- package/dist/plugin-sdk-internal/discord.js +23 -0
- package/dist/plugin-sdk-internal/imessage.js +13 -0
- package/dist/plugin-sdk-internal/setup.js +9 -0
- package/dist/plugin-sdk-internal/signal.js +13 -0
- package/dist/plugin-sdk-internal/slack.js +22 -0
- package/dist/plugin-sdk-internal/telegram.js +32 -0
- package/dist/plugin-sdk-internal/whatsapp.js +29 -0
- package/dist/routing/session-key.js +4 -185
- package/dist/shared/pid-alive.js +2 -61
- package/dist/shared/process-scoped-map.js +5 -7
- package/dist/signal/channel.js +264 -0
- package/dist/signal/monitor/access-policy.js +60 -0
- package/dist/signal/runtime.js +3 -0
- package/dist/slack/account-inspect.js +135 -0
- package/dist/slack/blocks-input.js +7 -38
- package/dist/slack/channel.js +394 -0
- package/dist/slack/interactive-replies.js +28 -0
- package/dist/slack/monitor/channel-type.js +31 -0
- package/dist/slack/monitor/dm-auth.js +49 -0
- package/dist/slack/monitor/events/interactions.modal.js +137 -0
- package/dist/slack/monitor/events/message-subtype-handlers.js +68 -0
- package/dist/slack/monitor/events/system-event-context.js +29 -0
- package/dist/slack/monitor/events/system-event-test-harness.js +41 -0
- package/dist/slack/monitor/external-arg-menu-store.js +46 -0
- package/dist/slack/monitor/message-handler/prepare-content.js +69 -0
- package/dist/slack/monitor/message-handler/prepare-thread-context.js +91 -0
- package/dist/slack/monitor/message-handler/prepare.test-helpers.js +55 -0
- package/dist/slack/monitor/reconnect-policy.js +78 -0
- package/dist/slack/monitor/slash-commands.runtime.js +1 -0
- package/dist/slack/monitor/slash-dispatch.runtime.js +9 -0
- package/dist/slack/monitor/slash-skill-commands.runtime.js +1 -0
- package/dist/slack/resolve-allowlist-common.js +36 -0
- package/dist/slack/runtime.js +3 -0
- package/dist/slack/sent-thread-cache.js +61 -0
- package/dist/slack/truncate.js +10 -0
- package/dist/telegram/account-inspect.js +175 -0
- package/dist/telegram/allow-from.js +10 -0
- package/dist/telegram/api-fetch.js +18 -0
- package/dist/telegram/approval-buttons.js +30 -0
- package/dist/telegram/audit-membership-runtime.js +61 -0
- package/dist/telegram/bot/delivery.replies.js +508 -0
- package/dist/telegram/bot/delivery.resolve-media.js +227 -0
- package/dist/telegram/bot/delivery.send.js +132 -0
- package/dist/telegram/bot/reply-threading.js +46 -0
- package/dist/telegram/bot-message-context.body.js +186 -0
- package/dist/telegram/bot-message-context.session.js +207 -0
- package/dist/telegram/bot-message-context.types.js +1 -0
- package/dist/telegram/bot-native-commands.test-helpers.js +117 -0
- package/dist/telegram/bot.media.e2e-harness.js +81 -0
- package/dist/telegram/bot.media.test-utils.js +81 -0
- package/dist/telegram/channel-actions.js +225 -0
- package/dist/telegram/channel.js +515 -0
- package/dist/telegram/conversation-route.js +107 -0
- package/dist/telegram/delivery.js +2 -0
- package/dist/telegram/delivery.replies.js +508 -0
- package/dist/telegram/dm-access.js +86 -0
- package/dist/telegram/draft-stream.test-helpers.js +62 -0
- package/dist/telegram/exec-approvals-handler.js +281 -0
- package/dist/telegram/exec-approvals.js +62 -0
- package/dist/telegram/forum-service-message.js +22 -0
- package/dist/telegram/group-config-helpers.js +10 -0
- package/dist/telegram/lane-delivery-state.js +19 -0
- package/dist/telegram/lane-delivery-text-deliverer.js +357 -0
- package/dist/telegram/lane-delivery.js +2 -0
- package/dist/telegram/normalize.js +37 -0
- package/dist/telegram/onboarding.js +192 -0
- package/dist/telegram/outbound-adapter.js +100 -0
- package/dist/telegram/polling-session.js +275 -0
- package/dist/telegram/runtime.js +3 -0
- package/dist/telegram/sendchataction-401-backoff.js +71 -0
- package/dist/telegram/sequential-key.js +46 -0
- package/dist/telegram/status-issues.js +105 -0
- package/dist/telegram/target-writeback.js +165 -0
- package/dist/telegram/thread-bindings.js +560 -0
- package/dist/utils.js +32 -257
- package/dist/wizard/prompts.js +5 -5
- package/extensions/feishu/src/policy.ts +1 -1
- package/extensions/firecrawl/index.test.ts +82 -0
- package/extensions/firecrawl/index.ts +20 -0
- package/extensions/firecrawl/openclaw.plugin.json +8 -0
- package/extensions/firecrawl/package.json +12 -0
- package/extensions/firecrawl/src/config.ts +159 -0
- package/extensions/firecrawl/src/firecrawl-client.ts +446 -0
- package/extensions/firecrawl/src/firecrawl-scrape-tool.ts +89 -0
- package/extensions/firecrawl/src/firecrawl-search-provider.ts +63 -0
- package/extensions/firecrawl/src/firecrawl-search-tool.ts +76 -0
- package/package.json +1 -1
- package/dist/.buildstamp +0 -1
- package/dist/acp/bindings-store.js +0 -209
- package/dist/acp/control-plane/runtime-cache.js +0 -54
- package/dist/acp/control-plane/runtime-options.js +0 -215
- package/dist/acp/control-plane/session-actor-queue.js +0 -36
- package/dist/acp/index.js +0 -2
- package/dist/acp/runtime/errors.js +0 -47
- package/dist/acp/runtime/registry.js +0 -86
- package/dist/acp/secret-file.js +0 -22
- package/dist/agents/auth-profiles.resolve-auth-profile-order.fixtures.js +0 -23
- package/dist/agents/bash-process-registry.test-helpers.js +0 -29
- package/dist/agents/bash-tools.exec-approval-request.js +0 -20
- package/dist/agents/bash-tools.exec-host-gateway.js +0 -240
- package/dist/agents/bash-tools.exec-host-node.js +0 -235
- package/dist/agents/checkpoint-manager.js +0 -290
- package/dist/agents/claude-cli-runner.js +0 -3
- package/dist/agents/error-classifier.js +0 -251
- package/dist/agents/live-model-filter.js +0 -84
- package/dist/agents/nvidia-models.js +0 -228
- package/dist/agents/pi-embedded-runner/run.overflow-compaction.fixture.js +0 -34
- package/dist/agents/pi-embedded-runner/run.overflow-compaction.mocks.shared.js +0 -156
- package/dist/agents/pi-embedded-subscribe.handlers.tools.media.test-helpers.js +0 -30
- package/dist/agents/provider/config-loader.js +0 -76
- package/dist/agents/provider/index.js +0 -15
- package/dist/agents/provider/models-dev.js +0 -129
- package/dist/agents/provider/session-binding.js +0 -376
- package/dist/agents/queued-file-writer.js +0 -22
- package/dist/agents/skills/bundled-context.js +0 -23
- package/dist/agents/skills/security.js +0 -211
- package/dist/agents/skills/tools-dir.js +0 -9
- package/dist/agents/skills-install-download.js +0 -290
- package/dist/agents/skills-install-output.js +0 -30
- package/dist/agents/skills-install.download-test-utils.js +0 -36
- package/dist/agents/skills.test-helpers.js +0 -13
- package/dist/agents/subagent-announce-reliability.js +0 -160
- package/dist/agents/subagent-registry.mocks.shared.js +0 -12
- package/dist/agents/test-helpers/assistant-message-fixtures.js +0 -29
- package/dist/agents/test-helpers/fast-coding-tools.js +0 -1
- package/dist/agents/test-helpers/fast-core-tools.js +0 -8
- package/dist/agents/test-helpers/fast-tool-stubs.js +0 -18
- package/dist/agents/test-helpers/host-sandbox-fs-bridge.js +0 -74
- package/dist/agents/test-helpers/pi-tools-sandbox-context.js +0 -27
- package/dist/agents/tool-display-common.js +0 -915
- package/dist/agents/tool-policy-shared.js +0 -108
- package/dist/agents/tool-policy.conformance.js +0 -14
- package/dist/agents/tool-result-truncation.js +0 -299
- package/dist/agents/tools/cron-tool.test-helpers.js +0 -12
- package/dist/agents/tools/discord-actions-moderation-shared.js +0 -27
- package/dist/agents/tools/discord-actions-presence.js +0 -78
- package/dist/control-ui/assets/index-D7shnQwQ.js.map +0 -1
- package/dist/discord/discord-improvements.js +0 -167
- package/dist/discord/index.js +0 -2
- package/dist/hooks/bundled/boot-md/HOOK.md +0 -19
- package/dist/hooks/bundled/command-logger/HOOK.md +0 -122
- package/dist/hooks/bundled/session-memory/HOOK.md +0 -86
- package/dist/hooks/bundled/soul-evil/HOOK.md +0 -71
- package/dist/whatsapp/normalize.js +0 -66
- package/dist/whatsapp/resolve-outbound-target.js +0 -42
- /package/dist/{acp/runtime/types.js → auto-reply/auto-reply/reply/commands-types.js} +0 -0
- /package/dist/{agents/pi-embedded-payloads.js → slack/account-surface-fields.js} +0 -0
|
@@ -1,290 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Checkpoint Manager - Save/Restore state during long-running executions
|
|
3
|
-
*
|
|
4
|
-
* Features:
|
|
5
|
-
* - Save execution state with metadata
|
|
6
|
-
* - Restore from checkpoints
|
|
7
|
-
* - Automatic cleanup of old checkpoints
|
|
8
|
-
* - Atomic writes with rollback on failure
|
|
9
|
-
* - Integrity verification via SHA256 hashes
|
|
10
|
-
*
|
|
11
|
-
* Based on Hermes Agent's checkpoint_manager.py
|
|
12
|
-
*/
|
|
13
|
-
import { createHash } from "node:crypto";
|
|
14
|
-
import { promises as fs } from "node:fs";
|
|
15
|
-
import path from "node:path";
|
|
16
|
-
import { createSubsystemLogger } from "../logging/subsystem.js";
|
|
17
|
-
const log = createSubsystemLogger("checkpoint-manager");
|
|
18
|
-
const DEFAULT_CONFIG = {
|
|
19
|
-
checkpointDir: "./checkpoints",
|
|
20
|
-
maxCheckpointsPerSession: 10,
|
|
21
|
-
maxAgeHours: 24,
|
|
22
|
-
enableCompression: true,
|
|
23
|
-
compressionThreshold: 1024 * 1024, // 1MB
|
|
24
|
-
};
|
|
25
|
-
export class CheckpointManager {
|
|
26
|
-
config;
|
|
27
|
-
constructor(config) {
|
|
28
|
-
this.config = { ...DEFAULT_CONFIG, ...config };
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Generate unique checkpoint ID
|
|
32
|
-
*/
|
|
33
|
-
generateCheckpointId() {
|
|
34
|
-
const timestamp = Date.now();
|
|
35
|
-
const random = Math.random().toString(36).substring(2, 10);
|
|
36
|
-
return `chk_${timestamp}_${random}`;
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Calculate SHA256 hash of data for integrity verification
|
|
40
|
-
*/
|
|
41
|
-
calculateHash(data) {
|
|
42
|
-
return createHash("sha256").update(data).digest("hex");
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Get checkpoint directory for a session
|
|
46
|
-
*/
|
|
47
|
-
getSessionCheckpointDir(sessionId) {
|
|
48
|
-
const safeSessionId = sessionId.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
49
|
-
return path.join(this.config.checkpointDir, safeSessionId);
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Get checkpoint file path
|
|
53
|
-
*/
|
|
54
|
-
getCheckpointFilePath(sessionId, checkpointId) {
|
|
55
|
-
return path.join(this.getSessionCheckpointDir(sessionId), `${checkpointId}.json`);
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Save a checkpoint
|
|
59
|
-
*/
|
|
60
|
-
async saveCheckpoint(sessionId, data, options) {
|
|
61
|
-
const checkpointId = this.generateCheckpointId();
|
|
62
|
-
const sessionDir = this.getSessionCheckpointDir(sessionId);
|
|
63
|
-
// Ensure directory exists
|
|
64
|
-
await fs.mkdir(sessionDir, { recursive: true });
|
|
65
|
-
// Serialize data
|
|
66
|
-
const serializedData = JSON.stringify(data, null, 2);
|
|
67
|
-
const sizeBytes = Buffer.byteLength(serializedData, "utf-8");
|
|
68
|
-
const hash = this.calculateHash(serializedData);
|
|
69
|
-
// Create metadata
|
|
70
|
-
const metadata = {
|
|
71
|
-
id: checkpointId,
|
|
72
|
-
sessionId,
|
|
73
|
-
name: options?.name || `checkpoint-${checkpointId.substring(0, 8)}`,
|
|
74
|
-
description: options?.description,
|
|
75
|
-
createdAt: Date.now(),
|
|
76
|
-
sizeBytes,
|
|
77
|
-
hash,
|
|
78
|
-
compression: "none",
|
|
79
|
-
tags: options?.tags,
|
|
80
|
-
};
|
|
81
|
-
// Write checkpoint atomically (write to temp file, then rename)
|
|
82
|
-
const tempPath = `${this.getCheckpointFilePath(sessionId, checkpointId)}.tmp`;
|
|
83
|
-
const finalPath = this.getCheckpointFilePath(sessionId, checkpointId);
|
|
84
|
-
try {
|
|
85
|
-
const store = {
|
|
86
|
-
metadata,
|
|
87
|
-
data,
|
|
88
|
-
};
|
|
89
|
-
await fs.writeFile(tempPath, JSON.stringify(store, null, 2), "utf-8");
|
|
90
|
-
await fs.rename(tempPath, finalPath);
|
|
91
|
-
log.debug(`Saved checkpoint ${checkpointId} for session ${sessionId} (${sizeBytes} bytes)`);
|
|
92
|
-
// Cleanup old checkpoints
|
|
93
|
-
await this.cleanupOldCheckpoints(sessionId);
|
|
94
|
-
return metadata;
|
|
95
|
-
}
|
|
96
|
-
catch (error) {
|
|
97
|
-
// Cleanup temp file on failure
|
|
98
|
-
try {
|
|
99
|
-
await fs.unlink(tempPath);
|
|
100
|
-
}
|
|
101
|
-
catch {
|
|
102
|
-
// Ignore cleanup errors
|
|
103
|
-
}
|
|
104
|
-
throw error;
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
/**
|
|
108
|
-
* Load a checkpoint by ID
|
|
109
|
-
*/
|
|
110
|
-
async loadCheckpoint(sessionId, checkpointId) {
|
|
111
|
-
const checkpointPath = this.getCheckpointFilePath(sessionId, checkpointId);
|
|
112
|
-
try {
|
|
113
|
-
const content = await fs.readFile(checkpointPath, "utf-8");
|
|
114
|
-
const store = JSON.parse(content);
|
|
115
|
-
// Verify integrity
|
|
116
|
-
const serializedData = JSON.stringify(store.data, null, 2);
|
|
117
|
-
const calculatedHash = this.calculateHash(serializedData);
|
|
118
|
-
if (calculatedHash !== store.metadata.hash) {
|
|
119
|
-
log.warn(`Checkpoint ${checkpointId} integrity check failed`);
|
|
120
|
-
return null;
|
|
121
|
-
}
|
|
122
|
-
return store;
|
|
123
|
-
}
|
|
124
|
-
catch (error) {
|
|
125
|
-
if (error.code === "ENOENT") {
|
|
126
|
-
return null;
|
|
127
|
-
}
|
|
128
|
-
throw error;
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
/**
|
|
132
|
-
* List all checkpoints for a session
|
|
133
|
-
*/
|
|
134
|
-
async listCheckpoints(sessionId) {
|
|
135
|
-
const sessionDir = this.getSessionCheckpointDir(sessionId);
|
|
136
|
-
try {
|
|
137
|
-
const files = await fs.readdir(sessionDir);
|
|
138
|
-
const checkpoints = [];
|
|
139
|
-
for (const file of files) {
|
|
140
|
-
if (!file.endsWith(".json")) {
|
|
141
|
-
continue;
|
|
142
|
-
}
|
|
143
|
-
const checkpointId = file.replace(".json", "");
|
|
144
|
-
const store = await this.loadCheckpoint(sessionId, checkpointId);
|
|
145
|
-
if (store) {
|
|
146
|
-
checkpoints.push(store.metadata);
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
// Sort by creation time (newest first)
|
|
150
|
-
return checkpoints.sort((a, b) => b.createdAt - a.createdAt);
|
|
151
|
-
}
|
|
152
|
-
catch (error) {
|
|
153
|
-
if (error.code === "ENOENT") {
|
|
154
|
-
return [];
|
|
155
|
-
}
|
|
156
|
-
throw error;
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
/**
|
|
160
|
-
* Delete a checkpoint
|
|
161
|
-
*/
|
|
162
|
-
async deleteCheckpoint(sessionId, checkpointId) {
|
|
163
|
-
const checkpointPath = this.getCheckpointFilePath(sessionId, checkpointId);
|
|
164
|
-
try {
|
|
165
|
-
await fs.unlink(checkpointPath);
|
|
166
|
-
log.debug(`Deleted checkpoint ${checkpointId} for session ${sessionId}`);
|
|
167
|
-
return true;
|
|
168
|
-
}
|
|
169
|
-
catch (error) {
|
|
170
|
-
if (error.code === "ENOENT") {
|
|
171
|
-
return false;
|
|
172
|
-
}
|
|
173
|
-
throw error;
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
/**
|
|
177
|
-
* Get the latest checkpoint for a session
|
|
178
|
-
*/
|
|
179
|
-
async getLatestCheckpoint(sessionId) {
|
|
180
|
-
const checkpoints = await this.listCheckpoints(sessionId);
|
|
181
|
-
if (checkpoints.length === 0) {
|
|
182
|
-
return null;
|
|
183
|
-
}
|
|
184
|
-
const latest = checkpoints[0]; // Already sorted newest first
|
|
185
|
-
return this.loadCheckpoint(sessionId, latest.id);
|
|
186
|
-
}
|
|
187
|
-
/**
|
|
188
|
-
* Cleanup old checkpoints
|
|
189
|
-
* - Keep only maxCheckpointsPerSession
|
|
190
|
-
* - Remove checkpoints older than maxAgeHours
|
|
191
|
-
*/
|
|
192
|
-
async cleanupOldCheckpoints(sessionId) {
|
|
193
|
-
const checkpoints = await this.listCheckpoints(sessionId);
|
|
194
|
-
const now = Date.now();
|
|
195
|
-
const maxAgeMs = this.config.maxAgeHours * 60 * 60 * 1000;
|
|
196
|
-
let deleted = 0;
|
|
197
|
-
for (let i = 0; i < checkpoints.length; i++) {
|
|
198
|
-
const checkpoint = checkpoints[i];
|
|
199
|
-
const age = now - checkpoint.createdAt;
|
|
200
|
-
const isTooOld = age > maxAgeMs;
|
|
201
|
-
const isBeyondMax = i >= this.config.maxCheckpointsPerSession;
|
|
202
|
-
if (isTooOld || isBeyondMax) {
|
|
203
|
-
await this.deleteCheckpoint(sessionId, checkpoint.id);
|
|
204
|
-
deleted++;
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
const kept = checkpoints.length - deleted;
|
|
208
|
-
if (deleted > 0) {
|
|
209
|
-
log.debug(`Cleaned up ${deleted} old checkpoints for session ${sessionId} (kept ${kept})`);
|
|
210
|
-
}
|
|
211
|
-
return { deleted, kept };
|
|
212
|
-
}
|
|
213
|
-
/**
|
|
214
|
-
* Cleanup all checkpoints for all sessions
|
|
215
|
-
*/
|
|
216
|
-
async cleanupAllCheckpoints() {
|
|
217
|
-
let totalDeleted = 0;
|
|
218
|
-
let sessionsProcessed = 0;
|
|
219
|
-
try {
|
|
220
|
-
const sessionDirs = await fs.readdir(this.config.checkpointDir);
|
|
221
|
-
for (const sessionDir of sessionDirs) {
|
|
222
|
-
const fullPath = path.join(this.config.checkpointDir, sessionDir);
|
|
223
|
-
const stat = await fs.stat(fullPath);
|
|
224
|
-
if (stat.isDirectory()) {
|
|
225
|
-
const sessionId = sessionDir;
|
|
226
|
-
const result = await this.cleanupOldCheckpoints(sessionId);
|
|
227
|
-
totalDeleted += result.deleted;
|
|
228
|
-
sessionsProcessed++;
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
catch (error) {
|
|
233
|
-
if (error.code !== "ENOENT") {
|
|
234
|
-
throw error;
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
log.debug(`Global checkpoint cleanup: deleted ${totalDeleted} from ${sessionsProcessed} sessions`);
|
|
238
|
-
return { totalDeleted, sessionsProcessed };
|
|
239
|
-
}
|
|
240
|
-
/**
|
|
241
|
-
* Get checkpoint statistics
|
|
242
|
-
*/
|
|
243
|
-
async getStats() {
|
|
244
|
-
const stats = {
|
|
245
|
-
totalCheckpoints: 0,
|
|
246
|
-
totalSessions: 0,
|
|
247
|
-
totalSizeBytes: 0,
|
|
248
|
-
oldestCheckpoint: undefined,
|
|
249
|
-
newestCheckpoint: undefined,
|
|
250
|
-
};
|
|
251
|
-
try {
|
|
252
|
-
const sessionDirs = await fs.readdir(this.config.checkpointDir);
|
|
253
|
-
for (const sessionDir of sessionDirs) {
|
|
254
|
-
const fullPath = path.join(this.config.checkpointDir, sessionDir);
|
|
255
|
-
const stat = await fs.stat(fullPath);
|
|
256
|
-
if (stat.isDirectory()) {
|
|
257
|
-
stats.totalSessions++;
|
|
258
|
-
const checkpoints = await this.listCheckpoints(sessionDir);
|
|
259
|
-
for (const checkpoint of checkpoints) {
|
|
260
|
-
stats.totalCheckpoints++;
|
|
261
|
-
stats.totalSizeBytes += checkpoint.sizeBytes;
|
|
262
|
-
if (!stats.oldestCheckpoint || checkpoint.createdAt < stats.oldestCheckpoint) {
|
|
263
|
-
stats.oldestCheckpoint = checkpoint.createdAt;
|
|
264
|
-
}
|
|
265
|
-
if (!stats.newestCheckpoint || checkpoint.createdAt > stats.newestCheckpoint) {
|
|
266
|
-
stats.newestCheckpoint = checkpoint.createdAt;
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
catch (error) {
|
|
273
|
-
if (error.code !== "ENOENT") {
|
|
274
|
-
throw error;
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
return stats;
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
// Export singleton instance for convenience
|
|
281
|
-
let globalCheckpointManager;
|
|
282
|
-
export function getCheckpointManager(config) {
|
|
283
|
-
if (!globalCheckpointManager) {
|
|
284
|
-
globalCheckpointManager = new CheckpointManager(config);
|
|
285
|
-
}
|
|
286
|
-
return globalCheckpointManager;
|
|
287
|
-
}
|
|
288
|
-
export function resetCheckpointManager() {
|
|
289
|
-
globalCheckpointManager = undefined;
|
|
290
|
-
}
|
|
@@ -1,251 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Error Classification System
|
|
3
|
-
*
|
|
4
|
-
* Provides comprehensive error classification for LLM/AI operations.
|
|
5
|
-
* Detects specific error types like context overflow, rate limits, etc.
|
|
6
|
-
*/
|
|
7
|
-
// OpenAI error patterns
|
|
8
|
-
const OPENAI_PATTERNS = {
|
|
9
|
-
context_overflow: [
|
|
10
|
-
/context length exceeded/i,
|
|
11
|
-
/maximum context length/i,
|
|
12
|
-
/token limit exceeded/i,
|
|
13
|
-
/too many tokens/i,
|
|
14
|
-
/rate_limit_exceeded.*context/i,
|
|
15
|
-
],
|
|
16
|
-
rate_limit: [/rate limit exceeded/i, /too many requests/i, /ratelimit/i],
|
|
17
|
-
authentication: [/invalid api key/i, /incorrect api key/i, /authentication/i, /unauthorized/i],
|
|
18
|
-
invalid_request: [/invalid_request_error/i, /bad request/i, /invalid parameter/i],
|
|
19
|
-
};
|
|
20
|
-
// Anthropic error patterns
|
|
21
|
-
const ANTHROPIC_PATTERNS = {
|
|
22
|
-
context_overflow: [/context window exceeded/i, /maximum token count/i, /too many tokens/i],
|
|
23
|
-
rate_limit: [/rate limit/i, /too many requests/i],
|
|
24
|
-
authentication: [/invalid api key/i, /authentication failed/i],
|
|
25
|
-
authorization: [
|
|
26
|
-
/forbidden/i,
|
|
27
|
-
/access denied/i,
|
|
28
|
-
/unauthorized.*resource/i,
|
|
29
|
-
/insufficient.*permission/i,
|
|
30
|
-
],
|
|
31
|
-
};
|
|
32
|
-
// Google/Gemini error patterns
|
|
33
|
-
const GEMINI_PATTERNS = {
|
|
34
|
-
context_overflow: [/token limit exceeded/i, /maximum input size/i, /context too long/i],
|
|
35
|
-
rate_limit: [/rate limit exceeded/i, /quota exceeded/i, /too many requests/i],
|
|
36
|
-
quota_exceeded: [/quota exceeded/i, /billing limit/i, /project quota/i],
|
|
37
|
-
};
|
|
38
|
-
// Generic patterns
|
|
39
|
-
const GENERIC_PATTERNS = {
|
|
40
|
-
context_overflow: [
|
|
41
|
-
/context.*overflow/i,
|
|
42
|
-
/context.*exceeded/i,
|
|
43
|
-
/token.*limit/i,
|
|
44
|
-
/maximum.*context/i,
|
|
45
|
-
/message too long/i,
|
|
46
|
-
/input too long/i,
|
|
47
|
-
],
|
|
48
|
-
rate_limit: [/rate.?limit/i, /too many requests/i, /throttled/i, /429/i],
|
|
49
|
-
timeout: [/timeout/i, /timed out/i, /etimedout/i],
|
|
50
|
-
network_error: [/network error/i, /econnreset/i, /econnrefused/i, /enotfound/i, /network/i],
|
|
51
|
-
server_error: [/server error/i, /internal error/i, /500/i, /502/i, /503/i, /504/i],
|
|
52
|
-
compaction_failure: [/compaction failed/i, /summarization failed/i, /failed to compact/i],
|
|
53
|
-
};
|
|
54
|
-
/**
|
|
55
|
-
* Classify an error based on message patterns
|
|
56
|
-
*/
|
|
57
|
-
export function classifyError(error) {
|
|
58
|
-
if (!(error instanceof Error)) {
|
|
59
|
-
return {
|
|
60
|
-
type: "unknown",
|
|
61
|
-
retryable: false,
|
|
62
|
-
message: String(error),
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
const message = error.message.toLowerCase();
|
|
66
|
-
// Check context overflow first (highest priority for LLM errors)
|
|
67
|
-
for (const pattern of [
|
|
68
|
-
...OPENAI_PATTERNS.context_overflow,
|
|
69
|
-
...ANTHROPIC_PATTERNS.context_overflow,
|
|
70
|
-
...GEMINI_PATTERNS.context_overflow,
|
|
71
|
-
...GENERIC_PATTERNS.context_overflow,
|
|
72
|
-
]) {
|
|
73
|
-
if (pattern.test(message)) {
|
|
74
|
-
return {
|
|
75
|
-
type: "context_overflow",
|
|
76
|
-
retryable: false,
|
|
77
|
-
message: error.message,
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
// Check quota exceeded (before rate limit to avoid false positives)
|
|
82
|
-
for (const pattern of GEMINI_PATTERNS.quota_exceeded) {
|
|
83
|
-
if (pattern.test(message)) {
|
|
84
|
-
return {
|
|
85
|
-
type: "quota_exceeded",
|
|
86
|
-
retryable: false,
|
|
87
|
-
message: error.message,
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
// Check rate limit
|
|
92
|
-
for (const pattern of [
|
|
93
|
-
...OPENAI_PATTERNS.rate_limit,
|
|
94
|
-
...ANTHROPIC_PATTERNS.rate_limit,
|
|
95
|
-
...GEMINI_PATTERNS.rate_limit,
|
|
96
|
-
...GENERIC_PATTERNS.rate_limit,
|
|
97
|
-
]) {
|
|
98
|
-
if (pattern.test(message)) {
|
|
99
|
-
return {
|
|
100
|
-
type: "rate_limit",
|
|
101
|
-
retryable: true,
|
|
102
|
-
message: error.message,
|
|
103
|
-
};
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
// Check authentication
|
|
107
|
-
for (const pattern of [...OPENAI_PATTERNS.authentication, ...ANTHROPIC_PATTERNS.authentication]) {
|
|
108
|
-
if (pattern.test(message)) {
|
|
109
|
-
return {
|
|
110
|
-
type: "authentication",
|
|
111
|
-
retryable: false,
|
|
112
|
-
message: error.message,
|
|
113
|
-
};
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
// Check authorization (403-like errors)
|
|
117
|
-
for (const pattern of ANTHROPIC_PATTERNS.authorization) {
|
|
118
|
-
if (pattern.test(message)) {
|
|
119
|
-
return {
|
|
120
|
-
type: "authorization",
|
|
121
|
-
retryable: false,
|
|
122
|
-
message: error.message,
|
|
123
|
-
};
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
// Check timeout
|
|
127
|
-
for (const pattern of GENERIC_PATTERNS.timeout) {
|
|
128
|
-
if (pattern.test(message)) {
|
|
129
|
-
return {
|
|
130
|
-
type: "timeout",
|
|
131
|
-
retryable: true,
|
|
132
|
-
message: error.message,
|
|
133
|
-
};
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
// Check network errors
|
|
137
|
-
for (const pattern of GENERIC_PATTERNS.network_error) {
|
|
138
|
-
if (pattern.test(message)) {
|
|
139
|
-
return {
|
|
140
|
-
type: "network_error",
|
|
141
|
-
retryable: true,
|
|
142
|
-
message: error.message,
|
|
143
|
-
};
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
// Check server errors
|
|
147
|
-
for (const pattern of GENERIC_PATTERNS.server_error) {
|
|
148
|
-
if (pattern.test(message)) {
|
|
149
|
-
return {
|
|
150
|
-
type: "server_error",
|
|
151
|
-
retryable: true,
|
|
152
|
-
message: error.message,
|
|
153
|
-
};
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
// Check compaction failure
|
|
157
|
-
for (const pattern of GENERIC_PATTERNS.compaction_failure) {
|
|
158
|
-
if (pattern.test(message)) {
|
|
159
|
-
return {
|
|
160
|
-
type: "compaction_failure",
|
|
161
|
-
retryable: true,
|
|
162
|
-
message: error.message,
|
|
163
|
-
};
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
// Default to unknown
|
|
167
|
-
return {
|
|
168
|
-
type: "unknown",
|
|
169
|
-
retryable: false,
|
|
170
|
-
message: error.message,
|
|
171
|
-
};
|
|
172
|
-
}
|
|
173
|
-
/**
|
|
174
|
-
* Check if error is a context overflow error
|
|
175
|
-
*/
|
|
176
|
-
export function isContextOverflowError(error) {
|
|
177
|
-
const classification = classifyError(error);
|
|
178
|
-
return classification.type === "context_overflow";
|
|
179
|
-
}
|
|
180
|
-
/**
|
|
181
|
-
* Check if error is a rate limit error
|
|
182
|
-
*/
|
|
183
|
-
export function isRateLimitError(error) {
|
|
184
|
-
const classification = classifyError(error);
|
|
185
|
-
return classification.type === "rate_limit";
|
|
186
|
-
}
|
|
187
|
-
/**
|
|
188
|
-
* Check if error is a compaction failure
|
|
189
|
-
*/
|
|
190
|
-
export function isCompactionFailureError(error) {
|
|
191
|
-
const classification = classifyError(error);
|
|
192
|
-
return classification.type === "compaction_failure";
|
|
193
|
-
}
|
|
194
|
-
/**
|
|
195
|
-
* Check if error is likely a context overflow (heuristic)
|
|
196
|
-
*/
|
|
197
|
-
export function isLikelyContextOverflowError(error) {
|
|
198
|
-
if (!(error instanceof Error)) {
|
|
199
|
-
return false;
|
|
200
|
-
}
|
|
201
|
-
const message = error.message.toLowerCase();
|
|
202
|
-
// Check for common indicators
|
|
203
|
-
const indicators = [
|
|
204
|
-
"context",
|
|
205
|
-
"token",
|
|
206
|
-
"length",
|
|
207
|
-
"exceeded",
|
|
208
|
-
"maximum",
|
|
209
|
-
"limit",
|
|
210
|
-
"too long",
|
|
211
|
-
"too many",
|
|
212
|
-
];
|
|
213
|
-
const score = indicators.reduce((acc, indicator) => {
|
|
214
|
-
return acc + (message.includes(indicator) ? 1 : 0);
|
|
215
|
-
}, 0);
|
|
216
|
-
// If 3+ indicators present, likely context overflow
|
|
217
|
-
return score >= 3;
|
|
218
|
-
}
|
|
219
|
-
/**
|
|
220
|
-
* Get retry delay for error type
|
|
221
|
-
*/
|
|
222
|
-
export function getRetryDelayForError(error, attempt) {
|
|
223
|
-
const classification = classifyError(error);
|
|
224
|
-
switch (classification.type) {
|
|
225
|
-
case "rate_limit":
|
|
226
|
-
// Rate limits: start with 2s, double each attempt
|
|
227
|
-
return Math.min(2000 * 2 ** attempt, 60000);
|
|
228
|
-
case "timeout":
|
|
229
|
-
case "network_error":
|
|
230
|
-
// Network issues: start with 500ms
|
|
231
|
-
return Math.min(500 * 2 ** attempt, 30000);
|
|
232
|
-
case "server_error":
|
|
233
|
-
// Server errors: start with 1s
|
|
234
|
-
return Math.min(1000 * 2 ** attempt, 30000);
|
|
235
|
-
case "compaction_failure":
|
|
236
|
-
// Compaction: shorter delays
|
|
237
|
-
return Math.min(500 * 2 ** attempt, 5000);
|
|
238
|
-
default:
|
|
239
|
-
return 1000;
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
/**
|
|
243
|
-
* Format error for logging (sanitized)
|
|
244
|
-
*/
|
|
245
|
-
export function formatErrorForLogging(error) {
|
|
246
|
-
if (error instanceof Error) {
|
|
247
|
-
const classification = classifyError(error);
|
|
248
|
-
return `[${classification.type}] ${classification.message}`;
|
|
249
|
-
}
|
|
250
|
-
return `[unknown] ${String(error)}`;
|
|
251
|
-
}
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
const ANTHROPIC_PREFIXES = [
|
|
2
|
-
"claude-opus-4-6",
|
|
3
|
-
"claude-sonnet-4-6",
|
|
4
|
-
"claude-opus-4-5",
|
|
5
|
-
"claude-sonnet-4-5",
|
|
6
|
-
"claude-haiku-4-5",
|
|
7
|
-
];
|
|
8
|
-
const OPENAI_MODELS = ["gpt-5.2", "gpt-5.0"];
|
|
9
|
-
const CODEX_MODELS = [
|
|
10
|
-
"gpt-5.2",
|
|
11
|
-
"gpt-5.2-codex",
|
|
12
|
-
"gpt-5.3-codex",
|
|
13
|
-
"gpt-5.3-codex-spark",
|
|
14
|
-
"gpt-5.1-codex",
|
|
15
|
-
"gpt-5.1-codex-mini",
|
|
16
|
-
"gpt-5.1-codex-max",
|
|
17
|
-
];
|
|
18
|
-
const GOOGLE_PREFIXES = ["gemini-3"];
|
|
19
|
-
const ZAI_PREFIXES = ["glm-5", "glm-4.7", "glm-4.7-flash", "glm-4.7-flashx"];
|
|
20
|
-
const MINIMAX_PREFIXES = ["minimax-m2.1", "minimax-m2.5"];
|
|
21
|
-
const XAI_PREFIXES = ["grok-4"];
|
|
22
|
-
function matchesPrefix(id, prefixes) {
|
|
23
|
-
return prefixes.some((prefix) => id.startsWith(prefix));
|
|
24
|
-
}
|
|
25
|
-
function matchesExactOrPrefix(id, values) {
|
|
26
|
-
return values.some((value) => id === value || id.startsWith(value));
|
|
27
|
-
}
|
|
28
|
-
function matchesAny(id, values) {
|
|
29
|
-
return values.some((value) => id.includes(value));
|
|
30
|
-
}
|
|
31
|
-
export function isModernModelRef(ref) {
|
|
32
|
-
const provider = ref.provider?.trim().toLowerCase() ?? "";
|
|
33
|
-
const id = ref.id?.trim().toLowerCase() ?? "";
|
|
34
|
-
if (!provider || !id) {
|
|
35
|
-
return false;
|
|
36
|
-
}
|
|
37
|
-
if (provider === "anthropic") {
|
|
38
|
-
return matchesPrefix(id, ANTHROPIC_PREFIXES);
|
|
39
|
-
}
|
|
40
|
-
if (provider === "openai") {
|
|
41
|
-
return matchesExactOrPrefix(id, OPENAI_MODELS);
|
|
42
|
-
}
|
|
43
|
-
if (provider === "openai-codex") {
|
|
44
|
-
return matchesExactOrPrefix(id, CODEX_MODELS);
|
|
45
|
-
}
|
|
46
|
-
if (provider === "google" || provider === "google-gemini-cli") {
|
|
47
|
-
return matchesPrefix(id, GOOGLE_PREFIXES);
|
|
48
|
-
}
|
|
49
|
-
if (provider === "google-antigravity") {
|
|
50
|
-
return matchesPrefix(id, GOOGLE_PREFIXES) || matchesPrefix(id, ANTHROPIC_PREFIXES);
|
|
51
|
-
}
|
|
52
|
-
if (provider === "zai") {
|
|
53
|
-
return matchesPrefix(id, ZAI_PREFIXES);
|
|
54
|
-
}
|
|
55
|
-
if (provider === "minimax") {
|
|
56
|
-
return matchesPrefix(id, MINIMAX_PREFIXES);
|
|
57
|
-
}
|
|
58
|
-
if (provider === "xai") {
|
|
59
|
-
return matchesPrefix(id, XAI_PREFIXES);
|
|
60
|
-
}
|
|
61
|
-
if (provider === "opencode" && id.endsWith("-free")) {
|
|
62
|
-
return false;
|
|
63
|
-
}
|
|
64
|
-
if (provider === "opencode" && id === "alpha-glm-4.7") {
|
|
65
|
-
return false;
|
|
66
|
-
}
|
|
67
|
-
// Opencode MiniMax variants have been intermittently unstable in live runs;
|
|
68
|
-
// prefer the rest of the modern catalog for deterministic smoke coverage.
|
|
69
|
-
if (provider === "opencode" && matchesPrefix(id, MINIMAX_PREFIXES)) {
|
|
70
|
-
return false;
|
|
71
|
-
}
|
|
72
|
-
if (provider === "openrouter" || provider === "opencode") {
|
|
73
|
-
return matchesAny(id, [
|
|
74
|
-
...ANTHROPIC_PREFIXES,
|
|
75
|
-
...OPENAI_MODELS,
|
|
76
|
-
...CODEX_MODELS,
|
|
77
|
-
...GOOGLE_PREFIXES,
|
|
78
|
-
...ZAI_PREFIXES,
|
|
79
|
-
...MINIMAX_PREFIXES,
|
|
80
|
-
...XAI_PREFIXES,
|
|
81
|
-
]);
|
|
82
|
-
}
|
|
83
|
-
return false;
|
|
84
|
-
}
|