stitchkit 0.95.3 → 0.96.1
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/CHANGELOG.md +111 -0
- package/dist/application/grammy-bot.d.ts +44 -0
- package/dist/application/grammy-bot.d.ts.map +1 -0
- package/dist/application/grammy-update-admission.d.ts +35 -0
- package/dist/application/grammy-update-admission.d.ts.map +1 -0
- package/dist/application/grammy.d.ts +23 -4
- package/dist/application/grammy.d.ts.map +1 -1
- package/dist/application/kernel-admission.d.ts +11 -0
- package/dist/application/kernel-admission.d.ts.map +1 -1
- package/dist/application/kernel-resource-context.d.ts.map +1 -1
- package/dist/application/resource.d.ts +22 -0
- package/dist/application/resource.d.ts.map +1 -1
- package/dist/entrypoints/application/grammy.d.ts +2 -1
- package/dist/entrypoints/application/grammy.d.ts.map +1 -1
- package/dist/entrypoints/application/grammy.js +139 -5
- package/dist/entrypoints/application.d.ts +1 -1
- package/dist/entrypoints/application.d.ts.map +1 -1
- package/dist/entrypoints/application.js +1 -1
- package/dist/entrypoints/observability.d.ts +1 -0
- package/dist/entrypoints/observability.d.ts.map +1 -1
- package/dist/entrypoints/observability.js +46 -4
- package/dist/entrypoints/telegram.d.ts +4 -0
- package/dist/entrypoints/telegram.d.ts.map +1 -1
- package/dist/entrypoints/telegram.js +693 -88
- package/dist/entrypoints/testing.js +1 -1
- package/dist/{index-w906953s.js → index-5qn1kx34.js} +48 -0
- package/dist/observability/json-logger.d.ts +38 -0
- package/dist/observability/json-logger.d.ts.map +1 -0
- package/dist/telegram/bot-api.d.ts +50 -0
- package/dist/telegram/bot-api.d.ts.map +1 -0
- package/dist/telegram/broadcast-state.d.ts +67 -0
- package/dist/telegram/broadcast-state.d.ts.map +1 -0
- package/dist/telegram/broadcast.d.ts +93 -0
- package/dist/telegram/broadcast.d.ts.map +1 -0
- package/dist/telegram/local-files.d.ts +63 -0
- package/dist/telegram/local-files.d.ts.map +1 -0
- package/dist/telegram/operator-channel.d.ts +78 -0
- package/dist/telegram/operator-channel.d.ts.map +1 -0
- package/llms/application-grammy.txt +5 -0
- package/llms/application.2.txt +1 -0
- package/llms/application.txt +51 -13
- package/llms/observability.txt +5 -0
- package/llms/server.4.txt +3 -0
- package/llms/stitchkit.txt +5 -5
- package/llms/telegram.txt +162 -3
- package/llms/{upgrading-0.37.0-0.53.0.txt → upgrading-0.37.0-0.56.0.txt} +130 -3
- package/llms/{upgrading-0.55.0-0.68.0.txt → upgrading-0.57.0-0.69.0.txt} +44 -130
- package/llms/{upgrading-0.69.0-0.95.0.txt → upgrading-0.70.0-0.96.0.txt} +40 -44
- package/llms/upgrading.txt +3 -3
- package/llms-full.txt +268 -23
- package/llms.txt +10 -9
- package/package.json +1 -1
|
@@ -380,6 +380,46 @@ function auditChanges(event) {
|
|
|
380
380
|
return true;
|
|
381
381
|
return !READ_METHODS.has(verb.toUpperCase());
|
|
382
382
|
}
|
|
383
|
+
// src/observability/json-logger.ts
|
|
384
|
+
var JSON_LOG_LEVELS = { debug: 20, info: 30, warn: 40, error: 50 };
|
|
385
|
+
function standardOutput(line) {
|
|
386
|
+
process.stdout.write(`${line}
|
|
387
|
+
`);
|
|
388
|
+
}
|
|
389
|
+
function serialise(record) {
|
|
390
|
+
try {
|
|
391
|
+
return JSON.stringify(record);
|
|
392
|
+
} catch {
|
|
393
|
+
return JSON.stringify({ level: record.level, time: record.time, msg: record.msg });
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
function createJsonLogger(options = {}) {
|
|
397
|
+
const threshold = JSON_LOG_LEVELS[options.level ?? "info"];
|
|
398
|
+
const write = options.write ?? standardOutput;
|
|
399
|
+
const now = options.now ?? Date.now;
|
|
400
|
+
const fields = options.fields ?? {};
|
|
401
|
+
const line = (level) => (msg, data) => {
|
|
402
|
+
const own = { level: JSON_LOG_LEVELS[level], time: now(), msg };
|
|
403
|
+
write(serialise(Object.assign({ ...own }, data, own)));
|
|
404
|
+
};
|
|
405
|
+
const sink = {
|
|
406
|
+
debug: line("debug"),
|
|
407
|
+
info: line("info"),
|
|
408
|
+
warn: line("warn"),
|
|
409
|
+
error: line("error")
|
|
410
|
+
};
|
|
411
|
+
const bounded = createBoundedLogger({ ...options, sink });
|
|
412
|
+
const gated = (level) => (msg, data) => {
|
|
413
|
+
if (JSON_LOG_LEVELS[level] >= threshold)
|
|
414
|
+
bounded[level](msg, { ...fields, ...data });
|
|
415
|
+
};
|
|
416
|
+
return {
|
|
417
|
+
debug: gated("debug"),
|
|
418
|
+
info: gated("info"),
|
|
419
|
+
warn: gated("warn"),
|
|
420
|
+
error: gated("error")
|
|
421
|
+
};
|
|
422
|
+
}
|
|
383
423
|
// src/observability/spool.ts
|
|
384
424
|
import { appendFile, mkdir, readFile, rename, writeFile } from "node:fs/promises";
|
|
385
425
|
import { dirname } from "node:path";
|
|
@@ -392,7 +432,7 @@ function createSpooledSink(config) {
|
|
|
392
432
|
const undelivered = new Map;
|
|
393
433
|
let delivered = 0;
|
|
394
434
|
let tail = Promise.resolve();
|
|
395
|
-
function
|
|
435
|
+
function serialise2(work) {
|
|
396
436
|
const next = tail.then(work, work);
|
|
397
437
|
tail = next.catch(() => {
|
|
398
438
|
return;
|
|
@@ -428,12 +468,12 @@ function createSpooledSink(config) {
|
|
|
428
468
|
return {
|
|
429
469
|
async write(event) {
|
|
430
470
|
const key = keyOf(event);
|
|
431
|
-
await
|
|
471
|
+
await serialise2(() => append({ k: key, e: event }, event));
|
|
432
472
|
undelivered.set(key, event);
|
|
433
473
|
await config.write(event);
|
|
434
474
|
undelivered.delete(key);
|
|
435
475
|
delivered += 1;
|
|
436
|
-
await
|
|
476
|
+
await serialise2(async () => {
|
|
437
477
|
await append({ a: key });
|
|
438
478
|
if (delivered >= compactAfter)
|
|
439
479
|
await compact();
|
|
@@ -483,7 +523,7 @@ function createSpooledSink(config) {
|
|
|
483
523
|
for (const [key, event] of pending)
|
|
484
524
|
undelivered.set(key, event);
|
|
485
525
|
delivered = 0;
|
|
486
|
-
await
|
|
526
|
+
await serialise2(compact);
|
|
487
527
|
return { replayed, failed };
|
|
488
528
|
},
|
|
489
529
|
pending: () => undelivered.size
|
|
@@ -556,6 +596,7 @@ export {
|
|
|
556
596
|
createTraceContext,
|
|
557
597
|
createSpooledSink,
|
|
558
598
|
createObservability,
|
|
599
|
+
createJsonLogger,
|
|
559
600
|
createDimensionsProjector,
|
|
560
601
|
createBoundedLogger,
|
|
561
602
|
childSpan,
|
|
@@ -563,5 +604,6 @@ export {
|
|
|
563
604
|
ObservabilityStatusSchema,
|
|
564
605
|
ObservabilitySinkStatusSchema,
|
|
565
606
|
ObservabilityDrainReportSchema,
|
|
607
|
+
JSON_LOG_LEVELS,
|
|
566
608
|
DEFAULT_REDACT_PATHS
|
|
567
609
|
};
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
export { callTelegramBotApi, TELEGRAM_BOT_TOKEN_PATTERN, type TelegramBotApiCall, TelegramBotApiError, } from '../telegram/bot-api.js';
|
|
2
|
+
export { runTelegramBroadcast, type TelegramBroadcastConfig, type TelegramBroadcastMessage, type TelegramBroadcastOutcome, type TelegramBroadcastRecipient, type TelegramBroadcastReport, type TelegramBroadcastRunOutcome, type TelegramBroadcastSend, type TelegramBroadcastSenderConfig, telegramBroadcastSender, } from '../telegram/broadcast.js';
|
|
1
3
|
export { type TelegramInitData, type TelegramInitDataRefusal, type TelegramInitDataUser, type TelegramInitDataVerification, type VerifyTelegramInitDataOptions, verifyTelegramInitData, } from '../telegram/init-data.js';
|
|
4
|
+
export { createTelegramLocalFiles, TelegramLocalFileError, type TelegramLocalFileRefusal, type TelegramLocalFiles, type TelegramLocalFilesCheck, type TelegramLocalFilesConfig, } from '../telegram/local-files.js';
|
|
5
|
+
export { createTelegramOperatorChannel, type TelegramChatId, type TelegramOperatorChannel, type TelegramOperatorChannelConfig, type TelegramOperatorDrop, type TelegramOperatorMessage, type TelegramOperatorSenderConfig, telegramOperatorSender, } from '../telegram/operator-channel.js';
|
|
2
6
|
export { classifyTelegramSendFailure, type TelegramSendFailure, type TelegramSendFailureReason, } from '../telegram/send-failure.js';
|
|
3
7
|
//# sourceMappingURL=telegram.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"telegram.d.ts","sourceRoot":"","sources":["../../src/entrypoints/telegram.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,uBAAuB,EAC5B,KAAK,oBAAoB,EACzB,KAAK,4BAA4B,EACjC,KAAK,6BAA6B,EAClC,sBAAsB,GACvB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,2BAA2B,EAC3B,KAAK,mBAAmB,EACxB,KAAK,yBAAyB,GAC/B,MAAM,0BAA0B,CAAC"}
|
|
1
|
+
{"version":3,"file":"telegram.d.ts","sourceRoot":"","sources":["../../src/entrypoints/telegram.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,0BAA0B,EAC1B,KAAK,kBAAkB,EACvB,mBAAmB,GACpB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,oBAAoB,EACpB,KAAK,uBAAuB,EAC5B,KAAK,wBAAwB,EAC7B,KAAK,wBAAwB,EAC7B,KAAK,0BAA0B,EAC/B,KAAK,uBAAuB,EAC5B,KAAK,2BAA2B,EAChC,KAAK,qBAAqB,EAC1B,KAAK,6BAA6B,EAClC,uBAAuB,GACxB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,uBAAuB,EAC5B,KAAK,oBAAoB,EACzB,KAAK,4BAA4B,EACjC,KAAK,6BAA6B,EAClC,sBAAsB,GACvB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,wBAAwB,EACxB,sBAAsB,EACtB,KAAK,wBAAwB,EAC7B,KAAK,kBAAkB,EACvB,KAAK,uBAAuB,EAC5B,KAAK,wBAAwB,GAC9B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,6BAA6B,EAC7B,KAAK,cAAc,EACnB,KAAK,uBAAuB,EAC5B,KAAK,6BAA6B,EAClC,KAAK,oBAAoB,EACzB,KAAK,uBAAuB,EAC5B,KAAK,4BAA4B,EACjC,sBAAsB,GACvB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,2BAA2B,EAC3B,KAAK,mBAAmB,EACxB,KAAK,yBAAyB,GAC/B,MAAM,0BAA0B,CAAC"}
|