switchroom 0.11.1 → 0.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +32 -16
- package/dist/agent-scheduler/index.js +216 -97
- package/dist/auth-broker/index.js +176 -97
- package/dist/cli/drive-write-pretool.mjs +26 -11
- package/dist/cli/skill-validate-pretool.mjs +7209 -0
- package/dist/cli/switchroom.js +45571 -42642
- package/dist/cli/ui/index.html +1281 -0
- package/dist/host-control/main.js +3628 -309
- package/dist/vault/approvals/kernel-server.js +207 -98
- package/dist/vault/broker/server.js +249 -119
- package/examples/personal-google-workspace-mcp/README.md +8 -3
- package/examples/switchroom.yaml +91 -42
- package/package.json +4 -3
- package/profiles/_base/start.sh.hbs +76 -36
- package/profiles/_shared/agent-self-service.md.hbs +1 -1
- package/profiles/default/CLAUDE.md.hbs +4 -2
- package/skills/file-bug/SKILL.md +6 -4
- package/skills/skill-creator/SKILL.md +52 -0
- package/skills/switchroom-cli/SKILL.md +20 -4
- package/skills/switchroom-install/SKILL.md +3 -3
- package/telegram-plugin/auth-snapshot-format.ts +9 -9
- package/telegram-plugin/card-format.ts +3 -3
- package/telegram-plugin/dist/bridge/bridge.js +112 -112
- package/telegram-plugin/dist/gateway/gateway.js +853 -414
- package/telegram-plugin/dist/server.js +162 -161
- package/telegram-plugin/format.ts +71 -0
- package/telegram-plugin/gateway/access-validator.test.ts +8 -8
- package/telegram-plugin/gateway/access-validator.ts +1 -1
- package/telegram-plugin/gateway/approval-card.test.ts +18 -18
- package/telegram-plugin/gateway/approval-card.ts +1 -1
- package/telegram-plugin/gateway/auth-command.ts +2 -2
- package/telegram-plugin/gateway/boot-card.ts +40 -3
- package/telegram-plugin/gateway/boot-probes.ts +114 -30
- package/telegram-plugin/gateway/diff-preview-card.test.ts +15 -15
- package/telegram-plugin/gateway/diff-preview-card.ts +1 -1
- package/telegram-plugin/gateway/drive-write-approval.test.ts +2 -2
- package/telegram-plugin/gateway/gateway.ts +265 -22
- package/telegram-plugin/gateway/update-announce.ts +167 -0
- package/telegram-plugin/quota-check.ts +0 -195
- package/telegram-plugin/recent-outbound-dedup.ts +1 -1
- package/telegram-plugin/registry/turns-schema.ts +1 -1
- package/telegram-plugin/retry-api-call.ts +24 -0
- package/telegram-plugin/server.ts +8 -5
- package/telegram-plugin/tests/auth-add-flow.test.ts +32 -3
- package/telegram-plugin/tests/auth-command-format2.test.ts +4 -4
- package/telegram-plugin/tests/auth-snapshot-format.test.ts +17 -17
- package/telegram-plugin/tests/auto-fallback-fleet.test.ts +10 -10
- package/telegram-plugin/tests/boot-probes.test.ts +90 -2
- package/telegram-plugin/tests/bot-runtime.test.ts +23 -1
- package/telegram-plugin/tests/fixtures/service-log-current-claude-code.bin +1 -1
- package/telegram-plugin/tests/fleet-state.test.ts +3 -2
- package/telegram-plugin/tests/quota-check.test.ts +0 -409
- package/telegram-plugin/tests/retry-api-call.test.ts +76 -0
- package/telegram-plugin/tests/secret-detect-audit.test.ts +1 -1
- package/telegram-plugin/tests/secret-detect-pipeline.test.ts +7 -6
- package/telegram-plugin/tests/secret-detect-suppressor-no-silent-allow.test.ts +6 -5
- package/telegram-plugin/tests/secret-detect.test.ts +8 -8
- package/telegram-plugin/tests/telegram-format.test.ts +84 -1
- package/telegram-plugin/tests/update-announce.test.ts +154 -0
- package/telegram-plugin/tests/vault-grant-inbound-builders.test.ts +8 -8
- package/telegram-plugin/tests/vault-request-access-tool.test.ts +51 -0
- package/telegram-plugin/welcome-text.ts +1 -8
- package/profiles/default/CLAUDE.md +0 -192
- package/skills/docx/scripts/office/validators/__pycache__/__init__.cpython-313.pyc +0 -0
- package/skills/docx/scripts/office/validators/__pycache__/base.cpython-313.pyc +0 -0
- package/skills/skill-creator/scripts/__pycache__/__init__.cpython-313.pyc +0 -0
- package/skills/skill-creator/scripts/__pycache__/generate_report.cpython-313.pyc +0 -0
- package/skills/skill-creator/scripts/__pycache__/improve_description.cpython-313.pyc +0 -0
- package/skills/skill-creator/scripts/__pycache__/run_eval.cpython-313.pyc +0 -0
- package/skills/skill-creator/scripts/__pycache__/run_loop.cpython-313.pyc +0 -0
- package/skills/skill-creator/scripts/__pycache__/utils.cpython-313.pyc +0 -0
- package/telegram-plugin/first-paint.ts +0 -225
- package/telegram-plugin/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +0 -1
- package/telegram-plugin/server.js +0 -41795
- package/telegram-plugin/tests/html-balanced.ts +0 -63
- package/telegram-plugin/tests/snapshot-serializer.ts +0 -79
- package/telegram-plugin/tool-error-filter.ts +0 -89
|
@@ -66,7 +66,7 @@ var __export = (target, all) => {
|
|
|
66
66
|
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
67
67
|
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
68
68
|
|
|
69
|
-
//
|
|
69
|
+
// ../../switchroom/node_modules/.bun/grammy@1.42.0/node_modules/grammy/out/filter.js
|
|
70
70
|
var require_filter = __commonJS((exports) => {
|
|
71
71
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
72
72
|
exports.matchFilter = matchFilter;
|
|
@@ -430,7 +430,7 @@ var require_filter = __commonJS((exports) => {
|
|
|
430
430
|
};
|
|
431
431
|
});
|
|
432
432
|
|
|
433
|
-
//
|
|
433
|
+
// ../../switchroom/node_modules/.bun/grammy@1.42.0/node_modules/grammy/out/context.js
|
|
434
434
|
var require_context = __commonJS((exports) => {
|
|
435
435
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
436
436
|
exports.Context = undefined;
|
|
@@ -1457,7 +1457,7 @@ var require_context = __commonJS((exports) => {
|
|
|
1457
1457
|
}
|
|
1458
1458
|
});
|
|
1459
1459
|
|
|
1460
|
-
//
|
|
1460
|
+
// ../../switchroom/node_modules/.bun/grammy@1.42.0/node_modules/grammy/out/composer.js
|
|
1461
1461
|
var require_composer = __commonJS((exports) => {
|
|
1462
1462
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1463
1463
|
exports.Composer = exports.BotError = undefined;
|
|
@@ -1619,7 +1619,7 @@ var require_composer = __commonJS((exports) => {
|
|
|
1619
1619
|
exports.Composer = Composer;
|
|
1620
1620
|
});
|
|
1621
1621
|
|
|
1622
|
-
//
|
|
1622
|
+
// ../../switchroom/node_modules/.bun/ms@2.1.3/node_modules/ms/index.js
|
|
1623
1623
|
var require_ms = __commonJS((exports, module) => {
|
|
1624
1624
|
var s = 1000;
|
|
1625
1625
|
var m = s * 60;
|
|
@@ -1729,7 +1729,7 @@ var require_ms = __commonJS((exports, module) => {
|
|
|
1729
1729
|
}
|
|
1730
1730
|
});
|
|
1731
1731
|
|
|
1732
|
-
//
|
|
1732
|
+
// ../../switchroom/node_modules/.bun/debug@4.4.3/node_modules/debug/src/common.js
|
|
1733
1733
|
var require_common = __commonJS((exports, module) => {
|
|
1734
1734
|
function setup(env) {
|
|
1735
1735
|
createDebug.debug = createDebug;
|
|
@@ -1904,7 +1904,7 @@ var require_common = __commonJS((exports, module) => {
|
|
|
1904
1904
|
module.exports = setup;
|
|
1905
1905
|
});
|
|
1906
1906
|
|
|
1907
|
-
//
|
|
1907
|
+
// ../../switchroom/node_modules/.bun/debug@4.4.3/node_modules/debug/src/browser.js
|
|
1908
1908
|
var require_browser = __commonJS((exports, module) => {
|
|
1909
1909
|
exports.formatArgs = formatArgs;
|
|
1910
1910
|
exports.save = save;
|
|
@@ -2064,7 +2064,7 @@ var require_browser = __commonJS((exports, module) => {
|
|
|
2064
2064
|
};
|
|
2065
2065
|
});
|
|
2066
2066
|
|
|
2067
|
-
//
|
|
2067
|
+
// ../../switchroom/node_modules/.bun/has-flag@4.0.0/node_modules/has-flag/index.js
|
|
2068
2068
|
var require_has_flag = __commonJS((exports, module) => {
|
|
2069
2069
|
module.exports = (flag, argv = process.argv) => {
|
|
2070
2070
|
const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
|
|
@@ -2074,7 +2074,7 @@ var require_has_flag = __commonJS((exports, module) => {
|
|
|
2074
2074
|
};
|
|
2075
2075
|
});
|
|
2076
2076
|
|
|
2077
|
-
//
|
|
2077
|
+
// ../../switchroom/node_modules/.bun/supports-color@7.2.0/node_modules/supports-color/index.js
|
|
2078
2078
|
var require_supports_color = __commonJS((exports, module) => {
|
|
2079
2079
|
var os = __require("os");
|
|
2080
2080
|
var tty = __require("tty");
|
|
@@ -2173,7 +2173,7 @@ var require_supports_color = __commonJS((exports, module) => {
|
|
|
2173
2173
|
};
|
|
2174
2174
|
});
|
|
2175
2175
|
|
|
2176
|
-
//
|
|
2176
|
+
// ../../switchroom/node_modules/.bun/debug@4.4.3/node_modules/debug/src/node.js
|
|
2177
2177
|
var require_node = __commonJS((exports, module) => {
|
|
2178
2178
|
var tty = __require("tty");
|
|
2179
2179
|
var util = __require("util");
|
|
@@ -2344,7 +2344,7 @@ var require_node = __commonJS((exports, module) => {
|
|
|
2344
2344
|
};
|
|
2345
2345
|
});
|
|
2346
2346
|
|
|
2347
|
-
//
|
|
2347
|
+
// ../../switchroom/node_modules/.bun/debug@4.4.3/node_modules/debug/src/index.js
|
|
2348
2348
|
var require_src = __commonJS((exports, module) => {
|
|
2349
2349
|
if (typeof process === "undefined" || process.type === "renderer" || false || process.__nwjs) {
|
|
2350
2350
|
module.exports = require_browser();
|
|
@@ -2353,7 +2353,7 @@ var require_src = __commonJS((exports, module) => {
|
|
|
2353
2353
|
}
|
|
2354
2354
|
});
|
|
2355
2355
|
|
|
2356
|
-
//
|
|
2356
|
+
// ../../switchroom/node_modules/.bun/grammy@1.42.0/node_modules/grammy/out/platform.node.js
|
|
2357
2357
|
var require_platform_node = __commonJS((exports) => {
|
|
2358
2358
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2359
2359
|
exports.defaultAdapter = exports.itrToStream = exports.debug = undefined;
|
|
@@ -2393,7 +2393,7 @@ var require_platform_node = __commonJS((exports) => {
|
|
|
2393
2393
|
exports.defaultAdapter = "express";
|
|
2394
2394
|
});
|
|
2395
2395
|
|
|
2396
|
-
//
|
|
2396
|
+
// ../../switchroom/node_modules/.bun/grammy@1.42.0/node_modules/grammy/out/core/error.js
|
|
2397
2397
|
var require_error = __commonJS((exports) => {
|
|
2398
2398
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2399
2399
|
exports.HttpError = exports.GrammyError = undefined;
|
|
@@ -2449,10 +2449,10 @@ var require_error = __commonJS((exports) => {
|
|
|
2449
2449
|
}
|
|
2450
2450
|
});
|
|
2451
2451
|
|
|
2452
|
-
//
|
|
2452
|
+
// ../../switchroom/node_modules/.bun/@grammyjs+types@3.26.0/node_modules/@grammyjs/types/mod.js
|
|
2453
2453
|
var exports_mod = {};
|
|
2454
2454
|
|
|
2455
|
-
//
|
|
2455
|
+
// ../../switchroom/node_modules/.bun/grammy@1.42.0/node_modules/grammy/out/types.node.js
|
|
2456
2456
|
var require_types_node = __commonJS((exports) => {
|
|
2457
2457
|
var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
|
|
2458
2458
|
if (k2 === undefined)
|
|
@@ -2543,7 +2543,7 @@ var require_types_node = __commonJS((exports) => {
|
|
|
2543
2543
|
}
|
|
2544
2544
|
});
|
|
2545
2545
|
|
|
2546
|
-
//
|
|
2546
|
+
// ../../switchroom/node_modules/.bun/grammy@1.42.0/node_modules/grammy/out/types.js
|
|
2547
2547
|
var require_types = __commonJS((exports) => {
|
|
2548
2548
|
var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
|
|
2549
2549
|
if (k2 === undefined)
|
|
@@ -2569,7 +2569,7 @@ var require_types = __commonJS((exports) => {
|
|
|
2569
2569
|
__exportStar(require_types_node(), exports);
|
|
2570
2570
|
});
|
|
2571
2571
|
|
|
2572
|
-
//
|
|
2572
|
+
// ../../switchroom/node_modules/.bun/grammy@1.42.0/node_modules/grammy/out/core/payload.js
|
|
2573
2573
|
var require_payload = __commonJS((exports) => {
|
|
2574
2574
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2575
2575
|
exports.requiresFormDataUpload = requiresFormDataUpload;
|
|
@@ -2709,7 +2709,7 @@ content-type:application/octet-stream\r
|
|
|
2709
2709
|
}
|
|
2710
2710
|
});
|
|
2711
2711
|
|
|
2712
|
-
//
|
|
2712
|
+
// ../../switchroom/node_modules/.bun/event-target-shim@5.0.1/node_modules/event-target-shim/dist/event-target-shim.js
|
|
2713
2713
|
var require_event_target_shim = __commonJS((exports, module) => {
|
|
2714
2714
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2715
2715
|
var privateData = new WeakMap;
|
|
@@ -3149,7 +3149,7 @@ var require_event_target_shim = __commonJS((exports, module) => {
|
|
|
3149
3149
|
module.exports.defineEventAttribute = defineEventAttribute;
|
|
3150
3150
|
});
|
|
3151
3151
|
|
|
3152
|
-
//
|
|
3152
|
+
// ../../switchroom/node_modules/.bun/abort-controller@3.0.0/node_modules/abort-controller/dist/abort-controller.js
|
|
3153
3153
|
var require_abort_controller = __commonJS((exports, module) => {
|
|
3154
3154
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3155
3155
|
var eventTargetShim = require_event_target_shim();
|
|
@@ -3229,7 +3229,7 @@ var require_abort_controller = __commonJS((exports, module) => {
|
|
|
3229
3229
|
module.exports.AbortSignal = AbortSignal2;
|
|
3230
3230
|
});
|
|
3231
3231
|
|
|
3232
|
-
//
|
|
3232
|
+
// ../../switchroom/node_modules/.bun/grammy@1.42.0/node_modules/grammy/out/shim.node.js
|
|
3233
3233
|
var require_shim_node = __commonJS((exports) => {
|
|
3234
3234
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3235
3235
|
exports.fetch = exports.AbortController = undefined;
|
|
@@ -3243,7 +3243,7 @@ var require_shim_node = __commonJS((exports) => {
|
|
|
3243
3243
|
} });
|
|
3244
3244
|
});
|
|
3245
3245
|
|
|
3246
|
-
//
|
|
3246
|
+
// ../../switchroom/node_modules/.bun/grammy@1.42.0/node_modules/grammy/out/core/client.js
|
|
3247
3247
|
var require_client = __commonJS((exports) => {
|
|
3248
3248
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3249
3249
|
exports.createRawApi = createRawApi;
|
|
@@ -3423,7 +3423,7 @@ If you want to prevent such mistakes in the future, consider using TypeScript. h
|
|
|
3423
3423
|
var shim_node_js_1 = require_shim_node();
|
|
3424
3424
|
});
|
|
3425
3425
|
|
|
3426
|
-
//
|
|
3426
|
+
// ../../switchroom/node_modules/.bun/grammy@1.42.0/node_modules/grammy/out/core/api.js
|
|
3427
3427
|
var require_api = __commonJS((exports) => {
|
|
3428
3428
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3429
3429
|
exports.Api = undefined;
|
|
@@ -4041,7 +4041,7 @@ var require_api = __commonJS((exports) => {
|
|
|
4041
4041
|
exports.Api = Api;
|
|
4042
4042
|
});
|
|
4043
4043
|
|
|
4044
|
-
//
|
|
4044
|
+
// ../../switchroom/node_modules/.bun/grammy@1.42.0/node_modules/grammy/out/bot.js
|
|
4045
4045
|
var require_bot = __commonJS((exports) => {
|
|
4046
4046
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4047
4047
|
exports.Bot = exports.BotError = exports.DEFAULT_UPDATE_TYPES = undefined;
|
|
@@ -4370,7 +4370,7 @@ On the other hand, if you actually know what you're doing and you do need to ins
|
|
|
4370
4370
|
var shim_node_js_1 = require_shim_node();
|
|
4371
4371
|
});
|
|
4372
4372
|
|
|
4373
|
-
//
|
|
4373
|
+
// ../../switchroom/node_modules/.bun/grammy@1.42.0/node_modules/grammy/out/convenience/constants.js
|
|
4374
4374
|
var require_constants = __commonJS((exports) => {
|
|
4375
4375
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4376
4376
|
exports.API_CONSTANTS = undefined;
|
|
@@ -4406,7 +4406,7 @@ var require_constants = __commonJS((exports) => {
|
|
|
4406
4406
|
Object.freeze(exports.API_CONSTANTS);
|
|
4407
4407
|
});
|
|
4408
4408
|
|
|
4409
|
-
//
|
|
4409
|
+
// ../../switchroom/node_modules/.bun/grammy@1.42.0/node_modules/grammy/out/convenience/inline_query.js
|
|
4410
4410
|
var require_inline_query = __commonJS((exports) => {
|
|
4411
4411
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4412
4412
|
exports.InlineQueryResultBuilder = undefined;
|
|
@@ -4604,7 +4604,7 @@ var require_inline_query = __commonJS((exports) => {
|
|
|
4604
4604
|
};
|
|
4605
4605
|
});
|
|
4606
4606
|
|
|
4607
|
-
//
|
|
4607
|
+
// ../../switchroom/node_modules/.bun/grammy@1.42.0/node_modules/grammy/out/convenience/input_media.js
|
|
4608
4608
|
var require_input_media = __commonJS((exports) => {
|
|
4609
4609
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4610
4610
|
exports.InputMediaBuilder = undefined;
|
|
@@ -4627,7 +4627,7 @@ var require_input_media = __commonJS((exports) => {
|
|
|
4627
4627
|
};
|
|
4628
4628
|
});
|
|
4629
4629
|
|
|
4630
|
-
//
|
|
4630
|
+
// ../../switchroom/node_modules/.bun/grammy@1.42.0/node_modules/grammy/out/convenience/keyboard.js
|
|
4631
4631
|
var require_keyboard = __commonJS((exports) => {
|
|
4632
4632
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4633
4633
|
exports.InlineKeyboard = exports.Keyboard = undefined;
|
|
@@ -4985,7 +4985,7 @@ var require_keyboard = __commonJS((exports) => {
|
|
|
4985
4985
|
}
|
|
4986
4986
|
});
|
|
4987
4987
|
|
|
4988
|
-
//
|
|
4988
|
+
// ../../switchroom/node_modules/.bun/grammy@1.42.0/node_modules/grammy/out/convenience/session.js
|
|
4989
4989
|
var require_session = __commonJS((exports) => {
|
|
4990
4990
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4991
4991
|
exports.MemorySessionStorage = undefined;
|
|
@@ -5285,7 +5285,7 @@ var require_session = __commonJS((exports) => {
|
|
|
5285
5285
|
}
|
|
5286
5286
|
});
|
|
5287
5287
|
|
|
5288
|
-
//
|
|
5288
|
+
// ../../switchroom/node_modules/.bun/grammy@1.42.0/node_modules/grammy/out/convenience/frameworks.js
|
|
5289
5289
|
var require_frameworks = __commonJS((exports) => {
|
|
5290
5290
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5291
5291
|
exports.adapters = undefined;
|
|
@@ -5653,7 +5653,7 @@ var require_frameworks = __commonJS((exports) => {
|
|
|
5653
5653
|
};
|
|
5654
5654
|
});
|
|
5655
5655
|
|
|
5656
|
-
//
|
|
5656
|
+
// ../../switchroom/node_modules/.bun/grammy@1.42.0/node_modules/grammy/out/convenience/webhook.js
|
|
5657
5657
|
var require_webhook = __commonJS((exports) => {
|
|
5658
5658
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5659
5659
|
exports.webhookCallback = webhookCallback;
|
|
@@ -5747,7 +5747,7 @@ var require_webhook = __commonJS((exports) => {
|
|
|
5747
5747
|
}
|
|
5748
5748
|
});
|
|
5749
5749
|
|
|
5750
|
-
//
|
|
5750
|
+
// ../../switchroom/node_modules/.bun/grammy@1.42.0/node_modules/grammy/out/mod.js
|
|
5751
5751
|
var require_mod = __commonJS((exports) => {
|
|
5752
5752
|
var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
|
|
5753
5753
|
if (k2 === undefined)
|
|
@@ -5813,7 +5813,7 @@ var require_mod = __commonJS((exports) => {
|
|
|
5813
5813
|
} });
|
|
5814
5814
|
});
|
|
5815
5815
|
|
|
5816
|
-
//
|
|
5816
|
+
// ../../switchroom/node_modules/.bun/@grammyjs+runner@2.0.3+c6be0243b1bbec89/node_modules/@grammyjs/runner/out/platform.node.js
|
|
5817
5817
|
var require_platform_node2 = __commonJS((exports) => {
|
|
5818
5818
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5819
5819
|
exports.parentThread = exports.createThread = undefined;
|
|
@@ -5844,7 +5844,7 @@ var require_platform_node2 = __commonJS((exports) => {
|
|
|
5844
5844
|
exports.parentThread = parentThread;
|
|
5845
5845
|
});
|
|
5846
5846
|
|
|
5847
|
-
//
|
|
5847
|
+
// ../../switchroom/node_modules/.bun/@grammyjs+runner@2.0.3+c6be0243b1bbec89/node_modules/@grammyjs/runner/out/distribute.js
|
|
5848
5848
|
var require_distribute = __commonJS((exports) => {
|
|
5849
5849
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5850
5850
|
exports.distribute = undefined;
|
|
@@ -5889,7 +5889,7 @@ var require_distribute = __commonJS((exports) => {
|
|
|
5889
5889
|
exports.distribute = distribute;
|
|
5890
5890
|
});
|
|
5891
5891
|
|
|
5892
|
-
//
|
|
5892
|
+
// ../../switchroom/node_modules/.bun/@grammyjs+runner@2.0.3+c6be0243b1bbec89/node_modules/@grammyjs/runner/out/queue.js
|
|
5893
5893
|
var require_queue = __commonJS((exports) => {
|
|
5894
5894
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5895
5895
|
exports.DecayingDeque = undefined;
|
|
@@ -6033,7 +6033,7 @@ var require_queue = __commonJS((exports) => {
|
|
|
6033
6033
|
exports.DecayingDeque = DecayingDeque;
|
|
6034
6034
|
});
|
|
6035
6035
|
|
|
6036
|
-
//
|
|
6036
|
+
// ../../switchroom/node_modules/.bun/@grammyjs+runner@2.0.3+c6be0243b1bbec89/node_modules/@grammyjs/runner/out/sink.js
|
|
6037
6037
|
var require_sink = __commonJS((exports) => {
|
|
6038
6038
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6039
6039
|
exports.createConcurrentSink = exports.createBatchSink = exports.createSequentialSink = undefined;
|
|
@@ -6078,7 +6078,7 @@ var require_sink = __commonJS((exports) => {
|
|
|
6078
6078
|
exports.createConcurrentSink = createConcurrentSink;
|
|
6079
6079
|
});
|
|
6080
6080
|
|
|
6081
|
-
//
|
|
6081
|
+
// ../../switchroom/node_modules/.bun/@grammyjs+runner@2.0.3+c6be0243b1bbec89/node_modules/@grammyjs/runner/out/node-shim.js
|
|
6082
6082
|
var require_node_shim = __commonJS((exports) => {
|
|
6083
6083
|
var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
|
|
6084
6084
|
if (k2 === undefined)
|
|
@@ -6104,7 +6104,7 @@ var require_node_shim = __commonJS((exports) => {
|
|
|
6104
6104
|
__exportStar(require_abort_controller(), exports);
|
|
6105
6105
|
});
|
|
6106
6106
|
|
|
6107
|
-
//
|
|
6107
|
+
// ../../switchroom/node_modules/.bun/@grammyjs+runner@2.0.3+c6be0243b1bbec89/node_modules/@grammyjs/runner/out/source.js
|
|
6108
6108
|
var require_source = __commonJS((exports) => {
|
|
6109
6109
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6110
6110
|
exports.createSource = undefined;
|
|
@@ -6184,7 +6184,7 @@ var require_source = __commonJS((exports) => {
|
|
|
6184
6184
|
var node_shim_js_1 = require_node_shim();
|
|
6185
6185
|
});
|
|
6186
6186
|
|
|
6187
|
-
//
|
|
6187
|
+
// ../../switchroom/node_modules/.bun/@grammyjs+runner@2.0.3+c6be0243b1bbec89/node_modules/@grammyjs/runner/out/runner.js
|
|
6188
6188
|
var require_runner = __commonJS((exports) => {
|
|
6189
6189
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6190
6190
|
exports.createRunner = exports.createUpdateFetcher = exports.run = undefined;
|
|
@@ -6336,7 +6336,7 @@ var require_runner = __commonJS((exports) => {
|
|
|
6336
6336
|
}
|
|
6337
6337
|
});
|
|
6338
6338
|
|
|
6339
|
-
//
|
|
6339
|
+
// ../../switchroom/node_modules/.bun/@grammyjs+runner@2.0.3+c6be0243b1bbec89/node_modules/@grammyjs/runner/out/sequentialize.js
|
|
6340
6340
|
var require_sequentialize = __commonJS((exports) => {
|
|
6341
6341
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6342
6342
|
exports.sequentialize = undefined;
|
|
@@ -6379,7 +6379,7 @@ var require_sequentialize = __commonJS((exports) => {
|
|
|
6379
6379
|
exports.sequentialize = sequentialize;
|
|
6380
6380
|
});
|
|
6381
6381
|
|
|
6382
|
-
//
|
|
6382
|
+
// ../../switchroom/node_modules/.bun/grammy@1.42.0/node_modules/grammy/out/mod.js
|
|
6383
6383
|
var require_mod2 = __commonJS((exports) => {
|
|
6384
6384
|
var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
|
|
6385
6385
|
if (k2 === undefined)
|
|
@@ -6445,7 +6445,7 @@ var require_mod2 = __commonJS((exports) => {
|
|
|
6445
6445
|
} });
|
|
6446
6446
|
});
|
|
6447
6447
|
|
|
6448
|
-
//
|
|
6448
|
+
// ../../switchroom/node_modules/.bun/@grammyjs+runner@2.0.3+c6be0243b1bbec89/node_modules/@grammyjs/runner/out/deps.node.js
|
|
6449
6449
|
var require_deps_node = __commonJS((exports) => {
|
|
6450
6450
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6451
6451
|
exports.BotError = exports.Bot = undefined;
|
|
@@ -6458,7 +6458,7 @@ var require_deps_node = __commonJS((exports) => {
|
|
|
6458
6458
|
} });
|
|
6459
6459
|
});
|
|
6460
6460
|
|
|
6461
|
-
//
|
|
6461
|
+
// ../../switchroom/node_modules/.bun/@grammyjs+runner@2.0.3+c6be0243b1bbec89/node_modules/@grammyjs/runner/out/worker.js
|
|
6462
6462
|
var require_worker = __commonJS((exports) => {
|
|
6463
6463
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6464
6464
|
exports.BotWorker = undefined;
|
|
@@ -6500,7 +6500,7 @@ var require_worker = __commonJS((exports) => {
|
|
|
6500
6500
|
exports.BotWorker = BotWorker;
|
|
6501
6501
|
});
|
|
6502
6502
|
|
|
6503
|
-
//
|
|
6503
|
+
// ../../switchroom/node_modules/.bun/@grammyjs+runner@2.0.3+c6be0243b1bbec89/node_modules/@grammyjs/runner/out/mod.js
|
|
6504
6504
|
var require_mod3 = __commonJS((exports) => {
|
|
6505
6505
|
var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
|
|
6506
6506
|
if (k2 === undefined)
|
|
@@ -6532,7 +6532,7 @@ var require_mod3 = __commonJS((exports) => {
|
|
|
6532
6532
|
__exportStar(require_worker(), exports);
|
|
6533
6533
|
});
|
|
6534
6534
|
|
|
6535
|
-
//
|
|
6535
|
+
// ../../switchroom/node_modules/.bun/@grammyjs+runner@2.0.3+c6be0243b1bbec89/node_modules/@grammyjs/runner/out/mod.js
|
|
6536
6536
|
var require_mod4 = __commonJS((exports) => {
|
|
6537
6537
|
var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
|
|
6538
6538
|
if (k2 === undefined)
|
|
@@ -6564,7 +6564,7 @@ var require_mod4 = __commonJS((exports) => {
|
|
|
6564
6564
|
__exportStar(require_worker(), exports);
|
|
6565
6565
|
});
|
|
6566
6566
|
|
|
6567
|
-
//
|
|
6567
|
+
// ../../switchroom/node_modules/.bun/@xterm+headless@6.0.0/node_modules/@xterm/headless/lib-headless/xterm-headless.js
|
|
6568
6568
|
var require_xterm_headless = __commonJS((exports2) => {
|
|
6569
6569
|
(() => {
|
|
6570
6570
|
var e = { 5639: (e2, t2, s2) => {
|
|
@@ -12119,7 +12119,7 @@ ${i3.join(`
|
|
|
12119
12119
|
})();
|
|
12120
12120
|
});
|
|
12121
12121
|
|
|
12122
|
-
//
|
|
12122
|
+
// ../../switchroom/node_modules/.bun/zod@3.25.76/node_modules/zod/v3/helpers/util.js
|
|
12123
12123
|
var util, objectUtil, ZodParsedType, getParsedType = (data) => {
|
|
12124
12124
|
const t = typeof data;
|
|
12125
12125
|
switch (t) {
|
|
@@ -12250,7 +12250,7 @@ var init_util = __esm(() => {
|
|
|
12250
12250
|
]);
|
|
12251
12251
|
});
|
|
12252
12252
|
|
|
12253
|
-
//
|
|
12253
|
+
// ../../switchroom/node_modules/.bun/zod@3.25.76/node_modules/zod/v3/ZodError.js
|
|
12254
12254
|
var ZodIssueCode, quotelessJson = (obj) => {
|
|
12255
12255
|
const json = JSON.stringify(obj, null, 2);
|
|
12256
12256
|
return json.replace(/"([^"]+)":/g, "$1:");
|
|
@@ -12371,7 +12371,7 @@ var init_ZodError = __esm(() => {
|
|
|
12371
12371
|
};
|
|
12372
12372
|
});
|
|
12373
12373
|
|
|
12374
|
-
//
|
|
12374
|
+
// ../../switchroom/node_modules/.bun/zod@3.25.76/node_modules/zod/v3/locales/en.js
|
|
12375
12375
|
var errorMap = (issue, _ctx) => {
|
|
12376
12376
|
let message;
|
|
12377
12377
|
switch (issue.code) {
|
|
@@ -12478,7 +12478,7 @@ var init_en = __esm(() => {
|
|
|
12478
12478
|
en_default = errorMap;
|
|
12479
12479
|
});
|
|
12480
12480
|
|
|
12481
|
-
//
|
|
12481
|
+
// ../../switchroom/node_modules/.bun/zod@3.25.76/node_modules/zod/v3/errors.js
|
|
12482
12482
|
function setErrorMap(map) {
|
|
12483
12483
|
overrideErrorMap = map;
|
|
12484
12484
|
}
|
|
@@ -12491,7 +12491,7 @@ var init_errors = __esm(() => {
|
|
|
12491
12491
|
overrideErrorMap = en_default;
|
|
12492
12492
|
});
|
|
12493
12493
|
|
|
12494
|
-
//
|
|
12494
|
+
// ../../switchroom/node_modules/.bun/zod@3.25.76/node_modules/zod/v3/helpers/parseUtil.js
|
|
12495
12495
|
function addIssueToContext(ctx, issueData) {
|
|
12496
12496
|
const overrideMap = getErrorMap();
|
|
12497
12497
|
const issue = makeIssue({
|
|
@@ -12596,10 +12596,10 @@ var init_parseUtil = __esm(() => {
|
|
|
12596
12596
|
});
|
|
12597
12597
|
});
|
|
12598
12598
|
|
|
12599
|
-
//
|
|
12599
|
+
// ../../switchroom/node_modules/.bun/zod@3.25.76/node_modules/zod/v3/helpers/typeAliases.js
|
|
12600
12600
|
var init_typeAliases = () => {};
|
|
12601
12601
|
|
|
12602
|
-
//
|
|
12602
|
+
// ../../switchroom/node_modules/.bun/zod@3.25.76/node_modules/zod/v3/helpers/errorUtil.js
|
|
12603
12603
|
var errorUtil;
|
|
12604
12604
|
var init_errorUtil = __esm(() => {
|
|
12605
12605
|
(function(errorUtil2) {
|
|
@@ -12608,7 +12608,7 @@ var init_errorUtil = __esm(() => {
|
|
|
12608
12608
|
})(errorUtil || (errorUtil = {}));
|
|
12609
12609
|
});
|
|
12610
12610
|
|
|
12611
|
-
//
|
|
12611
|
+
// ../../switchroom/node_modules/.bun/zod@3.25.76/node_modules/zod/v3/types.js
|
|
12612
12612
|
class ParseInputLazyPath {
|
|
12613
12613
|
constructor(parent, value, path, key) {
|
|
12614
12614
|
this._cachedPath = [];
|
|
@@ -15959,7 +15959,7 @@ var init_types = __esm(() => {
|
|
|
15959
15959
|
NEVER = INVALID;
|
|
15960
15960
|
});
|
|
15961
15961
|
|
|
15962
|
-
//
|
|
15962
|
+
// ../../switchroom/node_modules/.bun/zod@3.25.76/node_modules/zod/v3/external.js
|
|
15963
15963
|
var exports_external = {};
|
|
15964
15964
|
__export(exports_external, {
|
|
15965
15965
|
void: () => voidType,
|
|
@@ -16079,7 +16079,7 @@ var init_external = __esm(() => {
|
|
|
16079
16079
|
init_ZodError();
|
|
16080
16080
|
});
|
|
16081
16081
|
|
|
16082
|
-
//
|
|
16082
|
+
// ../../switchroom/node_modules/.bun/zod@3.25.76/node_modules/zod/index.js
|
|
16083
16083
|
var init_zod = __esm(() => {
|
|
16084
16084
|
init_external();
|
|
16085
16085
|
init_external();
|
|
@@ -16323,6 +16323,14 @@ import { existsSync as existsSync6 } from "node:fs";
|
|
|
16323
16323
|
import { homedir as homedir3 } from "node:os";
|
|
16324
16324
|
import { randomUUID as randomUUID3 } from "node:crypto";
|
|
16325
16325
|
import { join as join8 } from "node:path";
|
|
16326
|
+
function reviveDate(v) {
|
|
16327
|
+
if (v == null)
|
|
16328
|
+
return null;
|
|
16329
|
+
if (v instanceof Date)
|
|
16330
|
+
return Number.isNaN(v.getTime()) ? null : v;
|
|
16331
|
+
const d = new Date(v);
|
|
16332
|
+
return Number.isNaN(d.getTime()) ? null : d;
|
|
16333
|
+
}
|
|
16326
16334
|
function operatorSocketPath(home = homedir3()) {
|
|
16327
16335
|
return join8(home, ".switchroom", "state", "auth-broker-operator", "sock");
|
|
16328
16336
|
}
|
|
@@ -16398,7 +16406,14 @@ class AuthBrokerClient {
|
|
|
16398
16406
|
accounts: [...accounts],
|
|
16399
16407
|
...timeoutMs !== undefined ? { timeoutMs } : {}
|
|
16400
16408
|
});
|
|
16401
|
-
|
|
16409
|
+
const parsed = data;
|
|
16410
|
+
for (const entry of parsed.results) {
|
|
16411
|
+
if (entry.result.ok) {
|
|
16412
|
+
entry.result.data.fiveHourResetAt = reviveDate(entry.result.data.fiveHourResetAt);
|
|
16413
|
+
entry.result.data.sevenDayResetAt = reviveDate(entry.result.data.sevenDayResetAt);
|
|
16414
|
+
}
|
|
16415
|
+
}
|
|
16416
|
+
return parsed;
|
|
16402
16417
|
}
|
|
16403
16418
|
async setActive(account) {
|
|
16404
16419
|
const data = await this.send({
|
|
@@ -16612,7 +16627,7 @@ var init_client = __esm(() => {
|
|
|
16612
16627
|
};
|
|
16613
16628
|
});
|
|
16614
16629
|
|
|
16615
|
-
//
|
|
16630
|
+
// ../../switchroom/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/nodes/identity.js
|
|
16616
16631
|
var require_identity = __commonJS((exports2) => {
|
|
16617
16632
|
var ALIAS = Symbol.for("yaml.alias");
|
|
16618
16633
|
var DOC = Symbol.for("yaml.document");
|
|
@@ -16666,7 +16681,7 @@ var require_identity = __commonJS((exports2) => {
|
|
|
16666
16681
|
exports2.isSeq = isSeq;
|
|
16667
16682
|
});
|
|
16668
16683
|
|
|
16669
|
-
//
|
|
16684
|
+
// ../../switchroom/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/visit.js
|
|
16670
16685
|
var require_visit = __commonJS((exports2) => {
|
|
16671
16686
|
var identity = require_identity();
|
|
16672
16687
|
var BREAK = Symbol("break visit");
|
|
@@ -16821,7 +16836,7 @@ var require_visit = __commonJS((exports2) => {
|
|
|
16821
16836
|
exports2.visitAsync = visitAsync;
|
|
16822
16837
|
});
|
|
16823
16838
|
|
|
16824
|
-
//
|
|
16839
|
+
// ../../switchroom/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/doc/directives.js
|
|
16825
16840
|
var require_directives = __commonJS((exports2) => {
|
|
16826
16841
|
var identity = require_identity();
|
|
16827
16842
|
var visit = require_visit();
|
|
@@ -16973,7 +16988,7 @@ var require_directives = __commonJS((exports2) => {
|
|
|
16973
16988
|
exports2.Directives = Directives;
|
|
16974
16989
|
});
|
|
16975
16990
|
|
|
16976
|
-
//
|
|
16991
|
+
// ../../switchroom/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/doc/anchors.js
|
|
16977
16992
|
var require_anchors = __commonJS((exports2) => {
|
|
16978
16993
|
var identity = require_identity();
|
|
16979
16994
|
var visit = require_visit();
|
|
@@ -17035,7 +17050,7 @@ var require_anchors = __commonJS((exports2) => {
|
|
|
17035
17050
|
exports2.findNewAnchor = findNewAnchor;
|
|
17036
17051
|
});
|
|
17037
17052
|
|
|
17038
|
-
//
|
|
17053
|
+
// ../../switchroom/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/doc/applyReviver.js
|
|
17039
17054
|
var require_applyReviver = __commonJS((exports2) => {
|
|
17040
17055
|
function applyReviver(reviver, obj, key, val) {
|
|
17041
17056
|
if (val && typeof val === "object") {
|
|
@@ -17082,7 +17097,7 @@ var require_applyReviver = __commonJS((exports2) => {
|
|
|
17082
17097
|
exports2.applyReviver = applyReviver;
|
|
17083
17098
|
});
|
|
17084
17099
|
|
|
17085
|
-
//
|
|
17100
|
+
// ../../switchroom/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/nodes/toJS.js
|
|
17086
17101
|
var require_toJS = __commonJS((exports2) => {
|
|
17087
17102
|
var identity = require_identity();
|
|
17088
17103
|
function toJS(value, arg, ctx) {
|
|
@@ -17109,7 +17124,7 @@ var require_toJS = __commonJS((exports2) => {
|
|
|
17109
17124
|
exports2.toJS = toJS;
|
|
17110
17125
|
});
|
|
17111
17126
|
|
|
17112
|
-
//
|
|
17127
|
+
// ../../switchroom/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/nodes/Node.js
|
|
17113
17128
|
var require_Node = __commonJS((exports2) => {
|
|
17114
17129
|
var applyReviver = require_applyReviver();
|
|
17115
17130
|
var identity = require_identity();
|
|
@@ -17146,7 +17161,7 @@ var require_Node = __commonJS((exports2) => {
|
|
|
17146
17161
|
exports2.NodeBase = NodeBase;
|
|
17147
17162
|
});
|
|
17148
17163
|
|
|
17149
|
-
//
|
|
17164
|
+
// ../../switchroom/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/nodes/Alias.js
|
|
17150
17165
|
var require_Alias = __commonJS((exports2) => {
|
|
17151
17166
|
var anchors = require_anchors();
|
|
17152
17167
|
var visit = require_visit();
|
|
@@ -17254,7 +17269,7 @@ var require_Alias = __commonJS((exports2) => {
|
|
|
17254
17269
|
exports2.Alias = Alias;
|
|
17255
17270
|
});
|
|
17256
17271
|
|
|
17257
|
-
//
|
|
17272
|
+
// ../../switchroom/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/nodes/Scalar.js
|
|
17258
17273
|
var require_Scalar = __commonJS((exports2) => {
|
|
17259
17274
|
var identity = require_identity();
|
|
17260
17275
|
var Node = require_Node();
|
|
@@ -17282,7 +17297,7 @@ var require_Scalar = __commonJS((exports2) => {
|
|
|
17282
17297
|
exports2.isScalarValue = isScalarValue;
|
|
17283
17298
|
});
|
|
17284
17299
|
|
|
17285
|
-
//
|
|
17300
|
+
// ../../switchroom/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/doc/createNode.js
|
|
17286
17301
|
var require_createNode = __commonJS((exports2) => {
|
|
17287
17302
|
var Alias = require_Alias();
|
|
17288
17303
|
var identity = require_identity();
|
|
@@ -17354,7 +17369,7 @@ var require_createNode = __commonJS((exports2) => {
|
|
|
17354
17369
|
exports2.createNode = createNode;
|
|
17355
17370
|
});
|
|
17356
17371
|
|
|
17357
|
-
//
|
|
17372
|
+
// ../../switchroom/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/nodes/Collection.js
|
|
17358
17373
|
var require_Collection = __commonJS((exports2) => {
|
|
17359
17374
|
var createNode = require_createNode();
|
|
17360
17375
|
var identity = require_identity();
|
|
@@ -17469,7 +17484,7 @@ var require_Collection = __commonJS((exports2) => {
|
|
|
17469
17484
|
exports2.isEmptyPath = isEmptyPath;
|
|
17470
17485
|
});
|
|
17471
17486
|
|
|
17472
|
-
//
|
|
17487
|
+
// ../../switchroom/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/stringify/stringifyComment.js
|
|
17473
17488
|
var require_stringifyComment = __commonJS((exports2) => {
|
|
17474
17489
|
var stringifyComment = (str) => str.replace(/^(?!$)(?: $)?/gm, "#");
|
|
17475
17490
|
function indentComment(comment, indent) {
|
|
@@ -17486,7 +17501,7 @@ var require_stringifyComment = __commonJS((exports2) => {
|
|
|
17486
17501
|
exports2.stringifyComment = stringifyComment;
|
|
17487
17502
|
});
|
|
17488
17503
|
|
|
17489
|
-
//
|
|
17504
|
+
// ../../switchroom/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/stringify/foldFlowLines.js
|
|
17490
17505
|
var require_foldFlowLines = __commonJS((exports2) => {
|
|
17491
17506
|
var FOLD_FLOW = "flow";
|
|
17492
17507
|
var FOLD_BLOCK = "block";
|
|
@@ -17623,7 +17638,7 @@ ${indent}${text.slice(fold + 1, end2)}`;
|
|
|
17623
17638
|
exports2.foldFlowLines = foldFlowLines;
|
|
17624
17639
|
});
|
|
17625
17640
|
|
|
17626
|
-
//
|
|
17641
|
+
// ../../switchroom/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/stringify/stringifyString.js
|
|
17627
17642
|
var require_stringifyString = __commonJS((exports2) => {
|
|
17628
17643
|
var Scalar = require_Scalar();
|
|
17629
17644
|
var foldFlowLines = require_foldFlowLines();
|
|
@@ -17921,7 +17936,7 @@ ${indent}`);
|
|
|
17921
17936
|
exports2.stringifyString = stringifyString;
|
|
17922
17937
|
});
|
|
17923
17938
|
|
|
17924
|
-
//
|
|
17939
|
+
// ../../switchroom/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/stringify/stringify.js
|
|
17925
17940
|
var require_stringify = __commonJS((exports2) => {
|
|
17926
17941
|
var anchors = require_anchors();
|
|
17927
17942
|
var identity = require_identity();
|
|
@@ -18042,7 +18057,7 @@ ${ctx.indent}${str}`;
|
|
|
18042
18057
|
exports2.stringify = stringify;
|
|
18043
18058
|
});
|
|
18044
18059
|
|
|
18045
|
-
//
|
|
18060
|
+
// ../../switchroom/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/stringify/stringifyPair.js
|
|
18046
18061
|
var require_stringifyPair = __commonJS((exports2) => {
|
|
18047
18062
|
var identity = require_identity();
|
|
18048
18063
|
var Scalar = require_Scalar();
|
|
@@ -18178,7 +18193,7 @@ ${ctx.indent}`;
|
|
|
18178
18193
|
exports2.stringifyPair = stringifyPair;
|
|
18179
18194
|
});
|
|
18180
18195
|
|
|
18181
|
-
//
|
|
18196
|
+
// ../../switchroom/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/log.js
|
|
18182
18197
|
var require_log = __commonJS((exports2) => {
|
|
18183
18198
|
var node_process = __require("process");
|
|
18184
18199
|
function debug(logLevel, ...messages) {
|
|
@@ -18197,7 +18212,7 @@ var require_log = __commonJS((exports2) => {
|
|
|
18197
18212
|
exports2.warn = warn;
|
|
18198
18213
|
});
|
|
18199
18214
|
|
|
18200
|
-
//
|
|
18215
|
+
// ../../switchroom/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/yaml-1.1/merge.js
|
|
18201
18216
|
var require_merge = __commonJS((exports2) => {
|
|
18202
18217
|
var identity = require_identity();
|
|
18203
18218
|
var Scalar = require_Scalar();
|
|
@@ -18251,7 +18266,7 @@ var require_merge = __commonJS((exports2) => {
|
|
|
18251
18266
|
exports2.merge = merge;
|
|
18252
18267
|
});
|
|
18253
18268
|
|
|
18254
|
-
//
|
|
18269
|
+
// ../../switchroom/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/nodes/addPairToJSMap.js
|
|
18255
18270
|
var require_addPairToJSMap = __commonJS((exports2) => {
|
|
18256
18271
|
var log = require_log();
|
|
18257
18272
|
var merge = require_merge();
|
|
@@ -18312,7 +18327,7 @@ var require_addPairToJSMap = __commonJS((exports2) => {
|
|
|
18312
18327
|
exports2.addPairToJSMap = addPairToJSMap;
|
|
18313
18328
|
});
|
|
18314
18329
|
|
|
18315
|
-
//
|
|
18330
|
+
// ../../switchroom/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/nodes/Pair.js
|
|
18316
18331
|
var require_Pair = __commonJS((exports2) => {
|
|
18317
18332
|
var createNode = require_createNode();
|
|
18318
18333
|
var stringifyPair = require_stringifyPair();
|
|
@@ -18350,7 +18365,7 @@ var require_Pair = __commonJS((exports2) => {
|
|
|
18350
18365
|
exports2.createPair = createPair;
|
|
18351
18366
|
});
|
|
18352
18367
|
|
|
18353
|
-
//
|
|
18368
|
+
// ../../switchroom/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/stringify/stringifyCollection.js
|
|
18354
18369
|
var require_stringifyCollection = __commonJS((exports2) => {
|
|
18355
18370
|
var identity = require_identity();
|
|
18356
18371
|
var stringify = require_stringify();
|
|
@@ -18502,7 +18517,7 @@ ${indent}${end}`;
|
|
|
18502
18517
|
exports2.stringifyCollection = stringifyCollection;
|
|
18503
18518
|
});
|
|
18504
18519
|
|
|
18505
|
-
//
|
|
18520
|
+
// ../../switchroom/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/nodes/YAMLMap.js
|
|
18506
18521
|
var require_YAMLMap = __commonJS((exports2) => {
|
|
18507
18522
|
var stringifyCollection = require_stringifyCollection();
|
|
18508
18523
|
var addPairToJSMap = require_addPairToJSMap();
|
|
@@ -18629,7 +18644,7 @@ var require_YAMLMap = __commonJS((exports2) => {
|
|
|
18629
18644
|
exports2.findPair = findPair;
|
|
18630
18645
|
});
|
|
18631
18646
|
|
|
18632
|
-
//
|
|
18647
|
+
// ../../switchroom/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/common/map.js
|
|
18633
18648
|
var require_map = __commonJS((exports2) => {
|
|
18634
18649
|
var identity = require_identity();
|
|
18635
18650
|
var YAMLMap = require_YAMLMap();
|
|
@@ -18648,7 +18663,7 @@ var require_map = __commonJS((exports2) => {
|
|
|
18648
18663
|
exports2.map = map;
|
|
18649
18664
|
});
|
|
18650
18665
|
|
|
18651
|
-
//
|
|
18666
|
+
// ../../switchroom/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/nodes/YAMLSeq.js
|
|
18652
18667
|
var require_YAMLSeq = __commonJS((exports2) => {
|
|
18653
18668
|
var createNode = require_createNode();
|
|
18654
18669
|
var stringifyCollection = require_stringifyCollection();
|
|
@@ -18741,7 +18756,7 @@ var require_YAMLSeq = __commonJS((exports2) => {
|
|
|
18741
18756
|
exports2.YAMLSeq = YAMLSeq;
|
|
18742
18757
|
});
|
|
18743
18758
|
|
|
18744
|
-
//
|
|
18759
|
+
// ../../switchroom/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/common/seq.js
|
|
18745
18760
|
var require_seq = __commonJS((exports2) => {
|
|
18746
18761
|
var identity = require_identity();
|
|
18747
18762
|
var YAMLSeq = require_YAMLSeq();
|
|
@@ -18760,7 +18775,7 @@ var require_seq = __commonJS((exports2) => {
|
|
|
18760
18775
|
exports2.seq = seq;
|
|
18761
18776
|
});
|
|
18762
18777
|
|
|
18763
|
-
//
|
|
18778
|
+
// ../../switchroom/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/common/string.js
|
|
18764
18779
|
var require_string = __commonJS((exports2) => {
|
|
18765
18780
|
var stringifyString = require_stringifyString();
|
|
18766
18781
|
var string = {
|
|
@@ -18776,7 +18791,7 @@ var require_string = __commonJS((exports2) => {
|
|
|
18776
18791
|
exports2.string = string;
|
|
18777
18792
|
});
|
|
18778
18793
|
|
|
18779
|
-
//
|
|
18794
|
+
// ../../switchroom/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/common/null.js
|
|
18780
18795
|
var require_null = __commonJS((exports2) => {
|
|
18781
18796
|
var Scalar = require_Scalar();
|
|
18782
18797
|
var nullTag = {
|
|
@@ -18791,7 +18806,7 @@ var require_null = __commonJS((exports2) => {
|
|
|
18791
18806
|
exports2.nullTag = nullTag;
|
|
18792
18807
|
});
|
|
18793
18808
|
|
|
18794
|
-
//
|
|
18809
|
+
// ../../switchroom/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/core/bool.js
|
|
18795
18810
|
var require_bool = __commonJS((exports2) => {
|
|
18796
18811
|
var Scalar = require_Scalar();
|
|
18797
18812
|
var boolTag = {
|
|
@@ -18812,7 +18827,7 @@ var require_bool = __commonJS((exports2) => {
|
|
|
18812
18827
|
exports2.boolTag = boolTag;
|
|
18813
18828
|
});
|
|
18814
18829
|
|
|
18815
|
-
//
|
|
18830
|
+
// ../../switchroom/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/stringify/stringifyNumber.js
|
|
18816
18831
|
var require_stringifyNumber = __commonJS((exports2) => {
|
|
18817
18832
|
function stringifyNumber({ format, minFractionDigits, tag, value }) {
|
|
18818
18833
|
if (typeof value === "bigint")
|
|
@@ -18836,7 +18851,7 @@ var require_stringifyNumber = __commonJS((exports2) => {
|
|
|
18836
18851
|
exports2.stringifyNumber = stringifyNumber;
|
|
18837
18852
|
});
|
|
18838
18853
|
|
|
18839
|
-
//
|
|
18854
|
+
// ../../switchroom/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/core/float.js
|
|
18840
18855
|
var require_float = __commonJS((exports2) => {
|
|
18841
18856
|
var Scalar = require_Scalar();
|
|
18842
18857
|
var stringifyNumber = require_stringifyNumber();
|
|
@@ -18879,7 +18894,7 @@ var require_float = __commonJS((exports2) => {
|
|
|
18879
18894
|
exports2.floatNaN = floatNaN;
|
|
18880
18895
|
});
|
|
18881
18896
|
|
|
18882
|
-
//
|
|
18897
|
+
// ../../switchroom/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/core/int.js
|
|
18883
18898
|
var require_int = __commonJS((exports2) => {
|
|
18884
18899
|
var stringifyNumber = require_stringifyNumber();
|
|
18885
18900
|
var intIdentify = (value) => typeof value === "bigint" || Number.isInteger(value);
|
|
@@ -18921,7 +18936,7 @@ var require_int = __commonJS((exports2) => {
|
|
|
18921
18936
|
exports2.intOct = intOct;
|
|
18922
18937
|
});
|
|
18923
18938
|
|
|
18924
|
-
//
|
|
18939
|
+
// ../../switchroom/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/core/schema.js
|
|
18925
18940
|
var require_schema = __commonJS((exports2) => {
|
|
18926
18941
|
var map = require_map();
|
|
18927
18942
|
var _null = require_null();
|
|
@@ -18946,7 +18961,7 @@ var require_schema = __commonJS((exports2) => {
|
|
|
18946
18961
|
exports2.schema = schema;
|
|
18947
18962
|
});
|
|
18948
18963
|
|
|
18949
|
-
//
|
|
18964
|
+
// ../../switchroom/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/json/schema.js
|
|
18950
18965
|
var require_schema2 = __commonJS((exports2) => {
|
|
18951
18966
|
var Scalar = require_Scalar();
|
|
18952
18967
|
var map = require_map();
|
|
@@ -19010,7 +19025,7 @@ var require_schema2 = __commonJS((exports2) => {
|
|
|
19010
19025
|
exports2.schema = schema;
|
|
19011
19026
|
});
|
|
19012
19027
|
|
|
19013
|
-
//
|
|
19028
|
+
// ../../switchroom/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/yaml-1.1/binary.js
|
|
19014
19029
|
var require_binary = __commonJS((exports2) => {
|
|
19015
19030
|
var node_buffer = __require("buffer");
|
|
19016
19031
|
var Scalar = require_Scalar();
|
|
@@ -19065,7 +19080,7 @@ var require_binary = __commonJS((exports2) => {
|
|
|
19065
19080
|
exports2.binary = binary;
|
|
19066
19081
|
});
|
|
19067
19082
|
|
|
19068
|
-
//
|
|
19083
|
+
// ../../switchroom/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/yaml-1.1/pairs.js
|
|
19069
19084
|
var require_pairs = __commonJS((exports2) => {
|
|
19070
19085
|
var identity = require_identity();
|
|
19071
19086
|
var Pair = require_Pair();
|
|
@@ -19140,7 +19155,7 @@ ${cn.comment}` : item.comment;
|
|
|
19140
19155
|
exports2.resolvePairs = resolvePairs;
|
|
19141
19156
|
});
|
|
19142
19157
|
|
|
19143
|
-
//
|
|
19158
|
+
// ../../switchroom/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/yaml-1.1/omap.js
|
|
19144
19159
|
var require_omap = __commonJS((exports2) => {
|
|
19145
19160
|
var identity = require_identity();
|
|
19146
19161
|
var toJS = require_toJS();
|
|
@@ -19212,7 +19227,7 @@ var require_omap = __commonJS((exports2) => {
|
|
|
19212
19227
|
exports2.omap = omap;
|
|
19213
19228
|
});
|
|
19214
19229
|
|
|
19215
|
-
//
|
|
19230
|
+
// ../../switchroom/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/yaml-1.1/bool.js
|
|
19216
19231
|
var require_bool2 = __commonJS((exports2) => {
|
|
19217
19232
|
var Scalar = require_Scalar();
|
|
19218
19233
|
function boolStringify({ value, source }, ctx) {
|
|
@@ -19241,7 +19256,7 @@ var require_bool2 = __commonJS((exports2) => {
|
|
|
19241
19256
|
exports2.trueTag = trueTag;
|
|
19242
19257
|
});
|
|
19243
19258
|
|
|
19244
|
-
//
|
|
19259
|
+
// ../../switchroom/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/yaml-1.1/float.js
|
|
19245
19260
|
var require_float2 = __commonJS((exports2) => {
|
|
19246
19261
|
var Scalar = require_Scalar();
|
|
19247
19262
|
var stringifyNumber = require_stringifyNumber();
|
|
@@ -19287,7 +19302,7 @@ var require_float2 = __commonJS((exports2) => {
|
|
|
19287
19302
|
exports2.floatNaN = floatNaN;
|
|
19288
19303
|
});
|
|
19289
19304
|
|
|
19290
|
-
//
|
|
19305
|
+
// ../../switchroom/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/yaml-1.1/int.js
|
|
19291
19306
|
var require_int2 = __commonJS((exports2) => {
|
|
19292
19307
|
var stringifyNumber = require_stringifyNumber();
|
|
19293
19308
|
var intIdentify = (value) => typeof value === "bigint" || Number.isInteger(value);
|
|
@@ -19363,7 +19378,7 @@ var require_int2 = __commonJS((exports2) => {
|
|
|
19363
19378
|
exports2.intOct = intOct;
|
|
19364
19379
|
});
|
|
19365
19380
|
|
|
19366
|
-
//
|
|
19381
|
+
// ../../switchroom/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/yaml-1.1/set.js
|
|
19367
19382
|
var require_set = __commonJS((exports2) => {
|
|
19368
19383
|
var identity = require_identity();
|
|
19369
19384
|
var Pair = require_Pair();
|
|
@@ -19446,7 +19461,7 @@ var require_set = __commonJS((exports2) => {
|
|
|
19446
19461
|
exports2.set = set;
|
|
19447
19462
|
});
|
|
19448
19463
|
|
|
19449
|
-
//
|
|
19464
|
+
// ../../switchroom/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/yaml-1.1/timestamp.js
|
|
19450
19465
|
var require_timestamp = __commonJS((exports2) => {
|
|
19451
19466
|
var stringifyNumber = require_stringifyNumber();
|
|
19452
19467
|
function parseSexagesimal(str, asBigInt) {
|
|
@@ -19528,7 +19543,7 @@ var require_timestamp = __commonJS((exports2) => {
|
|
|
19528
19543
|
exports2.timestamp = timestamp;
|
|
19529
19544
|
});
|
|
19530
19545
|
|
|
19531
|
-
//
|
|
19546
|
+
// ../../switchroom/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/yaml-1.1/schema.js
|
|
19532
19547
|
var require_schema3 = __commonJS((exports2) => {
|
|
19533
19548
|
var map = require_map();
|
|
19534
19549
|
var _null = require_null();
|
|
@@ -19569,7 +19584,7 @@ var require_schema3 = __commonJS((exports2) => {
|
|
|
19569
19584
|
exports2.schema = schema;
|
|
19570
19585
|
});
|
|
19571
19586
|
|
|
19572
|
-
//
|
|
19587
|
+
// ../../switchroom/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/tags.js
|
|
19573
19588
|
var require_tags = __commonJS((exports2) => {
|
|
19574
19589
|
var map = require_map();
|
|
19575
19590
|
var _null = require_null();
|
|
@@ -19660,7 +19675,7 @@ var require_tags = __commonJS((exports2) => {
|
|
|
19660
19675
|
exports2.getTags = getTags;
|
|
19661
19676
|
});
|
|
19662
19677
|
|
|
19663
|
-
//
|
|
19678
|
+
// ../../switchroom/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/Schema.js
|
|
19664
19679
|
var require_Schema = __commonJS((exports2) => {
|
|
19665
19680
|
var identity = require_identity();
|
|
19666
19681
|
var map = require_map();
|
|
@@ -19690,7 +19705,7 @@ var require_Schema = __commonJS((exports2) => {
|
|
|
19690
19705
|
exports2.Schema = Schema;
|
|
19691
19706
|
});
|
|
19692
19707
|
|
|
19693
|
-
//
|
|
19708
|
+
// ../../switchroom/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/stringify/stringifyDocument.js
|
|
19694
19709
|
var require_stringifyDocument = __commonJS((exports2) => {
|
|
19695
19710
|
var identity = require_identity();
|
|
19696
19711
|
var stringify = require_stringify();
|
|
@@ -19770,7 +19785,7 @@ var require_stringifyDocument = __commonJS((exports2) => {
|
|
|
19770
19785
|
exports2.stringifyDocument = stringifyDocument;
|
|
19771
19786
|
});
|
|
19772
19787
|
|
|
19773
|
-
//
|
|
19788
|
+
// ../../switchroom/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/doc/Document.js
|
|
19774
19789
|
var require_Document = __commonJS((exports2) => {
|
|
19775
19790
|
var Alias = require_Alias();
|
|
19776
19791
|
var Collection = require_Collection();
|
|
@@ -20005,7 +20020,7 @@ var require_Document = __commonJS((exports2) => {
|
|
|
20005
20020
|
exports2.Document = Document;
|
|
20006
20021
|
});
|
|
20007
20022
|
|
|
20008
|
-
//
|
|
20023
|
+
// ../../switchroom/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/errors.js
|
|
20009
20024
|
var require_errors = __commonJS((exports2) => {
|
|
20010
20025
|
class YAMLError extends Error {
|
|
20011
20026
|
constructor(name, pos, code, message) {
|
|
@@ -20070,7 +20085,7 @@ ${pointer}
|
|
|
20070
20085
|
exports2.prettifyError = prettifyError;
|
|
20071
20086
|
});
|
|
20072
20087
|
|
|
20073
|
-
//
|
|
20088
|
+
// ../../switchroom/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/compose/resolve-props.js
|
|
20074
20089
|
var require_resolve_props = __commonJS((exports2) => {
|
|
20075
20090
|
function resolveProps(tokens, { flow, indicator, next, offset, onError, parentIndent, startOnNewline }) {
|
|
20076
20091
|
let spaceBefore = false;
|
|
@@ -20200,7 +20215,7 @@ var require_resolve_props = __commonJS((exports2) => {
|
|
|
20200
20215
|
exports2.resolveProps = resolveProps;
|
|
20201
20216
|
});
|
|
20202
20217
|
|
|
20203
|
-
//
|
|
20218
|
+
// ../../switchroom/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/compose/util-contains-newline.js
|
|
20204
20219
|
var require_util_contains_newline = __commonJS((exports2) => {
|
|
20205
20220
|
function containsNewline(key) {
|
|
20206
20221
|
if (!key)
|
|
@@ -20240,7 +20255,7 @@ var require_util_contains_newline = __commonJS((exports2) => {
|
|
|
20240
20255
|
exports2.containsNewline = containsNewline;
|
|
20241
20256
|
});
|
|
20242
20257
|
|
|
20243
|
-
//
|
|
20258
|
+
// ../../switchroom/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/compose/util-flow-indent-check.js
|
|
20244
20259
|
var require_util_flow_indent_check = __commonJS((exports2) => {
|
|
20245
20260
|
var utilContainsNewline = require_util_contains_newline();
|
|
20246
20261
|
function flowIndentCheck(indent, fc, onError) {
|
|
@@ -20255,7 +20270,7 @@ var require_util_flow_indent_check = __commonJS((exports2) => {
|
|
|
20255
20270
|
exports2.flowIndentCheck = flowIndentCheck;
|
|
20256
20271
|
});
|
|
20257
20272
|
|
|
20258
|
-
//
|
|
20273
|
+
// ../../switchroom/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/compose/util-map-includes.js
|
|
20259
20274
|
var require_util_map_includes = __commonJS((exports2) => {
|
|
20260
20275
|
var identity = require_identity();
|
|
20261
20276
|
function mapIncludes(ctx, items, search) {
|
|
@@ -20268,7 +20283,7 @@ var require_util_map_includes = __commonJS((exports2) => {
|
|
|
20268
20283
|
exports2.mapIncludes = mapIncludes;
|
|
20269
20284
|
});
|
|
20270
20285
|
|
|
20271
|
-
//
|
|
20286
|
+
// ../../switchroom/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/compose/resolve-block-map.js
|
|
20272
20287
|
var require_resolve_block_map = __commonJS((exports2) => {
|
|
20273
20288
|
var Pair = require_Pair();
|
|
20274
20289
|
var YAMLMap = require_YAMLMap();
|
|
@@ -20375,7 +20390,7 @@ var require_resolve_block_map = __commonJS((exports2) => {
|
|
|
20375
20390
|
exports2.resolveBlockMap = resolveBlockMap;
|
|
20376
20391
|
});
|
|
20377
20392
|
|
|
20378
|
-
//
|
|
20393
|
+
// ../../switchroom/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/compose/resolve-block-seq.js
|
|
20379
20394
|
var require_resolve_block_seq = __commonJS((exports2) => {
|
|
20380
20395
|
var YAMLSeq = require_YAMLSeq();
|
|
20381
20396
|
var resolveProps = require_resolve_props();
|
|
@@ -20423,7 +20438,7 @@ var require_resolve_block_seq = __commonJS((exports2) => {
|
|
|
20423
20438
|
exports2.resolveBlockSeq = resolveBlockSeq;
|
|
20424
20439
|
});
|
|
20425
20440
|
|
|
20426
|
-
//
|
|
20441
|
+
// ../../switchroom/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/compose/resolve-end.js
|
|
20427
20442
|
var require_resolve_end = __commonJS((exports2) => {
|
|
20428
20443
|
function resolveEnd(end, offset, reqSpace, onError) {
|
|
20429
20444
|
let comment = "";
|
|
@@ -20463,7 +20478,7 @@ var require_resolve_end = __commonJS((exports2) => {
|
|
|
20463
20478
|
exports2.resolveEnd = resolveEnd;
|
|
20464
20479
|
});
|
|
20465
20480
|
|
|
20466
|
-
//
|
|
20481
|
+
// ../../switchroom/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/compose/resolve-flow-collection.js
|
|
20467
20482
|
var require_resolve_flow_collection = __commonJS((exports2) => {
|
|
20468
20483
|
var identity = require_identity();
|
|
20469
20484
|
var Pair = require_Pair();
|
|
@@ -20654,7 +20669,7 @@ var require_resolve_flow_collection = __commonJS((exports2) => {
|
|
|
20654
20669
|
exports2.resolveFlowCollection = resolveFlowCollection;
|
|
20655
20670
|
});
|
|
20656
20671
|
|
|
20657
|
-
//
|
|
20672
|
+
// ../../switchroom/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/compose/compose-collection.js
|
|
20658
20673
|
var require_compose_collection = __commonJS((exports2) => {
|
|
20659
20674
|
var identity = require_identity();
|
|
20660
20675
|
var Scalar = require_Scalar();
|
|
@@ -20716,7 +20731,7 @@ var require_compose_collection = __commonJS((exports2) => {
|
|
|
20716
20731
|
exports2.composeCollection = composeCollection;
|
|
20717
20732
|
});
|
|
20718
20733
|
|
|
20719
|
-
//
|
|
20734
|
+
// ../../switchroom/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/compose/resolve-block-scalar.js
|
|
20720
20735
|
var require_resolve_block_scalar = __commonJS((exports2) => {
|
|
20721
20736
|
var Scalar = require_Scalar();
|
|
20722
20737
|
function resolveBlockScalar(ctx, scalar, onError) {
|
|
@@ -20909,7 +20924,7 @@ var require_resolve_block_scalar = __commonJS((exports2) => {
|
|
|
20909
20924
|
exports2.resolveBlockScalar = resolveBlockScalar;
|
|
20910
20925
|
});
|
|
20911
20926
|
|
|
20912
|
-
//
|
|
20927
|
+
// ../../switchroom/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/compose/resolve-flow-scalar.js
|
|
20913
20928
|
var require_resolve_flow_scalar = __commonJS((exports2) => {
|
|
20914
20929
|
var Scalar = require_Scalar();
|
|
20915
20930
|
var resolveEnd = require_resolve_end();
|
|
@@ -21125,7 +21140,7 @@ var require_resolve_flow_scalar = __commonJS((exports2) => {
|
|
|
21125
21140
|
exports2.resolveFlowScalar = resolveFlowScalar;
|
|
21126
21141
|
});
|
|
21127
21142
|
|
|
21128
|
-
//
|
|
21143
|
+
// ../../switchroom/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/compose/compose-scalar.js
|
|
21129
21144
|
var require_compose_scalar = __commonJS((exports2) => {
|
|
21130
21145
|
var identity = require_identity();
|
|
21131
21146
|
var Scalar = require_Scalar();
|
|
@@ -21203,7 +21218,7 @@ var require_compose_scalar = __commonJS((exports2) => {
|
|
|
21203
21218
|
exports2.composeScalar = composeScalar;
|
|
21204
21219
|
});
|
|
21205
21220
|
|
|
21206
|
-
//
|
|
21221
|
+
// ../../switchroom/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/compose/util-empty-scalar-position.js
|
|
21207
21222
|
var require_util_empty_scalar_position = __commonJS((exports2) => {
|
|
21208
21223
|
function emptyScalarPosition(offset, before, pos) {
|
|
21209
21224
|
if (before) {
|
|
@@ -21230,7 +21245,7 @@ var require_util_empty_scalar_position = __commonJS((exports2) => {
|
|
|
21230
21245
|
exports2.emptyScalarPosition = emptyScalarPosition;
|
|
21231
21246
|
});
|
|
21232
21247
|
|
|
21233
|
-
//
|
|
21248
|
+
// ../../switchroom/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/compose/compose-node.js
|
|
21234
21249
|
var require_compose_node = __commonJS((exports2) => {
|
|
21235
21250
|
var Alias = require_Alias();
|
|
21236
21251
|
var identity = require_identity();
|
|
@@ -21333,7 +21348,7 @@ var require_compose_node = __commonJS((exports2) => {
|
|
|
21333
21348
|
exports2.composeNode = composeNode;
|
|
21334
21349
|
});
|
|
21335
21350
|
|
|
21336
|
-
//
|
|
21351
|
+
// ../../switchroom/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/compose/compose-doc.js
|
|
21337
21352
|
var require_compose_doc = __commonJS((exports2) => {
|
|
21338
21353
|
var Document = require_Document();
|
|
21339
21354
|
var composeNode = require_compose_node();
|
|
@@ -21373,7 +21388,7 @@ var require_compose_doc = __commonJS((exports2) => {
|
|
|
21373
21388
|
exports2.composeDoc = composeDoc;
|
|
21374
21389
|
});
|
|
21375
21390
|
|
|
21376
|
-
//
|
|
21391
|
+
// ../../switchroom/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/compose/composer.js
|
|
21377
21392
|
var require_composer2 = __commonJS((exports2) => {
|
|
21378
21393
|
var node_process = __require("process");
|
|
21379
21394
|
var directives = require_directives();
|
|
@@ -21562,7 +21577,7 @@ ${end.comment}` : end.comment;
|
|
|
21562
21577
|
exports2.Composer = Composer;
|
|
21563
21578
|
});
|
|
21564
21579
|
|
|
21565
|
-
//
|
|
21580
|
+
// ../../switchroom/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/parse/cst-scalar.js
|
|
21566
21581
|
var require_cst_scalar = __commonJS((exports2) => {
|
|
21567
21582
|
var resolveBlockScalar = require_resolve_block_scalar();
|
|
21568
21583
|
var resolveFlowScalar = require_resolve_flow_scalar();
|
|
@@ -21752,7 +21767,7 @@ var require_cst_scalar = __commonJS((exports2) => {
|
|
|
21752
21767
|
exports2.setScalarValue = setScalarValue;
|
|
21753
21768
|
});
|
|
21754
21769
|
|
|
21755
|
-
//
|
|
21770
|
+
// ../../switchroom/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/parse/cst-stringify.js
|
|
21756
21771
|
var require_cst_stringify = __commonJS((exports2) => {
|
|
21757
21772
|
var stringify = (cst) => ("type" in cst) ? stringifyToken(cst) : stringifyItem(cst);
|
|
21758
21773
|
function stringifyToken(token) {
|
|
@@ -21810,7 +21825,7 @@ var require_cst_stringify = __commonJS((exports2) => {
|
|
|
21810
21825
|
exports2.stringify = stringify;
|
|
21811
21826
|
});
|
|
21812
21827
|
|
|
21813
|
-
//
|
|
21828
|
+
// ../../switchroom/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/parse/cst-visit.js
|
|
21814
21829
|
var require_cst_visit = __commonJS((exports2) => {
|
|
21815
21830
|
var BREAK = Symbol("break visit");
|
|
21816
21831
|
var SKIP = Symbol("skip children");
|
|
@@ -21869,7 +21884,7 @@ var require_cst_visit = __commonJS((exports2) => {
|
|
|
21869
21884
|
exports2.visit = visit;
|
|
21870
21885
|
});
|
|
21871
21886
|
|
|
21872
|
-
//
|
|
21887
|
+
// ../../switchroom/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/parse/cst.js
|
|
21873
21888
|
var require_cst = __commonJS((exports2) => {
|
|
21874
21889
|
var cstScalar = require_cst_scalar();
|
|
21875
21890
|
var cstStringify = require_cst_stringify();
|
|
@@ -21970,7 +21985,7 @@ var require_cst = __commonJS((exports2) => {
|
|
|
21970
21985
|
exports2.tokenType = tokenType;
|
|
21971
21986
|
});
|
|
21972
21987
|
|
|
21973
|
-
//
|
|
21988
|
+
// ../../switchroom/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/parse/lexer.js
|
|
21974
21989
|
var require_lexer = __commonJS((exports2) => {
|
|
21975
21990
|
var cst = require_cst();
|
|
21976
21991
|
function isEmpty2(ch) {
|
|
@@ -22556,7 +22571,7 @@ var require_lexer = __commonJS((exports2) => {
|
|
|
22556
22571
|
exports2.Lexer = Lexer;
|
|
22557
22572
|
});
|
|
22558
22573
|
|
|
22559
|
-
//
|
|
22574
|
+
// ../../switchroom/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/parse/line-counter.js
|
|
22560
22575
|
var require_line_counter = __commonJS((exports2) => {
|
|
22561
22576
|
class LineCounter {
|
|
22562
22577
|
constructor() {
|
|
@@ -22584,7 +22599,7 @@ var require_line_counter = __commonJS((exports2) => {
|
|
|
22584
22599
|
exports2.LineCounter = LineCounter;
|
|
22585
22600
|
});
|
|
22586
22601
|
|
|
22587
|
-
//
|
|
22602
|
+
// ../../switchroom/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/parse/parser.js
|
|
22588
22603
|
var require_parser = __commonJS((exports2) => {
|
|
22589
22604
|
var node_process = __require("process");
|
|
22590
22605
|
var cst = require_cst();
|
|
@@ -23433,7 +23448,7 @@ var require_parser = __commonJS((exports2) => {
|
|
|
23433
23448
|
exports2.Parser = Parser;
|
|
23434
23449
|
});
|
|
23435
23450
|
|
|
23436
|
-
//
|
|
23451
|
+
// ../../switchroom/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/public-api.js
|
|
23437
23452
|
var require_public_api = __commonJS((exports2) => {
|
|
23438
23453
|
var composer = require_composer2();
|
|
23439
23454
|
var Document = require_Document();
|
|
@@ -23527,7 +23542,7 @@ var require_public_api = __commonJS((exports2) => {
|
|
|
23527
23542
|
exports2.stringify = stringify;
|
|
23528
23543
|
});
|
|
23529
23544
|
|
|
23530
|
-
//
|
|
23545
|
+
// ../../switchroom/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/index.js
|
|
23531
23546
|
var composer, Document, Schema, errors2, Alias, identity, Pair, Scalar, YAMLMap, YAMLSeq, cst, lexer, lineCounter, parser, publicApi, visit, $Composer, $Document, $Schema, $YAMLError, $YAMLParseError, $YAMLWarning, $Alias, $isAlias, $isCollection, $isDocument, $isMap, $isNode, $isPair, $isScalar, $isSeq, $Pair, $Scalar, $YAMLMap, $YAMLSeq, $Lexer, $LineCounter, $Parser, $parse, $parseAllDocuments, $parseDocument, $stringify, $visit, $visitAsync;
|
|
23532
23547
|
var init_dist = __esm(() => {
|
|
23533
23548
|
composer = require_composer2();
|
|
@@ -23577,7 +23592,7 @@ var init_dist = __esm(() => {
|
|
|
23577
23592
|
});
|
|
23578
23593
|
|
|
23579
23594
|
// ../src/config/schema.ts
|
|
23580
|
-
var CodeRepoEntrySchema, AgentBindMountSchema, ScheduleEntrySchema, AgentSoulSchema, AgentToolsSchema, AgentMemorySchema, HookEntrySchema, AgentHooksSchema, SubagentSchema, SessionSchema, SessionContinuitySchema, TelegramChannelSchema, ChannelsSchema, TIMEZONE_REGEX, ApproverIdSchema, GoogleWorkspaceTierSchema, GoogleWorkspaceConfigSchema, AgentGoogleWorkspaceConfigSchema, ReactionsSchema, profileFields, ProfileSchema, _omitExtends, defaultsFields, AgentDefaultsSchema, AgentSchema, TelegramConfigSchema, MemoryBackendConfigSchema, VaultConfigSchema, QuotaConfigSchema, HostControlConfigSchema, SwitchroomConfigSchema;
|
|
23595
|
+
var CodeRepoEntrySchema, AgentBindMountSchema, ScheduleEntrySchema, AgentSoulSchema, AgentToolsSchema, AgentMemorySchema, HookEntrySchema, AgentHooksSchema, SubagentSchema, SessionSchema, SessionContinuitySchema, TelegramChannelSchema, ChannelsSchema, TIMEZONE_REGEX, ApproverIdSchema, GoogleWorkspaceTierSchema, GoogleWorkspaceConfigSchema, AgentGoogleWorkspaceConfigSchema, ReactionsSchema, ReleaseBlock, NetworkIsolationSchema, profileFields, ProfileSchema, _omitExtends, defaultsFields, AgentDefaultsSchema, AgentSchema, TelegramConfigSchema, MemoryBackendConfigSchema, VaultConfigSchema, QuotaConfigSchema, HostControlConfigSchema, SwitchroomConfigSchema;
|
|
23581
23596
|
var init_schema = __esm(() => {
|
|
23582
23597
|
init_zod();
|
|
23583
23598
|
CodeRepoEntrySchema = exports_external.object({
|
|
@@ -23593,7 +23608,7 @@ var init_schema = __esm(() => {
|
|
|
23593
23608
|
ScheduleEntrySchema = exports_external.object({
|
|
23594
23609
|
cron: exports_external.string().describe("Cron expression (e.g., '0 8 * * *')"),
|
|
23595
23610
|
prompt: exports_external.string().describe("Prompt to send at the scheduled time"),
|
|
23596
|
-
model: exports_external.string().optional().describe("
|
|
23611
|
+
model: exports_external.string().optional().describe("DEPRECATED / IGNORED. Pre-v0.8 the singleton scheduler ran each " + "task as an isolated `claude -p` and could set --model per task. " + "Post cron-fold-in (v0.8) the fire is injected into the agent's " + "running session, so it always uses the agent's configured model " + "\u2014 this field has no effect. Accepted (optional) only so existing " + "configs keep validating; set the model at the agent level instead. " + "See docs/scheduling.md."),
|
|
23597
23612
|
secrets: exports_external.array(exports_external.string().regex(/^[a-zA-Z0-9_\-/]+$/, "Secret key names must contain only alphanumeric characters, underscores, hyphens, and forward slashes")).default([]).describe("Vault key names this cron task may read via the vault-broker daemon. " + "Empty by default \u2014 broker requests for unlisted keys are denied. " + "Note: this is misconfiguration protection (a typo in cron-A doesn't " + "accidentally read cron-B's keys) rather than a security boundary \u2014 " + "anyone who can edit cron scripts can also edit switchroom.yaml, and " + "anyone with the vault passphrase can read the vault file directly. " + "See docs/configuration.md for the full framing.")
|
|
23598
23613
|
});
|
|
23599
23614
|
AgentSoulSchema = exports_external.object({
|
|
@@ -23660,6 +23675,7 @@ var init_schema = __esm(() => {
|
|
|
23660
23675
|
resume_max_bytes: exports_external.number().int().positive().optional().describe("Byte threshold above which 'auto' mode falls back to handoff " + "instead of --continue. Default 2_000_000 (~2MB). Large transcripts " + "can blow out the context window even with prefix caching, and " + "--continue replay is known-fragile at scale.")
|
|
23661
23676
|
}).optional();
|
|
23662
23677
|
TelegramChannelSchema = exports_external.object({
|
|
23678
|
+
enabled: exports_external.boolean().default(true).describe("Master switch for the per-agent Telegram gateway sidecar. " + "When false, start.sh skips the gateway supervise loop and the " + "agent boots without bot-token requirements (smoke-test + " + "offline-dev use case)."),
|
|
23663
23679
|
plugin: exports_external.enum(["switchroom", "official"]).optional().describe("Which Telegram MCP plugin to load. Default is 'switchroom' \u2014 the " + "enhanced fork with streaming edits, reactions, history, and " + "access control. Set to 'official' for the upstream marketplace " + "plugin (basic send/receive only)."),
|
|
23664
23680
|
format: exports_external.enum(["html", "markdownv2", "text"]).optional().describe("Default reply format passed to the plugin"),
|
|
23665
23681
|
rate_limit_ms: exports_external.number().optional().describe("Minimum delay between outgoing messages in ms"),
|
|
@@ -23724,6 +23740,9 @@ var init_schema = __esm(() => {
|
|
|
23724
23740
|
tier: GoogleWorkspaceTierSchema.optional().describe("RFC G Phase 1: which upstream MCP tier to expose. " + "core (default) = ~16 tools (Drive+Docs+Sheets+Calendar). " + "extended = ~40 tools (+Slides, Forms, Tasks, Chat). " + "complete = ~60+ tools (+Gmail; not recommended yet \u2014 see RFC G \u00a75).")
|
|
23725
23741
|
}).optional();
|
|
23726
23742
|
AgentGoogleWorkspaceConfigSchema = exports_external.object({
|
|
23743
|
+
account: exports_external.string().regex(/^[^@\s:]+@[^@\s:]+\.[^@\s:]+$/, {
|
|
23744
|
+
message: "google_workspace.account must be a Google account email like " + "'alice@example.com' (colons not allowed)"
|
|
23745
|
+
}).transform((v) => v.trim().toLowerCase()).optional().describe("RFC G: the Google account this agent uses for the Workspace MCP. " + "Must be a key in top-level `google_accounts:` with this agent " + "listed in its `enabled_for[]`. Read by the auth-broker " + "(get-credentials, provider=google) and by the scaffold to decide " + "whether to emit the `gdrive` MCP entry. Normalized to lowercase " + "so it matches the google_accounts key (which is also normalized)."),
|
|
23727
23746
|
approvers: exports_external.array(ApproverIdSchema).min(1).optional().describe("Per-agent approver override. When set, replaces (does not extend) " + "the top-level drive.approvers list for this agent's onboarding card."),
|
|
23728
23747
|
tier: GoogleWorkspaceTierSchema.optional().describe("Per-agent tier override (RFC G Phase 1). When set, replaces the " + "top-level google_workspace.tier for this agent. Common case: most " + "agents on `core`, one specialist on `extended` for Slides access.")
|
|
23729
23748
|
}).optional();
|
|
@@ -23734,9 +23753,17 @@ var init_schema = __esm(() => {
|
|
|
23734
23753
|
per_hour_cap: exports_external.number().int().nonnegative().optional().describe("Max reaction-triggered synthetic turns per chat per rolling hour. " + "Refusals are stderr-logged but not surfaced to the agent. " + "Default 10. Set to 0 to disable triggering via the cap path."),
|
|
23735
23754
|
group_admin_only: exports_external.boolean().optional().describe("In groups/supergroups (negative chat_id), only trigger a synthetic " + "turn when the reacter is a chat admin (creator or administrator). " + "Failing the lookup is treated as non-admin (fail-closed). " + "DMs are never affected by this flag \u2014 the reacter IS the user. " + "Default true.")
|
|
23736
23755
|
}).optional();
|
|
23756
|
+
ReleaseBlock = exports_external.object({
|
|
23757
|
+
channel: exports_external.enum(["dev", "rc", "latest"]).optional(),
|
|
23758
|
+
pin: exports_external.string().regex(/^(sha-[0-9a-f]{7,40}|v\d+\.\d+\.\d+)$/).optional()
|
|
23759
|
+
}).strict().refine((r) => !(r.channel && r.pin), {
|
|
23760
|
+
message: "release.channel and release.pin are mutually exclusive"
|
|
23761
|
+
});
|
|
23762
|
+
NetworkIsolationSchema = exports_external.enum(["host", "strict"]).optional().describe("Container network mode (sec WS6-F1 #1390 / feature #1413). " + "'host' (DEFAULT when unset): `network_mode: host` \u2014 the agent " + "shares the host network stack; hindsight 127.0.0.1:18888 and " + "operator-LAN devices are reachable, but there is NO network " + "isolation from sibling agents or host services (the documented, " + "deliberate shared-host tradeoff). 'strict': the agent joins its " + "OWN dedicated docker bridge network instead \u2014 it cannot reach " + "sibling agents; host services are reached via " + "`host.docker.internal`. OPT-IN: validate hindsight / operator-" + "LAN / cron / boot-self-test paths for your deployment before " + "adopting fleet-wide (default-flip is deferred to that validation " + "cycle, #1413). Cascades override (agent \u2192 profile \u2192 defaults).");
|
|
23737
23763
|
profileFields = {
|
|
23738
23764
|
extends: exports_external.string().optional(),
|
|
23739
23765
|
bot_token: exports_external.string().optional(),
|
|
23766
|
+
release: ReleaseBlock.optional().describe("Release-channel pin / pointer. Either `channel` (dev|rc|latest) or " + "`pin` (sha-<hex>|v<semver>) \u2014 mutually exclusive. Per-agent value " + "REPLACES the root entirely (no field merge)."),
|
|
23740
23767
|
timezone: exports_external.string().regex(TIMEZONE_REGEX, "timezone must be an IANA zone name like 'Australia/Melbourne' or 'UTC' " + "(three-letter aliases like EST/PST and bare offsets like UTC+10 are not accepted)").optional().describe("IANA timezone name (e.g. 'Australia/Melbourne', 'America/New_York', " + "'UTC'). Used to generate the per-turn local-time hint the agent's " + "UserPromptSubmit timezone hook emits, and baked into the systemd " + "unit as TZ= so subprocess `date`/`Date.now()` are correct. If unset " + "at every cascade layer, switchroom auto-detects from /etc/timezone " + "and warns on `reconcile` when the detected zone is UTC."),
|
|
23741
23768
|
soul: exports_external.object({
|
|
23742
23769
|
name: exports_external.string().optional(),
|
|
@@ -23773,8 +23800,8 @@ var init_schema = __esm(() => {
|
|
|
23773
23800
|
session: SessionSchema,
|
|
23774
23801
|
session_continuity: SessionContinuitySchema,
|
|
23775
23802
|
channels: ChannelsSchema,
|
|
23803
|
+
network_isolation: NetworkIsolationSchema,
|
|
23776
23804
|
dangerous_mode: exports_external.boolean().optional(),
|
|
23777
|
-
skip_permission_prompt: exports_external.boolean().optional(),
|
|
23778
23805
|
settings_raw: exports_external.record(exports_external.string(), exports_external.unknown()).optional(),
|
|
23779
23806
|
claude_md_raw: exports_external.string().optional(),
|
|
23780
23807
|
cli_args: exports_external.array(exports_external.string()).optional(),
|
|
@@ -23796,6 +23823,7 @@ var init_schema = __esm(() => {
|
|
|
23796
23823
|
AgentSchema = exports_external.object({
|
|
23797
23824
|
extends: exports_external.string().optional().describe("Name of a profile to inherit from (e.g., 'coding', 'health-coach'). " + "Profiles may be defined inline under switchroom.yaml `profiles:` or as a " + "filesystem directory `profiles/<name>/`. Defaults to DEFAULT_PROFILE " + "('default') when unset."),
|
|
23798
23825
|
bot_token: exports_external.string().optional().describe("Per-agent Telegram bot token or vault reference (overrides global telegram.bot_token)"),
|
|
23826
|
+
release: ReleaseBlock.optional().describe("Per-agent release-channel pin / pointer. REPLACES the root " + "`release` block entirely (no field merge) \u2014 a pinned agent does " + "not inherit the fleet channel, and vice versa."),
|
|
23799
23827
|
bot_username: exports_external.string().optional().describe("Per-agent Telegram bot username (without leading @) when it doesn't " + "contain the agent slug. Replaces the default 'username includes slug' " + "preflight check with an exact (case-insensitive) match. Use when an " + "agent and its bot have intentionally divergent names (e.g. agent " + "'lawgpt' paired with bot '@meken_law_bot')."),
|
|
23800
23828
|
timezone: exports_external.string().regex(TIMEZONE_REGEX, "timezone must be an IANA zone name like 'Australia/Melbourne' or 'UTC' " + "(three-letter aliases like EST/PST and bare offsets like UTC+10 are not accepted)").optional().describe("Per-agent IANA timezone override. Wins over any profile/defaults " + "value and over the top-level switchroom.timezone global. Controls " + "the UserPromptSubmit timezone hook's emitted local time and the " + "systemd unit's TZ= env."),
|
|
23801
23829
|
auth: exports_external.object({
|
|
@@ -23840,7 +23868,7 @@ var init_schema = __esm(() => {
|
|
|
23840
23868
|
session_continuity: SessionContinuitySchema.describe("Handoff-briefing settings. When enabled (default), a Stop hook " + "summarizes each session at shutdown and start.sh injects that " + "briefing into the next session via --append-system-prompt."),
|
|
23841
23869
|
channels: ChannelsSchema.describe("Per-channel configuration. Today only `telegram` is defined; the " + "shape is designed to expand to other channels (Slack, Discord, " + "Matrix, Email) as they're added."),
|
|
23842
23870
|
dangerous_mode: exports_external.boolean().optional().describe("If true, include --dangerously-skip-permissions in start.sh"),
|
|
23843
|
-
|
|
23871
|
+
network_isolation: NetworkIsolationSchema,
|
|
23844
23872
|
admin: exports_external.boolean().optional().describe("If true, the agent's Telegram gateway intercepts admin slash commands " + "(/agents, /logs, /restart, /delete, /update, /auth, /reconcile, etc.) " + "locally before forwarding to Claude. Commands are handled silently \u2014 " + "Claude never sees them. Requires the agent to use the switchroom-telegram " + "plugin. When false or absent, all messages pass through to Claude unchanged."),
|
|
23845
23873
|
settings_raw: exports_external.record(exports_external.string(), exports_external.unknown()).optional().describe("Escape hatch: raw object deep-merged into the generated " + "settings.json as the final step. Use for Claude Code settings " + "keys switchroom doesn't wrap directly (e.g. effort, apiKeyHelper). " + "Power-user-only \u2014 prefer the typed fields when they exist."),
|
|
23846
23874
|
claude_md_raw: exports_external.string().optional().describe("Escape hatch: markdown text appended verbatim to CLAUDE.md on " + "initial scaffold. Not re-applied on reconcile (CLAUDE.md is " + "user-protected). Use for one-off persona tuning that isn't " + "worth a template."),
|
|
@@ -23917,6 +23945,7 @@ var init_schema = __esm(() => {
|
|
|
23917
23945
|
timezone: exports_external.string().regex(TIMEZONE_REGEX, "timezone must be an IANA zone name like 'Australia/Melbourne' or 'UTC'").optional().describe("Global default IANA timezone applied to every agent unless the " + "agent (or its profile) declares its own. See the per-agent " + "timezone field for the full cascade and auto-detection fallback.")
|
|
23918
23946
|
}),
|
|
23919
23947
|
telegram: TelegramConfigSchema,
|
|
23948
|
+
release: ReleaseBlock.optional().describe("Fleet-wide default release-channel pin / pointer for the update " + "flow. Either `channel` (dev|rc|latest) or `pin` (sha-<hex>|v<semver>) " + "\u2014 mutually exclusive. Per-agent `release` REPLACES this entirely."),
|
|
23920
23949
|
memory: MemoryBackendConfigSchema.optional(),
|
|
23921
23950
|
vault: VaultConfigSchema.optional(),
|
|
23922
23951
|
auth: exports_external.object({
|
|
@@ -23955,6 +23984,13 @@ import { resolve as resolve2 } from "node:path";
|
|
|
23955
23984
|
function home() {
|
|
23956
23985
|
return process.env.HOME ?? "/root";
|
|
23957
23986
|
}
|
|
23987
|
+
function warnLegacyStateOnce(legacy) {
|
|
23988
|
+
if (_legacyStateWarned)
|
|
23989
|
+
return;
|
|
23990
|
+
_legacyStateWarned = true;
|
|
23991
|
+
process.stderr.write(`[switchroom] DEPRECATED: reading legacy state from ${legacy}. ` + "Run `mv ~/.clerk ~/.switchroom` (and rename any top-level `clerk:` " + "key in switchroom.yaml to `switchroom:`). This back-compat shim is " + `REMOVED in v0.13.0 \u2014 no automatic migration exists.
|
|
23992
|
+
`);
|
|
23993
|
+
}
|
|
23958
23994
|
function resolveDualPath(pathStr) {
|
|
23959
23995
|
const h = home();
|
|
23960
23996
|
if (pathStr.startsWith("~/")) {
|
|
@@ -23964,15 +24000,17 @@ function resolveDualPath(pathStr) {
|
|
|
23964
24000
|
const frag = rest.slice(DEFAULT_STATE_DIR.length + 1);
|
|
23965
24001
|
if (!existsSync7(absolute)) {
|
|
23966
24002
|
const legacy = resolve2(h, LEGACY_STATE_DIR, frag);
|
|
23967
|
-
if (existsSync7(legacy))
|
|
24003
|
+
if (existsSync7(legacy)) {
|
|
24004
|
+
warnLegacyStateOnce(legacy);
|
|
23968
24005
|
return legacy;
|
|
24006
|
+
}
|
|
23969
24007
|
}
|
|
23970
24008
|
}
|
|
23971
24009
|
return absolute;
|
|
23972
24010
|
}
|
|
23973
24011
|
return resolve2(pathStr);
|
|
23974
24012
|
}
|
|
23975
|
-
var DEFAULT_STATE_DIR = ".switchroom", LEGACY_STATE_DIR = ".clerk";
|
|
24013
|
+
var DEFAULT_STATE_DIR = ".switchroom", LEGACY_STATE_DIR = ".clerk", _legacyStateWarned = false;
|
|
23976
24014
|
var init_paths = () => {};
|
|
23977
24015
|
|
|
23978
24016
|
// ../src/config/overlay-schema.ts
|
|
@@ -24607,11 +24645,8 @@ function formatResetRelative(target, now = new Date) {
|
|
|
24607
24645
|
const remH = hours % 24;
|
|
24608
24646
|
return remH > 0 ? `resets in ${days}d ${remH}h` : `resets in ${days}d`;
|
|
24609
24647
|
}
|
|
24610
|
-
var OAUTH_BETA = "oauth-2025-04-20", DEFAULT_USER_AGENT = "claude-cli/1.0.0 (external, cli)", DEFAULT_PROBE_MODEL = "claude-haiku-4-5-20251001"
|
|
24611
|
-
var init_quota_check =
|
|
24612
|
-
ACCOUNT_QUOTA_CACHE_TTL_MS = 5 * 60000;
|
|
24613
|
-
accountQuotaCache = new Map;
|
|
24614
|
-
});
|
|
24648
|
+
var OAUTH_BETA = "oauth-2025-04-20", DEFAULT_USER_AGENT = "claude-cli/1.0.0 (external, cli)", DEFAULT_PROBE_MODEL = "claude-haiku-4-5-20251001";
|
|
24649
|
+
var init_quota_check = () => {};
|
|
24615
24650
|
|
|
24616
24651
|
// ../src/vault/broker/protocol.ts
|
|
24617
24652
|
function encodeRequest2(req) {
|
|
@@ -24709,7 +24744,7 @@ var init_protocol2 = __esm(() => {
|
|
|
24709
24744
|
ApprovalConsumeRequestSchema = exports_external.object({
|
|
24710
24745
|
v: exports_external.literal(1),
|
|
24711
24746
|
op: exports_external.literal("approval_consume"),
|
|
24712
|
-
request_id: exports_external.string().regex(/^[0-9a-f]{
|
|
24747
|
+
request_id: exports_external.string().regex(/^[0-9a-f]{32}$/)
|
|
24713
24748
|
});
|
|
24714
24749
|
ApprovalRevokeRequestSchema = exports_external.object({
|
|
24715
24750
|
v: exports_external.literal(1),
|
|
@@ -24733,7 +24768,7 @@ var init_protocol2 = __esm(() => {
|
|
|
24733
24768
|
ApprovalRecordRequestSchema = exports_external.object({
|
|
24734
24769
|
v: exports_external.literal(1),
|
|
24735
24770
|
op: exports_external.literal("approval_record"),
|
|
24736
|
-
request_id: exports_external.string().regex(/^[0-9a-f]{
|
|
24771
|
+
request_id: exports_external.string().regex(/^[0-9a-f]{32}$/),
|
|
24737
24772
|
decision: ApprovalDecisionModeSchema,
|
|
24738
24773
|
approver_set: exports_external.array(exports_external.string()),
|
|
24739
24774
|
granted_by_user_id: exports_external.number().int(),
|
|
@@ -24921,11 +24956,10 @@ import * as fs from "node:fs";
|
|
|
24921
24956
|
import { homedir as homedir7 } from "node:os";
|
|
24922
24957
|
import { join as join16 } from "node:path";
|
|
24923
24958
|
function defaultBrokerSocketPath() {
|
|
24924
|
-
if (
|
|
24925
|
-
|
|
24926
|
-
|
|
24959
|
+
if (fs.existsSync(OPERATOR_SOCKET_PATH))
|
|
24960
|
+
return OPERATOR_SOCKET_PATH;
|
|
24961
|
+
if (isDockerRuntime())
|
|
24927
24962
|
return OPERATOR_SOCKET_PATH;
|
|
24928
|
-
}
|
|
24929
24963
|
return LEGACY_SOCKET_PATH;
|
|
24930
24964
|
}
|
|
24931
24965
|
function vaultTokenFilePath(agentSlug) {
|
|
@@ -25207,7 +25241,7 @@ function deriveSlug(inputs, existing) {
|
|
|
25207
25241
|
return `${base}_${n}`;
|
|
25208
25242
|
}
|
|
25209
25243
|
|
|
25210
|
-
//
|
|
25244
|
+
// ../../switchroom/node_modules/.bun/boundary@2.0.0/node_modules/boundary/lib/index.js
|
|
25211
25245
|
var require_lib = __commonJS((exports2) => {
|
|
25212
25246
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
25213
25247
|
exports2.binarySearch = exports2.upperBound = exports2.lowerBound = exports2.compare = undefined;
|
|
@@ -25254,7 +25288,7 @@ var require_lib = __commonJS((exports2) => {
|
|
|
25254
25288
|
exports2.binarySearch = binarySearch;
|
|
25255
25289
|
});
|
|
25256
25290
|
|
|
25257
|
-
//
|
|
25291
|
+
// ../../switchroom/node_modules/.bun/structured-source@4.0.0/node_modules/structured-source/lib/structured-source.js
|
|
25258
25292
|
var require_structured_source = __commonJS((exports2) => {
|
|
25259
25293
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
25260
25294
|
exports2.StructuredSource = undefined;
|
|
@@ -25309,13 +25343,13 @@ var require_structured_source = __commonJS((exports2) => {
|
|
|
25309
25343
|
}
|
|
25310
25344
|
exports2.StructuredSource = StructuredSource;
|
|
25311
25345
|
});
|
|
25312
|
-
//
|
|
25346
|
+
// ../../switchroom/node_modules/.bun/@secretlint+core@12.2.0/node_modules/@secretlint/core/module/SecretLintSourceCodeImpl.js
|
|
25313
25347
|
var import_structured_source;
|
|
25314
25348
|
var init_SecretLintSourceCodeImpl = __esm(() => {
|
|
25315
25349
|
import_structured_source = __toESM(require_structured_source(), 1);
|
|
25316
25350
|
});
|
|
25317
25351
|
|
|
25318
|
-
//
|
|
25352
|
+
// ../../switchroom/node_modules/.bun/@secretlint+core@12.2.0/node_modules/@secretlint/core/module/helper/promise-event-emitter.js
|
|
25319
25353
|
class EventEmitter {
|
|
25320
25354
|
#listeners = new Map;
|
|
25321
25355
|
on(type, listener) {
|
|
@@ -25354,9 +25388,9 @@ class EventEmitter {
|
|
|
25354
25388
|
return Array.from(this.#listeners.get(type) ?? []);
|
|
25355
25389
|
}
|
|
25356
25390
|
}
|
|
25357
|
-
//
|
|
25391
|
+
// ../../switchroom/node_modules/.bun/@secretlint+core@12.2.0/node_modules/@secretlint/core/module/RuleContext.js
|
|
25358
25392
|
var init_RuleContext = () => {};
|
|
25359
|
-
//
|
|
25393
|
+
// ../../switchroom/node_modules/.bun/@secretlint+profiler@12.2.0/node_modules/@secretlint/profiler/module/index.js
|
|
25360
25394
|
class SecretLintProfiler {
|
|
25361
25395
|
perf;
|
|
25362
25396
|
entries = [];
|
|
@@ -25413,7 +25447,7 @@ class SecretLintProfiler {
|
|
|
25413
25447
|
}
|
|
25414
25448
|
}
|
|
25415
25449
|
|
|
25416
|
-
//
|
|
25450
|
+
// ../../switchroom/node_modules/.bun/@secretlint+profiler@12.2.0/node_modules/@secretlint/profiler/module/node.js
|
|
25417
25451
|
import perf_hooks from "node:perf_hooks";
|
|
25418
25452
|
|
|
25419
25453
|
class NullPerformanceObserver {
|
|
@@ -25428,19 +25462,19 @@ var init_node = __esm(() => {
|
|
|
25428
25462
|
});
|
|
25429
25463
|
});
|
|
25430
25464
|
|
|
25431
|
-
//
|
|
25465
|
+
// ../../switchroom/node_modules/.bun/@secretlint+core@12.2.0/node_modules/@secretlint/core/module/RunningEvents.js
|
|
25432
25466
|
var init_RunningEvents = __esm(() => {
|
|
25433
25467
|
init_node();
|
|
25434
25468
|
});
|
|
25435
25469
|
|
|
25436
|
-
//
|
|
25470
|
+
// ../../switchroom/node_modules/.bun/@secretlint+core@12.2.0/node_modules/@secretlint/core/module/RulePresetContext.js
|
|
25437
25471
|
var init_RulePresetContext = __esm(() => {
|
|
25438
25472
|
init_RuleContext();
|
|
25439
25473
|
});
|
|
25440
|
-
//
|
|
25474
|
+
// ../../switchroom/node_modules/.bun/@secretlint+core@12.2.0/node_modules/@secretlint/core/module/messages/index.js
|
|
25441
25475
|
var init_messages = () => {};
|
|
25442
25476
|
|
|
25443
|
-
//
|
|
25477
|
+
// ../../switchroom/node_modules/.bun/@secretlint+core@12.2.0/node_modules/@secretlint/core/module/index.js
|
|
25444
25478
|
var import_debug, debug;
|
|
25445
25479
|
var init_module = __esm(() => {
|
|
25446
25480
|
init_SecretLintSourceCodeImpl();
|
|
@@ -25453,7 +25487,7 @@ var init_module = __esm(() => {
|
|
|
25453
25487
|
debug = import_debug.default("@secretlint/core");
|
|
25454
25488
|
});
|
|
25455
25489
|
|
|
25456
|
-
//
|
|
25490
|
+
// ../../switchroom/node_modules/.bun/@secretlint+secretlint-rule-preset-recommend@12.2.0/node_modules/@secretlint/secretlint-rule-preset-recommend/module/index.js
|
|
25457
25491
|
function requireLodash_uniq() {
|
|
25458
25492
|
if (hasRequiredLodash_uniq)
|
|
25459
25493
|
return lodash_uniq;
|
|
@@ -27695,35 +27729,45 @@ async function probeGateway(info) {
|
|
|
27695
27729
|
return { status: "ok", label: "Gateway", detail: parts.join(" \u00b7 ") };
|
|
27696
27730
|
})());
|
|
27697
27731
|
}
|
|
27698
|
-
async function probeQuota(claudeConfigDir, _agentDir, fetchImpl = fetch) {
|
|
27732
|
+
async function probeQuota(claudeConfigDir, _agentDir, fetchImpl = fetch, opts = {}) {
|
|
27699
27733
|
return withTimeout("Quota", (async () => {
|
|
27700
27734
|
const cached = readQuotaCache();
|
|
27701
27735
|
if (cached) {
|
|
27702
27736
|
return cached;
|
|
27703
27737
|
}
|
|
27704
|
-
let
|
|
27705
|
-
|
|
27706
|
-
|
|
27707
|
-
|
|
27708
|
-
|
|
27709
|
-
|
|
27710
|
-
claudeDirForProbe = candidate;
|
|
27711
|
-
break;
|
|
27738
|
+
let probe = null;
|
|
27739
|
+
if (opts.brokerProbe) {
|
|
27740
|
+
try {
|
|
27741
|
+
probe = await opts.brokerProbe(QUOTA_BROKER_TIMEOUT_MS);
|
|
27742
|
+
} catch {
|
|
27743
|
+
probe = null;
|
|
27712
27744
|
}
|
|
27713
27745
|
}
|
|
27714
|
-
if (!
|
|
27715
|
-
|
|
27716
|
-
|
|
27717
|
-
|
|
27718
|
-
|
|
27719
|
-
|
|
27720
|
-
|
|
27746
|
+
if (!probe) {
|
|
27747
|
+
let claudeDirForProbe = null;
|
|
27748
|
+
for (const candidate of [
|
|
27749
|
+
claudeConfigDir,
|
|
27750
|
+
join21(claudeConfigDir, "accounts", "default")
|
|
27751
|
+
]) {
|
|
27752
|
+
if (existsSync23(join21(candidate, ".oauth-token"))) {
|
|
27753
|
+
claudeDirForProbe = candidate;
|
|
27754
|
+
break;
|
|
27755
|
+
}
|
|
27756
|
+
}
|
|
27757
|
+
if (!claudeDirForProbe) {
|
|
27758
|
+
return {
|
|
27759
|
+
status: "degraded",
|
|
27760
|
+
label: "Quota",
|
|
27761
|
+
detail: "no OAuth token",
|
|
27762
|
+
nextStep: "No OAuth token on disk \u2014 register a fleet account: `switchroom auth add <label> --from-oauth` then `switchroom auth use <label>` (RFC H)"
|
|
27763
|
+
};
|
|
27764
|
+
}
|
|
27765
|
+
probe = await fetchQuota({
|
|
27766
|
+
claudeConfigDir: claudeDirForProbe,
|
|
27767
|
+
fetchImpl,
|
|
27768
|
+
timeoutMs: QUOTA_DIRECT_FALLBACK_TIMEOUT_MS
|
|
27769
|
+
});
|
|
27721
27770
|
}
|
|
27722
|
-
const probe = await fetchQuota({
|
|
27723
|
-
claudeConfigDir: claudeDirForProbe,
|
|
27724
|
-
fetchImpl,
|
|
27725
|
-
timeoutMs: 1800
|
|
27726
|
-
});
|
|
27727
27771
|
if (!probe.ok) {
|
|
27728
27772
|
const isAuth = /auth rejected|HTTP 401|HTTP 403/i.test(probe.reason);
|
|
27729
27773
|
return {
|
|
@@ -27740,7 +27784,7 @@ async function probeQuota(claudeConfigDir, _agentDir, fetchImpl = fetch) {
|
|
|
27740
27784
|
};
|
|
27741
27785
|
writeQuotaCache(result);
|
|
27742
27786
|
return result;
|
|
27743
|
-
})());
|
|
27787
|
+
})(), QUOTA_PROBE_OUTER_TIMEOUT_MS);
|
|
27744
27788
|
}
|
|
27745
27789
|
async function probeHindsight(bankName, fetchImpl = fetch) {
|
|
27746
27790
|
return withTimeout("Hindsight", (async () => {
|
|
@@ -27761,7 +27805,7 @@ async function probeHindsight(bankName, fetchImpl = fetch) {
|
|
|
27761
27805
|
status: "fail",
|
|
27762
27806
|
label: "Hindsight",
|
|
27763
27807
|
detail: "unreachable",
|
|
27764
|
-
nextStep: "Hindsight server not responding on 127.0.0.1:18888 \u2014 start it with `hindsight serve` or check `systemctl --user status hindsight`"
|
|
27808
|
+
nextStep: process.env.SWITCHROOM_RUNTIME === "docker" ? "Hindsight server not responding on 127.0.0.1:18888 \u2014 check the hindsight container (`docker ps` / `docker logs`); it must be reachable on the host network." : "Hindsight server not responding on 127.0.0.1:18888 \u2014 start it with `hindsight serve` (or check `systemctl --user status hindsight`)."
|
|
27765
27809
|
};
|
|
27766
27810
|
}
|
|
27767
27811
|
const bankSuffix = bankName ? ` \u00b7 bank=${bankName}` : "";
|
|
@@ -27965,8 +28009,26 @@ async function probeSkills(agentDir, opts = {}) {
|
|
|
27965
28009
|
continue;
|
|
27966
28010
|
}
|
|
27967
28011
|
}
|
|
28012
|
+
const overlayDir = opts.overlaySkillsDir ?? join21(agentDir, "skills.d");
|
|
28013
|
+
const overlaySlugs = new Set;
|
|
28014
|
+
if (fs2.exists(overlayDir)) {
|
|
28015
|
+
let overlayEntries = [];
|
|
28016
|
+
try {
|
|
28017
|
+
overlayEntries = fs2.readdir(overlayDir);
|
|
28018
|
+
} catch {}
|
|
28019
|
+
for (const name of overlayEntries) {
|
|
28020
|
+
const m = name.match(/^(.+)\.ya?ml$/i);
|
|
28021
|
+
if (!m)
|
|
28022
|
+
continue;
|
|
28023
|
+
overlaySlugs.add(m[1]);
|
|
28024
|
+
}
|
|
28025
|
+
}
|
|
28026
|
+
const liveEntries = entries.filter((n) => !dangling.includes(n)).sort();
|
|
28027
|
+
const switchroomSkills = liveEntries.filter((n) => !overlaySlugs.has(n));
|
|
28028
|
+
const agentSkills = liveEntries.filter((n) => overlaySlugs.has(n));
|
|
28029
|
+
const bucketed = renderBucketedSkills(switchroomSkills, agentSkills);
|
|
27968
28030
|
if (dangling.length === 0) {
|
|
27969
|
-
return { status: "ok", label: "Skills", detail:
|
|
28031
|
+
return { status: "ok", label: "Skills", detail: bucketed };
|
|
27970
28032
|
}
|
|
27971
28033
|
const named = dangling.slice(0, max).join(", ");
|
|
27972
28034
|
const more = dangling.length > max ? ` +${dangling.length - max} more` : "";
|
|
@@ -27974,12 +28036,20 @@ async function probeSkills(agentDir, opts = {}) {
|
|
|
27974
28036
|
return {
|
|
27975
28037
|
status: "degraded",
|
|
27976
28038
|
label: "Skills",
|
|
27977
|
-
detail: `${dangling.length}/${entries.length} dangling: ${named}${more}`,
|
|
28039
|
+
detail: `${dangling.length}/${entries.length} dangling: ${named}${more} \u00b7 ${bucketed}`,
|
|
27978
28040
|
nextStep: `Run \`switchroom agent reconcile${reconcileTarget}\` to rebuild symlinks, or remove unused entries from switchroom.yaml`
|
|
27979
28041
|
};
|
|
27980
28042
|
})());
|
|
27981
28043
|
}
|
|
27982
|
-
|
|
28044
|
+
function renderBucketedSkills(switchroom, agent) {
|
|
28045
|
+
const parts = [];
|
|
28046
|
+
if (switchroom.length > 0)
|
|
28047
|
+
parts.push(`Switchroom: ${switchroom.join(", ")}`);
|
|
28048
|
+
if (agent.length > 0)
|
|
28049
|
+
parts.push(`Agent: ${agent.join(", ")}`);
|
|
28050
|
+
return parts.length === 0 ? "none resolved" : parts.join(" \u00b7 ");
|
|
28051
|
+
}
|
|
28052
|
+
var execFile3, PROBE_TIMEOUT_MS = 2000, QUOTA_BROKER_TIMEOUT_MS = 7000, QUOTA_DIRECT_FALLBACK_TIMEOUT_MS = 5000, QUOTA_PROBE_OUTER_TIMEOUT_MS = 9000, TOKEN_EXPIRING_SOON_DAYS = 7, AGENT_RETRY_INTERVAL_MS = 1500, AGENT_RETRY_MAX_MS = 12000, AGENT_LIVE_WINDOW_MS = 45000, AGENT_LIVE_POLL_INTERVAL_MS = 2000, AGENT_LIVE_FOLLOWUP_REPOLL_MS = 30000, realProcFs, SCHEDULER_LOCK_PATH_DEFAULT = "/state/agent/scheduler.lock", SCHEDULER_JSONL_PATH_DEFAULT = "/state/agent/scheduler.jsonl", SCHEDULER_FRESH_BOOT_MS = 30000, realSchedulerFs, realSkillsFs;
|
|
27983
28053
|
var init_boot_probes = __esm(() => {
|
|
27984
28054
|
init_quota_cache();
|
|
27985
28055
|
init_quota_check();
|
|
@@ -28200,7 +28270,8 @@ function renderBootCard(opts) {
|
|
|
28200
28270
|
if (restartReason === "crash") {
|
|
28201
28271
|
const ageStr = restartAgeMs != null && restartAgeMs > 0 ? ` \u00b7 ${(restartAgeMs / 1000).toFixed(1)}s ago` : "";
|
|
28202
28272
|
degradedRows.push(`\u26a0\ufe0f <b>Restart</b> ${escapeHtml8(REASON_LABEL.crash)}${ageStr}`);
|
|
28203
|
-
|
|
28273
|
+
const tailCmd = process.env.SWITCHROOM_RUNTIME === "docker" ? `docker logs --tail 100 switchroom-${escapeHtml8(agentSlug)}` : `journalctl --user -u switchroom-${escapeHtml8(agentSlug)} -n 100`;
|
|
28274
|
+
degradedRows.push(` \u21b3 Tail logs: <code>${tailCmd}</code>`);
|
|
28204
28275
|
}
|
|
28205
28276
|
if (probes) {
|
|
28206
28277
|
for (const key of PROBE_KEYS) {
|
|
@@ -28224,6 +28295,10 @@ function renderBootCard(opts) {
|
|
|
28224
28295
|
sections.push("", ...degradedRows);
|
|
28225
28296
|
if (accountRows.length > 0)
|
|
28226
28297
|
sections.push("", ...accountRows);
|
|
28298
|
+
if (opts.updateOutcomeLine) {
|
|
28299
|
+
sections.push("", ...opts.updateOutcomeLine.split(`
|
|
28300
|
+
`));
|
|
28301
|
+
}
|
|
28227
28302
|
if (sections.length === 1)
|
|
28228
28303
|
return ack;
|
|
28229
28304
|
return sections.join(`
|
|
@@ -28243,7 +28318,7 @@ async function runAllProbes(opts) {
|
|
|
28243
28318
|
probeGateway(opts.gatewayInfo).then((r) => {
|
|
28244
28319
|
probes.gateway = r;
|
|
28245
28320
|
}),
|
|
28246
|
-
probeQuota(claudeDir, opts.agentDir, opts.fetchImpl).then((r) => {
|
|
28321
|
+
probeQuota(claudeDir, opts.agentDir, opts.fetchImpl, { brokerProbe: opts.probeQuotaViaBroker }).then((r) => {
|
|
28247
28322
|
probes.quota = r;
|
|
28248
28323
|
}),
|
|
28249
28324
|
probeHindsight(opts.bankName, opts.fetchImpl).then((r) => {
|
|
@@ -28273,7 +28348,8 @@ async function startBootCard(chatId, threadId, bot, opts, ackMessageId, log) {
|
|
|
28273
28348
|
agentSlug: opts.agentSlug,
|
|
28274
28349
|
version: opts.version,
|
|
28275
28350
|
restartReason: opts.restartReason,
|
|
28276
|
-
restartAgeMs: opts.restartAgeMs
|
|
28351
|
+
restartAgeMs: opts.restartAgeMs,
|
|
28352
|
+
...opts.updateOutcomeLine ? { updateOutcomeLine: opts.updateOutcomeLine } : {}
|
|
28277
28353
|
});
|
|
28278
28354
|
const silentBootCard = opts.restartReasonDetail?.startsWith("operator:") === true;
|
|
28279
28355
|
let messageId;
|
|
@@ -28338,7 +28414,8 @@ async function startBootCard(chatId, threadId, bot, opts, ackMessageId, log) {
|
|
|
28338
28414
|
restartAgeMs: opts.restartAgeMs,
|
|
28339
28415
|
...accountRows ? { accounts: accountRows } : {},
|
|
28340
28416
|
...resolvedRows.length > 0 ? { resolvedRows } : {},
|
|
28341
|
-
...snoozeRows.length > 0 ? { snoozeRows } : {}
|
|
28417
|
+
...snoozeRows.length > 0 ? { snoozeRows } : {},
|
|
28418
|
+
...opts.updateOutcomeLine ? { updateOutcomeLine: opts.updateOutcomeLine } : {}
|
|
28342
28419
|
});
|
|
28343
28420
|
if (currentText !== ackText) {
|
|
28344
28421
|
try {
|
|
@@ -28379,7 +28456,8 @@ async function startBootCard(chatId, threadId, bot, opts, ackMessageId, log) {
|
|
|
28379
28456
|
restartAgeMs: opts.restartAgeMs,
|
|
28380
28457
|
...accountRows ? { accounts: accountRows } : {},
|
|
28381
28458
|
...resolvedRows.length > 0 ? { resolvedRows } : {},
|
|
28382
|
-
...snoozeRows.length > 0 ? { snoozeRows } : {}
|
|
28459
|
+
...snoozeRows.length > 0 ? { snoozeRows } : {},
|
|
28460
|
+
...opts.updateOutcomeLine ? { updateOutcomeLine: opts.updateOutcomeLine } : {}
|
|
28383
28461
|
});
|
|
28384
28462
|
if (updatedText === currentText)
|
|
28385
28463
|
continue;
|
|
@@ -28469,11 +28547,11 @@ var init_flock = () => {};
|
|
|
28469
28547
|
// ../src/vault/vault.ts
|
|
28470
28548
|
import { randomBytes as randomBytes5, scryptSync, createCipheriv, createDecipheriv } from "node:crypto";
|
|
28471
28549
|
import {
|
|
28472
|
-
readFileSync as
|
|
28550
|
+
readFileSync as readFileSync30,
|
|
28473
28551
|
writeFileSync as writeFileSync19,
|
|
28474
|
-
existsSync as
|
|
28552
|
+
existsSync as existsSync31,
|
|
28475
28553
|
renameSync as renameSync11,
|
|
28476
|
-
mkdirSync as
|
|
28554
|
+
mkdirSync as mkdirSync18,
|
|
28477
28555
|
unlinkSync as unlinkSync12,
|
|
28478
28556
|
lstatSync,
|
|
28479
28557
|
realpathSync
|
|
@@ -28509,12 +28587,12 @@ function normalizeSecrets(raw) {
|
|
|
28509
28587
|
return out;
|
|
28510
28588
|
}
|
|
28511
28589
|
function openVault(passphrase, vaultPath) {
|
|
28512
|
-
if (!
|
|
28590
|
+
if (!existsSync31(vaultPath)) {
|
|
28513
28591
|
throw new VaultError(`Vault file not found: ${vaultPath}`);
|
|
28514
28592
|
}
|
|
28515
28593
|
let vaultFile;
|
|
28516
28594
|
try {
|
|
28517
|
-
vaultFile = JSON.parse(
|
|
28595
|
+
vaultFile = JSON.parse(readFileSync30(vaultPath, "utf8"));
|
|
28518
28596
|
} catch {
|
|
28519
28597
|
throw new VaultError(`Failed to read vault file: ${vaultPath}`);
|
|
28520
28598
|
}
|
|
@@ -28560,15 +28638,15 @@ var init_vault = __esm(() => {
|
|
|
28560
28638
|
// ../src/vault/resolver.ts
|
|
28561
28639
|
import {
|
|
28562
28640
|
chmodSync as chmodSync4,
|
|
28563
|
-
closeSync as
|
|
28564
|
-
mkdirSync as
|
|
28641
|
+
closeSync as closeSync7,
|
|
28642
|
+
mkdirSync as mkdirSync19,
|
|
28565
28643
|
mkdtempSync as mkdtempSync2,
|
|
28566
|
-
openSync as
|
|
28644
|
+
openSync as openSync7,
|
|
28567
28645
|
rmSync as rmSync3,
|
|
28568
28646
|
statSync as statSync11,
|
|
28569
28647
|
writeSync as writeSync2
|
|
28570
28648
|
} from "node:fs";
|
|
28571
|
-
import { join as
|
|
28649
|
+
import { join as join31 } from "node:path";
|
|
28572
28650
|
import { tmpdir } from "node:os";
|
|
28573
28651
|
import { constants as fsConstants } from "node:fs";
|
|
28574
28652
|
function isVaultReference(value) {
|
|
@@ -28620,32 +28698,32 @@ function materializationRoot() {
|
|
|
28620
28698
|
return cachedRoot;
|
|
28621
28699
|
const xdg = process.env.XDG_RUNTIME_DIR;
|
|
28622
28700
|
if (xdg) {
|
|
28623
|
-
const base =
|
|
28624
|
-
|
|
28625
|
-
cachedRoot = mkdtempSync2(
|
|
28701
|
+
const base = join31(xdg, "switchroom", "vault");
|
|
28702
|
+
mkdirSync19(base, { recursive: true, mode: 448 });
|
|
28703
|
+
cachedRoot = mkdtempSync2(join31(base, "run-"));
|
|
28626
28704
|
} else {
|
|
28627
|
-
cachedRoot = mkdtempSync2(
|
|
28705
|
+
cachedRoot = mkdtempSync2(join31(tmpdir(), "switchroom-vault-"));
|
|
28628
28706
|
}
|
|
28629
28707
|
chmodSync4(cachedRoot, 448);
|
|
28630
28708
|
return cachedRoot;
|
|
28631
28709
|
}
|
|
28632
28710
|
function writeFileExclusive(filePath, content) {
|
|
28633
28711
|
const buf = typeof content === "string" ? Buffer.from(content, "utf8") : content;
|
|
28634
|
-
const fd =
|
|
28712
|
+
const fd = openSync7(filePath, fsConstants.O_WRONLY | fsConstants.O_CREAT | fsConstants.O_EXCL, 384);
|
|
28635
28713
|
try {
|
|
28636
28714
|
writeSync2(fd, buf);
|
|
28637
28715
|
} finally {
|
|
28638
|
-
|
|
28716
|
+
closeSync7(fd);
|
|
28639
28717
|
}
|
|
28640
28718
|
}
|
|
28641
28719
|
function materializeFilesEntry(key, files) {
|
|
28642
|
-
const dir =
|
|
28720
|
+
const dir = join31(materializationRoot(), key);
|
|
28643
28721
|
if (materializedDirs.has(dir)) {
|
|
28644
28722
|
try {
|
|
28645
28723
|
rmSync3(dir, { recursive: true, force: true });
|
|
28646
28724
|
} catch {}
|
|
28647
28725
|
}
|
|
28648
|
-
|
|
28726
|
+
mkdirSync19(dir, { recursive: true, mode: 448 });
|
|
28649
28727
|
chmodSync4(dir, 448);
|
|
28650
28728
|
const st = statSync11(dir);
|
|
28651
28729
|
if (typeof process.getuid === "function" && st.uid !== process.getuid()) {
|
|
@@ -28655,7 +28733,7 @@ function materializeFilesEntry(key, files) {
|
|
|
28655
28733
|
if (filename.includes("/") || filename.includes("\\") || filename === ".." || filename === "." || filename.includes("\x00")) {
|
|
28656
28734
|
throw new Error(`Refusing to materialize vault file with unsafe name: ${filename}`);
|
|
28657
28735
|
}
|
|
28658
|
-
const filePath =
|
|
28736
|
+
const filePath = join31(dir, filename);
|
|
28659
28737
|
const content = encoding === "base64" ? Buffer.from(value, "base64") : value;
|
|
28660
28738
|
writeFileExclusive(filePath, content);
|
|
28661
28739
|
}
|
|
@@ -28788,7 +28866,7 @@ __export(exports_materialize_bot_token, {
|
|
|
28788
28866
|
materializeBotToken: () => materializeBotToken,
|
|
28789
28867
|
BotTokenMaterializeError: () => BotTokenMaterializeError
|
|
28790
28868
|
});
|
|
28791
|
-
import { existsSync as
|
|
28869
|
+
import { existsSync as existsSync32 } from "node:fs";
|
|
28792
28870
|
function pickConfiguredToken(config, agentName3) {
|
|
28793
28871
|
if (agentName3) {
|
|
28794
28872
|
const agent = config.agents?.[agentName3];
|
|
@@ -28802,7 +28880,7 @@ function tryDirectVaultRead(ref, config, passphrase) {
|
|
|
28802
28880
|
if (!passphrase)
|
|
28803
28881
|
return null;
|
|
28804
28882
|
const vaultPath = resolvePath(config.vault?.path ?? "~/.switchroom/vault.enc");
|
|
28805
|
-
if (!
|
|
28883
|
+
if (!existsSync32(vaultPath))
|
|
28806
28884
|
return null;
|
|
28807
28885
|
try {
|
|
28808
28886
|
const secrets = openVault(passphrase, vaultPath);
|
|
@@ -28854,7 +28932,7 @@ async function materializeBotToken(opts = {}) {
|
|
|
28854
28932
|
}
|
|
28855
28933
|
}
|
|
28856
28934
|
if (!brokerResult.ok && brokerResult.reason === "locked") {
|
|
28857
|
-
throw new BotTokenMaterializeError("Bot token is a vault reference but vault is locked. Run
|
|
28935
|
+
throw new BotTokenMaterializeError("Bot token is a vault reference but the vault is locked. Run `switchroom vault broker unlock` (or set SWITCHROOM_VAULT_PASSPHRASE / enable auto-unlock).", "locked");
|
|
28858
28936
|
}
|
|
28859
28937
|
if (!brokerResult.ok && brokerResult.reason === "denied") {
|
|
28860
28938
|
throw new BotTokenMaterializeError(`Bot token resolution denied by vault broker (ACL). Check that this unit is authorised for the bot_token key in switchroom.yaml.`, "denied");
|
|
@@ -28869,7 +28947,7 @@ async function materializeBotToken(opts = {}) {
|
|
|
28869
28947
|
}
|
|
28870
28948
|
return direct;
|
|
28871
28949
|
}
|
|
28872
|
-
const unlockHint = isDockerRuntime() ? "Bring up the project (docker compose -p switchroom up -d), then `switchroom vault broker unlock` (or `docker exec -it switchroom-vault-broker switchroom vault broker unlock`), or set SWITCHROOM_VAULT_PASSPHRASE." : "Start the broker (switchroom vault unlock) or set SWITCHROOM_VAULT_PASSPHRASE.";
|
|
28950
|
+
const unlockHint = isDockerRuntime() ? "Bring up the project (docker compose -p switchroom up -d), then `switchroom vault broker unlock` (or `docker exec -it switchroom-vault-broker switchroom vault broker unlock`), or set SWITCHROOM_VAULT_PASSPHRASE." : "Start + unlock the broker (`switchroom vault broker unlock`) or set SWITCHROOM_VAULT_PASSPHRASE.";
|
|
28873
28951
|
throw new BotTokenMaterializeError(`Bot token is a vault reference (${configured}) but vault broker is unreachable and no SWITCHROOM_VAULT_PASSPHRASE is available for direct decrypt. ` + unlockHint, brokerResult.ok ? "unknown" : brokerResult.reason);
|
|
28874
28952
|
}
|
|
28875
28953
|
var BotTokenMaterializeError;
|
|
@@ -28894,7 +28972,7 @@ __export(exports_tmux, {
|
|
|
28894
28972
|
captureAgentPane: () => captureAgentPane
|
|
28895
28973
|
});
|
|
28896
28974
|
import { execFileSync as execFileSync4 } from "node:child_process";
|
|
28897
|
-
import { mkdirSync as
|
|
28975
|
+
import { mkdirSync as mkdirSync20, readdirSync as readdirSync6, statSync as statSync12, unlinkSync as unlinkSync13, writeFileSync as writeFileSync20 } from "node:fs";
|
|
28898
28976
|
import { resolve as resolve7 } from "node:path";
|
|
28899
28977
|
function captureAgentPane(opts) {
|
|
28900
28978
|
const { agentName: agentName3, agentDir, reason } = opts;
|
|
@@ -28906,7 +28984,7 @@ function captureAgentPane(opts) {
|
|
|
28906
28984
|
const reasonSlug = sanitizeReason(reason);
|
|
28907
28985
|
const outPath = resolve7(outDir, `${ts}-${reasonSlug}.txt`);
|
|
28908
28986
|
try {
|
|
28909
|
-
|
|
28987
|
+
mkdirSync20(outDir, { recursive: true, mode: 493 });
|
|
28910
28988
|
} catch (err) {
|
|
28911
28989
|
const msg = `mkdir crash-reports failed: ${err.message}`;
|
|
28912
28990
|
console.error(`[tmux-capture] ${agentName3}: ${msg}`);
|
|
@@ -29476,7 +29554,7 @@ function parseApprovalCallback(data) {
|
|
|
29476
29554
|
return null;
|
|
29477
29555
|
const request_id = parts[1];
|
|
29478
29556
|
const choiceStr = parts[2];
|
|
29479
|
-
if (!/^[0-9a-f]{
|
|
29557
|
+
if (!/^[0-9a-f]{32}$/.test(request_id ?? ""))
|
|
29480
29558
|
return null;
|
|
29481
29559
|
switch (choiceStr) {
|
|
29482
29560
|
case "once":
|
|
@@ -29611,22 +29689,22 @@ var import_runner2 = __toESM(require_mod3(), 1);
|
|
|
29611
29689
|
import { randomBytes as randomBytes6 } from "crypto";
|
|
29612
29690
|
import { execFileSync as execFileSync5, execSync as execSync2, spawn as spawn2 } from "child_process";
|
|
29613
29691
|
import {
|
|
29614
|
-
readFileSync as
|
|
29692
|
+
readFileSync as readFileSync31,
|
|
29615
29693
|
writeFileSync as writeFileSync21,
|
|
29616
|
-
mkdirSync as
|
|
29694
|
+
mkdirSync as mkdirSync21,
|
|
29617
29695
|
readdirSync as readdirSync7,
|
|
29618
29696
|
rmSync as rmSync4,
|
|
29619
29697
|
statSync as statSync13,
|
|
29620
29698
|
renameSync as renameSync12,
|
|
29621
29699
|
realpathSync as realpathSync2,
|
|
29622
29700
|
chmodSync as chmodSync5,
|
|
29623
|
-
openSync as
|
|
29624
|
-
closeSync as
|
|
29625
|
-
existsSync as
|
|
29701
|
+
openSync as openSync8,
|
|
29702
|
+
closeSync as closeSync8,
|
|
29703
|
+
existsSync as existsSync33,
|
|
29626
29704
|
unlinkSync as unlinkSync14
|
|
29627
29705
|
} from "fs";
|
|
29628
|
-
import { homedir as
|
|
29629
|
-
import { join as
|
|
29706
|
+
import { homedir as homedir12 } from "os";
|
|
29707
|
+
import { join as join32, extname, sep as sep3, basename as basename7 } from "path";
|
|
29630
29708
|
|
|
29631
29709
|
// plugin-logger.ts
|
|
29632
29710
|
import { appendFileSync, mkdirSync, renameSync, statSync, existsSync } from "fs";
|
|
@@ -31760,6 +31838,12 @@ async function retryWithThreadFallback(retry, send, opts) {
|
|
|
31760
31838
|
throw err;
|
|
31761
31839
|
}
|
|
31762
31840
|
}
|
|
31841
|
+
function isHtmlParseRejectError(err) {
|
|
31842
|
+
if (!(err instanceof import_grammy.GrammyError) || err.error_code !== 400)
|
|
31843
|
+
return false;
|
|
31844
|
+
const d = (err.description || "").toLowerCase();
|
|
31845
|
+
return d.includes("can't parse entities") || d.includes("can\u2019t parse entities") || d.includes("unsupported start tag") || d.includes("unclosed start tag") || d.includes("can't find end of the entity") || d.includes("expected end tag");
|
|
31846
|
+
}
|
|
31763
31847
|
|
|
31764
31848
|
// shared/bot-runtime.ts
|
|
31765
31849
|
var import_grammy3 = __toESM(require_mod2(), 1);
|
|
@@ -31924,7 +32008,7 @@ function clear(key) {
|
|
|
31924
32008
|
state.delete(key);
|
|
31925
32009
|
}
|
|
31926
32010
|
|
|
31927
|
-
//
|
|
32011
|
+
// ../../switchroom/node_modules/.bun/posthog-node@5.29.2/node_modules/posthog-node/dist/extensions/error-tracking/modifiers/module.node.mjs
|
|
31928
32012
|
import { dirname as dirname2, posix, sep as sep2 } from "path";
|
|
31929
32013
|
function createModulerModifier() {
|
|
31930
32014
|
const getModuleFromFileName = createGetModuleFromFilename();
|
|
@@ -31960,7 +32044,7 @@ function normalizeWindowsPath(path) {
|
|
|
31960
32044
|
return path.replace(/^[A-Z]:/, "").replace(/\\/g, "/");
|
|
31961
32045
|
}
|
|
31962
32046
|
|
|
31963
|
-
//
|
|
32047
|
+
// ../../switchroom/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/featureFlagUtils.mjs
|
|
31964
32048
|
var normalizeFlagsResponse = (flagsResponse) => {
|
|
31965
32049
|
if ("flags" in flagsResponse) {
|
|
31966
32050
|
const featureFlags = getFlagValuesFromFlags(flagsResponse.flags);
|
|
@@ -32031,7 +32115,7 @@ var parsePayload = (response) => {
|
|
|
32031
32115
|
}
|
|
32032
32116
|
};
|
|
32033
32117
|
|
|
32034
|
-
//
|
|
32118
|
+
// ../../switchroom/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/gzip.mjs
|
|
32035
32119
|
function isGzipSupported() {
|
|
32036
32120
|
return "CompressionStream" in globalThis;
|
|
32037
32121
|
}
|
|
@@ -32051,7 +32135,7 @@ async function gzipCompress(input, isDebug = true) {
|
|
|
32051
32135
|
}
|
|
32052
32136
|
}
|
|
32053
32137
|
|
|
32054
|
-
//
|
|
32138
|
+
// ../../switchroom/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/vendor/uuidv7.mjs
|
|
32055
32139
|
/*! For license information please see uuidv7.mjs.LICENSE.txt */
|
|
32056
32140
|
var DIGITS = "0123456789abcdef";
|
|
32057
32141
|
|
|
@@ -32229,7 +32313,7 @@ var defaultGenerator;
|
|
|
32229
32313
|
var uuidv7 = () => uuidv7obj().toString();
|
|
32230
32314
|
var uuidv7obj = () => (defaultGenerator || (defaultGenerator = new V7Generator)).generate();
|
|
32231
32315
|
|
|
32232
|
-
//
|
|
32316
|
+
// ../../switchroom/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/types.mjs
|
|
32233
32317
|
var types_PostHogPersistedProperty = /* @__PURE__ */ function(PostHogPersistedProperty) {
|
|
32234
32318
|
PostHogPersistedProperty["AnonymousId"] = "anonymous_id";
|
|
32235
32319
|
PostHogPersistedProperty["DistinctId"] = "distinct_id";
|
|
@@ -32262,7 +32346,7 @@ var types_PostHogPersistedProperty = /* @__PURE__ */ function(PostHogPersistedPr
|
|
|
32262
32346
|
return PostHogPersistedProperty;
|
|
32263
32347
|
}({});
|
|
32264
32348
|
|
|
32265
|
-
//
|
|
32349
|
+
// ../../switchroom/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/utils/bot-detection.mjs
|
|
32266
32350
|
var DEFAULT_BLOCKED_UA_STRS = [
|
|
32267
32351
|
"amazonbot",
|
|
32268
32352
|
"amazonproductbot",
|
|
@@ -32351,7 +32435,7 @@ var isBlockedUA = function(ua, customBlockedUserAgents = []) {
|
|
|
32351
32435
|
return uaLower.indexOf(blockedUaLower) !== -1;
|
|
32352
32436
|
});
|
|
32353
32437
|
};
|
|
32354
|
-
//
|
|
32438
|
+
// ../../switchroom/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/utils/type-utils.mjs
|
|
32355
32439
|
var nativeIsArray = Array.isArray;
|
|
32356
32440
|
var ObjProto = Object.prototype;
|
|
32357
32441
|
var type_utils_hasOwnProperty = ObjProto.hasOwnProperty;
|
|
@@ -32388,7 +32472,7 @@ function isInstanceOf(candidate, base) {
|
|
|
32388
32472
|
}
|
|
32389
32473
|
}
|
|
32390
32474
|
|
|
32391
|
-
//
|
|
32475
|
+
// ../../switchroom/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/utils/number-utils.mjs
|
|
32392
32476
|
function clampToRange(value, min, max, logger, fallbackValue) {
|
|
32393
32477
|
if (min > max) {
|
|
32394
32478
|
logger.warn("min cannot be greater than max.");
|
|
@@ -32408,7 +32492,7 @@ function clampToRange(value, min, max, logger, fallbackValue) {
|
|
|
32408
32492
|
return clampToRange(fallbackValue || max, min, max, logger);
|
|
32409
32493
|
}
|
|
32410
32494
|
|
|
32411
|
-
//
|
|
32495
|
+
// ../../switchroom/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/utils/bucketed-rate-limiter.mjs
|
|
32412
32496
|
var ONE_DAY_IN_MS = 86400000;
|
|
32413
32497
|
|
|
32414
32498
|
class BucketedRateLimiter {
|
|
@@ -32452,7 +32536,7 @@ class BucketedRateLimiter {
|
|
|
32452
32536
|
this._buckets = {};
|
|
32453
32537
|
}
|
|
32454
32538
|
}
|
|
32455
|
-
//
|
|
32539
|
+
// ../../switchroom/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/utils/promise-queue.mjs
|
|
32456
32540
|
class PromiseQueue {
|
|
32457
32541
|
add(promise) {
|
|
32458
32542
|
const promiseUUID = uuidv7();
|
|
@@ -32478,7 +32562,7 @@ class PromiseQueue {
|
|
|
32478
32562
|
this.promiseByIds = {};
|
|
32479
32563
|
}
|
|
32480
32564
|
}
|
|
32481
|
-
//
|
|
32565
|
+
// ../../switchroom/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/utils/logger.mjs
|
|
32482
32566
|
function createConsole(consoleLike = console) {
|
|
32483
32567
|
const lockedMethods = {
|
|
32484
32568
|
log: consoleLike.log.bind(consoleLike),
|
|
@@ -32516,7 +32600,7 @@ var passThrough = (fn) => fn();
|
|
|
32516
32600
|
function createLogger(prefix, maybeCall = passThrough) {
|
|
32517
32601
|
return _createLogger(prefix, maybeCall, createConsole());
|
|
32518
32602
|
}
|
|
32519
|
-
//
|
|
32603
|
+
// ../../switchroom/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/utils/user-agent-utils.mjs
|
|
32520
32604
|
var MOBILE = "Mobile";
|
|
32521
32605
|
var IOS = "iOS";
|
|
32522
32606
|
var ANDROID = "Android";
|
|
@@ -32773,7 +32857,7 @@ var osMatchers = [
|
|
|
32773
32857
|
]
|
|
32774
32858
|
];
|
|
32775
32859
|
|
|
32776
|
-
//
|
|
32860
|
+
// ../../switchroom/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/utils/index.mjs
|
|
32777
32861
|
var STRING_FORMAT = "utf8";
|
|
32778
32862
|
function assert(truthyValue, message) {
|
|
32779
32863
|
if (!truthyValue || typeof truthyValue != "string" || isEmpty(truthyValue))
|
|
@@ -32821,7 +32905,7 @@ function allSettled(promises) {
|
|
|
32821
32905
|
reason
|
|
32822
32906
|
}))));
|
|
32823
32907
|
}
|
|
32824
|
-
//
|
|
32908
|
+
// ../../switchroom/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/eventemitter.mjs
|
|
32825
32909
|
class SimpleEventEmitter {
|
|
32826
32910
|
constructor() {
|
|
32827
32911
|
this.events = {};
|
|
@@ -32843,7 +32927,7 @@ class SimpleEventEmitter {
|
|
|
32843
32927
|
}
|
|
32844
32928
|
}
|
|
32845
32929
|
|
|
32846
|
-
//
|
|
32930
|
+
// ../../switchroom/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/posthog-core-stateless.mjs
|
|
32847
32931
|
class PostHogFetchHttpError extends Error {
|
|
32848
32932
|
constructor(response, reqByteLength) {
|
|
32849
32933
|
super("HTTP error while fetching PostHog: status=" + response.status + ", reqByteLength=" + reqByteLength), this.response = response, this.reqByteLength = reqByteLength, this.name = "PostHogFetchHttpError";
|
|
@@ -33558,7 +33642,7 @@ class PostHogCoreStateless {
|
|
|
33558
33642
|
return this.shutdownPromise;
|
|
33559
33643
|
}
|
|
33560
33644
|
}
|
|
33561
|
-
//
|
|
33645
|
+
// ../../switchroom/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/index.mjs
|
|
33562
33646
|
var exports_error_tracking = {};
|
|
33563
33647
|
__export(exports_error_tracking, {
|
|
33564
33648
|
winjsStackLineParser: () => winjsStackLineParser,
|
|
@@ -33582,7 +33666,7 @@ __export(exports_error_tracking, {
|
|
|
33582
33666
|
DOMExceptionCoercer: () => DOMExceptionCoercer
|
|
33583
33667
|
});
|
|
33584
33668
|
|
|
33585
|
-
//
|
|
33669
|
+
// ../../switchroom/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/chunk-ids.mjs
|
|
33586
33670
|
var parsedStackResults;
|
|
33587
33671
|
var lastKeysCount;
|
|
33588
33672
|
var cachedFilenameChunkIds;
|
|
@@ -33621,7 +33705,7 @@ function getFilenameToChunkIdMap(stackParser) {
|
|
|
33621
33705
|
return cachedFilenameChunkIds;
|
|
33622
33706
|
}
|
|
33623
33707
|
|
|
33624
|
-
//
|
|
33708
|
+
// ../../switchroom/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/error-properties-builder.mjs
|
|
33625
33709
|
var MAX_CAUSE_RECURSION = 4;
|
|
33626
33710
|
|
|
33627
33711
|
class ErrorPropertiesBuilder {
|
|
@@ -33743,7 +33827,7 @@ class ErrorPropertiesBuilder {
|
|
|
33743
33827
|
return context;
|
|
33744
33828
|
}
|
|
33745
33829
|
}
|
|
33746
|
-
//
|
|
33830
|
+
// ../../switchroom/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/parsers/base.mjs
|
|
33747
33831
|
var UNKNOWN_FUNCTION = "?";
|
|
33748
33832
|
function createFrame(platform, filename, func, lineno, colno) {
|
|
33749
33833
|
const frame = {
|
|
@@ -33759,7 +33843,7 @@ function createFrame(platform, filename, func, lineno, colno) {
|
|
|
33759
33843
|
return frame;
|
|
33760
33844
|
}
|
|
33761
33845
|
|
|
33762
|
-
//
|
|
33846
|
+
// ../../switchroom/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/parsers/safari.mjs
|
|
33763
33847
|
var extractSafariExtensionDetails = (func, filename) => {
|
|
33764
33848
|
const isSafariExtension = func.indexOf("safari-extension") !== -1;
|
|
33765
33849
|
const isSafariWebExtension = func.indexOf("safari-web-extension") !== -1;
|
|
@@ -33772,7 +33856,7 @@ var extractSafariExtensionDetails = (func, filename) => {
|
|
|
33772
33856
|
];
|
|
33773
33857
|
};
|
|
33774
33858
|
|
|
33775
|
-
//
|
|
33859
|
+
// ../../switchroom/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/parsers/chrome.mjs
|
|
33776
33860
|
var chromeRegexNoFnName = /^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i;
|
|
33777
33861
|
var chromeRegex = /^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i;
|
|
33778
33862
|
var chromeEvalRegex = /\((\S*)(?::(\d+))(?::(\d+))\)/;
|
|
@@ -33798,7 +33882,7 @@ var chromeStackLineParser = (line, platform) => {
|
|
|
33798
33882
|
}
|
|
33799
33883
|
};
|
|
33800
33884
|
|
|
33801
|
-
//
|
|
33885
|
+
// ../../switchroom/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/parsers/gecko.mjs
|
|
33802
33886
|
var geckoREgex = /^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i;
|
|
33803
33887
|
var geckoEvalRegex = /(\S+) line (\d+)(?: > eval line \d+)* > eval/i;
|
|
33804
33888
|
var geckoStackLineParser = (line, platform) => {
|
|
@@ -33821,14 +33905,14 @@ var geckoStackLineParser = (line, platform) => {
|
|
|
33821
33905
|
}
|
|
33822
33906
|
};
|
|
33823
33907
|
|
|
33824
|
-
//
|
|
33908
|
+
// ../../switchroom/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/parsers/winjs.mjs
|
|
33825
33909
|
var winjsRegex = /^\s*at (?:((?:\[object object\])?.+) )?\(?((?:[-a-z]+):.*?):(\d+)(?::(\d+))?\)?\s*$/i;
|
|
33826
33910
|
var winjsStackLineParser = (line, platform) => {
|
|
33827
33911
|
const parts = winjsRegex.exec(line);
|
|
33828
33912
|
return parts ? createFrame(platform, parts[2], parts[1] || UNKNOWN_FUNCTION, +parts[3], parts[4] ? +parts[4] : undefined) : undefined;
|
|
33829
33913
|
};
|
|
33830
33914
|
|
|
33831
|
-
//
|
|
33915
|
+
// ../../switchroom/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/parsers/opera.mjs
|
|
33832
33916
|
var opera10Regex = / line (\d+).*script (?:in )?(\S+)(?:: in function (\S+))?$/i;
|
|
33833
33917
|
var opera10StackLineParser = (line, platform) => {
|
|
33834
33918
|
const parts = opera10Regex.exec(line);
|
|
@@ -33840,7 +33924,7 @@ var opera11StackLineParser = (line, platform) => {
|
|
|
33840
33924
|
return parts ? createFrame(platform, parts[5], parts[3] || parts[4] || UNKNOWN_FUNCTION, +parts[1], +parts[2]) : undefined;
|
|
33841
33925
|
};
|
|
33842
33926
|
|
|
33843
|
-
//
|
|
33927
|
+
// ../../switchroom/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/parsers/node.mjs
|
|
33844
33928
|
var FILENAME_MATCH = /^\s*[-]{4,}$/;
|
|
33845
33929
|
var FULL_MATCH = /at (?:async )?(?:(.+?)\s+\()?(?:(.+):(\d+):(\d+)?|([^)]+))\)?/;
|
|
33846
33930
|
var nodeStackLineParser = (line, platform) => {
|
|
@@ -33909,7 +33993,7 @@ function _parseIntOrUndefined(input) {
|
|
|
33909
33993
|
return parseInt(input || "", 10) || undefined;
|
|
33910
33994
|
}
|
|
33911
33995
|
|
|
33912
|
-
//
|
|
33996
|
+
// ../../switchroom/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/parsers/index.mjs
|
|
33913
33997
|
var WEBPACK_ERROR_REGEXP = /\(error: (.*)\)/;
|
|
33914
33998
|
var STACKTRACE_FRAME_LIMIT = 50;
|
|
33915
33999
|
function reverseAndStripFrames(stack) {
|
|
@@ -33954,7 +34038,7 @@ function createStackParser(platform, ...parsers) {
|
|
|
33954
34038
|
return reverseAndStripFrames(frames);
|
|
33955
34039
|
};
|
|
33956
34040
|
}
|
|
33957
|
-
//
|
|
34041
|
+
// ../../switchroom/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/coercers/dom-exception-coercer.mjs
|
|
33958
34042
|
class DOMExceptionCoercer {
|
|
33959
34043
|
match(err) {
|
|
33960
34044
|
return this.isDOMException(err) || this.isDOMError(err);
|
|
@@ -33984,7 +34068,7 @@ class DOMExceptionCoercer {
|
|
|
33984
34068
|
return isBuiltin(err, "DOMError");
|
|
33985
34069
|
}
|
|
33986
34070
|
}
|
|
33987
|
-
//
|
|
34071
|
+
// ../../switchroom/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/coercers/error-coercer.mjs
|
|
33988
34072
|
class ErrorCoercer {
|
|
33989
34073
|
match(err) {
|
|
33990
34074
|
return isPlainError(err);
|
|
@@ -34011,7 +34095,7 @@ class ErrorCoercer {
|
|
|
34011
34095
|
return err.stacktrace || err.stack || undefined;
|
|
34012
34096
|
}
|
|
34013
34097
|
}
|
|
34014
|
-
//
|
|
34098
|
+
// ../../switchroom/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/coercers/error-event-coercer.mjs
|
|
34015
34099
|
class ErrorEventCoercer {
|
|
34016
34100
|
constructor() {}
|
|
34017
34101
|
match(err) {
|
|
@@ -34029,7 +34113,7 @@ class ErrorEventCoercer {
|
|
|
34029
34113
|
return exceptionLike;
|
|
34030
34114
|
}
|
|
34031
34115
|
}
|
|
34032
|
-
//
|
|
34116
|
+
// ../../switchroom/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/coercers/string-coercer.mjs
|
|
34033
34117
|
var ERROR_TYPES_PATTERN = /^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;
|
|
34034
34118
|
|
|
34035
34119
|
class StringCoercer {
|
|
@@ -34059,7 +34143,7 @@ class StringCoercer {
|
|
|
34059
34143
|
];
|
|
34060
34144
|
}
|
|
34061
34145
|
}
|
|
34062
|
-
//
|
|
34146
|
+
// ../../switchroom/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/types.mjs
|
|
34063
34147
|
var severityLevels = [
|
|
34064
34148
|
"fatal",
|
|
34065
34149
|
"error",
|
|
@@ -34069,7 +34153,7 @@ var severityLevels = [
|
|
|
34069
34153
|
"debug"
|
|
34070
34154
|
];
|
|
34071
34155
|
|
|
34072
|
-
//
|
|
34156
|
+
// ../../switchroom/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/coercers/utils.mjs
|
|
34073
34157
|
function extractExceptionKeysForMessage(err, maxLength = 40) {
|
|
34074
34158
|
const keys = Object.keys(err);
|
|
34075
34159
|
keys.sort();
|
|
@@ -34086,7 +34170,7 @@ function extractExceptionKeysForMessage(err, maxLength = 40) {
|
|
|
34086
34170
|
return "";
|
|
34087
34171
|
}
|
|
34088
34172
|
|
|
34089
|
-
//
|
|
34173
|
+
// ../../switchroom/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/coercers/object-coercer.mjs
|
|
34090
34174
|
class ObjectCoercer {
|
|
34091
34175
|
match(candidate) {
|
|
34092
34176
|
return typeof candidate == "object" && candidate !== null;
|
|
@@ -34139,7 +34223,7 @@ class ObjectCoercer {
|
|
|
34139
34223
|
}
|
|
34140
34224
|
}
|
|
34141
34225
|
}
|
|
34142
|
-
//
|
|
34226
|
+
// ../../switchroom/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/coercers/event-coercer.mjs
|
|
34143
34227
|
class EventCoercer {
|
|
34144
34228
|
match(err) {
|
|
34145
34229
|
return isEvent(err);
|
|
@@ -34154,7 +34238,7 @@ class EventCoercer {
|
|
|
34154
34238
|
};
|
|
34155
34239
|
}
|
|
34156
34240
|
}
|
|
34157
|
-
//
|
|
34241
|
+
// ../../switchroom/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/coercers/primitive-coercer.mjs
|
|
34158
34242
|
class PrimitiveCoercer {
|
|
34159
34243
|
match(candidate) {
|
|
34160
34244
|
return isPrimitive(candidate);
|
|
@@ -34168,7 +34252,7 @@ class PrimitiveCoercer {
|
|
|
34168
34252
|
};
|
|
34169
34253
|
}
|
|
34170
34254
|
}
|
|
34171
|
-
//
|
|
34255
|
+
// ../../switchroom/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/coercers/promise-rejection-event.mjs
|
|
34172
34256
|
class PromiseRejectionEventCoercer {
|
|
34173
34257
|
match(err) {
|
|
34174
34258
|
return isBuiltin(err, "PromiseRejectionEvent") || this.isCustomEventWrappingRejection(err);
|
|
@@ -34204,7 +34288,7 @@ class PromiseRejectionEventCoercer {
|
|
|
34204
34288
|
return error;
|
|
34205
34289
|
}
|
|
34206
34290
|
}
|
|
34207
|
-
//
|
|
34291
|
+
// ../../switchroom/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/utils.mjs
|
|
34208
34292
|
class ReduceableCache {
|
|
34209
34293
|
constructor(_maxSize) {
|
|
34210
34294
|
this._maxSize = _maxSize;
|
|
@@ -34229,7 +34313,7 @@ class ReduceableCache {
|
|
|
34229
34313
|
}
|
|
34230
34314
|
}
|
|
34231
34315
|
}
|
|
34232
|
-
//
|
|
34316
|
+
// ../../switchroom/node_modules/.bun/posthog-node@5.29.2/node_modules/posthog-node/dist/extensions/error-tracking/modifiers/context-lines.node.mjs
|
|
34233
34317
|
import { createReadStream } from "node:fs";
|
|
34234
34318
|
import { createInterface } from "node:readline";
|
|
34235
34319
|
var LRU_FILE_CONTENTS_CACHE = new exports_error_tracking.ReduceableCache(25);
|
|
@@ -34447,7 +34531,7 @@ function snipLine(line, colno) {
|
|
|
34447
34531
|
return newLine;
|
|
34448
34532
|
}
|
|
34449
34533
|
|
|
34450
|
-
//
|
|
34534
|
+
// ../../switchroom/node_modules/.bun/posthog-node@5.29.2/node_modules/posthog-node/dist/extensions/error-tracking/autocapture.mjs
|
|
34451
34535
|
function makeUncaughtExceptionHandler(captureFn, onFatalFn) {
|
|
34452
34536
|
let calledFatalError = false;
|
|
34453
34537
|
return Object.assign((error) => {
|
|
@@ -34479,7 +34563,7 @@ function addUnhandledRejectionListener(captureFn) {
|
|
|
34479
34563
|
}));
|
|
34480
34564
|
}
|
|
34481
34565
|
|
|
34482
|
-
//
|
|
34566
|
+
// ../../switchroom/node_modules/.bun/posthog-node@5.29.2/node_modules/posthog-node/dist/extensions/error-tracking/index.mjs
|
|
34483
34567
|
var SHUTDOWN_TIMEOUT = 2000;
|
|
34484
34568
|
|
|
34485
34569
|
class ErrorTracking {
|
|
@@ -34548,10 +34632,10 @@ class ErrorTracking {
|
|
|
34548
34632
|
}
|
|
34549
34633
|
}
|
|
34550
34634
|
|
|
34551
|
-
//
|
|
34635
|
+
// ../../switchroom/node_modules/.bun/posthog-node@5.29.2/node_modules/posthog-node/dist/version.mjs
|
|
34552
34636
|
var version = "5.29.2";
|
|
34553
34637
|
|
|
34554
|
-
//
|
|
34638
|
+
// ../../switchroom/node_modules/.bun/posthog-node@5.29.2/node_modules/posthog-node/dist/types.mjs
|
|
34555
34639
|
var FeatureFlagError2 = {
|
|
34556
34640
|
ERRORS_WHILE_COMPUTING: "errors_while_computing_flags",
|
|
34557
34641
|
FLAG_MISSING: "flag_missing",
|
|
@@ -34559,7 +34643,7 @@ var FeatureFlagError2 = {
|
|
|
34559
34643
|
UNKNOWN_ERROR: "unknown_error"
|
|
34560
34644
|
};
|
|
34561
34645
|
|
|
34562
|
-
//
|
|
34646
|
+
// ../../switchroom/node_modules/.bun/posthog-node@5.29.2/node_modules/posthog-node/dist/extensions/feature-flags/crypto.mjs
|
|
34563
34647
|
async function hashSHA1(text) {
|
|
34564
34648
|
const subtle = globalThis.crypto?.subtle;
|
|
34565
34649
|
if (!subtle)
|
|
@@ -34569,7 +34653,7 @@ async function hashSHA1(text) {
|
|
|
34569
34653
|
return hashArray.map((byte) => byte.toString(16).padStart(2, "0")).join("");
|
|
34570
34654
|
}
|
|
34571
34655
|
|
|
34572
|
-
//
|
|
34656
|
+
// ../../switchroom/node_modules/.bun/posthog-node@5.29.2/node_modules/posthog-node/dist/extensions/feature-flags/feature-flags.mjs
|
|
34573
34657
|
var SIXTY_SECONDS = 60000;
|
|
34574
34658
|
var LONG_SCALE = 1152921504606847000;
|
|
34575
34659
|
var NULL_VALUES_ALLOWED_OPERATORS = [
|
|
@@ -35443,7 +35527,7 @@ function relativeDateParseForFeatureFlagMatching(value) {
|
|
|
35443
35527
|
}
|
|
35444
35528
|
}
|
|
35445
35529
|
|
|
35446
|
-
//
|
|
35530
|
+
// ../../switchroom/node_modules/.bun/posthog-node@5.29.2/node_modules/posthog-node/dist/storage-memory.mjs
|
|
35447
35531
|
class PostHogMemoryStorage {
|
|
35448
35532
|
getProperty(key) {
|
|
35449
35533
|
return this._memoryStorage[key];
|
|
@@ -35456,7 +35540,7 @@ class PostHogMemoryStorage {
|
|
|
35456
35540
|
}
|
|
35457
35541
|
}
|
|
35458
35542
|
|
|
35459
|
-
//
|
|
35543
|
+
// ../../switchroom/node_modules/.bun/posthog-node@5.29.2/node_modules/posthog-node/dist/client.mjs
|
|
35460
35544
|
var MINIMUM_POLLING_INTERVAL = 100;
|
|
35461
35545
|
var THIRTY_SECONDS = 30000;
|
|
35462
35546
|
var MAX_CACHE_SIZE = 50000;
|
|
@@ -36244,7 +36328,7 @@ class PostHogBackendClient extends PostHogCoreStateless {
|
|
|
36244
36328
|
}
|
|
36245
36329
|
}
|
|
36246
36330
|
|
|
36247
|
-
//
|
|
36331
|
+
// ../../switchroom/node_modules/.bun/posthog-node@5.29.2/node_modules/posthog-node/dist/extensions/context/context.mjs
|
|
36248
36332
|
import { AsyncLocalStorage as AsyncLocalStorage2 } from "node:async_hooks";
|
|
36249
36333
|
|
|
36250
36334
|
class PostHogContext {
|
|
@@ -36275,7 +36359,7 @@ class PostHogContext {
|
|
|
36275
36359
|
}
|
|
36276
36360
|
}
|
|
36277
36361
|
|
|
36278
|
-
//
|
|
36362
|
+
// ../../switchroom/node_modules/.bun/posthog-node@5.29.2/node_modules/posthog-node/dist/extensions/sentry-integration.mjs
|
|
36279
36363
|
var NAME = "posthog-node";
|
|
36280
36364
|
function createEventProcessor(_posthog, { organization, projectId, prefix, severityAllowList = [
|
|
36281
36365
|
"error"
|
|
@@ -36343,7 +36427,7 @@ class PostHogSentryIntegration {
|
|
|
36343
36427
|
};
|
|
36344
36428
|
}
|
|
36345
36429
|
}
|
|
36346
|
-
//
|
|
36430
|
+
// ../../switchroom/node_modules/.bun/posthog-node@5.29.2/node_modules/posthog-node/dist/entrypoints/index.node.mjs
|
|
36347
36431
|
ErrorTracking.errorPropertiesBuilder = new exports_error_tracking.ErrorPropertiesBuilder([
|
|
36348
36432
|
new exports_error_tracking.EventCoercer,
|
|
36349
36433
|
new exports_error_tracking.ErrorCoercer,
|
|
@@ -38204,6 +38288,14 @@ import { homedir as homedir4 } from "node:os";
|
|
|
38204
38288
|
import { randomUUID as randomUUID4 } from "node:crypto";
|
|
38205
38289
|
import { join as join9 } from "node:path";
|
|
38206
38290
|
var DEFAULT_TIMEOUT_MS2 = 5000;
|
|
38291
|
+
function reviveDate2(v) {
|
|
38292
|
+
if (v == null)
|
|
38293
|
+
return null;
|
|
38294
|
+
if (v instanceof Date)
|
|
38295
|
+
return Number.isNaN(v.getTime()) ? null : v;
|
|
38296
|
+
const d = new Date(v);
|
|
38297
|
+
return Number.isNaN(d.getTime()) ? null : d;
|
|
38298
|
+
}
|
|
38207
38299
|
function operatorSocketPath2(home = homedir4()) {
|
|
38208
38300
|
return join9(home, ".switchroom", "state", "auth-broker-operator", "sock");
|
|
38209
38301
|
}
|
|
@@ -38299,7 +38391,14 @@ class AuthBrokerClient2 {
|
|
|
38299
38391
|
accounts: [...accounts],
|
|
38300
38392
|
...timeoutMs !== undefined ? { timeoutMs } : {}
|
|
38301
38393
|
});
|
|
38302
|
-
|
|
38394
|
+
const parsed = data;
|
|
38395
|
+
for (const entry of parsed.results) {
|
|
38396
|
+
if (entry.result.ok) {
|
|
38397
|
+
entry.result.data.fiveHourResetAt = reviveDate2(entry.result.data.fiveHourResetAt);
|
|
38398
|
+
entry.result.data.sevenDayResetAt = reviveDate2(entry.result.data.sevenDayResetAt);
|
|
38399
|
+
}
|
|
38400
|
+
}
|
|
38401
|
+
return parsed;
|
|
38303
38402
|
}
|
|
38304
38403
|
async setActive(account) {
|
|
38305
38404
|
const data = await this.send({
|
|
@@ -39522,6 +39621,28 @@ function markdownToHtml(text) {
|
|
|
39522
39621
|
function escapeHtml4(text) {
|
|
39523
39622
|
return text.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
39524
39623
|
}
|
|
39624
|
+
function telegramHtmlToPlainText(html) {
|
|
39625
|
+
const decodeEntities = (s) => s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, '"').replace(/�*39;|�*27;|'/gi, "'").replace(/ /g, " ").replace(/&#(\d+);/g, (_m, d) => {
|
|
39626
|
+
const cp = Number(d);
|
|
39627
|
+
return Number.isFinite(cp) && cp > 0 && cp <= 1114111 ? String.fromCodePoint(cp) : _m;
|
|
39628
|
+
}).replace(/&#x([0-9a-fA-F]+);/g, (_m, h) => {
|
|
39629
|
+
const cp = parseInt(h, 16);
|
|
39630
|
+
return Number.isFinite(cp) && cp > 0 && cp <= 1114111 ? String.fromCodePoint(cp) : _m;
|
|
39631
|
+
});
|
|
39632
|
+
const stripTags = (s) => decodeEntities(s.replace(/<\s*br\s*\/?\s*>/gi, `
|
|
39633
|
+
`).replace(/<\/\s*(?:p|div|li|blockquote|pre|h[1-6])\s*>/gi, `
|
|
39634
|
+
`).replace(/<[^>]*>/g, ""));
|
|
39635
|
+
const withPlainLinks = html.replace(/<a\b[^>]*\bhref\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+))[^>]*>([\s\S]*?)<\/a>/gi, (_m, dq, sq, uq, label) => {
|
|
39636
|
+
const href = decodeEntities((dq ?? sq ?? uq ?? "").trim());
|
|
39637
|
+
const text = stripTags(label).trim();
|
|
39638
|
+
if (!href)
|
|
39639
|
+
return text;
|
|
39640
|
+
return !text || text === href ? href : `${text} (${href})`;
|
|
39641
|
+
});
|
|
39642
|
+
return stripTags(withPlainLinks).replace(/[ \t]+$/gm, "").replace(/\n{3,}/g, `
|
|
39643
|
+
|
|
39644
|
+
`).trim();
|
|
39645
|
+
}
|
|
39525
39646
|
function repairEscapedWhitespace(text) {
|
|
39526
39647
|
if (text.includes(`
|
|
39527
39648
|
`) || text.includes("\r"))
|
|
@@ -41309,8 +41430,6 @@ function formatQuotaBlock(q, now = new Date) {
|
|
|
41309
41430
|
return lines.join(`
|
|
41310
41431
|
`);
|
|
41311
41432
|
}
|
|
41312
|
-
var ACCOUNT_QUOTA_CACHE_TTL_MS2 = 5 * 60000;
|
|
41313
|
-
var accountQuotaCache2 = new Map;
|
|
41314
41433
|
|
|
41315
41434
|
// auto-fallback.ts
|
|
41316
41435
|
var DEFAULT_FALLBACK_COOLDOWN_MS = 2 * 60000;
|
|
@@ -41995,8 +42114,8 @@ function mergeAgentConfig(defaultsIn, agentIn) {
|
|
|
41995
42114
|
if (defaults.dangerous_mode !== undefined && merged.dangerous_mode === undefined) {
|
|
41996
42115
|
merged.dangerous_mode = defaults.dangerous_mode;
|
|
41997
42116
|
}
|
|
41998
|
-
if (defaults.
|
|
41999
|
-
merged.
|
|
42117
|
+
if (defaults.network_isolation !== undefined && merged.network_isolation === undefined) {
|
|
42118
|
+
merged.network_isolation = defaults.network_isolation;
|
|
42000
42119
|
}
|
|
42001
42120
|
if (defaults.thinking_effort !== undefined && merged.thinking_effort === undefined) {
|
|
42002
42121
|
merged.thinking_effort = defaults.thinking_effort;
|
|
@@ -42116,6 +42235,9 @@ function mergeAgentConfig(defaultsIn, agentIn) {
|
|
|
42116
42235
|
}
|
|
42117
42236
|
merged.session_continuity = combined;
|
|
42118
42237
|
}
|
|
42238
|
+
if (merged.release === undefined && defaults.release !== undefined) {
|
|
42239
|
+
merged.release = defaults.release;
|
|
42240
|
+
}
|
|
42119
42241
|
if (defaults.channels || merged.channels) {
|
|
42120
42242
|
const dChan = defaults.channels ?? {};
|
|
42121
42243
|
const aChan = merged.channels ?? {};
|
|
@@ -42247,7 +42369,9 @@ var UpdateApplyRequestSchema = exports_external.object({
|
|
|
42247
42369
|
op: exports_external.literal("update_apply"),
|
|
42248
42370
|
args: exports_external.object({
|
|
42249
42371
|
skip_images: exports_external.boolean().optional(),
|
|
42250
|
-
rebuild: exports_external.boolean().optional()
|
|
42372
|
+
rebuild: exports_external.boolean().optional(),
|
|
42373
|
+
channel: exports_external.enum(["dev", "rc", "latest"]).nullable().optional(),
|
|
42374
|
+
pin: exports_external.string().regex(/^(sha-[0-9a-f]{7,40}|v\d+\.\d+\.\d+)$/).nullable().optional()
|
|
42251
42375
|
}).optional()
|
|
42252
42376
|
});
|
|
42253
42377
|
var ApplyRequestSchema = exports_external.object({
|
|
@@ -43064,7 +43188,7 @@ function clampTtl(requested, fallback, min, max) {
|
|
|
43064
43188
|
|
|
43065
43189
|
// gateway/diff-preview-card.ts
|
|
43066
43190
|
var import_grammy5 = __toESM(require_mod2(), 1);
|
|
43067
|
-
var REQUEST_ID_RE = /^[0-9a-f]{
|
|
43191
|
+
var REQUEST_ID_RE = /^[0-9a-f]{32}$/;
|
|
43068
43192
|
var PENDING_FILE_ID_SENTINEL = "pending-create";
|
|
43069
43193
|
function buildDiffPreviewCard(input) {
|
|
43070
43194
|
if (!REQUEST_ID_RE.test(input.suggestRequestId)) {
|
|
@@ -45393,8 +45517,211 @@ function determineRestartReason(opts) {
|
|
|
45393
45517
|
// gateway/gateway.ts
|
|
45394
45518
|
init_boot_card();
|
|
45395
45519
|
|
|
45520
|
+
// gateway/update-announce.ts
|
|
45521
|
+
import { existsSync as existsSync25, mkdirSync as mkdirSync13, openSync as openSync3, closeSync as closeSync3, readFileSync as readFileSync24 } from "node:fs";
|
|
45522
|
+
import { join as join24 } from "node:path";
|
|
45523
|
+
import { homedir as homedir10 } from "node:os";
|
|
45524
|
+
|
|
45525
|
+
// ../src/host-control/audit-reader.ts
|
|
45526
|
+
import { homedir as homedir9 } from "node:os";
|
|
45527
|
+
import { join as join23 } from "node:path";
|
|
45528
|
+
function defaultAuditLogPath(home2 = homedir9()) {
|
|
45529
|
+
return join23(home2, ".switchroom", "host-control-audit.log");
|
|
45530
|
+
}
|
|
45531
|
+
function parseAuditLine(line) {
|
|
45532
|
+
const trimmed = line.trim();
|
|
45533
|
+
if (trimmed.length === 0)
|
|
45534
|
+
return null;
|
|
45535
|
+
let obj;
|
|
45536
|
+
try {
|
|
45537
|
+
obj = JSON.parse(trimmed);
|
|
45538
|
+
} catch {
|
|
45539
|
+
return null;
|
|
45540
|
+
}
|
|
45541
|
+
if (typeof obj !== "object" || obj === null)
|
|
45542
|
+
return null;
|
|
45543
|
+
const o = obj;
|
|
45544
|
+
if (typeof o.ts !== "string" || typeof o.op !== "string")
|
|
45545
|
+
return null;
|
|
45546
|
+
if (typeof o.request_id !== "string" || typeof o.result !== "string")
|
|
45547
|
+
return null;
|
|
45548
|
+
if (typeof o.duration_ms !== "number")
|
|
45549
|
+
return null;
|
|
45550
|
+
const callerRaw = o.caller;
|
|
45551
|
+
let caller;
|
|
45552
|
+
if (callerRaw && callerRaw.kind === "agent" && typeof callerRaw.name === "string") {
|
|
45553
|
+
caller = { kind: "agent", name: callerRaw.name };
|
|
45554
|
+
} else if (callerRaw && callerRaw.kind === "operator") {
|
|
45555
|
+
caller = { kind: "operator" };
|
|
45556
|
+
} else {
|
|
45557
|
+
return null;
|
|
45558
|
+
}
|
|
45559
|
+
const exit_code = o.exit_code === null || typeof o.exit_code === "number" ? o.exit_code : null;
|
|
45560
|
+
const entry = {
|
|
45561
|
+
ts: o.ts,
|
|
45562
|
+
op: o.op,
|
|
45563
|
+
caller,
|
|
45564
|
+
request_id: o.request_id,
|
|
45565
|
+
result: o.result,
|
|
45566
|
+
exit_code,
|
|
45567
|
+
duration_ms: o.duration_ms
|
|
45568
|
+
};
|
|
45569
|
+
if (typeof o.error === "string")
|
|
45570
|
+
entry.error = o.error;
|
|
45571
|
+
if (typeof o.phase === "string")
|
|
45572
|
+
entry.phase = o.phase;
|
|
45573
|
+
if (typeof o.stdout_tail === "string")
|
|
45574
|
+
entry.stdout_tail = o.stdout_tail;
|
|
45575
|
+
if (typeof o.stderr_tail === "string")
|
|
45576
|
+
entry.stderr_tail = o.stderr_tail;
|
|
45577
|
+
if (typeof o.channel === "string")
|
|
45578
|
+
entry.channel = o.channel;
|
|
45579
|
+
if (typeof o.pin === "string")
|
|
45580
|
+
entry.pin = o.pin;
|
|
45581
|
+
if (o.resolved_sha && typeof o.resolved_sha === "object" && !Array.isArray(o.resolved_sha)) {
|
|
45582
|
+
const rs = {};
|
|
45583
|
+
for (const [k, v] of Object.entries(o.resolved_sha)) {
|
|
45584
|
+
if (typeof v === "string")
|
|
45585
|
+
rs[k] = v;
|
|
45586
|
+
}
|
|
45587
|
+
if (Object.keys(rs).length > 0)
|
|
45588
|
+
entry.resolved_sha = rs;
|
|
45589
|
+
}
|
|
45590
|
+
if (o.install_context && typeof o.install_context === "object" && !Array.isArray(o.install_context)) {
|
|
45591
|
+
const ic = o.install_context;
|
|
45592
|
+
if (typeof ic.install_type === "string" && typeof ic.detected_at === "string") {
|
|
45593
|
+
entry.install_context = {
|
|
45594
|
+
install_type: ic.install_type,
|
|
45595
|
+
detected_at: ic.detected_at
|
|
45596
|
+
};
|
|
45597
|
+
}
|
|
45598
|
+
}
|
|
45599
|
+
return entry;
|
|
45600
|
+
}
|
|
45601
|
+
function filterEntries(entries, filters) {
|
|
45602
|
+
return entries.filter((e) => {
|
|
45603
|
+
if (filters.agent != null) {
|
|
45604
|
+
if (e.caller.kind !== "agent")
|
|
45605
|
+
return false;
|
|
45606
|
+
if (e.caller.name !== filters.agent)
|
|
45607
|
+
return false;
|
|
45608
|
+
}
|
|
45609
|
+
if (filters.op != null && e.op !== filters.op)
|
|
45610
|
+
return false;
|
|
45611
|
+
if (filters.errorOnly) {
|
|
45612
|
+
if (e.result !== "error" && e.result !== "denied")
|
|
45613
|
+
return false;
|
|
45614
|
+
}
|
|
45615
|
+
return true;
|
|
45616
|
+
});
|
|
45617
|
+
}
|
|
45618
|
+
function readAndFilter(raw, filters, limit) {
|
|
45619
|
+
const lines = raw.split(`
|
|
45620
|
+
`);
|
|
45621
|
+
const parsed = [];
|
|
45622
|
+
for (const line of lines) {
|
|
45623
|
+
const e = parseAuditLine(line);
|
|
45624
|
+
if (e != null)
|
|
45625
|
+
parsed.push(e);
|
|
45626
|
+
}
|
|
45627
|
+
const filtered = filterEntries(parsed, filters);
|
|
45628
|
+
return filtered.slice(-Math.max(1, limit));
|
|
45629
|
+
}
|
|
45630
|
+
|
|
45631
|
+
// gateway/update-announce.ts
|
|
45632
|
+
var DEFAULT_LOOKBACK_MS = 10 * 60 * 1000;
|
|
45633
|
+
function readLastTerminalUpdateAudit(opts = {}) {
|
|
45634
|
+
const path = opts.auditLogPath ?? defaultAuditLogPath();
|
|
45635
|
+
const exists = opts.exists ?? existsSync25;
|
|
45636
|
+
const readFile = opts.readFile ?? ((p) => readFileSync24(p, "utf-8"));
|
|
45637
|
+
if (!exists(path))
|
|
45638
|
+
return null;
|
|
45639
|
+
let raw;
|
|
45640
|
+
try {
|
|
45641
|
+
raw = readFile(path);
|
|
45642
|
+
} catch {
|
|
45643
|
+
return null;
|
|
45644
|
+
}
|
|
45645
|
+
const recent = readAndFilter(raw, { op: "update_apply" }, 200);
|
|
45646
|
+
const now = opts.now ?? Date.now();
|
|
45647
|
+
const since = now - (opts.lookbackMs ?? DEFAULT_LOOKBACK_MS);
|
|
45648
|
+
let best = null;
|
|
45649
|
+
for (const e of recent) {
|
|
45650
|
+
if (e.phase !== "terminal")
|
|
45651
|
+
continue;
|
|
45652
|
+
const ts = Date.parse(e.ts);
|
|
45653
|
+
if (Number.isNaN(ts))
|
|
45654
|
+
continue;
|
|
45655
|
+
if (ts < since)
|
|
45656
|
+
continue;
|
|
45657
|
+
if (best == null || Date.parse(best.ts) < ts)
|
|
45658
|
+
best = e;
|
|
45659
|
+
}
|
|
45660
|
+
return best;
|
|
45661
|
+
}
|
|
45662
|
+
var RECOVERY_HINTS = {
|
|
45663
|
+
binary: "curl https://switchroom.ai/install.sh | sh && switchroom update",
|
|
45664
|
+
source: "cd ~/code/switchroom && git pull && bun install && bun run build && switchroom update",
|
|
45665
|
+
"source-unlinked": "cd ~/code/switchroom && bun link && switchroom update # ensures binary is in PATH first",
|
|
45666
|
+
docker: "docker compose -p switchroom pull && docker compose -p switchroom up -d",
|
|
45667
|
+
unknown: "Cannot auto-detect install type. Run `switchroom apply` to refresh ~/.switchroom/install-type.json, then retry."
|
|
45668
|
+
};
|
|
45669
|
+
function recoveryHint(installType) {
|
|
45670
|
+
if (!installType)
|
|
45671
|
+
return RECOVERY_HINTS.unknown;
|
|
45672
|
+
return RECOVERY_HINTS[installType] ?? RECOVERY_HINTS.unknown;
|
|
45673
|
+
}
|
|
45674
|
+
function shortSha(s) {
|
|
45675
|
+
return s.replace(/^sha256:/, "").slice(0, 12);
|
|
45676
|
+
}
|
|
45677
|
+
function renderUpdateOutcomeLine(entry) {
|
|
45678
|
+
const success = entry.exit_code === 0 && entry.result !== "error" && entry.result !== "denied";
|
|
45679
|
+
if (success) {
|
|
45680
|
+
const channel = entry.channel ? `channel:${entry.channel}` : entry.pin ? `pin:${entry.pin}` : "channel:?";
|
|
45681
|
+
let shaStr = "";
|
|
45682
|
+
if (entry.resolved_sha) {
|
|
45683
|
+
const firstSha = Object.values(entry.resolved_sha)[0];
|
|
45684
|
+
if (firstSha)
|
|
45685
|
+
shaStr = `, sha:${shortSha(firstSha)}`;
|
|
45686
|
+
}
|
|
45687
|
+
return `\u2705 update completed (${channel}${shaStr})`;
|
|
45688
|
+
}
|
|
45689
|
+
const stderrTail = (entry.stderr_tail ?? entry.error ?? "").slice(-400);
|
|
45690
|
+
const opStep = entry.op;
|
|
45691
|
+
const hint = recoveryHint(entry.install_context?.install_type);
|
|
45692
|
+
const lines = [`\u274c update failed at ${opStep}: ${stderrTail || "(no stderr captured)"}`, ` \u21b3 Recovery: ${hint}`];
|
|
45693
|
+
return lines.join(`
|
|
45694
|
+
`);
|
|
45695
|
+
}
|
|
45696
|
+
function claimUpdateAnnouncement(requestId, opts = {}) {
|
|
45697
|
+
const stateDir = opts.stateDir ?? process.env.TELEGRAM_STATE_DIR ?? join24(homedir10(), ".switchroom");
|
|
45698
|
+
const dir = join24(stateDir, "update-announced");
|
|
45699
|
+
try {
|
|
45700
|
+
mkdirSync13(dir, { recursive: true });
|
|
45701
|
+
} catch {
|
|
45702
|
+
return false;
|
|
45703
|
+
}
|
|
45704
|
+
const safeId = requestId.replace(/[^A-Za-z0-9_.-]/g, "_").slice(0, 200);
|
|
45705
|
+
const path = join24(dir, safeId);
|
|
45706
|
+
try {
|
|
45707
|
+
const fd = openSync3(path, "wx");
|
|
45708
|
+
closeSync3(fd);
|
|
45709
|
+
return true;
|
|
45710
|
+
} catch {
|
|
45711
|
+
return false;
|
|
45712
|
+
}
|
|
45713
|
+
}
|
|
45714
|
+
function maybeRenderUpdateAnnouncement(opts = {}) {
|
|
45715
|
+
const entry = readLastTerminalUpdateAudit(opts);
|
|
45716
|
+
if (!entry)
|
|
45717
|
+
return null;
|
|
45718
|
+
if (!claimUpdateAnnouncement(entry.request_id, opts))
|
|
45719
|
+
return null;
|
|
45720
|
+
return renderUpdateOutcomeLine(entry);
|
|
45721
|
+
}
|
|
45722
|
+
|
|
45396
45723
|
// issues-card.ts
|
|
45397
|
-
import { readFileSync as
|
|
45724
|
+
import { readFileSync as readFileSync25, writeFileSync as writeFileSync15 } from "node:fs";
|
|
45398
45725
|
var SEVERITY_EMOJI = {
|
|
45399
45726
|
info: "\u2139\ufe0f",
|
|
45400
45727
|
warn: "\u26a0\ufe0f",
|
|
@@ -45486,7 +45813,7 @@ function extractRetryAfterSecs(err) {
|
|
|
45486
45813
|
var COOLDOWN_JITTER_MS = 500;
|
|
45487
45814
|
function readPersistedMessageId(path, log) {
|
|
45488
45815
|
try {
|
|
45489
|
-
const raw =
|
|
45816
|
+
const raw = readFileSync25(path, "utf8");
|
|
45490
45817
|
const parsed = JSON.parse(raw);
|
|
45491
45818
|
const v = parsed.messageId;
|
|
45492
45819
|
if (typeof v === "number" && Number.isInteger(v) && v > 0)
|
|
@@ -45595,24 +45922,24 @@ function createIssuesCardHandle(opts) {
|
|
|
45595
45922
|
}
|
|
45596
45923
|
|
|
45597
45924
|
// issues-watcher.ts
|
|
45598
|
-
import { existsSync as
|
|
45599
|
-
import { join as
|
|
45925
|
+
import { existsSync as existsSync27, statSync as statSync8 } from "node:fs";
|
|
45926
|
+
import { join as join26 } from "node:path";
|
|
45600
45927
|
|
|
45601
45928
|
// ../src/issues/store.ts
|
|
45602
45929
|
import {
|
|
45603
|
-
closeSync as
|
|
45604
|
-
existsSync as
|
|
45605
|
-
mkdirSync as
|
|
45606
|
-
openSync as
|
|
45930
|
+
closeSync as closeSync4,
|
|
45931
|
+
existsSync as existsSync26,
|
|
45932
|
+
mkdirSync as mkdirSync14,
|
|
45933
|
+
openSync as openSync4,
|
|
45607
45934
|
readdirSync as readdirSync5,
|
|
45608
|
-
readFileSync as
|
|
45935
|
+
readFileSync as readFileSync26,
|
|
45609
45936
|
renameSync as renameSync10,
|
|
45610
45937
|
statSync as statSync7,
|
|
45611
45938
|
unlinkSync as unlinkSync10,
|
|
45612
45939
|
writeFileSync as writeFileSync16,
|
|
45613
45940
|
writeSync
|
|
45614
45941
|
} from "node:fs";
|
|
45615
|
-
import { join as
|
|
45942
|
+
import { join as join25 } from "node:path";
|
|
45616
45943
|
import { randomBytes as randomBytes4 } from "node:crypto";
|
|
45617
45944
|
import { execSync } from "node:child_process";
|
|
45618
45945
|
|
|
@@ -45628,12 +45955,12 @@ var SEVERITY_RANK2 = {
|
|
|
45628
45955
|
var ISSUES_FILE = "issues.jsonl";
|
|
45629
45956
|
var ISSUES_LOCK = "issues.lock";
|
|
45630
45957
|
function readAll(stateDir) {
|
|
45631
|
-
const path =
|
|
45632
|
-
if (!
|
|
45958
|
+
const path = join25(stateDir, ISSUES_FILE);
|
|
45959
|
+
if (!existsSync26(path))
|
|
45633
45960
|
return [];
|
|
45634
45961
|
let raw;
|
|
45635
45962
|
try {
|
|
45636
|
-
raw =
|
|
45963
|
+
raw = readFileSync26(path, "utf-8");
|
|
45637
45964
|
} catch {
|
|
45638
45965
|
return [];
|
|
45639
45966
|
}
|
|
@@ -45665,7 +45992,7 @@ function list(stateDir, opts = {}) {
|
|
|
45665
45992
|
});
|
|
45666
45993
|
}
|
|
45667
45994
|
function resolve6(stateDir, fingerprint, nowFn = Date.now) {
|
|
45668
|
-
if (!
|
|
45995
|
+
if (!existsSync26(join25(stateDir, ISSUES_FILE)))
|
|
45669
45996
|
return 0;
|
|
45670
45997
|
return withLock(stateDir, () => {
|
|
45671
45998
|
const all = readAll(stateDir);
|
|
@@ -45683,7 +46010,7 @@ function resolve6(stateDir, fingerprint, nowFn = Date.now) {
|
|
|
45683
46010
|
});
|
|
45684
46011
|
}
|
|
45685
46012
|
function writeAll(stateDir, events) {
|
|
45686
|
-
const path =
|
|
46013
|
+
const path = join25(stateDir, ISSUES_FILE);
|
|
45687
46014
|
sweepOrphanTmpFiles(stateDir);
|
|
45688
46015
|
const tmp = `${path}.tmp-${process.pid}-${randomBytes4(4).toString("hex")}`;
|
|
45689
46016
|
const body = events.length === 0 ? "" : events.map((e) => JSON.stringify(e)).join(`
|
|
@@ -45705,7 +46032,7 @@ function sweepOrphanTmpFiles(stateDir) {
|
|
|
45705
46032
|
for (const entry of entries) {
|
|
45706
46033
|
if (!entry.startsWith(TMP_PREFIX))
|
|
45707
46034
|
continue;
|
|
45708
|
-
const tmpPath2 =
|
|
46035
|
+
const tmpPath2 = join25(stateDir, entry);
|
|
45709
46036
|
try {
|
|
45710
46037
|
const stat = statSync7(tmpPath2);
|
|
45711
46038
|
if (stat.mtimeMs < cutoff) {
|
|
@@ -45717,12 +46044,12 @@ function sweepOrphanTmpFiles(stateDir) {
|
|
|
45717
46044
|
var LOCK_RETRY_MS = 25;
|
|
45718
46045
|
var LOCK_TIMEOUT_MS = 1e4;
|
|
45719
46046
|
function withLock(stateDir, fn) {
|
|
45720
|
-
const lockPath =
|
|
46047
|
+
const lockPath = join25(stateDir, ISSUES_LOCK);
|
|
45721
46048
|
const startedAt = Date.now();
|
|
45722
46049
|
let fd = null;
|
|
45723
46050
|
while (fd === null) {
|
|
45724
46051
|
try {
|
|
45725
|
-
fd =
|
|
46052
|
+
fd = openSync4(lockPath, "wx");
|
|
45726
46053
|
try {
|
|
45727
46054
|
writeSync(fd, String(process.pid));
|
|
45728
46055
|
} catch {}
|
|
@@ -45742,7 +46069,7 @@ function withLock(stateDir, fn) {
|
|
|
45742
46069
|
return fn();
|
|
45743
46070
|
} finally {
|
|
45744
46071
|
try {
|
|
45745
|
-
|
|
46072
|
+
closeSync4(fd);
|
|
45746
46073
|
} catch {}
|
|
45747
46074
|
try {
|
|
45748
46075
|
unlinkSync10(lockPath);
|
|
@@ -45752,7 +46079,7 @@ function withLock(stateDir, fn) {
|
|
|
45752
46079
|
function tryStealStaleLock(lockPath) {
|
|
45753
46080
|
let pidStr;
|
|
45754
46081
|
try {
|
|
45755
|
-
pidStr =
|
|
46082
|
+
pidStr = readFileSync26(lockPath, "utf-8").trim();
|
|
45756
46083
|
} catch {
|
|
45757
46084
|
return true;
|
|
45758
46085
|
}
|
|
@@ -45802,7 +46129,7 @@ function isIssueEvent(v) {
|
|
|
45802
46129
|
// issues-watcher.ts
|
|
45803
46130
|
var DEFAULT_POLL_INTERVAL_MS2 = 2000;
|
|
45804
46131
|
function startIssuesWatcher(opts) {
|
|
45805
|
-
const path =
|
|
46132
|
+
const path = join26(opts.stateDir, ISSUES_FILE);
|
|
45806
46133
|
const log = opts.log ?? (() => {});
|
|
45807
46134
|
const intervalMs = opts.pollIntervalMs ?? DEFAULT_POLL_INTERVAL_MS2;
|
|
45808
46135
|
const setIntervalFn = opts.setInterval ?? setInterval;
|
|
@@ -45850,7 +46177,7 @@ function startIssuesWatcher(opts) {
|
|
|
45850
46177
|
};
|
|
45851
46178
|
}
|
|
45852
46179
|
function defaultSignatureProvider(path) {
|
|
45853
|
-
if (!
|
|
46180
|
+
if (!existsSync27(path))
|
|
45854
46181
|
return null;
|
|
45855
46182
|
try {
|
|
45856
46183
|
const stat = statSync8(path);
|
|
@@ -46039,8 +46366,8 @@ function skillBasenameFromPath2(input) {
|
|
|
46039
46366
|
}
|
|
46040
46367
|
|
|
46041
46368
|
// credits-watch.ts
|
|
46042
|
-
import { readFileSync as
|
|
46043
|
-
import { join as
|
|
46369
|
+
import { readFileSync as readFileSync27, writeFileSync as writeFileSync17, existsSync as existsSync28, mkdirSync as mkdirSync15 } from "fs";
|
|
46370
|
+
import { join as join27 } from "path";
|
|
46044
46371
|
var STATE_FILE = "credits-watch.json";
|
|
46045
46372
|
var FATAL_REASONS = new Set([
|
|
46046
46373
|
"out_of_credits",
|
|
@@ -46052,12 +46379,12 @@ function emptyCreditState() {
|
|
|
46052
46379
|
return { lastNotifiedReason: null, lastNotifiedAt: 0 };
|
|
46053
46380
|
}
|
|
46054
46381
|
function readClaudeJsonOverage(claudeConfigDir) {
|
|
46055
|
-
const path =
|
|
46056
|
-
if (!
|
|
46382
|
+
const path = join27(claudeConfigDir, ".claude.json");
|
|
46383
|
+
if (!existsSync28(path))
|
|
46057
46384
|
return null;
|
|
46058
46385
|
let raw;
|
|
46059
46386
|
try {
|
|
46060
|
-
raw =
|
|
46387
|
+
raw = readFileSync27(path, "utf-8");
|
|
46061
46388
|
} catch {
|
|
46062
46389
|
return null;
|
|
46063
46390
|
}
|
|
@@ -46137,11 +46464,11 @@ function escapeHtml10(s) {
|
|
|
46137
46464
|
return s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
46138
46465
|
}
|
|
46139
46466
|
function loadCreditState(stateDir) {
|
|
46140
|
-
const path =
|
|
46141
|
-
if (!
|
|
46467
|
+
const path = join27(stateDir, STATE_FILE);
|
|
46468
|
+
if (!existsSync28(path))
|
|
46142
46469
|
return emptyCreditState();
|
|
46143
46470
|
try {
|
|
46144
|
-
const raw =
|
|
46471
|
+
const raw = readFileSync27(path, "utf-8");
|
|
46145
46472
|
const parsed = JSON.parse(raw);
|
|
46146
46473
|
if (parsed && typeof parsed === "object" && (parsed.lastNotifiedReason === null || typeof parsed.lastNotifiedReason === "string") && typeof parsed.lastNotifiedAt === "number" && Number.isFinite(parsed.lastNotifiedAt)) {
|
|
46147
46474
|
return {
|
|
@@ -46153,55 +46480,55 @@ function loadCreditState(stateDir) {
|
|
|
46153
46480
|
return emptyCreditState();
|
|
46154
46481
|
}
|
|
46155
46482
|
function saveCreditState(stateDir, state3) {
|
|
46156
|
-
|
|
46157
|
-
const path =
|
|
46483
|
+
mkdirSync15(stateDir, { recursive: true });
|
|
46484
|
+
const path = join27(stateDir, STATE_FILE);
|
|
46158
46485
|
writeFileSync17(path, JSON.stringify(state3, null, 2) + `
|
|
46159
46486
|
`, { mode: 384 });
|
|
46160
46487
|
}
|
|
46161
46488
|
|
|
46162
46489
|
// gateway/turn-active-marker.ts
|
|
46163
46490
|
import {
|
|
46164
|
-
closeSync as
|
|
46165
|
-
existsSync as
|
|
46166
|
-
mkdirSync as
|
|
46167
|
-
openSync as
|
|
46168
|
-
readFileSync as
|
|
46491
|
+
closeSync as closeSync5,
|
|
46492
|
+
existsSync as existsSync29,
|
|
46493
|
+
mkdirSync as mkdirSync16,
|
|
46494
|
+
openSync as openSync5,
|
|
46495
|
+
readFileSync as readFileSync28,
|
|
46169
46496
|
statSync as statSync9,
|
|
46170
46497
|
unlinkSync as unlinkSync11,
|
|
46171
46498
|
utimesSync as utimesSync2,
|
|
46172
46499
|
writeFileSync as writeFileSync18
|
|
46173
46500
|
} from "node:fs";
|
|
46174
|
-
import { join as
|
|
46501
|
+
import { join as join28 } from "node:path";
|
|
46175
46502
|
var TURN_ACTIVE_MARKER_FILE2 = "turn-active.json";
|
|
46176
46503
|
function writeTurnActiveMarker(stateDir, marker) {
|
|
46177
46504
|
try {
|
|
46178
|
-
|
|
46179
|
-
writeFileSync18(
|
|
46505
|
+
mkdirSync16(stateDir, { recursive: true });
|
|
46506
|
+
writeFileSync18(join28(stateDir, TURN_ACTIVE_MARKER_FILE2), JSON.stringify(marker, null, 2) + `
|
|
46180
46507
|
`, { mode: 384 });
|
|
46181
46508
|
} catch {}
|
|
46182
46509
|
}
|
|
46183
46510
|
function touchTurnActiveMarker2(stateDir) {
|
|
46184
|
-
const path =
|
|
46185
|
-
if (!
|
|
46511
|
+
const path = join28(stateDir, TURN_ACTIVE_MARKER_FILE2);
|
|
46512
|
+
if (!existsSync29(path))
|
|
46186
46513
|
return;
|
|
46187
46514
|
const now = new Date;
|
|
46188
46515
|
try {
|
|
46189
46516
|
utimesSync2(path, now, now);
|
|
46190
46517
|
} catch {
|
|
46191
46518
|
try {
|
|
46192
|
-
const fd =
|
|
46193
|
-
|
|
46519
|
+
const fd = openSync5(path, "r+");
|
|
46520
|
+
closeSync5(fd);
|
|
46194
46521
|
} catch {}
|
|
46195
46522
|
}
|
|
46196
46523
|
}
|
|
46197
46524
|
function removeTurnActiveMarker(stateDir) {
|
|
46198
46525
|
try {
|
|
46199
|
-
unlinkSync11(
|
|
46526
|
+
unlinkSync11(join28(stateDir, TURN_ACTIVE_MARKER_FILE2));
|
|
46200
46527
|
} catch {}
|
|
46201
46528
|
}
|
|
46202
46529
|
function sweepStaleTurnActiveMarker(stateDir, opts) {
|
|
46203
|
-
const path =
|
|
46204
|
-
if (!
|
|
46530
|
+
const path = join28(stateDir, TURN_ACTIVE_MARKER_FILE2);
|
|
46531
|
+
if (!existsSync29(path))
|
|
46205
46532
|
return false;
|
|
46206
46533
|
const now = opts.now ?? Date.now();
|
|
46207
46534
|
try {
|
|
@@ -46213,7 +46540,7 @@ function sweepStaleTurnActiveMarker(stateDir, opts) {
|
|
|
46213
46540
|
return false;
|
|
46214
46541
|
let payload = null;
|
|
46215
46542
|
try {
|
|
46216
|
-
payload =
|
|
46543
|
+
payload = readFileSync28(path, "utf8");
|
|
46217
46544
|
} catch {}
|
|
46218
46545
|
unlinkSync11(path);
|
|
46219
46546
|
if (opts.onRemove) {
|
|
@@ -46232,11 +46559,11 @@ function sweepStaleTurnActiveMarker(stateDir, opts) {
|
|
|
46232
46559
|
}
|
|
46233
46560
|
|
|
46234
46561
|
// ../src/build-info.ts
|
|
46235
|
-
var VERSION = "0.
|
|
46236
|
-
var COMMIT_SHA = "
|
|
46237
|
-
var COMMIT_DATE = "2026-05-
|
|
46238
|
-
var LATEST_PR =
|
|
46239
|
-
var COMMITS_AHEAD_OF_TAG =
|
|
46562
|
+
var VERSION = "0.12.1";
|
|
46563
|
+
var COMMIT_SHA = "0de1edd1";
|
|
46564
|
+
var COMMIT_DATE = "2026-05-18T08:08:32Z";
|
|
46565
|
+
var LATEST_PR = 1503;
|
|
46566
|
+
var COMMITS_AHEAD_OF_TAG = null;
|
|
46240
46567
|
|
|
46241
46568
|
// gateway/boot-version.ts
|
|
46242
46569
|
function formatRelativeAgo(iso) {
|
|
@@ -46300,17 +46627,17 @@ init_protocol2();
|
|
|
46300
46627
|
init_peercred();
|
|
46301
46628
|
import * as net4 from "node:net";
|
|
46302
46629
|
import * as fs2 from "node:fs";
|
|
46303
|
-
import { homedir as
|
|
46304
|
-
import { join as
|
|
46630
|
+
import { homedir as homedir11 } from "node:os";
|
|
46631
|
+
import { join as join29 } from "node:path";
|
|
46305
46632
|
var DEFAULT_TIMEOUT_MS4 = 2000;
|
|
46306
|
-
var
|
|
46307
|
-
var
|
|
46633
|
+
var UNLOCK_TIMEOUT_MS = 30000;
|
|
46634
|
+
var LEGACY_SOCKET_PATH2 = join29(homedir11(), ".switchroom", "vault-broker.sock");
|
|
46635
|
+
var OPERATOR_SOCKET_PATH2 = join29(homedir11(), ".switchroom", "broker-operator", "sock");
|
|
46308
46636
|
function defaultBrokerSocketPath2() {
|
|
46309
|
-
if (
|
|
46310
|
-
|
|
46311
|
-
|
|
46637
|
+
if (fs2.existsSync(OPERATOR_SOCKET_PATH2))
|
|
46638
|
+
return OPERATOR_SOCKET_PATH2;
|
|
46639
|
+
if (isDockerRuntime())
|
|
46312
46640
|
return OPERATOR_SOCKET_PATH2;
|
|
46313
|
-
}
|
|
46314
46641
|
return LEGACY_SOCKET_PATH2;
|
|
46315
46642
|
}
|
|
46316
46643
|
function resolveBrokerSocketPath2(opts) {
|
|
@@ -46415,7 +46742,7 @@ async function lockViaBroker(opts) {
|
|
|
46415
46742
|
async function unlockViaBroker(passphrase, opts) {
|
|
46416
46743
|
const dataSocketPath = resolveBrokerSocketPath2(opts);
|
|
46417
46744
|
const unlockSocketPath = unlockSocketFor(dataSocketPath);
|
|
46418
|
-
const timeoutMs = opts?.timeoutMs ??
|
|
46745
|
+
const timeoutMs = opts?.timeoutMs ?? UNLOCK_TIMEOUT_MS;
|
|
46419
46746
|
return new Promise((resolve7) => {
|
|
46420
46747
|
let settled = false;
|
|
46421
46748
|
const settle = (val) => {
|
|
@@ -46527,8 +46854,8 @@ function resolveVaultApprovalPosture(broker) {
|
|
|
46527
46854
|
}
|
|
46528
46855
|
|
|
46529
46856
|
// registry/turns-schema.ts
|
|
46530
|
-
import { chmodSync as chmodSync3, mkdirSync as
|
|
46531
|
-
import { join as
|
|
46857
|
+
import { chmodSync as chmodSync3, mkdirSync as mkdirSync17 } from "fs";
|
|
46858
|
+
import { join as join30 } from "path";
|
|
46532
46859
|
var DatabaseClass2 = null;
|
|
46533
46860
|
function loadDatabaseClass2() {
|
|
46534
46861
|
if (DatabaseClass2 != null)
|
|
@@ -46587,9 +46914,9 @@ function applySchema(db2) {
|
|
|
46587
46914
|
}
|
|
46588
46915
|
function openTurnsDb(agentDir) {
|
|
46589
46916
|
const Database = loadDatabaseClass2();
|
|
46590
|
-
const dir =
|
|
46591
|
-
|
|
46592
|
-
const path =
|
|
46917
|
+
const dir = join30(agentDir, "telegram");
|
|
46918
|
+
mkdirSync17(dir, { recursive: true, mode: 448 });
|
|
46919
|
+
const path = join30(dir, "registry.db");
|
|
46593
46920
|
const db2 = new Database(path, { create: true });
|
|
46594
46921
|
applySchema(db2);
|
|
46595
46922
|
try {
|
|
@@ -46728,11 +47055,11 @@ installGlobalErrorHandlers();
|
|
|
46728
47055
|
process.on("beforeExit", () => {
|
|
46729
47056
|
shutdownAnalytics();
|
|
46730
47057
|
});
|
|
46731
|
-
var STATE_DIR = process.env.TELEGRAM_STATE_DIR ??
|
|
46732
|
-
var ACCESS_FILE =
|
|
46733
|
-
var APPROVED_DIR =
|
|
46734
|
-
var ENV_FILE =
|
|
46735
|
-
var INBOX_DIR =
|
|
47058
|
+
var STATE_DIR = process.env.TELEGRAM_STATE_DIR ?? join32(homedir12(), ".claude", "channels", "telegram");
|
|
47059
|
+
var ACCESS_FILE = join32(STATE_DIR, "access.json");
|
|
47060
|
+
var APPROVED_DIR = join32(STATE_DIR, "approved");
|
|
47061
|
+
var ENV_FILE = join32(STATE_DIR, ".env");
|
|
47062
|
+
var INBOX_DIR = join32(STATE_DIR, "inbox");
|
|
46736
47063
|
function triggerSelfRestart(targetAgent, reason, delayMs = 300) {
|
|
46737
47064
|
const isDocker = process.env.SWITCHROOM_RUNTIME === "docker";
|
|
46738
47065
|
const selfAgent = process.env.SWITCHROOM_AGENT_NAME;
|
|
@@ -46797,7 +47124,7 @@ function formatBootVersion() {
|
|
|
46797
47124
|
}
|
|
46798
47125
|
try {
|
|
46799
47126
|
chmodSync5(ENV_FILE, 384);
|
|
46800
|
-
for (const line of
|
|
47127
|
+
for (const line of readFileSync31(ENV_FILE, "utf8").split(`
|
|
46801
47128
|
`)) {
|
|
46802
47129
|
const m = line.match(/^(\w+)=(.*)$/);
|
|
46803
47130
|
if (m && process.env[m[1]] === undefined)
|
|
@@ -46850,7 +47177,7 @@ installTgPostLogger(bot);
|
|
|
46850
47177
|
var _rawSendMessageDraft = bot.api.raw.sendMessageDraft;
|
|
46851
47178
|
var GRAMMY_VERSION = (() => {
|
|
46852
47179
|
try {
|
|
46853
|
-
const raw =
|
|
47180
|
+
const raw = readFileSync31(new URL("../../node_modules/grammy/package.json", import.meta.url), "utf8");
|
|
46854
47181
|
return JSON.parse(raw).version ?? "unknown";
|
|
46855
47182
|
} catch {
|
|
46856
47183
|
return "unknown";
|
|
@@ -46923,7 +47250,7 @@ function assertSendable(f) {
|
|
|
46923
47250
|
} catch {
|
|
46924
47251
|
throw new Error(`refusing to send file \u2014 cannot resolve real path: ${f}`);
|
|
46925
47252
|
}
|
|
46926
|
-
const inbox =
|
|
47253
|
+
const inbox = join32(stateReal, "inbox");
|
|
46927
47254
|
if (real.startsWith(stateReal + sep3) && !real.startsWith(inbox + sep3)) {
|
|
46928
47255
|
throw new Error(`refusing to send channel state: ${f}`);
|
|
46929
47256
|
}
|
|
@@ -46942,7 +47269,7 @@ function assertSendable(f) {
|
|
|
46942
47269
|
}
|
|
46943
47270
|
function readAccessFile() {
|
|
46944
47271
|
try {
|
|
46945
|
-
const raw =
|
|
47272
|
+
const raw = readFileSync31(ACCESS_FILE, "utf8");
|
|
46946
47273
|
const parsed = JSON.parse(raw);
|
|
46947
47274
|
const allowFrom = validateStringArray("allowFrom", parsed.allowFrom ?? []);
|
|
46948
47275
|
const groups = {};
|
|
@@ -47007,7 +47334,7 @@ function assertAllowedChat(chat_id) {
|
|
|
47007
47334
|
function saveAccess(a) {
|
|
47008
47335
|
if (STATIC)
|
|
47009
47336
|
return;
|
|
47010
|
-
|
|
47337
|
+
mkdirSync21(STATE_DIR, { recursive: true, mode: 448 });
|
|
47011
47338
|
const tmp = ACCESS_FILE + ".tmp";
|
|
47012
47339
|
writeFileSync21(tmp, JSON.stringify(a, null, 2) + `
|
|
47013
47340
|
`, { mode: 384 });
|
|
@@ -47029,7 +47356,7 @@ var HISTORY_ENABLED = HISTORY_ACCESS.historyEnabled !== false;
|
|
|
47029
47356
|
if (HISTORY_ENABLED) {
|
|
47030
47357
|
try {
|
|
47031
47358
|
initHistory(STATE_DIR, HISTORY_ACCESS.historyRetentionDays ?? 30);
|
|
47032
|
-
process.stderr.write(`telegram gateway: history capture enabled at ${
|
|
47359
|
+
process.stderr.write(`telegram gateway: history capture enabled at ${join32(STATE_DIR, "history.db")}
|
|
47033
47360
|
`);
|
|
47034
47361
|
} catch (err) {
|
|
47035
47362
|
process.stderr.write(`telegram gateway: history init failed (${err.message}) \u2014 capture disabled
|
|
@@ -47046,10 +47373,10 @@ try {
|
|
|
47046
47373
|
process.stderr.write(`telegram gateway: turn-registry boot-reaper stamped ${reaped} orphaned turn(s) as ended_via='restart'
|
|
47047
47374
|
`);
|
|
47048
47375
|
} else {
|
|
47049
|
-
process.stderr.write(`telegram gateway: turn-registry initialized at ${
|
|
47376
|
+
process.stderr.write(`telegram gateway: turn-registry initialized at ${join32(agentDir, "telegram", "registry.db")}
|
|
47050
47377
|
`);
|
|
47051
47378
|
}
|
|
47052
|
-
const pendingEnvPath =
|
|
47379
|
+
const pendingEnvPath = join32(agentDir, ".pending-turn.env");
|
|
47053
47380
|
try {
|
|
47054
47381
|
const pending = findMostRecentInterruptedTurn(turnsDb);
|
|
47055
47382
|
if (pending != null) {
|
|
@@ -47069,7 +47396,7 @@ try {
|
|
|
47069
47396
|
renameSync12(pendingEnvTmp, pendingEnvPath);
|
|
47070
47397
|
process.stderr.write(`telegram gateway: pending-turn env written to ${pendingEnvPath} turnKey=${pending.turn_key} endedVia=${pending.ended_via ?? "open"}
|
|
47071
47398
|
`);
|
|
47072
|
-
} else if (
|
|
47399
|
+
} else if (existsSync33(pendingEnvPath)) {
|
|
47073
47400
|
rmSync4(pendingEnvPath, { force: true });
|
|
47074
47401
|
process.stderr.write(`telegram gateway: pending-turn env cleared (clean previous shutdown)
|
|
47075
47402
|
`);
|
|
@@ -47123,7 +47450,7 @@ function checkApprovals() {
|
|
|
47123
47450
|
return;
|
|
47124
47451
|
}
|
|
47125
47452
|
for (const senderId of files) {
|
|
47126
|
-
const file =
|
|
47453
|
+
const file = join32(APPROVED_DIR, senderId);
|
|
47127
47454
|
bot.api.sendMessage(senderId, "Paired! Say hi to Claude.").then(() => rmSync4(file, { force: true }), (err) => {
|
|
47128
47455
|
process.stderr.write(`telegram gateway: failed to send approval confirm: ${err}
|
|
47129
47456
|
`);
|
|
@@ -47769,11 +48096,11 @@ var unpinProgressCardForChat = null;
|
|
|
47769
48096
|
var getPinnedProgressCardMessageId = null;
|
|
47770
48097
|
var completeProgressCardTurn = null;
|
|
47771
48098
|
var subagentWatcher = null;
|
|
47772
|
-
var SOCKET_PATH = process.env.SWITCHROOM_GATEWAY_SOCKET ??
|
|
47773
|
-
|
|
47774
|
-
var GATEWAY_PID_PATH = process.env.SWITCHROOM_GATEWAY_PID_FILE ??
|
|
47775
|
-
var GATEWAY_SESSION_MARKER_PATH = process.env.SWITCHROOM_GATEWAY_SESSION_MARKER ??
|
|
47776
|
-
var GATEWAY_CLEAN_SHUTDOWN_MARKER_PATH = process.env.SWITCHROOM_GATEWAY_CLEAN_SHUTDOWN_MARKER ??
|
|
48099
|
+
var SOCKET_PATH = process.env.SWITCHROOM_GATEWAY_SOCKET ?? join32(STATE_DIR, "gateway.sock");
|
|
48100
|
+
mkdirSync21(STATE_DIR, { recursive: true, mode: 448 });
|
|
48101
|
+
var GATEWAY_PID_PATH = process.env.SWITCHROOM_GATEWAY_PID_FILE ?? join32(STATE_DIR, "gateway.pid.json");
|
|
48102
|
+
var GATEWAY_SESSION_MARKER_PATH = process.env.SWITCHROOM_GATEWAY_SESSION_MARKER ?? join32(STATE_DIR, "gateway-session.json");
|
|
48103
|
+
var GATEWAY_CLEAN_SHUTDOWN_MARKER_PATH = process.env.SWITCHROOM_GATEWAY_CLEAN_SHUTDOWN_MARKER ?? join32(STATE_DIR, "clean-shutdown.json");
|
|
47777
48104
|
var GATEWAY_STARTED_AT_MS = Date.now();
|
|
47778
48105
|
var BOOT_CARD_ENABLED = process.env.SWITCHROOM_BOOT_CARD !== "false";
|
|
47779
48106
|
var activeBootCard = null;
|
|
@@ -47802,7 +48129,7 @@ function ensureIssuesCard(chatId, threadId) {
|
|
|
47802
48129
|
bot: botApi,
|
|
47803
48130
|
log: (msg) => process.stderr.write(`telegram gateway: ${msg}
|
|
47804
48131
|
`),
|
|
47805
|
-
persistPath:
|
|
48132
|
+
persistPath: join32(stateDir, "issues-card.json")
|
|
47806
48133
|
});
|
|
47807
48134
|
activeIssuesWatcher = startIssuesWatcher({
|
|
47808
48135
|
stateDir,
|
|
@@ -47960,6 +48287,13 @@ var ipcServer = createIpcServer({
|
|
|
47960
48287
|
const agentDisplayName = resolvePersonaName(agentSlug);
|
|
47961
48288
|
const botApiForCard = wrapBootCardApi(threadId);
|
|
47962
48289
|
bootCardPending = true;
|
|
48290
|
+
const updateOutcomeLine = (() => {
|
|
48291
|
+
try {
|
|
48292
|
+
return maybeRenderUpdateAnnouncement() ?? undefined;
|
|
48293
|
+
} catch {
|
|
48294
|
+
return;
|
|
48295
|
+
}
|
|
48296
|
+
})();
|
|
47963
48297
|
startBootCard(chatId, threadId, botApiForCard, {
|
|
47964
48298
|
agentName: agentDisplayName,
|
|
47965
48299
|
agentSlug,
|
|
@@ -47970,8 +48304,10 @@ var ipcServer = createIpcServer({
|
|
|
47970
48304
|
restartAgeMs: markerAgeMs,
|
|
47971
48305
|
restartReasonDetail: cleanMarker?.reason,
|
|
47972
48306
|
loadAccounts: () => loadAccountsForBootCard(agentSlug),
|
|
48307
|
+
probeQuotaViaBroker: (t) => probeQuotaForBootCard(agentSlug, t),
|
|
47973
48308
|
tmuxSupervisor: process.env.SWITCHROOM_TMUX_SUPERVISOR === "1",
|
|
47974
|
-
dockerMode: process.env.SWITCHROOM_RUNTIME === "docker"
|
|
48309
|
+
dockerMode: process.env.SWITCHROOM_RUNTIME === "docker",
|
|
48310
|
+
...updateOutcomeLine ? { updateOutcomeLine } : {}
|
|
47975
48311
|
}, ackMsgId).then((handle) => {
|
|
47976
48312
|
activeBootCard = handle;
|
|
47977
48313
|
}).catch((err) => {
|
|
@@ -48466,6 +48802,17 @@ ${url}`;
|
|
|
48466
48802
|
previewMessageId = null;
|
|
48467
48803
|
}
|
|
48468
48804
|
}
|
|
48805
|
+
const sendChunkPlainText = async (opts) => {
|
|
48806
|
+
const plainOpts = { ...opts };
|
|
48807
|
+
delete plainOpts.parse_mode;
|
|
48808
|
+
const stripped = telegramHtmlToPlainText(chunks[i]);
|
|
48809
|
+
const plain = stripped.length > 0 ? stripped : "\u26A0\uFE0F (a formatted fragment could not be rendered for Telegram)";
|
|
48810
|
+
const sent = await lockedBot.api.sendMessage(chat_id, plain, plainOpts);
|
|
48811
|
+
sentIds.push(sent.message_id);
|
|
48812
|
+
logOutbound("reply", chat_id, sent.message_id, plain.length, `chunk=${i + 1}/${chunks.length} plaintext-fallback`);
|
|
48813
|
+
process.stderr.write(`telegram gateway: HTML parse-reject \u2014 resent chunk ${i + 1}/${chunks.length} as plain text
|
|
48814
|
+
`);
|
|
48815
|
+
};
|
|
48469
48816
|
try {
|
|
48470
48817
|
const sent = await robustApiCall(() => lockedBot.api.sendMessage(chat_id, chunks[i], sendOpts), { threadId, chat_id });
|
|
48471
48818
|
sentIds.push(sent.message_id);
|
|
@@ -48475,8 +48822,17 @@ ${url}`;
|
|
|
48475
48822
|
threadId = undefined;
|
|
48476
48823
|
const retryOpts = { ...sendOpts };
|
|
48477
48824
|
delete retryOpts.message_thread_id;
|
|
48478
|
-
|
|
48479
|
-
|
|
48825
|
+
try {
|
|
48826
|
+
const sent = await lockedBot.api.sendMessage(chat_id, chunks[i], retryOpts);
|
|
48827
|
+
sentIds.push(sent.message_id);
|
|
48828
|
+
} catch (retryErr) {
|
|
48829
|
+
if (isHtmlParseRejectError(retryErr))
|
|
48830
|
+
await sendChunkPlainText(retryOpts);
|
|
48831
|
+
else
|
|
48832
|
+
throw retryErr;
|
|
48833
|
+
}
|
|
48834
|
+
} else if (isHtmlParseRejectError(err)) {
|
|
48835
|
+
await sendChunkPlainText(sendOpts);
|
|
48480
48836
|
} else {
|
|
48481
48837
|
throw err;
|
|
48482
48838
|
}
|
|
@@ -48936,11 +49292,11 @@ async function executeSendGif(rawArgs) {
|
|
|
48936
49292
|
};
|
|
48937
49293
|
}
|
|
48938
49294
|
async function publishToTelegraph(text, shortName, authorName) {
|
|
48939
|
-
const accountPath =
|
|
49295
|
+
const accountPath = join32(STATE_DIR, "telegraph-account.json");
|
|
48940
49296
|
let account = null;
|
|
48941
49297
|
try {
|
|
48942
|
-
if (
|
|
48943
|
-
const raw =
|
|
49298
|
+
if (existsSync33(accountPath)) {
|
|
49299
|
+
const raw = readFileSync31(accountPath, "utf-8");
|
|
48944
49300
|
const parsed = JSON.parse(raw);
|
|
48945
49301
|
if (parsed.shortName && parsed.accessToken) {
|
|
48946
49302
|
account = parsed;
|
|
@@ -48959,7 +49315,7 @@ async function publishToTelegraph(text, shortName, authorName) {
|
|
|
48959
49315
|
}
|
|
48960
49316
|
account = created.value;
|
|
48961
49317
|
try {
|
|
48962
|
-
|
|
49318
|
+
mkdirSync21(STATE_DIR, { recursive: true, mode: 448 });
|
|
48963
49319
|
writeFileSync21(accountPath, JSON.stringify(account, null, 2), { mode: 384 });
|
|
48964
49320
|
} catch (err) {
|
|
48965
49321
|
process.stderr.write(`telegram gateway: telegraph cache write failed: ${err.message}
|
|
@@ -49117,6 +49473,21 @@ async function executeVaultRequestAccess(args) {
|
|
|
49117
49473
|
}
|
|
49118
49474
|
assertAllowedChat(chat_id);
|
|
49119
49475
|
const agentSlug = process.env.SWITCHROOM_AGENT_NAME || "agent";
|
|
49476
|
+
if (scopeRaw === "read") {
|
|
49477
|
+
try {
|
|
49478
|
+
const visible = await listViaBroker();
|
|
49479
|
+
if (visible !== null && visible.includes(key)) {
|
|
49480
|
+
return {
|
|
49481
|
+
content: [
|
|
49482
|
+
{
|
|
49483
|
+
type: "text",
|
|
49484
|
+
text: `vault_request_access: '${key}' is ALREADY covered by ${agentSlug}'s ` + `standing ACL (schedule.secrets[]). No approval card or grant is needed \u2014 ` + `read it directly: \`switchroom vault get ${key}\`. Do NOT request a grant for this key (a minted token would shadow the standing ACL). If a read still returns VAULT-BROKER-DENIED, the broker likely needs a restart to ` + `pick up a recent config change \u2014 tell the operator; don't re-request.`
|
|
49485
|
+
}
|
|
49486
|
+
]
|
|
49487
|
+
};
|
|
49488
|
+
}
|
|
49489
|
+
} catch {}
|
|
49490
|
+
}
|
|
49120
49491
|
const stageId = randomBytes6(4).toString("hex");
|
|
49121
49492
|
const pending = {
|
|
49122
49493
|
agent: agentSlug,
|
|
@@ -49185,7 +49556,7 @@ async function executeDownloadAttachment(args) {
|
|
|
49185
49556
|
fileUniqueId: file.file_unique_id,
|
|
49186
49557
|
now: Date.now()
|
|
49187
49558
|
});
|
|
49188
|
-
|
|
49559
|
+
mkdirSync21(INBOX_DIR, { recursive: true, mode: 448 });
|
|
49189
49560
|
assertInsideInbox(INBOX_DIR, dlPath);
|
|
49190
49561
|
writeFileSync21(dlPath, buf, { mode: 384 });
|
|
49191
49562
|
return { content: [{ type: "text", text: dlPath }] };
|
|
@@ -50777,7 +51148,7 @@ function restartMarkerPath() {
|
|
|
50777
51148
|
const agentDir = resolveAgentDirFromEnv();
|
|
50778
51149
|
if (!agentDir)
|
|
50779
51150
|
return null;
|
|
50780
|
-
return
|
|
51151
|
+
return join32(agentDir, "restart-pending.json");
|
|
50781
51152
|
}
|
|
50782
51153
|
function writeRestartMarker(marker) {
|
|
50783
51154
|
const p = restartMarkerPath();
|
|
@@ -50803,7 +51174,7 @@ function readRestartMarker() {
|
|
|
50803
51174
|
if (!p)
|
|
50804
51175
|
return null;
|
|
50805
51176
|
try {
|
|
50806
|
-
return JSON.parse(
|
|
51177
|
+
return JSON.parse(readFileSync31(p, "utf8"));
|
|
50807
51178
|
} catch {
|
|
50808
51179
|
return null;
|
|
50809
51180
|
}
|
|
@@ -50872,7 +51243,7 @@ var _dockerReachable;
|
|
|
50872
51243
|
function isDockerReachable() {
|
|
50873
51244
|
if (_dockerReachable !== undefined)
|
|
50874
51245
|
return _dockerReachable;
|
|
50875
|
-
if (!
|
|
51246
|
+
if (!existsSync33("/var/run/docker.sock")) {
|
|
50876
51247
|
_dockerReachable = false;
|
|
50877
51248
|
return _dockerReachable;
|
|
50878
51249
|
}
|
|
@@ -50889,11 +51260,11 @@ function _resetDockerReachableCache() {
|
|
|
50889
51260
|
}
|
|
50890
51261
|
function spawnSwitchroomDetached(args, onFailure) {
|
|
50891
51262
|
const fullArgs = SWITCHROOM_CONFIG ? ["--config", SWITCHROOM_CONFIG, ...args] : args;
|
|
50892
|
-
const logPath =
|
|
51263
|
+
const logPath = join32(STATE_DIR, "detached-spawn.log");
|
|
50893
51264
|
let outFd = null;
|
|
50894
51265
|
try {
|
|
50895
|
-
|
|
50896
|
-
outFd =
|
|
51266
|
+
mkdirSync21(STATE_DIR, { recursive: true });
|
|
51267
|
+
outFd = openSync8(logPath, "a");
|
|
50897
51268
|
writeFileSync21(logPath, `
|
|
50898
51269
|
[${new Date().toISOString()}] spawn ${SWITCHROOM_CLI} ${fullArgs.join(" ")}
|
|
50899
51270
|
`, { flag: "a" });
|
|
@@ -50908,7 +51279,7 @@ function spawnSwitchroomDetached(args, onFailure) {
|
|
|
50908
51279
|
});
|
|
50909
51280
|
if (outFd != null) {
|
|
50910
51281
|
try {
|
|
50911
|
-
|
|
51282
|
+
closeSync8(outFd);
|
|
50912
51283
|
} catch {}
|
|
50913
51284
|
}
|
|
50914
51285
|
if (onFailure) {
|
|
@@ -50920,7 +51291,7 @@ function spawnSwitchroomDetached(args, onFailure) {
|
|
|
50920
51291
|
return;
|
|
50921
51292
|
let tail = "";
|
|
50922
51293
|
try {
|
|
50923
|
-
const full =
|
|
51294
|
+
const full = readFileSync31(logPath, "utf8");
|
|
50924
51295
|
tail = full.split(`
|
|
50925
51296
|
`).slice(-30).join(`
|
|
50926
51297
|
`).trim();
|
|
@@ -51235,27 +51606,37 @@ ${preBlock(formatSwitchroomOutput(detail))}`, { html: true });
|
|
|
51235
51606
|
}
|
|
51236
51607
|
}
|
|
51237
51608
|
bot.use(async (ctx, next) => {
|
|
51238
|
-
if (
|
|
51609
|
+
if (ctx.message?.text) {
|
|
51239
51610
|
const myName = getMyAgentName();
|
|
51240
51611
|
const decision = classifyAdminGate(ctx.message.text, myName);
|
|
51241
51612
|
if (decision.action === "block") {
|
|
51242
|
-
process.stderr.write(`telegram gateway: admin-gate blocked cmd=/${decision.cmd} agent=${process.env.SWITCHROOM_AGENT_NAME ?? "-"} reason=${decision.reason} (AGENT_ADMIN=false)
|
|
51243
|
-
`);
|
|
51244
51613
|
const cmdHtml = escapeHtmlForTg(`/${decision.cmd}`);
|
|
51245
51614
|
const nameHtml = escapeHtmlForTg(myName);
|
|
51246
|
-
const
|
|
51247
|
-
|
|
51248
|
-
|
|
51615
|
+
const notFlagged = decision.reason === "other-agent" ? `\u26A0\uFE0F <code>${cmdHtml}</code> targeting another agent is an admin operation \u2014 this agent (<code>${nameHtml}</code>) isn't admin-flagged. Run it from an admin agent, or set <code>admin: true</code> for this agent in switchroom.yaml. (Self-restart is allowed: send <code>/restart</code> with no arg.)` : `\u26A0\uFE0F <code>${cmdHtml}</code> is an admin command \u2014 this agent (<code>${nameHtml}</code>) isn't admin-flagged. Run it from an admin agent, or set <code>admin: true</code> for this agent in switchroom.yaml.`;
|
|
51616
|
+
if (!AGENT_ADMIN) {
|
|
51617
|
+
process.stderr.write(`telegram gateway: admin-gate blocked cmd=/${decision.cmd} agent=${process.env.SWITCHROOM_AGENT_NAME ?? "-"} reason=${decision.reason} (AGENT_ADMIN=false)
|
|
51618
|
+
`);
|
|
51619
|
+
await switchroomReply(ctx, notFlagged, { html: true });
|
|
51620
|
+
return;
|
|
51621
|
+
}
|
|
51622
|
+
const senderId = String(ctx.from?.id ?? "");
|
|
51623
|
+
const operatorPrivate = ctx.chat?.type === "private" && loadAccess().allowFrom.includes(senderId);
|
|
51624
|
+
if (!operatorPrivate) {
|
|
51625
|
+
process.stderr.write(`telegram gateway: admin-gate refused (not operator-private) cmd=/${decision.cmd} agent=${process.env.SWITCHROOM_AGENT_NAME ?? "-"} chat=${ctx.chat?.type ?? "?"} sender=${senderId}
|
|
51626
|
+
`);
|
|
51627
|
+
await switchroomReply(ctx, `\u26A0\uFE0F <code>${cmdHtml}</code> is a fleet-admin command \u2014 it is <b>operator-private</b>. Send it as a direct message to me from your operator account (a private chat where your Telegram ID is on the access allowlist), not in a group or forum.`, { html: true });
|
|
51628
|
+
return;
|
|
51629
|
+
}
|
|
51249
51630
|
}
|
|
51250
51631
|
}
|
|
51251
51632
|
await next();
|
|
51252
51633
|
});
|
|
51253
51634
|
function readRecentDenialsForAgent(agentName3, windowMs, limit) {
|
|
51254
51635
|
try {
|
|
51255
|
-
const auditPath =
|
|
51256
|
-
if (!
|
|
51636
|
+
const auditPath = join32(homedir12(), ".switchroom", "vault-audit.log");
|
|
51637
|
+
if (!existsSync33(auditPath))
|
|
51257
51638
|
return [];
|
|
51258
|
-
const raw =
|
|
51639
|
+
const raw = readFileSync31(auditPath, "utf8");
|
|
51259
51640
|
return recentDenialsFromAuditLog(raw, { agentName: agentName3, windowMs, limit });
|
|
51260
51641
|
} catch {
|
|
51261
51642
|
return [];
|
|
@@ -51306,7 +51687,7 @@ async function buildAgentMetadata(agentName3) {
|
|
|
51306
51687
|
try {
|
|
51307
51688
|
const agentDir = resolveAgentDirFromEnv();
|
|
51308
51689
|
if (agentDir) {
|
|
51309
|
-
const raw =
|
|
51690
|
+
const raw = readFileSync31(join32(agentDir, ".claude", ".claude.json"), "utf8");
|
|
51310
51691
|
claudeJson = JSON.parse(raw);
|
|
51311
51692
|
}
|
|
51312
51693
|
} catch {}
|
|
@@ -51335,7 +51716,8 @@ async function buildLiveProbeRows(agentName3) {
|
|
|
51335
51716
|
agentDir,
|
|
51336
51717
|
gatewayInfo: { pid: process.pid, startedAtMs: GATEWAY_STARTED_AT_MS },
|
|
51337
51718
|
tmuxSupervisor: process.env.SWITCHROOM_TMUX_SUPERVISOR === "1",
|
|
51338
|
-
dockerMode: process.env.SWITCHROOM_RUNTIME === "docker"
|
|
51719
|
+
dockerMode: process.env.SWITCHROOM_RUNTIME === "docker",
|
|
51720
|
+
probeQuotaViaBroker: (t) => probeQuotaForBootCard(agentName3, t)
|
|
51339
51721
|
});
|
|
51340
51722
|
const rows = [];
|
|
51341
51723
|
const order = [
|
|
@@ -51519,9 +51901,9 @@ bot.command("restart", async (ctx) => {
|
|
|
51519
51901
|
function flushAgentHandoff(agentDir) {
|
|
51520
51902
|
let removed = 0;
|
|
51521
51903
|
for (const fname of [".handoff.md", ".handoff-topic"]) {
|
|
51522
|
-
const p =
|
|
51904
|
+
const p = join32(agentDir, fname);
|
|
51523
51905
|
try {
|
|
51524
|
-
if (
|
|
51906
|
+
if (existsSync33(p)) {
|
|
51525
51907
|
unlinkSync14(p);
|
|
51526
51908
|
removed++;
|
|
51527
51909
|
}
|
|
@@ -51577,7 +51959,7 @@ async function handleNewOrResetCommand(ctx, kind) {
|
|
|
51577
51959
|
writeRestartMarker({ chat_id: chatId, thread_id: threadId ?? null, ack_message_id: ackId, ts: Date.now() });
|
|
51578
51960
|
if (agentDir != null) {
|
|
51579
51961
|
try {
|
|
51580
|
-
writeFileSync21(
|
|
51962
|
+
writeFileSync21(join32(agentDir, ".force-fresh-session"), `${kind} at ${new Date().toISOString()}
|
|
51581
51963
|
`, "utf8");
|
|
51582
51964
|
} catch (err) {
|
|
51583
51965
|
process.stderr.write(`telegram gateway: failed to write force-fresh marker: ${err}
|
|
@@ -51746,7 +52128,7 @@ bot.command("audit", async (ctx) => {
|
|
|
51746
52128
|
return;
|
|
51747
52129
|
const arg = (ctx.match ?? "").trim();
|
|
51748
52130
|
if (arg === "" || arg === "help" || arg === "--help") {
|
|
51749
|
-
await switchroomReply(ctx, "Usage: <code>/audit hostd [--tail N] [--agent <name>] [--op <verb>] [--error]</code>", { html: true });
|
|
52131
|
+
await switchroomReply(ctx, "Usage: <code>/audit hostd [--tail N] [--agent <name>] [--op <verb>] [--error] [--verbose]</code>", { html: true });
|
|
51750
52132
|
return;
|
|
51751
52133
|
}
|
|
51752
52134
|
const tokens = arg.split(/\s+/);
|
|
@@ -51775,6 +52157,10 @@ bot.command("audit", async (ctx) => {
|
|
|
51775
52157
|
argv.push("--error");
|
|
51776
52158
|
continue;
|
|
51777
52159
|
}
|
|
52160
|
+
if (t === "--verbose") {
|
|
52161
|
+
argv.push("--verbose");
|
|
52162
|
+
continue;
|
|
52163
|
+
}
|
|
51778
52164
|
if (t === "--tail" || t === "--agent" || t === "--op") {
|
|
51779
52165
|
const v = tokens[++i];
|
|
51780
52166
|
if (v == null) {
|
|
@@ -51796,7 +52182,7 @@ bot.command("audit", async (ctx) => {
|
|
|
51796
52182
|
argv.push(t, v);
|
|
51797
52183
|
continue;
|
|
51798
52184
|
}
|
|
51799
|
-
await switchroomReply(ctx, `Unknown flag <code>${escapeHtmlForTg(t)}</code>. Allowed: <code>--tail</code>, <code>--agent</code>, <code>--op</code>, <code>--error</code>.`, { html: true });
|
|
52185
|
+
await switchroomReply(ctx, `Unknown flag <code>${escapeHtmlForTg(t)}</code>. Allowed: <code>--tail</code>, <code>--agent</code>, <code>--op</code>, <code>--error</code>, <code>--verbose</code>.`, { html: true });
|
|
51800
52186
|
return;
|
|
51801
52187
|
}
|
|
51802
52188
|
await runSwitchroomCommand(ctx, argv, `hostd audit${argv.length > 2 ? " \u2026" : ""}`);
|
|
@@ -51917,16 +52303,16 @@ bot.command("interrupt", async (ctx) => {
|
|
|
51917
52303
|
await runSwitchroomCommand(ctx, ["agent", "interrupt", name], `interrupt ${name}`);
|
|
51918
52304
|
});
|
|
51919
52305
|
var lockoutOps = {
|
|
51920
|
-
readFileSync: (p, enc) =>
|
|
52306
|
+
readFileSync: (p, enc) => readFileSync31(p, enc),
|
|
51921
52307
|
writeFileSync: (p, data, opts) => writeFileSync21(p, data, opts),
|
|
51922
|
-
existsSync: (p) =>
|
|
51923
|
-
mkdirSync: (p, opts) =>
|
|
51924
|
-
joinPath: (...parts) =>
|
|
52308
|
+
existsSync: (p) => existsSync33(p),
|
|
52309
|
+
mkdirSync: (p, opts) => mkdirSync21(p, opts),
|
|
52310
|
+
joinPath: (...parts) => join32(...parts)
|
|
51925
52311
|
};
|
|
51926
52312
|
var FLEET_FALLBACK_DEDUP_MS = 30000;
|
|
51927
52313
|
function isAuthBrokerSocketReachable() {
|
|
51928
52314
|
try {
|
|
51929
|
-
return
|
|
52315
|
+
return existsSync33(resolveAuthBrokerSocketPath2());
|
|
51930
52316
|
} catch {
|
|
51931
52317
|
return false;
|
|
51932
52318
|
}
|
|
@@ -51987,7 +52373,7 @@ async function runCreditWatch() {
|
|
|
51987
52373
|
if (!agentDir)
|
|
51988
52374
|
return;
|
|
51989
52375
|
const agentName3 = getMyAgentName();
|
|
51990
|
-
const claudeConfigDir =
|
|
52376
|
+
const claudeConfigDir = join32(agentDir, ".claude");
|
|
51991
52377
|
const stateDir = STATE_DIR;
|
|
51992
52378
|
const reason = readClaudeJsonOverage(claudeConfigDir);
|
|
51993
52379
|
const prev = loadCreditState(stateDir);
|
|
@@ -52015,8 +52401,16 @@ async function runCreditWatch() {
|
|
|
52015
52401
|
}
|
|
52016
52402
|
}
|
|
52017
52403
|
bot.command("auth", async (ctx) => {
|
|
52018
|
-
|
|
52404
|
+
const authSenderId = String(ctx.from?.id ?? "");
|
|
52405
|
+
const authOperatorPrivate = ctx.chat?.type === "private" && loadAccess().allowFrom.includes(authSenderId);
|
|
52406
|
+
if (!authOperatorPrivate) {
|
|
52407
|
+
if (ctx.chat?.type !== "private") {
|
|
52408
|
+
process.stderr.write(`telegram gateway: /auth refused (not operator-private) agent=${process.env.SWITCHROOM_AGENT_NAME ?? "-"} chat=${ctx.chat?.type ?? "?"} sender=${authSenderId}
|
|
52409
|
+
`);
|
|
52410
|
+
await switchroomReply(ctx, `\u26A0\uFE0F <code>/auth</code> manages account credentials \u2014 it is <b>operator-private</b>. Send it as a direct message to me from your operator account (a private chat where your Telegram ID is on the access allowlist), not in a group or forum.`, { html: true }).catch(() => {});
|
|
52411
|
+
}
|
|
52019
52412
|
return;
|
|
52413
|
+
}
|
|
52020
52414
|
const text = ctx.message?.text ?? "";
|
|
52021
52415
|
const parsed = parseAuthCommand(text);
|
|
52022
52416
|
if (!parsed)
|
|
@@ -52133,6 +52527,24 @@ async function loadAccountsForBootCard(agent) {
|
|
|
52133
52527
|
return null;
|
|
52134
52528
|
}
|
|
52135
52529
|
}
|
|
52530
|
+
async function probeQuotaForBootCard(agent, timeoutMs) {
|
|
52531
|
+
try {
|
|
52532
|
+
const client3 = await getAuthBrokerClient(agent);
|
|
52533
|
+
if (!client3)
|
|
52534
|
+
return null;
|
|
52535
|
+
const state3 = await client3.listState();
|
|
52536
|
+
const entry = state3.agents.find((a) => a.name === agent);
|
|
52537
|
+
const label = entry?.override ?? entry?.account ?? state3.active;
|
|
52538
|
+
if (!label)
|
|
52539
|
+
return null;
|
|
52540
|
+
const { results } = await client3.probeQuota([label], timeoutMs);
|
|
52541
|
+
return results.find((r) => r.label === label)?.result ?? null;
|
|
52542
|
+
} catch (err) {
|
|
52543
|
+
process.stderr.write(`telegram gateway: boot-card quota probe failed: ${err?.message ?? String(err)}
|
|
52544
|
+
`);
|
|
52545
|
+
return null;
|
|
52546
|
+
}
|
|
52547
|
+
}
|
|
52136
52548
|
async function handleVaultRecentDenialCallback(ctx, data) {
|
|
52137
52549
|
const senderId = String(ctx.from?.id ?? "");
|
|
52138
52550
|
const access = loadAccess();
|
|
@@ -52170,9 +52582,9 @@ async function handleVaultRecentDenialCallback(ctx, data) {
|
|
|
52170
52582
|
return;
|
|
52171
52583
|
}
|
|
52172
52584
|
const { token, id } = result;
|
|
52173
|
-
const tokenPath =
|
|
52585
|
+
const tokenPath = join32(homedir12(), ".switchroom", "agents", agentName3, ".vault-token");
|
|
52174
52586
|
try {
|
|
52175
|
-
|
|
52587
|
+
mkdirSync21(join32(homedir12(), ".switchroom", "agents", agentName3), { recursive: true });
|
|
52176
52588
|
writeFileSync21(tokenPath, token, { mode: 384 });
|
|
52177
52589
|
} catch (err) {
|
|
52178
52590
|
await switchroomReply(ctx, `<b>Grant created (${escapeHtmlForTg(id)}) but token write failed:</b> ${escapeHtmlForTg(String(err))}
|
|
@@ -52192,6 +52604,18 @@ async function handleVaultRecentDenialCallback(ctx, data) {
|
|
|
52192
52604
|
}
|
|
52193
52605
|
async function performVaultAccessApproval(ctx, pending, stageId, senderId, attestation) {
|
|
52194
52606
|
const brokerAuthOpts = attestation.kind === "passphrase" ? { passphrase: attestation.passphrase } : { attest_via_posture: true };
|
|
52607
|
+
if (pending.scope === "read") {
|
|
52608
|
+
try {
|
|
52609
|
+
const visible = await listViaBroker();
|
|
52610
|
+
if (visible !== null && visible.includes(pending.key)) {
|
|
52611
|
+
pendingVaultRequestAccesses.delete(stageId);
|
|
52612
|
+
if (pending.card_message_id != null) {
|
|
52613
|
+
await ctx.api.editMessageText(pending.chat_id, pending.card_message_id, `\u2139\uFE0F <b>${escapeHtmlForTg(pending.agent)}</b> already has standing-ACL access to <code>${escapeHtmlForTg(pending.key)}</code> (schedule.secrets[]). ` + `<b>No grant minted</b> \u2014 a token would shadow the standing ACL. ` + `The agent can read it directly.`, { parse_mode: "HTML", reply_markup: { inline_keyboard: [] } }).catch(() => {});
|
|
52614
|
+
}
|
|
52615
|
+
return;
|
|
52616
|
+
}
|
|
52617
|
+
} catch {}
|
|
52618
|
+
}
|
|
52195
52619
|
let existingReadKeys = [];
|
|
52196
52620
|
let existingWriteKeys = [];
|
|
52197
52621
|
if (pending.scope === "read" || pending.scope === "write") {
|
|
@@ -52237,9 +52661,9 @@ async function performVaultAccessApproval(ctx, pending, stageId, senderId, attes
|
|
|
52237
52661
|
return;
|
|
52238
52662
|
}
|
|
52239
52663
|
const { token, id } = result;
|
|
52240
|
-
const tokenPath =
|
|
52664
|
+
const tokenPath = join32(homedir12(), ".switchroom", "agents", pending.agent, ".vault-token");
|
|
52241
52665
|
try {
|
|
52242
|
-
|
|
52666
|
+
mkdirSync21(join32(homedir12(), ".switchroom", "agents", pending.agent), { recursive: true });
|
|
52243
52667
|
writeFileSync21(tokenPath, token, { mode: 384 });
|
|
52244
52668
|
} catch (err) {
|
|
52245
52669
|
await switchroomReply(ctx, `<b>Grant created (${escapeHtmlForTg(id)}) but token write failed:</b> ${escapeHtmlForTg(String(err))}
|
|
@@ -52667,9 +53091,9 @@ async function executeGrantWizard(ctx, chatId, state3) {
|
|
|
52667
53091
|
return;
|
|
52668
53092
|
}
|
|
52669
53093
|
const { token, id } = result;
|
|
52670
|
-
const tokenPath =
|
|
53094
|
+
const tokenPath = join32(homedir12(), ".switchroom", "agents", state3.agent, ".vault-token");
|
|
52671
53095
|
try {
|
|
52672
|
-
|
|
53096
|
+
mkdirSync21(join32(homedir12(), ".switchroom", "agents", state3.agent), { recursive: true });
|
|
52673
53097
|
writeFileSync21(tokenPath, token, { mode: 384 });
|
|
52674
53098
|
} catch (err) {
|
|
52675
53099
|
await switchroomReply(ctx, `<b>Grant created but token write failed:</b> ${escapeHtmlForTg(String(err))}`, { html: true });
|
|
@@ -53526,7 +53950,7 @@ bot.command("usage", async (ctx) => {
|
|
|
53526
53950
|
await switchroomReply(ctx, "<b>/usage:</b> cannot resolve agent dir.", { html: true });
|
|
53527
53951
|
return;
|
|
53528
53952
|
}
|
|
53529
|
-
const result = await fetchQuota2({ claudeConfigDir:
|
|
53953
|
+
const result = await fetchQuota2({ claudeConfigDir: join32(agentDir, ".claude") });
|
|
53530
53954
|
if (!result.ok) {
|
|
53531
53955
|
await switchroomReply(ctx, `<b>/usage:</b> ${escapeHtmlForTg(result.reason)}`, { html: true });
|
|
53532
53956
|
return;
|
|
@@ -53656,6 +54080,12 @@ bot.on("callback_query:data", async (ctx) => {
|
|
|
53656
54080
|
return;
|
|
53657
54081
|
}
|
|
53658
54082
|
if (data.startsWith("apv:")) {
|
|
54083
|
+
const access2 = loadAccess();
|
|
54084
|
+
const senderId2 = String(ctx.from?.id ?? "");
|
|
54085
|
+
if (!access2.allowFrom.includes(senderId2)) {
|
|
54086
|
+
await ctx.answerCallbackQuery({ text: "Not authorized." });
|
|
54087
|
+
return;
|
|
54088
|
+
}
|
|
53659
54089
|
const { handleApprovalCallback: handleApprovalCallback2 } = await Promise.resolve().then(() => (init_approval_callback(), exports_approval_callback));
|
|
53660
54090
|
await handleApprovalCallback2(ctx, data);
|
|
53661
54091
|
return;
|
|
@@ -53937,7 +54367,7 @@ bot.on("message:photo", async (ctx) => {
|
|
|
53937
54367
|
fileUniqueId: best.file_unique_id,
|
|
53938
54368
|
now: Date.now()
|
|
53939
54369
|
});
|
|
53940
|
-
|
|
54370
|
+
mkdirSync21(INBOX_DIR, { recursive: true, mode: 448 });
|
|
53941
54371
|
assertInsideInbox(INBOX_DIR, dlPath);
|
|
53942
54372
|
writeFileSync21(dlPath, buf, { mode: 384 });
|
|
53943
54373
|
return dlPath;
|
|
@@ -53979,8 +54409,8 @@ async function maybeTranscribeVoice(fileId, mimeType, language) {
|
|
|
53979
54409
|
let apiKey = null;
|
|
53980
54410
|
try {
|
|
53981
54411
|
const path = __require("path").join(__require("os").homedir(), ".switchroom", "openai-api-key");
|
|
53982
|
-
if (
|
|
53983
|
-
apiKey =
|
|
54412
|
+
if (existsSync33(path)) {
|
|
54413
|
+
apiKey = readFileSync31(path, "utf-8").trim();
|
|
53984
54414
|
}
|
|
53985
54415
|
} catch (err) {
|
|
53986
54416
|
process.stderr.write(`telegram gateway: voice-in: failed to read api key: ${err.message}
|
|
@@ -54823,18 +55253,27 @@ var didOneTimeSetup = false;
|
|
|
54823
55253
|
const botApiForCard = wrapBootCardApi(threadId);
|
|
54824
55254
|
bootCardPending = true;
|
|
54825
55255
|
try {
|
|
55256
|
+
const updateOutcomeLine = (() => {
|
|
55257
|
+
try {
|
|
55258
|
+
return maybeRenderUpdateAnnouncement() ?? undefined;
|
|
55259
|
+
} catch {
|
|
55260
|
+
return;
|
|
55261
|
+
}
|
|
55262
|
+
})();
|
|
54826
55263
|
const handle = await startBootCard(chatId, threadId, botApiForCard, {
|
|
54827
55264
|
agentName: agentDisplayName,
|
|
54828
55265
|
agentSlug,
|
|
54829
55266
|
version: formatBootVersion(),
|
|
54830
|
-
agentDir: agentDir ??
|
|
55267
|
+
agentDir: agentDir ?? join32(homedir12(), ".switchroom", "agents", agentSlug),
|
|
54831
55268
|
gatewayInfo: { pid: process.pid, startedAtMs: GATEWAY_STARTED_AT_MS },
|
|
54832
55269
|
restartReason: reason,
|
|
54833
55270
|
restartAgeMs: markerAgeMs,
|
|
54834
55271
|
restartReasonDetail: cleanMarker?.reason,
|
|
54835
55272
|
loadAccounts: () => loadAccountsForBootCard(agentSlug),
|
|
55273
|
+
probeQuotaViaBroker: (t) => probeQuotaForBootCard(agentSlug, t),
|
|
54836
55274
|
tmuxSupervisor: process.env.SWITCHROOM_TMUX_SUPERVISOR === "1",
|
|
54837
|
-
dockerMode: process.env.SWITCHROOM_RUNTIME === "docker"
|
|
55275
|
+
dockerMode: process.env.SWITCHROOM_RUNTIME === "docker",
|
|
55276
|
+
...updateOutcomeLine ? { updateOutcomeLine } : {}
|
|
54838
55277
|
}, ackMsgId);
|
|
54839
55278
|
activeBootCard = handle;
|
|
54840
55279
|
} catch (err) {
|