Skip to content

llm: add DangCheck and DangEval builtin tools - #15156

Merged
vito merged 7 commits into
mainfrom
dang-agent-tools
Nov 14, 2026
Merged

vito merged 7 commits into
mainfrom
dang-agent-tools

Conversation

@vito

@vito vito commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Adds two always-registered engine builtins for agents writing Dang:

  • DangCheck(source, at, search): ReadOnly, so a turn's probes run in parallel. It parses and infers only: it gives diagnostics, or a description of what a snippet is, plus ranked search. Nothing runs.
  • DangEval(source!, at): type-checks first, then runs the snippet and shows its printed output, TYPE = value (via dang.Describe, so laziness is visible) and, for an object or interface result, its member names. A footer gives the duration and the number of engine calls. Type errors and failures are reported as the tool's result, as DangCheck reports diagnostics, not as tool errors.

Scope. The default scope is the conversation's schema, MCP.loadBase, which every tool of the conversation shares. It includes the workspace's installed modules for value workspaces (a snapshot, an agent's checkout) as well as live ones. Modules are loaded best effort from the workspace as of each call, pending dagger.toml and source edits included, so a module a snippet installs or uninstalls joins or leaves the next call's scope. A bound tool object's own module wins over another revision the workspace installs. When a name isn't found and installed modules failed to load, the report ends with a note naming them and why.

Output is bounded like a module tool's.

  • Each tool logs its whole report to the tool call's span, line for line. DangEval streams printed output as it runs, then logs the rest.
  • The engine doesn't log the result to that span a second time, as it does for other tools (LLMTool.LogsOwnResult). The span therefore shows the report once, and it is the full report, not the bounded result the model sees. A skill nudge is logged after the report. A tool call that errors before producing a report still logs its error.
  • The result goes through the trace-report path module tools use (toolCallReportOpts, span tree hidden). A chain of API calls surfaces nothing, so its result is the report alone, bounded like a module tool's flat output: lines are clamped at 2,000 bytes, and past 16 KiB the middle gives way to ... N lines omitted (use ReadLogs(span: X, scope: "own") to read more) ....
  • A snippet that runs checks or tests gains FAILURES, CHECKS and TESTS sections, with the report as OUTPUT.
  • Results are described in full, except for what no reader could see:
    • a long multi-line string is shown verbatim as its lines between ''', Dang's verbatim quotes ((no final newline) when it lacks one; text that itself holds ''' stays verbatim, with a note that the block ends at its last line);
    • a one-line string keeps its head and tail within a line;
    • a flat list shows up to 512 elements, nested collections Describe's default of 32;
    • the description and the printed output are each capped at 1 MiB.

Skill nudge. When a snippet fails to parse or type-check and the conversation hasn't read the dang-language skill, the result ends with See the dang-language skill (ReadSkill) for Dang's syntax and semantics. Runtime failures and successes never get it. Reads are tracked internally, with no API: a successful ReadSkill call on the conversation's record, or earlier in the same step.

Bindings. Both tools see these in every scope (the default scope, and at a module, a file or a position), each holding its state as of the call:

  • ws, the conversation's workspace;
  • chat, the conversation itself (an LLM). It is only bound in a conversation's step, not under dagger mcp, and only where the snippet or the scope's files mention it, because its ID carries the whole history;
  • me, the Agent that owns the conversation: Agent! when there is one, otherwise a null Agent;
  • the conversation's bound tool objects, each named after its type in lowerCamel case (editor, dangDev, …).

If a module declares the same name at its top level, the module's declaration wins. The descriptions list the conversation's actual bindings rather than an example.

  • The objects' modules, and those modules' dependencies, join the scope's API without constructors. So editor.grep(source: ws, regex: "x") type-checks and runs through the eval's host-inert client.
  • Bound objects that aren't module objects, or whose modules don't fit beside the API, are left out.

Writes happen by assignment only. When a DangEval snippet succeeds:

  • A reassigned ws becomes the conversation's workspace through MCP.rebindWorkspace, as a tool returning a Workspace does, so commits and resets carry over.
  • A reassigned tool object is rebound the same way a tool call returning that type rebinds it.
  • A reassigned chat becomes the conversation the step resumes from, the same way a tool returning an LLM does (adoptLLM, scheduled as a continuation). So chat = editor.install(llm: chat, ref: "…") gives the conversation a module's tools mid-turn. Any LLM is accepted, the same as with such a tool.
  • chat must be reassigned alone: assigning it with ws or a tool object is a type error ("reassign chat alone; its workspace and tools come with it"), because an LLM carries its own workspace and tools. Reading editor to build the new chat is fine.
  • Reassigning me is a type error.

A failed snippet writes nothing. A Workspace or Changeset the snippet only returns is shown with a "not applied" hint and 0 writes. A footer line reports the writes (ws written (1 file), notes state updated); read-only probes print nothing about writes.

Writes are all or nothing: every final value is loaded and validated before any is applied, and a write that fails undoes the earlier ones (commitDangWrites).

This follows the settled two-tool scheme. No skill is added; the nudge points at the existing dang-language one. The tool descriptions carry the workflow. With ws, chat, me and a tool object all bound, the descriptions are 949 bytes (DangCheck) and 964 bytes (DangEval). A description changes when the conversation's bindings do, e.g. when a tool object is installed. Both are always registered; the LLM reference docs (docs/current_docs/partials/types/_llm.mdx) say what DangEval can reach.

Where it lives

  • core/llm_dang_tools.go defines a small DangTools interface plus RegisterDangTools, and MCP.loadDangTools registers both tools next to loadArtifactTools. dangToolResult shapes the result (bounds, trace-report sections, the nudge). The default scope starts from MCP.loadBase, the conversation's base schema, and adds the bound objects' modules over it (MCP.dangScope).
  • core/sdk/dang/v2/tools*.go holds the implementation. Only this package imports Dang, and it registers itself in init.
    • tools.go is engine glue. It resolves at in the conversation's workspace:

      • by the name of any installed module, which scopes to the module the default scope loaded. A git module's source directory is mounted read-only. A module written with another SDK, which declares nothing Dang reads, sees its full API.
      • by directory, by .dang file, or by path:line:col. It finds the module through findUp of dagger-module.toml/dagger.json plus Workspace.moduleSource, then mounts Workspace.directory(...), which includes pending edits.

      Where there's nothing to scope to, the call says why as its result, not a tool error: an unknown name lists what is installed, a module that failed to load gives its failure, and DangCheck of a module with no .dang files names its SDK. The schema is ModuleSource.introspectionSchemaJson plus ensureModuleSelfTypes, and the Dang version comes from the module source. Eval uses dangshared.WithNestedClientServer with inert attachables and the module as its context.

    • tools_check.go and tools_eval.go hold the Dang work over an fs.FS + schema + GraphQL client, unit-tested without an engine.

How each output is computed:

output how
module/file diagnostics analysis.Analyze in full mode, or Focus on the file
snippet analysis.Overlay as <check>.dang beside the module's files, Focus on it
snippet at a position Analyze(Focus: file), then ScopeAt, then InferFormsWithPhases on a clone of that scope
member reference analysis.Doc for Type.member, SelectedMember for expr.member, Lookup for a name; the declaration site comes from Inspect
type name analysis.Members; listings are capped at 40 with signatures and docs, then names only
value the inferred type of the last form; TypeMembers only for an object or interface
search analysis.Search(scope, query, 20)
eval dang.LoadDir(FS, Eager: module scope), then Module.Eval, then dang.Describe (a long multi-line string as a ''' block); TypeMembers names only for an object or interface

Other details:

  • Bindings. In every scope, ws is declared as let ws: Workspace! = Dagger.node(id: "<conversation workspace>").{{... on Workspace!}}, and tool objects are declared the same way. It is lazy, so an eval that doesn't read it makes no call. The names are qualified, so a module's local type, such as Notes at notes, can't capture them.
  • Writes. reportEvalResult finds which bound names the snippet reassigns, then reads their final values back from the same run and applies them before the eval's client shuts down.
  • Paths. Files are served at their workspace paths, so positions never name a mount. They are shown relative to the workspace cwd, the same way at resolves them.
  • Print output goes to the tool call's span as it is printed, under the report's output: heading, so the span's own logs read line for line as the report does. Any string a query selecting plaintext returned is scrubbed (***) from both. Outside a conversation's tool call (dagger mcp), there is no span of the call's own to point at, so the report only goes through the usual tool-result guard.
  • Diagnostics carry context (analysis: diagnostics carry the answer (DiagnosticContext) vito/dang#298). Both tools set analysis.Options.DiagnosticContext and render through analysis.Render (renderDiagnostics). A type error about a name lists the closest names and the receiver's members.
    • A diagnostic with no file keeps the plain error: message form.
    • A snippet checked at a path:line:col gets no context yet, because it is inferred outside analysis.
  • Dang version: this bumps github.com/vito/dang/v2 from v2.4.1 to v2.5.0, which brings Dang 2.5 ("..."/"""...""" interpolate ${...} and process escapes, '...' is verbatim), diagnostic context (analysis: diagnostics carry the answer (DiagnosticContext) vito/dang#298), declaration snapshots so let before = ws works (effects: let declarations snapshot before writes vito/dang#301), structural Dang interfaces, and cgo-free tree-sitter. Snippets in the default scope are now Dang 2.5 (dang.CurrentVersion). A snippet ending in an assignment to ws, a tool object or chat no longer prints the (not evaluated…) hint (describe: no eval hint on assignment results vito/dang#313); one that reassigns a module's own binding, which writes nothing, keeps it.
  • Module default: Dang SDK modules that declare no dang version default to Dang 2.5 from engineVersion v1.0.0-beta.28 (was 2.4, which no release shipped). Older modules keep 2.1, entrypoints stay at 2.1, and an explicit dang = "2.4" is honored.

Tool descriptions (exact, for a conversation with an agent and an editor tool object)

DangCheck

Type-check Dang without running anything. Scope: the core API and installed modules (as Dagger), or with at a module of the workspace, one of its .dang files, or a path:line:col in one (seeing the locals there). Every scope binds ws (your Workspace); chat (this conversation, an LLM); me (the Agent owning this conversation; can't be reassigned); your tool objects editor.
Without source: the module's or file's errors, warnings and deprecations, as path:line:col.
With source: its errors, else what it is. A member reference (xs.reduce, JSON.encode, Container.withExec) gives the member's signature, docs and example; a type name, the type and its members; any other expression, its type, and an object's members. Probe before writing a helper (List lists every list method), and check after each edit, before running a @check.
search ranks builtins, API fields and the module's declarations by name and docs.

  • source: Dang to check as one more file of the scope; its last expression is described.
  • at: Scope: a module installed in the workspace (by name), a Dang module's directory, a .dang file of one, or path:line:col in one. Default: the workspace scope.
  • search: Words to find in names and docs, e.g. "sort" or "escape html".

DangEval

Run Dang: printed output, then the result as TYPE = value and, for an object, its members. Scope as for DangCheck, without positions: at a module runs the snippet as one more file of it, after its top level. A type error runs nothing.
Engine calls go through the scope's API (with at, the module's dependencies and own API), with no access to the host, and are counted. Assignment is the write: if the snippet succeeds, a reassigned ws (ws = ws.withChanges(…)) becomes your workspace; a reassigned tool object (editor = editor.someMethod(…)) its state; a reassigned chat (an LLM, such as one a tool method returns given llm: chat) the conversation; assign it alone, as its workspace and tools come with it; nothing else is. A module installed through ws or chat is callable in the next call. Objects stay lazy (shown as their query) until you select a scalar such as .stdout or .sync. Each call is standalone; wrap long runs in Timeout.

  • source (required): Dang statements to run; the last expression is the result.
  • at: A module installed in the workspace (by name), a Dang module's directory, or a .dang file of one. Default: the workspace scope.

Examples (from the integration test's transcript)

DangCheck({"source":"[\"a\"].reduce"})

List.reduce(initial: b) { acc: b, item: a => b }: b
  reduces the list to a single value using an accumulator function
  example: [1, 2, 3, 4].reduce(0) { acc, x => acc + x }
ok · workspace scope · nothing ran
DangCheck({"at":"notes","source":"shout"})

shout(name: String!): String!
  Shouts a name.
  declared at .dagger/modules/notes/main.dang:17:5
ok · module notes (.dagger/modules/notes) · 1 file · nothing ran
DangEval({"source":"print(\"reading\")\nws.file(\"notes.txt\").contents"})

output:
reading
String! = "hi from the workspace\n"
ok · 10ms · 2 engine calls · workspace scope
DangEval({"source":"container.from(\"alpine\")"})

Dagger.Container! = <Container: container.from(address: …)>
(not evaluated; select a field such as .sync or .user to run it)
members: asService asTarball combinedOutput … withRun … (9 more)
ok · 3ms · 0 engine calls · workspace scope
DangEval({"source":"print(\"never\")\nnope"})   → returned as the tool's result

<check>:2:1: error: "nope" not found
1 error · workspace scope · nothing ran
See the dang-language skill (ReadSkill) for Dang's syntax and semantics.

The last line is the nudge; it is gone once the conversation has read the skill.

A long result, bounded like a module tool's output, with its middle in the call's own logs:

DangEval({"source":"container.from(\"alpine\").withExec([\"seq\", \"1\", \"20000\"]).stdout"})

String! = '''
1
2
…
2403
... 16741 lines omitted (use ReadLogs(span: 3deb60e0084398a9, scope: "own") to read more) ...
19145
…
20000
'''
ok · 1.3s · 1 engine call · workspace scope

Checks a snippet runs are reported as for a module tool call, with the Dang report as OUTPUT (a test module probe with a passing and a failing @check):

DangEval({"source":"ws.artifacts.filterUri(uri: \"probe/ok\").asChecks.{{pass}}"})

== OUTPUT ==
[{pass: Boolean!}!]! = [{{pass: true}}]
ok · 38ms · 2 engine calls · workspace scope

== CHECKS ==  ✔ 1 passed
✔ dag://?check=probe/ok 0.0s OK

... use ReadLogs(span: 2e53b3bad33af010) to read the full logs ...
DangEval({"source":"ws.artifacts.filterUri(uri: \"probe/broken\").asChecks.{{pass}}"})

== FAILURES ==
Selected span 7780d308a9e4d31a: 
No recorded error origins. Failed spans below are navigation, not proven causes.
Failed checks/tests (not necessarily causes):
check "dag://?check=probe/broken" [span=822b1ed0da4336a6]
  ReadTrace(span: "822b1ed0da4336a6")
  ReadLogs(span: "822b1ed0da4336a6")
  error: the probe failed

== OUTPUT ==
[{pass: Boolean!}!]! = [{{pass: false}}]
ok · 27ms · 2 engine calls · workspace scope

== CHECKS ==  ✘ 1 failed
✘ dag://?check=probe/broken 0.0s ERROR
  ! the probe failed
  ✘ Probe.__check_broken: Void 0.0s ERROR
  ! the probe failed

== SEE FULL TRACE ==
ReadTrace(span: "822b1ed0da4336a6")

A type error with diagnostic context (from the unit tests, at the position where the snippet calls findFirst on a list):

<check>:2:1: error: list does not have method "findFirst"
  closest: find { item: a => Boolean! }: a?  returns the first element for which the predicate returns true, or null if none…
  [String!]! has 25 members: all any contains dropFirst dropLast dropWhile each filter find flatMap
    indexOf isEmpty join length map reduce reject reverse sort sortBy sum takeFirst takeLast
    takeWhile uniq
1 error · workspace scope · nothing ran

Where the scheme meets the code

  • DangEval's default scope serves the conversation's full schema. A nested client outside a module used to serve only the core API. engine.ClientMetadata.ServedDeps is a new engine-internal field, like SDKEntrypoint. It gives an inert nested client a *core.SchemaBuilder to serve instead, the way a module client serves its module's dependencies. DangEval passes the conversation's deps (from MCP.loadBase, plus the bound objects' modules) and type-checks against the same schema, so DangCheck and DangEval agree, installed modules included. Host attachables stay inert. With at a module, the nested client gets that module as its context (the one the default scope loaded, else asModule), so the module's dependencies and its own API are callable.
  • Value workspaces. MCP.baseServer now loads a value workspace's installed modules from its own tree, as it loads a live workspace's from its owning client, so a snapshot or an agent's checkout gets them in every tool's schema, not only the Dang tools'. Loading is best effort: a broken module is left out, and if the installed modules don't fit together the schema goes without them. A value workspace is keyed by its recipe, so its modules load once per session (SchemaBuilderMemo.WorkspaceModules), failures included. Where the workspace installs another revision of a bound tool object's module that no client serves, or an edit breaks that module, the bound object's module stays in its place.
  • Module schema in module scope. This is the declaration-pass schema: dependencies plus self-type stubs (ensureModuleSelfTypes). Root self-call fields only exist at runtime.
  • Host-inert clients have no outer .env. ClientMetadata.InertAttachables (server-set) makes outerEnvFile return an empty file, as for module code, so DangEval can load workspace modules and the git modules behind bound tool objects.
    • engine.ClientScope carries the flag through NewClientScope, Metadata, Clone and Delegate, because the scope's JSON snapshot used to drop it.
    • sealClientMetadataLocked writes it in for clients nested under an inert one.
  • Host secrets in host-less clients. A bound tool object holding a host secret (e.g. cmd://gh auth token) still loads when rebuilt in a host-less client. The secret just can't be read there, and the host client keeps reading its own copy. Refusing Query.secret in host-less clients was tried and reverted, because it broke loading such objects.
  • Served tool modules. ServedDeps also adds the bound tools' modules beside a module client's own API.
  • Snippets act for their agent. engine.ClientMetadata.CallerAgent is a new engine-internal field, never sent on the wire, like ServedDeps. DangEval sets it on the snippet's client from core.CallerAgent(ctx), and engine.ClientScope carries it. After the loop context and the function call, core.CallerAgent falls back to the agent on the request's client scope. It reads the scope, not the metadata, because workspace operations swap in the workspace owner's metadata but keep the scope. So me.wait… from the agent's own turn fails with "cannot block on itself" instead of hanging, and send from a snippet records its sender. A synthetic FunctionCall would have broken Workspace auto-injection in snippets.
  • Commits and resets from a snippet need a workspace that doesn't read the host. A live host-backed workspace is snapshotted and reads the host git config, which the snippet's client can't do, so commit on a snapshot with an explicit author.
  • Secret scrubbing. No secret scrubber exists for in-engine logs; exec scrubbing works from env and file mounts. So this scrubs the plaintexts the snippet itself fetched, which is the only way Dang reads one, from both the result and the span's logs.
  • Trace-report OUTPUT. For a Dang call, OUTPUT is the Dang report itself rather than a fresh capture of the span's logs, as spanResult does for module tools. The report already is those logs line for line, and a capture would also hoist the snippet's nested exec output into it.
  • Describe's cost. Dang's describer lays out every item it shows before its byte cap applies, so item counts, not the byte cap, bound the work. That is why only a flat list shows 512 elements. A byte budget inside Dang's describer would be the real fix.

Tests

  • core/sdk/dang/v2/tools_test.go (unit, SDL schema plus a fake client) covers:
    • workspace scope: values, member references, statics, type names, ws
    • type errors and deprecations
    • module diagnostics with workspace paths, and a single file
    • a private helper with its declaration site
    • at a position, seeing locals
    • search
    • eval: output and result, laziness with 0 calls, a counted call, a type error running nothing, a failure keeping its output, secret scrubbing, the module top level running eagerly
    • cwd-relative paths
    • writes:
      • assigning ws writes it;
      • assigning a tool object rebinds it;
      • calling methods without assigning writes nothing and shows the hint;
      • an unassigned changeset is not applied;
      • a failure or a type error writes nothing;
      • ws is writable at a module;
      • a module's own top-level names are detected;
      • all-or-nothing writes (TestCommitDangWritesAllOrNothing);
      • let before = ws followed by ws = … shows both and writes only ws.
    • diagnostic context: unknown method and unknown field.
    • output: the span's logs equal the report line for line; long multi-line strings as verbatim blocks ((no final newline), long lines cut in the middle); one-line strings keeping head and tail within a line for narrow, wide and escaped text; a flat list's 512 elements and nested collections' default; members only for an object (none for scalars, lists, records or null).
    • TestDangRejected: parse and type errors are rejected (the nudge's trigger), runtime errors, successes and a module's own diagnostics aren't.
    • at: installed git and other-SDK modules (TestDangInstalledModuleGlobals, TestDangCheckModuleWithoutDangFiles), a bad at as a result (TestDangAtReport), and the unloaded-modules note (TestDangUnloadedNote).
  • core/llm_dang_tools_test.go (unit):
    • TestDangToolResultBounds: truncation with the scope: "own" ReadLogs pointer, rune-safe line clamps the result guard leaves alone, and only the guard outside a conversation's tool call.
    • TestDangSpanResult, against a real telemetry store: an API chain renders the report alone; a passing check adds OUTPUT, CHECKS and the footer; a failing one leads with FAILURES.
    • TestDangToolResultSkillNudge: the nudge on parse and type errors, not on success or runtime errors, gone after ReadSkill reads the skill (a failed read doesn't count).
    • TestMessagesReadSkill: reading the skill from the conversation's record.
    • TestDangToolCallLogsReportOnce: through CallContent, with a fake implementation, the span logs carry the report exactly once for Check, Eval and a rejected source (report, then nudge). Tool errors and bad arguments still log their error.
  • core/moddeps_test.go (TestSchemaBuilderMemoWorkspaceModules): a value workspace's modules load once per session, failures included.
  • core/integration/llm_dang_tools_test.go (TestLLM/TestDangTools) is end to end with a canned model over a workspace with a Dang module (dagger-module.toml). It covers:
    • DangCheck and DangEval calling the installed module without at;
    • ws = ws.withNewFile(…), written and then read back;
    • a failing write leaving no file;
    • a draft workspace that is only returned, giving the hint and 0 writes;
    • a write at: notes;
    • notes = notes.withGreeting(…) updating its state, both in the default scope and at: notes;
    • a commit through ws surviving to a later call;
    • let before = ws stays readable after ws = … ([false, true]), and the write persists;
    • a closest: line in a type error;
    • a bound tool object from a git module (served over smart HTTP), both called directly and with its source loaded fresh in the snippet's client;
    • a host secret in a git tool module (vault.reveal via tool call, DangEval and shell; a snippet's own secret(uri:) succeeds);
    • long results and the skill nudge: a 20,000-line result truncated with its ReadLogs pointer; the nudge on a DangEval type error and a DangCheck parse error, not on a runtime failure, and gone after ReadSkill;
    • checks a snippet runs: an API chain's result is the report alone with no members line; asChecks.{{pass}} on a passing and a failing @check gives OUTPUT, CHECKS and FAILURES;
    • installed modules of a snapshot workspace, a git one included, with at naming it and a bad at reported as a result;
    • a module installed (ws.withModule) or uninstalled (ws.withoutModule) by a snippet joins or leaves the next call's scope, live and snapshot;
    • a module broken by a snippet, and a snapshot with a broken module: left out, with the unloaded-modules note;
    • chat and me:
      • the descriptions list the real bindings;
      • chat = installer.install(llm: chat, ref: …) makes the module's tool callable in the next step, and the module callable from Dang;
      • chat with ws, and chat with a tool object, are rejected with nothing applied;
      • reassigning me fails in DangCheck and DangEval;
      • me is null without an agent, and me.handle reads correctly in an agent's conversation;
    • a snippet acts for its agent: in a spawned agent's own turn, me.wait.state fails right away with "cannot block on itself", and a snippet's send to a peer is recorded as from that agent, so the peer sees the [message #1 from agent "owner"] header.
  • core/agent_tool_context_test.go (TestCallerAgentFromNestedClientMetadata): the caller agent survives the client scope, the scope clone, and owner metadata swapped in.
  • core/schema (TestInertClientSecretReplay): a host-less rebuild of an object holding a host secret loads, and the host client still reads the secret afterwards.
  • engine/server/served_deps_test.go also covers InertAttachables surviving client scopes.
  • engine/server/served_deps_test.go: the served schema survives the client-metadata snapshot.

Not covered: enriched module-load errors (a follow-up), an LSP/edit hook, completion. Tool modules from private or SSH git remotes can't be reloaded from a snippet's host-inert client, because no credentials are delegated to it; public remotes work.

@vito
vito added this pull request to stack #15165 November 12, 2026 23:55
@vito
vito marked this pull request as ready for review November 14, 2026 00:41
@vito
vito requested a review from a team as a code owner November 14, 2026 00:41
@grouville
grouville self-requested a review November 14, 2026 01:34
vito added 7 commits November 14, 2026 02:21
Dang 2.5 is what the DangCheck and DangEval tools parse snippets with,
and what new Dang SDK modules default to later in this series. It also
drops the tree-sitter and go-pointer indirect dependencies.

Signed-off-by: Alex Suraci <[email protected]>
DangEval runs each snippet in an in-engine nested client that acts for
the conversation without its host access. ClientMetadata gains three
engine-internal (json:"-") fields for such clients:

- ServedDeps: the schema to serve instead of the core API alone, or,
  with a module context, modules served beside the module's own API (the
  conversation's bound tool objects, without constructors).
- CallerAgent: the agent the client acts for, so message provenance
  resolves for calls that run no function.
- InertAttachables: set by ServeHTTPToNestedClient and recorded when
  sealing, so a client nested under an inert one says so too.

ClientScope snapshots metadata as JSON, so it carries InertAttachables
and CallerAgent beside the snapshot like UseRecipeIDsByDefault; without
that, requests of an inert client claimed a host and failed with
PermissionDenied looking for its outer .env. A host-inert client now
gets an empty outer .env, as module code does.

TestInertClientSecretReplay pins that a host-less replay of an object
holding a host secret loads, and leaves the host client able to read it.

Signed-off-by: Alex Suraci <[email protected]>
Two always-registered LLM tools for agents writing Dang: DangCheck
type-checks and describes without running anything (ReadOnly, so a
turn's probes run in parallel), DangEval runs a snippet. Their
descriptions carry the workflow, since no skill points at them.

Only core/sdk/dang/v2 may import Dang, so core defines the DangTools
interface and the SDK registers the implementation. Core provides the
environment a call sees:

- the default scope: the conversation's schema, the bound workspace's
  installed modules (a value workspace's loaded from its own tree,
  cached per recipe, broken modules dropped and reported), and the
  bound tool objects;
- the bindings `ws`, `chat` (only where a scope uses it) and `me`, with
  writes applied when a snippet reassigns `ws`, `chat` or a tool object;
- CallerAgent resolution for the snippet's nested client, so its calls
  act for the conversation's agent.

Results are bounded like module tool output (line clamp, ReadLogs
pointer), logged once to the call's span (LLMTool.LogsOwnResult), and
nudge toward the dang-language skill on errors until it has been read
in the conversation.

Signed-off-by: Alex Suraci <[email protected]>
The language service behind core's Dang builtins, registered with
core.RegisterDangTools. DangCheck type-checks a snippet, file or module
(`at`) and describes expressions, members and search hits without
running anything. DangEval runs a snippet in a host-inert nested client
against the conversation's full schema, or a module's API with `at`.

Every scope binds `ws`, `chat`, `me` and the conversation's tool objects;
assignment is DangEval's only write. Errors show what exists, name a
bound value that fails to load, and note installed modules that didn't.
Long string results are shown as ''' blocks, which stay verbatim under
Dang 2.5, and reassignments are found by parsing at 2.5, 2.4 and 2.1.

Signed-off-by: Alex Suraci <[email protected]>
From v1.0.0-beta.28, a Dang SDK module that declares no `dang` version
is parsed as Dang 2.5, not 2.4: beta.28 is the first engine to embed
2.5, and no released engine ever defaulted to 2.4. Dang24ModuleVersion
becomes Dang25ModuleVersion. Older modules keep 2.1 (1.0 before
v0.21.5), entrypoints stay pinned at 2.1, and an explicit `dang = "2.4"`
is still honored.

The changelog entry (now linking danglang.org/v2.5), the SDK README and
the dang-dagger-modules skill describe 2.5's string changes and how to
migrate. Tests gain interpolation cases that tell 2.5 from 2.4, and the
skipped-module listing now expects 2.5's quoted syntax errors.

Signed-off-by: Alex Suraci <[email protected]>
Document DangCheck and DangEval on the LLM type: their bindings (`ws`,
`chat`, `me`, bound tool objects), DangEval's writes by assignment, and
that withWorkspace loads any workspace's modules from its own files.

Signed-off-by: Alex Suraci <[email protected]>
Integration tests drive DangCheck and DangEval through an LLM against a
fixture workspace with two Dang modules: scopes and `at`, bound tool
objects, writes by assignment to `ws`, `chat` and tool objects, output
bounds and the skill nudge, broken and removed modules, and host-inert
replays of git modules and objects holding host secrets. The toolset
count in TestToolReturningLLMContinues gains the two builtins.

Signed-off-by: Alex Suraci <[email protected]>
@vito
vito merged commit 2a385e9 into main Nov 14, 2026
97 checks passed
@vito
vito deleted the dang-agent-tools branch November 14, 2026 03:16
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.

2 participants