12293 Commits

Author SHA1 Message Date
Tianyi Cui
5299e43bed fix(session): snapshot seed + appended data at the boundary (review #31)
The source-level JSON-serializability invariant was only a preflight: the
Session constructor copied the seed array but shared every event/data
object with the caller, and append() stored the caller's `data` reference
verbatim. A post-create/post-append mutation could rewrite the durable
log or reintroduce a non-JSON-serializable value AFTER validation, so
session.events could diverge from what was validated / what a backend
can persist.

- ctor deep-clones each seed event after validation (not just the array).
- append() stores structuredClone(data) (serializability already checked,
  so the clone is safe); the returned event carries the same snapshot.

Regression tests: mutating the original seed / the passed append object
after the call leaves session.events unchanged. Adapted the dev-freeze
invariants test to assert on the logged clone (append no longer freezes
the caller's input). Documented isJsonValue's exact scope (own enumerable
string keys, matching JSON.stringify) and synced the README create()
signature with meta.createdAt.
2026-06-15 23:33:00 +08:00
Tianyi Cui
ccbc4f533f fix(session-persistence-sqlite): JSONL parity on append snapshot + corrupt-tail load
Two parity gaps with the JSONL backend found in review:

- append() now validates serializability and structuredClones the batch
  synchronously at call time, BEFORE waiting behind the per-session
  chain. A caller that mutates the passed array (or an event inside it)
  after the call can no longer corrupt the persisted copy or advance the
  cursor past what was written. Matches the JSONL backend.

- load() now computes the last-turn/end cut from the seq+type COLUMNS
  only (cutAtLastTurnEnd is generic over {seq,type}); event `data` is
  JSON-parsed only for the committed prefix, never for the uncommitted
  tail. A malformed `data` in a crash tail is discarded, not treated as
  unloadable — only a parse error/gap in the COMMITTED region is
  unloadable (the SessionPersistence.load contract). Matches scanLog.

Regression tests for both.
2026-06-15 22:23:36 +08:00
Tianyi Cui
bc670e69f3 Merge branch 'split/agent-factory' into split/session-persistence-sqlite 2026-06-15 22:14:02 +08:00
Tianyi Cui
6455a1600d Merge branch 'split/session-persistence' into split/agent-factory 2026-06-15 22:13:51 +08:00
Tianyi Cui
5f3a1e4d60 Merge branch 'split/turn-enclosure' into split/session-persistence 2026-06-15 22:13:40 +08:00
Tianyi Cui
3cc074ba5c Merge branch 'split/session-meta' into split/turn-enclosure
# Conflicts:
#	packages/agent-loop/tests/review-fixes.spec.ts
2026-06-15 22:13:22 +08:00
Tianyi Cui
611791ba7f Merge remote-tracking branch 'origin/master' into split/session-meta 2026-06-15 22:10:21 +08:00
Tianyi Cui
30765bd6d5 Merge pull request #24 from deepseek-ai/fix/registration-atomicity
fix: registration atomicity across the six registration methods
2026-06-15 22:09:50 +08:00
Tianyi Cui
328863e458 Merge pull request #23 from deepseek-ai/fix/agent-loop-tool-result-callid
fix(agent-loop): log tool/result under the originating call.id
2026-06-15 22:09:32 +08:00
Tianyi Cui
c0257dafcb Merge pull request #22 from deepseek-ai/fix/agent-loop-turn-step-balance
fix(agent-loop): always close a started turn and any open step on error
2026-06-15 22:09:11 +08:00
Tianyi Cui
247c408e75 Merge pull request #21 from deepseek-ai/fix/agent-loop-step-start-order
fix(agent-loop): append step/start before emitting agent/step-start
2026-06-15 22:08:52 +08:00
Tianyi Cui
4e3524f859 Merge pull request #20 from deepseek-ai/docs/sync-doc-sync-gate-and-invariants
docs: sync high-authority docs with the doc-sync gate and dsh-invariants
2026-06-15 22:07:39 +08:00
Tianyi Cui
9126697d87 feat(session-persistence-sqlite): second backend validating the abstraction
Add a SQLite SessionPersistence backend (node:sqlite), a SECOND
implementation built to prove the abstract seam + the shared
runPersistenceContract suite are genuinely backend-agnostic. Each
SessionEvent maps 1:1 onto an events row (session_id, seq, type, time,
data); append is an INSERT inside a transaction asserting the
contiguous-seq contract; the mutable SessionSummary lives in the
sessions metadata row.

It satisfies the SAME contract semantics as the JSONL backend, expressed
over rows instead of file bytes:
- Lazy materialization: create() records intent in memory; no row until
  the first append (a never-appended session is absent from has()/list()
  via a materialized flag set inside the first append transaction).
- Crash-tail-on-load: load() returns events only through the last
  complete turn/end and deletes the uncommitted tail; a seq gap in the
  committed region makes the session unloadable.
- Transactional append: a mid-batch failure (a UNIQUE seq collision from
  a concurrent writer) rolls back entirely, keeping the cursor truthful.

Like the JSONL backend it is also the write-path plugin (session/event →
buffer → session/flush drain, onCreated seed/adopt/collision handling,
HMR seeding, dispose-to-quiescence). The package runs the shared
runPersistenceContract suite plus SQLite-specific tests (transaction
rollback, crash-tail cut, schema version, HMR adoption).

Docs flip every "SQLite is future/deferred" reference (ADR 0016,
architecture.md, the persistence module doc + README) to "implemented;
the contract holds both backends to identical semantics".
2026-06-15 21:45:21 +08:00
Tianyi Cui
9a4006cb2b feat(agent): create/resume factory seam
Add the agent-creation factory seam on ctx.agents (AgentRegistry):
setFactory/create/resume plus the AgentFactory interface and
CreateAgentOptions/ResumeAgentOptions. AgentLoop implements AgentFactory
and registers itself via ctx.agents.setFactory(this), so plugins
create/resume agents through the interface without depending on the
concrete loop package.

- create({ agentId, sessionId, meta?, agentOptions? }) — programmatic
  create on a caller-supplied session id (e.g. an ACP-generated id).
- resume({ agentId, resumeSessionId, agentOptions? }) — load a persisted
  session via ctx.sessionPersistence (RFC 009) and resume an agent on it;
  the live session id is the resumed id, turn numbering and derived
  history continue from the loaded log. sessionPersistence is NOT
  hard-injected (non-persistent demos still work); resume rejects with a
  typed error when it is absent. assertAgentIdFree runs before any
  session is created (and again after the load await) so a duplicate id
  never leaves an orphaned live session.

Adds the runtime dsh-session-persistence dependency to agent-loop.
2026-06-15 21:12:14 +08:00
Tianyi Cui
df4b7d3d9a feat(session-persistence): abstract seam + JSONL backend + wiring
Add the durable session-persistence capability seam (ADR 0016): an
abstract SessionPersistence service (dsh-session-persistence,
ctx.sessionPersistence) defining create/append/load/list/has/delete/
update over the existing SessionEvent — no parallel persisted type — and
a first implementation (dsh-session-persistence-jsonl): an append-only
JSONL log per session with crash-safe atomic writes, truncation-repair
of a never-committed crash tail, and a read/replay path. SessionMeta
(format version, cwd, lineage) travels out-of-log via session.header.

A shared runPersistenceContract suite holds every backend to the same
append-only / contiguous-seq / lazy-materialization / serializability
semantics.

Config-driven create() now uses a per-run ${id}-session-<uuid> session
id so a fixed name no longer collides with an on-disk log once a durable
backend is loaded; each run is a new session (a demo simplification). The
examples drop their hand-rolled session-jsonl.ts and load the JSONL
backend via cordis.yml; CI smoke-loads it too.

The agent-facing create/resume factory that consumes load() is a
separate seam, deferred to a follow-up; this change stops at the load
primitive and does not reach into the loop.
2026-06-15 21:05:46 +08:00
Tianyi Cui
b0bc0b5792 feat(agent-loop): turn-enclosure invariant + post-turn error model
Every session event now lives inside a turn (between turn/start and its
turn/end). The loop records queued user/message events AFTER turn/start;
an idle agent.inject() wraps its context/message in a one-shot injection
turn. This makes the turn the single durability/replay boundary so a
persistence backend can treat anything after the last turn/end as a
crash tail without dropping legitimate between-turn context.

A failure once the turn is already closed (rejecting session/flush, a
throwing agent/turn-end listener) has no in-turn position for a session
error event, so it is reported via agent/error + logger only; the turn
stays balanced. failTurn appends an error event only while the turn is
open.

The dsh-invariants plugin enforces turn-enclosure via a default case:
every non-boundary event type — including plugin-added merge-extensible
keys — must sit inside an open turn or it throws.

Documented in ADR 0017 + architecture.md.
2026-06-15 20:56:17 +08:00
Tianyi Cui
0731ed374b feat(session): metadata seam + JSON-serializability invariant
Adds the durable-session metadata seam and enforces the log's
JSON-serializability invariant at the source:

- SessionHeader / SessionSummary / SessionMeta and CreateSessionOptions in
  dsh-session; Session gains a readonly `header`; SessionStore.create takes
  `(id?, options?: { seed?; meta? })` (validated absolute cwd, parentSession
  lineage). The injection TurnTrigger variant is added for the idle-inject
  one-shot turn that a later change introduces.
- isJsonValue (new json.ts): a value round-trips through JSON losslessly —
  rejects BigInt, function, symbol, undefined, non-finite numbers, sparse
  arrays, circular refs, and exotic objects (Map/Set/Date/class instances).
- Session.append throws on non-JSON-serializable data, and the Session
  constructor validates every seed event (isJsonValue + contiguous seq from
  0), so a replay/fork seed can never build a live log no backend can
  persist — the source-level guarantee a durable backend relies on.

Migrates the ~3 internal positional-seed `create(id, seed)` call sites to
`{ seed }`, and adapts the invariants tests forced by the new guard (the
bad-seq seed is now caught by the constructor; the cyclic deep-freeze test
drives via session/event since append rejects cyclic data; a direct
session/event drives the invariants seq-monotonicity check). Docs kept
backend-agnostic (the persistence packages arrive in a later PR).
2026-06-15 17:54:55 +08:00
Tianyi Cui
3783f3e178 fix(agent-loop): surface throwing step-end listener as turn error via failTurn
closeStep() previously caught and silently swallowed a throw from
agent/step-end emit. In the normal no-tool/no-steering path, this
caused runTurn to reach closeTurn(true) with reason still
{kind:completed}, so the session recorded a completed turn with
zero error events — even though a plugin had failed at a loop
boundary. This violates the contract that a throwing plugin is
contained as a turn error, not a silent success.

Now the catch calls failTurn(toError(error)), which appends the
single error event and sets reason={kind:error,…}. failTurn is
idempotent (errorReported guard), so existing error paths that
call failTurn after closeStep are unaffected.

Add regression test: a throwing agent/step-end listener during a
successful step now produces exactly one error event, a turn/end
with reason error, balanced boundaries (step/end before turn/end),
and a surviving loop.
2026-06-15 17:43:33 +08:00
Tianyi Cui
76602a0844 Merge pull request #26 from deepseek-ai/worktree-docs+rfc012-multi-backend
docs: note multi-language Code Mode backends in RFC 012
2026-06-15 08:45:15 +08:00
Tianyi Cui
a1eea4d36e docs: note multi-language Code Mode backends in RFC 012
Clarify that the CodeRuntime seam can host backends differing by
language/runtime, not just trust level — e.g. an AssemblyScript/WASM
backend (naturally sandboxed) and a Python backend over CPython or a
more controllable/embeddable interpreter. Note the execution contract
is language-agnostic while SDK codegen/prompt presentation is per-
language, and add these backends to the deferred follow-up list.
2026-06-15 08:37:45 +08:00
Tianyi Cui
2638ec9f3f Merge pull request #19 from deepseek-ai/worktree-rfc-012-code-mode
docs: RFC 012 — optional Code Mode for all tools
2026-06-15 01:54:47 +08:00
Tianyi Cui
1b7c376aec docs: address second-round PR review on RFC 012 (alternatives, framing)
- Add an Alternatives section comparing Code Mode against the narrower
  result-elision/summarization route over native tool-calling (solves
  context-bloat but not composition/round-trips) and against parallel native
  dispatch (a core-loop change that still lacks composition); states why
  Code Mode is chosen and why the new code-execution surface is the price.
- Fix the Problem-section framing: it said the model "can run independent
  calls concurrently," which contradicted the serialize-by-default decision.
  Reworded to "express fan-out, initially serialized until concurrency-safety
  metadata exists" — early win is composition + fewer round-trips, not parallelism.
2026-06-15 01:46:26 +08:00
Tianyi Cui
6d9934103d docs: address PR review on RFC 012 (concurrency, vm guard, prompt budget)
- Concurrency: change from "may serialize" to mandatory serialize-by-default
  via a per-run dispatch queue in the SDK bindings, with a non-overlap test as
  a hard acceptance criterion (the binding shape otherwise makes Promise.all
  dispatch concurrently before the tool contract has concurrency-safety metadata).
- node:vm guard: make it enforceable, not a README warning — CodeRuntime exposes
  safe:boolean, the VM stub throws unless constructed { unsafe:true }, and
  code-mode refuses to register run_code over an unsafe runtime unless separately
  acknowledged (allowUnsafeRuntime); refusal path is tested.
- Prompt budget: drop the "zero prompt tokens" claim (the SDK .d.ts is injected
  into the system prompt, so types do consume context) and add the explicit
  budget/caching tradeoff — Code Mode's saving is on output/round-trips, not the
  input-side tool description.
2026-06-15 01:39:21 +08:00
Tianyi Cui
1cc6e1caf7 docs: add RFC 012 (optional Code Mode for all tools)
Proposes an optional Code Mode where the model writes a TypeScript program
against a generated SDK wrapping every registered tool, instead of emitting
one native tool-call per step. Implemented Cordis-style as a capability-seam
trio (code-runtime interface / code-runtime-vm node:vm reference stub /
code-mode consumer plugin) with zero core-package changes; the hardened
execution substrate is deferred to a follow-up RFC.
2026-06-15 01:20:09 +08:00
Tianyi Cui
2df41ee1d3 fix: make the six registration methods atomic under a throwing change-listener (P1-1)
llm.registerAdapter, agents.register, sessions.create, systemPrompt.section,
systemPrompt.tools, and tools.register each mutated state, emitted a change
event, then returned the disposer. In Cordis a synchronous throw before the
effect returns its disposer leaves nothing for the fiber to collect, so a
throwing change-listener leaked the registry entry permanently — HMR/dispose
could not clean it, and the duplicate-name/already-exists check stayed wedged
until restart.

Convert each to the generator-effect pattern already proven in
AgentLoop.create: mutate state, `yield` the disposer that undoes it (collected
before the next step runs, so it is torn down if a later step throws), THEN
emit the change event. The existing duplicate-name throws are unchanged — they
fire before any mutation, so they correctly leak nothing. No public API change:
generator effects are still synchronous SyncEffects and register() keeps
returning its fire-and-forget disposer wrapper.

Tests: a listener-throw rollback test for all six methods — register with a
change-listener that throws, assert the call throws AND the registry is clean
(entry absent; a subsequent listener-free register of the same name succeeds
and contributes exactly once). For systemPrompt (no duplicate-name check) the
two tests assert assembly is clean. Verified each fails against the pre-fix
emit-before-return-disposer form.
2026-06-15 01:06:13 +08:00
Tianyi Cui
37576ade6a fix(agent-loop): log tool/result under the originating call.id (P1-7)
The loop passed the authoritative call.id into ctx.tools.execute() but then
appended tool/result using result.callId — the value a tools/execute waterfall
listener returns — with no check. A listener returning a mismatched id silently
recorded the result under the wrong call. callId is the model-transcript
correlation id: deriveMessages() turns it into the tool-result block's
toolCallId, which must pair with the assistant tool-call block; a wrong id
orphans that pairing in the next model request.

Append tool/result with callId: call.id (the loop's authoritative id). A
listener-internal id, if ever worth keeping, belongs in a separate diagnostic
field — never overloaded onto callId.

Test: a tools/execute listener returns a wrong callId; assert the logged
tool/result.callId equals call.id AND deriveMessages() yields a tool-result
block whose toolCallId equals call.id (not the wrong returned id). Verified the
test fails on the pre-fix result.callId behavior.
2026-06-15 01:06:13 +08:00
Tianyi Cui
22e9152d8b fix(agent-loop): always close a started turn and any open step on error (P1-5)
After turn/start was appended, nothing guaranteed a matching turn/end: a throw
from a boundary emit (agent/turn-start, agent/step-start, the normal-path
agent/turn-end) escaped runTurn, and the outer runLoop backstop logged an
error but never appended turn/end — leaving an unbalanced turn that replay,
telemetry, and the invariants plugin all assume is impossible.

runTurn is restructured around idempotent finalizers that satisfy the four
traps a naive finally would hit:
- closeStep()/closeTurn(emit) are guarded (stepOpen/turnEnded) so they run at
  most once; the agent/step-end and agent/error emits are contained so a
  throwing listener can't strand the turn open.
- failTurn() records the single error event + reason and emits agent/error
  exactly once (errorReported guard) — no double-logging when the outer catch
  also runs (e.g. a step error followed by a throwing turn-end listener).
- the catch closes an open step BEFORE turn/end (invariants reject turn/end
  while a step is open), and rethrows ONLY pre-turn throws (turnStarted false),
  where no turn/end is owed, so the backstop still nets them.
- disposal precedence: reason stays disposed only when disposed AND no error
  was reported; otherwise the error reason wins.

Tests (with the invariants plugin loaded as a balance oracle): throwing
turn-start (one error, one turn/end, no step), throwing step-start (step/end
before turn/end), throwing agent/error on a step-error path (balanced, loop
survives), disposal mid-turn (reason disposed, no error event), a pre-turn
turn/start-append throw (rethrown to the backstop, no turn/end owed), and a
step error + throwing turn-end listener (error logged exactly once). Verified
all six fail against a simulated finalizer bypass. dsh-invariants added as an
agent-loop devDependency (test-only oracle; no package cycle).
2026-06-15 01:06:13 +08:00
Tianyi Cui
9d5b3ab832 fix(agent-loop): append step/start before emitting agent/step-start (P1-6)
Every loop boundary appends the session event before emitting the Cordis
event (ADR 0003's append-before-emit rule) — except step/start, which was
inverted. A listener on agent/step-start that inspected session.events could
not see the step it was just told had started.

- Swap the two lines so session.append('step/start') precedes the emit.
- Fix the two stale pseudo-code copies (the runLoop JSDoc STEP-loop block and
  docs/architecture.md) so neither shows step-start emitted before the append.
- Regression test: a step-start listener observes the matching step/start
  event already at the tail of session.events. Verified the test fails on the
  pre-fix (emit-first) order.
2026-06-14 23:18:41 +08:00
Tianyi Cui
bcfff6f1ee docs: correct the doc-sync gate claim in the code-review skill (PR1 review)
Codex review of PR1 found a semantically-identical stale claim outside the
three files first touched: .agents/skills/dsh-code-review/SKILL.md said "the
doc-sync rule has no gate", which is the same P1-16 drift. doc-sync DOES gate
compilable ts blocks and the event-taxonomy table; only prose drift (config
keys, defaults, error codes, wire fields) is ungated. Reworded to say exactly
that.

(ADR 0014 was also checked and is correct as-is — it is the decision record
that establishes the gate and already describes it as existing.)
2026-06-14 23:14:46 +08:00
Tianyi Cui
b8d4790e98 docs: sync high-authority docs with the doc-sync gate and dsh-invariants (P1-16)
The `yarn doc-sync` gate (doc-typecheck + verify-event-taxonomy) and the
@deepseek-ai/dsh-invariants package both exist now, but the instruction docs
never caught up and the gate's markdown scope (README.md, docs/**/*.md,
packages/*/README.md) does not cover AGENTS.md / packages/AGENTS.md, so they
drifted silently.

- AGENTS.md: add invariants/ to the Repository Layout; add doc-typecheck /
  verify-event-taxonomy / doc-sync to Commands; rewrite the false "CI has no
  doc-sync gate" sentence to describe the gate's actual coverage and what
  remains outside it (AGENTS.md, packages/README.md, prose drift).
- packages/AGENTS.md: fix the same stale "no doc-sync gate" line.
- packages/README.md: add dsh-invariants to the dependency graph and the
  package table.

Verification: `yarn doc-sync` green; `grep -rn "no doc-sync gate"` returns
nothing; the three command names + dsh-invariants are present.
2026-06-14 23:07:52 +08:00
Tianyi Cui
5cec4c2f65 Merge pull request #18 from deepseek-ai/feat/rfc009-011-acp-and-persistence
docs: RFCs 009-011 — session persistence + ACP support
2026-06-14 22:02:02 +08:00
Tianyi Cui
de73afbe39 docs: resolve self-consistency follow-ups on RFCs 009-010
- 009: the crash-tail "overwrite" contradicted the append-only contract.
  Name it explicitly as a one-time truncation-repair (ftruncate+fsync to
  the last complete turn/end byte offset) that removes only the
  never-committed crash tail; committed events are never rewritten.
  Qualify the append/impl/ADR wording to match.
- 010: remove the remaining concrete-loop references — the session/new
  and session/load table rows now point at the dsh-agent create/resume
  factory, and the Risks disposal line uses the interface-level settle
  signal (agent/status) instead of LoopAgent-only agent.done.
2026-06-14 21:57:59 +08:00
Tianyi Cui
64ce7caedc docs: address review on RFCs 009-011
Resolve the inline review feedback on PR #18 (all verified against the
codebase, the published @agentclientprotocol/sdk@0.25.1 tarball, and
Cordis fiber semantics):

- 009: dsh-session owns SessionMeta (persistence re-exports) to avoid a
  package cycle; split mutable summary into a sidecar so the event log
  stays append-only and list/load can return it; pick one load-repair
  rule (resume from the last complete turn/end, overwrite the orphan).
- 010: SDK has a zod peer dep + runtime zod/v4 import (drop "zero runtime
  deps"); session/new needs a create seam taking {sessionId, meta};
  propose an abstract create/resume factory on dsh-agent so the bridge
  depends on the interface not the loop, and observe agent/status for
  quiescence since agent.done is LoopAgent-only; add the explicit
  TurnEndReason -> ACP StopReason wire mapping + test; reject non-empty
  additionalDirectories for the MVP; remove the EOF blank line.
- 011: ctx.extend() does not create a disposable fiber — use a real
  per-session disposer scope.
2026-06-14 21:43:16 +08:00
Tianyi Cui
a44f7f3486 docs: add RFCs 009-011 (session persistence + ACP support)
Three proposal documents, numbered in dependency order:

- RFC 009: an abstract, append-only, event-based SessionPersistence
  service over the existing SessionEvent log (no parallel persisted
  type), a JSONL impl, a SessionMeta header seam, and an async
  AgentLoop.resume path. Design informed by Codex/Claude Code/
  opencode/pi. Core design point; unblocks resume + ACP session/load.
- RFC 010: ACP (Agent Client Protocol) support as a dsh-acp
  client-driver plugin on @agentclientprotocol/sdk, mapping ACP onto
  the agent/* events and the tools/execute permission seam. Builds on
  009 for session/load; single active session.
- RFC 011: multiplex concurrent ACP sessions over one connection
  (bridge-layer change; downstream of 010).
2026-06-14 21:14:51 +08:00
Tianyi Cui
87608f3c32 Merge pull request #16 from deepseek-ai/codex/dev-guide
docs: add development setup guide
2026-06-14 12:20:45 +08:00
Tianyi Cui
d82b4e0d88 Merge pull request #17 from deepseek-ai/feat/rfc005-error-taxonomy
RFC 005 pt 2: structured error taxonomy (HarnessError base)
2026-06-14 12:20:18 +08:00
Tianyi Cui
204c36ed76 Merge pull request #15 from deepseek-ai/feat/rfc006-doc-sync
RFC 006 pts 1-2: doc-sync gates (doc code blocks + event taxonomy)
2026-06-14 12:19:54 +08:00
Tianyi Cui
751403bd1a Merge pull request #14 from deepseek-ai/feat/rfc001-property-tests
RFC 001: property-based testing for protocol-shaped code
2026-06-14 12:19:28 +08:00
Tianyi Cui
9b1507a2b7 Merge pull request #12 from deepseek-ai/feat/rfc005-arg-validation
RFC 005 pt 1: runtime tool-arg validation
2026-06-14 12:16:24 +08:00
Tianyi Cui
7586caf2dd docs: clarify Node CI matrix 2026-06-14 11:28:00 +08:00
Tianyi Cui
f2524e9c45 docs: sync dev guide with stacked gates 2026-06-14 10:52:46 +08:00
Tianyi Cui
0853f52f49 docs: split README guidance by audience 2026-06-14 10:50:10 +08:00
Tianyi Cui
40298c2847 docs: compact README guidance 2026-06-14 10:50:10 +08:00
Tianyi Cui
c3a3b6ae41 docs: clarify CI and hook gates 2026-06-14 10:50:10 +08:00
Tianyi Cui
91d7515fd8 docs: add development setup guide 2026-06-14 10:50:10 +08:00
Tianyi Cui
58627f075d Merge branch 'feat/rfc006-doc-sync' into feat/rfc005-error-taxonomy 2026-06-14 10:44:29 +08:00
Tianyi Cui
75044c9711 Merge branch 'feat/rfc001-property-tests' into feat/rfc006-doc-sync 2026-06-14 10:44:21 +08:00
Tianyi Cui
1c61efccf8 Merge branch 'feat/rfc005-dev-invariants' into feat/rfc001-property-tests 2026-06-14 10:44:00 +08:00
Tianyi Cui
bed91b46d5 fix(tools): give the unknown-tool failure a structured error code
The registry's unknown-tool branch returned isError text with no { name, code },
so a model-requested unknown tool logged an unroutable tool/result — a gap in
exactly the taxonomy this PR adds. Introduce ToolNotFoundError (HarnessError,
code UNKNOWN_TOOL) and route the unknown-tool case through the same catch as a
tool-thrown error, so both failure classes surface structured error metadata
from one path. Addresses PR review finding.
2026-06-14 10:43:23 +08:00
Tianyi Cui
fa7d1df6f2 build: run doc-sync gates in the local pre-push hook too
The doc-sync gates were CI-only, so the AGENTS.md doc-sync promise could be
missed locally until after push. Add a shared `doc-sync` package.json script
(doc-typecheck + verify-event-taxonomy) wired into the lefthook pre-push job,
and point the CI step at the same script — one source of truth per ADR 0007.
Addresses PR review finding.
2026-06-14 10:40:20 +08:00