blanchon commited on
Commit
c30abb6
·
1 Parent(s): 6d513c6
client/dist/generated/index.d.ts ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ export * from './schemas.gen';
2
+ export * from './services.gen';
3
+ export * from './types.gen';
4
+ //# sourceMappingURL=index.d.ts.map
client/dist/generated/index.d.ts.map ADDED
@@ -0,0 +1 @@
 
 
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/generated/index.ts"],"names":[],"mappings":"AACA,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC"}
client/dist/generated/schemas.gen.d.ts ADDED
@@ -0,0 +1,176 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ export declare const CreateSessionRequestSchema: {
2
+ readonly properties: {
3
+ readonly session_id: {
4
+ readonly type: "string";
5
+ readonly title: "Session Id";
6
+ };
7
+ readonly policy_path: {
8
+ readonly type: "string";
9
+ readonly title: "Policy Path";
10
+ };
11
+ readonly camera_names: {
12
+ readonly items: {
13
+ readonly type: "string";
14
+ };
15
+ readonly type: "array";
16
+ readonly title: "Camera Names";
17
+ readonly default: readonly ["front"];
18
+ };
19
+ readonly arena_server_url: {
20
+ readonly type: "string";
21
+ readonly title: "Arena Server Url";
22
+ readonly default: "http://localhost:8000";
23
+ };
24
+ readonly workspace_id: {
25
+ readonly anyOf: readonly [{
26
+ readonly type: "string";
27
+ }, {
28
+ readonly type: "null";
29
+ }];
30
+ readonly title: "Workspace Id";
31
+ };
32
+ readonly policy_type: {
33
+ readonly type: "string";
34
+ readonly title: "Policy Type";
35
+ readonly default: "act";
36
+ };
37
+ readonly language_instruction: {
38
+ readonly anyOf: readonly [{
39
+ readonly type: "string";
40
+ }, {
41
+ readonly type: "null";
42
+ }];
43
+ readonly title: "Language Instruction";
44
+ };
45
+ };
46
+ readonly type: "object";
47
+ readonly required: readonly ["session_id", "policy_path"];
48
+ readonly title: "CreateSessionRequest";
49
+ };
50
+ export declare const CreateSessionResponseSchema: {
51
+ readonly properties: {
52
+ readonly workspace_id: {
53
+ readonly type: "string";
54
+ readonly title: "Workspace Id";
55
+ };
56
+ readonly camera_room_ids: {
57
+ readonly additionalProperties: {
58
+ readonly type: "string";
59
+ };
60
+ readonly type: "object";
61
+ readonly title: "Camera Room Ids";
62
+ };
63
+ readonly joint_input_room_id: {
64
+ readonly type: "string";
65
+ readonly title: "Joint Input Room Id";
66
+ };
67
+ readonly joint_output_room_id: {
68
+ readonly type: "string";
69
+ readonly title: "Joint Output Room Id";
70
+ };
71
+ };
72
+ readonly type: "object";
73
+ readonly required: readonly ["workspace_id", "camera_room_ids", "joint_input_room_id", "joint_output_room_id"];
74
+ readonly title: "CreateSessionResponse";
75
+ };
76
+ export declare const HTTPValidationErrorSchema: {
77
+ readonly properties: {
78
+ readonly detail: {
79
+ readonly items: {
80
+ readonly $ref: "#/components/schemas/ValidationError";
81
+ };
82
+ readonly type: "array";
83
+ readonly title: "Detail";
84
+ };
85
+ };
86
+ readonly type: "object";
87
+ readonly title: "HTTPValidationError";
88
+ };
89
+ export declare const SessionStatusResponseSchema: {
90
+ readonly properties: {
91
+ readonly session_id: {
92
+ readonly type: "string";
93
+ readonly title: "Session Id";
94
+ };
95
+ readonly status: {
96
+ readonly type: "string";
97
+ readonly title: "Status";
98
+ };
99
+ readonly policy_path: {
100
+ readonly type: "string";
101
+ readonly title: "Policy Path";
102
+ };
103
+ readonly policy_type: {
104
+ readonly type: "string";
105
+ readonly title: "Policy Type";
106
+ };
107
+ readonly camera_names: {
108
+ readonly items: {
109
+ readonly type: "string";
110
+ };
111
+ readonly type: "array";
112
+ readonly title: "Camera Names";
113
+ };
114
+ readonly workspace_id: {
115
+ readonly type: "string";
116
+ readonly title: "Workspace Id";
117
+ };
118
+ readonly rooms: {
119
+ readonly additionalProperties: true;
120
+ readonly type: "object";
121
+ readonly title: "Rooms";
122
+ };
123
+ readonly stats: {
124
+ readonly additionalProperties: true;
125
+ readonly type: "object";
126
+ readonly title: "Stats";
127
+ };
128
+ readonly inference_stats: {
129
+ readonly anyOf: readonly [{
130
+ readonly additionalProperties: true;
131
+ readonly type: "object";
132
+ }, {
133
+ readonly type: "null";
134
+ }];
135
+ readonly title: "Inference Stats";
136
+ };
137
+ readonly error_message: {
138
+ readonly anyOf: readonly [{
139
+ readonly type: "string";
140
+ }, {
141
+ readonly type: "null";
142
+ }];
143
+ readonly title: "Error Message";
144
+ };
145
+ };
146
+ readonly type: "object";
147
+ readonly required: readonly ["session_id", "status", "policy_path", "policy_type", "camera_names", "workspace_id", "rooms", "stats"];
148
+ readonly title: "SessionStatusResponse";
149
+ };
150
+ export declare const ValidationErrorSchema: {
151
+ readonly properties: {
152
+ readonly loc: {
153
+ readonly items: {
154
+ readonly anyOf: readonly [{
155
+ readonly type: "string";
156
+ }, {
157
+ readonly type: "integer";
158
+ }];
159
+ };
160
+ readonly type: "array";
161
+ readonly title: "Location";
162
+ };
163
+ readonly msg: {
164
+ readonly type: "string";
165
+ readonly title: "Message";
166
+ };
167
+ readonly type: {
168
+ readonly type: "string";
169
+ readonly title: "Error Type";
170
+ };
171
+ };
172
+ readonly type: "object";
173
+ readonly required: readonly ["loc", "msg", "type"];
174
+ readonly title: "ValidationError";
175
+ };
176
+ //# sourceMappingURL=schemas.gen.d.ts.map
client/dist/generated/schemas.gen.d.ts.map ADDED
@@ -0,0 +1 @@
 
 
1
+ {"version":3,"file":"schemas.gen.d.ts","sourceRoot":"","sources":["../../../../src/generated/schemas.gen.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsD7B,CAAC;AAEX,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;CAyB9B,CAAC;AAEX,eAAO,MAAM,yBAAyB;;;;;;;;;;;;CAY5B,CAAC;AAEX,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkE9B,CAAC;AAEX,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;CA4BxB,CAAC"}
client/dist/generated/services.gen.d.ts ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { type Options } from '@hey-api/client-fetch';
2
+ import type { ListSessionsSessionsGetResponse, CreateSessionSessionsPostData, GetSessionStatusSessionsSessionIdGetData, DeleteSessionSessionsSessionIdDeleteData, StartInferenceSessionsSessionIdStartPostData, StopInferenceSessionsSessionIdStopPostData, RestartInferenceSessionsSessionIdRestartPostData, DebugResetSessionDebugSessionsSessionIdResetPostData, GetSessionQueueInfoDebugSessionsSessionIdQueueGetData } from './types.gen';
3
+ export declare const client: import("@hey-api/client-fetch").Client<Request, Response, import("@hey-api/client-fetch").RequestOptions>;
4
+ /**
5
+ * Root
6
+ * Health check endpoint.
7
+ */
8
+ export declare const rootGet: <ThrowOnError extends boolean = false>(options?: Options<unknown, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<unknown, unknown, ThrowOnError>;
9
+ /**
10
+ * Health Check
11
+ * Detailed health check.
12
+ */
13
+ export declare const healthCheckHealthGet: <ThrowOnError extends boolean = false>(options?: Options<unknown, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<unknown, unknown, ThrowOnError>;
14
+ /**
15
+ * List Policies
16
+ * List supported policy types.
17
+ */
18
+ export declare const listPoliciesPoliciesGet: <ThrowOnError extends boolean = false>(options?: Options<unknown, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<unknown, unknown, ThrowOnError>;
19
+ /**
20
+ * List Sessions
21
+ * List all sessions.
22
+ */
23
+ export declare const listSessionsSessionsGet: <ThrowOnError extends boolean = false>(options?: Options<unknown, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<ListSessionsSessionsGetResponse, unknown, ThrowOnError>;
24
+ /**
25
+ * Create Session
26
+ * Create a new inference session.
27
+ *
28
+ * If workspace_id is provided, all rooms will be created in that workspace.
29
+ * If workspace_id is not provided, a new workspace will be generated automatically.
30
+ * All rooms for a session (cameras + joints) are always created in the same workspace.
31
+ */
32
+ export declare const createSessionSessionsPost: <ThrowOnError extends boolean = false>(options: Options<CreateSessionSessionsPostData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").CreateSessionResponse, import("./types.gen").HTTPValidationError, ThrowOnError>;
33
+ /**
34
+ * Get Session Status
35
+ * Get status of a specific session.
36
+ */
37
+ export declare const getSessionStatusSessionsSessionIdGet: <ThrowOnError extends boolean = false>(options: Options<GetSessionStatusSessionsSessionIdGetData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").SessionStatusResponse, import("./types.gen").HTTPValidationError, ThrowOnError>;
38
+ /**
39
+ * Delete Session
40
+ * Delete a session.
41
+ */
42
+ export declare const deleteSessionSessionsSessionIdDelete: <ThrowOnError extends boolean = false>(options: Options<DeleteSessionSessionsSessionIdDeleteData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<unknown, import("./types.gen").HTTPValidationError, ThrowOnError>;
43
+ /**
44
+ * Start Inference
45
+ * Start inference for a session.
46
+ */
47
+ export declare const startInferenceSessionsSessionIdStartPost: <ThrowOnError extends boolean = false>(options: Options<StartInferenceSessionsSessionIdStartPostData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<unknown, import("./types.gen").HTTPValidationError, ThrowOnError>;
48
+ /**
49
+ * Stop Inference
50
+ * Stop inference for a session.
51
+ */
52
+ export declare const stopInferenceSessionsSessionIdStopPost: <ThrowOnError extends boolean = false>(options: Options<StopInferenceSessionsSessionIdStopPostData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<unknown, import("./types.gen").HTTPValidationError, ThrowOnError>;
53
+ /**
54
+ * Restart Inference
55
+ * Restart inference for a session.
56
+ */
57
+ export declare const restartInferenceSessionsSessionIdRestartPost: <ThrowOnError extends boolean = false>(options: Options<RestartInferenceSessionsSessionIdRestartPostData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<unknown, import("./types.gen").HTTPValidationError, ThrowOnError>;
58
+ /**
59
+ * Get System Info
60
+ * Get system information for debugging.
61
+ */
62
+ export declare const getSystemInfoDebugSystemGet: <ThrowOnError extends boolean = false>(options?: Options<unknown, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<unknown, unknown, ThrowOnError>;
63
+ /**
64
+ * Get Recent Logs
65
+ * Get recent log entries for debugging.
66
+ */
67
+ export declare const getRecentLogsDebugLogsGet: <ThrowOnError extends boolean = false>(options?: Options<unknown, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<unknown, unknown, ThrowOnError>;
68
+ /**
69
+ * Debug Reset Session
70
+ * Reset a session's internal state for debugging.
71
+ */
72
+ export declare const debugResetSessionDebugSessionsSessionIdResetPost: <ThrowOnError extends boolean = false>(options: Options<DebugResetSessionDebugSessionsSessionIdResetPostData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<unknown, import("./types.gen").HTTPValidationError, ThrowOnError>;
73
+ /**
74
+ * Get Session Queue Info
75
+ * Get detailed information about a session's action queue.
76
+ */
77
+ export declare const getSessionQueueInfoDebugSessionsSessionIdQueueGet: <ThrowOnError extends boolean = false>(options: Options<GetSessionQueueInfoDebugSessionsSessionIdQueueGetData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<unknown, import("./types.gen").HTTPValidationError, ThrowOnError>;
78
+ //# sourceMappingURL=services.gen.d.ts.map
client/dist/generated/services.gen.d.ts.map ADDED
@@ -0,0 +1 @@
 
 
1
+ {"version":3,"file":"services.gen.d.ts","sourceRoot":"","sources":["../../../../src/generated/services.gen.ts"],"names":[],"mappings":"AAEA,OAAO,EAA8B,KAAK,OAAO,EAAE,MAAM,uBAAuB,CAAC;AACjF,OAAO,KAAK,EAAuL,+BAA+B,EAAE,6BAA6B,EAAqE,wCAAwC,EAA2F,wCAAwC,EAA2F,4CAA4C,EAAmG,0CAA0C,EAA+F,gDAAgD,EAAqP,oDAAoD,EAAmH,qDAAqD,EAAqH,MAAM,aAAa,CAAC;AAE9+C,eAAO,MAAM,MAAM,2GAA+B,CAAC;AAEnD;;;GAGG;AACH,eAAO,MAAM,OAAO,GAAI,YAAY,SAAS,OAAO,GAAG,KAAK,EAAE,UAAU,OAAO,CAAC,OAAO,EAAE,YAAY,CAAC,kFAKrG,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,oBAAoB,GAAI,YAAY,SAAS,OAAO,GAAG,KAAK,EAAE,UAAU,OAAO,CAAC,OAAO,EAAE,YAAY,CAAC,kFAKlH,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,uBAAuB,GAAI,YAAY,SAAS,OAAO,GAAG,KAAK,EAAE,UAAU,OAAO,CAAC,OAAO,EAAE,YAAY,CAAC,kFAKrH,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,uBAAuB,GAAI,YAAY,SAAS,OAAO,GAAG,KAAK,EAAE,UAAU,OAAO,CAAC,OAAO,EAAE,YAAY,CAAC,0GAKrH,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,yBAAyB,GAAI,YAAY,SAAS,OAAO,GAAG,KAAK,EAAE,SAAS,OAAO,CAAC,6BAA6B,EAAE,YAAY,CAAC,wJAK5I,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,oCAAoC,GAAI,YAAY,SAAS,OAAO,GAAG,KAAK,EAAE,SAAS,OAAO,CAAC,wCAAwC,EAAE,YAAY,CAAC,wJAKlK,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,oCAAoC,GAAI,YAAY,SAAS,OAAO,GAAG,KAAK,EAAE,SAAS,OAAO,CAAC,wCAAwC,EAAE,YAAY,CAAC,oHAKlK,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,wCAAwC,GAAI,YAAY,SAAS,OAAO,GAAG,KAAK,EAAE,SAAS,OAAO,CAAC,4CAA4C,EAAE,YAAY,CAAC,oHAK1K,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,sCAAsC,GAAI,YAAY,SAAS,OAAO,GAAG,KAAK,EAAE,SAAS,OAAO,CAAC,0CAA0C,EAAE,YAAY,CAAC,oHAKtK,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,4CAA4C,GAAI,YAAY,SAAS,OAAO,GAAG,KAAK,EAAE,SAAS,OAAO,CAAC,gDAAgD,EAAE,YAAY,CAAC,oHAKlL,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,2BAA2B,GAAI,YAAY,SAAS,OAAO,GAAG,KAAK,EAAE,UAAU,OAAO,CAAC,OAAO,EAAE,YAAY,CAAC,kFAKzH,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,yBAAyB,GAAI,YAAY,SAAS,OAAO,GAAG,KAAK,EAAE,UAAU,OAAO,CAAC,OAAO,EAAE,YAAY,CAAC,kFAKvH,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,gDAAgD,GAAI,YAAY,SAAS,OAAO,GAAG,KAAK,EAAE,SAAS,OAAO,CAAC,oDAAoD,EAAE,YAAY,CAAC,oHAK1L,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,iDAAiD,GAAI,YAAY,SAAS,OAAO,GAAG,KAAK,EAAE,SAAS,OAAO,CAAC,qDAAqD,EAAE,YAAY,CAAC,oHAK5L,CAAC"}
client/dist/generated/types.gen.d.ts ADDED
@@ -0,0 +1,110 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ export type CreateSessionRequest = {
2
+ session_id: string;
3
+ policy_path: string;
4
+ camera_names?: Array<(string)>;
5
+ arena_server_url?: string;
6
+ workspace_id?: (string | null);
7
+ policy_type?: string;
8
+ language_instruction?: (string | null);
9
+ };
10
+ export type CreateSessionResponse = {
11
+ workspace_id: string;
12
+ camera_room_ids: {
13
+ [key: string]: (string);
14
+ };
15
+ joint_input_room_id: string;
16
+ joint_output_room_id: string;
17
+ };
18
+ export type HTTPValidationError = {
19
+ detail?: Array<ValidationError>;
20
+ };
21
+ export type SessionStatusResponse = {
22
+ session_id: string;
23
+ status: string;
24
+ policy_path: string;
25
+ policy_type: string;
26
+ camera_names: Array<(string)>;
27
+ workspace_id: string;
28
+ rooms: {
29
+ [key: string]: unknown;
30
+ };
31
+ stats: {
32
+ [key: string]: unknown;
33
+ };
34
+ inference_stats?: ({
35
+ [key: string]: unknown;
36
+ } | null);
37
+ error_message?: (string | null);
38
+ };
39
+ export type ValidationError = {
40
+ loc: Array<(string | number)>;
41
+ msg: string;
42
+ type: string;
43
+ };
44
+ export type RootGetResponse = (unknown);
45
+ export type RootGetError = unknown;
46
+ export type HealthCheckHealthGetResponse = (unknown);
47
+ export type HealthCheckHealthGetError = unknown;
48
+ export type ListPoliciesPoliciesGetResponse = (unknown);
49
+ export type ListPoliciesPoliciesGetError = unknown;
50
+ export type ListSessionsSessionsGetResponse = (Array<SessionStatusResponse>);
51
+ export type ListSessionsSessionsGetError = unknown;
52
+ export type CreateSessionSessionsPostData = {
53
+ body: CreateSessionRequest;
54
+ };
55
+ export type CreateSessionSessionsPostResponse = (CreateSessionResponse);
56
+ export type CreateSessionSessionsPostError = (HTTPValidationError);
57
+ export type GetSessionStatusSessionsSessionIdGetData = {
58
+ path: {
59
+ session_id: string;
60
+ };
61
+ };
62
+ export type GetSessionStatusSessionsSessionIdGetResponse = (SessionStatusResponse);
63
+ export type GetSessionStatusSessionsSessionIdGetError = (HTTPValidationError);
64
+ export type DeleteSessionSessionsSessionIdDeleteData = {
65
+ path: {
66
+ session_id: string;
67
+ };
68
+ };
69
+ export type DeleteSessionSessionsSessionIdDeleteResponse = (unknown);
70
+ export type DeleteSessionSessionsSessionIdDeleteError = (HTTPValidationError);
71
+ export type StartInferenceSessionsSessionIdStartPostData = {
72
+ path: {
73
+ session_id: string;
74
+ };
75
+ };
76
+ export type StartInferenceSessionsSessionIdStartPostResponse = (unknown);
77
+ export type StartInferenceSessionsSessionIdStartPostError = (HTTPValidationError);
78
+ export type StopInferenceSessionsSessionIdStopPostData = {
79
+ path: {
80
+ session_id: string;
81
+ };
82
+ };
83
+ export type StopInferenceSessionsSessionIdStopPostResponse = (unknown);
84
+ export type StopInferenceSessionsSessionIdStopPostError = (HTTPValidationError);
85
+ export type RestartInferenceSessionsSessionIdRestartPostData = {
86
+ path: {
87
+ session_id: string;
88
+ };
89
+ };
90
+ export type RestartInferenceSessionsSessionIdRestartPostResponse = (unknown);
91
+ export type RestartInferenceSessionsSessionIdRestartPostError = (HTTPValidationError);
92
+ export type GetSystemInfoDebugSystemGetResponse = (unknown);
93
+ export type GetSystemInfoDebugSystemGetError = unknown;
94
+ export type GetRecentLogsDebugLogsGetResponse = (unknown);
95
+ export type GetRecentLogsDebugLogsGetError = unknown;
96
+ export type DebugResetSessionDebugSessionsSessionIdResetPostData = {
97
+ path: {
98
+ session_id: string;
99
+ };
100
+ };
101
+ export type DebugResetSessionDebugSessionsSessionIdResetPostResponse = (unknown);
102
+ export type DebugResetSessionDebugSessionsSessionIdResetPostError = (HTTPValidationError);
103
+ export type GetSessionQueueInfoDebugSessionsSessionIdQueueGetData = {
104
+ path: {
105
+ session_id: string;
106
+ };
107
+ };
108
+ export type GetSessionQueueInfoDebugSessionsSessionIdQueueGetResponse = (unknown);
109
+ export type GetSessionQueueInfoDebugSessionsSessionIdQueueGetError = (HTTPValidationError);
110
+ //# sourceMappingURL=types.gen.d.ts.map
client/dist/generated/types.gen.d.ts.map ADDED
@@ -0,0 +1 @@
 
 
1
+ {"version":3,"file":"types.gen.d.ts","sourceRoot":"","sources":["../../../../src/generated/types.gen.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,oBAAoB,GAAG;IAC/B,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;IAC/B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,YAAY,CAAC,EAAE,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAC/B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,oBAAoB,CAAC,EAAE,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;CAC1C,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAChC,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE;QACb,CAAC,GAAG,EAAE,MAAM,GAAG,CAAC,MAAM,CAAC,CAAC;KAC3B,CAAC;IACF,mBAAmB,EAAE,MAAM,CAAC;IAC5B,oBAAoB,EAAE,MAAM,CAAC;CAChC,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAC9B,MAAM,CAAC,EAAE,KAAK,CAAC,eAAe,CAAC,CAAC;CACnC,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAChC,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;IAC9B,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE;QACH,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;KAC1B,CAAC;IACF,KAAK,EAAE;QACH,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;KAC1B,CAAC;IACF,eAAe,CAAC,EAAE,CAAC;QACnB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;KAC1B,GAAG,IAAI,CAAC,CAAC;IACN,aAAa,CAAC,EAAE,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;CACnC,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC1B,GAAG,EAAE,KAAK,CAAC,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,CAAC,CAAC;AAExC,MAAM,MAAM,YAAY,GAAG,OAAO,CAAC;AAEnC,MAAM,MAAM,4BAA4B,GAAG,CAAC,OAAO,CAAC,CAAC;AAErD,MAAM,MAAM,yBAAyB,GAAG,OAAO,CAAC;AAEhD,MAAM,MAAM,+BAA+B,GAAG,CAAC,OAAO,CAAC,CAAC;AAExD,MAAM,MAAM,4BAA4B,GAAG,OAAO,CAAC;AAEnD,MAAM,MAAM,+BAA+B,GAAG,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC,CAAC;AAE7E,MAAM,MAAM,4BAA4B,GAAG,OAAO,CAAC;AAEnD,MAAM,MAAM,6BAA6B,GAAG;IACxC,IAAI,EAAE,oBAAoB,CAAC;CAC9B,CAAC;AAEF,MAAM,MAAM,iCAAiC,GAAG,CAAC,qBAAqB,CAAC,CAAC;AAExE,MAAM,MAAM,8BAA8B,GAAG,CAAC,mBAAmB,CAAC,CAAC;AAEnE,MAAM,MAAM,wCAAwC,GAAG;IACnD,IAAI,EAAE;QACF,UAAU,EAAE,MAAM,CAAC;KACtB,CAAC;CACL,CAAC;AAEF,MAAM,MAAM,4CAA4C,GAAG,CAAC,qBAAqB,CAAC,CAAC;AAEnF,MAAM,MAAM,yCAAyC,GAAG,CAAC,mBAAmB,CAAC,CAAC;AAE9E,MAAM,MAAM,wCAAwC,GAAG;IACnD,IAAI,EAAE;QACF,UAAU,EAAE,MAAM,CAAC;KACtB,CAAC;CACL,CAAC;AAEF,MAAM,MAAM,4CAA4C,GAAG,CAAC,OAAO,CAAC,CAAC;AAErE,MAAM,MAAM,yCAAyC,GAAG,CAAC,mBAAmB,CAAC,CAAC;AAE9E,MAAM,MAAM,4CAA4C,GAAG;IACvD,IAAI,EAAE;QACF,UAAU,EAAE,MAAM,CAAC;KACtB,CAAC;CACL,CAAC;AAEF,MAAM,MAAM,gDAAgD,GAAG,CAAC,OAAO,CAAC,CAAC;AAEzE,MAAM,MAAM,6CAA6C,GAAG,CAAC,mBAAmB,CAAC,CAAC;AAElF,MAAM,MAAM,0CAA0C,GAAG;IACrD,IAAI,EAAE;QACF,UAAU,EAAE,MAAM,CAAC;KACtB,CAAC;CACL,CAAC;AAEF,MAAM,MAAM,8CAA8C,GAAG,CAAC,OAAO,CAAC,CAAC;AAEvE,MAAM,MAAM,2CAA2C,GAAG,CAAC,mBAAmB,CAAC,CAAC;AAEhF,MAAM,MAAM,gDAAgD,GAAG;IAC3D,IAAI,EAAE;QACF,UAAU,EAAE,MAAM,CAAC;KACtB,CAAC;CACL,CAAC;AAEF,MAAM,MAAM,oDAAoD,GAAG,CAAC,OAAO,CAAC,CAAC;AAE7E,MAAM,MAAM,iDAAiD,GAAG,CAAC,mBAAmB,CAAC,CAAC;AAEtF,MAAM,MAAM,mCAAmC,GAAG,CAAC,OAAO,CAAC,CAAC;AAE5D,MAAM,MAAM,gCAAgC,GAAG,OAAO,CAAC;AAEvD,MAAM,MAAM,iCAAiC,GAAG,CAAC,OAAO,CAAC,CAAC;AAE1D,MAAM,MAAM,8BAA8B,GAAG,OAAO,CAAC;AAErD,MAAM,MAAM,oDAAoD,GAAG;IAC/D,IAAI,EAAE;QACF,UAAU,EAAE,MAAM,CAAC;KACtB,CAAC;CACL,CAAC;AAEF,MAAM,MAAM,wDAAwD,GAAG,CAAC,OAAO,CAAC,CAAC;AAEjF,MAAM,MAAM,qDAAqD,GAAG,CAAC,mBAAmB,CAAC,CAAC;AAE1F,MAAM,MAAM,qDAAqD,GAAG;IAChE,IAAI,EAAE;QACF,UAAU,EAAE,MAAM,CAAC;KACtB,CAAC;CACL,CAAC;AAEF,MAAM,MAAM,yDAAyD,GAAG,CAAC,OAAO,CAAC,CAAC;AAElF,MAAM,MAAM,sDAAsD,GAAG,CAAC,mBAAmB,CAAC,CAAC"}
client/dist/index.d.ts ADDED
@@ -0,0 +1,102 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * LeRobot Arena Inference Server TypeScript Client
3
+ *
4
+ * This client provides TypeScript access to the LeRobot Arena Inference Server
5
+ * for ACT (Action Chunking Transformer) model inference and session management.
6
+ *
7
+ * @example Basic Usage
8
+ * ```typescript
9
+ * import { LeRobotInferenceServerClient, CreateSessionRequest } from '@lerobot-arena/inference-server-client';
10
+ *
11
+ * const client = new LeRobotInferenceServerClient('http://localhost:8001');
12
+ *
13
+ * // Create and start a session
14
+ * const sessionRequest: CreateSessionRequest = {
15
+ * session_id: 'my-robot-01',
16
+ * policy_path: './checkpoints/act_so101_beyond',
17
+ * camera_names: ['front', 'wrist'],
18
+ * arena_server_url: 'http://localhost:8000'
19
+ * };
20
+ *
21
+ * const session = await client.createSession(sessionRequest);
22
+ * await client.startInference('my-robot-01');
23
+ *
24
+ * // Monitor session
25
+ * const status = await client.getSessionStatus('my-robot-01');
26
+ * console.log(`Session status: ${status.status}`);
27
+ * ```
28
+ */
29
+ export * from './generated';
30
+ import type { CreateSessionRequest, CreateSessionResponse, SessionStatusResponse } from './generated';
31
+ /**
32
+ * LeRobot Arena Inference Server Client
33
+ *
34
+ * A convenience wrapper around the generated OpenAPI client that provides
35
+ * a simpler interface for common operations while maintaining full type safety.
36
+ */
37
+ export declare class LeRobotInferenceServerClient {
38
+ private baseUrl;
39
+ constructor(baseUrl: string);
40
+ /**
41
+ * Check if the inference server is healthy and responding
42
+ */
43
+ isHealthy(): Promise<boolean>;
44
+ /**
45
+ * Get detailed server health information
46
+ */
47
+ getHealth(): Promise<unknown>;
48
+ /**
49
+ * Create a new inference session
50
+ */
51
+ createSession(request: CreateSessionRequest): Promise<CreateSessionResponse>;
52
+ /**
53
+ * List all active sessions
54
+ */
55
+ listSessions(): Promise<SessionStatusResponse[]>;
56
+ /**
57
+ * Get detailed status of a specific session
58
+ */
59
+ getSessionStatus(sessionId: string): Promise<SessionStatusResponse>;
60
+ /**
61
+ * Start inference for a session
62
+ */
63
+ startInference(sessionId: string): Promise<void>;
64
+ /**
65
+ * Stop inference for a session
66
+ */
67
+ stopInference(sessionId: string): Promise<void>;
68
+ /**
69
+ * Restart inference for a session
70
+ */
71
+ restartInference(sessionId: string): Promise<void>;
72
+ /**
73
+ * Delete a session and clean up all resources
74
+ */
75
+ deleteSession(sessionId: string): Promise<void>;
76
+ /**
77
+ * Wait for a session to reach a specific status
78
+ */
79
+ waitForSessionStatus(sessionId: string, targetStatus: string, timeoutMs?: number): Promise<SessionStatusResponse>;
80
+ /**
81
+ * Convenience method to create a session and start inference in one call
82
+ */
83
+ createAndStartSession(request: CreateSessionRequest): Promise<{
84
+ session: CreateSessionResponse;
85
+ status: SessionStatusResponse;
86
+ }>;
87
+ /**
88
+ * Get system information for debugging
89
+ */
90
+ getSystemInfo(): Promise<unknown>;
91
+ /**
92
+ * Reset a session's internal state (debug method)
93
+ */
94
+ debugResetSession(sessionId: string): Promise<void>;
95
+ /**
96
+ * Get detailed information about a session's action queue
97
+ */
98
+ getSessionQueueInfo(sessionId: string): Promise<unknown>;
99
+ }
100
+ export declare function createClient(baseUrl: string): LeRobotInferenceServerClient;
101
+ export declare const LeRobotAIServerClient: typeof LeRobotInferenceServerClient;
102
+ //# sourceMappingURL=index.d.ts.map
client/dist/index.d.ts.map ADDED
@@ -0,0 +1 @@
 
 
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAGH,cAAc,aAAa,CAAC;AAkB5B,OAAO,KAAK,EACV,oBAAoB,EACpB,qBAAqB,EACrB,qBAAqB,EACtB,MAAM,aAAa,CAAC;AAErB;;;;;GAKG;AACH,qBAAa,4BAA4B;IACvC,OAAO,CAAC,OAAO,CAAS;gBAEZ,OAAO,EAAE,MAAM;IAM3B;;OAEG;IACG,SAAS,IAAI,OAAO,CAAC,OAAO,CAAC;IASnC;;OAEG;IACG,SAAS;IAQf;;OAEG;IACG,aAAa,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAYlF;;OAEG;IACG,YAAY,IAAI,OAAO,CAAC,qBAAqB,EAAE,CAAC;IAQtD;;OAEG;IACG,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAYzE;;OAEG;IACG,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAUtD;;OAEG;IACG,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAUrD;;OAEG;IACG,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAUxD;;OAEG;IACG,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAUrD;;OAEG;IACG,oBAAoB,CACxB,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,MAAM,EACpB,SAAS,GAAE,MAAc,GACxB,OAAO,CAAC,qBAAqB,CAAC;IAgBjC;;OAEG;IACG,qBAAqB,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC;QAClE,OAAO,EAAE,qBAAqB,CAAC;QAC/B,MAAM,EAAE,qBAAqB,CAAC;KAC/B,CAAC;IAUF;;OAEG;IACG,aAAa;IAQnB;;OAEG;IACG,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAUzD;;OAEG;IACG,mBAAmB,CAAC,SAAS,EAAE,MAAM;CAU5C;AAGD,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,4BAA4B,CAE1E;AAGD,eAAO,MAAM,qBAAqB,qCAA+B,CAAC"}
client/dist/index.js CHANGED
@@ -1,1621 +1,614 @@
1
  // @bun
2
- var __create = Object.create;
3
- var __getProtoOf = Object.getPrototypeOf;
4
- var __defProp = Object.defineProperty;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __toESM = (mod, isNodeMode, target) => {
8
- target = mod != null ? __create(__getProtoOf(mod)) : {};
9
- const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
10
- for (let key of __getOwnPropNames(mod))
11
- if (!__hasOwnProp.call(to, key))
12
- __defProp(to, key, {
13
- get: () => mod[key],
14
- enumerable: true
15
- });
16
- return to;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  };
18
- var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
19
- var __export = (target, all) => {
20
- for (var name in all)
21
- __defProp(target, name, {
22
- get: all[name],
23
- enumerable: true,
24
- configurable: true,
25
- set: (newValue) => all[name] = () => newValue
26
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
  };
28
-
29
- // ../../../../node_modules/eventemitter3/index.js
30
- var require_eventemitter3 = __commonJS((exports, module) => {
31
- var has = Object.prototype.hasOwnProperty;
32
- var prefix = "~";
33
- function Events() {}
34
- if (Object.create) {
35
- Events.prototype = Object.create(null);
36
- if (!new Events().__proto__)
37
- prefix = false;
38
- }
39
- function EE(fn, context, once) {
40
- this.fn = fn;
41
- this.context = context;
42
- this.once = once || false;
43
- }
44
- function addListener(emitter, event, fn, context, once) {
45
- if (typeof fn !== "function") {
46
- throw new TypeError("The listener must be a function");
47
- }
48
- var listener = new EE(fn, context || emitter, once), evt = prefix ? prefix + event : event;
49
- if (!emitter._events[evt])
50
- emitter._events[evt] = listener, emitter._eventsCount++;
51
- else if (!emitter._events[evt].fn)
52
- emitter._events[evt].push(listener);
53
- else
54
- emitter._events[evt] = [emitter._events[evt], listener];
55
- return emitter;
56
- }
57
- function clearEvent(emitter, evt) {
58
- if (--emitter._eventsCount === 0)
59
- emitter._events = new Events;
60
- else
61
- delete emitter._events[evt];
62
- }
63
- function EventEmitter() {
64
- this._events = new Events;
65
- this._eventsCount = 0;
66
- }
67
- EventEmitter.prototype.eventNames = function eventNames() {
68
- var names = [], events, name;
69
- if (this._eventsCount === 0)
70
- return names;
71
- for (name in events = this._events) {
72
- if (has.call(events, name))
73
- names.push(prefix ? name.slice(1) : name);
74
- }
75
- if (Object.getOwnPropertySymbols) {
76
- return names.concat(Object.getOwnPropertySymbols(events));
77
- }
78
- return names;
79
- };
80
- EventEmitter.prototype.listeners = function listeners(event) {
81
- var evt = prefix ? prefix + event : event, handlers = this._events[evt];
82
- if (!handlers)
83
- return [];
84
- if (handlers.fn)
85
- return [handlers.fn];
86
- for (var i = 0, l = handlers.length, ee = new Array(l);i < l; i++) {
87
- ee[i] = handlers[i].fn;
88
  }
89
- return ee;
90
- };
91
- EventEmitter.prototype.listenerCount = function listenerCount(event) {
92
- var evt = prefix ? prefix + event : event, listeners = this._events[evt];
93
- if (!listeners)
94
- return 0;
95
- if (listeners.fn)
96
- return 1;
97
- return listeners.length;
98
- };
99
- EventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {
100
- var evt = prefix ? prefix + event : event;
101
- if (!this._events[evt])
102
- return false;
103
- var listeners = this._events[evt], len = arguments.length, args, i;
104
- if (listeners.fn) {
105
- if (listeners.once)
106
- this.removeListener(event, listeners.fn, undefined, true);
107
- switch (len) {
108
- case 1:
109
- return listeners.fn.call(listeners.context), true;
110
- case 2:
111
- return listeners.fn.call(listeners.context, a1), true;
112
- case 3:
113
- return listeners.fn.call(listeners.context, a1, a2), true;
114
- case 4:
115
- return listeners.fn.call(listeners.context, a1, a2, a3), true;
116
- case 5:
117
- return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;
118
- case 6:
119
- return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;
120
- }
121
- for (i = 1, args = new Array(len - 1);i < len; i++) {
122
- args[i - 1] = arguments[i];
123
- }
124
- listeners.fn.apply(listeners.context, args);
125
- } else {
126
- var length = listeners.length, j;
127
- for (i = 0;i < length; i++) {
128
- if (listeners[i].once)
129
- this.removeListener(event, listeners[i].fn, undefined, true);
130
- switch (len) {
131
- case 1:
132
- listeners[i].fn.call(listeners[i].context);
133
- break;
134
- case 2:
135
- listeners[i].fn.call(listeners[i].context, a1);
136
- break;
137
- case 3:
138
- listeners[i].fn.call(listeners[i].context, a1, a2);
139
- break;
140
- case 4:
141
- listeners[i].fn.call(listeners[i].context, a1, a2, a3);
142
- break;
143
- default:
144
- if (!args)
145
- for (j = 1, args = new Array(len - 1);j < len; j++) {
146
- args[j - 1] = arguments[j];
147
- }
148
- listeners[i].fn.apply(listeners[i].context, args);
149
  }
150
- }
151
- }
152
- return true;
153
- };
154
- EventEmitter.prototype.on = function on(event, fn, context) {
155
- return addListener(this, event, fn, context, false);
156
- };
157
- EventEmitter.prototype.once = function once(event, fn, context) {
158
- return addListener(this, event, fn, context, true);
159
- };
160
- EventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {
161
- var evt = prefix ? prefix + event : event;
162
- if (!this._events[evt])
163
- return this;
164
- if (!fn) {
165
- clearEvent(this, evt);
166
- return this;
167
- }
168
- var listeners = this._events[evt];
169
- if (listeners.fn) {
170
- if (listeners.fn === fn && (!once || listeners.once) && (!context || listeners.context === context)) {
171
- clearEvent(this, evt);
172
- }
173
- } else {
174
- for (var i = 0, events = [], length = listeners.length;i < length; i++) {
175
- if (listeners[i].fn !== fn || once && !listeners[i].once || context && listeners[i].context !== context) {
176
- events.push(listeners[i]);
177
  }
178
- }
179
- if (events.length)
180
- this._events[evt] = events.length === 1 ? events[0] : events;
181
- else
182
- clearEvent(this, evt);
183
- }
184
- return this;
185
- };
186
- EventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {
187
- var evt;
188
- if (event) {
189
- evt = prefix ? prefix + event : event;
190
- if (this._events[evt])
191
- clearEvent(this, evt);
192
- } else {
193
- this._events = new Events;
194
- this._eventsCount = 0;
195
  }
196
- return this;
197
- };
198
- EventEmitter.prototype.off = EventEmitter.prototype.removeListener;
199
- EventEmitter.prototype.addListener = EventEmitter.prototype.on;
200
- EventEmitter.prefixed = prefix;
201
- EventEmitter.EventEmitter = EventEmitter;
202
- if (typeof module !== "undefined") {
203
- module.exports = EventEmitter;
204
- }
205
- });
206
-
207
- // src/robotics/index.ts
208
- var exports_robotics = {};
209
- __export(exports_robotics, {
210
- createProducerClient: () => createProducerClient,
211
- createConsumerClient: () => createConsumerClient,
212
- createClient: () => createClient,
213
- RoboticsProducer: () => RoboticsProducer,
214
- RoboticsConsumer: () => RoboticsConsumer,
215
- RoboticsClientCore: () => RoboticsClientCore
216
- });
217
-
218
- // ../../../../node_modules/eventemitter3/index.mjs
219
- var import__ = __toESM(require_eventemitter3(), 1);
220
-
221
- // src/robotics/core.ts
222
- class RoboticsClientCore extends import__.default {
223
- baseUrl;
224
- apiBase;
225
- websocket = null;
226
- workspaceId = null;
227
- roomId = null;
228
- role = null;
229
- participantId = null;
230
- connected = false;
231
- options;
232
- onErrorCallback = null;
233
- onConnectedCallback = null;
234
- onDisconnectedCallback = null;
235
- constructor(baseUrl = "http://localhost:8000", options = {}) {
236
- super();
237
- this.baseUrl = baseUrl.replace(/\/$/, "");
238
- this.apiBase = `${this.baseUrl}/robotics`;
239
- this.options = {
240
- timeout: 5000,
241
- reconnect_attempts: 3,
242
- heartbeat_interval: 30000,
243
- ...options
244
- };
245
- }
246
- async listRooms(workspaceId) {
247
- const response = await this.fetchApi(`/workspaces/${workspaceId}/rooms`);
248
- return response.rooms;
249
- }
250
- async createRoom(workspaceId, roomId) {
251
- const finalWorkspaceId = workspaceId || this.generateWorkspaceId();
252
- const payload = roomId ? { room_id: roomId, workspace_id: finalWorkspaceId } : { workspace_id: finalWorkspaceId };
253
- const response = await this.fetchApi(`/workspaces/${finalWorkspaceId}/rooms`, {
254
- method: "POST",
255
- headers: { "Content-Type": "application/json" },
256
- body: JSON.stringify(payload)
257
- });
258
- return { workspaceId: response.workspace_id, roomId: response.room_id };
259
- }
260
- async deleteRoom(workspaceId, roomId) {
261
- try {
262
- const response = await this.fetchApi(`/workspaces/${workspaceId}/rooms/${roomId}`, {
263
- method: "DELETE"
264
- });
265
- return response.success;
266
- } catch (error) {
267
- if (error instanceof Error && error.message.includes("404")) {
268
- return false;
269
- }
270
- throw error;
271
- }
272
- }
273
- async getRoomState(workspaceId, roomId) {
274
- const response = await this.fetchApi(`/workspaces/${workspaceId}/rooms/${roomId}/state`);
275
- return response.state;
276
- }
277
- async getRoomInfo(workspaceId, roomId) {
278
- const response = await this.fetchApi(`/workspaces/${workspaceId}/rooms/${roomId}`);
279
- return response.room;
280
- }
281
- async connectToRoom(workspaceId, roomId, role, participantId) {
282
- if (this.connected) {
283
- await this.disconnect();
284
- }
285
- this.workspaceId = workspaceId;
286
- this.roomId = roomId;
287
- this.role = role;
288
- this.participantId = participantId || `${role}_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
289
- const wsUrl = this.baseUrl.replace(/^http/, "ws").replace(/^https/, "wss");
290
- const wsEndpoint = `${wsUrl}/robotics/workspaces/${workspaceId}/rooms/${roomId}/ws`;
291
- try {
292
- this.websocket = new WebSocket(wsEndpoint);
293
- return new Promise((resolve, reject) => {
294
- const timeout = setTimeout(() => {
295
- reject(new Error("Connection timeout"));
296
- }, this.options.timeout || 5000);
297
- this.websocket.onopen = () => {
298
- clearTimeout(timeout);
299
- this.sendJoinMessage();
300
- };
301
- this.websocket.onmessage = (event) => {
302
- try {
303
- const message = JSON.parse(event.data);
304
- this.handleMessage(message);
305
- if (message.type === "joined") {
306
- this.connected = true;
307
- this.onConnectedCallback?.();
308
- this.emit("connected");
309
- resolve(true);
310
- } else if (message.type === "error") {
311
- this.handleError(message.message);
312
- resolve(false);
313
- }
314
- } catch (error) {
315
- console.error("Failed to parse WebSocket message:", error);
316
  }
317
- };
318
- this.websocket.onerror = (error) => {
319
- clearTimeout(timeout);
320
- console.error("WebSocket error:", error);
321
- this.handleError("WebSocket connection error");
322
- reject(error);
323
- };
324
- this.websocket.onclose = () => {
325
- clearTimeout(timeout);
326
- this.connected = false;
327
- this.onDisconnectedCallback?.();
328
- this.emit("disconnected");
329
- };
330
- });
331
- } catch (error) {
332
- console.error("Failed to connect to room:", error);
333
- return false;
334
- }
335
- }
336
- async disconnect() {
337
- if (this.websocket && this.websocket.readyState === WebSocket.OPEN) {
338
- this.websocket.close();
339
- }
340
- this.websocket = null;
341
- this.connected = false;
342
- this.workspaceId = null;
343
- this.roomId = null;
344
- this.role = null;
345
- this.participantId = null;
346
- this.onDisconnectedCallback?.();
347
- this.emit("disconnected");
348
- }
349
- sendJoinMessage() {
350
- if (!this.websocket || !this.participantId || !this.role)
351
- return;
352
- const joinMessage = {
353
- participant_id: this.participantId,
354
- role: this.role
355
- };
356
- this.websocket.send(JSON.stringify(joinMessage));
357
- }
358
- handleMessage(message) {
359
- switch (message.type) {
360
- case "joined":
361
- console.log(`Successfully joined room ${message.room_id} as ${message.role}`);
362
- break;
363
- case "heartbeat_ack":
364
- console.debug("Heartbeat acknowledged");
365
- break;
366
- case "error":
367
- this.handleError(message.message);
368
- break;
369
  default:
370
- this.handleRoleSpecificMessage(message);
371
  }
372
  }
373
- handleRoleSpecificMessage(message) {
374
- this.emit("message", message);
375
- }
376
- handleError(errorMessage) {
377
- console.error("Client error:", errorMessage);
378
- this.onErrorCallback?.(errorMessage);
379
- this.emit("error", errorMessage);
380
- }
381
- async sendHeartbeat() {
382
- if (!this.connected || !this.websocket)
383
- return;
384
- const message = { type: "heartbeat" };
385
- this.websocket.send(JSON.stringify(message));
386
- }
387
- isConnected() {
388
- return this.connected;
389
- }
390
- getConnectionInfo() {
391
- return {
392
- connected: this.connected,
393
- workspace_id: this.workspaceId,
394
- room_id: this.roomId,
395
- role: this.role,
396
- participant_id: this.participantId,
397
- base_url: this.baseUrl
398
- };
399
- }
400
- onError(callback) {
401
- this.onErrorCallback = callback;
402
- }
403
- onConnected(callback) {
404
- this.onConnectedCallback = callback;
405
- }
406
- onDisconnected(callback) {
407
- this.onDisconnectedCallback = callback;
408
- }
409
- async fetchApi(endpoint, options = {}) {
410
- const url = `${this.apiBase}${endpoint}`;
411
- const response = await fetch(url, {
412
- ...options,
413
- signal: AbortSignal.timeout(this.options.timeout || 5000)
414
- });
415
- if (!response.ok) {
416
- throw new Error(`HTTP ${response.status}: ${response.statusText}`);
417
  }
418
- return response.json();
419
- }
420
- generateWorkspaceId() {
421
- return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(c) {
422
- const r = Math.random() * 16 | 0;
423
- const v = c === "x" ? r : r & 3 | 8;
424
- return v.toString(16);
 
 
 
425
  });
426
- }
427
- }
428
- // src/robotics/producer.ts
429
- class RoboticsProducer extends RoboticsClientCore {
430
- constructor(baseUrl = "http://localhost:8000", options = {}) {
431
- super(baseUrl, options);
432
- }
433
- async connect(workspaceId, roomId, participantId) {
434
- return this.connectToRoom(workspaceId, roomId, "producer", participantId);
435
- }
436
- async sendJointUpdate(joints) {
437
- if (!this.connected || !this.websocket) {
438
- throw new Error("Must be connected to send joint updates");
439
- }
440
- const message = {
441
- type: "joint_update",
442
- data: joints,
443
- timestamp: new Date().toISOString()
444
- };
445
- this.websocket.send(JSON.stringify(message));
446
- }
447
- async sendStateSync(state) {
448
- if (!this.connected || !this.websocket) {
449
- throw new Error("Must be connected to send state sync");
450
- }
451
- const joints = Object.entries(state).map(([name, value]) => ({
452
- name,
453
- value
454
- }));
455
- await this.sendJointUpdate(joints);
456
- }
457
- async sendEmergencyStop(reason = "Emergency stop") {
458
- if (!this.connected || !this.websocket) {
459
- throw new Error("Must be connected to send emergency stop");
460
- }
461
- const message = {
462
- type: "emergency_stop",
463
- reason,
464
- timestamp: new Date().toISOString()
465
- };
466
- this.websocket.send(JSON.stringify(message));
467
- }
468
- handleRoleSpecificMessage(message) {
469
- switch (message.type) {
470
- case "emergency_stop":
471
- console.warn(`\uD83D\uDEA8 Emergency stop: ${message.reason || "Unknown reason"}`);
472
- this.handleError(`Emergency stop: ${message.reason || "Unknown reason"}`);
473
- break;
474
- case "error":
475
- console.error(`Server error: ${message.message}`);
476
- this.handleError(message.message);
477
- break;
478
  default:
479
- console.warn(`Unknown message type for producer: ${message.type}`);
480
- }
481
- }
482
- static async createAndConnect(baseUrl = "http://localhost:8000", workspaceId, roomId, participantId) {
483
- const producer = new RoboticsProducer(baseUrl);
484
- const roomData = await producer.createRoom(workspaceId, roomId);
485
- const connected = await producer.connect(roomData.workspaceId, roomData.roomId, participantId);
486
- if (!connected) {
487
- throw new Error("Failed to connect as producer");
488
- }
489
- return producer;
490
- }
491
- get currentRoomId() {
492
- return this.roomId;
493
- }
494
- }
495
- // src/robotics/consumer.ts
496
- class RoboticsConsumer extends RoboticsClientCore {
497
- onStateSyncCallback = null;
498
- onJointUpdateCallback = null;
499
- constructor(baseUrl = "http://localhost:8000", options = {}) {
500
- super(baseUrl, options);
501
- }
502
- async connect(workspaceId, roomId, participantId) {
503
- return this.connectToRoom(workspaceId, roomId, "consumer", participantId);
504
- }
505
- async getStateSyncAsync() {
506
- if (!this.workspaceId || !this.roomId) {
507
- throw new Error("Must be connected to a room");
508
  }
509
- const state = await this.getRoomState(this.workspaceId, this.roomId);
510
- return state.joints;
511
- }
512
- onStateSync(callback) {
513
- this.onStateSyncCallback = callback;
514
- }
515
- onJointUpdate(callback) {
516
- this.onJointUpdateCallback = callback;
517
  }
518
- handleRoleSpecificMessage(message) {
519
- switch (message.type) {
520
- case "state_sync":
521
- this.handleStateSync(message);
522
- break;
523
- case "joint_update":
524
- this.handleJointUpdate(message);
525
- break;
526
- case "emergency_stop":
527
- console.warn(`\uD83D\uDEA8 Emergency stop: ${message.reason || "Unknown reason"}`);
528
- this.handleError(`Emergency stop: ${message.reason || "Unknown reason"}`);
529
- break;
530
- case "error":
531
- console.error(`Server error: ${message.message}`);
532
- this.handleError(message.message);
533
- break;
534
  default:
535
- console.warn(`Unknown message type for consumer: ${message.type}`);
536
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
537
  }
538
- handleStateSync(message) {
539
- if (this.onStateSyncCallback) {
540
- this.onStateSyncCallback(message.data);
541
- }
542
- this.emit("stateSync", message.data);
543
- }
544
- handleJointUpdate(message) {
545
- if (this.onJointUpdateCallback) {
546
- this.onJointUpdateCallback(message.data);
547
- }
548
- this.emit("jointUpdate", message.data);
549
- }
550
- static async createAndConnect(workspaceId, roomId, baseUrl = "http://localhost:8000", participantId) {
551
- const consumer = new RoboticsConsumer(baseUrl);
552
- const connected = await consumer.connect(workspaceId, roomId, participantId);
553
- if (!connected) {
554
- throw new Error("Failed to connect as consumer");
555
- }
556
- return consumer;
557
- }
558
- }
559
- // src/robotics/factory.ts
560
- function createClient(role, baseUrl = "http://localhost:8000", options = {}) {
561
- if (role === "producer") {
562
- return new RoboticsProducer(baseUrl, options);
563
- }
564
- if (role === "consumer") {
565
- return new RoboticsConsumer(baseUrl, options);
566
  }
567
- throw new Error(`Invalid role: ${role}. Must be 'producer' or 'consumer'`);
568
- }
569
- async function createProducerClient(baseUrl = "http://localhost:8000", workspaceId, roomId, participantId, options = {}) {
570
- const producer = new RoboticsProducer(baseUrl, options);
571
- const roomData = await producer.createRoom(workspaceId, roomId);
572
- const connected = await producer.connect(roomData.workspaceId, roomData.roomId, participantId);
573
- if (!connected) {
574
- throw new Error("Failed to connect as producer");
575
  }
576
- return producer;
577
- }
578
- async function createConsumerClient(workspaceId, roomId, baseUrl = "http://localhost:8000", participantId, options = {}) {
579
- const consumer = new RoboticsConsumer(baseUrl, options);
580
- const connected = await consumer.connect(workspaceId, roomId, participantId);
581
- if (!connected) {
582
- throw new Error("Failed to connect as consumer");
583
  }
584
- return consumer;
585
  }
586
- // src/video/index.ts
587
- var exports_video = {};
588
- __export(exports_video, {
589
- createProducerClient: () => createProducerClient2,
590
- createConsumerClient: () => createConsumerClient2,
591
- createClient: () => createClient2,
592
- VideoProducer: () => VideoProducer,
593
- VideoConsumer: () => VideoConsumer,
594
- VideoClientCore: () => VideoClientCore
595
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
596
 
597
- // src/video/core.ts
598
- class VideoClientCore extends import__.default {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
599
  baseUrl;
600
- apiBase;
601
- websocket = null;
602
- peerConnection = null;
603
- localStream = null;
604
- remoteStream = null;
605
- workspaceId = null;
606
- roomId = null;
607
- role = null;
608
- participantId = null;
609
- connected = false;
610
- options;
611
- webrtcConfig;
612
- onErrorCallback = null;
613
- onConnectedCallback = null;
614
- onDisconnectedCallback = null;
615
- constructor(baseUrl = "http://localhost:8000", options = {}) {
616
- super();
617
- this.baseUrl = baseUrl.replace(/\/$/, "");
618
- this.apiBase = `${this.baseUrl}/video`;
619
- this.options = {
620
- timeout: 5000,
621
- reconnect_attempts: 3,
622
- heartbeat_interval: 30000,
623
- ...options
624
- };
625
- this.webrtcConfig = {
626
- iceServers: [{ urls: "stun:stun.l.google.com:19302" }],
627
- constraints: {
628
- video: {
629
- width: { ideal: 640 },
630
- height: { ideal: 480 },
631
- frameRate: { ideal: 30 }
632
- },
633
- audio: false
634
- },
635
- bitrate: 1e6,
636
- framerate: 30,
637
- resolution: { width: 640, height: 480 },
638
- codecPreferences: ["VP8", "H264"],
639
- ...this.options.webrtc_config
640
- };
641
  }
642
- async listRooms(workspaceId) {
643
- const response = await this.fetchApi(`/workspaces/${workspaceId}/rooms`);
644
- return response.rooms;
645
- }
646
- async createRoom(workspaceId, roomId, config, recoveryConfig) {
647
- const finalWorkspaceId = workspaceId || this.generateWorkspaceId();
648
- const payload = {
649
- room_id: roomId,
650
- workspace_id: finalWorkspaceId,
651
- config,
652
- recovery_config: recoveryConfig
653
- };
654
- const response = await this.fetchApi(`/workspaces/${finalWorkspaceId}/rooms`, {
655
- method: "POST",
656
- headers: { "Content-Type": "application/json" },
657
- body: JSON.stringify(payload)
658
- });
659
- return { workspaceId: response.workspace_id, roomId: response.room_id };
660
- }
661
- async deleteRoom(workspaceId, roomId) {
662
  try {
663
- const response = await this.fetchApi(`/workspaces/${workspaceId}/rooms/${roomId}`, {
664
- method: "DELETE"
665
- });
666
- return response.success;
667
- } catch (error) {
668
- if (error instanceof Error && error.message.includes("404")) {
669
- return false;
670
- }
671
- throw error;
672
- }
673
- }
674
- async getRoomState(workspaceId, roomId) {
675
- const response = await this.fetchApi(`/workspaces/${workspaceId}/rooms/${roomId}/state`);
676
- return response.state;
677
- }
678
- async getRoomInfo(workspaceId, roomId) {
679
- const response = await this.fetchApi(`/workspaces/${workspaceId}/rooms/${roomId}`);
680
- return response.room;
681
- }
682
- async sendWebRTCSignal(workspaceId, roomId, clientId, message) {
683
- const request = { client_id: clientId, message };
684
- return this.fetchApi(`/workspaces/${workspaceId}/rooms/${roomId}/webrtc/signal`, {
685
- method: "POST",
686
- headers: { "Content-Type": "application/json" },
687
- body: JSON.stringify(request)
688
- });
689
- }
690
- async connectToRoom(workspaceId, roomId, role, participantId) {
691
- if (this.connected) {
692
- await this.disconnect();
693
- }
694
- this.workspaceId = workspaceId;
695
- this.roomId = roomId;
696
- this.role = role;
697
- this.participantId = participantId || `${role}_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
698
- const wsUrl = this.baseUrl.replace(/^http/, "ws").replace(/^https/, "wss");
699
- const wsEndpoint = `${wsUrl}/video/workspaces/${workspaceId}/rooms/${roomId}/ws`;
700
- try {
701
- this.websocket = new WebSocket(wsEndpoint);
702
- return new Promise((resolve, reject) => {
703
- const timeout = setTimeout(() => {
704
- reject(new Error("Connection timeout"));
705
- }, this.options.timeout || 5000);
706
- this.websocket.onopen = () => {
707
- clearTimeout(timeout);
708
- this.sendJoinMessage();
709
- };
710
- this.websocket.onmessage = (event) => {
711
- try {
712
- const message = JSON.parse(event.data);
713
- this.handleMessage(message);
714
- if (message.type === "joined") {
715
- this.connected = true;
716
- this.onConnectedCallback?.();
717
- this.emit("connected");
718
- resolve(true);
719
- } else if (message.type === "error") {
720
- this.handleError(message.message);
721
- resolve(false);
722
- }
723
- } catch (error) {
724
- console.error("Failed to parse WebSocket message:", error);
725
- }
726
- };
727
- this.websocket.onerror = (error) => {
728
- clearTimeout(timeout);
729
- console.error("WebSocket error:", error);
730
- this.handleError("WebSocket connection error");
731
- reject(error);
732
- };
733
- this.websocket.onclose = () => {
734
- clearTimeout(timeout);
735
- this.connected = false;
736
- this.onDisconnectedCallback?.();
737
- this.emit("disconnected");
738
- };
739
- });
740
- } catch (error) {
741
- console.error("Failed to connect to room:", error);
742
  return false;
743
  }
744
  }
745
- async disconnect() {
746
- if (this.peerConnection) {
747
- this.peerConnection.close();
748
- this.peerConnection = null;
749
- }
750
- if (this.localStream) {
751
- this.localStream.getTracks().forEach((track) => track.stop());
752
- this.localStream = null;
753
- }
754
- if (this.websocket && this.websocket.readyState === WebSocket.OPEN) {
755
- this.websocket.close();
756
- }
757
- this.websocket = null;
758
- this.remoteStream = null;
759
- this.connected = false;
760
- this.workspaceId = null;
761
- this.roomId = null;
762
- this.role = null;
763
- this.participantId = null;
764
- this.onDisconnectedCallback?.();
765
- this.emit("disconnected");
766
- }
767
- createPeerConnection() {
768
- const config = {
769
- iceServers: this.webrtcConfig.iceServers || [
770
- { urls: "stun:stun.l.google.com:19302" }
771
- ]
772
- };
773
- this.peerConnection = new RTCPeerConnection(config);
774
- this.peerConnection.onconnectionstatechange = () => {
775
- const state = this.peerConnection?.connectionState;
776
- console.info(`\uD83D\uDD0C WebRTC connection state: ${state}`);
777
- };
778
- this.peerConnection.oniceconnectionstatechange = () => {
779
- const state = this.peerConnection?.iceConnectionState;
780
- console.info(`\uD83E\uDDCA ICE connection state: ${state}`);
781
- };
782
- this.peerConnection.onicecandidate = (event) => {
783
- if (event.candidate && this.workspaceId && this.roomId && this.participantId) {
784
- this.sendWebRTCSignal(this.workspaceId, this.roomId, this.participantId, {
785
- type: "ice",
786
- candidate: event.candidate.toJSON()
787
- });
788
- }
789
- };
790
- this.peerConnection.ontrack = (event) => {
791
- console.info("\uD83D\uDCFA Received remote track:", event.track.kind);
792
- this.remoteStream = event.streams[0] || null;
793
- this.emit("remoteStream", this.remoteStream);
794
- };
795
- return this.peerConnection;
796
- }
797
- async createOffer() {
798
- if (!this.peerConnection) {
799
- throw new Error("Peer connection not created");
800
- }
801
- const offer = await this.peerConnection.createOffer();
802
- await this.peerConnection.setLocalDescription(offer);
803
- return offer;
804
- }
805
- async createAnswer(offer) {
806
- if (!this.peerConnection) {
807
- throw new Error("Peer connection not created");
808
- }
809
- await this.peerConnection.setRemoteDescription(offer);
810
- const answer = await this.peerConnection.createAnswer();
811
- await this.peerConnection.setLocalDescription(answer);
812
- return answer;
813
- }
814
- async setRemoteDescription(description) {
815
- if (!this.peerConnection) {
816
- throw new Error("Peer connection not created");
817
- }
818
- await this.peerConnection.setRemoteDescription(description);
819
- }
820
- async addIceCandidate(candidate) {
821
- if (!this.peerConnection) {
822
- throw new Error("Peer connection not created");
823
- }
824
- await this.peerConnection.addIceCandidate(candidate);
825
- }
826
- async startProducing(constraints) {
827
- const mediaConstraints = constraints || this.webrtcConfig.constraints;
828
- try {
829
- this.localStream = await navigator.mediaDevices.getUserMedia(mediaConstraints);
830
- return this.localStream;
831
- } catch (error) {
832
- throw new Error(`Failed to start video production: ${error}`);
833
- }
834
- }
835
- async startScreenShare() {
836
- try {
837
- this.localStream = await navigator.mediaDevices.getDisplayMedia({
838
- video: {
839
- width: this.webrtcConfig.resolution?.width || 1920,
840
- height: this.webrtcConfig.resolution?.height || 1080,
841
- frameRate: this.webrtcConfig.framerate || 30
842
- },
843
- audio: false
844
- });
845
- return this.localStream;
846
- } catch (error) {
847
- throw new Error(`Failed to start screen share: ${error}`);
848
- }
849
- }
850
- stopProducing() {
851
- if (this.localStream) {
852
- this.localStream.getTracks().forEach((track) => track.stop());
853
- this.localStream = null;
854
  }
 
855
  }
856
- getLocalStream() {
857
- return this.localStream;
858
- }
859
- getRemoteStream() {
860
- return this.remoteStream;
861
- }
862
- getPeerConnection() {
863
- return this.peerConnection;
864
- }
865
- async getStats() {
866
- if (!this.peerConnection) {
867
- return null;
868
  }
869
- const stats = await this.peerConnection.getStats();
870
- return this.extractVideoStats(stats);
871
  }
872
- sendJoinMessage() {
873
- if (!this.websocket || !this.participantId || !this.role)
874
- return;
875
- const joinMessage = {
876
- participant_id: this.participantId,
877
- role: this.role
878
- };
879
- this.websocket.send(JSON.stringify(joinMessage));
880
- }
881
- handleMessage(message) {
882
- switch (message.type) {
883
- case "joined":
884
- console.log(`Successfully joined room ${message.room_id} as ${message.role}`);
885
- break;
886
- case "heartbeat_ack":
887
- console.debug("Heartbeat acknowledged");
888
- break;
889
- case "error":
890
- this.handleError(message.message);
891
- break;
892
- default:
893
- this.handleRoleSpecificMessage(message);
894
  }
 
895
  }
896
- handleRoleSpecificMessage(message) {
897
- this.emit("message", message);
898
- }
899
- handleError(errorMessage) {
900
- console.error("Video client error:", errorMessage);
901
- this.onErrorCallback?.(errorMessage);
902
- this.emit("error", errorMessage);
903
- }
904
- async sendHeartbeat() {
905
- if (!this.connected || !this.websocket)
906
- return;
907
- const message = { type: "heartbeat" };
908
- this.websocket.send(JSON.stringify(message));
909
- }
910
- isConnected() {
911
- return this.connected;
912
- }
913
- getConnectionInfo() {
914
- return {
915
- connected: this.connected,
916
- workspace_id: this.workspaceId,
917
- room_id: this.roomId,
918
- role: this.role,
919
- participant_id: this.participantId,
920
- base_url: this.baseUrl
921
- };
922
- }
923
- onError(callback) {
924
- this.onErrorCallback = callback;
925
- }
926
- onConnected(callback) {
927
- this.onConnectedCallback = callback;
928
- }
929
- onDisconnected(callback) {
930
- this.onDisconnectedCallback = callback;
931
- }
932
- async fetchApi(endpoint, options = {}) {
933
- const url = `${this.apiBase}${endpoint}`;
934
- const response = await fetch(url, {
935
- ...options,
936
- signal: AbortSignal.timeout(this.options.timeout || 5000)
937
  });
938
- if (!response.ok) {
939
- throw new Error(`HTTP ${response.status}: ${response.statusText}`);
940
  }
941
- return response.json();
942
  }
943
- extractVideoStats(stats) {
944
- let inboundVideoStats = null;
945
- let outboundVideoStats = null;
946
- stats.forEach((report) => {
947
- if (report.type === "inbound-rtp" && "kind" in report && report.kind === "video") {
948
- inboundVideoStats = report;
949
- } else if (report.type === "outbound-rtp" && "kind" in report && report.kind === "video") {
950
- outboundVideoStats = report;
951
- }
952
  });
953
- if (inboundVideoStats) {
954
- return {
955
- videoBitsPerSecond: inboundVideoStats.bytesReceived || 0,
956
- framesPerSecond: inboundVideoStats.framesPerSecond || 0,
957
- frameWidth: inboundVideoStats.frameWidth || 0,
958
- frameHeight: inboundVideoStats.frameHeight || 0,
959
- packetsLost: inboundVideoStats.packetsLost || 0,
960
- totalPackets: inboundVideoStats.packetsReceived || inboundVideoStats.framesDecoded || 0
961
- };
962
- }
963
- if (outboundVideoStats) {
964
- return {
965
- videoBitsPerSecond: outboundVideoStats.bytesSent || 0,
966
- framesPerSecond: outboundVideoStats.framesPerSecond || 0,
967
- frameWidth: outboundVideoStats.frameWidth || 0,
968
- frameHeight: outboundVideoStats.frameHeight || 0,
969
- packetsLost: outboundVideoStats.packetsLost || 0,
970
- totalPackets: outboundVideoStats.packetsSent || outboundVideoStats.framesSent || 0
971
- };
972
  }
973
- return null;
974
  }
975
- generateWorkspaceId() {
976
- return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(c) {
977
- const r = Math.random() * 16 | 0;
978
- const v = c === "x" ? r : r & 3 | 8;
979
- return v.toString(16);
980
  });
981
- }
982
- }
983
- // src/video/producer.ts
984
- class VideoProducer extends VideoClientCore {
985
- consumerConnections = new Map;
986
- constructor(baseUrl = "http://localhost:8000", options = {}) {
987
- super(baseUrl, options);
988
- }
989
- async connect(workspaceId, roomId, participantId) {
990
- const success = await this.connectToRoom(workspaceId, roomId, "producer", participantId);
991
- if (success) {
992
- this.on("consumer_joined", (consumerId) => {
993
- console.info(`\uD83C\uDFAF Consumer ${consumerId} joined, initiating WebRTC...`);
994
- this.initiateWebRTCWithConsumer(consumerId);
995
- });
996
- setTimeout(() => this.connectToExistingConsumers(), 1000);
997
- }
998
- return success;
999
- }
1000
- async connectToExistingConsumers() {
1001
- if (!this.workspaceId || !this.roomId)
1002
- return;
1003
- try {
1004
- const roomInfo = await this.getRoomInfo(this.workspaceId, this.roomId);
1005
- for (const consumerId of roomInfo.participants.consumers) {
1006
- if (!this.consumerConnections.has(consumerId)) {
1007
- console.info(`\uD83D\uDD04 Connecting to existing consumer ${consumerId}`);
1008
- await this.initiateWebRTCWithConsumer(consumerId);
1009
- }
1010
- }
1011
- } catch (error) {
1012
- console.error("Failed to connect to existing consumers:", error);
1013
- }
1014
- }
1015
- createPeerConnectionForConsumer(consumerId) {
1016
- const config = {
1017
- iceServers: this.webrtcConfig.iceServers || [
1018
- { urls: "stun:stun.l.google.com:19302" }
1019
- ]
1020
- };
1021
- const peerConnection = new RTCPeerConnection(config);
1022
- if (this.localStream) {
1023
- this.localStream.getTracks().forEach((track) => {
1024
- peerConnection.addTrack(track, this.localStream);
1025
- });
1026
- }
1027
- peerConnection.onconnectionstatechange = () => {
1028
- const state = peerConnection.connectionState;
1029
- console.info(`\uD83D\uDD0C WebRTC connection state for ${consumerId}: ${state}`);
1030
- if (state === "failed" || state === "disconnected") {
1031
- console.warn(`Connection to ${consumerId} failed, attempting restart...`);
1032
- setTimeout(() => this.restartConnectionToConsumer(consumerId), 2000);
1033
- }
1034
- };
1035
- peerConnection.oniceconnectionstatechange = () => {
1036
- const state = peerConnection.iceConnectionState;
1037
- console.info(`\uD83E\uDDCA ICE connection state for ${consumerId}: ${state}`);
1038
- };
1039
- peerConnection.onicecandidate = (event) => {
1040
- if (event.candidate && this.workspaceId && this.roomId && this.participantId) {
1041
- this.sendWebRTCSignal(this.workspaceId, this.roomId, this.participantId, {
1042
- type: "ice",
1043
- candidate: event.candidate.toJSON(),
1044
- target_consumer: consumerId
1045
- });
1046
- }
1047
- };
1048
- this.consumerConnections.set(consumerId, peerConnection);
1049
- return peerConnection;
1050
- }
1051
- async restartConnectionToConsumer(consumerId) {
1052
- console.info(`\uD83D\uDD04 Restarting connection to consumer ${consumerId}`);
1053
- await this.initiateWebRTCWithConsumer(consumerId);
1054
- }
1055
- handleConsumerLeft(consumerId) {
1056
- const peerConnection = this.consumerConnections.get(consumerId);
1057
- if (peerConnection) {
1058
- peerConnection.close();
1059
- this.consumerConnections.delete(consumerId);
1060
- console.info(`\uD83E\uDDF9 Cleaned up peer connection for consumer ${consumerId}`);
1061
- }
1062
- }
1063
- async restartConnectionsWithNewStream(stream) {
1064
- console.info("\uD83D\uDD04 Restarting connections with new stream...", { streamId: stream.id });
1065
- for (const [consumerId, peerConnection] of this.consumerConnections) {
1066
- peerConnection.close();
1067
- console.info(`\uD83E\uDDF9 Closed existing connection to consumer ${consumerId}`);
1068
- }
1069
- this.consumerConnections.clear();
1070
- try {
1071
- if (this.workspaceId && this.roomId) {
1072
- const roomInfo = await this.getRoomInfo(this.workspaceId, this.roomId);
1073
- for (const consumerId of roomInfo.participants.consumers) {
1074
- console.info(`\uD83D\uDD04 Creating new connection to consumer ${consumerId}...`);
1075
- await this.initiateWebRTCWithConsumer(consumerId);
1076
- }
1077
- }
1078
- } catch (error) {
1079
- console.error("Failed to restart connections:", error);
1080
- }
1081
- }
1082
- async startCamera(constraints) {
1083
- if (!this.connected) {
1084
- throw new Error("Must be connected to start camera");
1085
- }
1086
- const stream = await this.startProducing(constraints);
1087
- this.localStream = stream;
1088
- await this.restartConnectionsWithNewStream(stream);
1089
- this.notifyStreamStarted(stream);
1090
- return stream;
1091
- }
1092
- async startScreenShare() {
1093
- if (!this.connected) {
1094
- throw new Error("Must be connected to start screen share");
1095
- }
1096
- const stream = await super.startScreenShare();
1097
- this.localStream = stream;
1098
- await this.restartConnectionsWithNewStream(stream);
1099
- this.notifyStreamStarted(stream);
1100
- return stream;
1101
- }
1102
- async stopStreaming() {
1103
- if (!this.connected || !this.websocket) {
1104
- throw new Error("Must be connected to stop streaming");
1105
- }
1106
- for (const [consumerId, peerConnection] of this.consumerConnections) {
1107
- peerConnection.close();
1108
- console.info(`\uD83E\uDDF9 Closed connection to consumer ${consumerId}`);
1109
- }
1110
- this.consumerConnections.clear();
1111
- this.stopProducing();
1112
- this.notifyStreamStopped();
1113
- }
1114
- async updateVideoConfig(config) {
1115
- if (!this.connected || !this.websocket) {
1116
- throw new Error("Must be connected to update video config");
1117
- }
1118
- const message = {
1119
- type: "video_config_update",
1120
- config,
1121
- timestamp: new Date().toISOString()
1122
- };
1123
- this.websocket.send(JSON.stringify(message));
1124
- }
1125
- async sendEmergencyStop(reason = "Emergency stop") {
1126
- if (!this.connected || !this.websocket) {
1127
- throw new Error("Must be connected to send emergency stop");
1128
- }
1129
- const message = {
1130
- type: "emergency_stop",
1131
- reason,
1132
- timestamp: new Date().toISOString()
1133
- };
1134
- this.websocket.send(JSON.stringify(message));
1135
- }
1136
- async initiateWebRTCWithConsumer(consumerId) {
1137
- if (!this.workspaceId || !this.roomId || !this.participantId) {
1138
- console.warn("WebRTC not ready, skipping negotiation with consumer");
1139
- return;
1140
- }
1141
- if (this.consumerConnections.has(consumerId)) {
1142
- const existingConn = this.consumerConnections.get(consumerId);
1143
- existingConn?.close();
1144
- this.consumerConnections.delete(consumerId);
1145
- }
1146
- try {
1147
- console.info(`\uD83D\uDD04 Creating WebRTC offer for consumer ${consumerId}...`);
1148
- const peerConnection = this.createPeerConnectionForConsumer(consumerId);
1149
- const offer = await peerConnection.createOffer();
1150
- await peerConnection.setLocalDescription(offer);
1151
- console.info(`\uD83D\uDCE4 Sending WebRTC offer to consumer ${consumerId}...`);
1152
- await this.sendWebRTCSignal(this.workspaceId, this.roomId, this.participantId, {
1153
- type: "offer",
1154
- sdp: offer.sdp,
1155
- target_consumer: consumerId
1156
- });
1157
- console.info(`\u2705 WebRTC offer sent to consumer ${consumerId}`);
1158
- } catch (error) {
1159
- console.error(`Failed to initiate WebRTC with consumer ${consumerId}:`, error);
1160
- }
1161
- }
1162
- async handleWebRTCAnswer(message) {
1163
- try {
1164
- const consumerId = message.from_consumer;
1165
- console.info(`\uD83D\uDCE5 Received WebRTC answer from consumer ${consumerId}`);
1166
- const peerConnection = this.consumerConnections.get(consumerId);
1167
- if (!peerConnection) {
1168
- console.warn(`No peer connection found for consumer ${consumerId}`);
1169
- return;
1170
- }
1171
- const answer = new RTCSessionDescription({
1172
- type: "answer",
1173
- sdp: message.answer.sdp
1174
- });
1175
- await peerConnection.setRemoteDescription(answer);
1176
- console.info(`\u2705 WebRTC negotiation completed with consumer ${consumerId}`);
1177
- } catch (error) {
1178
- console.error(`Failed to handle WebRTC answer from ${message.from_consumer}:`, error);
1179
- this.handleError(`Failed to handle WebRTC answer: ${error}`);
1180
- }
1181
- }
1182
- async handleWebRTCIce(message) {
1183
- try {
1184
- const consumerId = message.from_consumer;
1185
- if (!consumerId) {
1186
- console.warn("No consumer ID in ICE message");
1187
- return;
1188
- }
1189
- const peerConnection = this.consumerConnections.get(consumerId);
1190
- if (!peerConnection) {
1191
- console.warn(`No peer connection found for consumer ${consumerId}`);
1192
- return;
1193
- }
1194
- console.info(`\uD83D\uDCE5 Received WebRTC ICE from consumer ${consumerId}`);
1195
- const candidate = new RTCIceCandidate(message.candidate);
1196
- await peerConnection.addIceCandidate(candidate);
1197
- console.info(`\u2705 WebRTC ICE handled with consumer ${consumerId}`);
1198
- } catch (error) {
1199
- console.error(`Failed to handle WebRTC ICE from ${message.from_consumer}:`, error);
1200
- this.handleError(`Failed to handle WebRTC ICE: ${error}`);
1201
- }
1202
- }
1203
- handleRoleSpecificMessage(message) {
1204
- switch (message.type) {
1205
- case "participant_joined":
1206
- if (message.role === "consumer" && message.participant_id !== this.participantId) {
1207
- console.info(`\uD83C\uDFAF Consumer ${message.participant_id} joined room`);
1208
- this.emit("consumer_joined", message.participant_id);
1209
- }
1210
- break;
1211
- case "participant_left":
1212
- if (message.role === "consumer") {
1213
- console.info(`\uD83D\uDC4B Consumer ${message.participant_id} left room`);
1214
- this.handleConsumerLeft(message.participant_id);
1215
- }
1216
- break;
1217
- case "webrtc_answer":
1218
- this.handleWebRTCAnswer(message);
1219
- break;
1220
- case "webrtc_ice":
1221
- this.handleWebRTCIce(message);
1222
- break;
1223
- case "status_update":
1224
- this.handleStatusUpdate(message);
1225
- break;
1226
- case "stream_stats":
1227
- this.handleStreamStats(message);
1228
- break;
1229
- case "emergency_stop":
1230
- console.warn(`\uD83D\uDEA8 Emergency stop: ${message.reason || "Unknown reason"}`);
1231
- this.handleError(`Emergency stop: ${message.reason || "Unknown reason"}`);
1232
- break;
1233
- case "error":
1234
- console.error(`Server error: ${message.message}`);
1235
- this.handleError(message.message);
1236
- break;
1237
- default:
1238
- console.warn(`Unknown message type for producer: ${message.type}`);
1239
- }
1240
- }
1241
- handleStatusUpdate(message) {
1242
- console.info(`\uD83D\uDCCA Status update: ${message.status}`, message.data);
1243
- this.emit("statusUpdate", message.status, message.data);
1244
- }
1245
- handleStreamStats(message) {
1246
- console.debug(`\uD83D\uDCC8 Stream stats:`, message.stats);
1247
- this.emit("streamStats", message.stats);
1248
- }
1249
- async notifyStreamStarted(stream) {
1250
- if (!this.websocket)
1251
- return;
1252
- const message = {
1253
- type: "stream_started",
1254
- config: {
1255
- resolution: this.webrtcConfig.resolution,
1256
- framerate: this.webrtcConfig.framerate,
1257
- bitrate: this.webrtcConfig.bitrate
1258
- },
1259
- participant_id: this.participantId,
1260
- timestamp: new Date().toISOString()
1261
- };
1262
- this.websocket.send(JSON.stringify(message));
1263
- this.emit("streamStarted", stream);
1264
- }
1265
- async notifyStreamStopped() {
1266
- if (!this.websocket)
1267
- return;
1268
- const message = {
1269
- type: "stream_stopped",
1270
- participant_id: this.participantId,
1271
- timestamp: new Date().toISOString()
1272
- };
1273
- this.websocket.send(JSON.stringify(message));
1274
- this.emit("streamStopped");
1275
- }
1276
- static async createAndConnect(baseUrl = "http://localhost:8000", workspaceId, roomId, participantId) {
1277
- const producer = new VideoProducer(baseUrl);
1278
- const roomData = await producer.createRoom(workspaceId, roomId);
1279
- const connected = await producer.connect(roomData.workspaceId, roomData.roomId, participantId);
1280
- if (!connected) {
1281
- throw new Error("Failed to connect as video producer");
1282
- }
1283
- return producer;
1284
- }
1285
- get currentRoomId() {
1286
- return this.roomId;
1287
- }
1288
- }
1289
- // src/video/consumer.ts
1290
- class VideoConsumer extends VideoClientCore {
1291
- onFrameUpdateCallback = null;
1292
- onVideoConfigUpdateCallback = null;
1293
- onStreamStartedCallback = null;
1294
- onStreamStoppedCallback = null;
1295
- onRecoveryTriggeredCallback = null;
1296
- onStatusUpdateCallback = null;
1297
- onStreamStatsCallback = null;
1298
- iceCandidateQueue = [];
1299
- hasRemoteDescription = false;
1300
- constructor(baseUrl = "http://localhost:8000", options = {}) {
1301
- super(baseUrl, options);
1302
- }
1303
- async connect(workspaceId, roomId, participantId) {
1304
- const connected = await this.connectToRoom(workspaceId, roomId, "consumer", participantId);
1305
- if (connected) {
1306
- console.info("\uD83D\uDD27 Creating peer connection for consumer...");
1307
- await this.startReceiving();
1308
- }
1309
- return connected;
1310
- }
1311
- async startReceiving() {
1312
- if (!this.connected) {
1313
- throw new Error("Must be connected to start receiving");
1314
- }
1315
- this.hasRemoteDescription = false;
1316
- this.iceCandidateQueue = [];
1317
- this.createPeerConnection();
1318
- if (this.peerConnection) {
1319
- this.peerConnection.ontrack = (event) => {
1320
- console.info("\uD83D\uDCFA Received remote track:", event.track.kind);
1321
- this.remoteStream = event.streams[0] || null;
1322
- this.emit("remoteStream", this.remoteStream);
1323
- this.emit("streamReceived", this.remoteStream);
1324
- };
1325
  }
1326
  }
1327
- async stopReceiving() {
1328
- if (this.peerConnection) {
1329
- this.peerConnection.close();
1330
- this.peerConnection = null;
1331
- }
1332
- this.remoteStream = null;
1333
- this.emit("streamStopped");
1334
- }
1335
- async handleWebRTCOffer(message) {
1336
- try {
1337
- console.info(`\uD83D\uDCE5 Received WebRTC offer from producer ${message.from_producer}`);
1338
- if (!this.peerConnection) {
1339
- console.warn("No peer connection available to handle offer");
1340
- return;
1341
- }
1342
- this.hasRemoteDescription = false;
1343
- this.iceCandidateQueue = [];
1344
- await this.setRemoteDescription(message.offer);
1345
- this.hasRemoteDescription = true;
1346
- await this.processQueuedIceCandidates();
1347
- const answer = await this.createAnswer(message.offer);
1348
- console.info(`\uD83D\uDCE4 Sending WebRTC answer to producer ${message.from_producer}`);
1349
- if (this.workspaceId && this.roomId && this.participantId) {
1350
- await this.sendWebRTCSignal(this.workspaceId, this.roomId, this.participantId, {
1351
- type: "answer",
1352
- sdp: answer.sdp,
1353
- target_producer: message.from_producer
1354
- });
1355
- }
1356
- console.info("\u2705 WebRTC negotiation completed from consumer side");
1357
- } catch (error) {
1358
- console.error("Failed to handle WebRTC offer:", error);
1359
- this.handleError(`Failed to handle WebRTC offer: ${error}`);
1360
- }
1361
- }
1362
- async handleWebRTCIce(message) {
1363
- if (!this.peerConnection) {
1364
- console.warn("No peer connection available to handle ICE");
1365
- return;
1366
- }
1367
- try {
1368
- console.info(`\uD83D\uDCE5 Received WebRTC ICE from producer ${message.from_producer}`);
1369
- const candidate = new RTCIceCandidate(message.candidate);
1370
- if (!this.hasRemoteDescription) {
1371
- console.info(`\uD83D\uDD04 Queuing ICE candidate from ${message.from_producer} (no remote description yet)`);
1372
- this.iceCandidateQueue.push({
1373
- candidate,
1374
- fromProducer: message.from_producer || "unknown"
1375
- });
1376
- return;
1377
- }
1378
- await this.peerConnection.addIceCandidate(candidate);
1379
- console.info(`\u2705 WebRTC ICE handled from producer ${message.from_producer}`);
1380
- } catch (error) {
1381
- console.error(`Failed to handle WebRTC ICE from ${message.from_producer}:`, error);
1382
- this.handleError(`Failed to handle WebRTC ICE: ${error}`);
1383
  }
1384
  }
1385
- async processQueuedIceCandidates() {
1386
- if (this.iceCandidateQueue.length === 0) {
1387
- return;
1388
- }
1389
- console.info(`\uD83D\uDD04 Processing ${this.iceCandidateQueue.length} queued ICE candidates`);
1390
- for (const { candidate, fromProducer } of this.iceCandidateQueue) {
1391
- try {
1392
- if (this.peerConnection) {
1393
- await this.peerConnection.addIceCandidate(candidate);
1394
- console.info(`\u2705 Processed queued ICE candidate from ${fromProducer}`);
1395
- }
1396
- } catch (error) {
1397
- console.error(`Failed to process queued ICE candidate from ${fromProducer}:`, error);
1398
- }
1399
  }
1400
- this.iceCandidateQueue = [];
1401
- }
1402
- createPeerConnection() {
1403
- const config = {
1404
- iceServers: this.webrtcConfig.iceServers || [
1405
- { urls: "stun:stun.l.google.com:19302" }
1406
- ]
1407
- };
1408
- this.peerConnection = new RTCPeerConnection(config);
1409
- this.peerConnection.onconnectionstatechange = () => {
1410
- const state = this.peerConnection?.connectionState;
1411
- console.info(`\uD83D\uDD0C WebRTC connection state: ${state}`);
1412
- };
1413
- this.peerConnection.oniceconnectionstatechange = () => {
1414
- const state = this.peerConnection?.iceConnectionState;
1415
- console.info(`\uD83E\uDDCA ICE connection state: ${state}`);
1416
- };
1417
- this.peerConnection.onicecandidate = (event) => {
1418
- if (event.candidate && this.workspaceId && this.roomId && this.participantId) {
1419
- this.sendIceCandidateToProducer(event.candidate);
1420
- }
1421
- };
1422
- this.peerConnection.ontrack = (event) => {
1423
- console.info("\uD83D\uDCFA Received remote track:", event.track.kind);
1424
- this.remoteStream = event.streams[0] || null;
1425
- this.emit("remoteStream", this.remoteStream);
1426
- this.emit("streamReceived", this.remoteStream);
1427
- };
1428
- return this.peerConnection;
1429
  }
1430
- async sendIceCandidateToProducer(candidate) {
1431
- if (!this.workspaceId || !this.roomId || !this.participantId)
1432
- return;
1433
- try {
1434
- const roomInfo = await this.getRoomInfo(this.workspaceId, this.roomId);
1435
- if (roomInfo.participants.producer) {
1436
- await this.sendWebRTCSignal(this.workspaceId, this.roomId, this.participantId, {
1437
- type: "ice",
1438
- candidate: candidate.toJSON(),
1439
- target_producer: roomInfo.participants.producer
1440
- });
1441
  }
1442
- } catch (error) {
1443
- console.error("Failed to send ICE candidate to producer:", error);
1444
- }
1445
- }
1446
- async handleStreamStarted(message) {
1447
- if (this.onStreamStartedCallback) {
1448
- this.onStreamStartedCallback(message.config, message.participant_id);
1449
- }
1450
- this.emit("streamStarted", message.config, message.participant_id);
1451
- console.info(`\uD83D\uDE80 Stream started by producer ${message.participant_id}, ready to receive video`);
1452
- }
1453
- onFrameUpdate(callback) {
1454
- this.onFrameUpdateCallback = callback;
1455
- }
1456
- onVideoConfigUpdate(callback) {
1457
- this.onVideoConfigUpdateCallback = callback;
1458
- }
1459
- onStreamStarted(callback) {
1460
- this.onStreamStartedCallback = callback;
1461
- }
1462
- onStreamStopped(callback) {
1463
- this.onStreamStoppedCallback = callback;
1464
- }
1465
- onRecoveryTriggered(callback) {
1466
- this.onRecoveryTriggeredCallback = callback;
1467
- }
1468
- onStatusUpdate(callback) {
1469
- this.onStatusUpdateCallback = callback;
1470
- }
1471
- onStreamStats(callback) {
1472
- this.onStreamStatsCallback = callback;
1473
- }
1474
- handleRoleSpecificMessage(message) {
1475
- switch (message.type) {
1476
- case "frame_update":
1477
- this.handleFrameUpdate(message);
1478
- break;
1479
- case "video_config_update":
1480
- this.handleVideoConfigUpdate(message);
1481
- break;
1482
- case "stream_started":
1483
- this.handleStreamStarted(message);
1484
- break;
1485
- case "stream_stopped":
1486
- this.handleStreamStopped(message);
1487
- break;
1488
- case "recovery_triggered":
1489
- this.handleRecoveryTriggered(message);
1490
- break;
1491
- case "status_update":
1492
- this.handleStatusUpdate(message);
1493
- break;
1494
- case "stream_stats":
1495
- this.handleStreamStats(message);
1496
- break;
1497
- case "participant_joined":
1498
- console.info(`\uD83D\uDCE5 Participant joined: ${message.participant_id} as ${message.role}`);
1499
- break;
1500
- case "participant_left":
1501
- console.info(`\uD83D\uDCE4 Participant left: ${message.participant_id} (${message.role})`);
1502
- break;
1503
- case "webrtc_offer":
1504
- this.handleWebRTCOffer(message);
1505
- break;
1506
- case "webrtc_answer":
1507
- console.info("\uD83D\uDCE8 Received WebRTC answer (consumer should not receive this)");
1508
- break;
1509
- case "webrtc_ice":
1510
- this.handleWebRTCIce(message);
1511
- break;
1512
- case "emergency_stop":
1513
- console.warn(`\uD83D\uDEA8 Emergency stop: ${message.reason || "Unknown reason"}`);
1514
- this.handleError(`Emergency stop: ${message.reason || "Unknown reason"}`);
1515
- break;
1516
- case "error":
1517
- console.error(`Server error: ${message.message}`);
1518
- this.handleError(message.message);
1519
- break;
1520
- default:
1521
- console.warn(`Unknown message type for consumer: ${message.type}`);
1522
- }
1523
- }
1524
- handleFrameUpdate(message) {
1525
- if (this.onFrameUpdateCallback) {
1526
- const frameData = {
1527
- data: message.data,
1528
- metadata: message.metadata
1529
- };
1530
- this.onFrameUpdateCallback(frameData);
1531
- }
1532
- this.emit("frameUpdate", message.data);
1533
- }
1534
- handleVideoConfigUpdate(message) {
1535
- if (this.onVideoConfigUpdateCallback) {
1536
- this.onVideoConfigUpdateCallback(message.config);
1537
- }
1538
- this.emit("videoConfigUpdate", message.config);
1539
- }
1540
- handleStreamStopped(message) {
1541
- if (this.onStreamStoppedCallback) {
1542
- this.onStreamStoppedCallback(message.participant_id, message.reason);
1543
  }
1544
- this.emit("streamStopped", message.participant_id, message.reason);
1545
  }
1546
- handleRecoveryTriggered(message) {
1547
- if (this.onRecoveryTriggeredCallback) {
1548
- this.onRecoveryTriggeredCallback(message.policy, message.reason);
1549
- }
1550
- this.emit("recoveryTriggered", message.policy, message.reason);
1551
- }
1552
- handleStatusUpdate(message) {
1553
- if (this.onStatusUpdateCallback) {
1554
- this.onStatusUpdateCallback(message.status, message.data);
1555
- }
1556
- this.emit("statusUpdate", message.status, message.data);
1557
  }
1558
- handleStreamStats(message) {
1559
- if (this.onStreamStatsCallback) {
1560
- this.onStreamStatsCallback(message.stats);
 
1561
  }
1562
- this.emit("streamStats", message.stats);
1563
  }
1564
- static async createAndConnect(workspaceId, roomId, baseUrl = "http://localhost:8000", participantId) {
1565
- const consumer = new VideoConsumer(baseUrl);
1566
- const connected = await consumer.connect(workspaceId, roomId, participantId);
1567
- if (!connected) {
1568
- throw new Error("Failed to connect as video consumer");
 
1569
  }
1570
- return consumer;
1571
  }
1572
- attachToVideoElement(videoElement) {
1573
- if (this.remoteStream) {
1574
- videoElement.srcObject = this.remoteStream;
1575
- }
1576
- this.on("remoteStream", (stream) => {
1577
- videoElement.srcObject = stream;
1578
  });
 
 
 
 
1579
  }
1580
- async getVideoStats() {
1581
- const stats = await this.getStats();
1582
- return stats;
1583
- }
1584
- }
1585
- // src/video/factory.ts
1586
- function createClient2(role, baseUrl = "http://localhost:8000", options = {}) {
1587
- if (role === "producer") {
1588
- return new VideoProducer(baseUrl, options);
1589
- }
1590
- if (role === "consumer") {
1591
- return new VideoConsumer(baseUrl, options);
1592
- }
1593
- throw new Error(`Invalid role: ${role}. Must be 'producer' or 'consumer'`);
1594
- }
1595
- async function createProducerClient2(baseUrl = "http://localhost:8000", workspaceId, roomId, participantId, options = {}) {
1596
- const producer = new VideoProducer(baseUrl, options);
1597
- const roomData = await producer.createRoom(workspaceId, roomId);
1598
- const connected = await producer.connect(roomData.workspaceId, roomData.roomId, participantId);
1599
- if (!connected) {
1600
- throw new Error("Failed to connect as video producer");
1601
- }
1602
- return producer;
1603
  }
1604
- async function createConsumerClient2(workspaceId, roomId, baseUrl = "http://localhost:8000", participantId, options = {}) {
1605
- const consumer = new VideoConsumer(baseUrl, options);
1606
- const connected = await consumer.connect(workspaceId, roomId, participantId);
1607
- if (!connected) {
1608
- throw new Error("Failed to connect as video consumer");
1609
- }
1610
- return consumer;
1611
  }
1612
- // src/index.ts
1613
- var VERSION = "1.0.0";
1614
  export {
1615
- exports_video as video,
1616
- exports_robotics as robotics,
1617
- VERSION
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1618
  };
1619
 
1620
- //# debugId=4A2D211384B624B064756E2164756E21
1621
  //# sourceMappingURL=index.js.map
 
1
  // @bun
2
+ // src/generated/schemas.gen.ts
3
+ var CreateSessionRequestSchema = {
4
+ properties: {
5
+ session_id: {
6
+ type: "string",
7
+ title: "Session Id"
8
+ },
9
+ policy_path: {
10
+ type: "string",
11
+ title: "Policy Path"
12
+ },
13
+ camera_names: {
14
+ items: {
15
+ type: "string"
16
+ },
17
+ type: "array",
18
+ title: "Camera Names",
19
+ default: ["front"]
20
+ },
21
+ arena_server_url: {
22
+ type: "string",
23
+ title: "Arena Server Url",
24
+ default: "http://localhost:8000"
25
+ },
26
+ workspace_id: {
27
+ anyOf: [
28
+ {
29
+ type: "string"
30
+ },
31
+ {
32
+ type: "null"
33
+ }
34
+ ],
35
+ title: "Workspace Id"
36
+ },
37
+ policy_type: {
38
+ type: "string",
39
+ title: "Policy Type",
40
+ default: "act"
41
+ },
42
+ language_instruction: {
43
+ anyOf: [
44
+ {
45
+ type: "string"
46
+ },
47
+ {
48
+ type: "null"
49
+ }
50
+ ],
51
+ title: "Language Instruction"
52
+ }
53
+ },
54
+ type: "object",
55
+ required: ["session_id", "policy_path"],
56
+ title: "CreateSessionRequest"
57
  };
58
+ var CreateSessionResponseSchema = {
59
+ properties: {
60
+ workspace_id: {
61
+ type: "string",
62
+ title: "Workspace Id"
63
+ },
64
+ camera_room_ids: {
65
+ additionalProperties: {
66
+ type: "string"
67
+ },
68
+ type: "object",
69
+ title: "Camera Room Ids"
70
+ },
71
+ joint_input_room_id: {
72
+ type: "string",
73
+ title: "Joint Input Room Id"
74
+ },
75
+ joint_output_room_id: {
76
+ type: "string",
77
+ title: "Joint Output Room Id"
78
+ }
79
+ },
80
+ type: "object",
81
+ required: ["workspace_id", "camera_room_ids", "joint_input_room_id", "joint_output_room_id"],
82
+ title: "CreateSessionResponse"
83
  };
84
+ var HTTPValidationErrorSchema = {
85
+ properties: {
86
+ detail: {
87
+ items: {
88
+ $ref: "#/components/schemas/ValidationError"
89
+ },
90
+ type: "array",
91
+ title: "Detail"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
92
  }
93
+ },
94
+ type: "object",
95
+ title: "HTTPValidationError"
96
+ };
97
+ var SessionStatusResponseSchema = {
98
+ properties: {
99
+ session_id: {
100
+ type: "string",
101
+ title: "Session Id"
102
+ },
103
+ status: {
104
+ type: "string",
105
+ title: "Status"
106
+ },
107
+ policy_path: {
108
+ type: "string",
109
+ title: "Policy Path"
110
+ },
111
+ policy_type: {
112
+ type: "string",
113
+ title: "Policy Type"
114
+ },
115
+ camera_names: {
116
+ items: {
117
+ type: "string"
118
+ },
119
+ type: "array",
120
+ title: "Camera Names"
121
+ },
122
+ workspace_id: {
123
+ type: "string",
124
+ title: "Workspace Id"
125
+ },
126
+ rooms: {
127
+ additionalProperties: true,
128
+ type: "object",
129
+ title: "Rooms"
130
+ },
131
+ stats: {
132
+ additionalProperties: true,
133
+ type: "object",
134
+ title: "Stats"
135
+ },
136
+ inference_stats: {
137
+ anyOf: [
138
+ {
139
+ additionalProperties: true,
140
+ type: "object"
141
+ },
142
+ {
143
+ type: "null"
 
 
 
 
 
 
 
 
 
144
  }
145
+ ],
146
+ title: "Inference Stats"
147
+ },
148
+ error_message: {
149
+ anyOf: [
150
+ {
151
+ type: "string"
152
+ },
153
+ {
154
+ type: "null"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
155
  }
156
+ ],
157
+ title: "Error Message"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
158
  }
159
+ },
160
+ type: "object",
161
+ required: ["session_id", "status", "policy_path", "policy_type", "camera_names", "workspace_id", "rooms", "stats"],
162
+ title: "SessionStatusResponse"
163
+ };
164
+ var ValidationErrorSchema = {
165
+ properties: {
166
+ loc: {
167
+ items: {
168
+ anyOf: [
169
+ {
170
+ type: "string"
171
+ },
172
+ {
173
+ type: "integer"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
174
  }
175
+ ]
176
+ },
177
+ type: "array",
178
+ title: "Location"
179
+ },
180
+ msg: {
181
+ type: "string",
182
+ title: "Message"
183
+ },
184
+ type: {
185
+ type: "string",
186
+ title: "Error Type"
187
+ }
188
+ },
189
+ type: "object",
190
+ required: ["loc", "msg", "type"],
191
+ title: "ValidationError"
192
+ };
193
+ // node_modules/@hey-api/client-fetch/dist/node/index.mjs
194
+ var e = /\{[^{}]+\}/g;
195
+ var t = ({ allowReserved: e2, name: t2, value: r }) => {
196
+ if (r == null)
197
+ return "";
198
+ if (typeof r == "object")
199
+ throw new Error("Deeply-nested arrays/objects aren\u2019t supported. Provide your own `querySerializer()` to handle these.");
200
+ return `${t2}=${e2 ? r : encodeURIComponent(r)}`;
201
+ };
202
+ var r = ({ allowReserved: e2, explode: r2, name: s, style: a, value: n }) => {
203
+ if (!r2) {
204
+ const t2 = (e2 ? n : n.map((e3) => encodeURIComponent(e3))).join(((e3) => {
205
+ switch (e3) {
206
+ case "form":
207
+ default:
208
+ return ",";
209
+ case "pipeDelimited":
210
+ return "|";
211
+ case "spaceDelimited":
212
+ return "%20";
213
+ }
214
+ })(a));
215
+ switch (a) {
216
+ case "label":
217
+ return `.${t2}`;
218
+ case "matrix":
219
+ return `;${s}=${t2}`;
220
+ case "simple":
221
+ return t2;
 
 
 
 
 
222
  default:
223
+ return `${s}=${t2}`;
224
  }
225
  }
226
+ const o = ((e3) => {
227
+ switch (e3) {
228
+ case "label":
229
+ return ".";
230
+ case "matrix":
231
+ return ";";
232
+ case "simple":
233
+ return ",";
234
+ default:
235
+ return "&";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
236
  }
237
+ })(a), l = n.map((r3) => a === "label" || a === "simple" ? e2 ? r3 : encodeURIComponent(r3) : t({ allowReserved: e2, name: s, value: r3 })).join(o);
238
+ return a === "label" || a === "matrix" ? o + l : l;
239
+ };
240
+ var s = ({ allowReserved: e2, explode: r2, name: s2, style: a, value: n }) => {
241
+ if (n instanceof Date)
242
+ return `${s2}=${n.toISOString()}`;
243
+ if (a !== "deepObject" && !r2) {
244
+ let t2 = [];
245
+ Object.entries(n).forEach(([r4, s3]) => {
246
+ t2 = [...t2, r4, e2 ? s3 : encodeURIComponent(s3)];
247
  });
248
+ const r3 = t2.join(",");
249
+ switch (a) {
250
+ case "form":
251
+ return `${s2}=${r3}`;
252
+ case "label":
253
+ return `.${r3}`;
254
+ case "matrix":
255
+ return `;${s2}=${r3}`;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
256
  default:
257
+ return r3;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
258
  }
 
 
 
 
 
 
 
 
259
  }
260
+ const o = ((e3) => {
261
+ switch (e3) {
262
+ case "label":
263
+ return ".";
264
+ case "matrix":
265
+ return ";";
266
+ case "simple":
267
+ return ",";
 
 
 
 
 
 
 
 
268
  default:
269
+ return "&";
270
  }
271
+ })(a), l = Object.entries(n).map(([r3, n2]) => t({ allowReserved: e2, name: a === "deepObject" ? `${s2}[${r3}]` : r3, value: n2 })).join(o);
272
+ return a === "label" || a === "matrix" ? o + l : l;
273
+ };
274
+ var a = ({ allowReserved: e2, array: a2, object: n } = {}) => (o) => {
275
+ let l = [];
276
+ if (o && typeof o == "object")
277
+ for (const i in o) {
278
+ const c = o[i];
279
+ c != null && (l = Array.isArray(c) ? [...l, r({ allowReserved: e2, explode: true, name: i, style: "form", value: c, ...a2 })] : typeof c != "object" ? [...l, t({ allowReserved: e2, name: i, value: c })] : [...l, s({ allowReserved: e2, explode: true, name: i, style: "deepObject", value: c, ...n })]);
280
+ }
281
+ return l.join("&");
282
+ };
283
+ var n = ({ baseUrl: a2, path: n2, query: o, querySerializer: l, url: i }) => {
284
+ let c = a2 + (i.startsWith("/") ? i : `/${i}`);
285
+ n2 && (c = (({ path: a3, url: n3 }) => {
286
+ let o2 = n3;
287
+ const l2 = n3.match(e);
288
+ if (l2)
289
+ for (const e2 of l2) {
290
+ let n4 = false, l3 = e2.substring(1, e2.length - 1), i2 = "simple";
291
+ l3.endsWith("*") && (n4 = true, l3 = l3.substring(0, l3.length - 1)), l3.startsWith(".") ? (l3 = l3.substring(1), i2 = "label") : l3.startsWith(";") && (l3 = l3.substring(1), i2 = "matrix");
292
+ const c2 = a3[l3];
293
+ c2 != null && (o2 = Array.isArray(c2) ? o2.replace(e2, r({ explode: n4, name: l3, style: i2, value: c2 })) : typeof c2 != "object" ? i2 !== "matrix" ? o2.replace(e2, i2 === "label" ? `.${c2}` : c2) : o2.replace(e2, `;${t({ name: l3, value: c2 })}`) : o2.replace(e2, s({ explode: n4, name: l3, style: i2, value: c2 })));
294
+ }
295
+ return o2;
296
+ })({ path: n2, url: c }));
297
+ let u = o ? l(o) : "";
298
+ return u.startsWith("?") && (u = u.substring(1)), u && (c += `?${u}`), c;
299
+ };
300
+ var o = (e2, t2) => {
301
+ const r2 = { ...e2, ...t2 };
302
+ return r2.baseUrl?.endsWith("/") && (r2.baseUrl = r2.baseUrl.substring(0, r2.baseUrl.length - 1)), r2.headers = l(e2.headers, t2.headers), r2;
303
+ };
304
+ var l = (...e2) => {
305
+ const t2 = new Headers;
306
+ for (const r2 of e2) {
307
+ if (!r2 || typeof r2 != "object")
308
+ continue;
309
+ const e3 = r2 instanceof Headers ? r2.entries() : Object.entries(r2);
310
+ for (const [r3, s2] of e3)
311
+ if (s2 === null)
312
+ t2.delete(r3);
313
+ else if (Array.isArray(s2))
314
+ for (const e4 of s2)
315
+ t2.append(r3, e4);
316
+ else
317
+ s2 !== undefined && t2.set(r3, typeof s2 == "object" ? JSON.stringify(s2) : s2);
318
  }
319
+ return t2;
320
+ };
321
+
322
+ class i {
323
+ _fns;
324
+ constructor() {
325
+ this._fns = [];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
326
  }
327
+ eject(e2) {
328
+ const t2 = this._fns.indexOf(e2);
329
+ t2 !== -1 && (this._fns = [...this._fns.slice(0, t2), ...this._fns.slice(t2 + 1)]);
 
 
 
 
 
330
  }
331
+ use(e2) {
332
+ this._fns = [...this._fns, e2];
 
 
 
 
 
333
  }
 
334
  }
335
+ var d = { bodySerializer: (e2) => JSON.stringify(e2) };
336
+ var h = a({ allowReserved: false, array: { explode: true, style: "form" }, object: { explode: true, style: "deepObject" } });
337
+ var y = { "Content-Type": "application/json" };
338
+ var m = (e2 = {}) => ({ ...d, baseUrl: "", fetch: globalThis.fetch, headers: y, parseAs: "auto", querySerializer: h, ...e2 });
339
+ var b = (e2 = {}) => {
340
+ let t2 = o(m(), e2);
341
+ const r2 = () => ({ ...t2 }), s2 = { request: new i, response: new i }, c = async (e3) => {
342
+ const r3 = { ...t2, ...e3, headers: l(t2.headers, e3.headers) };
343
+ r3.body && r3.bodySerializer && (r3.body = r3.bodySerializer(r3.body)), r3.body || r3.headers.delete("Content-Type");
344
+ const o2 = n({ baseUrl: r3.baseUrl ?? "", path: r3.path, query: r3.query, querySerializer: typeof r3.querySerializer == "function" ? r3.querySerializer : a(r3.querySerializer), url: r3.url }), i2 = { redirect: "follow", ...r3 };
345
+ let c2 = new Request(o2, i2);
346
+ for (const e4 of s2.request._fns)
347
+ c2 = await e4(c2, r3);
348
+ const u = r3.fetch;
349
+ let d2 = await u(c2);
350
+ for (const e4 of s2.response._fns)
351
+ d2 = await e4(d2, c2, r3);
352
+ const p = { request: c2, response: d2 };
353
+ if (d2.ok) {
354
+ if (d2.status === 204 || d2.headers.get("Content-Length") === "0")
355
+ return { data: {}, ...p };
356
+ if (r3.parseAs === "stream")
357
+ return { data: d2.body, ...p };
358
+ const e4 = (r3.parseAs === "auto" ? ((e5) => {
359
+ if (e5)
360
+ return e5.startsWith("application/json") || e5.endsWith("+json") ? "json" : e5 === "multipart/form-data" ? "formData" : ["application/", "audio/", "image/", "video/"].some((t4) => e5.startsWith(t4)) ? "blob" : e5.startsWith("text/") ? "text" : undefined;
361
+ })(d2.headers.get("Content-Type")) : r3.parseAs) ?? "json";
362
+ let t3 = await d2[e4]();
363
+ return e4 === "json" && r3.responseTransformer && (t3 = await r3.responseTransformer(t3)), { data: t3, ...p };
364
+ }
365
+ let f = await d2.text();
366
+ if (r3.throwOnError)
367
+ throw new Error(f);
368
+ try {
369
+ f = JSON.parse(f);
370
+ } catch {}
371
+ return { error: f || {}, ...p };
372
+ };
373
+ return { connect: (e3) => c({ ...e3, method: "CONNECT" }), delete: (e3) => c({ ...e3, method: "DELETE" }), get: (e3) => c({ ...e3, method: "GET" }), getConfig: r2, head: (e3) => c({ ...e3, method: "HEAD" }), interceptors: s2, options: (e3) => c({ ...e3, method: "OPTIONS" }), patch: (e3) => c({ ...e3, method: "PATCH" }), post: (e3) => c({ ...e3, method: "POST" }), put: (e3) => c({ ...e3, method: "PUT" }), request: c, setConfig: (e3) => (t2 = o(t2, e3), r2()), trace: (e3) => c({ ...e3, method: "TRACE" }) };
374
+ };
375
 
376
+ // src/generated/services.gen.ts
377
+ var client = b(m());
378
+ var rootGet = (options) => {
379
+ return (options?.client ?? client).get({
380
+ ...options,
381
+ url: "/"
382
+ });
383
+ };
384
+ var healthCheckHealthGet = (options) => {
385
+ return (options?.client ?? client).get({
386
+ ...options,
387
+ url: "/health"
388
+ });
389
+ };
390
+ var listPoliciesPoliciesGet = (options) => {
391
+ return (options?.client ?? client).get({
392
+ ...options,
393
+ url: "/policies"
394
+ });
395
+ };
396
+ var listSessionsSessionsGet = (options) => {
397
+ return (options?.client ?? client).get({
398
+ ...options,
399
+ url: "/sessions"
400
+ });
401
+ };
402
+ var createSessionSessionsPost = (options) => {
403
+ return (options?.client ?? client).post({
404
+ ...options,
405
+ url: "/sessions"
406
+ });
407
+ };
408
+ var getSessionStatusSessionsSessionIdGet = (options) => {
409
+ return (options?.client ?? client).get({
410
+ ...options,
411
+ url: "/sessions/{session_id}"
412
+ });
413
+ };
414
+ var deleteSessionSessionsSessionIdDelete = (options) => {
415
+ return (options?.client ?? client).delete({
416
+ ...options,
417
+ url: "/sessions/{session_id}"
418
+ });
419
+ };
420
+ var startInferenceSessionsSessionIdStartPost = (options) => {
421
+ return (options?.client ?? client).post({
422
+ ...options,
423
+ url: "/sessions/{session_id}/start"
424
+ });
425
+ };
426
+ var stopInferenceSessionsSessionIdStopPost = (options) => {
427
+ return (options?.client ?? client).post({
428
+ ...options,
429
+ url: "/sessions/{session_id}/stop"
430
+ });
431
+ };
432
+ var restartInferenceSessionsSessionIdRestartPost = (options) => {
433
+ return (options?.client ?? client).post({
434
+ ...options,
435
+ url: "/sessions/{session_id}/restart"
436
+ });
437
+ };
438
+ var getSystemInfoDebugSystemGet = (options) => {
439
+ return (options?.client ?? client).get({
440
+ ...options,
441
+ url: "/debug/system"
442
+ });
443
+ };
444
+ var getRecentLogsDebugLogsGet = (options) => {
445
+ return (options?.client ?? client).get({
446
+ ...options,
447
+ url: "/debug/logs"
448
+ });
449
+ };
450
+ var debugResetSessionDebugSessionsSessionIdResetPost = (options) => {
451
+ return (options?.client ?? client).post({
452
+ ...options,
453
+ url: "/debug/sessions/{session_id}/reset"
454
+ });
455
+ };
456
+ var getSessionQueueInfoDebugSessionsSessionIdQueueGet = (options) => {
457
+ return (options?.client ?? client).get({
458
+ ...options,
459
+ url: "/debug/sessions/{session_id}/queue"
460
+ });
461
+ };
462
+ // src/index.ts
463
+ class LeRobotInferenceServerClient {
464
  baseUrl;
465
+ constructor(baseUrl) {
466
+ this.baseUrl = baseUrl;
467
+ client.setConfig({ baseUrl });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
468
  }
469
+ async isHealthy() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
470
  try {
471
+ const response = await healthCheckHealthGet();
472
+ return !response.error;
473
+ } catch {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
474
  return false;
475
  }
476
  }
477
+ async getHealth() {
478
+ const response = await healthCheckHealthGet();
479
+ if (response.error) {
480
+ throw new Error(`Health check failed: ${JSON.stringify(response.error)}`);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
481
  }
482
+ return response.data;
483
  }
484
+ async createSession(request) {
485
+ const response = await createSessionSessionsPost({
486
+ body: request
487
+ });
488
+ if (response.error) {
489
+ throw new Error(`Failed to create session: ${JSON.stringify(response.error)}`);
 
 
 
 
 
 
490
  }
491
+ return response.data;
 
492
  }
493
+ async listSessions() {
494
+ const response = await listSessionsSessionsGet();
495
+ if (response.error) {
496
+ throw new Error(`Failed to list sessions: ${JSON.stringify(response.error)}`);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
497
  }
498
+ return response.data;
499
  }
500
+ async getSessionStatus(sessionId) {
501
+ const response = await getSessionStatusSessionsSessionIdGet({
502
+ path: { session_id: sessionId }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
503
  });
504
+ if (response.error) {
505
+ throw new Error(`Failed to get session status: ${JSON.stringify(response.error)}`);
506
  }
507
+ return response.data;
508
  }
509
+ async startInference(sessionId) {
510
+ const response = await startInferenceSessionsSessionIdStartPost({
511
+ path: { session_id: sessionId }
 
 
 
 
 
 
512
  });
513
+ if (response.error) {
514
+ throw new Error(`Failed to start inference: ${JSON.stringify(response.error)}`);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
515
  }
 
516
  }
517
+ async stopInference(sessionId) {
518
+ const response = await stopInferenceSessionsSessionIdStopPost({
519
+ path: { session_id: sessionId }
 
 
520
  });
521
+ if (response.error) {
522
+ throw new Error(`Failed to stop inference: ${JSON.stringify(response.error)}`);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
523
  }
524
  }
525
+ async restartInference(sessionId) {
526
+ const response = await restartInferenceSessionsSessionIdRestartPost({
527
+ path: { session_id: sessionId }
528
+ });
529
+ if (response.error) {
530
+ throw new Error(`Failed to restart inference: ${JSON.stringify(response.error)}`);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
531
  }
532
  }
533
+ async deleteSession(sessionId) {
534
+ const response = await deleteSessionSessionsSessionIdDelete({
535
+ path: { session_id: sessionId }
536
+ });
537
+ if (response.error) {
538
+ throw new Error(`Failed to delete session: ${JSON.stringify(response.error)}`);
 
 
 
 
 
 
 
 
539
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
540
  }
541
+ async waitForSessionStatus(sessionId, targetStatus, timeoutMs = 30000) {
542
+ const startTime = Date.now();
543
+ while (Date.now() - startTime < timeoutMs) {
544
+ const status = await this.getSessionStatus(sessionId);
545
+ if (status.status === targetStatus) {
546
+ return status;
 
 
 
 
 
547
  }
548
+ await new Promise((resolve) => setTimeout(resolve, 1000));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
549
  }
550
+ throw new Error(`Timeout waiting for session ${sessionId} to reach status ${targetStatus}`);
551
  }
552
+ async createAndStartSession(request) {
553
+ const session = await this.createSession(request);
554
+ await this.startInference(request.session_id);
555
+ const status = await this.waitForSessionStatus(request.session_id, "running");
556
+ return { session, status };
 
 
 
 
 
 
557
  }
558
+ async getSystemInfo() {
559
+ const response = await getSystemInfoDebugSystemGet();
560
+ if (response.error) {
561
+ throw new Error(`Failed to get system info: ${JSON.stringify(response.error)}`);
562
  }
563
+ return response.data;
564
  }
565
+ async debugResetSession(sessionId) {
566
+ const response = await debugResetSessionDebugSessionsSessionIdResetPost({
567
+ path: { session_id: sessionId }
568
+ });
569
+ if (response.error) {
570
+ throw new Error(`Failed to reset session: ${JSON.stringify(response.error)}`);
571
  }
 
572
  }
573
+ async getSessionQueueInfo(sessionId) {
574
+ const response = await getSessionQueueInfoDebugSessionsSessionIdQueueGet({
575
+ path: { session_id: sessionId }
 
 
 
576
  });
577
+ if (response.error) {
578
+ throw new Error(`Failed to get queue info: ${JSON.stringify(response.error)}`);
579
+ }
580
+ return response.data;
581
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
582
  }
583
+ function createClient(baseUrl) {
584
+ return new LeRobotInferenceServerClient(baseUrl);
 
 
 
 
 
585
  }
586
+ var LeRobotAIServerClient = LeRobotInferenceServerClient;
 
587
  export {
588
+ stopInferenceSessionsSessionIdStopPost,
589
+ startInferenceSessionsSessionIdStartPost,
590
+ rootGet,
591
+ restartInferenceSessionsSessionIdRestartPost,
592
+ listSessionsSessionsGet,
593
+ listPoliciesPoliciesGet,
594
+ healthCheckHealthGet,
595
+ getSystemInfoDebugSystemGet,
596
+ getSessionStatusSessionsSessionIdGet,
597
+ getSessionQueueInfoDebugSessionsSessionIdQueueGet,
598
+ getRecentLogsDebugLogsGet,
599
+ deleteSessionSessionsSessionIdDelete,
600
+ debugResetSessionDebugSessionsSessionIdResetPost,
601
+ createSessionSessionsPost,
602
+ createClient,
603
+ client,
604
+ ValidationErrorSchema,
605
+ SessionStatusResponseSchema,
606
+ LeRobotInferenceServerClient,
607
+ LeRobotAIServerClient,
608
+ HTTPValidationErrorSchema,
609
+ CreateSessionResponseSchema,
610
+ CreateSessionRequestSchema
611
  };
612
 
613
+ //# debugId=2097EAE219935B0E64756E2164756E21
614
  //# sourceMappingURL=index.js.map
client/dist/index.js.map CHANGED
The diff for this file is too large to render. See raw diff
 
client/src/generated/index.ts ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ // This file is auto-generated by @hey-api/openapi-ts
2
+ export * from './schemas.gen';
3
+ export * from './services.gen';
4
+ export * from './types.gen';
client/src/generated/schemas.gen.ts ADDED
@@ -0,0 +1,196 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // This file is auto-generated by @hey-api/openapi-ts
2
+
3
+ export const CreateSessionRequestSchema = {
4
+ properties: {
5
+ session_id: {
6
+ type: 'string',
7
+ title: 'Session Id'
8
+ },
9
+ policy_path: {
10
+ type: 'string',
11
+ title: 'Policy Path'
12
+ },
13
+ camera_names: {
14
+ items: {
15
+ type: 'string'
16
+ },
17
+ type: 'array',
18
+ title: 'Camera Names',
19
+ default: ['front']
20
+ },
21
+ arena_server_url: {
22
+ type: 'string',
23
+ title: 'Arena Server Url',
24
+ default: 'http://localhost:8000'
25
+ },
26
+ workspace_id: {
27
+ anyOf: [
28
+ {
29
+ type: 'string'
30
+ },
31
+ {
32
+ type: 'null'
33
+ }
34
+ ],
35
+ title: 'Workspace Id'
36
+ },
37
+ policy_type: {
38
+ type: 'string',
39
+ title: 'Policy Type',
40
+ default: 'act'
41
+ },
42
+ language_instruction: {
43
+ anyOf: [
44
+ {
45
+ type: 'string'
46
+ },
47
+ {
48
+ type: 'null'
49
+ }
50
+ ],
51
+ title: 'Language Instruction'
52
+ }
53
+ },
54
+ type: 'object',
55
+ required: ['session_id', 'policy_path'],
56
+ title: 'CreateSessionRequest'
57
+ } as const;
58
+
59
+ export const CreateSessionResponseSchema = {
60
+ properties: {
61
+ workspace_id: {
62
+ type: 'string',
63
+ title: 'Workspace Id'
64
+ },
65
+ camera_room_ids: {
66
+ additionalProperties: {
67
+ type: 'string'
68
+ },
69
+ type: 'object',
70
+ title: 'Camera Room Ids'
71
+ },
72
+ joint_input_room_id: {
73
+ type: 'string',
74
+ title: 'Joint Input Room Id'
75
+ },
76
+ joint_output_room_id: {
77
+ type: 'string',
78
+ title: 'Joint Output Room Id'
79
+ }
80
+ },
81
+ type: 'object',
82
+ required: ['workspace_id', 'camera_room_ids', 'joint_input_room_id', 'joint_output_room_id'],
83
+ title: 'CreateSessionResponse'
84
+ } as const;
85
+
86
+ export const HTTPValidationErrorSchema = {
87
+ properties: {
88
+ detail: {
89
+ items: {
90
+ '$ref': '#/components/schemas/ValidationError'
91
+ },
92
+ type: 'array',
93
+ title: 'Detail'
94
+ }
95
+ },
96
+ type: 'object',
97
+ title: 'HTTPValidationError'
98
+ } as const;
99
+
100
+ export const SessionStatusResponseSchema = {
101
+ properties: {
102
+ session_id: {
103
+ type: 'string',
104
+ title: 'Session Id'
105
+ },
106
+ status: {
107
+ type: 'string',
108
+ title: 'Status'
109
+ },
110
+ policy_path: {
111
+ type: 'string',
112
+ title: 'Policy Path'
113
+ },
114
+ policy_type: {
115
+ type: 'string',
116
+ title: 'Policy Type'
117
+ },
118
+ camera_names: {
119
+ items: {
120
+ type: 'string'
121
+ },
122
+ type: 'array',
123
+ title: 'Camera Names'
124
+ },
125
+ workspace_id: {
126
+ type: 'string',
127
+ title: 'Workspace Id'
128
+ },
129
+ rooms: {
130
+ additionalProperties: true,
131
+ type: 'object',
132
+ title: 'Rooms'
133
+ },
134
+ stats: {
135
+ additionalProperties: true,
136
+ type: 'object',
137
+ title: 'Stats'
138
+ },
139
+ inference_stats: {
140
+ anyOf: [
141
+ {
142
+ additionalProperties: true,
143
+ type: 'object'
144
+ },
145
+ {
146
+ type: 'null'
147
+ }
148
+ ],
149
+ title: 'Inference Stats'
150
+ },
151
+ error_message: {
152
+ anyOf: [
153
+ {
154
+ type: 'string'
155
+ },
156
+ {
157
+ type: 'null'
158
+ }
159
+ ],
160
+ title: 'Error Message'
161
+ }
162
+ },
163
+ type: 'object',
164
+ required: ['session_id', 'status', 'policy_path', 'policy_type', 'camera_names', 'workspace_id', 'rooms', 'stats'],
165
+ title: 'SessionStatusResponse'
166
+ } as const;
167
+
168
+ export const ValidationErrorSchema = {
169
+ properties: {
170
+ loc: {
171
+ items: {
172
+ anyOf: [
173
+ {
174
+ type: 'string'
175
+ },
176
+ {
177
+ type: 'integer'
178
+ }
179
+ ]
180
+ },
181
+ type: 'array',
182
+ title: 'Location'
183
+ },
184
+ msg: {
185
+ type: 'string',
186
+ title: 'Message'
187
+ },
188
+ type: {
189
+ type: 'string',
190
+ title: 'Error Type'
191
+ }
192
+ },
193
+ type: 'object',
194
+ required: ['loc', 'msg', 'type'],
195
+ title: 'ValidationError'
196
+ } as const;
client/src/generated/services.gen.ts ADDED
@@ -0,0 +1,164 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // This file is auto-generated by @hey-api/openapi-ts
2
+
3
+ import { createClient, createConfig, type Options } from '@hey-api/client-fetch';
4
+ import type { RootGetError, RootGetResponse, HealthCheckHealthGetError, HealthCheckHealthGetResponse, ListPoliciesPoliciesGetError, ListPoliciesPoliciesGetResponse, ListSessionsSessionsGetError, ListSessionsSessionsGetResponse, CreateSessionSessionsPostData, CreateSessionSessionsPostError, CreateSessionSessionsPostResponse, GetSessionStatusSessionsSessionIdGetData, GetSessionStatusSessionsSessionIdGetError, GetSessionStatusSessionsSessionIdGetResponse, DeleteSessionSessionsSessionIdDeleteData, DeleteSessionSessionsSessionIdDeleteError, DeleteSessionSessionsSessionIdDeleteResponse, StartInferenceSessionsSessionIdStartPostData, StartInferenceSessionsSessionIdStartPostError, StartInferenceSessionsSessionIdStartPostResponse, StopInferenceSessionsSessionIdStopPostData, StopInferenceSessionsSessionIdStopPostError, StopInferenceSessionsSessionIdStopPostResponse, RestartInferenceSessionsSessionIdRestartPostData, RestartInferenceSessionsSessionIdRestartPostError, RestartInferenceSessionsSessionIdRestartPostResponse, GetSystemInfoDebugSystemGetError, GetSystemInfoDebugSystemGetResponse, GetRecentLogsDebugLogsGetError, GetRecentLogsDebugLogsGetResponse, DebugResetSessionDebugSessionsSessionIdResetPostData, DebugResetSessionDebugSessionsSessionIdResetPostError, DebugResetSessionDebugSessionsSessionIdResetPostResponse, GetSessionQueueInfoDebugSessionsSessionIdQueueGetData, GetSessionQueueInfoDebugSessionsSessionIdQueueGetError, GetSessionQueueInfoDebugSessionsSessionIdQueueGetResponse } from './types.gen';
5
+
6
+ export const client = createClient(createConfig());
7
+
8
+ /**
9
+ * Root
10
+ * Health check endpoint.
11
+ */
12
+ export const rootGet = <ThrowOnError extends boolean = false>(options?: Options<unknown, ThrowOnError>) => {
13
+ return (options?.client ?? client).get<RootGetResponse, RootGetError, ThrowOnError>({
14
+ ...options,
15
+ url: '/'
16
+ });
17
+ };
18
+
19
+ /**
20
+ * Health Check
21
+ * Detailed health check.
22
+ */
23
+ export const healthCheckHealthGet = <ThrowOnError extends boolean = false>(options?: Options<unknown, ThrowOnError>) => {
24
+ return (options?.client ?? client).get<HealthCheckHealthGetResponse, HealthCheckHealthGetError, ThrowOnError>({
25
+ ...options,
26
+ url: '/health'
27
+ });
28
+ };
29
+
30
+ /**
31
+ * List Policies
32
+ * List supported policy types.
33
+ */
34
+ export const listPoliciesPoliciesGet = <ThrowOnError extends boolean = false>(options?: Options<unknown, ThrowOnError>) => {
35
+ return (options?.client ?? client).get<ListPoliciesPoliciesGetResponse, ListPoliciesPoliciesGetError, ThrowOnError>({
36
+ ...options,
37
+ url: '/policies'
38
+ });
39
+ };
40
+
41
+ /**
42
+ * List Sessions
43
+ * List all sessions.
44
+ */
45
+ export const listSessionsSessionsGet = <ThrowOnError extends boolean = false>(options?: Options<unknown, ThrowOnError>) => {
46
+ return (options?.client ?? client).get<ListSessionsSessionsGetResponse, ListSessionsSessionsGetError, ThrowOnError>({
47
+ ...options,
48
+ url: '/sessions'
49
+ });
50
+ };
51
+
52
+ /**
53
+ * Create Session
54
+ * Create a new inference session.
55
+ *
56
+ * If workspace_id is provided, all rooms will be created in that workspace.
57
+ * If workspace_id is not provided, a new workspace will be generated automatically.
58
+ * All rooms for a session (cameras + joints) are always created in the same workspace.
59
+ */
60
+ export const createSessionSessionsPost = <ThrowOnError extends boolean = false>(options: Options<CreateSessionSessionsPostData, ThrowOnError>) => {
61
+ return (options?.client ?? client).post<CreateSessionSessionsPostResponse, CreateSessionSessionsPostError, ThrowOnError>({
62
+ ...options,
63
+ url: '/sessions'
64
+ });
65
+ };
66
+
67
+ /**
68
+ * Get Session Status
69
+ * Get status of a specific session.
70
+ */
71
+ export const getSessionStatusSessionsSessionIdGet = <ThrowOnError extends boolean = false>(options: Options<GetSessionStatusSessionsSessionIdGetData, ThrowOnError>) => {
72
+ return (options?.client ?? client).get<GetSessionStatusSessionsSessionIdGetResponse, GetSessionStatusSessionsSessionIdGetError, ThrowOnError>({
73
+ ...options,
74
+ url: '/sessions/{session_id}'
75
+ });
76
+ };
77
+
78
+ /**
79
+ * Delete Session
80
+ * Delete a session.
81
+ */
82
+ export const deleteSessionSessionsSessionIdDelete = <ThrowOnError extends boolean = false>(options: Options<DeleteSessionSessionsSessionIdDeleteData, ThrowOnError>) => {
83
+ return (options?.client ?? client).delete<DeleteSessionSessionsSessionIdDeleteResponse, DeleteSessionSessionsSessionIdDeleteError, ThrowOnError>({
84
+ ...options,
85
+ url: '/sessions/{session_id}'
86
+ });
87
+ };
88
+
89
+ /**
90
+ * Start Inference
91
+ * Start inference for a session.
92
+ */
93
+ export const startInferenceSessionsSessionIdStartPost = <ThrowOnError extends boolean = false>(options: Options<StartInferenceSessionsSessionIdStartPostData, ThrowOnError>) => {
94
+ return (options?.client ?? client).post<StartInferenceSessionsSessionIdStartPostResponse, StartInferenceSessionsSessionIdStartPostError, ThrowOnError>({
95
+ ...options,
96
+ url: '/sessions/{session_id}/start'
97
+ });
98
+ };
99
+
100
+ /**
101
+ * Stop Inference
102
+ * Stop inference for a session.
103
+ */
104
+ export const stopInferenceSessionsSessionIdStopPost = <ThrowOnError extends boolean = false>(options: Options<StopInferenceSessionsSessionIdStopPostData, ThrowOnError>) => {
105
+ return (options?.client ?? client).post<StopInferenceSessionsSessionIdStopPostResponse, StopInferenceSessionsSessionIdStopPostError, ThrowOnError>({
106
+ ...options,
107
+ url: '/sessions/{session_id}/stop'
108
+ });
109
+ };
110
+
111
+ /**
112
+ * Restart Inference
113
+ * Restart inference for a session.
114
+ */
115
+ export const restartInferenceSessionsSessionIdRestartPost = <ThrowOnError extends boolean = false>(options: Options<RestartInferenceSessionsSessionIdRestartPostData, ThrowOnError>) => {
116
+ return (options?.client ?? client).post<RestartInferenceSessionsSessionIdRestartPostResponse, RestartInferenceSessionsSessionIdRestartPostError, ThrowOnError>({
117
+ ...options,
118
+ url: '/sessions/{session_id}/restart'
119
+ });
120
+ };
121
+
122
+ /**
123
+ * Get System Info
124
+ * Get system information for debugging.
125
+ */
126
+ export const getSystemInfoDebugSystemGet = <ThrowOnError extends boolean = false>(options?: Options<unknown, ThrowOnError>) => {
127
+ return (options?.client ?? client).get<GetSystemInfoDebugSystemGetResponse, GetSystemInfoDebugSystemGetError, ThrowOnError>({
128
+ ...options,
129
+ url: '/debug/system'
130
+ });
131
+ };
132
+
133
+ /**
134
+ * Get Recent Logs
135
+ * Get recent log entries for debugging.
136
+ */
137
+ export const getRecentLogsDebugLogsGet = <ThrowOnError extends boolean = false>(options?: Options<unknown, ThrowOnError>) => {
138
+ return (options?.client ?? client).get<GetRecentLogsDebugLogsGetResponse, GetRecentLogsDebugLogsGetError, ThrowOnError>({
139
+ ...options,
140
+ url: '/debug/logs'
141
+ });
142
+ };
143
+
144
+ /**
145
+ * Debug Reset Session
146
+ * Reset a session's internal state for debugging.
147
+ */
148
+ export const debugResetSessionDebugSessionsSessionIdResetPost = <ThrowOnError extends boolean = false>(options: Options<DebugResetSessionDebugSessionsSessionIdResetPostData, ThrowOnError>) => {
149
+ return (options?.client ?? client).post<DebugResetSessionDebugSessionsSessionIdResetPostResponse, DebugResetSessionDebugSessionsSessionIdResetPostError, ThrowOnError>({
150
+ ...options,
151
+ url: '/debug/sessions/{session_id}/reset'
152
+ });
153
+ };
154
+
155
+ /**
156
+ * Get Session Queue Info
157
+ * Get detailed information about a session's action queue.
158
+ */
159
+ export const getSessionQueueInfoDebugSessionsSessionIdQueueGet = <ThrowOnError extends boolean = false>(options: Options<GetSessionQueueInfoDebugSessionsSessionIdQueueGetData, ThrowOnError>) => {
160
+ return (options?.client ?? client).get<GetSessionQueueInfoDebugSessionsSessionIdQueueGetResponse, GetSessionQueueInfoDebugSessionsSessionIdQueueGetError, ThrowOnError>({
161
+ ...options,
162
+ url: '/debug/sessions/{session_id}/queue'
163
+ });
164
+ };
client/src/generated/types.gen.ts ADDED
@@ -0,0 +1,151 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // This file is auto-generated by @hey-api/openapi-ts
2
+
3
+ export type CreateSessionRequest = {
4
+ session_id: string;
5
+ policy_path: string;
6
+ camera_names?: Array<(string)>;
7
+ arena_server_url?: string;
8
+ workspace_id?: (string | null);
9
+ policy_type?: string;
10
+ language_instruction?: (string | null);
11
+ };
12
+
13
+ export type CreateSessionResponse = {
14
+ workspace_id: string;
15
+ camera_room_ids: {
16
+ [key: string]: (string);
17
+ };
18
+ joint_input_room_id: string;
19
+ joint_output_room_id: string;
20
+ };
21
+
22
+ export type HTTPValidationError = {
23
+ detail?: Array<ValidationError>;
24
+ };
25
+
26
+ export type SessionStatusResponse = {
27
+ session_id: string;
28
+ status: string;
29
+ policy_path: string;
30
+ policy_type: string;
31
+ camera_names: Array<(string)>;
32
+ workspace_id: string;
33
+ rooms: {
34
+ [key: string]: unknown;
35
+ };
36
+ stats: {
37
+ [key: string]: unknown;
38
+ };
39
+ inference_stats?: ({
40
+ [key: string]: unknown;
41
+ } | null);
42
+ error_message?: (string | null);
43
+ };
44
+
45
+ export type ValidationError = {
46
+ loc: Array<(string | number)>;
47
+ msg: string;
48
+ type: string;
49
+ };
50
+
51
+ export type RootGetResponse = (unknown);
52
+
53
+ export type RootGetError = unknown;
54
+
55
+ export type HealthCheckHealthGetResponse = (unknown);
56
+
57
+ export type HealthCheckHealthGetError = unknown;
58
+
59
+ export type ListPoliciesPoliciesGetResponse = (unknown);
60
+
61
+ export type ListPoliciesPoliciesGetError = unknown;
62
+
63
+ export type ListSessionsSessionsGetResponse = (Array<SessionStatusResponse>);
64
+
65
+ export type ListSessionsSessionsGetError = unknown;
66
+
67
+ export type CreateSessionSessionsPostData = {
68
+ body: CreateSessionRequest;
69
+ };
70
+
71
+ export type CreateSessionSessionsPostResponse = (CreateSessionResponse);
72
+
73
+ export type CreateSessionSessionsPostError = (HTTPValidationError);
74
+
75
+ export type GetSessionStatusSessionsSessionIdGetData = {
76
+ path: {
77
+ session_id: string;
78
+ };
79
+ };
80
+
81
+ export type GetSessionStatusSessionsSessionIdGetResponse = (SessionStatusResponse);
82
+
83
+ export type GetSessionStatusSessionsSessionIdGetError = (HTTPValidationError);
84
+
85
+ export type DeleteSessionSessionsSessionIdDeleteData = {
86
+ path: {
87
+ session_id: string;
88
+ };
89
+ };
90
+
91
+ export type DeleteSessionSessionsSessionIdDeleteResponse = (unknown);
92
+
93
+ export type DeleteSessionSessionsSessionIdDeleteError = (HTTPValidationError);
94
+
95
+ export type StartInferenceSessionsSessionIdStartPostData = {
96
+ path: {
97
+ session_id: string;
98
+ };
99
+ };
100
+
101
+ export type StartInferenceSessionsSessionIdStartPostResponse = (unknown);
102
+
103
+ export type StartInferenceSessionsSessionIdStartPostError = (HTTPValidationError);
104
+
105
+ export type StopInferenceSessionsSessionIdStopPostData = {
106
+ path: {
107
+ session_id: string;
108
+ };
109
+ };
110
+
111
+ export type StopInferenceSessionsSessionIdStopPostResponse = (unknown);
112
+
113
+ export type StopInferenceSessionsSessionIdStopPostError = (HTTPValidationError);
114
+
115
+ export type RestartInferenceSessionsSessionIdRestartPostData = {
116
+ path: {
117
+ session_id: string;
118
+ };
119
+ };
120
+
121
+ export type RestartInferenceSessionsSessionIdRestartPostResponse = (unknown);
122
+
123
+ export type RestartInferenceSessionsSessionIdRestartPostError = (HTTPValidationError);
124
+
125
+ export type GetSystemInfoDebugSystemGetResponse = (unknown);
126
+
127
+ export type GetSystemInfoDebugSystemGetError = unknown;
128
+
129
+ export type GetRecentLogsDebugLogsGetResponse = (unknown);
130
+
131
+ export type GetRecentLogsDebugLogsGetError = unknown;
132
+
133
+ export type DebugResetSessionDebugSessionsSessionIdResetPostData = {
134
+ path: {
135
+ session_id: string;
136
+ };
137
+ };
138
+
139
+ export type DebugResetSessionDebugSessionsSessionIdResetPostResponse = (unknown);
140
+
141
+ export type DebugResetSessionDebugSessionsSessionIdResetPostError = (HTTPValidationError);
142
+
143
+ export type GetSessionQueueInfoDebugSessionsSessionIdQueueGetData = {
144
+ path: {
145
+ session_id: string;
146
+ };
147
+ };
148
+
149
+ export type GetSessionQueueInfoDebugSessionsSessionIdQueueGetResponse = (unknown);
150
+
151
+ export type GetSessionQueueInfoDebugSessionsSessionIdQueueGetError = (HTTPValidationError);
src/inference_server.egg-info/PKG-INFO CHANGED
@@ -14,7 +14,7 @@ Requires-Dist: httpx>=0.28.1
14
  Requires-Dist: huggingface-hub>=0.32.4
15
  Requires-Dist: imageio[ffmpeg]>=2.37.0
16
  Requires-Dist: lerobot
17
- Requires-Dist: robohub-transport-server-client
18
  Requires-Dist: numpy>=1.26.4
19
  Requires-Dist: opencv-python>=4.11.0.86
20
  Requires-Dist: opencv-python-headless>=4.11.0.86
 
14
  Requires-Dist: huggingface-hub>=0.32.4
15
  Requires-Dist: imageio[ffmpeg]>=2.37.0
16
  Requires-Dist: lerobot
17
+ Requires-Dist: robothub-transport-server-client
18
  Requires-Dist: numpy>=1.26.4
19
  Requires-Dist: opencv-python>=4.11.0.86
20
  Requires-Dist: opencv-python-headless>=4.11.0.86
src/inference_server.egg-info/requires.txt CHANGED
@@ -8,7 +8,7 @@ httpx>=0.28.1
8
  huggingface-hub>=0.32.4
9
  imageio[ffmpeg]>=2.37.0
10
  lerobot
11
- robohub-transport-server-client
12
  numpy>=1.26.4
13
  opencv-python>=4.11.0.86
14
  opencv-python-headless>=4.11.0.86
 
8
  huggingface-hub>=0.32.4
9
  imageio[ffmpeg]>=2.37.0
10
  lerobot
11
+ robothub-transport-server-client
12
  numpy>=1.26.4
13
  opencv-python>=4.11.0.86
14
  opencv-python-headless>=4.11.0.86