feat(core): add public native API (#30828)
This commit is contained in:
parent
46e9863589
commit
773d33e282
10 changed files with 220 additions and 55 deletions
29
packages/core/test/public-opencode.test.ts
Normal file
29
packages/core/test/public-opencode.test.ts
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
import { describe, expect } from "bun:test"
|
||||
import { Effect } from "effect"
|
||||
import { OpenCode, Session } from "@opencode-ai/core/public"
|
||||
import { testEffect } from "./lib/effect"
|
||||
|
||||
const it = testEffect(OpenCode.layer)
|
||||
|
||||
describe("public native OpenCode API", () => {
|
||||
it.effect("exposes only the intentional Session capabilities", () =>
|
||||
Effect.gen(function* () {
|
||||
const opencode = yield* OpenCode.Service
|
||||
|
||||
expect(Object.keys(opencode.sessions).sort()).toEqual([
|
||||
"context",
|
||||
"create",
|
||||
"events",
|
||||
"get",
|
||||
"list",
|
||||
"message",
|
||||
"messages",
|
||||
"prompt",
|
||||
])
|
||||
expect(Session.ID.create()).toStartWith("ses_")
|
||||
expect(Session.MessageID.create()).toStartWith("msg_")
|
||||
expect(yield* opencode.sessions.list()).toBeArray()
|
||||
}),
|
||||
)
|
||||
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue