Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
a57c238
feature gpt-5-codex responses api
caozhiyuan Sep 26, 2025
87899a1
feat: enhance output type for function call and add content conversio…
caozhiyuan Sep 29, 2025
4fc0fa0
refactor: optimize content conversion logic in convertToolResultConte…
caozhiyuan Sep 29, 2025
2b9733b
refactor: remove unused function call output type and simplify respon…
caozhiyuan Sep 30, 2025
505f648
feat: add signature and reasoning handling to responses translation a…
caozhiyuan Sep 30, 2025
9477b45
feat: add signature to thinking messages and enhance reasoning struct…
caozhiyuan Sep 30, 2025
44551f9
refactor: remove summaryIndex from ResponsesStreamState and related h…
caozhiyuan Sep 30, 2025
708ae33
feat: enhance streaming response handling with ping mechanism
caozhiyuan Sep 30, 2025
47fb3e4
feat: responses translation add cache_read_input_tokens
caozhiyuan Oct 1, 2025
2800ed3
feat: enhance response event handling with event types and improved p…
caozhiyuan Oct 5, 2025
619d482
feat: improve event log and enhance reasoning content handling by add…
caozhiyuan Oct 7, 2025
5c6e4c6
1.fix claude code 2.0.28 warmup request consume premium request, forc…
caozhiyuan Oct 7, 2025
32cb10a
fix: the cluade code small model where max_tokens is only 512, which …
caozhiyuan Nov 3, 2025
9051a21
feat: add model reasoning efforts configuration and integrate into me…
caozhiyuan Nov 3, 2025
eeeb820
fix: ensure application directory is created when config file is missing
caozhiyuan Nov 3, 2025
3f69f13
feat: consola file logger for handler.ts
caozhiyuan Oct 29, 2025
4c0d775
fix: copolit function call returning infinite line breaks until max_t…
caozhiyuan Oct 30, 2025
1ec12db
feat: add verbose logging configuration to enhance log detail level
caozhiyuan Nov 3, 2025
174e868
fix: update verbose property to be required in State interface and ad…
caozhiyuan Nov 3, 2025
83cdfde
Merge remote-tracking branch 'remotes/origin/master' into feature/res…
caozhiyuan Nov 3, 2025
6f47926
fix: correct typo in warning message and refine whitespace handling l…
caozhiyuan Nov 6, 2025
01d4adb
fix: update token counting logic for GPT and Claude and Grok models, …
caozhiyuan Nov 10, 2025
3cdc32c
fix: extend whitespace handling in updateWhitespaceRunState to includ…
caozhiyuan Nov 19, 2025
f7835a4
Remove incompatible with copilot responses `service_tier` field (#45)
sr-tream Nov 22, 2025
318855e
feat(config): enhance model configuration with automatic defaults and…
caozhiyuan Dec 5, 2025
afb7a5c
feat(config): add useFunctionApplyPatch option and implement patch ha…
caozhiyuan Jan 10, 2026
ee5df50
fix: fix inconsistent credit consumption in chat , and adapter claude…
caozhiyuan Jan 12, 2026
f2b8476
fix: Merge tool_result and text blocks into tool_result to avoid cons…
caozhiyuan Jan 13, 2026
f3bef04
fix: improve merging of tool results and text blocks to optimize cont…
caozhiyuan Jan 16, 2026
736afa4
fix: sync stream IDs for @ai-sdk/openai compatibility with Responses API
cuipengfei Jan 17, 2026
4f22448
fix: sync stream IDs for @ai-sdk/openai compatibility with Responses…
cuipengfei Jan 19, 2026
bc205a6
fix: update mergeToolResultForClaude to handle opencode request
caozhiyuan Jan 20, 2026
6e93cfc
fix: add default thinking text for opencode compatibility in response…
caozhiyuan Jan 21, 2026
7e16a65
feat: support messages-api
caozhiyuan Jan 25, 2026
de424c1
feat: add compact model usage configuration and detection
caozhiyuan Jan 28, 2026
de08ef3
feat: filter valid thinking blocks for Claude models in Messages API
caozhiyuan Jan 28, 2026
3c12f58
feat: remove web_search tool in responses payload as it's not support…
caozhiyuan Jan 30, 2026
c2d0e6a
docs: improve configuration examples and Claude Code settings.json ex…
caozhiyuan Jan 31, 2026
f64c2c6
feat: update vscode and copilot versions, and refine anthropic-beta h…
caozhiyuan Feb 5, 2026
e2c437d
feat: opus4.6 thinking adaptive
caozhiyuan Feb 7, 2026
d0fb055
feat: enhance model capabilities with adaptive thinking support and u…
caozhiyuan Feb 7, 2026
7b3e739
fix(stream): send valid JSON in SSE ping events to prevent AI_JSONPar…
cuipengfei Feb 8, 2026
4bcbffb
feat: update vscode and copilot version
caozhiyuan Feb 11, 2026
fae8adc
feat(auth): implement API key authentication middleware and update RE…
caozhiyuan Feb 11, 2026
5c146ac
feat: enhance response translation with assistant phase handling
caozhiyuan Feb 11, 2026
0eb8e7f
feat: update fallback version for VSCode and increment Copilot version
caozhiyuan Feb 15, 2026
5b488b2
feat: implement subagent marker integration and update related handlers
caozhiyuan Feb 16, 2026
88a2e42
fix: correct search continuation logic in parseSubagentMarkerFromSyst…
caozhiyuan Feb 16, 2026
383ab1e
feat: implement claude-plugin for SubagentStart marker injection and …
caozhiyuan Feb 26, 2026
b2dbf9d
feat: enhance anthropic beta header handling in createMessages function
caozhiyuan Mar 5, 2026
47764aa
feat: enhance phase handling in responses translation
caozhiyuan Mar 5, 2026
c9686a2
feat: add context management and compaction features to responses API
caozhiyuan Mar 6, 2026
e69e6a8
feat: align with the request headers in the copilot extension version…
caozhiyuan Mar 8, 2026
8374c20
feat: enhance adaptive thinking handling in messages API to prevent e…
caozhiyuan Mar 11, 2026
ca803ba
feat: implement opencode OAuth handling
caozhiyuan Mar 12, 2026
ca2c7f9
feat: trim oauth env var and update docs
caozhiyuan Mar 12, 2026
47eb502
feat: implement findEndpointModel function to enhance claude model ma…
caozhiyuan Mar 14, 2026
75de2a3
fix: update subagent marker ID prefix for opencode 1.2.26 compatibility
caozhiyuan Mar 14, 2026
24c0867
feat: add useMessagesApi toggle to fallback to /chat/completions on h…
caozhiyuan Mar 15, 2026
090c617
feat: update getUUID function to generate standards-compliant UUIDv4 …
caozhiyuan Mar 15, 2026
97b11b2
feat: ensure that compaction message is tracked as agent initiated, c…
caozhiyuan Mar 18, 2026
dc4c62a
feat: enhance user ID parsing with JSON support and legacy fallback
caozhiyuan Mar 20, 2026
a649843
fix: update GitHub Enterprise API URL format
caozhiyuan Mar 21, 2026
ce8224c
fix: strip cache_control from payload before sending to Copilot Messa…
caozhiyuan Mar 31, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat(config): add useFunctionApplyPatch option and implement patch ha…
…ndling in responses
  • Loading branch information
caozhiyuan committed Jan 10, 2026
commit afb7a5c77bdd8a04e57f1c8d210a8659cd28b1f8
2 changes: 2 additions & 0 deletions src/lib/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export interface AppConfig {
string,
"none" | "minimal" | "low" | "medium" | "high" | "xhigh"
>
useFunctionApplyPatch?: boolean
}

const gpt5ExplorationPrompt = `## Exploration and reading files
Expand All @@ -28,6 +29,7 @@ const defaultConfig: AppConfig = {
modelReasoningEfforts: {
"gpt-5-mini": "low",
},
useFunctionApplyPatch: true,
}

let cachedConfig: AppConfig | null = null
Expand Down
35 changes: 35 additions & 0 deletions src/routes/responses/handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import type { Context } from "hono"
import { streamSSE } from "hono/streaming"

import { awaitApproval } from "~/lib/approval"
import { getConfig } from "~/lib/config"
import { createHandlerLogger } from "~/lib/logger"
import { checkRateLimit } from "~/lib/rate-limit"
import { state } from "~/lib/state"
Expand All @@ -24,6 +25,8 @@ export const handleResponses = async (c: Context) => {
const payload = await c.req.json<ResponsesPayload>()
logger.debug("Responses request payload:", JSON.stringify(payload))

useFunctionApplyPatch(payload)

const selectedModel = state.models?.data.find(
(model) => model.id === payload.model,
)
Expand Down Expand Up @@ -78,3 +81,35 @@ const isAsyncIterable = <T>(value: unknown): value is AsyncIterable<T> =>

const isStreamingRequested = (payload: ResponsesPayload): boolean =>
Boolean(payload.stream)

const useFunctionApplyPatch = (payload: ResponsesPayload): void => {
const config = getConfig()
const useFunctionApplyPatch = config.useFunctionApplyPatch ?? true
if (useFunctionApplyPatch) {
logger.debug("Using function tool apply_patch for responses")
if (Array.isArray(payload.tools)) {
const toolsArr = payload.tools
for (let i = 0; i < toolsArr.length; i++) {
const t = toolsArr[i]
if (t.type === "custom" && t.name === "apply_patch") {
toolsArr[i] = {
type: "function",
name: t.name,
description: "Use the `apply_patch` tool to edit files",
parameters: {
type: "object",
properties: {
input: {
type: "string",
description: "The entire contents of the apply_patch command",
},
},
required: ["input"],
},
strict: false,
}
}
}
}
}
}
2 changes: 1 addition & 1 deletion src/services/copilot/create-responses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export interface ToolChoiceFunction {
type: "function"
}

export type Tool = FunctionTool
export type Tool = FunctionTool | Record<string, unknown>

export interface FunctionTool {
name: string
Expand Down