specrails-desktop 2.59.2 → 2.60.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.
Files changed (177) hide show
  1. package/client/dist/assets/{ActivityFeedPage-vAY9C71W.js → ActivityFeedPage-3J7fR8yB.js} +1 -1
  2. package/client/dist/assets/{AgentBrowserCapture-CpwjGXQm.js → AgentBrowserCapture-D4a3wYM1.js} +1 -1
  3. package/client/dist/assets/{AgentModeAnalyticsPane-BHeoJVxQ.js → AgentModeAnalyticsPane-Dps30tk9.js} +2 -2
  4. package/client/dist/assets/{AgentModeCodePane-B0Nf3YkN.js → AgentModeCodePane-CvLimey8.js} +2 -2
  5. package/client/dist/assets/{AgentModeJobsPane-CpbIItY_.js → AgentModeJobsPane-25tQlLpF.js} +1 -1
  6. package/client/dist/assets/{AgentsPage-BVJAFXn3.js → AgentsPage-CUDp_sfw.js} +2 -2
  7. package/client/dist/assets/{AnalyticsPage-DDWees-K.js → AnalyticsPage-DXWMGn8b.js} +1 -1
  8. package/client/dist/assets/{CodePage-CzV5tkvS.js → CodePage-D981zRHy.js} +1 -1
  9. package/client/dist/assets/{DesktopAnalyticsPage-DfRHNK7i.js → DesktopAnalyticsPage-BkFBq0E6.js} +1 -1
  10. package/client/dist/assets/{DocsDialog-BxduBYbh.js → DocsDialog-BL7uSbIJ.js} +1 -1
  11. package/client/dist/assets/{DocsPage-DOVeRJn_.js → DocsPage-CsDLbmZX.js} +1 -1
  12. package/client/dist/assets/{ExportDropdown-BnKVV8UK.js → ExportDropdown-B4Olg1Fk.js} +1 -1
  13. package/client/dist/assets/{InteractiveJobComposer-Da9dvM-0.js → InteractiveJobComposer-Z6fl4791.js} +2 -2
  14. package/client/dist/assets/JobDetailModal-DS_Owxs6.js +1 -0
  15. package/client/dist/assets/JobDetailPage-1TUQ9vlE.js +1 -0
  16. package/client/dist/assets/{JobsPage-0vdlbNik.js → JobsPage-BSrl8P7u.js} +1 -1
  17. package/client/dist/assets/LoopBuilderPage-Dh5uk2Qy.js +1 -0
  18. package/client/dist/assets/{LoopPreviewModal-Df-S8NGf.js → LoopPreviewModal-CH1r-KhU.js} +1 -1
  19. package/client/dist/assets/{LoopWindowSurface-sdb7QbSo.js → LoopWindowSurface-CiZdI6aw.js} +1 -1
  20. package/client/dist/assets/{LoopsPage-CDfCC9Px.js → LoopsPage-BwFujdGi.js} +1 -1
  21. package/client/dist/assets/{MinimizedChatsContext-DKlPf54Y.js → MinimizedChatsContext-BD2bsRBe.js} +1 -1
  22. package/client/dist/assets/PluginsPage-B8f49Mvn.js +2 -0
  23. package/client/dist/assets/{ProjectSettingsDialog-DOkjT7xv.js → ProjectSettingsDialog-D7q-O6h3.js} +1 -1
  24. package/client/dist/assets/{RepositoryDeliveries-CJVpOUpZ.js → RepositoryDeliveries-NNorcGzT.js} +1 -1
  25. package/client/dist/assets/{RepositoryScopeSelector-BeM-2gIZ.js → RepositoryScopeSelector-D-jb4bI_.js} +1 -1
  26. package/client/dist/assets/{ReviewPacketPage-EBCim2w_.js → ReviewPacketPage-DpZSzF-Q.js} +1 -1
  27. package/client/dist/assets/{TemplatePreviewModal-1-92UGwN.js → TemplatePreviewModal-5CZdAZ0G.js} +1 -1
  28. package/client/dist/assets/{TicketDetailModalContext-CkVXuHxU.js → TicketDetailModalContext-BHmtj1As.js} +1 -1
  29. package/client/dist/assets/{Trans-CzhPjnjB.js → Trans-wmTUDVyC.js} +1 -1
  30. package/client/dist/assets/{agentRuntime-TXPQowKJ.js → agentRuntime-7Ydcvr6P.js} +1 -1
  31. package/client/dist/assets/{agentRuntime-Bpx3yWHK.js → agentRuntime-BHVw9orA.js} +1 -1
  32. package/client/dist/assets/{agentRuntime-15Pkk6we.js → agentRuntime-DCPDaQcV.js} +1 -1
  33. package/client/dist/assets/{agentRuntime-C78n13To.js → agentRuntime-DKTw4Ajg.js} +1 -1
  34. package/client/dist/assets/{agentRuntime-CCI7XF4c.js → agentRuntime-DVhij_i_.js} +1 -1
  35. package/client/dist/assets/{agentRuntime-Ddqvp2bP.js → agentRuntime-Doss-T8o.js} +1 -1
  36. package/client/dist/assets/{agentRuntime-CKDHe2-a.js → agentRuntime-eZSMUlkM.js} +1 -1
  37. package/client/dist/assets/{agentRuntime-hqZRy08E.js → agentRuntime-qSSU7fQk.js} +1 -1
  38. package/client/dist/assets/agents-B6ZsnARo.js +1 -0
  39. package/client/dist/assets/agents-BORdhe0K.js +1 -0
  40. package/client/dist/assets/agents-C6aq9Oqs.js +1 -0
  41. package/client/dist/assets/agents-Cbsc4bcX.js +1 -0
  42. package/client/dist/assets/agents-D0uYR6hq.js +1 -0
  43. package/client/dist/assets/agents-Doe1sHY5.js +1 -0
  44. package/client/dist/assets/agents-DyNi_I9m.js +1 -0
  45. package/client/dist/assets/agents-StKxiTg0.js +1 -0
  46. package/client/dist/assets/agentstudio-7cYCXn-L.js +1 -0
  47. package/client/dist/assets/{agentstudio-QdAJIDef.js → agentstudio-BHWQh8G3.js} +1 -1
  48. package/client/dist/assets/agentstudio-BjnWHyRs.js +1 -0
  49. package/client/dist/assets/{agentstudio-fLXpRGIi.js → agentstudio-BkV8vcK4.js} +1 -1
  50. package/client/dist/assets/{agentstudio-BWAKeGgB.js → agentstudio-BzugqB_N.js} +1 -1
  51. package/client/dist/assets/{agentstudio-Cja8Sjcp.js → agentstudio-CWbp7KvH.js} +1 -1
  52. package/client/dist/assets/agentstudio-DG6plf5o.js +1 -0
  53. package/client/dist/assets/agentstudio-DkZVF-Cc.js +1 -0
  54. package/client/dist/assets/{formatDistanceToNow-DlQaXc7c.js → formatDistanceToNow-Dax4zqPF.js} +1 -1
  55. package/client/dist/assets/{getTimezoneOffsetInMilliseconds-DxUFGcVq.js → getTimezoneOffsetInMilliseconds-dpIo42JZ.js} +1 -1
  56. package/client/dist/assets/{index-Czov72g7.js → index-g8S62tpS.js} +7 -7
  57. package/client/dist/assets/jira-B6OYw4CJ.js +1 -0
  58. package/client/dist/assets/jira-BTF6RaOe.js +1 -0
  59. package/client/dist/assets/jira-CEetIB2q.js +1 -0
  60. package/client/dist/assets/jira-CIzsZLw5.js +1 -0
  61. package/client/dist/assets/{jira-BOoaUXbb.js → jira-Cq6yvN4q.js} +1 -1
  62. package/client/dist/assets/jira-Daw9tmpI.js +1 -0
  63. package/client/dist/assets/jira-FXr7u2lh.js +1 -0
  64. package/client/dist/assets/jira-LaNQn7yl.js +1 -0
  65. package/client/dist/assets/{jira-api-CbJvbRYx.js → jira-api-CLrIvXFm.js} +1 -1
  66. package/client/dist/assets/{jobs-DZAbh1m2.js → jobs-ARwD85B9.js} +1 -1
  67. package/client/dist/assets/{jobs-BD47Ov11.js → jobs-BMF1w4WT.js} +1 -1
  68. package/client/dist/assets/{jobs-tWjcDF_6.js → jobs-CBfzGLwm.js} +1 -1
  69. package/client/dist/assets/{jobs-CSrRx5lD.js → jobs-CPjiluBY.js} +1 -1
  70. package/client/dist/assets/{jobs-epP7gt8W.js → jobs-CQQd58pY.js} +1 -1
  71. package/client/dist/assets/{jobs-1G3wodhl.js → jobs-De3EqaO0.js} +1 -1
  72. package/client/dist/assets/{jobs-BLOoVRRl.js → jobs-Du9-Ei9a.js} +1 -1
  73. package/client/dist/assets/{jobs-B4pu8TdF.js → jobs-qMHbnxwC.js} +1 -1
  74. package/client/dist/assets/{project-repositories-BkBD3rxx.js → project-repositories-BkyT8AjU.js} +1 -1
  75. package/client/dist/assets/{spending-CYotH-9N.js → spending-Oov7p52A.js} +1 -1
  76. package/client/dist/assets/{useDesktop-DpxVGfUC.js → useDesktop-DpiS8Uov.js} +1 -1
  77. package/client/dist/assets/{useRuntimeRuns-CfGRbhr9.js → useRuntimeRuns-DBm1mul0.js} +1 -1
  78. package/client/dist/assets/{useSharedWebSocket-C17TGqT8.js → useSharedWebSocket-BZxKaVNT.js} +2 -2
  79. package/client/dist/index.html +19 -19
  80. package/docs/getting-started.md +2 -2
  81. package/docs/guide/de/agents/1-meet-the-agents.md +1 -1
  82. package/docs/guide/de/agents/2-profiles-and-the-balanced-default.md +1 -1
  83. package/docs/guide/de/agents/3-customizing-models-per-agent.md +1 -1
  84. package/docs/guide/de/agents/4-custom-agents-catalog.md +3 -3
  85. package/docs/guide/en/agents/1-meet-the-agents.md +1 -1
  86. package/docs/guide/en/agents/2-profiles-and-the-balanced-default.md +1 -1
  87. package/docs/guide/en/agents/3-customizing-models-per-agent.md +1 -1
  88. package/docs/guide/en/agents/4-custom-agents-catalog.md +3 -3
  89. package/docs/guide/es/agents/1-meet-the-agents.md +1 -1
  90. package/docs/guide/es/agents/2-profiles-and-the-balanced-default.md +1 -1
  91. package/docs/guide/es/agents/3-customizing-models-per-agent.md +1 -1
  92. package/docs/guide/es/agents/4-custom-agents-catalog.md +3 -3
  93. package/docs/guide/fr/agents/1-meet-the-agents.md +1 -1
  94. package/docs/guide/fr/agents/2-profiles-and-the-balanced-default.md +1 -1
  95. package/docs/guide/fr/agents/3-customizing-models-per-agent.md +1 -1
  96. package/docs/guide/fr/agents/4-custom-agents-catalog.md +3 -3
  97. package/docs/guide/it/agents/1-meet-the-agents.md +1 -1
  98. package/docs/guide/it/agents/2-profiles-and-the-balanced-default.md +1 -1
  99. package/docs/guide/it/agents/3-customizing-models-per-agent.md +1 -1
  100. package/docs/guide/it/agents/4-custom-agents-catalog.md +3 -3
  101. package/docs/guide/ja/agents/1-meet-the-agents.md +1 -1
  102. package/docs/guide/ja/agents/2-profiles-and-the-balanced-default.md +1 -1
  103. package/docs/guide/ja/agents/3-customizing-models-per-agent.md +1 -1
  104. package/docs/guide/ja/agents/4-custom-agents-catalog.md +3 -3
  105. package/docs/guide/pt/agents/1-meet-the-agents.md +1 -1
  106. package/docs/guide/pt/agents/2-profiles-and-the-balanced-default.md +1 -1
  107. package/docs/guide/pt/agents/3-customizing-models-per-agent.md +1 -1
  108. package/docs/guide/pt/agents/4-custom-agents-catalog.md +3 -3
  109. package/docs/guide/zh/agents/1-meet-the-agents.md +1 -1
  110. package/docs/guide/zh/agents/2-profiles-and-the-balanced-default.md +1 -1
  111. package/docs/guide/zh/agents/3-customizing-models-per-agent.md +1 -1
  112. package/docs/guide/zh/agents/4-custom-agents-catalog.md +3 -3
  113. package/docs/internals/adding-a-provider.md +7 -6
  114. package/docs/internals/configuration.md +45 -0
  115. package/docs/internals/core-runtime-updates.md +19 -0
  116. package/docs/internals/loop-step-log-explorer.md +27 -0
  117. package/docs/internals/mission-rail-cards.md +7 -0
  118. package/docs/internals/profiles.md +17 -10
  119. package/docs/internals/review-packet.md +1 -1
  120. package/docs/internals/safe-pr-review-flow.md +9 -0
  121. package/docs/internals/source-map.md +6 -2
  122. package/docs/jira-integration-plan.md +7 -4
  123. package/docs/running-pipelines.md +2 -2
  124. package/package.json +1 -1
  125. package/server/dist/core-compat.js +7 -3
  126. package/server/dist/core-execution.js +5 -18
  127. package/server/dist/jira/jira-db.js +33 -6
  128. package/server/dist/jira/jira-materializer.js +11 -9
  129. package/server/dist/jira/jira-status-resolver.js +64 -22
  130. package/server/dist/jira/jira-sync-manager.js +40 -1
  131. package/server/dist/jira-router.js +8 -41
  132. package/server/dist/mcp/guide.js +4 -3
  133. package/server/dist/modules/agent-runtime/runtime/agent-runtime-bridge.js +22 -70
  134. package/server/dist/modules/agent-runtime/runtime/agent-runtime-controls.js +7 -4
  135. package/server/dist/modules/agent-runtime/runtime/agent-runtime-settings.js +24 -1
  136. package/server/dist/modules/agent-runtime/runtime/agent-runtime-verification-log.js +252 -0
  137. package/server/dist/modules/agents/runtime/profiles-router.js +74 -36
  138. package/server/dist/modules/delivery/runtime/rail-relaunch.js +10 -2
  139. package/server/dist/modules/execution/runtime/queue-manager.js +7 -9
  140. package/server/dist/modules/loops/runtime/loop-agents.js +2 -5
  141. package/server/dist/modules/loops/runtime/loop-command-catalog.js +5 -5
  142. package/server/dist/modules/loops/runtime/loop-definition.js +1 -1
  143. package/server/dist/modules/loops/runtime/loop-executors.js +0 -2
  144. package/server/dist/modules/loops/runtime/loop-implement-recipe.js +5 -4
  145. package/server/dist/modules/loops/runtime/loop-run-manager.js +5 -3
  146. package/server/dist/modules/loops/runtime/loops-router.js +3 -1
  147. package/server/dist/path-resolver.js +41 -20
  148. package/server/dist/project-env.js +22 -6
  149. package/server/dist/providers/gemini-agent-ack.js +13 -10
  150. package/server/dist/setup-manager.js +28 -43
  151. package/server/dist/util/checkout-path.js +22 -0
  152. package/server/dist/workspace-manager.js +13 -71
  153. package/server/dist/worktree-node-modules.js +70 -34
  154. package/client/dist/assets/JobDetailModal-DhwKbZGe.js +0 -1
  155. package/client/dist/assets/JobDetailPage-MtPE-E_1.js +0 -1
  156. package/client/dist/assets/LoopBuilderPage-DCUHozXh.js +0 -1
  157. package/client/dist/assets/PluginsPage-iL0G3rQQ.js +0 -2
  158. package/client/dist/assets/agents-CA5eT1d0.js +0 -1
  159. package/client/dist/assets/agents-CAgy-5uS.js +0 -1
  160. package/client/dist/assets/agents-CNm6Qzlv.js +0 -1
  161. package/client/dist/assets/agents-CTwbx-fb.js +0 -1
  162. package/client/dist/assets/agents-DEGV1Vao.js +0 -1
  163. package/client/dist/assets/agents-HsDF1aQU.js +0 -1
  164. package/client/dist/assets/agents-IQjdA-z9.js +0 -1
  165. package/client/dist/assets/agents-RkGoteXh.js +0 -1
  166. package/client/dist/assets/agentstudio-B2CTtQgZ.js +0 -1
  167. package/client/dist/assets/agentstudio-DtfPcr99.js +0 -1
  168. package/client/dist/assets/agentstudio-X70BKf6u.js +0 -1
  169. package/client/dist/assets/agentstudio-qXKqVnWS.js +0 -1
  170. package/client/dist/assets/jira-BNZu8f9O.js +0 -1
  171. package/client/dist/assets/jira-BYVN4L2u.js +0 -1
  172. package/client/dist/assets/jira-CKJg3HZd.js +0 -1
  173. package/client/dist/assets/jira-DDDsZ4ub.js +0 -1
  174. package/client/dist/assets/jira-DXwYjVE4.js +0 -1
  175. package/client/dist/assets/jira-Dn6U2nRW.js +0 -1
  176. package/client/dist/assets/jira-j7hVolR5.js +0 -1
  177. package/server/dist/modules/loops/runtime/loop-agent-defaults.json +0 -6
@@ -52,6 +52,7 @@ exports.linkNodeModulesIntoWorktree = linkNodeModulesIntoWorktree;
52
52
  const fs = __importStar(require("fs"));
53
53
  const path = __importStar(require("path"));
54
54
  const worktree_overlay_1 = require("./worktree-overlay");
55
+ const checkout_path_1 = require("./util/checkout-path");
55
56
  /** Package-dir discovery depth: 0 = repo root, 1 = `client/`-style children. */
56
57
  const MAX_DEPTH = 2;
57
58
  /** Name of the dependency directory this module links. */
@@ -122,24 +123,43 @@ function resolveRealPath(target) {
122
123
  return path.resolve(target);
123
124
  }
124
125
  }
126
+ /** Destination ancestors must be local directories, never links into another
127
+ * checkout. Missing directories can be created during preparation. */
128
+ function hasLocalParents(worktreePath, rel) {
129
+ let parent = worktreePath;
130
+ for (const segment of rel.split('/').slice(0, -1)) {
131
+ parent = path.join(parent, segment);
132
+ try {
133
+ if (!fs.lstatSync(parent).isDirectory())
134
+ return false;
135
+ }
136
+ catch (error) {
137
+ if (error.code !== 'ENOENT')
138
+ return false;
139
+ }
140
+ }
141
+ return true;
142
+ }
125
143
  /**
126
144
  * Prove one worktree-relative path is an app-created warm-dependency link and
127
145
  * fingerprint it. Returns null for anything that is not EXACTLY a symlink whose
128
- * target resolves to the base checkout's identically-named directory — a real
146
+ * target resolves to the registered source's corresponding entry — a real
129
147
  * directory, a dereferencing copy, a dangling link, or a link into some other
130
148
  * tree are all unauthorized and must keep preserving the worktree.
131
149
  */
132
- function authenticateWarmLink(baseRepo, worktreePath, rel) {
150
+ function authenticateWarmLink(baseRepo, worktreePath, rel, sourceRel = rel) {
151
+ if (!hasLocalParents(worktreePath, rel))
152
+ return null;
133
153
  const dest = path.join(worktreePath, ...rel.split('/'));
134
154
  try {
135
155
  if (!fs.lstatSync(dest).isSymbolicLink())
136
156
  return null;
137
157
  const target = path.resolve(path.dirname(dest), fs.readlinkSync(dest));
138
- const expected = path.join(baseRepo, ...rel.split('/'));
158
+ const expected = path.join(baseRepo, ...sourceRel.split('/'));
139
159
  if (resolveRealPath(target) !== resolveRealPath(expected))
140
160
  return null;
141
- // A link to something that is not a live directory proves nothing about the
142
- // base checkout's dependency tree.
161
+ // A dangling link proves nothing about the source dependency tree (entries
162
+ // include both package directories and files such as Yarn's install state).
143
163
  if (!exists(target))
144
164
  return null;
145
165
  }
@@ -195,39 +215,49 @@ function discoverWorktreeDependencyPaths(worktreePath) {
195
215
  * — the link target anchored to a directory the app controls.
196
216
  */
197
217
  function authenticateWarmNodeModulesLinks(baseRepo, worktreePath) {
198
- const evidence = [];
199
- for (const rel of discoverWorktreeDependencyPaths(worktreePath)) {
200
- const legacy = authenticateWarmLink(baseRepo, worktreePath, rel);
201
- if (legacy) {
202
- evidence.push(legacy);
218
+ const evidence = new Map();
219
+ const prefix = (0, checkout_path_1.checkoutSubdirectory)(baseRepo);
220
+ // Retained mounts may still contain the former misplaced layout. Keep its
221
+ // exact source proof, without moving it or broadening cleanup to directories.
222
+ for (const destinationPrefix of prefix ? [prefix, ''] : ['']) {
223
+ const project = (rel) => destinationPrefix ? `${destinationPrefix}/${rel}` : rel;
224
+ if (!hasLocalParents(worktreePath, project(DEPS_DIR)))
203
225
  continue;
204
- }
205
- const dest = path.join(worktreePath, rel);
206
- try {
207
- if (!fs.lstatSync(dest).isDirectory())
226
+ const destinationRoot = path.join(worktreePath, destinationPrefix);
227
+ const authenticate = (sourceRel) => authenticateWarmLink(baseRepo, worktreePath, project(sourceRel), sourceRel);
228
+ for (const rel of discoverWorktreeDependencyPaths(destinationRoot)) {
229
+ const legacy = authenticate(rel);
230
+ if (legacy) {
231
+ evidence.set(legacy.path, legacy);
208
232
  continue;
209
- for (const name of fs.readdirSync(dest)) {
210
- if (exports.WORKTREE_DEPENDENCY_CACHES.includes(name))
211
- continue;
212
- const entryRel = `${rel}/${name}`;
213
- const entry = authenticateWarmLink(baseRepo, worktreePath, entryRel);
214
- if (entry) {
215
- evidence.push(entry);
233
+ }
234
+ const dest = path.join(destinationRoot, rel);
235
+ try {
236
+ if (!fs.lstatSync(dest).isDirectory())
216
237
  continue;
217
- }
218
- // Scoped package parents are local too; never follow foreign symlinks.
219
- if (name.startsWith('@') && fs.lstatSync(path.join(dest, name)).isDirectory()) {
220
- for (const scoped of fs.readdirSync(path.join(dest, name))) {
221
- const child = authenticateWarmLink(baseRepo, worktreePath, `${entryRel}/${scoped}`);
222
- if (child)
223
- evidence.push(child);
238
+ for (const name of fs.readdirSync(dest)) {
239
+ if (exports.WORKTREE_DEPENDENCY_CACHES.includes(name))
240
+ continue;
241
+ const entryRel = `${rel}/${name}`;
242
+ const entry = authenticate(entryRel);
243
+ if (entry) {
244
+ evidence.set(entry.path, entry);
245
+ continue;
246
+ }
247
+ // Scoped package parents are local too; never follow foreign symlinks.
248
+ if (name.startsWith('@') && fs.lstatSync(path.join(dest, name)).isDirectory()) {
249
+ for (const scoped of fs.readdirSync(path.join(dest, name))) {
250
+ const child = authenticate(`${entryRel}/${scoped}`);
251
+ if (child)
252
+ evidence.set(child.path, child);
253
+ }
224
254
  }
225
255
  }
226
256
  }
257
+ catch { /* Unreadable or concurrently removed entries confer no authority. */ }
227
258
  }
228
- catch { /* Unreadable or concurrently removed entries confer no authority. */ }
229
259
  }
230
- return evidence;
260
+ return [...evidence.values()];
231
261
  }
232
262
  function linkDependencyEntry(source, destination) {
233
263
  fs.symlinkSync(source, destination, process.platform === 'win32'
@@ -262,13 +292,19 @@ function linkNodeModulesIntoWorktree(baseRepo, worktreePath) {
262
292
  const result = { linked: [], authenticated: [], evidence: [], warnings: [] };
263
293
  if (!isWorktreeNodeModulesEnabled())
264
294
  return result;
295
+ const prefix = (0, checkout_path_1.checkoutSubdirectory)(baseRepo);
265
296
  for (const pkgRel of discoverPackageDirs(baseRepo)) {
266
- const rel = pkgRel === '' ? DEPS_DIR : `${pkgRel}/${DEPS_DIR}`;
267
- const src = path.join(baseRepo, ...rel.split('/'));
297
+ const sourceRel = pkgRel === '' ? DEPS_DIR : `${pkgRel}/${DEPS_DIR}`;
298
+ const rel = prefix ? `${prefix}/${sourceRel}` : sourceRel;
299
+ const src = path.join(baseRepo, ...sourceRel.split('/'));
268
300
  if (!isDir(src))
269
301
  continue;
302
+ if (!hasLocalParents(worktreePath, rel)) {
303
+ result.warnings.push(`failed to prepare ${rel}: destination parent is not a local directory`);
304
+ continue;
305
+ }
270
306
  const dest = path.join(worktreePath, ...rel.split('/'));
271
- const legacy = authenticateWarmLink(baseRepo, worktreePath, rel);
307
+ const legacy = authenticateWarmLink(baseRepo, worktreePath, rel, sourceRel);
272
308
  if (!exists(dest) || legacy) {
273
309
  let staging;
274
310
  let removedLegacy = false;
@@ -280,7 +316,7 @@ function linkNodeModulesIntoWorktree(baseRepo, worktreePath) {
280
316
  if (legacy) {
281
317
  // Recheck immediately before removing the old link. Never unlink a
282
318
  // directory or a replacement another actor installed in the meantime.
283
- const current = authenticateWarmLink(baseRepo, worktreePath, rel);
319
+ const current = authenticateWarmLink(baseRepo, worktreePath, rel, sourceRel);
284
320
  if (!current || current.digest !== legacy.digest)
285
321
  throw new Error('dependency link changed during preparation');
286
322
  fs.unlinkSync(dest);
@@ -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{t as r}from"./react-dom-DiWzBDP9.js";import{a as i,c as a,l as o,m as s}from"./useSharedWebSocket-C17TGqT8.js";import{n as c}from"./createLucideIcon-Bjbbp_KS.js";import{a as l,s as u}from"./useDesktop-DpxVGfUC.js";import{dt as d,gt as f}from"./TicketDetailModalContext-CkVXuHxU.js";import{a as p,i as m,n as h,o as g,r as _,s as v,t as ee}from"./InteractiveJobComposer-Da9dvM-0.js";import{t as te}from"./loader-circle-DcygOQpC.js";import{t as ne}from"./x-CBMI9ejn.js";import{F as re,I as ie,P as ae}from"./dialog-CMgps2MY.js";import{t as oe}from"./formatDistanceToNow-DlQaXc7c.js";import{t as y}from"./button-D1xExSTF.js";import{G as se,J as b,W as x}from"./index-Czov72g7.js";import{n as S,t as C}from"./job-time-BCL7wee9.js";var ce=e(r(),1),w=e(t(),1),T=[1e3,2e3,4e3,8e3,16e3];function E(e,t){let[n,r]=(0,w.useState)(`connecting`),o=(0,w.useRef)(t);return o.current=t,(0,w.useEffect)(()=>{let t=!1,n=!1,s=null,c=0,l=null;async function u(){if(!(t||n||s)){n=!0;try{await a()}catch{}finally{n=!1}!t&&!s&&f()}}function d(){if(t)return;l!==null&&clearTimeout(l),r(`connecting`);let e=T[c++]??3e4;l=setTimeout(()=>{l=null,u()},e)}function f(){if(t||s)return;let n=i(),a;try{a=n?new WebSocket(e,[`specrails-desktop`,n]):new WebSocket(e)}catch{d();return}s=a,r(`connecting`),a.onopen=()=>{t||s!==a||(c=0,r(`connected`))},a.onmessage=e=>{if(!(t||s!==a))try{o.current(JSON.parse(e.data))}catch{}},a.onclose=()=>{t||s!==a||(s=null,d())}}let p=()=>{t||s||(l!==null&&clearTimeout(l),l=null,u())};return window.addEventListener(`online`,p),window.addEventListener(`focus`,p),f(),()=>{t=!0,window.removeEventListener(`online`,p),window.removeEventListener(`focus`,p),l!==null&&clearTimeout(l);let e=s;if(s=null,e){e.onopen=null,e.onmessage=null,e.onclose=null,e.onerror=null;try{e.close()}catch{}}}},[e]),{connectionStatus:n}}var D=n();function O({jobId:e,onClose:t,projectId:n}){let[r,i]=(0,w.useState)(e);(0,w.useEffect)(()=>{i(e)},[e]);let{t:a}=c(`jobs`),{t:T}=c(`narration`),O=(0,w.useCallback)(()=>n?`${o}/api/projects/${n}`:l(),[n]),[k,le]=(0,w.useState)(h),ue=(0,w.useCallback)(e=>{le(e),_(e)},[]),[A,j]=(0,w.useState)(null),[M,N]=(0,w.useState)([]),[P,F]=(0,w.useState)([]),[I,L]=(0,w.useState)({}),[R,z]=(0,w.useState)(!0),[B,V]=(0,w.useState)(!1),[H,U]=(0,w.useState)(!1),[W,G]=(0,w.useState)(!1);(0,w.useEffect)(()=>{async function e(){try{let e=await fetch(`${O()}/jobs/${r}`);if(e.status===404){V(!0);return}if(!e.ok)throw Error(`Failed to fetch job`);let t=await e.json();if(j(t.job),N(t.events),t.phaseDefinitions){F(t.phaseDefinitions);let e={};for(let n of t.phaseDefinitions)e[n.key]=`idle`;L(e)}}catch{V(!0)}finally{z(!1)}}e()},[r,O]);let K=(0,w.useCallback)(()=>{fetch(`${O()}/jobs/${r}`).then(e=>e.ok?e.json():null).then(e=>{e?.job&&j(e.job)}).catch(()=>{})},[r,O]),q=(0,w.useRef)([]),J=(0,w.useRef)(null),Y=(0,w.useCallback)(()=>{J.current=null;let e=q.current;e.length!==0&&(q.current=[],N(t=>{let n=[...t,...e];return n.length>1e4?n.slice(n.length-8e3):n}))},[]);(0,w.useEffect)(()=>()=>{J.current&&cancelAnimationFrame(J.current)},[]),E(f,(0,w.useCallback)(e=>{let t=e;if(t.type===`event`&&t.jobId===r){let e={id:Date.now(),job_id:r,seq:0,event_type:t.event_type,source:t.source,payload:t.payload,timestamp:t.timestamp};q.current.push(e),J.current||=requestAnimationFrame(Y)}else if(t.type===`log`&&t.processId===r){let e={id:Date.now(),job_id:r,seq:0,event_type:`log`,source:t.source,payload:JSON.stringify({line:t.line}),timestamp:t.timestamp};q.current.push(e),J.current||=requestAnimationFrame(Y)}else if(t.type===`job.finalized`&&t.jobId===r||t.type===`runtime.continuation`&&t.jobId===r||t.type===`job.interactive`&&t.jobId===r||(t.type===`loop.run_paused`||t.type===`loop.run_resumed`)&&t.loopRunId===r)K();else if(t.type===`phase`){let e=t.phase,n=t.state;L(t=>({...t,[e]:n}))}else if(t.type===`queue`){let e=t.jobs?.find(e=>e.id===r);e&&A&&j(t=>t&&{...t,status:e.status})}},[r,A,Y,K])),(0,w.useEffect)(()=>{function e(e){if(!(e.key!==`Escape`||e.defaultPrevented)){if(H){U(!1);return}t()}}return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[t,H]);let X=A?se(A):`job`,Z=X===`loop-run`;async function de(){G(!0);try{let e=await x({projectId:n??null,jobId:r,kind:X});e.ok?(u.success(a(Z?`modal.toast.stopSignalSent`:`modal.toast.cancelSignalSent`),{description:a(Z?`modal.toast.stopSignalSentDescription`:`modal.toast.cancelSignalSentDescription`)}),K()):u.error(a(`modal.toast.cancelFailed`),{description:e.error})}finally{G(!1)}}let fe=A?.status===`running`,Q=A?S(C(A)):null,{panelRef:pe,panelStyle:$,headerHandleProps:me,resizeHandles:he,isFloating:ge,guardBackdrop:_e}=re();return(0,ce.createPortal)((0,D.jsx)(b,{delayDuration:400,children:(0,D.jsxs)(`div`,{style:ie(),className:`fixed inset-0 z-[65] flex items-stretch justify-center p-[clamp(12px,2vmin,24px)]`,children:[(0,D.jsx)(`div`,{className:`absolute inset-0 bg-black/50 backdrop-blur-sm`,onClick:_e(t)}),(0,D.jsxs)(`div`,{ref:pe,className:`relative w-full min-w-0 rounded-xl glass-card border border-border/30 flex flex-col animate-in fade-in zoom-in-95 duration-200 overflow-hidden`,style:$,children:[(0,D.jsxs)(`div`,{...me,className:`flex items-center justify-between px-4 py-3 border-b border-border/30${ge?` cursor-grab active:cursor-grabbing`:``}`,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0`,children:[A&&(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`code`,{className:`text-xs font-mono text-foreground/80 truncate`,children:A.command}),(0,D.jsx)(`span`,{className:`text-[10px] text-muted-foreground shrink-0`,children:Q?oe(Q,{addSuffix:!0,locale:s()}):`—`})]}),R&&(0,D.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:a(`common:states.loading`)})]}),(0,D.jsx)(`button`,{onClick:t,className:`h-7 w-7 shrink-0 flex items-center justify-center rounded-md text-muted-foreground hover:text-foreground hover:bg-surface/50 transition-colors cursor-pointer`,children:(0,D.jsx)(ne,{className:`w-4 h-4`})})]}),A&&(0,D.jsx)(v,{onOpenRun:i,job:A,events:M,phases:I,phaseDefinitions:P,projectId:n,variant:`glass`,actions:fe?(0,D.jsxs)(y,{variant:`ghost`,size:`sm`,onClick:()=>U(!0),disabled:W,className:`h-7 text-destructive hover:text-destructive hover:bg-destructive/10`,children:[W&&(0,D.jsx)(te,{className:`w-3.5 h-3.5 mr-1.5 animate-spin`,"aria-hidden":!0}),a(Z?`dashboard:railControls.stop`:X===`interactive`?`common:actions.discard`:`common:actions.cancel`)]}):null}),(0,D.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden relative`,children:B?(0,D.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,D.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:a(`modal.notFound`)})}):d&&A?(0,D.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[(0,D.jsx)(`div`,{className:`flex items-center gap-1 border-b border-border/40 px-3 py-1.5`,children:[`narrated`,`log`].map(e=>(0,D.jsx)(`button`,{type:`button`,onClick:()=>ue(e),"aria-pressed":k===e,"data-testid":`modal-narration-mode-${e}`,className:`rounded-md px-2 py-0.5 text-[11px] font-medium transition-colors ${k===e?`bg-accent-primary/15 text-accent-primary`:`text-muted-foreground hover:bg-surface/60`}`,children:T(e===`narrated`?`modeNarrated`:`modeLog`)},e))}),(0,D.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:k===`narrated`?(0,D.jsx)(m,{events:M,settled:A.status!==`running`&&A.status!==`queued`,elapsedMs:A.duration_ms??null,variant:`glass`}):A.command.startsWith(`loop:`)?(0,D.jsx)(p,{events:M,jobStatus:A.status,isLoading:R,variant:`glass`,projectId:n,onOpenRun:i}):(0,D.jsx)(g,{events:M,isLoading:R,projectId:n})})]}):A?.command.startsWith(`loop:`)?(0,D.jsx)(p,{events:M,jobStatus:A.status,isLoading:R,variant:`glass`,projectId:n,onOpenRun:i}):(0,D.jsx)(g,{events:M,isLoading:R,projectId:n})}),!!A?.interactive&&A.status===`running`&&(0,D.jsx)(ee,{jobId:r,projectId:n,settleMode:A.interactiveSettleMode,initialAcceptingTurns:A.interactiveAcceptingTurns,pendingInterrupts:A.pendingInterrupts,kind:A.command.startsWith(`loop:`)?`loop-step`:`job`,variant:`glass`,onFinalized:K})]}),(0,D.jsx)(ae,{handles:he}),H&&(0,D.jsxs)(`div`,{"data-testid":`job-cancel-confirm`,className:`absolute inset-0 z-10 flex items-center justify-center p-4`,children:[(0,D.jsx)(`div`,{className:`absolute inset-0 bg-black/60 backdrop-blur-sm`,onClick:()=>U(!1)}),(0,D.jsxs)(`div`,{className:`relative w-full max-w-sm rounded-xl glass-card border border-border/30 p-5 shadow-xl animate-in fade-in zoom-in-95 duration-150`,children:[(0,D.jsx)(`h3`,{className:`text-base font-semibold text-foreground`,children:a(Z?`modal.stopRunConfirmTitle`:`modal.cancelConfirmTitle`)}),(0,D.jsx)(`p`,{className:`mt-1.5 text-sm text-muted-foreground`,children:a(Z?`modal.stopRunConfirmDescription`:`modal.cancelConfirmDescription`)}),(0,D.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,D.jsx)(y,{variant:`ghost`,size:`sm`,onClick:()=>U(!1),children:a(`modal.keepRunning`)}),(0,D.jsx)(y,{variant:`destructive`,size:`sm`,onClick:()=>{U(!1),de()},children:a(Z?`modal.stopRun`:X===`interactive`?`common:actions.discard`:`modal.cancelJob`)})]})]})]})]})}),document.body)}export{O as JobDetailModal};
@@ -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,n as i,u as a}from"./chunk-KS7C4IRE-DEKu087k.js";import{m as o,r as ee}from"./useSharedWebSocket-C17TGqT8.js";import{n as s}from"./createLucideIcon-Bjbbp_KS.js";import{a as c,r as te,s as l}from"./useDesktop-DpxVGfUC.js";import{dt as u,n as ne}from"./TicketDetailModalContext-CkVXuHxU.js";import{n as d}from"./save-OsUqVn99.js";import{c as f}from"./MinimizedChatsContext-DKlPf54Y.js";import{n as re}from"./file-text-BcLCfcWZ.js";import{a as p,c as ie,i as ae,n as oe,o as m,r as se,s as ce,t as le}from"./InteractiveJobComposer-Da9dvM-0.js";import{t as ue}from"./download-CFHyyHcw.js";import{t as de}from"./rotate-ccw-Wh4id13q.js";import{t as h}from"./utils-BC4DHlz2.js";import{t as fe}from"./formatDistanceToNow-DlQaXc7c.js";import{t as g}from"./button-D1xExSTF.js";import{K as _,Nt as v,W as pe,Y as y,q as b}from"./index-Czov72g7.js";import{t as me}from"./format-command-C0D9IPmV.js";var x=e(t(),1),S=n(),C=4;function he({tickets:e,onTicketClick:t}){let{t:n}=s(`jobs`),[r,i]=(0,x.useState)(!1);if(e.length===0)return null;let a=e.length>=C&&!r?e.slice(0,1):e,o=e.length-a.length;return(0,S.jsxs)(`div`,{className:`rounded-xl border border-border/40 bg-card/40 px-4 py-3 space-y-1.5`,children:[a.map(e=>(0,S.jsx)(w,{ticket:e,onClick:()=>t(e.id)},e.id)),o>0&&(0,S.jsxs)(`button`,{type:`button`,onClick:()=>i(!0),className:`flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors`,children:[n(`ticketHeader.showMore`,{count:o}),(0,S.jsx)(d,{className:`w-3 h-3`})]}),r&&e.length>=C&&(0,S.jsxs)(`button`,{type:`button`,onClick:()=>i(!1),className:`flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors`,children:[n(`ticketHeader.showLess`),(0,S.jsx)(f,{className:`w-3 h-3`})]})]})}function w({ticket:e,onClick:t}){let{t:n}=s(`jobs`),r=e.title==null,i=`inline-flex items-center px-1.5 py-0.5 rounded-md text-[11px] font-mono tabular-nums shrink-0`;return r?(0,S.jsx)(`div`,{className:`flex items-center gap-2 min-w-0`,children:(0,S.jsx)(`span`,{className:h(i,`text-muted-foreground bg-muted/20 select-none`),title:n(`ticketHeader.deletedTooltip`),children:n(`ticketHeader.deletedTicket`,{id:e.id})})}):(0,S.jsxs)(`button`,{type:`button`,onClick:t,className:`flex items-center gap-2 min-w-0 w-full text-left group`,title:e.title??void 0,children:[(0,S.jsxs)(`span`,{className:h(i,`text-accent-primary bg-accent-primary/10 group-hover:bg-accent-primary/20 transition-colors`),children:[`#`,e.id]}),(0,S.jsx)(`span`,{className:`text-lg font-semibold text-foreground truncate group-hover:text-accent-primary transition-colors`,children:e.title})]})}function T(){let{t:e}=s(`jobs`),{t}=s(`narration`),{id:n}=r(),{activeProjectId:d,projects:f}=te(),C=f.find(e=>e.id===d)?.provider,w=a(),{openTicketDetail:T}=ne(),[E,D]=(0,x.useState)(null),[O,k]=(0,x.useState)([]),[ge,A]=(0,x.useState)([]),[_e,j]=(0,x.useState)({}),[ve,M]=(0,x.useState)([]),[ye,N]=(0,x.useState)(!0),[be,P]=(0,x.useState)(!1),[F,xe]=(0,x.useState)(oe),[Se,I]=(0,x.useState)(null),Ce=(0,x.useCallback)(e=>{xe(e),se(e)},[]),L=E?.command??null;(0,x.useEffect)(()=>{if(!u||F!==`narrated`||!d||!L)return;let e=!1,t=`command=${encodeURIComponent(L)}`;try{Promise.resolve(fetch(`${c()}/run-duration-range?${t}`)).then(e=>e&&e.ok?e.json():null).then(t=>{e||I(t?.range??null)}).catch(()=>{e||I(null)})}catch{I(null)}return()=>{e=!0}},[d,L,F]);let[R,z]=(0,x.useState)(!1),B=(0,x.useRef)(!1),V=(0,x.useRef)(null);(0,x.useEffect)(()=>{B.current=!1,V.current=null,z(!1)},[n]),(0,x.useEffect)(()=>{if(!n)return;let e=new AbortController;D(null),k([]),A([]),j({}),N(!0),P(!1);async function t(){try{let t=await fetch(`${c()}/jobs/${n}`,{signal:e.signal});if(t.status===404){P(!0);return}if(!t.ok)throw Error(`Failed to fetch job`);let r=await t.json();D(r.job),k(r.events)}catch(e){if(e.name===`AbortError`)return;P(!0)}finally{e.signal.aborted||N(!1)}}return t(),()=>e.abort()},[n,d]),(0,x.useEffect)(()=>{if(!E?.pipeline_id){M([]);return}let e=E.pipeline_id;fetch(`${c()}/pipelines/${e}`).then(e=>e.ok?e.json():null).then(e=>{e?.jobs&&M(e.jobs)}).catch(()=>{})},[E?.pipeline_id,E?.status]);let H=(0,x.useRef)(d);H.current=d;let U=(0,x.useRef)(null);U.current=E?.status??null;let W=(0,x.useRef)([]),G=(0,x.useRef)(null),K=(0,x.useCallback)(()=>{G.current=null;let e=W.current;e.length!==0&&(W.current=[],k(t=>{let n=[...t,...e];return n.length>1e4?n.slice(n.length-8e3):n}))},[]),q=(0,x.useCallback)(e=>{let t=W.current;t.push(e),t.length>1e4&&(W.current=t.slice(-8e3)),G.current||=requestAnimationFrame(K)},[K]);(0,x.useEffect)(()=>()=>{G.current&&cancelAnimationFrame(G.current)},[]);let J=(0,x.useCallback)(e=>{let t=e;if(!(H.current&&t.projectId&&t.projectId!==H.current)){if(t.type===`init`){let e=t.phaseDefinitions??[];A(e);let n={};for(let r of e)n[r.key]=t.phases?.[r.key]??`idle`;j(n)}else if(t.type===`event`&&t.jobId===n){let e={id:Date.now(),job_id:n??``,seq:t.seq??0,event_type:t.event_type,source:t.source,payload:t.payload,timestamp:t.timestamp};q(e)}else if(t.type===`log`&&t.processId===n){let e={id:Date.now(),job_id:n??``,seq:0,event_type:`log`,source:t.source,payload:JSON.stringify({line:t.line}),timestamp:t.timestamp};q(e)}else if(t.type===`job.finalized`&&t.jobId===n||t.type===`runtime.continuation`&&t.jobId===n||t.type===`job.interactive`&&t.jobId===n||(t.type===`loop.run_paused`||t.type===`loop.run_resumed`)&&t.loopRunId===n)fetch(`${c()}/jobs/${n}`).then(e=>e.json()).then(e=>D(e.job)).catch(()=>{});else if(t.type===`phase`){let e=t.phase,n=t.state;j(t=>({...t,[e]:n}))}else if(t.type===`queue`){let e=t.jobs?.find(e=>e.id===n);if(e){let t=e.status,r=U.current;D(e=>e&&{...e,status:t}),(t===`completed`||t===`failed`||t===`canceled`||t===`running`&&r!==`running`)&&fetch(`${c()}/jobs/${n}`).then(e=>e.json()).then(e=>D(e.job)).catch(()=>{})}}}},[n,q]),{registerHandler:Y,unregisterHandler:X}=ee();(0,x.useEffect)(()=>(Y(`job-detail-${n}`,J),()=>X(`job-detail-${n}`)),[n,J,Y,X]),(0,x.useEffect)(()=>{if(!n||!E||E.status!==`running`||E.hasTelemetry)return;let e=setInterval(()=>{fetch(`${c()}/jobs/${n}`).then(e=>e.ok?e.json():null).then(e=>{e?.job?.hasTelemetry&&D(e=>e&&{...e,hasTelemetry:!0})}).catch(()=>{})},8e3);return()=>clearInterval(e)},[n,E?.status,E?.hasTelemetry]);async function we(){if(!n)return;let t=await pe({projectId:null,jobId:n});t.ok?l.success(e(`detail.toast.cancelSignalSent`),{description:e(`detail.toast.cancelSignalSentDescription`)}):t.httpStatus===null?l.error(e(`detail.toast.networkError`)):l.error(e(`detail.toast.failed`),{description:t.error})}async function Te(){if(E)try{let t=await fetch(`${c()}/jobs/${E.id}/diagnostic`);if(!t.ok){let n=await t.json().catch(()=>({}));throw Error(n.error??e(`detail.toast.exportFailedHttp`,{status:t.status}))}let n=await t.blob(),r=URL.createObjectURL(n),i=new Date().toISOString().slice(0,10),a=document.createElement(`a`);a.href=r,a.download=`specrails-diagnostic-${E.id}-${i}.zip`,document.body.appendChild(a),a.click(),a.remove(),URL.revokeObjectURL(r)}catch(t){l.error(e(`detail.toast.exportFailed`),{description:t.message})}}async function Ee(){if(!(!E||B.current)){B.current=!0,z(!0),V.current||=typeof globalThis.crypto?.randomUUID==`function`?globalThis.crypto.randomUUID():`rerun-${E.id}-${Date.now()}-${Math.random().toString(36).slice(2)}`;try{let t=await fetch(`${c()}/spawn`,{method:`POST`,headers:{"Content-Type":`application/json`,"Idempotency-Key":V.current},body:JSON.stringify({rerunOfJobId:E.id})}),n=await t.json();if(!t.ok)throw Error(n.error??e(`detail.toast.spawnFailed`));V.current=null,l.success(e(`detail.toast.jobRequeued`)),w(`/jobs/${n.jobId}`)}catch(e){l.error(e.message)}finally{B.current=!1,z(!1)}}}if(ye)return(0,S.jsx)(`div`,{className:`max-w-5xl mx-auto px-4 py-6`,children:(0,S.jsxs)(`div`,{className:`space-y-3`,children:[(0,S.jsx)(`div`,{className:`h-4 w-48 bg-muted/30 rounded animate-pulse`}),(0,S.jsx)(`div`,{className:`h-20 bg-muted/30 rounded-lg animate-pulse`}),(0,S.jsx)(`div`,{className:`h-64 bg-muted/30 rounded-lg animate-pulse`})]})});if(be||!E)return(0,S.jsxs)(`div`,{className:`max-w-5xl mx-auto px-4 py-6 flex flex-col items-center gap-3 mt-12`,children:[(0,S.jsx)(`p`,{className:`text-lg font-semibold`,children:e(`detail.notFound`)}),(0,S.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`detail.notFoundDescription`,{id:n})}),(0,S.jsx)(g,{asChild:!0,variant:`outline`,size:`sm`,children:(0,S.jsxs)(i,{to:`/`,children:[(0,S.jsx)(v,{className:`w-3.5 h-3.5 mr-1.5`}),e(`detail.backToDashboard`)]})})]});let Z=E.status===`running`,De=E.status===`completed`||E.status===`failed`,Q=!!E.interactive,Oe=Q&&Z,ke=(E.tickets?.length??0)>0,$=E.command.startsWith(`loop:`),Ae=ie(ve);return(0,S.jsxs)(`div`,{"data-job-detail-surface":!0,className:`flex flex-col h-full max-w-5xl mx-auto w-full`,children:[(0,S.jsxs)(`div`,{className:`px-4 pt-3 pb-2 space-y-2`,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-1 text-xs text-muted-foreground`,children:[(0,S.jsxs)(i,{to:`/`,className:`hover:text-foreground transition-colors flex items-center gap-1`,children:[(0,S.jsx)(v,{className:`w-3 h-3`}),e(`detail.breadcrumbDashboard`)]}),(0,S.jsx)(re,{className:`w-3 h-3`}),(0,S.jsx)(`span`,{className:`text-foreground font-mono`,children:e(`detail.breadcrumbJob`,{id:n?.slice(0,8)})})]}),ke&&(0,S.jsx)(he,{tickets:E.tickets??[],onTicketClick:T}),(0,S.jsxs)(`div`,{className:`flex items-center gap-3 text-xs text-muted-foreground flex-wrap min-w-0`,children:[(0,S.jsx)(`code`,{className:h(`font-mono text-foreground/90 truncate`,ke?`text-xs text-muted-foreground`:`text-sm`),children:me(E.command,C)}),(0,S.jsx)(`span`,{children:E.started_at?e(`detail.startedAgo`,{timeAgo:fe(new Date(E.started_at),{addSuffix:!0,locale:o()})}):e(`detail.queuedWaiting`)}),E.model&&(0,S.jsx)(`span`,{className:`text-muted-foreground/40`,children:E.model})]})]}),(0,S.jsx)(ce,{onOpenRun:e=>w(`/jobs/${e}`),job:E,events:O,phases:_e,phaseDefinitions:ge,projectId:d,variant:`page`,pipelineTotals:Ae,actions:(0,S.jsxs)(S.Fragment,{children:[E.hasTelemetry&&(0,S.jsxs)(_,{children:[(0,S.jsx)(y,{asChild:!0,children:(0,S.jsxs)(g,{variant:`outline`,size:`sm`,className:`h-7`,onClick:Te,"aria-label":e(`detail.exportDiagnosticAria`),children:[(0,S.jsx)(ue,{className:`w-3.5 h-3.5 mr-1.5`}),e(`detail.exportDiagnostic`)]})}),(0,S.jsx)(b,{children:e(`detail.exportDiagnosticTooltip`)})]}),De&&(0,S.jsxs)(_,{children:[(0,S.jsx)(y,{asChild:!0,children:(0,S.jsxs)(g,{variant:`outline`,size:`sm`,onClick:Ee,disabled:R,"aria-busy":R,className:`h-7`,children:[(0,S.jsx)(de,{className:`w-3.5 h-3.5 mr-1.5`}),e(`detail.reExecute`)]})}),(0,S.jsx)(b,{children:e(`detail.reExecuteTooltip`)})]}),Z&&(0,S.jsxs)(_,{children:[(0,S.jsx)(y,{asChild:!0,children:(0,S.jsx)(g,{variant:`outline`,size:`sm`,onClick:we,className:`h-7 border-destructive/30 text-destructive hover:bg-destructive/10`,children:e(Q?`detail.cancelInteractive`:`detail.cancelJob`)})}),(0,S.jsx)(b,{children:e(`detail.cancelJobTooltip`)})]})]})}),(0,S.jsx)(`div`,{className:`flex-1 overflow-hidden relative`,children:u?(0,S.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,S.jsx)(`div`,{className:`flex items-center gap-1 border-b border-border/50 px-3 py-1.5`,children:[`narrated`,`log`].map(e=>(0,S.jsx)(`button`,{type:`button`,onClick:()=>Ce(e),"aria-pressed":F===e,"data-testid":`job-narration-mode-${e}`,className:`rounded-md px-2 py-0.5 text-[11px] font-medium transition-colors ${F===e?`bg-accent-primary/15 text-accent-primary`:`text-muted-foreground hover:bg-surface`}`,children:t(e===`narrated`?`modeNarrated`:`modeLog`)},e))}),(0,S.jsx)(`div`,{className:`flex-1 overflow-hidden`,children:F===`narrated`?(0,S.jsx)(ae,{events:O,settled:E.status!==`running`&&E.status!==`queued`,durationRange:Se,elapsedMs:E.duration_ms??null,variant:`page`}):$?(0,S.jsx)(p,{events:O,jobStatus:E.status,variant:`page`,onOpenRun:e=>w(`/jobs/${e}`)}):(0,S.jsx)(m,{events:O})})]}):$?(0,S.jsx)(p,{events:O,jobStatus:E.status,variant:`page`,onOpenRun:e=>w(`/jobs/${e}`)}):(0,S.jsx)(m,{events:O})}),Oe&&(0,S.jsx)(le,{jobId:E.id,settleMode:E.interactiveSettleMode,initialAcceptingTurns:E.interactiveAcceptingTurns,pendingInterrupts:E.pendingInterrupts,kind:E.command.startsWith(`loop:`)?`loop-step`:`job`,variant:`page`})]})}export{T as default};
@@ -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-DpxVGfUC.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-BkBD3rxx.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-Czov72g7.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,2 +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{l as r,r as i}from"./useSharedWebSocket-C17TGqT8.js";import{n as a,t as o}from"./createLucideIcon-Bjbbp_KS.js";import{n as s,r as c,s as l}from"./useDesktop-DpxVGfUC.js";import{s as u}from"./provider-capabilities-lePfeT_Y.js";import{t as d}from"./download-CFHyyHcw.js";import{t as f}from"./external-link-D6XxC_Cu.js";import{t as p}from"./loader-circle-DcygOQpC.js";import{t as m}from"./search-Cq_gE3Ik.js";import{t as h}from"./trash-2-BOU3WdZZ.js";import{t as g}from"./triangle-alert-H9T4jAmh.js";import{n as _,t as v}from"./jira-api-CbJvbRYx.js";import{i as y,l as b,o as x,r as S,t as C}from"./dialog-CMgps2MY.js";import{t as w}from"./utils-BC4DHlz2.js";import{t as T}from"./button-D1xExSTF.js";import{Et as E,Gt as D,Tt as O,U as k,an as A,bt as j,on as ee,qt as M,vt as te,yt as ne}from"./index-Czov72g7.js";var N=o(`earth`,[[`path`,{d:`M21.54 15H17a2 2 0 0 0-2 2v4.54`,key:`1djwo0`}],[`path`,{d:`M7 3.34V5a3 3 0 0 0 3 3a2 2 0 0 1 2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2c0-1.1.9-2 2-2h3.17`,key:`1tzkfa`}],[`path`,{d:`M11 21.95V18a2 2 0 0 0-2-2a2 2 0 0 1-2-2v-1a2 2 0 0 0-2-2H2.05`,key:`14pb5j`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),P=o(`folder-kanban`,[[`path`,{d:`M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z`,key:`1fr9dc`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M12 10v2`,key:`hh53o1`}],[`path`,{d:`M16 10v6`,key:`1d6xys`}]]),re=o(`power`,[[`path`,{d:`M12 2v10`,key:`mnfbl`}],[`path`,{d:`M18.4 6.6a9 9 0 1 1-12.77.04`,key:`obofu9`}]]),F=o(`settings-2`,[[`path`,{d:`M14 17H5`,key:`gfn3mx`}],[`path`,{d:`M19 7h-9`,key:`6i9tg`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}],[`circle`,{cx:`7`,cy:`7`,r:`3`,key:`dfmy0x`}]]),I=e(t(),1),L=n(),ie=[`todo`,`in_progress`,`on_review`,`done`,`cancelled`],ae={todo:`todo`,in_progress:`inProgress`,on_review:`onReview`,done:`done`,cancelled:`cancelled`};function R({onConnected:e,onSkip:t,apiBase:n}){let{t:r}=a(`jira`),[i,o]=(0,I.useState)(1),[s,c]=(0,I.useState)(``),[u,d]=(0,I.useState)(``),[f,p]=(0,I.useState)(``),[m,h]=(0,I.useState)(`idle`),[g,_]=(0,I.useState)(null),[y,b]=(0,I.useState)(`cloud`),[x,S]=(0,I.useState)([]),[C,w]=(0,I.useState)(``),[E,D]=(0,I.useState)(``),[O,A]=(0,I.useState)(``),[j,ee]=(0,I.useState)(!1),[M,te]=(0,I.useState)([]),[ne,N]=(0,I.useState)({}),[P,re]=(0,I.useState)(``),[F,R]=(0,I.useState)(!1),H=()=>({baseUrl:s.trim(),accountEmail:u.trim()||null,token:f});async function U(){h(`testing`);try{let e=await v.test(H(),n);h(`ok`),_(e.displayName),b(e.deployment)}catch(e){h(`error`),l.error(V(e,r))}}async function W(){o(2),ee(!0);try{let{projects:e}=await v.discoverProjects({...H(),query:C.trim()||void 0},n);S(e)}catch(e){l.error(V(e,r))}finally{ee(!1)}}async function oe(){if(o(3),E)try{let{statuses:e}=await v.discoverStatuses({...H(),projectKey:E},n);te(e)}catch{te([])}}async function G(){R(!0);try{let t=Object.fromEntries(Object.entries(ne).filter(([,e])=>e));await v.connect({...H(),jiraProjectKey:E.trim(),statusMap:Object.keys(t).length?t:null,discardStatus:P.trim()||null},n),l.success(r(`status.connected`,{key:E.trim()})),e()}catch(e){l.error(V(e,r))}finally{R(!1)}}return(0,L.jsxs)(`div`,{className:`space-y-4`,"data-testid":`jira-wizard`,children:[(0,L.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,L.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:r(`wizard.step`,{current:i,total:4})}),t&&(0,L.jsx)(`button`,{type:`button`,onClick:t,className:`text-xs text-muted-foreground hover:text-foreground hover:underline`,"data-testid":`jira-later`,children:r(`wizard.later`)})]}),i===1&&(0,L.jsxs)(`div`,{className:`space-y-3`,children:[(0,L.jsx)(`h3`,{className:`text-sm font-semibold`,children:r(`wizard.step1Title`)}),(0,L.jsx)(z,{label:r(`creds.baseUrlLabel`),help:r(`creds.baseUrlHelp`),children:(0,L.jsx)(k,{value:s,onChange:e=>{c(e.target.value),h(`idle`)},placeholder:r(`creds.baseUrlPlaceholder`)})}),(0,L.jsx)(z,{label:r(`creds.emailLabel`),help:r(`creds.emailHelp`),children:(0,L.jsx)(k,{value:u,onChange:e=>{d(e.target.value),h(`idle`)},placeholder:r(`creds.emailPlaceholder`)})}),(0,L.jsx)(z,{label:r(`creds.tokenLabel`),help:r(`creds.tokenHelp`),children:(0,L.jsx)(k,{type:`password`,value:f,onChange:e=>{p(e.target.value),h(`idle`)}})}),(0,L.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,L.jsx)(T,{size:`sm`,variant:`outline`,onClick:U,disabled:!s.trim()||!f.trim()||m===`testing`,children:r(m===`testing`?`creds.testing`:m===`ok`?`creds.retest`:`creds.test`)}),m===`ok`&&(0,L.jsxs)(`span`,{className:`text-xs text-accent-success`,"data-testid":`jira-test-ok`,children:[`✓ `,r(`creds.testOk`,{name:g??``}),` · `,r(y===`cloud`?`review.cloud`:`review.dc`)]})]}),(0,L.jsx)(`div`,{className:`flex justify-end`,children:(0,L.jsx)(T,{size:`sm`,onClick:W,disabled:m!==`ok`,children:r(`wizard.next`)})})]}),i===2&&(0,L.jsxs)(`div`,{className:`space-y-3`,children:[(0,L.jsx)(`h3`,{className:`text-sm font-semibold`,children:r(`wizard.step2Title`)}),(0,L.jsxs)(`div`,{className:`flex gap-2`,children:[(0,L.jsx)(k,{value:C,onChange:e=>w(e.target.value),placeholder:r(`project.searchPlaceholder`)}),(0,L.jsx)(T,{size:`sm`,variant:`outline`,onClick:W,children:r(`project.searchPlaceholder`)})]}),j?(0,L.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:r(`project.loading`)}):x.length===0?(0,L.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:r(`project.none`)}):(0,L.jsx)(`div`,{className:`max-h-48 space-y-1 overflow-y-auto`,"data-testid":`jira-project-list`,children:x.map(e=>(0,L.jsxs)(`button`,{type:`button`,onClick:()=>{D(e.key),A(e.name)},className:`flex w-full items-center justify-between rounded px-2 py-1.5 text-left text-sm hover:bg-muted ${E===e.key?`bg-muted`:``}`,children:[(0,L.jsx)(`span`,{className:`font-medium`,children:e.key}),(0,L.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:e.name})]},e.id))}),(0,L.jsx)(z,{label:r(`project.manualLabel`),children:(0,L.jsx)(k,{value:E,onChange:e=>{D(e.target.value.toUpperCase()),A(``)},placeholder:r(`project.manualPlaceholder`)})}),(0,L.jsxs)(`div`,{className:`flex justify-between`,children:[(0,L.jsx)(T,{size:`sm`,variant:`ghost`,onClick:()=>o(1),children:r(`wizard.back`)}),(0,L.jsx)(T,{size:`sm`,onClick:oe,disabled:!E.trim(),children:r(`wizard.next`)})]})]}),i===3&&(0,L.jsxs)(`div`,{className:`space-y-3`,children:[(0,L.jsx)(`h3`,{className:`text-sm font-semibold`,children:r(`wizard.step3Title`)}),(0,L.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:r(`mapping.intro`)}),ie.map(e=>(0,L.jsx)(z,{label:r(`mapping.${ae[e]}`),children:(0,L.jsxs)(`select`,{value:ne[e]??``,onChange:t=>N(n=>({...n,[e]:t.target.value||void 0})),className:`w-full rounded-md border border-border bg-background px-2 py-1.5 text-sm`,children:[(0,L.jsx)(`option`,{value:``,children:r(`mapping.auto`)}),M.map(e=>(0,L.jsx)(`option`,{value:e.name,children:e.name},e.id))]})},e)),(0,L.jsx)(z,{label:r(`discard.configLabel`),help:r(`discard.configHelp`),children:(0,L.jsxs)(`select`,{value:P,onChange:e=>re(e.target.value),className:`w-full rounded-md border border-border bg-background px-2 py-1.5 text-sm`,"data-testid":`jira-discard-status-select`,children:[(0,L.jsx)(`option`,{value:``,children:r(`discard.configNone`)}),M.map(e=>(0,L.jsx)(`option`,{value:e.name,children:e.name},e.id))]})}),(0,L.jsxs)(`div`,{className:`flex justify-between`,children:[(0,L.jsx)(T,{size:`sm`,variant:`ghost`,onClick:()=>o(2),children:r(`wizard.back`)}),(0,L.jsx)(T,{size:`sm`,onClick:()=>o(4),children:r(`wizard.next`)})]})]}),i===4&&(0,L.jsxs)(`div`,{className:`space-y-3`,children:[(0,L.jsx)(`h3`,{className:`text-sm font-semibold`,children:r(`wizard.step4Title`)}),(0,L.jsxs)(`dl`,{className:`space-y-1 text-sm`,children:[(0,L.jsx)(B,{label:r(`review.site`),value:s}),(0,L.jsx)(B,{label:r(`review.project`),value:O?`${E} — ${O}`:E}),(0,L.jsx)(B,{label:r(`review.account`),value:g??u}),(0,L.jsx)(B,{label:r(`review.type`),value:r(y===`cloud`?`review.cloud`:`review.dc`)}),(0,L.jsx)(B,{label:r(`discard.reviewLabel`),value:P||r(`discard.configNone`)})]}),(0,L.jsxs)(`div`,{className:`flex justify-between`,children:[(0,L.jsx)(T,{size:`sm`,variant:`ghost`,onClick:()=>o(3),children:r(`wizard.back`)}),(0,L.jsx)(T,{size:`sm`,onClick:G,disabled:F,children:r(F?`wizard.connecting`:`wizard.connect`)})]})]})]})}function z({label:e,help:t,children:n}){return(0,L.jsxs)(`label`,{className:`block space-y-1`,children:[(0,L.jsx)(`span`,{className:`text-xs font-medium text-foreground`,children:e}),n,t&&(0,L.jsx)(`span`,{className:`block text-[11px] text-muted-foreground`,children:t})]})}function B({label:e,value:t}){return(0,L.jsxs)(`div`,{className:`flex justify-between gap-4`,children:[(0,L.jsx)(`dt`,{className:`text-muted-foreground`,children:e}),(0,L.jsx)(`dd`,{className:`truncate text-right font-medium`,children:t})]})}function V(e,t){return e instanceof Error?e.message:t(`errors.generic`)}var H=[`todo`,`in_progress`,`on_review`,`done`,`cancelled`],U={todo:`todo`,in_progress:`inProgress`,on_review:`onReview`,done:`done`,cancelled:`cancelled`};function W({state:e,onChanged:t,apiBase:n}){let{t:r}=a(`jira`),i=e.connection,[o,s]=(0,I.useState)(i.enabled),[c,u]=(0,I.useState)(!1),[d,f]=(0,I.useState)(!1),[p,m]=(0,I.useState)([]),[h,g]=(0,I.useState)([]),[_,y]=(0,I.useState)(i.discardStatus??``),[b,x]=(0,I.useState)(i.statusMap??{}),S=e.outbox??{pending:0,inflight:0,done:0,dead:0},C=(0,I.useCallback)(async()=>{try{let{ops:e}=n?await v.listOutbox(`dead`,n):await v.listOutbox(`dead`);m(e)}catch{m([])}},[n]);(0,I.useEffect)(()=>{C()},[C]),(0,I.useEffect)(()=>{let e=!1;return v.listStatuses(n).then(({statuses:t})=>{e||g(t)}).catch(()=>{e||g([])}),()=>{e=!0}},[n]);async function w(e){let i=_;y(e);try{n?await v.patchConnection({discardStatus:e||null},n):await v.patchConnection({discardStatus:e||null}),t()}catch(e){y(i),l.error(G(e,r))}}async function E(e,i){let a=b,o={...b,[e]:i||void 0};x(o);let s=Object.fromEntries(Object.entries(o).filter(([,e])=>e));try{n?await v.patchConnection({statusMap:Object.keys(s).length?s:null},n):await v.patchConnection({statusMap:Object.keys(s).length?s:null}),t()}catch(e){x(a),l.error(G(e,r))}}async function D(){let e=!o;s(e),f(!0);try{n?await v.setEnabled(e,n):await v.setEnabled(e)}catch(t){s(!e),l.error(G(t,r))}finally{f(!1)}}async function O(){u(!0);try{let e=n?await v.syncNow(n):await v.syncNow();l.success(r(`status.syncedToast`,{count:e.upserted}))}catch(e){l.error(G(e,r))}finally{u(!1)}}async function k(){if(window.confirm(r(`status.disconnectConfirm`))){f(!0);try{n?await v.disconnect(n):await v.disconnect(),l.success(r(`status.disconnectedToast`)),t()}catch(e){l.error(G(e,r))}finally{f(!1)}}}async function A(e){try{n?await v.retryOutbox(e,n):await v.retryOutbox(e),await C()}catch(e){l.error(G(e,r))}}let j=S.pending+S.inflight;return(0,L.jsxs)(`div`,{className:`space-y-4`,"data-testid":`jira-connected`,children:[(0,L.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`p`,{className:`text-sm font-medium text-foreground`,children:r(`status.connected`,{key:i.jiraProjectKey})}),(0,L.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[i.baseUrl,` · `,i.deployment===`cloud`?r(`review.cloud`):r(`review.dc`)]})]}),(0,L.jsx)(`a`,{href:`${i.baseUrl}/browse/${i.jiraProjectKey}`,target:`_blank`,rel:`noreferrer`,className:`text-xs text-accent-primary hover:underline`,children:r(`badge.openInJira`)})]}),(0,L.jsxs)(`div`,{className:`flex items-center justify-between rounded-md border border-border p-3`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`p`,{className:`text-sm font-medium`,children:r(`status.enabledLabel`)}),(0,L.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:r(o?`status.enabledHelp`:`status.pausedHelp`)})]}),(0,L.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":o,"aria-label":r(`status.enabledLabel`),disabled:d,onClick:D,className:`relative inline-flex h-5 w-9 shrink-0 items-center rounded-full transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 ${o?`bg-accent-success`:`bg-input`}`,children:(0,L.jsx)(`span`,{className:`inline-block h-3.5 w-3.5 rounded-full bg-background shadow-sm transition-transform ${o?`translate-x-4`:`translate-x-0.5`}`})})]}),(0,L.jsxs)(`div`,{className:`rounded-md border border-border p-3`,"data-testid":`jira-status-map`,children:[(0,L.jsx)(`p`,{className:`text-sm font-medium`,children:r(`wizard.step3Title`)}),(0,L.jsx)(`p`,{className:`mt-0.5 mb-2 text-xs text-muted-foreground`,children:r(`mapping.intro`)}),(0,L.jsx)(`div`,{className:`space-y-2`,children:H.map(e=>(0,L.jsxs)(`label`,{className:`flex items-center justify-between gap-3`,children:[(0,L.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:r(`mapping.${U[e]}`)}),(0,L.jsxs)(`select`,{value:b[e]??``,onChange:t=>void E(e,t.target.value),className:`w-44 rounded-md border border-border bg-background px-2 py-1.5 text-sm`,"data-testid":`jira-statusmap-${e}`,children:[(0,L.jsx)(`option`,{value:``,children:r(`mapping.auto`)}),h.map(e=>(0,L.jsx)(`option`,{value:e.name,children:e.name},e.id)),b[e]&&!h.some(t=>t.name===b[e])&&(0,L.jsx)(`option`,{value:b[e],children:b[e]})]})]},e))})]}),(0,L.jsxs)(`div`,{className:`rounded-md border border-border p-3`,children:[(0,L.jsx)(`p`,{className:`text-sm font-medium`,children:r(`discard.configLabel`)}),(0,L.jsx)(`p`,{className:`mt-0.5 mb-2 text-xs text-muted-foreground`,children:r(`discard.configHelp`)}),(0,L.jsxs)(`select`,{value:_,onChange:e=>void w(e.target.value),className:`w-full rounded-md border border-border bg-background px-2 py-1.5 text-sm`,"data-testid":`jira-discard-status-select`,children:[(0,L.jsx)(`option`,{value:``,children:r(`discard.configNone`)}),h.map(e=>(0,L.jsx)(`option`,{value:e.name,children:e.name},e.id)),_&&!h.some(e=>e.name===_)&&(0,L.jsx)(`option`,{value:_,children:_})]})]}),(0,L.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,L.jsx)(T,{variant:`outline`,size:`sm`,onClick:O,disabled:c,children:r(c?`status.syncing`:`status.syncNow`)}),(0,L.jsx)(T,{variant:`ghost`,size:`sm`,onClick:k,disabled:d,className:`text-destructive`,children:r(`status.disconnect`)})]}),(0,L.jsxs)(`div`,{className:`rounded-md border border-border p-3`,"data-testid":`jira-outbox`,children:[(0,L.jsx)(`p`,{className:`text-sm font-medium`,children:r(`outbox.title`)}),S.dead>0?(0,L.jsx)(`p`,{className:`mt-1 text-xs text-accent-warning`,children:r(`outbox.dead`,{count:S.dead})}):j>0?(0,L.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:r(`outbox.pending`,{count:j})}):(0,L.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:r(`outbox.allSynced`)}),p.length>0&&(0,L.jsxs)(`div`,{className:`mt-2 space-y-2`,children:[(0,L.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:r(`outbox.deadHelp`)}),p.map(e=>(0,L.jsxs)(`div`,{className:`flex items-center justify-between gap-2 rounded border border-border/60 px-2 py-1`,children:[(0,L.jsxs)(`span`,{className:`truncate text-xs`,children:[oe(e,r),` · `,e.deadReason??e.lastError??``]}),(0,L.jsx)(T,{variant:`outline`,size:`sm`,onClick:()=>A(e.id),children:r(`outbox.retry`)})]},e.id))]})]})]})}function oe(e,t){return e.opType===`transition`?t(`outbox.opTransition`):e.opType===`comment`?t(`outbox.opComment`):t(`outbox.opCreate`)}function G(e,t){return e instanceof Error?e.message:t(`errors.generic`)}var se=new Set([`claude`,`codex`,`kimi`]);function K(e){return{provider:e,label:e===`codex`?`Codex`:`Claude`,active:!1,available:!1,detectedRoute:!1,requests:0,inputTokens:0,inputTokensSaved:0,outputTokens:0,outputTokensSaved:0,outputSavingsPercent:0,outputSavingsMethod:`none`,outputSavingsAllocated:!1}}function q(){return{updatedAt:null,proxyStatsAvailable:!1,durableSavingsAvailable:!1,outputSavingsAvailable:!1,outputSavingsMethod:null,outputConfidence:null,providers:{codex:K(`codex`),claude:K(`claude`)},lastIssue:null}}var J={installed:!1,installSource:null,version:null,executablePath:null,uvPath:null,port:8787,phase:`idle`,activeProviders:{codex:!1,claude:!1},availableProviders:{codex:!1,claude:!1},detectedRoutes:{codex:!1,claude:!1},proxyRunning:!1,proxyPid:null,learning:{enabled:!1,baselineReady:!1,baselineSamples:0,updatedAt:null,lastIssue:null},metrics:q(),lastIssue:null,updatedAt:null};function ce(e){let t=e?.metrics??q();return{...J,...e,activeProviders:{...J.activeProviders,...e?.activeProviders},availableProviders:{...J.availableProviders,...e?.availableProviders},detectedRoutes:{...J.detectedRoutes,...e?.detectedRoutes},learning:{...J.learning,...e?.learning},metrics:{...q(),...t,providers:{codex:{...K(`codex`),...t.providers?.codex},claude:{...K(`claude`),...t.providers?.claude}}}}}async function Y(e){let t=await e.text(),n=t?JSON.parse(t):{};if(!e.ok){let t=n.issue;throw Object.assign(Error(t?.title??n.error??`HTTP ${e.status}`),{payload:n})}return n}function X(e){return`${r}/api/projects/${e}`}function Z(e,t=`en`){if(!Number.isFinite(e))return`0`;try{return Intl.NumberFormat(t,{notation:`compact`,maximumFractionDigits:1}).format(Math.max(0,e))}catch{return Intl.NumberFormat(`en`,{notation:`compact`,maximumFractionDigits:1}).format(Math.max(0,e))}}function Q(e,t,n){return`${Z(e,t)} ${n}`}function le({onWindowOpened:e}={}){let{t}=a(`integrations`),{projects:n}=c(),{registerHandler:o,unregisterHandler:s}=i(),[u,d]=(0,I.useState)(``),[p,h]=(0,I.useState)(`all`),[g,_]=(0,I.useState)(J),[v,T]=(0,I.useState)(!0),[D,k]=(0,I.useState)(null),[M,N]=(0,I.useState)([]),[re,F]=(0,I.useState)(!1),[ie,ae]=(0,I.useState)(!1),[R,z]=(0,I.useState)(null),[B,V]=(0,I.useState)({jira:0,serena:0,projects:0}),H=(0,I.useCallback)(async()=>{try{let e=await fetch(`${r}/api/global-plugins/headroom`).then(e=>Y(e));_(ce(e.state))}finally{T(!1)}},[]);(0,I.useEffect)(()=>{H()},[H]),(0,I.useEffect)(()=>(o(`plugins-page`,e=>{let t=e;t.type===`plugin.headroom_progress`&&(t.line&&N(e=>[...e.slice(-80),t.line]),H())}),()=>s(`plugins-page`)),[o,s,H]),(0,I.useEffect)(()=>{let e=!1;async function t(){let t=await Promise.all(n.map(async e=>{let[t,n]=await Promise.all([fetch(`${X(e.id)}/jira/connection`).then(e=>Y(e)).catch(()=>({connected:!1})),fetch(`${X(e.id)}/plugins`).then(e=>Y(e)).catch(()=>({plugins:[]}))]),r=n.plugins.find(e=>e.name===`serena`);return{jira:+!!t.connected,serena:r&&r.status!==`not-installed`&&r.status!==`orphan`?1:0}}));e||V({jira:t.reduce((e,t)=>e+t.jira,0),serena:t.reduce((e,t)=>e+t.serena,0),projects:n.length})}return t(),()=>{e=!0}},[n]);async function U(e,t){k(e),N([]);try{let e=(await t()).state;e&&_(ce(e))}catch(e){let t=e.payload;t?.state&&_(ce(t.state))}finally{k(null),H()}}let W=(0,I.useMemo)(()=>[{id:`headroom-ai`,title:`Headroom AI`,scope:`global`,icon:E,description:t(`plugins.catalog.headroom.description`),installed:g.installed,status:g.lastIssue?`attention`:g.installed?g.activeProviders.codex||g.activeProviders.claude?g.installSource===`system`?`external-active`:`active`:g.installSource===`system`?`external`:`installed`:`available`,statusLabel:g.lastIssue?t(`plugins.status.attention`):g.installed?g.activeProviders.codex||g.activeProviders.claude?g.installSource===`system`?t(`plugins.status.externalActive`):t(`plugins.status.active`):g.installSource===`system`?t(`plugins.status.external`):t(`plugins.status.installed`):t(`plugins.status.available`),actionKind:g.lastIssue?`review`:g.installed?`manage`:`install`,actionLabel:g.lastIssue?t(`plugins.actions.review`):g.installed?t(`plugins.actions.manage`):t(`plugins.actions.install`),busy:D===`install`,action:()=>{if(g.lastIssue||g.installed){F(!0);return}U(`install`,()=>fetch(`${r}/api/global-plugins/headroom/install`,{method:`POST`}).then(e=>Y(e)))}}],[g,D,t]),oe=(0,I.useMemo)(()=>[{id:`jira`,title:`Jira`,scope:`project`,icon:P,description:t(`plugins.catalog.jira.description`),installed:B.jira>0,status:B.jira>0?`configured`:`available`,statusLabel:B.jira>0?t(`plugins.status.configuredCount`,{count:B.jira}):t(`plugins.status.available`),actionKind:B.jira>0?`manage`:`install`,actionLabel:B.jira>0?t(`plugins.actions.manage`):t(`plugins.actions.install`),action:()=>z(`jira`)},{id:`serena`,title:`Serena`,scope:`project`,icon:te,description:t(`plugins.catalog.serena.description`),installed:B.serena>0,status:B.serena>0?`installed`:`available`,statusLabel:B.serena>0?t(`plugins.status.installedCount`,{count:B.serena}):t(`plugins.status.available`),actionKind:B.serena>0?`manage`:`install`,actionLabel:B.serena>0?t(`plugins.actions.manage`):t(`plugins.actions.install`),action:()=>z(`serena`)}],[B,t]),G=u.trim().toLowerCase(),se=e=>`${e.title} ${e.description} ${e.statusLabel} ${t(`plugins.scope.${e.scope}`)}`.toLowerCase().includes(G),K=[...W,...oe].filter(e=>p!==`all`&&e.scope!==p?!1:se(e)),q=K.filter(e=>e.scope===`global`&&e.installed),Z=K.filter(e=>e.scope===`project`&&e.installed),Q=K.filter(e=>e.scope===`global`&&!e.installed),le=K.filter(e=>e.scope===`project`&&!e.installed),fe=q.length>0||Z.length>0,pe=Q.length>0||le.length>0,me=[g.installed,B.jira>0,B.serena>0].filter(Boolean).length;return(0,L.jsxs)(`div`,{className:`flex h-full flex-col bg-background`,children:[(0,L.jsxs)(`div`,{className:`border-b border-border px-6 py-4`,children:[(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,L.jsx)(`div`,{className:`grid h-9 w-9 place-items-center rounded-lg border border-accent-primary/25 bg-accent-primary/10 text-accent-primary`,children:(0,L.jsx)(O,{className:`h-4 w-4`})}),(0,L.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,L.jsx)(`h1`,{className:`text-lg font-semibold tracking-normal`,children:t(`plugins.page.title`)}),(0,L.jsx)(`p`,{className:`mt-0.5 text-xs text-muted-foreground`,children:t(`plugins.page.subtitle`)})]}),!A()&&(0,L.jsxs)(`button`,{type:`button`,onClick:()=>void ee().then(()=>e?.()).catch(e=>l.error(String(e))),className:`inline-flex items-center gap-1.5 rounded-md border border-border px-3 py-2 text-xs hover:bg-muted`,children:[(0,L.jsx)(f,{className:`h-3.5 w-3.5`}),t(`plugins.page.openWindow`)]}),(0,L.jsxs)(`div`,{className:`mr-12 flex items-center gap-2 rounded-lg border border-border bg-card/60 px-3 py-2 text-xs`,children:[(0,L.jsx)(j,{className:`h-3.5 w-3.5 text-accent-success`}),(0,L.jsx)(`span`,{className:`text-muted-foreground`,children:t(`plugins.page.readyCount`,{count:me})})]})]}),(0,L.jsxs)(`div`,{className:`mt-4 flex flex-col gap-3 md:flex-row md:items-center`,children:[(0,L.jsxs)(`label`,{className:`relative flex-1`,children:[(0,L.jsx)(m,{className:`pointer-events-none absolute left-3 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground`}),(0,L.jsx)(`input`,{value:u,onChange:e=>d(e.target.value),placeholder:t(`plugins.search.placeholder`),className:`h-9 w-full rounded-lg border border-border bg-background pl-9 pr-3 text-sm outline-none transition-colors focus:border-accent-primary/60`})]}),(0,L.jsx)(`div`,{className:`inline-flex h-9 rounded-lg border border-border bg-card p-1`,children:[`all`,`global`,`project`].map(e=>(0,L.jsx)(`button`,{type:`button`,onClick:()=>h(e),className:w(`rounded-md px-3 text-xs capitalize transition-colors`,p===e?`bg-muted text-foreground`:`text-muted-foreground hover:text-foreground`),children:t(`plugins.filters.${e}`)},e))})]})]}),(0,L.jsxs)(`div`,{className:`flex-1 overflow-auto px-6 py-5`,children:[(0,L.jsxs)(`section`,{className:`mb-6`,children:[(0,L.jsxs)(`div`,{className:`mb-3 flex items-center gap-2 text-xs font-medium text-muted-foreground`,children:[(0,L.jsx)(ne,{className:`h-3.5 w-3.5`}),t(`plugins.sections.installed`)]}),fe?(0,L.jsx)(ue,{globalPlugins:q,projectPlugins:Z}):(0,L.jsx)(de,{text:t(G?`plugins.empty.installedSearch`:`plugins.empty.installed`)})]}),(0,L.jsxs)(`section`,{children:[(0,L.jsxs)(`div`,{className:`mb-3 flex items-center gap-2 text-xs font-medium text-muted-foreground`,children:[(0,L.jsx)(O,{className:`h-3.5 w-3.5`}),t(`plugins.sections.available`)]}),pe?(0,L.jsx)(ue,{globalPlugins:Q,projectPlugins:le}):(0,L.jsx)(de,{text:t(G?`plugins.empty.availableSearch`:`plugins.empty.allInstalled`)})]})]}),(0,L.jsx)(C,{open:re,onOpenChange:F,children:(0,L.jsxs)(S,{className:`w-[calc(100vw-2rem)] max-w-xl overflow-x-hidden p-4 sm:p-6`,children:[(0,L.jsxs)(x,{children:[(0,L.jsx)(b,{children:t(`plugins.headroom.title`)}),(0,L.jsx)(y,{children:t(`plugins.headroom.dialogDescription`)})]}),(0,L.jsx)(he,{state:g,loading:v,busy:D,logs:M,onInstall:()=>U(`install`,()=>fetch(`${r}/api/global-plugins/headroom/install`,{method:`POST`}).then(e=>Y(e))),onToggleProvider:(e,t)=>U(`${t?`deactivate`:`activate`}-${e}`,()=>fetch(`${r}/api/global-plugins/headroom/${t?`deactivate`:`activate`}`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({provider:e})}).then(e=>Y(e))),onDeactivateAll:()=>U(`deactivate-all`,async()=>{let e={state:g};for(let t of[`codex`,`claude`])g.activeProviders[t]&&(e=await fetch(`${r}/api/global-plugins/headroom/deactivate`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({provider:t})}).then(e=>Y(e)));return e}),onUninstall:()=>U(`uninstall`,()=>fetch(`${r}/api/global-plugins/headroom/uninstall`,{method:`POST`}).then(e=>Y(e))),onSetPort:e=>U(`port`,()=>fetch(`${r}/api/global-plugins/headroom/port`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({port:e})}).then(e=>Y(e))),onOpenDiagnostics:()=>ae(!0)})]})}),(0,L.jsx)(xe,{plugin:R,projects:n,onClose:()=>z(null)}),(0,L.jsx)(we,{open:ie,onClose:()=>ae(!1)})]})}function ue({globalPlugins:e,projectPlugins:t}){let{t:n}=a(`integrations`);return(0,L.jsxs)(`div`,{className:w(`grid grid-cols-1 gap-4`,e.length>0&&t.length>0&&`xl:grid-cols-2`),children:[e.length>0&&(0,L.jsxs)(`section`,{children:[(0,L.jsx)(pe,{title:n(`plugins.groups.global.title`),detail:n(`plugins.groups.global.detail`),scope:`global`}),(0,L.jsx)(`div`,{className:`grid grid-cols-[repeat(auto-fill,minmax(260px,320px))] justify-start gap-3`,children:e.map(e=>(0,L.jsx)(me,{plugin:e},e.id))})]}),t.length>0&&(0,L.jsxs)(`section`,{children:[(0,L.jsx)(pe,{title:n(`plugins.groups.project.title`),detail:n(`plugins.groups.project.detail`),scope:`project`}),(0,L.jsx)(`div`,{className:`grid grid-cols-[repeat(auto-fill,minmax(260px,320px))] justify-start gap-3`,children:t.map(e=>(0,L.jsx)(me,{plugin:e},e.id))})]})]})}function de({text:e}){return(0,L.jsx)(`div`,{className:`flex h-[74px] max-w-[320px] items-center rounded-lg border border-dashed border-border bg-card/35 px-3 text-xs text-muted-foreground`,children:e})}function fe({scope:e}){let{t}=a(`integrations`);return(0,L.jsx)(`span`,{className:w(`rounded px-1.5 py-0.5 text-[10px] uppercase tracking-wide`,e===`global`?`bg-accent-primary/10 text-accent-primary`:`bg-accent-info/10 text-accent-info`),children:t(`plugins.scope.${e}`)})}function pe({title:e,detail:t,scope:n}){return(0,L.jsxs)(`div`,{className:`mb-2 flex items-center gap-2`,children:[(0,L.jsx)(`div`,{className:w(`h-px flex-1`,n===`global`?`bg-accent-primary/30`:`bg-accent-info/30`)}),(0,L.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md border border-border bg-card/70 px-2 py-1`,children:[(0,L.jsx)(fe,{scope:n}),(0,L.jsx)(`span`,{className:`text-xs font-medium`,children:e}),(0,L.jsx)(`span`,{className:`hidden text-[11px] text-muted-foreground sm:inline`,children:t})]}),(0,L.jsx)(`div`,{className:w(`h-px flex-1`,n===`global`?`bg-accent-primary/30`:`bg-accent-info/30`)})]})}function me({plugin:e}){let{t}=a(`integrations`),n=e.icon,r=e.scope===`global`,i=e.status===`attention`,o=e.busy?p:e.actionKind===`install`?d:e.actionKind===`review`?g:F,s=w(`shrink-0 rounded border px-1.5 py-0.5 text-[10px] leading-none`,i?`border-accent-warning/30 bg-accent-warning/10 text-accent-warning`:e.installed?`border-accent-success/25 bg-accent-success/10 text-accent-success`:`border-border bg-muted text-muted-foreground`);return(0,L.jsxs)(`article`,{className:`grid h-[88px] w-full grid-cols-[38px_minmax(0,1fr)_auto] items-center gap-3 rounded-lg border border-border bg-card/70 px-3 transition-colors hover:border-accent-primary/35 hover:bg-card`,children:[(0,L.jsx)(`div`,{className:w(`grid h-[38px] w-[38px] shrink-0 place-items-center rounded-lg border`,r?`border-accent-primary/25 bg-accent-primary/10 text-accent-primary`:`border-accent-info/25 bg-accent-info/10 text-accent-info`),children:(0,L.jsx)(n,{className:`h-4 w-4`})}),(0,L.jsxs)(`div`,{className:`min-w-0`,children:[(0,L.jsx)(`h2`,{className:`truncate text-sm font-semibold leading-5`,children:e.title}),(0,L.jsx)(`p`,{className:`mt-1 truncate text-[11px] leading-4 text-muted-foreground`,children:e.description}),(0,L.jsxs)(`div`,{className:`mt-1.5 flex items-center gap-1.5`,children:[(0,L.jsx)(fe,{scope:e.scope}),(0,L.jsx)(`span`,{className:s,children:e.statusLabel})]})]}),(0,L.jsxs)(`button`,{type:`button`,disabled:e.busy,onClick:e.action,className:`flex h-7 shrink-0 items-center gap-1.5 rounded-md border border-border bg-background px-2.5 text-xs font-medium transition-colors hover:bg-muted disabled:opacity-50`,children:[(0,L.jsx)(o,{className:w(`h-3.5 w-3.5`,e.busy&&`animate-spin`)}),e.busy?t(`plugins.actions.installing`):e.actionLabel]})]})}function he({state:e,loading:t,busy:n,logs:r,onInstall:i,onToggleProvider:o,onDeactivateAll:s,onUninstall:c,onSetPort:l,onOpenDiagnostics:u}){let{t:f}=a(`integrations`),[m,g]=(0,I.useState)(String(e.port)),[v,y]=(0,I.useState)(!1);(0,I.useEffect)(()=>g(String(e.port)),[e.port]),(0,I.useEffect)(()=>{e.installed||y(!1)},[e.installed]);let b=e.activeProviders.codex||e.activeProviders.claude,x=e.installSource===`system`;return(0,L.jsxs)(`aside`,{className:`w-full min-w-0 overflow-hidden rounded-lg border border-border bg-card/80 p-4`,children:[(0,L.jsxs)(`div`,{className:`mb-4 flex items-start gap-3`,children:[(0,L.jsx)(`div`,{className:`grid h-10 w-10 place-items-center rounded-lg border border-accent-primary/25 bg-accent-primary/10 text-accent-primary`,children:(0,L.jsx)(E,{className:`h-4 w-4`})}),(0,L.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,L.jsx)(`h2`,{className:`text-sm font-semibold`,children:f(`plugins.headroom.title`)}),(0,L.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-muted-foreground`,children:f(`plugins.headroom.panelDescription`)})]})]}),(0,L.jsxs)(`div`,{className:`mb-4 grid grid-cols-3 gap-2 text-xs`,children:[(0,L.jsx)(ge,{label:f(`plugins.headroom.metrics.install`),value:t?f(`plugins.headroom.metrics.checking`):e.installed?f(`plugins.headroom.metrics.ready`):f(`plugins.headroom.metrics.missing`),good:e.installed}),(0,L.jsx)(ge,{label:f(`plugins.headroom.metrics.source`),value:e.installSource===`system`?f(`plugins.headroom.metrics.system`):e.installSource===`managed`?f(`plugins.headroom.metrics.specrails`):f(`plugins.headroom.metrics.none`),good:e.installed}),(0,L.jsx)(ge,{label:f(`plugins.headroom.metrics.proxy`),value:e.proxyRunning?`:${e.port}`:f(b?`plugins.headroom.metrics.starting`:`plugins.headroom.metrics.off`),good:e.proxyRunning||!b})]}),e.lastIssue&&(0,L.jsx)(_e,{issue:e.lastIssue}),e.installed?(0,L.jsxs)(`div`,{className:`mb-4 space-y-2`,children:[(0,L.jsx)(be,{provider:`codex`,active:e.activeProviders.codex,available:e.availableProviders.codex,detectedRoute:e.detectedRoutes.codex,busy:n===`activate-codex`||n===`deactivate-codex`,onClick:()=>o(`codex`,e.activeProviders.codex)}),(0,L.jsx)(be,{provider:`claude`,active:e.activeProviders.claude,available:e.availableProviders.claude,detectedRoute:e.detectedRoutes.claude,busy:n===`activate-claude`||n===`deactivate-claude`,onClick:()=>o(`claude`,e.activeProviders.claude)}),b&&(0,L.jsxs)(`button`,{type:`button`,disabled:!!n,onClick:s,className:`flex h-8 w-full items-center justify-center gap-2 rounded-lg border border-border bg-background/45 text-xs hover:bg-muted/50 disabled:opacity-50`,children:[n===`deactivate-all`?(0,L.jsx)(p,{className:`h-3.5 w-3.5 animate-spin`}):(0,L.jsx)(re,{className:`h-3.5 w-3.5`}),f(`plugins.headroom.actions.disableAllRoutes`)]})]}):(0,L.jsxs)(`button`,{type:`button`,disabled:!!n,onClick:i,className:`mb-3 flex h-9 w-full items-center justify-center gap-2 rounded-lg bg-accent-primary px-3 text-xs font-medium text-white disabled:opacity-50`,children:[n===`install`?(0,L.jsx)(p,{className:`h-3.5 w-3.5 animate-spin`}):(0,L.jsx)(d,{className:`h-3.5 w-3.5`}),f(`plugins.headroom.actions.installWithUv`)]}),e.installed&&(0,L.jsx)(ve,{state:e}),(0,L.jsxs)(`div`,{className:`mb-4 rounded-lg border border-border bg-background/45 p-3`,children:[(0,L.jsx)(`label`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:f(`plugins.headroom.port.label`)}),(0,L.jsxs)(`div`,{className:`flex gap-2`,children:[(0,L.jsx)(`input`,{value:m,onChange:e=>g(e.target.value),className:`h-8 min-w-0 flex-1 rounded-md border border-border bg-background px-2 text-sm`}),(0,L.jsx)(`button`,{type:`button`,disabled:!!n||Number(m)===e.port,onClick:()=>l(Number(m)),className:`rounded-md border border-border px-2 text-xs hover:bg-muted disabled:opacity-50`,children:f(`plugins.headroom.port.apply`)})]})]}),r.length>0&&(0,L.jsx)(`pre`,{className:`mb-3 max-h-32 overflow-y-auto overflow-x-hidden whitespace-pre-wrap break-words rounded-lg border border-border bg-background/60 p-2 text-[10px] text-muted-foreground`,children:r.join(`
2
- `)}),(0,L.jsxs)(`button`,{type:`button`,onClick:u,className:`mb-2 flex h-8 w-full items-center justify-center gap-2 rounded-lg border border-border text-xs hover:bg-muted/50`,children:[(0,L.jsx)(_,{className:`h-3.5 w-3.5`}),f(`plugins.headroom.actions.viewDiagnostics`)]}),e.installed&&(0,L.jsx)(`div`,{className:`rounded-lg border border-destructive/25 bg-destructive/5 p-3`,children:v?(0,L.jsxs)(`div`,{className:`space-y-2`,children:[(0,L.jsx)(`p`,{className:`text-[11px] leading-relaxed text-muted-foreground`,children:f(x?`plugins.headroom.confirmDetach`:`plugins.headroom.confirmUninstall`)}),(0,L.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,L.jsx)(`button`,{type:`button`,disabled:!!n,onClick:()=>y(!1),className:`h-8 rounded-md border border-border text-xs hover:bg-muted/50 disabled:opacity-50`,children:f(`plugins.actions.cancel`)}),(0,L.jsxs)(`button`,{type:`button`,disabled:!!n,onClick:c,className:`flex h-8 items-center justify-center gap-2 rounded-md bg-destructive px-2 text-xs font-medium text-destructive-foreground disabled:opacity-50`,children:[n===`uninstall`?(0,L.jsx)(p,{className:`h-3.5 w-3.5 animate-spin`}):(0,L.jsx)(h,{className:`h-3.5 w-3.5`}),f(x?`plugins.headroom.actions.detach`:`plugins.headroom.actions.uninstall`)]})]})]}):(0,L.jsxs)(`button`,{type:`button`,disabled:!!n,onClick:()=>y(!0),className:`flex h-8 w-full items-center justify-center gap-2 rounded-md text-xs font-medium text-destructive hover:bg-destructive/10 disabled:opacity-50`,children:[(0,L.jsx)(h,{className:`h-3.5 w-3.5`}),f(x?`plugins.headroom.actions.detachHeadroom`:`plugins.headroom.actions.uninstallHeadroom`)]})})]})}function ge({label:e,value:t,good:n}){return(0,L.jsxs)(`div`,{className:`rounded-lg border border-border bg-background/45 p-2`,children:[(0,L.jsx)(`div`,{className:`text-[10px] text-muted-foreground`,children:e}),(0,L.jsx)(`div`,{className:w(`mt-0.5 font-medium`,n?`text-foreground`:`text-accent-warning`),children:t})]})}function _e({issue:e}){let{t}=a(`integrations`),n=`plugins.headroom.issues.${e.code}`,r=t(`${n}.title`,{defaultValue:e.title}),i=t(`${n}.guidance`,{defaultValue:e.guidance});return(0,L.jsx)(`div`,{className:`mb-3 rounded-lg border border-accent-warning/35 bg-accent-warning/10 p-3`,children:(0,L.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,L.jsx)(g,{className:`mt-0.5 h-3.5 w-3.5 shrink-0 text-accent-warning`}),(0,L.jsxs)(`div`,{className:`min-w-0`,children:[(0,L.jsx)(`div`,{className:`text-xs font-medium`,children:r}),(0,L.jsx)(`p`,{className:`mt-1 text-[11px] leading-relaxed text-muted-foreground`,children:i}),(0,L.jsx)(`div`,{className:`mt-1 text-[10px] text-muted-foreground`,children:t(`plugins.headroom.issueCode`,{code:e.code})})]})]})})}function ve({state:e}){let{t,i18n:n}=a(`integrations`),r=e.metrics,i=r.outputSavingsAvailable,o=[`codex`,`claude`].map(e=>({provider:e,metric:r.providers[e]})),s=t(`plugins.headroom.savings.tokens`),c=o.reduce((e,{metric:t})=>({inputTokens:e.inputTokens+t.inputTokens,inputTokensSaved:e.inputTokensSaved+t.inputTokensSaved,outputTokens:e.outputTokens+t.outputTokens,outputTokensSaved:e.outputTokensSaved+t.outputTokensSaved}),{inputTokens:0,inputTokensSaved:0,outputTokens:0,outputTokensSaved:0}),l=o.some(({metric:e})=>e.inputTokensSaved>0),u=o.some(({metric:e})=>e.active),d=t(i?`plugins.headroom.savings.statusInputOutput`:l?`plugins.headroom.savings.statusInputOnly`:u?`plugins.headroom.savings.statusRouting`:`plugins.headroom.savings.statusInactive`),f=i||l;return(0,L.jsxs)(`div`,{className:`mb-4 rounded-lg border border-border bg-background/45 p-3`,children:[(0,L.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-2`,children:[(0,L.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,L.jsx)(M,{className:`h-3.5 w-3.5 text-accent-primary`}),(0,L.jsx)(`div`,{className:`truncate text-xs font-medium`,children:t(`plugins.headroom.savings.title`)})]}),(0,L.jsx)(`span`,{className:w(`shrink-0 rounded border px-1.5 py-0.5 text-[10px]`,f?`border-accent-success/25 bg-accent-success/10 text-accent-success`:u?`border-accent-primary/25 bg-accent-primary/10 text-accent-primary`:`border-border bg-muted text-muted-foreground`),children:d})]}),(0,L.jsxs)(`div`,{className:`mb-2 rounded-md bg-muted/35 px-2.5 py-2`,children:[(0,L.jsx)(`div`,{className:`mb-1.5 text-[10px] font-medium uppercase text-muted-foreground`,children:t(`plugins.headroom.savings.totals`)}),(0,L.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,L.jsx)($,{label:t(`plugins.headroom.savings.input`),processed:c.inputTokens>0?Q(c.inputTokens,n.language,s):t(`plugins.headroom.savings.noData`),saved:Q(c.inputTokensSaved,n.language,s)}),(0,L.jsx)($,{align:`right`,label:t(`plugins.headroom.savings.output`),processed:c.outputTokens>0?Q(c.outputTokens,n.language,s):t(`plugins.headroom.savings.noData`),saved:i?Q(c.outputTokensSaved,n.language,s):t(`plugins.headroom.savings.noData`)})]})]}),(0,L.jsx)(`div`,{className:`grid gap-2`,children:o.map(({provider:e,metric:t})=>(0,L.jsx)(ye,{metric:t,outputAvailable:r.outputSavingsAvailable},e))}),(0,L.jsx)(`div`,{className:`mt-2 flex items-center justify-end gap-2 text-[10px] text-muted-foreground`,children:r.updatedAt?t(`plugins.headroom.savings.updatedLive`):t(`plugins.headroom.savings.baselineSamples`,{count:e.learning.baselineSamples})})]})}function $({label:e,processed:t,saved:n,detail:r,align:i=`left`}){let{t:o}=a(`integrations`);return(0,L.jsxs)(`div`,{className:w(`min-w-0`,i===`right`&&`text-right`),children:[(0,L.jsx)(`div`,{className:`text-[10px] font-medium uppercase text-muted-foreground`,children:e}),(0,L.jsxs)(`div`,{className:`mt-1 space-y-0.5 text-[11px]`,children:[(0,L.jsxs)(`div`,{className:`flex min-w-0 items-baseline justify-between gap-2`,children:[(0,L.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:o(`plugins.headroom.savings.processed`)}),(0,L.jsx)(`span`,{className:`truncate font-semibold tabular-nums text-foreground`,children:t})]}),(0,L.jsxs)(`div`,{className:`flex min-w-0 items-baseline justify-between gap-2`,children:[(0,L.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:o(`plugins.headroom.savings.saved`)}),(0,L.jsx)(`span`,{className:`truncate font-semibold tabular-nums text-foreground`,children:n})]})]}),r&&(0,L.jsx)(`div`,{className:`mt-1 truncate text-[10px] text-muted-foreground`,children:r})]})}function ye({metric:e,outputAvailable:t}){let{t:n,i18n:r}=a(`integrations`),i=!e.available,o=i||!e.active,s=n(`plugins.headroom.savings.tokens`),c=e.inputTokens>0?Q(e.inputTokens,r.language,s):n(`plugins.headroom.savings.noData`),l=Q(e.inputTokensSaved,r.language,s),u=e.outputTokens>0?Q(e.outputTokens,r.language,s):n(`plugins.headroom.savings.noData`),d=t?Q(e.outputTokensSaved,r.language,s):e.active?n(`plugins.headroom.savings.noData`):n(`plugins.headroom.savings.off`),f=e.requests>0?n(`plugins.headroom.savings.requestCount`,{count:Z(e.requests,r.language)}):i?n(`plugins.headroom.provider.noProjectUsesProvider`):e.active?n(`plugins.headroom.savings.inputSavingsActive`):n(`plugins.headroom.savings.routeDisabled`);return(0,L.jsxs)(`div`,{className:w(`rounded-md border border-border bg-card/45 px-2.5 py-2`,o&&`opacity-70`),children:[(0,L.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,L.jsx)(`span`,{className:`text-xs font-medium`,children:e.label}),e.detectedRoute&&(0,L.jsx)(`span`,{className:`rounded bg-accent-primary/10 px-1.5 py-0.5 text-[9px] uppercase text-accent-primary`,children:n(`plugins.headroom.savings.detected`)})]}),(0,L.jsx)(`div`,{className:`mt-0.5 truncate text-[10px] text-muted-foreground`,children:f}),(0,L.jsxs)(`div`,{className:`mt-2 grid grid-cols-2 gap-3`,children:[(0,L.jsx)($,{label:n(`plugins.headroom.savings.input`),processed:c,saved:l}),(0,L.jsx)($,{align:`right`,label:n(`plugins.headroom.savings.output`),processed:u,saved:d})]})]})}function be({provider:e,active:t,available:n,detectedRoute:r,busy:i,onClick:o}){let{t:s}=a(`integrations`),c=s(n?t?`plugins.headroom.provider.routedThroughHeadroom`:r?`plugins.headroom.provider.detectedExternalRoute`:`plugins.headroom.provider.notRouted`:`plugins.headroom.provider.noProjectUsesProvider`);return(0,L.jsxs)(`button`,{type:`button`,onClick:o,disabled:i||!n,className:`flex w-full items-center gap-3 rounded-lg border border-border bg-background/45 p-3 text-left hover:bg-muted/35 disabled:opacity-50`,children:[(0,L.jsx)(`div`,{className:w(`grid h-8 w-8 place-items-center rounded-md`,t?`bg-accent-success/15 text-accent-success`:`bg-muted text-muted-foreground`),children:i?(0,L.jsx)(p,{className:`h-3.5 w-3.5 animate-spin`}):(0,L.jsx)(N,{className:`h-3.5 w-3.5`})}),(0,L.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,L.jsx)(`div`,{className:`text-xs font-medium capitalize`,children:e}),(0,L.jsx)(`div`,{className:`text-[11px] text-muted-foreground`,children:c})]}),(0,L.jsx)(`span`,{className:w(`h-5 w-9 rounded-full p-0.5 transition-colors`,t?`bg-accent-success`:`bg-muted`),children:(0,L.jsx)(`span`,{className:w(`block h-4 w-4 rounded-full bg-white shadow transition-transform`,t&&`translate-x-4`)})})]})}function xe({plugin:e,projects:t,onClose:n}){let{t:r}=a(`integrations`),[i,o]=(0,I.useState)(``);(0,I.useEffect)(()=>o(``),[e]);let c=t.find(e=>e.id===i)??null;return(0,L.jsx)(C,{open:!!e,onOpenChange:e=>{e||n()},children:(0,L.jsxs)(S,{className:`w-[calc(100vw-2rem)] max-w-3xl overflow-x-hidden p-4 sm:p-6`,children:[(0,L.jsxs)(x,{children:[(0,L.jsx)(b,{children:r(e===`jira`?`plugins.projectWizard.configureJira`:`plugins.projectWizard.installSerena`)}),(0,L.jsx)(y,{children:r(`plugins.projectWizard.description`)})]}),(0,L.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-[260px_minmax(0,1fr)]`,children:[(0,L.jsxs)(`div`,{className:`rounded-lg border border-border bg-card/70 p-3`,children:[(0,L.jsx)(`div`,{className:`mb-2 text-xs font-medium text-muted-foreground`,children:r(`plugins.projectWizard.chooseProject`)}),(0,L.jsx)(`div`,{className:`max-h-[52vh] space-y-1 overflow-auto`,children:t.map(t=>{let n=e===`serena`&&!s(t).some(e=>se.has(e));return(0,L.jsxs)(`button`,{type:`button`,disabled:n,onClick:()=>o(t.id),className:w(`w-full rounded-md px-2 py-2 text-left transition-colors`,t.id===i?`bg-muted text-foreground`:`text-muted-foreground hover:bg-muted/45 hover:text-foreground`,n&&`cursor-not-allowed opacity-45`),children:[(0,L.jsx)(`div`,{className:`truncate text-xs font-medium`,children:t.name}),(0,L.jsx)(`div`,{className:`truncate text-[10px]`,children:n?r(`plugins.projectWizard.requiresSupportedProvider`,{defaultValue:`Requires Claude or Codex`}):t.path})]},t.id)})})]}),(0,L.jsx)(`div`,{className:`min-h-[360px] rounded-lg border border-border bg-card/70 p-4`,children:c?e===`jira`?(0,L.jsx)(Se,{project:c,onDone:n}):(0,L.jsx)(Ce,{project:c,onDone:n}):(0,L.jsx)(`div`,{className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:r(`plugins.projectWizard.selectProjectToContinue`)})})]})]})})}function Se({project:e,onDone:t}){let{t:n}=a(`integrations`),r=X(e.id),[i,o]=(0,I.useState)(null),[s,c]=(0,I.useState)(!0),[l,u]=(0,I.useState)(null),d=(0,I.useCallback)(async()=>{c(!0),u(null);try{let e=await fetch(`${r}/jira/connection`).then(e=>Y(e));o(e)}catch(e){o({connected:!1}),u(e.message)}finally{c(!1)}},[r]);return(0,I.useEffect)(()=>{d()},[d]),s?(0,L.jsxs)(`div`,{className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:[(0,L.jsx)(p,{className:`mr-2 h-4 w-4 animate-spin`}),n(`plugins.jira.loading`,{defaultValue:`Loading Jira...`})]}):i?.connected&&i.connection?(0,L.jsxs)(`div`,{className:`space-y-4`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`h3`,{className:`text-sm font-semibold`,children:n(`plugins.jira.titleForProject`,{name:e.name,defaultValue:`Jira for ${e.name}`})}),(0,L.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:n(`plugins.jira.configuredDescription`,{defaultValue:`Manage the Jira project, status mapping, discard status, sync, and connection state.`})})]}),(0,L.jsx)(W,{state:i,apiBase:r,onChanged:()=>{d()}})]}):(0,L.jsxs)(`div`,{className:`space-y-4`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`h3`,{className:`text-sm font-semibold`,children:n(`plugins.jira.titleForProject`,{name:e.name,defaultValue:`Jira for ${e.name}`})}),(0,L.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:l?n(`plugins.jira.loadFailed`,{message:l,defaultValue:`Could not load the current Jira configuration: ${l}`}):n(`plugins.jira.notConfiguredDescription`,{defaultValue:`Connect this project to Jira.`})})]}),(0,L.jsx)(R,{apiBase:r,onConnected:()=>{d()},onSkip:t})]})}function Ce({project:e,onDone:t}){let{t:n}=a(`integrations`),r=(0,I.useMemo)(()=>s(e).filter(e=>se.has(e)),[e]),i=r.includes(e.provider)?e.provider:r[0]??e.provider,[o,c]=(0,I.useState)(i),[l,f]=(0,I.useState)(null),[m,h]=(0,I.useState)(null),[_,v]=(0,I.useState)(!1),[y,b]=(0,I.useState)(null),x=(0,I.useRef)(0);(0,I.useEffect)(()=>{c(i),f(null),h(null)},[e.id,i]);let S=(0,I.useCallback)(async()=>{let t=++x.current;b(null);try{let n=`?provider=${encodeURIComponent(o)}`,r=await fetch(`${X(e.id)}/plugins${n}`).then(e=>Y(e));if(t!==x.current)return;let i=r.plugins.find(e=>e.name===`serena`)??null;if(f(i),h(null),i?.status===`not-installed`){let r=await fetch(`${X(e.id)}/plugins/serena/preview-install${n}`).then(e=>Y(e));t===x.current&&h(r)}}catch(e){t===x.current&&b(e.message)}},[e.id,o]);(0,I.useEffect)(()=>{S()},[S]);async function C(){v(!0),b(null);try{await fetch(`${X(e.id)}/plugins/serena/install`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({provider:o})}).then(e=>Y(e)),await S(),t()}catch(e){b(e.message)}finally{v(!1)}}let w=(m?.requirements??[]).every(e=>e.installed&&e.executable&&e.meetsMinimum),T=l?n(`plugins.projectStatus.${l.status}`,{defaultValue:l.status}):``,E=l?.name===`serena`?n(`plugins.catalog.serena.description`):l?.description;return!l&&!y?(0,L.jsxs)(`div`,{className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:[(0,L.jsx)(p,{className:`mr-2 h-4 w-4 animate-spin`}),` `,n(`plugins.serena.loading`)]}):(0,L.jsxs)(`div`,{className:`space-y-4`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`h3`,{className:`text-sm font-semibold`,children:n(`plugins.serena.titleForProject`,{name:e.name})}),(0,L.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:n(`plugins.serena.description`)})]}),(0,L.jsxs)(`label`,{className:`block space-y-1`,children:[(0,L.jsx)(`span`,{className:`text-xs font-medium`,children:n(`plugins.serena.provider`,{defaultValue:`AI provider`})}),(0,L.jsx)(`select`,{"aria-label":n(`plugins.serena.provider`,{defaultValue:`AI provider`}),value:o,disabled:_,onChange:e=>{f(null),h(null),c(e.target.value)},className:`w-full rounded-md border border-border bg-background px-2 py-1.5 text-xs`,children:r.map(e=>(0,L.jsx)(`option`,{value:e,children:u(e)},e))})]}),l&&(0,L.jsxs)(`div`,{className:`rounded-lg border border-border bg-background/45 p-3`,children:[(0,L.jsx)(`div`,{className:`text-xs font-medium`,children:n(`plugins.serena.status`,{status:T})}),E&&(0,L.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:E})]}),m&&(0,L.jsxs)(`div`,{className:`space-y-3`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`div`,{className:`mb-1 text-xs font-medium`,children:n(`plugins.serena.files`)}),(0,L.jsx)(`ul`,{className:`space-y-1 text-xs font-mono`,children:m.files.map(e=>(0,L.jsxs)(`li`,{className:e.op===`create`?`text-accent-success`:`text-accent-info`,children:[e.op===`create`?`+ `:`~ `,e.path]},e.path))})]}),(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`div`,{className:`mb-1 text-xs font-medium`,children:n(`plugins.serena.prerequisites`)}),(0,L.jsx)(`ul`,{className:`space-y-1 text-xs`,children:m.requirements.map(e=>(0,L.jsxs)(`li`,{className:`flex items-center gap-2`,children:[e.installed&&e.executable&&e.meetsMinimum?(0,L.jsx)(D,{className:`h-3 w-3 text-accent-success`}):(0,L.jsx)(g,{className:`h-3 w-3 text-accent-warning`}),(0,L.jsxs)(`span`,{children:[e.name,e.minVersion?` >= ${e.minVersion}`:``]}),e.version&&(0,L.jsxs)(`span`,{className:`text-muted-foreground`,children:[`(`,e.version,`)`]})]},e.name))})]})]}),y&&(0,L.jsx)(`div`,{className:`rounded-lg border border-destructive/30 bg-destructive/10 p-3 text-xs text-destructive`,children:y}),(0,L.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,L.jsx)(`button`,{type:`button`,onClick:t,className:`rounded-md border border-border px-3 py-1.5 text-xs`,children:n(`plugins.actions.cancel`)}),(0,L.jsxs)(`button`,{type:`button`,disabled:_||l?.status!==`not-installed`||!w,onClick:C,className:`flex items-center gap-2 rounded-md bg-accent-primary px-3 py-1.5 text-xs text-white disabled:opacity-50`,children:[_?(0,L.jsx)(p,{className:`h-3.5 w-3.5 animate-spin`}):(0,L.jsx)(d,{className:`h-3.5 w-3.5`}),n(`plugins.actions.install`)]})]})]})}function we({open:e,onClose:t}){let{t:n}=a(`integrations`),[i,o]=(0,I.useState)(null);return(0,I.useEffect)(()=>{e&&fetch(`${r}/api/global-plugins/headroom/diagnostics`).then(e=>Y(e)).then(o).catch(e=>o({error:e.message}))},[e]),(0,L.jsx)(C,{open:e,onOpenChange:e=>{e||t()},children:(0,L.jsxs)(S,{className:`max-w-3xl`,children:[(0,L.jsxs)(x,{children:[(0,L.jsxs)(b,{className:`flex items-center gap-2`,children:[(0,L.jsx)(F,{className:`h-4 w-4`}),` `,n(`plugins.diagnostics.title`)]}),(0,L.jsx)(y,{children:n(`plugins.diagnostics.description`)})]}),(0,L.jsx)(`pre`,{className:`max-h-[62vh] overflow-y-auto overflow-x-hidden whitespace-pre-wrap break-words rounded-lg border border-border bg-background p-3 text-xs`,children:JSON.stringify(i,null,2)})]})})}export{le as default};
@@ -1 +0,0 @@
1
- var e={title:`Agents`,subtitle:`Agent-Profile und den Katalog (Upstream + Custom) für dieses Projekt verwalten.`,tabs:{profiles:`Profile`,usage:`Nutzung`,catalog:`Katalog`},banner:{title:`Profilgestützte Pipeline erfordert specrails-core {{required}}+`,body:`Dieses Projekt hat <code>{{version}}</code>. Führe <code>{{command}}</code> im Projekt aus, um den Profilmodus freizuschalten. Hier erstellte Profile werden trotzdem gespeichert; sie wirken sich nur erst nach dem Core-Update auf die Pipeline aus.`,unknownVersion:`unbekannt`}},t={loading:`Katalog wird geladen…`,aiEditChipLabel:`AI Edit · {{agentId}}`,errors:{loadFailed:`Katalog konnte nicht geladen werden: {{status}}`,bodyLoadFailed:`Agent-Inhalt konnte nicht geladen werden: {{status}}`,generateFailed:`Generierung fehlgeschlagen: {{status}}`,agentLoadFailed:`Laden fehlgeschlagen: {{status}}`},templates:{title:`Agent-Vorlagenbibliothek`,countOf:`{{shown}} von {{total}}`,description:`Starte mit einer kuratierten Vorlage aus Engineering, Produkt, Wissenschaft, Gesundheit, Recht und mehr. Wähle eine aus und öffne sie im Studio, um sie vor dem Speichern zu prüfen und zu bearbeiten.`,searchPlaceholder:`Nach Name, Beschreibung, Tag oder Kategorie suchen…`,allCategories:`Alle`,tagFilter:`Tag-Filter:`,noMatch:`Keine Vorlagen entsprechen deinen Filtern.`,clearFilters:`Filter zurücksetzen`,openInStudio:`Im Studio öffnen →`,tip:`Tipp: Klicke auf einen Tag-Chip auf einer Karte, um nach diesem Tag zu filtern.`},generate:{title:`Custom-Agent generieren`,agentIdLabel:`Agent-ID`,agentIdHint:`Muss mit <code>custom-</code> beginnen.`,descriptionLabel:`Beschreibe, was dieser Agent tun soll`,descriptionPlaceholder:`z. B. Terraform-/IaC-Änderungen reviewen und Sicherheits-Fehlkonfigurationen, übermäßige IAM-Berechtigungen und öffentliche S3-Buckets vor dem Merge markieren. Konservativ und knapp.`,note:`Claude entwirft einen vollständigen <code>.md</code>-Inhalt. Du prüfst ihn im Studio und kannst ihn vor dem Speichern bearbeiten. Dabei wird ein einmaliger claude-Aufruf gestartet, der bis zu 90 Sekunden dauern kann.`,generating:`Wird generiert…`,generateButton:`Generieren`},empty:{title:`Keine Agents installiert`,body:`Führe <code>{{command}}</code> in diesem Projekt aus, um die Upstream-Agents zu installieren, oder erstelle jetzt einen Custom-Agent.`},actions:{template:`Vorlage`,templateTitle:`Mit einer Vorlage starten`,generate:`Generieren`,generateWithClaude:`Mit Claude generieren`,generateWithAi:`Mit KI generieren`,blank:`Leer`,blankTitle:`Mit einer leeren Vorlage starten`},sidebar:{title:`Katalog`,createLabel:`Custom-Agent erstellen:`},sections:{upstream:`Upstream ({{count}})`,upstreamDescription:`Wird von specrails-core mitgeliefert; schreibgeschützt.`,custom:`Custom ({{count}})`,customDescription:`Die custom-*.md-Dateien deines Projekts. Nutze Vorlage / Generieren / Leer oben, um einen zu erstellen.`,noCustomAgents:`Noch keine Custom-Agents.`},detail:{defaultModel:`Standardmodell: {{model}}`,aiEdit:`AI Edit`,aiEditTitle:`Diesen Agent iterativ mit KI verfeinern`,readOnly:`schreibgeschützt`,editableHint:`bearbeitbar – nutze Bearbeiten oben`},kind:{upstream:`upstream`,custom:`custom`}},n={providerLabel:`Profilanbieter`,loading:`Profile werden geladen…`,selectPrompt:`Wähle ein Profil zum Bearbeiten`,errors:{listFailed:`Auflisten fehlgeschlagen: {{status}}`,loadFailed:`Laden fehlgeschlagen: {{status}}`,migrationFailed:`Migration fehlgeschlagen: {{status}}`,createFailed:`Erstellen fehlgeschlagen: {{status}}`,duplicateFailed:`Duplizieren fehlgeschlagen: {{status}}`,deleteFailed:`Löschen fehlgeschlagen: {{status}}`,saveFailed:`Speichern fehlgeschlagen: {{status}}`},toasts:{migrated:`Profil migriert`,migratedDescription:`default-Profil aus deinen aktuellen Agents erstellt`,migrationFailed:`Migration fehlgeschlagen`,created:`Profil erstellt`,createFailed:`Profil konnte nicht erstellt werden`,duplicated:`Profil dupliziert`,duplicatedDescription:`{{from}} → {{to}}`,duplicateFailed:`Profil konnte nicht dupliziert werden`,deleted:`Profil gelöscht`,deleteFailed:`Profil konnte nicht gelöscht werden`,saved:`Profil gespeichert`,saveFailed:`Profil konnte nicht gespeichert werden`,savedWithUntargeted:`Profil mit nicht angesteuerten Agents gespeichert`,savedWithUntargetedDescription:`Keine Routing-Regel zeigt auf: {{agents}}. Füge eine Tag-Regel hinzu oder ändere das Ziel der Default-Regel, wenn sie laufen sollen.`},createDialog:{title:`Neues Profil`,description:`Wähle einen Namen in Kleinbuchstaben im kebab-case (Buchstaben, Ziffern und Bindestriche).`,confirmLabel:`Erstellen`,invalidHint:`Muss mit einem Buchstaben oder einer Ziffer beginnen und darf nur Kleinbuchstaben, Ziffern und Bindestriche enthalten.`},duplicateDialog:{title:`„{{name}}“ duplizieren`,description:`Name für das neue Profil.`,invalidHint:`Nur Kleinbuchstaben im kebab-case.`},deleteDialog:{title:`Profil „{{name}}“ löschen?`,description:`Dies kann nicht rückgängig gemacht werden. Bereits mit diesem Profil gestartete Jobs behalten ihren Snapshot; künftige Starts fallen auf die Auflösungsreihenfolge zurück.`},empty:{title:`Noch keine Profile`,body:`Mit Profilen speicherst du Kombinationen aus Orchestrator + Agents + Routing und wählst pro Rail eines aus.`,migrateButton:`Aus aktuellen Agents migrieren`,blankButton:`Leeres Profil`,migrateExplainer:`„Migrieren“ liest die Frontmatter-Modelle deiner bestehenden <code>.claude/agents/</code>-Dateien und erstellt ein <code>default</code>-Profil, das das heutige Verhalten verlustfrei abbildet.`},sidebar:{title:`Profile`,teamDefault:`(Team-Standard)`},editorFooter:{fixValidationIssues:`Behebe Validierungsprobleme vor dem Speichern`,issuesToResolve_one:`{{count}} Problem zu beheben`,issuesToResolve_other:`{{count}} Probleme zu beheben`}},r={title:`Profilnutzung`,windowLabel:`{{days}}d`,subtitleEmpty:`Gestartete Jobs pro Profil im gewählten Zeitraum.`,subtitle:`Gestartete Jobs pro Profil in den letzten {{count}} Tagen.`,empty:`Noch keine profilgebundenen Jobs.`,jobsTooltip:`Jobs`,jobsLabel_one:`Job`,jobsLabel_other:`Jobs`,successRateTooltip:`Erfolgsquote`,okSuffix:`ok`,avgDurationTooltip:`Ø Dauer`,avgTokensTooltip:`Ø Tokens`,tokensSuffix:`tok`},i={addTitle:`Routing-Regel hinzufügen`,editTitle:`Routing-Regel bearbeiten`,addDescription:`Füge eine Tag-basierte Routing-Regel mit kebab-case-Tags in Kleinbuchstaben hinzu.`,editDescription:`Aktualisiere die Tags oder den Ziel-Agent dieser Regel.`,tagsLabel:`Tags`,tagsHint:`Kommagetrennt. Verwende kebab-case in Kleinbuchstaben wie <code>frontend</code> oder <code>api-design</code>.`,invalidTags_one:`Ungültiger Tag: {{tags}}. Tags dürfen nur Kleinbuchstaben, Ziffern und Bindestriche enthalten.`,invalidTags_other:`Ungültige Tags: {{tags}}. Tags dürfen nur Kleinbuchstaben, Ziffern und Bindestriche enthalten.`,routeToLabel:`Weiterleiten an`,routeToHint:`Nur Agents in der Kette dieses Profils können Routing-Ziele sein.`,addRule:`Regel hinzufügen`,saveChanges:`Änderungen speichern`},a={profileTitle:`Agent-Profil für diese Rail`,noProfile:`Kein Profil`,modelTitle:`Modell für diese Freestyle-Rail`,loopModelTitle:`Modell für diesen Loop`,engineTitle:`KI-Anbieter für alle Rollen dieses Starts: Architekt, Entwickler und Reviewer`,localEngine:`Lokale Engine`,rolesEngine:`Rollen`,rolesEngineTitle:`Hybride Engines pro Rolle: Architect, Developer und Reviewer nutzen die Runtime-Konfiguration; Verifier und Decider nutzen die Loop-Rollen (Einstellungen ▸ Specrails-Agenten)`,rolesChip:`Engines pro Rolle`,rolesChipTitle:`Engines pro Rolle konfiguriert in Einstellungen ▸ Specrails-Agenten: Architect, Developer und Reviewer aus der Runtime-Konfiguration; Verifier und Decider aus den Loop-Rollen. Modell, Aufwand und Profil werden hier nicht gewählt.`},o={page:e,catalog:t,profiles:n,usage:r,routingRule:i,railSelectors:a};export{t as catalog,o as default,e as page,n as profiles,a as railSelectors,i as routingRule,r as usage};
@@ -1 +0,0 @@
1
- var e={title:`Agents`,subtitle:`管理此项目的 Agent Profile 和目录(上游 + 自定义)。`,tabs:{profiles:`Profile`,usage:`用量`,catalog:`目录`},banner:{title:`Profile 感知流水线需要 specrails-core {{required}}+`,body:`此项目当前为 <code>{{version}}</code>。在项目内运行 <code>{{command}}</code> 以解锁 Profile 模式。在此创建的 Profile 仍会保存,只是在 core 更新前不会影响流水线。`,unknownVersion:`未知`}},t={loading:`正在加载目录…`,aiEditChipLabel:`AI 编辑 · {{agentId}}`,errors:{loadFailed:`目录加载失败:{{status}}`,bodyLoadFailed:`Agent 正文加载失败:{{status}}`,generateFailed:`生成失败:{{status}}`,agentLoadFailed:`加载失败:{{status}}`},templates:{title:`Agent 模板库`,countOf:`{{shown}} / {{total}}`,description:`从精选模板开始,覆盖工程、产品、科学、健康、法律等领域。挑选一个并在 Studio 中打开,审阅和编辑后再保存。`,searchPlaceholder:`按名称、描述、标签或分类搜索…`,allCategories:`全部`,tagFilter:`标签筛选:`,noMatch:`没有符合筛选条件的模板。`,clearFilters:`清除筛选`,openInStudio:`在 Studio 中打开 →`,tip:`提示:点击任意卡片上的标签即可按该标签筛选。`},generate:{title:`生成自定义 Agent`,agentIdLabel:`Agent ID`,agentIdHint:`必须以 <code>custom-</code> 开头。`,descriptionLabel:`描述此 Agent 的职责`,descriptionPlaceholder:`例如:审查 Terraform/IaC 变更,在合并前标记安全配置错误、过度的 IAM 权限和公开的 S3 存储桶。风格保守、简洁。`,note:`Claude 会起草完整的 <code>.md</code> 正文。你将在 Studio 中审阅,并可在保存前编辑。此操作会启动一次性的 claude 调用,最长可能需要 90 秒。`,generating:`正在生成…`,generateButton:`生成`},empty:{title:`尚未安装任何 Agent`,body:`在此项目中运行 <code>{{command}}</code> 安装上游 Agent,或立即创建一个自定义 Agent。`},actions:{template:`模板`,templateTitle:`从模板开始`,generate:`生成`,generateWithClaude:`用 Claude 生成`,generateWithAi:`用 AI 生成`,blank:`空白`,blankTitle:`从空白模板开始`},sidebar:{title:`目录`,createLabel:`创建自定义 Agent:`},sections:{upstream:`上游({{count}})`,upstreamDescription:`由 specrails-core 提供;只读。`,custom:`自定义({{count}})`,customDescription:`项目中的 custom-*.md 文件。使用上方的模板 / 生成 / 空白来创建。`,noCustomAgents:`暂无自定义 Agent。`},detail:{defaultModel:`默认模型:{{model}}`,aiEdit:`AI 编辑`,aiEditTitle:`用 AI 迭代优化此 Agent`,readOnly:`只读`,editableHint:`可编辑——使用上方的“编辑”`},kind:{upstream:`上游`,custom:`自定义`}},n={providerLabel:`Profile 提供方`,loading:`正在加载 Profile…`,selectPrompt:`选择要编辑的 Profile`,errors:{listFailed:`列表加载失败:{{status}}`,loadFailed:`加载失败:{{status}}`,migrationFailed:`迁移失败:{{status}}`,createFailed:`创建失败:{{status}}`,duplicateFailed:`复制失败:{{status}}`,deleteFailed:`删除失败:{{status}}`,saveFailed:`保存失败:{{status}}`},toasts:{migrated:`Profile 已迁移`,migratedDescription:`已根据当前 Agent 创建 default Profile`,migrationFailed:`迁移失败`,created:`Profile 已创建`,createFailed:`创建 Profile 失败`,duplicated:`Profile 已复制`,duplicatedDescription:`{{from}} → {{to}}`,duplicateFailed:`复制 Profile 失败`,deleted:`Profile 已删除`,deleteFailed:`删除 Profile 失败`,saved:`Profile 已保存`,saveFailed:`保存 Profile 失败`,savedWithUntargeted:`Profile 已保存,但存在未被路由的 Agent`,savedWithUntargetedDescription:`没有路由规则指向:{{agents}}。如需让它们运行,请添加标签规则或调整默认规则的目标。`},createDialog:{title:`新建 Profile`,description:`请使用小写 kebab-case 名称(字母、数字和连字符)。`,confirmLabel:`创建`,invalidHint:`必须以字母或数字开头,且只能包含小写字母、数字和连字符。`},duplicateDialog:{title:`复制“{{name}}”`,description:`新 Profile 的名称。`,invalidHint:`仅限小写 kebab-case。`},deleteDialog:{title:`删除 Profile“{{name}}”?`,description:`此操作无法撤销。已使用此 Profile 启动的任务会保留其快照;之后的启动将回退到解析顺序。`},empty:{title:`暂无 Profile`,body:`Profile 可保存编排器 + Agent + 路由的组合,并为每条 rail 单独选用。`,migrateButton:`从当前 Agent 迁移`,blankButton:`空白 Profile`,migrateExplainer:`“迁移”会读取现有 <code>.claude/agents/</code> frontmatter 中的模型,并创建一个 <code>default</code> Profile,完整复刻当前行为——零损失。`},sidebar:{title:`Profile`,teamDefault:`(团队默认)`},editorFooter:{fixValidationIssues:`保存前请先修复校验问题`,issuesToResolve_one:`{{count}} 个待解决问题`,issuesToResolve_other:`{{count}} 个待解决问题`}},r={title:`Profile 用量`,windowLabel:`{{days}}天`,subtitleEmpty:`所选时间窗口内各 Profile 启动的任务数。`,subtitle:`最近 {{count}} 天内各 Profile 启动的任务数。`,empty:`暂无使用 Profile 的任务。`,jobsTooltip:`任务`,jobsLabel_one:`个任务`,jobsLabel_other:`个任务`,successRateTooltip:`成功率`,okSuffix:`成功`,avgDurationTooltip:`平均时长`,avgTokensTooltip:`平均 token 数`,tokensSuffix:`tok`},i={addTitle:`添加路由规则`,editTitle:`编辑路由规则`,addDescription:`添加按标签匹配的路由规则,标签使用小写 kebab-case。`,editDescription:`更新此规则的标签或目标 Agent。`,tagsLabel:`标签`,tagsHint:`以逗号分隔。使用小写 kebab-case,如 <code>frontend</code> 或 <code>api-design</code>。`,invalidTags_one:`无效标签:{{tags}}。标签只能使用小写字母、数字和连字符。`,invalidTags_other:`无效标签:{{tags}}。标签只能使用小写字母、数字和连字符。`,routeToLabel:`路由到`,routeToHint:`只有此 Profile 链中的 Agent 才能作为路由目标。`,addRule:`添加规则`,saveChanges:`保存更改`},a={profileTitle:`此 rail 使用的 Agent Profile`,noProfile:`无 Profile`,modelTitle:`此 Freestyle rail 使用的模型`,loopModelTitle:`此 Loop 使用的模型`,engineTitle:`本次运行所有角色使用的 AI 提供商:架构师、开发者和审查者`,localEngine:`本地引擎`,rolesEngine:`按角色`,rolesEngineTitle:`按角色的混合引擎:architect、developer 和 reviewer 使用运行时配置;verifier 和 decider 使用循环角色(设置 ▸ Specrails 代理)`,rolesChip:`按角色引擎`,rolesChipTitle:`引擎已在“设置 ▸ Specrails 代理”中按角色配置:architect、developer 和 reviewer 来自运行时配置;verifier 和 decider 来自循环角色。此处不选择模型、推理强度或配置文件。`},o={page:e,catalog:t,profiles:n,usage:r,routingRule:i,railSelectors:a};export{t as catalog,o as default,e as page,n as profiles,a as railSelectors,i as routingRule,r as usage};
@@ -1 +0,0 @@
1
- var e={title:`エージェント`,subtitle:`このプロジェクトのエージェントプロファイルとカタログ(アップストリーム + カスタム)を管理します。`,tabs:{profiles:`プロファイル`,usage:`使用状況`,catalog:`カタログ`},banner:{title:`プロファイル対応パイプラインには specrails-core {{required}}+ が必要です`,body:`このプロジェクトのバージョンは <code>{{version}}</code> です。プロジェクト内で <code>{{command}}</code> を実行するとプロファイルモードが有効になります。ここで作成したプロファイルは保存されますが、core を更新するまでパイプラインには影響しません。`,unknownVersion:`不明`}},t={loading:`カタログを読み込み中…`,aiEditChipLabel:`AI編集 · {{agentId}}`,errors:{loadFailed:`カタログの読み込みに失敗しました: {{status}}`,bodyLoadFailed:`エージェント本文の読み込みに失敗しました: {{status}}`,generateFailed:`生成に失敗しました: {{status}}`,agentLoadFailed:`読み込みに失敗しました: {{status}}`},templates:{title:`エージェントテンプレートライブラリ`,countOf:`{{shown}} / {{total}}`,description:`エンジニアリング、プロダクト、科学、医療、法務など、厳選されたテンプレートから始められます。1つ選んで Studio で開き、確認・編集してから保存してください。`,searchPlaceholder:`名前、説明、タグ、カテゴリで検索…`,allCategories:`すべて`,tagFilter:`タグフィルター:`,noMatch:`フィルターに一致するテンプレートはありません。`,clearFilters:`フィルターをクリア`,openInStudio:`Studio で開く →`,tip:`ヒント: カードのタグをクリックすると、そのタグで絞り込めます。`},generate:{title:`カスタムエージェントを生成`,agentIdLabel:`エージェント ID`,agentIdHint:`<code>custom-</code> で始まる必要があります。`,descriptionLabel:`このエージェントの役割を記述してください`,descriptionPlaceholder:`例: Terraform/IaC の変更をレビューし、マージ前にセキュリティ設定ミス、過剰な IAM 権限、公開 S3 バケットを指摘する。保守的かつ簡潔に。`,note:`Claude が完全な <code>.md</code> 本文をドラフトします。Studio で確認し、保存前に編集できます。ワンショットの claude 呼び出しが起動され、最大 90 秒かかることがあります。`,generating:`生成中…`,generateButton:`生成`},empty:{title:`エージェントがインストールされていません`,body:`このプロジェクトで <code>{{command}}</code> を実行してアップストリームのエージェントをインストールするか、今すぐカスタムエージェントを作成してください。`},actions:{template:`テンプレート`,templateTitle:`テンプレートから始める`,generate:`生成`,generateWithClaude:`Claude で生成`,generateWithAi:`AI で生成`,blank:`ブランク`,blankTitle:`空のテンプレートから始める`},sidebar:{title:`カタログ`,createLabel:`カスタムエージェントを作成:`},sections:{upstream:`アップストリーム ({{count}})`,upstreamDescription:`specrails-core 付属。読み取り専用です。`,custom:`カスタム ({{count}})`,customDescription:`このプロジェクトの custom-*.md ファイルです。上のテンプレート / 生成 / ブランクから作成できます。`,noCustomAgents:`カスタムエージェントはまだありません。`},detail:{defaultModel:`デフォルトモデル: {{model}}`,aiEdit:`AI編集`,aiEditTitle:`AI でこのエージェントを反復的に改良`,readOnly:`読み取り専用`,editableHint:`編集可能 — 上の「編集」を使用`},kind:{upstream:`アップストリーム`,custom:`カスタム`}},n={providerLabel:`プロファイルのプロバイダー`,loading:`プロファイルを読み込み中…`,selectPrompt:`編集するプロファイルを選択してください`,errors:{listFailed:`一覧の取得に失敗しました: {{status}}`,loadFailed:`読み込みに失敗しました: {{status}}`,migrationFailed:`移行に失敗しました: {{status}}`,createFailed:`作成に失敗しました: {{status}}`,duplicateFailed:`複製に失敗しました: {{status}}`,deleteFailed:`削除に失敗しました: {{status}}`,saveFailed:`保存に失敗しました: {{status}}`},toasts:{migrated:`プロファイルを移行しました`,migratedDescription:`現在のエージェントから default プロファイルを作成しました`,migrationFailed:`移行に失敗しました`,created:`プロファイルを作成しました`,createFailed:`プロファイルの作成に失敗しました`,duplicated:`プロファイルを複製しました`,duplicatedDescription:`{{from}} → {{to}}`,duplicateFailed:`プロファイルの複製に失敗しました`,deleted:`プロファイルを削除しました`,deleteFailed:`プロファイルの削除に失敗しました`,saved:`プロファイルを保存しました`,saveFailed:`プロファイルの保存に失敗しました`,savedWithUntargeted:`未ターゲットのエージェントを含むプロファイルを保存しました`,savedWithUntargetedDescription:`ルーティングルールが次のエージェントを指していません: {{agents}}。実行させたい場合は、タグルールを追加するか default ルールのターゲットを変更してください。`},createDialog:{title:`新規プロファイル`,description:`小文字のケバブケース名(英小文字、数字、ハイフン)を指定してください。`,confirmLabel:`作成`,invalidHint:`先頭は英小文字または数字で、英小文字・数字・ハイフンのみ使用できます。`},duplicateDialog:{title:`「{{name}}」を複製`,description:`新しいプロファイルの名前。`,invalidHint:`小文字のケバブケースのみ。`},deleteDialog:{title:`プロファイル「{{name}}」を削除しますか?`,description:`この操作は元に戻せません。このプロファイルで起動済みのジョブはスナップショットを保持します。今後の起動は解決順序にフォールバックします。`},empty:{title:`プロファイルはまだありません`,body:`プロファイルを使うと、オーケストレーター + エージェント + ルーティングの組み合わせを保存し、レールごとに選択できます。`,migrateButton:`現在のエージェントから移行`,blankButton:`空のプロファイル`,migrateExplainer:`「移行」は既存の <code>.claude/agents/</code> フロントマターのモデルを読み取り、現在の動作をそのまま再現する <code>default</code> プロファイルを作成します — 損失ゼロです。`},sidebar:{title:`プロファイル`,teamDefault:`(チームデフォルト)`},editorFooter:{fixValidationIssues:`保存する前に検証エラーを修正してください`,issuesToResolve_one:`未解決の問題が {{count}} 件`,issuesToResolve_other:`未解決の問題が {{count}} 件`}},r={title:`プロファイル使用状況`,windowLabel:`{{days}}日`,subtitleEmpty:`選択した期間にプロファイルごとに起動されたジョブ数。`,subtitle:`過去 {{count}} 日間にプロファイルごとに起動されたジョブ数。`,empty:`プロファイル指定のジョブはまだありません。`,jobsTooltip:`ジョブ`,jobsLabel_one:`ジョブ`,jobsLabel_other:`ジョブ`,successRateTooltip:`成功率`,okSuffix:`ok`,avgDurationTooltip:`平均実行時間`,avgTokensTooltip:`平均トークン数`,tokensSuffix:`tok`},i={addTitle:`ルーティングルールを追加`,editTitle:`ルーティングルールを編集`,addDescription:`小文字ケバブケースのタグでマッチするルーティングルールを追加します。`,editDescription:`このルールのタグまたはターゲットエージェントを更新します。`,tagsLabel:`タグ`,tagsHint:`カンマ区切り。<code>frontend</code> や <code>api-design</code> のような小文字ケバブケースを使用してください。`,invalidTags_one:`無効なタグ: {{tags}}。タグには英小文字・数字・ハイフンのみ使用できます。`,invalidTags_other:`無効なタグ: {{tags}}。タグには英小文字・数字・ハイフンのみ使用できます。`,routeToLabel:`ルーティング先`,routeToHint:`このプロファイルのチェーンに含まれるエージェントのみルーティング先に指定できます。`,addRule:`ルールを追加`,saveChanges:`変更を保存`},a={profileTitle:`このレールのエージェントプロファイル`,noProfile:`プロファイルなし`,modelTitle:`この Freestyle レールのモデル`,loopModelTitle:`このループのモデル`,engineTitle:`この実行のすべてのロール(設計、開発、レビュー)で使う AI プロバイダー`,localEngine:`ローカルエンジン`,rolesEngine:`ロール別`,rolesEngineTitle:`ロール別のハイブリッドエンジン:architect・developer・reviewer はランタイム設定を、verifier・decider はループロールを使用します(設定 ▸ Specrails エージェント)`,rolesChip:`ロール別エンジン`,rolesChipTitle:`エンジンは「設定 ▸ Specrails エージェント」でロールごとに設定済みです:architect・developer・reviewer はランタイム設定から、verifier・decider はループロールから。モデル・推論の深さ・プロファイルはここでは選びません。`},o={page:e,catalog:t,profiles:n,usage:r,routingRule:i,railSelectors:a};export{t as catalog,o as default,e as page,n as profiles,a as railSelectors,i as routingRule,r as usage};