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
2 changes: 1 addition & 1 deletion FORK.md
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ migrations after upstream migrations.

102. Mobile's thread list has an Inbox bell with the open count ([#830](https://github.com/Jacksondr5/j5code/issues/830)), as web's rail does. J5-owned `apps/mobile/src/j5/inbox/InboxBell.tsx` reads every connected server's open count (`inboxCountSourcesAtom`, case 101), says it through `inboxBellPresentation` (`packages/client-runtime/src/j5/inbox.ts`, shared with web's bell), and opens the `Inbox` screen. It counts open asks only; web's also counts Crew requests and seat approvals, which come to mobile with Crews. Two headers mount it, each with one import and one or two lines: `apps/mobile/src/features/home/ThreadListToolbar.tsx` (Android) adds it beside `filterButton` in the toolbar row's `filter` slot when a server is saved, and `apps/mobile/src/features/workspace/WorkspaceToolbar.ios.tsx` adds it as a `Toolbar.Custom` in the right toolbar of the thread list on iPhone and iPad alike (iOS draws its sidebar's header natively, through this toolbar). Android's split view draws its sidebar header with the same `ThreadListToolbar`, so it gets the bell there; no other header holds the thread list's filter. Upstream's symbol set has no plain bell on Android, so J5's `BellGlyph` draws Tabler's there and the SF Symbol on iOS. On a pin advance: if upstream moves the thread list's filter, move the bell with it.

103. Mobile's persona forms and Playbook conversation form are pushed settings pages ([#894](https://github.com/Jacksondr5/j5code/issues/894), [#902](https://github.com/Jacksondr5/j5code/issues/902)), since Android's `Menu` draws in the app's root window and can't appear over an RN `Modal` or upstream's `Sheet`. `apps/mobile/src/Stack.tsx` imports J5-owned `j5SettingsFormRoutes` (`apps/mobile/src/j5/agents/routes.ts`) and spreads it into `SETTINGS_SCREENS` after `SettingsAgents`, adding `SettingsPersonaNew`, `SettingsPersonaEdit` and `SettingsPlaybookConversation`. They follow upstream's `SettingsScheduledTaskNew` and `SettingsScheduledTaskEdit`, including the guard against losing unsaved changes. On a pin advance: if upstream reshapes `SETTINGS_SCREENS`, spread the routes among them again.
103. Mobile's persona forms are pushed settings pages ([#894](https://github.com/Jacksondr5/j5code/issues/894)), since Android's `Menu` draws in the app's root window and can't appear over an RN `Modal` or upstream's `Sheet`. `apps/mobile/src/Stack.tsx` imports J5-owned `j5SettingsFormRoutes` (`apps/mobile/src/j5/agents/routes.ts`) and spreads it into `SETTINGS_SCREENS` after `SettingsAgents`, adding `SettingsPersonaNew` and `SettingsPersonaEdit`. They follow upstream's `SettingsScheduledTaskNew` and `SettingsScheduledTaskEdit`, including the guard against losing unsaved changes. On a pin advance: if upstream reshapes `SETTINGS_SCREENS`, spread the routes among them again. Starting a playbook opens upstream's new-chat draft instead of a page of its own ([#963](https://github.com/Jacksondr5/j5code/issues/963)).

104. A Crew notice with nothing for the person takes no timeline row ([#741](https://github.com/Jacksondr5/j5code/issues/741), Bryant 2026-10-27). `apps/web/src/components/chat/MessagesTimeline.tsx` carries one J5 import and one changed line in `ConversationTimeline`: `const rows = useStableRows(withoutHiddenCrewNotices(rawRows), listIdentityKey)`, J5-owned in `apps/web/src/j5/crew/crewNotices.logic.ts`. It drops the message rows of platform Crew notices (`createdBy === "system"`) whose `crewNoticeLines` are empty, a clean launch report or a clean finish, after upstream has derived the rows, so each notice still bounds the Captain turn it started (`deriveActiveVisualResponseRunIds`, terminal assistant messages and rollback all read user messages as turn boundaries), and returns the same array when nothing is hidden, cached per input array, because `useStableRows` compares its source by identity. Upstream's minimap reads the filtered rows, so an ask's reply preview can run past a hidden notice; that is accepted. Proof: `apps/web/src/j5/crew/crewNotices.logic.test.ts`, "keeps the rows a hidden notice bounded". On a pin advance: if upstream stops deriving rows through `useStableRows`, apply the filter to whatever the list renders, after turn boundaries are computed, never to the entries before them.

Expand Down
8 changes: 1 addition & 7 deletions apps/mobile/src/j5/agents/SettingsFormScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
} from "@react-navigation/native";
import type { NativeStackNavigationProp } from "@react-navigation/native-stack";
import type { AgentPersonaCreateDraft } from "@t3tools/client-runtime/j5/agent-personas";
import type { AgentPersonaEditInput, EnvironmentId, ProjectId } from "@t3tools/contracts";
import type { AgentPersonaEditInput, EnvironmentId } from "@t3tools/contracts";
import { useRef, type ReactNode } from "react";
import { KeyboardAvoidingView, Platform } from "react-native";
import { useSafeAreaInsets } from "react-native-safe-area-context";
Expand All @@ -27,12 +27,6 @@ export type SettingsFormRoutes = {
readonly environmentId: EnvironmentId;
readonly initial: Omit<AgentPersonaEditInput, "instructions">;
};
SettingsPlaybookConversation: {
readonly environmentId: EnvironmentId;
readonly name: string | null;
/** The project Settings is showing, so a project playbook's chat opens where it lives. */
readonly projectId: ProjectId | null;
};
};

export function useSettingsFormNavigation() {
Expand Down
7 changes: 1 addition & 6 deletions apps/mobile/src/j5/agents/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ import { createNativeStackScreen } from "@react-navigation/native-stack";

import { AgentCreateScreen } from "./AgentCreateScreen";
import { AgentEditorScreen } from "./AgentEditorScreen";
import { PlaybookConversationScreen } from "../playbooks/PlaybookConversationScreen";

/** The Personas page's forms, beside upstream's settings pages (FORK.md case 103). */
/** The persona forms, beside upstream's settings pages (FORK.md case 103). */
export const j5SettingsFormRoutes = <Options extends object>(options: Options) => ({
SettingsPersonaNew: createNativeStackScreen({
screen: AgentCreateScreen,
Expand All @@ -14,8 +13,4 @@ export const j5SettingsFormRoutes = <Options extends object>(options: Options) =
screen: AgentEditorScreen,
options: { ...options, title: "Edit persona" },
}),
SettingsPlaybookConversation: createNativeStackScreen({
screen: PlaybookConversationScreen,
options: { ...options, title: "Prepare chat" },
}),
});
185 changes: 0 additions & 185 deletions apps/mobile/src/j5/playbooks/PlaybookConversationScreen.tsx

This file was deleted.

10 changes: 3 additions & 7 deletions apps/mobile/src/j5/playbooks/PlaybookLibrarySettingsScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { useRemoteConnectionStatus } from "../../state/use-remote-environment-re
import { AgentFolderPickerModal } from "../agents/AgentFolderPickerModal";
import { useOwnedEnvironmentIds } from "../sharing/guestAccess";
import { j5Environment } from "../state";
import { useSettingsFormNavigation } from "../agents/SettingsFormScreen";
import { useStartPlaybookConversation } from "./startPlaybookConversation";

export function PlaybookLibrarySettingsSection({
environmentId,
Expand Down Expand Up @@ -76,13 +76,9 @@ function PlaybookLibrary({
const [yaml, setYaml] = useState("");
const [busy, setBusy] = useState(false);
const [error, setError] = useState<string | null>(null);
const navigation = useSettingsFormNavigation();
const startConversation = useStartPlaybookConversation(environmentId);
const openConversation = (playbook: string | null) =>
navigation.navigate("SettingsPlaybookConversation", {
environmentId,
name: playbook,
projectId: project?.id ?? null,
});
void act(() => startConversation({ playbook, projects, projectId: project?.id ?? null }));
const [details, setDetails] = useState<string | null>(null);
const [copyTarget, setCopyTarget] = useState<{
name: string;
Expand Down
89 changes: 89 additions & 0 deletions apps/mobile/src/j5/playbooks/startPlaybookConversation.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
import { StackActions, useNavigation } from "@react-navigation/native";
import {
ensurePlaybookAuthor,
PLAYBOOK_AUTHOR_ID,
PLAYBOOK_AUTHOR_PROMPT,
playbookWorkspaces,
} from "@t3tools/client-runtime/j5/playbooks";
import { squashAtomCommandFailure } from "@t3tools/client-runtime/state/runtime";
import type { EnvironmentId, ProjectId } from "@t3tools/contracts";

import { useServerConfigs } from "../../state/entities";
import { useAtomCommand } from "../../state/use-atom-command";
import { useAtomQueryRunner } from "../../state/use-atom-query-runner";
import { selectDraftAgent } from "../agents/agentDraftState";
import { agentPersonaEnvironment } from "../agents/agentPersonaAtoms";
import { preparePlaybookDraft } from "./preparePlaybookDraft";

/**
* Opens upstream's new chat on a prepared draft, so the person picks the project from its heading.
* Prepare chat fills "Start playbook <name>"; Create picks Playbook Author and its opening prompt.
*/
export function useStartPlaybookConversation(environmentId: EnvironmentId) {
const navigation = useNavigation();
const serverConfigs = useServerConfigs();
const readCatalog = useAtomQueryRunner(agentPersonaEnvironment.catalog, {
reportFailure: false,
refresh: true,
});
const readAuthor = useAtomCommand(agentPersonaEnvironment.readAgentPersona, {
reportFailure: false,
});
const editAuthor = useAtomCommand(agentPersonaEnvironment.editImportedAgentPersona, {
reportFailure: false,
});
const createPersona = useAtomCommand(agentPersonaEnvironment.createAgentPersona, {
reportFailure: false,
});
return async (input: {
readonly playbook: string | null;
readonly projects: Parameters<typeof playbookWorkspaces>[0];
/** The project Settings is showing, so a project playbook's chat opens where it lives. */
readonly projectId: ProjectId | null;
}) => {
const workspaces = playbookWorkspaces(input.projects, []);
const workspace =
workspaces.find((entry) => entry.projectId === input.projectId) ?? workspaces[0];
if (!workspace)
throw new Error(
"Add a project to open a conversation. You can import playbooks without one.",
);
if (input.playbook === null)
await ensurePlaybookAuthor({
providers: serverConfigs.get(environmentId)?.providers ?? [],
readCatalog: async () => {
const result = await readCatalog({ environmentId, input: {} });
if (result._tag === "Failure") throw squashAtomCommandFailure(result);
return result.value;
},
readDefinition: async (personaId) => {
const result = await readAuthor({ environmentId, input: { personaId } });
if (result._tag === "Failure") throw squashAtomCommandFailure(result);
return result.value.definition;
},
editPersona: async (edit) => {
const result = await editAuthor({ environmentId, input: edit });
if (result._tag === "Failure") throw squashAtomCommandFailure(result);
},
createPersona: async (definition) => {
const result = await createPersona({ environmentId, input: definition });
if (result._tag === "Failure") throw squashAtomCommandFailure(result);
},
});
const draftId = preparePlaybookDraft(
workspace,
input.playbook === null ? PLAYBOOK_AUTHOR_PROMPT : `Start playbook ${input.playbook}`,
);
if (input.playbook === null) selectDraftAgent(draftId, PLAYBOOK_AUTHOR_ID);
navigation.dispatch(
StackActions.push("Thread", {
draft: {
environmentId,
projectId: workspace.projectId,
title: workspace.title,
draftId,
},
}),
);
};
}
5 changes: 4 additions & 1 deletion apps/server/src/j5/playbooks/PlaybookLibrary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,10 @@ export const makePlaybookLibrary = Effect.gen(function* () {
const selected = selectPlaybookSource(yield* sources(workspaceRoot || undefined), stem);
if (selected.issue) return yield* selected.issue;
if (!selected.entry)
return yield* playbookError("not_found", `No playbook named ${stem}. Use j5_playbook_list.`);
return yield* playbookError(
"not_found",
`No playbook named ${stem} on this server. Use j5_playbook_list.`,
);
return {
stem,
source: selected.entry.source,
Expand Down
Loading
Loading