chore: generate

This commit is contained in:
opencode-agent[bot]
2026-08-15 00:20:16 +00:00
Unverified
parent 5c7f5840ee
commit 650f7e8cdd
9 changed files with 114 additions and 100 deletions
+15 -9
View File
@@ -82,7 +82,8 @@ export const testLayer = (initial: Entry[] = []) =>
Effect.gen(function* () {
const current = yield* Ref.get(entries)
const index = current.findIndex((entry) => entry.type === "document" && entry.path !== undefined)
if (index === -1) return yield* Effect.fail(new UpdateError({ message: "No editable config document found" }))
if (index === -1)
return yield* Effect.fail(new UpdateError({ message: "No editable config document found" }))
const entry = current[index]
if (!entry || entry.type !== "document")
return yield* Effect.fail(new UpdateError({ message: "No editable config document found" }))
@@ -247,9 +248,7 @@ export const layer = (options?: Options) =>
.toReversed()
fileTargets.clear()
directPaths.forEach((filepath) => fileTargets.add(AbsolutePath.make(filepath)))
const direct = yield* Effect.forEach(directPaths, (filepath) =>
loadFile(filepath),
).pipe(
const direct = yield* Effect.forEach(directPaths, (filepath) => loadFile(filepath)).pipe(
Effect.orDie,
Effect.map((entries) => entries.filter((entry): entry is Document => entry !== undefined)),
)
@@ -396,9 +395,13 @@ export const layer = (options?: Options) =>
})
const edits = changes(document.info, next)
if (!edits.length) return document.info
const text = yield* fs.readFileString(document.path).pipe(
Effect.mapError((cause) => new UpdateError({ message: `Failed to read config: ${document.path}`, cause })),
)
const text = yield* fs
.readFileString(document.path)
.pipe(
Effect.mapError(
(cause) => new UpdateError({ message: `Failed to read config: ${document.path}`, cause }),
),
)
const updated = edits.reduce(
(text, edit) =>
applyEdits(
@@ -408,11 +411,14 @@ export const layer = (options?: Options) =>
text,
)
const info = yield* parseInfo(updated, document.path)
if (!info) return yield* Effect.fail(new UpdateError({ message: `Invalid config update: ${document.path}` }))
if (!info)
return yield* Effect.fail(new UpdateError({ message: `Invalid config update: ${document.path}` }))
const temporary = document.path + ".tmp"
yield* fs.writeFileString(temporary, updated.endsWith("\n") ? updated : updated + "\n").pipe(
Effect.andThen(fs.rename(temporary, document.path)),
Effect.mapError((cause) => new UpdateError({ message: `Failed to write config: ${document.path}`, cause })),
Effect.mapError(
(cause) => new UpdateError({ message: `Failed to write config: ${document.path}`, cause }),
),
)
return info
}),
+3 -1
View File
@@ -333,7 +333,9 @@ export const make = Effect.fn("PluginHost.make")(function* (plugin: import("../p
default: {
get: draft.default.get,
set: (selection) =>
draft.default.set(selection === false || selection === "random" ? selection : WebSearch.ID.make(selection)),
draft.default.set(
selection === false || selection === "random" ? selection : WebSearch.ID.make(selection),
),
},
})
}),
+8 -8
View File
@@ -183,14 +183,14 @@ function resourceMcpLayer(
Layer.provide(
Layer.mergeAll(
overrides?.entries
? Layer.succeed(
Config.Service,
Config.Service.of({
entries: overrides.entries,
update: () => Effect.die("unused config update"),
changes: () => Stream.never,
}),
)
? Layer.succeed(
Config.Service,
Config.Service.of({
entries: overrides.entries,
update: () => Effect.die("unused config update"),
changes: () => Stream.never,
}),
)
: Config.testLayer([
new Document({
type: "document",
+3 -1
View File
@@ -389,7 +389,9 @@ export function webSearchHost(websearch: WebSearch.Interface): Plugin.Context["w
default: {
get: draft.default.get,
set: (selection) =>
draft.default.set(selection === false || selection === "random" ? selection : WebSearch.ID.make(selection)),
draft.default.set(
selection === false || selection === "random" ? selection : WebSearch.ID.make(selection),
),
},
})
}),
+6 -2
View File
@@ -135,13 +135,17 @@ const config = Layer.succeed(
Effect.succeed([
new Document({
type: "document",
info: new Info({ websearch: selection === undefined ? undefined : selection === false ? false : { provider: selection } }),
info: new Info({
websearch: selection === undefined ? undefined : selection === false ? false : { provider: selection },
}),
}),
]),
update: (update) =>
Effect.sync(() => {
const info = produce(
new Info({ websearch: selection === undefined ? undefined : selection === false ? false : { provider: selection } }),
new Info({
websearch: selection === undefined ? undefined : selection === false ? false : { provider: selection },
}),
update,
)
selection = info.websearch === false ? false : info.websearch?.provider
+26 -24
View File
@@ -23517,6 +23517,24 @@
"required": ["path"],
"additionalProperties": false
},
"ConfigWebSearch.Info": {
"type": "object",
"properties": {
"provider": {
"anyOf": [
{
"type": "string",
"enum": ["random"]
},
{
"type": "string"
}
]
}
},
"required": ["provider"],
"additionalProperties": false
},
"Config.Plugin.Entry": {
"type": "object",
"properties": {
@@ -24035,14 +24053,15 @@
}
},
"websearch": {
"type": "object",
"properties": {
"provider": {
"type": "string"
"anyOf": [
{
"type": "boolean",
"enum": [false]
},
{
"$ref": "#/components/schemas/ConfigWebSearch.Info"
}
},
"required": ["provider"],
"additionalProperties": false
]
},
"plugins": {
"type": "array",
@@ -24145,20 +24164,6 @@
"required": ["type", "path"],
"additionalProperties": false
},
"Config.File": {
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": ["file"]
},
"path": {
"type": "string"
}
},
"required": ["type", "path"],
"additionalProperties": false
},
"Config.AgentsDirectory": {
"type": "object",
"properties": {
@@ -24195,9 +24200,6 @@
{
"$ref": "#/components/schemas/Config.Directory"
},
{
"$ref": "#/components/schemas/Config.File"
},
{
"$ref": "#/components/schemas/Config.AgentsDirectory"
},
+1 -7
View File
@@ -41,13 +41,7 @@ describe("Config.Entry", () => {
expect(decoded).toEqual(entries)
expect(decoded[0]).toBeInstanceOf(Config.Document)
expect(decoded[1]).not.toHaveProperty("path")
expect(decoded.map((entry) => entry.type)).toEqual([
"document",
"document",
"directory",
"agents",
"claude",
])
expect(decoded.map((entry) => entry.type)).toEqual(["document", "document", "directory", "agents", "claude"])
expect(decoded[0]?.type === "document" ? decoded[0].info.permissions : undefined).toEqual([
{ action: "shell", resource: "*", effect: "ask" },
{ action: "shell", resource: "git status", effect: "allow" },
+26 -24
View File
@@ -23517,6 +23517,24 @@
"required": ["path"],
"additionalProperties": false
},
"ConfigWebSearch.Info": {
"type": "object",
"properties": {
"provider": {
"anyOf": [
{
"type": "string",
"enum": ["random"]
},
{
"type": "string"
}
]
}
},
"required": ["provider"],
"additionalProperties": false
},
"Config.Plugin.Entry": {
"type": "object",
"properties": {
@@ -24035,14 +24053,15 @@
}
},
"websearch": {
"type": "object",
"properties": {
"provider": {
"type": "string"
"anyOf": [
{
"type": "boolean",
"enum": [false]
},
{
"$ref": "#/components/schemas/ConfigWebSearch.Info"
}
},
"required": ["provider"],
"additionalProperties": false
]
},
"plugins": {
"type": "array",
@@ -24145,20 +24164,6 @@
"required": ["type", "path"],
"additionalProperties": false
},
"Config.File": {
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": ["file"]
},
"path": {
"type": "string"
}
},
"required": ["type", "path"],
"additionalProperties": false
},
"Config.AgentsDirectory": {
"type": "object",
"properties": {
@@ -24195,9 +24200,6 @@
{
"$ref": "#/components/schemas/Config.Directory"
},
{
"$ref": "#/components/schemas/Config.File"
},
{
"$ref": "#/components/schemas/Config.AgentsDirectory"
},
+26 -24
View File
@@ -23517,6 +23517,24 @@
"required": ["path"],
"additionalProperties": false
},
"ConfigWebSearch.Info": {
"type": "object",
"properties": {
"provider": {
"anyOf": [
{
"type": "string",
"enum": ["random"]
},
{
"type": "string"
}
]
}
},
"required": ["provider"],
"additionalProperties": false
},
"Config.Plugin.Entry": {
"type": "object",
"properties": {
@@ -24035,14 +24053,15 @@
}
},
"websearch": {
"type": "object",
"properties": {
"provider": {
"type": "string"
"anyOf": [
{
"type": "boolean",
"enum": [false]
},
{
"$ref": "#/components/schemas/ConfigWebSearch.Info"
}
},
"required": ["provider"],
"additionalProperties": false
]
},
"plugins": {
"type": "array",
@@ -24145,20 +24164,6 @@
"required": ["type", "path"],
"additionalProperties": false
},
"Config.File": {
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": ["file"]
},
"path": {
"type": "string"
}
},
"required": ["type", "path"],
"additionalProperties": false
},
"Config.AgentsDirectory": {
"type": "object",
"properties": {
@@ -24195,9 +24200,6 @@
{
"$ref": "#/components/schemas/Config.Directory"
},
{
"$ref": "#/components/schemas/Config.File"
},
{
"$ref": "#/components/schemas/Config.AgentsDirectory"
},