switchroom 0.13.55 → 0.13.57
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent-scheduler/index.js +80 -80
- package/dist/auth-broker/index.js +80 -80
- package/dist/cli/ack-first-pretool.mjs +75 -0
- package/dist/cli/drive-write-pretool.mjs +10 -10
- package/dist/cli/notion-write-pretool.mjs +90 -84
- package/dist/cli/skill-validate-pretool.mjs +72 -72
- package/dist/cli/switchroom.js +367 -358
- package/dist/host-control/main.js +148 -148
- package/dist/vault/approvals/kernel-server.js +82 -82
- package/dist/vault/broker/server.js +83 -83
- package/package.json +1 -1
- package/skills/notion/SKILL.md +13 -9
- package/telegram-plugin/ack-flag.ts +66 -0
- package/telegram-plugin/dist/bridge/bridge.js +112 -112
- package/telegram-plugin/dist/gateway/gateway.js +991 -601
- package/telegram-plugin/dist/server.js +160 -160
- package/telegram-plugin/gateway/gateway.ts +151 -1
- package/telegram-plugin/runtime-metrics.ts +17 -0
- package/telegram-plugin/silence-poke.ts +82 -0
- package/telegram-plugin/tests/ack-flag.test.ts +65 -0
- package/telegram-plugin/tests/post-fallback-outbound-count.test.ts +78 -0
- package/telegram-plugin/tests/silence-poke.test.ts +117 -7
- package/telegram-plugin/tests/tool-intent-surface.test.ts +128 -0
- package/telegram-plugin/tool-intent-surface.ts +155 -0
|
@@ -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-sec-1417/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-sec-1417/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-sec-1417/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-sec-1417/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-sec-1417/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-sec-1417/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-sec-1417/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-sec-1417/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-sec-1417/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-sec-1417/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-sec-1417/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-sec-1417/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-sec-1417/node_modules/.bun/@grammyjs+types@3.26.0/node_modules/@grammyjs/types/mod.js
|
|
2453
2453
|
var exports_mod = {};
|
|
2454
2454
|
|
|
2455
|
-
//
|
|
2455
|
+
// ../../switchroom-sec-1417/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-sec-1417/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-sec-1417/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-sec-1417/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-sec-1417/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-sec-1417/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-sec-1417/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-sec-1417/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-sec-1417/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-sec-1417/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-sec-1417/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-sec-1417/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-sec-1417/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-sec-1417/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-sec-1417/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-sec-1417/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-sec-1417/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-sec-1417/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-sec-1417/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-sec-1417/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-sec-1417/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-sec-1417/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-sec-1417/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-sec-1417/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-sec-1417/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-sec-1417/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-sec-1417/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-sec-1417/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-sec-1417/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-sec-1417/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-sec-1417/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-sec-1417/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-sec-1417/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-sec-1417/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-sec-1417/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-sec-1417/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-sec-1417/node_modules/.bun/zod@3.25.76/node_modules/zod/v3/helpers/typeAliases.js
|
|
12600
12600
|
var init_typeAliases = () => {};
|
|
12601
12601
|
|
|
12602
|
-
//
|
|
12602
|
+
// ../../switchroom-sec-1417/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-sec-1417/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-sec-1417/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-sec-1417/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();
|
|
@@ -16334,10 +16334,10 @@ __export(exports_client, {
|
|
|
16334
16334
|
AuthBrokerClient: () => AuthBrokerClient
|
|
16335
16335
|
});
|
|
16336
16336
|
import * as net from "node:net";
|
|
16337
|
-
import { existsSync as
|
|
16337
|
+
import { existsSync as existsSync7 } from "node:fs";
|
|
16338
16338
|
import { homedir as homedir3 } from "node:os";
|
|
16339
16339
|
import { randomUUID as randomUUID3 } from "node:crypto";
|
|
16340
|
-
import { join as
|
|
16340
|
+
import { join as join9 } from "node:path";
|
|
16341
16341
|
function reviveDate(v) {
|
|
16342
16342
|
if (v == null)
|
|
16343
16343
|
return null;
|
|
@@ -16347,7 +16347,7 @@ function reviveDate(v) {
|
|
|
16347
16347
|
return Number.isNaN(d.getTime()) ? null : d;
|
|
16348
16348
|
}
|
|
16349
16349
|
function operatorSocketPath(home = homedir3()) {
|
|
16350
|
-
return
|
|
16350
|
+
return join9(home, ".switchroom", "state", "auth-broker-operator", "sock");
|
|
16351
16351
|
}
|
|
16352
16352
|
function resolveAuthBrokerSocketPath(opts) {
|
|
16353
16353
|
if (opts?.socket)
|
|
@@ -16617,7 +16617,7 @@ async function withAuthBrokerClient(fn, opts) {
|
|
|
16617
16617
|
}
|
|
16618
16618
|
}
|
|
16619
16619
|
function authBrokerSocketExists(opts) {
|
|
16620
|
-
return
|
|
16620
|
+
return existsSync7(resolveAuthBrokerSocketPath(opts));
|
|
16621
16621
|
}
|
|
16622
16622
|
var DEFAULT_TIMEOUT_MS = 5000, AuthBrokerError, AuthBrokerUnreachableError;
|
|
16623
16623
|
var init_client = __esm(() => {
|
|
@@ -16642,7 +16642,7 @@ var init_client = __esm(() => {
|
|
|
16642
16642
|
};
|
|
16643
16643
|
});
|
|
16644
16644
|
|
|
16645
|
-
//
|
|
16645
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/nodes/identity.js
|
|
16646
16646
|
var require_identity = __commonJS((exports2) => {
|
|
16647
16647
|
var ALIAS = Symbol.for("yaml.alias");
|
|
16648
16648
|
var DOC = Symbol.for("yaml.document");
|
|
@@ -16696,7 +16696,7 @@ var require_identity = __commonJS((exports2) => {
|
|
|
16696
16696
|
exports2.isSeq = isSeq;
|
|
16697
16697
|
});
|
|
16698
16698
|
|
|
16699
|
-
//
|
|
16699
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/visit.js
|
|
16700
16700
|
var require_visit = __commonJS((exports2) => {
|
|
16701
16701
|
var identity = require_identity();
|
|
16702
16702
|
var BREAK = Symbol("break visit");
|
|
@@ -16851,7 +16851,7 @@ var require_visit = __commonJS((exports2) => {
|
|
|
16851
16851
|
exports2.visitAsync = visitAsync;
|
|
16852
16852
|
});
|
|
16853
16853
|
|
|
16854
|
-
//
|
|
16854
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/doc/directives.js
|
|
16855
16855
|
var require_directives = __commonJS((exports2) => {
|
|
16856
16856
|
var identity = require_identity();
|
|
16857
16857
|
var visit = require_visit();
|
|
@@ -17003,7 +17003,7 @@ var require_directives = __commonJS((exports2) => {
|
|
|
17003
17003
|
exports2.Directives = Directives;
|
|
17004
17004
|
});
|
|
17005
17005
|
|
|
17006
|
-
//
|
|
17006
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/doc/anchors.js
|
|
17007
17007
|
var require_anchors = __commonJS((exports2) => {
|
|
17008
17008
|
var identity = require_identity();
|
|
17009
17009
|
var visit = require_visit();
|
|
@@ -17065,7 +17065,7 @@ var require_anchors = __commonJS((exports2) => {
|
|
|
17065
17065
|
exports2.findNewAnchor = findNewAnchor;
|
|
17066
17066
|
});
|
|
17067
17067
|
|
|
17068
|
-
//
|
|
17068
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/doc/applyReviver.js
|
|
17069
17069
|
var require_applyReviver = __commonJS((exports2) => {
|
|
17070
17070
|
function applyReviver(reviver, obj, key, val) {
|
|
17071
17071
|
if (val && typeof val === "object") {
|
|
@@ -17112,7 +17112,7 @@ var require_applyReviver = __commonJS((exports2) => {
|
|
|
17112
17112
|
exports2.applyReviver = applyReviver;
|
|
17113
17113
|
});
|
|
17114
17114
|
|
|
17115
|
-
//
|
|
17115
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/nodes/toJS.js
|
|
17116
17116
|
var require_toJS = __commonJS((exports2) => {
|
|
17117
17117
|
var identity = require_identity();
|
|
17118
17118
|
function toJS(value, arg, ctx) {
|
|
@@ -17139,7 +17139,7 @@ var require_toJS = __commonJS((exports2) => {
|
|
|
17139
17139
|
exports2.toJS = toJS;
|
|
17140
17140
|
});
|
|
17141
17141
|
|
|
17142
|
-
//
|
|
17142
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/nodes/Node.js
|
|
17143
17143
|
var require_Node = __commonJS((exports2) => {
|
|
17144
17144
|
var applyReviver = require_applyReviver();
|
|
17145
17145
|
var identity = require_identity();
|
|
@@ -17176,7 +17176,7 @@ var require_Node = __commonJS((exports2) => {
|
|
|
17176
17176
|
exports2.NodeBase = NodeBase;
|
|
17177
17177
|
});
|
|
17178
17178
|
|
|
17179
|
-
//
|
|
17179
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/nodes/Alias.js
|
|
17180
17180
|
var require_Alias = __commonJS((exports2) => {
|
|
17181
17181
|
var anchors = require_anchors();
|
|
17182
17182
|
var visit = require_visit();
|
|
@@ -17284,7 +17284,7 @@ var require_Alias = __commonJS((exports2) => {
|
|
|
17284
17284
|
exports2.Alias = Alias;
|
|
17285
17285
|
});
|
|
17286
17286
|
|
|
17287
|
-
//
|
|
17287
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/nodes/Scalar.js
|
|
17288
17288
|
var require_Scalar = __commonJS((exports2) => {
|
|
17289
17289
|
var identity = require_identity();
|
|
17290
17290
|
var Node = require_Node();
|
|
@@ -17312,7 +17312,7 @@ var require_Scalar = __commonJS((exports2) => {
|
|
|
17312
17312
|
exports2.isScalarValue = isScalarValue;
|
|
17313
17313
|
});
|
|
17314
17314
|
|
|
17315
|
-
//
|
|
17315
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/doc/createNode.js
|
|
17316
17316
|
var require_createNode = __commonJS((exports2) => {
|
|
17317
17317
|
var Alias = require_Alias();
|
|
17318
17318
|
var identity = require_identity();
|
|
@@ -17384,7 +17384,7 @@ var require_createNode = __commonJS((exports2) => {
|
|
|
17384
17384
|
exports2.createNode = createNode;
|
|
17385
17385
|
});
|
|
17386
17386
|
|
|
17387
|
-
//
|
|
17387
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/nodes/Collection.js
|
|
17388
17388
|
var require_Collection = __commonJS((exports2) => {
|
|
17389
17389
|
var createNode = require_createNode();
|
|
17390
17390
|
var identity = require_identity();
|
|
@@ -17499,7 +17499,7 @@ var require_Collection = __commonJS((exports2) => {
|
|
|
17499
17499
|
exports2.isEmptyPath = isEmptyPath;
|
|
17500
17500
|
});
|
|
17501
17501
|
|
|
17502
|
-
//
|
|
17502
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/stringify/stringifyComment.js
|
|
17503
17503
|
var require_stringifyComment = __commonJS((exports2) => {
|
|
17504
17504
|
var stringifyComment = (str) => str.replace(/^(?!$)(?: $)?/gm, "#");
|
|
17505
17505
|
function indentComment(comment, indent) {
|
|
@@ -17516,7 +17516,7 @@ var require_stringifyComment = __commonJS((exports2) => {
|
|
|
17516
17516
|
exports2.stringifyComment = stringifyComment;
|
|
17517
17517
|
});
|
|
17518
17518
|
|
|
17519
|
-
//
|
|
17519
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/stringify/foldFlowLines.js
|
|
17520
17520
|
var require_foldFlowLines = __commonJS((exports2) => {
|
|
17521
17521
|
var FOLD_FLOW = "flow";
|
|
17522
17522
|
var FOLD_BLOCK = "block";
|
|
@@ -17653,7 +17653,7 @@ ${indent}${text.slice(fold + 1, end2)}`;
|
|
|
17653
17653
|
exports2.foldFlowLines = foldFlowLines;
|
|
17654
17654
|
});
|
|
17655
17655
|
|
|
17656
|
-
//
|
|
17656
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/stringify/stringifyString.js
|
|
17657
17657
|
var require_stringifyString = __commonJS((exports2) => {
|
|
17658
17658
|
var Scalar = require_Scalar();
|
|
17659
17659
|
var foldFlowLines = require_foldFlowLines();
|
|
@@ -17951,7 +17951,7 @@ ${indent}`);
|
|
|
17951
17951
|
exports2.stringifyString = stringifyString;
|
|
17952
17952
|
});
|
|
17953
17953
|
|
|
17954
|
-
//
|
|
17954
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/stringify/stringify.js
|
|
17955
17955
|
var require_stringify = __commonJS((exports2) => {
|
|
17956
17956
|
var anchors = require_anchors();
|
|
17957
17957
|
var identity = require_identity();
|
|
@@ -18072,7 +18072,7 @@ ${ctx.indent}${str}`;
|
|
|
18072
18072
|
exports2.stringify = stringify;
|
|
18073
18073
|
});
|
|
18074
18074
|
|
|
18075
|
-
//
|
|
18075
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/stringify/stringifyPair.js
|
|
18076
18076
|
var require_stringifyPair = __commonJS((exports2) => {
|
|
18077
18077
|
var identity = require_identity();
|
|
18078
18078
|
var Scalar = require_Scalar();
|
|
@@ -18208,7 +18208,7 @@ ${ctx.indent}`;
|
|
|
18208
18208
|
exports2.stringifyPair = stringifyPair;
|
|
18209
18209
|
});
|
|
18210
18210
|
|
|
18211
|
-
//
|
|
18211
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/log.js
|
|
18212
18212
|
var require_log = __commonJS((exports2) => {
|
|
18213
18213
|
var node_process = __require("process");
|
|
18214
18214
|
function debug(logLevel, ...messages) {
|
|
@@ -18227,7 +18227,7 @@ var require_log = __commonJS((exports2) => {
|
|
|
18227
18227
|
exports2.warn = warn;
|
|
18228
18228
|
});
|
|
18229
18229
|
|
|
18230
|
-
//
|
|
18230
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/yaml-1.1/merge.js
|
|
18231
18231
|
var require_merge = __commonJS((exports2) => {
|
|
18232
18232
|
var identity = require_identity();
|
|
18233
18233
|
var Scalar = require_Scalar();
|
|
@@ -18281,7 +18281,7 @@ var require_merge = __commonJS((exports2) => {
|
|
|
18281
18281
|
exports2.merge = merge;
|
|
18282
18282
|
});
|
|
18283
18283
|
|
|
18284
|
-
//
|
|
18284
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/nodes/addPairToJSMap.js
|
|
18285
18285
|
var require_addPairToJSMap = __commonJS((exports2) => {
|
|
18286
18286
|
var log = require_log();
|
|
18287
18287
|
var merge = require_merge();
|
|
@@ -18342,7 +18342,7 @@ var require_addPairToJSMap = __commonJS((exports2) => {
|
|
|
18342
18342
|
exports2.addPairToJSMap = addPairToJSMap;
|
|
18343
18343
|
});
|
|
18344
18344
|
|
|
18345
|
-
//
|
|
18345
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/nodes/Pair.js
|
|
18346
18346
|
var require_Pair = __commonJS((exports2) => {
|
|
18347
18347
|
var createNode = require_createNode();
|
|
18348
18348
|
var stringifyPair = require_stringifyPair();
|
|
@@ -18380,7 +18380,7 @@ var require_Pair = __commonJS((exports2) => {
|
|
|
18380
18380
|
exports2.createPair = createPair;
|
|
18381
18381
|
});
|
|
18382
18382
|
|
|
18383
|
-
//
|
|
18383
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/stringify/stringifyCollection.js
|
|
18384
18384
|
var require_stringifyCollection = __commonJS((exports2) => {
|
|
18385
18385
|
var identity = require_identity();
|
|
18386
18386
|
var stringify = require_stringify();
|
|
@@ -18532,7 +18532,7 @@ ${indent}${end}`;
|
|
|
18532
18532
|
exports2.stringifyCollection = stringifyCollection;
|
|
18533
18533
|
});
|
|
18534
18534
|
|
|
18535
|
-
//
|
|
18535
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/nodes/YAMLMap.js
|
|
18536
18536
|
var require_YAMLMap = __commonJS((exports2) => {
|
|
18537
18537
|
var stringifyCollection = require_stringifyCollection();
|
|
18538
18538
|
var addPairToJSMap = require_addPairToJSMap();
|
|
@@ -18659,7 +18659,7 @@ var require_YAMLMap = __commonJS((exports2) => {
|
|
|
18659
18659
|
exports2.findPair = findPair;
|
|
18660
18660
|
});
|
|
18661
18661
|
|
|
18662
|
-
//
|
|
18662
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/common/map.js
|
|
18663
18663
|
var require_map = __commonJS((exports2) => {
|
|
18664
18664
|
var identity = require_identity();
|
|
18665
18665
|
var YAMLMap = require_YAMLMap();
|
|
@@ -18678,7 +18678,7 @@ var require_map = __commonJS((exports2) => {
|
|
|
18678
18678
|
exports2.map = map;
|
|
18679
18679
|
});
|
|
18680
18680
|
|
|
18681
|
-
//
|
|
18681
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/nodes/YAMLSeq.js
|
|
18682
18682
|
var require_YAMLSeq = __commonJS((exports2) => {
|
|
18683
18683
|
var createNode = require_createNode();
|
|
18684
18684
|
var stringifyCollection = require_stringifyCollection();
|
|
@@ -18771,7 +18771,7 @@ var require_YAMLSeq = __commonJS((exports2) => {
|
|
|
18771
18771
|
exports2.YAMLSeq = YAMLSeq;
|
|
18772
18772
|
});
|
|
18773
18773
|
|
|
18774
|
-
//
|
|
18774
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/common/seq.js
|
|
18775
18775
|
var require_seq = __commonJS((exports2) => {
|
|
18776
18776
|
var identity = require_identity();
|
|
18777
18777
|
var YAMLSeq = require_YAMLSeq();
|
|
@@ -18790,7 +18790,7 @@ var require_seq = __commonJS((exports2) => {
|
|
|
18790
18790
|
exports2.seq = seq;
|
|
18791
18791
|
});
|
|
18792
18792
|
|
|
18793
|
-
//
|
|
18793
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/common/string.js
|
|
18794
18794
|
var require_string = __commonJS((exports2) => {
|
|
18795
18795
|
var stringifyString = require_stringifyString();
|
|
18796
18796
|
var string = {
|
|
@@ -18806,7 +18806,7 @@ var require_string = __commonJS((exports2) => {
|
|
|
18806
18806
|
exports2.string = string;
|
|
18807
18807
|
});
|
|
18808
18808
|
|
|
18809
|
-
//
|
|
18809
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/common/null.js
|
|
18810
18810
|
var require_null = __commonJS((exports2) => {
|
|
18811
18811
|
var Scalar = require_Scalar();
|
|
18812
18812
|
var nullTag = {
|
|
@@ -18821,7 +18821,7 @@ var require_null = __commonJS((exports2) => {
|
|
|
18821
18821
|
exports2.nullTag = nullTag;
|
|
18822
18822
|
});
|
|
18823
18823
|
|
|
18824
|
-
//
|
|
18824
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/core/bool.js
|
|
18825
18825
|
var require_bool = __commonJS((exports2) => {
|
|
18826
18826
|
var Scalar = require_Scalar();
|
|
18827
18827
|
var boolTag = {
|
|
@@ -18842,7 +18842,7 @@ var require_bool = __commonJS((exports2) => {
|
|
|
18842
18842
|
exports2.boolTag = boolTag;
|
|
18843
18843
|
});
|
|
18844
18844
|
|
|
18845
|
-
//
|
|
18845
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/stringify/stringifyNumber.js
|
|
18846
18846
|
var require_stringifyNumber = __commonJS((exports2) => {
|
|
18847
18847
|
function stringifyNumber({ format, minFractionDigits, tag, value }) {
|
|
18848
18848
|
if (typeof value === "bigint")
|
|
@@ -18866,7 +18866,7 @@ var require_stringifyNumber = __commonJS((exports2) => {
|
|
|
18866
18866
|
exports2.stringifyNumber = stringifyNumber;
|
|
18867
18867
|
});
|
|
18868
18868
|
|
|
18869
|
-
//
|
|
18869
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/core/float.js
|
|
18870
18870
|
var require_float = __commonJS((exports2) => {
|
|
18871
18871
|
var Scalar = require_Scalar();
|
|
18872
18872
|
var stringifyNumber = require_stringifyNumber();
|
|
@@ -18909,7 +18909,7 @@ var require_float = __commonJS((exports2) => {
|
|
|
18909
18909
|
exports2.floatNaN = floatNaN;
|
|
18910
18910
|
});
|
|
18911
18911
|
|
|
18912
|
-
//
|
|
18912
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/core/int.js
|
|
18913
18913
|
var require_int = __commonJS((exports2) => {
|
|
18914
18914
|
var stringifyNumber = require_stringifyNumber();
|
|
18915
18915
|
var intIdentify = (value) => typeof value === "bigint" || Number.isInteger(value);
|
|
@@ -18951,7 +18951,7 @@ var require_int = __commonJS((exports2) => {
|
|
|
18951
18951
|
exports2.intOct = intOct;
|
|
18952
18952
|
});
|
|
18953
18953
|
|
|
18954
|
-
//
|
|
18954
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/core/schema.js
|
|
18955
18955
|
var require_schema = __commonJS((exports2) => {
|
|
18956
18956
|
var map = require_map();
|
|
18957
18957
|
var _null = require_null();
|
|
@@ -18976,7 +18976,7 @@ var require_schema = __commonJS((exports2) => {
|
|
|
18976
18976
|
exports2.schema = schema;
|
|
18977
18977
|
});
|
|
18978
18978
|
|
|
18979
|
-
//
|
|
18979
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/json/schema.js
|
|
18980
18980
|
var require_schema2 = __commonJS((exports2) => {
|
|
18981
18981
|
var Scalar = require_Scalar();
|
|
18982
18982
|
var map = require_map();
|
|
@@ -19040,7 +19040,7 @@ var require_schema2 = __commonJS((exports2) => {
|
|
|
19040
19040
|
exports2.schema = schema;
|
|
19041
19041
|
});
|
|
19042
19042
|
|
|
19043
|
-
//
|
|
19043
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/yaml-1.1/binary.js
|
|
19044
19044
|
var require_binary = __commonJS((exports2) => {
|
|
19045
19045
|
var node_buffer = __require("buffer");
|
|
19046
19046
|
var Scalar = require_Scalar();
|
|
@@ -19095,7 +19095,7 @@ var require_binary = __commonJS((exports2) => {
|
|
|
19095
19095
|
exports2.binary = binary;
|
|
19096
19096
|
});
|
|
19097
19097
|
|
|
19098
|
-
//
|
|
19098
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/yaml-1.1/pairs.js
|
|
19099
19099
|
var require_pairs = __commonJS((exports2) => {
|
|
19100
19100
|
var identity = require_identity();
|
|
19101
19101
|
var Pair = require_Pair();
|
|
@@ -19170,7 +19170,7 @@ ${cn.comment}` : item.comment;
|
|
|
19170
19170
|
exports2.resolvePairs = resolvePairs;
|
|
19171
19171
|
});
|
|
19172
19172
|
|
|
19173
|
-
//
|
|
19173
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/yaml-1.1/omap.js
|
|
19174
19174
|
var require_omap = __commonJS((exports2) => {
|
|
19175
19175
|
var identity = require_identity();
|
|
19176
19176
|
var toJS = require_toJS();
|
|
@@ -19242,7 +19242,7 @@ var require_omap = __commonJS((exports2) => {
|
|
|
19242
19242
|
exports2.omap = omap;
|
|
19243
19243
|
});
|
|
19244
19244
|
|
|
19245
|
-
//
|
|
19245
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/yaml-1.1/bool.js
|
|
19246
19246
|
var require_bool2 = __commonJS((exports2) => {
|
|
19247
19247
|
var Scalar = require_Scalar();
|
|
19248
19248
|
function boolStringify({ value, source }, ctx) {
|
|
@@ -19271,7 +19271,7 @@ var require_bool2 = __commonJS((exports2) => {
|
|
|
19271
19271
|
exports2.trueTag = trueTag;
|
|
19272
19272
|
});
|
|
19273
19273
|
|
|
19274
|
-
//
|
|
19274
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/yaml-1.1/float.js
|
|
19275
19275
|
var require_float2 = __commonJS((exports2) => {
|
|
19276
19276
|
var Scalar = require_Scalar();
|
|
19277
19277
|
var stringifyNumber = require_stringifyNumber();
|
|
@@ -19317,7 +19317,7 @@ var require_float2 = __commonJS((exports2) => {
|
|
|
19317
19317
|
exports2.floatNaN = floatNaN;
|
|
19318
19318
|
});
|
|
19319
19319
|
|
|
19320
|
-
//
|
|
19320
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/yaml-1.1/int.js
|
|
19321
19321
|
var require_int2 = __commonJS((exports2) => {
|
|
19322
19322
|
var stringifyNumber = require_stringifyNumber();
|
|
19323
19323
|
var intIdentify = (value) => typeof value === "bigint" || Number.isInteger(value);
|
|
@@ -19393,7 +19393,7 @@ var require_int2 = __commonJS((exports2) => {
|
|
|
19393
19393
|
exports2.intOct = intOct;
|
|
19394
19394
|
});
|
|
19395
19395
|
|
|
19396
|
-
//
|
|
19396
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/yaml-1.1/set.js
|
|
19397
19397
|
var require_set = __commonJS((exports2) => {
|
|
19398
19398
|
var identity = require_identity();
|
|
19399
19399
|
var Pair = require_Pair();
|
|
@@ -19476,7 +19476,7 @@ var require_set = __commonJS((exports2) => {
|
|
|
19476
19476
|
exports2.set = set;
|
|
19477
19477
|
});
|
|
19478
19478
|
|
|
19479
|
-
//
|
|
19479
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/yaml-1.1/timestamp.js
|
|
19480
19480
|
var require_timestamp = __commonJS((exports2) => {
|
|
19481
19481
|
var stringifyNumber = require_stringifyNumber();
|
|
19482
19482
|
function parseSexagesimal(str, asBigInt) {
|
|
@@ -19558,7 +19558,7 @@ var require_timestamp = __commonJS((exports2) => {
|
|
|
19558
19558
|
exports2.timestamp = timestamp;
|
|
19559
19559
|
});
|
|
19560
19560
|
|
|
19561
|
-
//
|
|
19561
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/yaml-1.1/schema.js
|
|
19562
19562
|
var require_schema3 = __commonJS((exports2) => {
|
|
19563
19563
|
var map = require_map();
|
|
19564
19564
|
var _null = require_null();
|
|
@@ -19599,7 +19599,7 @@ var require_schema3 = __commonJS((exports2) => {
|
|
|
19599
19599
|
exports2.schema = schema;
|
|
19600
19600
|
});
|
|
19601
19601
|
|
|
19602
|
-
//
|
|
19602
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/tags.js
|
|
19603
19603
|
var require_tags = __commonJS((exports2) => {
|
|
19604
19604
|
var map = require_map();
|
|
19605
19605
|
var _null = require_null();
|
|
@@ -19690,7 +19690,7 @@ var require_tags = __commonJS((exports2) => {
|
|
|
19690
19690
|
exports2.getTags = getTags;
|
|
19691
19691
|
});
|
|
19692
19692
|
|
|
19693
|
-
//
|
|
19693
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/Schema.js
|
|
19694
19694
|
var require_Schema = __commonJS((exports2) => {
|
|
19695
19695
|
var identity = require_identity();
|
|
19696
19696
|
var map = require_map();
|
|
@@ -19720,7 +19720,7 @@ var require_Schema = __commonJS((exports2) => {
|
|
|
19720
19720
|
exports2.Schema = Schema;
|
|
19721
19721
|
});
|
|
19722
19722
|
|
|
19723
|
-
//
|
|
19723
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/stringify/stringifyDocument.js
|
|
19724
19724
|
var require_stringifyDocument = __commonJS((exports2) => {
|
|
19725
19725
|
var identity = require_identity();
|
|
19726
19726
|
var stringify = require_stringify();
|
|
@@ -19800,7 +19800,7 @@ var require_stringifyDocument = __commonJS((exports2) => {
|
|
|
19800
19800
|
exports2.stringifyDocument = stringifyDocument;
|
|
19801
19801
|
});
|
|
19802
19802
|
|
|
19803
|
-
//
|
|
19803
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/doc/Document.js
|
|
19804
19804
|
var require_Document = __commonJS((exports2) => {
|
|
19805
19805
|
var Alias = require_Alias();
|
|
19806
19806
|
var Collection = require_Collection();
|
|
@@ -20035,7 +20035,7 @@ var require_Document = __commonJS((exports2) => {
|
|
|
20035
20035
|
exports2.Document = Document;
|
|
20036
20036
|
});
|
|
20037
20037
|
|
|
20038
|
-
//
|
|
20038
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/errors.js
|
|
20039
20039
|
var require_errors = __commonJS((exports2) => {
|
|
20040
20040
|
class YAMLError extends Error {
|
|
20041
20041
|
constructor(name, pos, code, message) {
|
|
@@ -20100,7 +20100,7 @@ ${pointer}
|
|
|
20100
20100
|
exports2.prettifyError = prettifyError;
|
|
20101
20101
|
});
|
|
20102
20102
|
|
|
20103
|
-
//
|
|
20103
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/compose/resolve-props.js
|
|
20104
20104
|
var require_resolve_props = __commonJS((exports2) => {
|
|
20105
20105
|
function resolveProps(tokens, { flow, indicator, next, offset, onError, parentIndent, startOnNewline }) {
|
|
20106
20106
|
let spaceBefore = false;
|
|
@@ -20230,7 +20230,7 @@ var require_resolve_props = __commonJS((exports2) => {
|
|
|
20230
20230
|
exports2.resolveProps = resolveProps;
|
|
20231
20231
|
});
|
|
20232
20232
|
|
|
20233
|
-
//
|
|
20233
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/compose/util-contains-newline.js
|
|
20234
20234
|
var require_util_contains_newline = __commonJS((exports2) => {
|
|
20235
20235
|
function containsNewline(key) {
|
|
20236
20236
|
if (!key)
|
|
@@ -20270,7 +20270,7 @@ var require_util_contains_newline = __commonJS((exports2) => {
|
|
|
20270
20270
|
exports2.containsNewline = containsNewline;
|
|
20271
20271
|
});
|
|
20272
20272
|
|
|
20273
|
-
//
|
|
20273
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/compose/util-flow-indent-check.js
|
|
20274
20274
|
var require_util_flow_indent_check = __commonJS((exports2) => {
|
|
20275
20275
|
var utilContainsNewline = require_util_contains_newline();
|
|
20276
20276
|
function flowIndentCheck(indent, fc, onError) {
|
|
@@ -20285,7 +20285,7 @@ var require_util_flow_indent_check = __commonJS((exports2) => {
|
|
|
20285
20285
|
exports2.flowIndentCheck = flowIndentCheck;
|
|
20286
20286
|
});
|
|
20287
20287
|
|
|
20288
|
-
//
|
|
20288
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/compose/util-map-includes.js
|
|
20289
20289
|
var require_util_map_includes = __commonJS((exports2) => {
|
|
20290
20290
|
var identity = require_identity();
|
|
20291
20291
|
function mapIncludes(ctx, items, search) {
|
|
@@ -20298,7 +20298,7 @@ var require_util_map_includes = __commonJS((exports2) => {
|
|
|
20298
20298
|
exports2.mapIncludes = mapIncludes;
|
|
20299
20299
|
});
|
|
20300
20300
|
|
|
20301
|
-
//
|
|
20301
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/compose/resolve-block-map.js
|
|
20302
20302
|
var require_resolve_block_map = __commonJS((exports2) => {
|
|
20303
20303
|
var Pair = require_Pair();
|
|
20304
20304
|
var YAMLMap = require_YAMLMap();
|
|
@@ -20405,7 +20405,7 @@ var require_resolve_block_map = __commonJS((exports2) => {
|
|
|
20405
20405
|
exports2.resolveBlockMap = resolveBlockMap;
|
|
20406
20406
|
});
|
|
20407
20407
|
|
|
20408
|
-
//
|
|
20408
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/compose/resolve-block-seq.js
|
|
20409
20409
|
var require_resolve_block_seq = __commonJS((exports2) => {
|
|
20410
20410
|
var YAMLSeq = require_YAMLSeq();
|
|
20411
20411
|
var resolveProps = require_resolve_props();
|
|
@@ -20453,7 +20453,7 @@ var require_resolve_block_seq = __commonJS((exports2) => {
|
|
|
20453
20453
|
exports2.resolveBlockSeq = resolveBlockSeq;
|
|
20454
20454
|
});
|
|
20455
20455
|
|
|
20456
|
-
//
|
|
20456
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/compose/resolve-end.js
|
|
20457
20457
|
var require_resolve_end = __commonJS((exports2) => {
|
|
20458
20458
|
function resolveEnd(end, offset, reqSpace, onError) {
|
|
20459
20459
|
let comment = "";
|
|
@@ -20493,7 +20493,7 @@ var require_resolve_end = __commonJS((exports2) => {
|
|
|
20493
20493
|
exports2.resolveEnd = resolveEnd;
|
|
20494
20494
|
});
|
|
20495
20495
|
|
|
20496
|
-
//
|
|
20496
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/compose/resolve-flow-collection.js
|
|
20497
20497
|
var require_resolve_flow_collection = __commonJS((exports2) => {
|
|
20498
20498
|
var identity = require_identity();
|
|
20499
20499
|
var Pair = require_Pair();
|
|
@@ -20684,7 +20684,7 @@ var require_resolve_flow_collection = __commonJS((exports2) => {
|
|
|
20684
20684
|
exports2.resolveFlowCollection = resolveFlowCollection;
|
|
20685
20685
|
});
|
|
20686
20686
|
|
|
20687
|
-
//
|
|
20687
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/compose/compose-collection.js
|
|
20688
20688
|
var require_compose_collection = __commonJS((exports2) => {
|
|
20689
20689
|
var identity = require_identity();
|
|
20690
20690
|
var Scalar = require_Scalar();
|
|
@@ -20746,7 +20746,7 @@ var require_compose_collection = __commonJS((exports2) => {
|
|
|
20746
20746
|
exports2.composeCollection = composeCollection;
|
|
20747
20747
|
});
|
|
20748
20748
|
|
|
20749
|
-
//
|
|
20749
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/compose/resolve-block-scalar.js
|
|
20750
20750
|
var require_resolve_block_scalar = __commonJS((exports2) => {
|
|
20751
20751
|
var Scalar = require_Scalar();
|
|
20752
20752
|
function resolveBlockScalar(ctx, scalar, onError) {
|
|
@@ -20939,7 +20939,7 @@ var require_resolve_block_scalar = __commonJS((exports2) => {
|
|
|
20939
20939
|
exports2.resolveBlockScalar = resolveBlockScalar;
|
|
20940
20940
|
});
|
|
20941
20941
|
|
|
20942
|
-
//
|
|
20942
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/compose/resolve-flow-scalar.js
|
|
20943
20943
|
var require_resolve_flow_scalar = __commonJS((exports2) => {
|
|
20944
20944
|
var Scalar = require_Scalar();
|
|
20945
20945
|
var resolveEnd = require_resolve_end();
|
|
@@ -21155,7 +21155,7 @@ var require_resolve_flow_scalar = __commonJS((exports2) => {
|
|
|
21155
21155
|
exports2.resolveFlowScalar = resolveFlowScalar;
|
|
21156
21156
|
});
|
|
21157
21157
|
|
|
21158
|
-
//
|
|
21158
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/compose/compose-scalar.js
|
|
21159
21159
|
var require_compose_scalar = __commonJS((exports2) => {
|
|
21160
21160
|
var identity = require_identity();
|
|
21161
21161
|
var Scalar = require_Scalar();
|
|
@@ -21233,7 +21233,7 @@ var require_compose_scalar = __commonJS((exports2) => {
|
|
|
21233
21233
|
exports2.composeScalar = composeScalar;
|
|
21234
21234
|
});
|
|
21235
21235
|
|
|
21236
|
-
//
|
|
21236
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/compose/util-empty-scalar-position.js
|
|
21237
21237
|
var require_util_empty_scalar_position = __commonJS((exports2) => {
|
|
21238
21238
|
function emptyScalarPosition(offset, before, pos) {
|
|
21239
21239
|
if (before) {
|
|
@@ -21260,7 +21260,7 @@ var require_util_empty_scalar_position = __commonJS((exports2) => {
|
|
|
21260
21260
|
exports2.emptyScalarPosition = emptyScalarPosition;
|
|
21261
21261
|
});
|
|
21262
21262
|
|
|
21263
|
-
//
|
|
21263
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/compose/compose-node.js
|
|
21264
21264
|
var require_compose_node = __commonJS((exports2) => {
|
|
21265
21265
|
var Alias = require_Alias();
|
|
21266
21266
|
var identity = require_identity();
|
|
@@ -21363,7 +21363,7 @@ var require_compose_node = __commonJS((exports2) => {
|
|
|
21363
21363
|
exports2.composeNode = composeNode;
|
|
21364
21364
|
});
|
|
21365
21365
|
|
|
21366
|
-
//
|
|
21366
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/compose/compose-doc.js
|
|
21367
21367
|
var require_compose_doc = __commonJS((exports2) => {
|
|
21368
21368
|
var Document = require_Document();
|
|
21369
21369
|
var composeNode = require_compose_node();
|
|
@@ -21403,7 +21403,7 @@ var require_compose_doc = __commonJS((exports2) => {
|
|
|
21403
21403
|
exports2.composeDoc = composeDoc;
|
|
21404
21404
|
});
|
|
21405
21405
|
|
|
21406
|
-
//
|
|
21406
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/compose/composer.js
|
|
21407
21407
|
var require_composer2 = __commonJS((exports2) => {
|
|
21408
21408
|
var node_process = __require("process");
|
|
21409
21409
|
var directives = require_directives();
|
|
@@ -21592,7 +21592,7 @@ ${end.comment}` : end.comment;
|
|
|
21592
21592
|
exports2.Composer = Composer;
|
|
21593
21593
|
});
|
|
21594
21594
|
|
|
21595
|
-
//
|
|
21595
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/parse/cst-scalar.js
|
|
21596
21596
|
var require_cst_scalar = __commonJS((exports2) => {
|
|
21597
21597
|
var resolveBlockScalar = require_resolve_block_scalar();
|
|
21598
21598
|
var resolveFlowScalar = require_resolve_flow_scalar();
|
|
@@ -21782,7 +21782,7 @@ var require_cst_scalar = __commonJS((exports2) => {
|
|
|
21782
21782
|
exports2.setScalarValue = setScalarValue;
|
|
21783
21783
|
});
|
|
21784
21784
|
|
|
21785
|
-
//
|
|
21785
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/parse/cst-stringify.js
|
|
21786
21786
|
var require_cst_stringify = __commonJS((exports2) => {
|
|
21787
21787
|
var stringify = (cst) => ("type" in cst) ? stringifyToken(cst) : stringifyItem(cst);
|
|
21788
21788
|
function stringifyToken(token) {
|
|
@@ -21840,7 +21840,7 @@ var require_cst_stringify = __commonJS((exports2) => {
|
|
|
21840
21840
|
exports2.stringify = stringify;
|
|
21841
21841
|
});
|
|
21842
21842
|
|
|
21843
|
-
//
|
|
21843
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/parse/cst-visit.js
|
|
21844
21844
|
var require_cst_visit = __commonJS((exports2) => {
|
|
21845
21845
|
var BREAK = Symbol("break visit");
|
|
21846
21846
|
var SKIP = Symbol("skip children");
|
|
@@ -21899,7 +21899,7 @@ var require_cst_visit = __commonJS((exports2) => {
|
|
|
21899
21899
|
exports2.visit = visit;
|
|
21900
21900
|
});
|
|
21901
21901
|
|
|
21902
|
-
//
|
|
21902
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/parse/cst.js
|
|
21903
21903
|
var require_cst = __commonJS((exports2) => {
|
|
21904
21904
|
var cstScalar = require_cst_scalar();
|
|
21905
21905
|
var cstStringify = require_cst_stringify();
|
|
@@ -22000,7 +22000,7 @@ var require_cst = __commonJS((exports2) => {
|
|
|
22000
22000
|
exports2.tokenType = tokenType;
|
|
22001
22001
|
});
|
|
22002
22002
|
|
|
22003
|
-
//
|
|
22003
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/parse/lexer.js
|
|
22004
22004
|
var require_lexer = __commonJS((exports2) => {
|
|
22005
22005
|
var cst = require_cst();
|
|
22006
22006
|
function isEmpty2(ch) {
|
|
@@ -22586,7 +22586,7 @@ var require_lexer = __commonJS((exports2) => {
|
|
|
22586
22586
|
exports2.Lexer = Lexer;
|
|
22587
22587
|
});
|
|
22588
22588
|
|
|
22589
|
-
//
|
|
22589
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/parse/line-counter.js
|
|
22590
22590
|
var require_line_counter = __commonJS((exports2) => {
|
|
22591
22591
|
class LineCounter {
|
|
22592
22592
|
constructor() {
|
|
@@ -22614,7 +22614,7 @@ var require_line_counter = __commonJS((exports2) => {
|
|
|
22614
22614
|
exports2.LineCounter = LineCounter;
|
|
22615
22615
|
});
|
|
22616
22616
|
|
|
22617
|
-
//
|
|
22617
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/parse/parser.js
|
|
22618
22618
|
var require_parser = __commonJS((exports2) => {
|
|
22619
22619
|
var node_process = __require("process");
|
|
22620
22620
|
var cst = require_cst();
|
|
@@ -23463,7 +23463,7 @@ var require_parser = __commonJS((exports2) => {
|
|
|
23463
23463
|
exports2.Parser = Parser;
|
|
23464
23464
|
});
|
|
23465
23465
|
|
|
23466
|
-
//
|
|
23466
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/public-api.js
|
|
23467
23467
|
var require_public_api = __commonJS((exports2) => {
|
|
23468
23468
|
var composer = require_composer2();
|
|
23469
23469
|
var Document = require_Document();
|
|
@@ -23557,7 +23557,7 @@ var require_public_api = __commonJS((exports2) => {
|
|
|
23557
23557
|
exports2.stringify = stringify;
|
|
23558
23558
|
});
|
|
23559
23559
|
|
|
23560
|
-
//
|
|
23560
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/index.js
|
|
23561
23561
|
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;
|
|
23562
23562
|
var init_dist = __esm(() => {
|
|
23563
23563
|
composer = require_composer2();
|
|
@@ -24109,7 +24109,7 @@ var init_schema = __esm(() => {
|
|
|
24109
24109
|
});
|
|
24110
24110
|
|
|
24111
24111
|
// ../src/config/paths.ts
|
|
24112
|
-
import { existsSync as
|
|
24112
|
+
import { existsSync as existsSync8 } from "node:fs";
|
|
24113
24113
|
import { resolve as resolve2 } from "node:path";
|
|
24114
24114
|
function home() {
|
|
24115
24115
|
return process.env.HOME ?? "/root";
|
|
@@ -24128,9 +24128,9 @@ function resolveDualPath(pathStr) {
|
|
|
24128
24128
|
const absolute = resolve2(h, rest);
|
|
24129
24129
|
if (rest.startsWith(`${DEFAULT_STATE_DIR}/`)) {
|
|
24130
24130
|
const frag = rest.slice(DEFAULT_STATE_DIR.length + 1);
|
|
24131
|
-
if (!
|
|
24131
|
+
if (!existsSync8(absolute)) {
|
|
24132
24132
|
const legacy = resolve2(h, LEGACY_STATE_DIR, frag);
|
|
24133
|
-
if (
|
|
24133
|
+
if (existsSync8(legacy)) {
|
|
24134
24134
|
warnLegacyStateOnce(legacy);
|
|
24135
24135
|
return legacy;
|
|
24136
24136
|
}
|
|
@@ -24155,14 +24155,14 @@ var init_overlay_schema = __esm(() => {
|
|
|
24155
24155
|
});
|
|
24156
24156
|
|
|
24157
24157
|
// ../src/config/overlay-loader.ts
|
|
24158
|
-
import { existsSync as
|
|
24158
|
+
import { existsSync as existsSync9, readFileSync as readFileSync4, readdirSync, statSync as statSync2 } from "node:fs";
|
|
24159
24159
|
import { resolve as resolve3 } from "node:path";
|
|
24160
24160
|
function overlayDirFor(agentName3, subdir) {
|
|
24161
24161
|
const base = resolveDualPath(`~/.switchroom/agents/${agentName3}/${subdir}`);
|
|
24162
24162
|
return resolve3(base);
|
|
24163
24163
|
}
|
|
24164
24164
|
function listYamlFiles(dir) {
|
|
24165
|
-
if (!
|
|
24165
|
+
if (!existsSync9(dir))
|
|
24166
24166
|
return [];
|
|
24167
24167
|
let entries;
|
|
24168
24168
|
try {
|
|
@@ -24619,7 +24619,7 @@ function validateNotionWorkspaceConfig(config) {
|
|
|
24619
24619
|
}
|
|
24620
24620
|
|
|
24621
24621
|
// ../src/config/loader.ts
|
|
24622
|
-
import { readFileSync as readFileSync5, existsSync as
|
|
24622
|
+
import { readFileSync as readFileSync5, existsSync as existsSync10 } from "node:fs";
|
|
24623
24623
|
import { homedir as homedir5 } from "node:os";
|
|
24624
24624
|
import { resolve as resolve4 } from "node:path";
|
|
24625
24625
|
function formatZodErrors(error) {
|
|
@@ -24686,7 +24686,7 @@ function findConfigFile(startDir) {
|
|
|
24686
24686
|
resolve4(userDir, "clerk.yml")
|
|
24687
24687
|
].filter(Boolean);
|
|
24688
24688
|
for (const path of searchPaths) {
|
|
24689
|
-
if (
|
|
24689
|
+
if (existsSync10(path)) {
|
|
24690
24690
|
return path;
|
|
24691
24691
|
}
|
|
24692
24692
|
}
|
|
@@ -24694,7 +24694,7 @@ function findConfigFile(startDir) {
|
|
|
24694
24694
|
}
|
|
24695
24695
|
function loadConfig(configPath) {
|
|
24696
24696
|
const filePath = configPath ?? findConfigFile();
|
|
24697
|
-
if (!
|
|
24697
|
+
if (!existsSync10(filePath)) {
|
|
24698
24698
|
throw new ConfigError(`Config file not found: ${filePath}`);
|
|
24699
24699
|
}
|
|
24700
24700
|
let raw;
|
|
@@ -24802,7 +24802,7 @@ __export(exports_history, {
|
|
|
24802
24802
|
_resetForTests: () => _resetForTests
|
|
24803
24803
|
});
|
|
24804
24804
|
import { chmodSync as chmodSync2, mkdirSync as mkdirSync9 } from "fs";
|
|
24805
|
-
import { join as
|
|
24805
|
+
import { join as join12 } from "path";
|
|
24806
24806
|
function loadDatabaseClass() {
|
|
24807
24807
|
if (DatabaseClass != null)
|
|
24808
24808
|
return DatabaseClass;
|
|
@@ -24825,7 +24825,7 @@ function initHistory(stateDir, retentionDays = 30) {
|
|
|
24825
24825
|
return;
|
|
24826
24826
|
const Database = loadDatabaseClass();
|
|
24827
24827
|
mkdirSync9(stateDir, { recursive: true, mode: 448 });
|
|
24828
|
-
const path =
|
|
24828
|
+
const path = join12(stateDir, "history.db");
|
|
24829
24829
|
db = new Database(path, { create: true });
|
|
24830
24830
|
db.exec("PRAGMA journal_mode = WAL");
|
|
24831
24831
|
db.exec("PRAGMA synchronous = NORMAL");
|
|
@@ -25015,11 +25015,11 @@ var DatabaseClass = null, DEFAULT_LIMIT = 10, MAX_LIMIT = 50, db = null;
|
|
|
25015
25015
|
var init_history = () => {};
|
|
25016
25016
|
|
|
25017
25017
|
// quota-check.ts
|
|
25018
|
-
import { readFileSync as readFileSync8, existsSync as
|
|
25019
|
-
import { join as
|
|
25018
|
+
import { readFileSync as readFileSync8, existsSync as existsSync13 } from "fs";
|
|
25019
|
+
import { join as join13 } from "path";
|
|
25020
25020
|
function readOauthToken(claudeConfigDir) {
|
|
25021
|
-
const tokenFile =
|
|
25022
|
-
if (!
|
|
25021
|
+
const tokenFile = join13(claudeConfigDir, ".oauth-token");
|
|
25022
|
+
if (!existsSync13(tokenFile))
|
|
25023
25023
|
return null;
|
|
25024
25024
|
try {
|
|
25025
25025
|
const raw = readFileSync8(tokenFile, "utf-8").trim();
|
|
@@ -25501,7 +25501,7 @@ function isDockerRuntime() {
|
|
|
25501
25501
|
import * as net3 from "node:net";
|
|
25502
25502
|
import * as fs from "node:fs";
|
|
25503
25503
|
import { homedir as homedir7 } from "node:os";
|
|
25504
|
-
import { join as
|
|
25504
|
+
import { join as join17 } from "node:path";
|
|
25505
25505
|
function defaultBrokerSocketPath() {
|
|
25506
25506
|
if (fs.existsSync(OPERATOR_SOCKET_PATH))
|
|
25507
25507
|
return OPERATOR_SOCKET_PATH;
|
|
@@ -25510,7 +25510,7 @@ function defaultBrokerSocketPath() {
|
|
|
25510
25510
|
return LEGACY_SOCKET_PATH;
|
|
25511
25511
|
}
|
|
25512
25512
|
function vaultTokenFilePath(agentSlug) {
|
|
25513
|
-
return
|
|
25513
|
+
return join17(homedir7(), ".switchroom", "agents", agentSlug, ".vault-token");
|
|
25514
25514
|
}
|
|
25515
25515
|
function readVaultTokenFile(agentSlug) {
|
|
25516
25516
|
const filePath = vaultTokenFilePath(agentSlug);
|
|
@@ -25665,8 +25665,8 @@ var DEFAULT_TIMEOUT_MS3 = 2000, LEGACY_SOCKET_PATH, OPERATOR_SOCKET_PATH;
|
|
|
25665
25665
|
var init_client2 = __esm(() => {
|
|
25666
25666
|
init_protocol2();
|
|
25667
25667
|
init_peercred();
|
|
25668
|
-
LEGACY_SOCKET_PATH =
|
|
25669
|
-
OPERATOR_SOCKET_PATH =
|
|
25668
|
+
LEGACY_SOCKET_PATH = join17(homedir7(), ".switchroom", "vault-broker.sock");
|
|
25669
|
+
OPERATOR_SOCKET_PATH = join17(homedir7(), ".switchroom", "broker-operator", "sock");
|
|
25670
25670
|
});
|
|
25671
25671
|
|
|
25672
25672
|
// ../src/drive/deep-links.ts
|
|
@@ -25849,7 +25849,7 @@ function deriveSlug(inputs, existing) {
|
|
|
25849
25849
|
return `${base}_${n}`;
|
|
25850
25850
|
}
|
|
25851
25851
|
|
|
25852
|
-
//
|
|
25852
|
+
// ../../switchroom-sec-1417/node_modules/.bun/boundary@2.0.0/node_modules/boundary/lib/index.js
|
|
25853
25853
|
var require_lib = __commonJS((exports2) => {
|
|
25854
25854
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
25855
25855
|
exports2.binarySearch = exports2.upperBound = exports2.lowerBound = exports2.compare = undefined;
|
|
@@ -25896,7 +25896,7 @@ var require_lib = __commonJS((exports2) => {
|
|
|
25896
25896
|
exports2.binarySearch = binarySearch;
|
|
25897
25897
|
});
|
|
25898
25898
|
|
|
25899
|
-
//
|
|
25899
|
+
// ../../switchroom-sec-1417/node_modules/.bun/structured-source@4.0.0/node_modules/structured-source/lib/structured-source.js
|
|
25900
25900
|
var require_structured_source = __commonJS((exports2) => {
|
|
25901
25901
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
25902
25902
|
exports2.StructuredSource = undefined;
|
|
@@ -25951,13 +25951,13 @@ var require_structured_source = __commonJS((exports2) => {
|
|
|
25951
25951
|
}
|
|
25952
25952
|
exports2.StructuredSource = StructuredSource;
|
|
25953
25953
|
});
|
|
25954
|
-
//
|
|
25954
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@secretlint+core@12.2.0/node_modules/@secretlint/core/module/SecretLintSourceCodeImpl.js
|
|
25955
25955
|
var import_structured_source;
|
|
25956
25956
|
var init_SecretLintSourceCodeImpl = __esm(() => {
|
|
25957
25957
|
import_structured_source = __toESM(require_structured_source(), 1);
|
|
25958
25958
|
});
|
|
25959
25959
|
|
|
25960
|
-
//
|
|
25960
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@secretlint+core@12.2.0/node_modules/@secretlint/core/module/helper/promise-event-emitter.js
|
|
25961
25961
|
class EventEmitter {
|
|
25962
25962
|
#listeners = new Map;
|
|
25963
25963
|
on(type, listener) {
|
|
@@ -25996,9 +25996,9 @@ class EventEmitter {
|
|
|
25996
25996
|
return Array.from(this.#listeners.get(type) ?? []);
|
|
25997
25997
|
}
|
|
25998
25998
|
}
|
|
25999
|
-
//
|
|
25999
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@secretlint+core@12.2.0/node_modules/@secretlint/core/module/RuleContext.js
|
|
26000
26000
|
var init_RuleContext = () => {};
|
|
26001
|
-
//
|
|
26001
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@secretlint+profiler@12.2.0/node_modules/@secretlint/profiler/module/index.js
|
|
26002
26002
|
class SecretLintProfiler {
|
|
26003
26003
|
perf;
|
|
26004
26004
|
entries = [];
|
|
@@ -26055,7 +26055,7 @@ class SecretLintProfiler {
|
|
|
26055
26055
|
}
|
|
26056
26056
|
}
|
|
26057
26057
|
|
|
26058
|
-
//
|
|
26058
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@secretlint+profiler@12.2.0/node_modules/@secretlint/profiler/module/node.js
|
|
26059
26059
|
import perf_hooks from "node:perf_hooks";
|
|
26060
26060
|
|
|
26061
26061
|
class NullPerformanceObserver {
|
|
@@ -26070,19 +26070,19 @@ var init_node = __esm(() => {
|
|
|
26070
26070
|
});
|
|
26071
26071
|
});
|
|
26072
26072
|
|
|
26073
|
-
//
|
|
26073
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@secretlint+core@12.2.0/node_modules/@secretlint/core/module/RunningEvents.js
|
|
26074
26074
|
var init_RunningEvents = __esm(() => {
|
|
26075
26075
|
init_node();
|
|
26076
26076
|
});
|
|
26077
26077
|
|
|
26078
|
-
//
|
|
26078
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@secretlint+core@12.2.0/node_modules/@secretlint/core/module/RulePresetContext.js
|
|
26079
26079
|
var init_RulePresetContext = __esm(() => {
|
|
26080
26080
|
init_RuleContext();
|
|
26081
26081
|
});
|
|
26082
|
-
//
|
|
26082
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@secretlint+core@12.2.0/node_modules/@secretlint/core/module/messages/index.js
|
|
26083
26083
|
var init_messages = () => {};
|
|
26084
26084
|
|
|
26085
|
-
//
|
|
26085
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@secretlint+core@12.2.0/node_modules/@secretlint/core/module/index.js
|
|
26086
26086
|
var import_debug, debug;
|
|
26087
26087
|
var init_module = __esm(() => {
|
|
26088
26088
|
init_SecretLintSourceCodeImpl();
|
|
@@ -26095,7 +26095,7 @@ var init_module = __esm(() => {
|
|
|
26095
26095
|
debug = import_debug.default("@secretlint/core");
|
|
26096
26096
|
});
|
|
26097
26097
|
|
|
26098
|
-
//
|
|
26098
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@secretlint+secretlint-rule-preset-recommend@12.2.0/node_modules/@secretlint/secretlint-rule-preset-recommend/module/index.js
|
|
26099
26099
|
function requireLodash_uniq() {
|
|
26100
26100
|
if (hasRequiredLodash_uniq)
|
|
26101
26101
|
return lodash_uniq;
|
|
@@ -27779,15 +27779,15 @@ var init_secretlint_source = __esm(() => {
|
|
|
27779
27779
|
});
|
|
27780
27780
|
|
|
27781
27781
|
// card-format.ts
|
|
27782
|
-
function
|
|
27782
|
+
function escapeHtml9(s) {
|
|
27783
27783
|
return s.replace(/[&<>]/g, (c) => ({ "&": "&", "<": "<", ">": ">" })[c]);
|
|
27784
27784
|
}
|
|
27785
|
-
function
|
|
27785
|
+
function truncate6(s, n) {
|
|
27786
27786
|
return s.length > n ? s.slice(0, n - 1) + "\u2026" : s;
|
|
27787
27787
|
}
|
|
27788
27788
|
|
|
27789
27789
|
// gateway/auth-line.ts
|
|
27790
|
-
function
|
|
27790
|
+
function escapeHtml10(s) {
|
|
27791
27791
|
return s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
27792
27792
|
}
|
|
27793
27793
|
function formatRelativeMs2(ms) {
|
|
@@ -27847,7 +27847,7 @@ function renderAuthLine(state4, agentName3, now = Date.now()) {
|
|
|
27847
27847
|
if (!acc)
|
|
27848
27848
|
continue;
|
|
27849
27849
|
const marker = label === activeLabel ? "\u25b6" : "\u21b3";
|
|
27850
|
-
const labelHtml = `<code>${
|
|
27850
|
+
const labelHtml = `<code>${escapeHtml10(acc.label)}</code>`;
|
|
27851
27851
|
const quotaLine = formatAuthQuotaLine(acc, now);
|
|
27852
27852
|
rows.push(quotaLine ? `${marker} ${labelHtml} ${quotaLine}` : `${marker} ${labelHtml}`);
|
|
27853
27853
|
}
|
|
@@ -27855,15 +27855,15 @@ function renderAuthLine(state4, agentName3, now = Date.now()) {
|
|
|
27855
27855
|
}
|
|
27856
27856
|
|
|
27857
27857
|
// gateway/quota-cache.ts
|
|
27858
|
-
import { existsSync as
|
|
27859
|
-
import { join as
|
|
27858
|
+
import { existsSync as existsSync24, readFileSync as readFileSync22, writeFileSync as writeFileSync13, mkdirSync as mkdirSync11 } from "fs";
|
|
27859
|
+
import { join as join21, dirname as dirname8 } from "path";
|
|
27860
27860
|
function defaultCachePath() {
|
|
27861
|
-
return process.env.SWITCHROOM_QUOTA_CACHE_PATH ??
|
|
27861
|
+
return process.env.SWITCHROOM_QUOTA_CACHE_PATH ?? join21(process.env.HOME ?? "/tmp", ".switchroom", "quota-cache.json");
|
|
27862
27862
|
}
|
|
27863
27863
|
function readQuotaCache(opts = {}) {
|
|
27864
27864
|
const path = opts.path ?? defaultCachePath();
|
|
27865
27865
|
const now = opts.now ?? Date.now();
|
|
27866
|
-
if (!
|
|
27866
|
+
if (!existsSync24(path))
|
|
27867
27867
|
return null;
|
|
27868
27868
|
let entry;
|
|
27869
27869
|
try {
|
|
@@ -27904,8 +27904,8 @@ var init_quota_cache = __esm(() => {
|
|
|
27904
27904
|
});
|
|
27905
27905
|
|
|
27906
27906
|
// gateway/boot-probes.ts
|
|
27907
|
-
import { readFileSync as readFileSync23, readdirSync as readdirSync4, existsSync as
|
|
27908
|
-
import { join as
|
|
27907
|
+
import { readFileSync as readFileSync23, readdirSync as readdirSync4, existsSync as existsSync25 } from "fs";
|
|
27908
|
+
import { join as join22 } from "path";
|
|
27909
27909
|
import { execFile as execFileCb } from "child_process";
|
|
27910
27910
|
import { promisify as promisify3 } from "util";
|
|
27911
27911
|
async function withTimeout(label, p, timeoutMs = PROBE_TIMEOUT_MS) {
|
|
@@ -27947,8 +27947,8 @@ function mapPlan(billingType, hasExtra) {
|
|
|
27947
27947
|
}
|
|
27948
27948
|
async function probeAccount(agentDir) {
|
|
27949
27949
|
return withTimeout("Account", (async () => {
|
|
27950
|
-
const claudeDir =
|
|
27951
|
-
const claudeJsonPath =
|
|
27950
|
+
const claudeDir = join22(agentDir, ".claude");
|
|
27951
|
+
const claudeJsonPath = join22(claudeDir, ".claude.json");
|
|
27952
27952
|
let cfg = {};
|
|
27953
27953
|
try {
|
|
27954
27954
|
const raw = readFileSync23(claudeJsonPath, "utf8");
|
|
@@ -27969,10 +27969,10 @@ async function probeAccount(agentDir) {
|
|
|
27969
27969
|
let tokenStr = "";
|
|
27970
27970
|
let status = "ok";
|
|
27971
27971
|
for (const candidate of [
|
|
27972
|
-
|
|
27973
|
-
|
|
27972
|
+
join22(claudeDir, ".oauth-token.meta.json"),
|
|
27973
|
+
join22(claudeDir, "accounts", "default", ".oauth-token.meta.json")
|
|
27974
27974
|
]) {
|
|
27975
|
-
if (
|
|
27975
|
+
if (existsSync25(candidate)) {
|
|
27976
27976
|
try {
|
|
27977
27977
|
const meta = JSON.parse(readFileSync23(candidate, "utf8"));
|
|
27978
27978
|
if (meta.expiresAt) {
|
|
@@ -28149,7 +28149,7 @@ async function resolveTmuxSupervisorPid(agentName3, execFileImpl) {
|
|
|
28149
28149
|
if (!cgroup)
|
|
28150
28150
|
return null;
|
|
28151
28151
|
const procsPath = `/sys/fs/cgroup${cgroup}/cgroup.procs`;
|
|
28152
|
-
if (!
|
|
28152
|
+
if (!existsSync25(procsPath))
|
|
28153
28153
|
return null;
|
|
28154
28154
|
const pidsRaw = readFileSync23(procsPath, "utf-8");
|
|
28155
28155
|
const pids = pidsRaw.split(`
|
|
@@ -28356,9 +28356,9 @@ async function probeQuota(claudeConfigDir, _agentDir, fetchImpl = fetch, opts =
|
|
|
28356
28356
|
let claudeDirForProbe = null;
|
|
28357
28357
|
for (const candidate of [
|
|
28358
28358
|
claudeConfigDir,
|
|
28359
|
-
|
|
28359
|
+
join22(claudeConfigDir, "accounts", "default")
|
|
28360
28360
|
]) {
|
|
28361
|
-
if (
|
|
28361
|
+
if (existsSync25(join22(candidate, ".oauth-token"))) {
|
|
28362
28362
|
claudeDirForProbe = candidate;
|
|
28363
28363
|
break;
|
|
28364
28364
|
}
|
|
@@ -28529,7 +28529,7 @@ async function probeUds(label, socketPath, opts = {}) {
|
|
|
28529
28529
|
}
|
|
28530
28530
|
return withTimeout(label, (async () => {
|
|
28531
28531
|
if (!opts.connectImpl) {
|
|
28532
|
-
if (!
|
|
28532
|
+
if (!existsSync25(socketPath)) {
|
|
28533
28533
|
return {
|
|
28534
28534
|
status: "fail",
|
|
28535
28535
|
label,
|
|
@@ -28593,7 +28593,7 @@ async function probeSkills(agentDir, opts = {}) {
|
|
|
28593
28593
|
return withTimeout("Skills", (async () => {
|
|
28594
28594
|
const fs2 = opts.fs ?? realSkillsFs;
|
|
28595
28595
|
const max = opts.maxNamesShown ?? 3;
|
|
28596
|
-
const skillsDir =
|
|
28596
|
+
const skillsDir = join22(agentDir, ".claude", "skills");
|
|
28597
28597
|
if (!fs2.exists(skillsDir)) {
|
|
28598
28598
|
return { status: "ok", label: "Skills", detail: "no skills dir" };
|
|
28599
28599
|
}
|
|
@@ -28608,17 +28608,17 @@ async function probeSkills(agentDir, opts = {}) {
|
|
|
28608
28608
|
}
|
|
28609
28609
|
const dangling = [];
|
|
28610
28610
|
for (const name of entries) {
|
|
28611
|
-
const skillPath =
|
|
28611
|
+
const skillPath = join22(skillsDir, name);
|
|
28612
28612
|
if (!fs2.exists(skillPath)) {
|
|
28613
28613
|
dangling.push(name);
|
|
28614
28614
|
continue;
|
|
28615
28615
|
}
|
|
28616
|
-
const skillMd =
|
|
28616
|
+
const skillMd = join22(skillPath, "SKILL.md");
|
|
28617
28617
|
if (!fs2.exists(skillMd) && !fs2.exists(skillPath + ".md")) {
|
|
28618
28618
|
continue;
|
|
28619
28619
|
}
|
|
28620
28620
|
}
|
|
28621
|
-
const overlayDir = opts.overlaySkillsDir ??
|
|
28621
|
+
const overlayDir = opts.overlaySkillsDir ?? join22(agentDir, "skills.d");
|
|
28622
28622
|
const overlaySlugs = new Set;
|
|
28623
28623
|
if (fs2.exists(overlayDir)) {
|
|
28624
28624
|
let overlayEntries = [];
|
|
@@ -28673,16 +28673,16 @@ var init_boot_probes = __esm(() => {
|
|
|
28673
28673
|
const { statSync: statSync7 } = __require("fs");
|
|
28674
28674
|
return statSync7(p).mtimeMs;
|
|
28675
28675
|
},
|
|
28676
|
-
exists: (p) =>
|
|
28676
|
+
exists: (p) => existsSync25(p)
|
|
28677
28677
|
};
|
|
28678
28678
|
realSkillsFs = {
|
|
28679
28679
|
readdir: (p) => readdirSync4(p),
|
|
28680
|
-
exists: (p) =>
|
|
28680
|
+
exists: (p) => existsSync25(p)
|
|
28681
28681
|
};
|
|
28682
28682
|
});
|
|
28683
28683
|
|
|
28684
28684
|
// gateway/boot-issue-cache.ts
|
|
28685
|
-
import { existsSync as
|
|
28685
|
+
import { existsSync as existsSync26, readFileSync as readFileSync24, writeFileSync as writeFileSync14, mkdirSync as mkdirSync12, renameSync as renameSync9 } from "fs";
|
|
28686
28686
|
import { dirname as dirname9 } from "path";
|
|
28687
28687
|
function fingerprintProbe(key, r) {
|
|
28688
28688
|
if (r.status === "ok")
|
|
@@ -28762,7 +28762,7 @@ function diffProbes(probes, cache, opts = {}) {
|
|
|
28762
28762
|
return out;
|
|
28763
28763
|
}
|
|
28764
28764
|
function loadCache(path, now = Date.now) {
|
|
28765
|
-
if (!
|
|
28765
|
+
if (!existsSync26(path))
|
|
28766
28766
|
return { ...EMPTY_CACHE, probes: {} };
|
|
28767
28767
|
let raw;
|
|
28768
28768
|
try {
|
|
@@ -28833,7 +28833,7 @@ __export(exports_boot_card, {
|
|
|
28833
28833
|
renderBootCard: () => renderBootCard,
|
|
28834
28834
|
renderAccountRows: () => renderAuthLine
|
|
28835
28835
|
});
|
|
28836
|
-
import { join as
|
|
28836
|
+
import { join as join23 } from "path";
|
|
28837
28837
|
function resolvePersonaName(slug, loadConfig3) {
|
|
28838
28838
|
try {
|
|
28839
28839
|
const config = loadConfig3 ? loadConfig3() : loadConfig();
|
|
@@ -28858,14 +28858,14 @@ function shouldSkipDuplicateBootCard(gate, site) {
|
|
|
28858
28858
|
function renderNextStep(text) {
|
|
28859
28859
|
const parts = text.split("`");
|
|
28860
28860
|
if (parts.length % 2 === 0)
|
|
28861
|
-
return
|
|
28862
|
-
return parts.map((p, i) => i % 2 === 0 ?
|
|
28861
|
+
return escapeHtml9(text);
|
|
28862
|
+
return parts.map((p, i) => i % 2 === 0 ? escapeHtml9(p) : `<code>${escapeHtml9(p)}</code>`).join("");
|
|
28863
28863
|
}
|
|
28864
28864
|
function renderBootCard(opts) {
|
|
28865
28865
|
const { agentName: agentName3, version: version2, probes, restartReason, restartAgeMs } = opts;
|
|
28866
28866
|
const agentSlug = opts.agentSlug ?? agentName3;
|
|
28867
28867
|
const ackEmoji = restartReason ? REASON_EMOJI[restartReason] : "\u2705";
|
|
28868
|
-
const ack = `${ackEmoji} <b>${
|
|
28868
|
+
const ack = `${ackEmoji} <b>${escapeHtml9(agentName3)}</b> back up \u00b7 ${escapeHtml9(version2)}`;
|
|
28869
28869
|
const degradedRows = [];
|
|
28870
28870
|
const snoozeSet = new Set(opts.snoozeRows ?? []);
|
|
28871
28871
|
if (opts.resolvedRows && opts.resolvedRows.length > 0) {
|
|
@@ -28873,13 +28873,13 @@ function renderBootCard(opts) {
|
|
|
28873
28873
|
const lbl = PROBE_LABELS[key];
|
|
28874
28874
|
if (!lbl)
|
|
28875
28875
|
continue;
|
|
28876
|
-
degradedRows.push(`\u2705 <b>${
|
|
28876
|
+
degradedRows.push(`\u2705 <b>${escapeHtml9(lbl)}</b> resolved`);
|
|
28877
28877
|
}
|
|
28878
28878
|
}
|
|
28879
28879
|
if (restartReason === "crash") {
|
|
28880
28880
|
const ageStr = restartAgeMs != null && restartAgeMs > 0 ? ` \u00b7 ${(restartAgeMs / 1000).toFixed(1)}s ago` : "";
|
|
28881
|
-
degradedRows.push(`\u26a0\ufe0f <b>Restart</b> ${
|
|
28882
|
-
const tailCmd = process.env.SWITCHROOM_RUNTIME === "docker" ? `docker logs --tail 100 switchroom-${
|
|
28881
|
+
degradedRows.push(`\u26a0\ufe0f <b>Restart</b> ${escapeHtml9(REASON_LABEL.crash)}${ageStr}`);
|
|
28882
|
+
const tailCmd = process.env.SWITCHROOM_RUNTIME === "docker" ? `docker logs --tail 100 switchroom-${escapeHtml9(agentSlug)}` : `journalctl --user -u switchroom-${escapeHtml9(agentSlug)} -n 100`;
|
|
28883
28883
|
degradedRows.push(` \u21b3 Tail logs: <code>${tailCmd}</code>`);
|
|
28884
28884
|
}
|
|
28885
28885
|
if (probes) {
|
|
@@ -28892,7 +28892,7 @@ function renderBootCard(opts) {
|
|
|
28892
28892
|
if (snoozeSet.has(key))
|
|
28893
28893
|
continue;
|
|
28894
28894
|
const dot = DOT[r.status] ?? DOT.fail;
|
|
28895
|
-
degradedRows.push(`${dot} <b>${PROBE_LABELS[key]}</b> ${
|
|
28895
|
+
degradedRows.push(`${dot} <b>${PROBE_LABELS[key]}</b> ${escapeHtml9(r.detail)}`);
|
|
28896
28896
|
if (r.nextStep) {
|
|
28897
28897
|
degradedRows.push(` \u21b3 ${renderNextStep(r.nextStep)}`);
|
|
28898
28898
|
}
|
|
@@ -28914,7 +28914,7 @@ function renderBootCard(opts) {
|
|
|
28914
28914
|
`);
|
|
28915
28915
|
}
|
|
28916
28916
|
async function runAllProbes(opts) {
|
|
28917
|
-
const claudeDir =
|
|
28917
|
+
const claudeDir = join23(opts.agentDir, ".claude");
|
|
28918
28918
|
const probes = {};
|
|
28919
28919
|
const slug = opts.agentSlug ?? opts.agentName;
|
|
28920
28920
|
await Promise.allSettled([
|
|
@@ -29158,10 +29158,10 @@ import { randomBytes as randomBytes5, scryptSync, createCipheriv, createDecipher
|
|
|
29158
29158
|
import {
|
|
29159
29159
|
readFileSync as readFileSync31,
|
|
29160
29160
|
writeFileSync as writeFileSync19,
|
|
29161
|
-
existsSync as
|
|
29161
|
+
existsSync as existsSync33,
|
|
29162
29162
|
renameSync as renameSync11,
|
|
29163
29163
|
mkdirSync as mkdirSync18,
|
|
29164
|
-
unlinkSync as
|
|
29164
|
+
unlinkSync as unlinkSync13,
|
|
29165
29165
|
lstatSync,
|
|
29166
29166
|
realpathSync
|
|
29167
29167
|
} from "node:fs";
|
|
@@ -29196,7 +29196,7 @@ function normalizeSecrets(raw) {
|
|
|
29196
29196
|
return out;
|
|
29197
29197
|
}
|
|
29198
29198
|
function openVault(passphrase, vaultPath) {
|
|
29199
|
-
if (!
|
|
29199
|
+
if (!existsSync33(vaultPath)) {
|
|
29200
29200
|
throw new VaultError(`Vault file not found: ${vaultPath}`);
|
|
29201
29201
|
}
|
|
29202
29202
|
let vaultFile;
|
|
@@ -29247,15 +29247,15 @@ var init_vault = __esm(() => {
|
|
|
29247
29247
|
// ../src/vault/resolver.ts
|
|
29248
29248
|
import {
|
|
29249
29249
|
chmodSync as chmodSync4,
|
|
29250
|
-
closeSync as
|
|
29250
|
+
closeSync as closeSync8,
|
|
29251
29251
|
mkdirSync as mkdirSync19,
|
|
29252
29252
|
mkdtempSync as mkdtempSync2,
|
|
29253
|
-
openSync as
|
|
29253
|
+
openSync as openSync8,
|
|
29254
29254
|
rmSync as rmSync3,
|
|
29255
29255
|
statSync as statSync11,
|
|
29256
29256
|
writeSync as writeSync2
|
|
29257
29257
|
} from "node:fs";
|
|
29258
|
-
import { join as
|
|
29258
|
+
import { join as join32 } from "node:path";
|
|
29259
29259
|
import { tmpdir } from "node:os";
|
|
29260
29260
|
import { constants as fsConstants } from "node:fs";
|
|
29261
29261
|
function isVaultReference(value) {
|
|
@@ -29307,26 +29307,26 @@ function materializationRoot() {
|
|
|
29307
29307
|
return cachedRoot;
|
|
29308
29308
|
const xdg = process.env.XDG_RUNTIME_DIR;
|
|
29309
29309
|
if (xdg) {
|
|
29310
|
-
const base =
|
|
29310
|
+
const base = join32(xdg, "switchroom", "vault");
|
|
29311
29311
|
mkdirSync19(base, { recursive: true, mode: 448 });
|
|
29312
|
-
cachedRoot = mkdtempSync2(
|
|
29312
|
+
cachedRoot = mkdtempSync2(join32(base, "run-"));
|
|
29313
29313
|
} else {
|
|
29314
|
-
cachedRoot = mkdtempSync2(
|
|
29314
|
+
cachedRoot = mkdtempSync2(join32(tmpdir(), "switchroom-vault-"));
|
|
29315
29315
|
}
|
|
29316
29316
|
chmodSync4(cachedRoot, 448);
|
|
29317
29317
|
return cachedRoot;
|
|
29318
29318
|
}
|
|
29319
29319
|
function writeFileExclusive(filePath, content) {
|
|
29320
29320
|
const buf = typeof content === "string" ? Buffer.from(content, "utf8") : content;
|
|
29321
|
-
const fd =
|
|
29321
|
+
const fd = openSync8(filePath, fsConstants.O_WRONLY | fsConstants.O_CREAT | fsConstants.O_EXCL, 384);
|
|
29322
29322
|
try {
|
|
29323
29323
|
writeSync2(fd, buf);
|
|
29324
29324
|
} finally {
|
|
29325
|
-
|
|
29325
|
+
closeSync8(fd);
|
|
29326
29326
|
}
|
|
29327
29327
|
}
|
|
29328
29328
|
function materializeFilesEntry(key, files) {
|
|
29329
|
-
const dir =
|
|
29329
|
+
const dir = join32(materializationRoot(), key);
|
|
29330
29330
|
if (materializedDirs.has(dir)) {
|
|
29331
29331
|
try {
|
|
29332
29332
|
rmSync3(dir, { recursive: true, force: true });
|
|
@@ -29342,7 +29342,7 @@ function materializeFilesEntry(key, files) {
|
|
|
29342
29342
|
if (filename.includes("/") || filename.includes("\\") || filename === ".." || filename === "." || filename.includes("\x00")) {
|
|
29343
29343
|
throw new Error(`Refusing to materialize vault file with unsafe name: ${filename}`);
|
|
29344
29344
|
}
|
|
29345
|
-
const filePath =
|
|
29345
|
+
const filePath = join32(dir, filename);
|
|
29346
29346
|
const content = encoding === "base64" ? Buffer.from(value, "base64") : value;
|
|
29347
29347
|
writeFileExclusive(filePath, content);
|
|
29348
29348
|
}
|
|
@@ -29475,7 +29475,7 @@ __export(exports_materialize_bot_token, {
|
|
|
29475
29475
|
materializeBotToken: () => materializeBotToken,
|
|
29476
29476
|
BotTokenMaterializeError: () => BotTokenMaterializeError
|
|
29477
29477
|
});
|
|
29478
|
-
import { existsSync as
|
|
29478
|
+
import { existsSync as existsSync34 } from "node:fs";
|
|
29479
29479
|
function pickConfiguredToken(config, agentName3) {
|
|
29480
29480
|
if (agentName3) {
|
|
29481
29481
|
const agent = config.agents?.[agentName3];
|
|
@@ -29489,7 +29489,7 @@ function tryDirectVaultRead(ref, config, passphrase) {
|
|
|
29489
29489
|
if (!passphrase)
|
|
29490
29490
|
return null;
|
|
29491
29491
|
const vaultPath = resolvePath(config.vault?.path ?? "~/.switchroom/vault.enc");
|
|
29492
|
-
if (!
|
|
29492
|
+
if (!existsSync34(vaultPath))
|
|
29493
29493
|
return null;
|
|
29494
29494
|
try {
|
|
29495
29495
|
const secrets = openVault(passphrase, vaultPath);
|
|
@@ -29607,7 +29607,7 @@ function truncateDiffForCard(unifiedDiff, maxLines = 50, maxChars = 3000) {
|
|
|
29607
29607
|
}
|
|
29608
29608
|
return out === unifiedDiff ? out : out + sentinel;
|
|
29609
29609
|
}
|
|
29610
|
-
function
|
|
29610
|
+
function escapeHtml12(s) {
|
|
29611
29611
|
return s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
29612
29612
|
}
|
|
29613
29613
|
function clipReason(reason) {
|
|
@@ -29618,10 +29618,10 @@ function clipReason(reason) {
|
|
|
29618
29618
|
function buildConfigApprovalCardBody(args) {
|
|
29619
29619
|
const safeReason = clipReason(args.reason);
|
|
29620
29620
|
const render = (diff) => `\uD83D\uDEE0 <b>Config edit proposed</b>
|
|
29621
|
-
` + `Agent: <code>${
|
|
29622
|
-
` + `Reason: ${
|
|
29621
|
+
` + `Agent: <code>${escapeHtml12(args.agentName)}</code>
|
|
29622
|
+
` + `Reason: ${escapeHtml12(safeReason)}
|
|
29623
29623
|
|
|
29624
|
-
` + `<pre>${
|
|
29624
|
+
` + `<pre>${escapeHtml12(diff)}</pre>`;
|
|
29625
29625
|
return truncateRawToFit({
|
|
29626
29626
|
raw: args.unifiedDiff,
|
|
29627
29627
|
render,
|
|
@@ -29728,8 +29728,8 @@ async function handleRequestConfigFinalize(_client, msg, deps) {
|
|
|
29728
29728
|
}
|
|
29729
29729
|
pending.delete(msg.requestId);
|
|
29730
29730
|
const body = msg.outcome === "applied" ? `\u2705 <b>Applied</b>${msg.detail ? `
|
|
29731
|
-
${
|
|
29732
|
-
${
|
|
29731
|
+
${escapeHtml12(msg.detail)}` : ""}` : `\u26a0\ufe0f <b>Reconcile failed; rolled back</b>${msg.detail ? `
|
|
29732
|
+
${escapeHtml12(msg.detail)}` : ""}`;
|
|
29733
29733
|
try {
|
|
29734
29734
|
await deps.editCard({
|
|
29735
29735
|
chatId: entry.chatId,
|
|
@@ -29794,7 +29794,7 @@ __export(exports_tmux, {
|
|
|
29794
29794
|
captureAgentPane: () => captureAgentPane
|
|
29795
29795
|
});
|
|
29796
29796
|
import { execFileSync as execFileSync4 } from "node:child_process";
|
|
29797
|
-
import { mkdirSync as mkdirSync20, readdirSync as readdirSync6, statSync as statSync12, unlinkSync as
|
|
29797
|
+
import { mkdirSync as mkdirSync20, readdirSync as readdirSync6, statSync as statSync12, unlinkSync as unlinkSync14, writeFileSync as writeFileSync20 } from "node:fs";
|
|
29798
29798
|
import { resolve as resolve7 } from "node:path";
|
|
29799
29799
|
function captureAgentPane(opts) {
|
|
29800
29800
|
const { agentName: agentName3, agentDir, reason } = opts;
|
|
@@ -29908,7 +29908,7 @@ function pruneOldReports(dir, retain) {
|
|
|
29908
29908
|
}).sort((a, b) => b.mtimeMs - a.mtimeMs);
|
|
29909
29909
|
for (const stale of files.slice(retain)) {
|
|
29910
29910
|
try {
|
|
29911
|
-
|
|
29911
|
+
unlinkSync14(stale.full);
|
|
29912
29912
|
} catch {}
|
|
29913
29913
|
}
|
|
29914
29914
|
}
|
|
@@ -29999,17 +29999,17 @@ function registerApprovalsCommands(bot, opts) {
|
|
|
29999
29999
|
return;
|
|
30000
30000
|
}
|
|
30001
30001
|
if (decisions.length === 0) {
|
|
30002
|
-
await ctx.reply(agentFilter ? `No active approvals for <code>${
|
|
30002
|
+
await ctx.reply(agentFilter ? `No active approvals for <code>${escapeHtml13(agentFilter)}</code>.` : "No active approvals.", { parse_mode: "HTML" });
|
|
30003
30003
|
return;
|
|
30004
30004
|
}
|
|
30005
30005
|
const byAgent = new Map;
|
|
30006
30006
|
for (const d of decisions)
|
|
30007
30007
|
byAgent.set(d.agent_unit, (byAgent.get(d.agent_unit) ?? 0) + 1);
|
|
30008
|
-
const summary = Array.from(byAgent.entries()).map(([a, n]) => `\u2022 <b>${
|
|
30008
|
+
const summary = Array.from(byAgent.entries()).map(([a, n]) => `\u2022 <b>${escapeHtml13(a)}</b>: ${n}`).join(`
|
|
30009
30009
|
`);
|
|
30010
30010
|
const detail = decisions.slice(0, 20).map((d) => {
|
|
30011
30011
|
const ttl = d.ttl_expires_at === null ? "always" : `until ${new Date(d.ttl_expires_at).toISOString().slice(0, 16).replace("T", " ")}`;
|
|
30012
|
-
return `<code>${
|
|
30012
|
+
return `<code>${escapeHtml13(d.id.slice(0, 8))}</code> ` + `${escapeHtml13(d.agent_unit)} \u2192 ` + `<code>${escapeHtml13(d.scope)}</code> ` + `(${escapeHtml13(d.action)}, ${ttl}) ` + `\u00b7 /approvals revoke ${escapeHtml13(d.id)}`;
|
|
30013
30013
|
}).join(`
|
|
30014
30014
|
`);
|
|
30015
30015
|
await ctx.reply(`<b>Active approvals</b>
|
|
@@ -30035,13 +30035,13 @@ ${detail}`, {
|
|
|
30035
30035
|
await ctx.reply("Approval kernel unreachable.");
|
|
30036
30036
|
return;
|
|
30037
30037
|
}
|
|
30038
|
-
await ctx.reply(ok ? `Revoked <code>${
|
|
30038
|
+
await ctx.reply(ok ? `Revoked <code>${escapeHtml13(id)}</code>.` : `No such active decision <code>${escapeHtml13(id)}</code>.`, { parse_mode: "HTML" });
|
|
30039
30039
|
return;
|
|
30040
30040
|
}
|
|
30041
|
-
await ctx.reply(`Unknown subcommand <code>${
|
|
30041
|
+
await ctx.reply(`Unknown subcommand <code>${escapeHtml13(sub)}</code>. ` + `Use <code>/approvals list</code> or <code>/approvals revoke <id></code>. ` + `(<code>add</code> and <code>stats</code> are coming in a follow-up.)`, { parse_mode: "HTML" });
|
|
30042
30042
|
});
|
|
30043
30043
|
}
|
|
30044
|
-
function
|
|
30044
|
+
function escapeHtml13(s) {
|
|
30045
30045
|
return s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
30046
30046
|
}
|
|
30047
30047
|
var init_approvals_commands = __esm(() => {
|
|
@@ -30123,16 +30123,16 @@ function renderAccountRow2(snap, opts) {
|
|
|
30123
30123
|
const lines = [];
|
|
30124
30124
|
const marker = snap.isActive ? "\u25cf " : "";
|
|
30125
30125
|
if (!snap.quota) {
|
|
30126
|
-
lines.push(`${marker}<code>${
|
|
30126
|
+
lines.push(`${marker}<code>${escapeHtml14(snap.label)}</code> <i>quota probe failed</i>`);
|
|
30127
30127
|
if (snap.quotaError) {
|
|
30128
|
-
lines.push(` <i>${
|
|
30128
|
+
lines.push(` <i>${escapeHtml14(snap.quotaError)}</i>`);
|
|
30129
30129
|
}
|
|
30130
30130
|
return lines;
|
|
30131
30131
|
}
|
|
30132
30132
|
const q = snap.quota;
|
|
30133
30133
|
const fiveStr = fmtPct2(q.fiveHourUtilizationPct);
|
|
30134
30134
|
const sevenStr = fmtPct2(q.sevenDayUtilizationPct);
|
|
30135
|
-
lines.push(`${marker}<code>${
|
|
30135
|
+
lines.push(`${marker}<code>${escapeHtml14(snap.label)}</code> ${fiveStr} / ${sevenStr}`);
|
|
30136
30136
|
const health = classifyHealth2(snap);
|
|
30137
30137
|
if (health === "blocked") {
|
|
30138
30138
|
const win = bindingWindow2(q);
|
|
@@ -30238,13 +30238,13 @@ function renderFallbackAnnouncement2(input) {
|
|
|
30238
30238
|
const limitWord = input.oldQuota ? limitWordFor2(input.oldQuota) : "quota";
|
|
30239
30239
|
const headerLimit = limitWord === "quota" ? "quota cap" : `${limitWord} limit`;
|
|
30240
30240
|
if (!input.newLabel) {
|
|
30241
|
-
lines.push(`\uD83D\uDD34 <b>All accounts blocked \u00b7 ${headerLimit} on ${
|
|
30241
|
+
lines.push(`\uD83D\uDD34 <b>All accounts blocked \u00b7 ${headerLimit} on ${escapeHtml14(input.oldLabel)}</b>`);
|
|
30242
30242
|
lines.push("");
|
|
30243
|
-
lines.push(`Triggered by: agent <b>${
|
|
30243
|
+
lines.push(`Triggered by: agent <b>${escapeHtml14(input.triggerAgent)}</b>`);
|
|
30244
30244
|
if (input.oldQuota) {
|
|
30245
30245
|
const recovery = recoveryAtFor2(input.oldQuota);
|
|
30246
30246
|
if (recovery) {
|
|
30247
|
-
lines.push(`${
|
|
30247
|
+
lines.push(`${escapeHtml14(input.oldLabel)} recovers ${formatAbsolute2(recovery, tz)} ` + `(in ${formatRelative2(recovery, now)})`);
|
|
30248
30248
|
}
|
|
30249
30249
|
}
|
|
30250
30250
|
lines.push("");
|
|
@@ -30252,15 +30252,15 @@ function renderFallbackAnnouncement2(input) {
|
|
|
30252
30252
|
return lines.join(`
|
|
30253
30253
|
`);
|
|
30254
30254
|
}
|
|
30255
|
-
lines.push(`\u2713 <b>Switched fleet \u00b7 ${headerLimit} on ${
|
|
30255
|
+
lines.push(`\u2713 <b>Switched fleet \u00b7 ${headerLimit} on ${escapeHtml14(input.oldLabel)}</b>`);
|
|
30256
30256
|
lines.push("");
|
|
30257
|
-
lines.push(`<code>${
|
|
30258
|
-
lines.push(`Triggered by: agent <b>${
|
|
30257
|
+
lines.push(`<code>${escapeHtml14(input.oldLabel)}</code> \u2192 <code>${escapeHtml14(input.newLabel)}</code>`);
|
|
30258
|
+
lines.push(`Triggered by: agent <b>${escapeHtml14(input.triggerAgent)}</b>`);
|
|
30259
30259
|
lines.push("");
|
|
30260
30260
|
if (input.oldQuota) {
|
|
30261
30261
|
const recovery = recoveryAtFor2(input.oldQuota);
|
|
30262
30262
|
if (recovery) {
|
|
30263
|
-
lines.push(`<code>${
|
|
30263
|
+
lines.push(`<code>${escapeHtml14(input.oldLabel)}</code> recovers ` + `${formatAbsolute2(recovery, tz)} (in ${formatRelative2(recovery, now)})`);
|
|
30264
30264
|
}
|
|
30265
30265
|
}
|
|
30266
30266
|
if (input.newQuota) {
|
|
@@ -30268,7 +30268,7 @@ function renderFallbackAnnouncement2(input) {
|
|
|
30268
30268
|
const sevenStr = fmtPct2(input.newQuota.sevenDayUtilizationPct);
|
|
30269
30269
|
const hasHeadroom = input.newQuota.fiveHourUtilizationPct < THROTTLING_THRESHOLD_PCT2 && input.newQuota.sevenDayUtilizationPct < THROTTLING_THRESHOLD_PCT2;
|
|
30270
30270
|
const headroomStr = hasHeadroom ? "<i>(plenty of headroom)</i>" : "<i>(near limit \u2014 watch this)</i>";
|
|
30271
|
-
lines.push(`<code>${
|
|
30271
|
+
lines.push(`<code>${escapeHtml14(input.newLabel)}</code> now: ${fiveStr} of 5h \u00b7 ${sevenStr} of 7d ${headroomStr}`);
|
|
30272
30272
|
} else {
|
|
30273
30273
|
lines.push(`<i>(quota probe for new account is pending \u2014 will reflect on next /auth)</i>`);
|
|
30274
30274
|
}
|
|
@@ -30327,7 +30327,7 @@ function switchPriority2(s) {
|
|
|
30327
30327
|
return 2;
|
|
30328
30328
|
return 3;
|
|
30329
30329
|
}
|
|
30330
|
-
function
|
|
30330
|
+
function escapeHtml14(s) {
|
|
30331
30331
|
return s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
30332
30332
|
}
|
|
30333
30333
|
function buildSnapshotsFromState2(state4, quotas) {
|
|
@@ -30504,14 +30504,14 @@ import {
|
|
|
30504
30504
|
renameSync as renameSync12,
|
|
30505
30505
|
realpathSync as realpathSync2,
|
|
30506
30506
|
chmodSync as chmodSync5,
|
|
30507
|
-
openSync as
|
|
30508
|
-
closeSync as
|
|
30509
|
-
existsSync as
|
|
30510
|
-
unlinkSync as
|
|
30507
|
+
openSync as openSync9,
|
|
30508
|
+
closeSync as closeSync9,
|
|
30509
|
+
existsSync as existsSync35,
|
|
30510
|
+
unlinkSync as unlinkSync15,
|
|
30511
30511
|
appendFileSync as appendFileSync3
|
|
30512
30512
|
} from "fs";
|
|
30513
30513
|
import { homedir as homedir12 } from "os";
|
|
30514
|
-
import { join as
|
|
30514
|
+
import { join as join33, extname, sep as sep3, basename as basename8 } from "path";
|
|
30515
30515
|
|
|
30516
30516
|
// plugin-logger.ts
|
|
30517
30517
|
import { appendFileSync, mkdirSync, renameSync, statSync, existsSync } from "fs";
|
|
@@ -31755,6 +31755,264 @@ function prettifyServer(name) {
|
|
|
31755
31755
|
return name.charAt(0).toUpperCase() + name.slice(1);
|
|
31756
31756
|
}
|
|
31757
31757
|
|
|
31758
|
+
// tool-intent-surface.ts
|
|
31759
|
+
var MAX_LABEL_LEN = 140;
|
|
31760
|
+
function frameworkVerbFor(toolName) {
|
|
31761
|
+
const m = /^mcp__[^_]+__(.+)$/.exec(toolName);
|
|
31762
|
+
const suffix = (m ? m[1] : toolName).toLowerCase();
|
|
31763
|
+
switch (suffix) {
|
|
31764
|
+
case "bash":
|
|
31765
|
+
case "bashoutput":
|
|
31766
|
+
case "killshell":
|
|
31767
|
+
return "running";
|
|
31768
|
+
case "websearch":
|
|
31769
|
+
case "grep":
|
|
31770
|
+
case "glob":
|
|
31771
|
+
return "searching";
|
|
31772
|
+
case "webfetch":
|
|
31773
|
+
return "fetching";
|
|
31774
|
+
case "read":
|
|
31775
|
+
return "reading";
|
|
31776
|
+
case "write":
|
|
31777
|
+
return "writing";
|
|
31778
|
+
case "edit":
|
|
31779
|
+
case "multiedit":
|
|
31780
|
+
case "notebookedit":
|
|
31781
|
+
return "editing";
|
|
31782
|
+
case "todowrite":
|
|
31783
|
+
case "todoread":
|
|
31784
|
+
return "noting";
|
|
31785
|
+
case "task":
|
|
31786
|
+
case "agent":
|
|
31787
|
+
return "dispatching";
|
|
31788
|
+
case "toolsearch":
|
|
31789
|
+
return "loading tools";
|
|
31790
|
+
default:
|
|
31791
|
+
if (m)
|
|
31792
|
+
return `using ${m[1].replace(/_/g, " ")}`;
|
|
31793
|
+
return `using ${toolName}`;
|
|
31794
|
+
}
|
|
31795
|
+
}
|
|
31796
|
+
function isUserFacingTool(toolName) {
|
|
31797
|
+
const m = /^mcp__switchroom-telegram__(.+)$/.exec(toolName);
|
|
31798
|
+
const suffix = m ? m[1] : toolName;
|
|
31799
|
+
return suffix === "reply" || suffix === "stream_reply" || suffix === "edit_message" || suffix === "react" || suffix === "send_typing" || suffix === "pin_message" || suffix === "delete_message" || suffix === "forward_message" || suffix === "download_attachment" || suffix === "get_recent_messages" || suffix === "progress_update";
|
|
31800
|
+
}
|
|
31801
|
+
function deriveIntentSurface(toolName, toolInput, precomputedLabel) {
|
|
31802
|
+
if (!toolName)
|
|
31803
|
+
return { text: null };
|
|
31804
|
+
if (isUserFacingTool(toolName))
|
|
31805
|
+
return { text: null };
|
|
31806
|
+
const label = toolLabel(toolName, toolInput, undefined, precomputedLabel);
|
|
31807
|
+
if (!label || !label.trim()) {
|
|
31808
|
+
return {
|
|
31809
|
+
text: `<i>${escapeHtml(frameworkVerbFor(toolName))}</i>`
|
|
31810
|
+
};
|
|
31811
|
+
}
|
|
31812
|
+
const verb = frameworkVerbFor(toolName);
|
|
31813
|
+
const safeLabel = escapeHtml(label).slice(0, MAX_LABEL_LEN);
|
|
31814
|
+
return { text: `<i>${escapeHtml(verb)}:</i> ${safeLabel}` };
|
|
31815
|
+
}
|
|
31816
|
+
function escapeHtml(s) {
|
|
31817
|
+
return s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
31818
|
+
}
|
|
31819
|
+
|
|
31820
|
+
// tool-labels.ts
|
|
31821
|
+
var MAX_LABEL_CHARS2 = 60;
|
|
31822
|
+
var MAX_BASH_CHARS2 = 40;
|
|
31823
|
+
var MAX_DESCRIPTION_CHARS2 = 160;
|
|
31824
|
+
function basename2(p) {
|
|
31825
|
+
if (!p)
|
|
31826
|
+
return "";
|
|
31827
|
+
const parts = p.split("/").filter(Boolean);
|
|
31828
|
+
return parts.length > 0 ? parts[parts.length - 1] : p;
|
|
31829
|
+
}
|
|
31830
|
+
function shortenGrepPath2(p) {
|
|
31831
|
+
if (!p)
|
|
31832
|
+
return "repo";
|
|
31833
|
+
const hadTrailingSlash = /\/+$/.test(p);
|
|
31834
|
+
const trimmed = p.replace(/\/+$/, "");
|
|
31835
|
+
const parts = trimmed.split("/").filter(Boolean);
|
|
31836
|
+
if (parts.length === 0)
|
|
31837
|
+
return "repo";
|
|
31838
|
+
const last = parts[parts.length - 1];
|
|
31839
|
+
if (hadTrailingSlash)
|
|
31840
|
+
return `${last}/`;
|
|
31841
|
+
if (last.startsWith(".") && !last.slice(1).includes("."))
|
|
31842
|
+
return last;
|
|
31843
|
+
if (!last.includes("."))
|
|
31844
|
+
return `${last}/`;
|
|
31845
|
+
return last;
|
|
31846
|
+
}
|
|
31847
|
+
function hostFromUrl2(u) {
|
|
31848
|
+
if (!u)
|
|
31849
|
+
return "";
|
|
31850
|
+
try {
|
|
31851
|
+
return new URL(u).host;
|
|
31852
|
+
} catch {
|
|
31853
|
+
return truncate2(u);
|
|
31854
|
+
}
|
|
31855
|
+
}
|
|
31856
|
+
function truncate2(s, n = MAX_LABEL_CHARS2) {
|
|
31857
|
+
if (s.length <= n)
|
|
31858
|
+
return s;
|
|
31859
|
+
return s.slice(0, n - 1) + "\u2026";
|
|
31860
|
+
}
|
|
31861
|
+
function stripHtml2(s) {
|
|
31862
|
+
return s.replace(/<\/?[a-zA-Z][^>]*>/g, "");
|
|
31863
|
+
}
|
|
31864
|
+
function firstLine2(s) {
|
|
31865
|
+
const idx = s.indexOf(`
|
|
31866
|
+
`);
|
|
31867
|
+
return idx === -1 ? s : s.slice(0, idx);
|
|
31868
|
+
}
|
|
31869
|
+
function toolLabel2(tool, input, preamble, precomputedLabel) {
|
|
31870
|
+
if (precomputedLabel && precomputedLabel.trim().length > 0) {
|
|
31871
|
+
return truncate2(firstLine2(precomputedLabel.trim()), MAX_DESCRIPTION_CHARS2);
|
|
31872
|
+
}
|
|
31873
|
+
if (!input || typeof input !== "object")
|
|
31874
|
+
return "";
|
|
31875
|
+
const str = (k) => typeof input[k] === "string" ? input[k] : undefined;
|
|
31876
|
+
const preambleLabel = () => {
|
|
31877
|
+
if (!preamble)
|
|
31878
|
+
return null;
|
|
31879
|
+
if (preamble.includes(`
|
|
31880
|
+
`))
|
|
31881
|
+
return null;
|
|
31882
|
+
const trimmed = preamble.trim();
|
|
31883
|
+
if (!trimmed)
|
|
31884
|
+
return null;
|
|
31885
|
+
if (trimmed.length > MAX_DESCRIPTION_CHARS2)
|
|
31886
|
+
return null;
|
|
31887
|
+
return trimmed;
|
|
31888
|
+
};
|
|
31889
|
+
switch (tool) {
|
|
31890
|
+
case "Read":
|
|
31891
|
+
case "Write":
|
|
31892
|
+
case "NotebookEdit":
|
|
31893
|
+
case "Edit": {
|
|
31894
|
+
const pre = preambleLabel();
|
|
31895
|
+
if (pre)
|
|
31896
|
+
return pre;
|
|
31897
|
+
return truncate2(basename2(str("file_path") ?? ""));
|
|
31898
|
+
}
|
|
31899
|
+
case "Bash":
|
|
31900
|
+
case "BashOutput": {
|
|
31901
|
+
const description = str("description");
|
|
31902
|
+
if (description)
|
|
31903
|
+
return truncate2(firstLine2(description), MAX_DESCRIPTION_CHARS2);
|
|
31904
|
+
const pre = preambleLabel();
|
|
31905
|
+
if (pre)
|
|
31906
|
+
return pre;
|
|
31907
|
+
const cmd = str("command") ?? str("bash_id") ?? "";
|
|
31908
|
+
return truncate2(firstLine2(cmd), MAX_BASH_CHARS2);
|
|
31909
|
+
}
|
|
31910
|
+
case "KillShell":
|
|
31911
|
+
return truncate2(str("shell_id") ?? "");
|
|
31912
|
+
case "Glob": {
|
|
31913
|
+
const pre = preambleLabel();
|
|
31914
|
+
if (pre)
|
|
31915
|
+
return pre;
|
|
31916
|
+
return truncate2(str("pattern") ?? "");
|
|
31917
|
+
}
|
|
31918
|
+
case "Grep": {
|
|
31919
|
+
const pre = preambleLabel();
|
|
31920
|
+
if (pre)
|
|
31921
|
+
return pre;
|
|
31922
|
+
const pat = str("pattern") ?? "";
|
|
31923
|
+
if (!pat)
|
|
31924
|
+
return "";
|
|
31925
|
+
const path = str("path");
|
|
31926
|
+
const where = shortenGrepPath2(path ?? "");
|
|
31927
|
+
return truncate2(`"${pat}" (in ${where})`);
|
|
31928
|
+
}
|
|
31929
|
+
case "WebFetch":
|
|
31930
|
+
return truncate2(hostFromUrl2(str("url") ?? ""));
|
|
31931
|
+
case "WebSearch": {
|
|
31932
|
+
const q = str("query") ?? "";
|
|
31933
|
+
return q ? truncate2(`"${q}"`) : "";
|
|
31934
|
+
}
|
|
31935
|
+
case "Task":
|
|
31936
|
+
case "Agent": {
|
|
31937
|
+
const desc = str("description") ?? str("subagent_type") ?? "";
|
|
31938
|
+
return truncate2(desc);
|
|
31939
|
+
}
|
|
31940
|
+
case "TodoWrite":
|
|
31941
|
+
case "TaskCreate":
|
|
31942
|
+
case "TaskUpdate":
|
|
31943
|
+
case "TaskList":
|
|
31944
|
+
case "TaskGet":
|
|
31945
|
+
case "TaskStop":
|
|
31946
|
+
case "TaskOutput":
|
|
31947
|
+
return "";
|
|
31948
|
+
case "Skill":
|
|
31949
|
+
return truncate2(str("skill") ?? "");
|
|
31950
|
+
case "SlashCommand":
|
|
31951
|
+
return truncate2(str("command") ?? "");
|
|
31952
|
+
case "ToolSearch": {
|
|
31953
|
+
const q = str("query") ?? "";
|
|
31954
|
+
if (!q)
|
|
31955
|
+
return "";
|
|
31956
|
+
const selectMatch = q.match(/^\s*select\s*:\s*(.+)$/i);
|
|
31957
|
+
if (selectMatch) {
|
|
31958
|
+
const names = selectMatch[1].split(",").map((n) => n.trim()).filter((n) => n.length > 0).join(", ");
|
|
31959
|
+
return truncate2(`Loading schema: ${names}`);
|
|
31960
|
+
}
|
|
31961
|
+
return truncate2(`Searching tools: ${q}`);
|
|
31962
|
+
}
|
|
31963
|
+
default:
|
|
31964
|
+
if (tool.startsWith("mcp__")) {
|
|
31965
|
+
const description = str("description");
|
|
31966
|
+
if (description)
|
|
31967
|
+
return truncate2(firstLine2(stripHtml2(description)), MAX_DESCRIPTION_CHARS2);
|
|
31968
|
+
const label = mcpBaseLabel2(tool);
|
|
31969
|
+
const query = str("query") ?? str("text") ?? str("name");
|
|
31970
|
+
if (label && query) {
|
|
31971
|
+
const budget = Math.max(8, MAX_LABEL_CHARS2 - label.length - 4);
|
|
31972
|
+
const preview = truncate2(firstLine2(stripHtml2(query)), budget);
|
|
31973
|
+
return `${label} (${preview})`;
|
|
31974
|
+
}
|
|
31975
|
+
if (label)
|
|
31976
|
+
return truncate2(label);
|
|
31977
|
+
}
|
|
31978
|
+
for (const k of ["description", "file_path", "path", "url", "query", "pattern", "command"]) {
|
|
31979
|
+
const v = str(k);
|
|
31980
|
+
if (v != null && v.length > 0) {
|
|
31981
|
+
if (k === "file_path" || k === "path")
|
|
31982
|
+
return truncate2(basename2(v));
|
|
31983
|
+
if (k === "url")
|
|
31984
|
+
return truncate2(hostFromUrl2(v));
|
|
31985
|
+
if (k === "description")
|
|
31986
|
+
return truncate2(firstLine2(v), MAX_DESCRIPTION_CHARS2);
|
|
31987
|
+
return truncate2(firstLine2(v));
|
|
31988
|
+
}
|
|
31989
|
+
}
|
|
31990
|
+
return "";
|
|
31991
|
+
}
|
|
31992
|
+
}
|
|
31993
|
+
function mcpBaseLabel2(tool) {
|
|
31994
|
+
if (!tool.startsWith("mcp__"))
|
|
31995
|
+
return "";
|
|
31996
|
+
const parts = tool.slice("mcp__".length).split("__");
|
|
31997
|
+
if (parts.length < 2)
|
|
31998
|
+
return "";
|
|
31999
|
+
const rawServer = parts[0];
|
|
32000
|
+
const action = parts.slice(1).join("__");
|
|
32001
|
+
if (!rawServer || !action)
|
|
32002
|
+
return "";
|
|
32003
|
+
return `${prettifyServer2(rawServer)}: ${action}`;
|
|
32004
|
+
}
|
|
32005
|
+
function prettifyServer2(name) {
|
|
32006
|
+
const LABELS = {
|
|
32007
|
+
"switchroom-telegram": "Telegram"
|
|
32008
|
+
};
|
|
32009
|
+
if (LABELS[name])
|
|
32010
|
+
return LABELS[name];
|
|
32011
|
+
if (!name)
|
|
32012
|
+
return name;
|
|
32013
|
+
return name.charAt(0).toUpperCase() + name.slice(1);
|
|
32014
|
+
}
|
|
32015
|
+
|
|
31758
32016
|
// gateway/chat-key.ts
|
|
31759
32017
|
function chatKey(chatId, threadId) {
|
|
31760
32018
|
const t = threadId == null || threadId === 0 ? "_" : String(threadId);
|
|
@@ -32887,7 +33145,7 @@ function installTgPostLogger(bot) {
|
|
|
32887
33145
|
}
|
|
32888
33146
|
|
|
32889
33147
|
// attachment-path.ts
|
|
32890
|
-
import { join as join2, basename as
|
|
33148
|
+
import { join as join2, basename as basename3, resolve, sep } from "node:path";
|
|
32891
33149
|
function sanitizeExtension(ext) {
|
|
32892
33150
|
if (ext == null)
|
|
32893
33151
|
return "bin";
|
|
@@ -32916,7 +33174,7 @@ function assertInsideInbox(inboxDir, candidatePath) {
|
|
|
32916
33174
|
const inboxReal = resolve(inboxDir);
|
|
32917
33175
|
const candidateReal = resolve(candidatePath);
|
|
32918
33176
|
if (candidateReal !== inboxReal && !candidateReal.startsWith(inboxReal + sep)) {
|
|
32919
|
-
throw new Error(`attachment path escape: ${
|
|
33177
|
+
throw new Error(`attachment path escape: ${basename3(candidatePath)} resolved outside ${inboxDir}`);
|
|
32920
33178
|
}
|
|
32921
33179
|
}
|
|
32922
33180
|
|
|
@@ -32996,7 +33254,7 @@ function clear(key) {
|
|
|
32996
33254
|
state.delete(key);
|
|
32997
33255
|
}
|
|
32998
33256
|
|
|
32999
|
-
//
|
|
33257
|
+
// ../../switchroom-sec-1417/node_modules/.bun/posthog-node@5.29.2/node_modules/posthog-node/dist/extensions/error-tracking/modifiers/module.node.mjs
|
|
33000
33258
|
import { dirname as dirname2, posix, sep as sep2 } from "path";
|
|
33001
33259
|
function createModulerModifier() {
|
|
33002
33260
|
const getModuleFromFileName = createGetModuleFromFilename();
|
|
@@ -33032,7 +33290,7 @@ function normalizeWindowsPath(path) {
|
|
|
33032
33290
|
return path.replace(/^[A-Z]:/, "").replace(/\\/g, "/");
|
|
33033
33291
|
}
|
|
33034
33292
|
|
|
33035
|
-
//
|
|
33293
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/featureFlagUtils.mjs
|
|
33036
33294
|
var normalizeFlagsResponse = (flagsResponse) => {
|
|
33037
33295
|
if ("flags" in flagsResponse) {
|
|
33038
33296
|
const featureFlags = getFlagValuesFromFlags(flagsResponse.flags);
|
|
@@ -33103,7 +33361,7 @@ var parsePayload = (response) => {
|
|
|
33103
33361
|
}
|
|
33104
33362
|
};
|
|
33105
33363
|
|
|
33106
|
-
//
|
|
33364
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/gzip.mjs
|
|
33107
33365
|
function isGzipSupported() {
|
|
33108
33366
|
return "CompressionStream" in globalThis;
|
|
33109
33367
|
}
|
|
@@ -33123,7 +33381,7 @@ async function gzipCompress(input, isDebug = true) {
|
|
|
33123
33381
|
}
|
|
33124
33382
|
}
|
|
33125
33383
|
|
|
33126
|
-
//
|
|
33384
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/vendor/uuidv7.mjs
|
|
33127
33385
|
/*! For license information please see uuidv7.mjs.LICENSE.txt */
|
|
33128
33386
|
var DIGITS = "0123456789abcdef";
|
|
33129
33387
|
|
|
@@ -33301,7 +33559,7 @@ var defaultGenerator;
|
|
|
33301
33559
|
var uuidv7 = () => uuidv7obj().toString();
|
|
33302
33560
|
var uuidv7obj = () => (defaultGenerator || (defaultGenerator = new V7Generator)).generate();
|
|
33303
33561
|
|
|
33304
|
-
//
|
|
33562
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/types.mjs
|
|
33305
33563
|
var types_PostHogPersistedProperty = /* @__PURE__ */ function(PostHogPersistedProperty) {
|
|
33306
33564
|
PostHogPersistedProperty["AnonymousId"] = "anonymous_id";
|
|
33307
33565
|
PostHogPersistedProperty["DistinctId"] = "distinct_id";
|
|
@@ -33334,7 +33592,7 @@ var types_PostHogPersistedProperty = /* @__PURE__ */ function(PostHogPersistedPr
|
|
|
33334
33592
|
return PostHogPersistedProperty;
|
|
33335
33593
|
}({});
|
|
33336
33594
|
|
|
33337
|
-
//
|
|
33595
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/utils/bot-detection.mjs
|
|
33338
33596
|
var DEFAULT_BLOCKED_UA_STRS = [
|
|
33339
33597
|
"amazonbot",
|
|
33340
33598
|
"amazonproductbot",
|
|
@@ -33423,7 +33681,7 @@ var isBlockedUA = function(ua, customBlockedUserAgents = []) {
|
|
|
33423
33681
|
return uaLower.indexOf(blockedUaLower) !== -1;
|
|
33424
33682
|
});
|
|
33425
33683
|
};
|
|
33426
|
-
//
|
|
33684
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/utils/type-utils.mjs
|
|
33427
33685
|
var nativeIsArray = Array.isArray;
|
|
33428
33686
|
var ObjProto = Object.prototype;
|
|
33429
33687
|
var type_utils_hasOwnProperty = ObjProto.hasOwnProperty;
|
|
@@ -33460,7 +33718,7 @@ function isInstanceOf(candidate, base) {
|
|
|
33460
33718
|
}
|
|
33461
33719
|
}
|
|
33462
33720
|
|
|
33463
|
-
//
|
|
33721
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/utils/number-utils.mjs
|
|
33464
33722
|
function clampToRange(value, min, max, logger, fallbackValue) {
|
|
33465
33723
|
if (min > max) {
|
|
33466
33724
|
logger.warn("min cannot be greater than max.");
|
|
@@ -33480,7 +33738,7 @@ function clampToRange(value, min, max, logger, fallbackValue) {
|
|
|
33480
33738
|
return clampToRange(fallbackValue || max, min, max, logger);
|
|
33481
33739
|
}
|
|
33482
33740
|
|
|
33483
|
-
//
|
|
33741
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/utils/bucketed-rate-limiter.mjs
|
|
33484
33742
|
var ONE_DAY_IN_MS = 86400000;
|
|
33485
33743
|
|
|
33486
33744
|
class BucketedRateLimiter {
|
|
@@ -33524,7 +33782,7 @@ class BucketedRateLimiter {
|
|
|
33524
33782
|
this._buckets = {};
|
|
33525
33783
|
}
|
|
33526
33784
|
}
|
|
33527
|
-
//
|
|
33785
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/utils/promise-queue.mjs
|
|
33528
33786
|
class PromiseQueue {
|
|
33529
33787
|
add(promise) {
|
|
33530
33788
|
const promiseUUID = uuidv7();
|
|
@@ -33550,7 +33808,7 @@ class PromiseQueue {
|
|
|
33550
33808
|
this.promiseByIds = {};
|
|
33551
33809
|
}
|
|
33552
33810
|
}
|
|
33553
|
-
//
|
|
33811
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/utils/logger.mjs
|
|
33554
33812
|
function createConsole(consoleLike = console) {
|
|
33555
33813
|
const lockedMethods = {
|
|
33556
33814
|
log: consoleLike.log.bind(consoleLike),
|
|
@@ -33588,7 +33846,7 @@ var passThrough = (fn) => fn();
|
|
|
33588
33846
|
function createLogger(prefix, maybeCall = passThrough) {
|
|
33589
33847
|
return _createLogger(prefix, maybeCall, createConsole());
|
|
33590
33848
|
}
|
|
33591
|
-
//
|
|
33849
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/utils/user-agent-utils.mjs
|
|
33592
33850
|
var MOBILE = "Mobile";
|
|
33593
33851
|
var IOS = "iOS";
|
|
33594
33852
|
var ANDROID = "Android";
|
|
@@ -33845,7 +34103,7 @@ var osMatchers = [
|
|
|
33845
34103
|
]
|
|
33846
34104
|
];
|
|
33847
34105
|
|
|
33848
|
-
//
|
|
34106
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/utils/index.mjs
|
|
33849
34107
|
var STRING_FORMAT = "utf8";
|
|
33850
34108
|
function assert(truthyValue, message) {
|
|
33851
34109
|
if (!truthyValue || typeof truthyValue != "string" || isEmpty(truthyValue))
|
|
@@ -33893,7 +34151,7 @@ function allSettled(promises) {
|
|
|
33893
34151
|
reason
|
|
33894
34152
|
}))));
|
|
33895
34153
|
}
|
|
33896
|
-
//
|
|
34154
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/eventemitter.mjs
|
|
33897
34155
|
class SimpleEventEmitter {
|
|
33898
34156
|
constructor() {
|
|
33899
34157
|
this.events = {};
|
|
@@ -33915,7 +34173,7 @@ class SimpleEventEmitter {
|
|
|
33915
34173
|
}
|
|
33916
34174
|
}
|
|
33917
34175
|
|
|
33918
|
-
//
|
|
34176
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/posthog-core-stateless.mjs
|
|
33919
34177
|
class PostHogFetchHttpError extends Error {
|
|
33920
34178
|
constructor(response, reqByteLength) {
|
|
33921
34179
|
super("HTTP error while fetching PostHog: status=" + response.status + ", reqByteLength=" + reqByteLength), this.response = response, this.reqByteLength = reqByteLength, this.name = "PostHogFetchHttpError";
|
|
@@ -34630,7 +34888,7 @@ class PostHogCoreStateless {
|
|
|
34630
34888
|
return this.shutdownPromise;
|
|
34631
34889
|
}
|
|
34632
34890
|
}
|
|
34633
|
-
//
|
|
34891
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/index.mjs
|
|
34634
34892
|
var exports_error_tracking = {};
|
|
34635
34893
|
__export(exports_error_tracking, {
|
|
34636
34894
|
winjsStackLineParser: () => winjsStackLineParser,
|
|
@@ -34654,7 +34912,7 @@ __export(exports_error_tracking, {
|
|
|
34654
34912
|
DOMExceptionCoercer: () => DOMExceptionCoercer
|
|
34655
34913
|
});
|
|
34656
34914
|
|
|
34657
|
-
//
|
|
34915
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/chunk-ids.mjs
|
|
34658
34916
|
var parsedStackResults;
|
|
34659
34917
|
var lastKeysCount;
|
|
34660
34918
|
var cachedFilenameChunkIds;
|
|
@@ -34693,7 +34951,7 @@ function getFilenameToChunkIdMap(stackParser) {
|
|
|
34693
34951
|
return cachedFilenameChunkIds;
|
|
34694
34952
|
}
|
|
34695
34953
|
|
|
34696
|
-
//
|
|
34954
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/error-properties-builder.mjs
|
|
34697
34955
|
var MAX_CAUSE_RECURSION = 4;
|
|
34698
34956
|
|
|
34699
34957
|
class ErrorPropertiesBuilder {
|
|
@@ -34815,7 +35073,7 @@ class ErrorPropertiesBuilder {
|
|
|
34815
35073
|
return context;
|
|
34816
35074
|
}
|
|
34817
35075
|
}
|
|
34818
|
-
//
|
|
35076
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/parsers/base.mjs
|
|
34819
35077
|
var UNKNOWN_FUNCTION = "?";
|
|
34820
35078
|
function createFrame(platform, filename, func, lineno, colno) {
|
|
34821
35079
|
const frame = {
|
|
@@ -34831,7 +35089,7 @@ function createFrame(platform, filename, func, lineno, colno) {
|
|
|
34831
35089
|
return frame;
|
|
34832
35090
|
}
|
|
34833
35091
|
|
|
34834
|
-
//
|
|
35092
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/parsers/safari.mjs
|
|
34835
35093
|
var extractSafariExtensionDetails = (func, filename) => {
|
|
34836
35094
|
const isSafariExtension = func.indexOf("safari-extension") !== -1;
|
|
34837
35095
|
const isSafariWebExtension = func.indexOf("safari-web-extension") !== -1;
|
|
@@ -34844,7 +35102,7 @@ var extractSafariExtensionDetails = (func, filename) => {
|
|
|
34844
35102
|
];
|
|
34845
35103
|
};
|
|
34846
35104
|
|
|
34847
|
-
//
|
|
35105
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/parsers/chrome.mjs
|
|
34848
35106
|
var chromeRegexNoFnName = /^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i;
|
|
34849
35107
|
var chromeRegex = /^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i;
|
|
34850
35108
|
var chromeEvalRegex = /\((\S*)(?::(\d+))(?::(\d+))\)/;
|
|
@@ -34870,7 +35128,7 @@ var chromeStackLineParser = (line, platform) => {
|
|
|
34870
35128
|
}
|
|
34871
35129
|
};
|
|
34872
35130
|
|
|
34873
|
-
//
|
|
35131
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/parsers/gecko.mjs
|
|
34874
35132
|
var geckoREgex = /^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i;
|
|
34875
35133
|
var geckoEvalRegex = /(\S+) line (\d+)(?: > eval line \d+)* > eval/i;
|
|
34876
35134
|
var geckoStackLineParser = (line, platform) => {
|
|
@@ -34893,14 +35151,14 @@ var geckoStackLineParser = (line, platform) => {
|
|
|
34893
35151
|
}
|
|
34894
35152
|
};
|
|
34895
35153
|
|
|
34896
|
-
//
|
|
35154
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/parsers/winjs.mjs
|
|
34897
35155
|
var winjsRegex = /^\s*at (?:((?:\[object object\])?.+) )?\(?((?:[-a-z]+):.*?):(\d+)(?::(\d+))?\)?\s*$/i;
|
|
34898
35156
|
var winjsStackLineParser = (line, platform) => {
|
|
34899
35157
|
const parts = winjsRegex.exec(line);
|
|
34900
35158
|
return parts ? createFrame(platform, parts[2], parts[1] || UNKNOWN_FUNCTION, +parts[3], parts[4] ? +parts[4] : undefined) : undefined;
|
|
34901
35159
|
};
|
|
34902
35160
|
|
|
34903
|
-
//
|
|
35161
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/parsers/opera.mjs
|
|
34904
35162
|
var opera10Regex = / line (\d+).*script (?:in )?(\S+)(?:: in function (\S+))?$/i;
|
|
34905
35163
|
var opera10StackLineParser = (line, platform) => {
|
|
34906
35164
|
const parts = opera10Regex.exec(line);
|
|
@@ -34912,7 +35170,7 @@ var opera11StackLineParser = (line, platform) => {
|
|
|
34912
35170
|
return parts ? createFrame(platform, parts[5], parts[3] || parts[4] || UNKNOWN_FUNCTION, +parts[1], +parts[2]) : undefined;
|
|
34913
35171
|
};
|
|
34914
35172
|
|
|
34915
|
-
//
|
|
35173
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/parsers/node.mjs
|
|
34916
35174
|
var FILENAME_MATCH = /^\s*[-]{4,}$/;
|
|
34917
35175
|
var FULL_MATCH = /at (?:async )?(?:(.+?)\s+\()?(?:(.+):(\d+):(\d+)?|([^)]+))\)?/;
|
|
34918
35176
|
var nodeStackLineParser = (line, platform) => {
|
|
@@ -34981,7 +35239,7 @@ function _parseIntOrUndefined(input) {
|
|
|
34981
35239
|
return parseInt(input || "", 10) || undefined;
|
|
34982
35240
|
}
|
|
34983
35241
|
|
|
34984
|
-
//
|
|
35242
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/parsers/index.mjs
|
|
34985
35243
|
var WEBPACK_ERROR_REGEXP = /\(error: (.*)\)/;
|
|
34986
35244
|
var STACKTRACE_FRAME_LIMIT = 50;
|
|
34987
35245
|
function reverseAndStripFrames(stack) {
|
|
@@ -35026,7 +35284,7 @@ function createStackParser(platform, ...parsers) {
|
|
|
35026
35284
|
return reverseAndStripFrames(frames);
|
|
35027
35285
|
};
|
|
35028
35286
|
}
|
|
35029
|
-
//
|
|
35287
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/coercers/dom-exception-coercer.mjs
|
|
35030
35288
|
class DOMExceptionCoercer {
|
|
35031
35289
|
match(err) {
|
|
35032
35290
|
return this.isDOMException(err) || this.isDOMError(err);
|
|
@@ -35056,7 +35314,7 @@ class DOMExceptionCoercer {
|
|
|
35056
35314
|
return isBuiltin(err, "DOMError");
|
|
35057
35315
|
}
|
|
35058
35316
|
}
|
|
35059
|
-
//
|
|
35317
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/coercers/error-coercer.mjs
|
|
35060
35318
|
class ErrorCoercer {
|
|
35061
35319
|
match(err) {
|
|
35062
35320
|
return isPlainError(err);
|
|
@@ -35083,7 +35341,7 @@ class ErrorCoercer {
|
|
|
35083
35341
|
return err.stacktrace || err.stack || undefined;
|
|
35084
35342
|
}
|
|
35085
35343
|
}
|
|
35086
|
-
//
|
|
35344
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/coercers/error-event-coercer.mjs
|
|
35087
35345
|
class ErrorEventCoercer {
|
|
35088
35346
|
constructor() {}
|
|
35089
35347
|
match(err) {
|
|
@@ -35101,7 +35359,7 @@ class ErrorEventCoercer {
|
|
|
35101
35359
|
return exceptionLike;
|
|
35102
35360
|
}
|
|
35103
35361
|
}
|
|
35104
|
-
//
|
|
35362
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/coercers/string-coercer.mjs
|
|
35105
35363
|
var ERROR_TYPES_PATTERN = /^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;
|
|
35106
35364
|
|
|
35107
35365
|
class StringCoercer {
|
|
@@ -35131,7 +35389,7 @@ class StringCoercer {
|
|
|
35131
35389
|
];
|
|
35132
35390
|
}
|
|
35133
35391
|
}
|
|
35134
|
-
//
|
|
35392
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/types.mjs
|
|
35135
35393
|
var severityLevels = [
|
|
35136
35394
|
"fatal",
|
|
35137
35395
|
"error",
|
|
@@ -35141,7 +35399,7 @@ var severityLevels = [
|
|
|
35141
35399
|
"debug"
|
|
35142
35400
|
];
|
|
35143
35401
|
|
|
35144
|
-
//
|
|
35402
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/coercers/utils.mjs
|
|
35145
35403
|
function extractExceptionKeysForMessage(err, maxLength = 40) {
|
|
35146
35404
|
const keys = Object.keys(err);
|
|
35147
35405
|
keys.sort();
|
|
@@ -35158,7 +35416,7 @@ function extractExceptionKeysForMessage(err, maxLength = 40) {
|
|
|
35158
35416
|
return "";
|
|
35159
35417
|
}
|
|
35160
35418
|
|
|
35161
|
-
//
|
|
35419
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/coercers/object-coercer.mjs
|
|
35162
35420
|
class ObjectCoercer {
|
|
35163
35421
|
match(candidate) {
|
|
35164
35422
|
return typeof candidate == "object" && candidate !== null;
|
|
@@ -35211,7 +35469,7 @@ class ObjectCoercer {
|
|
|
35211
35469
|
}
|
|
35212
35470
|
}
|
|
35213
35471
|
}
|
|
35214
|
-
//
|
|
35472
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/coercers/event-coercer.mjs
|
|
35215
35473
|
class EventCoercer {
|
|
35216
35474
|
match(err) {
|
|
35217
35475
|
return isEvent(err);
|
|
@@ -35226,7 +35484,7 @@ class EventCoercer {
|
|
|
35226
35484
|
};
|
|
35227
35485
|
}
|
|
35228
35486
|
}
|
|
35229
|
-
//
|
|
35487
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/coercers/primitive-coercer.mjs
|
|
35230
35488
|
class PrimitiveCoercer {
|
|
35231
35489
|
match(candidate) {
|
|
35232
35490
|
return isPrimitive(candidate);
|
|
@@ -35240,7 +35498,7 @@ class PrimitiveCoercer {
|
|
|
35240
35498
|
};
|
|
35241
35499
|
}
|
|
35242
35500
|
}
|
|
35243
|
-
//
|
|
35501
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/coercers/promise-rejection-event.mjs
|
|
35244
35502
|
class PromiseRejectionEventCoercer {
|
|
35245
35503
|
match(err) {
|
|
35246
35504
|
return isBuiltin(err, "PromiseRejectionEvent") || this.isCustomEventWrappingRejection(err);
|
|
@@ -35276,7 +35534,7 @@ class PromiseRejectionEventCoercer {
|
|
|
35276
35534
|
return error;
|
|
35277
35535
|
}
|
|
35278
35536
|
}
|
|
35279
|
-
//
|
|
35537
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/utils.mjs
|
|
35280
35538
|
class ReduceableCache {
|
|
35281
35539
|
constructor(_maxSize) {
|
|
35282
35540
|
this._maxSize = _maxSize;
|
|
@@ -35301,7 +35559,7 @@ class ReduceableCache {
|
|
|
35301
35559
|
}
|
|
35302
35560
|
}
|
|
35303
35561
|
}
|
|
35304
|
-
//
|
|
35562
|
+
// ../../switchroom-sec-1417/node_modules/.bun/posthog-node@5.29.2/node_modules/posthog-node/dist/extensions/error-tracking/modifiers/context-lines.node.mjs
|
|
35305
35563
|
import { createReadStream } from "node:fs";
|
|
35306
35564
|
import { createInterface } from "node:readline";
|
|
35307
35565
|
var LRU_FILE_CONTENTS_CACHE = new exports_error_tracking.ReduceableCache(25);
|
|
@@ -35519,7 +35777,7 @@ function snipLine(line, colno) {
|
|
|
35519
35777
|
return newLine;
|
|
35520
35778
|
}
|
|
35521
35779
|
|
|
35522
|
-
//
|
|
35780
|
+
// ../../switchroom-sec-1417/node_modules/.bun/posthog-node@5.29.2/node_modules/posthog-node/dist/extensions/error-tracking/autocapture.mjs
|
|
35523
35781
|
function makeUncaughtExceptionHandler(captureFn, onFatalFn) {
|
|
35524
35782
|
let calledFatalError = false;
|
|
35525
35783
|
return Object.assign((error) => {
|
|
@@ -35551,7 +35809,7 @@ function addUnhandledRejectionListener(captureFn) {
|
|
|
35551
35809
|
}));
|
|
35552
35810
|
}
|
|
35553
35811
|
|
|
35554
|
-
//
|
|
35812
|
+
// ../../switchroom-sec-1417/node_modules/.bun/posthog-node@5.29.2/node_modules/posthog-node/dist/extensions/error-tracking/index.mjs
|
|
35555
35813
|
var SHUTDOWN_TIMEOUT = 2000;
|
|
35556
35814
|
|
|
35557
35815
|
class ErrorTracking {
|
|
@@ -35620,10 +35878,10 @@ class ErrorTracking {
|
|
|
35620
35878
|
}
|
|
35621
35879
|
}
|
|
35622
35880
|
|
|
35623
|
-
//
|
|
35881
|
+
// ../../switchroom-sec-1417/node_modules/.bun/posthog-node@5.29.2/node_modules/posthog-node/dist/version.mjs
|
|
35624
35882
|
var version = "5.29.2";
|
|
35625
35883
|
|
|
35626
|
-
//
|
|
35884
|
+
// ../../switchroom-sec-1417/node_modules/.bun/posthog-node@5.29.2/node_modules/posthog-node/dist/types.mjs
|
|
35627
35885
|
var FeatureFlagError2 = {
|
|
35628
35886
|
ERRORS_WHILE_COMPUTING: "errors_while_computing_flags",
|
|
35629
35887
|
FLAG_MISSING: "flag_missing",
|
|
@@ -35631,7 +35889,7 @@ var FeatureFlagError2 = {
|
|
|
35631
35889
|
UNKNOWN_ERROR: "unknown_error"
|
|
35632
35890
|
};
|
|
35633
35891
|
|
|
35634
|
-
//
|
|
35892
|
+
// ../../switchroom-sec-1417/node_modules/.bun/posthog-node@5.29.2/node_modules/posthog-node/dist/extensions/feature-flags/crypto.mjs
|
|
35635
35893
|
async function hashSHA1(text) {
|
|
35636
35894
|
const subtle = globalThis.crypto?.subtle;
|
|
35637
35895
|
if (!subtle)
|
|
@@ -35641,7 +35899,7 @@ async function hashSHA1(text) {
|
|
|
35641
35899
|
return hashArray.map((byte) => byte.toString(16).padStart(2, "0")).join("");
|
|
35642
35900
|
}
|
|
35643
35901
|
|
|
35644
|
-
//
|
|
35902
|
+
// ../../switchroom-sec-1417/node_modules/.bun/posthog-node@5.29.2/node_modules/posthog-node/dist/extensions/feature-flags/feature-flags.mjs
|
|
35645
35903
|
var SIXTY_SECONDS = 60000;
|
|
35646
35904
|
var LONG_SCALE = 1152921504606847000;
|
|
35647
35905
|
var NULL_VALUES_ALLOWED_OPERATORS = [
|
|
@@ -36515,7 +36773,7 @@ function relativeDateParseForFeatureFlagMatching(value) {
|
|
|
36515
36773
|
}
|
|
36516
36774
|
}
|
|
36517
36775
|
|
|
36518
|
-
//
|
|
36776
|
+
// ../../switchroom-sec-1417/node_modules/.bun/posthog-node@5.29.2/node_modules/posthog-node/dist/storage-memory.mjs
|
|
36519
36777
|
class PostHogMemoryStorage {
|
|
36520
36778
|
getProperty(key) {
|
|
36521
36779
|
return this._memoryStorage[key];
|
|
@@ -36528,7 +36786,7 @@ class PostHogMemoryStorage {
|
|
|
36528
36786
|
}
|
|
36529
36787
|
}
|
|
36530
36788
|
|
|
36531
|
-
//
|
|
36789
|
+
// ../../switchroom-sec-1417/node_modules/.bun/posthog-node@5.29.2/node_modules/posthog-node/dist/client.mjs
|
|
36532
36790
|
var MINIMUM_POLLING_INTERVAL = 100;
|
|
36533
36791
|
var THIRTY_SECONDS = 30000;
|
|
36534
36792
|
var MAX_CACHE_SIZE = 50000;
|
|
@@ -37316,7 +37574,7 @@ class PostHogBackendClient extends PostHogCoreStateless {
|
|
|
37316
37574
|
}
|
|
37317
37575
|
}
|
|
37318
37576
|
|
|
37319
|
-
//
|
|
37577
|
+
// ../../switchroom-sec-1417/node_modules/.bun/posthog-node@5.29.2/node_modules/posthog-node/dist/extensions/context/context.mjs
|
|
37320
37578
|
import { AsyncLocalStorage as AsyncLocalStorage2 } from "node:async_hooks";
|
|
37321
37579
|
|
|
37322
37580
|
class PostHogContext {
|
|
@@ -37347,7 +37605,7 @@ class PostHogContext {
|
|
|
37347
37605
|
}
|
|
37348
37606
|
}
|
|
37349
37607
|
|
|
37350
|
-
//
|
|
37608
|
+
// ../../switchroom-sec-1417/node_modules/.bun/posthog-node@5.29.2/node_modules/posthog-node/dist/extensions/sentry-integration.mjs
|
|
37351
37609
|
var NAME = "posthog-node";
|
|
37352
37610
|
function createEventProcessor(_posthog, { organization, projectId, prefix, severityAllowList = [
|
|
37353
37611
|
"error"
|
|
@@ -37415,7 +37673,7 @@ class PostHogSentryIntegration {
|
|
|
37415
37673
|
};
|
|
37416
37674
|
}
|
|
37417
37675
|
}
|
|
37418
|
-
//
|
|
37676
|
+
// ../../switchroom-sec-1417/node_modules/.bun/posthog-node@5.29.2/node_modules/posthog-node/dist/entrypoints/index.node.mjs
|
|
37419
37677
|
ErrorTracking.errorPropertiesBuilder = new exports_error_tracking.ErrorPropertiesBuilder([
|
|
37420
37678
|
new exports_error_tracking.EventCoercer,
|
|
37421
37679
|
new exports_error_tracking.ErrorCoercer,
|
|
@@ -37753,6 +38011,7 @@ function classifyInbound(text) {
|
|
|
37753
38011
|
// silence-poke.ts
|
|
37754
38012
|
var DEFAULT_THRESHOLDS = {
|
|
37755
38013
|
ack: 1e4,
|
|
38014
|
+
awarenessPing: 60000,
|
|
37756
38015
|
soft: 75000,
|
|
37757
38016
|
firm: 180000,
|
|
37758
38017
|
fallback: 300000,
|
|
@@ -37779,6 +38038,7 @@ function startTurn(key, now) {
|
|
|
37779
38038
|
lastThinkingAt: null,
|
|
37780
38039
|
fallbackFired: false,
|
|
37781
38040
|
ackPokeFired: false,
|
|
38041
|
+
awarenessPingFired: false,
|
|
37782
38042
|
lastPokeFiredAt: null,
|
|
37783
38043
|
inFlightTools: new Map
|
|
37784
38044
|
});
|
|
@@ -37896,6 +38156,42 @@ function tick(now) {
|
|
|
37896
38156
|
});
|
|
37897
38157
|
continue;
|
|
37898
38158
|
}
|
|
38159
|
+
if (!s.awarenessPingFired && s.lastOutboundAt == null && !s.subagentDispatchActive && silence >= thresholds.awarenessPing) {
|
|
38160
|
+
s.awarenessPingFired = true;
|
|
38161
|
+
const { chatId, threadId } = parseKey(key);
|
|
38162
|
+
const recentThinking = s.lastThinkingAt != null && now - s.lastThinkingAt < 30000;
|
|
38163
|
+
const fallbackKind = recentThinking ? "thinking" : "working";
|
|
38164
|
+
const inFlightTools = Array.from(s.inFlightTools.values()).sort((a, b) => a.startedAt - b.startedAt).map((t) => ({
|
|
38165
|
+
name: t.name,
|
|
38166
|
+
label: t.label,
|
|
38167
|
+
durationMs: now - t.startedAt
|
|
38168
|
+
}));
|
|
38169
|
+
activeDeps.emitMetric({
|
|
38170
|
+
kind: "awareness_ping_sent",
|
|
38171
|
+
key,
|
|
38172
|
+
fallback_kind: fallbackKind,
|
|
38173
|
+
silence_ms: silence
|
|
38174
|
+
});
|
|
38175
|
+
try {
|
|
38176
|
+
const ret = activeDeps.onAwarenessPing({
|
|
38177
|
+
key,
|
|
38178
|
+
chatId,
|
|
38179
|
+
threadId,
|
|
38180
|
+
fallbackKind,
|
|
38181
|
+
silenceMs: silence,
|
|
38182
|
+
inFlightTools
|
|
38183
|
+
});
|
|
38184
|
+
if (ret != null && typeof ret.then === "function") {
|
|
38185
|
+
ret.catch((err) => {
|
|
38186
|
+
process.stderr.write(`silence-poke: awareness-ping handler rejected: ${err}
|
|
38187
|
+
`);
|
|
38188
|
+
});
|
|
38189
|
+
}
|
|
38190
|
+
} catch (err) {
|
|
38191
|
+
process.stderr.write(`silence-poke: awareness-ping handler threw: ${err}
|
|
38192
|
+
`);
|
|
38193
|
+
}
|
|
38194
|
+
}
|
|
37899
38195
|
if (s.pokesFired === 0 && silence >= softThreshold) {
|
|
37900
38196
|
s.pokeArmed = { level: "soft" };
|
|
37901
38197
|
s.pokesFired = 1;
|
|
@@ -38218,6 +38514,45 @@ function recordSilentTurnEnd(args, deps) {
|
|
|
38218
38514
|
}
|
|
38219
38515
|
var recordUndeliveredTurnEnd = recordSilentTurnEnd;
|
|
38220
38516
|
|
|
38517
|
+
// ack-flag.ts
|
|
38518
|
+
import { closeSync, existsSync as existsSync6, openSync, unlinkSync as unlinkSync2 } from "node:fs";
|
|
38519
|
+
import { join as join7 } from "node:path";
|
|
38520
|
+
var ACK_SENT_MARKER = "ack-sent.flag";
|
|
38521
|
+
function markerPath() {
|
|
38522
|
+
const dir = process.env.TELEGRAM_STATE_DIR;
|
|
38523
|
+
if (!dir)
|
|
38524
|
+
return null;
|
|
38525
|
+
return join7(dir, ACK_SENT_MARKER);
|
|
38526
|
+
}
|
|
38527
|
+
function markAckSent() {
|
|
38528
|
+
const path = markerPath();
|
|
38529
|
+
if (path == null)
|
|
38530
|
+
return;
|
|
38531
|
+
if (existsSync6(path))
|
|
38532
|
+
return;
|
|
38533
|
+
try {
|
|
38534
|
+
const fd = openSync(path, "w");
|
|
38535
|
+
closeSync(fd);
|
|
38536
|
+
} catch (err) {
|
|
38537
|
+
process.stderr.write(`ack-flag: markAckSent failed path=${path}: ${err}
|
|
38538
|
+
`);
|
|
38539
|
+
}
|
|
38540
|
+
}
|
|
38541
|
+
function clearAckSent() {
|
|
38542
|
+
const path = markerPath();
|
|
38543
|
+
if (path == null)
|
|
38544
|
+
return;
|
|
38545
|
+
try {
|
|
38546
|
+
unlinkSync2(path);
|
|
38547
|
+
} catch (err) {
|
|
38548
|
+
const code = err?.code;
|
|
38549
|
+
if (code === "ENOENT")
|
|
38550
|
+
return;
|
|
38551
|
+
process.stderr.write(`ack-flag: clearAckSent failed path=${path}: ${err}
|
|
38552
|
+
`);
|
|
38553
|
+
}
|
|
38554
|
+
}
|
|
38555
|
+
|
|
38221
38556
|
// final-answer-detect.ts
|
|
38222
38557
|
var FINAL_ANSWER_MIN_CHARS = 200;
|
|
38223
38558
|
function isFinalAnswerReply(input) {
|
|
@@ -38641,7 +38976,7 @@ async function gatewayStartupRetry(fn, opts = {}) {
|
|
|
38641
38976
|
|
|
38642
38977
|
// gateway/quarantine.ts
|
|
38643
38978
|
import { mkdirSync as mkdirSync6, writeFileSync as writeFileSync4 } from "node:fs";
|
|
38644
|
-
import { join as
|
|
38979
|
+
import { join as join8 } from "node:path";
|
|
38645
38980
|
var QUARANTINE_FILENAME = "quarantine.json";
|
|
38646
38981
|
function writeQuarantineMarker(telegramStateDir, reason, detail, nowFn = Date.now) {
|
|
38647
38982
|
mkdirSync6(telegramStateDir, { recursive: true, mode: 448 });
|
|
@@ -38651,7 +38986,7 @@ function writeQuarantineMarker(telegramStateDir, reason, detail, nowFn = Date.no
|
|
|
38651
38986
|
ts: nowFn(),
|
|
38652
38987
|
detail
|
|
38653
38988
|
};
|
|
38654
|
-
writeFileSync4(
|
|
38989
|
+
writeFileSync4(join8(telegramStateDir, QUARANTINE_FILENAME), JSON.stringify(marker) + `
|
|
38655
38990
|
`, "utf-8");
|
|
38656
38991
|
}
|
|
38657
38992
|
|
|
@@ -38729,16 +39064,16 @@ function renderAccountRow(snap, opts) {
|
|
|
38729
39064
|
const lines = [];
|
|
38730
39065
|
const marker = snap.isActive ? "\u25cf " : "";
|
|
38731
39066
|
if (!snap.quota) {
|
|
38732
|
-
lines.push(`${marker}<code>${
|
|
39067
|
+
lines.push(`${marker}<code>${escapeHtml2(snap.label)}</code> <i>quota probe failed</i>`);
|
|
38733
39068
|
if (snap.quotaError) {
|
|
38734
|
-
lines.push(` <i>${
|
|
39069
|
+
lines.push(` <i>${escapeHtml2(snap.quotaError)}</i>`);
|
|
38735
39070
|
}
|
|
38736
39071
|
return lines;
|
|
38737
39072
|
}
|
|
38738
39073
|
const q = snap.quota;
|
|
38739
39074
|
const fiveStr = fmtPct(q.fiveHourUtilizationPct);
|
|
38740
39075
|
const sevenStr = fmtPct(q.sevenDayUtilizationPct);
|
|
38741
|
-
lines.push(`${marker}<code>${
|
|
39076
|
+
lines.push(`${marker}<code>${escapeHtml2(snap.label)}</code> ${fiveStr} / ${sevenStr}`);
|
|
38742
39077
|
const health = classifyHealth(snap);
|
|
38743
39078
|
if (health === "blocked") {
|
|
38744
39079
|
const win = bindingWindow(q);
|
|
@@ -38844,13 +39179,13 @@ function renderFallbackAnnouncement(input) {
|
|
|
38844
39179
|
const limitWord = input.oldQuota ? limitWordFor(input.oldQuota) : "quota";
|
|
38845
39180
|
const headerLimit = limitWord === "quota" ? "quota cap" : `${limitWord} limit`;
|
|
38846
39181
|
if (!input.newLabel) {
|
|
38847
|
-
lines.push(`\uD83D\uDD34 <b>All accounts blocked \u00b7 ${headerLimit} on ${
|
|
39182
|
+
lines.push(`\uD83D\uDD34 <b>All accounts blocked \u00b7 ${headerLimit} on ${escapeHtml2(input.oldLabel)}</b>`);
|
|
38848
39183
|
lines.push("");
|
|
38849
|
-
lines.push(`Triggered by: agent <b>${
|
|
39184
|
+
lines.push(`Triggered by: agent <b>${escapeHtml2(input.triggerAgent)}</b>`);
|
|
38850
39185
|
if (input.oldQuota) {
|
|
38851
39186
|
const recovery = recoveryAtFor(input.oldQuota);
|
|
38852
39187
|
if (recovery) {
|
|
38853
|
-
lines.push(`${
|
|
39188
|
+
lines.push(`${escapeHtml2(input.oldLabel)} recovers ${formatAbsolute(recovery, tz)} ` + `(in ${formatRelative(recovery, now)})`);
|
|
38854
39189
|
}
|
|
38855
39190
|
}
|
|
38856
39191
|
lines.push("");
|
|
@@ -38858,15 +39193,15 @@ function renderFallbackAnnouncement(input) {
|
|
|
38858
39193
|
return lines.join(`
|
|
38859
39194
|
`);
|
|
38860
39195
|
}
|
|
38861
|
-
lines.push(`\u2713 <b>Switched fleet \u00b7 ${headerLimit} on ${
|
|
39196
|
+
lines.push(`\u2713 <b>Switched fleet \u00b7 ${headerLimit} on ${escapeHtml2(input.oldLabel)}</b>`);
|
|
38862
39197
|
lines.push("");
|
|
38863
|
-
lines.push(`<code>${
|
|
38864
|
-
lines.push(`Triggered by: agent <b>${
|
|
39198
|
+
lines.push(`<code>${escapeHtml2(input.oldLabel)}</code> \u2192 <code>${escapeHtml2(input.newLabel)}</code>`);
|
|
39199
|
+
lines.push(`Triggered by: agent <b>${escapeHtml2(input.triggerAgent)}</b>`);
|
|
38865
39200
|
lines.push("");
|
|
38866
39201
|
if (input.oldQuota) {
|
|
38867
39202
|
const recovery = recoveryAtFor(input.oldQuota);
|
|
38868
39203
|
if (recovery) {
|
|
38869
|
-
lines.push(`<code>${
|
|
39204
|
+
lines.push(`<code>${escapeHtml2(input.oldLabel)}</code> recovers ` + `${formatAbsolute(recovery, tz)} (in ${formatRelative(recovery, now)})`);
|
|
38870
39205
|
}
|
|
38871
39206
|
}
|
|
38872
39207
|
if (input.newQuota) {
|
|
@@ -38874,7 +39209,7 @@ function renderFallbackAnnouncement(input) {
|
|
|
38874
39209
|
const sevenStr = fmtPct(input.newQuota.sevenDayUtilizationPct);
|
|
38875
39210
|
const hasHeadroom = input.newQuota.fiveHourUtilizationPct < THROTTLING_THRESHOLD_PCT && input.newQuota.sevenDayUtilizationPct < THROTTLING_THRESHOLD_PCT;
|
|
38876
39211
|
const headroomStr = hasHeadroom ? "<i>(plenty of headroom)</i>" : "<i>(near limit \u2014 watch this)</i>";
|
|
38877
|
-
lines.push(`<code>${
|
|
39212
|
+
lines.push(`<code>${escapeHtml2(input.newLabel)}</code> now: ${fiveStr} of 5h \u00b7 ${sevenStr} of 7d ${headroomStr}`);
|
|
38878
39213
|
} else {
|
|
38879
39214
|
lines.push(`<i>(quota probe for new account is pending \u2014 will reflect on next /auth)</i>`);
|
|
38880
39215
|
}
|
|
@@ -38933,7 +39268,7 @@ function switchPriority(s) {
|
|
|
38933
39268
|
return 2;
|
|
38934
39269
|
return 3;
|
|
38935
39270
|
}
|
|
38936
|
-
function
|
|
39271
|
+
function escapeHtml2(s) {
|
|
38937
39272
|
return s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
38938
39273
|
}
|
|
38939
39274
|
function buildSnapshotsFromState(state3, quotas) {
|
|
@@ -39026,7 +39361,7 @@ function parseAuthCommand(text) {
|
|
|
39026
39361
|
if (tail.length > 0) {
|
|
39027
39362
|
return {
|
|
39028
39363
|
kind: "help",
|
|
39029
|
-
reason: `Unknown <code>rm</code> modifier: <code>${
|
|
39364
|
+
reason: `Unknown <code>rm</code> modifier: <code>${escapeHtml3(tail)}</code>. Use <code>/auth rm <label> confirm</code> to confirm.`
|
|
39030
39365
|
};
|
|
39031
39366
|
}
|
|
39032
39367
|
return { kind: "rm-prompt", label };
|
|
@@ -39046,7 +39381,7 @@ function parseAuthCommand(text) {
|
|
|
39046
39381
|
if (sub !== "override") {
|
|
39047
39382
|
return {
|
|
39048
39383
|
kind: "help",
|
|
39049
|
-
reason: `Unknown <code>agent</code> subcommand: <code>${
|
|
39384
|
+
reason: `Unknown <code>agent</code> subcommand: <code>${escapeHtml3(sub || "(none)")}</code>. Try <code>/auth agent override <agent> <label|clear></code>.`
|
|
39050
39385
|
};
|
|
39051
39386
|
}
|
|
39052
39387
|
const agent = parts[2];
|
|
@@ -39068,7 +39403,7 @@ function parseAuthCommand(text) {
|
|
|
39068
39403
|
case "help":
|
|
39069
39404
|
return { kind: "help" };
|
|
39070
39405
|
default:
|
|
39071
|
-
return { kind: "help", reason: `Unknown verb: <code>${
|
|
39406
|
+
return { kind: "help", reason: `Unknown verb: <code>${escapeHtml3(verb)}</code>` };
|
|
39072
39407
|
}
|
|
39073
39408
|
}
|
|
39074
39409
|
async function handleAuthCommand(parsed, ctx) {
|
|
@@ -39122,7 +39457,7 @@ async function handleAuthCommand(parsed, ctx) {
|
|
|
39122
39457
|
};
|
|
39123
39458
|
} catch (err) {
|
|
39124
39459
|
return {
|
|
39125
|
-
text: `<b>/auth show failed:</b> ${
|
|
39460
|
+
text: `<b>/auth show failed:</b> ${escapeHtml3(err?.message ?? String(err))}`,
|
|
39126
39461
|
html: true
|
|
39127
39462
|
};
|
|
39128
39463
|
}
|
|
@@ -39134,7 +39469,7 @@ async function handleAuthCommand(parsed, ctx) {
|
|
|
39134
39469
|
const agent = state3.agents.find((a) => a.name === agentName3);
|
|
39135
39470
|
if (!agent) {
|
|
39136
39471
|
return {
|
|
39137
|
-
text: `<b>/auth show:</b> no agent named <code>${
|
|
39472
|
+
text: `<b>/auth show:</b> no agent named <code>${escapeHtml3(agentName3)}</code> in broker view.
|
|
39138
39473
|
` + `Run <code>/auth show</code> for the fleet snapshot.`,
|
|
39139
39474
|
html: true
|
|
39140
39475
|
};
|
|
@@ -39142,7 +39477,7 @@ async function handleAuthCommand(parsed, ctx) {
|
|
|
39142
39477
|
return { text: renderAgentDetail(state3, agent), html: true };
|
|
39143
39478
|
} catch (err) {
|
|
39144
39479
|
return {
|
|
39145
|
-
text: `<b>/auth show failed:</b> ${
|
|
39480
|
+
text: `<b>/auth show failed:</b> ${escapeHtml3(err?.message ?? String(err))}`,
|
|
39146
39481
|
html: true
|
|
39147
39482
|
};
|
|
39148
39483
|
}
|
|
@@ -39164,13 +39499,13 @@ async function handleAuthCommand(parsed, ctx) {
|
|
|
39164
39499
|
try {
|
|
39165
39500
|
const result = await ctx.client.setActive(parsed.label);
|
|
39166
39501
|
return {
|
|
39167
|
-
text: `<b>Active account \u2192</b> <code>${
|
|
39502
|
+
text: `<b>Active account \u2192</b> <code>${escapeHtml3(result.active)}</code>
|
|
39168
39503
|
` + `Re-mirrored credentials for ${result.fanned.length} agent${result.fanned.length === 1 ? "" : "s"}.`,
|
|
39169
39504
|
html: true
|
|
39170
39505
|
};
|
|
39171
39506
|
} catch (err) {
|
|
39172
39507
|
return {
|
|
39173
|
-
text: `<b>/auth use failed:</b> ${
|
|
39508
|
+
text: `<b>/auth use failed:</b> ${escapeHtml3(err?.message ?? String(err))}`,
|
|
39174
39509
|
html: true
|
|
39175
39510
|
};
|
|
39176
39511
|
}
|
|
@@ -39188,13 +39523,13 @@ async function handleAuthCommand(parsed, ctx) {
|
|
|
39188
39523
|
}
|
|
39189
39524
|
const result = await ctx.client.setActive(nextLabel);
|
|
39190
39525
|
return {
|
|
39191
|
-
text: `<b>Rotated:</b> active \u2192 <code>${
|
|
39526
|
+
text: `<b>Rotated:</b> active \u2192 <code>${escapeHtml3(result.active)}</code>
|
|
39192
39527
|
` + `Re-mirrored credentials for ${result.fanned.length} agent${result.fanned.length === 1 ? "" : "s"}.`,
|
|
39193
39528
|
html: true
|
|
39194
39529
|
};
|
|
39195
39530
|
} catch (err) {
|
|
39196
39531
|
return {
|
|
39197
|
-
text: `<b>/auth rotate failed:</b> ${
|
|
39532
|
+
text: `<b>/auth rotate failed:</b> ${escapeHtml3(err?.message ?? String(err))}`,
|
|
39198
39533
|
html: true
|
|
39199
39534
|
};
|
|
39200
39535
|
}
|
|
@@ -39205,20 +39540,20 @@ async function handleAuthCommand(parsed, ctx) {
|
|
|
39205
39540
|
state3 = await ctx.client.listState();
|
|
39206
39541
|
} catch (err) {
|
|
39207
39542
|
return {
|
|
39208
|
-
text: `<b>/auth rm failed:</b> ${
|
|
39543
|
+
text: `<b>/auth rm failed:</b> ${escapeHtml3(err?.message ?? String(err))}`,
|
|
39209
39544
|
html: true
|
|
39210
39545
|
};
|
|
39211
39546
|
}
|
|
39212
39547
|
const exists = state3.accounts.some((a) => a.label === parsed.label);
|
|
39213
39548
|
if (!exists) {
|
|
39214
39549
|
return {
|
|
39215
|
-
text: `<b>/auth rm:</b> no account named <code>${
|
|
39550
|
+
text: `<b>/auth rm:</b> no account named <code>${escapeHtml3(parsed.label)}</code>. ` + `Run <code>/auth show</code> for the current list.`,
|
|
39216
39551
|
html: true
|
|
39217
39552
|
};
|
|
39218
39553
|
}
|
|
39219
39554
|
if (state3.active === parsed.label) {
|
|
39220
39555
|
return {
|
|
39221
|
-
text: `<b>/auth rm refused.</b> <code>${
|
|
39556
|
+
text: `<b>/auth rm refused.</b> <code>${escapeHtml3(parsed.label)}</code> is the fleet active. ` + `Switch with <code>/auth use <other></code> or <code>/auth rotate</code> first.`,
|
|
39222
39557
|
html: true
|
|
39223
39558
|
};
|
|
39224
39559
|
}
|
|
@@ -39229,10 +39564,10 @@ async function handleAuthCommand(parsed, ctx) {
|
|
|
39229
39564
|
});
|
|
39230
39565
|
}
|
|
39231
39566
|
return {
|
|
39232
|
-
text: `<b>\u26a0 /auth rm</b> \u2014 about to remove <code>${
|
|
39233
|
-
` + `The fleet active is unchanged. Any agent override pointing at <code>${
|
|
39567
|
+
text: `<b>\u26a0 /auth rm</b> \u2014 about to remove <code>${escapeHtml3(parsed.label)}</code> from the broker.
|
|
39568
|
+
` + `The fleet active is unchanged. Any agent override pointing at <code>${escapeHtml3(parsed.label)}</code> will stop working.
|
|
39234
39569
|
|
|
39235
|
-
` + `Send <code>/auth rm ${
|
|
39570
|
+
` + `Send <code>/auth rm ${escapeHtml3(parsed.label)} confirm</code> within ${Math.round(AUTH_RM_CONFIRM_TTL_MS / 1000)}s to proceed.`,
|
|
39236
39571
|
html: true
|
|
39237
39572
|
};
|
|
39238
39573
|
}
|
|
@@ -39244,7 +39579,7 @@ async function handleAuthCommand(parsed, ctx) {
|
|
|
39244
39579
|
pendingAuthRmFlows.delete(ctx.chatId);
|
|
39245
39580
|
}
|
|
39246
39581
|
return {
|
|
39247
|
-
text: `<b>/auth rm:</b> no pending confirm for <code>${
|
|
39582
|
+
text: `<b>/auth rm:</b> no pending confirm for <code>${escapeHtml3(parsed.label)}</code> (expired or not started). ` + `Send <code>/auth rm ${escapeHtml3(parsed.label)}</code> first.`,
|
|
39248
39583
|
html: true
|
|
39249
39584
|
};
|
|
39250
39585
|
}
|
|
@@ -39253,12 +39588,12 @@ async function handleAuthCommand(parsed, ctx) {
|
|
|
39253
39588
|
try {
|
|
39254
39589
|
const data = await ctx.client.rmAccount(parsed.label);
|
|
39255
39590
|
return {
|
|
39256
|
-
text: `<b>Removed</b> <code>${
|
|
39591
|
+
text: `<b>Removed</b> <code>${escapeHtml3(data.label)}</code> from the broker.`,
|
|
39257
39592
|
html: true
|
|
39258
39593
|
};
|
|
39259
39594
|
} catch (err) {
|
|
39260
39595
|
return {
|
|
39261
|
-
text: `<b>/auth rm failed:</b> ${
|
|
39596
|
+
text: `<b>/auth rm failed:</b> ${escapeHtml3(err?.message ?? String(err))}`,
|
|
39262
39597
|
html: true
|
|
39263
39598
|
};
|
|
39264
39599
|
}
|
|
@@ -39269,7 +39604,7 @@ async function handleAuthCommand(parsed, ctx) {
|
|
|
39269
39604
|
const targets = parsed.label ? state3.accounts.filter((a) => a.label === parsed.label).map((a) => a.label) : state3.accounts.map((a) => a.label);
|
|
39270
39605
|
if (parsed.label && targets.length === 0) {
|
|
39271
39606
|
return {
|
|
39272
|
-
text: `<b>/auth refresh:</b> no account named <code>${
|
|
39607
|
+
text: `<b>/auth refresh:</b> no account named <code>${escapeHtml3(parsed.label)}</code>.`,
|
|
39273
39608
|
html: true
|
|
39274
39609
|
};
|
|
39275
39610
|
}
|
|
@@ -39288,10 +39623,10 @@ async function handleAuthCommand(parsed, ctx) {
|
|
|
39288
39623
|
formatExpiryAbs(data.expiresAt)
|
|
39289
39624
|
]);
|
|
39290
39625
|
} catch (err) {
|
|
39291
|
-
failures.push(`${label}: ${
|
|
39626
|
+
failures.push(`${label}: ${escapeHtml3(err?.message ?? String(err))}`);
|
|
39292
39627
|
}
|
|
39293
39628
|
}
|
|
39294
|
-
const head = targets.length === 1 ? `<b>Refreshed</b> <code>${
|
|
39629
|
+
const head = targets.length === 1 ? `<b>Refreshed</b> <code>${escapeHtml3(targets[0])}</code>` : `<b>Refreshed</b> ${rows.length - 1}/${targets.length} account${targets.length === 1 ? "" : "s"}`;
|
|
39295
39630
|
const table = rows.length > 1 ? `
|
|
39296
39631
|
<pre>${alignTable(rows)}</pre>` : "";
|
|
39297
39632
|
const failBlock = failures.length > 0 ? `
|
|
@@ -39301,7 +39636,7 @@ ${failures.map((f) => ` ${f}`).join(`
|
|
|
39301
39636
|
return { text: head + table + failBlock, html: true };
|
|
39302
39637
|
} catch (err) {
|
|
39303
39638
|
return {
|
|
39304
|
-
text: `<b>/auth refresh failed:</b> ${
|
|
39639
|
+
text: `<b>/auth refresh failed:</b> ${escapeHtml3(err?.message ?? String(err))}`,
|
|
39305
39640
|
html: true
|
|
39306
39641
|
};
|
|
39307
39642
|
}
|
|
@@ -39310,12 +39645,12 @@ ${failures.map((f) => ` ${f}`).join(`
|
|
|
39310
39645
|
try {
|
|
39311
39646
|
const data = await ctx.client.setOverride(parsed.agent, parsed.label);
|
|
39312
39647
|
return {
|
|
39313
|
-
text: `<b>Override set.</b> <code>${
|
|
39648
|
+
text: `<b>Override set.</b> <code>${escapeHtml3(data.agent)}</code> is now pinned to ` + `<code>${escapeHtml3(data.account ?? parsed.label)}</code>.`,
|
|
39314
39649
|
html: true
|
|
39315
39650
|
};
|
|
39316
39651
|
} catch (err) {
|
|
39317
39652
|
return {
|
|
39318
|
-
text: `<b>/auth agent override failed:</b> ${
|
|
39653
|
+
text: `<b>/auth agent override failed:</b> ${escapeHtml3(err?.message ?? String(err))}`,
|
|
39319
39654
|
html: true
|
|
39320
39655
|
};
|
|
39321
39656
|
}
|
|
@@ -39324,12 +39659,12 @@ ${failures.map((f) => ` ${f}`).join(`
|
|
|
39324
39659
|
try {
|
|
39325
39660
|
const data = await ctx.client.setOverride(parsed.agent, null);
|
|
39326
39661
|
return {
|
|
39327
|
-
text: `<b>Override cleared</b> on <code>${
|
|
39662
|
+
text: `<b>Override cleared</b> on <code>${escapeHtml3(data.agent)}</code> ` + `\u2014 back to fleet active.`,
|
|
39328
39663
|
html: true
|
|
39329
39664
|
};
|
|
39330
39665
|
} catch (err) {
|
|
39331
39666
|
return {
|
|
39332
|
-
text: `<b>/auth agent override failed:</b> ${
|
|
39667
|
+
text: `<b>/auth agent override failed:</b> ${escapeHtml3(err?.message ?? String(err))}`,
|
|
39333
39668
|
html: true
|
|
39334
39669
|
};
|
|
39335
39670
|
}
|
|
@@ -39408,7 +39743,7 @@ function formatAccountsTable(state3, now) {
|
|
|
39408
39743
|
const status = isActive ? "active" : acc.exhausted ? "exhausted" : "available";
|
|
39409
39744
|
const expires = acc.expiresAt != null ? formatRelativeMs(acc.expiresAt - now) : "\u2014";
|
|
39410
39745
|
const quotaReset = acc.exhausted && acc.exhausted_until != null && acc.exhausted_until > now ? formatRelativeMs(acc.exhausted_until - now) : "\u2014";
|
|
39411
|
-
rows.push([`${marker} ${
|
|
39746
|
+
rows.push([`${marker} ${escapeHtml3(acc.label)}`, status, expires, quotaReset]);
|
|
39412
39747
|
}
|
|
39413
39748
|
return alignTable(rows);
|
|
39414
39749
|
}
|
|
@@ -39416,15 +39751,15 @@ function formatAgentsTable(state3) {
|
|
|
39416
39751
|
const rows = [["AGENT", "ACTIVE", "SOURCE"]];
|
|
39417
39752
|
for (const a of state3.agents) {
|
|
39418
39753
|
const source = a.override ? "override" : a.account === state3.active ? "fleet-active" : "pinned";
|
|
39419
|
-
rows.push([
|
|
39754
|
+
rows.push([escapeHtml3(a.name), escapeHtml3(a.account), source]);
|
|
39420
39755
|
}
|
|
39421
39756
|
return alignTable(rows);
|
|
39422
39757
|
}
|
|
39423
39758
|
function renderAgentDetail(state3, agent, now = Date.now()) {
|
|
39424
39759
|
const lines = [];
|
|
39425
|
-
lines.push(`<b>${
|
|
39760
|
+
lines.push(`<b>${escapeHtml3(agent.name)}</b>`);
|
|
39426
39761
|
const source = agent.override ? "override" : "fleet-active";
|
|
39427
|
-
lines.push(`Active account: <code>${
|
|
39762
|
+
lines.push(`Active account: <code>${escapeHtml3(agent.account)}</code> (${source})`);
|
|
39428
39763
|
const acct = state3.accounts.find((a) => a.label === agent.account);
|
|
39429
39764
|
if (acct) {
|
|
39430
39765
|
const expRel = acct.expiresAt != null ? formatRelativeMs(acct.expiresAt - now) : "\u2014";
|
|
@@ -39447,11 +39782,11 @@ function formatConsumersTable(state3, now) {
|
|
|
39447
39782
|
const rows = [["CONSUMER", "ACTIVE", "STATUS"]];
|
|
39448
39783
|
for (const c of state3.consumers) {
|
|
39449
39784
|
const status = c.last_seen_at == null ? "socket bound" : `socket bound (last seen ${formatRelativeMs(now - c.last_seen_at)} ago)`;
|
|
39450
|
-
rows.push([
|
|
39785
|
+
rows.push([escapeHtml3(c.name), escapeHtml3(c.account), status]);
|
|
39451
39786
|
}
|
|
39452
39787
|
return alignTable(rows);
|
|
39453
39788
|
}
|
|
39454
|
-
function
|
|
39789
|
+
function escapeHtml3(s) {
|
|
39455
39790
|
return s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
39456
39791
|
}
|
|
39457
39792
|
function formatRelativeMs(ms) {
|
|
@@ -39536,7 +39871,7 @@ import * as net2 from "node:net";
|
|
|
39536
39871
|
init_protocol();
|
|
39537
39872
|
import { homedir as homedir4 } from "node:os";
|
|
39538
39873
|
import { randomUUID as randomUUID4 } from "node:crypto";
|
|
39539
|
-
import { join as
|
|
39874
|
+
import { join as join10 } from "node:path";
|
|
39540
39875
|
var DEFAULT_TIMEOUT_MS2 = 5000;
|
|
39541
39876
|
function reviveDate2(v) {
|
|
39542
39877
|
if (v == null)
|
|
@@ -39547,7 +39882,7 @@ function reviveDate2(v) {
|
|
|
39547
39882
|
return Number.isNaN(d.getTime()) ? null : d;
|
|
39548
39883
|
}
|
|
39549
39884
|
function operatorSocketPath2(home = homedir4()) {
|
|
39550
|
-
return
|
|
39885
|
+
return join10(home, ".switchroom", "state", "auth-broker-operator", "sock");
|
|
39551
39886
|
}
|
|
39552
39887
|
function resolveAuthBrokerSocketPath2(opts) {
|
|
39553
39888
|
if (opts?.socket)
|
|
@@ -39879,16 +40214,16 @@ function createFleetFallbackGate(opts) {
|
|
|
39879
40214
|
|
|
39880
40215
|
// gateway/auth-add-flow.ts
|
|
39881
40216
|
import { spawn } from "node:child_process";
|
|
39882
|
-
import { existsSync as
|
|
40217
|
+
import { existsSync as existsSync12, mkdirSync as mkdirSync8, readFileSync as readFileSync7, rmSync as rmSync2 } from "node:fs";
|
|
39883
40218
|
import { homedir as homedir6 } from "node:os";
|
|
39884
|
-
import { join as
|
|
40219
|
+
import { join as join11 } from "node:path";
|
|
39885
40220
|
import { randomBytes as randomBytes2 } from "node:crypto";
|
|
39886
40221
|
|
|
39887
40222
|
// ../src/auth/manager.ts
|
|
39888
40223
|
import {
|
|
39889
40224
|
readFileSync as readFileSync6,
|
|
39890
40225
|
readdirSync as readdirSync2,
|
|
39891
|
-
existsSync as
|
|
40226
|
+
existsSync as existsSync11,
|
|
39892
40227
|
writeFileSync as writeFileSync5,
|
|
39893
40228
|
mkdirSync as mkdirSync7,
|
|
39894
40229
|
mkdtempSync,
|
|
@@ -39915,7 +40250,7 @@ function parseSetupTokenUrl(output) {
|
|
|
39915
40250
|
}
|
|
39916
40251
|
function readTokenFromCredentialsFile(credentialsFilePath) {
|
|
39917
40252
|
try {
|
|
39918
|
-
if (!
|
|
40253
|
+
if (!existsSync11(credentialsFilePath))
|
|
39919
40254
|
return null;
|
|
39920
40255
|
const raw = readFileSync6(credentialsFilePath, "utf-8");
|
|
39921
40256
|
const parsed = JSON.parse(raw);
|
|
@@ -39934,7 +40269,7 @@ function readTokenFromCredentialsFile(credentialsFilePath) {
|
|
|
39934
40269
|
var pendingAuthAddFlows = new Map;
|
|
39935
40270
|
function pickScratchDir(label, home2 = homedir6()) {
|
|
39936
40271
|
const suffix = randomBytes2(8).toString("hex");
|
|
39937
|
-
return
|
|
40272
|
+
return join11(home2, ".switchroom", "accounts", ".in-progress", `${label}-${suffix}`);
|
|
39938
40273
|
}
|
|
39939
40274
|
function cleanScratchDir(scratchDir) {
|
|
39940
40275
|
try {
|
|
@@ -39995,7 +40330,7 @@ async function startAccountAuthSession(label, opts = {}) {
|
|
|
39995
40330
|
async function submitAccountAuthCode(flow, code, opts = {}) {
|
|
39996
40331
|
const pollIntervalMs = opts.pollIntervalMs ?? 250;
|
|
39997
40332
|
const pollTimeoutMs = opts.pollTimeoutMs ?? 120000;
|
|
39998
|
-
const credentialsPath =
|
|
40333
|
+
const credentialsPath = join11(flow.scratchDir, ".credentials.json");
|
|
39999
40334
|
if (!flow.child.stdin || flow.child.stdin.destroyed) {
|
|
40000
40335
|
cleanScratchDir(flow.scratchDir);
|
|
40001
40336
|
throw new Error("claude setup-token process stdin is not writable (child may have exited)");
|
|
@@ -40005,7 +40340,7 @@ async function submitAccountAuthCode(flow, code, opts = {}) {
|
|
|
40005
40340
|
const deadline = Date.now() + pollTimeoutMs;
|
|
40006
40341
|
while (Date.now() < deadline) {
|
|
40007
40342
|
await new Promise((r) => setTimeout(r, pollIntervalMs));
|
|
40008
|
-
if (
|
|
40343
|
+
if (existsSync12(credentialsPath)) {
|
|
40009
40344
|
const token = readTokenFromCredentialsFile(credentialsPath);
|
|
40010
40345
|
if (token) {
|
|
40011
40346
|
try {
|
|
@@ -40766,11 +41101,11 @@ function renderTable(headers, rows) {
|
|
|
40766
41101
|
if (colCount <= 3 && rowCount <= 6) {
|
|
40767
41102
|
const bullets = rows.map((row) => {
|
|
40768
41103
|
const cells = headers.map((_, i) => (row[i] ?? "").trim());
|
|
40769
|
-
const key =
|
|
40770
|
-
const rest = cells.slice(1).filter((v) => v !== "").map((v) => ` \u2014 ${
|
|
41104
|
+
const key = escapeHtml5(cells[0] || "\u2014");
|
|
41105
|
+
const rest = cells.slice(1).filter((v) => v !== "").map((v) => ` \u2014 ${escapeHtml5(v)}`).join("");
|
|
40771
41106
|
return `\u2022 <b>${key}</b>${rest}`;
|
|
40772
41107
|
});
|
|
40773
|
-
const headerLine = colCount >= 2 ? `<b>${headers.map((h) =>
|
|
41108
|
+
const headerLine = colCount >= 2 ? `<b>${headers.map((h) => escapeHtml5(h)).join(" / ")}</b>
|
|
40774
41109
|
` : "";
|
|
40775
41110
|
return headerLine + bullets.join(`
|
|
40776
41111
|
`);
|
|
@@ -40785,7 +41120,7 @@ function renderTable(headers, rows) {
|
|
|
40785
41120
|
sepLine,
|
|
40786
41121
|
...rows.map((r) => formatRow(r))
|
|
40787
41122
|
];
|
|
40788
|
-
return `<pre>${
|
|
41123
|
+
return `<pre>${escapeHtml5(lines.join(`
|
|
40789
41124
|
`))}</pre>`;
|
|
40790
41125
|
}
|
|
40791
41126
|
function extractMarkdownTables(text, store2, placeholderPrefix) {
|
|
@@ -40833,7 +41168,7 @@ function markdownToHtml(text) {
|
|
|
40833
41168
|
const INLINE_PH = "\x00CODEINLINE";
|
|
40834
41169
|
const TABLE_PH = "\x00TABLEBLOCK";
|
|
40835
41170
|
let result = text.replace(/```(\w*)\n([\s\S]*?)```/g, (_m, lang, code) => {
|
|
40836
|
-
const escaped =
|
|
41171
|
+
const escaped = escapeHtml5(code.replace(/\n$/, ""));
|
|
40837
41172
|
const cls = lang ? ` class="language-${lang}"` : "";
|
|
40838
41173
|
const idx = codeBlocks.length;
|
|
40839
41174
|
codeBlocks.push(`<pre><code${cls}>${escaped}</code></pre>`);
|
|
@@ -40846,7 +41181,7 @@ function markdownToHtml(text) {
|
|
|
40846
41181
|
const inlineCodes = [];
|
|
40847
41182
|
result = result.replace(/`([^`\n]+)`/g, (_m, code) => {
|
|
40848
41183
|
const idx = inlineCodes.length;
|
|
40849
|
-
inlineCodes.push(`<code>${
|
|
41184
|
+
inlineCodes.push(`<code>${escapeHtml5(code)}</code>`);
|
|
40850
41185
|
return `${INLINE_PH}${idx}\x00`;
|
|
40851
41186
|
});
|
|
40852
41187
|
const htmlTags = [];
|
|
@@ -40858,24 +41193,24 @@ function markdownToHtml(text) {
|
|
|
40858
41193
|
htmlTags.push(match);
|
|
40859
41194
|
return `${HTMLTAG_PH}${idx}\x00`;
|
|
40860
41195
|
});
|
|
40861
|
-
result =
|
|
41196
|
+
result = escapeHtml5(result);
|
|
40862
41197
|
result = result.replace(/\*\*(.+?)\*\*/g, "<b>$1</b>");
|
|
40863
41198
|
result = result.replace(/(?<!\*)\*(?!\*)(.+?)(?<!\*)\*(?!\*)/g, "<i>$1</i>");
|
|
40864
41199
|
result = result.replace(/(?<![\w_])_(?!_)([^_\n]+?)_(?![\w_])/g, "<i>$1</i>");
|
|
40865
41200
|
result = result.replace(/~~(.+?)~~/g, "<s>$1</s>");
|
|
40866
|
-
result = result.replace(new RegExp(`${
|
|
40867
|
-
result = result.replace(new RegExp(`${
|
|
40868
|
-
result = result.replace(new RegExp(`${
|
|
41201
|
+
result = result.replace(new RegExp(`${escapeHtml5(BLOCK_PH)}(\\d+)${escapeHtml5("\x00")}`, "g"), (_m, idx) => codeBlocks[Number(idx)]);
|
|
41202
|
+
result = result.replace(new RegExp(`${escapeHtml5(TABLE_PH)}(\\d+)${escapeHtml5("\x00")}`, "g"), (_m, idx) => codeBlocks[Number(idx)]);
|
|
41203
|
+
result = result.replace(new RegExp(`${escapeHtml5(INLINE_PH)}(\\d+)${escapeHtml5("\x00")}`, "g"), (_m, idx) => inlineCodes[Number(idx)]);
|
|
40869
41204
|
const ALLOWED_LINK_SCHEMES = /^(?:https?|mailto|tel|tg):/i;
|
|
40870
41205
|
result = result.replace(/\[([^\]]+)\]\(([^)]+)\)/g, (_m, linkText, url) => {
|
|
40871
41206
|
const safe = ALLOWED_LINK_SCHEMES.test(url.trim()) ? url.trim() : "#";
|
|
40872
|
-
return `<a href="${
|
|
41207
|
+
return `<a href="${escapeHtml5(safe)}">${linkText}</a>`;
|
|
40873
41208
|
});
|
|
40874
41209
|
result = result.replace(/(?<![<\/\w>])(\b[\w][\w.-]*\.(?:ts|js|py|rs|go|json|yaml|yml|toml|md|txt|sh|bash|zsh|css|html|xml|sql|env|cfg|conf|ini|log|csv|tsx|jsx|vue|svelte|rb|java|kt|swift|c|cpp|h|hpp|zig|asm|wasm|lock|mod|sum)\b)(?![^<]*>)/g, "<code>$1</code>");
|
|
40875
|
-
result = result.replace(new RegExp(`${
|
|
41210
|
+
result = result.replace(new RegExp(`${escapeHtml5(HTMLTAG_PH)}(\\d+)${escapeHtml5("\x00")}`, "g"), (_m, idx) => htmlTags[Number(idx)]);
|
|
40876
41211
|
return result;
|
|
40877
41212
|
}
|
|
40878
|
-
function
|
|
41213
|
+
function escapeHtml5(text) {
|
|
40879
41214
|
return text.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
40880
41215
|
}
|
|
40881
41216
|
function telegramHtmlToPlainText(html) {
|
|
@@ -41276,7 +41611,7 @@ async function finalizeCallback(ctx, opts) {
|
|
|
41276
41611
|
}
|
|
41277
41612
|
|
|
41278
41613
|
// welcome-text.ts
|
|
41279
|
-
function
|
|
41614
|
+
function escapeHtml6(text) {
|
|
41280
41615
|
return text.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
41281
41616
|
}
|
|
41282
41617
|
function formatAuthLine(auth) {
|
|
@@ -41288,13 +41623,13 @@ function formatAuthLine(auth) {
|
|
|
41288
41623
|
return "\u2717 not authenticated";
|
|
41289
41624
|
}
|
|
41290
41625
|
const sub = auth.subscription_type ?? "subscription";
|
|
41291
|
-
const expires = auth.expires_in ? ` \u00b7 expires ${
|
|
41292
|
-
return `\u2713 ${
|
|
41626
|
+
const expires = auth.expires_in ? ` \u00b7 expires ${escapeHtml6(auth.expires_in)}` : "";
|
|
41627
|
+
return `\u2713 ${escapeHtml6(sub)}${expires}`;
|
|
41293
41628
|
}
|
|
41294
41629
|
function formatAgentLine(meta) {
|
|
41295
41630
|
const m = meta.model && meta.model.length > 0 ? meta.model : "default";
|
|
41296
|
-
const topic = meta.topicName ? ` \u00b7 topic: ${
|
|
41297
|
-
return `<b>${
|
|
41631
|
+
const topic = meta.topicName ? ` \u00b7 topic: ${escapeHtml6([meta.topicEmoji, meta.topicName].filter(Boolean).join(" "))}` : "";
|
|
41632
|
+
return `<b>${escapeHtml6(meta.agentName)}</b> \u00b7 model: <code>${escapeHtml6(m)}</code>${topic}`;
|
|
41298
41633
|
}
|
|
41299
41634
|
function startText(agentName3, dmDisabled) {
|
|
41300
41635
|
if (dmDisabled)
|
|
@@ -41302,7 +41637,7 @@ function startText(agentName3, dmDisabled) {
|
|
|
41302
41637
|
return [
|
|
41303
41638
|
`<b>Switchroom</b> \u2014 Telegram on your Claude Pro or Max subscription.`,
|
|
41304
41639
|
``,
|
|
41305
|
-
`This bot is the <b>${
|
|
41640
|
+
`This bot is the <b>${escapeHtml6(agentName3)}</b> agent. Pair first, then send messages here and they reach the agent; replies and reactions come back.`,
|
|
41306
41641
|
``,
|
|
41307
41642
|
`<b>To pair:</b>`,
|
|
41308
41643
|
`1. DM me anything \u2014 you'll get a 6-char code`,
|
|
@@ -41316,7 +41651,7 @@ function helpText(agentName3) {
|
|
|
41316
41651
|
return [
|
|
41317
41652
|
`<b>Switchroom</b> \u2014 your Pro/Max subscription, wired to Telegram.`,
|
|
41318
41653
|
``,
|
|
41319
|
-
`This bot is the <b>${
|
|
41654
|
+
`This bot is the <b>${escapeHtml6(agentName3)}</b> agent. Text and photos route through to it; replies, reactions and progress cards come back.`,
|
|
41320
41655
|
``,
|
|
41321
41656
|
`Tool approvals surface as inline buttons (\u2705 / \u274c) or via <code>/approve</code>, <code>/deny</code>, <code>/pending</code>. Start a fresh session with <code>/new</code> or <code>/reset</code>.`,
|
|
41322
41657
|
``,
|
|
@@ -41335,40 +41670,40 @@ var STATUS_DOT = {
|
|
|
41335
41670
|
function statusPairedText(params) {
|
|
41336
41671
|
const { user, meta } = params;
|
|
41337
41672
|
const lines = [
|
|
41338
|
-
`Paired as ${
|
|
41673
|
+
`Paired as ${escapeHtml6(user)}.`,
|
|
41339
41674
|
``,
|
|
41340
41675
|
`Agent: ${formatAgentLine(meta)}`,
|
|
41341
41676
|
`Auth: ${formatAuthLine(meta.auth)}`
|
|
41342
41677
|
];
|
|
41343
41678
|
if (meta.status)
|
|
41344
|
-
lines.push(`Status: <code>${
|
|
41679
|
+
lines.push(`Status: <code>${escapeHtml6(meta.status)}</code>${meta.uptime ? ` \u00b7 up ${escapeHtml6(meta.uptime)}` : ""}`);
|
|
41345
41680
|
if (meta.live && meta.live.length > 0) {
|
|
41346
41681
|
lines.push("");
|
|
41347
41682
|
lines.push("<b>Health</b>");
|
|
41348
41683
|
for (const row of meta.live) {
|
|
41349
41684
|
const dot = STATUS_DOT[row.status] ?? STATUS_DOT.fail;
|
|
41350
|
-
lines.push(`${dot} <b>${
|
|
41685
|
+
lines.push(`${dot} <b>${escapeHtml6(row.label)}</b> ${escapeHtml6(row.detail)}`);
|
|
41351
41686
|
}
|
|
41352
41687
|
}
|
|
41353
41688
|
const audit = meta.audit;
|
|
41354
41689
|
if (audit) {
|
|
41355
41690
|
lines.push("");
|
|
41356
41691
|
if (audit.version)
|
|
41357
|
-
lines.push(`<b>Version</b> ${
|
|
41692
|
+
lines.push(`<b>Version</b> ${escapeHtml6(audit.version)}`);
|
|
41358
41693
|
if (meta.extendsProfile)
|
|
41359
|
-
lines.push(`<b>Profile</b> ${
|
|
41694
|
+
lines.push(`<b>Profile</b> ${escapeHtml6(meta.extendsProfile)}`);
|
|
41360
41695
|
if (audit.tools)
|
|
41361
|
-
lines.push(`<b>Tools</b> ${
|
|
41696
|
+
lines.push(`<b>Tools</b> ${escapeHtml6(audit.tools)}`);
|
|
41362
41697
|
if (audit.toolsDeny)
|
|
41363
|
-
lines.push(`<b>Deny</b> ${
|
|
41698
|
+
lines.push(`<b>Deny</b> ${escapeHtml6(audit.toolsDeny)}`);
|
|
41364
41699
|
if (audit.skills)
|
|
41365
|
-
lines.push(`<b>Skills</b> ${
|
|
41700
|
+
lines.push(`<b>Skills</b> ${escapeHtml6(audit.skills)}`);
|
|
41366
41701
|
if (audit.limits)
|
|
41367
|
-
lines.push(`<b>Limits</b> ${
|
|
41702
|
+
lines.push(`<b>Limits</b> ${escapeHtml6(audit.limits)}`);
|
|
41368
41703
|
if (audit.channel)
|
|
41369
|
-
lines.push(`<b>Channel</b> ${
|
|
41704
|
+
lines.push(`<b>Channel</b> ${escapeHtml6(audit.channel)}`);
|
|
41370
41705
|
if (audit.memoryBank)
|
|
41371
|
-
lines.push(`<b>Memory</b> ${
|
|
41706
|
+
lines.push(`<b>Memory</b> ${escapeHtml6(audit.memoryBank)}`);
|
|
41372
41707
|
}
|
|
41373
41708
|
return lines.join(`
|
|
41374
41709
|
`);
|
|
@@ -41376,7 +41711,7 @@ function statusPairedText(params) {
|
|
|
41376
41711
|
function statusPendingText(code) {
|
|
41377
41712
|
return `Pending pairing \u2014 run in Claude Code:
|
|
41378
41713
|
|
|
41379
|
-
<code>/telegram:access pair ${
|
|
41714
|
+
<code>/telegram:access pair ${escapeHtml6(code)}</code>`;
|
|
41380
41715
|
}
|
|
41381
41716
|
function statusUnpairedText() {
|
|
41382
41717
|
return "Not paired. Send me a message to get a pairing code.";
|
|
@@ -41405,7 +41740,7 @@ var TELEGRAM_BASE_COMMANDS = TELEGRAM_MENU_COMMANDS.slice(0, 3);
|
|
|
41405
41740
|
var TELEGRAM_SWITCHROOM_COMMANDS = TELEGRAM_MENU_COMMANDS.slice(3);
|
|
41406
41741
|
function switchroomHelpText(agentName3) {
|
|
41407
41742
|
return [
|
|
41408
|
-
`<b>Switchroom bot</b> \u2014 commands for the <b>${
|
|
41743
|
+
`<b>Switchroom bot</b> \u2014 commands for the <b>${escapeHtml6(agentName3)}</b> agent.`,
|
|
41409
41744
|
``,
|
|
41410
41745
|
`<b>Session & approvals</b>`,
|
|
41411
41746
|
`<code>/new</code> \u2014 fresh session (flush handoff, restart)`,
|
|
@@ -41453,15 +41788,15 @@ function switchroomHelpText(agentName3) {
|
|
|
41453
41788
|
`);
|
|
41454
41789
|
}
|
|
41455
41790
|
function restartAckText(agentName3) {
|
|
41456
|
-
return `\uD83D\uDD04 Restarting <b>${
|
|
41791
|
+
return `\uD83D\uDD04 Restarting <b>${escapeHtml6(agentName3)}</b>\u2026`;
|
|
41457
41792
|
}
|
|
41458
41793
|
function newSessionAckText(agentName3, flushedHandoff) {
|
|
41459
41794
|
const tail = flushedHandoff ? " \u00b7 flushed handoff" : "";
|
|
41460
|
-
return `\uD83C\uDD95 Started fresh session for <b>${
|
|
41795
|
+
return `\uD83C\uDD95 Started fresh session for <b>${escapeHtml6(agentName3)}</b>${tail} \u00b7 restarting\u2026`;
|
|
41461
41796
|
}
|
|
41462
41797
|
function resetSessionAckText(agentName3, flushedHandoff) {
|
|
41463
41798
|
const tail = flushedHandoff ? " \u00b7 flushed handoff" : "";
|
|
41464
|
-
return `\uD83D\uDD04 Reset session for <b>${
|
|
41799
|
+
return `\uD83D\uDD04 Reset session for <b>${escapeHtml6(agentName3)}</b>${tail} \u00b7 restarting\u2026`;
|
|
41465
41800
|
}
|
|
41466
41801
|
|
|
41467
41802
|
// gateway/auth-status-adapter.ts
|
|
@@ -41565,8 +41900,8 @@ function isTurnFlushSafetyEnabled(env = process.env) {
|
|
|
41565
41900
|
}
|
|
41566
41901
|
|
|
41567
41902
|
// handoff-continuity.ts
|
|
41568
|
-
import { readFileSync as readFileSync9, unlinkSync as
|
|
41569
|
-
import { dirname as dirname7, join as
|
|
41903
|
+
import { readFileSync as readFileSync9, unlinkSync as unlinkSync3, existsSync as existsSync14, writeFileSync as writeFileSync6, renameSync as renameSync2 } from "node:fs";
|
|
41904
|
+
import { dirname as dirname7, join as join14 } from "node:path";
|
|
41570
41905
|
var TOPIC_DISPLAY_MAX = 117;
|
|
41571
41906
|
var HANDOFF_TOPIC_FILENAME = ".handoff-topic";
|
|
41572
41907
|
var LAST_TURN_SUMMARY_FILENAME = ".last-turn-summary";
|
|
@@ -41577,8 +41912,8 @@ function resolveAgentDirFromEnv() {
|
|
|
41577
41912
|
return dirname7(state3);
|
|
41578
41913
|
}
|
|
41579
41914
|
function readHandoffTopic(agentDir) {
|
|
41580
|
-
const p =
|
|
41581
|
-
if (!
|
|
41915
|
+
const p = join14(agentDir, HANDOFF_TOPIC_FILENAME);
|
|
41916
|
+
if (!existsSync14(p))
|
|
41582
41917
|
return null;
|
|
41583
41918
|
let raw;
|
|
41584
41919
|
try {
|
|
@@ -41596,8 +41931,8 @@ function readHandoffTopic(agentDir) {
|
|
|
41596
41931
|
return topic;
|
|
41597
41932
|
}
|
|
41598
41933
|
function readLastTurnSummary(agentDir) {
|
|
41599
|
-
const p =
|
|
41600
|
-
if (!
|
|
41934
|
+
const p = join14(agentDir, LAST_TURN_SUMMARY_FILENAME);
|
|
41935
|
+
if (!existsSync14(p))
|
|
41601
41936
|
return null;
|
|
41602
41937
|
let raw;
|
|
41603
41938
|
try {
|
|
@@ -41616,16 +41951,16 @@ function readLastTurnSummary(agentDir) {
|
|
|
41616
41951
|
}
|
|
41617
41952
|
function consumeHandoffTopic(agentDir) {
|
|
41618
41953
|
const primary = readHandoffTopic(agentDir);
|
|
41619
|
-
const primaryPath =
|
|
41620
|
-
const fallbackPath =
|
|
41954
|
+
const primaryPath = join14(agentDir, HANDOFF_TOPIC_FILENAME);
|
|
41955
|
+
const fallbackPath = join14(agentDir, LAST_TURN_SUMMARY_FILENAME);
|
|
41621
41956
|
const removeFallback = () => {
|
|
41622
41957
|
try {
|
|
41623
|
-
|
|
41958
|
+
unlinkSync3(fallbackPath);
|
|
41624
41959
|
} catch {}
|
|
41625
41960
|
};
|
|
41626
41961
|
if (primary !== null) {
|
|
41627
41962
|
try {
|
|
41628
|
-
|
|
41963
|
+
unlinkSync3(primaryPath);
|
|
41629
41964
|
} catch {}
|
|
41630
41965
|
removeFallback();
|
|
41631
41966
|
return primary;
|
|
@@ -41646,7 +41981,7 @@ function shouldShowHandoffLine() {
|
|
|
41646
41981
|
function formatHandoffLine(topic, format) {
|
|
41647
41982
|
const prefix = "\u21a9\ufe0f Picked up where we left off, ";
|
|
41648
41983
|
if (format === "html") {
|
|
41649
|
-
return `<i>${prefix}${
|
|
41984
|
+
return `<i>${prefix}${escapeHtml7(topic)}</i>
|
|
41650
41985
|
|
|
41651
41986
|
`;
|
|
41652
41987
|
}
|
|
@@ -41661,7 +41996,7 @@ function formatHandoffLine(topic, format) {
|
|
|
41661
41996
|
|
|
41662
41997
|
`;
|
|
41663
41998
|
}
|
|
41664
|
-
function
|
|
41999
|
+
function escapeHtml7(s) {
|
|
41665
42000
|
return s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
41666
42001
|
}
|
|
41667
42002
|
var MDV2_SPECIALS = /[_*\[\]()~`>#+\-=|{}.!\\]/g;
|
|
@@ -41670,15 +42005,15 @@ function escapeMarkdownV2(s) {
|
|
|
41670
42005
|
}
|
|
41671
42006
|
|
|
41672
42007
|
// active-reactions.ts
|
|
41673
|
-
import { readFileSync as readFileSync10, writeFileSync as writeFileSync7, renameSync as renameSync3, existsSync as
|
|
41674
|
-
import { join as
|
|
42008
|
+
import { readFileSync as readFileSync10, writeFileSync as writeFileSync7, renameSync as renameSync3, existsSync as existsSync15, unlinkSync as unlinkSync4 } from "node:fs";
|
|
42009
|
+
import { join as join15 } from "node:path";
|
|
41675
42010
|
var ACTIVE_REACTIONS_FILENAME = ".active-reactions.json";
|
|
41676
42011
|
function reactionsPath(agentDir) {
|
|
41677
|
-
return
|
|
42012
|
+
return join15(agentDir, ACTIVE_REACTIONS_FILENAME);
|
|
41678
42013
|
}
|
|
41679
42014
|
function readActiveReactions(agentDir) {
|
|
41680
42015
|
const p = reactionsPath(agentDir);
|
|
41681
|
-
if (!
|
|
42016
|
+
if (!existsSync15(p))
|
|
41682
42017
|
return [];
|
|
41683
42018
|
let raw;
|
|
41684
42019
|
try {
|
|
@@ -41708,7 +42043,7 @@ function writeActiveReactions(agentDir, reactions) {
|
|
|
41708
42043
|
const p = reactionsPath(agentDir);
|
|
41709
42044
|
if (reactions.length === 0) {
|
|
41710
42045
|
try {
|
|
41711
|
-
|
|
42046
|
+
unlinkSync4(p);
|
|
41712
42047
|
} catch {}
|
|
41713
42048
|
return;
|
|
41714
42049
|
}
|
|
@@ -41733,20 +42068,20 @@ function removeActiveReaction(agentDir, chatId, messageId) {
|
|
|
41733
42068
|
}
|
|
41734
42069
|
function clearActiveReactions(agentDir) {
|
|
41735
42070
|
try {
|
|
41736
|
-
|
|
42071
|
+
unlinkSync4(reactionsPath(agentDir));
|
|
41737
42072
|
} catch {}
|
|
41738
42073
|
}
|
|
41739
42074
|
|
|
41740
42075
|
// active-reactions.ts
|
|
41741
|
-
import { readFileSync as readFileSync11, writeFileSync as writeFileSync8, renameSync as renameSync4, existsSync as
|
|
41742
|
-
import { join as
|
|
42076
|
+
import { readFileSync as readFileSync11, writeFileSync as writeFileSync8, renameSync as renameSync4, existsSync as existsSync16, unlinkSync as unlinkSync5 } from "node:fs";
|
|
42077
|
+
import { join as join16 } from "node:path";
|
|
41743
42078
|
var ACTIVE_REACTIONS_FILENAME2 = ".active-reactions.json";
|
|
41744
42079
|
function reactionsPath2(agentDir) {
|
|
41745
|
-
return
|
|
42080
|
+
return join16(agentDir, ACTIVE_REACTIONS_FILENAME2);
|
|
41746
42081
|
}
|
|
41747
42082
|
function readActiveReactions2(agentDir) {
|
|
41748
42083
|
const p = reactionsPath2(agentDir);
|
|
41749
|
-
if (!
|
|
42084
|
+
if (!existsSync16(p))
|
|
41750
42085
|
return [];
|
|
41751
42086
|
let raw;
|
|
41752
42087
|
try {
|
|
@@ -41774,7 +42109,7 @@ function readActiveReactions2(agentDir) {
|
|
|
41774
42109
|
}
|
|
41775
42110
|
function clearActiveReactions2(agentDir) {
|
|
41776
42111
|
try {
|
|
41777
|
-
|
|
42112
|
+
unlinkSync5(reactionsPath2(agentDir));
|
|
41778
42113
|
} catch {}
|
|
41779
42114
|
}
|
|
41780
42115
|
|
|
@@ -42627,14 +42962,14 @@ async function approvalRecord(args, opts) {
|
|
|
42627
42962
|
}
|
|
42628
42963
|
|
|
42629
42964
|
// quota-check.ts
|
|
42630
|
-
import { readFileSync as readFileSync13, existsSync as
|
|
42631
|
-
import { join as
|
|
42965
|
+
import { readFileSync as readFileSync13, existsSync as existsSync18 } from "fs";
|
|
42966
|
+
import { join as join18 } from "path";
|
|
42632
42967
|
var OAUTH_BETA2 = "oauth-2025-04-20";
|
|
42633
42968
|
var DEFAULT_USER_AGENT2 = "claude-cli/1.0.0 (external, cli)";
|
|
42634
42969
|
var DEFAULT_PROBE_MODEL2 = "claude-haiku-4-5-20251001";
|
|
42635
42970
|
function readOauthToken2(claudeConfigDir) {
|
|
42636
|
-
const tokenFile =
|
|
42637
|
-
if (!
|
|
42971
|
+
const tokenFile = join18(claudeConfigDir, ".oauth-token");
|
|
42972
|
+
if (!existsSync18(tokenFile))
|
|
42638
42973
|
return null;
|
|
42639
42974
|
try {
|
|
42640
42975
|
const raw = readFileSync13(tokenFile, "utf-8").trim();
|
|
@@ -43233,7 +43568,7 @@ init_schema();
|
|
|
43233
43568
|
init_paths();
|
|
43234
43569
|
init_overlay_loader();
|
|
43235
43570
|
init_merge();
|
|
43236
|
-
import { readFileSync as readFileSync14, existsSync as
|
|
43571
|
+
import { readFileSync as readFileSync14, existsSync as existsSync19 } from "node:fs";
|
|
43237
43572
|
import { homedir as homedir8 } from "node:os";
|
|
43238
43573
|
import { resolve as resolve5 } from "node:path";
|
|
43239
43574
|
|
|
@@ -43309,7 +43644,7 @@ function findConfigFile2(startDir) {
|
|
|
43309
43644
|
resolve5(userDir, "clerk.yml")
|
|
43310
43645
|
].filter(Boolean);
|
|
43311
43646
|
for (const path of searchPaths) {
|
|
43312
|
-
if (
|
|
43647
|
+
if (existsSync19(path)) {
|
|
43313
43648
|
return path;
|
|
43314
43649
|
}
|
|
43315
43650
|
}
|
|
@@ -43317,7 +43652,7 @@ function findConfigFile2(startDir) {
|
|
|
43317
43652
|
}
|
|
43318
43653
|
function loadConfig2(configPath) {
|
|
43319
43654
|
const filePath = configPath ?? findConfigFile2();
|
|
43320
|
-
if (!
|
|
43655
|
+
if (!existsSync19(filePath)) {
|
|
43321
43656
|
throw new ConfigError2(`Config file not found: ${filePath}`);
|
|
43322
43657
|
}
|
|
43323
43658
|
let raw;
|
|
@@ -43750,9 +44085,9 @@ function resolveOutboundTopic(config, event) {
|
|
|
43750
44085
|
}
|
|
43751
44086
|
|
|
43752
44087
|
// ../src/agents/perf.ts
|
|
43753
|
-
import { existsSync as
|
|
44088
|
+
import { existsSync as existsSync20, readFileSync as readFileSync15 } from "node:fs";
|
|
43754
44089
|
function readTurnUsages(jsonlPath, lastN) {
|
|
43755
|
-
if (!
|
|
44090
|
+
if (!existsSync20(jsonlPath))
|
|
43756
44091
|
return [];
|
|
43757
44092
|
if (lastN <= 0)
|
|
43758
44093
|
return [];
|
|
@@ -43896,7 +44231,7 @@ function nextCompactNotify(state3, ev) {
|
|
|
43896
44231
|
}
|
|
43897
44232
|
|
|
43898
44233
|
// gateway/hostd-dispatch.ts
|
|
43899
|
-
import { existsSync as
|
|
44234
|
+
import { existsSync as existsSync21 } from "node:fs";
|
|
43900
44235
|
import { randomBytes as randomBytes3 } from "node:crypto";
|
|
43901
44236
|
|
|
43902
44237
|
// ../src/host-control/client.ts
|
|
@@ -44187,13 +44522,13 @@ function hostdSocketPath(agentName3) {
|
|
|
44187
44522
|
function hostdWillBeUsed(agentName3) {
|
|
44188
44523
|
if (!isHostdEnabled())
|
|
44189
44524
|
return false;
|
|
44190
|
-
return
|
|
44525
|
+
return existsSync21(hostdSocketPath(agentName3));
|
|
44191
44526
|
}
|
|
44192
44527
|
async function tryHostdDispatch(agentName3, req) {
|
|
44193
44528
|
if (!isHostdEnabled())
|
|
44194
44529
|
return "not-configured";
|
|
44195
44530
|
const sockPath = hostdSocketPath(agentName3);
|
|
44196
|
-
if (!
|
|
44531
|
+
if (!existsSync21(sockPath))
|
|
44197
44532
|
return "not-configured";
|
|
44198
44533
|
try {
|
|
44199
44534
|
return await hostdRequest({ socketPath: sockPath, timeoutMs: 5000 }, req);
|
|
@@ -44217,7 +44552,7 @@ async function hostdGetStatusOnce(agentName3, targetRequestId) {
|
|
|
44217
44552
|
if (!isHostdEnabled())
|
|
44218
44553
|
return "not-configured";
|
|
44219
44554
|
const sockPath = hostdSocketPath(agentName3);
|
|
44220
|
-
if (!
|
|
44555
|
+
if (!existsSync21(sockPath))
|
|
44221
44556
|
return "not-configured";
|
|
44222
44557
|
try {
|
|
44223
44558
|
const resp = await hostdRequest({ socketPath: sockPath, timeoutMs: 3000 }, {
|
|
@@ -44238,7 +44573,7 @@ async function pollHostdStatus(agentName3, targetRequestId, opts) {
|
|
|
44238
44573
|
if (!isHostdEnabled())
|
|
44239
44574
|
return "not-configured";
|
|
44240
44575
|
const sockPath = hostdSocketPath(agentName3);
|
|
44241
|
-
if (!
|
|
44576
|
+
if (!existsSync21(sockPath))
|
|
44242
44577
|
return "not-configured";
|
|
44243
44578
|
const now = opts.now ?? Date.now;
|
|
44244
44579
|
const sleep2 = opts.sleep ?? ((ms) => new Promise((r) => setTimeout(r, ms)));
|
|
@@ -44316,7 +44651,7 @@ function shouldSweepChatAtBoot(chatId) {
|
|
|
44316
44651
|
}
|
|
44317
44652
|
|
|
44318
44653
|
// gateway/ipc-server.ts
|
|
44319
|
-
import { renameSync as renameSync5, unlinkSync as
|
|
44654
|
+
import { renameSync as renameSync5, unlinkSync as unlinkSync6 } from "fs";
|
|
44320
44655
|
var MAX_BUFFER_SIZE = 1024 * 1024;
|
|
44321
44656
|
var VALID_OPERATOR_KINDS = new Set([
|
|
44322
44657
|
"credentials-expired",
|
|
@@ -44434,7 +44769,7 @@ function createIpcServer(options) {
|
|
|
44434
44769
|
renameSync5(socketPath, socketPath + ".bak");
|
|
44435
44770
|
} catch {}
|
|
44436
44771
|
try {
|
|
44437
|
-
|
|
44772
|
+
unlinkSync6(socketPath + ".bak");
|
|
44438
44773
|
} catch {}
|
|
44439
44774
|
const clients = new Set;
|
|
44440
44775
|
const agentIndex = new Map;
|
|
@@ -45040,13 +45375,13 @@ function buildMs365CardText(p) {
|
|
|
45040
45375
|
const lines = [];
|
|
45041
45376
|
lines.push(`\uD83D\uDCC4 Microsoft 365 write approval`);
|
|
45042
45377
|
lines.push("");
|
|
45043
|
-
lines.push(`Agent: ${
|
|
45044
|
-
lines.push(`Tool: ${
|
|
45045
|
-
lines.push(`Item: ${
|
|
45378
|
+
lines.push(`Agent: ${truncate3(p.agentName, 64)}`);
|
|
45379
|
+
lines.push(`Tool: ${truncate3(p.toolName.replace(/^mcp__/, ""), 96)}`);
|
|
45380
|
+
lines.push(`Item: ${truncate3(p.itemDisplayName, 256)}`);
|
|
45046
45381
|
if (p.itemId !== "(new)") {
|
|
45047
|
-
lines.push(`ID: ${
|
|
45382
|
+
lines.push(`ID: ${truncate3(p.itemId, 96)}`);
|
|
45048
45383
|
}
|
|
45049
|
-
lines.push(`Account: ${
|
|
45384
|
+
lines.push(`Account: ${truncate3(p.accountEmail, 96)}`);
|
|
45050
45385
|
if (typeof p.sizeBytesBefore === "number" || typeof p.sizeBytesAfter === "number") {
|
|
45051
45386
|
const before = p.sizeBytesBefore ?? 0;
|
|
45052
45387
|
const after = p.sizeBytesAfter ?? 0;
|
|
@@ -45055,18 +45390,18 @@ function buildMs365CardText(p) {
|
|
|
45055
45390
|
lines.push(`Size: ${humanBytes(before)} \u2192 ${humanBytes(after)} (${sign}${humanBytes(delta)})`);
|
|
45056
45391
|
}
|
|
45057
45392
|
if (p.deepLink) {
|
|
45058
|
-
lines.push(`Link: ${
|
|
45393
|
+
lines.push(`Link: ${truncate3(p.deepLink, 256)}`);
|
|
45059
45394
|
}
|
|
45060
45395
|
if (p.agentRationale) {
|
|
45061
45396
|
lines.push("");
|
|
45062
|
-
lines.push(`\uD83D\uDCAC ${
|
|
45397
|
+
lines.push(`\uD83D\uDCAC ${truncate3(p.agentRationale, 512)}`);
|
|
45063
45398
|
}
|
|
45064
45399
|
lines.push("");
|
|
45065
45400
|
lines.push("\u26a0\ufe0f Weak attestation (RFC \u00a78 v1): operator should click through to verify the actual change before approving. Structural diff coming v1.5.");
|
|
45066
45401
|
return lines.join(`
|
|
45067
45402
|
`);
|
|
45068
45403
|
}
|
|
45069
|
-
function
|
|
45404
|
+
function truncate3(s, n) {
|
|
45070
45405
|
if (s.length <= n)
|
|
45071
45406
|
return s;
|
|
45072
45407
|
return s.slice(0, n - 1) + "\u2026";
|
|
@@ -45182,9 +45517,9 @@ function buildDiffPreviewCard(input) {
|
|
|
45182
45517
|
}
|
|
45183
45518
|
const preview = input.preview;
|
|
45184
45519
|
const bodyLines = [];
|
|
45185
|
-
bodyLines.push(`<b>${
|
|
45520
|
+
bodyLines.push(`<b>${escapeHtml8(preview.title)}</b>`);
|
|
45186
45521
|
for (const line of preview.lines) {
|
|
45187
|
-
bodyLines.push(
|
|
45522
|
+
bodyLines.push(escapeHtml8(line.text));
|
|
45188
45523
|
}
|
|
45189
45524
|
const text = bodyLines.join(`
|
|
45190
45525
|
`);
|
|
@@ -45237,7 +45572,7 @@ function buildDiffPreviewCard(input) {
|
|
|
45237
45572
|
}
|
|
45238
45573
|
return { text, reply_markup: kb };
|
|
45239
45574
|
}
|
|
45240
|
-
function
|
|
45575
|
+
function escapeHtml8(s) {
|
|
45241
45576
|
return s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
45242
45577
|
}
|
|
45243
45578
|
|
|
@@ -46083,14 +46418,14 @@ function buildVaultSaveDiscardedInbound(opts) {
|
|
|
46083
46418
|
// gateway/subagent-handback-inbound-builder.ts
|
|
46084
46419
|
var HANDBACK_RESULT_MAX = 3000;
|
|
46085
46420
|
var HANDBACK_DESC_MAX = 200;
|
|
46086
|
-
function
|
|
46421
|
+
function truncate4(s, max) {
|
|
46087
46422
|
const t = s.trim();
|
|
46088
46423
|
return t.length > max ? t.slice(0, max) + "\u2026" : t;
|
|
46089
46424
|
}
|
|
46090
46425
|
function buildSubagentHandbackInbound(opts) {
|
|
46091
46426
|
const ts = opts.nowMs ?? Date.now();
|
|
46092
|
-
const desc =
|
|
46093
|
-
const result =
|
|
46427
|
+
const desc = truncate4(opts.ctx.taskDescription, HANDBACK_DESC_MAX) || "(no description)";
|
|
46428
|
+
const result = truncate4(opts.ctx.resultText, HANDBACK_RESULT_MAX);
|
|
46094
46429
|
const text = opts.ctx.outcome === "failed" ? `\uD83E\uDD1D A background worker you dispatched has FAILED.
|
|
46095
46430
|
|
|
46096
46431
|
` + `Task: ${desc}
|
|
@@ -46154,7 +46489,7 @@ function decideSubagentHandback(input) {
|
|
|
46154
46489
|
var PROGRESS_RESULT_MAX = 800;
|
|
46155
46490
|
var PROGRESS_DESC_MAX = 200;
|
|
46156
46491
|
var DEFAULT_PROGRESS_INTERVAL_MS = 5 * 60 * 1000;
|
|
46157
|
-
function
|
|
46492
|
+
function truncate5(s, max) {
|
|
46158
46493
|
const t = s.trim();
|
|
46159
46494
|
return t.length > max ? t.slice(0, max) + "\u2026" : t;
|
|
46160
46495
|
}
|
|
@@ -46168,8 +46503,8 @@ function formatElapsed(ms) {
|
|
|
46168
46503
|
}
|
|
46169
46504
|
function buildSubagentProgressInbound(opts) {
|
|
46170
46505
|
const ts = opts.nowMs ?? Date.now();
|
|
46171
|
-
const desc =
|
|
46172
|
-
const summary =
|
|
46506
|
+
const desc = truncate5(opts.ctx.taskDescription, PROGRESS_DESC_MAX) || "(no description)";
|
|
46507
|
+
const summary = truncate5(opts.ctx.latestSummary, PROGRESS_RESULT_MAX);
|
|
46173
46508
|
const elapsed = formatElapsed(opts.ctx.elapsedMs);
|
|
46174
46509
|
const expiresAt = ts + 2 * opts.ctx.progressIntervalMs;
|
|
46175
46510
|
const text = `\uD83D\uDD04 A background worker you dispatched is still running.
|
|
@@ -46497,7 +46832,7 @@ function escapeBody(s) {
|
|
|
46497
46832
|
}
|
|
46498
46833
|
|
|
46499
46834
|
// gateway/pid-file.ts
|
|
46500
|
-
import { writeFileSync as writeFileSync9, readFileSync as readFileSync16, unlinkSync as
|
|
46835
|
+
import { writeFileSync as writeFileSync9, readFileSync as readFileSync16, unlinkSync as unlinkSync7, renameSync as renameSync6 } from "node:fs";
|
|
46501
46836
|
function writePidFile(path, record) {
|
|
46502
46837
|
const tmp = `${path}.tmp-${process.pid}-${Date.now()}`;
|
|
46503
46838
|
writeFileSync9(tmp, JSON.stringify(record), "utf-8");
|
|
@@ -46505,7 +46840,7 @@ function writePidFile(path, record) {
|
|
|
46505
46840
|
}
|
|
46506
46841
|
function clearPidFile(path) {
|
|
46507
46842
|
try {
|
|
46508
|
-
|
|
46843
|
+
unlinkSync7(path);
|
|
46509
46844
|
} catch {}
|
|
46510
46845
|
}
|
|
46511
46846
|
|
|
@@ -46722,7 +47057,7 @@ function safeCount(fn) {
|
|
|
46722
47057
|
}
|
|
46723
47058
|
|
|
46724
47059
|
// gateway/session-marker.ts
|
|
46725
|
-
import { writeFileSync as writeFileSync10, readFileSync as readFileSync18, renameSync as renameSync7, unlinkSync as
|
|
47060
|
+
import { writeFileSync as writeFileSync10, readFileSync as readFileSync18, renameSync as renameSync7, unlinkSync as unlinkSync8 } from "node:fs";
|
|
46726
47061
|
function writeSessionMarker(path, marker) {
|
|
46727
47062
|
const tmp = `${path}.tmp-${process.pid}-${Date.now()}`;
|
|
46728
47063
|
writeFileSync10(tmp, JSON.stringify(marker), "utf-8");
|
|
@@ -46752,7 +47087,7 @@ function shouldFireRestartBanner(input) {
|
|
|
46752
47087
|
}
|
|
46753
47088
|
|
|
46754
47089
|
// gateway/clean-shutdown-marker.ts
|
|
46755
|
-
import { writeFileSync as writeFileSync11, readFileSync as readFileSync19, renameSync as renameSync8, unlinkSync as
|
|
47090
|
+
import { writeFileSync as writeFileSync11, readFileSync as readFileSync19, renameSync as renameSync8, unlinkSync as unlinkSync9 } from "node:fs";
|
|
46756
47091
|
var DEFAULT_MAX_AGE_MS = 60000;
|
|
46757
47092
|
function writeCleanShutdownMarker(path, marker) {
|
|
46758
47093
|
const tmp = `${path}.tmp-${process.pid}-${Date.now()}`;
|
|
@@ -46776,7 +47111,7 @@ function readCleanShutdownMarker(path) {
|
|
|
46776
47111
|
}
|
|
46777
47112
|
function clearCleanShutdownMarker(path) {
|
|
46778
47113
|
try {
|
|
46779
|
-
|
|
47114
|
+
unlinkSync9(path);
|
|
46780
47115
|
} catch {}
|
|
46781
47116
|
}
|
|
46782
47117
|
function shouldSuppressRecoveryBanner(marker, now, maxAgeMs = DEFAULT_MAX_AGE_MS) {
|
|
@@ -47556,16 +47891,16 @@ function classifyAdminGate(text, myAgentName) {
|
|
|
47556
47891
|
|
|
47557
47892
|
// subagent-watcher.ts
|
|
47558
47893
|
import {
|
|
47559
|
-
existsSync as
|
|
47560
|
-
openSync as
|
|
47894
|
+
existsSync as existsSync23,
|
|
47895
|
+
openSync as openSync3,
|
|
47561
47896
|
readSync,
|
|
47562
47897
|
statSync as statSync6,
|
|
47563
|
-
closeSync as
|
|
47898
|
+
closeSync as closeSync3,
|
|
47564
47899
|
watch,
|
|
47565
47900
|
readdirSync as readdirSync3,
|
|
47566
47901
|
readFileSync as readFileSync21
|
|
47567
47902
|
} from "fs";
|
|
47568
|
-
import { join as
|
|
47903
|
+
import { join as join20 } from "path";
|
|
47569
47904
|
|
|
47570
47905
|
// operator-events.ts
|
|
47571
47906
|
var DEFAULT_OPERATOR_EVENT_COOLDOWN_MS2 = 5 * 60000;
|
|
@@ -47689,7 +48024,7 @@ function sanitiseToolArg(name, raw) {
|
|
|
47689
48024
|
case "NotebookEdit": {
|
|
47690
48025
|
const fp = raw.file_path;
|
|
47691
48026
|
if (typeof fp === "string" && fp.length > 0)
|
|
47692
|
-
out =
|
|
48027
|
+
out = basename4(fp);
|
|
47693
48028
|
break;
|
|
47694
48029
|
}
|
|
47695
48030
|
case "Bash": {
|
|
@@ -47725,7 +48060,7 @@ function sanitiseToolArg(name, raw) {
|
|
|
47725
48060
|
out = out.slice(0, SANITISE_MAX_LEN - 1) + "\u2026";
|
|
47726
48061
|
return out;
|
|
47727
48062
|
}
|
|
47728
|
-
function
|
|
48063
|
+
function basename4(p) {
|
|
47729
48064
|
const idx = p.lastIndexOf("/");
|
|
47730
48065
|
return idx === -1 ? p : p.slice(idx + 1);
|
|
47731
48066
|
}
|
|
@@ -47807,29 +48142,29 @@ function bumpSubagentActivity(db2, args) {
|
|
|
47807
48142
|
|
|
47808
48143
|
// gateway/turn-active-marker.ts
|
|
47809
48144
|
import {
|
|
47810
|
-
closeSync,
|
|
47811
|
-
existsSync as
|
|
48145
|
+
closeSync as closeSync2,
|
|
48146
|
+
existsSync as existsSync22,
|
|
47812
48147
|
mkdirSync as mkdirSync10,
|
|
47813
|
-
openSync,
|
|
48148
|
+
openSync as openSync2,
|
|
47814
48149
|
readFileSync as readFileSync20,
|
|
47815
48150
|
statSync as statSync5,
|
|
47816
|
-
unlinkSync as
|
|
48151
|
+
unlinkSync as unlinkSync10,
|
|
47817
48152
|
utimesSync,
|
|
47818
48153
|
writeFileSync as writeFileSync12
|
|
47819
48154
|
} from "node:fs";
|
|
47820
|
-
import { join as
|
|
48155
|
+
import { join as join19 } from "node:path";
|
|
47821
48156
|
var TURN_ACTIVE_MARKER_FILE = "turn-active.json";
|
|
47822
48157
|
function touchTurnActiveMarker(stateDir) {
|
|
47823
|
-
const path =
|
|
47824
|
-
if (!
|
|
48158
|
+
const path = join19(stateDir, TURN_ACTIVE_MARKER_FILE);
|
|
48159
|
+
if (!existsSync22(path))
|
|
47825
48160
|
return;
|
|
47826
48161
|
const now = new Date;
|
|
47827
48162
|
try {
|
|
47828
48163
|
utimesSync(path, now, now);
|
|
47829
48164
|
} catch {
|
|
47830
48165
|
try {
|
|
47831
|
-
const fd =
|
|
47832
|
-
|
|
48166
|
+
const fd = openSync2(path, "r+");
|
|
48167
|
+
closeSync2(fd);
|
|
47833
48168
|
} catch {}
|
|
47834
48169
|
}
|
|
47835
48170
|
}
|
|
@@ -48043,11 +48378,11 @@ function startSubagentWatcher(config) {
|
|
|
48043
48378
|
clearTimeout(ref.ref);
|
|
48044
48379
|
});
|
|
48045
48380
|
const fs2 = config.fs ?? {
|
|
48046
|
-
existsSync:
|
|
48381
|
+
existsSync: existsSync23,
|
|
48047
48382
|
readdirSync: readdirSync3,
|
|
48048
48383
|
statSync: statSync6,
|
|
48049
|
-
openSync:
|
|
48050
|
-
closeSync:
|
|
48384
|
+
openSync: openSync3,
|
|
48385
|
+
closeSync: closeSync3,
|
|
48051
48386
|
readSync,
|
|
48052
48387
|
watch
|
|
48053
48388
|
};
|
|
@@ -48212,7 +48547,7 @@ function startSubagentWatcher(config) {
|
|
|
48212
48547
|
if (idleMs >= threshold) {
|
|
48213
48548
|
entry.stallNotified = true;
|
|
48214
48549
|
entry.stalledAt = n;
|
|
48215
|
-
const desc =
|
|
48550
|
+
const desc = escapeHtml9(truncate6(entry.description, 80));
|
|
48216
48551
|
const idleSec = Math.floor(idleMs / 1000);
|
|
48217
48552
|
log?.(`subagent-watcher: stall detected for ${entry.agentId} (idle ${idleSec}s): ${desc}`);
|
|
48218
48553
|
if (db2 != null) {
|
|
@@ -48277,8 +48612,8 @@ function startSubagentWatcher(config) {
|
|
|
48277
48612
|
function rescanSubagentDirs() {
|
|
48278
48613
|
if (stopped)
|
|
48279
48614
|
return;
|
|
48280
|
-
const claudeHome =
|
|
48281
|
-
const projectsRoot =
|
|
48615
|
+
const claudeHome = join20(agentDir, ".claude");
|
|
48616
|
+
const projectsRoot = join20(claudeHome, "projects");
|
|
48282
48617
|
if (!fs2.existsSync(projectsRoot))
|
|
48283
48618
|
return;
|
|
48284
48619
|
let projectDirs;
|
|
@@ -48295,7 +48630,7 @@ function startSubagentWatcher(config) {
|
|
|
48295
48630
|
}
|
|
48296
48631
|
continue;
|
|
48297
48632
|
}
|
|
48298
|
-
const projectPath =
|
|
48633
|
+
const projectPath = join20(projectsRoot, pDir);
|
|
48299
48634
|
let sessionDirs;
|
|
48300
48635
|
try {
|
|
48301
48636
|
sessionDirs = fs2.readdirSync(projectPath);
|
|
@@ -48305,7 +48640,7 @@ function startSubagentWatcher(config) {
|
|
|
48305
48640
|
for (const sDir of sessionDirs) {
|
|
48306
48641
|
if (sDir.endsWith(".jsonl"))
|
|
48307
48642
|
continue;
|
|
48308
|
-
const subagentsPath =
|
|
48643
|
+
const subagentsPath = join20(projectPath, sDir, "subagents");
|
|
48309
48644
|
if (!fs2.existsSync(subagentsPath))
|
|
48310
48645
|
continue;
|
|
48311
48646
|
if (!dirWatchers.has(subagentsPath)) {
|
|
@@ -48313,7 +48648,7 @@ function startSubagentWatcher(config) {
|
|
|
48313
48648
|
const w = fs2.watch(subagentsPath, (_event, filename) => {
|
|
48314
48649
|
if (!filename || !filename.toString().startsWith("agent-") || !filename.toString().endsWith(".jsonl"))
|
|
48315
48650
|
return;
|
|
48316
|
-
const filePath =
|
|
48651
|
+
const filePath = join20(subagentsPath, filename.toString());
|
|
48317
48652
|
if (!knownFiles.has(filePath)) {
|
|
48318
48653
|
scanSubagentsDir(subagentsPath);
|
|
48319
48654
|
}
|
|
@@ -48338,7 +48673,7 @@ function startSubagentWatcher(config) {
|
|
|
48338
48673
|
for (const e of entries) {
|
|
48339
48674
|
if (!e.startsWith("agent-") || !e.endsWith(".jsonl"))
|
|
48340
48675
|
continue;
|
|
48341
|
-
const filePath =
|
|
48676
|
+
const filePath = join20(subagentsPath, e);
|
|
48342
48677
|
if (knownFiles.has(filePath))
|
|
48343
48678
|
continue;
|
|
48344
48679
|
const agentId = e.slice("agent-".length, -".jsonl".length);
|
|
@@ -48455,15 +48790,15 @@ function determineRestartReason(opts) {
|
|
|
48455
48790
|
init_boot_card();
|
|
48456
48791
|
|
|
48457
48792
|
// gateway/update-announce.ts
|
|
48458
|
-
import { existsSync as
|
|
48459
|
-
import { join as
|
|
48793
|
+
import { existsSync as existsSync27, mkdirSync as mkdirSync13, openSync as openSync4, closeSync as closeSync4, readFileSync as readFileSync25 } from "node:fs";
|
|
48794
|
+
import { join as join25 } from "node:path";
|
|
48460
48795
|
import { homedir as homedir10 } from "node:os";
|
|
48461
48796
|
|
|
48462
48797
|
// ../src/host-control/audit-reader.ts
|
|
48463
48798
|
import { homedir as homedir9 } from "node:os";
|
|
48464
|
-
import { join as
|
|
48799
|
+
import { join as join24 } from "node:path";
|
|
48465
48800
|
function defaultAuditLogPath(home2 = homedir9()) {
|
|
48466
|
-
return
|
|
48801
|
+
return join24(home2, ".switchroom", "host-control-audit.log");
|
|
48467
48802
|
}
|
|
48468
48803
|
function parseAuditLine(line) {
|
|
48469
48804
|
const trimmed = line.trim();
|
|
@@ -48569,7 +48904,7 @@ function readAndFilter(raw, filters, limit) {
|
|
|
48569
48904
|
var DEFAULT_LOOKBACK_MS = 10 * 60 * 1000;
|
|
48570
48905
|
function readLastTerminalUpdateAudit(opts = {}) {
|
|
48571
48906
|
const path = opts.auditLogPath ?? defaultAuditLogPath();
|
|
48572
|
-
const exists = opts.exists ??
|
|
48907
|
+
const exists = opts.exists ?? existsSync27;
|
|
48573
48908
|
const readFile = opts.readFile ?? ((p) => readFileSync25(p, "utf-8"));
|
|
48574
48909
|
if (!exists(path))
|
|
48575
48910
|
return null;
|
|
@@ -48631,18 +48966,18 @@ function renderUpdateOutcomeLine(entry) {
|
|
|
48631
48966
|
`);
|
|
48632
48967
|
}
|
|
48633
48968
|
function claimUpdateAnnouncement(requestId, opts = {}) {
|
|
48634
|
-
const stateDir = opts.stateDir ?? process.env.TELEGRAM_STATE_DIR ??
|
|
48635
|
-
const dir =
|
|
48969
|
+
const stateDir = opts.stateDir ?? process.env.TELEGRAM_STATE_DIR ?? join25(homedir10(), ".switchroom");
|
|
48970
|
+
const dir = join25(stateDir, "update-announced");
|
|
48636
48971
|
try {
|
|
48637
48972
|
mkdirSync13(dir, { recursive: true });
|
|
48638
48973
|
} catch {
|
|
48639
48974
|
return false;
|
|
48640
48975
|
}
|
|
48641
48976
|
const safeId = requestId.replace(/[^A-Za-z0-9_.-]/g, "_").slice(0, 200);
|
|
48642
|
-
const path =
|
|
48977
|
+
const path = join25(dir, safeId);
|
|
48643
48978
|
try {
|
|
48644
|
-
const fd =
|
|
48645
|
-
|
|
48979
|
+
const fd = openSync4(path, "wx");
|
|
48980
|
+
closeSync4(fd);
|
|
48646
48981
|
return true;
|
|
48647
48982
|
} catch {
|
|
48648
48983
|
return false;
|
|
@@ -48686,7 +49021,7 @@ function renderIssuesCard(opts) {
|
|
|
48686
49021
|
const maxSeverity = sorted[0].severity;
|
|
48687
49022
|
const headerEmoji = SEVERITY_EMOJI[maxSeverity];
|
|
48688
49023
|
const count = sorted.length;
|
|
48689
|
-
const header = `${headerEmoji} <b>${
|
|
49024
|
+
const header = `${headerEmoji} <b>${escapeHtml9(opts.agentName)}</b> \u00b7 ${count} ${count === 1 ? "issue" : "issues"}`;
|
|
48690
49025
|
const maxRows = opts.maxRows ?? DEFAULT_MAX_ROWS;
|
|
48691
49026
|
const visible = sorted.slice(0, maxRows);
|
|
48692
49027
|
const overflow = sorted.length - visible.length;
|
|
@@ -48695,10 +49030,10 @@ function renderIssuesCard(opts) {
|
|
|
48695
49030
|
const emoji = SEVERITY_EMOJI[e.severity];
|
|
48696
49031
|
const occ = e.occurrences > 1 ? ` <i>(\u00d7${e.occurrences})</i>` : "";
|
|
48697
49032
|
const ago = relTime(now - e.last_seen);
|
|
48698
|
-
const head = `${emoji} <code>${
|
|
49033
|
+
const head = `${emoji} <code>${escapeHtml9(e.fingerprint)}</code> ${escapeHtml9(e.summary)}${occ} \u2014 <i>${ago}</i>`;
|
|
48699
49034
|
const remediation = formatRemediation(e.detail);
|
|
48700
49035
|
return remediation == null ? head : `${head}
|
|
48701
|
-
\u2192 <i>${
|
|
49036
|
+
\u2192 <i>${escapeHtml9(remediation)}</i>`;
|
|
48702
49037
|
});
|
|
48703
49038
|
const lines = [header, "", ...rows];
|
|
48704
49039
|
if (overflow > 0) {
|
|
@@ -48859,24 +49194,24 @@ function createIssuesCardHandle(opts) {
|
|
|
48859
49194
|
}
|
|
48860
49195
|
|
|
48861
49196
|
// issues-watcher.ts
|
|
48862
|
-
import { existsSync as
|
|
48863
|
-
import { join as
|
|
49197
|
+
import { existsSync as existsSync29, statSync as statSync8 } from "node:fs";
|
|
49198
|
+
import { join as join27 } from "node:path";
|
|
48864
49199
|
|
|
48865
49200
|
// ../src/issues/store.ts
|
|
48866
49201
|
import {
|
|
48867
|
-
closeSync as
|
|
48868
|
-
existsSync as
|
|
49202
|
+
closeSync as closeSync5,
|
|
49203
|
+
existsSync as existsSync28,
|
|
48869
49204
|
mkdirSync as mkdirSync14,
|
|
48870
|
-
openSync as
|
|
49205
|
+
openSync as openSync5,
|
|
48871
49206
|
readdirSync as readdirSync5,
|
|
48872
49207
|
readFileSync as readFileSync27,
|
|
48873
49208
|
renameSync as renameSync10,
|
|
48874
49209
|
statSync as statSync7,
|
|
48875
|
-
unlinkSync as
|
|
49210
|
+
unlinkSync as unlinkSync11,
|
|
48876
49211
|
writeFileSync as writeFileSync16,
|
|
48877
49212
|
writeSync
|
|
48878
49213
|
} from "node:fs";
|
|
48879
|
-
import { join as
|
|
49214
|
+
import { join as join26 } from "node:path";
|
|
48880
49215
|
import { randomBytes as randomBytes4 } from "node:crypto";
|
|
48881
49216
|
import { execSync } from "node:child_process";
|
|
48882
49217
|
|
|
@@ -48892,8 +49227,8 @@ var SEVERITY_RANK2 = {
|
|
|
48892
49227
|
var ISSUES_FILE = "issues.jsonl";
|
|
48893
49228
|
var ISSUES_LOCK = "issues.lock";
|
|
48894
49229
|
function readAll(stateDir) {
|
|
48895
|
-
const path =
|
|
48896
|
-
if (!
|
|
49230
|
+
const path = join26(stateDir, ISSUES_FILE);
|
|
49231
|
+
if (!existsSync28(path))
|
|
48897
49232
|
return [];
|
|
48898
49233
|
let raw;
|
|
48899
49234
|
try {
|
|
@@ -48929,7 +49264,7 @@ function list(stateDir, opts = {}) {
|
|
|
48929
49264
|
});
|
|
48930
49265
|
}
|
|
48931
49266
|
function resolve6(stateDir, fingerprint, nowFn = Date.now) {
|
|
48932
|
-
if (!
|
|
49267
|
+
if (!existsSync28(join26(stateDir, ISSUES_FILE)))
|
|
48933
49268
|
return 0;
|
|
48934
49269
|
return withLock(stateDir, () => {
|
|
48935
49270
|
const all = readAll(stateDir);
|
|
@@ -48947,7 +49282,7 @@ function resolve6(stateDir, fingerprint, nowFn = Date.now) {
|
|
|
48947
49282
|
});
|
|
48948
49283
|
}
|
|
48949
49284
|
function writeAll(stateDir, events) {
|
|
48950
|
-
const path =
|
|
49285
|
+
const path = join26(stateDir, ISSUES_FILE);
|
|
48951
49286
|
sweepOrphanTmpFiles(stateDir);
|
|
48952
49287
|
const tmp = `${path}.tmp-${process.pid}-${randomBytes4(4).toString("hex")}`;
|
|
48953
49288
|
const body = events.length === 0 ? "" : events.map((e) => JSON.stringify(e)).join(`
|
|
@@ -48969,11 +49304,11 @@ function sweepOrphanTmpFiles(stateDir) {
|
|
|
48969
49304
|
for (const entry of entries) {
|
|
48970
49305
|
if (!entry.startsWith(TMP_PREFIX))
|
|
48971
49306
|
continue;
|
|
48972
|
-
const tmpPath2 =
|
|
49307
|
+
const tmpPath2 = join26(stateDir, entry);
|
|
48973
49308
|
try {
|
|
48974
49309
|
const stat = statSync7(tmpPath2);
|
|
48975
49310
|
if (stat.mtimeMs < cutoff) {
|
|
48976
|
-
|
|
49311
|
+
unlinkSync11(tmpPath2);
|
|
48977
49312
|
}
|
|
48978
49313
|
} catch {}
|
|
48979
49314
|
}
|
|
@@ -48981,12 +49316,12 @@ function sweepOrphanTmpFiles(stateDir) {
|
|
|
48981
49316
|
var LOCK_RETRY_MS = 25;
|
|
48982
49317
|
var LOCK_TIMEOUT_MS = 1e4;
|
|
48983
49318
|
function withLock(stateDir, fn) {
|
|
48984
|
-
const lockPath =
|
|
49319
|
+
const lockPath = join26(stateDir, ISSUES_LOCK);
|
|
48985
49320
|
const startedAt = Date.now();
|
|
48986
49321
|
let fd = null;
|
|
48987
49322
|
while (fd === null) {
|
|
48988
49323
|
try {
|
|
48989
|
-
fd =
|
|
49324
|
+
fd = openSync5(lockPath, "wx");
|
|
48990
49325
|
try {
|
|
48991
49326
|
writeSync(fd, String(process.pid));
|
|
48992
49327
|
} catch {}
|
|
@@ -49006,10 +49341,10 @@ function withLock(stateDir, fn) {
|
|
|
49006
49341
|
return fn();
|
|
49007
49342
|
} finally {
|
|
49008
49343
|
try {
|
|
49009
|
-
|
|
49344
|
+
closeSync5(fd);
|
|
49010
49345
|
} catch {}
|
|
49011
49346
|
try {
|
|
49012
|
-
|
|
49347
|
+
unlinkSync11(lockPath);
|
|
49013
49348
|
} catch {}
|
|
49014
49349
|
}
|
|
49015
49350
|
}
|
|
@@ -49023,13 +49358,13 @@ function tryStealStaleLock(lockPath) {
|
|
|
49023
49358
|
const pid = Number(pidStr);
|
|
49024
49359
|
if (!Number.isFinite(pid) || pid <= 0) {
|
|
49025
49360
|
try {
|
|
49026
|
-
|
|
49361
|
+
unlinkSync11(lockPath);
|
|
49027
49362
|
} catch {}
|
|
49028
49363
|
return true;
|
|
49029
49364
|
}
|
|
49030
49365
|
if (pid === process.pid) {
|
|
49031
49366
|
try {
|
|
49032
|
-
|
|
49367
|
+
unlinkSync11(lockPath);
|
|
49033
49368
|
} catch {}
|
|
49034
49369
|
return true;
|
|
49035
49370
|
}
|
|
@@ -49044,7 +49379,7 @@ function tryStealStaleLock(lockPath) {
|
|
|
49044
49379
|
return false;
|
|
49045
49380
|
}
|
|
49046
49381
|
try {
|
|
49047
|
-
|
|
49382
|
+
unlinkSync11(lockPath);
|
|
49048
49383
|
} catch {}
|
|
49049
49384
|
return true;
|
|
49050
49385
|
}
|
|
@@ -49066,7 +49401,7 @@ function isIssueEvent(v) {
|
|
|
49066
49401
|
// issues-watcher.ts
|
|
49067
49402
|
var DEFAULT_POLL_INTERVAL_MS2 = 2000;
|
|
49068
49403
|
function startIssuesWatcher(opts) {
|
|
49069
|
-
const path =
|
|
49404
|
+
const path = join27(opts.stateDir, ISSUES_FILE);
|
|
49070
49405
|
const log = opts.log ?? (() => {});
|
|
49071
49406
|
const intervalMs = opts.pollIntervalMs ?? DEFAULT_POLL_INTERVAL_MS2;
|
|
49072
49407
|
const setIntervalFn = opts.setInterval ?? setInterval;
|
|
@@ -49114,7 +49449,7 @@ function startIssuesWatcher(opts) {
|
|
|
49114
49449
|
};
|
|
49115
49450
|
}
|
|
49116
49451
|
function defaultSignatureProvider(path) {
|
|
49117
|
-
if (!
|
|
49452
|
+
if (!existsSync29(path))
|
|
49118
49453
|
return null;
|
|
49119
49454
|
try {
|
|
49120
49455
|
const stat = statSync8(path);
|
|
@@ -49127,7 +49462,7 @@ function defaultReadEvents(stateDir) {
|
|
|
49127
49462
|
return readAll(stateDir);
|
|
49128
49463
|
}
|
|
49129
49464
|
// permission-title.ts
|
|
49130
|
-
import { basename as
|
|
49465
|
+
import { basename as basename6 } from "node:path";
|
|
49131
49466
|
var COMMAND_TITLE_MAX = 40;
|
|
49132
49467
|
var PATH_TITLE_MAX = 40;
|
|
49133
49468
|
var DESCRIPTION_LINE_MAX = 240;
|
|
@@ -49178,13 +49513,13 @@ function summarizeToolForTitle(toolName, inputPreview) {
|
|
|
49178
49513
|
return `${toolName} (${skill})`;
|
|
49179
49514
|
const command = readString(input, "command");
|
|
49180
49515
|
if (command)
|
|
49181
|
-
return `${toolName}: ${
|
|
49516
|
+
return `${toolName}: ${truncate7(command, COMMAND_TITLE_MAX)}`;
|
|
49182
49517
|
const argHint = firstScalarArgHint(input);
|
|
49183
49518
|
return argHint ? `${toolName} (${argHint})` : toolName;
|
|
49184
49519
|
}
|
|
49185
49520
|
case "Bash": {
|
|
49186
49521
|
const command = readString(input, "command");
|
|
49187
|
-
return command ? `${toolName}: ${
|
|
49522
|
+
return command ? `${toolName}: ${truncate7(command, COMMAND_TITLE_MAX)}` : toolName;
|
|
49188
49523
|
}
|
|
49189
49524
|
case "Read":
|
|
49190
49525
|
case "Edit":
|
|
@@ -49192,17 +49527,17 @@ function summarizeToolForTitle(toolName, inputPreview) {
|
|
|
49192
49527
|
case "MultiEdit":
|
|
49193
49528
|
case "NotebookEdit": {
|
|
49194
49529
|
const filePath = readString(input, "file_path") ?? readString(input, "notebook_path");
|
|
49195
|
-
return filePath ? `${toolName}: ${
|
|
49530
|
+
return filePath ? `${toolName}: ${truncate7(basename6(filePath), PATH_TITLE_MAX)}` : toolName;
|
|
49196
49531
|
}
|
|
49197
49532
|
case "Glob":
|
|
49198
49533
|
case "Grep": {
|
|
49199
49534
|
const pattern = readString(input, "pattern");
|
|
49200
|
-
return pattern ? `${toolName}: ${
|
|
49535
|
+
return pattern ? `${toolName}: ${truncate7(pattern, COMMAND_TITLE_MAX)}` : toolName;
|
|
49201
49536
|
}
|
|
49202
49537
|
case "WebFetch":
|
|
49203
49538
|
case "WebSearch": {
|
|
49204
49539
|
const query2 = readString(input, "url") ?? readString(input, "query");
|
|
49205
|
-
return query2 ? `${toolName}: ${
|
|
49540
|
+
return query2 ? `${toolName}: ${truncate7(query2, COMMAND_TITLE_MAX)}` : toolName;
|
|
49206
49541
|
}
|
|
49207
49542
|
default:
|
|
49208
49543
|
return toolName;
|
|
@@ -49241,7 +49576,7 @@ function firstScalarArgHint(input) {
|
|
|
49241
49576
|
if (SKIP.has(key))
|
|
49242
49577
|
continue;
|
|
49243
49578
|
if (typeof value === "string" && value.length > 0) {
|
|
49244
|
-
return `${key}: ${
|
|
49579
|
+
return `${key}: ${truncate7(value, INPUT_VALUE_MAX)}`;
|
|
49245
49580
|
}
|
|
49246
49581
|
if (typeof value === "number" || typeof value === "boolean") {
|
|
49247
49582
|
return `${key}: ${String(value)}`;
|
|
@@ -49273,10 +49608,10 @@ function skillBasenameFromPath(input) {
|
|
|
49273
49608
|
return null;
|
|
49274
49609
|
const trimmed = path.replace(/\/SKILL\.md$/i, "").replace(/\/$/, "");
|
|
49275
49610
|
const lastSlash = trimmed.lastIndexOf("/");
|
|
49276
|
-
const
|
|
49277
|
-
return
|
|
49611
|
+
const basename7 = lastSlash >= 0 ? trimmed.slice(lastSlash + 1) : trimmed;
|
|
49612
|
+
return basename7.length > 0 ? basename7 : null;
|
|
49278
49613
|
}
|
|
49279
|
-
function
|
|
49614
|
+
function truncate7(text, max) {
|
|
49280
49615
|
const collapsed = text.replace(/\s+/g, " ").trim();
|
|
49281
49616
|
if (collapsed.length <= max)
|
|
49282
49617
|
return collapsed;
|
|
@@ -49284,7 +49619,7 @@ function truncate6(text, max) {
|
|
|
49284
49619
|
}
|
|
49285
49620
|
|
|
49286
49621
|
// permission-rule.ts
|
|
49287
|
-
import { basename as
|
|
49622
|
+
import { basename as basename7 } from "node:path";
|
|
49288
49623
|
function resolveAlwaysAllowRule(toolName, inputPreview) {
|
|
49289
49624
|
if (!toolName)
|
|
49290
49625
|
return null;
|
|
@@ -49350,12 +49685,12 @@ function skillBasenameFromPath2(input) {
|
|
|
49350
49685
|
if (!path)
|
|
49351
49686
|
return null;
|
|
49352
49687
|
const trimmed = path.replace(/\/SKILL\.md$/i, "").replace(/\/$/, "");
|
|
49353
|
-
return
|
|
49688
|
+
return basename7(trimmed) || null;
|
|
49354
49689
|
}
|
|
49355
49690
|
|
|
49356
49691
|
// credits-watch.ts
|
|
49357
|
-
import { readFileSync as readFileSync28, writeFileSync as writeFileSync17, existsSync as
|
|
49358
|
-
import { join as
|
|
49692
|
+
import { readFileSync as readFileSync28, writeFileSync as writeFileSync17, existsSync as existsSync30, mkdirSync as mkdirSync15 } from "fs";
|
|
49693
|
+
import { join as join28 } from "path";
|
|
49359
49694
|
var STATE_FILE = "credits-watch.json";
|
|
49360
49695
|
var FATAL_REASONS = new Set([
|
|
49361
49696
|
"out_of_credits",
|
|
@@ -49367,8 +49702,8 @@ function emptyCreditState() {
|
|
|
49367
49702
|
return { lastNotifiedReason: null, lastNotifiedAt: 0 };
|
|
49368
49703
|
}
|
|
49369
49704
|
function readClaudeJsonOverage(claudeConfigDir) {
|
|
49370
|
-
const path =
|
|
49371
|
-
if (!
|
|
49705
|
+
const path = join28(claudeConfigDir, ".claude.json");
|
|
49706
|
+
if (!existsSync30(path))
|
|
49372
49707
|
return null;
|
|
49373
49708
|
let raw;
|
|
49374
49709
|
try {
|
|
@@ -49396,7 +49731,7 @@ function evaluateCreditState(args) {
|
|
|
49396
49731
|
if (!currentIsFatal && prevIsFatal) {
|
|
49397
49732
|
return {
|
|
49398
49733
|
kind: "notify",
|
|
49399
|
-
message: `\u2705 <b>${
|
|
49734
|
+
message: `\u2705 <b>${escapeHtml11(agentName3)}</b>: credits restored \u2014 agent should resume normal operation.`,
|
|
49400
49735
|
newState: { lastNotifiedReason: null, lastNotifiedAt: now },
|
|
49401
49736
|
transition: "exited"
|
|
49402
49737
|
};
|
|
@@ -49425,12 +49760,12 @@ function evaluateCreditState(args) {
|
|
|
49425
49760
|
function buildEntryMessage(agentName3, reason) {
|
|
49426
49761
|
const desc = humanizeReason(reason);
|
|
49427
49762
|
return [
|
|
49428
|
-
`\u26a0\ufe0f <b>${
|
|
49763
|
+
`\u26a0\ufe0f <b>${escapeHtml11(agentName3)}</b>: ${desc}`,
|
|
49429
49764
|
``,
|
|
49430
49765
|
`Cron tasks and inbound replies will fail until this is resolved. Check`,
|
|
49431
49766
|
`your subscription or pre-paid usage at <a href="https://console.anthropic.com">console.anthropic.com</a>.`,
|
|
49432
49767
|
``,
|
|
49433
|
-
`<i>Source: Claude CLI cache (cachedExtraUsageDisabledReason=${
|
|
49768
|
+
`<i>Source: Claude CLI cache (cachedExtraUsageDisabledReason=${escapeHtml11(reason)})</i>`
|
|
49434
49769
|
].join(`
|
|
49435
49770
|
`);
|
|
49436
49771
|
}
|
|
@@ -49448,12 +49783,12 @@ function humanizeReason(reason) {
|
|
|
49448
49783
|
return `usage disabled (${reason})`;
|
|
49449
49784
|
}
|
|
49450
49785
|
}
|
|
49451
|
-
function
|
|
49786
|
+
function escapeHtml11(s) {
|
|
49452
49787
|
return s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
49453
49788
|
}
|
|
49454
49789
|
function loadCreditState(stateDir) {
|
|
49455
|
-
const path =
|
|
49456
|
-
if (!
|
|
49790
|
+
const path = join28(stateDir, STATE_FILE);
|
|
49791
|
+
if (!existsSync30(path))
|
|
49457
49792
|
return emptyCreditState();
|
|
49458
49793
|
try {
|
|
49459
49794
|
const raw = readFileSync28(path, "utf-8");
|
|
@@ -49469,54 +49804,54 @@ function loadCreditState(stateDir) {
|
|
|
49469
49804
|
}
|
|
49470
49805
|
function saveCreditState(stateDir, state4) {
|
|
49471
49806
|
mkdirSync15(stateDir, { recursive: true });
|
|
49472
|
-
const path =
|
|
49807
|
+
const path = join28(stateDir, STATE_FILE);
|
|
49473
49808
|
writeFileSync17(path, JSON.stringify(state4, null, 2) + `
|
|
49474
49809
|
`, { mode: 384 });
|
|
49475
49810
|
}
|
|
49476
49811
|
|
|
49477
49812
|
// gateway/turn-active-marker.ts
|
|
49478
49813
|
import {
|
|
49479
|
-
closeSync as
|
|
49480
|
-
existsSync as
|
|
49814
|
+
closeSync as closeSync6,
|
|
49815
|
+
existsSync as existsSync31,
|
|
49481
49816
|
mkdirSync as mkdirSync16,
|
|
49482
|
-
openSync as
|
|
49817
|
+
openSync as openSync6,
|
|
49483
49818
|
readFileSync as readFileSync29,
|
|
49484
49819
|
statSync as statSync9,
|
|
49485
|
-
unlinkSync as
|
|
49820
|
+
unlinkSync as unlinkSync12,
|
|
49486
49821
|
utimesSync as utimesSync2,
|
|
49487
49822
|
writeFileSync as writeFileSync18
|
|
49488
49823
|
} from "node:fs";
|
|
49489
|
-
import { join as
|
|
49824
|
+
import { join as join29 } from "node:path";
|
|
49490
49825
|
var TURN_ACTIVE_MARKER_FILE2 = "turn-active.json";
|
|
49491
49826
|
function writeTurnActiveMarker(stateDir, marker) {
|
|
49492
49827
|
try {
|
|
49493
49828
|
mkdirSync16(stateDir, { recursive: true });
|
|
49494
|
-
writeFileSync18(
|
|
49829
|
+
writeFileSync18(join29(stateDir, TURN_ACTIVE_MARKER_FILE2), JSON.stringify(marker, null, 2) + `
|
|
49495
49830
|
`, { mode: 384 });
|
|
49496
49831
|
} catch {}
|
|
49497
49832
|
}
|
|
49498
49833
|
function touchTurnActiveMarker2(stateDir) {
|
|
49499
|
-
const path =
|
|
49500
|
-
if (!
|
|
49834
|
+
const path = join29(stateDir, TURN_ACTIVE_MARKER_FILE2);
|
|
49835
|
+
if (!existsSync31(path))
|
|
49501
49836
|
return;
|
|
49502
49837
|
const now = new Date;
|
|
49503
49838
|
try {
|
|
49504
49839
|
utimesSync2(path, now, now);
|
|
49505
49840
|
} catch {
|
|
49506
49841
|
try {
|
|
49507
|
-
const fd =
|
|
49508
|
-
|
|
49842
|
+
const fd = openSync6(path, "r+");
|
|
49843
|
+
closeSync6(fd);
|
|
49509
49844
|
} catch {}
|
|
49510
49845
|
}
|
|
49511
49846
|
}
|
|
49512
49847
|
function removeTurnActiveMarker(stateDir) {
|
|
49513
49848
|
try {
|
|
49514
|
-
|
|
49849
|
+
unlinkSync12(join29(stateDir, TURN_ACTIVE_MARKER_FILE2));
|
|
49515
49850
|
} catch {}
|
|
49516
49851
|
}
|
|
49517
49852
|
function sweepStaleTurnActiveMarker(stateDir, opts) {
|
|
49518
|
-
const path =
|
|
49519
|
-
if (!
|
|
49853
|
+
const path = join29(stateDir, TURN_ACTIVE_MARKER_FILE2);
|
|
49854
|
+
if (!existsSync31(path))
|
|
49520
49855
|
return false;
|
|
49521
49856
|
const now = opts.now ?? Date.now();
|
|
49522
49857
|
try {
|
|
@@ -49530,7 +49865,7 @@ function sweepStaleTurnActiveMarker(stateDir, opts) {
|
|
|
49530
49865
|
try {
|
|
49531
49866
|
payload = readFileSync29(path, "utf8");
|
|
49532
49867
|
} catch {}
|
|
49533
|
-
|
|
49868
|
+
unlinkSync12(path);
|
|
49534
49869
|
if (opts.onRemove) {
|
|
49535
49870
|
try {
|
|
49536
49871
|
opts.onRemove({
|
|
@@ -49547,10 +49882,10 @@ function sweepStaleTurnActiveMarker(stateDir, opts) {
|
|
|
49547
49882
|
}
|
|
49548
49883
|
|
|
49549
49884
|
// ../src/build-info.ts
|
|
49550
|
-
var VERSION = "0.13.
|
|
49551
|
-
var COMMIT_SHA = "
|
|
49552
|
-
var COMMIT_DATE = "2026-05-
|
|
49553
|
-
var LATEST_PR =
|
|
49885
|
+
var VERSION = "0.13.57";
|
|
49886
|
+
var COMMIT_SHA = "bed7cd14";
|
|
49887
|
+
var COMMIT_DATE = "2026-05-27T21:24:41Z";
|
|
49888
|
+
var LATEST_PR = 1925;
|
|
49554
49889
|
var COMMITS_AHEAD_OF_TAG = 0;
|
|
49555
49890
|
|
|
49556
49891
|
// gateway/boot-version.ts
|
|
@@ -49624,11 +49959,11 @@ init_peercred();
|
|
|
49624
49959
|
import * as net4 from "node:net";
|
|
49625
49960
|
import * as fs2 from "node:fs";
|
|
49626
49961
|
import { homedir as homedir11 } from "node:os";
|
|
49627
|
-
import { join as
|
|
49962
|
+
import { join as join30 } from "node:path";
|
|
49628
49963
|
var DEFAULT_TIMEOUT_MS4 = 2000;
|
|
49629
49964
|
var UNLOCK_TIMEOUT_MS = 30000;
|
|
49630
|
-
var LEGACY_SOCKET_PATH2 =
|
|
49631
|
-
var OPERATOR_SOCKET_PATH2 =
|
|
49965
|
+
var LEGACY_SOCKET_PATH2 = join30(homedir11(), ".switchroom", "vault-broker.sock");
|
|
49966
|
+
var OPERATOR_SOCKET_PATH2 = join30(homedir11(), ".switchroom", "broker-operator", "sock");
|
|
49632
49967
|
function defaultBrokerSocketPath2() {
|
|
49633
49968
|
if (fs2.existsSync(OPERATOR_SOCKET_PATH2))
|
|
49634
49969
|
return OPERATOR_SOCKET_PATH2;
|
|
@@ -49851,7 +50186,7 @@ function resolveVaultApprovalPosture(broker) {
|
|
|
49851
50186
|
|
|
49852
50187
|
// registry/turns-schema.ts
|
|
49853
50188
|
import { chmodSync as chmodSync3, mkdirSync as mkdirSync17 } from "fs";
|
|
49854
|
-
import { join as
|
|
50189
|
+
import { join as join31 } from "path";
|
|
49855
50190
|
var DatabaseClass2 = null;
|
|
49856
50191
|
function loadDatabaseClass2() {
|
|
49857
50192
|
if (DatabaseClass2 != null)
|
|
@@ -49910,9 +50245,9 @@ function applySchema(db2) {
|
|
|
49910
50245
|
}
|
|
49911
50246
|
function openTurnsDb(agentDir) {
|
|
49912
50247
|
const Database = loadDatabaseClass2();
|
|
49913
|
-
const dir =
|
|
50248
|
+
const dir = join31(agentDir, "telegram");
|
|
49914
50249
|
mkdirSync17(dir, { recursive: true, mode: 448 });
|
|
49915
|
-
const path =
|
|
50250
|
+
const path = join31(dir, "registry.db");
|
|
49916
50251
|
const db2 = new Database(path, { create: true });
|
|
49917
50252
|
applySchema(db2);
|
|
49918
50253
|
try {
|
|
@@ -50053,11 +50388,11 @@ installGlobalErrorHandlers();
|
|
|
50053
50388
|
process.on("beforeExit", () => {
|
|
50054
50389
|
shutdownAnalytics();
|
|
50055
50390
|
});
|
|
50056
|
-
var STATE_DIR = process.env.TELEGRAM_STATE_DIR ??
|
|
50057
|
-
var ACCESS_FILE =
|
|
50058
|
-
var APPROVED_DIR =
|
|
50059
|
-
var ENV_FILE =
|
|
50060
|
-
var INBOX_DIR =
|
|
50391
|
+
var STATE_DIR = process.env.TELEGRAM_STATE_DIR ?? join33(homedir12(), ".claude", "channels", "telegram");
|
|
50392
|
+
var ACCESS_FILE = join33(STATE_DIR, "access.json");
|
|
50393
|
+
var APPROVED_DIR = join33(STATE_DIR, "approved");
|
|
50394
|
+
var ENV_FILE = join33(STATE_DIR, ".env");
|
|
50395
|
+
var INBOX_DIR = join33(STATE_DIR, "inbox");
|
|
50061
50396
|
function triggerSelfRestart(targetAgent, reason, delayMs = 300) {
|
|
50062
50397
|
const isDocker = process.env.SWITCHROOM_RUNTIME === "docker";
|
|
50063
50398
|
const selfAgent = process.env.SWITCHROOM_AGENT_NAME;
|
|
@@ -50248,7 +50583,7 @@ function assertSendable(f) {
|
|
|
50248
50583
|
} catch {
|
|
50249
50584
|
throw new Error(`refusing to send file \u2014 cannot resolve real path: ${f}`);
|
|
50250
50585
|
}
|
|
50251
|
-
const inbox =
|
|
50586
|
+
const inbox = join33(stateReal, "inbox");
|
|
50252
50587
|
if (real.startsWith(stateReal + sep3) && !real.startsWith(inbox + sep3)) {
|
|
50253
50588
|
throw new Error(`refusing to send channel state: ${f}`);
|
|
50254
50589
|
}
|
|
@@ -50354,7 +50689,7 @@ var HISTORY_ENABLED = HISTORY_ACCESS.historyEnabled !== false;
|
|
|
50354
50689
|
if (HISTORY_ENABLED) {
|
|
50355
50690
|
try {
|
|
50356
50691
|
initHistory(STATE_DIR, HISTORY_ACCESS.historyRetentionDays ?? 30);
|
|
50357
|
-
process.stderr.write(`telegram gateway: history capture enabled at ${
|
|
50692
|
+
process.stderr.write(`telegram gateway: history capture enabled at ${join33(STATE_DIR, "history.db")}
|
|
50358
50693
|
`);
|
|
50359
50694
|
} catch (err) {
|
|
50360
50695
|
process.stderr.write(`telegram gateway: history init failed (${err.message}) \u2014 capture disabled
|
|
@@ -50371,10 +50706,10 @@ try {
|
|
|
50371
50706
|
process.stderr.write(`telegram gateway: turn-registry boot-reaper stamped ${reaped} orphaned turn(s) as ended_via='restart'
|
|
50372
50707
|
`);
|
|
50373
50708
|
} else {
|
|
50374
|
-
process.stderr.write(`telegram gateway: turn-registry initialized at ${
|
|
50709
|
+
process.stderr.write(`telegram gateway: turn-registry initialized at ${join33(agentDir, "telegram", "registry.db")}
|
|
50375
50710
|
`);
|
|
50376
50711
|
}
|
|
50377
|
-
const pendingEnvPath =
|
|
50712
|
+
const pendingEnvPath = join33(agentDir, ".pending-turn.env");
|
|
50378
50713
|
try {
|
|
50379
50714
|
const pending2 = findMostRecentInterruptedTurn(turnsDb);
|
|
50380
50715
|
if (pending2 != null) {
|
|
@@ -50394,7 +50729,7 @@ try {
|
|
|
50394
50729
|
renameSync12(pendingEnvTmp, pendingEnvPath);
|
|
50395
50730
|
process.stderr.write(`telegram gateway: pending-turn env written to ${pendingEnvPath} turnKey=${pending2.turn_key} endedVia=${pending2.ended_via ?? "open"}
|
|
50396
50731
|
`);
|
|
50397
|
-
} else if (
|
|
50732
|
+
} else if (existsSync35(pendingEnvPath)) {
|
|
50398
50733
|
rmSync4(pendingEnvPath, { force: true });
|
|
50399
50734
|
process.stderr.write(`telegram gateway: pending-turn env cleared (clean previous shutdown)
|
|
50400
50735
|
`);
|
|
@@ -50448,7 +50783,7 @@ function checkApprovals() {
|
|
|
50448
50783
|
return;
|
|
50449
50784
|
}
|
|
50450
50785
|
for (const senderId of files) {
|
|
50451
|
-
const file =
|
|
50786
|
+
const file = join33(APPROVED_DIR, senderId);
|
|
50452
50787
|
bot.api.sendMessage(senderId, "Paired! Say hi to Claude.").then(() => rmSync4(file, { force: true }), (err) => {
|
|
50453
50788
|
process.stderr.write(`telegram gateway: failed to send approval confirm: ${err}
|
|
50454
50789
|
`);
|
|
@@ -51325,11 +51660,11 @@ var unpinProgressCardForChat = null;
|
|
|
51325
51660
|
var getPinnedProgressCardMessageId = null;
|
|
51326
51661
|
var completeProgressCardTurn = null;
|
|
51327
51662
|
var subagentWatcher = null;
|
|
51328
|
-
var SOCKET_PATH = process.env.SWITCHROOM_GATEWAY_SOCKET ??
|
|
51663
|
+
var SOCKET_PATH = process.env.SWITCHROOM_GATEWAY_SOCKET ?? join33(STATE_DIR, "gateway.sock");
|
|
51329
51664
|
mkdirSync21(STATE_DIR, { recursive: true, mode: 448 });
|
|
51330
|
-
var GATEWAY_PID_PATH = process.env.SWITCHROOM_GATEWAY_PID_FILE ??
|
|
51331
|
-
var GATEWAY_SESSION_MARKER_PATH = process.env.SWITCHROOM_GATEWAY_SESSION_MARKER ??
|
|
51332
|
-
var GATEWAY_CLEAN_SHUTDOWN_MARKER_PATH = process.env.SWITCHROOM_GATEWAY_CLEAN_SHUTDOWN_MARKER ??
|
|
51665
|
+
var GATEWAY_PID_PATH = process.env.SWITCHROOM_GATEWAY_PID_FILE ?? join33(STATE_DIR, "gateway.pid.json");
|
|
51666
|
+
var GATEWAY_SESSION_MARKER_PATH = process.env.SWITCHROOM_GATEWAY_SESSION_MARKER ?? join33(STATE_DIR, "gateway-session.json");
|
|
51667
|
+
var GATEWAY_CLEAN_SHUTDOWN_MARKER_PATH = process.env.SWITCHROOM_GATEWAY_CLEAN_SHUTDOWN_MARKER ?? join33(STATE_DIR, "clean-shutdown.json");
|
|
51333
51668
|
var GATEWAY_STARTED_AT_MS = Date.now();
|
|
51334
51669
|
var BOOT_CARD_ENABLED = process.env.SWITCHROOM_BOOT_CARD !== "false";
|
|
51335
51670
|
var activeBootCard = null;
|
|
@@ -51358,7 +51693,7 @@ function ensureIssuesCard(chatId, threadId) {
|
|
|
51358
51693
|
bot: botApi,
|
|
51359
51694
|
log: (msg) => process.stderr.write(`telegram gateway: ${msg}
|
|
51360
51695
|
`),
|
|
51361
|
-
persistPath:
|
|
51696
|
+
persistPath: join33(stateDir, "issues-card.json")
|
|
51362
51697
|
});
|
|
51363
51698
|
activeIssuesWatcher = startIssuesWatcher({
|
|
51364
51699
|
stateDir,
|
|
@@ -51402,6 +51737,21 @@ startTimer({
|
|
|
51402
51737
|
emitMetric: (event) => {
|
|
51403
51738
|
emitRuntimeMetric(event);
|
|
51404
51739
|
},
|
|
51740
|
+
onAwarenessPing: async (ctx) => {
|
|
51741
|
+
if (activeTurnStartedAt.get(ctx.key) == null && currentTurn == null) {
|
|
51742
|
+
return;
|
|
51743
|
+
}
|
|
51744
|
+
const text = formatFrameworkFallbackText(ctx.fallbackKind, ctx.silenceMs, ctx.inFlightTools);
|
|
51745
|
+
try {
|
|
51746
|
+
await robustApiCall(() => bot.api.sendMessage(ctx.chatId, text, {
|
|
51747
|
+
...ctx.threadId != null ? { message_thread_id: ctx.threadId } : {},
|
|
51748
|
+
disable_notification: true
|
|
51749
|
+
}), { chat_id: ctx.chatId, ...ctx.threadId != null ? { threadId: ctx.threadId } : {} });
|
|
51750
|
+
} catch (err) {
|
|
51751
|
+
process.stderr.write(`silence-poke awareness-ping sendMessage failed chat=${ctx.chatId} thread=${ctx.threadId}: ${err}
|
|
51752
|
+
`);
|
|
51753
|
+
}
|
|
51754
|
+
},
|
|
51405
51755
|
onFrameworkFallback: async (ctx) => {
|
|
51406
51756
|
if (activeTurnStartedAt.get(ctx.key) == null && currentTurn == null) {
|
|
51407
51757
|
process.stderr.write(`telegram gateway: silence-poke framework-fallback late-fire skipped \u2014 ` + `turn ended cleanly during silence window chat=${ctx.chatId} thread=${ctx.threadId ?? "-"} silence_ms=${ctx.silenceMs}
|
|
@@ -51450,7 +51800,6 @@ startTimer({
|
|
|
51450
51800
|
longest_silent_gap_ms: outboundMetrics.longestOutboundGapMs,
|
|
51451
51801
|
ended_via: "framework_fallback"
|
|
51452
51802
|
});
|
|
51453
|
-
clear(fbKey);
|
|
51454
51803
|
}
|
|
51455
51804
|
if (turnsDb != null && turnMatchesFallback && wedgedTurn?.registryKey != null) {
|
|
51456
51805
|
const _turnKey = wedgedTurn.registryKey;
|
|
@@ -51513,13 +51862,13 @@ startTimer2({
|
|
|
51513
51862
|
}
|
|
51514
51863
|
});
|
|
51515
51864
|
var inboundSpool = STATIC ? undefined : createInboundSpool({
|
|
51516
|
-
path:
|
|
51865
|
+
path: join33(STATE_DIR, "inbound-spool.jsonl"),
|
|
51517
51866
|
fs: {
|
|
51518
51867
|
appendFileSync: (p, d) => appendFileSync3(p, d),
|
|
51519
51868
|
readFileSync: (p) => readFileSync32(p, "utf8"),
|
|
51520
51869
|
writeFileSync: (p, d) => writeFileSync21(p, d),
|
|
51521
51870
|
renameSync: (a, b) => renameSync12(a, b),
|
|
51522
|
-
existsSync: (p) =>
|
|
51871
|
+
existsSync: (p) => existsSync35(p),
|
|
51523
51872
|
statSizeSync: (p) => statSync13(p).size
|
|
51524
51873
|
}
|
|
51525
51874
|
});
|
|
@@ -51747,7 +52096,7 @@ ${reminder}
|
|
|
51747
52096
|
noteSubagentDispatch(key);
|
|
51748
52097
|
}
|
|
51749
52098
|
if (ev.toolUseId != null && ev.toolUseId.length > 0 && !isTelegramSurfaceTool(ev.toolName)) {
|
|
51750
|
-
const label =
|
|
52099
|
+
const label = toolLabel2(ev.toolName, ev.input, undefined, ev.precomputedLabel);
|
|
51751
52100
|
noteToolStart(key, ev.toolUseId, ev.toolName, label.length > 0 ? label : null, Date.now());
|
|
51752
52101
|
const evInput = ev.input;
|
|
51753
52102
|
if (ev.toolName === "Agent" || ev.toolName === "Task" || ev.toolName === "Bash" && evInput?.run_in_background === true) {
|
|
@@ -52332,6 +52681,12 @@ ${url}`;
|
|
|
52332
52681
|
});
|
|
52333
52682
|
noteOutbound(statusKey(chat_id, threadId), Date.now());
|
|
52334
52683
|
noteOutbound2(statusKey(chat_id, threadId), Date.now());
|
|
52684
|
+
try {
|
|
52685
|
+
markAckSent();
|
|
52686
|
+
} catch (err) {
|
|
52687
|
+
process.stderr.write(`telegram gateway: markAckSent failed: ${err}
|
|
52688
|
+
`);
|
|
52689
|
+
}
|
|
52335
52690
|
if (isFinalAnswerReply({ text: rawText, disableNotification })) {
|
|
52336
52691
|
clearSilentEndState(statusKey(chat_id, threadId));
|
|
52337
52692
|
}
|
|
@@ -52659,6 +53014,12 @@ async function executeStreamReply(args) {
|
|
|
52659
53014
|
const sKey = statusKey(streamChatId, streamThreadId);
|
|
52660
53015
|
noteOutbound(sKey, Date.now());
|
|
52661
53016
|
noteOutbound2(sKey, Date.now());
|
|
53017
|
+
try {
|
|
53018
|
+
markAckSent();
|
|
53019
|
+
} catch (err) {
|
|
53020
|
+
process.stderr.write(`telegram gateway: markAckSent (stream_reply) failed: ${err}
|
|
53021
|
+
`);
|
|
53022
|
+
}
|
|
52662
53023
|
if (isFinalAnswerReply({
|
|
52663
53024
|
text: args.text ?? "",
|
|
52664
53025
|
disableNotification: args.disable_notification === true,
|
|
@@ -53009,10 +53370,10 @@ async function executeSendGif(rawArgs) {
|
|
|
53009
53370
|
};
|
|
53010
53371
|
}
|
|
53011
53372
|
async function publishToTelegraph(text, shortName, authorName) {
|
|
53012
|
-
const accountPath =
|
|
53373
|
+
const accountPath = join33(STATE_DIR, "telegraph-account.json");
|
|
53013
53374
|
let account = null;
|
|
53014
53375
|
try {
|
|
53015
|
-
if (
|
|
53376
|
+
if (existsSync35(accountPath)) {
|
|
53016
53377
|
const raw = readFileSync32(accountPath, "utf-8");
|
|
53017
53378
|
const parsed = JSON.parse(raw);
|
|
53018
53379
|
if (parsed.shortName && parsed.accessToken) {
|
|
@@ -53505,6 +53866,7 @@ function handleSessionEvent(ev) {
|
|
|
53505
53866
|
if (ev.chatId) {
|
|
53506
53867
|
const enqThreadId = ev.threadId != null ? Number(ev.threadId) : undefined;
|
|
53507
53868
|
clearPending(statusKey(ev.chatId, enqThreadId), "handback");
|
|
53869
|
+
clearAckSent();
|
|
53508
53870
|
}
|
|
53509
53871
|
if (ev.chatId) {
|
|
53510
53872
|
const prior = currentTurn;
|
|
@@ -53530,6 +53892,7 @@ function handleSessionEvent(ev) {
|
|
|
53530
53892
|
lastAssistantMsgId: null,
|
|
53531
53893
|
lastAssistantDone: false,
|
|
53532
53894
|
toolCallCount: 0,
|
|
53895
|
+
intentSurfaceFired: false,
|
|
53533
53896
|
answerStream: null,
|
|
53534
53897
|
isDm: isDmChatId(ev.chatId)
|
|
53535
53898
|
};
|
|
@@ -53595,6 +53958,33 @@ function handleSessionEvent(ev) {
|
|
|
53595
53958
|
turn.orphanedReplyTimeoutId = null;
|
|
53596
53959
|
}
|
|
53597
53960
|
}
|
|
53961
|
+
if (!turn.replyCalled && !turn.intentSurfaceFired && !isTelegramSurfaceTool(name)) {
|
|
53962
|
+
turn.intentSurfaceFired = true;
|
|
53963
|
+
const surface = deriveIntentSurface(name, ev.input, ev.precomputedLabel);
|
|
53964
|
+
if (surface.text != null) {
|
|
53965
|
+
try {
|
|
53966
|
+
markAckSent();
|
|
53967
|
+
} catch (err) {
|
|
53968
|
+
process.stderr.write(`telegram gateway: intent-surface markAckSent failed: ${err}
|
|
53969
|
+
`);
|
|
53970
|
+
}
|
|
53971
|
+
const surfaceChat = turn.sessionChatId;
|
|
53972
|
+
const surfaceThread = turn.sessionThreadId;
|
|
53973
|
+
const surfaceText = surface.text;
|
|
53974
|
+
(async () => {
|
|
53975
|
+
try {
|
|
53976
|
+
await robustApiCall(() => bot.api.sendMessage(surfaceChat, surfaceText, {
|
|
53977
|
+
...surfaceThread != null ? { message_thread_id: surfaceThread } : {},
|
|
53978
|
+
parse_mode: "HTML",
|
|
53979
|
+
disable_notification: true
|
|
53980
|
+
}), { chat_id: surfaceChat, ...surfaceThread != null ? { threadId: surfaceThread } : {}, verb: "intent-surface" });
|
|
53981
|
+
} catch (err) {
|
|
53982
|
+
process.stderr.write(`telegram gateway: intent-surface send failed: ${err}
|
|
53983
|
+
`);
|
|
53984
|
+
}
|
|
53985
|
+
})();
|
|
53986
|
+
}
|
|
53987
|
+
}
|
|
53598
53988
|
if (!ctrl)
|
|
53599
53989
|
return;
|
|
53600
53990
|
if (isTelegramSurfaceTool(name))
|
|
@@ -54949,7 +55339,7 @@ function getMyAgentName() {
|
|
|
54949
55339
|
const fromEnv = process.env.SWITCHROOM_AGENT_NAME;
|
|
54950
55340
|
if (fromEnv && fromEnv.trim().length > 0)
|
|
54951
55341
|
return fromEnv.trim();
|
|
54952
|
-
return
|
|
55342
|
+
return basename8(process.cwd());
|
|
54953
55343
|
}
|
|
54954
55344
|
function isSelfTargetingCommand(name) {
|
|
54955
55345
|
if (name === "all")
|
|
@@ -54962,7 +55352,7 @@ function restartMarkerPath() {
|
|
|
54962
55352
|
const agentDir = resolveAgentDirFromEnv();
|
|
54963
55353
|
if (!agentDir)
|
|
54964
55354
|
return null;
|
|
54965
|
-
return
|
|
55355
|
+
return join33(agentDir, "restart-pending.json");
|
|
54966
55356
|
}
|
|
54967
55357
|
function writeRestartMarker(marker) {
|
|
54968
55358
|
const p = restartMarkerPath();
|
|
@@ -55086,7 +55476,7 @@ var _dockerReachable;
|
|
|
55086
55476
|
function isDockerReachable() {
|
|
55087
55477
|
if (_dockerReachable !== undefined)
|
|
55088
55478
|
return _dockerReachable;
|
|
55089
|
-
if (!
|
|
55479
|
+
if (!existsSync35("/var/run/docker.sock")) {
|
|
55090
55480
|
_dockerReachable = false;
|
|
55091
55481
|
return _dockerReachable;
|
|
55092
55482
|
}
|
|
@@ -55103,11 +55493,11 @@ function _resetDockerReachableCache() {
|
|
|
55103
55493
|
}
|
|
55104
55494
|
function spawnSwitchroomDetached(args, onFailure) {
|
|
55105
55495
|
const fullArgs = SWITCHROOM_CONFIG ? ["--config", SWITCHROOM_CONFIG, ...args] : args;
|
|
55106
|
-
const logPath =
|
|
55496
|
+
const logPath = join33(STATE_DIR, "detached-spawn.log");
|
|
55107
55497
|
let outFd = null;
|
|
55108
55498
|
try {
|
|
55109
55499
|
mkdirSync21(STATE_DIR, { recursive: true });
|
|
55110
|
-
outFd =
|
|
55500
|
+
outFd = openSync9(logPath, "a");
|
|
55111
55501
|
writeFileSync21(logPath, `
|
|
55112
55502
|
[${new Date().toISOString()}] spawn ${SWITCHROOM_CLI} ${fullArgs.join(" ")}
|
|
55113
55503
|
`, { flag: "a" });
|
|
@@ -55122,7 +55512,7 @@ function spawnSwitchroomDetached(args, onFailure) {
|
|
|
55122
55512
|
});
|
|
55123
55513
|
if (outFd != null) {
|
|
55124
55514
|
try {
|
|
55125
|
-
|
|
55515
|
+
closeSync9(outFd);
|
|
55126
55516
|
} catch {}
|
|
55127
55517
|
}
|
|
55128
55518
|
if (onFailure) {
|
|
@@ -55476,8 +55866,8 @@ bot.use(async (ctx, next) => {
|
|
|
55476
55866
|
});
|
|
55477
55867
|
function readRecentDenialsForAgent(agentName3, windowMs, limit) {
|
|
55478
55868
|
try {
|
|
55479
|
-
const auditPath =
|
|
55480
|
-
if (!
|
|
55869
|
+
const auditPath = join33(homedir12(), ".switchroom", "vault-audit.log");
|
|
55870
|
+
if (!existsSync35(auditPath))
|
|
55481
55871
|
return [];
|
|
55482
55872
|
const raw = readFileSync32(auditPath, "utf8");
|
|
55483
55873
|
return recentDenialsFromAuditLog(raw, { agentName: agentName3, windowMs, limit });
|
|
@@ -55530,7 +55920,7 @@ async function buildAgentMetadata(agentName3) {
|
|
|
55530
55920
|
try {
|
|
55531
55921
|
const agentDir = resolveAgentDirFromEnv();
|
|
55532
55922
|
if (agentDir) {
|
|
55533
|
-
const raw = readFileSync32(
|
|
55923
|
+
const raw = readFileSync32(join33(agentDir, ".claude", ".claude.json"), "utf8");
|
|
55534
55924
|
claudeJson = JSON.parse(raw);
|
|
55535
55925
|
}
|
|
55536
55926
|
} catch {}
|
|
@@ -55744,10 +56134,10 @@ bot.command("restart", async (ctx) => {
|
|
|
55744
56134
|
function flushAgentHandoff(agentDir) {
|
|
55745
56135
|
let removed = 0;
|
|
55746
56136
|
for (const fname of [".handoff.md", ".handoff-topic"]) {
|
|
55747
|
-
const p =
|
|
56137
|
+
const p = join33(agentDir, fname);
|
|
55748
56138
|
try {
|
|
55749
|
-
if (
|
|
55750
|
-
|
|
56139
|
+
if (existsSync35(p)) {
|
|
56140
|
+
unlinkSync15(p);
|
|
55751
56141
|
removed++;
|
|
55752
56142
|
}
|
|
55753
56143
|
} catch (err) {
|
|
@@ -55802,7 +56192,7 @@ async function handleNewOrResetCommand(ctx, kind) {
|
|
|
55802
56192
|
writeRestartMarker({ chat_id: chatId, thread_id: threadId ?? null, ack_message_id: ackId, ts: Date.now() });
|
|
55803
56193
|
if (agentDir != null) {
|
|
55804
56194
|
try {
|
|
55805
|
-
writeFileSync21(
|
|
56195
|
+
writeFileSync21(join33(agentDir, ".force-fresh-session"), `${kind} at ${new Date().toISOString()}
|
|
55806
56196
|
`, "utf8");
|
|
55807
56197
|
} catch (err) {
|
|
55808
56198
|
process.stderr.write(`telegram gateway: failed to write force-fresh marker: ${err}
|
|
@@ -56163,14 +56553,14 @@ bot.command("interrupt", async (ctx) => {
|
|
|
56163
56553
|
var lockoutOps = {
|
|
56164
56554
|
readFileSync: (p, enc) => readFileSync32(p, enc),
|
|
56165
56555
|
writeFileSync: (p, data, opts) => writeFileSync21(p, data, opts),
|
|
56166
|
-
existsSync: (p) =>
|
|
56556
|
+
existsSync: (p) => existsSync35(p),
|
|
56167
56557
|
mkdirSync: (p, opts) => mkdirSync21(p, opts),
|
|
56168
|
-
joinPath: (...parts) =>
|
|
56558
|
+
joinPath: (...parts) => join33(...parts)
|
|
56169
56559
|
};
|
|
56170
56560
|
var FLEET_FALLBACK_DEDUP_MS = 30000;
|
|
56171
56561
|
function isAuthBrokerSocketReachable() {
|
|
56172
56562
|
try {
|
|
56173
|
-
return
|
|
56563
|
+
return existsSync35(resolveAuthBrokerSocketPath2());
|
|
56174
56564
|
} catch {
|
|
56175
56565
|
return false;
|
|
56176
56566
|
}
|
|
@@ -56231,7 +56621,7 @@ async function runCreditWatch() {
|
|
|
56231
56621
|
if (!agentDir)
|
|
56232
56622
|
return;
|
|
56233
56623
|
const agentName3 = getMyAgentName();
|
|
56234
|
-
const claudeConfigDir =
|
|
56624
|
+
const claudeConfigDir = join33(agentDir, ".claude");
|
|
56235
56625
|
const stateDir = STATE_DIR;
|
|
56236
56626
|
const reason = readClaudeJsonOverage(claudeConfigDir);
|
|
56237
56627
|
const prev = loadCreditState(stateDir);
|
|
@@ -56441,9 +56831,9 @@ async function handleVaultRecentDenialCallback(ctx, data) {
|
|
|
56441
56831
|
return;
|
|
56442
56832
|
}
|
|
56443
56833
|
const { token, id } = result;
|
|
56444
|
-
const tokenPath =
|
|
56834
|
+
const tokenPath = join33(homedir12(), ".switchroom", "agents", agentName3, ".vault-token");
|
|
56445
56835
|
try {
|
|
56446
|
-
mkdirSync21(
|
|
56836
|
+
mkdirSync21(join33(homedir12(), ".switchroom", "agents", agentName3), { recursive: true });
|
|
56447
56837
|
writeFileSync21(tokenPath, token, { mode: 384 });
|
|
56448
56838
|
} catch (err) {
|
|
56449
56839
|
await switchroomReply(ctx, `<b>Grant created (${escapeHtmlForTg(id)}) but token write failed:</b> ${escapeHtmlForTg(String(err))}
|
|
@@ -56520,9 +56910,9 @@ async function performVaultAccessApproval(ctx, pending2, stageId, senderId, atte
|
|
|
56520
56910
|
return;
|
|
56521
56911
|
}
|
|
56522
56912
|
const { token, id } = result;
|
|
56523
|
-
const tokenPath =
|
|
56913
|
+
const tokenPath = join33(homedir12(), ".switchroom", "agents", pending2.agent, ".vault-token");
|
|
56524
56914
|
try {
|
|
56525
|
-
mkdirSync21(
|
|
56915
|
+
mkdirSync21(join33(homedir12(), ".switchroom", "agents", pending2.agent), { recursive: true });
|
|
56526
56916
|
writeFileSync21(tokenPath, token, { mode: 384 });
|
|
56527
56917
|
} catch (err) {
|
|
56528
56918
|
await switchroomReply(ctx, `<b>Grant created (${escapeHtmlForTg(id)}) but token write failed:</b> ${escapeHtmlForTg(String(err))}
|
|
@@ -56998,9 +57388,9 @@ async function executeGrantWizard(ctx, chatId, state4) {
|
|
|
56998
57388
|
return;
|
|
56999
57389
|
}
|
|
57000
57390
|
const { token, id } = result;
|
|
57001
|
-
const tokenPath =
|
|
57391
|
+
const tokenPath = join33(homedir12(), ".switchroom", "agents", state4.agent, ".vault-token");
|
|
57002
57392
|
try {
|
|
57003
|
-
mkdirSync21(
|
|
57393
|
+
mkdirSync21(join33(homedir12(), ".switchroom", "agents", state4.agent), { recursive: true });
|
|
57004
57394
|
writeFileSync21(tokenPath, token, { mode: 384 });
|
|
57005
57395
|
} catch (err) {
|
|
57006
57396
|
await switchroomReply(ctx, `<b>Grant created but token write failed:</b> ${escapeHtmlForTg(String(err))}`, { html: true });
|
|
@@ -57858,7 +58248,7 @@ bot.command("usage", async (ctx) => {
|
|
|
57858
58248
|
await switchroomReply(ctx, "<b>/usage:</b> cannot resolve agent dir.", { html: true });
|
|
57859
58249
|
return;
|
|
57860
58250
|
}
|
|
57861
|
-
const result = await fetchQuota2({ claudeConfigDir:
|
|
58251
|
+
const result = await fetchQuota2({ claudeConfigDir: join33(agentDir, ".claude") });
|
|
57862
58252
|
if (!result.ok) {
|
|
57863
58253
|
await switchroomReply(ctx, `<b>/usage:</b> ${escapeHtmlForTg(result.reason)}`, { html: true });
|
|
57864
58254
|
return;
|
|
@@ -58403,7 +58793,7 @@ async function maybeTranscribeVoice(fileId, mimeType, language) {
|
|
|
58403
58793
|
let apiKey = null;
|
|
58404
58794
|
try {
|
|
58405
58795
|
const path = __require("path").join(__require("os").homedir(), ".switchroom", "openai-api-key");
|
|
58406
|
-
if (
|
|
58796
|
+
if (existsSync35(path)) {
|
|
58407
58797
|
apiKey = readFileSync32(path, "utf-8").trim();
|
|
58408
58798
|
}
|
|
58409
58799
|
} catch (err) {
|
|
@@ -59264,7 +59654,7 @@ var didOneTimeSetup = false;
|
|
|
59264
59654
|
agentName: agentDisplayName,
|
|
59265
59655
|
agentSlug,
|
|
59266
59656
|
version: formatBootVersion(),
|
|
59267
|
-
agentDir: agentDir ??
|
|
59657
|
+
agentDir: agentDir ?? join33(homedir12(), ".switchroom", "agents", agentSlug),
|
|
59268
59658
|
gatewayInfo: { pid: process.pid, startedAtMs: GATEWAY_STARTED_AT_MS },
|
|
59269
59659
|
restartReason: reason,
|
|
59270
59660
|
restartAgeMs: markerAgeMs,
|