question tools: phase-visible names, hardened teach schemas, context-slim seams

The tools_fails_2 diagnosis (glm-5.3 dropping trailing required fields):
- probe-phase quiz/explain renamed to probe/recall — a shared name carried
  the probe call shape into teaching (the first teach quiz dropped nodeId);
  display seams accept the old names forever
- teach quiz+explain schemas lead with the required pair (type, nodeId);
  explain gains the predict/check type and joins the reveal law (checks
  collapse, predictions arrive open; no-type records render check-style)
- plan_init/probe_done results go context-slim (owner, context diet):
  content = validated nodeIds + binding-id reminder / fixed ack; details
  keeps the tree for the popup and {ok:true} — serializer-verified that
  details never reaches the model; failure echoes dropped
- the cards carry the tool's own name (Probe/Recall) and the quiz type
  reads on the label (Prediction/Check) in composer and transcript
This commit is contained in:
amosblomqvist
2026-10-09 07:59:23 +03:00
parent c23eb1f15b
commit 1f41fb05a5
21 changed files with 411 additions and 127 deletions
+10 -8
View File
@@ -120,19 +120,20 @@ describe("plan_init — the author-once mermaid tool (execute against the real s
});
assert.equal(res.ok, true);
assert.equal(res.error, undefined);
assert.equal(res.tree.version, 1);
const tree = res.tree!;
assert.equal(tree.version, 1);
assert.deepEqual(
res.tree.nodes.map((n) => n.id),
tree.nodes.map((n) => n.id),
["primitives", "operators", "expressions", "detour"],
);
assert.deepEqual(res.tree.edges, [
assert.deepEqual(tree.edges, [
{ from: "primitives", to: "operators" },
{ from: "operators", to: "expressions" },
]);
const saved = chatStore.getChat(chatId)!.tree;
assert.ok(saved, "tree persisted to the chat record");
assert.deepEqual(saved, res.tree);
assert.deepEqual(saved, tree);
});
it("RE-CALLABLE: a rewrite replaces the tree wholesale (the mutation tools are gone)", async () => {
@@ -147,7 +148,7 @@ describe("plan_init — the author-once mermaid tool (execute against the real s
});
assert.equal(res.ok, true, "re-init is the sanctioned rewrite path now");
assert.deepEqual(
res.tree.nodes.map((n) => n.id),
res.tree!.nodes.map((n) => n.id),
["truth", "goal"],
);
assert.deepEqual(
@@ -169,7 +170,8 @@ describe("plan_init — the author-once mermaid tool (execute against the real s
assert.match(err, /line 2/);
assert.match(err, /line 3/);
assert.match(err, /line 4/);
assert.deepEqual(res.tree, emptyTree());
// Context diet (2026-10-09): failures carry just the error — no tree echo.
assert.equal(res.tree, undefined);
assert.equal(chatStore.getChat(chatId)!.tree, undefined, "nothing persisted on failure");
});
@@ -181,7 +183,7 @@ describe("plan_init — the author-once mermaid tool (execute against the real s
});
assert.equal(res.ok, false);
assert.match(res.error!, /cycle/);
assert.deepEqual(res.tree, emptyTree());
assert.equal(res.tree, undefined, "no tree echo on failure (context diet, 2026-10-09)");
});
it("only plan_init exists — the seven mutation/tracking tools are gone by design", () => {
@@ -194,7 +196,7 @@ describe("plan_init — the author-once mermaid tool (execute against the real s
const res = await exec(tools, "plan_init", { mermaid: "graph TD\n a[A]\n" });
assert.equal(res.ok, false);
assert.match(res.error!, /Chat not found/);
assert.deepEqual(res.tree, emptyTree());
assert.equal(res.tree, undefined);
});
});