Skip to content

hive/dwarfstar: its models reach for tools, held to ds4's own templates - #110

Merged
adiled merged 1 commit into
mainfrom
dwarfstar-tools
Nov 21, 2026
Merged

adiled merged 1 commit into
mainfrom
dwarfstar-tools

Conversation

@adiled

@adiled adiled commented Nov 21, 2026

Copy link
Copy Markdown
Owner

dwarfstar's bees dropped every prompt's tools, so its models said they had none. That included the wrepl humd hands every bloom from web2. Now they reach.

Tendrils. A prompt's tools go to the model in its family's own template: DSML for DeepSeek V4 and V4.1, <tool_call> with <arg_key>/<arg_value> for GLM, and <tool_call> with <function=…> for Qwen. The bee asks the engine which family it loaded. ds4 keeps all of this private to ds4_server.c, so src/chat.c ports it: the templates, the tool preambles, and the readers of the calls a model writes. A bloom grows in rounds:

  • Words stream, held back only where a call might be starting.
  • Each call unfurls as a closed tendril petal and goes out as tendril-reach.
  • Each tendril-result is told to the forager as tendril-info, and once every reach has come back the next round grows.

The model's own calls are rendered exactly as it sampled them, so the KV cache still holds them. A prompt whose graft ends in grasps now grows on, where it used to be refused with cannot-grow-on. Blooms without tools encode exactly as before. The hello declares the tendril chis, and richness goes from lean to medium.

Parking. ds4 runs one engine per bee. While a bloom waits on its grasps it parks, and the engine serves the rest of the queue, so a client that takes a tool call and never answers holds nothing up. A parked bloom lets go after DWARFSTAR_REACH_MS (30 min, the same as the forager's hold) with tendril_unanswered, or when a cancel or a new prompt arrives on its sid.

Held to ds4. make test checks the templates and readers on any machine (15 cases). make conform compiles ds4's own server code in its test mode, as ds4's ds4_test does, beside the port. It requires the same prompts byte for byte across 6 conversations × 4 families, with and without tools, and the same calls read from sample outputs: 54 of 54. A copy of chat.c with one byte changed in a template and one in the DSML reader fails 13 of them, so it is the check to run when DS4_SHA moves. The two deliberate departures are left out of it:

  • DeepSeek V4 puts the system words before the tools, as ds4's reference prompts do. ds4's server reverses them for a cache trim the bee doesn't use.
  • GLM reads an argument as JSON unless its schema says string. ds4 reads every GLM argument as a string.

Licence. The port lives in this repo rather than in gitignored vendor/, so ds4's MIT notice is kept beside it in LICENSE-ds4, and the README says what it covers.

Version. The bee reported a hardcoded 0.33.1. It reports 0.35.1 now, and release.sh bumps the #define VERSION in src/main.c with the other hives. A dry run of the sed and of the drift check both pass.

Code is speech. Prose leaves dwarfstar's code files (sources, Makefile, Orchfile, build, install) and goes to its README, which now describes the tendril rounds, the parking, DWARFSTAR_REACH_MS, the build targets, and the shader overrides the stripped comments explained.

Verified. Everything builds with no warnings under -Wall -Wextra -Wpedantic -Wshadow.

The stub bee, through the openai-server forager on a live humd:

  • A client tool round trip: tool_calls came back, then the answer.
  • A wrepl reach served by web2 inside one bloom.
  • With a client gone silent on a tool call, another client was answered in 0.5 s, and the parked blooms let go at their deadline.
  • humd logged no undeclared keys.

The real DeepSeek V4 Flash Q2, run as a separate test bee sharing the hive's GPU lock:

  • It called get_weather {"city":"Oslo"} and answered from the result. The second round took 1.8 s, so the cache held.
  • Asked which web services it reaches, it drove wrepl through several rounds and listed web2's weather service correctly.
  • At Q2 the model sometimes names its tool invoke, the template's own tag word: 11 of 16 calls in one run, almost all on one phrasing of the prompt. The bee passes that name through as written, and humd answers it as unserved.

Not read yet: a forced reach (tendrils.reach of required or a tool's name) and tendrils.parallel. Vision and thinking stay off.

The bee hands a prompt's tools to its model in the model family's own template (DeepSeek V4 and V4.1 DSML, GLM, Qwen), ported from ds4's server into src/chat.c, reads the calls the model writes back out, and reaches them as tendrils through humd. A bloom waiting on its grasps parks so the engine serves the queue meanwhile, and lets go after DWARFSTAR_REACH_MS. make test checks the templates and readers anywhere; make conform compiles ds4's own server code beside the port and holds them byte for byte. ds4's MIT notice travels with the port in LICENSE-ds4. The bee reports the release version and release.sh bumps it. Prose leaves dwarfstar's code files for its README.
@adiled
adiled merged commit a89f14e into main Nov 21, 2026
7 checks passed
@adiled
adiled deleted the dwarfstar-tools branch November 21, 2026 16:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant