@neta-art/cohub 1.4.0 → 1.5.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.
- package/dist/apis/cron-jobs.d.ts +1 -2
- package/dist/apis/cron-jobs.js +0 -7
- package/dist/apis/spaces.d.ts +3 -1
- package/dist/apis/spaces.js +8 -0
- package/dist/apis/tasks.d.ts +1 -6
- package/dist/apis/tasks.js +0 -7
- package/dist/types.d.ts +43 -16
- package/dist/websocket.js +3 -8
- package/package.json +2 -2
package/dist/apis/cron-jobs.d.ts
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import type { HttpTransport } from "../transport.js";
|
|
2
|
-
import type {
|
|
2
|
+
import type { CronJobRecord, TaskRunRecord } from "../types.js";
|
|
3
3
|
export declare class CronJobsApi {
|
|
4
4
|
private readonly transport;
|
|
5
5
|
constructor(transport: HttpTransport);
|
|
6
6
|
list(spaceId?: string): Promise<{
|
|
7
7
|
jobs: CronJobRecord[];
|
|
8
8
|
}>;
|
|
9
|
-
create(data: CreateCronJobInput): Promise<CronJobRecord>;
|
|
10
9
|
delete(id: string): Promise<{
|
|
11
10
|
ok: true;
|
|
12
11
|
}>;
|
package/dist/apis/cron-jobs.js
CHANGED
|
@@ -7,13 +7,6 @@ export class CronJobsApi {
|
|
|
7
7
|
const query = spaceId ? `?spaceId=${encodeURIComponent(spaceId)}` : "";
|
|
8
8
|
return this.transport.request(`/api/cron-jobs${query}`);
|
|
9
9
|
}
|
|
10
|
-
create(data) {
|
|
11
|
-
return this.transport.request("/api/cron-jobs", {
|
|
12
|
-
method: "POST",
|
|
13
|
-
headers: { "Content-Type": "application/json" },
|
|
14
|
-
body: JSON.stringify(data),
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
10
|
delete(id) {
|
|
18
11
|
return this.transport.request(`/api/cron-jobs/${id}`, {
|
|
19
12
|
method: "DELETE",
|
package/dist/apis/spaces.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { SpacePublicEndpoints } from "@neta-art/cohub-protocol/ports";
|
|
|
2
2
|
import type { WebsocketClient, WebsocketEventPayload } from "../websocket.js";
|
|
3
3
|
import type { HttpTransport, Fetch } from "../transport.js";
|
|
4
4
|
import { type SessionPatchApplyResult } from "../session-patch-reducer.js";
|
|
5
|
-
import type { CheckpointRecord, ContentBlock, SessionMessageResponse, SessionMessagesPaginatedResponse, SessionMessagesResponse, SessionTurnResponse, SessionTurnStreamSnapshotResponse, SessionTurnIndexResponse, SessionTurnWindowResponse, SessionTurnsPaginatedResponse, SessionTurnSignedUrlsResponse, SessionRecord, SpaceAccessPolicy, SpaceBootstrapSource, SpaceChannelBindingInput, SpaceCheckpointDetailResponse, SpaceCreateResponse, SpaceEnvInput, SpaceFsCompleteUploadInput, SpaceFsCompleteUploadResponse, SpaceFsCreateUploadInput, SpaceFsCreateUploadResponse, SpaceFsFileResponse, SpaceFsMoveInput, SpaceFsTreeResponse, SpaceFsUploadResponse, SpaceUsageResponse, SpaceFsWriteFileInput, SpaceMarkKind, SpaceMarkListItem, SpaceMarkResourceType, SpaceMember, SpaceRecord, SpaceRole, SpaceSessionsResponse } from "../types.js";
|
|
5
|
+
import type { CheckpointRecord, ContentBlock, 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";
|
|
6
6
|
import { SpaceInvitationsApi } from "./invitations.js";
|
|
7
7
|
export type SessionSubscriptionHandlers = {
|
|
8
8
|
patch?: (event: WebsocketEventPayload) => void;
|
|
@@ -22,6 +22,7 @@ type SessionSendMessageInput = {
|
|
|
22
22
|
content: ContentBlock[];
|
|
23
23
|
model?: string;
|
|
24
24
|
provider?: string;
|
|
25
|
+
clientMessageId?: string;
|
|
25
26
|
};
|
|
26
27
|
export declare class SpacesApi {
|
|
27
28
|
private readonly transport;
|
|
@@ -330,6 +331,7 @@ export declare class SpaceClient {
|
|
|
330
331
|
readonly marks: SpaceMarksApi;
|
|
331
332
|
constructor(id: string, transport: HttpTransport, websocketClient: WebsocketClient | null);
|
|
332
333
|
get(customFetch?: Fetch): Promise<SpaceRecord>;
|
|
334
|
+
prompt(input: CreateSpacePromptInput): Promise<CreateSpacePromptResponse>;
|
|
333
335
|
rename(name: string): Promise<{
|
|
334
336
|
space: SpaceRecord;
|
|
335
337
|
}>;
|
package/dist/apis/spaces.js
CHANGED
|
@@ -243,6 +243,7 @@ class SessionMessagesClient {
|
|
|
243
243
|
content: input.content,
|
|
244
244
|
model: input.model,
|
|
245
245
|
provider: input.provider,
|
|
246
|
+
clientMessageId: input.clientMessageId,
|
|
246
247
|
}),
|
|
247
248
|
});
|
|
248
249
|
}
|
|
@@ -705,6 +706,13 @@ export class SpaceClient {
|
|
|
705
706
|
fetch: customFetch,
|
|
706
707
|
});
|
|
707
708
|
}
|
|
709
|
+
prompt(input) {
|
|
710
|
+
return this.transport.request(`/api/spaces/${this.id}/prompt`, {
|
|
711
|
+
method: "POST",
|
|
712
|
+
headers: { "Content-Type": "application/json" },
|
|
713
|
+
body: JSON.stringify(input),
|
|
714
|
+
});
|
|
715
|
+
}
|
|
708
716
|
rename(name) {
|
|
709
717
|
return this.transport.request(`/api/spaces/${this.id}`, {
|
|
710
718
|
method: "PATCH",
|
package/dist/apis/tasks.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { HttpTransport } from "../transport.js";
|
|
2
|
-
import type {
|
|
2
|
+
import type { TaskRunDetailResponse, TaskRunRecord } from "../types.js";
|
|
3
3
|
export declare class TasksApi {
|
|
4
4
|
private readonly transport;
|
|
5
5
|
constructor(transport: HttpTransport);
|
|
@@ -10,9 +10,4 @@ export declare class TasksApi {
|
|
|
10
10
|
}): Promise<{
|
|
11
11
|
runs: TaskRunRecord[];
|
|
12
12
|
}>;
|
|
13
|
-
createScheduled(data: CreateScheduledTaskInput): Promise<{
|
|
14
|
-
ok: true;
|
|
15
|
-
taskRunId: string;
|
|
16
|
-
scheduledAt: string;
|
|
17
|
-
}>;
|
|
18
13
|
}
|
package/dist/apis/tasks.js
CHANGED
|
@@ -15,11 +15,4 @@ export class TasksApi {
|
|
|
15
15
|
const query = params.toString();
|
|
16
16
|
return this.transport.request(`/api/tasks${query ? `?${query}` : ""}`);
|
|
17
17
|
}
|
|
18
|
-
createScheduled(data) {
|
|
19
|
-
return this.transport.request("/api/tasks", {
|
|
20
|
-
method: "POST",
|
|
21
|
-
headers: { "Content-Type": "application/json" },
|
|
22
|
-
body: JSON.stringify(data),
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
18
|
}
|
package/dist/types.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ export type UserProfile = {
|
|
|
16
16
|
export type MeResponse = {
|
|
17
17
|
uuid: string;
|
|
18
18
|
profile: UserProfile;
|
|
19
|
+
email: string | null;
|
|
19
20
|
};
|
|
20
21
|
export type UserRulesResponse = {
|
|
21
22
|
content: string;
|
|
@@ -280,9 +281,51 @@ export type UserSshKey = {
|
|
|
280
281
|
giteaKeyId: number;
|
|
281
282
|
createdAt: string;
|
|
282
283
|
};
|
|
284
|
+
export type CreateSpacePromptInput = {
|
|
285
|
+
sessionId?: string | null;
|
|
286
|
+
title?: string | null;
|
|
287
|
+
content: ContentBlock[];
|
|
288
|
+
model?: string | null;
|
|
289
|
+
provider?: string | null;
|
|
290
|
+
clientMessageId?: string | null;
|
|
291
|
+
schedule?: {
|
|
292
|
+
mode?: "immediate";
|
|
293
|
+
} | {
|
|
294
|
+
mode: "delay";
|
|
295
|
+
delayMs: number;
|
|
296
|
+
} | {
|
|
297
|
+
mode: "at";
|
|
298
|
+
sendAt: string;
|
|
299
|
+
} | {
|
|
300
|
+
mode: "repeat";
|
|
301
|
+
cronExpression: string;
|
|
302
|
+
timezone: string;
|
|
303
|
+
};
|
|
304
|
+
};
|
|
305
|
+
export type CreateSpacePromptResponse = {
|
|
306
|
+
ok: true;
|
|
307
|
+
mode: "immediate";
|
|
308
|
+
sessionId: string;
|
|
309
|
+
userMessageId: string;
|
|
310
|
+
turnId: string;
|
|
311
|
+
} | {
|
|
312
|
+
ok: true;
|
|
313
|
+
mode: "delay" | "at";
|
|
314
|
+
taskRunId: string;
|
|
315
|
+
scheduledAt: string;
|
|
316
|
+
sessionId: string | null;
|
|
317
|
+
} | {
|
|
318
|
+
ok: true;
|
|
319
|
+
mode: "repeat";
|
|
320
|
+
cronJobId: string;
|
|
321
|
+
nextRunAt: string;
|
|
322
|
+
timezone: string;
|
|
323
|
+
sessionId: string | null;
|
|
324
|
+
};
|
|
283
325
|
export type CronJobRecord = {
|
|
284
326
|
id: string;
|
|
285
327
|
userUuid: string;
|
|
328
|
+
userProfile?: UserProfile;
|
|
286
329
|
title: string;
|
|
287
330
|
taskType: string;
|
|
288
331
|
payload: Record<string, unknown>;
|
|
@@ -331,22 +374,6 @@ export type CheckpointRecord = {
|
|
|
331
374
|
export type SpaceCheckpointDetailResponse = {
|
|
332
375
|
checkpoint: CheckpointRecord;
|
|
333
376
|
};
|
|
334
|
-
export type CreateCronJobInput = {
|
|
335
|
-
title: string;
|
|
336
|
-
taskType: string;
|
|
337
|
-
payload: Record<string, unknown>;
|
|
338
|
-
cronExpression: string;
|
|
339
|
-
timezone?: string;
|
|
340
|
-
spaceId?: string;
|
|
341
|
-
sessionId?: string;
|
|
342
|
-
};
|
|
343
|
-
export type CreateScheduledTaskInput = {
|
|
344
|
-
taskType: string;
|
|
345
|
-
payload: Record<string, unknown>;
|
|
346
|
-
scheduleAt: string;
|
|
347
|
-
spaceId?: string;
|
|
348
|
-
sessionId?: string;
|
|
349
|
-
};
|
|
350
377
|
export type SpaceRole = "host" | "builder" | "guest";
|
|
351
378
|
export type SpaceMember = {
|
|
352
379
|
userId: string;
|
package/dist/websocket.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { realtimeCompactFrameSchema, realtimeEnvelopeSchema, WS_COMPACT_STREAM_CAPABILITY, } from "@neta-art/cohub-protocol/realtime";
|
|
1
|
+
import { getSessionTurnPatchStreamKey, realtimeCompactFrameSchema, realtimeEnvelopeSchema, WS_COMPACT_STREAM_CAPABILITY, } from "@neta-art/cohub-protocol/realtime";
|
|
2
2
|
import { resolveWebsocketUrl } from "./environment.js";
|
|
3
3
|
const createEventMap = () => ({
|
|
4
4
|
connecting: new Set(),
|
|
@@ -446,13 +446,7 @@ export class WebsocketClient {
|
|
|
446
446
|
if (typeof realtimeMeta?.sid === "string" && realtimeMeta.sid.trim()) {
|
|
447
447
|
return realtimeMeta.sid;
|
|
448
448
|
}
|
|
449
|
-
|
|
450
|
-
return payload.turnId;
|
|
451
|
-
if (typeof payload.messageId === "string" && payload.messageId.trim())
|
|
452
|
-
return payload.messageId;
|
|
453
|
-
return typeof envelope.sessionId === "string" && envelope.sessionId.trim()
|
|
454
|
-
? envelope.sessionId
|
|
455
|
-
: null;
|
|
449
|
+
return getSessionTurnPatchStreamKey(payload, { includeSessionFallback: true });
|
|
456
450
|
}
|
|
457
451
|
handlePatchEnvelope(envelope) {
|
|
458
452
|
const payload = envelope.payload;
|
|
@@ -543,6 +537,7 @@ export class WebsocketClient {
|
|
|
543
537
|
turnId: context.turnId,
|
|
544
538
|
messageId: context.messageId,
|
|
545
539
|
messageOrdinal: context.messageOrdinal,
|
|
540
|
+
sourceMessageId: context.messageId,
|
|
546
541
|
anchorUserMessageId: context.anchorUserMessageId,
|
|
547
542
|
seq: frame.s,
|
|
548
543
|
baseSeq: frame.b,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@neta-art/cohub",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0",
|
|
4
4
|
"description": "Cohub SDK for spaces, sessions, checkpoints, and realtime agent collaboration.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"private": false,
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"README.md"
|
|
45
45
|
],
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@neta-art/cohub-protocol": "1.
|
|
47
|
+
"@neta-art/cohub-protocol": "1.3.0"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"typescript": "^6.0.3"
|