Files
deepseek-harness/scripts/fixtures/python-sdk-in-history-prompt.mjs
T
Tianyi Cui 9c8884284f test(sdk): record in-history system prompt updates in both clients
Cover the missing SDK projections through shipped dsh profiles. TypeScript reuses the headless read-completion composition and records SDK notifications. Python all includes a focused minimal-profile variant with an ordinary prompt section updated after shell completion, unchanged tools, persisted/subscribed append events, and independently checked editor output.

Observed: focused TS refresh and built replay passed (1 test); Python sdk-minimal-in-history and sdk-minimal passed against apps/cli/lib/bin.js using uv; unchanged-prompt negative control failed as expected then restored scenario passed; corpus 3 tests, doc-sync 33 gates, and lint:contracts-ready passed. Host-only build initially left SDK built startup incomplete; build:lib:client completed the prerequisites. Native packaged/wheel and Windows validation remain pending parent integration.
2026-09-07 11:09:39 +08:00

19 lines
677 B
JavaScript

/** Change one ordinary section after a successful persistent shell call. */
export const name = 'python-sdk-in-history-prompt'
export const inject = ['systemPrompt']
/** @param {import('@deepseek-ai/cordis').Context} ctx - Composed runtime services. */
export function apply(ctx) {
let version = 1
ctx.effect(() => ctx.systemPrompt.section({
name: 'python-sdk:in-history',
order: 400,
text: () => `Python SDK prompt version ${version}.`,
}))
ctx.on('tools/post-execute', async (exec, result, next) => {
const downstream = await next()
if (!result.isError && (exec.name === 'bash' || exec.name === 'pwsh')) version = 2
return downstream
})
}