@electric-agent/studio 1.7.0 → 1.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/active-sessions.d.ts +2 -0
- package/dist/active-sessions.d.ts.map +1 -1
- package/dist/active-sessions.js +4 -0
- package/dist/active-sessions.js.map +1 -1
- package/dist/api-schemas.d.ts +225 -0
- package/dist/api-schemas.d.ts.map +1 -0
- package/dist/api-schemas.js +95 -0
- package/dist/api-schemas.js.map +1 -0
- package/dist/bridge/claude-code-base.d.ts +121 -0
- package/dist/bridge/claude-code-base.d.ts.map +1 -0
- package/dist/bridge/claude-code-base.js +263 -0
- package/dist/bridge/claude-code-base.js.map +1 -0
- package/dist/bridge/claude-code-docker.d.ts +13 -73
- package/dist/bridge/claude-code-docker.d.ts.map +1 -1
- package/dist/bridge/claude-code-docker.js +91 -302
- package/dist/bridge/claude-code-docker.js.map +1 -1
- package/dist/bridge/claude-code-sprites.d.ts +12 -59
- package/dist/bridge/claude-code-sprites.d.ts.map +1 -1
- package/dist/bridge/claude-code-sprites.js +88 -281
- package/dist/bridge/claude-code-sprites.js.map +1 -1
- package/dist/bridge/claude-md-generator.d.ts +15 -3
- package/dist/bridge/claude-md-generator.d.ts.map +1 -1
- package/dist/bridge/claude-md-generator.js +79 -98
- package/dist/bridge/claude-md-generator.js.map +1 -1
- package/dist/bridge/codex-docker.d.ts +56 -51
- package/dist/bridge/codex-docker.js +222 -230
- package/dist/bridge/codex-json-parser.d.ts +11 -11
- package/dist/bridge/codex-json-parser.js +231 -238
- package/dist/bridge/codex-md-generator.d.ts +3 -3
- package/dist/bridge/codex-md-generator.js +42 -32
- package/dist/bridge/codex-sprites.d.ts +50 -45
- package/dist/bridge/codex-sprites.js +212 -222
- package/dist/bridge/daytona.d.ts +25 -25
- package/dist/bridge/daytona.js +131 -136
- package/dist/bridge/docker-stdio.d.ts +21 -21
- package/dist/bridge/docker-stdio.js +126 -132
- package/dist/bridge/hosted.d.ts +3 -2
- package/dist/bridge/hosted.d.ts.map +1 -1
- package/dist/bridge/hosted.js +4 -0
- package/dist/bridge/hosted.js.map +1 -1
- package/dist/bridge/message-parser.d.ts +24 -0
- package/dist/bridge/message-parser.d.ts.map +1 -0
- package/dist/bridge/message-parser.js +39 -0
- package/dist/bridge/message-parser.js.map +1 -0
- package/dist/bridge/role-skills.d.ts +25 -0
- package/dist/bridge/role-skills.d.ts.map +1 -0
- package/dist/bridge/role-skills.js +120 -0
- package/dist/bridge/role-skills.js.map +1 -0
- package/dist/bridge/room-messaging-skill.d.ts +11 -0
- package/dist/bridge/room-messaging-skill.d.ts.map +1 -0
- package/dist/bridge/room-messaging-skill.js +41 -0
- package/dist/bridge/room-messaging-skill.js.map +1 -0
- package/dist/bridge/sprites.d.ts +22 -22
- package/dist/bridge/sprites.js +123 -128
- package/dist/bridge/types.d.ts +4 -10
- package/dist/bridge/types.d.ts.map +1 -1
- package/dist/client/assets/index-BfvQSMwH.css +1 -0
- package/dist/client/assets/index-CtOOaA2Q.js +235 -0
- package/dist/client/index.html +2 -2
- package/dist/github-app.d.ts +14 -0
- package/dist/github-app.d.ts.map +1 -0
- package/dist/github-app.js +62 -0
- package/dist/github-app.js.map +1 -0
- package/dist/github-app.test.d.ts +2 -0
- package/dist/github-app.test.d.ts.map +1 -0
- package/dist/github-app.test.js +62 -0
- package/dist/github-app.test.js.map +1 -0
- package/dist/index.d.ts +4 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/invite-code.d.ts +5 -0
- package/dist/invite-code.d.ts.map +1 -0
- package/dist/invite-code.js +14 -0
- package/dist/invite-code.js.map +1 -0
- package/dist/project-utils.d.ts.map +1 -1
- package/dist/project-utils.js.map +1 -1
- package/dist/registry.d.ts +11 -4
- package/dist/registry.d.ts.map +1 -1
- package/dist/registry.js +1 -1
- package/dist/registry.js.map +1 -1
- package/dist/room-router.d.ts +73 -0
- package/dist/room-router.d.ts.map +1 -0
- package/dist/room-router.js +345 -0
- package/dist/room-router.js.map +1 -0
- package/dist/sandbox/docker.d.ts +1 -0
- package/dist/sandbox/docker.d.ts.map +1 -1
- package/dist/sandbox/docker.js +56 -6
- package/dist/sandbox/docker.js.map +1 -1
- package/dist/sandbox/index.d.ts +0 -1
- package/dist/sandbox/index.d.ts.map +1 -1
- package/dist/sandbox/index.js +0 -1
- package/dist/sandbox/index.js.map +1 -1
- package/dist/sandbox/sprites.d.ts +1 -0
- package/dist/sandbox/sprites.d.ts.map +1 -1
- package/dist/sandbox/sprites.js +91 -10
- package/dist/sandbox/sprites.js.map +1 -1
- package/dist/sandbox/types.d.ts +9 -2
- package/dist/sandbox/types.d.ts.map +1 -1
- package/dist/server.d.ts +12 -0
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +906 -445
- package/dist/server.js.map +1 -1
- package/dist/session-auth.d.ts +9 -0
- package/dist/session-auth.d.ts.map +1 -1
- package/dist/session-auth.js +30 -0
- package/dist/session-auth.js.map +1 -1
- package/dist/sessions.d.ts +1 -1
- package/dist/streams.d.ts +2 -6
- package/dist/streams.d.ts.map +1 -1
- package/dist/streams.js +6 -17
- package/dist/streams.js.map +1 -1
- package/dist/validate.d.ts +10 -0
- package/dist/validate.d.ts.map +1 -0
- package/dist/validate.js +24 -0
- package/dist/validate.js.map +1 -0
- package/package.json +6 -9
- package/dist/client/assets/index-D5-jqAV-.js +0 -234
- package/dist/client/assets/index-YyyiO26y.css +0 -1
|
@@ -15,6 +15,8 @@ export declare class ActiveSessions {
|
|
|
15
15
|
delete(id: string): boolean;
|
|
16
16
|
/** Check if a session exists in the active store. */
|
|
17
17
|
has(id: string): boolean;
|
|
18
|
+
/** Return the number of active sessions. */
|
|
19
|
+
size(): number;
|
|
18
20
|
/**
|
|
19
21
|
* Look up the EA session ID for a Claude Code transcript path.
|
|
20
22
|
* Returns undefined if no mapping exists or the session has been deleted.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"active-sessions.d.ts","sourceRoot":"","sources":["../src/active-sessions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAEhD;;;;;;GAMG;AACH,qBAAa,cAAc;IAC1B,OAAO,CAAC,QAAQ,CAAiC;IACjD,OAAO,CAAC,mBAAmB,CAA4B;IAEvD,GAAG,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI;IAI/B,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS;IAIxC,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,WAAW,CAAC,GAAG,IAAI;IAStD,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO;IAI3B,qDAAqD;IACrD,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO;
|
|
1
|
+
{"version":3,"file":"active-sessions.d.ts","sourceRoot":"","sources":["../src/active-sessions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAEhD;;;;;;GAMG;AACH,qBAAa,cAAc;IAC1B,OAAO,CAAC,QAAQ,CAAiC;IACjD,OAAO,CAAC,mBAAmB,CAA4B;IAEvD,GAAG,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI;IAI/B,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS;IAIxC,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,WAAW,CAAC,GAAG,IAAI;IAStD,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO;IAI3B,qDAAqD;IACrD,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO;IAIxB,4CAA4C;IAC5C,IAAI,IAAI,MAAM;IAMd;;;OAGG;IACH,eAAe,CAAC,cAAc,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAM3D;;OAEG;IACH,aAAa,CAAC,cAAc,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI;CAG9D"}
|
package/dist/active-sessions.js
CHANGED
|
@@ -29,6 +29,10 @@ export class ActiveSessions {
|
|
|
29
29
|
has(id) {
|
|
30
30
|
return this.sessions.has(id);
|
|
31
31
|
}
|
|
32
|
+
/** Return the number of active sessions. */
|
|
33
|
+
size() {
|
|
34
|
+
return this.sessions.size;
|
|
35
|
+
}
|
|
32
36
|
// --- Transcript → Session Mapping (for Claude Code hook integration) ---
|
|
33
37
|
/**
|
|
34
38
|
* Look up the EA session ID for a Claude Code transcript path.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"active-sessions.js","sourceRoot":"","sources":["../src/active-sessions.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,MAAM,OAAO,cAAc;IAClB,QAAQ,GAAG,IAAI,GAAG,EAAuB,CAAA;IACzC,mBAAmB,GAAG,IAAI,GAAG,EAAkB,CAAA;IAEvD,GAAG,CAAC,OAAoB;QACvB,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,EAAE,OAAO,CAAC,CAAA;IACvC,CAAC;IAED,GAAG,CAAC,EAAU;QACb,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;IAC7B,CAAC;IAED,MAAM,CAAC,EAAU,EAAE,MAA4B;QAC9C,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;QACrC,IAAI,OAAO,EAAE,CAAC;YACb,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE;gBAC9B,YAAY,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;aACtC,CAAC,CAAA;QACH,CAAC;IACF,CAAC;IAED,MAAM,CAAC,EAAU;QAChB,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,CAAA;IAChC,CAAC;IAED,qDA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AAE,CAAC,WAAW,EAAE;aACtC,CAAC,CAAA;QACH,CAAC;IACF,CAAC;IAED,MAAM,CAAC,EAAU;QAChB,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,CAAA;IAChC,CAAC;IAED,qDAAqD;IACrD,GAAG,CAAC,EAAU;QACb,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;IAC7B,CAAC;IAED,4CAA4C;IAC5C,IAAI;QACH,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAA;IAC1B,CAAC;IAED,0EAA0E;IAE1E;;;OAGG;IACH,eAAe,CAAC,cAAsB;QACrC,MAAM,SAAS,GAAG,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAAC,cAAc,CAAC,CAAA;QAC9D,IAAI,CAAC,SAAS;YAAE,OAAO,SAAS,CAAA;QAChC,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAA;IAC5D,CAAC;IAED;;OAEG;IACH,aAAa,CAAC,cAAsB,EAAE,SAAiB;QACtD,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAAC,cAAc,EAAE,SAAS,CAAC,CAAA;IACxD,CAAC;CACD"}
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zod schemas for API request body validation.
|
|
3
|
+
*
|
|
4
|
+
* Each schema corresponds to a POST endpoint in server.ts.
|
|
5
|
+
* Using `.passthrough()` where backwards-compat matters (unknown fields ignored).
|
|
6
|
+
*/
|
|
7
|
+
import { z } from "zod";
|
|
8
|
+
export declare const createSessionSchema: z.ZodObject<{
|
|
9
|
+
description: z.ZodString;
|
|
10
|
+
name: z.ZodOptional<z.ZodString>;
|
|
11
|
+
baseDir: z.ZodOptional<z.ZodString>;
|
|
12
|
+
freeform: z.ZodOptional<z.ZodBoolean>;
|
|
13
|
+
apiKey: z.ZodOptional<z.ZodString>;
|
|
14
|
+
oauthToken: z.ZodOptional<z.ZodString>;
|
|
15
|
+
ghToken: z.ZodOptional<z.ZodString>;
|
|
16
|
+
}, "strip", z.ZodTypeAny, {
|
|
17
|
+
description: string;
|
|
18
|
+
name?: string | undefined;
|
|
19
|
+
baseDir?: string | undefined;
|
|
20
|
+
freeform?: boolean | undefined;
|
|
21
|
+
apiKey?: string | undefined;
|
|
22
|
+
oauthToken?: string | undefined;
|
|
23
|
+
ghToken?: string | undefined;
|
|
24
|
+
}, {
|
|
25
|
+
description: string;
|
|
26
|
+
name?: string | undefined;
|
|
27
|
+
baseDir?: string | undefined;
|
|
28
|
+
freeform?: boolean | undefined;
|
|
29
|
+
apiKey?: string | undefined;
|
|
30
|
+
oauthToken?: string | undefined;
|
|
31
|
+
ghToken?: string | undefined;
|
|
32
|
+
}>;
|
|
33
|
+
export declare const iterateSessionSchema: z.ZodObject<{
|
|
34
|
+
request: z.ZodString;
|
|
35
|
+
}, "strip", z.ZodTypeAny, {
|
|
36
|
+
request: string;
|
|
37
|
+
}, {
|
|
38
|
+
request: string;
|
|
39
|
+
}>;
|
|
40
|
+
export declare const createSandboxSchema: z.ZodObject<{
|
|
41
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
42
|
+
projectName: z.ZodOptional<z.ZodString>;
|
|
43
|
+
infra: z.ZodOptional<z.ZodDiscriminatedUnion<"mode", [z.ZodObject<{
|
|
44
|
+
mode: z.ZodLiteral<"none">;
|
|
45
|
+
}, "strip", z.ZodTypeAny, {
|
|
46
|
+
mode: "none";
|
|
47
|
+
}, {
|
|
48
|
+
mode: "none";
|
|
49
|
+
}>, z.ZodObject<{
|
|
50
|
+
mode: z.ZodLiteral<"local">;
|
|
51
|
+
}, "strip", z.ZodTypeAny, {
|
|
52
|
+
mode: "local";
|
|
53
|
+
}, {
|
|
54
|
+
mode: "local";
|
|
55
|
+
}>, z.ZodObject<{
|
|
56
|
+
mode: z.ZodLiteral<"cloud">;
|
|
57
|
+
databaseUrl: z.ZodString;
|
|
58
|
+
electricUrl: z.ZodString;
|
|
59
|
+
sourceId: z.ZodString;
|
|
60
|
+
secret: z.ZodString;
|
|
61
|
+
}, "strip", z.ZodTypeAny, {
|
|
62
|
+
mode: "cloud";
|
|
63
|
+
databaseUrl: string;
|
|
64
|
+
electricUrl: string;
|
|
65
|
+
sourceId: string;
|
|
66
|
+
secret: string;
|
|
67
|
+
}, {
|
|
68
|
+
mode: "cloud";
|
|
69
|
+
databaseUrl: string;
|
|
70
|
+
electricUrl: string;
|
|
71
|
+
sourceId: string;
|
|
72
|
+
secret: string;
|
|
73
|
+
}>, z.ZodObject<{
|
|
74
|
+
mode: z.ZodLiteral<"claim">;
|
|
75
|
+
databaseUrl: z.ZodString;
|
|
76
|
+
electricUrl: z.ZodString;
|
|
77
|
+
sourceId: z.ZodString;
|
|
78
|
+
secret: z.ZodString;
|
|
79
|
+
claimId: z.ZodString;
|
|
80
|
+
}, "strip", z.ZodTypeAny, {
|
|
81
|
+
claimId: string;
|
|
82
|
+
mode: "claim";
|
|
83
|
+
databaseUrl: string;
|
|
84
|
+
electricUrl: string;
|
|
85
|
+
sourceId: string;
|
|
86
|
+
secret: string;
|
|
87
|
+
}, {
|
|
88
|
+
claimId: string;
|
|
89
|
+
mode: "claim";
|
|
90
|
+
databaseUrl: string;
|
|
91
|
+
electricUrl: string;
|
|
92
|
+
sourceId: string;
|
|
93
|
+
secret: string;
|
|
94
|
+
}>]>>;
|
|
95
|
+
}, "strip", z.ZodTypeAny, {
|
|
96
|
+
projectName?: string | undefined;
|
|
97
|
+
sessionId?: string | undefined;
|
|
98
|
+
infra?: {
|
|
99
|
+
mode: "none";
|
|
100
|
+
} | {
|
|
101
|
+
mode: "local";
|
|
102
|
+
} | {
|
|
103
|
+
mode: "cloud";
|
|
104
|
+
databaseUrl: string;
|
|
105
|
+
electricUrl: string;
|
|
106
|
+
sourceId: string;
|
|
107
|
+
secret: string;
|
|
108
|
+
} | {
|
|
109
|
+
claimId: string;
|
|
110
|
+
mode: "claim";
|
|
111
|
+
databaseUrl: string;
|
|
112
|
+
electricUrl: string;
|
|
113
|
+
sourceId: string;
|
|
114
|
+
secret: string;
|
|
115
|
+
} | undefined;
|
|
116
|
+
}, {
|
|
117
|
+
projectName?: string | undefined;
|
|
118
|
+
sessionId?: string | undefined;
|
|
119
|
+
infra?: {
|
|
120
|
+
mode: "none";
|
|
121
|
+
} | {
|
|
122
|
+
mode: "local";
|
|
123
|
+
} | {
|
|
124
|
+
mode: "cloud";
|
|
125
|
+
databaseUrl: string;
|
|
126
|
+
electricUrl: string;
|
|
127
|
+
sourceId: string;
|
|
128
|
+
secret: string;
|
|
129
|
+
} | {
|
|
130
|
+
claimId: string;
|
|
131
|
+
mode: "claim";
|
|
132
|
+
databaseUrl: string;
|
|
133
|
+
electricUrl: string;
|
|
134
|
+
sourceId: string;
|
|
135
|
+
secret: string;
|
|
136
|
+
} | undefined;
|
|
137
|
+
}>;
|
|
138
|
+
export declare const createRoomSchema: z.ZodObject<{
|
|
139
|
+
name: z.ZodString;
|
|
140
|
+
maxRounds: z.ZodOptional<z.ZodNumber>;
|
|
141
|
+
}, "strip", z.ZodTypeAny, {
|
|
142
|
+
name: string;
|
|
143
|
+
maxRounds?: number | undefined;
|
|
144
|
+
}, {
|
|
145
|
+
name: string;
|
|
146
|
+
maxRounds?: number | undefined;
|
|
147
|
+
}>;
|
|
148
|
+
export declare const addAgentSchema: z.ZodObject<{
|
|
149
|
+
name: z.ZodOptional<z.ZodString>;
|
|
150
|
+
role: z.ZodOptional<z.ZodString>;
|
|
151
|
+
gated: z.ZodOptional<z.ZodBoolean>;
|
|
152
|
+
initialPrompt: z.ZodOptional<z.ZodString>;
|
|
153
|
+
apiKey: z.ZodOptional<z.ZodString>;
|
|
154
|
+
oauthToken: z.ZodOptional<z.ZodString>;
|
|
155
|
+
ghToken: z.ZodOptional<z.ZodString>;
|
|
156
|
+
}, "strip", z.ZodTypeAny, {
|
|
157
|
+
name?: string | undefined;
|
|
158
|
+
apiKey?: string | undefined;
|
|
159
|
+
oauthToken?: string | undefined;
|
|
160
|
+
ghToken?: string | undefined;
|
|
161
|
+
role?: string | undefined;
|
|
162
|
+
gated?: boolean | undefined;
|
|
163
|
+
initialPrompt?: string | undefined;
|
|
164
|
+
}, {
|
|
165
|
+
name?: string | undefined;
|
|
166
|
+
apiKey?: string | undefined;
|
|
167
|
+
oauthToken?: string | undefined;
|
|
168
|
+
ghToken?: string | undefined;
|
|
169
|
+
role?: string | undefined;
|
|
170
|
+
gated?: boolean | undefined;
|
|
171
|
+
initialPrompt?: string | undefined;
|
|
172
|
+
}>;
|
|
173
|
+
export declare const addSessionToRoomSchema: z.ZodObject<{
|
|
174
|
+
sessionId: z.ZodString;
|
|
175
|
+
name: z.ZodString;
|
|
176
|
+
initialPrompt: z.ZodOptional<z.ZodString>;
|
|
177
|
+
}, "strip", z.ZodTypeAny, {
|
|
178
|
+
name: string;
|
|
179
|
+
sessionId: string;
|
|
180
|
+
initialPrompt?: string | undefined;
|
|
181
|
+
}, {
|
|
182
|
+
name: string;
|
|
183
|
+
sessionId: string;
|
|
184
|
+
initialPrompt?: string | undefined;
|
|
185
|
+
}>;
|
|
186
|
+
export declare const iterateRoomSessionSchema: z.ZodObject<{
|
|
187
|
+
request: z.ZodString;
|
|
188
|
+
}, "strip", z.ZodTypeAny, {
|
|
189
|
+
request: string;
|
|
190
|
+
}, {
|
|
191
|
+
request: string;
|
|
192
|
+
}>;
|
|
193
|
+
export declare const sendRoomMessageSchema: z.ZodObject<{
|
|
194
|
+
from: z.ZodString;
|
|
195
|
+
body: z.ZodString;
|
|
196
|
+
to: z.ZodOptional<z.ZodString>;
|
|
197
|
+
}, "strip", z.ZodTypeAny, {
|
|
198
|
+
from: string;
|
|
199
|
+
body: string;
|
|
200
|
+
to?: string | undefined;
|
|
201
|
+
}, {
|
|
202
|
+
from: string;
|
|
203
|
+
body: string;
|
|
204
|
+
to?: string | undefined;
|
|
205
|
+
}>;
|
|
206
|
+
export declare const resumeSessionSchema: z.ZodObject<{
|
|
207
|
+
repoUrl: z.ZodString;
|
|
208
|
+
branch: z.ZodOptional<z.ZodString>;
|
|
209
|
+
apiKey: z.ZodOptional<z.ZodString>;
|
|
210
|
+
oauthToken: z.ZodOptional<z.ZodString>;
|
|
211
|
+
ghToken: z.ZodOptional<z.ZodString>;
|
|
212
|
+
}, "strip", z.ZodTypeAny, {
|
|
213
|
+
repoUrl: string;
|
|
214
|
+
apiKey?: string | undefined;
|
|
215
|
+
oauthToken?: string | undefined;
|
|
216
|
+
ghToken?: string | undefined;
|
|
217
|
+
branch?: string | undefined;
|
|
218
|
+
}, {
|
|
219
|
+
repoUrl: string;
|
|
220
|
+
apiKey?: string | undefined;
|
|
221
|
+
oauthToken?: string | undefined;
|
|
222
|
+
ghToken?: string | undefined;
|
|
223
|
+
branch?: string | undefined;
|
|
224
|
+
}>;
|
|
225
|
+
//# sourceMappingURL=api-schemas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-schemas.d.ts","sourceRoot":"","sources":["../src/api-schemas.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAUvB,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;EAQ9B,CAAA;AAGF,eAAO,MAAM,oBAAoB;;;;;;EAE/B,CAAA;AA2BF,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAI9B,CAAA;AAGF,eAAO,MAAM,gBAAgB;;;;;;;;;EAG3B,CAAA;AAGF,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;EAQzB,CAAA;AAGF,eAAO,MAAM,sBAAsB;;;;;;;;;;;;EAIjC,CAAA;AAGF,eAAO,MAAM,wBAAwB;;;;;;EAEnC,CAAA;AAGF,eAAO,MAAM,qBAAqB;;;;;;;;;;;;EAIhC,CAAA;AAGF,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;EAM9B,CAAA"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zod schemas for API request body validation.
|
|
3
|
+
*
|
|
4
|
+
* Each schema corresponds to a POST endpoint in server.ts.
|
|
5
|
+
* Using `.passthrough()` where backwards-compat matters (unknown fields ignored).
|
|
6
|
+
*/
|
|
7
|
+
import { z } from "zod";
|
|
8
|
+
/** Max length for free-text fields to prevent abuse */
|
|
9
|
+
const MAX_TEXT = 10_000;
|
|
10
|
+
const MAX_SHORT = 500;
|
|
11
|
+
const MAX_KEY = 1_000;
|
|
12
|
+
const optionalKey = z.string().max(MAX_KEY).optional();
|
|
13
|
+
// POST /api/sessions
|
|
14
|
+
export const createSessionSchema = z.object({
|
|
15
|
+
description: z.string().min(1).max(MAX_TEXT),
|
|
16
|
+
name: z.string().max(MAX_SHORT).optional(),
|
|
17
|
+
baseDir: z.string().max(MAX_SHORT).optional(),
|
|
18
|
+
freeform: z.boolean().optional(),
|
|
19
|
+
apiKey: optionalKey,
|
|
20
|
+
oauthToken: optionalKey,
|
|
21
|
+
ghToken: optionalKey,
|
|
22
|
+
});
|
|
23
|
+
// POST /api/sessions/:id/iterate
|
|
24
|
+
export const iterateSessionSchema = z.object({
|
|
25
|
+
request: z.string().min(1).max(MAX_TEXT),
|
|
26
|
+
});
|
|
27
|
+
// POST /api/sandboxes
|
|
28
|
+
const infraNoneSchema = z.object({ mode: z.literal("none") });
|
|
29
|
+
const infraLocalSchema = z.object({ mode: z.literal("local") });
|
|
30
|
+
const infraCloudSchema = z.object({
|
|
31
|
+
mode: z.literal("cloud"),
|
|
32
|
+
databaseUrl: z.string().max(MAX_KEY),
|
|
33
|
+
electricUrl: z.string().max(MAX_KEY),
|
|
34
|
+
sourceId: z.string().max(MAX_SHORT),
|
|
35
|
+
secret: z.string().max(MAX_KEY),
|
|
36
|
+
});
|
|
37
|
+
const infraClaimSchema = z.object({
|
|
38
|
+
mode: z.literal("claim"),
|
|
39
|
+
databaseUrl: z.string().max(MAX_KEY),
|
|
40
|
+
electricUrl: z.string().max(MAX_KEY),
|
|
41
|
+
sourceId: z.string().max(MAX_SHORT),
|
|
42
|
+
secret: z.string().max(MAX_KEY),
|
|
43
|
+
claimId: z.string().max(MAX_SHORT),
|
|
44
|
+
});
|
|
45
|
+
const infraConfigSchema = z.discriminatedUnion("mode", [
|
|
46
|
+
infraNoneSchema,
|
|
47
|
+
infraLocalSchema,
|
|
48
|
+
infraCloudSchema,
|
|
49
|
+
infraClaimSchema,
|
|
50
|
+
]);
|
|
51
|
+
export const createSandboxSchema = z.object({
|
|
52
|
+
sessionId: z.string().uuid().optional(),
|
|
53
|
+
projectName: z.string().max(MAX_SHORT).optional(),
|
|
54
|
+
infra: infraConfigSchema.optional(),
|
|
55
|
+
});
|
|
56
|
+
// POST /api/rooms
|
|
57
|
+
export const createRoomSchema = z.object({
|
|
58
|
+
name: z.string().min(1).max(MAX_SHORT),
|
|
59
|
+
maxRounds: z.number().int().positive().optional(),
|
|
60
|
+
});
|
|
61
|
+
// POST /api/rooms/:id/agents
|
|
62
|
+
export const addAgentSchema = z.object({
|
|
63
|
+
name: z.string().max(MAX_SHORT).optional(),
|
|
64
|
+
role: z.string().max(MAX_SHORT).optional(),
|
|
65
|
+
gated: z.boolean().optional(),
|
|
66
|
+
initialPrompt: z.string().max(MAX_TEXT).optional(),
|
|
67
|
+
apiKey: optionalKey,
|
|
68
|
+
oauthToken: optionalKey,
|
|
69
|
+
ghToken: optionalKey,
|
|
70
|
+
});
|
|
71
|
+
// POST /api/rooms/:id/sessions
|
|
72
|
+
export const addSessionToRoomSchema = z.object({
|
|
73
|
+
sessionId: z.string().uuid(),
|
|
74
|
+
name: z.string().min(1).max(MAX_SHORT),
|
|
75
|
+
initialPrompt: z.string().max(MAX_TEXT).optional(),
|
|
76
|
+
});
|
|
77
|
+
// POST /api/rooms/:id/sessions/:sessionId/iterate
|
|
78
|
+
export const iterateRoomSessionSchema = z.object({
|
|
79
|
+
request: z.string().min(1).max(MAX_TEXT),
|
|
80
|
+
});
|
|
81
|
+
// POST /api/rooms/:id/messages
|
|
82
|
+
export const sendRoomMessageSchema = z.object({
|
|
83
|
+
from: z.string().min(1).max(MAX_SHORT),
|
|
84
|
+
body: z.string().min(1).max(MAX_TEXT),
|
|
85
|
+
to: z.string().max(MAX_SHORT).optional(),
|
|
86
|
+
});
|
|
87
|
+
// POST /api/sessions/resume
|
|
88
|
+
export const resumeSessionSchema = z.object({
|
|
89
|
+
repoUrl: z.string().min(1).max(MAX_KEY),
|
|
90
|
+
branch: z.string().max(MAX_SHORT).optional(),
|
|
91
|
+
apiKey: optionalKey,
|
|
92
|
+
oauthToken: optionalKey,
|
|
93
|
+
ghToken: optionalKey,
|
|
94
|
+
});
|
|
95
|
+
//# sourceMappingURL=api-schemas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-schemas.js","sourceRoot":"","sources":["../src/api-schemas.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,uDAAuD;AACvD,MAAM,QAAQ,GAAG,MAAM,CAAA;AACvB,MAAM,SAAS,GAAG,GAAG,CAAA;AACrB,MAAM,OAAO,GAAG,KAAK,CAAA;AAErB,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,CAAA;AAEtD,qBAAqB;AACrB,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC;IAC5C,IAAI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E,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC;IACrC,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,QAAQ,EAAE;CACxC,CAAC,CAAA;AAEF,4BAA4B;AAC5B,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC;IACvC,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,QAAQ,EAAE;IAC5C,MAAM,EAAE,WAAW;IACnB,UAAU,EAAE,WAAW;IACvB,OAAO,EAAE,WAAW;CACpB,CAAC,CAAA"}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Abstract base class for Claude Code bridges (Docker and Sprites).
|
|
3
|
+
*
|
|
4
|
+
* Encapsulates the shared logic for:
|
|
5
|
+
* - Durable Stream writing (emit, dispatchEvent)
|
|
6
|
+
* - Message queueing (sendCommand with queue-if-busy)
|
|
7
|
+
* - Event dispatching (callbacks, app_status detection)
|
|
8
|
+
* - Process lifecycle (exit handling, queue draining, session_end)
|
|
9
|
+
* - Gate responses
|
|
10
|
+
*
|
|
11
|
+
* Subclasses implement the platform-specific process management:
|
|
12
|
+
* - spawnProcess() — start a new Claude Code process
|
|
13
|
+
* - killProcess() — terminate the running process
|
|
14
|
+
* - isProcessAlive() — check if a process is currently running
|
|
15
|
+
* - writeToStdin(content) — write a user message to stdin
|
|
16
|
+
* - installHooksImpl() — install AskUserQuestion hooks
|
|
17
|
+
*/
|
|
18
|
+
import { DurableStream } from "@durable-streams/client";
|
|
19
|
+
import type { EngineEvent } from "@electric-agent/protocol";
|
|
20
|
+
import type { StreamConnectionInfo } from "../streams.js";
|
|
21
|
+
import { createStreamJsonParser } from "./stream-json-parser.js";
|
|
22
|
+
type StreamJsonParser = ReturnType<typeof createStreamJsonParser>;
|
|
23
|
+
import type { SessionBridge } from "./types.js";
|
|
24
|
+
export interface ClaudeCodeBaseConfig {
|
|
25
|
+
/** Initial prompt (the user's app description or task) */
|
|
26
|
+
prompt: string;
|
|
27
|
+
/** Working directory inside the container/sprite */
|
|
28
|
+
cwd: string;
|
|
29
|
+
/** Model to use (default: claude-sonnet-4-6) */
|
|
30
|
+
model?: string;
|
|
31
|
+
/** Allowed tools (default: all standard tools) */
|
|
32
|
+
allowedTools?: string[];
|
|
33
|
+
/** Additional CLI flags */
|
|
34
|
+
extraFlags?: string[];
|
|
35
|
+
/** HMAC token for authenticating hook-event requests back to the studio */
|
|
36
|
+
hookToken?: string;
|
|
37
|
+
/** Agent name — injected into assistant_message events for display */
|
|
38
|
+
agentName?: string;
|
|
39
|
+
}
|
|
40
|
+
export declare const DEFAULT_ALLOWED_TOOLS: string[];
|
|
41
|
+
/** Tools allowed in production mode — no WebSearch to prevent abuse */
|
|
42
|
+
export declare const PRODUCTION_ALLOWED_TOOLS: string[];
|
|
43
|
+
export declare abstract class ClaudeCodeBaseBridge implements SessionBridge {
|
|
44
|
+
readonly sessionId: string;
|
|
45
|
+
protected writer: DurableStream;
|
|
46
|
+
protected parser: StreamJsonParser;
|
|
47
|
+
protected closed: boolean;
|
|
48
|
+
protected running: boolean;
|
|
49
|
+
protected hooksInstalled: boolean;
|
|
50
|
+
/** Claude Code session ID captured from stream-json system.init — used for --resume */
|
|
51
|
+
protected claudeSessionId: string | null;
|
|
52
|
+
/** Whether the parser already emitted a session_end (from a "result" message) */
|
|
53
|
+
protected resultReceived: boolean;
|
|
54
|
+
/** Whether the process was intentionally interrupted (suppress exit handler session_end) */
|
|
55
|
+
protected interrupted: boolean;
|
|
56
|
+
/** Queued messages to deliver after the current process finishes */
|
|
57
|
+
protected pendingMessages: string[];
|
|
58
|
+
private agentEventCallbacks;
|
|
59
|
+
private completeCallbacks;
|
|
60
|
+
/** Logging prefix for console output (e.g., "claude-code-docker") */
|
|
61
|
+
protected abstract readonly logPrefix: string;
|
|
62
|
+
constructor(sessionId: string, connection: StreamConnectionInfo);
|
|
63
|
+
/** Spawn a new Claude Code process with the given prompt and optional resume session. */
|
|
64
|
+
protected abstract spawnProcess(prompt: string, resumeSessionId?: string): void | Promise<void>;
|
|
65
|
+
/** Kill the currently running process. */
|
|
66
|
+
protected abstract killProcess(): void;
|
|
67
|
+
/** Check if a process handle exists (not necessarily alive). */
|
|
68
|
+
protected abstract hasProcess(): boolean;
|
|
69
|
+
/** Write a raw string to the process's stdin. */
|
|
70
|
+
protected abstract writeToStdin(content: string): void;
|
|
71
|
+
/** Install AskUserQuestion hooks in the sandbox. */
|
|
72
|
+
protected abstract installHooksImpl(): void | Promise<void>;
|
|
73
|
+
/** Get the agent name for event injection. */
|
|
74
|
+
protected abstract getAgentName(): string | undefined;
|
|
75
|
+
emit(event: EngineEvent): Promise<void>;
|
|
76
|
+
/**
|
|
77
|
+
* Send a follow-up user message to Claude Code by respawning with --resume.
|
|
78
|
+
*
|
|
79
|
+
* If Claude Code is currently running, the message is queued and delivered
|
|
80
|
+
* after the current process finishes. This prevents killing the agent
|
|
81
|
+
* mid-work and losing in-flight file writes or tool calls.
|
|
82
|
+
*/
|
|
83
|
+
sendCommand(cmd: Record<string, unknown>): Promise<void>;
|
|
84
|
+
sendGateResponse(gate: string, value: Record<string, unknown>): Promise<void>;
|
|
85
|
+
onAgentEvent(cb: (event: EngineEvent) => void): void;
|
|
86
|
+
onComplete(cb: (success: boolean) => void): void;
|
|
87
|
+
abstract start(): Promise<void>;
|
|
88
|
+
isRunning(): boolean;
|
|
89
|
+
interrupt(): void;
|
|
90
|
+
close(): void;
|
|
91
|
+
/**
|
|
92
|
+
* Reset parser state before spawning a new process.
|
|
93
|
+
* Call this at the start of spawnProcess implementations.
|
|
94
|
+
*/
|
|
95
|
+
protected resetParserState(): void;
|
|
96
|
+
/**
|
|
97
|
+
* Install hooks if not already installed.
|
|
98
|
+
* Call this at the start of spawnProcess implementations.
|
|
99
|
+
*/
|
|
100
|
+
protected ensureHooksInstalled(): Promise<void>;
|
|
101
|
+
/**
|
|
102
|
+
* Handle a line of NDJSON output from Claude Code.
|
|
103
|
+
* Call this from stdout readline handlers.
|
|
104
|
+
*/
|
|
105
|
+
protected handleLine(line: string): void;
|
|
106
|
+
/**
|
|
107
|
+
* Handle process exit. Call this from process exit handlers.
|
|
108
|
+
* Defers processing to let pending readline events flush first.
|
|
109
|
+
*/
|
|
110
|
+
protected handleProcessExit(code: number | null): void;
|
|
111
|
+
/**
|
|
112
|
+
* Dispatch an engine event to the durable stream and all callbacks.
|
|
113
|
+
*/
|
|
114
|
+
protected dispatchEvent(event: EngineEvent): void;
|
|
115
|
+
/**
|
|
116
|
+
* Write a user message to Claude Code's stdin in stream-json format.
|
|
117
|
+
*/
|
|
118
|
+
private writeUserMessage;
|
|
119
|
+
}
|
|
120
|
+
export {};
|
|
121
|
+
//# sourceMappingURL=claude-code-base.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude-code-base.d.ts","sourceRoot":"","sources":["../../src/bridge/claude-code-base.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AACvD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AAE3D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAA;AAEzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAA;AAEhE,KAAK,gBAAgB,GAAG,UAAU,CAAC,OAAO,sBAAsB,CAAC,CAAA;AAEjE,OAAO,KAAK,EAAE,aAAa,EAAiB,MAAM,YAAY,CAAA;AAE9D,MAAM,WAAW,oBAAoB;IACpC,0DAA0D;IAC1D,MAAM,EAAE,MAAM,CAAA;IACd,oDAAoD;I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