mirror of
https://github.com/anomalyco/opencode.git
synced 2026-05-20 19:06:22 +00:00
sync
This commit is contained in:
2
.github/workflows/publish.yml
vendored
2
.github/workflows/publish.yml
vendored
@@ -34,7 +34,7 @@ jobs:
|
||||
|
||||
- uses: oven-sh/setup-bun@v2
|
||||
with:
|
||||
bun-version: 1.2.17
|
||||
bun-version: 1.2.19
|
||||
|
||||
- name: Install makepkg
|
||||
run: |
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
"name": "opencode",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"packageManager": "bun@1.2.14",
|
||||
"packageManager": "bun@1.2.19",
|
||||
"scripts": {
|
||||
"dev": "bun run packages/opencode/src/index.ts",
|
||||
"typecheck": "bun run --filter='*' typecheck",
|
||||
|
||||
@@ -19,9 +19,9 @@
|
||||
"@ai-sdk/anthropic": "1.2.12",
|
||||
"@standard-schema/spec": "1.0.0",
|
||||
"@tsconfig/bun": "1.0.7",
|
||||
"@types/bun": "latest",
|
||||
"@types/turndown": "5.0.5",
|
||||
"@types/yargs": "17.0.33",
|
||||
"@types/bun": "latest",
|
||||
"typescript": "catalog:",
|
||||
"vscode-languageserver-types": "3.17.5",
|
||||
"zod-to-json-schema": "3.24.5"
|
||||
|
||||
1
packages/plugin/.gitignore
vendored
Normal file
1
packages/plugin/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
dist
|
||||
@@ -1,4 +1,11 @@
|
||||
{
|
||||
"$schema": "https://json.schemastore.org/package.json",
|
||||
"name": "@opencode-ai/plugin"
|
||||
"private": false,
|
||||
"name": "@opencode-ai/plugin",
|
||||
"type": "module",
|
||||
"version": "0.0.1",
|
||||
"devDependencies": {
|
||||
"@tsconfig/node22": "22.0.2",
|
||||
"typescript": "catalog:"
|
||||
}
|
||||
}
|
||||
|
||||
11
packages/plugin/script/publish.ts
Executable file
11
packages/plugin/script/publish.ts
Executable file
@@ -0,0 +1,11 @@
|
||||
#!/usr/bin/env bun
|
||||
|
||||
import { $ } from "bun"
|
||||
|
||||
const dir = new URL("..", import.meta.url).pathname
|
||||
const version = process.env["VERSION"]
|
||||
if (!version) throw new Error("VERSION is required")
|
||||
|
||||
await $`bun pm pkg set version="${version}"`
|
||||
await $`tsc`.cwd(dir)
|
||||
await $`bun publish`
|
||||
@@ -1 +1 @@
|
||||
export * from "./plugin"
|
||||
export * from "./plugin.js"
|
||||
|
||||
11
packages/plugin/tsconfig.json
Normal file
11
packages/plugin/tsconfig.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"$schema": "https://json.schemastore.org/tsconfig",
|
||||
"extends": "@tsconfig/node22/tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "dist",
|
||||
"declaration": true
|
||||
},
|
||||
"include": [
|
||||
"src"
|
||||
]
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
configured_endpoints: 26
|
||||
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/opencode%2Fopencode-335697785b44f3928145853339226bd5e8accd5199bb9d79e2a3fd2d8ce62a57.yml
|
||||
openapi_spec_hash: 74fbaad0fa44496d0d8b11d9b98eab03
|
||||
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/opencode%2Fopencode-fb4caa8d0381531c44dd2d3c8c0b930b8c15a7bdde474d15bf7aeeb3b27aef56.yml
|
||||
openapi_spec_hash: 3a263e46f2369eeb2410430001c60d15
|
||||
config_hash: 1ae82c93499b9f0b9ba828b8919f9cb3
|
||||
|
||||
@@ -16,6 +16,10 @@ Methods:
|
||||
|
||||
# App
|
||||
|
||||
Params Types:
|
||||
|
||||
- <a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#LogLevel">LogLevel</a>
|
||||
|
||||
Response Types:
|
||||
|
||||
- <a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#App">App</a>
|
||||
|
||||
@@ -145,6 +145,24 @@ func (r appTimeJSON) RawJSON() string {
|
||||
return r.raw
|
||||
}
|
||||
|
||||
// Log level
|
||||
type LogLevel string
|
||||
|
||||
const (
|
||||
LogLevelDebug LogLevel = "debug"
|
||||
LogLevelInfo LogLevel = "info"
|
||||
LogLevelError LogLevel = "error"
|
||||
LogLevelWarn LogLevel = "warn"
|
||||
)
|
||||
|
||||
func (r LogLevel) IsKnown() bool {
|
||||
switch r {
|
||||
case LogLevelDebug, LogLevelInfo, LogLevelError, LogLevelWarn:
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
type Mode struct {
|
||||
Name string `json:"name,required"`
|
||||
Tools map[string]bool `json:"tools,required"`
|
||||
@@ -334,7 +352,7 @@ func (r appProvidersResponseJSON) RawJSON() string {
|
||||
|
||||
type AppLogParams struct {
|
||||
// Log level
|
||||
Level param.Field[AppLogParamsLevel] `json:"level,required"`
|
||||
Level param.Field[LogLevel] `json:"level,required"`
|
||||
// Log message
|
||||
Message param.Field[string] `json:"message,required"`
|
||||
// Service name for the log entry
|
||||
@@ -346,21 +364,3 @@ type AppLogParams struct {
|
||||
func (r AppLogParams) MarshalJSON() (data []byte, err error) {
|
||||
return apijson.MarshalRoot(r)
|
||||
}
|
||||
|
||||
// Log level
|
||||
type AppLogParamsLevel string
|
||||
|
||||
const (
|
||||
AppLogParamsLevelDebug AppLogParamsLevel = "debug"
|
||||
AppLogParamsLevelInfo AppLogParamsLevel = "info"
|
||||
AppLogParamsLevelError AppLogParamsLevel = "error"
|
||||
AppLogParamsLevelWarn AppLogParamsLevel = "warn"
|
||||
)
|
||||
|
||||
func (r AppLogParamsLevel) IsKnown() bool {
|
||||
switch r {
|
||||
case AppLogParamsLevelDebug, AppLogParamsLevelInfo, AppLogParamsLevelError, AppLogParamsLevelWarn:
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ func TestAppLogWithOptionalParams(t *testing.T) {
|
||||
option.WithBaseURL(baseURL),
|
||||
)
|
||||
_, err := client.App.Log(context.TODO(), opencode.AppLogParams{
|
||||
Level: opencode.F(opencode.AppLogParamsLevelDebug),
|
||||
Level: opencode.F(opencode.LogLevelDebug),
|
||||
Message: opencode.F("message"),
|
||||
Service: opencode.F("service"),
|
||||
Extra: opencode.F(map[string]interface{}{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
configured_endpoints: 26
|
||||
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/opencode%2Fopencode-335697785b44f3928145853339226bd5e8accd5199bb9d79e2a3fd2d8ce62a57.yml
|
||||
openapi_spec_hash: 74fbaad0fa44496d0d8b11d9b98eab03
|
||||
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/opencode%2Fopencode-fb4caa8d0381531c44dd2d3c8c0b930b8c15a7bdde474d15bf7aeeb3b27aef56.yml
|
||||
openapi_spec_hash: 3a263e46f2369eeb2410430001c60d15
|
||||
config_hash: 1ae82c93499b9f0b9ba828b8919f9cb3
|
||||
|
||||
@@ -21,6 +21,7 @@ Methods:
|
||||
Types:
|
||||
|
||||
- <code><a href="./src/resources/app.ts">App</a></code>
|
||||
- <code><a href="./src/resources/app.ts">LogLevel</a></code>
|
||||
- <code><a href="./src/resources/app.ts">Mode</a></code>
|
||||
- <code><a href="./src/resources/app.ts">Model</a></code>
|
||||
- <code><a href="./src/resources/app.ts">Provider</a></code>
|
||||
|
||||
@@ -24,6 +24,7 @@ import {
|
||||
AppModesResponse,
|
||||
AppProvidersResponse,
|
||||
AppResource,
|
||||
LogLevel,
|
||||
Mode,
|
||||
Model,
|
||||
Provider,
|
||||
@@ -89,7 +90,7 @@ import { HeadersLike, NullableHeaders, buildHeaders } from './internal/headers';
|
||||
import { FinalRequestOptions, RequestOptions } from './internal/request-options';
|
||||
import { readEnv } from './internal/utils/env';
|
||||
import {
|
||||
type LogLevel,
|
||||
type LogLevel as ClientLogLevel,
|
||||
type Logger,
|
||||
formatRequestDetails,
|
||||
loggerFor,
|
||||
@@ -157,7 +158,7 @@ export interface ClientOptions {
|
||||
*
|
||||
* Defaults to process.env['OPENCODE_LOG'] or 'warn' if it isn't set.
|
||||
*/
|
||||
logLevel?: LogLevel | undefined;
|
||||
logLevel?: ClientLogLevel | undefined;
|
||||
|
||||
/**
|
||||
* Set the logger.
|
||||
@@ -175,7 +176,7 @@ export class Opencode {
|
||||
maxRetries: number;
|
||||
timeout: number;
|
||||
logger: Logger | undefined;
|
||||
logLevel: LogLevel | undefined;
|
||||
logLevel: ClientLogLevel | undefined;
|
||||
fetchOptions: MergedRequestInit | undefined;
|
||||
|
||||
private fetch: Fetch;
|
||||
@@ -777,6 +778,7 @@ export declare namespace Opencode {
|
||||
export {
|
||||
AppResource as AppResource,
|
||||
type App as App,
|
||||
type LogLevel as LogLevel,
|
||||
type Mode as Mode,
|
||||
type Model as Model,
|
||||
type Provider as Provider,
|
||||
|
||||
@@ -69,6 +69,11 @@ export namespace App {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Log level
|
||||
*/
|
||||
export type LogLevel = 'debug' | 'info' | 'error' | 'warn';
|
||||
|
||||
export interface Mode {
|
||||
name: string;
|
||||
|
||||
@@ -157,7 +162,7 @@ export interface AppLogParams {
|
||||
/**
|
||||
* Log level
|
||||
*/
|
||||
level: 'debug' | 'info' | 'error' | 'warn';
|
||||
level: LogLevel;
|
||||
|
||||
/**
|
||||
* Log message
|
||||
@@ -178,6 +183,7 @@ export interface AppLogParams {
|
||||
export declare namespace AppResource {
|
||||
export {
|
||||
type App as App,
|
||||
type LogLevel as LogLevel,
|
||||
type Mode as Mode,
|
||||
type Model as Model,
|
||||
type Provider as Provider,
|
||||
|
||||
@@ -4,6 +4,7 @@ export * from './shared';
|
||||
export {
|
||||
AppResource,
|
||||
type App,
|
||||
type LogLevel,
|
||||
type Mode,
|
||||
type Model,
|
||||
type Provider,
|
||||
|
||||
9
scripts/publish.ts
Executable file
9
scripts/publish.ts
Executable file
@@ -0,0 +1,9 @@
|
||||
#!/usr/bin/env bun
|
||||
|
||||
import { $ } from "bun"
|
||||
|
||||
import pkg from "../package.json"
|
||||
|
||||
const version = process.env["VERSION"]
|
||||
|
||||
await import("./stainless.ts")
|
||||
15
scripts/stainless.ts
Executable file
15
scripts/stainless.ts
Executable file
@@ -0,0 +1,15 @@
|
||||
#!/usr/bin/env bun
|
||||
|
||||
import { $ } from "bun"
|
||||
|
||||
await $`bun run ./packages/opencode/src/index.ts generate > openapi.json`
|
||||
await $`stl builds create --branch dev --pull --allow-empty --+target go --+target typescript`
|
||||
await $`rm -rf packages/sdk`
|
||||
await $`mkdir -p packages/sdk`
|
||||
|
||||
await $`mv opencode-go/ packages/sdk/go`
|
||||
await $`rm -rf packages/sdk/go/.git`
|
||||
|
||||
await $`mv opencode-typescript/ packages/sdk/js`
|
||||
await $`rm -rf packages/sdk/js/.git`
|
||||
await $`rm -rf packages/sdk/js/yarn.lock`
|
||||
Reference in New Issue
Block a user