From 6d7889c116504336594ea86c2f7c3d0206cbbb1f Mon Sep 17 00:00:00 2001 From: mbajaj92 Date: Tue, 6 Oct 2026 02:32:14 +0000 Subject: [PATCH 1/2] feat(website): add the project directory field to the cron job form Frontend half of the cron project-binding work, split from the backend so each review diff stays under the 1 MB lane cap: the Project directory field and merged agent picker in JobForm, the collision marker, the reset notices, locales, and their tests. Backend half: the parent PR in this stack. --- .../modules/learn-cron-dashboard.md | 5 +- website/scripts/gen-pseudolocale.mjs | 1 + website/scripts/lib/render-scan.mjs | 1 + website/src/api/client/agents.ts | 14 +- website/src/components/AgentSelector.tsx | 93 +- website/src/components/JobForm.tsx | 523 +++++++++- website/src/hooks/useAgents.ts | 10 +- website/src/i18n/locales/bn.json | 19 +- website/src/i18n/locales/de.json | 19 +- website/src/i18n/locales/en-XA.json | 19 +- website/src/i18n/locales/en.json | 14 + website/src/i18n/locales/en.manual.json | 5 +- website/src/i18n/locales/es.json | 19 +- website/src/i18n/locales/fr.json | 19 +- website/src/i18n/locales/hi.json | 31 +- website/src/i18n/locales/it.json | 19 +- website/src/i18n/locales/ja.json | 19 +- website/src/i18n/locales/ko.json | 21 +- website/src/i18n/locales/pt.json | 19 +- website/src/i18n/locales/ru.json | 19 +- website/src/i18n/locales/zh-CN.json | 19 +- website/src/i18n/renderScan.test.ts | 3 +- website/src/pages/SchedulePage.tsx | 34 +- .../AgentSelector.overrideDetail.test.tsx | 48 + ...obForm.projectAgentOriginAndReset.test.tsx | 114 +++ .../test/JobForm.projectAgentReset.test.tsx | 912 ++++++++++++++++++ .../src/test/JobForm.saveAndBinding.test.tsx | 198 ++++ .../src/test/JobForm.scriptCommand.test.tsx | 10 + .../SchedulePage.lastErrorVisibility.test.tsx | 116 +++ website/src/types/index.ts | 1 + 30 files changed, 2284 insertions(+), 60 deletions(-) create mode 100644 website/src/test/AgentSelector.overrideDetail.test.tsx create mode 100644 website/src/test/JobForm.projectAgentOriginAndReset.test.tsx create mode 100644 website/src/test/JobForm.projectAgentReset.test.tsx create mode 100644 website/src/test/JobForm.saveAndBinding.test.tsx create mode 100644 website/src/test/SchedulePage.lastErrorVisibility.test.tsx diff --git a/docs/system-specs/modules/learn-cron-dashboard.md b/docs/system-specs/modules/learn-cron-dashboard.md index 6d754c5db844..7ee5eb1e62a8 100644 --- a/docs/system-specs/modules/learn-cron-dashboard.md +++ b/docs/system-specs/modules/learn-cron-dashboard.md @@ -950,8 +950,9 @@ dependency. The second run sees the agent the first already cleared, computes own notice after ~250ms. The branch is therefore guarded to act on the TRANSITION into the empty state (`unbindHandledRef`), re-armed by any bound path so a later clear still announces itself. A test that reads the notice synchronously cannot -see this: it passes against the erasing version, which is why the form's -regressions read it AFTER the debounce. +see this: it passes against the erasing version, which is why the regressions in +`website/src/test/JobForm.projectAgentReset.test.tsx` read it AFTER the +debounce. **A reset a path EDIT caused is undone when the finished path defines the name again.** The debounce above only protects a path typed faster than 250ms; diff --git a/website/scripts/gen-pseudolocale.mjs b/website/scripts/gen-pseudolocale.mjs index 88bddf14a85d..f740003ab252 100644 --- a/website/scripts/gen-pseudolocale.mjs +++ b/website/scripts/gen-pseudolocale.mjs @@ -90,6 +90,7 @@ const PRESERVE = [ /<[^>]+>/g, // markup, and the URL-shaped `<…>` values in this catalog /\$t\([^)]*\)/g, // i18next nesting /https?:\/\/\S+/g, // urls + /\/Users\/you\/projects\/myrepo/g, // canonical project-directory example path ] /** The masking sentinel, as a non-global regex so `.test()` carries no `lastIndex`. */ diff --git a/website/scripts/lib/render-scan.mjs b/website/scripts/lib/render-scan.mjs index 288f47580ddc..808d6dec8ef2 100644 --- a/website/scripts/lib/render-scan.mjs +++ b/website/scripts/lib/render-scan.mjs @@ -154,6 +154,7 @@ export const ALWAYS_LATIN = [ */ export const PRESERVED_REGIONS = [ /https?:\/\/\S+/g, // urls — may CONTAIN a <…> or {{…}} region, so strip first + /\/Users\/you\/projects\/myrepo/g, // canonical project-directory example path /\{\{[^}]*\}\}/g, // i18next interpolation /\$t\([^)]*\)/g, // i18next nesting /<[^>]+>/g, // markup, and the URL-shaped <…> values in this catalog diff --git a/website/src/api/client/agents.ts b/website/src/api/client/agents.ts index b6eaf41a029f..94a257867344 100644 --- a/website/src/api/client/agents.ts +++ b/website/src/api/client/agents.ts @@ -264,10 +264,18 @@ export function createAgentsEndpoints({ post, put, del, j, jfetch: fetch, sessio // slots sit on different projects, so project-scoped agents silently // vanish from the picker. Surfaces with no slot context (Channels, // Schedule) pass nothing and keep the global-only view. - kirocrewAgents: (sessionKey?: string) => - fetch('/api/agents', { + // + // `projectPath` is the raw-path fallback (Decision 1, cron project agents): + // a surface with no live slot (e.g. the Schedule page's job form) can still + // ask for a project's agents by passing the path directly. The server only + // honors it when sessionKey resolved to no project — a real slot's own + // project always wins, so this cannot override a live session's scope. + kirocrewAgents: (sessionKey?: string, projectPath?: string) => { + const qs = projectPath ? '?project_path=' + encodeURIComponent(projectPath) : '' + return fetch('/api/agents' + qs, { headers: sessionKey ? { 'X-Session-Key': sessionKey } : { ..._sk }, - }).then(j), + }).then(j) + }, /** The model a new session on this Kiro Crew agent would run on. Empty * `agent` resolves the configured default agent; `app` adds the owning * app's own model setting. */ diff --git a/website/src/components/AgentSelector.tsx b/website/src/components/AgentSelector.tsx index ecffb32f00fd..aeeae12993b6 100644 --- a/website/src/components/AgentSelector.tsx +++ b/website/src/components/AgentSelector.tsx @@ -32,6 +32,14 @@ export interface KiroCrewAgent { * older payloads predate the field, and it falls back to `description`. */ triggers?: string source: string + /** Which roster half this row came from: `'global'` for a configured agent, + * `'project'` for one declared by `/.kiro/agents`. Optional because + * a caller that never passes `project_path` has no project half to + * distinguish, only catalog rows carry it, and older payloads predate the + * field. Distinct from `source`, which names the row's PROVENANCE (kirocrew, + * package, app) and reads `'kirocrew'` on a project row — the two are not + * interchangeable. */ + scope?: string /** Default session color (#rrggbb hex) applied to new sessions using this * agent. Empty or absent means no agent color. */ session_color?: string @@ -43,8 +51,6 @@ export interface KiroCrewAgent { * members only. A member and a template can share a `name`, so a consumer * that offers both must key on (selection_kind, name), never on the name. */ selection_kind?: 'member' | 'template' - /** `global` or `project`; only catalog rows carry it. */ - scope?: string } /** The label a roster surface shows for a crew: its display name when one is @@ -105,6 +111,24 @@ interface Props { * keep the flat rendering they had, whatever their rows carry. */ groupByKind?: boolean + /** + * Names in `agents` where a PROJECT agent displaced a same-named configured + * one, so the row can say so. Present only on a surface that merges a + * project's roster into the global one (Schedule's job form); absent + * everywhere else, where no collision is representable. + * + * The list holds ONE row per name — the project one, because that is what + * dispatch resolves inside a bound folder. Without this marker the user sees + * a `project` badge and a global agent that has silently disappeared from + * the list, with nothing connecting the two. "This is a project agent" and + * "this project agent took over a configured agent's name" are different + * facts, and only the second explains the absence. + * + * A Set rather than a flag on the agent objects: those mirror a server + * payload, and a synthetic field on them would be indistinguishable from one + * the API actually sends. + */ + shadowedGlobals?: Set } /** @@ -123,7 +147,7 @@ interface Props { * Popover has no option semantics of its own, so the listbox ARIA and roving * focus come from `useListboxKeyboard`, unchanged. */ -export default function AgentSelector({ agents, defaultAgent, value, onChange, modal = false, rosterFailure, groupByKind = false }: Props) { +export default function AgentSelector({ agents, defaultAgent, value, onChange, modal = false, rosterFailure, groupByKind = false, shadowedGlobals }: Props) { const provider = useProvider() const [open, setOpen] = useState(false) const [filter, setFilter] = useState('') @@ -282,8 +306,69 @@ export default function AgentSelector({ agents, defaultAgent, value, onChange, m {a.source} )} + {/* `scope`, not `source` (UX Review): the server tags a + project row `scope: 'project'` but `source` reads + 'kirocrew' on it exactly as it does on a configured one, + so a project-supplied agent was visually identical to a + global one and a user could not tell which picks would + vanish when the directory was cleared. The `overrides + global` chip only ever covered COLLIDING rows, which is a + strict subset. Suppressed on a shadowed row: `overrides + global` already entails a project agent (only a project + definition can displace a same-named global one), so both + chips together are redundant and, three-abreast in the + 400px popover, they starve the name to "releas…" on the + exact collision rows this picker exists to disambiguate. + Dropping the weaker, implied chip returns that width to + the name (UX Review span=fc70ac00dcd8). */} + {a.scope === 'project' && !shadowedGlobals?.has(a.name) && ( + + {i18nT('components.agentSelector.project_agent')} + + )} + {shadowedGlobals?.has(a.name) && ( + + {i18nT('components.agentSelector.overrides_global')} + + )} - {a.description || provider.resolveAgentTemplate(a)} + {/* A shadowed row spends this line on the override instead of + the usual description. It is not a nicety: the badge above + is a 10px chip whose only explanation was a `title`, and a + native tooltip needs a mouse resting precisely on that chip + — no hover exists on touch, and the whole point of the + marker is that a user who cannot find their configured + agent learns why. The line is free here, because a project + row has no description of its own and would otherwise + repeat the template name the row already resolves to. + + It does NOT lead with the agent name (UX Review + span=7ddb24260c79): the row title directly above already + shows it, so repeating it here only pushed the meaning + ("…instead of your global agent") past this line's own + `truncate`, leaving "…of this n…" on a narrow popover. The + name lives in the title — which, since the redundant + project chip is now suppressed on a shadowed row, has the + width to show it. */} + {/* A shadowed row renders the FULL hint as body text and is + allowed to wrap, where every other row truncates. Two + reasons it earns the extra line: the explanation is the + only thing telling a user why their configured agent is + not the one running, and this string is translated in + every catalog, so wrapping it here gives non-English users + the same reassurance rather than an English-only clause + bolted onto the shorter detail string. */} + + {shadowedGlobals?.has(a.name) + ? i18nT('components.agentSelector.overrides_global_hint') + : a.description || provider.resolveAgentTemplate(a)} + {isCurrent && } diff --git a/website/src/components/JobForm.tsx b/website/src/components/JobForm.tsx index dcb5a396f480..9eb1b3206ee4 100644 --- a/website/src/components/JobForm.tsx +++ b/website/src/components/JobForm.tsx @@ -1,11 +1,12 @@ import { useEffect, useMemo, useRef, useState } from 'react' import { useQuery } from '@tanstack/react-query' -import { Zap } from 'lucide-react' +import { Zap, FolderOpen } from 'lucide-react' import { api } from '../api/client' import { ApiError } from '../api/apiError' import { Btn, Input, SendBtn } from './ui' import { SettingsToggle } from './settings' import AgentSelector, { type KiroCrewAgent } from './AgentSelector' +import ProjectPicker from './ProjectPicker' import SimpleSelect from './SimpleSelect' import type { ChatFolder, CronJob } from '../types' import { orderFoldersWithPaths } from '../utils/folderTree' @@ -13,6 +14,7 @@ import { useFolderSortMode } from '../hooks/useFolderSortMode' import type { CronPrefill } from '../utils/schedulePresets' import { SaveCreateLabel, expandDow } from '../utils/cronUtils' import { adviseCronMode } from '../utils/cronModeAdvice' +import { useDebouncedValue } from '../apps/file-explorer/hooks' import { i18nT } from '../i18n/t' import { uiLocation } from '../uiLocations/uiLocation' @@ -68,7 +70,7 @@ export function jobKindOf(job?: CronJob): JobKind { /** Parse a CronJob into initial form state */ function parseJobDefaults(job?: CronJob) { - if (!job) return { name: '', message: '', agent: '', model: '', channel: '', approvalMode: '', silent: false, strictSchedule: false, hideInChat: false, minimalContext: false, chatFolderId: '', jobKind: 'message' as JobKind, schedMode: 'interval' as const, intVal: 1, intUnit: 'hours' as const, weekDays: [] as number[], weekTime: '09:00', cronExpr: '' } + if (!job) return { name: '', message: '', agent: '', model: '', channel: '', approvalMode: '', silent: false, strictSchedule: false, hideInChat: false, minimalContext: false, chatFolderId: '', jobKind: 'message' as JobKind, schedMode: 'interval' as const, intVal: 1, intUnit: 'hours' as const, weekDays: [] as number[], weekTime: '09:00', cronExpr: '', projectPath: '' } const isInterval = !!(job.every_secs || (job.schedule || '').match(/^every\s+\d+/)) const secs = job.every_secs || (() => { const m = (job.schedule || '').match(/^every\s+(\d+)\s*([smh])/); if (!m) return 3600; return parseInt(m[1]) * (m[2] === 'h' ? 3600 : m[2] === 'm' ? 60 : 1) })() // Largest unit that divides `secs` EVENLY, not the largest unit that is merely @@ -115,7 +117,42 @@ function parseJobDefaults(job?: CronJob) { weekDays = expandDow(cronParts[4]).map(d => CRON_DOW_TO_GRID[d] || 1) weekTime = `${h.toString().padStart(2, '0')}:${m.toString().padStart(2, '0')}` } - return { name: job.name, message: job.message, agent: job.agent || '', model: job.model || '', channel: job.channel || '', approvalMode: job.approval_mode || '', silent: job.silent || false, strictSchedule: job.strict_schedule || false, hideInChat: job.hide_in_chat || false, minimalContext: job.minimal_context || false, chatFolderId: job.chat_folder_id || '', jobKind: jobKindOf(job), schedMode, intVal, intUnit, weekDays, weekTime, cronExpr: cronRaw } + return { name: job.name, message: job.message, agent: job.agent || '', model: job.model || '', channel: job.channel || '', approvalMode: job.approval_mode || '', silent: job.silent || false, strictSchedule: job.strict_schedule || false, hideInChat: job.hide_in_chat || false, minimalContext: job.minimal_context || false, chatFolderId: job.chat_folder_id || '', jobKind: jobKindOf(job), schedMode, intVal, intUnit, weekDays, weekTime, cronExpr: cronRaw, projectPath: job.project_path || '' } +} + +/** Remap the backend's raw `project_path` validation errors (which use the + * wire field name and say nothing about the field being optional) to the + * UI's own field label, so a rejected path reads as a helpful correction + * rather than "failed to save" with no clue why. The backend's error + * vocabulary is shared with the CLI/MCP tool and other callers, so this + * stays a display-only remap here rather than a change to those strings. + * Falls through to the raw message for anything else (network errors, + * other 4xx/5xx) so nothing is silently swallowed. */ +function friendlyProjectPathError(raw: string): string { + if (raw.includes('project_path must be an absolute path')) { + return i18nT('components.jobForm.project_directory_must_be_an_absolute_path') + } + if (raw.includes('project_path refers to a sensitive path')) { + return i18nT('components.jobForm.project_directory_refers_to_a_protected_path') + } + if (raw.includes('project_path must be an existing directory')) { + return i18nT('components.jobForm.project_directory_must_be_an_existing_directory') + } + return raw +} + +/** Whether a backend save rejection is one of the three `project_path` + * validation refusals `friendlyProjectPathError` remaps. Kept in lock-step + * with the substrings above so the caller can route those messages to the + * notice beside the project-directory field rather than the form-wide notice + * at the very bottom — the field sits mid-form, so a reject rendered only at + * the foot of the form made the user scroll to find what to fix (UX Review + * span=d88c9e1f411b). Any OTHER rejection (a bad agent name, a transport + * failure) is form-wide, because it is not about this one field. */ +function isProjectPathError(raw: string): boolean { + return raw.includes('project_path must be an absolute path') + || raw.includes('project_path refers to a sensitive path') + || raw.includes('project_path must be an existing directory') } /** Build the API body from form state. Returns null if validation fails (sets error). */ @@ -168,6 +205,16 @@ function buildBody( // that unchecking restores what was there, and a reader who checks the box, // saves, and unchecks it later would instead find the folder silently gone. body.chat_folder_id = isLlmless ? '' : f.chatFolderId + // "" is a valid, meaningful value here (clears the binding back to + // global-agent-only on an edit), so it is sent unconditionally rather than + // gated behind a truthiness check like the optional fields above. + // + // It is cleared for a script/command job for the same reason + // `chat_folder_id` is: the field is rendered only under `!isLlmless`, and a + // subprocess dispatch derives no cwd from it. Re-persisting the binding a + // converted job no longer shows would leave a folder the form cannot + // display, the dispatch never reads, and the owner gate still enforces. + body.project_path = isLlmless ? '' : f.projectPath if (f.schedMode === 'interval') { body.every = f.intVal * (f.intUnit === 'minutes' ? 60 : f.intUnit === 'hours' ? 3600 : 86400) } else if (f.schedMode === 'weekly') { @@ -318,6 +365,322 @@ export default function JobForm({ job, prefill, agents, defaultAgent, rosterFail const [weekTime, setWeekTime] = useState(init.weekTime) const [tz, setTz] = useState(() => job ? (job.timezone || 'UTC') : Intl.DateTimeFormat().resolvedOptions().timeZone) const [cronExpr, setCronExpr] = useState(init.cronExpr) + const [projectPath, setProjectPath] = useState(init.projectPath) + // Keep the input itself immediate, but wait for typing to settle before the + // path becomes a server-state identity. Querying every intermediate path can + // load an empty roster and reconcile a deliberate project-agent pick away. + const debouncedProjectPath = useDebouncedValue(projectPath, 250) + const [pickerOpen, setPickerOpen] = useState(false) + const browseRef = useRef(null) + // Project-scoped roster for THIS job's project_path — a raw path, no live + // chat slot behind it, so this is the project_path fallback (Decision 1). + // A local effect rather than useAgents(): that hook unconditionally syncs + + // fetches on every mount regardless of its args, which would double every + // JobForm's roster work even for the common case of no project_path set. + // This only does anything once a path is actually present. + const [projectAgents, setProjectAgents] = useState([]) + // Mirror of `projectAgents` for the clear-on-unbind effect below. That effect + // must know which names the FOLDER contributed, but it cannot depend on the + // state: its `!projectPath` branch calls `setProjectAgents([])` with a fresh + // array every run, so listing `projectAgents` as a dependency would re-fire + // it forever. A ref is never stale and needs no dependency entry. + const projectAgentsRef = useRef([]) + useEffect(() => { + projectAgentsRef.current = projectAgents + }, [projectAgents]) + // Separate from the form-wide `error` (validation failures on Save): a + // background roster fetch failing must not borrow that channel, which + // (1) auto-scrolls the page to the bottom-of-form notice on every set, + // interrupting a user who is calmly typing elsewhere in the form for a + // failure unrelated to what they are doing, and (2) shares one string with + // Save-time validation, so a stale roster error can sit through an + // otherwise-successful save (only `handleSave`'s `setError('')` clears it), + // or a validation error can be silently clobbered by a late-resolving + // roster retry. Rendered beside the working-directory field itself instead. + const [projectRosterError, setProjectRosterError] = useState('') + // The agent name a project-directory change cleared, or '' when nothing was + // cleared. Its own state rather than a flag on the roster error: a reset is not + // a failure, and folding the two would make one clear the other. The reason + // selects clear-specific wording while keeping one notice mechanism. + const [agentResetFrom, setAgentResetFrom] = useState('') + const [agentResetReason, setAgentResetReason] = useState<'project-cleared' | 'not-in-project'>('not-in-project') + // Whether the clear-on-unbind branch has already run for the CURRENT empty + // field. It must act on the TRANSITION into the empty state, not on every + // re-run: clearing the field fires the effect twice -- once when + // `projectPath` empties, then again when `debouncedProjectPath` settles and + // `enabled: !!debouncedProjectPath` turns the roster query off, which moves + // `projectAgentsData` to `undefined` and so changes a dependency. The second + // run sees the agent the first one just cleared, computes `cleared === false` + // and writes `setAgentResetFrom('')`, wiping the notice the first run set -- + // it rendered for ~200ms and then vanished, so the acknowledgment UX Review + // asked for was unreadable in practice while every test asserting it + // synchronously still passed. + const unbindHandledRef = useRef(false) + // The project agent a directory EDIT reconciled away, held until either the + // user picks something themselves or a settled roster defines that name again. + // + // The debounce above only protects a path typed faster than 250ms. Hand-editing + // a bound job's directory pauses longer than that, so an intermediate path + // becomes a roster identity of its own -- and `/api/agents?project_path=` + // answers an unusable path with HTTP 200 and the configured agents alone, so + // that roster legitimately lacks the pick and the reconcile below clears it. + // Clearing on what is known is right; leaving it cleared once the FINISHED path + // loads a roster that DOES define the name is not, and makes every path edit on + // a bound job force a re-pick (UX Review). Restoring needs no knowledge of + // whether a path was "half typed" -- a question the endpoint cannot answer + // anyway, since an unusable path and a usable one with no agents are the same + // 200 -- only that the name is resolvable again and the user has not chosen + // since. A ref rather than state: the effect that writes it must not re-run on + // it, exactly as `projectAgentsRef` above. + const editClearedAgentRef = useRef('') + // A deliberate pick supersedes the reset bookkeeping above: the notice now + // describes nothing the user can still act on, and the remembered name is no + // longer theirs to restore -- a later settled roster defining it must not + // override the choice they just made. + const pickAgent = (name: string) => { + editClearedAgentRef.current = '' + setAgent(name) + setAgentResetFrom('') + } + // The fetch itself lives in useQuery (per-frontend convention: server state + // goes through React Query, not manual useState+useEffect+fetch) — keyed on + // the DEBOUNCED mirror so a half-typed path never becomes a roster identity. + // Once typing settles, switching folders naturally supersedes an in-flight + // fetch the same way the old `cancelled` flag did: a stale response for a + // FORMER key can never land against the current one. `enabled` skips the + // request entirely while no settled path is set, matching the effect below's + // own early-return for an empty input. + const { + data: projectAgentsData, + error: projectAgentsQueryError, + refetch: refetchProjectAgents, + } = useQuery<{ agents?: KiroCrewAgent[] }, Error>({ + queryKey: ['project-agents', debouncedProjectPath], + queryFn: () => api.kirocrewAgents(undefined, debouncedProjectPath), + enabled: !!debouncedProjectPath, + }) + // Same shape as `retryChatFolders`/`rosterFailure.onReload`: refetch the ONE + // query in place, no page reload and no hand-off, because the notice sits + // beside unsaved form input. Held state rather than reading `isFetching` for + // the same reason it is below the chat-folder retry — the notice's own + // message survives from the effect, but the button needs its own pending + // flag. The prior notice offered no retry at all, so the only recovery was + // re-typing the path to re-key the query (UX Review span=6409bbff1088). + const [projectRosterRetrying, setProjectRosterRetrying] = useState(false) + const retryProjectRoster = () => { + setProjectRosterRetrying(true) + void refetchProjectAgents().finally(() => setProjectRosterRetrying(false)) + } + useEffect(() => { + if (!projectPath) { + setProjectAgents([]) + setProjectRosterError('') + // An emptied field ends the edit, so there is no later roster for a + // path-edit restore to land against: the clear below is its own + // announcement and stands. Written on every re-run for this empty field, + // which is safe -- unlike the reset below, writing '' twice is idempotent. + editClearedAgentRef.current = '' + // Idempotent past the first run for this empty field -- see + // `unbindHandledRef`. The two statements above are safe to repeat; the + // reset below is not, because it would clear its own notice. + if (unbindHandledRef.current) return + unbindHandledRef.current = true + // The selected agent may have been a project-scoped one that only + // existed because THIS folder was open (effectiveAgents merged it in + // from projectAgents, now cleared above). Left alone, that name is + // still sent on save (`agent: locked ?? agent`) with an empty + // project_path -- a project agent EXISTS only inside its folder, so + // without the folder the name resolves to nothing and the run would + // silently take the default agent's prompt, tools, and permissions. + // + // Decide on POSITIVE knowledge, not absence: clear the name when + // `projectAgents` -- the folder's own roster, still holding its + // pre-clear value on this render because React state updates are not + // synchronous -- is what contributed it. Testing "not in the global + // roster" instead was wrong twice over: an empty global roster is + // legitimate (a project-only install, and `CrewWakeSection` passes + // `agents={[]}` deliberately), and app agents under `~/.kiro/agents/` + // are dispatchable without ever appearing in it, so absence proves + // nothing. A project agent that shares a global agent's name is left + // alone -- the global one survives the folder being cleared, matching + // effectiveAgents' own dedup-by-name rule. + setAgent(a => { + const cleared = !!( + a + && projectAgentsRef.current.some(p => p.scope === 'project' && p.name === a) + && !agents.some(g => g.name === a) + ) + setAgentResetReason('project-cleared') + setAgentResetFrom(cleared ? a : '') + return cleared ? '' : a + }) + return + } + // A bound path re-arms the guard, so a LATER clear announces its reset + // again rather than staying silent after the first one. + unbindHandledRef.current = false + if (projectAgentsQueryError) { + // A roster-fetch failure must be VISIBLE, not a silent empty list: the + // user picked this folder specifically to see its agents, and an empty + // roster with no explanation reads as "this folder has none" rather + // than "the request failed" -- indistinguishable failure modes that + // need different next actions (retry vs. pick a different folder). + // api.kirocrewAgents throws ApiError/Error with an already-friendly + // message (apiFailure's friendlyErrText), so no remap is needed here -- + // friendlyProjectPathError is for the three raw project_path validation + // strings the SAVE path can surface, which this read endpoint does not. + setProjectAgents([]) + // Suffixed with the hand-off this failure causes: the agent picker + // below falls back to the global roster (effectiveAgents returns + // `agents` when projectAgents is empty), which the raw fetch error + // alone does not say -- without it, an empty-looking roster and a + // silently-substituted one are indistinguishable. A fixed lead-in + // sentence names what failed instead of gluing the raw backend text + // onto the fallback notice with no sentence boundary (UX Review): + // " Showing the global agent list instead." reads as one + // run-on fragment, not two facts. Keeps the existing (already + // translated in every locale) fallback-notice string as its own + // sentence rather than inventing a new untranslated key for it. + const rosterErr = projectAgentsQueryError.message + // A detail is only worth showing when it is PROSE. `friendlyErrText` + // unwraps `error`/`detail`/`message` when present, returns '' for an HTML + // error page, and otherwise hands back the raw body — so a body with no + // message field (a bare `{}`) arrives verbatim and interpolated as + // "Couldn't load this folder's agents: {}." and an HTML page as + // "…agents: ." Bare punctuation is worse than no clause at all (UX + // Review), so the two non-prose shapes take the detail-less sentence. + // Keyed on the same '{' test friendlyErrText uses to decide it found no + // message, rather than a second guess at what a message looks like. + const detail = rosterErr.trim() + const hasProse = detail !== '' && !detail.startsWith('{') + setProjectRosterError( + (hasProse + ? i18nT('components.jobForm.couldnt_load_this_folders_agents_detail', { detail }) + : i18nT('components.jobForm.couldnt_load_this_folders_agents')) + + ' ' + + i18nT('components.jobForm.project_roster_error_falls_back_to_global_agents'), + ) + return + } + if (projectAgentsData === undefined) { + // Still in flight for this projectPath (useQuery hasn't resolved yet). + // Clear immediately on folder change, before the fetch settles: the + // query-key supersession above only stops a SUPERSEDED fetch's result + // from overwriting a newer one, but leaves the PREVIOUS folder's + // now-stale agents selectable in the picker for the whole in-flight + // gap. A user who switches folders and picks an agent in that gap + // would get an agent from the folder they just left. + setProjectAgents([]) + setProjectRosterError('') + return + } + const newProjectAgents: KiroCrewAgent[] = projectAgentsData.agents || [] + setProjectAgents(newProjectAgents) + setProjectRosterError('') + // Switching from folder A to folder B: the agent selected under A may + // not exist under B at all. Reconcile against the union of the NEW + // project roster and the global roster (mirrors the `!projectPath` + // branch's own rule above) -- a name recognized by either is left + // alone, everything else is cleared back to default. Without this, + // save persists an agent name B's project cannot resolve, and the + // scheduled fire silently falls back to the default agent's prompt, + // tools, and permissions with no error surfaced anywhere. + setAgent(a => { + // A name either roster recognizes is resolvable under this project -- + // `newProjectAgents` is the successfully loaded WHOLE roster for it, + // including global rows, so this also preserves a valid global pick when + // the separate global-catalog request failed and the `agents` prop is + // empty. The old `agents.length > 0` guard tried to protect that transient + // failure, but also retained a project-A-only pick after project B had + // authoritatively loaded without it. + const known = (n: string) => + agents.some(g => g.name === n) || newProjectAgents.some(g => g.name === n) + const restorable = editClearedAgentRef.current + // Restore BEFORE considering a clear, so the two can never both fire on + // one run: an earlier, unfinished path took this name away, this roster + // settled with it defined again, and `!a` says the user has not chosen + // anything since -- so the pick is still theirs to have back. The ref is + // deliberately not cleared here: it holds the same name that is now + // selected, so a further edit re-reaches this branch with nothing stale, + // and leaving it untouched keeps this updater idempotent if React invokes + // it twice. + if (!a && restorable && known(restorable)) { + // Nothing was lost after all, so the acknowledgment must not linger. + setAgentResetFrom('') + return restorable + } + const cleared = !!(a && !known(a)) + if (cleared) editClearedAgentRef.current = a + setAgentResetReason('not-in-project') + // Announced, not just performed (UX Review): the reset is correct, but + // doing it silently meant the job saved under "default" with no + // acknowledgment anywhere -- the user's deliberate pick vanished between + // one keystroke in the directory field and pressing Save. Recording the + // NAME rather than a boolean so the notice can say which pick went. + if (cleared) { + setAgentResetFrom(a) + } else if (!(a === '' && restorable)) { + // Withheld while a restore is pending: the reset that notice describes is + // still in force, and a FURTHER unfinished path settling must not erase + // its acknowledgment -- erasing it is the same defect as the double-run + // the `unbindHandledRef` guard above covers, and if the operator's + // finished path never does define the name they are left with the silent + // reset the notice exists against. + setAgentResetFrom('') + } + return cleared ? '' : a + }) + }, [projectPath, agents, projectAgentsData, projectAgentsQueryError]) + // Global roster (the `agents` prop) plus this job's own project-scoped + // agents, deduped by name. Project rows arrive tagged `source: 'project'` + // by the server, and are shown as such without a per-folder relabel: this + // form only ever merges ONE folder's agents at a time, so the generic + // "project" badge already identifies where an agent came from + // unambiguously — a folder-name badge would only earn its keep if more than + // one folder's agents could appear in the same dropdown at once, which does + // not happen here. Merging here is the only way a per-job path (not known + // to the page-level roster) can ever appear in this picker at all. + // + // On a NAME COLLISION the project row is the one kept, because it is the one + // dispatch runs: inside a bound folder a project definition outranks a + // same-named configured agent (see `_resolve_agent_selection`). Keeping the + // global row instead would advertise an agent that cannot answer — the + // picker would name the configured one while the fire resolved the project + // file. The displaced names are reported separately so the surviving row can + // say so out loud rather than leaving the user to infer it from a badge: + // "this is a project agent" and "this project agent took over a global name" + // are different facts, and only the second explains why the global one has + // vanished from the list. + // + // One row per name, not two. `agent` is a bare string, so the form cannot + // record WHICH of two same-named rows was picked; a second row would be an + // option that could neither be selected nor persisted. It could not be + // honoured downstream either — kiro-cli resolves `--agent` against its cwd + // and searches the project scope first, and the job runs with the bound + // folder as cwd, so "use the global one here" is not ours to guarantee. + const effectiveAgents = useMemo(() => { + if (!projectPath || projectAgents.length === 0) return agents + const projectNames = new Set(projectAgents.map(a => a.name)) + const kept = agents.filter(a => !projectNames.has(a.name)) + return [...kept, ...projectAgents] + }, [agents, projectAgents, projectPath]) + // Names where a project agent displaced a same-named global one. Derived from + // the same two rosters `effectiveAgents` merges, so the marker cannot drift + // from the dedup that produced the list. + // + // Filtered on `scope === 'project'` because the project-scoped response is the + // WHOLE roster, not just the folder's half: it carries the configured agents + // too. Matching on the name alone would therefore mark every configured agent + // as overridden the moment any folder is bound, since each one appears in both + // the `agents` prop and the fetched payload. + const shadowedGlobals = useMemo(() => { + if (!projectPath || projectAgents.length === 0) return undefined + const globalNames = new Set(agents.map(a => a.name)) + const shadowed = projectAgents + .filter(a => a.scope === 'project' && globalNames.has(a.name)) + .map(a => a.name) + return shadowed.length ? new Set(shadowed) : undefined + }, [agents, projectAgents, projectPath]) // Touched = any field diverged from what the form OPENED with. Compared // against `init`/`defaults` (the same sources the state seeded from), so a // value typed and then typed back reads as untouched again — the same rule @@ -335,6 +698,7 @@ export default function JobForm({ job, prefill, agents, defaultAgent, rosterFail chatFolderId !== defaults.chatFolderId || intVal !== init.intVal || intUnit !== init.intUnit || weekTime !== init.weekTime || cronExpr !== init.cronExpr || + projectPath !== init.projectPath || weekDays.length !== init.weekDays.length || weekDays.some((d, i) => d !== init.weekDays[i]) const dirtyChangeRef = useRef(onDirtyChange) dirtyChangeRef.current = onDirtyChange @@ -356,6 +720,19 @@ export default function JobForm({ job, prefill, agents, defaultAgent, rosterFail useEffect(() => { if (error) errorRef.current?.scrollIntoView?.({ block: 'nearest' }) }, [error, errorTick]) + // A project_path SAVE rejection rendered beside the field it names, not in + // the form-wide notice at the foot of the form (UX Review span=d88c9e1f411b). + // Its own scroll-into-view (mirroring `errorRef` above) because the field + // sits mid-form while Save is at the bottom, so without it a reject would + // land off-screen above the button the user just pressed. The tick makes a + // REPEATED identical reject scroll again, exactly as the form-wide notice does. + const projectPathErrorRef = useRef(null) + const [projectPathSaveError, setProjectPathSaveErrorState] = useState('') + const [projectPathErrorTick, setProjectPathErrorTick] = useState(0) + const setProjectPathSaveError = (e: string) => { setProjectPathSaveErrorState(e); if (e) setProjectPathErrorTick(t => t + 1) } + useEffect(() => { + if (projectPathSaveError) projectPathErrorRef.current?.scrollIntoView?.({ block: 'nearest' }) + }, [projectPathSaveError, projectPathErrorTick]) const [saving, setSavingState] = useState(false) const setSaving = (v: boolean) => { setSavingState(v); onSavingChange?.(v) } @@ -462,8 +839,8 @@ export default function JobForm({ job, prefill, agents, defaultAgent, rosterFail }, [modelList, model]) const submit = async () => { - setError(''); setSaving(true) - const f = { name, message: msg, agent: locked ?? agent, model, channel, approvalMode, silent, strictSchedule, hideInChat, minimalContext, chatFolderId: submittedChatFolderId, jobKind, schedMode, intVal, intUnit, weekDays, weekTime, cronExpr } + setError(''); setProjectPathSaveError(''); setSaving(true) + const f = { name, message: msg, agent: locked ?? agent, model, channel, approvalMode, silent, strictSchedule, hideInChat, minimalContext, chatFolderId: submittedChatFolderId, jobKind, schedMode, intVal, intUnit, weekDays, weekTime, cronExpr, projectPath } const body = buildBody(f, tz, setError, !!job, job ? undefined : prefill) if (!body) { setSaving(false); return } if (privateMember && !isLlmless) { @@ -487,19 +864,35 @@ export default function JobForm({ job, prefill, agents, defaultAgent, rosterFail // gateway error can be raised before the app ever saw the POST, or after it // applied it and the response was lost. Anything without a status (a dropped // connection, an offline tab) reached no verdict either. + // Both routes carry the same catch, not just create: the project-binding + // validation refuses an UPDATE with the same field-scoped 400 (an agent the + // bound directory does not declare, a relative or sensitive path), and + // without it that reason fell to the outer handler and showed the generic + // "failed to save" instead of the sentence naming the field to fix. + const classify = (e: unknown) => ({ + error: e instanceof Error ? e.message : String(e), + errorConfirmed: e instanceof ApiError && e.status >= 400 && e.status < 500, + }) const res = job - ? await api.updateCron(job.id, body) - : await api.createCron(body).catch((e: unknown) => ({ - error: e instanceof Error ? e.message : String(e), - errorConfirmed: e instanceof ApiError && e.status >= 400 && e.status < 500, - })) + ? await api.updateCron(job.id, body).catch(classify) + : await api.createCron(body).catch(classify) if (res.error) { - setError(res.error) - onSubmitError?.(res.error, 'errorConfirmed' in res ? !!res.errorConfirmed : true, f.name) + // Rewritten for the field it belongs to before BOTH consumers see it: + // the host's onSubmitError gets the same sentence the user reads, so a + // dialog that surfaces the message itself cannot show the raw backend + // wording while the inline notice shows the friendly one. + const shown = friendlyProjectPathError(res.error) + // A project_path refusal names the project-directory field, so it is + // rendered beside that field rather than the form-wide notice at the + // foot of the form (UX Review span=d88c9e1f411b). Any other rejection + // is not about that one field and stays form-wide. + if (isProjectPathError(res.error)) setProjectPathSaveError(shown) + else setError(shown) + onSubmitError?.(shown, 'errorConfirmed' in res ? !!res.errorConfirmed : true, f.name) setSaving(false) return } - if (!job) { setName(''); setMsg(''); setWeekDays([]); setIntVal(1); setChannel(''); setModel(''); setApprovalMode(''); setSilent(false); setStrictSchedule(false); setHideInChat(false); setMinimalContext(false); setChatFolderId('') } + if (!job) { setName(''); setMsg(''); setWeekDays([]); setIntVal(1); setChannel(''); setModel(''); setApprovalMode(''); setSilent(false); setStrictSchedule(false); setHideInChat(false); setMinimalContext(false); setChatFolderId(''); setProjectPath('') } // Cleared BEFORE onSaved, so `onSavingChange` is symmetric: it reports // false on EVERY outcome, not only on failure. An asymmetric version made // the flag a host's problem to unlearn — a host that lifts it out of its @@ -577,7 +970,7 @@ export default function JobForm({ job, prefill, agents, defaultAgent, rosterFail setMsg(e.target.value)} /> {locked ? - : setAgent(name)} rosterFailure={rosterFailure} groupByKind modal />} + : } - {/* Agent and Approval are agent/message concepts — script/command crons - run no LLM, so hide them (consistent with the LLM-less create surface). */} + {/* Working directory (like Agent/Approval below) is an agent/message + concept: it is only ever read at fire time by the LLM-agent cron + paths in gateway.py (single-agent and sequential), never by a + script/command job's subprocess dispatch in cron.py, which passes + no cwd derived from it. Showing the field for script/command jobs + would display help text that talks about "this job's agent" when + that job kind has none, and — since save-time validation holds + any non-empty project_path that differs from the stored one to + the existing-directory bar — could 400 the + save over a value the job would never actually use. Guarding it + the same as Agent/Approval keeps the field's presence consistent + with what fire time actually reads. */} {!isLlmless && (<> +
+ {i18nT('components.jobForm.project_directory')} ({i18nT('components.jobForm.optional')}) + {i18nT('components.jobForm.run_this_job_s_agent_in_this_folder_and_offer')} +
+ { setProjectPath(e.target.value); setProjectPathSaveError('') }} + placeholder={i18nT('components.jobForm.project_directory_placeholder')} + /> + setPickerOpen(true)}> + {i18nT('components.jobForm.browse')} + +
+ {/* No hand-off: this notice sits inside the job form whose fields + (name, message, schedule, working directory) are still live — + the hand-off navigates to chat and would discard them. The retry + refetches the ONE roster query in place, the same shape as the + chat-folder retry below and the agent roster's `onReload`: the + failure "need[s] different next actions (retry vs. pick a + different folder)" and now offers both, not just re-typing the + path (UX Review span=6409bbff1088). */} + {projectRosterError && ( +
+ + + {projectRosterRetrying + ? i18nT('components.jobForm.project_roster_retrying') + : i18nT('components.jobForm.project_roster_retry')} + +
+ )} + {/* A save-time project_path rejection, beside the field it names + rather than the form-wide notice at the foot of the form (UX + Review span=d88c9e1f411b). Same inline ErrorNotice the roster + failure above uses — no new notice system. No hand-off: this is + a save refusal inside a form whose unsaved fields would be lost + when the hand-off navigates to chat. */} +
+ {projectPathSaveError && ( + + )} +
+
{i18nT('components.jobForm.agent')} {locked ? : (<> {i18nT('components.jobForm.which_agent_handles_this_job_leave_default_for_t')} - setAgent(name)} rosterFailure={rosterFailure} groupByKind modal /> + + {/* Beside the Agent field rather than in the form-wide notice: the + reset happened to THIS control, and it is information, not an + error -- the directory change was legitimate and so was the + reset. Cleared as soon as the user picks an agent again, since + by then the sentence describes nothing they can still act on. + + role="status" for the same reason the sibling + `chat_folder_was_deleted` notice below carries it: the system + discarded a choice the reader made deliberately, so a reader on + assistive tech must hear that it happened rather than discover a + silently different agent later. A status (polite) rather than an + alert, because the reset itself was legitimate and there is + nothing to interrupt for. */} + {agentResetFrom && ( + + {i18nT( + agentResetReason === 'project-cleared' + ? 'components.jobForm.agent_reset_project_cleared' + : 'components.jobForm.agent_reset_not_in_folder', + { name: agentResetFrom }, + )} + + )} )}
)} @@ -864,6 +1342,17 @@ export default function JobForm({ job, prefill, agents, defaultAgent, rosterFail
+ {/* Portals at z-[9999] via createPortal — reused rather than + * reimplemented so this folder picker is IDENTICAL to every other + * project-directory picker in the app (chat's own, FolderConfigModal's). */} + {pickerOpen && ( + { if (!o) setPickerOpen(false) }} + anchorRef={browseRef} + onSelect={path => { setProjectPath(path); setProjectPathSaveError(''); setPickerOpen(false) }} + /> + )} ) } diff --git a/website/src/hooks/useAgents.ts b/website/src/hooks/useAgents.ts index 0df8f21e8dd3..b8340203f2de 100644 --- a/website/src/hooks/useAgents.ts +++ b/website/src/hooks/useAgents.ts @@ -19,11 +19,11 @@ import { usePreviewFlag } from './usePreviewFlag' * * @param sessionKey Chat-slot key whose project scope should apply. Omit on * surfaces with no slot context; project-scoped agents are then excluded. - * @param projectDir The slot's current project directory. The server resolves - * project-scoped agents from it, so it is part of this fetch's identity, not - * just an input to it: pointing the SAME slot at a different project changes - * the roster without changing `sessionKey`. Omit on surfaces with no slot - * context (the roster is then global-only and cannot go stale this way). + * @param projectDir The slot's current project directory. It is part of this + * fetch's identity, not an argument to it: it is deliberately NOT sent to the + * API (the server derives the slot's project itself), but pointing the SAME + * slot at a different project must refetch and drop the previous project's + * roster. Omit on surfaces with no slot context. * * @returns `choices` — the catalog rows a namespace-aware picker (the chat agent * pop-up) renders, keyed by (selection_kind, name). Unless the gateway's diff --git a/website/src/i18n/locales/bn.json b/website/src/i18n/locales/bn.json index 7001772e39d6..1e46e901c84b 100644 --- a/website/src/i18n/locales/bn.json +++ b/website/src/i18n/locales/bn.json @@ -5979,6 +5979,9 @@ "default": "ডিফল্ট", "filter_agents": "এজেন্ট ফিল্টার করুন", "no_matches": "কোনো মিল নেই", + "project_agent": "প্রজেক্ট এজেন্ট", + "overrides_global": "গ্লোবাল ওভাররাইড করে", + "overrides_global_hint": "এই জবের প্রজেক্ট ডিরেক্টরি এই নামেই নিজের একটি এজেন্ট নির্ধারণ করে, তাই গ্লোবাল এজেন্টের বদলে এটিই চলে। অন্যত্র গ্লোবাল এজেন্ট অপরিবর্তিত থাকে।", "retry": "আবার চেষ্টা করুন", "retrying": "আবার চেষ্টা করা হচ্ছে…", "roster_load_failed": "এজেন্ট তালিকা লোড করা যায়নি।", @@ -7210,6 +7213,7 @@ "at": "সময়", "auto": "auto", "auto_approve": "স্বয়ংক্রিয় অনুমোদন", + "browse": "ব্রাউজ করো", "channel_id": "চ্যানেল ID", "channel_id_optional": "চ্যানেল ID (ঐচ্ছিক)", "command": "কমান্ড", @@ -7241,6 +7245,16 @@ "name": "নাম", "name_is_required": "নাম দেওয়া বাধ্যতামূলক", "optional": "ঐচ্ছিক", + "project_directory": "প্রজেক্ট ডিরেক্টরি", + "project_directory_must_be_an_absolute_path": "প্রজেক্ট ডিরেক্টরি একটি অ্যাবসোলিউট পাথ হতে হবে (যেমন /Users/you/projects/myrepo)।", + "project_directory_must_be_an_existing_directory": "প্রজেক্ট ডিরেক্টরি একটি বিদ্যমান ডিরেক্টরি হতে হবে।", + "project_directory_refers_to_a_protected_path": "প্রজেক্ট ডিরেক্টরি একটি সুরক্ষিত সিস্টেম পাথ নির্দেশ করে এবং এটি ব্যবহার করা যাবে না।", + "project_roster_error_falls_back_to_global_agents": "পরিবর্তে গ্লোবাল এজেন্ট তালিকা দেখানো হচ্ছে।", + "agent_reset_not_in_folder": "{{name}} এই প্রজেক্টে সংজ্ঞায়িত নয়, তাই এজেন্ট ডিফল্টে রিসেট করা হয়েছে।", + "agent_reset_project_cleared": "প্রজেক্ট ডিরেক্টরি খালি করা হয়েছে, তাই {{name}} ডিফল্টে রিসেট করা হয়েছে।", + "couldnt_load_this_folders_agents": "এই প্রজেক্টের এজেন্ট লোড করা যায়নি।", + "couldnt_load_this_folders_agents_detail": "এই প্রজেক্টের এজেন্ট লোড করা যায়নি: {{detail}}।", + "run_this_job_s_agent_in_this_folder_and_offer": "এই জবের এজেন্টকে এই প্রজেক্টে চালাও, এবং তোমার গ্লোবাল এজেন্টদের সাথে এর .kiro/agents/-এ সংজ্ঞায়িত এজেন্টগুলোও প্রদান করো।", "override_the_model_for_this_job_leave_on_inherit": "এই জবের জন্য মডেল ওভাররাইড করুন। এজেন্ট বা গ্লোবাল ডিফল্ট ব্যবহার করতে “ইনহেরিট”-এ রেখে দিন।", "save": "সেভ করো", "saving": "সেভ হচ্ছে...", @@ -7265,7 +7279,10 @@ "chat_folder_retry": "আবার চেষ্টা করো", "chat_folder_retrying": "আবার চেষ্টা করা হচ্ছে…", "chat_folder_none_yet": "এখনও কোনো ফোল্ডার নেই। এই কাজটি এখনই সংরক্ষণ করো; চ্যাট সাইডবারে একটি ফোল্ডার তৈরি করো, তারপর কাজটি আবার খুলে সেটি বেছে নাও।", - "chat_folder_was_deleted": "এই কাজটি যে ফোল্ডারে ফাইল করত সেটি মুছে ফেলা হয়েছে। অন্য একটি বেছে নাও, বা সংরক্ষণ করো যাতে রানগুলো ফাইল না হয়।" + "chat_folder_was_deleted": "এই কাজটি যে ফোল্ডারে ফাইল করত সেটি মুছে ফেলা হয়েছে। অন্য একটি বেছে নাও, বা সংরক্ষণ করো যাতে রানগুলো ফাইল না হয়।", + "project_roster_retry": "আবার চেষ্টা করো", + "project_roster_retrying": "আবার চেষ্টা করা হচ্ছে…", + "project_directory_placeholder": "যেমন /Users/you/projects/myrepo" }, "jobLogsView": { "cancel": "বাতিল করুন", diff --git a/website/src/i18n/locales/de.json b/website/src/i18n/locales/de.json index ae58c48fa7ab..8627bcb394eb 100644 --- a/website/src/i18n/locales/de.json +++ b/website/src/i18n/locales/de.json @@ -5979,6 +5979,9 @@ "default": "Standard", "filter_agents": "Agenten filtern", "no_matches": "Keine Treffer", + "project_agent": "Projekt-Agent", + "overrides_global": "überschreibt global", + "overrides_global_hint": "Das Projektverzeichnis dieses Jobs definiert einen eigenen Agenten mit diesem Namen, daher wird dieser anstelle des globalen Agenten ausgeführt. Andernorts bleibt der globale Agent unverändert.", "retry": "Wiederholen", "retrying": "Wird wiederholt…", "roster_load_failed": "Die Agentenliste konnte nicht geladen werden.", @@ -7210,6 +7213,7 @@ "at": "um", "auto": "automatisch", "auto_approve": "Automatisch genehmigen", + "browse": "Durchsuchen", "channel_id": "Kanal-ID", "channel_id_optional": "Kanal-ID (optional)", "command": "Befehl", @@ -7241,6 +7245,16 @@ "name": "Name", "name_is_required": "Name ist erforderlich", "optional": "Optional", + "project_directory": "Projektverzeichnis", + "project_directory_must_be_an_absolute_path": "Das Projektverzeichnis muss ein absoluter Pfad sein (z. B. /Users/you/projects/myrepo).", + "project_directory_must_be_an_existing_directory": "Das Projektverzeichnis muss ein vorhandenes Verzeichnis sein.", + "project_directory_refers_to_a_protected_path": "Das Projektverzeichnis verweist auf einen geschützten Systempfad und kann nicht verwendet werden.", + "project_roster_error_falls_back_to_global_agents": "Es wird stattdessen die globale Agentenliste angezeigt.", + "agent_reset_not_in_folder": "{{name}} ist in diesem Projekt nicht definiert, daher wurde der Agent auf den Standard zurückgesetzt.", + "agent_reset_project_cleared": "Das Projektverzeichnis wurde geleert, daher wurde {{name}} auf den Standard zurückgesetzt.", + "couldnt_load_this_folders_agents": "Agenten dieses Projekts konnten nicht geladen werden.", + "couldnt_load_this_folders_agents_detail": "Agenten dieses Projekts konnten nicht geladen werden: {{detail}}.", + "run_this_job_s_agent_in_this_folder_and_offer": "Führt den Agenten dieses Jobs in diesem Projekt aus und bietet zusätzlich zu deinen globalen Agenten die in dessen .kiro/agents/ definierten Agenten an.", "override_the_model_for_this_job_leave_on_inherit": "Das Modell für diesen Job übersteuern. Auf „Übernehmen“ belassen, um den Agenten- oder globalen Standard zu verwenden.", "save": "Speichern", "saving": "Wird gespeichert...", @@ -7265,7 +7279,10 @@ "chat_folder_retry": "Wiederholen", "chat_folder_retrying": "Wird wiederholt…", "chat_folder_none_yet": "Noch keine Ordner. Speichere diesen Auftrag jetzt; lege in der Chat-Seitenleiste einen Ordner an und öffne den Auftrag dann erneut, um ihn zu wählen.", - "chat_folder_was_deleted": "Der Ordner, in den dieser Auftrag ablegte, wurde gelöscht. Wähle einen anderen, oder speichere, damit die Ausführungen nicht abgelegt werden." + "chat_folder_was_deleted": "Der Ordner, in den dieser Auftrag ablegte, wurde gelöscht. Wähle einen anderen, oder speichere, damit die Ausführungen nicht abgelegt werden.", + "project_roster_retry": "Wiederholen", + "project_roster_retrying": "Wird wiederholt…", + "project_directory_placeholder": "z. B. /Users/you/projects/myrepo" }, "jobLogsView": { "cancel": "Abbrechen", diff --git a/website/src/i18n/locales/en-XA.json b/website/src/i18n/locales/en-XA.json index 70b7c5457a7c..2a4d703b6cae 100644 --- a/website/src/i18n/locales/en-XA.json +++ b/website/src/i18n/locales/en-XA.json @@ -5439,6 +5439,9 @@ "default": "[ðèƒàùĺţ ···········]", "filter_agents": "[Ƒìĺţèŕ àğèñţş ············]", "no_matches": "[Ñø ɱàţçĥèş ···············]", + "project_agent": "[þŕøĵèçţ àğèñţ ············]", + "overrides_global": "[øṽèŕŕìðèş ğĺøƀàĺ ··············]", + "overrides_global_hint": "[Ţĥìş ĵøƀ'ş þŕøĵèçţ ðìŕèçţøŕý ðèƒìñèş ìţş øẁñ àğèñţ ẁìţĥ ţĥìş ñàɱè, şø ìţ ŕùñş ìñşţèàð øƒ ýøùŕ ğĺøƀàĺ øñè. Ýøùŕ ğĺøƀàĺ àğèñţ ìş ùñçĥàñğèð èĺşèẁĥèŕè. ············································]", "retry": "[Ŕèţŕý ········]", "retrying": "[Ŕèţŕýìñğ… ··············]", "roster_load_failed": "[Çøùĺðñ'ţ ĺøàð ţĥè àğèñţ ĺìşţ. ····················]", @@ -6468,6 +6471,7 @@ "at": "[àţ ···]", "auto": "[àùţø ······]", "auto_approve": "[Àùţø-àþþŕøṽè ···········]", + "browse": "[Ɓŕøẁşè ·········]", "channel_id": "[Çĥàññèĺ ÌÐ ···············]", "channel_id_optional": "[Çĥàññèĺ ÌÐ (øþţìøñàĺ) ···············]", "command": "[Çøɱɱàñð ···········]", @@ -6490,6 +6494,16 @@ "model_inherit": "[Ṁøðèĺ: ìñĥèŕìţ ·············]", "name": "[Ñàɱè ······]", "optional": "[Øþţìøñàĺ ············]", + "run_this_job_s_agent_in_this_folder_and_offer": "[Ŕùñ ţĥìş ĵøƀ'ş àğèñţ ìñ ţĥìş þŕøĵèçţ, àñð øƒƒèŕ àñý àğèñţş ðèƒìñèð ìñ ìţş .ķìŕø/àğèñţş/ àĺøñğşìðè ýøùŕ ğĺøƀàĺ àğèñţş. ···································]", + "project_directory": "[Þŕøĵèçţ ðìŕèçţøŕý ···············]", + "project_directory_must_be_an_absolute_path": "[Þŕøĵèçţ ðìŕèçţøŕý ɱùşţ ƀè àñ àƀşøĺùţè þàţĥ (è.ğ. /Users/you/projects/myrepo). ··················]", + "project_directory_must_be_an_existing_directory": "[Þŕøĵèçţ ðìŕèçţøŕý ɱùşţ ƀè àñ èẋìşţìñğ ðìŕèçţøŕý. ························]", + "project_directory_refers_to_a_protected_path": "[Þŕøĵèçţ ðìŕèçţøŕý ŕèƒèŕş ţø à þŕøţèçţèð şýşţèɱ þàţĥ àñð çàñ'ţ ƀè ùşèð. ·························]", + "project_roster_error_falls_back_to_global_agents": "[Şĥøẁìñğ ţĥè ğĺøƀàĺ àğèñţ ĺìşţ ìñşţèàð. ···················]", + "agent_reset_not_in_folder": "[{{name}} ìşñ'ţ ðèƒìñèð ìñ ţĥìş þŕøĵèçţ, şø ţĥè àğèñţ ẁàş ŕèşèţ ţø ðèƒàùĺţ. ·······················]", + "agent_reset_project_cleared": "[Ţĥè þŕøĵèçţ ðìŕèçţøŕý ẁàş çĺèàŕèð, şø {{name}} ẁàş ŕèşèţ ţø ðèƒàùĺţ. ·····················]", + "couldnt_load_this_folders_agents": "[Çøùĺðñ'ţ ĺøàð ţĥìş þŕøĵèçţ'ş àğèñţş. ··················]", + "couldnt_load_this_folders_agents_detail": "[Çøùĺðñ'ţ ĺøàð ţĥìş þŕøĵèçţ'ş àğèñţş: {{detail}}. ···················]", "override_the_model_for_this_job_leave_on_inherit": "[Øṽèŕŕìðè ţĥè ɱøðèĺ ƒøŕ ţĥìş ĵøƀ. Ĺèàṽè øñ \"Ìñĥèŕìţ\" ţø ùşè ţĥè àğèñţ øŕ ğĺøƀàĺ ðèƒàùĺţ. ··························]", "schedule": "[Şçĥèðùĺè ············]", "script": "[Şçŕìþţ ·········]", @@ -6524,7 +6538,10 @@ "chat_folder_retry": "[Ŕèţŕý ········]", "chat_folder_retrying": "[Ŕèţŕýìñğ… ··············]", "chat_folder_none_yet": "[Ñø ƒøĺðèŕş ýèţ. Şàṽè ţĥìş ĵøƀ ñøẁ; çŕèàţè à ƒøĺðèŕ ìñ ţĥè çĥàţ şìðèƀàŕ, ţĥèñ ŕèøþèñ ţĥè ĵøƀ ţø þìçķ ìţ. ·······························]", - "chat_folder_was_deleted": "[Ţĥè ƒøĺðèŕ ţĥìş ĵøƀ ƒìĺèð ìñţø ẁàş ðèĺèţèð. Þìçķ àñøţĥèŕ, øŕ şàṽè ţø ĺèàṽè ŕùñş ùñƒìĺèð. ··························]" + "chat_folder_was_deleted": "[Ţĥè ƒøĺðèŕ ţĥìş ĵøƀ ƒìĺèð ìñţø ẁàş ðèĺèţèð. Þìçķ àñøţĥèŕ, øŕ şàṽè ţø ĺèàṽè ŕùñş ùñƒìĺèð. ··························]", + "project_roster_retry": "[Ŕèţŕý ········]", + "project_roster_retrying": "[Ŕèţŕýìñğ… ··············]", + "project_directory_placeholder": "[è.ğ. /Users/you/projects/myrepo ········]" }, "jobLogsView": { "cancel": "[Çàñçèĺ ·········]", diff --git a/website/src/i18n/locales/en.json b/website/src/i18n/locales/en.json index 6660e67fc79d..17418a021811 100644 --- a/website/src/i18n/locales/en.json +++ b/website/src/i18n/locales/en.json @@ -4159,6 +4159,9 @@ "default": "default", "filter_agents": "Filter agents", "no_matches": "No matches", + "project_agent": "project agent", + "overrides_global": "overrides global", + "overrides_global_hint": "This job's project directory defines its own agent with this name, so it runs instead of your global one. Your global agent is unchanged elsewhere.", "retry": "Retry", "retrying": "Retrying…", "roster_load_failed": "Couldn't load the agent list.", @@ -4683,6 +4686,7 @@ "at": "at", "auto": "auto", "auto_approve": "Auto-approve", + "browse": "Browse", "channel_id": "Channel ID", "channel_id_optional": "Channel ID (optional)", "command": "Command", @@ -4705,6 +4709,16 @@ "model_inherit": "Model: inherit", "name": "Name", "optional": "Optional", + "run_this_job_s_agent_in_this_folder_and_offer": "Run this job's agent in this project, and offer any agents defined in its .kiro/agents/ alongside your global agents.", + "project_directory": "Project directory", + "project_directory_must_be_an_absolute_path": "Project directory must be an absolute path (e.g. /Users/you/projects/myrepo).", + "project_directory_must_be_an_existing_directory": "Project directory must be an existing directory.", + "project_directory_refers_to_a_protected_path": "Project directory refers to a protected system path and can't be used.", + "project_roster_error_falls_back_to_global_agents": "Showing the global agent list instead.", + "agent_reset_not_in_folder": "{{name}} isn't defined in this project, so the agent was reset to default.", + "agent_reset_project_cleared": "The project directory was cleared, so {{name}} was reset to default.", + "couldnt_load_this_folders_agents": "Couldn't load this project's agents.", + "couldnt_load_this_folders_agents_detail": "Couldn't load this project's agents: {{detail}}.", "override_the_model_for_this_job_leave_on_inherit": "Override the model for this job. Leave on \"Inherit\" to use the agent or global default.", "schedule": "Schedule", "script": "Script", diff --git a/website/src/i18n/locales/en.manual.json b/website/src/i18n/locales/en.manual.json index dd1bf394a005..9f0be94c8d05 100644 --- a/website/src/i18n/locales/en.manual.json +++ b/website/src/i18n/locales/en.manual.json @@ -2682,7 +2682,10 @@ "chat_folder_retry": "Retry", "chat_folder_retrying": "Retrying…", "chat_folder_none_yet": "No folders yet. Save this job now; create a folder in the chat sidebar, then reopen the job to pick it.", - "chat_folder_was_deleted": "The folder this job filed into was deleted. Pick another, or save to leave runs unfiled." + "chat_folder_was_deleted": "The folder this job filed into was deleted. Pick another, or save to leave runs unfiled.", + "project_roster_retry": "Retry", + "project_roster_retrying": "Retrying…", + "project_directory_placeholder": "e.g. /Users/you/projects/myrepo" }, "jobLogsView": { "failed_to_load_history": "Failed to load history" diff --git a/website/src/i18n/locales/es.json b/website/src/i18n/locales/es.json index a495f61bb46c..91fdcdae6fcf 100644 --- a/website/src/i18n/locales/es.json +++ b/website/src/i18n/locales/es.json @@ -6080,6 +6080,9 @@ "default": "predeterminado", "filter_agents": "Filtrar agentes", "no_matches": "Sin coincidencias", + "project_agent": "agente de proyecto", + "overrides_global": "anula el global", + "overrides_global_hint": "El directorio del proyecto de esta tarea define su propio agente con este nombre, por lo que se ejecuta en lugar del agente global. En otros lugares, el agente global no cambia.", "retry": "Reintentar", "retrying": "Reintentando…", "roster_load_failed": "No se pudo cargar la lista de agentes.", @@ -7333,6 +7336,7 @@ "at": "a las", "auto": "auto", "auto_approve": "Aprobar automáticamente", + "browse": "Explorar", "channel_id": "ID del canal", "channel_id_optional": "ID del canal (opcional)", "command": "Comando", @@ -7364,6 +7368,16 @@ "name": "Nombre", "name_is_required": "El nombre es obligatorio", "optional": "Opcional", + "project_directory": "Directorio del proyecto", + "project_directory_must_be_an_absolute_path": "El directorio del proyecto debe ser una ruta absoluta (p. ej., /Users/you/projects/myrepo).", + "project_directory_must_be_an_existing_directory": "El directorio del proyecto debe ser un directorio existente.", + "project_directory_refers_to_a_protected_path": "El directorio del proyecto hace referencia a una ruta del sistema protegida y no se puede usar.", + "project_roster_error_falls_back_to_global_agents": "Mostrando la lista global de agentes en su lugar.", + "agent_reset_not_in_folder": "{{name}} no está definido en este proyecto, por lo que el agente se restableció al predeterminado.", + "agent_reset_project_cleared": "Se borró el directorio del proyecto, por lo que {{name}} se restableció al predeterminado.", + "couldnt_load_this_folders_agents": "No se pudieron cargar los agentes de este proyecto.", + "couldnt_load_this_folders_agents_detail": "No se pudieron cargar los agentes de este proyecto: {{detail}}.", + "run_this_job_s_agent_in_this_folder_and_offer": "Ejecuta el agente de este trabajo en este proyecto y ofrece los agentes definidos en su .kiro/agents/ junto con tus agentes globales.", "override_the_model_for_this_job_leave_on_inherit": "Anula el modelo para este trabajo. Déjalo en \"Heredar\" para usar el del agente o el predeterminado global.", "save": "Guardar", "saving": "Guardando…", @@ -7388,7 +7402,10 @@ "chat_folder_retry": "Reintentar", "chat_folder_retrying": "Reintentando…", "chat_folder_none_yet": "Aún no hay carpetas. Guarda esta tarea ahora; crea una carpeta en la barra lateral del chat y vuelve a abrir la tarea para elegirla.", - "chat_folder_was_deleted": "La carpeta en la que archivaba esta tarea se eliminó. Elige otra o guarda para dejar las ejecuciones sin archivar." + "chat_folder_was_deleted": "La carpeta en la que archivaba esta tarea se eliminó. Elige otra o guarda para dejar las ejecuciones sin archivar.", + "project_roster_retry": "Reintentar", + "project_roster_retrying": "Reintentando…", + "project_directory_placeholder": "p. ej., /Users/you/projects/myrepo" }, "jobLogsView": { "cancel": "Cancelar", diff --git a/website/src/i18n/locales/fr.json b/website/src/i18n/locales/fr.json index 3b9aecc07e10..c56cd2bdfed4 100644 --- a/website/src/i18n/locales/fr.json +++ b/website/src/i18n/locales/fr.json @@ -6080,6 +6080,9 @@ "default": "par défaut", "filter_agents": "Filtrer les agents", "no_matches": "Aucun résultat", + "project_agent": "agent du projet", + "overrides_global": "remplace le global", + "overrides_global_hint": "Le répertoire du projet de cette tâche définit son propre agent portant ce nom ; c'est donc lui qui s'exécute au lieu de l'agent global. Ailleurs, l'agent global reste inchangé.", "retry": "Réessayer", "retrying": "Nouvelle tentative…", "roster_load_failed": "Impossible de charger la liste des agents.", @@ -7333,6 +7336,7 @@ "at": "à", "auto": "auto", "auto_approve": "Approuver automatiquement", + "browse": "Parcourir", "channel_id": "ID du canal", "channel_id_optional": "ID du canal (facultatif)", "command": "Commande", @@ -7364,6 +7368,16 @@ "name": "Nom", "name_is_required": "Le nom est obligatoire", "optional": "Facultatif", + "project_directory": "Répertoire du projet", + "project_directory_must_be_an_absolute_path": "Le répertoire du projet doit être un chemin absolu (par ex. /Users/you/projects/myrepo).", + "project_directory_must_be_an_existing_directory": "Le répertoire du projet doit être un répertoire existant.", + "project_directory_refers_to_a_protected_path": "Le répertoire du projet fait référence à un chemin système protégé et ne peut pas être utilisé.", + "project_roster_error_falls_back_to_global_agents": "Affichage de la liste globale des agents à la place.", + "agent_reset_not_in_folder": "{{name}} n'est pas défini dans ce projet ; l'agent a donc été réinitialisé sur celui par défaut.", + "agent_reset_project_cleared": "Le répertoire du projet a été effacé ; {{name}} a donc été réinitialisé sur celui par défaut.", + "couldnt_load_this_folders_agents": "Impossible de charger les agents de ce projet.", + "couldnt_load_this_folders_agents_detail": "Impossible de charger les agents de ce projet : {{detail}}.", + "run_this_job_s_agent_in_this_folder_and_offer": "Exécute l'agent de cette tâche dans ce projet et propose les agents définis dans son .kiro/agents/ en plus de tes agents globaux.", "override_the_model_for_this_job_leave_on_inherit": "Remplacer le modèle pour cette tâche. Laissez sur « Hériter » pour utiliser le modèle de l'agent ou le modèle global par défaut.", "save": "Enregistrer", "saving": "Enregistrement...", @@ -7388,7 +7402,10 @@ "chat_folder_retry": "Réessayer", "chat_folder_retrying": "Nouvelle tentative…", "chat_folder_none_yet": "Aucun dossier pour l'instant. Enregistrez cette tâche maintenant ; créez un dossier dans la barre latérale de discussion, puis rouvrez la tâche pour le choisir.", - "chat_folder_was_deleted": "Le dossier dans lequel cette tâche classait ses exécutions a été supprimé. Choisissez-en un autre, ou enregistrez pour ne plus les classer." + "chat_folder_was_deleted": "Le dossier dans lequel cette tâche classait ses exécutions a été supprimé. Choisissez-en un autre, ou enregistrez pour ne plus les classer.", + "project_roster_retry": "Réessayer", + "project_roster_retrying": "Nouvelle tentative…", + "project_directory_placeholder": "par ex. /Users/you/projects/myrepo" }, "jobLogsView": { "cancel": "Annuler", diff --git a/website/src/i18n/locales/hi.json b/website/src/i18n/locales/hi.json index 12d7bad178d4..1ec1a2a7bfdb 100644 --- a/website/src/i18n/locales/hi.json +++ b/website/src/i18n/locales/hi.json @@ -401,7 +401,7 @@ "view_full_changelog": "▸ पूरा चेंजलॉग देखें", "what_s_new": "नया क्या है", "you_re_on_the_latest_version": "आप नवीनतम संस्करण पर हैं", - "k_run_a_command": "कमांड चलाएं", + "k_run_a_command": "कमांड चलाओ", "open_command_bar": "Command Bar खोलें", "focus_mode": "फ़ोकस मोड", "focus_mode_title": "फ़ोकस मोड · Alt+Shift+M", @@ -2673,7 +2673,7 @@ }, "repoSettings": { "browse_for_workspace_folder": "वर्कस्पेस फ़ोल्डर ब्राउज़ करें", - "browse": "ब्राउज़ करें", + "browse": "ब्राउज़ करो", "workspace": "वर्कस्पेस", "local_workspace_path": "स्थानीय वर्कस्पेस पथ", "where_this_repo_is_checked_out_investigate_cwd": "गेटवे चलाने वाली मशीन पर यह रिपॉज़िटरी कहाँ चेक आउट है। Investigate अपना चैट सत्र इसी डायरेक्टरी में खोलता है ताकि एजेंट रिपॉज़िटरी का असली स्रोत देख सके। केवल-स्थानीय — कभी भी स्रोत होस्ट को नहीं भेजा जाता।", @@ -5979,6 +5979,9 @@ "default": "डिफ़ॉल्ट", "filter_agents": "एजेंट फ़िल्टर करें", "no_matches": "कोई मेल नहीं", + "project_agent": "प्रोजेक्ट एजेंट", + "overrides_global": "ग्लोबल को ओवरराइड करता है", + "overrides_global_hint": "इस जॉब की प्रोजेक्ट डायरेक्टरी इसी नाम का अपना एजेंट परिभाषित करती है, इसलिए ग्लोबल एजेंट के बजाय यही चलता है। अन्य जगहों पर ग्लोबल एजेंट अपरिवर्तित रहता है।", "retry": "पुन: प्रयास करें", "retrying": "पुनः प्रयास कर रहे हैं…", "roster_load_failed": "एजेंट सूची लोड नहीं की जा सकी।", @@ -6991,7 +6994,7 @@ "folderConfigModal": { "agent_not_installed": "{{agent}} (इंस्टॉल नहीं है)", "agent_not_installed_notice": "यह एजेंट इंस्टॉल नहीं है, इसलिए यहाँ की चैट इसका उपयोग नहीं करेंगी। कोई इंस्टॉल किया हुआ एजेंट चुनें।", - "browse": "ब्राउज़ करें", + "browse": "ब्राउज़ करो", "cancel": "रद्द करें", "color": "रंग", "create_folder": "फ़ोल्डर बनाएँ", @@ -7210,6 +7213,7 @@ "at": "समय", "auto": "auto", "auto_approve": "स्वतः स्वीकृति", + "browse": "ब्राउज़ करो", "channel_id": "चैनल ID", "channel_id_optional": "चैनल ID (वैकल्पिक)", "command": "कमांड", @@ -7241,6 +7245,16 @@ "name": "नाम", "name_is_required": "नाम ज़रूरी है", "optional": "वैकल्पिक", + "project_directory": "प्रोजेक्ट डायरेक्टरी", + "project_directory_must_be_an_absolute_path": "प्रोजेक्ट डायरेक्टरी एक ऐब्सोल्यूट पथ होनी चाहिए (उदाहरण: /Users/you/projects/myrepo)।", + "project_directory_must_be_an_existing_directory": "प्रोजेक्ट डायरेक्टरी एक मौजूदा डायरेक्टरी होनी चाहिए।", + "project_directory_refers_to_a_protected_path": "प्रोजेक्ट डायरेक्टरी एक सुरक्षित सिस्टम पथ को संदर्भित करती है और इसका उपयोग नहीं किया जा सकता।", + "project_roster_error_falls_back_to_global_agents": "इसके बजाय ग्लोबल एजेंट सूची दिखाई जा रही है।", + "agent_reset_not_in_folder": "{{name}} इस प्रोजेक्ट में परिभाषित नहीं है, इसलिए एजेंट को डिफ़ॉल्ट पर रीसेट कर दिया गया।", + "agent_reset_project_cleared": "प्रोजेक्ट डायरेक्टरी खाली कर दी गई, इसलिए {{name}} को डिफ़ॉल्ट पर रीसेट कर दिया गया।", + "couldnt_load_this_folders_agents": "इस प्रोजेक्ट के एजेंट लोड नहीं हो सके।", + "couldnt_load_this_folders_agents_detail": "इस प्रोजेक्ट के एजेंट लोड नहीं हो सके: {{detail}}।", + "run_this_job_s_agent_in_this_folder_and_offer": "इस जॉब के एजेंट को इस प्रोजेक्ट में चलाओ, और तुम्हारे ग्लोबल एजेंटों के साथ-साथ इसके .kiro/agents/ में परिभाषित एजेंट भी प्रस्तुत करो।", "override_the_model_for_this_job_leave_on_inherit": "इस जॉब के लिए मॉडल ओवरराइड करें। एजेंट या ग्लोबल डिफ़ॉल्ट उपयोग करने के लिए \"इनहेरिट\" पर छोड़ दें।", "save": "सहेजें", "saving": "सहेजा जा रहा है...", @@ -7265,7 +7279,10 @@ "chat_folder_retry": "पुनः प्रयास करें", "chat_folder_retrying": "पुनः प्रयास कर रहे हैं…", "chat_folder_none_yet": "अभी कोई फ़ोल्डर नहीं। इस जॉब को अभी सहेजें; चैट साइडबार में एक फ़ोल्डर बनाएँ, फिर जॉब को दोबारा खोलकर उसे चुनें।", - "chat_folder_was_deleted": "यह जॉब जिस फ़ोल्डर में फ़ाइल करती थी वह हटा दिया गया है। दूसरा चुनें, या सहेजें ताकि रन फ़ाइल न हों।" + "chat_folder_was_deleted": "यह जॉब जिस फ़ोल्डर में फ़ाइल करती थी वह हटा दिया गया है। दूसरा चुनें, या सहेजें ताकि रन फ़ाइल न हों।", + "project_roster_retry": "पुनः प्रयास करो", + "project_roster_retrying": "पुनः प्रयास कर रहे हैं…", + "project_directory_placeholder": "उदाहरण: /Users/you/projects/myrepo" }, "jobLogsView": { "cancel": "रद्द करें", @@ -7983,7 +8000,7 @@ "all_drives": "सभी ड्राइव", "back": "वापस", "back_to": "{{path}} पर वापस जाएँ", - "browse": "ब्राउज़ करें", + "browse": "ब्राउज़ करो", "system_folder_picker": "सिस्टम का फ़ोल्डर पिकर खोलो…", "system_folder_picker_failed": "सिस्टम का फ़ोल्डर पिकर नहीं खुल सका। सूची से कोई फ़ोल्डर चुनो, या ब्राउज़ में कोई पथ लिखो।", "system_folder_refused": "{{failed}} को प्रोजेक्ट फ़ोल्डर के रूप में इस्तेमाल नहीं किया जा सकता। कोई दूसरा फ़ोल्डर चुनो।", @@ -15684,7 +15701,7 @@ "automatic_updates_unavailable_volume": "स्वचालित अपडेट उपलब्ध नहीं हैं क्योंकि यह ऐप एक रीड-ओनली डिस्क इमेज से चल रहा है। इसे अपने Applications फ़ोल्डर में ले जाएँ और फिर से खोलें।", "autonomous_agent_management_runs_locally_open_so": "स्वायत्त एजेंट प्रबंधन · स्थानीय रूप से चलता है · ओपन सोर्स", "browse_this_branch_on_github": "इस ब्रांच को GitHub पर देखें", - "channel_explainer_gateway_switch_note": "बदलने से केवल यह बदलता है कि कौन सा चैनल जांचा जाता है। इस इंस्टॉल को वास्तव में ले जाने के लिए नीचे दिया कमांड चलाएं।", + "channel_explainer_gateway_switch_note": "बदलने से केवल यह बदलता है कि कौन सा चैनल जांचा जाता है। इस इंस्टॉल को वास्तव में ले जाने के लिए नीचे दिया कमांड चलाओ।", "channel_explainer_insider": "शुरुआती बिल्ड, Stable से कुछ दिन या हफ़्ते पहले जारी होती हैं। नई सुविधाएँ पहले यहाँ आती हैं, और नई गड़बड़ियाँ भी।", "channel_explainer_nightly": "main से अपरीक्षित दैनिक बिल्ड्स। खराबी संभव है — उसी दिन आया फिक्स आजमाने के लिए उपयोगी।", "channel_explainer_stable": "केवल परखे हुए रिलीज़। अपडेट कम आते हैं और चौंकाने वाली दिक्कतें भी कम।", @@ -15777,7 +15794,7 @@ "approval_window_expired": "अनुमोदन के बिना अनुमोदन विंडो समाप्त हो गई। तैयार होने पर अपडेट फिर से शुरू करें।", "try_again": "फिर से कोशिश करें", "not_on_channel_yet": "{{channel}} पर नहीं", - "channel_explainer_gateway_switch_note_version": "बदलने से केवल यह बदलता है कि कौन सा चैनल जांचा जाता है। {{channel}} चैनल अभी v{{version}} प्रकाशित करता है, जो तुम्हारे चल रहे बिल्ड से पुराना है — इस इंस्टॉल को वास्तव में ले जाने के लिए नीचे दिया कमांड चलाएं।", + "channel_explainer_gateway_switch_note_version": "बदलने से केवल यह बदलता है कि कौन सा चैनल जांचा जाता है। {{channel}} चैनल अभी v{{version}} प्रकाशित करता है, जो तुम्हारे चल रहे बिल्ड से पुराना है — इस इंस्टॉल को वास्तव में ले जाने के लिए नीचे दिया कमांड चलाओ।", "channel_publishes_older_version": "{{channel}} चैनल अभी v{{version}} प्रकाशित करता है, जो तुम्हारे चल रहे बिल्ड से पुराना है, इसलिए कोई अपडेट नहीं दिखेगा। उस चैनल पर जाने के लिए v{{version}} डाउनलोड करो।", "switch_to_version": "v{{version}} पर जाओ", "in_app_channel_move_intro": "चुने गए चैनल का रिलीज़ मौजूदा के बगल में इंस्टॉल होता है और परमाणु रूप से स्विच हो जाता है। लागू करने के लिए गेटवे होस्ट पर एक अनुमोदन कमांड चलानी होती है।", diff --git a/website/src/i18n/locales/it.json b/website/src/i18n/locales/it.json index fef9c8b1e962..d85430ae9877 100644 --- a/website/src/i18n/locales/it.json +++ b/website/src/i18n/locales/it.json @@ -6080,6 +6080,9 @@ "default": "predefinito", "filter_agents": "Filtra gli agenti", "no_matches": "Nessuna corrispondenza", + "project_agent": "agente del progetto", + "overrides_global": "sostituisce il globale", + "overrides_global_hint": "La directory del progetto di questo processo definisce un proprio agente con questo nome, quindi viene eseguito al posto di quello globale. Altrove l'agente globale resta invariato.", "retry": "Riprova", "retrying": "Nuovo tentativo…", "roster_load_failed": "Impossibile caricare l'elenco degli agenti.", @@ -7333,6 +7336,7 @@ "at": "alle", "auto": "automatico", "auto_approve": "Approva automaticamente", + "browse": "Sfoglia", "channel_id": "ID canale", "channel_id_optional": "ID canale (facoltativo)", "command": "Comando", @@ -7364,6 +7368,16 @@ "name": "Nome", "name_is_required": "Il nome è obbligatorio", "optional": "Facoltativo", + "project_directory": "Directory del progetto", + "project_directory_must_be_an_absolute_path": "La directory del progetto deve essere un percorso assoluto (ad es. /Users/you/projects/myrepo).", + "project_directory_must_be_an_existing_directory": "La directory del progetto deve essere una directory esistente.", + "project_directory_refers_to_a_protected_path": "La directory del progetto fa riferimento a un percorso di sistema protetto e non può essere usata.", + "project_roster_error_falls_back_to_global_agents": "Verrà mostrato invece l'elenco globale degli agenti.", + "agent_reset_not_in_folder": "{{name}} non è definito in questo progetto, quindi l'agente è stato reimpostato su quello predefinito.", + "agent_reset_project_cleared": "La directory del progetto è stata cancellata, quindi {{name}} è stato reimpostato su quello predefinito.", + "couldnt_load_this_folders_agents": "Impossibile caricare gli agenti di questo progetto.", + "couldnt_load_this_folders_agents_detail": "Impossibile caricare gli agenti di questo progetto: {{detail}}.", + "run_this_job_s_agent_in_this_folder_and_offer": "Esegue l'agente di questo job in questo progetto e offre gli agenti definiti nella sua .kiro/agents/ insieme ai tuoi agenti globali.", "override_the_model_for_this_job_leave_on_inherit": "Sostituisci il modello per questo job. Lascia su \"Eredita\" per usare il valore predefinito dell'agente o globale.", "save": "Salva", "saving": "Salvataggio in corso...", @@ -7388,7 +7402,10 @@ "chat_folder_retry": "Riprova", "chat_folder_retrying": "Nuovo tentativo…", "chat_folder_none_yet": "Nessuna cartella per ora. Salva questa attività adesso; crea una cartella nella barra laterale della chat, poi riapri l'attività per sceglierla.", - "chat_folder_was_deleted": "La cartella in cui questa attività archiviava è stata eliminata. Scegline un'altra, o salva per lasciare le esecuzioni non archiviate." + "chat_folder_was_deleted": "La cartella in cui questa attività archiviava è stata eliminata. Scegline un'altra, o salva per lasciare le esecuzioni non archiviate.", + "project_roster_retry": "Riprova", + "project_roster_retrying": "Nuovo tentativo…", + "project_directory_placeholder": "ad es. /Users/you/projects/myrepo" }, "jobLogsView": { "cancel": "Annulla", diff --git a/website/src/i18n/locales/ja.json b/website/src/i18n/locales/ja.json index d2639fb64b75..4e8944195340 100644 --- a/website/src/i18n/locales/ja.json +++ b/website/src/i18n/locales/ja.json @@ -5848,6 +5848,9 @@ "default": "デフォルト", "filter_agents": "エージェントをフィルター", "no_matches": "マッチするものがありません", + "project_agent": "プロジェクトのエージェント", + "overrides_global": "グローバルを上書き", + "overrides_global_hint": "このジョブのプロジェクトディレクトリが同じ名前のエージェントを独自に定義しているため、グローバルエージェントの代わりにこちらが実行されます。他の場所ではグローバルエージェントは変更されません。", "retry": "再試行", "retrying": "再試行中…", "roster_load_failed": "エージェント一覧を読み込めませんでした。", @@ -7087,6 +7090,7 @@ "at": "で", "auto": "自動", "auto_approve": "自動承認", + "browse": "参照", "channel_id": "チャネルID", "channel_id_optional": "チャネルID (オプション)", "command": "コマンド", @@ -7118,6 +7122,16 @@ "name": "名前", "name_is_required": "名前は必須です", "optional": "オプション", + "project_directory": "プロジェクトディレクトリ", + "project_directory_must_be_an_absolute_path": "プロジェクトディレクトリは絶対パスである必要があります(例: /Users/you/projects/myrepo)。", + "project_directory_must_be_an_existing_directory": "プロジェクトディレクトリは既存のディレクトリである必要があります。", + "project_directory_refers_to_a_protected_path": "プロジェクトディレクトリが保護されたシステムパスを参照しているため使用できません。", + "project_roster_error_falls_back_to_global_agents": "代わりにグローバルエージェント一覧を表示しています。", + "agent_reset_not_in_folder": "{{name}} はこのプロジェクトで定義されていないため、エージェントを既定に戻しました。", + "agent_reset_project_cleared": "プロジェクトディレクトリがクリアされたため、{{name}} を既定に戻しました。", + "couldnt_load_this_folders_agents": "このプロジェクトのエージェントを読み込めませんでした。", + "couldnt_load_this_folders_agents_detail": "このプロジェクトのエージェントを読み込めませんでした: {{detail}}。", + "run_this_job_s_agent_in_this_folder_and_offer": "このジョブのエージェントをこのプロジェクトで実行し、グローバルエージェントに加えて、その .kiro/agents/ で定義されたエージェントも提供します。", "override_the_model_for_this_job_leave_on_inherit": "このジョブのモデルをオーバーライドします。エージェントまたはグローバルのデフォルトを使用する場合は「継承」のままにしてください。", "save": "保存", "saving": "保存中…", @@ -7142,7 +7156,10 @@ "chat_folder_retry": "再試行", "chat_folder_retrying": "再試行中…", "chat_folder_none_yet": "フォルダーはまだありません。まずこのジョブを保存し、チャットサイドバーでフォルダーを作成してから、ジョブを開き直して選んでください。", - "chat_folder_was_deleted": "このジョブが振り分けていたフォルダーは削除されました。別のフォルダーを選んでください。保存すれば振り分けなくなります。" + "chat_folder_was_deleted": "このジョブが振り分けていたフォルダーは削除されました。別のフォルダーを選んでください。保存すれば振り分けなくなります。", + "project_roster_retry": "再試行", + "project_roster_retrying": "再試行中…", + "project_directory_placeholder": "例: /Users/you/projects/myrepo" }, "jobLogsView": { "cancel": "キャンセル", diff --git a/website/src/i18n/locales/ko.json b/website/src/i18n/locales/ko.json index e5f14d765654..f08bd5eaa6a0 100644 --- a/website/src/i18n/locales/ko.json +++ b/website/src/i18n/locales/ko.json @@ -5848,6 +5848,9 @@ "default": "기본값", "filter_agents": "에이전트 필터", "no_matches": "일치 항목 없음", + "project_agent": "프로젝트 에이전트", + "overrides_global": "전역 재정의", + "overrides_global_hint": "이 작업의 프로젝트 디렉터리가 같은 이름의 자체 에이전트를 정의하므로 전역 에이전트 대신 이 에이전트가 실행됩니다. 다른 곳에서는 전역 에이전트가 그대로 유지됩니다.", "retry": "다시 시도", "retrying": "다시 시도 중…", "roster_load_failed": "에이전트 목록을 불러올 수 없습니다.", @@ -7087,6 +7090,7 @@ "at": "시각", "auto": "자동", "auto_approve": "자동 승인", + "browse": "찾아보기", "channel_id": "채널 ID", "channel_id_optional": "채널 ID (선택 사항)", "command": "명령", @@ -7118,7 +7122,17 @@ "name": "이름", "name_is_required": "이름은 필수입니다", "optional": "선택 사항", - "override_the_model_for_this_job_leave_on_inherit": "이 작업의 모델을 재정의합니다. 에이전트 또는 전역 기본값을 사용하려면 ‘상속’으로 두세요.", + "project_directory": "프로젝트 디렉터리", + "project_directory_must_be_an_absolute_path": "프로젝트 디렉터리는 절대 경로여야 합니다(예: /Users/you/projects/myrepo).", + "project_directory_must_be_an_existing_directory": "프로젝트 디렉터리는 실제로 존재하는 디렉터리여야 합니다.", + "project_directory_refers_to_a_protected_path": "프로젝트 디렉터리가 보호된 시스템 경로를 참조하므로 사용할 수 없습니다.", + "project_roster_error_falls_back_to_global_agents": "대신 전역 에이전트 목록을 표시합니다.", + "agent_reset_not_in_folder": "{{name}}은(는) 이 프로젝트에 정의되어 있지 않아 에이전트를 기본값으로 되돌렸습니다.", + "agent_reset_project_cleared": "프로젝트 디렉터리가 지워져 {{name}}을(를) 기본값으로 되돌렸습니다.", + "couldnt_load_this_folders_agents": "이 프로젝트의 에이전트를 불러올 수 없습니다.", + "couldnt_load_this_folders_agents_detail": "이 프로젝트의 에이전트를 불러올 수 없습니다: {{detail}}.", + "run_this_job_s_agent_in_this_folder_and_offer": "이 작업의 에이전트를 이 프로젝트에서 실행하고, 전역 에이전트와 함께 해당 .kiro/agents/에 정의된 에이전트도 제공합니다.", + "override_the_model_for_this_job_leave_on_inherit": "이 작업의 모델을 재정의합니다. 에이전트 또는 전역 기본값을 사용하려면 '상속'으로 두세요.", "save": "저장", "saving": "저장 중…", "schedule": "스케줄", @@ -7142,7 +7156,10 @@ "chat_folder_retry": "다시 시도", "chat_folder_retrying": "다시 시도 중…", "chat_folder_none_yet": "아직 폴더가 없습니다. 이 작업을 먼저 저장한 뒤, 채팅 사이드바에서 폴더를 만들고 작업을 다시 열어 선택하세요.", - "chat_folder_was_deleted": "이 작업이 정리하던 폴더가 삭제되었습니다. 다른 폴더를 선택하거나, 저장해 실행을 정리하지 않도록 하세요." + "chat_folder_was_deleted": "이 작업이 정리하던 폴더가 삭제되었습니다. 다른 폴더를 선택하거나, 저장해 실행을 정리하지 않도록 하세요.", + "project_roster_retry": "다시 시도", + "project_roster_retrying": "다시 시도 중…", + "project_directory_placeholder": "예: /Users/you/projects/myrepo" }, "jobLogsView": { "cancel": "취소", diff --git a/website/src/i18n/locales/pt.json b/website/src/i18n/locales/pt.json index 610addd3d7e8..6fd86b476780 100644 --- a/website/src/i18n/locales/pt.json +++ b/website/src/i18n/locales/pt.json @@ -6080,6 +6080,9 @@ "default": "padrão", "filter_agents": "Filtrar agentes", "no_matches": "Nenhum resultado", + "project_agent": "agente do projeto", + "overrides_global": "substitui o global", + "overrides_global_hint": "O diretório do projeto desta tarefa define o próprio agente com este nome, por isso é ele que é executado em vez do agente global. Noutros locais, o agente global permanece inalterado.", "retry": "Tentar novamente", "retrying": "Tentando novamente…", "roster_load_failed": "Não foi possível carregar a lista de agentes.", @@ -7333,6 +7336,7 @@ "at": "às", "auto": "auto", "auto_approve": "Aprovar automaticamente", + "browse": "Procurar", "channel_id": "ID do canal", "channel_id_optional": "ID do canal (opcional)", "command": "Comando", @@ -7364,6 +7368,16 @@ "name": "Nome", "name_is_required": "O nome é obrigatório", "optional": "Opcional", + "project_directory": "Diretório do projeto", + "project_directory_must_be_an_absolute_path": "O diretório do projeto deve ser um caminho absoluto (ex.: /Users/you/projects/myrepo).", + "project_directory_must_be_an_existing_directory": "O diretório do projeto deve ser um diretório existente.", + "project_directory_refers_to_a_protected_path": "O diretório do projeto faz referência a um caminho de sistema protegido e não pode ser usado.", + "project_roster_error_falls_back_to_global_agents": "Mostrando a lista global de agentes em vez disso.", + "agent_reset_not_in_folder": "{{name}} não está definido neste projeto, portanto o agente foi redefinido para o padrão.", + "agent_reset_project_cleared": "O diretório do projeto foi limpo, portanto {{name}} foi redefinido para o padrão.", + "couldnt_load_this_folders_agents": "Não foi possível carregar os agentes deste projeto.", + "couldnt_load_this_folders_agents_detail": "Não foi possível carregar os agentes deste projeto: {{detail}}.", + "run_this_job_s_agent_in_this_folder_and_offer": "Executa o agente deste job neste projeto e oferece os agentes definidos em seu .kiro/agents/, além dos seus agentes globais.", "override_the_model_for_this_job_leave_on_inherit": "Substitui o modelo deste job. Deixe em \"Herdar\" para usar o padrão do agente ou o global.", "save": "Salvar", "saving": "Salvando...", @@ -7388,7 +7402,10 @@ "chat_folder_retry": "Tentar novamente", "chat_folder_retrying": "Tentando novamente…", "chat_folder_none_yet": "Ainda não há pastas. Salve esta tarefa agora; crie uma pasta na barra lateral de conversa e reabra a tarefa para escolhê-la.", - "chat_folder_was_deleted": "A pasta em que esta tarefa arquivava foi excluída. Escolha outra ou salve para deixar as execuções sem arquivar." + "chat_folder_was_deleted": "A pasta em que esta tarefa arquivava foi excluída. Escolha outra ou salve para deixar as execuções sem arquivar.", + "project_roster_retry": "Tentar novamente", + "project_roster_retrying": "Tentando novamente…", + "project_directory_placeholder": "ex.: /Users/you/projects/myrepo" }, "jobLogsView": { "cancel": "Cancelar", diff --git a/website/src/i18n/locales/ru.json b/website/src/i18n/locales/ru.json index aeade2b2dc17..55b3a25bc925 100644 --- a/website/src/i18n/locales/ru.json +++ b/website/src/i18n/locales/ru.json @@ -6181,6 +6181,9 @@ "default": "по умолчанию", "filter_agents": "Фильтр агентов", "no_matches": "Нет совпадений", + "project_agent": "агент проекта", + "overrides_global": "переопределяет глобальный", + "overrides_global_hint": "В каталоге проекта этого задания определён собственный агент с таким именем, поэтому запускается он, а не глобальный агент. В других местах глобальный агент не меняется.", "retry": "Повторить", "retrying": "Повторная попытка…", "roster_load_failed": "Не удалось загрузить список агентов.", @@ -7456,6 +7459,7 @@ "at": "в", "auto": "авто", "auto_approve": "Автоподтверждение", + "browse": "Обзор", "channel_id": "ID канала", "channel_id_optional": "ID канала (необязательно)", "command": "Команда", @@ -7487,6 +7491,16 @@ "name": "Название", "name_is_required": "Нужно указать название", "optional": "Необязательно", + "project_directory": "Каталог проекта", + "project_directory_must_be_an_absolute_path": "Каталог проекта должен быть абсолютным путём (например, /Users/you/projects/myrepo).", + "project_directory_must_be_an_existing_directory": "Каталог проекта должен быть существующим каталогом.", + "project_directory_refers_to_a_protected_path": "Каталог проекта указывает на защищённый системный путь и не может быть использован.", + "project_roster_error_falls_back_to_global_agents": "Вместо этого показывается глобальный список агентов.", + "agent_reset_not_in_folder": "{{name}} не определён в этом проекте, поэтому агент сброшен на стандартный.", + "agent_reset_project_cleared": "Каталог проекта был очищен, поэтому {{name}} сброшен на стандартный.", + "couldnt_load_this_folders_agents": "Не удалось загрузить агентов этого проекта.", + "couldnt_load_this_folders_agents_detail": "Не удалось загрузить агентов этого проекта: {{detail}}.", + "run_this_job_s_agent_in_this_folder_and_offer": "Запускает агента этого задания в этом проекте и предлагает агентов, определённых в его .kiro/agents/, вместе с твоими глобальными агентами.", "override_the_model_for_this_job_leave_on_inherit": "Переопределить модель для этого задания. Оставьте «Наследовать», чтобы использовать модель агента или глобальную по умолчанию.", "save": "Сохранить", "saving": "Сохранение...", @@ -7511,7 +7525,10 @@ "chat_folder_retry": "Повторить", "chat_folder_retrying": "Повторная попытка…", "chat_folder_none_yet": "Папок пока нет. Сохраните эту задачу сейчас; создайте папку в боковой панели чатов, затем снова откройте задачу и выберите её.", - "chat_folder_was_deleted": "Папка, в которую попадали запуски этой задачи, удалена. Выберите другую или сохраните, чтобы не размещать их в папке." + "chat_folder_was_deleted": "Папка, в которую попадали запуски этой задачи, удалена. Выберите другую или сохраните, чтобы не размещать их в папке.", + "project_roster_retry": "Повторить", + "project_roster_retrying": "Повторная попытка…", + "project_directory_placeholder": "например, /Users/you/projects/myrepo" }, "jobLogsView": { "cancel": "Отмена", diff --git a/website/src/i18n/locales/zh-CN.json b/website/src/i18n/locales/zh-CN.json index b11e46b33b24..85fc62eb5413 100644 --- a/website/src/i18n/locales/zh-CN.json +++ b/website/src/i18n/locales/zh-CN.json @@ -5878,6 +5878,9 @@ "default": "默认", "filter_agents": "筛选代理", "no_matches": "无匹配项", + "project_agent": "项目代理", + "overrides_global": "覆盖全局", + "overrides_global_hint": "此作业的项目目录自行定义了同名代理,因此运行该代理而非全局代理。在其他位置,全局代理保持不变。", "retry": "重试", "retrying": "正在重试…", "roster_load_failed": "无法加载 Agent 列表。", @@ -7087,6 +7090,7 @@ "at": "于", "auto": "自动", "auto_approve": "自动审批", + "browse": "浏览", "channel_id": "频道 ID", "channel_id_optional": "频道 ID(可选)", "command": "命令", @@ -7118,6 +7122,16 @@ "name": "名称", "name_is_required": "名称不能为空", "optional": "可选", + "project_directory": "项目目录", + "project_directory_must_be_an_absolute_path": "项目目录必须是绝对路径(例如 /Users/you/projects/myrepo)。", + "project_directory_must_be_an_existing_directory": "项目目录必须是一个已存在的目录。", + "project_directory_refers_to_a_protected_path": "项目目录指向受保护的系统路径,无法使用。", + "project_roster_error_falls_back_to_global_agents": "改为显示全局代理列表。", + "agent_reset_not_in_folder": "{{name}} 未在此项目中定义,因此代理已重置为默认值。", + "agent_reset_project_cleared": "项目目录已清空,因此 {{name}} 已重置为默认值。", + "couldnt_load_this_folders_agents": "无法加载此项目的代理。", + "couldnt_load_this_folders_agents_detail": "无法加载此项目的代理:{{detail}}。", + "run_this_job_s_agent_in_this_folder_and_offer": "此任务将在该项目中运行对应代理,并把 .kiro/agents/ 中定义的代理与全局代理一起提供选择。", "override_the_model_for_this_job_leave_on_inherit": "为此任务覆盖模型。保持“继承”则使用代理或全局默认值。", "save": "保存", "saving": "保存中…", @@ -7142,7 +7156,10 @@ "chat_folder_retry": "重试", "chat_folder_retrying": "正在重试…", "chat_folder_none_yet": "还没有文件夹。请先保存此任务;在聊天侧边栏中创建一个文件夹,然后重新打开此任务再选择它。", - "chat_folder_was_deleted": "此任务原先归档的文件夹已被删除。请另选一个,或直接保存以不再归档运行记录。" + "chat_folder_was_deleted": "此任务原先归档的文件夹已被删除。请另选一个,或直接保存以不再归档运行记录。", + "project_roster_retry": "重试", + "project_roster_retrying": "正在重试…", + "project_directory_placeholder": "例如 /Users/you/projects/myrepo" }, "jobLogsView": { "cancel": "取消", diff --git a/website/src/i18n/renderScan.test.ts b/website/src/i18n/renderScan.test.ts index bdbe3da6e962..2d0932ac0f43 100644 --- a/website/src/i18n/renderScan.test.ts +++ b/website/src/i18n/renderScan.test.ts @@ -119,9 +119,10 @@ describe('latinLeaks', () => { expect(latinLeaks('https://')).toEqual([]) }) - it('ignores interpolation placeholders and URLs, which pass through un-accented', () => { + it('ignores interpolation placeholders, URLs and canonical paths, which pass through un-accented', () => { expect(latinLeaks('{{count}}')).toEqual([]) expect(latinLeaks('https://github.com/owner/repo')).toEqual([]) + expect(latinLeaks('/Users/you/projects/myrepo')).toEqual([]) }) it('honours a raised minLetters', () => { diff --git a/website/src/pages/SchedulePage.tsx b/website/src/pages/SchedulePage.tsx index a82a848aff45..d4b335d30cc0 100644 --- a/website/src/pages/SchedulePage.tsx +++ b/website/src/pages/SchedulePage.tsx @@ -1624,21 +1624,39 @@ function JobDetailDialog({ job, prefill, prefillWrites, agents, defaultAgent, ro FAILED), so it takes the shared surface with the 'Last Error' label as its title. `whitespace-pre-wrap` on the notice body keeps the log's line structure; `font-mono` keeps it reading as - output rather than prose. + output rather than prose -- styling that applies to a script's + captured output, while a skip reason is one prose sentence and is + left as prose. - NOT gated on `script`: a `command` job fails the same way and - carries the same `last_error`, and gating the only in-page - surface on the job's TYPE left that reader with the row's - `title=` tooltip alone -- invisible on touch, unreadable to a - screen reader, and no hand-off. The failure decides the - surface, never the shape of the job that produced it. */} + NOT gated on `script`, for two reasons. A `command` job fails the + same way and carries the same `last_error`. And a message job's + skip reason -- an agent that no longer resolves, a bound directory + that vanished, a project file shadowing a Crew Member -- is written + to this same field and is the only signal the operator gets, since + those skips deliberately spend no auto-pause strike. Gated on the + job's TYPE, the only in-page surface collapsed to the row's + `title=` tooltip: invisible on touch, unreadable to a screen + reader, no signal at all in the desktop app, and no hand-off. The + failure decides the surface, never the shape of the job that + produced it. */} {job?.last_error && ( <> {/* No hand-off: JobForm draft */} diff --git a/website/src/test/AgentSelector.overrideDetail.test.tsx b/website/src/test/AgentSelector.overrideDetail.test.tsx new file mode 100644 index 000000000000..ff9357df7e93 --- /dev/null +++ b/website/src/test/AgentSelector.overrideDetail.test.tsx @@ -0,0 +1,48 @@ +import { describe, it, expect } from 'vitest' +import { render, screen, fireEvent } from '@testing-library/react' +import AgentSelector from '../components/AgentSelector' +import type { KiroCrewAgent } from '../components/AgentSelector' + +/** + * A shadowed collision row explains the override on its detail line. That line + * used to open with `{{name}}` — but the row title directly above already + * shows the name, so repeating it pushed the actual meaning ("…instead of your + * global agent") past the line's own `truncate` and rendered "…of this n…" on + * the 400px popover (UX Review span=7ddb24260c79). The detail now leads with + * the meaning and the name lives in the title alone. + */ +describe('AgentSelector override-detail line does not repeat the agent name', () => { + const collision: KiroCrewAgent[] = [ + { + name: 'reviewer', kiro_agent: '', workspace: 'default', memory_store: 'default', + description: '', source: 'kirocrew', scope: 'project', + }, + ] + + it('states the override starting from the meaning, not the name', () => { + render( + {}} + shadowedGlobals={new Set(['reviewer'])} + />, + ) + fireEvent.click(screen.getByLabelText('Switch agent')) + const row = screen.getByRole('option', { name: /reviewer/ }) + // A shadowed row shows the full explanation as body text, not as a native + // `title` on the chip: a tooltip has no keyboard path and no hover on + // touch, and this sentence is the only thing telling a user why their + // configured agent is not the one running. It is also the string every + // catalog already translates, so non-English users get the same reassurance. + expect(row).toHaveTextContent( + "This job's project directory defines its own agent with this name, so it runs " + + 'instead of your global one. Your global agent is unchanged elsewhere.', + ) + // The detail does not begin with the agent name (which would read as + // "reviewer runs instead of …"): the leading name is redundant with the + // row title directly above it. + expect(row).not.toHaveTextContent('reviewer runs instead of') + }) +}) diff --git a/website/src/test/JobForm.projectAgentOriginAndReset.test.tsx b/website/src/test/JobForm.projectAgentOriginAndReset.test.tsx new file mode 100644 index 000000000000..24fc4b10be44 --- /dev/null +++ b/website/src/test/JobForm.projectAgentOriginAndReset.test.tsx @@ -0,0 +1,114 @@ +import { describe, it, expect, vi, afterEach } from 'vitest' +import { screen, waitFor, fireEvent, within } from '@testing-library/react' +import { renderWithProviders } from './helpers' +import JobForm from '../components/JobForm' +import { api } from '../api/client' +import type { CronJob } from '../types' + +/** + * UX Review, two findings on the same surface: + * + * 1. Changing the Project directory silently cleared a project-only Agent pick, + * so the job saved under "default" with no acknowledgment anywhere -- the + * user's deliberate choice vanished between a keystroke and pressing Save. + * 2. A folder-supplied agent rendered the same `kirocrew` badge as a configured + * one, so nobody could tell which picks the directory contributed (and would + * therefore lose when it was cleared). The `overrides global` chip covered + * only COLLIDING rows, a strict subset. + * + * NO `vi.clearAllMocks()` here, deliberately and for the same reason the sibling + * collision test omits it: it wipes the factory's `mockResolvedValue` defaults, + * after which the roster query resolves `undefined` and no project row ever + * renders. Only call counts are reset, below. + */ + +vi.mock('../api/client', () => ({ + api: { + models: vi.fn().mockResolvedValue({ models: [] }), + kirocrewAgents: vi.fn().mockResolvedValue({ agents: [], default_agent: 'default' }), + updateCron: vi.fn().mockResolvedValue({}), + createCron: vi.fn().mockResolvedValue({}), + listDirs: vi.fn().mockResolvedValue({ dirs: [] }), + agentCatalog: vi.fn().mockResolvedValue({ agents: [], default_agent: '' }), + chatFolders: vi.fn().mockResolvedValue([]), + }, +})) + +const globalRoster = [{ name: 'default', source: 'kirocrew', description: '' }] + +// The endpoint returns the WHOLE roster, each row carrying its own scope -- so +// the badge must key on scope, not on mere presence in this payload. +const projectRoster = { + agents: [ + { name: 'default', source: 'kirocrew', description: '', scope: 'global' }, + { name: 'repo-smoke', source: 'kirocrew', description: '', scope: 'project' }, + ], + default_agent: 'default', +} + +function messageJob(): CronJob { + return { + id: 'j1', name: 'nightly', message: 'do the thing', schedule: '', enabled: true, + cron_expr: '0 3 * * *', + } as CronJob +} + +function mount() { + renderWithProviders( + {}} + layout="vertical" + />, + ) +} + +afterEach(() => { + vi.mocked(api.kirocrewAgents).mockClear() +}) + +describe('JobForm — project agent origin and reset', () => { + it('marks a project-supplied agent as coming from this project, and only it', async () => { + vi.mocked(api.kirocrewAgents).mockResolvedValueOnce(projectRoster) + mount() + fireEvent.change(screen.getByLabelText('Project directory'), { target: { value: '/repo-a' } }) + await waitFor(() => expect(api.kirocrewAgents).toHaveBeenCalled()) + fireEvent.click(screen.getByLabelText('Switch agent')) + await waitFor(() => + expect(screen.getByRole('option', { name: /repo-smoke/ })).toBeInTheDocument(), + ) + const listbox = screen.getByRole('listbox') + + expect(within(listbox).getByRole('option', { name: /repo-smoke/ })).toHaveTextContent( + 'project agent', + ) + // The configured row must NOT carry it -- that is the whole point of keying + // on scope rather than on the payload the project fetch returned. + expect(within(listbox).getByRole('option', { name: /default/ })).not.toHaveTextContent( + 'project agent', + ) + }) + + it('says which agent it cleared when the new folder no longer defines it', async () => { + // Folder A supplies `repo-smoke`; folder B supplies only the global. + vi.mocked(api.kirocrewAgents) + .mockResolvedValueOnce(projectRoster) + .mockResolvedValueOnce({ agents: globalRoster, default_agent: 'default' }) + mount() + fireEvent.change(screen.getByLabelText('Project directory'), { target: { value: '/repo-a' } }) + await waitFor(() => expect(api.kirocrewAgents).toHaveBeenCalled()) + fireEvent.click(screen.getByLabelText('Switch agent')) + await waitFor(() => + expect(screen.getByRole('option', { name: /repo-smoke/ })).toBeInTheDocument(), + ) + fireEvent.click(screen.getByRole('option', { name: /repo-smoke/ })) + + // Move to a folder that does not define it -- the reset fires here. + fireEvent.change(screen.getByLabelText('Project directory'), { target: { value: '/repo-b' } }) + + const note = await screen.findByTestId('jobform-agent-reset-note') + expect(note.textContent).toContain('repo-smoke') + }) +}) diff --git a/website/src/test/JobForm.projectAgentReset.test.tsx b/website/src/test/JobForm.projectAgentReset.test.tsx new file mode 100644 index 000000000000..f1a2acbdc536 --- /dev/null +++ b/website/src/test/JobForm.projectAgentReset.test.tsx @@ -0,0 +1,912 @@ +import type { ComponentProps } from 'react' +import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest' +import { screen, fireEvent, waitFor, within, act } from '@testing-library/react' +import { renderWithProviders } from './helpers' +import JobForm from '../components/JobForm' +import type { KiroCrewAgent } from '../components/AgentSelector' +import type { CronJob } from '../types' +import { api } from '../api/client' + +vi.mock('../api/client', () => ({ + api: { + updateCron: vi.fn(), + createCron: vi.fn(), + models: vi.fn().mockResolvedValue({ models: [] }), + kirocrewAgents: vi.fn().mockResolvedValue({ agents: [], default_agent: '' }), + // Rendering JobForm reaches both: `useAgents` (in a child) calls + // `agentCatalog`, and the chat-folder picker calls `chatFolders`. Neither + // is any file in this group's subject; unstubbed they throw or render an + // unrelated error notice into the form under test. + agentCatalog: vi.fn().mockResolvedValue({ agents: [], default_agent: '' }), + chatFolders: vi.fn().mockResolvedValue([]), + }, +})) + +function messageJob(overrides: Partial = {}): CronJob { + return { + id: 'j1', name: 'nightly', message: 'do the thing', schedule: '', enabled: true, + cron_expr: '0 3 * * *', ...overrides, + } as CronJob +} + +const builtInAgent: KiroCrewAgent = { + name: 'default', kiro_agent: 'default', workspace: 'default', memory_store: 'default', + description: 'built-in', source: 'kirocrew', +} +const eaDevAgent: KiroCrewAgent = { + name: 'ea-dev', kiro_agent: 'ea-dev', workspace: 'ea', memory_store: 'ea', + description: 'ea agent', source: 'kirocrew', +} +const withDefaultAgent = { agents: [builtInAgent], defaultAgent: 'default' } + +/** Renders JobForm with the props every test shares; `overrides` varies any one. */ +function renderJobForm(overrides: Partial> = {}) { + return renderWithProviders( + {}} + layout="vertical" + {...overrides} + />, + ) +} + +beforeEach(() => { + vi.mocked(api.kirocrewAgents).mockReset() + vi.mocked(api.kirocrewAgents).mockResolvedValue({ agents: [], default_agent: '' }) +}) + +afterEach(() => { vi.useRealTimers() }) + +/** + * GPT 5.6 Review F2: switching the project directory from project A to + * project B (WITHOUT ever clearing it in between) left the picker's `agent` + * state untouched -- only the `!projectPath` early-return branch reconciled + * a stale selection, so the A-project agent stayed selected after B's + * roster loaded even though B's roster does not contain that name. Save + * would then persist an agent name B's project cannot resolve, and the + * scheduled fire silently falls back to the default agent's prompt, tools, + * and permissions with no error surfaced anywhere. Fixed by reconciling the + * selection against the union of the newly-fetched project roster and the + * global roster inside the success branch of the folder-change effect + * itself, not just the cleared-folder branch. + */ +describe('JobForm reconciles the agent picker when the project directory switches project', () => { + it('clears a project-A-only agent that does not exist under project B', async () => { + vi.mocked(api.kirocrewAgents) + .mockResolvedValueOnce({ + agents: [{ + name: 'repo-a-bot', kiro_agent: 'repo-a-bot', workspace: 'repo-a', memory_store: 'repo-a', + description: 'repo A agent', source: 'project', + }], + default_agent: '', + }) + .mockResolvedValueOnce({ + agents: [{ + name: 'repo-b-bot', kiro_agent: 'repo-b-bot', workspace: 'repo-b', memory_store: 'repo-b', + description: 'repo B agent', source: 'project', + }], + default_agent: '', + }) + + renderJobForm(withDefaultAgent) + + fireEvent.change(screen.getByLabelText('Project directory'), { + target: { value: '/Users/you/projects/repo-a' }, + }) + await waitFor(() => expect(api.kirocrewAgents).toHaveBeenCalledTimes(1)) + + fireEvent.click(screen.getByLabelText('Switch agent')) + // The resolved roster now propagates through useQuery (an extra render + // hop past the raw fetch call above), so wait for the option to actually + // be in the DOM before clicking it -- a bare `getByRole` can race that + // hop and see an empty listbox. + await waitFor(() => expect(screen.getByRole('option', { name: /repo-a-bot/ })).toBeInTheDocument()) + fireEvent.click(screen.getByRole('option', { name: /repo-a-bot/ })) + await waitFor(() => expect(screen.getByLabelText('Switch agent')).toHaveTextContent('repo-a-bot')) + + // Switch straight to project B, never clearing the field in between. + fireEvent.change(screen.getByLabelText('Project directory'), { + target: { value: '/Users/you/projects/repo-b' }, + }) + await waitFor(() => expect(api.kirocrewAgents).toHaveBeenCalledTimes(2)) + + // repo-a-bot exists in neither B's project roster nor the global + // roster, so the selection must be cleared back to default. + await waitFor(() => + expect(screen.getByLabelText('Switch agent')).toHaveTextContent('default'), + ) + expect(screen.getByLabelText('Switch agent')).not.toHaveTextContent('repo-a-bot') + }) + + it('keeps a project-only agent selected when it also exists under the new project', async () => { + vi.mocked(api.kirocrewAgents) + .mockResolvedValueOnce({ + agents: [{ + name: 'shared-bot', kiro_agent: 'shared-bot', workspace: 'repo-a', memory_store: 'repo-a', + description: 'shared agent', source: 'project', + }], + default_agent: '', + }) + .mockResolvedValueOnce({ + agents: [{ + name: 'shared-bot', kiro_agent: 'shared-bot', workspace: 'repo-b', memory_store: 'repo-b', + description: 'shared agent', source: 'project', + }], + default_agent: '', + }) + + renderJobForm(withDefaultAgent) + + fireEvent.change(screen.getByLabelText('Project directory'), { + target: { value: '/Users/you/projects/repo-a' }, + }) + await waitFor(() => expect(api.kirocrewAgents).toHaveBeenCalledTimes(1)) + + fireEvent.click(screen.getByLabelText('Switch agent')) + // See the sibling test above -- wait for the roster to have propagated + // through useQuery before clicking the option. + await waitFor(() => expect(screen.getByRole('option', { name: /shared-bot/ })).toBeInTheDocument()) + fireEvent.click(screen.getByRole('option', { name: /shared-bot/ })) + await waitFor(() => expect(screen.getByLabelText('Switch agent')).toHaveTextContent('shared-bot')) + + fireEvent.change(screen.getByLabelText('Project directory'), { + target: { value: '/Users/you/projects/repo-b' }, + }) + await waitFor(() => expect(api.kirocrewAgents).toHaveBeenCalledTimes(2)) + + // shared-bot exists under project B too, so it must survive. + expect(screen.getByLabelText('Switch agent')).toHaveTextContent('shared-bot') + }) + + it('keeps a global agent selected across a project A-to-B switch', async () => { + vi.mocked(api.kirocrewAgents) + .mockResolvedValueOnce({ agents: [], default_agent: '' }) + .mockResolvedValueOnce({ agents: [], default_agent: '' }) + + renderJobForm({ agents: [builtInAgent, eaDevAgent], defaultAgent: 'default' }) + + fireEvent.click(screen.getByLabelText('Switch agent')) + fireEvent.click(screen.getByRole('option', { name: /ea-dev/ })) + await waitFor(() => expect(screen.getByLabelText('Switch agent')).toHaveTextContent('ea-dev')) + + fireEvent.change(screen.getByLabelText('Project directory'), { + target: { value: '/Users/you/projects/repo-a' }, + }) + await waitFor(() => expect(api.kirocrewAgents).toHaveBeenCalledTimes(1)) + + fireEvent.change(screen.getByLabelText('Project directory'), { + target: { value: '/Users/you/projects/repo-b' }, + }) + await waitFor(() => expect(api.kirocrewAgents).toHaveBeenCalledTimes(2)) + + expect(screen.getByLabelText('Switch agent')).toHaveTextContent('ea-dev') + }) + + it('clears a project-A agent when the global catalog fails but project B loads', async () => { + vi.mocked(api.kirocrewAgents) + .mockResolvedValueOnce({ + agents: [{ + name: 'repo-a-bot', kiro_agent: 'repo-a-bot', workspace: 'repo-a', memory_store: 'repo-a', + description: 'repo A agent', source: 'project', scope: 'project', + }], + default_agent: '', + }) + .mockResolvedValueOnce({ + agents: [{ + name: 'repo-b-bot', kiro_agent: 'repo-b-bot', workspace: 'repo-b', memory_store: 'repo-b', + description: 'repo B agent', source: 'project', scope: 'project', + }], + default_agent: '', + }) + + renderJobForm() + + const projectDirectory = screen.getByLabelText('Project directory') + fireEvent.change(projectDirectory, { target: { value: '/Users/you/projects/repo-a' } }) + await waitFor(() => expect(api.kirocrewAgents).toHaveBeenCalledTimes(1)) + + fireEvent.click(screen.getByLabelText('Switch agent')) + await waitFor(() => expect(screen.getByRole('option', { name: /repo-a-bot/ })).toBeInTheDocument()) + fireEvent.click(screen.getByRole('option', { name: /repo-a-bot/ })) + await waitFor(() => expect(screen.getByLabelText('Switch agent')).toHaveTextContent('repo-a-bot')) + + fireEvent.change(projectDirectory, { target: { value: '/Users/you/projects/repo-b' } }) + await waitFor(() => expect(api.kirocrewAgents).toHaveBeenCalledTimes(2)) + + await waitFor(() => + expect(screen.getByLabelText('Switch agent')).not.toHaveTextContent('repo-a-bot'), + ) + expect(screen.getByTestId('jobform-agent-reset-note')).toHaveTextContent('repo-a-bot') + }) + + it('keeps a globally valid pick when the global catalog fails but project B loads it', async () => { + const globalFromProjectRoster = { + name: 'ea-dev', kiro_agent: 'ea-dev', workspace: 'ea', memory_store: 'ea', + description: 'global agent', source: 'kirocrew', scope: 'global', + } + vi.mocked(api.kirocrewAgents) + .mockResolvedValueOnce({ + agents: [ + globalFromProjectRoster, + { + name: 'repo-a-bot', kiro_agent: 'repo-a-bot', workspace: 'repo-a', memory_store: 'repo-a', + description: 'repo A agent', source: 'project', scope: 'project', + }, + ], + default_agent: '', + }) + .mockResolvedValueOnce({ agents: [globalFromProjectRoster], default_agent: '' }) + + renderJobForm() + + const projectDirectory = screen.getByLabelText('Project directory') + fireEvent.change(projectDirectory, { target: { value: '/Users/you/projects/repo-a' } }) + await waitFor(() => expect(api.kirocrewAgents).toHaveBeenCalledTimes(1)) + + fireEvent.click(screen.getByLabelText('Switch agent')) + await waitFor(() => expect(screen.getByRole('option', { name: /ea-dev/ })).toBeInTheDocument()) + fireEvent.click(screen.getByRole('option', { name: /ea-dev/ })) + await waitFor(() => expect(screen.getByLabelText('Switch agent')).toHaveTextContent('ea-dev')) + + fireEvent.change(projectDirectory, { target: { value: '/Users/you/projects/repo-b' } }) + await waitFor(() => expect(api.kirocrewAgents).toHaveBeenCalledTimes(2)) + + expect(screen.getByLabelText('Switch agent')).toHaveTextContent('ea-dev') + expect(screen.queryByTestId('jobform-agent-reset-note')).not.toBeInTheDocument() + }) + + it('keeps a project-only pick while a longer directory path is typed', async () => { + const projectAgent = { + name: 'repo-a-bot', kiro_agent: 'repo-a-bot', workspace: 'repo-a', memory_store: 'repo-a', + description: 'repo A agent', source: 'project', scope: 'project', + } + const initialPath = '/Users/you/projects/repo-a' + const finalPath = `${initialPath}-longer` + vi.mocked(api.kirocrewAgents).mockImplementation(async (_sessionKey, path) => ({ + agents: path === initialPath || path === finalPath ? [projectAgent] : [], + default_agent: '', + })) + + renderJobForm() + + const projectDirectory = screen.getByLabelText('Project directory') + fireEvent.change(projectDirectory, { target: { value: initialPath } }) + await waitFor(() => expect(api.kirocrewAgents).toHaveBeenCalledTimes(1)) + + fireEvent.click(screen.getByLabelText('Switch agent')) + await waitFor(() => expect(screen.getByRole('option', { name: /repo-a-bot/ })).toBeInTheDocument()) + fireEvent.click(screen.getByRole('option', { name: /repo-a-bot/ })) + await waitFor(() => expect(screen.getByLabelText('Switch agent')).toHaveTextContent('repo-a-bot')) + + for (let end = initialPath.length + 1; end <= finalPath.length; end += 1) { + fireEvent.change(projectDirectory, { target: { value: finalPath.slice(0, end) } }) + await Promise.resolve() + } + + // No half-typed path is queried, so its empty roster cannot reset the pick. + expect(api.kirocrewAgents).toHaveBeenCalledTimes(1) + expect(screen.getByLabelText('Switch agent')).toHaveTextContent('repo-a-bot') + expect(screen.queryByTestId('jobform-agent-reset-note')).not.toBeInTheDocument() + + await waitFor(() => expect(api.kirocrewAgents).toHaveBeenCalledTimes(2)) + expect(api.kirocrewAgents).toHaveBeenLastCalledWith(undefined, finalPath) + expect(screen.getByLabelText('Switch agent')).toHaveTextContent('repo-a-bot') + }) + + it('restores a pick an intermediate path cleared once the finished path defines it', async () => { + // UX Review: the debounce above only protects a path typed FASTER than + // 250ms. Hand-editing a bound job's directory pauses longer than that, so an + // intermediate path becomes a roster identity of its own -- and + // `GET /api/agents?project_path=` answers an unusable path with HTTP 200 and + // the globals alone, so that roster legitimately lacks the picked project + // agent and the reconcile clears it. Clearing on what it knows is right; the + // defect was that the pick never came BACK once the finished path loaded a + // roster that does define the name, so every path edit on a bound job forced + // a re-pick, and the acknowledgment for a reset still in force was erased by + // the next intermediate settle. + const projectAgent = { + name: 'repo-a-bot', kiro_agent: 'repo-a-bot', workspace: 'repo-a', memory_store: 'repo-a', + description: 'repo A agent', source: 'project', scope: 'project', + } + const initialPath = '/Users/you/projects/repo-a' + const halfTyped = `${initialPath}-v` + const finalPath = `${initialPath}-v2` + vi.mocked(api.kirocrewAgents).mockImplementation(async (_sessionKey, path) => ({ + agents: path === initialPath || path === finalPath ? [projectAgent] : [], + default_agent: '', + })) + + renderJobForm(withDefaultAgent) + + const projectDirectory = screen.getByLabelText('Project directory') + fireEvent.change(projectDirectory, { target: { value: initialPath } }) + await waitFor(() => expect(api.kirocrewAgents).toHaveBeenCalledTimes(1)) + + fireEvent.click(screen.getByLabelText('Switch agent')) + await waitFor(() => expect(screen.getByRole('option', { name: /repo-a-bot/ })).toBeInTheDocument()) + fireEvent.click(screen.getByRole('option', { name: /repo-a-bot/ })) + await waitFor(() => expect(screen.getByLabelText('Switch agent')).toHaveTextContent('repo-a-bot')) + + // Pause on a half-typed path long enough for it to settle and be queried. + fireEvent.change(projectDirectory, { target: { value: halfTyped } }) + await waitFor(() => expect(api.kirocrewAgents).toHaveBeenCalledTimes(2), { timeout: 2000 }) + await waitFor(() => + expect(screen.getByLabelText('Switch agent')).not.toHaveTextContent('repo-a-bot'), + ) + // The reset IS announced, and stays announced while it is still in force. + expect(screen.getByTestId('jobform-agent-reset-note')).toHaveTextContent('repo-a-bot') + + // Finish the path. Its roster defines the name again, so the operator's own + // pick comes back rather than leaving them to re-pick it. + fireEvent.change(projectDirectory, { target: { value: finalPath } }) + await waitFor(() => expect(api.kirocrewAgents).toHaveBeenCalledTimes(3), { timeout: 2000 }) + + await waitFor(() => + expect(screen.getByLabelText('Switch agent')).toHaveTextContent('repo-a-bot'), + ) + // Nothing was lost after all, so the acknowledgment must not linger. + expect(screen.queryByTestId('jobform-agent-reset-note')).not.toBeInTheDocument() + }) +}) + +/** + * Selecting a project-scoped agent (only offered because a working + * directory was set), then clearing that project directory, previously left + * the picker's `agent` state untouched: `effectiveAgents` correctly fell + * back to the global roster once `projectAgents` cleared, but the SELECTED + * name was never reset, so save sent that now-unresolvable name with an + * empty `project_path`. Kiro cannot resolve a project agent without its + * project scope and silently falls back to the default agent's prompt, + * tools, and permissions -- with no error surfaced anywhere to say so. + * Fixed by clearing the selection back to the global default whenever it is + * not a name the global roster itself recognizes. + */ +describe('JobForm clears a project-only agent selection when the project directory is cleared', () => { + it('resets the agent picker to the default once the project agent is no longer resolvable', async () => { + vi.mocked(api.kirocrewAgents).mockResolvedValueOnce({ + agents: [{ + name: 'repo-bot', kiro_agent: 'repo-bot', workspace: 'repo', memory_store: 'repo', + description: 'repo agent', source: 'project', scope: 'project', + }], + default_agent: '', + }) + renderJobForm(withDefaultAgent) + + fireEvent.change(screen.getByLabelText('Project directory'), { + target: { value: '/Users/you/projects/myrepo' }, + }) + await waitFor(() => expect(api.kirocrewAgents).toHaveBeenCalled()) + + // Select the project-only agent via the AgentSelector's listbox. Wait + // for the roster to have propagated through useQuery (an extra render + // hop past the raw fetch call above) before clicking the option -- a + // bare `getByRole` can race that hop and see an empty listbox. + fireEvent.click(screen.getByLabelText('Switch agent')) + await waitFor(() => expect(screen.getByRole('option', { name: /repo-bot/ })).toBeInTheDocument()) + fireEvent.click(screen.getByRole('option', { name: /repo-bot/ })) + await waitFor(() => expect(screen.getByLabelText('Switch agent')).toHaveTextContent('repo-bot')) + + // Now clear the project directory -- the project-only agent must no + // longer be shown as selected. + fireEvent.change(screen.getByLabelText('Project directory'), { target: { value: '' } }) + + await waitFor(() => + expect(screen.getByLabelText('Switch agent')).toHaveTextContent('default'), + ) + expect(screen.getByLabelText('Switch agent')).not.toHaveTextContent('repo-bot') + const note = screen.getByTestId('jobform-agent-reset-note') + expect(note).toHaveTextContent('repo-bot') + expect(note).toHaveTextContent('project directory was cleared') + expect(note).not.toHaveTextContent("isn't defined in this project") + }) + + it('leaves a global agent selection untouched when the project directory clears', async () => { + // A global agent that happens to be selected must survive the folder + // clearing -- this gate only targets names the global roster does not + // recognize. + renderJobForm({ agents: [builtInAgent, eaDevAgent], defaultAgent: 'default' }) + + fireEvent.click(screen.getByLabelText('Switch agent')) + fireEvent.click(screen.getByRole('option', { name: /ea-dev/ })) + await waitFor(() => expect(screen.getByLabelText('Switch agent')).toHaveTextContent('ea-dev')) + + fireEvent.change(screen.getByLabelText('Project directory'), { + target: { value: '/Users/you/projects/myrepo' }, + }) + await waitFor(() => expect(api.kirocrewAgents).toHaveBeenCalled()) + fireEvent.change(screen.getByLabelText('Project directory'), { target: { value: '' } }) + + expect(screen.getByLabelText('Switch agent')).toHaveTextContent('ea-dev') + }) + + it('keeps a global roster row selected when the global catalog failed and the directory clears', async () => { + vi.mocked(api.kirocrewAgents).mockResolvedValueOnce({ + agents: [{ + name: 'ea-dev', kiro_agent: 'ea-dev', workspace: 'ea', memory_store: 'ea', + description: 'global agent', source: 'kirocrew', scope: 'global', + }], + default_agent: '', + }) + renderJobForm() + + fireEvent.change(screen.getByLabelText('Project directory'), { + target: { value: '/Users/you/projects/myrepo' }, + }) + await waitFor(() => expect(api.kirocrewAgents).toHaveBeenCalled()) + fireEvent.click(screen.getByLabelText('Switch agent')) + await waitFor(() => expect(screen.getByRole('option', { name: /ea-dev/ })).toBeInTheDocument()) + fireEvent.click(screen.getByRole('option', { name: /ea-dev/ })) + await waitFor(() => expect(screen.getByLabelText('Switch agent')).toHaveTextContent('ea-dev')) + + fireEvent.change(screen.getByLabelText('Project directory'), { target: { value: '' } }) + + await waitFor(() => expect(screen.getByLabelText('Switch agent')).toHaveTextContent('ea-dev')) + expect(screen.queryByTestId('jobform-agent-reset-note')).not.toBeInTheDocument() + }) + + it('does not clear an existing job binding when the global roster is empty or still loading', async () => { + // Opus 4.8 finding: `!projectPath` runs on EVERY mount (every existing + // job has an empty project_path by default), and `agents.some(...)` on + // an empty/not-yet-loaded roster is always false for ANY saved agent + // name -- without the `agents.length > 0` guard, opening ANY existing + // message job while the roster fetch failed or is still in flight would + // silently clear its persisted agent binding, and a later save would + // overwrite it with the default even though the user changed nothing. + renderJobForm({ job: messageJob({ agent: 'ea-dev' }) }) + + // The job's saved agent must still be shown as selected -- not reset to + // the (also empty) default just because the roster hasn't loaded. + expect(screen.getByLabelText('Switch agent')).toHaveTextContent('ea-dev') + }) + + it('clears a project agent on a project-only install, where the global roster is legitimately empty', async () => { + // GPT 5.6 Review F2. The guard that fixed the test above tested the + // WRONG thing: it asked "is the global roster non-empty?" as a proxy for + // "has the roster loaded?". Those diverge on an install whose agents are + // all project-scoped -- the roster IS loaded and IS legitimately empty -- + // so the clear was skipped, the unresolvable name was saved with an empty + // project_path, and every fire silently ran the default agent instead. + // + // The fix decides on positive knowledge: the name came from + // `projectAgents`, so we KNOW it was the folder's. That also cannot + // misfire on a crew-bound form (`CrewWakeSection` passes `agents={[]}`) + // or on an app agent under `~/.kiro/agents/`, neither of which is ever + // in the folder's roster. + vi.mocked(api.kirocrewAgents).mockResolvedValueOnce({ + agents: [{ + name: 'repo-bot', kiro_agent: 'repo-bot', workspace: 'repo', memory_store: 'repo', + description: 'repo agent', source: 'project', scope: 'project', + }], + default_agent: '', + }) + renderJobForm() + + fireEvent.change(screen.getByLabelText('Project directory'), { + target: { value: '/Users/you/projects/myrepo' }, + }) + await waitFor(() => expect(api.kirocrewAgents).toHaveBeenCalled()) + + fireEvent.click(screen.getByLabelText('Switch agent')) + await waitFor(() => expect(screen.getByRole('option', { name: /repo-bot/ })).toBeInTheDocument()) + fireEvent.click(screen.getByRole('option', { name: /repo-bot/ })) + await waitFor(() => expect(screen.getByLabelText('Switch agent')).toHaveTextContent('repo-bot')) + + fireEvent.change(screen.getByLabelText('Project directory'), { target: { value: '' } }) + + // The project agent must be gone even though the global roster is empty. + await waitFor(() => + expect(screen.getByLabelText('Switch agent')).not.toHaveTextContent('repo-bot'), + ) + }) + + it('keeps the reset notice readable after the debounce settles, not just for 250ms', async () => { + // The notice appeared and then VANISHED. Clearing the field fires the + // effect TWICE: once when `projectPath` empties, then again when + // `debouncedProjectPath` (250ms) settles and `enabled: !!debouncedProjectPath` + // turns the roster query off, moving `projectAgentsData` to `undefined` -- + // a dependency change. That second run saw the agent the first run had + // already cleared, so `cleared` computed false and it wrote + // `setAgentResetFrom('')`, erasing its own acknowledgment. + // + // Every assertion in this file still passed, because they all read the + // notice SYNCHRONOUSLY inside that window. A browser probe showed it + // present at 200ms and gone at 400ms, so the acknowledgment UX Review + // asked for was unreadable in practice. This test reads it after the + // debounce, which is when a human would. + vi.mocked(api.kirocrewAgents).mockResolvedValueOnce({ + agents: [{ + name: 'repo-bot', kiro_agent: 'repo-bot', workspace: 'repo', memory_store: 'repo', + description: 'repo agent', source: 'project', scope: 'project', + }], + default_agent: '', + }) + renderJobForm(withDefaultAgent) + + fireEvent.change(screen.getByLabelText('Project directory'), { + target: { value: '/Users/you/projects/myrepo' }, + }) + await waitFor(() => expect(api.kirocrewAgents).toHaveBeenCalled()) + fireEvent.click(screen.getByLabelText('Switch agent')) + await waitFor(() => expect(screen.getByRole('option', { name: /repo-bot/ })).toBeInTheDocument()) + fireEvent.click(screen.getByRole('option', { name: /repo-bot/ })) + await waitFor(() => expect(screen.getByLabelText('Switch agent')).toHaveTextContent('repo-bot')) + + vi.useFakeTimers() + fireEvent.change(screen.getByLabelText('Project directory'), { target: { value: '' } }) + expect(screen.getByTestId('jobform-agent-reset-note')).toBeInTheDocument() + + // Settle the 250ms debounce and flush the query-disabling re-render. + await act(async () => { await vi.advanceTimersByTimeAsync(250) }) + + const note = screen.getByTestId('jobform-agent-reset-note') + expect(note).toHaveTextContent('repo-bot') + expect(note).toHaveTextContent('project directory was cleared') + }) + + it('announces a SECOND clear too, rather than staying silent after the first', async () => { + // The guard that fixed the test above is armed per empty field, so a bound + // path has to re-arm it. Without that, the effect would suppress every + // later reset for the lifetime of the form: the user binds another folder, + // picks another project agent, clears again -- and that pick would vanish + // with no acknowledgment at all, which is the exact silent-reset defect the + // notice exists to prevent. + vi.mocked(api.kirocrewAgents).mockResolvedValue({ + agents: [{ + name: 'repo-bot', kiro_agent: 'repo-bot', workspace: 'repo', memory_store: 'repo', + description: 'repo agent', source: 'project', scope: 'project', + }], + default_agent: '', + }) + renderJobForm(withDefaultAgent) + const field = screen.getByLabelText('Project directory') + + for (const round of [1, 2]) { + fireEvent.change(field, { target: { value: `/Users/you/projects/repo-${round}` } }) + fireEvent.click(screen.getByLabelText('Switch agent')) + await waitFor(() => expect(screen.getByRole('option', { name: /repo-bot/ })).toBeInTheDocument()) + fireEvent.click(screen.getByRole('option', { name: /repo-bot/ })) + await waitFor(() => expect(screen.getByLabelText('Switch agent')).toHaveTextContent('repo-bot')) + + vi.useFakeTimers() + fireEvent.change(field, { target: { value: '' } }) + expect(screen.getByTestId('jobform-agent-reset-note')).toHaveTextContent('repo-bot') + await act(async () => { await vi.advanceTimersByTimeAsync(250) }) + expect(screen.getByTestId('jobform-agent-reset-note')).toHaveTextContent( + 'project directory was cleared', + ) + vi.useRealTimers() + } + }) + + /** + * The notice reports that the system discarded an agent the reader chose + * deliberately. Rendered as a bare styled it is invisible to + * assistive tech, so a screen-reader user clears the directory, hears + * nothing, and only discovers the substitution when a different agent + * runs -- the exact silent substitution this notice exists against. Its + * sibling `chat_folder_was_deleted` notice in the same file already + * carries `role="status"` with a comment requiring it be "announced as a + * status", so this asserts the parity rather than the attribute: the note + * must be reachable BY ROLE, which is what an AT user actually depends on. + */ + it('announces the reset to assistive tech, not only to sighted readers', async () => { + vi.mocked(api.kirocrewAgents).mockResolvedValueOnce({ + agents: [{ + name: 'repo-bot', kiro_agent: 'repo-bot', workspace: 'repo', memory_store: 'repo', + description: 'repo agent', source: 'project', scope: 'project', + }], + default_agent: '', + }) + renderJobForm(withDefaultAgent) + const field = screen.getByLabelText('Project directory') + fireEvent.change(field, { target: { value: '/Users/you/projects/repo' } }) + fireEvent.click(screen.getByLabelText('Switch agent')) + await waitFor(() => expect(screen.getByRole('option', { name: /repo-bot/ })).toBeInTheDocument()) + fireEvent.click(screen.getByRole('option', { name: /repo-bot/ })) + await waitFor(() => expect(screen.getByLabelText('Switch agent')).toHaveTextContent('repo-bot')) + + fireEvent.change(field, { target: { value: '' } }) + const note = await waitFor( + () => { + const found = screen.getByTestId('jobform-agent-reset-note') + expect(found).toHaveTextContent('repo-bot') + return found + }, + { timeout: 2000 }, + ) + // Reachable by role is the assertion that matters -- a reader on + // assistive tech finds it this way or not at all. + expect(note).toBe(screen.getByRole('status', { name: '' })) + }) +}) + +/** + * The project-scoped roster fetch (`api.kirocrewAgents` keyed by working + * directory) had its `.catch()` write into the SAME `error` state as + * Save-time field validation. Two real bugs from that: (1) `setError` also + * auto-scrolls the page to the bottom-of-form notice on every set, so a + * background fetch failing mid-typing would yank the user's scroll position + * for a failure unrelated to what they were doing; (2) the two failure kinds + * share one string with no independent clear, so a stale roster error could + * survive an otherwise-successful save (only the Save handler's own + * `setError('')` clears it) or a validation error could be silently + * clobbered by a late-resolving roster retry. Fixed by giving the roster + * fetch its own state, rendered beside the project-directory field via the + * same `ErrorNotice` component the sibling `AgentSelector` roster-failure UI + * already uses, instead of the form-wide notice. + */ +describe('JobForm project roster fetch failure stays out of the form-wide error', () => { + it('shows the roster failure beside the project-directory field, not in the form-wide notice', async () => { + vi.mocked(api.kirocrewAgents).mockRejectedValueOnce(new Error('network unreachable')) + renderJobForm() + + fireEvent.change(screen.getByLabelText('Project directory'), { + target: { value: '/Users/you/projects/myrepo' }, + }) + + await waitFor(() => + expect(screen.getByTestId('jobform-project-roster-error')).toHaveTextContent('network unreachable'), + ) + // The form-wide notice (Save-time validation, no testId) must stay + // absent -- a background roster failure is not a reason to show it or + // scroll the page. Several notices in this form share `role="alert"`, so a + // bare `queryByRole` would match one of the tagged ones; the form-wide + // notice is the one carrying no `data-testid`, so assert on its absence + // rather than on a total alert count, which any new tagged sibling breaks. + const formWide = screen + .queryAllByRole('alert') + .filter(el => !el.getAttribute('data-testid')) + expect(formWide).toHaveLength(0) + }) + + it('keeps the roster failure visible after an unrelated successful save -- it describes the folder, not the save outcome', async () => { + vi.mocked(api.kirocrewAgents).mockRejectedValueOnce(new Error('network unreachable')) + vi.mocked(api.updateCron).mockResolvedValue({ ok: true }) + const onSaved = vi.fn() + renderJobForm({ onSaved }) + + fireEvent.change(screen.getByLabelText('Project directory'), { + target: { value: '/Users/you/projects/myrepo' }, + }) + await waitFor(() => expect(screen.getByTestId('jobform-project-roster-error')).toBeInTheDocument()) + + fireEvent.click(screen.getByRole('button', { name: 'Save' })) + await waitFor(() => expect(onSaved).toHaveBeenCalledTimes(1)) + // A prior implementation shared one `error` string between the roster + // fetch and Save-time validation, whose only clear point was the Save + // handler's own `setError('')` -- so a successful save happened to also + // wipe the (unrelated) roster message as a side effect, and the reverse + // held too: a real validation error could be clobbered by a late roster + // retry. The roster notice is now independent state describing the + // CURRENT folder, so it is unaffected by an unrelated save outcome -- + // it still needs its own retry/folder-change to clear, checked below. + expect(screen.getByTestId('jobform-project-roster-error')).toBeInTheDocument() + }) + + it('clears the roster failure when the folder is changed to one that resolves', async () => { + vi.mocked(api.kirocrewAgents) + .mockRejectedValueOnce(new Error('network unreachable')) + .mockResolvedValueOnce({ agents: [], default_agent: '' }) + renderJobForm() + + const input = screen.getByLabelText('Project directory') + fireEvent.change(input, { target: { value: '/Users/you/projects/myrepo' } }) + await waitFor(() => expect(screen.getByTestId('jobform-project-roster-error')).toBeInTheDocument()) + + fireEvent.change(input, { target: { value: '/Users/you/projects/other' } }) + await waitFor(() => + expect(screen.queryByTestId('jobform-project-roster-error')).not.toBeInTheDocument(), + ) + }) + + it('drops the detail clause when the error carries no prose message', async () => { + // UX Review: `friendlyErrText` unwraps error/detail/message when present and + // otherwise hands back the RAW body, so a response with no message field (a + // bare `{}`) was interpolated straight into the sentence and rendered + // "Couldn't load this project's agents: {}." Bare punctuation is worse than + // no clause, so the non-prose shapes take the detail-less sentence instead. + vi.mocked(api.kirocrewAgents).mockRejectedValue(new Error('{}')) + renderJobForm() + + const input = screen.getByLabelText('Project directory') + fireEvent.change(input, { target: { value: '/Users/you/projects/myrepo' } }) + + const notice = await screen.findByTestId('jobform-project-roster-error') + expect(notice.textContent).not.toContain('{}') + expect(notice.textContent).not.toContain('agents: .') + // The two facts still both land: what failed, and what it fell back to. + expect(notice.textContent).toContain("Couldn't load this project's agents.") + expect(notice.textContent).toContain('Showing the global agent list instead.') + }) + + it('keeps the detail clause when the error IS prose', async () => { + vi.mocked(api.kirocrewAgents).mockRejectedValue(new Error('network unreachable')) + renderJobForm() + + const input = screen.getByLabelText('Project directory') + fireEvent.change(input, { target: { value: '/Users/you/projects/myrepo' } }) + + const notice = await screen.findByTestId('jobform-project-roster-error') + expect(notice.textContent).toContain('network unreachable') + }) + + it('offers a retry in place and clears the failure on a successful refetch', async () => { + // The failure "need[s] different next actions (retry vs. pick a different + // folder)" -- before this it offered only the latter (re-type the path to + // re-key the query). Now a retry sits beside the notice, the same shape as + // the chat-folder and agent-roster retries (UX Review span=6409bbff1088). + vi.mocked(api.kirocrewAgents) + .mockRejectedValueOnce(new Error('network unreachable')) + .mockResolvedValueOnce({ agents: [], default_agent: '' }) + renderJobForm() + + fireEvent.change(screen.getByLabelText('Project directory'), { + target: { value: '/Users/you/projects/myrepo' }, + }) + await waitFor(() => expect(screen.getByTestId('jobform-project-roster-error')).toBeInTheDocument()) + + // Re-key by re-typing was the ONLY recovery before; the button is the fix. + const before = vi.mocked(api.kirocrewAgents).mock.calls.length + fireEvent.click(screen.getByRole('button', { name: 'Retry' })) + + await waitFor(() => + expect(screen.queryByTestId('jobform-project-roster-error')).not.toBeInTheDocument(), + ) + // The retry refetched the same query in place rather than asking the user + // to change the folder: at least one more fetch, no folder change. + expect(vi.mocked(api.kirocrewAgents).mock.calls.length).toBeGreaterThan(before) + }) +}) + +const collisionGlobalRoster: KiroCrewAgent[] = [ + { + name: 'default', kiro_agent: 'default', workspace: 'default', memory_store: 'default', + description: 'built-in', source: 'kirocrew', scope: 'global', + }, + { + name: 'reviewer', kiro_agent: 'reviewer-tpl', workspace: 'ws', memory_store: 'reviewer-kb', + description: 'the configured reviewer', source: 'package', scope: 'global', + }, +] + +/** + * The folder declares its OWN `reviewer` -- the collision under test. + * + * Shaped as `GET /api/agents?project_path=` actually answers, which matters in + * three ways a hand-made fixture gets wrong: + * + * - It is the WHOLE roster, not the folder's half: the configured agents are + * in it too. A fixture holding only project rows hides the bug where every + * configured agent gets marked as overridden. + * - The shadowed `reviewer` global row is ABSENT -- the backend suppresses the + * losing side rather than sending both. + * - A project row carries `source: 'kirocrew'` and an EMPTY description. Every + * project row is one shared default record under a project tag, because + * `project_agent_names` returns names only; there is no per-agent config on + * disk to read without a second scan. So `scope` is the only field that says + * "project", and a test may not identify a project row by a description the + * backend never populates. + */ +const collisionProjectRoster = { + agents: [ + { + name: 'default', kiro_agent: 'default', workspace: 'default', memory_store: 'default', + description: 'built-in', source: 'kirocrew', scope: 'global', + }, + { + name: 'reviewer', kiro_agent: '', workspace: 'default', memory_store: 'default', + description: '', source: 'kirocrew', scope: 'project', + }, + { + name: 'repo-bot', kiro_agent: '', workspace: 'default', memory_store: 'default', + description: '', source: 'kirocrew', scope: 'project', + }, + ], + default_agent: 'default', +} + +async function openWithCollisionFolder(): Promise { + vi.mocked(api.kirocrewAgents).mockResolvedValueOnce(collisionProjectRoster) + renderJobForm({ agents: collisionGlobalRoster, defaultAgent: 'default' }) + fireEvent.change(screen.getByLabelText('Project directory'), { + target: { value: '/Users/you/projects/myrepo' }, + }) + await waitFor(() => expect(api.kirocrewAgents).toHaveBeenCalled()) + fireEvent.click(screen.getByLabelText('Switch agent')) + // The roster arrives one render hop past the fetch call, so wait for a + // project-only row rather than reading the listbox immediately. + await waitFor(() => expect(screen.getByRole('option', { name: /repo-bot/ })).toBeInTheDocument()) + return screen.getByRole('listbox') +} + +/** + * Inside a bound folder a project definition outranks a same-named configured + * agent, so the picker must offer the PROJECT row: it is the one the fire + * resolves. Keeping the global row instead advertised an agent that could not + * answer -- the form named the configured agent while dispatch ran the project + * file, the advertised-vs-answering mismatch `resolved_alias` exists to + * prevent. + * + * One row per name, because `agent` is a bare string and could not record + * which of two same-named rows was chosen. The surviving row therefore states + * the override outright: "this is a project agent" and "this project agent took + * over a configured agent's name" are different facts, and only the second + * explains why the configured one is no longer listed. + */ +describe('JobForm agent picker on a project/global name collision', () => { + it('offers the project agent, not the same-named configured one', async () => { + const listbox = await openWithCollisionFolder() + const options = within(listbox).getAllByRole('option').map(o => o.textContent || '') + + // One row for the colliding name, not two: a second row would be an option + // the form cannot persist. + expect(options.filter(t => t.includes('reviewer'))).toHaveLength(1) + + // And it is the PROJECT one. Identified by the override marker plus the + // ABSENCE of the configured agent's description: a project row carries no + // description of its own, so there is no positive text to match on -- which + // is exactly why the marker has to exist. + const row = within(listbox).getByRole('option', { name: /reviewer/ }) + expect(row).toHaveTextContent('overrides global') + expect(row).not.toHaveTextContent('the configured reviewer') + + // Non-colliding rows from both sides survive untouched. + expect(options.some(t => t.includes('repo-bot'))).toBe(true) + expect(options.some(t => t.includes('default'))).toBe(true) + }) + + it('does not mark a configured agent the folder never declared', async () => { + // The project-scoped response carries the configured agents as well as the + // folder's, so a name-only match marks EVERY configured agent as overridden + // the moment a folder is bound. `default` is in both rosters and is not + // declared by the folder, so it must stay unmarked. + const listbox = await openWithCollisionFolder() + const untouched = within(listbox).getByRole('option', { name: /default/ }) + expect(untouched).not.toHaveTextContent('overrides global') + }) + + it('marks the surviving row as overriding the configured agent', async () => { + const listbox = await openWithCollisionFolder() + const row = within(listbox).getByRole('option', { name: /reviewer/ }) + expect(row).toHaveTextContent('overrides global') + + // The explanation is VISIBLE, not hover-only. The badge's `title` needs a + // mouse resting on a 10px chip and does not exist on touch at all, and this + // marker is the only signal in the feature that tells a user why their + // configured agent vanished from the list. It no longer REPEATS the agent + // name — the row title directly above already shows it, and repeating it + // pushed the meaning past this line's own truncation on a narrow popover + // (UX Review span=7ddb24260c79). + expect(row).toHaveTextContent( + "This job's project directory defines its own agent with this name, so it runs " + + 'instead of your global one. Your global agent is unchanged elsewhere.', + ) + + // The marker is specific to the collision, not to being a project agent: + // a project-only row has nothing to override and must not claim otherwise. + const projectOnly = within(listbox).getByRole('option', { name: /repo-bot/ }) + expect(projectOnly).not.toHaveTextContent('overrides global') + expect(projectOnly).not.toHaveTextContent('Runs instead of') + }) + + it('drops the marker when the project directory is cleared', async () => { + const listbox = await openWithCollisionFolder() + expect(within(listbox).getByRole('option', { name: /reviewer/ })).toHaveTextContent('overrides global') + + fireEvent.keyDown(listbox, { key: 'Escape' }) + fireEvent.change(screen.getByLabelText('Project directory'), { target: { value: '' } }) + + fireEvent.click(screen.getByLabelText('Switch agent')) + await waitFor(() => { + const reopened = screen.getByRole('listbox') + expect(within(reopened).queryByText('overrides global')).not.toBeInTheDocument() + }) + // With no folder there is no project scope, so the configured agent is the + // one offered again. + const reopened = screen.getByRole('listbox') + expect(within(reopened).getByRole('option', { name: /reviewer/ })).toHaveTextContent('the configured reviewer') + }) +}) diff --git a/website/src/test/JobForm.saveAndBinding.test.tsx b/website/src/test/JobForm.saveAndBinding.test.tsx new file mode 100644 index 000000000000..a634d78237d6 --- /dev/null +++ b/website/src/test/JobForm.saveAndBinding.test.tsx @@ -0,0 +1,198 @@ +import { describe, it, expect, vi } from 'vitest' +import { screen, fireEvent, waitFor } from '@testing-library/react' +import { renderWithProviders } from './helpers' +import JobForm, { buildBody, parseJobDefaults } from '../components/JobForm' +import type { CronJob } from '../types' +import { api } from '../api/client' + +vi.mock('../api/client', () => ({ + api: { + updateCron: vi.fn(), + createCron: vi.fn(), + models: vi.fn().mockResolvedValue({ models: [] }), + kirocrewAgents: vi.fn().mockResolvedValue({ agents: [], default_agent: '' }), + agentCatalog: vi.fn().mockResolvedValue({ agents: [], default_agent: '' }), + chatFolders: vi.fn().mockResolvedValue([]), + }, +})) + +function messageJob(overrides: Partial = {}): CronJob { + return { + id: 'j1', name: 'nightly', message: 'do the thing', schedule: '', enabled: true, + cron_expr: '0 3 * * *', ...overrides, + } as CronJob +} + +/** + * The project-directory placeholder in a mono input read as a FILLED value and + * was macOS-specific. Prefixing with "e.g. " marks it as an example (UX Review + * span=435d37ba26ce). Pinned so the "e.g. " lead cannot be dropped silently. + */ +describe('JobForm project-directory placeholder is marked as an example', () => { + it('prefixes the example path with "e.g. "', () => { + renderWithProviders( + {}} layout="vertical" />, + ) + const input = screen.getByLabelText('Project directory') + expect(input.getAttribute('placeholder')).toMatch(/^e\.g\. /) + }) +}) + +/** The project binding is cleared for a job kind whose dispatch never reads it. + * + * `project_path` is rendered only under `!isLlmless`, and a script/command + * job's subprocess dispatch derives no cwd from it. Submitting it anyway on a + * conversion re-persists a folder the form no longer shows and the run never + * uses -- the same reason `chat_folder_id` is cleared there (Opus Review + * span=be4da06858f3), and the same way a setting starts lying. + */ +describe('project binding on a job kind that cannot use it', () => { + const makeBindingJob = (over: Partial = {}): CronJob => + ({ + id: 'pb1', name: 'bound', message: 'Write the brief.', schedule: '', enabled: true, + every_secs: 3600, ...over, + }) as CronJob + + it('clears project_path when a bound job is converted to a script job', () => { + const body = buildBody( + { ...parseJobDefaults(makeBindingJob({ script: 'a.py:run' })), projectPath: '/tmp/proj' }, + 'UTC', + () => {}, + true, + ) + expect(body?.project_path).toBe('') + }) + + it('still sends the folder for a message job, including the empty clear', () => { + const bound = buildBody( + { ...parseJobDefaults(undefined), name: 'n', message: 'm', projectPath: '/tmp/proj' }, + 'UTC', + () => {}, + ) + expect(bound?.project_path).toBe('/tmp/proj') + + // "" is the real value for "unbind", so it must still reach the backend + // rather than being dropped as falsy. + const cleared = buildBody( + { ...parseJobDefaults(makeBindingJob({ project_path: '/tmp/proj' })), projectPath: '' }, + 'UTC', + () => {}, + ) + expect(cleared?.project_path).toBe('') + }) +}) + +/** + * The form-wide Save notice, identified by carrying no `data-testid`. + * + * Several notices in this form share `role="alert"` -- the project-directory + * field error, the folder-order notice -- so a bare `getByRole('alert')` is + * ambiguous and a total alert count couples these tests to how many tagged + * siblings happen to render. Every tagged notice belongs to a specific field; + * the form-wide one is the only untagged alert, so selecting on that is what + * actually names the thing these tests are about. + */ +function formWideAlerts(): HTMLElement[] { + return screen.queryAllByRole('alert').filter(el => !el.getAttribute('data-testid')) +} + +/** + * `createCron` had its own `.catch((e: Error) => ({ error: e.message }))` + * from the start, but `updateCron` (the EDIT path) had none — so a rejected + * PATCH (e.g. the backend's `project_path` validation) skipped past the + * `if (res.error)` branch entirely and fell into the generic + * `catch { setError('Failed to save') }`, discarding the real backend + * message. Confirmed live: editing a job with an invalid project directory + * always showed "Failed to save" with no way to tell why. These pin BOTH + * halves of the fix — updateCron's own error surfaces at all, AND the + * project_path-specific messages get remapped to the UI's own field label + * rather than the raw backend field name. + */ +describe('cron JobForm surfaces the real update error (not "Failed to save")', () => { + it('shows updateCron\'s rejection message instead of the generic failed-to-save text', async () => { + vi.mocked(api.updateCron).mockRejectedValue(new Error('project_path must be an absolute path')) + renderWithProviders( + {}} layout="vertical" />, + ) + + fireEvent.click(screen.getByRole('button', { name: 'Save' })) + + await waitFor(() => { + expect(screen.getByTestId('jobform-project-path-save-error')).toHaveTextContent( + 'Project directory must be an absolute path (e.g. /Users/you/projects/myrepo).', + ) + }) + expect(screen.queryByText('Failed to save')).not.toBeInTheDocument() + // Beside the project-directory field it names, NOT the form-wide notice at + // the foot of the form the user must scroll to (UX Review span=d88c9e1f411b). + // The form-wide notice is the alert carrying no `data-testid`, so its + // absence is what this pins -- a total alert count would also fail for a + // tagged sibling notice that says nothing about where this error rendered. + expect(formWideAlerts()).toHaveLength(0) + expect(screen.getByTestId('jobform-project-path-save-error')).toHaveAttribute('role', 'alert') + }) + + it('remaps the "existing directory" rejection to the field label, with no backend field name in it', async () => { + vi.mocked(api.updateCron).mockRejectedValue( + new Error('project_path must be an existing directory'), + ) + renderWithProviders( + {}} layout="vertical" />, + ) + + fireEvent.click(screen.getByRole('button', { name: 'Save' })) + + await waitFor(() => { + expect(screen.getByTestId('jobform-project-path-save-error')).toHaveTextContent( + 'Project directory must be an existing directory.', + ) + }) + expect(screen.queryByText(/project_path/)).not.toBeInTheDocument() + }) + + it('remaps the sensitive-path rejection to the field label', async () => { + vi.mocked(api.updateCron).mockRejectedValue( + new Error('project_path refers to a sensitive path'), + ) + renderWithProviders( + {}} layout="vertical" />, + ) + + fireEvent.click(screen.getByRole('button', { name: 'Save' })) + + await waitFor(() => { + expect(screen.getByTestId('jobform-project-path-save-error')).toHaveTextContent( + "Project directory refers to a protected system path and can't be used.", + ) + }) + }) + + it('falls through to the raw message for a non-project_path rejection', async () => { + vi.mocked(api.updateCron).mockRejectedValue(new Error('Agent \'ea-dev\' not found')) + renderWithProviders( + {}} layout="vertical" />, + ) + + fireEvent.click(screen.getByRole('button', { name: 'Save' })) + + await waitFor(() => { + expect(formWideAlerts()[0]).toHaveTextContent("Agent 'ea-dev' not found") + }) + // A rejection that is NOT about the project directory stays form-wide; it + // is not pinned to that one field. + expect(screen.queryByTestId('jobform-project-path-save-error')).not.toBeInTheDocument() + }) + + it('still saves successfully when updateCron resolves', async () => { + vi.mocked(api.updateCron).mockResolvedValue({ ok: true }) + const onSaved = vi.fn() + renderWithProviders( + , + ) + + fireEvent.click(screen.getByRole('button', { name: 'Save' })) + + await waitFor(() => expect(onSaved).toHaveBeenCalledTimes(1)) + expect(formWideAlerts()).toHaveLength(0) + }) +}) diff --git a/website/src/test/JobForm.scriptCommand.test.tsx b/website/src/test/JobForm.scriptCommand.test.tsx index 40e84a24b0cd..0a3e064764f0 100644 --- a/website/src/test/JobForm.scriptCommand.test.tsx +++ b/website/src/test/JobForm.scriptCommand.test.tsx @@ -103,6 +103,11 @@ describe('JobForm script/command edit path', () => { expect(screen.getByText('Script')).toBeInTheDocument() expect(screen.queryByText('Agent')).not.toBeInTheDocument() expect(screen.queryByText('Approval')).not.toBeInTheDocument() + // Project directory is an agent/message concept -- a script job's fire-time + // dispatch in cron.py never reads project_path, so the field (and its + // agent-specific help text) must not render for this job kind either. + expect(screen.queryByText('Project directory')).not.toBeInTheDocument() + expect(screen.queryByLabelText('Project directory')).not.toBeInTheDocument() // Channel still available for all kinds expect(screen.getByText('Channel ID')).toBeInTheDocument() }) @@ -119,5 +124,10 @@ describe('JobForm script/command edit path', () => { ) expect(screen.getByText('Agent')).toBeInTheDocument() expect(screen.getByText('Approval')).toBeInTheDocument() + // An agent/message job's fire-time path DOES read project_path (the + // single-agent and sequential cron paths in gateway.py), so the working + // directory field must render for this job kind. + expect(screen.getByText('Project directory')).toBeInTheDocument() + expect(screen.getByLabelText('Project directory')).toBeInTheDocument() }) }) diff --git a/website/src/test/SchedulePage.lastErrorVisibility.test.tsx b/website/src/test/SchedulePage.lastErrorVisibility.test.tsx new file mode 100644 index 000000000000..9d112f189307 --- /dev/null +++ b/website/src/test/SchedulePage.lastErrorVisibility.test.tsx @@ -0,0 +1,116 @@ +import { describe, it, expect, vi, beforeEach } from 'vitest' +import { screen, waitFor, fireEvent } from '@testing-library/react' +import { renderWithProviders } from './helpers' +import SchedulePage from '../pages/SchedulePage' +import type { CronJob } from '../types' + +/** + * UX Review: the Last Error panel was gated on `job.script`, so a MESSAGE job's + * `last_error` rendered only as the status cell's `title` attribute -- a hover + * tooltip, which is no signal at all in the desktop app. + * + * That field is exactly where a project-bound job's skip reason lands (an agent + * that no longer resolves, a bound directory that vanished, a project file + * shadowing a Crew Member), and those skips deliberately spend no auto-pause + * strike, so nothing else escalates -- the text IS the whole signal. These pin + * that it is rendered, for a message job as well as a script one. + */ + +const mkJob = (overrides: Partial = {}): CronJob => + ({ + id: 'job-1', + name: 'Nightly report', + schedule: 'every 1d', + message: 'send report', + enabled: true, + ...overrides, + }) as CronJob + +vi.mock('../api/client', () => ({ + api: { + crons: vi.fn(), + cronFolders: vi.fn().mockResolvedValue([]), + deleteCron: vi.fn(), + batchDeleteCron: vi.fn(), + createCron: vi.fn().mockResolvedValue({}), + models: vi.fn().mockResolvedValue([]), + updateCron: vi.fn().mockResolvedValue({}), + toggleCron: vi.fn().mockResolvedValue({}), + runCron: vi.fn().mockResolvedValue({}), + cronToChat: vi.fn().mockResolvedValue({}), + cronHistoryAll: vi.fn().mockResolvedValue({ runs: [] }), + kirocrewAgents: vi.fn().mockResolvedValue({ agents: [], default_agent: '' }), + // `useAgents` calls `agentCatalog`, and the job form's folder picker calls + // `chatFolders`. Neither is this file's subject, but both run when the page + // renders -- an unstubbed `agentCatalog` throws "not a function" inside a + // passive effect, which fails every test in the file before its own + // assertion runs. + agentCatalog: vi.fn().mockResolvedValue({ agents: [], default_agent: '' }), + chatFolders: vi.fn().mockResolvedValue([]), + syncKirocrewAgents: vi.fn().mockResolvedValue({}), + defaultAgent: vi.fn().mockResolvedValue({ default_agent: '' }), + }, +})) + +const SKIP_REASON = + "This job is bound to a Crew Member, and its project directory defines an " + + "agent with the same name ('default'). The run was skipped instead of letting " + + "that agent run with the member's own memory. Rename the project's agent or " + + "unbind the member." + +describe('SchedulePage — Last Error visibility', () => { + beforeEach(() => { + vi.clearAllMocks() + }) + + it("renders a message job's skip reason as visible text, not only a tooltip", async () => { + const { api } = await import('../api/client') + vi.mocked(api).crons.mockResolvedValue({ + jobs: [mkJob({ last_status: 'error', last_error: SKIP_REASON })], + }) + + renderWithProviders() + fireEvent.click(await screen.findByText('Nightly report')) + + await waitFor(() => + expect(screen.getByTestId('schedule-job-last-error')).toBeInTheDocument(), + ) + // The remedy sentence itself must be on screen -- a panel that renders but + // truncates the reason away would leave the operator no better off. + expect(screen.getByTestId('schedule-job-last-error').textContent).toContain( + 'Rename the project', + ) + }) + + it('still renders a script job\'s captured output with log styling', async () => { + const { api } = await import('../api/client') + vi.mocked(api).crons.mockResolvedValue({ + jobs: [ + mkJob({ + script: '~/.kiro/crew/crons/x.py:run', + last_status: 'error', + last_error: 'Traceback\n line 2\nValueError', + }), + ], + }) + + renderWithProviders() + fireEvent.click(await screen.findByText('Nightly report')) + + const panel = await screen.findByTestId('schedule-job-last-error') + expect(panel.className).toContain('font-mono') + }) + + it('renders no Last Error panel when the job has no error', async () => { + const { api } = await import('../api/client') + vi.mocked(api).crons.mockResolvedValue({ jobs: [mkJob({ last_status: 'ok' })] }) + + renderWithProviders() + fireEvent.click(await screen.findByText('Nightly report')) + + // The drawer's own Last run row proves it opened, without matching the job + // name (which the drawer renders a second time). + await waitFor(() => expect(screen.getAllByText('Nightly report').length).toBeGreaterThan(1)) + expect(screen.queryByTestId('schedule-job-last-error')).toBeNull() + }) +}) diff --git a/website/src/types/index.ts b/website/src/types/index.ts index 052db1961900..ad21a1fa7e9c 100644 --- a/website/src/types/index.ts +++ b/website/src/types/index.ts @@ -442,6 +442,7 @@ export interface CronJob { /** IANA timezone the cron expression's hour/minute fields are stored in. * Absent / null for legacy jobs created without an explicit TZ — treat as UTC. */ timezone?: string | null + project_path?: string | null skip_dates?: string[] | null script?: string | null; command?: string | null; last_result?: string | null; last_error?: string | null is_running?: boolean; running_since?: number | null From 2422f206060541e08be362a9c4fe42b1d4db2387 Mon Sep 17 00:00:00 2001 From: Kyle Seaman Date: Wed, 7 Oct 2026 03:46:40 +0000 Subject: [PATCH 2/2] fix(website): keep agent picks on directory change and name the collision winner A directory change no longer rewrites the agent pick. The form's catalogs cannot tell whether a name resolves under a folder, so clearing on what they omit discarded valid bindings and Save then stored the default agent. Save's own resolver check already refuses an unresolvable agent with a 400 naming the agent and folder, and the form shows it. Removes the reset notice and its two catalog keys. The collision row now says which definition runs ("This job runs the from this project's .kiro/agents/, not your global one.") and its chip is warn-toned so it does not read as a source label. Join the schedule directory picker to a modal Radix Popover so pointer, focus and dismissal stay inside the dialog layer and keep its draft. Standalone picker callers keep their existing layer behavior. Co-authored-by: mbajaj92 --- .../modules/learn-cron-dashboard.md | 74 ++- website/src/components/AgentSelector.tsx | 26 +- website/src/components/JobForm.tsx | 252 +++------ website/src/components/ProjectPicker.tsx | 56 +- website/src/i18n/locales/bn.json | 21 +- website/src/i18n/locales/de.json | 21 +- website/src/i18n/locales/en-XA.json | 19 +- website/src/i18n/locales/en.json | 21 +- website/src/i18n/locales/es.json | 21 +- website/src/i18n/locales/fr.json | 21 +- website/src/i18n/locales/hi.json | 21 +- website/src/i18n/locales/it.json | 21 +- website/src/i18n/locales/ja.json | 21 +- website/src/i18n/locales/ko.json | 21 +- website/src/i18n/locales/pt.json | 21 +- website/src/i18n/locales/ru.json | 21 +- website/src/i18n/locales/zh-CN.json | 21 +- website/src/pages/SchedulePage.tsx | 2 +- .../AgentSelector.overrideDetail.test.tsx | 22 +- ...obForm.projectAgentOriginAndReset.test.tsx | 32 +- .../test/JobForm.projectAgentReset.test.tsx | 480 +++++++----------- .../JobForm.projectCatalogFailure.test.tsx | 112 ++++ .../src/test/JobForm.saveAndBinding.test.tsx | 58 +++ .../SchedulePage.lastErrorVisibility.test.tsx | 26 + 24 files changed, 704 insertions(+), 707 deletions(-) create mode 100644 website/src/test/JobForm.projectCatalogFailure.test.tsx diff --git a/docs/system-specs/modules/learn-cron-dashboard.md b/docs/system-specs/modules/learn-cron-dashboard.md index 7ee5eb1e62a8..7849e05378f2 100644 --- a/docs/system-specs/modules/learn-cron-dashboard.md +++ b/docs/system-specs/modules/learn-cron-dashboard.md @@ -929,51 +929,39 @@ join rows 1–2b's provenance gate. **The picker says which agents the folder supplied.** A project row carries `scope: "project"` from the roster endpoint, and `AgentSelector` renders a -`from this folder` marker off that field — NOT off `source`, which reads +`folder agent` marker off that field — NOT off `source`, which reads `kirocrew` on a project row exactly as it does on a configured one, so without this a folder-supplied agent was visually identical to a global one and nobody -could anticipate which picks vanish when the directory is cleared. The -`overrides global` chip covers only COLLIDING rows, a strict subset. - -**A reset selection is announced, not just performed.** When a directory change -clears an agent the new folder cannot resolve, the form names the cleared agent -beside the Agent field. The reset itself is correct — saving a name the folder -cannot resolve would fire the default agent silently — but doing it without -acknowledgment meant a deliberate pick disappeared between a keystroke and -Save. **The announcement has to OUTLIVE the roster settling, which is a -constraint on the effect rather than on the copy.** Emptying the field runs the -clear-on-unbind branch twice — once when `projectPath` empties, then again when -the 250ms-debounced mirror settles and `enabled: !!debouncedProjectPath` turns -the roster query off, moving `projectAgentsData` to `undefined` and so changing a -dependency. The second run sees the agent the first already cleared, computes -"nothing was cleared", and would write the reset name back to `''` — erasing its -own notice after ~250ms. The branch is therefore guarded to act on the TRANSITION -into the empty state (`unbindHandledRef`), re-armed by any bound path so a later -clear still announces itself. A test that reads the notice synchronously cannot -see this: it passes against the erasing version, which is why the regressions in -`website/src/test/JobForm.projectAgentReset.test.tsx` read it AFTER the -debounce. - -**A reset a path EDIT caused is undone when the finished path defines the name -again.** The debounce above only protects a path typed faster than 250ms; -hand-editing a bound job's directory pauses longer, so an intermediate path -becomes a roster identity of its own — and `GET /api/agents?project_path=` -answers an unusable path with HTTP 200 and the configured agents alone, so that -roster legitimately lacks the pick and the reconcile clears it. Clearing on what -is known is right; leaving it cleared once the FINISHED path loads a roster that -DOES define the name is not, and made every path edit on a bound job force a -re-pick. The reconcile therefore remembers the name it took away -(`editClearedAgentRef`) and restores it when a later settled roster resolves it -and the user has not chosen since — restoring needs no judgement about whether a -path was "half typed", a question the endpoint cannot answer anyway since an -unusable path and a usable one with no agents are the same 200. Two bounds keep -this from overriding an operator: a deliberate pick drops the remembered name -(`pickAgent`), and so does emptying the field, whose own clear is an ended -gesture with no later roster to land against and stands announced. While a -restore is pending the notice is WITHHELD from the `''` write rather than erased -— the reset it describes is still in force, and a further intermediate settle -erasing it is the same defect as the double-run above, leaving an operator whose -finished path never does define the name with no acknowledgment at all. +could tell which picks depend on the directory. The accent-toned `folder's version` +chip covers only COLLIDING rows, a strict subset, and its detail line names the +definition that runs and that picking it changes nothing saved: "This job runs the folder's {{name}}. Your saved one is unchanged." +The picker's copy avoids "project", "global" and `.kiro/agents/`: a first-time +reader of the UX lane's blind read did not know those terms. +Only the roster's `scope: "project"` rows join the catalog the form already +holds; its global half is consulted for one fact only, that the server dropped +an alias whose template the folder declares, and the form drops that catalog +member row too (`JobForm` `effectiveAgents`). + +**A directory change never rewrites the agent pick; Save decides.** Whether a +name resolves under a folder is answered by the resolver dispatch uses, and the +picker catalogs cannot stand in for it: the project roster endpoint omits +installed templates, and the global catalog omits runtime-owned templates the +backend still runs, so absence from either proves nothing. The form therefore +keeps the selected name across a directory switch, an emptied field and any +roster loading or failure gap, and sends it on Save. The save-time half of the +twice-checked rule (`_agent_unresolvable_response`) refuses a name the bound +folder cannot resolve with a 400 (`code: "unknown_agent"`) naming the agent and +folder, which the form shows under the Agent picker (the Schedule page's vertical layout; the compact row keeps it form-wide) with "Pick an agent from this folder." when a directory is set, cleared by the next pick; every fire re-checks it. A form-side guess that +cleared picks on catalog absence discarded valid bindings and then saved the +default agent in their place, which is the silent substitution this feature +exists to prevent. + +**The directory picker joins the schedule dialog's modal layer.** In this form +it uses a modal Radix Popover, with a viewport-positioned portal outside the +translated dialog content. Pointer input, focus and dismissal belong to the +picker while it is open: a directory icon or row can be selected even where it +extends beyond the dialog, without closing the dialog or discarding its draft. +Standalone and non-Radix-modal ProjectPicker callers retain their own layer. **Session reuse tracks which definition won.** A persistent job reuses its session, so `_cron_session_binding` records the resolved identity — the folder, diff --git a/website/src/components/AgentSelector.tsx b/website/src/components/AgentSelector.tsx index aeeae12993b6..e1029f5d62cd 100644 --- a/website/src/components/AgentSelector.tsx +++ b/website/src/components/AgentSelector.tsx @@ -326,8 +326,13 @@ export default function AgentSelector({ agents, defaultAgent, value, onChange, m {i18nT('components.agentSelector.project_agent')} )} + {/* Accent-toned: distinct from the muted source pills, which a + blind reader took for one more origin label like `kirocrew`, + but not warning-toned, which read as "picking this overwrites + my saved agent". Picking it only chooses which definition this + one job runs (UX Review). */} {shadowedGlobals?.has(a.name) && ( - + {i18nT('components.agentSelector.overrides_global')} )} @@ -342,14 +347,15 @@ export default function AgentSelector({ agents, defaultAgent, value, onChange, m row has no description of its own and would otherwise repeat the template name the row already resolves to. - It does NOT lead with the agent name (UX Review - span=7ddb24260c79): the row title directly above already - shows it, so repeating it here only pushed the meaning - ("…instead of your global agent") past this line's own - `truncate`, leaving "…of this n…" on a narrow popover. The - name lives in the title — which, since the redundant - project chip is now suppressed on a shadowed row, has the - width to show it. */} + It names the winner -- this folder's agent, not the user's + saved one -- because a line that only said a project agent + "runs instead" left a blind reader unsure which same-named + definition the job would get (UX Review). It says "folder" + and "saved" rather than "project", "global" or the + `.kiro/agents/` path, which a later blind reader did not + understand (UX Review). The name sits mid-sentence rather + than leading it: the row title directly above already shows + it, and this line wraps rather than truncating. */} {/* A shadowed row renders the FULL hint as body text and is allowed to wrap, where every other row truncates. Two reasons it earns the extra line: the explanation is the @@ -366,7 +372,7 @@ export default function AgentSelector({ agents, defaultAgent, value, onChange, m } > {shadowedGlobals?.has(a.name) - ? i18nT('components.agentSelector.overrides_global_hint') + ? i18nT('components.agentSelector.overrides_global_hint', { name: a.name }) : a.description || provider.resolveAgentTemplate(a)} diff --git a/website/src/components/JobForm.tsx b/website/src/components/JobForm.tsx index 9eb1b3206ee4..91aec0a00624 100644 --- a/website/src/components/JobForm.tsx +++ b/website/src/components/JobForm.tsx @@ -155,6 +155,19 @@ function isProjectPathError(raw: string): boolean { || raw.includes('project_path must be an existing directory') } +/** The `code` field of a JSON error body, or `''`. A save refusal carries one + * (`unknown_agent`) so the form can route it to the field it names without + * matching on the human sentence. */ +function responseCode(body: string): string { + try { + const parsed: unknown = JSON.parse(body) + if (parsed && typeof parsed === 'object' && typeof (parsed as { code?: unknown }).code === 'string') { + return (parsed as { code: string }).code + } + } catch { /* not JSON: no code */ } + return '' +} + /** Build the API body from form state. Returns null if validation fails (sets error). */ function buildBody( f: ReturnType, @@ -379,15 +392,6 @@ export default function JobForm({ job, prefill, agents, defaultAgent, rosterFail // JobForm's roster work even for the common case of no project_path set. // This only does anything once a path is actually present. const [projectAgents, setProjectAgents] = useState([]) - // Mirror of `projectAgents` for the clear-on-unbind effect below. That effect - // must know which names the FOLDER contributed, but it cannot depend on the - // state: its `!projectPath` branch calls `setProjectAgents([])` with a fresh - // array every run, so listing `projectAgents` as a dependency would re-fire - // it forever. A ref is never stale and needs no dependency entry. - const projectAgentsRef = useRef([]) - useEffect(() => { - projectAgentsRef.current = projectAgents - }, [projectAgents]) // Separate from the form-wide `error` (validation failures on Save): a // background roster fetch failing must not borrow that channel, which // (1) auto-scrolls the page to the bottom-of-form notice on every set, @@ -398,50 +402,13 @@ export default function JobForm({ job, prefill, agents, defaultAgent, rosterFail // or a validation error can be silently clobbered by a late-resolving // roster retry. Rendered beside the working-directory field itself instead. const [projectRosterError, setProjectRosterError] = useState('') - // The agent name a project-directory change cleared, or '' when nothing was - // cleared. Its own state rather than a flag on the roster error: a reset is not - // a failure, and folding the two would make one clear the other. The reason - // selects clear-specific wording while keeping one notice mechanism. - const [agentResetFrom, setAgentResetFrom] = useState('') - const [agentResetReason, setAgentResetReason] = useState<'project-cleared' | 'not-in-project'>('not-in-project') - // Whether the clear-on-unbind branch has already run for the CURRENT empty - // field. It must act on the TRANSITION into the empty state, not on every - // re-run: clearing the field fires the effect twice -- once when - // `projectPath` empties, then again when `debouncedProjectPath` settles and - // `enabled: !!debouncedProjectPath` turns the roster query off, which moves - // `projectAgentsData` to `undefined` and so changes a dependency. The second - // run sees the agent the first one just cleared, computes `cleared === false` - // and writes `setAgentResetFrom('')`, wiping the notice the first run set -- - // it rendered for ~200ms and then vanished, so the acknowledgment UX Review - // asked for was unreadable in practice while every test asserting it - // synchronously still passed. - const unbindHandledRef = useRef(false) - // The project agent a directory EDIT reconciled away, held until either the - // user picks something themselves or a settled roster defines that name again. - // - // The debounce above only protects a path typed faster than 250ms. Hand-editing - // a bound job's directory pauses longer than that, so an intermediate path - // becomes a roster identity of its own -- and `/api/agents?project_path=` - // answers an unusable path with HTTP 200 and the configured agents alone, so - // that roster legitimately lacks the pick and the reconcile below clears it. - // Clearing on what is known is right; leaving it cleared once the FINISHED path - // loads a roster that DOES define the name is not, and makes every path edit on - // a bound job force a re-pick (UX Review). Restoring needs no knowledge of - // whether a path was "half typed" -- a question the endpoint cannot answer - // anyway, since an unusable path and a usable one with no agents are the same - // 200 -- only that the name is resolvable again and the user has not chosen - // since. A ref rather than state: the effect that writes it must not re-run on - // it, exactly as `projectAgentsRef` above. - const editClearedAgentRef = useRef('') - // A deliberate pick supersedes the reset bookkeeping above: the notice now - // describes nothing the user can still act on, and the remembered name is no - // longer theirs to restore -- a later settled roster defining it must not - // override the choice they just made. - const pickAgent = (name: string) => { - editClearedAgentRef.current = '' - setAgent(name) - setAgentResetFrom('') - } + // A directory change never rewrites the agent pick. Whether a name resolves + // under a folder is the backend's call, made by the same resolver dispatch + // uses: Save refuses an unresolvable agent with a 400 (`unknown_agent`) that + // names the agent and folder, and every fire re-checks it. The pickers' + // catalogs cannot answer that question -- neither lists every template the + // resolver accepts -- so clearing a pick on what they omit discarded valid + // bindings, and Save then stored the default agent in their place. // The fetch itself lives in useQuery (per-frontend convention: server state // goes through React Query, not manual useState+useEffect+fetch) — keyed on // the DEBOUNCED mirror so a half-typed path never becomes a roster identity. @@ -475,50 +442,8 @@ export default function JobForm({ job, prefill, agents, defaultAgent, rosterFail if (!projectPath) { setProjectAgents([]) setProjectRosterError('') - // An emptied field ends the edit, so there is no later roster for a - // path-edit restore to land against: the clear below is its own - // announcement and stands. Written on every re-run for this empty field, - // which is safe -- unlike the reset below, writing '' twice is idempotent. - editClearedAgentRef.current = '' - // Idempotent past the first run for this empty field -- see - // `unbindHandledRef`. The two statements above are safe to repeat; the - // reset below is not, because it would clear its own notice. - if (unbindHandledRef.current) return - unbindHandledRef.current = true - // The selected agent may have been a project-scoped one that only - // existed because THIS folder was open (effectiveAgents merged it in - // from projectAgents, now cleared above). Left alone, that name is - // still sent on save (`agent: locked ?? agent`) with an empty - // project_path -- a project agent EXISTS only inside its folder, so - // without the folder the name resolves to nothing and the run would - // silently take the default agent's prompt, tools, and permissions. - // - // Decide on POSITIVE knowledge, not absence: clear the name when - // `projectAgents` -- the folder's own roster, still holding its - // pre-clear value on this render because React state updates are not - // synchronous -- is what contributed it. Testing "not in the global - // roster" instead was wrong twice over: an empty global roster is - // legitimate (a project-only install, and `CrewWakeSection` passes - // `agents={[]}` deliberately), and app agents under `~/.kiro/agents/` - // are dispatchable without ever appearing in it, so absence proves - // nothing. A project agent that shares a global agent's name is left - // alone -- the global one survives the folder being cleared, matching - // effectiveAgents' own dedup-by-name rule. - setAgent(a => { - const cleared = !!( - a - && projectAgentsRef.current.some(p => p.scope === 'project' && p.name === a) - && !agents.some(g => g.name === a) - ) - setAgentResetReason('project-cleared') - setAgentResetFrom(cleared ? a : '') - return cleared ? '' : a - }) return } - // A bound path re-arms the guard, so a LATER clear announces its reset - // again rather than staying silent after the first one. - unbindHandledRef.current = false if (projectAgentsQueryError) { // A roster-fetch failure must be VISIBLE, not a silent empty list: the // user picked this folder specifically to see its agents, and an empty @@ -537,7 +462,7 @@ export default function JobForm({ job, prefill, agents, defaultAgent, rosterFail // silently-substituted one are indistinguishable. A fixed lead-in // sentence names what failed instead of gluing the raw backend text // onto the fallback notice with no sentence boundary (UX Review): - // " Showing the global agent list instead." reads as one + // " Showing your saved agents instead." reads as one // run-on fragment, not two facts. Keeps the existing (already // translated in every locale) fallback-notice string as its own // sentence rather than inventing a new untranslated key for it. @@ -577,60 +502,7 @@ export default function JobForm({ job, prefill, agents, defaultAgent, rosterFail const newProjectAgents: KiroCrewAgent[] = projectAgentsData.agents || [] setProjectAgents(newProjectAgents) setProjectRosterError('') - // Switching from folder A to folder B: the agent selected under A may - // not exist under B at all. Reconcile against the union of the NEW - // project roster and the global roster (mirrors the `!projectPath` - // branch's own rule above) -- a name recognized by either is left - // alone, everything else is cleared back to default. Without this, - // save persists an agent name B's project cannot resolve, and the - // scheduled fire silently falls back to the default agent's prompt, - // tools, and permissions with no error surfaced anywhere. - setAgent(a => { - // A name either roster recognizes is resolvable under this project -- - // `newProjectAgents` is the successfully loaded WHOLE roster for it, - // including global rows, so this also preserves a valid global pick when - // the separate global-catalog request failed and the `agents` prop is - // empty. The old `agents.length > 0` guard tried to protect that transient - // failure, but also retained a project-A-only pick after project B had - // authoritatively loaded without it. - const known = (n: string) => - agents.some(g => g.name === n) || newProjectAgents.some(g => g.name === n) - const restorable = editClearedAgentRef.current - // Restore BEFORE considering a clear, so the two can never both fire on - // one run: an earlier, unfinished path took this name away, this roster - // settled with it defined again, and `!a` says the user has not chosen - // anything since -- so the pick is still theirs to have back. The ref is - // deliberately not cleared here: it holds the same name that is now - // selected, so a further edit re-reaches this branch with nothing stale, - // and leaving it untouched keeps this updater idempotent if React invokes - // it twice. - if (!a && restorable && known(restorable)) { - // Nothing was lost after all, so the acknowledgment must not linger. - setAgentResetFrom('') - return restorable - } - const cleared = !!(a && !known(a)) - if (cleared) editClearedAgentRef.current = a - setAgentResetReason('not-in-project') - // Announced, not just performed (UX Review): the reset is correct, but - // doing it silently meant the job saved under "default" with no - // acknowledgment anywhere -- the user's deliberate pick vanished between - // one keystroke in the directory field and pressing Save. Recording the - // NAME rather than a boolean so the notice can say which pick went. - if (cleared) { - setAgentResetFrom(a) - } else if (!(a === '' && restorable)) { - // Withheld while a restore is pending: the reset that notice describes is - // still in force, and a FURTHER unfinished path settling must not erase - // its acknowledgment -- erasing it is the same defect as the double-run - // the `unbindHandledRef` guard above covers, and if the operator's - // finished path never does define the name they are left with the silent - // reset the notice exists against. - setAgentResetFrom('') - } - return cleared ? '' : a - }) - }, [projectPath, agents, projectAgentsData, projectAgentsQueryError]) + }, [projectPath, projectAgentsData, projectAgentsQueryError]) // Global roster (the `agents` prop) plus this job's own project-scoped // agents, deduped by name. Project rows arrive tagged `source: 'project'` // by the server, and are shown as such without a per-folder relabel: this @@ -658,11 +530,29 @@ export default function JobForm({ job, prefill, agents, defaultAgent, rosterFail // honoured downstream either — kiro-cli resolves `--agent` against its cwd // and searches the project scope first, and the job runs with the bound // folder as cwd, so "use the global one here" is not ours to guarantee. + // + // Only the response's `scope: 'project'` rows are merged. The project-scoped + // response is the WHOLE roster, and its global half is a plainer view of the + // catalog the `agents` prop already holds: merging it would swap catalog rows + // for ones without `selection_kind`/`runtime_policy` and re-add rows the + // caller filtered out (the built-in `mate` while the Crewmates preview is + // off). The global half still says one thing the catalog cannot: the server + // DROPS an alias whose template the folder declares, because the folder's + // file is what that alias would run. A catalog member row missing from it is + // therefore removed too, or picking it would run the folder's definition with + // no marker saying so. const effectiveAgents = useMemo(() => { if (!projectPath || projectAgents.length === 0) return agents - const projectNames = new Set(projectAgents.map(a => a.name)) - const kept = agents.filter(a => !projectNames.has(a.name)) - return [...kept, ...projectAgents] + const projectRows = projectAgents.filter(a => a.scope === 'project') + const projectNames = new Set(projectRows.map(a => a.name)) + const globalNames = new Set(projectAgents.filter(a => a.scope !== 'project').map(a => a.name)) + const displacedMember = (a: KiroCrewAgent) => + globalNames.size > 0 && (a.selection_kind ?? 'member') === 'member' && !globalNames.has(a.name) + // With no catalog (it failed or is still loading) the global half is the + // only list of saved agents there is, so it stands in for the catalog. + const base = agents.length > 0 ? agents : projectAgents.filter(a => a.scope !== 'project') + const kept = base.filter(a => !projectNames.has(a.name) && !displacedMember(a)) + return [...kept, ...projectRows] }, [agents, projectAgents, projectPath]) // Names where a project agent displaced a same-named global one. Derived from // the same two rosters `effectiveAgents` merges, so the marker cannot drift @@ -733,6 +623,18 @@ export default function JobForm({ job, prefill, agents, defaultAgent, rosterFail useEffect(() => { if (projectPathSaveError) projectPathErrorRef.current?.scrollIntoView?.({ block: 'nearest' }) }, [projectPathSaveError, projectPathErrorTick]) + // An `unknown_agent` refusal names the Agent field, so it is rendered under + // the agent picker (vertical layout) with its own scroll-into-view, for the + // same reason as the project-directory notice above: the field sits mid-form + // while Save is at the bottom. Picking another agent clears it. + const agentErrorRef = useRef(null) + const [agentSaveError, setAgentSaveErrorState] = useState('') + const [agentErrorTick, setAgentErrorTick] = useState(0) + const setAgentSaveError = (e: string) => { setAgentSaveErrorState(e); if (e) setAgentErrorTick(t => t + 1) } + useEffect(() => { + if (agentSaveError) agentErrorRef.current?.scrollIntoView?.({ block: 'nearest' }) + }, [agentSaveError, agentErrorTick]) + const pickAgent = (value: string) => { setAgent(value); setAgentSaveErrorState('') } const [saving, setSavingState] = useState(false) const setSaving = (v: boolean) => { setSavingState(v); onSavingChange?.(v) } @@ -839,7 +741,7 @@ export default function JobForm({ job, prefill, agents, defaultAgent, rosterFail }, [modelList, model]) const submit = async () => { - setError(''); setProjectPathSaveError(''); setSaving(true) + setError(''); setProjectPathSaveError(''); setAgentSaveError(''); setSaving(true) const f = { name, message: msg, agent: locked ?? agent, model, channel, approvalMode, silent, strictSchedule, hideInChat, minimalContext, chatFolderId: submittedChatFolderId, jobKind, schedMode, intVal, intUnit, weekDays, weekTime, cronExpr, projectPath } const body = buildBody(f, tz, setError, !!job, job ? undefined : prefill) if (!body) { setSaving(false); return } @@ -872,6 +774,7 @@ export default function JobForm({ job, prefill, agents, defaultAgent, rosterFail const classify = (e: unknown) => ({ error: e instanceof Error ? e.message : String(e), errorConfirmed: e instanceof ApiError && e.status >= 400 && e.status < 500, + errorCode: e instanceof ApiError ? responseCode(e.body) : '', }) const res = job ? await api.updateCron(job.id, body).catch(classify) @@ -886,8 +789,13 @@ export default function JobForm({ job, prefill, agents, defaultAgent, rosterFail // rendered beside that field rather than the form-wide notice at the // foot of the form (UX Review span=d88c9e1f411b). Any other rejection // is not about that one field and stays form-wide. + const unknownAgent = 'errorCode' in res && res.errorCode === 'unknown_agent' if (isProjectPathError(res.error)) setProjectPathSaveError(shown) - else setError(shown) + else if (unknownAgent && layout === 'vertical' && !locked) { + setAgentSaveError(projectPath.trim() + ? i18nT('components.jobForm.agent_not_in_this_folder', { detail: shown }) + : shown) + } else setError(shown) onSubmitError?.(shown, 'errorConfirmed' in res ? !!res.errorConfirmed : true, f.name) setSaving(false) return @@ -1134,29 +1042,12 @@ export default function JobForm({ job, prefill, agents, defaultAgent, rosterFail : (<> {i18nT('components.jobForm.which_agent_handles_this_job_leave_default_for_t')} - {/* Beside the Agent field rather than in the form-wide notice: the - reset happened to THIS control, and it is information, not an - error -- the directory change was legitimate and so was the - reset. Cleared as soon as the user picks an agent again, since - by then the sentence describes nothing they can still act on. - - role="status" for the same reason the sibling - `chat_folder_was_deleted` notice below carries it: the system - discarded a choice the reader made deliberately, so a reader on - assistive tech must hear that it happened rather than discover a - silently different agent later. A status (polite) rather than an - alert, because the reset itself was legitimate and there is - nothing to interrupt for. */} - {agentResetFrom && ( - - {i18nT( - agentResetReason === 'project-cleared' - ? 'components.jobForm.agent_reset_project_cleared' - : 'components.jobForm.agent_reset_not_in_folder', - { name: agentResetFrom }, - )} - - )} +
+ {/* No hand-off: unsaved JobForm draft (name, message, schedule, directory) */} + {agentSaveError && ( + + )} +
)} )} @@ -1342,11 +1233,10 @@ export default function JobForm({ job, prefill, agents, defaultAgent, rosterFail
- {/* Portals at z-[9999] via createPortal — reused rather than - * reimplemented so this folder picker is IDENTICAL to every other - * project-directory picker in the app (chat's own, FolderConfigModal's). */} + {/* Share the directory picker while joining the host dialog's layer stack. */} {pickerOpen && ( { if (!o) setPickerOpen(false) }} anchorRef={browseRef} diff --git a/website/src/components/ProjectPicker.tsx b/website/src/components/ProjectPicker.tsx index f907a9db5d63..5e15bdb14d9c 100644 --- a/website/src/components/ProjectPicker.tsx +++ b/website/src/components/ProjectPicker.tsx @@ -5,6 +5,7 @@ import { FolderOpen, FolderSearch, ChevronRight, ChevronLeft, Clock, Search, Sta import { api } from '../api/client' import { useListKeyboardNav } from '../hooks/useListKeyboardNav' import ErrorNotice from './ErrorNotice' +import { Popover, PopoverAnchor, PopoverContent } from './ui/popover' import { reportForError, type ErrorReport } from '../utils/errorReport' import { endsWithSeparator, isWindowsPath, lastSegment, parentIsDriveList, pathSeparator, stripTrailingSeparator } from '../utils/browsePath' import { searchErrorCause, type SearchErrorCause } from '../lib/searchErrorCause' @@ -168,6 +169,9 @@ interface Props { anchorRef?: RefObject anchorRect?: DOMRect | null onSelect: (path: string) => void + /** Join a Radix modal dialog's pointer, focus, dismissal and scroll layers. + * Opt-in so standalone and non-Radix-modal callers retain their behavior. */ + modal?: boolean /** * Turn on the agent hand-off in the listing-failure notice. The hand-off * navigates to the chat and unmounts whatever this popover floats over, so @@ -189,7 +193,7 @@ interface Props { footer?: ReactNode } -export default function ProjectPicker({ open, onOpenChange, anchorRef, anchorRect, onSelect, errorHandoff = false, startPath = '', footer }: Props) { +export default function ProjectPicker({ open, onOpenChange, anchorRef, anchorRect, onSelect, modal = false, errorHandoff = false, startPath = '', footer }: Props) { const [tab, setTab] = useState<'favorites' | 'recent' | 'browse'>('recent') // Focus inside the caller's footer (a field of its own) disarms the list navigators: // their document-capture listeners claim Enter and Tab, which would pick a project and @@ -475,7 +479,7 @@ export default function ProjectPicker({ open, onOpenChange, anchorRef, anchorRec }, [open]) useEffect(() => { - if (!open) return + if (!open || modal) return let cleanup = () => {} const timer = setTimeout(() => { const handler = (e: MouseEvent) => { @@ -491,7 +495,7 @@ export default function ProjectPicker({ open, onOpenChange, anchorRef, anchorRec cleanup = () => document.removeEventListener('mousedown', handler) }, 0) return () => { clearTimeout(timer); cleanup() } - }, [open, onOpenChange, btnRef, getAnchorRect]) + }, [open, modal, onOpenChange, btnRef, getAnchorRect]) const select = (path: string) => { // The browse input carries a trailing delimiter for typing continuation @@ -707,19 +711,19 @@ export default function ProjectPicker({ open, onOpenChange, anchorRef, anchorRec e.stopPropagation() } - return createPortal( - // eslint-disable-next-line jsx-a11y/no-static-element-interactions -- keyboard-isolation barrier (see above), not an activatable control; there is no behaviour for a keyboard to be given, and every control inside here is a real input or button. Adding a role/tab stop would advertise an interaction this element does not have. -
{ - const dropMinH = 200 - const spaceBelow = window.innerHeight - anchorR.bottom - 8 - const flipUp = spaceBelow < dropMinH || anchorR.bottom > window.innerHeight / 2 - const left = Math.max(8, Math.min(anchorR.right - 400, window.innerWidth - 408)) - if (flipUp) { - const spaceAbove = anchorR.top - 8 - return { bottom: window.innerHeight - anchorR.top + 4, left, height: Math.min(460, Math.max(200, spaceAbove)) } - } - return { top: anchorR.bottom + 4, left, height: Math.min(460, Math.max(200, spaceBelow)) } - })()}> + const dropMinH = 200 + const spaceBelow = window.innerHeight - anchorR.bottom - 8 + const flipUp = spaceBelow < dropMinH || anchorR.bottom > window.innerHeight / 2 + const spaceAbove = anchorR.top - 8 + const height = Math.min(460, Math.max(200, flipUp ? spaceAbove : spaceBelow)) + const left = Math.max(8, Math.min(anchorR.right - 400, window.innerWidth - 408)) + const position = flipUp + ? { bottom: window.innerHeight - anchorR.top + 4, left, height } + : { top: anchorR.bottom + 4, left, height } + + const panel = ( + // eslint-disable-next-line jsx-a11y/no-static-element-interactions -- keyboard-isolation barrier, not an activatable control; controls inside are inputs or buttons. +
{/* Tabs */}
)} -
, - document.body +
+ ) + + if (!modal) return createPortal(panel, document.body) + return ( + + anchorR } }} /> + { e.preventDefault(); btnRef?.current?.focus() }} + > + {panel} + + ) } diff --git a/website/src/i18n/locales/bn.json b/website/src/i18n/locales/bn.json index 1e46e901c84b..97dd74cd1050 100644 --- a/website/src/i18n/locales/bn.json +++ b/website/src/i18n/locales/bn.json @@ -5979,9 +5979,9 @@ "default": "ডিফল্ট", "filter_agents": "এজেন্ট ফিল্টার করুন", "no_matches": "কোনো মিল নেই", - "project_agent": "প্রজেক্ট এজেন্ট", - "overrides_global": "গ্লোবাল ওভাররাইড করে", - "overrides_global_hint": "এই জবের প্রজেক্ট ডিরেক্টরি এই নামেই নিজের একটি এজেন্ট নির্ধারণ করে, তাই গ্লোবাল এজেন্টের বদলে এটিই চলে। অন্যত্র গ্লোবাল এজেন্ট অপরিবর্তিত থাকে।", + "project_agent": "ফোল্ডারের এজেন্ট", + "overrides_global": "ফোল্ডারের সংস্করণ", + "overrides_global_hint": "এই কাজটি ফোল্ডারের {{name}} চালায়। আপনার সেভ করা এজেন্ট অপরিবর্তিত থাকে।", "retry": "আবার চেষ্টা করুন", "retrying": "আবার চেষ্টা করা হচ্ছে…", "roster_load_failed": "এজেন্ট তালিকা লোড করা যায়নি।", @@ -7213,7 +7213,7 @@ "at": "সময়", "auto": "auto", "auto_approve": "স্বয়ংক্রিয় অনুমোদন", - "browse": "ব্রাউজ করো", + "browse": "ডিরেক্টরি বেছে নিন…", "channel_id": "চ্যানেল ID", "channel_id_optional": "চ্যানেল ID (ঐচ্ছিক)", "command": "কমান্ড", @@ -7249,12 +7249,10 @@ "project_directory_must_be_an_absolute_path": "প্রজেক্ট ডিরেক্টরি একটি অ্যাবসোলিউট পাথ হতে হবে (যেমন /Users/you/projects/myrepo)।", "project_directory_must_be_an_existing_directory": "প্রজেক্ট ডিরেক্টরি একটি বিদ্যমান ডিরেক্টরি হতে হবে।", "project_directory_refers_to_a_protected_path": "প্রজেক্ট ডিরেক্টরি একটি সুরক্ষিত সিস্টেম পাথ নির্দেশ করে এবং এটি ব্যবহার করা যাবে না।", - "project_roster_error_falls_back_to_global_agents": "পরিবর্তে গ্লোবাল এজেন্ট তালিকা দেখানো হচ্ছে।", - "agent_reset_not_in_folder": "{{name}} এই প্রজেক্টে সংজ্ঞায়িত নয়, তাই এজেন্ট ডিফল্টে রিসেট করা হয়েছে।", - "agent_reset_project_cleared": "প্রজেক্ট ডিরেক্টরি খালি করা হয়েছে, তাই {{name}} ডিফল্টে রিসেট করা হয়েছে।", - "couldnt_load_this_folders_agents": "এই প্রজেক্টের এজেন্ট লোড করা যায়নি।", - "couldnt_load_this_folders_agents_detail": "এই প্রজেক্টের এজেন্ট লোড করা যায়নি: {{detail}}।", - "run_this_job_s_agent_in_this_folder_and_offer": "এই জবের এজেন্টকে এই প্রজেক্টে চালাও, এবং তোমার গ্লোবাল এজেন্টদের সাথে এর .kiro/agents/-এ সংজ্ঞায়িত এজেন্টগুলোও প্রদান করো।", + "project_roster_error_falls_back_to_global_agents": "পরিবর্তে আপনার সংরক্ষিত এজেন্টদের দেখানো হচ্ছে।", + "couldnt_load_this_folders_agents": "এই ফোল্ডারের এজেন্ট লোড করা যায়নি।", + "couldnt_load_this_folders_agents_detail": "এই ফোল্ডারের এজেন্ট লোড করা যায়নি: {{detail}}।", + "run_this_job_s_agent_in_this_folder_and_offer": "এই জবটি যে ফোল্ডারে কাজ করে। এই ফোল্ডারে সংরক্ষিত এজেন্টরাও নিচের এজেন্ট তালিকায় দেখা যায়।", "override_the_model_for_this_job_leave_on_inherit": "এই জবের জন্য মডেল ওভাররাইড করুন। এজেন্ট বা গ্লোবাল ডিফল্ট ব্যবহার করতে “ইনহেরিট”-এ রেখে দিন।", "save": "সেভ করো", "saving": "সেভ হচ্ছে...", @@ -7282,7 +7280,8 @@ "chat_folder_was_deleted": "এই কাজটি যে ফোল্ডারে ফাইল করত সেটি মুছে ফেলা হয়েছে। অন্য একটি বেছে নাও, বা সংরক্ষণ করো যাতে রানগুলো ফাইল না হয়।", "project_roster_retry": "আবার চেষ্টা করো", "project_roster_retrying": "আবার চেষ্টা করা হচ্ছে…", - "project_directory_placeholder": "যেমন /Users/you/projects/myrepo" + "project_directory_placeholder": "যেমন /Users/you/projects/myrepo", + "agent_not_in_this_folder": "{{detail}}। এই ফোল্ডারের একটি এজেন্ট বেছে নিন।" }, "jobLogsView": { "cancel": "বাতিল করুন", diff --git a/website/src/i18n/locales/de.json b/website/src/i18n/locales/de.json index 8627bcb394eb..28d5318111b5 100644 --- a/website/src/i18n/locales/de.json +++ b/website/src/i18n/locales/de.json @@ -5979,9 +5979,9 @@ "default": "Standard", "filter_agents": "Agenten filtern", "no_matches": "Keine Treffer", - "project_agent": "Projekt-Agent", - "overrides_global": "überschreibt global", - "overrides_global_hint": "Das Projektverzeichnis dieses Jobs definiert einen eigenen Agenten mit diesem Namen, daher wird dieser anstelle des globalen Agenten ausgeführt. Andernorts bleibt der globale Agent unverändert.", + "project_agent": "Ordner-Agent", + "overrides_global": "Version des Ordners", + "overrides_global_hint": "Dieser Job führt {{name}} aus diesem Ordner aus. Dein gespeicherter Agent bleibt unverändert.", "retry": "Wiederholen", "retrying": "Wird wiederholt…", "roster_load_failed": "Die Agentenliste konnte nicht geladen werden.", @@ -7213,7 +7213,7 @@ "at": "um", "auto": "automatisch", "auto_approve": "Automatisch genehmigen", - "browse": "Durchsuchen", + "browse": "Verzeichnis wählen…", "channel_id": "Kanal-ID", "channel_id_optional": "Kanal-ID (optional)", "command": "Befehl", @@ -7249,12 +7249,10 @@ "project_directory_must_be_an_absolute_path": "Das Projektverzeichnis muss ein absoluter Pfad sein (z. B. /Users/you/projects/myrepo).", "project_directory_must_be_an_existing_directory": "Das Projektverzeichnis muss ein vorhandenes Verzeichnis sein.", "project_directory_refers_to_a_protected_path": "Das Projektverzeichnis verweist auf einen geschützten Systempfad und kann nicht verwendet werden.", - "project_roster_error_falls_back_to_global_agents": "Es wird stattdessen die globale Agentenliste angezeigt.", - "agent_reset_not_in_folder": "{{name}} ist in diesem Projekt nicht definiert, daher wurde der Agent auf den Standard zurückgesetzt.", - "agent_reset_project_cleared": "Das Projektverzeichnis wurde geleert, daher wurde {{name}} auf den Standard zurückgesetzt.", - "couldnt_load_this_folders_agents": "Agenten dieses Projekts konnten nicht geladen werden.", - "couldnt_load_this_folders_agents_detail": "Agenten dieses Projekts konnten nicht geladen werden: {{detail}}.", - "run_this_job_s_agent_in_this_folder_and_offer": "Führt den Agenten dieses Jobs in diesem Projekt aus und bietet zusätzlich zu deinen globalen Agenten die in dessen .kiro/agents/ definierten Agenten an.", + "project_roster_error_falls_back_to_global_agents": "Stattdessen werden deine gespeicherten Agenten angezeigt.", + "couldnt_load_this_folders_agents": "Agenten dieses Ordners konnten nicht geladen werden.", + "couldnt_load_this_folders_agents_detail": "Agenten dieses Ordners konnten nicht geladen werden: {{detail}}.", + "run_this_job_s_agent_in_this_folder_and_offer": "Der Ordner, in dem dieser Job arbeitet. In diesem Ordner gespeicherte Agenten erscheinen auch in der Agentenliste unten.", "override_the_model_for_this_job_leave_on_inherit": "Das Modell für diesen Job übersteuern. Auf „Übernehmen“ belassen, um den Agenten- oder globalen Standard zu verwenden.", "save": "Speichern", "saving": "Wird gespeichert...", @@ -7282,7 +7280,8 @@ "chat_folder_was_deleted": "Der Ordner, in den dieser Auftrag ablegte, wurde gelöscht. Wähle einen anderen, oder speichere, damit die Ausführungen nicht abgelegt werden.", "project_roster_retry": "Wiederholen", "project_roster_retrying": "Wird wiederholt…", - "project_directory_placeholder": "z. B. /Users/you/projects/myrepo" + "project_directory_placeholder": "z. B. /Users/you/projects/myrepo", + "agent_not_in_this_folder": "{{detail}}. Wähle einen Agenten aus diesem Ordner." }, "jobLogsView": { "cancel": "Abbrechen", diff --git a/website/src/i18n/locales/en-XA.json b/website/src/i18n/locales/en-XA.json index 2a4d703b6cae..7d0090d7ba67 100644 --- a/website/src/i18n/locales/en-XA.json +++ b/website/src/i18n/locales/en-XA.json @@ -5439,9 +5439,9 @@ "default": "[ðèƒàùĺţ ···········]", "filter_agents": "[Ƒìĺţèŕ àğèñţş ············]", "no_matches": "[Ñø ɱàţçĥèş ···············]", - "project_agent": "[þŕøĵèçţ àğèñţ ············]", - "overrides_global": "[øṽèŕŕìðèş ğĺøƀàĺ ··············]", - "overrides_global_hint": "[Ţĥìş ĵøƀ'ş þŕøĵèçţ ðìŕèçţøŕý ðèƒìñèş ìţş øẁñ àğèñţ ẁìţĥ ţĥìş ñàɱè, şø ìţ ŕùñş ìñşţèàð øƒ ýøùŕ ğĺøƀàĺ øñè. Ýøùŕ ğĺøƀàĺ àğèñţ ìş ùñçĥàñğèð èĺşèẁĥèŕè. ············································]", + "project_agent": "[ƒøĺðèŕ àğèñţ ···········]", + "overrides_global": "[ƒøĺðèŕ'ş ṽèŕşìøñ ··············]", + "overrides_global_hint": "[Ţĥìş ĵøƀ ŕùñş ţĥè ƒøĺðèŕ'ş {{name}}. Ýøùŕ şàṽèð øñè ìş ùñçĥàñğèð. ····················]", "retry": "[Ŕèţŕý ········]", "retrying": "[Ŕèţŕýìñğ… ··············]", "roster_load_failed": "[Çøùĺðñ'ţ ĺøàð ţĥè àğèñţ ĺìşţ. ····················]", @@ -6471,7 +6471,7 @@ "at": "[àţ ···]", "auto": "[àùţø ······]", "auto_approve": "[Àùţø-àþþŕøṽè ···········]", - "browse": "[Ɓŕøẁşè ·········]", + "browse": "[Çĥøøşè ðìŕèçţøŕý… ···············]", "channel_id": "[Çĥàññèĺ ÌÐ ···············]", "channel_id_optional": "[Çĥàññèĺ ÌÐ (øþţìøñàĺ) ···············]", "command": "[Çøɱɱàñð ···········]", @@ -6494,16 +6494,14 @@ "model_inherit": "[Ṁøðèĺ: ìñĥèŕìţ ·············]", "name": "[Ñàɱè ······]", "optional": "[Øþţìøñàĺ ············]", - "run_this_job_s_agent_in_this_folder_and_offer": "[Ŕùñ ţĥìş ĵøƀ'ş àğèñţ ìñ ţĥìş þŕøĵèçţ, àñð øƒƒèŕ àñý àğèñţş ðèƒìñèð ìñ ìţş .ķìŕø/àğèñţş/ àĺøñğşìðè ýøùŕ ğĺøƀàĺ àğèñţş. ···································]", + "run_this_job_s_agent_in_this_folder_and_offer": "[Ƒøĺðèŕ ţĥìş ĵøƀ ẁøŕķş ìñ. Àğèñţş şàṽèð ìñ ţĥìş ƒøĺðèŕ àĺşø àþþèàŕ ìñ ţĥè Àğèñţ ĺìşţ ƀèĺøẁ. ···························]", "project_directory": "[Þŕøĵèçţ ðìŕèçţøŕý ···············]", "project_directory_must_be_an_absolute_path": "[Þŕøĵèçţ ðìŕèçţøŕý ɱùşţ ƀè àñ àƀşøĺùţè þàţĥ (è.ğ. /Users/you/projects/myrepo). ··················]", "project_directory_must_be_an_existing_directory": "[Þŕøĵèçţ ðìŕèçţøŕý ɱùşţ ƀè àñ èẋìşţìñğ ðìŕèçţøŕý. ························]", "project_directory_refers_to_a_protected_path": "[Þŕøĵèçţ ðìŕèçţøŕý ŕèƒèŕş ţø à þŕøţèçţèð şýşţèɱ þàţĥ àñð çàñ'ţ ƀè ùşèð. ·························]", - "project_roster_error_falls_back_to_global_agents": "[Şĥøẁìñğ ţĥè ğĺøƀàĺ àğèñţ ĺìşţ ìñşţèàð. ···················]", - "agent_reset_not_in_folder": "[{{name}} ìşñ'ţ ðèƒìñèð ìñ ţĥìş þŕøĵèçţ, şø ţĥè àğèñţ ẁàş ŕèşèţ ţø ðèƒàùĺţ. ·······················]", - "agent_reset_project_cleared": "[Ţĥè þŕøĵèçţ ðìŕèçţøŕý ẁàş çĺèàŕèð, şø {{name}} ẁàş ŕèşèţ ţø ðèƒàùĺţ. ·····················]", - "couldnt_load_this_folders_agents": "[Çøùĺðñ'ţ ĺøàð ţĥìş þŕøĵèçţ'ş àğèñţş. ··················]", - "couldnt_load_this_folders_agents_detail": "[Çøùĺðñ'ţ ĺøàð ţĥìş þŕøĵèçţ'ş àğèñţş: {{detail}}. ···················]", + "project_roster_error_falls_back_to_global_agents": "[Şĥøẁìñğ ýøùŕ şàṽèð àğèñţş ìñşţèàð. ·················]", + "couldnt_load_this_folders_agents": "[Çøùĺðñ'ţ ĺøàð ţĥìş ƒøĺðèŕ'ş àğèñţş. ··················]", + "couldnt_load_this_folders_agents_detail": "[Çøùĺðñ'ţ ĺøàð ţĥìş ƒøĺðèŕ'ş àğèñţş: {{detail}}. ···················]", "override_the_model_for_this_job_leave_on_inherit": "[Øṽèŕŕìðè ţĥè ɱøðèĺ ƒøŕ ţĥìş ĵøƀ. Ĺèàṽè øñ \"Ìñĥèŕìţ\" ţø ùşè ţĥè àğèñţ øŕ ğĺøƀàĺ ðèƒàùĺţ. ··························]", "schedule": "[Şçĥèðùĺè ············]", "script": "[Şçŕìþţ ·········]", @@ -6515,6 +6513,7 @@ "the_prompt_or_task_sent_to_the_agent_when_this_j": "[Ţĥè þŕøɱþţ øŕ ţàşķ şèñţ ţø ţĥè àğèñţ ẁĥèñ ţĥìş ĵøƀ ƒìŕèş ····················]", "weekly_schedule": "[Ẁèèķĺý şçĥèðùĺè ··············]", "which_agent_handles_this_job_leave_default_for_t": "[Ẁĥìçĥ àğèñţ ĥàñðĺèş ţĥìş ĵøƀ. Ĺèàṽè ðèƒàùĺţ ƒøŕ ţĥè þŕìɱàŕý àğèñţ. ·······················]", + "agent_not_in_this_folder": "[{{detail}}. Þìçķ àñ àğèñţ ƒŕøɱ ţĥìş ƒøĺðèŕ. ·················]", "add": "[Àðð ·····]", "enter_a_valid_5_field_cron_expression": "[Èñţèŕ à ṽàĺìð 5-ƒìèĺð çŕøñ èẋþŕèşşìøñ ···················]", "failed_to_save": "[Ƒàìĺèð ţø şàṽè ·············]", diff --git a/website/src/i18n/locales/en.json b/website/src/i18n/locales/en.json index 17418a021811..86d1eb805989 100644 --- a/website/src/i18n/locales/en.json +++ b/website/src/i18n/locales/en.json @@ -4159,9 +4159,9 @@ "default": "default", "filter_agents": "Filter agents", "no_matches": "No matches", - "project_agent": "project agent", - "overrides_global": "overrides global", - "overrides_global_hint": "This job's project directory defines its own agent with this name, so it runs instead of your global one. Your global agent is unchanged elsewhere.", + "project_agent": "folder agent", + "overrides_global": "folder's version", + "overrides_global_hint": "This job runs the folder's {{name}}. Your saved one is unchanged.", "retry": "Retry", "retrying": "Retrying…", "roster_load_failed": "Couldn't load the agent list.", @@ -4686,7 +4686,7 @@ "at": "at", "auto": "auto", "auto_approve": "Auto-approve", - "browse": "Browse", + "browse": "Choose directory…", "channel_id": "Channel ID", "channel_id_optional": "Channel ID (optional)", "command": "Command", @@ -4709,16 +4709,14 @@ "model_inherit": "Model: inherit", "name": "Name", "optional": "Optional", - "run_this_job_s_agent_in_this_folder_and_offer": "Run this job's agent in this project, and offer any agents defined in its .kiro/agents/ alongside your global agents.", + "run_this_job_s_agent_in_this_folder_and_offer": "Folder this job works in. Agents saved in this folder also appear in the Agent list below.", "project_directory": "Project directory", "project_directory_must_be_an_absolute_path": "Project directory must be an absolute path (e.g. /Users/you/projects/myrepo).", "project_directory_must_be_an_existing_directory": "Project directory must be an existing directory.", "project_directory_refers_to_a_protected_path": "Project directory refers to a protected system path and can't be used.", - "project_roster_error_falls_back_to_global_agents": "Showing the global agent list instead.", - "agent_reset_not_in_folder": "{{name}} isn't defined in this project, so the agent was reset to default.", - "agent_reset_project_cleared": "The project directory was cleared, so {{name}} was reset to default.", - "couldnt_load_this_folders_agents": "Couldn't load this project's agents.", - "couldnt_load_this_folders_agents_detail": "Couldn't load this project's agents: {{detail}}.", + "project_roster_error_falls_back_to_global_agents": "Showing your saved agents instead.", + "couldnt_load_this_folders_agents": "Couldn't load this folder's agents.", + "couldnt_load_this_folders_agents_detail": "Couldn't load this folder's agents: {{detail}}.", "override_the_model_for_this_job_leave_on_inherit": "Override the model for this job. Leave on \"Inherit\" to use the agent or global default.", "schedule": "Schedule", "script": "Script", @@ -4729,7 +4727,8 @@ "suppress_automatic_message_delivery_the_agent_co": "Suppress automatic message delivery. The agent controls when to notify.", "the_prompt_or_task_sent_to_the_agent_when_this_j": "The prompt or task sent to the agent when this job fires", "weekly_schedule": "Weekly schedule", - "which_agent_handles_this_job_leave_default_for_t": "Which agent handles this job. Leave default for the primary agent." + "which_agent_handles_this_job_leave_default_for_t": "Which agent handles this job. Leave default for the primary agent.", + "agent_not_in_this_folder": "{{detail}}. Pick an agent from this folder." }, "jobLogsView": { "cancel": "Cancel", diff --git a/website/src/i18n/locales/es.json b/website/src/i18n/locales/es.json index 91fdcdae6fcf..d64bcb7a432f 100644 --- a/website/src/i18n/locales/es.json +++ b/website/src/i18n/locales/es.json @@ -6080,9 +6080,9 @@ "default": "predeterminado", "filter_agents": "Filtrar agentes", "no_matches": "Sin coincidencias", - "project_agent": "agente de proyecto", - "overrides_global": "anula el global", - "overrides_global_hint": "El directorio del proyecto de esta tarea define su propio agente con este nombre, por lo que se ejecuta en lugar del agente global. En otros lugares, el agente global no cambia.", + "project_agent": "agente de la carpeta", + "overrides_global": "versión de la carpeta", + "overrides_global_hint": "Este trabajo ejecuta {{name}} de la carpeta. Tu agente guardado no cambia.", "retry": "Reintentar", "retrying": "Reintentando…", "roster_load_failed": "No se pudo cargar la lista de agentes.", @@ -7336,7 +7336,7 @@ "at": "a las", "auto": "auto", "auto_approve": "Aprobar automáticamente", - "browse": "Explorar", + "browse": "Elegir directorio…", "channel_id": "ID del canal", "channel_id_optional": "ID del canal (opcional)", "command": "Comando", @@ -7372,12 +7372,10 @@ "project_directory_must_be_an_absolute_path": "El directorio del proyecto debe ser una ruta absoluta (p. ej., /Users/you/projects/myrepo).", "project_directory_must_be_an_existing_directory": "El directorio del proyecto debe ser un directorio existente.", "project_directory_refers_to_a_protected_path": "El directorio del proyecto hace referencia a una ruta del sistema protegida y no se puede usar.", - "project_roster_error_falls_back_to_global_agents": "Mostrando la lista global de agentes en su lugar.", - "agent_reset_not_in_folder": "{{name}} no está definido en este proyecto, por lo que el agente se restableció al predeterminado.", - "agent_reset_project_cleared": "Se borró el directorio del proyecto, por lo que {{name}} se restableció al predeterminado.", - "couldnt_load_this_folders_agents": "No se pudieron cargar los agentes de este proyecto.", - "couldnt_load_this_folders_agents_detail": "No se pudieron cargar los agentes de este proyecto: {{detail}}.", - "run_this_job_s_agent_in_this_folder_and_offer": "Ejecuta el agente de este trabajo en este proyecto y ofrece los agentes definidos en su .kiro/agents/ junto con tus agentes globales.", + "project_roster_error_falls_back_to_global_agents": "Mostrando tus agentes guardados en su lugar.", + "couldnt_load_this_folders_agents": "No se pudieron cargar los agentes de esta carpeta.", + "couldnt_load_this_folders_agents_detail": "No se pudieron cargar los agentes de esta carpeta: {{detail}}.", + "run_this_job_s_agent_in_this_folder_and_offer": "Carpeta en la que trabaja esta tarea. Los agentes guardados en esta carpeta también aparecen en la lista de agentes de abajo.", "override_the_model_for_this_job_leave_on_inherit": "Anula el modelo para este trabajo. Déjalo en \"Heredar\" para usar el del agente o el predeterminado global.", "save": "Guardar", "saving": "Guardando…", @@ -7405,7 +7403,8 @@ "chat_folder_was_deleted": "La carpeta en la que archivaba esta tarea se eliminó. Elige otra o guarda para dejar las ejecuciones sin archivar.", "project_roster_retry": "Reintentar", "project_roster_retrying": "Reintentando…", - "project_directory_placeholder": "p. ej., /Users/you/projects/myrepo" + "project_directory_placeholder": "p. ej., /Users/you/projects/myrepo", + "agent_not_in_this_folder": "{{detail}}. Elige un agente de esta carpeta." }, "jobLogsView": { "cancel": "Cancelar", diff --git a/website/src/i18n/locales/fr.json b/website/src/i18n/locales/fr.json index c56cd2bdfed4..fa589dc38218 100644 --- a/website/src/i18n/locales/fr.json +++ b/website/src/i18n/locales/fr.json @@ -6080,9 +6080,9 @@ "default": "par défaut", "filter_agents": "Filtrer les agents", "no_matches": "Aucun résultat", - "project_agent": "agent du projet", - "overrides_global": "remplace le global", - "overrides_global_hint": "Le répertoire du projet de cette tâche définit son propre agent portant ce nom ; c'est donc lui qui s'exécute au lieu de l'agent global. Ailleurs, l'agent global reste inchangé.", + "project_agent": "agent du dossier", + "overrides_global": "version du dossier", + "overrides_global_hint": "Cette tâche exécute {{name}} du dossier. Ton agent enregistré reste inchangé.", "retry": "Réessayer", "retrying": "Nouvelle tentative…", "roster_load_failed": "Impossible de charger la liste des agents.", @@ -7336,7 +7336,7 @@ "at": "à", "auto": "auto", "auto_approve": "Approuver automatiquement", - "browse": "Parcourir", + "browse": "Choisir un répertoire…", "channel_id": "ID du canal", "channel_id_optional": "ID du canal (facultatif)", "command": "Commande", @@ -7372,12 +7372,10 @@ "project_directory_must_be_an_absolute_path": "Le répertoire du projet doit être un chemin absolu (par ex. /Users/you/projects/myrepo).", "project_directory_must_be_an_existing_directory": "Le répertoire du projet doit être un répertoire existant.", "project_directory_refers_to_a_protected_path": "Le répertoire du projet fait référence à un chemin système protégé et ne peut pas être utilisé.", - "project_roster_error_falls_back_to_global_agents": "Affichage de la liste globale des agents à la place.", - "agent_reset_not_in_folder": "{{name}} n'est pas défini dans ce projet ; l'agent a donc été réinitialisé sur celui par défaut.", - "agent_reset_project_cleared": "Le répertoire du projet a été effacé ; {{name}} a donc été réinitialisé sur celui par défaut.", - "couldnt_load_this_folders_agents": "Impossible de charger les agents de ce projet.", - "couldnt_load_this_folders_agents_detail": "Impossible de charger les agents de ce projet : {{detail}}.", - "run_this_job_s_agent_in_this_folder_and_offer": "Exécute l'agent de cette tâche dans ce projet et propose les agents définis dans son .kiro/agents/ en plus de tes agents globaux.", + "project_roster_error_falls_back_to_global_agents": "Affichage de tes agents enregistrés à la place.", + "couldnt_load_this_folders_agents": "Impossible de charger les agents de ce dossier.", + "couldnt_load_this_folders_agents_detail": "Impossible de charger les agents de ce dossier : {{detail}}.", + "run_this_job_s_agent_in_this_folder_and_offer": "Dossier dans lequel cette tâche travaille. Les agents enregistrés dans ce dossier apparaissent aussi dans la liste des agents ci-dessous.", "override_the_model_for_this_job_leave_on_inherit": "Remplacer le modèle pour cette tâche. Laissez sur « Hériter » pour utiliser le modèle de l'agent ou le modèle global par défaut.", "save": "Enregistrer", "saving": "Enregistrement...", @@ -7405,7 +7403,8 @@ "chat_folder_was_deleted": "Le dossier dans lequel cette tâche classait ses exécutions a été supprimé. Choisissez-en un autre, ou enregistrez pour ne plus les classer.", "project_roster_retry": "Réessayer", "project_roster_retrying": "Nouvelle tentative…", - "project_directory_placeholder": "par ex. /Users/you/projects/myrepo" + "project_directory_placeholder": "par ex. /Users/you/projects/myrepo", + "agent_not_in_this_folder": "{{detail}}. Choisis un agent de ce dossier." }, "jobLogsView": { "cancel": "Annuler", diff --git a/website/src/i18n/locales/hi.json b/website/src/i18n/locales/hi.json index 1ec1a2a7bfdb..bfb6844f6814 100644 --- a/website/src/i18n/locales/hi.json +++ b/website/src/i18n/locales/hi.json @@ -5979,9 +5979,9 @@ "default": "डिफ़ॉल्ट", "filter_agents": "एजेंट फ़िल्टर करें", "no_matches": "कोई मेल नहीं", - "project_agent": "प्रोजेक्ट एजेंट", - "overrides_global": "ग्लोबल को ओवरराइड करता है", - "overrides_global_hint": "इस जॉब की प्रोजेक्ट डायरेक्टरी इसी नाम का अपना एजेंट परिभाषित करती है, इसलिए ग्लोबल एजेंट के बजाय यही चलता है। अन्य जगहों पर ग्लोबल एजेंट अपरिवर्तित रहता है।", + "project_agent": "फ़ोल्डर का एजेंट", + "overrides_global": "फ़ोल्डर वाला संस्करण", + "overrides_global_hint": "यह जॉब फ़ोल्डर का {{name}} चलाता है। आपका सहेजा गया एजेंट नहीं बदलता।", "retry": "पुन: प्रयास करें", "retrying": "पुनः प्रयास कर रहे हैं…", "roster_load_failed": "एजेंट सूची लोड नहीं की जा सकी।", @@ -7213,7 +7213,7 @@ "at": "समय", "auto": "auto", "auto_approve": "स्वतः स्वीकृति", - "browse": "ब्राउज़ करो", + "browse": "डायरेक्टरी चुनो…", "channel_id": "चैनल ID", "channel_id_optional": "चैनल ID (वैकल्पिक)", "command": "कमांड", @@ -7249,12 +7249,10 @@ "project_directory_must_be_an_absolute_path": "प्रोजेक्ट डायरेक्टरी एक ऐब्सोल्यूट पथ होनी चाहिए (उदाहरण: /Users/you/projects/myrepo)।", "project_directory_must_be_an_existing_directory": "प्रोजेक्ट डायरेक्टरी एक मौजूदा डायरेक्टरी होनी चाहिए।", "project_directory_refers_to_a_protected_path": "प्रोजेक्ट डायरेक्टरी एक सुरक्षित सिस्टम पथ को संदर्भित करती है और इसका उपयोग नहीं किया जा सकता।", - "project_roster_error_falls_back_to_global_agents": "इसके बजाय ग्लोबल एजेंट सूची दिखाई जा रही है।", - "agent_reset_not_in_folder": "{{name}} इस प्रोजेक्ट में परिभाषित नहीं है, इसलिए एजेंट को डिफ़ॉल्ट पर रीसेट कर दिया गया।", - "agent_reset_project_cleared": "प्रोजेक्ट डायरेक्टरी खाली कर दी गई, इसलिए {{name}} को डिफ़ॉल्ट पर रीसेट कर दिया गया।", - "couldnt_load_this_folders_agents": "इस प्रोजेक्ट के एजेंट लोड नहीं हो सके।", - "couldnt_load_this_folders_agents_detail": "इस प्रोजेक्ट के एजेंट लोड नहीं हो सके: {{detail}}।", - "run_this_job_s_agent_in_this_folder_and_offer": "इस जॉब के एजेंट को इस प्रोजेक्ट में चलाओ, और तुम्हारे ग्लोबल एजेंटों के साथ-साथ इसके .kiro/agents/ में परिभाषित एजेंट भी प्रस्तुत करो।", + "project_roster_error_falls_back_to_global_agents": "इसके बजाय आपके सहेजे गए एजेंट दिखाए जा रहे हैं।", + "couldnt_load_this_folders_agents": "इस फ़ोल्डर के एजेंट लोड नहीं हो सके।", + "couldnt_load_this_folders_agents_detail": "इस फ़ोल्डर के एजेंट लोड नहीं हो सके: {{detail}}।", + "run_this_job_s_agent_in_this_folder_and_offer": "वह फ़ोल्डर जिसमें यह जॉब काम करता है। इस फ़ोल्डर में सहेजे गए एजेंट नीचे की एजेंट सूची में भी दिखते हैं।", "override_the_model_for_this_job_leave_on_inherit": "इस जॉब के लिए मॉडल ओवरराइड करें। एजेंट या ग्लोबल डिफ़ॉल्ट उपयोग करने के लिए \"इनहेरिट\" पर छोड़ दें।", "save": "सहेजें", "saving": "सहेजा जा रहा है...", @@ -7282,7 +7280,8 @@ "chat_folder_was_deleted": "यह जॉब जिस फ़ोल्डर में फ़ाइल करती थी वह हटा दिया गया है। दूसरा चुनें, या सहेजें ताकि रन फ़ाइल न हों।", "project_roster_retry": "पुनः प्रयास करो", "project_roster_retrying": "पुनः प्रयास कर रहे हैं…", - "project_directory_placeholder": "उदाहरण: /Users/you/projects/myrepo" + "project_directory_placeholder": "उदाहरण: /Users/you/projects/myrepo", + "agent_not_in_this_folder": "{{detail}}। इस फ़ोल्डर से कोई एजेंट चुनो।" }, "jobLogsView": { "cancel": "रद्द करें", diff --git a/website/src/i18n/locales/it.json b/website/src/i18n/locales/it.json index d85430ae9877..2bb81012a9e3 100644 --- a/website/src/i18n/locales/it.json +++ b/website/src/i18n/locales/it.json @@ -6080,9 +6080,9 @@ "default": "predefinito", "filter_agents": "Filtra gli agenti", "no_matches": "Nessuna corrispondenza", - "project_agent": "agente del progetto", - "overrides_global": "sostituisce il globale", - "overrides_global_hint": "La directory del progetto di questo processo definisce un proprio agente con questo nome, quindi viene eseguito al posto di quello globale. Altrove l'agente globale resta invariato.", + "project_agent": "agente della cartella", + "overrides_global": "versione della cartella", + "overrides_global_hint": "Questo job esegue {{name}} della cartella. Il tuo agente salvato resta invariato.", "retry": "Riprova", "retrying": "Nuovo tentativo…", "roster_load_failed": "Impossibile caricare l'elenco degli agenti.", @@ -7336,7 +7336,7 @@ "at": "alle", "auto": "automatico", "auto_approve": "Approva automaticamente", - "browse": "Sfoglia", + "browse": "Scegli directory…", "channel_id": "ID canale", "channel_id_optional": "ID canale (facoltativo)", "command": "Comando", @@ -7372,12 +7372,10 @@ "project_directory_must_be_an_absolute_path": "La directory del progetto deve essere un percorso assoluto (ad es. /Users/you/projects/myrepo).", "project_directory_must_be_an_existing_directory": "La directory del progetto deve essere una directory esistente.", "project_directory_refers_to_a_protected_path": "La directory del progetto fa riferimento a un percorso di sistema protetto e non può essere usata.", - "project_roster_error_falls_back_to_global_agents": "Verrà mostrato invece l'elenco globale degli agenti.", - "agent_reset_not_in_folder": "{{name}} non è definito in questo progetto, quindi l'agente è stato reimpostato su quello predefinito.", - "agent_reset_project_cleared": "La directory del progetto è stata cancellata, quindi {{name}} è stato reimpostato su quello predefinito.", - "couldnt_load_this_folders_agents": "Impossibile caricare gli agenti di questo progetto.", - "couldnt_load_this_folders_agents_detail": "Impossibile caricare gli agenti di questo progetto: {{detail}}.", - "run_this_job_s_agent_in_this_folder_and_offer": "Esegue l'agente di questo job in questo progetto e offre gli agenti definiti nella sua .kiro/agents/ insieme ai tuoi agenti globali.", + "project_roster_error_falls_back_to_global_agents": "Vengono mostrati invece i tuoi agenti salvati.", + "couldnt_load_this_folders_agents": "Impossibile caricare gli agenti di questa cartella.", + "couldnt_load_this_folders_agents_detail": "Impossibile caricare gli agenti di questa cartella: {{detail}}.", + "run_this_job_s_agent_in_this_folder_and_offer": "Cartella in cui lavora questo job. Gli agenti salvati in questa cartella compaiono anche nell'elenco degli agenti qui sotto.", "override_the_model_for_this_job_leave_on_inherit": "Sostituisci il modello per questo job. Lascia su \"Eredita\" per usare il valore predefinito dell'agente o globale.", "save": "Salva", "saving": "Salvataggio in corso...", @@ -7405,7 +7403,8 @@ "chat_folder_was_deleted": "La cartella in cui questa attività archiviava è stata eliminata. Scegline un'altra, o salva per lasciare le esecuzioni non archiviate.", "project_roster_retry": "Riprova", "project_roster_retrying": "Nuovo tentativo…", - "project_directory_placeholder": "ad es. /Users/you/projects/myrepo" + "project_directory_placeholder": "ad es. /Users/you/projects/myrepo", + "agent_not_in_this_folder": "{{detail}}. Scegli un agente di questa cartella." }, "jobLogsView": { "cancel": "Annulla", diff --git a/website/src/i18n/locales/ja.json b/website/src/i18n/locales/ja.json index 4e8944195340..8e3f7f358556 100644 --- a/website/src/i18n/locales/ja.json +++ b/website/src/i18n/locales/ja.json @@ -5848,9 +5848,9 @@ "default": "デフォルト", "filter_agents": "エージェントをフィルター", "no_matches": "マッチするものがありません", - "project_agent": "プロジェクトのエージェント", - "overrides_global": "グローバルを上書き", - "overrides_global_hint": "このジョブのプロジェクトディレクトリが同じ名前のエージェントを独自に定義しているため、グローバルエージェントの代わりにこちらが実行されます。他の場所ではグローバルエージェントは変更されません。", + "project_agent": "フォルダのエージェント", + "overrides_global": "フォルダ版", + "overrides_global_hint": "このジョブはフォルダの {{name}} を実行します。保存済みのエージェントは変更されません。", "retry": "再試行", "retrying": "再試行中…", "roster_load_failed": "エージェント一覧を読み込めませんでした。", @@ -7090,7 +7090,7 @@ "at": "で", "auto": "自動", "auto_approve": "自動承認", - "browse": "参照", + "browse": "ディレクトリを選択…", "channel_id": "チャネルID", "channel_id_optional": "チャネルID (オプション)", "command": "コマンド", @@ -7126,12 +7126,10 @@ "project_directory_must_be_an_absolute_path": "プロジェクトディレクトリは絶対パスである必要があります(例: /Users/you/projects/myrepo)。", "project_directory_must_be_an_existing_directory": "プロジェクトディレクトリは既存のディレクトリである必要があります。", "project_directory_refers_to_a_protected_path": "プロジェクトディレクトリが保護されたシステムパスを参照しているため使用できません。", - "project_roster_error_falls_back_to_global_agents": "代わりにグローバルエージェント一覧を表示しています。", - "agent_reset_not_in_folder": "{{name}} はこのプロジェクトで定義されていないため、エージェントを既定に戻しました。", - "agent_reset_project_cleared": "プロジェクトディレクトリがクリアされたため、{{name}} を既定に戻しました。", - "couldnt_load_this_folders_agents": "このプロジェクトのエージェントを読み込めませんでした。", - "couldnt_load_this_folders_agents_detail": "このプロジェクトのエージェントを読み込めませんでした: {{detail}}。", - "run_this_job_s_agent_in_this_folder_and_offer": "このジョブのエージェントをこのプロジェクトで実行し、グローバルエージェントに加えて、その .kiro/agents/ で定義されたエージェントも提供します。", + "project_roster_error_falls_back_to_global_agents": "代わりに保存済みのエージェントを表示しています。", + "couldnt_load_this_folders_agents": "このフォルダのエージェントを読み込めませんでした。", + "couldnt_load_this_folders_agents_detail": "このフォルダのエージェントを読み込めませんでした: {{detail}}。", + "run_this_job_s_agent_in_this_folder_and_offer": "このジョブが作業するフォルダです。このフォルダに保存されたエージェントも、下のエージェント一覧に表示されます。", "override_the_model_for_this_job_leave_on_inherit": "このジョブのモデルをオーバーライドします。エージェントまたはグローバルのデフォルトを使用する場合は「継承」のままにしてください。", "save": "保存", "saving": "保存中…", @@ -7159,7 +7157,8 @@ "chat_folder_was_deleted": "このジョブが振り分けていたフォルダーは削除されました。別のフォルダーを選んでください。保存すれば振り分けなくなります。", "project_roster_retry": "再試行", "project_roster_retrying": "再試行中…", - "project_directory_placeholder": "例: /Users/you/projects/myrepo" + "project_directory_placeholder": "例: /Users/you/projects/myrepo", + "agent_not_in_this_folder": "{{detail}}。このフォルダのエージェントを選んでください。" }, "jobLogsView": { "cancel": "キャンセル", diff --git a/website/src/i18n/locales/ko.json b/website/src/i18n/locales/ko.json index f08bd5eaa6a0..7af979618449 100644 --- a/website/src/i18n/locales/ko.json +++ b/website/src/i18n/locales/ko.json @@ -5848,9 +5848,9 @@ "default": "기본값", "filter_agents": "에이전트 필터", "no_matches": "일치 항목 없음", - "project_agent": "프로젝트 에이전트", - "overrides_global": "전역 재정의", - "overrides_global_hint": "이 작업의 프로젝트 디렉터리가 같은 이름의 자체 에이전트를 정의하므로 전역 에이전트 대신 이 에이전트가 실행됩니다. 다른 곳에서는 전역 에이전트가 그대로 유지됩니다.", + "project_agent": "폴더 에이전트", + "overrides_global": "폴더 버전", + "overrides_global_hint": "이 작업은 폴더의 {{name}}을(를) 실행합니다. 저장된 에이전트는 변경되지 않습니다.", "retry": "다시 시도", "retrying": "다시 시도 중…", "roster_load_failed": "에이전트 목록을 불러올 수 없습니다.", @@ -7090,7 +7090,7 @@ "at": "시각", "auto": "자동", "auto_approve": "자동 승인", - "browse": "찾아보기", + "browse": "디렉터리 선택…", "channel_id": "채널 ID", "channel_id_optional": "채널 ID (선택 사항)", "command": "명령", @@ -7126,12 +7126,10 @@ "project_directory_must_be_an_absolute_path": "프로젝트 디렉터리는 절대 경로여야 합니다(예: /Users/you/projects/myrepo).", "project_directory_must_be_an_existing_directory": "프로젝트 디렉터리는 실제로 존재하는 디렉터리여야 합니다.", "project_directory_refers_to_a_protected_path": "프로젝트 디렉터리가 보호된 시스템 경로를 참조하므로 사용할 수 없습니다.", - "project_roster_error_falls_back_to_global_agents": "대신 전역 에이전트 목록을 표시합니다.", - "agent_reset_not_in_folder": "{{name}}은(는) 이 프로젝트에 정의되어 있지 않아 에이전트를 기본값으로 되돌렸습니다.", - "agent_reset_project_cleared": "프로젝트 디렉터리가 지워져 {{name}}을(를) 기본값으로 되돌렸습니다.", - "couldnt_load_this_folders_agents": "이 프로젝트의 에이전트를 불러올 수 없습니다.", - "couldnt_load_this_folders_agents_detail": "이 프로젝트의 에이전트를 불러올 수 없습니다: {{detail}}.", - "run_this_job_s_agent_in_this_folder_and_offer": "이 작업의 에이전트를 이 프로젝트에서 실행하고, 전역 에이전트와 함께 해당 .kiro/agents/에 정의된 에이전트도 제공합니다.", + "project_roster_error_falls_back_to_global_agents": "대신 저장된 에이전트를 표시합니다.", + "couldnt_load_this_folders_agents": "이 폴더의 에이전트를 불러올 수 없습니다.", + "couldnt_load_this_folders_agents_detail": "이 폴더의 에이전트를 불러올 수 없습니다: {{detail}}.", + "run_this_job_s_agent_in_this_folder_and_offer": "이 작업이 실행되는 폴더입니다. 이 폴더에 저장된 에이전트도 아래 에이전트 목록에 표시됩니다.", "override_the_model_for_this_job_leave_on_inherit": "이 작업의 모델을 재정의합니다. 에이전트 또는 전역 기본값을 사용하려면 '상속'으로 두세요.", "save": "저장", "saving": "저장 중…", @@ -7159,7 +7157,8 @@ "chat_folder_was_deleted": "이 작업이 정리하던 폴더가 삭제되었습니다. 다른 폴더를 선택하거나, 저장해 실행을 정리하지 않도록 하세요.", "project_roster_retry": "다시 시도", "project_roster_retrying": "다시 시도 중…", - "project_directory_placeholder": "예: /Users/you/projects/myrepo" + "project_directory_placeholder": "예: /Users/you/projects/myrepo", + "agent_not_in_this_folder": "{{detail}}. 이 폴더의 에이전트를 선택하세요." }, "jobLogsView": { "cancel": "취소", diff --git a/website/src/i18n/locales/pt.json b/website/src/i18n/locales/pt.json index 6fd86b476780..e8b6f4e01738 100644 --- a/website/src/i18n/locales/pt.json +++ b/website/src/i18n/locales/pt.json @@ -6080,9 +6080,9 @@ "default": "padrão", "filter_agents": "Filtrar agentes", "no_matches": "Nenhum resultado", - "project_agent": "agente do projeto", - "overrides_global": "substitui o global", - "overrides_global_hint": "O diretório do projeto desta tarefa define o próprio agente com este nome, por isso é ele que é executado em vez do agente global. Noutros locais, o agente global permanece inalterado.", + "project_agent": "agente da pasta", + "overrides_global": "versão da pasta", + "overrides_global_hint": "Este job executa o {{name}} da pasta. Seu agente salvo continua igual.", "retry": "Tentar novamente", "retrying": "Tentando novamente…", "roster_load_failed": "Não foi possível carregar a lista de agentes.", @@ -7336,7 +7336,7 @@ "at": "às", "auto": "auto", "auto_approve": "Aprovar automaticamente", - "browse": "Procurar", + "browse": "Escolher diretório…", "channel_id": "ID do canal", "channel_id_optional": "ID do canal (opcional)", "command": "Comando", @@ -7372,12 +7372,10 @@ "project_directory_must_be_an_absolute_path": "O diretório do projeto deve ser um caminho absoluto (ex.: /Users/you/projects/myrepo).", "project_directory_must_be_an_existing_directory": "O diretório do projeto deve ser um diretório existente.", "project_directory_refers_to_a_protected_path": "O diretório do projeto faz referência a um caminho de sistema protegido e não pode ser usado.", - "project_roster_error_falls_back_to_global_agents": "Mostrando a lista global de agentes em vez disso.", - "agent_reset_not_in_folder": "{{name}} não está definido neste projeto, portanto o agente foi redefinido para o padrão.", - "agent_reset_project_cleared": "O diretório do projeto foi limpo, portanto {{name}} foi redefinido para o padrão.", - "couldnt_load_this_folders_agents": "Não foi possível carregar os agentes deste projeto.", - "couldnt_load_this_folders_agents_detail": "Não foi possível carregar os agentes deste projeto: {{detail}}.", - "run_this_job_s_agent_in_this_folder_and_offer": "Executa o agente deste job neste projeto e oferece os agentes definidos em seu .kiro/agents/, além dos seus agentes globais.", + "project_roster_error_falls_back_to_global_agents": "Mostrando seus agentes salvos em vez disso.", + "couldnt_load_this_folders_agents": "Não foi possível carregar os agentes desta pasta.", + "couldnt_load_this_folders_agents_detail": "Não foi possível carregar os agentes desta pasta: {{detail}}.", + "run_this_job_s_agent_in_this_folder_and_offer": "Pasta em que este job trabalha. Agentes salvos nesta pasta também aparecem na lista de agentes abaixo.", "override_the_model_for_this_job_leave_on_inherit": "Substitui o modelo deste job. Deixe em \"Herdar\" para usar o padrão do agente ou o global.", "save": "Salvar", "saving": "Salvando...", @@ -7405,7 +7403,8 @@ "chat_folder_was_deleted": "A pasta em que esta tarefa arquivava foi excluída. Escolha outra ou salve para deixar as execuções sem arquivar.", "project_roster_retry": "Tentar novamente", "project_roster_retrying": "Tentando novamente…", - "project_directory_placeholder": "ex.: /Users/you/projects/myrepo" + "project_directory_placeholder": "ex.: /Users/you/projects/myrepo", + "agent_not_in_this_folder": "{{detail}}. Escolha um agente desta pasta." }, "jobLogsView": { "cancel": "Cancelar", diff --git a/website/src/i18n/locales/ru.json b/website/src/i18n/locales/ru.json index 55b3a25bc925..88567b5328b0 100644 --- a/website/src/i18n/locales/ru.json +++ b/website/src/i18n/locales/ru.json @@ -6181,9 +6181,9 @@ "default": "по умолчанию", "filter_agents": "Фильтр агентов", "no_matches": "Нет совпадений", - "project_agent": "агент проекта", - "overrides_global": "переопределяет глобальный", - "overrides_global_hint": "В каталоге проекта этого задания определён собственный агент с таким именем, поэтому запускается он, а не глобальный агент. В других местах глобальный агент не меняется.", + "project_agent": "агент папки", + "overrides_global": "версия из папки", + "overrides_global_hint": "Это задание запускает {{name}} из папки. Ваш сохранённый агент не меняется.", "retry": "Повторить", "retrying": "Повторная попытка…", "roster_load_failed": "Не удалось загрузить список агентов.", @@ -7459,7 +7459,7 @@ "at": "в", "auto": "авто", "auto_approve": "Автоподтверждение", - "browse": "Обзор", + "browse": "Выбрать каталог…", "channel_id": "ID канала", "channel_id_optional": "ID канала (необязательно)", "command": "Команда", @@ -7495,12 +7495,10 @@ "project_directory_must_be_an_absolute_path": "Каталог проекта должен быть абсолютным путём (например, /Users/you/projects/myrepo).", "project_directory_must_be_an_existing_directory": "Каталог проекта должен быть существующим каталогом.", "project_directory_refers_to_a_protected_path": "Каталог проекта указывает на защищённый системный путь и не может быть использован.", - "project_roster_error_falls_back_to_global_agents": "Вместо этого показывается глобальный список агентов.", - "agent_reset_not_in_folder": "{{name}} не определён в этом проекте, поэтому агент сброшен на стандартный.", - "agent_reset_project_cleared": "Каталог проекта был очищен, поэтому {{name}} сброшен на стандартный.", - "couldnt_load_this_folders_agents": "Не удалось загрузить агентов этого проекта.", - "couldnt_load_this_folders_agents_detail": "Не удалось загрузить агентов этого проекта: {{detail}}.", - "run_this_job_s_agent_in_this_folder_and_offer": "Запускает агента этого задания в этом проекте и предлагает агентов, определённых в его .kiro/agents/, вместе с твоими глобальными агентами.", + "project_roster_error_falls_back_to_global_agents": "Вместо этого показаны ваши сохранённые агенты.", + "couldnt_load_this_folders_agents": "Не удалось загрузить агентов этой папки.", + "couldnt_load_this_folders_agents_detail": "Не удалось загрузить агентов этой папки: {{detail}}.", + "run_this_job_s_agent_in_this_folder_and_offer": "Папка, в которой работает это задание. Агенты, сохранённые в этой папке, тоже появятся в списке агентов ниже.", "override_the_model_for_this_job_leave_on_inherit": "Переопределить модель для этого задания. Оставьте «Наследовать», чтобы использовать модель агента или глобальную по умолчанию.", "save": "Сохранить", "saving": "Сохранение...", @@ -7528,7 +7526,8 @@ "chat_folder_was_deleted": "Папка, в которую попадали запуски этой задачи, удалена. Выберите другую или сохраните, чтобы не размещать их в папке.", "project_roster_retry": "Повторить", "project_roster_retrying": "Повторная попытка…", - "project_directory_placeholder": "например, /Users/you/projects/myrepo" + "project_directory_placeholder": "например, /Users/you/projects/myrepo", + "agent_not_in_this_folder": "{{detail}}. Выберите агента из этой папки." }, "jobLogsView": { "cancel": "Отмена", diff --git a/website/src/i18n/locales/zh-CN.json b/website/src/i18n/locales/zh-CN.json index 85fc62eb5413..2db381f2cc58 100644 --- a/website/src/i18n/locales/zh-CN.json +++ b/website/src/i18n/locales/zh-CN.json @@ -5878,9 +5878,9 @@ "default": "默认", "filter_agents": "筛选代理", "no_matches": "无匹配项", - "project_agent": "项目代理", - "overrides_global": "覆盖全局", - "overrides_global_hint": "此作业的项目目录自行定义了同名代理,因此运行该代理而非全局代理。在其他位置,全局代理保持不变。", + "project_agent": "文件夹代理", + "overrides_global": "文件夹中的版本", + "overrides_global_hint": "此任务运行文件夹中的 {{name}}。你已保存的代理不受影响。", "retry": "重试", "retrying": "正在重试…", "roster_load_failed": "无法加载 Agent 列表。", @@ -7090,7 +7090,7 @@ "at": "于", "auto": "自动", "auto_approve": "自动审批", - "browse": "浏览", + "browse": "选择目录…", "channel_id": "频道 ID", "channel_id_optional": "频道 ID(可选)", "command": "命令", @@ -7126,12 +7126,10 @@ "project_directory_must_be_an_absolute_path": "项目目录必须是绝对路径(例如 /Users/you/projects/myrepo)。", "project_directory_must_be_an_existing_directory": "项目目录必须是一个已存在的目录。", "project_directory_refers_to_a_protected_path": "项目目录指向受保护的系统路径,无法使用。", - "project_roster_error_falls_back_to_global_agents": "改为显示全局代理列表。", - "agent_reset_not_in_folder": "{{name}} 未在此项目中定义,因此代理已重置为默认值。", - "agent_reset_project_cleared": "项目目录已清空,因此 {{name}} 已重置为默认值。", - "couldnt_load_this_folders_agents": "无法加载此项目的代理。", - "couldnt_load_this_folders_agents_detail": "无法加载此项目的代理:{{detail}}。", - "run_this_job_s_agent_in_this_folder_and_offer": "此任务将在该项目中运行对应代理,并把 .kiro/agents/ 中定义的代理与全局代理一起提供选择。", + "project_roster_error_falls_back_to_global_agents": "改为显示你已保存的代理。", + "couldnt_load_this_folders_agents": "无法加载此文件夹的代理。", + "couldnt_load_this_folders_agents_detail": "无法加载此文件夹的代理:{{detail}}。", + "run_this_job_s_agent_in_this_folder_and_offer": "此任务的工作文件夹。保存在此文件夹中的代理也会出现在下方的代理列表中。", "override_the_model_for_this_job_leave_on_inherit": "为此任务覆盖模型。保持“继承”则使用代理或全局默认值。", "save": "保存", "saving": "保存中…", @@ -7159,7 +7157,8 @@ "chat_folder_was_deleted": "此任务原先归档的文件夹已被删除。请另选一个,或直接保存以不再归档运行记录。", "project_roster_retry": "重试", "project_roster_retrying": "正在重试…", - "project_directory_placeholder": "例如 /Users/you/projects/myrepo" + "project_directory_placeholder": "例如 /Users/you/projects/myrepo", + "agent_not_in_this_folder": "{{detail}}。请从此文件夹中选择一个代理。" }, "jobLogsView": { "cancel": "取消", diff --git a/website/src/pages/SchedulePage.tsx b/website/src/pages/SchedulePage.tsx index d4b335d30cc0..56ab2aa79a5e 100644 --- a/website/src/pages/SchedulePage.tsx +++ b/website/src/pages/SchedulePage.tsx @@ -1653,7 +1653,7 @@ function JobDetailDialog({ job, prefill, prefillWrites, agents, defaultAgent, ro // screenshot harness caught that; it renders its full height // now and scrolls within its own 200px cap as intended. className={ - job.script + job.script || job.command ? 'shrink-0 max-h-[200px] overflow-y-auto font-mono' : 'shrink-0 max-h-[200px] overflow-y-auto' } diff --git a/website/src/test/AgentSelector.overrideDetail.test.tsx b/website/src/test/AgentSelector.overrideDetail.test.tsx index ff9357df7e93..26292ff7564f 100644 --- a/website/src/test/AgentSelector.overrideDetail.test.tsx +++ b/website/src/test/AgentSelector.overrideDetail.test.tsx @@ -4,14 +4,11 @@ import AgentSelector from '../components/AgentSelector' import type { KiroCrewAgent } from '../components/AgentSelector' /** - * A shadowed collision row explains the override on its detail line. That line - * used to open with `{{name}}` — but the row title directly above already - * shows the name, so repeating it pushed the actual meaning ("…instead of your - * global agent") past the line's own `truncate` and rendered "…of this n…" on - * the 400px popover (UX Review span=7ddb24260c79). The detail now leads with - * the meaning and the name lives in the title alone. + * A shadowed collision row explains the override on its detail line: which + * same-named definition runs and where it lives. The name sits mid-sentence + * rather than leading it, because the row title directly above already shows it. */ -describe('AgentSelector override-detail line does not repeat the agent name', () => { +describe('AgentSelector override-detail line names the definition that runs', () => { const collision: KiroCrewAgent[] = [ { name: 'reviewer', kiro_agent: '', workspace: 'default', memory_store: 'default', @@ -19,7 +16,7 @@ describe('AgentSelector override-detail line does not repeat the agent name', () }, ] - it('states the override starting from the meaning, not the name', () => { + it("names this project's definition as the one that runs", () => { render( { vi.mocked(api.kirocrewAgents).mockClear() }) -describe('JobForm — project agent origin and reset', () => { +describe('JobForm — project agent origin and pick retention', () => { + it('explains the directory field in plain words and names its button apart from the picker tab', () => { + // UX Review (blind read): "I don't know what a "project" is here, and the + // hint mentions ".kiro/agents/", which means nothing to me"; and the + // field's "Browse" button opened a picker with its own "Browse" tab. + mount() + expect( + screen.getByText( + 'Folder this job works in. Agents saved in this folder also appear in the Agent list below.', + ), + ).toBeInTheDocument() + expect(screen.queryByText(/\.kiro\/agents\//)).not.toBeInTheDocument() + expect(screen.getByRole('button', { name: 'Choose directory…' })).toBeInTheDocument() + expect(screen.queryByRole('button', { name: 'Browse' })).not.toBeInTheDocument() + }) + it('marks a project-supplied agent as coming from this project, and only it', async () => { vi.mocked(api.kirocrewAgents).mockResolvedValueOnce(projectRoster) mount() @@ -82,16 +97,16 @@ describe('JobForm — project agent origin and reset', () => { const listbox = screen.getByRole('listbox') expect(within(listbox).getByRole('option', { name: /repo-smoke/ })).toHaveTextContent( - 'project agent', + 'folder agent', ) // The configured row must NOT carry it -- that is the whole point of keying // on scope rather than on the payload the project fetch returned. expect(within(listbox).getByRole('option', { name: /default/ })).not.toHaveTextContent( - 'project agent', + 'folder agent', ) }) - it('says which agent it cleared when the new folder no longer defines it', async () => { + it('keeps the pick when the new folder does not define it', async () => { // Folder A supplies `repo-smoke`; folder B supplies only the global. vi.mocked(api.kirocrewAgents) .mockResolvedValueOnce(projectRoster) @@ -105,10 +120,11 @@ describe('JobForm — project agent origin and reset', () => { ) fireEvent.click(screen.getByRole('option', { name: /repo-smoke/ })) - // Move to a folder that does not define it -- the reset fires here. + // Move to a folder that does not define it. Whether it resolves there is + // Save's call, not the picker's. fireEvent.change(screen.getByLabelText('Project directory'), { target: { value: '/repo-b' } }) - - const note = await screen.findByTestId('jobform-agent-reset-note') - expect(note.textContent).toContain('repo-smoke') + await waitFor(() => expect(api.kirocrewAgents).toHaveBeenCalledTimes(2)) + expect(screen.getByLabelText('Switch agent')).toHaveTextContent('repo-smoke') + expect(screen.queryByTestId('jobform-agent-reset-note')).not.toBeInTheDocument() }) }) diff --git a/website/src/test/JobForm.projectAgentReset.test.tsx b/website/src/test/JobForm.projectAgentReset.test.tsx index f1a2acbdc536..de68579e3e7d 100644 --- a/website/src/test/JobForm.projectAgentReset.test.tsx +++ b/website/src/test/JobForm.projectAgentReset.test.tsx @@ -6,6 +6,7 @@ import JobForm from '../components/JobForm' import type { KiroCrewAgent } from '../components/AgentSelector' import type { CronJob } from '../types' import { api } from '../api/client' +import { ApiError } from '../api/apiError' vi.mock('../api/client', () => ({ api: { @@ -61,35 +62,35 @@ beforeEach(() => { afterEach(() => { vi.useRealTimers() }) /** - * GPT 5.6 Review F2: switching the project directory from project A to - * project B (WITHOUT ever clearing it in between) left the picker's `agent` - * state untouched -- only the `!projectPath` early-return branch reconciled - * a stale selection, so the A-project agent stayed selected after B's - * roster loaded even though B's roster does not contain that name. Save - * would then persist an agent name B's project cannot resolve, and the - * scheduled fire silently falls back to the default agent's prompt, tools, - * and permissions with no error surfaced anywhere. Fixed by reconciling the - * selection against the union of the newly-fetched project roster and the - * global roster inside the success branch of the folder-change effect - * itself, not just the cleared-folder branch. + * A directory change never rewrites the agent pick. The form cannot tell from + * its catalogs whether a name resolves under a folder -- neither lists every + * template the resolver accepts -- so clearing on what they omit discarded + * valid bindings and Save stored the default agent in their place. The backend + * makes that call: Save refuses an unresolvable agent with a 400 naming the + * agent and folder, and the form shows that refusal. */ -describe('JobForm reconciles the agent picker when the project directory switches project', () => { - it('clears a project-A-only agent that does not exist under project B', async () => { +describe('JobForm keeps the agent pick when the project directory switches project', () => { + it('keeps a project-A pick under project B, sends it on Save, and shows the refusal', async () => { vi.mocked(api.kirocrewAgents) .mockResolvedValueOnce({ agents: [{ name: 'repo-a-bot', kiro_agent: 'repo-a-bot', workspace: 'repo-a', memory_store: 'repo-a', - description: 'repo A agent', source: 'project', + description: 'repo A agent', source: 'project', scope: 'project', }], default_agent: '', }) .mockResolvedValueOnce({ agents: [{ name: 'repo-b-bot', kiro_agent: 'repo-b-bot', workspace: 'repo-b', memory_store: 'repo-b', - description: 'repo B agent', source: 'project', + description: 'repo B agent', source: 'project', scope: 'project', }], default_agent: '', }) + const refusal = "Agent 'repo-a-bot' not found in project directory '/Users/you/projects/repo-b'" + vi.mocked(api.updateCron).mockClear() + vi.mocked(api.updateCron).mockRejectedValueOnce( + new ApiError(400, refusal, JSON.stringify({ error: refusal, code: 'unknown_agent' })), + ) renderJobForm(withDefaultAgent) @@ -99,26 +100,27 @@ describe('JobForm reconciles the agent picker when the project directory switche await waitFor(() => expect(api.kirocrewAgents).toHaveBeenCalledTimes(1)) fireEvent.click(screen.getByLabelText('Switch agent')) - // The resolved roster now propagates through useQuery (an extra render - // hop past the raw fetch call above), so wait for the option to actually - // be in the DOM before clicking it -- a bare `getByRole` can race that - // hop and see an empty listbox. + // The resolved roster propagates through useQuery (an extra render hop past + // the raw fetch call above), so wait for the option before clicking it. await waitFor(() => expect(screen.getByRole('option', { name: /repo-a-bot/ })).toBeInTheDocument()) fireEvent.click(screen.getByRole('option', { name: /repo-a-bot/ })) await waitFor(() => expect(screen.getByLabelText('Switch agent')).toHaveTextContent('repo-a-bot')) - // Switch straight to project B, never clearing the field in between. fireEvent.change(screen.getByLabelText('Project directory'), { target: { value: '/Users/you/projects/repo-b' }, }) await waitFor(() => expect(api.kirocrewAgents).toHaveBeenCalledTimes(2)) + await waitFor(() => expect(screen.getByLabelText('Switch agent')).toHaveTextContent('repo-a-bot')) - // repo-a-bot exists in neither B's project roster nor the global - // roster, so the selection must be cleared back to default. - await waitFor(() => - expect(screen.getByLabelText('Switch agent')).toHaveTextContent('default'), + fireEvent.click(screen.getByRole('button', { name: 'Save' })) + await waitFor(() => expect(api.updateCron).toHaveBeenCalledTimes(1)) + expect(vi.mocked(api.updateCron).mock.calls[0][1]).toMatchObject({ + agent: 'repo-a-bot', project_path: '/Users/you/projects/repo-b', + }) + // At the Agent field, with what to do next -- not form-wide under Save. + expect(await screen.findByTestId('jobform-agent-save-error')).toHaveTextContent( + `${refusal}. Pick an agent from this folder.`, ) - expect(screen.getByLabelText('Switch agent')).not.toHaveTextContent('repo-a-bot') }) it('keeps a project-only agent selected when it also exists under the new project', async () => { @@ -126,14 +128,14 @@ describe('JobForm reconciles the agent picker when the project directory switche .mockResolvedValueOnce({ agents: [{ name: 'shared-bot', kiro_agent: 'shared-bot', workspace: 'repo-a', memory_store: 'repo-a', - description: 'shared agent', source: 'project', + description: 'shared agent', source: 'project', scope: 'project', }], default_agent: '', }) .mockResolvedValueOnce({ agents: [{ name: 'shared-bot', kiro_agent: 'shared-bot', workspace: 'repo-b', memory_store: 'repo-b', - description: 'shared agent', source: 'project', + description: 'shared agent', source: 'project', scope: 'project', }], default_agent: '', }) @@ -185,7 +187,7 @@ describe('JobForm reconciles the agent picker when the project directory switche expect(screen.getByLabelText('Switch agent')).toHaveTextContent('ea-dev') }) - it('clears a project-A agent when the global catalog fails but project B loads', async () => { + it('keeps a project-A pick when the global catalog fails but project B loads', async () => { vi.mocked(api.kirocrewAgents) .mockResolvedValueOnce({ agents: [{ @@ -216,10 +218,76 @@ describe('JobForm reconciles the agent picker when the project directory switche fireEvent.change(projectDirectory, { target: { value: '/Users/you/projects/repo-b' } }) await waitFor(() => expect(api.kirocrewAgents).toHaveBeenCalledTimes(2)) - await waitFor(() => - expect(screen.getByLabelText('Switch agent')).not.toHaveTextContent('repo-a-bot'), - ) - expect(screen.getByTestId('jobform-agent-reset-note')).toHaveTextContent('repo-a-bot') + await waitFor(() => expect(screen.getByLabelText('Switch agent')).toHaveTextContent('repo-a-bot')) + }) + + /** The project roster for `/Users/you/projects/repo`: one folder agent, and no + * installed shared template, which the project endpoint never lists. */ + function mockRepoRoster() { + vi.mocked(api.kirocrewAgents).mockResolvedValue({ + agents: [{ + name: 'repo-bot', kiro_agent: 'repo-bot', workspace: 'repo', memory_store: 'repo', + description: 'repo agent', source: 'project', scope: 'project', + }], + default_agent: '', + }) + } + + /** Waits until the project roster has reached the picker, which happens in the + * same effect run that reconciles the saved pick against it. */ + async function waitForProjectRoster() { + fireEvent.click(screen.getByLabelText('Switch agent')) + await waitFor(() => expect(screen.getByRole('option', { name: /repo-bot/ })).toBeInTheDocument()) + fireEvent.keyDown(document.activeElement || document.body, { key: 'Escape' }) + } + + const sharedTemplate: KiroCrewAgent = { + name: 'shared-tpl', kiro_agent: 'shared-tpl', workspace: 'default', memory_store: 'default', + description: 'installed template', source: 'kirocrew', + } + const boundJob = () => messageJob({ agent: 'shared-tpl', project_path: '/Users/you/projects/repo' }) + const formProps = (overrides: Partial>) => ({ + job: boundJob(), defaultAgent: '', onSaved: () => {}, layout: 'vertical' as const, ...overrides, + }) + + it('keeps a saved template while the global catalog is pending, and after it then fails', async () => { + // GPT 6.1 Review: the project roster settled before the global catalog, + // omitted the template, and the pick was cleared; a later catalog failure + // left it cleared, so saving any unrelated edit stored the default agent. + mockRepoRoster() + const { rerender } = renderWithProviders() + await waitForProjectRoster() + + expect(screen.getByLabelText('Switch agent')).toHaveTextContent('shared-tpl') + expect(screen.queryByTestId('jobform-agent-reset-note')).not.toBeInTheDocument() + + const failure = { reloading: false, onReload: () => {} } + rerender() + expect(screen.getByLabelText('Switch agent')).toHaveTextContent('shared-tpl') + + rerender() + expect(screen.getByLabelText('Switch agent')).toHaveTextContent('shared-tpl') + expect(screen.queryByTestId('jobform-agent-reset-note')).not.toBeInTheDocument() + }) + + it('keeps and saves a runtime-owned template that no loaded catalog lists', async () => { + // GPT 6.1 Review: an installed runtime-owned template (`kirocrew-lite`) is + // accepted by the backend resolver but omitted by both pickers' catalogs, + // so catalog absence cleared it and an unrelated save stored `agent_id: ''`. + // Catalog absence is not a resolution failure; only a pick the previous + // folder defined is cleared. + mockRepoRoster() + vi.mocked(api.updateCron).mockResolvedValue({} as never) + const job = messageJob({ agent: 'kirocrew-lite', project_path: '/Users/you/projects/repo' }) + renderWithProviders() + await waitForProjectRoster() + + expect(screen.getByLabelText('Switch agent')).toHaveTextContent('kirocrew-lite') + expect(screen.queryByTestId('jobform-agent-reset-note')).not.toBeInTheDocument() + + fireEvent.click(screen.getByRole('button', { name: 'Save' })) + await waitFor(() => expect(api.updateCron).toHaveBeenCalled()) + expect(api.updateCron).toHaveBeenCalledWith('j1', expect.objectContaining({ agent: 'kirocrew-lite' })) }) it('keeps a globally valid pick when the global catalog fails but project B loads it', async () => { @@ -296,76 +364,10 @@ describe('JobForm reconciles the agent picker when the project directory switche expect(screen.getByLabelText('Switch agent')).toHaveTextContent('repo-a-bot') }) - it('restores a pick an intermediate path cleared once the finished path defines it', async () => { - // UX Review: the debounce above only protects a path typed FASTER than - // 250ms. Hand-editing a bound job's directory pauses longer than that, so an - // intermediate path becomes a roster identity of its own -- and - // `GET /api/agents?project_path=` answers an unusable path with HTTP 200 and - // the globals alone, so that roster legitimately lacks the picked project - // agent and the reconcile clears it. Clearing on what it knows is right; the - // defect was that the pick never came BACK once the finished path loaded a - // roster that does define the name, so every path edit on a bound job forced - // a re-pick, and the acknowledgment for a reset still in force was erased by - // the next intermediate settle. - const projectAgent = { - name: 'repo-a-bot', kiro_agent: 'repo-a-bot', workspace: 'repo-a', memory_store: 'repo-a', - description: 'repo A agent', source: 'project', scope: 'project', - } - const initialPath = '/Users/you/projects/repo-a' - const halfTyped = `${initialPath}-v` - const finalPath = `${initialPath}-v2` - vi.mocked(api.kirocrewAgents).mockImplementation(async (_sessionKey, path) => ({ - agents: path === initialPath || path === finalPath ? [projectAgent] : [], - default_agent: '', - })) - - renderJobForm(withDefaultAgent) - - const projectDirectory = screen.getByLabelText('Project directory') - fireEvent.change(projectDirectory, { target: { value: initialPath } }) - await waitFor(() => expect(api.kirocrewAgents).toHaveBeenCalledTimes(1)) - - fireEvent.click(screen.getByLabelText('Switch agent')) - await waitFor(() => expect(screen.getByRole('option', { name: /repo-a-bot/ })).toBeInTheDocument()) - fireEvent.click(screen.getByRole('option', { name: /repo-a-bot/ })) - await waitFor(() => expect(screen.getByLabelText('Switch agent')).toHaveTextContent('repo-a-bot')) - - // Pause on a half-typed path long enough for it to settle and be queried. - fireEvent.change(projectDirectory, { target: { value: halfTyped } }) - await waitFor(() => expect(api.kirocrewAgents).toHaveBeenCalledTimes(2), { timeout: 2000 }) - await waitFor(() => - expect(screen.getByLabelText('Switch agent')).not.toHaveTextContent('repo-a-bot'), - ) - // The reset IS announced, and stays announced while it is still in force. - expect(screen.getByTestId('jobform-agent-reset-note')).toHaveTextContent('repo-a-bot') - - // Finish the path. Its roster defines the name again, so the operator's own - // pick comes back rather than leaving them to re-pick it. - fireEvent.change(projectDirectory, { target: { value: finalPath } }) - await waitFor(() => expect(api.kirocrewAgents).toHaveBeenCalledTimes(3), { timeout: 2000 }) - - await waitFor(() => - expect(screen.getByLabelText('Switch agent')).toHaveTextContent('repo-a-bot'), - ) - // Nothing was lost after all, so the acknowledgment must not linger. - expect(screen.queryByTestId('jobform-agent-reset-note')).not.toBeInTheDocument() - }) }) -/** - * Selecting a project-scoped agent (only offered because a working - * directory was set), then clearing that project directory, previously left - * the picker's `agent` state untouched: `effectiveAgents` correctly fell - * back to the global roster once `projectAgents` cleared, but the SELECTED - * name was never reset, so save sent that now-unresolvable name with an - * empty `project_path`. Kiro cannot resolve a project agent without its - * project scope and silently falls back to the default agent's prompt, - * tools, and permissions -- with no error surfaced anywhere to say so. - * Fixed by clearing the selection back to the global default whenever it is - * not a name the global roster itself recognizes. - */ -describe('JobForm clears a project-only agent selection when the project directory is cleared', () => { - it('resets the agent picker to the default once the project agent is no longer resolvable', async () => { +describe('JobForm keeps the agent pick when the project directory is cleared', () => { + it('keeps a project-only pick, sends it on Save, and shows the refusal', async () => { vi.mocked(api.kirocrewAgents).mockResolvedValueOnce({ agents: [{ name: 'repo-bot', kiro_agent: 'repo-bot', workspace: 'repo', memory_store: 'repo', @@ -373,34 +375,34 @@ describe('JobForm clears a project-only agent selection when the project directo }], default_agent: '', }) + const refusal = "Agent 'repo-bot' is not a configured agent" + vi.mocked(api.updateCron).mockClear() + vi.mocked(api.updateCron).mockRejectedValueOnce( + new ApiError(400, refusal, JSON.stringify({ error: refusal, code: 'unknown_agent' })), + ) renderJobForm(withDefaultAgent) fireEvent.change(screen.getByLabelText('Project directory'), { target: { value: '/Users/you/projects/myrepo' }, }) await waitFor(() => expect(api.kirocrewAgents).toHaveBeenCalled()) - - // Select the project-only agent via the AgentSelector's listbox. Wait - // for the roster to have propagated through useQuery (an extra render - // hop past the raw fetch call above) before clicking the option -- a - // bare `getByRole` can race that hop and see an empty listbox. fireEvent.click(screen.getByLabelText('Switch agent')) await waitFor(() => expect(screen.getByRole('option', { name: /repo-bot/ })).toBeInTheDocument()) fireEvent.click(screen.getByRole('option', { name: /repo-bot/ })) await waitFor(() => expect(screen.getByLabelText('Switch agent')).toHaveTextContent('repo-bot')) - // Now clear the project directory -- the project-only agent must no - // longer be shown as selected. + vi.useFakeTimers() fireEvent.change(screen.getByLabelText('Project directory'), { target: { value: '' } }) + // Past the 250ms debounce, which turns the roster query off and re-runs the + // roster effect a second time. + await act(async () => { await vi.advanceTimersByTimeAsync(250) }) + vi.useRealTimers() + expect(screen.getByLabelText('Switch agent')).toHaveTextContent('repo-bot') - await waitFor(() => - expect(screen.getByLabelText('Switch agent')).toHaveTextContent('default'), - ) - expect(screen.getByLabelText('Switch agent')).not.toHaveTextContent('repo-bot') - const note = screen.getByTestId('jobform-agent-reset-note') - expect(note).toHaveTextContent('repo-bot') - expect(note).toHaveTextContent('project directory was cleared') - expect(note).not.toHaveTextContent("isn't defined in this project") + fireEvent.click(screen.getByRole('button', { name: 'Save' })) + await waitFor(() => expect(api.updateCron).toHaveBeenCalledTimes(1)) + expect(vi.mocked(api.updateCron).mock.calls[0][1]).toMatchObject({ agent: 'repo-bot', project_path: '' }) + expect(await screen.findByText(refusal)).toBeInTheDocument() }) it('leaves a global agent selection untouched when the project directory clears', async () => { @@ -462,165 +464,6 @@ describe('JobForm clears a project-only agent selection when the project directo expect(screen.getByLabelText('Switch agent')).toHaveTextContent('ea-dev') }) - it('clears a project agent on a project-only install, where the global roster is legitimately empty', async () => { - // GPT 5.6 Review F2. The guard that fixed the test above tested the - // WRONG thing: it asked "is the global roster non-empty?" as a proxy for - // "has the roster loaded?". Those diverge on an install whose agents are - // all project-scoped -- the roster IS loaded and IS legitimately empty -- - // so the clear was skipped, the unresolvable name was saved with an empty - // project_path, and every fire silently ran the default agent instead. - // - // The fix decides on positive knowledge: the name came from - // `projectAgents`, so we KNOW it was the folder's. That also cannot - // misfire on a crew-bound form (`CrewWakeSection` passes `agents={[]}`) - // or on an app agent under `~/.kiro/agents/`, neither of which is ever - // in the folder's roster. - vi.mocked(api.kirocrewAgents).mockResolvedValueOnce({ - agents: [{ - name: 'repo-bot', kiro_agent: 'repo-bot', workspace: 'repo', memory_store: 'repo', - description: 'repo agent', source: 'project', scope: 'project', - }], - default_agent: '', - }) - renderJobForm() - - fireEvent.change(screen.getByLabelText('Project directory'), { - target: { value: '/Users/you/projects/myrepo' }, - }) - await waitFor(() => expect(api.kirocrewAgents).toHaveBeenCalled()) - - fireEvent.click(screen.getByLabelText('Switch agent')) - await waitFor(() => expect(screen.getByRole('option', { name: /repo-bot/ })).toBeInTheDocument()) - fireEvent.click(screen.getByRole('option', { name: /repo-bot/ })) - await waitFor(() => expect(screen.getByLabelText('Switch agent')).toHaveTextContent('repo-bot')) - - fireEvent.change(screen.getByLabelText('Project directory'), { target: { value: '' } }) - - // The project agent must be gone even though the global roster is empty. - await waitFor(() => - expect(screen.getByLabelText('Switch agent')).not.toHaveTextContent('repo-bot'), - ) - }) - - it('keeps the reset notice readable after the debounce settles, not just for 250ms', async () => { - // The notice appeared and then VANISHED. Clearing the field fires the - // effect TWICE: once when `projectPath` empties, then again when - // `debouncedProjectPath` (250ms) settles and `enabled: !!debouncedProjectPath` - // turns the roster query off, moving `projectAgentsData` to `undefined` -- - // a dependency change. That second run saw the agent the first run had - // already cleared, so `cleared` computed false and it wrote - // `setAgentResetFrom('')`, erasing its own acknowledgment. - // - // Every assertion in this file still passed, because they all read the - // notice SYNCHRONOUSLY inside that window. A browser probe showed it - // present at 200ms and gone at 400ms, so the acknowledgment UX Review - // asked for was unreadable in practice. This test reads it after the - // debounce, which is when a human would. - vi.mocked(api.kirocrewAgents).mockResolvedValueOnce({ - agents: [{ - name: 'repo-bot', kiro_agent: 'repo-bot', workspace: 'repo', memory_store: 'repo', - description: 'repo agent', source: 'project', scope: 'project', - }], - default_agent: '', - }) - renderJobForm(withDefaultAgent) - - fireEvent.change(screen.getByLabelText('Project directory'), { - target: { value: '/Users/you/projects/myrepo' }, - }) - await waitFor(() => expect(api.kirocrewAgents).toHaveBeenCalled()) - fireEvent.click(screen.getByLabelText('Switch agent')) - await waitFor(() => expect(screen.getByRole('option', { name: /repo-bot/ })).toBeInTheDocument()) - fireEvent.click(screen.getByRole('option', { name: /repo-bot/ })) - await waitFor(() => expect(screen.getByLabelText('Switch agent')).toHaveTextContent('repo-bot')) - - vi.useFakeTimers() - fireEvent.change(screen.getByLabelText('Project directory'), { target: { value: '' } }) - expect(screen.getByTestId('jobform-agent-reset-note')).toBeInTheDocument() - - // Settle the 250ms debounce and flush the query-disabling re-render. - await act(async () => { await vi.advanceTimersByTimeAsync(250) }) - - const note = screen.getByTestId('jobform-agent-reset-note') - expect(note).toHaveTextContent('repo-bot') - expect(note).toHaveTextContent('project directory was cleared') - }) - - it('announces a SECOND clear too, rather than staying silent after the first', async () => { - // The guard that fixed the test above is armed per empty field, so a bound - // path has to re-arm it. Without that, the effect would suppress every - // later reset for the lifetime of the form: the user binds another folder, - // picks another project agent, clears again -- and that pick would vanish - // with no acknowledgment at all, which is the exact silent-reset defect the - // notice exists to prevent. - vi.mocked(api.kirocrewAgents).mockResolvedValue({ - agents: [{ - name: 'repo-bot', kiro_agent: 'repo-bot', workspace: 'repo', memory_store: 'repo', - description: 'repo agent', source: 'project', scope: 'project', - }], - default_agent: '', - }) - renderJobForm(withDefaultAgent) - const field = screen.getByLabelText('Project directory') - - for (const round of [1, 2]) { - fireEvent.change(field, { target: { value: `/Users/you/projects/repo-${round}` } }) - fireEvent.click(screen.getByLabelText('Switch agent')) - await waitFor(() => expect(screen.getByRole('option', { name: /repo-bot/ })).toBeInTheDocument()) - fireEvent.click(screen.getByRole('option', { name: /repo-bot/ })) - await waitFor(() => expect(screen.getByLabelText('Switch agent')).toHaveTextContent('repo-bot')) - - vi.useFakeTimers() - fireEvent.change(field, { target: { value: '' } }) - expect(screen.getByTestId('jobform-agent-reset-note')).toHaveTextContent('repo-bot') - await act(async () => { await vi.advanceTimersByTimeAsync(250) }) - expect(screen.getByTestId('jobform-agent-reset-note')).toHaveTextContent( - 'project directory was cleared', - ) - vi.useRealTimers() - } - }) - - /** - * The notice reports that the system discarded an agent the reader chose - * deliberately. Rendered as a bare styled it is invisible to - * assistive tech, so a screen-reader user clears the directory, hears - * nothing, and only discovers the substitution when a different agent - * runs -- the exact silent substitution this notice exists against. Its - * sibling `chat_folder_was_deleted` notice in the same file already - * carries `role="status"` with a comment requiring it be "announced as a - * status", so this asserts the parity rather than the attribute: the note - * must be reachable BY ROLE, which is what an AT user actually depends on. - */ - it('announces the reset to assistive tech, not only to sighted readers', async () => { - vi.mocked(api.kirocrewAgents).mockResolvedValueOnce({ - agents: [{ - name: 'repo-bot', kiro_agent: 'repo-bot', workspace: 'repo', memory_store: 'repo', - description: 'repo agent', source: 'project', scope: 'project', - }], - default_agent: '', - }) - renderJobForm(withDefaultAgent) - const field = screen.getByLabelText('Project directory') - fireEvent.change(field, { target: { value: '/Users/you/projects/repo' } }) - fireEvent.click(screen.getByLabelText('Switch agent')) - await waitFor(() => expect(screen.getByRole('option', { name: /repo-bot/ })).toBeInTheDocument()) - fireEvent.click(screen.getByRole('option', { name: /repo-bot/ })) - await waitFor(() => expect(screen.getByLabelText('Switch agent')).toHaveTextContent('repo-bot')) - - fireEvent.change(field, { target: { value: '' } }) - const note = await waitFor( - () => { - const found = screen.getByTestId('jobform-agent-reset-note') - expect(found).toHaveTextContent('repo-bot') - return found - }, - { timeout: 2000 }, - ) - // Reachable by role is the assertion that matters -- a reader on - // assistive tech finds it this way or not at all. - expect(note).toBe(screen.getByRole('status', { name: '' })) - }) }) /** @@ -706,7 +549,7 @@ describe('JobForm project roster fetch failure stays out of the form-wide error' // UX Review: `friendlyErrText` unwraps error/detail/message when present and // otherwise hands back the RAW body, so a response with no message field (a // bare `{}`) was interpolated straight into the sentence and rendered - // "Couldn't load this project's agents: {}." Bare punctuation is worse than + // "Couldn't load this folder's agents: {}." Bare punctuation is worse than // no clause, so the non-prose shapes take the detail-less sentence instead. vi.mocked(api.kirocrewAgents).mockRejectedValue(new Error('{}')) renderJobForm() @@ -718,8 +561,8 @@ describe('JobForm project roster fetch failure stays out of the form-wide error' expect(notice.textContent).not.toContain('{}') expect(notice.textContent).not.toContain('agents: .') // The two facts still both land: what failed, and what it fell back to. - expect(notice.textContent).toContain("Couldn't load this project's agents.") - expect(notice.textContent).toContain('Showing the global agent list instead.') + expect(notice.textContent).toContain("Couldn't load this folder's agents.") + expect(notice.textContent).toContain('Showing your saved agents instead.') }) it('keeps the detail clause when the error IS prose', async () => { @@ -850,7 +693,7 @@ describe('JobForm agent picker on a project/global name collision', () => { // description of its own, so there is no positive text to match on -- which // is exactly why the marker has to exist. const row = within(listbox).getByRole('option', { name: /reviewer/ }) - expect(row).toHaveTextContent('overrides global') + expect(row).toHaveTextContent("folder's version") expect(row).not.toHaveTextContent('the configured reviewer') // Non-colliding rows from both sides survive untouched. @@ -865,36 +708,34 @@ describe('JobForm agent picker on a project/global name collision', () => { // declared by the folder, so it must stay unmarked. const listbox = await openWithCollisionFolder() const untouched = within(listbox).getByRole('option', { name: /default/ }) - expect(untouched).not.toHaveTextContent('overrides global') + expect(untouched).not.toHaveTextContent("folder's version") }) it('marks the surviving row as overriding the configured agent', async () => { const listbox = await openWithCollisionFolder() const row = within(listbox).getByRole('option', { name: /reviewer/ }) - expect(row).toHaveTextContent('overrides global') + expect(row).toHaveTextContent("folder's version") // The explanation is VISIBLE, not hover-only. The badge's `title` needs a // mouse resting on a 10px chip and does not exist on touch at all, and this // marker is the only signal in the feature that tells a user why their - // configured agent vanished from the list. It no longer REPEATS the agent - // name — the row title directly above already shows it, and repeating it - // pushed the meaning past this line's own truncation on a narrow popover - // (UX Review span=7ddb24260c79). + // configured agent vanished from the list. It names the definition that + // runs and where it lives, so a reader knows which same-named agent the job + // gets. expect(row).toHaveTextContent( - "This job's project directory defines its own agent with this name, so it runs " - + 'instead of your global one. Your global agent is unchanged elsewhere.', + "This job runs the folder's reviewer. Your saved one is unchanged.", ) // The marker is specific to the collision, not to being a project agent: // a project-only row has nothing to override and must not claim otherwise. const projectOnly = within(listbox).getByRole('option', { name: /repo-bot/ }) - expect(projectOnly).not.toHaveTextContent('overrides global') - expect(projectOnly).not.toHaveTextContent('Runs instead of') + expect(projectOnly).not.toHaveTextContent("folder's version") + expect(projectOnly).not.toHaveTextContent('Your saved one is unchanged') }) it('drops the marker when the project directory is cleared', async () => { const listbox = await openWithCollisionFolder() - expect(within(listbox).getByRole('option', { name: /reviewer/ })).toHaveTextContent('overrides global') + expect(within(listbox).getByRole('option', { name: /reviewer/ })).toHaveTextContent("folder's version") fireEvent.keyDown(listbox, { key: 'Escape' }) fireEvent.change(screen.getByLabelText('Project directory'), { target: { value: '' } }) @@ -902,7 +743,7 @@ describe('JobForm agent picker on a project/global name collision', () => { fireEvent.click(screen.getByLabelText('Switch agent')) await waitFor(() => { const reopened = screen.getByRole('listbox') - expect(within(reopened).queryByText('overrides global')).not.toBeInTheDocument() + expect(within(reopened).queryByText("folder's version")).not.toBeInTheDocument() }) // With no folder there is no project scope, so the configured agent is the // one offered again. @@ -910,3 +751,62 @@ describe('JobForm agent picker on a project/global name collision', () => { expect(within(reopened).getByRole('option', { name: /reviewer/ })).toHaveTextContent('the configured reviewer') }) }) + +/** + * Only the project-scoped response's `scope: 'project'` rows join the picker. + * Its global half is a plainer copy of the catalog the form already has, so + * merging it would re-add rows the caller filtered out; but the server drops + * an alias whose template the folder declares, and the form drops that alias + * too, since picking it would run the folder's file with no marker. + */ +describe('JobForm merges a bound folder roster into the catalog', () => { + const projectRow = (name: string): KiroCrewAgent => ({ + name, kiro_agent: name, workspace: 'default', memory_store: 'default', + description: '', source: 'kirocrew', scope: 'project', + }) + const globalRow = (name: string, source = 'kirocrew'): KiroCrewAgent => ({ + name, kiro_agent: name, workspace: 'default', memory_store: 'default', + description: '', source, scope: 'global', + }) + + async function openPickerUnder(folderRoster: KiroCrewAgent[], catalog: KiroCrewAgent[]) { + vi.mocked(api.kirocrewAgents).mockResolvedValue({ agents: folderRoster, default_agent: 'default' }) + renderJobForm({ agents: catalog, defaultAgent: 'default' }) + fireEvent.change(screen.getByLabelText('Project directory'), { + target: { value: '/Users/you/projects/repo' }, + }) + await waitFor(() => expect(api.kirocrewAgents).toHaveBeenCalled()) + fireEvent.click(screen.getByLabelText('Switch agent')) + await waitFor(() => expect(screen.getByRole('option', { name: /repo-bot/ })).toBeInTheDocument()) + return screen.getByRole('listbox') + } + + it('does not re-add a row the catalog left out', async () => { + // The built-in `mate` is hidden from the catalog while the Crewmates + // preview is off, but the folder roster's global half still lists it. + const listbox = await openPickerUnder( + [globalRow('default'), globalRow('mate', 'builtin'), projectRow('repo-bot')], + [builtInAgent], + ) + expect(within(listbox).getAllByRole('option')).toHaveLength(2) + expect(within(listbox).queryByRole('option', { name: /mate/i })).not.toBeInTheDocument() + }) + + it('drops a saved alias the folder displaced, and keeps an installed template', async () => { + const displaced: KiroCrewAgent = { ...eaDevAgent, kiro_agent: 'repo-bot', selection_kind: 'member' } + const template: KiroCrewAgent = { + name: 'reviewer', kiro_agent: 'reviewer', workspace: 'default', memory_store: 'default', + description: '', source: 'kirocrew', selection_kind: 'template', + } + // ea-dev dispatches `repo-bot`, which the folder declares, so the server + // left ea-dev out of the roster's global half. + const listbox = await openPickerUnder( + [globalRow('default'), projectRow('repo-bot')], + [{ ...builtInAgent, selection_kind: 'member' }, displaced, template], + ) + expect(within(listbox).queryByRole('option', { name: /ea-dev/ })).not.toBeInTheDocument() + expect(within(listbox).getByRole('option', { name: /reviewer/ })).toBeInTheDocument() + expect(within(listbox).getByRole('option', { name: /^default/ })).toBeInTheDocument() + }) +}) + diff --git a/website/src/test/JobForm.projectCatalogFailure.test.tsx b/website/src/test/JobForm.projectCatalogFailure.test.tsx new file mode 100644 index 000000000000..74f24f96b690 --- /dev/null +++ b/website/src/test/JobForm.projectCatalogFailure.test.tsx @@ -0,0 +1,112 @@ +import { act, fireEvent, screen, waitFor } from '@testing-library/react' +import { beforeEach, describe, expect, it, vi } from 'vitest' +import type { ComponentProps } from 'react' +import { api } from '../api/client' +import JobForm from '../components/JobForm' +import type { KiroCrewAgent } from '../components/AgentSelector' +import type { CronJob } from '../types' +import { renderWithProviders } from './helpers' + +vi.mock('../api/client', () => ({ + api: { + models: vi.fn().mockResolvedValue({ models: [] }), + kirocrewAgents: vi.fn(), + agentCatalog: vi.fn().mockResolvedValue({ agents: [], default_agent: '' }), + chatFolders: vi.fn().mockResolvedValue([]), + updateCron: vi.fn(), + createCron: vi.fn(), + }, +})) + +const row = (name: string, scope: string): KiroCrewAgent => ({ + name, scope, kiro_agent: name, workspace: '', memory_store: '', + description: '', source: 'kirocrew', +}) +const configured = row('configured', 'global') +const projectOnly = row('repo-agent', 'project') +const rosterFailure = { reloading: false, onReload: () => {} } +const job = (agent: string): CronJob => ({ + id: 'saved-job', name: 'nightly', message: 'summarize changes', schedule: '', + enabled: true, every_secs: 3600, project_path: '/repo-a', agent, +} as CronJob) + +beforeEach(() => { + vi.mocked(api.kirocrewAgents).mockReset().mockResolvedValue({ agents: [configured], default_agent: '' }) + vi.mocked(api.updateCron).mockReset().mockResolvedValue({}) +}) + +function mount(agent: string, overrides: Partial> = {}) { + const props: ComponentProps = { + job: job(agent), agents: [], defaultAgent: '', rosterFailure, + layout: 'vertical', onSaved: () => {}, ...overrides, + } + return { ...renderWithProviders(), props } +} + +async function saveAndExpectAgent(agent: string) { + fireEvent.click(screen.getByRole('button', { name: 'Save' })) + await waitFor(() => expect(api.updateCron).toHaveBeenCalledWith( + 'saved-job', expect.objectContaining({ agent }), + )) +} + +describe('JobForm preserves saved template picks when the global catalog is unavailable', () => { + it('keeps an installed template absent from the configured-member project endpoint on an unrelated save', async () => { + const { queryClient } = mount('installed-template') + await waitFor(() => expect(queryClient.getQueryState(['project-agents', '/repo-a'])?.status).toBe('success')) + await act(async () => {}) + fireEvent.change(screen.getByLabelText('Name', { exact: true }), { target: { value: 'renamed' } }) + await saveAndExpectAgent('installed-template') + expect(screen.queryByTestId('jobform-agent-reset-note')).not.toBeInTheDocument() + }) + + it('keeps an installed template on a folder switch and fresh failure-prop objects', async () => { + const { queryClient, rerender, props } = mount('installed-template') + await waitFor(() => expect(queryClient.getQueryState(['project-agents', '/repo-a'])?.status).toBe('success')) + fireEvent.change(screen.getByLabelText('Project directory'), { target: { value: '/repo-b' } }) + await waitFor(() => expect(queryClient.getQueryState(['project-agents', '/repo-b'])?.status).toBe('success')) + rerender( {} }} />) + await act(async () => {}) + await saveAndExpectAgent('installed-template') + }) + + it('keeps a project-only pick across a loading gap into a folder that lacks it', async () => { + let finish!: (value: { agents: KiroCrewAgent[]; default_agent: string }) => void + vi.mocked(api.kirocrewAgents) + .mockResolvedValueOnce({ agents: [configured, projectOnly], default_agent: '' }) + .mockImplementationOnce(() => new Promise(resolve => { finish = resolve })) + const { queryClient } = mount(projectOnly.name) + await waitFor(() => expect(screen.getByLabelText('Switch agent')).toHaveTextContent(projectOnly.name)) + await waitFor(() => expect(queryClient.getQueryState(['project-agents', '/repo-a'])?.status).toBe('success')) + await act(async () => {}) + fireEvent.change(screen.getByLabelText('Project directory'), { target: { value: '/repo-b' } }) + await waitFor(() => expect(api.kirocrewAgents).toHaveBeenCalledTimes(2)) + await act(async () => {}) + expect(screen.queryByTestId('jobform-agent-reset-note')).not.toBeInTheDocument() + await act(async () => { finish({ agents: [configured], default_agent: '' }) }) + await waitFor(() => expect(screen.getByLabelText('Switch agent')).toHaveTextContent(projectOnly.name)) + await saveAndExpectAgent(projectOnly.name) + }) + + it('retains a matching global name even when a project row defined it', async () => { + vi.mocked(api.kirocrewAgents).mockResolvedValueOnce({ agents: [projectOnly], default_agent: '' }) + const { queryClient } = mount(projectOnly.name, { agents: [row(projectOnly.name, 'global')] }) + await waitFor(() => expect(queryClient.getQueryState(['project-agents', '/repo-a'])?.status).toBe('success')) + fireEvent.change(screen.getByLabelText('Project directory'), { target: { value: '/repo-b' } }) + await waitFor(() => expect(queryClient.getQueryState(['project-agents', '/repo-b'])?.status).toBe('success')) + await act(async () => {}) + await saveAndExpectAgent(projectOnly.name) + }) + + it('keeps a pick the recovered global catalog does not list', async () => { + // A loaded catalog is not the resolver: it omits runtime-owned templates the + // backend still runs, so its silence is no reason to clear a saved binding. + const { queryClient, rerender, props } = mount('installed-template') + await waitFor(() => expect(queryClient.getQueryState(['project-agents', '/repo-a'])?.status).toBe('success')) + await act(async () => {}) + rerender() + await act(async () => {}) + expect(screen.queryByTestId('jobform-agent-reset-note')).not.toBeInTheDocument() + await saveAndExpectAgent('installed-template') + }) +}) diff --git a/website/src/test/JobForm.saveAndBinding.test.tsx b/website/src/test/JobForm.saveAndBinding.test.tsx index a634d78237d6..85e332afc949 100644 --- a/website/src/test/JobForm.saveAndBinding.test.tsx +++ b/website/src/test/JobForm.saveAndBinding.test.tsx @@ -4,6 +4,7 @@ import { renderWithProviders } from './helpers' import JobForm, { buildBody, parseJobDefaults } from '../components/JobForm' import type { CronJob } from '../types' import { api } from '../api/client' +import { ApiError } from '../api/apiError' vi.mock('../api/client', () => ({ api: { @@ -196,3 +197,60 @@ describe('cron JobForm surfaces the real update error (not "Failed to save")', ( expect(formWideAlerts()).toHaveLength(0) }) }) + +/** + * An `unknown_agent` refusal names the Agent field, so the Schedule page's + * vertical form shows it under the agent picker instead of under Save, where a + * reader who had just switched directories found nothing near the Agent box to + * fix (UX Review). Routed on the response's `code`, not on its sentence. + */ +describe('an unknown_agent save refusal is shown at the Agent field', () => { + const refusal = (detail: string) => + new ApiError(400, detail, JSON.stringify({ error: detail, code: 'unknown_agent' })) + + it('renders under the agent picker and tells the reader what to pick', async () => { + const detail = "Agent 'repo-smoke' not found in project directory '/work/other'" + vi.mocked(api.updateCron).mockRejectedValue(refusal(detail)) + renderWithProviders( + {}} layout="vertical" />, + ) + + fireEvent.click(screen.getByRole('button', { name: 'Save' })) + + await waitFor(() => { + expect(screen.getByTestId('jobform-agent-save-error')).toHaveTextContent( + `${detail}. Pick an agent from this folder.`, + ) + }) + expect(formWideAlerts()).toHaveLength(0) + expect(screen.queryByTestId('jobform-project-path-save-error')).not.toBeInTheDocument() + }) + + it('names no folder when the job has no directory', async () => { + const detail = "Agent 'ghost' is not a configured agent" + vi.mocked(api.updateCron).mockRejectedValue(refusal(detail)) + renderWithProviders( + {}} layout="vertical" />, + ) + + fireEvent.click(screen.getByRole('button', { name: 'Save' })) + + await waitFor(() => { + expect(screen.getByTestId('jobform-agent-save-error')).toHaveTextContent(detail) + }) + expect(screen.getByTestId('jobform-agent-save-error')).not.toHaveTextContent('Pick an agent from this folder') + }) + + it('clears once a later save goes through', async () => { + const detail = "Agent 'repo-smoke' not found in project directory '/work/other'" + vi.mocked(api.updateCron).mockRejectedValueOnce(refusal(detail)).mockResolvedValueOnce({ ok: true } as never) + renderWithProviders( + {}} layout="vertical" />, + ) + + fireEvent.click(screen.getByRole('button', { name: 'Save' })) + await waitFor(() => expect(screen.getByTestId('jobform-agent-save-error')).toBeInTheDocument()) + fireEvent.click(screen.getByRole('button', { name: 'Save' })) + await waitFor(() => expect(screen.queryByTestId('jobform-agent-save-error')).not.toBeInTheDocument()) + }) +}) diff --git a/website/src/test/SchedulePage.lastErrorVisibility.test.tsx b/website/src/test/SchedulePage.lastErrorVisibility.test.tsx index 9d112f189307..c671353f50b0 100644 --- a/website/src/test/SchedulePage.lastErrorVisibility.test.tsx +++ b/website/src/test/SchedulePage.lastErrorVisibility.test.tsx @@ -101,6 +101,32 @@ describe('SchedulePage — Last Error visibility', () => { expect(panel.className).toContain('font-mono') }) + it("renders a command job's captured output with log styling too", async () => { + const { api } = await import('../api/client') + vi.mocked(api).crons.mockResolvedValue({ + jobs: [mkJob({ command: 'make check', last_status: 'error', last_error: 'make: *** [check] Error 2' })], + }) + + renderWithProviders() + fireEvent.click(await screen.findByText('Nightly report')) + + const panel = await screen.findByTestId('schedule-job-last-error') + expect(panel.className).toContain('font-mono') + }) + + it("renders a message job's skip reason as prose, not log styling", async () => { + const { api } = await import('../api/client') + vi.mocked(api).crons.mockResolvedValue({ + jobs: [mkJob({ last_status: 'error', last_error: SKIP_REASON })], + }) + + renderWithProviders() + fireEvent.click(await screen.findByText('Nightly report')) + + const panel = await screen.findByTestId('schedule-job-last-error') + expect(panel.className).not.toContain('font-mono') + }) + it('renders no Last Error panel when the job has no error', async () => { const { api } = await import('../api/client') vi.mocked(api).crons.mockResolvedValue({ jobs: [mkJob({ last_status: 'ok' })] })