Skip to content

The open source AI video agent: turns any coding agent into a video agent, with an editor to change anything it makes.

Desktop: DeepSeek Harness shows its steps as it works (#197)

riverisbuildingbae8bae71409
diff --git a/.changeset/dsh-live-steps.md b/.changeset/dsh-live-steps.md
new file mode 100644
index 0000000..7d29d85
--- /dev/null
+++ b/.changeset/dsh-live-steps.md
@@ -0,0 +1,5 @@
+---
+"@openfilm/desktop": patch
+---
+
+DeepSeek Harness shows its work in the chat as it goes. Each command it runs, file it reads or writes, search and web lookup now shows as a step the moment it starts, as with the other agents, instead of only "Working" until the whole reply appears at the end.
diff --git a/apps/desktop/chat/src/lib/local-agent-run.ts b/apps/desktop/chat/src/lib/local-agent-run.ts
index f7cfb98..4deee3e 100644
--- a/apps/desktop/chat/src/lib/local-agent-run.ts
+++ b/apps/desktop/chat/src/lib/local-agent-run.ts
@@ -338,6 +338,7 @@ export class LocalAgentTurn {
this.calls.set(String(u.toolCallId), {
...(typeof u.title === 'string' ? { title: u.title } : {}),
...(typeof u.kind === 'string' ? { kind: u.kind } : {}),
+ ...(u.rawInput != null ? { rawInput: u.rawInput } : {}),
...(tool ? { tool } : {}),
});
/* It asked the user through our MCP (ask_user): the question and options go on this row, and the panel shows the card */
@@ -382,8 +383,8 @@ export class LocalAgentTurn {
/** acpUpdateToEvent only yields the closed-set fields; the file name / command reaches the next agent-act from here. */
private pendingDetail: string | undefined;
private pendingAsk: TranscriptItem['ask'];
- /** Each call's first title and kind: later updates often carry only the fields that changed. */
- private calls = new Map<string, { title?: string; kind?: string; tool?: string }>();
+ /** Each call's first title, kind and input: later updates often carry only the fields that changed. */
+ private calls = new Map<string, { title?: string; kind?: string; rawInput?: unknown; tool?: string }>();
private thoughtNo = 0;
private openThought: string | null = null;
@@ -468,7 +469,7 @@ export class LocalAgentTurn {
const activity = localToolActivity(
typeof u.title === 'string' ? u.title : first?.title,
typeof u.kind === 'string' ? u.kind : first?.kind,
- u.rawInput ?? {},
+ u.rawInput ?? first?.rawInput ?? {},
{ locations: u.locations, content: u.content },
);
if (!activity || activity.act !== item.act) return;
diff --git a/apps/desktop/src/agents.mjs b/apps/desktop/src/agents.mjs
index 683da26..e6d0a09 100644
--- a/apps/desktop/src/agents.mjs
+++ b/apps/desktop/src/agents.mjs
@@ -86,10 +86,29 @@ export const AGENTS = Object.freeze({
kimi: { label: AGENT_DEFINITIONS.kimi.name, args: ['acp'], login: ['login'], approve: true },
minimax: { label: AGENT_DEFINITIONS.minimax.name, args: ['acp'], login: ['login'], approve: true },
/* DeepSeek Harness (`dsh`) speaks ACP as its `acp` profile. It has no sign-in command: the person signs in to their
- DeepSeek account in its desktop app, or sets DEEPSEEK_API_KEY, so one found is connected */
- deepseek: { label: AGENT_DEFINITIONS.deepseek.name, args: ['--profile', 'acp'], login: null, approve: true },
+ DeepSeek account in its desktop app, or sets DEEPSEEK_API_KEY, so one found is connected. It reports every tool
+ as kind `other`, titled by its name: `toolKinds` gives each the kind it is (see withToolKind) */
+ deepseek: { label: AGENT_DEFINITIONS.deepseek.name, args: ['--profile', 'acp'], login: null, approve: true,
+ toolKinds: {
+ bash: 'execute', pwsh: 'execute',
+ read: 'read', read_image: 'read',
+ write: 'edit', edit: 'edit', str_replace_editor: 'edit',
+ grep: 'search', glob: 'search',
+ web_search: 'fetch', web_fetch: 'fetch',
+ } },
});
+/**
+ * A tool call with the kind its name says (`toolKinds`), for an agent that reports every tool as `other`. The chat
+ * draws an `other` call as the passing "Working" status, not a step: without its kind, a turn shows no step until
+ * it ends.
+ */
+export function withToolKind(update, toolKinds) {
+ if (!toolKinds || update?.sessionUpdate !== 'tool_call' || (update.kind ?? 'other') !== 'other') return update;
+ const kind = Object.hasOwn(toolKinds, update.title) ? toolKinds[update.title] : null;
+ return kind ? { ...update, kind } : update;
+}
+
export const isAgentId = (id) => typeof id === 'string' && Object.hasOwn(AGENTS, id);
/** The variables an agent is started with (`defaults`) that the person's shell does not set itself. */
@@ -1108,7 +1127,7 @@ export class AgentSession {
return answers ? { action: 'accept', content: formContent(questions, answers) } : { action: 'decline' };
})
.onNotification(acp.methods.client.session.update, (ctx) => {
- const update = ctx.params.update;
+ const update = withToolKind(ctx.params.update, this.spec.toolKinds);
if (SPOKE.has(update?.sessionUpdate)) this.spoke = true;
this.heard = Date.now();
const phase = agentPhase(update);
diff --git a/apps/desktop/src/agents.test.mjs b/apps/desktop/src/agents.test.mjs
index ca7f701..4dcccaa 100644
--- a/apps/desktop/src/agents.test.mjs
+++ b/apps/desktop/src/agents.test.mjs
@@ -1,6 +1,6 @@
import { test } from 'node:test';
import assert from 'node:assert/strict';
-import { AgentSession, CLIENT_CAPABILITIES, agentDefaults, closeEverySession, planProblem, probeFolder, CODEX_UTF8_CMD, agentShell, allowOption, codexDeveloperInstructions, codexLaunchEnv, distinctOptions, errorCause, legacyOptions, powerShellScript, powerShellLine, powerShellWindowLaunch, terminalScript, checkAgentProgram, readAgentStatus, setChosenPaths, signInScript, turnError, signInError, codexTooOld, AGENTS, ownSignIn, codexServiceError, codexRefusal, codexNotice, explainFailure, stderrReason } from './agents.mjs';
+import { AgentSession, CLIENT_CAPABILITIES, agentDefaults, closeEverySession, planProblem, probeFolder, CODEX_UTF8_CMD, agentShell, allowOption, codexDeveloperInstructions, codexLaunchEnv, distinctOptions, errorCause, legacyOptions, powerShellScript, powerShellLine, powerShellWindowLaunch, terminalScript, checkAgentProgram, readAgentStatus, setChosenPaths, signInScript, turnError, signInError, codexTooOld, AGENTS, ownSignIn, codexServiceError, codexRefusal, codexNotice, explainFailure, stderrReason, withToolKind } from './agents.mjs';
test('an agent that asks: yes for good where it offers that, else yes this once; nothing to say yes with is null', () => {
const options = [
@@ -339,6 +339,52 @@ test('a turn whose agent waits on its model with nothing coming is stopped, and
}
});
+test('DeepSeek Harness: each step reaches the chat as it happens, with the kind its tool is, not as one "Working"', async () => {
+ /* dsh's ACP profile, as 0.0.1 sends a turn: its words as each message is done, every tool as kind `other` titled
+ by its name, and the turn's answer a while after */
+ const { dir, program } = await fakeAcpAgent('dsh', (m, send) => {
+ if (m.method !== 'session/prompt') return;
+ const update = (u) => send({ jsonrpc: '2.0', method: 'session/update', params: { sessionId: 's1', update: u } });
+ update({ sessionUpdate: 'agent_message_chunk', messageId: 'm1', content: { type: 'text', text: 'Reading the manual first.' } });
+ const tools = [['bash', { command: 'openfilm' }], ['read', { file_path: 'film.html' }], ['write', { file_path: 'a.html', content: '' }],
+ ['grep', { pattern: 'fill' }], ['web_search', { query: 'Alibaba 1999' }], ['todo_write', { todos: [] }]];
+ tools.forEach(([title, rawInput], i) => {
+ update({ sessionUpdate: 'tool_call', toolCallId: `c${i}`, title, kind: 'other', status: 'in_progress', rawInput });
+ update({ sessionUpdate: 'tool_call_update', toolCallId: `c${i}`, status: 'completed', content: [] });
+ });
+ setTimeout(() => send({ jsonrpc: '2.0', id: m.id, result: { stopReason: 'end_turn' } }), 300);
+ });
+ setChosenPaths({ deepseek: program });
+ let ended = false;
+ const heard = [];
+ const session = new AgentSession({ agent: 'deepseek', cwd: dir, onUpdate: (u) => heard.push({ ...u, ended }) });
+ try {
+ await session.start();
+ await session.prompt([{ type: 'text', text: 'Make a video about Alibaba' }]);
+ ended = true;
+ assert.ok(heard.length > 0 && heard.every((u) => !u.ended), 'all heard while the turn ran');
+ assert.equal(heard[0].content.text, 'Reading the manual first.');
+ const kinds = heard.filter((u) => u.sessionUpdate === 'tool_call').map((u) => [u.title, u.kind]);
+ assert.deepEqual(kinds, [['bash', 'execute'], ['read', 'read'], ['write', 'edit'], ['grep', 'search'], ['web_search', 'fetch'], ['todo_write', 'other']]);
+ assert.deepEqual(heard.find((u) => u.toolCallId === 'c0' && u.sessionUpdate === 'tool_call').rawInput, { command: 'openfilm' }, 'otherwise as it came');
+ } finally {
+ session.close();
+ setChosenPaths({});
+ }
+});
+
+test('a tool call keeps its kind unless the agent names its tools (toolKinds) and said `other`', () => {
+ const kinds = AGENTS.deepseek.toolKinds;
+ const call = { sessionUpdate: 'tool_call', toolCallId: 'c', title: 'bash', kind: 'other' };
+ assert.equal(withToolKind(call, kinds).kind, 'execute');
+ assert.equal(withToolKind({ ...call, kind: undefined }, kinds).kind, 'execute');
+ assert.equal(withToolKind({ ...call, kind: 'read' }, kinds).kind, 'read', 'a kind it gave is its own');
+ assert.equal(withToolKind(call, undefined), call, 'other agents: untouched');
+ assert.equal(withToolKind({ ...call, title: 'constructor' }, kinds).kind, 'other');
+ const update = { sessionUpdate: 'tool_call_update', toolCallId: 'c', title: 'bash', status: 'completed' };
+ assert.equal(withToolKind(update, kinds), update);
+});
+
test('quitting closes every agent process, one opened only to ask included; asking runs in one empty folder of the app', async () => {
assert.equal(probeFolder(), probeFolder());
const { dir, program } = await fakeAcpAgent('opencode', () => {});