1.7 KiB
1.7 KiB
kind, description
| kind | description |
|---|---|
| upgrade-guide | PTC programFormat includes Script syntax, and consumers read retainsState for cross-call memory. |
Handle Script programs and explicit state retention
English | 中文
Change
The published @deepseek-ai/dsh-ptc-runtime service widens PtcRuntime.programFormat from 'function-body' | 'repl' to include 'script'. External consumers that exhaustively match the old union must handle the new value. retainsState reports whether a provider preserves memory for a stateOwner; its base implementation returns false, so custom retained providers must override it.
Node keeps per-call as its default. The opt-in executionMode: vm-script accepts Script statements and top-level await, with scriptPersistence selecting cross-call memory independently. Existing Node function-body and REPL configurations remain valid.
Migration
- Import the exported
PtcProgramFormatfrom@deepseek-ai/dsh-ptc-runtimeinstead of copying its union literals. UpdateprogramFormatswitches in custom tool or workflow adapters. Handle'script'using statements or a final expression, without top-levelreturn; consult the Node syntax reference. - Replace checks that infer memory retention from
programFormat === 'repl'withruntime.retainsState. If a customPtcRuntimeprovider retains owner-scoped memory, overrideretainsStateto returntrueand continue implementingrelease(owner). - Rebuild external consumers against the new package declarations. Confirm that each supported format compiles and that persistence controls follow
retainsStatefor both REPL and Script providers.