@llblab/pi-telegram 0.51.6 → 0.52.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 +15 -12
- package/BACKLOG.md +16 -9
- package/CHANGELOG.md +19 -0
- package/LICENSE +21 -0
- package/README.md +17 -6
- package/dist/lib/activity-verbosity.d.ts +1 -5
- package/dist/lib/activity-verbosity.js +5 -7
- package/dist/lib/bindings.d.ts +5 -1
- package/dist/lib/bindings.js +7 -1
- package/dist/lib/bus-api.js +8 -5
- package/dist/lib/bus-follower.d.ts +54 -56
- package/dist/lib/bus-follower.js +206 -139
- package/dist/lib/bus-leader.d.ts +21 -2
- package/dist/lib/bus-leader.js +181 -25
- package/dist/lib/bus-transport.d.ts +4 -1
- package/dist/lib/bus-transport.js +28 -4
- package/dist/lib/bus.d.ts +52 -56
- package/dist/lib/bus.js +78 -246
- package/dist/lib/channel-posts.d.ts +1 -3
- package/dist/lib/channel-posts.js +23 -26
- package/dist/lib/command-templates.d.ts +0 -5
- package/dist/lib/command-templates.js +5 -5
- package/dist/lib/commands.d.ts +0 -23
- package/dist/lib/commands.js +15 -15
- package/dist/lib/config.d.ts +0 -17
- package/dist/lib/config.js +12 -14
- package/dist/lib/delivery.d.ts +0 -4
- package/dist/lib/delivery.js +2 -5
- package/dist/lib/extension.js +258 -61
- package/dist/lib/generative-apps.d.ts +0 -19
- package/dist/lib/inbound.d.ts +0 -2
- package/dist/lib/inbound.js +2 -2
- package/dist/lib/journal.d.ts +183 -16
- package/dist/lib/journal.js +1175 -248
- package/dist/lib/keyboard.d.ts +0 -2
- package/dist/lib/keyboard.js +2 -2
- package/dist/lib/lifecycle.js +1 -1
- package/dist/lib/locks.d.ts +100 -12
- package/dist/lib/locks.js +380 -14
- package/dist/lib/logging.d.ts +30 -12
- package/dist/lib/logging.js +129 -72
- package/dist/lib/media.d.ts +28 -5
- package/dist/lib/media.js +26 -8
- package/dist/lib/menu-model.d.ts +0 -11
- package/dist/lib/menu-model.js +8 -8
- package/dist/lib/menu-settings.d.ts +0 -18
- package/dist/lib/menu-settings.js +18 -18
- package/dist/lib/menu-status.d.ts +4 -4
- package/dist/lib/menu-status.js +12 -7
- package/dist/lib/menu-thinking.d.ts +1 -1
- package/dist/lib/menu-thinking.js +1 -1
- package/dist/lib/menu.d.ts +1 -0
- package/dist/lib/menu.js +4 -3
- package/dist/lib/outbound-attachments.d.ts +0 -1
- package/dist/lib/outbound-attachments.js +1 -1
- package/dist/lib/outbound-buttons.js +1 -8
- package/dist/lib/outbound-markup.d.ts +1 -6
- package/dist/lib/outbound-markup.js +4 -21
- package/dist/lib/outbound.d.ts +0 -8
- package/dist/lib/outbound.js +5 -5
- package/dist/lib/paths.d.ts +50 -7
- package/dist/lib/paths.js +155 -17
- package/dist/lib/pi.d.ts +1 -0
- package/dist/lib/pi.js +2 -1
- package/dist/lib/polling.d.ts +0 -5
- package/dist/lib/polling.js +5 -5
- package/dist/lib/preview.d.ts +0 -3
- package/dist/lib/preview.js +3 -3
- package/dist/lib/prompt-templates.d.ts +0 -1
- package/dist/lib/prompt-templates.js +1 -1
- package/dist/lib/queue.d.ts +5 -15
- package/dist/lib/queue.js +94 -11
- package/dist/lib/recovery.d.ts +29 -9
- package/dist/lib/recovery.js +104 -33
- package/dist/lib/replies.d.ts +0 -4
- package/dist/lib/replies.js +1 -1
- package/dist/lib/routing.d.ts +74 -8
- package/dist/lib/routing.js +2280 -307
- package/dist/lib/sections.d.ts +0 -2
- package/dist/lib/sections.js +1 -1
- package/dist/lib/status.d.ts +44 -9
- package/dist/lib/status.js +149 -27
- package/dist/lib/sync.d.ts +0 -5
- package/dist/lib/sync.js +5 -4
- package/dist/lib/telegram-api.d.ts +13 -3
- package/dist/lib/telegram-api.js +38 -23
- package/dist/lib/thread-cleanup-manager.d.ts +1 -0
- package/dist/lib/thread-cleanup-manager.js +18 -21
- package/dist/lib/thread-naming.d.ts +32 -5
- package/dist/lib/thread-naming.js +191 -7
- package/dist/lib/thread-reconciler.d.ts +2 -0
- package/dist/lib/thread-reconciler.js +1 -1
- package/dist/lib/threads.d.ts +293 -59
- package/dist/lib/threads.js +1689 -369
- package/dist/lib/turns.d.ts +0 -1
- package/dist/lib/turns.js +1 -1
- package/dist/lib/updates.d.ts +191 -28
- package/dist/lib/updates.js +1048 -114
- package/dist/lib/wire.d.ts +12 -0
- package/dist/lib/wire.js +21 -0
- package/dist/lib/workspace-admission.d.ts +25 -17
- package/dist/lib/workspace-admission.js +95 -20
- package/dist/lib/workspace-identity.d.ts +20 -0
- package/dist/lib/workspace-identity.js +103 -0
- package/dist/lib/workspace-retirement.d.ts +43 -8
- package/dist/lib/workspace-retirement.js +148 -52
- package/dist/package.json +6 -6
- package/dist/skills/generated-control-surface/SKILL.md +3 -3
- package/dist/skills/telegram-bridge/references/diagnosis.md +3 -3
- package/docs/README.md +1 -1
- package/docs/activity.md +1 -1
- package/docs/architecture.md +156 -36
- package/docs/callback-namespaces.md +1 -1
- package/docs/delivery.md +1 -1
- package/docs/generative-apps.md +2 -2
- package/docs/inbound.md +1 -1
- package/docs/multi-instance-bus.md +125 -19
- package/docs/public-api.md +3 -1
- package/docs/ui-style.md +23 -9
- package/docs/updates.md +1 -1
- package/lib/activity-verbosity.ts +5 -9
- package/lib/bindings.ts +7 -0
- package/lib/bus-api.ts +9 -4
- package/lib/bus-follower.ts +243 -224
- package/lib/bus-leader.ts +178 -31
- package/lib/bus-transport.ts +30 -8
- package/lib/bus.ts +110 -334
- package/lib/channel-posts.ts +29 -29
- package/lib/command-templates.ts +5 -5
- package/lib/commands.ts +15 -15
- package/lib/config.ts +12 -17
- package/lib/delivery.ts +2 -8
- package/lib/extension.ts +261 -72
- package/lib/generative-apps.ts +0 -22
- package/lib/inbound.ts +2 -2
- package/lib/journal.ts +1250 -325
- package/lib/keyboard.ts +2 -2
- package/lib/lifecycle.ts +1 -1
- package/lib/locks.ts +402 -23
- package/lib/logging.ts +151 -101
- package/lib/media.ts +51 -9
- package/lib/menu-model.ts +8 -8
- package/lib/menu-settings.ts +18 -18
- package/lib/menu-status.ts +11 -0
- package/lib/menu-thinking.ts +2 -2
- package/lib/menu.ts +5 -1
- package/lib/outbound-attachments.ts +1 -1
- package/lib/outbound-buttons.ts +1 -10
- package/lib/outbound-markup.ts +5 -24
- package/lib/outbound.ts +5 -5
- package/lib/paths.ts +177 -17
- package/lib/pi.ts +5 -2
- package/lib/polling.ts +5 -5
- package/lib/preview.ts +3 -3
- package/lib/prompt-templates.ts +1 -1
- package/lib/queue.ts +93 -12
- package/lib/recovery.ts +104 -44
- package/lib/replies.ts +1 -1
- package/lib/routing.ts +2010 -375
- package/lib/sections.ts +1 -1
- package/lib/status.ts +156 -36
- package/lib/sync.ts +4 -4
- package/lib/telegram-api.ts +53 -33
- package/lib/thread-cleanup-manager.ts +24 -21
- package/lib/thread-naming.ts +267 -9
- package/lib/thread-reconciler.ts +3 -1
- package/lib/threads.ts +1736 -488
- package/lib/turns.ts +1 -1
- package/lib/updates.ts +1094 -151
- package/lib/wire.ts +28 -0
- package/lib/workspace-admission.ts +97 -47
- package/lib/workspace-identity.ts +147 -0
- package/lib/workspace-retirement.ts +188 -89
- package/package.json +6 -6
- package/scripts/audit-exports.mjs +100 -0
- package/scripts/check-downgrade.mjs +80 -43
- package/skills/generated-control-surface/SKILL.md +3 -3
- package/skills/telegram-bridge/references/diagnosis.md +3 -3
package/dist/lib/turns.d.ts
CHANGED
|
@@ -24,7 +24,6 @@ export interface TelegramTurnMessage {
|
|
|
24
24
|
}
|
|
25
25
|
export type DownloadedTelegramTurnFile = DownloadedTelegramMessageFile;
|
|
26
26
|
export declare function createTelegramTurnPrefix(attributes?: Record<string, string | undefined>): string;
|
|
27
|
-
export declare function formatTelegramTurnPrefix(_message: TelegramTurnMessage, basePrefix?: string): string;
|
|
28
27
|
export { truncateTelegramQueueSummary };
|
|
29
28
|
export declare function formatTelegramTurnStatusSummary(rawText: string, files: DownloadedTelegramTurnFile[], handlerOutputs?: string[]): string;
|
|
30
29
|
export declare function buildTelegramTurnPrompt(options: {
|
package/dist/lib/turns.js
CHANGED
|
@@ -30,7 +30,7 @@ export function createTelegramTurnPrefix(attributes = {}) {
|
|
|
30
30
|
}
|
|
31
31
|
return `[${parts.join("|")}]`;
|
|
32
32
|
}
|
|
33
|
-
|
|
33
|
+
function formatTelegramTurnPrefix(_message, basePrefix = TELEGRAM_PREFIX) {
|
|
34
34
|
return basePrefix;
|
|
35
35
|
}
|
|
36
36
|
export { truncateTelegramQueueSummary };
|
package/dist/lib/updates.d.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
import { type TelegramTarget } from "./target.ts";
|
|
7
7
|
import type { TelegramBusEnvelope, TelegramBusFollowerView, TelegramBusForwardOwnership, TelegramBusForeignUpdateSettlement, TelegramProcessLiveness } from "./bus.ts";
|
|
8
8
|
import type { TelegramMessageOwnershipStore } from "./ownership.ts";
|
|
9
|
-
import { TELEGRAM_UPDATE_JOURNAL_VERSION, TELEGRAM_UPDATE_JOURNAL_EXCLUSION_VERSION, TELEGRAM_UPDATE_JOURNAL_CUSTODY_VERSION, type TelegramInputJournalReceipt, type TelegramInputJournalSourceReference, type TelegramInputJournalStore, type TelegramJournaledUpdate, type TelegramUpdateJournalDeadQueueOwnerRecoveryResult, type TelegramUpdateJournalAppendResult, type TelegramUpdateJournalInputClaim, type TelegramUpdateJournalOperatorDispositionInput, type TelegramUpdateJournalOperatorDispositionResult, type TelegramUpdateJournalQueueDiscardResult, type TelegramUpdateJournalQueueHandoffAcceptResult, type TelegramUpdateJournalQueueHandoffCancelResult, type TelegramUpdateJournalQueueHandoffInput, type TelegramUpdateJournalQueueHandoffOfferResult, type TelegramUpdateJournalQueueOwner, type TelegramUpdateJournalQueueOwnerIdentity } from "./journal.ts";
|
|
9
|
+
import { TELEGRAM_UPDATE_JOURNAL_VERSION, TELEGRAM_UPDATE_JOURNAL_EXCLUSION_VERSION, TELEGRAM_UPDATE_JOURNAL_CUSTODY_VERSION, type TelegramUpdateJournalEntryDigest, type TelegramUpdateJournalSourceCompletion, type TelegramUpdateJournalQueuedCompletion, type TelegramUpdateJournalQueuedReceiptEvidence, type TelegramInputJournalReceipt, type TelegramInputJournalSourceReference, type TelegramInputJournalStore, type TelegramJournaledUpdate, type TelegramUpdateJournalDeadQueueOwnerRecoveryResult, type TelegramUpdateJournalAppendResult, type TelegramUpdateJournalInputClaim, type TelegramUpdateJournalOperatorDispositionInput, type TelegramUpdateJournalOperatorDispositionResult, type TelegramUpdateJournalPendingAbandonmentInput, type TelegramUpdateJournalPendingAbandonmentResult, type TelegramUpdateJournalPendingRetentionEvidence, type TelegramUpdateJournalEntry, type TelegramUpdateJournalRoutingInput, type TelegramRoutingInputJournal, type TelegramRoutingInputExpiryResult, type TelegramUpdateJournalQueueDiscardResult, type TelegramUpdateJournalQueueHandoffAcceptResult, type TelegramUpdateJournalQueueHandoffCancelResult, type TelegramUpdateJournalQueueHandoffInput, type TelegramUpdateJournalQueueHandoffOfferResult, type TelegramUpdateJournalQueueOwner, type TelegramUpdateJournalQueueOwnerIdentity } from "./journal.ts";
|
|
10
10
|
import { type PendingTelegramControlItem, type TelegramControlQueueHandoffPayload, type TelegramQueueAdmissionReceipt, type TelegramQueueHandoffPayload, type TelegramQueueHandoffStageResult, type TelegramQueueReactionDisposition, type TelegramQueueHandoffStagingRuntime, type TelegramQueueItem } from "./queue.ts";
|
|
11
11
|
import { type TelegramAuthorizationState, type TelegramUserPairingRuntimeDeps } from "./config.ts";
|
|
12
12
|
export interface TelegramReactionTypeEmoji {
|
|
@@ -68,7 +68,6 @@ export interface TelegramUpdateDeletion {
|
|
|
68
68
|
}
|
|
69
69
|
export declare function normalizeTelegramReactionEmoji(emoji: string): string;
|
|
70
70
|
export declare function collectTelegramReactionEmojis(reactions: TelegramReactionType[]): Set<string>;
|
|
71
|
-
export declare function getTelegramQueueReactionDisposition(reactions: TelegramReactionType[]): TelegramQueueReactionDisposition;
|
|
72
71
|
export declare function extractDeletedTelegramMessageIds(update: TelegramUpdateDeletion): number[];
|
|
73
72
|
export interface TelegramUser {
|
|
74
73
|
id: number;
|
|
@@ -108,6 +107,8 @@ export interface TelegramGuestMessage {
|
|
|
108
107
|
from?: TelegramUser;
|
|
109
108
|
message_id?: number;
|
|
110
109
|
text?: string;
|
|
110
|
+
/** Text sent together with a photo, document or other media. */
|
|
111
|
+
caption?: string;
|
|
111
112
|
reply_to_message?: TelegramUpdateMessage;
|
|
112
113
|
}
|
|
113
114
|
export declare function getTelegramMessageTarget(message: TelegramUpdateMessage): TelegramTarget | undefined;
|
|
@@ -147,18 +148,6 @@ export interface TelegramForeignOwnedUpdateForwarder<TContext, TReactionUpdate e
|
|
|
147
148
|
ctx: TContext;
|
|
148
149
|
}) => Promise<TelegramBusForeignUpdateSettlement> | TelegramBusForeignUpdateSettlement;
|
|
149
150
|
}
|
|
150
|
-
type TelegramForeignUpdateSettlementFailure = Exclude<TelegramBusForeignUpdateSettlement, {
|
|
151
|
-
status: "accepted";
|
|
152
|
-
}> | {
|
|
153
|
-
status: "terminal-rejected";
|
|
154
|
-
failureClass: "forwarder-unavailable";
|
|
155
|
-
message: string;
|
|
156
|
-
sourceUpdateId?: number;
|
|
157
|
-
};
|
|
158
|
-
export declare class TelegramForeignUpdateSettlementError extends Error {
|
|
159
|
-
readonly settlement: TelegramForeignUpdateSettlementFailure;
|
|
160
|
-
constructor(operation: string, settlement: TelegramForeignUpdateSettlementFailure);
|
|
161
|
-
}
|
|
162
151
|
export interface TelegramMessageReactionUpdated {
|
|
163
152
|
chat: {
|
|
164
153
|
id?: number;
|
|
@@ -177,26 +166,98 @@ export interface TelegramUpdateFlow extends TelegramUpdateRouting, TelegramUpdat
|
|
|
177
166
|
}
|
|
178
167
|
export type TelegramUpdateAdmissionOutcome = {
|
|
179
168
|
kind: "complete";
|
|
169
|
+
expectedSource?: TelegramDeferredSourceEvidence;
|
|
180
170
|
} | {
|
|
181
171
|
kind: "deferred";
|
|
172
|
+
routingReview?: true;
|
|
182
173
|
} | {
|
|
183
174
|
kind: "queued";
|
|
184
175
|
queueKind: "prompt" | "control";
|
|
185
176
|
receiptId: string;
|
|
186
177
|
sourceUpdateIds: readonly number[];
|
|
187
178
|
};
|
|
179
|
+
export type TelegramDeferredUpdateAbandonmentAuthority = Pick<TelegramUpdateJournalPendingAbandonmentInput, "operatorAuthorityId" | "isCurrent">;
|
|
180
|
+
export interface TelegramDeferredAbandonmentRecoveryRequest {
|
|
181
|
+
journalBindingKey: string;
|
|
182
|
+
afterUpdateId?: number;
|
|
183
|
+
isCurrent: () => boolean;
|
|
184
|
+
}
|
|
185
|
+
/** A generation-owned post-drain hint for the new-world restart; never execution, completion or deletion authority by itself. */
|
|
186
|
+
export interface TelegramHeldSourcePreparation<TContext> {
|
|
187
|
+
ctx: TContext;
|
|
188
|
+
journalBindingKey: string;
|
|
189
|
+
/** Exact prepared worker owner, context, key and authority; the consumer adds its own domain fences. */
|
|
190
|
+
isCurrent: () => boolean;
|
|
191
|
+
signal: AbortSignal;
|
|
192
|
+
/** Chooser-clock sources that must survive cold spending until their fixed expiry. */
|
|
193
|
+
routingSourceIds?: readonly number[];
|
|
194
|
+
}
|
|
195
|
+
export interface TelegramDeferredAbandonmentRecoveryPage {
|
|
196
|
+
sources: {
|
|
197
|
+
/** Detached original evidence, not proof of current eligibility or archive integrity. */
|
|
198
|
+
original: TelegramUpdateJournalEntry;
|
|
199
|
+
retry: (authority: TelegramDeferredUpdateAbandonmentAuthority) => TelegramUpdateJournalPendingAbandonmentResult | undefined;
|
|
200
|
+
}[];
|
|
201
|
+
nextAfterUpdateId?: number;
|
|
202
|
+
}
|
|
203
|
+
type TelegramHistoricalInputPredicate = (original: TelegramUpdateJournalEntry) => boolean;
|
|
204
|
+
/** Read-only exact-source observation by its live worker; not an acceptance or removal grant. */
|
|
205
|
+
export interface TelegramDeferredSourceEvidence extends TelegramUpdateJournalEntryDigest {
|
|
206
|
+
journalBindingKey: string;
|
|
207
|
+
/** Supplied only after caller-owned acceptance publication; requires a durable removal ACK. */
|
|
208
|
+
completionSha256?: string;
|
|
209
|
+
}
|
|
188
210
|
interface TelegramUpdateAdmissionBinding {
|
|
189
211
|
sourceUpdateId: number;
|
|
190
212
|
report: (outcome: TelegramUpdateAdmissionOutcome) => void;
|
|
213
|
+
abandon?: (authority: TelegramDeferredUpdateAbandonmentAuthority) => TelegramUpdateJournalPendingAbandonmentResult | undefined;
|
|
214
|
+
armRoutingInput?: (operatorUserId: number, sourceUpdateIds: readonly number[]) => TelegramUpdateJournalRoutingInput | undefined;
|
|
215
|
+
acquireRouting?: (select?: boolean, sourceUpdateIds?: readonly number[]) => () => void;
|
|
216
|
+
inspectSource?: () => TelegramDeferredSourceEvidence | undefined;
|
|
217
|
+
supportsAbandonment?: (journalBindingKey: string) => boolean;
|
|
218
|
+
inspectAbandoning?: (request: TelegramDeferredAbandonmentRecoveryRequest) => TelegramDeferredAbandonmentRecoveryPage | undefined;
|
|
219
|
+
inspectHistorical?: (request: TelegramDeferredAbandonmentRecoveryRequest) => TelegramDeferredAbandonmentRecoveryPage | undefined;
|
|
220
|
+
isHistorical?: (matchesOriginal?: TelegramHistoricalInputPredicate) => boolean;
|
|
221
|
+
isHistoricalReviewHeld?: () => boolean;
|
|
191
222
|
}
|
|
192
223
|
export type TelegramQueueAdmissionReceiptLike = TelegramQueueAdmissionReceipt;
|
|
193
224
|
export declare function bindTelegramUpdateAdmissionSource<TUpdate extends TelegramUpdateFlow & {
|
|
194
225
|
update_id: number;
|
|
195
|
-
}>(update: TUpdate, report: TelegramUpdateAdmissionBinding["report"]): TUpdate;
|
|
226
|
+
}>(update: TUpdate, report: TelegramUpdateAdmissionBinding["report"], controls?: Pick<TelegramUpdateAdmissionBinding, "abandon" | "armRoutingInput" | "acquireRouting" | "inspectSource" | "supportsAbandonment" | "inspectAbandoning" | "inspectHistorical" | "isHistorical" | "isHistoricalReviewHeld">): TUpdate;
|
|
227
|
+
/**
|
|
228
|
+
* Conservative read-only census: any retained entry naming this Thread, in any nested Telegram object or state,
|
|
229
|
+
* is unresolved custody. It cannot see updates still in transit before journal append.
|
|
230
|
+
*/
|
|
231
|
+
export declare function collectTelegramJournalThreadUpdateIds(entries: readonly {
|
|
232
|
+
updateId: number;
|
|
233
|
+
update: unknown;
|
|
234
|
+
}[], target: {
|
|
235
|
+
chatId: number;
|
|
236
|
+
threadId: number;
|
|
237
|
+
}): number[];
|
|
196
238
|
export declare function collectTelegramAdmissionSourceUpdateIds(values: readonly unknown[]): number[];
|
|
239
|
+
/** Observe the original journal entry, never the mutable routed carrier, through current worker authority. */
|
|
240
|
+
export declare function inspectTelegramDeferredSource(value: unknown): TelegramDeferredSourceEvidence | undefined;
|
|
241
|
+
/** A route-owned pre-disposition acceptance publisher; wraps only this carrier, never the shared worker binding. */
|
|
242
|
+
export declare function bindTelegramUpdateCompletionAcceptance<TValue>(value: TValue, publish: () => TelegramDeferredSourceEvidence): TValue;
|
|
197
243
|
/** Report source completion; true means reported, not a durable settlement acknowledgement. */
|
|
198
|
-
export declare function reportTelegramUpdateCompleted(value: unknown): boolean;
|
|
244
|
+
export declare function reportTelegramUpdateCompleted(value: unknown, expectedSource?: TelegramDeferredSourceEvidence): boolean;
|
|
199
245
|
export declare function reportTelegramUpdateDeferred(value: unknown): boolean;
|
|
246
|
+
/** Exact source-bound cancellation; undefined means no eligible attempt was made. */
|
|
247
|
+
export declare function abandonTelegramDeferredUpdate(value: unknown, authority: TelegramDeferredUpdateAbandonmentAuthority): TelegramUpdateJournalPendingAbandonmentResult | undefined;
|
|
248
|
+
/** Capability for chooser publication; the eventual action still requires exact deferred authority. */
|
|
249
|
+
export declare function supportsTelegramDeferredAbandonment(value: unknown, journalBindingKey: string): boolean;
|
|
250
|
+
/** Observe protected attempts through a current carrier; the UI still owns human authorization. */
|
|
251
|
+
export declare function inspectTelegramAbandoningUpdates(value: unknown, request: TelegramDeferredAbandonmentRecoveryRequest): TelegramDeferredAbandonmentRecoveryPage | undefined;
|
|
252
|
+
/** Historical inspection is not human confirmation or permission to stop delivery. */
|
|
253
|
+
export declare function inspectTelegramHistoricalInputs(value: unknown, request: TelegramDeferredAbandonmentRecoveryRequest): TelegramDeferredAbandonmentRecoveryPage | undefined;
|
|
254
|
+
export declare function isTelegramHistoricalInput(value: unknown, matchesOriginal?: TelegramHistoricalInputPredicate): boolean;
|
|
255
|
+
/** Routing's last-boundary hold when ownership changed after early classification. */
|
|
256
|
+
export declare function reportTelegramHistoricalRoutingReview(value: unknown): boolean;
|
|
257
|
+
/** Arm only a positively published chooser; the journal owns the immutable hour deadline. */
|
|
258
|
+
export declare function armTelegramRoutingInputs(values: readonly unknown[], operatorUserId: number): TelegramUpdateJournalRoutingInput | undefined;
|
|
259
|
+
/** Reserve source execution; an actual choice must also freeze its durable TTL before any effect. */
|
|
260
|
+
export declare function acquireTelegramUpdateRouting(value: unknown, select?: boolean, sourceUpdateIds?: readonly number[]): () => void;
|
|
200
261
|
export declare function reportTelegramQueueAdmission(values: readonly unknown[], receipts: readonly TelegramQueueAdmissionReceiptLike[]): boolean;
|
|
201
262
|
export type TelegramUpdateFlowAction<TReactionUpdate extends TelegramMessageReactionUpdated = TelegramMessageReactionUpdated, TCallbackQuery extends TelegramCallbackQuery = TelegramCallbackQuery, TMessage extends TelegramUpdateMessage = TelegramUpdateMessage, TGuestMessage extends TelegramGuestMessage = TelegramGuestMessage> = {
|
|
202
263
|
kind: "ignore";
|
|
@@ -367,9 +428,6 @@ export interface AuthorizedTelegramReactionUpdateDeps<TContext> {
|
|
|
367
428
|
}
|
|
368
429
|
export declare function handleAuthorizedTelegramReactionUpdate<TContext>(reactionUpdate: TelegramMessageReactionUpdated, deps: AuthorizedTelegramReactionUpdateDeps<TContext>): Promise<void>;
|
|
369
430
|
export declare function executeTelegramUpdatePlan<TContext = unknown, TReactionUpdate extends TelegramMessageReactionUpdated = TelegramMessageReactionUpdated, TCallbackQuery extends TelegramCallbackQuery = TelegramCallbackQuery, TMessage extends TelegramUpdateMessage = TelegramUpdateMessage>(plan: TelegramUpdateExecutionPlan<TReactionUpdate, TCallbackQuery, TMessage>, deps: TelegramUpdateRuntimeDeps<TContext, TReactionUpdate, TCallbackQuery, TMessage>): Promise<void>;
|
|
370
|
-
export declare const TELEGRAM_UPDATE_RETRY_BASE_DELAY_MS = 1000;
|
|
371
|
-
export declare const TELEGRAM_UPDATE_RETRY_MAX_DELAY_MS = 60000;
|
|
372
|
-
export declare const TELEGRAM_UPDATE_WORKER_BATCH_SIZE = 64;
|
|
373
431
|
export type TelegramUpdateWorkerPhase = "stopped" | "idle" | "executing" | "retry-wait" | "failed" | "deferred" | "queued" | "blocked";
|
|
374
432
|
export type TelegramUpdateWorkerBlockedReason = "authority-lost" | "authority-check" | "journal-read" | "journal-write" | "execution" | "input-custody" | "prior-generation-executing" | "invalid-outcome";
|
|
375
433
|
export interface TelegramUpdateWorkerStateSnapshot {
|
|
@@ -386,6 +444,10 @@ export interface TelegramUpdateWorkerStateSnapshot {
|
|
|
386
444
|
journalSerializedBytes: number;
|
|
387
445
|
oldestAdmittedAtMs?: number;
|
|
388
446
|
deferredClaimCount: number;
|
|
447
|
+
/** Protected cancellation attempts, not proof of a committed discard. */
|
|
448
|
+
abandoningClaimCount?: number;
|
|
449
|
+
/** Historical sources held before routing, not evidence of prior non-delivery. */
|
|
450
|
+
historicalClaimCount?: number;
|
|
389
451
|
queuedClaimCount: number;
|
|
390
452
|
foreignQueuedCount: number;
|
|
391
453
|
foreignQueuedOwner?: TelegramUpdateJournalQueueOwner;
|
|
@@ -416,6 +478,7 @@ export interface TelegramUpdateWorkerJournalSnapshot {
|
|
|
416
478
|
update: TelegramJournaledUpdate;
|
|
417
479
|
readonly preApprovalExcluded?: boolean;
|
|
418
480
|
admittedAtMs: number;
|
|
481
|
+
routingInput?: TelegramUpdateJournalRoutingInput;
|
|
419
482
|
state: "pending" | "retry-wait" | "queued" | "failed";
|
|
420
483
|
inputClaim?: TelegramUpdateJournalInputClaim;
|
|
421
484
|
queueKind?: "prompt" | "control";
|
|
@@ -439,10 +502,21 @@ export interface TelegramUpdateWorkerJournalSnapshot {
|
|
|
439
502
|
}[];
|
|
440
503
|
serializedBytes: number;
|
|
441
504
|
}
|
|
505
|
+
export interface TelegramRoutingInputExpirySource {
|
|
506
|
+
original: TelegramUpdateJournalEntry;
|
|
507
|
+
journalBindingKey: string;
|
|
508
|
+
isCurrent(): boolean;
|
|
509
|
+
expire(): TelegramRoutingInputExpiryResult | undefined;
|
|
510
|
+
}
|
|
442
511
|
export interface TelegramUpdateWorkerJournalPort {
|
|
512
|
+
routingInputs?: TelegramRoutingInputJournal;
|
|
443
513
|
read: () => TelegramUpdateWorkerJournalSnapshot;
|
|
514
|
+
inspectPendingRetention?: (entry: TelegramUpdateJournalEntry) => TelegramUpdateJournalPendingRetentionEvidence | undefined;
|
|
515
|
+
abandonPending?: (input: TelegramUpdateJournalPendingAbandonmentInput) => TelegramUpdateJournalPendingAbandonmentResult;
|
|
444
516
|
/** Optional strict observation; it must not recover, repair or grant new receipt authority. */
|
|
445
517
|
isQueueReceiptCurrent?: (receipt: TelegramQueueAdmissionReceiptLike, owner: TelegramUpdateJournalQueueOwner) => boolean;
|
|
518
|
+
/** Strict full-group origin observation for prepared partial scopes; no writer or readiness acquisition. */
|
|
519
|
+
inspectQueuedReceipt?: (expected: TelegramUpdateJournalQueuedCompletion) => TelegramUpdateJournalQueuedReceiptEvidence | undefined;
|
|
446
520
|
markQueued: (receipt: {
|
|
447
521
|
queueKind: "prompt" | "control";
|
|
448
522
|
receiptId: string;
|
|
@@ -461,6 +535,15 @@ export interface TelegramUpdateWorkerJournalPort {
|
|
|
461
535
|
}[]) => {
|
|
462
536
|
removedUpdateIds: readonly number[];
|
|
463
537
|
};
|
|
538
|
+
completeQueuedExact?: (receipts: readonly {
|
|
539
|
+
queueKind: "prompt" | "control";
|
|
540
|
+
receiptId: string;
|
|
541
|
+
sourceUpdateIds: readonly number[];
|
|
542
|
+
queueOwner: TelegramUpdateJournalQueueOwner;
|
|
543
|
+
}[], completions: readonly TelegramUpdateJournalSourceCompletion[]) => {
|
|
544
|
+
removedUpdateIds: readonly number[];
|
|
545
|
+
sourceCompletions?: readonly TelegramUpdateJournalSourceCompletion[];
|
|
546
|
+
};
|
|
464
547
|
markExecutionFailure: (input: {
|
|
465
548
|
updateId: number;
|
|
466
549
|
expectedAttemptCount: number;
|
|
@@ -476,7 +559,16 @@ export interface TelegramUpdateWorkerJournalPort {
|
|
|
476
559
|
removeCompleted: (updateIds: readonly number[]) => {
|
|
477
560
|
removedUpdateIds: readonly number[];
|
|
478
561
|
};
|
|
562
|
+
/** No ID-only fallback is allowed for a guarded completion report. */
|
|
563
|
+
removeCompletedExact?: (updateIds: readonly number[], expectedSources: readonly TelegramUpdateJournalEntryDigest[], completions?: readonly TelegramUpdateJournalSourceCompletion[]) => {
|
|
564
|
+
removedUpdateIds: readonly number[];
|
|
565
|
+
sourceCompletions?: readonly TelegramUpdateJournalSourceCompletion[];
|
|
566
|
+
};
|
|
567
|
+
inspectSourceCompletion?: (expected: TelegramUpdateJournalSourceCompletion) => TelegramUpdateJournalSourceCompletion | undefined;
|
|
479
568
|
}
|
|
569
|
+
export type TelegramQueueSourceCompletion = TelegramDeferredSourceEvidence & {
|
|
570
|
+
completionSha256: string;
|
|
571
|
+
};
|
|
480
572
|
export interface TelegramUpdateRetryPolicy {
|
|
481
573
|
baseDelayMs: number;
|
|
482
574
|
maxDelayMs: number;
|
|
@@ -493,10 +585,17 @@ export interface TelegramUpdateWorkerRuntimeDeps<TContext> {
|
|
|
493
585
|
hasAuthority: (ctx: TContext) => boolean;
|
|
494
586
|
getJournalBindingKey?: () => string | undefined;
|
|
495
587
|
getRecipientBindingKey?: () => string | undefined;
|
|
588
|
+
/** True selects legacy historical review/spending; retain protects unsupported originals without disposition authority. */
|
|
589
|
+
shouldReviewHistoricalInput?: (entry: TelegramUpdateJournalEntry, ctx: TContext, signal: AbortSignal) => boolean | "retain" | Promise<boolean | "retain">;
|
|
590
|
+
/** New-world restart: spend unclocked classified routing input without delivery, copy or completion. Chooser clocks wait for expiry; interrupted private abandonment keeps exact recovery. */
|
|
591
|
+
spendHistoricalInput?: boolean;
|
|
592
|
+
/** Holds protected live or retry sources before execution; never cancels or disposes them. */
|
|
593
|
+
shouldHoldPendingInput?: (entry: TelegramUpdateJournalEntry, ctx: TContext, signal: AbortSignal) => boolean | Promise<boolean>;
|
|
496
594
|
getQueueOwnerIdentity?: (ctx: TContext) => TelegramUpdateJournalQueueOwnerIdentity;
|
|
497
595
|
isContextCurrent?: (ctx: TContext) => boolean;
|
|
498
596
|
createAbortController?: () => AbortController;
|
|
499
597
|
getNowMs?: () => number;
|
|
598
|
+
expireRoutingInput?: (source: TelegramRoutingInputExpirySource, ctx: TContext, signal: AbortSignal) => Promise<void> | void;
|
|
500
599
|
retryPolicy?: Partial<TelegramUpdateRetryPolicy>;
|
|
501
600
|
classifyExecutionFailure?: (error: unknown) => TelegramUpdateExecutionFailureClassification;
|
|
502
601
|
settleTerminalExecutionFailure?: (error: unknown) => Promise<boolean>;
|
|
@@ -505,8 +604,14 @@ export interface TelegramUpdateWorkerRuntimeDeps<TContext> {
|
|
|
505
604
|
batchSize?: number;
|
|
506
605
|
yieldToEventLoop?: () => Promise<void>;
|
|
507
606
|
onStateChange?: (state: TelegramUpdateWorkerStateSnapshot) => void;
|
|
607
|
+
/** One nonblocking hint after a quiescent validated startup projection, never execution or deletion authority. */
|
|
608
|
+
onHeldSourcesPrepared?: (input: TelegramHeldSourcePreparation<TContext>) => Promise<void> | void;
|
|
609
|
+
/** Prepared readiness barrier after durable queue admission; never authorizes replay or source removal. */
|
|
610
|
+
beforeQueueReceiptPublished?: (receipt: TelegramQueueAdmissionReceiptLike, queueOwner: TelegramUpdateJournalQueueOwner, ctx: TContext, isCurrent: () => boolean) => Promise<void | readonly TelegramQueueSourceCompletion[]> | void | readonly TelegramQueueSourceCompletion[];
|
|
611
|
+
/** Post-ACK hint only; it must not request Pi dispatch or inherit a Workspace admission lease. */
|
|
612
|
+
onQueueReceiptCompleted?: (receipt: TelegramQueueAdmissionReceiptLike, ctx: TContext) => void;
|
|
508
613
|
onQueueReceiptCommitted?: (receipt: TelegramQueueAdmissionReceiptLike, ctx: TContext) => void;
|
|
509
|
-
onUpdateCompleted?: (updateId: number, ctx: TContext) => void;
|
|
614
|
+
onUpdateCompleted?: (updateId: number, ctx: TContext, journalBindingKey?: string) => void;
|
|
510
615
|
recordRuntimeEvent?: (category: string, error: unknown, details?: Record<string, unknown>) => void;
|
|
511
616
|
}
|
|
512
617
|
export type TelegramQueueReceiptCompletionReason = "prompt-handoff" | "control-settlement" | "discard";
|
|
@@ -518,6 +623,46 @@ export interface TelegramUpdateWorkerRuntime<TContext> {
|
|
|
518
623
|
outcome: TelegramUpdateAdmissionOutcome;
|
|
519
624
|
signal: AbortSignal;
|
|
520
625
|
}) => void;
|
|
626
|
+
armRoutingInput?: (input: {
|
|
627
|
+
updateId: number;
|
|
628
|
+
signal: AbortSignal;
|
|
629
|
+
operatorUserId: number;
|
|
630
|
+
sourceUpdateIds: readonly number[];
|
|
631
|
+
}) => TelegramUpdateJournalRoutingInput | undefined;
|
|
632
|
+
selectRoutingInput?: (input: {
|
|
633
|
+
updateId: number;
|
|
634
|
+
signal: AbortSignal;
|
|
635
|
+
operatorUserId: number;
|
|
636
|
+
sourceUpdateIds: readonly number[];
|
|
637
|
+
}) => boolean;
|
|
638
|
+
isRoutingInputCurrent?: (input: {
|
|
639
|
+
updateId: number;
|
|
640
|
+
signal: AbortSignal;
|
|
641
|
+
}) => boolean;
|
|
642
|
+
supportsDeferredAbandonment?: (input: {
|
|
643
|
+
updateId: number;
|
|
644
|
+
signal: AbortSignal;
|
|
645
|
+
journalBindingKey: string;
|
|
646
|
+
}) => boolean;
|
|
647
|
+
inspectAbandoning?: (input: TelegramDeferredAbandonmentRecoveryRequest & {
|
|
648
|
+
signal: AbortSignal;
|
|
649
|
+
}) => TelegramDeferredAbandonmentRecoveryPage | undefined;
|
|
650
|
+
inspectHistorical?: (input: TelegramDeferredAbandonmentRecoveryRequest & {
|
|
651
|
+
signal: AbortSignal;
|
|
652
|
+
}) => TelegramDeferredAbandonmentRecoveryPage | undefined;
|
|
653
|
+
inspectDeferredSource?: (input: {
|
|
654
|
+
updateId: number;
|
|
655
|
+
signal: AbortSignal;
|
|
656
|
+
}) => TelegramDeferredSourceEvidence | undefined;
|
|
657
|
+
isHistoricalSource?: (input: {
|
|
658
|
+
updateId: number;
|
|
659
|
+
signal: AbortSignal;
|
|
660
|
+
matchesOriginal?: TelegramHistoricalInputPredicate;
|
|
661
|
+
}) => boolean;
|
|
662
|
+
abandonDeferred?: (input: TelegramDeferredUpdateAbandonmentAuthority & {
|
|
663
|
+
updateId: number;
|
|
664
|
+
signal: AbortSignal;
|
|
665
|
+
}) => TelegramUpdateJournalPendingAbandonmentResult | undefined;
|
|
521
666
|
settleCustodied: (input: {
|
|
522
667
|
updateId: number;
|
|
523
668
|
result: TelegramCustodiedExecutionResult;
|
|
@@ -525,18 +670,19 @@ export interface TelegramUpdateWorkerRuntime<TContext> {
|
|
|
525
670
|
}) => void;
|
|
526
671
|
isQueueReceiptCommitted: (receipt: TelegramQueueAdmissionReceiptLike) => boolean;
|
|
527
672
|
getQueueReceiptOwner: (receipt: TelegramQueueAdmissionReceiptLike) => TelegramUpdateJournalQueueOwner | undefined;
|
|
673
|
+
/** Completion-only owner observation; issued attempts are never dispatch readiness. */
|
|
674
|
+
getQueueReceiptSettlementOwner?: (receipt: TelegramQueueAdmissionReceiptLike, ctx: TContext, reason: TelegramQueueReceiptCompletionReason) => TelegramUpdateJournalQueueOwner | undefined;
|
|
528
675
|
completeQueueReceipts: (input: {
|
|
529
676
|
receipts: readonly TelegramQueueAdmissionReceiptLike[];
|
|
530
677
|
ctx: TContext;
|
|
531
678
|
reason: TelegramQueueReceiptCompletionReason;
|
|
679
|
+
/** Prepared immutable scopes for every source; the exact receipt owner still authorizes disposal. */
|
|
680
|
+
sourceCompletions?: readonly TelegramQueueSourceCompletion[];
|
|
532
681
|
}) => boolean;
|
|
533
682
|
stop: () => Promise<void>;
|
|
534
683
|
waitForDrain: () => Promise<void>;
|
|
535
684
|
getState: () => TelegramUpdateWorkerStateSnapshot;
|
|
536
685
|
}
|
|
537
|
-
export declare class TelegramUpdateAdmissionOutcomeError extends Error {
|
|
538
|
-
constructor(message: string);
|
|
539
|
-
}
|
|
540
686
|
export declare function createTelegramUpdateWorkerRuntime<TContext>(deps: TelegramUpdateWorkerRuntimeDeps<TContext>): TelegramUpdateWorkerRuntime<TContext>;
|
|
541
687
|
/**
|
|
542
688
|
* Verdict returned by a public Telegram update handler.
|
|
@@ -601,6 +747,15 @@ export interface TelegramUpdateAdmissionHandleDeps<TUpdate extends TelegramUpdat
|
|
|
601
747
|
signal: AbortSignal;
|
|
602
748
|
}) => void | Promise<void>;
|
|
603
749
|
onLateOutcomeError?: (error: unknown, updateId: number) => void;
|
|
750
|
+
abandonDeferred?: TelegramUpdateWorkerRuntime<TContext>["abandonDeferred"];
|
|
751
|
+
armRoutingInput?: TelegramUpdateWorkerRuntime<TContext>["armRoutingInput"];
|
|
752
|
+
selectRoutingInput?: TelegramUpdateWorkerRuntime<TContext>["selectRoutingInput"];
|
|
753
|
+
isRoutingInputCurrent?: TelegramUpdateWorkerRuntime<TContext>["isRoutingInputCurrent"];
|
|
754
|
+
supportsDeferredAbandonment?: TelegramUpdateWorkerRuntime<TContext>["supportsDeferredAbandonment"];
|
|
755
|
+
inspectAbandoning?: TelegramUpdateWorkerRuntime<TContext>["inspectAbandoning"];
|
|
756
|
+
inspectHistorical?: TelegramUpdateWorkerRuntime<TContext>["inspectHistorical"];
|
|
757
|
+
inspectDeferredSource?: TelegramUpdateWorkerRuntime<TContext>["inspectDeferredSource"];
|
|
758
|
+
isHistoricalSource?: TelegramUpdateWorkerRuntime<TContext>["isHistoricalSource"];
|
|
604
759
|
}
|
|
605
760
|
export type TelegramCustodiedExecutionResult = {
|
|
606
761
|
status: "completed";
|
|
@@ -987,7 +1142,7 @@ export declare function executeTelegramCustodiedInput(input: {
|
|
|
987
1142
|
export declare function createTelegramUpdateAdmissionHandle<TUpdate extends TelegramUpdateFlow & {
|
|
988
1143
|
update_id: number;
|
|
989
1144
|
}, TContext>(deps: TelegramUpdateAdmissionHandleDeps<TUpdate, TContext>): (update: TUpdate, ctx: TContext, signal: AbortSignal) => Promise<TelegramUpdateAdmissionOutcome>;
|
|
990
|
-
export declare function createTelegramCustodiedUpdateAdmissionHandle<TUpdate extends TelegramJournaledUpdate & TelegramUpdateFlow, TContext>(deps: Omit<TelegramUpdateAdmissionHandleDeps<TUpdate, TContext>, "onLateOutcome" | "onLateOutcomeError"> & {
|
|
1145
|
+
export declare function createTelegramCustodiedUpdateAdmissionHandle<TUpdate extends TelegramJournaledUpdate & TelegramUpdateFlow, TContext>(deps: Omit<TelegramUpdateAdmissionHandleDeps<TUpdate, TContext>, "onLateOutcome" | "onLateOutcomeError" | "abandonDeferred" | "armRoutingInput" | "selectRoutingInput" | "isRoutingInputCurrent" | "supportsDeferredAbandonment" | "inspectAbandoning" | "inspectHistorical" | "inspectDeferredSource" | "isHistoricalSource"> & {
|
|
991
1146
|
journal: TelegramCustodyExecutionJournal;
|
|
992
1147
|
recipientBindingKey: string;
|
|
993
1148
|
onLateOutcomeError(error: unknown, updateId: number): void;
|
|
@@ -1001,6 +1156,7 @@ export interface TelegramQueueAdmissionItemLike {
|
|
|
1001
1156
|
}
|
|
1002
1157
|
export interface TelegramQueueAdmissionSettlementRuntime<TContext> {
|
|
1003
1158
|
isItemReady: (item: TelegramQueueAdmissionItemLike) => boolean;
|
|
1159
|
+
getQueueReceiptSettlementOwner?: (receipt: TelegramQueueAdmissionReceiptLike, ctx: TContext, reason: TelegramQueueReceiptCompletionReason) => TelegramUpdateJournalQueueOwner | undefined;
|
|
1004
1160
|
getQueueReceiptOwner: (receipt: TelegramQueueAdmissionReceiptLike) => TelegramUpdateJournalQueueOwner | undefined;
|
|
1005
1161
|
onPromptHandedOff: (item: TelegramQueueAdmissionItemLike, ctx: TContext) => boolean;
|
|
1006
1162
|
onControlSettled: (item: TelegramQueueAdmissionItemLike, ctx: TContext) => boolean;
|
|
@@ -1125,7 +1281,7 @@ export interface TelegramQueueHandoffReconciliationRuntimeAssemblyDeps<TContext>
|
|
|
1125
1281
|
isBusEnabled: () => boolean;
|
|
1126
1282
|
canHandoffWithLeader?: () => boolean;
|
|
1127
1283
|
listFollowers: () => readonly TelegramBusFollowerView[];
|
|
1128
|
-
createRecipientJournalResolver: (profileKey: string) => (() => {
|
|
1284
|
+
createRecipientJournalResolver: (profileKey: string, sessionId: string) => (() => {
|
|
1129
1285
|
recoveryKey: string;
|
|
1130
1286
|
} | undefined);
|
|
1131
1287
|
queueStore: {
|
|
@@ -1167,6 +1323,8 @@ export interface TelegramUpdateAdmissionLifecycleRuntimeDeps<TContext> {
|
|
|
1167
1323
|
getQueueOwnerIdentity?: (ctx: TContext) => TelegramUpdateJournalQueueOwnerIdentity;
|
|
1168
1324
|
createWorker: (journal: TelegramUpdateWorkerJournalPort, binding: TelegramUpdateAdmissionLifecycleJournalBinding) => TelegramUpdateWorkerRuntime<TContext>;
|
|
1169
1325
|
acquireSourceReference?: (binding: TelegramUpdateAdmissionLifecycleJournalBinding) => () => void;
|
|
1326
|
+
/** Runs after the previous worker stopped and before the replacement worker exists; throwing refuses binding. */
|
|
1327
|
+
prepareBinding?: (binding: TelegramUpdateAdmissionLifecycleJournalBinding) => void;
|
|
1170
1328
|
recordRuntimeEvent?: TelegramUpdateWorkerRuntimeDeps<TContext>["recordRuntimeEvent"];
|
|
1171
1329
|
}
|
|
1172
1330
|
export interface TelegramUpdateAdmissionLifecycleRuntime<TContext> extends TelegramQueueAdmissionSettlementRuntime<TContext> {
|
|
@@ -1207,8 +1365,8 @@ export interface TelegramUpdateAdmissionLifecycleRuntime<TContext> extends Teleg
|
|
|
1207
1365
|
}
|
|
1208
1366
|
export interface TelegramUpdateWorkerOwnerRuntime<TContext> {
|
|
1209
1367
|
getQueueOwnerIdentity: () => TelegramUpdateJournalQueueOwnerIdentity;
|
|
1210
|
-
onQueueReceiptCommitted: (receipt:
|
|
1211
|
-
onUpdateCompleted: (updateId: number, ctx: TContext) => void;
|
|
1368
|
+
onQueueReceiptCommitted: (receipt: TelegramQueueAdmissionReceiptLike, ctx: TContext) => void;
|
|
1369
|
+
onUpdateCompleted: (updateId: number, ctx: TContext, journalBindingKey?: string) => void;
|
|
1212
1370
|
}
|
|
1213
1371
|
export interface TelegramUpdateWorkerOwnerRuntimeDeps<TContext> {
|
|
1214
1372
|
instanceId: string;
|
|
@@ -1218,7 +1376,8 @@ export interface TelegramUpdateWorkerOwnerRuntimeDeps<TContext> {
|
|
|
1218
1376
|
isContextCurrent: (ctx: TContext) => boolean;
|
|
1219
1377
|
dispatchNext: (ctx: TContext) => void;
|
|
1220
1378
|
requestQueueHandoffReconciliation: (ctx: TContext) => void;
|
|
1221
|
-
|
|
1379
|
+
afterQueueReceiptCommitted?: (receipt: TelegramQueueAdmissionReceiptLike, ctx: TContext) => void;
|
|
1380
|
+
afterUpdateCompleted?: (updateId: number, ctx: TContext, journalBindingKey?: string) => void;
|
|
1222
1381
|
}
|
|
1223
1382
|
export declare function createTelegramUpdateWorkerOwnerRuntime<TContext>(deps: TelegramUpdateWorkerOwnerRuntimeDeps<TContext>): TelegramUpdateWorkerOwnerRuntime<TContext>;
|
|
1224
1383
|
export interface TelegramUpdateAdmissionRuntimeBinding<TContext> {
|
|
@@ -1259,6 +1418,10 @@ export interface TelegramUpdateAdmissionLifecycleAssemblyDeps<TUpdate extends Te
|
|
|
1259
1418
|
isRegistered: () => boolean;
|
|
1260
1419
|
getGeneration: () => string | undefined;
|
|
1261
1420
|
prepareUpdateForExecution: (update: TUpdate) => TUpdate;
|
|
1421
|
+
/** Session succession before worker creation, under the exact generation-fenced binding. */
|
|
1422
|
+
prepareBinding?: (binding: TelegramUpdateAdmissionLifecycleJournalBinding & {
|
|
1423
|
+
hasAuthority?: () => boolean;
|
|
1424
|
+
}) => void;
|
|
1262
1425
|
};
|
|
1263
1426
|
recordRuntimeEvent?: TelegramUpdateWorkerRuntimeDeps<TContext>["recordRuntimeEvent"];
|
|
1264
1427
|
}
|