diff --git a/client/src/components/Assistant/cards/home/ChatHandOver.tsx b/client/src/components/Assistant/cards/home/ChatHandOver.tsx new file mode 100644 index 000000000..d49a14f8d --- /dev/null +++ b/client/src/components/Assistant/cards/home/ChatHandOver.tsx @@ -0,0 +1,49 @@ +import { ArrowRight, MessageSquareText } from 'lucide-react'; + +import { useTranslation } from '../../../../i18n'; +import { type AssistantChatTrip, useAssistantView } from '../../assistantViewContext'; + +/** + * What the home chat's cards that go on in another chat share: the question + * handed over, waiting there ready to send, and the button that switches to + * that chat. The button shows only where a chat can be switched to. + */ + +/** The question that waits in the other chat's composer. */ +export function HandedQuestion({ question }: { question: string | null }) { + const { t } = useTranslation(); + if (!question) return null; + return ( +

+

+ ); +} + +/** The button that goes on in the chat under `chat`, with the question handed over. */ +export function OpenChatButton({ + chat, + question, + label, +}: { + chat: AssistantChatTrip; + question: string | null; + label: string; +}) { + const { onOpenTripChat, variant } = useAssistantView(); + if (!onOpenTripChat) return null; + return ( + + ); +} diff --git a/client/src/components/Assistant/cards/home/JournalChatBlock.test.tsx b/client/src/components/Assistant/cards/home/JournalChatBlock.test.tsx new file mode 100644 index 000000000..e123808e1 --- /dev/null +++ b/client/src/components/Assistant/cards/home/JournalChatBlock.test.tsx @@ -0,0 +1,72 @@ +/** + * FE-AI-JOURNALCHAT-001 to FE-AI-JOURNALCHAT-003 + * + * The home chat's card that offers a journal's own chat: the journal with + * its subtitle or days and what it holds, the question waiting there, and the + * button that goes on in the chat kept under the journey's key. + */ +import type { JournalChatCard } from '@trek/shared'; +import { describe, expect, it, vi } from 'vitest'; + +import { fireEvent, render, screen } from '../../../../../tests/helpers/render'; +import { AssistantViewContext } from '../../assistantViewContext'; +import { JournalChatBlock } from './JournalChatBlock'; + +const JAPAN: JournalChatCard = { + kind: 'journalChat', + journey: { + id: 12, + title: 'Japan 2026', + subtitle: null, + startDate: '2026-11-02', + endDate: '2026-11-16', + entryCount: 4, + photoCount: 120, + }, + question: 'Make a new entry for Berlin Hauptbahnhof', +}; + +function drawn( + cards: JournalChatCard[], + onOpenTripChat?: (chat: { id: number; title: string }, q: string | null) => void +) { + return render( + + ({ toolCallId: `j${index}`, card }))} /> + + ); +} + +describe('JournalChatBlock', () => { + it('FE-AI-JOURNALCHAT-001: shows the journal, its days, what it holds and the question', () => { + drawn([JAPAN]); + expect(screen.getByRole('region', { name: 'Continue in a journal' })).toBeInTheDocument(); + expect(screen.getByText('Japan 2026')).toBeInTheDocument(); + expect(screen.getByText('4 entries')).toBeInTheDocument(); + expect(screen.getByText('120 photos')).toBeInTheDocument(); + expect(screen.getByText('Make a new entry for Berlin Hauptbahnhof')).toBeInTheDocument(); + // Nowhere to switch to: no button. + expect(screen.queryByRole('button')).not.toBeInTheDocument(); + }); + + it("FE-AI-JOURNALCHAT-002: the button goes on in the journal's chat, under the journey's key", () => { + const open = vi.fn(); + drawn([JAPAN], open); + fireEvent.click(screen.getByRole('button', { name: "Continue in this journal's chat" })); + expect(open).toHaveBeenCalledWith({ id: -12, title: 'Japan 2026' }, 'Make a new entry for Berlin Hauptbahnhof'); + }); + + it('FE-AI-JOURNALCHAT-003: a subtitle stands for the days, an empty journal shows no photos, nothing draws nothing', () => { + const bare: JournalChatCard = { + ...JAPAN, + journey: { ...JAPAN.journey, subtitle: 'Autumn', startDate: null, endDate: null, entryCount: 0, photoCount: 0 }, + question: null, + }; + drawn([bare]); + expect(screen.getByText('Autumn')).toBeInTheDocument(); + expect(screen.getByText('0 entries')).toBeInTheDocument(); + expect(screen.queryByText(/photos?$/)).not.toBeInTheDocument(); + const { container } = render(); + expect(container).toBeEmptyDOMElement(); + }); +}); diff --git a/client/src/components/Assistant/cards/home/JournalChatBlock.tsx b/client/src/components/Assistant/cards/home/JournalChatBlock.tsx new file mode 100644 index 000000000..a3fea6af5 --- /dev/null +++ b/client/src/components/Assistant/cards/home/JournalChatBlock.tsx @@ -0,0 +1,76 @@ +import type { JournalChatCard } from '@trek/shared'; +import { BookOpen } from 'lucide-react'; + +import { useTranslation } from '../../../../i18n'; +import { assistantChatKey } from '../../../../store/assistantChatKey'; +import { WhiteBadge } from '../../../Planner/planParts'; +import type { CardEntry } from '../cardTypes'; +import CardFrame from '../parts/CardFrame'; +import CardHeader from '../parts/CardHeader'; +import { useCardFormat } from '../parts/useCardFormat'; +import { chatDates } from './chatDates'; +import { HandedQuestion, OpenChatButton } from './ChatHandOver'; + +/** + * The home chat's way onto a journal's own page: the journal under its head + * (its subtitle or days, how many entries and photos it holds), the question + * that waits there ready to send, and the button that goes on in the + * journal's chat. That chat is the journey's conversation on its page, kept + * under the journey's key; the window switches to it in place, the phone + * opens the journal with its chat. + */ + +function JournalFacts({ card }: { card: JournalChatCard }) { + const { t } = useTranslation(); + const { entryCount, photoCount } = card.journey; + return ( +
+ {t('assistant.card.journey.entries', { count: entryCount })} + {photoCount > 0 && {t('assistant.card.journey.photos', { count: photoCount })}} +
+ ); +} + +function JournalChatSection({ card, first }: { card: JournalChatCard; first: boolean }) { + const { t } = useTranslation(); + const format = useCardFormat(); + const { journey, question } = card; + const meta = journey.subtitle ?? chatDates(t, format.date, journey.startDate, journey.endDate); + const chat = { id: assistantChatKey({ kind: 'journey', journeyId: journey.id }), title: journey.title }; + return ( +
+ {first ? ( + + + + ) : ( +
+ {journey.title} +
{meta}
+ +
+ )} + + +
+ ); +} + +export function JournalChatBlock({ cards }: { cards: readonly CardEntry[] }) { + const { t } = useTranslation(); + const journals = cards.flatMap((entry) => (entry.card.kind === 'journalChat' ? [entry.card] : [])); + if (journals.length === 0) return null; + return ( + + {journals.map((card, index) => ( + + ))} + + ); +} diff --git a/client/src/components/Assistant/cards/home/TripChatBlock.tsx b/client/src/components/Assistant/cards/home/TripChatBlock.tsx index 4a8e7b466..f81b59a07 100644 --- a/client/src/components/Assistant/cards/home/TripChatBlock.tsx +++ b/client/src/components/Assistant/cards/home/TripChatBlock.tsx @@ -1,13 +1,14 @@ import type { TripChatCard, TripChatPhase } from '@trek/shared'; -import { ArrowRight, Luggage, MessageSquareText } from 'lucide-react'; +import { Luggage } from 'lucide-react'; import { useTranslation } from '../../../../i18n'; import { type PillTone, SoftPill, WhiteBadge } from '../../../Planner/planParts'; -import { useAssistantView } from '../../assistantViewContext'; import type { CardEntry } from '../cardTypes'; import CardFrame from '../parts/CardFrame'; import CardHeader from '../parts/CardHeader'; import { useCardFormat } from '../parts/useCardFormat'; +import { chatDates } from './chatDates'; +import { HandedQuestion, OpenChatButton } from './ChatHandOver'; /** * The home chat's way into one trip's own chat: the trip under its head (its @@ -27,18 +28,9 @@ const PHASE: Readonly, { labelKey: stri function TripChatSection({ card, first }: { card: TripChatCard; first: boolean }) { const { t } = useTranslation(); - const { onOpenTripChat, variant } = useAssistantView(); const format = useCardFormat(); const { trip, question } = card; - const start = trip.startDate ?? trip.endDate; - const end = trip.endDate ?? trip.startDate; - let dates = t('assistant.card.tripChat.noDates'); - if (start && end) { - dates = - start === end - ? format.date(start) - : t('assistant.card.tripChat.dates', { start: format.date(start), end: format.date(end) }); - } + const dates = chatDates(t, format.date, trip.startDate, trip.endDate); const phase = trip.phase === 'undated' ? null : PHASE[trip.phase]; return (
@@ -59,25 +51,12 @@ function TripChatSection({ card, first }: { card: TripChatCard; first: boolean }
)} - {question && ( -

-

- )} - {onOpenTripChat && ( - - )} + + ); } diff --git a/client/src/components/Assistant/cards/home/chatDates.ts b/client/src/components/Assistant/cards/home/chatDates.ts new file mode 100644 index 000000000..155c66916 --- /dev/null +++ b/client/src/components/Assistant/cards/home/chatDates.ts @@ -0,0 +1,17 @@ +/** + * The days a card of another chat names under its head: one day, a span, or + * that it has none yet. Pure, so the trip's card and the journal's read one + * wording. + */ +export function chatDates( + t: (key: string, params?: Record) => string, + date: (value: string) => string, + startDate: string | null, + endDate: string | null +): string { + const start = startDate ?? endDate; + const end = endDate ?? startDate; + if (!start || !end) return t('assistant.card.tripChat.noDates'); + if (start === end) return date(start); + return t('assistant.card.tripChat.dates', { start: date(start), end: date(end) }); +} diff --git a/client/src/components/Assistant/cards/home/homeLook.ts b/client/src/components/Assistant/cards/home/homeLook.ts index 9c63935ae..661494b63 100644 --- a/client/src/components/Assistant/cards/home/homeLook.ts +++ b/client/src/components/Assistant/cards/home/homeLook.ts @@ -13,9 +13,11 @@ export const HOME_LOOK = { steps: { list_trips: { stepKey: 'assistant.step.readingTrips' }, open_trip_chat: { stepKey: 'assistant.step.openTripChat' }, + open_journey_chat: { stepKey: 'assistant.step.openJournalChat' }, }, entities: {}, cards: { tripChat: {}, + journalChat: {}, }, -} satisfies PackLook<'tripChat'>; +} satisfies PackLook<'tripChat' | 'journalChat'>; diff --git a/client/src/components/Assistant/cards/home/homeViews.tsx b/client/src/components/Assistant/cards/home/homeViews.tsx index 2d3b10ef2..ab727daed 100644 --- a/client/src/components/Assistant/cards/home/homeViews.tsx +++ b/client/src/components/Assistant/cards/home/homeViews.tsx @@ -1,12 +1,14 @@ import type { CardView } from '../cardTypes'; +import { JournalChatBlock } from './JournalChatBlock'; import { TripChatBlock } from './TripChatBlock'; /** - * How the home chat's kind draws: the trip it offers to go on with, beside - * the answer. This file only maps the kind to its view; the component lives + * How the home chat's kinds draw: the trip or the journal it offers to go on + * with, beside the answer. This file only maps the kind to its view; the component lives * in a sibling file, since a file that exports anything besides components * breaks fast refresh. */ export const HOME_VIEWS = { tripChat: { Block: TripChatBlock }, -} satisfies { [K in 'tripChat']: CardView }; + journalChat: { Block: JournalChatBlock }, +} satisfies { [K in 'tripChat' | 'journalChat']: CardView }; diff --git a/server/src/nest/assistant/assistant-home-journeys.ts b/server/src/nest/assistant/assistant-home-journeys.ts new file mode 100644 index 000000000..9cc3629e0 --- /dev/null +++ b/server/src/nest/assistant/assistant-home-journeys.ts @@ -0,0 +1,98 @@ +import type { AiToolSpec } from '../ai-connections/ai-chat-client.interface'; +import type { ToolRun } from './assistant-tools.service'; + +/** + * The home chat's way onto a journal's own page, the twin of open_trip_chat: + * a journal's entries, photos and settings change in the chat on its page, + * which knows them, so the home chat hands the question over there. The + * journal is read from the user's own journals (`list_journeys`, with the + * user's rights), so the card never names one the user cannot open. + */ + +/** The server's own step that offers to go on on a journal's page; no MCP tool has its name. */ +export const OPEN_JOURNEY_CHAT_TOOL = 'open_journey_chat'; + +/** The read the step answers from, offered only where the journal addon lists journals. */ +export const OPEN_JOURNEY_CHAT_READ = 'list_journeys'; + +/** The longest journal title and subtitle a card carries. */ +const MAX_TITLE_CHARS = 200; +const MAX_SUBTITLE_CHARS = 300; + +/** How the model is offered the way onto a journal's page. */ +export const OPEN_JOURNEY_CHAT_SPEC: AiToolSpec = { + name: OPEN_JOURNEY_CHAT_TOOL, + description: + "Offer the user to go on in the chat on one journal's own page, shown as a card with a button. Use it when the " + + 'user wants to write, change or delete entries of a journal, add or move its photos, or change its settings, ' + + "which only that journal's chat can do. Pass the journal's id from list_journeys (or from create_journey's " + + "answer) and the question to ask there, in the user's words and language. Call it once per journal, next to a " + + 'short answer saying why.', + parameters: { + type: 'object', + properties: { + journeyId: { type: 'integer', minimum: 1, description: 'The id of the journal, from list_journeys.' }, + question: { + type: 'string', + maxLength: 500, + description: "What to ask in the journal's chat, as the user would; leave it out when there is nothing to ask.", + }, + }, + required: ['journeyId'], + additionalProperties: false, + }, +}; + +const DATE = /^\d{4}-\d{2}-\d{2}$/; + +function dateOf(value: unknown): string | null { + return typeof value === 'string' && DATE.test(value.slice(0, 10)) ? value.slice(0, 10) : null; +} + +function lineOf(value: unknown, max: number): string | null { + const text = typeof value === 'string' ? value.replace(/\s+/g, ' ').trim().slice(0, max) : ''; + return text || null; +} + +function countOf(value: unknown): number { + const count = Number(value); + return Number.isInteger(count) && count >= 0 ? Math.min(count, 1_000_000) : 0; +} + +/** One journal of a `list_journeys` answer, as the card names it; null for a row without an id or a title. */ +function journalOf(row: unknown) { + const record = (row ?? {}) as Record; + const id = Number(record.id); + const title = lineOf(record.title, MAX_TITLE_CHARS); + if (!Number.isInteger(id) || id <= 0 || !title) return null; + return { + id, + title, + subtitle: lineOf(record.subtitle, MAX_SUBTITLE_CHARS), + startDate: dateOf(record.trip_date_min), + endDate: dateOf(record.trip_date_max), + entryCount: countOf(record.entry_count), + photoCount: countOf(record.photo_count), + }; +} + +/** + * Answers the step from the user's journals: the journal it names, as one + * the user may open, and the question to hand over. A journal the user + * cannot open is refused like one that does not exist. + */ +export function openJourneyChat(args: Record, listed: ToolRun): ToolRun { + const journeyId = Number(args.journeyId); + const rows = listed.ok ? (listed.value as { journeys?: unknown } | null)?.journeys : null; + const row = Array.isArray(rows) ? rows.find((candidate) => Number(candidate?.id) === journeyId) : undefined; + const journey = row === undefined ? null : journalOf(row); + if (!journey) return { ok: false, value: 'No journal of the user has this id. Take the id from list_journeys.' }; + return { + ok: true, + value: { + journey, + question: lineOf(args.question, 500), + shown: "Shown to the user as a card that opens the journal's page with its chat.", + }, + }; +} diff --git a/server/src/nest/assistant/assistant-home.ts b/server/src/nest/assistant/assistant-home.ts index 2f9443d4a..6b3103c2e 100644 --- a/server/src/nest/assistant/assistant-home.ts +++ b/server/src/nest/assistant/assistant-home.ts @@ -227,6 +227,7 @@ How you work: - The home card in the context lists the user's trips with their ids: the ones under way, the next ones, the latest ones behind. list_trips lists them all. Use those ids, or ids a tool returned; never invent one. - You can read any of these trips: pass its id to the trip tools (get_trip_summary, list_places, the budget, packing and to-do lists, the bookings, the weather). Answer questions across trips that way, for example which trip is next, what is still unbooked, or how two trips compare. - You cannot change a trip from here. When the user wants to change or plan one trip, answer in a sentence and call open_trip_chat with its id and their question: the trip's own chat knows its days and places and proposes the changes there. Also offer it when a conversation is about one trip only. +- A travel journal (a journey) is written in the chat on its own page. Here you can start a new one with create_journey, linking the trips the user names, and delete one for its owner with delete_journey; both are among the "journey" tools. To write, change or delete a journal's entries or photos or change its settings, answer in a sentence and call open_journey_chat with the journal's id from list_journeys (or from create_journey's answer) and the user's question. - What belongs to no trip you can change here, through its tools: the atlas (visited countries and regions, the bucket list), the vacation planner, collections of saved places, tours in the tour library, and the user's settings. Their tools are not loaded at first: call use_addon_tools with the groups you need, then use them in the same reply. - To change something, call the tool for the change. Do not describe a change in text and ask whether to make it: the app shows each call to the user as a change card, and nothing happens until they apply it. Never say a change was made unless its result says it was applied. - Act, don't announce. Make the lookups and changes you need in this reply, in as few steps as you can; never end a reply with "I will now ..." and no calls. diff --git a/server/src/nest/assistant/assistant-tool-offer.ts b/server/src/nest/assistant/assistant-tool-offer.ts index 52318b9e4..8788421a4 100644 --- a/server/src/nest/assistant/assistant-tool-offer.ts +++ b/server/src/nest/assistant/assistant-tool-offer.ts @@ -234,22 +234,34 @@ const JOURNEY_WRITE_CONTROLLERS: ReadonlySet = new Set([ 'TripJournalLinkMcp', ]); +/** + * The journey writes the home chat keeps although they name trips or a + * journey: starting a journal (its trips are checked one by one by the tool, + * as for any MCP client), and deleting one, which its own chat leaves out + * because the conversation goes with it; the tool refuses everyone but the + * owner. + */ +const HOME_JOURNEY_WRITES: ReadonlySet = new Set(['create_journey', 'delete_journey']); + /** * Whether the home chat (no one trip, no one journey) keeps an attached tool * once its schema and annotations are known: every read, a trip's or a * journey's too, on the id the model names (the tool itself checks that the * user may read it, as for any MCP client); and the writes that take neither * a trip nor a journey (the atlas, the vacation planner, collections, the - * tour library, the settings). A trip's own changes belong in that trip's - * chat, which the home chat offers instead (open_trip_chat); a journey's stay - * with the journey page, as they do for the Studio's chat. + * tour library, the settings), with a journal's start and its deletion. A + * trip's own changes belong in that trip's chat, which the home chat offers + * instead (open_trip_chat); a journal's in the chat on its page + * (open_journey_chat). */ export function keptAtHome( kind: 'read' | 'write', schemaArgs: Iterable, className: string | undefined, + name = '', ): boolean { if (kind === 'read') return true; + if (HOME_JOURNEY_WRITES.has(name)) return true; if (className !== undefined && JOURNEY_WRITE_CONTROLLERS.has(className)) return false; for (const arg of schemaArgs) if (TRIP_OR_JOURNEY_ARGS.has(arg)) return false; return true; diff --git a/server/src/nest/assistant/assistant-tools.service.ts b/server/src/nest/assistant/assistant-tools.service.ts index fe75e41cb..36cacee2d 100644 --- a/server/src/nest/assistant/assistant-tools.service.ts +++ b/server/src/nest/assistant/assistant-tools.service.ts @@ -5,6 +5,12 @@ import { traceEntry } from '../audit/entry-trace.logger'; import { withRequestContext } from '../database/request-context'; import { FOLLOW_UPS_SPEC } from './assistant-follow-ups'; import { OPEN_TRIP_CHAT_SPEC, OPEN_TRIP_CHAT_TOOL, openTripChat } from './assistant-home'; +import { + OPEN_JOURNEY_CHAT_READ, + OPEN_JOURNEY_CHAT_SPEC, + OPEN_JOURNEY_CHAT_TOOL, + openJourneyChat, +} from './assistant-home-journeys'; import { checkJournalTools, heldInJourney, @@ -150,7 +156,8 @@ export function checkToolCatalog( if (!tools.has(name)) problems.push(`tool "${name}" with a card of its own is not registered`); } for (const name of Object.keys(cards)) { - if (!tools.has(name) && !ASSISTANT_SERVER_TOOLS.has(name) && name !== OPEN_TRIP_CHAT_TOOL) { + const serverStep = name === OPEN_TRIP_CHAT_TOOL || name === OPEN_JOURNEY_CHAT_TOOL; + if (!tools.has(name) && !ASSISTANT_SERVER_TOOLS.has(name) && !serverStep) { problems.push(`tool "${name}" with cards of a package is neither registered nor the server's own`); } } @@ -170,6 +177,7 @@ export function checkToolCatalog( PREVIEW_BOOK_PAGE_TOOL, ASSISTANT_FOLLOW_UPS_TOOL, OPEN_TRIP_CHAT_TOOL, + OPEN_JOURNEY_CHAT_TOOL, ]) { if (tools.has(name)) problems.push(`"${name}" is the server's own step`); } @@ -281,7 +289,8 @@ export class AssistantToolSession { if (!this.grouped) return [...listed, FOLLOW_UPS_SPEC]; const more = Object.keys(ASSISTANT_TOOL_GROUPS).some((group) => !this.loaded.has(group)); if (this.mode === 'home') { - return [...listed, OPEN_TRIP_CHAT_SPEC, ...(more ? [HOME_USE_TOOLS_SPEC] : []), FOLLOW_UPS_SPEC]; + const journals = this.offersJournalChat ? [OPEN_JOURNEY_CHAT_SPEC] : []; + return [...listed, OPEN_TRIP_CHAT_SPEC, ...journals, ...(more ? [HOME_USE_TOOLS_SPEC] : []), FOLLOW_UPS_SPEC]; } return [...listed, REMEMBER_SPEC, ...(more ? [USE_TOOLS_SPEC] : []), FOLLOW_UPS_SPEC]; } @@ -293,10 +302,16 @@ export class AssistantToolSession { if (name === USE_TOOLS_TOOL) return this.grouped ? 'read' : null; // Offering a trip's chat changes nothing; the user decides on the card. if (name === OPEN_TRIP_CHAT_TOOL) return this.mode === 'home' ? 'read' : null; + if (name === OPEN_JOURNEY_CHAT_TOOL) return this.offersJournalChat ? 'read' : null; const tool = this.tools.get(name); return tool?.offered ? tool.kind : null; } + /** The home chat offers a journal's page while the user's journals can be listed (the journal addon is on). */ + private get offersJournalChat(): boolean { + return this.mode === 'home' && this.tools.has(OPEN_JOURNEY_CHAT_READ); + } + /** What a card for this tool goes by; null for a tool this session does not hold. */ hintOf(name: string): ToolHint | null { return this.tools.get(name)?.hint ?? null; @@ -321,6 +336,9 @@ export class AssistantToolSession { async call(name: string, args: ToolArgs): Promise { if (name === USE_TOOLS_TOOL) return this.load(args); if (name === OPEN_TRIP_CHAT_TOOL && this.mode === 'home') return this.offerTripChat(args); + if (name === OPEN_JOURNEY_CHAT_TOOL && this.offersJournalChat) { + return openJourneyChat(args, await this.invoke(OPEN_JOURNEY_CHAT_READ, {})); + } const final = name === TRANSIT_CREATE_TOOL ? await this.withFoundItinerary(args) : args; const run = await this.invoke(name, final); this.audit(name); @@ -493,6 +511,7 @@ export class AssistantToolsService implements OnApplicationBootstrap { tool.kind, Object.keys((tool.inputSchema.properties as object | undefined) ?? {}), catalog.get(tool.name)?.className, + tool.name, ); const mode: SessionMode = undoTargets ? 'undo' : 'home'; return this.session(userId, NO_PIN, mode, { catalog, include, keep }); diff --git a/server/src/nest/assistant/cards/home/index.ts b/server/src/nest/assistant/cards/home/index.ts index 1a9248d59..1ca80c21b 100644 --- a/server/src/nest/assistant/cards/home/index.ts +++ b/server/src/nest/assistant/cards/home/index.ts @@ -1,6 +1,7 @@ import { OPEN_TRIP_CHAT_TOOL, phaseOf } from '../../assistant-home'; +import { OPEN_JOURNEY_CHAT_TOOL } from '../../assistant-home-journeys'; import type { AnswerInput, DomainCards } from '../card-types'; -import { tripChatCardSchema, type TrekCard } from '@trek/shared'; +import { journalChatCardSchema, tripChatCardSchema, type TrekCard } from '@trek/shared'; /** * The home chat's own card: the way into a trip's chat its step offers, @@ -31,7 +32,26 @@ export function tripChatAnswer(input: AnswerInput): TrekCard | null { return parsed.success ? parsed.data : null; } +/** + * The way onto a journal's page its step offers, built from what the step + * answered (a journal of the user's, read from their own journals) and + * checked against the card's schema. + */ +export function journalChatAnswer(input: AnswerInput): TrekCard | null { + const value = (input.value ?? {}) as { journey?: unknown; question?: unknown }; + if (!value.journey) return null; + const parsed = journalChatCardSchema.safeParse({ + kind: 'journalChat', + journey: value.journey, + question: typeof value.question === 'string' && value.question ? value.question : null, + }); + return parsed.success ? parsed.data : null; +} + export const HOME_CARDS: DomainCards = { id: 'home', - tools: { [OPEN_TRIP_CHAT_TOOL]: { answer: tripChatAnswer } }, + tools: { + [OPEN_TRIP_CHAT_TOOL]: { answer: tripChatAnswer }, + [OPEN_JOURNEY_CHAT_TOOL]: { answer: journalChatAnswer }, + }, }; diff --git a/server/tests/unit/nest/assistant/assistant-home-session.test.ts b/server/tests/unit/nest/assistant/assistant-home-session.test.ts index 7f8508507..dca6b4eae 100644 --- a/server/tests/unit/nest/assistant/assistant-home-session.test.ts +++ b/server/tests/unit/nest/assistant/assistant-home-session.test.ts @@ -8,8 +8,10 @@ * session holds its target. */ import { OPEN_TRIP_CHAT_TOOL } from '../../../../src/nest/assistant/assistant-home'; +import { OPEN_JOURNEY_CHAT_TOOL } from '../../../../src/nest/assistant/assistant-home-journeys'; import { USE_TOOLS_TOOL } from '../../../../src/nest/assistant/assistant-tool-offer'; import { AssistantToolsService } from '../../../../src/nest/assistant/assistant-tools.service'; +import { makeJourney } from '../../../helpers/factories/journeys'; import { setAddonEnabled } from '../../../helpers/factories/settings'; import { makeTrip } from '../../../helpers/factories/trips'; import { makeUser } from '../../../helpers/factories/users'; @@ -105,6 +107,40 @@ describe('a home tool session', () => { } }); + it('ASTHSES-007: the journey group brings the start and the deletion of a journal, held as changes', async () => { + const { userId } = await ownerWithTrip(); + const session = await tools.openHome(userId); + try { + await session.call(USE_TOOLS_TOOL, { groups: ['journey'] }); + const names = session.specs().map((spec) => spec.name); + expect(names).toEqual(expect.arrayContaining(['create_journey', 'delete_journey', OPEN_JOURNEY_CHAT_TOOL])); + expect(session.kindOf('create_journey')).toBe('write'); + expect(session.kindOf('delete_journey')).toBe('write'); + expect(session.kindOf('update_journey')).toBeNull(); + expect(session.kindOf(OPEN_JOURNEY_CHAT_TOOL)).toBe('read'); + } finally { + await session.close(); + } + }); + + it("ASTHSES-008: offers a journal's page only for a journal of the user's", async () => { + const { userId } = await ownerWithTrip(); + const journey = await makeJourney(orm, userId, { title: 'Japan 2026' }); + const { user: stranger } = await makeUser(orm); + const own = await tools.openHome(userId); + const theirs = await tools.openHome(stranger.id); + try { + expect(await own.call(OPEN_JOURNEY_CHAT_TOOL, { journeyId: journey.id, question: 'New entry' })).toMatchObject({ + ok: true, + value: { journey: { id: journey.id, title: 'Japan 2026' }, question: 'New entry' }, + }); + expect(await theirs.call(OPEN_JOURNEY_CHAT_TOOL, { journeyId: journey.id })).toMatchObject({ ok: false }); + } finally { + await own.close(); + await theirs.close(); + } + }); + it('ASTHSES-003: reads a trip of the user by its id, and only with the user rights', async () => { const { userId, tripId } = await ownerWithTrip(); const { user: stranger } = await makeUser(orm); @@ -146,6 +182,7 @@ describe('a home tool session', () => { try { expect(session.specs().map((spec) => spec.name)).toEqual(['delete_collection']); expect(session.kindOf(OPEN_TRIP_CHAT_TOOL)).toBeNull(); + expect(session.kindOf(OPEN_JOURNEY_CHAT_TOOL)).toBeNull(); expect(session.kindOf(USE_TOOLS_TOOL)).toBeNull(); } finally { await session.close(); diff --git a/server/tests/unit/nest/assistant/assistant-home.test.ts b/server/tests/unit/nest/assistant/assistant-home.test.ts index a9fe30183..2236d1d1b 100644 --- a/server/tests/unit/nest/assistant/assistant-home.test.ts +++ b/server/tests/unit/nest/assistant/assistant-home.test.ts @@ -17,8 +17,13 @@ import { renderHomeCard, tripsOf, } from '../../../../src/nest/assistant/assistant-home'; +import { + OPEN_JOURNEY_CHAT_SPEC, + OPEN_JOURNEY_CHAT_TOOL, + openJourneyChat, +} from '../../../../src/nest/assistant/assistant-home-journeys'; import { HOME_USE_TOOLS_SPEC, keptAtHome, USE_TOOLS_SPEC } from '../../../../src/nest/assistant/assistant-tool-offer'; -import { tripChatAnswer } from '../../../../src/nest/assistant/cards/home'; +import { journalChatAnswer, tripChatAnswer } from '../../../../src/nest/assistant/cards/home'; import { answerCardOf } from '../../../../src/nest/assistant/cards/registry'; import { describe, expect, it, vi } from 'vitest'; @@ -130,6 +135,10 @@ describe('a home turn', () => { expect(prompt).toContain('use_addon_tools'); expect(OPEN_TRIP_CHAT_SPEC.name).toBe(OPEN_TRIP_CHAT_TOOL); expect(OPEN_TRIP_CHAT_SPEC.parameters.required).toEqual(['tripId']); + expect(prompt).toContain('open_journey_chat'); + expect(prompt).toContain('create_journey'); + expect(OPEN_JOURNEY_CHAT_SPEC.name).toBe(OPEN_JOURNEY_CHAT_TOOL); + expect(OPEN_JOURNEY_CHAT_SPEC.parameters.required).toEqual(['journeyId']); }); it('ASTHOME-012: the step that loads groups says what needs nothing loaded in each chat', () => { @@ -183,6 +192,62 @@ describe("the way into a trip's chat", () => { }); }); +describe("the way onto a journal's page", () => { + const journal = { + id: 12, + title: ' Japan 2026 ', + subtitle: '', + trip_date_min: '2026-11-02', + trip_date_max: '2026-11-16 00:00:00', + entry_count: 4, + photo_count: 120, + }; + const listed = { ok: true, value: { journeys: [journal, { id: 13, title: 'Other' }] } }; + + it("ASTHOME-040: answers with one of the user's journals and the question, cleaned up", () => { + expect(openJourneyChat({ journeyId: 12, question: ' A new entry ' }, listed)).toEqual({ + ok: true, + value: { + journey: { + id: 12, + title: 'Japan 2026', + subtitle: null, + startDate: '2026-11-02', + endDate: '2026-11-16', + entryCount: 4, + photoCount: 120, + }, + question: 'A new entry', + shown: "Shown to the user as a card that opens the journal's page with its chat.", + }, + }); + expect(openJourneyChat({ journeyId: 13 }, listed)).toMatchObject({ + value: { journey: { id: 13, entryCount: 0, startDate: null }, question: null }, + }); + }); + + it('ASTHOME-041: refuses a journal the user cannot open, a failed read and a row without a title', () => { + expect(openJourneyChat({ journeyId: 77 }, listed)).toMatchObject({ ok: false }); + expect(openJourneyChat({ journeyId: 12 }, { ok: false, value: 'no' })).toMatchObject({ ok: false }); + expect(openJourneyChat({}, listed)).toMatchObject({ ok: false }); + const untitled = { ok: true, value: { journeys: [{ id: 5, title: ' ' }] } }; + expect(openJourneyChat({ journeyId: 5 }, untitled)).toMatchObject({ ok: false }); + }); + + it('ASTHOME-042: shows a card for the journal, and none for an answer without one', () => { + const run = openJourneyChat({ journeyId: 12, question: 'A new entry' }, listed); + const input = { toolCallId: 'c1', args: {}, value: run.value, card: emptyTripCard(1), today: TODAY }; + expect(journalChatAnswer(input)).toMatchObject({ + kind: 'journalChat', + journey: { id: 12, title: 'Japan 2026' }, + question: 'A new entry', + }); + expect(answerCardOf(OPEN_JOURNEY_CHAT_TOOL, input)).toMatchObject({ kind: 'journalChat' }); + expect(journalChatAnswer({ ...input, value: 'No journal' })).toBeNull(); + expect(journalChatAnswer({ ...input, value: { journey: { id: 0 } } })).toBeNull(); + }); +}); + describe('the tools the home chat keeps', () => { it('ASTHOME-030: every read, and only the writes that name no trip and no journey', () => { expect(keptAtHome('read', ['tripId'], 'TripsMcp')).toBe(true); @@ -203,4 +268,11 @@ describe('the tools the home chat keeps', () => { expect(keptAtHome('write', ['suggestionId', 'journalId'], 'DawarichMcp')).toBe(false); expect(keptAtHome('write', ['suggestionId', 'bucketListItemId'], 'DawarichMcp')).toBe(true); }); + + it('ASTHOME-032: starts a journal and deletes one, which no journey chat offers, and no other journey write', () => { + expect(keptAtHome('write', ['title', 'trip_ids'], 'JourneyMcp', 'create_journey')).toBe(true); + expect(keptAtHome('write', ['journeyId'], 'JourneyMcp', 'delete_journey')).toBe(true); + expect(keptAtHome('write', ['journeyId'], 'JourneyMcp', 'update_journey')).toBe(false); + expect(keptAtHome('write', ['journeyId', 'tripId'], 'JourneyMcp', 'add_journey_trip')).toBe(false); + }); }); diff --git a/shared/src/assistant/cards/home.contract.ts b/shared/src/assistant/cards/home.contract.ts index 4e24ec664..41225da2e 100644 --- a/shared/src/assistant/cards/home.contract.ts +++ b/shared/src/assistant/cards/home.contract.ts @@ -1,12 +1,14 @@ +import { journalChatCardSchema } from './journal-chat.card'; import { tripChatCardSchema } from './trip-chat.card'; +export * from './journal-chat.card'; export * from './trip-chat.card'; /** * What the chat outside any one trip (the `home` scope) brings to the - * assistant chat: the card that offers to go on in a trip's own chat. It has - * no change cards of its own; the writes it proposes are the atlas', the - * vacation planner's and the collections'. cards/index.ts spreads the kinds - * into the card union. + * assistant chat: the cards that offer to go on in a trip's own chat or on a + * journal's page. It has no change cards of its own; the writes it proposes + * are the atlas', the vacation planner's, the collections' and a new + * journal's. cards/index.ts spreads the kinds into the card union. */ -export const HOME_CARD_SCHEMAS = [tripChatCardSchema] as const; +export const HOME_CARD_SCHEMAS = [tripChatCardSchema, journalChatCardSchema] as const; diff --git a/shared/src/assistant/cards/journal-chat.card.spec.ts b/shared/src/assistant/cards/journal-chat.card.spec.ts new file mode 100644 index 000000000..3e592772d --- /dev/null +++ b/shared/src/assistant/cards/journal-chat.card.spec.ts @@ -0,0 +1,46 @@ +import { storedTrekCardSchema, trekCardSchema } from './index'; +import { journalChatCardSchema } from './journal-chat.card'; + +import { describe, expect, it } from 'vitest'; + +const card = { + kind: 'journalChat', + journey: { + id: 12, + title: 'Japan 2026', + subtitle: 'Two weeks in autumn', + startDate: '2026-11-02', + endDate: '2026-11-16', + entryCount: 4, + photoCount: 120, + }, + question: 'Make a new entry for Berlin Hauptbahnhof', +} as const; + +describe('journalChatCardSchema', () => { + it('JOURNALCHAT-001: is part of the card union and reads as itself', () => { + expect(trekCardSchema.parse(card)).toEqual(card); + expect(storedTrekCardSchema.parse(card)).toEqual(card); + }); + + it('JOURNALCHAT-002: takes a journal without dates, a subtitle or a question', () => { + const bare = { + kind: 'journalChat', + journey: { id: 3, title: 'Notes', subtitle: null, startDate: null, endDate: null, entryCount: 0, photoCount: 0 }, + question: null, + }; + expect(journalChatCardSchema.parse(bare)).toEqual(bare); + }); + + it('JOURNALCHAT-003: refuses a bad id, a bad date, an empty title, a negative count or an overlong question', () => { + expect(journalChatCardSchema.safeParse({ ...card, journey: { ...card.journey, id: 0 } }).success).toBe(false); + expect( + journalChatCardSchema.safeParse({ ...card, journey: { ...card.journey, startDate: '2.11.2026' } }).success, + ).toBe(false); + expect(journalChatCardSchema.safeParse({ ...card, journey: { ...card.journey, title: '' } }).success).toBe(false); + expect(journalChatCardSchema.safeParse({ ...card, journey: { ...card.journey, entryCount: -1 } }).success).toBe( + false, + ); + expect(journalChatCardSchema.safeParse({ ...card, question: 'x'.repeat(501) }).success).toBe(false); + }); +}); diff --git a/shared/src/assistant/cards/journal-chat.card.ts b/shared/src/assistant/cards/journal-chat.card.ts new file mode 100644 index 000000000..12d833b13 --- /dev/null +++ b/shared/src/assistant/cards/journal-chat.card.ts @@ -0,0 +1,28 @@ +import { idSchema } from '../../common/primitives.schema'; +import { cardCountSchema, cardDateSchema, cardText } from './card-parts'; + +import { z } from 'zod'; + +/** + * A journal the chat outside any one trip offers to go on with on the + * journal's own page: the conversation there knows the journal's entries and + * photos and can change them, which the chat on the dashboard does not. The + * question is what the user asked about the journal, handed over so it waits + * there ready to send. + */ +export const journalChatCardSchema = z.object({ + kind: z.literal('journalChat'), + journey: z.object({ + id: idSchema, + title: cardText(200), + subtitle: cardText(300).nullable(), + /** The days of the trips it holds, when it holds any. */ + startDate: cardDateSchema.nullable(), + endDate: cardDateSchema.nullable(), + entryCount: cardCountSchema, + photoCount: cardCountSchema, + }), + /** The question to ask on the journal's page, in the user's words; null when there is none to hand over. */ + question: cardText(500).nullable(), +}); +export type JournalChatCard = z.infer; diff --git a/shared/src/i18n/ar/assistantHome.ts b/shared/src/i18n/ar/assistantHome.ts index 2a23e6739..3ab62dfdb 100644 --- a/shared/src/i18n/ar/assistantHome.ts +++ b/shared/src/i18n/ar/assistantHome.ts @@ -22,6 +22,10 @@ const assistantHome: TranslationStrings = { 'assistant.card.tripChat.phase.past': 'انتهت', 'assistant.step.readingTrips': 'أطّلع على رحلاتك', 'assistant.step.openTripChat': 'أبحث عن الرحلة', + 'assistant.card.journalChat.label': 'المتابعة في يوميات', + 'assistant.card.journalChat.eyebrow': 'اليوميات', + 'assistant.card.journalChat.open': 'المتابعة في دردشة هذه اليوميات', + 'assistant.step.openJournalChat': 'أبحث عن اليوميات', }; export default assistantHome; diff --git a/shared/src/i18n/az/assistantHome.ts b/shared/src/i18n/az/assistantHome.ts index 05ac5961b..81d116238 100644 --- a/shared/src/i18n/az/assistantHome.ts +++ b/shared/src/i18n/az/assistantHome.ts @@ -22,6 +22,10 @@ const assistantHome: TranslationStrings = { 'assistant.card.tripChat.phase.past': 'Keçib', 'assistant.step.readingTrips': 'Səyahətlərinizə baxıram', 'assistant.step.openTripChat': 'Səyahəti tapıram', + 'assistant.card.journalChat.label': 'Gündəlikdə davam et', + 'assistant.card.journalChat.eyebrow': 'Gündəlik', + 'assistant.card.journalChat.open': 'Bu gündəliyin söhbətində davam et', + 'assistant.step.openJournalChat': 'Gündəliyi tapıram', }; export default assistantHome; diff --git a/shared/src/i18n/br/assistantHome.ts b/shared/src/i18n/br/assistantHome.ts index 863bd167d..53e4e6cd0 100644 --- a/shared/src/i18n/br/assistantHome.ts +++ b/shared/src/i18n/br/assistantHome.ts @@ -22,6 +22,10 @@ const assistantHome: TranslationStrings = { 'assistant.card.tripChat.phase.past': 'Passada', 'assistant.step.readingTrips': 'Olhando suas viagens', 'assistant.step.openTripChat': 'Procurando a viagem', + 'assistant.card.journalChat.label': 'Continuar em um diário', + 'assistant.card.journalChat.eyebrow': 'Diário', + 'assistant.card.journalChat.open': 'Continuar no chat deste diário', + 'assistant.step.openJournalChat': 'Procurando o diário', }; export default assistantHome; diff --git a/shared/src/i18n/ca/assistantHome.ts b/shared/src/i18n/ca/assistantHome.ts index 97e469606..ef5525af8 100644 --- a/shared/src/i18n/ca/assistantHome.ts +++ b/shared/src/i18n/ca/assistantHome.ts @@ -22,6 +22,10 @@ const assistantHome: TranslationStrings = { 'assistant.card.tripChat.phase.past': 'Passat', 'assistant.step.readingTrips': 'Mirant els teus viatges', 'assistant.step.openTripChat': 'Buscant el viatge', + 'assistant.card.journalChat.label': 'Continuar en un diari', + 'assistant.card.journalChat.eyebrow': 'Diari', + 'assistant.card.journalChat.open': "Continuar al xat d'aquest diari", + 'assistant.step.openJournalChat': 'Buscant el diari', }; export default assistantHome; diff --git a/shared/src/i18n/cs/assistantHome.ts b/shared/src/i18n/cs/assistantHome.ts index 48a3a73a8..fbf942f21 100644 --- a/shared/src/i18n/cs/assistantHome.ts +++ b/shared/src/i18n/cs/assistantHome.ts @@ -22,6 +22,10 @@ const assistantHome: TranslationStrings = { 'assistant.card.tripChat.phase.past': 'Za tebou', 'assistant.step.readingTrips': 'Prohlížím tvoje cesty', 'assistant.step.openTripChat': 'Hledám cestu', + 'assistant.card.journalChat.label': 'Pokračovat v deníku', + 'assistant.card.journalChat.eyebrow': 'Deník', + 'assistant.card.journalChat.open': 'Pokračovat v chatu tohoto deníku', + 'assistant.step.openJournalChat': 'Hledám deník', }; export default assistantHome; diff --git a/shared/src/i18n/de/assistantHome.ts b/shared/src/i18n/de/assistantHome.ts index fb22b966e..72b43243e 100644 --- a/shared/src/i18n/de/assistantHome.ts +++ b/shared/src/i18n/de/assistantHome.ts @@ -22,6 +22,10 @@ const assistantHome: TranslationStrings = { 'assistant.card.tripChat.phase.past': 'Vorbei', 'assistant.step.readingTrips': 'Schaue mir deine Reisen an', 'assistant.step.openTripChat': 'Suche die Reise', + 'assistant.card.journalChat.label': 'Im Journal weiter', + 'assistant.card.journalChat.eyebrow': 'Reisejournal', + 'assistant.card.journalChat.open': 'Im Chat dieses Journals weiter', + 'assistant.step.openJournalChat': 'Suche das Journal', }; export default assistantHome; diff --git a/shared/src/i18n/en/assistantHome.ts b/shared/src/i18n/en/assistantHome.ts index 84d163159..981c07f34 100644 --- a/shared/src/i18n/en/assistantHome.ts +++ b/shared/src/i18n/en/assistantHome.ts @@ -22,6 +22,10 @@ const assistantHome: TranslationStrings = { 'assistant.card.tripChat.phase.past': 'Behind you', 'assistant.step.readingTrips': 'Looking at your trips', 'assistant.step.openTripChat': 'Finding the trip', + 'assistant.card.journalChat.label': 'Continue in a journal', + 'assistant.card.journalChat.eyebrow': 'Journal', + 'assistant.card.journalChat.open': "Continue in this journal's chat", + 'assistant.step.openJournalChat': 'Finding the journal', }; export default assistantHome; diff --git a/shared/src/i18n/es/assistantHome.ts b/shared/src/i18n/es/assistantHome.ts index 370402a24..9666d986f 100644 --- a/shared/src/i18n/es/assistantHome.ts +++ b/shared/src/i18n/es/assistantHome.ts @@ -22,6 +22,10 @@ const assistantHome: TranslationStrings = { 'assistant.card.tripChat.phase.past': 'Pasado', 'assistant.step.readingTrips': 'Mirando tus viajes', 'assistant.step.openTripChat': 'Buscando el viaje', + 'assistant.card.journalChat.label': 'Seguir en un diario', + 'assistant.card.journalChat.eyebrow': 'Diario', + 'assistant.card.journalChat.open': 'Seguir en el chat de este diario', + 'assistant.step.openJournalChat': 'Buscando el diario', }; export default assistantHome; diff --git a/shared/src/i18n/et/assistantHome.ts b/shared/src/i18n/et/assistantHome.ts index d770494d5..b8a95a72e 100644 --- a/shared/src/i18n/et/assistantHome.ts +++ b/shared/src/i18n/et/assistantHome.ts @@ -22,6 +22,10 @@ const assistantHome: TranslationStrings = { 'assistant.card.tripChat.phase.past': 'Möödas', 'assistant.step.readingTrips': 'Vaatan su reise', 'assistant.step.openTripChat': 'Otsin reisi üles', + 'assistant.card.journalChat.label': 'Jätka päevikus', + 'assistant.card.journalChat.eyebrow': 'Päevik', + 'assistant.card.journalChat.open': 'Jätka selle päeviku vestluses', + 'assistant.step.openJournalChat': 'Otsin päeviku üles', }; export default assistantHome; diff --git a/shared/src/i18n/fr/assistantHome.ts b/shared/src/i18n/fr/assistantHome.ts index 7733e8833..c2d8133b6 100644 --- a/shared/src/i18n/fr/assistantHome.ts +++ b/shared/src/i18n/fr/assistantHome.ts @@ -22,6 +22,10 @@ const assistantHome: TranslationStrings = { 'assistant.card.tripChat.phase.past': 'Passé', 'assistant.step.readingTrips': 'Je regarde vos voyages', 'assistant.step.openTripChat': 'Je cherche le voyage', + 'assistant.card.journalChat.label': 'Continuer dans un journal', + 'assistant.card.journalChat.eyebrow': 'Journal de voyage', + 'assistant.card.journalChat.open': 'Continuer dans le chat de ce journal', + 'assistant.step.openJournalChat': 'Je cherche le journal', }; export default assistantHome; diff --git a/shared/src/i18n/gr/assistantHome.ts b/shared/src/i18n/gr/assistantHome.ts index d0fe1ec6e..76a367942 100644 --- a/shared/src/i18n/gr/assistantHome.ts +++ b/shared/src/i18n/gr/assistantHome.ts @@ -22,6 +22,10 @@ const assistantHome: TranslationStrings = { 'assistant.card.tripChat.phase.past': 'Πίσω σου', 'assistant.step.readingTrips': 'Κοιτάζω τα ταξίδια σου', 'assistant.step.openTripChat': 'Βρίσκω το ταξίδι', + 'assistant.card.journalChat.label': 'Συνέχεια σε ένα ημερολόγιο', + 'assistant.card.journalChat.eyebrow': 'Ημερολόγιο', + 'assistant.card.journalChat.open': 'Συνέχεια στη συνομιλία αυτού του ημερολογίου', + 'assistant.step.openJournalChat': 'Βρίσκω το ημερολόγιο', }; export default assistantHome; diff --git a/shared/src/i18n/hu/assistantHome.ts b/shared/src/i18n/hu/assistantHome.ts index 31fd817d6..78060e9ef 100644 --- a/shared/src/i18n/hu/assistantHome.ts +++ b/shared/src/i18n/hu/assistantHome.ts @@ -22,6 +22,10 @@ const assistantHome: TranslationStrings = { 'assistant.card.tripChat.phase.past': 'Elmúlt', 'assistant.step.readingTrips': 'Megnézem az utazásaidat', 'assistant.step.openTripChat': 'Megkeresem az utazást', + 'assistant.card.journalChat.label': 'Folytatás egy naplóban', + 'assistant.card.journalChat.eyebrow': 'Napló', + 'assistant.card.journalChat.open': 'Folytatás ennek a naplónak a csevegésében', + 'assistant.step.openJournalChat': 'Megkeresem a naplót', }; export default assistantHome; diff --git a/shared/src/i18n/id/assistantHome.ts b/shared/src/i18n/id/assistantHome.ts index a982047ec..a9591657f 100644 --- a/shared/src/i18n/id/assistantHome.ts +++ b/shared/src/i18n/id/assistantHome.ts @@ -22,6 +22,10 @@ const assistantHome: TranslationStrings = { 'assistant.card.tripChat.phase.past': 'Sudah lewat', 'assistant.step.readingTrips': 'Melihat perjalananmu', 'assistant.step.openTripChat': 'Mencari perjalanannya', + 'assistant.card.journalChat.label': 'Lanjutkan di jurnal', + 'assistant.card.journalChat.eyebrow': 'Jurnal', + 'assistant.card.journalChat.open': 'Lanjutkan di obrolan jurnal ini', + 'assistant.step.openJournalChat': 'Mencari jurnalnya', }; export default assistantHome; diff --git a/shared/src/i18n/it/assistantHome.ts b/shared/src/i18n/it/assistantHome.ts index aa2ae434c..b26598951 100644 --- a/shared/src/i18n/it/assistantHome.ts +++ b/shared/src/i18n/it/assistantHome.ts @@ -22,6 +22,10 @@ const assistantHome: TranslationStrings = { 'assistant.card.tripChat.phase.past': 'Passato', 'assistant.step.readingTrips': 'Guardo i tuoi viaggi', 'assistant.step.openTripChat': 'Cerco il viaggio', + 'assistant.card.journalChat.label': 'Continua in un diario', + 'assistant.card.journalChat.eyebrow': 'Diario', + 'assistant.card.journalChat.open': 'Continua nella chat di questo diario', + 'assistant.step.openJournalChat': 'Cerco il diario', }; export default assistantHome; diff --git a/shared/src/i18n/ja/assistantHome.ts b/shared/src/i18n/ja/assistantHome.ts index 51c987706..b17ceeaaf 100644 --- a/shared/src/i18n/ja/assistantHome.ts +++ b/shared/src/i18n/ja/assistantHome.ts @@ -22,6 +22,10 @@ const assistantHome: TranslationStrings = { 'assistant.card.tripChat.phase.past': '終了', 'assistant.step.readingTrips': '旅を確認しています', 'assistant.step.openTripChat': '旅を探しています', + 'assistant.card.journalChat.label': 'ジャーナルで続ける', + 'assistant.card.journalChat.eyebrow': 'ジャーナル', + 'assistant.card.journalChat.open': 'このジャーナルのチャットで続ける', + 'assistant.step.openJournalChat': 'ジャーナルを探しています', }; export default assistantHome; diff --git a/shared/src/i18n/ko/assistantHome.ts b/shared/src/i18n/ko/assistantHome.ts index 60c9fb9cb..05bd4b4ba 100644 --- a/shared/src/i18n/ko/assistantHome.ts +++ b/shared/src/i18n/ko/assistantHome.ts @@ -22,6 +22,10 @@ const assistantHome: TranslationStrings = { 'assistant.card.tripChat.phase.past': '지난 여행', 'assistant.step.readingTrips': '여행을 살펴보는 중', 'assistant.step.openTripChat': '여행을 찾는 중', + 'assistant.card.journalChat.label': '저널에서 계속하기', + 'assistant.card.journalChat.eyebrow': '저널', + 'assistant.card.journalChat.open': '이 저널의 채팅에서 계속하기', + 'assistant.step.openJournalChat': '저널을 찾는 중', }; export default assistantHome; diff --git a/shared/src/i18n/nl/assistantHome.ts b/shared/src/i18n/nl/assistantHome.ts index 713823122..c5cc889a1 100644 --- a/shared/src/i18n/nl/assistantHome.ts +++ b/shared/src/i18n/nl/assistantHome.ts @@ -22,6 +22,10 @@ const assistantHome: TranslationStrings = { 'assistant.card.tripChat.phase.past': 'Voorbij', 'assistant.step.readingTrips': 'Ik bekijk je reizen', 'assistant.step.openTripChat': 'Ik zoek de reis', + 'assistant.card.journalChat.label': 'Verder in een dagboek', + 'assistant.card.journalChat.eyebrow': 'Dagboek', + 'assistant.card.journalChat.open': 'Verder in de chat van dit dagboek', + 'assistant.step.openJournalChat': 'Ik zoek het dagboek', }; export default assistantHome; diff --git a/shared/src/i18n/pl/assistantHome.ts b/shared/src/i18n/pl/assistantHome.ts index 52a3106b6..b7e8d2a4b 100644 --- a/shared/src/i18n/pl/assistantHome.ts +++ b/shared/src/i18n/pl/assistantHome.ts @@ -22,6 +22,10 @@ const assistantHome: TranslationStrings = { 'assistant.card.tripChat.phase.past': 'Za tobą', 'assistant.step.readingTrips': 'Przeglądam twoje podróże', 'assistant.step.openTripChat': 'Szukam podróży', + 'assistant.card.journalChat.label': 'Kontynuuj w dzienniku', + 'assistant.card.journalChat.eyebrow': 'Dziennik', + 'assistant.card.journalChat.open': 'Kontynuuj na czacie tego dziennika', + 'assistant.step.openJournalChat': 'Szukam dziennika', }; export default assistantHome; diff --git a/shared/src/i18n/ru/assistantHome.ts b/shared/src/i18n/ru/assistantHome.ts index f30a19cbc..4a3814e38 100644 --- a/shared/src/i18n/ru/assistantHome.ts +++ b/shared/src/i18n/ru/assistantHome.ts @@ -22,6 +22,10 @@ const assistantHome: TranslationStrings = { 'assistant.card.tripChat.phase.past': 'Позади', 'assistant.step.readingTrips': 'Смотрю ваши поездки', 'assistant.step.openTripChat': 'Ищу поездку', + 'assistant.card.journalChat.label': 'Продолжить в дневнике', + 'assistant.card.journalChat.eyebrow': 'Дневник', + 'assistant.card.journalChat.open': 'Продолжить в чате этого дневника', + 'assistant.step.openJournalChat': 'Ищу дневник', }; export default assistantHome; diff --git a/shared/src/i18n/sk/assistantHome.ts b/shared/src/i18n/sk/assistantHome.ts index cf65d10c0..4cf87246f 100644 --- a/shared/src/i18n/sk/assistantHome.ts +++ b/shared/src/i18n/sk/assistantHome.ts @@ -22,6 +22,10 @@ const assistantHome: TranslationStrings = { 'assistant.card.tripChat.phase.past': 'Za tebou', 'assistant.step.readingTrips': 'Prezerám tvoje cesty', 'assistant.step.openTripChat': 'Hľadám cestu', + 'assistant.card.journalChat.label': 'Pokračovať v denníku', + 'assistant.card.journalChat.eyebrow': 'Denník', + 'assistant.card.journalChat.open': 'Pokračovať v chate tohto denníka', + 'assistant.step.openJournalChat': 'Hľadám denník', }; export default assistantHome; diff --git a/shared/src/i18n/sv/assistantHome.ts b/shared/src/i18n/sv/assistantHome.ts index 5f05a8f08..b1877b0c6 100644 --- a/shared/src/i18n/sv/assistantHome.ts +++ b/shared/src/i18n/sv/assistantHome.ts @@ -22,6 +22,10 @@ const assistantHome: TranslationStrings = { 'assistant.card.tripChat.phase.past': 'Bakom dig', 'assistant.step.readingTrips': 'Tittar på dina resor', 'assistant.step.openTripChat': 'Letar upp resan', + 'assistant.card.journalChat.label': 'Fortsätt i en dagbok', + 'assistant.card.journalChat.eyebrow': 'Dagbok', + 'assistant.card.journalChat.open': 'Fortsätt i den här dagbokens chatt', + 'assistant.step.openJournalChat': 'Letar upp dagboken', }; export default assistantHome; diff --git a/shared/src/i18n/th/assistantHome.ts b/shared/src/i18n/th/assistantHome.ts index e972bc8d4..b877241d4 100644 --- a/shared/src/i18n/th/assistantHome.ts +++ b/shared/src/i18n/th/assistantHome.ts @@ -22,6 +22,10 @@ const assistantHome: TranslationStrings = { 'assistant.card.tripChat.phase.past': 'ผ่านไปแล้ว', 'assistant.step.readingTrips': 'กำลังดูทริปของคุณ', 'assistant.step.openTripChat': 'กำลังหาทริป', + 'assistant.card.journalChat.label': 'ไปต่อในบันทึก', + 'assistant.card.journalChat.eyebrow': 'บันทึกการเดินทาง', + 'assistant.card.journalChat.open': 'ไปต่อในแชตของบันทึกนี้', + 'assistant.step.openJournalChat': 'กำลังหาบันทึก', }; export default assistantHome; diff --git a/shared/src/i18n/tr/assistantHome.ts b/shared/src/i18n/tr/assistantHome.ts index 69e2eb502..c456476e2 100644 --- a/shared/src/i18n/tr/assistantHome.ts +++ b/shared/src/i18n/tr/assistantHome.ts @@ -22,6 +22,10 @@ const assistantHome: TranslationStrings = { 'assistant.card.tripChat.phase.past': 'Geride', 'assistant.step.readingTrips': 'Seyahatlerine bakıyorum', 'assistant.step.openTripChat': 'Seyahati buluyorum', + 'assistant.card.journalChat.label': 'Bir günlükte devam et', + 'assistant.card.journalChat.eyebrow': 'Günlük', + 'assistant.card.journalChat.open': 'Bu günlüğün sohbetinde devam et', + 'assistant.step.openJournalChat': 'Günlüğü buluyorum', }; export default assistantHome; diff --git a/shared/src/i18n/uk/assistantHome.ts b/shared/src/i18n/uk/assistantHome.ts index 463b21b7f..16ff55192 100644 --- a/shared/src/i18n/uk/assistantHome.ts +++ b/shared/src/i18n/uk/assistantHome.ts @@ -22,6 +22,10 @@ const assistantHome: TranslationStrings = { 'assistant.card.tripChat.phase.past': 'Позаду', 'assistant.step.readingTrips': 'Переглядаю ваші подорожі', 'assistant.step.openTripChat': 'Шукаю подорож', + 'assistant.card.journalChat.label': 'Продовжити в щоденнику', + 'assistant.card.journalChat.eyebrow': 'Щоденник', + 'assistant.card.journalChat.open': 'Продовжити в чаті цього щоденника', + 'assistant.step.openJournalChat': 'Шукаю щоденник', }; export default assistantHome; diff --git a/shared/src/i18n/vi/assistantHome.ts b/shared/src/i18n/vi/assistantHome.ts index b2e258cc3..d922cb548 100644 --- a/shared/src/i18n/vi/assistantHome.ts +++ b/shared/src/i18n/vi/assistantHome.ts @@ -22,6 +22,10 @@ const assistantHome: TranslationStrings = { 'assistant.card.tripChat.phase.past': 'Đã qua', 'assistant.step.readingTrips': 'Đang xem các chuyến đi của bạn', 'assistant.step.openTripChat': 'Đang tìm chuyến đi', + 'assistant.card.journalChat.label': 'Tiếp tục trong một nhật ký', + 'assistant.card.journalChat.eyebrow': 'Nhật ký', + 'assistant.card.journalChat.open': 'Tiếp tục trong cuộc trò chuyện của nhật ký này', + 'assistant.step.openJournalChat': 'Đang tìm nhật ký', }; export default assistantHome; diff --git a/shared/src/i18n/zh-TW/assistantHome.ts b/shared/src/i18n/zh-TW/assistantHome.ts index 4b4e155b9..9c59885f4 100644 --- a/shared/src/i18n/zh-TW/assistantHome.ts +++ b/shared/src/i18n/zh-TW/assistantHome.ts @@ -22,6 +22,10 @@ const assistantHome: TranslationStrings = { 'assistant.card.tripChat.phase.past': '已結束', 'assistant.step.readingTrips': '正在查看你的旅行', 'assistant.step.openTripChat': '正在尋找這趟旅行', + 'assistant.card.journalChat.label': '在日誌中繼續', + 'assistant.card.journalChat.eyebrow': '日誌', + 'assistant.card.journalChat.open': '在這本日誌的聊天中繼續', + 'assistant.step.openJournalChat': '正在尋找日誌', }; export default assistantHome; diff --git a/shared/src/i18n/zh/assistantHome.ts b/shared/src/i18n/zh/assistantHome.ts index 9c9e51ff6..9eae564d9 100644 --- a/shared/src/i18n/zh/assistantHome.ts +++ b/shared/src/i18n/zh/assistantHome.ts @@ -22,6 +22,10 @@ const assistantHome: TranslationStrings = { 'assistant.card.tripChat.phase.past': '已结束', 'assistant.step.readingTrips': '正在查看你的旅行', 'assistant.step.openTripChat': '正在查找这次旅行', + 'assistant.card.journalChat.label': '在日志中继续', + 'assistant.card.journalChat.eyebrow': '日志', + 'assistant.card.journalChat.open': '在这本日志的聊天中继续', + 'assistant.step.openJournalChat': '正在查找日志', }; export default assistantHome;