feat(core): wire v2 subagent tool (#34320)

This commit is contained in:
Kit Langton
2026-06-28 12:52:39 -04:00
committed by GitHub
parent 41283933ff
commit 94e3a29d2f
15 changed files with 631 additions and 49 deletions
+29
View File
@@ -56,6 +56,14 @@ const it = testEffect(
const location = Location.Ref.make({ directory: AbsolutePath.make("/project") })
const id = SessionV2.ID.create()
const assertCreateInputTypes = (session: SessionV2.Interface) => {
// @ts-expect-error location or parentID is required.
session.create({})
// @ts-expect-error child sessions inherit their parent's location.
session.create({ parentID: SessionV2.ID.create(), location })
}
void assertCreateInputTypes
describe("SessionV2.create", () => {
it.effect("creates a fresh projected session when the ID is omitted", () =>
Effect.gen(function* () {
@@ -102,6 +110,27 @@ describe("SessionV2.create", () => {
}),
)
it.effect("inherits location from an existing parent when omitted", () =>
Effect.gen(function* () {
const session = yield* SessionV2.Service
const parent = yield* session.create({ location })
const child = yield* session.create({ parentID: parent.id, title: "child" })
expect(child).toMatchObject({ parentID: parent.id, location })
}),
)
it.effect("rejects child creation when the parent does not exist", () =>
Effect.gen(function* () {
const session = yield* SessionV2.Service
const missing = SessionV2.ID.create()
expect(yield* Effect.flip(session.create({ parentID: missing, title: "child" }))).toEqual(
new SessionV2.NotFoundError({ sessionID: missing }),
)
}),
)
it.effect("returns the existing Session when one ID is reused with different create arguments", () =>
Effect.gen(function* () {
const session = yield* SessionV2.Service