@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
|
@@ -5,22 +5,16 @@
|
|
|
5
5
|
* heartbeat, forwarded-update receiving, and follower-routed API calls.
|
|
6
6
|
* It must not spawn Pi processes or create hidden Telegram-originated instances.
|
|
7
7
|
*/
|
|
8
|
-
import
|
|
8
|
+
import type { TelegramWorkspaceRestoreExecutor, TelegramWorkspaceRestoreIntent } from "./threads.ts";
|
|
9
9
|
import * as Threads from "./threads.ts";
|
|
10
10
|
import { type TelegramUpdateJournalStoreOptions } from "./journal.ts";
|
|
11
11
|
import { type TelegramLockEntry, type TelegramLockState } from "./locks.ts";
|
|
12
12
|
import type { TelegramQueueHandoffPayload, TelegramQueueHandoffStageResult } from "./queue.ts";
|
|
13
13
|
import type { TelegramTarget } from "./target.ts";
|
|
14
|
-
import { type TelegramBusAgentMessage, type TelegramBusAgentTargetSelector, type TelegramBusEnvelope, type TelegramBusForwardOwnership, type TelegramBusProtocolIdentity, type TelegramBusSocketPathSource } from "./bus.ts";
|
|
14
|
+
import { type TelegramBusAgentMessage, type TelegramBusAgentTargetSelector, type TelegramBusEnvelope, type TelegramBusWorkspaceRestoreObservation, type TelegramBusForwardOwnership, type TelegramBusProtocolIdentity, type TelegramBusSocketPathSource } from "./bus.ts";
|
|
15
15
|
import type { TelegramConfigStore, TelegramThreadDisplayMode } from "./config.ts";
|
|
16
16
|
import { type TelegramWorkspaceAdmissionLedger } from "./workspace-admission.ts";
|
|
17
|
-
export declare const TELEGRAM_BUS_FOLLOWER_PROMOTION_GRACE_MS = 2500;
|
|
18
|
-
export declare const TELEGRAM_FOLLOWER_SESSION_HANDOFF_TTL_MS = 30000;
|
|
19
|
-
export declare const TELEGRAM_BUS_FOLLOWER_CLIENT_TIMEOUT_MS = 30000;
|
|
20
|
-
export declare const TELEGRAM_BUS_FOLLOWER_REGISTRATION_WAIT_MS = 30000;
|
|
21
17
|
export declare const TELEGRAM_BUS_FOLLOWER_HEARTBEAT_TIMEOUT_MS = 8000;
|
|
22
|
-
export declare const TELEGRAM_BUS_FOLLOWER_REGISTRATION_RETRY_ATTEMPTS: number;
|
|
23
|
-
export declare const TELEGRAM_BUS_FOLLOWER_REGISTRATION_RETRY_DELAY_MS: number;
|
|
24
18
|
export interface TelegramFollowerSessionHandoff {
|
|
25
19
|
pid: number;
|
|
26
20
|
instanceId: string;
|
|
@@ -31,11 +25,6 @@ export interface TelegramFollowerSessionHandoff {
|
|
|
31
25
|
}
|
|
32
26
|
export declare function getTelegramFollowerSessionHandoff(): TelegramFollowerSessionHandoff | undefined;
|
|
33
27
|
export declare function setTelegramFollowerSessionHandoff(handoff: TelegramFollowerSessionHandoff | undefined): void;
|
|
34
|
-
export declare function isTelegramFollowerSessionHandoffFresh(handoff: TelegramFollowerSessionHandoff | undefined, options?: {
|
|
35
|
-
pid?: number;
|
|
36
|
-
nowMs?: number;
|
|
37
|
-
ttlMs?: number;
|
|
38
|
-
}): handoff is TelegramFollowerSessionHandoff;
|
|
39
28
|
export interface TelegramBusFollowerRegistrationRuntime<TContext> {
|
|
40
29
|
registerWithLeader: (ctx: TContext, leader: {
|
|
41
30
|
busSocketPath?: string;
|
|
@@ -95,6 +84,8 @@ export interface TelegramBusFollowerRegistrationState {
|
|
|
95
84
|
getDisplayTitle: () => string | undefined;
|
|
96
85
|
setDisplayTitle: (title: string, generation: string) => boolean;
|
|
97
86
|
getGeneration: () => string | undefined;
|
|
87
|
+
/** Return the acknowledged session only when it matches the caller's current context. */
|
|
88
|
+
getSessionId: (currentSessionId: string | undefined) => string | undefined;
|
|
98
89
|
beginRecovery: () => number;
|
|
99
90
|
cancelRecovery: () => void;
|
|
100
91
|
waitForGeneration: (timeoutMs?: number) => Promise<string | undefined>;
|
|
@@ -106,6 +97,7 @@ export interface TelegramBusFollowerRegistrationState {
|
|
|
106
97
|
threadName?: string;
|
|
107
98
|
displayTitle?: string;
|
|
108
99
|
generation?: string;
|
|
100
|
+
sessionId?: string;
|
|
109
101
|
leaderProtocol?: TelegramBusProtocolIdentity;
|
|
110
102
|
}) => void;
|
|
111
103
|
}
|
|
@@ -204,19 +196,6 @@ export declare function createTelegramBusFollowerPromotionHandler<TContext exten
|
|
|
204
196
|
getPid?: () => number;
|
|
205
197
|
getWorkspaceAdmission?: TelegramBusFollowerWorkspaceAdmissionDeps["getWorkspaceAdmission"];
|
|
206
198
|
}): TelegramBusFollowerPromotionHandler<TContext>;
|
|
207
|
-
export interface TelegramBusFollowerTargetReplacementHandlerDeps<TContext> {
|
|
208
|
-
topicTargetStore: Pick<Threads.TelegramTopicTargetStore, "load" | "list" | "markStaleByTarget" | "upsert" | "persist">;
|
|
209
|
-
registrationState: Pick<TelegramBusFollowerRegistrationState, "getTarget" | "getSlot" | "setRegistered" | "getGeneration">;
|
|
210
|
-
instanceId: string;
|
|
211
|
-
getManualFollowerProfileKey: () => string;
|
|
212
|
-
manualFollowerOwnerId: string;
|
|
213
|
-
getSyncState: () => Sync.TelegramSyncState;
|
|
214
|
-
setSyncState: (state: Sync.TelegramSyncState) => void;
|
|
215
|
-
getNowMs?: () => number;
|
|
216
|
-
updateStatus: (ctx: TContext) => void;
|
|
217
|
-
recordRuntimeEvent?: (category: string, error: unknown, details?: Record<string, unknown>) => void;
|
|
218
|
-
getWorkspaceAdmission?: TelegramBusFollowerWorkspaceAdmissionDeps["getWorkspaceAdmission"];
|
|
219
|
-
}
|
|
220
199
|
export type TelegramBusFollowerLeaderState = {
|
|
221
200
|
kind: "inactive";
|
|
222
201
|
} | {
|
|
@@ -265,21 +244,18 @@ export interface TelegramBusForwardedUpdateReceiverRuntimeDeps<TContext> {
|
|
|
265
244
|
handleQueueHandoff?: (envelope: Extract<TelegramBusEnvelope, {
|
|
266
245
|
kind: "leader.offerQueueHandoff";
|
|
267
246
|
}>, ctx: TContext) => Promise<TelegramQueueHandoffStageResult> | TelegramQueueHandoffStageResult;
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
};
|
|
272
|
-
oldTarget?: TelegramTarget & {
|
|
273
|
-
threadId: number;
|
|
274
|
-
};
|
|
275
|
-
reason: "thread-restore";
|
|
247
|
+
isWorkspaceRestoreEnabled?: () => boolean;
|
|
248
|
+
handleWorkspaceRestore?: (input: {
|
|
249
|
+
operationId: string;
|
|
276
250
|
registrationGeneration: string;
|
|
277
|
-
|
|
251
|
+
mode: "apply" | "inspect";
|
|
252
|
+
}, ctx: TContext) => Promise<TelegramBusWorkspaceRestoreObservation>;
|
|
278
253
|
recordRuntimeEvent?: (category: string, error: unknown, details?: Record<string, unknown>) => void;
|
|
279
254
|
}
|
|
280
255
|
export interface TelegramBusFollowerRuntimeAssembly<TContext> {
|
|
281
256
|
receiver: TelegramBusForwardedUpdateReceiverRuntime;
|
|
282
257
|
registration: TelegramBusFollowerRegistrationRuntime<TContext>;
|
|
258
|
+
getReadySessionId: () => string | undefined;
|
|
283
259
|
}
|
|
284
260
|
export interface TelegramBusFollowerRuntimeAssemblyPorts<TContext extends {
|
|
285
261
|
cwd?: string;
|
|
@@ -287,8 +263,7 @@ export interface TelegramBusFollowerRuntimeAssemblyPorts<TContext extends {
|
|
|
287
263
|
instanceId: string;
|
|
288
264
|
registrationState: TelegramBusFollowerRegistrationState;
|
|
289
265
|
recordRuntimeEvent: (category: string, error: unknown, details?: Record<string, unknown>) => void;
|
|
290
|
-
receiver: Omit<TelegramBusForwardedUpdateReceiverRuntimeDeps<TContext>, "
|
|
291
|
-
targetReplacement: Omit<TelegramBusFollowerTargetReplacementHandlerDeps<TContext>, "registrationState" | "instanceId" | "recordRuntimeEvent">;
|
|
266
|
+
receiver: Omit<TelegramBusForwardedUpdateReceiverRuntimeDeps<TContext>, "instanceId" | "recordRuntimeEvent" | "getRegistrationGeneration">;
|
|
292
267
|
recovery: Omit<TelegramBusFollowerHeartbeatRecoveryHandlerDeps<TContext>, "getRegistrationRuntime" | "registrationState" | "recordRuntimeEvent">;
|
|
293
268
|
registration: Omit<TelegramBusFollowerRegistrationRuntimeDeps<TContext>, "startReceiving" | "stopReceiving" | "onHeartbeatFailure" | "instanceId" | "registrationState" | "recordRuntimeEvent" | "protocolIdentity"> & {
|
|
294
269
|
protocolIdentity: TelegramBusProtocolIdentity;
|
|
@@ -297,7 +272,42 @@ export interface TelegramBusFollowerRuntimeAssemblyPorts<TContext extends {
|
|
|
297
272
|
export declare function createTelegramBusFollowerRuntimeAssembly<TContext extends {
|
|
298
273
|
cwd?: string;
|
|
299
274
|
}>(ports: TelegramBusFollowerRuntimeAssemblyPorts<TContext>): TelegramBusFollowerRuntimeAssembly<TContext>;
|
|
300
|
-
export
|
|
275
|
+
export interface TelegramBusFollowerRestoreContext {
|
|
276
|
+
executor: TelegramWorkspaceRestoreExecutor;
|
|
277
|
+
profileBindingKey: string;
|
|
278
|
+
operatorUserId: number;
|
|
279
|
+
cwd: string;
|
|
280
|
+
sessionId: string;
|
|
281
|
+
generation: string | number;
|
|
282
|
+
leaderProtocol?: TelegramBusProtocolIdentity;
|
|
283
|
+
}
|
|
284
|
+
/** Binds Restore to real Pi lifetime and the current authenticated transport owner, not request fields. */
|
|
285
|
+
export declare function createTelegramBusFollowerRestoreContextGetter<TContext>(deps: {
|
|
286
|
+
isContextCurrent: (ctx: TContext) => boolean;
|
|
287
|
+
getSessionId: (ctx: TContext) => string | undefined;
|
|
288
|
+
getCwd: (ctx: TContext) => string | undefined;
|
|
289
|
+
getGeneration: () => number;
|
|
290
|
+
getProfileBindingKey: () => string | undefined;
|
|
291
|
+
getOperatorUserId: () => number | undefined;
|
|
292
|
+
getLeaderState: () => TelegramLockState;
|
|
293
|
+
getAuthenticatedSecret: () => string | undefined;
|
|
294
|
+
getLeaderProtocol: () => TelegramBusProtocolIdentity | undefined;
|
|
295
|
+
}): (ctx: TContext) => TelegramBusFollowerRestoreContext | undefined;
|
|
296
|
+
/** Prepared receiver: its caller authenticates the envelope; no canonical writes, dispatch or cleanup. */
|
|
297
|
+
export declare function createTelegramBusFollowerWorkspaceRestoreHandler<TContext>(deps: {
|
|
298
|
+
instanceId: string;
|
|
299
|
+
/** Captures actual Pi lifetime and authenticated leader/profile authority, never request-derived values. */
|
|
300
|
+
getContextAuthority: (ctx: TContext) => TelegramBusFollowerRestoreContext | undefined;
|
|
301
|
+
readRestoreIntent: (operationId: string, profileBindingKey: string) => TelegramWorkspaceRestoreIntent | undefined;
|
|
302
|
+
topicTargetStore: Pick<Threads.TelegramTopicTargetStore, "load" | "withWorkspaceRestoreSnapshot">;
|
|
303
|
+
registrationState: Pick<TelegramBusFollowerRegistrationState, "getTarget" | "getSlot" | "getGeneration" | "setRegistered" | "getLeaderProtocol">;
|
|
304
|
+
getWorkspaceAdmission: NonNullable<TelegramBusFollowerWorkspaceAdmissionDeps["getWorkspaceAdmission"]>;
|
|
305
|
+
recordRuntimeEvent?: TelegramBusFollowerWorkspaceAdmissionDeps["recordRuntimeEvent"];
|
|
306
|
+
}): (input: {
|
|
307
|
+
operationId: string;
|
|
308
|
+
registrationGeneration: string;
|
|
309
|
+
mode: "apply" | "inspect";
|
|
310
|
+
}, ctx: TContext) => Promise<TelegramBusWorkspaceRestoreObservation>;
|
|
301
311
|
export declare function createTelegramBusFollowerClientRuntime<TContext, TReactionUpdate, TCallbackQuery, TMessage = unknown>(deps: TelegramBusFollowerClientRuntimeDeps<TMessage>): {
|
|
302
312
|
createRequestId: () => string;
|
|
303
313
|
callApi: (method: string, args: unknown[]) => Promise<unknown>;
|
|
@@ -340,18 +350,6 @@ export declare function createTelegramBusFollowerClientRuntime<TContext, TReacti
|
|
|
340
350
|
handoffToken: string;
|
|
341
351
|
payload: TelegramQueueHandoffPayload;
|
|
342
352
|
}) => Promise<TelegramQueueHandoffStageResult>;
|
|
343
|
-
targetController: {
|
|
344
|
-
replaceTarget: (input: {
|
|
345
|
-
follower: import("./bus.ts").TelegramBusFollowerView;
|
|
346
|
-
target: TelegramTarget & {
|
|
347
|
-
threadId: number;
|
|
348
|
-
};
|
|
349
|
-
oldTarget?: TelegramTarget & {
|
|
350
|
-
threadId: number;
|
|
351
|
-
};
|
|
352
|
-
reason: "thread-restore";
|
|
353
|
-
}) => Promise<boolean>;
|
|
354
|
-
};
|
|
355
353
|
};
|
|
356
354
|
export declare function createTelegramBusFollowerQueueHandoffClient(deps: TelegramBusFollowerApiCallerDeps): (input: {
|
|
357
355
|
recipientInstanceId: string;
|
|
@@ -364,12 +362,6 @@ export declare function createTelegramBusFollowerQueueHandoffClient(deps: Telegr
|
|
|
364
362
|
handoffToken: string;
|
|
365
363
|
payload: TelegramQueueHandoffPayload;
|
|
366
364
|
}) => Promise<TelegramQueueHandoffStageResult>;
|
|
367
|
-
export declare function createTelegramBusAgentMessageClient(deps: TelegramBusFollowerApiCallerDeps): {
|
|
368
|
-
resolveTarget: (selector: TelegramBusAgentTargetSelector) => Promise<TelegramTarget & {
|
|
369
|
-
threadId: number;
|
|
370
|
-
}>;
|
|
371
|
-
routeMessage: (message: TelegramBusAgentMessage) => Promise<void>;
|
|
372
|
-
};
|
|
373
365
|
export declare function createTelegramBusFollowerApiCaller(deps: TelegramBusFollowerApiCallerDeps): (method: string, args: unknown[]) => Promise<unknown>;
|
|
374
366
|
export declare function createTelegramBusFollowerSessionReplacementSuspender(deps: TelegramBusFollowerSessionReplacementSuspenderDeps): (preserveTarget?: boolean) => Promise<void>;
|
|
375
367
|
export declare function createTelegramBusFollowerSessionRefreshHook<TContext>(deps: TelegramBusFollowerSessionRefreshHookDeps<TContext>): (_event: unknown, ctx: TContext) => Promise<void>;
|
|
@@ -398,6 +390,12 @@ export declare function createTelegramBusFollowerDurableAdmissionRuntime<TContex
|
|
|
398
390
|
} & Record<string, unknown>)[]): unknown;
|
|
399
391
|
};
|
|
400
392
|
signalWorker: (ctx: TContext) => void;
|
|
393
|
+
getNowMs?: () => number;
|
|
394
|
+
/** Bounded process-local replay window; omit for the production 24 h / 4,096-delivery defaults. */
|
|
395
|
+
recentDeliveryLimit?: {
|
|
396
|
+
maxAgeMs: number;
|
|
397
|
+
maxEntries: number;
|
|
398
|
+
};
|
|
401
399
|
}): TelegramBusFollowerDurableAdmissionPort<TContext>;
|
|
402
400
|
export interface TelegramBusFollowerInputCustodyBundle<TContext> {
|
|
403
401
|
acceptHandoff(input: {
|