Files
deepseek-harness/packages/pty/pty
imccyu ec601ca13d build(vendor): rescope the vendored Cordis packages into @deepseek-ai
Machine-produced by `pnpm run rescope-vendor --apply` plus the regeneration it
prints: `pnpm install` for the lockfile, `pnpm run gen-third-party-notices`,
`verify-translation-pairing --write` for the touched bilingual pairs,
`gen-doc-graphs`, and one typert snapshot whose ids embed character offsets.
`pnpm run rescope-vendor --check` verifies the result.

Renames nine vendored packages (cordis, cosmokit, schemastery and the six
@cordisjs plugins) and every reference that resolves them: manifest names and
dependency keys, module specifiers including declare-module merges, cordis.yml
plugin names, tsconfig paths, every Markdown fence, and `docs/` prose.
Directory names, upstream versions, and dependency ranges are unchanged, so
vendor/README.md still reads as an upstream snapshot; its manifest table gains
an upstream-name column so THIRD_PARTY_NOTICES keeps MIT attribution pointed
at each fork's origin.

The tutorial tier follows the rename end to end: its yaml fences named plugins
the Loader can no longer resolve, its `ts ignore-check` fences disagreed with
the compiled fences beside them, and its prose quoted both. The contracts that
told readers to keep upstream names — the root convention and the vendoring
cookbook's tree comment and manifest invariant — now say to rescope instead.

Two rules read `@deepseek-ai/` as "another workspace plugin": the client bundle
purity gate now names the vendored libraries a browser bundle inlines, and the
files where a bare `cordis` is an agent-preset id keep that product data.
2026-08-10 22:04:13 +08:00
..
2026-07-26 05:06:39 +08:00

@deepseek-ai/dsh-pty

English | 中文

Owner-scoped persistent PTY seam. PtyService registers as ctx.pty, mints opaque session ids, routes creation through named backends, fences every operation to the exact live Agent, and awaits backend quiescence when that agent or the service disposes.

Contract

  • Backends register one stable type and return an unpublished PtyBackendSession; failed or cancelled setup must clean partial resources, and a failed cleanup rejects with PtyBackendCleanupError so the registry can retain it across cancellation.
  • Spawn cancellation preserves the caller's exact abort reason. Service disposal and owner loss remain distinct machine-routable failures after backend setup.
  • Owner and service disposal abort unpublished setup through a service-owned signal and await backend settlement plus rollback before returning.
  • A rollback-close or backend-reported startup cleanup failure rejects the disposing lifecycle instead of claiming quiescence. Caller-triggered cancellation still receives its exact reason; lifecycle-triggered rollback failure also rejects the pending spawn.
  • A backend cleanup failure that follows caller cancellation remains owner activity until owner or service disposal consumes and reports it, so lifecycle policy cannot mistake failed cleanup for quiescence.
  • hasOwnerActivity(owner) spans unpublished setup through final close, so lifecycle policy can fence the exact owner without a publication race.
  • A successful spawn publishes one PtySessionId. The optional name is owner-local display metadata, never authority.
  • One session accepts at most one live send operation. Reads and signals may observe it; another send fails until the operation settles.
  • PtySendResult.waitReason and sessionStatus are independent. session_exit describes the top-level PTY process, not an arbitrary foreground command.
  • kill() and disposal resolve only after the backend's captured process tree is quiescent. A cleanup failure rejects instead of claiming success and clears the matching backend and registry fences so a later close can retry without disturbing a newer attempt.

The seam contains no node-pty, sandbox, tool-schema, prompt, task, or terminal-rendering policy. Implementations own terminal mechanics; consumers own model presentation and optional background-task registration.

Model Experience

Indirect consumer

What the model sees

Nothing directly. This package registers no prompt or tool; @deepseek-ai/dsh-tool-pty owns visible schemas and result text.

Token effect

None directly. Live session state stays process-local until a consumer returns a bounded result.

KV Cache effect

No direct invalidation; the named consumer owns request-prefix changes.

Known Limitations and Deferred Work

  • Sessions are process-local and are not restored after a harness restart.
  • Cross-agent sharing is intentionally absent; a future shared-session design needs a separate authority contract.