standalone-owner.ts 635 B

12345678910111213141516171819
  1. import { Effect } from "effect"
  2. import { Service } from "@opencode-ai/client/effect"
  3. import path from "node:path"
  4. import { Standalone } from "../../src/services/standalone"
  5. process.argv[1] = path.join(import.meta.dir, "../../src/index.ts")
  6. await Effect.runPromise(
  7. Effect.scoped(
  8. Effect.gen(function* () {
  9. const endpoint = yield* Standalone.start()
  10. const response = yield* Effect.promise(() =>
  11. fetch(new URL("/api/health", endpoint.url), { headers: Service.headers(endpoint) }),
  12. )
  13. console.log(`${endpoint.pid} ${endpoint.url} ${response.status}`)
  14. return yield* Effect.never
  15. }),
  16. ),
  17. )