@llblab/pi-kit 0.27.6 → 0.28.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.
- package/BACKLOG.md +2 -5
- package/CHANGELOG.md +5 -0
- package/README.md +2 -2
- package/node_modules/@llblab/pi-telegram/AGENTS.md +10 -8
- package/node_modules/@llblab/pi-telegram/BACKLOG.md +1 -9
- package/node_modules/@llblab/pi-telegram/CHANGELOG.md +13 -0
- package/node_modules/@llblab/pi-telegram/LICENSE +21 -0
- package/node_modules/@llblab/pi-telegram/README.md +15 -5
- package/node_modules/@llblab/pi-telegram/dist/lib/activity-verbosity.d.ts +1 -5
- package/node_modules/@llblab/pi-telegram/dist/lib/activity-verbosity.js +5 -7
- package/node_modules/@llblab/pi-telegram/dist/lib/bindings.d.ts +5 -1
- package/node_modules/@llblab/pi-telegram/dist/lib/bindings.js +6 -1
- package/node_modules/@llblab/pi-telegram/dist/lib/bus-api.js +4 -2
- package/node_modules/@llblab/pi-telegram/dist/lib/bus-follower.d.ts +54 -56
- package/node_modules/@llblab/pi-telegram/dist/lib/bus-follower.js +206 -139
- package/node_modules/@llblab/pi-telegram/dist/lib/bus-leader.d.ts +21 -2
- package/node_modules/@llblab/pi-telegram/dist/lib/bus-leader.js +181 -25
- package/node_modules/@llblab/pi-telegram/dist/lib/bus-transport.d.ts +4 -1
- package/node_modules/@llblab/pi-telegram/dist/lib/bus-transport.js +28 -4
- package/node_modules/@llblab/pi-telegram/dist/lib/bus.d.ts +52 -56
- package/node_modules/@llblab/pi-telegram/dist/lib/bus.js +78 -246
- package/node_modules/@llblab/pi-telegram/dist/lib/channel-posts.d.ts +1 -3
- package/node_modules/@llblab/pi-telegram/dist/lib/channel-posts.js +23 -26
- package/node_modules/@llblab/pi-telegram/dist/lib/command-templates.d.ts +0 -5
- package/node_modules/@llblab/pi-telegram/dist/lib/command-templates.js +5 -5
- package/node_modules/@llblab/pi-telegram/dist/lib/commands.d.ts +0 -23
- package/node_modules/@llblab/pi-telegram/dist/lib/commands.js +15 -15
- package/node_modules/@llblab/pi-telegram/dist/lib/config.d.ts +0 -17
- package/node_modules/@llblab/pi-telegram/dist/lib/config.js +12 -14
- package/node_modules/@llblab/pi-telegram/dist/lib/delivery.d.ts +0 -4
- package/node_modules/@llblab/pi-telegram/dist/lib/delivery.js +2 -5
- package/node_modules/@llblab/pi-telegram/dist/lib/extension.js +255 -61
- package/node_modules/@llblab/pi-telegram/dist/lib/generative-apps.d.ts +0 -19
- package/node_modules/@llblab/pi-telegram/dist/lib/inbound.d.ts +0 -2
- package/node_modules/@llblab/pi-telegram/dist/lib/inbound.js +2 -2
- package/node_modules/@llblab/pi-telegram/dist/lib/journal.d.ts +177 -16
- package/node_modules/@llblab/pi-telegram/dist/lib/journal.js +1115 -249
- package/node_modules/@llblab/pi-telegram/dist/lib/keyboard.d.ts +0 -2
- package/node_modules/@llblab/pi-telegram/dist/lib/keyboard.js +2 -2
- package/node_modules/@llblab/pi-telegram/dist/lib/lifecycle.js +1 -1
- package/node_modules/@llblab/pi-telegram/dist/lib/locks.d.ts +100 -12
- package/node_modules/@llblab/pi-telegram/dist/lib/locks.js +380 -14
- package/node_modules/@llblab/pi-telegram/dist/lib/logging.d.ts +30 -12
- package/node_modules/@llblab/pi-telegram/dist/lib/logging.js +129 -72
- package/node_modules/@llblab/pi-telegram/dist/lib/media.d.ts +28 -5
- package/node_modules/@llblab/pi-telegram/dist/lib/media.js +26 -8
- package/node_modules/@llblab/pi-telegram/dist/lib/menu-model.d.ts +0 -11
- package/node_modules/@llblab/pi-telegram/dist/lib/menu-model.js +8 -8
- package/node_modules/@llblab/pi-telegram/dist/lib/menu-settings.d.ts +0 -18
- package/node_modules/@llblab/pi-telegram/dist/lib/menu-settings.js +18 -18
- package/node_modules/@llblab/pi-telegram/dist/lib/menu-status.d.ts +4 -4
- package/node_modules/@llblab/pi-telegram/dist/lib/menu-status.js +12 -7
- package/node_modules/@llblab/pi-telegram/dist/lib/menu-thinking.d.ts +1 -1
- package/node_modules/@llblab/pi-telegram/dist/lib/menu-thinking.js +1 -1
- package/node_modules/@llblab/pi-telegram/dist/lib/menu.d.ts +1 -0
- package/node_modules/@llblab/pi-telegram/dist/lib/menu.js +4 -3
- package/node_modules/@llblab/pi-telegram/dist/lib/outbound-attachments.d.ts +0 -1
- package/node_modules/@llblab/pi-telegram/dist/lib/outbound-attachments.js +1 -1
- package/node_modules/@llblab/pi-telegram/dist/lib/outbound-buttons.js +1 -8
- package/node_modules/@llblab/pi-telegram/dist/lib/outbound-markup.d.ts +1 -6
- package/node_modules/@llblab/pi-telegram/dist/lib/outbound-markup.js +4 -21
- package/node_modules/@llblab/pi-telegram/dist/lib/outbound.d.ts +0 -8
- package/node_modules/@llblab/pi-telegram/dist/lib/outbound.js +5 -5
- package/node_modules/@llblab/pi-telegram/dist/lib/paths.d.ts +50 -7
- package/node_modules/@llblab/pi-telegram/dist/lib/paths.js +155 -17
- package/node_modules/@llblab/pi-telegram/dist/lib/pi.d.ts +1 -0
- package/node_modules/@llblab/pi-telegram/dist/lib/pi.js +2 -1
- package/node_modules/@llblab/pi-telegram/dist/lib/polling.d.ts +0 -5
- package/node_modules/@llblab/pi-telegram/dist/lib/polling.js +5 -5
- package/node_modules/@llblab/pi-telegram/dist/lib/preview.d.ts +0 -3
- package/node_modules/@llblab/pi-telegram/dist/lib/preview.js +3 -3
- package/node_modules/@llblab/pi-telegram/dist/lib/prompt-templates.d.ts +0 -1
- package/node_modules/@llblab/pi-telegram/dist/lib/prompt-templates.js +1 -1
- package/node_modules/@llblab/pi-telegram/dist/lib/queue.d.ts +3 -15
- package/node_modules/@llblab/pi-telegram/dist/lib/queue.js +69 -8
- package/node_modules/@llblab/pi-telegram/dist/lib/recovery.d.ts +29 -9
- package/node_modules/@llblab/pi-telegram/dist/lib/recovery.js +104 -33
- package/node_modules/@llblab/pi-telegram/dist/lib/replies.d.ts +0 -4
- package/node_modules/@llblab/pi-telegram/dist/lib/replies.js +1 -1
- package/node_modules/@llblab/pi-telegram/dist/lib/routing.d.ts +73 -8
- package/node_modules/@llblab/pi-telegram/dist/lib/routing.js +2206 -307
- package/node_modules/@llblab/pi-telegram/dist/lib/sections.d.ts +0 -2
- package/node_modules/@llblab/pi-telegram/dist/lib/sections.js +1 -1
- package/node_modules/@llblab/pi-telegram/dist/lib/status.d.ts +44 -9
- package/node_modules/@llblab/pi-telegram/dist/lib/status.js +149 -27
- package/node_modules/@llblab/pi-telegram/dist/lib/sync.d.ts +0 -5
- package/node_modules/@llblab/pi-telegram/dist/lib/sync.js +5 -4
- package/node_modules/@llblab/pi-telegram/dist/lib/telegram-api.d.ts +11 -3
- package/node_modules/@llblab/pi-telegram/dist/lib/telegram-api.js +34 -23
- package/node_modules/@llblab/pi-telegram/dist/lib/thread-cleanup-manager.d.ts +1 -0
- package/node_modules/@llblab/pi-telegram/dist/lib/thread-cleanup-manager.js +18 -21
- package/node_modules/@llblab/pi-telegram/dist/lib/thread-naming.d.ts +32 -5
- package/node_modules/@llblab/pi-telegram/dist/lib/thread-naming.js +191 -7
- package/node_modules/@llblab/pi-telegram/dist/lib/thread-reconciler.d.ts +2 -0
- package/node_modules/@llblab/pi-telegram/dist/lib/thread-reconciler.js +1 -1
- package/node_modules/@llblab/pi-telegram/dist/lib/threads.d.ts +291 -59
- package/node_modules/@llblab/pi-telegram/dist/lib/threads.js +1647 -369
- package/node_modules/@llblab/pi-telegram/dist/lib/turns.d.ts +0 -1
- package/node_modules/@llblab/pi-telegram/dist/lib/turns.js +1 -1
- package/node_modules/@llblab/pi-telegram/dist/lib/updates.d.ts +184 -28
- package/node_modules/@llblab/pi-telegram/dist/lib/updates.js +1032 -114
- package/node_modules/@llblab/pi-telegram/dist/lib/wire.d.ts +12 -0
- package/node_modules/@llblab/pi-telegram/dist/lib/wire.js +21 -0
- package/node_modules/@llblab/pi-telegram/dist/lib/workspace-admission.d.ts +25 -17
- package/node_modules/@llblab/pi-telegram/dist/lib/workspace-admission.js +95 -20
- package/node_modules/@llblab/pi-telegram/dist/lib/workspace-identity.d.ts +20 -0
- package/node_modules/@llblab/pi-telegram/dist/lib/workspace-identity.js +103 -0
- package/node_modules/@llblab/pi-telegram/dist/lib/workspace-retirement.d.ts +43 -8
- package/node_modules/@llblab/pi-telegram/dist/lib/workspace-retirement.js +148 -52
- package/node_modules/@llblab/pi-telegram/dist/package.json +6 -6
- package/node_modules/@llblab/pi-telegram/dist/skills/generated-control-surface/SKILL.md +3 -3
- package/node_modules/@llblab/pi-telegram/dist/skills/telegram-bridge/references/diagnosis.md +3 -3
- package/node_modules/@llblab/pi-telegram/docs/README.md +1 -1
- package/node_modules/@llblab/pi-telegram/docs/activity.md +1 -1
- package/node_modules/@llblab/pi-telegram/docs/architecture.md +152 -34
- package/node_modules/@llblab/pi-telegram/docs/callback-namespaces.md +1 -1
- package/node_modules/@llblab/pi-telegram/docs/delivery.md +1 -1
- package/node_modules/@llblab/pi-telegram/docs/generative-apps.md +2 -2
- package/node_modules/@llblab/pi-telegram/docs/inbound.md +1 -1
- package/node_modules/@llblab/pi-telegram/docs/multi-instance-bus.md +125 -19
- package/node_modules/@llblab/pi-telegram/docs/public-api.md +3 -1
- package/node_modules/@llblab/pi-telegram/docs/ui-style.md +22 -8
- package/node_modules/@llblab/pi-telegram/docs/updates.md +1 -1
- package/node_modules/@llblab/pi-telegram/lib/activity-verbosity.ts +5 -9
- package/node_modules/@llblab/pi-telegram/lib/bindings.ts +6 -0
- package/node_modules/@llblab/pi-telegram/lib/bus-api.ts +5 -2
- package/node_modules/@llblab/pi-telegram/lib/bus-follower.ts +243 -224
- package/node_modules/@llblab/pi-telegram/lib/bus-leader.ts +178 -31
- package/node_modules/@llblab/pi-telegram/lib/bus-transport.ts +30 -8
- package/node_modules/@llblab/pi-telegram/lib/bus.ts +110 -334
- package/node_modules/@llblab/pi-telegram/lib/channel-posts.ts +29 -29
- package/node_modules/@llblab/pi-telegram/lib/command-templates.ts +5 -5
- package/node_modules/@llblab/pi-telegram/lib/commands.ts +15 -15
- package/node_modules/@llblab/pi-telegram/lib/config.ts +12 -17
- package/node_modules/@llblab/pi-telegram/lib/delivery.ts +2 -8
- package/node_modules/@llblab/pi-telegram/lib/extension.ts +257 -72
- package/node_modules/@llblab/pi-telegram/lib/generative-apps.ts +0 -22
- package/node_modules/@llblab/pi-telegram/lib/inbound.ts +2 -2
- package/node_modules/@llblab/pi-telegram/lib/journal.ts +1182 -326
- package/node_modules/@llblab/pi-telegram/lib/keyboard.ts +2 -2
- package/node_modules/@llblab/pi-telegram/lib/lifecycle.ts +1 -1
- package/node_modules/@llblab/pi-telegram/lib/locks.ts +402 -23
- package/node_modules/@llblab/pi-telegram/lib/logging.ts +151 -101
- package/node_modules/@llblab/pi-telegram/lib/media.ts +51 -9
- package/node_modules/@llblab/pi-telegram/lib/menu-model.ts +8 -8
- package/node_modules/@llblab/pi-telegram/lib/menu-settings.ts +18 -18
- package/node_modules/@llblab/pi-telegram/lib/menu-status.ts +11 -0
- package/node_modules/@llblab/pi-telegram/lib/menu-thinking.ts +2 -2
- package/node_modules/@llblab/pi-telegram/lib/menu.ts +5 -1
- package/node_modules/@llblab/pi-telegram/lib/outbound-attachments.ts +1 -1
- package/node_modules/@llblab/pi-telegram/lib/outbound-buttons.ts +1 -10
- package/node_modules/@llblab/pi-telegram/lib/outbound-markup.ts +5 -24
- package/node_modules/@llblab/pi-telegram/lib/outbound.ts +5 -5
- package/node_modules/@llblab/pi-telegram/lib/paths.ts +177 -17
- package/node_modules/@llblab/pi-telegram/lib/pi.ts +5 -2
- package/node_modules/@llblab/pi-telegram/lib/polling.ts +5 -5
- package/node_modules/@llblab/pi-telegram/lib/preview.ts +3 -3
- package/node_modules/@llblab/pi-telegram/lib/prompt-templates.ts +1 -1
- package/node_modules/@llblab/pi-telegram/lib/queue.ts +67 -9
- package/node_modules/@llblab/pi-telegram/lib/recovery.ts +104 -44
- package/node_modules/@llblab/pi-telegram/lib/replies.ts +1 -1
- package/node_modules/@llblab/pi-telegram/lib/routing.ts +1955 -375
- package/node_modules/@llblab/pi-telegram/lib/sections.ts +1 -1
- package/node_modules/@llblab/pi-telegram/lib/status.ts +156 -36
- package/node_modules/@llblab/pi-telegram/lib/sync.ts +4 -4
- package/node_modules/@llblab/pi-telegram/lib/telegram-api.ts +48 -33
- package/node_modules/@llblab/pi-telegram/lib/thread-cleanup-manager.ts +24 -21
- package/node_modules/@llblab/pi-telegram/lib/thread-naming.ts +267 -9
- package/node_modules/@llblab/pi-telegram/lib/thread-reconciler.ts +3 -1
- package/node_modules/@llblab/pi-telegram/lib/threads.ts +1697 -488
- package/node_modules/@llblab/pi-telegram/lib/turns.ts +1 -1
- package/node_modules/@llblab/pi-telegram/lib/updates.ts +1072 -151
- package/node_modules/@llblab/pi-telegram/lib/wire.ts +28 -0
- package/node_modules/@llblab/pi-telegram/lib/workspace-admission.ts +97 -47
- package/node_modules/@llblab/pi-telegram/lib/workspace-identity.ts +147 -0
- package/node_modules/@llblab/pi-telegram/lib/workspace-retirement.ts +188 -89
- package/node_modules/@llblab/pi-telegram/package.json +6 -6
- package/node_modules/@llblab/pi-telegram/scripts/audit-exports.mjs +100 -0
- package/node_modules/@llblab/pi-telegram/scripts/check-downgrade.mjs +80 -43
- package/node_modules/@llblab/pi-telegram/skills/generated-control-surface/SKILL.md +3 -3
- package/node_modules/@llblab/pi-telegram/skills/telegram-bridge/references/diagnosis.md +3 -3
- package/package.json +2 -2
|
@@ -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: {
|
|
@@ -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 };
|
|
@@ -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 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,96 @@ 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
|
+
}
|
|
193
|
+
export interface TelegramDeferredAbandonmentRecoveryPage {
|
|
194
|
+
sources: {
|
|
195
|
+
/** Detached original evidence, not proof of current eligibility or archive integrity. */
|
|
196
|
+
original: TelegramUpdateJournalEntry;
|
|
197
|
+
retry: (authority: TelegramDeferredUpdateAbandonmentAuthority) => TelegramUpdateJournalPendingAbandonmentResult | undefined;
|
|
198
|
+
}[];
|
|
199
|
+
nextAfterUpdateId?: number;
|
|
200
|
+
}
|
|
201
|
+
type TelegramHistoricalInputPredicate = (original: TelegramUpdateJournalEntry) => boolean;
|
|
202
|
+
/** Read-only exact-source observation by its live worker; not an acceptance or removal grant. */
|
|
203
|
+
export interface TelegramDeferredSourceEvidence extends TelegramUpdateJournalEntryDigest {
|
|
204
|
+
journalBindingKey: string;
|
|
205
|
+
/** Supplied only after caller-owned acceptance publication; requires a durable removal ACK. */
|
|
206
|
+
completionSha256?: string;
|
|
207
|
+
}
|
|
188
208
|
interface TelegramUpdateAdmissionBinding {
|
|
189
209
|
sourceUpdateId: number;
|
|
190
210
|
report: (outcome: TelegramUpdateAdmissionOutcome) => void;
|
|
211
|
+
abandon?: (authority: TelegramDeferredUpdateAbandonmentAuthority) => TelegramUpdateJournalPendingAbandonmentResult | undefined;
|
|
212
|
+
armRoutingInput?: (operatorUserId: number, sourceUpdateIds: readonly number[]) => TelegramUpdateJournalRoutingInput | undefined;
|
|
213
|
+
acquireRouting?: (select?: boolean, sourceUpdateIds?: readonly number[]) => () => void;
|
|
214
|
+
inspectSource?: () => TelegramDeferredSourceEvidence | undefined;
|
|
215
|
+
supportsAbandonment?: (journalBindingKey: string) => boolean;
|
|
216
|
+
inspectAbandoning?: (request: TelegramDeferredAbandonmentRecoveryRequest) => TelegramDeferredAbandonmentRecoveryPage | undefined;
|
|
217
|
+
inspectHistorical?: (request: TelegramDeferredAbandonmentRecoveryRequest) => TelegramDeferredAbandonmentRecoveryPage | undefined;
|
|
218
|
+
isHistorical?: (matchesOriginal?: TelegramHistoricalInputPredicate) => boolean;
|
|
219
|
+
isHistoricalReviewHeld?: () => boolean;
|
|
191
220
|
}
|
|
192
221
|
export type TelegramQueueAdmissionReceiptLike = TelegramQueueAdmissionReceipt;
|
|
193
222
|
export declare function bindTelegramUpdateAdmissionSource<TUpdate extends TelegramUpdateFlow & {
|
|
194
223
|
update_id: number;
|
|
195
|
-
}>(update: TUpdate, report: TelegramUpdateAdmissionBinding["report"]): TUpdate;
|
|
224
|
+
}>(update: TUpdate, report: TelegramUpdateAdmissionBinding["report"], controls?: Pick<TelegramUpdateAdmissionBinding, "abandon" | "armRoutingInput" | "acquireRouting" | "inspectSource" | "supportsAbandonment" | "inspectAbandoning" | "inspectHistorical" | "isHistorical" | "isHistoricalReviewHeld">): TUpdate;
|
|
225
|
+
/**
|
|
226
|
+
* Conservative read-only census: any retained entry naming this Thread, in any nested Telegram object or state,
|
|
227
|
+
* is unresolved custody. It cannot see updates still in transit before journal append.
|
|
228
|
+
*/
|
|
229
|
+
export declare function collectTelegramJournalThreadUpdateIds(entries: readonly {
|
|
230
|
+
updateId: number;
|
|
231
|
+
update: unknown;
|
|
232
|
+
}[], target: {
|
|
233
|
+
chatId: number;
|
|
234
|
+
threadId: number;
|
|
235
|
+
}): number[];
|
|
196
236
|
export declare function collectTelegramAdmissionSourceUpdateIds(values: readonly unknown[]): number[];
|
|
237
|
+
/** Observe the original journal entry, never the mutable routed carrier, through current worker authority. */
|
|
238
|
+
export declare function inspectTelegramDeferredSource(value: unknown): TelegramDeferredSourceEvidence | undefined;
|
|
239
|
+
/** A route-owned pre-disposition acceptance publisher; wraps only this carrier, never the shared worker binding. */
|
|
240
|
+
export declare function bindTelegramUpdateCompletionAcceptance<TValue>(value: TValue, publish: () => TelegramDeferredSourceEvidence): TValue;
|
|
197
241
|
/** Report source completion; true means reported, not a durable settlement acknowledgement. */
|
|
198
|
-
export declare function reportTelegramUpdateCompleted(value: unknown): boolean;
|
|
242
|
+
export declare function reportTelegramUpdateCompleted(value: unknown, expectedSource?: TelegramDeferredSourceEvidence): boolean;
|
|
199
243
|
export declare function reportTelegramUpdateDeferred(value: unknown): boolean;
|
|
244
|
+
/** Exact source-bound cancellation; undefined means no eligible attempt was made. */
|
|
245
|
+
export declare function abandonTelegramDeferredUpdate(value: unknown, authority: TelegramDeferredUpdateAbandonmentAuthority): TelegramUpdateJournalPendingAbandonmentResult | undefined;
|
|
246
|
+
/** Capability for chooser publication; the eventual action still requires exact deferred authority. */
|
|
247
|
+
export declare function supportsTelegramDeferredAbandonment(value: unknown, journalBindingKey: string): boolean;
|
|
248
|
+
/** Observe protected attempts through a current carrier; the UI still owns human authorization. */
|
|
249
|
+
export declare function inspectTelegramAbandoningUpdates(value: unknown, request: TelegramDeferredAbandonmentRecoveryRequest): TelegramDeferredAbandonmentRecoveryPage | undefined;
|
|
250
|
+
/** Historical inspection is not human confirmation or permission to stop delivery. */
|
|
251
|
+
export declare function inspectTelegramHistoricalInputs(value: unknown, request: TelegramDeferredAbandonmentRecoveryRequest): TelegramDeferredAbandonmentRecoveryPage | undefined;
|
|
252
|
+
export declare function isTelegramHistoricalInput(value: unknown, matchesOriginal?: TelegramHistoricalInputPredicate): boolean;
|
|
253
|
+
/** Routing's last-boundary hold when ownership changed after early classification. */
|
|
254
|
+
export declare function reportTelegramHistoricalRoutingReview(value: unknown): boolean;
|
|
255
|
+
/** Arm only a positively published chooser; the journal owns the immutable hour deadline. */
|
|
256
|
+
export declare function armTelegramRoutingInputs(values: readonly unknown[], operatorUserId: number): TelegramUpdateJournalRoutingInput | undefined;
|
|
257
|
+
/** Reserve source execution; an actual choice must also freeze its durable TTL before any effect. */
|
|
258
|
+
export declare function acquireTelegramUpdateRouting(value: unknown, select?: boolean, sourceUpdateIds?: readonly number[]): () => void;
|
|
200
259
|
export declare function reportTelegramQueueAdmission(values: readonly unknown[], receipts: readonly TelegramQueueAdmissionReceiptLike[]): boolean;
|
|
201
260
|
export type TelegramUpdateFlowAction<TReactionUpdate extends TelegramMessageReactionUpdated = TelegramMessageReactionUpdated, TCallbackQuery extends TelegramCallbackQuery = TelegramCallbackQuery, TMessage extends TelegramUpdateMessage = TelegramUpdateMessage, TGuestMessage extends TelegramGuestMessage = TelegramGuestMessage> = {
|
|
202
261
|
kind: "ignore";
|
|
@@ -367,9 +426,6 @@ export interface AuthorizedTelegramReactionUpdateDeps<TContext> {
|
|
|
367
426
|
}
|
|
368
427
|
export declare function handleAuthorizedTelegramReactionUpdate<TContext>(reactionUpdate: TelegramMessageReactionUpdated, deps: AuthorizedTelegramReactionUpdateDeps<TContext>): Promise<void>;
|
|
369
428
|
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
429
|
export type TelegramUpdateWorkerPhase = "stopped" | "idle" | "executing" | "retry-wait" | "failed" | "deferred" | "queued" | "blocked";
|
|
374
430
|
export type TelegramUpdateWorkerBlockedReason = "authority-lost" | "authority-check" | "journal-read" | "journal-write" | "execution" | "input-custody" | "prior-generation-executing" | "invalid-outcome";
|
|
375
431
|
export interface TelegramUpdateWorkerStateSnapshot {
|
|
@@ -386,6 +442,10 @@ export interface TelegramUpdateWorkerStateSnapshot {
|
|
|
386
442
|
journalSerializedBytes: number;
|
|
387
443
|
oldestAdmittedAtMs?: number;
|
|
388
444
|
deferredClaimCount: number;
|
|
445
|
+
/** Protected cancellation attempts, not proof of a committed discard. */
|
|
446
|
+
abandoningClaimCount?: number;
|
|
447
|
+
/** Historical sources held before routing, not evidence of prior non-delivery. */
|
|
448
|
+
historicalClaimCount?: number;
|
|
389
449
|
queuedClaimCount: number;
|
|
390
450
|
foreignQueuedCount: number;
|
|
391
451
|
foreignQueuedOwner?: TelegramUpdateJournalQueueOwner;
|
|
@@ -416,6 +476,7 @@ export interface TelegramUpdateWorkerJournalSnapshot {
|
|
|
416
476
|
update: TelegramJournaledUpdate;
|
|
417
477
|
readonly preApprovalExcluded?: boolean;
|
|
418
478
|
admittedAtMs: number;
|
|
479
|
+
routingInput?: TelegramUpdateJournalRoutingInput;
|
|
419
480
|
state: "pending" | "retry-wait" | "queued" | "failed";
|
|
420
481
|
inputClaim?: TelegramUpdateJournalInputClaim;
|
|
421
482
|
queueKind?: "prompt" | "control";
|
|
@@ -439,10 +500,21 @@ export interface TelegramUpdateWorkerJournalSnapshot {
|
|
|
439
500
|
}[];
|
|
440
501
|
serializedBytes: number;
|
|
441
502
|
}
|
|
503
|
+
export interface TelegramRoutingInputExpirySource {
|
|
504
|
+
original: TelegramUpdateJournalEntry;
|
|
505
|
+
journalBindingKey: string;
|
|
506
|
+
isCurrent(): boolean;
|
|
507
|
+
expire(): TelegramUpdateJournalPendingAbandonmentResult | undefined;
|
|
508
|
+
}
|
|
442
509
|
export interface TelegramUpdateWorkerJournalPort {
|
|
510
|
+
routingInputs?: TelegramRoutingInputJournal;
|
|
443
511
|
read: () => TelegramUpdateWorkerJournalSnapshot;
|
|
512
|
+
inspectPendingRetention?: (entry: TelegramUpdateJournalEntry) => TelegramUpdateJournalPendingRetentionEvidence | undefined;
|
|
513
|
+
abandonPending?: (input: TelegramUpdateJournalPendingAbandonmentInput) => TelegramUpdateJournalPendingAbandonmentResult;
|
|
444
514
|
/** Optional strict observation; it must not recover, repair or grant new receipt authority. */
|
|
445
515
|
isQueueReceiptCurrent?: (receipt: TelegramQueueAdmissionReceiptLike, owner: TelegramUpdateJournalQueueOwner) => boolean;
|
|
516
|
+
/** Strict full-group origin observation for prepared partial scopes; no writer or readiness acquisition. */
|
|
517
|
+
inspectQueuedReceipt?: (expected: TelegramUpdateJournalQueuedCompletion) => TelegramUpdateJournalQueuedReceiptEvidence | undefined;
|
|
446
518
|
markQueued: (receipt: {
|
|
447
519
|
queueKind: "prompt" | "control";
|
|
448
520
|
receiptId: string;
|
|
@@ -461,6 +533,15 @@ export interface TelegramUpdateWorkerJournalPort {
|
|
|
461
533
|
}[]) => {
|
|
462
534
|
removedUpdateIds: readonly number[];
|
|
463
535
|
};
|
|
536
|
+
completeQueuedExact?: (receipts: readonly {
|
|
537
|
+
queueKind: "prompt" | "control";
|
|
538
|
+
receiptId: string;
|
|
539
|
+
sourceUpdateIds: readonly number[];
|
|
540
|
+
queueOwner: TelegramUpdateJournalQueueOwner;
|
|
541
|
+
}[], completions: readonly TelegramUpdateJournalSourceCompletion[]) => {
|
|
542
|
+
removedUpdateIds: readonly number[];
|
|
543
|
+
sourceCompletions?: readonly TelegramUpdateJournalSourceCompletion[];
|
|
544
|
+
};
|
|
464
545
|
markExecutionFailure: (input: {
|
|
465
546
|
updateId: number;
|
|
466
547
|
expectedAttemptCount: number;
|
|
@@ -476,7 +557,16 @@ export interface TelegramUpdateWorkerJournalPort {
|
|
|
476
557
|
removeCompleted: (updateIds: readonly number[]) => {
|
|
477
558
|
removedUpdateIds: readonly number[];
|
|
478
559
|
};
|
|
560
|
+
/** No ID-only fallback is allowed for a guarded completion report. */
|
|
561
|
+
removeCompletedExact?: (updateIds: readonly number[], expectedSources: readonly TelegramUpdateJournalEntryDigest[], completions?: readonly TelegramUpdateJournalSourceCompletion[]) => {
|
|
562
|
+
removedUpdateIds: readonly number[];
|
|
563
|
+
sourceCompletions?: readonly TelegramUpdateJournalSourceCompletion[];
|
|
564
|
+
};
|
|
565
|
+
inspectSourceCompletion?: (expected: TelegramUpdateJournalSourceCompletion) => TelegramUpdateJournalSourceCompletion | undefined;
|
|
479
566
|
}
|
|
567
|
+
export type TelegramQueueSourceCompletion = TelegramDeferredSourceEvidence & {
|
|
568
|
+
completionSha256: string;
|
|
569
|
+
};
|
|
480
570
|
export interface TelegramUpdateRetryPolicy {
|
|
481
571
|
baseDelayMs: number;
|
|
482
572
|
maxDelayMs: number;
|
|
@@ -493,10 +583,17 @@ export interface TelegramUpdateWorkerRuntimeDeps<TContext> {
|
|
|
493
583
|
hasAuthority: (ctx: TContext) => boolean;
|
|
494
584
|
getJournalBindingKey?: () => string | undefined;
|
|
495
585
|
getRecipientBindingKey?: () => string | undefined;
|
|
586
|
+
/** True selects legacy historical review/spending; retain protects unsupported originals without disposition authority. */
|
|
587
|
+
shouldReviewHistoricalInput?: (entry: TelegramUpdateJournalEntry, ctx: TContext, signal: AbortSignal) => boolean | "retain" | Promise<boolean | "retain">;
|
|
588
|
+
/** New-world restart: spend previous-process routing inputs (classified or armed) without delivery, copy or completion observers. Interrupted private abandonment keeps its own exact recovery. */
|
|
589
|
+
spendHistoricalInput?: boolean;
|
|
590
|
+
/** Holds protected live or retry sources before execution; never cancels or disposes them. */
|
|
591
|
+
shouldHoldPendingInput?: (entry: TelegramUpdateJournalEntry, ctx: TContext, signal: AbortSignal) => boolean | Promise<boolean>;
|
|
496
592
|
getQueueOwnerIdentity?: (ctx: TContext) => TelegramUpdateJournalQueueOwnerIdentity;
|
|
497
593
|
isContextCurrent?: (ctx: TContext) => boolean;
|
|
498
594
|
createAbortController?: () => AbortController;
|
|
499
595
|
getNowMs?: () => number;
|
|
596
|
+
expireRoutingInput?: (source: TelegramRoutingInputExpirySource, ctx: TContext, signal: AbortSignal) => Promise<void> | void;
|
|
500
597
|
retryPolicy?: Partial<TelegramUpdateRetryPolicy>;
|
|
501
598
|
classifyExecutionFailure?: (error: unknown) => TelegramUpdateExecutionFailureClassification;
|
|
502
599
|
settleTerminalExecutionFailure?: (error: unknown) => Promise<boolean>;
|
|
@@ -505,8 +602,14 @@ export interface TelegramUpdateWorkerRuntimeDeps<TContext> {
|
|
|
505
602
|
batchSize?: number;
|
|
506
603
|
yieldToEventLoop?: () => Promise<void>;
|
|
507
604
|
onStateChange?: (state: TelegramUpdateWorkerStateSnapshot) => void;
|
|
605
|
+
/** One nonblocking hint after a quiescent validated startup projection, never execution or deletion authority. */
|
|
606
|
+
onHeldSourcesPrepared?: (input: TelegramHeldSourcePreparation<TContext>) => Promise<void> | void;
|
|
607
|
+
/** Prepared readiness barrier after durable queue admission; never authorizes replay or source removal. */
|
|
608
|
+
beforeQueueReceiptPublished?: (receipt: TelegramQueueAdmissionReceiptLike, queueOwner: TelegramUpdateJournalQueueOwner, ctx: TContext, isCurrent: () => boolean) => Promise<void | readonly TelegramQueueSourceCompletion[]> | void | readonly TelegramQueueSourceCompletion[];
|
|
609
|
+
/** Post-ACK hint only; it must not request Pi dispatch or inherit a Workspace admission lease. */
|
|
610
|
+
onQueueReceiptCompleted?: (receipt: TelegramQueueAdmissionReceiptLike, ctx: TContext) => void;
|
|
508
611
|
onQueueReceiptCommitted?: (receipt: TelegramQueueAdmissionReceiptLike, ctx: TContext) => void;
|
|
509
|
-
onUpdateCompleted?: (updateId: number, ctx: TContext) => void;
|
|
612
|
+
onUpdateCompleted?: (updateId: number, ctx: TContext, journalBindingKey?: string) => void;
|
|
510
613
|
recordRuntimeEvent?: (category: string, error: unknown, details?: Record<string, unknown>) => void;
|
|
511
614
|
}
|
|
512
615
|
export type TelegramQueueReceiptCompletionReason = "prompt-handoff" | "control-settlement" | "discard";
|
|
@@ -518,6 +621,42 @@ export interface TelegramUpdateWorkerRuntime<TContext> {
|
|
|
518
621
|
outcome: TelegramUpdateAdmissionOutcome;
|
|
519
622
|
signal: AbortSignal;
|
|
520
623
|
}) => void;
|
|
624
|
+
armRoutingInput?: (input: {
|
|
625
|
+
updateId: number;
|
|
626
|
+
signal: AbortSignal;
|
|
627
|
+
operatorUserId: number;
|
|
628
|
+
sourceUpdateIds: readonly number[];
|
|
629
|
+
}) => TelegramUpdateJournalRoutingInput | undefined;
|
|
630
|
+
selectRoutingInput?: (input: {
|
|
631
|
+
updateId: number;
|
|
632
|
+
signal: AbortSignal;
|
|
633
|
+
operatorUserId: number;
|
|
634
|
+
sourceUpdateIds: readonly number[];
|
|
635
|
+
}) => boolean;
|
|
636
|
+
supportsDeferredAbandonment?: (input: {
|
|
637
|
+
updateId: number;
|
|
638
|
+
signal: AbortSignal;
|
|
639
|
+
journalBindingKey: string;
|
|
640
|
+
}) => boolean;
|
|
641
|
+
inspectAbandoning?: (input: TelegramDeferredAbandonmentRecoveryRequest & {
|
|
642
|
+
signal: AbortSignal;
|
|
643
|
+
}) => TelegramDeferredAbandonmentRecoveryPage | undefined;
|
|
644
|
+
inspectHistorical?: (input: TelegramDeferredAbandonmentRecoveryRequest & {
|
|
645
|
+
signal: AbortSignal;
|
|
646
|
+
}) => TelegramDeferredAbandonmentRecoveryPage | undefined;
|
|
647
|
+
inspectDeferredSource?: (input: {
|
|
648
|
+
updateId: number;
|
|
649
|
+
signal: AbortSignal;
|
|
650
|
+
}) => TelegramDeferredSourceEvidence | undefined;
|
|
651
|
+
isHistoricalSource?: (input: {
|
|
652
|
+
updateId: number;
|
|
653
|
+
signal: AbortSignal;
|
|
654
|
+
matchesOriginal?: TelegramHistoricalInputPredicate;
|
|
655
|
+
}) => boolean;
|
|
656
|
+
abandonDeferred?: (input: TelegramDeferredUpdateAbandonmentAuthority & {
|
|
657
|
+
updateId: number;
|
|
658
|
+
signal: AbortSignal;
|
|
659
|
+
}) => TelegramUpdateJournalPendingAbandonmentResult | undefined;
|
|
521
660
|
settleCustodied: (input: {
|
|
522
661
|
updateId: number;
|
|
523
662
|
result: TelegramCustodiedExecutionResult;
|
|
@@ -525,18 +664,19 @@ export interface TelegramUpdateWorkerRuntime<TContext> {
|
|
|
525
664
|
}) => void;
|
|
526
665
|
isQueueReceiptCommitted: (receipt: TelegramQueueAdmissionReceiptLike) => boolean;
|
|
527
666
|
getQueueReceiptOwner: (receipt: TelegramQueueAdmissionReceiptLike) => TelegramUpdateJournalQueueOwner | undefined;
|
|
667
|
+
/** Completion-only owner observation; issued attempts are never dispatch readiness. */
|
|
668
|
+
getQueueReceiptSettlementOwner?: (receipt: TelegramQueueAdmissionReceiptLike, ctx: TContext, reason: TelegramQueueReceiptCompletionReason) => TelegramUpdateJournalQueueOwner | undefined;
|
|
528
669
|
completeQueueReceipts: (input: {
|
|
529
670
|
receipts: readonly TelegramQueueAdmissionReceiptLike[];
|
|
530
671
|
ctx: TContext;
|
|
531
672
|
reason: TelegramQueueReceiptCompletionReason;
|
|
673
|
+
/** Prepared immutable scopes for every source; the exact receipt owner still authorizes disposal. */
|
|
674
|
+
sourceCompletions?: readonly TelegramQueueSourceCompletion[];
|
|
532
675
|
}) => boolean;
|
|
533
676
|
stop: () => Promise<void>;
|
|
534
677
|
waitForDrain: () => Promise<void>;
|
|
535
678
|
getState: () => TelegramUpdateWorkerStateSnapshot;
|
|
536
679
|
}
|
|
537
|
-
export declare class TelegramUpdateAdmissionOutcomeError extends Error {
|
|
538
|
-
constructor(message: string);
|
|
539
|
-
}
|
|
540
680
|
export declare function createTelegramUpdateWorkerRuntime<TContext>(deps: TelegramUpdateWorkerRuntimeDeps<TContext>): TelegramUpdateWorkerRuntime<TContext>;
|
|
541
681
|
/**
|
|
542
682
|
* Verdict returned by a public Telegram update handler.
|
|
@@ -601,6 +741,14 @@ export interface TelegramUpdateAdmissionHandleDeps<TUpdate extends TelegramUpdat
|
|
|
601
741
|
signal: AbortSignal;
|
|
602
742
|
}) => void | Promise<void>;
|
|
603
743
|
onLateOutcomeError?: (error: unknown, updateId: number) => void;
|
|
744
|
+
abandonDeferred?: TelegramUpdateWorkerRuntime<TContext>["abandonDeferred"];
|
|
745
|
+
armRoutingInput?: TelegramUpdateWorkerRuntime<TContext>["armRoutingInput"];
|
|
746
|
+
selectRoutingInput?: TelegramUpdateWorkerRuntime<TContext>["selectRoutingInput"];
|
|
747
|
+
supportsDeferredAbandonment?: TelegramUpdateWorkerRuntime<TContext>["supportsDeferredAbandonment"];
|
|
748
|
+
inspectAbandoning?: TelegramUpdateWorkerRuntime<TContext>["inspectAbandoning"];
|
|
749
|
+
inspectHistorical?: TelegramUpdateWorkerRuntime<TContext>["inspectHistorical"];
|
|
750
|
+
inspectDeferredSource?: TelegramUpdateWorkerRuntime<TContext>["inspectDeferredSource"];
|
|
751
|
+
isHistoricalSource?: TelegramUpdateWorkerRuntime<TContext>["isHistoricalSource"];
|
|
604
752
|
}
|
|
605
753
|
export type TelegramCustodiedExecutionResult = {
|
|
606
754
|
status: "completed";
|
|
@@ -987,7 +1135,7 @@ export declare function executeTelegramCustodiedInput(input: {
|
|
|
987
1135
|
export declare function createTelegramUpdateAdmissionHandle<TUpdate extends TelegramUpdateFlow & {
|
|
988
1136
|
update_id: number;
|
|
989
1137
|
}, 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"> & {
|
|
1138
|
+
export declare function createTelegramCustodiedUpdateAdmissionHandle<TUpdate extends TelegramJournaledUpdate & TelegramUpdateFlow, TContext>(deps: Omit<TelegramUpdateAdmissionHandleDeps<TUpdate, TContext>, "onLateOutcome" | "onLateOutcomeError" | "abandonDeferred" | "armRoutingInput" | "selectRoutingInput" | "supportsDeferredAbandonment" | "inspectAbandoning" | "inspectHistorical" | "inspectDeferredSource" | "isHistoricalSource"> & {
|
|
991
1139
|
journal: TelegramCustodyExecutionJournal;
|
|
992
1140
|
recipientBindingKey: string;
|
|
993
1141
|
onLateOutcomeError(error: unknown, updateId: number): void;
|
|
@@ -1001,6 +1149,7 @@ export interface TelegramQueueAdmissionItemLike {
|
|
|
1001
1149
|
}
|
|
1002
1150
|
export interface TelegramQueueAdmissionSettlementRuntime<TContext> {
|
|
1003
1151
|
isItemReady: (item: TelegramQueueAdmissionItemLike) => boolean;
|
|
1152
|
+
getQueueReceiptSettlementOwner?: (receipt: TelegramQueueAdmissionReceiptLike, ctx: TContext, reason: TelegramQueueReceiptCompletionReason) => TelegramUpdateJournalQueueOwner | undefined;
|
|
1004
1153
|
getQueueReceiptOwner: (receipt: TelegramQueueAdmissionReceiptLike) => TelegramUpdateJournalQueueOwner | undefined;
|
|
1005
1154
|
onPromptHandedOff: (item: TelegramQueueAdmissionItemLike, ctx: TContext) => boolean;
|
|
1006
1155
|
onControlSettled: (item: TelegramQueueAdmissionItemLike, ctx: TContext) => boolean;
|
|
@@ -1125,7 +1274,7 @@ export interface TelegramQueueHandoffReconciliationRuntimeAssemblyDeps<TContext>
|
|
|
1125
1274
|
isBusEnabled: () => boolean;
|
|
1126
1275
|
canHandoffWithLeader?: () => boolean;
|
|
1127
1276
|
listFollowers: () => readonly TelegramBusFollowerView[];
|
|
1128
|
-
createRecipientJournalResolver: (profileKey: string) => (() => {
|
|
1277
|
+
createRecipientJournalResolver: (profileKey: string, sessionId: string) => (() => {
|
|
1129
1278
|
recoveryKey: string;
|
|
1130
1279
|
} | undefined);
|
|
1131
1280
|
queueStore: {
|
|
@@ -1167,6 +1316,8 @@ export interface TelegramUpdateAdmissionLifecycleRuntimeDeps<TContext> {
|
|
|
1167
1316
|
getQueueOwnerIdentity?: (ctx: TContext) => TelegramUpdateJournalQueueOwnerIdentity;
|
|
1168
1317
|
createWorker: (journal: TelegramUpdateWorkerJournalPort, binding: TelegramUpdateAdmissionLifecycleJournalBinding) => TelegramUpdateWorkerRuntime<TContext>;
|
|
1169
1318
|
acquireSourceReference?: (binding: TelegramUpdateAdmissionLifecycleJournalBinding) => () => void;
|
|
1319
|
+
/** Runs after the previous worker stopped and before the replacement worker exists; throwing refuses binding. */
|
|
1320
|
+
prepareBinding?: (binding: TelegramUpdateAdmissionLifecycleJournalBinding) => void;
|
|
1170
1321
|
recordRuntimeEvent?: TelegramUpdateWorkerRuntimeDeps<TContext>["recordRuntimeEvent"];
|
|
1171
1322
|
}
|
|
1172
1323
|
export interface TelegramUpdateAdmissionLifecycleRuntime<TContext> extends TelegramQueueAdmissionSettlementRuntime<TContext> {
|
|
@@ -1207,8 +1358,8 @@ export interface TelegramUpdateAdmissionLifecycleRuntime<TContext> extends Teleg
|
|
|
1207
1358
|
}
|
|
1208
1359
|
export interface TelegramUpdateWorkerOwnerRuntime<TContext> {
|
|
1209
1360
|
getQueueOwnerIdentity: () => TelegramUpdateJournalQueueOwnerIdentity;
|
|
1210
|
-
onQueueReceiptCommitted: (receipt:
|
|
1211
|
-
onUpdateCompleted: (updateId: number, ctx: TContext) => void;
|
|
1361
|
+
onQueueReceiptCommitted: (receipt: TelegramQueueAdmissionReceiptLike, ctx: TContext) => void;
|
|
1362
|
+
onUpdateCompleted: (updateId: number, ctx: TContext, journalBindingKey?: string) => void;
|
|
1212
1363
|
}
|
|
1213
1364
|
export interface TelegramUpdateWorkerOwnerRuntimeDeps<TContext> {
|
|
1214
1365
|
instanceId: string;
|
|
@@ -1218,7 +1369,8 @@ export interface TelegramUpdateWorkerOwnerRuntimeDeps<TContext> {
|
|
|
1218
1369
|
isContextCurrent: (ctx: TContext) => boolean;
|
|
1219
1370
|
dispatchNext: (ctx: TContext) => void;
|
|
1220
1371
|
requestQueueHandoffReconciliation: (ctx: TContext) => void;
|
|
1221
|
-
|
|
1372
|
+
afterQueueReceiptCommitted?: (receipt: TelegramQueueAdmissionReceiptLike, ctx: TContext) => void;
|
|
1373
|
+
afterUpdateCompleted?: (updateId: number, ctx: TContext, journalBindingKey?: string) => void;
|
|
1222
1374
|
}
|
|
1223
1375
|
export declare function createTelegramUpdateWorkerOwnerRuntime<TContext>(deps: TelegramUpdateWorkerOwnerRuntimeDeps<TContext>): TelegramUpdateWorkerOwnerRuntime<TContext>;
|
|
1224
1376
|
export interface TelegramUpdateAdmissionRuntimeBinding<TContext> {
|
|
@@ -1259,6 +1411,10 @@ export interface TelegramUpdateAdmissionLifecycleAssemblyDeps<TUpdate extends Te
|
|
|
1259
1411
|
isRegistered: () => boolean;
|
|
1260
1412
|
getGeneration: () => string | undefined;
|
|
1261
1413
|
prepareUpdateForExecution: (update: TUpdate) => TUpdate;
|
|
1414
|
+
/** Session succession before worker creation, under the exact generation-fenced binding. */
|
|
1415
|
+
prepareBinding?: (binding: TelegramUpdateAdmissionLifecycleJournalBinding & {
|
|
1416
|
+
hasAuthority?: () => boolean;
|
|
1417
|
+
}) => void;
|
|
1262
1418
|
};
|
|
1263
1419
|
recordRuntimeEvent?: TelegramUpdateWorkerRuntimeDeps<TContext>["recordRuntimeEvent"];
|
|
1264
1420
|
}
|