61 Commits
Author SHA1 Message Date
_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
_Kerman 25ede01a8b fix(ptc): preserve compact declarations and native syntax diagnostics 2026-10-21 19:51:49 +08:00
_Kerman 5dcb912b1b refactor(cua): delegate retained execution settings to Node provider 2026-10-21 16:47:32 +08:00
_Kerman ac0816e573 refactor(ptc-runtime-node): centralize cross-realm exception formatting 2026-10-21 16:47:08 +08:00
_Kerman 73a5e63894 fix(ptc-runtime-node): report clearing only for retained executions 2026-10-21 16:46:56 +08:00
_Kerman 4b06d5bf80 refactor(ptc-runtime-node): remove unused bootstrap paths 2026-10-21 16:00:30 +08:00
_Kerman 2b7b2a0ee6 refactor(ptc): share the program format type 2026-10-21 15:59:56 +08:00
_Kerman 6085b6fb62 Merge latest master into xtr/ptc-vm-script 2026-10-21 15:12:47 +08:00
_Kerman 86fcf49a74 fix(ptc-runtime-node): validate Script evaluation and process lifecycle 2026-10-21 11:12:33 +08:00
_Kerman 94dae61fb5 fix(ptc-runtime-node): keep per-call binding waits pending when the host closes
Closing the control pipe after the result rejected outstanding birpc
calls; an unawaited binding promise then crashed the child and its trace
reached the result logs. Once the result is returned or the pipe closes,
binding calls now never settle, including those the closure rejects.
2026-10-21 10:30:31 +08:00
_Kerman e82dddc45c fix(ptc-runtime-node): correct Script await handling and guidance 2026-10-21 00:37:56 +08:00
_Kerman c3473d1ea6 refactor(ptc-runtime-node): unify temporary and retained processes 2026-10-21 00:03:21 +08:00
_Kerman 399a74e808 refactor(ptc-runtime-node): simplify evaluator binding setup 2026-10-21 00:02:56 +08:00
_Kerman 36820a5462 refactor(ptc-runtime-node): share the fake child and fold result validation into the protocol
Move the identical in-memory child used by the per-call and persistent
host specs into tests/fake-child.ts, and move readProgramResult next to
the ProgramResult type it validates in protocol.ts.
2026-10-20 23:55:36 +08:00
_Kerman 7bab95f8da refactor(ptc-runtime-node): rely on birpc defaults for message handling
Keep the stream side owned here: line bounds, the leading-brace check,
the write-queue limit and closure. On the birpc side, drop the strict
envelope validation, falsy-rejection normalization and fatal UTF-8
decoding. Calls to methods an endpoint does not own are answered with
birpc's error and unknown messages are ignored; the resolver still runs
only own methods and none after the endpoint closes.
2026-10-20 23:28:27 +08:00
_Kerman 7745b3b9da feat(ptc-runtime-node): add VM Script execution with optional retained state 2026-10-20 23:16:30 +08:00
_Kerman 427d62d4a7 fix(ptc-runtime-node): fail fast on mismatched bootstraps and late replies
- Reject a control line that does not start with "{", so another
  release's length-prefixed frame fails as a protocol error instead of
  waiting for a newline until the deadline.
- Bump SSH_PROTOCOL_VERSION to 3: executable helpers embed the PTC
  worker, so an older helper is now rejected while connecting.
- Send a small error instead of a late binding result from a finished
  persistent evaluation, so it cannot overflow the pipe shared with
  the next evaluation.
- Leave per-call binding waits pending after the result instead of
  rejecting them; unawaited calls crashed the child and leaked the
  trace into the result logs.
- Pin birpc to 4.2.0 so the host and the bundled child agree, and
  regenerate THIRD_PARTY_NOTICES.md.
- Update stale frame wording.
2026-10-20 16:06:50 +08:00
_Kerman 82b23cf4d2 refactor(ptc-runtime-node): drop evaluation ids from the control protocol
One pipe delivers each evaluation's messages before its result, and the
child refuses calls from finished evaluations, so the per-message
evaluation id protected nothing. Remove it with the checks, counters and
helpers it required, measure outgoing messages only when posting, and
replace rethrowing validation blocks with early refusals.
2026-10-20 15:15:04 +08:00
_Kerman 534aafce7a refactor(ptc-runtime-node): carry the process control channel over birpc
Replace the length-prefixed JsonChannel and hand-written request/reply
correlation with typed birpc methods over newline-delimited JSON. The
host calls the child's run(); bindings call the host's invoke(); logs
and output-limit reports are notifications. The transport bounds
incoming lines and queued writes, validates UTF-8 and exposed methods,
and rejects outstanding calls when the pipe closes.

Drop logic made obsolete by the new transport, including the 32-bit
frame-length bound on maxMessageBytes.
2026-10-20 14:50:05 +08:00
Tianyi Cui 64ece4cac1 fix(sandbox): reject redirected and unsupported write grants 2026-10-18 11:10:00 +08:00
Tianyi Cui 6b71dcad85 fix(sandbox): support explicit additional writable roots 2026-10-18 11:10:00 +08:00
Tianyi Cui b9863a9e28 fix(ptc): cancel pending runs when Session policy changes
Register calls before awaiting prior process cleanup. Carry policy cancellation into both Node execution modes and retain each admission until its call settles. Track persistent calls during provider disposal as well.

Cover unchanged-mode temporary escalation and policy changes that return to the original mode while cleanup is pending. Document the admission guarantee.

Validation: 308 focused tests passed, one skipped; both changed source files have 100% coverage. Two built-runtime smokes, two selected Session snapshots, all 43 doc-sync gates, and typed lint passed.
2026-10-09 16:43:56 +08:00
creatixchu 42cf8c5ee0 Merge remote-tracking branch 'origin/master' into codex/ptc-review-policy
# Conflicts:
#	apps/desktop/tests/ptc-runtime.spec.ts
#	docs/config-catalog.md
#	docs/config-catalog.zh.md
#	packages/ptc-runtime/ptc-runtime-node/README.i18n.yaml
#	packages/ptc-runtime/ptc-runtime-node/README.md
#	packages/ptc-runtime/ptc-runtime-node/README.zh.md
#	packages/ptc-runtime/ptc-runtime-node/src/index.ts
#	packages/ptc-runtime/ptc-runtime-node/src/launch.ts
#	packages/ptc-runtime/ptc-runtime-node/tests/launch.spec.ts
2026-10-09 15:10:13 +08:00
creatixchu 9b9630e6d8 fix(ptc): preserve standalone runtime composition 2026-10-09 15:07:42 +08:00
creatixchu 4138fd1912 fix(ptc): simplify registered cleanup settlement 2026-10-09 15:02:58 +08:00
creatixchu 244ca73755 fix(ptc): keep policy cleanup waits inside PTC 2026-10-09 15:02:01 +08:00
creatixchu 046d722c14 fix(ptc): preserve caller context across process control callbacks 2026-10-08 17:45:18 +08:00
creatixchu 209684aaae fix(ptc): retain per-call cleanup until process exit is observed 2026-10-08 17:05:07 +08:00
creatixchu 6885d662d2 refactor(ptc): move mode-change coordination into sandbox policy 2026-10-08 16:43:00 +08:00
creatixchu 80b42178c5 fix(ptc): keep admission closed through owner disposal 2026-10-08 15:05:04 +08:00
creatixchu 6a6105dc1b fix(ptc): preserve tool execution identity during cancellation 2026-10-08 14:59:28 +08:00
creatixchu e3a92c9de5 fix(ptc): confine persistent memory and isolate temporary approvals 2026-10-08 14:57:36 +08:00
creatixchu bcd1e66141 fix(ptc): reserve owners through explicit environment release 2026-09-28 16:27:15 +08:00
creatixchu 6fe4bf04fc fix(ptc): retain idle process cleanup until it settles 2026-09-28 16:24:05 +08:00
creatixchu bf95e3a74b fix(ptc): preserve policy and evaluation lifecycle across memory runs 2026-09-28 16:08:45 +08:00
creatixchu 30b193b38a feat(ptc): select Node state retention through executionMode 2026-09-28 15:27:39 +08:00
creatixchu 01aeea93f2 fix(ptc): reject dispatch to an exited retained process 2026-09-25 13:34:23 +08:00
creatixchu 5a2bb185ab fix(ptc): refresh retained binding error descriptors 2026-09-25 13:15:17 +08:00
creatixchu 1c29ff0598 fix(ptc): await every retained environment during unload 2026-09-25 13:11:00 +08:00
creatixchu d256be165c fix(ptc): return bounded parse-overflow cleanup failures 2026-09-25 13:04:16 +08:00
creatixchu 9d6a9e28b5 fix(ptc): isolate the REPL process binding 2026-09-25 12:40:48 +08:00
creatixchu 0309d22520 docs(ptc): clarify raw subprocess output attribution 2026-09-24 23:01:33 +08:00
creatixchu 9e17500315 fix(ptc): separate shared schema value from config type 2026-09-24 22:55:09 +08:00
creatixchu 6a8483ce42 fix(ptc): contain retained evaluation failures and output 2026-09-24 22:44:56 +08:00
creatixchu 75ae02da4a fix(ptc): allow top-level await in scoped blocks 2026-09-23 20:18:49 +08:00
Yichen Jiang d9342fcb5d feat(ssh): package standalone POSIX helper runtimes 2026-09-23 19:16:59 +08:00
creatixchu cff260f048 chore(ptc): align published artifacts and strict lint contracts 2026-09-23 17:12:43 +08:00
creatixchu 1393ed2e12 fix(ptc): simplify evaluation settlement and isolate published bundles 2026-09-23 17:03:04 +08:00