@crazx/dsh-api-session-controller 0.1.2-alpha.3.zw.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.
Files changed (74) hide show
  1. package/LICENSE +21 -0
  2. package/README.i18n.yaml +6 -0
  3. package/README.md +74 -0
  4. package/README.zh.md +74 -0
  5. package/lib/client.js +2724 -0
  6. package/lib/index.js +2826 -0
  7. package/lib/invariant.js +13 -0
  8. package/lib/typert.host.d.ts +3 -0
  9. package/lib/typert.host.js +2574 -0
  10. package/lib/typert.remote-client.d.ts +67 -0
  11. package/lib/typert.remote-client.js +1119 -0
  12. package/lib/types/agent.d.ts +156 -0
  13. package/lib/types/agent.js +537 -0
  14. package/lib/types/catalog.d.ts +11 -0
  15. package/lib/types/catalog.js +58 -0
  16. package/lib/types/client/contract/events.d.ts +71 -0
  17. package/lib/types/client/contract/events.js +91 -0
  18. package/lib/types/client/contract/session.d.ts +150 -0
  19. package/lib/types/client/contract/session.js +2 -0
  20. package/lib/types/client/contract/sessions.d.ts +125 -0
  21. package/lib/types/client/contract/sessions.js +2 -0
  22. package/lib/types/client/contract/snapshot.d.ts +82 -0
  23. package/lib/types/client/contract/snapshot.js +2 -0
  24. package/lib/types/client/index.d.ts +30 -0
  25. package/lib/types/client/index.js +48 -0
  26. package/lib/types/client/ordered-baseline.d.ts +12 -0
  27. package/lib/types/client/ordered-baseline.js +41 -0
  28. package/lib/types/client/scope.d.ts +36 -0
  29. package/lib/types/client/scope.js +54 -0
  30. package/lib/types/client/sessions/history-records.d.ts +22 -0
  31. package/lib/types/client/sessions/history-records.js +31 -0
  32. package/lib/types/client/sessions/lineage.d.ts +38 -0
  33. package/lib/types/client/sessions/lineage.js +56 -0
  34. package/lib/types/client/sessions/manager.d.ts +280 -0
  35. package/lib/types/client/sessions/manager.js +894 -0
  36. package/lib/types/client/sessions/notifier.d.ts +39 -0
  37. package/lib/types/client/sessions/notifier.js +98 -0
  38. package/lib/types/client/sessions/projection-store.d.ts +108 -0
  39. package/lib/types/client/sessions/projection-store.js +129 -0
  40. package/lib/types/client/sessions/queue-mirror.d.ts +26 -0
  41. package/lib/types/client/sessions/queue-mirror.js +61 -0
  42. package/lib/types/client/sessions/remotes.d.ts +30 -0
  43. package/lib/types/client/sessions/remotes.js +8 -0
  44. package/lib/types/client/sessions/service.d.ts +349 -0
  45. package/lib/types/client/sessions/service.js +574 -0
  46. package/lib/types/client/sessions/session.d.ts +294 -0
  47. package/lib/types/client/sessions/session.js +711 -0
  48. package/lib/types/client/time-zone.d.ts +8 -0
  49. package/lib/types/client/time-zone.js +14 -0
  50. package/lib/types/client/transport.d.ts +73 -0
  51. package/lib/types/client/transport.js +106 -0
  52. package/lib/types/commands.d.ts +69 -0
  53. package/lib/types/commands.js +544 -0
  54. package/lib/types/control.d.ts +23 -0
  55. package/lib/types/control.js +192 -0
  56. package/lib/types/file-references.d.ts +27 -0
  57. package/lib/types/file-references.js +69 -0
  58. package/lib/types/history.d.ts +31 -0
  59. package/lib/types/history.js +376 -0
  60. package/lib/types/index.d.ts +171 -0
  61. package/lib/types/index.js +424 -0
  62. package/lib/types/invariant.d.ts +9 -0
  63. package/lib/types/invariant.js +12 -0
  64. package/lib/types/list.d.ts +53 -0
  65. package/lib/types/list.js +405 -0
  66. package/lib/types/model-selection-projection.d.ts +8 -0
  67. package/lib/types/model-selection-projection.js +66 -0
  68. package/lib/types/remote-events.d.ts +8 -0
  69. package/lib/types/remote-events.js +2 -0
  70. package/lib/types/skill-catalog.d.ts +28 -0
  71. package/lib/types/skill-catalog.js +192 -0
  72. package/lib/types/types.d.ts +505 -0
  73. package/lib/types/types.js +6 -0
  74. package/package.json +154 -0
@@ -0,0 +1,376 @@
1
+ /** Cold Session history pagination and live-event source. */
2
+ var __addDisposableResource = (this && this.__addDisposableResource) || function (env, value, async) {
3
+ if (value !== null && value !== void 0) {
4
+ if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
5
+ var dispose, inner;
6
+ if (async) {
7
+ if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
8
+ dispose = value[Symbol.asyncDispose];
9
+ }
10
+ if (dispose === void 0) {
11
+ if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
12
+ dispose = value[Symbol.dispose];
13
+ if (async) inner = dispose;
14
+ }
15
+ if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
16
+ if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };
17
+ env.stack.push({ value: value, dispose: dispose, async: async });
18
+ }
19
+ else if (async) {
20
+ env.stack.push({ async: true });
21
+ }
22
+ return value;
23
+ };
24
+ var __disposeResources = (this && this.__disposeResources) || (function (SuppressedError) {
25
+ return function (env) {
26
+ function fail(e) {
27
+ env.error = env.hasError ? new SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
28
+ env.hasError = true;
29
+ }
30
+ var r, s = 0;
31
+ function next() {
32
+ while (r = env.stack.pop()) {
33
+ try {
34
+ if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);
35
+ if (r.dispose) {
36
+ var result = r.dispose.call(r.value);
37
+ if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });
38
+ }
39
+ else s |= 1;
40
+ }
41
+ catch (e) {
42
+ fail(e);
43
+ }
44
+ }
45
+ if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();
46
+ if (env.hasError) throw env.error;
47
+ }
48
+ return next();
49
+ };
50
+ })(typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
51
+ var e = new Error(message);
52
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
53
+ });
54
+ import { Deque } from '@deepseek-ai/dsh-deque';
55
+ import { isAppendSurfaceEvent } from '@deepseek-ai/dsh-session';
56
+ import { isChunkRow, packChunkRuns } from '@deepseek-ai/dsh-session/chunk-rows';
57
+ import { SessionQueryError } from '@deepseek-ai/dsh-session-query';
58
+ import { RemoteError } from '@deepseek-ai/dsh-typert-protocol';
59
+ const DEFAULT_MAX_MESSAGES = 50;
60
+ const MESSAGE_TYPES = new Set(['user/message', 'assistant/message']);
61
+ /** Implements cold-safe history operations delegated by the Session Controller. */
62
+ export class SessionHistoryController {
63
+ ctx;
64
+ promote;
65
+ closeFollowers = new Set();
66
+ /**
67
+ * @param ctx - Host context carrying Session query and projection services.
68
+ * @param promote - starts ordinary Session activation after snapshot delivery.
69
+ */
70
+ constructor(ctx, promote) {
71
+ this.ctx = ctx;
72
+ this.promote = promote;
73
+ ctx.effect(() => () => {
74
+ for (const close of this.closeFollowers)
75
+ close();
76
+ this.closeFollowers.clear();
77
+ }, 'session-controller.history');
78
+ }
79
+ /**
80
+ * Read one message-aligned history page without activating an Agent.
81
+ * @param request - durable address and backwards-page cursor.
82
+ * @param signal - caller cancellation for persistence reads.
83
+ * @returns a contiguous event page.
84
+ */
85
+ async page(request, signal) {
86
+ const env_1 = { stack: [], error: void 0, hasError: false };
87
+ try {
88
+ validatePageRequest(request);
89
+ const source = __addDisposableResource(env_1, await this.sourceFor(request.address, signal, false), false);
90
+ signal.throwIfAborted();
91
+ const sourceLog = source.events;
92
+ const sourceCursor = sourceLog.at(-1)?.seq ?? -1;
93
+ if (request.throughSeq > sourceCursor) {
94
+ throw new RemoteError('gateway/bad-request', `session page through seq ${String(request.throughSeq)} is past cursor ${String(sourceCursor)}`, {});
95
+ }
96
+ /* v8 ignore next -- Session and persistence validation guarantee a dense zero-based event prefix. */
97
+ if (request.throughSeq >= 0 && sourceLog[request.throughSeq]?.seq !== request.throughSeq) {
98
+ throw new RemoteError('gateway/internal', `session log does not contain through seq ${String(request.throughSeq)}`, {});
99
+ }
100
+ const page = paginate(sourceLog, request.beforeSeq, request.maxMessages ?? DEFAULT_MAX_MESSAGES, request.throughSeq);
101
+ const records = pageRecords(page.events);
102
+ return {
103
+ records,
104
+ hasMore: page.hasMore,
105
+ };
106
+ }
107
+ catch (e_1) {
108
+ env_1.error = e_1;
109
+ env_1.hasError = true;
110
+ }
111
+ finally {
112
+ __disposeResources(env_1);
113
+ }
114
+ }
115
+ /**
116
+ * Follow events appended after an initial cursor on one durable address.
117
+ * @param request - durable address and last committed sequence already held by the caller.
118
+ * @param signal - stream cancellation owned by the Remote carrier.
119
+ * @returns a complete opening snapshot followed by gap-free event frames.
120
+ */
121
+ async *follow(request, signal) {
122
+ validateFollowRequest(request);
123
+ const { address } = request;
124
+ const target = addressId(address);
125
+ const buffered = new Deque();
126
+ let snapshotCursor;
127
+ let wake;
128
+ const notify = () => {
129
+ const resume = wake;
130
+ wake = undefined;
131
+ resume?.();
132
+ };
133
+ const follower = { closed: false };
134
+ const close = () => {
135
+ follower.closed = true;
136
+ notify();
137
+ };
138
+ this.closeFollowers.add(close);
139
+ const disposeEvent = this.ctx.on('session/event', (session, event) => {
140
+ if (session.id !== target)
141
+ return;
142
+ buffered.pushBack(event);
143
+ notify();
144
+ }, { global: true });
145
+ const disposeCreated = this.ctx.on('session/created', (session) => {
146
+ if (session.id !== target)
147
+ return;
148
+ // Constructor seed events have no session/event notification. Normally
149
+ // only the end-seed suffix is new; if persistence advanced after the
150
+ // opening observation, replay everything beyond that snapshot cursor.
151
+ const suffix = session.events.slice(snapshotCursor === undefined
152
+ ? session.firstLiveSeq
153
+ : snapshotCursor + 1);
154
+ for (let index = suffix.length - 1; index >= 0; index -= 1) {
155
+ buffered.pushFront(suffix[index]);
156
+ }
157
+ notify();
158
+ }, { global: true });
159
+ const onAbort = () => { notify(); };
160
+ signal.addEventListener('abort', onAbort, { once: true });
161
+ try {
162
+ const env_2 = { stack: [], error: void 0, hasError: false };
163
+ try {
164
+ const source = __addDisposableResource(env_2, await this.sourceFor(address, signal, true), false);
165
+ const events = source.events;
166
+ signal.throwIfAborted();
167
+ const cursor = source.cursor;
168
+ snapshotCursor = cursor;
169
+ const page = paginate(events, undefined, request.maxMessages ?? DEFAULT_MAX_MESSAGES);
170
+ yield {
171
+ type: 'snapshot',
172
+ header: source.header,
173
+ cursor,
174
+ records: pageRecords(page.events),
175
+ hasMore: page.hasMore,
176
+ projections: source.projections === undefined
177
+ ? { asOfSeq: cursor, values: {} }
178
+ : projectionBlock(source.projections),
179
+ };
180
+ if (address.kind === 'session' && source.source === 'prepared') {
181
+ const promotion = source.retain();
182
+ try {
183
+ this.promote(promotion);
184
+ }
185
+ catch (error) {
186
+ promotion[Symbol.dispose]();
187
+ throw error;
188
+ }
189
+ }
190
+ let nextSeq = cursor + 1;
191
+ while (!follower.closed && !signal.aborted) {
192
+ const item = buffered.popFront();
193
+ if (item === undefined) {
194
+ await new Promise((resolve) => { wake = resolve; });
195
+ continue;
196
+ }
197
+ if (item.seq < nextSeq)
198
+ continue;
199
+ if (item.seq !== nextSeq) {
200
+ throw new RemoteError('gateway/internal', `session event stream skipped seq ${String(nextSeq)}`, {});
201
+ }
202
+ nextSeq++;
203
+ yield entryFor(item);
204
+ }
205
+ }
206
+ catch (e_2) {
207
+ env_2.error = e_2;
208
+ env_2.hasError = true;
209
+ }
210
+ finally {
211
+ __disposeResources(env_2);
212
+ }
213
+ }
214
+ finally {
215
+ this.closeFollowers.delete(close);
216
+ signal.removeEventListener('abort', onAbort);
217
+ disposeCreated();
218
+ disposeEvent();
219
+ }
220
+ }
221
+ async sourceFor(address, signal, withProjections) {
222
+ const sessionId = addressId(address);
223
+ try {
224
+ const observation = await this.ctx.sessionQuery.observeSession(sessionId, {
225
+ signal,
226
+ projectionMode: withProjections || address.kind === 'subagent' ? 'all' : 'none',
227
+ });
228
+ if (observation.header.cwd === undefined) {
229
+ observation[Symbol.dispose]();
230
+ rejectNotFound(address);
231
+ }
232
+ try {
233
+ validateAddress(address, observation.header, observation.projections);
234
+ }
235
+ catch (error) {
236
+ observation[Symbol.dispose]();
237
+ throw error;
238
+ }
239
+ return observation;
240
+ }
241
+ catch (error) {
242
+ if (error instanceof SessionQueryError
243
+ && error.code === 'SESSION_QUERY_SESSION_NOT_FOUND')
244
+ rejectNotFound(address);
245
+ throw error;
246
+ }
247
+ }
248
+ }
249
+ function projectionBlock(snapshot) {
250
+ return {
251
+ asOfSeq: snapshot.asOfSeq,
252
+ // Projection definitions validate whole JSON values before snapshot publication.
253
+ values: snapshot.values,
254
+ };
255
+ }
256
+ function validatePageRequest(request) {
257
+ if (!Number.isSafeInteger(request.throughSeq) || request.throughSeq < -1) {
258
+ throw new RemoteError('gateway/bad-request', 'throughSeq must be an integer greater than or equal to -1', {});
259
+ }
260
+ if (request.beforeSeq !== undefined
261
+ && (!Number.isSafeInteger(request.beforeSeq) || request.beforeSeq < 0)) {
262
+ throw new RemoteError('gateway/bad-request', 'beforeSeq must be a non-negative safe integer', {});
263
+ }
264
+ if (request.maxMessages !== undefined
265
+ && (!Number.isSafeInteger(request.maxMessages) || request.maxMessages <= 0)) {
266
+ throw new RemoteError('gateway/bad-request', 'maxMessages must be a positive safe integer', {});
267
+ }
268
+ }
269
+ function validateFollowRequest(request) {
270
+ if (request.maxMessages !== undefined
271
+ && (!Number.isSafeInteger(request.maxMessages) || request.maxMessages <= 0)) {
272
+ throw new RemoteError('gateway/bad-request', 'maxMessages must be a positive safe integer', {});
273
+ }
274
+ }
275
+ function addressId(address) {
276
+ return address.kind === 'session' ? address.sessionId : address.childSessionId;
277
+ }
278
+ function validateAddress(address, header, projections) {
279
+ if (address.kind === 'session') {
280
+ if (header.origin === 'subagent') {
281
+ throw new RemoteError('session/agent-busy', 'subagent Sessions require their durable parent address', {
282
+ reason: 'use subagent delivery for this child session',
283
+ });
284
+ }
285
+ return;
286
+ }
287
+ if (header.origin !== 'subagent' || header.parentSession !== address.parentSessionId) {
288
+ throw new RemoteError('subagent/unauthorized', 'subagent does not belong to the supplied parent', {
289
+ childSessionId: address.childSessionId,
290
+ });
291
+ }
292
+ const identity = projections?.values.subagent;
293
+ if (identity === null) {
294
+ throw new RemoteError('subagent/catalog-diagnostic', 'subagent descriptor is corrupt', {
295
+ parentSessionId: address.parentSessionId,
296
+ childSessionId: address.childSessionId,
297
+ reason: 'corrupt',
298
+ });
299
+ }
300
+ if (identity === undefined || identity.seq < (header.seedLength ?? 0)) {
301
+ throw new RemoteError('subagent/catalog-diagnostic', 'subagent descriptor is unavailable', {
302
+ parentSessionId: address.parentSessionId,
303
+ childSessionId: address.childSessionId,
304
+ reason: 'unsupported',
305
+ });
306
+ }
307
+ if (identity.mode !== address.mode) {
308
+ throw new RemoteError('subagent/unauthorized', 'subagent mode does not match the supplied address', {
309
+ childSessionId: address.childSessionId,
310
+ });
311
+ }
312
+ }
313
+ function rejectNotFound(address) {
314
+ if (address.kind === 'session') {
315
+ throw new RemoteError('session/not-found', `session "${address.sessionId}" not found`, { sessionId: address.sessionId });
316
+ }
317
+ throw new RemoteError('subagent/not-found', 'subagent is unavailable', {
318
+ parentSessionId: address.parentSessionId,
319
+ childSessionId: address.childSessionId,
320
+ });
321
+ }
322
+ function paginate(events, beforeSeq, maxMessages, throughSeq = events.at(-1)?.seq ?? -1) {
323
+ const end = Math.min(throughSeq + 1, beforeSeq ?? throughSeq + 1);
324
+ let count = 0;
325
+ let cut = 0;
326
+ for (let index = end - 1; index >= 0; index--) {
327
+ const event = events[index];
328
+ if (!MESSAGE_TYPES.has(event.type) || !isAppendSurfaceEvent(event))
329
+ continue;
330
+ count++;
331
+ const sources = event.sourceEventSeqs;
332
+ let groupStart = event.seq;
333
+ if (sources !== undefined) {
334
+ for (const source of sources)
335
+ groupStart = Math.min(groupStart, source);
336
+ }
337
+ if (count >= maxMessages) {
338
+ cut = groupStart;
339
+ break;
340
+ }
341
+ }
342
+ return { events: events.slice(cut, end), hasMore: cut > 0 };
343
+ }
344
+ function entryFor(event) {
345
+ return {
346
+ type: 'event',
347
+ // Session.append validates and freezes event data as JSON before publication.
348
+ event: event,
349
+ };
350
+ }
351
+ function chunkEntryFor(row) {
352
+ switch (row.type) {
353
+ case 'text-chunks':
354
+ return {
355
+ type: 'chunks',
356
+ event: { type: 'chunkrow/text-chunks', seq: row.seq0, time: row.time0, data: row.data },
357
+ };
358
+ case 'reasoning-chunks':
359
+ return {
360
+ type: 'chunks',
361
+ event: { type: 'chunkrow/reasoning-chunks', seq: row.seq0, time: row.time0, data: row.data },
362
+ };
363
+ case 'tool-call-chunks':
364
+ return {
365
+ type: 'chunks',
366
+ event: { type: 'chunkrow/tool-call-chunks', seq: row.seq0, time: row.time0, data: row.data },
367
+ };
368
+ }
369
+ }
370
+ /** Encode one bounded logical page without changing its pagination cut. */
371
+ function pageRecords(events) {
372
+ return packChunkRuns(events).map(record => isChunkRow(record)
373
+ ? chunkEntryFor(record)
374
+ : entryFor(record));
375
+ }
376
+ //# sourceMappingURL=history.js.map
@@ -0,0 +1,171 @@
1
+ /** Session Remote owner: cold reads, explicit Agent commands, and live control state. */
2
+ import { Context } from '@deepseek-ai/cordis';
3
+ import z from '@deepseek-ai/schemastery';
4
+ import type { SessionEvent, SessionHeader, SessionId } from '@deepseek-ai/dsh-session';
5
+ import { TypertRemoteService } from '@deepseek-ai/dsh-typert-protocol';
6
+ import { type ApiSessionAgentResult } from './agent.ts';
7
+ import { buildModelCatalog } from './catalog.ts';
8
+ import type { ModelCatalog, SessionAttachmentRequest, SessionAttachmentValue, SessionCancelRequest, SessionCancelValue, SessionControlFrame, SessionCreateRequest, SessionCreateValue, SessionFollowFrame, SessionFollowRequest, SessionForkRequest, SessionForkValue, SessionListRequest, SessionListValue, SessionOpenWorkspacePathRequest, SessionOpenWorkspacePathValue, SessionPage, SessionPageRequest, SessionPromptRequest, SessionPromptValue, SessionRenameRequest, SessionRenameValue, SessionSearchRequest, SessionSearchValue, SessionSelectModelRequest, SessionSelectModelValue, SessionUpdateQueueRequest, SessionUpdateQueueValue } from './types.ts';
9
+ export type * from './types.ts';
10
+ export { ApiSessionNotFound } from './agent.ts';
11
+ export { SessionFileReferences } from './file-references.ts';
12
+ export { SessionSkillCatalog } from './skill-catalog.ts';
13
+ declare module '@deepseek-ai/cordis' {
14
+ interface Context {
15
+ /** Host Session business API and Remote namespace owner. */
16
+ sessionController: SessionController;
17
+ }
18
+ }
19
+ /** Session Controller deployment policy. */
20
+ export interface Config {
21
+ /** Maximum cold Session artifact size eligible for one full projection observation. */
22
+ readonly coldBlankProbeMaxBytes?: number;
23
+ /** Override platform desktop-opener detection. */
24
+ readonly nativeOpen?: boolean;
25
+ }
26
+ /** Host integrations replaceable by direct unit tests. */
27
+ export interface SessionControllerInternals {
28
+ /** Native default-application handoff. */
29
+ readonly openPath?: (path: string, signal: AbortSignal) => Promise<void>;
30
+ /** Native handoff availability probe. */
31
+ readonly canOpenPath?: () => boolean;
32
+ }
33
+ /** Host service backing the generated `ctx.remote.session` namespace. */
34
+ export declare class SessionController extends TypertRemoteService {
35
+ static inject: string[];
36
+ static Config: z<Config>;
37
+ private readonly agents;
38
+ private readonly commands;
39
+ private readonly controlState;
40
+ private readonly history;
41
+ private readonly listState;
42
+ private readonly openPath;
43
+ private readonly canOpenPath;
44
+ private readonly promotions;
45
+ /**
46
+ * @param ctx - Host context containing the Session capability assembly.
47
+ * @param config - cold-list observation policy.
48
+ */
49
+ constructor(ctx: Context, config: Config, internals?: SessionControllerInternals);
50
+ private promote;
51
+ /**
52
+ * Resolve or resume one ordinary Session for another Host API domain.
53
+ * @param sessionId - Session identity whose Agent owns the operation.
54
+ * @returns the live Agent or the stable Session-domain failure.
55
+ */
56
+ resolveAgent(sessionId: SessionId): Promise<ApiSessionAgentResult>;
57
+ /**
58
+ * Inspect one attached or persisted Session without activating its Agent.
59
+ * @param sessionId - durable Session identity.
60
+ * @param signal - optional caller cancellation for persistence reads.
61
+ * @returns the current attached state or persisted header and event prefix.
62
+ */
63
+ inspect(sessionId: SessionId, signal?: AbortSignal): Promise<{
64
+ meta: SessionHeader;
65
+ events: SessionEvent[];
66
+ }>;
67
+ /**
68
+ * Read all visible Session rows without resuming an Agent.
69
+ * @param _request - reserved empty list request.
70
+ * @param signal - cancellation for persistence reads.
71
+ * @returns visible Session summaries ordered by activity.
72
+ */
73
+ list(_request: SessionListRequest, signal: AbortSignal): Promise<SessionListValue>;
74
+ /**
75
+ * Search visible Session content without resuming an Agent.
76
+ * @param request - literal message-content query.
77
+ * @param signal - cancellation for list and search reads.
78
+ * @returns authorized bounded Session search results.
79
+ */
80
+ search(request: SessionSearchRequest, signal: AbortSignal): Promise<SessionSearchValue>;
81
+ /**
82
+ * Create or idempotently adopt one ordinary Session.
83
+ * @param request - requested identity, location, and Agent preset.
84
+ * @returns the Session identity and resolved preset when configured.
85
+ */
86
+ create(request: SessionCreateRequest): Promise<SessionCreateValue>;
87
+ /**
88
+ * Select one Session-local model after explicitly resuming the Session.
89
+ * @param request - Session identity and requested model selection.
90
+ * @returns the normalized selection installed for the Session.
91
+ */
92
+ selectModel(request: SessionSelectModelRequest): Promise<SessionSelectModelValue>;
93
+ /**
94
+ * Describe every currently routable model for Host-generation selectors.
95
+ * @returns provider-grouped models, the deployment default, and isolated provider failures.
96
+ */
97
+ modelCatalog(): Promise<ModelCatalog>;
98
+ /**
99
+ * Report whether this deployment can hand a Session workspace path to a native desktop.
100
+ * @returns true when the matching open operation is available.
101
+ */
102
+ canOpenWorkspacePath(): boolean;
103
+ /**
104
+ * Open one path prepared by a Session-aware caller on the Host desktop.
105
+ * @param request - path after best-effort Session workspace resolution.
106
+ * @param signal - caller lifetime; abort terminates the native command.
107
+ * @returns confirmation after the native opener accepts the path.
108
+ * @throws RemoteError when the request is invalid, cancelled, or the opener fails.
109
+ */
110
+ openWorkspacePath(request: SessionOpenWorkspacePathRequest, signal: AbortSignal): Promise<SessionOpenWorkspacePathValue>;
111
+ /**
112
+ * Rename one Session after explicitly resuming it.
113
+ * @param request - Session identity and proposed title.
114
+ * @returns the accepted title and durable event sequence.
115
+ */
116
+ rename(request: SessionRenameRequest): Promise<SessionRenameValue>;
117
+ /**
118
+ * Fork one cold-readable completed-turn prefix into a new Session.
119
+ * @param request - source Session and optional event anchor.
120
+ * @returns the new Session identity.
121
+ */
122
+ fork(request: SessionForkRequest): Promise<SessionForkValue>;
123
+ /**
124
+ * Admit one prompt after explicitly resuming its Session.
125
+ * @param request - Session identity, prompt content, source metadata, and delivery mode.
126
+ * @param signal - caller cancellation before prompt admission begins.
127
+ * @returns acknowledgement that the Agent accepted the prompt.
128
+ */
129
+ prompt(request: SessionPromptRequest, signal: AbortSignal): Promise<SessionPromptValue>;
130
+ /**
131
+ * Read one image proven reachable from the addressed Session log.
132
+ * @param request - Session and attachment identities used for authorization.
133
+ * @returns the durable attachment reference and base64-encoded bytes.
134
+ */
135
+ attachment(request: SessionAttachmentRequest): Promise<SessionAttachmentValue>;
136
+ /**
137
+ * Mutate one still-pending queue occurrence on a live Agent.
138
+ * @param request - Session, queue item, and requested mutation.
139
+ * @returns acknowledgement that the queue mutation was applied.
140
+ */
141
+ updateQueue(request: SessionUpdateQueueRequest): SessionUpdateQueueValue;
142
+ /**
143
+ * Cancel one active Agent turn without dropping its pending inbox.
144
+ * @param request - Session whose active Agent turn is cancelled.
145
+ * @returns acknowledgement that cancellation was requested.
146
+ */
147
+ cancel(request: SessionCancelRequest): SessionCancelValue;
148
+ /**
149
+ * Read one cold-safe, message-aligned Session history page.
150
+ * @param request - durable address, backward cursor, and page budget.
151
+ * @param signal - cancellation for persistence reads.
152
+ * @returns one chronological page.
153
+ */
154
+ page(request: SessionPageRequest, signal: AbortSignal): Promise<SessionPage>;
155
+ /**
156
+ * Follow one Session log from its opening or resume cursor.
157
+ * @param request - durable address and last committed sequence already held by the caller.
158
+ * @param signal - cancellation owned by the Remote stream carrier.
159
+ * @returns a complete opening snapshot followed by gap-free event frames.
160
+ */
161
+ follow(request: SessionFollowRequest, signal: AbortSignal): AsyncIterable<SessionFollowFrame>;
162
+ /**
163
+ * Stream a complete live-control baseline followed by replacement frames.
164
+ * @param signal - cancellation owned by the Remote stream carrier.
165
+ * @returns one complete baseline followed by live replacement frames.
166
+ */
167
+ control(signal: AbortSignal): AsyncIterable<SessionControlFrame>;
168
+ }
169
+ export { buildModelCatalog };
170
+ export default SessionController;
171
+ //# sourceMappingURL=index.d.ts.map