@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/journal.d.ts
CHANGED
|
@@ -10,14 +10,7 @@ import { type TelegramWorkspaceAdmissionLedger, type TelegramWorkspaceAdmissionS
|
|
|
10
10
|
export declare const TELEGRAM_UPDATE_JOURNAL_VERSION: 1;
|
|
11
11
|
export declare const TELEGRAM_UPDATE_JOURNAL_EXCLUSION_VERSION: 2;
|
|
12
12
|
export declare const TELEGRAM_UPDATE_JOURNAL_CUSTODY_VERSION: 3;
|
|
13
|
-
export declare const TELEGRAM_UPDATE_JOURNAL_MAX_ENTRIES = 10000;
|
|
14
|
-
export declare const TELEGRAM_UPDATE_JOURNAL_MAX_BYTES: number;
|
|
15
|
-
export declare const TELEGRAM_UPDATE_JOURNAL_FAILURE_ID_MAX_LENGTH = 128;
|
|
16
13
|
export declare const TELEGRAM_UPDATE_JOURNAL_QUEUE_OWNER_ID_MAX_LENGTH = 256;
|
|
17
|
-
export declare const TELEGRAM_UPDATE_JOURNAL_INPUT_BINDING_MAX_LENGTH = 256;
|
|
18
|
-
export declare const TELEGRAM_UPDATE_JOURNAL_QUEUE_HANDOFF_ID_MAX_LENGTH = 128;
|
|
19
|
-
export declare const TELEGRAM_UPDATE_JOURNAL_QUEUE_HANDOFF_TOKEN_MIN_LENGTH = 32;
|
|
20
|
-
export declare const TELEGRAM_UPDATE_JOURNAL_QUEUE_HANDOFF_TOKEN_MAX_LENGTH = 256;
|
|
21
14
|
export declare const TELEGRAM_UPDATE_JOURNAL_FAILURE_CLASS_MAX_LENGTH = 128;
|
|
22
15
|
export declare const TELEGRAM_UPDATE_JOURNAL_FAILURE_SUMMARY_MAX_LENGTH = 512;
|
|
23
16
|
export interface TelegramFollowerJournalDiscovery {
|
|
@@ -29,7 +22,17 @@ export declare function discoverTelegramFollowerJournalPaths(input: {
|
|
|
29
22
|
directory: string;
|
|
30
23
|
profileName?: string;
|
|
31
24
|
}): TelegramFollowerJournalDiscovery;
|
|
32
|
-
|
|
25
|
+
/** Bounded read-only session-family discovery, not writer closure or deletion authority. */
|
|
26
|
+
export declare function discoverTelegramSessionJournalPaths(input: {
|
|
27
|
+
directory: string;
|
|
28
|
+
profileName?: string;
|
|
29
|
+
maxDirectoryEntries?: number;
|
|
30
|
+
}): TelegramFollowerJournalDiscovery;
|
|
31
|
+
/** Transitional discovery covers both retained flat recipients and session-owned families. */
|
|
32
|
+
export declare function discoverTelegramRecipientJournalPaths(input: {
|
|
33
|
+
directory: string;
|
|
34
|
+
profileName?: string;
|
|
35
|
+
}): TelegramFollowerJournalDiscovery;
|
|
33
36
|
export declare const TELEGRAM_UPDATE_JOURNAL_COMPACTION_SEGMENT_COUNT = 256;
|
|
34
37
|
export declare const TELEGRAM_UPDATE_JOURNAL_COMPACTION_SEGMENT_BYTES: number;
|
|
35
38
|
export type TelegramUpdateJournalErrorCode = "capacity" | "conflict" | "identity-mismatch" | "invalid" | "io" | "unsupported-version" | "pairing-evidence" | "sender-denied";
|
|
@@ -113,7 +116,6 @@ export interface TelegramUpdateJournalLegacyCustodyCandidate {
|
|
|
113
116
|
failureClass: string;
|
|
114
117
|
evidenceSha256: string;
|
|
115
118
|
}
|
|
116
|
-
export declare function listTelegramUpdateJournalLegacyCustodyCandidates(snapshot: Pick<TelegramUpdateJournalSnapshot, "entries">): TelegramUpdateJournalLegacyCustodyCandidate[];
|
|
117
119
|
export interface TelegramUpdateJournalLegacyCustodyDispositionAuthority {
|
|
118
120
|
version: 1;
|
|
119
121
|
dispositionId: string;
|
|
@@ -146,12 +148,21 @@ export interface TelegramUpdateJournalLegacyCustodyDisposition {
|
|
|
146
148
|
authorizedAtMs: number;
|
|
147
149
|
}
|
|
148
150
|
export type TelegramUpdateJournalOperatorDisposition = TelegramUpdateJournalTerminalOperatorDisposition | TelegramUpdateJournalLegacyCustodyDisposition;
|
|
151
|
+
export declare const TELEGRAM_ROUTING_INPUT_TTL_MS: number;
|
|
152
|
+
/** A source-only choice deadline, never a queue lease or a Thread deletion grant. */
|
|
153
|
+
export interface TelegramUpdateJournalRoutingInput {
|
|
154
|
+
operatorUserId: number;
|
|
155
|
+
publishedAtMs: number;
|
|
156
|
+
expiresAtMs: number;
|
|
157
|
+
phase: "waiting" | "selected";
|
|
158
|
+
}
|
|
149
159
|
export interface TelegramUpdateJournalEntry {
|
|
150
160
|
updateId: number;
|
|
151
161
|
update: TelegramJournaledUpdate;
|
|
152
162
|
/** Mandatory in v2/v3; immutable veto, never sender authorization. Absent only in legacy v1. */
|
|
153
163
|
preApprovalExcluded?: boolean;
|
|
154
164
|
admittedAtMs: number;
|
|
165
|
+
routingInput?: TelegramUpdateJournalRoutingInput;
|
|
155
166
|
state: TelegramUpdateJournalEntryState;
|
|
156
167
|
queueKind?: TelegramUpdateJournalQueueKind;
|
|
157
168
|
queueReceiptId?: string;
|
|
@@ -165,6 +176,16 @@ export interface TelegramUpdateJournalEntry {
|
|
|
165
176
|
terminalReason?: string;
|
|
166
177
|
terminalFailureId?: string;
|
|
167
178
|
}
|
|
179
|
+
/** Exact parsed journal entry identity, checked inside the source owner's mutation transaction. */
|
|
180
|
+
export interface TelegramUpdateJournalEntryDigest {
|
|
181
|
+
updateId: number;
|
|
182
|
+
sourceSha256: string;
|
|
183
|
+
}
|
|
184
|
+
/** Journal-owned removal ACK bound to an opaque, immutable caller acceptance scope. */
|
|
185
|
+
export interface TelegramUpdateJournalSourceCompletion extends TelegramUpdateJournalEntryDigest {
|
|
186
|
+
completionSha256: string;
|
|
187
|
+
}
|
|
188
|
+
export declare function createTelegramUpdateJournalEntryDigest(entry: TelegramUpdateJournalEntry): TelegramUpdateJournalEntryDigest;
|
|
168
189
|
export interface TelegramUpdateJournalFile {
|
|
169
190
|
version: typeof TELEGRAM_UPDATE_JOURNAL_VERSION | typeof TELEGRAM_UPDATE_JOURNAL_EXCLUSION_VERSION | typeof TELEGRAM_UPDATE_JOURNAL_CUSTODY_VERSION;
|
|
170
191
|
revision?: number;
|
|
@@ -173,6 +194,7 @@ export interface TelegramUpdateJournalFile {
|
|
|
173
194
|
botIdentity: TelegramUpdateJournalBotIdentity;
|
|
174
195
|
entries: TelegramUpdateJournalEntry[];
|
|
175
196
|
operatorDispositions?: TelegramUpdateJournalOperatorDisposition[];
|
|
197
|
+
sourceCompletions?: TelegramUpdateJournalSourceCompletion[];
|
|
176
198
|
}
|
|
177
199
|
export interface TelegramUpdateJournalSnapshot extends TelegramUpdateJournalFile {
|
|
178
200
|
exists: boolean;
|
|
@@ -187,6 +209,7 @@ export interface TelegramUpdateJournalAppendResult {
|
|
|
187
209
|
serializedBytes: number;
|
|
188
210
|
}
|
|
189
211
|
export interface TelegramUpdateJournalRemoveResult {
|
|
212
|
+
sourceCompletions?: TelegramUpdateJournalSourceCompletion[];
|
|
190
213
|
removedUpdateIds: number[];
|
|
191
214
|
entryCount: number;
|
|
192
215
|
serializedBytes: number;
|
|
@@ -204,6 +227,11 @@ export interface TelegramUpdateJournalQueueResult {
|
|
|
204
227
|
entryCount: number;
|
|
205
228
|
serializedBytes: number;
|
|
206
229
|
}
|
|
230
|
+
export interface TelegramUpdateJournalQueuedReceiptEvidence {
|
|
231
|
+
receipt: TelegramUpdateJournalQueuedCompletion;
|
|
232
|
+
sources: TelegramUpdateJournalEntryDigest[];
|
|
233
|
+
queueOwnerSha256: string;
|
|
234
|
+
}
|
|
207
235
|
export interface TelegramUpdateJournalQueuedCompletion {
|
|
208
236
|
queueKind: TelegramUpdateJournalQueueKind;
|
|
209
237
|
receiptId: string;
|
|
@@ -306,8 +334,72 @@ export interface TelegramUpdateJournalOperatorDispositionResult {
|
|
|
306
334
|
entryCount: number;
|
|
307
335
|
serializedBytes: number;
|
|
308
336
|
}
|
|
337
|
+
export interface TelegramUpdateJournalPendingAbandonmentInput {
|
|
338
|
+
journalBindingKey: string;
|
|
339
|
+
entry: TelegramUpdateJournalEntry;
|
|
340
|
+
operatorAuthorityId: string;
|
|
341
|
+
/** Caller proves owner authorization and excludes live chooser/worker dispatch through publication. */
|
|
342
|
+
isCurrent: () => boolean;
|
|
343
|
+
}
|
|
344
|
+
export interface TelegramUpdateJournalPendingAbandonmentResult {
|
|
345
|
+
disposition: TelegramUpdateJournalLegacyCustodyDisposition;
|
|
346
|
+
retainedPath: string;
|
|
347
|
+
duplicate: boolean;
|
|
348
|
+
entryCount: number;
|
|
349
|
+
serializedBytes: number;
|
|
350
|
+
}
|
|
351
|
+
/** Private evidence copy, not execution authority or proof that abandonment committed. */
|
|
352
|
+
export interface TelegramUpdateJournalRetainedInput {
|
|
353
|
+
version: 1;
|
|
354
|
+
kind: "pending-input-retention";
|
|
355
|
+
journalBindingKey: string;
|
|
356
|
+
entry: TelegramUpdateJournalEntry;
|
|
357
|
+
requestedDisposition: TelegramUpdateJournalLegacyCustodyDisposition;
|
|
358
|
+
}
|
|
359
|
+
export interface TelegramUpdateJournalPendingRetentionEvidence {
|
|
360
|
+
journalBindingKey: string;
|
|
361
|
+
retainedPath: string;
|
|
362
|
+
requestedDisposition: TelegramUpdateJournalLegacyCustodyDisposition;
|
|
363
|
+
}
|
|
364
|
+
/** Durable proof that an owner abandoned this exact pending source; never delivery or completion proof. */
|
|
365
|
+
export interface TelegramUpdateJournalAbandonedPendingEvidence {
|
|
366
|
+
journalBindingKey: string;
|
|
367
|
+
updateId: number;
|
|
368
|
+
retainedPath: string;
|
|
369
|
+
operatorAuthorityId: string;
|
|
370
|
+
}
|
|
371
|
+
export interface TelegramRoutingInputAuthority {
|
|
372
|
+
journalBindingKey: string;
|
|
373
|
+
entries: readonly TelegramUpdateJournalEntry[];
|
|
374
|
+
operatorUserId: number;
|
|
375
|
+
isCurrent(): boolean;
|
|
376
|
+
}
|
|
377
|
+
/** Expiry drops a donor attempt without retaining its body or claiming recipient execution/cancellation. */
|
|
378
|
+
export type TelegramRoutingInputExpiryResult = Omit<TelegramUpdateJournalPendingAbandonmentResult, "retainedPath">;
|
|
379
|
+
export type TelegramRoutingInputExpiryEvidence = Omit<TelegramUpdateJournalAbandonedPendingEvidence, "retainedPath">;
|
|
380
|
+
/** Package-private v1 capability; raw input custody does not expose it. */
|
|
381
|
+
export interface TelegramRoutingInputJournal {
|
|
382
|
+
arm(input: TelegramRoutingInputAuthority & {
|
|
383
|
+
publishedAtMs: number;
|
|
384
|
+
}): TelegramUpdateJournalEntry[];
|
|
385
|
+
select(input: TelegramRoutingInputAuthority): {
|
|
386
|
+
issued: boolean;
|
|
387
|
+
entries: TelegramUpdateJournalEntry[];
|
|
388
|
+
};
|
|
389
|
+
expire(input: Omit<TelegramRoutingInputAuthority, "entries"> & {
|
|
390
|
+
entry: TelegramUpdateJournalEntry;
|
|
391
|
+
}): TelegramRoutingInputExpiryResult;
|
|
392
|
+
inspectExpiry(updateId: number): TelegramRoutingInputExpiryEvidence | undefined;
|
|
393
|
+
inspectGroupExpiry(updateIds: readonly number[]): TelegramRoutingInputExpiryEvidence[] | undefined;
|
|
394
|
+
}
|
|
309
395
|
export interface TelegramUpdateJournalStore {
|
|
396
|
+
routingInputs?: TelegramRoutingInputJournal;
|
|
310
397
|
read(): TelegramUpdateJournalSnapshot;
|
|
398
|
+
/** Read-only: the committed abandonment tombstone plus its matching private retention, or undefined. */
|
|
399
|
+
inspectAbandonedPending(updateId: number): TelegramUpdateJournalAbandonedPendingEvidence | undefined;
|
|
400
|
+
/** Read-only protection evidence for this snapshot entry, never commit/execution authority. */
|
|
401
|
+
inspectPendingRetention(entry: TelegramUpdateJournalEntry): TelegramUpdateJournalPendingRetentionEvidence | undefined;
|
|
402
|
+
abandonPending(input: TelegramUpdateJournalPendingAbandonmentInput): TelegramUpdateJournalPendingAbandonmentResult;
|
|
311
403
|
appendBatch<TUpdate extends TelegramUpdateJournalInput>(updates: readonly TUpdate[], acceptedThroughUpdateId?: number): TelegramUpdateJournalAppendResult;
|
|
312
404
|
markQueued(receipt: TelegramUpdateJournalQueueReceipt): TelegramUpdateJournalQueueResult;
|
|
313
405
|
markExecutionFailure(input: TelegramUpdateJournalFailureInput): TelegramUpdateJournalFailureResult;
|
|
@@ -317,16 +409,28 @@ export interface TelegramUpdateJournalStore {
|
|
|
317
409
|
acceptQueuedHandoff(input: TelegramUpdateJournalQueueHandoffInput): TelegramUpdateJournalQueueHandoffAcceptResult;
|
|
318
410
|
cancelQueuedHandoff(input: TelegramUpdateJournalQueueHandoffInput): TelegramUpdateJournalQueueHandoffCancelResult;
|
|
319
411
|
completeQueued(receipts: readonly TelegramUpdateJournalQueuedCompletion[]): TelegramUpdateJournalRemoveResult;
|
|
412
|
+
/** Strict v1 whole-receipt disposal co-publishes caller-scoped ACKs; never a readiness grant. */
|
|
413
|
+
completeQueuedExact(receipts: readonly TelegramUpdateJournalQueuedCompletion[], completions: readonly TelegramUpdateJournalSourceCompletion[]): TelegramUpdateJournalRemoveResult;
|
|
320
414
|
discardQueued(input: TelegramUpdateJournalQueueDiscardInput): TelegramUpdateJournalQueueDiscardResult;
|
|
321
415
|
recoverDeadQueueOwner(input: TelegramUpdateJournalDeadQueueOwnerRecoveryInput): TelegramUpdateJournalDeadQueueOwnerRecoveryResult;
|
|
322
416
|
removeCompleted(updateIds: readonly number[]): TelegramUpdateJournalRemoveResult;
|
|
417
|
+
/** Guarded completion; every supplied source must still match, and absence is a conflict, not an ACK. */
|
|
418
|
+
removeCompletedExact(updateIds: readonly number[], expectedSources: readonly TelegramUpdateJournalEntryDigest[], completions?: readonly TelegramUpdateJournalSourceCompletion[]): TelegramUpdateJournalRemoveResult;
|
|
419
|
+
/** Strict read-only observation; neither source absence nor a different scope is completion evidence. */
|
|
420
|
+
inspectSourceCompletion(expected: TelegramUpdateJournalSourceCompletion): TelegramUpdateJournalSourceCompletion | undefined;
|
|
421
|
+
/** Complete strict observation of a retained, unoffered v1 queue receipt; never acquires readiness. */
|
|
422
|
+
inspectQueuedReceipt(expected: TelegramUpdateJournalQueuedCompletion): TelegramUpdateJournalQueuedReceiptEvidence | undefined;
|
|
423
|
+
isQueueReceiptCurrent?: (receipt: Pick<TelegramUpdateJournalQueuedCompletion, "queueKind" | "receiptId" | "sourceUpdateIds"> & {
|
|
424
|
+
journalBindingKey?: string;
|
|
425
|
+
}, owner: TelegramUpdateJournalQueueOwner) => boolean;
|
|
323
426
|
}
|
|
324
427
|
export type TelegramUpdateJournalPublicationBoundary = "before-write" | "after-write-before-rename";
|
|
325
428
|
export interface TelegramUpdateJournalRecoveryEvent {
|
|
326
429
|
kind: "repaired" | "reset";
|
|
327
430
|
path: string;
|
|
328
431
|
revision?: number;
|
|
329
|
-
|
|
432
|
+
/** Damaged snapshot/segment paths deleted or atomically replaced; nothing is retained for recovery. */
|
|
433
|
+
deletedPaths?: string[];
|
|
330
434
|
reason: string;
|
|
331
435
|
}
|
|
332
436
|
export interface TelegramUpdateJournalStoreOptions {
|
|
@@ -498,6 +602,7 @@ export interface TelegramUpdateJournalSegment {
|
|
|
498
602
|
upsertedEntries: TelegramUpdateJournalEntry[];
|
|
499
603
|
removedUpdateIds: number[];
|
|
500
604
|
operatorDispositions?: TelegramUpdateJournalOperatorDisposition[];
|
|
605
|
+
sourceCompletions?: TelegramUpdateJournalSourceCompletion[];
|
|
501
606
|
}
|
|
502
607
|
export interface TelegramUpdateJournalSegmentPublicationResult {
|
|
503
608
|
path: string;
|
|
@@ -507,6 +612,8 @@ export interface TelegramUpdateJournalSegmentPublicationResult {
|
|
|
507
612
|
export declare function parseTelegramUpdateJournalQueueOwner(value: unknown): TelegramUpdateJournalQueueOwner | undefined;
|
|
508
613
|
export declare function isTelegramUpdateJournalQueueOwnerProcess(owner: TelegramUpdateJournalQueueOwner, identity: TelegramUpdateJournalQueueOwnerIdentity): boolean;
|
|
509
614
|
export declare function areTelegramUpdateJournalQueueOwnersEqual(left: TelegramUpdateJournalQueueOwner, right: TelegramUpdateJournalQueueOwner): boolean;
|
|
615
|
+
/** Only legacy v1 carries routing-lifetime, scoped-ACK and pairing-free queue-receipt semantics. */
|
|
616
|
+
export declare function isTelegramUpdateJournalLegacyFamilyVersion(version: unknown): boolean;
|
|
510
617
|
/**
|
|
511
618
|
* Isolated evidence only: caller must serialize/quiesce writers before inspection
|
|
512
619
|
* and consumption. Metadata checks detect observable changes, not hostile same-user
|
|
@@ -541,6 +648,18 @@ export declare function inspectTelegramUpdateJournalFamily(input: {
|
|
|
541
648
|
work: number;
|
|
542
649
|
};
|
|
543
650
|
};
|
|
651
|
+
export interface TelegramUpdateJournalRetentionInspection {
|
|
652
|
+
evidence: ReturnType<typeof inspectTelegramUpdateJournalFamily>;
|
|
653
|
+
retainedInputs: {
|
|
654
|
+
path: string;
|
|
655
|
+
journalBindingKey: string;
|
|
656
|
+
failureId: string;
|
|
657
|
+
updateId: number;
|
|
658
|
+
state: "committed" | "uncommitted";
|
|
659
|
+
}[];
|
|
660
|
+
}
|
|
661
|
+
/** Classifies private originals against exact discard tombstones; never replay or deletion authority. */
|
|
662
|
+
export declare function inspectTelegramUpdateJournalRetention(input: Parameters<typeof inspectTelegramUpdateJournalFamily>[0]): TelegramUpdateJournalRetentionInspection;
|
|
544
663
|
/**
|
|
545
664
|
* Read-only source evidence for cooperating writers serialized by the caller through
|
|
546
665
|
* consumption; never readiness, recovery, or permission to publish. Ancestors retain
|
|
@@ -560,7 +679,7 @@ export declare function readTelegramUpdateJournalSource(input: Parameters<typeof
|
|
|
560
679
|
* Recensus detects observable changes, not hostile same-user path swaps; arbitrary
|
|
561
680
|
* consumer references and archive consumption require separate audits.
|
|
562
681
|
*/
|
|
563
|
-
export
|
|
682
|
+
export interface TelegramJournalNamespaceInspectionInput {
|
|
564
683
|
directory: string;
|
|
565
684
|
profile: string;
|
|
566
685
|
botIdentity: TelegramUpdateJournalBotIdentity;
|
|
@@ -571,9 +690,18 @@ export declare function inspectTelegramProfileJournalNamespace(input: {
|
|
|
571
690
|
maxEntries: number;
|
|
572
691
|
maxWork: number;
|
|
573
692
|
};
|
|
574
|
-
|
|
693
|
+
/** Leader polling journal named by owners.json; defaults to the flat root `inbox`. */
|
|
694
|
+
pollingPath?: string;
|
|
695
|
+
/** Hold a participating consumer reference during each physical family read. */
|
|
696
|
+
withSourceReference?: <T>(path: string, operation: () => T) => T;
|
|
697
|
+
}
|
|
698
|
+
export interface TelegramJournalNamespaceInspection {
|
|
699
|
+
/** Original preservation facts only, never replay/deletion grants. */
|
|
700
|
+
retainedInputs?: (TelegramUpdateJournalRetentionInspection["retainedInputs"][number] & {
|
|
701
|
+
journalPath: string;
|
|
702
|
+
})[];
|
|
575
703
|
sources: {
|
|
576
|
-
role: "polling" | "follower";
|
|
704
|
+
role: "polling" | "follower" | "session";
|
|
577
705
|
path: string;
|
|
578
706
|
evidence: ReturnType<typeof inspectTelegramUpdateJournalFamily>;
|
|
579
707
|
}[];
|
|
@@ -584,7 +712,15 @@ export declare function inspectTelegramProfileJournalNamespace(input: {
|
|
|
584
712
|
work: number;
|
|
585
713
|
};
|
|
586
714
|
knownBotId?: number;
|
|
587
|
-
}
|
|
715
|
+
}
|
|
716
|
+
export declare function inspectTelegramProfileJournalNamespace(input: TelegramJournalNamespaceInspectionInput): TelegramJournalNamespaceInspection;
|
|
717
|
+
/** Read-only evidence over polling, retained flat recipients and role-neutral session journals. */
|
|
718
|
+
export declare function inspectTelegramSessionJournalNamespace(input: TelegramJournalNamespaceInspectionInput): TelegramJournalNamespaceInspection;
|
|
719
|
+
/** Complete-empty protection only; caller holds source serialization through consumption. Never deletion authority. */
|
|
720
|
+
export declare function isTelegramThreadCleanupJournalNamespaceClear(input: TelegramJournalNamespaceInspectionInput & {
|
|
721
|
+
requiredJournalBindingKeys: readonly string[];
|
|
722
|
+
withSourceReference: NonNullable<TelegramJournalNamespaceInspectionInput["withSourceReference"]>;
|
|
723
|
+
}): boolean;
|
|
588
724
|
export declare function publishTelegramUpdateJournalSegment(path: string, segment: TelegramUpdateJournalSegment): TelegramUpdateJournalSegmentPublicationResult;
|
|
589
725
|
export declare function createTelegramUpdateQueueHandoffToken(): string;
|
|
590
726
|
export declare function createTelegramUpdateJournalBotIdentity(input: {
|
|
@@ -612,6 +748,7 @@ export interface TelegramUpdateJournalRuntimeBinding {
|
|
|
612
748
|
journal: TelegramUpdateJournalStore;
|
|
613
749
|
readForProtection?: () => {
|
|
614
750
|
entries: readonly TelegramUpdateJournalEntry[];
|
|
751
|
+
exists: boolean;
|
|
615
752
|
};
|
|
616
753
|
}
|
|
617
754
|
export interface TelegramUpdateJournalRuntimeBindingResolverDeps {
|
|
@@ -621,8 +758,11 @@ export interface TelegramUpdateJournalRuntimeBindingResolverDeps {
|
|
|
621
758
|
getJournalPath: (profileName?: string) => string;
|
|
622
759
|
getQueueRuntimeIdentity?: () => TelegramUpdateJournalQueueRuntimeIdentity;
|
|
623
760
|
withWriterAdmission?: <T>(operation: () => T) => T;
|
|
761
|
+
withSourceSerialization?: TelegramUpdateJournalStoreOptions["withSourceSerialization"];
|
|
624
762
|
getWorkspaceAdmission?: () => Pick<TelegramWorkspaceAdmissionLedger, "acquireAdmission" | "releaseAdmission"> | undefined;
|
|
625
763
|
onRecovery?: (event: TelegramUpdateJournalRecoveryEvent) => void;
|
|
764
|
+
/** Strict no-follow source handles; defaults to platform support (absent on Windows). */
|
|
765
|
+
strictSourceAccess?: boolean;
|
|
626
766
|
}
|
|
627
767
|
export declare function createTelegramUpdateJournalRuntimeBindingResolver(deps: TelegramUpdateJournalRuntimeBindingResolverDeps): () => TelegramUpdateJournalRuntimeBinding | undefined;
|
|
628
768
|
export type TelegramUpdateJournalReferenceClass = "leader-lifecycle" | "follower-lifecycle" | "polling-cursor" | "polling-bootstrap" | "workspace-retirement" | "operator-disposition";
|
|
@@ -648,19 +788,46 @@ export declare function withTelegramResolvedUpdateJournalReference<T>(input: {
|
|
|
648
788
|
referenceClass: TelegramUpdateJournalReferenceClass;
|
|
649
789
|
operation(binding: TelegramUpdateJournalRuntimeBinding): T;
|
|
650
790
|
}): T | undefined;
|
|
791
|
+
/** Operator-distinct authority: routing never treats it as an owner cancellation. */
|
|
792
|
+
export declare const TELEGRAM_SESSION_ADOPTION_AUTHORITY_PREFIX = "session-successor:";
|
|
793
|
+
export interface TelegramSessionPendingAdoptionInput {
|
|
794
|
+
recipientBindingKey: string;
|
|
795
|
+
predecessorSessionId: string;
|
|
796
|
+
successorSessionId: string;
|
|
797
|
+
/** Caller proves the successor registration is current and no predecessor worker runs. */
|
|
798
|
+
isCurrent: () => boolean;
|
|
799
|
+
}
|
|
800
|
+
export interface TelegramSessionPendingAdoptionResult {
|
|
801
|
+
adoptedUpdateIds: number[];
|
|
802
|
+
/** Already committed away by an earlier attempt; never re-appended, the private original remains. */
|
|
803
|
+
retainedUpdateIds: number[];
|
|
804
|
+
}
|
|
651
805
|
export interface TelegramUpdateJournalBindingRuntime {
|
|
652
806
|
resolveLeader: () => TelegramUpdateJournalRuntimeBinding | undefined;
|
|
653
807
|
resolveFollower: () => TelegramUpdateJournalRuntimeBinding | undefined;
|
|
654
808
|
resolveActive: () => TelegramUpdateJournalRuntimeBinding | undefined;
|
|
655
809
|
getActiveRecoveryKey: () => string | undefined;
|
|
656
|
-
|
|
810
|
+
/** Exact historical proof lookup; no store, admission, execution, recovery or mutation port. */
|
|
811
|
+
inspectSourceAbandonment: (journalBindingKey: string, updateId: number) => TelegramUpdateJournalAbandonedPendingEvidence | undefined;
|
|
812
|
+
inspectSourceGroupExpiry: (journalBindingKey: string, updateIds: readonly number[]) => TelegramRoutingInputExpiryEvidence[] | undefined;
|
|
813
|
+
inspectSourceCompletion: (journalBindingKey: string, expected: TelegramUpdateJournalSourceCompletion) => TelegramUpdateJournalSourceCompletion | undefined;
|
|
814
|
+
inspectQueuedReceipt: (journalBindingKey: string, expected: TelegramUpdateJournalQueuedCompletion) => TelegramUpdateJournalQueuedReceiptEvidence | undefined;
|
|
815
|
+
/** In-process `/new` succession: move unclaimed predecessor pending inputs into the successor session journal. */
|
|
816
|
+
adoptPredecessorPending: (input: TelegramSessionPendingAdoptionInput) => TelegramSessionPendingAdoptionResult;
|
|
817
|
+
/** Process-local: adopts from the previously prepared session of the same recipient key, then records the active one. */
|
|
818
|
+
prepareActiveFollowerSuccession: (isCurrent: () => boolean) => TelegramSessionPendingAdoptionResult | undefined;
|
|
819
|
+
createRecipientResolver: (recipientBindingKey: string, sessionId?: string) => () => TelegramUpdateJournalRuntimeBinding | undefined;
|
|
820
|
+
createLegacyRecipientResolver: (recipientBindingKey: string) => () => TelegramUpdateJournalRuntimeBinding | undefined;
|
|
657
821
|
createPathResolver: (path: string) => () => TelegramUpdateJournalRuntimeBinding | undefined;
|
|
658
822
|
}
|
|
659
823
|
export declare function createTelegramUpdateJournalBindingRuntime(deps: {
|
|
660
824
|
base: Omit<TelegramUpdateJournalRuntimeBindingResolverDeps, "getJournalPath">;
|
|
661
825
|
getLeaderJournalPath: (profileName?: string) => string;
|
|
662
|
-
|
|
826
|
+
/** Runtime root; defaults to the leader journal's directory for flat layouts. */
|
|
827
|
+
getRuntimeDir?: () => string;
|
|
828
|
+
getFollowerJournalPath: (bindingKey: string, profileName?: string, sessionId?: string) => string;
|
|
663
829
|
getActiveFollowerBindingKey: () => string;
|
|
830
|
+
getActiveFollowerSessionId?: () => string | undefined;
|
|
664
831
|
isFollowerRegistered: () => boolean;
|
|
665
832
|
}): TelegramUpdateJournalBindingRuntime;
|
|
666
833
|
export declare function createTelegramUpdateJournalStore(options: TelegramUpdateJournalStoreOptions): TelegramUpdateJournalStore;
|