(input: {
readonly slug: string;
readonly path: string;
})
| 167 | ).pipe(Effect.ignore); |
| 168 | |
| 169 | const syncAndInvoke = (input: { |
| 170 | readonly slug: string; |
| 171 | readonly path: string; |
| 172 | }): Effect.Effect<void> => |
| 173 | Effect.promise(async () => { |
| 174 | await expectGuestRequest("/api/apps/sources", { |
| 175 | method: "POST", |
| 176 | body: { |
| 177 | kind: "local-directory", |
| 178 | slug: input.slug, |
| 179 | app: input.slug, |
| 180 | path: input.path, |
| 181 | }, |
| 182 | }); |
| 183 | |
| 184 | const sync = await expectGuestRequest<SyncResponse>( |
| 185 | `/api/apps/sources/${input.slug}/sync`, |
| 186 | { method: "POST" }, |
| 187 | 180, |
| 188 | ); |
| 189 | expect(sync.status, "the desktop sidecar bundled and published the tool").toBe("published"); |
| 190 | expect(sync.tools, "the desktop sidecar bundled and published the tool").toContain("greet"); |
| 191 | |
| 192 | const execution = await expectGuestRequest<ExecuteResponse>("/api/executions", { |
| 193 | method: "POST", |
| 194 | body: { |
| 195 | code: `export default await tools["${input.slug}.org.published.greet"]({ name: "Ada" })`, |
| 196 | autoApprove: true, |
| 197 | }, |
| 198 | }); |
| 199 | expect( |
| 200 | JSON.stringify(execution.structured ?? execution.text), |
| 201 | "the published tool executes and returns the greeting", |
| 202 | ).toContain('"greeting":"hello Ada"'); |
| 203 | }); |
| 204 | |
| 205 | if (!guestIp) { |
| 206 | it.skip(`${NAME} (needs a desktop guest with E2E_DESKTOP_VM_IP)`, () => {}); |
no test coverage detected