specrails-desktop 2.59.3 → 2.61.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/client/dist/assets/{ActivityFeedPage-BGEayjTY.js → ActivityFeedPage-Wi5XNgoG.js} +1 -1
- package/client/dist/assets/{AgentBrowserCapture-Qvg4y5Tr.js → AgentBrowserCapture-CkNWDZT3.js} +1 -1
- package/client/dist/assets/{AgentModeAnalyticsPane-CR7aFeLJ.js → AgentModeAnalyticsPane-CXz2j-Bt.js} +2 -2
- package/client/dist/assets/{AgentModeCodePane-gAd88Gng.js → AgentModeCodePane-DnsBPtpS.js} +2 -2
- package/client/dist/assets/{AgentModeJobsPane-EjCDuTow.js → AgentModeJobsPane-U1J6PaBo.js} +1 -1
- package/client/dist/assets/{AgentsPage-CRHHcp1V.js → AgentsPage-CXrqu5vo.js} +2 -2
- package/client/dist/assets/{AnalyticsPage-a0b1fNEl.js → AnalyticsPage-Cvtt-LOO.js} +1 -1
- package/client/dist/assets/{CodePage-BmV1m7l3.js → CodePage-D35o-MFO.js} +1 -1
- package/client/dist/assets/{DesktopAnalyticsPage-B87WmXOQ.js → DesktopAnalyticsPage-CsDFy5rp.js} +1 -1
- package/client/dist/assets/{DocsDialog-Co0O672q.js → DocsDialog-CSlMPemn.js} +1 -1
- package/client/dist/assets/{DocsPage-DxGI6A2T.js → DocsPage-BKlYAvWq.js} +1 -1
- package/client/dist/assets/{ExportDropdown-1Ce031vB.js → ExportDropdown-CweP_1GP.js} +1 -1
- package/client/dist/assets/InteractiveJobComposer-CFKvbQeJ.js +19 -0
- package/client/dist/assets/{JobDetailModal-DVLDVgzz.js → JobDetailModal-DYyGq1Vp.js} +1 -1
- package/client/dist/assets/{JobDetailPage-RcP9N-D-.js → JobDetailPage-C6gpdYvj.js} +1 -1
- package/client/dist/assets/{JobsPage-R9M4xQnp.js → JobsPage-CgS0pnKd.js} +1 -1
- package/client/dist/assets/LoopBuilderPage-jUp20DSZ.js +1 -0
- package/client/dist/assets/{LoopPreviewModal-DA2JeKWX.js → LoopPreviewModal-DkLRfsYX.js} +1 -1
- package/client/dist/assets/{LoopWindowSurface-BkkeD0hx.js → LoopWindowSurface-CuACkXFV.js} +1 -1
- package/client/dist/assets/{LoopsPage-BHv--iI7.js → LoopsPage-ClSrWzDd.js} +1 -1
- package/client/dist/assets/{MinimizedChatsContext-Bc9xHByW.js → MinimizedChatsContext-CroAs6Kh.js} +1 -1
- package/client/dist/assets/{PluginsPage-BEy62gxK.js → PluginsPage-nCKQOwRL.js} +1 -1
- package/client/dist/assets/{ProjectSettingsDialog-DDQ_f94T.js → ProjectSettingsDialog-BVDYwllU.js} +1 -1
- package/client/dist/assets/{RepositoryDeliveries-DIWDFLRM.js → RepositoryDeliveries-DJCm1pZr.js} +1 -1
- package/client/dist/assets/{RepositoryScopeSelector-D3PlHIM-.js → RepositoryScopeSelector-CeCr6Jz-.js} +1 -1
- package/client/dist/assets/{ReviewPacketPage-BXdPwmdE.js → ReviewPacketPage-kTErrEjx.js} +1 -1
- package/client/dist/assets/{TemplatePreviewModal-C7-G6lvI.js → TemplatePreviewModal-B8yd1AGU.js} +1 -1
- package/client/dist/assets/{TicketDetailModalContext-gGUv7gsQ.js → TicketDetailModalContext-YBJX3RmP.js} +1 -1
- package/client/dist/assets/{Trans-Br_OIUKP.js → Trans-D5eOjfvG.js} +1 -1
- package/client/dist/assets/agentRuntime-B-myNBUP.js +1 -0
- package/client/dist/assets/agentRuntime-Bjt7Ij6_.js +1 -0
- package/client/dist/assets/agentRuntime-C_yLPKDy.js +1 -0
- package/client/dist/assets/agentRuntime-D2kYQqNO.js +1 -0
- package/client/dist/assets/agentRuntime-DvhEe1um.js +1 -0
- package/client/dist/assets/agentRuntime-DxC6-9rN.js +1 -0
- package/client/dist/assets/agentRuntime-TKQyg137.js +1 -0
- package/client/dist/assets/agentRuntime-WSv8G0pW.js +1 -0
- package/client/dist/assets/agents-B6ZsnARo.js +1 -0
- package/client/dist/assets/agents-BORdhe0K.js +1 -0
- package/client/dist/assets/agents-C6aq9Oqs.js +1 -0
- package/client/dist/assets/agents-Cbsc4bcX.js +1 -0
- package/client/dist/assets/agents-D0uYR6hq.js +1 -0
- package/client/dist/assets/agents-Doe1sHY5.js +1 -0
- package/client/dist/assets/agents-DyNi_I9m.js +1 -0
- package/client/dist/assets/agents-StKxiTg0.js +1 -0
- package/client/dist/assets/agentstudio-7cYCXn-L.js +1 -0
- package/client/dist/assets/{agentstudio-QdAJIDef.js → agentstudio-BHWQh8G3.js} +1 -1
- package/client/dist/assets/agentstudio-BjnWHyRs.js +1 -0
- package/client/dist/assets/{agentstudio-fLXpRGIi.js → agentstudio-BkV8vcK4.js} +1 -1
- package/client/dist/assets/{agentstudio-BWAKeGgB.js → agentstudio-BzugqB_N.js} +1 -1
- package/client/dist/assets/{agentstudio-Cja8Sjcp.js → agentstudio-CWbp7KvH.js} +1 -1
- package/client/dist/assets/agentstudio-DG6plf5o.js +1 -0
- package/client/dist/assets/agentstudio-DkZVF-Cc.js +1 -0
- package/client/dist/assets/{formatDistanceToNow-Q7QPRFV4.js → formatDistanceToNow-DZ3VWsHq.js} +1 -1
- package/client/dist/assets/{getTimezoneOffsetInMilliseconds-Bq0CXBaJ.js → getTimezoneOffsetInMilliseconds-9JiGlFrx.js} +1 -1
- package/client/dist/assets/{index-DVkWHOR3.js → index-lTGJJTuk.js} +8 -8
- package/client/dist/assets/{jira-api-C2Tzc362.js → jira-api-Bp0zXwjg.js} +1 -1
- package/client/dist/assets/{loops-Cm55CXJ4.js → loops-B2PhQLKR.js} +1 -1
- package/client/dist/assets/{loops-3IutojWt.js → loops-BqbF46st.js} +1 -1
- package/client/dist/assets/{loops-BAosWtXE.js → loops-CINnHbfI.js} +1 -1
- package/client/dist/assets/{loops-kIJJkaxf.js → loops-D-3XhH04.js} +1 -1
- package/client/dist/assets/{loops-DHQtnfze.js → loops-DKkEEjZ_.js} +1 -1
- package/client/dist/assets/{loops-D7tL_Saw.js → loops-DzWR5-v6.js} +1 -1
- package/client/dist/assets/{loops--KWr0X-w.js → loops-WyWDkhok.js} +1 -1
- package/client/dist/assets/{loops-BISDssL5.js → loops-scD5fIBf.js} +1 -1
- package/client/dist/assets/{narration-DvLQBW9U.js → narration-BEKMVxGm.js} +1 -1
- package/client/dist/assets/{narration-CHI06czm.js → narration-CjLwGKap.js} +1 -1
- package/client/dist/assets/{narration-DjKB3pQZ.js → narration-DANWuGsW.js} +1 -1
- package/client/dist/assets/{narration-eSx3gR0W.js → narration-DGeEDWiT.js} +1 -1
- package/client/dist/assets/{narration-DtCYvRLM.js → narration-DJgpGwIP.js} +1 -1
- package/client/dist/assets/{narration-n3hOA7LY.js → narration-DbHnz0qV.js} +1 -1
- package/client/dist/assets/{narration-thJOeT2-.js → narration-bZSsTZG8.js} +1 -1
- package/client/dist/assets/{narration--hUhjM5v.js → narration-i6aKJKEc.js} +1 -1
- package/client/dist/assets/{project-repositories-DZKmieH3.js → project-repositories-CadLZOnr.js} +1 -1
- package/client/dist/assets/{spending-EXaboRU0.js → spending-DQDNtM8q.js} +1 -1
- package/client/dist/assets/{useDesktop-ChSmmJfc.js → useDesktop-DKNbOF0u.js} +1 -1
- package/client/dist/assets/{useRuntimeRuns-w9-5OzZl.js → useRuntimeRuns-D3YMw9qx.js} +1 -1
- package/client/dist/assets/{useSharedWebSocket-g0nTHfTT.js → useSharedWebSocket-DaWuiO0S.js} +2 -2
- package/client/dist/index.html +19 -19
- package/docs/getting-started.md +2 -2
- package/docs/guide/de/agents/1-meet-the-agents.md +1 -1
- package/docs/guide/de/agents/2-profiles-and-the-balanced-default.md +1 -1
- package/docs/guide/de/agents/3-customizing-models-per-agent.md +1 -1
- package/docs/guide/de/agents/4-custom-agents-catalog.md +3 -3
- package/docs/guide/en/agents/1-meet-the-agents.md +1 -1
- package/docs/guide/en/agents/2-profiles-and-the-balanced-default.md +1 -1
- package/docs/guide/en/agents/3-customizing-models-per-agent.md +1 -1
- package/docs/guide/en/agents/4-custom-agents-catalog.md +3 -3
- package/docs/guide/es/agents/1-meet-the-agents.md +1 -1
- package/docs/guide/es/agents/2-profiles-and-the-balanced-default.md +1 -1
- package/docs/guide/es/agents/3-customizing-models-per-agent.md +1 -1
- package/docs/guide/es/agents/4-custom-agents-catalog.md +3 -3
- package/docs/guide/fr/agents/1-meet-the-agents.md +1 -1
- package/docs/guide/fr/agents/2-profiles-and-the-balanced-default.md +1 -1
- package/docs/guide/fr/agents/3-customizing-models-per-agent.md +1 -1
- package/docs/guide/fr/agents/4-custom-agents-catalog.md +3 -3
- package/docs/guide/it/agents/1-meet-the-agents.md +1 -1
- package/docs/guide/it/agents/2-profiles-and-the-balanced-default.md +1 -1
- package/docs/guide/it/agents/3-customizing-models-per-agent.md +1 -1
- package/docs/guide/it/agents/4-custom-agents-catalog.md +3 -3
- package/docs/guide/ja/agents/1-meet-the-agents.md +1 -1
- package/docs/guide/ja/agents/2-profiles-and-the-balanced-default.md +1 -1
- package/docs/guide/ja/agents/3-customizing-models-per-agent.md +1 -1
- package/docs/guide/ja/agents/4-custom-agents-catalog.md +3 -3
- package/docs/guide/pt/agents/1-meet-the-agents.md +1 -1
- package/docs/guide/pt/agents/2-profiles-and-the-balanced-default.md +1 -1
- package/docs/guide/pt/agents/3-customizing-models-per-agent.md +1 -1
- package/docs/guide/pt/agents/4-custom-agents-catalog.md +3 -3
- package/docs/guide/zh/agents/1-meet-the-agents.md +1 -1
- package/docs/guide/zh/agents/2-profiles-and-the-balanced-default.md +1 -1
- package/docs/guide/zh/agents/3-customizing-models-per-agent.md +1 -1
- package/docs/guide/zh/agents/4-custom-agents-catalog.md +3 -3
- package/docs/internals/adding-a-provider.md +7 -6
- package/docs/internals/configuration.md +2 -0
- package/docs/internals/core-runtime-updates.md +22 -3
- package/docs/internals/profiles.md +17 -10
- package/docs/internals/programmatic-agent-runtime.md +2 -0
- package/docs/internals/review-packet.md +1 -1
- package/docs/internals/source-map.md +1 -1
- package/docs/running-pipelines.md +2 -2
- package/package.json +1 -1
- package/server/dist/core-compat.js +7 -3
- package/server/dist/mcp/guide.js +4 -3
- package/server/dist/modules/agent-runtime/runtime/agent-runtime-bridge.js +19 -3
- package/server/dist/modules/agent-runtime/runtime/agent-runtime-effective-config.js +2 -0
- package/server/dist/modules/agent-runtime/runtime/agent-runtime-settings-router.js +6 -2
- package/server/dist/modules/agent-runtime/runtime/agent-runtime-settings.js +42 -7
- package/server/dist/modules/agents/runtime/profiles-router.js +74 -36
- package/server/dist/modules/execution/runtime/queue-manager.js +7 -9
- package/server/dist/modules/loops/runtime/loop-agents.js +2 -5
- package/server/dist/modules/loops/runtime/loop-command-catalog.js +5 -5
- package/server/dist/modules/loops/runtime/loop-core-factory.js +2 -2
- package/server/dist/modules/loops/runtime/loop-definition.js +2 -1
- package/server/dist/modules/loops/runtime/loop-executors.js +0 -2
- package/server/dist/modules/loops/runtime/loop-factory.js +1 -1
- package/server/dist/modules/loops/runtime/loop-graph.js +8 -1
- package/server/dist/modules/loops/runtime/loop-implement-recipe.js +33 -13
- package/server/dist/modules/loops/runtime/loop-templates.js +3 -3
- package/server/dist/modules/loops/runtime/loops-router.js +3 -1
- package/server/dist/providers/gemini-agent-ack.js +13 -10
- package/server/dist/schemas/agent-runtime.schema.json +9 -7
- package/server/dist/setup-manager.js +28 -43
- package/server/dist/workspace-manager.js +13 -71
- package/client/dist/assets/InteractiveJobComposer-DkqR77pO.js +0 -19
- package/client/dist/assets/LoopBuilderPage-C4S-rkWp.js +0 -1
- package/client/dist/assets/agentRuntime-15Pkk6we.js +0 -1
- package/client/dist/assets/agentRuntime-Bpx3yWHK.js +0 -1
- package/client/dist/assets/agentRuntime-C78n13To.js +0 -1
- package/client/dist/assets/agentRuntime-CCI7XF4c.js +0 -1
- package/client/dist/assets/agentRuntime-CKDHe2-a.js +0 -1
- package/client/dist/assets/agentRuntime-Ddqvp2bP.js +0 -1
- package/client/dist/assets/agentRuntime-TXPQowKJ.js +0 -1
- package/client/dist/assets/agentRuntime-hqZRy08E.js +0 -1
- package/client/dist/assets/agents-CA5eT1d0.js +0 -1
- package/client/dist/assets/agents-CAgy-5uS.js +0 -1
- package/client/dist/assets/agents-CNm6Qzlv.js +0 -1
- package/client/dist/assets/agents-CTwbx-fb.js +0 -1
- package/client/dist/assets/agents-DEGV1Vao.js +0 -1
- package/client/dist/assets/agents-HsDF1aQU.js +0 -1
- package/client/dist/assets/agents-IQjdA-z9.js +0 -1
- package/client/dist/assets/agents-RkGoteXh.js +0 -1
- package/client/dist/assets/agentstudio-B2CTtQgZ.js +0 -1
- package/client/dist/assets/agentstudio-DtfPcr99.js +0 -1
- package/client/dist/assets/agentstudio-X70BKf6u.js +0 -1
- package/client/dist/assets/agentstudio-qXKqVnWS.js +0 -1
- package/server/dist/modules/loops/runtime/loop-agent-defaults.json +0 -6
|
@@ -3,7 +3,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.ensureFrameworkAgents = ensureFrameworkAgents;
|
|
7
6
|
exports.ensureFrameworkCommandSubtrees = ensureFrameworkCommandSubtrees;
|
|
8
7
|
exports.workspacePathFor = workspacePathFor;
|
|
9
8
|
exports.ensureWorkspace = ensureWorkspace;
|
|
@@ -16,63 +15,6 @@ const framework_manager_1 = require("./framework-manager");
|
|
|
16
15
|
const framework_migration_1 = require("./framework-migration");
|
|
17
16
|
const artifact_registry_1 = require("./artifact-registry");
|
|
18
17
|
const agent_mcp_config_1 = require("./agent-mcp-config");
|
|
19
|
-
/**
|
|
20
|
-
* Windows repair: ensure the workspace's `<providerDir>/agents` holds the
|
|
21
|
-
* framework's `sr-*` agent definitions, copied from the REAL versioned framework
|
|
22
|
-
* dir (`~/.specrails/framework/<version>/<providerDir>/agents`).
|
|
23
|
-
*
|
|
24
|
-
* Why: on Windows the `framework/current` JUNCTION can be untraversable by Node's
|
|
25
|
-
* `fs` ("UNKNOWN: scandir" / "untrusted mount point"); the bundled core's
|
|
26
|
-
* `assemble` sources the agents THROUGH `current`, so `linkAgentFiles` reads
|
|
27
|
-
* nothing and the workspace ends up with NO `sr-*` agents — the implement
|
|
28
|
-
* pipeline then has no sub-agents to delegate to (architect/developer/reviewer)
|
|
29
|
-
* and silently runs everything inline. The versioned dir is a real, traversable
|
|
30
|
-
* directory, so we read it directly. (The proper fix lives in core's `assemble`;
|
|
31
|
-
* this repairs already-broken installs without waiting for a core republish, and
|
|
32
|
-
* mirrors exactly what the fixed core does on Windows — copy from the version
|
|
33
|
-
* dir.) `assemble` never re-runs on a rail spawn, so a workspace broken at setup
|
|
34
|
-
* stays broken; this runs per rail spawn to self-heal it.
|
|
35
|
-
*
|
|
36
|
-
* NO-OP on POSIX (per-file symlinks already populate the workspace correctly;
|
|
37
|
-
* byte-identical). Additive (never touches user `custom-*.md`) + idempotent.
|
|
38
|
-
* Returns the number of agents copied.
|
|
39
|
-
*/
|
|
40
|
-
function ensureFrameworkAgents(workspaceDir, providerDir, home) {
|
|
41
|
-
(0, core_update_state_1.assertWorkspaceCoreReady)(workspaceDir, home);
|
|
42
|
-
if (process.platform !== 'win32')
|
|
43
|
-
return 0;
|
|
44
|
-
const root = (0, framework_manager_1.frameworkRoot)(home);
|
|
45
|
-
const version = (0, framework_manager_1.readCurrentFrameworkVersion)(home);
|
|
46
|
-
if (!version)
|
|
47
|
-
return 0;
|
|
48
|
-
const src = path_1.default.join(root, version, providerDir, 'agents');
|
|
49
|
-
let entries;
|
|
50
|
-
try {
|
|
51
|
-
entries = fs_1.default.readdirSync(src);
|
|
52
|
-
}
|
|
53
|
-
catch {
|
|
54
|
-
return 0; // framework agents not materialized for this provider
|
|
55
|
-
}
|
|
56
|
-
const dest = path_1.default.join(workspaceDir, providerDir, 'agents');
|
|
57
|
-
let copied = 0;
|
|
58
|
-
for (const name of entries) {
|
|
59
|
-
// Framework agents only; never clobber a user/plugin `custom-*.md`.
|
|
60
|
-
if (!name.endsWith('.md') || name.startsWith('custom-'))
|
|
61
|
-
continue;
|
|
62
|
-
const destFile = path_1.default.join(dest, name);
|
|
63
|
-
if (fs_1.default.existsSync(destFile))
|
|
64
|
-
continue;
|
|
65
|
-
try {
|
|
66
|
-
fs_1.default.mkdirSync(dest, { recursive: true });
|
|
67
|
-
fs_1.default.copyFileSync(path_1.default.join(src, name), destFile);
|
|
68
|
-
copied += 1;
|
|
69
|
-
}
|
|
70
|
-
catch {
|
|
71
|
-
/* best-effort per file — one failure must never abort the rail spawn */
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
return copied;
|
|
75
|
-
}
|
|
76
18
|
/** Whole-directory framework links for the legacy provider layouts. */
|
|
77
19
|
const DIR_LINKED_SUBTREES = ['commands', 'skills', 'rules'];
|
|
78
20
|
/**
|
|
@@ -80,8 +22,9 @@ const DIR_LINKED_SUBTREES = ['commands', 'skills', 'rules'];
|
|
|
80
22
|
*
|
|
81
23
|
* - `rules/` and `specrails/` are whole-directory framework links.
|
|
82
24
|
* - `skills/` is a real merged directory. Core links only its framework-owned
|
|
83
|
-
* `specrails-*` workflow
|
|
84
|
-
* other user-owned direct-child skills can
|
|
25
|
+
* `specrails-*` workflow children (older Cores also linked `sr-*` role
|
|
26
|
+
* skills) so OpenSpec, custom, and other user-owned direct-child skills can
|
|
27
|
+
* coexist.
|
|
85
28
|
*
|
|
86
29
|
* The Windows repair must mirror that ownership boundary exactly. Replacing the
|
|
87
30
|
* Kimi `skills/` root would destroy user state; merely seeing entries in that
|
|
@@ -172,21 +115,20 @@ function repairMissingCommands(src, dest) {
|
|
|
172
115
|
}
|
|
173
116
|
}
|
|
174
117
|
/**
|
|
175
|
-
* Windows repair for provider-owned framework links
|
|
176
|
-
* `ensureFrameworkAgents`.
|
|
118
|
+
* Windows repair for provider-owned framework links.
|
|
177
119
|
*
|
|
178
|
-
* Why
|
|
179
|
-
*
|
|
180
|
-
*
|
|
181
|
-
*
|
|
182
|
-
*
|
|
183
|
-
* unreadable and the workspace has NO `/specrails:*` commands at all — the claude
|
|
184
|
-
* CLI then reports `Unknown command: /specrails:implement`. This replaces an
|
|
120
|
+
* Why: `commands`/`skills`/`rules` are a single dir-symlink INTO
|
|
121
|
+
* `current/<provider>/<subtree>`; when the `current` junction is untraversable
|
|
122
|
+
* by the sidecar (the documented Windows failure), that link is unreadable and
|
|
123
|
+
* the workspace has NO `/specrails:*` commands at all — the claude CLI then
|
|
124
|
+
* reports `Unknown command: /specrails:implement`. This replaces an
|
|
185
125
|
* unreadable/missing link with a REAL recursively-copied directory read straight
|
|
186
|
-
* from the versioned framework dir (never through `current`).
|
|
126
|
+
* from the versioned framework dir (never through `current`). Role agents need
|
|
127
|
+
* no repair: specrails-core defines them in its runtime, not as workspace files.
|
|
128
|
+
* `assemble` never re-runs on a rail spawn, so this runs per spawn to self-heal.
|
|
187
129
|
*
|
|
188
130
|
* Kimi needs an additional per-child repair because its `skills/` root is a real
|
|
189
|
-
* merged directory. Only `specrails-*` and `sr-*` children are framework-owned;
|
|
131
|
+
* merged directory. Only `specrails-*` (and legacy `sr-*`) children are framework-owned;
|
|
190
132
|
* `openspec-*`, `custom-*`, and unknown children are never copied, replaced, or
|
|
191
133
|
* removed.
|
|
192
134
|
*
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-CNC7AqOf.js";import{n as t,t as n}from"./jsx-runtime-zu2_FqZY.js";import{h as r,l as i,r as a}from"./useSharedWebSocket-g0nTHfTT.js";import{n as o,t as s}from"./createLucideIcon-Bjbbp_KS.js";import{a as c,r as l,s as u}from"./useDesktop-ChSmmJfc.js";import{$ as d,Q as f,V as p,tt as m}from"./TicketDetailModalContext-gGUv7gsQ.js";import{n as h}from"./provider-capabilities-lePfeT_Y.js";import{n as g}from"./save-OsUqVn99.js";import{l as _}from"./MinimizedChatsContext-Bc9xHByW.js";import{n as v}from"./file-text-BcLCfcWZ.js";import{t as y}from"./circle-x-CMYsN4ZH.js";import{t as b}from"./git-branch-BRM0F5GN.js";import{t as x}from"./loader-circle-DcygOQpC.js";import{n as S,t as C}from"./square-Ci-PFcFe.js";import{t as w}from"./rotate-ccw-Wh4id13q.js";import{t as T}from"./search-Cq_gE3Ik.js";import{t as E}from"./triangle-alert-H9T4jAmh.js";import{t as D}from"./x-CBMI9ejn.js";import{L as O,l as k,n as A,r as j,t as M,u as N}from"./dialog-CMgps2MY.js";import{t as P}from"./utils-BC4DHlz2.js";import{n as F,t as I}from"./lib-CGdyxIWg.js";import{t as L}from"./button-D1xExSTF.js";import{n as R}from"./project-repositories-DZKmieH3.js";import{t as ee}from"./useRuntimeRuns-w9-5OzZl.js";import{$ as z,At as te,C as ne,Ct as re,E as ie,Gt as B,Ht as V,K as H,Mt as ae,St as U,T as oe,U as se,Y as W,Yt as ce,b as le,et as ue,gt as de,k as fe,kt as pe,q as me,st as he,tn as ge,tt as _e,w as ve,x as ye,y as be,zt as xe}from"./index-DVkWHOR3.js";import{l as Se,n as Ce,p as we,r as Te,t as Ee}from"./loop-layout-BF8xMiNv.js";import{t as De}from"./lib-C7Mhm-gT.js";import{n as Oe}from"./job-time-BCL7wee9.js";var ke=s(`chevrons-down-up`,[[`path`,{d:`m7 20 5-5 5 5`,key:`13a0gw`}],[`path`,{d:`m7 4 5 5 5-5`,key:`1kwcof`}]]),Ae=s(`chevrons-up-down`,[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]]),je=s(`circle-dot`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}]]),Me=s(`circle-pause`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`10`,x2:`10`,y1:`15`,y2:`9`,key:`c1nkhi`}],[`line`,{x1:`14`,x2:`14`,y1:`15`,y2:`9`,key:`h65svq`}]]),Ne=s(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),Pe=s(`hourglass`,[[`path`,{d:`M5 22h14`,key:`ehvnwv`}],[`path`,{d:`M5 2h14`,key:`pdyrp9`}],[`path`,{d:`M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22`,key:`1d314k`}],[`path`,{d:`M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2`,key:`1vvvr6`}]]),Fe=s(`message-circle-question-mark`,[[`path`,{d:`M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719`,key:`1sd12s`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),G=e(t(),1),K=n();function Ie({phases:e,phaseDefinitions:t}){return t.length===0?null:(0,K.jsx)(`div`,{className:`flex items-center`,children:t.map((n,r)=>{let i=e[n.key]??`idle`,a=r<t.length-1?e[t[r+1].key]??`idle`:null;return(0,K.jsxs)(`div`,{className:`flex items-center`,children:[(0,K.jsxs)(H,{children:[(0,K.jsx)(W,{asChild:!0,children:(0,K.jsxs)(`div`,{className:`flex flex-col items-center gap-1.5 cursor-default px-4`,children:[(0,K.jsx)(Le,{state:i}),(0,K.jsx)(`span`,{className:P(`text-xs font-medium transition-colors`,i===`running`?`text-blue-400 aurora-light:text-accent-info`:i===`done`?`text-emerald-400 aurora-light:text-accent-success`:i===`error`?`text-red-400 aurora-light:text-destructive`:`text-muted-foreground/40`),children:n.label})]})}),(0,K.jsxs)(me,{side:`bottom`,className:`max-w-[200px]`,children:[(0,K.jsx)(`p`,{className:`font-medium`,children:n.label}),(0,K.jsx)(`p`,{className:`text-muted-foreground mt-0.5`,children:n.description})]})]}),a!==null&&(0,K.jsx)(`div`,{className:P(`h-px w-12 -mt-5 shrink-0 transition-all duration-300`,a===`done`||i===`done`?`bg-emerald-500/30 aurora-light:bg-accent-success/40`:a===`running`?`bg-blue-400/40 aurora-light:bg-accent-info/40`:`bg-border/30`)})]},n.key)})})}function Le({state:e}){return(0,K.jsxs)(`div`,{className:P(`flex items-center justify-center w-10 h-10 rounded-full transition-all duration-300`,e===`running`?`bg-blue-500/10 aurora-light:bg-accent-info/10 ring-1 ring-blue-400/30 aurora-light:ring-accent-info/30 animate-pulse`:e===`done`?`bg-emerald-500/10 aurora-light:bg-accent-success/10`:e===`error`?`bg-red-500/10 aurora-light:bg-destructive/10`:`bg-muted/20`),children:[e===`running`&&(0,K.jsx)(x,{className:`w-6 h-6 text-blue-400 aurora-light:text-accent-info animate-spin`}),e===`done`&&(0,K.jsx)(B,{className:`w-6 h-6 text-emerald-400 aurora-light:text-accent-success`}),e===`error`&&(0,K.jsx)(y,{className:`w-6 h-6 text-red-400 aurora-light:text-destructive`}),e===`idle`&&(0,K.jsx)(f,{className:`w-6 h-6 text-muted-foreground/20`})]})}function Re(e,t){let n=Oe(e??null),r=(typeof t==`number`?t:Oe(t??null)?.getTime()??NaN)-(n?.getTime()??NaN);if(!Number.isFinite(r)||r<0)return`—`;let i=Math.round(r/1e3);if(i<60)return`${i}s`;let a=Math.floor(i/60),o=i%60;return a<60?`${a}m ${o}s`:`${Math.floor(a/60)}h ${a%60}m`}function ze(e){let t=new Set;for(let n of e)if(n.event_type===`log`)try{let e=(JSON.parse(n.payload).line??``).match(/(?:Writing|Editing|Created?|Updated?)\s+(?:file:\s*)?([\w./\-]+\.\w+)/i);e&&t.add(e[1])}catch{}return Array.from(t).slice(0,20)}var Be={steps:0,actionKey:``,actionArg:``,turns:0,tokens:0,lastSeenIdx:0};function Ve(e){if(e.event_type!==`assistant`)return null;try{let t=JSON.parse(e.payload);if(!t||typeof t!=`object`||Array.isArray(t))return null;let n=t.message,r=(n&&typeof n==`object`&&!Array.isArray(n)?n:t).usage;if(!r||typeof r!=`object`||Array.isArray(r))return null;let i=r,a=e=>typeof e==`number`&&Number.isFinite(e)?e:0;return a(i.input_tokens)+a(i.output_tokens)+a(i.cache_read_input_tokens)+a(i.cache_creation_input_tokens)}catch{return null}}function He(e,t){if(t.type===`reset`)return Be;if(t.type===`consume`){let{events:n}=t,r=e.lastSeenIdx>n.length?n.length:e.lastSeenIdx;if(n.length<=r)return r===e.lastSeenIdx?e:{...e,lastSeenIdx:r};let{steps:i,actionKey:a,actionArg:o,turns:s,tokens:c}=e;for(let e=r;e<n.length;e++){let t=ye(n[e]);t.step&&(i+=t.stepCount??1),t.actionKey&&(a=t.actionKey,o=t.actionArg??``);let r=Ve(n[e]);r!=null&&(s+=1,c+=r)}return{steps:i,actionKey:a,actionArg:o,turns:s,tokens:c,lastSeenIdx:n.length}}return e}function Ue(e,t){let[n,r]=(0,G.useReducer)(He,Be),i=(0,G.useRef)(e);return(0,G.useEffect)(()=>{i.current!==e&&(i.current=e,r({type:`reset`})),r({type:`consume`,events:t})},[e,t]),n}function We(e,t){let n=t&&e.steps===0?`connecting`:e.actionKey||`thinking`,r=n===`delegating`||be.has(n),i=r&&e.actionArg!==``;return{key:r&&!i?`working`:n,arg:i?e.actionArg:null}}function Ge(e){return`${(e/1e3).toFixed(1)}k`}function Ke(e){let t=!!e.total_cost_usd_estimated,n=e.total_cost_usd==null?null:`${t?`~`:``}$${e.total_cost_usd.toFixed(4)}`,r=e.num_turns==null?null:String(e.num_turns),i=e.tokens_in==null?null:(e.tokens_in??0)+(e.tokens_out??0)+(e.tokens_cache_read??0)+(e.tokens_cache_create??0);return{cost:n,turns:r,tokens:i==null?null:Ge(i)}}function qe(e){if(e.length<=1)return null;let t=e=>e.tokens_in==null&&e.tokens_out==null&&e.tokens_cache_read==null&&e.tokens_cache_create==null;return{totalCostUsd:e.reduce((e,t)=>e+(t.total_cost_usd??0),0),hasNullCost:e.some(e=>e.total_cost_usd==null),costEstimated:e.some(e=>!!e.total_cost_usd_estimated),nullCostCount:e.filter(e=>e.total_cost_usd==null).length,costUnavailable:e.every(e=>e.total_cost_usd==null),totalTokensIn:e.reduce((e,t)=>e+(t.tokens_in??0),0),totalTokensOut:e.reduce((e,t)=>e+(t.tokens_out??0),0),totalTokensCacheRead:e.reduce((e,t)=>e+(t.tokens_cache_read??0),0),totalTokensCacheCreate:e.reduce((e,t)=>e+(t.tokens_cache_create??0),0),nullTokenCount:e.filter(t).length,tokensUnavailable:e.every(t),jobCount:e.length}}function Je(e){return e.costUnavailable?`—`:`${e.costEstimated?`~`:``}${e.hasNullCost?`≥`:``}$${e.totalCostUsd.toFixed(4)}`}function Ye(e){if(e.tokensUnavailable)return`—`;let t=e.totalTokensIn+e.totalTokensOut+e.totalTokensCacheRead+e.totalTokensCacheCreate;return`${(e.nullTokenCount??0)>0?`≥`:``}${Ge(t)}`}var Xe=`specrails-desktop:job-run-details`;function Ze(e){try{let t=localStorage.getItem(Xe);return t?JSON.parse(t)?.[e]===!0:!1}catch{return!1}}function Qe(e,t){try{let n=localStorage.getItem(Xe),r={};if(n)try{let e=JSON.parse(n);e&&typeof e==`object`&&(r=e)}catch{}r[e]=t,localStorage.setItem(Xe,JSON.stringify(r))}catch{}}var $e={running:{variant:`running`,labelKey:`statusLabel.running`,tooltipKey:`statusTooltip.running`},completed:{variant:`success`,labelKey:`statusLabel.completed`,tooltipKey:`statusTooltip.completed`},failed:{variant:`failed`,labelKey:`statusLabel.failed`,tooltipKey:`statusTooltip.failed`},canceled:{variant:`canceled`,labelKey:`statusLabel.canceled`,tooltipKey:`statusTooltip.canceled`},queued:{variant:`queued`,labelKey:`statusLabel.queued`,tooltipKey:`statusTooltip.queued`},zombie_terminated:{variant:`failed`,labelKey:`statusLabel.zombie`,tooltipKey:`statusTooltip.zombie`},skipped:{variant:`queued`,labelKey:`statusLabel.skipped`,tooltipKey:`statusTooltip.skipped`}};function et({job:e,events:t,phases:n,phaseDefinitions:r,projectId:i,variant:a,pipelineTotals:s,actions:c,onOpenRun:l}){let{t:u}=o(`jobs`),{t:d}=o(`agentRuntime`),f=e.status===`running`,p=e.status===`queued`,m=e.command.startsWith(`loop:`),_=$e[e.status]??$e.queued,[v,y]=(0,G.useState)(()=>Date.now());(0,G.useEffect)(()=>{if(!f)return;y(Date.now());let e=window.setInterval(()=>y(Date.now()),1e3);return()=>window.clearInterval(e)},[f]);let b=e.finished_at?Re(e.started_at,e.finished_at):f?Re(e.started_at,v):`—`,S=Ue(e.id,t),C=ee(i,{jobId:e.id,enabled:!!i}),w=C.runs[0],[T,E]=(0,G.useState)(()=>Ze(a)),D=e=>{E(e),Qe(a,e)},O=(0,G.useMemo)(()=>r.find(e=>n[e.key]===`running`)?.label??null,[n,r]),k=w?.nextStep?d(`roles.${w.nextStep}`,{defaultValue:w.nextStep}):null,A=O??k,{key:j,arg:M}=We(S,f),N=M==null?u(`statusPanel.activity.${j}`):u(`statusPanel.activity.${j}`,{arg:M}),F=f?A?u(`runHeader.phaseActivity`,{phase:A,activity:N}):N:w&&!w.active&&w.nextStep&&(w.canResume||w.pendingQuestion||w.pendingApproval)?u(`runHeader.phaseActivity`,{phase:d(`runs.status.${w.status}`,{defaultValue:w.status}),activity:d(`runs.phase`,{phase:k})}):null,I=m&&f&&S.steps>0?u(`statusPanel.steps`,{count:S.steps}):null,R=Ke(e),z=!f&&!p,te=(0,G.useMemo)(()=>z?ze(t):[],[t,z]),re=f&&S.turns>0,B=C.runs.length>0?C.error:``,V=!!w?.pendingQuestion&&!!w.canResume&&!w.recoverableSteps.length,ae=z||re||!!w&&!!i||!!B,U=C.busy!==null,se=w?(0,K.jsxs)(K.Fragment,{children:[w.canResume&&!V&&(w.engineVersion===2&&w.recoverableSteps.length>0?(0,K.jsx)(ie,{run:w,busy:U,onRecover:e=>void C.act(w,`recover`,e)},`${i}:${w.runId}`):(0,K.jsx)(L,{size:`sm`,className:`h-7`,disabled:U,onClick:()=>void C.act(w,w.recoverableSteps.length?`recover`:w.pendingApproval?`approve`:`resume`),children:w.recoverableSteps.length?d(`runs.recover`):w.pendingApproval?d(`runs.approve`):d(`runs.resume`)})),V&&(0,K.jsxs)(L,{size:`sm`,variant:`outline`,className:`h-7 border-accent-warning/40 text-accent-warning hover:bg-accent-warning/10`,onClick:()=>D(!0),children:[(0,K.jsx)(Fe,{className:`w-3.5 h-3.5 mr-1.5`,"aria-hidden":!0}),u(`runHeader.questionPending`)]}),w.canSettle&&(0,K.jsx)(L,{size:`sm`,className:`h-7`,disabled:U,onClick:()=>void C.act(w,`settle`),children:d(`runs.prepareDelivery`)}),w.forkSuccessor&&l&&(0,K.jsx)(L,{size:`sm`,variant:`outline`,onClick:()=>l(w.forkSuccessor),children:u(`loopExplorer.openFork`)}),w.canCancel&&(0,K.jsx)(L,{size:`sm`,variant:`secondary`,className:`h-7`,disabled:U,onClick:()=>void C.act(w,`cancel`),children:d(`runs.cancel`)})]}):null;return(0,K.jsxs)(`div`,{"data-testid":`job-run-header`,className:P(`shrink-0`,a===`glass`?`border-b border-border/30 bg-surface/30`:`border-b border-border bg-background`),children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap px-3 py-2 min-w-0`,children:[(0,K.jsxs)(H,{children:[(0,K.jsx)(W,{asChild:!0,children:(0,K.jsx)(`div`,{children:(0,K.jsx)(fe,{variant:_.variant,children:u(_.labelKey)})})}),(0,K.jsx)(me,{children:u(_.tooltipKey)})]}),(0,K.jsxs)(`span`,{className:P(`inline-flex items-center gap-1.5 text-xs tabular-nums`,f?`text-accent-info font-medium`:`text-muted-foreground`),title:u(f?`statusPanel.liveTooltip`:`statusPanel.duration`),children:[f&&(0,K.jsx)(`span`,{className:`inline-block w-1.5 h-1.5 rounded-full bg-accent-info animate-pulse`,"aria-hidden":!0}),b]}),F&&(0,K.jsxs)(`span`,{className:`flex items-center gap-1.5 min-w-0 flex-1 basis-40 text-xs text-muted-foreground`,children:[f&&(0,K.jsx)(x,{className:`w-3 h-3 shrink-0 text-accent-info animate-spin`,"aria-hidden":!0}),(0,K.jsx)(`span`,{className:`truncate`,"data-testid":`job-run-activity`,children:F})]}),!F&&(0,K.jsx)(`span`,{className:`flex-1`}),I&&(0,K.jsx)(`span`,{className:`text-[11px] text-muted-foreground/70 tabular-nums shrink-0`,children:I}),(0,K.jsxs)(`div`,{className:`flex items-center gap-1.5 shrink-0 ml-auto`,children:[se,c,ae&&(0,K.jsxs)(`button`,{type:`button`,onClick:()=>D(!T),"aria-expanded":T,className:`inline-flex items-center gap-1 h-7 px-2 rounded-md text-[11px] text-muted-foreground hover:text-foreground hover:bg-surface/60 transition-colors`,children:[u(`runHeader.details`),(0,K.jsx)(g,{className:P(`w-3.5 h-3.5 transition-transform duration-150`,T&&`rotate-180`),"aria-hidden":!0})]})]})]}),r.length>0&&(0,K.jsx)(`div`,{className:`px-3 pb-2 overflow-x-auto`,children:(0,K.jsx)(Ie,{phases:n,phaseDefinitions:r})}),ae&&T&&(0,K.jsxs)(`div`,{"data-testid":`job-run-details`,className:`px-3 pb-3 space-y-3 border-t border-border/20 pt-3 text-xs`,children:[re&&(0,K.jsxs)(`div`,{children:[(0,K.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 max-w-sm`,children:[(0,K.jsx)(q,{label:u(`statusPanel.turns`),value:String(S.turns)}),(0,K.jsx)(q,{label:u(`statusPanel.tokens`),value:Ge(S.tokens)})]}),(0,K.jsx)(`p`,{className:`text-[10px] text-muted-foreground/60 mt-1`,children:u(`runHeader.liveReported`)})]}),z&&(0,K.jsxs)(`div`,{className:`grid grid-cols-3 gap-2 max-w-lg`,children:[(0,K.jsx)(q,{label:u(`statusPanel.cost`),value:R.cost,valueClass:`text-yellow-400 aurora-light:text-accent-warning`,naCaption:h(e.provider)?u(`statusPanel.costUnknownLocal`):u(`statusPanel.notAvailable`),naTooltip:h(e.provider)?u(`statusPanel.costUnknownLocalTooltip`):void 0}),(0,K.jsx)(q,{label:u(`statusPanel.turns`),value:R.turns,naCaption:u(`statusPanel.notAvailable`)}),(0,K.jsx)(q,{label:u(`statusPanel.tokens`),value:R.tokens,naCaption:u(`statusPanel.notAvailable`)})]}),z&&s&&(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`p`,{className:`text-[10px] text-muted-foreground/50 uppercase tracking-wider mb-1.5`,children:u(`statusPanel.pipelineTotal`,{count:s.jobCount})}),(0,K.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 max-w-sm`,children:[(0,K.jsx)(q,{label:u(`statusPanel.totalCost`),value:Je(s),valueClass:`text-yellow-400 aurora-light:text-accent-warning`}),(0,K.jsx)(q,{label:u(`statusPanel.totalTokens`),value:Ye(s)})]}),s.hasNullCost&&!s.costUnavailable&&(0,K.jsx)(`p`,{"data-testid":`pipeline-partial-hint`,className:`text-[10px] text-muted-foreground/70 mt-1.5`,title:u(`statusPanel.pipelinePartialTooltip`),children:u(`statusPanel.pipelinePartial`,{count:s.nullCostCount??0})}),s.costUnavailable&&(0,K.jsx)(`p`,{"data-testid":`pipeline-cost-unavailable`,className:`text-[10px] text-muted-foreground/70 mt-1.5`,children:u(`statusPanel.pipelineCostUnavailable`)}),(s.nullTokenCount??0)>0&&(0,K.jsx)(`p`,{"data-testid":`pipeline-usage-coverage-hint`,className:`text-[10px] text-muted-foreground/70 mt-1`,title:u(`statusPanel.pipelineUsageTooltip`),children:s.tokensUnavailable?u(`statusPanel.pipelineUsageUnavailable`):u(`statusPanel.pipelineUsagePartial`,{count:s.nullTokenCount??0})})]}),te.length>0&&(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`p`,{className:`text-[10px] text-muted-foreground/50 uppercase tracking-wider mb-1.5`,children:u(`statusPanel.filesModified`)}),(0,K.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:te.map(e=>(0,K.jsx)(`code`,{className:`text-[10px] font-mono bg-muted/30 px-2 py-0.5 rounded text-cyan-400/80 aurora-light:text-accent-info`,children:e},e))})]}),(w||B)&&i&&(0,K.jsxs)(`section`,{"aria-label":d(`runs.implementation`),className:`space-y-2`,onClick:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation(),children:[B&&(0,K.jsx)(`p`,{role:`alert`,className:`text-destructive`,children:B}),w?.historical&&(0,K.jsx)(`p`,{className:`text-muted-foreground`,children:d(`evidence.historical`)}),w?.status===`succeeded`&&(0,K.jsx)(`p`,{className:`text-muted-foreground`,children:d(`runs.reviewDelivery`)}),w?.canResume&&(0,K.jsx)(`p`,{className:`text-muted-foreground`,children:d(`runs.preserveProgress`)}),w?.error&&(0,K.jsx)(`p`,{className:`text-destructive`,children:w.error}),w?.pendingApproval?.reason&&(0,K.jsx)(`p`,{className:`text-muted-foreground`,children:w.pendingApproval.reason}),w?.pendingQuestion&&(0,K.jsxs)(`div`,{className:`space-y-2`,children:[(0,K.jsx)(`p`,{className:`font-medium`,children:d(`runs.question`)}),(0,K.jsx)(`p`,{className:`whitespace-pre-wrap`,children:w.pendingQuestion.question}),V&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`label`,{className:`block space-y-1`,children:[d(`runs.answerLabel`),(0,K.jsx)(`textarea`,{className:`min-h-20 w-full rounded-md border border-input bg-background px-2 py-1 text-sm`,maxLength:2e4,placeholder:d(`runs.answerPlaceholder`),value:C.answers[w.runId]??``,onChange:e=>C.setAnswer(w.runId,e.target.value)})]}),(0,K.jsx)(L,{size:`sm`,disabled:U||!C.answers[w.runId]?.trim(),onClick:()=>void C.act(w,`answer`),children:d(`runs.answer`)})]})]}),w?.metrics&&(0,K.jsx)(ne,{metrics:w.metrics}),w&&(0,K.jsx)(oe,{projectId:i,runId:w.runId,summary:w.efficiencySummary,historical:w.historical}),w&&(0,K.jsx)(ve,{projectId:i,run:w,onAccepted:C.refresh})]})]})]})}function q({label:e,value:t,valueClass:n,naCaption:r,naTooltip:i}){return(0,K.jsxs)(`div`,{className:`bg-muted/20 rounded-lg px-2.5 py-1.5`,title:t==null?i:void 0,children:[(0,K.jsx)(`p`,{className:`text-[10px] text-muted-foreground/50 uppercase tracking-wider`,children:e}),(0,K.jsx)(`p`,{className:P(`text-sm font-semibold tabular-nums`,t==null?`text-muted-foreground`:n),children:t??`—`}),t==null&&r&&(0,K.jsx)(`p`,{className:`text-[10px] text-muted-foreground/40`,children:r})]})}function tt(e){let t=e.trimStart();return!!(/^#{1,6}\s/.test(t)||/^[-*+]\s/.test(t)||/^\d+\.\s/.test(t)||/^\|.+\|/.test(t)||t.startsWith("```")||t.startsWith(`> `)||/\*\*[^*]+\*\*/.test(e)||/`[^`]+`/.test(e)||/\[.+\]\(.+\)/.test(e)||/^(-{3,}|_{3,}|\*{3,})$/.test(t)||/^- \[[ x]\]\s/.test(t))}var nt=new Set;function rt({ticketId:e,onOpen:t,children:n}){let{t:r}=o(`agent`),i=r(`refs.openTicket`,{id:e});return(0,K.jsx)(`button`,{type:`button`,"data-testid":`log-ticket-ref`,onClick:n=>{n.stopPropagation(),t(e)},title:i,"aria-label":i,className:`inline cursor-pointer p-0 align-baseline text-accent-primary/90 underline decoration-accent-primary/50 decoration-dotted underline-offset-2 transition-colors hover:text-accent-primary hover:decoration-solid`,children:n})}function it(e){if(!e.includes(`#`))return null;let t=_e(e,nt);return t.some(e=>e.kind===`ticket`)?t:null}function at(e,t){let n=it(e);return n?n.map((e,n)=>e.kind===`ticket`?(0,K.jsx)(rt,{ticketId:e.ticketId,onOpen:t,children:e.label},n):(0,K.jsx)(G.Fragment,{children:e.kind===`text`?e.text:e.label},n)):e}var ot=new Set([`code`,`inlineCode`,`link`,`linkReference`,`image`,`imageReference`,`definition`,`html`]);function st(e){return e.kind===`ticket`?{type:`link`,url:z({kind:`ticket`,ticketId:e.ticketId}),children:[{type:`text`,value:e.label}]}:{type:`text`,value:e.kind===`text`?e.text:e.label}}function ct(e){let t=e.children;if(t)for(let e=t.length-1;e>=0;e--){let n=t[e];if(!ot.has(n.type))if(n.type===`text`&&typeof n.value==`string`){let r=_e(n.value,nt);r.some(e=>e.kind===`ticket`)&&t.splice(e,1,...r.map(st))}else ct(n)}}function lt(){return e=>ct(e)}function ut(e){let{activeProjectId:t}=l(),{openRef:n}=he(),r=e??t??void 0;return(0,G.useMemo)(()=>r?e=>{n(r,{kind:`ticket`,ticketId:e})}:void 0,[r,n])}function dt(e,t){let n=`${e.id??t}`,i=e.timestamp;if(e.event_type===`log`)try{let t=JSON.parse(e.payload).line??``;return t.trim()?t.startsWith(`▸`)||t.match(/^(architect|developer|reviewer|ship|analyst)\s*:/i)?{id:n,content:t,type:`phase`,timestamp:i}:e.source===`stderr`?{id:n,content:t,type:`stderr`,timestamp:i}:tt(t)?{id:n,content:t,type:`assistant`,timestamp:i}:{id:n,content:t,type:`plain`,timestamp:i}:null}catch{return null}if(e.event_type!==`log`&&e.event_type!==`result`)return null;if(e.event_type===`result`)try{let t=JSON.parse(e.payload),a=[];return t.duration_ms&&a.push(`${(t.duration_ms/1e3).toFixed(1)}s`),t.total_cost_usd&&a.push(`$${t.total_cost_usd.toFixed(4)}`),t.num_turns&&a.push(r.t(`jobs:logViewer.turns`,{count:t.num_turns})),{id:n,content:`▸ ${r.t(`jobs:logViewer.completed`)}${a.length?` — ${a.join(` · `)}`:``}`,type:`result`,timestamp:i}}catch{return null}return null}function ft(e){let t=`none`,n=[];for(let r of e){let e=r.type;if(e!==`plain`&&e!==`log`){t=`none`,n.push(r);continue}let i=r.content;i.startsWith(`--- `)?(t=`saw_minus`,n.push({...r,type:`diff-meta`})):t===`saw_minus`&&i.startsWith(`+++ `)?(t=`active`,n.push({...r,type:`diff-meta`})):t===`active`&&i.startsWith(`@@ `)?n.push({...r,type:`diff-hunk`}):t===`active`&&i.startsWith(`+`)&&!i.startsWith(`+++`)?n.push({...r,type:`diff-add`}):t===`active`&&i.startsWith(`-`)&&!i.startsWith(`---`)?n.push({...r,type:`diff-remove`}):(t===`active`&&(i.startsWith(` `)||i===``)||(t=`none`),n.push(r))}return n}function pt(e){let t=[];for(let n of e){let e=t.length>0?t[t.length-1]:null;n.type===`assistant`&&e?.type===`assistant`?e.content+=`
|
|
2
|
-
`+n.content:t.push({...n})}return t}function mt(e){let t=[{key:`__preamble__`,header:null,lines:[]}];for(let n of e)n.type===`phase`?t.push({key:n.id,header:n,lines:[]}):t[t.length-1].lines.push(n);return t.filter(e=>e.header!==null||e.lines.length>0)}function ht({events:e,isLoading:t,projectId:n}){let{t:r,i18n:i}=o(`jobs`),[a,s]=(0,G.useState)(``),[c,l]=(0,G.useState)(!0),[d,f]=(0,G.useState)(new Set),p=(0,G.useRef)(null),m=(0,G.useRef)(null),h=ut(n),{processedLines:_,groups:v,totalLines:y}=(0,G.useMemo)(()=>{let t=ft(pt(e.map((e,t)=>dt(e,t)).filter(e=>e!==null)));return{processedLines:t,groups:mt(t),totalLines:t.length}},[e,i.language]),b=(0,G.useMemo)(()=>{if(!a)return y;let e=a.toLowerCase();return _.filter(t=>t.content.toLowerCase().includes(e)).length},[a,_,y]),x=(0,G.useCallback)(()=>{let e=m.current;e&&(e.scrollTop=e.scrollHeight)},[]);(0,G.useEffect)(()=>{c&&x()},[e.length,c,x]);function S(){let e=m.current;if(!e)return;let t=e.scrollHeight-e.scrollTop-e.clientHeight<50;l(t)}function C(e){f(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}return t?(0,K.jsx)(`div`,{className:`flex-1 flex items-center justify-center`,children:(0,K.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:r(`logViewer.loading`)})}):y===0?(0,K.jsx)(`div`,{className:`flex-1 flex items-center justify-center`,children:(0,K.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:r(`logViewer.empty`)})}):(0,K.jsxs)(`div`,{className:`flex flex-col h-full`,children:[(0,K.jsxs)(`div`,{className:`px-4 py-2 border-b border-border flex items-center gap-2`,children:[(0,K.jsxs)(`div`,{className:`relative flex-1 max-w-xs`,children:[(0,K.jsx)(T,{className:`absolute left-2.5 top-1/2 -translate-y-1/2 w-3 h-3 text-muted-foreground`}),(0,K.jsx)(se,{placeholder:r(`logViewer.filterPlaceholder`),value:a,onChange:e=>s(e.target.value),className:`pl-7 h-7`})]}),(0,K.jsx)(L,{variant:`ghost`,size:`sm`,className:`h-7 px-2 text-muted-foreground/50 hover:text-foreground`,onClick:()=>{let e=_.map(e=>e.content).join(`
|
|
3
|
-
`);navigator.clipboard.writeText(e).then(()=>{u.success(r(`logViewer.copySuccess`))}).catch(()=>{u.error(r(`logViewer.copyFailed`))})},children:(0,K.jsx)(V,{className:`w-3.5 h-3.5`})}),(0,K.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:r(`logViewer.lineCount`,{filtered:b,total:y})})]}),(0,K.jsxs)(`div`,{ref:m,className:`flex-1 overflow-y-auto p-2 text-xs relative`,onScroll:S,children:[v.map(e=>(0,K.jsx)(gt,{group:e,filter:a,collapsed:d.has(e.key),onToggle:()=>C(e.key),onOpenTicket:h},e.key)),(0,K.jsx)(`div`,{ref:p})]}),!c&&(0,K.jsxs)(L,{size:`sm`,variant:`secondary`,onClick:()=>{l(!0),x()},className:`absolute bottom-16 right-6 h-7 gap-1 shadow-lg`,children:[(0,K.jsx)(g,{className:`w-3 h-3`}),r(`logViewer.jumpToBottom`)]})]})}var gt=(0,G.memo)(function({group:e,filter:t,collapsed:n,onToggle:r,onOpenTicket:i}){let{t:a}=o(`jobs`),s=t?e.lines.filter(e=>e.content.toLowerCase().includes(t.toLowerCase())):e.lines;if(e.header===null)return s.length===0?null:(0,K.jsx)(`div`,{children:s.map((e,t)=>(0,K.jsx)(bt,{line:e,even:t%2==0,onOpenTicket:i},e.id))});let c=e.header.content;return(0,K.jsxs)(`div`,{className:`mt-3 rounded-md overflow-hidden border border-border/20`,children:[(0,K.jsxs)(`button`,{type:`button`,onClick:r,className:P(`flex items-center gap-2 w-full text-left px-3 py-2`,`bg-primary/5 border-b border-primary/20`,`hover:bg-primary/10 transition-colors duration-150 cursor-pointer`),children:[(0,K.jsx)(v,{className:P(`w-3 h-3 text-primary/60 shrink-0 transition-transform duration-150`,!n&&`rotate-90`)}),(0,K.jsx)(`span`,{className:`flex-1 text-[12px] font-semibold text-foreground leading-none`,children:c}),e.header.timestamp&&(0,K.jsx)(`span`,{className:`text-[10px] text-muted-foreground/40 font-mono tabular-nums shrink-0`,children:new Date(e.header.timestamp).toLocaleTimeString(`en`,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1})}),(0,K.jsx)(`span`,{className:`text-[10px] text-muted-foreground/40 shrink-0`,children:a(`logViewer.phaseLines`,{count:e.lines.length})})]}),!n&&(0,K.jsx)(`div`,{className:`bg-muted/5`,children:s.length===0?(0,K.jsx)(`p`,{className:`px-4 py-2 text-[10px] text-muted-foreground/40 italic`,children:a(t?`logViewer.noMatchingLines`:`logViewer.noOutput`)}):s.map((e,t)=>(0,K.jsx)(bt,{line:e,even:t%2==0,onOpenTicket:i},e.id))})]})}),_t=[De],vt=[I],yt=[I,lt],bt=(0,G.memo)(function({line:e,even:t,onOpenTicket:n}){let r=e.type===`assistant`,i=e.type===`diff-add`,a=e.type===`diff-remove`,o=e.type===`diff-meta`,s=e.type===`diff-hunk`,c=i||a||o||s,l=n!=null&&(e.type===`plain`||e.type===`log`),u=(0,G.useMemo)(()=>l&&n?at(e.content,n):e.content,[l,n,e.content]),d=r&&n?yt:vt,f=(0,G.useMemo)(()=>n?{a:({href:e,children:t})=>{let r=ue(e);return r?.kind===`ticket`?(0,K.jsx)(rt,{ticketId:r.ticketId,onOpen:n,children:t}):(0,K.jsx)(`a`,{href:e,children:t})}}:void 0,[n]);return(0,K.jsxs)(`div`,{className:P(`flex items-start gap-2 group px-2 py-0.5 rounded-sm`,!c&&(t?`bg-muted/20`:`bg-transparent`),e.type===`result`&&`bg-emerald-500/5 aurora-light:bg-accent-success/10 border-l-2 border-emerald-500/40 aurora-light:border-accent-success/40 mt-2 py-2`,i&&`bg-emerald-500/8 aurora-light:bg-accent-success/10 border-l-2 border-emerald-500/50 aurora-light:border-accent-success/50`,a&&`bg-red-500/8 aurora-light:bg-destructive/10 border-l-2 border-red-500/50 aurora-light:border-destructive/50`,o&&`bg-accent-primary/5 border-l-2 border-accent-primary/30`,s&&`bg-accent-info/5 border-l-2 border-accent-info/30`),children:[e.timestamp&&(0,K.jsx)(`span`,{className:`text-[10px] text-muted-foreground/40 shrink-0 mt-0.5 w-[52px] font-mono tabular-nums`,children:new Date(e.timestamp).toLocaleTimeString(`en`,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1})}),r?(0,K.jsx)(`div`,{className:`flex-1 min-w-0 prose prose-invert prose-xs max-w-none
|
|
4
|
-
prose-p:my-1 prose-p:leading-relaxed
|
|
5
|
-
prose-headings:mt-2 prose-headings:mb-1 prose-headings:text-sm prose-headings:font-semibold
|
|
6
|
-
prose-ul:my-1 prose-ol:my-1 prose-li:my-0
|
|
7
|
-
prose-code:text-cyan-300 prose-code:text-[11px] prose-code:bg-muted/40 prose-code:px-1 prose-code:py-0.5 prose-code:rounded
|
|
8
|
-
prose-pre:my-1 prose-pre:bg-muted/30 prose-pre:rounded-md prose-pre:p-2 prose-pre:text-[11px]
|
|
9
|
-
prose-strong:text-foreground prose-em:text-foreground/70
|
|
10
|
-
prose-a:text-blue-400 prose-a:no-underline hover:prose-a:underline
|
|
11
|
-
prose-table:my-2 prose-table:text-[11px]
|
|
12
|
-
prose-thead:border-border prose-thead:bg-muted/30
|
|
13
|
-
prose-th:px-3 prose-th:py-1.5 prose-th:text-left prose-th:font-semibold prose-th:text-foreground/90
|
|
14
|
-
prose-td:px-3 prose-td:py-1.5 prose-td:border-border
|
|
15
|
-
prose-tr:border-border
|
|
16
|
-
text-foreground/80`,children:(0,K.jsx)(F,{remarkPlugins:d,rehypePlugins:_t,components:f,children:e.content})}):(0,K.jsx)(`span`,{className:P(`flex-1 break-all leading-relaxed whitespace-pre-wrap font-mono`,e.type===`tool-use`&&`text-cyan-400/80 aurora-light:text-accent-info text-[11px]`,e.type===`stderr`&&`text-orange-400 aurora-light:text-accent-warning`,e.type===`result`&&`text-emerald-400 aurora-light:text-accent-success font-medium`,e.type===`log`&&`text-foreground/60`,e.type===`plain`&&`text-foreground/70`,e.type===`tool-result`&&`text-muted-foreground/50`,i&&`text-emerald-400 aurora-light:text-accent-success`,a&&`text-red-400 aurora-light:text-destructive`,o&&`text-accent-primary/80`,s&&`text-accent-info/80`),children:u})]})}),xt=e=>!!e&&typeof e==`object`&&!Array.isArray(e);function St(e){if(!xt(e)||typeof e.entry!=`string`||!Array.isArray(e.nodes)||e.nodes.length>1e4)return null;let t=[];for(let n of e.nodes){if(!xt(n)||typeof n.id!=`string`||!n.id||typeof n.kind!=`string`||typeof n.label!=`string`||!xt(n.ends)||Object.values(n.ends).some(e=>e!==null&&typeof e!=`string`)||n.component!==void 0&&typeof n.component!=`string`)return null;t.push({id:n.id,kind:n.kind,label:n.label,ends:n.ends,...typeof n.component==`string`?{component:n.component}:{}})}let n=new Set(t.map(e=>e.id));return n.size!==t.length||!n.has(e.entry)||t.some(e=>Object.values(e.ends).some(e=>e!==null&&!n.has(e)))?null:{entry:e.entry,nodes:t}}function Ct(e){let t=St(e);if(!t||!xt(e)||e.components!==void 0&&!xt(e.components))return null;let n=Object.create(null);for(let[t,r]of Object.entries(e.components??{})){let e=St(r);if(!e)return null;n[t]=e}return{...t,components:n}}var J=e=>typeof e==`object`&&!!e&&!Array.isArray(e),Y=e=>typeof e==`number`&&Number.isFinite(e)&&e>=0,wt=e=>Array.isArray(e)&&e.every(e=>typeof e==`string`);function Tt(e){if(!J(e)||e.version!==1||typeof e.execution!=`string`||!Y(e.steps)||!Y(e.deciderEvaluations)||!(e.turns===null||Y(e.turns))||!(e.costUsd===null||Y(e.costUsd))||typeof e.costUncertain!=`boolean`||e.engineVersion===2&&e.completion!==void 0&&(!J(e.completion)||typeof e.completion.ok!=`boolean`||typeof e.completion.verified!=`boolean`||!wt(e.completion.reasons)))return null;if(e.core!==null){let t=e.core;if(!J(t)||typeof t.change!=`string`||typeof t.recordedAt!=`string`||!J(t.completion)||![`implementation`,`validation`,`archive`,`delivery`].every(e=>typeof t.completion==`object`&&typeof t.completion[e]==`string`)||!wt(t.completion.reasons)||!wt(t.findings)||!Array.isArray(t.exceptions)||!Array.isArray(t.checks)||!Array.isArray(t.phases)||!t.exceptions.every(e=>J(e)&&[`requirement`,`reason`,`impact`,`acceptedBy`,`approvalEvidence`].every(t=>typeof e[t]==`string`))||!t.checks.every(e=>J(e)&&[`name`,`status`,`scope`,`limitations`].every(t=>typeof e[t]==`string`)&&typeof e.required==`boolean`&&wt(e.evidence))||!t.phases.every(e=>J(e)&&typeof e.name==`string`&&typeof e.status==`string`&&(e.durationMs===null||Y(e.durationMs))&&(e.attempts===null||Y(e.attempts))))return null}return e}function X(e){try{let t=JSON.parse(e);if(t&&typeof t==`object`&&!Array.isArray(t))return t}catch{}return null}var Et=/^\s*━+\s*Step\s+\d+\s*·/,Dt=/\s*\(iteration\s+\d+\)\s*$/i;function Ot(e){return e.replace(/^[\s\uFE0F\p{Extended_Pictographic}]+/u,``).trim()||e.trim()}function kt(e){let t=Ot(e.title);return e.iteration==null?t:t.replace(Dt,``)}function At(e){return e.meta.nodeId??`${e.meta.kind}::${Ot(e.meta.title).replace(Dt,``)}`}function jt(e){let t=null,n=0,r=null,i=[[]],a=new Map,o=[];for(let s=0;s<e.length;s++){let c=e[s];if(c.event_type===`loop_completion`){r=Tt(X(c.payload));continue}if(c.event_type===`runtime-graph`){let e=X(c.payload);if(e&&Array.isArray(e.nodes)&&Array.isArray(e.edges)){let n=e.nodes.filter(e=>!!(e&&typeof e==`object`&&typeof e.path==`string`)),r=e.edges.filter(e=>!!(e&&typeof e==`object`&&typeof e.from==`string`&&typeof e.to==`string`)),i=t;t={...i??{},runtimeTopology:Ct(e.graph)??void 0,loopId:typeof e.workflowId==`string`?e.workflowId:i?.loopId,graph:{nodes:n.map((e,t)=>({id:String(e.path),type:`core`,position:{x:0,y:t*100},data:{label:String(e.label??e.path),kind:e.kind}})),edges:r.map((e,t)=>({id:`core-edge-${t}`,source:String(e.from),target:String(e.to),label:String(e.label)})),config:i?.graph.config??{maxIterations:1,timeoutMinutes:0}}}}continue}if(c.event_type===`loop_graph`){let e=X(c.payload);e&&e.graph&&typeof e.graph==`object`&&!Array.isArray(e.graph)&&(t={graph:e.graph,loopId:typeof e.loopId==`string`?e.loopId:void 0,loopName:typeof e.loopName==`string`?e.loopName:void 0,provider:typeof e.provider==`string`?e.provider:void 0,model:typeof e.model==`string`?e.model:void 0,iterationLimit:typeof e.iterationLimit==`number`?e.iterationLimit:void 0});continue}if(c.event_type===`loop_step`){let e=X(c.payload);if(!e||typeof e.index!=`number`)continue;let t=typeof e.iteration==`number`?e.iteration:null;t!=null&&t>n&&(n=t),o.push({meta:{index:e.index,traceId:typeof e.traceId==`string`?e.traceId:void 0,spanId:typeof e.spanId==`string`?e.spanId:void 0,nodePath:typeof e.nodePath==`string`?e.nodePath:void 0,scopeId:typeof e.scopeId==`string`?e.scopeId:void 0,branch:typeof e.branch==`string`?e.branch:void 0,attemptId:typeof e.attemptId==`string`?e.attemptId:void 0,attempt:typeof e.attempt==`number`?e.attempt:void 0,kind:typeof e.kind==`string`?e.kind:`ai-step`,title:typeof e.title==`string`?e.title:``,nodeId:typeof e.nodeId==`string`?e.nodeId:null,iteration:t,template:typeof e.template==`string`&&e.template?e.template:void 0,command:typeof e.command==`string`&&e.command?e.command:void 0},end:null,lastActivity:null}),typeof e.attemptId==`string`&&a.set(e.attemptId,o.length-1),i.push([]);continue}if(c.event_type===`loop_step_end`){let e=X(c.payload);if(!e||typeof e.index!=`number`)continue;for(let t=o.length-1;t>=0;t--)if(o[t].meta.index===e.index){o[t].end={index:e.index,nodeId:typeof e.nodeId==`string`?e.nodeId:null,status:e.status===`paused`?`paused`:e.status===`interrupted`?`interrupted`:e.status===`stalled`?`stalled`:e.status===`failed`?`failed`:`ok`,exitCode:typeof e.exitCode==`number`?e.exitCode:null,durationMs:typeof e.durationMs==`number`?e.durationMs:null,decision:e.decision===`continue`||e.decision===`stop`?e.decision:void 0,...e.reason===`idle_timeout`||e.reason===`provider_limit`?{reason:e.reason}:{},...typeof e.idleMs==`number`?{idleMs:e.idleMs}:{}};break}continue}let l=X(c.payload),u=l?.attemptId??(l?.event&&typeof l.event==`object`?l.event.attemptId:void 0),d=typeof u==`string`?a.get(u)??-1:-1,f=d>=0?d:u===void 0?o.length-1:-1,p=f>=0,m=dt(c,s);if(m&&!(p&&Et.test(m.content))&&i[f+1].push(m),p){let e=ye(c);e.step&&e.actionKey&&(o[f].lastActivity={actionKey:e.actionKey,actionArg:e.actionArg})}}let s=e=>ft(pt(e)),c=s(i[0]),l=o.map((e,t)=>({key:`step-${t}-${e.meta.index}`,meta:e.meta,lines:s(i[t+1]),end:e.end,lastActivity:e.lastActivity})),u=c.length+l.reduce((e,t)=>e+t.lines.length,0);return{graphMeta:t,setup:c,segments:l,maxIteration:n,totalLines:u,...r?{completion:r}:{}}}function Mt(e,t){return e.end?e.end.status:t.isLast||e.meta.attemptId?t.jobSettled?`interrupted`:`running`:`unknown`}function Nt(e){return e===`continue`?0:e===`stop`?2:1}function Pt(e){let t=new Map(e.nodes.map(e=>[e.id,e])),n=new Set,r=[],i=a=>{if(n.has(a))return;let o=t.get(a);if(!o)return;n.add(a),r.push(o);let s=e.edges.filter(e=>e.source===a).slice().sort((e,t)=>Nt(e.branch)-Nt(t.branch));for(let e of s)i(e.target)},a=e.nodes.find(e=>e.type===`start`);a&&i(a.id);for(let t of e.nodes)i(t.id);return r}function Ft(e){let t=e.data?.label;return typeof t==`string`&&t.trim()?t.trim():null}function It(e,t){let n=e.segments.length-1,r=new Map,i=new Map;e.segments.forEach((e,t)=>{let n=At(e);r.set(n,{seg:e,idx:t}),e.meta.kind===`decider`&&e.end?.decision&&i.set(n,e.end.decision)});let a=e=>{let r=Mt(e.seg,{isLast:e.idx===n,jobSettled:t.jobSettled});return r===`unknown`?`ok`:r===`stalled`?`failed`:r};if(e.graphMeta)return Pt(e.graphMeta.graph).map(e=>{if(e.type===`start`)return{key:e.id,kind:`start`,label:Ft(e),state:`ok`,latestSegmentKey:null};if(e.type===`end`)return{key:e.id,kind:`end`,label:Ft(e),state:t.jobSettled?t.jobFailed?`failed`:`ok`:`pending`,latestSegmentKey:null};let n=r.get(e.id);return n?{key:e.id,kind:e.type,label:Ft(e)??kt(n.seg.meta),state:a(n),decision:e.type===`decider`?i.get(e.id):void 0,latestSegmentKey:n.seg.key}:{key:e.id,kind:e.type,label:Ft(e),state:`pending`,latestSegmentKey:null}});let o=[],s=new Map;return e.segments.forEach((e,t)=>{let n=At(e),r={seg:e,idx:t},c=s.get(n),l=e.meta.kind===`decider`?i.get(n):void 0;if(c!=null){let t=o[c];t.state=a(r),t.decision=l,t.latestSegmentKey=e.key}else s.set(n,o.length),o.push({key:n,kind:e.meta.kind,label:kt(e.meta)||null,state:a(r),decision:l,latestSegmentKey:e.key})}),o}function Lt(e){if(!Number.isFinite(e)||e<0)return`—`;if(e<1e3)return`${Math.round(e)}ms`;let t=e/1e3;if(t<60)return`${t.toFixed(1)}s`;let n=Math.floor(t/60),r=Math.round(t%60);return n<60?`${n}m ${r}s`:`${Math.floor(n/60)}h ${n%60}m`}function Rt({topology:e,segments:t,settled:n,onFocus:r,onFork:i,forkBusy:a}){let{t:s}=o(`jobs`),c=ge(),[l,u]=(0,G.useState)(!1),[p,m]=(0,G.useState)(!1),[h,g]=(0,G.useState)([]),[_,v]=(0,G.useState)(null),b=h[h.length-1]??{path:``,body:e},S=e=>b.path?`${b.path}/${e}`:e,C=t.filter(e=>(e.meta.nodePath??e.meta.nodeId)===_),w=(0,G.useMemo)(()=>{let e=b.body.nodes.flatMap(e=>Object.entries(e.ends).flatMap(([t,n])=>n===null?[]:[{id:`${e.id}:${t}`,source:e.id,target:n,label:t,markerEnd:{type:we.ArrowClosed}}])),r=new Map;for(let e of t){let t=e.meta.nodePath??e.meta.nodeId;if(!t)continue;let n=r.get(t)??new Map;n.set(e.meta.scopeId??`legacy`,e),r.set(t,n)}let i=b.body.nodes.map(e=>{let i=b.path?`${b.path}/${e.id}`:e.id,a=[...(r.get(i)??new Map).values()].map(e=>Mt(e,{isLast:e===t[t.length-1],jobSettled:n})),o=[`running`,`paused`,`failed`,`stalled`,`interrupted`].find(e=>a.includes(e))??(a.length?a.every(e=>e===`ok`)?`ok`:`unknown`:`pending`),c=o===`running`?`var(--color-accent-primary)`:o===`ok`?`var(--color-accent-success)`:o===`failed`?`var(--color-destructive)`:[`paused`,`stalled`,`interrupted`].includes(o)?`var(--color-accent-warning)`:`var(--color-border)`,l=o===`running`?x:o===`ok`?B:o===`failed`?y:[`paused`,`stalled`,`interrupted`].includes(o)?Me:o===`unknown`?d:f;return{id:e.id,type:`default`,position:{x:0,y:0},data:{kind:`core`,label:(0,K.jsxs)(`span`,{className:`block text-left`,"data-state":o,children:[(0,K.jsxs)(`strong`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(l,{"aria-hidden":!0,className:`h-4 w-4 shrink-0 ${o===`running`?`motion-safe:animate-spin`:``}`,style:{color:o===`pending`||o===`unknown`?`var(--color-muted-foreground)`:c}}),e.label]}),(0,K.jsxs)(`span`,{className:`mt-1 block text-[10px]`,children:[e.kind,` · `,s(`loopExplorer.graphState.${o}`)]})]})},style:{background:o===`pending`||o===`unknown`?`var(--color-background)`:`color-mix(in srgb, ${c} 12%, var(--color-background))`,color:`var(--color-foreground)`,borderColor:c,borderWidth:o===`pending`||o===`unknown`?1:2,boxShadow:o===`running`?`0 0 0 2px color-mix(in srgb, ${c} 30%, transparent), 0 0 22px color-mix(in srgb, ${c} 35%, transparent)`:void 0}}});return i.sort((e,t)=>e.id===b.body.entry?-1:+(t.id===b.body.entry)),{nodes:Ee(i,e,`vertical`),edges:e}},[b.body,b.path,t,n,s]),T=b.body.nodes.find(e=>S(e.id)===_),E=T?.component?e.components[T.component]:void 0,D=e=>(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 py-2 text-xs`,children:[h.length>0&&(0,K.jsx)(L,{size:`sm`,variant:`ghost`,onClick:()=>{g(e=>e.slice(0,-1)),v(null)},children:s(`loopExplorer.graphBack`)}),(0,K.jsx)(`code`,{children:b.path||`/`}),e?(0,K.jsx)(A,{asChild:!0,children:(0,K.jsx)(L,{className:`ml-auto`,size:`sm`,variant:`ghost`,"aria-label":s(`loopExplorer.graphExitFullscreen`),title:s(`loopExplorer.graphExitFullscreen`),children:(0,K.jsx)(pe,{className:`h-4 w-4`})})}):(0,K.jsx)(N,{asChild:!0,children:(0,K.jsx)(L,{className:`ml-auto`,size:`sm`,variant:`ghost`,"aria-label":s(`loopExplorer.graphFullscreen`),title:s(`loopExplorer.graphFullscreen`),children:(0,K.jsx)(te,{className:`h-4 w-4`})})})]}),(0,K.jsx)(`div`,{className:e?`min-h-0 flex-1 rounded border border-border`:`h-72 rounded border border-border`,"aria-label":s(`loopExplorer.runtimeGraph`),children:(0,K.jsxs)(Se,{colorMode:c.scheme===`dark`?`dark`:`light`,nodes:w.nodes,edges:w.edges,nodesDraggable:!1,nodesConnectable:!1,edgesReconnectable:!1,deleteKeyCode:null,fitView:!0,minZoom:.1,onNodeClick:(e,t)=>v(S(t.id)),children:[(0,K.jsx)(Ce,{}),(0,K.jsx)(Te,{showInteractive:!1})]},`${b.path}:${e}`)}),_&&(0,K.jsxs)(`div`,{className:`shrink-0 space-y-2 py-2 text-xs`,children:[(0,K.jsx)(`code`,{className:`break-all`,children:_}),E&&h.length<16&&(0,K.jsx)(L,{size:`sm`,variant:`outline`,onClick:()=>{g(e=>[...e,{path:_,body:E}]),v(null)},children:s(`loopExplorer.graphOpenComponent`)}),C.length===0?(0,K.jsx)(`p`,{children:s(`loopExplorer.graphNoAttempts`)}):(0,K.jsx)(`ul`,{className:`max-h-40 space-y-1 overflow-auto`,children:C.map(e=>(0,K.jsxs)(`li`,{children:[(0,K.jsxs)(`button`,{className:`text-left underline underline-offset-2`,onClick:()=>r(e.key),children:[e.meta.scopeId??`/`,` · `,e.meta.attemptId??e.meta.index,` · `,s(`loopExplorer.graphState.${Mt(e,{isLast:!0,jobSettled:n})}`)]}),i&&e.end&&e.meta.nodePath&&e.meta.scopeId&&e.meta.iteration!=null&&(0,K.jsx)(L,{className:`ml-2`,size:`sm`,variant:`outline`,disabled:a,onClick:()=>i(e),children:s(`loopExplorer.repeatFromHere`)}),e.meta.traceId&&(0,K.jsxs)(`code`,{className:`block break-all text-[10px] text-muted-foreground`,children:[`traceId: `,e.meta.traceId,e.meta.spanId?` · spanId: ${e.meta.spanId}`:``]})]},e.key))})]})]});return(0,K.jsxs)(M,{open:p,onOpenChange:m,children:[(0,K.jsxs)(`details`,{className:`shrink-0 border-b border-border p-2`,onToggle:e=>u(e.currentTarget.open),children:[(0,K.jsx)(`summary`,{className:`cursor-pointer text-xs font-medium`,children:s(`loopExplorer.runtimeGraph`)}),l&&D(!1)]}),(0,K.jsxs)(j,{overlayClassName:`z-[2147483646]`,className:`z-[2147483647] flex w-screen max-w-none !max-h-none flex-col gap-0 rounded-none p-3 sm:rounded-none`,style:{height:`calc(100dvh - ${O()}px)`},showCloseButton:!1,"aria-describedby":void 0,children:[(0,K.jsx)(k,{className:`shrink-0 text-sm`,children:s(`loopExplorer.runtimeGraph`)}),D(!0)]})]})}function zt({result:e}){let{t}=o(`jobs`),{t:n}=o(`loops`),r=e.core,i=e=>t(`completion.status.${e}`,{defaultValue:e});return(0,K.jsxs)(`section`,{"aria-label":t(`completion.title`),className:`border-b border-border/40 px-4 py-3 text-xs space-y-2`,"data-testid":`loop-completion`,children:[(0,K.jsxs)(`p`,{className:`font-medium`,children:[t(`completion.execution`),`: `,i(e.execution)]}),e.completion?(0,K.jsxs)(`div`,{className:`space-y-1`,children:[(0,K.jsxs)(`p`,{className:e.completion.ok?`text-accent-success`:`text-accent-warning`,children:[n(`core.acceptance`),`: `,i(e.completion.ok?`complete`:`blocked`)]}),(0,K.jsxs)(`p`,{children:[n(`core.verified`),`: `,i(e.completion.verified?`verified`:`unverified`)]}),e.completion.reasons.map((e,t)=>(0,K.jsx)(`p`,{className:`text-foreground/70`,children:e},t))]}):r?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`dl`,{className:`grid grid-cols-2 gap-2 md:grid-cols-4`,children:[`implementation`,`validation`,`archive`,`delivery`].map(e=>(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`dt`,{className:`text-foreground/70`,children:t(`completion.${e}`)}),(0,K.jsx)(`dd`,{className:r.completion[e]===`with-exceptions`||r.completion[e]===`blocked`?`text-accent-warning font-medium`:`font-medium`,children:i(r.completion[e])})]},e))}),(0,K.jsxs)(`details`,{children:[(0,K.jsx)(`summary`,{className:`cursor-pointer`,children:t(`completion.evidence`)}),(0,K.jsxs)(`div`,{className:`space-y-2 pt-2 break-words`,children:[(0,K.jsx)(`p`,{className:`text-foreground/70`,children:t(`completion.snapshot`,{change:r.change,at:r.recordedAt})}),r.completion.reasons.map((e,t)=>(0,K.jsx)(`p`,{children:e},`reason-${t}`)),r.exceptions.map((e,n)=>(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`p`,{className:`font-medium`,children:e.requirement}),(0,K.jsxs)(`p`,{children:[e.reason,` — `,e.impact]}),(0,K.jsxs)(`p`,{children:[t(`completion.acceptedBy`,{by:e.acceptedBy}),`: `,e.approvalEvidence]})]},`exception-${n}`)),r.checks.map((e,n)=>(0,K.jsxs)(`div`,{children:[(0,K.jsxs)(`p`,{className:`font-medium`,children:[e.name,`: `,i(e.status),` (`,t(e.required?`completion.required`:`completion.supplementary`),`)`]}),(0,K.jsxs)(`p`,{children:[e.scope,` — `,e.limitations]}),(0,K.jsx)(`p`,{className:`text-foreground/70`,children:e.evidence.join(`; `)})]},`check-${n}`)),r.findings.map((e,t)=>(0,K.jsx)(`p`,{children:e},`finding-${t}`)),r.phases.map(e=>(0,K.jsxs)(`p`,{children:[e.name,`: `,i(e.status),` · `,e.durationMs==null?t(`completion.unavailable`):`${(e.durationMs/1e3).toFixed(1)}s`,` · `,e.attempts==null?t(`completion.unavailable`):t(`completion.attempts`,{count:e.attempts})]},e.name)),(0,K.jsx)(`p`,{className:`text-foreground/70`,children:t(`completion.phaseCostUnavailable`)})]})]})]}):(0,K.jsx)(`p`,{className:`text-foreground/70`,children:t(`completion.noCoreEvidence`)})]})}var Bt={start:S,"ai-step":ce,shell:de,decider:b,condition:b,end:xe},Vt=C,Ht={start:`text-accent-success`,"ai-step":`text-accent-primary`,shell:`text-accent-warning`,decider:`text-accent-highlight`,condition:`text-accent-info`,end:`text-accent-secondary`},Ut={start:`border-accent-success/60`,"ai-step":`border-accent-primary/60`,shell:`border-accent-warning/60`,decider:`border-accent-highlight/60`,condition:`border-accent-info/60`,end:`border-accent-secondary/60`};function Wt(e){return Bt[e]??Vt}function Gt({chips:e,iteration:t,onChipClick:n,variant:r}){let{t:i}=o(`jobs`);return e.length===0&&!t?null:(0,K.jsxs)(`div`,{"data-testid":`loop-overview-strip`,role:`list`,"aria-label":i(`loopExplorer.stepMapAria`),className:P(`flex items-center gap-1 overflow-x-auto border-b border-border/30 bg-surface/20`,r===`glass`?`px-3 py-1.5`:`px-4 py-2`),children:[e.map((e,t)=>{let r=Wt(e.kind),a=Ht[e.kind]??`text-foreground`,o=Ut[e.kind]??`border-border/40`,s=e.label??i(`loops:builder.nodes.${e.kind}`,{defaultValue:e.kind}),c=e.latestSegmentKey!=null;return(0,K.jsxs)(G.Fragment,{children:[t>0&&(0,K.jsx)(v,{className:`w-3 h-3 text-muted-foreground/30 shrink-0`}),(0,K.jsxs)(`button`,{type:`button`,role:`listitem`,"data-testid":`loop-node-chip`,"data-state":e.state,"data-kind":e.kind,"data-decision":e.decision,"aria-label":`${s} — ${e.state}`,disabled:!c,onClick:()=>e.latestSegmentKey&&n(e.latestSegmentKey),className:P(`relative flex items-center gap-1.5 shrink-0 rounded-full border bg-surface/40 px-2.5 py-1 text-[11px] transition-colors`,o,e.state===`pending`&&`opacity-45 border-border/40`,(e.state===`interrupted`||e.state===`paused`)&&`border-dashed border-accent-warning/50`,c?`cursor-pointer hover:bg-surface/70`:`cursor-default`),children:[e.state===`running`&&(0,K.jsx)(`span`,{"aria-hidden":!0,className:`absolute -inset-px rounded-full ring-2 ring-accent-primary/50 motion-safe:animate-pulse pointer-events-none`}),(0,K.jsx)(r,{className:P(`w-3 h-3 shrink-0`,a)}),(0,K.jsx)(`span`,{className:P(`max-w-[120px] truncate font-medium text-foreground/90`,e.state===`running`&&`title-shimmer`),children:s}),e.state===`paused`&&(0,K.jsx)(`span`,{className:`text-accent-warning`,children:i(`loopExplorer.paused`)}),e.state===`ok`&&(0,K.jsx)(_,{className:`w-3 h-3 text-accent-success shrink-0`}),e.state===`failed`&&(0,K.jsx)(D,{className:`w-3 h-3 text-destructive shrink-0`}),e.decision===`continue`&&(0,K.jsx)(p,{className:`w-3 h-3 text-accent-highlight shrink-0`}),e.decision===`stop`&&(0,K.jsx)(m,{className:`w-3 h-3 text-accent-success shrink-0`})]})]},e.key)}),t&&(0,K.jsxs)(`span`,{"data-testid":`loop-iteration-chip`,className:`ml-auto flex items-center gap-1.5 shrink-0 rounded-full border border-accent-highlight/40 bg-accent-highlight/10 px-2.5 py-1 text-[10px] font-medium text-accent-highlight tabular-nums`,children:[(0,K.jsx)(re,{className:`w-3 h-3`}),t.limit==null?i(`loopExplorer.iterationBadge`,{count:t.current}):i(`loopExplorer.iteration`,{current:t.current,limit:t.limit})]})]})}var Kt=(0,G.memo)(Gt);function qt({className:e}){return(0,K.jsxs)(`span`,{className:P(`relative flex h-2 w-2 shrink-0`,e),children:[(0,K.jsx)(`span`,{className:`motion-safe:animate-ping absolute inline-flex h-full w-full rounded-full bg-accent-primary opacity-60`}),(0,K.jsx)(`span`,{className:`relative inline-flex rounded-full h-2 w-2 bg-accent-primary`})]})}function Jt(e,t){if(!t)return e;let n=t.toLowerCase();return e.filter(e=>e.content.toLowerCase().includes(n))}function Yt(e,t,n,r){return e.length===0?(0,K.jsx)(`p`,{className:`px-4 py-2 text-[10px] text-muted-foreground/40 italic`,children:n(t?`logViewer.noMatchingLines`:`logViewer.noOutput`)}):e.map((e,t)=>(0,K.jsx)(bt,{line:e,even:t%2==0,onOpenTicket:r},e.id))}function Xt({label:e,value:t,copyLabel:n}){let[r,i]=(0,G.useState)(!1),a=async()=>{try{await navigator.clipboard.writeText(t),i(!0),window.setTimeout(()=>i(!1),1500)}catch{}};return(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,K.jsx)(`span`,{className:`text-[9px] font-semibold uppercase tracking-wider text-muted-foreground/50`,children:e}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>void a(),"aria-label":`${n} — ${e}`,title:n,className:`p-0.5 text-muted-foreground/40 hover:text-foreground transition-colors cursor-pointer`,children:r?(0,K.jsx)(_,{className:`w-2.5 h-2.5 text-accent-success`}):(0,K.jsx)(V,{className:`w-2.5 h-2.5`})})]}),(0,K.jsx)(`pre`,{className:`mt-0.5 text-[10px] font-mono leading-relaxed text-foreground/75 whitespace-pre-wrap break-words`,children:t})]})}function Zt({segment:e,status:t,collapsed:n,filter:r,onToggle:i,onCopy:a,setRef:s,onOpenTicket:c}){let{t:l}=o(`jobs`),{meta:u,lines:d,end:f,lastActivity:p}=e,m=Wt(u.kind),h=Ht[u.kind]??`text-foreground`,g=Jt(d,r),y=t===`running`,b=!!(u.template||u.command),[x,S]=(0,G.useState)(!1);return(0,K.jsxs)(`div`,{ref:t=>s(e.key,t),"data-testid":`loop-step-section`,"data-status":t,"data-step-index":u.index,className:P(`mt-3 rounded-md overflow-hidden border animate-in fade-in duration-200`,t===`running`&&`border-accent-primary/40`,t===`failed`&&`border-destructive/30`,t===`stalled`&&`border-dashed border-destructive/40`,(t===`interrupted`||t===`paused`)&&`border-dashed border-accent-warning/40`,(t===`ok`||t===`unknown`)&&`border-border/20`),children:[(0,K.jsxs)(`div`,{className:P(`flex items-stretch bg-primary/5 border-b`,t===`failed`||t===`stalled`?`border-destructive/20`:`border-primary/20`),children:[(0,K.jsxs)(`button`,{type:`button`,onClick:()=>i(e.key),className:`flex items-center gap-2 flex-1 min-w-0 text-left px-3 py-2 hover:bg-primary/10 transition-colors duration-150 cursor-pointer`,children:[(0,K.jsx)(v,{className:P(`w-3 h-3 text-primary/60 shrink-0 transition-transform duration-150`,!n&&`rotate-90`)}),(0,K.jsx)(`span`,{className:`text-[10px] font-mono tabular-nums text-muted-foreground/60 shrink-0 w-5 text-right`,children:u.index}),(0,K.jsx)(m,{className:P(`w-3.5 h-3.5 shrink-0`,h)}),(0,K.jsx)(`span`,{className:`text-[12px] font-semibold text-foreground leading-none truncate`,children:kt(u)}),u.branch&&(0,K.jsx)(`span`,{className:`max-w-40 truncate font-mono text-[10px] text-muted-foreground`,title:u.scopeId,children:u.branch}),t===`paused`&&(0,K.jsx)(`span`,{className:`text-[10px] text-accent-warning`,children:l(`loopExplorer.paused`,{defaultValue:`Paused`})}),u.iteration!=null&&u.iteration>=1&&(0,K.jsx)(`span`,{className:`shrink-0 rounded-full bg-muted/60 px-1.5 py-0.5 text-[9px] font-medium text-muted-foreground tabular-nums`,children:l(`loopExplorer.iterationBadge`,{count:u.iteration})}),y&&(0,K.jsxs)(`span`,{className:`flex items-center gap-1.5 min-w-0 shrink-0 max-w-[40%]`,children:[(0,K.jsx)(qt,{}),p&&(0,K.jsx)(`span`,{className:`title-shimmer text-[10px] truncate`,children:l(`statusPanel.activity.${p.actionKey}`,{arg:p.actionArg??``})})]}),t===`ok`&&(0,K.jsx)(_,{className:`w-3.5 h-3.5 text-accent-success shrink-0`}),t===`failed`&&f?.reason===`provider_limit`&&(0,K.jsx)(`span`,{className:`shrink-0 rounded border border-dashed border-destructive/50 px-1.5 py-0.5 text-[9px] font-medium uppercase tracking-wide text-destructive`,title:l(`loopExplorer.providerLimitHint`),"data-testid":`loop-step-provider-limit`,children:l(`loopExplorer.providerLimit`)}),t===`failed`&&(0,K.jsx)(D,{className:`w-3.5 h-3.5 text-destructive shrink-0`}),t===`stalled`&&(0,K.jsx)(`span`,{className:`shrink-0 rounded border border-dashed border-destructive/50 px-1.5 py-0.5 text-[9px] font-medium uppercase tracking-wide text-destructive`,title:f?.idleMs==null?void 0:l(`loopExplorer.stalledIdle`,{count:Math.max(1,Math.round(f.idleMs/6e4))}),children:l(`loopExplorer.stalled`)}),t===`interrupted`&&(0,K.jsx)(`span`,{className:`shrink-0 rounded border border-dashed border-accent-warning/50 px-1.5 py-0.5 text-[9px] font-medium uppercase tracking-wide text-accent-warning`,children:l(`loopExplorer.interrupted`)}),(0,K.jsx)(`span`,{className:`flex-1`}),f?.durationMs!=null&&(0,K.jsx)(`span`,{className:`text-[10px] text-muted-foreground/50 font-mono tabular-nums shrink-0`,children:Lt(f.durationMs)}),t===`failed`&&f?.exitCode!=null&&f.exitCode!==0&&(0,K.jsx)(`span`,{className:`text-[10px] text-destructive/70 font-mono shrink-0`,children:l(`activeJob.exitCode`,{code:f.exitCode})}),(0,K.jsx)(`span`,{className:`text-[10px] text-muted-foreground/40 shrink-0`,children:l(`logViewer.phaseLines`,{count:d.length})})]}),b&&(0,K.jsx)(`button`,{type:`button`,onClick:()=>S(e=>!e),"aria-label":l(`loopExplorer.stepDetail`),"aria-expanded":x,title:l(`loopExplorer.stepDetail`),className:P(`px-2 flex items-center transition-colors cursor-pointer`,x?`text-foreground bg-primary/10`:`text-muted-foreground/40 hover:text-foreground hover:bg-primary/10`),children:(0,K.jsx)(ae,{className:`w-3 h-3`})}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>a(e.key),"aria-label":l(`loopExplorer.copyStep`),title:l(`loopExplorer.copyStep`),className:`px-2.5 flex items-center text-muted-foreground/40 hover:text-foreground hover:bg-primary/10 transition-colors cursor-pointer`,children:(0,K.jsx)(V,{className:`w-3 h-3`})})]}),x&&b&&(0,K.jsxs)(`div`,{"data-testid":`loop-step-detail`,className:P(`px-4 py-2.5 space-y-2.5 bg-muted/10 border-b animate-in fade-in duration-150`,t===`failed`?`border-destructive/20`:`border-primary/10`),children:[u.template&&(0,K.jsx)(Xt,{label:l(`loopExplorer.stepDetailTemplate`),value:u.template,copyLabel:l(`loopExplorer.copyCommand`)}),u.command&&(0,K.jsx)(Xt,{label:l(`loopExplorer.stepDetailCommand`),value:u.command,copyLabel:l(`loopExplorer.copyCommand`)})]}),!n&&(0,K.jsx)(`div`,{className:`bg-muted/5`,children:Yt(g,r,l,c)})]})}var Qt=(0,G.memo)(Zt,(e,t)=>e.segment.key===t.segment.key&&e.segment.lines.length===t.segment.lines.length&&e.segment.lines[e.segment.lines.length-1]?.content===t.segment.lines[t.segment.lines.length-1]?.content&&e.segment.meta.template===t.segment.meta.template&&e.segment.meta.command===t.segment.meta.command&&e.segment.end?.status===t.segment.end?.status&&e.segment.end?.durationMs===t.segment.end?.durationMs&&e.segment.end?.decision===t.segment.end?.decision&&e.segment.end?.exitCode===t.segment.end?.exitCode&&e.segment.lastActivity?.actionKey===t.segment.lastActivity?.actionKey&&e.segment.lastActivity?.actionArg===t.segment.lastActivity?.actionArg&&e.status===t.status&&e.collapsed===t.collapsed&&e.filter===t.filter&&e.onOpenTicket===t.onOpenTicket),$t=`__setup__`;function en({lines:e,collapsed:t,filter:n,onToggle:r,setRef:i,onOpenTicket:a}){let{t:s}=o(`jobs`),c=Jt(e,n);return(0,K.jsxs)(`div`,{ref:e=>i($t,e),"data-testid":`loop-setup-section`,className:`rounded-md overflow-hidden border border-border/20`,children:[(0,K.jsxs)(`button`,{type:`button`,onClick:()=>r($t),className:`flex items-center gap-2 w-full text-left px-3 py-2 bg-muted/10 border-b border-border/20 hover:bg-muted/20 transition-colors duration-150 cursor-pointer`,children:[(0,K.jsx)(v,{className:P(`w-3 h-3 text-muted-foreground/60 shrink-0 transition-transform duration-150`,!t&&`rotate-90`)}),(0,K.jsx)(S,{className:`w-3.5 h-3.5 text-accent-success/70 shrink-0`}),(0,K.jsx)(`span`,{className:`text-[11px] font-semibold text-muted-foreground leading-none uppercase tracking-wide`,children:s(`loopExplorer.setup`)}),(0,K.jsx)(`span`,{className:`flex-1`}),(0,K.jsx)(`span`,{className:`text-[10px] text-muted-foreground/40 shrink-0`,children:s(`logViewer.phaseLines`,{count:e.length})})]}),!t&&(0,K.jsx)(`div`,{className:`bg-muted/5`,children:Yt(c,n,s,a)})]})}var tn=(0,G.memo)(en,(e,t)=>e.lines.length===t.lines.length&&e.lines[e.lines.length-1]?.content===t.lines[t.lines.length-1]?.content&&e.collapsed===t.collapsed&&e.filter===t.filter&&e.onOpenTicket===t.onOpenTicket);function nn(e,t){let{t:n}=o(`jobs`),[r,i]=(0,G.useState)(!1),[a,s]=(0,G.useState)(``),[l,u]=(0,G.useState)(null),d=`${t??`active`}:${e??``}`,f=(0,G.useRef)(d),p=(0,G.useRef)(!1);f.current=d,(0,G.useEffect)(()=>(f.current=d,i(!1),s(``),u(null),p.current=!1,()=>{f.current=``}),[d]);async function m(r){if(!e||p.current||!r.meta.nodePath||!r.meta.scopeId||!r.meta.iteration)return;let a=d;p.current=!0,i(!0),s(``);try{let i=`${t?R(t):c()}/loop-runs/${encodeURIComponent(e)}`,o=await fetch(`${i}/recovery`,{cache:`no-store`});if(!o.ok)throw Error(n(`loopExplorer.forkFailed`));let s=await o.json();if(f.current!==a)return;if(s.forkAdopted&&s.forkRunId){u(s.forkRunId);return}let l={fromNodePath:r.meta.nodePath,scopeId:r.meta.scopeId,visit:r.meta.iteration};if(s.forkRequest&&(s.forkRequest.fromNodePath!==l.fromNodePath||s.forkRequest.scopeId!==l.scopeId||s.forkRequest.visit!==l.visit))throw Error(n(`loopExplorer.forkPending`));let d=s.forkRequest??{...l,requestId:crypto.randomUUID()},p=await fetch(`${i}/fork`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(d)}),m=await p.json();if(!p.ok||!m.loopRunId)throw Error(m.detail??n(`loopExplorer.forkFailed`));f.current===a&&u(m.loopRunId)}catch(e){f.current===a&&s(e instanceof Error?e.message:n(`loopExplorer.forkFailed`))}finally{f.current===a&&(p.current=!1,i(!1))}}return{busy:r,error:a,created:l,fork:m}}function rn(){return(0,K.jsxs)(`span`,{className:`relative flex h-1.5 w-1.5 shrink-0`,children:[(0,K.jsx)(`span`,{className:`motion-safe:animate-ping absolute inline-flex h-full w-full rounded-full bg-accent-primary opacity-60`}),(0,K.jsx)(`span`,{className:`relative inline-flex rounded-full h-1.5 w-1.5 bg-accent-primary`})]})}function an({events:e,jobStatus:t,isLoading:n,variant:r=`page`,projectId:i,onOpenRun:a}){let{t:s,i18n:c}=o(`jobs`),[d,f]=(0,G.useState)(``),[p,m]=(0,G.useState)(`follow`),[h,g]=(0,G.useState)(new Set),_=(0,G.useRef)(null),v=(0,G.useRef)(new Map),y=ut(i),{activeProjectId:b}=l(),x=nn(e[0]?.job_id,i??b??void 0),S=(0,G.useMemo)(()=>jt(e),[e,c.language]),C=t!=null&&t!==`running`&&t!==`queued`,w=t===`running`,E=(0,G.useMemo)(()=>S.segments.map((e,t)=>Mt(e,{isLast:t===S.segments.length-1,jobSettled:C})),[S,C]),D=(0,G.useMemo)(()=>{let e=S.segments.map(e=>e.key);return S.setup.length>0&&e.push($t),e},[S]),O=S.segments.length>0?S.segments[S.segments.length-1].key:$t,k=(0,G.useMemo)(()=>d?new Set(D):p===`follow`?new Set([O]):h,[d,p,O,h,D]),A=(0,G.useRef)(k);A.current=k;let j=(0,G.useRef)(S);j.current=S;let M=(0,G.useCallback)(e=>{let t=new Set(A.current);e?.(t),g(t),m(`manual`)},[]),N=(0,G.useCallback)(e=>{M(t=>{t.has(e)?t.delete(e):t.add(e)})},[M]),F=(0,G.useCallback)(e=>{M(t=>t.add(e)),requestAnimationFrame(()=>{v.current.get(e)?.scrollIntoView?.({behavior:`smooth`,block:`start`})})},[M]),I=(0,G.useCallback)(()=>{let e=_.current;e&&(e.scrollTop=e.scrollHeight)},[]),R=(0,G.useCallback)(()=>{m(`follow`),requestAnimationFrame(I)},[I]),ee=(0,G.useCallback)(()=>{g(new Set(D)),m(`manual`)},[D]),z=(0,G.useCallback)(()=>{g(new Set),m(`manual`)},[]);(0,G.useEffect)(()=>{p===`follow`&&!d&&I()},[S.totalLines,S.segments.length,p,d,I]);let te=(0,G.useCallback)(()=>{let e=_.current;!e||p!==`follow`||e.scrollHeight-e.scrollTop-e.clientHeight>80&&M()},[p,M]),ne=(0,G.useCallback)((e,t)=>{t?v.current.set(e,t):v.current.delete(e)},[]),re=(0,G.useCallback)(e=>{let t=j.current.segments.find(t=>t.key===e),n=e===`__setup__`?j.current.setup.map(e=>e.content).join(`
|
|
17
|
-
`):(t?.lines??[]).map(e=>e.content).join(`
|
|
18
|
-
`);navigator.clipboard.writeText(n).then(()=>u.success(s(`loopExplorer.copied`))).catch(()=>u.error(s(`logViewer.copyFailed`)))},[s]),ie=(0,G.useCallback)(()=>{let e=j.current,t=e.setup.map(e=>e.content);for(let n of e.segments){t.push(`── Step ${n.meta.index} · ${Ot(n.meta.title)} ──`);for(let e of n.lines)t.push(e.content)}navigator.clipboard.writeText(t.join(`
|
|
19
|
-
`)).then(()=>u.success(s(`logViewer.copySuccess`))).catch(()=>u.error(s(`logViewer.copyFailed`)))},[s]),B=(0,G.useMemo)(()=>It(S,{jobSettled:C,jobFailed:t===`failed`}),[S,C,t]),H=S.graphMeta?.iterationLimit??S.graphMeta?.graph.config.maxIterations??null,ae=S.maxIteration>0?{current:S.maxIteration,limit:H}:null,U=(0,G.useMemo)(()=>{if(!d)return S.totalLines;let e=d.toLowerCase(),t=S.setup.filter(t=>t.content.toLowerCase().includes(e)).length;for(let n of S.segments)t+=n.lines.filter(t=>t.content.toLowerCase().includes(e)).length;return t},[d,S]),oe=S.segments[S.segments.length-1],W=w&&(S.segments.length===0||oe?.end!=null);return n?(0,K.jsx)(`div`,{className:`flex-1 flex items-center justify-center h-full`,children:(0,K.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:s(`logViewer.loading`)})}):S.totalLines===0&&S.segments.length===0?(0,K.jsx)(`div`,{"data-testid":`loop-step-explorer`,className:`flex-1 flex items-center justify-center h-full`,children:(0,K.jsxs)(`p`,{className:`text-xs text-muted-foreground flex items-center gap-2`,children:[w&&(0,K.jsx)(rn,{}),s(w?`loopExplorer.waiting`:`logViewer.empty`)]})}):(0,K.jsxs)(`div`,{"data-testid":`loop-step-explorer`,className:`relative flex min-h-0 flex-col h-full`,children:[(0,K.jsxs)(`div`,{className:P(`border-b border-border flex items-center gap-2`,r===`glass`?`px-3 py-1.5`:`px-4 py-2`),children:[(0,K.jsxs)(`div`,{className:`relative flex-1 max-w-xs`,children:[(0,K.jsx)(T,{className:`absolute left-2.5 top-1/2 -translate-y-1/2 w-3 h-3 text-muted-foreground`}),(0,K.jsx)(se,{placeholder:s(`logViewer.filterPlaceholder`),value:d,onChange:e=>f(e.target.value),className:`pl-7 h-7`})]}),(0,K.jsx)(L,{variant:`ghost`,size:`sm`,className:`h-7 px-2 text-muted-foreground/50 hover:text-foreground`,onClick:ee,"aria-label":s(`loopExplorer.expandAll`),title:s(`loopExplorer.expandAll`),children:(0,K.jsx)(Ae,{className:`w-3.5 h-3.5`})}),(0,K.jsx)(L,{variant:`ghost`,size:`sm`,className:`h-7 px-2 text-muted-foreground/50 hover:text-foreground`,onClick:z,"aria-label":s(`loopExplorer.collapseAll`),title:s(`loopExplorer.collapseAll`),children:(0,K.jsx)(ke,{className:`w-3.5 h-3.5`})}),p===`follow`&&w&&(0,K.jsxs)(`span`,{className:`flex items-center gap-1.5 text-[10px] text-accent-primary shrink-0`,children:[(0,K.jsx)(rn,{}),s(`loopExplorer.follow`)]}),(0,K.jsx)(`span`,{className:`flex-1`}),(0,K.jsx)(L,{variant:`ghost`,size:`sm`,className:`h-7 px-2 text-muted-foreground/50 hover:text-foreground`,onClick:ie,"aria-label":s(`logViewer.copySuccess`),children:(0,K.jsx)(V,{className:`w-3.5 h-3.5`})}),(0,K.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:s(`logViewer.lineCount`,{filtered:U,total:S.totalLines})})]}),S.completion&&(0,K.jsx)(`div`,{"data-testid":`loop-completion-scroll`,className:r===`glass`?`max-h-[45%] min-h-0 shrink-0 overflow-y-auto overscroll-contain`:void 0,tabIndex:r===`glass`?0:void 0,children:(0,K.jsx)(zt,{result:S.completion})}),S.graphMeta?.runtimeTopology&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(Rt,{topology:S.graphMeta.runtimeTopology,segments:S.segments,settled:C,onFocus:F,onFork:x.fork,forkBusy:x.busy}),x.error&&(0,K.jsx)(`p`,{role:`alert`,className:`px-2 text-xs text-destructive`,children:x.error}),x.created&&(0,K.jsxs)(`div`,{className:`p-2 text-xs`,children:[(0,K.jsx)(`p`,{children:s(`loopExplorer.forkCreated`)}),(0,K.jsx)(L,{size:`sm`,variant:`outline`,onClick:()=>a?.(x.created),disabled:!a,children:s(`loopExplorer.openFork`)}),(0,K.jsx)(`code`,{className:`ml-2`,children:x.created})]})]}),(0,K.jsx)(Kt,{chips:B,iteration:ae,onChipClick:F,variant:r}),(0,K.jsxs)(`div`,{ref:_,onScroll:te,className:`min-h-0 flex-1 overflow-y-auto p-2 text-xs`,children:[S.setup.length>0&&(0,K.jsx)(tn,{lines:S.setup,collapsed:!k.has(`__setup__`),filter:d,onToggle:N,setRef:ne,onOpenTicket:y}),S.segments.map((e,t)=>(0,K.jsx)(Qt,{segment:e,status:E[t],collapsed:!k.has(e.key),filter:d,onToggle:N,onCopy:re,setRef:ne,onOpenTicket:y},e.key)),W&&(0,K.jsxs)(`div`,{"data-testid":`loop-waiting-row`,className:`mt-3 flex items-center gap-2 px-3 py-2 text-[11px] text-muted-foreground/70 italic`,children:[(0,K.jsx)(rn,{}),s(`loopExplorer.waiting`)]})]}),p===`manual`&&w&&!d&&(0,K.jsxs)(`button`,{type:`button`,"data-testid":`resume-follow-pill`,onClick:R,className:`absolute bottom-4 left-1/2 -translate-x-1/2 z-10 flex items-center gap-1.5 rounded-full glass-card border border-accent-primary/30 px-3 py-1.5 text-[11px] font-medium text-foreground shadow-lg hover:border-accent-primary/60 transition-colors cursor-pointer animate-in fade-in slide-in-from-bottom-2 duration-200`,children:[(0,K.jsx)(rn,{}),s(`loopExplorer.resumeFollow`)]})]})}var on=new Set(`grep.rg.ag.ack.find.fd.ls.cat.head.tail.sed.awk.cut.sort.uniq.wc.jq.yq.tr.xargs.tee.column.less.more.cd.pwd.echo.printf.which.type.test.true.false.env.export.set.source.date.basename.dirname.realpath.readlink.stat.file.tree.diff.sleep.seq.hostname.whoami.uname.mkdir.rmdir.cp.mv.rm.touch.ln.chmod.chown.install.[[.[.]].].for.while.until.if.then.else.elif.fi.do.done.case.esac.exec.eval.trap.read.shift.wait`.split(`.`)),sn=new Set([`status`,`diff`,`log`,`show`,`branch`,`rev-parse`,`ls-files`,`blame`,`describe`]),cn=new Set([...sn,`commit`,`add`,`stage`,`push`,`pull`,`fetch`,`checkout`,`switch`,`merge`,`rebase`,`reset`,`stash`,`tag`,`clone`,`worktree`,`cherry-pick`,`restore`,`apply`,`init`,`remote`,`config`,`update-ref`,`for-each-ref`]),ln=new Set([`run`,`run-script`,`test`,`install`,`ci`,`i`,`add`,`exec`,`start`,`dlx`]),un=[[/^(test|tests|test:.*|vitest|jest|spec)$/,`activity.testing`],[/^(build|compile|bundle|dist)$/,`activity.building`],[/^(typecheck|tsc|types?)$/,`activity.typechecking`],[/^(lint|lint:.*|eslint|format|fmt|prettier)$/,`activity.linting`]],dn=new Set([`vitest`,`jest`,`pytest`,`mocha`,`ava`,`rspec`,`phpunit`]);function fn(e){for(let[t,n]of un)if(t.test(e))return n;return null}function pn(e){return e.split(/\s+/).map(e=>e.replace(/^['"`]+/,``).replace(/['"`]+$/,``)).filter(e=>e.length>0&&!e.startsWith(`-`))}function mn(e){let t=pn(e);if(t.length===0)return{kind:`plumbing`};let n=t[0].split(`/`).pop()??t[0],r=t.slice(1);if(on.has(n))return{kind:`plumbing`};if(dn.has(n))return{kind:`intent`,code:`activity.testing`};if((n===`npx`||n===`pnpm`||n===`yarn`||n===`bunx`)&&r.length>0){let e=r[0]===`dlx`||r[0]===`exec`?r[1]??``:r[0];if(dn.has(e))return{kind:`intent`,code:`activity.testing`};let t=fn(e===`run`?r[r.indexOf(`run`)+1]??``:e);if(t)return{kind:`intent`,code:t};if(e===`tsc`)return{kind:`intent`,code:`activity.typechecking`}}if(n===`npm`||n===`yarn`||n===`pnpm`||n===`bun`){let e=r.findIndex(e=>ln.has(e)),t=e===-1?``:r[e];if(t===`install`||t===`ci`||t===`i`||t===`add`)return{kind:`intent`,code:`activity.installing`};let i=fn(t===`run`||t===`run-script`?r[e+1]??``:t);return i?{kind:`intent`,code:i}:{kind:`named`,tool:n}}if(n===`git`){let e=r.find(e=>cn.has(e))??``;return sn.has(e)?{kind:`plumbing`}:e===`commit`||e===`add`||e===`stage`?{kind:`intent`,code:`activity.savingWork`}:{kind:`named`,tool:n}}if(n===`cargo`||n===`go`||n===`dotnet`||n===`mvn`||n===`mvnw`||n===`gradle`||n===`gradlew`){let e=r.find(e=>e===`test`||e===`build`||e===`compile`)??``;return e===`test`?{kind:`intent`,code:`activity.testing`}:e===`build`||e===`compile`?{kind:`intent`,code:`activity.building`}:{kind:`named`,tool:n}}return n===`tsc`?{kind:`intent`,code:`activity.typechecking`}:n===`openspec`?{kind:`intent`,code:`activity.checkingSpec`}:{kind:`named`,tool:n}}function hn(e){try{let t=JSON.parse(e);return t&&typeof t==`object`&&!Array.isArray(t)?t:{}}catch{return{}}}function gn(e,t){return e&&/^main-\d+$/.test(e)?`step.role.work`:e===`verify`?`step.role.verify`:e===`decide`||t===`decider`?`step.role.decide`:e===`fix`?`step.role.fix`:null}function _n(e){return e.replace(/^[^\p{L}\p{N}(]+/u,``).trim()}var Z=e=>typeof e==`number`&&Number.isFinite(e)?e:null,Q=e=>typeof e==`string`&&e.length>0?e:null,vn=new Set([`thinking`,`reasoning`]),yn=/^(MEMORY\.md|confidence-score\.json|design-confidence\.json|\d{4}-\d{2}-\d{2}-.+|feedback_.+)$/,bn=/^(proposal|design|tasks|spec|context-bundle)\.md$/,xn=new Set([`reading`,`writing`,`editing`]);function $(e,t,n,r,i,a=``){for(let t=e.length-1;t>=0;t--){let o=e[t];if(o.values.phaseBoundary===1)break;if(o.kind!==`activity`){if(o.stepIndex!==n)break;continue}if(o.stepIndex!==n)break;if((o.values.repository??``)===a&&o.values.action===r&&o.values.target===i){o.values.repeats=Number(o.values.repeats??1)+1;return}}e.push({seq:t,kind:`activity`,code:r===`intent`?i:i?`activity.${r}`:`activity.${r}Bare`,values:{action:r,target:i,repeats:1,repository:a},stepIndex:n,tone:`neutral`})}var Sn=new Set([`architect`,`developer`,`fixer`,`verify`,`reviewer`,`archive`]),Cn=3;function wn(e,t,n,r,i,a=``){for(let t=e.length-1;t>=0;t--){let o=e[t];if(o.values.phaseBoundary===1||o.stepIndex!==n)break;if(o.kind!==`activity`||(o.values.repository??``)!==a||o.values.action!==r||o.values.fileGroup!==1)continue;let s=String(o.values.allNames??``).split(`\0`).filter(Boolean),c=!!i&&!s.includes(i);c&&s.push(i),o.values.allNames=s.join(`\0`),o.values.files=s.length;let l=String(o.values.names??``).split(`, `).filter(Boolean);c&&l.length<Cn&&(l.push(i),o.values.names=l.join(`, `)),o.code=s.length>1?`activity.${r}Files`:i?`activity.${r}`:`activity.${r}Bare`,o.values.repeats=s.length>1?1:Number(o.values.repeats??1)+1;return}e.push({seq:t,kind:`activity`,code:i?`activity.${r}`:`activity.${r}Bare`,values:{action:r,target:i,names:i,allNames:i,repository:a,files:+!!i,fileGroup:1,repeats:1},stepIndex:n,tone:`neutral`})}function Tn({events:e,settled:t}){let n=[],r=new Map,i=new Set,a=null,o=!1,s=!1,c=e.some(e=>e.event_type===`workflow-event`);for(let t of e){if(t.event_type===`loop_graph`){o=!0;continue}if(t.event_type===`loop_step`){let e=hn(t.payload),i=Z(e.index);if(i===null)continue;o=!0;let s=Q(e.kind)??`ai-step`,l={index:i,title:_n(Q(e.title)??``),roleCode:c?null:gn(Q(e.nodeId),s),kind:s,iteration:Z(e.iteration),ended:!1};r.set(i,l),a=i;let u=Z(e.attempt);n.push({seq:t.seq,kind:`step-start`,code:u!==null&&u>1?`step.startResume`:l.iteration&&l.iteration>1?`step.startRetry`:`step.start`,values:{step:i,title:l.title,iteration:l.iteration??1,...u!==null&&u>1?{attempt:u}:{},...l.roleCode?{roleCode:l.roleCode}:{}},stepIndex:i,tone:`neutral`});continue}if(t.event_type===`loop_step_end`){let e=hn(t.payload),i=Z(e.index);if(i===null)continue;let a=i===null?void 0:r.get(i);a&&(a.ended=!0);let o=Q(e.status),s=Z(e.durationMs),c=Z(e.exitCode),l=Z(e.idleMs),u=o===`stalled`,d=o===`failed`||u,f=o===`failed`&&Q(e.reason)===`provider_limit`;n.push({seq:t.seq,kind:`step-end`,code:e.recovered===!0&&o===`ok`?`step.recovered`:u?`step.stalled`:f?`step.providerLimit`:d?`step.failed`:s===null?`step.done`:s>=9e4?`step.doneTimedMin`:`step.doneTimed`,values:{step:i,title:a?.title??``,seconds:s===null?0:Math.max(1,Math.round(s/1e3)),minutes:s===null?0:Math.max(1,Math.round(s/6e4)),...u?{idleMinutes:l===null?0:Math.max(1,Math.round(l/6e4))}:{},...a?.roleCode?{roleCode:a.roleCode}:{},...c===null?{}:{exitCode:c}},stepIndex:i,tone:d?`bad`:`good`});let p=Q(e.decision);(p===`continue`||p===`stop`)&&n.push({seq:t.seq,kind:`decision`,code:p===`continue`?`decision.another`:`decision.satisfied`,values:{step:i},stepIndex:i,tone:p===`continue`?`neutral`:`good`});continue}if(t.event_type===`runtime-efficiency-event`){let e=hn(t.payload),r=e.payload&&typeof e.payload==`object`&&!Array.isArray(e.payload)?e.payload:{},o=Q(e.eventId),s=Q(e.kind);if(e.schemaVersion!==1||!o||i.has(o))continue;i.add(o);let c=Q(r.label),l=Q(r.repositoryId);if(!c||!l||c.length>256||l.length>256)continue;let u=s===`check-started`?`started`:s===`check-reused`?`reused`:s===`check-invalidated`?`invalidated`:s===`check-finished`&&typeof r.exitCode==`number`?r.exitCode===0?`passed`:`failed`:null;u&&n.push({seq:t.seq,kind:`activity`,code:`activity.check.${u}`,values:{target:c,repository:l},stepIndex:a,tone:u===`failed`?`bad`:`neutral`});continue}if(t.event_type===`workflow-event`){let e=hn(t.payload),r=e.event&&typeof e.event==`object`&&!Array.isArray(e.event)?e.event:{},i=Q(r.type),o=Q(r.stepId);if(i===`workflow_resumed`)s=!1,n.push({seq:t.seq,kind:`activity`,code:`activity.phase.resumed`,values:{phaseBoundary:1},stepIndex:a,tone:`neutral`});else if(i===`step_started`&&o&&Sn.has(o)){let e=o===`developer`&&s;o===`developer`&&(s=!0),n.push({seq:t.seq,kind:`activity`,code:e?`activity.phase.corrections`:`activity.phase.${o}`,values:{phaseBoundary:1},stepIndex:a,tone:`neutral`})}else i===`step_succeeded`&&o===`verify`&&typeof r.message!=`string`||i===`step_blocked`||(i===`workflow_failed`||i===`workflow_blocked`||i===`workflow_cancelled`)&&n.push({seq:t.seq,kind:`activity`,code:`activity.phase.stopped`,values:{action:`intent`,target:Q(r.message)??i,repeats:1},stepIndex:a,tone:`bad`});continue}let e=t.event_type===`agent-event`?hn(t.payload):{},l=Array.isArray(e.repositories)?e.repositories.map(e=>typeof e?.name==`string`?e.name:``).filter(Boolean).join(` + `):``,u=ye(t);if(!(!u.step||!u.actionKey)&&!vn.has(u.actionKey)&&!(c&&u.actionKey===`working`)){if(c&&u.actionKey===`searching`){$(n,t.seq,a,`searching`,``,l);continue}if(u.actionKey===`running`){let e=le(t),r=e?mn(e):{kind:`named`,tool:u.actionArg??``};if(r.kind===`plumbing`){$(n,t.seq,a,`exploring`,``,l);continue}if(r.kind===`intent`){$(n,t.seq,a,`intent`,r.code,l);continue}$(n,t.seq,a,`running`,c?``:r.tool,l);continue}if(xn.has(u.actionKey)){let e=u.actionArg??``;if(yn.test(e)){$(n,t.seq,a,`intent`,`activity.bookkeeping`,l);continue}if(bn.test(e)){$(n,t.seq,a,`intent`,`activity.writingSpec`,l);continue}wn(n,t.seq,a,u.actionKey,e,l);continue}$(n,t.seq,a,u.actionKey,u.actionArg??``,l)}}if(t)for(let e of r.values())e.ended||n.push({seq:2**53-1-(1e3-e.index),kind:`step-interrupted`,code:`step.interrupted`,values:{step:e.index,title:e.title},stepIndex:e.index,tone:`bad`});return{milestones:n,stepCount:r.size,plainJob:!o}}var En={"step-start":je,"step-end":_,"step-interrupted":E,decision:w,activity:je},Dn={neutral:`text-muted-foreground`,good:`text-accent-success`,bad:`text-accent-warning`};function On({events:e,settled:t,durationRange:n,elapsedMs:r,variant:i=`page`}){let{t:a}=o(`narration`),s=(0,G.useMemo)(()=>Tn({events:e,settled:t}),[e,t]),c=(0,G.useMemo)(()=>e.some(e=>e.event_type===`workflow-event`),[e]),l=(0,G.useMemo)(()=>[...s.milestones].sort((e,t)=>e.seq-t.seq),[s.milestones]);return(0,K.jsxs)(`div`,{className:i===`glass`?`flex h-full flex-col overflow-hidden`:`flex flex-col`,children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 border-b border-border/50 px-3 py-2 text-[11px] text-muted-foreground`,children:[typeof r==`number`&&r>0?(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,K.jsx)(Ne,{className:`size-3`,"aria-hidden":!0}),a(`waiting.elapsed`,{minutes:Math.max(1,Math.round(r/6e4))})]}):null,n?(0,K.jsx)(`span`,{"data-testid":`narration-range`,children:a(`waiting.range`,{low:Math.max(1,Math.round(n.p25Ms/6e4)),high:Math.max(1,Math.round(n.p75Ms/6e4)),count:n.sampleCount})}):null,(0,K.jsx)(`span`,{className:`ml-auto italic opacity-70`,children:a(`aiNote`)})]}),(0,K.jsx)(`ol`,{className:`flex-1 space-y-1 px-3 py-2 ${i===`glass`?`overflow-y-auto`:``}`,"data-testid":`narration-list`,children:l.length===0?(0,K.jsx)(`li`,{className:`py-6 text-center text-xs text-muted-foreground`,children:a(t?`emptySettled`:`emptyLive`)}):l.map((e,t)=>{let n=En[e.kind],r=e.kind===`step-start`||e.kind===`step-end`||e.kind===`step-interrupted`,i=Number(e.values.files??0)>1||c?1:Number(e.values.repeats??1);return(0,K.jsxs)(`li`,{className:`flex items-start gap-2 text-sm ${r||e.values.phaseBoundary===1?`font-medium text-foreground`:`text-muted-foreground`} ${e.kind===`step-start`&&t>0?`pt-2`:``}`,children:[(0,K.jsx)(n,{className:`mt-0.5 size-3.5 shrink-0 ${Dn[e.tone]}`,"aria-hidden":!0}),(0,K.jsxs)(`span`,{className:`min-w-0 break-words`,children:[typeof e.values.repository==`string`&&e.values.repository&&(0,K.jsx)(`span`,{className:`mr-2 inline-block rounded border border-border px-1.5 py-0.5 text-xs font-medium text-foreground`,children:e.values.repository}),e.kind===`step-start`&&typeof e.values.roleCode==`string`?a(e.code,{...e.values,title:a(e.values.roleCode),defaultValue:e.code}):a(e.code,{...e.values,defaultValue:e.code}),i>1?(0,K.jsx)(`span`,{className:`ml-1.5 text-[11px] opacity-70`,children:a(`repeats`,{count:i})}):null]})]},`${e.seq}-${e.code}-${t}`)})})]})}var kn=`specrails-desktop:job-log-mode`;function An(){try{let e=localStorage.getItem(kn);return e===`log`||e===`narrated`?e:`narrated`}catch{return`narrated`}}function jn(e){try{localStorage.setItem(kn,e)}catch{}}var Mn=8e3,Nn=new Set([`loop_graph`,`runtime-graph`,`loop_step`,`loop_step_end`,`loop_completion`,`workflow-event`,`runtime-result`,`runtime-efficiency-event`,`result`]);function Pn(e){return e.event_type!==`verification-output`}function Fn(e,t=!1){let n=[],r=Mn;for(let i=e.length-1;i>=0;i--){let a=e[i];Pn(a)&&(Nn.has(a.event_type)?n.push(a):r>0?(n.push(a),r--):t=!0)}return{events:n.reverse(),omitted:t}}function In(e,t){return!e.omitted||!e.events.length?e.events:[{...e.events[0],id:-1,seq:-1,event_type:`log`,source:`stdout`,payload:JSON.stringify({line:t})},...e.events]}function Ln(e,t){switch(t.type){case`turn-user`:return{...e,streaming:!0,accepting:!0,queued:t.queued?e.queued+1:e.queued};case`turn-done`:{let n=Math.max(0,e.queued-1);return{...e,totals:t.totals,queued:n,streaming:e.queued>0}}case`finalized`:return{...e,streaming:!1,finalizing:!1,accepting:!1,queued:0,totals:t.totals??e.totals};case`accepting`:return t.accepting?{...e,accepting:!0}:{...e,accepting:!1,streaming:!1,queued:0};case`finalize-request`:return{...e,finalizing:!0};case`finalize-reject`:return{...e,finalizing:!1};case`blocked`:return{...e,accepting:!1,streaming:!1};default:return e}}function Rn(){try{return a()}catch{return null}}function zn({jobId:e,projectId:t,settleMode:n,initialAcceptingTurns:r,pendingInterrupts:a,kind:s=`job`,variant:l=`page`,onFinalized:d}){let{t:f}=o(`jobs`),{t:p}=o(`loops`),[m,h]=(0,G.useState)(a??[]),[g,_]=(0,G.useState)(a?.length===1?a[0].id:``);(0,G.useEffect)(()=>{h(a??[]),_(a?.length===1?a[0].id:``)},[a]);let v=m.find(e=>e.id===g),y=v!==void 0&&v.kind!==`question`,b=n??`finalize`,S=()=>t?`${i}/api/projects/${t}`:c(),[C,w]=(0,G.useReducer)(Ln,{streaming:!1,queued:0,totals:null,accepting:r??!0,finalizing:!1}),[T,E]=(0,G.useState)(``),[D,O]=(0,G.useState)(!1),k=(0,G.useRef)(null);(0,G.useEffect)(()=>{r!==void 0&&w({type:`accepting`,accepting:r})},[r]);let A=(0,G.useRef)(d);A.current=d;let j=Rn(),M=(0,G.useId)();(0,G.useEffect)(()=>{if(!j)return;let t=`interactive-composer-${e}-${M}`;return j.registerHandler(t,t=>{let n=t;if(n.jobId===e){if(n.type===`job.turn_user`)w({type:`turn-user`,queued:!!n.queued});else if(n.type===`job.turn_done`)w({type:`turn-done`,totals:n.totals});else if(n.type===`job.finalized`)w({type:`finalized`,totals:n.totals??null}),A.current?.();else if(n.type===`job.interactive`&&(w({type:`accepting`,accepting:!!n.acceptingTurns}),Array.isArray(n.pendingInterrupts))){let e=n.pendingInterrupts;h(e),_(e.length===1?e[0].id:``)}}}),()=>j.unregisterHandler(t)},[j,e,M]);let N=s===`loop-step`&&!C.accepting;async function F(t=!1){let n=T.trim();if(!(!n&&!t||D||N||m.length>0&&!v||y&&!t)){O(!0);try{let r=await fetch(`${S()}/jobs/${e}/messages`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({text:n,...v?{interruptId:v.id}:{},...t?{approve:!0}:{}})});if(r.ok)E(``),v&&(h([]),_(``),w({type:`accepting`,accepting:!1})),requestAnimationFrame(()=>k.current?.focus());else if(r.status===409&&s===`loop-step`&&!m.length)w({type:`blocked`});else{let e=await r.json().catch(()=>({}));u.error(f(`detail.toast.sendFailed`),{description:e.error})}}catch{u.error(f(`detail.toast.networkError`))}finally{O(!1)}}}async function I(){if(!C.finalizing){w({type:`finalize-request`});try{let t=await fetch(`${S()}/jobs/${e}/finalize`,{method:`POST`});if(t.ok)u.success(f(b===`finalize`?`detail.toast.finalizeScheduled`:s===`loop-step`?`detail.toast.wrapUpStepScheduled`:`detail.toast.wrapUpScheduled`));else if(t.status===409&&s===`loop-step`)w({type:`blocked`}),w({type:`finalize-reject`});else{let e=await t.json().catch(()=>({}));u.error(f(`detail.toast.finalizeFailed`),{description:e.error}),w({type:`finalize-reject`})}}catch{u.error(f(`detail.toast.networkError`)),w({type:`finalize-reject`})}}}let R=D||N||!T.trim()||y||m.length>0&&!v,ee=f(`detail.interactive.working`);return(0,K.jsxs)(`div`,{"data-testid":`interactive-job-composer`,className:P(`shrink-0 border-t px-3 py-2 space-y-1.5`,`motion-safe:animate-in motion-safe:fade-in motion-safe:slide-in-from-bottom-2 motion-safe:duration-300`,l===`glass`?`border-border/30 bg-surface/30`:`border-border/40 bg-surface/40`),children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-3 text-[11px] text-muted-foreground`,children:[(0,K.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[N?(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,K.jsx)(Pe,{className:`h-3 w-3 motion-safe:animate-pulse`}),f(`detail.interactive.waitingForStepShort`)]}):C.streaming?(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,K.jsx)(x,{className:`h-3 w-3 animate-spin text-accent-primary`}),(0,K.jsxs)(`span`,{className:`relative`,children:[ee,(0,K.jsx)(`span`,{"aria-hidden":!0,className:`title-shimmer pointer-events-none absolute inset-0`,children:ee})]})]}):(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,K.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full bg-accent-success motion-safe:animate-pulse`}),f(`detail.interactive.ready`)]}),C.queued>0&&(0,K.jsx)(`span`,{className:`rounded-full border border-accent-info/30 bg-accent-info/10 px-1.5 py-px text-[10px] tabular-nums text-accent-info motion-safe:animate-in motion-safe:fade-in`,children:f(`detail.interactive.queued`,{count:C.queued})})]}),(0,K.jsxs)(`span`,{className:`flex shrink-0 items-center gap-3`,children:[C.totals&&(0,K.jsx)(`span`,{className:`tabular-nums`,children:f(`detail.interactive.liveTotals`,{turns:C.totals.num_turns??f(`completion.unavailable`),cost:C.totals.total_cost_usd?.toFixed(4)??f(`completion.unavailable`)})}),m.length?null:b===`finalize`?(0,K.jsxs)(H,{children:[(0,K.jsx)(W,{asChild:!0,children:(0,K.jsxs)(L,{variant:`outline`,size:`sm`,onClick:()=>void I(),disabled:C.finalizing,className:`h-7 border-accent-success/40 text-accent-success hover:bg-accent-success/10`,children:[(0,K.jsx)(B,{className:`mr-1.5 h-3.5 w-3.5`}),C.finalizing?f(`detail.finalizing`):f(`detail.finalizeJob`)]})}),(0,K.jsx)(me,{children:f(`detail.finalizeJobTooltip`)})]}):(0,K.jsxs)(H,{children:[(0,K.jsx)(W,{asChild:!0,children:(0,K.jsx)(`button`,{type:`button`,onClick:()=>void I(),disabled:C.finalizing||N,className:P(`text-[11px] underline-offset-2 transition-colors`,N?`cursor-not-allowed text-muted-foreground/40`:`text-muted-foreground hover:text-accent-success hover:underline`),children:C.finalizing?f(`detail.interactive.wrappingUp`):f(s===`loop-step`?`detail.interactive.wrapUpStep`:`detail.interactive.wrapUp`)})}),(0,K.jsx)(me,{children:f(s===`loop-step`?`detail.interactive.wrapUpStepTooltip`:`detail.interactive.wrapUpTooltip`)})]})]})]}),m.length>0&&(0,K.jsxs)(`div`,{className:`space-y-2 rounded-md border border-accent-warning/30 bg-accent-warning/5 p-3`,children:[(0,K.jsxs)(`label`,{className:`block text-sm`,children:[p(`core.selectInterrupt`),(0,K.jsxs)(`select`,{"aria-label":p(`core.selectInterrupt`),className:`mt-1 w-full rounded border border-border bg-background p-2`,value:g,onChange:e=>_(e.target.value),children:[(0,K.jsx)(`option`,{value:``,children:p(`core.selectInterrupt`)}),m.map(e=>(0,K.jsxs)(`option`,{value:e.id,children:[e.nodePath,` · `,p(`core.${e.kind===`question`?`answerQuestion`:`approval`}`)]},e.id))]})]}),v&&typeof v.value==`object`&&v.value!==null&&typeof v.value.prompt==`string`&&(0,K.jsx)(`p`,{className:`whitespace-pre-wrap text-sm`,children:String(v.value.prompt)}),y&&(0,K.jsx)(L,{onClick:()=>void F(!0),disabled:D||N,children:p(`core.approveContinue`)})]}),b===`auto`&&!m.length&&(0,K.jsx)(`p`,{className:`text-[11px] leading-snug text-muted-foreground/60`,children:f(N?`detail.interactive.waitingForStep`:`detail.interactive.autoHint`)}),(0,K.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,K.jsx)(`textarea`,{ref:k,value:T,onChange:e=>E(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(!e.shiftKey||e.metaKey||e.ctrlKey)&&(e.preventDefault(),F())},rows:2,placeholder:f(N?`detail.interactive.waitingForStepShort`:`detail.interactive.placeholder`),"aria-label":f(`detail.interactive.placeholder`),disabled:N,className:P(`flex-1 resize-none rounded-md border border-border/50 bg-background px-2.5 py-1.5 text-sm transition-opacity focus:outline-none focus:ring-2 focus:ring-ring`,N&&`opacity-60`)}),(0,K.jsxs)(H,{children:[(0,K.jsx)(W,{asChild:!0,children:(0,K.jsx)(`span`,{className:`shrink-0`,children:(0,K.jsxs)(L,{size:`sm`,onClick:()=>void F(),disabled:R,className:`h-9`,children:[(0,K.jsx)(U,{className:`mr-1.5 h-3.5 w-3.5`}),f(`detail.interactive.send`)]})})}),R&&!D&&(0,K.jsx)(me,{children:f(N?`detail.interactive.sendDisabledWaiting`:`detail.interactive.sendDisabledEmpty`)})]})]})]})}export{An as a,an as c,qe as d,Fn as i,ht as l,Pn as n,jn as o,In as r,On as s,zn as t,et as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-CNC7AqOf.js";import{n as t,t as n}from"./jsx-runtime-zu2_FqZY.js";import{d as r,u as i}from"./chunk-KS7C4IRE-DEKu087k.js";import{n as a,t as o}from"./createLucideIcon-Bjbbp_KS.js";import{a as s,r as c,s as l}from"./useDesktop-ChSmmJfc.js";import{r as u}from"./provider-capabilities-lePfeT_Y.js";import{n as d,r as f,t as p}from"./save-OsUqVn99.js";import{t as m}from"./external-link-D6XxC_Cu.js";import{t as h}from"./git-branch-BRM0F5GN.js";import{n as g,t as _}from"./square-Ci-PFcFe.js";import{t as v}from"./plus-CsnjfkmX.js";import{t as y}from"./rotate-ccw-Wh4id13q.js";import{t as b}from"./trash-2-BOU3WdZZ.js";import{t as ee}from"./triangle-alert-H9T4jAmh.js";import{t as te}from"./upload-DYMjAQ6M.js";import{t as ne}from"./x-CBMI9ejn.js";import{a as x,i as re,l as S,o as ie,r as C,t as ae}from"./dialog-CMgps2MY.js";import{t as w}from"./utils-BC4DHlz2.js";import{t as T}from"./button-D1xExSTF.js";import{n as E,t as D}from"./project-repositories-DZKmieH3.js";import{Ft as oe,J as se,K as ce,Mt as le,U as O,Ut as ue,Vt as de,Y as fe,Yt as pe,bt as me,c as k,d as he,f as ge,gt as A,in as _e,it as j,l as M,m as N,ot as P,p as ve,q as ye,rn as be,rt as xe,tn as Se,u as F,xt as I,zt as Ce}from"./index-DVkWHOR3.js";import{a as we,c as Te,d as Ee,f as De,i as L,l as Oe,m as R,n as ke,o as Ae,p as je,r as Me,s as Ne,t as Pe,u as Fe}from"./loop-layout-BF8xMiNv.js";var Ie=o(`grid-3x3`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M3 9h18`,key:`1pudct`}],[`path`,{d:`M3 15h18`,key:`5xshup`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}]]),Le=o(`move-horizontal`,[[`path`,{d:`m18 8 4 4-4 4`,key:`1ak13k`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}],[`path`,{d:`m6 8-4 4 4 4`,key:`15zrgr`}]]),Re=o(`move-vertical`,[[`path`,{d:`M12 2v20`,key:`t6zp3m`}],[`path`,{d:`m8 18 4 4 4-4`,key:`bh5tu3`}],[`path`,{d:`m8 6 4-4 4 4`,key:`ybng9g`}]]),z=e(t(),1),B=n(),V=`h-9 w-full rounded-md border border-input bg-background px-2 text-sm`;function ze({roles:e={},provider:t,supported:n,onChange:r,renderEngine:i,visibleRoleIds:o,manageRoles:s=!0}){let{t:c}=a(`agentRuntime`),[l,u]=(0,z.useState)(``),[d,f]=(0,z.useState)(!1),p=Object.entries(e).filter(([e])=>!ge.includes(e)&&(!o||o.includes(e)));function m(){if(!k.test(l)||l===`fixer`||ge.includes(l)||Object.prototype.hasOwnProperty.call(e,l)){f(!0);return}r({...e,[l]:{provider:t,access:`read`,artifacts:`none`}}),u(``),f(!1)}return(0,B.jsxs)(`section`,{className:`space-y-3`,"aria-labelledby":`custom-runtime-roles`,children:[s&&(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h3`,{id:`custom-runtime-roles`,className:`text-sm font-medium`,children:c(`customRoles.title`)}),(0,B.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:c(`customRoles.hint`)})]}),!n&&(0,B.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:c(`customRoles.unsupported`)}),p.map(([t,a])=>{let o=n=>r({...e,[t]:{...a,...n}});return(0,B.jsxs)(`fieldset`,{className:`space-y-3 rounded-lg border p-3`,"aria-label":t,children:[(0,B.jsx)(`legend`,{className:`px-1 font-mono text-sm`,children:t}),s&&(0,B.jsx)(`div`,{className:`flex justify-end`,children:(0,B.jsx)(T,{size:`sm`,variant:`ghost`,onClick:()=>{let n={...e};delete n[t],r(n)},children:c(`customRoles.remove`,{id:t})})}),(0,B.jsxs)(`fieldset`,{disabled:!n,className:`space-y-3`,children:[i(t),(0,B.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,B.jsxs)(`label`,{className:`space-y-1 text-xs`,children:[c(`customRoles.access`),(0,B.jsxs)(`select`,{className:V,value:a.access,onChange:e=>o({access:e.target.value}),children:[(0,B.jsx)(`option`,{value:`read`,children:c(`customRoles.read`)}),(0,B.jsx)(`option`,{value:`write`,children:c(`customRoles.write`)})]})]}),(0,B.jsxs)(`label`,{className:`space-y-1 text-xs`,children:[c(`customRoles.artifacts`),(0,B.jsxs)(`select`,{className:V,value:a.artifacts,onChange:e=>o({artifacts:e.target.value}),children:[(0,B.jsx)(`option`,{value:`none`,children:c(`customRoles.none`)}),(0,B.jsx)(`option`,{value:`tasks-checkboxes`,children:c(`customRoles.tasks`)}),(0,B.jsx)(`option`,{value:`all`,children:c(`customRoles.all`)})]})]})]}),(0,B.jsxs)(`label`,{className:`block space-y-1 text-xs`,children:[c(`customRoles.skill`),(0,B.jsxs)(`select`,{className:V,value:a.openspecSkill??``,onChange:e=>o({openspecSkill:e.target.value||void 0}),children:[(0,B.jsx)(`option`,{value:``,children:c(`customRoles.noSkill`)}),[`openspec-ff-change`,`openspec-apply-change`,`openspec-verify-change`].map(e=>(0,B.jsx)(`option`,{value:e,children:e},e))]})]}),(0,B.jsxs)(`label`,{className:`block space-y-1 text-xs`,children:[c(`customRoles.prompt`),(0,B.jsx)(`textarea`,{className:`w-full rounded-md border border-input bg-background px-3 py-2 text-sm`,value:a.prompt??``,rows:5,maxLength:2e4,onChange:e=>o({prompt:e.target.value||void 0})})]})]})]},t)}),s&&(0,B.jsxs)(`fieldset`,{disabled:!n||!t,className:`flex items-end gap-2`,children:[(0,B.jsxs)(`label`,{className:`min-w-0 flex-1 space-y-1 text-xs`,children:[c(`customRoles.id`),(0,B.jsx)(O,{value:l,maxLength:64,placeholder:`security-reviewer`,onChange:e=>{u(e.target.value),f(!1)}})]}),(0,B.jsx)(T,{variant:`secondary`,onClick:m,children:c(`customRoles.add`)})]}),d&&(0,B.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive`,children:c(`customRoles.invalidId`)})]})}var Be={architect:ue,developer:oe,host:A};function Ve({projectId:e,catalogUrl:t,guardrails:n,onChange:r}){let{t:i,i18n:o}=a(`agentRuntime`),[s,c]=(0,z.useState)(!0),[l,u]=(0,z.useState)({status:`loading`});(0,z.useEffect)(()=>{let n=!1;return u({status:`loading`}),fetch(t??`${E(e)}/agent-runtime/guardrails`,{cache:`no-store`}).then(async e=>{if(!e.ok)throw Error(`guardrails`);let r=await e.json(),i=t?r.guardrails:r;if(!ve(i))throw Error(`guardrails`);n||u({status:`ready`,supported:i.supported,catalog:i.catalog})}).catch(()=>{n||u({status:`unsupported`})}),()=>{n=!0}},[e,t]);let f=l.status===`ready`?l.catalog:[],p=l.status===`ready`&&l.supported,m=f.filter(e=>n?.[e.id]===!1).length,h=f.length,g=e=>o.exists(`agentRuntime:guardrails.items.${e}.title`),_=`pipeline-guardrails-body`;return(0,B.jsxs)(`fieldset`,{id:`pipeline-guardrails`,"data-testid":`phase-card-guardrails`,className:`scroll-mt-4 rounded-lg border border-border transition-shadow`,children:[(0,B.jsx)(`legend`,{className:`sr-only`,children:i(`guardrails.title`)}),(0,B.jsxs)(`button`,{type:`button`,"aria-expanded":s,"aria-controls":_,"aria-label":`${i(s?`pipeline.collapse`:`pipeline.open`)}: ${i(`guardrails.title`)}`,onClick:()=>c(e=>!e),className:`flex w-full flex-wrap items-center gap-2 rounded-t-lg px-3 py-2 text-left hover:bg-muted/40`,children:[(0,B.jsx)(`span`,{className:`flex h-5 w-5 shrink-0 items-center justify-center rounded-full bg-accent-success/15 text-accent-success`,children:(0,B.jsx)(me,{className:`h-3.5 w-3.5`,"aria-hidden":!0})}),(0,B.jsx)(`span`,{className:`text-xs font-medium`,children:i(`guardrails.title`)}),(0,B.jsxs)(`span`,{className:`ml-auto flex items-center gap-2`,children:[l.status===`ready`&&p&&(0,B.jsx)(`span`,{"data-testid":`guardrails-active`,className:w(`inline-flex items-center rounded-md border px-1.5 py-0.5 text-[11px] leading-4`,m?`border-accent-warning/40 bg-accent-warning/10 text-accent-warning`:`border-accent-success/30 bg-accent-success/10 text-accent-success`),children:i(`guardrails.active`,{on:h-m,total:h})}),(0,B.jsx)(d,{className:`h-3.5 w-3.5 text-muted-foreground transition-transform ${s?``:`-rotate-90`}`,"aria-hidden":!0})]})]}),(0,B.jsxs)(`div`,{id:_,hidden:!s,className:`space-y-3 px-3 pb-3`,children:[(0,B.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:i(`guardrails.intro`)}),l.status===`loading`&&(0,B.jsx)(`p`,{role:`status`,className:`text-xs text-muted-foreground`,children:i(`loading`)}),(l.status===`unsupported`||l.status===`ready`&&!p)&&(0,B.jsx)(`p`,{role:`status`,className:`rounded-md border border-accent-warning/40 p-3 text-xs text-accent-warning`,children:i(`guardrails.unsupported`)}),l.status===`ready`&&(0,B.jsxs)(`fieldset`,{disabled:!p,className:`space-y-3 disabled:opacity-60`,children:[m>0&&(0,B.jsx)(`div`,{className:`flex justify-end`,children:(0,B.jsx)(`button`,{type:`button`,className:`text-[11px] text-accent-primary underline-offset-2 hover:underline`,onClick:()=>r(void 0),children:i(`guardrails.reset`)})}),M.map(e=>{let t=f.filter(t=>t.phase===e);if(!t.length)return null;let a=Be[e];return(0,B.jsxs)(`div`,{className:`space-y-2`,"data-testid":`guardrails-phase-${e}`,children:[(0,B.jsxs)(`p`,{className:`flex items-center gap-1.5 text-[11px] font-medium uppercase tracking-wide text-muted-foreground`,children:[(0,B.jsx)(a,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),i(`guardrails.phases.${e}`)]}),(0,B.jsx)(`ul`,{className:`divide-y divide-border/60 rounded-md border border-border/60`,children:t.map(e=>{let t=n?.[e.id]!==!1,a=g(e.id)?i(`guardrails.items.${e.id}.title`):e.id,o=g(e.id)?i(`guardrails.items.${e.id}.description`):i(`guardrails.unknown`),s=g(e.id)?i(`guardrails.items.${e.id}.why`):null,c=`guardrail-${e.id}-title`;return(0,B.jsxs)(`li`,{className:`flex items-start gap-3 px-3 py-2`,children:[(0,B.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":t,"aria-labelledby":c,"data-testid":`guardrail-${e.id}`,onClick:()=>r(N(n,e.id,!t)),className:w(`relative mt-0.5 inline-flex h-4 w-7 shrink-0 items-center rounded-full transition-colors`,t?`bg-accent-primary/70`:`bg-muted-foreground/30`),children:(0,B.jsx)(`span`,{className:w(`absolute h-3 w-3 rounded-full bg-background shadow transition-transform`,t?`translate-x-3.5`:`translate-x-0.5`)})}),(0,B.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,B.jsx)(`p`,{id:c,className:w(`text-xs font-medium`,!t&&`text-muted-foreground line-through decoration-muted-foreground/50`),children:a}),(0,B.jsx)(`p`,{className:`mt-0.5 text-[11px] leading-4 text-muted-foreground`,children:o}),s&&(0,B.jsx)(`p`,{className:`mt-0.5 text-[10px] italic leading-4 text-muted-foreground/70`,children:s})]})]},e.id)})})]},e)})]})]})]})}var He=`h-9 w-full rounded-md border border-input bg-background px-2 text-sm`;function Ue({config:e,onChange:t}){let{t:n}=a(`agentRuntime`),r=e.efficiency??{schemaVersion:1};return(0,B.jsxs)(`section`,{className:`space-y-3`,"aria-label":n(`efficiency.title`),children:[(0,B.jsx)(`h3`,{className:`text-sm font-medium`,children:n(`efficiency.title`)}),(0,B.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n(`efficiency.scope`)}),(0,B.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-3`,children:[`contextMode`,`reviewMode`,`planning`].map(i=>(0,B.jsxs)(`label`,{className:`block space-y-1 text-xs`,children:[n(`efficiency.${i}`),(0,B.jsxs)(`select`,{className:He,value:r[i]??(i===`planning`?`proportional`:`incremental`),onChange:n=>t({...e,efficiency:{...r,[i]:n.target.value}}),children:[(0,B.jsx)(`option`,{value:i===`planning`?`proportional`:`incremental`,children:n(`efficiency.adaptive`)}),(0,B.jsx)(`option`,{value:`full`,children:n(`efficiency.full`)})]})]},i))}),(0,B.jsxs)(`label`,{className:`flex items-center gap-2 text-xs`,children:[(0,B.jsx)(`input`,{type:`checkbox`,checked:r.acceptDeveloperChecks!==!1,onChange:n=>t({...e,efficiency:{...r,acceptDeveloperChecks:n.target.checked}})}),n(`efficiency.developerChecks`)]}),(0,B.jsxs)(`label`,{className:`block space-y-1 text-xs`,children:[n(`efficiency.concurrency`),(0,B.jsx)(O,{type:`number`,min:`1`,max:`4`,step:`1`,value:r.verification?.maxConcurrency??1,onChange:n=>t({...e,efficiency:{...r,verification:{...r.verification,maxConcurrency:Number(n.target.value)}}})})]}),(0,B.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n(`efficiency.concurrencyHint`)})]})}function We(e){let t=[],n=0;function r(i,a,o){if(!(o.length>=32||t.length>=1e4))for(let s of i.nodes){if(++n>1e4)return;if(s.type!==`core`)continue;let i=a+s.id,c=s.data?.kind,l=H(s.data?.params);(c===`role-turn`||c===`implementation-step`&&l.phase===`reviewer`)&&t.push(i);let u=c===`component`?l.ref:c===`map`?l.body:void 0;typeof u==`string`&&!o.includes(u)&&e.components?.[u]&&r(e.components[u],i+`/`,[...o,u])}}return r(e,``,[]),t.sort()}var H=e=>typeof e==`object`&&e&&!Array.isArray(e)?e:{};function U(e){return typeof e.type==`string`?e.type:e.properties||e.additionalProperties?`object`:e.items?`array`:`string`}function W(e){if(`default`in e)return structuredClone(e.default);if(`const`in e)return structuredClone(e.const);if(Array.isArray(e.enum))return structuredClone(e.enum[0]);let t=e.oneOf??e.anyOf;if(Array.isArray(t)&&!e.properties)return W(H(t[0]));switch(U(e)){case`boolean`:return!1;case`number`:case`integer`:return typeof e.minimum==`number`?e.minimum:0;case`array`:return[];case`object`:{let t=H(e.properties);return Object.fromEntries((Array.isArray(e.required)?e.required:[]).filter(e=>typeof e==`string`).map(e=>[e,W(H(t[e]))]))}default:return``}}function Ge(e){let t=H(W(e.paramsSchema));return e.kind===`prompt`&&(t.text=``,t.engine={provider:`claude`},t.access=`read`),e.kind===`shell`&&(t.argv=[``]),e.kind===`assign`&&(t.set={}),{kind:`core`,coreKind:e.kind,params:t}}function Ke(e,t,n={}){if(!e)return[];let r=e.outcomes;return e.kind===`prompt`&&(r=t.sentinel===`verification`?[`pass`,`fail`,`failed`]:t.sentinel===`blocked`?[`next`,`blocked`,`failed`]:[`next`,`failed`]),e.kind===`role-turn`&&(r=t.structuredOutput?[`next`,`invalid`,`failed`]:[`next`,`failed`]),e.kind===`component`?n[String(t.ref)]?.outputs??[`next`,`failed`]:r.filter(t=>e.outcomes.includes(t))}var qe=e=>[`prompt`,`role-turn`,`decider`,`implementation`,`implementation-step`].includes(e)?`ai`:[`verify`,`shell`].includes(e)?`verification`:e===`artifact-contract`||e.startsWith(`openspec-`)?`openspec`:`control`;function Je(e,t,n){return t===`implementation`?[`architect`,`developer`,`reviewer`,`fixer`]:t===`implementation-step`?[`architect`,`developer`,`reviewer`,`fixer`].includes(String(n.phase))?[String(n.phase)]:[]:t===`prompt`?[e===`fix`?`fixer`:e===`prepare`?`architect`:n.access===`read`?`reviewer`:`developer`]:(t===`role-turn`||t===`decider`)&&typeof n.roleId==`string`?[n.roleId]:[]}function Ye(e){let t=new Set,n=new Set;function r(i){for(let a of i.nodes){if(a.type!==`core`)continue;let i=H(a.data?.params),o=a.data?.kind;Je(a.id,o,i).forEach(e=>t.add(e));let s=o===`component`?i.ref:o===`map`?i.body:void 0;typeof s==`string`&&!n.has(s)&&e.components?.[s]&&(n.add(s),r(e.components[s]))}}return r(e),[...t]}var G=`w-full rounded-md border border-input bg-background px-2 py-1 text-xs`,K=[`architect`,`developer`,`reviewer`,`fixer`];function Xe({value:e,onChange:t,selectedRole:n,graph:r,mode:i=`all`}){let{t:o}=a(`agentRuntime`),{activeProjectId:l}=c(),d=(0,z.useRef)(l);d.current=l;let[f,p]=(0,z.useState)([]),[m,h]=(0,z.useState)({}),[g,_]=(0,z.useState)(),[v,y]=(0,z.useState)(``),[b,ee]=(0,z.useState)(!1),[te,ne]=(0,z.useState)(!1),x=r?Ye(r):[...K,...Object.keys(e?.roles??{})],re=i===`step`?[n??``]:te?void 0:x,S=i!==`workflow`,ie=i!==`step`,C=i===`step`?`loopAgents.stepTitle`:i===`workflow`?`loopAgents.policy`:`loopAgents.title`,ae=[...K,...Object.keys(e?.roles??{})].some(e=>!x.includes(e));(0,z.useEffect)(()=>{let e=new AbortController;return Promise.all([`/api/runtime-providers`,`/api/loop-agent-defaults`].map(t=>fetch(t,{signal:e.signal}).then(async e=>{if(!e.ok)throw Error(o(`loadFailed`));return e.json()}))).then(([t,n])=>{e.signal.aborted||(p(t.providers??[]),_(n.agents),h(Object.fromEntries(Object.entries(t.status??{}).map(([e,t])=>[e,t.models??[]]))))}).catch(()=>{e.signal.aborted||y(o(`loadFailed`))}),()=>e.abort()},[o]);async function w(){let e=l;ee(!0),y(``);try{let n=s(),[r,i]=await Promise.all([fetch(`${n}/agent-runtime/config`),fetch(`${n}/agent-runtime/loop-roles`)]);if(!r.ok||!i.ok)throw Error(o(`loadFailed`));let a=await r.json(),c=await i.json(),{agents:l,fixer:u,roles:f,rolePrompts:p,limits:m,review:h,architect:_,approvalBeforeArchive:v,efficiency:y,guardrails:b}=a.config;if(!e||d.current!==e)return;t({schemaVersion:1,agents:l,fixer:u,roles:{...g?.roles,...Object.fromEntries(Object.entries(f??{}).map(([e,t])=>[e,{...t,prompt:p?.[e]??t.prompt}])),...c.roles?.decider?{"loop-decider":{...g.roles[`loop-decider`],...c.roles.decider}}:{}},rolePrompts:Object.fromEntries(Object.entries({...g?.rolePrompts,...p}).filter(([e])=>K.includes(e))),limits:m,review:h,architect:_,approvalBeforeArchive:v,efficiency:y,guardrails:b})}catch{y(o(`loadFailed`))}finally{ee(!1)}}function E(n){if(!e)return null;let r=K.includes(n),i=n===`fixer`?e.fixer??e.agents.developer:r?e.agents[n]:e.roles?.[n];if(!i)return null;let a=i=>t(n===`fixer`?{...e,fixer:i}:r?{...e,agents:{...e.agents,[n]:i}}:{...e,roles:{...e.roles,[n]:{...e.roles[n],...i}}}),s=f.find(e=>e.id===i.provider),c=s?.kind===`cli`?P(s.cli).map(e=>e.value):m[i.provider]??[];return(0,B.jsxs)(`div`,{className:`space-y-2`,children:[(0,B.jsxs)(`label`,{className:`block text-xs`,children:[o(`agents.provider`),(0,B.jsxs)(`select`,{className:G,value:i.provider,onChange:e=>a({provider:e.target.value,maxTurns:i.maxTurns}),children:[(0,B.jsx)(`option`,{value:`inherit`,children:o(`loopAgents.inheritProvider`)}),!s&&i.provider!==`inherit`&&u(i.provider)&&(0,B.jsx)(`option`,{value:i.provider,children:i.provider}),f.filter(e=>u(e.kind===`cli`?e.cli:e.id)).map(e=>(0,B.jsx)(`option`,{value:e.id,children:e.kind===`openai-compatible`?e.label??e.id:e.id},e.id))]})]}),(0,B.jsxs)(`label`,{className:`block text-xs`,children:[o(`agents.model`),(0,B.jsx)(O,{value:i.model??``,list:`loop-models-${n}`,onChange:e=>a({...i,model:e.target.value||void 0})}),(0,B.jsx)(`datalist`,{id:`loop-models-${n}`,children:c.map(e=>(0,B.jsx)(`option`,{value:e},e))})]}),(0,B.jsxs)(`label`,{className:`block text-xs`,children:[o(`loopAgents.effort`),(0,B.jsx)(O,{value:i.effort??``,onChange:e=>a({...i,effort:e.target.value||void 0})})]}),(0,B.jsxs)(`label`,{className:`block text-xs`,children:[o(`agents.maxTurns`,{turns:100}),(0,B.jsx)(O,{type:`number`,min:1,value:i.maxTurns??``,onChange:e=>a({...i,maxTurns:e.target.value?Number(e.target.value):void 0})})]}),(0,B.jsxs)(`label`,{className:`block text-xs`,children:[o(`agents.thinking`),(0,B.jsxs)(`select`,{className:G,value:i.thinking??``,onChange:e=>a({...i,thinking:e.target.value?e.target.value:void 0}),children:[(0,B.jsx)(`option`,{value:``,children:o(`loopAgents.default`)}),(0,B.jsx)(`option`,{value:`off`,children:o(`agents.thinking_off`)}),(0,B.jsx)(`option`,{value:`on`,children:o(`agents.thinking_on`)})]})]}),(0,B.jsxs)(`label`,{className:`block text-xs`,children:[o(`loopAgents.escalationModel`),(0,B.jsx)(O,{value:i.escalation?.model??``,onChange:e=>a({...i,escalation:e.target.value?{...i.escalation,model:e.target.value}:void 0})})]}),i.escalation&&(0,B.jsxs)(`label`,{className:`block text-xs`,children:[o(`loopAgents.escalationEffort`),(0,B.jsx)(O,{value:i.escalation.effort??``,onChange:e=>a({...i,escalation:{model:i.escalation.model,effort:e.target.value||void 0}})})]})]})}let D=e?{...e,enabled:!0,providers:f,verification:[]}:void 0;return(0,B.jsxs)(`section`,{className:`space-y-3 border-b border-border pb-4`,"aria-label":o(C),children:[(0,B.jsx)(`h3`,{className:`text-sm font-medium`,children:o(C)}),S&&(0,B.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:o(i===`step`?`loopAgents.stepHint`:`loopAgents.hint`)}),v&&(0,B.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive`,children:v}),!e&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`p`,{className:`text-xs text-accent-warning`,children:o(`loopAgents.legacy`)}),(0,B.jsx)(T,{size:`sm`,disabled:!g,onClick:()=>g&&t(structuredClone(g)),children:o(`loopAgents.enable`)})]}),i!==`step`&&(0,B.jsx)(T,{size:`sm`,variant:`secondary`,disabled:!l||!g||b,onClick:()=>void w(),children:o(`loopAgents.import`)}),e&&(0,B.jsxs)(B.Fragment,{children:[i===`all`&&ae&&(0,B.jsxs)(`label`,{className:`flex gap-2 text-xs`,children:[(0,B.jsx)(`input`,{type:`checkbox`,checked:te,onChange:e=>ne(e.target.checked)}),o(`loopAgents.showUnused`)]}),S&&K.filter(e=>!re||re.includes(e)).map(r=>(0,B.jsxs)(`details`,{open:n===r,className:`rounded-md border border-border p-2`,children:[(0,B.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium`,children:r}),(0,B.jsxs)(`div`,{className:`mt-3 space-y-3`,children:[E(r),(0,B.jsxs)(`label`,{className:`block text-xs`,children:[o(`customRoles.prompt`),(0,B.jsx)(`textarea`,{className:G,rows:10,maxLength:2e4,value:e.rolePrompts?.[r]??``,onChange:n=>t({...e,rolePrompts:{...e.rolePrompts,[r]:n.target.value}})})]}),(0,B.jsx)(T,{size:`sm`,variant:`ghost`,disabled:!g,onClick:()=>t({...e,rolePrompts:{...e.rolePrompts,[r]:g?.rolePrompts?.[r]??``}}),children:o(`loopAgents.restoreDefinition`)})]})]},r)),i===`step`&&n&&![...K,`archive`,`verify`].includes(n)&&!e.roles?.[n]&&(0,B.jsx)(T,{size:`sm`,disabled:!f.length,onClick:()=>t({...e,roles:{...e.roles,[n]:{provider:`inherit`,access:`read`,artifacts:`none`}}}),children:o(`customRoles.add`)}),(S||i===`workflow`)&&(0,B.jsx)(ze,{manageRoles:i!==`step`,visibleRoleIds:i===`workflow`?[]:re,roles:e.roles,provider:`inherit`,supported:!0,onChange:n=>{Object.keys(n).some(t=>!e.roles?.[t])&&ne(!0),t({...e,roles:n,rolePrompts:Object.fromEntries(Object.entries(e.rolePrompts??{}).filter(([e])=>K.includes(e)))})},renderEngine:E}),(0,B.jsxs)(`div`,{className:`space-y-3`,children:[ie&&(0,B.jsxs)(`details`,{className:`rounded-md border border-border p-2`,children:[(0,B.jsx)(`summary`,{className:`cursor-pointer text-sm`,children:o(`loopAgents.policy`)}),(0,B.jsxs)(`div`,{className:`mt-3 space-y-3`,children:[[`maxAttempts`,`maxTokens`,`maxCostUsd`,`timeoutMs`].map(n=>(0,B.jsxs)(`label`,{className:`block text-xs`,children:[o(`loopAgents.${n}`),(0,B.jsx)(O,{type:`number`,min:1,value:e.limits?.[n]??``,onChange:r=>t({...e,limits:{...e.limits,[n]:r.target.value?Number(r.target.value):void 0}})})]},n)),(0,B.jsx)(Ve,{catalogUrl:`/api/loop-agent-defaults`,guardrails:e.guardrails,onChange:n=>t({...e,guardrails:n})}),D&&(0,B.jsx)(Ue,{config:D,onChange:n=>t({...e,efficiency:n.efficiency})})]})]}),(i===`all`||i===`step`&&n===`reviewer`)&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`label`,{className:`block text-xs`,children:[o(`review.minScore`,{score:70}),(0,B.jsx)(O,{type:`number`,min:70,max:100,value:e.review?.minScore??``,onChange:n=>t({...e,review:{...e.review,minScore:n.target.value?Number(n.target.value):void 0}})})]}),F.map(n=>(0,B.jsxs)(`label`,{className:`block text-xs`,children:[o(`review.aspects.${n}`,{score:he.aspects[n]}),(0,B.jsx)(O,{type:`number`,min:he.aspects[n],max:100,value:e.review?.aspects?.[n]??``,onChange:r=>t({...e,review:{...e.review,aspects:{...e.review?.aspects,[n]:r.target.value?Number(r.target.value):void 0}}})})]},n))]}),(i===`all`||i===`step`&&n===`architect`)&&(0,B.jsxs)(`label`,{className:`block text-xs`,children:[o(`architect.onLowConfidence`),(0,B.jsxs)(`select`,{className:G,value:e.architect?.onLowConfidence??`ask`,onChange:n=>t({...e,architect:{onLowConfidence:n.target.value}}),children:[(0,B.jsx)(`option`,{value:`ask`,children:o(`architect.ask`)}),(0,B.jsx)(`option`,{value:`proceed`,children:o(`architect.proceed`)})]})]}),(i===`all`||i===`step`&&n===`archive`)&&(0,B.jsxs)(`label`,{className:`flex gap-2 text-xs`,children:[(0,B.jsx)(`input`,{type:`checkbox`,checked:e.approvalBeforeArchive??!1,onChange:n=>t({...e,approvalBeforeArchive:n.target.checked})}),o(`approvalBeforeArchive`)]})]})]})]})}var q=`w-full min-w-0 rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent-primary`;function J({schema:e,value:t,onChange:n,path:r=`params`,choices:i={},depth:o=0}){let{t:s}=a(`loops`),c=(0,z.useId)(),[l,u]=(0,z.useState)(``);if(o>24)return(0,B.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive`,children:s(`builder.core.tooDeep`)});let d=typeof e.title==`string`?e.title:r.split(`.`).slice(-1)[0],f=(e,n,a,s)=>(0,B.jsx)(J,{schema:n,value:a,onChange:s,path:`${r}.${e}`,choices:{...i,selectedProvider:typeof H(t).provider==`string`?String(H(t).provider):i.selectedProvider},depth:o+1},e),p=e.oneOf??e.anyOf;if(Array.isArray(p)&&!e.properties){let e=p.map(H),r=Math.max(0,e.findIndex(e=>`const`in e?t===e.const:Array.isArray(e.enum)?e.enum.includes(t):U(e)===(Array.isArray(t)?`array`:typeof t)));return(0,B.jsxs)(`fieldset`,{className:`space-y-2`,children:[(0,B.jsx)(`legend`,{className:`text-xs font-medium`,children:d}),(0,B.jsx)(`label`,{className:`sr-only`,htmlFor:c,children:s(`builder.core.variant`,{name:d})}),(0,B.jsx)(`select`,{id:c,className:q,value:r,onChange:t=>n(W(e[Number(t.target.value)])),children:e.map((e,t)=>(0,B.jsx)(`option`,{value:t,children:String(e.title??e.const??(Array.isArray(e.enum)?e.enum.join(` / `):U(e)))},t))}),f(`value`,e[r],t,n)]})}if(`const`in e)return(0,B.jsxs)(`p`,{className:`text-xs`,children:[(0,B.jsxs)(`span`,{className:`text-muted-foreground`,children:[d,`: `]}),String(e.const)]});if(Array.isArray(e.enum))return(0,B.jsxs)(`label`,{className:`block space-y-1 text-xs`,children:[d,(0,B.jsxs)(`select`,{className:q,value:JSON.stringify(t),onChange:e=>n(JSON.parse(e.target.value)),children:[!e.enum.includes(t)&&(0,B.jsx)(`option`,{value:JSON.stringify(t)??``,children:s(`builder.core.select`)}),e.enum.map((e,t)=>(0,B.jsx)(`option`,{value:JSON.stringify(e),children:String(e)},t))]})]});let m=U(e);if(m===`object`){let r=H(t),i=H(e.properties),a=new Set(Array.isArray(e.required)?e.required:[]),o=[...Object.keys(i),...Object.keys(r).filter(e=>!(e in i))],c=(e,t)=>{let a={...r};e===`provider`&&t!==r.provider&&i.model&&(delete a.model,delete a.effort),t===void 0?delete a[e]:Object.defineProperty(a,e,{value:t,enumerable:!0,configurable:!0,writable:!0}),n(a)},m=Array.isArray(p)?p.map(e=>H(e).required).filter(e=>Array.isArray(e)&&e.every(e=>typeof e==`string`)):[],h=t=>{let a={...r};if(m.some(e=>e.includes(t)))for(let e of m)for(let n of e)n!==t&&delete a[n];Object.defineProperty(a,t,{value:W(H(i[t]??e.additionalProperties)),enumerable:!0,configurable:!0,writable:!0}),n(a)};return(0,B.jsxs)(`fieldset`,{className:`space-y-2 min-w-0`,children:[(0,B.jsx)(`legend`,{className:`text-xs font-semibold text-foreground mb-1`,children:d}),o.map(t=>{let n=Object.prototype.hasOwnProperty.call(r,t),o=a.has(t);return!n&&!o?(0,B.jsxs)(`button`,{type:`button`,className:`inline-flex items-center gap-1 text-xs rounded border border-border px-2 py-1 mr-1 hover:bg-muted`,onClick:()=>h(t),"aria-label":s(`builder.core.addField`,{name:t}),children:[(0,B.jsx)(v,{className:`h-3 w-3`}),t]},t):(0,B.jsxs)(`div`,{className:`relative border-l border-border pl-2 space-y-1`,children:[!o&&(0,B.jsx)(`button`,{type:`button`,className:`float-right text-muted-foreground hover:text-destructive`,onClick:()=>c(t,void 0),"aria-label":s(`builder.core.removeField`,{name:t}),children:(0,B.jsx)(ne,{className:`h-3.5 w-3.5`})}),f(t,H(i[t]??e.additionalProperties),r[t],e=>c(t,e))]},t)}),e.additionalProperties!==!1&&(0,B.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,B.jsx)(`input`,{className:q,value:l,placeholder:s(`builder.core.fieldName`),"aria-label":s(`builder.core.fieldName`),onChange:e=>u(e.target.value)}),(0,B.jsx)(`button`,{type:`button`,className:`p-1.5 text-accent-primary disabled:opacity-40`,disabled:!l.trim()||Object.prototype.hasOwnProperty.call(r,l.trim())||[`__proto__`,`constructor`,`prototype`].includes(l.trim()),onClick:()=>{h(l.trim()),u(``)},"aria-label":s(`builder.core.addField`,{name:l}),children:(0,B.jsx)(v,{className:`h-4 w-4`})})]})]})}if(m===`array`){let r=Array.isArray(t)?t:[],i=H(e.items);return(0,B.jsxs)(`fieldset`,{className:`space-y-2`,children:[(0,B.jsx)(`legend`,{className:`text-xs font-semibold`,children:d}),r.map((e,t)=>(0,B.jsxs)(`div`,{className:`border-l border-border pl-2`,children:[(0,B.jsx)(`button`,{type:`button`,className:`float-right text-muted-foreground hover:text-destructive`,onClick:()=>n(r.filter((e,n)=>n!==t)),"aria-label":s(`builder.core.removeField`,{name:`${d} ${t+1}`}),children:(0,B.jsx)(ne,{className:`h-3.5 w-3.5`})}),f(String(t+1),i,e,e=>n(r.map((n,r)=>r===t?e:n)))]},t)),(0,B.jsxs)(`button`,{type:`button`,className:`inline-flex items-center gap-1 text-xs text-accent-primary`,disabled:typeof e.maxItems==`number`&&r.length>=e.maxItems,onClick:()=>n([...r,W(i)]),children:[(0,B.jsx)(v,{className:`h-3 w-3`}),s(`builder.core.addItem`)]})]})}if(!Object.keys(e).length){let e=t===null?`null`:Array.isArray(t)?`array`:typeof t,r=[`object`,`array`,`boolean`,`number`,`null`].includes(e)?e:`string`;return(0,B.jsxs)(`div`,{className:`space-y-1`,children:[(0,B.jsxs)(`label`,{className:`text-xs`,children:[s(`builder.core.valueType`),(0,B.jsx)(`select`,{className:q,value:r,onChange:e=>n(e.target.value===`null`?null:W({type:e.target.value})),children:[`string`,`number`,`boolean`,`object`,`array`,`null`].map(e=>(0,B.jsx)(`option`,{children:e},e))})]}),r===`null`?(0,B.jsx)(`span`,{className:`text-xs`,children:`null`}):f(`value`,{type:r},t,n)]})}if(m===`boolean`)return(0,B.jsxs)(`label`,{className:`flex items-center gap-2 text-xs`,children:[(0,B.jsx)(`input`,{type:`checkbox`,checked:t===!0,onChange:e=>n(e.target.checked),className:`accent-accent-primary`}),d]});if(m===`number`||m===`integer`)return(0,B.jsxs)(`label`,{className:`block space-y-1 text-xs`,children:[d,(0,B.jsx)(`input`,{type:`number`,className:q,value:typeof t==`number`?t:``,min:typeof e.minimum==`number`?e.minimum:void 0,max:typeof e.maximum==`number`?e.maximum:void 0,step:m===`integer`?1:`any`,onChange:e=>n(e.target.value===``?void 0:Number(e.target.value))})]});let h=d===`provider`?i.providers:d===`roleId`?i.roles:[`ref`,`body`].includes(d)?i.components:void 0,g=d===`model`?i.models?.[i.selectedProvider??``]:void 0,_=[`text`,`prompt`,`question`,`message`,`goal`,`expr`,`commandLine`,`reason`].includes(d);return(0,B.jsxs)(`label`,{className:`block space-y-1 text-xs`,children:[d,h?.length&&d!==`roleId`?(0,B.jsxs)(`select`,{className:q,value:typeof t==`string`?t:``,onChange:e=>n(e.target.value),children:[(0,B.jsx)(`option`,{value:``,children:s(`builder.core.select`)}),t&&!h.includes(String(t))?(0,B.jsx)(`option`,{value:String(t),children:String(t)}):null,h.map(e=>(0,B.jsx)(`option`,{children:e},e))]}):_?(0,B.jsx)(`textarea`,{className:`${q} min-h-24 resize-y font-mono`,value:typeof t==`string`?t:``,maxLength:typeof e.maxLength==`number`?e.maxLength:void 0,onChange:e=>n(e.target.value)}):(0,B.jsx)(`input`,{list:g?.length||d===`roleId`&&h?.length?c:void 0,className:q,value:typeof t==`string`?t:``,maxLength:typeof e.maxLength==`number`?e.maxLength:void 0,onChange:e=>n(e.target.value)}),g?.length||d===`roleId`&&h?.length?(0,B.jsx)(`datalist`,{id:c,children:(g??h??[]).map(e=>(0,B.jsx)(`option`,{value:e},e))}):null,typeof e.description==`string`&&(0,B.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:e.description})]})}var Y=`w-full min-w-0 rounded border border-border bg-background px-2 py-1 text-xs`,Ze=[`journal`,`change`,`maxTokens`,`maxTransitions`,`policies`];function Qe({graph:e,canvas:t,schema:n,onChange:r,onOpenCanvas:i}){let{t:o}=a(`loops`),[s,c]=(0,z.useState)(``),l=H(n.properties),u={type:`object`,additionalProperties:!1,properties:{...Object.fromEntries(Ze.filter(e=>l[e]).map(e=>[e,l[e]])),...H(H(l.budget).properties).maxTokens?{maxTokens:H(H(l.budget).properties).maxTokens}:{}}},d=Object.fromEntries(Object.entries(e.config).filter(([e])=>Ze.includes(e))),f=t?e.components?.[t]:void 0,p=t?[]:We(e);return(0,B.jsxs)(B.Fragment,{children:[!t&&(0,B.jsxs)(`label`,{className:`block space-y-1 text-xs`,children:[(0,B.jsx)(`span`,{children:o(`builder.core.reviewerStep`)}),(0,B.jsxs)(`select`,{className:Y,value:e.config.reviewerStepId??``,onChange:t=>r({...e,config:{...e.config,reviewerStepId:t.target.value||void 0}}),children:[(0,B.jsx)(`option`,{value:``,children:o(`builder.core.reviewerAutomatic`)}),e.config.reviewerStepId&&!p.includes(e.config.reviewerStepId)&&(0,B.jsx)(`option`,{value:e.config.reviewerStepId,children:e.config.reviewerStepId}),p.map(e=>(0,B.jsx)(`option`,{value:e,children:e},e))]}),(0,B.jsx)(`span`,{className:`block text-muted-foreground`,children:o(`builder.core.reviewerHint`)})]}),(0,B.jsx)(J,{schema:u,value:d,path:o(`builder.core.options`),onChange:t=>{let n=Object.fromEntries(Object.entries(e.config).filter(([e])=>!Ze.includes(e)));r({...e,config:{...n,...t}})}}),(0,B.jsxs)(`section`,{className:`space-y-2`,children:[(0,B.jsx)(`p`,{className:`text-xs font-semibold`,children:o(`builder.core.components`)}),(0,B.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:Object.keys(e.components??{}).map(e=>(0,B.jsx)(`button`,{type:`button`,onClick:()=>i(e),className:`text-xs rounded border border-border px-2 py-1 hover:bg-muted`,children:e},e))}),(0,B.jsxs)(`div`,{className:`flex gap-1`,children:[(0,B.jsx)(`input`,{className:Y,value:s,"aria-label":o(`builder.core.componentName`),placeholder:o(`builder.core.componentName`),onChange:e=>c(e.target.value)}),(0,B.jsx)(`button`,{type:`button`,disabled:!/^[a-z][a-z0-9-]{0,63}$/.test(s)||!!e.components?.[s],onClick:()=>{i(s,!0),c(``)},"aria-label":o(`builder.core.addComponent`),className:`text-accent-primary disabled:opacity-40`,children:(0,B.jsx)(v,{className:`w-4 h-4`})})]}),f&&t&&(0,B.jsx)(J,{schema:{type:`object`,additionalProperties:!1,required:[`inputs`,`outputs`],properties:{inputs:{type:`array`,items:{type:`string`}},outputs:{type:`array`,items:{type:`string`}}}},value:{inputs:f.inputs??[],outputs:f.outputs??[`next`,`failed`]},path:t,onChange:n=>{r({...e,components:{...e.components,[t]:{...f,...n}}})}})]})]})}function $e({nodeId:e,data:t,piece:n,choices:r,schema:i,onChange:o,onDelete:s,onOpenCanvas:c}){let{t:l}=a(`loops`),u=t.params?.ref??t.params?.body,d=H(H(i.$defs).retry),f=n?.paramsSchema??{},p=t.coreKind===`assign`?{set:l(`builder.core.assignment.set`),increment:l(`builder.core.assignment.increment`)}:t.coreKind===`decider`?{continueWhen:l(`builder.core.requiredContinue`)}:{},m=Object.keys(p).length?{...f,properties:Object.fromEntries(Object.entries(H(f.properties)).map(([e,t])=>[e,p[e]?{...H(t),title:p[e]}:t]))}:f;return(0,B.jsxs)(`div`,{className:`space-y-3`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,B.jsx)(`h3`,{className:`text-sm font-semibold`,children:l(`builder.core.pieces.${t.coreKind}`)}),(0,B.jsx)(`button`,{type:`button`,onClick:s,"aria-label":l(`common:actions.delete`),className:`text-muted-foreground hover:text-destructive`,children:(0,B.jsx)(b,{className:`h-4 w-4`})})]}),(0,B.jsxs)(`label`,{className:`block text-xs`,children:[l(`builder.inspector.label`),(0,B.jsx)(`input`,{className:Y,value:String(t.label??``),onChange:e=>o({label:e.target.value})})]}),[`implementation`,`implementation-step`].includes(t.coreKind??``)&&(0,B.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:l(`builder.core.legacyImplementation`)}),n?(0,B.jsx)(J,{schema:m,value:t.params??{},onChange:e=>o({params:e}),choices:r},e):(0,B.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:l(`builder.core.unavailable`)}),[`component`,`map`].includes(t.coreKind)&&typeof u==`string`&&(0,B.jsx)(`button`,{type:`button`,className:`text-xs text-accent-primary`,onClick:()=>c(u),children:l(`builder.core.openComponent`)}),Object.keys(d).length>0&&(0,B.jsx)(J,{schema:d,value:t.retry??{},path:`retry`,onChange:e=>o({retry:e})})]})}function et(e){return e===`continue`||e===`stop`?e:void 0}function tt(e){switch(e){case`core`:return{kind:e,coreKind:`prompt`,params:{text:``,access:`write`,sessionContinuity:`run`}};case`ai-step`:return{kind:e,prompt:``,provider:`claude`,model:``,effort:`medium`,maxTurns:0};case`shell`:return{kind:e,command:``};case`decider`:return{kind:e,goal:``};case`condition`:return{kind:e,join:`AND`};case`end`:return{kind:e,outcome:`success`};default:return{kind:e}}}function nt(){return globalThis.crypto?.randomUUID?.()??`n-${Date.now()}-${Math.floor(Math.random()*1e9)}`}function rt(e,t){return{id:nt(),type:`loop`,position:t,data:tt(e)}}function it(e){let t=(e.nodes??[]).map(e=>({id:e.id,type:`loop`,position:e.position??{x:0,y:0},data:{...e.data??{},...e.type===`core`?{coreKind:e.data?.kind}:{},kind:e.type}})),n=new Map((e.nodes??[]).map(e=>[e.id,e.type]));return{nodes:t,edges:(e.edges??[]).map(e=>{let t=e.branch??(n.get(e.source)===`decider`?n.get(e.target)===`end`?`stop`:`continue`:void 0);return{id:e.id,source:e.source,target:e.target,sourceHandle:e.label??t??void 0,type:`smoothstep`,markerEnd:{type:je.ArrowClosed,width:16,height:16},label:e.label??e.join,data:{...e.join?{join:e.join}:{},...t?{branch:t}:{},...e.label?{label:e.label}:{}},...t?{style:{stroke:t===`stop`?`var(--color-accent-success)`:`var(--color-accent-highlight)`}}:{}}})}}function at(e,t,n,r){let i={...n};return i.legacyDeciderRole&&!e.some(e=>e.data.coreKind===`decider`&&e.data.params?.roleId===i.legacyDeciderRole)&&delete i.legacyDeciderRole,{nodes:e.map(e=>{let{kind:t,coreKind:n,...r}=e.data,i={id:e.id,type:t,position:e.position};return(Object.keys(r).length>0||n)&&(i.data={...r,...t===`core`?{kind:n}:{}}),i}),edges:t.map(t=>{let n=t.data?.join;if(e.find(e=>e.id===t.source)?.data.kind===`core`){let e=t.sourceHandle??t.data?.label;return{id:t.id,source:t.source,target:t.target,...e?{label:e}:{}}}let r=et(t.sourceHandle)??et(t.data?.branch);return{id:t.id,source:t.source,target:t.target,...n?{join:n}:{},...r?{branch:r}:{}}}),config:i,...r?{components:r}:{}}}var ot=`specrailsNodes`;function st(e,t){let n=e.filter(e=>e.selected);if(n.length===0)return null;let r=new Set(n.map(e=>e.id));return{specrailsNodes:1,nodes:n,edges:t.filter(e=>r.has(e.source)&&r.has(e.target))}}function ct(e){if(!e)return null;let t;try{t=JSON.parse(e)}catch{return null}let n=t;return!n||n[ot]==null||!Array.isArray(n.nodes)?null:{nodes:n.nodes,edges:Array.isArray(n.edges)?n.edges:[]}}function lt(e,t){let n=t.offset??{x:40,y:40},r=new Set(t.excludeKinds??[]),i=new Map;return{nodes:e.nodes.filter(e=>!r.has(String(e.data?.kind))).map(e=>{let r=t.mintId();return i.set(e.id,r),{...e,id:r,position:{x:e.position.x+n.x,y:e.position.y+n.y},selected:!0}}),edges:e.edges.filter(e=>i.has(e.source)&&i.has(e.target)).map(e=>({...e,id:t.mintId(),source:i.get(e.source),target:i.get(e.target),selected:!1}))}}function ut(e){return typeof e!=`string`||e.trim().length===0}function dt(e,t){let n=e.find(e=>e.data.kind===`start`),r=new Set;if(!n)return r;let i=new Map;for(let e of t)(i.get(e.source)??i.set(e.source,[]).get(e.source)).push(e.target);let a=[n.id];for(;a.length;){let e=a.shift();if(!r.has(e)){r.add(e);for(let t of i.get(e)??[])r.has(t)||a.push(t)}}return r}function ft(e,t){let n=[],r=e.filter(e=>e.data.kind===`start`);r.length===0&&n.push({severity:`error`,code:`NO_START`});for(let e of r.slice(1))n.push({severity:`error`,code:`MULTIPLE_START`,nodeId:e.id});if(e.some(e=>e.data.kind===`end`||e.data.kind===`core`&&e.data.coreKind===`end`)||n.push({severity:`error`,code:`NO_END`}),e.some(e=>e.data.kind===`core`)&&e.some(e=>![`start`,`core`,`end`].includes(e.data.kind))&&n.push({severity:`error`,code:`MIXED_ENGINES`}),r.length===1){let r=dt(e,t);for(let t of e)r.has(t.id)||n.push({severity:`error`,code:`ORPHAN`,nodeId:t.id})}let i=new Map;for(let e of t)(i.get(e.source)??i.set(e.source,[]).get(e.source)).push(e);for(let t of e){let e=i.get(t.id)??[];switch(t.data.kind){case`core`:{(!t.data.coreKind||!t.data.params||typeof t.data.params!=`object`||Array.isArray(t.data.params))&&n.push({severity:`error`,code:`CORE_PIECE`,nodeId:t.id});let r=e.map(e=>e.sourceHandle??e.data?.label);(t.data.coreKind===`end`?e.length>0:!r.length||r.some(e=>!e||!/^[a-z][a-z0-9-]{0,31}$/.test(e))||new Set(r).size!==r.length)&&n.push({severity:`error`,code:`CORE_OUTCOMES`,nodeId:t.id});break}case`decider`:{let r=new Set(e.map(e=>e.sourceHandle??e.data?.branch));(!r.has(`continue`)||!r.has(`stop`))&&n.push({severity:`error`,code:`DECIDER_BRANCHES`,nodeId:t.id}),ut(t.data.goal)&&n.push({severity:`warning`,code:`EMPTY_GOAL`,nodeId:t.id});break}case`ai-step`:ut(t.data.prompt)&&n.push({severity:`warning`,code:`EMPTY_PROMPT`,nodeId:t.id}),e.length===0&&n.push({severity:`warning`,code:`DEAD_END`,nodeId:t.id});break;case`shell`:ut(t.data.command)&&n.push({severity:`warning`,code:`EMPTY_COMMAND`,nodeId:t.id}),e.length===0&&n.push({severity:`warning`,code:`DEAD_END`,nodeId:t.id});break;case`start`:e.length===0&&n.push({severity:`warning`,code:`DEAD_END`,nodeId:t.id});break;default:break}}return n}function pt(e){let t=new Map;for(let n of e)n.nodeId&&(n.severity===`error`||!t.has(n.nodeId))&&t.set(n.nodeId,n.severity);return t}var mt=(0,z.createContext)(new Map),ht=(0,z.createContext)({pieces:[]}),gt=[`start`,`ai-step`,`shell`,`decider`,`end`],_t={core:pe,start:g,"ai-step":pe,shell:A,decider:h,condition:h,end:Ce},vt={core:`border-accent-primary/60`,start:`border-accent-success/60`,"ai-step":`border-accent-primary/60`,shell:`border-accent-warning/60`,decider:`border-accent-highlight/60`,condition:`border-accent-info/60`,end:`border-accent-secondary/60`};function yt({id:e,data:t,selected:n}){let{t:r}=a(`loops`),i=t.kind,o=_t[i]??_,s=String(t.label??``).trim(),c=(0,z.useContext)(mt).get(e),l=(0,z.useContext)(ht),u=Ke(l.pieces.find(e=>e.kind===t.coreKind),t.params??{},l.components),d=i===`core`?String(t.params?.roleId??t.params?.ref??t.params?.body??t.params?.text??t.params?.expr??``):i===`ai-step`?String(t.model||t.provider||``):i===`shell`?String(t.command||``):i===`decider`?String(t.goal||``):i===`condition`?String(t.join||`AND`):i===`end`?String(t.outcome||`success`):``;return(0,B.jsxs)(`div`,{className:w(`rounded-md border-2 bg-card px-3 py-2 min-w-[140px] shadow-sm`,vt[i],c===`error`?`ring-2 ring-destructive`:n?`ring-2 ring-accent-primary`:c===`warning`?`ring-2 ring-accent-warning`:``),children:[i!==`start`&&(0,B.jsx)(L,{type:`target`,position:R.Top}),(0,B.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,B.jsx)(o,{className:`w-3.5 h-3.5 text-foreground flex-shrink-0`}),(0,B.jsx)(`span`,{className:`text-xs font-semibold text-foreground truncate max-w-[150px]`,children:s||r(i===`core`?`builder.core.pieces.${t.coreKind}`:`builder.nodes.${i}`)}),s&&(0,B.jsx)(`span`,{className:`text-[9px] text-muted-foreground/70 flex-shrink-0`,children:r(i===`core`?`builder.core.pieces.${t.coreKind}`:`builder.nodes.${i}`)})]}),d&&(0,B.jsx)(`p`,{className:`text-[10px] text-muted-foreground mt-1 truncate max-w-[160px]`,children:d}),i===`core`?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`div`,{className:`flex justify-around gap-2 mt-2 text-[9px] text-accent-primary`,children:u.map(e=>(0,B.jsx)(`span`,{children:e},e))}),u.map((e,t)=>(0,B.jsx)(L,{id:e,type:`source`,position:R.Bottom,style:{left:`${(t+1)*100/(u.length+1)}%`},"aria-label":e},e))]}):i===`decider`?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{className:`mt-1.5 flex items-center justify-between gap-2 text-[9px] font-medium`,children:[(0,B.jsx)(`span`,{className:`text-accent-highlight`,children:r(`builder.branch.continue`)}),(0,B.jsx)(`span`,{className:`text-accent-success`,children:r(`builder.branch.stop`)})]}),(0,B.jsx)(L,{id:`continue`,type:`source`,position:R.Bottom,style:{left:`30%`},className:`!bg-accent-highlight`}),(0,B.jsx)(L,{id:`stop`,type:`source`,position:R.Bottom,style:{left:`70%`},className:`!bg-accent-success`})]}):i===`end`?null:(0,B.jsx)(L,{type:`source`,position:R.Bottom})]})}function bt({loopId:e,onExit:t,onWindowOpened:n}){let{t:o}=a(`loops`),u=i(),{id:d}=r(),h=e??d,g=(0,z.useCallback)(()=>{t?t():u(`/loops`)},[t,u]),_=Se(),{fitView:b,screenToFlowPosition:ne}=De(),{activeProjectId:E}=c(),[D,oe]=(0,z.useState)([]),[O,ue]=(0,z.useState)({}),[pe,me]=(0,z.useState)(!1),[k,he]=(0,z.useState)({}),[ge,A]=(0,z.useState)([]),[M,N]=(0,z.useState)(null),[P,ve]=(0,z.useState)(null);(0,z.useEffect)(()=>{let e=!1;return j.catalog().then(t=>{e||(oe(t.nodeKinds),ue(t.definitionSchema??{}),me(!1))}).catch(()=>{e||me(!0)}),()=>{e=!0}},[]),(0,z.useEffect)(()=>{let e=new AbortController;he({});let t=t=>fetch(t,{signal:e.signal}).then(e=>e.ok?e.json():null).catch(()=>null);return Promise.all([E&&M&&!M.config.agents?t(`${s()}/agent-runtime/config`):Promise.resolve(null),t(`/api/runtime-providers`)]).then(([t,n])=>{e.signal.aborted||he({providers:(t?.config?.providers??n?.providers??[]).map(e=>e.id),roles:[...new Set([...Object.keys(t?.config?.agents??{}),...Object.keys(t?.config?.roles??{}),...Object.keys(t?.workflowRoleDefaults??{})])],models:Object.fromEntries(Object.entries(n?.status??{}).map(([e,t])=>[e,t.models??[]]))})}),()=>e.abort()},[E,!!M,!!M?.config.agents]);let[F,I,Ce]=Ee([]),[L,R,Ne]=Fe([]),[V,ze]=(0,z.useState)(``),[Be,Ve]=(0,z.useState)(!1),[He,Ue]=(0,z.useState)(!1),[We,H]=(0,z.useState)(10),[U,W]=(0,z.useState)(30),[Ye,G]=(0,z.useState)(null),[K,q]=(0,z.useState)(null),[J,Y]=(0,z.useState)(!1);(0,z.useEffect)(()=>Y(!1),[h]);let[Ze,et]=(0,z.useState)(!0),[tt,ot]=(0,z.useState)(!1),[ut,dt]=(0,z.useState)(!1),[vt,bt]=(0,z.useState)(null),[xt,St]=(0,z.useState)(!1),X=(0,z.useMemo)(()=>[...ft(F,L),...ge.map(e=>({severity:`error`,code:`CORE_VALIDATION`,nodeId:e.nodeId,message:e.message}))],[F,L,ge]),Ct=(0,z.useMemo)(()=>pt(X),[X]),wt=X.filter(e=>e.severity===`error`).length,[Ot,kt]=(0,z.useState)(`manual`),At=(0,z.useRef)(new Map),[jt,Mt]=(0,z.useState)([]),[Nt,Pt]=(0,z.useState)(!1),Ft=(0,z.useCallback)(async()=>{try{Mt(await j.loopConstants())}catch{}},[]);(0,z.useEffect)(()=>{Ft()},[Ft]);let It=(0,z.useMemo)(()=>({loop:yt}),[]),Lt=(0,z.useCallback)(e=>{N(e.graph),ve(null);let{nodes:t,edges:n}=it(e.graph);At.current=new Map(t.map(e=>[e.id,{...e.position}]));let r=e.graph.config?.layout,i=r===`vertical`||r===`horizontal`||r===`grid`?r:`manual`;kt(i),I(i===`manual`?t:Pe(t,n,i)),R(n),ze(e.name),H(e.graph.config?.maxIterations??10),W(e.graph.config?.timeoutMinutes??30),G(typeof e.graph.config?.maxCostUsd==`number`?e.graph.config.maxCostUsd:null),Ve(!!e.builtinId)},[I,R]);(0,z.useEffect)(()=>{if(!h)return;let e=!1;return j.get(h).then(t=>{e||Lt(t)}).catch(()=>l.error(o(`errors.load`))).finally(()=>{e||et(!1)}),()=>{e=!0}},[h,Lt,o]);let Rt=(0,z.useCallback)(async()=>{if(h){Ue(!1);try{Lt(await j.restoreBuiltin(h)),A([]),l.success(o(`builder.builtin.restored`))}catch(e){l.error(e instanceof Error&&e.message?e.message:o(`errors.save`))}}},[h,Lt,o]),zt=(0,z.useCallback)(e=>{if(A([]),F.find(t=>t.id===e.source)?.data.kind===`core`){R(t=>Te({...e,label:e.sourceHandle,data:{label:e.sourceHandle}},t));return}let t=e.sourceHandle===`continue`||e.sourceHandle===`stop`?e.sourceHandle:void 0,n=t?{...e,data:{branch:t},style:{stroke:t===`stop`?`var(--color-accent-success)`:`var(--color-accent-highlight)`}}:e;R(e=>Te(n,e))},[R,F]),Bt=(0,z.useCallback)(e=>{if(!e.source||!e.target)return!1;let t=F.find(t=>t.id===e.source)?.data.kind,n=F.find(t=>t.id===e.target)?.data.kind;if(!t||!n||e.source===e.target&&t!==`core`||t===`end`)return!1;if(t===`core`){let t=F.find(t=>t.id===e.source),n=Ke(D.find(e=>e.kind===t.data.coreKind),t.data.params??{},M?.components);if(!e.sourceHandle||!n.includes(e.sourceHandle)||L.some(t=>t.source===e.source&&t.sourceHandle===e.sourceHandle))return!1}return!(t===`start`&&L.some(t=>t.source===e.source)||n===`start`)},[F,L,D,M]),Vt=(0,z.useCallback)(e=>{kt(e==="default"?`manual`:e),I(t=>e==="default"?t.map(e=>{let t=At.current.get(e.id);return t?{...e,position:{...t}}:e}):Pe(t,L,e)),requestAnimationFrame(()=>b({padding:.25,maxZoom:.85,duration:300}))},[I,L,b]),Ht=(0,z.useCallback)(e=>{e.some(e=>e.type===`position`&&e.dragging===!1)&&kt(`manual`),Ce(e)},[Ce]),Ut=(0,z.useRef)(F);Ut.current=F;let Wt=(0,z.useRef)(L);Wt.current=L,(0,z.useEffect)(()=>{let e=()=>{let e=window.document.activeElement;return!!e&&(e.tagName===`INPUT`||e.tagName===`TEXTAREA`||e.isContentEditable)},t=t=>{if(e())return;let n=st(Ut.current,Wt.current);!n||!t.clipboardData||(t.clipboardData.setData(`text/plain`,JSON.stringify(n)),t.preventDefault())},n=t=>{if(e())return;let n=ct(t.clipboardData?.getData(`text/plain`)??``);if(!n)return;t.preventDefault();let r=lt(n,{mintId:nt,offset:{x:40,y:40},excludeKinds:Ut.current.some(e=>e.data.kind===`start`)?[`start`]:[]});r.nodes.length!==0&&(I(e=>[...e.map(e=>({...e,selected:!1})),...r.nodes]),R(e=>[...e,...r.edges]),kt(`manual`),l.success(o(`builder.paste.done`,{count:r.nodes.length})))};return window.addEventListener(`copy`,t),window.addEventListener(`paste`,n),()=>{window.removeEventListener(`copy`,t),window.removeEventListener(`paste`,n)}},[I,R,o]);let Gt=(0,z.useCallback)(e=>{let t=rt(e,{x:120+Math.random()*120,y:80+Math.random()*240});I(e=>[...e,t]),Y(!1),q(t.id)},[I]),Kt=(0,z.useCallback)(e=>{A([]),I(t=>t.map(t=>t.id===K?{...t,data:{...t.data,...e}}:t))},[K,I]),qt=(0,z.useCallback)(()=>{K&&(I(e=>e.filter(e=>e.id!==K)),R(e=>e.filter(e=>e.source!==K&&e.target!==K)),q(null))},[K,I,R]),Z=!!M&&!F.some(e=>![`start`,`core`,`end`].includes(e.data.kind)),Q=(0,z.useCallback)(()=>{let e={...M?.config,maxIterations:We,timeoutMinutes:U,maxCostUsd:Ye??void 0,layout:Ot},t=P?M?.components?.[P]:M,n={...t,...at(F,L,P?t?.config??e:e)};return P?{...M,config:e,components:{...M?.components,[P]:n}}:{...n,components:M?.components}},[M,P,F,L,We,U,Ye,Ot]),Jt=(0,z.useCallback)((e,t=!1)=>{let n=Q();e&&t&&!n.components?.[e]&&(n.components={...n.components,[e]:{nodes:[{id:nt(),type:`start`,position:{x:160,y:40}},{id:nt(),type:`core`,position:{x:160,y:220},data:{kind:`end`,params:{outcome:`success`}}}],edges:[],config:{maxIterations:10,timeoutMinutes:0},inputs:[],outputs:[`next`,`failed`]}});let r=e?n.components?.[e]:n;if(!r)return;let i=it(r);N(n),ve(e),I(i.nodes),R(i.edges),q(null),A([]),requestAnimationFrame(()=>b({padding:.25}))},[Q,I,R,b]),Yt=(0,z.useCallback)((e,t)=>{let n={id:nt(),type:`loop`,position:t??{x:160+F.length*20,y:100+F.length*30},data:Ge(e)};if(e.kind===`role-turn`&&M){let e=k.providers?.[0]??`claude`,t=(`agent-`+n.id.replace(/[^a-z0-9-]/g,`-`)).slice(0,64),r=M.config.agents??{schemaVersion:1,agents:{architect:{provider:e},developer:{provider:e},reviewer:{provider:e}}};n.data.params={roleId:t,prompt:o(`builder.core.agentTaskDefault`)},N({...M,config:{...M.config,agents:{...r,roles:{...r.roles,[t]:{provider:e,access:`write`,artifacts:`none`,prompt:``}}}}})}e.kind===`prompt`&&k.providers?.length&&(n.data.params.engine={provider:k.providers[0]}),I(e=>[...e,n]),Y(!1),q(n.id)},[F.length,I,k.providers,M,o]),Xt=(0,z.useCallback)(async()=>{St(!0);try{let e=Q(),{steps:t}=await j.previewLoop(e);bt(t)}catch{l.error(o(`builder.preview.error`))}finally{St(!1)}},[Q,o]),Zt=(0,z.useCallback)(async()=>{if(!h)return!1;ot(!0);try{let e=Q();return await j.update(h,{name:V,graph:e}),!0}catch(e){return l.error(e instanceof Error&&e.message?e.message:o(`errors.save`)),!1}finally{ot(!1)}},[h,Q,V,o]),Qt=(0,z.useCallback)(async()=>{if(h&&await Zt())try{await j.publish(h),l.success(o(`builder.published`)),g()}catch(e){e instanceof xe?(A(e.errors),dt(!0),l.error(o(`errors.publishInvalid`))):l.error(e instanceof Error&&e.message?e.message:o(`errors.save`))}},[h,Zt,g,o]),$=F.find(e=>e.id===K)??null;return(0,B.jsx)(mt.Provider,{value:Ct,children:(0,B.jsx)(ht.Provider,{value:{pieces:D,components:M?.components},children:(0,B.jsxs)(`div`,{className:`h-full flex flex-col`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-4 h-12 border-b border-border flex-shrink-0`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,B.jsx)(`button`,{type:`button`,onClick:g,className:`text-muted-foreground hover:text-foreground`,"aria-label":o(`builder.back`),children:(0,B.jsx)(f,{className:`w-4 h-4`})}),(0,B.jsx)(`input`,{value:V,onChange:e=>ze(e.target.value),className:`text-sm font-semibold bg-transparent text-foreground border-b border-transparent focus:border-border focus:outline-none min-w-0`,"aria-label":`name`})]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsxs)(se,{delayDuration:150,children:[(0,B.jsxs)(`label`,{className:`text-[10px] text-muted-foreground flex items-center gap-1`,children:[o(`builder.config.maxIterations`),(0,B.jsxs)(ce,{children:[(0,B.jsx)(fe,{asChild:!0,children:(0,B.jsx)(`button`,{type:`button`,onClick:e=>e.preventDefault(),className:`text-muted-foreground/60 hover:text-foreground`,"aria-label":o(`builder.config.maxIterations`),children:(0,B.jsx)(le,{className:`w-3 h-3`})})}),(0,B.jsx)(ye,{className:`max-w-xs leading-relaxed`,children:o(`builder.config.maxIterationsHint`)})]}),(0,B.jsx)(`input`,{type:`number`,min:1,value:We,onChange:e=>H(Math.max(1,Number(e.target.value)||1)),className:`w-14 h-6 text-xs rounded border border-border bg-transparent px-1 text-foreground`})]}),(0,B.jsxs)(`label`,{className:`text-[10px] text-muted-foreground flex items-center gap-1`,children:[o(`builder.config.timeout`),(0,B.jsxs)(ce,{children:[(0,B.jsx)(fe,{asChild:!0,children:(0,B.jsx)(`button`,{type:`button`,onClick:e=>e.preventDefault(),className:`text-muted-foreground/60 hover:text-foreground`,"aria-label":o(`builder.config.timeout`),children:(0,B.jsx)(le,{className:`w-3 h-3`})})}),(0,B.jsx)(ye,{className:`max-w-xs leading-relaxed`,children:o(`builder.config.timeoutHint`)})]}),(0,B.jsx)(`input`,{type:`number`,min:0,"aria-label":o(`builder.config.timeout`),value:U,onChange:e=>W(Math.max(0,Number(e.target.value)||0)),className:`w-14 h-6 text-xs rounded border border-border bg-transparent px-1 text-foreground`})]}),(0,B.jsxs)(`label`,{className:`text-[10px] text-muted-foreground flex items-center gap-1`,children:[o(`builder.config.maxCost`),(0,B.jsxs)(ce,{children:[(0,B.jsx)(fe,{asChild:!0,children:(0,B.jsx)(`button`,{type:`button`,onClick:e=>e.preventDefault(),className:`text-muted-foreground/60 hover:text-foreground`,"aria-label":o(`builder.config.maxCost`),children:(0,B.jsx)(le,{className:`w-3 h-3`})})}),(0,B.jsx)(ye,{className:`max-w-xs leading-relaxed`,children:o(`builder.config.maxCostHint`)})]}),(0,B.jsx)(`input`,{type:`number`,min:0,step:.5,placeholder:`∞`,value:Ye??``,onChange:e=>{let t=Number(e.target.value);G(e.target.value===``||!(t>0)?null:t)},className:`w-16 h-6 text-xs rounded border border-border bg-transparent px-1 text-foreground`})]})]}),Z&&(0,B.jsx)(`button`,{type:`button`,"aria-pressed":J,onClick:()=>Y(e=>!e),className:`inline-flex items-center gap-1.5 h-7 px-2.5 rounded-md text-xs border border-border hover:bg-muted text-foreground`,children:o(`builder.loopSettings`)}),Be&&(0,B.jsxs)(`button`,{type:`button`,onClick:()=>Ue(!0),disabled:tt,"data-testid":`builder-restore-builtin`,className:`inline-flex items-center gap-1.5 h-7 px-2.5 rounded-md text-xs border border-border hover:bg-muted text-foreground disabled:opacity-50`,children:[(0,B.jsx)(y,{className:`w-3 h-3`}),` `,o(`actions.restoreBuiltin`)]}),(0,B.jsxs)(`button`,{type:`button`,onClick:()=>void Xt(),disabled:xt,className:`inline-flex items-center gap-1.5 h-7 px-2.5 rounded-md text-xs border border-border hover:bg-muted text-foreground disabled:opacity-50`,children:[(0,B.jsx)(de,{className:`w-3 h-3`}),` `,o(`builder.preview.label`)]}),!be()&&(0,B.jsxs)(`button`,{type:`button`,disabled:tt,onClick:()=>void Zt().then(async e=>{if(!(!e||!h))try{await _e(E,h),n?n():g()}catch(e){l.error(String(e))}}),className:`inline-flex items-center gap-1.5 h-7 px-2.5 rounded-md text-xs border border-border hover:bg-muted disabled:opacity-50`,children:[(0,B.jsx)(m,{className:`w-3 h-3`}),o(`window.open`)]}),(0,B.jsxs)(`button`,{type:`button`,onClick:()=>void Zt().then(e=>e&&l.success(o(`builder.saved`))),disabled:tt,className:`inline-flex items-center gap-1.5 h-7 px-2.5 rounded-md text-xs border border-border hover:bg-muted text-foreground disabled:opacity-50`,children:[(0,B.jsx)(p,{className:`w-3 h-3`}),` `,o(`builder.save`)]}),(0,B.jsxs)(`button`,{type:`button`,onClick:()=>void Qt(),disabled:tt,className:`inline-flex items-center gap-1.5 h-7 px-2.5 rounded-md text-xs bg-accent-primary text-white hover:bg-accent-primary/90 disabled:opacity-50`,children:[(0,B.jsx)(te,{className:`w-3 h-3`}),` `,o(`builder.publish`)]})]})]}),Be&&(0,B.jsx)(`div`,{role:`note`,"data-testid":`builder-builtin-note`,className:`px-4 py-1.5 border-b border-border bg-accent-info/10 text-[11px] text-accent-info flex-shrink-0`,children:o(`builder.builtin.note`)}),(0,B.jsx)(ae,{open:He,onOpenChange:e=>{e||Ue(!1)},children:(0,B.jsxs)(C,{className:`max-w-sm`,children:[(0,B.jsxs)(ie,{children:[(0,B.jsx)(S,{children:o(`builder.builtin.confirmTitle`)}),(0,B.jsx)(re,{children:o(`builder.builtin.confirmBody`)})]}),(0,B.jsxs)(x,{children:[(0,B.jsx)(T,{variant:`ghost`,onClick:()=>Ue(!1),children:o(`common:actions.cancel`)}),(0,B.jsx)(T,{"data-testid":`builder-restore-confirm`,onClick:()=>void Rt(),children:o(`actions.restoreBuiltin`)})]})]})}),(0,B.jsxs)(`div`,{className:`flex-1 flex min-h-0`,children:[(0,B.jsxs)(`div`,{className:`w-44 border-r border-border p-2 space-y-1 flex-shrink-0 overflow-y-auto`,children:[(0,B.jsx)(`p`,{className:`text-[10px] font-semibold uppercase tracking-wide text-muted-foreground px-1 mb-1`,children:o(`builder.addNode`)}),Z&&pe&&(0,B.jsx)(`p`,{role:`status`,className:`text-xs text-muted-foreground px-1`,children:o(`builder.core.unavailable`)}),Z&&D.length>0&&[`ai`,`verification`,`openspec`,`control`].map(e=>(0,B.jsxs)(`div`,{className:`pt-2`,children:[(0,B.jsx)(`p`,{className:`text-[10px] uppercase text-muted-foreground px-1`,children:o(`builder.core.groups.${e}`)}),D.filter(t=>![`implementation`,`implementation-step`].includes(t.kind)&&qe(t.kind)===e).map(e=>(0,B.jsxs)(`button`,{type:`button`,draggable:!0,onDragStart:t=>{t.dataTransfer.setData(`application/specrails-core-piece`,e.kind),t.dataTransfer.effectAllowed=`copy`},onClick:()=>Yt(e),className:`flex items-center gap-2 w-full min-h-8 px-2 rounded text-left text-xs hover:bg-muted focus-visible:ring-2 focus-visible:ring-accent-primary`,children:[(0,B.jsx)(v,{className:`h-3 w-3 flex-shrink-0`}),o(`builder.core.pieces.${e.kind}`)]},e.kind))]},e)),(Z?[`start`]:gt).map(e=>{let t=_t[e];return(0,B.jsxs)(`button`,{type:`button`,onClick:()=>Gt(e),disabled:e===`start`&&F.some(e=>e.data.kind===`start`),className:`flex items-center gap-2 w-full h-8 px-2 rounded-md text-xs text-muted-foreground hover:text-foreground hover:bg-muted/50`,children:[(0,B.jsx)(t,{className:`w-3.5 h-3.5 flex-shrink-0`}),(0,B.jsx)(`span`,{className:`truncate`,children:o(`builder.nodes.${e}`)}),(0,B.jsx)(v,{className:`w-3 h-3 ml-auto opacity-50`})]},e)})]}),(0,B.jsx)(`div`,{className:`flex-1 min-w-0 relative`,onDragOver:e=>{e.dataTransfer.types.includes(`application/specrails-core-piece`)&&(e.preventDefault(),e.dataTransfer.dropEffect=`copy`)},onDrop:e=>{let t=D.find(t=>t.kind===e.dataTransfer.getData(`application/specrails-core-piece`));!t||!Z||(e.preventDefault(),Yt(t,ne({x:e.clientX,y:e.clientY})))},children:Ze?(0,B.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,B.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`…`})}):(0,B.jsxs)(Oe,{nodes:F,edges:L,onNodesChange:Ht,onEdgesChange:Ne,onConnect:zt,isValidConnection:Bt,onNodeClick:(e,t)=>{Y(!1),q(t.id)},onPaneClick:()=>{Y(!1),q(null)},nodeTypes:It,colorMode:_.scheme===`dark`?`dark`:`light`,fitView:!0,fitViewOptions:{padding:.25,maxZoom:.85},minZoom:.2,defaultEdgeOptions:{type:`smoothstep`,markerEnd:{type:je.ArrowClosed,width:16,height:16}},proOptions:{hideAttribution:!0},children:[Z&&(0,B.jsx)(Ae,{position:`top-center`,children:(0,B.jsxs)(`nav`,{className:`flex items-center gap-1 rounded border border-border bg-card/95 p-1 text-xs`,"aria-label":o(`builder.core.breadcrumbs`),children:[(0,B.jsx)(`button`,{type:`button`,onClick:()=>Jt(null),className:`px-2 py-1 hover:bg-muted`,children:V||o(`builder.core.root`)}),P&&(0,B.jsxs)(`span`,{"aria-current":`page`,children:[`/ `,P]})]})}),(0,B.jsx)(ke,{}),(0,B.jsx)(Me,{}),(0,B.jsx)(we,{pannable:!0,zoomable:!0}),(0,B.jsx)(Ae,{position:`top-left`,children:(0,B.jsx)(`div`,{className:`flex items-center gap-0.5 rounded-md border border-border bg-card/90 backdrop-blur p-0.5`,role:`group`,"aria-label":o(`builder.arrange.label`),children:[[`vertical`,Re],[`horizontal`,Le],[`grid`,Ie],[`default`,y]].map(([e,t])=>{let n=e==="default"?`reset`:e,r=e==="default"?Ot===`manual`:Ot===e;return(0,B.jsx)(`button`,{type:`button`,title:o(`builder.arrange.${n}`),"aria-label":o(`builder.arrange.${n}`),"aria-pressed":r,onClick:()=>Vt(e),className:w(`inline-flex items-center justify-center w-7 h-7 rounded hover:bg-muted`,r?`bg-muted text-accent-primary`:`text-muted-foreground hover:text-foreground`),children:(0,B.jsx)(t,{className:`w-3.5 h-3.5`})},e)})})}),(0,B.jsx)(Ae,{position:`top-right`,children:(0,B.jsx)(se,{delayDuration:150,children:(0,B.jsxs)(ce,{children:[(0,B.jsx)(fe,{asChild:!0,children:(0,B.jsxs)(`button`,{type:`button`,className:`inline-flex items-center gap-1 h-6 px-2 rounded-md text-[10px] border border-border bg-card/90 text-muted-foreground hover:text-foreground backdrop-blur`,children:[(0,B.jsx)(le,{className:`w-3 h-3`}),o(`builder.edgesHelp.label`)]})}),(0,B.jsx)(ye,{className:`max-w-xs leading-relaxed`,children:o(`builder.edgesHelp.body`)})]})})}),X.length>0&&(0,B.jsx)(Ae,{position:`bottom-center`,children:(0,B.jsxs)(`div`,{className:`rounded-md border border-border bg-card/95 backdrop-blur text-xs overflow-hidden max-w-md mb-2`,children:[(0,B.jsxs)(`button`,{type:`button`,onClick:()=>dt(e=>!e),className:w(`flex items-center gap-1.5 w-full px-2.5 py-1.5 font-medium`,wt>0?`text-destructive`:`text-accent-warning`),children:[(0,B.jsx)(ee,{className:`w-3.5 h-3.5`}),o(`builder.problems.count`,{count:X.length})]}),ut&&(0,B.jsx)(`ul`,{className:`border-t border-border max-h-40 overflow-y-auto py-1`,children:X.map((e,t)=>(0,B.jsx)(`li`,{children:(0,B.jsxs)(`button`,{type:`button`,disabled:!e.nodeId,onClick:()=>{e.nodeId&&(Y(!1),q(e.nodeId))},className:`flex items-start gap-1.5 w-full text-left px-2.5 py-1 hover:bg-muted disabled:cursor-default`,children:[(0,B.jsx)(`span`,{className:w(`mt-1 w-1.5 h-1.5 rounded-full flex-shrink-0`,e.severity===`error`?`bg-destructive`:`bg-accent-warning`)}),(0,B.jsx)(`span`,{className:`text-foreground`,children:`message`in e?String(e.message):o(`builder.problems.${e.code}`)})]})},`${e.code}-${e.nodeId??t}`))})]})})]})}),(0,B.jsxs)(`div`,{className:`w-80 border-l border-border p-3 flex-shrink-0 overflow-y-auto space-y-4`,children:[!J&&($?$.data.kind===`core`?(0,B.jsx)($e,{nodeId:$.id,data:$.data,piece:D.find(e=>e.kind===$.data.coreKind),choices:{...k,roles:M?.config.agents?[...Object.keys(M.config.agents.agents),...Object.keys(M.config.agents.roles??{})]:k.roles,components:Object.keys(M?.components??{})},schema:O,onChange:Kt,onDelete:qt,onOpenCanvas:Jt}):(0,B.jsx)(Dt,{data:$.data,onChange:Kt,onDelete:qt,constants:jt,onManageConstants:()=>Pt(!0)}):(0,B.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:o(`builder.inspector.selectNode`)})),!J&&Z&&M&&$&&(Je($.id,$.data.coreKind,$.data.params??{}).length>0||$.data.coreKind===`implementation-step`&&$.data.params?.phase===`archive`)&&(0,B.jsx)(Xe,{mode:$.data.coreKind===`implementation`?`all`:`step`,graph:Q(),value:M.config.agents,selectedRole:String($.data.params?.phase??Je($.id,$.data.coreKind,$.data.params??{})[0]??``),onChange:e=>N({...M,config:{...M.config,agents:e}})},`${h}:${$.id}`),J&&Z&&M&&(0,B.jsx)(Xe,{mode:`workflow`,graph:Q(),value:M.config.agents,selectedRole:$?Je($.id,$.data.coreKind,$.data.params??{})[0]:void 0,onChange:e=>N({...M,config:{...M.config,agents:e}})},h),J&&Z&&M&&(0,B.jsx)(Qe,{graph:M,canvas:P,schema:O,onChange:N,onOpenCanvas:Jt})]})]}),(0,B.jsx)(Tt,{open:Nt,onClose:()=>Pt(!1),constants:jt,onChanged:Ft,t:o}),(0,B.jsx)(Et,{steps:vt,onClose:()=>bt(null),t:o})]})})})}var xt=[{labelKey:`builder.inspector.tokensSpec`,tokens:[{token:`{{spec.title}}`,label:`spec.title`},{token:`{{spec.description}}`,label:`spec.description`},{token:`{{spec.id}}`,label:`spec.id`},{token:`{{spec.status}}`,label:`spec.status`},{token:`{{spec.priority}}`,label:`spec.priority`},{token:`{{spec.labels}}`,label:`spec.labels`}]},{labelKey:`builder.inspector.tokensJira`,tokens:[{token:`{{spec.jira_key}}`,label:`spec.jira_key`},{token:`{{spec.jira_url}}`,label:`spec.jira_url`}]}];function St({token:e,label:t,description:n,onInsert:r}){return(0,B.jsx)(`button`,{type:`button`,draggable:!0,onDragStart:t=>t.dataTransfer.setData(`text/plain`,e),onClick:()=>r(e),title:n?`${e} — ${n}`:e,className:`px-1.5 py-0.5 rounded border border-border bg-surface/40 text-[10px] font-mono text-accent-primary hover:bg-accent-primary/10 cursor-grab active:cursor-grabbing`,children:t})}function X({t:e,onInsert:t}){let[n,r]=(0,z.useState)([]);return(0,z.useEffect)(()=>{let e=!1;return j.loopCommands().then(t=>{e||r(t)}).catch(()=>{}),()=>{e=!0}},[]),(0,B.jsxs)(`div`,{className:`mb-2 space-y-1.5`,children:[xt.map(n=>(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`span`,{className:`block text-[9px] uppercase tracking-wide text-muted-foreground/70 mb-0.5`,children:e(n.labelKey)}),(0,B.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:n.tokens.map(e=>(0,B.jsx)(St,{token:e.token,label:e.label,onInsert:t},e.token))})]},n.labelKey)),n.length>0&&(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`span`,{className:`block text-[9px] uppercase tracking-wide text-muted-foreground/70 mb-0.5`,children:e(`builder.inspector.tokensCommands`)}),(0,B.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:n.map(e=>(0,B.jsx)(St,{token:`{{cmd:${e.name}}}`,label:`⚡ ${e.label}`,description:e.description,onInsert:t},e.name))})]})]})}function Ct({t:e,constants:t,onInsert:n,onManage:r}){return(0,B.jsxs)(`div`,{className:`mb-2`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between mb-0.5`,children:[(0,B.jsx)(`span`,{className:`text-[9px] uppercase tracking-wide text-muted-foreground/70`,children:e(`builder.constants.label`)}),(0,B.jsx)(`button`,{type:`button`,onClick:r,title:e(`builder.constants.manage`),"aria-label":e(`builder.constants.manage`),className:`text-muted-foreground hover:text-foreground`,children:(0,B.jsx)(I,{className:`w-3 h-3`})})]}),(0,B.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:t.map(e=>(0,B.jsx)(St,{token:`{{const:${e.name}}}`,label:e.builtin?`🔒 ${e.name}`:e.name,description:e.value,onInsert:n},e.id))})]})}function wt({c:e,onSave:t,onDelete:n}){let[r,i]=(0,z.useState)(e.value);return(0,B.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,B.jsx)(`code`,{className:`text-[10px] font-mono text-accent-primary w-28 truncate`,title:e.name,children:e.name}),(0,B.jsx)(`input`,{className:`flex-1 text-xs rounded border border-border bg-transparent px-2 py-1 text-foreground`,value:r,onChange:e=>i(e.target.value)}),(0,B.jsx)(`button`,{type:`button`,disabled:r===e.value||!r,onClick:()=>t(r),className:`text-muted-foreground hover:text-foreground disabled:opacity-40`,"aria-label":`save`,children:(0,B.jsx)(p,{className:`w-3.5 h-3.5`})}),(0,B.jsx)(`button`,{type:`button`,onClick:n,className:`text-muted-foreground hover:text-destructive`,"aria-label":`delete`,children:(0,B.jsx)(b,{className:`w-3.5 h-3.5`})})]})}function Tt({open:e,onClose:t,constants:n,onChanged:r,t:i}){let[a,o]=(0,z.useState)(``),[s,c]=(0,z.useState)(``),[l,u]=(0,z.useState)(null),[d,f]=(0,z.useState)(!1),p=n.filter(e=>e.builtin),m=n.filter(e=>!e.builtin),h=async()=>{f(!0),u(null);try{await j.createConstant(a.trim(),s),o(``),c(``),await r()}catch(e){u(e instanceof Error?e.message:`error`)}finally{f(!1)}},g=`text-xs rounded border border-border bg-transparent px-2 py-1 text-foreground focus:outline-none focus:ring-1 focus:ring-accent-primary/40`;return(0,B.jsx)(ae,{open:e,onOpenChange:e=>{e||t()},children:(0,B.jsxs)(C,{className:`max-w-md`,children:[(0,B.jsx)(ie,{children:(0,B.jsx)(S,{children:i(`builder.constants.title`)})}),(0,B.jsxs)(`div`,{className:`space-y-3`,children:[(0,B.jsxs)(`div`,{className:`space-y-1.5`,children:[m.length===0&&(0,B.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:i(`builder.constants.empty`)}),m.map(e=>(0,B.jsx)(wt,{c:e,onSave:t=>void j.updateConstant(e.id,t).then(r),onDelete:()=>void j.deleteConstant(e.id).then(r)},e.id))]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-1.5 border-t border-border pt-2`,children:[(0,B.jsx)(`input`,{className:`${g} w-28`,placeholder:i(`builder.constants.name`),value:a,onChange:e=>o(e.target.value)}),(0,B.jsx)(`input`,{className:`${g} flex-1`,placeholder:i(`builder.constants.value`),value:s,onChange:e=>c(e.target.value)}),(0,B.jsx)(T,{size:`sm`,disabled:d||!a.trim()||!s,onClick:()=>void h(),children:i(`builder.constants.add`)})]}),l&&(0,B.jsx)(`p`,{className:`text-[10px] text-destructive`,children:l}),p.length>0&&(0,B.jsxs)(`div`,{className:`border-t border-border pt-2 space-y-1`,children:[(0,B.jsx)(`span`,{className:`text-[9px] uppercase tracking-wide text-muted-foreground/70`,children:i(`builder.constants.builtinBadge`)}),p.map(e=>(0,B.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[10px]`,children:[(0,B.jsx)(`code`,{className:`font-mono text-accent-primary w-28 truncate`,title:e.name,children:e.name}),(0,B.jsx)(`span`,{className:`text-muted-foreground truncate`,children:e.value})]},e.id))]})]}),(0,B.jsx)(x,{children:(0,B.jsx)(T,{variant:`ghost`,onClick:t,children:i(`common:actions.close`)})})]})})}function Et({steps:e,onClose:t,t:n}){return(0,B.jsx)(ae,{open:e!==null,onOpenChange:e=>{e||t()},children:(0,B.jsxs)(C,{className:`max-w-2xl`,children:[(0,B.jsx)(ie,{children:(0,B.jsx)(S,{children:n(`builder.preview.title`)})}),(0,B.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:n(`builder.preview.sampleNote`)}),(0,B.jsxs)(`div`,{className:`space-y-2 max-h-[60vh] overflow-y-auto`,children:[e&&e.length===0&&(0,B.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n(`builder.preview.empty`)}),e?.map((e,t)=>(0,B.jsxs)(`div`,{className:`rounded-md border border-border`,children:[(0,B.jsxs)(`div`,{className:`px-2.5 py-1 text-[10px] border-b border-border flex items-center gap-1.5`,children:[(0,B.jsx)(`span`,{className:`font-medium text-foreground`,children:e.label||n([`start`,`end`,`ai-step`,`shell`,`decider`,`condition`].includes(e.kind)?`builder.nodes.${e.kind}`:`builder.core.pieces.${e.kind}`)}),(0,B.jsxs)(`span`,{className:`text-muted-foreground`,children:[`· `,n([`start`,`end`,`ai-step`,`shell`,`decider`,`condition`].includes(e.kind)?`builder.nodes.${e.kind}`:`builder.core.pieces.${e.kind}`)]})]}),(0,B.jsx)(`pre`,{className:`px-2.5 py-2 text-[11px] text-foreground whitespace-pre-wrap break-words font-mono`,children:e.text||`—`})]},`${e.nodeId}-${t}`))]}),(0,B.jsx)(x,{children:(0,B.jsx)(T,{variant:`ghost`,onClick:t,children:n(`common:actions.close`)})})]})})}function Dt({data:e,onChange:t,onDelete:n,constants:r,onManageConstants:i}){let{t:o}=a(`loops`),{activeProjectId:s,projects:l}=c(),u=D(l.find(e=>e.id===s)),d=e.kind,f=`block text-[10px] font-medium text-muted-foreground mb-1`,p=`w-full text-xs rounded border border-border bg-transparent px-2 py-1 text-foreground focus:outline-none focus:ring-1 focus:ring-accent-primary/40`,m=(0,z.useRef)(null),h=(0,z.useRef)(null),g=(n,r,i)=>{let a=n.current,o=String(e[r]??``);if(!a){t({[r]:o+i});return}let s=a.selectionStart??o.length,c=a.selectionEnd??o.length;t({[r]:o.slice(0,s)+i+o.slice(c)}),requestAnimationFrame(()=>{a.focus();let e=s+i.length;a.setSelectionRange(e,e)})},_=e=>g(m,`prompt`,e);return(0,B.jsxs)(`div`,{className:`space-y-3`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,B.jsx)(`span`,{className:`text-xs font-semibold text-foreground`,children:o(`builder.nodes.${d}`)}),(0,B.jsx)(`button`,{type:`button`,onClick:n,"aria-label":o(`builder.deleteNode`),className:`text-muted-foreground hover:text-destructive`,children:(0,B.jsx)(b,{className:`w-3.5 h-3.5`})})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`label`,{className:f,children:o(`builder.inspector.label`)}),(0,B.jsx)(`input`,{className:p,value:String(e.label??``),onChange:e=>t({label:e.target.value}),placeholder:o(`builder.nodes.${d}`)})]}),d===`ai-step`&&(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`label`,{className:f,children:o(`builder.inspector.prompt`)}),(0,B.jsx)(X,{t:o,onInsert:_}),(0,B.jsx)(Ct,{t:o,constants:r,onInsert:_,onManage:i}),(0,B.jsx)(`textarea`,{ref:m,rows:7,className:p,value:String(e.prompt??``),onChange:e=>t({prompt:e.target.value})}),(0,B.jsx)(`p`,{className:`text-[10px] text-muted-foreground mt-1`,children:o(`builder.inspector.promptHint`)})]}),d===`shell`&&(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`label`,{className:f,children:o(`builder.inspector.command`)}),(0,B.jsx)(`input`,{className:p,value:String(e.command??``),onChange:e=>t({command:e.target.value}),placeholder:`npm test`}),(0,B.jsxs)(`label`,{className:`${f} mt-3`,children:[o(`common:repositories.shellTarget`),(0,B.jsxs)(`select`,{className:p,value:String(e.repositoryId??``),onChange:e=>t({repositoryId:e.target.value||void 0}),children:[(0,B.jsx)(`option`,{value:``,children:o(`common:repositories.shellDefault`)}),u.filter(e=>e.kind===`git`).map(e=>(0,B.jsx)(`option`,{value:e.id,children:e.name},e.id)),!!e.repositoryId&&!u.some(t=>t.id===e.repositoryId)&&(0,B.jsx)(`option`,{value:String(e.repositoryId),children:String(e.repositoryId)})]})]}),(0,B.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:o(`common:repositories.shellHint`)})]}),d===`decider`&&(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`label`,{className:f,children:o(`builder.inspector.goal`)}),(0,B.jsx)(Ct,{t:o,constants:r,onInsert:e=>g(h,`goal`,e),onManage:i}),(0,B.jsx)(`textarea`,{ref:h,rows:4,className:p,value:String(e.goal??``),onChange:e=>t({goal:e.target.value})})]}),d===`condition`&&(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`label`,{className:f,children:o(`builder.inspector.join`)}),(0,B.jsxs)(`select`,{className:p,value:String(e.join??`AND`),onChange:e=>t({join:e.target.value}),children:[(0,B.jsx)(`option`,{value:`AND`,children:`AND`}),(0,B.jsx)(`option`,{value:`OR`,children:`OR`})]})]}),d===`end`&&(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`label`,{className:f,children:o(`builder.inspector.outcome`)}),(0,B.jsxs)(`select`,{className:p,value:String(e.outcome??`success`),onChange:e=>t({outcome:e.target.value}),children:[(0,B.jsx)(`option`,{value:`success`,children:`success`}),(0,B.jsx)(`option`,{value:`failure`,children:`failure`})]})]}),d===`start`&&(0,B.jsx)(`p`,{className:`text-[10px] text-muted-foreground`,children:o(`builder.inspector.startNote`)})]})}function Ot({loopId:e,onExit:t,onWindowOpened:n}={}){return(0,B.jsx)(Ne,{children:(0,B.jsx)(bt,{loopId:e,onExit:t,onWindowOpened:n})})}export{Ot as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var e=`Motore degli agenti`,t=`Architetto, sviluppatore e revisore girano come fasi separate con verifica deterministica in mezzo. Scegli un fornitore per ruolo; tutto il resto ha un valore predefinito funzionante.`,n=`Caricamento delle impostazioni…`,r=`Impossibile caricare le impostazioni. Riprova prima di modificarle.`,i=`Riprova`,a=`Questa installazione di Core non include il motore degli agenti. Aggiorna Core prima di attivarlo; puoi preparare le impostazioni mentre è disattivato.`,o=`Salva impostazioni`,s=`Salvataggio…`,c=`Impostazioni salvate`,l=`Impossibile salvare le impostazioni.`,u=`Richiedi approvazione prima di completare il flusso`,d={title:`Fornitori`,hint:`I CLI usano l’accesso esistente. Le API accettano solo il nome di una variabile d’ambiente, mai la chiave. Per servizi locali può restare vuoto. Riassegna i ruoli prima di rimuovere il fornitore.`,entry:`Fornitore {{index}}`,id:`ID del fornitore`,kind:`Tipo di connessione`,cli:`CLI di programmazione installato`,compatible:`Endpoint compatibile con OpenAI`,command:`CLI di programmazione`,baseUrl:`URL base dell’API`,apiKeyEnv:`Variabile d’ambiente della chiave (facoltativa)`,remove:`Rimuovi fornitore`,addCli:`Aggiungi fornitore CLI`,addLocal:`Aggiungi fornitore locale / API`,show:`Mostra connessioni dei fornitori`,hide:`Nascondi connessioni dei fornitori`,globalTitle:`Provider di IA`,globalHint:`Due tipi di provider alimentano ogni progetto: le CLI di programmazione rilevate su questa macchina e i motori locali compatibili con OpenAI che registri qui. Assegnali alle fasi della pipeline in Impostazioni del progetto ▸ Motore degli agenti. Le modifiche si applicano alle nuove esecuzioni.`,label:`Nome visualizzato (facoltativo)`,labelPlaceholder:`es. Macchina LAN`,defaultModel:`Modello predefinito`,defaultModelNone:`Nessun predefinito (primo rilevato)`,defaultModelPlaceholder:`ID del modello o alias personalizzato`,customModel:`Alias personalizzato…`,discoveredModels:`Modelli rilevati`,noModels:`Nessun modello rilevato finora: prova la connessione.`,rates:`Tariffe (USD per 1M di token, facoltativo)`,ratesHint:`I costi sono mostrati come stime; lascia entrambe vuote e il costo resta sconosciuto.`,inputRate:`Input per 1M`,outputRate:`Output per 1M`,ratesInvalid:`Inserisci entrambe le tariffe come numeri non negativi, oppure lasciale entrambe vuote.`,reasoningEffort:`L'endpoint accetta lo sforzo di ragionamento`,reasoningEffortHint:`Invia il campo reasoning_effort di OpenAI: lo sforzo configurato del ruolo a ogni chiamata, alzato ad alto mentre l'architetto compatto scrive il piano. Lascialo disattivo se il server non lo rispetta.`,apiKeyEnvMissing:`{{name}} non è impostata nel processo dell'app. Impostala nell'ambiente da cui viene avviata l'app.`,test:`Prova connessione`,testing:`Prova in corso…`,testFailed:`Impossibile provare la connessione.`,rename:`Rinomina`,renameHint:`Rinominando, le assegnazioni dei ruoli continuano a puntare a questa connessione.`,idLocked:`L'id è bloccato dopo il salvataggio. Usa Rinomina per cambiarlo.`,localBadge:`Motore locale`,cliBadge:`CLI`,notDetected:`Non rilevato su questa macchina`,unsaved:`Modifiche non salvate`,empty:`Nessuna connessione ancora. Aggiungi un provider locale / API per iniziare.`,fixBeforeSave:`Correggi i campi evidenziati prima di salvare.`,status:{probing:`Verifica…`,reachable:`Raggiungibile`,unauthorized:`Non autorizzato`,unreachable:`Non raggiungibile`,untested:`Mai provato`},auth:{authenticated:`Accesso effettuato`,unauthenticated:`Accesso non effettuato`,unknown:`Accesso sconosciuto`},agentLoop:`Loop dell'agente`,agentLoopHint:`come la pipeline implement guida questo modello`,agentLoop_compact:`Compatto`,agentLoop_compactHint:`Micro-passi guidati dall'app con output strutturato. Consigliato per modelli sotto ~30B.`,agentLoop_free:`Libero`,agentLoop_freeHint:`Un loop agentico per ruolo, come un provider CLI. Richiede un modello potente.`,contextWindow:`Finestra di contesto (token)`,contextWindowHint:`Allineala alla dimensione di contesto del server (n_ctx / num_ctx). Serve a compattare i vecchi risultati degli strumenti prima di riempire la finestra. Predefinito 32768.`,maxOutput:`Budget di output per turno (token)`,maxOutputHint:`max_tokens di un turno con strumenti; un turno troncato viene ritentato una volta al doppio. Conta dentro la finestra di contesto, quindi è sempre limitato allo spazio rimanente — alzalo se il modello ragiona in privato (il thinking lo consuma). Predefinito 8192.`,reasoningEffortRailHint:`Disattivo: il selettore dello sforzo di ragionamento non compare nell'intestazione del rail per questo motore.`,presetTitle:`Configurazione rapida`,presetSmallModel:`Consigliato per modelli piccoli`,presetSmallModelApplied:`Preset per modelli piccoli applicato`,presetSmallModelHint:`Imposta il loop Compatto, inoltra lo sforzo di ragionamento e una finestra di contesto di 32k: la combinazione validata con modelli da 7–14B. Ogni campo resta modificabile.`,cliGroup:`Strumenti CLI`,cliGroupHint:`Rilevati su questa macchina: usano il proprio accesso, niente da configurare.`,localGroup:`Motori locali`,localGroupHint:`Endpoint compatibili con OpenAI (llama.cpp, Ollama, vLLM, LM Studio…) raggiungibili da questa app.`,models_one:`{{count}} modello`,models_other:`{{count}} modelli`,expand:`Mostra impostazioni`,collapse:`Nascondi impostazioni`,overflow:`Altre azioni`,addLocalHero:`Aggiungi motore locale`,emptyLocalPitch:`Nessun motore locale per ora. Punta l’app a un endpoint compatibile con OpenAI per eseguire la pipeline sul tuo hardware: il costo resta sotto il tuo controllo e nulla esce dalla tua rete.`,defaultsGroup:`Valori predefiniti del provider`},f={claude:`Claude`,codex:`Codex`,gemini:`Gemini`,kimi:`Kimi`},p={architect:`Architetto`,developer:`Sviluppatore`,reviewer:`Revisore`,fixer:`Correttore`,verify:`Verifica`,archive:`Completamento`},m={title:`Assegnazione dei ruoli`,hint:`Ogni ruolo può usare un provider e un modello diversi. Connessioni: Impostazioni generali → Provider di IA. Limite predefinito: {{turns}} turni per agente.`,provider:`Fornitore`,model:`Modello`,modelPlaceholder:`ID del modello o predefinito del CLI`,maxTurns:`Numero massimo di turni (predefinito {{turns}})`,defaultModel:`Predefinito ({{model}})`,thinking:`Ragionamento nascosto`,thinking_off:`Disattivato`,thinking_on:`Attivato`,thinkingHint:`Disattivato per impostazione predefinita: il ragionamento nascosto consuma il budget di output e minuti per turno in un ciclo guidato dall'host. Attivalo per un ruolo che trae vantaggio dalla deliberazione (inviato come chat_template_kwargs.enable_thinking; gli endpoint che non lo conoscono lo ignorano).`},h={title:`Limiti del flusso`,hint:`I campi vuoti usano i valori di Core: {{attempts}} tentativi di correzione e {{minutes}} minuti per passo di ruolo. Sui motori locali il timeout si applica a ogni unità di lavoro (un gruppo di attività, un artefatto, una revisione) — 45 minuti per impostazione predefinita — più un watchdog di inattività di 20 minuti; un passo che esaurisce il tempo blocca l'esecuzione e può riprendere dal gruppo aperto successivo. I limiti di token e USD sono facoltativi; quelli in USD richiedono Claude per ogni ruolo.`,maxAttempts:`Tentativi massimi dello sviluppatore (predefinito {{attempts}})`,timeoutMinutes:`Timeout in minuti (predefinito {{minutes}}; motori locali 45 per gruppo di attività)`,maxTokens:`Token massimi`,maxCostUsd:`Costo massimo (USD)`,unlimited:`Nessun limite`},g={title:`Comandi di verifica`,hint:`Facoltativo. Vengono eseguiti quando lo sviluppatore termina e i fallimenti tornano allo sviluppatore. Lista vuota: l’architetto propone i controlli propri del progetto a ogni esecuzione; i repository senza controllo automatico vengono comunque revisionati.`,detect:`Rileva i controlli del progetto`,detecting:`Rilevamento…`,detected:`Compilato con i controlli che questo progetto già definisce.`,nothingDetected:`Nessun comando di test, controllo tipi o build trovato. Va bene: l’architetto propone controlli a ogni esecuzione quando possibile.`,detectFailed:`Impossibile ispezionare i repository del progetto.`,repository:`Repository`,command:`Comando`,reason:`Rilevato da {{reason}}`,remove:`Rimuovi`,add:`Aggiungi comando`,invalidLine:`Comando di verifica vuoto o con virgolette non chiuse: {{line}}`,label:`Nome del controllo (facoltativo)`,moveUp:`Sposta su`,moveDown:`Sposta giù`},_={title:`Esecuzioni salvate`,refresh:`Aggiorna`,hint:`Continua nel worktree originale con ambito e impostazioni salvati; l’avanzamento compare nel log di quel job. Non pubblica né riavvia la consegna Desktop. Le esecuzioni attive si fermano dai controlli del job.`,empty:`Nessuna esecuzione salvata.`,loadFailed:`Impossibile caricare le esecuzioni.`,actionFailed:`Impossibile aggiornare questa esecuzione.`,phase:`Prossima fase: {{phase}}`,approve:`Approva completamento`,recover:`Recupera fase interrotta`,resume:`Riprendi`,cancel:`Annulla continuazione`,status:{running:`Continuazione in corso…`,succeeded:`Riuscito`,failed:`Fallito`,blocked:`Bloccato`,paused:`In pausa`,cancelled:`Annullato`,interrupted:`Interrotto`,unavailable:`Non disponibile`,expired:`Scaduto`},question:`L'architetto chiede:`,answerLabel:`La tua risposta`,answerPlaceholder:`Rispondi alla domanda; l'architetto prosegue con essa.`,answer:`Rispondi e riprendi`,viewLog:`Visualizza log del job`,implementation:`Implementazione`,preserveProgress:`Riprendi dalla fase indicata, conservando il lavoro e le impostazioni salvate.`,reviewDelivery:`Implementazione completata. Controlla il risultato nel log prima della consegna; questa ripresa non lo ha pubblicato.`,prepareDelivery:`Prepara consegna`,dismiss:`Ignora`,selectRecovery:`Seleziona i tentativi interrotti da riprendere`},v={architect:`Legge il codice e scrive proposta, design, attività e spec. Sola lettura.`,developer:`Implementa le attività con i test. Può modificare file ed eseguire comandi nella sandbox del CLI.`,reviewer:`Controlla il risultato rispetto alla spec e alle prove di verifica. Sola lettura.`},y={title:`Soglia di revisione`,hint:`I campi vuoti usano la soglia di Core. I valori possono solo alzarla: punteggio complessivo almeno {{score}}, sicurezza almeno {{security}}, altri aspetti almeno {{aspect}}.`,minScore:`Punteggio complessivo minimo (predefinito {{score}})`,aspects:{type_correctness:`Correttezza dei tipi (predefinito {{score}})`,pattern_adherence:`Aderenza ai pattern (predefinito {{score}})`,test_coverage:`Copertura dei test (predefinito {{score}})`,security:`Sicurezza (predefinito {{score}})`,architectural_alignment:`Allineamento architetturale (predefinito {{score}})`}},b={title:`Confidenza dell'architetto`,hint:`Dopo un passaggio di indagine autonoma, un progetto ancora poco sicuro si mette in pausa con la domanda dell'architetto oppure procede su ipotesi dichiarate.`,onLowConfidence:`Con bassa confidenza`,ask:`Chiedere (pausa con la domanda)`,proceed:`Procedere su ipotesi dichiarate`},x={title:`Consumo e tempo`,hint:`Include correzioni e chiamate non riuscite. Il tempo degli agenti include gli strumenti. I token della cache fanno parte dei token di input.`,unknown:`Non disponibile`,duration:`Tempo di esecuzione`,agentTime:`Tempo degli agenti`,cost:`Costo dichiarato`,providerCalls:`Chiamate agli agenti`,toolCalls:`Chiamate agli strumenti`,input:`Token di input`,output:`Token di output`,uncached:`Input senza cache`,cacheRead:`Letture della cache`,cacheWrite:`Scritture della cache`,partial:`Alcuni tentativi non hanno misurazioni dettagliate.`,phases:`Consumo per fase`,phase:`Fase`,attempts:`Tentativi`},S={title:`Prompt dei ruoli degli agenti`,description:`Visualizza e modifica le istruzioni di ogni ruolo. Sono condivise da tutti i progetti e provider; le modifiche si applicano ai nuovi lavori. I lavori ripresi mantengono i prompt originali.`,definition:`Definizione di {{role}}`,default:`Impostazione predefinita`,custom:`Personalizzato`,restore:`Ripristina predefinito`,contracts:`Il contesto della spec, il workflow OpenSpec e il formato di risposta richiesto vengono aggiunti automaticamente e non sono modificabili qui.`,invalid:`Ogni definizione deve contenere da 1 a 20.000 caratteri, con testo non vuoto e senza byte nulli.`,saved:`Prompt dei ruoli salvati`,unsaved:`Modifiche non salvate`,discard:`Scarta modifiche`,save:`Salva prompt`,fixerHint:`Usato solo nei giri di correzione: dopo una verifica fallita o una revisione respinta. Gira sul motore dello sviluppatore, salvo che Impostazioni ▸ Motore agenti ▸ Correttore ne indichi uno proprio. Un provider CLI che riprende la sessione dello sviluppatore riceve il breve seguito di correzione; la definizione si applica ogni volta che parte una sessione nuova (motori locali, motore correttore, sessione persa).`},C={title:`Efficienza dell’implementazione`,scope:`Si applica alle nuove esecuzioni. Quelle salvate mantengono configurazione e motore originali.`,effort:`Sforzo di ragionamento`,providerDefault:`Predefinito del fornitore`,unconfirmed:`Non confermato`,unknownSupport:`Il supporto per questo modello e trasporto non è confermato.`,escalation:`Consenti un livello superiore con lo stesso fornitore`,baseRequired:`Seleziona prima un modello base esplicito.`,escalationModel:`Modello di livello superiore`,triggers:{architect:`Solo l’approfondimento già previsto può selezionare questo livello.`,developer:`Dopo due candidati falliti, il tentativo successivo consentito può selezionare questo livello.`,reviewer:`Solo per correggere risposte malformate; il rifiuto del codice non lo attiva.`,fixer:`Solo un giro di correzione può raggiungere questo livello; i primi passaggi non eseguono mai il correttore.`},contextMode:`Contesto del repository`,reviewMode:`Revisione delle correzioni`,planning:`Profondità della pianificazione`,adaptive:`Adattivo`,full:`Completo`,developerChecks:`Accetta controlli aggiuntivi proposti dallo sviluppatore`,concurrency:`Controlli simultanei massimi`,concurrencyHint:`Predefinito: 1. Solo controlli indipendenti dichiarati dall’host in repository diversi possono essere simultanei. Nessun riutilizzo predefinito.`,checkCapabilities:`Verifica compatibilità dei modelli`,capabilitiesFailed:`Compatibilità non confermata. Aggiorna Core o mantieni i valori del fornitore.`},w={title:`Evidenze di verifica`,acceptance:`Accettazione tecnica`,acceptanceStatus:{pending:`In attesa`,validated:`Validato`,"with-exceptions":`Con eccezioni`,blocked:`Bloccato`},calls:`Chiamate agli agenti`,executed:`Controlli eseguiti`,reused:`Controlli riutilizzati`,unknown:`Non disponibile`,unavailable:`Evidenza non disponibile. Il risultato registrato non prova la validità attuale.`,current:`Candidato e piano attuali`,historical:`Risultato storico`,moreChecks:`Altri controlli`,output:`Output della verifica`,empty:`Nessun output`,truncated:`Pagina limitata o acquisizione troncata.`,nextPage:`Pagina successiva`,status:{passed:`Superato`,failed:`Fallito`,cancelled:`Annullato`,interrupted:`Interrotto`},disposition:{executed:`Eseguito`,reused:`Riutilizzato`,"not-run":`Non eseguito`},origin:`Origine`,origins:{host:`Host`,architect:`Architetto`,developer:`Sviluppatore`,"frozen-runtime-config":`Configurazione salvata`,"project-role":`Ruolo del progetto`,default:`Predefinito`,"explicit-launch-override":`Provider scelto per questo avvio`,"loop-role":`Ruolo del loop`},reuseDisabled:`Riutilizzo disabilitato per questo controllo.`,reuseConfirmed:`Riutilizzato dopo la conferma di input e strumenti identici.`,inputsChanged:`Input cambiati durante la verifica; risultato invalidato.`,reuseUnproven:`Nessun risultato attuale con input identici comprovati; controllo rieseguito.`,original:`Esecuzione originale`,requested:`Richiesto`,reported:`Segnalato`},T={title:`Ruoli del loop`,hint:`Motori dei ruoli del loop quando un rail viene lanciato con il motore «Ruoli». I ruoli della pipeline qui sopra (architect, developer, reviewer) provengono già da questa configurazione del runtime.`,verifier:`Verificatore`,verifierHint:`Ogni passo IA del loop esterno al core: verify, fix e passi IA personalizzati.`,decider:`Decisore`,deciderHint:`Il Loop Decider che legge il verdetto e sceglie il passo successivo: un modello economico e veloce è la scelta naturale.`,inherit:`Eredita il principale`,model:`Modello`,effort:`Sforzo di ragionamento`,disabled:`Il runtime degli agenti è disattivato: i rail lanciati con il motore «Ruoli» vengono rifiutati finché non viene attivato.`,saveFailed:`Impossibile salvare i ruoli del loop.`},E={title:`Pipeline di implementazione`,explainer:`Queste fasi vengono eseguite in quest'ordine a ogni implementazione. Quando il motore del rail è "{{roles}}", ogni fase usa il motore configurato qui sotto: provider, modello ed effort diversi per fase. Scegliendo un motore specifico sul rail, tutte le fasi girano su quel motore.`,host:`Host`,noCommand:`nessun comando`,inherits:`Eredita il principale`,inheritsDeveloper:`Eredita dallo sviluppatore`,open:`Apri`,collapse:`Comprimi`,groups:{core:{title:`Pipeline principale`,hint:`Viene eseguita in ogni implementazione: pianificare, costruire, verificare, correggere, revisionare.`},loop:{title:`Passi del loop`,hint:`Passi IA del loop del rail che avvolge l'esecuzione (verificare → decidere → correggere) e dei loop personalizzati; ereditano il motore principale se non impostati.`,chip:`loop del rail`}},phases:{architect:{name:`Architetto`,purpose:`Legge il codice e scrive proposta, design e task.`},developer:{name:`Sviluppatore`,purpose:`Implementa i task con i test.`},verification:{name:`Verifica`,purpose:`L'host esegue i tuoi controlli; i fallimenti tornano allo sviluppatore.`},fixer:{name:`Correttore`,purpose:`Corregge ciò che la verifica o la revisione respingono; eredita dallo sviluppatore se non configurato.`},reviewer:{name:`Revisore`,purpose:`Confronta il risultato con la spec e le evidenze.`},verifier:{name:`Verificatore`,purpose:`Passi IA verify, fix e personalizzati del loop.`},decider:{name:`Decisore`,purpose:`Legge il verdetto e sceglie il prossimo passo del loop.`}}},D={title:`Motore del correttore`,inherit:`Eredita sviluppatore`,own:`Motore proprio`,hint:`Viene eseguito solo nei giri di correzione: dopo una verifica fallita o una revisione respinta; i primi passaggi restano sullo sviluppatore. Un modello più potente o cloud qui conviene quando lo sviluppatore è un modello locale economico.`},O={title:`Guardrail`,intro:`Regole di processo che l'host applica intorno ai modelli locali perché un modello piccolo non deragli. Tutte attive per impostazione predefinita; disattivane una solo per regolare il processo. I provider CLI non sono mai coinvolti.`,unsupported:`Questa installazione di Core non espone guardrail configurabili. Aggiorna Core per regolarli; le regole integrate continuano ad applicarsi.`,active:`{{on}} di {{total}} attivi`,reset:`Ripristina predefiniti`,phases:{architect:`Architetto`,developer:`Sviluppatore`,host:`Host`},unknown:`Un guardrail aggiunto da un Core più recente; questa app non ha ancora una descrizione.`,items:{"plan-validation":{title:`Piano di attività validato`,description:`Rifiuta piani che puntano a openspec/, elencano semplici nomi di file come attività, hanno troppo poche attività/gruppi per la spec o lasciano criteri di accettazione scoperti; l'architetto riprova.`,why:`Un piano vago o incompleto è la causa n. 1 per cui un piccolo modello sviluppatore scrive stub.`},"genuine-blocking-question":{title:`Solo vere domande bloccanti`,description:`L'architetto può mettere in pausa l'esecuzione solo con una vera domanda che termina con '?', mai con testo d'esempio copiato.`,why:`I modelli piccoli ripetono i segnaposto del prompt e bloccherebbero ogni esecuzione.`},"plan-language-hint":{title:`Pianificare nel linguaggio del repository`,description:`Indica all'architetto il linguaggio principale così i nomi dei file delle attività hanno l'estensione giusta.`,why:`Un piano JS su un repo TypeScript rende impossibile spuntare le attività.`},"frozen-plan-writes":{title:`Gli artefatti di pianificazione sono congelati`,description:`Lo sviluppatore non può scrivere sotto openspec/; il piano appartiene all'host.`,why:`I modelli 'implementano' modificando il piano invece del codice.`},"primary-language":{title:`Promemoria del linguaggio principale`,description:`A ogni gruppo di attività viene indicato il linguaggio principale del repository; i nuovi file dovrebbero usarlo.`,why:`Evita una seconda implementazione in un altro linguaggio.`},"duplicate-sibling":{title:`Nessun modulo gemello tra linguaggi`,description:`Rifiuta board.js quando board.ts esiste già; estendi invece il modulo esistente.`,why:`I gemelli compilano entrambi e i test importano quello sbagliato.`},"one-test-per-module":{title:`Un file di test per modulo`,description:`Rifiuta board.tick.test.ts quando esiste board.test.ts; estendilo invece.`,why:`Altrimenti ogni passata di correzione aggiunge una nuova suite.`},"empty-write":{title:`Nessuna sovrascrittura vuota`,description:`Una scrittura vuota su un file con contenuto viene rifiutata; scrivi il contenuto completo o applica una patch.`,why:`Una passata di 'pulizia' una volta lasciò index.ts a 0 righe.`},"evidence-gated-ticking":{title:`Prove prima di spuntare un'attività`,description:`Un'attività che nomina file è completata solo se esistono e non sono stub (estensioni sorelle accettate).`,why:`Senza, 'fatto' è solo un'affermazione e la verifica gira contro il nulla.`},"inventory-retry":{title:`Riprova con l'inventario reale`,description:`Quando il modello rinuncia sostenendo che il repo è vuoto mentre non lo è, riprova una volta con l'elenco dei file.`,why:`Seconda possibilità economica invece di un passo fallito.`},"synthetic-corrections":{title:`Trasformare il feedback in attività`,description:`Quando tutte le attività sono spuntate ma review/verify sono falliti, il feedback diventa attività di correzione concrete.`,why:`Altrimenti lo sviluppatore risponde 'già fatto' e nulla cambia.`},"silent-group-closure":{title:`Chiudere i gruppi silenziosi, conservare i loro file`,description:`Un gruppo il cui modello smette di rispondere viene chiuso accreditando i file scritti e lasciando aperte le sue attività, invece di far fallire l'esecuzione.`,why:`Un modello 9B scrisse cinque moduli, tacque e l'intera esecuzione fallì.`},"environment-repair":{title:`L'host ripara l'ambiente`,description:`Dipendenze o strumenti di test mancanti (npm install, ts-jest, @types/jest, moduli di config Jest) vengono installati dall'host, poi la verifica viene rieseguita una volta.`,why:`Il modello non può sistemare l'ambiente e brucia correzioni provandoci.`},"lockfile-repair":{title:`Scartare i lockfile scritti a mano`,description:`Un package-lock.json inventato dal modello (EINTEGRITY/ETARGET) viene rimosso e l'installazione ritentata una volta.`,why:`Gli hash inventati non si installano mai.`},"verify-idle-timeout":{title:`Fermare i test bloccati`,description:`Un comando di verifica senza output per 5 minuti viene fermato e segnalato come probabile blocco (ultimo output incluso).`,why:`Altrimenti un ciclo while in un test trattiene l'esecuzione fino al limite di 15 minuti.`},"verify-per-group":{title:`Verifica dopo ogni gruppo`,description:`Esegue il comando di test del repository subito dopo ogni gruppo di attività; un errore riceve un giro di correzione immediato finché il contesto del gruppo è fresco.`,why:`Cinque suite rotte alla fine sono molto più difficili da sistemare di una alla volta.`},"test-reachability":{title:`Ogni nuovo test deve essere eseguito davvero`,description:"Un file di test scritto dal developer che il comando di test del repository non esegue mai (uno script `test` che enumera e salta il file nuovo) fa fallire la verifica indicando il file esatto, prima a livello di gruppo e poi di nuovo nella verifica dell'host.",why:`Una suite di 622 righe con sei casi falliti è passata in verde perché nessuno l'aveva mai eseguita.`},"exit-code-honesty":{title:`Diffidare di un exit 0 che segnala fallimenti`,description:`Un comando di verifica che esce con 0 mentre l'output stampa fallimenti (righe \`FAIL:\`, "3 failed", un AssertionError) è trattato come FALLITO e passato al correttore con l'harness indicato come difetto.`,why:`Un runner di test artigianale che non impostava mai un exit code diverso da zero ha consegnato tre test rossi come verdi.`}}},k=`Modifiche non salvate`,A={title:`Ruoli personalizzati`,hint:`Definisci istruzioni riutilizzabili e autorizzazioni esplicite per i ruoli del flusso.`,unsupported:`Aggiorna Core per modificare i ruoli personalizzati.`,remove:`Rimuovi {{id}}`,access:`Accesso al codice`,read:`Sola lettura`,write:`Lettura e scrittura`,artifacts:`Accesso agli artefatti OpenSpec`,none:`Nessuno`,tasks:`Solo caselle delle attività`,all:`Tutti gli artefatti della modifica`,skill:`Skill OpenSpec`,noSkill:`Nessuno skill associato`,prompt:`Istruzioni del ruolo`,id:`ID del ruolo`,add:`Aggiungi ruolo`,invalidId:`Usa un ID univoco in minuscolo che inizi con una lettera, con un massimo di 64 lettere, numeri o trattini. Gli ID integrati sono riservati.`,escalationHint:`Solo una correzione consentita del protocollo può usare il modello superiore. Non viene aggiunto alcun tentativo.`},j={title:`Istruzioni di esecuzione`,hint:`Core conserva queste istruzioni per il prossimo turno di agente compatibile. L’invio non risponde alle domande e non concede approvazioni.`,label:`Istruzioni aggiuntive`,send:`Invia istruzioni`,accepted:`Ricevute da Core; in attesa di utilizzo.`,pending:`In attesa di un turno di agente`,consumed:`Utilizzate da un agente`,counts:`In attesa: {{pending}} · Utilizzate: {{consumed}}`,failed:`Impossibile inviare le istruzioni. Riprova per confermare lo stesso messaggio.`,unavailable:`I dettagli delle ricevute non sono disponibili.`,unreported:`Questa versione di Core non segnala l’utilizzo.`,truncated:`Sono mostrate solo le ricevute recenti e i messaggi in attesa.`},M={title:`Valori predefiniti del ruolo Core`,hint:`Questi valori del file si applicano ai nuovi workflow. Le impostazioni esplicite del progetto hanno la precedenza; le esecuzioni salvate mantengono le impostazioni fissate.`,invalid:`Correggi l’intestazione YAML nell’editor prima di modificare i campi del ruolo.`,escalationEffort:`Sforzo di ragionamento del modello superiore`},N={title:`Conservazione della cronologia`,description:`Elimina le cronologie scadute e le versioni di Core inutilizzate. Le cronologie eliminate non possono essere riprese o biforcate. Le esecuzioni attive o recuperabili e le consegne in sospeso restano protette; i log e i costi vengono conservati.`,forever:`Conserva la cronologia indefinitamente`,days:`Giorni di conservazione`,save:`Salva conservazione`,preview:`Anteprima pulizia`,collect:`Elimina cronologia scaduta`,previewSummary:`Idonei: {{runs}} cronologie e {{packages}} versioni di Core inutilizzate.`,collectedSummary:`Scadute: {{runs}} cronologie. Rimosse: {{packages}} versioni di Core inutilizzate.`,more:`{{count}} esecuzioni aggiuntive.`,failed:`Impossibile consultare o aggiornare la conservazione.`,expired:`Questa cronologia è scaduta secondo la politica del progetto. Il log e la contabilità restano disponibili.`,loading:`Caricamento della politica…`,states:{protected:`Conservato`,eligible:`Idoneo`,expired:`Scaduto`,cleanup_pending:`Pulizia in sospeso`,busy:`In uso`,error:`Verifica non riuscita`},reasons:{disabled:`Conservazione indefinita`,recoverable:`Recupero ancora disponibile`,active:`Esecuzione attiva`,human_pending:`In attesa di risposta umana`,interrupted_writes:`Scritture interrotte da verificare`,delivery_pending:`Consegna in sospeso`,fork_pending:`Resta una biforcazione dipendente`,unknown_terminal_time:`Data di completamento sconosciuta`,within_retention:`Periodo di conservazione non scaduto`}},P={title:`Loop agents`,hint:`These definitions are shared by every project using this loop. Duplicate the loop to customize a separate workflow.`,legacy:`This saved loop still uses historical project agents. Import them or enable loop agents before changing its configuration.`,enable:`Use loop agents`,import:`Import current project agents`,restoreDefinition:`Restore default definition`,default:`Provider default`,effort:`Reasoning effort`,escalationModel:`Escalation model`,escalationEffort:`Escalation effort`,policy:`Workflow policy`,maxAttempts:`Maximum correction attempts`,maxTokens:`Token budget`,maxCostUsd:`Cost budget (USD)`,timeoutMs:`Run timeout (ms)`,projectHint:`Configure repository checks here. Agent definitions, models and workflow policy are configured in the loop editor. Historical project agents can be imported into a duplicated loop.`,showUnused:`Also show agents not used in this loop`,stepTitle:`Step agent and options`,stepHint:`Edit this step’s agent definition and engine. Steps using the same role in this loop share these settings.`,inheritProvider:`Eredita il provider della missione`},F={title:e,description:t,loading:n,loadFailed:r,retry:i,unavailable:a,save:o,saving:s,saved:c,saveFailed:l,approvalBeforeArchive:u,providers:d,cliNames:f,roles:p,agents:m,limits:h,verification:g,runs:_,roleHints:v,review:y,architect:b,metrics:x,prompts:S,efficiency:C,evidence:w,loopRoles:T,pipeline:E,fixer:D,guardrails:O,unsavedChanges:k,customRoles:A,steering:j,studioRole:M,retention:N,loopAgents:P};export{m as agents,u as approvalBeforeArchive,b as architect,f as cliNames,A as customRoles,F as default,t as description,C as efficiency,w as evidence,D as fixer,O as guardrails,h as limits,r as loadFailed,n as loading,P as loopAgents,T as loopRoles,x as metrics,E as pipeline,S as prompts,d as providers,N as retention,i as retry,y as review,v as roleHints,p as roles,_ as runs,o as save,l as saveFailed,c as saved,s as saving,j as steering,M as studioRole,e as title,a as unavailable,k as unsavedChanges,g as verification};
|