@robota-sdk/agent-transport 3.0.0-beta.83 → 3.0.0-beta.84
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 +43 -0
- package/README.md +80 -118
- package/dist/browser/client.d.ts +1 -1
- package/dist/browser/client.js +1 -1
- package/dist/browser/index.d.ts +60 -6
- 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-CEeisRaF.js +2 -0
- package/dist/browser/observer-messages-CEeisRaF.js.map +1 -0
- package/dist/browser/{observer-messages-DC_8VHk9.d.ts → observer-messages-Dnff2Tdb.d.ts} +125 -3
- package/dist/browser/observer-messages-Dnff2Tdb.d.ts.map +1 -0
- package/dist/node/index.cjs +1 -1
- package/dist/node/index.d.cts +181 -6
- package/dist/node/index.d.cts.map +1 -1
- package/dist/node/index.d.ts +181 -6
- 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/package.json +12 -11
- package/src/__tests__/message-decoders.test.ts +295 -1
- package/src/__tests__/project-read-messages.test.ts +118 -0
- package/src/__tests__/session-directory-messages.test.ts +130 -0
- package/src/__tests__/session-error-classification.test.ts +113 -0
- package/src/__tests__/session-message-handler-observe.test.ts +25 -1
- package/src/__tests__/session-message-handler.test.ts +57 -3
- package/src/__tests__/settings-messages.test.ts +193 -0
- package/src/index.ts +4 -0
- package/src/message-decoders.ts +157 -3
- package/src/observer-messages.ts +11 -0
- package/src/project-read-messages.ts +74 -0
- package/src/protocol-session.ts +17 -1
- package/src/session-directory-messages.ts +78 -1
- package/src/session-error-classification.ts +91 -0
- package/src/session-events.ts +7 -1
- package/src/session-message-handler.ts +58 -8
- package/src/session-query-messages.ts +18 -1
- package/src/session-resume-bridge.ts +8 -0
- package/src/settings-messages.ts +103 -0
- package/src/wire-messages.ts +133 -4
- package/dist/browser/observer-messages-Bx-xReUQ.js +0 -2
- package/dist/browser/observer-messages-Bx-xReUQ.js.map +0 -1
- package/dist/browser/observer-messages-DC_8VHk9.d.ts.map +0 -1
package/dist/node/index.d.cts
CHANGED
|
@@ -1,12 +1,21 @@
|
|
|
1
1
|
import { IPersonalUsageReport, IPersonalUsageRequest, IUsageBySourceReport, TUsageSurface } from "@robota-sdk/agent-interface-analytics";
|
|
2
|
-
import { ICommandListEntry, ICommandResult, ICommandSkillListEntry } from "@robota-sdk/agent-interface-command";
|
|
2
|
+
import { ICommandListEntry, ICommandResult, ICommandSkillListEntry, TCommandSurfaceLocality } from "@robota-sdk/agent-interface-command";
|
|
3
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";
|
|
4
|
+
import { IAskRequestEvent, IBranchEvent, IContextFileRefreshedEvent, IExecutionResult, IModelListGroup, IPermissionRequestEvent, IPlanApprovalEvent, IPromptResolvedEvent, ISessionAgentJobs, ISessionBackgroundGroups, ISessionBackgroundTasks, ISessionCommands, ISessionConversationRead, ISessionDirectory, ISessionDriverAttribution, ISessionEvents, ISessionExecutionDetail, ISessionExecutionState, ISessionExecutionWorkspace, ISessionListing, ISessionProjectRead, ISessionPromptResolution, ISessionRenamedEvent, ISessionSelfPacedLoopControl, ISessionStatusRead, ISessionStatusSnapshot, ISessionSwitchedEvent, ISessionTurnControl, ISessionTurnSubmission, ISettingsSnapshot, IToolState, IUiIntentEvent, TDriverId, TPermissionResultValue, TProjectDiffRead, TProjectMemoryRead, TProjectStatusRead, TSessionChangeRefusalCode, TSessionDeleteRefusalCode, TSettingsPatch, 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
9
|
type THistoryEntry = ReturnType<ISessionConversationRead['getFullHistory']>[number];
|
|
10
|
+
/**
|
|
11
|
+
* #3282 §4: one agent the switcher can offer. `definedIn` is a plain-words location — a discovered
|
|
12
|
+
* file's path, or "Built-in" — never a raw internal id.
|
|
13
|
+
*/
|
|
14
|
+
interface IWireAgentDefinitionSummary {
|
|
15
|
+
name: string;
|
|
16
|
+
description: string;
|
|
17
|
+
definedIn: string;
|
|
18
|
+
}
|
|
10
19
|
/**
|
|
11
20
|
* #3189: one entry of the session's full history as it crosses the wire. The same record the session
|
|
12
21
|
* keeps, except that `timestamp` is an ISO 8601 string: a `Date` does not survive JSON, and a
|
|
@@ -47,6 +56,12 @@ type TClientMessage = {
|
|
|
47
56
|
type: 'get-commands';
|
|
48
57
|
} | {
|
|
49
58
|
type: 'get-status';
|
|
59
|
+
} | {
|
|
60
|
+
type: 'list-models';
|
|
61
|
+
requestId: string;
|
|
62
|
+
} | {
|
|
63
|
+
type: 'get-agent-definitions';
|
|
64
|
+
requestId: string;
|
|
50
65
|
} | {
|
|
51
66
|
type: 'list-sessions';
|
|
52
67
|
requestId: string;
|
|
@@ -57,6 +72,15 @@ type TClientMessage = {
|
|
|
57
72
|
type: 'switch-session';
|
|
58
73
|
sessionId: string;
|
|
59
74
|
requestId?: string;
|
|
75
|
+
} | {
|
|
76
|
+
type: 'rename-session';
|
|
77
|
+
sessionId: string;
|
|
78
|
+
name: string;
|
|
79
|
+
requestId: string;
|
|
80
|
+
} | {
|
|
81
|
+
type: 'delete-session';
|
|
82
|
+
sessionId: string;
|
|
83
|
+
requestId: string;
|
|
60
84
|
} | {
|
|
61
85
|
type: 'get-usage-report';
|
|
62
86
|
} | {
|
|
@@ -82,6 +106,16 @@ type TClientMessage = {
|
|
|
82
106
|
} | {
|
|
83
107
|
type: 'stop-waiting-loop';
|
|
84
108
|
requestId: string;
|
|
109
|
+
} | {
|
|
110
|
+
type: 'project-status';
|
|
111
|
+
requestId: string;
|
|
112
|
+
} | {
|
|
113
|
+
type: 'project-diff';
|
|
114
|
+
requestId: string;
|
|
115
|
+
path: string;
|
|
116
|
+
} | {
|
|
117
|
+
type: 'project-memory';
|
|
118
|
+
requestId: string;
|
|
85
119
|
} | {
|
|
86
120
|
type: 'get-background-tasks';
|
|
87
121
|
filter?: IBackgroundTaskListFilter;
|
|
@@ -125,6 +159,13 @@ type TClientMessage = {
|
|
|
125
159
|
} | {
|
|
126
160
|
type: 'ack';
|
|
127
161
|
seq: number;
|
|
162
|
+
} | {
|
|
163
|
+
type: 'get-settings';
|
|
164
|
+
requestId: string;
|
|
165
|
+
} | {
|
|
166
|
+
type: 'update-settings';
|
|
167
|
+
requestId: string;
|
|
168
|
+
patch: TSettingsPatch;
|
|
128
169
|
};
|
|
129
170
|
/** Outbound message from server to client. */
|
|
130
171
|
type TServerMessage = {
|
|
@@ -157,7 +198,24 @@ type TServerMessage = {
|
|
|
157
198
|
driverId?: TDriverId;
|
|
158
199
|
} | {
|
|
159
200
|
type: 'error';
|
|
201
|
+
/** The raw failure text — kept for a "Details" disclosure; never the whole story on its own. */
|
|
160
202
|
message: string;
|
|
203
|
+
/**
|
|
204
|
+
* What kind of failure this was, when it's known — so a renderer can say what happened and
|
|
205
|
+
* what to do next in plain words instead of showing `message` verbatim (#3289 §3). Additive:
|
|
206
|
+
* absent for a session error this classification does not recognize (unchanged behavior).
|
|
207
|
+
*/
|
|
208
|
+
code?: 'auth' | 'rate_limit' | 'model_unavailable' | 'network' | 'provider';
|
|
209
|
+
/** The provider/profile name the failure came from, when `code` names one. */
|
|
210
|
+
provider?: string;
|
|
211
|
+
/** For `code: 'rate_limit'`, how long until a retry may succeed, when the provider said so. */
|
|
212
|
+
retryAfterSeconds?: number;
|
|
213
|
+
/**
|
|
214
|
+
* For `code: 'model_unavailable'`, the model the failed request tried — captured at the moment
|
|
215
|
+
* of failure so a renderer never has to fall back to whatever model is live by the time it
|
|
216
|
+
* draws this notice (which may already be a different one the person switched to).
|
|
217
|
+
*/
|
|
218
|
+
model?: string;
|
|
161
219
|
driverId?: TDriverId;
|
|
162
220
|
} | {
|
|
163
221
|
type: 'command_result';
|
|
@@ -170,6 +228,20 @@ type TServerMessage = {
|
|
|
170
228
|
} | {
|
|
171
229
|
type: 'messages';
|
|
172
230
|
messages: ReturnType<ISessionConversationRead['getMessages']>;
|
|
231
|
+
/**
|
|
232
|
+
* #3288 §2: the SAME history, projected into display segments (text runs and finished tool
|
|
233
|
+
* calls, diffs included) — so a reload/reconnect/resume replay shows tool rows instead of bare
|
|
234
|
+
* text. Optional so an older host that has not grown `getMessagesDisplay()` yet still sends a
|
|
235
|
+
* valid frame; a client without this field falls back to `messages`-only (text bubbles), the
|
|
236
|
+
* same as before this existed.
|
|
237
|
+
*/
|
|
238
|
+
display?: ReturnType<ISessionConversationRead['getMessagesDisplay']>;
|
|
239
|
+
/**
|
|
240
|
+
* #3289 §3: this connection's own server-assigned driver id, carried on the first frame every
|
|
241
|
+
* connection already gets — so a client can tell its OWN turns from a co-driver's instead of
|
|
242
|
+
* treating everything but the literal `'owner'` id as someone else (REMOTE-014 E5 display-only).
|
|
243
|
+
*/
|
|
244
|
+
driverId?: TDriverId;
|
|
173
245
|
} | {
|
|
174
246
|
type: 'history';
|
|
175
247
|
startIndex: number;
|
|
@@ -190,6 +262,17 @@ type TServerMessage = {
|
|
|
190
262
|
} | {
|
|
191
263
|
type: 'session_status';
|
|
192
264
|
status: ISessionStatusSnapshot;
|
|
265
|
+
} | {
|
|
266
|
+
type: 'model_list';
|
|
267
|
+
requestId: string;
|
|
268
|
+
groups: readonly IModelListGroup[];
|
|
269
|
+
currentProfile?: string;
|
|
270
|
+
currentModel: string;
|
|
271
|
+
} | {
|
|
272
|
+
type: 'agent_definitions';
|
|
273
|
+
requestId: string;
|
|
274
|
+
agents: readonly IWireAgentDefinitionSummary[];
|
|
275
|
+
current: string;
|
|
193
276
|
} | {
|
|
194
277
|
type: 'sessions';
|
|
195
278
|
requestId: string;
|
|
@@ -207,6 +290,24 @@ type TServerMessage = {
|
|
|
207
290
|
code: TSessionChangeRefusalCode;
|
|
208
291
|
message: string;
|
|
209
292
|
requestId?: string;
|
|
293
|
+
} | {
|
|
294
|
+
type: 'session_renamed_in_list';
|
|
295
|
+
requestId: string;
|
|
296
|
+
sessionId: string;
|
|
297
|
+
name: string;
|
|
298
|
+
} | {
|
|
299
|
+
type: 'session_rename_failed';
|
|
300
|
+
requestId: string;
|
|
301
|
+
message: string;
|
|
302
|
+
} | {
|
|
303
|
+
type: 'session_deleted';
|
|
304
|
+
requestId: string;
|
|
305
|
+
sessionId: string;
|
|
306
|
+
} | {
|
|
307
|
+
type: 'session_delete_failed';
|
|
308
|
+
requestId: string;
|
|
309
|
+
code: TSessionDeleteRefusalCode;
|
|
310
|
+
message: string;
|
|
210
311
|
} | {
|
|
211
312
|
type: 'usage_report';
|
|
212
313
|
report: IUsageBySourceReport;
|
|
@@ -252,6 +353,18 @@ type TServerMessage = {
|
|
|
252
353
|
type: 'waiting_loop_stop';
|
|
253
354
|
requestId: string;
|
|
254
355
|
outcome: TWaitingLoopStopOutcome;
|
|
356
|
+
} | {
|
|
357
|
+
type: 'project_status';
|
|
358
|
+
requestId: string;
|
|
359
|
+
result: TProjectStatusRead;
|
|
360
|
+
} | {
|
|
361
|
+
type: 'project_diff';
|
|
362
|
+
requestId: string;
|
|
363
|
+
result: TProjectDiffRead;
|
|
364
|
+
} | {
|
|
365
|
+
type: 'project_memory';
|
|
366
|
+
requestId: string;
|
|
367
|
+
result: TProjectMemoryRead;
|
|
255
368
|
} | {
|
|
256
369
|
type: 'background_task_event';
|
|
257
370
|
event: TBackgroundTaskEvent;
|
|
@@ -314,6 +427,15 @@ type TServerMessage = {
|
|
|
314
427
|
requestId?: string;
|
|
315
428
|
} | {
|
|
316
429
|
type: 'resume_gap';
|
|
430
|
+
} | {
|
|
431
|
+
type: 'settings';
|
|
432
|
+
requestId: string;
|
|
433
|
+
settings: ISettingsSnapshot;
|
|
434
|
+
} | {
|
|
435
|
+
type: 'settings_error';
|
|
436
|
+
requestId: string;
|
|
437
|
+
code: 'not_available' | 'invalid' | 'refused' | 'update_failed';
|
|
438
|
+
message: string;
|
|
317
439
|
};
|
|
318
440
|
/**
|
|
319
441
|
* REMOTE-013 E4: a server message stamped with its monotonic session sequence number (added by the
|
|
@@ -416,7 +538,48 @@ declare function createOutboundDelivery(send: (message: TServerMessage) => void,
|
|
|
416
538
|
//#endregion
|
|
417
539
|
//#region src/protocol-session.d.ts
|
|
418
540
|
/** Session roles required by the shared WebSocket/WebRTC protocol. */
|
|
419
|
-
interface IProtocolSession extends ISessionTurnSubmission, ISessionTurnControl, ISessionCommands, ISessionStatusRead, ISessionEvents, ISessionPromptResolution, ISessionConversationRead, ISessionExecutionState, ISessionDriverAttribution, ISessionBackgroundTasks, ISessionBackgroundGroups, ISessionExecutionWorkspace, ISessionExecutionDetail, ISessionSelfPacedLoopControl {}
|
|
541
|
+
interface IProtocolSession extends ISessionTurnSubmission, ISessionTurnControl, ISessionCommands, ISessionStatusRead, ISessionEvents, ISessionPromptResolution, ISessionConversationRead, ISessionExecutionState, ISessionDriverAttribution, ISessionBackgroundTasks, ISessionBackgroundGroups, ISessionExecutionWorkspace, ISessionExecutionDetail, ISessionSelfPacedLoopControl, ISessionAgentJobs {}
|
|
542
|
+
/**
|
|
543
|
+
* #3282 §4c: a protocol session that ALSO answers the Project panel's reads. `Partial` (not a fourth
|
|
544
|
+
* mandatory role on {@link IProtocolSession} itself) deliberately: every existing test double and
|
|
545
|
+
* every other host that builds an `IProtocolSession` keeps type-checking unchanged, and the panel's
|
|
546
|
+
* three methods are runtime-probed (`typeof session.readProjectStatus === 'function'`) rather than
|
|
547
|
+
* assumed — `InteractiveSession` (the one production implementation) provides all three, satisfying
|
|
548
|
+
* this type with no further wiring.
|
|
549
|
+
*/
|
|
550
|
+
type TProjectReadCapableSession = IProtocolSession & Partial<ISessionProjectRead>;
|
|
551
|
+
//#endregion
|
|
552
|
+
//#region src/settings-messages.d.ts
|
|
553
|
+
type TSettingsMessage = Extract<TClientMessage, {
|
|
554
|
+
type: 'get-settings' | 'update-settings';
|
|
555
|
+
}>;
|
|
556
|
+
declare function isSettingsMessage(msg: TClientMessage): msg is TSettingsMessage;
|
|
557
|
+
/** What applying a patch did: the fresh snapshot, or why nothing was written. */
|
|
558
|
+
type TSettingsUpdateOutcome = {
|
|
559
|
+
readonly ok: true;
|
|
560
|
+
readonly settings: ISettingsSnapshot;
|
|
561
|
+
} | {
|
|
562
|
+
readonly ok: false;
|
|
563
|
+
readonly code: 'not_available' | 'invalid' | 'refused' | 'update_failed';
|
|
564
|
+
readonly message: string;
|
|
565
|
+
};
|
|
566
|
+
/**
|
|
567
|
+
* #3282 §4a: host-owned read/write for the Settings screen, supplied by the composition root the
|
|
568
|
+
* same way `IUsageQueryReporters` supplies usage reads — this package only correlates the request
|
|
569
|
+
* and carries the result. `updateSettings` applies through the SAME function the matching slash
|
|
570
|
+
* command uses (issue #3282 §4: "one code path, so the behavior matches the TUI"), so whatever a
|
|
571
|
+
* command would refuse on this surface is refused here too.
|
|
572
|
+
*/
|
|
573
|
+
interface ISettingsReporter {
|
|
574
|
+
getSettings(session: IProtocolSession, locality?: TCommandSurfaceLocality): ISettingsSnapshot | Promise<ISettingsSnapshot>;
|
|
575
|
+
/**
|
|
576
|
+
* Applies through the SAME function the matching slash command uses. `locality` (#3282 §4 part
|
|
577
|
+
* b-2) is forwarded to that command exactly as the transport received it, so a command that
|
|
578
|
+
* refuses a remote surface (installing a plugin) refuses identically here.
|
|
579
|
+
*/
|
|
580
|
+
updateSettings(session: IProtocolSession, patch: TSettingsPatch, locality?: TCommandSurfaceLocality): TSettingsUpdateOutcome | Promise<TSettingsUpdateOutcome>;
|
|
581
|
+
}
|
|
582
|
+
declare function handleSettingsMessage(session: IProtocolSession, deliver: TOutboundDeliver, msg: TSettingsMessage, reporter: ISettingsReporter | undefined, locality?: TCommandSurfaceLocality): void;
|
|
420
583
|
//#endregion
|
|
421
584
|
//#region src/usage-messages.d.ts
|
|
422
585
|
interface IUsageQueryReporters {
|
|
@@ -467,8 +630,8 @@ declare const PROTOCOL_SESSION_EVENT_CLASSIFICATION: {
|
|
|
467
630
|
*/
|
|
468
631
|
type TSessionSurfaceRole = 'drive' | 'observe';
|
|
469
632
|
interface ISessionMessageHandlerOptions {
|
|
470
|
-
/** IProtocolSession to expose. */
|
|
471
|
-
session:
|
|
633
|
+
/** IProtocolSession to expose — `Partial<ISessionProjectRead>` is probed, not assumed (#3282 §4c). */
|
|
634
|
+
session: TProjectReadCapableSession;
|
|
472
635
|
/**
|
|
473
636
|
* ARCH-030: the CARRIER's connection-scoped outbound delivery boundary — not a raw `send`, and not a
|
|
474
637
|
* `send` plus an error callback for this handler to assemble into one. The carrier owns both the sink
|
|
@@ -495,6 +658,15 @@ interface ISessionMessageHandlerOptions {
|
|
|
495
658
|
storedSessionUsageReporter?: NonNullable<IUsageQueryReporters['storedSessionUsageReporter']>;
|
|
496
659
|
/** Host-owned session directory (#3189): list, start and switch the host's sessions. */
|
|
497
660
|
sessionDirectory?: ISessionDirectory;
|
|
661
|
+
/** #3282 §4a: host-owned read/write for the GUI Settings screen. */
|
|
662
|
+
settingsReporter?: ISettingsReporter;
|
|
663
|
+
/**
|
|
664
|
+
* #3282 §4 part b-2: carrier-decided, like `role` — whether THIS carrier's connections are
|
|
665
|
+
* provably on this machine. The loopback WS carrier is `'local'`; the device-mesh/WebRTC carrier
|
|
666
|
+
* sets `'remote'`. Absent → `'local'`, forwarded to `executeCommand` and the settings reporter so a
|
|
667
|
+
* command that runs code from outside the session (installing a plugin) can refuse a remote device.
|
|
668
|
+
*/
|
|
669
|
+
commandSurfaceLocality?: TCommandSurfaceLocality;
|
|
498
670
|
}
|
|
499
671
|
/**
|
|
500
672
|
* Create a carrier-neutral message handler for an IProtocolSession.
|
|
@@ -645,6 +817,8 @@ interface ISessionResumeBridgeOptions {
|
|
|
645
817
|
readonly personalUsageReporter?: IUsageQueryReporters['personalUsageReporter'];
|
|
646
818
|
readonly usageReporter?: IUsageQueryReporters['usageReporter'];
|
|
647
819
|
readonly storedSessionUsageReporter?: IUsageQueryReporters['storedSessionUsageReporter'];
|
|
820
|
+
/** #3282 §4 part b-2: this bridge is the reconnectable WebRTC path, so it is always `'remote'`. */
|
|
821
|
+
readonly commandSurfaceLocality?: TCommandSurfaceLocality;
|
|
648
822
|
}
|
|
649
823
|
declare class SessionResumeBridge {
|
|
650
824
|
private readonly session;
|
|
@@ -652,6 +826,7 @@ declare class SessionResumeBridge {
|
|
|
652
826
|
private driverId?;
|
|
653
827
|
private readonly reporters;
|
|
654
828
|
private readonly surface?;
|
|
829
|
+
private readonly commandSurfaceLocality?;
|
|
655
830
|
private readonly unsubscribe;
|
|
656
831
|
private onDeliveryError?;
|
|
657
832
|
/**
|
|
@@ -879,5 +1054,5 @@ declare class HandoffChunkAssembler {
|
|
|
879
1054
|
*/
|
|
880
1055
|
declare function chunkCountFor(integrity: IHandoffIntegrity, maxChunkBytes?: number): number;
|
|
881
1056
|
//#endregion
|
|
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 };
|
|
1057
|
+
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 ISettingsReporter, type IWireAgentDefinitionSummary, 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 TSettingsUpdateOutcome, type TWireExecutionResult, acknowledgePeerMessage, admitPeerMessage, chunkCountFor, chunkHandoffPayload, createOutboundDelivery, createPeerMessageLedger, createPendingStallClock, createSessionMessageHandler, decodeChannelFrame, decodeClientMessage, decodeFrame, decodeServerMessage, encodeBinaryFrame, encodeChannelEventFrame, forgetPeerOrigin, handleSettingsMessage, isChannelFrame, isObserverMessageType, isOverPendingBudget, isSettingsMessage };
|
|
883
1058
|
//# 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/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":";;;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../../src/wire-messages.ts","../../src/outbound-delivery.ts","../../src/protocol-session.ts","../../src/settings-messages.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":";;;;;;;KAyDY;KAEP,gBAAgB,WAAW;;;;;UAM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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,12 +1,21 @@
|
|
|
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
|
+
import { IAskRequestEvent, IBranchEvent, IContextFileRefreshedEvent, IExecutionResult, IModelListGroup, IPermissionRequestEvent, IPlanApprovalEvent, IPromptResolvedEvent, ISessionAgentJobs, ISessionBackgroundGroups, ISessionBackgroundTasks, ISessionCommands, ISessionConversationRead, ISessionDirectory, ISessionDriverAttribution, ISessionEvents, ISessionExecutionDetail, ISessionExecutionState, ISessionExecutionWorkspace, ISessionListing, ISessionProjectRead, ISessionPromptResolution, ISessionRenamedEvent, ISessionSelfPacedLoopControl, ISessionStatusRead, ISessionStatusSnapshot, ISessionSwitchedEvent, ISessionTurnControl, ISessionTurnSubmission, ISettingsSnapshot, IToolState, IUiIntentEvent, TDriverId, TPermissionResultValue, TProjectDiffRead, TProjectMemoryRead, TProjectStatusRead, TSessionChangeRefusalCode, TSessionDeleteRefusalCode, TSettingsPatch, TTurnSource, TWaitingLoopStopOutcome } from "@robota-sdk/agent-interface-session";
|
|
2
2
|
import { IPersonalUsageReport, IPersonalUsageRequest, IUsageBySourceReport, TUsageSurface } from "@robota-sdk/agent-interface-analytics";
|
|
3
|
-
import { ICommandListEntry, ICommandResult, ICommandSkillListEntry } from "@robota-sdk/agent-interface-command";
|
|
3
|
+
import { ICommandListEntry, ICommandResult, ICommandSkillListEntry, TCommandSurfaceLocality } from "@robota-sdk/agent-interface-command";
|
|
4
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
9
|
type THistoryEntry = ReturnType<ISessionConversationRead['getFullHistory']>[number];
|
|
10
|
+
/**
|
|
11
|
+
* #3282 §4: one agent the switcher can offer. `definedIn` is a plain-words location — a discovered
|
|
12
|
+
* file's path, or "Built-in" — never a raw internal id.
|
|
13
|
+
*/
|
|
14
|
+
interface IWireAgentDefinitionSummary {
|
|
15
|
+
name: string;
|
|
16
|
+
description: string;
|
|
17
|
+
definedIn: string;
|
|
18
|
+
}
|
|
10
19
|
/**
|
|
11
20
|
* #3189: one entry of the session's full history as it crosses the wire. The same record the session
|
|
12
21
|
* keeps, except that `timestamp` is an ISO 8601 string: a `Date` does not survive JSON, and a
|
|
@@ -47,6 +56,12 @@ type TClientMessage = {
|
|
|
47
56
|
type: 'get-commands';
|
|
48
57
|
} | {
|
|
49
58
|
type: 'get-status';
|
|
59
|
+
} | {
|
|
60
|
+
type: 'list-models';
|
|
61
|
+
requestId: string;
|
|
62
|
+
} | {
|
|
63
|
+
type: 'get-agent-definitions';
|
|
64
|
+
requestId: string;
|
|
50
65
|
} | {
|
|
51
66
|
type: 'list-sessions';
|
|
52
67
|
requestId: string;
|
|
@@ -57,6 +72,15 @@ type TClientMessage = {
|
|
|
57
72
|
type: 'switch-session';
|
|
58
73
|
sessionId: string;
|
|
59
74
|
requestId?: string;
|
|
75
|
+
} | {
|
|
76
|
+
type: 'rename-session';
|
|
77
|
+
sessionId: string;
|
|
78
|
+
name: string;
|
|
79
|
+
requestId: string;
|
|
80
|
+
} | {
|
|
81
|
+
type: 'delete-session';
|
|
82
|
+
sessionId: string;
|
|
83
|
+
requestId: string;
|
|
60
84
|
} | {
|
|
61
85
|
type: 'get-usage-report';
|
|
62
86
|
} | {
|
|
@@ -82,6 +106,16 @@ type TClientMessage = {
|
|
|
82
106
|
} | {
|
|
83
107
|
type: 'stop-waiting-loop';
|
|
84
108
|
requestId: string;
|
|
109
|
+
} | {
|
|
110
|
+
type: 'project-status';
|
|
111
|
+
requestId: string;
|
|
112
|
+
} | {
|
|
113
|
+
type: 'project-diff';
|
|
114
|
+
requestId: string;
|
|
115
|
+
path: string;
|
|
116
|
+
} | {
|
|
117
|
+
type: 'project-memory';
|
|
118
|
+
requestId: string;
|
|
85
119
|
} | {
|
|
86
120
|
type: 'get-background-tasks';
|
|
87
121
|
filter?: IBackgroundTaskListFilter;
|
|
@@ -125,6 +159,13 @@ type TClientMessage = {
|
|
|
125
159
|
} | {
|
|
126
160
|
type: 'ack';
|
|
127
161
|
seq: number;
|
|
162
|
+
} | {
|
|
163
|
+
type: 'get-settings';
|
|
164
|
+
requestId: string;
|
|
165
|
+
} | {
|
|
166
|
+
type: 'update-settings';
|
|
167
|
+
requestId: string;
|
|
168
|
+
patch: TSettingsPatch;
|
|
128
169
|
};
|
|
129
170
|
/** Outbound message from server to client. */
|
|
130
171
|
type TServerMessage = {
|
|
@@ -157,7 +198,24 @@ type TServerMessage = {
|
|
|
157
198
|
driverId?: TDriverId;
|
|
158
199
|
} | {
|
|
159
200
|
type: 'error';
|
|
201
|
+
/** The raw failure text — kept for a "Details" disclosure; never the whole story on its own. */
|
|
160
202
|
message: string;
|
|
203
|
+
/**
|
|
204
|
+
* What kind of failure this was, when it's known — so a renderer can say what happened and
|
|
205
|
+
* what to do next in plain words instead of showing `message` verbatim (#3289 §3). Additive:
|
|
206
|
+
* absent for a session error this classification does not recognize (unchanged behavior).
|
|
207
|
+
*/
|
|
208
|
+
code?: 'auth' | 'rate_limit' | 'model_unavailable' | 'network' | 'provider';
|
|
209
|
+
/** The provider/profile name the failure came from, when `code` names one. */
|
|
210
|
+
provider?: string;
|
|
211
|
+
/** For `code: 'rate_limit'`, how long until a retry may succeed, when the provider said so. */
|
|
212
|
+
retryAfterSeconds?: number;
|
|
213
|
+
/**
|
|
214
|
+
* For `code: 'model_unavailable'`, the model the failed request tried — captured at the moment
|
|
215
|
+
* of failure so a renderer never has to fall back to whatever model is live by the time it
|
|
216
|
+
* draws this notice (which may already be a different one the person switched to).
|
|
217
|
+
*/
|
|
218
|
+
model?: string;
|
|
161
219
|
driverId?: TDriverId;
|
|
162
220
|
} | {
|
|
163
221
|
type: 'command_result';
|
|
@@ -170,6 +228,20 @@ type TServerMessage = {
|
|
|
170
228
|
} | {
|
|
171
229
|
type: 'messages';
|
|
172
230
|
messages: ReturnType<ISessionConversationRead['getMessages']>;
|
|
231
|
+
/**
|
|
232
|
+
* #3288 §2: the SAME history, projected into display segments (text runs and finished tool
|
|
233
|
+
* calls, diffs included) — so a reload/reconnect/resume replay shows tool rows instead of bare
|
|
234
|
+
* text. Optional so an older host that has not grown `getMessagesDisplay()` yet still sends a
|
|
235
|
+
* valid frame; a client without this field falls back to `messages`-only (text bubbles), the
|
|
236
|
+
* same as before this existed.
|
|
237
|
+
*/
|
|
238
|
+
display?: ReturnType<ISessionConversationRead['getMessagesDisplay']>;
|
|
239
|
+
/**
|
|
240
|
+
* #3289 §3: this connection's own server-assigned driver id, carried on the first frame every
|
|
241
|
+
* connection already gets — so a client can tell its OWN turns from a co-driver's instead of
|
|
242
|
+
* treating everything but the literal `'owner'` id as someone else (REMOTE-014 E5 display-only).
|
|
243
|
+
*/
|
|
244
|
+
driverId?: TDriverId;
|
|
173
245
|
} | {
|
|
174
246
|
type: 'history';
|
|
175
247
|
startIndex: number;
|
|
@@ -190,6 +262,17 @@ type TServerMessage = {
|
|
|
190
262
|
} | {
|
|
191
263
|
type: 'session_status';
|
|
192
264
|
status: ISessionStatusSnapshot;
|
|
265
|
+
} | {
|
|
266
|
+
type: 'model_list';
|
|
267
|
+
requestId: string;
|
|
268
|
+
groups: readonly IModelListGroup[];
|
|
269
|
+
currentProfile?: string;
|
|
270
|
+
currentModel: string;
|
|
271
|
+
} | {
|
|
272
|
+
type: 'agent_definitions';
|
|
273
|
+
requestId: string;
|
|
274
|
+
agents: readonly IWireAgentDefinitionSummary[];
|
|
275
|
+
current: string;
|
|
193
276
|
} | {
|
|
194
277
|
type: 'sessions';
|
|
195
278
|
requestId: string;
|
|
@@ -207,6 +290,24 @@ type TServerMessage = {
|
|
|
207
290
|
code: TSessionChangeRefusalCode;
|
|
208
291
|
message: string;
|
|
209
292
|
requestId?: string;
|
|
293
|
+
} | {
|
|
294
|
+
type: 'session_renamed_in_list';
|
|
295
|
+
requestId: string;
|
|
296
|
+
sessionId: string;
|
|
297
|
+
name: string;
|
|
298
|
+
} | {
|
|
299
|
+
type: 'session_rename_failed';
|
|
300
|
+
requestId: string;
|
|
301
|
+
message: string;
|
|
302
|
+
} | {
|
|
303
|
+
type: 'session_deleted';
|
|
304
|
+
requestId: string;
|
|
305
|
+
sessionId: string;
|
|
306
|
+
} | {
|
|
307
|
+
type: 'session_delete_failed';
|
|
308
|
+
requestId: string;
|
|
309
|
+
code: TSessionDeleteRefusalCode;
|
|
310
|
+
message: string;
|
|
210
311
|
} | {
|
|
211
312
|
type: 'usage_report';
|
|
212
313
|
report: IUsageBySourceReport;
|
|
@@ -252,6 +353,18 @@ type TServerMessage = {
|
|
|
252
353
|
type: 'waiting_loop_stop';
|
|
253
354
|
requestId: string;
|
|
254
355
|
outcome: TWaitingLoopStopOutcome;
|
|
356
|
+
} | {
|
|
357
|
+
type: 'project_status';
|
|
358
|
+
requestId: string;
|
|
359
|
+
result: TProjectStatusRead;
|
|
360
|
+
} | {
|
|
361
|
+
type: 'project_diff';
|
|
362
|
+
requestId: string;
|
|
363
|
+
result: TProjectDiffRead;
|
|
364
|
+
} | {
|
|
365
|
+
type: 'project_memory';
|
|
366
|
+
requestId: string;
|
|
367
|
+
result: TProjectMemoryRead;
|
|
255
368
|
} | {
|
|
256
369
|
type: 'background_task_event';
|
|
257
370
|
event: TBackgroundTaskEvent;
|
|
@@ -314,6 +427,15 @@ type TServerMessage = {
|
|
|
314
427
|
requestId?: string;
|
|
315
428
|
} | {
|
|
316
429
|
type: 'resume_gap';
|
|
430
|
+
} | {
|
|
431
|
+
type: 'settings';
|
|
432
|
+
requestId: string;
|
|
433
|
+
settings: ISettingsSnapshot;
|
|
434
|
+
} | {
|
|
435
|
+
type: 'settings_error';
|
|
436
|
+
requestId: string;
|
|
437
|
+
code: 'not_available' | 'invalid' | 'refused' | 'update_failed';
|
|
438
|
+
message: string;
|
|
317
439
|
};
|
|
318
440
|
/**
|
|
319
441
|
* REMOTE-013 E4: a server message stamped with its monotonic session sequence number (added by the
|
|
@@ -416,7 +538,48 @@ declare function createOutboundDelivery(send: (message: TServerMessage) => void,
|
|
|
416
538
|
//#endregion
|
|
417
539
|
//#region src/protocol-session.d.ts
|
|
418
540
|
/** Session roles required by the shared WebSocket/WebRTC protocol. */
|
|
419
|
-
interface IProtocolSession extends ISessionTurnSubmission, ISessionTurnControl, ISessionCommands, ISessionStatusRead, ISessionEvents, ISessionPromptResolution, ISessionConversationRead, ISessionExecutionState, ISessionDriverAttribution, ISessionBackgroundTasks, ISessionBackgroundGroups, ISessionExecutionWorkspace, ISessionExecutionDetail, ISessionSelfPacedLoopControl {}
|
|
541
|
+
interface IProtocolSession extends ISessionTurnSubmission, ISessionTurnControl, ISessionCommands, ISessionStatusRead, ISessionEvents, ISessionPromptResolution, ISessionConversationRead, ISessionExecutionState, ISessionDriverAttribution, ISessionBackgroundTasks, ISessionBackgroundGroups, ISessionExecutionWorkspace, ISessionExecutionDetail, ISessionSelfPacedLoopControl, ISessionAgentJobs {}
|
|
542
|
+
/**
|
|
543
|
+
* #3282 §4c: a protocol session that ALSO answers the Project panel's reads. `Partial` (not a fourth
|
|
544
|
+
* mandatory role on {@link IProtocolSession} itself) deliberately: every existing test double and
|
|
545
|
+
* every other host that builds an `IProtocolSession` keeps type-checking unchanged, and the panel's
|
|
546
|
+
* three methods are runtime-probed (`typeof session.readProjectStatus === 'function'`) rather than
|
|
547
|
+
* assumed — `InteractiveSession` (the one production implementation) provides all three, satisfying
|
|
548
|
+
* this type with no further wiring.
|
|
549
|
+
*/
|
|
550
|
+
type TProjectReadCapableSession = IProtocolSession & Partial<ISessionProjectRead>;
|
|
551
|
+
//#endregion
|
|
552
|
+
//#region src/settings-messages.d.ts
|
|
553
|
+
type TSettingsMessage = Extract<TClientMessage, {
|
|
554
|
+
type: 'get-settings' | 'update-settings';
|
|
555
|
+
}>;
|
|
556
|
+
declare function isSettingsMessage(msg: TClientMessage): msg is TSettingsMessage;
|
|
557
|
+
/** What applying a patch did: the fresh snapshot, or why nothing was written. */
|
|
558
|
+
type TSettingsUpdateOutcome = {
|
|
559
|
+
readonly ok: true;
|
|
560
|
+
readonly settings: ISettingsSnapshot;
|
|
561
|
+
} | {
|
|
562
|
+
readonly ok: false;
|
|
563
|
+
readonly code: 'not_available' | 'invalid' | 'refused' | 'update_failed';
|
|
564
|
+
readonly message: string;
|
|
565
|
+
};
|
|
566
|
+
/**
|
|
567
|
+
* #3282 §4a: host-owned read/write for the Settings screen, supplied by the composition root the
|
|
568
|
+
* same way `IUsageQueryReporters` supplies usage reads — this package only correlates the request
|
|
569
|
+
* and carries the result. `updateSettings` applies through the SAME function the matching slash
|
|
570
|
+
* command uses (issue #3282 §4: "one code path, so the behavior matches the TUI"), so whatever a
|
|
571
|
+
* command would refuse on this surface is refused here too.
|
|
572
|
+
*/
|
|
573
|
+
interface ISettingsReporter {
|
|
574
|
+
getSettings(session: IProtocolSession, locality?: TCommandSurfaceLocality): ISettingsSnapshot | Promise<ISettingsSnapshot>;
|
|
575
|
+
/**
|
|
576
|
+
* Applies through the SAME function the matching slash command uses. `locality` (#3282 §4 part
|
|
577
|
+
* b-2) is forwarded to that command exactly as the transport received it, so a command that
|
|
578
|
+
* refuses a remote surface (installing a plugin) refuses identically here.
|
|
579
|
+
*/
|
|
580
|
+
updateSettings(session: IProtocolSession, patch: TSettingsPatch, locality?: TCommandSurfaceLocality): TSettingsUpdateOutcome | Promise<TSettingsUpdateOutcome>;
|
|
581
|
+
}
|
|
582
|
+
declare function handleSettingsMessage(session: IProtocolSession, deliver: TOutboundDeliver, msg: TSettingsMessage, reporter: ISettingsReporter | undefined, locality?: TCommandSurfaceLocality): void;
|
|
420
583
|
//#endregion
|
|
421
584
|
//#region src/usage-messages.d.ts
|
|
422
585
|
interface IUsageQueryReporters {
|
|
@@ -467,8 +630,8 @@ declare const PROTOCOL_SESSION_EVENT_CLASSIFICATION: {
|
|
|
467
630
|
*/
|
|
468
631
|
type TSessionSurfaceRole = 'drive' | 'observe';
|
|
469
632
|
interface ISessionMessageHandlerOptions {
|
|
470
|
-
/** IProtocolSession to expose. */
|
|
471
|
-
session:
|
|
633
|
+
/** IProtocolSession to expose — `Partial<ISessionProjectRead>` is probed, not assumed (#3282 §4c). */
|
|
634
|
+
session: TProjectReadCapableSession;
|
|
472
635
|
/**
|
|
473
636
|
* ARCH-030: the CARRIER's connection-scoped outbound delivery boundary — not a raw `send`, and not a
|
|
474
637
|
* `send` plus an error callback for this handler to assemble into one. The carrier owns both the sink
|
|
@@ -495,6 +658,15 @@ interface ISessionMessageHandlerOptions {
|
|
|
495
658
|
storedSessionUsageReporter?: NonNullable<IUsageQueryReporters['storedSessionUsageReporter']>;
|
|
496
659
|
/** Host-owned session directory (#3189): list, start and switch the host's sessions. */
|
|
497
660
|
sessionDirectory?: ISessionDirectory;
|
|
661
|
+
/** #3282 §4a: host-owned read/write for the GUI Settings screen. */
|
|
662
|
+
settingsReporter?: ISettingsReporter;
|
|
663
|
+
/**
|
|
664
|
+
* #3282 §4 part b-2: carrier-decided, like `role` — whether THIS carrier's connections are
|
|
665
|
+
* provably on this machine. The loopback WS carrier is `'local'`; the device-mesh/WebRTC carrier
|
|
666
|
+
* sets `'remote'`. Absent → `'local'`, forwarded to `executeCommand` and the settings reporter so a
|
|
667
|
+
* command that runs code from outside the session (installing a plugin) can refuse a remote device.
|
|
668
|
+
*/
|
|
669
|
+
commandSurfaceLocality?: TCommandSurfaceLocality;
|
|
498
670
|
}
|
|
499
671
|
/**
|
|
500
672
|
* Create a carrier-neutral message handler for an IProtocolSession.
|
|
@@ -645,6 +817,8 @@ interface ISessionResumeBridgeOptions {
|
|
|
645
817
|
readonly personalUsageReporter?: IUsageQueryReporters['personalUsageReporter'];
|
|
646
818
|
readonly usageReporter?: IUsageQueryReporters['usageReporter'];
|
|
647
819
|
readonly storedSessionUsageReporter?: IUsageQueryReporters['storedSessionUsageReporter'];
|
|
820
|
+
/** #3282 §4 part b-2: this bridge is the reconnectable WebRTC path, so it is always `'remote'`. */
|
|
821
|
+
readonly commandSurfaceLocality?: TCommandSurfaceLocality;
|
|
648
822
|
}
|
|
649
823
|
declare class SessionResumeBridge {
|
|
650
824
|
private readonly session;
|
|
@@ -652,6 +826,7 @@ declare class SessionResumeBridge {
|
|
|
652
826
|
private driverId?;
|
|
653
827
|
private readonly reporters;
|
|
654
828
|
private readonly surface?;
|
|
829
|
+
private readonly commandSurfaceLocality?;
|
|
655
830
|
private readonly unsubscribe;
|
|
656
831
|
private onDeliveryError?;
|
|
657
832
|
/**
|
|
@@ -879,5 +1054,5 @@ declare class HandoffChunkAssembler {
|
|
|
879
1054
|
*/
|
|
880
1055
|
declare function chunkCountFor(integrity: IHandoffIntegrity, maxChunkBytes?: number): number;
|
|
881
1056
|
//#endregion
|
|
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 };
|
|
1057
|
+
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 ISettingsReporter, type IWireAgentDefinitionSummary, 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 TSettingsUpdateOutcome, type TWireExecutionResult, acknowledgePeerMessage, admitPeerMessage, chunkCountFor, chunkHandoffPayload, createOutboundDelivery, createPeerMessageLedger, createPendingStallClock, createSessionMessageHandler, decodeChannelFrame, decodeClientMessage, decodeFrame, decodeServerMessage, encodeBinaryFrame, encodeChannelEventFrame, forgetPeerOrigin, handleSettingsMessage, isChannelFrame, isObserverMessageType, isOverPendingBudget, isSettingsMessage };
|
|
883
1058
|
//# sourceMappingURL=index.d.ts.map
|