feat(tools): live dispatch lifecycle + native-contract parallel sub-calls in Code Mode
The bridge replaces its serialization queue with a pool that reuses the native concurrency contract: submissions classify through registry.executionMode (fail-closed isConcurrencySafe), start strictly in submission order, overlap up to the validated maxParallelSubCalls config (default 10; 1 restores serial), and exclusive calls drain the pool, run alone, and bar later calls. Each started sub-call logs a tool/code-dispatch-start event at pool entry; the existing tool/code-dispatch settles the pair (started ⇔ settles exactly once; abandoned queued calls log neither). SDK prompt guidance now states the true Promise.all contract — re-recorded across every code/both-mode snapshot (plus the stale cordis-dynamic-toolchain fixture gaining the required description arg). Client: CodeSubCall widens to RunningToolCall | ToolResultNode — starts land the running shape (rows wear the native running ring), settles replace in place preserving start order, callTime pairs to the start time. Fixture emits start/settle pairs; jsdom pins the running sub-row; runtime specs pin in-place settlement and out-of-order completion.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
terminal 100x36 buffer=normal length=53 base=17 viewport=17
|
||||
terminal 100x36 buffer=normal length=66 base=30 viewport=30
|
||||
lifecycle started=1 stopped=0 progress=inactive
|
||||
title "Using ONE run_code program: call — DSH TUI snapshot"
|
||||
cursor hidden column=1 viewportRow=31 bufferRow=48
|
||||
cursor hidden column=1 viewportRow=31 bufferRow=61
|
||||
buffer
|
||||
0| " DEEPSEEK HARNESS"
|
||||
style 1-8 fg=bright-blue bold
|
||||
@@ -52,87 +52,86 @@ buffer
|
||||
style 1-3 fg=bright-blue
|
||||
style 4-50 fg=bright-black italic
|
||||
16| " "
|
||||
17| " The program body is an async function. I need to: "
|
||||
style 1-49 fg=bright-black italic
|
||||
18| " - Call tools.bash({command: \"echo CODE_ONE\", description: \"Echo CODE_ONE\"}) "
|
||||
style 1-2 fg=bright-blue
|
||||
style 3-7 fg=bright-black italic
|
||||
style 8-75 fg=cyan
|
||||
19| " - Call tools.bash({command: \"echo CODE_TWO\", description: \"Echo CODE_TWO\"}) "
|
||||
style 1-2 fg=bright-blue
|
||||
style 3-7 fg=bright-black italic
|
||||
style 8-75 fg=cyan
|
||||
20| " - Extract the stdout text from each "
|
||||
style 1-2 fg=bright-blue
|
||||
style 3-35 fg=bright-black italic
|
||||
21| " - console.log exactly captured output "
|
||||
style 1-2 fg=bright-blue
|
||||
style 3-22 fg=bright-black italic
|
||||
style 23-37 fg=cyan
|
||||
22| " - Return them joined with + "
|
||||
style 1-2 fg=bright-blue
|
||||
style 3-26 fg=bright-black italic
|
||||
style 27-27 fg=cyan
|
||||
23| " "
|
||||
24| " Let me look at the bash output shape. From the schema, it returns {kind: \"foreground\", stdout: "
|
||||
style 1-66 fg=bright-black italic
|
||||
style 67-99 fg=cyan
|
||||
25| " {text: string, ...}, ...}. So I'd access result.stdout.text. "
|
||||
style 1-25 fg=cyan
|
||||
style 26-41 fg=bright-black italic
|
||||
style 42-59 fg=cyan
|
||||
style 60-60 fg=bright-black italic
|
||||
26| " "
|
||||
27| " The echo commands produce output like \"CODE_ONE\\n\" - I should trim the trailing newline. "
|
||||
style 1-88 fg=bright-black italic
|
||||
28| " "
|
||||
29| " Let me write the code. "
|
||||
style 1-22 fg=bright-black italic
|
||||
30| <blank>
|
||||
31| "▌ "
|
||||
17| " Let me think about the structure. The bash tool returns an object with stdout/stderr. I need to "
|
||||
style 1-38 fg=bright-black italic
|
||||
style 39-42 fg=cyan
|
||||
style 43-99 fg=bright-black italic
|
||||
18| " extract the stdout text from each call. "
|
||||
style 1-39 fg=bright-black italic
|
||||
19| " "
|
||||
20| " Looking at the bash output type: "
|
||||
style 1-32 fg=bright-black italic
|
||||
21| " "
|
||||
22| " ``` "
|
||||
style 1-3 dim
|
||||
23| " { "
|
||||
24| " kind: \"foreground\"; "
|
||||
25| " exitCode: number | null; "
|
||||
26| " signal: string | null; "
|
||||
27| " timedOut: boolean; "
|
||||
28| " aborted: boolean; "
|
||||
29| " timeoutMs: number; "
|
||||
30| " stdout: { "
|
||||
31| " text: string; "
|
||||
32| " truncated: boolean; "
|
||||
33| " spillPath?: string; "
|
||||
34| " }; "
|
||||
35| " stderr: { ... }; "
|
||||
36| " sandbox?: { ... }; "
|
||||
37| " } "
|
||||
38| " ``` "
|
||||
style 1-3 dim
|
||||
39| " "
|
||||
40| " So I need to access .stdout.text from each result. "
|
||||
style 1-20 fg=bright-black italic
|
||||
style 21-32 fg=cyan
|
||||
style 33-50 fg=bright-black italic
|
||||
41| " "
|
||||
42| " Let me write the program. "
|
||||
style 1-25 fg=bright-black italic
|
||||
43| <blank>
|
||||
44| "▌ "
|
||||
style 0-0 fg=green
|
||||
32| "▌ ✓ Echo CODE_ONE and CODE_TWO, join with plus "
|
||||
45| "▌ ✓ Call bash twice, log, join outputs "
|
||||
style 0-0 fg=green
|
||||
style 2-2 fg=green bold
|
||||
style 3-45 bold
|
||||
33| "▌ captured output "
|
||||
style 3-37 bold
|
||||
46| "▌ captured output "
|
||||
style 0-0 fg=green
|
||||
34| "▌ CODE_ONE+CODE_TWO "
|
||||
47| "▌ CODE_ONE+CODE_TWO "
|
||||
style 0-0 fg=green
|
||||
35| "▌ "
|
||||
48| "▌ "
|
||||
style 0-0 fg=green
|
||||
36| <blank>
|
||||
37| " Reasoning "
|
||||
49| <blank>
|
||||
50| " Reasoning "
|
||||
style 1-9 fg=bright-black italic
|
||||
38| " The output shows: "
|
||||
style 1-17 fg=bright-black italic
|
||||
39| " 1. console.log(\"captured output\") printed captured output "
|
||||
style 1-3 fg=bright-blue
|
||||
style 4-33 fg=cyan
|
||||
style 34-42 fg=bright-black italic
|
||||
style 43-57 fg=cyan
|
||||
40| " 2. The return value CODE_ONE+CODE_TWO was also printed "
|
||||
style 1-3 fg=bright-blue
|
||||
style 4-20 fg=bright-black italic
|
||||
style 21-37 fg=cyan
|
||||
style 38-54 fg=bright-black italic
|
||||
41| " "
|
||||
42| " The user said \"Reply with that joined string only and stop.\" So I should reply with just "
|
||||
51| " The program ran successfully. The output shows: "
|
||||
style 1-47 fg=bright-black italic
|
||||
52| " - captured output (from console.log) "
|
||||
style 1-2 fg=bright-blue
|
||||
style 3-17 fg=cyan
|
||||
style 18-36 fg=bright-black italic
|
||||
53| " - CODE_ONE+CODE_TWO (the returned joined string) "
|
||||
style 1-2 fg=bright-blue
|
||||
style 3-19 fg=cyan
|
||||
style 20-48 fg=bright-black italic
|
||||
54| " "
|
||||
55| " The user asked me to reply with that joined string only and stop. So I'll reply with just "
|
||||
style 1-99 fg=bright-black italic
|
||||
43| " CODE_ONE+CODE_TWO. "
|
||||
56| " CODE_ONE+CODE_TWO. "
|
||||
style 1-17 fg=cyan
|
||||
style 18-18 fg=bright-black italic
|
||||
44| <blank>
|
||||
45| " Assistant "
|
||||
57| <blank>
|
||||
58| " Assistant "
|
||||
style 1-9 fg=bright-magenta bold
|
||||
46| " CODE_ONE+CODE_TWO "
|
||||
47| "────────────────────────────────────────────────────────────────────────────────────────────────────"
|
||||
59| " CODE_ONE+CODE_TWO "
|
||||
60| "────────────────────────────────────────────────────────────────────────────────────────────────────"
|
||||
style 0-99 dim
|
||||
48| " "
|
||||
61| " "
|
||||
style 1-1 inverse
|
||||
49| "────────────────────────────────────────────────────────────────────────────────────────────────────"
|
||||
62| "────────────────────────────────────────────────────────────────────────────────────────────────────"
|
||||
style 0-99 dim
|
||||
50| "deepseek-v4-flash /workspace/project ↑150 ↓464 cache 98% 4% context tools:c"
|
||||
63| "deepseek-v4-flash /workspace/project ↑182 ↓446 cache 98% 4% context tools:c"
|
||||
style 0-78 dim
|
||||
style 81-99 dim
|
||||
51-52| <blank>
|
||||
64-65| <blank>
|
||||
|
||||
Reference in New Issue
Block a user