sync
This commit is contained in:
parent
6357869e81
commit
22d92aa505
20 changed files with 126 additions and 964 deletions
2
.github/workflows/publish.yml
vendored
2
.github/workflows/publish.yml
vendored
|
|
@ -34,7 +34,7 @@ jobs:
|
||||||
|
|
||||||
- uses: oven-sh/setup-bun@v2
|
- uses: oven-sh/setup-bun@v2
|
||||||
with:
|
with:
|
||||||
bun-version: 1.2.17
|
bun-version: 1.2.19
|
||||||
|
|
||||||
- name: Install makepkg
|
- name: Install makepkg
|
||||||
run: |
|
run: |
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
"name": "opencode",
|
"name": "opencode",
|
||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"packageManager": "bun@1.2.14",
|
"packageManager": "bun@1.2.19",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "bun run packages/opencode/src/index.ts",
|
"dev": "bun run packages/opencode/src/index.ts",
|
||||||
"typecheck": "bun run --filter='*' typecheck",
|
"typecheck": "bun run --filter='*' typecheck",
|
||||||
|
|
|
||||||
|
|
@ -19,9 +19,9 @@
|
||||||
"@ai-sdk/anthropic": "1.2.12",
|
"@ai-sdk/anthropic": "1.2.12",
|
||||||
"@standard-schema/spec": "1.0.0",
|
"@standard-schema/spec": "1.0.0",
|
||||||
"@tsconfig/bun": "1.0.7",
|
"@tsconfig/bun": "1.0.7",
|
||||||
"@types/bun": "latest",
|
|
||||||
"@types/turndown": "5.0.5",
|
"@types/turndown": "5.0.5",
|
||||||
"@types/yargs": "17.0.33",
|
"@types/yargs": "17.0.33",
|
||||||
|
"@types/bun": "latest",
|
||||||
"typescript": "catalog:",
|
"typescript": "catalog:",
|
||||||
"vscode-languageserver-types": "3.17.5",
|
"vscode-languageserver-types": "3.17.5",
|
||||||
"zod-to-json-schema": "3.24.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",
|
"$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
|
configured_endpoints: 26
|
||||||
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/opencode%2Fopencode-335697785b44f3928145853339226bd5e8accd5199bb9d79e2a3fd2d8ce62a57.yml
|
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/opencode%2Fopencode-fb4caa8d0381531c44dd2d3c8c0b930b8c15a7bdde474d15bf7aeeb3b27aef56.yml
|
||||||
openapi_spec_hash: 74fbaad0fa44496d0d8b11d9b98eab03
|
openapi_spec_hash: 3a263e46f2369eeb2410430001c60d15
|
||||||
config_hash: 1ae82c93499b9f0b9ba828b8919f9cb3
|
config_hash: 1ae82c93499b9f0b9ba828b8919f9cb3
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,10 @@ Methods:
|
||||||
|
|
||||||
# App
|
# 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:
|
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>
|
- <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
|
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 {
|
type Mode struct {
|
||||||
Name string `json:"name,required"`
|
Name string `json:"name,required"`
|
||||||
Tools map[string]bool `json:"tools,required"`
|
Tools map[string]bool `json:"tools,required"`
|
||||||
|
|
@ -334,7 +352,7 @@ func (r appProvidersResponseJSON) RawJSON() string {
|
||||||
|
|
||||||
type AppLogParams struct {
|
type AppLogParams struct {
|
||||||
// Log level
|
// Log level
|
||||||
Level param.Field[AppLogParamsLevel] `json:"level,required"`
|
Level param.Field[LogLevel] `json:"level,required"`
|
||||||
// Log message
|
// Log message
|
||||||
Message param.Field[string] `json:"message,required"`
|
Message param.Field[string] `json:"message,required"`
|
||||||
// Service name for the log entry
|
// Service name for the log entry
|
||||||
|
|
@ -346,21 +364,3 @@ type AppLogParams struct {
|
||||||
func (r AppLogParams) MarshalJSON() (data []byte, err error) {
|
func (r AppLogParams) MarshalJSON() (data []byte, err error) {
|
||||||
return apijson.MarshalRoot(r)
|
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),
|
option.WithBaseURL(baseURL),
|
||||||
)
|
)
|
||||||
_, err := client.App.Log(context.TODO(), opencode.AppLogParams{
|
_, err := client.App.Log(context.TODO(), opencode.AppLogParams{
|
||||||
Level: opencode.F(opencode.AppLogParamsLevelDebug),
|
Level: opencode.F(opencode.LogLevelDebug),
|
||||||
Message: opencode.F("message"),
|
Message: opencode.F("message"),
|
||||||
Service: opencode.F("service"),
|
Service: opencode.F("service"),
|
||||||
Extra: opencode.F(map[string]interface{}{
|
Extra: opencode.F(map[string]interface{}{
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
configured_endpoints: 26
|
configured_endpoints: 26
|
||||||
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/opencode%2Fopencode-335697785b44f3928145853339226bd5e8accd5199bb9d79e2a3fd2d8ce62a57.yml
|
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/opencode%2Fopencode-fb4caa8d0381531c44dd2d3c8c0b930b8c15a7bdde474d15bf7aeeb3b27aef56.yml
|
||||||
openapi_spec_hash: 74fbaad0fa44496d0d8b11d9b98eab03
|
openapi_spec_hash: 3a263e46f2369eeb2410430001c60d15
|
||||||
config_hash: 1ae82c93499b9f0b9ba828b8919f9cb3
|
config_hash: 1ae82c93499b9f0b9ba828b8919f9cb3
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ Methods:
|
||||||
Types:
|
Types:
|
||||||
|
|
||||||
- <code><a href="./src/resources/app.ts">App</a></code>
|
- <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">Mode</a></code>
|
||||||
- <code><a href="./src/resources/app.ts">Model</a></code>
|
- <code><a href="./src/resources/app.ts">Model</a></code>
|
||||||
- <code><a href="./src/resources/app.ts">Provider</a></code>
|
- <code><a href="./src/resources/app.ts">Provider</a></code>
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@ import {
|
||||||
AppModesResponse,
|
AppModesResponse,
|
||||||
AppProvidersResponse,
|
AppProvidersResponse,
|
||||||
AppResource,
|
AppResource,
|
||||||
|
LogLevel,
|
||||||
Mode,
|
Mode,
|
||||||
Model,
|
Model,
|
||||||
Provider,
|
Provider,
|
||||||
|
|
@ -89,7 +90,7 @@ import { HeadersLike, NullableHeaders, buildHeaders } from './internal/headers';
|
||||||
import { FinalRequestOptions, RequestOptions } from './internal/request-options';
|
import { FinalRequestOptions, RequestOptions } from './internal/request-options';
|
||||||
import { readEnv } from './internal/utils/env';
|
import { readEnv } from './internal/utils/env';
|
||||||
import {
|
import {
|
||||||
type LogLevel,
|
type LogLevel as ClientLogLevel,
|
||||||
type Logger,
|
type Logger,
|
||||||
formatRequestDetails,
|
formatRequestDetails,
|
||||||
loggerFor,
|
loggerFor,
|
||||||
|
|
@ -157,7 +158,7 @@ export interface ClientOptions {
|
||||||
*
|
*
|
||||||
* Defaults to process.env['OPENCODE_LOG'] or 'warn' if it isn't set.
|
* Defaults to process.env['OPENCODE_LOG'] or 'warn' if it isn't set.
|
||||||
*/
|
*/
|
||||||
logLevel?: LogLevel | undefined;
|
logLevel?: ClientLogLevel | undefined;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the logger.
|
* Set the logger.
|
||||||
|
|
@ -175,7 +176,7 @@ export class Opencode {
|
||||||
maxRetries: number;
|
maxRetries: number;
|
||||||
timeout: number;
|
timeout: number;
|
||||||
logger: Logger | undefined;
|
logger: Logger | undefined;
|
||||||
logLevel: LogLevel | undefined;
|
logLevel: ClientLogLevel | undefined;
|
||||||
fetchOptions: MergedRequestInit | undefined;
|
fetchOptions: MergedRequestInit | undefined;
|
||||||
|
|
||||||
private fetch: Fetch;
|
private fetch: Fetch;
|
||||||
|
|
@ -777,6 +778,7 @@ export declare namespace Opencode {
|
||||||
export {
|
export {
|
||||||
AppResource as AppResource,
|
AppResource as AppResource,
|
||||||
type App as App,
|
type App as App,
|
||||||
|
type LogLevel as LogLevel,
|
||||||
type Mode as Mode,
|
type Mode as Mode,
|
||||||
type Model as Model,
|
type Model as Model,
|
||||||
type Provider as Provider,
|
type Provider as Provider,
|
||||||
|
|
|
||||||
|
|
@ -69,6 +69,11 @@ export namespace App {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Log level
|
||||||
|
*/
|
||||||
|
export type LogLevel = 'debug' | 'info' | 'error' | 'warn';
|
||||||
|
|
||||||
export interface Mode {
|
export interface Mode {
|
||||||
name: string;
|
name: string;
|
||||||
|
|
||||||
|
|
@ -157,7 +162,7 @@ export interface AppLogParams {
|
||||||
/**
|
/**
|
||||||
* Log level
|
* Log level
|
||||||
*/
|
*/
|
||||||
level: 'debug' | 'info' | 'error' | 'warn';
|
level: LogLevel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Log message
|
* Log message
|
||||||
|
|
@ -178,6 +183,7 @@ export interface AppLogParams {
|
||||||
export declare namespace AppResource {
|
export declare namespace AppResource {
|
||||||
export {
|
export {
|
||||||
type App as App,
|
type App as App,
|
||||||
|
type LogLevel as LogLevel,
|
||||||
type Mode as Mode,
|
type Mode as Mode,
|
||||||
type Model as Model,
|
type Model as Model,
|
||||||
type Provider as Provider,
|
type Provider as Provider,
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ export * from './shared';
|
||||||
export {
|
export {
|
||||||
AppResource,
|
AppResource,
|
||||||
type App,
|
type App,
|
||||||
|
type LogLevel,
|
||||||
type Mode,
|
type Mode,
|
||||||
type Model,
|
type Model,
|
||||||
type Provider,
|
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`
|
||||||
Loading…
Add table
Add a link
Reference in a new issue