mirror of
https://github.com/anomalyco/opencode.git
synced 2026-04-09 23:44:52 +00:00
Compare commits
1 Commits
beta
...
brendan/no
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
407825bdad |
3
bun.lock
3
bun.lock
@@ -439,6 +439,7 @@
|
||||
"@typescript/native-preview": "catalog:",
|
||||
"drizzle-kit": "catalog:",
|
||||
"drizzle-orm": "catalog:",
|
||||
"openapi-types": "12.1.3",
|
||||
"typescript": "catalog:",
|
||||
"vscode-languageserver-types": "3.17.5",
|
||||
"why-is-node-running": "3.2.2",
|
||||
@@ -632,8 +633,10 @@
|
||||
"tree-sitter-bash",
|
||||
],
|
||||
"patchedDependencies": {
|
||||
"ai@6.0.149": "patches/ai@6.0.149.patch",
|
||||
"solid-js@1.9.10": "patches/solid-js@1.9.10.patch",
|
||||
"@standard-community/standard-openapi@0.2.9": "patches/@standard-community%2Fstandard-openapi@0.2.9.patch",
|
||||
"hono-openapi@1.1.2": "patches/hono-openapi@1.1.2.patch",
|
||||
},
|
||||
"overrides": {
|
||||
"@types/bun": "catalog:",
|
||||
|
||||
@@ -120,6 +120,8 @@
|
||||
},
|
||||
"patchedDependencies": {
|
||||
"@standard-community/standard-openapi@0.2.9": "patches/@standard-community%2Fstandard-openapi@0.2.9.patch",
|
||||
"solid-js@1.9.10": "patches/solid-js@1.9.10.patch"
|
||||
"solid-js@1.9.10": "patches/solid-js@1.9.10.patch",
|
||||
"hono-openapi@1.1.2": "patches/hono-openapi@1.1.2.patch",
|
||||
"ai@6.0.149": "patches/ai@6.0.149.patch"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,12 +33,10 @@ export function setWslConfig(config: WslConfig) {
|
||||
export async function spawnLocalServer(hostname: string, port: number, password: string) {
|
||||
prepareServerEnv(password)
|
||||
const { Log, Server } = await import("virtual:opencode-server")
|
||||
await Log.init({ level: "WARN" })
|
||||
await Log.init({ level: "WARN", print: true })
|
||||
const listener = await Server.listen({
|
||||
port,
|
||||
hostname,
|
||||
username: "opencode",
|
||||
password,
|
||||
})
|
||||
|
||||
const wait = (async () => {
|
||||
|
||||
3
packages/opencode/.gitignore
vendored
3
packages/opencode/.gitignore
vendored
@@ -2,5 +2,4 @@ research
|
||||
dist
|
||||
gen
|
||||
app.log
|
||||
src/provider/models-snapshot.js
|
||||
src/provider/models-snapshot.d.ts
|
||||
src/provider/models-snapshot.ts
|
||||
|
||||
@@ -69,6 +69,7 @@
|
||||
"@typescript/native-preview": "catalog:",
|
||||
"drizzle-kit": "catalog:",
|
||||
"drizzle-orm": "catalog:",
|
||||
"openapi-types": "12.1.3",
|
||||
"typescript": "catalog:",
|
||||
"vscode-languageserver-types": "3.17.5",
|
||||
"why-is-node-running": "3.2.2",
|
||||
|
||||
@@ -21,12 +21,8 @@ const modelsData = process.env.MODELS_DEV_API_JSON
|
||||
? await Bun.file(process.env.MODELS_DEV_API_JSON).text()
|
||||
: await fetch(`${modelsUrl}/api.json`).then((x) => x.text())
|
||||
await Bun.write(
|
||||
path.join(dir, "src/provider/models-snapshot.js"),
|
||||
`// @ts-nocheck\n// Auto-generated by build.ts - do not edit\nexport const snapshot = ${modelsData}\n`,
|
||||
)
|
||||
await Bun.write(
|
||||
path.join(dir, "src/provider/models-snapshot.d.ts"),
|
||||
`// Auto-generated by build.ts - do not edit\nexport declare const snapshot: Record<string, unknown>\n`,
|
||||
path.join(dir, "src/provider/models-snapshot.ts"),
|
||||
`// Auto-generated by build.ts - do not edit\nexport const snapshot = ${modelsData} as Record<string, unknown>\n`,
|
||||
)
|
||||
console.log("Generated models-snapshot.js")
|
||||
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
// Auto-generated by build.ts - do not edit
|
||||
export declare const snapshot: Record<string, unknown>
|
||||
File diff suppressed because it is too large
Load Diff
2
packages/opencode/src/provider/models-snapshot.ts
Normal file
2
packages/opencode/src/provider/models-snapshot.ts
Normal file
File diff suppressed because one or more lines are too long
@@ -1,5 +1,6 @@
|
||||
import { resolver } from "hono-openapi"
|
||||
import z from "zod"
|
||||
import "openapi-types"
|
||||
import { NotFoundError } from "../storage/db"
|
||||
|
||||
export const ERRORS = {
|
||||
|
||||
@@ -192,7 +192,9 @@ export const ExperimentalRoutes = lazy(() =>
|
||||
id: t.id,
|
||||
description: t.description,
|
||||
// Handle both Zod schemas and plain JSON schemas
|
||||
parameters: (t.parameters as any)?._def ? zodToJsonSchema(t.parameters as any) : t.parameters,
|
||||
parameters: (t.parameters as any)?._def
|
||||
? (zodToJsonSchema(t.parameters as any) as any)
|
||||
: (t.parameters as any),
|
||||
})),
|
||||
)
|
||||
},
|
||||
@@ -350,7 +352,7 @@ export const ExperimentalRoutes = lazy(() =>
|
||||
const hasMore = sessions.length > limit
|
||||
const list = hasMore ? sessions.slice(0, limit) : sessions
|
||||
if (hasMore && list.length > 0) {
|
||||
c.header("x-next-cursor", String(list[list.length - 1].time.updated))
|
||||
c.header("x-next-cursor", String(list[list.length - 1]!.time.updated))
|
||||
}
|
||||
return c.json(list)
|
||||
},
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { Provider } from "@/provider/provider"
|
||||
import { Log } from "@/util/log"
|
||||
import { Cause, Effect, Layer, Record, ServiceMap } from "effect"
|
||||
import * as Queue from "effect/Queue"
|
||||
import { Effect, Layer, Record, ServiceMap } from "effect"
|
||||
import * as Stream from "effect/Stream"
|
||||
import { streamText, wrapLanguageModel, type ModelMessage, type Tool, tool, jsonSchema } from "ai"
|
||||
import { mergeDeep, pipe } from "remeda"
|
||||
|
||||
@@ -7,7 +7,7 @@ import { Truncate } from "./truncate"
|
||||
import { Agent } from "@/agent/agent"
|
||||
|
||||
export namespace Tool {
|
||||
interface Metadata {
|
||||
export interface Metadata {
|
||||
[key: string]: any
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ export const withStatics =
|
||||
Object.assign(schema, methods(schema))
|
||||
|
||||
declare const NewtypeBrand: unique symbol
|
||||
type NewtypeBrand<Tag extends string> = { readonly [NewtypeBrand]: Tag }
|
||||
export type NewtypeBrand<Tag extends string> = { readonly [NewtypeBrand]: Tag }
|
||||
|
||||
/**
|
||||
* Nominal wrapper for scalar types. The class itself is a valid schema —
|
||||
|
||||
@@ -18,6 +18,12 @@
|
||||
"transform": "@effect/language-service/transform",
|
||||
"namespaceImportPackages": ["effect", "@effect/*"]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"outDir": "dist/types",
|
||||
"rootDir": ".",
|
||||
"noEmit": false,
|
||||
"declaration": true,
|
||||
"emitDeclarationOnly": true
|
||||
},
|
||||
"include": ["src"]
|
||||
}
|
||||
|
||||
64
patches/ai@6.0.149.patch
Normal file
64
patches/ai@6.0.149.patch
Normal file
@@ -0,0 +1,64 @@
|
||||
diff --git a/dist/index.d.mts b/dist/index.d.mts
|
||||
index e339fe99f4d3705e8ca94f1ce9cb7444dc6ed3ed..881296755bb2ccee116b118f4d35fc0a2de11d72 100644
|
||||
--- a/dist/index.d.mts
|
||||
+++ b/dist/index.d.mts
|
||||
@@ -1,15 +1,15 @@
|
||||
import { GatewayModelId } from '@ai-sdk/gateway';
|
||||
-export { GatewayModelId, createGateway, gateway } from '@ai-sdk/gateway';
|
||||
import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
|
||||
import { Tool, InferToolInput, InferToolOutput, FlexibleSchema, InferSchema, SystemModelMessage, ModelMessage, AssistantModelMessage, ToolModelMessage, ReasoningPart, ProviderOptions, UserModelMessage, IdGenerator, ToolCall, MaybePromiseLike, TextPart, FilePart, Resolvable, FetchFunction, DataContent } from '@ai-sdk/provider-utils';
|
||||
-export { AssistantContent, AssistantModelMessage, DataContent, DownloadError, FilePart, FlexibleSchema, IdGenerator, ImagePart, InferSchema, InferToolInput, InferToolOutput, ModelMessage, Schema, SystemModelMessage, TextPart, Tool, ToolApprovalRequest, ToolApprovalResponse, ToolCallOptions, ToolCallPart, ToolContent, ToolExecuteFunction, ToolExecutionOptions, ToolModelMessage, ToolResultPart, UserContent, UserModelMessage, asSchema, createIdGenerator, dynamicTool, generateId, jsonSchema, parseJsonEventStream, tool, zodSchema } from '@ai-sdk/provider-utils';
|
||||
import * as _ai_sdk_provider from '@ai-sdk/provider';
|
||||
import { EmbeddingModelV3, EmbeddingModelV2, EmbeddingModelV3Embedding, EmbeddingModelV3Middleware, ImageModelV3, ImageModelV2, ImageModelV3ProviderMetadata, ImageModelV2ProviderMetadata, ImageModelV3Middleware, JSONValue as JSONValue$1, LanguageModelV3, LanguageModelV2, SharedV3Warning, LanguageModelV3Source, LanguageModelV3Middleware, RerankingModelV3, SharedV3ProviderMetadata, SpeechModelV3, SpeechModelV2, TranscriptionModelV3, TranscriptionModelV2, JSONObject, ImageModelV3Usage, LanguageModelV3ToolChoice, AISDKError, LanguageModelV3ToolCall, JSONSchema7, LanguageModelV3CallOptions, JSONParseError, TypeValidationError, Experimental_VideoModelV3, EmbeddingModelV3CallOptions, ProviderV3, ProviderV2, NoSuchModelError } from '@ai-sdk/provider';
|
||||
-export { AISDKError, APICallError, EmptyResponseBodyError, InvalidPromptError, InvalidResponseDataError, JSONParseError, JSONSchema7, LoadAPIKeyError, LoadSettingError, NoContentGeneratedError, NoSuchModelError, TooManyEmbeddingValuesForCallError, TypeValidationError, UnsupportedFunctionalityError } from '@ai-sdk/provider';
|
||||
import { AttributeValue, Tracer } from '@opentelemetry/api';
|
||||
import { ServerResponse } from 'node:http';
|
||||
import { ServerResponse as ServerResponse$1 } from 'http';
|
||||
import { z } from 'zod/v4';
|
||||
+export { GatewayModelId, createGateway, gateway } from '@ai-sdk/gateway';
|
||||
+export { AssistantContent, AssistantModelMessage, DataContent, DownloadError, FilePart, FlexibleSchema, IdGenerator, ImagePart, InferSchema, InferToolInput, InferToolOutput, ModelMessage, Schema, SystemModelMessage, TextPart, Tool, ToolApprovalRequest, ToolApprovalResponse, ToolCallOptions, ToolCallPart, ToolContent, ToolExecuteFunction, ToolExecutionOptions, ToolModelMessage, ToolResultPart, UserContent, UserModelMessage, asSchema, createIdGenerator, dynamicTool, generateId, jsonSchema, parseJsonEventStream, tool, zodSchema } from '@ai-sdk/provider-utils';
|
||||
+export { AISDKError, APICallError, EmptyResponseBodyError, InvalidPromptError, InvalidResponseDataError, JSONParseError, JSONSchema7, LoadAPIKeyError, LoadSettingError, NoContentGeneratedError, NoSuchModelError, TooManyEmbeddingValuesForCallError, TypeValidationError, UnsupportedFunctionalityError } from '@ai-sdk/provider';
|
||||
|
||||
/**
|
||||
* Embedding model that is used by the AI SDK.
|
||||
@@ -2970,7 +2970,7 @@ type EnrichedStreamPart<TOOLS extends ToolSet, PARTIAL_OUTPUT> = {
|
||||
partialOutput: PARTIAL_OUTPUT | undefined;
|
||||
};
|
||||
|
||||
-interface Output<OUTPUT = any, PARTIAL = any, ELEMENT = any> {
|
||||
+export interface Output<OUTPUT = any, PARTIAL = any, ELEMENT = any> {
|
||||
/**
|
||||
* The name of the output mode.
|
||||
*/
|
||||
diff --git a/dist/index.d.ts b/dist/index.d.ts
|
||||
index e339fe99f4d3705e8ca94f1ce9cb7444dc6ed3ed..881296755bb2ccee116b118f4d35fc0a2de11d72 100644
|
||||
--- a/dist/index.d.ts
|
||||
+++ b/dist/index.d.ts
|
||||
@@ -1,15 +1,15 @@
|
||||
import { GatewayModelId } from '@ai-sdk/gateway';
|
||||
-export { GatewayModelId, createGateway, gateway } from '@ai-sdk/gateway';
|
||||
import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
|
||||
import { Tool, InferToolInput, InferToolOutput, FlexibleSchema, InferSchema, SystemModelMessage, ModelMessage, AssistantModelMessage, ToolModelMessage, ReasoningPart, ProviderOptions, UserModelMessage, IdGenerator, ToolCall, MaybePromiseLike, TextPart, FilePart, Resolvable, FetchFunction, DataContent } from '@ai-sdk/provider-utils';
|
||||
-export { AssistantContent, AssistantModelMessage, DataContent, DownloadError, FilePart, FlexibleSchema, IdGenerator, ImagePart, InferSchema, InferToolInput, InferToolOutput, ModelMessage, Schema, SystemModelMessage, TextPart, Tool, ToolApprovalRequest, ToolApprovalResponse, ToolCallOptions, ToolCallPart, ToolContent, ToolExecuteFunction, ToolExecutionOptions, ToolModelMessage, ToolResultPart, UserContent, UserModelMessage, asSchema, createIdGenerator, dynamicTool, generateId, jsonSchema, parseJsonEventStream, tool, zodSchema } from '@ai-sdk/provider-utils';
|
||||
import * as _ai_sdk_provider from '@ai-sdk/provider';
|
||||
import { EmbeddingModelV3, EmbeddingModelV2, EmbeddingModelV3Embedding, EmbeddingModelV3Middleware, ImageModelV3, ImageModelV2, ImageModelV3ProviderMetadata, ImageModelV2ProviderMetadata, ImageModelV3Middleware, JSONValue as JSONValue$1, LanguageModelV3, LanguageModelV2, SharedV3Warning, LanguageModelV3Source, LanguageModelV3Middleware, RerankingModelV3, SharedV3ProviderMetadata, SpeechModelV3, SpeechModelV2, TranscriptionModelV3, TranscriptionModelV2, JSONObject, ImageModelV3Usage, LanguageModelV3ToolChoice, AISDKError, LanguageModelV3ToolCall, JSONSchema7, LanguageModelV3CallOptions, JSONParseError, TypeValidationError, Experimental_VideoModelV3, EmbeddingModelV3CallOptions, ProviderV3, ProviderV2, NoSuchModelError } from '@ai-sdk/provider';
|
||||
-export { AISDKError, APICallError, EmptyResponseBodyError, InvalidPromptError, InvalidResponseDataError, JSONParseError, JSONSchema7, LoadAPIKeyError, LoadSettingError, NoContentGeneratedError, NoSuchModelError, TooManyEmbeddingValuesForCallError, TypeValidationError, UnsupportedFunctionalityError } from '@ai-sdk/provider';
|
||||
import { AttributeValue, Tracer } from '@opentelemetry/api';
|
||||
import { ServerResponse } from 'node:http';
|
||||
import { ServerResponse as ServerResponse$1 } from 'http';
|
||||
import { z } from 'zod/v4';
|
||||
+export { GatewayModelId, createGateway, gateway } from '@ai-sdk/gateway';
|
||||
+export { AssistantContent, AssistantModelMessage, DataContent, DownloadError, FilePart, FlexibleSchema, IdGenerator, ImagePart, InferSchema, InferToolInput, InferToolOutput, ModelMessage, Schema, SystemModelMessage, TextPart, Tool, ToolApprovalRequest, ToolApprovalResponse, ToolCallOptions, ToolCallPart, ToolContent, ToolExecuteFunction, ToolExecutionOptions, ToolModelMessage, ToolResultPart, UserContent, UserModelMessage, asSchema, createIdGenerator, dynamicTool, generateId, jsonSchema, parseJsonEventStream, tool, zodSchema } from '@ai-sdk/provider-utils';
|
||||
+export { AISDKError, APICallError, EmptyResponseBodyError, InvalidPromptError, InvalidResponseDataError, JSONParseError, JSONSchema7, LoadAPIKeyError, LoadSettingError, NoContentGeneratedError, NoSuchModelError, TooManyEmbeddingValuesForCallError, TypeValidationError, UnsupportedFunctionalityError } from '@ai-sdk/provider';
|
||||
|
||||
/**
|
||||
* Embedding model that is used by the AI SDK.
|
||||
@@ -2970,7 +2970,7 @@ type EnrichedStreamPart<TOOLS extends ToolSet, PARTIAL_OUTPUT> = {
|
||||
partialOutput: PARTIAL_OUTPUT | undefined;
|
||||
};
|
||||
|
||||
-interface Output<OUTPUT = any, PARTIAL = any, ELEMENT = any> {
|
||||
+export interface Output<OUTPUT = any, PARTIAL = any, ELEMENT = any> {
|
||||
/**
|
||||
* The name of the output mode.
|
||||
*/
|
||||
36
patches/hono-openapi@1.1.2.patch
Normal file
36
patches/hono-openapi@1.1.2.patch
Normal file
@@ -0,0 +1,36 @@
|
||||
diff --git a/dist/index.d.cts b/dist/index.d.cts
|
||||
index 0f49b720b0b8c827fef52a2982fb194e98bc0c50..bb34d041de0d5190c1e932ada4557806887ebc95 100644
|
||||
--- a/dist/index.d.cts
|
||||
+++ b/dist/index.d.cts
|
||||
@@ -9,11 +9,11 @@ import { StatusCode } from 'hono/utils/http-status';
|
||||
import { JSONSchema7 } from 'json-schema';
|
||||
|
||||
/** The Standard Schema interface. */
|
||||
-interface StandardSchemaV1<Input = unknown, Output = Input> {
|
||||
+export interface StandardSchemaV1<Input = unknown, Output = Input> {
|
||||
/** The Standard Schema properties. */
|
||||
readonly "~standard": StandardSchemaV1.Props<Input, Output>;
|
||||
}
|
||||
-declare namespace StandardSchemaV1 {
|
||||
+export declare namespace StandardSchemaV1 {
|
||||
/** The Standard Schema properties interface. */
|
||||
export interface Props<Input = unknown, Output = Input> {
|
||||
/** The version number of the standard. */
|
||||
diff --git a/dist/index.d.ts b/dist/index.d.ts
|
||||
index 0f49b720b0b8c827fef52a2982fb194e98bc0c50..bb34d041de0d5190c1e932ada4557806887ebc95 100644
|
||||
--- a/dist/index.d.ts
|
||||
+++ b/dist/index.d.ts
|
||||
@@ -9,11 +9,11 @@ import { StatusCode } from 'hono/utils/http-status';
|
||||
import { JSONSchema7 } from 'json-schema';
|
||||
|
||||
/** The Standard Schema interface. */
|
||||
-interface StandardSchemaV1<Input = unknown, Output = Input> {
|
||||
+export interface StandardSchemaV1<Input = unknown, Output = Input> {
|
||||
/** The Standard Schema properties. */
|
||||
readonly "~standard": StandardSchemaV1.Props<Input, Output>;
|
||||
}
|
||||
-declare namespace StandardSchemaV1 {
|
||||
+export declare namespace StandardSchemaV1 {
|
||||
/** The Standard Schema properties interface. */
|
||||
export interface Props<Input = unknown, Output = Input> {
|
||||
/** The version number of the standard. */
|
||||
Reference in New Issue
Block a user