@llblab/pi-kit 0.31.2 → 0.33.0

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 (94) hide show
  1. package/BACKLOG.md +1 -1
  2. package/CHANGELOG.md +8 -0
  3. package/README.md +5 -3
  4. package/node_modules/@llblab/pi-codex-usage/AGENTS.md +2 -1
  5. package/node_modules/@llblab/pi-codex-usage/CHANGELOG.md +4 -0
  6. package/node_modules/@llblab/pi-codex-usage/README.md +11 -9
  7. package/node_modules/@llblab/pi-codex-usage/lib/extension.ts +13 -10
  8. package/node_modules/@llblab/pi-codex-usage/lib/fast.ts +6 -5
  9. package/node_modules/@llblab/pi-codex-usage/lib/query.ts +4 -4
  10. package/node_modules/@llblab/pi-codex-usage/lib/status.ts +10 -10
  11. package/node_modules/@llblab/pi-codex-usage/lib/telegram.ts +1 -1
  12. package/node_modules/@llblab/pi-codex-usage/lib/usage.ts +2 -1
  13. package/node_modules/@llblab/pi-codex-usage/package.json +1 -1
  14. package/node_modules/@llblab/pi-telegram/AGENTS.md +4 -2
  15. package/node_modules/@llblab/pi-telegram/BACKLOG.md +1 -1
  16. package/node_modules/@llblab/pi-telegram/CHANGELOG.md +11 -0
  17. package/node_modules/@llblab/pi-telegram/README.md +5 -3
  18. package/node_modules/@llblab/pi-telegram/dist/lib/activity.d.ts +5 -1
  19. package/node_modules/@llblab/pi-telegram/dist/lib/activity.js +31 -2
  20. package/node_modules/@llblab/pi-telegram/dist/lib/bindings.d.ts +3 -1
  21. package/node_modules/@llblab/pi-telegram/dist/lib/bindings.js +8 -2
  22. package/node_modules/@llblab/pi-telegram/dist/lib/bus-api.d.ts +2 -2
  23. package/node_modules/@llblab/pi-telegram/dist/lib/bus-api.js +7 -2
  24. package/node_modules/@llblab/pi-telegram/dist/lib/bus-follower.d.ts +49 -3
  25. package/node_modules/@llblab/pi-telegram/dist/lib/bus-follower.js +313 -146
  26. package/node_modules/@llblab/pi-telegram/dist/lib/bus-leader.d.ts +3 -0
  27. package/node_modules/@llblab/pi-telegram/dist/lib/bus-leader.js +99 -18
  28. package/node_modules/@llblab/pi-telegram/dist/lib/bus.d.ts +5 -3
  29. package/node_modules/@llblab/pi-telegram/dist/lib/bus.js +13 -10
  30. package/node_modules/@llblab/pi-telegram/dist/lib/delivery.d.ts +4 -0
  31. package/node_modules/@llblab/pi-telegram/dist/lib/delivery.js +48 -15
  32. package/node_modules/@llblab/pi-telegram/dist/lib/extension.js +48 -6
  33. package/node_modules/@llblab/pi-telegram/dist/lib/lifecycle.d.ts +68 -0
  34. package/node_modules/@llblab/pi-telegram/dist/lib/lifecycle.js +178 -58
  35. package/node_modules/@llblab/pi-telegram/dist/lib/machine.d.ts +23 -0
  36. package/node_modules/@llblab/pi-telegram/dist/lib/machine.js +37 -0
  37. package/node_modules/@llblab/pi-telegram/dist/lib/media.d.ts +114 -28
  38. package/node_modules/@llblab/pi-telegram/dist/lib/media.js +292 -119
  39. package/node_modules/@llblab/pi-telegram/dist/lib/model.d.ts +54 -15
  40. package/node_modules/@llblab/pi-telegram/dist/lib/model.js +98 -53
  41. package/node_modules/@llblab/pi-telegram/dist/lib/polling.js +2 -0
  42. package/node_modules/@llblab/pi-telegram/dist/lib/preview.d.ts +128 -113
  43. package/node_modules/@llblab/pi-telegram/dist/lib/preview.js +448 -366
  44. package/node_modules/@llblab/pi-telegram/dist/lib/queue.d.ts +2 -2
  45. package/node_modules/@llblab/pi-telegram/dist/lib/queue.js +3 -3
  46. package/node_modules/@llblab/pi-telegram/dist/lib/routing.d.ts +6 -1
  47. package/node_modules/@llblab/pi-telegram/dist/lib/routing.js +334 -210
  48. package/node_modules/@llblab/pi-telegram/dist/lib/runtime.d.ts +77 -11
  49. package/node_modules/@llblab/pi-telegram/dist/lib/runtime.js +174 -92
  50. package/node_modules/@llblab/pi-telegram/dist/lib/sections.js +0 -1
  51. package/node_modules/@llblab/pi-telegram/dist/lib/telegram-api.d.ts +11 -9
  52. package/node_modules/@llblab/pi-telegram/dist/lib/telegram-api.js +53 -4
  53. package/node_modules/@llblab/pi-telegram/dist/lib/text-groups.d.ts +0 -26
  54. package/node_modules/@llblab/pi-telegram/dist/lib/text-groups.js +51 -98
  55. package/node_modules/@llblab/pi-telegram/dist/lib/thread-display.js +14 -6
  56. package/node_modules/@llblab/pi-telegram/dist/lib/threads.d.ts +18 -5
  57. package/node_modules/@llblab/pi-telegram/dist/lib/threads.js +107 -30
  58. package/node_modules/@llblab/pi-telegram/dist/lib/turns.d.ts +2 -0
  59. package/node_modules/@llblab/pi-telegram/dist/lib/turns.js +6 -1
  60. package/node_modules/@llblab/pi-telegram/dist/lib/updates.d.ts +11 -4
  61. package/node_modules/@llblab/pi-telegram/dist/lib/updates.js +54 -19
  62. package/node_modules/@llblab/pi-telegram/dist/package.json +1 -1
  63. package/node_modules/@llblab/pi-telegram/docs/activity.md +1 -1
  64. package/node_modules/@llblab/pi-telegram/docs/architecture.md +12 -11
  65. package/node_modules/@llblab/pi-telegram/docs/delivery.md +7 -5
  66. package/node_modules/@llblab/pi-telegram/docs/multi-instance-bus.md +18 -8
  67. package/node_modules/@llblab/pi-telegram/docs/public-api.md +2 -2
  68. package/node_modules/@llblab/pi-telegram/docs/ui-style.md +2 -2
  69. package/node_modules/@llblab/pi-telegram/lib/activity.ts +29 -5
  70. package/node_modules/@llblab/pi-telegram/lib/bindings.ts +9 -1
  71. package/node_modules/@llblab/pi-telegram/lib/bus-api.ts +11 -3
  72. package/node_modules/@llblab/pi-telegram/lib/bus-follower.ts +417 -203
  73. package/node_modules/@llblab/pi-telegram/lib/bus-leader.ts +88 -14
  74. package/node_modules/@llblab/pi-telegram/lib/bus.ts +17 -15
  75. package/node_modules/@llblab/pi-telegram/lib/delivery.ts +47 -19
  76. package/node_modules/@llblab/pi-telegram/lib/extension.ts +51 -9
  77. package/node_modules/@llblab/pi-telegram/lib/lifecycle.ts +229 -55
  78. package/node_modules/@llblab/pi-telegram/lib/machine.ts +60 -0
  79. package/node_modules/@llblab/pi-telegram/lib/media.ts +438 -172
  80. package/node_modules/@llblab/pi-telegram/lib/model.ts +169 -74
  81. package/node_modules/@llblab/pi-telegram/lib/polling.ts +2 -0
  82. package/node_modules/@llblab/pi-telegram/lib/preview.ts +715 -566
  83. package/node_modules/@llblab/pi-telegram/lib/queue.ts +5 -5
  84. package/node_modules/@llblab/pi-telegram/lib/routing.ts +325 -238
  85. package/node_modules/@llblab/pi-telegram/lib/runtime.ts +260 -104
  86. package/node_modules/@llblab/pi-telegram/lib/sections.ts +0 -2
  87. package/node_modules/@llblab/pi-telegram/lib/telegram-api.ts +61 -8
  88. package/node_modules/@llblab/pi-telegram/lib/text-groups.ts +75 -136
  89. package/node_modules/@llblab/pi-telegram/lib/thread-display.ts +15 -4
  90. package/node_modules/@llblab/pi-telegram/lib/threads.ts +120 -36
  91. package/node_modules/@llblab/pi-telegram/lib/turns.ts +8 -1
  92. package/node_modules/@llblab/pi-telegram/lib/updates.ts +58 -21
  93. package/node_modules/@llblab/pi-telegram/package.json +1 -1
  94. package/package.json +3 -3
@@ -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)