Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
15 commits
Select commit Hold shift + click to select a range
ef3ecc3
feat(web): edit Crew proposal members in place
bryantderosier Oct 27, 2026
beee9bb
feat(web): review Crew proposals from the composer
bryantderosier Oct 27, 2026
ca7b7cd
fix(web): keep Crew proposals collapsed until opened
bryantderosier Oct 27, 2026
8687bba
fix(web): match the approved Crew proposal layout
bryantderosier Oct 27, 2026
d723d21
fix(web): the settled roster summary names who approved it (#742)
bryantderosier Oct 28, 2026
c55b097
refactor(web): drop the Crew preview hook's unused debounce (#742)
bryantderosier Oct 28, 2026
72c93de
fix(web): keep roster edits when the composer hides the Crew proposal…
bryantderosier Oct 28, 2026
76ed03a
fix(web): an edited persona text replaces the persona's instructions …
bryantderosier Oct 28, 2026
d27ec65
fix(web): an edited persona seat does not show the changed-since-laun…
bryantderosier Oct 28, 2026
0335681
fix(web): a cleared persona text is rejected instead of silently reve…
bryantderosier Oct 29, 2026
9a85815
merge: bring the updated quiet-timeline layer into the roster-card layer
bryantderosier Nov 2, 2026
cc95fb5
fix(contracts): export the persona instructions limit the proposal st…
bryantderosier Nov 2, 2026
19f584e
merge: pick up the lint fixes from the quiet-timeline layer
bryantderosier Nov 2, 2026
38f10e0
fix(web): drop manual memos and the draft-save effect from the Crew p…
bryantderosier Nov 2, 2026
5be6542
test(web): run the Crew proposal card tests in the browser project
bryantderosier Nov 2, 2026
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
2 changes: 1 addition & 1 deletion FORK.md
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ Upstream settings sections no longer accept a `description` prop; J5 library pan

`apps/server/src/orchestration-v2/ThreadMessageIntake.ts` treats the J5 `resolve-agent-persona` launch refusal as pre-dispatch failure and releases claimed uploads; the pending upload remains available for retry.

Bryant requested a shared agent picker for Codex and Claude, invoking a saved agent as a subagent within the current conversation. This is a narrow exception to the earlier native-only Subagent steering: the child uses the existing delegated-child engine with `lineage.relationshipToParent = subagent`. Its child thread is backing storage, not a top-level Peer Agent. Ordinary native subagent requests and `j5_spawn_agent` retain their existing meanings; `j5_spawn_agent`'s optional `agent` input (2026-09-09) resolves a saved agent into a Peer Agent's immutable assignment entirely inside `apps/server/src/j5/agents/agentPersonaSpawn.ts` and the J5 toolkit handlers, with no further upstream hook. Proposal-driven Crews use ordinary conversation. The former `/crew` send-path wrapper in `ChatView.tsx` and slash-menu spread in `ChatComposer.tsx` are removed; case 8's standing instructions guide the agent to propose a roster, including custom members, and wait for the person's decision before launching. The platform's `<j5_crew_gate>` decisions render as notices through case 7's `renderThreadA2ADelivery` call: J5-owned `apps/web/src/j5/crew/CrewNoticeRenderer.tsx` draws them, the shared parser in `packages/client-runtime/src/j5/crewNotices.ts` recognizes the tagged blocks strictly (anything unparsed stays raw), and the call passes the thread and markdown folder from `TimelineRowCtx`, so a seat opens its thread and the brief renders as markdown (2026-09-16). Mobile has no delivery seam and shows these notices in upstream's rows, as it does A2A deliveries. `ChatView.tsx` mounts J5-owned `CrewRosterGate` (`apps/web/src/j5/crew/CrewRosterGate.tsx`) immediately above `ChatComposer`, outside its form so roster focus does not expand the composer: the initial roster proposal is answered inline above the Captain's composer like a planning question, while mid-run seat additions stay on the inbox bell (`crewProposals.logic.ts` decides which is which). The human gate (open proposals, approve with edited seats, decline) lives entirely in J5 files: `apps/web/src/j5/crew/`, the J5 inbox page and bell, and the list, preview and resolve RPCs (case 64). One adapter append makes the gate reachable from Claude: `claudeMcpQueryOverrides` in `apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.ts` spreads J5-owned `J5_CLAUDE_MCP_ALLOWED_TOOLS` (`apps/server/src/j5/a2a/mcp/claudeAllowedTools.ts`) into the read-only pre-approval list, because Claude runs read-only personas in `dontAsk` mode and would otherwise deny every J5 coordination tool; the upstream `CLAUDE_READ_ONLY_T3_MCP_ALLOWED_TOOLS` constant and its toolkit cross-check stay untouched, and the two exact-allowlist assertions in `ClaudeAdapterV2.test.ts` include the J5 spread. The Codex counterpart is one spread in `codexThreadRuntimeParams` (`apps/server/src/orchestration-v2/Adapters/CodexAdapterV2.ts`, private to that file since the 2026-10-24 advance): upstream's injected `"mcp_servers.t3-code"` entry gains J5-owned `J5_CODEX_T3_MCP_SERVER_CONFIG` (`apps/server/src/j5/a2a/mcp/codexToolApproval.ts`; since 2026-09-14 a per-tool `tools.<verb>.approval_mode = "approve"` map naming the J5 verbs plus `j5_write_artifact` (a saved agent's declared handoff artifact lives in application storage, never the workspace) and, since 2026-09-15, the provider-native Subagent verbs `delegate_task`, `task_status`, and `task_cancel` (a Crew member refused `j5_spawn_agent` is sent there), never a server-wide default, so worktree handoff, browser preview, and scheduling keep Codex's own verdict for read-only personas), because Codex 0.153+ rejects every non-read-only MCP tool under approval policy `never` with "MCP tool call requires approval, but approval policy is never"; that policy is what full-access mode and every saved-agent runtime policy send, so without the spread `j5_send_message`, `j5_spawn_agent`, and `j5_propose_crew` all fail on Codex. The full spread applies when the thread's resolved approval policy is `never` (`j5ApprovalPolicyIsNever`). Since 2026-09-24 both appends draw their names from one J5 leaf module, `apps/server/src/j5/a2a/mcp/j5ToolPreapproval.ts` (`J5_PREAPPROVED_TOOLS`, the interactive-mode `J5_COORDINATION_TOOLS`, and `j5PreapprovedTools(runtimePolicy)`), so Codex and Claude, the two harnesses J5 pre-approves its tools on (Jackson's ruling on #233), pre-approve the same set. Interactive modes pre-approve only routine messaging and the crew proposal/request tools; membership still waits for the platform's human roster or Inbox decision. Other tools retain Codex's prompting. The ten upstream tools admitted on 2026-10-08 (case 4) are not in J5's pre-approval lists; they keep each harness's own verdict, and upstream's Claude read-only list already carries `html_preview` and `html_render`. The expected thread config in `CodexAdapterV2.test.ts` includes the spread.
Bryant requested a shared agent picker for Codex and Claude, invoking a saved agent as a subagent within the current conversation. This is a narrow exception to the earlier native-only Subagent steering: the child uses the existing delegated-child engine with `lineage.relationshipToParent = subagent`. Its child thread is backing storage, not a top-level Peer Agent. Ordinary native subagent requests and `j5_spawn_agent` retain their existing meanings; `j5_spawn_agent`'s optional `agent` input (2026-09-09) resolves a saved agent into a Peer Agent's immutable assignment entirely inside `apps/server/src/j5/agents/agentPersonaSpawn.ts` and the J5 toolkit handlers, with no further upstream hook. Proposal-driven Crews use ordinary conversation. The former `/crew` send-path wrapper in `ChatView.tsx` and slash-menu spread in `ChatComposer.tsx` are removed; case 8's standing instructions guide the agent to propose a roster, including custom members, and wait for the person's decision before launching. The platform's `<j5_crew_gate>` decisions render as notices through case 7's `renderThreadA2ADelivery` call: J5-owned `apps/web/src/j5/crew/CrewNoticeRenderer.tsx` draws them, the shared parser in `packages/client-runtime/src/j5/crewNotices.ts` recognizes the tagged blocks strictly (anything unparsed stays raw), and the call passes the thread and markdown folder from `TimelineRowCtx`, so a seat opens its thread and the brief renders as markdown (2026-09-16). Mobile has no delivery seam and shows these notices in upstream's rows, as it does A2A deliveries. `ChatView.tsx` passes J5-owned `CrewRosterGate` (`apps/web/src/j5/crew/CrewRosterGate.tsx`) through the existing `ChatComposer.threadProgressControl` slot alongside Playbooks. It uses upstream’s `ComposerBanner` attachment and expands from a compact strip above the Captain’s composer; Add/Edit member dialogs stay outside the composer’s focus flow. The slot is hidden while a blocking tool approval or question is open, so the proposal disappears meanwhile; the person's saved roster edits live in J5-owned `apps/web/src/j5/crew/crewProposalDraftStore.ts` (keyed by environment and proposal, cleared when the proposal is approved or declined) and are restored when the gate returns. Mid-run seat additions stay on the inbox bell (`crewProposals.logic.ts` decides which is which). The human gate (open proposals, approve with edited seats, decline) lives entirely in J5 files: `apps/web/src/j5/crew/`, the J5 inbox page and bell, and the list, preview and resolve RPCs (case 64). One adapter append makes the gate reachable from Claude: `claudeMcpQueryOverrides` in `apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.ts` spreads J5-owned `J5_CLAUDE_MCP_ALLOWED_TOOLS` (`apps/server/src/j5/a2a/mcp/claudeAllowedTools.ts`) into the read-only pre-approval list, because Claude runs read-only personas in `dontAsk` mode and would otherwise deny every J5 coordination tool; the upstream `CLAUDE_READ_ONLY_T3_MCP_ALLOWED_TOOLS` constant and its toolkit cross-check stay untouched, and the two exact-allowlist assertions in `ClaudeAdapterV2.test.ts` include the J5 spread. The Codex counterpart is one spread in `codexThreadRuntimeParams` (`apps/server/src/orchestration-v2/Adapters/CodexAdapterV2.ts`, private to that file since the 2026-10-24 advance): upstream's injected `"mcp_servers.t3-code"` entry gains J5-owned `J5_CODEX_T3_MCP_SERVER_CONFIG` (`apps/server/src/j5/a2a/mcp/codexToolApproval.ts`; since 2026-09-14 a per-tool `tools.<verb>.approval_mode = "approve"` map naming the J5 verbs plus `j5_write_artifact` (a saved agent's declared handoff artifact lives in application storage, never the workspace) and, since 2026-09-15, the provider-native Subagent verbs `delegate_task`, `task_status`, and `task_cancel` (a Crew member refused `j5_spawn_agent` is sent there), never a server-wide default, so worktree handoff, browser preview, and scheduling keep Codex's own verdict for read-only personas), because Codex 0.153+ rejects every non-read-only MCP tool under approval policy `never` with "MCP tool call requires approval, but approval policy is never"; that policy is what full-access mode and every saved-agent runtime policy send, so without the spread `j5_send_message`, `j5_spawn_agent`, and `j5_propose_crew` all fail on Codex. The full spread applies when the thread's resolved approval policy is `never` (`j5ApprovalPolicyIsNever`). Since 2026-09-24 both appends draw their names from one J5 leaf module, `apps/server/src/j5/a2a/mcp/j5ToolPreapproval.ts` (`J5_PREAPPROVED_TOOLS`, the interactive-mode `J5_COORDINATION_TOOLS`, and `j5PreapprovedTools(runtimePolicy)`), so Codex and Claude, the two harnesses J5 pre-approves its tools on (Jackson's ruling on #233), pre-approve the same set. Interactive modes pre-approve only routine messaging and the crew proposal/request tools; membership still waits for the platform's human roster or Inbox decision. Other tools retain Codex's prompting. The ten upstream tools admitted on 2026-10-08 (case 4) are not in J5's pre-approval lists; they keep each harness's own verdict, and upstream's Claude read-only list already carries `html_preview` and `html_render`. The expected thread config in `CodexAdapterV2.test.ts` includes the spread.

`packages/client-runtime/src/state/models.ts` accepts a status-only runtime in `threadRuntimeIsActive`; J5 crew state reuses that exported predicate without importing the upstream-private status helper. Preserve this narrow input contract when carrying crew reads forward.

Expand Down
9 changes: 8 additions & 1 deletion apps/server/src/j5/a2a/AgentCrewProposalService.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
import { ModelSelection, RuntimeMode, ThreadId } from "@t3tools/contracts";
import {
AGENT_PERSONA_INSTRUCTIONS_MAX_LENGTH,
ModelSelection,
RuntimeMode,
ThreadId,
} from "@t3tools/contracts";
import { CrewPersonaSwap, PLAYBOOK_MAX_STEPS } from "@t3tools/contracts/j5";
import * as Context from "effect/Context";
import * as Effect from "effect/Effect";
Expand All @@ -23,6 +28,8 @@ export const CrewProposalSeat = Schema.Struct({
agentId: Schema.NullOr(bounded(CREW_NAME_MAX_CHARS)),
reason: bounded(CREW_REASON_MAX_CHARS),
instructions: Schema.optional(bounded(CREW_TEXT_MAX_CHARS)),
/** Set only by the person's roster card, never by an agent's request: the persona's text, replaced. */
personaInstructions: Schema.optional(bounded(AGENT_PERSONA_INSTRUCTIONS_MAX_LENGTH)),
modelSelection: Schema.optional(ModelSelection),
runtimeMode: Schema.optional(RuntimeMode),
/**
Expand Down
60 changes: 60 additions & 0 deletions apps/server/src/j5/a2a/CrewLaunchService.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1182,6 +1182,66 @@ it.effect("a full-access persona seat runs full access unless the seat overrides
}).pipe(Effect.scoped),
);

it.effect("a persona seat's edited instructions replace the persona's own at launch", () =>
Effect.gen(function* () {
const { context, commands, captain } = yield* fixture;
const layer = crewLaunchLayer.pipe(
Layer.provideMerge(
dependencies(commands, [
provider("codex", "codex", [{ slug: "gpt-5.6-terra", options: ["high"] }]),
]),
),
Layer.provideMerge(Layer.succeedContext(context)),
Layer.provideMerge(
personaLibraryLayer("j5-edited-persona-", Object.values(BUILT_IN_AGENT_PERSONAS)),
),
Layer.provideMerge(NodeServices.layer),
);
yield* Effect.gen(function* () {
const launcher = yield* CrewLaunchService;
const library = yield* makeAgentPersonaLibrary;
const seat = {
name: "scout",
agentId: "scout",
reason: "Look around",
workspace: { type: "shared" as const },
};
const instructionsOf = (resolved: (typeof plain)[number]) =>
resolveAgentPersonaRuntime(
{ agentPersonaAssignment: resolved.assignment!, runtimeMode: resolved.runtimeMode },
library,
).pipe(Effect.map(({ agentPersonaInstructions }) => agentPersonaInstructions!));
const plain = yield* launcher.resolveSeats(captain, [seat]);
const edited = yield* launcher.resolveSeats(captain, [
{ ...seat, personaInstructions: "Only read the README." },
]);
const original = BUILT_IN_AGENT_PERSONAS.scout.instructions;
assert.include(yield* instructionsOf(plain[0]!), original);
const replaced = yield* instructionsOf(edited[0]!);
assert.include(replaced, "Only read the README.");
assert.notInclude(replaced, original);
assert.equal(edited[0]!.assignment!.personaId, plain[0]!.assignment!.personaId);
assert.equal(edited[0]!.assignment!.instructionsEdited, true);
assert.notProperty(plain[0]!.assignment!, "instructionsEdited");
assert.notEqual(
edited[0]!.assignment!.definitionDigest,
plain[0]!.assignment!.definitionDigest,
);
// A seat with no edit resolves exactly as it always did, so its approval token is unchanged.
assert.deepStrictEqual(yield* launcher.resolveSeats(captain, [seat]), plain);
const proposal = {
id: "proposal:edit",
brief: "Look around.",
displayName: "Edit",
} as unknown as Parameters<typeof crewApprovalToken>[0];
assert.notEqual(
crewApprovalToken(proposal, captain, plain),
crewApprovalToken(proposal, captain, edited),
);
}).pipe(Effect.provide(layer));
}).pipe(Effect.scoped),
);

it.effect("refuses persona seats whose effective ACP access the harness cannot enforce", () =>
Effect.gen(function* () {
const { context, commands, captain } = yield* fixture;
Expand Down
36 changes: 34 additions & 2 deletions apps/server/src/j5/a2a/CrewLaunchService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ import { ThreadManagementService } from "../../orchestration-v2/ThreadManagement
import { ProviderRegistry } from "../../provider/ProviderRegistry.ts";
import { prepareAgentPersonaLaunch } from "../agents/agentPersonaLaunch.ts";
import { agentHandoffArtifactPath } from "../agents/agentPersonaArtifacts.ts";
import { makeAgentPersonaLibrary } from "../agents/agentPersonaLibrary.ts";
import {
AgentPersonaLibraryError,
makeAgentPersonaLibrary,
} from "../agents/agentPersonaLibrary.ts";
import {
providerCanEnforceAgentPersonaAuthority,
translateAgentPersonaProviderPolicy,
Expand Down Expand Up @@ -69,6 +72,8 @@ export interface CrewLaunchSeat {
readonly agentId: string | null;
readonly reason: string | null;
readonly instructions?: string | undefined;
/** Replaces the persona's own instructions for this seat; set only by the person's roster card. */
readonly personaInstructions?: string | undefined;
readonly modelSelection?: ModelSelection | undefined;
readonly runtimeMode?: RuntimeMode | undefined;
/** Ids of the playbook steps the seat owns; recorded on its member row. */
Expand Down Expand Up @@ -377,7 +382,7 @@ export const layer = Layer.effect(
});
continue;
}
const assignment = yield* Effect.gen(function* () {
const prepared = yield* Effect.gen(function* () {
if (seat.modelSelection === undefined) {
const prepared = yield* prepareAgentPersonaLaunch(
{ personaId: agentId },
Expand Down Expand Up @@ -437,6 +442,33 @@ export const layer = Layer.effect(
}),
),
);
// The person's edited text runs instead of the persona's, never beside it: the seat's
// assignment points at a snapshot of the persona with that text.
const assignment =
seat.personaInstructions === undefined
? prepared
: yield* agents.readSnapshot(prepared).pipe(
Effect.flatMap((definition) =>
agents.snapshot({ ...definition, instructions: seat.personaInstructions! }),
),
Effect.flatMap((definitionDigest) =>
definitionDigest === undefined
? Effect.fail(
new AgentPersonaLibraryError({
message: "Persona snapshot storage is unavailable.",
}),
)
: Effect.succeed({ ...prepared, definitionDigest, instructionsEdited: true }),
),
Effect.mapError(
(error) =>
new CrewLaunchSeatUnavailableError({
seatName: seat.name,
agentId,
detail: error.message,
}),
),
);
// Every seat reaching this point was approved by a human, and that approval is the
// authority: explicit runtime choices override the persona sandbox while its behavior
// instructions remain pinned to the original snapshot.
Expand Down
Loading
Loading