refactor(apply-patch): drop unrelated changes and redundant prose

Restore files outside the patch feature to their merge-base state: the
invariant-check refactors across acp, session-controller, client,
compaction, agent-loop, agent, session-title, and subprocess, the cast
baseline edit, and the rescope-vendor skip list added during the merge.

Rename tool-fs.enableApplyPatch to applyPatch, matching the read, write,
and edit switches. Remove the unused collectMutationPaths export and the
unconsumed PatchHunk.contextLineIndices field, including its SSH schema
and fixtures. Report preflight refusals and syntax failures directly
instead of padding every phase with outcome, affectedPaths, and
cancelled fields. Add apply_patch to the shipped tool catalog test.

Fold the default-activation Agent Note into the apply_patch file-editing
note and delete it. Delete the guarded-filesystem-mutations upgrade
guide: every change is additive and all FileSystem subclasses live in
this repository. Trim defensive and reviewer-addressed sentences from
the package READMEs, subsystem docs, FileSystem JSDoc, and the Agent
Note, keeping the English and Chinese pairs aligned.
This commit is contained in:
sjw1231 committed 2026-10-20 20:25:24 +08:00
1 parent 3f229e5089
commit 2bd9913e2f
105 files changed
+566 -817

No files matched your search

@@ -1,4 +1,3 @@
import { RemoteError } from '@deepseek-ai/dsh-typert-protocol'
import { Context } from '@deepseek-ai/cordis'
import AgentRegistry from '@deepseek-ai/dsh-agent'
import { provideWorkingDirectoryFixture } from '@deepseek-ai/dsh-agent-loop-testkit'
@@ -177,7 +176,7 @@ describe('SessionSkillCatalog', () => {
expect(ctx.agents.list()).toEqual([])
})
it.each(['agent-preset/not-found', 'agent-preset/invalid'] as const)('falls back to the global registry for %s', async (code) => {
it('falls back to the global registry when the recorded preset is unavailable', async () => {
const ctx = await context()
const sessionId = SessionId('gone-preset')
ctx.provide('sessionQuery', {
@@ -187,7 +186,7 @@ describe('SessionSkillCatalog', () => {
})),
} as never)
ctx.provide('agentPresets', {
acquireScope: () => Promise.reject(new RemoteError(code, 'unavailable preset', { agentPreset: 'gone', available: [], reason: 'unavailable' })),
acquireScope: () => Promise.reject(new Error('unknown preset')),
} as never)
const list = vi.fn(() => Promise.resolve([]))
ctx.provide('skills', { list } as never)
@@ -197,29 +196,6 @@ describe('SessionSkillCatalog', () => {
expect(list).toHaveBeenCalledWith({ cwd: '/cold/project', scope: undefined })
})
it.each([new Error('preset defect'), new RemoteError('gateway/internal', 'preset defect', {})])('warns and falls back to global skills for unexpected preset failures: %s', async (failure) => {
const ctx = await context()
const sessionId = SessionId('gone-preset')
ctx.provide('sessionQuery', {
observeSession: () => Promise.resolve(observation(sessionId, {
cwd: '/cold/project',
agentPreset: 'gone',
})),
} as never)
ctx.provide('agentPresets', {
acquireScope: () => Promise.reject(failure),
} as never)
const list = vi.fn(() => Promise.resolve([]))
ctx.provide('skills', { list } as never)
const catalog = new SessionSkillCatalog(ctx)
const warn = vi.spyOn(ctx.logger, 'warn').mockImplementation(() => {})
await expect(catalog.list({ sessionId }, new AbortController().signal)).resolves.toEqual({ skills: [] })
expect(list).toHaveBeenCalledWith({ cwd: '/cold/project', scope: undefined })
expect(warn).toHaveBeenCalledWith(expect.stringContaining('preset gone'))
expect(warn).toHaveBeenCalledWith(expect.stringContaining('preset defect'))
})
it.each([
{
error: new SessionQueryError(