switchroom 0.13.52 → 0.13.54
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 +399 -213
- package/dist/auth-broker/index.js +576 -237
- package/dist/cli/drive-write-pretool.mjs +28 -13
- package/dist/cli/ms-365-write-pretool.mjs +259 -0
- package/dist/cli/skill-validate-pretool.mjs +72 -72
- package/dist/cli/switchroom.js +3241 -1382
- package/dist/host-control/main.js +396 -276
- package/dist/vault/approvals/kernel-server.js +8266 -8142
- package/dist/vault/broker/server.js +2894 -2770
- package/package.json +1 -1
- package/profiles/_base/start.sh.hbs +17 -0
- package/profiles/_shared/telegram-style.md.hbs +2 -0
- package/skills/switchroom-status/SKILL.md +8 -6
- package/telegram-plugin/chat-lock.ts +87 -19
- package/telegram-plugin/dist/bridge/bridge.js +112 -112
- package/telegram-plugin/dist/gateway/gateway.js +1283 -343
- package/telegram-plugin/dist/server.js +160 -160
- package/telegram-plugin/gateway/disconnect-flush.ts +32 -0
- package/telegram-plugin/gateway/gateway.ts +485 -72
- package/telegram-plugin/gateway/inbound-coalesce.ts +19 -6
- package/telegram-plugin/gateway/ipc-protocol.ts +37 -0
- package/telegram-plugin/gateway/ipc-server.ts +59 -0
- package/telegram-plugin/gateway/ms365-write-approval.test.ts +314 -0
- package/telegram-plugin/gateway/ms365-write-approval.ts +335 -0
- package/telegram-plugin/stream-reply-handler.ts +10 -8
- package/telegram-plugin/tests/gateway-disconnect-flush.test.ts +116 -0
- package/telegram-plugin/tests/inbound-coalesce.test.ts +20 -4
- package/telegram-plugin/tests/ipc-validator.test.ts +61 -0
- package/telegram-plugin/tests/outbound-ordering.test.ts +228 -0
- package/telegram-plugin/tests/parallel-turns-deadlock-fix.test.ts +217 -0
- package/telegram-plugin/tests/slash-command-smart-split.test.ts +115 -0
- package/telegram-plugin/tests/typing-wrap.test.ts +65 -8
- package/telegram-plugin/typing-wrap.ts +43 -21
- package/vendor/hindsight-memory/scripts/lib/gateway_ipc.py +35 -0
- package/vendor/hindsight-memory/scripts/recall.py +164 -4
- package/vendor/hindsight-memory/scripts/retain.py +52 -0
- package/vendor/hindsight-memory/scripts/tests/test_gateway_ipc.py +42 -0
- package/vendor/hindsight-memory/scripts/tests/test_recall_topic_filter.py +139 -0
- package/profiles/default/CLAUDE.md +0 -122
|
@@ -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();
|
|
@@ -16105,11 +16105,11 @@ function decodeResponse(line) {
|
|
|
16105
16105
|
}
|
|
16106
16106
|
return ResponseSchema.parse(parsed);
|
|
16107
16107
|
}
|
|
16108
|
-
var MAX_FRAME_BYTES, PROTOCOL_VERSION = 1, ProviderNameSchema, GetCredentialsRequestSchema, ListStateRequestSchema, SetActiveRequestSchema, MarkExhaustedRequestSchema, RefreshAccountRequestSchema, AnthropicCredentialsSchema, GoogleCredentialsSchema, ProviderCredentialsSchema, AddAccountRequestSchema, RmAccountRequestSchema, SetOverrideRequestSchema, ListGoogleAccountsRequestSchema, ProbeQuotaRequestSchema, RequestSchema, GetCredentialsDataSchema, AccountStateSchema, AgentStateSchema, ConsumerStateSchema, ListStateDataSchema, SetActiveDataSchema, MarkExhaustedDataSchema, RefreshAccountDataSchema, AddAccountDataSchema, RmAccountDataSchema, SetOverrideDataSchema, GoogleAccountStateSchema, ListGoogleAccountsDataSchema, ErrorBodySchema, SuccessResponseSchema, ErrorResponseSchema, ResponseSchema;
|
|
16108
|
+
var MAX_FRAME_BYTES, PROTOCOL_VERSION = 1, ProviderNameSchema, GetCredentialsRequestSchema, ListStateRequestSchema, SetActiveRequestSchema, MarkExhaustedRequestSchema, RefreshAccountRequestSchema, AnthropicCredentialsSchema, GoogleCredentialsSchema, MicrosoftCredentialsSchema, ProviderCredentialsSchema, AddAccountRequestSchema, RmAccountRequestSchema, SetOverrideRequestSchema, ListGoogleAccountsRequestSchema, ProbeQuotaRequestSchema, RequestSchema, GetCredentialsDataSchema, AccountStateSchema, AgentStateSchema, ConsumerStateSchema, ListStateDataSchema, SetActiveDataSchema, MarkExhaustedDataSchema, RefreshAccountDataSchema, AddAccountDataSchema, RmAccountDataSchema, SetOverrideDataSchema, GoogleAccountStateSchema, ListGoogleAccountsDataSchema, ErrorBodySchema, SuccessResponseSchema, ErrorResponseSchema, ResponseSchema;
|
|
16109
16109
|
var init_protocol = __esm(() => {
|
|
16110
16110
|
init_zod();
|
|
16111
16111
|
MAX_FRAME_BYTES = 64 * 1024;
|
|
16112
|
-
ProviderNameSchema = exports_external.enum(["anthropic", "google"]);
|
|
16112
|
+
ProviderNameSchema = exports_external.enum(["anthropic", "google", "microsoft"]);
|
|
16113
16113
|
GetCredentialsRequestSchema = exports_external.object({
|
|
16114
16114
|
v: exports_external.literal(PROTOCOL_VERSION),
|
|
16115
16115
|
op: exports_external.literal("get-credentials"),
|
|
@@ -16162,9 +16162,24 @@ var init_protocol = __esm(() => {
|
|
|
16162
16162
|
tokenType: exports_external.literal("Bearer")
|
|
16163
16163
|
})
|
|
16164
16164
|
});
|
|
16165
|
+
MicrosoftCredentialsSchema = exports_external.object({
|
|
16166
|
+
microsoftOauth: exports_external.object({
|
|
16167
|
+
accessToken: exports_external.string(),
|
|
16168
|
+
refreshToken: exports_external.string(),
|
|
16169
|
+
expiresAt: exports_external.number(),
|
|
16170
|
+
scope: exports_external.string(),
|
|
16171
|
+
clientId: exports_external.string(),
|
|
16172
|
+
accountEmail: exports_external.string(),
|
|
16173
|
+
tokenType: exports_external.literal("Bearer"),
|
|
16174
|
+
tenantId: exports_external.string(),
|
|
16175
|
+
accountType: exports_external.enum(["personal", "work"]),
|
|
16176
|
+
homeAccountId: exports_external.string()
|
|
16177
|
+
})
|
|
16178
|
+
});
|
|
16165
16179
|
ProviderCredentialsSchema = exports_external.union([
|
|
16166
16180
|
AnthropicCredentialsSchema,
|
|
16167
|
-
GoogleCredentialsSchema
|
|
16181
|
+
GoogleCredentialsSchema,
|
|
16182
|
+
MicrosoftCredentialsSchema
|
|
16168
16183
|
]);
|
|
16169
16184
|
AddAccountRequestSchema = exports_external.object({
|
|
16170
16185
|
v: exports_external.literal(PROTOCOL_VERSION),
|
|
@@ -16627,7 +16642,7 @@ var init_client = __esm(() => {
|
|
|
16627
16642
|
};
|
|
16628
16643
|
});
|
|
16629
16644
|
|
|
16630
|
-
//
|
|
16645
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/nodes/identity.js
|
|
16631
16646
|
var require_identity = __commonJS((exports2) => {
|
|
16632
16647
|
var ALIAS = Symbol.for("yaml.alias");
|
|
16633
16648
|
var DOC = Symbol.for("yaml.document");
|
|
@@ -16681,7 +16696,7 @@ var require_identity = __commonJS((exports2) => {
|
|
|
16681
16696
|
exports2.isSeq = isSeq;
|
|
16682
16697
|
});
|
|
16683
16698
|
|
|
16684
|
-
//
|
|
16699
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/visit.js
|
|
16685
16700
|
var require_visit = __commonJS((exports2) => {
|
|
16686
16701
|
var identity = require_identity();
|
|
16687
16702
|
var BREAK = Symbol("break visit");
|
|
@@ -16836,7 +16851,7 @@ var require_visit = __commonJS((exports2) => {
|
|
|
16836
16851
|
exports2.visitAsync = visitAsync;
|
|
16837
16852
|
});
|
|
16838
16853
|
|
|
16839
|
-
//
|
|
16854
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/doc/directives.js
|
|
16840
16855
|
var require_directives = __commonJS((exports2) => {
|
|
16841
16856
|
var identity = require_identity();
|
|
16842
16857
|
var visit = require_visit();
|
|
@@ -16988,7 +17003,7 @@ var require_directives = __commonJS((exports2) => {
|
|
|
16988
17003
|
exports2.Directives = Directives;
|
|
16989
17004
|
});
|
|
16990
17005
|
|
|
16991
|
-
//
|
|
17006
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/doc/anchors.js
|
|
16992
17007
|
var require_anchors = __commonJS((exports2) => {
|
|
16993
17008
|
var identity = require_identity();
|
|
16994
17009
|
var visit = require_visit();
|
|
@@ -17050,7 +17065,7 @@ var require_anchors = __commonJS((exports2) => {
|
|
|
17050
17065
|
exports2.findNewAnchor = findNewAnchor;
|
|
17051
17066
|
});
|
|
17052
17067
|
|
|
17053
|
-
//
|
|
17068
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/doc/applyReviver.js
|
|
17054
17069
|
var require_applyReviver = __commonJS((exports2) => {
|
|
17055
17070
|
function applyReviver(reviver, obj, key, val) {
|
|
17056
17071
|
if (val && typeof val === "object") {
|
|
@@ -17097,7 +17112,7 @@ var require_applyReviver = __commonJS((exports2) => {
|
|
|
17097
17112
|
exports2.applyReviver = applyReviver;
|
|
17098
17113
|
});
|
|
17099
17114
|
|
|
17100
|
-
//
|
|
17115
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/nodes/toJS.js
|
|
17101
17116
|
var require_toJS = __commonJS((exports2) => {
|
|
17102
17117
|
var identity = require_identity();
|
|
17103
17118
|
function toJS(value, arg, ctx) {
|
|
@@ -17124,7 +17139,7 @@ var require_toJS = __commonJS((exports2) => {
|
|
|
17124
17139
|
exports2.toJS = toJS;
|
|
17125
17140
|
});
|
|
17126
17141
|
|
|
17127
|
-
//
|
|
17142
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/nodes/Node.js
|
|
17128
17143
|
var require_Node = __commonJS((exports2) => {
|
|
17129
17144
|
var applyReviver = require_applyReviver();
|
|
17130
17145
|
var identity = require_identity();
|
|
@@ -17161,7 +17176,7 @@ var require_Node = __commonJS((exports2) => {
|
|
|
17161
17176
|
exports2.NodeBase = NodeBase;
|
|
17162
17177
|
});
|
|
17163
17178
|
|
|
17164
|
-
//
|
|
17179
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/nodes/Alias.js
|
|
17165
17180
|
var require_Alias = __commonJS((exports2) => {
|
|
17166
17181
|
var anchors = require_anchors();
|
|
17167
17182
|
var visit = require_visit();
|
|
@@ -17269,7 +17284,7 @@ var require_Alias = __commonJS((exports2) => {
|
|
|
17269
17284
|
exports2.Alias = Alias;
|
|
17270
17285
|
});
|
|
17271
17286
|
|
|
17272
|
-
//
|
|
17287
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/nodes/Scalar.js
|
|
17273
17288
|
var require_Scalar = __commonJS((exports2) => {
|
|
17274
17289
|
var identity = require_identity();
|
|
17275
17290
|
var Node = require_Node();
|
|
@@ -17297,7 +17312,7 @@ var require_Scalar = __commonJS((exports2) => {
|
|
|
17297
17312
|
exports2.isScalarValue = isScalarValue;
|
|
17298
17313
|
});
|
|
17299
17314
|
|
|
17300
|
-
//
|
|
17315
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/doc/createNode.js
|
|
17301
17316
|
var require_createNode = __commonJS((exports2) => {
|
|
17302
17317
|
var Alias = require_Alias();
|
|
17303
17318
|
var identity = require_identity();
|
|
@@ -17369,7 +17384,7 @@ var require_createNode = __commonJS((exports2) => {
|
|
|
17369
17384
|
exports2.createNode = createNode;
|
|
17370
17385
|
});
|
|
17371
17386
|
|
|
17372
|
-
//
|
|
17387
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/nodes/Collection.js
|
|
17373
17388
|
var require_Collection = __commonJS((exports2) => {
|
|
17374
17389
|
var createNode = require_createNode();
|
|
17375
17390
|
var identity = require_identity();
|
|
@@ -17484,7 +17499,7 @@ var require_Collection = __commonJS((exports2) => {
|
|
|
17484
17499
|
exports2.isEmptyPath = isEmptyPath;
|
|
17485
17500
|
});
|
|
17486
17501
|
|
|
17487
|
-
//
|
|
17502
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/stringify/stringifyComment.js
|
|
17488
17503
|
var require_stringifyComment = __commonJS((exports2) => {
|
|
17489
17504
|
var stringifyComment = (str) => str.replace(/^(?!$)(?: $)?/gm, "#");
|
|
17490
17505
|
function indentComment(comment, indent) {
|
|
@@ -17501,7 +17516,7 @@ var require_stringifyComment = __commonJS((exports2) => {
|
|
|
17501
17516
|
exports2.stringifyComment = stringifyComment;
|
|
17502
17517
|
});
|
|
17503
17518
|
|
|
17504
|
-
//
|
|
17519
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/stringify/foldFlowLines.js
|
|
17505
17520
|
var require_foldFlowLines = __commonJS((exports2) => {
|
|
17506
17521
|
var FOLD_FLOW = "flow";
|
|
17507
17522
|
var FOLD_BLOCK = "block";
|
|
@@ -17638,7 +17653,7 @@ ${indent}${text.slice(fold + 1, end2)}`;
|
|
|
17638
17653
|
exports2.foldFlowLines = foldFlowLines;
|
|
17639
17654
|
});
|
|
17640
17655
|
|
|
17641
|
-
//
|
|
17656
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/stringify/stringifyString.js
|
|
17642
17657
|
var require_stringifyString = __commonJS((exports2) => {
|
|
17643
17658
|
var Scalar = require_Scalar();
|
|
17644
17659
|
var foldFlowLines = require_foldFlowLines();
|
|
@@ -17936,7 +17951,7 @@ ${indent}`);
|
|
|
17936
17951
|
exports2.stringifyString = stringifyString;
|
|
17937
17952
|
});
|
|
17938
17953
|
|
|
17939
|
-
//
|
|
17954
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/stringify/stringify.js
|
|
17940
17955
|
var require_stringify = __commonJS((exports2) => {
|
|
17941
17956
|
var anchors = require_anchors();
|
|
17942
17957
|
var identity = require_identity();
|
|
@@ -18057,7 +18072,7 @@ ${ctx.indent}${str}`;
|
|
|
18057
18072
|
exports2.stringify = stringify;
|
|
18058
18073
|
});
|
|
18059
18074
|
|
|
18060
|
-
//
|
|
18075
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/stringify/stringifyPair.js
|
|
18061
18076
|
var require_stringifyPair = __commonJS((exports2) => {
|
|
18062
18077
|
var identity = require_identity();
|
|
18063
18078
|
var Scalar = require_Scalar();
|
|
@@ -18193,7 +18208,7 @@ ${ctx.indent}`;
|
|
|
18193
18208
|
exports2.stringifyPair = stringifyPair;
|
|
18194
18209
|
});
|
|
18195
18210
|
|
|
18196
|
-
//
|
|
18211
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/log.js
|
|
18197
18212
|
var require_log = __commonJS((exports2) => {
|
|
18198
18213
|
var node_process = __require("process");
|
|
18199
18214
|
function debug(logLevel, ...messages) {
|
|
@@ -18212,7 +18227,7 @@ var require_log = __commonJS((exports2) => {
|
|
|
18212
18227
|
exports2.warn = warn;
|
|
18213
18228
|
});
|
|
18214
18229
|
|
|
18215
|
-
//
|
|
18230
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/yaml-1.1/merge.js
|
|
18216
18231
|
var require_merge = __commonJS((exports2) => {
|
|
18217
18232
|
var identity = require_identity();
|
|
18218
18233
|
var Scalar = require_Scalar();
|
|
@@ -18266,7 +18281,7 @@ var require_merge = __commonJS((exports2) => {
|
|
|
18266
18281
|
exports2.merge = merge;
|
|
18267
18282
|
});
|
|
18268
18283
|
|
|
18269
|
-
//
|
|
18284
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/nodes/addPairToJSMap.js
|
|
18270
18285
|
var require_addPairToJSMap = __commonJS((exports2) => {
|
|
18271
18286
|
var log = require_log();
|
|
18272
18287
|
var merge = require_merge();
|
|
@@ -18327,7 +18342,7 @@ var require_addPairToJSMap = __commonJS((exports2) => {
|
|
|
18327
18342
|
exports2.addPairToJSMap = addPairToJSMap;
|
|
18328
18343
|
});
|
|
18329
18344
|
|
|
18330
|
-
//
|
|
18345
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/nodes/Pair.js
|
|
18331
18346
|
var require_Pair = __commonJS((exports2) => {
|
|
18332
18347
|
var createNode = require_createNode();
|
|
18333
18348
|
var stringifyPair = require_stringifyPair();
|
|
@@ -18365,7 +18380,7 @@ var require_Pair = __commonJS((exports2) => {
|
|
|
18365
18380
|
exports2.createPair = createPair;
|
|
18366
18381
|
});
|
|
18367
18382
|
|
|
18368
|
-
//
|
|
18383
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/stringify/stringifyCollection.js
|
|
18369
18384
|
var require_stringifyCollection = __commonJS((exports2) => {
|
|
18370
18385
|
var identity = require_identity();
|
|
18371
18386
|
var stringify = require_stringify();
|
|
@@ -18517,7 +18532,7 @@ ${indent}${end}`;
|
|
|
18517
18532
|
exports2.stringifyCollection = stringifyCollection;
|
|
18518
18533
|
});
|
|
18519
18534
|
|
|
18520
|
-
//
|
|
18535
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/nodes/YAMLMap.js
|
|
18521
18536
|
var require_YAMLMap = __commonJS((exports2) => {
|
|
18522
18537
|
var stringifyCollection = require_stringifyCollection();
|
|
18523
18538
|
var addPairToJSMap = require_addPairToJSMap();
|
|
@@ -18644,7 +18659,7 @@ var require_YAMLMap = __commonJS((exports2) => {
|
|
|
18644
18659
|
exports2.findPair = findPair;
|
|
18645
18660
|
});
|
|
18646
18661
|
|
|
18647
|
-
//
|
|
18662
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/common/map.js
|
|
18648
18663
|
var require_map = __commonJS((exports2) => {
|
|
18649
18664
|
var identity = require_identity();
|
|
18650
18665
|
var YAMLMap = require_YAMLMap();
|
|
@@ -18663,7 +18678,7 @@ var require_map = __commonJS((exports2) => {
|
|
|
18663
18678
|
exports2.map = map;
|
|
18664
18679
|
});
|
|
18665
18680
|
|
|
18666
|
-
//
|
|
18681
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/nodes/YAMLSeq.js
|
|
18667
18682
|
var require_YAMLSeq = __commonJS((exports2) => {
|
|
18668
18683
|
var createNode = require_createNode();
|
|
18669
18684
|
var stringifyCollection = require_stringifyCollection();
|
|
@@ -18756,7 +18771,7 @@ var require_YAMLSeq = __commonJS((exports2) => {
|
|
|
18756
18771
|
exports2.YAMLSeq = YAMLSeq;
|
|
18757
18772
|
});
|
|
18758
18773
|
|
|
18759
|
-
//
|
|
18774
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/common/seq.js
|
|
18760
18775
|
var require_seq = __commonJS((exports2) => {
|
|
18761
18776
|
var identity = require_identity();
|
|
18762
18777
|
var YAMLSeq = require_YAMLSeq();
|
|
@@ -18775,7 +18790,7 @@ var require_seq = __commonJS((exports2) => {
|
|
|
18775
18790
|
exports2.seq = seq;
|
|
18776
18791
|
});
|
|
18777
18792
|
|
|
18778
|
-
//
|
|
18793
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/common/string.js
|
|
18779
18794
|
var require_string = __commonJS((exports2) => {
|
|
18780
18795
|
var stringifyString = require_stringifyString();
|
|
18781
18796
|
var string = {
|
|
@@ -18791,7 +18806,7 @@ var require_string = __commonJS((exports2) => {
|
|
|
18791
18806
|
exports2.string = string;
|
|
18792
18807
|
});
|
|
18793
18808
|
|
|
18794
|
-
//
|
|
18809
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/common/null.js
|
|
18795
18810
|
var require_null = __commonJS((exports2) => {
|
|
18796
18811
|
var Scalar = require_Scalar();
|
|
18797
18812
|
var nullTag = {
|
|
@@ -18806,7 +18821,7 @@ var require_null = __commonJS((exports2) => {
|
|
|
18806
18821
|
exports2.nullTag = nullTag;
|
|
18807
18822
|
});
|
|
18808
18823
|
|
|
18809
|
-
//
|
|
18824
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/core/bool.js
|
|
18810
18825
|
var require_bool = __commonJS((exports2) => {
|
|
18811
18826
|
var Scalar = require_Scalar();
|
|
18812
18827
|
var boolTag = {
|
|
@@ -18827,7 +18842,7 @@ var require_bool = __commonJS((exports2) => {
|
|
|
18827
18842
|
exports2.boolTag = boolTag;
|
|
18828
18843
|
});
|
|
18829
18844
|
|
|
18830
|
-
//
|
|
18845
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/stringify/stringifyNumber.js
|
|
18831
18846
|
var require_stringifyNumber = __commonJS((exports2) => {
|
|
18832
18847
|
function stringifyNumber({ format, minFractionDigits, tag, value }) {
|
|
18833
18848
|
if (typeof value === "bigint")
|
|
@@ -18851,7 +18866,7 @@ var require_stringifyNumber = __commonJS((exports2) => {
|
|
|
18851
18866
|
exports2.stringifyNumber = stringifyNumber;
|
|
18852
18867
|
});
|
|
18853
18868
|
|
|
18854
|
-
//
|
|
18869
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/core/float.js
|
|
18855
18870
|
var require_float = __commonJS((exports2) => {
|
|
18856
18871
|
var Scalar = require_Scalar();
|
|
18857
18872
|
var stringifyNumber = require_stringifyNumber();
|
|
@@ -18894,7 +18909,7 @@ var require_float = __commonJS((exports2) => {
|
|
|
18894
18909
|
exports2.floatNaN = floatNaN;
|
|
18895
18910
|
});
|
|
18896
18911
|
|
|
18897
|
-
//
|
|
18912
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/core/int.js
|
|
18898
18913
|
var require_int = __commonJS((exports2) => {
|
|
18899
18914
|
var stringifyNumber = require_stringifyNumber();
|
|
18900
18915
|
var intIdentify = (value) => typeof value === "bigint" || Number.isInteger(value);
|
|
@@ -18936,7 +18951,7 @@ var require_int = __commonJS((exports2) => {
|
|
|
18936
18951
|
exports2.intOct = intOct;
|
|
18937
18952
|
});
|
|
18938
18953
|
|
|
18939
|
-
//
|
|
18954
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/core/schema.js
|
|
18940
18955
|
var require_schema = __commonJS((exports2) => {
|
|
18941
18956
|
var map = require_map();
|
|
18942
18957
|
var _null = require_null();
|
|
@@ -18961,7 +18976,7 @@ var require_schema = __commonJS((exports2) => {
|
|
|
18961
18976
|
exports2.schema = schema;
|
|
18962
18977
|
});
|
|
18963
18978
|
|
|
18964
|
-
//
|
|
18979
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/json/schema.js
|
|
18965
18980
|
var require_schema2 = __commonJS((exports2) => {
|
|
18966
18981
|
var Scalar = require_Scalar();
|
|
18967
18982
|
var map = require_map();
|
|
@@ -19025,7 +19040,7 @@ var require_schema2 = __commonJS((exports2) => {
|
|
|
19025
19040
|
exports2.schema = schema;
|
|
19026
19041
|
});
|
|
19027
19042
|
|
|
19028
|
-
//
|
|
19043
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/yaml-1.1/binary.js
|
|
19029
19044
|
var require_binary = __commonJS((exports2) => {
|
|
19030
19045
|
var node_buffer = __require("buffer");
|
|
19031
19046
|
var Scalar = require_Scalar();
|
|
@@ -19080,7 +19095,7 @@ var require_binary = __commonJS((exports2) => {
|
|
|
19080
19095
|
exports2.binary = binary;
|
|
19081
19096
|
});
|
|
19082
19097
|
|
|
19083
|
-
//
|
|
19098
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/yaml-1.1/pairs.js
|
|
19084
19099
|
var require_pairs = __commonJS((exports2) => {
|
|
19085
19100
|
var identity = require_identity();
|
|
19086
19101
|
var Pair = require_Pair();
|
|
@@ -19155,7 +19170,7 @@ ${cn.comment}` : item.comment;
|
|
|
19155
19170
|
exports2.resolvePairs = resolvePairs;
|
|
19156
19171
|
});
|
|
19157
19172
|
|
|
19158
|
-
//
|
|
19173
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/yaml-1.1/omap.js
|
|
19159
19174
|
var require_omap = __commonJS((exports2) => {
|
|
19160
19175
|
var identity = require_identity();
|
|
19161
19176
|
var toJS = require_toJS();
|
|
@@ -19227,7 +19242,7 @@ var require_omap = __commonJS((exports2) => {
|
|
|
19227
19242
|
exports2.omap = omap;
|
|
19228
19243
|
});
|
|
19229
19244
|
|
|
19230
|
-
//
|
|
19245
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/yaml-1.1/bool.js
|
|
19231
19246
|
var require_bool2 = __commonJS((exports2) => {
|
|
19232
19247
|
var Scalar = require_Scalar();
|
|
19233
19248
|
function boolStringify({ value, source }, ctx) {
|
|
@@ -19256,7 +19271,7 @@ var require_bool2 = __commonJS((exports2) => {
|
|
|
19256
19271
|
exports2.trueTag = trueTag;
|
|
19257
19272
|
});
|
|
19258
19273
|
|
|
19259
|
-
//
|
|
19274
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/yaml-1.1/float.js
|
|
19260
19275
|
var require_float2 = __commonJS((exports2) => {
|
|
19261
19276
|
var Scalar = require_Scalar();
|
|
19262
19277
|
var stringifyNumber = require_stringifyNumber();
|
|
@@ -19302,7 +19317,7 @@ var require_float2 = __commonJS((exports2) => {
|
|
|
19302
19317
|
exports2.floatNaN = floatNaN;
|
|
19303
19318
|
});
|
|
19304
19319
|
|
|
19305
|
-
//
|
|
19320
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/yaml-1.1/int.js
|
|
19306
19321
|
var require_int2 = __commonJS((exports2) => {
|
|
19307
19322
|
var stringifyNumber = require_stringifyNumber();
|
|
19308
19323
|
var intIdentify = (value) => typeof value === "bigint" || Number.isInteger(value);
|
|
@@ -19378,7 +19393,7 @@ var require_int2 = __commonJS((exports2) => {
|
|
|
19378
19393
|
exports2.intOct = intOct;
|
|
19379
19394
|
});
|
|
19380
19395
|
|
|
19381
|
-
//
|
|
19396
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/yaml-1.1/set.js
|
|
19382
19397
|
var require_set = __commonJS((exports2) => {
|
|
19383
19398
|
var identity = require_identity();
|
|
19384
19399
|
var Pair = require_Pair();
|
|
@@ -19461,7 +19476,7 @@ var require_set = __commonJS((exports2) => {
|
|
|
19461
19476
|
exports2.set = set;
|
|
19462
19477
|
});
|
|
19463
19478
|
|
|
19464
|
-
//
|
|
19479
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/yaml-1.1/timestamp.js
|
|
19465
19480
|
var require_timestamp = __commonJS((exports2) => {
|
|
19466
19481
|
var stringifyNumber = require_stringifyNumber();
|
|
19467
19482
|
function parseSexagesimal(str, asBigInt) {
|
|
@@ -19543,7 +19558,7 @@ var require_timestamp = __commonJS((exports2) => {
|
|
|
19543
19558
|
exports2.timestamp = timestamp;
|
|
19544
19559
|
});
|
|
19545
19560
|
|
|
19546
|
-
//
|
|
19561
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/yaml-1.1/schema.js
|
|
19547
19562
|
var require_schema3 = __commonJS((exports2) => {
|
|
19548
19563
|
var map = require_map();
|
|
19549
19564
|
var _null = require_null();
|
|
@@ -19584,7 +19599,7 @@ var require_schema3 = __commonJS((exports2) => {
|
|
|
19584
19599
|
exports2.schema = schema;
|
|
19585
19600
|
});
|
|
19586
19601
|
|
|
19587
|
-
//
|
|
19602
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/tags.js
|
|
19588
19603
|
var require_tags = __commonJS((exports2) => {
|
|
19589
19604
|
var map = require_map();
|
|
19590
19605
|
var _null = require_null();
|
|
@@ -19675,7 +19690,7 @@ var require_tags = __commonJS((exports2) => {
|
|
|
19675
19690
|
exports2.getTags = getTags;
|
|
19676
19691
|
});
|
|
19677
19692
|
|
|
19678
|
-
//
|
|
19693
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/Schema.js
|
|
19679
19694
|
var require_Schema = __commonJS((exports2) => {
|
|
19680
19695
|
var identity = require_identity();
|
|
19681
19696
|
var map = require_map();
|
|
@@ -19705,7 +19720,7 @@ var require_Schema = __commonJS((exports2) => {
|
|
|
19705
19720
|
exports2.Schema = Schema;
|
|
19706
19721
|
});
|
|
19707
19722
|
|
|
19708
|
-
//
|
|
19723
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/stringify/stringifyDocument.js
|
|
19709
19724
|
var require_stringifyDocument = __commonJS((exports2) => {
|
|
19710
19725
|
var identity = require_identity();
|
|
19711
19726
|
var stringify = require_stringify();
|
|
@@ -19785,7 +19800,7 @@ var require_stringifyDocument = __commonJS((exports2) => {
|
|
|
19785
19800
|
exports2.stringifyDocument = stringifyDocument;
|
|
19786
19801
|
});
|
|
19787
19802
|
|
|
19788
|
-
//
|
|
19803
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/doc/Document.js
|
|
19789
19804
|
var require_Document = __commonJS((exports2) => {
|
|
19790
19805
|
var Alias = require_Alias();
|
|
19791
19806
|
var Collection = require_Collection();
|
|
@@ -20020,7 +20035,7 @@ var require_Document = __commonJS((exports2) => {
|
|
|
20020
20035
|
exports2.Document = Document;
|
|
20021
20036
|
});
|
|
20022
20037
|
|
|
20023
|
-
//
|
|
20038
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/errors.js
|
|
20024
20039
|
var require_errors = __commonJS((exports2) => {
|
|
20025
20040
|
class YAMLError extends Error {
|
|
20026
20041
|
constructor(name, pos, code, message) {
|
|
@@ -20085,7 +20100,7 @@ ${pointer}
|
|
|
20085
20100
|
exports2.prettifyError = prettifyError;
|
|
20086
20101
|
});
|
|
20087
20102
|
|
|
20088
|
-
//
|
|
20103
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/compose/resolve-props.js
|
|
20089
20104
|
var require_resolve_props = __commonJS((exports2) => {
|
|
20090
20105
|
function resolveProps(tokens, { flow, indicator, next, offset, onError, parentIndent, startOnNewline }) {
|
|
20091
20106
|
let spaceBefore = false;
|
|
@@ -20215,7 +20230,7 @@ var require_resolve_props = __commonJS((exports2) => {
|
|
|
20215
20230
|
exports2.resolveProps = resolveProps;
|
|
20216
20231
|
});
|
|
20217
20232
|
|
|
20218
|
-
//
|
|
20233
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/compose/util-contains-newline.js
|
|
20219
20234
|
var require_util_contains_newline = __commonJS((exports2) => {
|
|
20220
20235
|
function containsNewline(key) {
|
|
20221
20236
|
if (!key)
|
|
@@ -20255,7 +20270,7 @@ var require_util_contains_newline = __commonJS((exports2) => {
|
|
|
20255
20270
|
exports2.containsNewline = containsNewline;
|
|
20256
20271
|
});
|
|
20257
20272
|
|
|
20258
|
-
//
|
|
20273
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/compose/util-flow-indent-check.js
|
|
20259
20274
|
var require_util_flow_indent_check = __commonJS((exports2) => {
|
|
20260
20275
|
var utilContainsNewline = require_util_contains_newline();
|
|
20261
20276
|
function flowIndentCheck(indent, fc, onError) {
|
|
@@ -20270,7 +20285,7 @@ var require_util_flow_indent_check = __commonJS((exports2) => {
|
|
|
20270
20285
|
exports2.flowIndentCheck = flowIndentCheck;
|
|
20271
20286
|
});
|
|
20272
20287
|
|
|
20273
|
-
//
|
|
20288
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/compose/util-map-includes.js
|
|
20274
20289
|
var require_util_map_includes = __commonJS((exports2) => {
|
|
20275
20290
|
var identity = require_identity();
|
|
20276
20291
|
function mapIncludes(ctx, items, search) {
|
|
@@ -20283,7 +20298,7 @@ var require_util_map_includes = __commonJS((exports2) => {
|
|
|
20283
20298
|
exports2.mapIncludes = mapIncludes;
|
|
20284
20299
|
});
|
|
20285
20300
|
|
|
20286
|
-
//
|
|
20301
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/compose/resolve-block-map.js
|
|
20287
20302
|
var require_resolve_block_map = __commonJS((exports2) => {
|
|
20288
20303
|
var Pair = require_Pair();
|
|
20289
20304
|
var YAMLMap = require_YAMLMap();
|
|
@@ -20390,7 +20405,7 @@ var require_resolve_block_map = __commonJS((exports2) => {
|
|
|
20390
20405
|
exports2.resolveBlockMap = resolveBlockMap;
|
|
20391
20406
|
});
|
|
20392
20407
|
|
|
20393
|
-
//
|
|
20408
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/compose/resolve-block-seq.js
|
|
20394
20409
|
var require_resolve_block_seq = __commonJS((exports2) => {
|
|
20395
20410
|
var YAMLSeq = require_YAMLSeq();
|
|
20396
20411
|
var resolveProps = require_resolve_props();
|
|
@@ -20438,7 +20453,7 @@ var require_resolve_block_seq = __commonJS((exports2) => {
|
|
|
20438
20453
|
exports2.resolveBlockSeq = resolveBlockSeq;
|
|
20439
20454
|
});
|
|
20440
20455
|
|
|
20441
|
-
//
|
|
20456
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/compose/resolve-end.js
|
|
20442
20457
|
var require_resolve_end = __commonJS((exports2) => {
|
|
20443
20458
|
function resolveEnd(end, offset, reqSpace, onError) {
|
|
20444
20459
|
let comment = "";
|
|
@@ -20478,7 +20493,7 @@ var require_resolve_end = __commonJS((exports2) => {
|
|
|
20478
20493
|
exports2.resolveEnd = resolveEnd;
|
|
20479
20494
|
});
|
|
20480
20495
|
|
|
20481
|
-
//
|
|
20496
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/compose/resolve-flow-collection.js
|
|
20482
20497
|
var require_resolve_flow_collection = __commonJS((exports2) => {
|
|
20483
20498
|
var identity = require_identity();
|
|
20484
20499
|
var Pair = require_Pair();
|
|
@@ -20669,7 +20684,7 @@ var require_resolve_flow_collection = __commonJS((exports2) => {
|
|
|
20669
20684
|
exports2.resolveFlowCollection = resolveFlowCollection;
|
|
20670
20685
|
});
|
|
20671
20686
|
|
|
20672
|
-
//
|
|
20687
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/compose/compose-collection.js
|
|
20673
20688
|
var require_compose_collection = __commonJS((exports2) => {
|
|
20674
20689
|
var identity = require_identity();
|
|
20675
20690
|
var Scalar = require_Scalar();
|
|
@@ -20731,7 +20746,7 @@ var require_compose_collection = __commonJS((exports2) => {
|
|
|
20731
20746
|
exports2.composeCollection = composeCollection;
|
|
20732
20747
|
});
|
|
20733
20748
|
|
|
20734
|
-
//
|
|
20749
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/compose/resolve-block-scalar.js
|
|
20735
20750
|
var require_resolve_block_scalar = __commonJS((exports2) => {
|
|
20736
20751
|
var Scalar = require_Scalar();
|
|
20737
20752
|
function resolveBlockScalar(ctx, scalar, onError) {
|
|
@@ -20924,7 +20939,7 @@ var require_resolve_block_scalar = __commonJS((exports2) => {
|
|
|
20924
20939
|
exports2.resolveBlockScalar = resolveBlockScalar;
|
|
20925
20940
|
});
|
|
20926
20941
|
|
|
20927
|
-
//
|
|
20942
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/compose/resolve-flow-scalar.js
|
|
20928
20943
|
var require_resolve_flow_scalar = __commonJS((exports2) => {
|
|
20929
20944
|
var Scalar = require_Scalar();
|
|
20930
20945
|
var resolveEnd = require_resolve_end();
|
|
@@ -21140,7 +21155,7 @@ var require_resolve_flow_scalar = __commonJS((exports2) => {
|
|
|
21140
21155
|
exports2.resolveFlowScalar = resolveFlowScalar;
|
|
21141
21156
|
});
|
|
21142
21157
|
|
|
21143
|
-
//
|
|
21158
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/compose/compose-scalar.js
|
|
21144
21159
|
var require_compose_scalar = __commonJS((exports2) => {
|
|
21145
21160
|
var identity = require_identity();
|
|
21146
21161
|
var Scalar = require_Scalar();
|
|
@@ -21218,7 +21233,7 @@ var require_compose_scalar = __commonJS((exports2) => {
|
|
|
21218
21233
|
exports2.composeScalar = composeScalar;
|
|
21219
21234
|
});
|
|
21220
21235
|
|
|
21221
|
-
//
|
|
21236
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/compose/util-empty-scalar-position.js
|
|
21222
21237
|
var require_util_empty_scalar_position = __commonJS((exports2) => {
|
|
21223
21238
|
function emptyScalarPosition(offset, before, pos) {
|
|
21224
21239
|
if (before) {
|
|
@@ -21245,7 +21260,7 @@ var require_util_empty_scalar_position = __commonJS((exports2) => {
|
|
|
21245
21260
|
exports2.emptyScalarPosition = emptyScalarPosition;
|
|
21246
21261
|
});
|
|
21247
21262
|
|
|
21248
|
-
//
|
|
21263
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/compose/compose-node.js
|
|
21249
21264
|
var require_compose_node = __commonJS((exports2) => {
|
|
21250
21265
|
var Alias = require_Alias();
|
|
21251
21266
|
var identity = require_identity();
|
|
@@ -21348,7 +21363,7 @@ var require_compose_node = __commonJS((exports2) => {
|
|
|
21348
21363
|
exports2.composeNode = composeNode;
|
|
21349
21364
|
});
|
|
21350
21365
|
|
|
21351
|
-
//
|
|
21366
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/compose/compose-doc.js
|
|
21352
21367
|
var require_compose_doc = __commonJS((exports2) => {
|
|
21353
21368
|
var Document = require_Document();
|
|
21354
21369
|
var composeNode = require_compose_node();
|
|
@@ -21388,7 +21403,7 @@ var require_compose_doc = __commonJS((exports2) => {
|
|
|
21388
21403
|
exports2.composeDoc = composeDoc;
|
|
21389
21404
|
});
|
|
21390
21405
|
|
|
21391
|
-
//
|
|
21406
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/compose/composer.js
|
|
21392
21407
|
var require_composer2 = __commonJS((exports2) => {
|
|
21393
21408
|
var node_process = __require("process");
|
|
21394
21409
|
var directives = require_directives();
|
|
@@ -21577,7 +21592,7 @@ ${end.comment}` : end.comment;
|
|
|
21577
21592
|
exports2.Composer = Composer;
|
|
21578
21593
|
});
|
|
21579
21594
|
|
|
21580
|
-
//
|
|
21595
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/parse/cst-scalar.js
|
|
21581
21596
|
var require_cst_scalar = __commonJS((exports2) => {
|
|
21582
21597
|
var resolveBlockScalar = require_resolve_block_scalar();
|
|
21583
21598
|
var resolveFlowScalar = require_resolve_flow_scalar();
|
|
@@ -21767,7 +21782,7 @@ var require_cst_scalar = __commonJS((exports2) => {
|
|
|
21767
21782
|
exports2.setScalarValue = setScalarValue;
|
|
21768
21783
|
});
|
|
21769
21784
|
|
|
21770
|
-
//
|
|
21785
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/parse/cst-stringify.js
|
|
21771
21786
|
var require_cst_stringify = __commonJS((exports2) => {
|
|
21772
21787
|
var stringify = (cst) => ("type" in cst) ? stringifyToken(cst) : stringifyItem(cst);
|
|
21773
21788
|
function stringifyToken(token) {
|
|
@@ -21825,7 +21840,7 @@ var require_cst_stringify = __commonJS((exports2) => {
|
|
|
21825
21840
|
exports2.stringify = stringify;
|
|
21826
21841
|
});
|
|
21827
21842
|
|
|
21828
|
-
//
|
|
21843
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/parse/cst-visit.js
|
|
21829
21844
|
var require_cst_visit = __commonJS((exports2) => {
|
|
21830
21845
|
var BREAK = Symbol("break visit");
|
|
21831
21846
|
var SKIP = Symbol("skip children");
|
|
@@ -21884,7 +21899,7 @@ var require_cst_visit = __commonJS((exports2) => {
|
|
|
21884
21899
|
exports2.visit = visit;
|
|
21885
21900
|
});
|
|
21886
21901
|
|
|
21887
|
-
//
|
|
21902
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/parse/cst.js
|
|
21888
21903
|
var require_cst = __commonJS((exports2) => {
|
|
21889
21904
|
var cstScalar = require_cst_scalar();
|
|
21890
21905
|
var cstStringify = require_cst_stringify();
|
|
@@ -21985,7 +22000,7 @@ var require_cst = __commonJS((exports2) => {
|
|
|
21985
22000
|
exports2.tokenType = tokenType;
|
|
21986
22001
|
});
|
|
21987
22002
|
|
|
21988
|
-
//
|
|
22003
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/parse/lexer.js
|
|
21989
22004
|
var require_lexer = __commonJS((exports2) => {
|
|
21990
22005
|
var cst = require_cst();
|
|
21991
22006
|
function isEmpty2(ch) {
|
|
@@ -22571,7 +22586,7 @@ var require_lexer = __commonJS((exports2) => {
|
|
|
22571
22586
|
exports2.Lexer = Lexer;
|
|
22572
22587
|
});
|
|
22573
22588
|
|
|
22574
|
-
//
|
|
22589
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/parse/line-counter.js
|
|
22575
22590
|
var require_line_counter = __commonJS((exports2) => {
|
|
22576
22591
|
class LineCounter {
|
|
22577
22592
|
constructor() {
|
|
@@ -22599,7 +22614,7 @@ var require_line_counter = __commonJS((exports2) => {
|
|
|
22599
22614
|
exports2.LineCounter = LineCounter;
|
|
22600
22615
|
});
|
|
22601
22616
|
|
|
22602
|
-
//
|
|
22617
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/parse/parser.js
|
|
22603
22618
|
var require_parser = __commonJS((exports2) => {
|
|
22604
22619
|
var node_process = __require("process");
|
|
22605
22620
|
var cst = require_cst();
|
|
@@ -23448,7 +23463,7 @@ var require_parser = __commonJS((exports2) => {
|
|
|
23448
23463
|
exports2.Parser = Parser;
|
|
23449
23464
|
});
|
|
23450
23465
|
|
|
23451
|
-
//
|
|
23466
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/public-api.js
|
|
23452
23467
|
var require_public_api = __commonJS((exports2) => {
|
|
23453
23468
|
var composer = require_composer2();
|
|
23454
23469
|
var Document = require_Document();
|
|
@@ -23542,7 +23557,7 @@ var require_public_api = __commonJS((exports2) => {
|
|
|
23542
23557
|
exports2.stringify = stringify;
|
|
23543
23558
|
});
|
|
23544
23559
|
|
|
23545
|
-
//
|
|
23560
|
+
// ../../switchroom-sec-1417/node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/index.js
|
|
23546
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;
|
|
23547
23562
|
var init_dist = __esm(() => {
|
|
23548
23563
|
composer = require_composer2();
|
|
@@ -23592,7 +23607,7 @@ var init_dist = __esm(() => {
|
|
|
23592
23607
|
});
|
|
23593
23608
|
|
|
23594
23609
|
// ../src/config/schema.ts
|
|
23595
|
-
var CodeRepoEntrySchema, AgentBindMountSchema, ScheduleEntrySchema, AgentSoulSchema, AgentToolsSchema, AgentMemorySchema, HookEntrySchema, AgentHooksSchema, SubagentSchema, SessionSchema, SessionContinuitySchema, TelegramChannelSchema, ChannelsSchema, TIMEZONE_REGEX, ApproverIdSchema, GoogleWorkspaceTierSchema, GoogleWorkspaceConfigSchema, AgentGoogleWorkspaceConfigSchema, ReactionsSchema, ReleaseBlock, NetworkIsolationSchema, profileFields, ProfileSchema, _omitExtends, defaultsFields, AgentDefaultsSchema, AgentSchema, TelegramConfigSchema, MemoryBackendConfigSchema, VaultConfigSchema, QuotaConfigSchema, AutoReleaseCheckSchema, HostControlConfigSchema, HostdConfigSchema, SwitchroomConfigSchema;
|
|
23610
|
+
var CodeRepoEntrySchema, AgentBindMountSchema, ScheduleEntrySchema, AgentSoulSchema, AgentToolsSchema, AgentMemorySchema, HookEntrySchema, AgentHooksSchema, SubagentSchema, SessionSchema, SessionContinuitySchema, TelegramChannelSchema, ChannelsSchema, TIMEZONE_REGEX, ApproverIdSchema, GoogleWorkspaceTierSchema, GoogleWorkspaceConfigSchema, MicrosoftWorkspaceConfigSchema, AgentGoogleWorkspaceConfigSchema, AgentMicrosoftWorkspaceConfigSchema, ReactionsSchema, ReleaseBlock, NetworkIsolationSchema, profileFields, ProfileSchema, _omitExtends, defaultsFields, AgentDefaultsSchema, AgentSchema, TelegramConfigSchema, MemoryBackendConfigSchema, VaultConfigSchema, QuotaConfigSchema, AutoReleaseCheckSchema, HostControlConfigSchema, HostdConfigSchema, SwitchroomConfigSchema;
|
|
23596
23611
|
var init_schema = __esm(() => {
|
|
23597
23612
|
init_zod();
|
|
23598
23613
|
CodeRepoEntrySchema = exports_external.object({
|
|
@@ -23609,7 +23624,11 @@ var init_schema = __esm(() => {
|
|
|
23609
23624
|
cron: exports_external.string().describe("Cron expression (e.g., '0 8 * * *')"),
|
|
23610
23625
|
prompt: exports_external.string().describe("Prompt to send at the scheduled time"),
|
|
23611
23626
|
model: exports_external.string().optional().describe("DEPRECATED / IGNORED. Pre-v0.8 the singleton scheduler ran each " + "task as an isolated headless invocation and could set --model per " + "task. Post cron-fold-in (v0.8) the fire is injected into the agent's " + "running session, so it always uses the agent's configured model " + "\u2014 this field has no effect. Accepted (optional) only so existing " + "configs keep validating; set the model at the agent level instead. " + "See docs/scheduling.md."),
|
|
23612
|
-
secrets: exports_external.array(exports_external.string().regex(/^[a-zA-Z0-9_\-/]+$/, "Secret key names must contain only alphanumeric characters, underscores, hyphens, and forward slashes")).default([]).describe("Vault key names this cron task may read via the vault-broker daemon. " + "Empty by default \u2014 broker requests for unlisted keys are denied. " + "Note: this is misconfiguration protection (a typo in cron-A doesn't " + "accidentally read cron-B's keys) rather than a security boundary \u2014 " + "anyone who can edit cron scripts can also edit switchroom.yaml, and " + "anyone with the vault passphrase can read the vault file directly. " + "See docs/configuration.md for the full framing.")
|
|
23627
|
+
secrets: exports_external.array(exports_external.string().regex(/^[a-zA-Z0-9_\-/]+$/, "Secret key names must contain only alphanumeric characters, underscores, hyphens, and forward slashes")).default([]).describe("Vault key names this cron task may read via the vault-broker daemon. " + "Empty by default \u2014 broker requests for unlisted keys are denied. " + "Note: this is misconfiguration protection (a typo in cron-A doesn't " + "accidentally read cron-B's keys) rather than a security boundary \u2014 " + "anyone who can edit cron scripts can also edit switchroom.yaml, and " + "anyone with the vault passphrase can read the vault file directly. " + "See docs/configuration.md for the full framing."),
|
|
23628
|
+
topic: exports_external.union([
|
|
23629
|
+
exports_external.string().min(1, "topic alias must be non-empty"),
|
|
23630
|
+
exports_external.number().int().positive("topic ID must be a positive integer")
|
|
23631
|
+
]).optional().describe("Forum topic this cron fires into when the owning agent is in " + "supergroup-owned mode (channels.telegram.chat_id set). Either a " + 'string alias resolved against `topic_aliases` (e.g. "planning") ' + "or a numeric topic ID. Falls back to the agent's `default_topic_id` " + "when unset. Ignored for agents in fleet-shared or dm_only mode. " + "Alias-resolution happens at config-load \u2014 typos surface immediately. " + "See docs/rfcs/supergroup-mode.md.")
|
|
23613
23632
|
});
|
|
23614
23633
|
AgentSoulSchema = exports_external.object({
|
|
23615
23634
|
name: exports_external.string().describe("Agent persona name (e.g., 'Coach', 'Sage')"),
|
|
@@ -23629,7 +23648,8 @@ var init_schema = __esm(() => {
|
|
|
23629
23648
|
recall: exports_external.object({
|
|
23630
23649
|
max_memories: exports_external.number().int().min(0).optional().describe("Cap on the number of memories injected into the prompt by " + "auto-recall, regardless of token budget. Plugin default is 12. " + "0 disables the cap (all memories Hindsight returns are injected)."),
|
|
23631
23650
|
cache_ttl_secs: exports_external.number().int().min(0).optional().describe("Per-session recall cache TTL in seconds. When > 0, identical " + "(prompt, bank) within the same session reuse the cached recall " + "result instead of round-tripping to Hindsight. 0 disables. " + "Default is 600 (10 min) for switchroom-managed agents."),
|
|
23632
|
-
min_overlap: exports_external.number().min(0).max(1).optional().describe("Minimum Jaccard token overlap [0.0\u20131.0] between the user " + "prompt and a memory's text for the memory to be injected. " + "Drops low-relevance matches before the count cap so weak hits " + "don't fill the slot on real queries. 0.0 disables (default \u2014 " + "current behaviour). Try 0.10\u20130.20 to start; observe the " + "`overlap_dropped` field via `switchroom memory recall-log`.")
|
|
23651
|
+
min_overlap: exports_external.number().min(0).max(1).optional().describe("Minimum Jaccard token overlap [0.0\u20131.0] between the user " + "prompt and a memory's text for the memory to be injected. " + "Drops low-relevance matches before the count cap so weak hits " + "don't fill the slot on real queries. 0.0 disables (default \u2014 " + "current behaviour). Try 0.10\u20130.20 to start; observe the " + "`overlap_dropped` field via `switchroom memory recall-log`."),
|
|
23652
|
+
topic_filter_mode: exports_external.enum(["soft-preamble", "hard-filter"]).optional().describe("Supergroup-mode cross-topic memory behaviour. Default " + "(unset) \u2192 soft-preamble: recall returns memories from all " + "topics, and a 'Current topic: \u2026' preamble tells the model " + "to self-scope. hard-filter: drop any recalled memory whose " + "metadata.thread_id differs from the active inbound's topic. " + "Flip to hard-filter when the recall_log shows binding " + "failures (model surfacing the right memory but applying " + "it to the wrong topic).")
|
|
23633
23653
|
}).optional().describe("Auto-recall tuning knobs")
|
|
23634
23654
|
}).optional();
|
|
23635
23655
|
HookEntrySchema = exports_external.object({
|
|
@@ -23721,8 +23741,35 @@ var init_schema = __esm(() => {
|
|
|
23721
23741
|
}).optional().describe("Auto-dispatch rules: when a verified webhook event matches a rule, " + "inject the rendered prompt into the agent's live session (#1625). " + "Supports cooldowns, quiet hours, and label/action matchers. " + "Off by default \u2014 opt in per agent. See src/web/webhook-dispatch.ts."),
|
|
23722
23742
|
webhook_rate_limit: exports_external.object({
|
|
23723
23743
|
rpm: exports_external.number().int().positive()
|
|
23724
|
-
}).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.")
|
|
23725
|
-
|
|
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
|
+
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
|
+
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
|
+
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.")
|
|
23748
|
+
}).optional().superRefine((tg, ctx) => {
|
|
23749
|
+
if (!tg)
|
|
23750
|
+
return;
|
|
23751
|
+
if (tg.chat_id != null && tg.default_topic_id == null) {
|
|
23752
|
+
ctx.addIssue({
|
|
23753
|
+
code: exports_external.ZodIssueCode.custom,
|
|
23754
|
+
message: "`channels.telegram.chat_id` requires `default_topic_id` \u2014 supergroup-mode agents need a fallback topic for unclassified outbounds.",
|
|
23755
|
+
path: ["default_topic_id"]
|
|
23756
|
+
});
|
|
23757
|
+
}
|
|
23758
|
+
if (tg.default_topic_id != null && tg.chat_id == null) {
|
|
23759
|
+
ctx.addIssue({
|
|
23760
|
+
code: exports_external.ZodIssueCode.custom,
|
|
23761
|
+
message: "`channels.telegram.default_topic_id` requires `chat_id` \u2014 default_topic_id is only meaningful when the agent owns its own supergroup.",
|
|
23762
|
+
path: ["chat_id"]
|
|
23763
|
+
});
|
|
23764
|
+
}
|
|
23765
|
+
if (tg.topic_aliases != null && tg.chat_id == null) {
|
|
23766
|
+
ctx.addIssue({
|
|
23767
|
+
code: exports_external.ZodIssueCode.custom,
|
|
23768
|
+
message: "`channels.telegram.topic_aliases` requires `chat_id` \u2014 aliases only resolve in supergroup-owned mode.",
|
|
23769
|
+
path: ["topic_aliases"]
|
|
23770
|
+
});
|
|
23771
|
+
}
|
|
23772
|
+
});
|
|
23726
23773
|
ChannelsSchema = exports_external.object({
|
|
23727
23774
|
telegram: TelegramChannelSchema
|
|
23728
23775
|
}).optional();
|
|
@@ -23739,6 +23786,12 @@ var init_schema = __esm(() => {
|
|
|
23739
23786
|
approvers: exports_external.array(ApproverIdSchema).min(1).describe("Array of numeric Telegram user IDs authorized to approve drive onboarding. " + "At least one must be specified."),
|
|
23740
23787
|
tier: GoogleWorkspaceTierSchema.optional().describe("RFC G Phase 1: which upstream MCP tier to expose. " + "core (default) = ~16 tools (Drive+Docs+Sheets+Calendar). " + "extended = ~40 tools (+Slides, Forms, Tasks, Chat). " + "complete = ~60+ tools (+Gmail; not recommended yet \u2014 see RFC G \u00a75).")
|
|
23741
23788
|
}).optional();
|
|
23789
|
+
MicrosoftWorkspaceConfigSchema = exports_external.object({
|
|
23790
|
+
microsoft_client_id: exports_external.string().min(1).describe("Microsoft OAuth application (client) ID from Entra portal " + "(literal string or vault reference e.g. " + "'vault:microsoft-oauth-client-id')."),
|
|
23791
|
+
microsoft_client_secret: exports_external.string().min(1).optional().describe("Microsoft OAuth client secret. Optional \u2014 public-client apps " + "(Mobile + Desktop platform with 'Allow public client flows' " + "enabled) work without a secret; confidential clients pass " + "one. Either literal or vault reference e.g. " + "'vault:microsoft-oauth-client-secret'."),
|
|
23792
|
+
authority: exports_external.string().url().optional().describe("Microsoft authority endpoint. Defaults to " + "'https://login.microsoftonline.com/common' which accepts both " + "personal MSA and work/school tenants. Override only for " + "single-tenant deployments."),
|
|
23793
|
+
org_mode: exports_external.boolean().optional().describe("Opt-in to Teams + SharePoint surfaces (RFC \u00a76.4). When true, " + "the v1 scope set adds Sites.ReadWrite.All AND the launcher " + "spawns softeria with --org-mode. Defaults to false \u2014 personal " + "MSA + standard work surfaces only. Flipping for an existing " + "consented account requires re-running 'auth microsoft account " + "add --replace' to consent the additional scope.")
|
|
23794
|
+
}).optional();
|
|
23742
23795
|
AgentGoogleWorkspaceConfigSchema = exports_external.object({
|
|
23743
23796
|
account: exports_external.string().regex(/^[^@\s:]+@[^@\s:]+\.[^@\s:]+$/, {
|
|
23744
23797
|
message: "google_workspace.account must be a Google account email like " + "'alice@example.com' (colons not allowed)"
|
|
@@ -23746,6 +23799,12 @@ var init_schema = __esm(() => {
|
|
|
23746
23799
|
approvers: exports_external.array(ApproverIdSchema).min(1).optional().describe("Per-agent approver override. When set, replaces (does not extend) " + "the top-level drive.approvers list for this agent's onboarding card."),
|
|
23747
23800
|
tier: GoogleWorkspaceTierSchema.optional().describe("Per-agent tier override (RFC G Phase 1). When set, replaces the " + "top-level google_workspace.tier for this agent. Common case: most " + "agents on `core`, one specialist on `extended` for Slides access.")
|
|
23748
23801
|
}).optional();
|
|
23802
|
+
AgentMicrosoftWorkspaceConfigSchema = exports_external.object({
|
|
23803
|
+
account: exports_external.string().regex(/^[^@\s:]+@[^@\s:]+\.[^@\s:]+$/, {
|
|
23804
|
+
message: "microsoft_workspace.account must be a Microsoft account email like " + "'alice@outlook.com' or 'alice@contoso.com' (colons not allowed)"
|
|
23805
|
+
}).transform((v) => v.trim().toLowerCase()).optional().describe("RFC #1873: the Microsoft account this agent uses for the M365 MCP. " + "Must be a key in top-level `microsoft_accounts:` with this agent " + "listed in its `enabled_for[]`. Read by the auth-broker " + "(get-credentials, provider=microsoft) and by the scaffold to " + "decide whether to emit the `ms-365` MCP entry. Normalized to " + "lowercase so it matches the microsoft_accounts key (which is " + "also normalized)."),
|
|
23806
|
+
org_mode: exports_external.boolean().optional().describe("Per-agent org_mode override (RFC #1873 \u00a76.4). When set, replaces " + "the top-level microsoft_workspace.org_mode for this agent. " + "Defaults to top-level value (which defaults to false).")
|
|
23807
|
+
}).optional();
|
|
23749
23808
|
ReactionsSchema = exports_external.object({
|
|
23750
23809
|
enabled: exports_external.boolean().optional().describe("Master switch for the reaction-trigger path. When false, " + "reactions are still persisted via recordReaction but never " + "dispatched to the agent as synthetic inbound turns. Default true."),
|
|
23751
23810
|
trigger_emojis: exports_external.array(exports_external.string()).optional().describe("Emoji allowlist that triggers a synthetic inbound when reacted " + "to a bot message. Default ['\uD83D\uDC4E', '\u274c', '\uD83D\uDC4D', '\u2705']. Cascade " + "mode: REPLACE (not union) \u2014 setting this at a layer replaces " + "lower layers entirely, so an operator can narrow to [] to " + "disable triggering without flipping `enabled`."),
|
|
@@ -23881,6 +23940,7 @@ var init_schema = __esm(() => {
|
|
|
23881
23940
|
code_repos: exports_external.array(CodeRepoEntrySchema).optional().describe("Git repositories this agent is allowed to claim worktrees from. " + "Each entry provides a short name alias, a source path, and an " + "optional concurrency cap (default 5). When code_repos is set, " + "claim_worktree accepts the alias as the repo argument. " + "Absolute paths may always be passed regardless of this list."),
|
|
23882
23941
|
drive: AgentGoogleWorkspaceConfigSchema.describe("RFC D legacy key \u2014 use `google_workspace:` instead. Per-agent " + "google_workspace overrides (currently approvers + tier). When set, " + "replaces the top-level approvers list for this agent. " + "google_client_id/secret are not per-agent \u2014 they live at the top level."),
|
|
23883
23942
|
google_workspace: AgentGoogleWorkspaceConfigSchema.describe("RFC G canonical key. Per-agent Google Workspace overrides \u2014 currently " + "approvers (replaces, does not extend the top-level list) and tier " + "(`core` | `extended` | `complete`, replaces top-level default). " + "google_client_id/secret are not per-agent \u2014 they live at the top level. " + "Mutually exclusive with `drive:` on the same agent (loader fails fast " + "if both are set)."),
|
|
23943
|
+
microsoft_workspace: AgentMicrosoftWorkspaceConfigSchema.describe("RFC #1873 (Microsoft 365 integration). Per-agent Microsoft Workspace " + "override \u2014 pins the Microsoft account this agent reads via the " + "auth-broker (must be a key in top-level `microsoft_accounts:` with " + "this agent in its `enabled_for[]`) and optionally overrides org_mode. " + "microsoft_client_id/secret are not per-agent."),
|
|
23884
23944
|
repos: exports_external.record(exports_external.string().regex(/^[a-z0-9][a-z0-9-]*$/, "Repo slug must be kebab-case ASCII: start with a lowercase letter or digit, contain only lowercase letters, digits, and hyphens"), exports_external.object({
|
|
23885
23945
|
url: exports_external.string().min(1).describe("Git remote URL for the repo (e.g. 'git@github.com:org/repo.git' or " + "'https://github.com/org/repo.git'). Used verbatim for git clone."),
|
|
23886
23946
|
branch_default: exports_external.string().optional().describe("Default branch to track (defaults to the remote's HEAD, typically 'main'). " + "The per-agent branch 'agent/<agentName>/main' fast-forwards to this branch " + "when the worktree is clean on session start.")
|
|
@@ -23895,6 +23955,33 @@ var init_schema = __esm(() => {
|
|
|
23895
23955
|
pids_limit: exports_external.number().int().positive().optional(),
|
|
23896
23956
|
cpus: exports_external.number().positive().optional()
|
|
23897
23957
|
}).optional()
|
|
23958
|
+
}).superRefine((agent, ctx) => {
|
|
23959
|
+
if (agent.dm_only !== true)
|
|
23960
|
+
return;
|
|
23961
|
+
const tg = agent.channels?.telegram;
|
|
23962
|
+
if (tg == null)
|
|
23963
|
+
return;
|
|
23964
|
+
if (tg.chat_id != null) {
|
|
23965
|
+
ctx.addIssue({
|
|
23966
|
+
code: exports_external.ZodIssueCode.custom,
|
|
23967
|
+
message: "`dm_only: true` forbids `channels.telegram.chat_id` \u2014 DM-only agents have their own private chat, not a supergroup.",
|
|
23968
|
+
path: ["channels", "telegram", "chat_id"]
|
|
23969
|
+
});
|
|
23970
|
+
}
|
|
23971
|
+
if (tg.default_topic_id != null) {
|
|
23972
|
+
ctx.addIssue({
|
|
23973
|
+
code: exports_external.ZodIssueCode.custom,
|
|
23974
|
+
message: "`dm_only: true` forbids `channels.telegram.default_topic_id` \u2014 DMs don't have forum topics.",
|
|
23975
|
+
path: ["channels", "telegram", "default_topic_id"]
|
|
23976
|
+
});
|
|
23977
|
+
}
|
|
23978
|
+
if (tg.topic_aliases != null) {
|
|
23979
|
+
ctx.addIssue({
|
|
23980
|
+
code: exports_external.ZodIssueCode.custom,
|
|
23981
|
+
message: "`dm_only: true` forbids `channels.telegram.topic_aliases` \u2014 DMs don't have forum topics.",
|
|
23982
|
+
path: ["channels", "telegram", "topic_aliases"]
|
|
23983
|
+
});
|
|
23984
|
+
}
|
|
23898
23985
|
});
|
|
23899
23986
|
TelegramConfigSchema = exports_external.object({
|
|
23900
23987
|
bot_token: exports_external.string().describe("Telegram bot token or vault reference (e.g., 'vault:telegram-bot-token')"),
|
|
@@ -23976,6 +24063,7 @@ var init_schema = __esm(() => {
|
|
|
23976
24063
|
}).optional().describe("Switchroom-auth-broker configuration (RFC H). Fleet-wide active account, " + "fallback order, admin-agent ACL, and ephemeral-consumer surface. " + "Required from the v0.8+ schema onwards; pre-v0.8 fleets are migrated " + "in-place by `switchroom apply` (see src/auth/migrate-schema.ts)."),
|
|
23977
24064
|
drive: GoogleWorkspaceConfigSchema.describe("RFC D legacy key \u2014 use `google_workspace:` instead. Optional Google " + "Workspace onboarding configuration. When set, supplies Google OAuth " + "client credentials, the approver allowlist for `switchroom drive " + "connect`, and the optional tier knob. Env vars " + "(SWITCHROOM_GOOGLE_CLIENT_ID, SWITCHROOM_GOOGLE_CLIENT_SECRET, " + "SWITCHROOM_APPROVER_USER_ID) take precedence over this block when " + "set, preserving back-compat with the env-only flow shipped in #766."),
|
|
23978
24065
|
google_workspace: GoogleWorkspaceConfigSchema.describe("RFC G canonical key. Top-level Google Workspace configuration \u2014 " + "OAuth client credentials, approver allowlist, and tier knob (`core` " + "| `extended` | `complete`, default `core`). Mutually exclusive with " + "`drive:` at the top level (loader fails fast if both are set)."),
|
|
24066
|
+
microsoft_workspace: MicrosoftWorkspaceConfigSchema.describe("RFC #1873 (Microsoft 365 integration). Top-level Microsoft Workspace " + "configuration \u2014 OAuth client credentials (Entra app), authority " + "endpoint (defaults to /common for personal MSA + work), and the " + "org_mode opt-in for Teams/SharePoint surfaces. Block is optional; " + "when omitted the broker does not register the Microsoft provider."),
|
|
23979
24067
|
quota: QuotaConfigSchema.optional().describe("Optional weekly/monthly USD spend budgets rendered in the session " + "greeting. Usage is read from ccusage at runtime; no network calls."),
|
|
23980
24068
|
host_control: HostControlConfigSchema.default({}).describe("Host-control daemon configuration. Defaults to enabled=true since " + "RFC C Phase 2 (docs/rfcs/host-control-daemon.md). Omit the block " + "to accept defaults; set `enabled: false` only on legacy systemd-" + "mode installs (removal tracked as RFC C Phase 3)."),
|
|
23981
24069
|
hostd: HostdConfigSchema.default({}).describe("hostd verb-level knobs (RFC admin-agent-config-edit). Distinct " + "from `host_control:` which governs whether the daemon runs at " + "all. Currently scopes the opt-in flag and rate cap for the new " + "`config_propose_edit` verb (PR 1a \u2014 disabled by default)."),
|
|
@@ -23986,6 +24074,13 @@ var init_schema = __esm(() => {
|
|
|
23986
24074
|
message: "Agent name must match the standard agent-name pattern"
|
|
23987
24075
|
})).describe("Agent slugs that may read this account's vault slots " + "(`google:<account>:refresh_token` etc). Per-agent ACL is " + "enforced at the broker, not at the agent identity layer \u2014 " + "the agent still authenticates via socket-path-as-identity " + "per RFC D \u00a74.1, broker just gates the cross-agent token share.")
|
|
23988
24076
|
})).optional().describe("RFC G Phase 2: per-Google-account ACL for vault slots holding " + "OAuth refresh tokens. Maps account email \u2192 list of agents " + "permitted to read that account's slots. Written by `switchroom " + "auth google enable|disable` (Phase 3); read by the broker on " + "every Google slot access. Replaces RFC D's per-agent vault slot " + "scope (which can't express 'two agents share one Google account')."),
|
|
24077
|
+
microsoft_accounts: exports_external.record(exports_external.string().regex(/^[^@\s:]+@[^@\s:]+\.[^@\s:]+$/, {
|
|
24078
|
+
message: "Account key must be a Microsoft account email like 'alice@outlook.com' or 'alice@contoso.com' (colons not allowed)"
|
|
24079
|
+
}).transform((v) => v.trim().toLowerCase()), exports_external.object({
|
|
24080
|
+
enabled_for: exports_external.array(exports_external.string().regex(/^[a-z0-9][a-z0-9_-]{0,50}$/, {
|
|
24081
|
+
message: "Agent name must match the standard agent-name pattern"
|
|
24082
|
+
})).describe("Agent slugs that may read this Microsoft account's broker " + "credentials. Per-agent ACL enforced at the broker; agents " + "still authenticate via socket-path-as-identity, broker just " + "gates the cross-agent token share. Mirrors google_accounts.")
|
|
24083
|
+
})).optional().describe("RFC #1873: per-Microsoft-account ACL. Maps account email \u2192 list of " + "agents permitted to use that account's broker credentials. Written " + "by `switchroom auth microsoft enable|disable`; read by the broker " + "on get-credentials with provider=microsoft."),
|
|
23989
24084
|
defaults: AgentDefaultsSchema.describe("Implicit bottom-of-cascade profile applied to every agent before " + "per-agent config and `extends:` resolution. Tools, mcp_servers, and " + "schedule are unioned/concatenated; scalars and nested objects are " + "shallow-merged with per-agent values winning."),
|
|
23990
24085
|
profiles: exports_external.record(exports_external.string(), ProfileSchema).optional().describe("Named profile definitions. Agents reference via `extends: <name>`. " + "Inline profiles declared here take priority over filesystem " + "profiles/<name>/ directories when both exist."),
|
|
23991
24086
|
agents: exports_external.record(exports_external.string().regex(/^[a-z0-9][a-z0-9_-]{0,50}$/, {
|
|
@@ -24165,6 +24260,317 @@ var init_overlay_loader = __esm(() => {
|
|
|
24165
24260
|
OVERLAY_SOURCE = Symbol.for("switchroom.config.overlay-source");
|
|
24166
24261
|
});
|
|
24167
24262
|
|
|
24263
|
+
// ../src/config/merge.ts
|
|
24264
|
+
function dedupe(items) {
|
|
24265
|
+
const seen = new Set;
|
|
24266
|
+
const out = [];
|
|
24267
|
+
for (const item of items) {
|
|
24268
|
+
if (seen.has(item))
|
|
24269
|
+
continue;
|
|
24270
|
+
seen.add(item);
|
|
24271
|
+
out.push(item);
|
|
24272
|
+
}
|
|
24273
|
+
return out;
|
|
24274
|
+
}
|
|
24275
|
+
function deepMergeJson(base, override) {
|
|
24276
|
+
if (override === undefined)
|
|
24277
|
+
return base;
|
|
24278
|
+
if (base === undefined)
|
|
24279
|
+
return override;
|
|
24280
|
+
if (typeof base !== "object" || base === null || Array.isArray(base) || typeof override !== "object" || override === null || Array.isArray(override)) {
|
|
24281
|
+
return override;
|
|
24282
|
+
}
|
|
24283
|
+
const out = { ...base };
|
|
24284
|
+
for (const [k, v] of Object.entries(override)) {
|
|
24285
|
+
if (k === "__proto__" || k === "constructor" || k === "prototype")
|
|
24286
|
+
continue;
|
|
24287
|
+
out[k] = deepMergeJson(out[k], v);
|
|
24288
|
+
}
|
|
24289
|
+
return out;
|
|
24290
|
+
}
|
|
24291
|
+
function resolveAgentConfig(defaults, profiles, agent) {
|
|
24292
|
+
if (!mergeAgentConfig.suppressDeprecationLogs && !mergeAgentConfig.notifiedWorkerIsolationMove && defaults?.subagents?.worker?.isolation === "worktree") {
|
|
24293
|
+
mergeAgentConfig.notifiedWorkerIsolationMove = true;
|
|
24294
|
+
console.warn("[switchroom] NOTICE: defaults.subagents.worker.isolation moved to the " + "`coding` profile in switchroom 0.6.6 (#682). Agents extending coding " + "still get worktree-isolated workers; other agents would have hard-failed " + "the first time they delegated. See CHANGELOG.");
|
|
24295
|
+
}
|
|
24296
|
+
const name = agent.extends;
|
|
24297
|
+
const profile = name && profiles ? profiles[name] : undefined;
|
|
24298
|
+
if (!profile) {
|
|
24299
|
+
return mergeAgentConfig(defaults, agent);
|
|
24300
|
+
}
|
|
24301
|
+
const { extends: _unused, ...profileWithoutExtends } = profile;
|
|
24302
|
+
const layered = mergeAgentConfig(defaults, profileWithoutExtends);
|
|
24303
|
+
return mergeAgentConfig(layered, agent);
|
|
24304
|
+
}
|
|
24305
|
+
function foldDeprecatedTelegramFields(config) {
|
|
24306
|
+
const c = config;
|
|
24307
|
+
const root = c;
|
|
24308
|
+
const deprecations = [];
|
|
24309
|
+
const hasRoot = root.voice_in !== undefined || root.telegraph !== undefined || root.webhook_sources !== undefined;
|
|
24310
|
+
if (!hasRoot)
|
|
24311
|
+
return { config: c, deprecations };
|
|
24312
|
+
const channels = { ...c.channels ?? {} };
|
|
24313
|
+
const tg = { ...channels.telegram ?? {} };
|
|
24314
|
+
if (root.voice_in !== undefined) {
|
|
24315
|
+
if (tg.voice_in === undefined)
|
|
24316
|
+
tg.voice_in = root.voice_in;
|
|
24317
|
+
deprecations.push("voice_in at the agent root is deprecated; move under channels.telegram.voice_in (#596).");
|
|
24318
|
+
}
|
|
24319
|
+
if (root.telegraph !== undefined) {
|
|
24320
|
+
if (tg.telegraph === undefined)
|
|
24321
|
+
tg.telegraph = root.telegraph;
|
|
24322
|
+
deprecations.push("telegraph at the agent root is deprecated; move under channels.telegram.telegraph (#596).");
|
|
24323
|
+
}
|
|
24324
|
+
if (root.webhook_sources !== undefined) {
|
|
24325
|
+
if (tg.webhook_sources === undefined)
|
|
24326
|
+
tg.webhook_sources = root.webhook_sources;
|
|
24327
|
+
deprecations.push("webhook_sources at the agent root is deprecated; move under channels.telegram.webhook_sources (#596).");
|
|
24328
|
+
}
|
|
24329
|
+
channels.telegram = tg;
|
|
24330
|
+
const { voice_in: _vi, telegraph: _tg, webhook_sources: _ws, ...rest } = root;
|
|
24331
|
+
return {
|
|
24332
|
+
config: { ...rest, channels },
|
|
24333
|
+
deprecations
|
|
24334
|
+
};
|
|
24335
|
+
}
|
|
24336
|
+
function mergeAgentConfig(defaultsIn, agentIn) {
|
|
24337
|
+
const { config: agent, deprecations: agentDeprecations } = foldDeprecatedTelegramFields(agentIn);
|
|
24338
|
+
const defaultsMigration = defaultsIn ? foldDeprecatedTelegramFields(defaultsIn) : null;
|
|
24339
|
+
const defaults = defaultsMigration?.config;
|
|
24340
|
+
const allDeprecations = [
|
|
24341
|
+
...agentDeprecations,
|
|
24342
|
+
...defaultsMigration?.deprecations ?? []
|
|
24343
|
+
];
|
|
24344
|
+
if (allDeprecations.length > 0 && !mergeAgentConfig.suppressDeprecationLogs) {
|
|
24345
|
+
for (const msg of allDeprecations) {
|
|
24346
|
+
console.warn(`[switchroom] DEPRECATION: ${msg}`);
|
|
24347
|
+
}
|
|
24348
|
+
}
|
|
24349
|
+
if (!defaults)
|
|
24350
|
+
return agent;
|
|
24351
|
+
const merged = { ...agent };
|
|
24352
|
+
if (defaults.bot_token !== undefined && merged.bot_token === undefined) {
|
|
24353
|
+
merged.bot_token = defaults.bot_token;
|
|
24354
|
+
}
|
|
24355
|
+
if (defaults.timezone !== undefined && merged.timezone === undefined) {
|
|
24356
|
+
merged.timezone = defaults.timezone;
|
|
24357
|
+
}
|
|
24358
|
+
if (defaults.model !== undefined && merged.model === undefined) {
|
|
24359
|
+
merged.model = defaults.model;
|
|
24360
|
+
}
|
|
24361
|
+
if (defaults.dangerous_mode !== undefined && merged.dangerous_mode === undefined) {
|
|
24362
|
+
merged.dangerous_mode = defaults.dangerous_mode;
|
|
24363
|
+
}
|
|
24364
|
+
if (defaults.network_isolation !== undefined && merged.network_isolation === undefined) {
|
|
24365
|
+
merged.network_isolation = defaults.network_isolation;
|
|
24366
|
+
}
|
|
24367
|
+
if (defaults.thinking_effort !== undefined && merged.thinking_effort === undefined) {
|
|
24368
|
+
merged.thinking_effort = defaults.thinking_effort;
|
|
24369
|
+
}
|
|
24370
|
+
if (defaults.permission_mode !== undefined && merged.permission_mode === undefined) {
|
|
24371
|
+
merged.permission_mode = defaults.permission_mode;
|
|
24372
|
+
}
|
|
24373
|
+
if (defaults.fallback_model !== undefined && merged.fallback_model === undefined) {
|
|
24374
|
+
merged.fallback_model = defaults.fallback_model;
|
|
24375
|
+
}
|
|
24376
|
+
if (defaults.tools || merged.tools) {
|
|
24377
|
+
const dAllow = defaults.tools?.allow ?? [];
|
|
24378
|
+
const aAllow = merged.tools?.allow ?? [];
|
|
24379
|
+
const dDeny = defaults.tools?.deny ?? [];
|
|
24380
|
+
const aDeny = merged.tools?.deny ?? [];
|
|
24381
|
+
merged.tools = {
|
|
24382
|
+
allow: dedupe([...dAllow, ...aAllow]),
|
|
24383
|
+
deny: dedupe([...dDeny, ...aDeny])
|
|
24384
|
+
};
|
|
24385
|
+
}
|
|
24386
|
+
if (defaults.soul || merged.soul) {
|
|
24387
|
+
const base = defaults.soul ?? {};
|
|
24388
|
+
const override = merged.soul ?? {};
|
|
24389
|
+
const combined = { ...base };
|
|
24390
|
+
for (const [k, v] of Object.entries(override)) {
|
|
24391
|
+
if (v !== undefined)
|
|
24392
|
+
combined[k] = v;
|
|
24393
|
+
}
|
|
24394
|
+
merged.soul = combined;
|
|
24395
|
+
}
|
|
24396
|
+
if (defaults.memory || merged.memory) {
|
|
24397
|
+
const base = defaults.memory ?? {};
|
|
24398
|
+
const override = merged.memory ?? {};
|
|
24399
|
+
const combined = { ...base };
|
|
24400
|
+
for (const [k, v] of Object.entries(override)) {
|
|
24401
|
+
if (v === undefined)
|
|
24402
|
+
continue;
|
|
24403
|
+
if (k === "recall" && base.recall && typeof v === "object" && v !== null && !Array.isArray(v)) {
|
|
24404
|
+
combined[k] = { ...base.recall, ...v };
|
|
24405
|
+
} else {
|
|
24406
|
+
combined[k] = v;
|
|
24407
|
+
}
|
|
24408
|
+
}
|
|
24409
|
+
merged.memory = combined;
|
|
24410
|
+
}
|
|
24411
|
+
if (defaults.mcp_servers || merged.mcp_servers) {
|
|
24412
|
+
merged.mcp_servers = {
|
|
24413
|
+
...defaults.mcp_servers ?? {},
|
|
24414
|
+
...merged.mcp_servers ?? {}
|
|
24415
|
+
};
|
|
24416
|
+
}
|
|
24417
|
+
const dBundled = defaults.bundled_skills;
|
|
24418
|
+
const mBundled = merged.bundled_skills;
|
|
24419
|
+
if (dBundled || mBundled) {
|
|
24420
|
+
merged.bundled_skills = {
|
|
24421
|
+
...dBundled ?? {},
|
|
24422
|
+
...mBundled ?? {}
|
|
24423
|
+
};
|
|
24424
|
+
}
|
|
24425
|
+
if (defaults.hooks || merged.hooks) {
|
|
24426
|
+
const result = {};
|
|
24427
|
+
const dHooks = defaults.hooks ?? {};
|
|
24428
|
+
const aHooks = merged.hooks ?? {};
|
|
24429
|
+
const events = new Set([
|
|
24430
|
+
...Object.keys(dHooks),
|
|
24431
|
+
...Object.keys(aHooks)
|
|
24432
|
+
]);
|
|
24433
|
+
for (const event of events) {
|
|
24434
|
+
const d = dHooks[event] ?? [];
|
|
24435
|
+
const a = aHooks[event] ?? [];
|
|
24436
|
+
result[event] = [...d, ...a];
|
|
24437
|
+
}
|
|
24438
|
+
merged.hooks = result;
|
|
24439
|
+
}
|
|
24440
|
+
if (defaults.env || merged.env) {
|
|
24441
|
+
merged.env = {
|
|
24442
|
+
...defaults.env ?? {},
|
|
24443
|
+
...merged.env ?? {}
|
|
24444
|
+
};
|
|
24445
|
+
}
|
|
24446
|
+
if (defaults.subagents || merged.subagents) {
|
|
24447
|
+
const dSub = defaults.subagents ?? {};
|
|
24448
|
+
const mSub = merged.subagents ?? {};
|
|
24449
|
+
const out = { ...dSub };
|
|
24450
|
+
for (const [name, override] of Object.entries(mSub)) {
|
|
24451
|
+
const base = dSub[name];
|
|
24452
|
+
if (base && typeof base === "object" && override && typeof override === "object") {
|
|
24453
|
+
const combined = { ...base };
|
|
24454
|
+
for (const [k, v] of Object.entries(override)) {
|
|
24455
|
+
if (v !== undefined)
|
|
24456
|
+
combined[k] = v;
|
|
24457
|
+
}
|
|
24458
|
+
out[name] = combined;
|
|
24459
|
+
} else {
|
|
24460
|
+
out[name] = override;
|
|
24461
|
+
}
|
|
24462
|
+
}
|
|
24463
|
+
merged.subagents = out;
|
|
24464
|
+
}
|
|
24465
|
+
if (defaults.session || merged.session) {
|
|
24466
|
+
const base = defaults.session ?? {};
|
|
24467
|
+
const override = merged.session ?? {};
|
|
24468
|
+
const combined = { ...base };
|
|
24469
|
+
for (const [k, v] of Object.entries(override)) {
|
|
24470
|
+
if (v !== undefined)
|
|
24471
|
+
combined[k] = v;
|
|
24472
|
+
}
|
|
24473
|
+
merged.session = combined;
|
|
24474
|
+
}
|
|
24475
|
+
if (defaults.session_continuity || merged.session_continuity) {
|
|
24476
|
+
const base = defaults.session_continuity ?? {};
|
|
24477
|
+
const override = merged.session_continuity ?? {};
|
|
24478
|
+
const combined = { ...base };
|
|
24479
|
+
for (const [k, v] of Object.entries(override)) {
|
|
24480
|
+
if (v !== undefined)
|
|
24481
|
+
combined[k] = v;
|
|
24482
|
+
}
|
|
24483
|
+
merged.session_continuity = combined;
|
|
24484
|
+
}
|
|
24485
|
+
if (merged.release === undefined && defaults.release !== undefined) {
|
|
24486
|
+
merged.release = defaults.release;
|
|
24487
|
+
}
|
|
24488
|
+
if (defaults.channels || merged.channels) {
|
|
24489
|
+
const dChan = defaults.channels ?? {};
|
|
24490
|
+
const aChan = merged.channels ?? {};
|
|
24491
|
+
const combined = { ...dChan };
|
|
24492
|
+
for (const [key, value] of Object.entries(aChan)) {
|
|
24493
|
+
if (value === undefined)
|
|
24494
|
+
continue;
|
|
24495
|
+
const base = combined[key] ?? {};
|
|
24496
|
+
const override = value;
|
|
24497
|
+
const field = { ...base };
|
|
24498
|
+
for (const [k, v] of Object.entries(override)) {
|
|
24499
|
+
if (v !== undefined)
|
|
24500
|
+
field[k] = v;
|
|
24501
|
+
}
|
|
24502
|
+
combined[key] = field;
|
|
24503
|
+
}
|
|
24504
|
+
merged.channels = combined;
|
|
24505
|
+
}
|
|
24506
|
+
if (defaults.system_prompt_append || merged.system_prompt_append) {
|
|
24507
|
+
const parts = [
|
|
24508
|
+
defaults.system_prompt_append,
|
|
24509
|
+
merged.system_prompt_append
|
|
24510
|
+
].filter((p) => typeof p === "string" && p.length > 0);
|
|
24511
|
+
merged.system_prompt_append = parts.join(`
|
|
24512
|
+
|
|
24513
|
+
`);
|
|
24514
|
+
}
|
|
24515
|
+
if (defaults.schedule && defaults.schedule.length > 0) {
|
|
24516
|
+
merged.schedule = [...defaults.schedule, ...merged.schedule ?? []];
|
|
24517
|
+
}
|
|
24518
|
+
if (defaults.skills || merged.skills) {
|
|
24519
|
+
const d = defaults.skills ?? [];
|
|
24520
|
+
const a = merged.skills ?? [];
|
|
24521
|
+
merged.skills = dedupe([...d, ...a]);
|
|
24522
|
+
}
|
|
24523
|
+
if (defaults.settings_raw || merged.settings_raw) {
|
|
24524
|
+
merged.settings_raw = deepMergeJson(defaults.settings_raw ?? {}, merged.settings_raw ?? {});
|
|
24525
|
+
}
|
|
24526
|
+
if (defaults.claude_md_raw || merged.claude_md_raw) {
|
|
24527
|
+
const parts = [defaults.claude_md_raw, merged.claude_md_raw].filter((p) => typeof p === "string" && p.length > 0);
|
|
24528
|
+
merged.claude_md_raw = parts.join(`
|
|
24529
|
+
|
|
24530
|
+
`);
|
|
24531
|
+
}
|
|
24532
|
+
if (defaults.cli_args || merged.cli_args) {
|
|
24533
|
+
merged.cli_args = [
|
|
24534
|
+
...defaults.cli_args ?? [],
|
|
24535
|
+
...merged.cli_args ?? []
|
|
24536
|
+
];
|
|
24537
|
+
}
|
|
24538
|
+
if (defaults.extra_stable_files || merged.extra_stable_files) {
|
|
24539
|
+
const d = defaults.extra_stable_files ?? [];
|
|
24540
|
+
const a = merged.extra_stable_files ?? [];
|
|
24541
|
+
merged.extra_stable_files = dedupe([...d, ...a]);
|
|
24542
|
+
}
|
|
24543
|
+
const dReactions = defaults.reactions;
|
|
24544
|
+
const mReactions = merged.reactions;
|
|
24545
|
+
if (dReactions || mReactions) {
|
|
24546
|
+
const base = dReactions ?? {};
|
|
24547
|
+
const override = mReactions ?? {};
|
|
24548
|
+
const combined = { ...base };
|
|
24549
|
+
for (const [k, v] of Object.entries(override)) {
|
|
24550
|
+
if (v !== undefined)
|
|
24551
|
+
combined[k] = v;
|
|
24552
|
+
}
|
|
24553
|
+
merged.reactions = combined;
|
|
24554
|
+
}
|
|
24555
|
+
if (defaults.resources || merged.resources) {
|
|
24556
|
+
const d = defaults.resources ?? {};
|
|
24557
|
+
const a = merged.resources ?? {};
|
|
24558
|
+
merged.resources = { ...d, ...a };
|
|
24559
|
+
}
|
|
24560
|
+
if (defaults.experimental || merged.experimental) {
|
|
24561
|
+
const d = defaults.experimental ?? {};
|
|
24562
|
+
const a = merged.experimental ?? {};
|
|
24563
|
+
merged.experimental = { ...d, ...a };
|
|
24564
|
+
}
|
|
24565
|
+
return merged;
|
|
24566
|
+
}
|
|
24567
|
+
var init_merge = __esm(() => {
|
|
24568
|
+
((mergeAgentConfig) => {
|
|
24569
|
+
mergeAgentConfig.suppressDeprecationLogs = false;
|
|
24570
|
+
mergeAgentConfig.notifiedWorkerIsolationMove = false;
|
|
24571
|
+
})(mergeAgentConfig ||= {});
|
|
24572
|
+
});
|
|
24573
|
+
|
|
24168
24574
|
// ../src/config/loader.ts
|
|
24169
24575
|
import { readFileSync as readFileSync5, existsSync as existsSync9 } from "node:fs";
|
|
24170
24576
|
import { homedir as homedir5 } from "node:os";
|
|
@@ -24278,8 +24684,34 @@ function loadConfig(configPath) {
|
|
|
24278
24684
|
throw err;
|
|
24279
24685
|
}
|
|
24280
24686
|
applyAgentOverlays(config);
|
|
24687
|
+
validateAllCronTopicAliases(config, filePath);
|
|
24281
24688
|
return config;
|
|
24282
24689
|
}
|
|
24690
|
+
function validateAllCronTopicAliases(config, filePath) {
|
|
24691
|
+
const issues = [];
|
|
24692
|
+
for (const [agentName3, agentRaw] of Object.entries(config.agents)) {
|
|
24693
|
+
if (!agentRaw)
|
|
24694
|
+
continue;
|
|
24695
|
+
const resolved = resolveAgentConfig(config.defaults, config.profiles, agentRaw);
|
|
24696
|
+
const schedule = resolved.schedule ?? [];
|
|
24697
|
+
if (schedule.length === 0)
|
|
24698
|
+
continue;
|
|
24699
|
+
const tg = resolved.channels?.telegram;
|
|
24700
|
+
const aliases = new Set(Object.keys(tg?.topic_aliases ?? {}));
|
|
24701
|
+
for (const entry of schedule) {
|
|
24702
|
+
if (entry.topic == null)
|
|
24703
|
+
continue;
|
|
24704
|
+
if (typeof entry.topic === "number")
|
|
24705
|
+
continue;
|
|
24706
|
+
if (!aliases.has(entry.topic)) {
|
|
24707
|
+
issues.push(` agents.${agentName3}.schedule cron \`${entry.cron}\`: ` + `topic alias "${entry.topic}" is not defined in ` + `channels.telegram.topic_aliases.`);
|
|
24708
|
+
}
|
|
24709
|
+
}
|
|
24710
|
+
}
|
|
24711
|
+
if (issues.length > 0) {
|
|
24712
|
+
throw new ConfigError(`Cron \`topic:\` alias references unknown topic_aliases in ${filePath}`, issues);
|
|
24713
|
+
}
|
|
24714
|
+
}
|
|
24283
24715
|
function resolvePath(pathStr) {
|
|
24284
24716
|
return resolveDualPath(pathStr);
|
|
24285
24717
|
}
|
|
@@ -24290,6 +24722,7 @@ var init_loader = __esm(() => {
|
|
|
24290
24722
|
init_schema();
|
|
24291
24723
|
init_paths();
|
|
24292
24724
|
init_overlay_loader();
|
|
24725
|
+
init_merge();
|
|
24293
24726
|
ConfigError = class ConfigError extends Error {
|
|
24294
24727
|
details;
|
|
24295
24728
|
constructor(message, details) {
|
|
@@ -25365,7 +25798,7 @@ function deriveSlug(inputs, existing) {
|
|
|
25365
25798
|
return `${base}_${n}`;
|
|
25366
25799
|
}
|
|
25367
25800
|
|
|
25368
|
-
//
|
|
25801
|
+
// ../../switchroom-sec-1417/node_modules/.bun/boundary@2.0.0/node_modules/boundary/lib/index.js
|
|
25369
25802
|
var require_lib = __commonJS((exports2) => {
|
|
25370
25803
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
25371
25804
|
exports2.binarySearch = exports2.upperBound = exports2.lowerBound = exports2.compare = undefined;
|
|
@@ -25412,7 +25845,7 @@ var require_lib = __commonJS((exports2) => {
|
|
|
25412
25845
|
exports2.binarySearch = binarySearch;
|
|
25413
25846
|
});
|
|
25414
25847
|
|
|
25415
|
-
//
|
|
25848
|
+
// ../../switchroom-sec-1417/node_modules/.bun/structured-source@4.0.0/node_modules/structured-source/lib/structured-source.js
|
|
25416
25849
|
var require_structured_source = __commonJS((exports2) => {
|
|
25417
25850
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
25418
25851
|
exports2.StructuredSource = undefined;
|
|
@@ -25467,13 +25900,13 @@ var require_structured_source = __commonJS((exports2) => {
|
|
|
25467
25900
|
}
|
|
25468
25901
|
exports2.StructuredSource = StructuredSource;
|
|
25469
25902
|
});
|
|
25470
|
-
//
|
|
25903
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@secretlint+core@12.2.0/node_modules/@secretlint/core/module/SecretLintSourceCodeImpl.js
|
|
25471
25904
|
var import_structured_source;
|
|
25472
25905
|
var init_SecretLintSourceCodeImpl = __esm(() => {
|
|
25473
25906
|
import_structured_source = __toESM(require_structured_source(), 1);
|
|
25474
25907
|
});
|
|
25475
25908
|
|
|
25476
|
-
//
|
|
25909
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@secretlint+core@12.2.0/node_modules/@secretlint/core/module/helper/promise-event-emitter.js
|
|
25477
25910
|
class EventEmitter {
|
|
25478
25911
|
#listeners = new Map;
|
|
25479
25912
|
on(type, listener) {
|
|
@@ -25512,9 +25945,9 @@ class EventEmitter {
|
|
|
25512
25945
|
return Array.from(this.#listeners.get(type) ?? []);
|
|
25513
25946
|
}
|
|
25514
25947
|
}
|
|
25515
|
-
//
|
|
25948
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@secretlint+core@12.2.0/node_modules/@secretlint/core/module/RuleContext.js
|
|
25516
25949
|
var init_RuleContext = () => {};
|
|
25517
|
-
//
|
|
25950
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@secretlint+profiler@12.2.0/node_modules/@secretlint/profiler/module/index.js
|
|
25518
25951
|
class SecretLintProfiler {
|
|
25519
25952
|
perf;
|
|
25520
25953
|
entries = [];
|
|
@@ -25571,7 +26004,7 @@ class SecretLintProfiler {
|
|
|
25571
26004
|
}
|
|
25572
26005
|
}
|
|
25573
26006
|
|
|
25574
|
-
//
|
|
26007
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@secretlint+profiler@12.2.0/node_modules/@secretlint/profiler/module/node.js
|
|
25575
26008
|
import perf_hooks from "node:perf_hooks";
|
|
25576
26009
|
|
|
25577
26010
|
class NullPerformanceObserver {
|
|
@@ -25586,19 +26019,19 @@ var init_node = __esm(() => {
|
|
|
25586
26019
|
});
|
|
25587
26020
|
});
|
|
25588
26021
|
|
|
25589
|
-
//
|
|
26022
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@secretlint+core@12.2.0/node_modules/@secretlint/core/module/RunningEvents.js
|
|
25590
26023
|
var init_RunningEvents = __esm(() => {
|
|
25591
26024
|
init_node();
|
|
25592
26025
|
});
|
|
25593
26026
|
|
|
25594
|
-
//
|
|
26027
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@secretlint+core@12.2.0/node_modules/@secretlint/core/module/RulePresetContext.js
|
|
25595
26028
|
var init_RulePresetContext = __esm(() => {
|
|
25596
26029
|
init_RuleContext();
|
|
25597
26030
|
});
|
|
25598
|
-
//
|
|
26031
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@secretlint+core@12.2.0/node_modules/@secretlint/core/module/messages/index.js
|
|
25599
26032
|
var init_messages = () => {};
|
|
25600
26033
|
|
|
25601
|
-
//
|
|
26034
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@secretlint+core@12.2.0/node_modules/@secretlint/core/module/index.js
|
|
25602
26035
|
var import_debug, debug;
|
|
25603
26036
|
var init_module = __esm(() => {
|
|
25604
26037
|
init_SecretLintSourceCodeImpl();
|
|
@@ -25611,7 +26044,7 @@ var init_module = __esm(() => {
|
|
|
25611
26044
|
debug = import_debug.default("@secretlint/core");
|
|
25612
26045
|
});
|
|
25613
26046
|
|
|
25614
|
-
//
|
|
26047
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@secretlint+secretlint-rule-preset-recommend@12.2.0/node_modules/@secretlint/secretlint-rule-preset-recommend/module/index.js
|
|
25615
26048
|
function requireLodash_uniq() {
|
|
25616
26049
|
if (hasRequiredLodash_uniq)
|
|
25617
26050
|
return lodash_uniq;
|
|
@@ -27298,7 +27731,7 @@ var init_secretlint_source = __esm(() => {
|
|
|
27298
27731
|
function escapeHtml8(s) {
|
|
27299
27732
|
return s.replace(/[&<>]/g, (c) => ({ "&": "&", "<": "<", ">": ">" })[c]);
|
|
27300
27733
|
}
|
|
27301
|
-
function
|
|
27734
|
+
function truncate5(s, n) {
|
|
27302
27735
|
return s.length > n ? s.slice(0, n - 1) + "\u2026" : s;
|
|
27303
27736
|
}
|
|
27304
27737
|
|
|
@@ -27401,7 +27834,7 @@ function writeQuotaCache(result, opts = {}) {
|
|
|
27401
27834
|
if (result.status === "fail")
|
|
27402
27835
|
return;
|
|
27403
27836
|
const path = opts.path ?? defaultCachePath();
|
|
27404
|
-
const ttlMs = opts.ttlMs ?? (result.rateLimited ? RATE_LIMIT_TTL_MS :
|
|
27837
|
+
const ttlMs = opts.ttlMs ?? (result.rateLimited ? RATE_LIMIT_TTL_MS : DEFAULT_TTL_MS4);
|
|
27405
27838
|
const now = opts.now ?? Date.now();
|
|
27406
27839
|
const entry = {
|
|
27407
27840
|
capturedAt: new Date(now).toISOString(),
|
|
@@ -27413,9 +27846,9 @@ function writeQuotaCache(result, opts = {}) {
|
|
|
27413
27846
|
writeFileSync13(path, JSON.stringify(entry, null, 2), { mode: 384 });
|
|
27414
27847
|
} catch {}
|
|
27415
27848
|
}
|
|
27416
|
-
var
|
|
27849
|
+
var DEFAULT_TTL_MS4, RATE_LIMIT_TTL_MS;
|
|
27417
27850
|
var init_quota_cache = __esm(() => {
|
|
27418
|
-
|
|
27851
|
+
DEFAULT_TTL_MS4 = 5 * 60 * 1000;
|
|
27419
27852
|
RATE_LIMIT_TTL_MS = 30 * 1000;
|
|
27420
27853
|
});
|
|
27421
27854
|
|
|
@@ -30801,8 +31234,9 @@ function createInboundCoalescer(opts) {
|
|
|
30801
31234
|
}
|
|
30802
31235
|
};
|
|
30803
31236
|
}
|
|
30804
|
-
function inboundCoalesceKey(chatId, userId) {
|
|
30805
|
-
|
|
31237
|
+
function inboundCoalesceKey(chatId, threadId, userId) {
|
|
31238
|
+
const t = threadId == null || threadId === 0 ? "_" : String(threadId);
|
|
31239
|
+
return `${chatId}:${t}:${userId}`;
|
|
30806
31240
|
}
|
|
30807
31241
|
|
|
30808
31242
|
// status-reactions.ts
|
|
@@ -31270,29 +31704,41 @@ function prettifyServer(name) {
|
|
|
31270
31704
|
return name.charAt(0).toUpperCase() + name.slice(1);
|
|
31271
31705
|
}
|
|
31272
31706
|
|
|
31707
|
+
// gateway/chat-key.ts
|
|
31708
|
+
function chatKey(chatId, threadId) {
|
|
31709
|
+
const t = threadId == null || threadId === 0 ? "_" : String(threadId);
|
|
31710
|
+
return `${chatId}:${t}`;
|
|
31711
|
+
}
|
|
31712
|
+
function chatKeyWithSuffix(chatId, threadId, suffix) {
|
|
31713
|
+
return `${chatKey(chatId, threadId)}:${suffix}`;
|
|
31714
|
+
}
|
|
31715
|
+
|
|
31273
31716
|
// typing-wrap.ts
|
|
31274
31717
|
function createTypingWrapper(deps) {
|
|
31275
31718
|
const debounceMs = deps.debounceMs ?? 500;
|
|
31276
31719
|
const pending = new Map;
|
|
31277
|
-
const
|
|
31720
|
+
const activeLanes = new Set;
|
|
31278
31721
|
return {
|
|
31279
|
-
onToolUse(toolUseId, chatId, toolName) {
|
|
31722
|
+
onToolUse(toolUseId, chatId, toolName, threadId) {
|
|
31280
31723
|
if (!toolUseId)
|
|
31281
31724
|
return;
|
|
31282
31725
|
if (deps.isSurfaceTool(toolName))
|
|
31283
31726
|
return;
|
|
31727
|
+
const tid = threadId ?? null;
|
|
31728
|
+
const lane = chatKey(chatId, tid);
|
|
31284
31729
|
const prior = pending.get(toolUseId);
|
|
31285
31730
|
if (prior) {
|
|
31286
31731
|
clearTimeout(prior.timer);
|
|
31287
31732
|
if (prior.started)
|
|
31288
|
-
deps.stopTypingLoop(prior.chatId);
|
|
31733
|
+
deps.stopTypingLoop(prior.chatId, prior.threadId);
|
|
31289
31734
|
pending.delete(toolUseId);
|
|
31290
31735
|
}
|
|
31291
|
-
if (!
|
|
31292
|
-
deps.startTypingLoop(chatId);
|
|
31293
|
-
|
|
31736
|
+
if (!activeLanes.has(lane)) {
|
|
31737
|
+
deps.startTypingLoop(chatId, tid);
|
|
31738
|
+
activeLanes.add(lane);
|
|
31294
31739
|
const entry2 = {
|
|
31295
31740
|
chatId,
|
|
31741
|
+
threadId: tid,
|
|
31296
31742
|
started: true,
|
|
31297
31743
|
timer: setTimeout(() => {}, 0)
|
|
31298
31744
|
};
|
|
@@ -31301,9 +31747,10 @@ function createTypingWrapper(deps) {
|
|
|
31301
31747
|
}
|
|
31302
31748
|
const entry = {
|
|
31303
31749
|
chatId,
|
|
31750
|
+
threadId: tid,
|
|
31304
31751
|
started: false,
|
|
31305
31752
|
timer: setTimeout(() => {
|
|
31306
|
-
deps.startTypingLoop(chatId);
|
|
31753
|
+
deps.startTypingLoop(chatId, tid);
|
|
31307
31754
|
entry.started = true;
|
|
31308
31755
|
}, debounceMs)
|
|
31309
31756
|
};
|
|
@@ -31317,8 +31764,8 @@ function createTypingWrapper(deps) {
|
|
|
31317
31764
|
return;
|
|
31318
31765
|
clearTimeout(entry.timer);
|
|
31319
31766
|
if (entry.started) {
|
|
31320
|
-
deps.stopTypingLoop(entry.chatId);
|
|
31321
|
-
|
|
31767
|
+
deps.stopTypingLoop(entry.chatId, entry.threadId);
|
|
31768
|
+
activeLanes.delete(chatKey(entry.chatId, entry.threadId));
|
|
31322
31769
|
}
|
|
31323
31770
|
pending.delete(toolUseId);
|
|
31324
31771
|
},
|
|
@@ -31326,10 +31773,10 @@ function createTypingWrapper(deps) {
|
|
|
31326
31773
|
for (const entry of pending.values()) {
|
|
31327
31774
|
clearTimeout(entry.timer);
|
|
31328
31775
|
if (entry.started)
|
|
31329
|
-
deps.stopTypingLoop(entry.chatId);
|
|
31776
|
+
deps.stopTypingLoop(entry.chatId, entry.threadId);
|
|
31330
31777
|
}
|
|
31331
31778
|
pending.clear();
|
|
31332
|
-
|
|
31779
|
+
activeLanes.clear();
|
|
31333
31780
|
}
|
|
31334
31781
|
};
|
|
31335
31782
|
}
|
|
@@ -32004,10 +32451,8 @@ function buildAccentHeader(accent) {
|
|
|
32004
32451
|
}
|
|
32005
32452
|
}
|
|
32006
32453
|
function streamKey2(chatId, threadId, lane, turnKey) {
|
|
32007
|
-
const
|
|
32008
|
-
|
|
32009
|
-
const withLane = lane != null && lane.length > 0 ? `${base}:${lane}` : base;
|
|
32010
|
-
return turnKey != null && turnKey.length > 0 ? `${withLane}:${turnKey}` : withLane;
|
|
32454
|
+
const base = lane != null && lane.length > 0 ? chatKeyWithSuffix(chatId, threadId ?? null, lane) : chatKey(chatId, threadId ?? null);
|
|
32455
|
+
return turnKey != null && turnKey.length > 0 ? `${base}:${turnKey}` : base;
|
|
32011
32456
|
}
|
|
32012
32457
|
async function handleStreamReply(args, state, deps) {
|
|
32013
32458
|
const chat_id = args.chat_id;
|
|
@@ -32202,14 +32647,14 @@ async function handleStreamReply(args, state, deps) {
|
|
|
32202
32647
|
// chat-lock.ts
|
|
32203
32648
|
function createChatLock() {
|
|
32204
32649
|
const chains = new Map;
|
|
32205
|
-
function run(
|
|
32206
|
-
const prior = chains.get(
|
|
32650
|
+
function run(key, fn) {
|
|
32651
|
+
const prior = chains.get(key) ?? Promise.resolve();
|
|
32207
32652
|
const next = prior.then(fn, fn);
|
|
32208
32653
|
const tracked = next.finally(() => {
|
|
32209
|
-
if (chains.get(
|
|
32210
|
-
chains.delete(
|
|
32654
|
+
if (chains.get(key) === tracked)
|
|
32655
|
+
chains.delete(key);
|
|
32211
32656
|
});
|
|
32212
|
-
chains.set(
|
|
32657
|
+
chains.set(key, tracked);
|
|
32213
32658
|
return next;
|
|
32214
32659
|
}
|
|
32215
32660
|
function wrapBot(bot) {
|
|
@@ -32220,8 +32665,21 @@ function createChatLock() {
|
|
|
32220
32665
|
return orig;
|
|
32221
32666
|
return function(...args) {
|
|
32222
32667
|
const first = args[0];
|
|
32223
|
-
|
|
32224
|
-
|
|
32668
|
+
if (typeof first !== "string" && typeof first !== "number") {
|
|
32669
|
+
return run("__global__", () => orig.apply(target, args));
|
|
32670
|
+
}
|
|
32671
|
+
const chatId = String(first);
|
|
32672
|
+
const last = args[args.length - 1];
|
|
32673
|
+
const lastIsOpts = last != null && typeof last === "object" && !Array.isArray(last);
|
|
32674
|
+
const threadFromOpts = lastIsOpts ? last.message_thread_id : undefined;
|
|
32675
|
+
let tid = typeof threadFromOpts === "number" ? threadFromOpts : null;
|
|
32676
|
+
if (tid === 1) {
|
|
32677
|
+
tid = null;
|
|
32678
|
+
const cleanedOpts = { ...last };
|
|
32679
|
+
delete cleanedOpts.message_thread_id;
|
|
32680
|
+
args = args.slice(0, -1).concat([cleanedOpts]);
|
|
32681
|
+
}
|
|
32682
|
+
return run(chatKey(chatId, tid), () => orig.apply(target, args));
|
|
32225
32683
|
};
|
|
32226
32684
|
}
|
|
32227
32685
|
});
|
|
@@ -32487,7 +32945,7 @@ function clear(key) {
|
|
|
32487
32945
|
state.delete(key);
|
|
32488
32946
|
}
|
|
32489
32947
|
|
|
32490
|
-
//
|
|
32948
|
+
// ../../switchroom-sec-1417/node_modules/.bun/posthog-node@5.29.2/node_modules/posthog-node/dist/extensions/error-tracking/modifiers/module.node.mjs
|
|
32491
32949
|
import { dirname as dirname2, posix, sep as sep2 } from "path";
|
|
32492
32950
|
function createModulerModifier() {
|
|
32493
32951
|
const getModuleFromFileName = createGetModuleFromFilename();
|
|
@@ -32523,7 +32981,7 @@ function normalizeWindowsPath(path) {
|
|
|
32523
32981
|
return path.replace(/^[A-Z]:/, "").replace(/\\/g, "/");
|
|
32524
32982
|
}
|
|
32525
32983
|
|
|
32526
|
-
//
|
|
32984
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/featureFlagUtils.mjs
|
|
32527
32985
|
var normalizeFlagsResponse = (flagsResponse) => {
|
|
32528
32986
|
if ("flags" in flagsResponse) {
|
|
32529
32987
|
const featureFlags = getFlagValuesFromFlags(flagsResponse.flags);
|
|
@@ -32594,7 +33052,7 @@ var parsePayload = (response) => {
|
|
|
32594
33052
|
}
|
|
32595
33053
|
};
|
|
32596
33054
|
|
|
32597
|
-
//
|
|
33055
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/gzip.mjs
|
|
32598
33056
|
function isGzipSupported() {
|
|
32599
33057
|
return "CompressionStream" in globalThis;
|
|
32600
33058
|
}
|
|
@@ -32614,7 +33072,7 @@ async function gzipCompress(input, isDebug = true) {
|
|
|
32614
33072
|
}
|
|
32615
33073
|
}
|
|
32616
33074
|
|
|
32617
|
-
//
|
|
33075
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/vendor/uuidv7.mjs
|
|
32618
33076
|
/*! For license information please see uuidv7.mjs.LICENSE.txt */
|
|
32619
33077
|
var DIGITS = "0123456789abcdef";
|
|
32620
33078
|
|
|
@@ -32792,7 +33250,7 @@ var defaultGenerator;
|
|
|
32792
33250
|
var uuidv7 = () => uuidv7obj().toString();
|
|
32793
33251
|
var uuidv7obj = () => (defaultGenerator || (defaultGenerator = new V7Generator)).generate();
|
|
32794
33252
|
|
|
32795
|
-
//
|
|
33253
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/types.mjs
|
|
32796
33254
|
var types_PostHogPersistedProperty = /* @__PURE__ */ function(PostHogPersistedProperty) {
|
|
32797
33255
|
PostHogPersistedProperty["AnonymousId"] = "anonymous_id";
|
|
32798
33256
|
PostHogPersistedProperty["DistinctId"] = "distinct_id";
|
|
@@ -32825,7 +33283,7 @@ var types_PostHogPersistedProperty = /* @__PURE__ */ function(PostHogPersistedPr
|
|
|
32825
33283
|
return PostHogPersistedProperty;
|
|
32826
33284
|
}({});
|
|
32827
33285
|
|
|
32828
|
-
//
|
|
33286
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/utils/bot-detection.mjs
|
|
32829
33287
|
var DEFAULT_BLOCKED_UA_STRS = [
|
|
32830
33288
|
"amazonbot",
|
|
32831
33289
|
"amazonproductbot",
|
|
@@ -32914,7 +33372,7 @@ var isBlockedUA = function(ua, customBlockedUserAgents = []) {
|
|
|
32914
33372
|
return uaLower.indexOf(blockedUaLower) !== -1;
|
|
32915
33373
|
});
|
|
32916
33374
|
};
|
|
32917
|
-
//
|
|
33375
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/utils/type-utils.mjs
|
|
32918
33376
|
var nativeIsArray = Array.isArray;
|
|
32919
33377
|
var ObjProto = Object.prototype;
|
|
32920
33378
|
var type_utils_hasOwnProperty = ObjProto.hasOwnProperty;
|
|
@@ -32951,7 +33409,7 @@ function isInstanceOf(candidate, base) {
|
|
|
32951
33409
|
}
|
|
32952
33410
|
}
|
|
32953
33411
|
|
|
32954
|
-
//
|
|
33412
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/utils/number-utils.mjs
|
|
32955
33413
|
function clampToRange(value, min, max, logger, fallbackValue) {
|
|
32956
33414
|
if (min > max) {
|
|
32957
33415
|
logger.warn("min cannot be greater than max.");
|
|
@@ -32971,7 +33429,7 @@ function clampToRange(value, min, max, logger, fallbackValue) {
|
|
|
32971
33429
|
return clampToRange(fallbackValue || max, min, max, logger);
|
|
32972
33430
|
}
|
|
32973
33431
|
|
|
32974
|
-
//
|
|
33432
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/utils/bucketed-rate-limiter.mjs
|
|
32975
33433
|
var ONE_DAY_IN_MS = 86400000;
|
|
32976
33434
|
|
|
32977
33435
|
class BucketedRateLimiter {
|
|
@@ -33015,7 +33473,7 @@ class BucketedRateLimiter {
|
|
|
33015
33473
|
this._buckets = {};
|
|
33016
33474
|
}
|
|
33017
33475
|
}
|
|
33018
|
-
//
|
|
33476
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/utils/promise-queue.mjs
|
|
33019
33477
|
class PromiseQueue {
|
|
33020
33478
|
add(promise) {
|
|
33021
33479
|
const promiseUUID = uuidv7();
|
|
@@ -33041,7 +33499,7 @@ class PromiseQueue {
|
|
|
33041
33499
|
this.promiseByIds = {};
|
|
33042
33500
|
}
|
|
33043
33501
|
}
|
|
33044
|
-
//
|
|
33502
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/utils/logger.mjs
|
|
33045
33503
|
function createConsole(consoleLike = console) {
|
|
33046
33504
|
const lockedMethods = {
|
|
33047
33505
|
log: consoleLike.log.bind(consoleLike),
|
|
@@ -33079,7 +33537,7 @@ var passThrough = (fn) => fn();
|
|
|
33079
33537
|
function createLogger(prefix, maybeCall = passThrough) {
|
|
33080
33538
|
return _createLogger(prefix, maybeCall, createConsole());
|
|
33081
33539
|
}
|
|
33082
|
-
//
|
|
33540
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/utils/user-agent-utils.mjs
|
|
33083
33541
|
var MOBILE = "Mobile";
|
|
33084
33542
|
var IOS = "iOS";
|
|
33085
33543
|
var ANDROID = "Android";
|
|
@@ -33336,7 +33794,7 @@ var osMatchers = [
|
|
|
33336
33794
|
]
|
|
33337
33795
|
];
|
|
33338
33796
|
|
|
33339
|
-
//
|
|
33797
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/utils/index.mjs
|
|
33340
33798
|
var STRING_FORMAT = "utf8";
|
|
33341
33799
|
function assert(truthyValue, message) {
|
|
33342
33800
|
if (!truthyValue || typeof truthyValue != "string" || isEmpty(truthyValue))
|
|
@@ -33384,7 +33842,7 @@ function allSettled(promises) {
|
|
|
33384
33842
|
reason
|
|
33385
33843
|
}))));
|
|
33386
33844
|
}
|
|
33387
|
-
//
|
|
33845
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/eventemitter.mjs
|
|
33388
33846
|
class SimpleEventEmitter {
|
|
33389
33847
|
constructor() {
|
|
33390
33848
|
this.events = {};
|
|
@@ -33406,7 +33864,7 @@ class SimpleEventEmitter {
|
|
|
33406
33864
|
}
|
|
33407
33865
|
}
|
|
33408
33866
|
|
|
33409
|
-
//
|
|
33867
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/posthog-core-stateless.mjs
|
|
33410
33868
|
class PostHogFetchHttpError extends Error {
|
|
33411
33869
|
constructor(response, reqByteLength) {
|
|
33412
33870
|
super("HTTP error while fetching PostHog: status=" + response.status + ", reqByteLength=" + reqByteLength), this.response = response, this.reqByteLength = reqByteLength, this.name = "PostHogFetchHttpError";
|
|
@@ -34121,7 +34579,7 @@ class PostHogCoreStateless {
|
|
|
34121
34579
|
return this.shutdownPromise;
|
|
34122
34580
|
}
|
|
34123
34581
|
}
|
|
34124
|
-
//
|
|
34582
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/index.mjs
|
|
34125
34583
|
var exports_error_tracking = {};
|
|
34126
34584
|
__export(exports_error_tracking, {
|
|
34127
34585
|
winjsStackLineParser: () => winjsStackLineParser,
|
|
@@ -34145,7 +34603,7 @@ __export(exports_error_tracking, {
|
|
|
34145
34603
|
DOMExceptionCoercer: () => DOMExceptionCoercer
|
|
34146
34604
|
});
|
|
34147
34605
|
|
|
34148
|
-
//
|
|
34606
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/chunk-ids.mjs
|
|
34149
34607
|
var parsedStackResults;
|
|
34150
34608
|
var lastKeysCount;
|
|
34151
34609
|
var cachedFilenameChunkIds;
|
|
@@ -34184,7 +34642,7 @@ function getFilenameToChunkIdMap(stackParser) {
|
|
|
34184
34642
|
return cachedFilenameChunkIds;
|
|
34185
34643
|
}
|
|
34186
34644
|
|
|
34187
|
-
//
|
|
34645
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/error-properties-builder.mjs
|
|
34188
34646
|
var MAX_CAUSE_RECURSION = 4;
|
|
34189
34647
|
|
|
34190
34648
|
class ErrorPropertiesBuilder {
|
|
@@ -34306,7 +34764,7 @@ class ErrorPropertiesBuilder {
|
|
|
34306
34764
|
return context;
|
|
34307
34765
|
}
|
|
34308
34766
|
}
|
|
34309
|
-
//
|
|
34767
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/parsers/base.mjs
|
|
34310
34768
|
var UNKNOWN_FUNCTION = "?";
|
|
34311
34769
|
function createFrame(platform, filename, func, lineno, colno) {
|
|
34312
34770
|
const frame = {
|
|
@@ -34322,7 +34780,7 @@ function createFrame(platform, filename, func, lineno, colno) {
|
|
|
34322
34780
|
return frame;
|
|
34323
34781
|
}
|
|
34324
34782
|
|
|
34325
|
-
//
|
|
34783
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/parsers/safari.mjs
|
|
34326
34784
|
var extractSafariExtensionDetails = (func, filename) => {
|
|
34327
34785
|
const isSafariExtension = func.indexOf("safari-extension") !== -1;
|
|
34328
34786
|
const isSafariWebExtension = func.indexOf("safari-web-extension") !== -1;
|
|
@@ -34335,7 +34793,7 @@ var extractSafariExtensionDetails = (func, filename) => {
|
|
|
34335
34793
|
];
|
|
34336
34794
|
};
|
|
34337
34795
|
|
|
34338
|
-
//
|
|
34796
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/parsers/chrome.mjs
|
|
34339
34797
|
var chromeRegexNoFnName = /^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i;
|
|
34340
34798
|
var chromeRegex = /^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i;
|
|
34341
34799
|
var chromeEvalRegex = /\((\S*)(?::(\d+))(?::(\d+))\)/;
|
|
@@ -34361,7 +34819,7 @@ var chromeStackLineParser = (line, platform) => {
|
|
|
34361
34819
|
}
|
|
34362
34820
|
};
|
|
34363
34821
|
|
|
34364
|
-
//
|
|
34822
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/parsers/gecko.mjs
|
|
34365
34823
|
var geckoREgex = /^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i;
|
|
34366
34824
|
var geckoEvalRegex = /(\S+) line (\d+)(?: > eval line \d+)* > eval/i;
|
|
34367
34825
|
var geckoStackLineParser = (line, platform) => {
|
|
@@ -34384,14 +34842,14 @@ var geckoStackLineParser = (line, platform) => {
|
|
|
34384
34842
|
}
|
|
34385
34843
|
};
|
|
34386
34844
|
|
|
34387
|
-
//
|
|
34845
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/parsers/winjs.mjs
|
|
34388
34846
|
var winjsRegex = /^\s*at (?:((?:\[object object\])?.+) )?\(?((?:[-a-z]+):.*?):(\d+)(?::(\d+))?\)?\s*$/i;
|
|
34389
34847
|
var winjsStackLineParser = (line, platform) => {
|
|
34390
34848
|
const parts = winjsRegex.exec(line);
|
|
34391
34849
|
return parts ? createFrame(platform, parts[2], parts[1] || UNKNOWN_FUNCTION, +parts[3], parts[4] ? +parts[4] : undefined) : undefined;
|
|
34392
34850
|
};
|
|
34393
34851
|
|
|
34394
|
-
//
|
|
34852
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/parsers/opera.mjs
|
|
34395
34853
|
var opera10Regex = / line (\d+).*script (?:in )?(\S+)(?:: in function (\S+))?$/i;
|
|
34396
34854
|
var opera10StackLineParser = (line, platform) => {
|
|
34397
34855
|
const parts = opera10Regex.exec(line);
|
|
@@ -34403,7 +34861,7 @@ var opera11StackLineParser = (line, platform) => {
|
|
|
34403
34861
|
return parts ? createFrame(platform, parts[5], parts[3] || parts[4] || UNKNOWN_FUNCTION, +parts[1], +parts[2]) : undefined;
|
|
34404
34862
|
};
|
|
34405
34863
|
|
|
34406
|
-
//
|
|
34864
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/parsers/node.mjs
|
|
34407
34865
|
var FILENAME_MATCH = /^\s*[-]{4,}$/;
|
|
34408
34866
|
var FULL_MATCH = /at (?:async )?(?:(.+?)\s+\()?(?:(.+):(\d+):(\d+)?|([^)]+))\)?/;
|
|
34409
34867
|
var nodeStackLineParser = (line, platform) => {
|
|
@@ -34472,7 +34930,7 @@ function _parseIntOrUndefined(input) {
|
|
|
34472
34930
|
return parseInt(input || "", 10) || undefined;
|
|
34473
34931
|
}
|
|
34474
34932
|
|
|
34475
|
-
//
|
|
34933
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/parsers/index.mjs
|
|
34476
34934
|
var WEBPACK_ERROR_REGEXP = /\(error: (.*)\)/;
|
|
34477
34935
|
var STACKTRACE_FRAME_LIMIT = 50;
|
|
34478
34936
|
function reverseAndStripFrames(stack) {
|
|
@@ -34517,7 +34975,7 @@ function createStackParser(platform, ...parsers) {
|
|
|
34517
34975
|
return reverseAndStripFrames(frames);
|
|
34518
34976
|
};
|
|
34519
34977
|
}
|
|
34520
|
-
//
|
|
34978
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/coercers/dom-exception-coercer.mjs
|
|
34521
34979
|
class DOMExceptionCoercer {
|
|
34522
34980
|
match(err) {
|
|
34523
34981
|
return this.isDOMException(err) || this.isDOMError(err);
|
|
@@ -34547,7 +35005,7 @@ class DOMExceptionCoercer {
|
|
|
34547
35005
|
return isBuiltin(err, "DOMError");
|
|
34548
35006
|
}
|
|
34549
35007
|
}
|
|
34550
|
-
//
|
|
35008
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/coercers/error-coercer.mjs
|
|
34551
35009
|
class ErrorCoercer {
|
|
34552
35010
|
match(err) {
|
|
34553
35011
|
return isPlainError(err);
|
|
@@ -34574,7 +35032,7 @@ class ErrorCoercer {
|
|
|
34574
35032
|
return err.stacktrace || err.stack || undefined;
|
|
34575
35033
|
}
|
|
34576
35034
|
}
|
|
34577
|
-
//
|
|
35035
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/coercers/error-event-coercer.mjs
|
|
34578
35036
|
class ErrorEventCoercer {
|
|
34579
35037
|
constructor() {}
|
|
34580
35038
|
match(err) {
|
|
@@ -34592,7 +35050,7 @@ class ErrorEventCoercer {
|
|
|
34592
35050
|
return exceptionLike;
|
|
34593
35051
|
}
|
|
34594
35052
|
}
|
|
34595
|
-
//
|
|
35053
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/coercers/string-coercer.mjs
|
|
34596
35054
|
var ERROR_TYPES_PATTERN = /^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;
|
|
34597
35055
|
|
|
34598
35056
|
class StringCoercer {
|
|
@@ -34622,7 +35080,7 @@ class StringCoercer {
|
|
|
34622
35080
|
];
|
|
34623
35081
|
}
|
|
34624
35082
|
}
|
|
34625
|
-
//
|
|
35083
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/types.mjs
|
|
34626
35084
|
var severityLevels = [
|
|
34627
35085
|
"fatal",
|
|
34628
35086
|
"error",
|
|
@@ -34632,7 +35090,7 @@ var severityLevels = [
|
|
|
34632
35090
|
"debug"
|
|
34633
35091
|
];
|
|
34634
35092
|
|
|
34635
|
-
//
|
|
35093
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/coercers/utils.mjs
|
|
34636
35094
|
function extractExceptionKeysForMessage(err, maxLength = 40) {
|
|
34637
35095
|
const keys = Object.keys(err);
|
|
34638
35096
|
keys.sort();
|
|
@@ -34649,7 +35107,7 @@ function extractExceptionKeysForMessage(err, maxLength = 40) {
|
|
|
34649
35107
|
return "";
|
|
34650
35108
|
}
|
|
34651
35109
|
|
|
34652
|
-
//
|
|
35110
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/coercers/object-coercer.mjs
|
|
34653
35111
|
class ObjectCoercer {
|
|
34654
35112
|
match(candidate) {
|
|
34655
35113
|
return typeof candidate == "object" && candidate !== null;
|
|
@@ -34702,7 +35160,7 @@ class ObjectCoercer {
|
|
|
34702
35160
|
}
|
|
34703
35161
|
}
|
|
34704
35162
|
}
|
|
34705
|
-
//
|
|
35163
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/coercers/event-coercer.mjs
|
|
34706
35164
|
class EventCoercer {
|
|
34707
35165
|
match(err) {
|
|
34708
35166
|
return isEvent(err);
|
|
@@ -34717,7 +35175,7 @@ class EventCoercer {
|
|
|
34717
35175
|
};
|
|
34718
35176
|
}
|
|
34719
35177
|
}
|
|
34720
|
-
//
|
|
35178
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/coercers/primitive-coercer.mjs
|
|
34721
35179
|
class PrimitiveCoercer {
|
|
34722
35180
|
match(candidate) {
|
|
34723
35181
|
return isPrimitive(candidate);
|
|
@@ -34731,7 +35189,7 @@ class PrimitiveCoercer {
|
|
|
34731
35189
|
};
|
|
34732
35190
|
}
|
|
34733
35191
|
}
|
|
34734
|
-
//
|
|
35192
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/coercers/promise-rejection-event.mjs
|
|
34735
35193
|
class PromiseRejectionEventCoercer {
|
|
34736
35194
|
match(err) {
|
|
34737
35195
|
return isBuiltin(err, "PromiseRejectionEvent") || this.isCustomEventWrappingRejection(err);
|
|
@@ -34767,7 +35225,7 @@ class PromiseRejectionEventCoercer {
|
|
|
34767
35225
|
return error;
|
|
34768
35226
|
}
|
|
34769
35227
|
}
|
|
34770
|
-
//
|
|
35228
|
+
// ../../switchroom-sec-1417/node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/utils.mjs
|
|
34771
35229
|
class ReduceableCache {
|
|
34772
35230
|
constructor(_maxSize) {
|
|
34773
35231
|
this._maxSize = _maxSize;
|
|
@@ -34792,7 +35250,7 @@ class ReduceableCache {
|
|
|
34792
35250
|
}
|
|
34793
35251
|
}
|
|
34794
35252
|
}
|
|
34795
|
-
//
|
|
35253
|
+
// ../../switchroom-sec-1417/node_modules/.bun/posthog-node@5.29.2/node_modules/posthog-node/dist/extensions/error-tracking/modifiers/context-lines.node.mjs
|
|
34796
35254
|
import { createReadStream } from "node:fs";
|
|
34797
35255
|
import { createInterface } from "node:readline";
|
|
34798
35256
|
var LRU_FILE_CONTENTS_CACHE = new exports_error_tracking.ReduceableCache(25);
|
|
@@ -35010,7 +35468,7 @@ function snipLine(line, colno) {
|
|
|
35010
35468
|
return newLine;
|
|
35011
35469
|
}
|
|
35012
35470
|
|
|
35013
|
-
//
|
|
35471
|
+
// ../../switchroom-sec-1417/node_modules/.bun/posthog-node@5.29.2/node_modules/posthog-node/dist/extensions/error-tracking/autocapture.mjs
|
|
35014
35472
|
function makeUncaughtExceptionHandler(captureFn, onFatalFn) {
|
|
35015
35473
|
let calledFatalError = false;
|
|
35016
35474
|
return Object.assign((error) => {
|
|
@@ -35042,7 +35500,7 @@ function addUnhandledRejectionListener(captureFn) {
|
|
|
35042
35500
|
}));
|
|
35043
35501
|
}
|
|
35044
35502
|
|
|
35045
|
-
//
|
|
35503
|
+
// ../../switchroom-sec-1417/node_modules/.bun/posthog-node@5.29.2/node_modules/posthog-node/dist/extensions/error-tracking/index.mjs
|
|
35046
35504
|
var SHUTDOWN_TIMEOUT = 2000;
|
|
35047
35505
|
|
|
35048
35506
|
class ErrorTracking {
|
|
@@ -35111,10 +35569,10 @@ class ErrorTracking {
|
|
|
35111
35569
|
}
|
|
35112
35570
|
}
|
|
35113
35571
|
|
|
35114
|
-
//
|
|
35572
|
+
// ../../switchroom-sec-1417/node_modules/.bun/posthog-node@5.29.2/node_modules/posthog-node/dist/version.mjs
|
|
35115
35573
|
var version = "5.29.2";
|
|
35116
35574
|
|
|
35117
|
-
//
|
|
35575
|
+
// ../../switchroom-sec-1417/node_modules/.bun/posthog-node@5.29.2/node_modules/posthog-node/dist/types.mjs
|
|
35118
35576
|
var FeatureFlagError2 = {
|
|
35119
35577
|
ERRORS_WHILE_COMPUTING: "errors_while_computing_flags",
|
|
35120
35578
|
FLAG_MISSING: "flag_missing",
|
|
@@ -35122,7 +35580,7 @@ var FeatureFlagError2 = {
|
|
|
35122
35580
|
UNKNOWN_ERROR: "unknown_error"
|
|
35123
35581
|
};
|
|
35124
35582
|
|
|
35125
|
-
//
|
|
35583
|
+
// ../../switchroom-sec-1417/node_modules/.bun/posthog-node@5.29.2/node_modules/posthog-node/dist/extensions/feature-flags/crypto.mjs
|
|
35126
35584
|
async function hashSHA1(text) {
|
|
35127
35585
|
const subtle = globalThis.crypto?.subtle;
|
|
35128
35586
|
if (!subtle)
|
|
@@ -35132,7 +35590,7 @@ async function hashSHA1(text) {
|
|
|
35132
35590
|
return hashArray.map((byte) => byte.toString(16).padStart(2, "0")).join("");
|
|
35133
35591
|
}
|
|
35134
35592
|
|
|
35135
|
-
//
|
|
35593
|
+
// ../../switchroom-sec-1417/node_modules/.bun/posthog-node@5.29.2/node_modules/posthog-node/dist/extensions/feature-flags/feature-flags.mjs
|
|
35136
35594
|
var SIXTY_SECONDS = 60000;
|
|
35137
35595
|
var LONG_SCALE = 1152921504606847000;
|
|
35138
35596
|
var NULL_VALUES_ALLOWED_OPERATORS = [
|
|
@@ -36006,7 +36464,7 @@ function relativeDateParseForFeatureFlagMatching(value) {
|
|
|
36006
36464
|
}
|
|
36007
36465
|
}
|
|
36008
36466
|
|
|
36009
|
-
//
|
|
36467
|
+
// ../../switchroom-sec-1417/node_modules/.bun/posthog-node@5.29.2/node_modules/posthog-node/dist/storage-memory.mjs
|
|
36010
36468
|
class PostHogMemoryStorage {
|
|
36011
36469
|
getProperty(key) {
|
|
36012
36470
|
return this._memoryStorage[key];
|
|
@@ -36019,7 +36477,7 @@ class PostHogMemoryStorage {
|
|
|
36019
36477
|
}
|
|
36020
36478
|
}
|
|
36021
36479
|
|
|
36022
|
-
//
|
|
36480
|
+
// ../../switchroom-sec-1417/node_modules/.bun/posthog-node@5.29.2/node_modules/posthog-node/dist/client.mjs
|
|
36023
36481
|
var MINIMUM_POLLING_INTERVAL = 100;
|
|
36024
36482
|
var THIRTY_SECONDS = 30000;
|
|
36025
36483
|
var MAX_CACHE_SIZE = 50000;
|
|
@@ -36807,7 +37265,7 @@ class PostHogBackendClient extends PostHogCoreStateless {
|
|
|
36807
37265
|
}
|
|
36808
37266
|
}
|
|
36809
37267
|
|
|
36810
|
-
//
|
|
37268
|
+
// ../../switchroom-sec-1417/node_modules/.bun/posthog-node@5.29.2/node_modules/posthog-node/dist/extensions/context/context.mjs
|
|
36811
37269
|
import { AsyncLocalStorage as AsyncLocalStorage2 } from "node:async_hooks";
|
|
36812
37270
|
|
|
36813
37271
|
class PostHogContext {
|
|
@@ -36838,7 +37296,7 @@ class PostHogContext {
|
|
|
36838
37296
|
}
|
|
36839
37297
|
}
|
|
36840
37298
|
|
|
36841
|
-
//
|
|
37299
|
+
// ../../switchroom-sec-1417/node_modules/.bun/posthog-node@5.29.2/node_modules/posthog-node/dist/extensions/sentry-integration.mjs
|
|
36842
37300
|
var NAME = "posthog-node";
|
|
36843
37301
|
function createEventProcessor(_posthog, { organization, projectId, prefix, severityAllowList = [
|
|
36844
37302
|
"error"
|
|
@@ -36906,7 +37364,7 @@ class PostHogSentryIntegration {
|
|
|
36906
37364
|
};
|
|
36907
37365
|
}
|
|
36908
37366
|
}
|
|
36909
|
-
//
|
|
37367
|
+
// ../../switchroom-sec-1417/node_modules/.bun/posthog-node@5.29.2/node_modules/posthog-node/dist/entrypoints/index.node.mjs
|
|
36910
37368
|
ErrorTracking.errorPropertiesBuilder = new exports_error_tracking.ErrorPropertiesBuilder([
|
|
36911
37369
|
new exports_error_tracking.EventCoercer,
|
|
36912
37370
|
new exports_error_tracking.ErrorCoercer,
|
|
@@ -41300,6 +41758,7 @@ function flushOnAgentDisconnect(deps) {
|
|
|
41300
41758
|
activeStatusReactions,
|
|
41301
41759
|
activeReactionMsgIds,
|
|
41302
41760
|
activeTurnStartedAt,
|
|
41761
|
+
claudeBusyKeys,
|
|
41303
41762
|
activeDraftStreams,
|
|
41304
41763
|
activeDraftParseModes,
|
|
41305
41764
|
clearActiveReactions: clearActiveReactions3,
|
|
@@ -41316,6 +41775,7 @@ function flushOnAgentDisconnect(deps) {
|
|
|
41316
41775
|
activeStatusReactions.delete(key);
|
|
41317
41776
|
activeReactionMsgIds.delete(key);
|
|
41318
41777
|
activeTurnStartedAt.delete(key);
|
|
41778
|
+
claudeBusyKeys.delete(key);
|
|
41319
41779
|
}
|
|
41320
41780
|
clearActiveReactions3();
|
|
41321
41781
|
const danglingKeys = [...activeTurnStartedAt.keys()];
|
|
@@ -41323,10 +41783,16 @@ function flushOnAgentDisconnect(deps) {
|
|
|
41323
41783
|
for (const k of danglingKeys) {
|
|
41324
41784
|
activeTurnStartedAt.delete(k);
|
|
41325
41785
|
activeReactionMsgIds.delete(k);
|
|
41786
|
+
claudeBusyKeys.delete(k);
|
|
41326
41787
|
}
|
|
41327
41788
|
log(`telegram gateway: disconnect-flush swept ${danglingKeys.length} dangling turn key(s) ` + `post-bridge-death (controller loop missed \u2014 finalize raced disconnect)`);
|
|
41328
41789
|
onDanglingTurnsSwept?.(danglingKeys);
|
|
41329
41790
|
}
|
|
41791
|
+
if (claudeBusyKeys.size > 0) {
|
|
41792
|
+
const orphanCount = claudeBusyKeys.size;
|
|
41793
|
+
claudeBusyKeys.clear();
|
|
41794
|
+
log(`telegram gateway: disconnect-flush cleared ${orphanCount} orphan claudeBusyKeys ` + `entr${orphanCount === 1 ? "y" : "ies"} (synthetic-inbound deliveries that never turn_ended)`);
|
|
41795
|
+
}
|
|
41330
41796
|
disposeProgressDriver();
|
|
41331
41797
|
for (const [key, stream] of activeDraftStreams.entries()) {
|
|
41332
41798
|
if (!stream.isFinal())
|
|
@@ -42715,6 +43181,7 @@ init_zod();
|
|
|
42715
43181
|
init_schema();
|
|
42716
43182
|
init_paths();
|
|
42717
43183
|
init_overlay_loader();
|
|
43184
|
+
init_merge();
|
|
42718
43185
|
import { readFileSync as readFileSync14, existsSync as existsSync18 } from "node:fs";
|
|
42719
43186
|
import { homedir as homedir8 } from "node:os";
|
|
42720
43187
|
import { resolve as resolve5 } from "node:path";
|
|
@@ -42836,11 +43303,37 @@ function loadConfig2(configPath) {
|
|
|
42836
43303
|
throw err;
|
|
42837
43304
|
}
|
|
42838
43305
|
applyAgentOverlays(config);
|
|
43306
|
+
validateAllCronTopicAliases2(config, filePath);
|
|
42839
43307
|
return config;
|
|
42840
43308
|
}
|
|
43309
|
+
function validateAllCronTopicAliases2(config, filePath) {
|
|
43310
|
+
const issues = [];
|
|
43311
|
+
for (const [agentName3, agentRaw] of Object.entries(config.agents)) {
|
|
43312
|
+
if (!agentRaw)
|
|
43313
|
+
continue;
|
|
43314
|
+
const resolved = resolveAgentConfig(config.defaults, config.profiles, agentRaw);
|
|
43315
|
+
const schedule = resolved.schedule ?? [];
|
|
43316
|
+
if (schedule.length === 0)
|
|
43317
|
+
continue;
|
|
43318
|
+
const tg = resolved.channels?.telegram;
|
|
43319
|
+
const aliases = new Set(Object.keys(tg?.topic_aliases ?? {}));
|
|
43320
|
+
for (const entry of schedule) {
|
|
43321
|
+
if (entry.topic == null)
|
|
43322
|
+
continue;
|
|
43323
|
+
if (typeof entry.topic === "number")
|
|
43324
|
+
continue;
|
|
43325
|
+
if (!aliases.has(entry.topic)) {
|
|
43326
|
+
issues.push(` agents.${agentName3}.schedule cron \`${entry.cron}\`: ` + `topic alias "${entry.topic}" is not defined in ` + `channels.telegram.topic_aliases.`);
|
|
43327
|
+
}
|
|
43328
|
+
}
|
|
43329
|
+
}
|
|
43330
|
+
if (issues.length > 0) {
|
|
43331
|
+
throw new ConfigError2(`Cron \`topic:\` alias references unknown topic_aliases in ${filePath}`, issues);
|
|
43332
|
+
}
|
|
43333
|
+
}
|
|
42841
43334
|
|
|
42842
43335
|
// ../src/config/merge.ts
|
|
42843
|
-
function
|
|
43336
|
+
function dedupe2(items) {
|
|
42844
43337
|
const seen = new Set;
|
|
42845
43338
|
const out = [];
|
|
42846
43339
|
for (const item of items) {
|
|
@@ -42851,7 +43344,7 @@ function dedupe(items) {
|
|
|
42851
43344
|
}
|
|
42852
43345
|
return out;
|
|
42853
43346
|
}
|
|
42854
|
-
function
|
|
43347
|
+
function deepMergeJson2(base, override) {
|
|
42855
43348
|
if (override === undefined)
|
|
42856
43349
|
return base;
|
|
42857
43350
|
if (base === undefined)
|
|
@@ -42863,25 +43356,25 @@ function deepMergeJson(base, override) {
|
|
|
42863
43356
|
for (const [k, v] of Object.entries(override)) {
|
|
42864
43357
|
if (k === "__proto__" || k === "constructor" || k === "prototype")
|
|
42865
43358
|
continue;
|
|
42866
|
-
out[k] =
|
|
43359
|
+
out[k] = deepMergeJson2(out[k], v);
|
|
42867
43360
|
}
|
|
42868
43361
|
return out;
|
|
42869
43362
|
}
|
|
42870
|
-
function
|
|
42871
|
-
if (!
|
|
42872
|
-
|
|
43363
|
+
function resolveAgentConfig2(defaults, profiles, agent) {
|
|
43364
|
+
if (!mergeAgentConfig2.suppressDeprecationLogs && !mergeAgentConfig2.notifiedWorkerIsolationMove && defaults?.subagents?.worker?.isolation === "worktree") {
|
|
43365
|
+
mergeAgentConfig2.notifiedWorkerIsolationMove = true;
|
|
42873
43366
|
console.warn("[switchroom] NOTICE: defaults.subagents.worker.isolation moved to the " + "`coding` profile in switchroom 0.6.6 (#682). Agents extending coding " + "still get worktree-isolated workers; other agents would have hard-failed " + "the first time they delegated. See CHANGELOG.");
|
|
42874
43367
|
}
|
|
42875
43368
|
const name = agent.extends;
|
|
42876
43369
|
const profile = name && profiles ? profiles[name] : undefined;
|
|
42877
43370
|
if (!profile) {
|
|
42878
|
-
return
|
|
43371
|
+
return mergeAgentConfig2(defaults, agent);
|
|
42879
43372
|
}
|
|
42880
43373
|
const { extends: _unused, ...profileWithoutExtends } = profile;
|
|
42881
|
-
const layered =
|
|
42882
|
-
return
|
|
43374
|
+
const layered = mergeAgentConfig2(defaults, profileWithoutExtends);
|
|
43375
|
+
return mergeAgentConfig2(layered, agent);
|
|
42883
43376
|
}
|
|
42884
|
-
function
|
|
43377
|
+
function foldDeprecatedTelegramFields2(config) {
|
|
42885
43378
|
const c = config;
|
|
42886
43379
|
const root = c;
|
|
42887
43380
|
const deprecations = [];
|
|
@@ -42912,15 +43405,15 @@ function foldDeprecatedTelegramFields(config) {
|
|
|
42912
43405
|
deprecations
|
|
42913
43406
|
};
|
|
42914
43407
|
}
|
|
42915
|
-
function
|
|
42916
|
-
const { config: agent, deprecations: agentDeprecations } =
|
|
42917
|
-
const defaultsMigration = defaultsIn ?
|
|
43408
|
+
function mergeAgentConfig2(defaultsIn, agentIn) {
|
|
43409
|
+
const { config: agent, deprecations: agentDeprecations } = foldDeprecatedTelegramFields2(agentIn);
|
|
43410
|
+
const defaultsMigration = defaultsIn ? foldDeprecatedTelegramFields2(defaultsIn) : null;
|
|
42918
43411
|
const defaults = defaultsMigration?.config;
|
|
42919
43412
|
const allDeprecations = [
|
|
42920
43413
|
...agentDeprecations,
|
|
42921
43414
|
...defaultsMigration?.deprecations ?? []
|
|
42922
43415
|
];
|
|
42923
|
-
if (allDeprecations.length > 0 && !
|
|
43416
|
+
if (allDeprecations.length > 0 && !mergeAgentConfig2.suppressDeprecationLogs) {
|
|
42924
43417
|
for (const msg of allDeprecations) {
|
|
42925
43418
|
console.warn(`[switchroom] DEPRECATION: ${msg}`);
|
|
42926
43419
|
}
|
|
@@ -42958,8 +43451,8 @@ function mergeAgentConfig(defaultsIn, agentIn) {
|
|
|
42958
43451
|
const dDeny = defaults.tools?.deny ?? [];
|
|
42959
43452
|
const aDeny = merged.tools?.deny ?? [];
|
|
42960
43453
|
merged.tools = {
|
|
42961
|
-
allow:
|
|
42962
|
-
deny:
|
|
43454
|
+
allow: dedupe2([...dAllow, ...aAllow]),
|
|
43455
|
+
deny: dedupe2([...dDeny, ...aDeny])
|
|
42963
43456
|
};
|
|
42964
43457
|
}
|
|
42965
43458
|
if (defaults.soul || merged.soul) {
|
|
@@ -43097,10 +43590,10 @@ function mergeAgentConfig(defaultsIn, agentIn) {
|
|
|
43097
43590
|
if (defaults.skills || merged.skills) {
|
|
43098
43591
|
const d = defaults.skills ?? [];
|
|
43099
43592
|
const a = merged.skills ?? [];
|
|
43100
|
-
merged.skills =
|
|
43593
|
+
merged.skills = dedupe2([...d, ...a]);
|
|
43101
43594
|
}
|
|
43102
43595
|
if (defaults.settings_raw || merged.settings_raw) {
|
|
43103
|
-
merged.settings_raw =
|
|
43596
|
+
merged.settings_raw = deepMergeJson2(defaults.settings_raw ?? {}, merged.settings_raw ?? {});
|
|
43104
43597
|
}
|
|
43105
43598
|
if (defaults.claude_md_raw || merged.claude_md_raw) {
|
|
43106
43599
|
const parts = [defaults.claude_md_raw, merged.claude_md_raw].filter((p) => typeof p === "string" && p.length > 0);
|
|
@@ -43117,7 +43610,7 @@ function mergeAgentConfig(defaultsIn, agentIn) {
|
|
|
43117
43610
|
if (defaults.extra_stable_files || merged.extra_stable_files) {
|
|
43118
43611
|
const d = defaults.extra_stable_files ?? [];
|
|
43119
43612
|
const a = merged.extra_stable_files ?? [];
|
|
43120
|
-
merged.extra_stable_files =
|
|
43613
|
+
merged.extra_stable_files = dedupe2([...d, ...a]);
|
|
43121
43614
|
}
|
|
43122
43615
|
const dReactions = defaults.reactions;
|
|
43123
43616
|
const mReactions = merged.reactions;
|
|
@@ -43146,7 +43639,60 @@ function mergeAgentConfig(defaultsIn, agentIn) {
|
|
|
43146
43639
|
((mergeAgentConfig) => {
|
|
43147
43640
|
mergeAgentConfig.suppressDeprecationLogs = false;
|
|
43148
43641
|
mergeAgentConfig.notifiedWorkerIsolationMove = false;
|
|
43149
|
-
})(
|
|
43642
|
+
})(mergeAgentConfig2 ||= {});
|
|
43643
|
+
|
|
43644
|
+
// ../src/telegram/topic-router.ts
|
|
43645
|
+
var ALERTS_ALIAS = "alerts";
|
|
43646
|
+
var ADMIN_ALIAS = "admin";
|
|
43647
|
+
function aliasToId(config, name) {
|
|
43648
|
+
return config.topic_aliases?.[name];
|
|
43649
|
+
}
|
|
43650
|
+
function resolveOutboundTopic(config, event) {
|
|
43651
|
+
const cfg = config ?? {};
|
|
43652
|
+
const inSupergroupMode = cfg.default_topic_id != null;
|
|
43653
|
+
switch (event.kind) {
|
|
43654
|
+
case "reply":
|
|
43655
|
+
return event.originThreadId;
|
|
43656
|
+
case "subagent-progress":
|
|
43657
|
+
return event.parentThreadId;
|
|
43658
|
+
case "command-query":
|
|
43659
|
+
return event.originThreadId;
|
|
43660
|
+
case "vault":
|
|
43661
|
+
case "permission":
|
|
43662
|
+
if (event.turnInitiated) {
|
|
43663
|
+
return event.originThreadId ?? cfg.default_topic_id;
|
|
43664
|
+
}
|
|
43665
|
+
if (!inSupergroupMode)
|
|
43666
|
+
return;
|
|
43667
|
+
return aliasToId(cfg, ADMIN_ALIAS) ?? cfg.default_topic_id;
|
|
43668
|
+
case "hostd-approval":
|
|
43669
|
+
if (event.originThreadId != null)
|
|
43670
|
+
return event.originThreadId;
|
|
43671
|
+
if (!inSupergroupMode)
|
|
43672
|
+
return;
|
|
43673
|
+
return aliasToId(cfg, ADMIN_ALIAS) ?? cfg.default_topic_id;
|
|
43674
|
+
case "cron": {
|
|
43675
|
+
if (typeof event.entryTopic === "number")
|
|
43676
|
+
return event.entryTopic;
|
|
43677
|
+
if (typeof event.entryTopic === "string") {
|
|
43678
|
+
const resolved = aliasToId(cfg, event.entryTopic);
|
|
43679
|
+
if (resolved != null)
|
|
43680
|
+
return resolved;
|
|
43681
|
+
}
|
|
43682
|
+
return cfg.default_topic_id;
|
|
43683
|
+
}
|
|
43684
|
+
case "boot":
|
|
43685
|
+
case "compact-watchdog":
|
|
43686
|
+
if (!inSupergroupMode)
|
|
43687
|
+
return;
|
|
43688
|
+
return aliasToId(cfg, ALERTS_ALIAS) ?? cfg.default_topic_id;
|
|
43689
|
+
case "command-mutation":
|
|
43690
|
+
case "command-heavy":
|
|
43691
|
+
if (!inSupergroupMode)
|
|
43692
|
+
return;
|
|
43693
|
+
return aliasToId(cfg, ADMIN_ALIAS) ?? cfg.default_topic_id;
|
|
43694
|
+
}
|
|
43695
|
+
}
|
|
43150
43696
|
|
|
43151
43697
|
// ../src/agents/perf.ts
|
|
43152
43698
|
import { existsSync as existsSync19, readFileSync as readFileSync15 } from "node:fs";
|
|
@@ -43794,6 +44340,17 @@ function validateClientMessage(msg) {
|
|
|
43794
44340
|
return false;
|
|
43795
44341
|
return true;
|
|
43796
44342
|
}
|
|
44343
|
+
case "request_ms365_approval": {
|
|
44344
|
+
if (typeof m.correlationId !== "string" || m.correlationId.length === 0 || m.correlationId.length > 64)
|
|
44345
|
+
return false;
|
|
44346
|
+
if (typeof m.agentName !== "string" || !AGENT_NAME_RE3.test(m.agentName))
|
|
44347
|
+
return false;
|
|
44348
|
+
if (typeof m.preview !== "object" || m.preview === null)
|
|
44349
|
+
return false;
|
|
44350
|
+
if (m.ttlMs !== undefined && (typeof m.ttlMs !== "number" || !Number.isFinite(m.ttlMs) || m.ttlMs < 0))
|
|
44351
|
+
return false;
|
|
44352
|
+
return true;
|
|
44353
|
+
}
|
|
43797
44354
|
default:
|
|
43798
44355
|
return false;
|
|
43799
44356
|
}
|
|
@@ -43812,6 +44369,7 @@ function createIpcServer(options) {
|
|
|
43812
44369
|
onPtyPartial,
|
|
43813
44370
|
onInjectInbound,
|
|
43814
44371
|
onRequestDriveApproval,
|
|
44372
|
+
onRequestMs365Approval,
|
|
43815
44373
|
onRequestConfigApproval,
|
|
43816
44374
|
onRequestConfigFinalize,
|
|
43817
44375
|
log = () => {},
|
|
@@ -43918,6 +44476,30 @@ function createIpcServer(options) {
|
|
|
43918
44476
|
} catch {}
|
|
43919
44477
|
}
|
|
43920
44478
|
break;
|
|
44479
|
+
case "request_ms365_approval":
|
|
44480
|
+
if (onRequestMs365Approval) {
|
|
44481
|
+
onRequestMs365Approval(client3, msg).catch((err) => {
|
|
44482
|
+
log(`request_ms365_approval handler threw (client=${client3.id}): ${err.message}`);
|
|
44483
|
+
try {
|
|
44484
|
+
client3.send({
|
|
44485
|
+
type: "ms365_approval_posted",
|
|
44486
|
+
correlationId: msg.correlationId,
|
|
44487
|
+
ok: false,
|
|
44488
|
+
reason: `gateway handler error: ${err.message}`
|
|
44489
|
+
});
|
|
44490
|
+
} catch {}
|
|
44491
|
+
});
|
|
44492
|
+
} else {
|
|
44493
|
+
try {
|
|
44494
|
+
client3.send({
|
|
44495
|
+
type: "ms365_approval_posted",
|
|
44496
|
+
correlationId: msg.correlationId,
|
|
44497
|
+
ok: false,
|
|
44498
|
+
reason: "gateway not configured for MS-365 write approval"
|
|
44499
|
+
});
|
|
44500
|
+
} catch {}
|
|
44501
|
+
}
|
|
44502
|
+
break;
|
|
43921
44503
|
case "request_config_approval":
|
|
43922
44504
|
if (onRequestConfigApproval) {
|
|
43923
44505
|
onRequestConfigApproval(client3, msg).catch((err) => {
|
|
@@ -44354,6 +44936,184 @@ function clampTtl(requested, fallback, min, max) {
|
|
|
44354
44936
|
return t;
|
|
44355
44937
|
}
|
|
44356
44938
|
|
|
44939
|
+
// gateway/ms365-write-approval.ts
|
|
44940
|
+
function validateMs365Preview(input) {
|
|
44941
|
+
if (!input || typeof input !== "object")
|
|
44942
|
+
return null;
|
|
44943
|
+
const o = input;
|
|
44944
|
+
if (typeof o.agentName !== "string" || o.agentName.length === 0)
|
|
44945
|
+
return null;
|
|
44946
|
+
if (typeof o.toolName !== "string" || o.toolName.length === 0)
|
|
44947
|
+
return null;
|
|
44948
|
+
if (typeof o.itemId !== "string" || o.itemId.length === 0)
|
|
44949
|
+
return null;
|
|
44950
|
+
if (typeof o.itemDisplayName !== "string")
|
|
44951
|
+
return null;
|
|
44952
|
+
if (typeof o.accountEmail !== "string")
|
|
44953
|
+
return null;
|
|
44954
|
+
const out = {
|
|
44955
|
+
agentName: o.agentName,
|
|
44956
|
+
toolName: o.toolName,
|
|
44957
|
+
itemId: o.itemId,
|
|
44958
|
+
itemDisplayName: o.itemDisplayName,
|
|
44959
|
+
accountEmail: o.accountEmail
|
|
44960
|
+
};
|
|
44961
|
+
if (typeof o.deepLink === "string")
|
|
44962
|
+
out.deepLink = o.deepLink;
|
|
44963
|
+
if (typeof o.sizeBytesBefore === "number")
|
|
44964
|
+
out.sizeBytesBefore = o.sizeBytesBefore;
|
|
44965
|
+
if (typeof o.sizeBytesAfter === "number")
|
|
44966
|
+
out.sizeBytesAfter = o.sizeBytesAfter;
|
|
44967
|
+
if (typeof o.agentRationale === "string")
|
|
44968
|
+
out.agentRationale = o.agentRationale;
|
|
44969
|
+
return out;
|
|
44970
|
+
}
|
|
44971
|
+
var DEFAULT_TTL_MS2 = 5 * 60 * 1000;
|
|
44972
|
+
var MAX_TTL_MS2 = 30 * 60 * 1000;
|
|
44973
|
+
var MIN_TTL_MS2 = 30 * 1000;
|
|
44974
|
+
function defaultKeyboard(requestId) {
|
|
44975
|
+
return {
|
|
44976
|
+
inline_keyboard: [
|
|
44977
|
+
[
|
|
44978
|
+
{ text: "\u2705 Approve", callback_data: `apv:${requestId}:once` },
|
|
44979
|
+
{ text: "\uD83D\uDEAB Deny", callback_data: `apv:${requestId}:deny` }
|
|
44980
|
+
]
|
|
44981
|
+
]
|
|
44982
|
+
};
|
|
44983
|
+
}
|
|
44984
|
+
function buildMs365CardText(p) {
|
|
44985
|
+
const lines = [];
|
|
44986
|
+
lines.push(`\uD83D\uDCC4 Microsoft 365 write approval`);
|
|
44987
|
+
lines.push("");
|
|
44988
|
+
lines.push(`Agent: ${truncate2(p.agentName, 64)}`);
|
|
44989
|
+
lines.push(`Tool: ${truncate2(p.toolName.replace(/^mcp__/, ""), 96)}`);
|
|
44990
|
+
lines.push(`Item: ${truncate2(p.itemDisplayName, 256)}`);
|
|
44991
|
+
if (p.itemId !== "(new)") {
|
|
44992
|
+
lines.push(`ID: ${truncate2(p.itemId, 96)}`);
|
|
44993
|
+
}
|
|
44994
|
+
lines.push(`Account: ${truncate2(p.accountEmail, 96)}`);
|
|
44995
|
+
if (typeof p.sizeBytesBefore === "number" || typeof p.sizeBytesAfter === "number") {
|
|
44996
|
+
const before = p.sizeBytesBefore ?? 0;
|
|
44997
|
+
const after = p.sizeBytesAfter ?? 0;
|
|
44998
|
+
const delta = after - before;
|
|
44999
|
+
const sign = delta >= 0 ? "+" : "";
|
|
45000
|
+
lines.push(`Size: ${humanBytes(before)} \u2192 ${humanBytes(after)} (${sign}${humanBytes(delta)})`);
|
|
45001
|
+
}
|
|
45002
|
+
if (p.deepLink) {
|
|
45003
|
+
lines.push(`Link: ${truncate2(p.deepLink, 256)}`);
|
|
45004
|
+
}
|
|
45005
|
+
if (p.agentRationale) {
|
|
45006
|
+
lines.push("");
|
|
45007
|
+
lines.push(`\uD83D\uDCAC ${truncate2(p.agentRationale, 512)}`);
|
|
45008
|
+
}
|
|
45009
|
+
lines.push("");
|
|
45010
|
+
lines.push("\u26a0\ufe0f Weak attestation (RFC \u00a78 v1): operator should click through to verify the actual change before approving. Structural diff coming v1.5.");
|
|
45011
|
+
return lines.join(`
|
|
45012
|
+
`);
|
|
45013
|
+
}
|
|
45014
|
+
function truncate2(s, n) {
|
|
45015
|
+
if (s.length <= n)
|
|
45016
|
+
return s;
|
|
45017
|
+
return s.slice(0, n - 1) + "\u2026";
|
|
45018
|
+
}
|
|
45019
|
+
function humanBytes(bytes) {
|
|
45020
|
+
const abs = Math.abs(bytes);
|
|
45021
|
+
if (abs < 1024)
|
|
45022
|
+
return `${bytes}B`;
|
|
45023
|
+
if (abs < 1024 * 1024)
|
|
45024
|
+
return `${(bytes / 1024).toFixed(1)}KB`;
|
|
45025
|
+
if (abs < 1024 * 1024 * 1024)
|
|
45026
|
+
return `${(bytes / 1024 / 1024).toFixed(2)}MB`;
|
|
45027
|
+
return `${(bytes / 1024 / 1024 / 1024).toFixed(2)}GB`;
|
|
45028
|
+
}
|
|
45029
|
+
function clampTtl2(requested, def, min, max) {
|
|
45030
|
+
if (typeof requested !== "number" || !Number.isFinite(requested))
|
|
45031
|
+
return def;
|
|
45032
|
+
return Math.max(min, Math.min(max, requested));
|
|
45033
|
+
}
|
|
45034
|
+
async function handleRequestMs365Approval(client3, msg, deps) {
|
|
45035
|
+
const log = deps.log ?? (() => {});
|
|
45036
|
+
const sendResponse = (ok, extra = {}) => {
|
|
45037
|
+
client3.send({
|
|
45038
|
+
type: "ms365_approval_posted",
|
|
45039
|
+
correlationId: msg.correlationId,
|
|
45040
|
+
ok,
|
|
45041
|
+
...extra
|
|
45042
|
+
});
|
|
45043
|
+
};
|
|
45044
|
+
if (msg.agentName !== deps.agentName) {
|
|
45045
|
+
log(`ms365-approval: cross-agent request rejected (msg=${msg.agentName} vs gateway=${deps.agentName})`);
|
|
45046
|
+
sendResponse(false, { reason: "cross-agent request rejected" });
|
|
45047
|
+
return;
|
|
45048
|
+
}
|
|
45049
|
+
const preview = validateMs365Preview(msg.preview);
|
|
45050
|
+
if (!preview) {
|
|
45051
|
+
log("ms365-approval: invalid preview payload");
|
|
45052
|
+
sendResponse(false, { reason: "invalid preview payload" });
|
|
45053
|
+
return;
|
|
45054
|
+
}
|
|
45055
|
+
const allowFrom = deps.loadAllowFrom();
|
|
45056
|
+
if (allowFrom.length === 0) {
|
|
45057
|
+
log("ms365-approval: no operator allowFrom configured");
|
|
45058
|
+
sendResponse(false, { reason: "no operator allowFrom configured" });
|
|
45059
|
+
return;
|
|
45060
|
+
}
|
|
45061
|
+
const targetChat = deps.loadTargetChat();
|
|
45062
|
+
if (!targetChat) {
|
|
45063
|
+
log("ms365-approval: no target chat resolved");
|
|
45064
|
+
sendResponse(false, { reason: "no target chat resolved" });
|
|
45065
|
+
return;
|
|
45066
|
+
}
|
|
45067
|
+
const ttlMs = clampTtl2(msg.ttlMs, deps.defaultTtlMs ?? DEFAULT_TTL_MS2, deps.minTtlMs ?? MIN_TTL_MS2, deps.maxTtlMs ?? MAX_TTL_MS2);
|
|
45068
|
+
const scope = `ms-365:write:${preview.itemId}`;
|
|
45069
|
+
const why = preview.agentRationale ?? `${preview.toolName} on ${preview.itemDisplayName}`;
|
|
45070
|
+
let registered;
|
|
45071
|
+
try {
|
|
45072
|
+
registered = await deps.registerApproval({
|
|
45073
|
+
agent_unit: preview.agentName,
|
|
45074
|
+
scope,
|
|
45075
|
+
action: "write",
|
|
45076
|
+
approver_set: allowFrom,
|
|
45077
|
+
why,
|
|
45078
|
+
ttl_ms: ttlMs
|
|
45079
|
+
});
|
|
45080
|
+
} catch (err) {
|
|
45081
|
+
const msg2 = err instanceof Error ? err.message : String(err);
|
|
45082
|
+
log(`ms365-approval: kernel register failed \u2014 ${msg2}`);
|
|
45083
|
+
sendResponse(false, { reason: `kernel register failed: ${msg2}` });
|
|
45084
|
+
return;
|
|
45085
|
+
}
|
|
45086
|
+
if (!registered) {
|
|
45087
|
+
sendResponse(false, { reason: "kernel returned no request_id" });
|
|
45088
|
+
return;
|
|
45089
|
+
}
|
|
45090
|
+
const text = buildMs365CardText(preview);
|
|
45091
|
+
const replyMarkup = (deps.buildKeyboard ?? defaultKeyboard)(registered.request_id);
|
|
45092
|
+
let posted;
|
|
45093
|
+
try {
|
|
45094
|
+
posted = await deps.postCard({
|
|
45095
|
+
chatId: targetChat.chatId,
|
|
45096
|
+
threadId: targetChat.threadId,
|
|
45097
|
+
text,
|
|
45098
|
+
replyMarkup
|
|
45099
|
+
});
|
|
45100
|
+
} catch (err) {
|
|
45101
|
+
const m = err instanceof Error ? err.message : String(err);
|
|
45102
|
+
log(`ms365-approval: card post threw \u2014 ${m}`);
|
|
45103
|
+
sendResponse(false, { reason: `card post failed: ${m}` });
|
|
45104
|
+
return;
|
|
45105
|
+
}
|
|
45106
|
+
if (!posted) {
|
|
45107
|
+
sendResponse(false, { reason: "card post returned null" });
|
|
45108
|
+
return;
|
|
45109
|
+
}
|
|
45110
|
+
log(`ms365-approval: posted card msg=${posted.messageId} request=${registered.request_id} expires=${new Date(registered.expires_at_ms).toISOString()}`);
|
|
45111
|
+
sendResponse(true, {
|
|
45112
|
+
requestId: registered.request_id,
|
|
45113
|
+
expiresAtMs: registered.expires_at_ms
|
|
45114
|
+
});
|
|
45115
|
+
}
|
|
45116
|
+
|
|
44357
45117
|
// gateway/diff-preview-card.ts
|
|
44358
45118
|
var import_grammy5 = __toESM(require_mod2(), 1);
|
|
44359
45119
|
var REQUEST_ID_RE = /^[0-9a-f]{32}$/;
|
|
@@ -44768,12 +45528,12 @@ function createPendingPermissionBuffer(opts = {}) {
|
|
|
44768
45528
|
}
|
|
44769
45529
|
|
|
44770
45530
|
// gateway/chat-key.ts
|
|
44771
|
-
function
|
|
45531
|
+
function chatKey2(chatId, threadId) {
|
|
44772
45532
|
const t = threadId == null || threadId === 0 ? "_" : String(threadId);
|
|
44773
45533
|
return `${chatId}:${t}`;
|
|
44774
45534
|
}
|
|
44775
|
-
function
|
|
44776
|
-
return `${
|
|
45535
|
+
function chatKeyWithSuffix2(chatId, threadId, suffix) {
|
|
45536
|
+
return `${chatKey2(chatId, threadId)}:${suffix}`;
|
|
44777
45537
|
}
|
|
44778
45538
|
function chatIdOfChatKey(key) {
|
|
44779
45539
|
const idx = key.indexOf(":");
|
|
@@ -45268,14 +46028,14 @@ function buildVaultSaveDiscardedInbound(opts) {
|
|
|
45268
46028
|
// gateway/subagent-handback-inbound-builder.ts
|
|
45269
46029
|
var HANDBACK_RESULT_MAX = 3000;
|
|
45270
46030
|
var HANDBACK_DESC_MAX = 200;
|
|
45271
|
-
function
|
|
46031
|
+
function truncate3(s, max) {
|
|
45272
46032
|
const t = s.trim();
|
|
45273
46033
|
return t.length > max ? t.slice(0, max) + "\u2026" : t;
|
|
45274
46034
|
}
|
|
45275
46035
|
function buildSubagentHandbackInbound(opts) {
|
|
45276
46036
|
const ts = opts.nowMs ?? Date.now();
|
|
45277
|
-
const desc =
|
|
45278
|
-
const result =
|
|
46037
|
+
const desc = truncate3(opts.ctx.taskDescription, HANDBACK_DESC_MAX) || "(no description)";
|
|
46038
|
+
const result = truncate3(opts.ctx.resultText, HANDBACK_RESULT_MAX);
|
|
45279
46039
|
const text = opts.ctx.outcome === "failed" ? `\uD83E\uDD1D A background worker you dispatched has FAILED.
|
|
45280
46040
|
|
|
45281
46041
|
` + `Task: ${desc}
|
|
@@ -45339,7 +46099,7 @@ function decideSubagentHandback(input) {
|
|
|
45339
46099
|
var PROGRESS_RESULT_MAX = 800;
|
|
45340
46100
|
var PROGRESS_DESC_MAX = 200;
|
|
45341
46101
|
var DEFAULT_PROGRESS_INTERVAL_MS = 5 * 60 * 1000;
|
|
45342
|
-
function
|
|
46102
|
+
function truncate4(s, max) {
|
|
45343
46103
|
const t = s.trim();
|
|
45344
46104
|
return t.length > max ? t.slice(0, max) + "\u2026" : t;
|
|
45345
46105
|
}
|
|
@@ -45353,8 +46113,8 @@ function formatElapsed(ms) {
|
|
|
45353
46113
|
}
|
|
45354
46114
|
function buildSubagentProgressInbound(opts) {
|
|
45355
46115
|
const ts = opts.nowMs ?? Date.now();
|
|
45356
|
-
const desc =
|
|
45357
|
-
const summary =
|
|
46116
|
+
const desc = truncate4(opts.ctx.taskDescription, PROGRESS_DESC_MAX) || "(no description)";
|
|
46117
|
+
const summary = truncate4(opts.ctx.latestSummary, PROGRESS_RESULT_MAX);
|
|
45358
46118
|
const elapsed = formatElapsed(opts.ctx.elapsedMs);
|
|
45359
46119
|
const expiresAt = ts + 2 * opts.ctx.progressIntervalMs;
|
|
45360
46120
|
const text = `\uD83D\uDD04 A background worker you dispatched is still running.
|
|
@@ -46349,12 +47109,12 @@ function runPipeline(inputs) {
|
|
|
46349
47109
|
}
|
|
46350
47110
|
|
|
46351
47111
|
// secret-detect/staging.ts
|
|
46352
|
-
var
|
|
47112
|
+
var DEFAULT_TTL_MS3 = 5 * 60 * 1000;
|
|
46353
47113
|
|
|
46354
47114
|
class StagingMap {
|
|
46355
47115
|
ttlMs;
|
|
46356
47116
|
map = new Map;
|
|
46357
|
-
constructor(ttlMs =
|
|
47117
|
+
constructor(ttlMs = DEFAULT_TTL_MS3) {
|
|
46358
47118
|
this.ttlMs = ttlMs;
|
|
46359
47119
|
}
|
|
46360
47120
|
key(chat_id, message_id) {
|
|
@@ -47397,7 +48157,7 @@ function startSubagentWatcher(config) {
|
|
|
47397
48157
|
if (idleMs >= threshold) {
|
|
47398
48158
|
entry.stallNotified = true;
|
|
47399
48159
|
entry.stalledAt = n;
|
|
47400
|
-
const desc = escapeHtml8(
|
|
48160
|
+
const desc = escapeHtml8(truncate5(entry.description, 80));
|
|
47401
48161
|
const idleSec = Math.floor(idleMs / 1000);
|
|
47402
48162
|
log?.(`subagent-watcher: stall detected for ${entry.agentId} (idle ${idleSec}s): ${desc}`);
|
|
47403
48163
|
if (db2 != null) {
|
|
@@ -48363,13 +49123,13 @@ function summarizeToolForTitle(toolName, inputPreview) {
|
|
|
48363
49123
|
return `${toolName} (${skill})`;
|
|
48364
49124
|
const command = readString(input, "command");
|
|
48365
49125
|
if (command)
|
|
48366
|
-
return `${toolName}: ${
|
|
49126
|
+
return `${toolName}: ${truncate6(command, COMMAND_TITLE_MAX)}`;
|
|
48367
49127
|
const argHint = firstScalarArgHint(input);
|
|
48368
49128
|
return argHint ? `${toolName} (${argHint})` : toolName;
|
|
48369
49129
|
}
|
|
48370
49130
|
case "Bash": {
|
|
48371
49131
|
const command = readString(input, "command");
|
|
48372
|
-
return command ? `${toolName}: ${
|
|
49132
|
+
return command ? `${toolName}: ${truncate6(command, COMMAND_TITLE_MAX)}` : toolName;
|
|
48373
49133
|
}
|
|
48374
49134
|
case "Read":
|
|
48375
49135
|
case "Edit":
|
|
@@ -48377,17 +49137,17 @@ function summarizeToolForTitle(toolName, inputPreview) {
|
|
|
48377
49137
|
case "MultiEdit":
|
|
48378
49138
|
case "NotebookEdit": {
|
|
48379
49139
|
const filePath = readString(input, "file_path") ?? readString(input, "notebook_path");
|
|
48380
|
-
return filePath ? `${toolName}: ${
|
|
49140
|
+
return filePath ? `${toolName}: ${truncate6(basename5(filePath), PATH_TITLE_MAX)}` : toolName;
|
|
48381
49141
|
}
|
|
48382
49142
|
case "Glob":
|
|
48383
49143
|
case "Grep": {
|
|
48384
49144
|
const pattern = readString(input, "pattern");
|
|
48385
|
-
return pattern ? `${toolName}: ${
|
|
49145
|
+
return pattern ? `${toolName}: ${truncate6(pattern, COMMAND_TITLE_MAX)}` : toolName;
|
|
48386
49146
|
}
|
|
48387
49147
|
case "WebFetch":
|
|
48388
49148
|
case "WebSearch": {
|
|
48389
49149
|
const query2 = readString(input, "url") ?? readString(input, "query");
|
|
48390
|
-
return query2 ? `${toolName}: ${
|
|
49150
|
+
return query2 ? `${toolName}: ${truncate6(query2, COMMAND_TITLE_MAX)}` : toolName;
|
|
48391
49151
|
}
|
|
48392
49152
|
default:
|
|
48393
49153
|
return toolName;
|
|
@@ -48426,7 +49186,7 @@ function firstScalarArgHint(input) {
|
|
|
48426
49186
|
if (SKIP.has(key))
|
|
48427
49187
|
continue;
|
|
48428
49188
|
if (typeof value === "string" && value.length > 0) {
|
|
48429
|
-
return `${key}: ${
|
|
49189
|
+
return `${key}: ${truncate6(value, INPUT_VALUE_MAX)}`;
|
|
48430
49190
|
}
|
|
48431
49191
|
if (typeof value === "number" || typeof value === "boolean") {
|
|
48432
49192
|
return `${key}: ${String(value)}`;
|
|
@@ -48461,7 +49221,7 @@ function skillBasenameFromPath(input) {
|
|
|
48461
49221
|
const basename6 = lastSlash >= 0 ? trimmed.slice(lastSlash + 1) : trimmed;
|
|
48462
49222
|
return basename6.length > 0 ? basename6 : null;
|
|
48463
49223
|
}
|
|
48464
|
-
function
|
|
49224
|
+
function truncate6(text, max) {
|
|
48465
49225
|
const collapsed = text.replace(/\s+/g, " ").trim();
|
|
48466
49226
|
if (collapsed.length <= max)
|
|
48467
49227
|
return collapsed;
|
|
@@ -48732,10 +49492,10 @@ function sweepStaleTurnActiveMarker(stateDir, opts) {
|
|
|
48732
49492
|
}
|
|
48733
49493
|
|
|
48734
49494
|
// ../src/build-info.ts
|
|
48735
|
-
var VERSION = "0.13.
|
|
48736
|
-
var COMMIT_SHA = "
|
|
48737
|
-
var COMMIT_DATE = "2026-05-
|
|
48738
|
-
var LATEST_PR =
|
|
49495
|
+
var VERSION = "0.13.54";
|
|
49496
|
+
var COMMIT_SHA = "95784728";
|
|
49497
|
+
var COMMIT_DATE = "2026-05-27T05:55:02Z";
|
|
49498
|
+
var LATEST_PR = 1894;
|
|
48739
49499
|
var COMMITS_AHEAD_OF_TAG = 0;
|
|
48740
49500
|
|
|
48741
49501
|
// gateway/boot-version.ts
|
|
@@ -49650,6 +50410,16 @@ var outboundDedup = new OutboundDedupCache;
|
|
|
49650
50410
|
var chatAvailableReactions = new Map;
|
|
49651
50411
|
var chatProbesInFlight = new Set;
|
|
49652
50412
|
var activeTurnStartedAt = new Map;
|
|
50413
|
+
var claudeBusyKeys = new Set;
|
|
50414
|
+
function markClaudeBusyForInbound(m) {
|
|
50415
|
+
let tid = m.threadId ?? null;
|
|
50416
|
+
if (tid == null && m.meta?.message_thread_id != null) {
|
|
50417
|
+
const n = Number(m.meta.message_thread_id);
|
|
50418
|
+
if (Number.isFinite(n))
|
|
50419
|
+
tid = n;
|
|
50420
|
+
}
|
|
50421
|
+
claudeBusyKeys.add(chatKey2(m.chatId, tid));
|
|
50422
|
+
}
|
|
49653
50423
|
var pendingRestarts = new Map;
|
|
49654
50424
|
var lastSessionActiveFile = null;
|
|
49655
50425
|
var compactState = initialCompactState();
|
|
@@ -49689,10 +50459,10 @@ var CONTEXT_EXHAUSTION_COOLDOWN_MS = 600000;
|
|
|
49689
50459
|
var lastContextExhaustionWarningAt = 0;
|
|
49690
50460
|
var pendingPtyPartial = null;
|
|
49691
50461
|
function statusKey(chatId, threadId) {
|
|
49692
|
-
return
|
|
50462
|
+
return chatKey2(chatId, threadId);
|
|
49693
50463
|
}
|
|
49694
50464
|
function streamKey3(chatId, threadId) {
|
|
49695
|
-
return
|
|
50465
|
+
return chatKey2(chatId, threadId);
|
|
49696
50466
|
}
|
|
49697
50467
|
function purgeReactionTracking(key, endingTurn) {
|
|
49698
50468
|
const outboundEmitted = endingTurn != null ? endingTurn.replyCalled === true : currentTurn?.replyCalled === true;
|
|
@@ -49701,16 +50471,29 @@ function purgeReactionTracking(key, endingTurn) {
|
|
|
49701
50471
|
activeStatusReactions.delete(key);
|
|
49702
50472
|
activeReactionMsgIds.delete(key);
|
|
49703
50473
|
activeTurnStartedAt.delete(key);
|
|
49704
|
-
|
|
50474
|
+
claudeBusyKeys.delete(key);
|
|
50475
|
+
if (endingTurn != null) {
|
|
50476
|
+
stopTurnTypingLoop(endingTurn.sessionChatId, endingTurn.sessionThreadId ?? null);
|
|
50477
|
+
} else {
|
|
50478
|
+
const chatId = chatIdOfChatKey(key);
|
|
50479
|
+
const threadPart = key.slice(chatId.length + 1);
|
|
50480
|
+
const threadId = threadPart === "_" || threadPart === "" ? null : Number(threadPart);
|
|
50481
|
+
stopTurnTypingLoop(chatId, Number.isFinite(threadId) ? threadId : null);
|
|
50482
|
+
}
|
|
49705
50483
|
if (msgInfo) {
|
|
49706
50484
|
const agentDir = resolveAgentDirFromEnv();
|
|
49707
50485
|
if (agentDir != null)
|
|
49708
50486
|
removeActiveReaction(agentDir, msgInfo.chatId, msgInfo.messageId);
|
|
49709
50487
|
}
|
|
49710
|
-
if (
|
|
50488
|
+
if (claudeBusyKeys.size === 0) {
|
|
49711
50489
|
const selfAgentForFlush = process.env.SWITCHROOM_AGENT_NAME ?? "";
|
|
49712
50490
|
if (pendingInboundBuffer.depth(selfAgentForFlush) > 0) {
|
|
49713
|
-
const fr = redeliverBufferedInbound(pendingInboundBuffer, selfAgentForFlush, (m) =>
|
|
50491
|
+
const fr = redeliverBufferedInbound(pendingInboundBuffer, selfAgentForFlush, (m) => {
|
|
50492
|
+
const d = ipcServer.sendToAgent(selfAgentForFlush, m);
|
|
50493
|
+
if (d)
|
|
50494
|
+
markClaudeBusyForInbound(m);
|
|
50495
|
+
return d;
|
|
50496
|
+
}, inboundSpool);
|
|
49714
50497
|
if (fr.redelivered > 0) {
|
|
49715
50498
|
process.stderr.write(`telegram gateway: turn-complete flushed ${fr.redelivered}/${fr.drained} held inbound for ${selfAgentForFlush}${fr.rebuffered > 0 ? ` (${fr.rebuffered} re-buffered)` : ""}
|
|
49716
50499
|
`);
|
|
@@ -49730,11 +50513,17 @@ function releaseTurnBufferGate(key) {
|
|
|
49730
50513
|
if (!activeTurnStartedAt.has(key))
|
|
49731
50514
|
return;
|
|
49732
50515
|
activeTurnStartedAt.delete(key);
|
|
50516
|
+
claudeBusyKeys.delete(key);
|
|
49733
50517
|
shadowEmit({ kind: "turnEnd", key, at: Date.now(), outboundEmitted: true });
|
|
49734
|
-
if (
|
|
50518
|
+
if (claudeBusyKeys.size === 0) {
|
|
49735
50519
|
const selfAgentForFlush = process.env.SWITCHROOM_AGENT_NAME ?? "";
|
|
49736
50520
|
if (pendingInboundBuffer.depth(selfAgentForFlush) > 0) {
|
|
49737
|
-
const fr = redeliverBufferedInbound(pendingInboundBuffer, selfAgentForFlush, (m) =>
|
|
50521
|
+
const fr = redeliverBufferedInbound(pendingInboundBuffer, selfAgentForFlush, (m) => {
|
|
50522
|
+
const d = ipcServer.sendToAgent(selfAgentForFlush, m);
|
|
50523
|
+
if (d)
|
|
50524
|
+
markClaudeBusyForInbound(m);
|
|
50525
|
+
return d;
|
|
50526
|
+
}, inboundSpool);
|
|
49738
50527
|
if (fr.redelivered > 0) {
|
|
49739
50528
|
process.stderr.write(`telegram gateway: reply-released-gate flushed ${fr.redelivered}/${fr.drained} held inbound for ${selfAgentForFlush}${fr.rebuffered > 0 ? ` (${fr.rebuffered} re-buffered)` : ""}
|
|
49740
50529
|
`);
|
|
@@ -49758,7 +50547,7 @@ function maybeProactiveCompact() {
|
|
|
49758
50547
|
try {
|
|
49759
50548
|
const cfg = loadConfig2();
|
|
49760
50549
|
const rawAgent = cfg.agents?.[agentName3] ?? {};
|
|
49761
|
-
const resolved =
|
|
50550
|
+
const resolved = resolveAgentConfig2(cfg.defaults, cfg.profiles, rawAgent);
|
|
49762
50551
|
cap = resolved.session?.max_context_tokens;
|
|
49763
50552
|
} catch {
|
|
49764
50553
|
return;
|
|
@@ -49811,7 +50600,7 @@ async function postCompactCard(occ, cap) {
|
|
|
49811
50600
|
const chatId = loadAccess().allowFrom[0];
|
|
49812
50601
|
if (!chatId)
|
|
49813
50602
|
return;
|
|
49814
|
-
const threadId = chatThreadMap.get(chatId);
|
|
50603
|
+
const threadId = resolveAgentOutboundTopic({ kind: "compact-watchdog" }) ?? chatThreadMap.get(chatId);
|
|
49815
50604
|
const text = `\uD83D\uDDDC\uFE0F <b>Context compaction</b>
|
|
49816
50605
|
` + `Working context hit ~${occ.toLocaleString()} tokens (cap ${cap.toLocaleString()}) \u2014 running <code>/compact</code>. ` + `Older detail moves to Hindsight; I'll confirm here once the context has shrunk (may take a turn or two).`;
|
|
49817
50606
|
const sent = await swallowingApiCall(() => bot.api.sendMessage(chatId, text, {
|
|
@@ -49986,53 +50775,59 @@ var CHAT_ACTION_WHITELIST = new Set([
|
|
|
49986
50775
|
"record_video_note",
|
|
49987
50776
|
"upload_video_note"
|
|
49988
50777
|
]);
|
|
49989
|
-
function startTypingLoop(chat_id, action = "typing") {
|
|
49990
|
-
stopTypingLoop(chat_id);
|
|
50778
|
+
function startTypingLoop(chat_id, thread_id = null, action = "typing") {
|
|
50779
|
+
stopTypingLoop(chat_id, thread_id);
|
|
50780
|
+
const key = chatKey2(chat_id, thread_id);
|
|
50781
|
+
const sendOpts = thread_id != null ? { message_thread_id: thread_id } : undefined;
|
|
49991
50782
|
const send = () => {
|
|
49992
|
-
bot.api.sendChatAction(chat_id, action).then(() => {
|
|
50783
|
+
bot.api.sendChatAction(chat_id, action, sendOpts).then(() => {
|
|
49993
50784
|
typingBackoffMs = 0;
|
|
49994
50785
|
}, (err) => {
|
|
49995
50786
|
const msg = err instanceof Error ? err.message : String(err);
|
|
49996
50787
|
if (msg.includes("401") || msg.includes("Unauthorized")) {
|
|
49997
50788
|
typingBackoffMs = Math.min(Math.max(typingBackoffMs * 2 || 1000, 1000), TYPING_BACKOFF_MAX);
|
|
49998
|
-
stopTypingLoop(chat_id);
|
|
50789
|
+
stopTypingLoop(chat_id, thread_id);
|
|
49999
50790
|
const retry = setTimeout(() => {
|
|
50000
|
-
typingRetryTimers.delete(
|
|
50001
|
-
startTypingLoop(chat_id, action);
|
|
50791
|
+
typingRetryTimers.delete(key);
|
|
50792
|
+
startTypingLoop(chat_id, thread_id, action);
|
|
50002
50793
|
}, typingBackoffMs);
|
|
50003
|
-
typingRetryTimers.set(
|
|
50794
|
+
typingRetryTimers.set(key, retry);
|
|
50004
50795
|
}
|
|
50005
50796
|
});
|
|
50006
50797
|
};
|
|
50007
50798
|
send();
|
|
50008
|
-
typingIntervals.set(
|
|
50799
|
+
typingIntervals.set(key, setInterval(send, 4000));
|
|
50009
50800
|
}
|
|
50010
|
-
function stopTypingLoop(chat_id) {
|
|
50011
|
-
const
|
|
50801
|
+
function stopTypingLoop(chat_id, thread_id = null) {
|
|
50802
|
+
const key = chatKey2(chat_id, thread_id);
|
|
50803
|
+
const iv = typingIntervals.get(key);
|
|
50012
50804
|
if (iv) {
|
|
50013
50805
|
clearInterval(iv);
|
|
50014
|
-
typingIntervals.delete(
|
|
50806
|
+
typingIntervals.delete(key);
|
|
50015
50807
|
}
|
|
50016
|
-
const retry = typingRetryTimers.get(
|
|
50808
|
+
const retry = typingRetryTimers.get(key);
|
|
50017
50809
|
if (retry) {
|
|
50018
50810
|
clearTimeout(retry);
|
|
50019
|
-
typingRetryTimers.delete(
|
|
50811
|
+
typingRetryTimers.delete(key);
|
|
50020
50812
|
}
|
|
50021
50813
|
}
|
|
50022
50814
|
var turnTypingIntervals = new Map;
|
|
50023
|
-
function startTurnTypingLoop(chat_id) {
|
|
50024
|
-
stopTurnTypingLoop(chat_id);
|
|
50815
|
+
function startTurnTypingLoop(chat_id, thread_id = null) {
|
|
50816
|
+
stopTurnTypingLoop(chat_id, thread_id);
|
|
50817
|
+
const key = chatKey2(chat_id, thread_id);
|
|
50818
|
+
const sendOpts = thread_id != null ? { message_thread_id: thread_id } : undefined;
|
|
50025
50819
|
const send = () => {
|
|
50026
|
-
bot.api.sendChatAction(chat_id, "typing").catch(() => {});
|
|
50820
|
+
bot.api.sendChatAction(chat_id, "typing", sendOpts).catch(() => {});
|
|
50027
50821
|
};
|
|
50028
50822
|
send();
|
|
50029
|
-
turnTypingIntervals.set(
|
|
50823
|
+
turnTypingIntervals.set(key, setInterval(send, 4000));
|
|
50030
50824
|
}
|
|
50031
|
-
function stopTurnTypingLoop(chat_id) {
|
|
50032
|
-
const
|
|
50825
|
+
function stopTurnTypingLoop(chat_id, thread_id = null) {
|
|
50826
|
+
const key = chatKey2(chat_id, thread_id);
|
|
50827
|
+
const iv = turnTypingIntervals.get(key);
|
|
50033
50828
|
if (iv) {
|
|
50034
50829
|
clearInterval(iv);
|
|
50035
|
-
turnTypingIntervals.delete(
|
|
50830
|
+
turnTypingIntervals.delete(key);
|
|
50036
50831
|
}
|
|
50037
50832
|
}
|
|
50038
50833
|
var typingWrapper = createTypingWrapper({
|
|
@@ -50411,12 +51206,14 @@ function emitGatewayOperatorEvent(event) {
|
|
|
50411
51206
|
`);
|
|
50412
51207
|
return;
|
|
50413
51208
|
}
|
|
50414
|
-
|
|
51209
|
+
const opEventTopic = resolveAgentOutboundTopic({ kind: "compact-watchdog" });
|
|
51210
|
+
process.stderr.write(`telegram gateway: operator-event posting agent=${agent} kind=${kind} to ${access.allowFrom.length} chat(s)` + (opEventTopic != null ? ` topic=${opEventTopic}` : "") + `
|
|
50415
51211
|
`);
|
|
50416
51212
|
for (const chat_id of access.allowFrom) {
|
|
50417
51213
|
const opts = {
|
|
50418
51214
|
parse_mode: "HTML",
|
|
50419
|
-
...renderedKeyboard ? { reply_markup: renderedKeyboard } : {}
|
|
51215
|
+
...renderedKeyboard ? { reply_markup: renderedKeyboard } : {},
|
|
51216
|
+
...opEventTopic != null ? { message_thread_id: opEventTopic } : {}
|
|
50420
51217
|
};
|
|
50421
51218
|
bot.api.sendMessage(chat_id, renderedText, opts).catch((e) => {
|
|
50422
51219
|
process.stderr.write(`telegram gateway: operator-event send to ${chat_id} failed agent=${agent} kind=${kind}: ${e}
|
|
@@ -50635,7 +51432,12 @@ startTimer({
|
|
|
50635
51432
|
clearSilentEndState(fbKey);
|
|
50636
51433
|
} catch {}
|
|
50637
51434
|
const fbSelfAgent = process.env.SWITCHROOM_AGENT_NAME ?? "";
|
|
50638
|
-
const fbRedeliver = redeliverBufferedInbound(pendingInboundBuffer, fbSelfAgent, (m) =>
|
|
51435
|
+
const fbRedeliver = redeliverBufferedInbound(pendingInboundBuffer, fbSelfAgent, (m) => {
|
|
51436
|
+
const d = ipcServer.sendToAgent(fbSelfAgent, m);
|
|
51437
|
+
if (d)
|
|
51438
|
+
markClaudeBusyForInbound(m);
|
|
51439
|
+
return d;
|
|
51440
|
+
}, inboundSpool);
|
|
50639
51441
|
process.stderr.write(`telegram gateway: silence-poke framework-fallback ended wedged turn chat=${fbChatId} thread=${ctx.threadId ?? "-"} silence_ms=${ctx.silenceMs} currentTurn_nulled=${turnMatchesFallback} drained_buffered=${fbRedeliver.redelivered}/${fbRedeliver.drained}${fbRedeliver.rebuffered > 0 ? ` rebuffered=${fbRedeliver.rebuffered}` : ""}${fbExtraPurge.purged.length > 0 ? ` extra_keys_purged=${fbExtraPurge.purged.length}` : ""}
|
|
50640
51442
|
`);
|
|
50641
51443
|
}
|
|
@@ -50818,6 +51620,7 @@ var ipcServer = createIpcServer({
|
|
|
50818
51620
|
activeStatusReactions,
|
|
50819
51621
|
activeReactionMsgIds,
|
|
50820
51622
|
activeTurnStartedAt,
|
|
51623
|
+
claudeBusyKeys,
|
|
50821
51624
|
activeDraftStreams,
|
|
50822
51625
|
activeDraftParseModes,
|
|
50823
51626
|
clearActiveReactions: () => {
|
|
@@ -50918,10 +51721,17 @@ ${reminder}
|
|
|
50918
51721
|
if (alwaysRule != null) {
|
|
50919
51722
|
keyboard.row().text(`\uD83D\uDD01 Always allow ${alwaysRule.label}`, `perm:always:${requestId}`);
|
|
50920
51723
|
}
|
|
51724
|
+
const activeTurn = currentTurn;
|
|
51725
|
+
const permTopic = resolveAgentOutboundTopic({
|
|
51726
|
+
kind: "permission",
|
|
51727
|
+
turnInitiated: activeTurn != null,
|
|
51728
|
+
originThreadId: activeTurn?.sessionThreadId
|
|
51729
|
+
});
|
|
50921
51730
|
for (const chat_id of access.allowFrom) {
|
|
50922
51731
|
bot.api.sendMessage(chat_id, text, {
|
|
50923
51732
|
parse_mode: "HTML",
|
|
50924
|
-
reply_markup: keyboard
|
|
51733
|
+
reply_markup: keyboard,
|
|
51734
|
+
...permTopic != null ? { message_thread_id: permTopic } : {}
|
|
50925
51735
|
}).catch((e) => {
|
|
50926
51736
|
process.stderr.write(`telegram gateway: permission_request send to ${chat_id} failed: ${e}
|
|
50927
51737
|
`);
|
|
@@ -50931,7 +51741,7 @@ ${reminder}
|
|
|
50931
51741
|
onHeartbeat(_client, _msg) {},
|
|
50932
51742
|
onScheduleRestart(client3, msg) {
|
|
50933
51743
|
const { agentName: agentName3 } = msg;
|
|
50934
|
-
const turnInFlight =
|
|
51744
|
+
const turnInFlight = claudeBusyKeys.size > 0;
|
|
50935
51745
|
if (!turnInFlight) {
|
|
50936
51746
|
try {
|
|
50937
51747
|
client3.send({
|
|
@@ -50981,7 +51791,15 @@ ${reminder}
|
|
|
50981
51791
|
const operator = access.allowFrom[0];
|
|
50982
51792
|
if (operator === undefined)
|
|
50983
51793
|
return null;
|
|
50984
|
-
|
|
51794
|
+
const activeTurn = currentTurn;
|
|
51795
|
+
const driveTopic = resolveAgentOutboundTopic({
|
|
51796
|
+
kind: "hostd-approval",
|
|
51797
|
+
originThreadId: activeTurn?.sessionThreadId
|
|
51798
|
+
});
|
|
51799
|
+
return {
|
|
51800
|
+
chatId: operator,
|
|
51801
|
+
...driveTopic != null ? { threadId: driveTopic } : {}
|
|
51802
|
+
};
|
|
50985
51803
|
},
|
|
50986
51804
|
registerApproval: async (args) => {
|
|
50987
51805
|
const r = await approvalRequest({
|
|
@@ -51019,6 +51837,62 @@ ${reminder}
|
|
|
51019
51837
|
},
|
|
51020
51838
|
buildCard: ({ preview, suggestRequestId }) => buildDiffPreviewCard({ preview, suggestRequestId }),
|
|
51021
51839
|
log: (m) => process.stderr.write(`telegram gateway: drive-approval \u2014 ${m}
|
|
51840
|
+
`)
|
|
51841
|
+
});
|
|
51842
|
+
},
|
|
51843
|
+
async onRequestMs365Approval(client3, msg) {
|
|
51844
|
+
await handleRequestMs365Approval(client3, msg, {
|
|
51845
|
+
agentName: getMyAgentName(),
|
|
51846
|
+
loadAllowFrom: () => loadAccess().allowFrom,
|
|
51847
|
+
loadTargetChat: () => {
|
|
51848
|
+
const access = loadAccess();
|
|
51849
|
+
const operator = access.allowFrom[0];
|
|
51850
|
+
if (operator === undefined)
|
|
51851
|
+
return null;
|
|
51852
|
+
const activeTurn = currentTurn;
|
|
51853
|
+
const ms365Topic = resolveAgentOutboundTopic({
|
|
51854
|
+
kind: "hostd-approval",
|
|
51855
|
+
originThreadId: activeTurn?.sessionThreadId
|
|
51856
|
+
});
|
|
51857
|
+
return {
|
|
51858
|
+
chatId: operator,
|
|
51859
|
+
...ms365Topic != null ? { threadId: ms365Topic } : {}
|
|
51860
|
+
};
|
|
51861
|
+
},
|
|
51862
|
+
registerApproval: async (args) => {
|
|
51863
|
+
const r = await approvalRequest({
|
|
51864
|
+
agent_unit: args.agent_unit,
|
|
51865
|
+
scope: args.scope,
|
|
51866
|
+
action: args.action,
|
|
51867
|
+
approver_set: args.approver_set,
|
|
51868
|
+
why: args.why,
|
|
51869
|
+
ttl_ms: args.ttl_ms
|
|
51870
|
+
});
|
|
51871
|
+
if (r === null || r.state === "rate_limited")
|
|
51872
|
+
return null;
|
|
51873
|
+
return {
|
|
51874
|
+
request_id: r.request_id,
|
|
51875
|
+
expires_at_ms: r.expires_at
|
|
51876
|
+
};
|
|
51877
|
+
},
|
|
51878
|
+
postCard: async (args) => {
|
|
51879
|
+
try {
|
|
51880
|
+
const sent = await robustApiCall(() => bot.api.sendMessage(args.chatId, args.text, {
|
|
51881
|
+
...args.threadId !== undefined ? { message_thread_id: args.threadId } : {},
|
|
51882
|
+
reply_markup: args.replyMarkup
|
|
51883
|
+
}), {
|
|
51884
|
+
chat_id: String(args.chatId),
|
|
51885
|
+
verb: "ms365-approval-card",
|
|
51886
|
+
...args.threadId !== undefined ? { threadId: args.threadId } : {}
|
|
51887
|
+
});
|
|
51888
|
+
return { messageId: sent.message_id };
|
|
51889
|
+
} catch (err) {
|
|
51890
|
+
process.stderr.write(`telegram gateway: ms365-approval postCard failed: ${err.message}
|
|
51891
|
+
`);
|
|
51892
|
+
return null;
|
|
51893
|
+
}
|
|
51894
|
+
},
|
|
51895
|
+
log: (m) => process.stderr.write(`telegram gateway: ms365-approval \u2014 ${m}
|
|
51022
51896
|
`)
|
|
51023
51897
|
});
|
|
51024
51898
|
},
|
|
@@ -51032,7 +51906,15 @@ ${reminder}
|
|
|
51032
51906
|
const operator = access.allowFrom[0];
|
|
51033
51907
|
if (operator === undefined)
|
|
51034
51908
|
return null;
|
|
51035
|
-
|
|
51909
|
+
const activeTurn = currentTurn;
|
|
51910
|
+
const cfgTopic = resolveAgentOutboundTopic({
|
|
51911
|
+
kind: "hostd-approval",
|
|
51912
|
+
originThreadId: activeTurn?.sessionThreadId
|
|
51913
|
+
});
|
|
51914
|
+
return {
|
|
51915
|
+
chatId: operator,
|
|
51916
|
+
...cfgTopic != null ? { threadId: cfgTopic } : {}
|
|
51917
|
+
};
|
|
51036
51918
|
},
|
|
51037
51919
|
buildKeyboard: (requestId) => new InlineKeyboard6().text("\u2705 Approve", `cfg:${requestId}:approve`).text("\uD83D\uDEAB Deny", `cfg:${requestId}:deny`),
|
|
51038
51920
|
postCard: async (args) => {
|
|
@@ -51098,6 +51980,8 @@ ${reminder}
|
|
|
51098
51980
|
const promptKey = typeof msg.inbound.meta?.prompt_key === "string" ? msg.inbound.meta.prompt_key : "unknown";
|
|
51099
51981
|
const source = typeof msg.inbound.meta?.source === "string" ? msg.inbound.meta.source : "unknown";
|
|
51100
51982
|
const delivered = ipcServer.sendToAgent(msg.agentName, msg.inbound);
|
|
51983
|
+
if (delivered)
|
|
51984
|
+
markClaudeBusyForInbound(msg.inbound);
|
|
51101
51985
|
process.stderr.write(`telegram gateway: inject_inbound agent=${msg.agentName} source=${source} prompt_key=${promptKey} delivered=${delivered}
|
|
51102
51986
|
`);
|
|
51103
51987
|
if (!delivered) {
|
|
@@ -51112,11 +51996,16 @@ if (!STATIC) {
|
|
|
51112
51996
|
setInterval(() => {
|
|
51113
51997
|
const selfAgent = process.env.SWITCHROOM_AGENT_NAME ?? "";
|
|
51114
51998
|
const r = idleDrainTick(pendingInboundBuffer, selfAgent, () => {
|
|
51115
|
-
if (
|
|
51999
|
+
if (claudeBusyKeys.size > 0)
|
|
51116
52000
|
return false;
|
|
51117
52001
|
const c = ipcServer.getClient(selfAgent);
|
|
51118
52002
|
return c != null && c.isAlive();
|
|
51119
|
-
}, (m) =>
|
|
52003
|
+
}, (m) => {
|
|
52004
|
+
const d = ipcServer.sendToAgent(selfAgent, m);
|
|
52005
|
+
if (d)
|
|
52006
|
+
markClaudeBusyForInbound(m);
|
|
52007
|
+
return d;
|
|
52008
|
+
}, inboundSpool);
|
|
51120
52009
|
if (r != null && r.redelivered > 0) {
|
|
51121
52010
|
process.stderr.write(`telegram gateway: idle-drain flushed ${r.redelivered}/${r.drained} buffered inbound for ${selfAgent}${r.rebuffered > 0 ? ` (${r.rebuffered} re-buffered)` : ""}
|
|
51122
52011
|
`);
|
|
@@ -51395,7 +52284,7 @@ ${url}`;
|
|
|
51395
52284
|
await deleteStalePreview(previewMessageId);
|
|
51396
52285
|
previewMessageId = null;
|
|
51397
52286
|
}
|
|
51398
|
-
startTypingLoop(chat_id);
|
|
52287
|
+
startTypingLoop(chat_id, threadId ?? null);
|
|
51399
52288
|
let silentAnchorEditDone = false;
|
|
51400
52289
|
{
|
|
51401
52290
|
const turn2 = currentTurn;
|
|
@@ -51464,7 +52353,7 @@ ${url}`;
|
|
|
51464
52353
|
}
|
|
51465
52354
|
}
|
|
51466
52355
|
if (silentAnchorEditDone) {
|
|
51467
|
-
stopTypingLoop(chat_id);
|
|
52356
|
+
stopTypingLoop(chat_id, threadId ?? null);
|
|
51468
52357
|
return {
|
|
51469
52358
|
content: [
|
|
51470
52359
|
{
|
|
@@ -51558,7 +52447,7 @@ ${url}`;
|
|
|
51558
52447
|
const msg = err instanceof Error ? err.message : String(err);
|
|
51559
52448
|
throw new Error(`reply failed after ${sentIds.length} of ${chunks.length} chunk(s) sent: ${msg}`);
|
|
51560
52449
|
} finally {
|
|
51561
|
-
stopTypingLoop(chat_id);
|
|
52450
|
+
stopTypingLoop(chat_id, threadId ?? null);
|
|
51562
52451
|
}
|
|
51563
52452
|
if (replyButtonMeta != null && replyButtonMeta.size > 0 && sentIds.length >= chunks.length) {
|
|
51564
52453
|
const keyboardMsgId = sentIds[chunks.length - 1];
|
|
@@ -52397,8 +53286,9 @@ async function executeSendTyping(args) {
|
|
|
52397
53286
|
}
|
|
52398
53287
|
action = rawAction;
|
|
52399
53288
|
}
|
|
52400
|
-
|
|
52401
|
-
|
|
53289
|
+
const stThreadId = resolveThreadId(stChatId, args.message_thread_id) ?? null;
|
|
53290
|
+
startTypingLoop(stChatId, stThreadId, action);
|
|
53291
|
+
setTimeout(() => stopTypingLoop(stChatId, stThreadId), 30000);
|
|
52402
53292
|
for (const [key, ctrl] of activeStatusReactions.entries()) {
|
|
52403
53293
|
if (key.startsWith(`${stChatId}:`))
|
|
52404
53294
|
ctrl.setTool();
|
|
@@ -52535,7 +53425,7 @@ function resetOrphanedReplyTimeout() {
|
|
|
52535
53425
|
}
|
|
52536
53426
|
}
|
|
52537
53427
|
function closeActivityLane(chatId, threadId) {
|
|
52538
|
-
const key =
|
|
53428
|
+
const key = chatKeyWithSuffix2(chatId, threadId, "activity");
|
|
52539
53429
|
const stream = activeDraftStreams.get(key);
|
|
52540
53430
|
if (stream == null)
|
|
52541
53431
|
return;
|
|
@@ -52544,7 +53434,7 @@ function closeActivityLane(chatId, threadId) {
|
|
|
52544
53434
|
stream.finalize().catch(() => {});
|
|
52545
53435
|
}
|
|
52546
53436
|
function closeProgressLane(chatId, threadId) {
|
|
52547
|
-
const prefix =
|
|
53437
|
+
const prefix = chatKeyWithSuffix2(chatId, threadId, "progress");
|
|
52548
53438
|
for (const [key, stream] of activeDraftStreams) {
|
|
52549
53439
|
if (key.startsWith(prefix)) {
|
|
52550
53440
|
activeDraftStreams.delete(key);
|
|
@@ -52593,7 +53483,7 @@ function handleSessionEvent(ev) {
|
|
|
52593
53483
|
clearSilentEndState(statusKey(ev.chatId, ev.threadId != null ? Number(ev.threadId) : null));
|
|
52594
53484
|
if (turnsDb != null) {
|
|
52595
53485
|
const evThreadIdNum = ev.threadId != null ? Number(ev.threadId) : null;
|
|
52596
|
-
const turnKey =
|
|
53486
|
+
const turnKey = chatKeyWithSuffix2(ev.chatId, evThreadIdNum, String(startedAt));
|
|
52597
53487
|
next.registryKey = turnKey;
|
|
52598
53488
|
const userPromptPreview = extractUserPromptPreview(ev.rawContent);
|
|
52599
53489
|
try {
|
|
@@ -52656,7 +53546,7 @@ function handleSessionEvent(ev) {
|
|
|
52656
53546
|
return;
|
|
52657
53547
|
ctrl.setTool(name);
|
|
52658
53548
|
if (ev.toolUseId) {
|
|
52659
|
-
typingWrapper.onToolUse(ev.toolUseId, turn.sessionChatId, name);
|
|
53549
|
+
typingWrapper.onToolUse(ev.toolUseId, turn.sessionChatId, name, turn.sessionThreadId ?? null);
|
|
52660
53550
|
}
|
|
52661
53551
|
return;
|
|
52662
53552
|
}
|
|
@@ -52774,7 +53664,7 @@ function handleSessionEvent(ev) {
|
|
|
52774
53664
|
return;
|
|
52775
53665
|
if (!ev.toolUseId)
|
|
52776
53666
|
return;
|
|
52777
|
-
typingWrapper.onToolUse(ev.toolUseId, turn.sessionChatId, ev.toolName);
|
|
53667
|
+
typingWrapper.onToolUse(ev.toolUseId, turn.sessionChatId, ev.toolName, turn.sessionThreadId ?? null);
|
|
52778
53668
|
return;
|
|
52779
53669
|
}
|
|
52780
53670
|
case "sub_agent_tool_result": {
|
|
@@ -52853,7 +53743,7 @@ function handleSessionEvent(ev) {
|
|
|
52853
53743
|
if (flushDecision.kind === "skip" && flushDecision.reason === "silent-marker") {
|
|
52854
53744
|
process.stderr.write(`telegram gateway: silent-turn-suppression: chat=${chatId} turnKey=${turn.startedAt} reason=silent-marker
|
|
52855
53745
|
`);
|
|
52856
|
-
const suppressPrefix =
|
|
53746
|
+
const suppressPrefix = chatKeyWithSuffix2(chatId, threadId, "progress");
|
|
52857
53747
|
for (const [key] of activeDraftStreams) {
|
|
52858
53748
|
if (key.startsWith(suppressPrefix)) {
|
|
52859
53749
|
activeDraftStreams.delete(key);
|
|
@@ -53284,7 +54174,7 @@ async function handleInboundCoalesced(ctx, text, downloadImage, attachment) {
|
|
|
53284
54174
|
if (!from)
|
|
53285
54175
|
return;
|
|
53286
54176
|
maybeEarlyAckReaction(ctx, from);
|
|
53287
|
-
const key = inboundCoalesceKey(String(ctx.chat.id), String(from.id));
|
|
54177
|
+
const key = inboundCoalesceKey(String(ctx.chat.id), ctx.message?.message_thread_id, String(from.id));
|
|
53288
54178
|
const result = inboundCoalescer.enqueue(key, { text, ctx, downloadImage, attachment });
|
|
53289
54179
|
if (result.bypass)
|
|
53290
54180
|
return handleInbound(ctx, text, undefined, undefined);
|
|
@@ -53339,7 +54229,7 @@ async function handleInbound(ctx, text, downloadImage, attachment) {
|
|
|
53339
54229
|
},
|
|
53340
54230
|
at: Date.now()
|
|
53341
54231
|
});
|
|
53342
|
-
const turnInFlightAtReceipt =
|
|
54232
|
+
const turnInFlightAtReceipt = claudeBusyKeys.size > 0;
|
|
53343
54233
|
const access = result.access;
|
|
53344
54234
|
const from = ctx.from;
|
|
53345
54235
|
const chat_id = String(ctx.chat.id);
|
|
@@ -53435,11 +54325,12 @@ async function handleInbound(ctx, text, downloadImage, attachment) {
|
|
|
53435
54325
|
}
|
|
53436
54326
|
return;
|
|
53437
54327
|
}
|
|
53438
|
-
const
|
|
54328
|
+
const interceptKey = chatKey2(chat_id, messageThreadId);
|
|
54329
|
+
const pendingAdd = pendingAuthAddFlows.get(interceptKey);
|
|
53439
54330
|
if (pendingAdd && looksLikeAuthCode(text)) {
|
|
53440
54331
|
const elapsed = Date.now() - pendingAdd.startedAt;
|
|
53441
54332
|
if (elapsed < REAUTH_INTERCEPT_TTL_MS) {
|
|
53442
|
-
pendingAuthAddFlows.delete(
|
|
54333
|
+
pendingAuthAddFlows.delete(interceptKey);
|
|
53443
54334
|
try {
|
|
53444
54335
|
const credentials = await submitAccountAuthCode(pendingAdd, text.trim());
|
|
53445
54336
|
try {
|
|
@@ -53458,13 +54349,13 @@ The fleet's active account hasn't changed. Send <code>/auth use ${escapeHtmlForT
|
|
|
53458
54349
|
return;
|
|
53459
54350
|
}
|
|
53460
54351
|
cancelAccountAuthSession(pendingAdd);
|
|
53461
|
-
pendingAuthAddFlows.delete(
|
|
54352
|
+
pendingAuthAddFlows.delete(interceptKey);
|
|
53462
54353
|
}
|
|
53463
|
-
const pendingReauth = pendingReauthFlows.get(
|
|
54354
|
+
const pendingReauth = pendingReauthFlows.get(interceptKey);
|
|
53464
54355
|
if (pendingReauth && looksLikeAuthCode(text)) {
|
|
53465
54356
|
const elapsed = Date.now() - pendingReauth.startedAt;
|
|
53466
54357
|
if (elapsed < REAUTH_INTERCEPT_TTL_MS) {
|
|
53467
|
-
pendingReauthFlows.delete(
|
|
54358
|
+
pendingReauthFlows.delete(interceptKey);
|
|
53468
54359
|
const { result: result2, errorText } = execAuthCode(pendingReauth.agent, text.trim());
|
|
53469
54360
|
if (errorText) {
|
|
53470
54361
|
await switchroomReply(ctx, `<b>auth code failed:</b>
|
|
@@ -53483,7 +54374,7 @@ ${preBlock(formatSwitchroomOutput(errorText))}`, { html: true });
|
|
|
53483
54374
|
redactAuthCodeMessage(bot.api, chat_id, msgId ?? null, (line) => process.stderr.write(line));
|
|
53484
54375
|
return;
|
|
53485
54376
|
}
|
|
53486
|
-
pendingReauthFlows.delete(
|
|
54377
|
+
pendingReauthFlows.delete(interceptKey);
|
|
53487
54378
|
}
|
|
53488
54379
|
const pendingVault = pendingVaultOps.get(chat_id);
|
|
53489
54380
|
if (pendingVault) {
|
|
@@ -53779,7 +54670,7 @@ ${preBlock(write.output)}`;
|
|
|
53779
54670
|
reset(statusKey(chat_id, messageThreadId), Date.now());
|
|
53780
54671
|
startTurn(statusKey(chat_id, messageThreadId), Date.now());
|
|
53781
54672
|
clearPending(statusKey(chat_id, messageThreadId), "inbound");
|
|
53782
|
-
startTurnTypingLoop(chat_id);
|
|
54673
|
+
startTurnTypingLoop(chat_id, messageThreadId ?? null);
|
|
53783
54674
|
emitRuntimeMetric({
|
|
53784
54675
|
kind: "turn_started",
|
|
53785
54676
|
chat_id,
|
|
@@ -53911,6 +54802,8 @@ ${preBlock(write.output)}`;
|
|
|
53911
54802
|
return;
|
|
53912
54803
|
}
|
|
53913
54804
|
const delivered = ipcServer.sendToAgent(selfAgent, inboundMsg);
|
|
54805
|
+
if (delivered)
|
|
54806
|
+
markClaudeBusyForInbound(inboundMsg);
|
|
53914
54807
|
if (!delivered) {
|
|
53915
54808
|
pendingInboundBuffer.push(selfAgent, inboundMsg);
|
|
53916
54809
|
const threadOpts = messageThreadId != null ? { message_thread_id: messageThreadId } : {};
|
|
@@ -53961,7 +54854,9 @@ function preBlock(text) {
|
|
|
53961
54854
|
}
|
|
53962
54855
|
async function switchroomReply(ctx, text, options = {}) {
|
|
53963
54856
|
const chatId = String(ctx.chat.id);
|
|
53964
|
-
const
|
|
54857
|
+
const baseThreadId = resolveThreadId(chatId, ctx.message?.message_thread_id);
|
|
54858
|
+
const routedOpts = options.classification ? slashCommandReplyOpts(ctx, options.classification) : {};
|
|
54859
|
+
const threadId = routedOpts.message_thread_id ?? baseThreadId;
|
|
53965
54860
|
await ctx.reply(text, {
|
|
53966
54861
|
...threadId != null ? { message_thread_id: threadId } : {},
|
|
53967
54862
|
...options.html ? { parse_mode: "HTML", link_preview_options: { is_disabled: true } } : {},
|
|
@@ -54061,9 +54956,10 @@ function resolveBootChatId(marker, ageMs) {
|
|
|
54061
54956
|
ackMsgId: marker.ack_message_id ?? undefined
|
|
54062
54957
|
};
|
|
54063
54958
|
}
|
|
54959
|
+
const supergroupBootTopic = resolveAgentOutboundTopic({ kind: "boot" });
|
|
54064
54960
|
const envChat = process.env.SUBAGENT_OWNER_CHAT_ID;
|
|
54065
54961
|
if (envChat)
|
|
54066
|
-
return { chatId: envChat, threadId:
|
|
54962
|
+
return { chatId: envChat, threadId: supergroupBootTopic, ackMsgId: undefined };
|
|
54067
54963
|
if (HISTORY_ENABLED) {
|
|
54068
54964
|
try {
|
|
54069
54965
|
const access = loadAccess();
|
|
@@ -54071,12 +54967,30 @@ function resolveBootChatId(marker, ageMs) {
|
|
|
54071
54967
|
if (ownerChatId) {
|
|
54072
54968
|
const recent = query({ chat_id: ownerChatId, limit: 1 });
|
|
54073
54969
|
if (recent.length > 0)
|
|
54074
|
-
return { chatId: ownerChatId, threadId:
|
|
54970
|
+
return { chatId: ownerChatId, threadId: supergroupBootTopic, ackMsgId: undefined };
|
|
54075
54971
|
}
|
|
54076
54972
|
} catch {}
|
|
54077
54973
|
}
|
|
54078
54974
|
return null;
|
|
54079
54975
|
}
|
|
54976
|
+
function resolveAgentOutboundTopic(event) {
|
|
54977
|
+
const agentName3 = process.env.SWITCHROOM_AGENT_NAME;
|
|
54978
|
+
if (!agentName3)
|
|
54979
|
+
return;
|
|
54980
|
+
try {
|
|
54981
|
+
const cfg = loadConfig2();
|
|
54982
|
+
const rawAgent = cfg.agents?.[agentName3];
|
|
54983
|
+
if (!rawAgent)
|
|
54984
|
+
return;
|
|
54985
|
+
const resolved = resolveAgentConfig2(cfg.defaults, cfg.profiles, rawAgent);
|
|
54986
|
+
const tg = resolved.channels?.telegram;
|
|
54987
|
+
if (!tg)
|
|
54988
|
+
return;
|
|
54989
|
+
return resolveOutboundTopic(tg, event);
|
|
54990
|
+
} catch {
|
|
54991
|
+
return;
|
|
54992
|
+
}
|
|
54993
|
+
}
|
|
54080
54994
|
function stampUserRestartReason(reason) {
|
|
54081
54995
|
try {
|
|
54082
54996
|
writeCleanShutdownMarker(GATEWAY_CLEAN_SHUTDOWN_MARKER_PATH, {
|
|
@@ -54103,6 +55017,16 @@ function resolveSystemdRunPath() {
|
|
|
54103
55017
|
}
|
|
54104
55018
|
return _systemdRunPath;
|
|
54105
55019
|
}
|
|
55020
|
+
function slashCommandReplyOpts(ctx, classification) {
|
|
55021
|
+
const originThreadId = ctx.message?.message_thread_id;
|
|
55022
|
+
const event = classification === "query" ? { kind: "command-query", originThreadId } : classification === "mutation" ? { kind: "command-mutation" } : { kind: "command-heavy" };
|
|
55023
|
+
const target = resolveAgentOutboundTopic(event);
|
|
55024
|
+
if (target == null)
|
|
55025
|
+
return {};
|
|
55026
|
+
if (target === originThreadId)
|
|
55027
|
+
return {};
|
|
55028
|
+
return { message_thread_id: target };
|
|
55029
|
+
}
|
|
54106
55030
|
var _dockerReachable;
|
|
54107
55031
|
function isDockerReachable() {
|
|
54108
55032
|
if (_dockerReachable !== undefined)
|
|
@@ -54380,28 +55304,28 @@ async function dispatchShortVerbViaHostd(ctx, req, label, legacyArgs) {
|
|
|
54380
55304
|
await switchroomReply(ctx, `\u274C <b>${escapeHtmlForTg(label)} failed via hostd</b> (result=${escapeHtmlForTg(hostdResp.result)}):
|
|
54381
55305
|
` + preBlock(stripAnsi2(errBody)), { html: true });
|
|
54382
55306
|
}
|
|
54383
|
-
async function runSwitchroomCommand(ctx, args, label) {
|
|
55307
|
+
async function runSwitchroomCommand(ctx, args, label, classification = "query") {
|
|
54384
55308
|
try {
|
|
54385
55309
|
const output = stripAnsi2(switchroomExec(args));
|
|
54386
55310
|
const formatted = formatSwitchroomOutput(output);
|
|
54387
55311
|
if (formatted) {
|
|
54388
|
-
await switchroomReply(ctx, preBlock(formatted), { html: true });
|
|
55312
|
+
await switchroomReply(ctx, preBlock(formatted), { html: true, classification });
|
|
54389
55313
|
} else {
|
|
54390
|
-
await switchroomReply(ctx, `${label}: done (no output)
|
|
55314
|
+
await switchroomReply(ctx, `${label}: done (no output)`, { classification });
|
|
54391
55315
|
}
|
|
54392
55316
|
} catch (err) {
|
|
54393
55317
|
const error = err;
|
|
54394
55318
|
if (error.message?.includes("ENOENT")) {
|
|
54395
|
-
await switchroomReply(ctx, "switchroom CLI not found.", { html: true });
|
|
55319
|
+
await switchroomReply(ctx, "switchroom CLI not found.", { html: true, classification });
|
|
54396
55320
|
return;
|
|
54397
55321
|
}
|
|
54398
55322
|
if (error.message?.includes("ETIMEDOUT") || error.message?.includes("timed out")) {
|
|
54399
|
-
await switchroomReply(ctx, `${label}: timed out
|
|
55323
|
+
await switchroomReply(ctx, `${label}: timed out`, { classification });
|
|
54400
55324
|
return;
|
|
54401
55325
|
}
|
|
54402
55326
|
const detail = stripAnsi2(error.stderr?.trim() || error.message || "unknown error");
|
|
54403
55327
|
await switchroomReply(ctx, `<b>${escapeHtmlForTg(label)} failed:</b>
|
|
54404
|
-
${preBlock(formatSwitchroomOutput(detail))}`, { html: true });
|
|
55328
|
+
${preBlock(formatSwitchroomOutput(detail))}`, { html: true, classification });
|
|
54405
55329
|
}
|
|
54406
55330
|
}
|
|
54407
55331
|
function switchroomExecJson(args) {
|
|
@@ -54995,7 +55919,7 @@ The gateway will restart as part of the recreate step; watch for the post-restar
|
|
|
54995
55919
|
bot.command("upgradestatus", async (ctx) => {
|
|
54996
55920
|
if (!isAuthorizedSender(ctx))
|
|
54997
55921
|
return;
|
|
54998
|
-
await runSwitchroomCommand(ctx, ["update", "--status"], "update --status");
|
|
55922
|
+
await runSwitchroomCommand(ctx, ["update", "--status"], "update --status", "heavy");
|
|
54999
55923
|
});
|
|
55000
55924
|
bot.command("upgrade", async (ctx) => {
|
|
55001
55925
|
if (!isAuthorizedSender(ctx))
|
|
@@ -55064,7 +55988,7 @@ bot.command("audit", async (ctx) => {
|
|
|
55064
55988
|
await switchroomReply(ctx, `Unknown flag <code>${escapeHtmlForTg(t)}</code>. Allowed: <code>--tail</code>, <code>--agent</code>, <code>--op</code>, <code>--error</code>, <code>--verbose</code>.`, { html: true });
|
|
55065
55989
|
return;
|
|
55066
55990
|
}
|
|
55067
|
-
await runSwitchroomCommand(ctx, argv, `hostd audit${argv.length > 2 ? " \u2026" : ""}
|
|
55991
|
+
await runSwitchroomCommand(ctx, argv, `hostd audit${argv.length > 2 ? " \u2026" : ""}`, "heavy");
|
|
55068
55992
|
});
|
|
55069
55993
|
function isValidPermissionRequestId(id) {
|
|
55070
55994
|
return /^[a-z0-9-]{1,32}$/.test(id);
|
|
@@ -55308,24 +56232,25 @@ bot.command("auth", async (ctx) => {
|
|
|
55308
56232
|
Set <code>admin: true</code> on this agent in switchroom.yaml to unlock (the same flag that gates <code>/agents</code>, <code>/restart</code>, <code>/update</code> etc.).`, { html: true });
|
|
55309
56233
|
return;
|
|
55310
56234
|
}
|
|
56235
|
+
const authAddKey = chatKey2(chatId, ctx.message?.message_thread_id ?? null);
|
|
55311
56236
|
if (parsed.kind === "cancel") {
|
|
55312
|
-
const existing = pendingAuthAddFlows.get(
|
|
56237
|
+
const existing = pendingAuthAddFlows.get(authAddKey);
|
|
55313
56238
|
if (!existing) {
|
|
55314
56239
|
await switchroomReply(ctx, "<i>No pending <code>/auth add</code> flow in this chat.</i>", { html: true });
|
|
55315
56240
|
return;
|
|
55316
56241
|
}
|
|
55317
56242
|
cancelAccountAuthSession(existing);
|
|
55318
|
-
pendingAuthAddFlows.delete(
|
|
56243
|
+
pendingAuthAddFlows.delete(authAddKey);
|
|
55319
56244
|
await switchroomReply(ctx, "Cancelled.", { html: true });
|
|
55320
56245
|
return;
|
|
55321
56246
|
}
|
|
55322
|
-
if (pendingAuthAddFlows.has(
|
|
56247
|
+
if (pendingAuthAddFlows.has(authAddKey)) {
|
|
55323
56248
|
await switchroomReply(ctx, "<i>An <code>/auth add</code> flow is already in progress for this chat. Finish the paste, or send <code>/auth cancel</code> to abort.</i>", { html: true });
|
|
55324
56249
|
return;
|
|
55325
56250
|
}
|
|
55326
56251
|
try {
|
|
55327
56252
|
const { loginUrl, scratchDir, child } = await startAccountAuthSession(parsed.label);
|
|
55328
|
-
pendingAuthAddFlows.set(
|
|
56253
|
+
pendingAuthAddFlows.set(authAddKey, {
|
|
55329
56254
|
label: parsed.label,
|
|
55330
56255
|
scratchDir,
|
|
55331
56256
|
child,
|
|
@@ -55569,6 +56494,8 @@ async function performVaultAccessApproval(ctx, pending2, stageId, senderId, atte
|
|
|
55569
56494
|
operatorId: senderId
|
|
55570
56495
|
});
|
|
55571
56496
|
const delivered = ipcServer.sendToAgent(pending2.agent, synthetic);
|
|
56497
|
+
if (delivered)
|
|
56498
|
+
markClaudeBusyForInbound(synthetic);
|
|
55572
56499
|
process.stderr.write(`telegram gateway: vault_grant_approved injection agent=${pending2.agent} key=${pending2.key} stage=${stageId} delivered=${delivered}
|
|
55573
56500
|
`);
|
|
55574
56501
|
if (!delivered) {
|
|
@@ -55615,6 +56542,8 @@ async function handleVaultRequestAccessCallback(ctx, data) {
|
|
|
55615
56542
|
operatorId: senderId
|
|
55616
56543
|
});
|
|
55617
56544
|
const denyDelivered = ipcServer.sendToAgent(pending2.agent, denyInbound);
|
|
56545
|
+
if (denyDelivered)
|
|
56546
|
+
markClaudeBusyForInbound(denyInbound);
|
|
55618
56547
|
process.stderr.write(`telegram gateway: vault_grant_denied injection agent=${pending2.agent} key=${pending2.key} stage=${stageId} delivered=${denyDelivered}
|
|
55619
56548
|
`);
|
|
55620
56549
|
if (!denyDelivered) {
|
|
@@ -55698,6 +56627,8 @@ async function handleVaultRequestSaveCallback(ctx, data) {
|
|
|
55698
56627
|
operatorId: senderId
|
|
55699
56628
|
});
|
|
55700
56629
|
const dDelivered = ipcServer.sendToAgent(pending2.agent, discardInbound);
|
|
56630
|
+
if (dDelivered)
|
|
56631
|
+
markClaudeBusyForInbound(discardInbound);
|
|
55701
56632
|
process.stderr.write(`telegram gateway: vault_save_discarded injection agent=${pending2.agent} key=${pending2.key} stage=${stageId} delivered=${dDelivered}
|
|
55702
56633
|
`);
|
|
55703
56634
|
if (!dDelivered)
|
|
@@ -55758,6 +56689,8 @@ async function handleVaultRequestSaveCallback(ctx, data) {
|
|
|
55758
56689
|
reason: failReason
|
|
55759
56690
|
});
|
|
55760
56691
|
const fDelivered = ipcServer.sendToAgent(pending2.agent, failInbound);
|
|
56692
|
+
if (fDelivered)
|
|
56693
|
+
markClaudeBusyForInbound(failInbound);
|
|
55761
56694
|
process.stderr.write(`telegram gateway: vault_save_failed injection agent=${pending2.agent} key=${pending2.key} stage=${stageId} delivered=${fDelivered}
|
|
55762
56695
|
`);
|
|
55763
56696
|
if (!fDelivered)
|
|
@@ -55775,6 +56708,8 @@ async function handleVaultRequestSaveCallback(ctx, data) {
|
|
|
55775
56708
|
operatorId: senderId
|
|
55776
56709
|
});
|
|
55777
56710
|
const okDelivered = ipcServer.sendToAgent(pending2.agent, okInbound);
|
|
56711
|
+
if (okDelivered)
|
|
56712
|
+
markClaudeBusyForInbound(okInbound);
|
|
55778
56713
|
process.stderr.write(`telegram gateway: vault_save_completed injection agent=${pending2.agent} key=${pending2.key} stage=${stageId} delivered=${okDelivered}
|
|
55779
56714
|
`);
|
|
55780
56715
|
if (!okDelivered)
|
|
@@ -56337,7 +57272,8 @@ async function handleOperatorEventCallback(ctx, data) {
|
|
|
56337
57272
|
parseMode: "HTML",
|
|
56338
57273
|
synthInbound: async () => {
|
|
56339
57274
|
await runSwitchroomAuthCommand(ctx, ["auth", "reauth", agent], `auth reauth ${agent}`);
|
|
56340
|
-
|
|
57275
|
+
const reauthThreadId = ctx.callbackQuery?.message?.message_thread_id;
|
|
57276
|
+
pendingReauthFlows.set(chatKey2(String(ctx.chat.id), reauthThreadId ?? null), { agent, startedAt: Date.now() });
|
|
56341
57277
|
}
|
|
56342
57278
|
});
|
|
56343
57279
|
return;
|
|
@@ -56769,7 +57705,7 @@ bot.command("logs", async (ctx) => {
|
|
|
56769
57705
|
}
|
|
56770
57706
|
const lines = linesArg ? parseInt(linesArg, 10) : 20;
|
|
56771
57707
|
const lineCount = isNaN(lines) || lines < 1 ? 20 : Math.min(lines, 200);
|
|
56772
|
-
await runSwitchroomCommand(ctx, ["agent", "logs", name, "--lines", String(lineCount)], `logs ${name}
|
|
57708
|
+
await runSwitchroomCommand(ctx, ["agent", "logs", name, "--lines", String(lineCount)], `logs ${name}`, "heavy");
|
|
56773
57709
|
});
|
|
56774
57710
|
bot.command("memory", async (ctx) => {
|
|
56775
57711
|
if (!isAuthorizedSender(ctx))
|
|
@@ -56779,7 +57715,7 @@ bot.command("memory", async (ctx) => {
|
|
|
56779
57715
|
await switchroomReply(ctx, "Usage: /memory <search query>");
|
|
56780
57716
|
return;
|
|
56781
57717
|
}
|
|
56782
|
-
await runSwitchroomCommand(ctx, ["memory", "search", query2], "memory search");
|
|
57718
|
+
await runSwitchroomCommand(ctx, ["memory", "search", query2], "memory search", "heavy");
|
|
56783
57719
|
});
|
|
56784
57720
|
bot.command("issues", async (ctx) => {
|
|
56785
57721
|
if (!isAuthorizedSender(ctx))
|
|
@@ -57216,6 +58152,8 @@ ${preBlock(formatSwitchroomOutput(err.message ?? "unknown error"))}`, { html: tr
|
|
|
57216
58152
|
`);
|
|
57217
58153
|
const selfAgentBtn = process.env.SWITCHROOM_AGENT_NAME ?? "";
|
|
57218
58154
|
const btnDelivered = ipcServer.sendToAgent(selfAgentBtn, inboundMsg);
|
|
58155
|
+
if (btnDelivered)
|
|
58156
|
+
markClaudeBusyForInbound(inboundMsg);
|
|
57219
58157
|
if (!btnDelivered) {
|
|
57220
58158
|
pendingInboundBuffer.push(selfAgentBtn, inboundMsg);
|
|
57221
58159
|
swallowingApiCall(() => bot.api.sendMessage(cbChatId, "\u23F3 Agent is restarting \u2014 your button tap is queued and will be processed when it comes back.", cbThreadId != null ? { message_thread_id: cbThreadId } : {}), {
|
|
@@ -57766,7 +58704,7 @@ function getReactionsConfig() {
|
|
|
57766
58704
|
if (agentName3) {
|
|
57767
58705
|
const rawAgent = cfg.agents?.[agentName3];
|
|
57768
58706
|
if (rawAgent) {
|
|
57769
|
-
const resolved =
|
|
58707
|
+
const resolved = resolveAgentConfig2(cfg.defaults, cfg.profiles, rawAgent);
|
|
57770
58708
|
raw = resolved.reactions;
|
|
57771
58709
|
}
|
|
57772
58710
|
}
|
|
@@ -57812,6 +58750,8 @@ function flushReactionBatch(batch) {
|
|
|
57812
58750
|
meta
|
|
57813
58751
|
};
|
|
57814
58752
|
const delivered = ipcServer.sendToAgent(agentName3, inbound);
|
|
58753
|
+
if (delivered)
|
|
58754
|
+
markClaudeBusyForInbound(inbound);
|
|
57815
58755
|
process.stderr.write(`telegram gateway: reactions.dispatch agent=${agentName3} chat=${batch.chatId} count=${batch.reactions.length} batched=${batch.batched} delivered=${delivered}
|
|
57816
58756
|
`);
|
|
57817
58757
|
if (!delivered) {
|