@unieai/rabi-api-session-controller 0.0.0-stage → 0.2.1-rc.3
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/LICENSE +21 -0
- package/README.md +7 -2
- package/lib/client.js +4325 -0
- package/lib/index.js +3367 -0
- package/lib/typert.host.d.ts +3 -0
- package/lib/typert.host.js +4053 -0
- package/lib/typert.remote-client.d.ts +97 -0
- package/lib/typert.remote-client.js +2013 -0
- package/lib/types/agent.d.ts +198 -0
- package/lib/types/agent.js +609 -0
- package/lib/types/archived-session-gate.d.ts +30 -0
- package/lib/types/archived-session-gate.js +51 -0
- package/lib/types/assistant-stream.d.ts +26 -0
- package/lib/types/assistant-stream.js +82 -0
- package/lib/types/catalog.d.ts +24 -0
- package/lib/types/catalog.js +106 -0
- package/lib/types/client/contract/events.d.ts +102 -0
- package/lib/types/client/contract/events.js +111 -0
- package/lib/types/client/contract/session.d.ts +157 -0
- package/lib/types/client/contract/session.js +1 -0
- package/lib/types/client/contract/sessions.d.ts +161 -0
- package/lib/types/client/contract/sessions.js +1 -0
- package/lib/types/client/contract/snapshot.d.ts +81 -0
- package/lib/types/client/contract/snapshot.js +1 -0
- package/lib/types/client/index.d.ts +39 -0
- package/lib/types/client/index.js +60 -0
- package/lib/types/client/ordered-baseline.d.ts +12 -0
- package/lib/types/client/ordered-baseline.js +40 -0
- package/lib/types/client/scope.d.ts +46 -0
- package/lib/types/client/scope.js +46 -0
- package/lib/types/client/session-wire-event.d.ts +11 -0
- package/lib/types/client/session-wire-event.js +42 -0
- package/lib/types/client/sessions/assistant-stream.d.ts +56 -0
- package/lib/types/client/sessions/assistant-stream.js +182 -0
- package/lib/types/client/sessions/history-records.d.ts +22 -0
- package/lib/types/client/sessions/history-records.js +25 -0
- package/lib/types/client/sessions/lineage.d.ts +40 -0
- package/lib/types/client/sessions/lineage.js +54 -0
- package/lib/types/client/sessions/manager.d.ts +269 -0
- package/lib/types/client/sessions/manager.js +799 -0
- package/lib/types/client/sessions/notifier.d.ts +39 -0
- package/lib/types/client/sessions/notifier.js +97 -0
- package/lib/types/client/sessions/projection-store.d.ts +128 -0
- package/lib/types/client/sessions/projection-store.js +161 -0
- package/lib/types/client/sessions/remotes.d.ts +29 -0
- package/lib/types/client/sessions/remotes.js +7 -0
- package/lib/types/client/sessions/service.d.ts +258 -0
- package/lib/types/client/sessions/service.js +582 -0
- package/lib/types/client/sessions/session.d.ts +287 -0
- package/lib/types/client/sessions/session.js +866 -0
- package/lib/types/client/time-zone.d.ts +8 -0
- package/lib/types/client/time-zone.js +13 -0
- package/lib/types/client/transport.d.ts +77 -0
- package/lib/types/client/transport.js +129 -0
- package/lib/types/commands.d.ts +86 -0
- package/lib/types/commands.js +624 -0
- package/lib/types/control.d.ts +20 -0
- package/lib/types/control.js +106 -0
- package/lib/types/file-references.d.ts +27 -0
- package/lib/types/file-references.js +68 -0
- package/lib/types/history.d.ts +32 -0
- package/lib/types/history.js +441 -0
- package/lib/types/index.d.ts +222 -0
- package/lib/types/index.js +658 -0
- package/lib/types/list.d.ts +50 -0
- package/lib/types/list.js +325 -0
- package/lib/types/media-references.d.ts +16 -0
- package/lib/types/media-references.js +76 -0
- package/lib/types/model-selection-projection.d.ts +8 -0
- package/lib/types/model-selection-projection.js +65 -0
- package/lib/types/remote-events.d.ts +8 -0
- package/lib/types/remote-events.js +1 -0
- package/lib/types/skill-catalog.d.ts +28 -0
- package/lib/types/skill-catalog.js +203 -0
- package/lib/types/types.d.ts +611 -0
- package/lib/types/types.js +4 -0
- package/locale/en.json +5 -0
- package/locale/zh.json +6 -0
- package/package.json +114 -4
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
/** Session Remote owner: cold reads, explicit Agent commands, and live control state. */
|
|
2
|
+
import { Context } 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 type { SessionInspection } from '@unieai/rabi-session-persistence';
|
|
7
|
+
import { TypertRemoteService } from '@unieai/rabi-typert-protocol';
|
|
8
|
+
import { type ApiSessionAgentResult } from './agent.ts';
|
|
9
|
+
import { buildModelCatalog } from './catalog.ts';
|
|
10
|
+
import type { ModelCatalog, SessionWorkspacePathApplication, 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, SessionProjectionsRequest, SessionProjectionsValue, SessionUpdateQueueRequest, SessionUpdateQueueValue } from './types.ts';
|
|
11
|
+
export type * from './types.ts';
|
|
12
|
+
export { ApiSessionNotFound } from './agent.ts';
|
|
13
|
+
export { SessionFileReferences } from './file-references.ts';
|
|
14
|
+
export { SessionSkillCatalog } from './skill-catalog.ts';
|
|
15
|
+
declare module '@unieai/cordis' {
|
|
16
|
+
interface Context {
|
|
17
|
+
/** Host Session business API and Remote namespace owner. */
|
|
18
|
+
sessionController: SessionController;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
/** Session Controller deployment policy. */
|
|
22
|
+
export interface Config {
|
|
23
|
+
/** Override platform desktop-opener detection. */
|
|
24
|
+
readonly nativeOpen?: boolean;
|
|
25
|
+
/** Positive integral milliseconds of list work before yielding between complete rows. */
|
|
26
|
+
readonly listWorkSliceMs?: number;
|
|
27
|
+
}
|
|
28
|
+
/** Deployment policy after schema defaults have been applied. */
|
|
29
|
+
type ResolvedConfig = Config & {
|
|
30
|
+
readonly listWorkSliceMs: number;
|
|
31
|
+
};
|
|
32
|
+
/** Host integrations replaceable by direct unit tests. */
|
|
33
|
+
export interface SessionControllerInternals {
|
|
34
|
+
/** Native default-application handoff. */
|
|
35
|
+
readonly openPath?: (path: string, signal: AbortSignal) => Promise<void>;
|
|
36
|
+
/** Native file-association query. */
|
|
37
|
+
readonly fileApplications?: typeof nativeFileApplications;
|
|
38
|
+
/** Explicit registered-application handoff. */
|
|
39
|
+
readonly openFileApplication?: typeof openNativeFileApplication;
|
|
40
|
+
/** Native file-manager handoff. */
|
|
41
|
+
readonly revealPath?: (path: string, signal: AbortSignal) => Promise<void>;
|
|
42
|
+
/** Native handoff availability probe. */
|
|
43
|
+
readonly canOpenPath?: () => boolean;
|
|
44
|
+
}
|
|
45
|
+
/** Host service backing the generated `ctx.remote.session` namespace. */
|
|
46
|
+
export declare class SessionController extends TypertRemoteService {
|
|
47
|
+
static inject: string[];
|
|
48
|
+
static Config: z<Config, ResolvedConfig>;
|
|
49
|
+
private readonly agents;
|
|
50
|
+
private readonly commands;
|
|
51
|
+
private readonly controlState;
|
|
52
|
+
private readonly history;
|
|
53
|
+
private readonly listState;
|
|
54
|
+
private readonly openPath;
|
|
55
|
+
private readonly fileApplications;
|
|
56
|
+
private readonly openFileApplication;
|
|
57
|
+
private readonly revealPath;
|
|
58
|
+
private readonly canOpenPath;
|
|
59
|
+
private readonly promotions;
|
|
60
|
+
/**
|
|
61
|
+
* @param ctx - Host context containing the Session capability assembly.
|
|
62
|
+
* @param config - native-opener and list-scheduling deployment policy.
|
|
63
|
+
* @param internals - host integrations replaceable by direct unit tests.
|
|
64
|
+
*/
|
|
65
|
+
constructor(ctx: Context, config: Config, internals?: SessionControllerInternals);
|
|
66
|
+
private promote;
|
|
67
|
+
/**
|
|
68
|
+
* Resolve or resume one ordinary Session for another Host API domain.
|
|
69
|
+
* @param sessionId - Session identity whose Agent owns the operation.
|
|
70
|
+
* @returns the live Agent or the stable Session-domain failure.
|
|
71
|
+
*/
|
|
72
|
+
resolveAgent(sessionId: SessionId): Promise<ApiSessionAgentResult>;
|
|
73
|
+
/**
|
|
74
|
+
* Inspect one attached or persisted Session without activating its Agent.
|
|
75
|
+
* @param sessionId - durable Session identity.
|
|
76
|
+
* @param signal - optional caller cancellation for persistence reads.
|
|
77
|
+
* @returns the current attached state or persisted header and event prefix.
|
|
78
|
+
*/
|
|
79
|
+
inspect(sessionId: SessionId, signal?: AbortSignal): Promise<SessionInspection>;
|
|
80
|
+
/**
|
|
81
|
+
* Read all visible Session rows without resuming an Agent.
|
|
82
|
+
* @param _request - reserved empty list request.
|
|
83
|
+
* @param signal - cancellation for persistence reads and summary generation.
|
|
84
|
+
* @returns visible Session summaries ordered by activity.
|
|
85
|
+
*/
|
|
86
|
+
list(_request: SessionListRequest, signal: AbortSignal): Promise<SessionListValue>;
|
|
87
|
+
/**
|
|
88
|
+
* Search visible Session content without resuming an Agent. A non-owner
|
|
89
|
+
* receives only the hits whose Session `allows()` admits; `hasMore`
|
|
90
|
+
* describes the bounded result before that filtering.
|
|
91
|
+
* @param request - literal message-content query.
|
|
92
|
+
* @param signal - cancellation for list and search reads.
|
|
93
|
+
* @returns authorized bounded Session search results.
|
|
94
|
+
*/
|
|
95
|
+
search(request: SessionSearchRequest, signal: AbortSignal): Promise<SessionSearchValue>;
|
|
96
|
+
/**
|
|
97
|
+
* Create one ordinary Session for a new conversation, reusing the named blank Session while it is reusable.
|
|
98
|
+
* @param request - optional blank Session to reuse, location, and Agent preset.
|
|
99
|
+
* @returns the created or reused Session identity and its preset when configured.
|
|
100
|
+
*/
|
|
101
|
+
create(request: SessionCreateRequest): Promise<SessionCreateValue>;
|
|
102
|
+
/**
|
|
103
|
+
* Select one Session-local model after explicitly resuming the Session; save the default in the background.
|
|
104
|
+
* @param request - Session identity and requested model selection.
|
|
105
|
+
* @returns the normalized selection installed for the Session, without waiting for default persistence.
|
|
106
|
+
*/
|
|
107
|
+
selectModel(request: SessionSelectModelRequest): Promise<SessionSelectModelValue>;
|
|
108
|
+
/**
|
|
109
|
+
* Select the first available account model after login when no provider API key is configured.
|
|
110
|
+
* @returns after saving the first available model or retaining the existing default.
|
|
111
|
+
*/
|
|
112
|
+
initializeDefaultModel(): Promise<void>;
|
|
113
|
+
/**
|
|
114
|
+
* Describe every currently routable model for Host-generation selectors.
|
|
115
|
+
* @returns provider-grouped models, the deployment default, and isolated provider failures.
|
|
116
|
+
*/
|
|
117
|
+
modelCatalog(): Promise<ModelCatalog>;
|
|
118
|
+
/**
|
|
119
|
+
* Report whether this deployment can hand a Session workspace path to a native desktop.
|
|
120
|
+
* @returns true when the matching open operation is available.
|
|
121
|
+
*/
|
|
122
|
+
canOpenWorkspacePath(): boolean;
|
|
123
|
+
/**
|
|
124
|
+
* Describe the serving desktop for authenticated file-action routes.
|
|
125
|
+
* @returns Host name, configured availability, and platform-specific file-manager behavior.
|
|
126
|
+
*/
|
|
127
|
+
workspaceDesktop(): {
|
|
128
|
+
name: string;
|
|
129
|
+
available: boolean;
|
|
130
|
+
fileManager: 'finder' | 'explorer' | 'directory' | null;
|
|
131
|
+
};
|
|
132
|
+
/**
|
|
133
|
+
* Verify one path through the composed filesystem and open it on the Host desktop.
|
|
134
|
+
* @param request - path after best-effort Session workspace resolution.
|
|
135
|
+
* @param signal - caller lifetime; abort terminates the native command.
|
|
136
|
+
* @returns confirmation after the native opener accepts the path.
|
|
137
|
+
* @throws RemoteError when the request is invalid, has no verified Host mapping, is cancelled, or the opener fails.
|
|
138
|
+
*/
|
|
139
|
+
openWorkspacePath(request: SessionOpenWorkspacePathRequest, signal: AbortSignal): Promise<SessionOpenWorkspacePathValue>;
|
|
140
|
+
/**
|
|
141
|
+
* Query current file handlers on the serving desktop without activating an Agent.
|
|
142
|
+
* @param request - file path in Host filesystem syntax.
|
|
143
|
+
* @param signal - caller lifetime, propagated to filesystem and desktop queries.
|
|
144
|
+
* @returns OS application names, icons, and default selection; empty when desktop opening is unavailable.
|
|
145
|
+
* @throws RemoteError when the path is invalid, the query is cancelled, or native discovery fails.
|
|
146
|
+
*/
|
|
147
|
+
workspacePathApplications(request: {
|
|
148
|
+
readonly path: string;
|
|
149
|
+
}, signal: AbortSignal): Promise<readonly SessionWorkspacePathApplication[]>;
|
|
150
|
+
private verifyDesktopPath;
|
|
151
|
+
/**
|
|
152
|
+
* Rename one Session after explicitly resuming it.
|
|
153
|
+
* @param request - Session identity and proposed title.
|
|
154
|
+
* @returns the accepted title and durable event sequence.
|
|
155
|
+
*/
|
|
156
|
+
rename(request: SessionRenameRequest): Promise<SessionRenameValue>;
|
|
157
|
+
/**
|
|
158
|
+
* Fork one cold-readable exact event prefix into a new Session. An omitted
|
|
159
|
+
* boundary selects the latest completed-turn prefix; an open cut receives
|
|
160
|
+
* synthetic fork closers.
|
|
161
|
+
* @param request - source Session, optional exact inclusive event boundary, and migration preflight choice.
|
|
162
|
+
* @returns the new Session identity.
|
|
163
|
+
*/
|
|
164
|
+
fork(request: SessionForkRequest): Promise<SessionForkValue>;
|
|
165
|
+
/**
|
|
166
|
+
* Admit one prompt after explicitly resuming its Session.
|
|
167
|
+
* @param request - Session identity, prompt content, source metadata, and delivery mode.
|
|
168
|
+
* @param signal - caller cancellation before prompt admission begins.
|
|
169
|
+
* @returns acknowledgement that the Agent accepted the prompt.
|
|
170
|
+
*/
|
|
171
|
+
prompt(request: SessionPromptRequest, signal: AbortSignal): Promise<SessionPromptValue>;
|
|
172
|
+
/**
|
|
173
|
+
* Read one image proven reachable from the addressed Session log.
|
|
174
|
+
* @param request - Session and attachment identities used for authorization.
|
|
175
|
+
* @returns the durable attachment reference and base64-encoded bytes.
|
|
176
|
+
*/
|
|
177
|
+
attachment(request: SessionAttachmentRequest): Promise<SessionAttachmentValue>;
|
|
178
|
+
/**
|
|
179
|
+
* Mutate one still-pending queue occurrence, resuming a cold Agent first.
|
|
180
|
+
* @param request - Session, queue item, and requested mutation.
|
|
181
|
+
* @returns acknowledgement that the queue mutation was applied.
|
|
182
|
+
*/
|
|
183
|
+
updateQueue(request: SessionUpdateQueueRequest): Promise<SessionUpdateQueueValue>;
|
|
184
|
+
/**
|
|
185
|
+
* Cancel one active Agent turn without dropping its pending inbox.
|
|
186
|
+
* @param request - Session whose active Agent turn is cancelled.
|
|
187
|
+
* @returns acknowledgement that cancellation was requested.
|
|
188
|
+
*/
|
|
189
|
+
cancel(request: SessionCancelRequest): SessionCancelValue;
|
|
190
|
+
/**
|
|
191
|
+
* Read one cold-safe, message-aligned Session history page.
|
|
192
|
+
* @param request - durable address, backward cursor, and page budget.
|
|
193
|
+
* @param signal - cancellation for persistence reads.
|
|
194
|
+
* @returns one chronological page.
|
|
195
|
+
*/
|
|
196
|
+
page(request: SessionPageRequest, signal: AbortSignal): Promise<SessionPage>;
|
|
197
|
+
/**
|
|
198
|
+
* Follow one Session log from its opening or resume cursor.
|
|
199
|
+
* @param request - durable address and last committed sequence already held by the caller.
|
|
200
|
+
* @param signal - cancellation owned by the Remote stream carrier.
|
|
201
|
+
* @returns a complete opening snapshot followed by gap-free durable event
|
|
202
|
+
* frames and optional cursorless assistant-stream frames.
|
|
203
|
+
*/
|
|
204
|
+
follow(request: SessionFollowRequest, signal: AbortSignal): AsyncIterable<SessionFollowFrame>;
|
|
205
|
+
/**
|
|
206
|
+
* Read exact projections, returning cached hints only when migration is required.
|
|
207
|
+
* @param request - Session whose current values are required.
|
|
208
|
+
* @param signal - cancellation for the Session read.
|
|
209
|
+
* @returns a sequenced baseline, cached hints when migration is deferred, or null when absent.
|
|
210
|
+
*/
|
|
211
|
+
projections(request: SessionProjectionsRequest, signal: AbortSignal): Promise<SessionProjectionsValue>;
|
|
212
|
+
private liveProjections;
|
|
213
|
+
/**
|
|
214
|
+
* Stream a complete live-control baseline followed by replacement frames.
|
|
215
|
+
* @param signal - cancellation owned by the Remote stream carrier.
|
|
216
|
+
* @returns one complete baseline followed by live replacement frames.
|
|
217
|
+
*/
|
|
218
|
+
control(signal: AbortSignal): AsyncIterable<SessionControlFrame>;
|
|
219
|
+
}
|
|
220
|
+
export { buildModelCatalog };
|
|
221
|
+
export default SessionController;
|
|
222
|
+
//# sourceMappingURL=index.d.ts.map
|