feat: v0.5.16 - migrate to Responses API (#586)
* refactor: migrate from /v1/runs to /v1/responses streaming API Replace EventSource-based polling with direct SSE streaming via the /v1/responses endpoint across all server-side callers (chat-run-socket, context-compressor, gateway-client, agent-clients). Messages are now written to DB in real-time during streaming, eliminating post-run sync. Frontend chat store adds tool_call_id tracking for deduplication. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> * chore: bump version to 0.5.16 and add changelog - Persist real API usage to usage table on response.completed - Remove unused codex_reasoning_items field from message schema - Fix unused variable warnings in chat-run-socket - Bump version to 0.5.16 - Add changelog entries for 0.5.16 (8 locales) Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -70,7 +70,6 @@ export const MESSAGES_SCHEMA: Record<string, string> = {
|
||||
reasoning: 'TEXT',
|
||||
reasoning_details: 'TEXT',
|
||||
reasoning_content: 'TEXT',
|
||||
codex_reasoning_items: 'TEXT',
|
||||
}
|
||||
|
||||
export const MESSAGES_INDEX = 'CREATE INDEX IF NOT EXISTS idx_messages_session_id ON messages(session_id)'
|
||||
|
||||
@@ -45,7 +45,6 @@ export interface HermesMessageRow {
|
||||
finish_reason: string | null
|
||||
reasoning: string | null
|
||||
reasoning_details?: string | null
|
||||
codex_reasoning_items?: string | null
|
||||
reasoning_content?: string | null
|
||||
}
|
||||
|
||||
@@ -121,7 +120,6 @@ function mapMessageRow(row: Record<string, unknown>): HermesMessageRow {
|
||||
finish_reason: row.finish_reason != null ? String(row.finish_reason) : null,
|
||||
reasoning: row.reasoning != null ? String(row.reasoning) : null,
|
||||
reasoning_details: row.reasoning_details != null ? String(row.reasoning_details) : null,
|
||||
codex_reasoning_items: row.codex_reasoning_items != null ? String(row.codex_reasoning_items) : null,
|
||||
reasoning_content: row.reasoning_content != null ? String(row.reasoning_content) : null,
|
||||
}
|
||||
}
|
||||
@@ -343,21 +341,20 @@ export function addMessage(msg: {
|
||||
reasoning?: string | null
|
||||
reasoning_details?: string | null
|
||||
reasoning_content?: string | null
|
||||
codex_reasoning_items?: string | null
|
||||
}): number | undefined {
|
||||
if (!isSqliteAvailable()) return undefined
|
||||
const db = getDb()!
|
||||
const toolCallsJson = msg.tool_calls ? JSON.stringify(msg.tool_calls) : null
|
||||
const result = db.prepare(
|
||||
`INSERT INTO ${MESSAGES_TABLE} (session_id, role, content, tool_call_id, tool_calls, tool_name, timestamp, token_count, finish_reason, reasoning, reasoning_details, reasoning_content, codex_reasoning_items)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,
|
||||
`INSERT INTO ${MESSAGES_TABLE} (session_id, role, content, tool_call_id, tool_calls, tool_name, timestamp, token_count, finish_reason, reasoning, reasoning_details, reasoning_content)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,
|
||||
).run(
|
||||
msg.session_id, msg.role, msg.content,
|
||||
msg.tool_call_id ?? null, toolCallsJson, msg.tool_name ?? null,
|
||||
msg.timestamp ?? Math.floor(Date.now() / 1000),
|
||||
msg.token_count ?? null, msg.finish_reason ?? null,
|
||||
msg.reasoning ?? null, msg.reasoning_details ?? null,
|
||||
msg.reasoning_content ?? null, msg.codex_reasoning_items ?? null,
|
||||
msg.reasoning_content ?? null,
|
||||
)
|
||||
return result.lastInsertRowid as number
|
||||
}
|
||||
@@ -375,13 +372,12 @@ export function addMessages(msgs: Array<{
|
||||
reasoning?: string | null
|
||||
reasoning_details?: string | null
|
||||
reasoning_content?: string | null
|
||||
codex_reasoning_items?: string | null
|
||||
}>): void {
|
||||
if (!isSqliteAvailable() || msgs.length === 0) return
|
||||
const db = getDb()!
|
||||
const insert = db.prepare(
|
||||
`INSERT INTO ${MESSAGES_TABLE} (session_id, role, content, tool_call_id, tool_calls, tool_name, timestamp, token_count, finish_reason, reasoning, reasoning_details, reasoning_content, codex_reasoning_items)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,
|
||||
`INSERT INTO ${MESSAGES_TABLE} (session_id, role, content, tool_call_id, tool_calls, tool_name, timestamp, token_count, finish_reason, reasoning, reasoning_details, reasoning_content)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,
|
||||
)
|
||||
db.exec('BEGIN')
|
||||
try {
|
||||
@@ -393,7 +389,7 @@ export function addMessages(msgs: Array<{
|
||||
msg.timestamp ?? Math.floor(Date.now() / 1000),
|
||||
msg.token_count ?? null, msg.finish_reason ?? null,
|
||||
msg.reasoning ?? null, msg.reasoning_details ?? null,
|
||||
msg.reasoning_content ?? null, msg.codex_reasoning_items ?? null,
|
||||
msg.reasoning_content ?? null,
|
||||
)
|
||||
}
|
||||
db.exec('COMMIT')
|
||||
|
||||
@@ -53,7 +53,6 @@ export interface HermesMessageRow {
|
||||
finish_reason: string | null
|
||||
reasoning: string | null
|
||||
reasoning_details?: string | null
|
||||
codex_reasoning_items?: string | null
|
||||
reasoning_content?: string | null
|
||||
}
|
||||
|
||||
@@ -350,7 +349,6 @@ function mapMessageRow(row: Record<string, unknown>): HermesMessageRow {
|
||||
finish_reason: normalizeNullableString(row.finish_reason),
|
||||
reasoning,
|
||||
reasoning_details: normalizeNullableString(row.reasoning_details),
|
||||
codex_reasoning_items: normalizeNullableString(row.codex_reasoning_items),
|
||||
reasoning_content: normalizeNullableString(row.reasoning_content),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user