switchroom 0.14.8 → 0.14.10
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 +160 -157
- package/dist/auth-broker/index.js +81 -80
- package/dist/cli/drive-write-pretool.mjs +10 -10
- package/dist/cli/notion-write-pretool.mjs +83 -82
- package/dist/cli/skill-validate-pretool.mjs +72 -72
- package/dist/cli/switchroom.js +455 -365
- package/dist/host-control/main.js +149 -148
- package/dist/vault/approvals/kernel-server.js +83 -82
- package/dist/vault/broker/server.js +84 -83
- package/package.json +3 -3
- package/telegram-plugin/dist/bridge/bridge.js +112 -112
- package/telegram-plugin/dist/gateway/gateway.js +1217 -599
- package/telegram-plugin/dist/server.js +160 -160
- package/telegram-plugin/gateway/gateway.ts +126 -97
- package/telegram-plugin/gateway/webhook-ingest-server.test.ts +125 -0
- package/telegram-plugin/gateway/webhook-ingest-server.ts +218 -0
- package/telegram-plugin/tests/tool-activity-summary.test.ts +0 -216
- package/telegram-plugin/tool-activity-summary.ts +18 -197
|
@@ -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();
|
|
@@ -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();
|
|
@@ -23742,6 +23742,7 @@ var init_schema = __esm(() => {
|
|
|
23742
23742
|
webhook_rate_limit: exports_external.object({
|
|
23743
23743
|
rpm: exports_external.number().int().positive()
|
|
23744
23744
|
}).optional().describe("Per-source rate limit for the webhook ingest path (#714). " + "Off by default \u2014 when this key is absent the handler skips " + "rate-limit checks entirely. Opt in by setting `rpm` to an " + "integer requests-per-minute (token bucket per (agent, source); " + "burst equal to rpm). When enabled, exceeding the limit returns " + "429 with Retry-After header; first throttle event per " + "(agent, source) per 60s window is written to " + "<agent>/telegram/issues.jsonl. " + "Cascades from defaults.channels.telegram.webhook_rate_limit."),
|
|
23745
|
+
webhook_via_gateway: exports_external.boolean().optional().describe("Route verified webhook events to the agent's in-container gateway " + "over a peercred-gated UDS (<agent>/telegram/webhook.sock) instead " + "of having the host-side web receiver write the agent dir directly. " + "Required under the Docker runtime: the receiver runs as the host " + "operator UID and cannot write the per-agent-UID-owned agent dir " + "(EACCES 500) nor connect the gateway socket. When true the gateway " + "(running as the agent UID) becomes the sole writer of " + "webhook-events.jsonl + dedup/cooldown state and also fires " + "webhook_dispatch. Off by default for back-compat with host-runtime " + "installs. See docs/rfcs/webhook-via-gateway-socket.md."),
|
|
23745
23746
|
chat_id: exports_external.string().regex(/^-\d+$/, 'supergroup chat_id must be a negative integer as a string (e.g. "-1001234567890")').optional().describe("Per-agent supergroup ID \u2014 overrides fleet `telegram.forum_chat_id`. " + "When set, requires `default_topic_id`. Negative integer as string. " + "Forbidden when `dm_only: true`. See docs/rfcs/supergroup-mode.md."),
|
|
23746
23747
|
default_topic_id: exports_external.number().int().positive().optional().describe("Forum topic ID this agent's automated outbounds default to when " + "no more-specific alias resolves. Required when `chat_id` is set. " + "Telegram's General topic is `id=1` at MTProto but sends omit the " + "field \u2014 the outbound wrapper strips `message_thread_id === 1` " + "on send. Forbidden when `dm_only: true`."),
|
|
23747
23748
|
topic_aliases: exports_external.record(exports_external.string(), exports_external.number().int().positive()).optional().describe("Operator-friendly names for forum topic IDs (e.g. " + "`{ general: 1, planning: 17, cron: 23, admin: 31, alerts: 41 }`). " + "Referenced from per-cron `topic:` fields and the outbound router " + "for autonomous events (boot \u2192 alerts, hostd \u2192 admin, etc.). " + "Cascades per-key through defaults \u2192 profile \u2192 agent.")
|
|
@@ -25161,6 +25162,59 @@ function formatResetRelative(target, now = new Date) {
|
|
|
25161
25162
|
}
|
|
25162
25163
|
var OAUTH_BETA = "oauth-2025-04-20", DEFAULT_USER_AGENT = "claude-cli/1.0.0 (external, cli)", DEFAULT_PROBE_MODEL = "claude-haiku-4-5-20251001";
|
|
25163
25164
|
var init_quota_check = () => {};
|
|
25165
|
+
|
|
25166
|
+
// ../src/vault/broker/peercred-ffi.ts
|
|
25167
|
+
function getPeerCred(fd) {
|
|
25168
|
+
if (process.platform !== "linux")
|
|
25169
|
+
return null;
|
|
25170
|
+
try {
|
|
25171
|
+
const ffi = __require("bun:ffi");
|
|
25172
|
+
const { dlopen, FFIType, ptr } = ffi;
|
|
25173
|
+
const SOL_SOCKET = 1;
|
|
25174
|
+
const SO_PEERCRED = 17;
|
|
25175
|
+
const UCRED_SIZE = 12;
|
|
25176
|
+
const cache = getPeerCred;
|
|
25177
|
+
const lib = cache._lib ?? (() => {
|
|
25178
|
+
const candidates = ["libc.so.6", "libc.so"];
|
|
25179
|
+
const symbolSpec = {
|
|
25180
|
+
getsockopt: {
|
|
25181
|
+
args: [FFIType.i32, FFIType.i32, FFIType.i32, FFIType.ptr, FFIType.ptr],
|
|
25182
|
+
returns: FFIType.i32
|
|
25183
|
+
}
|
|
25184
|
+
};
|
|
25185
|
+
const errors3 = [];
|
|
25186
|
+
for (const name of candidates) {
|
|
25187
|
+
try {
|
|
25188
|
+
const opened = dlopen(name, symbolSpec);
|
|
25189
|
+
cache._lib = opened;
|
|
25190
|
+
return opened;
|
|
25191
|
+
} catch (e) {
|
|
25192
|
+
errors3.push(`${name}: ${e instanceof Error ? e.message : String(e)}`);
|
|
25193
|
+
}
|
|
25194
|
+
}
|
|
25195
|
+
process.stderr.write(`[vault-broker] peercred-ffi: dlopen failed for all libc candidates ` + `(${errors3.join("; ")}); falling back to ss-parsing.
|
|
25196
|
+
`);
|
|
25197
|
+
throw new Error("no libc candidate could be opened");
|
|
25198
|
+
})();
|
|
25199
|
+
const credBuf = new ArrayBuffer(UCRED_SIZE);
|
|
25200
|
+
const lenBuf = new Uint32Array(1);
|
|
25201
|
+
lenBuf[0] = UCRED_SIZE;
|
|
25202
|
+
const rc = lib.symbols.getsockopt(fd, SOL_SOCKET, SO_PEERCRED, ptr(credBuf), ptr(lenBuf.buffer));
|
|
25203
|
+
if (rc !== 0)
|
|
25204
|
+
return null;
|
|
25205
|
+
if (lenBuf[0] !== UCRED_SIZE)
|
|
25206
|
+
return null;
|
|
25207
|
+
const view = new DataView(credBuf);
|
|
25208
|
+
return {
|
|
25209
|
+
pid: view.getInt32(0, true),
|
|
25210
|
+
uid: view.getInt32(4, true),
|
|
25211
|
+
gid: view.getInt32(8, true)
|
|
25212
|
+
};
|
|
25213
|
+
} catch {
|
|
25214
|
+
return null;
|
|
25215
|
+
}
|
|
25216
|
+
}
|
|
25217
|
+
|
|
25164
25218
|
// ../src/vault/broker/peercred.ts
|
|
25165
25219
|
function isReservedAgentName(name) {
|
|
25166
25220
|
return RESERVED_AGENT_NAMES.has(name);
|
|
@@ -25863,7 +25917,7 @@ function deriveSlug(inputs, existing) {
|
|
|
25863
25917
|
return `${base}_${n}`;
|
|
25864
25918
|
}
|
|
25865
25919
|
|
|
25866
|
-
// ../../
|
|
25920
|
+
// ../../switchroom-sec-1417/node_modules/.bun/boundary@2.0.0/node_modules/boundary/lib/index.js
|
|
25867
25921
|
var require_lib = __commonJS((exports2) => {
|
|
25868
25922
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
25869
25923
|
exports2.binarySearch = exports2.upperBound = exports2.lowerBound = exports2.compare = undefined;
|
|
@@ -25910,7 +25964,7 @@ var require_lib = __commonJS((exports2) => {
|
|
|
25910
25964
|
exports2.binarySearch = binarySearch;
|
|
25911
25965
|
});
|
|
25912
25966
|
|
|
25913
|
-
// ../../
|
|
25967
|
+
// ../../switchroom-sec-1417/node_modules/.bun/structured-source@4.0.0/node_modules/structured-source/lib/structured-source.js
|
|
25914
25968
|
var require_structured_source = __commonJS((exports2) => {
|
|
25915
25969
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
25916
25970
|
exports2.StructuredSource = undefined;
|
|
@@ -25965,13 +26019,13 @@ var require_structured_source = __commonJS((exports2) => {
|
|
|
25965
26019
|
}
|
|
25966
26020
|
exports2.StructuredSource = StructuredSource;
|
|
25967
26021
|
});
|
|
25968
|
-
// ../../
|
|
26022
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@secretlint+core@12.2.0/node_modules/@secretlint/core/module/SecretLintSourceCodeImpl.js
|
|
25969
26023
|
var import_structured_source;
|
|
25970
26024
|
var init_SecretLintSourceCodeImpl = __esm(() => {
|
|
25971
26025
|
import_structured_source = __toESM(require_structured_source(), 1);
|
|
25972
26026
|
});
|
|
25973
26027
|
|
|
25974
|
-
// ../../
|
|
26028
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@secretlint+core@12.2.0/node_modules/@secretlint/core/module/helper/promise-event-emitter.js
|
|
25975
26029
|
class EventEmitter {
|
|
25976
26030
|
#listeners = new Map;
|
|
25977
26031
|
on(type, listener) {
|
|
@@ -26010,9 +26064,9 @@ class EventEmitter {
|
|
|
26010
26064
|
return Array.from(this.#listeners.get(type) ?? []);
|
|
26011
26065
|
}
|
|
26012
26066
|
}
|
|
26013
|
-
// ../../
|
|
26067
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@secretlint+core@12.2.0/node_modules/@secretlint/core/module/RuleContext.js
|
|
26014
26068
|
var init_RuleContext = () => {};
|
|
26015
|
-
// ../../
|
|
26069
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@secretlint+profiler@12.2.0/node_modules/@secretlint/profiler/module/index.js
|
|
26016
26070
|
class SecretLintProfiler {
|
|
26017
26071
|
perf;
|
|
26018
26072
|
entries = [];
|
|
@@ -26069,7 +26123,7 @@ class SecretLintProfiler {
|
|
|
26069
26123
|
}
|
|
26070
26124
|
}
|
|
26071
26125
|
|
|
26072
|
-
// ../../
|
|
26126
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@secretlint+profiler@12.2.0/node_modules/@secretlint/profiler/module/node.js
|
|
26073
26127
|
import perf_hooks from "node:perf_hooks";
|
|
26074
26128
|
|
|
26075
26129
|
class NullPerformanceObserver {
|
|
@@ -26084,19 +26138,19 @@ var init_node = __esm(() => {
|
|
|
26084
26138
|
});
|
|
26085
26139
|
});
|
|
26086
26140
|
|
|
26087
|
-
// ../../
|
|
26141
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@secretlint+core@12.2.0/node_modules/@secretlint/core/module/RunningEvents.js
|
|
26088
26142
|
var init_RunningEvents = __esm(() => {
|
|
26089
26143
|
init_node();
|
|
26090
26144
|
});
|
|
26091
26145
|
|
|
26092
|
-
// ../../
|
|
26146
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@secretlint+core@12.2.0/node_modules/@secretlint/core/module/RulePresetContext.js
|
|
26093
26147
|
var init_RulePresetContext = __esm(() => {
|
|
26094
26148
|
init_RuleContext();
|
|
26095
26149
|
});
|
|
26096
|
-
// ../../
|
|
26150
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@secretlint+core@12.2.0/node_modules/@secretlint/core/module/messages/index.js
|
|
26097
26151
|
var init_messages = () => {};
|
|
26098
26152
|
|
|
26099
|
-
// ../../
|
|
26153
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@secretlint+core@12.2.0/node_modules/@secretlint/core/module/index.js
|
|
26100
26154
|
var import_debug, debug;
|
|
26101
26155
|
var init_module = __esm(() => {
|
|
26102
26156
|
init_SecretLintSourceCodeImpl();
|
|
@@ -26109,7 +26163,7 @@ var init_module = __esm(() => {
|
|
|
26109
26163
|
debug = import_debug.default("@secretlint/core");
|
|
26110
26164
|
});
|
|
26111
26165
|
|
|
26112
|
-
// ../../
|
|
26166
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@secretlint+secretlint-rule-preset-recommend@12.2.0/node_modules/@secretlint/secretlint-rule-preset-recommend/module/index.js
|
|
26113
26167
|
function requireLodash_uniq() {
|
|
26114
26168
|
if (hasRequiredLodash_uniq)
|
|
26115
26169
|
return lodash_uniq;
|
|
@@ -27869,19 +27923,19 @@ function renderAuthLine(state4, agentName3, now = Date.now()) {
|
|
|
27869
27923
|
}
|
|
27870
27924
|
|
|
27871
27925
|
// gateway/quota-cache.ts
|
|
27872
|
-
import { existsSync as
|
|
27873
|
-
import { join as
|
|
27926
|
+
import { existsSync as existsSync26, readFileSync as readFileSync24, writeFileSync as writeFileSync15, mkdirSync as mkdirSync14 } from "fs";
|
|
27927
|
+
import { join as join23, dirname as dirname8 } from "path";
|
|
27874
27928
|
function defaultCachePath() {
|
|
27875
|
-
return process.env.SWITCHROOM_QUOTA_CACHE_PATH ??
|
|
27929
|
+
return process.env.SWITCHROOM_QUOTA_CACHE_PATH ?? join23(process.env.HOME ?? "/tmp", ".switchroom", "quota-cache.json");
|
|
27876
27930
|
}
|
|
27877
27931
|
function readQuotaCache(opts = {}) {
|
|
27878
27932
|
const path = opts.path ?? defaultCachePath();
|
|
27879
27933
|
const now = opts.now ?? Date.now();
|
|
27880
|
-
if (!
|
|
27934
|
+
if (!existsSync26(path))
|
|
27881
27935
|
return null;
|
|
27882
27936
|
let entry;
|
|
27883
27937
|
try {
|
|
27884
|
-
entry = JSON.parse(
|
|
27938
|
+
entry = JSON.parse(readFileSync24(path, "utf8"));
|
|
27885
27939
|
} catch {
|
|
27886
27940
|
return null;
|
|
27887
27941
|
}
|
|
@@ -27907,8 +27961,8 @@ function writeQuotaCache(result, opts = {}) {
|
|
|
27907
27961
|
result
|
|
27908
27962
|
};
|
|
27909
27963
|
try {
|
|
27910
|
-
|
|
27911
|
-
|
|
27964
|
+
mkdirSync14(dirname8(path), { recursive: true });
|
|
27965
|
+
writeFileSync15(path, JSON.stringify(entry, null, 2), { mode: 384 });
|
|
27912
27966
|
} catch {}
|
|
27913
27967
|
}
|
|
27914
27968
|
var DEFAULT_TTL_MS4, RATE_LIMIT_TTL_MS;
|
|
@@ -27918,8 +27972,8 @@ var init_quota_cache = __esm(() => {
|
|
|
27918
27972
|
});
|
|
27919
27973
|
|
|
27920
27974
|
// gateway/boot-probes.ts
|
|
27921
|
-
import { readFileSync as
|
|
27922
|
-
import { join as
|
|
27975
|
+
import { readFileSync as readFileSync25, readdirSync as readdirSync4, existsSync as existsSync27 } from "fs";
|
|
27976
|
+
import { join as join24 } from "path";
|
|
27923
27977
|
import { execFile as execFileCb } from "child_process";
|
|
27924
27978
|
import { promisify as promisify3 } from "util";
|
|
27925
27979
|
async function withTimeout(label, p, timeoutMs = PROBE_TIMEOUT_MS) {
|
|
@@ -27961,11 +28015,11 @@ function mapPlan(billingType, hasExtra) {
|
|
|
27961
28015
|
}
|
|
27962
28016
|
async function probeAccount(agentDir) {
|
|
27963
28017
|
return withTimeout("Account", (async () => {
|
|
27964
|
-
const claudeDir =
|
|
27965
|
-
const claudeJsonPath =
|
|
28018
|
+
const claudeDir = join24(agentDir, ".claude");
|
|
28019
|
+
const claudeJsonPath = join24(claudeDir, ".claude.json");
|
|
27966
28020
|
let cfg = {};
|
|
27967
28021
|
try {
|
|
27968
|
-
const raw =
|
|
28022
|
+
const raw = readFileSync25(claudeJsonPath, "utf8");
|
|
27969
28023
|
cfg = JSON.parse(raw);
|
|
27970
28024
|
} catch {
|
|
27971
28025
|
return { status: "fail", label: "Account", detail: "no .claude.json" };
|
|
@@ -27983,12 +28037,12 @@ async function probeAccount(agentDir) {
|
|
|
27983
28037
|
let tokenStr = "";
|
|
27984
28038
|
let status = "ok";
|
|
27985
28039
|
for (const candidate of [
|
|
27986
|
-
|
|
27987
|
-
|
|
28040
|
+
join24(claudeDir, ".oauth-token.meta.json"),
|
|
28041
|
+
join24(claudeDir, "accounts", "default", ".oauth-token.meta.json")
|
|
27988
28042
|
]) {
|
|
27989
|
-
if (
|
|
28043
|
+
if (existsSync27(candidate)) {
|
|
27990
28044
|
try {
|
|
27991
|
-
const meta = JSON.parse(
|
|
28045
|
+
const meta = JSON.parse(readFileSync25(candidate, "utf8"));
|
|
27992
28046
|
if (meta.expiresAt) {
|
|
27993
28047
|
tokenStr = " \u00b7 " + formatDaysFromNow(meta.expiresAt);
|
|
27994
28048
|
const daysLeft = Math.round((meta.expiresAt - Date.now()) / 86400000);
|
|
@@ -28163,9 +28217,9 @@ async function resolveTmuxSupervisorPid(agentName3, execFileImpl) {
|
|
|
28163
28217
|
if (!cgroup)
|
|
28164
28218
|
return null;
|
|
28165
28219
|
const procsPath = `/sys/fs/cgroup${cgroup}/cgroup.procs`;
|
|
28166
|
-
if (!
|
|
28220
|
+
if (!existsSync27(procsPath))
|
|
28167
28221
|
return null;
|
|
28168
|
-
const pidsRaw =
|
|
28222
|
+
const pidsRaw = readFileSync25(procsPath, "utf-8");
|
|
28169
28223
|
const pids = pidsRaw.split(`
|
|
28170
28224
|
`).map((s) => s.trim()).filter(Boolean);
|
|
28171
28225
|
if (pids.length === 0)
|
|
@@ -28178,7 +28232,7 @@ async function resolveTmuxSupervisorPid(agentName3, execFileImpl) {
|
|
|
28178
28232
|
let rss = 0;
|
|
28179
28233
|
let comm = "";
|
|
28180
28234
|
try {
|
|
28181
|
-
const status =
|
|
28235
|
+
const status = readFileSync25(`/proc/${pid}/status`, "utf-8");
|
|
28182
28236
|
const rssLine = status.split(`
|
|
28183
28237
|
`).find((l) => l.startsWith("VmRSS:"));
|
|
28184
28238
|
if (rssLine) {
|
|
@@ -28190,7 +28244,7 @@ async function resolveTmuxSupervisorPid(agentName3, execFileImpl) {
|
|
|
28190
28244
|
continue;
|
|
28191
28245
|
}
|
|
28192
28246
|
try {
|
|
28193
|
-
comm =
|
|
28247
|
+
comm = readFileSync25(`/proc/${pid}/comm`, "utf-8").trim();
|
|
28194
28248
|
} catch {}
|
|
28195
28249
|
candidates.push({ pid, rss, comm });
|
|
28196
28250
|
}
|
|
@@ -28370,9 +28424,9 @@ async function probeQuota(claudeConfigDir, _agentDir, fetchImpl = fetch, opts =
|
|
|
28370
28424
|
let claudeDirForProbe = null;
|
|
28371
28425
|
for (const candidate of [
|
|
28372
28426
|
claudeConfigDir,
|
|
28373
|
-
|
|
28427
|
+
join24(claudeConfigDir, "accounts", "default")
|
|
28374
28428
|
]) {
|
|
28375
|
-
if (
|
|
28429
|
+
if (existsSync27(join24(candidate, ".oauth-token"))) {
|
|
28376
28430
|
claudeDirForProbe = candidate;
|
|
28377
28431
|
break;
|
|
28378
28432
|
}
|
|
@@ -28437,7 +28491,7 @@ async function probeHindsight(bankName, fetchImpl = fetch) {
|
|
|
28437
28491
|
}
|
|
28438
28492
|
function readContainerBootTimeMsForProbe() {
|
|
28439
28493
|
try {
|
|
28440
|
-
const stat1 =
|
|
28494
|
+
const stat1 = readFileSync25("/proc/1/stat", "utf8");
|
|
28441
28495
|
const lastParen = stat1.lastIndexOf(")");
|
|
28442
28496
|
if (lastParen < 0)
|
|
28443
28497
|
return null;
|
|
@@ -28445,7 +28499,7 @@ function readContainerBootTimeMsForProbe() {
|
|
|
28445
28499
|
const starttimeTicks = Number(after[19]);
|
|
28446
28500
|
if (!Number.isFinite(starttimeTicks))
|
|
28447
28501
|
return null;
|
|
28448
|
-
const procStat =
|
|
28502
|
+
const procStat = readFileSync25("/proc/stat", "utf8");
|
|
28449
28503
|
const btimeLine = procStat.split(`
|
|
28450
28504
|
`).find((l) => l.startsWith("btime "));
|
|
28451
28505
|
if (!btimeLine)
|
|
@@ -28543,7 +28597,7 @@ async function probeUds(label, socketPath, opts = {}) {
|
|
|
28543
28597
|
}
|
|
28544
28598
|
return withTimeout(label, (async () => {
|
|
28545
28599
|
if (!opts.connectImpl) {
|
|
28546
|
-
if (!
|
|
28600
|
+
if (!existsSync27(socketPath)) {
|
|
28547
28601
|
return {
|
|
28548
28602
|
status: "fail",
|
|
28549
28603
|
label,
|
|
@@ -28578,9 +28632,9 @@ function udsNextStep(label, kind) {
|
|
|
28578
28632
|
return `${label} socket not reachable \u2014 bring up the daemon with \`docker compose up -d ${svc}\` (or check \`docker compose ps\`)`;
|
|
28579
28633
|
}
|
|
28580
28634
|
function defaultUdsConnect(socketPath) {
|
|
28581
|
-
const
|
|
28635
|
+
const net5 = __require("net");
|
|
28582
28636
|
return new Promise((resolve6, reject) => {
|
|
28583
|
-
const sock =
|
|
28637
|
+
const sock = net5.createConnection({ path: socketPath });
|
|
28584
28638
|
const t = setTimeout(() => {
|
|
28585
28639
|
sock.destroy();
|
|
28586
28640
|
reject(new Error("connect timeout"));
|
|
@@ -28607,7 +28661,7 @@ async function probeSkills(agentDir, opts = {}) {
|
|
|
28607
28661
|
return withTimeout("Skills", (async () => {
|
|
28608
28662
|
const fs2 = opts.fs ?? realSkillsFs;
|
|
28609
28663
|
const max = opts.maxNamesShown ?? 3;
|
|
28610
|
-
const skillsDir =
|
|
28664
|
+
const skillsDir = join24(agentDir, ".claude", "skills");
|
|
28611
28665
|
if (!fs2.exists(skillsDir)) {
|
|
28612
28666
|
return { status: "ok", label: "Skills", detail: "no skills dir" };
|
|
28613
28667
|
}
|
|
@@ -28622,17 +28676,17 @@ async function probeSkills(agentDir, opts = {}) {
|
|
|
28622
28676
|
}
|
|
28623
28677
|
const dangling = [];
|
|
28624
28678
|
for (const name of entries) {
|
|
28625
|
-
const skillPath =
|
|
28679
|
+
const skillPath = join24(skillsDir, name);
|
|
28626
28680
|
if (!fs2.exists(skillPath)) {
|
|
28627
28681
|
dangling.push(name);
|
|
28628
28682
|
continue;
|
|
28629
28683
|
}
|
|
28630
|
-
const skillMd =
|
|
28684
|
+
const skillMd = join24(skillPath, "SKILL.md");
|
|
28631
28685
|
if (!fs2.exists(skillMd) && !fs2.exists(skillPath + ".md")) {
|
|
28632
28686
|
continue;
|
|
28633
28687
|
}
|
|
28634
28688
|
}
|
|
28635
|
-
const overlayDir = opts.overlaySkillsDir ??
|
|
28689
|
+
const overlayDir = opts.overlaySkillsDir ?? join24(agentDir, "skills.d");
|
|
28636
28690
|
const overlaySlugs = new Set;
|
|
28637
28691
|
if (fs2.exists(overlayDir)) {
|
|
28638
28692
|
let overlayEntries = [];
|
|
@@ -28679,24 +28733,24 @@ var init_boot_probes = __esm(() => {
|
|
|
28679
28733
|
execFile3 = promisify3(execFileCb);
|
|
28680
28734
|
realProcFs = {
|
|
28681
28735
|
readdir: (p) => readdirSync4(p),
|
|
28682
|
-
readFile: (p) =>
|
|
28736
|
+
readFile: (p) => readFileSync25(p, "utf-8")
|
|
28683
28737
|
};
|
|
28684
28738
|
realSchedulerFs = {
|
|
28685
|
-
readFile: (p) =>
|
|
28739
|
+
readFile: (p) => readFileSync25(p, "utf-8"),
|
|
28686
28740
|
mtimeMs: (p) => {
|
|
28687
28741
|
const { statSync: statSync7 } = __require("fs");
|
|
28688
28742
|
return statSync7(p).mtimeMs;
|
|
28689
28743
|
},
|
|
28690
|
-
exists: (p) =>
|
|
28744
|
+
exists: (p) => existsSync27(p)
|
|
28691
28745
|
};
|
|
28692
28746
|
realSkillsFs = {
|
|
28693
28747
|
readdir: (p) => readdirSync4(p),
|
|
28694
|
-
exists: (p) =>
|
|
28748
|
+
exists: (p) => existsSync27(p)
|
|
28695
28749
|
};
|
|
28696
28750
|
});
|
|
28697
28751
|
|
|
28698
28752
|
// gateway/boot-issue-cache.ts
|
|
28699
|
-
import { existsSync as
|
|
28753
|
+
import { existsSync as existsSync28, readFileSync as readFileSync26, writeFileSync as writeFileSync16, mkdirSync as mkdirSync15, renameSync as renameSync9 } from "fs";
|
|
28700
28754
|
import { dirname as dirname9 } from "path";
|
|
28701
28755
|
function fingerprintProbe(key, r) {
|
|
28702
28756
|
if (r.status === "ok")
|
|
@@ -28776,11 +28830,11 @@ function diffProbes(probes, cache, opts = {}) {
|
|
|
28776
28830
|
return out;
|
|
28777
28831
|
}
|
|
28778
28832
|
function loadCache(path, now = Date.now) {
|
|
28779
|
-
if (!
|
|
28833
|
+
if (!existsSync28(path))
|
|
28780
28834
|
return { ...EMPTY_CACHE, probes: {} };
|
|
28781
28835
|
let raw;
|
|
28782
28836
|
try {
|
|
28783
|
-
raw =
|
|
28837
|
+
raw = readFileSync26(path, "utf-8");
|
|
28784
28838
|
} catch {
|
|
28785
28839
|
return { ...EMPTY_CACHE, probes: {} };
|
|
28786
28840
|
}
|
|
@@ -28823,9 +28877,9 @@ function applyAndSave(path, cache, diff) {
|
|
|
28823
28877
|
}
|
|
28824
28878
|
}
|
|
28825
28879
|
try {
|
|
28826
|
-
|
|
28880
|
+
mkdirSync15(dirname9(path), { recursive: true });
|
|
28827
28881
|
const tmp = `${path}.tmp`;
|
|
28828
|
-
|
|
28882
|
+
writeFileSync16(tmp, JSON.stringify(next), { mode: 384 });
|
|
28829
28883
|
renameSync9(tmp, path);
|
|
28830
28884
|
} catch {}
|
|
28831
28885
|
return next;
|
|
@@ -28839,7 +28893,7 @@ var init_boot_issue_cache = __esm(() => {
|
|
|
28839
28893
|
|
|
28840
28894
|
// gateway/config-snapshot.ts
|
|
28841
28895
|
import { createHash as createHash2 } from "crypto";
|
|
28842
|
-
import { existsSync as
|
|
28896
|
+
import { existsSync as existsSync29, readFileSync as readFileSync27, writeFileSync as writeFileSync17, mkdirSync as mkdirSync16, renameSync as renameSync10 } from "fs";
|
|
28843
28897
|
import { dirname as dirname10 } from "path";
|
|
28844
28898
|
function hashStringArray(items) {
|
|
28845
28899
|
if (!items || items.length === 0)
|
|
@@ -28904,11 +28958,11 @@ function renderConfigChangeDim(dim) {
|
|
|
28904
28958
|
}
|
|
28905
28959
|
}
|
|
28906
28960
|
function loadSnapshot(path, now = Date.now) {
|
|
28907
|
-
if (!
|
|
28961
|
+
if (!existsSync29(path))
|
|
28908
28962
|
return null;
|
|
28909
28963
|
let raw;
|
|
28910
28964
|
try {
|
|
28911
|
-
raw =
|
|
28965
|
+
raw = readFileSync27(path, "utf-8");
|
|
28912
28966
|
} catch {
|
|
28913
28967
|
return null;
|
|
28914
28968
|
}
|
|
@@ -28938,9 +28992,9 @@ function loadSnapshot(path, now = Date.now) {
|
|
|
28938
28992
|
}
|
|
28939
28993
|
function persistSnapshot(path, snapshot) {
|
|
28940
28994
|
try {
|
|
28941
|
-
|
|
28995
|
+
mkdirSync16(dirname10(path), { recursive: true });
|
|
28942
28996
|
const tmp = `${path}.tmp`;
|
|
28943
|
-
|
|
28997
|
+
writeFileSync17(tmp, JSON.stringify(snapshot), { mode: 384 });
|
|
28944
28998
|
renameSync10(tmp, path);
|
|
28945
28999
|
} catch {}
|
|
28946
29000
|
}
|
|
@@ -28956,7 +29010,7 @@ __export(exports_boot_card, {
|
|
|
28956
29010
|
renderBootCard: () => renderBootCard,
|
|
28957
29011
|
renderAccountRows: () => renderAuthLine
|
|
28958
29012
|
});
|
|
28959
|
-
import { join as
|
|
29013
|
+
import { join as join25 } from "path";
|
|
28960
29014
|
function resolvePersonaName(slug, loadConfig3) {
|
|
28961
29015
|
try {
|
|
28962
29016
|
const config = loadConfig3 ? loadConfig3() : loadConfig();
|
|
@@ -29046,7 +29100,7 @@ function renderBootCard(opts) {
|
|
|
29046
29100
|
`);
|
|
29047
29101
|
}
|
|
29048
29102
|
async function runAllProbes(opts) {
|
|
29049
|
-
const claudeDir =
|
|
29103
|
+
const claudeDir = join25(opts.agentDir, ".claude");
|
|
29050
29104
|
const probes = {};
|
|
29051
29105
|
const slug = opts.agentSlug ?? opts.agentName;
|
|
29052
29106
|
await Promise.allSettled([
|
|
@@ -29664,12 +29718,12 @@ var init_flock = () => {};
|
|
|
29664
29718
|
// ../src/vault/vault.ts
|
|
29665
29719
|
import { randomBytes as randomBytes5, scryptSync, createCipheriv, createDecipheriv } from "node:crypto";
|
|
29666
29720
|
import {
|
|
29667
|
-
readFileSync as
|
|
29668
|
-
writeFileSync as
|
|
29669
|
-
existsSync as
|
|
29721
|
+
readFileSync as readFileSync35,
|
|
29722
|
+
writeFileSync as writeFileSync23,
|
|
29723
|
+
existsSync as existsSync37,
|
|
29670
29724
|
renameSync as renameSync12,
|
|
29671
|
-
mkdirSync as
|
|
29672
|
-
unlinkSync as
|
|
29725
|
+
mkdirSync as mkdirSync23,
|
|
29726
|
+
unlinkSync as unlinkSync13,
|
|
29673
29727
|
lstatSync,
|
|
29674
29728
|
realpathSync
|
|
29675
29729
|
} from "node:fs";
|
|
@@ -29704,12 +29758,12 @@ function normalizeSecrets(raw) {
|
|
|
29704
29758
|
return out;
|
|
29705
29759
|
}
|
|
29706
29760
|
function openVault(passphrase, vaultPath) {
|
|
29707
|
-
if (!
|
|
29761
|
+
if (!existsSync37(vaultPath)) {
|
|
29708
29762
|
throw new VaultError(`Vault file not found: ${vaultPath}`);
|
|
29709
29763
|
}
|
|
29710
29764
|
let vaultFile;
|
|
29711
29765
|
try {
|
|
29712
|
-
vaultFile = JSON.parse(
|
|
29766
|
+
vaultFile = JSON.parse(readFileSync35(vaultPath, "utf8"));
|
|
29713
29767
|
} catch {
|
|
29714
29768
|
throw new VaultError(`Failed to read vault file: ${vaultPath}`);
|
|
29715
29769
|
}
|
|
@@ -29754,16 +29808,16 @@ var init_vault = __esm(() => {
|
|
|
29754
29808
|
|
|
29755
29809
|
// ../src/vault/resolver.ts
|
|
29756
29810
|
import {
|
|
29757
|
-
chmodSync as
|
|
29811
|
+
chmodSync as chmodSync5,
|
|
29758
29812
|
closeSync as closeSync7,
|
|
29759
|
-
mkdirSync as
|
|
29813
|
+
mkdirSync as mkdirSync24,
|
|
29760
29814
|
mkdtempSync as mkdtempSync2,
|
|
29761
29815
|
openSync as openSync7,
|
|
29762
29816
|
rmSync as rmSync3,
|
|
29763
29817
|
statSync as statSync11,
|
|
29764
29818
|
writeSync as writeSync2
|
|
29765
29819
|
} from "node:fs";
|
|
29766
|
-
import { join as
|
|
29820
|
+
import { join as join35 } from "node:path";
|
|
29767
29821
|
import { tmpdir } from "node:os";
|
|
29768
29822
|
import { constants as fsConstants } from "node:fs";
|
|
29769
29823
|
function isVaultReference(value) {
|
|
@@ -29815,13 +29869,13 @@ function materializationRoot() {
|
|
|
29815
29869
|
return cachedRoot;
|
|
29816
29870
|
const xdg = process.env.XDG_RUNTIME_DIR;
|
|
29817
29871
|
if (xdg) {
|
|
29818
|
-
const base =
|
|
29819
|
-
|
|
29820
|
-
cachedRoot = mkdtempSync2(
|
|
29872
|
+
const base = join35(xdg, "switchroom", "vault");
|
|
29873
|
+
mkdirSync24(base, { recursive: true, mode: 448 });
|
|
29874
|
+
cachedRoot = mkdtempSync2(join35(base, "run-"));
|
|
29821
29875
|
} else {
|
|
29822
|
-
cachedRoot = mkdtempSync2(
|
|
29876
|
+
cachedRoot = mkdtempSync2(join35(tmpdir(), "switchroom-vault-"));
|
|
29823
29877
|
}
|
|
29824
|
-
|
|
29878
|
+
chmodSync5(cachedRoot, 448);
|
|
29825
29879
|
return cachedRoot;
|
|
29826
29880
|
}
|
|
29827
29881
|
function writeFileExclusive(filePath, content) {
|
|
@@ -29834,14 +29888,14 @@ function writeFileExclusive(filePath, content) {
|
|
|
29834
29888
|
}
|
|
29835
29889
|
}
|
|
29836
29890
|
function materializeFilesEntry(key, files) {
|
|
29837
|
-
const dir =
|
|
29891
|
+
const dir = join35(materializationRoot(), key);
|
|
29838
29892
|
if (materializedDirs.has(dir)) {
|
|
29839
29893
|
try {
|
|
29840
29894
|
rmSync3(dir, { recursive: true, force: true });
|
|
29841
29895
|
} catch {}
|
|
29842
29896
|
}
|
|
29843
|
-
|
|
29844
|
-
|
|
29897
|
+
mkdirSync24(dir, { recursive: true, mode: 448 });
|
|
29898
|
+
chmodSync5(dir, 448);
|
|
29845
29899
|
const st = statSync11(dir);
|
|
29846
29900
|
if (typeof process.getuid === "function" && st.uid !== process.getuid()) {
|
|
29847
29901
|
throw new Error(`Refusing to materialize vault entry: ${dir} not owned by caller`);
|
|
@@ -29850,7 +29904,7 @@ function materializeFilesEntry(key, files) {
|
|
|
29850
29904
|
if (filename.includes("/") || filename.includes("\\") || filename === ".." || filename === "." || filename.includes("\x00")) {
|
|
29851
29905
|
throw new Error(`Refusing to materialize vault file with unsafe name: ${filename}`);
|
|
29852
29906
|
}
|
|
29853
|
-
const filePath =
|
|
29907
|
+
const filePath = join35(dir, filename);
|
|
29854
29908
|
const content = encoding === "base64" ? Buffer.from(value, "base64") : value;
|
|
29855
29909
|
writeFileExclusive(filePath, content);
|
|
29856
29910
|
}
|
|
@@ -29983,7 +30037,7 @@ __export(exports_materialize_bot_token, {
|
|
|
29983
30037
|
materializeBotToken: () => materializeBotToken,
|
|
29984
30038
|
BotTokenMaterializeError: () => BotTokenMaterializeError
|
|
29985
30039
|
});
|
|
29986
|
-
import { existsSync as
|
|
30040
|
+
import { existsSync as existsSync38 } from "node:fs";
|
|
29987
30041
|
function pickConfiguredToken(config, agentName3) {
|
|
29988
30042
|
if (agentName3) {
|
|
29989
30043
|
const agent = config.agents?.[agentName3];
|
|
@@ -29997,7 +30051,7 @@ function tryDirectVaultRead(ref, config, passphrase) {
|
|
|
29997
30051
|
if (!passphrase)
|
|
29998
30052
|
return null;
|
|
29999
30053
|
const vaultPath = resolvePath(config.vault?.path ?? "~/.switchroom/vault.enc");
|
|
30000
|
-
if (!
|
|
30054
|
+
if (!existsSync38(vaultPath))
|
|
30001
30055
|
return null;
|
|
30002
30056
|
try {
|
|
30003
30057
|
const secrets = openVault(passphrase, vaultPath);
|
|
@@ -30307,7 +30361,7 @@ __export(exports_tmux, {
|
|
|
30307
30361
|
captureAgentPane: () => captureAgentPane
|
|
30308
30362
|
});
|
|
30309
30363
|
import { execFileSync as execFileSync4 } from "node:child_process";
|
|
30310
|
-
import { mkdirSync as
|
|
30364
|
+
import { mkdirSync as mkdirSync25, readdirSync as readdirSync6, statSync as statSync12, unlinkSync as unlinkSync14, writeFileSync as writeFileSync24 } from "node:fs";
|
|
30311
30365
|
import { resolve as resolve7 } from "node:path";
|
|
30312
30366
|
function captureAgentPane(opts) {
|
|
30313
30367
|
const { agentName: agentName3, agentDir, reason } = opts;
|
|
@@ -30319,7 +30373,7 @@ function captureAgentPane(opts) {
|
|
|
30319
30373
|
const reasonSlug = sanitizeReason(reason);
|
|
30320
30374
|
const outPath = resolve7(outDir, `${ts}-${reasonSlug}.txt`);
|
|
30321
30375
|
try {
|
|
30322
|
-
|
|
30376
|
+
mkdirSync25(outDir, { recursive: true, mode: 493 });
|
|
30323
30377
|
} catch (err) {
|
|
30324
30378
|
const msg = `mkdir crash-reports failed: ${err.message}`;
|
|
30325
30379
|
console.error(`[tmux-capture] ${agentName3}: ${msg}`);
|
|
@@ -30353,7 +30407,7 @@ function captureAgentPane(opts) {
|
|
|
30353
30407
|
` + `
|
|
30354
30408
|
`;
|
|
30355
30409
|
try {
|
|
30356
|
-
|
|
30410
|
+
writeFileSync24(outPath, Buffer.concat([Buffer.from(header, "utf8"), body]), {
|
|
30357
30411
|
mode: 420
|
|
30358
30412
|
});
|
|
30359
30413
|
} catch (err) {
|
|
@@ -30421,7 +30475,7 @@ function pruneOldReports(dir, retain) {
|
|
|
30421
30475
|
}).sort((a, b) => b.mtimeMs - a.mtimeMs);
|
|
30422
30476
|
for (const stale of files.slice(retain)) {
|
|
30423
30477
|
try {
|
|
30424
|
-
|
|
30478
|
+
unlinkSync14(stale.full);
|
|
30425
30479
|
} catch {}
|
|
30426
30480
|
}
|
|
30427
30481
|
}
|
|
@@ -30695,23 +30749,23 @@ var import_runner2 = __toESM(require_mod3(), 1);
|
|
|
30695
30749
|
import { randomBytes as randomBytes6 } from "crypto";
|
|
30696
30750
|
import { execFileSync as execFileSync5, execSync as execSync2, spawn as spawn2 } from "child_process";
|
|
30697
30751
|
import {
|
|
30698
|
-
readFileSync as
|
|
30699
|
-
writeFileSync as
|
|
30700
|
-
mkdirSync as
|
|
30752
|
+
readFileSync as readFileSync36,
|
|
30753
|
+
writeFileSync as writeFileSync25,
|
|
30754
|
+
mkdirSync as mkdirSync26,
|
|
30701
30755
|
readdirSync as readdirSync7,
|
|
30702
30756
|
rmSync as rmSync4,
|
|
30703
30757
|
statSync as statSync13,
|
|
30704
30758
|
renameSync as renameSync13,
|
|
30705
30759
|
realpathSync as realpathSync2,
|
|
30706
|
-
chmodSync as
|
|
30760
|
+
chmodSync as chmodSync6,
|
|
30707
30761
|
openSync as openSync8,
|
|
30708
30762
|
closeSync as closeSync8,
|
|
30709
|
-
existsSync as
|
|
30710
|
-
unlinkSync as
|
|
30711
|
-
appendFileSync as
|
|
30763
|
+
existsSync as existsSync39,
|
|
30764
|
+
unlinkSync as unlinkSync15,
|
|
30765
|
+
appendFileSync as appendFileSync5
|
|
30712
30766
|
} from "fs";
|
|
30713
|
-
import { homedir as
|
|
30714
|
-
import { join as
|
|
30767
|
+
import { homedir as homedir14 } from "os";
|
|
30768
|
+
import { join as join36, extname, sep as sep3, basename as basename7 } from "path";
|
|
30715
30769
|
|
|
30716
30770
|
// plugin-logger.ts
|
|
30717
30771
|
import { appendFileSync, mkdirSync, renameSync, statSync, existsSync } from "fs";
|
|
@@ -31760,114 +31814,6 @@ function isTelegramSurfaceTool(toolName) {
|
|
|
31760
31814
|
}
|
|
31761
31815
|
|
|
31762
31816
|
// tool-activity-summary.ts
|
|
31763
|
-
var READ_VERBS = new Set(["read"]);
|
|
31764
|
-
var WRITE_VERBS = new Set(["wrote", "created", "edited"]);
|
|
31765
|
-
function makeEmptyActivityState() {
|
|
31766
|
-
return { counts: {}, order: [], firstToolName: null };
|
|
31767
|
-
}
|
|
31768
|
-
function verbForTool(toolName) {
|
|
31769
|
-
if (!toolName)
|
|
31770
|
-
return null;
|
|
31771
|
-
const mcpMatch = /^mcp__(.+?)__(.+)$/.exec(toolName);
|
|
31772
|
-
if (mcpMatch && mcpMatch[1] === "switchroom-telegram")
|
|
31773
|
-
return null;
|
|
31774
|
-
if (mcpMatch) {
|
|
31775
|
-
const server = mcpMatch[1].toLowerCase();
|
|
31776
|
-
const mcpTool = mcpMatch[2].toLowerCase();
|
|
31777
|
-
if (server === "hindsight") {
|
|
31778
|
-
if (mcpTool === "recall" || mcpTool === "reflect")
|
|
31779
|
-
return "searched";
|
|
31780
|
-
if (mcpTool === "retain" || mcpTool === "update_memory" || mcpTool === "sync_retain")
|
|
31781
|
-
return "saved";
|
|
31782
|
-
}
|
|
31783
|
-
if (server === "google-workspace" || server === "claude_ai_google_drive" || server === "claude_ai_gmail" || server === "claude_ai_google_calendar") {
|
|
31784
|
-
if (/^(search|list|query|read|get|fetch|download)/i.test(mcpTool))
|
|
31785
|
-
return "searched";
|
|
31786
|
-
if (/^(create|update|write|send|move|copy|duplicate)/i.test(mcpTool))
|
|
31787
|
-
return "edited";
|
|
31788
|
-
}
|
|
31789
|
-
if (server === "notion" || server === "claude_ai_notion") {
|
|
31790
|
-
const action = mcpTool.replace(/^notion-/, "");
|
|
31791
|
-
if (/^(search|fetch|query|get|read)/i.test(action))
|
|
31792
|
-
return "searched";
|
|
31793
|
-
if (/^(create|update|move|duplicate|comment)/i.test(action))
|
|
31794
|
-
return "edited";
|
|
31795
|
-
}
|
|
31796
|
-
}
|
|
31797
|
-
const suffix = (mcpMatch ? mcpMatch[2] : toolName).toLowerCase();
|
|
31798
|
-
switch (suffix) {
|
|
31799
|
-
case "read":
|
|
31800
|
-
return "read";
|
|
31801
|
-
case "write":
|
|
31802
|
-
return "created";
|
|
31803
|
-
case "edit":
|
|
31804
|
-
case "multiedit":
|
|
31805
|
-
case "notebookedit":
|
|
31806
|
-
return "edited";
|
|
31807
|
-
case "bash":
|
|
31808
|
-
case "bashoutput":
|
|
31809
|
-
case "killshell":
|
|
31810
|
-
return "ran";
|
|
31811
|
-
case "websearch":
|
|
31812
|
-
case "grep":
|
|
31813
|
-
case "glob":
|
|
31814
|
-
return "searched";
|
|
31815
|
-
case "webfetch":
|
|
31816
|
-
return "fetched";
|
|
31817
|
-
case "task":
|
|
31818
|
-
case "agent":
|
|
31819
|
-
return "dispatched";
|
|
31820
|
-
case "todowrite":
|
|
31821
|
-
case "todoread":
|
|
31822
|
-
return "noted";
|
|
31823
|
-
default:
|
|
31824
|
-
return "used";
|
|
31825
|
-
}
|
|
31826
|
-
}
|
|
31827
|
-
function register(state, toolName) {
|
|
31828
|
-
const verb = verbForTool(toolName);
|
|
31829
|
-
if (!verb)
|
|
31830
|
-
return false;
|
|
31831
|
-
if (state.firstToolName == null)
|
|
31832
|
-
state.firstToolName = toolName;
|
|
31833
|
-
const prior = state.counts[verb] ?? 0;
|
|
31834
|
-
if (prior === 0)
|
|
31835
|
-
state.order.push(verb);
|
|
31836
|
-
state.counts[verb] = prior + 1;
|
|
31837
|
-
return true;
|
|
31838
|
-
}
|
|
31839
|
-
var VERB_PHRASE = {
|
|
31840
|
-
read: { singular: "read a file", plural: "read $N files" },
|
|
31841
|
-
edited: { singular: "edited a file", plural: "edited $N files" },
|
|
31842
|
-
created: { singular: "created a file", plural: "created $N files" },
|
|
31843
|
-
ran: { singular: "ran a command", plural: "ran $N commands" },
|
|
31844
|
-
searched: { singular: "ran a search", plural: "ran $N searches" },
|
|
31845
|
-
fetched: { singular: "fetched a URL", plural: "fetched $N URLs" },
|
|
31846
|
-
dispatched: { singular: "dispatched a sub-agent", plural: "dispatched $N sub-agents" },
|
|
31847
|
-
noted: { singular: "updated the todo list", plural: "updated the todo list ($N edits)" },
|
|
31848
|
-
saved: { singular: "saved a memory", plural: "saved $N memories" },
|
|
31849
|
-
used: { singular: "used a tool", plural: "used $N tools" }
|
|
31850
|
-
};
|
|
31851
|
-
function formatSummary(state) {
|
|
31852
|
-
const phrases = [];
|
|
31853
|
-
for (const verb of state.order) {
|
|
31854
|
-
const n = state.counts[verb] ?? 0;
|
|
31855
|
-
if (n <= 0)
|
|
31856
|
-
continue;
|
|
31857
|
-
const p = VERB_PHRASE[verb];
|
|
31858
|
-
phrases.push(n === 1 ? p.singular : p.plural.replace("$N", String(n)));
|
|
31859
|
-
}
|
|
31860
|
-
if (phrases.length === 0)
|
|
31861
|
-
return null;
|
|
31862
|
-
const sentence = phrases.join(", ");
|
|
31863
|
-
return sentence.charAt(0).toUpperCase() + sentence.slice(1);
|
|
31864
|
-
}
|
|
31865
|
-
function registerAndRender(state, toolName) {
|
|
31866
|
-
const changed = register(state, toolName);
|
|
31867
|
-
if (!changed)
|
|
31868
|
-
return null;
|
|
31869
|
-
return formatSummary(state);
|
|
31870
|
-
}
|
|
31871
31817
|
var MIRROR_MAX_LINES = 6;
|
|
31872
31818
|
function escapeFeedHtml(s) {
|
|
31873
31819
|
return s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
@@ -33335,7 +33281,7 @@ function clear(key) {
|
|
|
33335
33281
|
state.delete(key);
|
|
33336
33282
|
}
|
|
33337
33283
|
|
|
33338
|
-
// ../../
|
|
33284
|
+
// ../../switchroom-sec-1417/node_modules/.bun/posthog-node@5.29.2/node_modules/posthog-node/dist/extensions/error-tracking/modifiers/module.node.mjs
|
|
33339
33285
|
import { dirname as dirname2, posix, sep as sep2 } from "path";
|
|
33340
33286
|
function createModulerModifier() {
|
|
33341
33287
|
const getModuleFromFileName = createGetModuleFromFilename();
|
|
@@ -33371,7 +33317,7 @@ function normalizeWindowsPath(path) {
|
|
|
33371
33317
|
return path.replace(/^[A-Z]:/, "").replace(/\\/g, "/");
|
|
33372
33318
|
}
|
|
33373
33319
|
|
|
33374
|
-
// ../../
|
|
33320
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/featureFlagUtils.mjs
|
|
33375
33321
|
var normalizeFlagsResponse = (flagsResponse) => {
|
|
33376
33322
|
if ("flags" in flagsResponse) {
|
|
33377
33323
|
const featureFlags = getFlagValuesFromFlags(flagsResponse.flags);
|
|
@@ -33442,7 +33388,7 @@ var parsePayload = (response) => {
|
|
|
33442
33388
|
}
|
|
33443
33389
|
};
|
|
33444
33390
|
|
|
33445
|
-
// ../../
|
|
33391
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/gzip.mjs
|
|
33446
33392
|
function isGzipSupported() {
|
|
33447
33393
|
return "CompressionStream" in globalThis;
|
|
33448
33394
|
}
|
|
@@ -33462,7 +33408,7 @@ async function gzipCompress(input, isDebug = true) {
|
|
|
33462
33408
|
}
|
|
33463
33409
|
}
|
|
33464
33410
|
|
|
33465
|
-
// ../../
|
|
33411
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/vendor/uuidv7.mjs
|
|
33466
33412
|
/*! For license information please see uuidv7.mjs.LICENSE.txt */
|
|
33467
33413
|
var DIGITS = "0123456789abcdef";
|
|
33468
33414
|
|
|
@@ -33640,7 +33586,7 @@ var defaultGenerator;
|
|
|
33640
33586
|
var uuidv7 = () => uuidv7obj().toString();
|
|
33641
33587
|
var uuidv7obj = () => (defaultGenerator || (defaultGenerator = new V7Generator)).generate();
|
|
33642
33588
|
|
|
33643
|
-
// ../../
|
|
33589
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/types.mjs
|
|
33644
33590
|
var types_PostHogPersistedProperty = /* @__PURE__ */ function(PostHogPersistedProperty) {
|
|
33645
33591
|
PostHogPersistedProperty["AnonymousId"] = "anonymous_id";
|
|
33646
33592
|
PostHogPersistedProperty["DistinctId"] = "distinct_id";
|
|
@@ -33673,7 +33619,7 @@ var types_PostHogPersistedProperty = /* @__PURE__ */ function(PostHogPersistedPr
|
|
|
33673
33619
|
return PostHogPersistedProperty;
|
|
33674
33620
|
}({});
|
|
33675
33621
|
|
|
33676
|
-
// ../../
|
|
33622
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/utils/bot-detection.mjs
|
|
33677
33623
|
var DEFAULT_BLOCKED_UA_STRS = [
|
|
33678
33624
|
"amazonbot",
|
|
33679
33625
|
"amazonproductbot",
|
|
@@ -33762,7 +33708,7 @@ var isBlockedUA = function(ua, customBlockedUserAgents = []) {
|
|
|
33762
33708
|
return uaLower.indexOf(blockedUaLower) !== -1;
|
|
33763
33709
|
});
|
|
33764
33710
|
};
|
|
33765
|
-
// ../../
|
|
33711
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/utils/type-utils.mjs
|
|
33766
33712
|
var nativeIsArray = Array.isArray;
|
|
33767
33713
|
var ObjProto = Object.prototype;
|
|
33768
33714
|
var type_utils_hasOwnProperty = ObjProto.hasOwnProperty;
|
|
@@ -33799,7 +33745,7 @@ function isInstanceOf(candidate, base) {
|
|
|
33799
33745
|
}
|
|
33800
33746
|
}
|
|
33801
33747
|
|
|
33802
|
-
// ../../
|
|
33748
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/utils/number-utils.mjs
|
|
33803
33749
|
function clampToRange(value, min, max, logger, fallbackValue) {
|
|
33804
33750
|
if (min > max) {
|
|
33805
33751
|
logger.warn("min cannot be greater than max.");
|
|
@@ -33819,7 +33765,7 @@ function clampToRange(value, min, max, logger, fallbackValue) {
|
|
|
33819
33765
|
return clampToRange(fallbackValue || max, min, max, logger);
|
|
33820
33766
|
}
|
|
33821
33767
|
|
|
33822
|
-
// ../../
|
|
33768
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/utils/bucketed-rate-limiter.mjs
|
|
33823
33769
|
var ONE_DAY_IN_MS = 86400000;
|
|
33824
33770
|
|
|
33825
33771
|
class BucketedRateLimiter {
|
|
@@ -33863,7 +33809,7 @@ class BucketedRateLimiter {
|
|
|
33863
33809
|
this._buckets = {};
|
|
33864
33810
|
}
|
|
33865
33811
|
}
|
|
33866
|
-
// ../../
|
|
33812
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/utils/promise-queue.mjs
|
|
33867
33813
|
class PromiseQueue {
|
|
33868
33814
|
add(promise) {
|
|
33869
33815
|
const promiseUUID = uuidv7();
|
|
@@ -33889,7 +33835,7 @@ class PromiseQueue {
|
|
|
33889
33835
|
this.promiseByIds = {};
|
|
33890
33836
|
}
|
|
33891
33837
|
}
|
|
33892
|
-
// ../../
|
|
33838
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/utils/logger.mjs
|
|
33893
33839
|
function createConsole(consoleLike = console) {
|
|
33894
33840
|
const lockedMethods = {
|
|
33895
33841
|
log: consoleLike.log.bind(consoleLike),
|
|
@@ -33927,7 +33873,7 @@ var passThrough = (fn) => fn();
|
|
|
33927
33873
|
function createLogger(prefix, maybeCall = passThrough) {
|
|
33928
33874
|
return _createLogger(prefix, maybeCall, createConsole());
|
|
33929
33875
|
}
|
|
33930
|
-
// ../../
|
|
33876
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/utils/user-agent-utils.mjs
|
|
33931
33877
|
var MOBILE = "Mobile";
|
|
33932
33878
|
var IOS = "iOS";
|
|
33933
33879
|
var ANDROID = "Android";
|
|
@@ -34184,7 +34130,7 @@ var osMatchers = [
|
|
|
34184
34130
|
]
|
|
34185
34131
|
];
|
|
34186
34132
|
|
|
34187
|
-
// ../../
|
|
34133
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/utils/index.mjs
|
|
34188
34134
|
var STRING_FORMAT = "utf8";
|
|
34189
34135
|
function assert(truthyValue, message) {
|
|
34190
34136
|
if (!truthyValue || typeof truthyValue != "string" || isEmpty(truthyValue))
|
|
@@ -34232,7 +34178,7 @@ function allSettled(promises) {
|
|
|
34232
34178
|
reason
|
|
34233
34179
|
}))));
|
|
34234
34180
|
}
|
|
34235
|
-
// ../../
|
|
34181
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/eventemitter.mjs
|
|
34236
34182
|
class SimpleEventEmitter {
|
|
34237
34183
|
constructor() {
|
|
34238
34184
|
this.events = {};
|
|
@@ -34254,7 +34200,7 @@ class SimpleEventEmitter {
|
|
|
34254
34200
|
}
|
|
34255
34201
|
}
|
|
34256
34202
|
|
|
34257
|
-
// ../../
|
|
34203
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/posthog-core-stateless.mjs
|
|
34258
34204
|
class PostHogFetchHttpError extends Error {
|
|
34259
34205
|
constructor(response, reqByteLength) {
|
|
34260
34206
|
super("HTTP error while fetching PostHog: status=" + response.status + ", reqByteLength=" + reqByteLength), this.response = response, this.reqByteLength = reqByteLength, this.name = "PostHogFetchHttpError";
|
|
@@ -34969,7 +34915,7 @@ class PostHogCoreStateless {
|
|
|
34969
34915
|
return this.shutdownPromise;
|
|
34970
34916
|
}
|
|
34971
34917
|
}
|
|
34972
|
-
// ../../
|
|
34918
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/index.mjs
|
|
34973
34919
|
var exports_error_tracking = {};
|
|
34974
34920
|
__export(exports_error_tracking, {
|
|
34975
34921
|
winjsStackLineParser: () => winjsStackLineParser,
|
|
@@ -34993,7 +34939,7 @@ __export(exports_error_tracking, {
|
|
|
34993
34939
|
DOMExceptionCoercer: () => DOMExceptionCoercer
|
|
34994
34940
|
});
|
|
34995
34941
|
|
|
34996
|
-
// ../../
|
|
34942
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/chunk-ids.mjs
|
|
34997
34943
|
var parsedStackResults;
|
|
34998
34944
|
var lastKeysCount;
|
|
34999
34945
|
var cachedFilenameChunkIds;
|
|
@@ -35032,7 +34978,7 @@ function getFilenameToChunkIdMap(stackParser) {
|
|
|
35032
34978
|
return cachedFilenameChunkIds;
|
|
35033
34979
|
}
|
|
35034
34980
|
|
|
35035
|
-
// ../../
|
|
34981
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/error-properties-builder.mjs
|
|
35036
34982
|
var MAX_CAUSE_RECURSION = 4;
|
|
35037
34983
|
|
|
35038
34984
|
class ErrorPropertiesBuilder {
|
|
@@ -35154,7 +35100,7 @@ class ErrorPropertiesBuilder {
|
|
|
35154
35100
|
return context;
|
|
35155
35101
|
}
|
|
35156
35102
|
}
|
|
35157
|
-
// ../../
|
|
35103
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/parsers/base.mjs
|
|
35158
35104
|
var UNKNOWN_FUNCTION = "?";
|
|
35159
35105
|
function createFrame(platform, filename, func, lineno, colno) {
|
|
35160
35106
|
const frame = {
|
|
@@ -35170,7 +35116,7 @@ function createFrame(platform, filename, func, lineno, colno) {
|
|
|
35170
35116
|
return frame;
|
|
35171
35117
|
}
|
|
35172
35118
|
|
|
35173
|
-
// ../../
|
|
35119
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/parsers/safari.mjs
|
|
35174
35120
|
var extractSafariExtensionDetails = (func, filename) => {
|
|
35175
35121
|
const isSafariExtension = func.indexOf("safari-extension") !== -1;
|
|
35176
35122
|
const isSafariWebExtension = func.indexOf("safari-web-extension") !== -1;
|
|
@@ -35183,7 +35129,7 @@ var extractSafariExtensionDetails = (func, filename) => {
|
|
|
35183
35129
|
];
|
|
35184
35130
|
};
|
|
35185
35131
|
|
|
35186
|
-
// ../../
|
|
35132
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/parsers/chrome.mjs
|
|
35187
35133
|
var chromeRegexNoFnName = /^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i;
|
|
35188
35134
|
var chromeRegex = /^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i;
|
|
35189
35135
|
var chromeEvalRegex = /\((\S*)(?::(\d+))(?::(\d+))\)/;
|
|
@@ -35209,7 +35155,7 @@ var chromeStackLineParser = (line, platform) => {
|
|
|
35209
35155
|
}
|
|
35210
35156
|
};
|
|
35211
35157
|
|
|
35212
|
-
// ../../
|
|
35158
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/parsers/gecko.mjs
|
|
35213
35159
|
var geckoREgex = /^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i;
|
|
35214
35160
|
var geckoEvalRegex = /(\S+) line (\d+)(?: > eval line \d+)* > eval/i;
|
|
35215
35161
|
var geckoStackLineParser = (line, platform) => {
|
|
@@ -35232,14 +35178,14 @@ var geckoStackLineParser = (line, platform) => {
|
|
|
35232
35178
|
}
|
|
35233
35179
|
};
|
|
35234
35180
|
|
|
35235
|
-
// ../../
|
|
35181
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/parsers/winjs.mjs
|
|
35236
35182
|
var winjsRegex = /^\s*at (?:((?:\[object object\])?.+) )?\(?((?:[-a-z]+):.*?):(\d+)(?::(\d+))?\)?\s*$/i;
|
|
35237
35183
|
var winjsStackLineParser = (line, platform) => {
|
|
35238
35184
|
const parts = winjsRegex.exec(line);
|
|
35239
35185
|
return parts ? createFrame(platform, parts[2], parts[1] || UNKNOWN_FUNCTION, +parts[3], parts[4] ? +parts[4] : undefined) : undefined;
|
|
35240
35186
|
};
|
|
35241
35187
|
|
|
35242
|
-
// ../../
|
|
35188
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/parsers/opera.mjs
|
|
35243
35189
|
var opera10Regex = / line (\d+).*script (?:in )?(\S+)(?:: in function (\S+))?$/i;
|
|
35244
35190
|
var opera10StackLineParser = (line, platform) => {
|
|
35245
35191
|
const parts = opera10Regex.exec(line);
|
|
@@ -35251,7 +35197,7 @@ var opera11StackLineParser = (line, platform) => {
|
|
|
35251
35197
|
return parts ? createFrame(platform, parts[5], parts[3] || parts[4] || UNKNOWN_FUNCTION, +parts[1], +parts[2]) : undefined;
|
|
35252
35198
|
};
|
|
35253
35199
|
|
|
35254
|
-
// ../../
|
|
35200
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/parsers/node.mjs
|
|
35255
35201
|
var FILENAME_MATCH = /^\s*[-]{4,}$/;
|
|
35256
35202
|
var FULL_MATCH = /at (?:async )?(?:(.+?)\s+\()?(?:(.+):(\d+):(\d+)?|([^)]+))\)?/;
|
|
35257
35203
|
var nodeStackLineParser = (line, platform) => {
|
|
@@ -35320,7 +35266,7 @@ function _parseIntOrUndefined(input) {
|
|
|
35320
35266
|
return parseInt(input || "", 10) || undefined;
|
|
35321
35267
|
}
|
|
35322
35268
|
|
|
35323
|
-
// ../../
|
|
35269
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/parsers/index.mjs
|
|
35324
35270
|
var WEBPACK_ERROR_REGEXP = /\(error: (.*)\)/;
|
|
35325
35271
|
var STACKTRACE_FRAME_LIMIT = 50;
|
|
35326
35272
|
function reverseAndStripFrames(stack) {
|
|
@@ -35365,7 +35311,7 @@ function createStackParser(platform, ...parsers) {
|
|
|
35365
35311
|
return reverseAndStripFrames(frames);
|
|
35366
35312
|
};
|
|
35367
35313
|
}
|
|
35368
|
-
// ../../
|
|
35314
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/coercers/dom-exception-coercer.mjs
|
|
35369
35315
|
class DOMExceptionCoercer {
|
|
35370
35316
|
match(err) {
|
|
35371
35317
|
return this.isDOMException(err) || this.isDOMError(err);
|
|
@@ -35395,7 +35341,7 @@ class DOMExceptionCoercer {
|
|
|
35395
35341
|
return isBuiltin(err, "DOMError");
|
|
35396
35342
|
}
|
|
35397
35343
|
}
|
|
35398
|
-
// ../../
|
|
35344
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/coercers/error-coercer.mjs
|
|
35399
35345
|
class ErrorCoercer {
|
|
35400
35346
|
match(err) {
|
|
35401
35347
|
return isPlainError(err);
|
|
@@ -35422,7 +35368,7 @@ class ErrorCoercer {
|
|
|
35422
35368
|
return err.stacktrace || err.stack || undefined;
|
|
35423
35369
|
}
|
|
35424
35370
|
}
|
|
35425
|
-
// ../../
|
|
35371
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/coercers/error-event-coercer.mjs
|
|
35426
35372
|
class ErrorEventCoercer {
|
|
35427
35373
|
constructor() {}
|
|
35428
35374
|
match(err) {
|
|
@@ -35440,7 +35386,7 @@ class ErrorEventCoercer {
|
|
|
35440
35386
|
return exceptionLike;
|
|
35441
35387
|
}
|
|
35442
35388
|
}
|
|
35443
|
-
// ../../
|
|
35389
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/coercers/string-coercer.mjs
|
|
35444
35390
|
var ERROR_TYPES_PATTERN = /^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;
|
|
35445
35391
|
|
|
35446
35392
|
class StringCoercer {
|
|
@@ -35470,7 +35416,7 @@ class StringCoercer {
|
|
|
35470
35416
|
];
|
|
35471
35417
|
}
|
|
35472
35418
|
}
|
|
35473
|
-
// ../../
|
|
35419
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/types.mjs
|
|
35474
35420
|
var severityLevels = [
|
|
35475
35421
|
"fatal",
|
|
35476
35422
|
"error",
|
|
@@ -35480,7 +35426,7 @@ var severityLevels = [
|
|
|
35480
35426
|
"debug"
|
|
35481
35427
|
];
|
|
35482
35428
|
|
|
35483
|
-
// ../../
|
|
35429
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/coercers/utils.mjs
|
|
35484
35430
|
function extractExceptionKeysForMessage(err, maxLength = 40) {
|
|
35485
35431
|
const keys = Object.keys(err);
|
|
35486
35432
|
keys.sort();
|
|
@@ -35497,7 +35443,7 @@ function extractExceptionKeysForMessage(err, maxLength = 40) {
|
|
|
35497
35443
|
return "";
|
|
35498
35444
|
}
|
|
35499
35445
|
|
|
35500
|
-
// ../../
|
|
35446
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/coercers/object-coercer.mjs
|
|
35501
35447
|
class ObjectCoercer {
|
|
35502
35448
|
match(candidate) {
|
|
35503
35449
|
return typeof candidate == "object" && candidate !== null;
|
|
@@ -35550,7 +35496,7 @@ class ObjectCoercer {
|
|
|
35550
35496
|
}
|
|
35551
35497
|
}
|
|
35552
35498
|
}
|
|
35553
|
-
// ../../
|
|
35499
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/coercers/event-coercer.mjs
|
|
35554
35500
|
class EventCoercer {
|
|
35555
35501
|
match(err) {
|
|
35556
35502
|
return isEvent(err);
|
|
@@ -35565,7 +35511,7 @@ class EventCoercer {
|
|
|
35565
35511
|
};
|
|
35566
35512
|
}
|
|
35567
35513
|
}
|
|
35568
|
-
// ../../
|
|
35514
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/coercers/primitive-coercer.mjs
|
|
35569
35515
|
class PrimitiveCoercer {
|
|
35570
35516
|
match(candidate) {
|
|
35571
35517
|
return isPrimitive(candidate);
|
|
@@ -35579,7 +35525,7 @@ class PrimitiveCoercer {
|
|
|
35579
35525
|
};
|
|
35580
35526
|
}
|
|
35581
35527
|
}
|
|
35582
|
-
// ../../
|
|
35528
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/coercers/promise-rejection-event.mjs
|
|
35583
35529
|
class PromiseRejectionEventCoercer {
|
|
35584
35530
|
match(err) {
|
|
35585
35531
|
return isBuiltin(err, "PromiseRejectionEvent") || this.isCustomEventWrappingRejection(err);
|
|
@@ -35615,7 +35561,7 @@ class PromiseRejectionEventCoercer {
|
|
|
35615
35561
|
return error;
|
|
35616
35562
|
}
|
|
35617
35563
|
}
|
|
35618
|
-
// ../../
|
|
35564
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/utils.mjs
|
|
35619
35565
|
class ReduceableCache {
|
|
35620
35566
|
constructor(_maxSize) {
|
|
35621
35567
|
this._maxSize = _maxSize;
|
|
@@ -35640,7 +35586,7 @@ class ReduceableCache {
|
|
|
35640
35586
|
}
|
|
35641
35587
|
}
|
|
35642
35588
|
}
|
|
35643
|
-
// ../../
|
|
35589
|
+
// ../../switchroom-sec-1417/node_modules/.bun/posthog-node@5.29.2/node_modules/posthog-node/dist/extensions/error-tracking/modifiers/context-lines.node.mjs
|
|
35644
35590
|
import { createReadStream } from "node:fs";
|
|
35645
35591
|
import { createInterface } from "node:readline";
|
|
35646
35592
|
var LRU_FILE_CONTENTS_CACHE = new exports_error_tracking.ReduceableCache(25);
|
|
@@ -35858,7 +35804,7 @@ function snipLine(line, colno) {
|
|
|
35858
35804
|
return newLine;
|
|
35859
35805
|
}
|
|
35860
35806
|
|
|
35861
|
-
// ../../
|
|
35807
|
+
// ../../switchroom-sec-1417/node_modules/.bun/posthog-node@5.29.2/node_modules/posthog-node/dist/extensions/error-tracking/autocapture.mjs
|
|
35862
35808
|
function makeUncaughtExceptionHandler(captureFn, onFatalFn) {
|
|
35863
35809
|
let calledFatalError = false;
|
|
35864
35810
|
return Object.assign((error) => {
|
|
@@ -35890,7 +35836,7 @@ function addUnhandledRejectionListener(captureFn) {
|
|
|
35890
35836
|
}));
|
|
35891
35837
|
}
|
|
35892
35838
|
|
|
35893
|
-
// ../../
|
|
35839
|
+
// ../../switchroom-sec-1417/node_modules/.bun/posthog-node@5.29.2/node_modules/posthog-node/dist/extensions/error-tracking/index.mjs
|
|
35894
35840
|
var SHUTDOWN_TIMEOUT = 2000;
|
|
35895
35841
|
|
|
35896
35842
|
class ErrorTracking {
|
|
@@ -35959,10 +35905,10 @@ class ErrorTracking {
|
|
|
35959
35905
|
}
|
|
35960
35906
|
}
|
|
35961
35907
|
|
|
35962
|
-
// ../../
|
|
35908
|
+
// ../../switchroom-sec-1417/node_modules/.bun/posthog-node@5.29.2/node_modules/posthog-node/dist/version.mjs
|
|
35963
35909
|
var version = "5.29.2";
|
|
35964
35910
|
|
|
35965
|
-
// ../../
|
|
35911
|
+
// ../../switchroom-sec-1417/node_modules/.bun/posthog-node@5.29.2/node_modules/posthog-node/dist/types.mjs
|
|
35966
35912
|
var FeatureFlagError2 = {
|
|
35967
35913
|
ERRORS_WHILE_COMPUTING: "errors_while_computing_flags",
|
|
35968
35914
|
FLAG_MISSING: "flag_missing",
|
|
@@ -35970,7 +35916,7 @@ var FeatureFlagError2 = {
|
|
|
35970
35916
|
UNKNOWN_ERROR: "unknown_error"
|
|
35971
35917
|
};
|
|
35972
35918
|
|
|
35973
|
-
// ../../
|
|
35919
|
+
// ../../switchroom-sec-1417/node_modules/.bun/posthog-node@5.29.2/node_modules/posthog-node/dist/extensions/feature-flags/crypto.mjs
|
|
35974
35920
|
async function hashSHA1(text) {
|
|
35975
35921
|
const subtle = globalThis.crypto?.subtle;
|
|
35976
35922
|
if (!subtle)
|
|
@@ -35980,7 +35926,7 @@ async function hashSHA1(text) {
|
|
|
35980
35926
|
return hashArray.map((byte) => byte.toString(16).padStart(2, "0")).join("");
|
|
35981
35927
|
}
|
|
35982
35928
|
|
|
35983
|
-
// ../../
|
|
35929
|
+
// ../../switchroom-sec-1417/node_modules/.bun/posthog-node@5.29.2/node_modules/posthog-node/dist/extensions/feature-flags/feature-flags.mjs
|
|
35984
35930
|
var SIXTY_SECONDS = 60000;
|
|
35985
35931
|
var LONG_SCALE = 1152921504606847000;
|
|
35986
35932
|
var NULL_VALUES_ALLOWED_OPERATORS = [
|
|
@@ -36854,7 +36800,7 @@ function relativeDateParseForFeatureFlagMatching(value) {
|
|
|
36854
36800
|
}
|
|
36855
36801
|
}
|
|
36856
36802
|
|
|
36857
|
-
// ../../
|
|
36803
|
+
// ../../switchroom-sec-1417/node_modules/.bun/posthog-node@5.29.2/node_modules/posthog-node/dist/storage-memory.mjs
|
|
36858
36804
|
class PostHogMemoryStorage {
|
|
36859
36805
|
getProperty(key) {
|
|
36860
36806
|
return this._memoryStorage[key];
|
|
@@ -36867,7 +36813,7 @@ class PostHogMemoryStorage {
|
|
|
36867
36813
|
}
|
|
36868
36814
|
}
|
|
36869
36815
|
|
|
36870
|
-
// ../../
|
|
36816
|
+
// ../../switchroom-sec-1417/node_modules/.bun/posthog-node@5.29.2/node_modules/posthog-node/dist/client.mjs
|
|
36871
36817
|
var MINIMUM_POLLING_INTERVAL = 100;
|
|
36872
36818
|
var THIRTY_SECONDS = 30000;
|
|
36873
36819
|
var MAX_CACHE_SIZE = 50000;
|
|
@@ -37655,7 +37601,7 @@ class PostHogBackendClient extends PostHogCoreStateless {
|
|
|
37655
37601
|
}
|
|
37656
37602
|
}
|
|
37657
37603
|
|
|
37658
|
-
// ../../
|
|
37604
|
+
// ../../switchroom-sec-1417/node_modules/.bun/posthog-node@5.29.2/node_modules/posthog-node/dist/extensions/context/context.mjs
|
|
37659
37605
|
import { AsyncLocalStorage as AsyncLocalStorage2 } from "node:async_hooks";
|
|
37660
37606
|
|
|
37661
37607
|
class PostHogContext {
|
|
@@ -37686,7 +37632,7 @@ class PostHogContext {
|
|
|
37686
37632
|
}
|
|
37687
37633
|
}
|
|
37688
37634
|
|
|
37689
|
-
// ../../
|
|
37635
|
+
// ../../switchroom-sec-1417/node_modules/.bun/posthog-node@5.29.2/node_modules/posthog-node/dist/extensions/sentry-integration.mjs
|
|
37690
37636
|
var NAME = "posthog-node";
|
|
37691
37637
|
function createEventProcessor(_posthog, { organization, projectId, prefix, severityAllowList = [
|
|
37692
37638
|
"error"
|
|
@@ -37754,7 +37700,7 @@ class PostHogSentryIntegration {
|
|
|
37754
37700
|
};
|
|
37755
37701
|
}
|
|
37756
37702
|
}
|
|
37757
|
-
// ../../
|
|
37703
|
+
// ../../switchroom-sec-1417/node_modules/.bun/posthog-node@5.29.2/node_modules/posthog-node/dist/entrypoints/index.node.mjs
|
|
37758
37704
|
ErrorTracking.errorPropertiesBuilder = new exports_error_tracking.ErrorPropertiesBuilder([
|
|
37759
37705
|
new exports_error_tracking.EventCoercer,
|
|
37760
37706
|
new exports_error_tracking.ErrorCoercer,
|
|
@@ -44724,8 +44670,643 @@ function shouldSweepChatAtBoot(chatId) {
|
|
|
44724
44670
|
return n < 0;
|
|
44725
44671
|
}
|
|
44726
44672
|
|
|
44673
|
+
// gateway/webhook-ingest-server.ts
|
|
44674
|
+
import net4 from "node:net";
|
|
44675
|
+
import { chmodSync as chmodSync3, existsSync as existsSync21, unlinkSync as unlinkSync5 } from "node:fs";
|
|
44676
|
+
var MAX_REQUEST_BYTES = 1024 * 1024;
|
|
44677
|
+
function fdOf(conn) {
|
|
44678
|
+
const handle = conn._handle;
|
|
44679
|
+
if (!handle || typeof handle.fd !== "number" || handle.fd < 0)
|
|
44680
|
+
return null;
|
|
44681
|
+
return handle.fd;
|
|
44682
|
+
}
|
|
44683
|
+
function startWebhookIngestServer(opts) {
|
|
44684
|
+
const log = opts.log ?? ((s) => process.stderr.write(s));
|
|
44685
|
+
const allowed = new Set(opts.allowedUids);
|
|
44686
|
+
try {
|
|
44687
|
+
if (existsSync21(opts.socketPath))
|
|
44688
|
+
unlinkSync5(opts.socketPath);
|
|
44689
|
+
} catch (err) {
|
|
44690
|
+
log(`webhook-ingest-server: could not unlink stale socket: ${err.message}
|
|
44691
|
+
`);
|
|
44692
|
+
}
|
|
44693
|
+
const server = net4.createServer((conn) => {
|
|
44694
|
+
const fd = fdOf(conn);
|
|
44695
|
+
const cred = fd !== null ? getPeerCred(fd) : null;
|
|
44696
|
+
if (cred === null || !allowed.has(cred.uid)) {
|
|
44697
|
+
log(`webhook-ingest-server: DENY connection uid=${cred?.uid ?? "unknown"} ` + `(allowed=${[...allowed].join(",")})
|
|
44698
|
+
`);
|
|
44699
|
+
conn.destroy();
|
|
44700
|
+
return;
|
|
44701
|
+
}
|
|
44702
|
+
let buf = "";
|
|
44703
|
+
let handled = false;
|
|
44704
|
+
conn.setEncoding("utf8");
|
|
44705
|
+
const reply = (resp) => {
|
|
44706
|
+
if (handled)
|
|
44707
|
+
return;
|
|
44708
|
+
handled = true;
|
|
44709
|
+
try {
|
|
44710
|
+
conn.write(JSON.stringify(resp) + `
|
|
44711
|
+
`);
|
|
44712
|
+
} catch {}
|
|
44713
|
+
conn.end();
|
|
44714
|
+
};
|
|
44715
|
+
conn.on("data", (chunk) => {
|
|
44716
|
+
if (handled)
|
|
44717
|
+
return;
|
|
44718
|
+
buf += chunk;
|
|
44719
|
+
if (buf.length > MAX_REQUEST_BYTES) {
|
|
44720
|
+
reply({ status: "error", error: "request too large" });
|
|
44721
|
+
return;
|
|
44722
|
+
}
|
|
44723
|
+
const nl = buf.indexOf(`
|
|
44724
|
+
`);
|
|
44725
|
+
if (nl === -1)
|
|
44726
|
+
return;
|
|
44727
|
+
const line = buf.slice(0, nl);
|
|
44728
|
+
let req;
|
|
44729
|
+
try {
|
|
44730
|
+
req = JSON.parse(line);
|
|
44731
|
+
} catch {
|
|
44732
|
+
reply({ status: "error", error: "malformed request" });
|
|
44733
|
+
return;
|
|
44734
|
+
}
|
|
44735
|
+
if (!req || typeof req.agent !== "string" || typeof req.source !== "string" || typeof req.event_type !== "string" || typeof req.rendered_text !== "string" || typeof req.payload !== "object" || req.payload === null) {
|
|
44736
|
+
reply({ status: "error", error: "invalid request shape" });
|
|
44737
|
+
return;
|
|
44738
|
+
}
|
|
44739
|
+
Promise.resolve().then(() => opts.onRecord(req)).then((resp) => reply(resp)).catch((err) => {
|
|
44740
|
+
log(`webhook-ingest-server: onRecord threw: ${String(err)}
|
|
44741
|
+
`);
|
|
44742
|
+
reply({ status: "error", error: "internal error" });
|
|
44743
|
+
});
|
|
44744
|
+
});
|
|
44745
|
+
conn.on("error", (err) => {
|
|
44746
|
+
log(`webhook-ingest-server: conn error: ${err.message}
|
|
44747
|
+
`);
|
|
44748
|
+
});
|
|
44749
|
+
conn.setTimeout(1e4, () => {
|
|
44750
|
+
if (!handled)
|
|
44751
|
+
reply({ status: "error", error: "timeout" });
|
|
44752
|
+
conn.destroy();
|
|
44753
|
+
});
|
|
44754
|
+
});
|
|
44755
|
+
server.on("error", (err) => {
|
|
44756
|
+
log(`webhook-ingest-server: server error: ${err.message}
|
|
44757
|
+
`);
|
|
44758
|
+
});
|
|
44759
|
+
try {
|
|
44760
|
+
server.listen(opts.socketPath, () => {
|
|
44761
|
+
try {
|
|
44762
|
+
chmodSync3(opts.socketPath, 438);
|
|
44763
|
+
} catch (err) {
|
|
44764
|
+
log(`webhook-ingest-server: chmod failed: ${err.message}
|
|
44765
|
+
`);
|
|
44766
|
+
}
|
|
44767
|
+
log(`webhook-ingest-server: listening at ${opts.socketPath} ` + `(allowed uids: ${[...allowed].join(",")})
|
|
44768
|
+
`);
|
|
44769
|
+
});
|
|
44770
|
+
} catch (err) {
|
|
44771
|
+
log(`webhook-ingest-server: listen failed: ${err.message}
|
|
44772
|
+
`);
|
|
44773
|
+
}
|
|
44774
|
+
return {
|
|
44775
|
+
close: () => {
|
|
44776
|
+
try {
|
|
44777
|
+
server.close();
|
|
44778
|
+
} catch {}
|
|
44779
|
+
try {
|
|
44780
|
+
if (existsSync21(opts.socketPath))
|
|
44781
|
+
unlinkSync5(opts.socketPath);
|
|
44782
|
+
} catch {}
|
|
44783
|
+
}
|
|
44784
|
+
};
|
|
44785
|
+
}
|
|
44786
|
+
|
|
44787
|
+
// ../src/web/webhook-gateway-record.ts
|
|
44788
|
+
import { appendFileSync as appendFileSync4, mkdirSync as mkdirSync12 } from "fs";
|
|
44789
|
+
import { join as join20 } from "path";
|
|
44790
|
+
import { homedir as homedir10 } from "os";
|
|
44791
|
+
|
|
44792
|
+
// ../src/web/webhook-handler.ts
|
|
44793
|
+
import { appendFileSync as appendFileSync3, existsSync as existsSync22, mkdirSync as mkdirSync10, readFileSync as readFileSync16, writeFileSync as writeFileSync9 } from "fs";
|
|
44794
|
+
import { join as join18 } from "path";
|
|
44795
|
+
var DEDUP_MAX = 1000;
|
|
44796
|
+
var DEDUP_TTL_MS = 24 * 60 * 60 * 1000;
|
|
44797
|
+
function loadDedupFile(path) {
|
|
44798
|
+
try {
|
|
44799
|
+
if (!existsSync22(path))
|
|
44800
|
+
return {};
|
|
44801
|
+
const raw = JSON.parse(readFileSync16(path, "utf-8"));
|
|
44802
|
+
return typeof raw.deliveries === "object" && raw.deliveries !== null ? raw.deliveries : {};
|
|
44803
|
+
} catch {
|
|
44804
|
+
return {};
|
|
44805
|
+
}
|
|
44806
|
+
}
|
|
44807
|
+
function saveDedupFile(path, deliveries, now) {
|
|
44808
|
+
const pruned = {};
|
|
44809
|
+
for (const [id, ts] of Object.entries(deliveries)) {
|
|
44810
|
+
if (now - ts < DEDUP_TTL_MS)
|
|
44811
|
+
pruned[id] = ts;
|
|
44812
|
+
}
|
|
44813
|
+
const sorted = Object.entries(pruned).sort((a, b) => b[1] - a[1]).slice(0, DEDUP_MAX);
|
|
44814
|
+
const final = Object.fromEntries(sorted);
|
|
44815
|
+
writeFileSync9(path, JSON.stringify({ deliveries: final }), {
|
|
44816
|
+
mode: 384
|
|
44817
|
+
});
|
|
44818
|
+
}
|
|
44819
|
+
var agentDedupCache = new Map;
|
|
44820
|
+
function createFileDedupStore(resolveAgentDir) {
|
|
44821
|
+
return {
|
|
44822
|
+
check(agent, deliveryId, now) {
|
|
44823
|
+
const telegramDir = join18(resolveAgentDir(agent), "telegram");
|
|
44824
|
+
const filePath = join18(telegramDir, "webhook-dedup.json");
|
|
44825
|
+
if (!agentDedupCache.has(agent)) {
|
|
44826
|
+
agentDedupCache.set(agent, loadDedupFile(filePath));
|
|
44827
|
+
}
|
|
44828
|
+
const deliveries = agentDedupCache.get(agent);
|
|
44829
|
+
if (deliveries[deliveryId] !== undefined) {
|
|
44830
|
+
return deliveries[deliveryId];
|
|
44831
|
+
}
|
|
44832
|
+
deliveries[deliveryId] = now;
|
|
44833
|
+
try {
|
|
44834
|
+
mkdirSync10(telegramDir, { recursive: true });
|
|
44835
|
+
saveDedupFile(filePath, deliveries, now);
|
|
44836
|
+
} catch {}
|
|
44837
|
+
return;
|
|
44838
|
+
}
|
|
44839
|
+
};
|
|
44840
|
+
}
|
|
44841
|
+
var tokenBuckets = new Map;
|
|
44842
|
+
var throttleIssueWindow = new Map;
|
|
44843
|
+
|
|
44844
|
+
// ../src/web/webhook-dispatch.ts
|
|
44845
|
+
import { existsSync as existsSync23, mkdirSync as mkdirSync11, readFileSync as readFileSync17, writeFileSync as writeFileSync10 } from "fs";
|
|
44846
|
+
import { join as join19 } from "path";
|
|
44847
|
+
import { homedir as homedir9 } from "os";
|
|
44848
|
+
|
|
44849
|
+
// ../src/agent-scheduler/ipc-client.ts
|
|
44850
|
+
import { createConnection as createConnection2 } from "node:net";
|
|
44851
|
+
function createInjectIpcClient(options) {
|
|
44852
|
+
const {
|
|
44853
|
+
socketPath,
|
|
44854
|
+
reconnectDelayMs = 1000,
|
|
44855
|
+
maxReconnectDelayMs = 30000,
|
|
44856
|
+
connectTimeoutMs = 5000,
|
|
44857
|
+
log = () => {},
|
|
44858
|
+
_connect = (path) => createConnection2(path)
|
|
44859
|
+
} = options;
|
|
44860
|
+
let socket = null;
|
|
44861
|
+
let connected = false;
|
|
44862
|
+
let closed = false;
|
|
44863
|
+
let currentDelay = reconnectDelayMs;
|
|
44864
|
+
let reconnectTimer = null;
|
|
44865
|
+
let connectTimeoutTimer = null;
|
|
44866
|
+
function clearConnectTimeout() {
|
|
44867
|
+
if (connectTimeoutTimer !== null) {
|
|
44868
|
+
clearTimeout(connectTimeoutTimer);
|
|
44869
|
+
connectTimeoutTimer = null;
|
|
44870
|
+
}
|
|
44871
|
+
}
|
|
44872
|
+
function clearReconnectTimer() {
|
|
44873
|
+
if (reconnectTimer !== null) {
|
|
44874
|
+
clearTimeout(reconnectTimer);
|
|
44875
|
+
reconnectTimer = null;
|
|
44876
|
+
}
|
|
44877
|
+
}
|
|
44878
|
+
function scheduleReconnect() {
|
|
44879
|
+
if (closed)
|
|
44880
|
+
return;
|
|
44881
|
+
log(`scheduler ipc: reconnecting in ${currentDelay}ms`);
|
|
44882
|
+
reconnectTimer = setTimeout(() => {
|
|
44883
|
+
reconnectTimer = null;
|
|
44884
|
+
if (!closed)
|
|
44885
|
+
connect2();
|
|
44886
|
+
}, currentDelay);
|
|
44887
|
+
currentDelay = Math.min(currentDelay * 2, maxReconnectDelayMs);
|
|
44888
|
+
}
|
|
44889
|
+
function onClose() {
|
|
44890
|
+
clearConnectTimeout();
|
|
44891
|
+
connected = false;
|
|
44892
|
+
socket = null;
|
|
44893
|
+
if (!closed)
|
|
44894
|
+
scheduleReconnect();
|
|
44895
|
+
}
|
|
44896
|
+
function connect2() {
|
|
44897
|
+
if (closed)
|
|
44898
|
+
return;
|
|
44899
|
+
let s;
|
|
44900
|
+
try {
|
|
44901
|
+
s = _connect(socketPath);
|
|
44902
|
+
} catch (err) {
|
|
44903
|
+
log(`scheduler ipc: connect threw: ${err.message}`);
|
|
44904
|
+
scheduleReconnect();
|
|
44905
|
+
return;
|
|
44906
|
+
}
|
|
44907
|
+
socket = s;
|
|
44908
|
+
connectTimeoutTimer = setTimeout(() => {
|
|
44909
|
+
connectTimeoutTimer = null;
|
|
44910
|
+
if (!connected) {
|
|
44911
|
+
log(`scheduler ipc: connect timeout after ${connectTimeoutMs}ms`);
|
|
44912
|
+
try {
|
|
44913
|
+
s.destroy();
|
|
44914
|
+
} catch {}
|
|
44915
|
+
}
|
|
44916
|
+
}, connectTimeoutMs);
|
|
44917
|
+
s.on("connect", () => {
|
|
44918
|
+
clearConnectTimeout();
|
|
44919
|
+
connected = true;
|
|
44920
|
+
currentDelay = reconnectDelayMs;
|
|
44921
|
+
log(`scheduler ipc: connected to ${socketPath}`);
|
|
44922
|
+
});
|
|
44923
|
+
s.on("close", () => onClose());
|
|
44924
|
+
s.on("error", (err) => {
|
|
44925
|
+
log(`scheduler ipc: socket error: ${err.message}`);
|
|
44926
|
+
});
|
|
44927
|
+
s.on("data", () => {});
|
|
44928
|
+
}
|
|
44929
|
+
setImmediate(connect2);
|
|
44930
|
+
return {
|
|
44931
|
+
sendInjectInbound(msg) {
|
|
44932
|
+
if (!socket || !connected)
|
|
44933
|
+
return false;
|
|
44934
|
+
try {
|
|
44935
|
+
return socket.write(JSON.stringify(msg) + `
|
|
44936
|
+
`);
|
|
44937
|
+
} catch (err) {
|
|
44938
|
+
log(`scheduler ipc: write failed: ${err.message}`);
|
|
44939
|
+
return false;
|
|
44940
|
+
}
|
|
44941
|
+
},
|
|
44942
|
+
isConnected() {
|
|
44943
|
+
return connected;
|
|
44944
|
+
},
|
|
44945
|
+
waitForConnect(timeoutMs) {
|
|
44946
|
+
if (connected)
|
|
44947
|
+
return Promise.resolve(true);
|
|
44948
|
+
if (closed)
|
|
44949
|
+
return Promise.resolve(false);
|
|
44950
|
+
return new Promise((resolve6) => {
|
|
44951
|
+
const start = Date.now();
|
|
44952
|
+
const timer3 = setInterval(() => {
|
|
44953
|
+
if (connected) {
|
|
44954
|
+
clearInterval(timer3);
|
|
44955
|
+
resolve6(true);
|
|
44956
|
+
return;
|
|
44957
|
+
}
|
|
44958
|
+
if (closed || Date.now() - start >= timeoutMs) {
|
|
44959
|
+
clearInterval(timer3);
|
|
44960
|
+
resolve6(connected);
|
|
44961
|
+
}
|
|
44962
|
+
}, 50);
|
|
44963
|
+
if (typeof timer3.unref === "function") {
|
|
44964
|
+
timer3.unref();
|
|
44965
|
+
}
|
|
44966
|
+
});
|
|
44967
|
+
},
|
|
44968
|
+
close() {
|
|
44969
|
+
closed = true;
|
|
44970
|
+
clearReconnectTimer();
|
|
44971
|
+
clearConnectTimeout();
|
|
44972
|
+
if (socket) {
|
|
44973
|
+
try {
|
|
44974
|
+
socket.end();
|
|
44975
|
+
} catch {}
|
|
44976
|
+
socket = null;
|
|
44977
|
+
}
|
|
44978
|
+
connected = false;
|
|
44979
|
+
}
|
|
44980
|
+
};
|
|
44981
|
+
}
|
|
44982
|
+
|
|
44983
|
+
// ../src/web/webhook-dispatch.ts
|
|
44984
|
+
function renderTemplate(template, ctx) {
|
|
44985
|
+
return template.replace(/\{\{(\w+)\}\}/g, (_, key) => ctx[key] ?? "");
|
|
44986
|
+
}
|
|
44987
|
+
function buildGithubContext(eventType, payload) {
|
|
44988
|
+
const repo = payload.repository?.full_name ?? "";
|
|
44989
|
+
const pr = payload.pull_request;
|
|
44990
|
+
const issue = payload.issue;
|
|
44991
|
+
const obj = pr ?? issue;
|
|
44992
|
+
const number = String(payload.number ?? obj?.number ?? "");
|
|
44993
|
+
const firstCommit = payload.commits?.[0];
|
|
44994
|
+
const title = String(obj?.title ?? firstCommit?.message ?? "");
|
|
44995
|
+
const html_url = String(obj?.html_url ?? payload.html_url ?? "");
|
|
44996
|
+
const author = String(obj?.user?.login ?? payload.sender?.login ?? "");
|
|
44997
|
+
const rawLabels = obj?.labels ?? [];
|
|
44998
|
+
const labels = rawLabels.map((l) => String(l.name ?? "")).join(", ");
|
|
44999
|
+
const action = String(payload.action ?? "");
|
|
45000
|
+
return { repo, number, title, html_url, author, labels, action, event: eventType };
|
|
45001
|
+
}
|
|
45002
|
+
function matchesRule(eventType, payload, matcher) {
|
|
45003
|
+
if (matcher.event !== eventType)
|
|
45004
|
+
return false;
|
|
45005
|
+
const ctx = buildGithubContext(eventType, payload);
|
|
45006
|
+
if (matcher.actions && matcher.actions.length > 0) {
|
|
45007
|
+
if (!matcher.actions.includes(ctx.action))
|
|
45008
|
+
return false;
|
|
45009
|
+
}
|
|
45010
|
+
if (matcher.exclude_authors && matcher.exclude_authors.length > 0) {
|
|
45011
|
+
if (matcher.exclude_authors.includes(ctx.author))
|
|
45012
|
+
return false;
|
|
45013
|
+
}
|
|
45014
|
+
if (matcher.labels_any && matcher.labels_any.length > 0) {
|
|
45015
|
+
const pr = payload.pull_request;
|
|
45016
|
+
const issue = payload.issue;
|
|
45017
|
+
const rawLabels = (pr ?? issue)?.labels ?? [];
|
|
45018
|
+
const labelNames = new Set(rawLabels.map((l) => String(l.name ?? "")));
|
|
45019
|
+
const hasAny = matcher.labels_any.some((l) => labelNames.has(l));
|
|
45020
|
+
if (!hasAny)
|
|
45021
|
+
return false;
|
|
45022
|
+
}
|
|
45023
|
+
if (matcher.labels_all && matcher.labels_all.length > 0) {
|
|
45024
|
+
const pr = payload.pull_request;
|
|
45025
|
+
const issue = payload.issue;
|
|
45026
|
+
const rawLabels = (pr ?? issue)?.labels ?? [];
|
|
45027
|
+
const labelNames = new Set(rawLabels.map((l) => String(l.name ?? "")));
|
|
45028
|
+
const hasAll = matcher.labels_all.every((l) => labelNames.has(l));
|
|
45029
|
+
if (!hasAll)
|
|
45030
|
+
return false;
|
|
45031
|
+
}
|
|
45032
|
+
return true;
|
|
45033
|
+
}
|
|
45034
|
+
function parseDurationMs(d) {
|
|
45035
|
+
const m = d.trim().match(/^(\d+)(s|m|h|d)?$/);
|
|
45036
|
+
if (!m)
|
|
45037
|
+
return 0;
|
|
45038
|
+
const n = parseInt(m[1], 10);
|
|
45039
|
+
switch (m[2]) {
|
|
45040
|
+
case "s":
|
|
45041
|
+
return n * 1000;
|
|
45042
|
+
case "m":
|
|
45043
|
+
return n * 60000;
|
|
45044
|
+
case "h":
|
|
45045
|
+
return n * 3600000;
|
|
45046
|
+
case "d":
|
|
45047
|
+
return n * 86400000;
|
|
45048
|
+
default:
|
|
45049
|
+
return n;
|
|
45050
|
+
}
|
|
45051
|
+
}
|
|
45052
|
+
function cooldownKey(eventType, repo, number, ruleIndex) {
|
|
45053
|
+
return `${eventType}:${repo}:${number}:${ruleIndex}`;
|
|
45054
|
+
}
|
|
45055
|
+
function loadCooldownFile(path) {
|
|
45056
|
+
try {
|
|
45057
|
+
if (!existsSync23(path))
|
|
45058
|
+
return {};
|
|
45059
|
+
const raw = JSON.parse(readFileSync17(path, "utf-8"));
|
|
45060
|
+
return typeof raw.dispatches === "object" && raw.dispatches !== null ? raw.dispatches : {};
|
|
45061
|
+
} catch {
|
|
45062
|
+
return {};
|
|
45063
|
+
}
|
|
45064
|
+
}
|
|
45065
|
+
function saveCooldownFile(path, dispatches) {
|
|
45066
|
+
try {
|
|
45067
|
+
writeFileSync10(path, JSON.stringify({ dispatches }), {
|
|
45068
|
+
mode: 384
|
|
45069
|
+
});
|
|
45070
|
+
} catch {}
|
|
45071
|
+
}
|
|
45072
|
+
function createFileCooldownStore(resolveAgentDir) {
|
|
45073
|
+
const cache = new Map;
|
|
45074
|
+
return {
|
|
45075
|
+
isCoolingDown(agent, key, cooldownMs, now) {
|
|
45076
|
+
if (cooldownMs <= 0)
|
|
45077
|
+
return false;
|
|
45078
|
+
const telegramDir = join19(resolveAgentDir(agent), "telegram");
|
|
45079
|
+
const filePath = join19(telegramDir, "webhook-cooldown.json");
|
|
45080
|
+
if (!cache.has(agent)) {
|
|
45081
|
+
cache.set(agent, loadCooldownFile(filePath));
|
|
45082
|
+
}
|
|
45083
|
+
const dispatches = cache.get(agent);
|
|
45084
|
+
const lastDispatch = dispatches[key];
|
|
45085
|
+
if (lastDispatch !== undefined && now - lastDispatch < cooldownMs) {
|
|
45086
|
+
return true;
|
|
45087
|
+
}
|
|
45088
|
+
dispatches[key] = now;
|
|
45089
|
+
try {
|
|
45090
|
+
mkdirSync11(telegramDir, { recursive: true });
|
|
45091
|
+
saveCooldownFile(filePath, dispatches);
|
|
45092
|
+
} catch {}
|
|
45093
|
+
return false;
|
|
45094
|
+
}
|
|
45095
|
+
};
|
|
45096
|
+
}
|
|
45097
|
+
function isQuietHour(qh, now) {
|
|
45098
|
+
const tz = qh.tz ?? "UTC";
|
|
45099
|
+
let hour;
|
|
45100
|
+
try {
|
|
45101
|
+
const formatter = new Intl.DateTimeFormat("en-US", {
|
|
45102
|
+
timeZone: tz,
|
|
45103
|
+
hour: "numeric",
|
|
45104
|
+
hour12: false
|
|
45105
|
+
});
|
|
45106
|
+
const parts = formatter.formatToParts(now);
|
|
45107
|
+
const hourPart = parts.find((p) => p.type === "hour");
|
|
45108
|
+
hour = parseInt(hourPart?.value ?? "0", 10);
|
|
45109
|
+
} catch {
|
|
45110
|
+
hour = now.getUTCHours();
|
|
45111
|
+
}
|
|
45112
|
+
const { start, end } = qh;
|
|
45113
|
+
if (start < end) {
|
|
45114
|
+
return hour >= start && hour < end;
|
|
45115
|
+
} else {
|
|
45116
|
+
return hour >= start || hour < end;
|
|
45117
|
+
}
|
|
45118
|
+
}
|
|
45119
|
+
async function defaultInject(socketPath, agentName3, inbound) {
|
|
45120
|
+
const client3 = createInjectIpcClient({ socketPath });
|
|
45121
|
+
try {
|
|
45122
|
+
const connected = await client3.waitForConnect(5000);
|
|
45123
|
+
if (!connected)
|
|
45124
|
+
return false;
|
|
45125
|
+
return client3.sendInjectInbound({
|
|
45126
|
+
type: "inject_inbound",
|
|
45127
|
+
agentName: agentName3,
|
|
45128
|
+
inbound
|
|
45129
|
+
});
|
|
45130
|
+
} finally {
|
|
45131
|
+
client3.close();
|
|
45132
|
+
}
|
|
45133
|
+
}
|
|
45134
|
+
function injectWebhookInbound(agent, prompt, ctx, deps = {}) {
|
|
45135
|
+
const log = deps.log ?? ((s) => process.stderr.write(s));
|
|
45136
|
+
const resolveAgentDir = deps.resolveAgentDir ?? ((a) => join19(homedir9(), ".switchroom", "agents", a));
|
|
45137
|
+
const now = (deps.now ?? Date.now)();
|
|
45138
|
+
const socketPath = join19(resolveAgentDir(agent), "telegram", "gateway.sock");
|
|
45139
|
+
const inbound = {
|
|
45140
|
+
type: "inbound",
|
|
45141
|
+
chatId: ctx.chatId,
|
|
45142
|
+
...ctx.threadId !== undefined ? { threadId: ctx.threadId } : {},
|
|
45143
|
+
messageId: now,
|
|
45144
|
+
user: "webhook",
|
|
45145
|
+
userId: 0,
|
|
45146
|
+
ts: now,
|
|
45147
|
+
text: prompt,
|
|
45148
|
+
meta: {
|
|
45149
|
+
source: "webhook",
|
|
45150
|
+
event: ctx.eventType,
|
|
45151
|
+
rule_index: String(ctx.ruleIndex)
|
|
45152
|
+
}
|
|
45153
|
+
};
|
|
45154
|
+
const injectFn = deps.injectFn ?? defaultInject;
|
|
45155
|
+
injectFn(socketPath, agent, inbound).then((ok) => log(`webhook-dispatch: agent='${agent}' inject_inbound ` + `${ok ? "delivered to gateway" : "not delivered (gateway not connected)"}
|
|
45156
|
+
`)).catch((err) => log(`webhook-dispatch: agent='${agent}' inject failed: ${String(err)}
|
|
45157
|
+
`));
|
|
45158
|
+
}
|
|
45159
|
+
function evaluateDispatch(args, deps = {}) {
|
|
45160
|
+
const log = deps.log ?? ((s) => process.stderr.write(s));
|
|
45161
|
+
const now = (deps.now ?? Date.now)();
|
|
45162
|
+
const nowDate = deps.nowDate ?? (() => new Date(now));
|
|
45163
|
+
const resolveAgentDir = deps.resolveAgentDir ?? ((a) => join19(homedir9(), ".switchroom", "agents", a));
|
|
45164
|
+
const cooldownStore = deps.cooldownStore ?? createFileCooldownStore(resolveAgentDir);
|
|
45165
|
+
if (args.source !== "github")
|
|
45166
|
+
return 0;
|
|
45167
|
+
const rules = args.dispatchConfig.github;
|
|
45168
|
+
if (!rules || rules.length === 0)
|
|
45169
|
+
return 0;
|
|
45170
|
+
const ctx = buildGithubContext(args.eventType, args.payload);
|
|
45171
|
+
let fired = 0;
|
|
45172
|
+
for (let i = 0;i < rules.length; i++) {
|
|
45173
|
+
const rule = rules[i];
|
|
45174
|
+
if (!matchesRule(args.eventType, args.payload, rule.match))
|
|
45175
|
+
continue;
|
|
45176
|
+
if (rule.quiet_hours && isQuietHour(rule.quiet_hours, nowDate())) {
|
|
45177
|
+
log(`webhook-dispatch: agent='${args.agent}' rule=${i} skipped (quiet hours)
|
|
45178
|
+
`);
|
|
45179
|
+
continue;
|
|
45180
|
+
}
|
|
45181
|
+
const cooldownMs = rule.cooldown ? parseDurationMs(rule.cooldown) : 0;
|
|
45182
|
+
if (cooldownMs > 0) {
|
|
45183
|
+
const ck = cooldownKey(args.eventType, ctx.repo, ctx.number, i);
|
|
45184
|
+
if (cooldownStore.isCoolingDown(args.agent, ck, cooldownMs, now)) {
|
|
45185
|
+
log(`webhook-dispatch: agent='${args.agent}' rule=${i} skipped (cooldown)
|
|
45186
|
+
`);
|
|
45187
|
+
continue;
|
|
45188
|
+
}
|
|
45189
|
+
}
|
|
45190
|
+
const prompt = renderTemplate(rule.prompt, ctx);
|
|
45191
|
+
log(`webhook-dispatch: agent='${args.agent}' rule=${i} matched event='${args.eventType}' action='${ctx.action}' firing
|
|
45192
|
+
`);
|
|
45193
|
+
injectWebhookInbound(args.agent, prompt, {
|
|
45194
|
+
chatId: args.chatId,
|
|
45195
|
+
...args.threadId !== undefined ? { threadId: args.threadId } : {},
|
|
45196
|
+
eventType: args.eventType,
|
|
45197
|
+
ruleIndex: i
|
|
45198
|
+
}, { ...deps, resolveAgentDir });
|
|
45199
|
+
fired++;
|
|
45200
|
+
}
|
|
45201
|
+
return fired;
|
|
45202
|
+
}
|
|
45203
|
+
|
|
45204
|
+
// ../src/web/webhook-gateway-record.ts
|
|
45205
|
+
init_loader();
|
|
45206
|
+
init_merge();
|
|
45207
|
+
|
|
45208
|
+
// ../src/agent-scheduler/channel-target.ts
|
|
45209
|
+
init_merge();
|
|
45210
|
+
function resolveChannelTarget(config, agentName3) {
|
|
45211
|
+
const agent = config.agents?.[agentName3];
|
|
45212
|
+
const tgChannel = agent ? resolveAgentConfig(config.defaults, config.profiles, agent).channels?.telegram : undefined;
|
|
45213
|
+
const supergroupChatId = tgChannel?.chat_id;
|
|
45214
|
+
const supergroupDefaultTopic = tgChannel?.default_topic_id;
|
|
45215
|
+
if (typeof supergroupChatId === "string" && supergroupChatId.length > 0) {
|
|
45216
|
+
return {
|
|
45217
|
+
chatId: supergroupChatId,
|
|
45218
|
+
...typeof supergroupDefaultTopic === "number" ? { threadId: supergroupDefaultTopic } : {},
|
|
45219
|
+
routerConfig: {
|
|
45220
|
+
...typeof supergroupDefaultTopic === "number" ? { default_topic_id: supergroupDefaultTopic } : {},
|
|
45221
|
+
...tgChannel?.topic_aliases ? { topic_aliases: tgChannel.topic_aliases } : {}
|
|
45222
|
+
}
|
|
45223
|
+
};
|
|
45224
|
+
}
|
|
45225
|
+
const forumChatId = config.telegram?.forum_chat_id;
|
|
45226
|
+
if (typeof forumChatId !== "string" || forumChatId.length === 0)
|
|
45227
|
+
return null;
|
|
45228
|
+
const threadId = agent?.topic_id;
|
|
45229
|
+
return {
|
|
45230
|
+
chatId: forumChatId,
|
|
45231
|
+
...typeof threadId === "number" ? { threadId } : {}
|
|
45232
|
+
};
|
|
45233
|
+
}
|
|
45234
|
+
|
|
45235
|
+
// ../src/web/webhook-gateway-record.ts
|
|
45236
|
+
function recordWebhookEvent(rec, deps = {}) {
|
|
45237
|
+
const log = deps.log ?? ((s) => process.stderr.write(s));
|
|
45238
|
+
const now = rec.ts || (deps.now ?? Date.now)();
|
|
45239
|
+
const resolveAgentDir = deps.resolveAgentDir ?? ((a) => join20(homedir10(), ".switchroom", "agents", a));
|
|
45240
|
+
const dedupStore = deps.dedupStore ?? createFileDedupStore(resolveAgentDir);
|
|
45241
|
+
const agent = rec.agent;
|
|
45242
|
+
const telegramDir = join20(resolveAgentDir(agent), "telegram");
|
|
45243
|
+
if (rec.source === "github" && rec.delivery_id) {
|
|
45244
|
+
const originalTs = dedupStore.check(agent, rec.delivery_id, now);
|
|
45245
|
+
if (originalTs !== undefined) {
|
|
45246
|
+
log(`webhook-gateway: agent='${agent}' source='${rec.source}' deduped delivery='${rec.delivery_id}'
|
|
45247
|
+
`);
|
|
45248
|
+
return { status: "deduped", ts: originalTs };
|
|
45249
|
+
}
|
|
45250
|
+
}
|
|
45251
|
+
const logPath = join20(telegramDir, "webhook-events.jsonl");
|
|
45252
|
+
try {
|
|
45253
|
+
mkdirSync12(telegramDir, { recursive: true });
|
|
45254
|
+
const record = {
|
|
45255
|
+
ts: now,
|
|
45256
|
+
source: rec.source,
|
|
45257
|
+
event_type: rec.event_type,
|
|
45258
|
+
rendered_text: rec.rendered_text,
|
|
45259
|
+
payload: rec.payload
|
|
45260
|
+
};
|
|
45261
|
+
appendFileSync4(logPath, JSON.stringify(record) + `
|
|
45262
|
+
`, { mode: 384 });
|
|
45263
|
+
} catch (err) {
|
|
45264
|
+
log(`webhook-gateway: agent='${agent}' source='${rec.source}' write failed: ${err.message}
|
|
45265
|
+
`);
|
|
45266
|
+
return { status: "error", error: "write failed" };
|
|
45267
|
+
}
|
|
45268
|
+
log(`webhook-gateway: agent='${agent}' source='${rec.source}' event='${rec.event_type}' recorded ts=${now}
|
|
45269
|
+
`);
|
|
45270
|
+
let dispatched = 0;
|
|
45271
|
+
try {
|
|
45272
|
+
const config = (deps.loadConfig ?? loadConfig)();
|
|
45273
|
+
const rawAgent = config.agents?.[agent];
|
|
45274
|
+
const dispatchConfig = rawAgent ? resolveAgentConfig(config.defaults, config.profiles, rawAgent).channels?.telegram?.webhook_dispatch : undefined;
|
|
45275
|
+
if (dispatchConfig && rec.source === "github") {
|
|
45276
|
+
const target = resolveChannelTarget(config, agent);
|
|
45277
|
+
if (!target) {
|
|
45278
|
+
log(`webhook-gateway: agent='${agent}' dispatch skipped \u2014 no chat target (forum_chat_id / chat_id unset)
|
|
45279
|
+
`);
|
|
45280
|
+
} else {
|
|
45281
|
+
const injectFn = deps.inject;
|
|
45282
|
+
dispatched = evaluateDispatch({
|
|
45283
|
+
agent,
|
|
45284
|
+
source: rec.source,
|
|
45285
|
+
eventType: rec.event_type,
|
|
45286
|
+
payload: rec.payload,
|
|
45287
|
+
dispatchConfig,
|
|
45288
|
+
chatId: target.chatId,
|
|
45289
|
+
...target.threadId !== undefined ? { threadId: target.threadId } : {}
|
|
45290
|
+
}, {
|
|
45291
|
+
now: () => now,
|
|
45292
|
+
resolveAgentDir,
|
|
45293
|
+
log,
|
|
45294
|
+
...deps.cooldownStore ? { cooldownStore: deps.cooldownStore } : {},
|
|
45295
|
+
...injectFn ? {
|
|
45296
|
+
injectFn: async (_socketPath, agentName3, inbound) => injectFn(agentName3, inbound)
|
|
45297
|
+
} : {}
|
|
45298
|
+
});
|
|
45299
|
+
}
|
|
45300
|
+
}
|
|
45301
|
+
} catch (err) {
|
|
45302
|
+
log(`webhook-gateway: agent='${agent}' dispatch error (event recorded): ${err.message}
|
|
45303
|
+
`);
|
|
45304
|
+
}
|
|
45305
|
+
return { status: "ok", ts: now, dispatched };
|
|
45306
|
+
}
|
|
45307
|
+
|
|
44727
45308
|
// gateway/ipc-server.ts
|
|
44728
|
-
import { renameSync as renameSync5, unlinkSync as
|
|
45309
|
+
import { renameSync as renameSync5, unlinkSync as unlinkSync6 } from "fs";
|
|
44729
45310
|
var MAX_BUFFER_SIZE = 1024 * 1024;
|
|
44730
45311
|
var VALID_OPERATOR_KINDS = new Set([
|
|
44731
45312
|
"credentials-expired",
|
|
@@ -44843,7 +45424,7 @@ function createIpcServer(options) {
|
|
|
44843
45424
|
renameSync5(socketPath, socketPath + ".bak");
|
|
44844
45425
|
} catch {}
|
|
44845
45426
|
try {
|
|
44846
|
-
|
|
45427
|
+
unlinkSync6(socketPath + ".bak");
|
|
44847
45428
|
} catch {}
|
|
44848
45429
|
const clients = new Set;
|
|
44849
45430
|
const agentIndex = new Map;
|
|
@@ -46913,15 +47494,15 @@ function escapeBody(s) {
|
|
|
46913
47494
|
}
|
|
46914
47495
|
|
|
46915
47496
|
// gateway/pid-file.ts
|
|
46916
|
-
import { writeFileSync as
|
|
47497
|
+
import { writeFileSync as writeFileSync11, readFileSync as readFileSync18, unlinkSync as unlinkSync7, renameSync as renameSync6 } from "node:fs";
|
|
46917
47498
|
function writePidFile(path, record) {
|
|
46918
47499
|
const tmp = `${path}.tmp-${process.pid}-${Date.now()}`;
|
|
46919
|
-
|
|
47500
|
+
writeFileSync11(tmp, JSON.stringify(record), "utf-8");
|
|
46920
47501
|
renameSync6(tmp, path);
|
|
46921
47502
|
}
|
|
46922
47503
|
function clearPidFile(path) {
|
|
46923
47504
|
try {
|
|
46924
|
-
|
|
47505
|
+
unlinkSync7(path);
|
|
46925
47506
|
} catch {}
|
|
46926
47507
|
}
|
|
46927
47508
|
|
|
@@ -46932,10 +47513,10 @@ import {
|
|
|
46932
47513
|
writeFile as writeFileAsync,
|
|
46933
47514
|
readFile as readFileAsync
|
|
46934
47515
|
} from "node:fs/promises";
|
|
46935
|
-
import { readFileSync as
|
|
47516
|
+
import { readFileSync as readFileSync19 } from "node:fs";
|
|
46936
47517
|
function readCurrentBootId() {
|
|
46937
47518
|
try {
|
|
46938
|
-
const stat =
|
|
47519
|
+
const stat = readFileSync19("/proc/1/stat", "utf-8");
|
|
46939
47520
|
const lastParen = stat.lastIndexOf(")");
|
|
46940
47521
|
if (lastParen < 0)
|
|
46941
47522
|
return null;
|
|
@@ -47138,15 +47719,15 @@ function safeCount(fn) {
|
|
|
47138
47719
|
}
|
|
47139
47720
|
|
|
47140
47721
|
// gateway/session-marker.ts
|
|
47141
|
-
import { writeFileSync as
|
|
47722
|
+
import { writeFileSync as writeFileSync12, readFileSync as readFileSync20, renameSync as renameSync7, unlinkSync as unlinkSync8 } from "node:fs";
|
|
47142
47723
|
function writeSessionMarker(path, marker) {
|
|
47143
47724
|
const tmp = `${path}.tmp-${process.pid}-${Date.now()}`;
|
|
47144
|
-
|
|
47725
|
+
writeFileSync12(tmp, JSON.stringify(marker), "utf-8");
|
|
47145
47726
|
renameSync7(tmp, path);
|
|
47146
47727
|
}
|
|
47147
47728
|
function readSessionMarker(path) {
|
|
47148
47729
|
try {
|
|
47149
|
-
const raw =
|
|
47730
|
+
const raw = readFileSync20(path, "utf-8");
|
|
47150
47731
|
const parsed = JSON.parse(raw);
|
|
47151
47732
|
if (typeof parsed.pid === "number" && typeof parsed.startedAtMs === "number" && Number.isFinite(parsed.pid) && Number.isFinite(parsed.startedAtMs)) {
|
|
47152
47733
|
return { pid: parsed.pid, startedAtMs: parsed.startedAtMs };
|
|
@@ -47168,16 +47749,16 @@ function shouldFireRestartBanner(input) {
|
|
|
47168
47749
|
}
|
|
47169
47750
|
|
|
47170
47751
|
// gateway/clean-shutdown-marker.ts
|
|
47171
|
-
import { writeFileSync as
|
|
47752
|
+
import { writeFileSync as writeFileSync13, readFileSync as readFileSync21, renameSync as renameSync8, unlinkSync as unlinkSync9 } from "node:fs";
|
|
47172
47753
|
var DEFAULT_MAX_AGE_MS = 60000;
|
|
47173
47754
|
function writeCleanShutdownMarker(path, marker) {
|
|
47174
47755
|
const tmp = `${path}.tmp-${process.pid}-${Date.now()}`;
|
|
47175
|
-
|
|
47756
|
+
writeFileSync13(tmp, JSON.stringify(marker), "utf-8");
|
|
47176
47757
|
renameSync8(tmp, path);
|
|
47177
47758
|
}
|
|
47178
47759
|
function readCleanShutdownMarker(path) {
|
|
47179
47760
|
try {
|
|
47180
|
-
const raw =
|
|
47761
|
+
const raw = readFileSync21(path, "utf-8");
|
|
47181
47762
|
const parsed = JSON.parse(raw);
|
|
47182
47763
|
if (typeof parsed.ts === "number" && Number.isFinite(parsed.ts) && typeof parsed.signal === "string" && parsed.signal.length > 0) {
|
|
47183
47764
|
const out = { ts: parsed.ts, signal: parsed.signal };
|
|
@@ -47192,7 +47773,7 @@ function readCleanShutdownMarker(path) {
|
|
|
47192
47773
|
}
|
|
47193
47774
|
function clearCleanShutdownMarker(path) {
|
|
47194
47775
|
try {
|
|
47195
|
-
|
|
47776
|
+
unlinkSync9(path);
|
|
47196
47777
|
} catch {}
|
|
47197
47778
|
}
|
|
47198
47779
|
function shouldSuppressRecoveryBanner(marker, now, maxAgeMs = DEFAULT_MAX_AGE_MS) {
|
|
@@ -47972,16 +48553,16 @@ function classifyAdminGate(text, myAgentName) {
|
|
|
47972
48553
|
|
|
47973
48554
|
// subagent-watcher.ts
|
|
47974
48555
|
import {
|
|
47975
|
-
existsSync as
|
|
48556
|
+
existsSync as existsSync25,
|
|
47976
48557
|
openSync as openSync2,
|
|
47977
48558
|
readSync,
|
|
47978
48559
|
statSync as statSync6,
|
|
47979
48560
|
closeSync as closeSync2,
|
|
47980
48561
|
watch,
|
|
47981
48562
|
readdirSync as readdirSync3,
|
|
47982
|
-
readFileSync as
|
|
48563
|
+
readFileSync as readFileSync23
|
|
47983
48564
|
} from "fs";
|
|
47984
|
-
import { join as
|
|
48565
|
+
import { join as join22 } from "path";
|
|
47985
48566
|
|
|
47986
48567
|
// operator-events.ts
|
|
47987
48568
|
var DEFAULT_OPERATOR_EVENT_COOLDOWN_MS2 = 5 * 60000;
|
|
@@ -48224,20 +48805,20 @@ function bumpSubagentActivity(db2, args) {
|
|
|
48224
48805
|
// gateway/turn-active-marker.ts
|
|
48225
48806
|
import {
|
|
48226
48807
|
closeSync,
|
|
48227
|
-
existsSync as
|
|
48228
|
-
mkdirSync as
|
|
48808
|
+
existsSync as existsSync24,
|
|
48809
|
+
mkdirSync as mkdirSync13,
|
|
48229
48810
|
openSync,
|
|
48230
|
-
readFileSync as
|
|
48811
|
+
readFileSync as readFileSync22,
|
|
48231
48812
|
statSync as statSync5,
|
|
48232
|
-
unlinkSync as
|
|
48813
|
+
unlinkSync as unlinkSync10,
|
|
48233
48814
|
utimesSync,
|
|
48234
|
-
writeFileSync as
|
|
48815
|
+
writeFileSync as writeFileSync14
|
|
48235
48816
|
} from "node:fs";
|
|
48236
|
-
import { join as
|
|
48817
|
+
import { join as join21 } from "node:path";
|
|
48237
48818
|
var TURN_ACTIVE_MARKER_FILE = "turn-active.json";
|
|
48238
48819
|
function touchTurnActiveMarker(stateDir) {
|
|
48239
|
-
const path =
|
|
48240
|
-
if (!
|
|
48820
|
+
const path = join21(stateDir, TURN_ACTIVE_MARKER_FILE);
|
|
48821
|
+
if (!existsSync24(path))
|
|
48241
48822
|
return;
|
|
48242
48823
|
const now = new Date;
|
|
48243
48824
|
try {
|
|
@@ -48272,7 +48853,7 @@ function backfillJsonlAgentId(db2, jsonlPath, agentId, log) {
|
|
|
48272
48853
|
const metaPath = jsonlPath.replace(/\.jsonl$/, ".meta.json");
|
|
48273
48854
|
let meta;
|
|
48274
48855
|
try {
|
|
48275
|
-
const raw =
|
|
48856
|
+
const raw = readFileSync23(metaPath, "utf8");
|
|
48276
48857
|
meta = JSON.parse(raw);
|
|
48277
48858
|
} catch {
|
|
48278
48859
|
log?.(`subagent-watcher: backfill skip ${agentId} \u2014 meta.json not readable at ${metaPath}`);
|
|
@@ -48459,7 +49040,7 @@ function startSubagentWatcher(config) {
|
|
|
48459
49040
|
clearTimeout(ref.ref);
|
|
48460
49041
|
});
|
|
48461
49042
|
const fs2 = config.fs ?? {
|
|
48462
|
-
existsSync:
|
|
49043
|
+
existsSync: existsSync25,
|
|
48463
49044
|
readdirSync: readdirSync3,
|
|
48464
49045
|
statSync: statSync6,
|
|
48465
49046
|
openSync: openSync2,
|
|
@@ -48693,8 +49274,8 @@ function startSubagentWatcher(config) {
|
|
|
48693
49274
|
function rescanSubagentDirs() {
|
|
48694
49275
|
if (stopped)
|
|
48695
49276
|
return;
|
|
48696
|
-
const claudeHome =
|
|
48697
|
-
const projectsRoot =
|
|
49277
|
+
const claudeHome = join22(agentDir, ".claude");
|
|
49278
|
+
const projectsRoot = join22(claudeHome, "projects");
|
|
48698
49279
|
if (!fs2.existsSync(projectsRoot))
|
|
48699
49280
|
return;
|
|
48700
49281
|
let projectDirs;
|
|
@@ -48711,7 +49292,7 @@ function startSubagentWatcher(config) {
|
|
|
48711
49292
|
}
|
|
48712
49293
|
continue;
|
|
48713
49294
|
}
|
|
48714
|
-
const projectPath =
|
|
49295
|
+
const projectPath = join22(projectsRoot, pDir);
|
|
48715
49296
|
let sessionDirs;
|
|
48716
49297
|
try {
|
|
48717
49298
|
sessionDirs = fs2.readdirSync(projectPath);
|
|
@@ -48721,7 +49302,7 @@ function startSubagentWatcher(config) {
|
|
|
48721
49302
|
for (const sDir of sessionDirs) {
|
|
48722
49303
|
if (sDir.endsWith(".jsonl"))
|
|
48723
49304
|
continue;
|
|
48724
|
-
const subagentsPath =
|
|
49305
|
+
const subagentsPath = join22(projectPath, sDir, "subagents");
|
|
48725
49306
|
if (!fs2.existsSync(subagentsPath))
|
|
48726
49307
|
continue;
|
|
48727
49308
|
if (!dirWatchers.has(subagentsPath)) {
|
|
@@ -48729,7 +49310,7 @@ function startSubagentWatcher(config) {
|
|
|
48729
49310
|
const w = fs2.watch(subagentsPath, (_event, filename) => {
|
|
48730
49311
|
if (!filename || !filename.toString().startsWith("agent-") || !filename.toString().endsWith(".jsonl"))
|
|
48731
49312
|
return;
|
|
48732
|
-
const filePath =
|
|
49313
|
+
const filePath = join22(subagentsPath, filename.toString());
|
|
48733
49314
|
if (!knownFiles.has(filePath)) {
|
|
48734
49315
|
scanSubagentsDir(subagentsPath);
|
|
48735
49316
|
}
|
|
@@ -48754,7 +49335,7 @@ function startSubagentWatcher(config) {
|
|
|
48754
49335
|
for (const e of entries) {
|
|
48755
49336
|
if (!e.startsWith("agent-") || !e.endsWith(".jsonl"))
|
|
48756
49337
|
continue;
|
|
48757
|
-
const filePath =
|
|
49338
|
+
const filePath = join22(subagentsPath, e);
|
|
48758
49339
|
if (knownFiles.has(filePath))
|
|
48759
49340
|
continue;
|
|
48760
49341
|
const agentId = e.slice("agent-".length, -".jsonl".length);
|
|
@@ -48871,15 +49452,15 @@ function determineRestartReason(opts) {
|
|
|
48871
49452
|
init_boot_card();
|
|
48872
49453
|
|
|
48873
49454
|
// gateway/update-announce.ts
|
|
48874
|
-
import { existsSync as
|
|
48875
|
-
import { join as
|
|
48876
|
-
import { homedir as
|
|
49455
|
+
import { existsSync as existsSync30, mkdirSync as mkdirSync17, openSync as openSync3, closeSync as closeSync3, readFileSync as readFileSync28 } from "node:fs";
|
|
49456
|
+
import { join as join27 } from "node:path";
|
|
49457
|
+
import { homedir as homedir12 } from "node:os";
|
|
48877
49458
|
|
|
48878
49459
|
// ../src/host-control/audit-reader.ts
|
|
48879
|
-
import { homedir as
|
|
48880
|
-
import { join as
|
|
48881
|
-
function defaultAuditLogPath(home2 =
|
|
48882
|
-
return
|
|
49460
|
+
import { homedir as homedir11 } from "node:os";
|
|
49461
|
+
import { join as join26 } from "node:path";
|
|
49462
|
+
function defaultAuditLogPath(home2 = homedir11()) {
|
|
49463
|
+
return join26(home2, ".switchroom", "host-control-audit.log");
|
|
48883
49464
|
}
|
|
48884
49465
|
function parseAuditLine(line) {
|
|
48885
49466
|
const trimmed = line.trim();
|
|
@@ -48985,8 +49566,8 @@ function readAndFilter(raw, filters, limit) {
|
|
|
48985
49566
|
var DEFAULT_LOOKBACK_MS = 10 * 60 * 1000;
|
|
48986
49567
|
function readLastTerminalUpdateAudit(opts = {}) {
|
|
48987
49568
|
const path = opts.auditLogPath ?? defaultAuditLogPath();
|
|
48988
|
-
const exists = opts.exists ??
|
|
48989
|
-
const readFile = opts.readFile ?? ((p) =>
|
|
49569
|
+
const exists = opts.exists ?? existsSync30;
|
|
49570
|
+
const readFile = opts.readFile ?? ((p) => readFileSync28(p, "utf-8"));
|
|
48990
49571
|
if (!exists(path))
|
|
48991
49572
|
return null;
|
|
48992
49573
|
let raw;
|
|
@@ -49047,15 +49628,15 @@ function renderUpdateOutcomeLine(entry) {
|
|
|
49047
49628
|
`);
|
|
49048
49629
|
}
|
|
49049
49630
|
function claimUpdateAnnouncement(requestId, opts = {}) {
|
|
49050
|
-
const stateDir = opts.stateDir ?? process.env.TELEGRAM_STATE_DIR ??
|
|
49051
|
-
const dir =
|
|
49631
|
+
const stateDir = opts.stateDir ?? process.env.TELEGRAM_STATE_DIR ?? join27(homedir12(), ".switchroom");
|
|
49632
|
+
const dir = join27(stateDir, "update-announced");
|
|
49052
49633
|
try {
|
|
49053
|
-
|
|
49634
|
+
mkdirSync17(dir, { recursive: true });
|
|
49054
49635
|
} catch {
|
|
49055
49636
|
return false;
|
|
49056
49637
|
}
|
|
49057
49638
|
const safeId = requestId.replace(/[^A-Za-z0-9_.-]/g, "_").slice(0, 200);
|
|
49058
|
-
const path =
|
|
49639
|
+
const path = join27(dir, safeId);
|
|
49059
49640
|
try {
|
|
49060
49641
|
const fd = openSync3(path, "wx");
|
|
49061
49642
|
closeSync3(fd);
|
|
@@ -49074,7 +49655,7 @@ function maybeRenderUpdateAnnouncement(opts = {}) {
|
|
|
49074
49655
|
}
|
|
49075
49656
|
|
|
49076
49657
|
// issues-card.ts
|
|
49077
|
-
import { readFileSync as
|
|
49658
|
+
import { readFileSync as readFileSync29, writeFileSync as writeFileSync18 } from "node:fs";
|
|
49078
49659
|
var SEVERITY_EMOJI = {
|
|
49079
49660
|
info: "\u2139\ufe0f",
|
|
49080
49661
|
warn: "\u26a0\ufe0f",
|
|
@@ -49166,7 +49747,7 @@ function extractRetryAfterSecs(err) {
|
|
|
49166
49747
|
var COOLDOWN_JITTER_MS = 500;
|
|
49167
49748
|
function readPersistedMessageId(path, log) {
|
|
49168
49749
|
try {
|
|
49169
|
-
const raw =
|
|
49750
|
+
const raw = readFileSync29(path, "utf8");
|
|
49170
49751
|
const parsed = JSON.parse(raw);
|
|
49171
49752
|
const v = parsed.messageId;
|
|
49172
49753
|
if (typeof v === "number" && Number.isInteger(v) && v > 0)
|
|
@@ -49182,7 +49763,7 @@ function readPersistedMessageId(path, log) {
|
|
|
49182
49763
|
}
|
|
49183
49764
|
function writePersistedMessageId(path, messageId, log) {
|
|
49184
49765
|
try {
|
|
49185
|
-
|
|
49766
|
+
writeFileSync18(path, JSON.stringify({ messageId }) + `
|
|
49186
49767
|
`, { mode: 384 });
|
|
49187
49768
|
} catch (err) {
|
|
49188
49769
|
log(`issues-card: persist write failed (${err.message})`);
|
|
@@ -49275,24 +49856,24 @@ function createIssuesCardHandle(opts) {
|
|
|
49275
49856
|
}
|
|
49276
49857
|
|
|
49277
49858
|
// issues-watcher.ts
|
|
49278
|
-
import { existsSync as
|
|
49279
|
-
import { join as
|
|
49859
|
+
import { existsSync as existsSync32, statSync as statSync8 } from "node:fs";
|
|
49860
|
+
import { join as join29 } from "node:path";
|
|
49280
49861
|
|
|
49281
49862
|
// ../src/issues/store.ts
|
|
49282
49863
|
import {
|
|
49283
49864
|
closeSync as closeSync4,
|
|
49284
|
-
existsSync as
|
|
49285
|
-
mkdirSync as
|
|
49865
|
+
existsSync as existsSync31,
|
|
49866
|
+
mkdirSync as mkdirSync18,
|
|
49286
49867
|
openSync as openSync4,
|
|
49287
49868
|
readdirSync as readdirSync5,
|
|
49288
|
-
readFileSync as
|
|
49869
|
+
readFileSync as readFileSync30,
|
|
49289
49870
|
renameSync as renameSync11,
|
|
49290
49871
|
statSync as statSync7,
|
|
49291
|
-
unlinkSync as
|
|
49292
|
-
writeFileSync as
|
|
49872
|
+
unlinkSync as unlinkSync11,
|
|
49873
|
+
writeFileSync as writeFileSync19,
|
|
49293
49874
|
writeSync
|
|
49294
49875
|
} from "node:fs";
|
|
49295
|
-
import { join as
|
|
49876
|
+
import { join as join28 } from "node:path";
|
|
49296
49877
|
import { randomBytes as randomBytes4 } from "node:crypto";
|
|
49297
49878
|
import { execSync } from "node:child_process";
|
|
49298
49879
|
|
|
@@ -49308,12 +49889,12 @@ var SEVERITY_RANK2 = {
|
|
|
49308
49889
|
var ISSUES_FILE = "issues.jsonl";
|
|
49309
49890
|
var ISSUES_LOCK = "issues.lock";
|
|
49310
49891
|
function readAll(stateDir) {
|
|
49311
|
-
const path =
|
|
49312
|
-
if (!
|
|
49892
|
+
const path = join28(stateDir, ISSUES_FILE);
|
|
49893
|
+
if (!existsSync31(path))
|
|
49313
49894
|
return [];
|
|
49314
49895
|
let raw;
|
|
49315
49896
|
try {
|
|
49316
|
-
raw =
|
|
49897
|
+
raw = readFileSync30(path, "utf-8");
|
|
49317
49898
|
} catch {
|
|
49318
49899
|
return [];
|
|
49319
49900
|
}
|
|
@@ -49345,7 +49926,7 @@ function list(stateDir, opts = {}) {
|
|
|
49345
49926
|
});
|
|
49346
49927
|
}
|
|
49347
49928
|
function resolve6(stateDir, fingerprint, nowFn = Date.now) {
|
|
49348
|
-
if (!
|
|
49929
|
+
if (!existsSync31(join28(stateDir, ISSUES_FILE)))
|
|
49349
49930
|
return 0;
|
|
49350
49931
|
return withLock(stateDir, () => {
|
|
49351
49932
|
const all = readAll(stateDir);
|
|
@@ -49363,13 +49944,13 @@ function resolve6(stateDir, fingerprint, nowFn = Date.now) {
|
|
|
49363
49944
|
});
|
|
49364
49945
|
}
|
|
49365
49946
|
function writeAll(stateDir, events) {
|
|
49366
|
-
const path =
|
|
49947
|
+
const path = join28(stateDir, ISSUES_FILE);
|
|
49367
49948
|
sweepOrphanTmpFiles(stateDir);
|
|
49368
49949
|
const tmp = `${path}.tmp-${process.pid}-${randomBytes4(4).toString("hex")}`;
|
|
49369
49950
|
const body = events.length === 0 ? "" : events.map((e) => JSON.stringify(e)).join(`
|
|
49370
49951
|
`) + `
|
|
49371
49952
|
`;
|
|
49372
|
-
|
|
49953
|
+
writeFileSync19(tmp, body, "utf-8");
|
|
49373
49954
|
renameSync11(tmp, path);
|
|
49374
49955
|
}
|
|
49375
49956
|
var ORPHAN_TMP_TTL_MS = 60000;
|
|
@@ -49385,11 +49966,11 @@ function sweepOrphanTmpFiles(stateDir) {
|
|
|
49385
49966
|
for (const entry of entries) {
|
|
49386
49967
|
if (!entry.startsWith(TMP_PREFIX))
|
|
49387
49968
|
continue;
|
|
49388
|
-
const tmpPath2 =
|
|
49969
|
+
const tmpPath2 = join28(stateDir, entry);
|
|
49389
49970
|
try {
|
|
49390
49971
|
const stat = statSync7(tmpPath2);
|
|
49391
49972
|
if (stat.mtimeMs < cutoff) {
|
|
49392
|
-
|
|
49973
|
+
unlinkSync11(tmpPath2);
|
|
49393
49974
|
}
|
|
49394
49975
|
} catch {}
|
|
49395
49976
|
}
|
|
@@ -49397,7 +49978,7 @@ function sweepOrphanTmpFiles(stateDir) {
|
|
|
49397
49978
|
var LOCK_RETRY_MS = 25;
|
|
49398
49979
|
var LOCK_TIMEOUT_MS = 1e4;
|
|
49399
49980
|
function withLock(stateDir, fn) {
|
|
49400
|
-
const lockPath =
|
|
49981
|
+
const lockPath = join28(stateDir, ISSUES_LOCK);
|
|
49401
49982
|
const startedAt = Date.now();
|
|
49402
49983
|
let fd = null;
|
|
49403
49984
|
while (fd === null) {
|
|
@@ -49425,27 +50006,27 @@ function withLock(stateDir, fn) {
|
|
|
49425
50006
|
closeSync4(fd);
|
|
49426
50007
|
} catch {}
|
|
49427
50008
|
try {
|
|
49428
|
-
|
|
50009
|
+
unlinkSync11(lockPath);
|
|
49429
50010
|
} catch {}
|
|
49430
50011
|
}
|
|
49431
50012
|
}
|
|
49432
50013
|
function tryStealStaleLock(lockPath) {
|
|
49433
50014
|
let pidStr;
|
|
49434
50015
|
try {
|
|
49435
|
-
pidStr =
|
|
50016
|
+
pidStr = readFileSync30(lockPath, "utf-8").trim();
|
|
49436
50017
|
} catch {
|
|
49437
50018
|
return true;
|
|
49438
50019
|
}
|
|
49439
50020
|
const pid = Number(pidStr);
|
|
49440
50021
|
if (!Number.isFinite(pid) || pid <= 0) {
|
|
49441
50022
|
try {
|
|
49442
|
-
|
|
50023
|
+
unlinkSync11(lockPath);
|
|
49443
50024
|
} catch {}
|
|
49444
50025
|
return true;
|
|
49445
50026
|
}
|
|
49446
50027
|
if (pid === process.pid) {
|
|
49447
50028
|
try {
|
|
49448
|
-
|
|
50029
|
+
unlinkSync11(lockPath);
|
|
49449
50030
|
} catch {}
|
|
49450
50031
|
return true;
|
|
49451
50032
|
}
|
|
@@ -49460,7 +50041,7 @@ function tryStealStaleLock(lockPath) {
|
|
|
49460
50041
|
return false;
|
|
49461
50042
|
}
|
|
49462
50043
|
try {
|
|
49463
|
-
|
|
50044
|
+
unlinkSync11(lockPath);
|
|
49464
50045
|
} catch {}
|
|
49465
50046
|
return true;
|
|
49466
50047
|
}
|
|
@@ -49482,7 +50063,7 @@ function isIssueEvent(v) {
|
|
|
49482
50063
|
// issues-watcher.ts
|
|
49483
50064
|
var DEFAULT_POLL_INTERVAL_MS2 = 2000;
|
|
49484
50065
|
function startIssuesWatcher(opts) {
|
|
49485
|
-
const path =
|
|
50066
|
+
const path = join29(opts.stateDir, ISSUES_FILE);
|
|
49486
50067
|
const log = opts.log ?? (() => {});
|
|
49487
50068
|
const intervalMs = opts.pollIntervalMs ?? DEFAULT_POLL_INTERVAL_MS2;
|
|
49488
50069
|
const setIntervalFn = opts.setInterval ?? setInterval;
|
|
@@ -49530,7 +50111,7 @@ function startIssuesWatcher(opts) {
|
|
|
49530
50111
|
};
|
|
49531
50112
|
}
|
|
49532
50113
|
function defaultSignatureProvider(path) {
|
|
49533
|
-
if (!
|
|
50114
|
+
if (!existsSync32(path))
|
|
49534
50115
|
return null;
|
|
49535
50116
|
try {
|
|
49536
50117
|
const stat = statSync8(path);
|
|
@@ -50014,8 +50595,8 @@ function extractFlowItems(line) {
|
|
|
50014
50595
|
}
|
|
50015
50596
|
|
|
50016
50597
|
// credits-watch.ts
|
|
50017
|
-
import { readFileSync as
|
|
50018
|
-
import { join as
|
|
50598
|
+
import { readFileSync as readFileSync31, writeFileSync as writeFileSync20, existsSync as existsSync33, mkdirSync as mkdirSync19 } from "fs";
|
|
50599
|
+
import { join as join30 } from "path";
|
|
50019
50600
|
var STATE_FILE = "credits-watch.json";
|
|
50020
50601
|
var FATAL_REASONS = new Set([
|
|
50021
50602
|
"out_of_credits",
|
|
@@ -50027,12 +50608,12 @@ function emptyCreditState() {
|
|
|
50027
50608
|
return { lastNotifiedReason: null, lastNotifiedAt: 0 };
|
|
50028
50609
|
}
|
|
50029
50610
|
function readClaudeJsonOverage(claudeConfigDir) {
|
|
50030
|
-
const path =
|
|
50031
|
-
if (!
|
|
50611
|
+
const path = join30(claudeConfigDir, ".claude.json");
|
|
50612
|
+
if (!existsSync33(path))
|
|
50032
50613
|
return null;
|
|
50033
50614
|
let raw;
|
|
50034
50615
|
try {
|
|
50035
|
-
raw =
|
|
50616
|
+
raw = readFileSync31(path, "utf-8");
|
|
50036
50617
|
} catch {
|
|
50037
50618
|
return null;
|
|
50038
50619
|
}
|
|
@@ -50112,11 +50693,11 @@ function escapeHtml10(s) {
|
|
|
50112
50693
|
return s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
50113
50694
|
}
|
|
50114
50695
|
function loadCreditState(stateDir) {
|
|
50115
|
-
const path =
|
|
50116
|
-
if (!
|
|
50696
|
+
const path = join30(stateDir, STATE_FILE);
|
|
50697
|
+
if (!existsSync33(path))
|
|
50117
50698
|
return emptyCreditState();
|
|
50118
50699
|
try {
|
|
50119
|
-
const raw =
|
|
50700
|
+
const raw = readFileSync31(path, "utf-8");
|
|
50120
50701
|
const parsed = JSON.parse(raw);
|
|
50121
50702
|
if (parsed && typeof parsed === "object" && (parsed.lastNotifiedReason === null || typeof parsed.lastNotifiedReason === "string") && typeof parsed.lastNotifiedAt === "number" && Number.isFinite(parsed.lastNotifiedAt)) {
|
|
50122
50703
|
return {
|
|
@@ -50128,15 +50709,15 @@ function loadCreditState(stateDir) {
|
|
|
50128
50709
|
return emptyCreditState();
|
|
50129
50710
|
}
|
|
50130
50711
|
function saveCreditState(stateDir, state4) {
|
|
50131
|
-
|
|
50132
|
-
const path =
|
|
50133
|
-
|
|
50712
|
+
mkdirSync19(stateDir, { recursive: true });
|
|
50713
|
+
const path = join30(stateDir, STATE_FILE);
|
|
50714
|
+
writeFileSync20(path, JSON.stringify(state4, null, 2) + `
|
|
50134
50715
|
`, { mode: 384 });
|
|
50135
50716
|
}
|
|
50136
50717
|
|
|
50137
50718
|
// quota-watch.ts
|
|
50138
|
-
import { readFileSync as
|
|
50139
|
-
import { join as
|
|
50719
|
+
import { readFileSync as readFileSync32, writeFileSync as writeFileSync21, existsSync as existsSync34, mkdirSync as mkdirSync20 } from "fs";
|
|
50720
|
+
import { join as join31 } from "path";
|
|
50140
50721
|
var STATE_FILE2 = "quota-watch.json";
|
|
50141
50722
|
function emptyQuotaWatchState() {
|
|
50142
50723
|
return {};
|
|
@@ -50226,11 +50807,11 @@ function escapeHtml11(s) {
|
|
|
50226
50807
|
return s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
50227
50808
|
}
|
|
50228
50809
|
function loadQuotaWatchState(stateDir) {
|
|
50229
|
-
const path =
|
|
50230
|
-
if (!
|
|
50810
|
+
const path = join31(stateDir, STATE_FILE2);
|
|
50811
|
+
if (!existsSync34(path))
|
|
50231
50812
|
return emptyQuotaWatchState();
|
|
50232
50813
|
try {
|
|
50233
|
-
const raw =
|
|
50814
|
+
const raw = readFileSync32(path, "utf-8");
|
|
50234
50815
|
const parsed = JSON.parse(raw);
|
|
50235
50816
|
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
50236
50817
|
return emptyQuotaWatchState();
|
|
@@ -50247,9 +50828,9 @@ function loadQuotaWatchState(stateDir) {
|
|
|
50247
50828
|
}
|
|
50248
50829
|
}
|
|
50249
50830
|
function saveQuotaWatchState(stateDir, state4) {
|
|
50250
|
-
|
|
50251
|
-
const path =
|
|
50252
|
-
|
|
50831
|
+
mkdirSync20(stateDir, { recursive: true });
|
|
50832
|
+
const path = join31(stateDir, STATE_FILE2);
|
|
50833
|
+
writeFileSync21(path, JSON.stringify(state4, null, 2) + `
|
|
50253
50834
|
`, { mode: 384 });
|
|
50254
50835
|
}
|
|
50255
50836
|
function patchQuotaWatchState(current, accountLabel, accountState) {
|
|
@@ -50262,27 +50843,27 @@ init_auth_snapshot_format();
|
|
|
50262
50843
|
// gateway/turn-active-marker.ts
|
|
50263
50844
|
import {
|
|
50264
50845
|
closeSync as closeSync5,
|
|
50265
|
-
existsSync as
|
|
50266
|
-
mkdirSync as
|
|
50846
|
+
existsSync as existsSync35,
|
|
50847
|
+
mkdirSync as mkdirSync21,
|
|
50267
50848
|
openSync as openSync5,
|
|
50268
|
-
readFileSync as
|
|
50849
|
+
readFileSync as readFileSync33,
|
|
50269
50850
|
statSync as statSync9,
|
|
50270
|
-
unlinkSync as
|
|
50851
|
+
unlinkSync as unlinkSync12,
|
|
50271
50852
|
utimesSync as utimesSync2,
|
|
50272
|
-
writeFileSync as
|
|
50853
|
+
writeFileSync as writeFileSync22
|
|
50273
50854
|
} from "node:fs";
|
|
50274
|
-
import { join as
|
|
50855
|
+
import { join as join32 } from "node:path";
|
|
50275
50856
|
var TURN_ACTIVE_MARKER_FILE2 = "turn-active.json";
|
|
50276
50857
|
function writeTurnActiveMarker(stateDir, marker) {
|
|
50277
50858
|
try {
|
|
50278
|
-
|
|
50279
|
-
|
|
50859
|
+
mkdirSync21(stateDir, { recursive: true });
|
|
50860
|
+
writeFileSync22(join32(stateDir, TURN_ACTIVE_MARKER_FILE2), JSON.stringify(marker, null, 2) + `
|
|
50280
50861
|
`, { mode: 384 });
|
|
50281
50862
|
} catch {}
|
|
50282
50863
|
}
|
|
50283
50864
|
function touchTurnActiveMarker2(stateDir) {
|
|
50284
|
-
const path =
|
|
50285
|
-
if (!
|
|
50865
|
+
const path = join32(stateDir, TURN_ACTIVE_MARKER_FILE2);
|
|
50866
|
+
if (!existsSync35(path))
|
|
50286
50867
|
return;
|
|
50287
50868
|
const now = new Date;
|
|
50288
50869
|
try {
|
|
@@ -50296,12 +50877,12 @@ function touchTurnActiveMarker2(stateDir) {
|
|
|
50296
50877
|
}
|
|
50297
50878
|
function removeTurnActiveMarker(stateDir) {
|
|
50298
50879
|
try {
|
|
50299
|
-
|
|
50880
|
+
unlinkSync12(join32(stateDir, TURN_ACTIVE_MARKER_FILE2));
|
|
50300
50881
|
} catch {}
|
|
50301
50882
|
}
|
|
50302
50883
|
function sweepStaleTurnActiveMarker(stateDir, opts) {
|
|
50303
|
-
const path =
|
|
50304
|
-
if (!
|
|
50884
|
+
const path = join32(stateDir, TURN_ACTIVE_MARKER_FILE2);
|
|
50885
|
+
if (!existsSync35(path))
|
|
50305
50886
|
return false;
|
|
50306
50887
|
const now = opts.now ?? Date.now();
|
|
50307
50888
|
try {
|
|
@@ -50313,9 +50894,9 @@ function sweepStaleTurnActiveMarker(stateDir, opts) {
|
|
|
50313
50894
|
return false;
|
|
50314
50895
|
let payload = null;
|
|
50315
50896
|
try {
|
|
50316
|
-
payload =
|
|
50897
|
+
payload = readFileSync33(path, "utf8");
|
|
50317
50898
|
} catch {}
|
|
50318
|
-
|
|
50899
|
+
unlinkSync12(path);
|
|
50319
50900
|
if (opts.onRemove) {
|
|
50320
50901
|
try {
|
|
50321
50902
|
opts.onRemove({
|
|
@@ -50332,10 +50913,10 @@ function sweepStaleTurnActiveMarker(stateDir, opts) {
|
|
|
50332
50913
|
}
|
|
50333
50914
|
|
|
50334
50915
|
// ../src/build-info.ts
|
|
50335
|
-
var VERSION = "0.14.
|
|
50336
|
-
var COMMIT_SHA = "
|
|
50337
|
-
var COMMIT_DATE = "2026-05-
|
|
50338
|
-
var LATEST_PR =
|
|
50916
|
+
var VERSION = "0.14.10";
|
|
50917
|
+
var COMMIT_SHA = "0cd391b5";
|
|
50918
|
+
var COMMIT_DATE = "2026-05-29T05:14:25Z";
|
|
50919
|
+
var LATEST_PR = 1987;
|
|
50339
50920
|
var COMMITS_AHEAD_OF_TAG = 0;
|
|
50340
50921
|
|
|
50341
50922
|
// gateway/boot-version.ts
|
|
@@ -50406,14 +50987,14 @@ function classifyRejection(err, opts = {}) {
|
|
|
50406
50987
|
// ../src/vault/broker/client.ts
|
|
50407
50988
|
init_protocol2();
|
|
50408
50989
|
init_peercred();
|
|
50409
|
-
import * as
|
|
50990
|
+
import * as net5 from "node:net";
|
|
50410
50991
|
import * as fs2 from "node:fs";
|
|
50411
|
-
import { homedir as
|
|
50412
|
-
import { join as
|
|
50992
|
+
import { homedir as homedir13 } from "node:os";
|
|
50993
|
+
import { join as join33 } from "node:path";
|
|
50413
50994
|
var DEFAULT_TIMEOUT_MS4 = 2000;
|
|
50414
50995
|
var UNLOCK_TIMEOUT_MS = 30000;
|
|
50415
|
-
var LEGACY_SOCKET_PATH2 =
|
|
50416
|
-
var OPERATOR_SOCKET_PATH2 =
|
|
50996
|
+
var LEGACY_SOCKET_PATH2 = join33(homedir13(), ".switchroom", "vault-broker.sock");
|
|
50997
|
+
var OPERATOR_SOCKET_PATH2 = join33(homedir13(), ".switchroom", "broker-operator", "sock");
|
|
50417
50998
|
function defaultBrokerSocketPath2() {
|
|
50418
50999
|
if (fs2.existsSync(OPERATOR_SOCKET_PATH2))
|
|
50419
51000
|
return OPERATOR_SOCKET_PATH2;
|
|
@@ -50442,7 +51023,7 @@ async function rpc2(req, opts) {
|
|
|
50442
51023
|
settled = true;
|
|
50443
51024
|
resolve7(val);
|
|
50444
51025
|
};
|
|
50445
|
-
const client3 = new
|
|
51026
|
+
const client3 = new net5.Socket;
|
|
50446
51027
|
const timer3 = setTimeout(() => {
|
|
50447
51028
|
client3.destroy();
|
|
50448
51029
|
settle({ kind: "unreachable", msg: `broker did not respond within ${timeoutMs}ms` });
|
|
@@ -50536,7 +51117,7 @@ async function unlockViaBroker(passphrase, opts) {
|
|
|
50536
51117
|
client3.destroy();
|
|
50537
51118
|
settle({ ok: false, msg: "Timeout waiting for broker" });
|
|
50538
51119
|
}, timeoutMs);
|
|
50539
|
-
const client3 =
|
|
51120
|
+
const client3 = net5.createConnection({ path: unlockSocketPath });
|
|
50540
51121
|
client3.on("error", (err) => {
|
|
50541
51122
|
clearTimeout(timer3);
|
|
50542
51123
|
settle({ ok: false, msg: `Broker unreachable: ${err.message}` });
|
|
@@ -50635,8 +51216,8 @@ function resolveVaultApprovalPosture(broker) {
|
|
|
50635
51216
|
}
|
|
50636
51217
|
|
|
50637
51218
|
// registry/turns-schema.ts
|
|
50638
|
-
import { chmodSync as
|
|
50639
|
-
import { join as
|
|
51219
|
+
import { chmodSync as chmodSync4, mkdirSync as mkdirSync22 } from "fs";
|
|
51220
|
+
import { join as join34 } from "path";
|
|
50640
51221
|
var DatabaseClass2 = null;
|
|
50641
51222
|
function loadDatabaseClass2() {
|
|
50642
51223
|
if (DatabaseClass2 != null)
|
|
@@ -50695,13 +51276,13 @@ function applySchema(db2) {
|
|
|
50695
51276
|
}
|
|
50696
51277
|
function openTurnsDb(agentDir) {
|
|
50697
51278
|
const Database = loadDatabaseClass2();
|
|
50698
|
-
const dir =
|
|
50699
|
-
|
|
50700
|
-
const path =
|
|
51279
|
+
const dir = join34(agentDir, "telegram");
|
|
51280
|
+
mkdirSync22(dir, { recursive: true, mode: 448 });
|
|
51281
|
+
const path = join34(dir, "registry.db");
|
|
50701
51282
|
const db2 = new Database(path, { create: true });
|
|
50702
51283
|
applySchema(db2);
|
|
50703
51284
|
try {
|
|
50704
|
-
|
|
51285
|
+
chmodSync4(path, 384);
|
|
50705
51286
|
} catch {}
|
|
50706
51287
|
return db2;
|
|
50707
51288
|
}
|
|
@@ -50838,11 +51419,11 @@ installGlobalErrorHandlers();
|
|
|
50838
51419
|
process.on("beforeExit", () => {
|
|
50839
51420
|
shutdownAnalytics();
|
|
50840
51421
|
});
|
|
50841
|
-
var STATE_DIR = process.env.TELEGRAM_STATE_DIR ??
|
|
50842
|
-
var ACCESS_FILE =
|
|
50843
|
-
var APPROVED_DIR =
|
|
50844
|
-
var ENV_FILE =
|
|
50845
|
-
var INBOX_DIR =
|
|
51422
|
+
var STATE_DIR = process.env.TELEGRAM_STATE_DIR ?? join36(homedir14(), ".claude", "channels", "telegram");
|
|
51423
|
+
var ACCESS_FILE = join36(STATE_DIR, "access.json");
|
|
51424
|
+
var APPROVED_DIR = join36(STATE_DIR, "approved");
|
|
51425
|
+
var ENV_FILE = join36(STATE_DIR, ".env");
|
|
51426
|
+
var INBOX_DIR = join36(STATE_DIR, "inbox");
|
|
50846
51427
|
function triggerSelfRestart(targetAgent, reason, delayMs = 300) {
|
|
50847
51428
|
const isDocker = process.env.SWITCHROOM_RUNTIME === "docker";
|
|
50848
51429
|
const selfAgent = process.env.SWITCHROOM_AGENT_NAME;
|
|
@@ -50906,8 +51487,8 @@ function formatBootVersion() {
|
|
|
50906
51487
|
});
|
|
50907
51488
|
}
|
|
50908
51489
|
try {
|
|
50909
|
-
|
|
50910
|
-
for (const line of
|
|
51490
|
+
chmodSync6(ENV_FILE, 384);
|
|
51491
|
+
for (const line of readFileSync36(ENV_FILE, "utf8").split(`
|
|
50911
51492
|
`)) {
|
|
50912
51493
|
const m = line.match(/^(\w+)=(.*)$/);
|
|
50913
51494
|
if (m && process.env[m[1]] === undefined)
|
|
@@ -50960,7 +51541,7 @@ installTgPostLogger(bot);
|
|
|
50960
51541
|
var _rawSendMessageDraft = bot.api.raw.sendMessageDraft;
|
|
50961
51542
|
var GRAMMY_VERSION = (() => {
|
|
50962
51543
|
try {
|
|
50963
|
-
const raw =
|
|
51544
|
+
const raw = readFileSync36(new URL("../../node_modules/grammy/package.json", import.meta.url), "utf8");
|
|
50964
51545
|
return JSON.parse(raw).version ?? "unknown";
|
|
50965
51546
|
} catch {
|
|
50966
51547
|
return "unknown";
|
|
@@ -51033,7 +51614,7 @@ function assertSendable(f) {
|
|
|
51033
51614
|
} catch {
|
|
51034
51615
|
throw new Error(`refusing to send file \u2014 cannot resolve real path: ${f}`);
|
|
51035
51616
|
}
|
|
51036
|
-
const inbox =
|
|
51617
|
+
const inbox = join36(stateReal, "inbox");
|
|
51037
51618
|
if (real.startsWith(stateReal + sep3) && !real.startsWith(inbox + sep3)) {
|
|
51038
51619
|
throw new Error(`refusing to send channel state: ${f}`);
|
|
51039
51620
|
}
|
|
@@ -51052,7 +51633,7 @@ function assertSendable(f) {
|
|
|
51052
51633
|
}
|
|
51053
51634
|
function readAccessFile() {
|
|
51054
51635
|
try {
|
|
51055
|
-
const raw =
|
|
51636
|
+
const raw = readFileSync36(ACCESS_FILE, "utf8");
|
|
51056
51637
|
const parsed = JSON.parse(raw);
|
|
51057
51638
|
const allowFrom = validateStringArray("allowFrom", parsed.allowFrom ?? []);
|
|
51058
51639
|
const groups = {};
|
|
@@ -51117,9 +51698,9 @@ function assertAllowedChat(chat_id) {
|
|
|
51117
51698
|
function saveAccess(a) {
|
|
51118
51699
|
if (STATIC)
|
|
51119
51700
|
return;
|
|
51120
|
-
|
|
51701
|
+
mkdirSync26(STATE_DIR, { recursive: true, mode: 448 });
|
|
51121
51702
|
const tmp = ACCESS_FILE + ".tmp";
|
|
51122
|
-
|
|
51703
|
+
writeFileSync25(tmp, JSON.stringify(a, null, 2) + `
|
|
51123
51704
|
`, { mode: 384 });
|
|
51124
51705
|
renameSync13(tmp, ACCESS_FILE);
|
|
51125
51706
|
}
|
|
@@ -51139,7 +51720,7 @@ var HISTORY_ENABLED = HISTORY_ACCESS.historyEnabled !== false;
|
|
|
51139
51720
|
if (HISTORY_ENABLED) {
|
|
51140
51721
|
try {
|
|
51141
51722
|
initHistory(STATE_DIR, HISTORY_ACCESS.historyRetentionDays ?? 30);
|
|
51142
|
-
process.stderr.write(`telegram gateway: history capture enabled at ${
|
|
51723
|
+
process.stderr.write(`telegram gateway: history capture enabled at ${join36(STATE_DIR, "history.db")}
|
|
51143
51724
|
`);
|
|
51144
51725
|
} catch (err) {
|
|
51145
51726
|
process.stderr.write(`telegram gateway: history init failed (${err.message}) \u2014 capture disabled
|
|
@@ -51156,10 +51737,10 @@ try {
|
|
|
51156
51737
|
process.stderr.write(`telegram gateway: turn-registry boot-reaper stamped ${reaped} orphaned turn(s) as ended_via='restart'
|
|
51157
51738
|
`);
|
|
51158
51739
|
} else {
|
|
51159
|
-
process.stderr.write(`telegram gateway: turn-registry initialized at ${
|
|
51740
|
+
process.stderr.write(`telegram gateway: turn-registry initialized at ${join36(agentDir, "telegram", "registry.db")}
|
|
51160
51741
|
`);
|
|
51161
51742
|
}
|
|
51162
|
-
const pendingEnvPath =
|
|
51743
|
+
const pendingEnvPath = join36(agentDir, ".pending-turn.env");
|
|
51163
51744
|
try {
|
|
51164
51745
|
const pending2 = findMostRecentInterruptedTurn(turnsDb);
|
|
51165
51746
|
if (pending2 != null) {
|
|
@@ -51173,13 +51754,13 @@ try {
|
|
|
51173
51754
|
`SWITCHROOM_PENDING_STARTED_AT=${pending2.started_at}`
|
|
51174
51755
|
];
|
|
51175
51756
|
const pendingEnvTmp = `${pendingEnvPath}.tmp-${process.pid}`;
|
|
51176
|
-
|
|
51757
|
+
writeFileSync25(pendingEnvTmp, lines.join(`
|
|
51177
51758
|
`) + `
|
|
51178
51759
|
`, { mode: 384 });
|
|
51179
51760
|
renameSync13(pendingEnvTmp, pendingEnvPath);
|
|
51180
51761
|
process.stderr.write(`telegram gateway: pending-turn env written to ${pendingEnvPath} turnKey=${pending2.turn_key} endedVia=${pending2.ended_via ?? "open"}
|
|
51181
51762
|
`);
|
|
51182
|
-
} else if (
|
|
51763
|
+
} else if (existsSync39(pendingEnvPath)) {
|
|
51183
51764
|
rmSync4(pendingEnvPath, { force: true });
|
|
51184
51765
|
process.stderr.write(`telegram gateway: pending-turn env cleared (clean previous shutdown)
|
|
51185
51766
|
`);
|
|
@@ -51233,7 +51814,7 @@ function checkApprovals() {
|
|
|
51233
51814
|
return;
|
|
51234
51815
|
}
|
|
51235
51816
|
for (const senderId of files) {
|
|
51236
|
-
const file =
|
|
51817
|
+
const file = join36(APPROVED_DIR, senderId);
|
|
51237
51818
|
bot.api.sendMessage(senderId, "Paired! Say hi to Claude.").then(() => rmSync4(file, { force: true }), (err) => {
|
|
51238
51819
|
process.stderr.write(`telegram gateway: failed to send approval confirm: ${err}
|
|
51239
51820
|
`);
|
|
@@ -52117,23 +52698,16 @@ var ANSWER_STREAM_VISIBLE_ENABLED = (() => {
|
|
|
52117
52698
|
return false;
|
|
52118
52699
|
return true;
|
|
52119
52700
|
})();
|
|
52120
|
-
var DRAFT_MIRROR_ENABLED = (() => {
|
|
52121
|
-
const raw = process.env.SWITCHROOM_DRAFT_MIRROR;
|
|
52122
|
-
if (raw == null)
|
|
52123
|
-
return false;
|
|
52124
|
-
const v = raw.trim().toLowerCase();
|
|
52125
|
-
return !(v === "0" || v === "false" || v === "off" || v === "no");
|
|
52126
|
-
})();
|
|
52127
52701
|
var progressDriver = null;
|
|
52128
52702
|
var unpinProgressCardForChat = null;
|
|
52129
52703
|
var getPinnedProgressCardMessageId = null;
|
|
52130
52704
|
var completeProgressCardTurn = null;
|
|
52131
52705
|
var subagentWatcher = null;
|
|
52132
|
-
var SOCKET_PATH = process.env.SWITCHROOM_GATEWAY_SOCKET ??
|
|
52133
|
-
|
|
52134
|
-
var GATEWAY_PID_PATH = process.env.SWITCHROOM_GATEWAY_PID_FILE ??
|
|
52135
|
-
var GATEWAY_SESSION_MARKER_PATH = process.env.SWITCHROOM_GATEWAY_SESSION_MARKER ??
|
|
52136
|
-
var GATEWAY_CLEAN_SHUTDOWN_MARKER_PATH = process.env.SWITCHROOM_GATEWAY_CLEAN_SHUTDOWN_MARKER ??
|
|
52706
|
+
var SOCKET_PATH = process.env.SWITCHROOM_GATEWAY_SOCKET ?? join36(STATE_DIR, "gateway.sock");
|
|
52707
|
+
mkdirSync26(STATE_DIR, { recursive: true, mode: 448 });
|
|
52708
|
+
var GATEWAY_PID_PATH = process.env.SWITCHROOM_GATEWAY_PID_FILE ?? join36(STATE_DIR, "gateway.pid.json");
|
|
52709
|
+
var GATEWAY_SESSION_MARKER_PATH = process.env.SWITCHROOM_GATEWAY_SESSION_MARKER ?? join36(STATE_DIR, "gateway-session.json");
|
|
52710
|
+
var GATEWAY_CLEAN_SHUTDOWN_MARKER_PATH = process.env.SWITCHROOM_GATEWAY_CLEAN_SHUTDOWN_MARKER ?? join36(STATE_DIR, "clean-shutdown.json");
|
|
52137
52711
|
var GATEWAY_STARTED_AT_MS = Date.now();
|
|
52138
52712
|
var BOOT_CARD_ENABLED = process.env.SWITCHROOM_BOOT_CARD !== "false";
|
|
52139
52713
|
var activeBootCard = null;
|
|
@@ -52162,7 +52736,7 @@ function ensureIssuesCard(chatId, threadId) {
|
|
|
52162
52736
|
bot: botApi,
|
|
52163
52737
|
log: (msg) => process.stderr.write(`telegram gateway: ${msg}
|
|
52164
52738
|
`),
|
|
52165
|
-
persistPath:
|
|
52739
|
+
persistPath: join36(stateDir, "issues-card.json")
|
|
52166
52740
|
});
|
|
52167
52741
|
activeIssuesWatcher = startIssuesWatcher({
|
|
52168
52742
|
stateDir,
|
|
@@ -52336,13 +52910,13 @@ startTimer2({
|
|
|
52336
52910
|
}
|
|
52337
52911
|
});
|
|
52338
52912
|
var inboundSpool = STATIC ? undefined : createInboundSpool({
|
|
52339
|
-
path:
|
|
52913
|
+
path: join36(STATE_DIR, "inbound-spool.jsonl"),
|
|
52340
52914
|
fs: {
|
|
52341
|
-
appendFileSync: (p, d) =>
|
|
52342
|
-
readFileSync: (p) =>
|
|
52343
|
-
writeFileSync: (p, d) =>
|
|
52915
|
+
appendFileSync: (p, d) => appendFileSync5(p, d),
|
|
52916
|
+
readFileSync: (p) => readFileSync36(p, "utf8"),
|
|
52917
|
+
writeFileSync: (p, d) => writeFileSync25(p, d),
|
|
52344
52918
|
renameSync: (a, b) => renameSync13(a, b),
|
|
52345
|
-
existsSync: (p) =>
|
|
52919
|
+
existsSync: (p) => existsSync39(p),
|
|
52346
52920
|
statSizeSync: (p) => statSync13(p).size
|
|
52347
52921
|
}
|
|
52348
52922
|
});
|
|
@@ -52469,7 +53043,7 @@ var ipcServer = createIpcServer({
|
|
|
52469
53043
|
probeQuotaViaBroker: (t) => probeQuotaForBootCard(agentSlug, t),
|
|
52470
53044
|
tmuxSupervisor: process.env.SWITCHROOM_TMUX_SUPERVISOR === "1",
|
|
52471
53045
|
dockerMode: process.env.SWITCHROOM_RUNTIME === "docker",
|
|
52472
|
-
configSnapshotPath:
|
|
53046
|
+
configSnapshotPath: join36(resolvedAgentDirForCard, ".config-snapshot.json"),
|
|
52473
53047
|
...updateOutcomeLine ? { updateOutcomeLine } : {}
|
|
52474
53048
|
}, ackMsgId).then((handle) => {
|
|
52475
53049
|
activeBootCard = handle;
|
|
@@ -52884,6 +53458,62 @@ ${reminder}
|
|
|
52884
53458
|
log: (msg) => process.stderr.write(`telegram gateway: ipc \u2014 ${msg}
|
|
52885
53459
|
`)
|
|
52886
53460
|
});
|
|
53461
|
+
(() => {
|
|
53462
|
+
try {
|
|
53463
|
+
const selfAgent = process.env.SWITCHROOM_AGENT_NAME ?? "";
|
|
53464
|
+
if (!selfAgent)
|
|
53465
|
+
return;
|
|
53466
|
+
let viaGateway = false;
|
|
53467
|
+
try {
|
|
53468
|
+
const cfg = loadConfig2();
|
|
53469
|
+
const raw = cfg.agents?.[selfAgent];
|
|
53470
|
+
viaGateway = raw ? resolveAgentConfig2(cfg.defaults, cfg.profiles, raw).channels?.telegram?.webhook_via_gateway === true : false;
|
|
53471
|
+
} catch (err) {
|
|
53472
|
+
process.stderr.write(`telegram gateway: webhook-ingest config probe failed: ${err.message}
|
|
53473
|
+
`);
|
|
53474
|
+
}
|
|
53475
|
+
if (!viaGateway)
|
|
53476
|
+
return;
|
|
53477
|
+
const allowedUids = [];
|
|
53478
|
+
const ownUid = typeof process.getuid === "function" ? process.getuid() : null;
|
|
53479
|
+
if (ownUid !== null)
|
|
53480
|
+
allowedUids.push(ownUid);
|
|
53481
|
+
const receiverUidRaw = process.env.SWITCHROOM_WEBHOOK_RECEIVER_UID;
|
|
53482
|
+
const receiverUid = receiverUidRaw ? Number(receiverUidRaw) : NaN;
|
|
53483
|
+
if (Number.isInteger(receiverUid))
|
|
53484
|
+
allowedUids.push(receiverUid);
|
|
53485
|
+
const socketPath = join36(STATE_DIR, "webhook.sock");
|
|
53486
|
+
const webhookInject = (agentName3, inbound) => {
|
|
53487
|
+
const msg = inbound;
|
|
53488
|
+
const delivered = ipcServer.sendToAgent(agentName3, msg);
|
|
53489
|
+
if (delivered)
|
|
53490
|
+
markClaudeBusyForInbound(msg);
|
|
53491
|
+
else
|
|
53492
|
+
pendingInboundBuffer.push(agentName3, msg);
|
|
53493
|
+
return delivered;
|
|
53494
|
+
};
|
|
53495
|
+
startWebhookIngestServer({
|
|
53496
|
+
socketPath,
|
|
53497
|
+
allowedUids,
|
|
53498
|
+
log: (s) => process.stderr.write(`telegram gateway: ${s}`),
|
|
53499
|
+
onRecord: (req) => recordWebhookEvent({
|
|
53500
|
+
agent: selfAgent,
|
|
53501
|
+
source: req.source,
|
|
53502
|
+
event_type: req.event_type,
|
|
53503
|
+
ts: req.ts,
|
|
53504
|
+
rendered_text: req.rendered_text,
|
|
53505
|
+
payload: req.payload,
|
|
53506
|
+
...req.delivery_id ? { delivery_id: req.delivery_id } : {}
|
|
53507
|
+
}, {
|
|
53508
|
+
inject: webhookInject,
|
|
53509
|
+
log: (s) => process.stderr.write(`telegram gateway: ${s}`)
|
|
53510
|
+
})
|
|
53511
|
+
});
|
|
53512
|
+
} catch (err) {
|
|
53513
|
+
process.stderr.write(`telegram gateway: webhook-ingest server start failed (non-fatal): ${err.message}
|
|
53514
|
+
`);
|
|
53515
|
+
}
|
|
53516
|
+
})();
|
|
52887
53517
|
var IDLE_DRAIN_INTERVAL_MS = 5000;
|
|
52888
53518
|
if (!STATIC) {
|
|
52889
53519
|
setInterval(() => {
|
|
@@ -53849,11 +54479,11 @@ async function executeSendGif(rawArgs) {
|
|
|
53849
54479
|
};
|
|
53850
54480
|
}
|
|
53851
54481
|
async function publishToTelegraph(text, shortName, authorName) {
|
|
53852
|
-
const accountPath =
|
|
54482
|
+
const accountPath = join36(STATE_DIR, "telegraph-account.json");
|
|
53853
54483
|
let account = null;
|
|
53854
54484
|
try {
|
|
53855
|
-
if (
|
|
53856
|
-
const raw =
|
|
54485
|
+
if (existsSync39(accountPath)) {
|
|
54486
|
+
const raw = readFileSync36(accountPath, "utf-8");
|
|
53857
54487
|
const parsed = JSON.parse(raw);
|
|
53858
54488
|
if (parsed.shortName && parsed.accessToken) {
|
|
53859
54489
|
account = parsed;
|
|
@@ -53872,8 +54502,8 @@ async function publishToTelegraph(text, shortName, authorName) {
|
|
|
53872
54502
|
}
|
|
53873
54503
|
account = created.value;
|
|
53874
54504
|
try {
|
|
53875
|
-
|
|
53876
|
-
|
|
54505
|
+
mkdirSync26(STATE_DIR, { recursive: true, mode: 448 });
|
|
54506
|
+
writeFileSync25(accountPath, JSON.stringify(account, null, 2), { mode: 384 });
|
|
53877
54507
|
} catch (err) {
|
|
53878
54508
|
process.stderr.write(`telegram gateway: telegraph cache write failed: ${err.message}
|
|
53879
54509
|
`);
|
|
@@ -54115,9 +54745,9 @@ async function executeDownloadAttachment(args) {
|
|
|
54115
54745
|
fileUniqueId: file.file_unique_id,
|
|
54116
54746
|
now: Date.now()
|
|
54117
54747
|
});
|
|
54118
|
-
|
|
54748
|
+
mkdirSync26(INBOX_DIR, { recursive: true, mode: 448 });
|
|
54119
54749
|
assertInsideInbox(INBOX_DIR, dlPath);
|
|
54120
|
-
|
|
54750
|
+
writeFileSync25(dlPath, buf, { mode: 384 });
|
|
54121
54751
|
return { content: [{ type: "text", text: dlPath }] };
|
|
54122
54752
|
}
|
|
54123
54753
|
async function executeEditMessage(args) {
|
|
@@ -54344,10 +54974,10 @@ async function drainActivitySummary(turn) {
|
|
|
54344
54974
|
const target = turn.activityPendingRender;
|
|
54345
54975
|
if (target == null)
|
|
54346
54976
|
break;
|
|
54347
|
-
const html =
|
|
54977
|
+
const html = target;
|
|
54348
54978
|
const chat = turn.sessionChatId;
|
|
54349
54979
|
const thread = turn.sessionThreadId;
|
|
54350
|
-
const replyAnchor =
|
|
54980
|
+
const replyAnchor = turn.sourceMessageId != null ? { reply_parameters: { message_id: turn.sourceMessageId, allow_sending_without_reply: true } } : {};
|
|
54351
54981
|
try {
|
|
54352
54982
|
if (turn.activityMessageId == null) {
|
|
54353
54983
|
const sent = await robustApiCall(() => bot.api.sendMessage(chat, html, {
|
|
@@ -54425,7 +55055,6 @@ function handleSessionEvent(ev) {
|
|
|
54425
55055
|
lastAssistantMsgId: null,
|
|
54426
55056
|
lastAssistantDone: false,
|
|
54427
55057
|
toolCallCount: 0,
|
|
54428
|
-
toolActivity: makeEmptyActivityState(),
|
|
54429
55058
|
activityMessageId: null,
|
|
54430
55059
|
activityInFlight: null,
|
|
54431
55060
|
activityPendingRender: null,
|
|
@@ -54505,15 +55134,6 @@ function handleSessionEvent(ev) {
|
|
|
54505
55134
|
clearActivitySummary(turn);
|
|
54506
55135
|
}
|
|
54507
55136
|
}
|
|
54508
|
-
if (!DRAFT_MIRROR_ENABLED && !turn.replyCalled && !isTelegramSurfaceTool(name)) {
|
|
54509
|
-
const rendered = registerAndRender(turn.toolActivity, name);
|
|
54510
|
-
if (rendered != null) {
|
|
54511
|
-
turn.activityPendingRender = rendered;
|
|
54512
|
-
if (turn.activityInFlight == null) {
|
|
54513
|
-
turn.activityInFlight = drainActivitySummary(turn);
|
|
54514
|
-
}
|
|
54515
|
-
}
|
|
54516
|
-
}
|
|
54517
55137
|
if (!ctrl)
|
|
54518
55138
|
return;
|
|
54519
55139
|
if (isTelegramSurfaceTool(name))
|
|
@@ -54525,8 +55145,6 @@ function handleSessionEvent(ev) {
|
|
|
54525
55145
|
return;
|
|
54526
55146
|
}
|
|
54527
55147
|
case "tool_label": {
|
|
54528
|
-
if (!DRAFT_MIRROR_ENABLED)
|
|
54529
|
-
return;
|
|
54530
55148
|
const turn = currentTurn;
|
|
54531
55149
|
if (turn == null)
|
|
54532
55150
|
return;
|
|
@@ -54672,7 +55290,7 @@ function handleSessionEvent(ev) {
|
|
|
54672
55290
|
clearTimeout(turn.orphanedReplyTimeoutId);
|
|
54673
55291
|
turn.orphanedReplyTimeoutId = null;
|
|
54674
55292
|
}
|
|
54675
|
-
if (
|
|
55293
|
+
if (turn != null) {
|
|
54676
55294
|
clearActivitySummary(turn);
|
|
54677
55295
|
}
|
|
54678
55296
|
preambleSuppressor.flushNow();
|
|
@@ -55904,14 +56522,14 @@ function restartMarkerPath() {
|
|
|
55904
56522
|
const agentDir = resolveAgentDirFromEnv();
|
|
55905
56523
|
if (!agentDir)
|
|
55906
56524
|
return null;
|
|
55907
|
-
return
|
|
56525
|
+
return join36(agentDir, "restart-pending.json");
|
|
55908
56526
|
}
|
|
55909
56527
|
function writeRestartMarker(marker) {
|
|
55910
56528
|
const p = restartMarkerPath();
|
|
55911
56529
|
if (!p)
|
|
55912
56530
|
return;
|
|
55913
56531
|
try {
|
|
55914
|
-
|
|
56532
|
+
writeFileSync25(p, JSON.stringify(marker));
|
|
55915
56533
|
lastPlannedRestartAt = Date.now();
|
|
55916
56534
|
process.stderr.write(`telegram gateway: restart-marker: write chat_id=${marker.chat_id} thread_id=${marker.thread_id ?? "-"} ack=${marker.ack_message_id ?? "-"} path=${p}
|
|
55917
56535
|
`);
|
|
@@ -55930,7 +56548,7 @@ function readRestartMarker() {
|
|
|
55930
56548
|
if (!p)
|
|
55931
56549
|
return null;
|
|
55932
56550
|
try {
|
|
55933
|
-
return JSON.parse(
|
|
56551
|
+
return JSON.parse(readFileSync36(p, "utf8"));
|
|
55934
56552
|
} catch {
|
|
55935
56553
|
return null;
|
|
55936
56554
|
}
|
|
@@ -56028,7 +56646,7 @@ var _dockerReachable;
|
|
|
56028
56646
|
function isDockerReachable() {
|
|
56029
56647
|
if (_dockerReachable !== undefined)
|
|
56030
56648
|
return _dockerReachable;
|
|
56031
|
-
if (!
|
|
56649
|
+
if (!existsSync39("/var/run/docker.sock")) {
|
|
56032
56650
|
_dockerReachable = false;
|
|
56033
56651
|
return _dockerReachable;
|
|
56034
56652
|
}
|
|
@@ -56045,12 +56663,12 @@ function _resetDockerReachableCache() {
|
|
|
56045
56663
|
}
|
|
56046
56664
|
function spawnSwitchroomDetached(args, onFailure) {
|
|
56047
56665
|
const fullArgs = SWITCHROOM_CONFIG ? ["--config", SWITCHROOM_CONFIG, ...args] : args;
|
|
56048
|
-
const logPath =
|
|
56666
|
+
const logPath = join36(STATE_DIR, "detached-spawn.log");
|
|
56049
56667
|
let outFd = null;
|
|
56050
56668
|
try {
|
|
56051
|
-
|
|
56669
|
+
mkdirSync26(STATE_DIR, { recursive: true });
|
|
56052
56670
|
outFd = openSync8(logPath, "a");
|
|
56053
|
-
|
|
56671
|
+
writeFileSync25(logPath, `
|
|
56054
56672
|
[${new Date().toISOString()}] spawn ${SWITCHROOM_CLI} ${fullArgs.join(" ")}
|
|
56055
56673
|
`, { flag: "a" });
|
|
56056
56674
|
} catch {}
|
|
@@ -56076,7 +56694,7 @@ function spawnSwitchroomDetached(args, onFailure) {
|
|
|
56076
56694
|
return;
|
|
56077
56695
|
let tail = "";
|
|
56078
56696
|
try {
|
|
56079
|
-
const full =
|
|
56697
|
+
const full = readFileSync36(logPath, "utf8");
|
|
56080
56698
|
tail = full.split(`
|
|
56081
56699
|
`).slice(-30).join(`
|
|
56082
56700
|
`).trim();
|
|
@@ -56418,10 +57036,10 @@ bot.use(async (ctx, next) => {
|
|
|
56418
57036
|
});
|
|
56419
57037
|
function readRecentDenialsForAgent(agentName3, windowMs, limit) {
|
|
56420
57038
|
try {
|
|
56421
|
-
const auditPath =
|
|
56422
|
-
if (!
|
|
57039
|
+
const auditPath = join36(homedir14(), ".switchroom", "vault-audit.log");
|
|
57040
|
+
if (!existsSync39(auditPath))
|
|
56423
57041
|
return [];
|
|
56424
|
-
const raw =
|
|
57042
|
+
const raw = readFileSync36(auditPath, "utf8");
|
|
56425
57043
|
return recentDenialsFromAuditLog(raw, { agentName: agentName3, windowMs, limit });
|
|
56426
57044
|
} catch {
|
|
56427
57045
|
return [];
|
|
@@ -56472,7 +57090,7 @@ async function buildAgentMetadata(agentName3) {
|
|
|
56472
57090
|
try {
|
|
56473
57091
|
const agentDir = resolveAgentDirFromEnv();
|
|
56474
57092
|
if (agentDir) {
|
|
56475
|
-
const raw =
|
|
57093
|
+
const raw = readFileSync36(join36(agentDir, ".claude", ".claude.json"), "utf8");
|
|
56476
57094
|
claudeJson = JSON.parse(raw);
|
|
56477
57095
|
}
|
|
56478
57096
|
} catch {}
|
|
@@ -56686,10 +57304,10 @@ bot.command("restart", async (ctx) => {
|
|
|
56686
57304
|
function flushAgentHandoff(agentDir) {
|
|
56687
57305
|
let removed = 0;
|
|
56688
57306
|
for (const fname of [".handoff.md", ".handoff-topic"]) {
|
|
56689
|
-
const p =
|
|
57307
|
+
const p = join36(agentDir, fname);
|
|
56690
57308
|
try {
|
|
56691
|
-
if (
|
|
56692
|
-
|
|
57309
|
+
if (existsSync39(p)) {
|
|
57310
|
+
unlinkSync15(p);
|
|
56693
57311
|
removed++;
|
|
56694
57312
|
}
|
|
56695
57313
|
} catch (err) {
|
|
@@ -56744,7 +57362,7 @@ async function handleNewOrResetCommand(ctx, kind) {
|
|
|
56744
57362
|
writeRestartMarker({ chat_id: chatId, thread_id: threadId ?? null, ack_message_id: ackId, ts: Date.now() });
|
|
56745
57363
|
if (agentDir != null) {
|
|
56746
57364
|
try {
|
|
56747
|
-
|
|
57365
|
+
writeFileSync25(join36(agentDir, ".force-fresh-session"), `${kind} at ${new Date().toISOString()}
|
|
56748
57366
|
`, "utf8");
|
|
56749
57367
|
} catch (err) {
|
|
56750
57368
|
process.stderr.write(`telegram gateway: failed to write force-fresh marker: ${err}
|
|
@@ -57103,16 +57721,16 @@ bot.command("interrupt", async (ctx) => {
|
|
|
57103
57721
|
await runSwitchroomCommand(ctx, ["agent", "interrupt", name], `interrupt ${name}`);
|
|
57104
57722
|
});
|
|
57105
57723
|
var lockoutOps = {
|
|
57106
|
-
readFileSync: (p, enc) =>
|
|
57107
|
-
writeFileSync: (p, data, opts) =>
|
|
57108
|
-
existsSync: (p) =>
|
|
57109
|
-
mkdirSync: (p, opts) =>
|
|
57110
|
-
joinPath: (...parts) =>
|
|
57724
|
+
readFileSync: (p, enc) => readFileSync36(p, enc),
|
|
57725
|
+
writeFileSync: (p, data, opts) => writeFileSync25(p, data, opts),
|
|
57726
|
+
existsSync: (p) => existsSync39(p),
|
|
57727
|
+
mkdirSync: (p, opts) => mkdirSync26(p, opts),
|
|
57728
|
+
joinPath: (...parts) => join36(...parts)
|
|
57111
57729
|
};
|
|
57112
57730
|
var FLEET_FALLBACK_DEDUP_MS = 30000;
|
|
57113
57731
|
function isAuthBrokerSocketReachable() {
|
|
57114
57732
|
try {
|
|
57115
|
-
return
|
|
57733
|
+
return existsSync39(resolveAuthBrokerSocketPath2());
|
|
57116
57734
|
} catch {
|
|
57117
57735
|
return false;
|
|
57118
57736
|
}
|
|
@@ -57173,7 +57791,7 @@ async function runCreditWatch() {
|
|
|
57173
57791
|
if (!agentDir)
|
|
57174
57792
|
return;
|
|
57175
57793
|
const agentName3 = getMyAgentName();
|
|
57176
|
-
const claudeConfigDir =
|
|
57794
|
+
const claudeConfigDir = join36(agentDir, ".claude");
|
|
57177
57795
|
const stateDir = STATE_DIR;
|
|
57178
57796
|
const reason = readClaudeJsonOverage(claudeConfigDir);
|
|
57179
57797
|
const prev = loadCreditState(stateDir);
|
|
@@ -57476,10 +58094,10 @@ async function handleVaultRecentDenialCallback(ctx, data) {
|
|
|
57476
58094
|
return;
|
|
57477
58095
|
}
|
|
57478
58096
|
const { token, id } = result;
|
|
57479
|
-
const tokenPath =
|
|
58097
|
+
const tokenPath = join36(homedir14(), ".switchroom", "agents", agentName3, ".vault-token");
|
|
57480
58098
|
try {
|
|
57481
|
-
|
|
57482
|
-
|
|
58099
|
+
mkdirSync26(join36(homedir14(), ".switchroom", "agents", agentName3), { recursive: true });
|
|
58100
|
+
writeFileSync25(tokenPath, token, { mode: 384 });
|
|
57483
58101
|
} catch (err) {
|
|
57484
58102
|
await switchroomReply(ctx, `<b>Grant created (${escapeHtmlForTg(id)}) but token write failed:</b> ${escapeHtmlForTg(String(err))}
|
|
57485
58103
|
<i>Recover with: <code>switchroom vault grant ${escapeHtmlForTg(agentName3)} --keys ${escapeHtmlForTg(keyName)} --duration 30d</code> on the host.</i>`, { html: true });
|
|
@@ -57555,10 +58173,10 @@ async function performVaultAccessApproval(ctx, pending2, stageId, senderId, atte
|
|
|
57555
58173
|
return;
|
|
57556
58174
|
}
|
|
57557
58175
|
const { token, id } = result;
|
|
57558
|
-
const tokenPath =
|
|
58176
|
+
const tokenPath = join36(homedir14(), ".switchroom", "agents", pending2.agent, ".vault-token");
|
|
57559
58177
|
try {
|
|
57560
|
-
|
|
57561
|
-
|
|
58178
|
+
mkdirSync26(join36(homedir14(), ".switchroom", "agents", pending2.agent), { recursive: true });
|
|
58179
|
+
writeFileSync25(tokenPath, token, { mode: 384 });
|
|
57562
58180
|
} catch (err) {
|
|
57563
58181
|
await switchroomReply(ctx, `<b>Grant created (${escapeHtmlForTg(id)}) but token write failed:</b> ${escapeHtmlForTg(String(err))}
|
|
57564
58182
|
<i>Recover with: <code>switchroom vault grant ${escapeHtmlForTg(pending2.agent)} --keys ${escapeHtmlForTg(pending2.key)} --duration ${Math.round(pending2.ttl_seconds / 86400)}d</code> on the host.</i>`, { html: true });
|
|
@@ -58033,10 +58651,10 @@ async function executeGrantWizard(ctx, chatId, state4) {
|
|
|
58033
58651
|
return;
|
|
58034
58652
|
}
|
|
58035
58653
|
const { token, id } = result;
|
|
58036
|
-
const tokenPath =
|
|
58654
|
+
const tokenPath = join36(homedir14(), ".switchroom", "agents", state4.agent, ".vault-token");
|
|
58037
58655
|
try {
|
|
58038
|
-
|
|
58039
|
-
|
|
58656
|
+
mkdirSync26(join36(homedir14(), ".switchroom", "agents", state4.agent), { recursive: true });
|
|
58657
|
+
writeFileSync25(tokenPath, token, { mode: 384 });
|
|
58040
58658
|
} catch (err) {
|
|
58041
58659
|
await switchroomReply(ctx, `<b>Grant created but token write failed:</b> ${escapeHtmlForTg(String(err))}`, { html: true });
|
|
58042
58660
|
return;
|
|
@@ -58884,7 +59502,7 @@ bot.command("usage", async (ctx) => {
|
|
|
58884
59502
|
await switchroomReply(ctx, "<b>/usage:</b> cannot resolve agent dir.", { html: true });
|
|
58885
59503
|
return;
|
|
58886
59504
|
}
|
|
58887
|
-
const result = await fetchQuota2({ claudeConfigDir:
|
|
59505
|
+
const result = await fetchQuota2({ claudeConfigDir: join36(agentDir, ".claude") });
|
|
58888
59506
|
if (!result.ok) {
|
|
58889
59507
|
await switchroomReply(ctx, `<b>/usage:</b> ${escapeHtmlForTg(result.reason)}`, { html: true });
|
|
58890
59508
|
return;
|
|
@@ -59325,7 +59943,7 @@ ${prettyInput}`;
|
|
|
59325
59943
|
const unifiedDiff = (() => {
|
|
59326
59944
|
try {
|
|
59327
59945
|
const cfgPath = process.env.SWITCHROOM_CONFIG ?? SWITCHROOM_CONFIG ?? findConfigFile2();
|
|
59328
|
-
const raw =
|
|
59946
|
+
const raw = readFileSync36(cfgPath, "utf8");
|
|
59329
59947
|
return synthesizeAllowRuleDiff({ agentName: agentName3, rule: rule.rule, configText: raw });
|
|
59330
59948
|
} catch (err) {
|
|
59331
59949
|
process.stderr.write(`telegram gateway: always-allow diff synth failed: ${err.message}
|
|
@@ -59462,9 +60080,9 @@ bot.on("message:photo", async (ctx) => {
|
|
|
59462
60080
|
fileUniqueId: best.file_unique_id,
|
|
59463
60081
|
now: Date.now()
|
|
59464
60082
|
});
|
|
59465
|
-
|
|
60083
|
+
mkdirSync26(INBOX_DIR, { recursive: true, mode: 448 });
|
|
59466
60084
|
assertInsideInbox(INBOX_DIR, dlPath);
|
|
59467
|
-
|
|
60085
|
+
writeFileSync25(dlPath, buf, { mode: 384 });
|
|
59468
60086
|
return dlPath;
|
|
59469
60087
|
} catch (err) {
|
|
59470
60088
|
const msg = err instanceof Error ? err.message : "unknown error";
|
|
@@ -59504,8 +60122,8 @@ async function maybeTranscribeVoice(fileId, mimeType, language) {
|
|
|
59504
60122
|
let apiKey = null;
|
|
59505
60123
|
try {
|
|
59506
60124
|
const path = __require("path").join(__require("os").homedir(), ".switchroom", "openai-api-key");
|
|
59507
|
-
if (
|
|
59508
|
-
apiKey =
|
|
60125
|
+
if (existsSync39(path)) {
|
|
60126
|
+
apiKey = readFileSync36(path, "utf-8").trim();
|
|
59509
60127
|
}
|
|
59510
60128
|
} catch (err) {
|
|
59511
60129
|
process.stderr.write(`telegram gateway: voice-in: failed to read api key: ${err.message}
|
|
@@ -60361,7 +60979,7 @@ var didOneTimeSetup = false;
|
|
|
60361
60979
|
return;
|
|
60362
60980
|
}
|
|
60363
60981
|
})();
|
|
60364
|
-
const resolvedAgentDirForBootCard = agentDir ??
|
|
60982
|
+
const resolvedAgentDirForBootCard = agentDir ?? join36(homedir14(), ".switchroom", "agents", agentSlug);
|
|
60365
60983
|
const handle = await startBootCard(chatId, threadId, botApiForCard, {
|
|
60366
60984
|
agentName: agentDisplayName,
|
|
60367
60985
|
agentSlug,
|
|
@@ -60375,7 +60993,7 @@ var didOneTimeSetup = false;
|
|
|
60375
60993
|
probeQuotaViaBroker: (t) => probeQuotaForBootCard(agentSlug, t),
|
|
60376
60994
|
tmuxSupervisor: process.env.SWITCHROOM_TMUX_SUPERVISOR === "1",
|
|
60377
60995
|
dockerMode: process.env.SWITCHROOM_RUNTIME === "docker",
|
|
60378
|
-
configSnapshotPath:
|
|
60996
|
+
configSnapshotPath: join36(resolvedAgentDirForBootCard, ".config-snapshot.json"),
|
|
60379
60997
|
...updateOutcomeLine ? { updateOutcomeLine } : {}
|
|
60380
60998
|
}, ackMsgId);
|
|
60381
60999
|
activeBootCard = handle;
|