Commit Graph
9 Commits
Author SHA1 Message Date
Chinesezjc 8833607469 docs(code-runtime-python): state the package's current surface, not its stack position
docs/AGENTS.md:38 keeps PRs, commits, and stack positions out of durable
prose. Both README sides described where this layer sits in a PR stack and
what a later PR would add, which goes stale the moment the backend lands.
Describe what the package owns instead: the wire protocol, with an exported
surface that carries no subprocess execution path.

Re-record README.i18n.yaml.
2026-08-17 17:46:40 +08:00
Chinesezjc b90b45158e Merge remote-tracking branch 'origin/master' into feat/code-runtime-python-protocol
Resolutions:

- docs/module-graph.md, docs/config-catalog.md: generated files. Regenerated
  with gen-module-graph and gen-config-catalog on the merged tree, then carried
  the new package's entries into the Chinese sides and re-recorded both
  pairings. Each side now differs from master by exactly the
  code-runtime-python rows.
- scripts/verify-package-readme-model-experience.ts, tsconfig.host.json: master
  renamed packages/bash -> packages/shell, packages/pty -> packages/terminal,
  code-runtime-worker -> code-runtime-worker-thread and agent-tool-mode ->
  agent-tool-presentation. Kept master's names and re-added this branch's
  code-runtime-python entry.

Adapted the package to conventions master introduced while the branch was open:
version 0.1.0-rc.6 with publishConfig.access "public" (the release-member rule
check-workspace-constraints now enforces), the invariants project reference
moved to packages/runtime-diagnostics/invariants, and the README companion link
retargeted to code-runtime-worker-thread.
2026-08-17 17:26:11 +08:00
Chinesezjc 5dad49f4db docs(code-runtime-python): name the roster aliases by subset direction, align metering prose
Rename UnionCoversRoster/RosterCoversUnion to UnionSubsetOfRoster/RosterSubsetOfUnion so
the names read in the same direction as their extends clauses, share the python3 -I -B
flags between the two mirror probes, and align the README and Agent Note prose with the
checkDoneValue JSDoc: the escaped-size scan is the metering itself, not deferred work.
Regenerate docs/module-graph.md, which listed code-runtime-python twice.
2026-08-07 15:37:19 +08:00
Chinesezjc 4674d8fa92 fix(code-runtime-python): verify union<->roster both ways, stop pycache writes, refresh metering prose
Address the latest review round:

- WireFrameShapesCoverUnions checked only union ⊆ roster, so removing a frame
  from a message union (e.g. dropping ReplyErr from ReplyMessage) left the check
  true while the public TS union diverged from the wire. Replace it with a
  bidirectional equivalence between MessageFrames and the roster's message-frame
  value types (nested Namespace/ErrorClass/DoneErrorField excluded): both a frame
  added to a union without a roster entry and a frame removed from a union now
  fail typecheck (both verified).
- The mirror e2e's python3 probes imported protocol.py without -B, writing
  py/__pycache__/*.pyc into the (un-ignored) source tree. Add -B to both.
- Refresh the metering prose (checkDoneValue JSDoc + README both sides + Agent
  Note both sides): the incremental-work list no longer says "per-key
  JSON.stringify" now that jsonStringBytesUpTo scans without stringifying;
  re-record the README and Agent Note i18n pairings.
2026-08-07 13:27:54 +08:00
Chinesezjc 8a60b5f005 feat(code-runtime-python): make the TypedDict wire mirror an executable gate
Address the two standing review suggestions in this layer rather than deferring
them to PR #4:

- Extend tests/protocol-mirror.e2e.ts to read each py/protocol.py TypedDict's
  required/optional key set and assert it against the wire field names
  src/protocol.ts declares (global included, via functional TypedDict). The
  round-12 class of drift — a renamed/dropped field, or one side making a field
  optional the other requires — now fails a test instead of relying on review.
  Field types remain review-guarded (no mechanical TS/Python equivalent).
- Drop the forward references to PR #4's internal mechanisms from this layer's
  prose: the "256 MiB frame ceiling" figure and the "(index.ts)" fd-3 pinning
  citation become an abstract "host-side inbound frame-size cap" so the JSDoc,
  spec, README, and Agent Note describe only what this layer owns.

Update both README sides and the Agent Note (both languages) to state the
mirror is now executable, and re-record their i18n pairings.
2026-08-07 13:27:54 +08:00
Chinesezjc 8cf253a470 docs(code-runtime-python): sync README metering claim with code and note
Both README sides still described checkDoneValue as "one bounded traversal /
一次有界遍历" — the same overclaim already retracted in the code JSDoc and the
Agent Note. Reword both to match: the walk bounds only the incremental
allocation it adds (escaped-string copy, enqueued children, per-key stringify);
the frame's own width is parsed upstream and capped by the host's fd-3 receive
buffer, not re-bounded here. Re-record README.i18n.yaml.
2026-08-07 13:27:54 +08:00
Chinesezjc 31506dec2d fix(code-runtime-python): correct Chinese translation quality
- Translate README.zh.md's Model Experience body and KV Cache line, which
  were left verbatim in English.
- Convert half-width punctuation to full-width across the README.zh.md
  Known Limitations bullets and the entire Agent Note Chinese side, per
  docs/i18n translation-rules.md Typography (MUST use ,。:()in Chinese prose).
- Re-record both README and Agent Note i18n.yaml pairing hashes.
- Reword the workspace-constraints extra-files comment: this layer's py/
  ships only the wire-protocol mirror; the spawned bootstrap arrives later.
2026-08-07 13:27:54 +08:00
Chinesezjc b3e29e7af5 fix(code-runtime-python): satisfy static gates for the protocol-only layer
- Drop the unused @deepseek-ai/dsh-code-runtime dependency: this layer
  imports nothing from the seam (protocol.ts has no imports; the invariant
  companion uses only cordis and dsh-invariants). The backend-core PR
  re-adds it when PythonCodeRuntime consumes the seam. Fixes knip.
- Point the Agent Note's cross-reference to the seam note at the English
  target on both language sides, per the bilingual-pairing contract (only
  the language switcher flips to .zh.md). Re-record the sidecar.
- Add the Known Limitations section both READMEs require, covering the
  cross-language guard's scope and the deferred runtime implementation.
- Regenerate the module graph for the dropped dependency edge.
2026-08-07 13:27:54 +08:00
Chinesezjc e0f22aeaad feat(code-runtime-python): add the fd-3 frame protocol
Introduce @deepseek-ai/dsh-code-runtime-python with the versionless
JSON-lines protocol between the Node host and the CPython subprocess:
the host-side hostile-frame codec (validateChildFrame, encodeJsonPlain,
checkDoneValue, hasUnsafeIntegerToken, hasNonLosslessNumber,
logTruncationMarker) and the Python-side wire-vocabulary mirror
(py/protocol.py).

This is the protocol layer of the code-runtime-python stack, split from
#436 and based on the multi-language seam extension. The PythonCodeRuntime
implementation and its Python JSON codec land in the backend-core PR on
top of this branch.

Ship the minimal buildable package skeleton (package.json, tsconfig,
tsdown, barrel index, invariant companion, bilingual README) because the
workspace-constraint, coverage, and invariant-topology gates require the
package to exist and build the moment its directory does; the backend-core
PR extends those files rather than creating them.

Align py/protocol.py with src/protocol.ts (the round-12 review of #436
found LogMessage.truncated, DoneMessage.error.kind, and Namespace.errorClass
stale) and guard the two runtime-executed surfaces (PROTOCOL_FD and the log
truncation marker) with a real-python3 cross-language mirror e2e test.
2026-08-07 13:27:54 +08:00