robodev 0.37.0 → 0.37.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/package.json +3 -3
- package/src/dev-clients.test.ts +38 -0
- package/src/dev-clients.ts +19 -5
- package/src/dev-server.ts +2 -0
- package/src/dev.ts +2 -0
- package/templates/auth-chat/package.json +2 -2
- package/templates/backend/package.json +2 -2
- package/templates/empty/package.json +2 -2
- package/templates/marketplace/package.json +2 -2
- package/templates/space/package.json +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "robodev",
|
|
3
|
-
"version": "0.37.
|
|
3
|
+
"version": "0.37.1",
|
|
4
4
|
"description": "CLI for Robodev Starbase — create, auth, link, deploy, and run a project locally with robodev dev",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
"embedded-postgres": "17.10.0-beta.17",
|
|
27
27
|
"fastify": "^5.12.1",
|
|
28
28
|
"tsx": "^4.20.5",
|
|
29
|
-
"@robodev-ai/runtime": "0.4.
|
|
30
|
-
"@robodev-ai/sdk": "0.11.
|
|
29
|
+
"@robodev-ai/runtime": "0.4.2",
|
|
30
|
+
"@robodev-ai/sdk": "0.11.1"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@types/node": "^24.3.0",
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { mkdir, mkdtemp, writeFile } from "node:fs/promises";
|
|
3
|
+
import { tmpdir } from "node:os";
|
|
4
|
+
import { join } from "node:path";
|
|
5
|
+
import { test } from "node:test";
|
|
6
|
+
import { consoleEmailClient } from "./dev-clients.js";
|
|
7
|
+
import { createDevInspect } from "./dev-inspect.js";
|
|
8
|
+
|
|
9
|
+
test("consoleEmailClient renders a local robodev/emails catalog file", async () => {
|
|
10
|
+
const root = await mkdtemp(join(tmpdir(), "robodev-dev-email-"));
|
|
11
|
+
await mkdir(join(root, "robodev", "emails"), { recursive: true });
|
|
12
|
+
await writeFile(join(root, "robodev", "emails", "welcome.html"), "<p>Hi {{name}}</p>", "utf8");
|
|
13
|
+
await writeFile(
|
|
14
|
+
join(root, "robodev", "emails", "welcome.json"),
|
|
15
|
+
JSON.stringify({ subject: "Hello {{name}}", text: "Hi {{name}}" }),
|
|
16
|
+
"utf8",
|
|
17
|
+
);
|
|
18
|
+
const lines: string[] = [];
|
|
19
|
+
const inspect = createDevInspect({ max: 20 });
|
|
20
|
+
const email = consoleEmailClient((line) => lines.push(line), inspect, root);
|
|
21
|
+
const result = await email.send({
|
|
22
|
+
to: "ada@example.com",
|
|
23
|
+
template: "welcome",
|
|
24
|
+
vars: { name: "Ada" },
|
|
25
|
+
});
|
|
26
|
+
assert.equal(result.status, "sent");
|
|
27
|
+
assert.match(lines[0] ?? "", /Hello Ada/);
|
|
28
|
+
assert.match(lines[1] ?? "", /Hi Ada/);
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
test("consoleEmailClient throws template_not_found without a local file or body", async () => {
|
|
32
|
+
const inspect = createDevInspect({ max: 20 });
|
|
33
|
+
const email = consoleEmailClient(() => undefined, inspect, await mkdtemp(join(tmpdir(), "robodev-dev-email-")));
|
|
34
|
+
await assert.rejects(
|
|
35
|
+
() => email.send({ to: "ada@example.com", template: "missing" }),
|
|
36
|
+
/template_not_found/,
|
|
37
|
+
);
|
|
38
|
+
});
|
package/src/dev-clients.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createLocalStorageClient,
|
|
3
3
|
createProjectSocketsClient,
|
|
4
|
+
loadLocalEmailTemplate,
|
|
5
|
+
resolveEmailSendInput,
|
|
4
6
|
type StorageQueryable,
|
|
5
7
|
} from "@robodev-ai/runtime";
|
|
6
8
|
import type { RouteClients } from "@robodev-ai/runtime";
|
|
@@ -97,13 +99,24 @@ function inspectSocketsClient(client: SocketsClient, inspect: DevInspectStore):
|
|
|
97
99
|
export function consoleEmailClient(
|
|
98
100
|
log: (line: string) => void,
|
|
99
101
|
inspect: DevInspectStore,
|
|
102
|
+
projectRoot?: string,
|
|
100
103
|
): EmailClient {
|
|
101
104
|
return {
|
|
102
105
|
async send(input) {
|
|
103
|
-
const
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
106
|
+
const catalog =
|
|
107
|
+
input.template && projectRoot
|
|
108
|
+
? await loadLocalEmailTemplate(projectRoot, input.template)
|
|
109
|
+
: null;
|
|
110
|
+
const resolved = resolveEmailSendInput(input, catalog);
|
|
111
|
+
const to = Array.isArray(resolved.to) ? resolved.to.join(", ") : resolved.to;
|
|
112
|
+
log(`email → ${to}: ${resolved.subject ?? ""}`);
|
|
113
|
+
if (resolved.text) log(` ${resolved.text}`);
|
|
114
|
+
inspect.record({
|
|
115
|
+
kind: "email",
|
|
116
|
+
to,
|
|
117
|
+
subject: resolved.subject ?? "",
|
|
118
|
+
text: resolved.text,
|
|
119
|
+
});
|
|
107
120
|
return { id: `local_${Date.now().toString(36)}`, status: "sent" };
|
|
108
121
|
},
|
|
109
122
|
};
|
|
@@ -126,9 +139,10 @@ export function devRouteClients(input: {
|
|
|
126
139
|
publicBaseUrl: string;
|
|
127
140
|
projectId: string;
|
|
128
141
|
jwtSecret: string;
|
|
142
|
+
projectRoot?: string;
|
|
129
143
|
}): RouteClients {
|
|
130
144
|
return {
|
|
131
|
-
email: consoleEmailClient(input.log, input.inspect),
|
|
145
|
+
email: consoleEmailClient(input.log, input.inspect, input.projectRoot),
|
|
132
146
|
llm: offlineLlmClient(),
|
|
133
147
|
agent: {
|
|
134
148
|
createSession: () => notConfigured("llm_not_configured"),
|
package/src/dev-server.ts
CHANGED
|
@@ -63,6 +63,7 @@ export type DevServerOptions = {
|
|
|
63
63
|
googleClientId?: string;
|
|
64
64
|
googleClientSecret?: string;
|
|
65
65
|
storageDir: string;
|
|
66
|
+
projectRoot?: string;
|
|
66
67
|
};
|
|
67
68
|
|
|
68
69
|
const SWAGGER_PATHS = new Set(["/_robodev/docs", "/_robodev/swagger", "/docs", "/swagger"]);
|
|
@@ -129,6 +130,7 @@ function routeClients(options: DevServerOptions, getRuntime: () => DevRuntime |
|
|
|
129
130
|
publicBaseUrl: options.listenOrigin,
|
|
130
131
|
projectId: options.projectId,
|
|
131
132
|
jwtSecret: options.jwtSecret,
|
|
133
|
+
projectRoot: options.projectRoot,
|
|
132
134
|
});
|
|
133
135
|
}
|
|
134
136
|
|
package/src/dev.ts
CHANGED
|
@@ -191,6 +191,7 @@ export async function main(args: string[]): Promise<void> {
|
|
|
191
191
|
publicBaseUrl: `http://localhost:${parsed.port}`,
|
|
192
192
|
projectId: DEV_PROJECT_ID,
|
|
193
193
|
jwtSecret: DEV_JWT_SECRET,
|
|
194
|
+
projectRoot: project.root,
|
|
194
195
|
}),
|
|
195
196
|
onJobFinished: (event) => {
|
|
196
197
|
inspect.record({
|
|
@@ -310,6 +311,7 @@ export async function main(args: string[]): Promise<void> {
|
|
|
310
311
|
googleClientId: env.GOOGLE_CLIENT_ID,
|
|
311
312
|
googleClientSecret: env.GOOGLE_CLIENT_SECRET,
|
|
312
313
|
storageDir,
|
|
314
|
+
projectRoot: project.root,
|
|
313
315
|
},
|
|
314
316
|
() => current,
|
|
315
317
|
);
|
|
@@ -9,10 +9,10 @@
|
|
|
9
9
|
"rules:gen": "rulesync generate"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@robodev-ai/sdk": "^0.11.
|
|
12
|
+
"@robodev-ai/sdk": "^0.11.1"
|
|
13
13
|
},
|
|
14
14
|
"devDependencies": {
|
|
15
|
-
"robodev": "^0.37.
|
|
15
|
+
"robodev": "^0.37.1",
|
|
16
16
|
"rulesync": "^8.18.0",
|
|
17
17
|
"typescript": "^5.9.2"
|
|
18
18
|
}
|
|
@@ -9,10 +9,10 @@
|
|
|
9
9
|
"rules:gen": "rulesync generate"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@robodev-ai/sdk": "^0.11.
|
|
12
|
+
"@robodev-ai/sdk": "^0.11.1"
|
|
13
13
|
},
|
|
14
14
|
"devDependencies": {
|
|
15
|
-
"robodev": "^0.37.
|
|
15
|
+
"robodev": "^0.37.1",
|
|
16
16
|
"rulesync": "^8.18.0",
|
|
17
17
|
"typescript": "^5.9.2"
|
|
18
18
|
}
|
|
@@ -9,10 +9,10 @@
|
|
|
9
9
|
"rules:gen": "rulesync generate"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@robodev-ai/sdk": "^0.11.
|
|
12
|
+
"@robodev-ai/sdk": "^0.11.1"
|
|
13
13
|
},
|
|
14
14
|
"devDependencies": {
|
|
15
|
-
"robodev": "^0.37.
|
|
15
|
+
"robodev": "^0.37.1",
|
|
16
16
|
"rulesync": "^8.18.0",
|
|
17
17
|
"typescript": "^5.9.2"
|
|
18
18
|
}
|