switchroom 0.19.26 → 0.19.28
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/bin/git-agent-attribution-hook.sh +144 -0
- package/dist/agent-scheduler/index.js +60 -2
- package/dist/auth-broker/index.js +244 -13
- package/dist/cli/autoaccept-poll.js +225 -17
- package/dist/cli/notion-write-pretool.mjs +60 -2
- package/dist/cli/switchroom.js +2843 -1220
- package/dist/host-control/main.js +245 -14
- package/dist/vault/approvals/kernel-server.js +242 -13
- package/dist/vault/broker/server.js +242 -13
- package/package.json +7 -2
- package/profiles/_base/cron-session.sh.hbs +8 -0
- package/profiles/_base/start.sh.hbs +175 -15
- package/telegram-plugin/card-layout.ts +328 -0
- package/telegram-plugin/dist/bridge/bridge.js +94 -1
- package/telegram-plugin/dist/gateway/gateway.js +2544 -1182
- package/telegram-plugin/dist/server.js +97 -1
- package/telegram-plugin/edit-flood-fuse.ts +841 -57
- package/telegram-plugin/flood-429-ledger.ts +526 -0
- package/telegram-plugin/flood-circuit-breaker.ts +18 -0
- package/telegram-plugin/gateway/callback-query-handlers.ts +6 -0
- package/telegram-plugin/gateway/flood-reply-queue.ts +168 -0
- package/telegram-plugin/gateway/gateway.ts +67 -70
- package/telegram-plugin/gateway/mcp-failure-hook.ts +74 -0
- package/telegram-plugin/gateway/narrative-lane.ts +14 -0
- package/telegram-plugin/gateway/outbound-send-path.ts +36 -0
- package/telegram-plugin/gateway/outbox-sweep.ts +183 -6
- package/telegram-plugin/gateway/pinned-message-handler.ts +12 -16
- package/telegram-plugin/gateway/status-pin-retarget.ts +72 -36
- package/telegram-plugin/gateway/status-pin-store.ts +58 -9
- package/telegram-plugin/gateway/worker-pin-reaper.ts +56 -7
- package/telegram-plugin/inline-keyboard-callbacks.ts +202 -21
- package/telegram-plugin/llm-error-present.ts +61 -2
- package/telegram-plugin/mcp-credential-failure.ts +459 -0
- package/telegram-plugin/model-unavailable.ts +8 -0
- package/telegram-plugin/operator-events.ts +110 -5
- package/telegram-plugin/outbound-class.ts +81 -0
- package/telegram-plugin/provider-credit.ts +237 -0
- package/telegram-plugin/scripts/bun-test-ci.sh +36 -6
- package/telegram-plugin/send-gate.ts +24 -2
- package/telegram-plugin/status-no-truncate.ts +10 -48
- package/telegram-plugin/status-pin-driver.ts +33 -45
- package/telegram-plugin/status-pin.ts +18 -1
- package/telegram-plugin/tests/card-golden.test.ts +69 -0
- package/telegram-plugin/tests/card-lifecycle-render.test.ts +362 -0
- package/telegram-plugin/tests/card-type-distinguishability.test.ts +187 -164
- package/telegram-plugin/tests/card-variants.golden.txt +211 -0
- package/telegram-plugin/tests/card-variants.ts +366 -0
- package/telegram-plugin/tests/edit-flood-fuse-ban-awareness.test.ts +373 -0
- package/telegram-plugin/tests/edit-flood-fuse-default-deny.test.ts +319 -0
- package/telegram-plugin/tests/edit-flood-fuse-reply-reserve.test.ts +340 -0
- package/telegram-plugin/tests/edit-flood-fuse.test.ts +11 -2
- package/telegram-plugin/tests/feed-edit-rate-ceiling.test.ts +462 -0
- package/telegram-plugin/tests/finalize-callback-flood-policy.test.ts +298 -0
- package/telegram-plugin/tests/finalize-callback.test.ts +41 -8
- package/telegram-plugin/tests/fixtures/real-429-stream.ts +220 -0
- package/telegram-plugin/tests/flood-429-ledger.test.ts +278 -0
- package/telegram-plugin/tests/flood-429-recorder-wiring.test.ts +128 -0
- package/telegram-plugin/tests/flood-reply-queue.test.ts +418 -0
- package/telegram-plugin/tests/mcp-credential-failure.test.ts +310 -0
- package/telegram-plugin/tests/outbox-sweep-flood-breaker.test.ts +221 -0
- package/telegram-plugin/tests/pinned-card-collapse.test.ts +19 -24
- package/telegram-plugin/tests/pinned-message-handler.test.ts +15 -15
- package/telegram-plugin/tests/provider-credit-402.test.ts +243 -0
- package/telegram-plugin/tests/status-pin-api.test.ts +11 -11
- package/telegram-plugin/tests/status-pin-boot-recovery.test.ts +36 -37
- package/telegram-plugin/tests/status-pin-lifecycle.test.ts +602 -0
- package/telegram-plugin/tests/status-pin-retarget.test.ts +90 -62
- package/telegram-plugin/tests/status-pin-service-message-suppression.test.ts +7 -3
- package/telegram-plugin/tests/status-pin-store.test.ts +109 -60
- package/telegram-plugin/tests/status-pin.test.ts +56 -5
- package/telegram-plugin/tests/test-runner-coverage.test.ts +133 -0
- package/telegram-plugin/tests/worker-activity-feed.test.ts +12 -10
- package/telegram-plugin/tests/worker-feed-coalesce.test.ts +23 -29
- package/telegram-plugin/tests/worker-feed-pin-persistence.test.ts +56 -59
- package/telegram-plugin/tests/worker-feed-terminal-edit-class.test.ts +335 -0
- package/telegram-plugin/tests/worker-visibility-prose-silent-harness.test.ts +1 -1
- package/telegram-plugin/tool-activity-summary.ts +239 -365
- package/telegram-plugin/uat/assertions.ts +22 -11
- package/telegram-plugin/uat/feed-matcher.test.ts +24 -17
- package/telegram-plugin/worker-activity-feed.ts +105 -47
- package/vendor/hindsight-memory/CLAUDE.md +45 -0
- package/vendor/hindsight-memory/scripts/drain_pending.py +433 -11
- package/vendor/hindsight-memory/scripts/lib/config.py +33 -0
- package/vendor/hindsight-memory/scripts/lib/pending.py +193 -28
- package/vendor/hindsight-memory/scripts/recall.py +176 -7
- package/vendor/hindsight-memory/scripts/tests/test_config_recall_passthrough_env.py +170 -0
- package/vendor/hindsight-memory/scripts/tests/test_drain_circuit_breaker.py +401 -0
- package/vendor/hindsight-memory/scripts/tests/test_drain_serialisation.py +286 -0
- package/vendor/hindsight-memory/scripts/tests/test_pending_drops.py +817 -8
- package/vendor/hindsight-memory/scripts/tests/test_recall_min_score.py +464 -0
- package/vendor/hindsight-memory/settings.json +1 -1
- package/vendor/hindsight-memory/tests/test_hooks.py +11 -2
|
@@ -23029,6 +23029,90 @@ function isLitellmProxyAuthMisconfig(text) {
|
|
|
23029
23029
|
return lower.includes("fallback") && lower.includes("x-api-key");
|
|
23030
23030
|
}
|
|
23031
23031
|
|
|
23032
|
+
// provider-credit.ts
|
|
23033
|
+
var PROVIDER_CREDIT_REGISTRY = [
|
|
23034
|
+
{
|
|
23035
|
+
id: "openrouter",
|
|
23036
|
+
label: "OpenRouter",
|
|
23037
|
+
vaultKey: "openrouter/api-key",
|
|
23038
|
+
consoleUrl: "https://openrouter.ai/credits",
|
|
23039
|
+
action: "Top up the OpenRouter balance (or raise the key\u2019s credit limit) in the OpenRouter console.",
|
|
23040
|
+
markers: ["openrouter", "openrouter.ai"]
|
|
23041
|
+
},
|
|
23042
|
+
{
|
|
23043
|
+
id: "openai",
|
|
23044
|
+
label: "OpenAI",
|
|
23045
|
+
vaultKey: "openai/api-key",
|
|
23046
|
+
consoleUrl: "https://platform.openai.com/settings/organization/billing",
|
|
23047
|
+
action: "Add credit / raise the billing limit in the OpenAI console.",
|
|
23048
|
+
markers: ["api.openai.com", "openai.", "openaiexception", "openai_api"]
|
|
23049
|
+
},
|
|
23050
|
+
{
|
|
23051
|
+
id: "perplexity",
|
|
23052
|
+
label: "Perplexity",
|
|
23053
|
+
vaultKey: "perplexity/api-key",
|
|
23054
|
+
consoleUrl: "https://www.perplexity.ai/settings/api",
|
|
23055
|
+
action: "Top up the Perplexity API balance (or re-issue the key) in the Perplexity console.",
|
|
23056
|
+
markers: ["perplexity", "api.perplexity.ai", "pplx"]
|
|
23057
|
+
}
|
|
23058
|
+
];
|
|
23059
|
+
var CREDIT_EXHAUSTION_SIGNALS = [
|
|
23060
|
+
"payment_required",
|
|
23061
|
+
"payment required",
|
|
23062
|
+
"insufficient credits",
|
|
23063
|
+
"insufficient_credits",
|
|
23064
|
+
"more credits are required",
|
|
23065
|
+
"requires more credits",
|
|
23066
|
+
"add more credits",
|
|
23067
|
+
"out of credits",
|
|
23068
|
+
"insufficient_quota",
|
|
23069
|
+
"exceeded your current quota",
|
|
23070
|
+
"billing_hard_limit_reached",
|
|
23071
|
+
"billing hard limit",
|
|
23072
|
+
"insufficient balance",
|
|
23073
|
+
"insufficient_balance",
|
|
23074
|
+
"credit balance is too low",
|
|
23075
|
+
"credit balance too low",
|
|
23076
|
+
"credit_balance_too_low",
|
|
23077
|
+
"no credits remaining",
|
|
23078
|
+
"quota exceeded for credits"
|
|
23079
|
+
];
|
|
23080
|
+
var CREDIT_EXHAUSTION_STATUSES = [402];
|
|
23081
|
+
var MAX_SCAN_CHARS = 16384;
|
|
23082
|
+
function sample(text) {
|
|
23083
|
+
if (typeof text !== "string" || text.length === 0)
|
|
23084
|
+
return "";
|
|
23085
|
+
return (text.length > MAX_SCAN_CHARS ? text.slice(0, MAX_SCAN_CHARS) : text).toLowerCase();
|
|
23086
|
+
}
|
|
23087
|
+
function isProviderCreditStatus(status) {
|
|
23088
|
+
return typeof status === "number" && CREDIT_EXHAUSTION_STATUSES.includes(status);
|
|
23089
|
+
}
|
|
23090
|
+
function hasCreditExhaustionWording(text) {
|
|
23091
|
+
const lower = sample(text);
|
|
23092
|
+
if (lower.length === 0)
|
|
23093
|
+
return false;
|
|
23094
|
+
return CREDIT_EXHAUSTION_SIGNALS.some((s) => lower.includes(s));
|
|
23095
|
+
}
|
|
23096
|
+
function attributeProvider(text) {
|
|
23097
|
+
const lower = sample(text);
|
|
23098
|
+
if (lower.length === 0)
|
|
23099
|
+
return null;
|
|
23100
|
+
for (const entry of PROVIDER_CREDIT_REGISTRY) {
|
|
23101
|
+
if (entry.markers.some((m) => lower.includes(m)))
|
|
23102
|
+
return entry;
|
|
23103
|
+
}
|
|
23104
|
+
return null;
|
|
23105
|
+
}
|
|
23106
|
+
function detectProviderCreditExhaustion(text, status) {
|
|
23107
|
+
if (isProviderCreditStatus(status)) {
|
|
23108
|
+
return { provider: attributeProvider(text), via: "status" };
|
|
23109
|
+
}
|
|
23110
|
+
if (hasCreditExhaustionWording(text)) {
|
|
23111
|
+
return { provider: attributeProvider(text), via: "wording" };
|
|
23112
|
+
}
|
|
23113
|
+
return null;
|
|
23114
|
+
}
|
|
23115
|
+
|
|
23032
23116
|
// operator-events.ts
|
|
23033
23117
|
function classifyClaudeError(raw) {
|
|
23034
23118
|
try {
|
|
@@ -23062,9 +23146,16 @@ ${message}`)) {
|
|
|
23062
23146
|
if (errorType === "invalid_api_key" || errorCode === "invalid_api_key" || sdkCode === "invalid_api_key" || message.toLowerCase().includes("invalid_api_key") || message.toLowerCase().includes("invalid api key")) {
|
|
23063
23147
|
return "credentials-invalid";
|
|
23064
23148
|
}
|
|
23065
|
-
|
|
23149
|
+
const creditScanText = `${errorType}
|
|
23150
|
+
${errorCode}
|
|
23151
|
+
${sdkCode}
|
|
23152
|
+
${message}`;
|
|
23153
|
+
if ((errorType === "credit_balance_too_low" || errorCode === "credit_balance_too_low" || sdkCode === "credit_balance_too_low" || message.toLowerCase().includes("credit_balance_too_low") || message.toLowerCase().includes("credit balance")) && attributeProvider(creditScanText) == null) {
|
|
23066
23154
|
return "credit-exhausted";
|
|
23067
23155
|
}
|
|
23156
|
+
if (detectProviderCreditExhaustion(creditScanText, status) != null) {
|
|
23157
|
+
return "provider-credit-exhausted";
|
|
23158
|
+
}
|
|
23068
23159
|
if (errorType === "rate_limit_error" || errorCode === "rate_limit_error" || sdkCode === "rate_limit_error" || message.toLowerCase().includes("rate_limit_error") || message.toLowerCase().includes("rate limit")) {
|
|
23069
23160
|
return "rate-limited";
|
|
23070
23161
|
}
|
|
@@ -23103,6 +23194,8 @@ var OPERATOR_ACTIONABLE_KINDS = new Set([
|
|
|
23103
23194
|
"credentials-expired",
|
|
23104
23195
|
"credentials-invalid",
|
|
23105
23196
|
"credit-exhausted",
|
|
23197
|
+
"provider-credit-exhausted",
|
|
23198
|
+
"mcp-dependency-blocked",
|
|
23106
23199
|
"proxy-misconfig"
|
|
23107
23200
|
]);
|
|
23108
23201
|
|