@unieai/rabi-api-session-controller 0.0.0-stage → 0.2.2-rc.5

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 (137) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +7 -2
  3. package/lib/client.js +4 -0
  4. package/lib/index.js +4300 -0
  5. package/lib/typert.host.d.ts +3 -0
  6. package/lib/typert.host.js +5013 -0
  7. package/lib/typert.remote-client.d.ts +115 -0
  8. package/lib/typert.remote-client.js +2714 -0
  9. package/lib/types/agent.d.ts +164 -0
  10. package/lib/types/agent.js +484 -0
  11. package/lib/types/archived-session-gate.d.ts +33 -0
  12. package/lib/types/archived-session-gate.js +54 -0
  13. package/lib/types/assistant-stream.d.ts +26 -0
  14. package/lib/types/assistant-stream.js +82 -0
  15. package/lib/types/catalog.d.ts +24 -0
  16. package/lib/types/catalog.js +107 -0
  17. package/lib/types/client/contract/events.d.ts +102 -0
  18. package/lib/types/client/contract/events.js +111 -0
  19. package/lib/types/client/contract/session.d.ts +178 -0
  20. package/lib/types/client/contract/session.js +1 -0
  21. package/lib/types/client/contract/sessions.d.ts +162 -0
  22. package/lib/types/client/contract/sessions.js +1 -0
  23. package/lib/types/client/contract/snapshot.d.ts +84 -0
  24. package/lib/types/client/contract/snapshot.js +1 -0
  25. package/lib/types/client/index.d.ts +39 -0
  26. package/lib/types/client/index.js +60 -0
  27. package/lib/types/client/ordered-baseline.d.ts +12 -0
  28. package/lib/types/client/ordered-baseline.js +40 -0
  29. package/lib/types/client/scope.d.ts +46 -0
  30. package/lib/types/client/scope.js +46 -0
  31. package/lib/types/client/session-wire-event.d.ts +11 -0
  32. package/lib/types/client/session-wire-event.js +42 -0
  33. package/lib/types/client/sessions/assistant-stream.d.ts +56 -0
  34. package/lib/types/client/sessions/assistant-stream.js +182 -0
  35. package/lib/types/client/sessions/history-records.d.ts +22 -0
  36. package/lib/types/client/sessions/history-records.js +25 -0
  37. package/lib/types/client/sessions/lineage.d.ts +48 -0
  38. package/lib/types/client/sessions/lineage.js +55 -0
  39. package/lib/types/client/sessions/manager.d.ts +272 -0
  40. package/lib/types/client/sessions/manager.js +774 -0
  41. package/lib/types/client/sessions/notifier.d.ts +39 -0
  42. package/lib/types/client/sessions/notifier.js +97 -0
  43. package/lib/types/client/sessions/projection-store.d.ts +128 -0
  44. package/lib/types/client/sessions/projection-store.js +161 -0
  45. package/lib/types/client/sessions/remotes.d.ts +29 -0
  46. package/lib/types/client/sessions/remotes.js +7 -0
  47. package/lib/types/client/sessions/service.d.ts +263 -0
  48. package/lib/types/client/sessions/service.js +597 -0
  49. package/lib/types/client/sessions/session.d.ts +303 -0
  50. package/lib/types/client/sessions/session.js +991 -0
  51. package/lib/types/client/time-zone.d.ts +8 -0
  52. package/lib/types/client/time-zone.js +13 -0
  53. package/lib/types/client/transport.d.ts +77 -0
  54. package/lib/types/client/transport.js +130 -0
  55. package/lib/types/commands.d.ts +92 -0
  56. package/lib/types/commands.js +575 -0
  57. package/lib/types/continuation.d.ts +35 -0
  58. package/lib/types/continuation.js +47 -0
  59. package/lib/types/control.d.ts +20 -0
  60. package/lib/types/control.js +106 -0
  61. package/lib/types/file-references.d.ts +27 -0
  62. package/lib/types/file-references.js +68 -0
  63. package/lib/types/history/assistant-stream.d.ts +43 -0
  64. package/lib/types/history/assistant-stream.js +79 -0
  65. package/lib/types/history/controller.d.ts +104 -0
  66. package/lib/types/history/controller.js +293 -0
  67. package/lib/types/history/listener.d.ts +105 -0
  68. package/lib/types/history/listener.js +296 -0
  69. package/lib/types/history.d.ts +58 -0
  70. package/lib/types/history.js +152 -0
  71. package/lib/types/index.d.ts +262 -0
  72. package/lib/types/index.js +693 -0
  73. package/lib/types/list.d.ts +62 -0
  74. package/lib/types/list.js +343 -0
  75. package/lib/types/media-references.d.ts +18 -0
  76. package/lib/types/media-references.js +84 -0
  77. package/lib/types/remote-events.d.ts +8 -0
  78. package/lib/types/remote-events.js +1 -0
  79. package/lib/types/skill-catalog.d.ts +28 -0
  80. package/lib/types/skill-catalog.js +203 -0
  81. package/lib/types/state/controller.d.ts +45 -0
  82. package/lib/types/state/controller.js +288 -0
  83. package/lib/types/state/listener.d.ts +40 -0
  84. package/lib/types/state/listener.js +111 -0
  85. package/lib/types/types.d.ts +687 -0
  86. package/lib/types/types.js +5 -0
  87. package/lib/types/web/controller.d.ts +25 -0
  88. package/lib/types/web/controller.js +138 -0
  89. package/locale/de.json +6 -0
  90. package/locale/en.json +5 -0
  91. package/locale/es.json +6 -0
  92. package/locale/fr.json +6 -0
  93. package/locale/ja.json +6 -0
  94. package/locale/pt.json +6 -0
  95. package/locale/ru.json +6 -0
  96. package/locale/zh.json +6 -0
  97. package/package.json +119 -4
  98. package/src/agent.ts +474 -0
  99. package/src/archived-session-gate.ts +59 -0
  100. package/src/assistant-stream.ts +102 -0
  101. package/src/catalog.ts +117 -0
  102. package/src/client/contract/events.ts +205 -0
  103. package/src/client/contract/session.ts +174 -0
  104. package/src/client/contract/sessions.ts +169 -0
  105. package/src/client/contract/snapshot.ts +94 -0
  106. package/src/client/index.ts +149 -0
  107. package/src/client/ordered-baseline.ts +43 -0
  108. package/src/client/scope.ts +76 -0
  109. package/src/client/session-wire-event.ts +46 -0
  110. package/src/client/sessions/assistant-stream.ts +229 -0
  111. package/src/client/sessions/history-records.ts +35 -0
  112. package/src/client/sessions/lineage.ts +96 -0
  113. package/src/client/sessions/manager.ts +857 -0
  114. package/src/client/sessions/notifier.ts +97 -0
  115. package/src/client/sessions/projection-store.ts +244 -0
  116. package/src/client/sessions/remotes.ts +44 -0
  117. package/src/client/sessions/service.ts +741 -0
  118. package/src/client/sessions/session.ts +1055 -0
  119. package/src/client/time-zone.ts +14 -0
  120. package/src/client/transport.ts +247 -0
  121. package/src/commands.ts +602 -0
  122. package/src/continuation.ts +58 -0
  123. package/src/control.ts +121 -0
  124. package/src/file-references.ts +42 -0
  125. package/src/history/assistant-stream.ts +102 -0
  126. package/src/history/controller.ts +256 -0
  127. package/src/history/listener.ts +302 -0
  128. package/src/history.ts +189 -0
  129. package/src/index.ts +651 -0
  130. package/src/list.ts +382 -0
  131. package/src/media-references.ts +84 -0
  132. package/src/remote-events.ts +14 -0
  133. package/src/skill-catalog.ts +108 -0
  134. package/src/state/controller.ts +221 -0
  135. package/src/state/listener.ts +116 -0
  136. package/src/types.ts +720 -0
  137. package/src/web/controller.ts +78 -0
@@ -0,0 +1,58 @@
1
+ /** Shared Session history pagination, address validation and wire conversion. */
2
+ import type { SessionEvent, SessionHeader, SessionId, SessionLogOffset as SessionLogOffsetType, SessionSeqCursor } from '@unieai/rabi-session';
3
+ import type { SessionObservation } from '@unieai/rabi-session-query';
4
+ import type { SessionAddress, SessionEventEntry, SessionHistoryRecord, SessionPageRequest } from './types.ts';
5
+ /** Message budget applied when a history request omits `maxMessages`. */
6
+ export declare const DEFAULT_MAX_MESSAGES = 50;
7
+ /**
8
+ * Reject an invalid message budget or turn window.
9
+ * @param request - history window fields.
10
+ */
11
+ export declare function validateHistoryWindow(request: Pick<SessionPageRequest, 'maxMessages' | 'turnWindow'>): void;
12
+ /**
13
+ * Select the Session whose log an address names.
14
+ * @param address - ordinary Session or direct-subagent address.
15
+ * @returns the Session whose log the address reads.
16
+ */
17
+ export declare function addressId(address: SessionAddress): SessionId;
18
+ /**
19
+ * Reject an address that does not match the observed Session.
20
+ * @param address - ordinary Session or direct-subagent address.
21
+ * @param header - observed Session header.
22
+ * @param inheritedEventCount - observed fork-inherited event count.
23
+ * @param projections - observed projections; subagent addresses require them.
24
+ */
25
+ export declare function validateAddress(address: SessionAddress, header: SessionHeader, inheritedEventCount: SessionLogOffsetType, projections: SessionObservation['projections']): void;
26
+ /**
27
+ * Reject a missing Session using its address-specific error.
28
+ * @param address - ordinary Session or direct-subagent address.
29
+ * @returns never; this operation always throws.
30
+ * @throws RemoteError `session/not-found` or `subagent/not-found`.
31
+ */
32
+ export declare function rejectNotFound(address: SessionAddress): never;
33
+ /**
34
+ * Cut one message-aligned backwards page from a contiguous event prefix.
35
+ * @param events - contiguous events starting at seq 0.
36
+ * @param beforeSeq - exclusive upper offset of an older page.
37
+ * @param maxMessages - message budget.
38
+ * @param throughSeq - inclusive log cut.
39
+ * @param turnWindow - optional turn-boundary stop rule.
40
+ * @returns the page events and whether older events remain.
41
+ */
42
+ export declare function paginate(events: readonly SessionEvent[], beforeSeq: SessionLogOffsetType | undefined, maxMessages: number, throughSeq: SessionSeqCursor, turnWindow?: SessionPageRequest['turnWindow']): {
43
+ readonly events: SessionEvent[];
44
+ readonly hasMore: boolean;
45
+ };
46
+ /**
47
+ * Convert a committed event to its wire entry.
48
+ * @param event - committed Session event.
49
+ * @returns the wire event entry.
50
+ */
51
+ export declare function entryFor(event: SessionEvent): SessionEventEntry;
52
+ /**
53
+ * Encode one bounded logical page without changing its pagination cut.
54
+ * @param events - page events.
55
+ * @returns the wire records.
56
+ */
57
+ export declare function pageRecords(events: readonly SessionEvent[]): SessionHistoryRecord[];
58
+ //# sourceMappingURL=history.d.ts.map
@@ -0,0 +1,152 @@
1
+ /** Shared Session history pagination, address validation and wire conversion. */
2
+ import { isAppendSurfaceEvent, SessionLogOffset, } from '@unieai/rabi-session';
3
+ import { RemoteError } from '@unieai/rabi-typert-protocol';
4
+ /** Message budget applied when a history request omits `maxMessages`. */
5
+ export const DEFAULT_MAX_MESSAGES = 50;
6
+ const MESSAGE_TYPES = new Set(['user/message', 'assistant/message']);
7
+ /**
8
+ * Reject an invalid message budget or turn window.
9
+ * @param request - history window fields.
10
+ */
11
+ export function validateHistoryWindow(request) {
12
+ if (request.maxMessages !== undefined
13
+ && (!Number.isSafeInteger(request.maxMessages) || request.maxMessages <= 0)) {
14
+ throw new RemoteError('gateway/bad-request', 'maxMessages must be a positive safe integer', {});
15
+ }
16
+ const window = request.turnWindow;
17
+ if (window !== undefined) {
18
+ if (!Number.isSafeInteger(window.minMessages) || window.minMessages <= 0
19
+ || window.minMessages > (request.maxMessages ?? DEFAULT_MAX_MESSAGES)) {
20
+ throw new RemoteError('gateway/bad-request', 'turnWindow.minMessages must be a positive safe integer no greater than maxMessages', {});
21
+ }
22
+ if (!Number.isSafeInteger(window.minTurns) || window.minTurns <= 0) {
23
+ throw new RemoteError('gateway/bad-request', 'turnWindow.minTurns must be a positive safe integer', {});
24
+ }
25
+ }
26
+ }
27
+ /**
28
+ * Select the Session whose log an address names.
29
+ * @param address - ordinary Session or direct-subagent address.
30
+ * @returns the Session whose log the address reads.
31
+ */
32
+ export function addressId(address) {
33
+ return address.kind === 'session' ? address.sessionId : address.childSessionId;
34
+ }
35
+ /**
36
+ * Reject an address that does not match the observed Session.
37
+ * @param address - ordinary Session or direct-subagent address.
38
+ * @param header - observed Session header.
39
+ * @param inheritedEventCount - observed fork-inherited event count.
40
+ * @param projections - observed projections; subagent addresses require them.
41
+ */
42
+ export function validateAddress(address, header, inheritedEventCount, projections) {
43
+ if (address.kind === 'session') {
44
+ if (header.origin === 'subagent') {
45
+ throw new RemoteError('session/agent-busy', 'subagent Sessions require their durable parent address', {
46
+ reason: 'use subagent delivery for this child session',
47
+ });
48
+ }
49
+ return;
50
+ }
51
+ if (header.origin !== 'subagent' || header.parentSession !== address.parentSessionId) {
52
+ throw new RemoteError('subagent/unauthorized', 'subagent does not belong to the supplied parent', {
53
+ childSessionId: address.childSessionId,
54
+ });
55
+ }
56
+ const identity = projections?.values.subagent;
57
+ if (identity === null) {
58
+ throw new RemoteError('subagent/catalog-diagnostic', 'subagent descriptor is corrupt', {
59
+ parentSessionId: address.parentSessionId,
60
+ childSessionId: address.childSessionId,
61
+ reason: 'corrupt',
62
+ });
63
+ }
64
+ if (identity === undefined || identity.seq < inheritedEventCount) {
65
+ throw new RemoteError('subagent/catalog-diagnostic', 'subagent descriptor is unavailable', {
66
+ parentSessionId: address.parentSessionId,
67
+ childSessionId: address.childSessionId,
68
+ reason: 'unsupported',
69
+ });
70
+ }
71
+ if (address.mode !== 'unknown' && identity.mode !== address.mode) {
72
+ throw new RemoteError('subagent/unauthorized', 'subagent mode does not match the supplied address', {
73
+ childSessionId: address.childSessionId,
74
+ });
75
+ }
76
+ }
77
+ /**
78
+ * Reject a missing Session using its address-specific error.
79
+ * @param address - ordinary Session or direct-subagent address.
80
+ * @returns never; this operation always throws.
81
+ * @throws RemoteError `session/not-found` or `subagent/not-found`.
82
+ */
83
+ export function rejectNotFound(address) {
84
+ if (address.kind === 'session') {
85
+ throw new RemoteError('session/not-found', `session "${address.sessionId}" not found`, { sessionId: address.sessionId });
86
+ }
87
+ throw new RemoteError('subagent/not-found', 'subagent is unavailable', {
88
+ parentSessionId: address.parentSessionId,
89
+ childSessionId: address.childSessionId,
90
+ });
91
+ }
92
+ /**
93
+ * Cut one message-aligned backwards page from a contiguous event prefix.
94
+ * @param events - contiguous events starting at seq 0.
95
+ * @param beforeSeq - exclusive upper offset of an older page.
96
+ * @param maxMessages - message budget.
97
+ * @param throughSeq - inclusive log cut.
98
+ * @param turnWindow - optional turn-boundary stop rule.
99
+ * @returns the page events and whether older events remain.
100
+ */
101
+ export function paginate(events, beforeSeq, maxMessages, throughSeq, turnWindow) {
102
+ const end = SessionLogOffset(Math.min(throughSeq + 1, beforeSeq ?? throughSeq + 1));
103
+ let count = 0;
104
+ let turns = 0;
105
+ let cut = SessionLogOffset(0);
106
+ for (let index = end - 1; index >= 0; index--) {
107
+ const event = events[index];
108
+ if (turnWindow !== undefined && event.type === 'turn/start') {
109
+ turns++;
110
+ if (count >= turnWindow.minMessages && turns >= turnWindow.minTurns) {
111
+ cut = SessionLogOffset(index);
112
+ break;
113
+ }
114
+ }
115
+ if (!MESSAGE_TYPES.has(event.type) || !isAppendSurfaceEvent(event))
116
+ continue;
117
+ count++;
118
+ const sources = event.sourceEventSeqs;
119
+ let groupStart = event.seq;
120
+ if (sources !== undefined) {
121
+ for (const source of sources) {
122
+ if (source < groupStart)
123
+ groupStart = source;
124
+ }
125
+ }
126
+ if (count >= maxMessages) {
127
+ cut = SessionLogOffset(groupStart);
128
+ break;
129
+ }
130
+ }
131
+ return { events: events.slice(cut, end), hasMore: cut > 0 };
132
+ }
133
+ /**
134
+ * Convert a committed event to its wire entry.
135
+ * @param event - committed Session event.
136
+ * @returns the wire event entry.
137
+ */
138
+ export function entryFor(event) {
139
+ return {
140
+ type: 'event',
141
+ // Session.append validates and freezes event data as JSON before publication.
142
+ event: event,
143
+ };
144
+ }
145
+ /**
146
+ * Encode one bounded logical page without changing its pagination cut.
147
+ * @param events - page events.
148
+ * @returns the wire records.
149
+ */
150
+ export function pageRecords(events) {
151
+ return events.map(entryFor);
152
+ }
@@ -0,0 +1,262 @@
1
+ /** Session Remote owner: cold reads, explicit Agent commands, and live control state. */
2
+ import { Context, Service } from '@unieai/cordis';
3
+ import z from '@unieai/schemastery';
4
+ import { nativeFileApplications, openNativeFileApplication } from '@unieai/rabi-native-command';
5
+ import type { SessionId } from '@unieai/rabi-session';
6
+ import { TypertRemoteService } from '@unieai/rabi-typert-protocol';
7
+ import { type ApiSessionAgentResult } from './agent.ts';
8
+ import type { ModelCatalog, SessionWorkspacePathApplication, SessionAttachmentRequest, SessionAttachmentValue, SessionCancelRequest, SessionCancelValue, SessionControlFrame, SessionCreateRequest, SessionCreateValue, SessionFollowFrame, SessionFollowRequest, SessionForkRequest, SessionForkValue, SessionListRequest, SessionListValue, SessionOpenWorkspacePathRequest, SessionOpenWorkspacePathValue, SessionEventsPage, SessionPageRequest, SessionEventFrame, SessionObserveEventRequest, SessionProjectionFrame, SessionStateRequest, SessionState, SessionWaitRequest, SessionWaitValue, SessionPromptRequest, SessionPromptValue, SessionRenameRequest, SessionRenameValue, SessionSearchRequest, SessionSearchValue, SessionSelectModelRequest, SessionSelectModelValue, SessionProjectionsRequest, SessionProjectionsValue, 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 '@unieai/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
+ /** Override platform desktop-opener detection. */
22
+ readonly nativeOpen?: boolean;
23
+ /** Positive integral milliseconds of list work before yielding between complete rows. */
24
+ readonly listWorkSliceMs?: number;
25
+ }
26
+ /** Deployment policy after schema defaults have been applied. */
27
+ type ResolvedConfig = Config & {
28
+ readonly listWorkSliceMs: number;
29
+ };
30
+ /** Host integrations replaceable by direct unit tests. */
31
+ export interface SessionControllerInternals {
32
+ /** Native default-application handoff. */
33
+ readonly openPath?: (path: string, signal: AbortSignal) => Promise<void>;
34
+ /** Native file-association query. */
35
+ readonly fileApplications?: typeof nativeFileApplications;
36
+ /** Explicit registered-application handoff. */
37
+ readonly openFileApplication?: typeof openNativeFileApplication;
38
+ /** Native file-manager handoff. */
39
+ readonly revealPath?: (path: string, signal: AbortSignal) => Promise<void>;
40
+ /** Native handoff availability probe. */
41
+ readonly canOpenPath?: () => boolean;
42
+ }
43
+ /** Host service backing the generated `ctx.remote.session` namespace. */
44
+ export declare class SessionController extends TypertRemoteService {
45
+ static inject: string[];
46
+ static Config: z<Config, ResolvedConfig>;
47
+ private historyController;
48
+ private stateController;
49
+ private webController;
50
+ private agents;
51
+ private commands;
52
+ private controlState;
53
+ private listState;
54
+ private readonly openPath;
55
+ private readonly fileApplications;
56
+ private readonly openFileApplication;
57
+ private readonly revealPath;
58
+ private readonly canOpenPath;
59
+ private readonly listWorkSliceMs;
60
+ private readonly promotions;
61
+ /**
62
+ * @param ctx - Host context containing the Session capability assembly.
63
+ * @param config - native-opener and list-scheduling deployment policy.
64
+ * @param internals - host integrations replaceable by direct unit tests.
65
+ */
66
+ constructor(ctx: Context, config: Config, internals?: SessionControllerInternals);
67
+ protected [Service.init](): Promise<void>;
68
+ /**
69
+ * Request background activation through the existing Session Agent controller.
70
+ * @param observation - owned lease disposed by the background task; callers retain their own lease separately.
71
+ */
72
+ private promote;
73
+ /**
74
+ * Resolve or resume one ordinary Session for another Host API domain.
75
+ * @param sessionId - Session identity whose Agent owns the operation.
76
+ * @returns the live Agent or the stable Session-domain failure.
77
+ */
78
+ resolveAgent(sessionId: SessionId): Promise<ApiSessionAgentResult>;
79
+ /**
80
+ * Read all visible Session rows without resuming an Agent.
81
+ * @param _request - reserved empty list request.
82
+ * @param signal - cancellation for persistence reads and summary generation.
83
+ * @returns visible Session summaries ordered by activity.
84
+ */
85
+ list(_request: SessionListRequest, signal: AbortSignal): Promise<SessionListValue>;
86
+ /**
87
+ * Search visible Session content without resuming an Agent. A non-owner
88
+ * receives only the hits whose Session `allows()` admits; `hasMore`
89
+ * describes the bounded result before that filtering.
90
+ * @param request - literal message-content query.
91
+ * @param signal - cancellation for list and search reads.
92
+ * @returns authorized bounded Session search results.
93
+ */
94
+ search(request: SessionSearchRequest, signal: AbortSignal): Promise<SessionSearchValue>;
95
+ /**
96
+ * Create one ordinary Session for a new conversation, reusing the named blank Session while it is reusable.
97
+ * @param request - optional blank Session to reuse, location, and Agent preset.
98
+ * @returns the created or reused Session identity and its preset when configured.
99
+ */
100
+ create(request: SessionCreateRequest): Promise<SessionCreateValue>;
101
+ /**
102
+ * Select one Session-local model after explicitly resuming the Session; save the default in the background.
103
+ * @param request - Session identity and requested model selection.
104
+ * @returns the normalized selection installed for the Session, without waiting for default persistence.
105
+ */
106
+ selectModel(request: SessionSelectModelRequest): Promise<SessionSelectModelValue>;
107
+ /**
108
+ * Select the first available account model after login when no provider API key is configured.
109
+ * @returns after saving the first available model or retaining the existing default.
110
+ */
111
+ initializeDefaultModel(): Promise<void>;
112
+ /**
113
+ * Describe every currently routable model for Host-generation selectors.
114
+ * @returns provider-grouped models, the deployment default, and isolated provider failures.
115
+ */
116
+ modelCatalog(): Promise<ModelCatalog>;
117
+ /**
118
+ * Report whether this deployment can hand a Session workspace path to a native desktop.
119
+ * @returns true when the matching open operation is available.
120
+ */
121
+ canOpenWorkspacePath(): boolean;
122
+ /**
123
+ * Describe the serving desktop for authenticated file-action routes.
124
+ * @returns Host name, configured availability, and platform-specific file-manager behavior.
125
+ */
126
+ workspaceDesktop(): {
127
+ name: string;
128
+ available: boolean;
129
+ fileManager: 'finder' | 'explorer' | 'directory' | null;
130
+ };
131
+ /**
132
+ * Verify one path through the composed filesystem and open it on the Host desktop.
133
+ * @param request - path after best-effort Session workspace resolution.
134
+ * @param signal - caller lifetime; abort terminates the native command.
135
+ * @returns confirmation after the native opener accepts the path.
136
+ * @throws RemoteError when the request is invalid, has no verified Host mapping, is cancelled, or the opener fails.
137
+ */
138
+ openWorkspacePath(request: SessionOpenWorkspacePathRequest, signal: AbortSignal): Promise<SessionOpenWorkspacePathValue>;
139
+ /**
140
+ * Query current file handlers on the serving desktop without activating an Agent.
141
+ * @param request - file path in Host filesystem syntax.
142
+ * @param signal - caller lifetime, propagated to filesystem and desktop queries.
143
+ * @returns OS application names, icons, and default selection; empty when desktop opening is unavailable.
144
+ * @throws RemoteError when the path is invalid, the query is cancelled, or native discovery fails.
145
+ */
146
+ workspacePathApplications(request: {
147
+ readonly path: string;
148
+ }, signal: AbortSignal): Promise<readonly SessionWorkspacePathApplication[]>;
149
+ private verifyDesktopPath;
150
+ /**
151
+ * Rename one Session after explicitly resuming it.
152
+ * @param request - Session identity and proposed title.
153
+ * @returns the accepted title and durable event sequence.
154
+ */
155
+ rename(request: SessionRenameRequest): Promise<SessionRenameValue>;
156
+ /**
157
+ * Fork one cold-readable exact event prefix into a new Session. An omitted
158
+ * boundary selects the latest completed-turn prefix; an open cut receives
159
+ * synthetic fork closers.
160
+ * @param request - source Session, optional exact inclusive event boundary, and migration preflight choice.
161
+ * @returns the new Session identity.
162
+ */
163
+ fork(request: SessionForkRequest): Promise<SessionForkValue>;
164
+ /**
165
+ * Admit one prompt after explicitly resuming its Session.
166
+ * @param request - Session identity, prompt content, source metadata, and delivery mode.
167
+ * @param signal - caller cancellation before prompt admission begins.
168
+ * @returns acknowledgement that the Agent accepted the prompt.
169
+ */
170
+ prompt(request: SessionPromptRequest, signal: AbortSignal): Promise<SessionPromptValue>;
171
+ /**
172
+ * Read one image from the attachment store after gateway authorization.
173
+ * @param request - image reference and gateway permission scope; Session existence is not checked.
174
+ * @returns the durable attachment reference and base64-encoded bytes.
175
+ */
176
+ attachment(request: SessionAttachmentRequest): Promise<SessionAttachmentValue>;
177
+ /**
178
+ * Mutate one still-pending queue occurrence, resuming a cold Agent first.
179
+ * @param request - Session, queue item, and requested mutation.
180
+ * @returns acknowledgement that the queue mutation was applied.
181
+ */
182
+ updateQueue(request: SessionUpdateQueueRequest): Promise<SessionUpdateQueueValue>;
183
+ /**
184
+ * Cancel one active Agent turn without dropping its pending inbox.
185
+ * @param request - Session whose active Agent turn is cancelled.
186
+ * @returns acknowledgement that cancellation was requested.
187
+ */
188
+ cancel(request: SessionCancelRequest): SessionCancelValue;
189
+ /**
190
+ * Read one cold-safe, message-aligned Session history page.
191
+ * @deprecated Use `events`; this entry point remains for existing Web callers.
192
+ * @param request - durable address, optional fixed cut, backward cursor, and page budget.
193
+ * @param signal - cancellation for persistence reads.
194
+ * @returns one chronological page with its inclusive cursor; an omitted `throughSeq` selects the observed log end.
195
+ */
196
+ page(request: SessionPageRequest, signal: AbortSignal): Promise<SessionEventsPage>;
197
+ /**
198
+ * Read one cold-safe, message-aligned Session history page.
199
+ * @param request - durable address, optional fixed cut, backward cursor, and page budget.
200
+ * @param signal - cancellation for persistence reads.
201
+ * @returns one chronological page with its inclusive cursor.
202
+ */
203
+ events(request: SessionPageRequest, signal: AbortSignal): Promise<SessionEventsPage>;
204
+ /**
205
+ * Subscribe to Session events without reading a snapshot.
206
+ * @param request - Session address.
207
+ * @param signal - subscription cancellation.
208
+ * @returns readiness and subsequent events, without a snapshot.
209
+ */
210
+ observeEvent(request: SessionObserveEventRequest, signal: AbortSignal): AsyncIterable<SessionEventFrame>;
211
+ /**
212
+ * Subscribe to Session projection changes.
213
+ * @param request - target Session.
214
+ * @param signal - subscription cancellation.
215
+ * @returns readiness followed by one projection change frame per committed event.
216
+ */
217
+ observeProjections(request: SessionProjectionsRequest, signal: AbortSignal): AsyncIterable<SessionProjectionFrame>;
218
+ /**
219
+ * Read passive Session state.
220
+ * @param request - target Session.
221
+ * @param signal - read cancellation.
222
+ * @returns current passive state.
223
+ */
224
+ state(request: SessionStateRequest, signal: AbortSignal): Promise<SessionState>;
225
+ /**
226
+ * Subscribe to complete Session state replacements.
227
+ * @param request - target Session.
228
+ * @param signal - subscription cancellation.
229
+ * @returns complete passive state replacements.
230
+ */
231
+ observeState(request: SessionStateRequest, signal: AbortSignal): AsyncIterable<SessionState>;
232
+ /**
233
+ * Wait for Session quiescence or pending input with bounded assistant output.
234
+ * @param request - Session, wait bounds and output window.
235
+ * @param signal - caller cancellation.
236
+ * @returns stopping state and bounded assistant output.
237
+ */
238
+ wait(request: SessionWaitRequest, signal: AbortSignal): Promise<SessionWaitValue>;
239
+ /**
240
+ * Follow one Session log from its opening or resume cursor.
241
+ * @param request - durable address and last committed sequence already held by the caller.
242
+ * @param signal - cancellation owned by the Remote stream carrier.
243
+ * @returns a complete opening snapshot followed by gap-free durable event
244
+ * frames and optional cursorless assistant-stream frames.
245
+ */
246
+ follow(request: SessionFollowRequest, signal: AbortSignal): AsyncIterable<SessionFollowFrame>;
247
+ /**
248
+ * Read exact projections, returning cached hints only when migration is required.
249
+ * @param request - Session whose current values are required.
250
+ * @param signal - cancellation for the Session read.
251
+ * @returns a sequenced baseline, cached hints when migration is deferred, or null when absent.
252
+ */
253
+ projections(request: SessionProjectionsRequest, signal: AbortSignal): Promise<SessionProjectionsValue>;
254
+ /**
255
+ * Stream a complete live-control baseline followed by replacement frames.
256
+ * @param signal - cancellation owned by the Remote stream carrier.
257
+ * @returns one complete baseline followed by live replacement frames.
258
+ */
259
+ control(signal: AbortSignal): AsyncIterable<SessionControlFrame>;
260
+ }
261
+ export default SessionController;
262
+ //# sourceMappingURL=index.d.ts.map