Files
loki/scripts/test/project-builder-agents.ts
CatoandClaude Opus 5.5 afb39da877 fix(agents): each project is offered what its own builder has, and a missing CLI is said, not launched (#1262)
* fix(agents): each project is offered what its own builder has, and a missing CLI is said, not launched

- Control offered one agent list for the whole panel, read from the
  computer's report first, so a cloud project was offered Codex because the
  laptop had it. Each card now gets the list of the builder that will run
  that project (the same answer dispatch gives: locus lock, builder_pref,
  cloud), and an agent that builder lacks reads "not on the cloud builder".
  A builder that has not reported changes nothing (unknown, not none).
- A builder about to launch a CLI it does not have used to open a terminal
  on "command not found", and the run read as an agent that never answered.
  launchAgentPty now refuses first: "Codex is not installed on the cloud
  builder, so nothing was started. Switch this project to an agent installed
  there, or install Codex on the cloud builder, then try again."
- The next-step suggestions told the model the agent was "Claude Code" in
  every session. They now name the agent actually running (looked up from
  its adapter id; no free text reaches the system prompt).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NZqZujmXpupVDC1Hi5Jbsx

* chore(desktop): Fleet Runner 0.8.43 — the launch check reaches computers

The launch check lives in desktop/src/main/pty-runtime.ts, so it reaches a
computer only with a release; desktop-release-drift (new on main) is right to
refuse it at 0.8.42. Bump and record the release.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NZqZujmXpupVDC1Hi5Jbsx

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-17 18:41:08 +02:00

52 lines
1.9 KiB
TypeScript

/**
* Each Control card offers the agents installed on the builder that runs that
* project (components/control/control-panel-card-props → onProjectBuilder).
*
* The panel-wide list read the computer's report first, so a cloud project
* was offered Codex because the laptop had it, and the dispatch then started a
* session for a program the cloud builder does not have.
*
* Run: npx tsx scripts/test/project-builder-agents.ts
*/
import assert from "node:assert/strict";
import { onProjectBuilder } from "@/components/control/control-panel-card-props";
const panel = [
{ id: "claude", label: "Claude", available: true },
{ id: "codex", label: "Codex", available: true },
{ id: "grok", label: "Grok", available: false },
];
const cloud = onProjectBuilder(panel, {
builderChannel: "cloud",
builderAgents: ["claude", "grok"],
});
assert.equal(cloud.find((a) => a.id === "claude")?.available, true);
assert.equal(
cloud.find((a) => a.id === "codex")?.available,
false,
"laptop-only Codex is not offered to a cloud project",
);
assert.match(
cloud.find((a) => a.id === "codex")?.availabilityReason ?? "",
/not installed on the cloud builder/,
);
assert.equal(cloud.find((a) => a.id === "codex")?.unavailableNote, "not on the cloud builder");
assert.equal(
cloud.find((a) => a.id === "grok")?.available,
true,
"installed on the builder that runs it, whatever the laptop says",
);
const local = onProjectBuilder(panel, { builderChannel: "local", builderAgents: ["codex"] });
assert.match(local.find((a) => a.id === "claude")?.availabilityReason ?? "", /your computer/);
assert.deepEqual(
onProjectBuilder(panel, { builderChannel: "cloud", builderAgents: null }),
panel,
"a builder that never reported leaves the rows as they were (unknown, not none)",
);
assert.deepEqual(onProjectBuilder(panel, {}), panel, "an older API response changes nothing");
console.log("✓ project-builder-agents: 9 checks passed");