summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--packages/opencode/src/util/schema.ts7
-rw-r--r--packages/opencode/test/util/instance-state.test.ts10
-rw-r--r--packages/sdk/js/src/v2/gen/types.gen.ts148
-rw-r--r--packages/sdk/openapi.json318
4 files changed, 244 insertions, 239 deletions
diff --git a/packages/opencode/src/util/schema.ts b/packages/opencode/src/util/schema.ts
index 944b7ffcb..6a88dba53 100644
--- a/packages/opencode/src/util/schema.ts
+++ b/packages/opencode/src/util/schema.ts
@@ -46,9 +46,8 @@ export function Newtype<Self>() {
Object.setPrototypeOf(Base, schema)
- return Base as unknown as
- & (abstract new (_: never) => Branded)
- & { readonly makeUnsafe: (value: Schema.Schema.Type<S>) => Self }
- & Omit<Schema.Opaque<Self, S, {}>, "makeUnsafe">
+ return Base as unknown as (abstract new (_: never) => Branded) & {
+ readonly makeUnsafe: (value: Schema.Schema.Type<S>) => Self
+ } & Omit<Schema.Opaque<Self, S, {}>, "makeUnsafe">
}
}
diff --git a/packages/opencode/test/util/instance-state.test.ts b/packages/opencode/test/util/instance-state.test.ts
index 19e051f38..29d0738c1 100644
--- a/packages/opencode/test/util/instance-state.test.ts
+++ b/packages/opencode/test/util/instance-state.test.ts
@@ -68,7 +68,10 @@ test("InstanceState is disposed on instance reload", async () => {
const state = yield* InstanceState.make(() =>
Effect.acquireRelease(
Effect.sync(() => ({ n: ++n })),
- (value) => Effect.sync(() => { seen.push(String(value.n)) }),
+ (value) =>
+ Effect.sync(() => {
+ seen.push(String(value.n))
+ }),
),
)
@@ -94,7 +97,10 @@ test("InstanceState is disposed on disposeAll", async () => {
const state = yield* InstanceState.make((dir) =>
Effect.acquireRelease(
Effect.sync(() => ({ dir })),
- (value) => Effect.sync(() => { seen.push(value.dir) }),
+ (value) =>
+ Effect.sync(() => {
+ seen.push(value.dir)
+ }),
),
)
diff --git a/packages/sdk/js/src/v2/gen/types.gen.ts b/packages/sdk/js/src/v2/gen/types.gen.ts
index 2629015eb..b2ee46670 100644
--- a/packages/sdk/js/src/v2/gen/types.gen.ts
+++ b/packages/sdk/js/src/v2/gen/types.gen.ts
@@ -54,6 +54,77 @@ export type EventServerInstanceDisposed = {
}
}
+export type QuestionOption = {
+ /**
+ * Display text (1-5 words, concise)
+ */
+ label: string
+ /**
+ * Explanation of choice
+ */
+ description: string
+}
+
+export type QuestionInfo = {
+ /**
+ * Complete question
+ */
+ question: string
+ /**
+ * Very short label (max 30 chars)
+ */
+ header: string
+ /**
+ * Available choices
+ */
+ options: Array<QuestionOption>
+ /**
+ * Allow selecting multiple choices
+ */
+ multiple?: boolean
+ /**
+ * Allow typing a custom answer (default: true)
+ */
+ custom?: boolean
+}
+
+export type QuestionRequest = {
+ id: string
+ sessionID: string
+ /**
+ * Questions to ask
+ */
+ questions: Array<QuestionInfo>
+ tool?: {
+ messageID: string
+ callID: string
+ }
+}
+
+export type EventQuestionAsked = {
+ type: "question.asked"
+ properties: QuestionRequest
+}
+
+export type QuestionAnswer = Array<string>
+
+export type EventQuestionReplied = {
+ type: "question.replied"
+ properties: {
+ sessionID: string
+ requestID: string
+ answers: Array<QuestionAnswer>
+ }
+}
+
+export type EventQuestionRejected = {
+ type: "question.rejected"
+ properties: {
+ sessionID: string
+ requestID: string
+ }
+}
+
export type EventServerConnected = {
type: "server.connected"
properties: {
@@ -607,77 +678,6 @@ export type EventSessionIdle = {
}
}
-export type QuestionOption = {
- /**
- * Display text (1-5 words, concise)
- */
- label: string
- /**
- * Explanation of choice
- */
- description: string
-}
-
-export type QuestionInfo = {
- /**
- * Complete question
- */
- question: string
- /**
- * Very short label (max 30 chars)
- */
- header: string
- /**
- * Available choices
- */
- options: Array<QuestionOption>
- /**
- * Allow selecting multiple choices
- */
- multiple?: boolean
- /**
- * Allow typing a custom answer (default: true)
- */
- custom?: boolean
-}
-
-export type QuestionRequest = {
- id: string
- sessionID: string
- /**
- * Questions to ask
- */
- questions: Array<QuestionInfo>
- tool?: {
- messageID: string
- callID: string
- }
-}
-
-export type EventQuestionAsked = {
- type: "question.asked"
- properties: QuestionRequest
-}
-
-export type QuestionAnswer = Array<string>
-
-export type EventQuestionReplied = {
- type: "question.replied"
- properties: {
- sessionID: string
- requestID: string
- answers: Array<QuestionAnswer>
- }
-}
-
-export type EventQuestionRejected = {
- type: "question.rejected"
- properties: {
- sessionID: string
- requestID: string
- }
-}
-
export type EventSessionCompacted = {
type: "session.compacted"
properties: {
@@ -962,6 +962,9 @@ export type Event =
| EventInstallationUpdateAvailable
| EventProjectUpdated
| EventServerInstanceDisposed
+ | EventQuestionAsked
+ | EventQuestionReplied
+ | EventQuestionRejected
| EventServerConnected
| EventGlobalDisposed
| EventLspClientDiagnostics
@@ -976,9 +979,6 @@ export type Event =
| EventPermissionReplied
| EventSessionStatus
| EventSessionIdle
- | EventQuestionAsked
- | EventQuestionReplied
- | EventQuestionRejected
| EventSessionCompacted
| EventFileWatcherUpdated
| EventTodoUpdated
diff --git a/packages/sdk/openapi.json b/packages/sdk/openapi.json
index e2a1eebb0..d79de78e7 100644
--- a/packages/sdk/openapi.json
+++ b/packages/sdk/openapi.json
@@ -7062,6 +7062,156 @@
},
"required": ["type", "properties"]
},
+ "QuestionOption": {
+ "type": "object",
+ "properties": {
+ "label": {
+ "description": "Display text (1-5 words, concise)",
+ "type": "string"
+ },
+ "description": {
+ "description": "Explanation of choice",
+ "type": "string"
+ }
+ },
+ "required": ["label", "description"]
+ },
+ "QuestionInfo": {
+ "type": "object",
+ "properties": {
+ "question": {
+ "description": "Complete question",
+ "type": "string"
+ },
+ "header": {
+ "description": "Very short label (max 30 chars)",
+ "type": "string"
+ },
+ "options": {
+ "description": "Available choices",
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/QuestionOption"
+ }
+ },
+ "multiple": {
+ "description": "Allow selecting multiple choices",
+ "type": "boolean"
+ },
+ "custom": {
+ "description": "Allow typing a custom answer (default: true)",
+ "type": "boolean"
+ }
+ },
+ "required": ["question", "header", "options"]
+ },
+ "QuestionRequest": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "string",
+ "pattern": "^que.*"
+ },
+ "sessionID": {
+ "type": "string",
+ "pattern": "^ses.*"
+ },
+ "questions": {
+ "description": "Questions to ask",
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/QuestionInfo"
+ }
+ },
+ "tool": {
+ "type": "object",
+ "properties": {
+ "messageID": {
+ "type": "string",
+ "pattern": "^msg.*"
+ },
+ "callID": {
+ "type": "string"
+ }
+ },
+ "required": ["messageID", "callID"]
+ }
+ },
+ "required": ["id", "sessionID", "questions"]
+ },
+ "Event.question.asked": {
+ "type": "object",
+ "properties": {
+ "type": {
+ "type": "string",
+ "const": "question.asked"
+ },
+ "properties": {
+ "$ref": "#/components/schemas/QuestionRequest"
+ }
+ },
+ "required": ["type", "properties"]
+ },
+ "QuestionAnswer": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "Event.question.replied": {
+ "type": "object",
+ "properties": {
+ "type": {
+ "type": "string",
+ "const": "question.replied"
+ },
+ "properties": {
+ "type": "object",
+ "properties": {
+ "sessionID": {
+ "type": "string",
+ "pattern": "^ses.*"
+ },
+ "requestID": {
+ "type": "string",
+ "pattern": "^que.*"
+ },
+ "answers": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/QuestionAnswer"
+ }
+ }
+ },
+ "required": ["sessionID", "requestID", "answers"]
+ }
+ },
+ "required": ["type", "properties"]
+ },
+ "Event.question.rejected": {
+ "type": "object",
+ "properties": {
+ "type": {
+ "type": "string",
+ "const": "question.rejected"
+ },
+ "properties": {
+ "type": "object",
+ "properties": {
+ "sessionID": {
+ "type": "string",
+ "pattern": "^ses.*"
+ },
+ "requestID": {
+ "type": "string",
+ "pattern": "^que.*"
+ }
+ },
+ "required": ["sessionID", "requestID"]
+ }
+ },
+ "required": ["type", "properties"]
+ },
"Event.server.connected": {
"type": "object",
"properties": {
@@ -8696,156 +8846,6 @@
},
"required": ["type", "properties"]
},
- "QuestionOption": {
- "type": "object",
- "properties": {
- "label": {
- "description": "Display text (1-5 words, concise)",
- "type": "string"
- },
- "description": {
- "description": "Explanation of choice",
- "type": "string"
- }
- },
- "required": ["label", "description"]
- },
- "QuestionInfo": {
- "type": "object",
- "properties": {
- "question": {
- "description": "Complete question",
- "type": "string"
- },
- "header": {
- "description": "Very short label (max 30 chars)",
- "type": "string"
- },
- "options": {
- "description": "Available choices",
- "type": "array",
- "items": {
- "$ref": "#/components/schemas/QuestionOption"
- }
- },
- "multiple": {
- "description": "Allow selecting multiple choices",
- "type": "boolean"
- },
- "custom": {
- "description": "Allow typing a custom answer (default: true)",
- "type": "boolean"
- }
- },
- "required": ["question", "header", "options"]
- },
- "QuestionRequest": {
- "type": "object",
- "properties": {
- "id": {
- "type": "string",
- "pattern": "^que.*"
- },
- "sessionID": {
- "type": "string",
- "pattern": "^ses.*"
- },
- "questions": {
- "description": "Questions to ask",
- "type": "array",
- "items": {
- "$ref": "#/components/schemas/QuestionInfo"
- }
- },
- "tool": {
- "type": "object",
- "properties": {
- "messageID": {
- "type": "string",
- "pattern": "^msg.*"
- },
- "callID": {
- "type": "string"
- }
- },
- "required": ["messageID", "callID"]
- }
- },
- "required": ["id", "sessionID", "questions"]
- },
- "Event.question.asked": {
- "type": "object",
- "properties": {
- "type": {
- "type": "string",
- "const": "question.asked"
- },
- "properties": {
- "$ref": "#/components/schemas/QuestionRequest"
- }
- },
- "required": ["type", "properties"]
- },
- "QuestionAnswer": {
- "type": "array",
- "items": {
- "type": "string"
- }
- },
- "Event.question.replied": {
- "type": "object",
- "properties": {
- "type": {
- "type": "string",
- "const": "question.replied"
- },
- "properties": {
- "type": "object",
- "properties": {
- "sessionID": {
- "type": "string",
- "pattern": "^ses.*"
- },
- "requestID": {
- "type": "string",
- "pattern": "^que.*"
- },
- "answers": {
- "type": "array",
- "items": {
- "$ref": "#/components/schemas/QuestionAnswer"
- }
- }
- },
- "required": ["sessionID", "requestID", "answers"]
- }
- },
- "required": ["type", "properties"]
- },
- "Event.question.rejected": {
- "type": "object",
- "properties": {
- "type": {
- "type": "string",
- "const": "question.rejected"
- },
- "properties": {
- "type": "object",
- "properties": {
- "sessionID": {
- "type": "string",
- "pattern": "^ses.*"
- },
- "requestID": {
- "type": "string",
- "pattern": "^que.*"
- }
- },
- "required": ["sessionID", "requestID"]
- }
- },
- "required": ["type", "properties"]
- },
"Event.session.compacted": {
"type": "object",
"properties": {
@@ -9612,6 +9612,15 @@
"$ref": "#/components/schemas/Event.server.instance.disposed"
},
{
+ "$ref": "#/components/schemas/Event.question.asked"
+ },
+ {
+ "$ref": "#/components/schemas/Event.question.replied"
+ },
+ {
+ "$ref": "#/components/schemas/Event.question.rejected"
+ },
+ {
"$ref": "#/components/schemas/Event.server.connected"
},
{
@@ -9654,15 +9663,6 @@
"$ref": "#/components/schemas/Event.session.idle"
},
{
- "$ref": "#/components/schemas/Event.question.asked"
- },
- {
- "$ref": "#/components/schemas/Event.question.replied"
- },
- {
- "$ref": "#/components/schemas/Event.question.rejected"
- },
- {
"$ref": "#/components/schemas/Event.session.compacted"
},
{