@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
package/dist/types.d.ts DELETED
@@ -1,535 +0,0 @@
1
- import type { SessionBindingRecord as ProtocolSessionBindingRecord, SessionRecord as ProtocolSessionRecord, SessionForkRecord, SessionTurnIndexItem, SessionTurnRecord, SessionTurnSegmentRecord } from "@neta-art/cohub-protocol/model";
2
- import type { ChannelConfig } from "@neta-art/cohub-protocol/gateway";
3
- import type { ContentBlock, Usage } from "@neta-art/cohub-protocol/core";
4
- import type { Generation, ListGenerationModelsResponse, PublicGenerationDeclaration, CreateGenerationRequest } from "@neta-art/cohub-protocol";
5
- import type { MessageRecord } from "@neta-art/cohub-protocol/model";
6
- export type { ChannelConfig, DiscordChannelConfig, } from "@neta-art/cohub-protocol/gateway";
7
- export type ApiError = {
8
- message: string;
9
- };
10
- export type UserProfile = {
11
- userUuid: string;
12
- logtoUserId?: string;
13
- displayName: string;
14
- avatarUrl: string | null;
15
- syncedAt?: string;
16
- };
17
- export type MeResponse = {
18
- uuid: string;
19
- profile: UserProfile;
20
- email: string | null;
21
- };
22
- export type UserRulesResponse = {
23
- content: string;
24
- updatedAt: string | null;
25
- source: "config-space";
26
- path: string;
27
- };
28
- export type { ContentBlock, MessageRecord, SessionTurnRecord, SessionTurnIndexItem, SessionForkRecord, SessionTurnSegmentRecord, Generation, ListGenerationModelsResponse, PublicGenerationDeclaration, CreateGenerationRequest, };
29
- export type SpaceFsEntry = {
30
- name: string;
31
- path: string;
32
- type: "file" | "dir" | "symlink";
33
- size: number;
34
- mimeType: string | null;
35
- mtimeMs: number;
36
- };
37
- export type SpaceFsTreeResponse = {
38
- path: string;
39
- entries: SpaceFsEntry[];
40
- };
41
- export type SpaceFsFileKind = "text" | "binary";
42
- export type SpaceFsEncoding = "utf-8" | "base64";
43
- export type SpaceFsFileResponse = {
44
- path: string;
45
- name: string;
46
- size: number;
47
- mimeType: string | null;
48
- mtimeMs: number;
49
- kind: SpaceFsFileKind;
50
- encoding: SpaceFsEncoding;
51
- content: string;
52
- };
53
- export type SpaceFsWriteFileInput = {
54
- path: string;
55
- content: string;
56
- encoding: SpaceFsEncoding;
57
- };
58
- export type SpaceFsMoveInput = {
59
- fromPath: string;
60
- toPath: string;
61
- };
62
- export type SpaceFsUploadEntry = {
63
- path: string;
64
- name: string;
65
- size: number;
66
- mimeType: string | null;
67
- mtimeMs: number;
68
- };
69
- export type SpaceFsUploadError = {
70
- name: string;
71
- code: "file_too_large" | "name_invalid" | "path_invalid" | "write_failed" | "object_missing";
72
- message: string;
73
- };
74
- export type SpaceFsUploadResponse = {
75
- uploaded: SpaceFsUploadEntry[];
76
- errors: SpaceFsUploadError[];
77
- };
78
- export type SpaceFsUploadPlanEntryInput = {
79
- id: string;
80
- name: string;
81
- relativePath: string;
82
- size: number;
83
- mimeType?: string | null;
84
- lastModified?: number;
85
- };
86
- export type SpaceFsCreateUploadInput = {
87
- targetDir?: string;
88
- entries: SpaceFsUploadPlanEntryInput[];
89
- };
90
- export type SpaceFsUploadPlanEntry = {
91
- id: string;
92
- objectKey: string;
93
- uploadUrl: string;
94
- headers?: Record<string, string>;
95
- };
96
- export type SpaceFsCreateUploadResponse = {
97
- uploadId: string;
98
- expiresAt: string;
99
- entries: SpaceFsUploadPlanEntry[];
100
- };
101
- export type SpaceFsCompleteUploadInput = {
102
- entries: Array<{
103
- id: string;
104
- etag?: string | null;
105
- }>;
106
- };
107
- export type SpaceFsCompleteUploadResponse = {
108
- ok: true;
109
- taskRunId: string;
110
- };
111
- export type SpaceFsUploadProgress = {
112
- phase: "queued" | "importing" | "done" | "failed";
113
- totalFiles: number;
114
- importedFiles: number;
115
- totalBytes: number;
116
- importedBytes: number;
117
- currentPath?: string;
118
- errors: SpaceFsUploadError[];
119
- };
120
- export type SessionBindingRecord = ProtocolSessionBindingRecord;
121
- export type SessionRecord = ProtocolSessionRecord & {
122
- bindings?: SessionBindingRecord[];
123
- totalMessages?: number;
124
- totalToolCalls?: number;
125
- totalInputTokens?: number;
126
- totalOutputTokens?: number;
127
- totalCost?: string | number | null;
128
- };
129
- export type SpaceGitInfo = {
130
- giteaHost: string;
131
- giteaUsername: string;
132
- };
133
- export type SpaceRecord = {
134
- id: string;
135
- userUuid: string;
136
- name: string | null;
137
- description: string | null;
138
- storageRepoName?: string | null;
139
- baseCheckpointId?: string | null;
140
- headCheckpointId?: string | null;
141
- title: string | null;
142
- status: string | null;
143
- meta: Record<string, unknown> | null;
144
- createdAt: string;
145
- updatedAt: string;
146
- channels?: {
147
- id: string;
148
- name: string | null;
149
- provider: string;
150
- status: string;
151
- }[];
152
- accessLevel?: "minimal";
153
- gitInfo?: SpaceGitInfo | null;
154
- };
155
- export type SpaceBootstrapSource = {
156
- type: "blank";
157
- } | {
158
- type: "git_repo";
159
- repoUrl?: string;
160
- ref?: string | null;
161
- } | {
162
- type: "checkpoint";
163
- checkpointId: string;
164
- };
165
- export type SpaceCreateResponse = {
166
- space: SpaceRecord;
167
- taskRunId: string;
168
- };
169
- export type SpaceListItem = SpaceRecord;
170
- export type SessionMessagesResponse = {
171
- session: SessionRecord;
172
- messages: MessageRecord[];
173
- };
174
- export type SessionMessageResponse = {
175
- session: SessionRecord;
176
- message: MessageRecord;
177
- };
178
- export type SessionMessagesPaginatedResponse = {
179
- session: SessionRecord;
180
- messages: MessageRecord[];
181
- hasMore: boolean;
182
- nextCursor: number | undefined;
183
- };
184
- export type SessionTurnsPaginatedResponse = {
185
- session: SessionRecord;
186
- turns: SessionTurnRecord[];
187
- hasMore: boolean;
188
- nextCursor: number | undefined;
189
- };
190
- export type SessionTurnIndexResponse = {
191
- session: SessionRecord;
192
- turns: SessionTurnIndexItem[];
193
- hasMore: boolean;
194
- nextCursor: number | undefined;
195
- };
196
- export type SessionTurnWindowResponse = {
197
- session: SessionRecord;
198
- turns: SessionTurnRecord[];
199
- hasMoreOlder: boolean;
200
- hasMoreNewer: boolean;
201
- oldestCursor: number | undefined;
202
- newestCursor: number | undefined;
203
- anchorSequence: number | undefined;
204
- };
205
- export type SessionTurnResponse = {
206
- session: SessionRecord;
207
- turn: SessionTurnRecord;
208
- };
209
- export type SessionTurnSignedUrlsResponse = {
210
- urls: Record<string, string>;
211
- };
212
- export type SessionTurnStreamSnapshotResponse = {
213
- snapshot: {
214
- version: 2;
215
- spaceId: string;
216
- sessionId: string;
217
- turnId: string | null;
218
- anchorUserMessageId: string | null;
219
- seq: number;
220
- current: {
221
- messageId: string | null;
222
- messageOrdinal: number | null;
223
- content: ContentBlock[];
224
- appendPath: string | null;
225
- };
226
- intermediateMessages: Array<{
227
- messageId: string | null;
228
- messageOrdinal: number | null;
229
- content: ContentBlock[];
230
- id?: string;
231
- sessionId?: string;
232
- role?: "user" | "assistant" | "system";
233
- text?: string | null;
234
- provider?: string | null;
235
- model?: string | null;
236
- stopReason?: string | null;
237
- errorMessage?: string | null;
238
- usage?: Usage | null;
239
- toolCallsObjectKey?: string | null;
240
- meta?: Record<string, unknown> | null;
241
- createdAt?: string;
242
- }>;
243
- updatedAt: number;
244
- } | null;
245
- };
246
- export type ModelCatalogEntry = {
247
- provider: string;
248
- id: string;
249
- model: Record<string, unknown>;
250
- };
251
- export type PromptTemplateCatalogEntry = {
252
- name: string;
253
- description: string;
254
- argumentHint?: string;
255
- category?: string;
256
- scope: "platform";
257
- };
258
- export type PromptTemplateCatalogResponse = {
259
- prompts: PromptTemplateCatalogEntry[];
260
- };
261
- export type Channel = {
262
- id: string;
263
- userUuid: string;
264
- provider: string;
265
- name: string;
266
- status: string;
267
- createdAt: string;
268
- updatedAt: string;
269
- boundSpace: {
270
- id: string;
271
- title: string | null;
272
- status: string;
273
- } | null;
274
- };
275
- export type SpaceEnvInput = {
276
- name: string;
277
- value: string;
278
- };
279
- export type SpaceChannelBindingInput = {
280
- channelId: string;
281
- config?: ChannelConfig | null;
282
- };
283
- export type GlobalSearchResult = {
284
- type: "turn" | "session" | "space";
285
- id: string;
286
- spaceId: string;
287
- sessionId: string | null;
288
- turnId: string | null;
289
- sequence: number | null;
290
- title: string;
291
- excerpt: string | null;
292
- spaceName: string | null;
293
- sessionTitle: string | null;
294
- matchedField: "userText" | "title" | "name" | "description";
295
- href: string;
296
- score: number;
297
- textScore: number;
298
- recencyScore: number;
299
- typePriorityScore: number;
300
- updatedAt: string | null;
301
- source: "remote";
302
- };
303
- export type GlobalSearchResponse = {
304
- items: GlobalSearchResult[];
305
- query: string;
306
- source: "remote";
307
- degraded?: boolean;
308
- };
309
- export type SpaceSessionsResponse = {
310
- sessions: SessionRecord[];
311
- pageInfo?: {
312
- hasMore: boolean;
313
- nextCursor: string | null;
314
- };
315
- };
316
- export type UserSshKey = {
317
- id: string;
318
- key: string;
319
- title: string;
320
- giteaKeyId: number;
321
- createdAt: string;
322
- };
323
- export type CreateSpacePromptInput = {
324
- sessionId?: string | null;
325
- title?: string | null;
326
- content: ContentBlock[];
327
- model?: string | null;
328
- provider?: string | null;
329
- clientMessageId?: string | null;
330
- schedule?: {
331
- mode?: "immediate";
332
- } | {
333
- mode: "delay";
334
- delayMs: number;
335
- } | {
336
- mode: "at";
337
- sendAt: string;
338
- } | {
339
- mode: "repeat";
340
- cronExpression: string;
341
- timezone: string;
342
- };
343
- };
344
- export type CreateSpacePromptResponse = {
345
- ok: true;
346
- mode: "immediate";
347
- sessionId: string;
348
- userMessageId: string;
349
- turnId: string;
350
- } | {
351
- ok: true;
352
- mode: "delay" | "at";
353
- taskRunId: string;
354
- scheduledAt: string;
355
- sessionId: string | null;
356
- } | {
357
- ok: true;
358
- mode: "repeat";
359
- cronJobId: string;
360
- nextRunAt: string;
361
- timezone: string;
362
- sessionId: string | null;
363
- };
364
- export type CronJobRecord = {
365
- id: string;
366
- userUuid: string;
367
- userProfile?: UserProfile;
368
- title: string;
369
- taskType: string;
370
- payload: Record<string, unknown>;
371
- cronExpression: string;
372
- timezone: string;
373
- bullJobKey: string;
374
- spaceId: string | null;
375
- sessionId: string | null;
376
- enabled: boolean;
377
- createdAt: string;
378
- updatedAt: string;
379
- };
380
- export type TaskRunDetailResponse = {
381
- run: TaskRunRecord;
382
- progress: unknown;
383
- };
384
- export type TaskRunRecord = {
385
- id: string;
386
- jobId: string;
387
- cronJobId: string | null;
388
- taskType: string;
389
- status: "pending" | "running" | "completed" | "failed";
390
- payload: unknown;
391
- result: unknown;
392
- errorMessage: string | null;
393
- attemptCount: number;
394
- spaceId: string | null;
395
- sessionId: string | null;
396
- userUuid: string | null;
397
- scheduledAt: string | null;
398
- startedAt: string | null;
399
- finishedAt: string | null;
400
- createdAt: string;
401
- updatedAt: string;
402
- };
403
- export type CheckpointRecord = {
404
- id: string;
405
- spaceId: string;
406
- commitHash: string;
407
- description: string;
408
- parentCheckpointId: string | null;
409
- forkCount: number;
410
- meta: Record<string, unknown> | null;
411
- createdAt: string;
412
- };
413
- export type SpaceCheckpointDetailResponse = {
414
- checkpoint: CheckpointRecord;
415
- };
416
- export type SpaceRole = "host" | "builder" | "guest";
417
- export type SpaceMember = {
418
- userId: string;
419
- role: SpaceRole;
420
- profile: UserProfile;
421
- createdAt: string;
422
- updatedAt: string;
423
- };
424
- export type SpaceMarkKind = "pin";
425
- export type SpaceMarkResourceType = "session" | "checkpoint" | "file";
426
- export type SpaceMarkRecord = {
427
- id: string;
428
- spaceId: string;
429
- kind: SpaceMarkKind;
430
- resourceType: SpaceMarkResourceType;
431
- resourceRef: string;
432
- label: string | null;
433
- rank: number;
434
- createdBy: string;
435
- createdAt: string;
436
- updatedAt: string;
437
- };
438
- export type SpaceMarkListItem = SpaceMarkRecord & {
439
- href: string;
440
- resource: {
441
- title: string;
442
- subtitle: string | null;
443
- status: string | null;
444
- } | null;
445
- };
446
- export type ExploreSpaceItem = {
447
- space: SpaceRecord;
448
- accessAudience: "anonymous" | "signed_in";
449
- explore: {
450
- rank: number;
451
- category: string | null;
452
- label: string | null;
453
- };
454
- latestCheckpoints: CheckpointRecord[];
455
- stats: {
456
- pinnedCount: number;
457
- checkpointCount: number;
458
- forkCount: number;
459
- };
460
- sandboxStatus: string | null;
461
- };
462
- export type SpaceAccessPolicy = {
463
- signed_in_user: SpaceRole | null;
464
- anonymous_user: SpaceRole | null;
465
- };
466
- export type SpaceUsageHourlyStat = {
467
- bucketStartAt: string;
468
- totalTokens: number;
469
- inputTokens: number;
470
- outputTokens: number;
471
- cacheReadTokens: number;
472
- cacheWriteTokens: number;
473
- costInput: number;
474
- costOutput: number;
475
- costCacheRead: number;
476
- costCacheWrite: number;
477
- costTotal: number;
478
- requestCount: number;
479
- successCount: number;
480
- errorCount: number;
481
- models: string[];
482
- };
483
- export type SpaceUsageSummary = {
484
- totalTokens: number;
485
- inputTokens: number;
486
- outputTokens: number;
487
- cacheReadTokens: number;
488
- cacheWriteTokens: number;
489
- costInput: number;
490
- costOutput: number;
491
- costCacheRead: number;
492
- costCacheWrite: number;
493
- costTotal: number;
494
- requestCount: number;
495
- successCount: number;
496
- errorCount: number;
497
- };
498
- export type SpaceUsageResponse = {
499
- hourly: SpaceUsageHourlyStat[];
500
- summary: SpaceUsageSummary;
501
- days: number;
502
- };
503
- export type SpaceInvitation = {
504
- token: string;
505
- role: SpaceRole;
506
- status: "active" | "revoked" | "exhausted";
507
- useCount: number;
508
- maxUses: number | null;
509
- createdAt: string | null;
510
- expiresInSeconds: number | null;
511
- };
512
- export type CreateInvitationInput = {
513
- role?: SpaceRole;
514
- ttlSeconds?: number;
515
- maxUses?: number;
516
- };
517
- export type CreateInvitationResponse = {
518
- token: string;
519
- role: SpaceRole;
520
- expiresAt: string;
521
- maxUses: number | null;
522
- };
523
- export type InvitationDetail = {
524
- token: string;
525
- spaceId: string;
526
- spaceName: string;
527
- role: SpaceRole;
528
- expiresInSeconds: number | null;
529
- };
530
- export type AcceptInvitationResponse = {
531
- ok: true;
532
- spaceId: string;
533
- spaceName: string;
534
- role: SpaceRole;
535
- };
package/dist/types.js DELETED
@@ -1 +0,0 @@
1
- export {};