MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / syncAndInvoke

Function syncAndInvoke

e2e/desktop-vm/custom-tools-sidecar.test.ts:169–203  ·  view source on GitHub ↗
(input: {
  readonly slug: string;
  readonly path: string;
})

Source from the content-addressed store, hash-verified

167 ).pipe(Effect.ignore);
168
169const 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
205if (!guestIp) {
206 it.skip(`${NAME} (needs a desktop guest with E2E_DESKTOP_VM_IP)`, () => {});

Callers 1

Calls 1

expectGuestRequestFunction · 0.85

Tested by

no test coverage detected