switchroom 0.14.9 → 0.14.11
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 +161 -157
- package/dist/auth-broker/index.js +82 -80
- package/dist/cli/drive-write-pretool.mjs +10 -10
- package/dist/cli/notion-write-pretool.mjs +84 -82
- package/dist/cli/skill-validate-pretool.mjs +72 -72
- package/dist/cli/switchroom.js +1053 -917
- package/dist/host-control/main.js +150 -148
- package/dist/vault/approvals/kernel-server.js +84 -82
- package/dist/vault/broker/server.js +85 -83
- package/package.json +3 -3
- package/telegram-plugin/dist/bridge/bridge.js +112 -112
- package/telegram-plugin/dist/gateway/gateway.js +1218 -634
- package/telegram-plugin/dist/server.js +160 -160
- package/telegram-plugin/gateway/boot-card.ts +15 -11
- package/telegram-plugin/gateway/gateway.ts +94 -67
- package/telegram-plugin/gateway/webhook-ingest-server.test.ts +125 -0
- package/telegram-plugin/gateway/webhook-ingest-server.ts +218 -0
- package/telegram-plugin/runtime-metrics.ts +8 -52
- package/telegram-plugin/silence-poke.ts +39 -312
- package/telegram-plugin/tests/boot-card-silent-on-operator.test.ts +27 -30
- package/telegram-plugin/tests/silence-poke.test.ts +54 -569
- package/telegram-plugin/uat/scenarios/jtbd-fast-ack-dm.test.ts +21 -23
- package/telegram-plugin/uat/scenarios/silence-poke-soft-dm.test.ts +0 -155
|
@@ -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
|
+
// ../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
|
+
// ../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
|
+
// ../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
|
+
// ../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
|
+
// ../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
|
+
// ../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
|
+
// ../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
|
+
// ../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
|
+
// ../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
|
+
// ../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
|
+
// ../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
|
+
// ../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
|
+
// ../node_modules/.bun/@grammyjs+types@3.26.0/node_modules/@grammyjs/types/mod.js
|
|
2453
2453
|
var exports_mod = {};
|
|
2454
2454
|
|
|
2455
|
-
//
|
|
2455
|
+
// ../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
|
+
// ../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
|
+
// ../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
|
+
// ../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
|
+
// ../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
|
+
// ../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
|
+
// ../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
|
+
// ../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
|
+
// ../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
|
+
// ../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
|
+
// ../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
|
+
// ../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
|
+
// ../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
|
+
// ../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
|
+
// ../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
|
+
// ../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
|
+
// ../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
|
+
// ../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
|
+
// ../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
|
+
// ../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
|
+
// ../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
|
+
// ../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
|
+
// ../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
|
+
// ../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
|
+
// ../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
|
+
// ../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
|
+
// ../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
|
+
// ../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
|
+
// ../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
|
+
// ../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
|
+
// ../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
|
+
// ../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
|
+
// ../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
|
+
// ../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
|
+
// ../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
|
+
// ../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
|
+
// ../node_modules/.bun/zod@3.25.76/node_modules/zod/v3/helpers/typeAliases.js
|
|
12600
12600
|
var init_typeAliases = () => {};
|
|
12601
12601
|
|
|
12602
|
-
//
|
|
12602
|
+
// ../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
|
+
// ../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
|
+
// ../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
|
+
// ../node_modules/.bun/zod@3.25.76/node_modules/zod/index.js
|
|
16083
16083
|
var init_zod = __esm(() => {
|
|
16084
16084
|
init_external();
|
|
16085
16085
|
init_external();
|
|
@@ -16642,7 +16642,7 @@ var init_client = __esm(() => {
|
|
|
16642
16642
|
};
|
|
16643
16643
|
});
|
|
16644
16644
|
|
|
16645
|
-
//
|
|
16645
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/nodes/identity.js
|
|
16646
16646
|
var require_identity = __commonJS((exports2) => {
|
|
16647
16647
|
var ALIAS = Symbol.for("yaml.alias");
|
|
16648
16648
|
var DOC = Symbol.for("yaml.document");
|
|
@@ -16696,7 +16696,7 @@ var require_identity = __commonJS((exports2) => {
|
|
|
16696
16696
|
exports2.isSeq = isSeq;
|
|
16697
16697
|
});
|
|
16698
16698
|
|
|
16699
|
-
//
|
|
16699
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/visit.js
|
|
16700
16700
|
var require_visit = __commonJS((exports2) => {
|
|
16701
16701
|
var identity = require_identity();
|
|
16702
16702
|
var BREAK = Symbol("break visit");
|
|
@@ -16851,7 +16851,7 @@ var require_visit = __commonJS((exports2) => {
|
|
|
16851
16851
|
exports2.visitAsync = visitAsync;
|
|
16852
16852
|
});
|
|
16853
16853
|
|
|
16854
|
-
//
|
|
16854
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/doc/directives.js
|
|
16855
16855
|
var require_directives = __commonJS((exports2) => {
|
|
16856
16856
|
var identity = require_identity();
|
|
16857
16857
|
var visit = require_visit();
|
|
@@ -17003,7 +17003,7 @@ var require_directives = __commonJS((exports2) => {
|
|
|
17003
17003
|
exports2.Directives = Directives;
|
|
17004
17004
|
});
|
|
17005
17005
|
|
|
17006
|
-
//
|
|
17006
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/doc/anchors.js
|
|
17007
17007
|
var require_anchors = __commonJS((exports2) => {
|
|
17008
17008
|
var identity = require_identity();
|
|
17009
17009
|
var visit = require_visit();
|
|
@@ -17065,7 +17065,7 @@ var require_anchors = __commonJS((exports2) => {
|
|
|
17065
17065
|
exports2.findNewAnchor = findNewAnchor;
|
|
17066
17066
|
});
|
|
17067
17067
|
|
|
17068
|
-
//
|
|
17068
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/doc/applyReviver.js
|
|
17069
17069
|
var require_applyReviver = __commonJS((exports2) => {
|
|
17070
17070
|
function applyReviver(reviver, obj, key, val) {
|
|
17071
17071
|
if (val && typeof val === "object") {
|
|
@@ -17112,7 +17112,7 @@ var require_applyReviver = __commonJS((exports2) => {
|
|
|
17112
17112
|
exports2.applyReviver = applyReviver;
|
|
17113
17113
|
});
|
|
17114
17114
|
|
|
17115
|
-
//
|
|
17115
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/nodes/toJS.js
|
|
17116
17116
|
var require_toJS = __commonJS((exports2) => {
|
|
17117
17117
|
var identity = require_identity();
|
|
17118
17118
|
function toJS(value, arg, ctx) {
|
|
@@ -17139,7 +17139,7 @@ var require_toJS = __commonJS((exports2) => {
|
|
|
17139
17139
|
exports2.toJS = toJS;
|
|
17140
17140
|
});
|
|
17141
17141
|
|
|
17142
|
-
//
|
|
17142
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/nodes/Node.js
|
|
17143
17143
|
var require_Node = __commonJS((exports2) => {
|
|
17144
17144
|
var applyReviver = require_applyReviver();
|
|
17145
17145
|
var identity = require_identity();
|
|
@@ -17176,7 +17176,7 @@ var require_Node = __commonJS((exports2) => {
|
|
|
17176
17176
|
exports2.NodeBase = NodeBase;
|
|
17177
17177
|
});
|
|
17178
17178
|
|
|
17179
|
-
//
|
|
17179
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/nodes/Alias.js
|
|
17180
17180
|
var require_Alias = __commonJS((exports2) => {
|
|
17181
17181
|
var anchors = require_anchors();
|
|
17182
17182
|
var visit = require_visit();
|
|
@@ -17284,7 +17284,7 @@ var require_Alias = __commonJS((exports2) => {
|
|
|
17284
17284
|
exports2.Alias = Alias;
|
|
17285
17285
|
});
|
|
17286
17286
|
|
|
17287
|
-
//
|
|
17287
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/nodes/Scalar.js
|
|
17288
17288
|
var require_Scalar = __commonJS((exports2) => {
|
|
17289
17289
|
var identity = require_identity();
|
|
17290
17290
|
var Node = require_Node();
|
|
@@ -17312,7 +17312,7 @@ var require_Scalar = __commonJS((exports2) => {
|
|
|
17312
17312
|
exports2.isScalarValue = isScalarValue;
|
|
17313
17313
|
});
|
|
17314
17314
|
|
|
17315
|
-
//
|
|
17315
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/doc/createNode.js
|
|
17316
17316
|
var require_createNode = __commonJS((exports2) => {
|
|
17317
17317
|
var Alias = require_Alias();
|
|
17318
17318
|
var identity = require_identity();
|
|
@@ -17384,7 +17384,7 @@ var require_createNode = __commonJS((exports2) => {
|
|
|
17384
17384
|
exports2.createNode = createNode;
|
|
17385
17385
|
});
|
|
17386
17386
|
|
|
17387
|
-
//
|
|
17387
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/nodes/Collection.js
|
|
17388
17388
|
var require_Collection = __commonJS((exports2) => {
|
|
17389
17389
|
var createNode = require_createNode();
|
|
17390
17390
|
var identity = require_identity();
|
|
@@ -17499,7 +17499,7 @@ var require_Collection = __commonJS((exports2) => {
|
|
|
17499
17499
|
exports2.isEmptyPath = isEmptyPath;
|
|
17500
17500
|
});
|
|
17501
17501
|
|
|
17502
|
-
//
|
|
17502
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/stringify/stringifyComment.js
|
|
17503
17503
|
var require_stringifyComment = __commonJS((exports2) => {
|
|
17504
17504
|
var stringifyComment = (str) => str.replace(/^(?!$)(?: $)?/gm, "#");
|
|
17505
17505
|
function indentComment(comment, indent) {
|
|
@@ -17516,7 +17516,7 @@ var require_stringifyComment = __commonJS((exports2) => {
|
|
|
17516
17516
|
exports2.stringifyComment = stringifyComment;
|
|
17517
17517
|
});
|
|
17518
17518
|
|
|
17519
|
-
//
|
|
17519
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/stringify/foldFlowLines.js
|
|
17520
17520
|
var require_foldFlowLines = __commonJS((exports2) => {
|
|
17521
17521
|
var FOLD_FLOW = "flow";
|
|
17522
17522
|
var FOLD_BLOCK = "block";
|
|
@@ -17653,7 +17653,7 @@ ${indent}${text.slice(fold + 1, end2)}`;
|
|
|
17653
17653
|
exports2.foldFlowLines = foldFlowLines;
|
|
17654
17654
|
});
|
|
17655
17655
|
|
|
17656
|
-
//
|
|
17656
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/stringify/stringifyString.js
|
|
17657
17657
|
var require_stringifyString = __commonJS((exports2) => {
|
|
17658
17658
|
var Scalar = require_Scalar();
|
|
17659
17659
|
var foldFlowLines = require_foldFlowLines();
|
|
@@ -17951,7 +17951,7 @@ ${indent}`);
|
|
|
17951
17951
|
exports2.stringifyString = stringifyString;
|
|
17952
17952
|
});
|
|
17953
17953
|
|
|
17954
|
-
//
|
|
17954
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/stringify/stringify.js
|
|
17955
17955
|
var require_stringify = __commonJS((exports2) => {
|
|
17956
17956
|
var anchors = require_anchors();
|
|
17957
17957
|
var identity = require_identity();
|
|
@@ -18072,7 +18072,7 @@ ${ctx.indent}${str}`;
|
|
|
18072
18072
|
exports2.stringify = stringify;
|
|
18073
18073
|
});
|
|
18074
18074
|
|
|
18075
|
-
//
|
|
18075
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/stringify/stringifyPair.js
|
|
18076
18076
|
var require_stringifyPair = __commonJS((exports2) => {
|
|
18077
18077
|
var identity = require_identity();
|
|
18078
18078
|
var Scalar = require_Scalar();
|
|
@@ -18208,7 +18208,7 @@ ${ctx.indent}`;
|
|
|
18208
18208
|
exports2.stringifyPair = stringifyPair;
|
|
18209
18209
|
});
|
|
18210
18210
|
|
|
18211
|
-
//
|
|
18211
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/log.js
|
|
18212
18212
|
var require_log = __commonJS((exports2) => {
|
|
18213
18213
|
var node_process = __require("process");
|
|
18214
18214
|
function debug(logLevel, ...messages) {
|
|
@@ -18227,7 +18227,7 @@ var require_log = __commonJS((exports2) => {
|
|
|
18227
18227
|
exports2.warn = warn;
|
|
18228
18228
|
});
|
|
18229
18229
|
|
|
18230
|
-
//
|
|
18230
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/yaml-1.1/merge.js
|
|
18231
18231
|
var require_merge = __commonJS((exports2) => {
|
|
18232
18232
|
var identity = require_identity();
|
|
18233
18233
|
var Scalar = require_Scalar();
|
|
@@ -18281,7 +18281,7 @@ var require_merge = __commonJS((exports2) => {
|
|
|
18281
18281
|
exports2.merge = merge;
|
|
18282
18282
|
});
|
|
18283
18283
|
|
|
18284
|
-
//
|
|
18284
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/nodes/addPairToJSMap.js
|
|
18285
18285
|
var require_addPairToJSMap = __commonJS((exports2) => {
|
|
18286
18286
|
var log = require_log();
|
|
18287
18287
|
var merge = require_merge();
|
|
@@ -18342,7 +18342,7 @@ var require_addPairToJSMap = __commonJS((exports2) => {
|
|
|
18342
18342
|
exports2.addPairToJSMap = addPairToJSMap;
|
|
18343
18343
|
});
|
|
18344
18344
|
|
|
18345
|
-
//
|
|
18345
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/nodes/Pair.js
|
|
18346
18346
|
var require_Pair = __commonJS((exports2) => {
|
|
18347
18347
|
var createNode = require_createNode();
|
|
18348
18348
|
var stringifyPair = require_stringifyPair();
|
|
@@ -18380,7 +18380,7 @@ var require_Pair = __commonJS((exports2) => {
|
|
|
18380
18380
|
exports2.createPair = createPair;
|
|
18381
18381
|
});
|
|
18382
18382
|
|
|
18383
|
-
//
|
|
18383
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/stringify/stringifyCollection.js
|
|
18384
18384
|
var require_stringifyCollection = __commonJS((exports2) => {
|
|
18385
18385
|
var identity = require_identity();
|
|
18386
18386
|
var stringify = require_stringify();
|
|
@@ -18532,7 +18532,7 @@ ${indent}${end}`;
|
|
|
18532
18532
|
exports2.stringifyCollection = stringifyCollection;
|
|
18533
18533
|
});
|
|
18534
18534
|
|
|
18535
|
-
//
|
|
18535
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/nodes/YAMLMap.js
|
|
18536
18536
|
var require_YAMLMap = __commonJS((exports2) => {
|
|
18537
18537
|
var stringifyCollection = require_stringifyCollection();
|
|
18538
18538
|
var addPairToJSMap = require_addPairToJSMap();
|
|
@@ -18659,7 +18659,7 @@ var require_YAMLMap = __commonJS((exports2) => {
|
|
|
18659
18659
|
exports2.findPair = findPair;
|
|
18660
18660
|
});
|
|
18661
18661
|
|
|
18662
|
-
//
|
|
18662
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/common/map.js
|
|
18663
18663
|
var require_map = __commonJS((exports2) => {
|
|
18664
18664
|
var identity = require_identity();
|
|
18665
18665
|
var YAMLMap = require_YAMLMap();
|
|
@@ -18678,7 +18678,7 @@ var require_map = __commonJS((exports2) => {
|
|
|
18678
18678
|
exports2.map = map;
|
|
18679
18679
|
});
|
|
18680
18680
|
|
|
18681
|
-
//
|
|
18681
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/nodes/YAMLSeq.js
|
|
18682
18682
|
var require_YAMLSeq = __commonJS((exports2) => {
|
|
18683
18683
|
var createNode = require_createNode();
|
|
18684
18684
|
var stringifyCollection = require_stringifyCollection();
|
|
@@ -18771,7 +18771,7 @@ var require_YAMLSeq = __commonJS((exports2) => {
|
|
|
18771
18771
|
exports2.YAMLSeq = YAMLSeq;
|
|
18772
18772
|
});
|
|
18773
18773
|
|
|
18774
|
-
//
|
|
18774
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/common/seq.js
|
|
18775
18775
|
var require_seq = __commonJS((exports2) => {
|
|
18776
18776
|
var identity = require_identity();
|
|
18777
18777
|
var YAMLSeq = require_YAMLSeq();
|
|
@@ -18790,7 +18790,7 @@ var require_seq = __commonJS((exports2) => {
|
|
|
18790
18790
|
exports2.seq = seq;
|
|
18791
18791
|
});
|
|
18792
18792
|
|
|
18793
|
-
//
|
|
18793
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/common/string.js
|
|
18794
18794
|
var require_string = __commonJS((exports2) => {
|
|
18795
18795
|
var stringifyString = require_stringifyString();
|
|
18796
18796
|
var string = {
|
|
@@ -18806,7 +18806,7 @@ var require_string = __commonJS((exports2) => {
|
|
|
18806
18806
|
exports2.string = string;
|
|
18807
18807
|
});
|
|
18808
18808
|
|
|
18809
|
-
//
|
|
18809
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/common/null.js
|
|
18810
18810
|
var require_null = __commonJS((exports2) => {
|
|
18811
18811
|
var Scalar = require_Scalar();
|
|
18812
18812
|
var nullTag = {
|
|
@@ -18821,7 +18821,7 @@ var require_null = __commonJS((exports2) => {
|
|
|
18821
18821
|
exports2.nullTag = nullTag;
|
|
18822
18822
|
});
|
|
18823
18823
|
|
|
18824
|
-
//
|
|
18824
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/core/bool.js
|
|
18825
18825
|
var require_bool = __commonJS((exports2) => {
|
|
18826
18826
|
var Scalar = require_Scalar();
|
|
18827
18827
|
var boolTag = {
|
|
@@ -18842,7 +18842,7 @@ var require_bool = __commonJS((exports2) => {
|
|
|
18842
18842
|
exports2.boolTag = boolTag;
|
|
18843
18843
|
});
|
|
18844
18844
|
|
|
18845
|
-
//
|
|
18845
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/stringify/stringifyNumber.js
|
|
18846
18846
|
var require_stringifyNumber = __commonJS((exports2) => {
|
|
18847
18847
|
function stringifyNumber({ format, minFractionDigits, tag, value }) {
|
|
18848
18848
|
if (typeof value === "bigint")
|
|
@@ -18866,7 +18866,7 @@ var require_stringifyNumber = __commonJS((exports2) => {
|
|
|
18866
18866
|
exports2.stringifyNumber = stringifyNumber;
|
|
18867
18867
|
});
|
|
18868
18868
|
|
|
18869
|
-
//
|
|
18869
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/core/float.js
|
|
18870
18870
|
var require_float = __commonJS((exports2) => {
|
|
18871
18871
|
var Scalar = require_Scalar();
|
|
18872
18872
|
var stringifyNumber = require_stringifyNumber();
|
|
@@ -18909,7 +18909,7 @@ var require_float = __commonJS((exports2) => {
|
|
|
18909
18909
|
exports2.floatNaN = floatNaN;
|
|
18910
18910
|
});
|
|
18911
18911
|
|
|
18912
|
-
//
|
|
18912
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/core/int.js
|
|
18913
18913
|
var require_int = __commonJS((exports2) => {
|
|
18914
18914
|
var stringifyNumber = require_stringifyNumber();
|
|
18915
18915
|
var intIdentify = (value) => typeof value === "bigint" || Number.isInteger(value);
|
|
@@ -18951,7 +18951,7 @@ var require_int = __commonJS((exports2) => {
|
|
|
18951
18951
|
exports2.intOct = intOct;
|
|
18952
18952
|
});
|
|
18953
18953
|
|
|
18954
|
-
//
|
|
18954
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/core/schema.js
|
|
18955
18955
|
var require_schema = __commonJS((exports2) => {
|
|
18956
18956
|
var map = require_map();
|
|
18957
18957
|
var _null = require_null();
|
|
@@ -18976,7 +18976,7 @@ var require_schema = __commonJS((exports2) => {
|
|
|
18976
18976
|
exports2.schema = schema;
|
|
18977
18977
|
});
|
|
18978
18978
|
|
|
18979
|
-
//
|
|
18979
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/json/schema.js
|
|
18980
18980
|
var require_schema2 = __commonJS((exports2) => {
|
|
18981
18981
|
var Scalar = require_Scalar();
|
|
18982
18982
|
var map = require_map();
|
|
@@ -19040,7 +19040,7 @@ var require_schema2 = __commonJS((exports2) => {
|
|
|
19040
19040
|
exports2.schema = schema;
|
|
19041
19041
|
});
|
|
19042
19042
|
|
|
19043
|
-
//
|
|
19043
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/yaml-1.1/binary.js
|
|
19044
19044
|
var require_binary = __commonJS((exports2) => {
|
|
19045
19045
|
var node_buffer = __require("buffer");
|
|
19046
19046
|
var Scalar = require_Scalar();
|
|
@@ -19095,7 +19095,7 @@ var require_binary = __commonJS((exports2) => {
|
|
|
19095
19095
|
exports2.binary = binary;
|
|
19096
19096
|
});
|
|
19097
19097
|
|
|
19098
|
-
//
|
|
19098
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/yaml-1.1/pairs.js
|
|
19099
19099
|
var require_pairs = __commonJS((exports2) => {
|
|
19100
19100
|
var identity = require_identity();
|
|
19101
19101
|
var Pair = require_Pair();
|
|
@@ -19170,7 +19170,7 @@ ${cn.comment}` : item.comment;
|
|
|
19170
19170
|
exports2.resolvePairs = resolvePairs;
|
|
19171
19171
|
});
|
|
19172
19172
|
|
|
19173
|
-
//
|
|
19173
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/yaml-1.1/omap.js
|
|
19174
19174
|
var require_omap = __commonJS((exports2) => {
|
|
19175
19175
|
var identity = require_identity();
|
|
19176
19176
|
var toJS = require_toJS();
|
|
@@ -19242,7 +19242,7 @@ var require_omap = __commonJS((exports2) => {
|
|
|
19242
19242
|
exports2.omap = omap;
|
|
19243
19243
|
});
|
|
19244
19244
|
|
|
19245
|
-
//
|
|
19245
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/yaml-1.1/bool.js
|
|
19246
19246
|
var require_bool2 = __commonJS((exports2) => {
|
|
19247
19247
|
var Scalar = require_Scalar();
|
|
19248
19248
|
function boolStringify({ value, source }, ctx) {
|
|
@@ -19271,7 +19271,7 @@ var require_bool2 = __commonJS((exports2) => {
|
|
|
19271
19271
|
exports2.trueTag = trueTag;
|
|
19272
19272
|
});
|
|
19273
19273
|
|
|
19274
|
-
//
|
|
19274
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/yaml-1.1/float.js
|
|
19275
19275
|
var require_float2 = __commonJS((exports2) => {
|
|
19276
19276
|
var Scalar = require_Scalar();
|
|
19277
19277
|
var stringifyNumber = require_stringifyNumber();
|
|
@@ -19317,7 +19317,7 @@ var require_float2 = __commonJS((exports2) => {
|
|
|
19317
19317
|
exports2.floatNaN = floatNaN;
|
|
19318
19318
|
});
|
|
19319
19319
|
|
|
19320
|
-
//
|
|
19320
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/yaml-1.1/int.js
|
|
19321
19321
|
var require_int2 = __commonJS((exports2) => {
|
|
19322
19322
|
var stringifyNumber = require_stringifyNumber();
|
|
19323
19323
|
var intIdentify = (value) => typeof value === "bigint" || Number.isInteger(value);
|
|
@@ -19393,7 +19393,7 @@ var require_int2 = __commonJS((exports2) => {
|
|
|
19393
19393
|
exports2.intOct = intOct;
|
|
19394
19394
|
});
|
|
19395
19395
|
|
|
19396
|
-
//
|
|
19396
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/yaml-1.1/set.js
|
|
19397
19397
|
var require_set = __commonJS((exports2) => {
|
|
19398
19398
|
var identity = require_identity();
|
|
19399
19399
|
var Pair = require_Pair();
|
|
@@ -19476,7 +19476,7 @@ var require_set = __commonJS((exports2) => {
|
|
|
19476
19476
|
exports2.set = set;
|
|
19477
19477
|
});
|
|
19478
19478
|
|
|
19479
|
-
//
|
|
19479
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/yaml-1.1/timestamp.js
|
|
19480
19480
|
var require_timestamp = __commonJS((exports2) => {
|
|
19481
19481
|
var stringifyNumber = require_stringifyNumber();
|
|
19482
19482
|
function parseSexagesimal(str, asBigInt) {
|
|
@@ -19558,7 +19558,7 @@ var require_timestamp = __commonJS((exports2) => {
|
|
|
19558
19558
|
exports2.timestamp = timestamp;
|
|
19559
19559
|
});
|
|
19560
19560
|
|
|
19561
|
-
//
|
|
19561
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/yaml-1.1/schema.js
|
|
19562
19562
|
var require_schema3 = __commonJS((exports2) => {
|
|
19563
19563
|
var map = require_map();
|
|
19564
19564
|
var _null = require_null();
|
|
@@ -19599,7 +19599,7 @@ var require_schema3 = __commonJS((exports2) => {
|
|
|
19599
19599
|
exports2.schema = schema;
|
|
19600
19600
|
});
|
|
19601
19601
|
|
|
19602
|
-
//
|
|
19602
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/tags.js
|
|
19603
19603
|
var require_tags = __commonJS((exports2) => {
|
|
19604
19604
|
var map = require_map();
|
|
19605
19605
|
var _null = require_null();
|
|
@@ -19690,7 +19690,7 @@ var require_tags = __commonJS((exports2) => {
|
|
|
19690
19690
|
exports2.getTags = getTags;
|
|
19691
19691
|
});
|
|
19692
19692
|
|
|
19693
|
-
//
|
|
19693
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/schema/Schema.js
|
|
19694
19694
|
var require_Schema = __commonJS((exports2) => {
|
|
19695
19695
|
var identity = require_identity();
|
|
19696
19696
|
var map = require_map();
|
|
@@ -19720,7 +19720,7 @@ var require_Schema = __commonJS((exports2) => {
|
|
|
19720
19720
|
exports2.Schema = Schema;
|
|
19721
19721
|
});
|
|
19722
19722
|
|
|
19723
|
-
//
|
|
19723
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/stringify/stringifyDocument.js
|
|
19724
19724
|
var require_stringifyDocument = __commonJS((exports2) => {
|
|
19725
19725
|
var identity = require_identity();
|
|
19726
19726
|
var stringify = require_stringify();
|
|
@@ -19800,7 +19800,7 @@ var require_stringifyDocument = __commonJS((exports2) => {
|
|
|
19800
19800
|
exports2.stringifyDocument = stringifyDocument;
|
|
19801
19801
|
});
|
|
19802
19802
|
|
|
19803
|
-
//
|
|
19803
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/doc/Document.js
|
|
19804
19804
|
var require_Document = __commonJS((exports2) => {
|
|
19805
19805
|
var Alias = require_Alias();
|
|
19806
19806
|
var Collection = require_Collection();
|
|
@@ -20035,7 +20035,7 @@ var require_Document = __commonJS((exports2) => {
|
|
|
20035
20035
|
exports2.Document = Document;
|
|
20036
20036
|
});
|
|
20037
20037
|
|
|
20038
|
-
//
|
|
20038
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/errors.js
|
|
20039
20039
|
var require_errors = __commonJS((exports2) => {
|
|
20040
20040
|
class YAMLError extends Error {
|
|
20041
20041
|
constructor(name, pos, code, message) {
|
|
@@ -20100,7 +20100,7 @@ ${pointer}
|
|
|
20100
20100
|
exports2.prettifyError = prettifyError;
|
|
20101
20101
|
});
|
|
20102
20102
|
|
|
20103
|
-
//
|
|
20103
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/compose/resolve-props.js
|
|
20104
20104
|
var require_resolve_props = __commonJS((exports2) => {
|
|
20105
20105
|
function resolveProps(tokens, { flow, indicator, next, offset, onError, parentIndent, startOnNewline }) {
|
|
20106
20106
|
let spaceBefore = false;
|
|
@@ -20230,7 +20230,7 @@ var require_resolve_props = __commonJS((exports2) => {
|
|
|
20230
20230
|
exports2.resolveProps = resolveProps;
|
|
20231
20231
|
});
|
|
20232
20232
|
|
|
20233
|
-
//
|
|
20233
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/compose/util-contains-newline.js
|
|
20234
20234
|
var require_util_contains_newline = __commonJS((exports2) => {
|
|
20235
20235
|
function containsNewline(key) {
|
|
20236
20236
|
if (!key)
|
|
@@ -20270,7 +20270,7 @@ var require_util_contains_newline = __commonJS((exports2) => {
|
|
|
20270
20270
|
exports2.containsNewline = containsNewline;
|
|
20271
20271
|
});
|
|
20272
20272
|
|
|
20273
|
-
//
|
|
20273
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/compose/util-flow-indent-check.js
|
|
20274
20274
|
var require_util_flow_indent_check = __commonJS((exports2) => {
|
|
20275
20275
|
var utilContainsNewline = require_util_contains_newline();
|
|
20276
20276
|
function flowIndentCheck(indent, fc, onError) {
|
|
@@ -20285,7 +20285,7 @@ var require_util_flow_indent_check = __commonJS((exports2) => {
|
|
|
20285
20285
|
exports2.flowIndentCheck = flowIndentCheck;
|
|
20286
20286
|
});
|
|
20287
20287
|
|
|
20288
|
-
//
|
|
20288
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/compose/util-map-includes.js
|
|
20289
20289
|
var require_util_map_includes = __commonJS((exports2) => {
|
|
20290
20290
|
var identity = require_identity();
|
|
20291
20291
|
function mapIncludes(ctx, items, search) {
|
|
@@ -20298,7 +20298,7 @@ var require_util_map_includes = __commonJS((exports2) => {
|
|
|
20298
20298
|
exports2.mapIncludes = mapIncludes;
|
|
20299
20299
|
});
|
|
20300
20300
|
|
|
20301
|
-
//
|
|
20301
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/compose/resolve-block-map.js
|
|
20302
20302
|
var require_resolve_block_map = __commonJS((exports2) => {
|
|
20303
20303
|
var Pair = require_Pair();
|
|
20304
20304
|
var YAMLMap = require_YAMLMap();
|
|
@@ -20405,7 +20405,7 @@ var require_resolve_block_map = __commonJS((exports2) => {
|
|
|
20405
20405
|
exports2.resolveBlockMap = resolveBlockMap;
|
|
20406
20406
|
});
|
|
20407
20407
|
|
|
20408
|
-
//
|
|
20408
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/compose/resolve-block-seq.js
|
|
20409
20409
|
var require_resolve_block_seq = __commonJS((exports2) => {
|
|
20410
20410
|
var YAMLSeq = require_YAMLSeq();
|
|
20411
20411
|
var resolveProps = require_resolve_props();
|
|
@@ -20453,7 +20453,7 @@ var require_resolve_block_seq = __commonJS((exports2) => {
|
|
|
20453
20453
|
exports2.resolveBlockSeq = resolveBlockSeq;
|
|
20454
20454
|
});
|
|
20455
20455
|
|
|
20456
|
-
//
|
|
20456
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/compose/resolve-end.js
|
|
20457
20457
|
var require_resolve_end = __commonJS((exports2) => {
|
|
20458
20458
|
function resolveEnd(end, offset, reqSpace, onError) {
|
|
20459
20459
|
let comment = "";
|
|
@@ -20493,7 +20493,7 @@ var require_resolve_end = __commonJS((exports2) => {
|
|
|
20493
20493
|
exports2.resolveEnd = resolveEnd;
|
|
20494
20494
|
});
|
|
20495
20495
|
|
|
20496
|
-
//
|
|
20496
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/compose/resolve-flow-collection.js
|
|
20497
20497
|
var require_resolve_flow_collection = __commonJS((exports2) => {
|
|
20498
20498
|
var identity = require_identity();
|
|
20499
20499
|
var Pair = require_Pair();
|
|
@@ -20684,7 +20684,7 @@ var require_resolve_flow_collection = __commonJS((exports2) => {
|
|
|
20684
20684
|
exports2.resolveFlowCollection = resolveFlowCollection;
|
|
20685
20685
|
});
|
|
20686
20686
|
|
|
20687
|
-
//
|
|
20687
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/compose/compose-collection.js
|
|
20688
20688
|
var require_compose_collection = __commonJS((exports2) => {
|
|
20689
20689
|
var identity = require_identity();
|
|
20690
20690
|
var Scalar = require_Scalar();
|
|
@@ -20746,7 +20746,7 @@ var require_compose_collection = __commonJS((exports2) => {
|
|
|
20746
20746
|
exports2.composeCollection = composeCollection;
|
|
20747
20747
|
});
|
|
20748
20748
|
|
|
20749
|
-
//
|
|
20749
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/compose/resolve-block-scalar.js
|
|
20750
20750
|
var require_resolve_block_scalar = __commonJS((exports2) => {
|
|
20751
20751
|
var Scalar = require_Scalar();
|
|
20752
20752
|
function resolveBlockScalar(ctx, scalar, onError) {
|
|
@@ -20939,7 +20939,7 @@ var require_resolve_block_scalar = __commonJS((exports2) => {
|
|
|
20939
20939
|
exports2.resolveBlockScalar = resolveBlockScalar;
|
|
20940
20940
|
});
|
|
20941
20941
|
|
|
20942
|
-
//
|
|
20942
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/compose/resolve-flow-scalar.js
|
|
20943
20943
|
var require_resolve_flow_scalar = __commonJS((exports2) => {
|
|
20944
20944
|
var Scalar = require_Scalar();
|
|
20945
20945
|
var resolveEnd = require_resolve_end();
|
|
@@ -21155,7 +21155,7 @@ var require_resolve_flow_scalar = __commonJS((exports2) => {
|
|
|
21155
21155
|
exports2.resolveFlowScalar = resolveFlowScalar;
|
|
21156
21156
|
});
|
|
21157
21157
|
|
|
21158
|
-
//
|
|
21158
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/compose/compose-scalar.js
|
|
21159
21159
|
var require_compose_scalar = __commonJS((exports2) => {
|
|
21160
21160
|
var identity = require_identity();
|
|
21161
21161
|
var Scalar = require_Scalar();
|
|
@@ -21233,7 +21233,7 @@ var require_compose_scalar = __commonJS((exports2) => {
|
|
|
21233
21233
|
exports2.composeScalar = composeScalar;
|
|
21234
21234
|
});
|
|
21235
21235
|
|
|
21236
|
-
//
|
|
21236
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/compose/util-empty-scalar-position.js
|
|
21237
21237
|
var require_util_empty_scalar_position = __commonJS((exports2) => {
|
|
21238
21238
|
function emptyScalarPosition(offset, before, pos) {
|
|
21239
21239
|
if (before) {
|
|
@@ -21260,7 +21260,7 @@ var require_util_empty_scalar_position = __commonJS((exports2) => {
|
|
|
21260
21260
|
exports2.emptyScalarPosition = emptyScalarPosition;
|
|
21261
21261
|
});
|
|
21262
21262
|
|
|
21263
|
-
//
|
|
21263
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/compose/compose-node.js
|
|
21264
21264
|
var require_compose_node = __commonJS((exports2) => {
|
|
21265
21265
|
var Alias = require_Alias();
|
|
21266
21266
|
var identity = require_identity();
|
|
@@ -21363,7 +21363,7 @@ var require_compose_node = __commonJS((exports2) => {
|
|
|
21363
21363
|
exports2.composeNode = composeNode;
|
|
21364
21364
|
});
|
|
21365
21365
|
|
|
21366
|
-
//
|
|
21366
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/compose/compose-doc.js
|
|
21367
21367
|
var require_compose_doc = __commonJS((exports2) => {
|
|
21368
21368
|
var Document = require_Document();
|
|
21369
21369
|
var composeNode = require_compose_node();
|
|
@@ -21403,7 +21403,7 @@ var require_compose_doc = __commonJS((exports2) => {
|
|
|
21403
21403
|
exports2.composeDoc = composeDoc;
|
|
21404
21404
|
});
|
|
21405
21405
|
|
|
21406
|
-
//
|
|
21406
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/compose/composer.js
|
|
21407
21407
|
var require_composer2 = __commonJS((exports2) => {
|
|
21408
21408
|
var node_process = __require("process");
|
|
21409
21409
|
var directives = require_directives();
|
|
@@ -21592,7 +21592,7 @@ ${end.comment}` : end.comment;
|
|
|
21592
21592
|
exports2.Composer = Composer;
|
|
21593
21593
|
});
|
|
21594
21594
|
|
|
21595
|
-
//
|
|
21595
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/parse/cst-scalar.js
|
|
21596
21596
|
var require_cst_scalar = __commonJS((exports2) => {
|
|
21597
21597
|
var resolveBlockScalar = require_resolve_block_scalar();
|
|
21598
21598
|
var resolveFlowScalar = require_resolve_flow_scalar();
|
|
@@ -21782,7 +21782,7 @@ var require_cst_scalar = __commonJS((exports2) => {
|
|
|
21782
21782
|
exports2.setScalarValue = setScalarValue;
|
|
21783
21783
|
});
|
|
21784
21784
|
|
|
21785
|
-
//
|
|
21785
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/parse/cst-stringify.js
|
|
21786
21786
|
var require_cst_stringify = __commonJS((exports2) => {
|
|
21787
21787
|
var stringify = (cst) => ("type" in cst) ? stringifyToken(cst) : stringifyItem(cst);
|
|
21788
21788
|
function stringifyToken(token) {
|
|
@@ -21840,7 +21840,7 @@ var require_cst_stringify = __commonJS((exports2) => {
|
|
|
21840
21840
|
exports2.stringify = stringify;
|
|
21841
21841
|
});
|
|
21842
21842
|
|
|
21843
|
-
//
|
|
21843
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/parse/cst-visit.js
|
|
21844
21844
|
var require_cst_visit = __commonJS((exports2) => {
|
|
21845
21845
|
var BREAK = Symbol("break visit");
|
|
21846
21846
|
var SKIP = Symbol("skip children");
|
|
@@ -21899,7 +21899,7 @@ var require_cst_visit = __commonJS((exports2) => {
|
|
|
21899
21899
|
exports2.visit = visit;
|
|
21900
21900
|
});
|
|
21901
21901
|
|
|
21902
|
-
//
|
|
21902
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/parse/cst.js
|
|
21903
21903
|
var require_cst = __commonJS((exports2) => {
|
|
21904
21904
|
var cstScalar = require_cst_scalar();
|
|
21905
21905
|
var cstStringify = require_cst_stringify();
|
|
@@ -22000,7 +22000,7 @@ var require_cst = __commonJS((exports2) => {
|
|
|
22000
22000
|
exports2.tokenType = tokenType;
|
|
22001
22001
|
});
|
|
22002
22002
|
|
|
22003
|
-
//
|
|
22003
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/parse/lexer.js
|
|
22004
22004
|
var require_lexer = __commonJS((exports2) => {
|
|
22005
22005
|
var cst = require_cst();
|
|
22006
22006
|
function isEmpty2(ch) {
|
|
@@ -22586,7 +22586,7 @@ var require_lexer = __commonJS((exports2) => {
|
|
|
22586
22586
|
exports2.Lexer = Lexer;
|
|
22587
22587
|
});
|
|
22588
22588
|
|
|
22589
|
-
//
|
|
22589
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/parse/line-counter.js
|
|
22590
22590
|
var require_line_counter = __commonJS((exports2) => {
|
|
22591
22591
|
class LineCounter {
|
|
22592
22592
|
constructor() {
|
|
@@ -22614,7 +22614,7 @@ var require_line_counter = __commonJS((exports2) => {
|
|
|
22614
22614
|
exports2.LineCounter = LineCounter;
|
|
22615
22615
|
});
|
|
22616
22616
|
|
|
22617
|
-
//
|
|
22617
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/parse/parser.js
|
|
22618
22618
|
var require_parser = __commonJS((exports2) => {
|
|
22619
22619
|
var node_process = __require("process");
|
|
22620
22620
|
var cst = require_cst();
|
|
@@ -23463,7 +23463,7 @@ var require_parser = __commonJS((exports2) => {
|
|
|
23463
23463
|
exports2.Parser = Parser;
|
|
23464
23464
|
});
|
|
23465
23465
|
|
|
23466
|
-
//
|
|
23466
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/public-api.js
|
|
23467
23467
|
var require_public_api = __commonJS((exports2) => {
|
|
23468
23468
|
var composer = require_composer2();
|
|
23469
23469
|
var Document = require_Document();
|
|
@@ -23557,7 +23557,7 @@ var require_public_api = __commonJS((exports2) => {
|
|
|
23557
23557
|
exports2.stringify = stringify;
|
|
23558
23558
|
});
|
|
23559
23559
|
|
|
23560
|
-
//
|
|
23560
|
+
// ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/index.js
|
|
23561
23561
|
var composer, Document, Schema, errors2, Alias, identity, Pair, Scalar, YAMLMap, YAMLSeq, cst, lexer, lineCounter, parser, publicApi, visit, $Composer, $Document, $Schema, $YAMLError, $YAMLParseError, $YAMLWarning, $Alias, $isAlias, $isCollection, $isDocument, $isMap, $isNode, $isPair, $isScalar, $isSeq, $Pair, $Scalar, $YAMLMap, $YAMLSeq, $Lexer, $LineCounter, $Parser, $parse, $parseAllDocuments, $parseDocument, $stringify, $visit, $visitAsync;
|
|
23562
23562
|
var init_dist = __esm(() => {
|
|
23563
23563
|
composer = require_composer2();
|
|
@@ -23742,6 +23742,8 @@ var init_schema = __esm(() => {
|
|
|
23742
23742
|
webhook_rate_limit: exports_external.object({
|
|
23743
23743
|
rpm: exports_external.number().int().positive()
|
|
23744
23744
|
}).optional().describe("Per-source rate limit for the webhook ingest path (#714). " + "Off by default \u2014 when this key is absent the handler skips " + "rate-limit checks entirely. Opt in by setting `rpm` to an " + "integer requests-per-minute (token bucket per (agent, source); " + "burst equal to rpm). When enabled, exceeding the limit returns " + "429 with Retry-After header; first throttle event per " + "(agent, source) per 60s window is written to " + "<agent>/telegram/issues.jsonl. " + "Cascades from defaults.channels.telegram.webhook_rate_limit."),
|
|
23745
|
+
webhook_via_gateway: exports_external.boolean().optional().describe("Route verified webhook events to the agent's in-container gateway " + "over a peercred-gated UDS (<agent>/telegram/webhook.sock) instead " + "of having the host-side web receiver write the agent dir directly. " + "Required under the Docker runtime: the receiver runs as the host " + "operator UID and cannot write the per-agent-UID-owned agent dir " + "(EACCES 500) nor connect the gateway socket. When true the gateway " + "(running as the agent UID) becomes the sole writer of " + "webhook-events.jsonl + dedup/cooldown state and also fires " + "webhook_dispatch. Off by default for back-compat with host-runtime " + "installs. See docs/rfcs/webhook-via-gateway-socket.md."),
|
|
23746
|
+
webhook_require_edge: exports_external.boolean().optional().describe("Cloudflare-only edge lock: require the X-Switchroom-Edge header " + "(injected by a Cloudflare Transform Rule on hooks.switchroom.ai) to " + "match the operator's edge secret at ~/.switchroom/webhook-edge-secret " + "before any HMAC verification; reject 403 otherwise. Proves the " + "request entered through our Cloudflare edge \u2014 the per-agent HMAC " + "alone can't (it proves body provenance, not network path). Stacks " + "on the GitHub-IP WAF + per-agent HMAC. Fail-closed: when required " + "but the secret file is missing/empty every request is rejected. Off " + "by default. See docs/rfcs/webhook-cloudflare-edge-lock.md."),
|
|
23745
23747
|
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
23748
|
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
23749
|
topic_aliases: exports_external.record(exports_external.string(), exports_external.number().int().positive()).optional().describe("Operator-friendly names for forum topic IDs (e.g. " + "`{ general: 1, planning: 17, cron: 23, admin: 31, alerts: 41 }`). " + "Referenced from per-cron `topic:` fields and the outbound router " + "for autonomous events (boot \u2192 alerts, hostd \u2192 admin, etc.). " + "Cascades per-key through defaults \u2192 profile \u2192 agent.")
|
|
@@ -25161,6 +25163,59 @@ function formatResetRelative(target, now = new Date) {
|
|
|
25161
25163
|
}
|
|
25162
25164
|
var OAUTH_BETA = "oauth-2025-04-20", DEFAULT_USER_AGENT = "claude-cli/1.0.0 (external, cli)", DEFAULT_PROBE_MODEL = "claude-haiku-4-5-20251001";
|
|
25163
25165
|
var init_quota_check = () => {};
|
|
25166
|
+
|
|
25167
|
+
// ../src/vault/broker/peercred-ffi.ts
|
|
25168
|
+
function getPeerCred(fd) {
|
|
25169
|
+
if (process.platform !== "linux")
|
|
25170
|
+
return null;
|
|
25171
|
+
try {
|
|
25172
|
+
const ffi = __require("bun:ffi");
|
|
25173
|
+
const { dlopen, FFIType, ptr } = ffi;
|
|
25174
|
+
const SOL_SOCKET = 1;
|
|
25175
|
+
const SO_PEERCRED = 17;
|
|
25176
|
+
const UCRED_SIZE = 12;
|
|
25177
|
+
const cache = getPeerCred;
|
|
25178
|
+
const lib = cache._lib ?? (() => {
|
|
25179
|
+
const candidates = ["libc.so.6", "libc.so"];
|
|
25180
|
+
const symbolSpec = {
|
|
25181
|
+
getsockopt: {
|
|
25182
|
+
args: [FFIType.i32, FFIType.i32, FFIType.i32, FFIType.ptr, FFIType.ptr],
|
|
25183
|
+
returns: FFIType.i32
|
|
25184
|
+
}
|
|
25185
|
+
};
|
|
25186
|
+
const errors3 = [];
|
|
25187
|
+
for (const name of candidates) {
|
|
25188
|
+
try {
|
|
25189
|
+
const opened = dlopen(name, symbolSpec);
|
|
25190
|
+
cache._lib = opened;
|
|
25191
|
+
return opened;
|
|
25192
|
+
} catch (e) {
|
|
25193
|
+
errors3.push(`${name}: ${e instanceof Error ? e.message : String(e)}`);
|
|
25194
|
+
}
|
|
25195
|
+
}
|
|
25196
|
+
process.stderr.write(`[vault-broker] peercred-ffi: dlopen failed for all libc candidates ` + `(${errors3.join("; ")}); falling back to ss-parsing.
|
|
25197
|
+
`);
|
|
25198
|
+
throw new Error("no libc candidate could be opened");
|
|
25199
|
+
})();
|
|
25200
|
+
const credBuf = new ArrayBuffer(UCRED_SIZE);
|
|
25201
|
+
const lenBuf = new Uint32Array(1);
|
|
25202
|
+
lenBuf[0] = UCRED_SIZE;
|
|
25203
|
+
const rc = lib.symbols.getsockopt(fd, SOL_SOCKET, SO_PEERCRED, ptr(credBuf), ptr(lenBuf.buffer));
|
|
25204
|
+
if (rc !== 0)
|
|
25205
|
+
return null;
|
|
25206
|
+
if (lenBuf[0] !== UCRED_SIZE)
|
|
25207
|
+
return null;
|
|
25208
|
+
const view = new DataView(credBuf);
|
|
25209
|
+
return {
|
|
25210
|
+
pid: view.getInt32(0, true),
|
|
25211
|
+
uid: view.getInt32(4, true),
|
|
25212
|
+
gid: view.getInt32(8, true)
|
|
25213
|
+
};
|
|
25214
|
+
} catch {
|
|
25215
|
+
return null;
|
|
25216
|
+
}
|
|
25217
|
+
}
|
|
25218
|
+
|
|
25164
25219
|
// ../src/vault/broker/peercred.ts
|
|
25165
25220
|
function isReservedAgentName(name) {
|
|
25166
25221
|
return RESERVED_AGENT_NAMES.has(name);
|
|
@@ -25863,7 +25918,7 @@ function deriveSlug(inputs, existing) {
|
|
|
25863
25918
|
return `${base}_${n}`;
|
|
25864
25919
|
}
|
|
25865
25920
|
|
|
25866
|
-
//
|
|
25921
|
+
// ../node_modules/.bun/boundary@2.0.0/node_modules/boundary/lib/index.js
|
|
25867
25922
|
var require_lib = __commonJS((exports2) => {
|
|
25868
25923
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
25869
25924
|
exports2.binarySearch = exports2.upperBound = exports2.lowerBound = exports2.compare = undefined;
|
|
@@ -25910,7 +25965,7 @@ var require_lib = __commonJS((exports2) => {
|
|
|
25910
25965
|
exports2.binarySearch = binarySearch;
|
|
25911
25966
|
});
|
|
25912
25967
|
|
|
25913
|
-
//
|
|
25968
|
+
// ../node_modules/.bun/structured-source@4.0.0/node_modules/structured-source/lib/structured-source.js
|
|
25914
25969
|
var require_structured_source = __commonJS((exports2) => {
|
|
25915
25970
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
25916
25971
|
exports2.StructuredSource = undefined;
|
|
@@ -25965,13 +26020,13 @@ var require_structured_source = __commonJS((exports2) => {
|
|
|
25965
26020
|
}
|
|
25966
26021
|
exports2.StructuredSource = StructuredSource;
|
|
25967
26022
|
});
|
|
25968
|
-
//
|
|
26023
|
+
// ../node_modules/.bun/@secretlint+core@12.2.0/node_modules/@secretlint/core/module/SecretLintSourceCodeImpl.js
|
|
25969
26024
|
var import_structured_source;
|
|
25970
26025
|
var init_SecretLintSourceCodeImpl = __esm(() => {
|
|
25971
26026
|
import_structured_source = __toESM(require_structured_source(), 1);
|
|
25972
26027
|
});
|
|
25973
26028
|
|
|
25974
|
-
//
|
|
26029
|
+
// ../node_modules/.bun/@secretlint+core@12.2.0/node_modules/@secretlint/core/module/helper/promise-event-emitter.js
|
|
25975
26030
|
class EventEmitter {
|
|
25976
26031
|
#listeners = new Map;
|
|
25977
26032
|
on(type, listener) {
|
|
@@ -26010,9 +26065,9 @@ class EventEmitter {
|
|
|
26010
26065
|
return Array.from(this.#listeners.get(type) ?? []);
|
|
26011
26066
|
}
|
|
26012
26067
|
}
|
|
26013
|
-
//
|
|
26068
|
+
// ../node_modules/.bun/@secretlint+core@12.2.0/node_modules/@secretlint/core/module/RuleContext.js
|
|
26014
26069
|
var init_RuleContext = () => {};
|
|
26015
|
-
//
|
|
26070
|
+
// ../node_modules/.bun/@secretlint+profiler@12.2.0/node_modules/@secretlint/profiler/module/index.js
|
|
26016
26071
|
class SecretLintProfiler {
|
|
26017
26072
|
perf;
|
|
26018
26073
|
entries = [];
|
|
@@ -26069,7 +26124,7 @@ class SecretLintProfiler {
|
|
|
26069
26124
|
}
|
|
26070
26125
|
}
|
|
26071
26126
|
|
|
26072
|
-
//
|
|
26127
|
+
// ../node_modules/.bun/@secretlint+profiler@12.2.0/node_modules/@secretlint/profiler/module/node.js
|
|
26073
26128
|
import perf_hooks from "node:perf_hooks";
|
|
26074
26129
|
|
|
26075
26130
|
class NullPerformanceObserver {
|
|
@@ -26084,19 +26139,19 @@ var init_node = __esm(() => {
|
|
|
26084
26139
|
});
|
|
26085
26140
|
});
|
|
26086
26141
|
|
|
26087
|
-
//
|
|
26142
|
+
// ../node_modules/.bun/@secretlint+core@12.2.0/node_modules/@secretlint/core/module/RunningEvents.js
|
|
26088
26143
|
var init_RunningEvents = __esm(() => {
|
|
26089
26144
|
init_node();
|
|
26090
26145
|
});
|
|
26091
26146
|
|
|
26092
|
-
//
|
|
26147
|
+
// ../node_modules/.bun/@secretlint+core@12.2.0/node_modules/@secretlint/core/module/RulePresetContext.js
|
|
26093
26148
|
var init_RulePresetContext = __esm(() => {
|
|
26094
26149
|
init_RuleContext();
|
|
26095
26150
|
});
|
|
26096
|
-
//
|
|
26151
|
+
// ../node_modules/.bun/@secretlint+core@12.2.0/node_modules/@secretlint/core/module/messages/index.js
|
|
26097
26152
|
var init_messages = () => {};
|
|
26098
26153
|
|
|
26099
|
-
//
|
|
26154
|
+
// ../node_modules/.bun/@secretlint+core@12.2.0/node_modules/@secretlint/core/module/index.js
|
|
26100
26155
|
var import_debug, debug;
|
|
26101
26156
|
var init_module = __esm(() => {
|
|
26102
26157
|
init_SecretLintSourceCodeImpl();
|
|
@@ -26109,7 +26164,7 @@ var init_module = __esm(() => {
|
|
|
26109
26164
|
debug = import_debug.default("@secretlint/core");
|
|
26110
26165
|
});
|
|
26111
26166
|
|
|
26112
|
-
//
|
|
26167
|
+
// ../node_modules/.bun/@secretlint+secretlint-rule-preset-recommend@12.2.0/node_modules/@secretlint/secretlint-rule-preset-recommend/module/index.js
|
|
26113
26168
|
function requireLodash_uniq() {
|
|
26114
26169
|
if (hasRequiredLodash_uniq)
|
|
26115
26170
|
return lodash_uniq;
|
|
@@ -27869,19 +27924,19 @@ function renderAuthLine(state4, agentName3, now = Date.now()) {
|
|
|
27869
27924
|
}
|
|
27870
27925
|
|
|
27871
27926
|
// gateway/quota-cache.ts
|
|
27872
|
-
import { existsSync as
|
|
27873
|
-
import { join as
|
|
27927
|
+
import { existsSync as existsSync26, readFileSync as readFileSync24, writeFileSync as writeFileSync15, mkdirSync as mkdirSync14 } from "fs";
|
|
27928
|
+
import { join as join23, dirname as dirname8 } from "path";
|
|
27874
27929
|
function defaultCachePath() {
|
|
27875
|
-
return process.env.SWITCHROOM_QUOTA_CACHE_PATH ??
|
|
27930
|
+
return process.env.SWITCHROOM_QUOTA_CACHE_PATH ?? join23(process.env.HOME ?? "/tmp", ".switchroom", "quota-cache.json");
|
|
27876
27931
|
}
|
|
27877
27932
|
function readQuotaCache(opts = {}) {
|
|
27878
27933
|
const path = opts.path ?? defaultCachePath();
|
|
27879
27934
|
const now = opts.now ?? Date.now();
|
|
27880
|
-
if (!
|
|
27935
|
+
if (!existsSync26(path))
|
|
27881
27936
|
return null;
|
|
27882
27937
|
let entry;
|
|
27883
27938
|
try {
|
|
27884
|
-
entry = JSON.parse(
|
|
27939
|
+
entry = JSON.parse(readFileSync24(path, "utf8"));
|
|
27885
27940
|
} catch {
|
|
27886
27941
|
return null;
|
|
27887
27942
|
}
|
|
@@ -27907,8 +27962,8 @@ function writeQuotaCache(result, opts = {}) {
|
|
|
27907
27962
|
result
|
|
27908
27963
|
};
|
|
27909
27964
|
try {
|
|
27910
|
-
|
|
27911
|
-
|
|
27965
|
+
mkdirSync14(dirname8(path), { recursive: true });
|
|
27966
|
+
writeFileSync15(path, JSON.stringify(entry, null, 2), { mode: 384 });
|
|
27912
27967
|
} catch {}
|
|
27913
27968
|
}
|
|
27914
27969
|
var DEFAULT_TTL_MS4, RATE_LIMIT_TTL_MS;
|
|
@@ -27918,8 +27973,8 @@ var init_quota_cache = __esm(() => {
|
|
|
27918
27973
|
});
|
|
27919
27974
|
|
|
27920
27975
|
// gateway/boot-probes.ts
|
|
27921
|
-
import { readFileSync as
|
|
27922
|
-
import { join as
|
|
27976
|
+
import { readFileSync as readFileSync25, readdirSync as readdirSync4, existsSync as existsSync27 } from "fs";
|
|
27977
|
+
import { join as join24 } from "path";
|
|
27923
27978
|
import { execFile as execFileCb } from "child_process";
|
|
27924
27979
|
import { promisify as promisify3 } from "util";
|
|
27925
27980
|
async function withTimeout(label, p, timeoutMs = PROBE_TIMEOUT_MS) {
|
|
@@ -27961,11 +28016,11 @@ function mapPlan(billingType, hasExtra) {
|
|
|
27961
28016
|
}
|
|
27962
28017
|
async function probeAccount(agentDir) {
|
|
27963
28018
|
return withTimeout("Account", (async () => {
|
|
27964
|
-
const claudeDir =
|
|
27965
|
-
const claudeJsonPath =
|
|
28019
|
+
const claudeDir = join24(agentDir, ".claude");
|
|
28020
|
+
const claudeJsonPath = join24(claudeDir, ".claude.json");
|
|
27966
28021
|
let cfg = {};
|
|
27967
28022
|
try {
|
|
27968
|
-
const raw =
|
|
28023
|
+
const raw = readFileSync25(claudeJsonPath, "utf8");
|
|
27969
28024
|
cfg = JSON.parse(raw);
|
|
27970
28025
|
} catch {
|
|
27971
28026
|
return { status: "fail", label: "Account", detail: "no .claude.json" };
|
|
@@ -27983,12 +28038,12 @@ async function probeAccount(agentDir) {
|
|
|
27983
28038
|
let tokenStr = "";
|
|
27984
28039
|
let status = "ok";
|
|
27985
28040
|
for (const candidate of [
|
|
27986
|
-
|
|
27987
|
-
|
|
28041
|
+
join24(claudeDir, ".oauth-token.meta.json"),
|
|
28042
|
+
join24(claudeDir, "accounts", "default", ".oauth-token.meta.json")
|
|
27988
28043
|
]) {
|
|
27989
|
-
if (
|
|
28044
|
+
if (existsSync27(candidate)) {
|
|
27990
28045
|
try {
|
|
27991
|
-
const meta = JSON.parse(
|
|
28046
|
+
const meta = JSON.parse(readFileSync25(candidate, "utf8"));
|
|
27992
28047
|
if (meta.expiresAt) {
|
|
27993
28048
|
tokenStr = " \u00b7 " + formatDaysFromNow(meta.expiresAt);
|
|
27994
28049
|
const daysLeft = Math.round((meta.expiresAt - Date.now()) / 86400000);
|
|
@@ -28163,9 +28218,9 @@ async function resolveTmuxSupervisorPid(agentName3, execFileImpl) {
|
|
|
28163
28218
|
if (!cgroup)
|
|
28164
28219
|
return null;
|
|
28165
28220
|
const procsPath = `/sys/fs/cgroup${cgroup}/cgroup.procs`;
|
|
28166
|
-
if (!
|
|
28221
|
+
if (!existsSync27(procsPath))
|
|
28167
28222
|
return null;
|
|
28168
|
-
const pidsRaw =
|
|
28223
|
+
const pidsRaw = readFileSync25(procsPath, "utf-8");
|
|
28169
28224
|
const pids = pidsRaw.split(`
|
|
28170
28225
|
`).map((s) => s.trim()).filter(Boolean);
|
|
28171
28226
|
if (pids.length === 0)
|
|
@@ -28178,7 +28233,7 @@ async function resolveTmuxSupervisorPid(agentName3, execFileImpl) {
|
|
|
28178
28233
|
let rss = 0;
|
|
28179
28234
|
let comm = "";
|
|
28180
28235
|
try {
|
|
28181
|
-
const status =
|
|
28236
|
+
const status = readFileSync25(`/proc/${pid}/status`, "utf-8");
|
|
28182
28237
|
const rssLine = status.split(`
|
|
28183
28238
|
`).find((l) => l.startsWith("VmRSS:"));
|
|
28184
28239
|
if (rssLine) {
|
|
@@ -28190,7 +28245,7 @@ async function resolveTmuxSupervisorPid(agentName3, execFileImpl) {
|
|
|
28190
28245
|
continue;
|
|
28191
28246
|
}
|
|
28192
28247
|
try {
|
|
28193
|
-
comm =
|
|
28248
|
+
comm = readFileSync25(`/proc/${pid}/comm`, "utf-8").trim();
|
|
28194
28249
|
} catch {}
|
|
28195
28250
|
candidates.push({ pid, rss, comm });
|
|
28196
28251
|
}
|
|
@@ -28370,9 +28425,9 @@ async function probeQuota(claudeConfigDir, _agentDir, fetchImpl = fetch, opts =
|
|
|
28370
28425
|
let claudeDirForProbe = null;
|
|
28371
28426
|
for (const candidate of [
|
|
28372
28427
|
claudeConfigDir,
|
|
28373
|
-
|
|
28428
|
+
join24(claudeConfigDir, "accounts", "default")
|
|
28374
28429
|
]) {
|
|
28375
|
-
if (
|
|
28430
|
+
if (existsSync27(join24(candidate, ".oauth-token"))) {
|
|
28376
28431
|
claudeDirForProbe = candidate;
|
|
28377
28432
|
break;
|
|
28378
28433
|
}
|
|
@@ -28437,7 +28492,7 @@ async function probeHindsight(bankName, fetchImpl = fetch) {
|
|
|
28437
28492
|
}
|
|
28438
28493
|
function readContainerBootTimeMsForProbe() {
|
|
28439
28494
|
try {
|
|
28440
|
-
const stat1 =
|
|
28495
|
+
const stat1 = readFileSync25("/proc/1/stat", "utf8");
|
|
28441
28496
|
const lastParen = stat1.lastIndexOf(")");
|
|
28442
28497
|
if (lastParen < 0)
|
|
28443
28498
|
return null;
|
|
@@ -28445,7 +28500,7 @@ function readContainerBootTimeMsForProbe() {
|
|
|
28445
28500
|
const starttimeTicks = Number(after[19]);
|
|
28446
28501
|
if (!Number.isFinite(starttimeTicks))
|
|
28447
28502
|
return null;
|
|
28448
|
-
const procStat =
|
|
28503
|
+
const procStat = readFileSync25("/proc/stat", "utf8");
|
|
28449
28504
|
const btimeLine = procStat.split(`
|
|
28450
28505
|
`).find((l) => l.startsWith("btime "));
|
|
28451
28506
|
if (!btimeLine)
|
|
@@ -28543,7 +28598,7 @@ async function probeUds(label, socketPath, opts = {}) {
|
|
|
28543
28598
|
}
|
|
28544
28599
|
return withTimeout(label, (async () => {
|
|
28545
28600
|
if (!opts.connectImpl) {
|
|
28546
|
-
if (!
|
|
28601
|
+
if (!existsSync27(socketPath)) {
|
|
28547
28602
|
return {
|
|
28548
28603
|
status: "fail",
|
|
28549
28604
|
label,
|
|
@@ -28578,9 +28633,9 @@ function udsNextStep(label, kind) {
|
|
|
28578
28633
|
return `${label} socket not reachable \u2014 bring up the daemon with \`docker compose up -d ${svc}\` (or check \`docker compose ps\`)`;
|
|
28579
28634
|
}
|
|
28580
28635
|
function defaultUdsConnect(socketPath) {
|
|
28581
|
-
const
|
|
28636
|
+
const net5 = __require("net");
|
|
28582
28637
|
return new Promise((resolve6, reject) => {
|
|
28583
|
-
const sock =
|
|
28638
|
+
const sock = net5.createConnection({ path: socketPath });
|
|
28584
28639
|
const t = setTimeout(() => {
|
|
28585
28640
|
sock.destroy();
|
|
28586
28641
|
reject(new Error("connect timeout"));
|
|
@@ -28607,7 +28662,7 @@ async function probeSkills(agentDir, opts = {}) {
|
|
|
28607
28662
|
return withTimeout("Skills", (async () => {
|
|
28608
28663
|
const fs2 = opts.fs ?? realSkillsFs;
|
|
28609
28664
|
const max = opts.maxNamesShown ?? 3;
|
|
28610
|
-
const skillsDir =
|
|
28665
|
+
const skillsDir = join24(agentDir, ".claude", "skills");
|
|
28611
28666
|
if (!fs2.exists(skillsDir)) {
|
|
28612
28667
|
return { status: "ok", label: "Skills", detail: "no skills dir" };
|
|
28613
28668
|
}
|
|
@@ -28622,17 +28677,17 @@ async function probeSkills(agentDir, opts = {}) {
|
|
|
28622
28677
|
}
|
|
28623
28678
|
const dangling = [];
|
|
28624
28679
|
for (const name of entries) {
|
|
28625
|
-
const skillPath =
|
|
28680
|
+
const skillPath = join24(skillsDir, name);
|
|
28626
28681
|
if (!fs2.exists(skillPath)) {
|
|
28627
28682
|
dangling.push(name);
|
|
28628
28683
|
continue;
|
|
28629
28684
|
}
|
|
28630
|
-
const skillMd =
|
|
28685
|
+
const skillMd = join24(skillPath, "SKILL.md");
|
|
28631
28686
|
if (!fs2.exists(skillMd) && !fs2.exists(skillPath + ".md")) {
|
|
28632
28687
|
continue;
|
|
28633
28688
|
}
|
|
28634
28689
|
}
|
|
28635
|
-
const overlayDir = opts.overlaySkillsDir ??
|
|
28690
|
+
const overlayDir = opts.overlaySkillsDir ?? join24(agentDir, "skills.d");
|
|
28636
28691
|
const overlaySlugs = new Set;
|
|
28637
28692
|
if (fs2.exists(overlayDir)) {
|
|
28638
28693
|
let overlayEntries = [];
|
|
@@ -28679,24 +28734,24 @@ var init_boot_probes = __esm(() => {
|
|
|
28679
28734
|
execFile3 = promisify3(execFileCb);
|
|
28680
28735
|
realProcFs = {
|
|
28681
28736
|
readdir: (p) => readdirSync4(p),
|
|
28682
|
-
readFile: (p) =>
|
|
28737
|
+
readFile: (p) => readFileSync25(p, "utf-8")
|
|
28683
28738
|
};
|
|
28684
28739
|
realSchedulerFs = {
|
|
28685
|
-
readFile: (p) =>
|
|
28740
|
+
readFile: (p) => readFileSync25(p, "utf-8"),
|
|
28686
28741
|
mtimeMs: (p) => {
|
|
28687
28742
|
const { statSync: statSync7 } = __require("fs");
|
|
28688
28743
|
return statSync7(p).mtimeMs;
|
|
28689
28744
|
},
|
|
28690
|
-
exists: (p) =>
|
|
28745
|
+
exists: (p) => existsSync27(p)
|
|
28691
28746
|
};
|
|
28692
28747
|
realSkillsFs = {
|
|
28693
28748
|
readdir: (p) => readdirSync4(p),
|
|
28694
|
-
exists: (p) =>
|
|
28749
|
+
exists: (p) => existsSync27(p)
|
|
28695
28750
|
};
|
|
28696
28751
|
});
|
|
28697
28752
|
|
|
28698
28753
|
// gateway/boot-issue-cache.ts
|
|
28699
|
-
import { existsSync as
|
|
28754
|
+
import { existsSync as existsSync28, readFileSync as readFileSync26, writeFileSync as writeFileSync16, mkdirSync as mkdirSync15, renameSync as renameSync9 } from "fs";
|
|
28700
28755
|
import { dirname as dirname9 } from "path";
|
|
28701
28756
|
function fingerprintProbe(key, r) {
|
|
28702
28757
|
if (r.status === "ok")
|
|
@@ -28776,11 +28831,11 @@ function diffProbes(probes, cache, opts = {}) {
|
|
|
28776
28831
|
return out;
|
|
28777
28832
|
}
|
|
28778
28833
|
function loadCache(path, now = Date.now) {
|
|
28779
|
-
if (!
|
|
28834
|
+
if (!existsSync28(path))
|
|
28780
28835
|
return { ...EMPTY_CACHE, probes: {} };
|
|
28781
28836
|
let raw;
|
|
28782
28837
|
try {
|
|
28783
|
-
raw =
|
|
28838
|
+
raw = readFileSync26(path, "utf-8");
|
|
28784
28839
|
} catch {
|
|
28785
28840
|
return { ...EMPTY_CACHE, probes: {} };
|
|
28786
28841
|
}
|
|
@@ -28823,9 +28878,9 @@ function applyAndSave(path, cache, diff) {
|
|
|
28823
28878
|
}
|
|
28824
28879
|
}
|
|
28825
28880
|
try {
|
|
28826
|
-
|
|
28881
|
+
mkdirSync15(dirname9(path), { recursive: true });
|
|
28827
28882
|
const tmp = `${path}.tmp`;
|
|
28828
|
-
|
|
28883
|
+
writeFileSync16(tmp, JSON.stringify(next), { mode: 384 });
|
|
28829
28884
|
renameSync9(tmp, path);
|
|
28830
28885
|
} catch {}
|
|
28831
28886
|
return next;
|
|
@@ -28839,7 +28894,7 @@ var init_boot_issue_cache = __esm(() => {
|
|
|
28839
28894
|
|
|
28840
28895
|
// gateway/config-snapshot.ts
|
|
28841
28896
|
import { createHash as createHash2 } from "crypto";
|
|
28842
|
-
import { existsSync as
|
|
28897
|
+
import { existsSync as existsSync29, readFileSync as readFileSync27, writeFileSync as writeFileSync17, mkdirSync as mkdirSync16, renameSync as renameSync10 } from "fs";
|
|
28843
28898
|
import { dirname as dirname10 } from "path";
|
|
28844
28899
|
function hashStringArray(items) {
|
|
28845
28900
|
if (!items || items.length === 0)
|
|
@@ -28904,11 +28959,11 @@ function renderConfigChangeDim(dim) {
|
|
|
28904
28959
|
}
|
|
28905
28960
|
}
|
|
28906
28961
|
function loadSnapshot(path, now = Date.now) {
|
|
28907
|
-
if (!
|
|
28962
|
+
if (!existsSync29(path))
|
|
28908
28963
|
return null;
|
|
28909
28964
|
let raw;
|
|
28910
28965
|
try {
|
|
28911
|
-
raw =
|
|
28966
|
+
raw = readFileSync27(path, "utf-8");
|
|
28912
28967
|
} catch {
|
|
28913
28968
|
return null;
|
|
28914
28969
|
}
|
|
@@ -28938,9 +28993,9 @@ function loadSnapshot(path, now = Date.now) {
|
|
|
28938
28993
|
}
|
|
28939
28994
|
function persistSnapshot(path, snapshot) {
|
|
28940
28995
|
try {
|
|
28941
|
-
|
|
28996
|
+
mkdirSync16(dirname10(path), { recursive: true });
|
|
28942
28997
|
const tmp = `${path}.tmp`;
|
|
28943
|
-
|
|
28998
|
+
writeFileSync17(tmp, JSON.stringify(snapshot), { mode: 384 });
|
|
28944
28999
|
renameSync10(tmp, path);
|
|
28945
29000
|
} catch {}
|
|
28946
29001
|
}
|
|
@@ -28956,7 +29011,7 @@ __export(exports_boot_card, {
|
|
|
28956
29011
|
renderBootCard: () => renderBootCard,
|
|
28957
29012
|
renderAccountRows: () => renderAuthLine
|
|
28958
29013
|
});
|
|
28959
|
-
import { join as
|
|
29014
|
+
import { join as join25 } from "path";
|
|
28960
29015
|
function resolvePersonaName(slug, loadConfig3) {
|
|
28961
29016
|
try {
|
|
28962
29017
|
const config = loadConfig3 ? loadConfig3() : loadConfig();
|
|
@@ -29046,7 +29101,7 @@ function renderBootCard(opts) {
|
|
|
29046
29101
|
`);
|
|
29047
29102
|
}
|
|
29048
29103
|
async function runAllProbes(opts) {
|
|
29049
|
-
const claudeDir =
|
|
29104
|
+
const claudeDir = join25(opts.agentDir, ".claude");
|
|
29050
29105
|
const probes = {};
|
|
29051
29106
|
const slug = opts.agentSlug ?? opts.agentName;
|
|
29052
29107
|
await Promise.allSettled([
|
|
@@ -29092,7 +29147,7 @@ async function startBootCard(chatId, threadId, bot, opts, ackMessageId, log) {
|
|
|
29092
29147
|
restartAgeMs: opts.restartAgeMs,
|
|
29093
29148
|
...opts.updateOutcomeLine ? { updateOutcomeLine: opts.updateOutcomeLine } : {}
|
|
29094
29149
|
});
|
|
29095
|
-
const silentBootCard =
|
|
29150
|
+
const silentBootCard = true;
|
|
29096
29151
|
let messageId;
|
|
29097
29152
|
try {
|
|
29098
29153
|
const sent = await bot.sendMessage(chatId, ackText, {
|
|
@@ -29664,12 +29719,12 @@ var init_flock = () => {};
|
|
|
29664
29719
|
// ../src/vault/vault.ts
|
|
29665
29720
|
import { randomBytes as randomBytes5, scryptSync, createCipheriv, createDecipheriv } from "node:crypto";
|
|
29666
29721
|
import {
|
|
29667
|
-
readFileSync as
|
|
29668
|
-
writeFileSync as
|
|
29669
|
-
existsSync as
|
|
29722
|
+
readFileSync as readFileSync35,
|
|
29723
|
+
writeFileSync as writeFileSync23,
|
|
29724
|
+
existsSync as existsSync37,
|
|
29670
29725
|
renameSync as renameSync12,
|
|
29671
|
-
mkdirSync as
|
|
29672
|
-
unlinkSync as
|
|
29726
|
+
mkdirSync as mkdirSync23,
|
|
29727
|
+
unlinkSync as unlinkSync13,
|
|
29673
29728
|
lstatSync,
|
|
29674
29729
|
realpathSync
|
|
29675
29730
|
} from "node:fs";
|
|
@@ -29704,12 +29759,12 @@ function normalizeSecrets(raw) {
|
|
|
29704
29759
|
return out;
|
|
29705
29760
|
}
|
|
29706
29761
|
function openVault(passphrase, vaultPath) {
|
|
29707
|
-
if (!
|
|
29762
|
+
if (!existsSync37(vaultPath)) {
|
|
29708
29763
|
throw new VaultError(`Vault file not found: ${vaultPath}`);
|
|
29709
29764
|
}
|
|
29710
29765
|
let vaultFile;
|
|
29711
29766
|
try {
|
|
29712
|
-
vaultFile = JSON.parse(
|
|
29767
|
+
vaultFile = JSON.parse(readFileSync35(vaultPath, "utf8"));
|
|
29713
29768
|
} catch {
|
|
29714
29769
|
throw new VaultError(`Failed to read vault file: ${vaultPath}`);
|
|
29715
29770
|
}
|
|
@@ -29754,16 +29809,16 @@ var init_vault = __esm(() => {
|
|
|
29754
29809
|
|
|
29755
29810
|
// ../src/vault/resolver.ts
|
|
29756
29811
|
import {
|
|
29757
|
-
chmodSync as
|
|
29812
|
+
chmodSync as chmodSync5,
|
|
29758
29813
|
closeSync as closeSync7,
|
|
29759
|
-
mkdirSync as
|
|
29814
|
+
mkdirSync as mkdirSync24,
|
|
29760
29815
|
mkdtempSync as mkdtempSync2,
|
|
29761
29816
|
openSync as openSync7,
|
|
29762
29817
|
rmSync as rmSync3,
|
|
29763
29818
|
statSync as statSync11,
|
|
29764
29819
|
writeSync as writeSync2
|
|
29765
29820
|
} from "node:fs";
|
|
29766
|
-
import { join as
|
|
29821
|
+
import { join as join35 } from "node:path";
|
|
29767
29822
|
import { tmpdir } from "node:os";
|
|
29768
29823
|
import { constants as fsConstants } from "node:fs";
|
|
29769
29824
|
function isVaultReference(value) {
|
|
@@ -29815,13 +29870,13 @@ function materializationRoot() {
|
|
|
29815
29870
|
return cachedRoot;
|
|
29816
29871
|
const xdg = process.env.XDG_RUNTIME_DIR;
|
|
29817
29872
|
if (xdg) {
|
|
29818
|
-
const base =
|
|
29819
|
-
|
|
29820
|
-
cachedRoot = mkdtempSync2(
|
|
29873
|
+
const base = join35(xdg, "switchroom", "vault");
|
|
29874
|
+
mkdirSync24(base, { recursive: true, mode: 448 });
|
|
29875
|
+
cachedRoot = mkdtempSync2(join35(base, "run-"));
|
|
29821
29876
|
} else {
|
|
29822
|
-
cachedRoot = mkdtempSync2(
|
|
29877
|
+
cachedRoot = mkdtempSync2(join35(tmpdir(), "switchroom-vault-"));
|
|
29823
29878
|
}
|
|
29824
|
-
|
|
29879
|
+
chmodSync5(cachedRoot, 448);
|
|
29825
29880
|
return cachedRoot;
|
|
29826
29881
|
}
|
|
29827
29882
|
function writeFileExclusive(filePath, content) {
|
|
@@ -29834,14 +29889,14 @@ function writeFileExclusive(filePath, content) {
|
|
|
29834
29889
|
}
|
|
29835
29890
|
}
|
|
29836
29891
|
function materializeFilesEntry(key, files) {
|
|
29837
|
-
const dir =
|
|
29892
|
+
const dir = join35(materializationRoot(), key);
|
|
29838
29893
|
if (materializedDirs.has(dir)) {
|
|
29839
29894
|
try {
|
|
29840
29895
|
rmSync3(dir, { recursive: true, force: true });
|
|
29841
29896
|
} catch {}
|
|
29842
29897
|
}
|
|
29843
|
-
|
|
29844
|
-
|
|
29898
|
+
mkdirSync24(dir, { recursive: true, mode: 448 });
|
|
29899
|
+
chmodSync5(dir, 448);
|
|
29845
29900
|
const st = statSync11(dir);
|
|
29846
29901
|
if (typeof process.getuid === "function" && st.uid !== process.getuid()) {
|
|
29847
29902
|
throw new Error(`Refusing to materialize vault entry: ${dir} not owned by caller`);
|
|
@@ -29850,7 +29905,7 @@ function materializeFilesEntry(key, files) {
|
|
|
29850
29905
|
if (filename.includes("/") || filename.includes("\\") || filename === ".." || filename === "." || filename.includes("\x00")) {
|
|
29851
29906
|
throw new Error(`Refusing to materialize vault file with unsafe name: ${filename}`);
|
|
29852
29907
|
}
|
|
29853
|
-
const filePath =
|
|
29908
|
+
const filePath = join35(dir, filename);
|
|
29854
29909
|
const content = encoding === "base64" ? Buffer.from(value, "base64") : value;
|
|
29855
29910
|
writeFileExclusive(filePath, content);
|
|
29856
29911
|
}
|
|
@@ -29983,7 +30038,7 @@ __export(exports_materialize_bot_token, {
|
|
|
29983
30038
|
materializeBotToken: () => materializeBotToken,
|
|
29984
30039
|
BotTokenMaterializeError: () => BotTokenMaterializeError
|
|
29985
30040
|
});
|
|
29986
|
-
import { existsSync as
|
|
30041
|
+
import { existsSync as existsSync38 } from "node:fs";
|
|
29987
30042
|
function pickConfiguredToken(config, agentName3) {
|
|
29988
30043
|
if (agentName3) {
|
|
29989
30044
|
const agent = config.agents?.[agentName3];
|
|
@@ -29997,7 +30052,7 @@ function tryDirectVaultRead(ref, config, passphrase) {
|
|
|
29997
30052
|
if (!passphrase)
|
|
29998
30053
|
return null;
|
|
29999
30054
|
const vaultPath = resolvePath(config.vault?.path ?? "~/.switchroom/vault.enc");
|
|
30000
|
-
if (!
|
|
30055
|
+
if (!existsSync38(vaultPath))
|
|
30001
30056
|
return null;
|
|
30002
30057
|
try {
|
|
30003
30058
|
const secrets = openVault(passphrase, vaultPath);
|
|
@@ -30307,7 +30362,7 @@ __export(exports_tmux, {
|
|
|
30307
30362
|
captureAgentPane: () => captureAgentPane
|
|
30308
30363
|
});
|
|
30309
30364
|
import { execFileSync as execFileSync4 } from "node:child_process";
|
|
30310
|
-
import { mkdirSync as
|
|
30365
|
+
import { mkdirSync as mkdirSync25, readdirSync as readdirSync6, statSync as statSync12, unlinkSync as unlinkSync14, writeFileSync as writeFileSync24 } from "node:fs";
|
|
30311
30366
|
import { resolve as resolve7 } from "node:path";
|
|
30312
30367
|
function captureAgentPane(opts) {
|
|
30313
30368
|
const { agentName: agentName3, agentDir, reason } = opts;
|
|
@@ -30319,7 +30374,7 @@ function captureAgentPane(opts) {
|
|
|
30319
30374
|
const reasonSlug = sanitizeReason(reason);
|
|
30320
30375
|
const outPath = resolve7(outDir, `${ts}-${reasonSlug}.txt`);
|
|
30321
30376
|
try {
|
|
30322
|
-
|
|
30377
|
+
mkdirSync25(outDir, { recursive: true, mode: 493 });
|
|
30323
30378
|
} catch (err) {
|
|
30324
30379
|
const msg = `mkdir crash-reports failed: ${err.message}`;
|
|
30325
30380
|
console.error(`[tmux-capture] ${agentName3}: ${msg}`);
|
|
@@ -30353,7 +30408,7 @@ function captureAgentPane(opts) {
|
|
|
30353
30408
|
` + `
|
|
30354
30409
|
`;
|
|
30355
30410
|
try {
|
|
30356
|
-
|
|
30411
|
+
writeFileSync24(outPath, Buffer.concat([Buffer.from(header, "utf8"), body]), {
|
|
30357
30412
|
mode: 420
|
|
30358
30413
|
});
|
|
30359
30414
|
} catch (err) {
|
|
@@ -30421,7 +30476,7 @@ function pruneOldReports(dir, retain) {
|
|
|
30421
30476
|
}).sort((a, b) => b.mtimeMs - a.mtimeMs);
|
|
30422
30477
|
for (const stale of files.slice(retain)) {
|
|
30423
30478
|
try {
|
|
30424
|
-
|
|
30479
|
+
unlinkSync14(stale.full);
|
|
30425
30480
|
} catch {}
|
|
30426
30481
|
}
|
|
30427
30482
|
}
|
|
@@ -30695,23 +30750,23 @@ var import_runner2 = __toESM(require_mod3(), 1);
|
|
|
30695
30750
|
import { randomBytes as randomBytes6 } from "crypto";
|
|
30696
30751
|
import { execFileSync as execFileSync5, execSync as execSync2, spawn as spawn2 } from "child_process";
|
|
30697
30752
|
import {
|
|
30698
|
-
readFileSync as
|
|
30699
|
-
writeFileSync as
|
|
30700
|
-
mkdirSync as
|
|
30753
|
+
readFileSync as readFileSync36,
|
|
30754
|
+
writeFileSync as writeFileSync25,
|
|
30755
|
+
mkdirSync as mkdirSync26,
|
|
30701
30756
|
readdirSync as readdirSync7,
|
|
30702
30757
|
rmSync as rmSync4,
|
|
30703
30758
|
statSync as statSync13,
|
|
30704
30759
|
renameSync as renameSync13,
|
|
30705
30760
|
realpathSync as realpathSync2,
|
|
30706
|
-
chmodSync as
|
|
30761
|
+
chmodSync as chmodSync6,
|
|
30707
30762
|
openSync as openSync8,
|
|
30708
30763
|
closeSync as closeSync8,
|
|
30709
|
-
existsSync as
|
|
30710
|
-
unlinkSync as
|
|
30711
|
-
appendFileSync as
|
|
30764
|
+
existsSync as existsSync39,
|
|
30765
|
+
unlinkSync as unlinkSync15,
|
|
30766
|
+
appendFileSync as appendFileSync5
|
|
30712
30767
|
} from "fs";
|
|
30713
|
-
import { homedir as
|
|
30714
|
-
import { join as
|
|
30768
|
+
import { homedir as homedir14 } from "os";
|
|
30769
|
+
import { join as join36, extname, sep as sep3, basename as basename7 } from "path";
|
|
30715
30770
|
|
|
30716
30771
|
// plugin-logger.ts
|
|
30717
30772
|
import { appendFileSync, mkdirSync, renameSync, statSync, existsSync } from "fs";
|
|
@@ -33227,7 +33282,7 @@ function clear(key) {
|
|
|
33227
33282
|
state.delete(key);
|
|
33228
33283
|
}
|
|
33229
33284
|
|
|
33230
|
-
//
|
|
33285
|
+
// ../node_modules/.bun/posthog-node@5.29.2/node_modules/posthog-node/dist/extensions/error-tracking/modifiers/module.node.mjs
|
|
33231
33286
|
import { dirname as dirname2, posix, sep as sep2 } from "path";
|
|
33232
33287
|
function createModulerModifier() {
|
|
33233
33288
|
const getModuleFromFileName = createGetModuleFromFilename();
|
|
@@ -33263,7 +33318,7 @@ function normalizeWindowsPath(path) {
|
|
|
33263
33318
|
return path.replace(/^[A-Z]:/, "").replace(/\\/g, "/");
|
|
33264
33319
|
}
|
|
33265
33320
|
|
|
33266
|
-
//
|
|
33321
|
+
// ../node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/featureFlagUtils.mjs
|
|
33267
33322
|
var normalizeFlagsResponse = (flagsResponse) => {
|
|
33268
33323
|
if ("flags" in flagsResponse) {
|
|
33269
33324
|
const featureFlags = getFlagValuesFromFlags(flagsResponse.flags);
|
|
@@ -33334,7 +33389,7 @@ var parsePayload = (response) => {
|
|
|
33334
33389
|
}
|
|
33335
33390
|
};
|
|
33336
33391
|
|
|
33337
|
-
//
|
|
33392
|
+
// ../node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/gzip.mjs
|
|
33338
33393
|
function isGzipSupported() {
|
|
33339
33394
|
return "CompressionStream" in globalThis;
|
|
33340
33395
|
}
|
|
@@ -33354,7 +33409,7 @@ async function gzipCompress(input, isDebug = true) {
|
|
|
33354
33409
|
}
|
|
33355
33410
|
}
|
|
33356
33411
|
|
|
33357
|
-
//
|
|
33412
|
+
// ../node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/vendor/uuidv7.mjs
|
|
33358
33413
|
/*! For license information please see uuidv7.mjs.LICENSE.txt */
|
|
33359
33414
|
var DIGITS = "0123456789abcdef";
|
|
33360
33415
|
|
|
@@ -33532,7 +33587,7 @@ var defaultGenerator;
|
|
|
33532
33587
|
var uuidv7 = () => uuidv7obj().toString();
|
|
33533
33588
|
var uuidv7obj = () => (defaultGenerator || (defaultGenerator = new V7Generator)).generate();
|
|
33534
33589
|
|
|
33535
|
-
//
|
|
33590
|
+
// ../node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/types.mjs
|
|
33536
33591
|
var types_PostHogPersistedProperty = /* @__PURE__ */ function(PostHogPersistedProperty) {
|
|
33537
33592
|
PostHogPersistedProperty["AnonymousId"] = "anonymous_id";
|
|
33538
33593
|
PostHogPersistedProperty["DistinctId"] = "distinct_id";
|
|
@@ -33565,7 +33620,7 @@ var types_PostHogPersistedProperty = /* @__PURE__ */ function(PostHogPersistedPr
|
|
|
33565
33620
|
return PostHogPersistedProperty;
|
|
33566
33621
|
}({});
|
|
33567
33622
|
|
|
33568
|
-
//
|
|
33623
|
+
// ../node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/utils/bot-detection.mjs
|
|
33569
33624
|
var DEFAULT_BLOCKED_UA_STRS = [
|
|
33570
33625
|
"amazonbot",
|
|
33571
33626
|
"amazonproductbot",
|
|
@@ -33654,7 +33709,7 @@ var isBlockedUA = function(ua, customBlockedUserAgents = []) {
|
|
|
33654
33709
|
return uaLower.indexOf(blockedUaLower) !== -1;
|
|
33655
33710
|
});
|
|
33656
33711
|
};
|
|
33657
|
-
//
|
|
33712
|
+
// ../node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/utils/type-utils.mjs
|
|
33658
33713
|
var nativeIsArray = Array.isArray;
|
|
33659
33714
|
var ObjProto = Object.prototype;
|
|
33660
33715
|
var type_utils_hasOwnProperty = ObjProto.hasOwnProperty;
|
|
@@ -33691,7 +33746,7 @@ function isInstanceOf(candidate, base) {
|
|
|
33691
33746
|
}
|
|
33692
33747
|
}
|
|
33693
33748
|
|
|
33694
|
-
//
|
|
33749
|
+
// ../node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/utils/number-utils.mjs
|
|
33695
33750
|
function clampToRange(value, min, max, logger, fallbackValue) {
|
|
33696
33751
|
if (min > max) {
|
|
33697
33752
|
logger.warn("min cannot be greater than max.");
|
|
@@ -33711,7 +33766,7 @@ function clampToRange(value, min, max, logger, fallbackValue) {
|
|
|
33711
33766
|
return clampToRange(fallbackValue || max, min, max, logger);
|
|
33712
33767
|
}
|
|
33713
33768
|
|
|
33714
|
-
//
|
|
33769
|
+
// ../node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/utils/bucketed-rate-limiter.mjs
|
|
33715
33770
|
var ONE_DAY_IN_MS = 86400000;
|
|
33716
33771
|
|
|
33717
33772
|
class BucketedRateLimiter {
|
|
@@ -33755,7 +33810,7 @@ class BucketedRateLimiter {
|
|
|
33755
33810
|
this._buckets = {};
|
|
33756
33811
|
}
|
|
33757
33812
|
}
|
|
33758
|
-
//
|
|
33813
|
+
// ../node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/utils/promise-queue.mjs
|
|
33759
33814
|
class PromiseQueue {
|
|
33760
33815
|
add(promise) {
|
|
33761
33816
|
const promiseUUID = uuidv7();
|
|
@@ -33781,7 +33836,7 @@ class PromiseQueue {
|
|
|
33781
33836
|
this.promiseByIds = {};
|
|
33782
33837
|
}
|
|
33783
33838
|
}
|
|
33784
|
-
//
|
|
33839
|
+
// ../node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/utils/logger.mjs
|
|
33785
33840
|
function createConsole(consoleLike = console) {
|
|
33786
33841
|
const lockedMethods = {
|
|
33787
33842
|
log: consoleLike.log.bind(consoleLike),
|
|
@@ -33819,7 +33874,7 @@ var passThrough = (fn) => fn();
|
|
|
33819
33874
|
function createLogger(prefix, maybeCall = passThrough) {
|
|
33820
33875
|
return _createLogger(prefix, maybeCall, createConsole());
|
|
33821
33876
|
}
|
|
33822
|
-
//
|
|
33877
|
+
// ../node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/utils/user-agent-utils.mjs
|
|
33823
33878
|
var MOBILE = "Mobile";
|
|
33824
33879
|
var IOS = "iOS";
|
|
33825
33880
|
var ANDROID = "Android";
|
|
@@ -34076,7 +34131,7 @@ var osMatchers = [
|
|
|
34076
34131
|
]
|
|
34077
34132
|
];
|
|
34078
34133
|
|
|
34079
|
-
//
|
|
34134
|
+
// ../node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/utils/index.mjs
|
|
34080
34135
|
var STRING_FORMAT = "utf8";
|
|
34081
34136
|
function assert(truthyValue, message) {
|
|
34082
34137
|
if (!truthyValue || typeof truthyValue != "string" || isEmpty(truthyValue))
|
|
@@ -34124,7 +34179,7 @@ function allSettled(promises) {
|
|
|
34124
34179
|
reason
|
|
34125
34180
|
}))));
|
|
34126
34181
|
}
|
|
34127
|
-
//
|
|
34182
|
+
// ../node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/eventemitter.mjs
|
|
34128
34183
|
class SimpleEventEmitter {
|
|
34129
34184
|
constructor() {
|
|
34130
34185
|
this.events = {};
|
|
@@ -34146,7 +34201,7 @@ class SimpleEventEmitter {
|
|
|
34146
34201
|
}
|
|
34147
34202
|
}
|
|
34148
34203
|
|
|
34149
|
-
//
|
|
34204
|
+
// ../node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/posthog-core-stateless.mjs
|
|
34150
34205
|
class PostHogFetchHttpError extends Error {
|
|
34151
34206
|
constructor(response, reqByteLength) {
|
|
34152
34207
|
super("HTTP error while fetching PostHog: status=" + response.status + ", reqByteLength=" + reqByteLength), this.response = response, this.reqByteLength = reqByteLength, this.name = "PostHogFetchHttpError";
|
|
@@ -34861,7 +34916,7 @@ class PostHogCoreStateless {
|
|
|
34861
34916
|
return this.shutdownPromise;
|
|
34862
34917
|
}
|
|
34863
34918
|
}
|
|
34864
|
-
//
|
|
34919
|
+
// ../node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/index.mjs
|
|
34865
34920
|
var exports_error_tracking = {};
|
|
34866
34921
|
__export(exports_error_tracking, {
|
|
34867
34922
|
winjsStackLineParser: () => winjsStackLineParser,
|
|
@@ -34885,7 +34940,7 @@ __export(exports_error_tracking, {
|
|
|
34885
34940
|
DOMExceptionCoercer: () => DOMExceptionCoercer
|
|
34886
34941
|
});
|
|
34887
34942
|
|
|
34888
|
-
//
|
|
34943
|
+
// ../node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/chunk-ids.mjs
|
|
34889
34944
|
var parsedStackResults;
|
|
34890
34945
|
var lastKeysCount;
|
|
34891
34946
|
var cachedFilenameChunkIds;
|
|
@@ -34924,7 +34979,7 @@ function getFilenameToChunkIdMap(stackParser) {
|
|
|
34924
34979
|
return cachedFilenameChunkIds;
|
|
34925
34980
|
}
|
|
34926
34981
|
|
|
34927
|
-
//
|
|
34982
|
+
// ../node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/error-properties-builder.mjs
|
|
34928
34983
|
var MAX_CAUSE_RECURSION = 4;
|
|
34929
34984
|
|
|
34930
34985
|
class ErrorPropertiesBuilder {
|
|
@@ -35046,7 +35101,7 @@ class ErrorPropertiesBuilder {
|
|
|
35046
35101
|
return context;
|
|
35047
35102
|
}
|
|
35048
35103
|
}
|
|
35049
|
-
//
|
|
35104
|
+
// ../node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/parsers/base.mjs
|
|
35050
35105
|
var UNKNOWN_FUNCTION = "?";
|
|
35051
35106
|
function createFrame(platform, filename, func, lineno, colno) {
|
|
35052
35107
|
const frame = {
|
|
@@ -35062,7 +35117,7 @@ function createFrame(platform, filename, func, lineno, colno) {
|
|
|
35062
35117
|
return frame;
|
|
35063
35118
|
}
|
|
35064
35119
|
|
|
35065
|
-
//
|
|
35120
|
+
// ../node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/parsers/safari.mjs
|
|
35066
35121
|
var extractSafariExtensionDetails = (func, filename) => {
|
|
35067
35122
|
const isSafariExtension = func.indexOf("safari-extension") !== -1;
|
|
35068
35123
|
const isSafariWebExtension = func.indexOf("safari-web-extension") !== -1;
|
|
@@ -35075,7 +35130,7 @@ var extractSafariExtensionDetails = (func, filename) => {
|
|
|
35075
35130
|
];
|
|
35076
35131
|
};
|
|
35077
35132
|
|
|
35078
|
-
//
|
|
35133
|
+
// ../node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/parsers/chrome.mjs
|
|
35079
35134
|
var chromeRegexNoFnName = /^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i;
|
|
35080
35135
|
var chromeRegex = /^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i;
|
|
35081
35136
|
var chromeEvalRegex = /\((\S*)(?::(\d+))(?::(\d+))\)/;
|
|
@@ -35101,7 +35156,7 @@ var chromeStackLineParser = (line, platform) => {
|
|
|
35101
35156
|
}
|
|
35102
35157
|
};
|
|
35103
35158
|
|
|
35104
|
-
//
|
|
35159
|
+
// ../node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/parsers/gecko.mjs
|
|
35105
35160
|
var geckoREgex = /^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i;
|
|
35106
35161
|
var geckoEvalRegex = /(\S+) line (\d+)(?: > eval line \d+)* > eval/i;
|
|
35107
35162
|
var geckoStackLineParser = (line, platform) => {
|
|
@@ -35124,14 +35179,14 @@ var geckoStackLineParser = (line, platform) => {
|
|
|
35124
35179
|
}
|
|
35125
35180
|
};
|
|
35126
35181
|
|
|
35127
|
-
//
|
|
35182
|
+
// ../node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/parsers/winjs.mjs
|
|
35128
35183
|
var winjsRegex = /^\s*at (?:((?:\[object object\])?.+) )?\(?((?:[-a-z]+):.*?):(\d+)(?::(\d+))?\)?\s*$/i;
|
|
35129
35184
|
var winjsStackLineParser = (line, platform) => {
|
|
35130
35185
|
const parts = winjsRegex.exec(line);
|
|
35131
35186
|
return parts ? createFrame(platform, parts[2], parts[1] || UNKNOWN_FUNCTION, +parts[3], parts[4] ? +parts[4] : undefined) : undefined;
|
|
35132
35187
|
};
|
|
35133
35188
|
|
|
35134
|
-
//
|
|
35189
|
+
// ../node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/parsers/opera.mjs
|
|
35135
35190
|
var opera10Regex = / line (\d+).*script (?:in )?(\S+)(?:: in function (\S+))?$/i;
|
|
35136
35191
|
var opera10StackLineParser = (line, platform) => {
|
|
35137
35192
|
const parts = opera10Regex.exec(line);
|
|
@@ -35143,7 +35198,7 @@ var opera11StackLineParser = (line, platform) => {
|
|
|
35143
35198
|
return parts ? createFrame(platform, parts[5], parts[3] || parts[4] || UNKNOWN_FUNCTION, +parts[1], +parts[2]) : undefined;
|
|
35144
35199
|
};
|
|
35145
35200
|
|
|
35146
|
-
//
|
|
35201
|
+
// ../node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/parsers/node.mjs
|
|
35147
35202
|
var FILENAME_MATCH = /^\s*[-]{4,}$/;
|
|
35148
35203
|
var FULL_MATCH = /at (?:async )?(?:(.+?)\s+\()?(?:(.+):(\d+):(\d+)?|([^)]+))\)?/;
|
|
35149
35204
|
var nodeStackLineParser = (line, platform) => {
|
|
@@ -35212,7 +35267,7 @@ function _parseIntOrUndefined(input) {
|
|
|
35212
35267
|
return parseInt(input || "", 10) || undefined;
|
|
35213
35268
|
}
|
|
35214
35269
|
|
|
35215
|
-
//
|
|
35270
|
+
// ../node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/parsers/index.mjs
|
|
35216
35271
|
var WEBPACK_ERROR_REGEXP = /\(error: (.*)\)/;
|
|
35217
35272
|
var STACKTRACE_FRAME_LIMIT = 50;
|
|
35218
35273
|
function reverseAndStripFrames(stack) {
|
|
@@ -35257,7 +35312,7 @@ function createStackParser(platform, ...parsers) {
|
|
|
35257
35312
|
return reverseAndStripFrames(frames);
|
|
35258
35313
|
};
|
|
35259
35314
|
}
|
|
35260
|
-
//
|
|
35315
|
+
// ../node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/coercers/dom-exception-coercer.mjs
|
|
35261
35316
|
class DOMExceptionCoercer {
|
|
35262
35317
|
match(err) {
|
|
35263
35318
|
return this.isDOMException(err) || this.isDOMError(err);
|
|
@@ -35287,7 +35342,7 @@ class DOMExceptionCoercer {
|
|
|
35287
35342
|
return isBuiltin(err, "DOMError");
|
|
35288
35343
|
}
|
|
35289
35344
|
}
|
|
35290
|
-
//
|
|
35345
|
+
// ../node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/coercers/error-coercer.mjs
|
|
35291
35346
|
class ErrorCoercer {
|
|
35292
35347
|
match(err) {
|
|
35293
35348
|
return isPlainError(err);
|
|
@@ -35314,7 +35369,7 @@ class ErrorCoercer {
|
|
|
35314
35369
|
return err.stacktrace || err.stack || undefined;
|
|
35315
35370
|
}
|
|
35316
35371
|
}
|
|
35317
|
-
//
|
|
35372
|
+
// ../node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/coercers/error-event-coercer.mjs
|
|
35318
35373
|
class ErrorEventCoercer {
|
|
35319
35374
|
constructor() {}
|
|
35320
35375
|
match(err) {
|
|
@@ -35332,7 +35387,7 @@ class ErrorEventCoercer {
|
|
|
35332
35387
|
return exceptionLike;
|
|
35333
35388
|
}
|
|
35334
35389
|
}
|
|
35335
|
-
//
|
|
35390
|
+
// ../node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/coercers/string-coercer.mjs
|
|
35336
35391
|
var ERROR_TYPES_PATTERN = /^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;
|
|
35337
35392
|
|
|
35338
35393
|
class StringCoercer {
|
|
@@ -35362,7 +35417,7 @@ class StringCoercer {
|
|
|
35362
35417
|
];
|
|
35363
35418
|
}
|
|
35364
35419
|
}
|
|
35365
|
-
//
|
|
35420
|
+
// ../node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/types.mjs
|
|
35366
35421
|
var severityLevels = [
|
|
35367
35422
|
"fatal",
|
|
35368
35423
|
"error",
|
|
@@ -35372,7 +35427,7 @@ var severityLevels = [
|
|
|
35372
35427
|
"debug"
|
|
35373
35428
|
];
|
|
35374
35429
|
|
|
35375
|
-
//
|
|
35430
|
+
// ../node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/coercers/utils.mjs
|
|
35376
35431
|
function extractExceptionKeysForMessage(err, maxLength = 40) {
|
|
35377
35432
|
const keys = Object.keys(err);
|
|
35378
35433
|
keys.sort();
|
|
@@ -35389,7 +35444,7 @@ function extractExceptionKeysForMessage(err, maxLength = 40) {
|
|
|
35389
35444
|
return "";
|
|
35390
35445
|
}
|
|
35391
35446
|
|
|
35392
|
-
//
|
|
35447
|
+
// ../node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/coercers/object-coercer.mjs
|
|
35393
35448
|
class ObjectCoercer {
|
|
35394
35449
|
match(candidate) {
|
|
35395
35450
|
return typeof candidate == "object" && candidate !== null;
|
|
@@ -35442,7 +35497,7 @@ class ObjectCoercer {
|
|
|
35442
35497
|
}
|
|
35443
35498
|
}
|
|
35444
35499
|
}
|
|
35445
|
-
//
|
|
35500
|
+
// ../node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/coercers/event-coercer.mjs
|
|
35446
35501
|
class EventCoercer {
|
|
35447
35502
|
match(err) {
|
|
35448
35503
|
return isEvent(err);
|
|
@@ -35457,7 +35512,7 @@ class EventCoercer {
|
|
|
35457
35512
|
};
|
|
35458
35513
|
}
|
|
35459
35514
|
}
|
|
35460
|
-
//
|
|
35515
|
+
// ../node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/coercers/primitive-coercer.mjs
|
|
35461
35516
|
class PrimitiveCoercer {
|
|
35462
35517
|
match(candidate) {
|
|
35463
35518
|
return isPrimitive(candidate);
|
|
@@ -35471,7 +35526,7 @@ class PrimitiveCoercer {
|
|
|
35471
35526
|
};
|
|
35472
35527
|
}
|
|
35473
35528
|
}
|
|
35474
|
-
//
|
|
35529
|
+
// ../node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/coercers/promise-rejection-event.mjs
|
|
35475
35530
|
class PromiseRejectionEventCoercer {
|
|
35476
35531
|
match(err) {
|
|
35477
35532
|
return isBuiltin(err, "PromiseRejectionEvent") || this.isCustomEventWrappingRejection(err);
|
|
@@ -35507,7 +35562,7 @@ class PromiseRejectionEventCoercer {
|
|
|
35507
35562
|
return error;
|
|
35508
35563
|
}
|
|
35509
35564
|
}
|
|
35510
|
-
//
|
|
35565
|
+
// ../node_modules/.bun/@posthog+core@1.25.2/node_modules/@posthog/core/dist/error-tracking/utils.mjs
|
|
35511
35566
|
class ReduceableCache {
|
|
35512
35567
|
constructor(_maxSize) {
|
|
35513
35568
|
this._maxSize = _maxSize;
|
|
@@ -35532,7 +35587,7 @@ class ReduceableCache {
|
|
|
35532
35587
|
}
|
|
35533
35588
|
}
|
|
35534
35589
|
}
|
|
35535
|
-
//
|
|
35590
|
+
// ../node_modules/.bun/posthog-node@5.29.2/node_modules/posthog-node/dist/extensions/error-tracking/modifiers/context-lines.node.mjs
|
|
35536
35591
|
import { createReadStream } from "node:fs";
|
|
35537
35592
|
import { createInterface } from "node:readline";
|
|
35538
35593
|
var LRU_FILE_CONTENTS_CACHE = new exports_error_tracking.ReduceableCache(25);
|
|
@@ -35750,7 +35805,7 @@ function snipLine(line, colno) {
|
|
|
35750
35805
|
return newLine;
|
|
35751
35806
|
}
|
|
35752
35807
|
|
|
35753
|
-
//
|
|
35808
|
+
// ../node_modules/.bun/posthog-node@5.29.2/node_modules/posthog-node/dist/extensions/error-tracking/autocapture.mjs
|
|
35754
35809
|
function makeUncaughtExceptionHandler(captureFn, onFatalFn) {
|
|
35755
35810
|
let calledFatalError = false;
|
|
35756
35811
|
return Object.assign((error) => {
|
|
@@ -35782,7 +35837,7 @@ function addUnhandledRejectionListener(captureFn) {
|
|
|
35782
35837
|
}));
|
|
35783
35838
|
}
|
|
35784
35839
|
|
|
35785
|
-
//
|
|
35840
|
+
// ../node_modules/.bun/posthog-node@5.29.2/node_modules/posthog-node/dist/extensions/error-tracking/index.mjs
|
|
35786
35841
|
var SHUTDOWN_TIMEOUT = 2000;
|
|
35787
35842
|
|
|
35788
35843
|
class ErrorTracking {
|
|
@@ -35851,10 +35906,10 @@ class ErrorTracking {
|
|
|
35851
35906
|
}
|
|
35852
35907
|
}
|
|
35853
35908
|
|
|
35854
|
-
//
|
|
35909
|
+
// ../node_modules/.bun/posthog-node@5.29.2/node_modules/posthog-node/dist/version.mjs
|
|
35855
35910
|
var version = "5.29.2";
|
|
35856
35911
|
|
|
35857
|
-
//
|
|
35912
|
+
// ../node_modules/.bun/posthog-node@5.29.2/node_modules/posthog-node/dist/types.mjs
|
|
35858
35913
|
var FeatureFlagError2 = {
|
|
35859
35914
|
ERRORS_WHILE_COMPUTING: "errors_while_computing_flags",
|
|
35860
35915
|
FLAG_MISSING: "flag_missing",
|
|
@@ -35862,7 +35917,7 @@ var FeatureFlagError2 = {
|
|
|
35862
35917
|
UNKNOWN_ERROR: "unknown_error"
|
|
35863
35918
|
};
|
|
35864
35919
|
|
|
35865
|
-
//
|
|
35920
|
+
// ../node_modules/.bun/posthog-node@5.29.2/node_modules/posthog-node/dist/extensions/feature-flags/crypto.mjs
|
|
35866
35921
|
async function hashSHA1(text) {
|
|
35867
35922
|
const subtle = globalThis.crypto?.subtle;
|
|
35868
35923
|
if (!subtle)
|
|
@@ -35872,7 +35927,7 @@ async function hashSHA1(text) {
|
|
|
35872
35927
|
return hashArray.map((byte) => byte.toString(16).padStart(2, "0")).join("");
|
|
35873
35928
|
}
|
|
35874
35929
|
|
|
35875
|
-
//
|
|
35930
|
+
// ../node_modules/.bun/posthog-node@5.29.2/node_modules/posthog-node/dist/extensions/feature-flags/feature-flags.mjs
|
|
35876
35931
|
var SIXTY_SECONDS = 60000;
|
|
35877
35932
|
var LONG_SCALE = 1152921504606847000;
|
|
35878
35933
|
var NULL_VALUES_ALLOWED_OPERATORS = [
|
|
@@ -36746,7 +36801,7 @@ function relativeDateParseForFeatureFlagMatching(value) {
|
|
|
36746
36801
|
}
|
|
36747
36802
|
}
|
|
36748
36803
|
|
|
36749
|
-
//
|
|
36804
|
+
// ../node_modules/.bun/posthog-node@5.29.2/node_modules/posthog-node/dist/storage-memory.mjs
|
|
36750
36805
|
class PostHogMemoryStorage {
|
|
36751
36806
|
getProperty(key) {
|
|
36752
36807
|
return this._memoryStorage[key];
|
|
@@ -36759,7 +36814,7 @@ class PostHogMemoryStorage {
|
|
|
36759
36814
|
}
|
|
36760
36815
|
}
|
|
36761
36816
|
|
|
36762
|
-
//
|
|
36817
|
+
// ../node_modules/.bun/posthog-node@5.29.2/node_modules/posthog-node/dist/client.mjs
|
|
36763
36818
|
var MINIMUM_POLLING_INTERVAL = 100;
|
|
36764
36819
|
var THIRTY_SECONDS = 30000;
|
|
36765
36820
|
var MAX_CACHE_SIZE = 50000;
|
|
@@ -37547,7 +37602,7 @@ class PostHogBackendClient extends PostHogCoreStateless {
|
|
|
37547
37602
|
}
|
|
37548
37603
|
}
|
|
37549
37604
|
|
|
37550
|
-
//
|
|
37605
|
+
// ../node_modules/.bun/posthog-node@5.29.2/node_modules/posthog-node/dist/extensions/context/context.mjs
|
|
37551
37606
|
import { AsyncLocalStorage as AsyncLocalStorage2 } from "node:async_hooks";
|
|
37552
37607
|
|
|
37553
37608
|
class PostHogContext {
|
|
@@ -37578,7 +37633,7 @@ class PostHogContext {
|
|
|
37578
37633
|
}
|
|
37579
37634
|
}
|
|
37580
37635
|
|
|
37581
|
-
//
|
|
37636
|
+
// ../node_modules/.bun/posthog-node@5.29.2/node_modules/posthog-node/dist/extensions/sentry-integration.mjs
|
|
37582
37637
|
var NAME = "posthog-node";
|
|
37583
37638
|
function createEventProcessor(_posthog, { organization, projectId, prefix, severityAllowList = [
|
|
37584
37639
|
"error"
|
|
@@ -37646,7 +37701,7 @@ class PostHogSentryIntegration {
|
|
|
37646
37701
|
};
|
|
37647
37702
|
}
|
|
37648
37703
|
}
|
|
37649
|
-
//
|
|
37704
|
+
// ../node_modules/.bun/posthog-node@5.29.2/node_modules/posthog-node/dist/entrypoints/index.node.mjs
|
|
37650
37705
|
ErrorTracking.errorPropertiesBuilder = new exports_error_tracking.ErrorPropertiesBuilder([
|
|
37651
37706
|
new exports_error_tracking.EventCoercer,
|
|
37652
37707
|
new exports_error_tracking.ErrorCoercer,
|
|
@@ -37983,13 +38038,7 @@ function classifyInbound(text) {
|
|
|
37983
38038
|
|
|
37984
38039
|
// silence-poke.ts
|
|
37985
38040
|
var DEFAULT_THRESHOLDS = {
|
|
37986
|
-
|
|
37987
|
-
awarenessPing: 60000,
|
|
37988
|
-
soft: 75000,
|
|
37989
|
-
firm: 180000,
|
|
37990
|
-
fallback: 300000,
|
|
37991
|
-
subagentSoft: 300000,
|
|
37992
|
-
pokeSuccessWindowMs: 15000
|
|
38041
|
+
fallback: 300000
|
|
37993
38042
|
};
|
|
37994
38043
|
var DEFAULT_POLL_INTERVAL_MS = 5000;
|
|
37995
38044
|
var state2 = new Map;
|
|
@@ -38005,14 +38054,8 @@ function startTurn(key, now) {
|
|
|
38005
38054
|
state2.set(key, {
|
|
38006
38055
|
turnStartedAt: now,
|
|
38007
38056
|
lastOutboundAt: null,
|
|
38008
|
-
pokesFired: 0,
|
|
38009
|
-
pokeArmed: null,
|
|
38010
|
-
subagentDispatchActive: false,
|
|
38011
38057
|
lastThinkingAt: null,
|
|
38012
38058
|
fallbackFired: false,
|
|
38013
|
-
ackPokeFired: false,
|
|
38014
|
-
awarenessPingFired: false,
|
|
38015
|
-
lastPokeFiredAt: null,
|
|
38016
38059
|
inFlightTools: new Map
|
|
38017
38060
|
});
|
|
38018
38061
|
}
|
|
@@ -38020,27 +38063,9 @@ function noteOutbound2(key, now) {
|
|
|
38020
38063
|
const s = state2.get(key);
|
|
38021
38064
|
if (s == null)
|
|
38022
38065
|
return;
|
|
38023
|
-
const thresholds = activeDeps?.thresholdsMs ?? DEFAULT_THRESHOLDS;
|
|
38024
|
-
if (s.lastPokeFiredAt != null && now - s.lastPokeFiredAt <= thresholds.pokeSuccessWindowMs && activeDeps != null && s.pokesFired >= 1 && s.pokesFired <= 2) {
|
|
38025
|
-
activeDeps.emitMetric({
|
|
38026
|
-
kind: "silence_poke_succeeded",
|
|
38027
|
-
key,
|
|
38028
|
-
level: s.pokesFired === 1 ? "soft" : "firm",
|
|
38029
|
-
latency_ms: now - s.lastPokeFiredAt
|
|
38030
|
-
});
|
|
38031
|
-
}
|
|
38032
38066
|
s.lastOutboundAt = now;
|
|
38033
|
-
s.pokesFired = 0;
|
|
38034
|
-
s.pokeArmed = null;
|
|
38035
|
-
s.lastPokeFiredAt = null;
|
|
38036
38067
|
s.fallbackFired = false;
|
|
38037
38068
|
}
|
|
38038
|
-
function noteSubagentDispatch(key) {
|
|
38039
|
-
const s = state2.get(key);
|
|
38040
|
-
if (s == null)
|
|
38041
|
-
return;
|
|
38042
|
-
s.subagentDispatchActive = true;
|
|
38043
|
-
}
|
|
38044
38069
|
function noteThinking(key, now) {
|
|
38045
38070
|
const s = state2.get(key);
|
|
38046
38071
|
if (s == null)
|
|
@@ -38059,28 +38084,9 @@ function noteToolEnd(key, toolUseId, _now) {
|
|
|
38059
38084
|
return;
|
|
38060
38085
|
s.inFlightTools.delete(toolUseId);
|
|
38061
38086
|
}
|
|
38062
|
-
function consumeArmedPoke() {
|
|
38063
|
-
for (const s of state2.values()) {
|
|
38064
|
-
if (s.pokeArmed != null) {
|
|
38065
|
-
const level = s.pokeArmed.level;
|
|
38066
|
-
s.pokeArmed = null;
|
|
38067
|
-
return formatPokeText(level);
|
|
38068
|
-
}
|
|
38069
|
-
}
|
|
38070
|
-
return null;
|
|
38071
|
-
}
|
|
38072
38087
|
function endTurn(key) {
|
|
38073
38088
|
state2.delete(key);
|
|
38074
38089
|
}
|
|
38075
|
-
function formatPokeText(level) {
|
|
38076
|
-
if (level === "ack") {
|
|
38077
|
-
return "[silence-poke] You haven't sent the user anything yet this turn \u2014 " + "they are looking at a silent chat. Send a short, human one-line " + 'acknowledgement now via `reply` (e.g. "on it \u2014 checking"), in your ' + "persona's voice, before you do any more work. A good colleague " + "answers in a beat; don't leave the message hanging while you think. " + "If the full answer is genuinely seconds away, send that instead.";
|
|
38078
|
-
}
|
|
38079
|
-
if (level === "soft") {
|
|
38080
|
-
return "[silence-poke] You've been silent to the user for 75s. If you're " + "still working on this, send one short conversational reply \u2014 e.g. " + `"still going, working through X" \u2014 so they know you're alive. ` + "Keep it brief; don't restate the task. If you're about to finish " + "within the next few seconds, skip the update.";
|
|
38081
|
-
}
|
|
38082
|
-
return "[silence-poke] 3 minutes silent. Please send an update now \u2014 what " + "you're working on, or whether you're stuck. If something is taking " + "unusually long (slow tool, network, waiting on a sub-agent), say so " + "explicitly.";
|
|
38083
|
-
}
|
|
38084
38090
|
function formatFrameworkFallbackText(fallbackKind, silenceMs, inFlightTools = []) {
|
|
38085
38091
|
const minutes = Math.max(1, Math.round(silenceMs / 60000));
|
|
38086
38092
|
const suffix = `(no update from agent in ${minutes} min)`;
|
|
@@ -38119,85 +38125,8 @@ function tick(now) {
|
|
|
38119
38125
|
const silence = now - zeroAt;
|
|
38120
38126
|
if (silence < 0)
|
|
38121
38127
|
continue;
|
|
38122
|
-
|
|
38123
|
-
if (!s.ackPokeFired && s.lastOutboundAt == null && s.pokesFired === 0 && silence >= thresholds.ack) {
|
|
38124
|
-
s.pokeArmed = { level: "ack" };
|
|
38125
|
-
s.ackPokeFired = true;
|
|
38126
|
-
s.lastPokeFiredAt = now;
|
|
38127
|
-
activeDeps.emitMetric({
|
|
38128
|
-
kind: "silence_poke_fired",
|
|
38129
|
-
key,
|
|
38130
|
-
level: "ack",
|
|
38131
|
-
silence_ms: silence,
|
|
38132
|
-
subagent_wait: s.subagentDispatchActive
|
|
38133
|
-
});
|
|
38134
|
-
continue;
|
|
38135
|
-
}
|
|
38136
|
-
if (!s.awarenessPingFired && s.lastOutboundAt == null && !s.subagentDispatchActive && silence >= thresholds.awarenessPing) {
|
|
38137
|
-
s.awarenessPingFired = true;
|
|
38138
|
-
const { chatId, threadId } = parseKey(key);
|
|
38139
|
-
const recentThinking = s.lastThinkingAt != null && now - s.lastThinkingAt < 30000;
|
|
38140
|
-
const fallbackKind = recentThinking ? "thinking" : "working";
|
|
38141
|
-
const inFlightTools = Array.from(s.inFlightTools.values()).sort((a, b) => a.startedAt - b.startedAt).map((t) => ({
|
|
38142
|
-
name: t.name,
|
|
38143
|
-
label: t.label,
|
|
38144
|
-
durationMs: now - t.startedAt
|
|
38145
|
-
}));
|
|
38146
|
-
activeDeps.emitMetric({
|
|
38147
|
-
kind: "awareness_ping_sent",
|
|
38148
|
-
key,
|
|
38149
|
-
fallback_kind: fallbackKind,
|
|
38150
|
-
silence_ms: silence
|
|
38151
|
-
});
|
|
38152
|
-
try {
|
|
38153
|
-
const ret = activeDeps.onAwarenessPing({
|
|
38154
|
-
key,
|
|
38155
|
-
chatId,
|
|
38156
|
-
threadId,
|
|
38157
|
-
fallbackKind,
|
|
38158
|
-
silenceMs: silence,
|
|
38159
|
-
inFlightTools
|
|
38160
|
-
});
|
|
38161
|
-
if (ret != null && typeof ret.then === "function") {
|
|
38162
|
-
ret.catch((err) => {
|
|
38163
|
-
process.stderr.write(`silence-poke: awareness-ping handler rejected: ${err}
|
|
38164
|
-
`);
|
|
38165
|
-
});
|
|
38166
|
-
}
|
|
38167
|
-
} catch (err) {
|
|
38168
|
-
process.stderr.write(`silence-poke: awareness-ping handler threw: ${err}
|
|
38169
|
-
`);
|
|
38170
|
-
}
|
|
38171
|
-
}
|
|
38172
|
-
if (s.pokesFired === 0 && silence >= softThreshold) {
|
|
38173
|
-
s.pokeArmed = { level: "soft" };
|
|
38174
|
-
s.pokesFired = 1;
|
|
38175
|
-
s.lastPokeFiredAt = now;
|
|
38176
|
-
activeDeps.emitMetric({
|
|
38177
|
-
kind: "silence_poke_fired",
|
|
38178
|
-
key,
|
|
38179
|
-
level: "soft",
|
|
38180
|
-
silence_ms: silence,
|
|
38181
|
-
subagent_wait: s.subagentDispatchActive
|
|
38182
|
-
});
|
|
38183
|
-
continue;
|
|
38184
|
-
}
|
|
38185
|
-
if (s.pokesFired === 1 && silence >= thresholds.firm) {
|
|
38186
|
-
s.pokeArmed = { level: "firm" };
|
|
38187
|
-
s.pokesFired = 2;
|
|
38188
|
-
s.lastPokeFiredAt = now;
|
|
38189
|
-
activeDeps.emitMetric({
|
|
38190
|
-
kind: "silence_poke_fired",
|
|
38191
|
-
key,
|
|
38192
|
-
level: "firm",
|
|
38193
|
-
silence_ms: silence,
|
|
38194
|
-
subagent_wait: s.subagentDispatchActive
|
|
38195
|
-
});
|
|
38196
|
-
continue;
|
|
38197
|
-
}
|
|
38198
|
-
if (s.pokesFired === 2 && !s.fallbackFired && silence >= thresholds.fallback) {
|
|
38128
|
+
if (!s.fallbackFired && silence >= thresholds.fallback) {
|
|
38199
38129
|
s.fallbackFired = true;
|
|
38200
|
-
s.pokesFired = 3;
|
|
38201
38130
|
const { chatId, threadId } = parseKey(key);
|
|
38202
38131
|
const recentThinking = s.lastThinkingAt != null && now - s.lastThinkingAt < 30000;
|
|
38203
38132
|
const fallbackKind = recentThinking ? "thinking" : "working";
|
|
@@ -44616,8 +44545,643 @@ function shouldSweepChatAtBoot(chatId) {
|
|
|
44616
44545
|
return n < 0;
|
|
44617
44546
|
}
|
|
44618
44547
|
|
|
44548
|
+
// gateway/webhook-ingest-server.ts
|
|
44549
|
+
import net4 from "node:net";
|
|
44550
|
+
import { chmodSync as chmodSync3, existsSync as existsSync21, unlinkSync as unlinkSync5 } from "node:fs";
|
|
44551
|
+
var MAX_REQUEST_BYTES = 1024 * 1024;
|
|
44552
|
+
function fdOf(conn) {
|
|
44553
|
+
const handle = conn._handle;
|
|
44554
|
+
if (!handle || typeof handle.fd !== "number" || handle.fd < 0)
|
|
44555
|
+
return null;
|
|
44556
|
+
return handle.fd;
|
|
44557
|
+
}
|
|
44558
|
+
function startWebhookIngestServer(opts) {
|
|
44559
|
+
const log = opts.log ?? ((s) => process.stderr.write(s));
|
|
44560
|
+
const allowed = new Set(opts.allowedUids);
|
|
44561
|
+
try {
|
|
44562
|
+
if (existsSync21(opts.socketPath))
|
|
44563
|
+
unlinkSync5(opts.socketPath);
|
|
44564
|
+
} catch (err) {
|
|
44565
|
+
log(`webhook-ingest-server: could not unlink stale socket: ${err.message}
|
|
44566
|
+
`);
|
|
44567
|
+
}
|
|
44568
|
+
const server = net4.createServer((conn) => {
|
|
44569
|
+
const fd = fdOf(conn);
|
|
44570
|
+
const cred = fd !== null ? getPeerCred(fd) : null;
|
|
44571
|
+
if (cred === null || !allowed.has(cred.uid)) {
|
|
44572
|
+
log(`webhook-ingest-server: DENY connection uid=${cred?.uid ?? "unknown"} ` + `(allowed=${[...allowed].join(",")})
|
|
44573
|
+
`);
|
|
44574
|
+
conn.destroy();
|
|
44575
|
+
return;
|
|
44576
|
+
}
|
|
44577
|
+
let buf = "";
|
|
44578
|
+
let handled = false;
|
|
44579
|
+
conn.setEncoding("utf8");
|
|
44580
|
+
const reply = (resp) => {
|
|
44581
|
+
if (handled)
|
|
44582
|
+
return;
|
|
44583
|
+
handled = true;
|
|
44584
|
+
try {
|
|
44585
|
+
conn.write(JSON.stringify(resp) + `
|
|
44586
|
+
`);
|
|
44587
|
+
} catch {}
|
|
44588
|
+
conn.end();
|
|
44589
|
+
};
|
|
44590
|
+
conn.on("data", (chunk) => {
|
|
44591
|
+
if (handled)
|
|
44592
|
+
return;
|
|
44593
|
+
buf += chunk;
|
|
44594
|
+
if (buf.length > MAX_REQUEST_BYTES) {
|
|
44595
|
+
reply({ status: "error", error: "request too large" });
|
|
44596
|
+
return;
|
|
44597
|
+
}
|
|
44598
|
+
const nl = buf.indexOf(`
|
|
44599
|
+
`);
|
|
44600
|
+
if (nl === -1)
|
|
44601
|
+
return;
|
|
44602
|
+
const line = buf.slice(0, nl);
|
|
44603
|
+
let req;
|
|
44604
|
+
try {
|
|
44605
|
+
req = JSON.parse(line);
|
|
44606
|
+
} catch {
|
|
44607
|
+
reply({ status: "error", error: "malformed request" });
|
|
44608
|
+
return;
|
|
44609
|
+
}
|
|
44610
|
+
if (!req || typeof req.agent !== "string" || typeof req.source !== "string" || typeof req.event_type !== "string" || typeof req.rendered_text !== "string" || typeof req.payload !== "object" || req.payload === null) {
|
|
44611
|
+
reply({ status: "error", error: "invalid request shape" });
|
|
44612
|
+
return;
|
|
44613
|
+
}
|
|
44614
|
+
Promise.resolve().then(() => opts.onRecord(req)).then((resp) => reply(resp)).catch((err) => {
|
|
44615
|
+
log(`webhook-ingest-server: onRecord threw: ${String(err)}
|
|
44616
|
+
`);
|
|
44617
|
+
reply({ status: "error", error: "internal error" });
|
|
44618
|
+
});
|
|
44619
|
+
});
|
|
44620
|
+
conn.on("error", (err) => {
|
|
44621
|
+
log(`webhook-ingest-server: conn error: ${err.message}
|
|
44622
|
+
`);
|
|
44623
|
+
});
|
|
44624
|
+
conn.setTimeout(1e4, () => {
|
|
44625
|
+
if (!handled)
|
|
44626
|
+
reply({ status: "error", error: "timeout" });
|
|
44627
|
+
conn.destroy();
|
|
44628
|
+
});
|
|
44629
|
+
});
|
|
44630
|
+
server.on("error", (err) => {
|
|
44631
|
+
log(`webhook-ingest-server: server error: ${err.message}
|
|
44632
|
+
`);
|
|
44633
|
+
});
|
|
44634
|
+
try {
|
|
44635
|
+
server.listen(opts.socketPath, () => {
|
|
44636
|
+
try {
|
|
44637
|
+
chmodSync3(opts.socketPath, 438);
|
|
44638
|
+
} catch (err) {
|
|
44639
|
+
log(`webhook-ingest-server: chmod failed: ${err.message}
|
|
44640
|
+
`);
|
|
44641
|
+
}
|
|
44642
|
+
log(`webhook-ingest-server: listening at ${opts.socketPath} ` + `(allowed uids: ${[...allowed].join(",")})
|
|
44643
|
+
`);
|
|
44644
|
+
});
|
|
44645
|
+
} catch (err) {
|
|
44646
|
+
log(`webhook-ingest-server: listen failed: ${err.message}
|
|
44647
|
+
`);
|
|
44648
|
+
}
|
|
44649
|
+
return {
|
|
44650
|
+
close: () => {
|
|
44651
|
+
try {
|
|
44652
|
+
server.close();
|
|
44653
|
+
} catch {}
|
|
44654
|
+
try {
|
|
44655
|
+
if (existsSync21(opts.socketPath))
|
|
44656
|
+
unlinkSync5(opts.socketPath);
|
|
44657
|
+
} catch {}
|
|
44658
|
+
}
|
|
44659
|
+
};
|
|
44660
|
+
}
|
|
44661
|
+
|
|
44662
|
+
// ../src/web/webhook-gateway-record.ts
|
|
44663
|
+
import { appendFileSync as appendFileSync4, mkdirSync as mkdirSync12 } from "fs";
|
|
44664
|
+
import { join as join20 } from "path";
|
|
44665
|
+
import { homedir as homedir10 } from "os";
|
|
44666
|
+
|
|
44667
|
+
// ../src/web/webhook-handler.ts
|
|
44668
|
+
import { appendFileSync as appendFileSync3, existsSync as existsSync22, mkdirSync as mkdirSync10, readFileSync as readFileSync16, writeFileSync as writeFileSync9 } from "fs";
|
|
44669
|
+
import { join as join18 } from "path";
|
|
44670
|
+
var DEDUP_MAX = 1000;
|
|
44671
|
+
var DEDUP_TTL_MS = 24 * 60 * 60 * 1000;
|
|
44672
|
+
function loadDedupFile(path) {
|
|
44673
|
+
try {
|
|
44674
|
+
if (!existsSync22(path))
|
|
44675
|
+
return {};
|
|
44676
|
+
const raw = JSON.parse(readFileSync16(path, "utf-8"));
|
|
44677
|
+
return typeof raw.deliveries === "object" && raw.deliveries !== null ? raw.deliveries : {};
|
|
44678
|
+
} catch {
|
|
44679
|
+
return {};
|
|
44680
|
+
}
|
|
44681
|
+
}
|
|
44682
|
+
function saveDedupFile(path, deliveries, now) {
|
|
44683
|
+
const pruned = {};
|
|
44684
|
+
for (const [id, ts] of Object.entries(deliveries)) {
|
|
44685
|
+
if (now - ts < DEDUP_TTL_MS)
|
|
44686
|
+
pruned[id] = ts;
|
|
44687
|
+
}
|
|
44688
|
+
const sorted = Object.entries(pruned).sort((a, b) => b[1] - a[1]).slice(0, DEDUP_MAX);
|
|
44689
|
+
const final = Object.fromEntries(sorted);
|
|
44690
|
+
writeFileSync9(path, JSON.stringify({ deliveries: final }), {
|
|
44691
|
+
mode: 384
|
|
44692
|
+
});
|
|
44693
|
+
}
|
|
44694
|
+
var agentDedupCache = new Map;
|
|
44695
|
+
function createFileDedupStore(resolveAgentDir) {
|
|
44696
|
+
return {
|
|
44697
|
+
check(agent, deliveryId, now) {
|
|
44698
|
+
const telegramDir = join18(resolveAgentDir(agent), "telegram");
|
|
44699
|
+
const filePath = join18(telegramDir, "webhook-dedup.json");
|
|
44700
|
+
if (!agentDedupCache.has(agent)) {
|
|
44701
|
+
agentDedupCache.set(agent, loadDedupFile(filePath));
|
|
44702
|
+
}
|
|
44703
|
+
const deliveries = agentDedupCache.get(agent);
|
|
44704
|
+
if (deliveries[deliveryId] !== undefined) {
|
|
44705
|
+
return deliveries[deliveryId];
|
|
44706
|
+
}
|
|
44707
|
+
deliveries[deliveryId] = now;
|
|
44708
|
+
try {
|
|
44709
|
+
mkdirSync10(telegramDir, { recursive: true });
|
|
44710
|
+
saveDedupFile(filePath, deliveries, now);
|
|
44711
|
+
} catch {}
|
|
44712
|
+
return;
|
|
44713
|
+
}
|
|
44714
|
+
};
|
|
44715
|
+
}
|
|
44716
|
+
var tokenBuckets = new Map;
|
|
44717
|
+
var throttleIssueWindow = new Map;
|
|
44718
|
+
|
|
44719
|
+
// ../src/web/webhook-dispatch.ts
|
|
44720
|
+
import { existsSync as existsSync23, mkdirSync as mkdirSync11, readFileSync as readFileSync17, writeFileSync as writeFileSync10 } from "fs";
|
|
44721
|
+
import { join as join19 } from "path";
|
|
44722
|
+
import { homedir as homedir9 } from "os";
|
|
44723
|
+
|
|
44724
|
+
// ../src/agent-scheduler/ipc-client.ts
|
|
44725
|
+
import { createConnection as createConnection2 } from "node:net";
|
|
44726
|
+
function createInjectIpcClient(options) {
|
|
44727
|
+
const {
|
|
44728
|
+
socketPath,
|
|
44729
|
+
reconnectDelayMs = 1000,
|
|
44730
|
+
maxReconnectDelayMs = 30000,
|
|
44731
|
+
connectTimeoutMs = 5000,
|
|
44732
|
+
log = () => {},
|
|
44733
|
+
_connect = (path) => createConnection2(path)
|
|
44734
|
+
} = options;
|
|
44735
|
+
let socket = null;
|
|
44736
|
+
let connected = false;
|
|
44737
|
+
let closed = false;
|
|
44738
|
+
let currentDelay = reconnectDelayMs;
|
|
44739
|
+
let reconnectTimer = null;
|
|
44740
|
+
let connectTimeoutTimer = null;
|
|
44741
|
+
function clearConnectTimeout() {
|
|
44742
|
+
if (connectTimeoutTimer !== null) {
|
|
44743
|
+
clearTimeout(connectTimeoutTimer);
|
|
44744
|
+
connectTimeoutTimer = null;
|
|
44745
|
+
}
|
|
44746
|
+
}
|
|
44747
|
+
function clearReconnectTimer() {
|
|
44748
|
+
if (reconnectTimer !== null) {
|
|
44749
|
+
clearTimeout(reconnectTimer);
|
|
44750
|
+
reconnectTimer = null;
|
|
44751
|
+
}
|
|
44752
|
+
}
|
|
44753
|
+
function scheduleReconnect() {
|
|
44754
|
+
if (closed)
|
|
44755
|
+
return;
|
|
44756
|
+
log(`scheduler ipc: reconnecting in ${currentDelay}ms`);
|
|
44757
|
+
reconnectTimer = setTimeout(() => {
|
|
44758
|
+
reconnectTimer = null;
|
|
44759
|
+
if (!closed)
|
|
44760
|
+
connect2();
|
|
44761
|
+
}, currentDelay);
|
|
44762
|
+
currentDelay = Math.min(currentDelay * 2, maxReconnectDelayMs);
|
|
44763
|
+
}
|
|
44764
|
+
function onClose() {
|
|
44765
|
+
clearConnectTimeout();
|
|
44766
|
+
connected = false;
|
|
44767
|
+
socket = null;
|
|
44768
|
+
if (!closed)
|
|
44769
|
+
scheduleReconnect();
|
|
44770
|
+
}
|
|
44771
|
+
function connect2() {
|
|
44772
|
+
if (closed)
|
|
44773
|
+
return;
|
|
44774
|
+
let s;
|
|
44775
|
+
try {
|
|
44776
|
+
s = _connect(socketPath);
|
|
44777
|
+
} catch (err) {
|
|
44778
|
+
log(`scheduler ipc: connect threw: ${err.message}`);
|
|
44779
|
+
scheduleReconnect();
|
|
44780
|
+
return;
|
|
44781
|
+
}
|
|
44782
|
+
socket = s;
|
|
44783
|
+
connectTimeoutTimer = setTimeout(() => {
|
|
44784
|
+
connectTimeoutTimer = null;
|
|
44785
|
+
if (!connected) {
|
|
44786
|
+
log(`scheduler ipc: connect timeout after ${connectTimeoutMs}ms`);
|
|
44787
|
+
try {
|
|
44788
|
+
s.destroy();
|
|
44789
|
+
} catch {}
|
|
44790
|
+
}
|
|
44791
|
+
}, connectTimeoutMs);
|
|
44792
|
+
s.on("connect", () => {
|
|
44793
|
+
clearConnectTimeout();
|
|
44794
|
+
connected = true;
|
|
44795
|
+
currentDelay = reconnectDelayMs;
|
|
44796
|
+
log(`scheduler ipc: connected to ${socketPath}`);
|
|
44797
|
+
});
|
|
44798
|
+
s.on("close", () => onClose());
|
|
44799
|
+
s.on("error", (err) => {
|
|
44800
|
+
log(`scheduler ipc: socket error: ${err.message}`);
|
|
44801
|
+
});
|
|
44802
|
+
s.on("data", () => {});
|
|
44803
|
+
}
|
|
44804
|
+
setImmediate(connect2);
|
|
44805
|
+
return {
|
|
44806
|
+
sendInjectInbound(msg) {
|
|
44807
|
+
if (!socket || !connected)
|
|
44808
|
+
return false;
|
|
44809
|
+
try {
|
|
44810
|
+
return socket.write(JSON.stringify(msg) + `
|
|
44811
|
+
`);
|
|
44812
|
+
} catch (err) {
|
|
44813
|
+
log(`scheduler ipc: write failed: ${err.message}`);
|
|
44814
|
+
return false;
|
|
44815
|
+
}
|
|
44816
|
+
},
|
|
44817
|
+
isConnected() {
|
|
44818
|
+
return connected;
|
|
44819
|
+
},
|
|
44820
|
+
waitForConnect(timeoutMs) {
|
|
44821
|
+
if (connected)
|
|
44822
|
+
return Promise.resolve(true);
|
|
44823
|
+
if (closed)
|
|
44824
|
+
return Promise.resolve(false);
|
|
44825
|
+
return new Promise((resolve6) => {
|
|
44826
|
+
const start = Date.now();
|
|
44827
|
+
const timer3 = setInterval(() => {
|
|
44828
|
+
if (connected) {
|
|
44829
|
+
clearInterval(timer3);
|
|
44830
|
+
resolve6(true);
|
|
44831
|
+
return;
|
|
44832
|
+
}
|
|
44833
|
+
if (closed || Date.now() - start >= timeoutMs) {
|
|
44834
|
+
clearInterval(timer3);
|
|
44835
|
+
resolve6(connected);
|
|
44836
|
+
}
|
|
44837
|
+
}, 50);
|
|
44838
|
+
if (typeof timer3.unref === "function") {
|
|
44839
|
+
timer3.unref();
|
|
44840
|
+
}
|
|
44841
|
+
});
|
|
44842
|
+
},
|
|
44843
|
+
close() {
|
|
44844
|
+
closed = true;
|
|
44845
|
+
clearReconnectTimer();
|
|
44846
|
+
clearConnectTimeout();
|
|
44847
|
+
if (socket) {
|
|
44848
|
+
try {
|
|
44849
|
+
socket.end();
|
|
44850
|
+
} catch {}
|
|
44851
|
+
socket = null;
|
|
44852
|
+
}
|
|
44853
|
+
connected = false;
|
|
44854
|
+
}
|
|
44855
|
+
};
|
|
44856
|
+
}
|
|
44857
|
+
|
|
44858
|
+
// ../src/web/webhook-dispatch.ts
|
|
44859
|
+
function renderTemplate(template, ctx) {
|
|
44860
|
+
return template.replace(/\{\{(\w+)\}\}/g, (_, key) => ctx[key] ?? "");
|
|
44861
|
+
}
|
|
44862
|
+
function buildGithubContext(eventType, payload) {
|
|
44863
|
+
const repo = payload.repository?.full_name ?? "";
|
|
44864
|
+
const pr = payload.pull_request;
|
|
44865
|
+
const issue = payload.issue;
|
|
44866
|
+
const obj = pr ?? issue;
|
|
44867
|
+
const number = String(payload.number ?? obj?.number ?? "");
|
|
44868
|
+
const firstCommit = payload.commits?.[0];
|
|
44869
|
+
const title = String(obj?.title ?? firstCommit?.message ?? "");
|
|
44870
|
+
const html_url = String(obj?.html_url ?? payload.html_url ?? "");
|
|
44871
|
+
const author = String(obj?.user?.login ?? payload.sender?.login ?? "");
|
|
44872
|
+
const rawLabels = obj?.labels ?? [];
|
|
44873
|
+
const labels = rawLabels.map((l) => String(l.name ?? "")).join(", ");
|
|
44874
|
+
const action = String(payload.action ?? "");
|
|
44875
|
+
return { repo, number, title, html_url, author, labels, action, event: eventType };
|
|
44876
|
+
}
|
|
44877
|
+
function matchesRule(eventType, payload, matcher) {
|
|
44878
|
+
if (matcher.event !== eventType)
|
|
44879
|
+
return false;
|
|
44880
|
+
const ctx = buildGithubContext(eventType, payload);
|
|
44881
|
+
if (matcher.actions && matcher.actions.length > 0) {
|
|
44882
|
+
if (!matcher.actions.includes(ctx.action))
|
|
44883
|
+
return false;
|
|
44884
|
+
}
|
|
44885
|
+
if (matcher.exclude_authors && matcher.exclude_authors.length > 0) {
|
|
44886
|
+
if (matcher.exclude_authors.includes(ctx.author))
|
|
44887
|
+
return false;
|
|
44888
|
+
}
|
|
44889
|
+
if (matcher.labels_any && matcher.labels_any.length > 0) {
|
|
44890
|
+
const pr = payload.pull_request;
|
|
44891
|
+
const issue = payload.issue;
|
|
44892
|
+
const rawLabels = (pr ?? issue)?.labels ?? [];
|
|
44893
|
+
const labelNames = new Set(rawLabels.map((l) => String(l.name ?? "")));
|
|
44894
|
+
const hasAny = matcher.labels_any.some((l) => labelNames.has(l));
|
|
44895
|
+
if (!hasAny)
|
|
44896
|
+
return false;
|
|
44897
|
+
}
|
|
44898
|
+
if (matcher.labels_all && matcher.labels_all.length > 0) {
|
|
44899
|
+
const pr = payload.pull_request;
|
|
44900
|
+
const issue = payload.issue;
|
|
44901
|
+
const rawLabels = (pr ?? issue)?.labels ?? [];
|
|
44902
|
+
const labelNames = new Set(rawLabels.map((l) => String(l.name ?? "")));
|
|
44903
|
+
const hasAll = matcher.labels_all.every((l) => labelNames.has(l));
|
|
44904
|
+
if (!hasAll)
|
|
44905
|
+
return false;
|
|
44906
|
+
}
|
|
44907
|
+
return true;
|
|
44908
|
+
}
|
|
44909
|
+
function parseDurationMs(d) {
|
|
44910
|
+
const m = d.trim().match(/^(\d+)(s|m|h|d)?$/);
|
|
44911
|
+
if (!m)
|
|
44912
|
+
return 0;
|
|
44913
|
+
const n = parseInt(m[1], 10);
|
|
44914
|
+
switch (m[2]) {
|
|
44915
|
+
case "s":
|
|
44916
|
+
return n * 1000;
|
|
44917
|
+
case "m":
|
|
44918
|
+
return n * 60000;
|
|
44919
|
+
case "h":
|
|
44920
|
+
return n * 3600000;
|
|
44921
|
+
case "d":
|
|
44922
|
+
return n * 86400000;
|
|
44923
|
+
default:
|
|
44924
|
+
return n;
|
|
44925
|
+
}
|
|
44926
|
+
}
|
|
44927
|
+
function cooldownKey(eventType, repo, number, ruleIndex) {
|
|
44928
|
+
return `${eventType}:${repo}:${number}:${ruleIndex}`;
|
|
44929
|
+
}
|
|
44930
|
+
function loadCooldownFile(path) {
|
|
44931
|
+
try {
|
|
44932
|
+
if (!existsSync23(path))
|
|
44933
|
+
return {};
|
|
44934
|
+
const raw = JSON.parse(readFileSync17(path, "utf-8"));
|
|
44935
|
+
return typeof raw.dispatches === "object" && raw.dispatches !== null ? raw.dispatches : {};
|
|
44936
|
+
} catch {
|
|
44937
|
+
return {};
|
|
44938
|
+
}
|
|
44939
|
+
}
|
|
44940
|
+
function saveCooldownFile(path, dispatches) {
|
|
44941
|
+
try {
|
|
44942
|
+
writeFileSync10(path, JSON.stringify({ dispatches }), {
|
|
44943
|
+
mode: 384
|
|
44944
|
+
});
|
|
44945
|
+
} catch {}
|
|
44946
|
+
}
|
|
44947
|
+
function createFileCooldownStore(resolveAgentDir) {
|
|
44948
|
+
const cache = new Map;
|
|
44949
|
+
return {
|
|
44950
|
+
isCoolingDown(agent, key, cooldownMs, now) {
|
|
44951
|
+
if (cooldownMs <= 0)
|
|
44952
|
+
return false;
|
|
44953
|
+
const telegramDir = join19(resolveAgentDir(agent), "telegram");
|
|
44954
|
+
const filePath = join19(telegramDir, "webhook-cooldown.json");
|
|
44955
|
+
if (!cache.has(agent)) {
|
|
44956
|
+
cache.set(agent, loadCooldownFile(filePath));
|
|
44957
|
+
}
|
|
44958
|
+
const dispatches = cache.get(agent);
|
|
44959
|
+
const lastDispatch = dispatches[key];
|
|
44960
|
+
if (lastDispatch !== undefined && now - lastDispatch < cooldownMs) {
|
|
44961
|
+
return true;
|
|
44962
|
+
}
|
|
44963
|
+
dispatches[key] = now;
|
|
44964
|
+
try {
|
|
44965
|
+
mkdirSync11(telegramDir, { recursive: true });
|
|
44966
|
+
saveCooldownFile(filePath, dispatches);
|
|
44967
|
+
} catch {}
|
|
44968
|
+
return false;
|
|
44969
|
+
}
|
|
44970
|
+
};
|
|
44971
|
+
}
|
|
44972
|
+
function isQuietHour(qh, now) {
|
|
44973
|
+
const tz = qh.tz ?? "UTC";
|
|
44974
|
+
let hour;
|
|
44975
|
+
try {
|
|
44976
|
+
const formatter = new Intl.DateTimeFormat("en-US", {
|
|
44977
|
+
timeZone: tz,
|
|
44978
|
+
hour: "numeric",
|
|
44979
|
+
hour12: false
|
|
44980
|
+
});
|
|
44981
|
+
const parts = formatter.formatToParts(now);
|
|
44982
|
+
const hourPart = parts.find((p) => p.type === "hour");
|
|
44983
|
+
hour = parseInt(hourPart?.value ?? "0", 10);
|
|
44984
|
+
} catch {
|
|
44985
|
+
hour = now.getUTCHours();
|
|
44986
|
+
}
|
|
44987
|
+
const { start, end } = qh;
|
|
44988
|
+
if (start < end) {
|
|
44989
|
+
return hour >= start && hour < end;
|
|
44990
|
+
} else {
|
|
44991
|
+
return hour >= start || hour < end;
|
|
44992
|
+
}
|
|
44993
|
+
}
|
|
44994
|
+
async function defaultInject(socketPath, agentName3, inbound) {
|
|
44995
|
+
const client3 = createInjectIpcClient({ socketPath });
|
|
44996
|
+
try {
|
|
44997
|
+
const connected = await client3.waitForConnect(5000);
|
|
44998
|
+
if (!connected)
|
|
44999
|
+
return false;
|
|
45000
|
+
return client3.sendInjectInbound({
|
|
45001
|
+
type: "inject_inbound",
|
|
45002
|
+
agentName: agentName3,
|
|
45003
|
+
inbound
|
|
45004
|
+
});
|
|
45005
|
+
} finally {
|
|
45006
|
+
client3.close();
|
|
45007
|
+
}
|
|
45008
|
+
}
|
|
45009
|
+
function injectWebhookInbound(agent, prompt, ctx, deps = {}) {
|
|
45010
|
+
const log = deps.log ?? ((s) => process.stderr.write(s));
|
|
45011
|
+
const resolveAgentDir = deps.resolveAgentDir ?? ((a) => join19(homedir9(), ".switchroom", "agents", a));
|
|
45012
|
+
const now = (deps.now ?? Date.now)();
|
|
45013
|
+
const socketPath = join19(resolveAgentDir(agent), "telegram", "gateway.sock");
|
|
45014
|
+
const inbound = {
|
|
45015
|
+
type: "inbound",
|
|
45016
|
+
chatId: ctx.chatId,
|
|
45017
|
+
...ctx.threadId !== undefined ? { threadId: ctx.threadId } : {},
|
|
45018
|
+
messageId: now,
|
|
45019
|
+
user: "webhook",
|
|
45020
|
+
userId: 0,
|
|
45021
|
+
ts: now,
|
|
45022
|
+
text: prompt,
|
|
45023
|
+
meta: {
|
|
45024
|
+
source: "webhook",
|
|
45025
|
+
event: ctx.eventType,
|
|
45026
|
+
rule_index: String(ctx.ruleIndex)
|
|
45027
|
+
}
|
|
45028
|
+
};
|
|
45029
|
+
const injectFn = deps.injectFn ?? defaultInject;
|
|
45030
|
+
injectFn(socketPath, agent, inbound).then((ok) => log(`webhook-dispatch: agent='${agent}' inject_inbound ` + `${ok ? "delivered to gateway" : "not delivered (gateway not connected)"}
|
|
45031
|
+
`)).catch((err) => log(`webhook-dispatch: agent='${agent}' inject failed: ${String(err)}
|
|
45032
|
+
`));
|
|
45033
|
+
}
|
|
45034
|
+
function evaluateDispatch(args, deps = {}) {
|
|
45035
|
+
const log = deps.log ?? ((s) => process.stderr.write(s));
|
|
45036
|
+
const now = (deps.now ?? Date.now)();
|
|
45037
|
+
const nowDate = deps.nowDate ?? (() => new Date(now));
|
|
45038
|
+
const resolveAgentDir = deps.resolveAgentDir ?? ((a) => join19(homedir9(), ".switchroom", "agents", a));
|
|
45039
|
+
const cooldownStore = deps.cooldownStore ?? createFileCooldownStore(resolveAgentDir);
|
|
45040
|
+
if (args.source !== "github")
|
|
45041
|
+
return 0;
|
|
45042
|
+
const rules = args.dispatchConfig.github;
|
|
45043
|
+
if (!rules || rules.length === 0)
|
|
45044
|
+
return 0;
|
|
45045
|
+
const ctx = buildGithubContext(args.eventType, args.payload);
|
|
45046
|
+
let fired = 0;
|
|
45047
|
+
for (let i = 0;i < rules.length; i++) {
|
|
45048
|
+
const rule = rules[i];
|
|
45049
|
+
if (!matchesRule(args.eventType, args.payload, rule.match))
|
|
45050
|
+
continue;
|
|
45051
|
+
if (rule.quiet_hours && isQuietHour(rule.quiet_hours, nowDate())) {
|
|
45052
|
+
log(`webhook-dispatch: agent='${args.agent}' rule=${i} skipped (quiet hours)
|
|
45053
|
+
`);
|
|
45054
|
+
continue;
|
|
45055
|
+
}
|
|
45056
|
+
const cooldownMs = rule.cooldown ? parseDurationMs(rule.cooldown) : 0;
|
|
45057
|
+
if (cooldownMs > 0) {
|
|
45058
|
+
const ck = cooldownKey(args.eventType, ctx.repo, ctx.number, i);
|
|
45059
|
+
if (cooldownStore.isCoolingDown(args.agent, ck, cooldownMs, now)) {
|
|
45060
|
+
log(`webhook-dispatch: agent='${args.agent}' rule=${i} skipped (cooldown)
|
|
45061
|
+
`);
|
|
45062
|
+
continue;
|
|
45063
|
+
}
|
|
45064
|
+
}
|
|
45065
|
+
const prompt = renderTemplate(rule.prompt, ctx);
|
|
45066
|
+
log(`webhook-dispatch: agent='${args.agent}' rule=${i} matched event='${args.eventType}' action='${ctx.action}' firing
|
|
45067
|
+
`);
|
|
45068
|
+
injectWebhookInbound(args.agent, prompt, {
|
|
45069
|
+
chatId: args.chatId,
|
|
45070
|
+
...args.threadId !== undefined ? { threadId: args.threadId } : {},
|
|
45071
|
+
eventType: args.eventType,
|
|
45072
|
+
ruleIndex: i
|
|
45073
|
+
}, { ...deps, resolveAgentDir });
|
|
45074
|
+
fired++;
|
|
45075
|
+
}
|
|
45076
|
+
return fired;
|
|
45077
|
+
}
|
|
45078
|
+
|
|
45079
|
+
// ../src/web/webhook-gateway-record.ts
|
|
45080
|
+
init_loader();
|
|
45081
|
+
init_merge();
|
|
45082
|
+
|
|
45083
|
+
// ../src/agent-scheduler/channel-target.ts
|
|
45084
|
+
init_merge();
|
|
45085
|
+
function resolveChannelTarget(config, agentName3) {
|
|
45086
|
+
const agent = config.agents?.[agentName3];
|
|
45087
|
+
const tgChannel = agent ? resolveAgentConfig(config.defaults, config.profiles, agent).channels?.telegram : undefined;
|
|
45088
|
+
const supergroupChatId = tgChannel?.chat_id;
|
|
45089
|
+
const supergroupDefaultTopic = tgChannel?.default_topic_id;
|
|
45090
|
+
if (typeof supergroupChatId === "string" && supergroupChatId.length > 0) {
|
|
45091
|
+
return {
|
|
45092
|
+
chatId: supergroupChatId,
|
|
45093
|
+
...typeof supergroupDefaultTopic === "number" ? { threadId: supergroupDefaultTopic } : {},
|
|
45094
|
+
routerConfig: {
|
|
45095
|
+
...typeof supergroupDefaultTopic === "number" ? { default_topic_id: supergroupDefaultTopic } : {},
|
|
45096
|
+
...tgChannel?.topic_aliases ? { topic_aliases: tgChannel.topic_aliases } : {}
|
|
45097
|
+
}
|
|
45098
|
+
};
|
|
45099
|
+
}
|
|
45100
|
+
const forumChatId = config.telegram?.forum_chat_id;
|
|
45101
|
+
if (typeof forumChatId !== "string" || forumChatId.length === 0)
|
|
45102
|
+
return null;
|
|
45103
|
+
const threadId = agent?.topic_id;
|
|
45104
|
+
return {
|
|
45105
|
+
chatId: forumChatId,
|
|
45106
|
+
...typeof threadId === "number" ? { threadId } : {}
|
|
45107
|
+
};
|
|
45108
|
+
}
|
|
45109
|
+
|
|
45110
|
+
// ../src/web/webhook-gateway-record.ts
|
|
45111
|
+
function recordWebhookEvent(rec, deps = {}) {
|
|
45112
|
+
const log = deps.log ?? ((s) => process.stderr.write(s));
|
|
45113
|
+
const now = rec.ts || (deps.now ?? Date.now)();
|
|
45114
|
+
const resolveAgentDir = deps.resolveAgentDir ?? ((a) => join20(homedir10(), ".switchroom", "agents", a));
|
|
45115
|
+
const dedupStore = deps.dedupStore ?? createFileDedupStore(resolveAgentDir);
|
|
45116
|
+
const agent = rec.agent;
|
|
45117
|
+
const telegramDir = join20(resolveAgentDir(agent), "telegram");
|
|
45118
|
+
if (rec.source === "github" && rec.delivery_id) {
|
|
45119
|
+
const originalTs = dedupStore.check(agent, rec.delivery_id, now);
|
|
45120
|
+
if (originalTs !== undefined) {
|
|
45121
|
+
log(`webhook-gateway: agent='${agent}' source='${rec.source}' deduped delivery='${rec.delivery_id}'
|
|
45122
|
+
`);
|
|
45123
|
+
return { status: "deduped", ts: originalTs };
|
|
45124
|
+
}
|
|
45125
|
+
}
|
|
45126
|
+
const logPath = join20(telegramDir, "webhook-events.jsonl");
|
|
45127
|
+
try {
|
|
45128
|
+
mkdirSync12(telegramDir, { recursive: true });
|
|
45129
|
+
const record = {
|
|
45130
|
+
ts: now,
|
|
45131
|
+
source: rec.source,
|
|
45132
|
+
event_type: rec.event_type,
|
|
45133
|
+
rendered_text: rec.rendered_text,
|
|
45134
|
+
payload: rec.payload
|
|
45135
|
+
};
|
|
45136
|
+
appendFileSync4(logPath, JSON.stringify(record) + `
|
|
45137
|
+
`, { mode: 384 });
|
|
45138
|
+
} catch (err) {
|
|
45139
|
+
log(`webhook-gateway: agent='${agent}' source='${rec.source}' write failed: ${err.message}
|
|
45140
|
+
`);
|
|
45141
|
+
return { status: "error", error: "write failed" };
|
|
45142
|
+
}
|
|
45143
|
+
log(`webhook-gateway: agent='${agent}' source='${rec.source}' event='${rec.event_type}' recorded ts=${now}
|
|
45144
|
+
`);
|
|
45145
|
+
let dispatched = 0;
|
|
45146
|
+
try {
|
|
45147
|
+
const config = (deps.loadConfig ?? loadConfig)();
|
|
45148
|
+
const rawAgent = config.agents?.[agent];
|
|
45149
|
+
const dispatchConfig = rawAgent ? resolveAgentConfig(config.defaults, config.profiles, rawAgent).channels?.telegram?.webhook_dispatch : undefined;
|
|
45150
|
+
if (dispatchConfig && rec.source === "github") {
|
|
45151
|
+
const target = resolveChannelTarget(config, agent);
|
|
45152
|
+
if (!target) {
|
|
45153
|
+
log(`webhook-gateway: agent='${agent}' dispatch skipped \u2014 no chat target (forum_chat_id / chat_id unset)
|
|
45154
|
+
`);
|
|
45155
|
+
} else {
|
|
45156
|
+
const injectFn = deps.inject;
|
|
45157
|
+
dispatched = evaluateDispatch({
|
|
45158
|
+
agent,
|
|
45159
|
+
source: rec.source,
|
|
45160
|
+
eventType: rec.event_type,
|
|
45161
|
+
payload: rec.payload,
|
|
45162
|
+
dispatchConfig,
|
|
45163
|
+
chatId: target.chatId,
|
|
45164
|
+
...target.threadId !== undefined ? { threadId: target.threadId } : {}
|
|
45165
|
+
}, {
|
|
45166
|
+
now: () => now,
|
|
45167
|
+
resolveAgentDir,
|
|
45168
|
+
log,
|
|
45169
|
+
...deps.cooldownStore ? { cooldownStore: deps.cooldownStore } : {},
|
|
45170
|
+
...injectFn ? {
|
|
45171
|
+
injectFn: async (_socketPath, agentName3, inbound) => injectFn(agentName3, inbound)
|
|
45172
|
+
} : {}
|
|
45173
|
+
});
|
|
45174
|
+
}
|
|
45175
|
+
}
|
|
45176
|
+
} catch (err) {
|
|
45177
|
+
log(`webhook-gateway: agent='${agent}' dispatch error (event recorded): ${err.message}
|
|
45178
|
+
`);
|
|
45179
|
+
}
|
|
45180
|
+
return { status: "ok", ts: now, dispatched };
|
|
45181
|
+
}
|
|
45182
|
+
|
|
44619
45183
|
// gateway/ipc-server.ts
|
|
44620
|
-
import { renameSync as renameSync5, unlinkSync as
|
|
45184
|
+
import { renameSync as renameSync5, unlinkSync as unlinkSync6 } from "fs";
|
|
44621
45185
|
var MAX_BUFFER_SIZE = 1024 * 1024;
|
|
44622
45186
|
var VALID_OPERATOR_KINDS = new Set([
|
|
44623
45187
|
"credentials-expired",
|
|
@@ -44735,7 +45299,7 @@ function createIpcServer(options) {
|
|
|
44735
45299
|
renameSync5(socketPath, socketPath + ".bak");
|
|
44736
45300
|
} catch {}
|
|
44737
45301
|
try {
|
|
44738
|
-
|
|
45302
|
+
unlinkSync6(socketPath + ".bak");
|
|
44739
45303
|
} catch {}
|
|
44740
45304
|
const clients = new Set;
|
|
44741
45305
|
const agentIndex = new Map;
|
|
@@ -46805,15 +47369,15 @@ function escapeBody(s) {
|
|
|
46805
47369
|
}
|
|
46806
47370
|
|
|
46807
47371
|
// gateway/pid-file.ts
|
|
46808
|
-
import { writeFileSync as
|
|
47372
|
+
import { writeFileSync as writeFileSync11, readFileSync as readFileSync18, unlinkSync as unlinkSync7, renameSync as renameSync6 } from "node:fs";
|
|
46809
47373
|
function writePidFile(path, record) {
|
|
46810
47374
|
const tmp = `${path}.tmp-${process.pid}-${Date.now()}`;
|
|
46811
|
-
|
|
47375
|
+
writeFileSync11(tmp, JSON.stringify(record), "utf-8");
|
|
46812
47376
|
renameSync6(tmp, path);
|
|
46813
47377
|
}
|
|
46814
47378
|
function clearPidFile(path) {
|
|
46815
47379
|
try {
|
|
46816
|
-
|
|
47380
|
+
unlinkSync7(path);
|
|
46817
47381
|
} catch {}
|
|
46818
47382
|
}
|
|
46819
47383
|
|
|
@@ -46824,10 +47388,10 @@ import {
|
|
|
46824
47388
|
writeFile as writeFileAsync,
|
|
46825
47389
|
readFile as readFileAsync
|
|
46826
47390
|
} from "node:fs/promises";
|
|
46827
|
-
import { readFileSync as
|
|
47391
|
+
import { readFileSync as readFileSync19 } from "node:fs";
|
|
46828
47392
|
function readCurrentBootId() {
|
|
46829
47393
|
try {
|
|
46830
|
-
const stat =
|
|
47394
|
+
const stat = readFileSync19("/proc/1/stat", "utf-8");
|
|
46831
47395
|
const lastParen = stat.lastIndexOf(")");
|
|
46832
47396
|
if (lastParen < 0)
|
|
46833
47397
|
return null;
|
|
@@ -47030,15 +47594,15 @@ function safeCount(fn) {
|
|
|
47030
47594
|
}
|
|
47031
47595
|
|
|
47032
47596
|
// gateway/session-marker.ts
|
|
47033
|
-
import { writeFileSync as
|
|
47597
|
+
import { writeFileSync as writeFileSync12, readFileSync as readFileSync20, renameSync as renameSync7, unlinkSync as unlinkSync8 } from "node:fs";
|
|
47034
47598
|
function writeSessionMarker(path, marker) {
|
|
47035
47599
|
const tmp = `${path}.tmp-${process.pid}-${Date.now()}`;
|
|
47036
|
-
|
|
47600
|
+
writeFileSync12(tmp, JSON.stringify(marker), "utf-8");
|
|
47037
47601
|
renameSync7(tmp, path);
|
|
47038
47602
|
}
|
|
47039
47603
|
function readSessionMarker(path) {
|
|
47040
47604
|
try {
|
|
47041
|
-
const raw =
|
|
47605
|
+
const raw = readFileSync20(path, "utf-8");
|
|
47042
47606
|
const parsed = JSON.parse(raw);
|
|
47043
47607
|
if (typeof parsed.pid === "number" && typeof parsed.startedAtMs === "number" && Number.isFinite(parsed.pid) && Number.isFinite(parsed.startedAtMs)) {
|
|
47044
47608
|
return { pid: parsed.pid, startedAtMs: parsed.startedAtMs };
|
|
@@ -47060,16 +47624,16 @@ function shouldFireRestartBanner(input) {
|
|
|
47060
47624
|
}
|
|
47061
47625
|
|
|
47062
47626
|
// gateway/clean-shutdown-marker.ts
|
|
47063
|
-
import { writeFileSync as
|
|
47627
|
+
import { writeFileSync as writeFileSync13, readFileSync as readFileSync21, renameSync as renameSync8, unlinkSync as unlinkSync9 } from "node:fs";
|
|
47064
47628
|
var DEFAULT_MAX_AGE_MS = 60000;
|
|
47065
47629
|
function writeCleanShutdownMarker(path, marker) {
|
|
47066
47630
|
const tmp = `${path}.tmp-${process.pid}-${Date.now()}`;
|
|
47067
|
-
|
|
47631
|
+
writeFileSync13(tmp, JSON.stringify(marker), "utf-8");
|
|
47068
47632
|
renameSync8(tmp, path);
|
|
47069
47633
|
}
|
|
47070
47634
|
function readCleanShutdownMarker(path) {
|
|
47071
47635
|
try {
|
|
47072
|
-
const raw =
|
|
47636
|
+
const raw = readFileSync21(path, "utf-8");
|
|
47073
47637
|
const parsed = JSON.parse(raw);
|
|
47074
47638
|
if (typeof parsed.ts === "number" && Number.isFinite(parsed.ts) && typeof parsed.signal === "string" && parsed.signal.length > 0) {
|
|
47075
47639
|
const out = { ts: parsed.ts, signal: parsed.signal };
|
|
@@ -47084,7 +47648,7 @@ function readCleanShutdownMarker(path) {
|
|
|
47084
47648
|
}
|
|
47085
47649
|
function clearCleanShutdownMarker(path) {
|
|
47086
47650
|
try {
|
|
47087
|
-
|
|
47651
|
+
unlinkSync9(path);
|
|
47088
47652
|
} catch {}
|
|
47089
47653
|
}
|
|
47090
47654
|
function shouldSuppressRecoveryBanner(marker, now, maxAgeMs = DEFAULT_MAX_AGE_MS) {
|
|
@@ -47864,16 +48428,16 @@ function classifyAdminGate(text, myAgentName) {
|
|
|
47864
48428
|
|
|
47865
48429
|
// subagent-watcher.ts
|
|
47866
48430
|
import {
|
|
47867
|
-
existsSync as
|
|
48431
|
+
existsSync as existsSync25,
|
|
47868
48432
|
openSync as openSync2,
|
|
47869
48433
|
readSync,
|
|
47870
48434
|
statSync as statSync6,
|
|
47871
48435
|
closeSync as closeSync2,
|
|
47872
48436
|
watch,
|
|
47873
48437
|
readdirSync as readdirSync3,
|
|
47874
|
-
readFileSync as
|
|
48438
|
+
readFileSync as readFileSync23
|
|
47875
48439
|
} from "fs";
|
|
47876
|
-
import { join as
|
|
48440
|
+
import { join as join22 } from "path";
|
|
47877
48441
|
|
|
47878
48442
|
// operator-events.ts
|
|
47879
48443
|
var DEFAULT_OPERATOR_EVENT_COOLDOWN_MS2 = 5 * 60000;
|
|
@@ -48116,20 +48680,20 @@ function bumpSubagentActivity(db2, args) {
|
|
|
48116
48680
|
// gateway/turn-active-marker.ts
|
|
48117
48681
|
import {
|
|
48118
48682
|
closeSync,
|
|
48119
|
-
existsSync as
|
|
48120
|
-
mkdirSync as
|
|
48683
|
+
existsSync as existsSync24,
|
|
48684
|
+
mkdirSync as mkdirSync13,
|
|
48121
48685
|
openSync,
|
|
48122
|
-
readFileSync as
|
|
48686
|
+
readFileSync as readFileSync22,
|
|
48123
48687
|
statSync as statSync5,
|
|
48124
|
-
unlinkSync as
|
|
48688
|
+
unlinkSync as unlinkSync10,
|
|
48125
48689
|
utimesSync,
|
|
48126
|
-
writeFileSync as
|
|
48690
|
+
writeFileSync as writeFileSync14
|
|
48127
48691
|
} from "node:fs";
|
|
48128
|
-
import { join as
|
|
48692
|
+
import { join as join21 } from "node:path";
|
|
48129
48693
|
var TURN_ACTIVE_MARKER_FILE = "turn-active.json";
|
|
48130
48694
|
function touchTurnActiveMarker(stateDir) {
|
|
48131
|
-
const path =
|
|
48132
|
-
if (!
|
|
48695
|
+
const path = join21(stateDir, TURN_ACTIVE_MARKER_FILE);
|
|
48696
|
+
if (!existsSync24(path))
|
|
48133
48697
|
return;
|
|
48134
48698
|
const now = new Date;
|
|
48135
48699
|
try {
|
|
@@ -48164,7 +48728,7 @@ function backfillJsonlAgentId(db2, jsonlPath, agentId, log) {
|
|
|
48164
48728
|
const metaPath = jsonlPath.replace(/\.jsonl$/, ".meta.json");
|
|
48165
48729
|
let meta;
|
|
48166
48730
|
try {
|
|
48167
|
-
const raw =
|
|
48731
|
+
const raw = readFileSync23(metaPath, "utf8");
|
|
48168
48732
|
meta = JSON.parse(raw);
|
|
48169
48733
|
} catch {
|
|
48170
48734
|
log?.(`subagent-watcher: backfill skip ${agentId} \u2014 meta.json not readable at ${metaPath}`);
|
|
@@ -48351,7 +48915,7 @@ function startSubagentWatcher(config) {
|
|
|
48351
48915
|
clearTimeout(ref.ref);
|
|
48352
48916
|
});
|
|
48353
48917
|
const fs2 = config.fs ?? {
|
|
48354
|
-
existsSync:
|
|
48918
|
+
existsSync: existsSync25,
|
|
48355
48919
|
readdirSync: readdirSync3,
|
|
48356
48920
|
statSync: statSync6,
|
|
48357
48921
|
openSync: openSync2,
|
|
@@ -48585,8 +49149,8 @@ function startSubagentWatcher(config) {
|
|
|
48585
49149
|
function rescanSubagentDirs() {
|
|
48586
49150
|
if (stopped)
|
|
48587
49151
|
return;
|
|
48588
|
-
const claudeHome =
|
|
48589
|
-
const projectsRoot =
|
|
49152
|
+
const claudeHome = join22(agentDir, ".claude");
|
|
49153
|
+
const projectsRoot = join22(claudeHome, "projects");
|
|
48590
49154
|
if (!fs2.existsSync(projectsRoot))
|
|
48591
49155
|
return;
|
|
48592
49156
|
let projectDirs;
|
|
@@ -48603,7 +49167,7 @@ function startSubagentWatcher(config) {
|
|
|
48603
49167
|
}
|
|
48604
49168
|
continue;
|
|
48605
49169
|
}
|
|
48606
|
-
const projectPath =
|
|
49170
|
+
const projectPath = join22(projectsRoot, pDir);
|
|
48607
49171
|
let sessionDirs;
|
|
48608
49172
|
try {
|
|
48609
49173
|
sessionDirs = fs2.readdirSync(projectPath);
|
|
@@ -48613,7 +49177,7 @@ function startSubagentWatcher(config) {
|
|
|
48613
49177
|
for (const sDir of sessionDirs) {
|
|
48614
49178
|
if (sDir.endsWith(".jsonl"))
|
|
48615
49179
|
continue;
|
|
48616
|
-
const subagentsPath =
|
|
49180
|
+
const subagentsPath = join22(projectPath, sDir, "subagents");
|
|
48617
49181
|
if (!fs2.existsSync(subagentsPath))
|
|
48618
49182
|
continue;
|
|
48619
49183
|
if (!dirWatchers.has(subagentsPath)) {
|
|
@@ -48621,7 +49185,7 @@ function startSubagentWatcher(config) {
|
|
|
48621
49185
|
const w = fs2.watch(subagentsPath, (_event, filename) => {
|
|
48622
49186
|
if (!filename || !filename.toString().startsWith("agent-") || !filename.toString().endsWith(".jsonl"))
|
|
48623
49187
|
return;
|
|
48624
|
-
const filePath =
|
|
49188
|
+
const filePath = join22(subagentsPath, filename.toString());
|
|
48625
49189
|
if (!knownFiles.has(filePath)) {
|
|
48626
49190
|
scanSubagentsDir(subagentsPath);
|
|
48627
49191
|
}
|
|
@@ -48646,7 +49210,7 @@ function startSubagentWatcher(config) {
|
|
|
48646
49210
|
for (const e of entries) {
|
|
48647
49211
|
if (!e.startsWith("agent-") || !e.endsWith(".jsonl"))
|
|
48648
49212
|
continue;
|
|
48649
|
-
const filePath =
|
|
49213
|
+
const filePath = join22(subagentsPath, e);
|
|
48650
49214
|
if (knownFiles.has(filePath))
|
|
48651
49215
|
continue;
|
|
48652
49216
|
const agentId = e.slice("agent-".length, -".jsonl".length);
|
|
@@ -48763,15 +49327,15 @@ function determineRestartReason(opts) {
|
|
|
48763
49327
|
init_boot_card();
|
|
48764
49328
|
|
|
48765
49329
|
// gateway/update-announce.ts
|
|
48766
|
-
import { existsSync as
|
|
48767
|
-
import { join as
|
|
48768
|
-
import { homedir as
|
|
49330
|
+
import { existsSync as existsSync30, mkdirSync as mkdirSync17, openSync as openSync3, closeSync as closeSync3, readFileSync as readFileSync28 } from "node:fs";
|
|
49331
|
+
import { join as join27 } from "node:path";
|
|
49332
|
+
import { homedir as homedir12 } from "node:os";
|
|
48769
49333
|
|
|
48770
49334
|
// ../src/host-control/audit-reader.ts
|
|
48771
|
-
import { homedir as
|
|
48772
|
-
import { join as
|
|
48773
|
-
function defaultAuditLogPath(home2 =
|
|
48774
|
-
return
|
|
49335
|
+
import { homedir as homedir11 } from "node:os";
|
|
49336
|
+
import { join as join26 } from "node:path";
|
|
49337
|
+
function defaultAuditLogPath(home2 = homedir11()) {
|
|
49338
|
+
return join26(home2, ".switchroom", "host-control-audit.log");
|
|
48775
49339
|
}
|
|
48776
49340
|
function parseAuditLine(line) {
|
|
48777
49341
|
const trimmed = line.trim();
|
|
@@ -48877,8 +49441,8 @@ function readAndFilter(raw, filters, limit) {
|
|
|
48877
49441
|
var DEFAULT_LOOKBACK_MS = 10 * 60 * 1000;
|
|
48878
49442
|
function readLastTerminalUpdateAudit(opts = {}) {
|
|
48879
49443
|
const path = opts.auditLogPath ?? defaultAuditLogPath();
|
|
48880
|
-
const exists = opts.exists ??
|
|
48881
|
-
const readFile = opts.readFile ?? ((p) =>
|
|
49444
|
+
const exists = opts.exists ?? existsSync30;
|
|
49445
|
+
const readFile = opts.readFile ?? ((p) => readFileSync28(p, "utf-8"));
|
|
48882
49446
|
if (!exists(path))
|
|
48883
49447
|
return null;
|
|
48884
49448
|
let raw;
|
|
@@ -48939,15 +49503,15 @@ function renderUpdateOutcomeLine(entry) {
|
|
|
48939
49503
|
`);
|
|
48940
49504
|
}
|
|
48941
49505
|
function claimUpdateAnnouncement(requestId, opts = {}) {
|
|
48942
|
-
const stateDir = opts.stateDir ?? process.env.TELEGRAM_STATE_DIR ??
|
|
48943
|
-
const dir =
|
|
49506
|
+
const stateDir = opts.stateDir ?? process.env.TELEGRAM_STATE_DIR ?? join27(homedir12(), ".switchroom");
|
|
49507
|
+
const dir = join27(stateDir, "update-announced");
|
|
48944
49508
|
try {
|
|
48945
|
-
|
|
49509
|
+
mkdirSync17(dir, { recursive: true });
|
|
48946
49510
|
} catch {
|
|
48947
49511
|
return false;
|
|
48948
49512
|
}
|
|
48949
49513
|
const safeId = requestId.replace(/[^A-Za-z0-9_.-]/g, "_").slice(0, 200);
|
|
48950
|
-
const path =
|
|
49514
|
+
const path = join27(dir, safeId);
|
|
48951
49515
|
try {
|
|
48952
49516
|
const fd = openSync3(path, "wx");
|
|
48953
49517
|
closeSync3(fd);
|
|
@@ -48966,7 +49530,7 @@ function maybeRenderUpdateAnnouncement(opts = {}) {
|
|
|
48966
49530
|
}
|
|
48967
49531
|
|
|
48968
49532
|
// issues-card.ts
|
|
48969
|
-
import { readFileSync as
|
|
49533
|
+
import { readFileSync as readFileSync29, writeFileSync as writeFileSync18 } from "node:fs";
|
|
48970
49534
|
var SEVERITY_EMOJI = {
|
|
48971
49535
|
info: "\u2139\ufe0f",
|
|
48972
49536
|
warn: "\u26a0\ufe0f",
|
|
@@ -49058,7 +49622,7 @@ function extractRetryAfterSecs(err) {
|
|
|
49058
49622
|
var COOLDOWN_JITTER_MS = 500;
|
|
49059
49623
|
function readPersistedMessageId(path, log) {
|
|
49060
49624
|
try {
|
|
49061
|
-
const raw =
|
|
49625
|
+
const raw = readFileSync29(path, "utf8");
|
|
49062
49626
|
const parsed = JSON.parse(raw);
|
|
49063
49627
|
const v = parsed.messageId;
|
|
49064
49628
|
if (typeof v === "number" && Number.isInteger(v) && v > 0)
|
|
@@ -49074,7 +49638,7 @@ function readPersistedMessageId(path, log) {
|
|
|
49074
49638
|
}
|
|
49075
49639
|
function writePersistedMessageId(path, messageId, log) {
|
|
49076
49640
|
try {
|
|
49077
|
-
|
|
49641
|
+
writeFileSync18(path, JSON.stringify({ messageId }) + `
|
|
49078
49642
|
`, { mode: 384 });
|
|
49079
49643
|
} catch (err) {
|
|
49080
49644
|
log(`issues-card: persist write failed (${err.message})`);
|
|
@@ -49167,24 +49731,24 @@ function createIssuesCardHandle(opts) {
|
|
|
49167
49731
|
}
|
|
49168
49732
|
|
|
49169
49733
|
// issues-watcher.ts
|
|
49170
|
-
import { existsSync as
|
|
49171
|
-
import { join as
|
|
49734
|
+
import { existsSync as existsSync32, statSync as statSync8 } from "node:fs";
|
|
49735
|
+
import { join as join29 } from "node:path";
|
|
49172
49736
|
|
|
49173
49737
|
// ../src/issues/store.ts
|
|
49174
49738
|
import {
|
|
49175
49739
|
closeSync as closeSync4,
|
|
49176
|
-
existsSync as
|
|
49177
|
-
mkdirSync as
|
|
49740
|
+
existsSync as existsSync31,
|
|
49741
|
+
mkdirSync as mkdirSync18,
|
|
49178
49742
|
openSync as openSync4,
|
|
49179
49743
|
readdirSync as readdirSync5,
|
|
49180
|
-
readFileSync as
|
|
49744
|
+
readFileSync as readFileSync30,
|
|
49181
49745
|
renameSync as renameSync11,
|
|
49182
49746
|
statSync as statSync7,
|
|
49183
|
-
unlinkSync as
|
|
49184
|
-
writeFileSync as
|
|
49747
|
+
unlinkSync as unlinkSync11,
|
|
49748
|
+
writeFileSync as writeFileSync19,
|
|
49185
49749
|
writeSync
|
|
49186
49750
|
} from "node:fs";
|
|
49187
|
-
import { join as
|
|
49751
|
+
import { join as join28 } from "node:path";
|
|
49188
49752
|
import { randomBytes as randomBytes4 } from "node:crypto";
|
|
49189
49753
|
import { execSync } from "node:child_process";
|
|
49190
49754
|
|
|
@@ -49200,12 +49764,12 @@ var SEVERITY_RANK2 = {
|
|
|
49200
49764
|
var ISSUES_FILE = "issues.jsonl";
|
|
49201
49765
|
var ISSUES_LOCK = "issues.lock";
|
|
49202
49766
|
function readAll(stateDir) {
|
|
49203
|
-
const path =
|
|
49204
|
-
if (!
|
|
49767
|
+
const path = join28(stateDir, ISSUES_FILE);
|
|
49768
|
+
if (!existsSync31(path))
|
|
49205
49769
|
return [];
|
|
49206
49770
|
let raw;
|
|
49207
49771
|
try {
|
|
49208
|
-
raw =
|
|
49772
|
+
raw = readFileSync30(path, "utf-8");
|
|
49209
49773
|
} catch {
|
|
49210
49774
|
return [];
|
|
49211
49775
|
}
|
|
@@ -49237,7 +49801,7 @@ function list(stateDir, opts = {}) {
|
|
|
49237
49801
|
});
|
|
49238
49802
|
}
|
|
49239
49803
|
function resolve6(stateDir, fingerprint, nowFn = Date.now) {
|
|
49240
|
-
if (!
|
|
49804
|
+
if (!existsSync31(join28(stateDir, ISSUES_FILE)))
|
|
49241
49805
|
return 0;
|
|
49242
49806
|
return withLock(stateDir, () => {
|
|
49243
49807
|
const all = readAll(stateDir);
|
|
@@ -49255,13 +49819,13 @@ function resolve6(stateDir, fingerprint, nowFn = Date.now) {
|
|
|
49255
49819
|
});
|
|
49256
49820
|
}
|
|
49257
49821
|
function writeAll(stateDir, events) {
|
|
49258
|
-
const path =
|
|
49822
|
+
const path = join28(stateDir, ISSUES_FILE);
|
|
49259
49823
|
sweepOrphanTmpFiles(stateDir);
|
|
49260
49824
|
const tmp = `${path}.tmp-${process.pid}-${randomBytes4(4).toString("hex")}`;
|
|
49261
49825
|
const body = events.length === 0 ? "" : events.map((e) => JSON.stringify(e)).join(`
|
|
49262
49826
|
`) + `
|
|
49263
49827
|
`;
|
|
49264
|
-
|
|
49828
|
+
writeFileSync19(tmp, body, "utf-8");
|
|
49265
49829
|
renameSync11(tmp, path);
|
|
49266
49830
|
}
|
|
49267
49831
|
var ORPHAN_TMP_TTL_MS = 60000;
|
|
@@ -49277,11 +49841,11 @@ function sweepOrphanTmpFiles(stateDir) {
|
|
|
49277
49841
|
for (const entry of entries) {
|
|
49278
49842
|
if (!entry.startsWith(TMP_PREFIX))
|
|
49279
49843
|
continue;
|
|
49280
|
-
const tmpPath2 =
|
|
49844
|
+
const tmpPath2 = join28(stateDir, entry);
|
|
49281
49845
|
try {
|
|
49282
49846
|
const stat = statSync7(tmpPath2);
|
|
49283
49847
|
if (stat.mtimeMs < cutoff) {
|
|
49284
|
-
|
|
49848
|
+
unlinkSync11(tmpPath2);
|
|
49285
49849
|
}
|
|
49286
49850
|
} catch {}
|
|
49287
49851
|
}
|
|
@@ -49289,7 +49853,7 @@ function sweepOrphanTmpFiles(stateDir) {
|
|
|
49289
49853
|
var LOCK_RETRY_MS = 25;
|
|
49290
49854
|
var LOCK_TIMEOUT_MS = 1e4;
|
|
49291
49855
|
function withLock(stateDir, fn) {
|
|
49292
|
-
const lockPath =
|
|
49856
|
+
const lockPath = join28(stateDir, ISSUES_LOCK);
|
|
49293
49857
|
const startedAt = Date.now();
|
|
49294
49858
|
let fd = null;
|
|
49295
49859
|
while (fd === null) {
|
|
@@ -49317,27 +49881,27 @@ function withLock(stateDir, fn) {
|
|
|
49317
49881
|
closeSync4(fd);
|
|
49318
49882
|
} catch {}
|
|
49319
49883
|
try {
|
|
49320
|
-
|
|
49884
|
+
unlinkSync11(lockPath);
|
|
49321
49885
|
} catch {}
|
|
49322
49886
|
}
|
|
49323
49887
|
}
|
|
49324
49888
|
function tryStealStaleLock(lockPath) {
|
|
49325
49889
|
let pidStr;
|
|
49326
49890
|
try {
|
|
49327
|
-
pidStr =
|
|
49891
|
+
pidStr = readFileSync30(lockPath, "utf-8").trim();
|
|
49328
49892
|
} catch {
|
|
49329
49893
|
return true;
|
|
49330
49894
|
}
|
|
49331
49895
|
const pid = Number(pidStr);
|
|
49332
49896
|
if (!Number.isFinite(pid) || pid <= 0) {
|
|
49333
49897
|
try {
|
|
49334
|
-
|
|
49898
|
+
unlinkSync11(lockPath);
|
|
49335
49899
|
} catch {}
|
|
49336
49900
|
return true;
|
|
49337
49901
|
}
|
|
49338
49902
|
if (pid === process.pid) {
|
|
49339
49903
|
try {
|
|
49340
|
-
|
|
49904
|
+
unlinkSync11(lockPath);
|
|
49341
49905
|
} catch {}
|
|
49342
49906
|
return true;
|
|
49343
49907
|
}
|
|
@@ -49352,7 +49916,7 @@ function tryStealStaleLock(lockPath) {
|
|
|
49352
49916
|
return false;
|
|
49353
49917
|
}
|
|
49354
49918
|
try {
|
|
49355
|
-
|
|
49919
|
+
unlinkSync11(lockPath);
|
|
49356
49920
|
} catch {}
|
|
49357
49921
|
return true;
|
|
49358
49922
|
}
|
|
@@ -49374,7 +49938,7 @@ function isIssueEvent(v) {
|
|
|
49374
49938
|
// issues-watcher.ts
|
|
49375
49939
|
var DEFAULT_POLL_INTERVAL_MS2 = 2000;
|
|
49376
49940
|
function startIssuesWatcher(opts) {
|
|
49377
|
-
const path =
|
|
49941
|
+
const path = join29(opts.stateDir, ISSUES_FILE);
|
|
49378
49942
|
const log = opts.log ?? (() => {});
|
|
49379
49943
|
const intervalMs = opts.pollIntervalMs ?? DEFAULT_POLL_INTERVAL_MS2;
|
|
49380
49944
|
const setIntervalFn = opts.setInterval ?? setInterval;
|
|
@@ -49422,7 +49986,7 @@ function startIssuesWatcher(opts) {
|
|
|
49422
49986
|
};
|
|
49423
49987
|
}
|
|
49424
49988
|
function defaultSignatureProvider(path) {
|
|
49425
|
-
if (!
|
|
49989
|
+
if (!existsSync32(path))
|
|
49426
49990
|
return null;
|
|
49427
49991
|
try {
|
|
49428
49992
|
const stat = statSync8(path);
|
|
@@ -49906,8 +50470,8 @@ function extractFlowItems(line) {
|
|
|
49906
50470
|
}
|
|
49907
50471
|
|
|
49908
50472
|
// credits-watch.ts
|
|
49909
|
-
import { readFileSync as
|
|
49910
|
-
import { join as
|
|
50473
|
+
import { readFileSync as readFileSync31, writeFileSync as writeFileSync20, existsSync as existsSync33, mkdirSync as mkdirSync19 } from "fs";
|
|
50474
|
+
import { join as join30 } from "path";
|
|
49911
50475
|
var STATE_FILE = "credits-watch.json";
|
|
49912
50476
|
var FATAL_REASONS = new Set([
|
|
49913
50477
|
"out_of_credits",
|
|
@@ -49919,12 +50483,12 @@ function emptyCreditState() {
|
|
|
49919
50483
|
return { lastNotifiedReason: null, lastNotifiedAt: 0 };
|
|
49920
50484
|
}
|
|
49921
50485
|
function readClaudeJsonOverage(claudeConfigDir) {
|
|
49922
|
-
const path =
|
|
49923
|
-
if (!
|
|
50486
|
+
const path = join30(claudeConfigDir, ".claude.json");
|
|
50487
|
+
if (!existsSync33(path))
|
|
49924
50488
|
return null;
|
|
49925
50489
|
let raw;
|
|
49926
50490
|
try {
|
|
49927
|
-
raw =
|
|
50491
|
+
raw = readFileSync31(path, "utf-8");
|
|
49928
50492
|
} catch {
|
|
49929
50493
|
return null;
|
|
49930
50494
|
}
|
|
@@ -50004,11 +50568,11 @@ function escapeHtml10(s) {
|
|
|
50004
50568
|
return s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
50005
50569
|
}
|
|
50006
50570
|
function loadCreditState(stateDir) {
|
|
50007
|
-
const path =
|
|
50008
|
-
if (!
|
|
50571
|
+
const path = join30(stateDir, STATE_FILE);
|
|
50572
|
+
if (!existsSync33(path))
|
|
50009
50573
|
return emptyCreditState();
|
|
50010
50574
|
try {
|
|
50011
|
-
const raw =
|
|
50575
|
+
const raw = readFileSync31(path, "utf-8");
|
|
50012
50576
|
const parsed = JSON.parse(raw);
|
|
50013
50577
|
if (parsed && typeof parsed === "object" && (parsed.lastNotifiedReason === null || typeof parsed.lastNotifiedReason === "string") && typeof parsed.lastNotifiedAt === "number" && Number.isFinite(parsed.lastNotifiedAt)) {
|
|
50014
50578
|
return {
|
|
@@ -50020,15 +50584,15 @@ function loadCreditState(stateDir) {
|
|
|
50020
50584
|
return emptyCreditState();
|
|
50021
50585
|
}
|
|
50022
50586
|
function saveCreditState(stateDir, state4) {
|
|
50023
|
-
|
|
50024
|
-
const path =
|
|
50025
|
-
|
|
50587
|
+
mkdirSync19(stateDir, { recursive: true });
|
|
50588
|
+
const path = join30(stateDir, STATE_FILE);
|
|
50589
|
+
writeFileSync20(path, JSON.stringify(state4, null, 2) + `
|
|
50026
50590
|
`, { mode: 384 });
|
|
50027
50591
|
}
|
|
50028
50592
|
|
|
50029
50593
|
// quota-watch.ts
|
|
50030
|
-
import { readFileSync as
|
|
50031
|
-
import { join as
|
|
50594
|
+
import { readFileSync as readFileSync32, writeFileSync as writeFileSync21, existsSync as existsSync34, mkdirSync as mkdirSync20 } from "fs";
|
|
50595
|
+
import { join as join31 } from "path";
|
|
50032
50596
|
var STATE_FILE2 = "quota-watch.json";
|
|
50033
50597
|
function emptyQuotaWatchState() {
|
|
50034
50598
|
return {};
|
|
@@ -50118,11 +50682,11 @@ function escapeHtml11(s) {
|
|
|
50118
50682
|
return s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
50119
50683
|
}
|
|
50120
50684
|
function loadQuotaWatchState(stateDir) {
|
|
50121
|
-
const path =
|
|
50122
|
-
if (!
|
|
50685
|
+
const path = join31(stateDir, STATE_FILE2);
|
|
50686
|
+
if (!existsSync34(path))
|
|
50123
50687
|
return emptyQuotaWatchState();
|
|
50124
50688
|
try {
|
|
50125
|
-
const raw =
|
|
50689
|
+
const raw = readFileSync32(path, "utf-8");
|
|
50126
50690
|
const parsed = JSON.parse(raw);
|
|
50127
50691
|
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
50128
50692
|
return emptyQuotaWatchState();
|
|
@@ -50139,9 +50703,9 @@ function loadQuotaWatchState(stateDir) {
|
|
|
50139
50703
|
}
|
|
50140
50704
|
}
|
|
50141
50705
|
function saveQuotaWatchState(stateDir, state4) {
|
|
50142
|
-
|
|
50143
|
-
const path =
|
|
50144
|
-
|
|
50706
|
+
mkdirSync20(stateDir, { recursive: true });
|
|
50707
|
+
const path = join31(stateDir, STATE_FILE2);
|
|
50708
|
+
writeFileSync21(path, JSON.stringify(state4, null, 2) + `
|
|
50145
50709
|
`, { mode: 384 });
|
|
50146
50710
|
}
|
|
50147
50711
|
function patchQuotaWatchState(current, accountLabel, accountState) {
|
|
@@ -50154,27 +50718,27 @@ init_auth_snapshot_format();
|
|
|
50154
50718
|
// gateway/turn-active-marker.ts
|
|
50155
50719
|
import {
|
|
50156
50720
|
closeSync as closeSync5,
|
|
50157
|
-
existsSync as
|
|
50158
|
-
mkdirSync as
|
|
50721
|
+
existsSync as existsSync35,
|
|
50722
|
+
mkdirSync as mkdirSync21,
|
|
50159
50723
|
openSync as openSync5,
|
|
50160
|
-
readFileSync as
|
|
50724
|
+
readFileSync as readFileSync33,
|
|
50161
50725
|
statSync as statSync9,
|
|
50162
|
-
unlinkSync as
|
|
50726
|
+
unlinkSync as unlinkSync12,
|
|
50163
50727
|
utimesSync as utimesSync2,
|
|
50164
|
-
writeFileSync as
|
|
50728
|
+
writeFileSync as writeFileSync22
|
|
50165
50729
|
} from "node:fs";
|
|
50166
|
-
import { join as
|
|
50730
|
+
import { join as join32 } from "node:path";
|
|
50167
50731
|
var TURN_ACTIVE_MARKER_FILE2 = "turn-active.json";
|
|
50168
50732
|
function writeTurnActiveMarker(stateDir, marker) {
|
|
50169
50733
|
try {
|
|
50170
|
-
|
|
50171
|
-
|
|
50734
|
+
mkdirSync21(stateDir, { recursive: true });
|
|
50735
|
+
writeFileSync22(join32(stateDir, TURN_ACTIVE_MARKER_FILE2), JSON.stringify(marker, null, 2) + `
|
|
50172
50736
|
`, { mode: 384 });
|
|
50173
50737
|
} catch {}
|
|
50174
50738
|
}
|
|
50175
50739
|
function touchTurnActiveMarker2(stateDir) {
|
|
50176
|
-
const path =
|
|
50177
|
-
if (!
|
|
50740
|
+
const path = join32(stateDir, TURN_ACTIVE_MARKER_FILE2);
|
|
50741
|
+
if (!existsSync35(path))
|
|
50178
50742
|
return;
|
|
50179
50743
|
const now = new Date;
|
|
50180
50744
|
try {
|
|
@@ -50188,12 +50752,12 @@ function touchTurnActiveMarker2(stateDir) {
|
|
|
50188
50752
|
}
|
|
50189
50753
|
function removeTurnActiveMarker(stateDir) {
|
|
50190
50754
|
try {
|
|
50191
|
-
|
|
50755
|
+
unlinkSync12(join32(stateDir, TURN_ACTIVE_MARKER_FILE2));
|
|
50192
50756
|
} catch {}
|
|
50193
50757
|
}
|
|
50194
50758
|
function sweepStaleTurnActiveMarker(stateDir, opts) {
|
|
50195
|
-
const path =
|
|
50196
|
-
if (!
|
|
50759
|
+
const path = join32(stateDir, TURN_ACTIVE_MARKER_FILE2);
|
|
50760
|
+
if (!existsSync35(path))
|
|
50197
50761
|
return false;
|
|
50198
50762
|
const now = opts.now ?? Date.now();
|
|
50199
50763
|
try {
|
|
@@ -50205,9 +50769,9 @@ function sweepStaleTurnActiveMarker(stateDir, opts) {
|
|
|
50205
50769
|
return false;
|
|
50206
50770
|
let payload = null;
|
|
50207
50771
|
try {
|
|
50208
|
-
payload =
|
|
50772
|
+
payload = readFileSync33(path, "utf8");
|
|
50209
50773
|
} catch {}
|
|
50210
|
-
|
|
50774
|
+
unlinkSync12(path);
|
|
50211
50775
|
if (opts.onRemove) {
|
|
50212
50776
|
try {
|
|
50213
50777
|
opts.onRemove({
|
|
@@ -50224,10 +50788,10 @@ function sweepStaleTurnActiveMarker(stateDir, opts) {
|
|
|
50224
50788
|
}
|
|
50225
50789
|
|
|
50226
50790
|
// ../src/build-info.ts
|
|
50227
|
-
var VERSION = "0.14.
|
|
50228
|
-
var COMMIT_SHA = "
|
|
50229
|
-
var COMMIT_DATE = "2026-05-
|
|
50230
|
-
var LATEST_PR =
|
|
50791
|
+
var VERSION = "0.14.11";
|
|
50792
|
+
var COMMIT_SHA = "89d93911";
|
|
50793
|
+
var COMMIT_DATE = "2026-05-29T09:38:43Z";
|
|
50794
|
+
var LATEST_PR = 1991;
|
|
50231
50795
|
var COMMITS_AHEAD_OF_TAG = 0;
|
|
50232
50796
|
|
|
50233
50797
|
// gateway/boot-version.ts
|
|
@@ -50298,14 +50862,14 @@ function classifyRejection(err, opts = {}) {
|
|
|
50298
50862
|
// ../src/vault/broker/client.ts
|
|
50299
50863
|
init_protocol2();
|
|
50300
50864
|
init_peercred();
|
|
50301
|
-
import * as
|
|
50865
|
+
import * as net5 from "node:net";
|
|
50302
50866
|
import * as fs2 from "node:fs";
|
|
50303
|
-
import { homedir as
|
|
50304
|
-
import { join as
|
|
50867
|
+
import { homedir as homedir13 } from "node:os";
|
|
50868
|
+
import { join as join33 } from "node:path";
|
|
50305
50869
|
var DEFAULT_TIMEOUT_MS4 = 2000;
|
|
50306
50870
|
var UNLOCK_TIMEOUT_MS = 30000;
|
|
50307
|
-
var LEGACY_SOCKET_PATH2 =
|
|
50308
|
-
var OPERATOR_SOCKET_PATH2 =
|
|
50871
|
+
var LEGACY_SOCKET_PATH2 = join33(homedir13(), ".switchroom", "vault-broker.sock");
|
|
50872
|
+
var OPERATOR_SOCKET_PATH2 = join33(homedir13(), ".switchroom", "broker-operator", "sock");
|
|
50309
50873
|
function defaultBrokerSocketPath2() {
|
|
50310
50874
|
if (fs2.existsSync(OPERATOR_SOCKET_PATH2))
|
|
50311
50875
|
return OPERATOR_SOCKET_PATH2;
|
|
@@ -50334,7 +50898,7 @@ async function rpc2(req, opts) {
|
|
|
50334
50898
|
settled = true;
|
|
50335
50899
|
resolve7(val);
|
|
50336
50900
|
};
|
|
50337
|
-
const client3 = new
|
|
50901
|
+
const client3 = new net5.Socket;
|
|
50338
50902
|
const timer3 = setTimeout(() => {
|
|
50339
50903
|
client3.destroy();
|
|
50340
50904
|
settle({ kind: "unreachable", msg: `broker did not respond within ${timeoutMs}ms` });
|
|
@@ -50428,7 +50992,7 @@ async function unlockViaBroker(passphrase, opts) {
|
|
|
50428
50992
|
client3.destroy();
|
|
50429
50993
|
settle({ ok: false, msg: "Timeout waiting for broker" });
|
|
50430
50994
|
}, timeoutMs);
|
|
50431
|
-
const client3 =
|
|
50995
|
+
const client3 = net5.createConnection({ path: unlockSocketPath });
|
|
50432
50996
|
client3.on("error", (err) => {
|
|
50433
50997
|
clearTimeout(timer3);
|
|
50434
50998
|
settle({ ok: false, msg: `Broker unreachable: ${err.message}` });
|
|
@@ -50527,8 +51091,8 @@ function resolveVaultApprovalPosture(broker) {
|
|
|
50527
51091
|
}
|
|
50528
51092
|
|
|
50529
51093
|
// registry/turns-schema.ts
|
|
50530
|
-
import { chmodSync as
|
|
50531
|
-
import { join as
|
|
51094
|
+
import { chmodSync as chmodSync4, mkdirSync as mkdirSync22 } from "fs";
|
|
51095
|
+
import { join as join34 } from "path";
|
|
50532
51096
|
var DatabaseClass2 = null;
|
|
50533
51097
|
function loadDatabaseClass2() {
|
|
50534
51098
|
if (DatabaseClass2 != null)
|
|
@@ -50587,13 +51151,13 @@ function applySchema(db2) {
|
|
|
50587
51151
|
}
|
|
50588
51152
|
function openTurnsDb(agentDir) {
|
|
50589
51153
|
const Database = loadDatabaseClass2();
|
|
50590
|
-
const dir =
|
|
50591
|
-
|
|
50592
|
-
const path =
|
|
51154
|
+
const dir = join34(agentDir, "telegram");
|
|
51155
|
+
mkdirSync22(dir, { recursive: true, mode: 448 });
|
|
51156
|
+
const path = join34(dir, "registry.db");
|
|
50593
51157
|
const db2 = new Database(path, { create: true });
|
|
50594
51158
|
applySchema(db2);
|
|
50595
51159
|
try {
|
|
50596
|
-
|
|
51160
|
+
chmodSync4(path, 384);
|
|
50597
51161
|
} catch {}
|
|
50598
51162
|
return db2;
|
|
50599
51163
|
}
|
|
@@ -50730,11 +51294,11 @@ installGlobalErrorHandlers();
|
|
|
50730
51294
|
process.on("beforeExit", () => {
|
|
50731
51295
|
shutdownAnalytics();
|
|
50732
51296
|
});
|
|
50733
|
-
var STATE_DIR = process.env.TELEGRAM_STATE_DIR ??
|
|
50734
|
-
var ACCESS_FILE =
|
|
50735
|
-
var APPROVED_DIR =
|
|
50736
|
-
var ENV_FILE =
|
|
50737
|
-
var INBOX_DIR =
|
|
51297
|
+
var STATE_DIR = process.env.TELEGRAM_STATE_DIR ?? join36(homedir14(), ".claude", "channels", "telegram");
|
|
51298
|
+
var ACCESS_FILE = join36(STATE_DIR, "access.json");
|
|
51299
|
+
var APPROVED_DIR = join36(STATE_DIR, "approved");
|
|
51300
|
+
var ENV_FILE = join36(STATE_DIR, ".env");
|
|
51301
|
+
var INBOX_DIR = join36(STATE_DIR, "inbox");
|
|
50738
51302
|
function triggerSelfRestart(targetAgent, reason, delayMs = 300) {
|
|
50739
51303
|
const isDocker = process.env.SWITCHROOM_RUNTIME === "docker";
|
|
50740
51304
|
const selfAgent = process.env.SWITCHROOM_AGENT_NAME;
|
|
@@ -50798,8 +51362,8 @@ function formatBootVersion() {
|
|
|
50798
51362
|
});
|
|
50799
51363
|
}
|
|
50800
51364
|
try {
|
|
50801
|
-
|
|
50802
|
-
for (const line of
|
|
51365
|
+
chmodSync6(ENV_FILE, 384);
|
|
51366
|
+
for (const line of readFileSync36(ENV_FILE, "utf8").split(`
|
|
50803
51367
|
`)) {
|
|
50804
51368
|
const m = line.match(/^(\w+)=(.*)$/);
|
|
50805
51369
|
if (m && process.env[m[1]] === undefined)
|
|
@@ -50852,7 +51416,7 @@ installTgPostLogger(bot);
|
|
|
50852
51416
|
var _rawSendMessageDraft = bot.api.raw.sendMessageDraft;
|
|
50853
51417
|
var GRAMMY_VERSION = (() => {
|
|
50854
51418
|
try {
|
|
50855
|
-
const raw =
|
|
51419
|
+
const raw = readFileSync36(new URL("../../node_modules/grammy/package.json", import.meta.url), "utf8");
|
|
50856
51420
|
return JSON.parse(raw).version ?? "unknown";
|
|
50857
51421
|
} catch {
|
|
50858
51422
|
return "unknown";
|
|
@@ -50925,7 +51489,7 @@ function assertSendable(f) {
|
|
|
50925
51489
|
} catch {
|
|
50926
51490
|
throw new Error(`refusing to send file \u2014 cannot resolve real path: ${f}`);
|
|
50927
51491
|
}
|
|
50928
|
-
const inbox =
|
|
51492
|
+
const inbox = join36(stateReal, "inbox");
|
|
50929
51493
|
if (real.startsWith(stateReal + sep3) && !real.startsWith(inbox + sep3)) {
|
|
50930
51494
|
throw new Error(`refusing to send channel state: ${f}`);
|
|
50931
51495
|
}
|
|
@@ -50944,7 +51508,7 @@ function assertSendable(f) {
|
|
|
50944
51508
|
}
|
|
50945
51509
|
function readAccessFile() {
|
|
50946
51510
|
try {
|
|
50947
|
-
const raw =
|
|
51511
|
+
const raw = readFileSync36(ACCESS_FILE, "utf8");
|
|
50948
51512
|
const parsed = JSON.parse(raw);
|
|
50949
51513
|
const allowFrom = validateStringArray("allowFrom", parsed.allowFrom ?? []);
|
|
50950
51514
|
const groups = {};
|
|
@@ -51009,9 +51573,9 @@ function assertAllowedChat(chat_id) {
|
|
|
51009
51573
|
function saveAccess(a) {
|
|
51010
51574
|
if (STATIC)
|
|
51011
51575
|
return;
|
|
51012
|
-
|
|
51576
|
+
mkdirSync26(STATE_DIR, { recursive: true, mode: 448 });
|
|
51013
51577
|
const tmp = ACCESS_FILE + ".tmp";
|
|
51014
|
-
|
|
51578
|
+
writeFileSync25(tmp, JSON.stringify(a, null, 2) + `
|
|
51015
51579
|
`, { mode: 384 });
|
|
51016
51580
|
renameSync13(tmp, ACCESS_FILE);
|
|
51017
51581
|
}
|
|
@@ -51031,7 +51595,7 @@ var HISTORY_ENABLED = HISTORY_ACCESS.historyEnabled !== false;
|
|
|
51031
51595
|
if (HISTORY_ENABLED) {
|
|
51032
51596
|
try {
|
|
51033
51597
|
initHistory(STATE_DIR, HISTORY_ACCESS.historyRetentionDays ?? 30);
|
|
51034
|
-
process.stderr.write(`telegram gateway: history capture enabled at ${
|
|
51598
|
+
process.stderr.write(`telegram gateway: history capture enabled at ${join36(STATE_DIR, "history.db")}
|
|
51035
51599
|
`);
|
|
51036
51600
|
} catch (err) {
|
|
51037
51601
|
process.stderr.write(`telegram gateway: history init failed (${err.message}) \u2014 capture disabled
|
|
@@ -51048,10 +51612,10 @@ try {
|
|
|
51048
51612
|
process.stderr.write(`telegram gateway: turn-registry boot-reaper stamped ${reaped} orphaned turn(s) as ended_via='restart'
|
|
51049
51613
|
`);
|
|
51050
51614
|
} else {
|
|
51051
|
-
process.stderr.write(`telegram gateway: turn-registry initialized at ${
|
|
51615
|
+
process.stderr.write(`telegram gateway: turn-registry initialized at ${join36(agentDir, "telegram", "registry.db")}
|
|
51052
51616
|
`);
|
|
51053
51617
|
}
|
|
51054
|
-
const pendingEnvPath =
|
|
51618
|
+
const pendingEnvPath = join36(agentDir, ".pending-turn.env");
|
|
51055
51619
|
try {
|
|
51056
51620
|
const pending2 = findMostRecentInterruptedTurn(turnsDb);
|
|
51057
51621
|
if (pending2 != null) {
|
|
@@ -51065,13 +51629,13 @@ try {
|
|
|
51065
51629
|
`SWITCHROOM_PENDING_STARTED_AT=${pending2.started_at}`
|
|
51066
51630
|
];
|
|
51067
51631
|
const pendingEnvTmp = `${pendingEnvPath}.tmp-${process.pid}`;
|
|
51068
|
-
|
|
51632
|
+
writeFileSync25(pendingEnvTmp, lines.join(`
|
|
51069
51633
|
`) + `
|
|
51070
51634
|
`, { mode: 384 });
|
|
51071
51635
|
renameSync13(pendingEnvTmp, pendingEnvPath);
|
|
51072
51636
|
process.stderr.write(`telegram gateway: pending-turn env written to ${pendingEnvPath} turnKey=${pending2.turn_key} endedVia=${pending2.ended_via ?? "open"}
|
|
51073
51637
|
`);
|
|
51074
|
-
} else if (
|
|
51638
|
+
} else if (existsSync39(pendingEnvPath)) {
|
|
51075
51639
|
rmSync4(pendingEnvPath, { force: true });
|
|
51076
51640
|
process.stderr.write(`telegram gateway: pending-turn env cleared (clean previous shutdown)
|
|
51077
51641
|
`);
|
|
@@ -51125,7 +51689,7 @@ function checkApprovals() {
|
|
|
51125
51689
|
return;
|
|
51126
51690
|
}
|
|
51127
51691
|
for (const senderId of files) {
|
|
51128
|
-
const file =
|
|
51692
|
+
const file = join36(APPROVED_DIR, senderId);
|
|
51129
51693
|
bot.api.sendMessage(senderId, "Paired! Say hi to Claude.").then(() => rmSync4(file, { force: true }), (err) => {
|
|
51130
51694
|
process.stderr.write(`telegram gateway: failed to send approval confirm: ${err}
|
|
51131
51695
|
`);
|
|
@@ -52014,11 +52578,11 @@ var unpinProgressCardForChat = null;
|
|
|
52014
52578
|
var getPinnedProgressCardMessageId = null;
|
|
52015
52579
|
var completeProgressCardTurn = null;
|
|
52016
52580
|
var subagentWatcher = null;
|
|
52017
|
-
var SOCKET_PATH = process.env.SWITCHROOM_GATEWAY_SOCKET ??
|
|
52018
|
-
|
|
52019
|
-
var GATEWAY_PID_PATH = process.env.SWITCHROOM_GATEWAY_PID_FILE ??
|
|
52020
|
-
var GATEWAY_SESSION_MARKER_PATH = process.env.SWITCHROOM_GATEWAY_SESSION_MARKER ??
|
|
52021
|
-
var GATEWAY_CLEAN_SHUTDOWN_MARKER_PATH = process.env.SWITCHROOM_GATEWAY_CLEAN_SHUTDOWN_MARKER ??
|
|
52581
|
+
var SOCKET_PATH = process.env.SWITCHROOM_GATEWAY_SOCKET ?? join36(STATE_DIR, "gateway.sock");
|
|
52582
|
+
mkdirSync26(STATE_DIR, { recursive: true, mode: 448 });
|
|
52583
|
+
var GATEWAY_PID_PATH = process.env.SWITCHROOM_GATEWAY_PID_FILE ?? join36(STATE_DIR, "gateway.pid.json");
|
|
52584
|
+
var GATEWAY_SESSION_MARKER_PATH = process.env.SWITCHROOM_GATEWAY_SESSION_MARKER ?? join36(STATE_DIR, "gateway-session.json");
|
|
52585
|
+
var GATEWAY_CLEAN_SHUTDOWN_MARKER_PATH = process.env.SWITCHROOM_GATEWAY_CLEAN_SHUTDOWN_MARKER ?? join36(STATE_DIR, "clean-shutdown.json");
|
|
52022
52586
|
var GATEWAY_STARTED_AT_MS = Date.now();
|
|
52023
52587
|
var BOOT_CARD_ENABLED = process.env.SWITCHROOM_BOOT_CARD !== "false";
|
|
52024
52588
|
var activeBootCard = null;
|
|
@@ -52047,7 +52611,7 @@ function ensureIssuesCard(chatId, threadId) {
|
|
|
52047
52611
|
bot: botApi,
|
|
52048
52612
|
log: (msg) => process.stderr.write(`telegram gateway: ${msg}
|
|
52049
52613
|
`),
|
|
52050
|
-
persistPath:
|
|
52614
|
+
persistPath: join36(stateDir, "issues-card.json")
|
|
52051
52615
|
});
|
|
52052
52616
|
activeIssuesWatcher = startIssuesWatcher({
|
|
52053
52617
|
stateDir,
|
|
@@ -52091,21 +52655,6 @@ startTimer({
|
|
|
52091
52655
|
emitMetric: (event) => {
|
|
52092
52656
|
emitRuntimeMetric(event);
|
|
52093
52657
|
},
|
|
52094
|
-
onAwarenessPing: async (ctx) => {
|
|
52095
|
-
if (activeTurnStartedAt.get(ctx.key) == null && currentTurn == null) {
|
|
52096
|
-
return;
|
|
52097
|
-
}
|
|
52098
|
-
const text = formatFrameworkFallbackText(ctx.fallbackKind, ctx.silenceMs, ctx.inFlightTools);
|
|
52099
|
-
try {
|
|
52100
|
-
await robustApiCall(() => bot.api.sendMessage(ctx.chatId, text, {
|
|
52101
|
-
...ctx.threadId != null ? { message_thread_id: ctx.threadId } : {},
|
|
52102
|
-
disable_notification: true
|
|
52103
|
-
}), { chat_id: ctx.chatId, ...ctx.threadId != null ? { threadId: ctx.threadId } : {} });
|
|
52104
|
-
} catch (err) {
|
|
52105
|
-
process.stderr.write(`silence-poke awareness-ping sendMessage failed chat=${ctx.chatId} thread=${ctx.threadId}: ${err}
|
|
52106
|
-
`);
|
|
52107
|
-
}
|
|
52108
|
-
},
|
|
52109
52658
|
onFrameworkFallback: async (ctx) => {
|
|
52110
52659
|
if (activeTurnStartedAt.get(ctx.key) == null && currentTurn == null) {
|
|
52111
52660
|
process.stderr.write(`telegram gateway: silence-poke framework-fallback late-fire skipped \u2014 ` + `turn ended cleanly during silence window chat=${ctx.chatId} thread=${ctx.threadId ?? "-"} silence_ms=${ctx.silenceMs}
|
|
@@ -52221,13 +52770,13 @@ startTimer2({
|
|
|
52221
52770
|
}
|
|
52222
52771
|
});
|
|
52223
52772
|
var inboundSpool = STATIC ? undefined : createInboundSpool({
|
|
52224
|
-
path:
|
|
52773
|
+
path: join36(STATE_DIR, "inbound-spool.jsonl"),
|
|
52225
52774
|
fs: {
|
|
52226
|
-
appendFileSync: (p, d) =>
|
|
52227
|
-
readFileSync: (p) =>
|
|
52228
|
-
writeFileSync: (p, d) =>
|
|
52775
|
+
appendFileSync: (p, d) => appendFileSync5(p, d),
|
|
52776
|
+
readFileSync: (p) => readFileSync36(p, "utf8"),
|
|
52777
|
+
writeFileSync: (p, d) => writeFileSync25(p, d),
|
|
52229
52778
|
renameSync: (a, b) => renameSync13(a, b),
|
|
52230
|
-
existsSync: (p) =>
|
|
52779
|
+
existsSync: (p) => existsSync39(p),
|
|
52231
52780
|
statSizeSync: (p) => statSync13(p).size
|
|
52232
52781
|
}
|
|
52233
52782
|
});
|
|
@@ -52354,7 +52903,7 @@ var ipcServer = createIpcServer({
|
|
|
52354
52903
|
probeQuotaViaBroker: (t) => probeQuotaForBootCard(agentSlug, t),
|
|
52355
52904
|
tmuxSupervisor: process.env.SWITCHROOM_TMUX_SUPERVISOR === "1",
|
|
52356
52905
|
dockerMode: process.env.SWITCHROOM_RUNTIME === "docker",
|
|
52357
|
-
configSnapshotPath:
|
|
52906
|
+
configSnapshotPath: join36(resolvedAgentDirForCard, ".config-snapshot.json"),
|
|
52358
52907
|
...updateOutcomeLine ? { updateOutcomeLine } : {}
|
|
52359
52908
|
}, ackMsgId).then((handle) => {
|
|
52360
52909
|
activeBootCard = handle;
|
|
@@ -52412,24 +52961,6 @@ var ipcServer = createIpcServer({
|
|
|
52412
52961
|
`);
|
|
52413
52962
|
try {
|
|
52414
52963
|
const result = await executeToolCall(msg.tool, msg.args);
|
|
52415
|
-
const reminder = consumeArmedPoke();
|
|
52416
|
-
if (reminder != null && result != null && typeof result === "object") {
|
|
52417
|
-
const r = result;
|
|
52418
|
-
if (Array.isArray(r.content) && r.content.length > 0 && r.content[0].type === "text") {
|
|
52419
|
-
r.content[0].text = `${r.content[0].text}
|
|
52420
|
-
|
|
52421
|
-
<system-reminder>
|
|
52422
|
-
${reminder}
|
|
52423
|
-
</system-reminder>`;
|
|
52424
|
-
} else {
|
|
52425
|
-
r.content = [
|
|
52426
|
-
...Array.isArray(r.content) ? r.content : [],
|
|
52427
|
-
{ type: "text", text: `<system-reminder>
|
|
52428
|
-
${reminder}
|
|
52429
|
-
</system-reminder>` }
|
|
52430
|
-
];
|
|
52431
|
-
}
|
|
52432
|
-
}
|
|
52433
52964
|
return { type: "tool_call_result", id: msg.id, success: true, result };
|
|
52434
52965
|
} catch (err) {
|
|
52435
52966
|
return {
|
|
@@ -52453,9 +52984,6 @@ ${reminder}
|
|
|
52453
52984
|
if (ev.kind === "thinking") {
|
|
52454
52985
|
noteThinking(key, Date.now());
|
|
52455
52986
|
} else if (ev.kind === "tool_use") {
|
|
52456
|
-
if (ev.toolName === "Task" || ev.toolName === "Agent") {
|
|
52457
|
-
noteSubagentDispatch(key);
|
|
52458
|
-
}
|
|
52459
52987
|
if (ev.toolUseId != null && ev.toolUseId.length > 0 && !isTelegramSurfaceTool(ev.toolName)) {
|
|
52460
52988
|
const label = toolLabel(ev.toolName, ev.input, undefined, ev.precomputedLabel);
|
|
52461
52989
|
noteToolStart(key, ev.toolUseId, ev.toolName, label.length > 0 ? label : null, Date.now());
|
|
@@ -52769,6 +53297,62 @@ ${reminder}
|
|
|
52769
53297
|
log: (msg) => process.stderr.write(`telegram gateway: ipc \u2014 ${msg}
|
|
52770
53298
|
`)
|
|
52771
53299
|
});
|
|
53300
|
+
(() => {
|
|
53301
|
+
try {
|
|
53302
|
+
const selfAgent = process.env.SWITCHROOM_AGENT_NAME ?? "";
|
|
53303
|
+
if (!selfAgent)
|
|
53304
|
+
return;
|
|
53305
|
+
let viaGateway = false;
|
|
53306
|
+
try {
|
|
53307
|
+
const cfg = loadConfig2();
|
|
53308
|
+
const raw = cfg.agents?.[selfAgent];
|
|
53309
|
+
viaGateway = raw ? resolveAgentConfig2(cfg.defaults, cfg.profiles, raw).channels?.telegram?.webhook_via_gateway === true : false;
|
|
53310
|
+
} catch (err) {
|
|
53311
|
+
process.stderr.write(`telegram gateway: webhook-ingest config probe failed: ${err.message}
|
|
53312
|
+
`);
|
|
53313
|
+
}
|
|
53314
|
+
if (!viaGateway)
|
|
53315
|
+
return;
|
|
53316
|
+
const allowedUids = [];
|
|
53317
|
+
const ownUid = typeof process.getuid === "function" ? process.getuid() : null;
|
|
53318
|
+
if (ownUid !== null)
|
|
53319
|
+
allowedUids.push(ownUid);
|
|
53320
|
+
const receiverUidRaw = process.env.SWITCHROOM_WEBHOOK_RECEIVER_UID;
|
|
53321
|
+
const receiverUid = receiverUidRaw ? Number(receiverUidRaw) : NaN;
|
|
53322
|
+
if (Number.isInteger(receiverUid))
|
|
53323
|
+
allowedUids.push(receiverUid);
|
|
53324
|
+
const socketPath = join36(STATE_DIR, "webhook.sock");
|
|
53325
|
+
const webhookInject = (agentName3, inbound) => {
|
|
53326
|
+
const msg = inbound;
|
|
53327
|
+
const delivered = ipcServer.sendToAgent(agentName3, msg);
|
|
53328
|
+
if (delivered)
|
|
53329
|
+
markClaudeBusyForInbound(msg);
|
|
53330
|
+
else
|
|
53331
|
+
pendingInboundBuffer.push(agentName3, msg);
|
|
53332
|
+
return delivered;
|
|
53333
|
+
};
|
|
53334
|
+
startWebhookIngestServer({
|
|
53335
|
+
socketPath,
|
|
53336
|
+
allowedUids,
|
|
53337
|
+
log: (s) => process.stderr.write(`telegram gateway: ${s}`),
|
|
53338
|
+
onRecord: (req) => recordWebhookEvent({
|
|
53339
|
+
agent: selfAgent,
|
|
53340
|
+
source: req.source,
|
|
53341
|
+
event_type: req.event_type,
|
|
53342
|
+
ts: req.ts,
|
|
53343
|
+
rendered_text: req.rendered_text,
|
|
53344
|
+
payload: req.payload,
|
|
53345
|
+
...req.delivery_id ? { delivery_id: req.delivery_id } : {}
|
|
53346
|
+
}, {
|
|
53347
|
+
inject: webhookInject,
|
|
53348
|
+
log: (s) => process.stderr.write(`telegram gateway: ${s}`)
|
|
53349
|
+
})
|
|
53350
|
+
});
|
|
53351
|
+
} catch (err) {
|
|
53352
|
+
process.stderr.write(`telegram gateway: webhook-ingest server start failed (non-fatal): ${err.message}
|
|
53353
|
+
`);
|
|
53354
|
+
}
|
|
53355
|
+
})();
|
|
52772
53356
|
var IDLE_DRAIN_INTERVAL_MS = 5000;
|
|
52773
53357
|
if (!STATIC) {
|
|
52774
53358
|
setInterval(() => {
|
|
@@ -53734,11 +54318,11 @@ async function executeSendGif(rawArgs) {
|
|
|
53734
54318
|
};
|
|
53735
54319
|
}
|
|
53736
54320
|
async function publishToTelegraph(text, shortName, authorName) {
|
|
53737
|
-
const accountPath =
|
|
54321
|
+
const accountPath = join36(STATE_DIR, "telegraph-account.json");
|
|
53738
54322
|
let account = null;
|
|
53739
54323
|
try {
|
|
53740
|
-
if (
|
|
53741
|
-
const raw =
|
|
54324
|
+
if (existsSync39(accountPath)) {
|
|
54325
|
+
const raw = readFileSync36(accountPath, "utf-8");
|
|
53742
54326
|
const parsed = JSON.parse(raw);
|
|
53743
54327
|
if (parsed.shortName && parsed.accessToken) {
|
|
53744
54328
|
account = parsed;
|
|
@@ -53757,8 +54341,8 @@ async function publishToTelegraph(text, shortName, authorName) {
|
|
|
53757
54341
|
}
|
|
53758
54342
|
account = created.value;
|
|
53759
54343
|
try {
|
|
53760
|
-
|
|
53761
|
-
|
|
54344
|
+
mkdirSync26(STATE_DIR, { recursive: true, mode: 448 });
|
|
54345
|
+
writeFileSync25(accountPath, JSON.stringify(account, null, 2), { mode: 384 });
|
|
53762
54346
|
} catch (err) {
|
|
53763
54347
|
process.stderr.write(`telegram gateway: telegraph cache write failed: ${err.message}
|
|
53764
54348
|
`);
|
|
@@ -54000,9 +54584,9 @@ async function executeDownloadAttachment(args) {
|
|
|
54000
54584
|
fileUniqueId: file.file_unique_id,
|
|
54001
54585
|
now: Date.now()
|
|
54002
54586
|
});
|
|
54003
|
-
|
|
54587
|
+
mkdirSync26(INBOX_DIR, { recursive: true, mode: 448 });
|
|
54004
54588
|
assertInsideInbox(INBOX_DIR, dlPath);
|
|
54005
|
-
|
|
54589
|
+
writeFileSync25(dlPath, buf, { mode: 384 });
|
|
54006
54590
|
return { content: [{ type: "text", text: dlPath }] };
|
|
54007
54591
|
}
|
|
54008
54592
|
async function executeEditMessage(args) {
|
|
@@ -55777,14 +56361,14 @@ function restartMarkerPath() {
|
|
|
55777
56361
|
const agentDir = resolveAgentDirFromEnv();
|
|
55778
56362
|
if (!agentDir)
|
|
55779
56363
|
return null;
|
|
55780
|
-
return
|
|
56364
|
+
return join36(agentDir, "restart-pending.json");
|
|
55781
56365
|
}
|
|
55782
56366
|
function writeRestartMarker(marker) {
|
|
55783
56367
|
const p = restartMarkerPath();
|
|
55784
56368
|
if (!p)
|
|
55785
56369
|
return;
|
|
55786
56370
|
try {
|
|
55787
|
-
|
|
56371
|
+
writeFileSync25(p, JSON.stringify(marker));
|
|
55788
56372
|
lastPlannedRestartAt = Date.now();
|
|
55789
56373
|
process.stderr.write(`telegram gateway: restart-marker: write chat_id=${marker.chat_id} thread_id=${marker.thread_id ?? "-"} ack=${marker.ack_message_id ?? "-"} path=${p}
|
|
55790
56374
|
`);
|
|
@@ -55803,7 +56387,7 @@ function readRestartMarker() {
|
|
|
55803
56387
|
if (!p)
|
|
55804
56388
|
return null;
|
|
55805
56389
|
try {
|
|
55806
|
-
return JSON.parse(
|
|
56390
|
+
return JSON.parse(readFileSync36(p, "utf8"));
|
|
55807
56391
|
} catch {
|
|
55808
56392
|
return null;
|
|
55809
56393
|
}
|
|
@@ -55901,7 +56485,7 @@ var _dockerReachable;
|
|
|
55901
56485
|
function isDockerReachable() {
|
|
55902
56486
|
if (_dockerReachable !== undefined)
|
|
55903
56487
|
return _dockerReachable;
|
|
55904
|
-
if (!
|
|
56488
|
+
if (!existsSync39("/var/run/docker.sock")) {
|
|
55905
56489
|
_dockerReachable = false;
|
|
55906
56490
|
return _dockerReachable;
|
|
55907
56491
|
}
|
|
@@ -55918,12 +56502,12 @@ function _resetDockerReachableCache() {
|
|
|
55918
56502
|
}
|
|
55919
56503
|
function spawnSwitchroomDetached(args, onFailure) {
|
|
55920
56504
|
const fullArgs = SWITCHROOM_CONFIG ? ["--config", SWITCHROOM_CONFIG, ...args] : args;
|
|
55921
|
-
const logPath =
|
|
56505
|
+
const logPath = join36(STATE_DIR, "detached-spawn.log");
|
|
55922
56506
|
let outFd = null;
|
|
55923
56507
|
try {
|
|
55924
|
-
|
|
56508
|
+
mkdirSync26(STATE_DIR, { recursive: true });
|
|
55925
56509
|
outFd = openSync8(logPath, "a");
|
|
55926
|
-
|
|
56510
|
+
writeFileSync25(logPath, `
|
|
55927
56511
|
[${new Date().toISOString()}] spawn ${SWITCHROOM_CLI} ${fullArgs.join(" ")}
|
|
55928
56512
|
`, { flag: "a" });
|
|
55929
56513
|
} catch {}
|
|
@@ -55949,7 +56533,7 @@ function spawnSwitchroomDetached(args, onFailure) {
|
|
|
55949
56533
|
return;
|
|
55950
56534
|
let tail = "";
|
|
55951
56535
|
try {
|
|
55952
|
-
const full =
|
|
56536
|
+
const full = readFileSync36(logPath, "utf8");
|
|
55953
56537
|
tail = full.split(`
|
|
55954
56538
|
`).slice(-30).join(`
|
|
55955
56539
|
`).trim();
|
|
@@ -56291,10 +56875,10 @@ bot.use(async (ctx, next) => {
|
|
|
56291
56875
|
});
|
|
56292
56876
|
function readRecentDenialsForAgent(agentName3, windowMs, limit) {
|
|
56293
56877
|
try {
|
|
56294
|
-
const auditPath =
|
|
56295
|
-
if (!
|
|
56878
|
+
const auditPath = join36(homedir14(), ".switchroom", "vault-audit.log");
|
|
56879
|
+
if (!existsSync39(auditPath))
|
|
56296
56880
|
return [];
|
|
56297
|
-
const raw =
|
|
56881
|
+
const raw = readFileSync36(auditPath, "utf8");
|
|
56298
56882
|
return recentDenialsFromAuditLog(raw, { agentName: agentName3, windowMs, limit });
|
|
56299
56883
|
} catch {
|
|
56300
56884
|
return [];
|
|
@@ -56345,7 +56929,7 @@ async function buildAgentMetadata(agentName3) {
|
|
|
56345
56929
|
try {
|
|
56346
56930
|
const agentDir = resolveAgentDirFromEnv();
|
|
56347
56931
|
if (agentDir) {
|
|
56348
|
-
const raw =
|
|
56932
|
+
const raw = readFileSync36(join36(agentDir, ".claude", ".claude.json"), "utf8");
|
|
56349
56933
|
claudeJson = JSON.parse(raw);
|
|
56350
56934
|
}
|
|
56351
56935
|
} catch {}
|
|
@@ -56559,10 +57143,10 @@ bot.command("restart", async (ctx) => {
|
|
|
56559
57143
|
function flushAgentHandoff(agentDir) {
|
|
56560
57144
|
let removed = 0;
|
|
56561
57145
|
for (const fname of [".handoff.md", ".handoff-topic"]) {
|
|
56562
|
-
const p =
|
|
57146
|
+
const p = join36(agentDir, fname);
|
|
56563
57147
|
try {
|
|
56564
|
-
if (
|
|
56565
|
-
|
|
57148
|
+
if (existsSync39(p)) {
|
|
57149
|
+
unlinkSync15(p);
|
|
56566
57150
|
removed++;
|
|
56567
57151
|
}
|
|
56568
57152
|
} catch (err) {
|
|
@@ -56617,7 +57201,7 @@ async function handleNewOrResetCommand(ctx, kind) {
|
|
|
56617
57201
|
writeRestartMarker({ chat_id: chatId, thread_id: threadId ?? null, ack_message_id: ackId, ts: Date.now() });
|
|
56618
57202
|
if (agentDir != null) {
|
|
56619
57203
|
try {
|
|
56620
|
-
|
|
57204
|
+
writeFileSync25(join36(agentDir, ".force-fresh-session"), `${kind} at ${new Date().toISOString()}
|
|
56621
57205
|
`, "utf8");
|
|
56622
57206
|
} catch (err) {
|
|
56623
57207
|
process.stderr.write(`telegram gateway: failed to write force-fresh marker: ${err}
|
|
@@ -56976,16 +57560,16 @@ bot.command("interrupt", async (ctx) => {
|
|
|
56976
57560
|
await runSwitchroomCommand(ctx, ["agent", "interrupt", name], `interrupt ${name}`);
|
|
56977
57561
|
});
|
|
56978
57562
|
var lockoutOps = {
|
|
56979
|
-
readFileSync: (p, enc) =>
|
|
56980
|
-
writeFileSync: (p, data, opts) =>
|
|
56981
|
-
existsSync: (p) =>
|
|
56982
|
-
mkdirSync: (p, opts) =>
|
|
56983
|
-
joinPath: (...parts) =>
|
|
57563
|
+
readFileSync: (p, enc) => readFileSync36(p, enc),
|
|
57564
|
+
writeFileSync: (p, data, opts) => writeFileSync25(p, data, opts),
|
|
57565
|
+
existsSync: (p) => existsSync39(p),
|
|
57566
|
+
mkdirSync: (p, opts) => mkdirSync26(p, opts),
|
|
57567
|
+
joinPath: (...parts) => join36(...parts)
|
|
56984
57568
|
};
|
|
56985
57569
|
var FLEET_FALLBACK_DEDUP_MS = 30000;
|
|
56986
57570
|
function isAuthBrokerSocketReachable() {
|
|
56987
57571
|
try {
|
|
56988
|
-
return
|
|
57572
|
+
return existsSync39(resolveAuthBrokerSocketPath2());
|
|
56989
57573
|
} catch {
|
|
56990
57574
|
return false;
|
|
56991
57575
|
}
|
|
@@ -57046,7 +57630,7 @@ async function runCreditWatch() {
|
|
|
57046
57630
|
if (!agentDir)
|
|
57047
57631
|
return;
|
|
57048
57632
|
const agentName3 = getMyAgentName();
|
|
57049
|
-
const claudeConfigDir =
|
|
57633
|
+
const claudeConfigDir = join36(agentDir, ".claude");
|
|
57050
57634
|
const stateDir = STATE_DIR;
|
|
57051
57635
|
const reason = readClaudeJsonOverage(claudeConfigDir);
|
|
57052
57636
|
const prev = loadCreditState(stateDir);
|
|
@@ -57349,10 +57933,10 @@ async function handleVaultRecentDenialCallback(ctx, data) {
|
|
|
57349
57933
|
return;
|
|
57350
57934
|
}
|
|
57351
57935
|
const { token, id } = result;
|
|
57352
|
-
const tokenPath =
|
|
57936
|
+
const tokenPath = join36(homedir14(), ".switchroom", "agents", agentName3, ".vault-token");
|
|
57353
57937
|
try {
|
|
57354
|
-
|
|
57355
|
-
|
|
57938
|
+
mkdirSync26(join36(homedir14(), ".switchroom", "agents", agentName3), { recursive: true });
|
|
57939
|
+
writeFileSync25(tokenPath, token, { mode: 384 });
|
|
57356
57940
|
} catch (err) {
|
|
57357
57941
|
await switchroomReply(ctx, `<b>Grant created (${escapeHtmlForTg(id)}) but token write failed:</b> ${escapeHtmlForTg(String(err))}
|
|
57358
57942
|
<i>Recover with: <code>switchroom vault grant ${escapeHtmlForTg(agentName3)} --keys ${escapeHtmlForTg(keyName)} --duration 30d</code> on the host.</i>`, { html: true });
|
|
@@ -57428,10 +58012,10 @@ async function performVaultAccessApproval(ctx, pending2, stageId, senderId, atte
|
|
|
57428
58012
|
return;
|
|
57429
58013
|
}
|
|
57430
58014
|
const { token, id } = result;
|
|
57431
|
-
const tokenPath =
|
|
58015
|
+
const tokenPath = join36(homedir14(), ".switchroom", "agents", pending2.agent, ".vault-token");
|
|
57432
58016
|
try {
|
|
57433
|
-
|
|
57434
|
-
|
|
58017
|
+
mkdirSync26(join36(homedir14(), ".switchroom", "agents", pending2.agent), { recursive: true });
|
|
58018
|
+
writeFileSync25(tokenPath, token, { mode: 384 });
|
|
57435
58019
|
} catch (err) {
|
|
57436
58020
|
await switchroomReply(ctx, `<b>Grant created (${escapeHtmlForTg(id)}) but token write failed:</b> ${escapeHtmlForTg(String(err))}
|
|
57437
58021
|
<i>Recover with: <code>switchroom vault grant ${escapeHtmlForTg(pending2.agent)} --keys ${escapeHtmlForTg(pending2.key)} --duration ${Math.round(pending2.ttl_seconds / 86400)}d</code> on the host.</i>`, { html: true });
|
|
@@ -57906,10 +58490,10 @@ async function executeGrantWizard(ctx, chatId, state4) {
|
|
|
57906
58490
|
return;
|
|
57907
58491
|
}
|
|
57908
58492
|
const { token, id } = result;
|
|
57909
|
-
const tokenPath =
|
|
58493
|
+
const tokenPath = join36(homedir14(), ".switchroom", "agents", state4.agent, ".vault-token");
|
|
57910
58494
|
try {
|
|
57911
|
-
|
|
57912
|
-
|
|
58495
|
+
mkdirSync26(join36(homedir14(), ".switchroom", "agents", state4.agent), { recursive: true });
|
|
58496
|
+
writeFileSync25(tokenPath, token, { mode: 384 });
|
|
57913
58497
|
} catch (err) {
|
|
57914
58498
|
await switchroomReply(ctx, `<b>Grant created but token write failed:</b> ${escapeHtmlForTg(String(err))}`, { html: true });
|
|
57915
58499
|
return;
|
|
@@ -58757,7 +59341,7 @@ bot.command("usage", async (ctx) => {
|
|
|
58757
59341
|
await switchroomReply(ctx, "<b>/usage:</b> cannot resolve agent dir.", { html: true });
|
|
58758
59342
|
return;
|
|
58759
59343
|
}
|
|
58760
|
-
const result = await fetchQuota2({ claudeConfigDir:
|
|
59344
|
+
const result = await fetchQuota2({ claudeConfigDir: join36(agentDir, ".claude") });
|
|
58761
59345
|
if (!result.ok) {
|
|
58762
59346
|
await switchroomReply(ctx, `<b>/usage:</b> ${escapeHtmlForTg(result.reason)}`, { html: true });
|
|
58763
59347
|
return;
|
|
@@ -59198,7 +59782,7 @@ ${prettyInput}`;
|
|
|
59198
59782
|
const unifiedDiff = (() => {
|
|
59199
59783
|
try {
|
|
59200
59784
|
const cfgPath = process.env.SWITCHROOM_CONFIG ?? SWITCHROOM_CONFIG ?? findConfigFile2();
|
|
59201
|
-
const raw =
|
|
59785
|
+
const raw = readFileSync36(cfgPath, "utf8");
|
|
59202
59786
|
return synthesizeAllowRuleDiff({ agentName: agentName3, rule: rule.rule, configText: raw });
|
|
59203
59787
|
} catch (err) {
|
|
59204
59788
|
process.stderr.write(`telegram gateway: always-allow diff synth failed: ${err.message}
|
|
@@ -59335,9 +59919,9 @@ bot.on("message:photo", async (ctx) => {
|
|
|
59335
59919
|
fileUniqueId: best.file_unique_id,
|
|
59336
59920
|
now: Date.now()
|
|
59337
59921
|
});
|
|
59338
|
-
|
|
59922
|
+
mkdirSync26(INBOX_DIR, { recursive: true, mode: 448 });
|
|
59339
59923
|
assertInsideInbox(INBOX_DIR, dlPath);
|
|
59340
|
-
|
|
59924
|
+
writeFileSync25(dlPath, buf, { mode: 384 });
|
|
59341
59925
|
return dlPath;
|
|
59342
59926
|
} catch (err) {
|
|
59343
59927
|
const msg = err instanceof Error ? err.message : "unknown error";
|
|
@@ -59377,8 +59961,8 @@ async function maybeTranscribeVoice(fileId, mimeType, language) {
|
|
|
59377
59961
|
let apiKey = null;
|
|
59378
59962
|
try {
|
|
59379
59963
|
const path = __require("path").join(__require("os").homedir(), ".switchroom", "openai-api-key");
|
|
59380
|
-
if (
|
|
59381
|
-
apiKey =
|
|
59964
|
+
if (existsSync39(path)) {
|
|
59965
|
+
apiKey = readFileSync36(path, "utf-8").trim();
|
|
59382
59966
|
}
|
|
59383
59967
|
} catch (err) {
|
|
59384
59968
|
process.stderr.write(`telegram gateway: voice-in: failed to read api key: ${err.message}
|
|
@@ -60234,7 +60818,7 @@ var didOneTimeSetup = false;
|
|
|
60234
60818
|
return;
|
|
60235
60819
|
}
|
|
60236
60820
|
})();
|
|
60237
|
-
const resolvedAgentDirForBootCard = agentDir ??
|
|
60821
|
+
const resolvedAgentDirForBootCard = agentDir ?? join36(homedir14(), ".switchroom", "agents", agentSlug);
|
|
60238
60822
|
const handle = await startBootCard(chatId, threadId, botApiForCard, {
|
|
60239
60823
|
agentName: agentDisplayName,
|
|
60240
60824
|
agentSlug,
|
|
@@ -60248,7 +60832,7 @@ var didOneTimeSetup = false;
|
|
|
60248
60832
|
probeQuotaViaBroker: (t) => probeQuotaForBootCard(agentSlug, t),
|
|
60249
60833
|
tmuxSupervisor: process.env.SWITCHROOM_TMUX_SUPERVISOR === "1",
|
|
60250
60834
|
dockerMode: process.env.SWITCHROOM_RUNTIME === "docker",
|
|
60251
|
-
configSnapshotPath:
|
|
60835
|
+
configSnapshotPath: join36(resolvedAgentDirForBootCard, ".config-snapshot.json"),
|
|
60252
60836
|
...updateOutcomeLine ? { updateOutcomeLine } : {}
|
|
60253
60837
|
}, ackMsgId);
|
|
60254
60838
|
activeBootCard = handle;
|