Commit Graph
126 Commits
Author SHA1 Message Date
imccyu 37e0924f68 Merge pull request #8257 from deepseek-harness/ptc-scoped-repl-switch
feat(ptc): run the scoped REPL by default for persistent-in-memory execution
2026-11-10 22:34:59 +08:00
imccyu c6ef2d17da fix(ptc): keep the runtime's own experimental warnings out of program output
The child filters Node's ExperimentalWarning for vm.USE_MAIN_CONTEXT_DEFAULT_LOADER
and stripTypeScriptTypes, which the runtime itself triggers; an environment
initializer that imports a module under the scoped REPL otherwise prints it into
the first call's output. Warnings that programs emit still print. The host strips
types without printing the stripTypeScriptTypes warning.
2026-11-10 18:52:20 +08:00
imccyu 561f7f1538 test(ptc): match scoped REPL filenames with platform paths
Scoped REPL programs are named resolve(<creation cwd>, '.ptc-repl-<n>.js'), so on Windows their stacks show backslash paths. Compare locations against the resolved filename instead of a hardcoded '/' separator, keeping the submission ordinal, line, and column checks.
2026-11-10 18:52:20 +08:00
imccyu 1cf3217403 fix(ptc): align scoped REPL guidance and tests with inspect output
run_code now discards completion values for TypeScript runtimes, so the
scoped REPL guidance shares the inspect output sentence with the other
modes. Tests read the output field, cover environment initialization with
copied bindings, and the ptc-scoped-repl snapshot is re-recorded with
inspect output.
2026-11-10 18:52:19 +08:00
imccyu 5a398a9990 feat(ptc): name scoped REPL programs as hidden files in the first directory
Each call's Script filename becomes <first working directory>/.ptc-repl-<n>.js.
No file exists at that path; the directory stays because Node's default loader
resolves relative import() specifiers from the filename.
2026-11-10 18:52:19 +08:00
imccyu ba4d01126c feat(ptc): start scoped REPL var redeclarations from the earlier value
A call that declares an earlier name again only with var now gets a var
copy of the earlier value, so a var declaration that does not run, after
a throw or in an untaken branch, keeps that value as a global var does in
Node's REPL. var count = count + 1 consequently adds to the earlier value.
A function of the same name in one call takes precedence over the var.
Update the model guidance, Agent Note, READMEs, and the ptc-scoped-repl
snapshot schema.
2026-11-10 18:52:19 +08:00
imccyu 793ce790a6 feat(ptc): add scoped REPL execution with copied top-level bindings
With replScoped: true, persistent-in-memory runs each call as a separate
VM Script in one retained context. Each call starts with copies of the
top-level bindings left by earlier calls, so a later call may declare any
earlier name again with any keyword while earlier functions and
still-running code keep their values. Results, top-level await, errors
and asynchronous failures follow the existing REPL evaluator; modules
load only through dynamic import(), resolved from the environment's first
working directory.

The control protocol moves to version 3; the upgrade guide covers
preinstalled bootstraps and the new PtcProgramFormat member. The Agent
Note records the decision and its comparison with node:repl and
vm-script, and the ptc-scoped-repl snapshot pins the model guidance.
2026-11-10 18:52:19 +08:00
_Kerman 7526051e60 test(ptc): sync artifact expectations with emitted newlines 2026-11-10 16:31:41 +08:00
_Kerman 5fd443618f fix(ptc): preserve raw text and cross-realm image inspection 2026-11-10 16:07:14 +08:00
_Kerman 0a398c2968 refactor(ptc): require image dependencies for inspect 2026-11-10 14:40:31 +08:00
_Kerman 86984d8358 Merge branch 'feat/cua-run-code-standard' into xtr/ptc-inspect-output 2026-11-10 14:24:26 +08:00
_Kerman 0191dbb0cf refactor(ptc): collect nested images through custom inspection 2026-11-10 13:38:43 +08:00
_Kerman 5d0106771e fix(ptc): render inspected values with Node object formatting 2026-11-10 11:58:10 +08:00
_Kerman 9e61299fdb fix(ptc): isolate image property descriptors from prototypes 2026-11-10 11:42:07 +08:00
turtle1999 d602624eb3 refactor(cua): isolate raw registration and simplify initialization 2026-11-10 11:11:58 +08:00
_Kerman 2bedbf2f2b fix(ptc): align JSON inspection tests and failure handling 2026-11-10 10:45:41 +08:00
turtle1999 26427a26e1 refactor(ptc): initialize each environment through a registered hook 2026-11-09 22:19:35 +08:00
_Kerman 4e976ee9a9 fix(ptc-runtime): retain inspected output across proxy and limit cases 2026-11-09 21:42:29 +08:00
turtle1999 f0e9dc1c92 fix(cua): support clean source runs and preserve per-mode guidance 2026-11-09 18:17:56 +08:00
_Kerman e1f0a36193 fix(ptc): preserve native console methods 2026-11-09 18:17:19 +08:00
_Kerman a2ea3970fd refactor(ptc): return ordered text and image output 2026-11-09 17:44:12 +08:00
_Kerman 1fed265b3b fix(ptc): bound binary inspection and preserve failure output 2026-11-09 17:19:48 +08:00
_Kerman b98e3d070b feat(ptc): expose attachment IDs on program images 2026-11-09 15:58:33 +08:00
turtle1999 b9966a12a6 feat(cua): expose persistent code tool outside PTC mode 2026-11-09 15:53:22 +08:00
_Kerman 4e72e43037 chore(ptc): align fixtures and docs with simplified image handling 2026-11-09 15:42:49 +08:00
_Kerman 724e56b286 feat(ptc): unify explicit text and image inspection 2026-11-09 15:06:09 +08:00
_Kerman 790991a6c0 docs(ptc): align inspection guidance and references 2026-11-09 12:56:55 +08:00
_Kerman e688c61aab fix(ptc): target program realms for console globals 2026-11-09 12:48:09 +08:00
_Kerman c1783e9dff feat(ptc): select program output with Harness.inspect 2026-11-09 12:00:07 +08:00
Anlai Lu 41ef0fcaa9 refactor(ptc): 复用 embedded 载体的既有 process.js 启动 2026-11-06 13:51:24 +08:00
Anlai Lu 4ac6a28e68 feat(ptc): 支持 embedded 模式启用 persistent PTC 2026-11-06 12:55:15 +08:00
Yixiang Tu 69e6199cb7 test(sandbox): canonicalize roots allocated under home 2026-11-04 16:06:17 +08:00
Yixiang Tu e032300b4e fix(sandbox): use current grants after failed PTC startup 2026-11-04 15:11:17 +08:00
Yixiang Tu f5dea38671 feat(sandbox): add session-scoped writable directory effects 2026-11-04 15:11:17 +08:00
_Kerman ab2bee0051 Merge remote-tracking branch 'origin/master' into xtr/ptc-timeout-step-1 2026-11-03 20:12:59 +08:00
_Kerman 5cf9348314 refactor(ptc-runtime-node): reuse sequential RPC evaluation lifecycle 2026-10-30 20:55:23 +08:00
_Kerman adc54201f3 fix(ptc-runtime-node): preserve existing native output behavior 2026-10-30 20:54:53 +08:00
_Kerman 964231856d refactor(ptc): reuse run completion for cooperative stop 2026-10-30 17:00:42 +08:00
_Kerman 718f28ee9a refactor(ptc): simplify model-visible state and recovery messages 2026-10-30 11:30:37 +08:00
_Kerman 7d20d1c361 fix(ptc-runtime-node): contain teardown and validate bootstrap readiness 2026-10-29 21:58:51 +08:00
_Kerman 9800c764ef feat(ptc-runtime-node): preserve state after cooperative cancellation 2026-10-29 21:22:25 +08:00
_Kerman 7c0af3101b refactor(ptc): reuse native module format resolution 2026-10-26 22:05:56 +08:00
_Kerman cf6e05df6d fix(ptc): preserve import semantics across evaluation lifetimes 2026-10-26 21:07:10 +08:00
_Kerman 7fad73160d Merge remote-tracking branch 'origin/master' into xtr/ptc-runner-imports 2026-10-26 17:15:55 +08:00
_Kerman dc3754d252 Merge remote-tracking branch 'origin/master' into xtr/ptc-vm-script
# Conflicts:
#	docs/module-graph.md
#	docs/module-graph.zh.md
#	packages/ptc-runtime/ptc-runtime-node/package.json
2026-10-23 17:09:31 +08:00
_Kerman 9d56130730 fix(ptc): refresh imported process environment after scrubbing 2026-10-22 11:10:47 +08:00
_Kerman 8faf20f660 Merge latest xtr/ptc-vm-script into xtr/ptc-runner-imports 2026-10-22 11:07:30 +08:00
_Kerman 67911ed176 fix(ptc): describe fresh Script failures without retained state 2026-10-21 19:51:52 +08:00
_Kerman 09c7036e05 fix(ptc): retain control transport errors in worker exit diagnostics 2026-10-21 19:51:51 +08:00
_Kerman c905726461 fix(ptc): allow local process declarations in function bodies 2026-10-21 19:51:50 +08:00