chore: generate

This commit is contained in:
opencode-agent[bot]
2026-05-10 12:28:11 +00:00
parent 5cf9abe743
commit 6589a66822
5 changed files with 27 additions and 31 deletions
+11 -13
View File
@@ -351,19 +351,17 @@ export const layer = Layer.effect(
description: referenceDescription(resolved), description: referenceDescription(resolved),
permission: Permission.merge( permission: Permission.merge(
agents.scout.permission, agents.scout.permission,
Permission.fromConfig( Permission.fromConfig({
{ repo_clone: "deny",
repo_clone: "deny", ...(localPath
...(localPath ? {
? { external_directory: {
external_directory: { [localPath]: "allow",
[localPath]: "allow", [path.join(localPath, "*")]: "allow",
[path.join(localPath, "*")]: "allow", },
}, }
} : {}),
: {}), }),
},
),
), ),
prompt: referencePrompt(resolved), prompt: referencePrompt(resolved),
options: { reference: cfg.reference?.[resolved.name], resolved }, options: { reference: cfg.reference?.[resolved.name], resolved },
+11 -2
View File
@@ -90,7 +90,12 @@ function containsReferencePath(referencePath: string, target: string) {
return AppFileSystem.contains(normalizedTarget(referencePath) ?? referencePath, target) return AppFileSystem.contains(normalizedTarget(referencePath) ?? referencePath, target)
} }
export function resolve(input: { name: string; reference: ReferenceEntry; directory: string; worktree: string }): Resolved { export function resolve(input: {
name: string
reference: ReferenceEntry
directory: string
worktree: string
}): Resolved {
if (typeof input.reference === "string") { if (typeof input.reference === "string") {
if (input.reference.startsWith(".") || input.reference.startsWith("/") || input.reference.startsWith("~")) { if (input.reference.startsWith(".") || input.reference.startsWith("/") || input.reference.startsWith("~")) {
return { name: input.name, kind: "local", path: referencePath({ ...input, value: input.reference }) } return { name: input.name, kind: "local", path: referencePath({ ...input, value: input.reference }) }
@@ -142,7 +147,11 @@ export const layer = Layer.effect(
const state = yield* InstanceState.make<State>( const state = yield* InstanceState.make<State>(
Effect.fn("Reference.state")(function* (ctx) { Effect.fn("Reference.state")(function* (ctx) {
const cfg = yield* config.get() const cfg = yield* config.get()
const references = resolveAll({ references: cfg.reference ?? {}, directory: ctx.directory, worktree: ctx.worktree }) const references = resolveAll({
references: cfg.reference ?? {},
directory: ctx.directory,
worktree: ctx.worktree,
})
const seenPath = new Set<string>() const seenPath = new Set<string>()
const gitReferences = references.filter((reference): reference is Extract<Resolved, { kind: "git" }> => { const gitReferences = references.filter((reference): reference is Extract<Resolved, { kind: "git" }> => {
if (reference.kind !== "git") return false if (reference.kind !== "git") return false
@@ -87,15 +87,7 @@ export const ensure = Effect.fn("RepositoryCache.ensure")(function* (
if (status === "cloned") { if (status === "cloned") {
const clone = yield* services.git.run( const clone = yield* services.git.run(
[ ["clone", "--depth", "100", ...(input.branch ? ["--branch", input.branch] : []), "--", remote, localPath],
"clone",
"--depth",
"100",
...(input.branch ? ["--branch", input.branch] : []),
"--",
remote,
localPath,
],
{ cwd: path.dirname(localPath) }, { cwd: path.dirname(localPath) },
) )
if (clone.exitCode !== 0) { if (clone.exitCode !== 0) {
+3 -1
View File
@@ -174,7 +174,9 @@ test("reference config creates scout-backed subagents", async () => {
expect(effect).toBeDefined() expect(effect).toBeDefined()
expect(effect?.mode).toBe("subagent") expect(effect?.mode).toBe("subagent")
expect(effect?.prompt).toContain("Repository: github.com/effect/effect-smol") expect(effect?.prompt).toContain("Repository: github.com/effect/effect-smol")
expect(effect?.prompt).toContain(`Cached directory: ${path.join(Global.Path.repos, "github.com", "effect", "effect-smol")}`) expect(effect?.prompt).toContain(
`Cached directory: ${path.join(Global.Path.repos, "github.com", "effect", "effect-smol")}`,
)
expect(effect?.prompt).toContain("Do not call repo_clone") expect(effect?.prompt).toContain("Do not call repo_clone")
expect(evalPerm(effect, "repo_clone")).toBe("deny") expect(evalPerm(effect, "repo_clone")).toBe("deny")
@@ -15,12 +15,7 @@ afterEach(async () => {
}) })
const it = testEffect( const it = testEffect(
Layer.mergeAll( Layer.mergeAll(AppFileSystem.defaultLayer, CrossSpawnSpawner.defaultLayer, Git.defaultLayer, Reference.defaultLayer),
AppFileSystem.defaultLayer,
CrossSpawnSpawner.defaultLayer,
Git.defaultLayer,
Reference.defaultLayer,
),
) )
const experimentalScout = <A, E, R>(self: Effect.Effect<A, E, R>) => const experimentalScout = <A, E, R>(self: Effect.Effect<A, E, R>) =>