@llblab/pi-kit 0.32.0 → 0.33.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.
Files changed (84) hide show
  1. package/BACKLOG.md +1 -1
  2. package/CHANGELOG.md +8 -0
  3. package/README.md +3 -3
  4. package/node_modules/@llblab/pi-telegram/AGENTS.md +4 -2
  5. package/node_modules/@llblab/pi-telegram/BACKLOG.md +1 -1
  6. package/node_modules/@llblab/pi-telegram/CHANGELOG.md +16 -0
  7. package/node_modules/@llblab/pi-telegram/README.md +5 -3
  8. package/node_modules/@llblab/pi-telegram/dist/lib/activity.d.ts +5 -1
  9. package/node_modules/@llblab/pi-telegram/dist/lib/activity.js +31 -2
  10. package/node_modules/@llblab/pi-telegram/dist/lib/bindings.d.ts +3 -1
  11. package/node_modules/@llblab/pi-telegram/dist/lib/bindings.js +8 -2
  12. package/node_modules/@llblab/pi-telegram/dist/lib/bus-api.d.ts +2 -2
  13. package/node_modules/@llblab/pi-telegram/dist/lib/bus-api.js +7 -2
  14. package/node_modules/@llblab/pi-telegram/dist/lib/bus-follower.d.ts +50 -3
  15. package/node_modules/@llblab/pi-telegram/dist/lib/bus-follower.js +313 -146
  16. package/node_modules/@llblab/pi-telegram/dist/lib/bus-leader.d.ts +3 -0
  17. package/node_modules/@llblab/pi-telegram/dist/lib/bus-leader.js +99 -18
  18. package/node_modules/@llblab/pi-telegram/dist/lib/bus.d.ts +7 -3
  19. package/node_modules/@llblab/pi-telegram/dist/lib/bus.js +24 -16
  20. package/node_modules/@llblab/pi-telegram/dist/lib/delivery.d.ts +4 -0
  21. package/node_modules/@llblab/pi-telegram/dist/lib/delivery.js +48 -15
  22. package/node_modules/@llblab/pi-telegram/dist/lib/extension.js +48 -6
  23. package/node_modules/@llblab/pi-telegram/dist/lib/lifecycle.d.ts +68 -0
  24. package/node_modules/@llblab/pi-telegram/dist/lib/lifecycle.js +178 -58
  25. package/node_modules/@llblab/pi-telegram/dist/lib/machine.d.ts +23 -0
  26. package/node_modules/@llblab/pi-telegram/dist/lib/machine.js +37 -0
  27. package/node_modules/@llblab/pi-telegram/dist/lib/media.d.ts +114 -28
  28. package/node_modules/@llblab/pi-telegram/dist/lib/media.js +292 -119
  29. package/node_modules/@llblab/pi-telegram/dist/lib/model.d.ts +54 -15
  30. package/node_modules/@llblab/pi-telegram/dist/lib/model.js +98 -53
  31. package/node_modules/@llblab/pi-telegram/dist/lib/polling.js +2 -0
  32. package/node_modules/@llblab/pi-telegram/dist/lib/preview.d.ts +128 -113
  33. package/node_modules/@llblab/pi-telegram/dist/lib/preview.js +448 -366
  34. package/node_modules/@llblab/pi-telegram/dist/lib/queue.d.ts +2 -2
  35. package/node_modules/@llblab/pi-telegram/dist/lib/queue.js +3 -3
  36. package/node_modules/@llblab/pi-telegram/dist/lib/routing.d.ts +7 -2
  37. package/node_modules/@llblab/pi-telegram/dist/lib/routing.js +585 -229
  38. package/node_modules/@llblab/pi-telegram/dist/lib/runtime.d.ts +77 -11
  39. package/node_modules/@llblab/pi-telegram/dist/lib/runtime.js +174 -92
  40. package/node_modules/@llblab/pi-telegram/dist/lib/sections.js +0 -1
  41. package/node_modules/@llblab/pi-telegram/dist/lib/telegram-api.d.ts +11 -9
  42. package/node_modules/@llblab/pi-telegram/dist/lib/telegram-api.js +53 -4
  43. package/node_modules/@llblab/pi-telegram/dist/lib/text-groups.d.ts +0 -26
  44. package/node_modules/@llblab/pi-telegram/dist/lib/text-groups.js +51 -98
  45. package/node_modules/@llblab/pi-telegram/dist/lib/thread-display.js +14 -6
  46. package/node_modules/@llblab/pi-telegram/dist/lib/threads.d.ts +18 -5
  47. package/node_modules/@llblab/pi-telegram/dist/lib/threads.js +107 -30
  48. package/node_modules/@llblab/pi-telegram/dist/lib/turns.d.ts +6 -0
  49. package/node_modules/@llblab/pi-telegram/dist/lib/turns.js +12 -1
  50. package/node_modules/@llblab/pi-telegram/dist/lib/updates.d.ts +13 -4
  51. package/node_modules/@llblab/pi-telegram/dist/lib/updates.js +54 -19
  52. package/node_modules/@llblab/pi-telegram/dist/package.json +1 -1
  53. package/node_modules/@llblab/pi-telegram/docs/activity.md +1 -1
  54. package/node_modules/@llblab/pi-telegram/docs/architecture.md +14 -11
  55. package/node_modules/@llblab/pi-telegram/docs/delivery.md +7 -5
  56. package/node_modules/@llblab/pi-telegram/docs/multi-instance-bus.md +20 -8
  57. package/node_modules/@llblab/pi-telegram/docs/public-api.md +2 -2
  58. package/node_modules/@llblab/pi-telegram/docs/ui-style.md +2 -2
  59. package/node_modules/@llblab/pi-telegram/lib/activity.ts +29 -5
  60. package/node_modules/@llblab/pi-telegram/lib/bindings.ts +9 -1
  61. package/node_modules/@llblab/pi-telegram/lib/bus-api.ts +11 -3
  62. package/node_modules/@llblab/pi-telegram/lib/bus-follower.ts +417 -203
  63. package/node_modules/@llblab/pi-telegram/lib/bus-leader.ts +88 -14
  64. package/node_modules/@llblab/pi-telegram/lib/bus.ts +30 -18
  65. package/node_modules/@llblab/pi-telegram/lib/delivery.ts +47 -19
  66. package/node_modules/@llblab/pi-telegram/lib/extension.ts +51 -9
  67. package/node_modules/@llblab/pi-telegram/lib/lifecycle.ts +229 -55
  68. package/node_modules/@llblab/pi-telegram/lib/machine.ts +60 -0
  69. package/node_modules/@llblab/pi-telegram/lib/media.ts +438 -172
  70. package/node_modules/@llblab/pi-telegram/lib/model.ts +169 -74
  71. package/node_modules/@llblab/pi-telegram/lib/polling.ts +2 -0
  72. package/node_modules/@llblab/pi-telegram/lib/preview.ts +715 -566
  73. package/node_modules/@llblab/pi-telegram/lib/queue.ts +5 -5
  74. package/node_modules/@llblab/pi-telegram/lib/routing.ts +614 -257
  75. package/node_modules/@llblab/pi-telegram/lib/runtime.ts +260 -104
  76. package/node_modules/@llblab/pi-telegram/lib/sections.ts +0 -2
  77. package/node_modules/@llblab/pi-telegram/lib/telegram-api.ts +61 -8
  78. package/node_modules/@llblab/pi-telegram/lib/text-groups.ts +75 -136
  79. package/node_modules/@llblab/pi-telegram/lib/thread-display.ts +15 -4
  80. package/node_modules/@llblab/pi-telegram/lib/threads.ts +120 -36
  81. package/node_modules/@llblab/pi-telegram/lib/turns.ts +15 -1
  82. package/node_modules/@llblab/pi-telegram/lib/updates.ts +60 -21
  83. package/node_modules/@llblab/pi-telegram/package.json +1 -1
  84. package/package.json +2 -2
@@ -3354,7 +3354,7 @@ export interface TelegramDispatchRuntimeDeps<TContext = unknown> {
3354
3354
  { kind: "control" }
3355
3355
  >["item"],
3356
3356
  ) => void;
3357
- onPromptDispatchStart: (chatId: number) => void;
3357
+ onPromptDispatchStart: (chatId: number, target?: TelegramQueueTarget) => void;
3358
3358
  commitPromptDispatch?: (
3359
3359
  item: Extract<
3360
3360
  TelegramQueueDispatchAction<TContext>,
@@ -3383,7 +3383,7 @@ export interface TelegramQueueDispatchControllerDeps<
3383
3383
  isDispatchGenerationActive?: (generation: number) => boolean;
3384
3384
  updateStatus: (ctx: TContext, error?: string) => void;
3385
3385
  sendTextReply: TelegramControlRuntimeDeps<TContext>["sendTextReply"];
3386
- onPromptDispatchStart: (ctx: TContext, chatId: number) => void;
3386
+ onPromptDispatchStart: (ctx: TContext, chatId: number, target?: TelegramQueueTarget) => void;
3387
3387
  commitPromptDispatch?: (
3388
3388
  item: Extract<
3389
3389
  TelegramQueueDispatchAction<TContext>,
@@ -3426,7 +3426,7 @@ export function executeTelegramQueueDispatchPlan<TContext = unknown>(
3426
3426
  deps.executeControlItem(plan.item);
3427
3427
  return;
3428
3428
  }
3429
- deps.onPromptDispatchStart(plan.item.chatId);
3429
+ deps.onPromptDispatchStart(plan.item.chatId, plan.item.target);
3430
3430
  try {
3431
3431
  if (deps.commitPromptDispatch && !deps.commitPromptDispatch(plan.item)) {
3432
3432
  throw new Error(
@@ -3702,8 +3702,8 @@ export function createTelegramQueueDispatchController<TContext = unknown>(
3702
3702
  },
3703
3703
  });
3704
3704
  },
3705
- onPromptDispatchStart: (chatId) => {
3706
- deps.onPromptDispatchStart(ctx, chatId);
3705
+ onPromptDispatchStart: (chatId, target) => {
3706
+ deps.onPromptDispatchStart(ctx, chatId, target);
3707
3707
  },
3708
3708
  commitPromptDispatch: deps.commitPromptDispatch
3709
3709
  ? (item) => deps.commitPromptDispatch!(item, ctx)