@robota-sdk/agent-transport 3.0.0-beta.82 → 3.0.0-beta.83
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/CHANGELOG.md +752 -0
- package/dist/browser/client.d.ts +2 -2
- package/dist/browser/client.js +1 -1
- package/dist/browser/index.d.ts +31 -11
- package/dist/browser/index.d.ts.map +1 -1
- package/dist/browser/index.js +1 -1
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/observer-messages-Bx-xReUQ.js +2 -0
- package/dist/browser/observer-messages-Bx-xReUQ.js.map +1 -0
- package/dist/browser/{message-decoders-BB8n-H2X.d.ts → observer-messages-DC_8VHk9.d.ts} +104 -7
- package/dist/browser/observer-messages-DC_8VHk9.d.ts.map +1 -0
- package/dist/node/index.cjs +1 -1
- package/dist/node/index.d.cts +131 -14
- package/dist/node/index.d.cts.map +1 -1
- package/dist/node/index.d.ts +131 -14
- package/dist/node/index.d.ts.map +1 -1
- package/dist/node/index.js +1 -1
- package/dist/node/index.js.map +1 -1
- package/dist/node/node.cjs +1 -1
- package/dist/node/node.d.cts +69 -1
- package/dist/node/node.d.cts.map +1 -1
- package/dist/node/node.d.ts +70 -2
- package/dist/node/node.d.ts.map +1 -1
- package/dist/node/node.js +1 -1
- package/dist/node/node.js.map +1 -1
- package/package.json +13 -11
- package/src/__tests__/bearer-resource-gate.test.ts +120 -0
- package/src/__tests__/history-attached-budget.test.ts +216 -0
- package/src/__tests__/message-decoders.test.ts +201 -5
- package/src/__tests__/session-detail-loop-status.test.ts +169 -0
- package/src/__tests__/session-directory-messages.test.ts +192 -0
- package/src/__tests__/session-history-wire.test.ts +342 -0
- package/src/__tests__/session-message-handler-observe.test.ts +193 -0
- package/src/__tests__/session-message-handler.test.ts +82 -1
- package/src/__tests__/ws-broadcast-events.test.ts +10 -0
- package/src/client.ts +9 -1
- package/src/index.ts +14 -2
- package/src/loop-control-messages.ts +34 -0
- package/src/message-decoders.ts +82 -4
- package/src/node/bearer-resource-gate.ts +291 -0
- package/src/node/index.ts +13 -0
- package/src/observer-messages.ts +36 -0
- package/src/open-prompts.ts +76 -0
- package/src/outbound-delivery.ts +11 -2
- package/src/protocol-session.ts +7 -1
- package/src/session-directory-messages.ts +85 -0
- package/src/session-events.ts +93 -18
- package/src/session-message-handler.ts +53 -8
- package/src/session-query-messages.ts +105 -4
- package/src/wire-messages.ts +105 -7
- package/dist/browser/message-decoders-BB8n-H2X.d.ts.map +0 -1
- package/dist/browser/message-decoders-CDmDoZPR.js +0 -2
- package/dist/browser/message-decoders-CDmDoZPR.js.map +0 -1
package/dist/node/index.d.cts
CHANGED
|
@@ -1,11 +1,26 @@
|
|
|
1
1
|
import { IPersonalUsageReport, IPersonalUsageRequest, IUsageBySourceReport, TUsageSurface } from "@robota-sdk/agent-interface-analytics";
|
|
2
|
-
import { ICommandResult } from "@robota-sdk/agent-interface-command";
|
|
3
|
-
import { IBackgroundJobGroupState, IBackgroundTaskInput, IBackgroundTaskListFilter, IBackgroundTaskLogCursor, IBackgroundTaskLogPage, IBackgroundTaskState, IExecutionWorkspaceSnapshot, TBackgroundJobGroupEvent, TBackgroundTaskEvent } from "@robota-sdk/agent-interface-execution";
|
|
4
|
-
import { IAskRequestEvent, IBranchEvent, IContextFileRefreshedEvent, IExecutionResult, IPermissionRequestEvent, IPlanApprovalEvent, IPromptResolvedEvent, ISessionBackgroundGroups, ISessionBackgroundTasks, ISessionCommands, ISessionConversationRead, ISessionDriverAttribution, ISessionEvents, ISessionExecutionState, ISessionExecutionWorkspace, ISessionPromptResolution, ISessionRenamedEvent, ISessionTurnControl, ISessionTurnSubmission, IToolState, IUiIntentEvent, TDriverId, TPermissionResultValue } from "@robota-sdk/agent-interface-session";
|
|
2
|
+
import { ICommandListEntry, ICommandResult, ICommandSkillListEntry } from "@robota-sdk/agent-interface-command";
|
|
3
|
+
import { IBackgroundJobGroupState, IBackgroundTaskInput, IBackgroundTaskListFilter, IBackgroundTaskLogCursor, IBackgroundTaskLogPage, IBackgroundTaskState, IExecutionDetailCursor, IExecutionDetailPage, IExecutionWorkspaceSnapshot, TBackgroundJobGroupEvent, TBackgroundTaskEvent } from "@robota-sdk/agent-interface-execution";
|
|
4
|
+
import { IAskRequestEvent, IBranchEvent, IContextFileRefreshedEvent, IExecutionResult, IPermissionRequestEvent, IPlanApprovalEvent, IPromptResolvedEvent, ISessionBackgroundGroups, ISessionBackgroundTasks, ISessionCommands, ISessionConversationRead, ISessionDirectory, ISessionDriverAttribution, ISessionEvents, ISessionExecutionDetail, ISessionExecutionState, ISessionExecutionWorkspace, ISessionListing, ISessionPromptResolution, ISessionRenamedEvent, ISessionSelfPacedLoopControl, ISessionStatusRead, ISessionStatusSnapshot, ISessionSwitchedEvent, ISessionTurnControl, ISessionTurnSubmission, IToolState, IUiIntentEvent, TDriverId, TPermissionResultValue, TSessionChangeRefusalCode, TTurnSource, TWaitingLoopStopOutcome } from "@robota-sdk/agent-interface-session";
|
|
5
5
|
import { IBinaryFrame, IChannelEventFrame, TActionResponse, TChannelReceiveResult } from "@robota-sdk/agent-interface-transport";
|
|
6
6
|
import { IHandoffIntegrity, IPeerMessage, IPeerMessageAck, TPeerDeliveryState } from "@robota-sdk/agent-interface-session-mobility";
|
|
7
7
|
//#region src/wire-messages.d.ts
|
|
8
8
|
type TBackgroundControlAction = 'cancel' | 'close' | 'send';
|
|
9
|
+
type THistoryEntry = ReturnType<ISessionConversationRead['getFullHistory']>[number];
|
|
10
|
+
/**
|
|
11
|
+
* #3189: one entry of the session's full history as it crosses the wire. The same record the session
|
|
12
|
+
* keeps, except that `timestamp` is an ISO 8601 string: a `Date` does not survive JSON, and a
|
|
13
|
+
* declared `Date` that arrives as a string would let a client call `Date` methods on a string.
|
|
14
|
+
*/
|
|
15
|
+
interface IWireHistoryEntry extends Omit<THistoryEntry, 'timestamp'> {
|
|
16
|
+
/** ISO 8601. */
|
|
17
|
+
timestamp: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* #3189: a turn's result as it crosses the wire. The session's whole history stays behind: it only
|
|
21
|
+
* grows, so a client reads it in bounded pages with `get-history` instead.
|
|
22
|
+
*/
|
|
23
|
+
type TWireExecutionResult = Omit<IExecutionResult, 'history'>;
|
|
9
24
|
/** Inbound message from client to server. */
|
|
10
25
|
type TClientMessage = {
|
|
11
26
|
type: 'submit';
|
|
@@ -14,14 +29,34 @@ type TClientMessage = {
|
|
|
14
29
|
type: 'command';
|
|
15
30
|
name: string;
|
|
16
31
|
args?: string;
|
|
32
|
+
requestId?: string;
|
|
17
33
|
} | {
|
|
18
34
|
type: 'abort';
|
|
19
35
|
} | {
|
|
20
36
|
type: 'cancel-queue';
|
|
21
37
|
} | {
|
|
22
38
|
type: 'get-messages';
|
|
39
|
+
} | {
|
|
40
|
+
type: 'get-history';
|
|
41
|
+
fromIndex?: number;
|
|
42
|
+
} | {
|
|
43
|
+
type: 'get-prompts';
|
|
23
44
|
} | {
|
|
24
45
|
type: 'get-context';
|
|
46
|
+
} | {
|
|
47
|
+
type: 'get-commands';
|
|
48
|
+
} | {
|
|
49
|
+
type: 'get-status';
|
|
50
|
+
} | {
|
|
51
|
+
type: 'list-sessions';
|
|
52
|
+
requestId: string;
|
|
53
|
+
} | {
|
|
54
|
+
type: 'new-session';
|
|
55
|
+
requestId?: string;
|
|
56
|
+
} | {
|
|
57
|
+
type: 'switch-session';
|
|
58
|
+
sessionId: string;
|
|
59
|
+
requestId?: string;
|
|
25
60
|
} | {
|
|
26
61
|
type: 'get-usage-report';
|
|
27
62
|
} | {
|
|
@@ -39,6 +74,14 @@ type TClientMessage = {
|
|
|
39
74
|
type: 'get-pending';
|
|
40
75
|
} | {
|
|
41
76
|
type: 'get-execution-workspace';
|
|
77
|
+
} | {
|
|
78
|
+
type: 'read-execution-detail';
|
|
79
|
+
requestId: string;
|
|
80
|
+
entryId: string;
|
|
81
|
+
cursor?: IExecutionDetailCursor;
|
|
82
|
+
} | {
|
|
83
|
+
type: 'stop-waiting-loop';
|
|
84
|
+
requestId: string;
|
|
42
85
|
} | {
|
|
43
86
|
type: 'get-background-tasks';
|
|
44
87
|
filter?: IBackgroundTaskListFilter;
|
|
@@ -106,11 +149,11 @@ type TServerMessage = {
|
|
|
106
149
|
driverId?: TDriverId;
|
|
107
150
|
} | {
|
|
108
151
|
type: 'complete';
|
|
109
|
-
result:
|
|
152
|
+
result: TWireExecutionResult;
|
|
110
153
|
driverId?: TDriverId;
|
|
111
154
|
} | {
|
|
112
155
|
type: 'interrupted';
|
|
113
|
-
result:
|
|
156
|
+
result: TWireExecutionResult;
|
|
114
157
|
driverId?: TDriverId;
|
|
115
158
|
} | {
|
|
116
159
|
type: 'error';
|
|
@@ -122,12 +165,48 @@ type TServerMessage = {
|
|
|
122
165
|
message: string;
|
|
123
166
|
success: boolean;
|
|
124
167
|
data?: ICommandResult['data'];
|
|
168
|
+
/** The `requestId` of the `command` this answers, when it carried one. */
|
|
169
|
+
requestId?: string;
|
|
125
170
|
} | {
|
|
126
171
|
type: 'messages';
|
|
127
172
|
messages: ReturnType<ISessionConversationRead['getMessages']>;
|
|
173
|
+
} | {
|
|
174
|
+
type: 'history';
|
|
175
|
+
startIndex: number;
|
|
176
|
+
total: number;
|
|
177
|
+
entries: IWireHistoryEntry[];
|
|
128
178
|
} | {
|
|
129
179
|
type: 'context';
|
|
130
180
|
state: ReturnType<ISessionConversationRead['getContextState']>;
|
|
181
|
+
} | {
|
|
182
|
+
type: 'history_changed';
|
|
183
|
+
} | {
|
|
184
|
+
type: 'turn_source';
|
|
185
|
+
source: TTurnSource;
|
|
186
|
+
} | {
|
|
187
|
+
type: 'commands';
|
|
188
|
+
commands: ICommandListEntry[];
|
|
189
|
+
skills: ICommandSkillListEntry[];
|
|
190
|
+
} | {
|
|
191
|
+
type: 'session_status';
|
|
192
|
+
status: ISessionStatusSnapshot;
|
|
193
|
+
} | {
|
|
194
|
+
type: 'sessions';
|
|
195
|
+
requestId: string;
|
|
196
|
+
listing: ISessionListing;
|
|
197
|
+
} | {
|
|
198
|
+
type: 'sessions_error';
|
|
199
|
+
requestId: string;
|
|
200
|
+
code: 'not_available' | 'list_failed';
|
|
201
|
+
message: string;
|
|
202
|
+
} | {
|
|
203
|
+
type: 'session_switched';
|
|
204
|
+
event: ISessionSwitchedEvent;
|
|
205
|
+
} | {
|
|
206
|
+
type: 'session_change_failed';
|
|
207
|
+
code: TSessionChangeRefusalCode;
|
|
208
|
+
message: string;
|
|
209
|
+
requestId?: string;
|
|
131
210
|
} | {
|
|
132
211
|
type: 'usage_report';
|
|
133
212
|
report: IUsageBySourceReport;
|
|
@@ -157,9 +236,22 @@ type TServerMessage = {
|
|
|
157
236
|
} | {
|
|
158
237
|
type: 'pending';
|
|
159
238
|
pending: string | null;
|
|
239
|
+
pendingCount?: number;
|
|
160
240
|
} | {
|
|
161
241
|
type: 'execution_workspace_event';
|
|
162
242
|
snapshot: IExecutionWorkspaceSnapshot;
|
|
243
|
+
} | {
|
|
244
|
+
type: 'execution_detail';
|
|
245
|
+
requestId: string;
|
|
246
|
+
page: IExecutionDetailPage;
|
|
247
|
+
} | {
|
|
248
|
+
type: 'execution_detail_error';
|
|
249
|
+
requestId: string;
|
|
250
|
+
message: string;
|
|
251
|
+
} | {
|
|
252
|
+
type: 'waiting_loop_stop';
|
|
253
|
+
requestId: string;
|
|
254
|
+
outcome: TWaitingLoopStopOutcome;
|
|
163
255
|
} | {
|
|
164
256
|
type: 'background_task_event';
|
|
165
257
|
event: TBackgroundTaskEvent;
|
|
@@ -219,6 +311,7 @@ type TServerMessage = {
|
|
|
219
311
|
} | {
|
|
220
312
|
type: 'protocol_error';
|
|
221
313
|
message: string;
|
|
314
|
+
requestId?: string;
|
|
222
315
|
} | {
|
|
223
316
|
type: 'resume_gap';
|
|
224
317
|
};
|
|
@@ -262,14 +355,22 @@ type TOutboundDeliver = ((message: TServerMessage) => void) & {
|
|
|
262
355
|
};
|
|
263
356
|
/**
|
|
264
357
|
* Observe THIS connection's first outbound delivery failure. `event` is the `type` of the frame that
|
|
265
|
-
* could not be delivered — a session event
|
|
266
|
-
* reply's type for a reply (`command_result`, `protocol_error`, …).
|
|
358
|
+
* could not be delivered — for the fan-out, the frame a session event was forwarded as (usually, not
|
|
359
|
+
* always, the event's own name), and the reply's type for a reply (`command_result`, `protocol_error`, …).
|
|
267
360
|
*
|
|
268
361
|
* Required, never optional: a carrier that could opt out of observing its own delivery failures is the
|
|
269
362
|
* silent-failure shape this boundary exists to remove.
|
|
270
363
|
*/
|
|
271
364
|
type TDeliveryErrorHandler = (error: Error, event: TServerMessage['type']) => void;
|
|
272
365
|
declare const DEFAULT_MAX_PENDING_BYTES: number;
|
|
366
|
+
/**
|
|
367
|
+
* Backpressure budget for a terminal attached to a session on the same host, in either role.
|
|
368
|
+
*
|
|
369
|
+
* 1 MiB, tighter than the default: an attached terminal reads a local socket, so a backlog this large
|
|
370
|
+
* means it stopped reading rather than that a network is slow. Exceeding it closes that connection
|
|
371
|
+
* only; the session never waits for a reader, so other surfaces keep streaming.
|
|
372
|
+
*/
|
|
373
|
+
declare const ATTACHED_SURFACE_MAX_PENDING_BYTES: number;
|
|
273
374
|
/**
|
|
274
375
|
* Is this carrier holding more than the budget allows?
|
|
275
376
|
*
|
|
@@ -315,7 +416,7 @@ declare function createOutboundDelivery(send: (message: TServerMessage) => void,
|
|
|
315
416
|
//#endregion
|
|
316
417
|
//#region src/protocol-session.d.ts
|
|
317
418
|
/** Session roles required by the shared WebSocket/WebRTC protocol. */
|
|
318
|
-
interface IProtocolSession extends ISessionTurnSubmission, ISessionTurnControl, ISessionCommands, ISessionEvents, ISessionPromptResolution, ISessionConversationRead, ISessionExecutionState, ISessionDriverAttribution, ISessionBackgroundTasks, ISessionBackgroundGroups, ISessionExecutionWorkspace {}
|
|
419
|
+
interface IProtocolSession extends ISessionTurnSubmission, ISessionTurnControl, ISessionCommands, ISessionStatusRead, ISessionEvents, ISessionPromptResolution, ISessionConversationRead, ISessionExecutionState, ISessionDriverAttribution, ISessionBackgroundTasks, ISessionBackgroundGroups, ISessionExecutionWorkspace, ISessionExecutionDetail, ISessionSelfPacedLoopControl {}
|
|
319
420
|
//#endregion
|
|
320
421
|
//#region src/usage-messages.d.ts
|
|
321
422
|
interface IUsageQueryReporters {
|
|
@@ -334,17 +435,17 @@ declare const PROTOCOL_SESSION_EVENT_CLASSIFICATION: {
|
|
|
334
435
|
readonly thinking: "forwarded";
|
|
335
436
|
readonly complete: "forwarded";
|
|
336
437
|
readonly error: "forwarded";
|
|
337
|
-
readonly context_update: "
|
|
338
|
-
readonly compact: "
|
|
438
|
+
readonly context_update: "forwarded";
|
|
439
|
+
readonly compact: "forwarded";
|
|
339
440
|
readonly interrupted: "forwarded";
|
|
340
|
-
readonly skill_activation: "
|
|
441
|
+
readonly skill_activation: "forwarded";
|
|
341
442
|
readonly background_task_event: "forwarded";
|
|
342
443
|
readonly background_job_group_event: "forwarded";
|
|
343
444
|
readonly execution_workspace_event: "forwarded";
|
|
344
445
|
readonly user_message: "forwarded";
|
|
345
|
-
readonly turn_source: "
|
|
446
|
+
readonly turn_source: "forwarded";
|
|
346
447
|
readonly context_file_refreshed: "forwarded";
|
|
347
|
-
readonly memory_event: "
|
|
448
|
+
readonly memory_event: "forwarded";
|
|
348
449
|
readonly goal_event: "non-surface";
|
|
349
450
|
readonly plan_event: "forwarded";
|
|
350
451
|
readonly branch_event: "forwarded";
|
|
@@ -354,9 +455,17 @@ declare const PROTOCOL_SESSION_EVENT_CLASSIFICATION: {
|
|
|
354
455
|
readonly ui_intent: "requester-routed";
|
|
355
456
|
readonly session_renamed: "forwarded";
|
|
356
457
|
readonly history_cleared: "forwarded";
|
|
458
|
+
readonly session_switched: "forwarded";
|
|
459
|
+
readonly status_changed: "forwarded";
|
|
357
460
|
};
|
|
358
461
|
//#endregion
|
|
359
462
|
//#region src/session-message-handler.d.ts
|
|
463
|
+
/**
|
|
464
|
+
* What a connected surface may do. `drive` sends prompts, answers questions and controls the session.
|
|
465
|
+
* `observe` is read-only: it follows this session's conversation and state, but never submits, answers,
|
|
466
|
+
* controls, or reads another session's records, and it never counts as a surface that can answer.
|
|
467
|
+
*/
|
|
468
|
+
type TSessionSurfaceRole = 'drive' | 'observe';
|
|
360
469
|
interface ISessionMessageHandlerOptions {
|
|
361
470
|
/** IProtocolSession to expose. */
|
|
362
471
|
session: IProtocolSession;
|
|
@@ -376,12 +485,16 @@ interface ISessionMessageHandlerOptions {
|
|
|
376
485
|
driverId?: TDriverId;
|
|
377
486
|
/** Trusted carrier-owned product surface, kept separate from driver identity. */
|
|
378
487
|
surface?: TUsageSurface;
|
|
488
|
+
/** Carrier-decided role of this connection; defaults to `drive`. The client never chooses it here. */
|
|
489
|
+
role?: TSessionSurfaceRole;
|
|
379
490
|
/** Host-owned cross-session read model. The protocol only correlates and carries its result. */
|
|
380
491
|
personalUsageReporter?: NonNullable<IUsageQueryReporters['personalUsageReporter']>;
|
|
381
492
|
/** Host-owned current-session trace/cost producer for the pre-existing message family. */
|
|
382
493
|
usageReporter?: NonNullable<IUsageQueryReporters['usageReporter']>;
|
|
383
494
|
/** Host-owned stored-session producer used by cross-session drill-down. */
|
|
384
495
|
storedSessionUsageReporter?: NonNullable<IUsageQueryReporters['storedSessionUsageReporter']>;
|
|
496
|
+
/** Host-owned session directory (#3189): list, start and switch the host's sessions. */
|
|
497
|
+
sessionDirectory?: ISessionDirectory;
|
|
385
498
|
}
|
|
386
499
|
/**
|
|
387
500
|
* Create a carrier-neutral message handler for an IProtocolSession.
|
|
@@ -407,6 +520,10 @@ declare function createSessionMessageHandler(options: ISessionMessageHandlerOpti
|
|
|
407
520
|
cleanup: () => void;
|
|
408
521
|
};
|
|
409
522
|
//#endregion
|
|
523
|
+
//#region src/observer-messages.d.ts
|
|
524
|
+
/** Whether an observer may send a message of this type. */
|
|
525
|
+
declare function isObserverMessageType(type: string): boolean;
|
|
526
|
+
//#endregion
|
|
410
527
|
//#region src/message-decoders.d.ts
|
|
411
528
|
type TMessageDecodeResult<TMessage> = {
|
|
412
529
|
readonly ok: true;
|
|
@@ -762,5 +879,5 @@ declare class HandoffChunkAssembler {
|
|
|
762
879
|
*/
|
|
763
880
|
declare function chunkCountFor(integrity: IHandoffIntegrity, maxChunkBytes?: number): number;
|
|
764
881
|
//#endregion
|
|
765
|
-
export { CHANNEL_FRAME_MAGIC, CHANNEL_FRAME_VERSION, DEFAULT_MAX_CHUNK_BYTES, DEFAULT_MAX_PENDING_BYTES, DEFAULT_MAX_PENDING_MS, HandoffChunkAssembler, type IAttachOptions, type IBufferedFrame, type IChunkResult, type IHandoffChunk, type IPeerMessageLedger, type IPeerMessageRejection, type IPeerMessageVerdict, type IPendingStallClock, type IProtocolSession, type IResumeBufferOptions, type ISessionMessageHandlerOptions, type ISessionResumeBridgeOptions, MAX_INBOUND_FRAME_BYTES, PROTOCOL_SESSION_EVENT_CLASSIFICATION, ResumeBuffer, SessionResumeBridge, type TChunkOutcome, type TChunkRejection, type TClientMessage, type TDeliveryErrorHandler, type TMessageDecodeResult, type TOutboundDeliver, type TProtocolSessionEventClassification, type TResumeSink, type TResumeTail, type TSeqServerMessage, type TServerMessage, acknowledgePeerMessage, admitPeerMessage, chunkCountFor, chunkHandoffPayload, createOutboundDelivery, createPeerMessageLedger, createPendingStallClock, createSessionMessageHandler, decodeChannelFrame, decodeClientMessage, decodeFrame, decodeServerMessage, encodeBinaryFrame, encodeChannelEventFrame, forgetPeerOrigin, isChannelFrame, isOverPendingBudget };
|
|
882
|
+
export { ATTACHED_SURFACE_MAX_PENDING_BYTES, CHANNEL_FRAME_MAGIC, CHANNEL_FRAME_VERSION, DEFAULT_MAX_CHUNK_BYTES, DEFAULT_MAX_PENDING_BYTES, DEFAULT_MAX_PENDING_MS, HandoffChunkAssembler, type IAttachOptions, type IBufferedFrame, type IChunkResult, type IHandoffChunk, type IPeerMessageLedger, type IPeerMessageRejection, type IPeerMessageVerdict, type IPendingStallClock, type IProtocolSession, type IResumeBufferOptions, type ISessionMessageHandlerOptions, type ISessionResumeBridgeOptions, type IWireHistoryEntry, MAX_INBOUND_FRAME_BYTES, PROTOCOL_SESSION_EVENT_CLASSIFICATION, ResumeBuffer, SessionResumeBridge, type TChunkOutcome, type TChunkRejection, type TClientMessage, type TDeliveryErrorHandler, type TMessageDecodeResult, type TOutboundDeliver, type TProtocolSessionEventClassification, type TResumeSink, type TResumeTail, type TSeqServerMessage, type TServerMessage, type TSessionSurfaceRole, type TWireExecutionResult, acknowledgePeerMessage, admitPeerMessage, chunkCountFor, chunkHandoffPayload, createOutboundDelivery, createPeerMessageLedger, createPendingStallClock, createSessionMessageHandler, decodeChannelFrame, decodeClientMessage, decodeFrame, decodeServerMessage, encodeBinaryFrame, encodeChannelEventFrame, forgetPeerOrigin, isChannelFrame, isObserverMessageType, isOverPendingBudget };
|
|
766
883
|
//# sourceMappingURL=index.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../../src/wire-messages.ts","../../src/outbound-delivery.ts","../../src/protocol-session.ts","../../src/usage-messages.ts","../../src/session-events.ts","../../src/session-message-handler.ts","../../src/message-decoders.ts","../../src/resume-buffer.ts","../../src/channel-frames.ts","../../src/session-resume-bridge.ts","../../src/peer-message-ledger.ts","../../src/handoff-chunking.ts"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../../src/wire-messages.ts","../../src/outbound-delivery.ts","../../src/protocol-session.ts","../../src/usage-messages.ts","../../src/session-events.ts","../../src/session-message-handler.ts","../../src/observer-messages.ts","../../src/message-decoders.ts","../../src/resume-buffer.ts","../../src/channel-frames.ts","../../src/session-resume-bridge.ts","../../src/peer-message-ledger.ts","../../src/handoff-chunking.ts"],"mappings":";;;;;;;KAkDY;KAEP,gBAAgB,WAAW;;;;;;UAOf,0BAA0B,KAAK;;EAE9C;;;;;;KAOU,uBAAuB,KAAK;;KAG5B;EACN;EAAgB;;EAGhB;EAAiB;EAAc;EAAe;;EAC9C;;EACA;;EACA;;EA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;;EAEA,WAAW;;EAEX,QAAQ,YAAY;;;UAIL;WACN,SAAS,YAAY;;iBAGhB,2BAA2B;;UAK1B;WACN,OAAO,QAAQ;WACf;;UAGM;WACN,KAAK;;;;;;;;WAQL;;;;;;;WAOA;;;;;;;;;iBAUK,iBACd,QAAQ,oBACR,SAAS,cACT,YAAY,wBACX;;;;;;;;iBAyEa,uBACd,QAAQ,oBACR,yBACA,aACC;;iBAWa,iBAAiB,QAAQ,oBAAoB;;;;;;;;;;UCvJ5C;WACN;;WAEA;;WAEA;;WAEA;;;;;;;;;cAUE;;;;;;;;iBASG,oBACd,mBACA,oBACA,kCACU;;KAqBA;;;;;;;;;KAUA;;;;;;;UASK;WACN,SAAS;WACT,YAAY;;WAEZ;;WAEA;;WAEA;;;;;;;;;;cAWE;mBAIkB;mBAHZ;UACT;EAEqB,YAAA;MAEzB;MAIA;;EAKJ,OAAO,OAAO,gBAAgB;;EAmD9B;;EAQA;UAKQ;;;;;;;;iBAsBM,cACd,WAAW,mBACX"}
|
package/dist/node/index.d.ts
CHANGED
|
@@ -1,11 +1,26 @@
|
|
|
1
|
+
import { IAskRequestEvent, IBranchEvent, IContextFileRefreshedEvent, IExecutionResult, IPermissionRequestEvent, IPlanApprovalEvent, IPromptResolvedEvent, ISessionBackgroundGroups, ISessionBackgroundTasks, ISessionCommands, ISessionConversationRead, ISessionDirectory, ISessionDriverAttribution, ISessionEvents, ISessionExecutionDetail, ISessionExecutionState, ISessionExecutionWorkspace, ISessionListing, ISessionPromptResolution, ISessionRenamedEvent, ISessionSelfPacedLoopControl, ISessionStatusRead, ISessionStatusSnapshot, ISessionSwitchedEvent, ISessionTurnControl, ISessionTurnSubmission, IToolState, IUiIntentEvent, TDriverId, TPermissionResultValue, TSessionChangeRefusalCode, TTurnSource, TWaitingLoopStopOutcome } from "@robota-sdk/agent-interface-session";
|
|
1
2
|
import { IPersonalUsageReport, IPersonalUsageRequest, IUsageBySourceReport, TUsageSurface } from "@robota-sdk/agent-interface-analytics";
|
|
2
|
-
import { ICommandResult } from "@robota-sdk/agent-interface-command";
|
|
3
|
-
import { IBackgroundJobGroupState, IBackgroundTaskInput, IBackgroundTaskListFilter, IBackgroundTaskLogCursor, IBackgroundTaskLogPage, IBackgroundTaskState, IExecutionWorkspaceSnapshot, TBackgroundJobGroupEvent, TBackgroundTaskEvent } from "@robota-sdk/agent-interface-execution";
|
|
4
|
-
import { IAskRequestEvent, IBranchEvent, IContextFileRefreshedEvent, IExecutionResult, IPermissionRequestEvent, IPlanApprovalEvent, IPromptResolvedEvent, ISessionBackgroundGroups, ISessionBackgroundTasks, ISessionCommands, ISessionConversationRead, ISessionDriverAttribution, ISessionEvents, ISessionExecutionState, ISessionExecutionWorkspace, ISessionPromptResolution, ISessionRenamedEvent, ISessionTurnControl, ISessionTurnSubmission, IToolState, IUiIntentEvent, TDriverId, TPermissionResultValue } from "@robota-sdk/agent-interface-session";
|
|
3
|
+
import { ICommandListEntry, ICommandResult, ICommandSkillListEntry } from "@robota-sdk/agent-interface-command";
|
|
4
|
+
import { IBackgroundJobGroupState, IBackgroundTaskInput, IBackgroundTaskListFilter, IBackgroundTaskLogCursor, IBackgroundTaskLogPage, IBackgroundTaskState, IExecutionDetailCursor, IExecutionDetailPage, IExecutionWorkspaceSnapshot, TBackgroundJobGroupEvent, TBackgroundTaskEvent } from "@robota-sdk/agent-interface-execution";
|
|
5
5
|
import { IBinaryFrame, IChannelEventFrame, TActionResponse, TChannelReceiveResult } from "@robota-sdk/agent-interface-transport";
|
|
6
6
|
import { IHandoffIntegrity, IPeerMessage, IPeerMessageAck, TPeerDeliveryState } from "@robota-sdk/agent-interface-session-mobility";
|
|
7
7
|
//#region src/wire-messages.d.ts
|
|
8
8
|
type TBackgroundControlAction = 'cancel' | 'close' | 'send';
|
|
9
|
+
type THistoryEntry = ReturnType<ISessionConversationRead['getFullHistory']>[number];
|
|
10
|
+
/**
|
|
11
|
+
* #3189: one entry of the session's full history as it crosses the wire. The same record the session
|
|
12
|
+
* keeps, except that `timestamp` is an ISO 8601 string: a `Date` does not survive JSON, and a
|
|
13
|
+
* declared `Date` that arrives as a string would let a client call `Date` methods on a string.
|
|
14
|
+
*/
|
|
15
|
+
interface IWireHistoryEntry extends Omit<THistoryEntry, 'timestamp'> {
|
|
16
|
+
/** ISO 8601. */
|
|
17
|
+
timestamp: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* #3189: a turn's result as it crosses the wire. The session's whole history stays behind: it only
|
|
21
|
+
* grows, so a client reads it in bounded pages with `get-history` instead.
|
|
22
|
+
*/
|
|
23
|
+
type TWireExecutionResult = Omit<IExecutionResult, 'history'>;
|
|
9
24
|
/** Inbound message from client to server. */
|
|
10
25
|
type TClientMessage = {
|
|
11
26
|
type: 'submit';
|
|
@@ -14,14 +29,34 @@ type TClientMessage = {
|
|
|
14
29
|
type: 'command';
|
|
15
30
|
name: string;
|
|
16
31
|
args?: string;
|
|
32
|
+
requestId?: string;
|
|
17
33
|
} | {
|
|
18
34
|
type: 'abort';
|
|
19
35
|
} | {
|
|
20
36
|
type: 'cancel-queue';
|
|
21
37
|
} | {
|
|
22
38
|
type: 'get-messages';
|
|
39
|
+
} | {
|
|
40
|
+
type: 'get-history';
|
|
41
|
+
fromIndex?: number;
|
|
42
|
+
} | {
|
|
43
|
+
type: 'get-prompts';
|
|
23
44
|
} | {
|
|
24
45
|
type: 'get-context';
|
|
46
|
+
} | {
|
|
47
|
+
type: 'get-commands';
|
|
48
|
+
} | {
|
|
49
|
+
type: 'get-status';
|
|
50
|
+
} | {
|
|
51
|
+
type: 'list-sessions';
|
|
52
|
+
requestId: string;
|
|
53
|
+
} | {
|
|
54
|
+
type: 'new-session';
|
|
55
|
+
requestId?: string;
|
|
56
|
+
} | {
|
|
57
|
+
type: 'switch-session';
|
|
58
|
+
sessionId: string;
|
|
59
|
+
requestId?: string;
|
|
25
60
|
} | {
|
|
26
61
|
type: 'get-usage-report';
|
|
27
62
|
} | {
|
|
@@ -39,6 +74,14 @@ type TClientMessage = {
|
|
|
39
74
|
type: 'get-pending';
|
|
40
75
|
} | {
|
|
41
76
|
type: 'get-execution-workspace';
|
|
77
|
+
} | {
|
|
78
|
+
type: 'read-execution-detail';
|
|
79
|
+
requestId: string;
|
|
80
|
+
entryId: string;
|
|
81
|
+
cursor?: IExecutionDetailCursor;
|
|
82
|
+
} | {
|
|
83
|
+
type: 'stop-waiting-loop';
|
|
84
|
+
requestId: string;
|
|
42
85
|
} | {
|
|
43
86
|
type: 'get-background-tasks';
|
|
44
87
|
filter?: IBackgroundTaskListFilter;
|
|
@@ -106,11 +149,11 @@ type TServerMessage = {
|
|
|
106
149
|
driverId?: TDriverId;
|
|
107
150
|
} | {
|
|
108
151
|
type: 'complete';
|
|
109
|
-
result:
|
|
152
|
+
result: TWireExecutionResult;
|
|
110
153
|
driverId?: TDriverId;
|
|
111
154
|
} | {
|
|
112
155
|
type: 'interrupted';
|
|
113
|
-
result:
|
|
156
|
+
result: TWireExecutionResult;
|
|
114
157
|
driverId?: TDriverId;
|
|
115
158
|
} | {
|
|
116
159
|
type: 'error';
|
|
@@ -122,12 +165,48 @@ type TServerMessage = {
|
|
|
122
165
|
message: string;
|
|
123
166
|
success: boolean;
|
|
124
167
|
data?: ICommandResult['data'];
|
|
168
|
+
/** The `requestId` of the `command` this answers, when it carried one. */
|
|
169
|
+
requestId?: string;
|
|
125
170
|
} | {
|
|
126
171
|
type: 'messages';
|
|
127
172
|
messages: ReturnType<ISessionConversationRead['getMessages']>;
|
|
173
|
+
} | {
|
|
174
|
+
type: 'history';
|
|
175
|
+
startIndex: number;
|
|
176
|
+
total: number;
|
|
177
|
+
entries: IWireHistoryEntry[];
|
|
128
178
|
} | {
|
|
129
179
|
type: 'context';
|
|
130
180
|
state: ReturnType<ISessionConversationRead['getContextState']>;
|
|
181
|
+
} | {
|
|
182
|
+
type: 'history_changed';
|
|
183
|
+
} | {
|
|
184
|
+
type: 'turn_source';
|
|
185
|
+
source: TTurnSource;
|
|
186
|
+
} | {
|
|
187
|
+
type: 'commands';
|
|
188
|
+
commands: ICommandListEntry[];
|
|
189
|
+
skills: ICommandSkillListEntry[];
|
|
190
|
+
} | {
|
|
191
|
+
type: 'session_status';
|
|
192
|
+
status: ISessionStatusSnapshot;
|
|
193
|
+
} | {
|
|
194
|
+
type: 'sessions';
|
|
195
|
+
requestId: string;
|
|
196
|
+
listing: ISessionListing;
|
|
197
|
+
} | {
|
|
198
|
+
type: 'sessions_error';
|
|
199
|
+
requestId: string;
|
|
200
|
+
code: 'not_available' | 'list_failed';
|
|
201
|
+
message: string;
|
|
202
|
+
} | {
|
|
203
|
+
type: 'session_switched';
|
|
204
|
+
event: ISessionSwitchedEvent;
|
|
205
|
+
} | {
|
|
206
|
+
type: 'session_change_failed';
|
|
207
|
+
code: TSessionChangeRefusalCode;
|
|
208
|
+
message: string;
|
|
209
|
+
requestId?: string;
|
|
131
210
|
} | {
|
|
132
211
|
type: 'usage_report';
|
|
133
212
|
report: IUsageBySourceReport;
|
|
@@ -157,9 +236,22 @@ type TServerMessage = {
|
|
|
157
236
|
} | {
|
|
158
237
|
type: 'pending';
|
|
159
238
|
pending: string | null;
|
|
239
|
+
pendingCount?: number;
|
|
160
240
|
} | {
|
|
161
241
|
type: 'execution_workspace_event';
|
|
162
242
|
snapshot: IExecutionWorkspaceSnapshot;
|
|
243
|
+
} | {
|
|
244
|
+
type: 'execution_detail';
|
|
245
|
+
requestId: string;
|
|
246
|
+
page: IExecutionDetailPage;
|
|
247
|
+
} | {
|
|
248
|
+
type: 'execution_detail_error';
|
|
249
|
+
requestId: string;
|
|
250
|
+
message: string;
|
|
251
|
+
} | {
|
|
252
|
+
type: 'waiting_loop_stop';
|
|
253
|
+
requestId: string;
|
|
254
|
+
outcome: TWaitingLoopStopOutcome;
|
|
163
255
|
} | {
|
|
164
256
|
type: 'background_task_event';
|
|
165
257
|
event: TBackgroundTaskEvent;
|
|
@@ -219,6 +311,7 @@ type TServerMessage = {
|
|
|
219
311
|
} | {
|
|
220
312
|
type: 'protocol_error';
|
|
221
313
|
message: string;
|
|
314
|
+
requestId?: string;
|
|
222
315
|
} | {
|
|
223
316
|
type: 'resume_gap';
|
|
224
317
|
};
|
|
@@ -262,14 +355,22 @@ type TOutboundDeliver = ((message: TServerMessage) => void) & {
|
|
|
262
355
|
};
|
|
263
356
|
/**
|
|
264
357
|
* Observe THIS connection's first outbound delivery failure. `event` is the `type` of the frame that
|
|
265
|
-
* could not be delivered — a session event
|
|
266
|
-
* reply's type for a reply (`command_result`, `protocol_error`, …).
|
|
358
|
+
* could not be delivered — for the fan-out, the frame a session event was forwarded as (usually, not
|
|
359
|
+
* always, the event's own name), and the reply's type for a reply (`command_result`, `protocol_error`, …).
|
|
267
360
|
*
|
|
268
361
|
* Required, never optional: a carrier that could opt out of observing its own delivery failures is the
|
|
269
362
|
* silent-failure shape this boundary exists to remove.
|
|
270
363
|
*/
|
|
271
364
|
type TDeliveryErrorHandler = (error: Error, event: TServerMessage['type']) => void;
|
|
272
365
|
declare const DEFAULT_MAX_PENDING_BYTES: number;
|
|
366
|
+
/**
|
|
367
|
+
* Backpressure budget for a terminal attached to a session on the same host, in either role.
|
|
368
|
+
*
|
|
369
|
+
* 1 MiB, tighter than the default: an attached terminal reads a local socket, so a backlog this large
|
|
370
|
+
* means it stopped reading rather than that a network is slow. Exceeding it closes that connection
|
|
371
|
+
* only; the session never waits for a reader, so other surfaces keep streaming.
|
|
372
|
+
*/
|
|
373
|
+
declare const ATTACHED_SURFACE_MAX_PENDING_BYTES: number;
|
|
273
374
|
/**
|
|
274
375
|
* Is this carrier holding more than the budget allows?
|
|
275
376
|
*
|
|
@@ -315,7 +416,7 @@ declare function createOutboundDelivery(send: (message: TServerMessage) => void,
|
|
|
315
416
|
//#endregion
|
|
316
417
|
//#region src/protocol-session.d.ts
|
|
317
418
|
/** Session roles required by the shared WebSocket/WebRTC protocol. */
|
|
318
|
-
interface IProtocolSession extends ISessionTurnSubmission, ISessionTurnControl, ISessionCommands, ISessionEvents, ISessionPromptResolution, ISessionConversationRead, ISessionExecutionState, ISessionDriverAttribution, ISessionBackgroundTasks, ISessionBackgroundGroups, ISessionExecutionWorkspace {}
|
|
419
|
+
interface IProtocolSession extends ISessionTurnSubmission, ISessionTurnControl, ISessionCommands, ISessionStatusRead, ISessionEvents, ISessionPromptResolution, ISessionConversationRead, ISessionExecutionState, ISessionDriverAttribution, ISessionBackgroundTasks, ISessionBackgroundGroups, ISessionExecutionWorkspace, ISessionExecutionDetail, ISessionSelfPacedLoopControl {}
|
|
319
420
|
//#endregion
|
|
320
421
|
//#region src/usage-messages.d.ts
|
|
321
422
|
interface IUsageQueryReporters {
|
|
@@ -334,17 +435,17 @@ declare const PROTOCOL_SESSION_EVENT_CLASSIFICATION: {
|
|
|
334
435
|
readonly thinking: "forwarded";
|
|
335
436
|
readonly complete: "forwarded";
|
|
336
437
|
readonly error: "forwarded";
|
|
337
|
-
readonly context_update: "
|
|
338
|
-
readonly compact: "
|
|
438
|
+
readonly context_update: "forwarded";
|
|
439
|
+
readonly compact: "forwarded";
|
|
339
440
|
readonly interrupted: "forwarded";
|
|
340
|
-
readonly skill_activation: "
|
|
441
|
+
readonly skill_activation: "forwarded";
|
|
341
442
|
readonly background_task_event: "forwarded";
|
|
342
443
|
readonly background_job_group_event: "forwarded";
|
|
343
444
|
readonly execution_workspace_event: "forwarded";
|
|
344
445
|
readonly user_message: "forwarded";
|
|
345
|
-
readonly turn_source: "
|
|
446
|
+
readonly turn_source: "forwarded";
|
|
346
447
|
readonly context_file_refreshed: "forwarded";
|
|
347
|
-
readonly memory_event: "
|
|
448
|
+
readonly memory_event: "forwarded";
|
|
348
449
|
readonly goal_event: "non-surface";
|
|
349
450
|
readonly plan_event: "forwarded";
|
|
350
451
|
readonly branch_event: "forwarded";
|
|
@@ -354,9 +455,17 @@ declare const PROTOCOL_SESSION_EVENT_CLASSIFICATION: {
|
|
|
354
455
|
readonly ui_intent: "requester-routed";
|
|
355
456
|
readonly session_renamed: "forwarded";
|
|
356
457
|
readonly history_cleared: "forwarded";
|
|
458
|
+
readonly session_switched: "forwarded";
|
|
459
|
+
readonly status_changed: "forwarded";
|
|
357
460
|
};
|
|
358
461
|
//#endregion
|
|
359
462
|
//#region src/session-message-handler.d.ts
|
|
463
|
+
/**
|
|
464
|
+
* What a connected surface may do. `drive` sends prompts, answers questions and controls the session.
|
|
465
|
+
* `observe` is read-only: it follows this session's conversation and state, but never submits, answers,
|
|
466
|
+
* controls, or reads another session's records, and it never counts as a surface that can answer.
|
|
467
|
+
*/
|
|
468
|
+
type TSessionSurfaceRole = 'drive' | 'observe';
|
|
360
469
|
interface ISessionMessageHandlerOptions {
|
|
361
470
|
/** IProtocolSession to expose. */
|
|
362
471
|
session: IProtocolSession;
|
|
@@ -376,12 +485,16 @@ interface ISessionMessageHandlerOptions {
|
|
|
376
485
|
driverId?: TDriverId;
|
|
377
486
|
/** Trusted carrier-owned product surface, kept separate from driver identity. */
|
|
378
487
|
surface?: TUsageSurface;
|
|
488
|
+
/** Carrier-decided role of this connection; defaults to `drive`. The client never chooses it here. */
|
|
489
|
+
role?: TSessionSurfaceRole;
|
|
379
490
|
/** Host-owned cross-session read model. The protocol only correlates and carries its result. */
|
|
380
491
|
personalUsageReporter?: NonNullable<IUsageQueryReporters['personalUsageReporter']>;
|
|
381
492
|
/** Host-owned current-session trace/cost producer for the pre-existing message family. */
|
|
382
493
|
usageReporter?: NonNullable<IUsageQueryReporters['usageReporter']>;
|
|
383
494
|
/** Host-owned stored-session producer used by cross-session drill-down. */
|
|
384
495
|
storedSessionUsageReporter?: NonNullable<IUsageQueryReporters['storedSessionUsageReporter']>;
|
|
496
|
+
/** Host-owned session directory (#3189): list, start and switch the host's sessions. */
|
|
497
|
+
sessionDirectory?: ISessionDirectory;
|
|
385
498
|
}
|
|
386
499
|
/**
|
|
387
500
|
* Create a carrier-neutral message handler for an IProtocolSession.
|
|
@@ -407,6 +520,10 @@ declare function createSessionMessageHandler(options: ISessionMessageHandlerOpti
|
|
|
407
520
|
cleanup: () => void;
|
|
408
521
|
};
|
|
409
522
|
//#endregion
|
|
523
|
+
//#region src/observer-messages.d.ts
|
|
524
|
+
/** Whether an observer may send a message of this type. */
|
|
525
|
+
declare function isObserverMessageType(type: string): boolean;
|
|
526
|
+
//#endregion
|
|
410
527
|
//#region src/message-decoders.d.ts
|
|
411
528
|
type TMessageDecodeResult<TMessage> = {
|
|
412
529
|
readonly ok: true;
|
|
@@ -762,5 +879,5 @@ declare class HandoffChunkAssembler {
|
|
|
762
879
|
*/
|
|
763
880
|
declare function chunkCountFor(integrity: IHandoffIntegrity, maxChunkBytes?: number): number;
|
|
764
881
|
//#endregion
|
|
765
|
-
export { CHANNEL_FRAME_MAGIC, CHANNEL_FRAME_VERSION, DEFAULT_MAX_CHUNK_BYTES, DEFAULT_MAX_PENDING_BYTES, DEFAULT_MAX_PENDING_MS, HandoffChunkAssembler, type IAttachOptions, type IBufferedFrame, type IChunkResult, type IHandoffChunk, type IPeerMessageLedger, type IPeerMessageRejection, type IPeerMessageVerdict, type IPendingStallClock, type IProtocolSession, type IResumeBufferOptions, type ISessionMessageHandlerOptions, type ISessionResumeBridgeOptions, MAX_INBOUND_FRAME_BYTES, PROTOCOL_SESSION_EVENT_CLASSIFICATION, ResumeBuffer, SessionResumeBridge, type TChunkOutcome, type TChunkRejection, type TClientMessage, type TDeliveryErrorHandler, type TMessageDecodeResult, type TOutboundDeliver, type TProtocolSessionEventClassification, type TResumeSink, type TResumeTail, type TSeqServerMessage, type TServerMessage, acknowledgePeerMessage, admitPeerMessage, chunkCountFor, chunkHandoffPayload, createOutboundDelivery, createPeerMessageLedger, createPendingStallClock, createSessionMessageHandler, decodeChannelFrame, decodeClientMessage, decodeFrame, decodeServerMessage, encodeBinaryFrame, encodeChannelEventFrame, forgetPeerOrigin, isChannelFrame, isOverPendingBudget };
|
|
882
|
+
export { ATTACHED_SURFACE_MAX_PENDING_BYTES, CHANNEL_FRAME_MAGIC, CHANNEL_FRAME_VERSION, DEFAULT_MAX_CHUNK_BYTES, DEFAULT_MAX_PENDING_BYTES, DEFAULT_MAX_PENDING_MS, HandoffChunkAssembler, type IAttachOptions, type IBufferedFrame, type IChunkResult, type IHandoffChunk, type IPeerMessageLedger, type IPeerMessageRejection, type IPeerMessageVerdict, type IPendingStallClock, type IProtocolSession, type IResumeBufferOptions, type ISessionMessageHandlerOptions, type ISessionResumeBridgeOptions, type IWireHistoryEntry, MAX_INBOUND_FRAME_BYTES, PROTOCOL_SESSION_EVENT_CLASSIFICATION, ResumeBuffer, SessionResumeBridge, type TChunkOutcome, type TChunkRejection, type TClientMessage, type TDeliveryErrorHandler, type TMessageDecodeResult, type TOutboundDeliver, type TProtocolSessionEventClassification, type TResumeSink, type TResumeTail, type TSeqServerMessage, type TServerMessage, type TSessionSurfaceRole, type TWireExecutionResult, acknowledgePeerMessage, admitPeerMessage, chunkCountFor, chunkHandoffPayload, createOutboundDelivery, createPeerMessageLedger, createPendingStallClock, createSessionMessageHandler, decodeChannelFrame, decodeClientMessage, decodeFrame, decodeServerMessage, encodeBinaryFrame, encodeChannelEventFrame, forgetPeerOrigin, isChannelFrame, isObserverMessageType, isOverPendingBudget };
|
|
766
883
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/node/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/wire-messages.ts","../../src/outbound-delivery.ts","../../src/protocol-session.ts","../../src/usage-messages.ts","../../src/session-events.ts","../../src/session-message-handler.ts","../../src/message-decoders.ts","../../src/resume-buffer.ts","../../src/channel-frames.ts","../../src/session-resume-bridge.ts","../../src/peer-message-ledger.ts","../../src/handoff-chunking.ts"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/wire-messages.ts","../../src/outbound-delivery.ts","../../src/protocol-session.ts","../../src/usage-messages.ts","../../src/session-events.ts","../../src/session-message-handler.ts","../../src/observer-messages.ts","../../src/message-decoders.ts","../../src/resume-buffer.ts","../../src/channel-frames.ts","../../src/session-resume-bridge.ts","../../src/peer-message-ledger.ts","../../src/handoff-chunking.ts"],"mappings":";;;;;;;KAkDY;KAEP,gBAAgB,WAAW;;;;;;UAOf,0BAA0B,KAAK;;EAE9C;;;;;;KAOU,uBAAuB,KAAK;;KAG5B;EACN;EAAgB;;EAGhB;EAAiB;EAAc;EAAe;;EAC9C;;EACA;;EACA;;EAIA;EAAqB;;EAGrB;;EACA;;EAGA;;EACA;;EAGA;EAAuB;;EACvB;EAAqB;;EACrB;EAAwB;EAAmB;;EAE3C;;EAEA;EACA;EACA,QAAQ;EACR;;EAEA;EAAyC;EAAmB;;EAC5D;;EACA;;EACA;;EAIA;EACA;EACA;EACA,SAAS;;EAGT;EAA2B;;EAC3B;EAA8B,SAAS;;EACvC;EAA6B;;EAC7B;;EACA;EAAkC;;EAClC;EAAmC;;EACnC;EAAgC;EAAgB;;EAChD;EAA+B;;EAC/B;EAA8B;EAAgB,OAAO;;EACrD;EAAkC;EAAgB,SAAS;;EAE3D;EAA6B;EAAY,QAAQ;;EACjD;EAAsB;EAAY,UAAU;;EAG5C;EAAgB;;EAChB;EAAa;;;KAGP;EAIN;EAAoB;EAAe,WAAW;;EAC9C;EAAsB;EAAiB,WAAW;;EAClD;EAAoB,OAAO;EAAY,WAAW;;EAClD;EAAkB,OAAO;EAAY,WAAW;;EAChD;EAAkB;EAAqB,WAAW;;EAClD;EAAkB,QAAQ;EAAsB,WAAW;;EAC3D;EAAqB,QAAQ;EAAsB,WAAW;;EAC9D;EAAe;EAAiB,WAAW;;EAE3C;EACA;EACA;EACA;EACA,OAAO;;EAEP;;EAEA;EAAkB,UAAU,WAAW;;EAGvC;EAAiB;EAAoB;EAAe,SAAS;;EAE7D;EAAiB,OAAO,WAAW;;EAGnC;;EAEA;EAAqB,QAAQ;;EAC7B;EAAkB,UAAU;EAAqB,QAAQ;;EAEzD;EAAwB,QAAQ;;EAChC;EAAkB;EAA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