@llblab/pi-telegram 0.54.4 → 0.55.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/AGENTS.md +4 -2
- package/BACKLOG.md +1 -1
- package/CHANGELOG.md +16 -0
- package/README.md +5 -3
- package/dist/lib/activity.d.ts +5 -1
- package/dist/lib/activity.js +31 -2
- package/dist/lib/bindings.d.ts +3 -1
- package/dist/lib/bindings.js +8 -2
- package/dist/lib/bus-api.d.ts +2 -2
- package/dist/lib/bus-api.js +7 -2
- package/dist/lib/bus-follower.d.ts +50 -3
- package/dist/lib/bus-follower.js +313 -146
- package/dist/lib/bus-leader.d.ts +3 -0
- package/dist/lib/bus-leader.js +99 -18
- package/dist/lib/bus.d.ts +7 -3
- package/dist/lib/bus.js +24 -16
- package/dist/lib/delivery.d.ts +4 -0
- package/dist/lib/delivery.js +48 -15
- package/dist/lib/extension.js +48 -6
- package/dist/lib/lifecycle.d.ts +68 -0
- package/dist/lib/lifecycle.js +178 -58
- package/dist/lib/machine.d.ts +23 -0
- package/dist/lib/machine.js +37 -0
- package/dist/lib/media.d.ts +114 -28
- package/dist/lib/media.js +292 -119
- package/dist/lib/model.d.ts +54 -15
- package/dist/lib/model.js +98 -53
- package/dist/lib/polling.js +2 -0
- package/dist/lib/preview.d.ts +128 -113
- package/dist/lib/preview.js +448 -366
- package/dist/lib/queue.d.ts +2 -2
- package/dist/lib/queue.js +3 -3
- package/dist/lib/routing.d.ts +7 -2
- package/dist/lib/routing.js +585 -229
- package/dist/lib/runtime.d.ts +77 -11
- package/dist/lib/runtime.js +174 -92
- package/dist/lib/sections.js +0 -1
- package/dist/lib/telegram-api.d.ts +11 -9
- package/dist/lib/telegram-api.js +53 -4
- package/dist/lib/text-groups.d.ts +0 -26
- package/dist/lib/text-groups.js +51 -98
- package/dist/lib/thread-display.js +14 -6
- package/dist/lib/threads.d.ts +18 -5
- package/dist/lib/threads.js +107 -30
- package/dist/lib/turns.d.ts +6 -0
- package/dist/lib/turns.js +12 -1
- package/dist/lib/updates.d.ts +13 -4
- package/dist/lib/updates.js +54 -19
- package/dist/package.json +1 -1
- package/docs/activity.md +1 -1
- package/docs/architecture.md +14 -11
- package/docs/delivery.md +7 -5
- package/docs/multi-instance-bus.md +20 -8
- package/docs/public-api.md +2 -2
- package/docs/ui-style.md +2 -2
- package/lib/activity.ts +29 -5
- package/lib/bindings.ts +9 -1
- package/lib/bus-api.ts +11 -3
- package/lib/bus-follower.ts +417 -203
- package/lib/bus-leader.ts +88 -14
- package/lib/bus.ts +30 -18
- package/lib/delivery.ts +47 -19
- package/lib/extension.ts +51 -9
- package/lib/lifecycle.ts +229 -55
- package/lib/machine.ts +60 -0
- package/lib/media.ts +438 -172
- package/lib/model.ts +169 -74
- package/lib/polling.ts +2 -0
- package/lib/preview.ts +715 -566
- package/lib/queue.ts +5 -5
- package/lib/routing.ts +614 -257
- package/lib/runtime.ts +260 -104
- package/lib/sections.ts +0 -2
- package/lib/telegram-api.ts +61 -8
- package/lib/text-groups.ts +75 -136
- package/lib/thread-display.ts +15 -4
- package/lib/threads.ts +120 -36
- package/lib/turns.ts +15 -1
- package/lib/updates.ts +60 -21
- package/package.json +1 -1
package/dist/lib/queue.d.ts
CHANGED
|
@@ -726,7 +726,7 @@ export interface TelegramDispatchRuntimeDeps<TContext = unknown> {
|
|
|
726
726
|
executeControlItem: (item: Extract<TelegramQueueDispatchAction<TContext>, {
|
|
727
727
|
kind: "control";
|
|
728
728
|
}>["item"]) => void;
|
|
729
|
-
onPromptDispatchStart: (chatId: number) => void;
|
|
729
|
+
onPromptDispatchStart: (chatId: number, target?: TelegramQueueTarget) => void;
|
|
730
730
|
commitPromptDispatch?: (item: Extract<TelegramQueueDispatchAction<TContext>, {
|
|
731
731
|
kind: "prompt";
|
|
732
732
|
}>["item"]) => boolean;
|
|
@@ -745,7 +745,7 @@ export interface TelegramQueueDispatchControllerDeps<TContext = unknown> extends
|
|
|
745
745
|
isDispatchGenerationActive?: (generation: number) => boolean;
|
|
746
746
|
updateStatus: (ctx: TContext, error?: string) => void;
|
|
747
747
|
sendTextReply: TelegramControlRuntimeDeps<TContext>["sendTextReply"];
|
|
748
|
-
onPromptDispatchStart: (ctx: TContext, chatId: number) => void;
|
|
748
|
+
onPromptDispatchStart: (ctx: TContext, chatId: number, target?: TelegramQueueTarget) => void;
|
|
749
749
|
commitPromptDispatch?: (item: Extract<TelegramQueueDispatchAction<TContext>, {
|
|
750
750
|
kind: "prompt";
|
|
751
751
|
}>["item"], ctx: TContext) => boolean;
|
package/dist/lib/queue.js
CHANGED
|
@@ -1957,7 +1957,7 @@ export function executeTelegramQueueDispatchPlan(plan, deps) {
|
|
|
1957
1957
|
deps.executeControlItem(plan.item);
|
|
1958
1958
|
return;
|
|
1959
1959
|
}
|
|
1960
|
-
deps.onPromptDispatchStart(plan.item.chatId);
|
|
1960
|
+
deps.onPromptDispatchStart(plan.item.chatId, plan.item.target);
|
|
1961
1961
|
try {
|
|
1962
1962
|
if (deps.commitPromptDispatch && !deps.commitPromptDispatch(plan.item)) {
|
|
1963
1963
|
throw new Error("Telegram prompt dispatch could not be committed durably.");
|
|
@@ -2188,8 +2188,8 @@ export function createTelegramQueueDispatchController(deps) {
|
|
|
2188
2188
|
},
|
|
2189
2189
|
});
|
|
2190
2190
|
},
|
|
2191
|
-
onPromptDispatchStart: (chatId) => {
|
|
2192
|
-
deps.onPromptDispatchStart(ctx, chatId);
|
|
2191
|
+
onPromptDispatchStart: (chatId, target) => {
|
|
2192
|
+
deps.onPromptDispatchStart(ctx, chatId, target);
|
|
2193
2193
|
},
|
|
2194
2194
|
commitPromptDispatch: deps.commitPromptDispatch
|
|
2195
2195
|
? (item) => deps.commitPromptDispatch(item, ctx)
|
package/dist/lib/routing.d.ts
CHANGED
|
@@ -72,7 +72,7 @@ type TelegramLiveRebindSelectedCommandReference = {
|
|
|
72
72
|
preparedSource: Bus.TelegramBusPreparedCommandSource;
|
|
73
73
|
selectedCommand: Bus.TelegramBusSelectedCommandInput;
|
|
74
74
|
};
|
|
75
|
-
/** One warm live attempt with exact
|
|
75
|
+
/** One warm live attempt with independent leader input/cleanup grants and exact peer donor settlement; no startup recovery or legacy Restore ACK. */
|
|
76
76
|
export declare function createTelegramLiveRebindCoordinator(input: {
|
|
77
77
|
request: Threads.TelegramWorkspaceRestoreRequest;
|
|
78
78
|
/** Captures caller source/reference, admission, profile, transport and Pi lifetime. */
|
|
@@ -103,6 +103,8 @@ export declare function createTelegramLiveRebindCoordinator(input: {
|
|
|
103
103
|
/** Explicit staged singleton command branch; absence preserves ordinary live input behavior. */
|
|
104
104
|
selectedCommand?: Bus.TelegramBusSelectedCommandInput;
|
|
105
105
|
};
|
|
106
|
+
/** Existing profile admission spans the applied recipient, fresh cleanup decision and one native input grant. */
|
|
107
|
+
cleanupBeforeRelease?(intent: Threads.TelegramWorkspaceLiveRebindIntent, isCurrent: () => boolean): Promise<boolean>;
|
|
106
108
|
/** Restore moves the tab to its new owner: once applied, show that owner's title (best-effort, never blocking). */
|
|
107
109
|
retitle?: (isCurrent: () => boolean) => Promise<void>;
|
|
108
110
|
recordRuntimeEvent?: (category: string, error: unknown, details: Record<string, unknown>) => void;
|
|
@@ -204,9 +206,10 @@ export interface TelegramInboundRouteRuntimeDeps<TMessage extends TelegramRouted
|
|
|
204
206
|
hasWorkspaceRestoreAuthority?: () => boolean;
|
|
205
207
|
/** Exact live root authority; capability advertisement alone cannot replace owned profile/session/recipient fences. */
|
|
206
208
|
hasWorkspaceLiveRebindAuthority?: () => boolean;
|
|
209
|
+
canUsePreDispatchRebind?: (recipient?: Threads.TelegramWorkspaceRestoreRecipient) => boolean;
|
|
207
210
|
/** Strict complete namespace plus exact current/historical references; only an empty result clears journal protection. */
|
|
208
211
|
inspectTemporaryThreadSources?: (target: Queue.TelegramQueueTarget, requiredJournalBindingKeys: readonly string[], ownInputs?: readonly Threads.TelegramTemporaryThreadInput[]) => readonly number[] | undefined;
|
|
209
|
-
/** Quiet period after the last cancelled input before one cleanup attempt; defaults to
|
|
212
|
+
/** Quiet period after the last cancelled input before one cleanup attempt; defaults to 0 ms. */
|
|
210
213
|
temporaryThreadCleanupDelayMs?: number;
|
|
211
214
|
/** Live-rebind cleanup attempt pacing; the bounded window ends in `not-issued`, never a time-based deletion. */
|
|
212
215
|
liveRebindCleanupSchedule?: {
|
|
@@ -353,6 +356,8 @@ export declare function createTelegramInboundRouteRuntime<TUpdate extends Update
|
|
|
353
356
|
canPrepareHeldCommand: ReturnType<typeof Commands.createTelegramCommandHandlerTargetRuntime<TMessage, TContext>>["canPrepareHeldCommand"];
|
|
354
357
|
/** Agent-settled hint: wakes waiting leader cleanup retries early; every readiness gate is still sampled fresh. */
|
|
355
358
|
onSessionSettled(ctx: TContext): void;
|
|
359
|
+
/** Lifetime-fenced hint from drained publication/activity/delivery/API owners; never a cleanup grant. */
|
|
360
|
+
onDeliverySettled(ctx: TContext): void;
|
|
356
361
|
/** Fresh body-free recipient observation only; never reconstructs an attempt or grants cleanup. */
|
|
357
362
|
observeLiveRebindLeaderWork(intent: Threads.TelegramWorkspaceLiveRebindIntent, ctx: TContext): Promise<Bus.TelegramBusLiveRebindWorkObservation | undefined>;
|
|
358
363
|
/** Fresh non-destructive candidate only; no retained idle, cleanup action or deletion grant. */
|