@neta-art/cohub 1.9.0 → 1.10.0

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 (51) hide show
  1. package/README.md +6 -105
  2. package/dist/chunks/environment.js +33 -0
  3. package/dist/chunks/http.d.ts +1615 -0
  4. package/dist/chunks/http.js +1919 -0
  5. package/dist/chunks/websocket.d.ts +266 -0
  6. package/dist/chunks/websocket.js +655 -0
  7. package/dist/http.d.ts +3 -32
  8. package/dist/http.js +2 -48
  9. package/dist/index.d.ts +35 -14
  10. package/dist/index.js +105 -8
  11. package/dist/websocket.d.ts +2 -141
  12. package/dist/websocket.js +2 -628
  13. package/package.json +7 -7
  14. package/dist/apis/channels.d.ts +0 -13
  15. package/dist/apis/channels.js +0 -24
  16. package/dist/apis/cron-jobs.d.ts +0 -18
  17. package/dist/apis/cron-jobs.js +0 -25
  18. package/dist/apis/explore.d.ts +0 -9
  19. package/dist/apis/explore.js +0 -9
  20. package/dist/apis/generations.d.ts +0 -7
  21. package/dist/apis/generations.js +0 -13
  22. package/dist/apis/invitations.d.ts +0 -20
  23. package/dist/apis/invitations.js +0 -36
  24. package/dist/apis/models.d.ts +0 -10
  25. package/dist/apis/models.js +0 -13
  26. package/dist/apis/prompts.d.ts +0 -9
  27. package/dist/apis/prompts.js +0 -16
  28. package/dist/apis/search.d.ts +0 -10
  29. package/dist/apis/search.js +0 -14
  30. package/dist/apis/session-access.d.ts +0 -13
  31. package/dist/apis/session-access.js +0 -19
  32. package/dist/apis/spaces.d.ts +0 -371
  33. package/dist/apis/spaces.js +0 -766
  34. package/dist/apis/tasks.d.ts +0 -13
  35. package/dist/apis/tasks.js +0 -18
  36. package/dist/apis/user.d.ts +0 -27
  37. package/dist/apis/user.js +0 -71
  38. package/dist/client.d.ts +0 -33
  39. package/dist/client.js +0 -103
  40. package/dist/environment.d.ts +0 -22
  41. package/dist/environment.js +0 -37
  42. package/dist/realtime.d.ts +0 -2
  43. package/dist/realtime.js +0 -8
  44. package/dist/session-generation-stream.d.ts +0 -114
  45. package/dist/session-generation-stream.js +0 -514
  46. package/dist/session-patch-reducer.d.ts +0 -61
  47. package/dist/session-patch-reducer.js +0 -432
  48. package/dist/transport.d.ts +0 -40
  49. package/dist/transport.js +0 -78
  50. package/dist/types.d.ts +0 -535
  51. package/dist/types.js +0 -1
@@ -1,18 +0,0 @@
1
- import type { HttpTransport } from "../transport.js";
2
- import type { CronJobRecord, TaskRunRecord } from "../types.js";
3
- export declare class CronJobsApi {
4
- private readonly transport;
5
- constructor(transport: HttpTransport);
6
- list(spaceId?: string): Promise<{
7
- jobs: CronJobRecord[];
8
- }>;
9
- delete(id: string): Promise<{
10
- ok: true;
11
- }>;
12
- toggle(id: string, enabled: boolean): Promise<{
13
- ok: true;
14
- }>;
15
- runs(cronJobId: string): Promise<{
16
- runs: TaskRunRecord[];
17
- }>;
18
- }
@@ -1,25 +0,0 @@
1
- export class CronJobsApi {
2
- transport;
3
- constructor(transport) {
4
- this.transport = transport;
5
- }
6
- list(spaceId) {
7
- const query = spaceId ? `?spaceId=${encodeURIComponent(spaceId)}` : "";
8
- return this.transport.request(`/api/cron-jobs${query}`);
9
- }
10
- delete(id) {
11
- return this.transport.request(`/api/cron-jobs/${id}`, {
12
- method: "DELETE",
13
- });
14
- }
15
- toggle(id, enabled) {
16
- return this.transport.request(`/api/cron-jobs/${id}`, {
17
- method: "PATCH",
18
- headers: { "Content-Type": "application/json" },
19
- body: JSON.stringify({ enabled }),
20
- });
21
- }
22
- runs(cronJobId) {
23
- return this.transport.request(`/api/cron-jobs/${cronJobId}/runs`);
24
- }
25
- }
@@ -1,9 +0,0 @@
1
- import type { ExploreSpaceItem } from "../types.js";
2
- import type { HttpTransport } from "../transport.js";
3
- export declare class ExploreApi {
4
- private readonly transport;
5
- constructor(transport: HttpTransport);
6
- spaces(): Promise<{
7
- spaces: ExploreSpaceItem[];
8
- }>;
9
- }
@@ -1,9 +0,0 @@
1
- export class ExploreApi {
2
- transport;
3
- constructor(transport) {
4
- this.transport = transport;
5
- }
6
- spaces() {
7
- return this.transport.request("/api/explore/spaces");
8
- }
9
- }
@@ -1,7 +0,0 @@
1
- import type { CreateGenerationRequest, Generation } from "@neta-art/cohub-protocol";
2
- import type { HttpTransport } from "../transport.js";
3
- export declare class GenerationsApi {
4
- private readonly transport;
5
- constructor(transport: HttpTransport);
6
- create(request: CreateGenerationRequest): Promise<Generation>;
7
- }
@@ -1,13 +0,0 @@
1
- export class GenerationsApi {
2
- transport;
3
- constructor(transport) {
4
- this.transport = transport;
5
- }
6
- async create(request) {
7
- return this.transport.request("/api/generations", {
8
- method: "POST",
9
- headers: { "Content-Type": "application/json" },
10
- body: JSON.stringify(request),
11
- });
12
- }
13
- }
@@ -1,20 +0,0 @@
1
- import type { HttpTransport } from "../transport.js";
2
- import type { SpaceInvitation, CreateInvitationInput, CreateInvitationResponse, InvitationDetail, AcceptInvitationResponse } from "../types.js";
3
- export declare class SpaceInvitationsApi {
4
- private readonly transport;
5
- private readonly spaceId;
6
- constructor(transport: HttpTransport, spaceId: string);
7
- list(): Promise<{
8
- items: SpaceInvitation[];
9
- }>;
10
- create(input?: CreateInvitationInput): Promise<CreateInvitationResponse>;
11
- revoke(token: string): Promise<{
12
- ok: true;
13
- }>;
14
- }
15
- export declare class PublicInviteApi {
16
- private readonly transport;
17
- constructor(transport: HttpTransport);
18
- get(token: string): Promise<InvitationDetail>;
19
- accept(token: string): Promise<AcceptInvitationResponse>;
20
- }
@@ -1,36 +0,0 @@
1
- export class SpaceInvitationsApi {
2
- transport;
3
- spaceId;
4
- constructor(transport, spaceId) {
5
- this.transport = transport;
6
- this.spaceId = spaceId;
7
- }
8
- list() {
9
- return this.transport.request(`/api/spaces/${this.spaceId}/invitations`);
10
- }
11
- create(input) {
12
- return this.transport.request(`/api/spaces/${this.spaceId}/invitations`, {
13
- method: "POST",
14
- headers: { "Content-Type": "application/json" },
15
- body: JSON.stringify(input ?? {}),
16
- });
17
- }
18
- revoke(token) {
19
- return this.transport.request(`/api/spaces/${this.spaceId}/invitations/${token}`, { method: "DELETE" });
20
- }
21
- }
22
- // Public invite API (no auth required for viewing)
23
- export class PublicInviteApi {
24
- transport;
25
- constructor(transport) {
26
- this.transport = transport;
27
- }
28
- get(token) {
29
- return this.transport.request(`/api/invite/${token}`);
30
- }
31
- accept(token) {
32
- return this.transport.request(`/api/invite/${token}/accept`, {
33
- method: "POST",
34
- });
35
- }
36
- }
@@ -1,10 +0,0 @@
1
- import type { HttpTransport } from "../transport.js";
2
- import type { ModelCatalogEntry, ListGenerationModelsResponse } from "../types.js";
3
- export declare const MULTIMODAL_MODEL_TYPE = "multimodal";
4
- export type ModelsCatalog = Record<string, ModelCatalogEntry[]>;
5
- export declare class ModelsApi {
6
- private readonly transport;
7
- constructor(transport: HttpTransport);
8
- list(): Promise<ModelsCatalog>;
9
- listMultimodal(): Promise<ListGenerationModelsResponse>;
10
- }
@@ -1,13 +0,0 @@
1
- export const MULTIMODAL_MODEL_TYPE = "multimodal";
2
- export class ModelsApi {
3
- transport;
4
- constructor(transport) {
5
- this.transport = transport;
6
- }
7
- async list() {
8
- return this.transport.request("/api/models");
9
- }
10
- async listMultimodal() {
11
- return this.transport.request(`/api/models?modelType=${MULTIMODAL_MODEL_TYPE}`);
12
- }
13
- }
@@ -1,9 +0,0 @@
1
- import type { HttpTransport, Fetch } from "../transport.js";
2
- import type { PromptTemplateCatalogResponse } from "../types.js";
3
- export declare class PromptsApi {
4
- private readonly transport;
5
- constructor(transport: HttpTransport);
6
- list(options?: {
7
- spaceId?: string;
8
- }, customFetch?: Fetch): Promise<PromptTemplateCatalogResponse>;
9
- }
@@ -1,16 +0,0 @@
1
- export class PromptsApi {
2
- transport;
3
- constructor(transport) {
4
- this.transport = transport;
5
- }
6
- async list(options, customFetch) {
7
- const params = new URLSearchParams();
8
- if (options?.spaceId)
9
- params.set("spaceId", options.spaceId);
10
- const query = params.toString();
11
- const path = query ? `/api/prompts?${query}` : "/api/prompts";
12
- return this.transport.request(path, {
13
- fetch: customFetch,
14
- });
15
- }
16
- }
@@ -1,10 +0,0 @@
1
- import type { Fetch, HttpTransport } from "../transport.js";
2
- import type { GlobalSearchResponse } from "../types.js";
3
- export declare class SearchApi {
4
- private readonly transport;
5
- constructor(transport: HttpTransport);
6
- query(input: {
7
- q: string;
8
- limit?: number;
9
- }, customFetch?: Fetch): Promise<GlobalSearchResponse>;
10
- }
@@ -1,14 +0,0 @@
1
- export class SearchApi {
2
- transport;
3
- constructor(transport) {
4
- this.transport = transport;
5
- }
6
- query(input, customFetch) {
7
- const params = new URLSearchParams({ q: input.q });
8
- if (input.limit !== undefined)
9
- params.set("limit", String(input.limit));
10
- return this.transport.request(`/api/search?${params.toString()}`, {
11
- fetch: customFetch,
12
- });
13
- }
14
- }
@@ -1,13 +0,0 @@
1
- import type { HttpTransport } from "../transport.js";
2
- import type { SpaceAccessPolicy, SpaceRole } from "../types.js";
3
- export declare class SessionAccessApi {
4
- private readonly transport;
5
- constructor(transport: HttpTransport);
6
- get(sessionId: string): Promise<SpaceAccessPolicy>;
7
- set(sessionId: string, body: {
8
- anonymous_user?: SpaceRole | null;
9
- }): Promise<SpaceAccessPolicy>;
10
- remove(sessionId: string): Promise<{
11
- ok: true;
12
- }>;
13
- }
@@ -1,19 +0,0 @@
1
- export class SessionAccessApi {
2
- transport;
3
- constructor(transport) {
4
- this.transport = transport;
5
- }
6
- get(sessionId) {
7
- return this.transport.request(`/api/sessions/${sessionId}/access`);
8
- }
9
- set(sessionId, body) {
10
- return this.transport.request(`/api/sessions/${sessionId}/access`, {
11
- method: "PATCH",
12
- headers: { "Content-Type": "application/json" },
13
- body: JSON.stringify(body),
14
- });
15
- }
16
- remove(sessionId) {
17
- return this.transport.request(`/api/sessions/${sessionId}/access`, { method: "DELETE" });
18
- }
19
- }
@@ -1,371 +0,0 @@
1
- import type { SpacePublicEndpoints } from "@neta-art/cohub-protocol/ports";
2
- import type { WebsocketClient, WebsocketEventPayload } from "../websocket.js";
3
- import type { HttpTransport, Fetch } from "../transport.js";
4
- import { type SessionPatchApplyResult } from "../session-patch-reducer.js";
5
- import { SessionGenerationStreamClient, type GenerationStreamSubscriptionHandlers } from "../session-generation-stream.js";
6
- import type { CheckpointRecord, ContentBlock, SessionForkRecord, SessionMessageResponse, SessionMessagesPaginatedResponse, SessionMessagesResponse, SessionTurnResponse, SessionTurnStreamSnapshotResponse, SessionTurnIndexResponse, SessionTurnWindowResponse, SessionTurnsPaginatedResponse, SessionTurnSignedUrlsResponse, SessionRecord, SpaceAccessPolicy, SpaceBootstrapSource, SpaceChannelBindingInput, SpaceCheckpointDetailResponse, SpaceCreateResponse, CreateSpacePromptInput, CreateSpacePromptResponse, SpaceEnvInput, SpaceFsCompleteUploadInput, SpaceFsCompleteUploadResponse, SpaceFsCreateUploadInput, SpaceFsCreateUploadResponse, SpaceFsFileResponse, SpaceFsMoveInput, SpaceFsTreeResponse, SpaceFsUploadResponse, SpaceUsageResponse, SpaceFsWriteFileInput, SpaceMarkKind, SpaceMarkListItem, SpaceMarkResourceType, SpaceMember, SpaceRecord, SpaceRole, SpaceSessionsResponse } from "../types.js";
7
- import { SpaceInvitationsApi } from "./invitations.js";
8
- export type SessionSubscriptionHandlers = {
9
- patch?: (event: WebsocketEventPayload) => void;
10
- /**
11
- * @deprecated Use `session.subscribeGeneration({ state })` for normalized
12
- * snapshot/patch/progress generation state.
13
- */
14
- patchState?: (result: SessionPatchApplyResult) => void;
15
- /** @deprecated Use `session.subscribeGeneration({ state })`. */
16
- snapshot?: (event: WebsocketEventPayload) => void;
17
- /** @deprecated Legacy progress events are normalized by `subscribeGeneration`. */
18
- progress?: (event: WebsocketEventPayload) => void;
19
- /** @deprecated Use `session.subscribeGeneration({ commit, finalized })`. */
20
- final?: (event: WebsocketEventPayload) => void;
21
- turnUpdated?: (event: WebsocketEventPayload) => void;
22
- turnFinalized?: (event: WebsocketEventPayload) => void;
23
- error?: (event: WebsocketEventPayload) => void;
24
- persisted?: (event: WebsocketEventPayload) => void;
25
- event?: (event: WebsocketEventPayload) => void;
26
- };
27
- export type SessionEventName = "turn.patch" | "turn.snapshot" | "turn.progress" | "turn.final" | "turn.updated" | "turn.error" | "message.persisted";
28
- export type SpaceEventName = SessionEventName | "ports.changed" | "event";
29
- type SessionSendMessageInput = {
30
- content: ContentBlock[];
31
- model?: string;
32
- provider?: string;
33
- clientMessageId?: string;
34
- };
35
- export declare class SpacesApi {
36
- private readonly transport;
37
- constructor(transport: HttpTransport);
38
- list(customFetch?: Fetch): Promise<SpaceRecord[]>;
39
- get(spaceId: string, customFetch?: Fetch): Promise<SpaceRecord>;
40
- create(input?: {
41
- name?: string;
42
- description?: string;
43
- source?: string;
44
- extraEnv?: SpaceEnvInput[];
45
- channelBindings?: SpaceChannelBindingInput[];
46
- bootstrapSource?: SpaceBootstrapSource;
47
- }, headers?: Record<string, string>): Promise<SpaceCreateResponse>;
48
- }
49
- export declare class SpaceFilesApi {
50
- private readonly transport;
51
- private readonly spaceId;
52
- constructor(transport: HttpTransport, spaceId: string);
53
- list(path?: string, customFetch?: Fetch): Promise<SpaceFsTreeResponse>;
54
- read(path: string, customFetch?: Fetch): Promise<SpaceFsFileResponse>;
55
- /**
56
- * Build a direct download URL. For private files, prefer `download()` so the
57
- * SDK can attach authorization headers.
58
- */
59
- getDownloadUrl(path: string): string;
60
- download(path: string, customFetch?: Fetch): Promise<{
61
- blob: Blob;
62
- filename: string;
63
- mimeType: string;
64
- }>;
65
- write(input: SpaceFsWriteFileInput): Promise<{
66
- ok: true;
67
- path: string;
68
- size: number;
69
- mtimeMs: number;
70
- }>;
71
- createDir(path: string): Promise<{
72
- ok: true;
73
- path: string;
74
- size: number;
75
- mtimeMs: number;
76
- }>;
77
- delete(path: string, recursive?: boolean): Promise<{
78
- ok: true;
79
- path: string;
80
- }>;
81
- move(input: SpaceFsMoveInput): Promise<{
82
- ok: true;
83
- fromPath: string;
84
- toPath: string;
85
- }>;
86
- upload(files: File[], dir?: string): Promise<SpaceFsUploadResponse>;
87
- createUpload(input: SpaceFsCreateUploadInput): Promise<SpaceFsCreateUploadResponse>;
88
- completeUpload(uploadId: string, input: SpaceFsCompleteUploadInput): Promise<SpaceFsCompleteUploadResponse>;
89
- }
90
- declare class SessionMessagesClient {
91
- private readonly transport;
92
- private readonly sessionId;
93
- private lastSentSignature;
94
- private lastSentSessionId;
95
- private lastSentAt;
96
- constructor(transport: HttpTransport, sessionId: string);
97
- list(customFetch?: Fetch): Promise<SessionMessagesResponse>;
98
- get(messageId: string, optionsOrFetch?: {
99
- detail?: "summary" | "full";
100
- } | Fetch, customFetch?: Fetch): Promise<SessionMessageResponse>;
101
- listPaginated(options?: {
102
- cursor?: number;
103
- limit?: number;
104
- direction?: "older" | "newer";
105
- }, customFetch?: Fetch): Promise<SessionMessagesPaginatedResponse>;
106
- send(input: SessionSendMessageInput): Promise<{
107
- ok: true;
108
- userMessageId: string;
109
- turnId: string;
110
- }>;
111
- }
112
- declare class SessionTurnsClient {
113
- private readonly transport;
114
- private readonly sessionId;
115
- constructor(transport: HttpTransport, sessionId: string);
116
- listPaginated(options?: {
117
- cursor?: number;
118
- limit?: number;
119
- direction?: "older" | "newer";
120
- }, customFetch?: Fetch): Promise<SessionTurnsPaginatedResponse>;
121
- index(options?: {
122
- cursor?: number;
123
- limit?: number;
124
- }, customFetch?: Fetch): Promise<SessionTurnIndexResponse>;
125
- window(options: {
126
- sequence?: number;
127
- turnId?: string;
128
- before?: number;
129
- after?: number;
130
- }, customFetch?: Fetch): Promise<SessionTurnWindowResponse>;
131
- streamSnapshot(customFetch?: Fetch): Promise<SessionTurnStreamSnapshotResponse>;
132
- get(turnId: string, customFetch?: Fetch): Promise<SessionTurnResponse>;
133
- signedUrls(turnId: string, objectKeys: string[]): Promise<SessionTurnSignedUrlsResponse>;
134
- }
135
- declare class SessionRealtimeClient {
136
- private readonly websocketClient;
137
- private readonly spaceId;
138
- private readonly sessionId;
139
- private readonly patchReducer;
140
- constructor(websocketClient: WebsocketClient | null, spaceId: string, sessionId: string);
141
- subscribe(handlers: SessionSubscriptionHandlers): () => void;
142
- on(type: SessionEventName, handler: (event: WebsocketEventPayload) => void): () => void;
143
- }
144
- export declare class SessionClient {
145
- readonly spaceId: string;
146
- readonly id: string;
147
- private readonly transport;
148
- readonly messages: SessionMessagesClient;
149
- readonly turns: SessionTurnsClient;
150
- readonly realtime: SessionRealtimeClient;
151
- readonly generation: SessionGenerationStreamClient;
152
- constructor(spaceId: string, id: string, transport: HttpTransport, websocketClient: WebsocketClient | null);
153
- get(customFetch?: Fetch): Promise<{
154
- space: SpaceRecord;
155
- session: SessionRecord;
156
- }>;
157
- rename(title: string | null, customFetch?: Fetch): Promise<{
158
- session: SessionRecord;
159
- }>;
160
- abort(optionsOrFetch?: {
161
- turnId?: string | null;
162
- } | Fetch, customFetch?: Fetch): Promise<{
163
- ok: true;
164
- }>;
165
- turn(turnId: string): {
166
- fork: (input?: {
167
- title?: string | null;
168
- }) => Promise<{
169
- session: SessionRecord;
170
- fork: SessionForkRecord;
171
- }>;
172
- };
173
- subscribe(handlers: SessionSubscriptionHandlers): () => void;
174
- subscribeGeneration(handlers: GenerationStreamSubscriptionHandlers): () => void;
175
- on(type: SessionEventName, handler: (event: WebsocketEventPayload) => void): () => void;
176
- }
177
- export declare class SpaceSessionsApi {
178
- private readonly transport;
179
- private readonly spaceId;
180
- private readonly websocketClient;
181
- constructor(transport: HttpTransport, spaceId: string, websocketClient: WebsocketClient | null);
182
- create(input?: {
183
- title?: string;
184
- source?: string;
185
- }): Promise<{
186
- ok: true;
187
- session: SessionRecord;
188
- }>;
189
- list(optionsOrFetch?: {
190
- limit?: number;
191
- cursor?: string | null;
192
- } | Fetch, customFetch?: Fetch): Promise<SpaceSessionsResponse>;
193
- byId(sessionId: string): SessionClient;
194
- }
195
- export type WebSocketConnectionState = {
196
- state: "connecting" | "reconnecting" | "open" | "closed" | "error";
197
- willReconnect: boolean;
198
- connectionId?: string | null;
199
- attempt?: number;
200
- delayMs?: number;
201
- recoverable?: boolean;
202
- };
203
- export declare class SpaceEventsApi {
204
- private readonly websocketClient;
205
- private readonly spaceId;
206
- constructor(websocketClient: WebsocketClient | null, spaceId: string);
207
- subscribe(handler: (event: WebsocketEventPayload) => void): () => void;
208
- on(type: SpaceEventName, handler: (event: WebsocketEventPayload) => void): () => void;
209
- }
210
- export declare class SpaceMembersApi {
211
- private readonly transport;
212
- private readonly spaceId;
213
- constructor(transport: HttpTransport, spaceId: string);
214
- list(): Promise<{
215
- items: SpaceMember[];
216
- }>;
217
- update(userId: string, role: SpaceRole): Promise<SpaceMember>;
218
- remove(userId: string): Promise<{
219
- ok: true;
220
- }>;
221
- }
222
- export declare class SpaceAccessApi {
223
- private readonly transport;
224
- private readonly spaceId;
225
- constructor(transport: HttpTransport, spaceId: string);
226
- get(): Promise<SpaceAccessPolicy>;
227
- set(body: {
228
- signed_in_user?: SpaceRole | null;
229
- anonymous_user?: SpaceRole | null;
230
- }): Promise<SpaceAccessPolicy>;
231
- }
232
- export declare class SpaceUsageApi {
233
- private readonly transport;
234
- private readonly spaceId;
235
- constructor(transport: HttpTransport, spaceId: string);
236
- get(days?: number, customFetch?: Fetch): Promise<SpaceUsageResponse>;
237
- }
238
- export type SpaceChannelBindingRecord = {
239
- id: string;
240
- spaceId: string;
241
- channelId: string;
242
- config: Record<string, unknown> | null;
243
- createdAt: string;
244
- channel: {
245
- id: string;
246
- userUuid: string;
247
- provider: string;
248
- name: string;
249
- status: string;
250
- createdAt: string;
251
- updatedAt: string;
252
- } | null;
253
- };
254
- export declare class SpaceChannelsApi {
255
- private readonly transport;
256
- private readonly spaceId;
257
- constructor(transport: HttpTransport, spaceId: string);
258
- list(): Promise<SpaceChannelBindingRecord[]>;
259
- bind(channelId: string, config?: Record<string, unknown> | null): Promise<SpaceChannelBindingRecord>;
260
- unbind(channelId: string): Promise<{
261
- ok: true;
262
- }>;
263
- }
264
- export declare class SpaceEnvApi {
265
- private readonly transport;
266
- private readonly spaceId;
267
- constructor(transport: HttpTransport, spaceId: string);
268
- list(): Promise<{
269
- env: SpaceEnvInput[];
270
- }>;
271
- create(input: SpaceEnvInput): Promise<{
272
- env: SpaceEnvInput[];
273
- }>;
274
- update(name: string, value: string): Promise<{
275
- env: SpaceEnvInput[];
276
- }>;
277
- remove(name: string): Promise<{
278
- env: SpaceEnvInput[];
279
- }>;
280
- }
281
- export type SpaceSandboxRecord = {
282
- status: string | null;
283
- podName?: string | null;
284
- desiredImage?: string | null;
285
- reportedImageVersion?: string | null;
286
- lastHeartbeatAt?: string | null;
287
- reportedAt?: string | null;
288
- meta?: Record<string, unknown> | null;
289
- };
290
- export declare class SpaceSandboxApi {
291
- private readonly transport;
292
- private readonly spaceId;
293
- constructor(transport: HttpTransport, spaceId: string);
294
- get(): Promise<{
295
- sandbox: SpaceSandboxRecord | null;
296
- }>;
297
- ports(): Promise<{
298
- endpoints: SpacePublicEndpoints;
299
- }>;
300
- recreate(): Promise<{
301
- ok: boolean;
302
- status?: string;
303
- verified?: boolean;
304
- checks?: Record<string, boolean> | null;
305
- message?: string;
306
- }>;
307
- }
308
- export declare class SpaceMarksApi {
309
- private readonly transport;
310
- private readonly spaceId;
311
- constructor(transport: HttpTransport, spaceId: string);
312
- list(kind?: SpaceMarkKind): Promise<{
313
- marks: SpaceMarkListItem[];
314
- }>;
315
- create(input: {
316
- kind?: SpaceMarkKind;
317
- resourceType: SpaceMarkResourceType;
318
- resourceRef: string;
319
- label?: string | null;
320
- }): Promise<{
321
- mark: SpaceMarkListItem;
322
- }>;
323
- delete(markId: string): Promise<{
324
- ok: true;
325
- }>;
326
- }
327
- export declare class SpaceCheckpointsApi {
328
- private readonly transport;
329
- private readonly spaceId;
330
- constructor(transport: HttpTransport, spaceId: string);
331
- create(description?: string | null): Promise<{
332
- ok: true;
333
- taskRunId: string;
334
- }>;
335
- list(): Promise<{
336
- checkpoints: CheckpointRecord[];
337
- }>;
338
- get(checkpointId: string, customFetch?: Fetch): Promise<SpaceCheckpointDetailResponse>;
339
- }
340
- export declare class SpaceClient {
341
- readonly id: string;
342
- private readonly transport;
343
- private readonly websocketClient;
344
- readonly files: SpaceFilesApi;
345
- readonly sessions: SpaceSessionsApi;
346
- readonly members: SpaceMembersApi;
347
- readonly access: SpaceAccessApi;
348
- readonly checkpoints: SpaceCheckpointsApi;
349
- readonly usage: SpaceUsageApi;
350
- readonly channels: SpaceChannelsApi;
351
- readonly env: SpaceEnvApi;
352
- readonly sandbox: SpaceSandboxApi;
353
- readonly invitations: SpaceInvitationsApi;
354
- readonly marks: SpaceMarksApi;
355
- constructor(id: string, transport: HttpTransport, websocketClient: WebsocketClient | null);
356
- get(customFetch?: Fetch): Promise<SpaceRecord>;
357
- prompt(input: CreateSpacePromptInput): Promise<CreateSpacePromptResponse>;
358
- rename(name: string): Promise<{
359
- space: SpaceRecord;
360
- }>;
361
- profile(body: {
362
- description?: string | null;
363
- pictureUrl?: string | null;
364
- }): Promise<{
365
- space: SpaceRecord;
366
- }>;
367
- session(sessionId: string): SessionClient;
368
- subscribe(handler: (event: WebsocketEventPayload) => void): () => void;
369
- on(type: SpaceEventName, handler: (event: WebsocketEventPayload) => void): () => void;
370
- }
371
- export {};