chore: generate

This commit is contained in:
opencode-agent[bot]
2026-05-30 04:07:26 +00:00
parent 9583e08be4
commit e4d3b81b0e
11 changed files with 182 additions and 104 deletions

View File

@@ -32,17 +32,21 @@ export class Info extends Schema.Class<Info>("Config.Info")({
model: Schema.String.pipe(Schema.optional).annotate({
description: "Default model to use when no session or agent model is selected",
}),
autoupdate: Schema.Union([Schema.Boolean, Schema.Literal("notify")]).pipe(Schema.optional).annotate({
description: "Automatically update or notify when a new version is available",
}),
autoupdate: Schema.Union([Schema.Boolean, Schema.Literal("notify")])
.pipe(Schema.optional)
.annotate({
description: "Automatically update or notify when a new version is available",
}),
share: Schema.Literals(["manual", "auto", "disabled"]).pipe(Schema.optional).annotate({
description: "Control whether sessions may be shared manually, automatically, or not at all",
}),
enterprise: Schema.Struct({
url: Schema.String.pipe(Schema.optional),
}).pipe(Schema.optional).annotate({
description: "Enterprise sharing service configuration",
}),
})
.pipe(Schema.optional)
.annotate({
description: "Enterprise sharing service configuration",
}),
username: Schema.String.pipe(Schema.optional).annotate({
description: "Username displayed in conversations and used for telemetry identity",
}),
@@ -196,7 +200,4 @@ export const layer = Layer.effect(
}),
)
export const defaultLayer = layer.pipe(
Layer.provide(AppFileSystem.defaultLayer),
Layer.provide(Global.defaultLayer),
)
export const defaultLayer = layer.pipe(Layer.provide(AppFileSystem.defaultLayer), Layer.provide(Global.defaultLayer))

View File

@@ -18,7 +18,13 @@ import { ProviderPlugins } from "./provider"
type Plugin = {
id: PluginV2.ID
effect: PluginV2.Effect<
Catalog.Service | AccountV2.Service | AgentV2.Service | Npm.Service | EventV2.Service | PluginV2.Service | Config.Service
| Catalog.Service
| AccountV2.Service
| AgentV2.Service
| Npm.Service
| EventV2.Service
| PluginV2.Service
| Config.Service
>
}

View File

@@ -15,11 +15,7 @@ export interface Options<State extends Objectish, Editor> {
export interface Interface<State extends Objectish, Editor> {
readonly get: () => State
readonly transform: () => Effect.Effect<
(transform: Transform<Editor>) => Effect.Effect<void>,
never,
Scope.Scope
>
readonly transform: () => Effect.Effect<(transform: Transform<Editor>) => Effect.Effect<void>, never, Scope.Scope>
readonly update: (update: (editor: Editor) => Effect.Effect<void>, reason?: string) => Effect.Effect<void>
}

View File

@@ -94,9 +94,7 @@ describe("AgentV2", () => {
const id = AgentV2.ID.make("custom")
yield* agent.update((editor) => Effect.sync(() => editor.update(id, () => {})))
expect(yield* agent.get(id)).toEqual(
AgentV2.Info.empty(id),
)
expect(yield* agent.get(id)).toEqual(AgentV2.Info.empty(id))
yield* agent.update((editor) => Effect.sync(() => editor.remove(id)))
expect(yield* agent.get(id)).toBeUndefined()

View File

@@ -194,9 +194,14 @@ describe("Config", () => {
},
snapshots: false,
watcher: { ignore: ["node_modules/**", "dist/**", ".git"] },
formatter: { prettier: { disabled: true }, custom: { command: ["custom-fmt", "$FILE"], extensions: [".foo"] } },
formatter: {
prettier: { disabled: true },
custom: { command: ["custom-fmt", "$FILE"], extensions: [".foo"] },
},
lsp: { typescript: { disabled: true }, custom: { command: ["custom-lsp"], extensions: [".foo"] } },
attachments: { image: { auto_resize: false, max_width: 1200, max_height: 900, max_base64_bytes: 1048576 } },
attachments: {
image: { auto_resize: false, max_width: 1200, max_height: 900, max_base64_bytes: 1048576 },
},
tool_output: { max_lines: 1000, max_bytes: 32768 },
mcp: {
timeout: 5000,
@@ -370,11 +375,15 @@ describe("Config", () => {
await fs.mkdir(global, { recursive: true })
await fs.writeFile(
path.join(global, "opencode.json"),
JSON.stringify({ experimental: { policies: [{ effect: "deny", action: "provider.use", resource: "openai" }] } }),
JSON.stringify({
experimental: { policies: [{ effect: "deny", action: "provider.use", resource: "openai" }] },
}),
)
await fs.writeFile(
path.join(tmp.path, "opencode.json"),
JSON.stringify({ experimental: { policies: [{ effect: "allow", action: "provider.use", resource: "openai" }] } }),
JSON.stringify({
experimental: { policies: [{ effect: "allow", action: "provider.use", resource: "openai" }] },
}),
)
})

View File

@@ -17,12 +17,7 @@ afterEach(async () => {
})
const it = testEffect(
Layer.mergeAll(
Provider.defaultLayer,
Env.defaultLayer,
Plugin.defaultLayer,
CrossSpawnSpawner.defaultLayer,
),
Layer.mergeAll(Provider.defaultLayer, Env.defaultLayer, Plugin.defaultLayer, CrossSpawnSpawner.defaultLayer),
)
it.live("headerTimeout does not abort delayed SSE body after headers arrive", () =>

View File

@@ -77,6 +77,7 @@ export type Event =
| EventSessionNextCompactionStarted
| EventSessionNextCompactionDelta
| EventSessionNextCompactionEnded
| EventPluginAdded
| EventCatalogModelUpdated
| EventModelsDevRefreshed
| EventAccountAdded
@@ -878,6 +879,7 @@ export type GlobalEvent = {
| EventSessionNextCompactionStarted
| EventSessionNextCompactionDelta
| EventSessionNextCompactionEnded
| EventPluginAdded
| EventCatalogModelUpdated
| EventModelsDevRefreshed
| EventAccountAdded
@@ -1316,6 +1318,7 @@ export type Config = {
primary_tools?: Array<string>
continue_loop_on_deny?: boolean
mcp_timeout?: number
policies?: Array<ConfigV2ExperimentalPolicy>
}
}
@@ -2137,7 +2140,7 @@ export type SyncEventSessionNextModelSwitched = {
model: {
id: string
providerID: string
variant: string
variant?: string
}
}
}
@@ -2209,7 +2212,7 @@ export type SyncEventSessionNextStepStarted = {
model: {
id: string
providerID: string
variant: string
variant?: string
}
snapshot?: string
}
@@ -2890,7 +2893,7 @@ export type EventSessionNextModelSwitched = {
model: {
id: string
providerID: string
variant: string
variant?: string
}
}
}
@@ -2978,7 +2981,7 @@ export type EventSessionNextStepStarted = {
model: {
id: string
providerID: string
variant: string
variant?: string
}
snapshot?: string
}
@@ -3252,6 +3255,14 @@ export type EventSessionNextCompactionEnded = {
}
}
export type EventPluginAdded = {
id: string
type: "plugin.added"
properties: {
id: string
}
}
export type ModelV2Info = {
id: string
apiID: string
@@ -3416,6 +3427,14 @@ export type EventAccountSwitched = {
}
}
export type PolicyEffect = "allow" | "deny"
export type ConfigV2ExperimentalPolicy = {
action: "provider.use"
effect: PolicyEffect
resource: string
}
export type SessionInfo = {
id: string
parentID?: string
@@ -3426,7 +3445,7 @@ export type SessionInfo = {
model?: {
id: string
providerID: string
variant: string
variant?: string
}
cost: number
tokens: {
@@ -3472,7 +3491,7 @@ export type SessionMessageModelSwitched = {
model: {
id: string
providerID: string
variant: string
variant?: string
}
}
@@ -3607,7 +3626,7 @@ export type SessionMessageAssistant = {
model: {
id: string
providerID: string
variant: string
variant?: string
}
content: Array<SessionMessageAssistantText | SessionMessageAssistantReasoning | SessionMessageAssistantTool>
snapshot?: {

View File

@@ -10698,6 +10698,9 @@
{
"$ref": "#/components/schemas/EventSessionNextCompactionEnded"
},
{
"$ref": "#/components/schemas/EventPluginAdded"
},
{
"$ref": "#/components/schemas/EventCatalogModelUpdated"
},
@@ -13124,6 +13127,9 @@
{
"$ref": "#/components/schemas/EventSessionNextCompactionEnded"
},
{
"$ref": "#/components/schemas/EventPluginAdded"
},
{
"$ref": "#/components/schemas/EventCatalogModelUpdated"
},
@@ -14330,6 +14336,12 @@
"mcp_timeout": {
"type": "integer",
"exclusiveMinimum": 0
},
"policies": {
"type": "array",
"items": {
"$ref": "#/components/schemas/ConfigV2ExperimentalPolicy"
}
}
},
"additionalProperties": false
@@ -16969,7 +16981,7 @@
"type": "string"
}
},
"required": ["id", "providerID", "variant"],
"required": ["id", "providerID"],
"additionalProperties": false
}
},
@@ -17201,7 +17213,7 @@
"type": "string"
}
},
"required": ["id", "providerID", "variant"],
"required": ["id", "providerID"],
"additionalProperties": false
},
"snapshot": {
@@ -19307,7 +19319,7 @@
"type": "string"
}
},
"required": ["id", "providerID", "variant"],
"required": ["id", "providerID"],
"additionalProperties": false
}
},
@@ -19570,7 +19582,7 @@
"type": "string"
}
},
"required": ["id", "providerID", "variant"],
"required": ["id", "providerID"],
"additionalProperties": false
},
"snapshot": {
@@ -20386,6 +20398,30 @@
"required": ["id", "type", "properties"],
"additionalProperties": false
},
"EventPluginAdded": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"type": {
"type": "string",
"enum": ["plugin.added"]
},
"properties": {
"type": "object",
"properties": {
"id": {
"type": "string"
}
},
"required": ["id"],
"additionalProperties": false
}
},
"required": ["id", "type", "properties"],
"additionalProperties": false
},
"ModelV2Info": {
"type": "object",
"properties": {
@@ -20900,6 +20936,27 @@
"required": ["id", "type", "properties"],
"additionalProperties": false
},
"PolicyEffect": {
"type": "string",
"enum": ["allow", "deny"]
},
"ConfigV2ExperimentalPolicy": {
"type": "object",
"properties": {
"action": {
"type": "string",
"enum": ["provider.use"]
},
"effect": {
"$ref": "#/components/schemas/PolicyEffect"
},
"resource": {
"type": "string"
}
},
"required": ["action", "effect", "resource"],
"additionalProperties": false
},
"SessionInfo": {
"type": "object",
"properties": {
@@ -20937,7 +20994,7 @@
"type": "string"
}
},
"required": ["id", "providerID", "variant"],
"required": ["id", "providerID"],
"additionalProperties": false
},
"cost": {
@@ -21065,7 +21122,7 @@
"type": "string"
}
},
"required": ["id", "providerID", "variant"],
"required": ["id", "providerID"],
"additionalProperties": false
}
},
@@ -21444,7 +21501,7 @@
"type": "string"
}
},
"required": ["id", "providerID", "variant"],
"required": ["id", "providerID"],
"additionalProperties": false
},
"content": {

View File

@@ -42,9 +42,9 @@ A provider denied by policy is not available for model selection or model use, e
OpenCode currently supports one policy action:
| Action | Resource | Description |
| -------------- | ------------------------------ | ------------------------------------------ |
| `provider.use` | Provider ID, such as `openai` | Allow or deny use of an LLM provider. |
| Action | Resource | Description |
| -------------- | ----------------------------- | ------------------------------------- |
| `provider.use` | Provider ID, such as `openai` | Allow or deny use of an LLM provider. |
More policy actions may be added in the future.