robodev 0.37.1 → 0.38.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -3
- package/src/dev-clients.ts +28 -2
- package/src/dev-inspect.test.ts +19 -0
- package/src/dev-inspect.ts +13 -3
- 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.
|
|
3
|
+
"version": "0.38.0",
|
|
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.
|
|
30
|
-
"@robodev-ai/sdk": "0.
|
|
29
|
+
"@robodev-ai/runtime": "0.5.0",
|
|
30
|
+
"@robodev-ai/sdk": "0.12.0"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@types/node": "^24.3.0",
|
package/src/dev-clients.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
+
createHopPdfClient,
|
|
2
3
|
createLocalStorageClient,
|
|
3
4
|
createProjectSocketsClient,
|
|
4
5
|
loadLocalEmailTemplate,
|
|
@@ -10,6 +11,7 @@ import type {
|
|
|
10
11
|
EmailClient,
|
|
11
12
|
JobEnqueueInput,
|
|
12
13
|
LlmClient,
|
|
14
|
+
PdfClient,
|
|
13
15
|
SocketsClient,
|
|
14
16
|
StorageClient,
|
|
15
17
|
} from "@robodev-ai/sdk";
|
|
@@ -21,8 +23,8 @@ import {
|
|
|
21
23
|
|
|
22
24
|
/**
|
|
23
25
|
* The `ctx.*` clients `robodev dev` can offer offline. `email` prints to the terminal;
|
|
24
|
-
* `jobs`, `storage`, and `sockets` run locally. llm / agent / push
|
|
25
|
-
* not-configured codes rather than silently doing nothing.
|
|
26
|
+
* `jobs`, `storage`, and `sockets` run locally. `pdf` hops to Starbase. llm / agent / push
|
|
27
|
+
* throw hosted-style not-configured codes rather than silently doing nothing.
|
|
26
28
|
*/
|
|
27
29
|
|
|
28
30
|
function notConfigured(code: string): never {
|
|
@@ -59,6 +61,29 @@ function inspectStorageClient(client: StorageClient, inspect: DevInspectStore):
|
|
|
59
61
|
};
|
|
60
62
|
}
|
|
61
63
|
|
|
64
|
+
function inspectPdfClient(client: PdfClient, inspect: DevInspectStore): PdfClient {
|
|
65
|
+
return {
|
|
66
|
+
async fromHtml(html, options) {
|
|
67
|
+
const htmlBytes = Buffer.byteLength(html, "utf8");
|
|
68
|
+
const format = options?.format ?? "A4";
|
|
69
|
+
try {
|
|
70
|
+
const result = await client.fromHtml(html, options);
|
|
71
|
+
inspect.record({ kind: "pdf", htmlBytes, format, ok: true });
|
|
72
|
+
return result;
|
|
73
|
+
} catch (error) {
|
|
74
|
+
inspect.record({
|
|
75
|
+
kind: "pdf",
|
|
76
|
+
htmlBytes,
|
|
77
|
+
format,
|
|
78
|
+
ok: false,
|
|
79
|
+
error: errorMessage(error),
|
|
80
|
+
});
|
|
81
|
+
throw error;
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
|
|
62
87
|
function inspectSocketsClient(client: SocketsClient, inspect: DevInspectStore): SocketsClient {
|
|
63
88
|
function tracked(
|
|
64
89
|
socketKind: "send" | "broadcast",
|
|
@@ -161,6 +186,7 @@ export function devRouteClients(input: {
|
|
|
161
186
|
}),
|
|
162
187
|
input.inspect,
|
|
163
188
|
),
|
|
189
|
+
pdf: inspectPdfClient(createHopPdfClient(), input.inspect),
|
|
164
190
|
push: { send: () => notConfigured("push_not_configured") },
|
|
165
191
|
jobs: {
|
|
166
192
|
enqueue: async (job) => {
|
package/src/dev-inspect.test.ts
CHANGED
|
@@ -383,3 +383,22 @@ test("storage object count is 0 when the query fails", async () => {
|
|
|
383
383
|
assert.equal(state.overview.storageObjectCount, 0);
|
|
384
384
|
assert.deepEqual(state.storage.objects, []);
|
|
385
385
|
});
|
|
386
|
+
|
|
387
|
+
test("pdf inspect records byte length and format, not HTML text", () => {
|
|
388
|
+
const inspect = createDevInspect();
|
|
389
|
+
const html = "<html><body>secret invoice</body></html>";
|
|
390
|
+
const event = inspect.record({
|
|
391
|
+
kind: "pdf",
|
|
392
|
+
htmlBytes: Buffer.byteLength(html, "utf8"),
|
|
393
|
+
format: "Letter",
|
|
394
|
+
ok: false,
|
|
395
|
+
error: "pdf_failed",
|
|
396
|
+
});
|
|
397
|
+
assert.equal(event.kind, "pdf");
|
|
398
|
+
if (event.kind !== "pdf") throw new Error("expected pdf");
|
|
399
|
+
assert.equal(event.htmlBytes, Buffer.byteLength(html, "utf8"));
|
|
400
|
+
assert.equal(event.format, "Letter");
|
|
401
|
+
assert.equal(event.ok, false);
|
|
402
|
+
assert.equal(event.error, "pdf_failed");
|
|
403
|
+
assert.equal(JSON.stringify(event).includes("secret invoice"), false);
|
|
404
|
+
});
|
package/src/dev-inspect.ts
CHANGED
|
@@ -55,7 +55,7 @@ export const RESERVED_AUTH_ROUTES: Array<{ method: string; path: string; file: s
|
|
|
55
55
|
export const SOCKET_PREVIEW_MAX = 200;
|
|
56
56
|
|
|
57
57
|
export type DevInspectKind =
|
|
58
|
-
"request" | "email" | "auth_code" | "job" | "job_run" | "log" | "storage" | "socket";
|
|
58
|
+
"request" | "email" | "auth_code" | "job" | "job_run" | "log" | "storage" | "socket" | "pdf";
|
|
59
59
|
|
|
60
60
|
export type StorageInspectOp = "upload" | "get" | "getUrl" | "delete" | "list" | "serve";
|
|
61
61
|
export type SocketInspectKind = "connect" | "message" | "close" | "send" | "broadcast";
|
|
@@ -127,6 +127,14 @@ export type DevInspectSocketEvent = EventBase & {
|
|
|
127
127
|
preview?: string;
|
|
128
128
|
};
|
|
129
129
|
|
|
130
|
+
export type DevInspectPdfEvent = EventBase & {
|
|
131
|
+
kind: "pdf";
|
|
132
|
+
htmlBytes: number;
|
|
133
|
+
format: string;
|
|
134
|
+
ok: boolean;
|
|
135
|
+
error?: string;
|
|
136
|
+
};
|
|
137
|
+
|
|
130
138
|
export type DevInspectEvent =
|
|
131
139
|
| DevInspectRequestEvent
|
|
132
140
|
| DevInspectEmailEvent
|
|
@@ -135,7 +143,8 @@ export type DevInspectEvent =
|
|
|
135
143
|
| DevInspectJobRunEvent
|
|
136
144
|
| DevInspectLogEvent
|
|
137
145
|
| DevInspectStorageEvent
|
|
138
|
-
| DevInspectSocketEvent
|
|
146
|
+
| DevInspectSocketEvent
|
|
147
|
+
| DevInspectPdfEvent;
|
|
139
148
|
|
|
140
149
|
export type DevInspectRecordInput =
|
|
141
150
|
| Omit<DevInspectRequestEvent, "id" | "at">
|
|
@@ -145,7 +154,8 @@ export type DevInspectRecordInput =
|
|
|
145
154
|
| Omit<DevInspectJobRunEvent, "id" | "at">
|
|
146
155
|
| Omit<DevInspectLogEvent, "id" | "at">
|
|
147
156
|
| Omit<DevInspectStorageEvent, "id" | "at">
|
|
148
|
-
| Omit<DevInspectSocketEvent, "id" | "at"
|
|
157
|
+
| Omit<DevInspectSocketEvent, "id" | "at">
|
|
158
|
+
| Omit<DevInspectPdfEvent, "id" | "at">;
|
|
149
159
|
|
|
150
160
|
export type DashboardGoogle = "broker" | "local_override" | "incomplete";
|
|
151
161
|
|
|
@@ -9,10 +9,10 @@
|
|
|
9
9
|
"rules:gen": "rulesync generate"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@robodev-ai/sdk": "^0.
|
|
12
|
+
"@robodev-ai/sdk": "^0.12.0"
|
|
13
13
|
},
|
|
14
14
|
"devDependencies": {
|
|
15
|
-
"robodev": "^0.
|
|
15
|
+
"robodev": "^0.38.0",
|
|
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.
|
|
12
|
+
"@robodev-ai/sdk": "^0.12.0"
|
|
13
13
|
},
|
|
14
14
|
"devDependencies": {
|
|
15
|
-
"robodev": "^0.
|
|
15
|
+
"robodev": "^0.38.0",
|
|
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.
|
|
12
|
+
"@robodev-ai/sdk": "^0.12.0"
|
|
13
13
|
},
|
|
14
14
|
"devDependencies": {
|
|
15
|
-
"robodev": "^0.
|
|
15
|
+
"robodev": "^0.38.0",
|
|
16
16
|
"rulesync": "^8.18.0",
|
|
17
17
|
"typescript": "^5.9.2"
|
|
18
18
|
}
|