Commit Graph

32 Commits

Author SHA1 Message Date
Tianyi Cui
e819a586b0 refactor(acp): reduce bridge to automation protocol 2026-07-24 01:40:25 +08:00
Tianyi Cui
54bc084e5d Merge refreshed schema DSL into canonical tool output
# Conflicts:
#	docs/config-catalog.md
#	examples/headless-agent/tests/snapshots/advanced-toolchain/session.1.jsonl
#	examples/headless-agent/tests/snapshots/advanced-toolchain/session.2.jsonl
#	examples/headless-agent/tests/snapshots/advanced-toolchain/session.jsonl
#	packages/context/workspace-context/tests/workspace-context.spec.ts
#	packages/core/tools/tests/tools.spec.ts
#	packages/ui/tui/src/index.ts
#	packages/ui/tui/tests/tui.snapshot.ts
2026-07-22 21:31:16 +08:00
Tianyi Cui
84f752234d test: make LSP canonical fixture cross-platform 2026-07-22 18:09:53 +08:00
Tianyi Cui
8739abdbfe Merge origin/master into worktree/ci-under-minute 2026-07-22 17:15:46 +08:00
Tianyi Cui
4cd5f21c08 Merge branch 'codex/tool-json-schema-dsl' into codex/canonical-tool-output 2026-07-22 17:05:38 +08:00
Tianyi Cui
769710cfb9 fix(lsp): make transport recovery ownership-safe 2026-07-22 15:56:29 +08:00
Tianyi Cui
2a8e7c661d test(windows): use native PATH delimiter 2026-07-22 14:42:11 +08:00
Tianyi Cui
7b6b544243 test(windows): cover teardown decisions deterministically 2026-07-22 14:34:26 +08:00
Tianyi Cui
5da343126c fix(windows): restore LSP and TUI coverage 2026-07-22 14:23:44 +08:00
Tianyi Cui
6f16715299 test(windows): skip process-group disposal race 2026-07-22 13:37:44 +08:00
Tianyi Cui
cfdc6fcdfb test(windows): skip remaining unstable coverage cases 2026-07-22 13:28:52 +08:00
Tianyi Cui
4643e0de10 test(windows): make coverage fixtures portable 2026-07-22 13:10:48 +08:00
Tianyi Cui
7d3cb39047 Merge branch 'codex/tool-json-schema-dsl' into codex/canonical-tool-output
# Conflicts:
#	.agents/notes/implemented/feature/2026-06-30-interception-seams.md
#	docs/config-catalog.md
#	docs/cookbook/adding-a-tool.i18n.yaml
#	docs/cookbook/adding-a-tool.md
#	docs/cookbook/adding-a-tool.zh.md
#	docs/cordis-catalog/events.md
#	docs/cordis-catalog/services.md
#	docs/core-data-structures/tools.md
#	docs/event-producer-consumer.md
#	docs/persistence-catalog.md
#	examples/acp-agent/tests/snapshots/cordis-inspect-jsdoc/session.jsonl
#	examples/acp-agent/tests/snapshots/cordis-inspect-jsdoc/stdout.expected.jsonl
#	packages/bash/tool-bash/src/index.ts
#	packages/core/agent-loop/src/tool-calls.ts
#	packages/core/agent-loop/tests/cancel.spec.ts
#	packages/core/agent-loop/tests/contract-regressions.spec.ts
#	packages/core/agent-loop/tests/tool-calls.spec.ts
#	packages/core/tools/README.md
#	packages/core/tools/src/index.ts
#	packages/core/tools/tests/code-mode.spec.ts
#	packages/core/tools/tests/tools.spec.ts
#	packages/fs/tool-fs-search/tests/integration.spec.ts
#	packages/fs/tool-fs-search/tests/tools.spec.ts
#	packages/fs/tool-fs/tests/integration.spec.ts
#	packages/mcp/mcp-client/src/tools.ts
#	packages/timeout/timeout-policy/tests/timeout-policy.spec.ts
#	packages/web/tool-web/tests/integration.spec.ts
#	packages/web/tool-web/tests/tool-web.spec.ts
2026-07-21 23:39:03 +08:00
Tianyi Cui
3fa5795bf4 test(lsp): synchronize idle server eviction 2026-07-21 22:09:50 +08:00
Tianyi Cui
ba1e34f8fb test(lsp): synchronize closed-stdin fixture 2026-07-21 21:47:38 +08:00
Tianyi Cui
0004b8675f Merge remote-tracking branch 'origin/master' into codex/enforce-tool-cancellation
# Conflicts:
#	docs/event-producer-consumer.md
#	examples/acp-agent/tests/snapshots/bash-spill/session.jsonl
#	examples/acp-agent/tests/snapshots/escalation-approved/session.jsonl
#	examples/acp-agent/tests/snapshots/escalation-rejected/session.jsonl
#	examples/acp-agent/tests/snapshots/fs-escalation-approved/session.jsonl
#	examples/acp-agent/tests/snapshots/hook-cc-pretool-ask/session.jsonl
#	packages/context/workspace-context/tests/workspace-context.spec.ts
#	packages/core/agent/src/index.ts
#	packages/support/invariants/tests/invariants.spec.ts
#	packages/ui/acp/src/index.ts
#	packages/ui/tui/tests/harness.ts
#	packages/ui/tui/tests/tui.spec.ts
2026-07-21 20:03:00 +08:00
Tianyi Cui
72a48fede6 Merge branch 'codex/tool-json-schema-dsl' into codex/canonical-tool-output
# Conflicts:
#	docs/event-producer-consumer.md
#	packages/context/time-context/tests/time-context.spec.ts
#	packages/context/workspace-context/tests/workspace-context.spec.ts
2026-07-21 19:56:43 +08:00
Tianyi Cui
0ed8e7baf6 docs(lsp): document canonical query results 2026-07-21 19:15:40 +08:00
Tianyi Cui
0cc5009f58 Merge branch 'codex/tool-json-schema-dsl' into codex/canonical-tool-output
# Conflicts:
#	docs/config-catalog.md
#	examples/acp-agent/tests/snapshots/fs-escalation-approved/session.jsonl
2026-07-21 19:15:18 +08:00
Tianyi Cui
071fe76755 Merge latest master into invariant service seam 2026-07-21 18:27:46 +08:00
Tianyi Cui
bc60b9ffe8 fix(lsp): cancel blocked document opens 2026-07-21 13:52:15 +08:00
Tianyi Cui
2fd995bf3c fix(lsp): align operations and harden lifecycle 2026-07-21 13:29:40 +08:00
Dudu-0223
be84a73f56 Stabilize process-group coverage across POSIX 2026-07-20 14:40:18 +08:00
Dudu-0223
ca1cc61dfb Merge origin/master into lsp 2026-07-20 13:54:38 +08:00
Dudu-0223
a5c7732592 fix(lsp): address lifecycle review feedback 2026-07-17 16:32:34 +08:00
Dudu-0223
e92ec69f32 refactor(lsp): drop redundant side-effect type import
The value import of LspProviderId already pulls in the cordis module
augmentation for ctx.lsp, so the separate `import type {}` is dead.
2026-07-16 17:57:18 +08:00
Dudu-0223
a63c55eb00 refactor(lsp): configure local servers together 2026-07-16 17:31:20 +08:00
Dudu-0223
0d8e7e98f7 fix(lsp): harden local provider lifecycle 2026-07-16 16:42:32 +08:00
Dudu-0223
43d419ac5c fix(lsp): address codex review round 3
Final review pass on the local provider:
- Tear the instance down when `initialize` REJECTS (utf-8 negotiation, malformed
  result), not only on abort, so a permanently-rejecting `ready` is never pooled.
- Use the group-aware SIGKILL on a framing failure so helpers are reached.
- Validate maxMessageBytes and maxDocumentBytes positive at load alongside the
  other byte caps.
- Fix the location renderer's outside-workspace check to match a `..` segment
  exactly, so an in-workspace path like `..generated/a.ts` stays relative.
- Document the accepted ancestor-directory symlink-swap TOCTOU under the
  trusted-host model (O_NOFOLLOW guards only the final component).
2026-07-16 14:17:21 +08:00
Dudu-0223
0f3f0efd9c fix(lsp): address codex review round 2
Further lifecycle/safety hardening of the local provider:
- Tear the instance down when the initialize handshake is aborted, so a
  poisoned pending `ready` can't make later queries for that workspace re-wait.
- Make the serialized-queue wait itself abortable, so a query blocked behind
  hung earlier work can still observe its own timeout.
- Spawn the server detached and signal the whole process group on teardown, so
  helper processes (e.g. tsserver) can't outlive dispose().
- Open the source with O_NOFOLLOW and cap the read at maxDocumentBytes+1, closing
  the symlink-swap and concurrent-grow windows the fd-based read left open.
- Honor an already-aborted signal before any host I/O or startup.
- Validate maxStderrBytes positive at load; surface the retained stderr tail in
  the "language server exited" error so a fatal startup diagnostic is visible.
2026-07-16 13:34:37 +08:00
Dudu-0223
8e8f90e235 fix(lsp): address codex review round 1
Lifecycle and safety fixes from the external review:
- Observe abort while awaiting the initialize handshake, so a server that never
  replies can't defeat the tool-timeout signal.
- On an aborted request the server won't cancel, tear the instance down after a
  bounded grace instead of releasing the serialized queue with work still live
  (prevents overlapping document lifecycles).
- Re-check provider disposal after the canonicalize/read awaits so a query can't
  spawn an unowned server after disposeAll().
- Read the source through one open handle (stat + read on the same fd) to close
  the realpath-vs-read TOCTOU; decode with a fatal UTF-8 decoder so a legitimate
  U+FFFD is not misclassified as invalid.
- Validate and read the source BEFORE spawning a server (pre-start rejection).
- Require an explicit openClose for option-form textDocumentSync.
- Reject nonpositive teardown budgets and non-executable absolute commands at
  load; surface unsupported operations as structured LSP_UNSUPPORTED_OPERATION.
- Retain the stderr tail (fatal diagnostics land at exit), not the prefix.
- Catalog the seam vocabulary in docs/core-data-structures/lsp.md.
2026-07-16 13:11:07 +08:00
Dudu-0223
d0029d8d60 feat(lsp): LSP capability seam, generic stdio provider, and lsp tool
Implements the LSP capability seam RFC as three packages: dsh-lsp (the
ctx.lsp interface — provider registry by branded id + exclusive extension
mapping, per-query order-independent selection, closed request/result
vocabulary, LspError taxonomy), dsh-lsp-local (a generic stdio language-server
provider — Content-Length JSON-RPC framing, per-(provider, workspace) process
single-flight, transient didOpen/query/didClose, an abortable per-instance
queue, UTF-16 negotiation, host-namespace source reads outside ctx.fs, and
bounded shutdown/kill teardown), and dsh-tool-lsp (the model-facing lsp tool —
four operations, one-based UTF-16 cursor conversion, workspace-grouped location
rendering, hover capping, a required session workspace, and a timeout budget).

Why: an agent had text search and file reads but no way to identify a program
symbol — follow an alias, connect an interface to implementations, or read an
inferred type — before changing code. Splitting model contract, seam, and local
subprocess behavior keeps the four semantic queries stable across future remote
or sandbox-native providers without leaking a JSON-RPC escape hatch.
2026-07-16 12:05:35 +08:00