Commit Graph
237 Commits
Author SHA1 Message Date
_Kerman 3e0e419bd2 Merge remote-tracking branch 'origin/master' into xtr/explicit-agent-context
# Conflicts:
#	apps/web/tests/queue-actions.e2e.ts
#	docs/subsystems/tools.i18n.yaml
#	docs/subsystems/tools.md
#	docs/subsystems/tools.zh.md
#	packages/extensions/tool-cordis/src/api-catalog.ts
#	packages/visualizer/tool-visualizer/README.i18n.yaml
#	packages/visualizer/tool-visualizer/README.md
#	packages/visualizer/tool-visualizer/README.zh.md
#	packages/visualizer/tool-visualizer/src/index.ts
#	packages/visualizer/tool-visualizer/tests/loader-composition.spec.ts
#	packages/visualizer/tool-visualizer/tests/model-surface.spec.ts
2026-09-08 19:54:59 +08:00
_Kerman 314ccf08af Merge remote-tracking branch 'origin/master' into xtr/explicit-agent-context
# Conflicts:
#	packages/bundle/headless/tests/headless.spec.ts
#	packages/core/agent-loop/src/agent.ts
#	packages/subagent/subagent/tests/continuation.spec.ts
2026-09-08 17:12:51 +08:00
_Kerman cb3df20cf3 docs(api): remove obsolete media path restrictions 2026-09-08 14:25:50 +08:00
_Kerman 3f1f7da7c3 Merge origin/master into fix/session-prose-local-media-display 2026-09-08 14:25:21 +08:00
_Kerman 40c5ef4fc3 refactor(api): reuse attachment limits for file responses 2026-09-08 12:55:57 +08:00
_Kerman b52966922a fix(api): serve bounded files through the filesystem provider 2026-09-08 12:06:11 +08:00
Turtle a56619d9f7 fix(session): reject empty queue edits 2026-09-08 10:48:32 +08:00
Turtle ae19d9383b fix(session-controller): reject empty prompts 2026-09-08 10:47:36 +08:00
_Kerman dbb9db5f34 docs(session-controller): refresh translation pairing record 2026-09-07 21:05:29 +08:00
_Kerman 68643a07f9 docs(session-controller): unwrap zh readme paragraph 2026-09-07 20:52:09 +08:00
_Kerman 0348599f04 Merge remote-tracking branch 'origin/master' into dshw/pr-deepseek-harness-deepseek-harness-2672
# Conflicts:
#	docs/event-producer-consumer.i18n.yaml
#	docs/event-producer-consumer.md
#	docs/event-producer-consumer.zh.md
#	packages/acp/acp/tests/harness.ts
#	packages/api/session-controller/README.i18n.yaml
#	packages/api/session-controller/README.md
#	packages/api/session-controller/README.zh.md
#	packages/api/session-controller/tests/commands-queue-attachment.host.spec.ts
#	packages/context/agent-instructions/tests/agent-instructions.e2e.ts
#	packages/fs/tool-fs/tests/harness.ts
#	packages/preset/agent-presets/tests/invariant.spec.ts
#	packages/preset/agent-presets/tests/mount.spec.ts
#	packages/preset/agent-presets/tests/remote.spec.ts
#	packages/test-support/agent-loop-testkit/package.json
2026-09-07 20:22:24 +08:00
Yichen Jiang e379fa8bdd release(dsh): 0.1.3-alpha.2 2026-09-07 19:27:06 +08:00
_Kerman 67c5136c7e fix(api): refuse non-regular files before open and bound full streams
- A media-named FIFO or device node is refused before the open would
  block on it (pre-open isFile check); POSIX FIFO regression test added.
- The full-body stream is bounded to the stat'ed size so concurrent
  appends cannot exceed the declared Content-Length.
- Error responses carry no body for HEAD requests.
- Docs no longer overclaim the replacement race: the stat-identity
  comparison narrows (does not fully close) the replacement window, and
  the earlier realpath-to-stat window is acknowledged. Pairs re-recorded.
2026-09-07 18:04:07 +08:00
_Kerman ba4a536030 fix(api): honor only bytes ranges and ignore malformed or multi-range headers
range-parser never validates the range unit, so /api/file now parses only
headers that start with the bytes unit: unsatisfiable ranges answer 416,
while malformed, unknown-unit, and multi-range headers are ignored for a
full 200 body per RFC 9110. The filesystem-root workspace case stays
POSIX-only in tests (a Windows drive-root spelling cannot be constructed
portably); containment already treats any separator-terminated root the
same. Docs (README pair, Agent Note pair) re-recorded.
2026-09-07 18:01:29 +08:00
_Kerman 8b8a051c7a fix(api): address /api/file review findings
- HEAD never opens a file stream; GET streams are destroyed on client
  abort and are never opened for already-aborted requests.
- Validation and reading bind to the same opened file: pre-open and
  opened stat identities are compared, so replacement/re-linking races
  are refused (dev/ino check, read through the FileHandle).
- Workspace containment compares path components, so a filesystem-root
  workspace serves files instead of doubling the separator.
- Multi-range headers are ignored for a full 200 body instead of a
  mislabeled single-segment 206; single-range behavior unchanged.
- Tests now cover the reviewed edges (empty path, multi-range, root
  workspace, HEAD+range, mid/early abort, unreadable file, explicit
  unregister-on-dispose, private outside-target directories); module
  coverage is back at 100/100/100/100.
- Agent Note bilingual facts and the ui-primitives/session-controller
  README pairs are synced to the shipped behavior (pairs re-recorded).
2026-09-07 17:27:57 +08:00
_Kerman 1780d0d355 Merge remote-tracking branch 'origin/master' into xtr/explicit-agent-context 2026-09-07 17:25:46 +08:00
_Kerman 4b009e7f94 refactor(api): shrink media-references surface and reuse maintained libs
- /api/file module now exports only the SessionMediaReferences plugin
  contribution; MIME and range policy helpers are module-private and
  exercised entirely through the registered route.
- Replace the hand-rolled media extension table with mime-types (served
  categories image/video/audio, excluding image/svg+xml) and the
  hand-rolled Range parser with range-parser; keep the fail-closed
  workspace containment policy.
- Spec rewritten as route-level behavior tests (12 cases) covering the
  same branches; Agent Note facts updated in the same change.
2026-09-07 16:35:15 +08:00
_Kerman f81c5072bd fix(api): close coverage edges in media-references route 2026-09-07 16:20:10 +08:00
_Kerman b685a9a6b0 fix(api): satisfy oxlint same-type operand rule in range header 2026-09-07 16:02:14 +08:00
_Kerman 7a715e7919 refactor(api): serve /api/file media by extension allowlist only
Drop the byte-signature sniff duplicated from fs/tool-fs's read_image tool:
the cross-file duplication gate forbids the clone, and no shared owner
exists without widening the attachment package's public API. The
extension allowlist keeps non-media content out; corrupt image payloads
fail in the browser, not on the route. Agent Note facts updated in the
same change.
2026-09-07 15:53:54 +08:00
Dudu-0223 96ead6091d feat(subagent): align human inbox controls (#3223)
* feat(subagent): align continuable human inbox controls

* fix: repair rebase documentation and close test persistence

* docs: refresh rebased module dependency graph
2026-09-07 07:39:39 +00:00
_Kerman 9da174c304 fix(web): display local media paths referenced in session prose
Assistant prose that references a workspace-contained local media path
(e.g. `![](/Users/.../x.png)`) now renders through a same-origin
`GET|HEAD /api/file?path=` route instead of inert alt text.

- ui-primitives: MarkdownText gains a settled-only MarkdownPathImages
  vocabulary gate (same posture as file mentions); no vocabulary means
  byte-identical output.
- ui-chat: AssistantMarkdown supplies a page-stable rewrite vocabulary
  for absolute POSIX paths (local-path-media.ts).
- session-controller: SessionMediaReferences plugin contribution mounts
  the route on the authenticated connection.fetch channel; per-request
  policy = workspace-root containment after realpath, regular file,
  allowlisted media extension (images additionally signature-checked),
  range/HEAD streaming, private no-store + nosniff, fail-closed statuses.
- Agent Note added (feature/2026-09-07-session-prose-local-media-display).

Closes #3662.
2026-09-07 15:34:19 +08:00
_Kerman b759ad91e8 Merge remote-tracking branch 'origin/master' into xtr/explicit-agent-context
# Conflicts:
#	packages/subagent/subagent/src/continuation.ts
2026-09-07 12:09:06 +08:00
Tianyi Cui 40792330c0 fix(system-prompt): keep model persona prefix and place cwd in suffix 2026-09-06 20:35:42 +08:00
Tianyi Cui 165cc31eb8 perf(llm,host): read embedded Assistant streams per compact record
Session format v2 embeds each attempt's compact stream in
assistant/message and assistant/attempt, but Host and client consumers
still expanded it into per-member TimedStreamChunk arrays and did
per-member work; expandAssistantStream materializes the full array before
find/toReversed/break can answer. Session Stats (the projection phase of
every Session open), the token meter's usage and provider-assembly folds,
the subagent output fold, and the Session Controller image lookup still
paid O(members) allocation and time per settlement.

The Chat and Trajectory definitions were already settled from
message.content on master; the remaining per-member folds stay.

dsh-llm now exports record-level readers (first token, visible content,
visible text, last raw chunk of a type, raw chunks of a type, joined
text, run-aware assembly, per-run first-token/first-visible times) that
scan the compact records once with early exit. Session Stats reads
assistantStreamFirstTokenTime, the token meter reads
lastAssistantStreamChunk(stream, 'usage') and assembles through
assembleAssistantStream, the subagent output fold appends
joinAssistantStreamText, and the Session Controller scans
assistantStreamChunks(stream, 'block-end').

expandAssistantStream is deliberately not memoized: retaining expansions
costs roughly ten times the compact stream for the Session's lifetime.
It remains the validating path at durable boundaries.

Synthetic 200-turn v0 migration benchmark, median of five: first-open
projection 28.0 ms -> 5.4 ms, first-open total 76.9 -> 50.0 ms, peak RSS
137.2 -> 94.9 MB; reopen projection 17.8 -> 5.6 ms; all phase budgets and
the 128 MB heap constraint keep passing.
2026-09-06 12:41:25 +08:00
imccyu 9b78f99dec perf(session): transfer frozen persistence reads into restore 2026-09-06 02:10:23 +08:00
Yichen Jiang 14befe7ff7 Merge branch 'master' into release/dsh-0.1.3-alpha.1 2026-09-04 16:16:15 +08:00
creatixchu 58ec1f0867 refactor(file-upload): keep storage helpers and the HTTP route package-private
Stop re-exporting the verbatim file-store helpers from attachment-local, move
the raw-byte upload route handler into a non-entry module of file-upload, and
drop the redundant hook type re-exports from the Client entry. The route test
moves next to the module it exercises.
2026-09-04 15:41:25 +08:00
Yichen Jiang ed67c22496 release(dsh): 0.1.3-alpha.1 2026-09-04 15:38:55 +08:00
creatixchu 268cf0101e Merge remote-tracking branch 'origin/master' into worktree/2984-generic-file-upload 2026-09-04 13:08:41 +08:00
_Kerman 891f07a2d0 Merge remote-tracking branch 'origin/master' into dshw/pr-deepseek-harness-deepseek-harness-2672
# Conflicts:
#	docs/event-producer-consumer.i18n.yaml
#	docs/event-producer-consumer.md
#	docs/event-producer-consumer.zh.md
#	docs/module-graph.i18n.yaml
#	docs/module-graph.md
#	docs/module-graph.zh.md
#	packages/api/session-controller/README.i18n.yaml
#	packages/api/session-controller/README.md
#	packages/api/session-controller/README.zh.md
#	packages/api/session-controller/tests/session-projections.host.spec.ts
#	packages/bundle/headless/tests/headless.spec.ts
#	packages/core/agent-loop/README.i18n.yaml
#	packages/core/agent-loop/README.md
#	packages/core/agent-loop/README.zh.md
#	packages/core/agent/src/runtime-types.ts
#	packages/fs/tool-str-replace-editor/tests/tools.spec.ts
#	packages/llm/llm-retry/tests/retry.spec.ts
#	packages/llm/llm-retry/tests/transport-recovery.spec.ts
#	packages/shell/tool-bash-persistent/tests/loader-composition.spec.ts
#	packages/shell/tool-bash-persistent/tests/tools.spec.ts
#	packages/shell/tool-pwsh-persistent/tests/loader-composition.spec.ts
#	packages/shell/tool-pwsh-persistent/tests/tools.spec.ts
#	packages/terminal/terminal-bash/tests/index.spec.ts
#	packages/test-support/agent-loop-testkit/package.json
2026-09-04 12:18:37 +08:00
Chinesezjc 3f07443702 Merge branch 'master' into fix/test-tmp-teardown-self-clean 2026-09-04 11:15:31 +08:00
creatixchu 48656b4594 test(session-controller): restore Session type import 2026-09-04 10:14:15 +08:00
creatixchu fb743759a7 Merge remote-tracking branch 'origin/master' into worktree/2984-generic-file-upload
# Conflicts:
#	apps/web/tests/scaffold.ts
#	docs/config-catalog.i18n.yaml
#	docs/config-catalog.md
#	docs/config-catalog.zh.md
#	docs/event-producer-consumer.i18n.yaml
#	docs/event-producer-consumer.md
#	docs/event-producer-consumer.zh.md
#	packages/api/session-controller/README.i18n.yaml
#	packages/api/session-controller/README.md
#	packages/api/session-controller/README.zh.md
#	packages/extensions/tool-cordis/src/api-catalog.ts
#	packages/llm/token-meter/src/index.ts
#	packages/session-query/session-log-export/README.i18n.yaml
#	packages/session-query/session-log-export/README.md
#	packages/session-query/session-log-export/README.zh.md
#	packages/session-query/session-log-export/src/archive.ts
#	scripts/package-dependency-policy.ts
2026-09-04 10:12:19 +08:00
Tianyi Cui 86241a442d fix(session): keep independent version fields off the format generation
`SESSION_FORMAT_VERSION` is the only value that names the Session format
generation. Two other version fields had moved to 2 alongside it:

- The `dsh_session_log` request extension's outer schema `version` returns
  to 1 and its Session header projection keeps `seedLength`, derived from
  the logical inherited cut, so the external wire is unchanged in this PR;
  `sessionFormatVersion` alone identifies the embedded generation.
- The `sessionStats` projection unit's `stateVersion` returns to 1: the
  projection cache binds every checkpoint to the format generation, so a
  generation change discards old rows without a unit version bump.

Test doubles and the standalone Client fixture that build a current
header now spell `SESSION_FORMAT_VERSION` instead of the literal.
2026-09-03 22:36:51 +08:00
Tianyi Cui d58964a010 Merge commit 'be5db297c7' into worktree/session-format-05-v1-v2-chunk-migration
# Conflicts:
#	.agents/notes/implemented/architecture/2026-08-31-live-assistant-stream-frames.i18n.yaml
#	.agents/notes/implemented/architecture/2026-08-31-live-assistant-stream-frames.md
#	.agents/notes/implemented/architecture/2026-08-31-live-assistant-stream-frames.zh.md
#	docs/event-producer-consumer.i18n.yaml
#	docs/event-producer-consumer.md
#	docs/event-producer-consumer.zh.md
#	packages/api/session-controller/README.i18n.yaml
#	packages/api/session-controller/README.md
#	packages/api/session-controller/README.zh.md
#	packages/api/session-controller/src/assistant-stream.ts
#	packages/api/session-controller/src/client/sessions/assistant-stream.ts
#	packages/api/session-controller/src/types.ts
#	packages/api/session-controller/tests/assistant-stream.client.spec.ts
#	packages/api/session-controller/tests/session-history-journal.host.spec.ts
#	packages/api/session-controller/tests/sessions-service.client.spec.ts
#	packages/api/session-controller/tests/transport.client.spec.ts
#	packages/core/agent/README.i18n.yaml
#	packages/core/agent/README.md
#	packages/core/agent/README.zh.md
#	packages/extensions/tool-cordis/src/api-catalog.ts
#	scripts/package-dependency-policy.ts
2026-09-03 22:09:31 +08:00
Tianyi Cui fe9c2d7053 refactor(agent, session-controller): drop the unread startedTime frame field
The `start` frame and the reconnect baseline attempt carried a wall-clock
`startedTime` that no Host or Client consumer read: the Host accumulator
and the Client reconciler copied it into their attempt maps and nothing
looked at it again. Presentation frames now carry only the coordinates
consumers use (attempt, revision, turn, step, chunk index, and v1 seq
provenance); the type-equivalence block, event graph, READMEs, and the
live-stream Agent Note follow the type.
2026-09-03 21:58:34 +08:00
creatixchu de022388ea test(ci): stabilize attachment fixtures 2026-09-03 21:25:45 +08:00
creatixchu 0516edb037 test(file-upload): restore host composition fixtures 2026-09-03 21:12:50 +08:00
creatixchu ea669428be refactor(attachment): unify prompt content admission 2026-09-03 20:53:29 +08:00
creatixchu 3eb9736eb6 refactor(file-upload): scope prompt binding rollback 2026-09-03 20:15:18 +08:00
Tianyi Cui 28b16c011a Merge commit 'a123cb0055' into worktree/session-format-05-v1-v2-chunk-migration
# Conflicts:
#	docs/config-catalog.i18n.yaml
#	docs/config-catalog.md
#	docs/config-catalog.zh.md
2026-09-03 18:39:44 +08:00
Tianyi Cui 13074e4aa2 Merge commit '308c1c69a6' into worktree/session-format-04-live-assistant-stream 2026-09-03 18:36:02 +08:00
Tianyi Cui 3aef64797d Merge master into session format migration
# Conflicts:
#	packages/test-support/session-snapshot/src/harness.ts
#	scripts/smoke-python-runtime.py
2026-09-03 18:31:54 +08:00
creatixchu b2c4483c9d refactor(attachment): own prompt admission on service 2026-09-03 18:18:32 +08:00
creatixchu f989df7c8e test(file-upload): cover extensible request identifiers 2026-09-03 17:04:29 +08:00
creatixchu 8a84c1edff test(file-upload): cover isolated service paths 2026-09-03 17:03:14 +08:00
creatixchu 7158227650 fix(file-upload): declare host runtime dependencies 2026-09-03 16:35:50 +08:00
Chinesezjc 0364343a7e test: remove dsh-* temp dirs created by unit tests at teardown
Spec files that create /tmp/dsh-* directories via mkdtemp now track and
delete them in afterEach/afterAll; module-scope fixture dirs (executor
spill dirs) are removed in afterAll. The file list came from the
observed-residue inventory on the self-hosted CI host: only specs whose
dirs actually accumulated were leak sources (issue #3134), superseding
the kept-but-unmerged CI sweep branch per the #3233 review decision.

Product per-process spill roots (dsh-subprocess-local spawn,
dsh-spill-local store) register a process-exit handler that removes the
memoized dir, so processes that used the spawn/spill path clean up on
normal exit. A SIGKILLed process cannot run in-process teardown; the
machine-side timer remains the backstop for that path.

Agent Note: .agents/notes/implemented/process/2026-08-28-test-temp-dir-self-cleanup.md
2026-09-03 16:19:18 +08:00
creatixchu 8fc9a11c5e refactor(attachment): isolate file upload service 2026-09-03 16:10:24 +08:00