mirror of
https://github.com/deepseek-ai/deepseek-harness.git
synced 2026-08-29 04:26:38 +00:00
fix(tests): complete ToolCallId rename
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { CallId, createUserMessage } from '@deepseek-ai/dsh-llm'
|
||||
import { createUserMessage, ToolCallId } from '@deepseek-ai/dsh-llm'
|
||||
/**
|
||||
* Tests for the queue-aware `Agent.cancel()` primitive. The default clears
|
||||
* queued and steering work, while `keepInbox` preserves pending input for a
|
||||
@@ -543,7 +543,7 @@ describe('Agent.cancel()', () => {
|
||||
{ type: 'text-delta', index: 0, text: 'reading the file' },
|
||||
{ type: 'block-end', index: 0, block: { type: 'text', text: 'reading the file' } },
|
||||
{ type: 'block-start', index: 1, blockType: 'tool-call' },
|
||||
{ type: 'tool-call-delta', index: 1, id: CallId('c1'), name: 'read', argumentsDelta: '{"pa' },
|
||||
{ type: 'tool-call-delta', index: 1, id: ToolCallId('c1'), name: 'read', argumentsDelta: '{"pa' },
|
||||
],
|
||||
}])
|
||||
const ctx = await harness(adapter)
|
||||
@@ -620,7 +620,7 @@ describe('Agent.cancel()', () => {
|
||||
const adapter = new MockAdapter([{
|
||||
hangAfter: [
|
||||
{ type: 'block-start', index: 0, blockType: 'tool-call' },
|
||||
{ type: 'tool-call-delta', index: 0, id: CallId('c1'), name: 'read', argumentsDelta: '{"pa' },
|
||||
{ type: 'tool-call-delta', index: 0, id: ToolCallId('c1'), name: 'read', argumentsDelta: '{"pa' },
|
||||
],
|
||||
}])
|
||||
const ctx = await harness(adapter)
|
||||
|
||||
@@ -245,10 +245,10 @@ describe('BlockAssembler.interruptedBlocks', () => {
|
||||
assembler.push({ type: 'text-delta', index: 0, text: 'calling' })
|
||||
assembler.push({ type: 'block-end', index: 0, block: { type: 'text', text: 'calling' } })
|
||||
assembler.push({ type: 'block-start', index: 1, blockType: 'tool-call' })
|
||||
assembler.push({ type: 'tool-call-delta', index: 1, id: CallId('c1'), name: 'read', argumentsDelta: '{"a":1}' })
|
||||
assembler.push({ type: 'block-end', index: 1, block: { type: 'tool-call', id: CallId('c1'), name: 'read', arguments: '{"a":1}' } })
|
||||
assembler.push({ type: 'tool-call-delta', index: 1, id: ToolCallId('c1'), name: 'read', argumentsDelta: '{"a":1}' })
|
||||
assembler.push({ type: 'block-end', index: 1, block: { type: 'tool-call', id: ToolCallId('c1'), name: 'read', arguments: '{"a":1}' } })
|
||||
assembler.push({ type: 'block-start', index: 2, blockType: 'tool-call' })
|
||||
assembler.push({ type: 'tool-call-delta', index: 2, id: CallId('c2'), name: 'read', argumentsDelta: '{"pa' })
|
||||
assembler.push({ type: 'tool-call-delta', index: 2, id: ToolCallId('c2'), name: 'read', argumentsDelta: '{"pa' })
|
||||
expect(assembler.interruptedBlocks()).toEqual([{ type: 'text', text: 'calling' }])
|
||||
})
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { AttachmentId } from '@deepseek-ai/dsh-attachment'
|
||||
import { CallId, createUserMessage, OFFLOADED_IMAGE_TEXT, offloadRequestImages } from '../src/index.ts'
|
||||
import { createUserMessage, OFFLOADED_IMAGE_TEXT, offloadRequestImages, ToolCallId } from '../src/index.ts'
|
||||
import type { ContentBlock } from '../src/index.ts'
|
||||
|
||||
const source = { kind: 'plugin' as const, plugin: 'test' }
|
||||
@@ -49,7 +49,7 @@ describe('offloadRequestImages', () => {
|
||||
createUserMessage({
|
||||
content: [{
|
||||
type: 'tool-result',
|
||||
toolCallId: CallId('shot'),
|
||||
toolCallId: ToolCallId('shot'),
|
||||
content: [shared],
|
||||
}],
|
||||
source,
|
||||
@@ -61,7 +61,7 @@ describe('offloadRequestImages', () => {
|
||||
expect(fitted).not.toBe(messages)
|
||||
expect(fitted[0]?.content).toEqual([{
|
||||
type: 'tool-result',
|
||||
toolCallId: CallId('shot'),
|
||||
toolCallId: ToolCallId('shot'),
|
||||
content: [{ type: 'text', text: OFFLOADED_IMAGE_TEXT }],
|
||||
}])
|
||||
expect(fitted[1]?.content).toEqual([shared, image(3)])
|
||||
@@ -77,7 +77,7 @@ describe('offloadRequestImages', () => {
|
||||
it('keeps unchanged nested content while replacing a later image', () => {
|
||||
const nested = {
|
||||
type: 'tool-result' as const,
|
||||
toolCallId: CallId('text-only'),
|
||||
toolCallId: ToolCallId('text-only'),
|
||||
content: [{ type: 'text' as const, text: 'kept' }],
|
||||
}
|
||||
const messages = [createUserMessage({ content: [nested, image(3)], source })]
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { zstdCompressSync } from 'node:zlib'
|
||||
import type { SessionEvent } from '@deepseek-ai/dsh-session'
|
||||
import { CallId, type StreamChunk } from '@deepseek-ai/dsh-llm'
|
||||
import { ToolCallId, type StreamChunk } from '@deepseek-ai/dsh-llm'
|
||||
import {
|
||||
decodeStorageRecord,
|
||||
MAX_PACKED_DATA_BYTES,
|
||||
@@ -85,10 +85,10 @@ describe('SQLite compression', () => {
|
||||
const events = [
|
||||
...[0, 1, 2].map(seq => event(seq, seq, { type: 'reasoning-delta', index: 1, text: `${seq}` })),
|
||||
...[3, 4, 5].map(seq => event(seq, seq, {
|
||||
type: 'tool-call-delta', index: 2, id: CallId('named'), name: 'write', argumentsDelta: `${seq}`,
|
||||
type: 'tool-call-delta', index: 2, id: ToolCallId('named'), name: 'write', argumentsDelta: `${seq}`,
|
||||
})),
|
||||
...[6, 7, 8].map(seq => event(seq, seq, {
|
||||
type: 'tool-call-delta', index: 3, id: CallId('unnamed'), argumentsDelta: `${seq}`,
|
||||
type: 'tool-call-delta', index: 3, id: ToolCallId('unnamed'), argumentsDelta: `${seq}`,
|
||||
})),
|
||||
]
|
||||
const records = packChunkRuns(events)
|
||||
@@ -128,7 +128,7 @@ describe('SQLite compression', () => {
|
||||
event(2, Number.MAX_SAFE_INTEGER, { type: 'text-delta', index: 0, text: 'c' }),
|
||||
]
|
||||
const toolName = [0, 1, 2].map(seq => event(seq, seq, {
|
||||
type: 'tool-call-delta', index: 0, id: CallId('id'),
|
||||
type: 'tool-call-delta', index: 0, id: ToolCallId('id'),
|
||||
...seq === 2 ? {} : { name: 'write' }, argumentsDelta: 'x',
|
||||
}))
|
||||
for (const events of [gap, step, block, unsafeTime, toolName]) {
|
||||
|
||||
@@ -5,7 +5,7 @@ import { mkdtemp, rm } from 'node:fs/promises'
|
||||
import { tmpdir } from 'node:os'
|
||||
import { join } from 'node:path'
|
||||
import { DatabaseSync } from 'node:sqlite'
|
||||
import { CallId, type StreamChunk } from '@deepseek-ai/dsh-llm'
|
||||
import { ToolCallId, type StreamChunk } from '@deepseek-ai/dsh-llm'
|
||||
import SessionStore, { type SessionEvent } from '@deepseek-ai/dsh-session'
|
||||
import type { SessionPersistence } from '@deepseek-ai/dsh-session-persistence'
|
||||
import SessionPersistenceJsonl from '@deepseek-ai/dsh-session-persistence-jsonl'
|
||||
@@ -86,7 +86,7 @@ function packingMatrixLog(): SessionEvent[] {
|
||||
chunk: {
|
||||
type: 'tool-call-delta' as const,
|
||||
index: 2,
|
||||
id: CallId('named-call'),
|
||||
id: ToolCallId('named-call'),
|
||||
name: 'write',
|
||||
argumentsDelta: `{${index}`,
|
||||
},
|
||||
@@ -96,7 +96,7 @@ function packingMatrixLog(): SessionEvent[] {
|
||||
chunk: {
|
||||
type: 'tool-call-delta' as const,
|
||||
index: 3,
|
||||
id: CallId('unnamed-call'),
|
||||
id: ToolCallId('unnamed-call'),
|
||||
argumentsDelta: `${index}}`,
|
||||
},
|
||||
time: 3_000 + index,
|
||||
@@ -176,13 +176,13 @@ const streamChunkArbitrary: fc.Arbitrary<StreamChunk> = fc.oneof(
|
||||
fc.record({
|
||||
type: fc.constant<'tool-call-delta'>('tool-call-delta'),
|
||||
index: fc.nat(2),
|
||||
id: fc.constantFrom(CallId('call-1'), CallId('call-2')),
|
||||
id: fc.constantFrom(ToolCallId('call-1'), ToolCallId('call-2')),
|
||||
argumentsDelta: fc.string(),
|
||||
}),
|
||||
fc.record({
|
||||
type: fc.constant<'tool-call-delta'>('tool-call-delta'),
|
||||
index: fc.nat(2),
|
||||
id: fc.constantFrom(CallId('call-1'), CallId('call-2')),
|
||||
id: fc.constantFrom(ToolCallId('call-1'), ToolCallId('call-2')),
|
||||
name: fc.constantFrom('read', 'write'),
|
||||
argumentsDelta: fc.string(),
|
||||
}),
|
||||
|
||||
@@ -7,7 +7,7 @@ import { afterEach, describe, expect, it } from 'vitest'
|
||||
import { Context } from '@deepseek-ai/cordis'
|
||||
import Loader from '@deepseek-ai/cordis-plugin-loader'
|
||||
import Include from '@deepseek-ai/cordis-plugin-include'
|
||||
import { CallId } from '@deepseek-ai/dsh-llm'
|
||||
import { ToolCallId } from '@deepseek-ai/dsh-llm'
|
||||
import { Session, SessionId } from '@deepseek-ai/dsh-session'
|
||||
import AgentRegistry, { Inbox } from '@deepseek-ai/dsh-agent'
|
||||
import type { Agent } from '@deepseek-ai/dsh-agent'
|
||||
@@ -130,7 +130,7 @@ describe.skipIf(!hasPwsh)('persistent pwsh through a real cordis.yml Loader comp
|
||||
const signal = new AbortController().signal
|
||||
const execute = (id: string, command: string) => context!.tools.execute({
|
||||
signal,
|
||||
callId: CallId(id),
|
||||
callId: ToolCallId(id),
|
||||
name: 'pwsh',
|
||||
arguments: { command },
|
||||
agent: owner,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { afterEach, describe, expect, it } from 'vitest'
|
||||
import { Context } from '@deepseek-ai/cordis'
|
||||
import { CallId } from '@deepseek-ai/dsh-llm'
|
||||
import { ToolCallId } from '@deepseek-ai/dsh-llm'
|
||||
import { Session, SessionId } from '@deepseek-ai/dsh-session'
|
||||
import AgentRegistry, { Inbox } from '@deepseek-ai/dsh-agent'
|
||||
import type { Agent } from '@deepseek-ai/dsh-agent'
|
||||
@@ -66,7 +66,7 @@ function call(
|
||||
) {
|
||||
return ctx.tools.execute({
|
||||
signal,
|
||||
callId: CallId(`persistent-pwsh-${++callNumber}`),
|
||||
callId: ToolCallId(`persistent-pwsh-${++callNumber}`),
|
||||
name: 'pwsh',
|
||||
arguments: { command },
|
||||
...owner === undefined ? {} : { agent: owner },
|
||||
|
||||
Reference in New Issue
Block a user