@neta-art/cohub-protocol 1.4.0 → 1.6.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.
@@ -19,6 +19,11 @@ export type ContentBlock = {
19
19
  data: string;
20
20
  };
21
21
  _meta?: ContentBlockMeta;
22
+ } | {
23
+ type: "shell_command";
24
+ command: string;
25
+ rawText: string;
26
+ _meta?: ContentBlockMeta;
22
27
  } | {
23
28
  type: "tool_use";
24
29
  id: string;
@@ -0,0 +1,117 @@
1
+ export type GenerationSource = {
2
+ type: "url";
3
+ url: string;
4
+ } | {
5
+ type: "base64";
6
+ media_type: string;
7
+ data: string;
8
+ } | {
9
+ type: "space_file";
10
+ space_id: string;
11
+ path: string;
12
+ };
13
+ export type GenerationContentBlockMeta = Record<string, unknown>;
14
+ export type GenerationContentBlock = {
15
+ type: "text";
16
+ text: string;
17
+ _meta?: GenerationContentBlockMeta;
18
+ } | {
19
+ type: "image";
20
+ source: GenerationSource;
21
+ _meta?: GenerationContentBlockMeta;
22
+ } | {
23
+ type: "video";
24
+ source: GenerationSource;
25
+ _meta?: GenerationContentBlockMeta;
26
+ } | {
27
+ type: "audio";
28
+ source: GenerationSource;
29
+ _meta?: GenerationContentBlockMeta;
30
+ };
31
+ export type CreateGenerationRequest = {
32
+ model: string;
33
+ content: GenerationContentBlock[];
34
+ parameters?: Record<string, unknown>;
35
+ metadata?: Record<string, unknown>;
36
+ };
37
+ export type GenerationStatus = "queued" | "running" | "succeeded" | "failed" | "cancelled";
38
+ export type Generation = {
39
+ id: string;
40
+ status: GenerationStatus;
41
+ model: string;
42
+ input: GenerationContentBlock[];
43
+ output?: GenerationContentBlock[];
44
+ parameters?: Record<string, unknown>;
45
+ metadata?: Record<string, unknown>;
46
+ error?: {
47
+ code?: string;
48
+ message: string;
49
+ raw?: unknown;
50
+ };
51
+ created_at: string;
52
+ updated_at: string;
53
+ completed_at?: string;
54
+ };
55
+ export type GenerationContentSpec = {
56
+ type: "text" | "image" | "video" | "audio";
57
+ required?: boolean;
58
+ min?: number;
59
+ max?: number;
60
+ sources?: Array<"url" | "base64" | "space_file">;
61
+ merge?: "newline" | "space" | "concat";
62
+ meta?: Record<string, unknown>;
63
+ description?: string;
64
+ };
65
+ export type GenerationParameterSpec = {
66
+ type: "string";
67
+ optional?: boolean;
68
+ default?: string;
69
+ enum?: string[];
70
+ description?: string;
71
+ examples?: string[];
72
+ } | {
73
+ type: "number";
74
+ optional?: boolean;
75
+ default?: number;
76
+ min?: number;
77
+ max?: number;
78
+ description?: string;
79
+ examples?: number[];
80
+ } | {
81
+ type: "integer";
82
+ optional?: boolean;
83
+ default?: number;
84
+ min?: number;
85
+ max?: number;
86
+ description?: string;
87
+ examples?: number[];
88
+ } | {
89
+ type: "boolean";
90
+ optional?: boolean;
91
+ default?: boolean;
92
+ description?: string;
93
+ examples?: boolean[];
94
+ };
95
+ export type GenerationDeclaration = {
96
+ schema: "cohub.generation.v1";
97
+ model: string;
98
+ title?: string;
99
+ description?: string;
100
+ adapter: {
101
+ type: string;
102
+ base_url: string;
103
+ api_key: string;
104
+ };
105
+ content: {
106
+ input: GenerationContentSpec[];
107
+ };
108
+ parameters?: Record<string, GenerationParameterSpec>;
109
+ examples?: Array<{
110
+ title?: string;
111
+ request: CreateGenerationRequest;
112
+ }>;
113
+ };
114
+ export type PublicGenerationDeclaration = Omit<GenerationDeclaration, "adapter">;
115
+ export type ListGenerationDeclarationsResponse = {
116
+ declarations: PublicGenerationDeclaration[];
117
+ };
@@ -0,0 +1 @@
1
+ export {};
package/dist/index.d.ts CHANGED
@@ -8,3 +8,4 @@ export * from "./gateway/index.js";
8
8
  export * from "./task/index.js";
9
9
  export * from "./fs/index.js";
10
10
  export * from "./ports/index.js";
11
+ export * from "./generation/index.js";
package/dist/index.js CHANGED
@@ -8,3 +8,4 @@ export * from "./gateway/index.js";
8
8
  export * from "./task/index.js";
9
9
  export * from "./fs/index.js";
10
10
  export * from "./ports/index.js";
11
+ export * from "./generation/index.js";
@@ -1,5 +1,29 @@
1
1
  import type { ContentBlock } from "../core/content.js";
2
2
  import type { Usage } from "../core/usage.js";
3
+ export type SessionForkRecord = {
4
+ id: string;
5
+ spaceId: string;
6
+ parentSessionId: string;
7
+ childSessionId: string;
8
+ rootSessionId: string;
9
+ depth: number;
10
+ anchorSourceSessionId: string;
11
+ anchorTurnId: string;
12
+ anchorSequence: number;
13
+ ancestorSessionIds: string[];
14
+ sessionPath: string[];
15
+ createdBy: string | null;
16
+ createdAt: string;
17
+ };
18
+ export type SessionTurnSegmentRecord = {
19
+ id: string;
20
+ sessionId: string;
21
+ ordinal: number;
22
+ sourceSessionId: string;
23
+ fromSequence: number;
24
+ toSequence: number | null;
25
+ createdAt: string;
26
+ };
3
27
  export type { MessageToolCallsFile, SessionTurnIntent, SessionTurnIntermediateIndex, SessionTurnIntermediateSummary, SessionTurnIndexItem, SessionTurnRecord, SessionTurnStatus, SessionTurnSummary, StoredIntermediateMessage, StoredToolCall, TurnIntermediateMessagesFile, } from "./turn.js";
4
28
  export type SessionPromptInput = {
5
29
  spaceId: string;
@@ -74,10 +98,6 @@ export type SessionRecord = {
74
98
  status: string | null;
75
99
  externalSessionId: string | null;
76
100
  meta: Record<string, unknown> | null;
77
- parentSessionId: string | null;
78
- forkedFromMessageId: string | null;
79
- lineageRootSessionId: string | null;
80
- forkDepth: number;
81
101
  latestMessageText: string | null;
82
102
  lastMessageAt: string | null;
83
103
  lastMessageId: string | null;
@@ -67,6 +67,8 @@ export type TurnIntermediateMessagesFile = {
67
67
  export type SessionTurnIndexItem = {
68
68
  id: string;
69
69
  sessionId: string;
70
+ sourceSessionId?: string;
71
+ sourceTurnId?: string;
70
72
  sequence: number;
71
73
  status: SessionTurnStatus;
72
74
  startedAt: string | null;
@@ -89,6 +91,8 @@ export type SessionTurnAuthorProfile = {
89
91
  export type SessionTurnRecord = {
90
92
  id: string;
91
93
  sessionId: string;
94
+ sourceSessionId?: string;
95
+ sourceTurnId?: string;
92
96
  userUuid: string | null;
93
97
  sequence: number;
94
98
  status: SessionTurnStatus;
@@ -24,6 +24,11 @@ export declare const contentBlockSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
24
24
  data: z.ZodString;
25
25
  }, z.core.$strip>]>;
26
26
  _meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
27
+ }, z.core.$strip>, z.ZodObject<{
28
+ type: z.ZodLiteral<"shell_command">;
29
+ command: z.ZodString;
30
+ rawText: z.ZodString;
31
+ _meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
27
32
  }, z.core.$strip>, z.ZodObject<{
28
33
  type: z.ZodLiteral<"tool_use">;
29
34
  id: z.ZodString;
@@ -81,6 +86,11 @@ export declare const wsClientEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
81
86
  data: z.ZodString;
82
87
  }, z.core.$strip>]>;
83
88
  _meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
89
+ }, z.core.$strip>, z.ZodObject<{
90
+ type: z.ZodLiteral<"shell_command">;
91
+ command: z.ZodString;
92
+ rawText: z.ZodString;
93
+ _meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
84
94
  }, z.core.$strip>, z.ZodObject<{
85
95
  type: z.ZodLiteral<"tool_use">;
86
96
  id: z.ZodString;
@@ -21,6 +21,12 @@ export const contentBlockSchema = z.discriminatedUnion("type", [
21
21
  ]),
22
22
  _meta: contentBlockMetaSchema.optional(),
23
23
  }),
24
+ z.object({
25
+ type: z.literal("shell_command"),
26
+ command: z.string(),
27
+ rawText: z.string(),
28
+ _meta: contentBlockMetaSchema.optional(),
29
+ }),
24
30
  z.object({
25
31
  type: z.literal("tool_use"),
26
32
  id: z.string(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neta-art/cohub-protocol",
3
- "version": "1.4.0",
3
+ "version": "1.6.0",
4
4
  "description": "Shared protocol definitions for the Cohub agent collaboration platform.",
5
5
  "license": "UNLICENSED",
6
6
  "private": false,
@@ -56,6 +56,10 @@
56
56
  "./ports": {
57
57
  "types": "./dist/ports/index.d.ts",
58
58
  "default": "./dist/ports/index.js"
59
+ },
60
+ "./generation": {
61
+ "types": "./dist/generation/index.d.ts",
62
+ "default": "./dist/generation/index.js"
59
63
  }
60
64
  },
61
65
  "types": "./dist/index.d.ts",