Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ed8d277e49 | |||
| 59b3268c64 | |||
| d043f67761 | |||
| 51bf193889 |
@@ -19,7 +19,7 @@
|
||||
},
|
||||
"packages/opencode": {
|
||||
"name": "opencode",
|
||||
"version": "0.0.0",
|
||||
"version": "0.0.5",
|
||||
"bin": {
|
||||
"opencode": "./bin/opencode",
|
||||
},
|
||||
|
||||
+5
-1
@@ -3,7 +3,11 @@
|
||||
"experimental": {
|
||||
"hook": {
|
||||
"file_edited": {
|
||||
".json": []
|
||||
".json": [
|
||||
{
|
||||
"command": ["bun", "run", "prettier", "$FILE"]
|
||||
}
|
||||
]
|
||||
},
|
||||
"session_completed": [
|
||||
{
|
||||
|
||||
Vendored
+8
-8
@@ -6,20 +6,20 @@
|
||||
import "sst"
|
||||
declare module "sst" {
|
||||
export interface Resource {
|
||||
"Web": {
|
||||
"type": "sst.cloudflare.Astro"
|
||||
"url": string
|
||||
Web: {
|
||||
type: "sst.cloudflare.Astro"
|
||||
url: string
|
||||
}
|
||||
}
|
||||
}
|
||||
// cloudflare
|
||||
import * as cloudflare from "@cloudflare/workers-types";
|
||||
// cloudflare
|
||||
import * as cloudflare from "@cloudflare/workers-types"
|
||||
declare module "sst" {
|
||||
export interface Resource {
|
||||
"Api": cloudflare.Service
|
||||
"Bucket": cloudflare.R2Bucket
|
||||
Api: cloudflare.Service
|
||||
Bucket: cloudflare.R2Bucket
|
||||
}
|
||||
}
|
||||
|
||||
import "sst"
|
||||
export {}
|
||||
export {}
|
||||
|
||||
@@ -202,10 +202,7 @@
|
||||
"type": "number"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"input",
|
||||
"output"
|
||||
],
|
||||
"required": ["input", "output"],
|
||||
"additionalProperties": false
|
||||
},
|
||||
"limit": {
|
||||
@@ -218,10 +215,7 @@
|
||||
"type": "number"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"context",
|
||||
"output"
|
||||
],
|
||||
"required": ["context", "output"],
|
||||
"additionalProperties": false
|
||||
},
|
||||
"id": {
|
||||
@@ -240,9 +234,7 @@
|
||||
"additionalProperties": {}
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"models"
|
||||
],
|
||||
"required": ["models"],
|
||||
"additionalProperties": false
|
||||
},
|
||||
"description": "Custom provider configurations and model overrides"
|
||||
@@ -274,10 +266,7 @@
|
||||
"description": "Environment variables to set when running the MCP server"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"type",
|
||||
"command"
|
||||
],
|
||||
"required": ["type", "command"],
|
||||
"additionalProperties": false
|
||||
},
|
||||
{
|
||||
@@ -293,10 +282,7 @@
|
||||
"description": "URL of the remote MCP server"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"type",
|
||||
"url"
|
||||
],
|
||||
"required": ["type", "url"],
|
||||
"additionalProperties": false
|
||||
}
|
||||
]
|
||||
@@ -329,9 +315,7 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"command"
|
||||
],
|
||||
"required": ["command"],
|
||||
"additionalProperties": false
|
||||
}
|
||||
}
|
||||
@@ -354,9 +338,7 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"command"
|
||||
],
|
||||
"required": ["command"],
|
||||
"additionalProperties": false
|
||||
}
|
||||
}
|
||||
@@ -369,4 +351,4 @@
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"$schema": "http://json-schema.org/draft-07/schema#"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ import "zod-openapi/extend"
|
||||
import { Log } from "../util/log"
|
||||
import { Context } from "../util/context"
|
||||
import { Filesystem } from "../util/filesystem"
|
||||
import { Project } from "../util/project"
|
||||
import { Global } from "../global"
|
||||
import path from "path"
|
||||
import os from "os"
|
||||
@@ -12,7 +13,9 @@ export namespace App {
|
||||
|
||||
export const Info = z
|
||||
.object({
|
||||
project: z.string(),
|
||||
user: z.string(),
|
||||
hostname: z.string(),
|
||||
git: z.boolean(),
|
||||
path: z.object({
|
||||
config: z.string(),
|
||||
@@ -62,8 +65,13 @@ export namespace App {
|
||||
}
|
||||
>()
|
||||
|
||||
const root = git ?? input.cwd
|
||||
const project = await Project.getName(root)
|
||||
|
||||
const info: Info = {
|
||||
project: project,
|
||||
user: os.userInfo().username,
|
||||
hostname: os.hostname(),
|
||||
time: {
|
||||
initialized: state.initialized,
|
||||
},
|
||||
@@ -72,7 +80,7 @@ export namespace App {
|
||||
config: Global.Path.config,
|
||||
state: Global.Path.state,
|
||||
data,
|
||||
root: git ?? input.cwd,
|
||||
root,
|
||||
cwd: input.cwd,
|
||||
},
|
||||
}
|
||||
@@ -142,4 +150,3 @@ export namespace App {
|
||||
.replace(/[^A-Za-z0-9_]/g, "-")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ export const AuthListCommand = cmd({
|
||||
UI.empty()
|
||||
const authPath = path.join(Global.Path.data, "auth.json")
|
||||
const homedir = os.homedir()
|
||||
const displayPath = authPath.startsWith(homedir)
|
||||
const displayPath = authPath.startsWith(homedir)
|
||||
? authPath.replace(homedir, "~")
|
||||
: authPath
|
||||
prompts.intro(`Credentials ${UI.Style.TEXT_DIM}${displayPath}`)
|
||||
@@ -46,14 +46,14 @@ export const AuthListCommand = cmd({
|
||||
prompts.outro(`${results.length} credentials`)
|
||||
|
||||
// Environment variables section
|
||||
const activeEnvVars: Array<{ provider: string, envVar: string }> = []
|
||||
|
||||
const activeEnvVars: Array<{ provider: string; envVar: string }> = []
|
||||
|
||||
for (const [providerID, provider] of Object.entries(database)) {
|
||||
for (const envVar of provider.env) {
|
||||
if (process.env[envVar]) {
|
||||
activeEnvVars.push({
|
||||
provider: provider.name || providerID,
|
||||
envVar
|
||||
activeEnvVars.push({
|
||||
provider: provider.name || providerID,
|
||||
envVar,
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -62,11 +62,11 @@ export const AuthListCommand = cmd({
|
||||
if (activeEnvVars.length > 0) {
|
||||
UI.empty()
|
||||
prompts.intro("Environment")
|
||||
|
||||
|
||||
for (const { provider, envVar } of activeEnvVars) {
|
||||
prompts.log.info(`${provider} ${UI.Style.TEXT_DIM}${envVar}`)
|
||||
}
|
||||
|
||||
|
||||
prompts.outro(`${activeEnvVars.length} environment variables`)
|
||||
}
|
||||
},
|
||||
|
||||
@@ -8,7 +8,7 @@ export const ModelsCommand = cmd({
|
||||
handler: async () => {
|
||||
await App.provide({ cwd: process.cwd() }, async () => {
|
||||
const providers = await Provider.list()
|
||||
|
||||
|
||||
for (const [providerID, provider] of Object.entries(providers)) {
|
||||
for (const modelID of Object.keys(provider.info.models)) {
|
||||
console.log(`${providerID}/${modelID}`)
|
||||
@@ -16,4 +16,4 @@ export const ModelsCommand = cmd({
|
||||
}
|
||||
})
|
||||
},
|
||||
})
|
||||
})
|
||||
|
||||
@@ -7,12 +7,9 @@ export const ScrapCommand = cmd({
|
||||
builder: (yargs) =>
|
||||
yargs.positional("file", { type: "string", demandOption: true }),
|
||||
async handler(args) {
|
||||
await App.provide(
|
||||
{ cwd: process.cwd() },
|
||||
async () => {
|
||||
await LSP.touchFile(args.file, true)
|
||||
console.log(await LSP.diagnostics())
|
||||
},
|
||||
)
|
||||
await App.provide({ cwd: process.cwd() }, async () => {
|
||||
await LSP.touchFile(args.file, true)
|
||||
console.log(await LSP.diagnostics())
|
||||
})
|
||||
},
|
||||
})
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import { App } from '../app/app'
|
||||
import { BunProc } from '../bun'
|
||||
import { Config } from '../config/config'
|
||||
import { Log } from '../util/log'
|
||||
import path from 'path'
|
||||
import { App } from "../app/app"
|
||||
import { BunProc } from "../bun"
|
||||
import { Config } from "../config/config"
|
||||
import { Log } from "../util/log"
|
||||
import path from "path"
|
||||
|
||||
export namespace Format {
|
||||
const log = Log.create({ service: 'format' })
|
||||
const log = Log.create({ service: "format" })
|
||||
|
||||
const state = App.state('format', async () => {
|
||||
const state = App.state("format", async () => {
|
||||
const hooks: Record<string, Hook[]> = {}
|
||||
for (const item of FORMATTERS) {
|
||||
if (await item.enabled()) {
|
||||
@@ -42,22 +42,24 @@ export namespace Format {
|
||||
})
|
||||
|
||||
export async function run(file: string) {
|
||||
log.info('formatting', { file })
|
||||
log.info("formatting", { file })
|
||||
const { hooks } = await state()
|
||||
const ext = path.extname(file)
|
||||
const match = hooks[ext]
|
||||
if (!match) return
|
||||
|
||||
for (const item of match) {
|
||||
log.info('running', { command: item.command })
|
||||
log.info("running", { command: item.command })
|
||||
const proc = Bun.spawn({
|
||||
cmd: item.command.map((x) => x.replace('$FILE', file)),
|
||||
cmd: item.command.map((x) => x.replace("$FILE", file)),
|
||||
cwd: App.info().path.cwd,
|
||||
env: item.environment,
|
||||
stdout: "ignore",
|
||||
stderr: "ignore",
|
||||
})
|
||||
const exit = await proc.exited
|
||||
if (exit !== 0)
|
||||
log.error('failed', {
|
||||
log.error("failed", {
|
||||
command: item.command,
|
||||
...item.environment,
|
||||
})
|
||||
@@ -79,58 +81,49 @@ export namespace Format {
|
||||
|
||||
const FORMATTERS: Native[] = [
|
||||
{
|
||||
name: 'prettier',
|
||||
extensions: [
|
||||
'.js',
|
||||
'.jsx',
|
||||
'.mjs',
|
||||
'.cjs',
|
||||
'.ts',
|
||||
'.tsx',
|
||||
'.mts',
|
||||
'.cts',
|
||||
'.html',
|
||||
'.htm',
|
||||
'.css',
|
||||
'.scss',
|
||||
'.sass',
|
||||
'.less',
|
||||
'.vue',
|
||||
'.svelte',
|
||||
'.json',
|
||||
'.jsonc',
|
||||
'.yaml',
|
||||
'.yml',
|
||||
'.toml',
|
||||
'.xml',
|
||||
'.md',
|
||||
'.mdx',
|
||||
'.php',
|
||||
'.rb',
|
||||
'.java',
|
||||
'.go',
|
||||
'.rs',
|
||||
'.swift',
|
||||
'.kt',
|
||||
'.kts',
|
||||
'.sol',
|
||||
'.graphql',
|
||||
'.gql',
|
||||
],
|
||||
command: [BunProc.which(), 'run', 'prettier', '--write', '$FILE'],
|
||||
name: "prettier",
|
||||
command: [BunProc.which(), "run", "prettier", "--write", "$FILE"],
|
||||
environment: {
|
||||
BUN_BE_BUN: '1',
|
||||
BUN_BE_BUN: "1",
|
||||
},
|
||||
extensions: [
|
||||
".js",
|
||||
".jsx",
|
||||
".mjs",
|
||||
".cjs",
|
||||
".ts",
|
||||
".tsx",
|
||||
".mts",
|
||||
".cts",
|
||||
".html",
|
||||
".htm",
|
||||
".css",
|
||||
".scss",
|
||||
".sass",
|
||||
".less",
|
||||
".vue",
|
||||
".svelte",
|
||||
".json",
|
||||
".jsonc",
|
||||
".yaml",
|
||||
".yml",
|
||||
".toml",
|
||||
".xml",
|
||||
".md",
|
||||
".mdx",
|
||||
".graphql",
|
||||
".gql",
|
||||
],
|
||||
async enabled() {
|
||||
try {
|
||||
const proc = Bun.spawn({
|
||||
cmd: [BunProc.which(), 'run', 'prettier', '--version'],
|
||||
cmd: [BunProc.which(), "run", "prettier", "--version"],
|
||||
cwd: App.info().path.cwd,
|
||||
env: {
|
||||
BUN_BE_BUN: '1',
|
||||
BUN_BE_BUN: "1",
|
||||
},
|
||||
stdout: 'ignore',
|
||||
stderr: 'ignore',
|
||||
stdout: "ignore",
|
||||
stderr: "ignore",
|
||||
})
|
||||
const exit = await proc.exited
|
||||
return exit === 0
|
||||
|
||||
@@ -537,6 +537,7 @@ export namespace Session {
|
||||
// return step
|
||||
// },
|
||||
toolCallStreaming: true,
|
||||
maxTokens: model.info.limit.output || undefined,
|
||||
abortSignal: abort.signal,
|
||||
maxSteps: 1000,
|
||||
providerOptions: model.info.options,
|
||||
@@ -860,6 +861,8 @@ export namespace Session {
|
||||
cmd: item.command,
|
||||
cwd: App.info().path.cwd,
|
||||
env: item.environment,
|
||||
stdout: "ignore",
|
||||
stderr: "ignore",
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,6 +80,7 @@ export const EditTool = Tool.define({
|
||||
)
|
||||
await file.write(contentNew)
|
||||
await Format.run(filepath)
|
||||
contentNew = await file.text()
|
||||
})()
|
||||
|
||||
const diff = trimDiff(
|
||||
|
||||
@@ -8,4 +8,3 @@ export function lazy<T>(fn: () => T) {
|
||||
return value as T
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,10 @@ export namespace Log {
|
||||
await fs.mkdir(dir, { recursive: true })
|
||||
cleanup(dir)
|
||||
if (options.print) return
|
||||
logpath = path.join(dir, new Date().toISOString().split(".")[0].replace(/:/g, "") + ".log")
|
||||
logpath = path.join(
|
||||
dir,
|
||||
new Date().toISOString().split(".")[0].replace(/:/g, "") + ".log",
|
||||
)
|
||||
const logfile = Bun.file(logpath)
|
||||
await fs.truncate(logpath).catch(() => {})
|
||||
const writer = logfile.writer()
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
import path from "path"
|
||||
import { readdir } from "fs/promises"
|
||||
|
||||
export namespace Project {
|
||||
export async function getName(rootPath: string): Promise<string> {
|
||||
try {
|
||||
const packageJsonPath = path.join(rootPath, "package.json")
|
||||
const packageJson = await Bun.file(packageJsonPath).json()
|
||||
if (packageJson.name && typeof packageJson.name === "string") {
|
||||
return packageJson.name
|
||||
}
|
||||
} catch {}
|
||||
|
||||
try {
|
||||
const cargoTomlPath = path.join(rootPath, "Cargo.toml")
|
||||
const cargoToml = await Bun.file(cargoTomlPath).text()
|
||||
const nameMatch = cargoToml.match(/^\s*name\s*=\s*"([^"]+)"/m)
|
||||
if (nameMatch?.[1]) {
|
||||
return nameMatch[1]
|
||||
}
|
||||
} catch {}
|
||||
|
||||
try {
|
||||
const pyprojectPath = path.join(rootPath, "pyproject.toml")
|
||||
const pyproject = await Bun.file(pyprojectPath).text()
|
||||
const nameMatch = pyproject.match(/^\s*name\s*=\s*"([^"]+)"/m)
|
||||
if (nameMatch?.[1]) {
|
||||
return nameMatch[1]
|
||||
}
|
||||
} catch {}
|
||||
|
||||
try {
|
||||
const goModPath = path.join(rootPath, "go.mod")
|
||||
const goMod = await Bun.file(goModPath).text()
|
||||
const moduleMatch = goMod.match(/^module\s+(.+)$/m)
|
||||
if (moduleMatch?.[1]) {
|
||||
// Extract just the last part of the module path
|
||||
const parts = moduleMatch[1].trim().split("/")
|
||||
return parts[parts.length - 1]
|
||||
}
|
||||
} catch {}
|
||||
|
||||
try {
|
||||
const composerPath = path.join(rootPath, "composer.json")
|
||||
const composer = await Bun.file(composerPath).json()
|
||||
if (composer.name && typeof composer.name === "string") {
|
||||
// Composer names are usually vendor/package, extract the package part
|
||||
const parts = composer.name.split("/")
|
||||
return parts[parts.length - 1]
|
||||
}
|
||||
} catch {}
|
||||
|
||||
try {
|
||||
const pomPath = path.join(rootPath, "pom.xml")
|
||||
const pom = await Bun.file(pomPath).text()
|
||||
const artifactIdMatch = pom.match(/<artifactId>([^<]+)<\/artifactId>/)
|
||||
if (artifactIdMatch?.[1]) {
|
||||
return artifactIdMatch[1]
|
||||
}
|
||||
} catch {}
|
||||
|
||||
for (const gradleFile of ["build.gradle", "build.gradle.kts"]) {
|
||||
try {
|
||||
const gradlePath = path.join(rootPath, gradleFile)
|
||||
await Bun.file(gradlePath).text() // Check if gradle file exists
|
||||
// Look for rootProject.name in settings.gradle
|
||||
const settingsPath = path.join(rootPath, "settings.gradle")
|
||||
const settings = await Bun.file(settingsPath).text()
|
||||
const nameMatch = settings.match(
|
||||
/rootProject\.name\s*=\s*['"]([^'"]+)['"]/,
|
||||
)
|
||||
if (nameMatch?.[1]) {
|
||||
return nameMatch[1]
|
||||
}
|
||||
} catch {}
|
||||
}
|
||||
|
||||
const dotnetExtensions = [".csproj", ".fsproj", ".vbproj"]
|
||||
try {
|
||||
const files = await readdir(rootPath)
|
||||
for (const file of files) {
|
||||
if (dotnetExtensions.some((ext) => file.endsWith(ext))) {
|
||||
// Use the filename without extension as project name
|
||||
return path.basename(file, path.extname(file))
|
||||
}
|
||||
}
|
||||
} catch {}
|
||||
|
||||
return path.basename(rootPath)
|
||||
}
|
||||
}
|
||||
Vendored
+1
-1
@@ -6,4 +6,4 @@
|
||||
/// <reference path="../../sst-env.d.ts" />
|
||||
|
||||
import "sst"
|
||||
export {}
|
||||
export {}
|
||||
|
||||
@@ -316,13 +316,13 @@ const testCases: TestCase[] = [
|
||||
// WhitespaceNormalizedReplacer - test regex special characters that could cause errors
|
||||
{
|
||||
content: 'const pattern = "test[123]";',
|
||||
find: 'test[123]',
|
||||
replace: 'test[456]',
|
||||
find: "test[123]",
|
||||
replace: "test[456]",
|
||||
},
|
||||
{
|
||||
content: 'const regex = "^start.*end$";',
|
||||
find: '^start.*end$',
|
||||
replace: '^begin.*finish$',
|
||||
find: "^start.*end$",
|
||||
replace: "^begin.*finish$",
|
||||
},
|
||||
|
||||
// EscapeNormalizedReplacer - test single backslash vs double backslash
|
||||
|
||||
@@ -23,4 +23,4 @@
|
||||
- **Client**: Generated OpenAPI client communicates with TypeScript server
|
||||
- **Components**: Reusable UI components in `internal/components/`
|
||||
- **Themes**: JSON-based theming system with override hierarchy
|
||||
- **State**: Centralized app state with message passing
|
||||
- **State**: Centralized app state with message passing
|
||||
|
||||
@@ -49,6 +49,8 @@ func main() {
|
||||
logger := slog.New(slog.NewTextHandler(file, &slog.HandlerOptions{Level: slog.LevelDebug}))
|
||||
slog.SetDefault(logger)
|
||||
|
||||
slog.Debug("TUI launched", "app", appInfo)
|
||||
|
||||
httpClient, err := client.NewClientWithResponses(url)
|
||||
if err != nil {
|
||||
slog.Error("Failed to create client", "error", err)
|
||||
@@ -66,7 +68,6 @@ func main() {
|
||||
|
||||
program := tea.NewProgram(
|
||||
tui.NewModel(app_),
|
||||
// tea.WithColorProfile(colorprofile.ANSI),
|
||||
tea.WithAltScreen(),
|
||||
tea.WithKeyboardEnhancements(),
|
||||
tea.WithMouseCellMotion(),
|
||||
|
||||
@@ -78,4 +78,3 @@
|
||||
"syntaxPunctuation": "darkFg"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -110,4 +110,3 @@
|
||||
"syntaxPunctuation": { "dark": "darkText", "light": "lightText" }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -225,4 +225,4 @@
|
||||
"light": "#193549"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -216,4 +216,4 @@
|
||||
"light": "#282a36"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -239,4 +239,3 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -230,4 +230,4 @@
|
||||
"light": "lightFg"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -232,4 +232,4 @@
|
||||
"light": "lightFg"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -218,4 +218,4 @@
|
||||
"light": "#272822"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -243,4 +243,3 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -219,4 +219,4 @@
|
||||
"light": "#292d3e"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -231,4 +231,4 @@
|
||||
"light": "dawnSubtle"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -220,4 +220,4 @@
|
||||
"light": "base00"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -223,4 +223,4 @@
|
||||
"light": "#262335"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -241,4 +241,3 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -220,4 +220,4 @@
|
||||
"light": "#3f3f3f"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1088,13 +1088,17 @@
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/UnknownError"
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/MessageOutputLengthError"
|
||||
}
|
||||
],
|
||||
"discriminator": {
|
||||
"propertyName": "name",
|
||||
"mapping": {
|
||||
"ProviderAuthError": "#/components/schemas/ProviderAuthError",
|
||||
"UnknownError": "#/components/schemas/UnknownError"
|
||||
"UnknownError": "#/components/schemas/UnknownError",
|
||||
"MessageOutputLengthError": "#/components/schemas/MessageOutputLengthError"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -1272,6 +1276,22 @@
|
||||
"data"
|
||||
]
|
||||
},
|
||||
"MessageOutputLengthError": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string",
|
||||
"const": "MessageOutputLengthError"
|
||||
},
|
||||
"data": {
|
||||
"type": "object"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"name",
|
||||
"data"
|
||||
]
|
||||
},
|
||||
"Event.message.part.updated": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -1420,13 +1440,17 @@
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/UnknownError"
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/MessageOutputLengthError"
|
||||
}
|
||||
],
|
||||
"discriminator": {
|
||||
"propertyName": "name",
|
||||
"mapping": {
|
||||
"ProviderAuthError": "#/components/schemas/ProviderAuthError",
|
||||
"UnknownError": "#/components/schemas/UnknownError"
|
||||
"UnknownError": "#/components/schemas/UnknownError",
|
||||
"MessageOutputLengthError": "#/components/schemas/MessageOutputLengthError"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1441,9 +1465,15 @@
|
||||
"App.Info": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"project": {
|
||||
"type": "string"
|
||||
},
|
||||
"user": {
|
||||
"type": "string"
|
||||
},
|
||||
"hostname": {
|
||||
"type": "string"
|
||||
},
|
||||
"git": {
|
||||
"type": "boolean"
|
||||
},
|
||||
@@ -1484,7 +1514,9 @@
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"project",
|
||||
"user",
|
||||
"hostname",
|
||||
"git",
|
||||
"path",
|
||||
"time"
|
||||
@@ -1644,6 +1676,65 @@
|
||||
}
|
||||
},
|
||||
"description": "MCP (Model Context Protocol) server configurations"
|
||||
},
|
||||
"experimental": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"hook": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"file_edited": {
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"command": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"environment": {
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"command"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"session_completed": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"command": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"environment": {
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"command"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
|
||||
@@ -25,15 +25,17 @@ const (
|
||||
|
||||
// AppInfo defines model for App.Info.
|
||||
type AppInfo struct {
|
||||
Git bool `json:"git"`
|
||||
Path struct {
|
||||
Git bool `json:"git"`
|
||||
Hostname string `json:"hostname"`
|
||||
Path struct {
|
||||
Config string `json:"config"`
|
||||
Cwd string `json:"cwd"`
|
||||
Data string `json:"data"`
|
||||
Root string `json:"root"`
|
||||
State string `json:"state"`
|
||||
} `json:"path"`
|
||||
Time struct {
|
||||
Project string `json:"project"`
|
||||
Time struct {
|
||||
Initialized *float32 `json:"initialized,omitempty"`
|
||||
} `json:"time"`
|
||||
User string `json:"user"`
|
||||
@@ -51,8 +53,20 @@ type ConfigInfo struct {
|
||||
Autoupdate *bool `json:"autoupdate,omitempty"`
|
||||
|
||||
// DisabledProviders Disable providers that are loaded automatically
|
||||
DisabledProviders *[]string `json:"disabled_providers,omitempty"`
|
||||
Keybinds *ConfigKeybinds `json:"keybinds,omitempty"`
|
||||
DisabledProviders *[]string `json:"disabled_providers,omitempty"`
|
||||
Experimental *struct {
|
||||
Hook *struct {
|
||||
FileEdited *map[string][]struct {
|
||||
Command []string `json:"command"`
|
||||
Environment *map[string]string `json:"environment,omitempty"`
|
||||
} `json:"file_edited,omitempty"`
|
||||
SessionCompleted *[]struct {
|
||||
Command []string `json:"command"`
|
||||
Environment *map[string]string `json:"environment,omitempty"`
|
||||
} `json:"session_completed,omitempty"`
|
||||
} `json:"hook,omitempty"`
|
||||
} `json:"experimental,omitempty"`
|
||||
Keybinds *ConfigKeybinds `json:"keybinds,omitempty"`
|
||||
|
||||
// Mcp MCP (Model Context Protocol) server configurations
|
||||
Mcp *map[string]ConfigInfo_Mcp_AdditionalProperties `json:"mcp,omitempty"`
|
||||
@@ -434,6 +448,12 @@ type MessageToolInvocationToolResult struct {
|
||||
ToolName string `json:"toolName"`
|
||||
}
|
||||
|
||||
// MessageOutputLengthError defines model for MessageOutputLengthError.
|
||||
type MessageOutputLengthError struct {
|
||||
Data map[string]interface{} `json:"data"`
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
// ModelInfo defines model for Model.Info.
|
||||
type ModelInfo struct {
|
||||
Attachment bool `json:"attachment"`
|
||||
@@ -1110,6 +1130,34 @@ func (t *EventSessionError_Properties_Error) MergeUnknownError(v UnknownError) e
|
||||
return err
|
||||
}
|
||||
|
||||
// AsMessageOutputLengthError returns the union data inside the EventSessionError_Properties_Error as a MessageOutputLengthError
|
||||
func (t EventSessionError_Properties_Error) AsMessageOutputLengthError() (MessageOutputLengthError, error) {
|
||||
var body MessageOutputLengthError
|
||||
err := json.Unmarshal(t.union, &body)
|
||||
return body, err
|
||||
}
|
||||
|
||||
// FromMessageOutputLengthError overwrites any union data inside the EventSessionError_Properties_Error as the provided MessageOutputLengthError
|
||||
func (t *EventSessionError_Properties_Error) FromMessageOutputLengthError(v MessageOutputLengthError) error {
|
||||
v.Name = "MessageOutputLengthError"
|
||||
b, err := json.Marshal(v)
|
||||
t.union = b
|
||||
return err
|
||||
}
|
||||
|
||||
// MergeMessageOutputLengthError performs a merge with any union data inside the EventSessionError_Properties_Error, using the provided MessageOutputLengthError
|
||||
func (t *EventSessionError_Properties_Error) MergeMessageOutputLengthError(v MessageOutputLengthError) error {
|
||||
v.Name = "MessageOutputLengthError"
|
||||
b, err := json.Marshal(v)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
merged, err := runtime.JSONMerge(t.union, b)
|
||||
t.union = merged
|
||||
return err
|
||||
}
|
||||
|
||||
func (t EventSessionError_Properties_Error) Discriminator() (string, error) {
|
||||
var discriminator struct {
|
||||
Discriminator string `json:"name"`
|
||||
@@ -1124,6 +1172,8 @@ func (t EventSessionError_Properties_Error) ValueByDiscriminator() (interface{},
|
||||
return nil, err
|
||||
}
|
||||
switch discriminator {
|
||||
case "MessageOutputLengthError":
|
||||
return t.AsMessageOutputLengthError()
|
||||
case "ProviderAuthError":
|
||||
return t.AsProviderAuthError()
|
||||
case "UnknownError":
|
||||
@@ -1199,6 +1249,34 @@ func (t *MessageMetadata_Error) MergeUnknownError(v UnknownError) error {
|
||||
return err
|
||||
}
|
||||
|
||||
// AsMessageOutputLengthError returns the union data inside the MessageMetadata_Error as a MessageOutputLengthError
|
||||
func (t MessageMetadata_Error) AsMessageOutputLengthError() (MessageOutputLengthError, error) {
|
||||
var body MessageOutputLengthError
|
||||
err := json.Unmarshal(t.union, &body)
|
||||
return body, err
|
||||
}
|
||||
|
||||
// FromMessageOutputLengthError overwrites any union data inside the MessageMetadata_Error as the provided MessageOutputLengthError
|
||||
func (t *MessageMetadata_Error) FromMessageOutputLengthError(v MessageOutputLengthError) error {
|
||||
v.Name = "MessageOutputLengthError"
|
||||
b, err := json.Marshal(v)
|
||||
t.union = b
|
||||
return err
|
||||
}
|
||||
|
||||
// MergeMessageOutputLengthError performs a merge with any union data inside the MessageMetadata_Error, using the provided MessageOutputLengthError
|
||||
func (t *MessageMetadata_Error) MergeMessageOutputLengthError(v MessageOutputLengthError) error {
|
||||
v.Name = "MessageOutputLengthError"
|
||||
b, err := json.Marshal(v)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
merged, err := runtime.JSONMerge(t.union, b)
|
||||
t.union = merged
|
||||
return err
|
||||
}
|
||||
|
||||
func (t MessageMetadata_Error) Discriminator() (string, error) {
|
||||
var discriminator struct {
|
||||
Discriminator string `json:"name"`
|
||||
@@ -1213,6 +1291,8 @@ func (t MessageMetadata_Error) ValueByDiscriminator() (interface{}, error) {
|
||||
return nil, err
|
||||
}
|
||||
switch discriminator {
|
||||
case "MessageOutputLengthError":
|
||||
return t.AsMessageOutputLengthError()
|
||||
case "ProviderAuthError":
|
||||
return t.AsProviderAuthError()
|
||||
case "UnknownError":
|
||||
|
||||
@@ -32,9 +32,7 @@ export default defineConfig({
|
||||
starlight({
|
||||
title: "opencode",
|
||||
expressiveCode: { themes: ["github-light", "github-dark"] },
|
||||
social: [
|
||||
{ icon: "github", label: "GitHub", href: config.github },
|
||||
],
|
||||
social: [{ icon: "github", label: "GitHub", href: config.github }],
|
||||
head: [
|
||||
{
|
||||
tag: "link",
|
||||
|
||||
Reference in New Issue
Block a user