(input: {
readonly target: TargetShape;
readonly identity: Identity;
readonly slug: string;
readonly path: string;
})
| 204 | ).pipe(Effect.ignore); |
| 205 | |
| 206 | const syncAndInvoke = (input: { |
| 207 | readonly target: TargetShape; |
| 208 | readonly identity: Identity; |
| 209 | readonly slug: string; |
| 210 | readonly path: string; |
| 211 | }): Effect.Effect<void> => |
| 212 | Effect.promise(async () => { |
| 213 | await postJson(input.target, input.identity, "/api/apps/sources", { |
| 214 | kind: "local-directory", |
| 215 | slug: input.slug, |
| 216 | app: input.slug, |
| 217 | path: input.path, |
| 218 | }); |
| 219 | |
| 220 | const sync = await postJson<SyncResponse>( |
| 221 | input.target, |
| 222 | input.identity, |
| 223 | `/api/apps/sources/${input.slug}/sync`, |
| 224 | undefined, |
| 225 | 180_000, |
| 226 | ); |
| 227 | expect(sync.status, "the packed binary bundled and published the tool").toBe("published"); |
| 228 | expect(sync.tools, "the packed binary bundled and published the tool").toContain("greet"); |
| 229 | |
| 230 | const execution = await postJson<ExecuteResponse>( |
| 231 | input.target, |
| 232 | input.identity, |
| 233 | "/api/executions", |
| 234 | { |
| 235 | code: `export default await tools["${input.slug}.org.published.greet"]({ name: "Ada" })`, |
| 236 | autoApprove: true, |
| 237 | }, |
| 238 | ); |
| 239 | expect( |
| 240 | JSON.stringify(execution.structured ?? execution.text), |
| 241 | "the published tool executes and returns the greeting", |
| 242 | ).toContain('"greeting":"hello Ada"'); |
| 243 | }); |
| 244 | |
| 245 | scenario( |
| 246 | "CLI packed binary · local-directory custom tool publishes and executes", |
no test coverage detected