Commit Graph

5825 Commits

Author SHA1 Message Date
Chinesezjc
2cb0dddb40 docs(tools): stop over-quantifying what String does to a big integral double
The pyScalar paragraph read as a universal over every beyond-safe-range
integral number, and three of its clauses have counterexamples inside
that very domain: String(2 ** 53) and String(1e20) are byte-identical to
BigInt's digits, so the "different integer or no integer literal at all"
split is not exhaustive, "the 16 digits" is 2 ** 60's instance count
rather than the mechanism (shortest round-trip is 1 to 17 significant
digits), and padded digits do name a held integer for 1e20. Say shortest
decimal string then padded to the exponent, give both counts, condition
the no-double-holds-it clause, and state the invariant that makes the
rule unconditional: where String is already exact the two agree, and
where it is not, BigInt is the exact one.

Also align one README.zh.md term: the same file already translates
"exotic names" as 特殊名称 in the SDK-section bullet.
2026-08-05 20:06:06 +08:00
Chinesezjc
5d65686c33 feat(tools): accept Unicode Python identifiers in the Python SDK renderer
The identifier test was ASCII-only, so an object with a `路径` field
degraded to dict[str, Any] -- dropping every sibling field's name,
requiredness and type, with no native schema behind it in Code Mode to
carry them. Python identifiers are `xid_start xid_continue*`, so match
that instead, and widen camelCase's split and head check to the same
sets (naming `_` explicitly in the split, since it is XID_Continue).

NFKC stability is a second and separate condition. CPython normalizes
identifiers at compile time while a JSON key is compared as written, so
a U+FB01 ligature key would be declared and reachable under its ASCII
expansion, a key the tool never accepts, and two keys that normalize
together would collapse
into one declaration. Those names take the subscript path. Generated
class names are normalized instead of rejected -- they are never matched
against a key. Astral characters can now reach the class-name cap, whose
slice counts UTF-16 code units, so drop a split surrogate half.

Also fix two comment claims. The note said one projection reads the
runtime twice per tool; the language-aware getters are installed on
run_code's own definition, so it is twice, both for that schema. And the
182-bracket site's reachability is an array reached from the root
through oneOf arms alone -- a union spine of any depth, not just one
root union; an object ancestor restarts the chain at the 181 site.
2026-08-05 20:03:39 +08:00
Chinesezjc
ba634896e0 docs(tools): name the boundary that rejects a padded integer, and what the flavor-guard test actually reads
pyScalar's docstring attributed the rejection of a String-spelled
beyond-safe-range integer to "the Python runtime". No published backend
makes that call on this base. The fact that does not depend on one: the
padded digits name an integer no double holds, and passing it back would
have to cross the argument boundary as a JSON number. Say that, and say
why String rounds at all -- Number::toString is shortest round-trip, so
2 ** 60 emits the 16 digits that re-read to the same double and pads.
Mirror both in the test comment.

The note's Decision sentence said a test covers the flavor guard through
ctx.tools.schemas(). The test reads the definition's getter directly,
under a language absent from both tables; schemas() reaches the same
getter but has no assertion. Name what is read, and record that a
renderer-without-flavor language is drift this guards against rather
than an existing input -- the two key sets are identical today.
2026-08-05 19:44:05 +08:00
Chinesezjc
015bef2f5f docs(tools): widen the 182 reachability shape and finish the note's two language-binding facts
"Reachable only through a raw register() whose parameters is
array-rooted" was too narrow. A root oneOf reaches the same 182: the
union arm propagates listDepth unchanged because `A | B` opens no
bracket, so an array branch starts its chain at 0 exactly as an array
root does. Say "root opens an array chain -- rooted at the array, or at
an array branch of a root oneOf", in the JSDoc and the test comment,
and assert the union shape alongside the array-rooted one.

The note's Decision paragraph said the flavor guard is reached under
"a language that has a renderer but no flavor entry, and a test covers
it". The test uses ruby, absent from both tables, and the mechanism is
that schemas() reaches run_code's getters without passing
requireCodeRuntime -- so any language absent from the flavor table hits
it. State that instead.

The Consequences paragraph recorded the language-binding obligation as
two reads, assembly and execution. Within one projection there are more:
run_code's description and parameters getters each call
resolveFlavor(peekRuntime()) and schemaOf destructures both, so a reload
between them yields one schema whose halves name different languages.
2026-08-05 19:37:11 +08:00
Chinesezjc
b44acab888 docs(tools): correct three comment claims about what defineTool and the subscript path do
"defineTool compiles an object root, so the annotation is a bare
TypedDict class name that opens nothing" is a false universal:
parameterSchemaSpecToJsonSchema compiles an OPEN object root, so an
empty parameter table and one with unrepresentable field names both
degrade to dict[str, Any], which opens one bracket. The conclusion the
sentence carries is unaffected -- 1 or 2 against a 182 cap -- so say
"a bare TypedDict class name or dict[str, Any], neither of which
carries a chain", in the JSDoc and the test comment that copied it.

pyScalar's docstring said the subscript tool-name comment quotes
"through the same call". It quotes through its own JSON.stringify call
site in renderToolsSdkPy and never reaches pyScalar, which only takes
const/enum scalars. Same function, different call site.

The mode-'both' test attributed assembly.tools to the public schemas().
That projection is wireSchemas, wired at ctx.systemPrompt.tools.
2026-08-05 19:22:42 +08:00
Chinesezjc
72991bbcdb fix(tools): count kinds of code point, not code points, and cover a hostile tool name
"the two code points CPython refuses" counted classes: NUL is one code
point, unpaired surrogates are the whole 2,048-wide D800-DFFF block. Say
kinds, in both the docstring and the test comment that mirrors it, and
restore the "odd" qualifier the test comment dropped -- an even trailing
backslash run does not eat the closing quote.

The soft-keyword test title still said "only special in statement
position", which the previous commit's own three-way split contradicts
for `case`: `case_block` is a clause head inside a `match` statement, not
a statement.

Add the case the subscript tool-name path lacked. A lone surrogate is
reachable in a name through JSON.parse of MCP wire JSON, and that path
has no UNPRINTABLE / LONE_SURROGATE fallback -- only the same ES2019
well-formed stringification the Literal path leans on.
2026-08-05 19:17:34 +08:00
Chinesezjc
f3c8695fd6 test(tools): pin the argument-annotation nesting cap, the worst of the three sites
The 182 the cap is chosen against had no direct case: the existing tests
cover the root chain and the TypedDict field, both of which start one
bracket lower. An array-rooted parameters schema reaches it from a plain
ToolSdkSchema literal, no raw register() needed. Exactly 180 arrays over
a const scalar is the worst case itself -- the root frame starts at
listDepth 0, so every list[ still emits and the innermost Literal[ is
reached rather than degraded; one deeper is where the item degrades.

Name the subscript tool-name comment in pyScalar's docstring: it quotes
through the same JSON.stringify call and inherits the same escapes and
the same pass-throughs.
2026-08-05 19:07:10 +08:00
Chinesezjc
dbefb2fa90 fix(tools): complete the Literal parseability attribution and the soft-keyword positions
pyScalar's docstring named only the two code points CPython refuses
anywhere in source. A bare quote, a trailing odd backslash, and a bare
LF/CR break the Literal line just as fatally, and JSON.stringify is what
covers those too. The argument also leaned on an unstated coincidence:
every escape JSON.stringify can emit is a Python escape for the same
character, which is why the emitted text both parses and decodes back to
the declared value. Say both, and assert the second class.

"statement head" does not describe `case`, whose clause block is not a
statement. Split the positions three ways.

Add the mode 'both' by python assembly, pinning the mode-by-language
matrix rather than leaving it to the shared code path.
2026-08-05 19:01:18 +08:00
Chinesezjc
5afcf36ae1 Merge remote-tracking branch 'origin/master' into feat/py-types-code-mode 2026-08-05 18:45:10 +08:00
Chinesezjc
9bba851a62 fix(tools): correct the trim-order claim and check the Literal escape dependency
trim and escape commute for every input, so the new whitespace test does
not pin their order: UNPRINTABLE and LONE_SURROGATE are disjoint from the
set trim() strips, and both escapes emit plain non-whitespace ASCII,
leaving the leading and trailing whitespace runs byte-identical. State that instead of the false causal clause.

pyScalar's Literal path escapes nothing itself -- JSON.stringify is what
keeps it parseable, covering NUL and, under ES2019 well-formed
stringification, unpaired surrogates. Record the dependency and turn it
into a checked invariant. Pin the docstring emission site for a lone
surrogate too, mirroring the NUL case.

Two docstring corrections: describe's caller enumeration omitted the
synthetic { description } wrapper docLines builds, and "special in
statement position" does not describe `_`, which is special in a match
pattern. Both keep the conclusion they support.

Note which of the two table guards fires depends on the entry point.
2026-08-05 18:43:03 +08:00
Chinesezjc
529e69ed87 Merge remote-tracking branch 'origin/master' into feat/py-types-code-mode 2026-08-05 18:21:54 +08:00
Chinesezjc
cf85c9a3e4 fix(tools): escape unpaired surrogates and state the Cf boundary by category
U+00AD is 0xAD, so "Cf cannot be addressed by \xNN" was false for the
first example in its own list. The real boundary is the category: one
\xNN form covers Cc exactly, and escaping the single addressable Cf
member would leave a rule that is neither category- nor
addressability-shaped.

A lone surrogate is the NUL case rather than the invisible-character
case -- Python source must be UTF-8-encodable, and compile() raises
UnicodeEncodeError for one in a string literal or a # comment alike
(measured on 3.9). JSON.parse on a wire "\ud800" escape produces them,
so escape them as \uNNNN; the regex's u flag keeps well-formed astral
pairs intact.

Pin the whitespace-plus-surviving-control boundary, which also pins
trim-after-escape.
2026-08-05 18:21:43 +08:00
creatixchu
452462a504 Merge remote-tracking branch 'origin/master' into worktree/composer-scrollbar-gutter 2026-08-05 18:20:36 +08:00
Chinesezjc
308f5ae0f3 fix(tools): escape the whole C1 control range, not just NEL
Unicode Cc is U+0000-U+001F plus U+007F-U+009F, and no C1 code point is
ECMAScript whitespace, so U+0080-U+009F all survived the collapse and
reached the docstring raw and invisible -- the gap the previous commit
closed for NEL alone. \xNN addresses the whole block, which is the same
reason the set stops at Cc, so widen the class to U+009F and pin
U+009B/U+009C/U+009F.

Windows-1252 bytes 0x80-0x9F decoded as Latin-1 produce exactly these.

Also: required TypedDict fields share the optional fields' listDepth
start, and a description of whitespace plus a surviving control
character is not absent.
2026-08-05 17:59:48 +08:00
Chinesezjc
1b4cb031f0 fix(tools): name the two bound SDK names and escape NEL
The static-stub sentence over-generalized: `tools` and `ToolCallError`
ARE bound at run time, and a model reading "everything below is a stub"
could stop catching `ToolCallError`. State the boundary and pin both
halves in the fixed-instruction assertions.

UNPRINTABLE missed U+0085: it is Cc but not ECMAScript whitespace, so
it survived the collapse and reached the docstring raw and invisible.
Add it and scope the docstring to Cc, since the `\xNN` escape cannot
address the Cf formatting characters that pass through by design.

Record the backend PR's two runtime contracts -- inject only `tools`
and `ToolCallError`, and bind the assembly-time language to the
request -- in the Agent Note and at requireCodeRuntime.
2026-08-05 17:45:38 +08:00
Chinesezjc
bc94431c34 docs(tools): state the Python SDK declarations are static stubs
A TypedDict reads as a constructible class, so a model that writes
FooArgs(field=1) fails with NameError before dispatch: the run request
injects only the tools namespace and ToolCallError. Say so in
SDK_INSTRUCTIONS and require plain dict/list JSON arguments. The TS
flavor needs no counterpart -- interface is visibly a type and its
"runs type-stripped" clause already covers erasure.
2026-08-05 17:28:58 +08:00
Chinesezjc
137a2f4a4f docs(tools): name the underscore family in the Python SDK usage contract 2026-08-05 17:15:35 +08:00
Chinesezjc
cb53dbe24a docs(tools): correct the bracket-count sites and the underscore routing rationale 2026-08-05 17:01:51 +08:00
_Kerman
a006d19bde Merge remote-tracking branch 'origin/master' into fix/workspace-blank-session-reuse-membership
# Conflicts:
#	packages/client/runtime/README.i18n.yaml
2026-08-05 16:58:36 +08:00
creatixchu
e627c156f6 Merge remote-tracking branch 'origin/master' into worktree/composer-scrollbar-gutter
# Conflicts:
#	packages/client/ui-conversation/README.i18n.yaml
2026-08-05 16:55:12 +08:00
Chinesezjc
a2c4aa513b Merge remote-tracking branch 'origin/master' into feat/py-types-code-mode
# Conflicts:
#	packages/code-runtime/README.i18n.yaml
#	packages/code-runtime/README.zh.md
2026-08-05 16:48:01 +08:00
Chinesezjc
a525d7d1e2 test(tools): pin underscore-leading tool names to subscript access 2026-08-05 16:46:23 +08:00
Chinesezjc
c844bbc8dc Merge remote-tracking branch 'origin/master' into feat/py-types-code-mode 2026-08-05 16:31:09 +08:00
Chinesezjc
581d2ee621 docs(tools): correct the propagated branch-name example to the index-derived 1 2026-08-05 16:31:07 +08:00
creatixchu
ecaf3095fc Merge remote-tracking branch 'origin/master' into worktree/composer-scrollbar-gutter 2026-08-05 16:19:52 +08:00
Turtle
c991a7cc79 docs: finish hierarchy rescan after rebase 2026-08-05 16:18:58 +08:00
Turtle
8af3babaea docs: rescan rebased documentation hierarchy 2026-08-05 16:16:57 +08:00
Turtle
dd8d446286 docs: apply hierarchy across the corpus 2026-08-05 16:13:28 +08:00
Chinesezjc
cc6e4d59fc docs(tools): scope the Python SDK validity standard to the grammar
The list-nesting cap guards against a tokenizer SyntaxError, which makes the
text not Python. A long `A | B | …` union is valid at any length and only
defeats CPython's compile-time C recursion (measured: 1,000 branches compile,
5,000 raise RecursionError); nothing compiles this block, and capping would
retire the deep-chain tests pinning the walk's linear time. Records that
boundary at the `oneOf` arm and in the Agent Note (both languages).

Also documents that the context-free degrade marker reads the call's
className rather than the frame's — frames propagate a derived name, so a
per-frame read would declare classes the caller cannot receive — and pins
that path with oneOf-of-objects and array-of-oneOf assertions.
2026-08-05 15:59:15 +08:00
Chinesezjc
0d17baae01 fix(tools): restore the v8 ignore adjacency broken by an inserted comment
The directive must sit on the line before its target; the nesting-cap comment
displaced it onto a comment line, leaving the `?? ''` arm uncovered.
2026-08-05 15:55:42 +08:00
creatixchu
1ed62688ab Merge remote-tracking branch 'origin/master' into worktree/composer-scrollbar-gutter
# Conflicts:
#	packages/client/ui-conversation/README.i18n.yaml
2026-08-05 15:36:06 +08:00
Yichen Jiang
cc6e2382cb Merge remote-tracking branch 'origin/master' into worktree/open-settings-config-file
# Conflicts:
#	.agents/notes/implemented/architecture/2026-07-30-web-config-plane.i18n.yaml
#	.agents/notes/implemented/architecture/2026-07-30-web-config-plane.md
#	.agents/notes/implemented/architecture/2026-07-30-web-config-plane.zh.md
#	packages/client/ui-settings/README.i18n.yaml
#	packages/host/apiproxy/README.i18n.yaml
#	packages/host/apiproxy/README.zh.md
2026-08-05 15:34:51 +08:00
Chinesezjc
95da760696 fix(tools): cap Python SDK list nesting at CPython's bracket limit
A schema nesting arrays past ~200 levels rendered a `list[list[...]]` chain
CPython's tokenizer rejects outright (`too many nested parentheses`), so the
SDK block was not valid Python at all — the failure docstring escaping in the
same file already guards against. The chain now degrades to `Any` at 180
levels; nesting restarts per TypedDict field, since a field annotation is its
own logical line. Unions and nested objects are unaffected: neither
accumulates open brackets.

Also aligns the unreachable SDK_RENDERERS guard message with the two reachable
ones, and corrects a test comment that still said class docstring.
2026-08-05 14:59:52 +08:00
Chinesezjc
b83c15b1ed Merge remote-tracking branch 'origin/master' into feat/py-types-code-mode 2026-08-05 14:07:53 +08:00
Chinesezjc
a1d7b9a3cd fix(tools): treat a whitespace-only description as absent in the Python SDK
It collapsed to '' rather than undefined, so the renderer emitted an empty
`""""""` docstring or a bare `#   ` line for a node that documents nothing.
2026-08-05 14:05:02 +08:00
imccyu
e4d5ec548e Merge pull request #1050 from deepseek-harness/worktree/custom-deepseek-models
feat(web): configure custom DeepSeek models, with a restyled Models card
2026-08-05 14:04:18 +08:00
Chinesezjc
3f7707e9aa test(tools): satisfy noUncheckedIndexedAccess in the docstring test 2026-08-05 14:03:43 +08:00
Chinesezjc
766ef45bd7 Merge remote-tracking branch 'origin/master' into feat/py-types-code-mode 2026-08-05 14:02:55 +08:00
Chinesezjc
7a178951d6 fix(tools): attach Python SDK docstrings to their own methods
A description was emitted above the `async def`, where Python treats the
first string as the `Tools` class docstring and every later one as a dead
expression — leaving each method undocumented in the model's only source of
tool semantics. Emit it as the first statement of the method body instead.

Also names the known languages in the run_code flavor guard (the reachable
rejection, symmetric with the SDK_RENDERERS guard) and corrects three doc
claims: the code-runtime group README no longer calls the generated SDK
TypeScript, the base Code Mode note states its serial dispatch in past
tense, and the tools README points at the rationale the language-dispatch
note actually carries.
2026-08-05 14:02:47 +08:00
Wenlu Wang
61e46f077e Merge pull request #1362 from deepseek-harness/fix/landlock-runner-failure-classification
Fix false sandbox failures from Landlock partial-enforcement notices
2026-08-05 13:59:47 +08:00
Chinesezjc
975350c7b8 Merge remote-tracking branch 'origin/master' into feat/py-types-code-mode 2026-08-05 13:18:05 +08:00
kingwl
75bd2b8aaa Merge remote-tracking branch 'origin/master' into fix/landlock-runner-failure-classification
# Conflicts:
#	.agents/notes/implemented/feature/2026-07-06-sandbox.i18n.yaml
#	.agents/notes/implemented/feature/2026-07-06-sandbox.zh.md
#	docs/core-data-structures/sandbox.i18n.yaml
#	docs/core-data-structures/sandbox.zh.md
#	docs/postmortem/README.i18n.yaml
#	docs/postmortem/README.zh.md
#	examples/acp-agent/tests/acp.snapshot.ts
#	native/landlock-run/README.i18n.yaml
#	packages/sandbox/sandbox-local/README.i18n.yaml
#	packages/sandbox/sandbox-local/README.zh.md
#	packages/sandbox/sandbox/README.i18n.yaml
2026-08-05 13:17:38 +08:00
Chinesezjc
698fdaea9b fix(tools): emit Python SDK members in one lexicographic stream
The Python renderer partitioned identifier methods ahead of subscript
comments, so a tool set like {a-tool, z} emitted z first — contradicting
the documented lexicographic contract and the TypeScript flavor, which
quotes exotic keys in place. Interleave both kinds in one ordered stream
and track emitted statements for the pass fallback.

Also correct four stale serialization claims in the base Code Mode note
that the live-parallel scheduler superseded.
2026-08-05 12:59:20 +08:00
Yichen Jiang
e9b377e9c5 Merge remote-tracking branch 'origin/master' into worktree/custom-deepseek-models
# Conflicts:
#	.agents/notes/implemented/architecture/2026-07-30-web-config-plane.i18n.yaml
#	.agents/notes/implemented/feature/2026-07-24-web-session-model-selector.i18n.yaml
#	packages/client/ui-model/README.i18n.yaml
#	packages/client/ui-model/README.zh.md
#	packages/client/ui-models/README.i18n.yaml
#	packages/client/ui-models/README.zh.md
#	packages/host/apiproxy/README.i18n.yaml
#	packages/llm/llm-deepseek/README.i18n.yaml
2026-08-05 12:50:58 +08:00
_Kerman
63ba836bce fix(client): address CI and review findings on blank-session reuse
- docs: fix cross-class note links (../feature/...), mirror the membership
  reuse criterion in README.zh.md and the connectWorkspace architecture
  note (EN/ZH/sidecars re-recorded)
- test(client): stray + member blank at the same path — the scan skips the
  stray and reuses the member
- test(web): re-registration after delete now mints a fresh blank session
  (the old cwd-only reuse is gone), so the account is no longer empty;
  assert the retained seeded session is still not re-adopted
2026-08-05 12:21:09 +08:00
_Kerman
add1674ac4 fix(client): only reuse workspace-member blank sessions for New Session
The blank-session reuse scan in connectWorkspace matched on cwd alone, so a
live blank session the CLI/TUI birthed at the host cwd (never accounted to
any workspace) was hijacked when + was clicked on a workspace registered at
that path, opening a session the sidebar shows under Ungrouped instead of
the clicked workspace. Reuse now also requires membership in the workspace's
sessionIds (the host's own membership rule); cwd-only matches fall through
to session.create({workspaceId}).

Fixes #1647
2026-08-05 12:20:50 +08:00
imccyu
5ae0a23f42 fix(session): remove unreachable header guard 2026-08-05 11:57:17 +08:00
imccyu
1832df038d docs(session): document creation ownership boundaries 2026-08-05 11:57:17 +08:00
imccyu
c02871b910 refactor(session): separate validation from snapshots 2026-08-05 11:56:14 +08:00
imccyu
69b1ea8d8c refactor(agent-loop): extract setup and publication 2026-08-05 11:56:14 +08:00