switchroom 0.11.1 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -6
- package/dist/agent-scheduler/index.js +216 -97
- package/dist/auth-broker/index.js +175 -96
- package/dist/cli/drive-write-pretool.mjs +26 -11
- package/dist/cli/switchroom.js +45153 -42663
- 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 +218 -97
- package/examples/personal-google-workspace-mcp/README.md +8 -3
- package/examples/switchroom.yaml +91 -42
- package/package.json +2 -2
- package/profiles/_base/start.sh.hbs +76 -36
- package/profiles/default/CLAUDE.md.hbs +4 -2
- package/skills/file-bug/SKILL.md +6 -4
- package/skills/switchroom-cli/SKILL.md +20 -4
- package/skills/switchroom-install/SKILL.md +3 -3
- package/telegram-plugin/auth-snapshot-format.ts +4 -4
- package/telegram-plugin/card-format.ts +3 -3
- package/telegram-plugin/dist/bridge/bridge.js +112 -112
- package/telegram-plugin/dist/gateway/gateway.js +795 -410
- package/telegram-plugin/dist/server.js +162 -161
- package/telegram-plugin/format.ts +71 -0
- 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 +71 -27
- 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 +193 -22
- package/telegram-plugin/gateway/update-announce.ts +167 -0
- package/telegram-plugin/quota-check.ts +0 -195
- 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 +31 -2
- package/telegram-plugin/tests/boot-probes.test.ts +53 -0
- package/telegram-plugin/tests/bot-runtime.test.ts +23 -1
- 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/telegram-format.test.ts +84 -1
- package/telegram-plugin/tests/update-announce.test.ts +154 -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}` : "";
|
|
@@ -27979,7 +28023,7 @@ async function probeSkills(agentDir, opts = {}) {
|
|
|
27979
28023
|
};
|
|
27980
28024
|
})());
|
|
27981
28025
|
}
|
|
27982
|
-
var execFile3, PROBE_TIMEOUT_MS = 2000, 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;
|
|
28026
|
+
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
28027
|
var init_boot_probes = __esm(() => {
|
|
27984
28028
|
init_quota_cache();
|
|
27985
28029
|
init_quota_check();
|
|
@@ -28200,7 +28244,8 @@ function renderBootCard(opts) {
|
|
|
28200
28244
|
if (restartReason === "crash") {
|
|
28201
28245
|
const ageStr = restartAgeMs != null && restartAgeMs > 0 ? ` \u00b7 ${(restartAgeMs / 1000).toFixed(1)}s ago` : "";
|
|
28202
28246
|
degradedRows.push(`\u26a0\ufe0f <b>Restart</b> ${escapeHtml8(REASON_LABEL.crash)}${ageStr}`);
|
|
28203
|
-
|
|
28247
|
+
const tailCmd = process.env.SWITCHROOM_RUNTIME === "docker" ? `docker logs --tail 100 switchroom-${escapeHtml8(agentSlug)}` : `journalctl --user -u switchroom-${escapeHtml8(agentSlug)} -n 100`;
|
|
28248
|
+
degradedRows.push(` \u21b3 Tail logs: <code>${tailCmd}</code>`);
|
|
28204
28249
|
}
|
|
28205
28250
|
if (probes) {
|
|
28206
28251
|
for (const key of PROBE_KEYS) {
|
|
@@ -28224,6 +28269,10 @@ function renderBootCard(opts) {
|
|
|
28224
28269
|
sections.push("", ...degradedRows);
|
|
28225
28270
|
if (accountRows.length > 0)
|
|
28226
28271
|
sections.push("", ...accountRows);
|
|
28272
|
+
if (opts.updateOutcomeLine) {
|
|
28273
|
+
sections.push("", ...opts.updateOutcomeLine.split(`
|
|
28274
|
+
`));
|
|
28275
|
+
}
|
|
28227
28276
|
if (sections.length === 1)
|
|
28228
28277
|
return ack;
|
|
28229
28278
|
return sections.join(`
|
|
@@ -28243,7 +28292,7 @@ async function runAllProbes(opts) {
|
|
|
28243
28292
|
probeGateway(opts.gatewayInfo).then((r) => {
|
|
28244
28293
|
probes.gateway = r;
|
|
28245
28294
|
}),
|
|
28246
|
-
probeQuota(claudeDir, opts.agentDir, opts.fetchImpl).then((r) => {
|
|
28295
|
+
probeQuota(claudeDir, opts.agentDir, opts.fetchImpl, { brokerProbe: opts.probeQuotaViaBroker }).then((r) => {
|
|
28247
28296
|
probes.quota = r;
|
|
28248
28297
|
}),
|
|
28249
28298
|
probeHindsight(opts.bankName, opts.fetchImpl).then((r) => {
|
|
@@ -28273,7 +28322,8 @@ async function startBootCard(chatId, threadId, bot, opts, ackMessageId, log) {
|
|
|
28273
28322
|
agentSlug: opts.agentSlug,
|
|
28274
28323
|
version: opts.version,
|
|
28275
28324
|
restartReason: opts.restartReason,
|
|
28276
|
-
restartAgeMs: opts.restartAgeMs
|
|
28325
|
+
restartAgeMs: opts.restartAgeMs,
|
|
28326
|
+
...opts.updateOutcomeLine ? { updateOutcomeLine: opts.updateOutcomeLine } : {}
|
|
28277
28327
|
});
|
|
28278
28328
|
const silentBootCard = opts.restartReasonDetail?.startsWith("operator:") === true;
|
|
28279
28329
|
let messageId;
|
|
@@ -28338,7 +28388,8 @@ async function startBootCard(chatId, threadId, bot, opts, ackMessageId, log) {
|
|
|
28338
28388
|
restartAgeMs: opts.restartAgeMs,
|
|
28339
28389
|
...accountRows ? { accounts: accountRows } : {},
|
|
28340
28390
|
...resolvedRows.length > 0 ? { resolvedRows } : {},
|
|
28341
|
-
...snoozeRows.length > 0 ? { snoozeRows } : {}
|
|
28391
|
+
...snoozeRows.length > 0 ? { snoozeRows } : {},
|
|
28392
|
+
...opts.updateOutcomeLine ? { updateOutcomeLine: opts.updateOutcomeLine } : {}
|
|
28342
28393
|
});
|
|
28343
28394
|
if (currentText !== ackText) {
|
|
28344
28395
|
try {
|
|
@@ -28379,7 +28430,8 @@ async function startBootCard(chatId, threadId, bot, opts, ackMessageId, log) {
|
|
|
28379
28430
|
restartAgeMs: opts.restartAgeMs,
|
|
28380
28431
|
...accountRows ? { accounts: accountRows } : {},
|
|
28381
28432
|
...resolvedRows.length > 0 ? { resolvedRows } : {},
|
|
28382
|
-
...snoozeRows.length > 0 ? { snoozeRows } : {}
|
|
28433
|
+
...snoozeRows.length > 0 ? { snoozeRows } : {},
|
|
28434
|
+
...opts.updateOutcomeLine ? { updateOutcomeLine: opts.updateOutcomeLine } : {}
|
|
28383
28435
|
});
|
|
28384
28436
|
if (updatedText === currentText)
|
|
28385
28437
|
continue;
|
|
@@ -28469,11 +28521,11 @@ var init_flock = () => {};
|
|
|
28469
28521
|
// ../src/vault/vault.ts
|
|
28470
28522
|
import { randomBytes as randomBytes5, scryptSync, createCipheriv, createDecipheriv } from "node:crypto";
|
|
28471
28523
|
import {
|
|
28472
|
-
readFileSync as
|
|
28524
|
+
readFileSync as readFileSync30,
|
|
28473
28525
|
writeFileSync as writeFileSync19,
|
|
28474
|
-
existsSync as
|
|
28526
|
+
existsSync as existsSync31,
|
|
28475
28527
|
renameSync as renameSync11,
|
|
28476
|
-
mkdirSync as
|
|
28528
|
+
mkdirSync as mkdirSync18,
|
|
28477
28529
|
unlinkSync as unlinkSync12,
|
|
28478
28530
|
lstatSync,
|
|
28479
28531
|
realpathSync
|
|
@@ -28509,12 +28561,12 @@ function normalizeSecrets(raw) {
|
|
|
28509
28561
|
return out;
|
|
28510
28562
|
}
|
|
28511
28563
|
function openVault(passphrase, vaultPath) {
|
|
28512
|
-
if (!
|
|
28564
|
+
if (!existsSync31(vaultPath)) {
|
|
28513
28565
|
throw new VaultError(`Vault file not found: ${vaultPath}`);
|
|
28514
28566
|
}
|
|
28515
28567
|
let vaultFile;
|
|
28516
28568
|
try {
|
|
28517
|
-
vaultFile = JSON.parse(
|
|
28569
|
+
vaultFile = JSON.parse(readFileSync30(vaultPath, "utf8"));
|
|
28518
28570
|
} catch {
|
|
28519
28571
|
throw new VaultError(`Failed to read vault file: ${vaultPath}`);
|
|
28520
28572
|
}
|
|
@@ -28560,15 +28612,15 @@ var init_vault = __esm(() => {
|
|
|
28560
28612
|
// ../src/vault/resolver.ts
|
|
28561
28613
|
import {
|
|
28562
28614
|
chmodSync as chmodSync4,
|
|
28563
|
-
closeSync as
|
|
28564
|
-
mkdirSync as
|
|
28615
|
+
closeSync as closeSync7,
|
|
28616
|
+
mkdirSync as mkdirSync19,
|
|
28565
28617
|
mkdtempSync as mkdtempSync2,
|
|
28566
|
-
openSync as
|
|
28618
|
+
openSync as openSync7,
|
|
28567
28619
|
rmSync as rmSync3,
|
|
28568
28620
|
statSync as statSync11,
|
|
28569
28621
|
writeSync as writeSync2
|
|
28570
28622
|
} from "node:fs";
|
|
28571
|
-
import { join as
|
|
28623
|
+
import { join as join31 } from "node:path";
|
|
28572
28624
|
import { tmpdir } from "node:os";
|
|
28573
28625
|
import { constants as fsConstants } from "node:fs";
|
|
28574
28626
|
function isVaultReference(value) {
|
|
@@ -28620,32 +28672,32 @@ function materializationRoot() {
|
|
|
28620
28672
|
return cachedRoot;
|
|
28621
28673
|
const xdg = process.env.XDG_RUNTIME_DIR;
|
|
28622
28674
|
if (xdg) {
|
|
28623
|
-
const base =
|
|
28624
|
-
|
|
28625
|
-
cachedRoot = mkdtempSync2(
|
|
28675
|
+
const base = join31(xdg, "switchroom", "vault");
|
|
28676
|
+
mkdirSync19(base, { recursive: true, mode: 448 });
|
|
28677
|
+
cachedRoot = mkdtempSync2(join31(base, "run-"));
|
|
28626
28678
|
} else {
|
|
28627
|
-
cachedRoot = mkdtempSync2(
|
|
28679
|
+
cachedRoot = mkdtempSync2(join31(tmpdir(), "switchroom-vault-"));
|
|
28628
28680
|
}
|
|
28629
28681
|
chmodSync4(cachedRoot, 448);
|
|
28630
28682
|
return cachedRoot;
|
|
28631
28683
|
}
|
|
28632
28684
|
function writeFileExclusive(filePath, content) {
|
|
28633
28685
|
const buf = typeof content === "string" ? Buffer.from(content, "utf8") : content;
|
|
28634
|
-
const fd =
|
|
28686
|
+
const fd = openSync7(filePath, fsConstants.O_WRONLY | fsConstants.O_CREAT | fsConstants.O_EXCL, 384);
|
|
28635
28687
|
try {
|
|
28636
28688
|
writeSync2(fd, buf);
|
|
28637
28689
|
} finally {
|
|
28638
|
-
|
|
28690
|
+
closeSync7(fd);
|
|
28639
28691
|
}
|
|
28640
28692
|
}
|
|
28641
28693
|
function materializeFilesEntry(key, files) {
|
|
28642
|
-
const dir =
|
|
28694
|
+
const dir = join31(materializationRoot(), key);
|
|
28643
28695
|
if (materializedDirs.has(dir)) {
|
|
28644
28696
|
try {
|
|
28645
28697
|
rmSync3(dir, { recursive: true, force: true });
|
|
28646
28698
|
} catch {}
|
|
28647
28699
|
}
|
|
28648
|
-
|
|
28700
|
+
mkdirSync19(dir, { recursive: true, mode: 448 });
|
|
28649
28701
|
chmodSync4(dir, 448);
|
|
28650
28702
|
const st = statSync11(dir);
|
|
28651
28703
|
if (typeof process.getuid === "function" && st.uid !== process.getuid()) {
|
|
@@ -28655,7 +28707,7 @@ function materializeFilesEntry(key, files) {
|
|
|
28655
28707
|
if (filename.includes("/") || filename.includes("\\") || filename === ".." || filename === "." || filename.includes("\x00")) {
|
|
28656
28708
|
throw new Error(`Refusing to materialize vault file with unsafe name: ${filename}`);
|
|
28657
28709
|
}
|
|
28658
|
-
const filePath =
|
|
28710
|
+
const filePath = join31(dir, filename);
|
|
28659
28711
|
const content = encoding === "base64" ? Buffer.from(value, "base64") : value;
|
|
28660
28712
|
writeFileExclusive(filePath, content);
|
|
28661
28713
|
}
|
|
@@ -28788,7 +28840,7 @@ __export(exports_materialize_bot_token, {
|
|
|
28788
28840
|
materializeBotToken: () => materializeBotToken,
|
|
28789
28841
|
BotTokenMaterializeError: () => BotTokenMaterializeError
|
|
28790
28842
|
});
|
|
28791
|
-
import { existsSync as
|
|
28843
|
+
import { existsSync as existsSync32 } from "node:fs";
|
|
28792
28844
|
function pickConfiguredToken(config, agentName3) {
|
|
28793
28845
|
if (agentName3) {
|
|
28794
28846
|
const agent = config.agents?.[agentName3];
|
|
@@ -28802,7 +28854,7 @@ function tryDirectVaultRead(ref, config, passphrase) {
|
|
|
28802
28854
|
if (!passphrase)
|
|
28803
28855
|
return null;
|
|
28804
28856
|
const vaultPath = resolvePath(config.vault?.path ?? "~/.switchroom/vault.enc");
|
|
28805
|
-
if (!
|
|
28857
|
+
if (!existsSync32(vaultPath))
|
|
28806
28858
|
return null;
|
|
28807
28859
|
try {
|
|
28808
28860
|
const secrets = openVault(passphrase, vaultPath);
|
|
@@ -28854,7 +28906,7 @@ async function materializeBotToken(opts = {}) {
|
|
|
28854
28906
|
}
|
|
28855
28907
|
}
|
|
28856
28908
|
if (!brokerResult.ok && brokerResult.reason === "locked") {
|
|
28857
|
-
throw new BotTokenMaterializeError("Bot token is a vault reference but vault is locked. Run
|
|
28909
|
+
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
28910
|
}
|
|
28859
28911
|
if (!brokerResult.ok && brokerResult.reason === "denied") {
|
|
28860
28912
|
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 +28921,7 @@ async function materializeBotToken(opts = {}) {
|
|
|
28869
28921
|
}
|
|
28870
28922
|
return direct;
|
|
28871
28923
|
}
|
|
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.";
|
|
28924
|
+
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
28925
|
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
28926
|
}
|
|
28875
28927
|
var BotTokenMaterializeError;
|
|
@@ -28894,7 +28946,7 @@ __export(exports_tmux, {
|
|
|
28894
28946
|
captureAgentPane: () => captureAgentPane
|
|
28895
28947
|
});
|
|
28896
28948
|
import { execFileSync as execFileSync4 } from "node:child_process";
|
|
28897
|
-
import { mkdirSync as
|
|
28949
|
+
import { mkdirSync as mkdirSync20, readdirSync as readdirSync6, statSync as statSync12, unlinkSync as unlinkSync13, writeFileSync as writeFileSync20 } from "node:fs";
|
|
28898
28950
|
import { resolve as resolve7 } from "node:path";
|
|
28899
28951
|
function captureAgentPane(opts) {
|
|
28900
28952
|
const { agentName: agentName3, agentDir, reason } = opts;
|
|
@@ -28906,7 +28958,7 @@ function captureAgentPane(opts) {
|
|
|
28906
28958
|
const reasonSlug = sanitizeReason(reason);
|
|
28907
28959
|
const outPath = resolve7(outDir, `${ts}-${reasonSlug}.txt`);
|
|
28908
28960
|
try {
|
|
28909
|
-
|
|
28961
|
+
mkdirSync20(outDir, { recursive: true, mode: 493 });
|
|
28910
28962
|
} catch (err) {
|
|
28911
28963
|
const msg = `mkdir crash-reports failed: ${err.message}`;
|
|
28912
28964
|
console.error(`[tmux-capture] ${agentName3}: ${msg}`);
|
|
@@ -29476,7 +29528,7 @@ function parseApprovalCallback(data) {
|
|
|
29476
29528
|
return null;
|
|
29477
29529
|
const request_id = parts[1];
|
|
29478
29530
|
const choiceStr = parts[2];
|
|
29479
|
-
if (!/^[0-9a-f]{
|
|
29531
|
+
if (!/^[0-9a-f]{32}$/.test(request_id ?? ""))
|
|
29480
29532
|
return null;
|
|
29481
29533
|
switch (choiceStr) {
|
|
29482
29534
|
case "once":
|
|
@@ -29611,22 +29663,22 @@ var import_runner2 = __toESM(require_mod3(), 1);
|
|
|
29611
29663
|
import { randomBytes as randomBytes6 } from "crypto";
|
|
29612
29664
|
import { execFileSync as execFileSync5, execSync as execSync2, spawn as spawn2 } from "child_process";
|
|
29613
29665
|
import {
|
|
29614
|
-
readFileSync as
|
|
29666
|
+
readFileSync as readFileSync31,
|
|
29615
29667
|
writeFileSync as writeFileSync21,
|
|
29616
|
-
mkdirSync as
|
|
29668
|
+
mkdirSync as mkdirSync21,
|
|
29617
29669
|
readdirSync as readdirSync7,
|
|
29618
29670
|
rmSync as rmSync4,
|
|
29619
29671
|
statSync as statSync13,
|
|
29620
29672
|
renameSync as renameSync12,
|
|
29621
29673
|
realpathSync as realpathSync2,
|
|
29622
29674
|
chmodSync as chmodSync5,
|
|
29623
|
-
openSync as
|
|
29624
|
-
closeSync as
|
|
29625
|
-
existsSync as
|
|
29675
|
+
openSync as openSync8,
|
|
29676
|
+
closeSync as closeSync8,
|
|
29677
|
+
existsSync as existsSync33,
|
|
29626
29678
|
unlinkSync as unlinkSync14
|
|
29627
29679
|
} from "fs";
|
|
29628
|
-
import { homedir as
|
|
29629
|
-
import { join as
|
|
29680
|
+
import { homedir as homedir12 } from "os";
|
|
29681
|
+
import { join as join32, extname, sep as sep3, basename as basename7 } from "path";
|
|
29630
29682
|
|
|
29631
29683
|
// plugin-logger.ts
|
|
29632
29684
|
import { appendFileSync, mkdirSync, renameSync, statSync, existsSync } from "fs";
|
|
@@ -31760,6 +31812,12 @@ async function retryWithThreadFallback(retry, send, opts) {
|
|
|
31760
31812
|
throw err;
|
|
31761
31813
|
}
|
|
31762
31814
|
}
|
|
31815
|
+
function isHtmlParseRejectError(err) {
|
|
31816
|
+
if (!(err instanceof import_grammy.GrammyError) || err.error_code !== 400)
|
|
31817
|
+
return false;
|
|
31818
|
+
const d = (err.description || "").toLowerCase();
|
|
31819
|
+
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");
|
|
31820
|
+
}
|
|
31763
31821
|
|
|
31764
31822
|
// shared/bot-runtime.ts
|
|
31765
31823
|
var import_grammy3 = __toESM(require_mod2(), 1);
|
|
@@ -31924,7 +31982,7 @@ function clear(key) {
|
|
|
31924
31982
|
state.delete(key);
|
|
31925
31983
|
}
|
|
31926
31984
|
|
|
31927
|
-
//
|
|
31985
|
+
// ../../switchroom/node_modules/.bun/posthog-node@5.29.2/node_modules/posthog-node/dist/extensions/error-tracking/modifiers/module.node.mjs
|
|
31928
31986
|
import { dirname as dirname2, posix, sep as sep2 } from "path";
|
|
31929
31987
|
function createModulerModifier() {
|
|
31930
31988
|
const getModuleFromFileName = createGetModuleFromFilename();
|
|
@@ -31960,7 +32018,7 @@ function normalizeWindowsPath(path) {
|
|
|
31960
32018
|
return path.replace(/^[A-Z]:/, "").replace(/\\/g, "/");
|
|
31961
32019
|
}
|
|
31962
32020
|
|
|
31963
|
-
//
|
|
32021
|
+
// ../../switchroom/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/featureFlagUtils.mjs
|
|
31964
32022
|
var normalizeFlagsResponse = (flagsResponse) => {
|
|
31965
32023
|
if ("flags" in flagsResponse) {
|
|
31966
32024
|
const featureFlags = getFlagValuesFromFlags(flagsResponse.flags);
|
|
@@ -32031,7 +32089,7 @@ var parsePayload = (response) => {
|
|
|
32031
32089
|
}
|
|
32032
32090
|
};
|
|
32033
32091
|
|
|
32034
|
-
//
|
|
32092
|
+
// ../../switchroom/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/gzip.mjs
|
|
32035
32093
|
function isGzipSupported() {
|
|
32036
32094
|
return "CompressionStream" in globalThis;
|
|
32037
32095
|
}
|
|
@@ -32051,7 +32109,7 @@ async function gzipCompress(input, isDebug = true) {
|
|
|
32051
32109
|
}
|
|
32052
32110
|
}
|
|
32053
32111
|
|
|
32054
|
-
//
|
|
32112
|
+
// ../../switchroom/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/vendor/uuidv7.mjs
|
|
32055
32113
|
/*! For license information please see uuidv7.mjs.LICENSE.txt */
|
|
32056
32114
|
var DIGITS = "0123456789abcdef";
|
|
32057
32115
|
|
|
@@ -32229,7 +32287,7 @@ var defaultGenerator;
|
|
|
32229
32287
|
var uuidv7 = () => uuidv7obj().toString();
|
|
32230
32288
|
var uuidv7obj = () => (defaultGenerator || (defaultGenerator = new V7Generator)).generate();
|
|
32231
32289
|
|
|
32232
|
-
//
|
|
32290
|
+
// ../../switchroom/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/types.mjs
|
|
32233
32291
|
var types_PostHogPersistedProperty = /* @__PURE__ */ function(PostHogPersistedProperty) {
|
|
32234
32292
|
PostHogPersistedProperty["AnonymousId"] = "anonymous_id";
|
|
32235
32293
|
PostHogPersistedProperty["DistinctId"] = "distinct_id";
|
|
@@ -32262,7 +32320,7 @@ var types_PostHogPersistedProperty = /* @__PURE__ */ function(PostHogPersistedPr
|
|
|
32262
32320
|
return PostHogPersistedProperty;
|
|
32263
32321
|
}({});
|
|
32264
32322
|
|
|
32265
|
-
//
|
|
32323
|
+
// ../../switchroom/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/utils/bot-detection.mjs
|
|
32266
32324
|
var DEFAULT_BLOCKED_UA_STRS = [
|
|
32267
32325
|
"amazonbot",
|
|
32268
32326
|
"amazonproductbot",
|
|
@@ -32351,7 +32409,7 @@ var isBlockedUA = function(ua, customBlockedUserAgents = []) {
|
|
|
32351
32409
|
return uaLower.indexOf(blockedUaLower) !== -1;
|
|
32352
32410
|
});
|
|
32353
32411
|
};
|
|
32354
|
-
//
|
|
32412
|
+
// ../../switchroom/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/utils/type-utils.mjs
|
|
32355
32413
|
var nativeIsArray = Array.isArray;
|
|
32356
32414
|
var ObjProto = Object.prototype;
|
|
32357
32415
|
var type_utils_hasOwnProperty = ObjProto.hasOwnProperty;
|
|
@@ -32388,7 +32446,7 @@ function isInstanceOf(candidate, base) {
|
|
|
32388
32446
|
}
|
|
32389
32447
|
}
|
|
32390
32448
|
|
|
32391
|
-
//
|
|
32449
|
+
// ../../switchroom/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/utils/number-utils.mjs
|
|
32392
32450
|
function clampToRange(value, min, max, logger, fallbackValue) {
|
|
32393
32451
|
if (min > max) {
|
|
32394
32452
|
logger.warn("min cannot be greater than max.");
|
|
@@ -32408,7 +32466,7 @@ function clampToRange(value, min, max, logger, fallbackValue) {
|
|
|
32408
32466
|
return clampToRange(fallbackValue || max, min, max, logger);
|
|
32409
32467
|
}
|
|
32410
32468
|
|
|
32411
|
-
//
|
|
32469
|
+
// ../../switchroom/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/utils/bucketed-rate-limiter.mjs
|
|
32412
32470
|
var ONE_DAY_IN_MS = 86400000;
|
|
32413
32471
|
|
|
32414
32472
|
class BucketedRateLimiter {
|
|
@@ -32452,7 +32510,7 @@ class BucketedRateLimiter {
|
|
|
32452
32510
|
this._buckets = {};
|
|
32453
32511
|
}
|
|
32454
32512
|
}
|
|
32455
|
-
//
|
|
32513
|
+
// ../../switchroom/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/utils/promise-queue.mjs
|
|
32456
32514
|
class PromiseQueue {
|
|
32457
32515
|
add(promise) {
|
|
32458
32516
|
const promiseUUID = uuidv7();
|
|
@@ -32478,7 +32536,7 @@ class PromiseQueue {
|
|
|
32478
32536
|
this.promiseByIds = {};
|
|
32479
32537
|
}
|
|
32480
32538
|
}
|
|
32481
|
-
//
|
|
32539
|
+
// ../../switchroom/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/utils/logger.mjs
|
|
32482
32540
|
function createConsole(consoleLike = console) {
|
|
32483
32541
|
const lockedMethods = {
|
|
32484
32542
|
log: consoleLike.log.bind(consoleLike),
|
|
@@ -32516,7 +32574,7 @@ var passThrough = (fn) => fn();
|
|
|
32516
32574
|
function createLogger(prefix, maybeCall = passThrough) {
|
|
32517
32575
|
return _createLogger(prefix, maybeCall, createConsole());
|
|
32518
32576
|
}
|
|
32519
|
-
//
|
|
32577
|
+
// ../../switchroom/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/utils/user-agent-utils.mjs
|
|
32520
32578
|
var MOBILE = "Mobile";
|
|
32521
32579
|
var IOS = "iOS";
|
|
32522
32580
|
var ANDROID = "Android";
|
|
@@ -32773,7 +32831,7 @@ var osMatchers = [
|
|
|
32773
32831
|
]
|
|
32774
32832
|
];
|
|
32775
32833
|
|
|
32776
|
-
//
|
|
32834
|
+
// ../../switchroom/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/utils/index.mjs
|
|
32777
32835
|
var STRING_FORMAT = "utf8";
|
|
32778
32836
|
function assert(truthyValue, message) {
|
|
32779
32837
|
if (!truthyValue || typeof truthyValue != "string" || isEmpty(truthyValue))
|
|
@@ -32821,7 +32879,7 @@ function allSettled(promises) {
|
|
|
32821
32879
|
reason
|
|
32822
32880
|
}))));
|
|
32823
32881
|
}
|
|
32824
|
-
//
|
|
32882
|
+
// ../../switchroom/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/eventemitter.mjs
|
|
32825
32883
|
class SimpleEventEmitter {
|
|
32826
32884
|
constructor() {
|
|
32827
32885
|
this.events = {};
|
|
@@ -32843,7 +32901,7 @@ class SimpleEventEmitter {
|
|
|
32843
32901
|
}
|
|
32844
32902
|
}
|
|
32845
32903
|
|
|
32846
|
-
//
|
|
32904
|
+
// ../../switchroom/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/posthog-core-stateless.mjs
|
|
32847
32905
|
class PostHogFetchHttpError extends Error {
|
|
32848
32906
|
constructor(response, reqByteLength) {
|
|
32849
32907
|
super("HTTP error while fetching PostHog: status=" + response.status + ", reqByteLength=" + reqByteLength), this.response = response, this.reqByteLength = reqByteLength, this.name = "PostHogFetchHttpError";
|
|
@@ -33558,7 +33616,7 @@ class PostHogCoreStateless {
|
|
|
33558
33616
|
return this.shutdownPromise;
|
|
33559
33617
|
}
|
|
33560
33618
|
}
|
|
33561
|
-
//
|
|
33619
|
+
// ../../switchroom/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/index.mjs
|
|
33562
33620
|
var exports_error_tracking = {};
|
|
33563
33621
|
__export(exports_error_tracking, {
|
|
33564
33622
|
winjsStackLineParser: () => winjsStackLineParser,
|
|
@@ -33582,7 +33640,7 @@ __export(exports_error_tracking, {
|
|
|
33582
33640
|
DOMExceptionCoercer: () => DOMExceptionCoercer
|
|
33583
33641
|
});
|
|
33584
33642
|
|
|
33585
|
-
//
|
|
33643
|
+
// ../../switchroom/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/chunk-ids.mjs
|
|
33586
33644
|
var parsedStackResults;
|
|
33587
33645
|
var lastKeysCount;
|
|
33588
33646
|
var cachedFilenameChunkIds;
|
|
@@ -33621,7 +33679,7 @@ function getFilenameToChunkIdMap(stackParser) {
|
|
|
33621
33679
|
return cachedFilenameChunkIds;
|
|
33622
33680
|
}
|
|
33623
33681
|
|
|
33624
|
-
//
|
|
33682
|
+
// ../../switchroom/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/error-properties-builder.mjs
|
|
33625
33683
|
var MAX_CAUSE_RECURSION = 4;
|
|
33626
33684
|
|
|
33627
33685
|
class ErrorPropertiesBuilder {
|
|
@@ -33743,7 +33801,7 @@ class ErrorPropertiesBuilder {
|
|
|
33743
33801
|
return context;
|
|
33744
33802
|
}
|
|
33745
33803
|
}
|
|
33746
|
-
//
|
|
33804
|
+
// ../../switchroom/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/parsers/base.mjs
|
|
33747
33805
|
var UNKNOWN_FUNCTION = "?";
|
|
33748
33806
|
function createFrame(platform, filename, func, lineno, colno) {
|
|
33749
33807
|
const frame = {
|
|
@@ -33759,7 +33817,7 @@ function createFrame(platform, filename, func, lineno, colno) {
|
|
|
33759
33817
|
return frame;
|
|
33760
33818
|
}
|
|
33761
33819
|
|
|
33762
|
-
//
|
|
33820
|
+
// ../../switchroom/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/parsers/safari.mjs
|
|
33763
33821
|
var extractSafariExtensionDetails = (func, filename) => {
|
|
33764
33822
|
const isSafariExtension = func.indexOf("safari-extension") !== -1;
|
|
33765
33823
|
const isSafariWebExtension = func.indexOf("safari-web-extension") !== -1;
|
|
@@ -33772,7 +33830,7 @@ var extractSafariExtensionDetails = (func, filename) => {
|
|
|
33772
33830
|
];
|
|
33773
33831
|
};
|
|
33774
33832
|
|
|
33775
|
-
//
|
|
33833
|
+
// ../../switchroom/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/parsers/chrome.mjs
|
|
33776
33834
|
var chromeRegexNoFnName = /^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i;
|
|
33777
33835
|
var chromeRegex = /^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i;
|
|
33778
33836
|
var chromeEvalRegex = /\((\S*)(?::(\d+))(?::(\d+))\)/;
|
|
@@ -33798,7 +33856,7 @@ var chromeStackLineParser = (line, platform) => {
|
|
|
33798
33856
|
}
|
|
33799
33857
|
};
|
|
33800
33858
|
|
|
33801
|
-
//
|
|
33859
|
+
// ../../switchroom/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/parsers/gecko.mjs
|
|
33802
33860
|
var geckoREgex = /^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i;
|
|
33803
33861
|
var geckoEvalRegex = /(\S+) line (\d+)(?: > eval line \d+)* > eval/i;
|
|
33804
33862
|
var geckoStackLineParser = (line, platform) => {
|
|
@@ -33821,14 +33879,14 @@ var geckoStackLineParser = (line, platform) => {
|
|
|
33821
33879
|
}
|
|
33822
33880
|
};
|
|
33823
33881
|
|
|
33824
|
-
//
|
|
33882
|
+
// ../../switchroom/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/parsers/winjs.mjs
|
|
33825
33883
|
var winjsRegex = /^\s*at (?:((?:\[object object\])?.+) )?\(?((?:[-a-z]+):.*?):(\d+)(?::(\d+))?\)?\s*$/i;
|
|
33826
33884
|
var winjsStackLineParser = (line, platform) => {
|
|
33827
33885
|
const parts = winjsRegex.exec(line);
|
|
33828
33886
|
return parts ? createFrame(platform, parts[2], parts[1] || UNKNOWN_FUNCTION, +parts[3], parts[4] ? +parts[4] : undefined) : undefined;
|
|
33829
33887
|
};
|
|
33830
33888
|
|
|
33831
|
-
//
|
|
33889
|
+
// ../../switchroom/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/parsers/opera.mjs
|
|
33832
33890
|
var opera10Regex = / line (\d+).*script (?:in )?(\S+)(?:: in function (\S+))?$/i;
|
|
33833
33891
|
var opera10StackLineParser = (line, platform) => {
|
|
33834
33892
|
const parts = opera10Regex.exec(line);
|
|
@@ -33840,7 +33898,7 @@ var opera11StackLineParser = (line, platform) => {
|
|
|
33840
33898
|
return parts ? createFrame(platform, parts[5], parts[3] || parts[4] || UNKNOWN_FUNCTION, +parts[1], +parts[2]) : undefined;
|
|
33841
33899
|
};
|
|
33842
33900
|
|
|
33843
|
-
//
|
|
33901
|
+
// ../../switchroom/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/parsers/node.mjs
|
|
33844
33902
|
var FILENAME_MATCH = /^\s*[-]{4,}$/;
|
|
33845
33903
|
var FULL_MATCH = /at (?:async )?(?:(.+?)\s+\()?(?:(.+):(\d+):(\d+)?|([^)]+))\)?/;
|
|
33846
33904
|
var nodeStackLineParser = (line, platform) => {
|
|
@@ -33909,7 +33967,7 @@ function _parseIntOrUndefined(input) {
|
|
|
33909
33967
|
return parseInt(input || "", 10) || undefined;
|
|
33910
33968
|
}
|
|
33911
33969
|
|
|
33912
|
-
//
|
|
33970
|
+
// ../../switchroom/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/parsers/index.mjs
|
|
33913
33971
|
var WEBPACK_ERROR_REGEXP = /\(error: (.*)\)/;
|
|
33914
33972
|
var STACKTRACE_FRAME_LIMIT = 50;
|
|
33915
33973
|
function reverseAndStripFrames(stack) {
|
|
@@ -33954,7 +34012,7 @@ function createStackParser(platform, ...parsers) {
|
|
|
33954
34012
|
return reverseAndStripFrames(frames);
|
|
33955
34013
|
};
|
|
33956
34014
|
}
|
|
33957
|
-
//
|
|
34015
|
+
// ../../switchroom/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/coercers/dom-exception-coercer.mjs
|
|
33958
34016
|
class DOMExceptionCoercer {
|
|
33959
34017
|
match(err) {
|
|
33960
34018
|
return this.isDOMException(err) || this.isDOMError(err);
|
|
@@ -33984,7 +34042,7 @@ class DOMExceptionCoercer {
|
|
|
33984
34042
|
return isBuiltin(err, "DOMError");
|
|
33985
34043
|
}
|
|
33986
34044
|
}
|
|
33987
|
-
//
|
|
34045
|
+
// ../../switchroom/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/coercers/error-coercer.mjs
|
|
33988
34046
|
class ErrorCoercer {
|
|
33989
34047
|
match(err) {
|
|
33990
34048
|
return isPlainError(err);
|
|
@@ -34011,7 +34069,7 @@ class ErrorCoercer {
|
|
|
34011
34069
|
return err.stacktrace || err.stack || undefined;
|
|
34012
34070
|
}
|
|
34013
34071
|
}
|
|
34014
|
-
//
|
|
34072
|
+
// ../../switchroom/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/coercers/error-event-coercer.mjs
|
|
34015
34073
|
class ErrorEventCoercer {
|
|
34016
34074
|
constructor() {}
|
|
34017
34075
|
match(err) {
|
|
@@ -34029,7 +34087,7 @@ class ErrorEventCoercer {
|
|
|
34029
34087
|
return exceptionLike;
|
|
34030
34088
|
}
|
|
34031
34089
|
}
|
|
34032
|
-
//
|
|
34090
|
+
// ../../switchroom/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/coercers/string-coercer.mjs
|
|
34033
34091
|
var ERROR_TYPES_PATTERN = /^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;
|
|
34034
34092
|
|
|
34035
34093
|
class StringCoercer {
|
|
@@ -34059,7 +34117,7 @@ class StringCoercer {
|
|
|
34059
34117
|
];
|
|
34060
34118
|
}
|
|
34061
34119
|
}
|
|
34062
|
-
//
|
|
34120
|
+
// ../../switchroom/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/types.mjs
|
|
34063
34121
|
var severityLevels = [
|
|
34064
34122
|
"fatal",
|
|
34065
34123
|
"error",
|
|
@@ -34069,7 +34127,7 @@ var severityLevels = [
|
|
|
34069
34127
|
"debug"
|
|
34070
34128
|
];
|
|
34071
34129
|
|
|
34072
|
-
//
|
|
34130
|
+
// ../../switchroom/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/coercers/utils.mjs
|
|
34073
34131
|
function extractExceptionKeysForMessage(err, maxLength = 40) {
|
|
34074
34132
|
const keys = Object.keys(err);
|
|
34075
34133
|
keys.sort();
|
|
@@ -34086,7 +34144,7 @@ function extractExceptionKeysForMessage(err, maxLength = 40) {
|
|
|
34086
34144
|
return "";
|
|
34087
34145
|
}
|
|
34088
34146
|
|
|
34089
|
-
//
|
|
34147
|
+
// ../../switchroom/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/coercers/object-coercer.mjs
|
|
34090
34148
|
class ObjectCoercer {
|
|
34091
34149
|
match(candidate) {
|
|
34092
34150
|
return typeof candidate == "object" && candidate !== null;
|
|
@@ -34139,7 +34197,7 @@ class ObjectCoercer {
|
|
|
34139
34197
|
}
|
|
34140
34198
|
}
|
|
34141
34199
|
}
|
|
34142
|
-
//
|
|
34200
|
+
// ../../switchroom/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/coercers/event-coercer.mjs
|
|
34143
34201
|
class EventCoercer {
|
|
34144
34202
|
match(err) {
|
|
34145
34203
|
return isEvent(err);
|
|
@@ -34154,7 +34212,7 @@ class EventCoercer {
|
|
|
34154
34212
|
};
|
|
34155
34213
|
}
|
|
34156
34214
|
}
|
|
34157
|
-
//
|
|
34215
|
+
// ../../switchroom/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/coercers/primitive-coercer.mjs
|
|
34158
34216
|
class PrimitiveCoercer {
|
|
34159
34217
|
match(candidate) {
|
|
34160
34218
|
return isPrimitive(candidate);
|
|
@@ -34168,7 +34226,7 @@ class PrimitiveCoercer {
|
|
|
34168
34226
|
};
|
|
34169
34227
|
}
|
|
34170
34228
|
}
|
|
34171
|
-
//
|
|
34229
|
+
// ../../switchroom/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/coercers/promise-rejection-event.mjs
|
|
34172
34230
|
class PromiseRejectionEventCoercer {
|
|
34173
34231
|
match(err) {
|
|
34174
34232
|
return isBuiltin(err, "PromiseRejectionEvent") || this.isCustomEventWrappingRejection(err);
|
|
@@ -34204,7 +34262,7 @@ class PromiseRejectionEventCoercer {
|
|
|
34204
34262
|
return error;
|
|
34205
34263
|
}
|
|
34206
34264
|
}
|
|
34207
|
-
//
|
|
34265
|
+
// ../../switchroom/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/utils.mjs
|
|
34208
34266
|
class ReduceableCache {
|
|
34209
34267
|
constructor(_maxSize) {
|
|
34210
34268
|
this._maxSize = _maxSize;
|
|
@@ -34229,7 +34287,7 @@ class ReduceableCache {
|
|
|
34229
34287
|
}
|
|
34230
34288
|
}
|
|
34231
34289
|
}
|
|
34232
|
-
//
|
|
34290
|
+
// ../../switchroom/node_modules/.bun/posthog-node@5.29.2/node_modules/posthog-node/dist/extensions/error-tracking/modifiers/context-lines.node.mjs
|
|
34233
34291
|
import { createReadStream } from "node:fs";
|
|
34234
34292
|
import { createInterface } from "node:readline";
|
|
34235
34293
|
var LRU_FILE_CONTENTS_CACHE = new exports_error_tracking.ReduceableCache(25);
|
|
@@ -34447,7 +34505,7 @@ function snipLine(line, colno) {
|
|
|
34447
34505
|
return newLine;
|
|
34448
34506
|
}
|
|
34449
34507
|
|
|
34450
|
-
//
|
|
34508
|
+
// ../../switchroom/node_modules/.bun/posthog-node@5.29.2/node_modules/posthog-node/dist/extensions/error-tracking/autocapture.mjs
|
|
34451
34509
|
function makeUncaughtExceptionHandler(captureFn, onFatalFn) {
|
|
34452
34510
|
let calledFatalError = false;
|
|
34453
34511
|
return Object.assign((error) => {
|
|
@@ -34479,7 +34537,7 @@ function addUnhandledRejectionListener(captureFn) {
|
|
|
34479
34537
|
}));
|
|
34480
34538
|
}
|
|
34481
34539
|
|
|
34482
|
-
//
|
|
34540
|
+
// ../../switchroom/node_modules/.bun/posthog-node@5.29.2/node_modules/posthog-node/dist/extensions/error-tracking/index.mjs
|
|
34483
34541
|
var SHUTDOWN_TIMEOUT = 2000;
|
|
34484
34542
|
|
|
34485
34543
|
class ErrorTracking {
|
|
@@ -34548,10 +34606,10 @@ class ErrorTracking {
|
|
|
34548
34606
|
}
|
|
34549
34607
|
}
|
|
34550
34608
|
|
|
34551
|
-
//
|
|
34609
|
+
// ../../switchroom/node_modules/.bun/posthog-node@5.29.2/node_modules/posthog-node/dist/version.mjs
|
|
34552
34610
|
var version = "5.29.2";
|
|
34553
34611
|
|
|
34554
|
-
//
|
|
34612
|
+
// ../../switchroom/node_modules/.bun/posthog-node@5.29.2/node_modules/posthog-node/dist/types.mjs
|
|
34555
34613
|
var FeatureFlagError2 = {
|
|
34556
34614
|
ERRORS_WHILE_COMPUTING: "errors_while_computing_flags",
|
|
34557
34615
|
FLAG_MISSING: "flag_missing",
|
|
@@ -34559,7 +34617,7 @@ var FeatureFlagError2 = {
|
|
|
34559
34617
|
UNKNOWN_ERROR: "unknown_error"
|
|
34560
34618
|
};
|
|
34561
34619
|
|
|
34562
|
-
//
|
|
34620
|
+
// ../../switchroom/node_modules/.bun/posthog-node@5.29.2/node_modules/posthog-node/dist/extensions/feature-flags/crypto.mjs
|
|
34563
34621
|
async function hashSHA1(text) {
|
|
34564
34622
|
const subtle = globalThis.crypto?.subtle;
|
|
34565
34623
|
if (!subtle)
|
|
@@ -34569,7 +34627,7 @@ async function hashSHA1(text) {
|
|
|
34569
34627
|
return hashArray.map((byte) => byte.toString(16).padStart(2, "0")).join("");
|
|
34570
34628
|
}
|
|
34571
34629
|
|
|
34572
|
-
//
|
|
34630
|
+
// ../../switchroom/node_modules/.bun/posthog-node@5.29.2/node_modules/posthog-node/dist/extensions/feature-flags/feature-flags.mjs
|
|
34573
34631
|
var SIXTY_SECONDS = 60000;
|
|
34574
34632
|
var LONG_SCALE = 1152921504606847000;
|
|
34575
34633
|
var NULL_VALUES_ALLOWED_OPERATORS = [
|
|
@@ -35443,7 +35501,7 @@ function relativeDateParseForFeatureFlagMatching(value) {
|
|
|
35443
35501
|
}
|
|
35444
35502
|
}
|
|
35445
35503
|
|
|
35446
|
-
//
|
|
35504
|
+
// ../../switchroom/node_modules/.bun/posthog-node@5.29.2/node_modules/posthog-node/dist/storage-memory.mjs
|
|
35447
35505
|
class PostHogMemoryStorage {
|
|
35448
35506
|
getProperty(key) {
|
|
35449
35507
|
return this._memoryStorage[key];
|
|
@@ -35456,7 +35514,7 @@ class PostHogMemoryStorage {
|
|
|
35456
35514
|
}
|
|
35457
35515
|
}
|
|
35458
35516
|
|
|
35459
|
-
//
|
|
35517
|
+
// ../../switchroom/node_modules/.bun/posthog-node@5.29.2/node_modules/posthog-node/dist/client.mjs
|
|
35460
35518
|
var MINIMUM_POLLING_INTERVAL = 100;
|
|
35461
35519
|
var THIRTY_SECONDS = 30000;
|
|
35462
35520
|
var MAX_CACHE_SIZE = 50000;
|
|
@@ -36244,7 +36302,7 @@ class PostHogBackendClient extends PostHogCoreStateless {
|
|
|
36244
36302
|
}
|
|
36245
36303
|
}
|
|
36246
36304
|
|
|
36247
|
-
//
|
|
36305
|
+
// ../../switchroom/node_modules/.bun/posthog-node@5.29.2/node_modules/posthog-node/dist/extensions/context/context.mjs
|
|
36248
36306
|
import { AsyncLocalStorage as AsyncLocalStorage2 } from "node:async_hooks";
|
|
36249
36307
|
|
|
36250
36308
|
class PostHogContext {
|
|
@@ -36275,7 +36333,7 @@ class PostHogContext {
|
|
|
36275
36333
|
}
|
|
36276
36334
|
}
|
|
36277
36335
|
|
|
36278
|
-
//
|
|
36336
|
+
// ../../switchroom/node_modules/.bun/posthog-node@5.29.2/node_modules/posthog-node/dist/extensions/sentry-integration.mjs
|
|
36279
36337
|
var NAME = "posthog-node";
|
|
36280
36338
|
function createEventProcessor(_posthog, { organization, projectId, prefix, severityAllowList = [
|
|
36281
36339
|
"error"
|
|
@@ -36343,7 +36401,7 @@ class PostHogSentryIntegration {
|
|
|
36343
36401
|
};
|
|
36344
36402
|
}
|
|
36345
36403
|
}
|
|
36346
|
-
//
|
|
36404
|
+
// ../../switchroom/node_modules/.bun/posthog-node@5.29.2/node_modules/posthog-node/dist/entrypoints/index.node.mjs
|
|
36347
36405
|
ErrorTracking.errorPropertiesBuilder = new exports_error_tracking.ErrorPropertiesBuilder([
|
|
36348
36406
|
new exports_error_tracking.EventCoercer,
|
|
36349
36407
|
new exports_error_tracking.ErrorCoercer,
|
|
@@ -38204,6 +38262,14 @@ import { homedir as homedir4 } from "node:os";
|
|
|
38204
38262
|
import { randomUUID as randomUUID4 } from "node:crypto";
|
|
38205
38263
|
import { join as join9 } from "node:path";
|
|
38206
38264
|
var DEFAULT_TIMEOUT_MS2 = 5000;
|
|
38265
|
+
function reviveDate2(v) {
|
|
38266
|
+
if (v == null)
|
|
38267
|
+
return null;
|
|
38268
|
+
if (v instanceof Date)
|
|
38269
|
+
return Number.isNaN(v.getTime()) ? null : v;
|
|
38270
|
+
const d = new Date(v);
|
|
38271
|
+
return Number.isNaN(d.getTime()) ? null : d;
|
|
38272
|
+
}
|
|
38207
38273
|
function operatorSocketPath2(home = homedir4()) {
|
|
38208
38274
|
return join9(home, ".switchroom", "state", "auth-broker-operator", "sock");
|
|
38209
38275
|
}
|
|
@@ -38299,7 +38365,14 @@ class AuthBrokerClient2 {
|
|
|
38299
38365
|
accounts: [...accounts],
|
|
38300
38366
|
...timeoutMs !== undefined ? { timeoutMs } : {}
|
|
38301
38367
|
});
|
|
38302
|
-
|
|
38368
|
+
const parsed = data;
|
|
38369
|
+
for (const entry of parsed.results) {
|
|
38370
|
+
if (entry.result.ok) {
|
|
38371
|
+
entry.result.data.fiveHourResetAt = reviveDate2(entry.result.data.fiveHourResetAt);
|
|
38372
|
+
entry.result.data.sevenDayResetAt = reviveDate2(entry.result.data.sevenDayResetAt);
|
|
38373
|
+
}
|
|
38374
|
+
}
|
|
38375
|
+
return parsed;
|
|
38303
38376
|
}
|
|
38304
38377
|
async setActive(account) {
|
|
38305
38378
|
const data = await this.send({
|
|
@@ -39522,6 +39595,28 @@ function markdownToHtml(text) {
|
|
|
39522
39595
|
function escapeHtml4(text) {
|
|
39523
39596
|
return text.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
39524
39597
|
}
|
|
39598
|
+
function telegramHtmlToPlainText(html) {
|
|
39599
|
+
const decodeEntities = (s) => s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, '"').replace(/�*39;|�*27;|'/gi, "'").replace(/ /g, " ").replace(/&#(\d+);/g, (_m, d) => {
|
|
39600
|
+
const cp = Number(d);
|
|
39601
|
+
return Number.isFinite(cp) && cp > 0 && cp <= 1114111 ? String.fromCodePoint(cp) : _m;
|
|
39602
|
+
}).replace(/&#x([0-9a-fA-F]+);/g, (_m, h) => {
|
|
39603
|
+
const cp = parseInt(h, 16);
|
|
39604
|
+
return Number.isFinite(cp) && cp > 0 && cp <= 1114111 ? String.fromCodePoint(cp) : _m;
|
|
39605
|
+
});
|
|
39606
|
+
const stripTags = (s) => decodeEntities(s.replace(/<\s*br\s*\/?\s*>/gi, `
|
|
39607
|
+
`).replace(/<\/\s*(?:p|div|li|blockquote|pre|h[1-6])\s*>/gi, `
|
|
39608
|
+
`).replace(/<[^>]*>/g, ""));
|
|
39609
|
+
const withPlainLinks = html.replace(/<a\b[^>]*\bhref\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+))[^>]*>([\s\S]*?)<\/a>/gi, (_m, dq, sq, uq, label) => {
|
|
39610
|
+
const href = decodeEntities((dq ?? sq ?? uq ?? "").trim());
|
|
39611
|
+
const text = stripTags(label).trim();
|
|
39612
|
+
if (!href)
|
|
39613
|
+
return text;
|
|
39614
|
+
return !text || text === href ? href : `${text} (${href})`;
|
|
39615
|
+
});
|
|
39616
|
+
return stripTags(withPlainLinks).replace(/[ \t]+$/gm, "").replace(/\n{3,}/g, `
|
|
39617
|
+
|
|
39618
|
+
`).trim();
|
|
39619
|
+
}
|
|
39525
39620
|
function repairEscapedWhitespace(text) {
|
|
39526
39621
|
if (text.includes(`
|
|
39527
39622
|
`) || text.includes("\r"))
|
|
@@ -41309,8 +41404,6 @@ function formatQuotaBlock(q, now = new Date) {
|
|
|
41309
41404
|
return lines.join(`
|
|
41310
41405
|
`);
|
|
41311
41406
|
}
|
|
41312
|
-
var ACCOUNT_QUOTA_CACHE_TTL_MS2 = 5 * 60000;
|
|
41313
|
-
var accountQuotaCache2 = new Map;
|
|
41314
41407
|
|
|
41315
41408
|
// auto-fallback.ts
|
|
41316
41409
|
var DEFAULT_FALLBACK_COOLDOWN_MS = 2 * 60000;
|
|
@@ -41995,8 +42088,8 @@ function mergeAgentConfig(defaultsIn, agentIn) {
|
|
|
41995
42088
|
if (defaults.dangerous_mode !== undefined && merged.dangerous_mode === undefined) {
|
|
41996
42089
|
merged.dangerous_mode = defaults.dangerous_mode;
|
|
41997
42090
|
}
|
|
41998
|
-
if (defaults.
|
|
41999
|
-
merged.
|
|
42091
|
+
if (defaults.network_isolation !== undefined && merged.network_isolation === undefined) {
|
|
42092
|
+
merged.network_isolation = defaults.network_isolation;
|
|
42000
42093
|
}
|
|
42001
42094
|
if (defaults.thinking_effort !== undefined && merged.thinking_effort === undefined) {
|
|
42002
42095
|
merged.thinking_effort = defaults.thinking_effort;
|
|
@@ -42116,6 +42209,9 @@ function mergeAgentConfig(defaultsIn, agentIn) {
|
|
|
42116
42209
|
}
|
|
42117
42210
|
merged.session_continuity = combined;
|
|
42118
42211
|
}
|
|
42212
|
+
if (merged.release === undefined && defaults.release !== undefined) {
|
|
42213
|
+
merged.release = defaults.release;
|
|
42214
|
+
}
|
|
42119
42215
|
if (defaults.channels || merged.channels) {
|
|
42120
42216
|
const dChan = defaults.channels ?? {};
|
|
42121
42217
|
const aChan = merged.channels ?? {};
|
|
@@ -42247,7 +42343,9 @@ var UpdateApplyRequestSchema = exports_external.object({
|
|
|
42247
42343
|
op: exports_external.literal("update_apply"),
|
|
42248
42344
|
args: exports_external.object({
|
|
42249
42345
|
skip_images: exports_external.boolean().optional(),
|
|
42250
|
-
rebuild: exports_external.boolean().optional()
|
|
42346
|
+
rebuild: exports_external.boolean().optional(),
|
|
42347
|
+
channel: exports_external.enum(["dev", "rc", "latest"]).nullable().optional(),
|
|
42348
|
+
pin: exports_external.string().regex(/^(sha-[0-9a-f]{7,40}|v\d+\.\d+\.\d+)$/).nullable().optional()
|
|
42251
42349
|
}).optional()
|
|
42252
42350
|
});
|
|
42253
42351
|
var ApplyRequestSchema = exports_external.object({
|
|
@@ -43064,7 +43162,7 @@ function clampTtl(requested, fallback, min, max) {
|
|
|
43064
43162
|
|
|
43065
43163
|
// gateway/diff-preview-card.ts
|
|
43066
43164
|
var import_grammy5 = __toESM(require_mod2(), 1);
|
|
43067
|
-
var REQUEST_ID_RE = /^[0-9a-f]{
|
|
43165
|
+
var REQUEST_ID_RE = /^[0-9a-f]{32}$/;
|
|
43068
43166
|
var PENDING_FILE_ID_SENTINEL = "pending-create";
|
|
43069
43167
|
function buildDiffPreviewCard(input) {
|
|
43070
43168
|
if (!REQUEST_ID_RE.test(input.suggestRequestId)) {
|
|
@@ -45393,8 +45491,211 @@ function determineRestartReason(opts) {
|
|
|
45393
45491
|
// gateway/gateway.ts
|
|
45394
45492
|
init_boot_card();
|
|
45395
45493
|
|
|
45494
|
+
// gateway/update-announce.ts
|
|
45495
|
+
import { existsSync as existsSync25, mkdirSync as mkdirSync13, openSync as openSync3, closeSync as closeSync3, readFileSync as readFileSync24 } from "node:fs";
|
|
45496
|
+
import { join as join24 } from "node:path";
|
|
45497
|
+
import { homedir as homedir10 } from "node:os";
|
|
45498
|
+
|
|
45499
|
+
// ../src/host-control/audit-reader.ts
|
|
45500
|
+
import { homedir as homedir9 } from "node:os";
|
|
45501
|
+
import { join as join23 } from "node:path";
|
|
45502
|
+
function defaultAuditLogPath(home2 = homedir9()) {
|
|
45503
|
+
return join23(home2, ".switchroom", "host-control-audit.log");
|
|
45504
|
+
}
|
|
45505
|
+
function parseAuditLine(line) {
|
|
45506
|
+
const trimmed = line.trim();
|
|
45507
|
+
if (trimmed.length === 0)
|
|
45508
|
+
return null;
|
|
45509
|
+
let obj;
|
|
45510
|
+
try {
|
|
45511
|
+
obj = JSON.parse(trimmed);
|
|
45512
|
+
} catch {
|
|
45513
|
+
return null;
|
|
45514
|
+
}
|
|
45515
|
+
if (typeof obj !== "object" || obj === null)
|
|
45516
|
+
return null;
|
|
45517
|
+
const o = obj;
|
|
45518
|
+
if (typeof o.ts !== "string" || typeof o.op !== "string")
|
|
45519
|
+
return null;
|
|
45520
|
+
if (typeof o.request_id !== "string" || typeof o.result !== "string")
|
|
45521
|
+
return null;
|
|
45522
|
+
if (typeof o.duration_ms !== "number")
|
|
45523
|
+
return null;
|
|
45524
|
+
const callerRaw = o.caller;
|
|
45525
|
+
let caller;
|
|
45526
|
+
if (callerRaw && callerRaw.kind === "agent" && typeof callerRaw.name === "string") {
|
|
45527
|
+
caller = { kind: "agent", name: callerRaw.name };
|
|
45528
|
+
} else if (callerRaw && callerRaw.kind === "operator") {
|
|
45529
|
+
caller = { kind: "operator" };
|
|
45530
|
+
} else {
|
|
45531
|
+
return null;
|
|
45532
|
+
}
|
|
45533
|
+
const exit_code = o.exit_code === null || typeof o.exit_code === "number" ? o.exit_code : null;
|
|
45534
|
+
const entry = {
|
|
45535
|
+
ts: o.ts,
|
|
45536
|
+
op: o.op,
|
|
45537
|
+
caller,
|
|
45538
|
+
request_id: o.request_id,
|
|
45539
|
+
result: o.result,
|
|
45540
|
+
exit_code,
|
|
45541
|
+
duration_ms: o.duration_ms
|
|
45542
|
+
};
|
|
45543
|
+
if (typeof o.error === "string")
|
|
45544
|
+
entry.error = o.error;
|
|
45545
|
+
if (typeof o.phase === "string")
|
|
45546
|
+
entry.phase = o.phase;
|
|
45547
|
+
if (typeof o.stdout_tail === "string")
|
|
45548
|
+
entry.stdout_tail = o.stdout_tail;
|
|
45549
|
+
if (typeof o.stderr_tail === "string")
|
|
45550
|
+
entry.stderr_tail = o.stderr_tail;
|
|
45551
|
+
if (typeof o.channel === "string")
|
|
45552
|
+
entry.channel = o.channel;
|
|
45553
|
+
if (typeof o.pin === "string")
|
|
45554
|
+
entry.pin = o.pin;
|
|
45555
|
+
if (o.resolved_sha && typeof o.resolved_sha === "object" && !Array.isArray(o.resolved_sha)) {
|
|
45556
|
+
const rs = {};
|
|
45557
|
+
for (const [k, v] of Object.entries(o.resolved_sha)) {
|
|
45558
|
+
if (typeof v === "string")
|
|
45559
|
+
rs[k] = v;
|
|
45560
|
+
}
|
|
45561
|
+
if (Object.keys(rs).length > 0)
|
|
45562
|
+
entry.resolved_sha = rs;
|
|
45563
|
+
}
|
|
45564
|
+
if (o.install_context && typeof o.install_context === "object" && !Array.isArray(o.install_context)) {
|
|
45565
|
+
const ic = o.install_context;
|
|
45566
|
+
if (typeof ic.install_type === "string" && typeof ic.detected_at === "string") {
|
|
45567
|
+
entry.install_context = {
|
|
45568
|
+
install_type: ic.install_type,
|
|
45569
|
+
detected_at: ic.detected_at
|
|
45570
|
+
};
|
|
45571
|
+
}
|
|
45572
|
+
}
|
|
45573
|
+
return entry;
|
|
45574
|
+
}
|
|
45575
|
+
function filterEntries(entries, filters) {
|
|
45576
|
+
return entries.filter((e) => {
|
|
45577
|
+
if (filters.agent != null) {
|
|
45578
|
+
if (e.caller.kind !== "agent")
|
|
45579
|
+
return false;
|
|
45580
|
+
if (e.caller.name !== filters.agent)
|
|
45581
|
+
return false;
|
|
45582
|
+
}
|
|
45583
|
+
if (filters.op != null && e.op !== filters.op)
|
|
45584
|
+
return false;
|
|
45585
|
+
if (filters.errorOnly) {
|
|
45586
|
+
if (e.result !== "error" && e.result !== "denied")
|
|
45587
|
+
return false;
|
|
45588
|
+
}
|
|
45589
|
+
return true;
|
|
45590
|
+
});
|
|
45591
|
+
}
|
|
45592
|
+
function readAndFilter(raw, filters, limit) {
|
|
45593
|
+
const lines = raw.split(`
|
|
45594
|
+
`);
|
|
45595
|
+
const parsed = [];
|
|
45596
|
+
for (const line of lines) {
|
|
45597
|
+
const e = parseAuditLine(line);
|
|
45598
|
+
if (e != null)
|
|
45599
|
+
parsed.push(e);
|
|
45600
|
+
}
|
|
45601
|
+
const filtered = filterEntries(parsed, filters);
|
|
45602
|
+
return filtered.slice(-Math.max(1, limit));
|
|
45603
|
+
}
|
|
45604
|
+
|
|
45605
|
+
// gateway/update-announce.ts
|
|
45606
|
+
var DEFAULT_LOOKBACK_MS = 10 * 60 * 1000;
|
|
45607
|
+
function readLastTerminalUpdateAudit(opts = {}) {
|
|
45608
|
+
const path = opts.auditLogPath ?? defaultAuditLogPath();
|
|
45609
|
+
const exists = opts.exists ?? existsSync25;
|
|
45610
|
+
const readFile = opts.readFile ?? ((p) => readFileSync24(p, "utf-8"));
|
|
45611
|
+
if (!exists(path))
|
|
45612
|
+
return null;
|
|
45613
|
+
let raw;
|
|
45614
|
+
try {
|
|
45615
|
+
raw = readFile(path);
|
|
45616
|
+
} catch {
|
|
45617
|
+
return null;
|
|
45618
|
+
}
|
|
45619
|
+
const recent = readAndFilter(raw, { op: "update_apply" }, 200);
|
|
45620
|
+
const now = opts.now ?? Date.now();
|
|
45621
|
+
const since = now - (opts.lookbackMs ?? DEFAULT_LOOKBACK_MS);
|
|
45622
|
+
let best = null;
|
|
45623
|
+
for (const e of recent) {
|
|
45624
|
+
if (e.phase !== "terminal")
|
|
45625
|
+
continue;
|
|
45626
|
+
const ts = Date.parse(e.ts);
|
|
45627
|
+
if (Number.isNaN(ts))
|
|
45628
|
+
continue;
|
|
45629
|
+
if (ts < since)
|
|
45630
|
+
continue;
|
|
45631
|
+
if (best == null || Date.parse(best.ts) < ts)
|
|
45632
|
+
best = e;
|
|
45633
|
+
}
|
|
45634
|
+
return best;
|
|
45635
|
+
}
|
|
45636
|
+
var RECOVERY_HINTS = {
|
|
45637
|
+
binary: "curl https://switchroom.ai/install.sh | sh && switchroom update",
|
|
45638
|
+
source: "cd ~/code/switchroom && git pull && bun install && bun run build && switchroom update",
|
|
45639
|
+
"source-unlinked": "cd ~/code/switchroom && bun link && switchroom update # ensures binary is in PATH first",
|
|
45640
|
+
docker: "docker compose -p switchroom pull && docker compose -p switchroom up -d",
|
|
45641
|
+
unknown: "Cannot auto-detect install type. Run `switchroom apply` to refresh ~/.switchroom/install-type.json, then retry."
|
|
45642
|
+
};
|
|
45643
|
+
function recoveryHint(installType) {
|
|
45644
|
+
if (!installType)
|
|
45645
|
+
return RECOVERY_HINTS.unknown;
|
|
45646
|
+
return RECOVERY_HINTS[installType] ?? RECOVERY_HINTS.unknown;
|
|
45647
|
+
}
|
|
45648
|
+
function shortSha(s) {
|
|
45649
|
+
return s.replace(/^sha256:/, "").slice(0, 12);
|
|
45650
|
+
}
|
|
45651
|
+
function renderUpdateOutcomeLine(entry) {
|
|
45652
|
+
const success = entry.exit_code === 0 && entry.result !== "error" && entry.result !== "denied";
|
|
45653
|
+
if (success) {
|
|
45654
|
+
const channel = entry.channel ? `channel:${entry.channel}` : entry.pin ? `pin:${entry.pin}` : "channel:?";
|
|
45655
|
+
let shaStr = "";
|
|
45656
|
+
if (entry.resolved_sha) {
|
|
45657
|
+
const firstSha = Object.values(entry.resolved_sha)[0];
|
|
45658
|
+
if (firstSha)
|
|
45659
|
+
shaStr = `, sha:${shortSha(firstSha)}`;
|
|
45660
|
+
}
|
|
45661
|
+
return `\u2705 update completed (${channel}${shaStr})`;
|
|
45662
|
+
}
|
|
45663
|
+
const stderrTail = (entry.stderr_tail ?? entry.error ?? "").slice(-400);
|
|
45664
|
+
const opStep = entry.op;
|
|
45665
|
+
const hint = recoveryHint(entry.install_context?.install_type);
|
|
45666
|
+
const lines = [`\u274c update failed at ${opStep}: ${stderrTail || "(no stderr captured)"}`, ` \u21b3 Recovery: ${hint}`];
|
|
45667
|
+
return lines.join(`
|
|
45668
|
+
`);
|
|
45669
|
+
}
|
|
45670
|
+
function claimUpdateAnnouncement(requestId, opts = {}) {
|
|
45671
|
+
const stateDir = opts.stateDir ?? process.env.TELEGRAM_STATE_DIR ?? join24(homedir10(), ".switchroom");
|
|
45672
|
+
const dir = join24(stateDir, "update-announced");
|
|
45673
|
+
try {
|
|
45674
|
+
mkdirSync13(dir, { recursive: true });
|
|
45675
|
+
} catch {
|
|
45676
|
+
return false;
|
|
45677
|
+
}
|
|
45678
|
+
const safeId = requestId.replace(/[^A-Za-z0-9_.-]/g, "_").slice(0, 200);
|
|
45679
|
+
const path = join24(dir, safeId);
|
|
45680
|
+
try {
|
|
45681
|
+
const fd = openSync3(path, "wx");
|
|
45682
|
+
closeSync3(fd);
|
|
45683
|
+
return true;
|
|
45684
|
+
} catch {
|
|
45685
|
+
return false;
|
|
45686
|
+
}
|
|
45687
|
+
}
|
|
45688
|
+
function maybeRenderUpdateAnnouncement(opts = {}) {
|
|
45689
|
+
const entry = readLastTerminalUpdateAudit(opts);
|
|
45690
|
+
if (!entry)
|
|
45691
|
+
return null;
|
|
45692
|
+
if (!claimUpdateAnnouncement(entry.request_id, opts))
|
|
45693
|
+
return null;
|
|
45694
|
+
return renderUpdateOutcomeLine(entry);
|
|
45695
|
+
}
|
|
45696
|
+
|
|
45396
45697
|
// issues-card.ts
|
|
45397
|
-
import { readFileSync as
|
|
45698
|
+
import { readFileSync as readFileSync25, writeFileSync as writeFileSync15 } from "node:fs";
|
|
45398
45699
|
var SEVERITY_EMOJI = {
|
|
45399
45700
|
info: "\u2139\ufe0f",
|
|
45400
45701
|
warn: "\u26a0\ufe0f",
|
|
@@ -45486,7 +45787,7 @@ function extractRetryAfterSecs(err) {
|
|
|
45486
45787
|
var COOLDOWN_JITTER_MS = 500;
|
|
45487
45788
|
function readPersistedMessageId(path, log) {
|
|
45488
45789
|
try {
|
|
45489
|
-
const raw =
|
|
45790
|
+
const raw = readFileSync25(path, "utf8");
|
|
45490
45791
|
const parsed = JSON.parse(raw);
|
|
45491
45792
|
const v = parsed.messageId;
|
|
45492
45793
|
if (typeof v === "number" && Number.isInteger(v) && v > 0)
|
|
@@ -45595,24 +45896,24 @@ function createIssuesCardHandle(opts) {
|
|
|
45595
45896
|
}
|
|
45596
45897
|
|
|
45597
45898
|
// issues-watcher.ts
|
|
45598
|
-
import { existsSync as
|
|
45599
|
-
import { join as
|
|
45899
|
+
import { existsSync as existsSync27, statSync as statSync8 } from "node:fs";
|
|
45900
|
+
import { join as join26 } from "node:path";
|
|
45600
45901
|
|
|
45601
45902
|
// ../src/issues/store.ts
|
|
45602
45903
|
import {
|
|
45603
|
-
closeSync as
|
|
45604
|
-
existsSync as
|
|
45605
|
-
mkdirSync as
|
|
45606
|
-
openSync as
|
|
45904
|
+
closeSync as closeSync4,
|
|
45905
|
+
existsSync as existsSync26,
|
|
45906
|
+
mkdirSync as mkdirSync14,
|
|
45907
|
+
openSync as openSync4,
|
|
45607
45908
|
readdirSync as readdirSync5,
|
|
45608
|
-
readFileSync as
|
|
45909
|
+
readFileSync as readFileSync26,
|
|
45609
45910
|
renameSync as renameSync10,
|
|
45610
45911
|
statSync as statSync7,
|
|
45611
45912
|
unlinkSync as unlinkSync10,
|
|
45612
45913
|
writeFileSync as writeFileSync16,
|
|
45613
45914
|
writeSync
|
|
45614
45915
|
} from "node:fs";
|
|
45615
|
-
import { join as
|
|
45916
|
+
import { join as join25 } from "node:path";
|
|
45616
45917
|
import { randomBytes as randomBytes4 } from "node:crypto";
|
|
45617
45918
|
import { execSync } from "node:child_process";
|
|
45618
45919
|
|
|
@@ -45628,12 +45929,12 @@ var SEVERITY_RANK2 = {
|
|
|
45628
45929
|
var ISSUES_FILE = "issues.jsonl";
|
|
45629
45930
|
var ISSUES_LOCK = "issues.lock";
|
|
45630
45931
|
function readAll(stateDir) {
|
|
45631
|
-
const path =
|
|
45632
|
-
if (!
|
|
45932
|
+
const path = join25(stateDir, ISSUES_FILE);
|
|
45933
|
+
if (!existsSync26(path))
|
|
45633
45934
|
return [];
|
|
45634
45935
|
let raw;
|
|
45635
45936
|
try {
|
|
45636
|
-
raw =
|
|
45937
|
+
raw = readFileSync26(path, "utf-8");
|
|
45637
45938
|
} catch {
|
|
45638
45939
|
return [];
|
|
45639
45940
|
}
|
|
@@ -45665,7 +45966,7 @@ function list(stateDir, opts = {}) {
|
|
|
45665
45966
|
});
|
|
45666
45967
|
}
|
|
45667
45968
|
function resolve6(stateDir, fingerprint, nowFn = Date.now) {
|
|
45668
|
-
if (!
|
|
45969
|
+
if (!existsSync26(join25(stateDir, ISSUES_FILE)))
|
|
45669
45970
|
return 0;
|
|
45670
45971
|
return withLock(stateDir, () => {
|
|
45671
45972
|
const all = readAll(stateDir);
|
|
@@ -45683,7 +45984,7 @@ function resolve6(stateDir, fingerprint, nowFn = Date.now) {
|
|
|
45683
45984
|
});
|
|
45684
45985
|
}
|
|
45685
45986
|
function writeAll(stateDir, events) {
|
|
45686
|
-
const path =
|
|
45987
|
+
const path = join25(stateDir, ISSUES_FILE);
|
|
45687
45988
|
sweepOrphanTmpFiles(stateDir);
|
|
45688
45989
|
const tmp = `${path}.tmp-${process.pid}-${randomBytes4(4).toString("hex")}`;
|
|
45689
45990
|
const body = events.length === 0 ? "" : events.map((e) => JSON.stringify(e)).join(`
|
|
@@ -45705,7 +46006,7 @@ function sweepOrphanTmpFiles(stateDir) {
|
|
|
45705
46006
|
for (const entry of entries) {
|
|
45706
46007
|
if (!entry.startsWith(TMP_PREFIX))
|
|
45707
46008
|
continue;
|
|
45708
|
-
const tmpPath2 =
|
|
46009
|
+
const tmpPath2 = join25(stateDir, entry);
|
|
45709
46010
|
try {
|
|
45710
46011
|
const stat = statSync7(tmpPath2);
|
|
45711
46012
|
if (stat.mtimeMs < cutoff) {
|
|
@@ -45717,12 +46018,12 @@ function sweepOrphanTmpFiles(stateDir) {
|
|
|
45717
46018
|
var LOCK_RETRY_MS = 25;
|
|
45718
46019
|
var LOCK_TIMEOUT_MS = 1e4;
|
|
45719
46020
|
function withLock(stateDir, fn) {
|
|
45720
|
-
const lockPath =
|
|
46021
|
+
const lockPath = join25(stateDir, ISSUES_LOCK);
|
|
45721
46022
|
const startedAt = Date.now();
|
|
45722
46023
|
let fd = null;
|
|
45723
46024
|
while (fd === null) {
|
|
45724
46025
|
try {
|
|
45725
|
-
fd =
|
|
46026
|
+
fd = openSync4(lockPath, "wx");
|
|
45726
46027
|
try {
|
|
45727
46028
|
writeSync(fd, String(process.pid));
|
|
45728
46029
|
} catch {}
|
|
@@ -45742,7 +46043,7 @@ function withLock(stateDir, fn) {
|
|
|
45742
46043
|
return fn();
|
|
45743
46044
|
} finally {
|
|
45744
46045
|
try {
|
|
45745
|
-
|
|
46046
|
+
closeSync4(fd);
|
|
45746
46047
|
} catch {}
|
|
45747
46048
|
try {
|
|
45748
46049
|
unlinkSync10(lockPath);
|
|
@@ -45752,7 +46053,7 @@ function withLock(stateDir, fn) {
|
|
|
45752
46053
|
function tryStealStaleLock(lockPath) {
|
|
45753
46054
|
let pidStr;
|
|
45754
46055
|
try {
|
|
45755
|
-
pidStr =
|
|
46056
|
+
pidStr = readFileSync26(lockPath, "utf-8").trim();
|
|
45756
46057
|
} catch {
|
|
45757
46058
|
return true;
|
|
45758
46059
|
}
|
|
@@ -45802,7 +46103,7 @@ function isIssueEvent(v) {
|
|
|
45802
46103
|
// issues-watcher.ts
|
|
45803
46104
|
var DEFAULT_POLL_INTERVAL_MS2 = 2000;
|
|
45804
46105
|
function startIssuesWatcher(opts) {
|
|
45805
|
-
const path =
|
|
46106
|
+
const path = join26(opts.stateDir, ISSUES_FILE);
|
|
45806
46107
|
const log = opts.log ?? (() => {});
|
|
45807
46108
|
const intervalMs = opts.pollIntervalMs ?? DEFAULT_POLL_INTERVAL_MS2;
|
|
45808
46109
|
const setIntervalFn = opts.setInterval ?? setInterval;
|
|
@@ -45850,7 +46151,7 @@ function startIssuesWatcher(opts) {
|
|
|
45850
46151
|
};
|
|
45851
46152
|
}
|
|
45852
46153
|
function defaultSignatureProvider(path) {
|
|
45853
|
-
if (!
|
|
46154
|
+
if (!existsSync27(path))
|
|
45854
46155
|
return null;
|
|
45855
46156
|
try {
|
|
45856
46157
|
const stat = statSync8(path);
|
|
@@ -46039,8 +46340,8 @@ function skillBasenameFromPath2(input) {
|
|
|
46039
46340
|
}
|
|
46040
46341
|
|
|
46041
46342
|
// credits-watch.ts
|
|
46042
|
-
import { readFileSync as
|
|
46043
|
-
import { join as
|
|
46343
|
+
import { readFileSync as readFileSync27, writeFileSync as writeFileSync17, existsSync as existsSync28, mkdirSync as mkdirSync15 } from "fs";
|
|
46344
|
+
import { join as join27 } from "path";
|
|
46044
46345
|
var STATE_FILE = "credits-watch.json";
|
|
46045
46346
|
var FATAL_REASONS = new Set([
|
|
46046
46347
|
"out_of_credits",
|
|
@@ -46052,12 +46353,12 @@ function emptyCreditState() {
|
|
|
46052
46353
|
return { lastNotifiedReason: null, lastNotifiedAt: 0 };
|
|
46053
46354
|
}
|
|
46054
46355
|
function readClaudeJsonOverage(claudeConfigDir) {
|
|
46055
|
-
const path =
|
|
46056
|
-
if (!
|
|
46356
|
+
const path = join27(claudeConfigDir, ".claude.json");
|
|
46357
|
+
if (!existsSync28(path))
|
|
46057
46358
|
return null;
|
|
46058
46359
|
let raw;
|
|
46059
46360
|
try {
|
|
46060
|
-
raw =
|
|
46361
|
+
raw = readFileSync27(path, "utf-8");
|
|
46061
46362
|
} catch {
|
|
46062
46363
|
return null;
|
|
46063
46364
|
}
|
|
@@ -46137,11 +46438,11 @@ function escapeHtml10(s) {
|
|
|
46137
46438
|
return s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
46138
46439
|
}
|
|
46139
46440
|
function loadCreditState(stateDir) {
|
|
46140
|
-
const path =
|
|
46141
|
-
if (!
|
|
46441
|
+
const path = join27(stateDir, STATE_FILE);
|
|
46442
|
+
if (!existsSync28(path))
|
|
46142
46443
|
return emptyCreditState();
|
|
46143
46444
|
try {
|
|
46144
|
-
const raw =
|
|
46445
|
+
const raw = readFileSync27(path, "utf-8");
|
|
46145
46446
|
const parsed = JSON.parse(raw);
|
|
46146
46447
|
if (parsed && typeof parsed === "object" && (parsed.lastNotifiedReason === null || typeof parsed.lastNotifiedReason === "string") && typeof parsed.lastNotifiedAt === "number" && Number.isFinite(parsed.lastNotifiedAt)) {
|
|
46147
46448
|
return {
|
|
@@ -46153,55 +46454,55 @@ function loadCreditState(stateDir) {
|
|
|
46153
46454
|
return emptyCreditState();
|
|
46154
46455
|
}
|
|
46155
46456
|
function saveCreditState(stateDir, state3) {
|
|
46156
|
-
|
|
46157
|
-
const path =
|
|
46457
|
+
mkdirSync15(stateDir, { recursive: true });
|
|
46458
|
+
const path = join27(stateDir, STATE_FILE);
|
|
46158
46459
|
writeFileSync17(path, JSON.stringify(state3, null, 2) + `
|
|
46159
46460
|
`, { mode: 384 });
|
|
46160
46461
|
}
|
|
46161
46462
|
|
|
46162
46463
|
// gateway/turn-active-marker.ts
|
|
46163
46464
|
import {
|
|
46164
|
-
closeSync as
|
|
46165
|
-
existsSync as
|
|
46166
|
-
mkdirSync as
|
|
46167
|
-
openSync as
|
|
46168
|
-
readFileSync as
|
|
46465
|
+
closeSync as closeSync5,
|
|
46466
|
+
existsSync as existsSync29,
|
|
46467
|
+
mkdirSync as mkdirSync16,
|
|
46468
|
+
openSync as openSync5,
|
|
46469
|
+
readFileSync as readFileSync28,
|
|
46169
46470
|
statSync as statSync9,
|
|
46170
46471
|
unlinkSync as unlinkSync11,
|
|
46171
46472
|
utimesSync as utimesSync2,
|
|
46172
46473
|
writeFileSync as writeFileSync18
|
|
46173
46474
|
} from "node:fs";
|
|
46174
|
-
import { join as
|
|
46475
|
+
import { join as join28 } from "node:path";
|
|
46175
46476
|
var TURN_ACTIVE_MARKER_FILE2 = "turn-active.json";
|
|
46176
46477
|
function writeTurnActiveMarker(stateDir, marker) {
|
|
46177
46478
|
try {
|
|
46178
|
-
|
|
46179
|
-
writeFileSync18(
|
|
46479
|
+
mkdirSync16(stateDir, { recursive: true });
|
|
46480
|
+
writeFileSync18(join28(stateDir, TURN_ACTIVE_MARKER_FILE2), JSON.stringify(marker, null, 2) + `
|
|
46180
46481
|
`, { mode: 384 });
|
|
46181
46482
|
} catch {}
|
|
46182
46483
|
}
|
|
46183
46484
|
function touchTurnActiveMarker2(stateDir) {
|
|
46184
|
-
const path =
|
|
46185
|
-
if (!
|
|
46485
|
+
const path = join28(stateDir, TURN_ACTIVE_MARKER_FILE2);
|
|
46486
|
+
if (!existsSync29(path))
|
|
46186
46487
|
return;
|
|
46187
46488
|
const now = new Date;
|
|
46188
46489
|
try {
|
|
46189
46490
|
utimesSync2(path, now, now);
|
|
46190
46491
|
} catch {
|
|
46191
46492
|
try {
|
|
46192
|
-
const fd =
|
|
46193
|
-
|
|
46493
|
+
const fd = openSync5(path, "r+");
|
|
46494
|
+
closeSync5(fd);
|
|
46194
46495
|
} catch {}
|
|
46195
46496
|
}
|
|
46196
46497
|
}
|
|
46197
46498
|
function removeTurnActiveMarker(stateDir) {
|
|
46198
46499
|
try {
|
|
46199
|
-
unlinkSync11(
|
|
46500
|
+
unlinkSync11(join28(stateDir, TURN_ACTIVE_MARKER_FILE2));
|
|
46200
46501
|
} catch {}
|
|
46201
46502
|
}
|
|
46202
46503
|
function sweepStaleTurnActiveMarker(stateDir, opts) {
|
|
46203
|
-
const path =
|
|
46204
|
-
if (!
|
|
46504
|
+
const path = join28(stateDir, TURN_ACTIVE_MARKER_FILE2);
|
|
46505
|
+
if (!existsSync29(path))
|
|
46205
46506
|
return false;
|
|
46206
46507
|
const now = opts.now ?? Date.now();
|
|
46207
46508
|
try {
|
|
@@ -46213,7 +46514,7 @@ function sweepStaleTurnActiveMarker(stateDir, opts) {
|
|
|
46213
46514
|
return false;
|
|
46214
46515
|
let payload = null;
|
|
46215
46516
|
try {
|
|
46216
|
-
payload =
|
|
46517
|
+
payload = readFileSync28(path, "utf8");
|
|
46217
46518
|
} catch {}
|
|
46218
46519
|
unlinkSync11(path);
|
|
46219
46520
|
if (opts.onRemove) {
|
|
@@ -46232,10 +46533,10 @@ function sweepStaleTurnActiveMarker(stateDir, opts) {
|
|
|
46232
46533
|
}
|
|
46233
46534
|
|
|
46234
46535
|
// ../src/build-info.ts
|
|
46235
|
-
var VERSION = "0.
|
|
46236
|
-
var COMMIT_SHA = "
|
|
46237
|
-
var COMMIT_DATE = "2026-05-
|
|
46238
|
-
var LATEST_PR =
|
|
46536
|
+
var VERSION = "0.12.0";
|
|
46537
|
+
var COMMIT_SHA = "2870fb03";
|
|
46538
|
+
var COMMIT_DATE = "2026-05-17T08:03:22Z";
|
|
46539
|
+
var LATEST_PR = 1462;
|
|
46239
46540
|
var COMMITS_AHEAD_OF_TAG = 0;
|
|
46240
46541
|
|
|
46241
46542
|
// gateway/boot-version.ts
|
|
@@ -46300,17 +46601,16 @@ init_protocol2();
|
|
|
46300
46601
|
init_peercred();
|
|
46301
46602
|
import * as net4 from "node:net";
|
|
46302
46603
|
import * as fs2 from "node:fs";
|
|
46303
|
-
import { homedir as
|
|
46304
|
-
import { join as
|
|
46604
|
+
import { homedir as homedir11 } from "node:os";
|
|
46605
|
+
import { join as join29 } from "node:path";
|
|
46305
46606
|
var DEFAULT_TIMEOUT_MS4 = 2000;
|
|
46306
|
-
var LEGACY_SOCKET_PATH2 =
|
|
46307
|
-
var OPERATOR_SOCKET_PATH2 =
|
|
46607
|
+
var LEGACY_SOCKET_PATH2 = join29(homedir11(), ".switchroom", "vault-broker.sock");
|
|
46608
|
+
var OPERATOR_SOCKET_PATH2 = join29(homedir11(), ".switchroom", "broker-operator", "sock");
|
|
46308
46609
|
function defaultBrokerSocketPath2() {
|
|
46309
|
-
if (
|
|
46310
|
-
|
|
46311
|
-
|
|
46610
|
+
if (fs2.existsSync(OPERATOR_SOCKET_PATH2))
|
|
46611
|
+
return OPERATOR_SOCKET_PATH2;
|
|
46612
|
+
if (isDockerRuntime())
|
|
46312
46613
|
return OPERATOR_SOCKET_PATH2;
|
|
46313
|
-
}
|
|
46314
46614
|
return LEGACY_SOCKET_PATH2;
|
|
46315
46615
|
}
|
|
46316
46616
|
function resolveBrokerSocketPath2(opts) {
|
|
@@ -46527,8 +46827,8 @@ function resolveVaultApprovalPosture(broker) {
|
|
|
46527
46827
|
}
|
|
46528
46828
|
|
|
46529
46829
|
// registry/turns-schema.ts
|
|
46530
|
-
import { chmodSync as chmodSync3, mkdirSync as
|
|
46531
|
-
import { join as
|
|
46830
|
+
import { chmodSync as chmodSync3, mkdirSync as mkdirSync17 } from "fs";
|
|
46831
|
+
import { join as join30 } from "path";
|
|
46532
46832
|
var DatabaseClass2 = null;
|
|
46533
46833
|
function loadDatabaseClass2() {
|
|
46534
46834
|
if (DatabaseClass2 != null)
|
|
@@ -46587,9 +46887,9 @@ function applySchema(db2) {
|
|
|
46587
46887
|
}
|
|
46588
46888
|
function openTurnsDb(agentDir) {
|
|
46589
46889
|
const Database = loadDatabaseClass2();
|
|
46590
|
-
const dir =
|
|
46591
|
-
|
|
46592
|
-
const path =
|
|
46890
|
+
const dir = join30(agentDir, "telegram");
|
|
46891
|
+
mkdirSync17(dir, { recursive: true, mode: 448 });
|
|
46892
|
+
const path = join30(dir, "registry.db");
|
|
46593
46893
|
const db2 = new Database(path, { create: true });
|
|
46594
46894
|
applySchema(db2);
|
|
46595
46895
|
try {
|
|
@@ -46728,11 +47028,11 @@ installGlobalErrorHandlers();
|
|
|
46728
47028
|
process.on("beforeExit", () => {
|
|
46729
47029
|
shutdownAnalytics();
|
|
46730
47030
|
});
|
|
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 =
|
|
47031
|
+
var STATE_DIR = process.env.TELEGRAM_STATE_DIR ?? join32(homedir12(), ".claude", "channels", "telegram");
|
|
47032
|
+
var ACCESS_FILE = join32(STATE_DIR, "access.json");
|
|
47033
|
+
var APPROVED_DIR = join32(STATE_DIR, "approved");
|
|
47034
|
+
var ENV_FILE = join32(STATE_DIR, ".env");
|
|
47035
|
+
var INBOX_DIR = join32(STATE_DIR, "inbox");
|
|
46736
47036
|
function triggerSelfRestart(targetAgent, reason, delayMs = 300) {
|
|
46737
47037
|
const isDocker = process.env.SWITCHROOM_RUNTIME === "docker";
|
|
46738
47038
|
const selfAgent = process.env.SWITCHROOM_AGENT_NAME;
|
|
@@ -46797,7 +47097,7 @@ function formatBootVersion() {
|
|
|
46797
47097
|
}
|
|
46798
47098
|
try {
|
|
46799
47099
|
chmodSync5(ENV_FILE, 384);
|
|
46800
|
-
for (const line of
|
|
47100
|
+
for (const line of readFileSync31(ENV_FILE, "utf8").split(`
|
|
46801
47101
|
`)) {
|
|
46802
47102
|
const m = line.match(/^(\w+)=(.*)$/);
|
|
46803
47103
|
if (m && process.env[m[1]] === undefined)
|
|
@@ -46850,7 +47150,7 @@ installTgPostLogger(bot);
|
|
|
46850
47150
|
var _rawSendMessageDraft = bot.api.raw.sendMessageDraft;
|
|
46851
47151
|
var GRAMMY_VERSION = (() => {
|
|
46852
47152
|
try {
|
|
46853
|
-
const raw =
|
|
47153
|
+
const raw = readFileSync31(new URL("../../node_modules/grammy/package.json", import.meta.url), "utf8");
|
|
46854
47154
|
return JSON.parse(raw).version ?? "unknown";
|
|
46855
47155
|
} catch {
|
|
46856
47156
|
return "unknown";
|
|
@@ -46923,7 +47223,7 @@ function assertSendable(f) {
|
|
|
46923
47223
|
} catch {
|
|
46924
47224
|
throw new Error(`refusing to send file \u2014 cannot resolve real path: ${f}`);
|
|
46925
47225
|
}
|
|
46926
|
-
const inbox =
|
|
47226
|
+
const inbox = join32(stateReal, "inbox");
|
|
46927
47227
|
if (real.startsWith(stateReal + sep3) && !real.startsWith(inbox + sep3)) {
|
|
46928
47228
|
throw new Error(`refusing to send channel state: ${f}`);
|
|
46929
47229
|
}
|
|
@@ -46942,7 +47242,7 @@ function assertSendable(f) {
|
|
|
46942
47242
|
}
|
|
46943
47243
|
function readAccessFile() {
|
|
46944
47244
|
try {
|
|
46945
|
-
const raw =
|
|
47245
|
+
const raw = readFileSync31(ACCESS_FILE, "utf8");
|
|
46946
47246
|
const parsed = JSON.parse(raw);
|
|
46947
47247
|
const allowFrom = validateStringArray("allowFrom", parsed.allowFrom ?? []);
|
|
46948
47248
|
const groups = {};
|
|
@@ -47007,7 +47307,7 @@ function assertAllowedChat(chat_id) {
|
|
|
47007
47307
|
function saveAccess(a) {
|
|
47008
47308
|
if (STATIC)
|
|
47009
47309
|
return;
|
|
47010
|
-
|
|
47310
|
+
mkdirSync21(STATE_DIR, { recursive: true, mode: 448 });
|
|
47011
47311
|
const tmp = ACCESS_FILE + ".tmp";
|
|
47012
47312
|
writeFileSync21(tmp, JSON.stringify(a, null, 2) + `
|
|
47013
47313
|
`, { mode: 384 });
|
|
@@ -47029,7 +47329,7 @@ var HISTORY_ENABLED = HISTORY_ACCESS.historyEnabled !== false;
|
|
|
47029
47329
|
if (HISTORY_ENABLED) {
|
|
47030
47330
|
try {
|
|
47031
47331
|
initHistory(STATE_DIR, HISTORY_ACCESS.historyRetentionDays ?? 30);
|
|
47032
|
-
process.stderr.write(`telegram gateway: history capture enabled at ${
|
|
47332
|
+
process.stderr.write(`telegram gateway: history capture enabled at ${join32(STATE_DIR, "history.db")}
|
|
47033
47333
|
`);
|
|
47034
47334
|
} catch (err) {
|
|
47035
47335
|
process.stderr.write(`telegram gateway: history init failed (${err.message}) \u2014 capture disabled
|
|
@@ -47046,10 +47346,10 @@ try {
|
|
|
47046
47346
|
process.stderr.write(`telegram gateway: turn-registry boot-reaper stamped ${reaped} orphaned turn(s) as ended_via='restart'
|
|
47047
47347
|
`);
|
|
47048
47348
|
} else {
|
|
47049
|
-
process.stderr.write(`telegram gateway: turn-registry initialized at ${
|
|
47349
|
+
process.stderr.write(`telegram gateway: turn-registry initialized at ${join32(agentDir, "telegram", "registry.db")}
|
|
47050
47350
|
`);
|
|
47051
47351
|
}
|
|
47052
|
-
const pendingEnvPath =
|
|
47352
|
+
const pendingEnvPath = join32(agentDir, ".pending-turn.env");
|
|
47053
47353
|
try {
|
|
47054
47354
|
const pending = findMostRecentInterruptedTurn(turnsDb);
|
|
47055
47355
|
if (pending != null) {
|
|
@@ -47069,7 +47369,7 @@ try {
|
|
|
47069
47369
|
renameSync12(pendingEnvTmp, pendingEnvPath);
|
|
47070
47370
|
process.stderr.write(`telegram gateway: pending-turn env written to ${pendingEnvPath} turnKey=${pending.turn_key} endedVia=${pending.ended_via ?? "open"}
|
|
47071
47371
|
`);
|
|
47072
|
-
} else if (
|
|
47372
|
+
} else if (existsSync33(pendingEnvPath)) {
|
|
47073
47373
|
rmSync4(pendingEnvPath, { force: true });
|
|
47074
47374
|
process.stderr.write(`telegram gateway: pending-turn env cleared (clean previous shutdown)
|
|
47075
47375
|
`);
|
|
@@ -47123,7 +47423,7 @@ function checkApprovals() {
|
|
|
47123
47423
|
return;
|
|
47124
47424
|
}
|
|
47125
47425
|
for (const senderId of files) {
|
|
47126
|
-
const file =
|
|
47426
|
+
const file = join32(APPROVED_DIR, senderId);
|
|
47127
47427
|
bot.api.sendMessage(senderId, "Paired! Say hi to Claude.").then(() => rmSync4(file, { force: true }), (err) => {
|
|
47128
47428
|
process.stderr.write(`telegram gateway: failed to send approval confirm: ${err}
|
|
47129
47429
|
`);
|
|
@@ -47769,11 +48069,11 @@ var unpinProgressCardForChat = null;
|
|
|
47769
48069
|
var getPinnedProgressCardMessageId = null;
|
|
47770
48070
|
var completeProgressCardTurn = null;
|
|
47771
48071
|
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 ??
|
|
48072
|
+
var SOCKET_PATH = process.env.SWITCHROOM_GATEWAY_SOCKET ?? join32(STATE_DIR, "gateway.sock");
|
|
48073
|
+
mkdirSync21(STATE_DIR, { recursive: true, mode: 448 });
|
|
48074
|
+
var GATEWAY_PID_PATH = process.env.SWITCHROOM_GATEWAY_PID_FILE ?? join32(STATE_DIR, "gateway.pid.json");
|
|
48075
|
+
var GATEWAY_SESSION_MARKER_PATH = process.env.SWITCHROOM_GATEWAY_SESSION_MARKER ?? join32(STATE_DIR, "gateway-session.json");
|
|
48076
|
+
var GATEWAY_CLEAN_SHUTDOWN_MARKER_PATH = process.env.SWITCHROOM_GATEWAY_CLEAN_SHUTDOWN_MARKER ?? join32(STATE_DIR, "clean-shutdown.json");
|
|
47777
48077
|
var GATEWAY_STARTED_AT_MS = Date.now();
|
|
47778
48078
|
var BOOT_CARD_ENABLED = process.env.SWITCHROOM_BOOT_CARD !== "false";
|
|
47779
48079
|
var activeBootCard = null;
|
|
@@ -47802,7 +48102,7 @@ function ensureIssuesCard(chatId, threadId) {
|
|
|
47802
48102
|
bot: botApi,
|
|
47803
48103
|
log: (msg) => process.stderr.write(`telegram gateway: ${msg}
|
|
47804
48104
|
`),
|
|
47805
|
-
persistPath:
|
|
48105
|
+
persistPath: join32(stateDir, "issues-card.json")
|
|
47806
48106
|
});
|
|
47807
48107
|
activeIssuesWatcher = startIssuesWatcher({
|
|
47808
48108
|
stateDir,
|
|
@@ -47960,6 +48260,13 @@ var ipcServer = createIpcServer({
|
|
|
47960
48260
|
const agentDisplayName = resolvePersonaName(agentSlug);
|
|
47961
48261
|
const botApiForCard = wrapBootCardApi(threadId);
|
|
47962
48262
|
bootCardPending = true;
|
|
48263
|
+
const updateOutcomeLine = (() => {
|
|
48264
|
+
try {
|
|
48265
|
+
return maybeRenderUpdateAnnouncement() ?? undefined;
|
|
48266
|
+
} catch {
|
|
48267
|
+
return;
|
|
48268
|
+
}
|
|
48269
|
+
})();
|
|
47963
48270
|
startBootCard(chatId, threadId, botApiForCard, {
|
|
47964
48271
|
agentName: agentDisplayName,
|
|
47965
48272
|
agentSlug,
|
|
@@ -47970,8 +48277,10 @@ var ipcServer = createIpcServer({
|
|
|
47970
48277
|
restartAgeMs: markerAgeMs,
|
|
47971
48278
|
restartReasonDetail: cleanMarker?.reason,
|
|
47972
48279
|
loadAccounts: () => loadAccountsForBootCard(agentSlug),
|
|
48280
|
+
probeQuotaViaBroker: (t) => probeQuotaForBootCard(agentSlug, t),
|
|
47973
48281
|
tmuxSupervisor: process.env.SWITCHROOM_TMUX_SUPERVISOR === "1",
|
|
47974
|
-
dockerMode: process.env.SWITCHROOM_RUNTIME === "docker"
|
|
48282
|
+
dockerMode: process.env.SWITCHROOM_RUNTIME === "docker",
|
|
48283
|
+
...updateOutcomeLine ? { updateOutcomeLine } : {}
|
|
47975
48284
|
}, ackMsgId).then((handle) => {
|
|
47976
48285
|
activeBootCard = handle;
|
|
47977
48286
|
}).catch((err) => {
|
|
@@ -48466,6 +48775,17 @@ ${url}`;
|
|
|
48466
48775
|
previewMessageId = null;
|
|
48467
48776
|
}
|
|
48468
48777
|
}
|
|
48778
|
+
const sendChunkPlainText = async (opts) => {
|
|
48779
|
+
const plainOpts = { ...opts };
|
|
48780
|
+
delete plainOpts.parse_mode;
|
|
48781
|
+
const stripped = telegramHtmlToPlainText(chunks[i]);
|
|
48782
|
+
const plain = stripped.length > 0 ? stripped : "\u26A0\uFE0F (a formatted fragment could not be rendered for Telegram)";
|
|
48783
|
+
const sent = await lockedBot.api.sendMessage(chat_id, plain, plainOpts);
|
|
48784
|
+
sentIds.push(sent.message_id);
|
|
48785
|
+
logOutbound("reply", chat_id, sent.message_id, plain.length, `chunk=${i + 1}/${chunks.length} plaintext-fallback`);
|
|
48786
|
+
process.stderr.write(`telegram gateway: HTML parse-reject \u2014 resent chunk ${i + 1}/${chunks.length} as plain text
|
|
48787
|
+
`);
|
|
48788
|
+
};
|
|
48469
48789
|
try {
|
|
48470
48790
|
const sent = await robustApiCall(() => lockedBot.api.sendMessage(chat_id, chunks[i], sendOpts), { threadId, chat_id });
|
|
48471
48791
|
sentIds.push(sent.message_id);
|
|
@@ -48475,8 +48795,17 @@ ${url}`;
|
|
|
48475
48795
|
threadId = undefined;
|
|
48476
48796
|
const retryOpts = { ...sendOpts };
|
|
48477
48797
|
delete retryOpts.message_thread_id;
|
|
48478
|
-
|
|
48479
|
-
|
|
48798
|
+
try {
|
|
48799
|
+
const sent = await lockedBot.api.sendMessage(chat_id, chunks[i], retryOpts);
|
|
48800
|
+
sentIds.push(sent.message_id);
|
|
48801
|
+
} catch (retryErr) {
|
|
48802
|
+
if (isHtmlParseRejectError(retryErr))
|
|
48803
|
+
await sendChunkPlainText(retryOpts);
|
|
48804
|
+
else
|
|
48805
|
+
throw retryErr;
|
|
48806
|
+
}
|
|
48807
|
+
} else if (isHtmlParseRejectError(err)) {
|
|
48808
|
+
await sendChunkPlainText(sendOpts);
|
|
48480
48809
|
} else {
|
|
48481
48810
|
throw err;
|
|
48482
48811
|
}
|
|
@@ -48936,11 +49265,11 @@ async function executeSendGif(rawArgs) {
|
|
|
48936
49265
|
};
|
|
48937
49266
|
}
|
|
48938
49267
|
async function publishToTelegraph(text, shortName, authorName) {
|
|
48939
|
-
const accountPath =
|
|
49268
|
+
const accountPath = join32(STATE_DIR, "telegraph-account.json");
|
|
48940
49269
|
let account = null;
|
|
48941
49270
|
try {
|
|
48942
|
-
if (
|
|
48943
|
-
const raw =
|
|
49271
|
+
if (existsSync33(accountPath)) {
|
|
49272
|
+
const raw = readFileSync31(accountPath, "utf-8");
|
|
48944
49273
|
const parsed = JSON.parse(raw);
|
|
48945
49274
|
if (parsed.shortName && parsed.accessToken) {
|
|
48946
49275
|
account = parsed;
|
|
@@ -48959,7 +49288,7 @@ async function publishToTelegraph(text, shortName, authorName) {
|
|
|
48959
49288
|
}
|
|
48960
49289
|
account = created.value;
|
|
48961
49290
|
try {
|
|
48962
|
-
|
|
49291
|
+
mkdirSync21(STATE_DIR, { recursive: true, mode: 448 });
|
|
48963
49292
|
writeFileSync21(accountPath, JSON.stringify(account, null, 2), { mode: 384 });
|
|
48964
49293
|
} catch (err) {
|
|
48965
49294
|
process.stderr.write(`telegram gateway: telegraph cache write failed: ${err.message}
|
|
@@ -49185,7 +49514,7 @@ async function executeDownloadAttachment(args) {
|
|
|
49185
49514
|
fileUniqueId: file.file_unique_id,
|
|
49186
49515
|
now: Date.now()
|
|
49187
49516
|
});
|
|
49188
|
-
|
|
49517
|
+
mkdirSync21(INBOX_DIR, { recursive: true, mode: 448 });
|
|
49189
49518
|
assertInsideInbox(INBOX_DIR, dlPath);
|
|
49190
49519
|
writeFileSync21(dlPath, buf, { mode: 384 });
|
|
49191
49520
|
return { content: [{ type: "text", text: dlPath }] };
|
|
@@ -50777,7 +51106,7 @@ function restartMarkerPath() {
|
|
|
50777
51106
|
const agentDir = resolveAgentDirFromEnv();
|
|
50778
51107
|
if (!agentDir)
|
|
50779
51108
|
return null;
|
|
50780
|
-
return
|
|
51109
|
+
return join32(agentDir, "restart-pending.json");
|
|
50781
51110
|
}
|
|
50782
51111
|
function writeRestartMarker(marker) {
|
|
50783
51112
|
const p = restartMarkerPath();
|
|
@@ -50803,7 +51132,7 @@ function readRestartMarker() {
|
|
|
50803
51132
|
if (!p)
|
|
50804
51133
|
return null;
|
|
50805
51134
|
try {
|
|
50806
|
-
return JSON.parse(
|
|
51135
|
+
return JSON.parse(readFileSync31(p, "utf8"));
|
|
50807
51136
|
} catch {
|
|
50808
51137
|
return null;
|
|
50809
51138
|
}
|
|
@@ -50872,7 +51201,7 @@ var _dockerReachable;
|
|
|
50872
51201
|
function isDockerReachable() {
|
|
50873
51202
|
if (_dockerReachable !== undefined)
|
|
50874
51203
|
return _dockerReachable;
|
|
50875
|
-
if (!
|
|
51204
|
+
if (!existsSync33("/var/run/docker.sock")) {
|
|
50876
51205
|
_dockerReachable = false;
|
|
50877
51206
|
return _dockerReachable;
|
|
50878
51207
|
}
|
|
@@ -50889,11 +51218,11 @@ function _resetDockerReachableCache() {
|
|
|
50889
51218
|
}
|
|
50890
51219
|
function spawnSwitchroomDetached(args, onFailure) {
|
|
50891
51220
|
const fullArgs = SWITCHROOM_CONFIG ? ["--config", SWITCHROOM_CONFIG, ...args] : args;
|
|
50892
|
-
const logPath =
|
|
51221
|
+
const logPath = join32(STATE_DIR, "detached-spawn.log");
|
|
50893
51222
|
let outFd = null;
|
|
50894
51223
|
try {
|
|
50895
|
-
|
|
50896
|
-
outFd =
|
|
51224
|
+
mkdirSync21(STATE_DIR, { recursive: true });
|
|
51225
|
+
outFd = openSync8(logPath, "a");
|
|
50897
51226
|
writeFileSync21(logPath, `
|
|
50898
51227
|
[${new Date().toISOString()}] spawn ${SWITCHROOM_CLI} ${fullArgs.join(" ")}
|
|
50899
51228
|
`, { flag: "a" });
|
|
@@ -50908,7 +51237,7 @@ function spawnSwitchroomDetached(args, onFailure) {
|
|
|
50908
51237
|
});
|
|
50909
51238
|
if (outFd != null) {
|
|
50910
51239
|
try {
|
|
50911
|
-
|
|
51240
|
+
closeSync8(outFd);
|
|
50912
51241
|
} catch {}
|
|
50913
51242
|
}
|
|
50914
51243
|
if (onFailure) {
|
|
@@ -50920,7 +51249,7 @@ function spawnSwitchroomDetached(args, onFailure) {
|
|
|
50920
51249
|
return;
|
|
50921
51250
|
let tail = "";
|
|
50922
51251
|
try {
|
|
50923
|
-
const full =
|
|
51252
|
+
const full = readFileSync31(logPath, "utf8");
|
|
50924
51253
|
tail = full.split(`
|
|
50925
51254
|
`).slice(-30).join(`
|
|
50926
51255
|
`).trim();
|
|
@@ -51235,27 +51564,37 @@ ${preBlock(formatSwitchroomOutput(detail))}`, { html: true });
|
|
|
51235
51564
|
}
|
|
51236
51565
|
}
|
|
51237
51566
|
bot.use(async (ctx, next) => {
|
|
51238
|
-
if (
|
|
51567
|
+
if (ctx.message?.text) {
|
|
51239
51568
|
const myName = getMyAgentName();
|
|
51240
51569
|
const decision = classifyAdminGate(ctx.message.text, myName);
|
|
51241
51570
|
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
51571
|
const cmdHtml = escapeHtmlForTg(`/${decision.cmd}`);
|
|
51245
51572
|
const nameHtml = escapeHtmlForTg(myName);
|
|
51246
|
-
const
|
|
51247
|
-
|
|
51248
|
-
|
|
51573
|
+
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.`;
|
|
51574
|
+
if (!AGENT_ADMIN) {
|
|
51575
|
+
process.stderr.write(`telegram gateway: admin-gate blocked cmd=/${decision.cmd} agent=${process.env.SWITCHROOM_AGENT_NAME ?? "-"} reason=${decision.reason} (AGENT_ADMIN=false)
|
|
51576
|
+
`);
|
|
51577
|
+
await switchroomReply(ctx, notFlagged, { html: true });
|
|
51578
|
+
return;
|
|
51579
|
+
}
|
|
51580
|
+
const senderId = String(ctx.from?.id ?? "");
|
|
51581
|
+
const operatorPrivate = ctx.chat?.type === "private" && loadAccess().allowFrom.includes(senderId);
|
|
51582
|
+
if (!operatorPrivate) {
|
|
51583
|
+
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}
|
|
51584
|
+
`);
|
|
51585
|
+
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 });
|
|
51586
|
+
return;
|
|
51587
|
+
}
|
|
51249
51588
|
}
|
|
51250
51589
|
}
|
|
51251
51590
|
await next();
|
|
51252
51591
|
});
|
|
51253
51592
|
function readRecentDenialsForAgent(agentName3, windowMs, limit) {
|
|
51254
51593
|
try {
|
|
51255
|
-
const auditPath =
|
|
51256
|
-
if (!
|
|
51594
|
+
const auditPath = join32(homedir12(), ".switchroom", "vault-audit.log");
|
|
51595
|
+
if (!existsSync33(auditPath))
|
|
51257
51596
|
return [];
|
|
51258
|
-
const raw =
|
|
51597
|
+
const raw = readFileSync31(auditPath, "utf8");
|
|
51259
51598
|
return recentDenialsFromAuditLog(raw, { agentName: agentName3, windowMs, limit });
|
|
51260
51599
|
} catch {
|
|
51261
51600
|
return [];
|
|
@@ -51306,7 +51645,7 @@ async function buildAgentMetadata(agentName3) {
|
|
|
51306
51645
|
try {
|
|
51307
51646
|
const agentDir = resolveAgentDirFromEnv();
|
|
51308
51647
|
if (agentDir) {
|
|
51309
|
-
const raw =
|
|
51648
|
+
const raw = readFileSync31(join32(agentDir, ".claude", ".claude.json"), "utf8");
|
|
51310
51649
|
claudeJson = JSON.parse(raw);
|
|
51311
51650
|
}
|
|
51312
51651
|
} catch {}
|
|
@@ -51335,7 +51674,8 @@ async function buildLiveProbeRows(agentName3) {
|
|
|
51335
51674
|
agentDir,
|
|
51336
51675
|
gatewayInfo: { pid: process.pid, startedAtMs: GATEWAY_STARTED_AT_MS },
|
|
51337
51676
|
tmuxSupervisor: process.env.SWITCHROOM_TMUX_SUPERVISOR === "1",
|
|
51338
|
-
dockerMode: process.env.SWITCHROOM_RUNTIME === "docker"
|
|
51677
|
+
dockerMode: process.env.SWITCHROOM_RUNTIME === "docker",
|
|
51678
|
+
probeQuotaViaBroker: (t) => probeQuotaForBootCard(agentName3, t)
|
|
51339
51679
|
});
|
|
51340
51680
|
const rows = [];
|
|
51341
51681
|
const order = [
|
|
@@ -51519,9 +51859,9 @@ bot.command("restart", async (ctx) => {
|
|
|
51519
51859
|
function flushAgentHandoff(agentDir) {
|
|
51520
51860
|
let removed = 0;
|
|
51521
51861
|
for (const fname of [".handoff.md", ".handoff-topic"]) {
|
|
51522
|
-
const p =
|
|
51862
|
+
const p = join32(agentDir, fname);
|
|
51523
51863
|
try {
|
|
51524
|
-
if (
|
|
51864
|
+
if (existsSync33(p)) {
|
|
51525
51865
|
unlinkSync14(p);
|
|
51526
51866
|
removed++;
|
|
51527
51867
|
}
|
|
@@ -51577,7 +51917,7 @@ async function handleNewOrResetCommand(ctx, kind) {
|
|
|
51577
51917
|
writeRestartMarker({ chat_id: chatId, thread_id: threadId ?? null, ack_message_id: ackId, ts: Date.now() });
|
|
51578
51918
|
if (agentDir != null) {
|
|
51579
51919
|
try {
|
|
51580
|
-
writeFileSync21(
|
|
51920
|
+
writeFileSync21(join32(agentDir, ".force-fresh-session"), `${kind} at ${new Date().toISOString()}
|
|
51581
51921
|
`, "utf8");
|
|
51582
51922
|
} catch (err) {
|
|
51583
51923
|
process.stderr.write(`telegram gateway: failed to write force-fresh marker: ${err}
|
|
@@ -51746,7 +52086,7 @@ bot.command("audit", async (ctx) => {
|
|
|
51746
52086
|
return;
|
|
51747
52087
|
const arg = (ctx.match ?? "").trim();
|
|
51748
52088
|
if (arg === "" || arg === "help" || arg === "--help") {
|
|
51749
|
-
await switchroomReply(ctx, "Usage: <code>/audit hostd [--tail N] [--agent <name>] [--op <verb>] [--error]</code>", { html: true });
|
|
52089
|
+
await switchroomReply(ctx, "Usage: <code>/audit hostd [--tail N] [--agent <name>] [--op <verb>] [--error] [--verbose]</code>", { html: true });
|
|
51750
52090
|
return;
|
|
51751
52091
|
}
|
|
51752
52092
|
const tokens = arg.split(/\s+/);
|
|
@@ -51775,6 +52115,10 @@ bot.command("audit", async (ctx) => {
|
|
|
51775
52115
|
argv.push("--error");
|
|
51776
52116
|
continue;
|
|
51777
52117
|
}
|
|
52118
|
+
if (t === "--verbose") {
|
|
52119
|
+
argv.push("--verbose");
|
|
52120
|
+
continue;
|
|
52121
|
+
}
|
|
51778
52122
|
if (t === "--tail" || t === "--agent" || t === "--op") {
|
|
51779
52123
|
const v = tokens[++i];
|
|
51780
52124
|
if (v == null) {
|
|
@@ -51796,7 +52140,7 @@ bot.command("audit", async (ctx) => {
|
|
|
51796
52140
|
argv.push(t, v);
|
|
51797
52141
|
continue;
|
|
51798
52142
|
}
|
|
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 });
|
|
52143
|
+
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
52144
|
return;
|
|
51801
52145
|
}
|
|
51802
52146
|
await runSwitchroomCommand(ctx, argv, `hostd audit${argv.length > 2 ? " \u2026" : ""}`);
|
|
@@ -51917,16 +52261,16 @@ bot.command("interrupt", async (ctx) => {
|
|
|
51917
52261
|
await runSwitchroomCommand(ctx, ["agent", "interrupt", name], `interrupt ${name}`);
|
|
51918
52262
|
});
|
|
51919
52263
|
var lockoutOps = {
|
|
51920
|
-
readFileSync: (p, enc) =>
|
|
52264
|
+
readFileSync: (p, enc) => readFileSync31(p, enc),
|
|
51921
52265
|
writeFileSync: (p, data, opts) => writeFileSync21(p, data, opts),
|
|
51922
|
-
existsSync: (p) =>
|
|
51923
|
-
mkdirSync: (p, opts) =>
|
|
51924
|
-
joinPath: (...parts) =>
|
|
52266
|
+
existsSync: (p) => existsSync33(p),
|
|
52267
|
+
mkdirSync: (p, opts) => mkdirSync21(p, opts),
|
|
52268
|
+
joinPath: (...parts) => join32(...parts)
|
|
51925
52269
|
};
|
|
51926
52270
|
var FLEET_FALLBACK_DEDUP_MS = 30000;
|
|
51927
52271
|
function isAuthBrokerSocketReachable() {
|
|
51928
52272
|
try {
|
|
51929
|
-
return
|
|
52273
|
+
return existsSync33(resolveAuthBrokerSocketPath2());
|
|
51930
52274
|
} catch {
|
|
51931
52275
|
return false;
|
|
51932
52276
|
}
|
|
@@ -51987,7 +52331,7 @@ async function runCreditWatch() {
|
|
|
51987
52331
|
if (!agentDir)
|
|
51988
52332
|
return;
|
|
51989
52333
|
const agentName3 = getMyAgentName();
|
|
51990
|
-
const claudeConfigDir =
|
|
52334
|
+
const claudeConfigDir = join32(agentDir, ".claude");
|
|
51991
52335
|
const stateDir = STATE_DIR;
|
|
51992
52336
|
const reason = readClaudeJsonOverage(claudeConfigDir);
|
|
51993
52337
|
const prev = loadCreditState(stateDir);
|
|
@@ -52015,8 +52359,16 @@ async function runCreditWatch() {
|
|
|
52015
52359
|
}
|
|
52016
52360
|
}
|
|
52017
52361
|
bot.command("auth", async (ctx) => {
|
|
52018
|
-
|
|
52362
|
+
const authSenderId = String(ctx.from?.id ?? "");
|
|
52363
|
+
const authOperatorPrivate = ctx.chat?.type === "private" && loadAccess().allowFrom.includes(authSenderId);
|
|
52364
|
+
if (!authOperatorPrivate) {
|
|
52365
|
+
if (ctx.chat?.type !== "private") {
|
|
52366
|
+
process.stderr.write(`telegram gateway: /auth refused (not operator-private) agent=${process.env.SWITCHROOM_AGENT_NAME ?? "-"} chat=${ctx.chat?.type ?? "?"} sender=${authSenderId}
|
|
52367
|
+
`);
|
|
52368
|
+
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(() => {});
|
|
52369
|
+
}
|
|
52019
52370
|
return;
|
|
52371
|
+
}
|
|
52020
52372
|
const text = ctx.message?.text ?? "";
|
|
52021
52373
|
const parsed = parseAuthCommand(text);
|
|
52022
52374
|
if (!parsed)
|
|
@@ -52133,6 +52485,24 @@ async function loadAccountsForBootCard(agent) {
|
|
|
52133
52485
|
return null;
|
|
52134
52486
|
}
|
|
52135
52487
|
}
|
|
52488
|
+
async function probeQuotaForBootCard(agent, timeoutMs) {
|
|
52489
|
+
try {
|
|
52490
|
+
const client3 = await getAuthBrokerClient(agent);
|
|
52491
|
+
if (!client3)
|
|
52492
|
+
return null;
|
|
52493
|
+
const state3 = await client3.listState();
|
|
52494
|
+
const entry = state3.agents.find((a) => a.name === agent);
|
|
52495
|
+
const label = entry?.override ?? entry?.account ?? state3.active;
|
|
52496
|
+
if (!label)
|
|
52497
|
+
return null;
|
|
52498
|
+
const { results } = await client3.probeQuota([label], timeoutMs);
|
|
52499
|
+
return results.find((r) => r.label === label)?.result ?? null;
|
|
52500
|
+
} catch (err) {
|
|
52501
|
+
process.stderr.write(`telegram gateway: boot-card quota probe failed: ${err?.message ?? String(err)}
|
|
52502
|
+
`);
|
|
52503
|
+
return null;
|
|
52504
|
+
}
|
|
52505
|
+
}
|
|
52136
52506
|
async function handleVaultRecentDenialCallback(ctx, data) {
|
|
52137
52507
|
const senderId = String(ctx.from?.id ?? "");
|
|
52138
52508
|
const access = loadAccess();
|
|
@@ -52170,9 +52540,9 @@ async function handleVaultRecentDenialCallback(ctx, data) {
|
|
|
52170
52540
|
return;
|
|
52171
52541
|
}
|
|
52172
52542
|
const { token, id } = result;
|
|
52173
|
-
const tokenPath =
|
|
52543
|
+
const tokenPath = join32(homedir12(), ".switchroom", "agents", agentName3, ".vault-token");
|
|
52174
52544
|
try {
|
|
52175
|
-
|
|
52545
|
+
mkdirSync21(join32(homedir12(), ".switchroom", "agents", agentName3), { recursive: true });
|
|
52176
52546
|
writeFileSync21(tokenPath, token, { mode: 384 });
|
|
52177
52547
|
} catch (err) {
|
|
52178
52548
|
await switchroomReply(ctx, `<b>Grant created (${escapeHtmlForTg(id)}) but token write failed:</b> ${escapeHtmlForTg(String(err))}
|
|
@@ -52237,9 +52607,9 @@ async function performVaultAccessApproval(ctx, pending, stageId, senderId, attes
|
|
|
52237
52607
|
return;
|
|
52238
52608
|
}
|
|
52239
52609
|
const { token, id } = result;
|
|
52240
|
-
const tokenPath =
|
|
52610
|
+
const tokenPath = join32(homedir12(), ".switchroom", "agents", pending.agent, ".vault-token");
|
|
52241
52611
|
try {
|
|
52242
|
-
|
|
52612
|
+
mkdirSync21(join32(homedir12(), ".switchroom", "agents", pending.agent), { recursive: true });
|
|
52243
52613
|
writeFileSync21(tokenPath, token, { mode: 384 });
|
|
52244
52614
|
} catch (err) {
|
|
52245
52615
|
await switchroomReply(ctx, `<b>Grant created (${escapeHtmlForTg(id)}) but token write failed:</b> ${escapeHtmlForTg(String(err))}
|
|
@@ -52667,9 +53037,9 @@ async function executeGrantWizard(ctx, chatId, state3) {
|
|
|
52667
53037
|
return;
|
|
52668
53038
|
}
|
|
52669
53039
|
const { token, id } = result;
|
|
52670
|
-
const tokenPath =
|
|
53040
|
+
const tokenPath = join32(homedir12(), ".switchroom", "agents", state3.agent, ".vault-token");
|
|
52671
53041
|
try {
|
|
52672
|
-
|
|
53042
|
+
mkdirSync21(join32(homedir12(), ".switchroom", "agents", state3.agent), { recursive: true });
|
|
52673
53043
|
writeFileSync21(tokenPath, token, { mode: 384 });
|
|
52674
53044
|
} catch (err) {
|
|
52675
53045
|
await switchroomReply(ctx, `<b>Grant created but token write failed:</b> ${escapeHtmlForTg(String(err))}`, { html: true });
|
|
@@ -53526,7 +53896,7 @@ bot.command("usage", async (ctx) => {
|
|
|
53526
53896
|
await switchroomReply(ctx, "<b>/usage:</b> cannot resolve agent dir.", { html: true });
|
|
53527
53897
|
return;
|
|
53528
53898
|
}
|
|
53529
|
-
const result = await fetchQuota2({ claudeConfigDir:
|
|
53899
|
+
const result = await fetchQuota2({ claudeConfigDir: join32(agentDir, ".claude") });
|
|
53530
53900
|
if (!result.ok) {
|
|
53531
53901
|
await switchroomReply(ctx, `<b>/usage:</b> ${escapeHtmlForTg(result.reason)}`, { html: true });
|
|
53532
53902
|
return;
|
|
@@ -53656,6 +54026,12 @@ bot.on("callback_query:data", async (ctx) => {
|
|
|
53656
54026
|
return;
|
|
53657
54027
|
}
|
|
53658
54028
|
if (data.startsWith("apv:")) {
|
|
54029
|
+
const access2 = loadAccess();
|
|
54030
|
+
const senderId2 = String(ctx.from?.id ?? "");
|
|
54031
|
+
if (!access2.allowFrom.includes(senderId2)) {
|
|
54032
|
+
await ctx.answerCallbackQuery({ text: "Not authorized." });
|
|
54033
|
+
return;
|
|
54034
|
+
}
|
|
53659
54035
|
const { handleApprovalCallback: handleApprovalCallback2 } = await Promise.resolve().then(() => (init_approval_callback(), exports_approval_callback));
|
|
53660
54036
|
await handleApprovalCallback2(ctx, data);
|
|
53661
54037
|
return;
|
|
@@ -53937,7 +54313,7 @@ bot.on("message:photo", async (ctx) => {
|
|
|
53937
54313
|
fileUniqueId: best.file_unique_id,
|
|
53938
54314
|
now: Date.now()
|
|
53939
54315
|
});
|
|
53940
|
-
|
|
54316
|
+
mkdirSync21(INBOX_DIR, { recursive: true, mode: 448 });
|
|
53941
54317
|
assertInsideInbox(INBOX_DIR, dlPath);
|
|
53942
54318
|
writeFileSync21(dlPath, buf, { mode: 384 });
|
|
53943
54319
|
return dlPath;
|
|
@@ -53979,8 +54355,8 @@ async function maybeTranscribeVoice(fileId, mimeType, language) {
|
|
|
53979
54355
|
let apiKey = null;
|
|
53980
54356
|
try {
|
|
53981
54357
|
const path = __require("path").join(__require("os").homedir(), ".switchroom", "openai-api-key");
|
|
53982
|
-
if (
|
|
53983
|
-
apiKey =
|
|
54358
|
+
if (existsSync33(path)) {
|
|
54359
|
+
apiKey = readFileSync31(path, "utf-8").trim();
|
|
53984
54360
|
}
|
|
53985
54361
|
} catch (err) {
|
|
53986
54362
|
process.stderr.write(`telegram gateway: voice-in: failed to read api key: ${err.message}
|
|
@@ -54823,18 +55199,27 @@ var didOneTimeSetup = false;
|
|
|
54823
55199
|
const botApiForCard = wrapBootCardApi(threadId);
|
|
54824
55200
|
bootCardPending = true;
|
|
54825
55201
|
try {
|
|
55202
|
+
const updateOutcomeLine = (() => {
|
|
55203
|
+
try {
|
|
55204
|
+
return maybeRenderUpdateAnnouncement() ?? undefined;
|
|
55205
|
+
} catch {
|
|
55206
|
+
return;
|
|
55207
|
+
}
|
|
55208
|
+
})();
|
|
54826
55209
|
const handle = await startBootCard(chatId, threadId, botApiForCard, {
|
|
54827
55210
|
agentName: agentDisplayName,
|
|
54828
55211
|
agentSlug,
|
|
54829
55212
|
version: formatBootVersion(),
|
|
54830
|
-
agentDir: agentDir ??
|
|
55213
|
+
agentDir: agentDir ?? join32(homedir12(), ".switchroom", "agents", agentSlug),
|
|
54831
55214
|
gatewayInfo: { pid: process.pid, startedAtMs: GATEWAY_STARTED_AT_MS },
|
|
54832
55215
|
restartReason: reason,
|
|
54833
55216
|
restartAgeMs: markerAgeMs,
|
|
54834
55217
|
restartReasonDetail: cleanMarker?.reason,
|
|
54835
55218
|
loadAccounts: () => loadAccountsForBootCard(agentSlug),
|
|
55219
|
+
probeQuotaViaBroker: (t) => probeQuotaForBootCard(agentSlug, t),
|
|
54836
55220
|
tmuxSupervisor: process.env.SWITCHROOM_TMUX_SUPERVISOR === "1",
|
|
54837
|
-
dockerMode: process.env.SWITCHROOM_RUNTIME === "docker"
|
|
55221
|
+
dockerMode: process.env.SWITCHROOM_RUNTIME === "docker",
|
|
55222
|
+
...updateOutcomeLine ? { updateOutcomeLine } : {}
|
|
54838
55223
|
}, ackMsgId);
|
|
54839
55224
|
activeBootCard = handle;
|
|
54840
55225
|
} catch (err) {
|