Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions FORK_CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ setting is missing here or a setting named here does not exist.
| Model policy: the setting for which models (and efforts) agents may pick, per provider driver: off, advise or enforce, and the allowed rows. The server checks an agent's pick (`delegate_task`, `create_threads`, `t3_thread_launch`, `t3_thread_configure`, here, and both before and after it goes to linked machines): a model in no row, a call that names no model, or an effort off its row is refused in enforce, only noted in advise. A person's own pick is never refused; Settings marks one outside the rows. A bad hand edit, or a settings file that does not parse, refuses every agent pick (a warning if the value says advise). Settings offers the fork's start rows (Opus 5.5 and Fable 5.2) while none are saved. While it is on, a child whose call names its model keeps only the options it names. | Agents should use the models the person chose for each kind of work. | `server.modelPolicy` | off | [#268](https://github.com/scuttletoby/t3code/pull/268), [#731](https://github.com/scuttletoby/t3code/issues/731) |
| Placement, part 1: the settings only. `placement` (off, advise or enforce; this machine's labels, an optional facts command, label groups that must never meet on one machine, and a weight per linked machine) and `placementNeeds` (labels a project's work needs). Person-only; a bad `placement` reads as off and a bad `placementNeeds` fits no machine, each kept as written. Nothing reads them yet. | Delegated work should go to a machine that has what it needs, and never where it must not run. | `server.placement`, `server.placementNeeds`, `projectOverride.placementNeeds` | off | [#134](https://github.com/scuttletoby/t3code/issues/134) |
| Calm sidebar, part 1: the settings. `threadRoles` names the assistant thread and one orchestrator per project; the server refuses a role for a thread that is missing, deleted, a sub-agent, a side chat, delegated from a linked machine or in another project. `calmSidebarEnabled` is the per-device switch. Nothing shows them yet. | A short sidebar: the threads that matter on top, the rest folded. | `server.threadRoles`, `client.calmSidebarEnabled` | off | [#928](https://github.com/scuttletoby/t3code/pull/928) |
| Assistant setup: the switch `assistant.enabled` (off) offers **Make assistant** in Settings, which makes a thread in the Scratch project, names it `threadRoles.assistant` and picks for it the new built-in MCP profile `assistant` (no outside servers, no shell, file or web tools; T3 tool groups `orchestration`, `threads` and `projects`). Claude only. | One thread you talk to across projects, with only T3's tools. | `server.assistant`, `server.mcpProfiles` | off | [#953](https://github.com/scuttletoby/t3code/pull/953) |

## Repository, CI and releases

Expand Down
72 changes: 71 additions & 1 deletion apps/server/src/fork/mcpProfile.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ describe("MCP profile resolver: old and empty state", () => {
});
});

it.each(["all", "t3-only"])(
it.each(["all", "t3-only", "assistant"])(
"refuses %s when a hand edit put a profile of that name in the file",
(name) => {
const file = {
Expand Down Expand Up @@ -662,6 +662,19 @@ describe('builtinTools "none" (assistant)', () => {
);
});

it("the built-in assistant: no servers or built-in tools, three groups; a child keeps it", () => {
const picked = fromFile({ mcpThreadProfiles: { a1: "assistant" } });
const own = resolved(resolveMcpProfile(picked, [top("a1")]));
expect([own.name, own.source]).toEqual(["assistant", "thread-pick"]);
expect(own.profile).toEqual({
servers: [],
t3Tools: ["orchestration", "threads", "projects"],
builtinTools: "none",
});
const sub = resolved(resolveMcpProfile(picked, [child("c1"), top("a1")]));
expect(sub.profile).toEqual(own.profile);
});

it.each([["some"], [false], [["Bash"]]])("refuses, never widens, builtinTools %j", (value) => {
const broken = fromFile({
mcpProfiles: { odd: { servers: "all", t3Tools: "all", builtinTools: value } },
Expand All @@ -674,3 +687,60 @@ describe('builtinTools "none" (assistant)', () => {
);
});
});

describe("the assistant thread is never wider than the assistant profile (#953)", () => {
const ASSISTANT_SET = {
servers: [],
t3Tools: ["orchestration", "threads", "projects"],
builtinTools: "none",
};
const roles = { assistant: "a1", orchestrators: {} };

it("a managed policy that drops its pick: the defaults' all is cut down to assistant", () => {
// The policy owns mcpThreadProfiles as a whole and leaves the assistant's pick out.
const dropped = fromFile({
mcpProfiles: PROFILES,
threadRoles: roles,
mcpThreadProfiles: { other: "docs" },
});
const own = resolved(resolveMcpProfile(dropped, [top("a1")]));
expect([own.name, own.source]).toEqual(["assistant", "assistant-role"]);
expect(own.profile).toEqual(ASSISTANT_SET);
// A project default and a wider pick are cut too; a child gets no more than its parent.
const project = resolved(resolveMcpProfile(dropped, [top("a1", { mcpProfile: "docs" })]));
expect(project.profile).toEqual(ASSISTANT_SET);
const wide = fromFile({ threadRoles: roles, mcpThreadProfiles: { a1: "all" } });
expect(resolved(resolveMcpProfile(wide, [top("a1")])).profile).toEqual(ASSISTANT_SET);
expect(resolved(resolveMcpProfile(dropped, [child("c1"), top("a1")])).profile).toEqual(
ASSISTANT_SET,
);
});

it("its own pick stands when it is within assistant; other threads are not touched", () => {
const settings = fromFile({
mcpProfiles: { tiny: { servers: [], t3Tools: ["threads"], builtinTools: "none" } },
threadRoles: roles,
mcpThreadProfiles: { a1: "tiny" },
});
const own = resolved(resolveMcpProfile(settings, [top("a1")]));
expect([own.name, own.source]).toEqual(["tiny", "thread-pick"]);
const picked = fromFile({ threadRoles: roles, mcpThreadProfiles: { a1: "assistant" } });
expect(resolved(resolveMcpProfile(picked, [top("a1")])).source).toBe("thread-pick");
const other = resolved(resolveMcpProfile(settings, [top("t2")]));
expect([other.name, isEveryMcpTool(other.profile)]).toEqual(["all", true]);
// No role: the thread that held the pick gets what any thread gets.
expect(isEveryMcpTool(resolved(resolveMcpProfile(fromFile({}), [top("a1")])).profile)).toBe(
true,
);
});

it("refuses, never widens, when the built-in assistant cannot be read or the pick is broken", () => {
const shadowed = fromFile({
mcpProfiles: { assistant: { servers: "all", t3Tools: "all" } },
threadRoles: roles,
});
expect(refused(resolveMcpProfile(shadowed, [top("a1")])).profileName).toBe("assistant");
const missing = fromFile({ threadRoles: roles, mcpThreadProfiles: { a1: "gone" } });
expect(refused(resolveMcpProfile(missing, [top("a1")])).problem).toBe("missing");
});
});
15 changes: 15 additions & 0 deletions apps/server/src/fork/mcpProfileSettingsText.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,3 +243,18 @@ describe("mcpProfileFileKeysOf (#681)", () => {
);
});
});

describe("the assistant pointer counts as an MCP profile key (#953)", () => {
it("a file that does not decode still gives threadRoles.assistant, laid over a broken load", () => {
// `"theme": 5` makes the full decode fail; the text reader still gives the profile keys.
const keys = keysOf(
JSON.stringify({ theme: 5, threadRoles: { assistant: "thread:a", orchestrators: 3 } }),
);
expect(keys.threadRoles).toEqual({ assistant: "thread:a", orchestrators: {} });
const laid = withMcpProfileFileKeys(DEFAULT_SERVER_SETTINGS, keys);
expect(laid.threadRoles.assistant).toBe("thread:a");
// A decoded file gives the same, so the keys last read keep it too.
const decoded = { ...DEFAULT_SERVER_SETTINGS, threadRoles: keys.threadRoles } as ServerSettings;
expect(mcpProfileFileKeysOf(decoded).threadRoles.assistant).toBe("thread:a");
});
});
10 changes: 8 additions & 2 deletions apps/server/src/fork/mcpProfileSettingsText.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,13 @@ import * as Schema from "effect/Schema";

import { parseSettingsFileText } from "../serverSettings.ts";

/** The settings keys MCP profiles read from the file, besides `mcpCarriedProfiles`. */
/**
* The settings keys MCP profiles read from the file, besides `mcpCarriedProfiles`. `threadRoles`
* too: the assistant thread is held within the `assistant` profile, so its pointer counts.
*/
export type McpProfileFileKeys = Pick<
ServerSettings,
"mcpProfiles" | "mcpProfile" | "mcpSubagentProfile" | "mcpThreadProfiles"
"mcpProfiles" | "mcpProfile" | "mcpSubagentProfile" | "mcpThreadProfiles" | "threadRoles"
> & {
/** Each project's two MCP profile keys, as written; a project left out has none. */
readonly projectSettingsOverrides: Readonly<
Expand Down Expand Up @@ -49,6 +52,7 @@ const ServerKeys = Schema.Struct({
mcpProfile: ForkServerSettingsFields.mcpProfile,
mcpSubagentProfile: ForkServerSettingsFields.mcpSubagentProfile,
mcpThreadProfiles: ForkServerSettingsFields.mcpThreadProfiles,
threadRoles: ForkServerSettingsFields.threadRoles,
});
const ProjectKeys = Schema.Struct({
mcpProfile: ForkProjectOverrideFields.mcpProfile,
Expand Down Expand Up @@ -184,6 +188,7 @@ export function mcpProfileFileKeysOf(settings: ServerSettings): McpProfileFileKe
mcpProfile: settings.mcpProfile,
mcpSubagentProfile: settings.mcpSubagentProfile,
mcpThreadProfiles: settings.mcpThreadProfiles,
threadRoles: settings.threadRoles,
projectSettingsOverrides,
};
}
Expand Down Expand Up @@ -211,6 +216,7 @@ export function withMcpProfileFileKeys(
mcpProfile: keys.mcpProfile,
mcpSubagentProfile: keys.mcpSubagentProfile,
mcpThreadProfiles: keys.mcpThreadProfiles,
threadRoles: keys.threadRoles,
projectSettingsOverrides:
projectSettingsOverrides as ServerSettings["projectSettingsOverrides"],
};
Expand Down
1 change: 1 addition & 0 deletions apps/server/src/golive/forkReport.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1142,6 +1142,7 @@ describe("__fork-report settings", () => {
placementNeeds:
"placement: settings only so far; nothing reads them yet (later placement rows)",
threadRoles: "calm sidebar: settings only so far; nothing reads them yet",
assistant: "only offers Make assistant; the assistant is the threadRoles.assistant thread",
};

it("counts every fork setting as a feature or names why it is not a switch", () => {
Expand Down
1 change: 1 addition & 0 deletions apps/server/src/policy/forkManagedSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import type { ForkServerSettingKey } from "@t3tools/contracts";

const WHOLE_ONLY = [
"assistant",
"handoff",
"mcpCarriedProfiles",
"mcpProfile",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ describe("the thread menu's MCP profile entry", () => {
expect(item!.children!.map((child) => [child.id, child.checked ?? false])).toEqual([
["mcp-profile:pick:all", false],
["mcp-profile:pick:t3-only", false],
// The built-in `assistant` is a choice for every thread: it only narrows and gives no role.
["mcp-profile:pick:assistant", false],
["mcp-profile:pick:docs", false],
["mcp-profile:pick:narrow", true],
["mcp-profile:clear", false],
Expand Down
Loading
Loading