refactor(llm): rename CallId to ToolCallId

This commit is contained in:
_Kerman
2026-08-21 16:10:24 +08:00
parent 8cf2445f11
commit a789637db6
186 changed files with 1013 additions and 1013 deletions
@@ -12,7 +12,7 @@ import {
resolveTargetPolicy,
} from '@deepseek-ai/dsh-compaction-basic/src/config.ts'
import type { CompactionResult } from '@deepseek-ai/dsh-compaction'
import LlmRuntime, { createUserMessage, CallId, CONTEXT_WINDOW_EXCEEDED_CODE, createToolResultMessage, LlmAdapter , createMessage } from '@deepseek-ai/dsh-llm'
import LlmRuntime, { createUserMessage, ToolCallId, CONTEXT_WINDOW_EXCEEDED_CODE, createToolResultMessage, LlmAdapter , createMessage } from '@deepseek-ai/dsh-llm'
import type {
ContentBlock,
GenerateOptions,
@@ -142,7 +142,7 @@ function conversation(turns = 4, text = 'fixture '.repeat(40).trim()): Session {
function toolConversation(): Session {
const session = Session.create(SessionId('tools'))
for (let turn = 1; turn <= 3; turn += 1) {
const callId = CallId(`call-${turn}`)
const callId = ToolCallId(`call-${turn}`)
session.append('turn/start', { turn })
session.append('user/message', createUserMessage({
content: [{ type: 'text', text: `request ${turn} `.repeat(300) }],
@@ -190,7 +190,7 @@ function toolConversation(): Session {
/** One closed routed tool step followed by an open turn for rewrite events. */
function oversizedToolResult(chars = 3_000, withCompactablePrompt = false): Session {
const session = Session.create(SessionId(`oversized-tool-${chars}`))
const callId = CallId('oversized')
const callId = ToolCallId('oversized')
session.append('turn/start', { turn: 1 })
if (withCompactablePrompt) {
session.append('user/message', createUserMessage({
@@ -568,7 +568,7 @@ describe('pressure measurement and retention', () => {
it('declines forced overflow when the whole surface is one indivisible tool pair', async () => {
const compact = service(compactConfig)
const session = Session.create(SessionId('single-tool-pair'))
const callId = CallId('single-call')
const callId = ToolCallId('single-call')
session.append('turn/start', { turn: 1 })
session.append('step/start', { turn: 1, step: 1 })
session.append('request/header', {
@@ -734,7 +734,7 @@ describe('pressure measurement and retention', () => {
it('declines when rounding a cut would consume the only tool pair', () => {
const ctx = createContext()
const session = Session.create(SessionId('one-tool-pair'))
const callId = CallId('only')
const callId = ToolCallId('only')
session.append('turn/start', { turn: 1 })
session.append('step/start', { turn: 1, step: 1 })
session.append('assistant/message', {
@@ -1183,7 +1183,7 @@ describe('default one-shot summarizer', () => {
const { adapter, compact } = await summarizerHarness([
{ type: 'reasoning', text: 'private' },
{ type: 'text', text: 'public summary' },
{ type: 'tool-call', id: CallId('unexpected'), name: 'x', arguments: '{}' },
{ type: 'tool-call', id: ToolCallId('unexpected'), name: 'x', arguments: '{}' },
], undefined, MODEL, {
auto: false,
summarizationProvider: MODEL,
@@ -1199,7 +1199,7 @@ describe('default one-shot summarizer', () => {
rawOutput: [
{ type: 'reasoning', text: 'private' },
{ type: 'text', text: 'public summary' },
{ type: 'tool-call', id: CallId('unexpected'), name: 'x', arguments: '{}' },
{ type: 'tool-call', id: ToolCallId('unexpected'), name: 'x', arguments: '{}' },
],
llmStreamCall: true,
provider: MODEL,
@@ -1417,7 +1417,7 @@ describe('default one-shot summarizer', () => {
it('rejects image summary output nested in a tool result', async () => {
const { compact } = await summarizerHarness([{
type: 'tool-result',
toolCallId: CallId('summary-tool'),
toolCallId: ToolCallId('summary-tool'),
content: [{
type: 'image',
attachment: {