prismalens 0.5.4 → 0.5.5

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 (109) hide show
  1. package/dist/{chunk-ZZ3DOHTJ.js → chunk-3PSZIGUA.js} +14 -2
  2. package/dist/src/cli/up.js +1 -1
  3. package/dist/src/cli/update-notice.js +1 -1
  4. package/dist/src/cli/upgrade.js +70 -10
  5. package/node_modules/@prismalens/api/dist/src/core/settings/about.service.js +28 -8
  6. package/node_modules/@prismalens/api/dist/src/core/settings/update.service.js +9 -3
  7. package/node_modules/@prismalens/api/public/assets/{AddProjectDialog-BEBKziDJ.js → AddProjectDialog-p3LLsE1B.js} +1 -1
  8. package/node_modules/@prismalens/api/public/assets/{AgentDetail-DNNZ2RSQ.js → AgentDetail-CbhnttdO.js} +1 -1
  9. package/node_modules/@prismalens/api/public/assets/{AlertsBlank-M7HkWlgo.js → AlertsBlank-CVPQuVxb.js} +1 -1
  10. package/node_modules/@prismalens/api/public/assets/Composer-DIYA4JDp.js +1 -0
  11. package/node_modules/@prismalens/api/public/assets/{HelperThread-BmGnmkL5.js → HelperThread-DNWceguA.js} +1 -1
  12. package/node_modules/@prismalens/api/public/assets/{Hint-BCpVhAvV.js → Hint-Od6cnmvm.js} +1 -1
  13. package/node_modules/@prismalens/api/public/assets/{HomeComposer-BI6Vhge8.js → HomeComposer-sotk5r71.js} +1 -1
  14. package/node_modules/@prismalens/api/public/assets/{HypothesesCard-HKxfxVbG.js → HypothesesCard-BcaBcZ8b.js} +1 -1
  15. package/node_modules/@prismalens/api/public/assets/{IncidentHeader-BIYafwD0.js → IncidentHeader-GG30mdkp.js} +1 -1
  16. package/node_modules/@prismalens/api/public/assets/{KeptWorkspaces-ozJb7lRG.js → KeptWorkspaces-B_TvW0ro.js} +1 -1
  17. package/node_modules/@prismalens/api/public/assets/{MergeDialog-DRjChRQQ.js → MergeDialog-82IoAwUo.js} +1 -1
  18. package/node_modules/@prismalens/api/public/assets/{NewThread-HisGwIRc.js → NewThread-CAT5otyD.js} +1 -1
  19. package/node_modules/@prismalens/api/public/assets/{PanelShell-BHpdPx3P.js → PanelShell-ghqMmsZW.js} +1 -1
  20. package/node_modules/@prismalens/api/public/assets/{ProjectList-lAMigyat.js → ProjectList-DAPGOIoj.js} +1 -1
  21. package/node_modules/@prismalens/api/public/assets/{ResolveDialog-DbMNHrwo.js → ResolveDialog-CPNlWRrP.js} +1 -1
  22. package/node_modules/@prismalens/api/public/assets/{RingTick-DkMvLoUV.js → RingTick-Zd_duqBv.js} +1 -1
  23. package/node_modules/@prismalens/api/public/assets/{RunStrip-CLaYEj2D.js → RunStrip-CAosRfHY.js} +1 -1
  24. package/node_modules/@prismalens/api/public/assets/{RunsMenu-CD4Yy4jT.js → RunsMenu-B9_X_90y.js} +1 -1
  25. package/node_modules/@prismalens/api/public/assets/{ScheduleDialog-DPYtmK0g.js → ScheduleDialog-DKRvxEa7.js} +1 -1
  26. package/node_modules/@prismalens/api/public/assets/{ServiceFormDialog-9-qDnObk.js → ServiceFormDialog-Bfyz7V7X.js} +1 -1
  27. package/node_modules/@prismalens/api/public/assets/{SubagentPane-exGNOprU.js → SubagentPane-DxVUfFbn.js} +1 -1
  28. package/node_modules/@prismalens/api/public/assets/{Transcript-2ke3pjya.js → Transcript-Csly_ODF.js} +4 -4
  29. package/node_modules/@prismalens/api/public/assets/{TriggerCard-BIAznpA9.js → TriggerCard-B4_zrVDz.js} +1 -1
  30. package/node_modules/@prismalens/api/public/assets/{WebhookCopy-C8w9xwD6.js → WebhookCopy-Cy9bof9B.js} +1 -1
  31. package/node_modules/@prismalens/api/public/assets/{WorkspaceFields-DCSJCThm.js → WorkspaceFields-CXSg1krp.js} +1 -1
  32. package/node_modules/@prismalens/api/public/assets/{___design-8brlEBqd.js → ___design-F8T4DJmm.js} +1 -1
  33. package/node_modules/@prismalens/api/public/assets/{_authenticated-BETuqAeS.js → _authenticated-CJYOmwQf.js} +1 -1
  34. package/node_modules/@prismalens/api/public/assets/{_id-y5y3CxjT.js → _id-0EUmYM6O.js} +1 -1
  35. package/node_modules/@prismalens/api/public/assets/{_id-B8v8uWe_.js → _id-B4P0alBy.js} +1 -1
  36. package/node_modules/@prismalens/api/public/assets/{_id-DiQnst4D.js → _id-C_OturvV.js} +1 -1
  37. package/node_modules/@prismalens/api/public/assets/{_id-BeO8QWfB.js → _id-D3aRrGal.js} +1 -1
  38. package/node_modules/@prismalens/api/public/assets/{_id-Cnh_sXTf.js → _id-Jd8V68_n.js} +1 -1
  39. package/node_modules/@prismalens/api/public/assets/{_id-VgE-Xeq5.js → _id-o6KZri3X.js} +1 -1
  40. package/node_modules/@prismalens/api/public/assets/{_id_.runs._runId-U4P5LH-M.js → _id_.runs._runId-B2eT22Ak.js} +1 -1
  41. package/node_modules/@prismalens/api/public/assets/{alerts-BI1l8Cxn.js → alerts-DkmUI_TY.js} +1 -1
  42. package/node_modules/@prismalens/api/public/assets/{automation-FhFtuS5_.js → automation-Cw0qe0-8.js} +1 -1
  43. package/node_modules/@prismalens/api/public/assets/{boxes-Dh2QZfJa.js → boxes-B__2zYVO.js} +1 -1
  44. package/node_modules/@prismalens/api/public/assets/check-C96xWdLm.js +1 -0
  45. package/node_modules/@prismalens/api/public/assets/chevron-left-S6eOHk4C.js +1 -0
  46. package/node_modules/@prismalens/api/public/assets/chevron-right-DXWfiPu3.js +1 -0
  47. package/node_modules/@prismalens/api/public/assets/circle-Dy7W2aR3.js +1 -0
  48. package/node_modules/@prismalens/api/public/assets/{command-chip-5Lf0FARB.js → command-chip-BFhgzAY5.js} +1 -1
  49. package/node_modules/@prismalens/api/public/assets/{conversation-CXkaesO_.js → conversation-Cf7_OnZb.js} +1 -1
  50. package/node_modules/@prismalens/api/public/assets/{copy-BUnkkIK-.js → copy-_5FNPl7W.js} +1 -1
  51. package/node_modules/@prismalens/api/public/assets/desktop-yb-lqHMd.js +9 -0
  52. package/node_modules/@prismalens/api/public/assets/{device-name-CZPntaj6.js → device-name-CxC_JUpj.js} +1 -1
  53. package/node_modules/@prismalens/api/public/assets/{dist-CYLssYEL.js → dist-CtE2KbbF.js} +1 -1
  54. package/node_modules/@prismalens/api/public/assets/{dist-CQz4Osl1.js → dist-zIr1CK3Q.js} +1 -1
  55. package/node_modules/@prismalens/api/public/assets/{dropdown-menu-Db9u3UIb.js → dropdown-menu-yoILSLgJ.js} +1 -1
  56. package/node_modules/@prismalens/api/public/assets/{ellipsis-d1vABf4v.js → ellipsis-BsNLvnl9.js} +1 -1
  57. package/node_modules/@prismalens/api/public/assets/{evidence-files-C9UcJR1J.js → evidence-files-C_a9Ct8m.js} +1 -1
  58. package/node_modules/@prismalens/api/public/assets/{fixes-CgjsPkfr.js → fixes-BWFKY2Zx.js} +1 -1
  59. package/node_modules/@prismalens/api/public/assets/{folder-git-2-DRsiaeAx.js → folder-git-2-Co_pliwR.js} +1 -1
  60. package/node_modules/@prismalens/api/public/assets/{globe-D2S-zGel.js → globe-C0OZE9Nx.js} +1 -1
  61. package/node_modules/@prismalens/api/public/assets/{highlighted-body-JLMTFACH-B_v9yJZa.js → highlighted-body-JLMTFACH-DGWjXpHw.js} +1 -1
  62. package/node_modules/@prismalens/api/public/assets/{incidents-B0KnIveX.js → incidents-TJ2Rty4H.js} +1 -1
  63. package/node_modules/@prismalens/api/public/assets/{index-DZMj9YK4.js → index-BoI68UdU.js} +6 -6
  64. package/node_modules/@prismalens/api/public/assets/{key-CjFGD02m.js → key-BjaZOgBI.js} +1 -1
  65. package/node_modules/@prismalens/api/public/assets/{live-refresh-C5Jfxdxb.js → live-refresh-DlFUKDgl.js} +1 -1
  66. package/node_modules/@prismalens/api/public/assets/mermaid-WFAXDIZX-BQk6GVWB.js +1 -0
  67. package/node_modules/@prismalens/api/public/assets/{new-Ci475pgf.js → new-Bo1xcbFc.js} +1 -1
  68. package/node_modules/@prismalens/api/public/assets/{pair-CobM73_c.js → pair-BePmSLQZ.js} +1 -1
  69. package/node_modules/@prismalens/api/public/assets/{pencil-BwNhunJy.js → pencil-CKAiE_29.js} +1 -1
  70. package/node_modules/@prismalens/api/public/assets/plus-f3bDJe68.js +1 -0
  71. package/node_modules/@prismalens/api/public/assets/projects-Cwgyv1jw.js +1 -0
  72. package/node_modules/@prismalens/api/public/assets/{restart-40l7XMmi.js → restart-FIcq7DzH.js} +1 -1
  73. package/node_modules/@prismalens/api/public/assets/{route-DX3TI7JD.js → route-1kdlRYKk.js} +1 -1
  74. package/node_modules/@prismalens/api/public/assets/{route-Dvao2bBW.js → route-CLgiK_od.js} +1 -1
  75. package/node_modules/@prismalens/api/public/assets/{route-Bg17GbpR.js → route-q1BFinlW.js} +1 -1
  76. package/node_modules/@prismalens/api/public/assets/{route-ah1SnYbH.js → route-rOkhgLEt.js} +1 -1
  77. package/node_modules/@prismalens/api/public/assets/{run-details-DTzMO1X0.js → run-details-B1I5SE7k.js} +1 -1
  78. package/node_modules/@prismalens/api/public/assets/{run-labels-ubQZmnqd.js → run-labels-BLTL5eG9.js} +1 -1
  79. package/node_modules/@prismalens/api/public/assets/{select-98_n4DVz.js → select-hkRu0Dxf.js} +1 -1
  80. package/node_modules/@prismalens/api/public/assets/{service-detail.utils-ulWHS1Ao.js → service-detail.utils-BQfYgq-F.js} +1 -1
  81. package/node_modules/@prismalens/api/public/assets/{services-CZQMzqYj.js → services-CnYlTAN3.js} +1 -1
  82. package/node_modules/@prismalens/api/public/assets/{settings-QPxeIS82.js → settings-COMwARMq.js} +1 -1
  83. package/node_modules/@prismalens/api/public/assets/{source-words-B5oOdiQU.js → source-words-CCeTLwOy.js} +1 -1
  84. package/node_modules/@prismalens/api/public/assets/{state-tone-DEsvSFn6.js → state-tone-DOGSNxJV.js} +1 -1
  85. package/node_modules/@prismalens/api/public/assets/{switch-DpPkkZxw.js → switch-u0tmvVOg.js} +1 -1
  86. package/node_modules/@prismalens/api/public/assets/{theme-provider-C9jvt7JX.js → theme-provider-Cg3suR2p.js} +1 -1
  87. package/node_modules/@prismalens/api/public/assets/{threads-BqAHgCGd.js → threads-Pk0lpo7I.js} +1 -1
  88. package/node_modules/@prismalens/api/public/assets/{tick-copy-B7dbIrfQ.js → tick-copy-DPjahm-5.js} +1 -1
  89. package/node_modules/@prismalens/api/public/assets/{use-operator-BH6GxjAY.js → use-operator-BdSmIxpm.js} +1 -1
  90. package/node_modules/@prismalens/api/public/assets/{use-repositories-orpc-c6hPOKjE.js → use-repositories-orpc-Ban_zGD7.js} +1 -1
  91. package/node_modules/@prismalens/api/public/assets/{use-threads-orpc-rBrvQXJf.js → use-threads-orpc-mbpsuq3G.js} +1 -1
  92. package/node_modules/@prismalens/api/public/assets/{useInvestigationRun-xdB0R08B.js → useInvestigationRun-BJKQxOF2.js} +1 -1
  93. package/node_modules/@prismalens/api/public/assets/{useQueries-CGpidxif.js → useQueries-B6U7UAZl.js} +1 -1
  94. package/node_modules/@prismalens/api/public/index.html +2 -2
  95. package/node_modules/@prismalens/config/dist/index.js +2 -1
  96. package/node_modules/@prismalens/config/dist/utils/install-channel.js +3 -3
  97. package/node_modules/@prismalens/config/dist/utils/update-channel.js +65 -0
  98. package/node_modules/@prismalens/config/dist/utils/update-check.js +67 -34
  99. package/node_modules/@prismalens/contracts/dist/schemas/settings.js +16 -0
  100. package/package.json +3 -2
  101. package/node_modules/@prismalens/api/public/assets/Composer-MAXlRLhF.js +0 -1
  102. package/node_modules/@prismalens/api/public/assets/check-DfKru7HJ.js +0 -1
  103. package/node_modules/@prismalens/api/public/assets/chevron-left-DWLaEwl8.js +0 -1
  104. package/node_modules/@prismalens/api/public/assets/chevron-right-tPbGnTHi.js +0 -1
  105. package/node_modules/@prismalens/api/public/assets/circle-BqIhGHXt.js +0 -1
  106. package/node_modules/@prismalens/api/public/assets/desktop-Bqso9PNq.js +0 -9
  107. package/node_modules/@prismalens/api/public/assets/mermaid-WFAXDIZX-CqliGVff.js +0 -1
  108. package/node_modules/@prismalens/api/public/assets/plus-DWSahnrj.js +0 -1
  109. package/node_modules/@prismalens/api/public/assets/projects-CIckRlw8.js +0 -1
@@ -1,6 +1,8 @@
1
1
  // src/cli/update-notice.ts
2
2
  import {
3
3
  doNotTrack,
4
+ effectiveUpdateChannel,
5
+ installChannel,
4
6
  isNewer,
5
7
  isStale,
6
8
  readCache,
@@ -40,10 +42,20 @@ function updateNotice(options) {
40
42
  if (!updateCheckEnabled(env, stdoutIsTTY)) {
41
43
  return { line: null, refresh: Promise.resolve() };
42
44
  }
43
- const cache = readCache(workspaceDir);
45
+ const channel = effectiveUpdateChannel(
46
+ workspaceDir,
47
+ installChannel(env),
48
+ env
49
+ );
50
+ const cache = readCache(workspaceDir, channel);
44
51
  const line = noticeFor(cache?.latest ?? null, current);
45
52
  if (!isStale(cache, now)) return { line, refresh: Promise.resolve() };
46
- const refresh = refreshUpdateCache(workspaceDir, fetchImpl).catch(() => {
53
+ const refresh = refreshUpdateCache(
54
+ workspaceDir,
55
+ fetchImpl,
56
+ Date.now(),
57
+ channel
58
+ ).catch(() => {
47
59
  });
48
60
  return { line, refresh };
49
61
  }
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  updateNotice
3
- } from "../../chunk-ZZ3DOHTJ.js";
3
+ } from "../../chunk-3PSZIGUA.js";
4
4
  import {
5
5
  cliVersion
6
6
  } from "../../chunk-HPE5CTO4.js";
@@ -9,7 +9,7 @@ import {
9
9
  updateCheckEnabled,
10
10
  updateNotice,
11
11
  writeCache
12
- } from "../../chunk-ZZ3DOHTJ.js";
12
+ } from "../../chunk-3PSZIGUA.js";
13
13
  export {
14
14
  fetchLatestVersion,
15
15
  isNewer,
@@ -2,7 +2,7 @@ import {
2
2
  fetchLatestVersion,
3
3
  isNewer,
4
4
  releaseReady
5
- } from "../../chunk-ZZ3DOHTJ.js";
5
+ } from "../../chunk-3PSZIGUA.js";
6
6
  import {
7
7
  cliVersion
8
8
  } from "../../chunk-HPE5CTO4.js";
@@ -33,6 +33,10 @@ import "../../chunk-NXTEM2HN.js";
33
33
  // src/cli/upgrade.ts
34
34
  import { spawnSync } from "node:child_process";
35
35
  import { join } from "node:path";
36
+ import {
37
+ isExactVersion,
38
+ NIGHTLY_NPM_ONLY
39
+ } from "@prismalens/config";
36
40
  import { defineCommand } from "citty";
37
41
  import consola from "consola";
38
42
  function upgradeEnv(env = process.env, platform = process.platform) {
@@ -61,6 +65,37 @@ function switchBackFor(config, channel, version) {
61
65
  return `${channel} can't reinstall ${version}; install it with the installer or npm`;
62
66
  };
63
67
  }
68
+ function commandVersion(channel, pinned, target) {
69
+ return pinned ?? (channel === "npm" ? target : void 0);
70
+ }
71
+ function pinnedVersionValid(version, channel) {
72
+ if (channel === "npm") return isExactVersion(version);
73
+ return /^\d+\.\d+\.\d+$/.test(version);
74
+ }
75
+ function resolveUpdateChannel(config, workspace, channel, requested, env = process.env) {
76
+ let saveNote;
77
+ if (requested !== void 0) {
78
+ const wanted = requested.trim().toLowerCase();
79
+ if (wanted !== "stable" && wanted !== "nightly")
80
+ return {
81
+ error: `--channel takes stable or nightly, not "${requested}".`
82
+ };
83
+ if (wanted === "nightly" && config.nightlyBlockedBy(channel))
84
+ return { error: NIGHTLY_NPM_ONLY };
85
+ config.writeUpdateChannel(workspace, wanted);
86
+ const read = config.readUpdateChannel(workspace, env);
87
+ saveNote = read === wanted ? `Release channel set to ${wanted}.` : `Release channel saved as ${wanted}, but PRISMALENS_UPDATE_CHANNEL=${read} overrides it while it is set.`;
88
+ }
89
+ const saved = config.readUpdateChannel(workspace, env);
90
+ if (saved === "nightly" && config.nightlyBlockedBy(channel)) {
91
+ const fallback = `This copy was installed with ${channel}, so it follows stable. ${NIGHTLY_NPM_ONLY}`;
92
+ return {
93
+ channel: "stable",
94
+ note: saveNote ? `${saveNote} ${fallback}` : fallback
95
+ };
96
+ }
97
+ return saveNote ? { channel: saved, note: saveNote } : { channel: saved };
98
+ }
64
99
  function upgradeArgv(channel, version, platform = process.platform) {
65
100
  switch (channel) {
66
101
  case "npm":
@@ -96,6 +131,10 @@ var upgrade_default = defineCommand({
96
131
  type: "string",
97
132
  description: "Install this version instead of the newest"
98
133
  },
134
+ channel: {
135
+ type: "string",
136
+ description: "Follow this release channel from now on: stable (the default) or nightly (npm installs only)"
137
+ },
99
138
  check: {
100
139
  type: "boolean",
101
140
  description: "Only say whether a newer version exists"
@@ -110,10 +149,24 @@ var upgrade_default = defineCommand({
110
149
  const config = await import("@prismalens/config");
111
150
  const current = cliVersion();
112
151
  const channel = config.installChannel();
152
+ const service = config.installedService();
153
+ const workspace = service?.workspace ?? config.getAppDataDir();
154
+ const chosen = resolveUpdateChannel(
155
+ config,
156
+ workspace,
157
+ channel,
158
+ args.channel === void 0 ? void 0 : String(args.channel)
159
+ );
160
+ if ("error" in chosen) {
161
+ consola.error(chosen.error);
162
+ process.exit(1);
163
+ }
164
+ if (chosen.note) consola.info(chosen.note);
165
+ const updateChannel = chosen.channel;
113
166
  const pinned = args.version ? String(args.version).replace(/^v/, "") : null;
114
- if (pinned && !/^\d+\.\d+\.\d+$/.test(pinned)) {
167
+ if (pinned && !pinnedVersionValid(pinned, channel)) {
115
168
  consola.error(
116
- `--version takes a plain version like 0.5.1, not "${pinned}".`
169
+ channel === "npm" ? `--version takes an exact version like 0.5.1 or 0.5.2-nightly.20261111.1, not "${pinned}".` : `--version takes a plain version like 0.5.1, not "${pinned}".`
117
170
  );
118
171
  process.exit(1);
119
172
  }
@@ -139,15 +192,20 @@ var upgrade_default = defineCommand({
139
192
  }
140
193
  target = pinned;
141
194
  } else {
142
- const latest = await fetchLatestVersion();
195
+ const latest = await fetchLatestVersion(fetch, updateChannel);
143
196
  if (!latest) {
144
197
  consola.error(
145
- "Couldn't reach GitHub to find the newest release. Pass --version to pick one."
198
+ `Couldn't reach ${updateChannel === "nightly" ? "npm" : "GitHub"} to find the newest release. Pass --version to pick one.`
146
199
  );
147
200
  process.exit(1);
148
201
  }
149
202
  if (!isNewer(latest, current)) {
150
- consola.success(`PrismaLens ${current} is the newest release.`);
203
+ const note = updateChannel === "stable" ? config.leavingNightlyNote(current, latest) : null;
204
+ if (note) consola.info(note);
205
+ else
206
+ consola.success(
207
+ `PrismaLens ${current} is the newest ${updateChannel} release.`
208
+ );
151
209
  return;
152
210
  }
153
211
  if (channel !== "npm" && !await releaseReady(latest)) {
@@ -161,11 +219,12 @@ var upgrade_default = defineCommand({
161
219
  const command = config.upgradeCommand(
162
220
  channel,
163
221
  process.platform,
164
- pinned ?? void 0
222
+ commandVersion(channel, pinned, target),
223
+ updateChannel
165
224
  );
166
225
  if (args.check) {
167
226
  consola.info(
168
- `${target} is available (you have ${current}, installed with ${channel}). Upgrade with: pl upgrade${pinned ? ` --version ${pinned}` : ""}`
227
+ `${target} is available on the ${updateChannel} channel (you have ${current}, installed with ${channel}). Upgrade with: pl upgrade${pinned ? ` --version ${pinned}` : ""}`
169
228
  );
170
229
  return;
171
230
  }
@@ -174,9 +233,7 @@ var upgrade_default = defineCommand({
174
233
  consola.info(`The desktop app upgrades by download: ${command}`);
175
234
  return;
176
235
  }
177
- const service = config.installedService();
178
236
  const kind = config.serviceManagerKind();
179
- const workspace = service?.workspace ?? config.getAppDataDir();
180
237
  const uid = process.getuid?.() ?? 0;
181
238
  const viaService = kind !== null && service !== null;
182
239
  const startService = () => !viaService || runAction(kind, "start", service.unitPath, uid);
@@ -291,7 +348,10 @@ var upgrade_default = defineCommand({
291
348
  }
292
349
  });
293
350
  export {
351
+ commandVersion,
294
352
  upgrade_default as default,
353
+ pinnedVersionValid,
354
+ resolveUpdateChannel,
295
355
  switchBackFor,
296
356
  upgradeArgv,
297
357
  upgradeEnv
@@ -8,7 +8,7 @@ import { readdirSync } from "node:fs";
8
8
  import { release as osRelease, type as osType } from "node:os";
9
9
  import { join } from "node:path";
10
10
  import { Injectable } from "@nestjs/common";
11
- import { getAppDataDir, installChannel, installedService, isNewer, isStale, RELEASES_URL, readCache, refreshUpdateCache, uninstallCommand, updateCheckDisabledBy, upgradeCommand, } from "@prismalens/config";
11
+ import { effectiveUpdateChannel, getAppDataDir, installChannel, installedService, isNewer, isStale, isUpdateChannel, leavingNightlyNote, nightlyBlockedBy, RELEASES_URL, readCache, refreshUpdateCache, uninstallCommand, updateCheckDisabledBy, upgradeCommand, } from "@prismalens/config";
12
12
  import { resolveServiceBuild, resolveServiceVersion, } from "../../shared/utils/service-version.js";
13
13
  export function resolveLogDir(env, workspaceDir) {
14
14
  return env.PRISMALENS_LOG_FILE_LOCATION || join(workspaceDir, "logs");
@@ -31,21 +31,33 @@ let AboutService = class AboutService {
31
31
  env = process.env;
32
32
  fetchImpl = fetch;
33
33
  now = Date.now;
34
+ async refresh(workspaceDir, channel) {
35
+ while (this.refreshing && this.refreshing.channel !== channel)
36
+ await this.refreshing.done;
37
+ if (!this.refreshing) {
38
+ const done = refreshUpdateCache(workspaceDir, this.fetchImpl, this.now(), channel).finally(() => {
39
+ if (this.refreshing?.done === done)
40
+ this.refreshing = null;
41
+ });
42
+ this.refreshing = { channel, done };
43
+ }
44
+ await this.refreshing.done;
45
+ }
34
46
  async get(opts = {}) {
35
47
  const workspaceDir = getAppDataDir();
36
48
  const channel = installChannel(this.env);
37
49
  const disabledBy = updateCheckDisabledBy(this.env);
38
50
  const checking = !disabledBy && opts.checkEnabled !== false;
51
+ const updateChannel = effectiveUpdateChannel(workspaceDir, channel, this.env);
39
52
  if (checking &&
40
- (opts.force || isStale(readCache(workspaceDir), this.now()))) {
41
- this.refreshing ??= refreshUpdateCache(workspaceDir, this.fetchImpl, this.now()).finally(() => {
42
- this.refreshing = null;
43
- });
44
- await this.refreshing;
53
+ (opts.force ||
54
+ isStale(readCache(workspaceDir, updateChannel), this.now()))) {
55
+ await this.refresh(workspaceDir, updateChannel);
45
56
  }
46
- const cache = checking ? readCache(workspaceDir) : null;
57
+ const cache = checking ? readCache(workspaceDir, updateChannel) : null;
47
58
  const latest = cache?.latest ?? null;
48
59
  const available = latest !== null && isNewer(latest, this.version);
60
+ const envChannel = this.env.PRISMALENS_UPDATE_CHANNEL?.trim().toLowerCase();
49
61
  return {
50
62
  version: this.version,
51
63
  channel,
@@ -59,7 +71,7 @@ let AboutService = class AboutService {
59
71
  disabledBy,
60
72
  releaseNotesUrl: latest ? `${RELEASES_URL}/tag/v${latest}` : null,
61
73
  },
62
- upgradeCommand: upgradeCommand(channel),
74
+ upgradeCommand: upgradeCommand(channel, process.platform, undefined, updateChannel),
63
75
  uninstallCommand: installedService()
64
76
  ? `pl service uninstall && ${uninstallCommand(channel)}`
65
77
  : uninstallCommand(channel),
@@ -70,6 +82,14 @@ let AboutService = class AboutService {
70
82
  arch: process.arch,
71
83
  },
72
84
  checkForUpdates: opts.checkEnabled !== false,
85
+ updateChannel: {
86
+ current: updateChannel,
87
+ fromEnv: isUpdateChannel(envChannel),
88
+ nightlyBlockedBy: nightlyBlockedBy(channel),
89
+ leavingNightly: updateChannel === "stable"
90
+ ? leavingNightlyNote(this.version, latest)
91
+ : null,
92
+ },
73
93
  };
74
94
  }
75
95
  };
@@ -17,7 +17,7 @@ import { join } from "node:path";
17
17
  import { fileURLToPath } from "node:url";
18
18
  import { stripVTControlCharacters } from "node:util";
19
19
  import { Injectable, Logger, Optional, } from "@nestjs/common";
20
- import { autoInstallBlockedBy, getAppDataDir, installChannel, installerArgv, installerDataDir, installerEnv, isNewer, RESTART_EXIT_CODE, readCache, releaseNotesFor, resolvePort, underServiceManager, updateCheckDisabledBy, upgradeCommand, } from "@prismalens/config";
20
+ import { autoInstallBlockedBy, effectiveUpdateChannel, getAppDataDir, installChannel, installerArgv, installerDataDir, installerEnv, isNewer, NIGHTLY_NPM_ONLY, nightlyBlockedBy, RESTART_EXIT_CODE, readCache, releaseNotesFor, resolvePort, underServiceManager, updateCheckDisabledBy, upgradeCommand, writeUpdateChannel, } from "@prismalens/config";
21
21
  import { resolveServiceVersion } from "../../shared/utils/service-version.js";
22
22
  import { AdmissionService } from "../lifecycle/admission.service.js";
23
23
  import { requestRestartExit } from "../lifecycle/restart-exit.js";
@@ -92,7 +92,13 @@ let UpdateService = UpdateService_1 = class UpdateService {
92
92
  async setPrefs(input, host) {
93
93
  if (!host)
94
94
  throw new UpdateRefused("FORBIDDEN", "Only the owner can change updates.");
95
- const next = { ...(await this.prefs()), ...input };
95
+ const { channel, ...rest } = input;
96
+ if (channel) {
97
+ if (channel === "nightly" && nightlyBlockedBy(installChannel(this.env)))
98
+ throw new UpdateRefused("BAD_REQUEST", NIGHTLY_NPM_ONLY);
99
+ writeUpdateChannel(getAppDataDir(), channel);
100
+ }
101
+ const next = { ...(await this.prefs()), ...rest };
96
102
  const value = JSON.stringify(next);
97
103
  await this.prisma.setting.upsert({
98
104
  where: { key: PREFS_KEY },
@@ -148,7 +154,7 @@ let UpdateService = UpdateService_1 = class UpdateService {
148
154
  const base = {
149
155
  ...this.status,
150
156
  draining: this.admission?.draining ?? false,
151
- upgradeCommand: upgradeCommand(channel, this.platform),
157
+ upgradeCommand: upgradeCommand(channel, this.platform, undefined, effectiveUpdateChannel(getAppDataDir(), channel, this.env)),
152
158
  };
153
159
  if (this.status.phase !== "idle")
154
160
  return base;
@@ -1 +1 @@
1
- import{_t as e,a as t,c as n,t as r}from"./desktop-Bqso9PNq.js";import{n as i,r as a,t as o}from"./switch-DpPkkZxw.js";import{n as s,t as c}from"./globe-D2S-zGel.js";import{a as l,n as u,t as d}from"./jsx-runtime-Wy9s6hX0.js";import{t as f}from"./button-DmIfWVZ8.js";import{b as p,v as m,w as ee,y as h}from"./use-repositories-orpc-c6hPOKjE.js";import{t as g}from"./input-CXxt1dAV.js";import{r as _}from"./use-operator-BH6GxjAY.js";import{t as v}from"./folder-git-2-DRsiaeAx.js";import{t as y}from"./utils-A3okWeke.js";var b={name:`folder`,size:24,node:[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]};b.node;var x=t(b),S=l(u(),1),C=/^(https?:\/\/|ssh:\/\/|git:\/\/|[\w.-]+@[\w.-]+:)/,w=e=>C.test(e.trim()),T={folder:`Folder`,repo:`Repo`,remote:`Remote repo`},E={folder:x,repo:v,remote:c};function D(e){let t=e.trim();if(!t)return{dir:null,prefix:``};let n=Math.max(t.lastIndexOf(`/`),t.lastIndexOf(`\\`));return n<0?{dir:t,prefix:``}:{dir:t.slice(0,n+1),prefix:t.slice(n+1)}}function O(e,t,n){let r=t.toLowerCase();return e.filter(e=>(n||!e.hidden||r.startsWith(`.`))&&e.name.toLowerCase().startsWith(r))}function k(e,t,n){if(w(e))return`remote`;if(!t?.ok||!e.trim())return null;if(!n)return t.git?`repo`:`folder`;let r=t.entries.find(e=>e.name===n);return r?r.git||t.git?`repo`:`folder`:null}var A={denied:`No access here`,missing:`No such folder`,timeout:`Took too long`,"not-folder":`Not a folder`,"not-absolute":`Type a full path`,link:`Goes through a link`,busy:`Folder reads busy`},j=`pl.recentProjects`,M=5;function N(){try{let e=JSON.parse(localStorage.getItem(j)??`[]`);return Array.isArray(e)?e.filter(e=>typeof e==`string`).slice(0,M):[]}catch{return[]}}function P(e){try{let t=[e,...N().filter(t=>t!==e)];localStorage.setItem(j,JSON.stringify(t.slice(0,M)))}catch{}}function te(e){let t=e.trim();return/^[A-Za-z]:[\\/]$|^\/$/.test(t)?t:t.replace(/[\\/]+$/,``)}var F=d();function I({open:t,onOpenChange:c,onChoose:l,title:u=`Add project`,submitLabel:d=`Add`,folderOnly:v=!1,pending:b=!1,error:x=null}){let[C,j]=(0,S.useState)(``),[M,I]=(0,S.useState)(!1),[L,R]=(0,S.useState)(!!r()?.pickFolder);(0,S.useEffect)(()=>{t&&j(``)},[t]);let{managesPairing:z}=_(),B=!v&&w(C),{dir:V,prefix:H}=D((0,S.useDeferredValue)(C)),U=e({...n.repositories.browseFolders.queryOptions({input:{path:V}}),enabled:t&&z&&!B,staleTime:5e3,placeholderData:e=>e}).data,W=v?null:k(C,U,H),G=U?.ok?O(U.entries,H,M):[],K=C?[]:N(),q=te(C),J=e=>{e&&!b&&(P(e),l(e))},Y=e=>{e.preventDefault(),J(q)},X=async()=>{let e=await r()?.pickFolder?.();if(!e||`unavailable`in e)return R(!1);e.path&&j(e.path)},Z=U?.ok&&U.path.includes(`\\`)?`\\`:`/`,Q=e=>j(e.endsWith(Z)?e:`${e}${Z}`),$=W?E[W]:null;return(0,F.jsx)(h,{open:t,onOpenChange:c,children:(0,F.jsxs)(p,{className:y(m.sm,`grid gap-3`),"data-testid":`add-project-dialog`,children:[(0,F.jsx)(ee,{children:u}),(0,F.jsxs)(`form`,{onSubmit:Y,className:`grid gap-2`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsx)(g,{autoFocus:!0,value:C,onChange:e=>j(e.target.value),placeholder:v?`Folder`:`Folder or git URL`,"aria-label":v?`Folder`:`Folder or git URL`,className:`min-w-0 flex-1 font-mono`,"data-testid":`add-project-source`}),L&&z&&(0,F.jsxs)(f,{type:`button`,variant:`secondary`,onClick:()=>void X(),"data-testid":`add-project-native`,children:[(0,F.jsx)(s,{}),`Choose`]})]}),$&&W&&(0,F.jsxs)(`span`,{className:`flex items-center gap-1.5 text-meta text-text-2`,"data-testid":`add-project-kind`,"data-kind":W,children:[(0,F.jsx)($,{className:`size-3.5`,"aria-hidden":!0}),T[W]]}),z&&!B&&(0,F.jsxs)(`div`,{className:`grid gap-1.5 rounded-surface bg-surface-1 p-2`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsxs)(f,{type:`button`,variant:`text`,size:`sm`,disabled:!U?.ok||!U.parent,onClick:()=>U?.ok&&U.parent&&Q(U.parent),"data-testid":`add-project-up`,children:[(0,F.jsx)(a,{}),`Up`]}),(0,F.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-meta text-text-3`,children:U?.path}),(0,F.jsxs)(`label`,{className:`flex items-center gap-1.5 text-meta text-text-2`,children:[(0,F.jsx)(o,{checked:M,onCheckedChange:I,"data-testid":`add-project-hidden`}),`Hidden`]})]}),K.length>0&&(0,F.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:K.map(e=>(0,F.jsxs)(`button`,{type:`button`,onClick:()=>j(e),className:`flex max-w-full items-center gap-1 rounded-control px-1.5 py-0.5 text-meta text-text-2 hover:bg-surface-3`,"data-testid":`add-project-recent`,children:[(0,F.jsx)(i,{className:`size-3 shrink-0`,"aria-hidden":!0}),(0,F.jsx)(`span`,{className:`truncate font-mono`,children:e})]},e))}),U&&!U.ok?(0,F.jsx)(`p`,{className:`px-1 py-1 text-meta text-text-3`,"data-testid":`add-project-browse-error`,"data-error":U.error,children:A[U.error]}):(0,F.jsxs)(`ul`,{className:`grid max-h-56 gap-px overflow-y-auto`,"aria-label":`Folders`,"data-testid":`add-project-entries`,children:[G.map(e=>{let t=E[e.git?`repo`:`folder`];return(0,F.jsx)(`li`,{children:(0,F.jsxs)(`button`,{type:`button`,onClick:()=>Q(e.path),className:`flex h-8 w-full items-center gap-2 rounded-control px-2 text-left text-body text-text-1 hover:bg-surface-3`,"data-testid":`add-project-entry`,children:[(0,F.jsx)(t,{className:`size-4 shrink-0 text-text-3`,"aria-hidden":!0}),(0,F.jsx)(`span`,{className:`min-w-0 truncate`,children:e.name})]})},e.path)}),U?.ok&&G.length===0&&(0,F.jsx)(`li`,{className:`px-2 py-1 text-meta text-text-3`,children:`No folders`}),U?.ok&&U.truncated&&(0,F.jsx)(`li`,{className:`px-2 py-1 text-meta text-text-3`,children:`More not shown`})]})]}),x&&(0,F.jsx)(`p`,{className:`text-meta text-danger`,role:`alert`,"data-testid":`add-project-error`,children:x}),(0,F.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,F.jsx)(f,{type:`button`,variant:`text`,onClick:()=>c(!1),children:`Cancel`}),(0,F.jsx)(f,{type:`submit`,disabled:!q||b,"data-testid":`add-project-submit`,children:d})]})]})]})})}function L({onPick:e,folderOnly:t=!1,disabled:n=!1,testId:r=`browse-folder`}){let[i,a]=(0,S.useState)(!1);return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(f,{type:`button`,variant:`secondary`,disabled:n,onClick:()=>a(!0),"data-testid":r,children:[(0,F.jsx)(s,{}),`Browse`]}),i&&(0,F.jsx)(I,{open:!0,onOpenChange:a,title:t?`Choose a folder`:`Choose code`,submitLabel:`Use`,folderOnly:t,onChoose:t=>{e(t),a(!1)}})]})}export{T as i,L as n,E as r,I as t};
1
+ import{_t as e,a as t,c as n,t as r}from"./desktop-yb-lqHMd.js";import{n as i,r as a,t as o}from"./switch-u0tmvVOg.js";import{n as s,t as c}from"./globe-C0OZE9Nx.js";import{a as l,n as u,t as d}from"./jsx-runtime-Wy9s6hX0.js";import{t as f}from"./button-DmIfWVZ8.js";import{b as p,v as m,w as ee,y as h}from"./use-repositories-orpc-Ban_zGD7.js";import{t as g}from"./input-CXxt1dAV.js";import{r as _}from"./use-operator-BdSmIxpm.js";import{t as v}from"./folder-git-2-Co_pliwR.js";import{t as y}from"./utils-A3okWeke.js";var b={name:`folder`,size:24,node:[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]};b.node;var x=t(b),S=l(u(),1),C=/^(https?:\/\/|ssh:\/\/|git:\/\/|[\w.-]+@[\w.-]+:)/,w=e=>C.test(e.trim()),T={folder:`Folder`,repo:`Repo`,remote:`Remote repo`},E={folder:x,repo:v,remote:c};function D(e){let t=e.trim();if(!t)return{dir:null,prefix:``};let n=Math.max(t.lastIndexOf(`/`),t.lastIndexOf(`\\`));return n<0?{dir:t,prefix:``}:{dir:t.slice(0,n+1),prefix:t.slice(n+1)}}function O(e,t,n){let r=t.toLowerCase();return e.filter(e=>(n||!e.hidden||r.startsWith(`.`))&&e.name.toLowerCase().startsWith(r))}function k(e,t,n){if(w(e))return`remote`;if(!t?.ok||!e.trim())return null;if(!n)return t.git?`repo`:`folder`;let r=t.entries.find(e=>e.name===n);return r?r.git||t.git?`repo`:`folder`:null}var A={denied:`No access here`,missing:`No such folder`,timeout:`Took too long`,"not-folder":`Not a folder`,"not-absolute":`Type a full path`,link:`Goes through a link`,busy:`Folder reads busy`},j=`pl.recentProjects`,M=5;function N(){try{let e=JSON.parse(localStorage.getItem(j)??`[]`);return Array.isArray(e)?e.filter(e=>typeof e==`string`).slice(0,M):[]}catch{return[]}}function P(e){try{let t=[e,...N().filter(t=>t!==e)];localStorage.setItem(j,JSON.stringify(t.slice(0,M)))}catch{}}function te(e){let t=e.trim();return/^[A-Za-z]:[\\/]$|^\/$/.test(t)?t:t.replace(/[\\/]+$/,``)}var F=d();function I({open:t,onOpenChange:c,onChoose:l,title:u=`Add project`,submitLabel:d=`Add`,folderOnly:v=!1,pending:b=!1,error:x=null}){let[C,j]=(0,S.useState)(``),[M,I]=(0,S.useState)(!1),[L,R]=(0,S.useState)(!!r()?.pickFolder);(0,S.useEffect)(()=>{t&&j(``)},[t]);let{managesPairing:z}=_(),B=!v&&w(C),{dir:V,prefix:H}=D((0,S.useDeferredValue)(C)),U=e({...n.repositories.browseFolders.queryOptions({input:{path:V}}),enabled:t&&z&&!B,staleTime:5e3,placeholderData:e=>e}).data,W=v?null:k(C,U,H),G=U?.ok?O(U.entries,H,M):[],K=C?[]:N(),q=te(C),J=e=>{e&&!b&&(P(e),l(e))},Y=e=>{e.preventDefault(),J(q)},X=async()=>{let e=await r()?.pickFolder?.();if(!e||`unavailable`in e)return R(!1);e.path&&j(e.path)},Z=U?.ok&&U.path.includes(`\\`)?`\\`:`/`,Q=e=>j(e.endsWith(Z)?e:`${e}${Z}`),$=W?E[W]:null;return(0,F.jsx)(h,{open:t,onOpenChange:c,children:(0,F.jsxs)(p,{className:y(m.sm,`grid gap-3`),"data-testid":`add-project-dialog`,children:[(0,F.jsx)(ee,{children:u}),(0,F.jsxs)(`form`,{onSubmit:Y,className:`grid gap-2`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsx)(g,{autoFocus:!0,value:C,onChange:e=>j(e.target.value),placeholder:v?`Folder`:`Folder or git URL`,"aria-label":v?`Folder`:`Folder or git URL`,className:`min-w-0 flex-1 font-mono`,"data-testid":`add-project-source`}),L&&z&&(0,F.jsxs)(f,{type:`button`,variant:`secondary`,onClick:()=>void X(),"data-testid":`add-project-native`,children:[(0,F.jsx)(s,{}),`Choose`]})]}),$&&W&&(0,F.jsxs)(`span`,{className:`flex items-center gap-1.5 text-meta text-text-2`,"data-testid":`add-project-kind`,"data-kind":W,children:[(0,F.jsx)($,{className:`size-3.5`,"aria-hidden":!0}),T[W]]}),z&&!B&&(0,F.jsxs)(`div`,{className:`grid gap-1.5 rounded-surface bg-surface-1 p-2`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsxs)(f,{type:`button`,variant:`text`,size:`sm`,disabled:!U?.ok||!U.parent,onClick:()=>U?.ok&&U.parent&&Q(U.parent),"data-testid":`add-project-up`,children:[(0,F.jsx)(a,{}),`Up`]}),(0,F.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-meta text-text-3`,children:U?.path}),(0,F.jsxs)(`label`,{className:`flex items-center gap-1.5 text-meta text-text-2`,children:[(0,F.jsx)(o,{checked:M,onCheckedChange:I,"data-testid":`add-project-hidden`}),`Hidden`]})]}),K.length>0&&(0,F.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:K.map(e=>(0,F.jsxs)(`button`,{type:`button`,onClick:()=>j(e),className:`flex max-w-full items-center gap-1 rounded-control px-1.5 py-0.5 text-meta text-text-2 hover:bg-surface-3`,"data-testid":`add-project-recent`,children:[(0,F.jsx)(i,{className:`size-3 shrink-0`,"aria-hidden":!0}),(0,F.jsx)(`span`,{className:`truncate font-mono`,children:e})]},e))}),U&&!U.ok?(0,F.jsx)(`p`,{className:`px-1 py-1 text-meta text-text-3`,"data-testid":`add-project-browse-error`,"data-error":U.error,children:A[U.error]}):(0,F.jsxs)(`ul`,{className:`grid max-h-56 gap-px overflow-y-auto`,"aria-label":`Folders`,"data-testid":`add-project-entries`,children:[G.map(e=>{let t=E[e.git?`repo`:`folder`];return(0,F.jsx)(`li`,{children:(0,F.jsxs)(`button`,{type:`button`,onClick:()=>Q(e.path),className:`flex h-8 w-full items-center gap-2 rounded-control px-2 text-left text-body text-text-1 hover:bg-surface-3`,"data-testid":`add-project-entry`,children:[(0,F.jsx)(t,{className:`size-4 shrink-0 text-text-3`,"aria-hidden":!0}),(0,F.jsx)(`span`,{className:`min-w-0 truncate`,children:e.name})]})},e.path)}),U?.ok&&G.length===0&&(0,F.jsx)(`li`,{className:`px-2 py-1 text-meta text-text-3`,children:`No folders`}),U?.ok&&U.truncated&&(0,F.jsx)(`li`,{className:`px-2 py-1 text-meta text-text-3`,children:`More not shown`})]})]}),x&&(0,F.jsx)(`p`,{className:`text-meta text-danger`,role:`alert`,"data-testid":`add-project-error`,children:x}),(0,F.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,F.jsx)(f,{type:`button`,variant:`text`,onClick:()=>c(!1),children:`Cancel`}),(0,F.jsx)(f,{type:`submit`,disabled:!q||b,"data-testid":`add-project-submit`,children:d})]})]})]})})}function L({onPick:e,folderOnly:t=!1,disabled:n=!1,testId:r=`browse-folder`}){let[i,a]=(0,S.useState)(!1);return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(f,{type:`button`,variant:`secondary`,disabled:n,onClick:()=>a(!0),"data-testid":r,children:[(0,F.jsx)(s,{}),`Browse`]}),i&&(0,F.jsx)(I,{open:!0,onOpenChange:a,title:t?`Choose a folder`:`Choose code`,submitLabel:`Use`,folderOnly:t,onChoose:t=>{e(t),a(!1)}})]})}export{T as i,L as n,E as r,I as t};
@@ -1,4 +1,4 @@
1
- import{G as e,J as t,W as n,Xt as r,a as i,at as a,h as o,i as s,m as c,n as l,st as u,z as d}from"./desktop-Bqso9PNq.js";import{t as f}from"./link-BHh9_evg.js";import{C as p,E as m,S as h,T as g,_,_t as v,a as y,ht as b,lt as x,n as S,r as C,ut as w,v as T,w as E,y as D}from"./source-words-B5oOdiQU.js";import{r as O,t as k}from"./switch-DpPkkZxw.js";import{a as A,n as j,r as M,t as N}from"./jsx-runtime-Wy9s6hX0.js";import{s as P}from"./restart-40l7XMmi.js";import{t as F}from"./utils-A3okWeke.js";import{D as I,b as L,c as ee,m as R,n as te,o as ne,s as re,w as ie}from"./harness-CokJrRXZ.js";import{t as ae}from"./check-DfKru7HJ.js";import{$ as oe,B as se,H as ce,U as le,V as ue,l as de,p as fe,s as pe,t as me,u as he}from"./Hint-BCpVhAvV.js";import{t as ge}from"./plus-DWSahnrj.js";import{$ as _e,B as ve,C as ye,D as be,E as xe,H as Se,I as Ce,J as we,L as Te,M as Ee,Q as De,R as Oe,S as ke,U as Ae,V as je,W as Me,X as z,Y as Ne,b as Pe,j as Fe,k as Ie,q as B,w as Le,x as Re,y as ze,z as Be}from"./use-repositories-orpc-c6hPOKjE.js";import{t as Ve}from"./react-dom-g7hNCJoM.js";import{a as He,o as V,r as Ue,t as H}from"./button-DmIfWVZ8.js";import{n as We}from"./useNavigate-I5E4IRt2.js";import{c as Ge,i as Ke,l as qe,n as Je,o as Ye,s as Xe,t as Ze}from"./select-98_n4DVz.js";import{r as Qe,t as $e}from"./command-chip-5Lf0FARB.js";import{t as U}from"./input-CXxt1dAV.js";import{n as et,r as tt,t as nt}from"./dist-CQz4Osl1.js";import{n as rt,r as it,t as at}from"./RingTick-DkMvLoUV.js";import{n as ot,t as st}from"./CopyButton-DKP5JHET.js";import{n as ct,t as lt}from"./Row-B3HLhwlw.js";import{r as ut}from"./State-CCKzehkH.js";var dt={name:`arrow-left`,size:24,node:[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]};dt.node;var ft=i(dt),pt={name:`search`,size:24,node:[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]};pt.node;var mt=i(pt),ht={name:`shield-alert`,size:24,node:[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M12 16h.01`,key:`1drbdi`}]]};ht.node;var gt=i(ht),_t={name:`shield`,size:24,node:[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}]]};_t.node;var vt=i(_t),yt={name:`star`,size:24,node:[[`path`,{d:`M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z`,key:`r04s7s`}]]};yt.node;var bt=i(yt),xt={name:`upload`,size:24,node:[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]};xt.node;var St=i(xt);function Ct(e){let t=e.trim().split(`
1
+ import{G as e,J as t,W as n,Xt as r,a as i,at as a,h as o,i as s,m as c,n as l,st as u,z as d}from"./desktop-yb-lqHMd.js";import{t as f}from"./link-BHh9_evg.js";import{C as p,E as m,S as h,T as g,_,_t as v,a as y,ht as b,lt as x,n as S,r as C,ut as w,v as T,w as E,y as D}from"./source-words-CCeTLwOy.js";import{r as O,t as k}from"./switch-u0tmvVOg.js";import{a as A,n as j,r as M,t as N}from"./jsx-runtime-Wy9s6hX0.js";import{s as P}from"./restart-FIcq7DzH.js";import{t as F}from"./utils-A3okWeke.js";import{D as I,b as L,c as ee,m as R,n as te,o as ne,s as re,w as ie}from"./harness-CokJrRXZ.js";import{t as ae}from"./check-C96xWdLm.js";import{$ as oe,B as se,H as ce,U as le,V as ue,l as de,p as fe,s as pe,t as me,u as he}from"./Hint-Od6cnmvm.js";import{t as ge}from"./plus-f3bDJe68.js";import{$ as _e,B as ve,C as ye,D as be,E as xe,H as Se,I as Ce,J as we,L as Te,M as Ee,Q as De,R as Oe,S as ke,U as Ae,V as je,W as Me,X as z,Y as Ne,b as Pe,j as Fe,k as Ie,q as B,w as Le,x as Re,y as ze,z as Be}from"./use-repositories-orpc-Ban_zGD7.js";import{t as Ve}from"./react-dom-g7hNCJoM.js";import{a as He,o as V,r as Ue,t as H}from"./button-DmIfWVZ8.js";import{n as We}from"./useNavigate-I5E4IRt2.js";import{c as Ge,i as Ke,l as qe,n as Je,o as Ye,s as Xe,t as Ze}from"./select-hkRu0Dxf.js";import{r as Qe,t as $e}from"./command-chip-BFhgzAY5.js";import{t as U}from"./input-CXxt1dAV.js";import{n as et,r as tt,t as nt}from"./dist-zIr1CK3Q.js";import{n as rt,r as it,t as at}from"./RingTick-Zd_duqBv.js";import{n as ot,t as st}from"./CopyButton-DKP5JHET.js";import{n as ct,t as lt}from"./Row-B3HLhwlw.js";import{r as ut}from"./State-CCKzehkH.js";var dt={name:`arrow-left`,size:24,node:[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]};dt.node;var ft=i(dt),pt={name:`search`,size:24,node:[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]};pt.node;var mt=i(pt),ht={name:`shield-alert`,size:24,node:[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M12 16h.01`,key:`1drbdi`}]]};ht.node;var gt=i(ht),_t={name:`shield`,size:24,node:[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}]]};_t.node;var vt=i(_t),yt={name:`star`,size:24,node:[[`path`,{d:`M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z`,key:`r04s7s`}]]};yt.node;var bt=i(yt),xt={name:`upload`,size:24,node:[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]};xt.node;var St=i(xt);function Ct(e){let t=e.trim().split(`
2
2
  `)[0]??``,n=t.search(/[.;:](\s|$)/);return n>0?t.slice(0,n):t}function wt(e,t,n){let r=e.alertCount,i=`Its ${r===1?`1 alert moves`:`${r} alerts move`} to INC-${t.number} and INC-${e.number} ends as merged. Its runs stay here.`,a=t.investigations?.[0];if(!a||!d(a.status))return i;let o=n?`the ${n} repositories`:`their repositories`;return`${i} INC-${t.number}'s working run keeps its workspace; the next run also clones ${o}.`}var Tt=[{test:/\b529\b|overloaded/i,words:{what:`The model provider was overloaded.`,next:`Nothing is wrong with your setup. Try again in a minute.`}},{test:/\b429\b|rate.?limit/i,words:{what:`The model provider limited the request rate.`,next:`Try again in a minute, or pick another model.`}},{test:/failed to authenticate|oauth|session (has )?expired|token (has )?expired|log ?in again/i,words:e=>({what:`${Et(e)}'s sign-in has expired.`,next:`Sign in to ${e} again, then start a new run.`,plain:!0})},{test:/not logged in|auth(entication)?[ _]required|unauthori[sz]ed|\b401\b|\b403\b|api key|sign(ed)? in/i,words:(e,t)=>Dt(e,t)},{test:/timed? ?out/i,words:{what:`The agent took too long to answer.`,next:`Try again; a smaller brief can help.`}},{test:/did not validate|could not parse|invalid report/i,words:{what:`The agent's report could not be read.`,next:`Try again, or pick another model.`,ours:!0}},{test:/produced no evidence/i,words:{what:`The agent finished without running a single check, so there is no report.`,next:`Try again, or pick another model.`,ours:!0}}],Et=e=>e.charAt(0).toUpperCase()+e.slice(1);function Dt(e,t){let n=t?.match(/`([^`]+)`/)?.[1];return{what:`${Et(e)} is not signed in to its model provider.`,next:n?`Run ${n} in a terminal, then retry.`:`Sign in with its own CLI, then retry.`,plain:!0}}function Ot(e){return e.next?`${e.what} ${e.next}`:e.what}function kt(e,t=`the agent`,n){if(!e)return{what:`No error was recorded.`};for(let r of Tt)if(r.test.test(e))return typeof r.words==`function`?r.words(t,n):r.words;let r=Ct(e);return{what:/[.!?]$/.test(r)?r:`${r}.`}}var W=A(j(),1),G=N(),At=Object.defineProperty,K=(e,t)=>At(e,`name`,{value:t,configurable:!0}),jt=`Popover`,[Mt,Nt]=De(jt,[le]),Pt=le(),[Ft,It]=Mt(jt),Lt=K(e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=Pt(t),c=W.useRef(null),[l,u]=W.useState(!1),[d,f]=W.useState(0),[p,m]=W.useState(0),[h,g]=Ne({prop:r,defaultProp:i??!1,onChange:a,caller:jt});return(0,G.jsx)(se,{...s,children:(0,G.jsx)(Ft,{scope:t,contentId:B(),titleId:B(),descriptionId:B(),titlePresent:d>0,descriptionPresent:p>0,setTitleCount:f,setDescriptionCount:m,triggerRef:c,open:h,onOpenChange:g,onOpenToggle:W.useCallback(()=>g(e=>!e),[g]),hasCustomAnchor:l,onCustomAnchorAdd:W.useCallback(()=>u(!0),[]),onCustomAnchorRemove:W.useCallback(()=>u(!1),[]),modal:o,children:n})})},`Popover`),Rt=`PopoverTrigger`,zt=W.forwardRef(K(function(e,t){let{__scopePopover:n,...r}=e,i=It(Rt,n),a=Pt(n),o=V(t,i.triggerRef),s=(0,G.jsx)(_e.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":Xt(i.open),...r,ref:o,onClick:z(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:(0,G.jsx)(ue,{asChild:!0,...a,children:s})},`PopoverTrigger`)),Bt=`PopoverPortal`,[Vt,Ht]=Mt(Bt,{forceMount:void 0}),Ut=K(e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=It(Bt,t);return(0,G.jsx)(Vt,{scope:t,forceMount:n,children:(0,G.jsx)(we,{present:n||a.open,children:(0,G.jsx)(Be,{asChild:!0,container:i,children:r})})})},`PopoverPortal`),Wt=`PopoverContent`,Gt=W.forwardRef(K(function(e,t){let n=Ht(Wt,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=It(Wt,e.__scopePopover);return(0,G.jsx)(we,{present:r||a.open,children:a.modal?(0,G.jsx)(qt,{...i,ref:t}):(0,G.jsx)(Jt,{...i,ref:t})})},`PopoverContent`)),Kt=Ue(`PopoverContent.RemoveScroll`),qt=W.forwardRef(K(function(e,t){let n=It(Wt,e.__scopePopover),r=W.useRef(null),i=V(t,r),a=W.useRef(!1),{nodes:o,registry:s}=Ae();return W.useEffect(()=>{let e=r.current;if(e)return Ce(e)},[]),(0,G.jsx)(Te,{as:Kt,allowPinchZoom:!0,shards:W.useMemo(()=>[r,...o.map(e=>({current:e}))],[r,o]),children:(0,G.jsx)(Yt,{...e,ref:i,branchNodes:o,branchRegistry:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:z(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:z(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;a.current=r},{checkForDefaultPrevented:!1}),onFocusOutside:z(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})},`PopoverContentModal`)),Jt=W.forwardRef(K(function(e,t){let n=It(Wt,e.__scopePopover),r=W.useRef(!1),i=W.useRef(!1);return(0,G.jsx)(Yt,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})},`PopoverContentNonModal`)),Yt=W.forwardRef(K(function(e,t){let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,"aria-describedby":d,branchNodes:f,branchRegistry:p,...m}=e,h=It(Wt,n),g=Pt(n),[_,v]=W.useState(null),y=V(t,v);return Se(_),Oe(),(0,G.jsx)(je,{registry:p,children:(0,G.jsx)(ve,{asChild:!0,loop:!0,trapped:r,branches:f,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,G.jsx)(Me,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>h.onOpenChange(!1),deferPointerDownOutside:!0,children:(0,G.jsx)(ce,{"data-state":Xt(h.open),role:`dialog`,id:h.contentId,"aria-labelledby":h.titlePresent?h.titleId:void 0,"aria-describedby":h.descriptionPresent?Zt(d,h.descriptionId):d,...g,...m,ref:y,style:{...m.style,"--radix-popover-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-popover-content-available-width":`var(--radix-popper-available-width)`,"--radix-popover-content-available-height":`var(--radix-popper-available-height)`,"--radix-popover-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-popover-trigger-height":`var(--radix-popper-anchor-height)`}})})})})},`PopoverContentImpl`));function Xt(e){return e?`open`:`closed`}K(Xt,`getState`);function Zt(...e){let t=new Set;for(let n of e)if(typeof n==`string`)for(let e of String(n).trim().split(/\s+/))e&&t.add(e);return t.size>0?Array.from(t).join(` `):void 0}K(Zt,`concatAriaDescribedby`);var Qt=Object.defineProperty,q=(e,t)=>Qt(e,`name`,{value:t,configurable:!0}),$t=`Radio`,[en,tn]=De($t),[nn,rn]=en($t);function an(e){let{__scopeRadio:t,checked:n=!1,children:r,disabled:i,form:a,name:o,onCheck:s,required:c,value:l=`on`,internal_do_not_use_render:u}=e,[d,f]=W.useState(null),[p,m]=W.useState(null),[h,g]=W.useState(null),_={checked:n,disabled:i,required:c,name:o,form:a,value:l,control:d,setControl:f,userClick:h,onUserClick:g,isFormControl:!d||!!a||!!d.closest(`form`),bubbleInput:p,setBubbleInput:m,onCheck:q(()=>s?.(),`onCheck`)};return(0,G.jsx)(nn,{scope:t,..._,children:fn(u)?u(_):r})}q(an,`RadioProvider`);var on=`RadioTrigger`,sn=W.forwardRef(q(function({__scopeRadio:e,onClick:t,...n},r){let{checked:i,disabled:a,value:o,setControl:s,onCheck:c,onUserClick:l,isFormControl:u,bubbleInput:d}=rn(on,e),f=V(r,s);return(0,G.jsx)(_e.button,{type:`button`,role:`radio`,"aria-checked":i,"data-state":pn(i),"data-disabled":a?``:void 0,disabled:a,value:o,...n,ref:f,onClick:z(t,e=>{let t=e.isPropagationStopped();i||(l({hasConsumerStoppedPropagation:t}),c()),d&&u&&(t||e.stopPropagation())})})},`RadioTrigger`)),cn=`RadioIndicator`,ln=W.forwardRef(q(function(e,t){let{__scopeRadio:n,forceMount:r,...i}=e,a=rn(cn,n);return(0,G.jsx)(we,{present:r||a.checked,children:(0,G.jsx)(_e.span,{"data-state":pn(a.checked),"data-disabled":a.disabled?``:void 0,...i,ref:t})})},`RadioIndicator`)),un=`RadioBubbleInput`,dn=W.forwardRef(q(function({__scopeRadio:e,onClick:t,...n},r){let{control:i,checked:a,required:o,disabled:s,name:c,value:l,form:u,bubbleInput:d,setBubbleInput:f,userClick:p}=rn(un,e),m=V(r,f),h=xe(i),g=W.useRef(!1),_=W.useRef(a),v=W.useRef(p),y=W.useRef(null);W.useEffect(()=>{let e=d;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set;if(!n)return;let r=_.current!==a;_.current=a;let i=p!==null&&p!==v.current;if(v.current=p,i)y.current=r?null:p,r&&n.call(e,a),e.dispatchEvent(new Event(`click`,{bubbles:!p.hasConsumerStoppedPropagation}));else if(r){let t=y.current;y.current=null;let r=a&&t!==null;g.current=!0,n.call(e,a),e.dispatchEvent(new Event(`click`,{bubbles:!(r&&t.hasConsumerStoppedPropagation)})),g.current=!1}},[d,a,p]);let b=W.useRef(a);return(0,G.jsx)(_e.input,{type:`radio`,"aria-hidden":!0,defaultChecked:b.current,required:o,disabled:s,name:c,value:l,form:u,...n,tabIndex:-1,ref:m,onClick:z(t,e=>{g.current&&e.stopPropagation()}),style:{...n.style,...h,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})},`RadioBubbleInput`));function fn(e){return typeof e==`function`}q(fn,`isFunction`);function pn(e){return e?`checked`:`unchecked`}q(pn,`getState`);var mn=[`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`],hn=`RadioGroup`,[gn,_n]=De(hn,[tt,tn]),vn=tt(),yn=tn(),[bn,xn]=gn(hn),Sn=W.forwardRef(q(function(e,t){let{__scopeRadioGroup:n,name:r,form:i,defaultValue:a,value:o,required:s=!1,disabled:c=!1,orientation:l,dir:u,loop:d=!0,onValueChange:f,...p}=e,m=vn(n),h=qe(u),[g,_]=Ne({prop:o,defaultProp:a??null,onChange:f,caller:hn}),[v,y]=W.useState(null),b=V(t,y),x=W.useRef(g);return W.useEffect(()=>{let e=i?v?.ownerDocument.getElementById(i):v?.closest(`form`);if(e instanceof HTMLFormElement){let t=q(()=>_(x.current),`reset`);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[v,i,_]),(0,G.jsx)(bn,{scope:n,name:r,form:i,required:s,disabled:c,value:g,onValueChange:_,children:(0,G.jsx)(nt,{asChild:!0,...m,orientation:l,dir:h,loop:d,children:(0,G.jsx)(_e.div,{role:`radiogroup`,"aria-required":s,"aria-orientation":l,"data-disabled":c?``:void 0,dir:h,...p,ref:b})})})},`RadioGroup`)),Cn=`RadioGroupItemProvider`,wn=`RadioGroupItemTrigger`;function Tn(e){let{__scopeRadioGroup:t,value:n,disabled:r,children:i,internal_do_not_use_render:a}=e,o=xn(Cn,t),s=yn(t),c=o.disabled||r;return(0,G.jsx)(an,{...s,checked:o.value===n,disabled:c,required:o.required,name:o.name,form:o.form,value:n,onCheck:()=>o.onValueChange(n),internal_do_not_use_render:a,children:i})}q(Tn,`RadioGroupItemProvider`);var En=W.forwardRef(q(function(e,t){let{__scopeRadioGroup:n,...r}=e,i=vn(n),a=yn(n),{checked:o,disabled:s}=rn(wn,a.__scopeRadio),c=W.useRef(null),l=V(t,c),u=W.useRef(!1);return W.useEffect(()=>{let e=q(e=>{mn.includes(e.key)&&(u.current=!0)},`handleKeyDown`),t=q(()=>u.current=!1,`handleKeyUp`);return document.addEventListener(`keydown`,e),document.addEventListener(`keyup`,t),()=>{document.removeEventListener(`keydown`,e),document.removeEventListener(`keyup`,t)}},[]),(0,G.jsx)(et,{asChild:!0,...i,focusable:!s,active:o,children:(0,G.jsx)(sn,{...a,...r,ref:l,onKeyDown:z(r.onKeyDown,e=>{e.key===`Enter`&&e.preventDefault()}),onFocus:z(r.onFocus,()=>{u.current&&c.current?.click()})})})},`RadioGroupItemTrigger`)),Dn=W.forwardRef(q(function(e,t){let{__scopeRadioGroup:n,value:r,disabled:i,...a}=e;return(0,G.jsx)(Tn,{__scopeRadioGroup:n,value:r,disabled:i,internal_do_not_use_render:({isFormControl:e})=>(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(En,{...a,ref:t,__scopeRadioGroup:n}),e&&(0,G.jsx)(On,{__scopeRadioGroup:n})]})})},`RadioGroupItem`)),On=W.forwardRef(q(function(e,t){let{__scopeRadioGroup:n,...r}=e,i=yn(n);return(0,G.jsx)(dn,{...i,...r,ref:t})},`RadioGroupItemBubbleInput`)),kn=W.forwardRef(q(function(e,t){let{__scopeRadioGroup:n,...r}=e,i=yn(n);return(0,G.jsx)(ln,{...i,...r,ref:t})},`RadioGroupIndicator`));function An({label:e,description:t,children:n,below:r,className:i,testId:a}){return(0,G.jsx)(ct,{label:e,meta:t,trailing:n,below:r,stackOnPhone:!0,className:i,testId:a})}function jn({title:e,count:t,actions:n,description:r,children:i,className:a,testId:o}){return(0,G.jsxs)(`section`,{className:F(`mt-8 first:mt-0`,a),"data-testid":o,children:[(0,G.jsxs)(`div`,{className:`mb-3`,children:[(0,G.jsxs)(`div`,{className:`flex min-h-5 items-center justify-between gap-3`,children:[(0,G.jsxs)(`h3`,{className:`flex items-baseline gap-2 text-body font-medium text-text-2`,children:[e,t!==void 0&&(0,G.jsx)(`span`,{className:`font-normal text-text-3 tabular-nums`,children:t})]}),n]}),r&&(0,G.jsx)(`p`,{className:`mt-0.5 text-meta text-text-3`,children:r})]}),(0,G.jsx)(`div`,{children:i})]})}var Mn=M(((e,t)=>{var n=[`||`,`&&`,`;;&`,`;;`,`;&`,`|&`,`<(`,`>(`,`<<<`,`<<-`,`<<`,`>>`,`>&`,`>|`,`&>>`,`&>`,`<&`,`<>`,`&`,`;`,`(`,`)`,`|`,`<`,`>`],r=/[\n\r\u2028\u2029]/,i=/[\s#!"$&'():;<=>@\\^`|~]/g;t.exports=function(e){var t=!1;return e.map(function(e){if(t&&typeof e==`string`&&r.test(e))throw TypeError("a token after a `comment` must not contain line terminators");if(e===``)return`''`;if(e&&typeof e==`object`){if(`op`in e&&e.op===`glob`){if(typeof e.pattern!=`string`)throw TypeError("glob token requires a string `pattern`");if(r.test(e.pattern))throw TypeError("glob `pattern` must not contain line terminators");return e.pattern===``?`''`:e.pattern.replace(i,`\\$&`)}if(`op`in e&&typeof e.op==`string`){if(n.indexOf(e.op)<0)throw TypeError("invalid `op` value: "+JSON.stringify(e.op));return e.op.replace(/[\s\S]/g,`\\$&`)}if(`comment`in e&&typeof e.comment==`string`){if(r.test(e.comment))throw TypeError("`comment` must not contain line terminators");return t=!0,`#`+e.comment}throw TypeError(`unrecognized object token shape`)}return/'/.test(e)&&/!/.test(e)?`'`+e.replace(/'/g,`'"'"'`)+`'`:/["\s\\]/.test(e)&&!/'/.test(e)?`'`+e+`'`:/["'\s]/.test(e)?`"`+e.replace(/(["\\$`])/g,`\\$1`)+`"`:String(e).replace(/([A-Za-z]:)?([#!"$&'()*,:;<=>?@[\\\]^`{|}~])/g,`$1\\$2`)}).join(` `)}})),Nn=M(((e,t)=>{for(var n=`(?:\\|\\||\\&(?:\\&|>>?)|;;\\&?|[;|]\\&|\\<\\(|\\<\\<\\<|\\<\\<-|\\<\\<(?!\\()|>>|>[&|(]|<[&>]|[&;()|<>])`,r=RegExp(`^`+n+`$`),i=`|&;()<> \\t`,a=`'([^']*?)'`,o=`(?:\\\\[\\s\\S]|[^\\\\'])*?`,s=`\\$'`+o+`'`,c=RegExp(`\\$'`+o+`(?:(')|\\\\?$)`,`g`),l=`abeEfnrtv`,u=`\x07\b\x1B\x1B\f
3
3
  \r \v`,d=/^#$/,f=`'`,p=`"`,m=`$`,h=``,g=4294967296,_=0;_<4;_++)h+=(g*Math.random()).toString(16);var v=RegExp(`^`+h);function y(e,t){for(var n=t.lastIndex,r=[],i;i=t.exec(e);)r[r.length]=i,t.lastIndex===i.index&&(t.lastIndex+=1);return t.lastIndex=n,r}function b(e,t,n){var r=typeof e==`function`?e(n):e[n];return r===void 0&&n!=``?r=``:r===void 0&&(r=`$`),typeof r==`object`?t+h+JSON.stringify(r)+h:t+r}var x=/\\([0-7]{1,3}|x[\dA-Fa-f]{1,2}|u[\dA-Fa-f]{1,4}|U[\dA-Fa-f]{1,8}|c(?:\\\\|[\s\S])|[abeEfnrtv\\'"?])/g;function S(e,t){var n=t.charAt(0);if(n===`c`){var r=t.charAt(1);return r===`?`?``:String.fromCharCode(r.charCodeAt(0)&31)}if(n===`x`||n===`u`||n===`U`){var i=parseInt(t.slice(1),16);return i>1114111?e:String.fromCharCode.apply(null,i>65535?[55232+(i>>10),56320+(i&1023)]:[i])}if(n>=`0`&&n<=`7`)return String.fromCharCode(parseInt(t,8)&255);var a=l.indexOf(t);return a<0?t:u.charAt(a)}function C(e){return e.replace(x,S).split(`\0`)[0]}function w(e,t){return c.lastIndex=t,!!c.exec(e)[1]}function T(e,t,o){o||={};var l=o.escape||`\\`,u=o.splitUnquoted===!0?`
4
4
  `:typeof o.splitUnquoted==`string`?o.splitUnquoted:``,h=`(\\`+l+`['"$\\`+l+i+`]|\\$\\$|\\$(?!`+s.slice(2)+`)|[^\\s'"$`+i+`])+`,g=`"(?:\\`+l+`[\\s\\S]|[^"\\`+l+`])*"`,_=y(e,new RegExp([`(`+n+`)`,`(`+s+`|`+h+`|`+g+`|`+a+`)+`].join(`|`),`g`));if(_.length===0)return[];t||={};var v=!1;return _.map(function(n){var i=n[0];if(!i||v)return;if(r.test(i))return{op:i};var a=!1,o=!1,s=``,h=[],g=!1,_=null,y=!1,x;function S(){x+=1;var e,n,r=i.charAt(x);if(r===`{`){if(x+=1,i.charAt(x)===`}`)throw Error(`Bad substitution: `+i.slice(x-2,x+1));var a=1;for(e=x;a>0&&e<i.length;)i.charAt(e)===`{`&&i.charAt(e-1)===`$`?a+=1:i.charAt(e)===`}`&&--a,e+=1;if(a!==0)throw Error(`Bad substitution: `+i.slice(x));--e,n=i.slice(x,e),x=e}else if(/[*@#?$!-]/.test(r))n=r;else{var o=i.slice(x);e=o.match(/[^\w\d_]/),e?(n=o.slice(0,e.index),x+=e.index-1):(n=o,x=i.length)}return b(t,``,n)}function T(){if(_!==null){if(_===0)s!==``&&(h[h.length]=s,s=``);else{h[h.length]=s,s=``;for(var e=1;e<_;e+=1)h[h.length]=``}_=null}}for(x=0;x<i.length;x++){var E=i.charAt(x);if(u&&E!==m&&T(),y||=!a&&(E===`*`||E===`?`),o)s+=E,o=!1;else if(a)E===a?a=!1:a==f?s+=E:E===l?(x+=1,E=i.charAt(x),s+=E===p||E===l||E===m?E:l+E):s+=E===m?S():E;else if(E===p||E===f)a=E,g=!0;else if(r.test(E))return{op:i};else if(d.test(E)){v=!0;var D={comment:e.slice(n.index+x+1)};return s.length?[s,D]:[D]}else if(E===l)o=!0;else if(E===m&&i.charAt(x+1)===f&&w(i,x))T(),g=!0,s+=C(i.slice(x+2,c.lastIndex-1)),x=c.lastIndex-1;else if(E===m){var O=S();if(!u)s+=O;else for(var k=0;k<O.length;k+=1){var A=O.charAt(k);u.indexOf(A)<0?(T(),s+=A):_===null?_=A===` `||A===` `||A===`
@@ -1 +1 @@
1
- import{t as e}from"./link-BHh9_evg.js";import{t}from"./CopyButton-DKP5JHET.js";import{c as n}from"./select-98_n4DVz.js";import{t as r}from"./State-CCKzehkH.js";import{it as i,ot as a,st as o}from"./index-DZMj9YK4.js";import{t as s}from"./jsx-runtime-Wy9s6hX0.js";var c=s();function l({compact:t=!1}){let{data:n}=a(),s=o(`prometheus`);return(0,c.jsxs)(r,{title:`Connect your alerts`,testId:`alerts-none`,className:t?`pt-4 pb-4`:void 0,children:[(0,c.jsx)(`p`,{className:`-mt-2 text-body text-text-2`,children:`Add as an Alertmanager webhook`}),(0,c.jsxs)(`div`,{className:`pool flex w-full flex-col gap-1 px-4 py-3 text-left`,children:[(0,c.jsx)(u,{label:`Webhook`,value:s,copy:s,copyLabel:`Copy URL`,testId:`alerts-copy-url`}),n&&(0,c.jsx)(u,{label:`Token`,value:i(n.token),copy:n.token,copyLabel:`Copy token`,testId:`alerts-copy-token`})]}),(0,c.jsx)(e,{to:`/settings`,search:{tab:`alert-intake`},className:`inline-flex min-h-6 items-center text-body text-text-2 hover:text-text-1 hover:underline`,"data-testid":`alerts-add-source`,children:`Or pull from a source`})]})}function u({label:e,value:r,copy:i,copyLabel:a,testId:o}){return(0,c.jsxs)(`div`,{className:`flex min-h-9 items-center gap-3`,children:[(0,c.jsx)(`span`,{className:`w-16 shrink-0 text-meta text-text-3`,children:e}),(0,c.jsx)(n,{className:`min-w-0 flex-1 break-all text-text-1`,children:r}),(0,c.jsx)(t,{value:i,label:a,variant:`text`,testId:o})]})}export{l as t};
1
+ import{t as e}from"./link-BHh9_evg.js";import{t}from"./CopyButton-DKP5JHET.js";import{c as n}from"./select-hkRu0Dxf.js";import{t as r}from"./State-CCKzehkH.js";import{it as i,ot as a,st as o}from"./index-BoI68UdU.js";import{t as s}from"./jsx-runtime-Wy9s6hX0.js";var c=s();function l({compact:t=!1}){let{data:n}=a(),s=o(`prometheus`);return(0,c.jsxs)(r,{title:`Connect your alerts`,testId:`alerts-none`,className:t?`pt-4 pb-4`:void 0,children:[(0,c.jsx)(`p`,{className:`-mt-2 text-body text-text-2`,children:`Add as an Alertmanager webhook`}),(0,c.jsxs)(`div`,{className:`pool flex w-full flex-col gap-1 px-4 py-3 text-left`,children:[(0,c.jsx)(u,{label:`Webhook`,value:s,copy:s,copyLabel:`Copy URL`,testId:`alerts-copy-url`}),n&&(0,c.jsx)(u,{label:`Token`,value:i(n.token),copy:n.token,copyLabel:`Copy token`,testId:`alerts-copy-token`})]}),(0,c.jsx)(e,{to:`/settings`,search:{tab:`alert-intake`},className:`inline-flex min-h-6 items-center text-body text-text-2 hover:text-text-1 hover:underline`,"data-testid":`alerts-add-source`,children:`Or pull from a source`})]})}function u({label:e,value:r,copy:i,copyLabel:a,testId:o}){return(0,c.jsxs)(`div`,{className:`flex min-h-9 items-center gap-3`,children:[(0,c.jsx)(`span`,{className:`w-16 shrink-0 text-meta text-text-3`,children:e}),(0,c.jsx)(n,{className:`min-w-0 flex-1 break-all text-text-1`,children:r}),(0,c.jsx)(t,{value:i,label:a,variant:`text`,testId:o})]})}export{l as t};
@@ -0,0 +1 @@
1
+ import{dt as e,ft as t}from"./source-words-CCeTLwOy.js";import{a as n,b as r,i,r as a}from"./desktop-yb-lqHMd.js";import{t as ee}from"./plus-f3bDJe68.js";import{Ot as o}from"./index-BoI68UdU.js";import{a as s,n as c,t as l}from"./jsx-runtime-Wy9s6hX0.js";import{a as te,l as ne,o as re,r as ie}from"./AgentDetail-CbhnttdO.js";import{r as ae}from"./switch-u0tmvVOg.js";import{t as u}from"./RingTick-Zd_duqBv.js";import{s as d,t as f}from"./button-DmIfWVZ8.js";import{t as p}from"./utils-A3okWeke.js";import{t as m}from"./Hint-Od6cnmvm.js";var h={name:`paperclip`,size:24,node:[[`path`,{d:`m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551`,key:`1miecu`}]]};h.node;var oe=n(h),g={name:`play`,size:24,node:[[`path`,{d:`M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z`,key:`10ikf1`}]]};g.node;var se=n(g),_={name:`repeat`,size:24,node:[[`path`,{d:`m17 2 4 4-4 4`,key:`nntrym`}],[`path`,{d:`M3 11v-1a4 4 0 0 1 4-4h14`,key:`84bu3i`}],[`path`,{d:`m7 22-4-4 4-4`,key:`1wqhfi`}],[`path`,{d:`M21 13v1a4 4 0 0 1-4 4H3`,key:`1rx37r`}]]};_.node;var ce=n(_),v=s(c(),1),y=l();function le(e,t,n){if(n>=10)return`Up to 10 files per message`;let i=r(e);if(!i)return`${e.name}: attach an image or a text file (.log, .json, .csv, .md, .txt, .yaml)`;if(i===`image`){if(t.images===!1)return`${t.label} can't take images`;if(t.images===null)return`Images: not checked yet for ${t.label}. Run its check in Settings, Agent.`;if(e.size>4194304)return`Images up to 4 MB`}else if(e.size>262144)return`Text files up to 256 KB`;return null}function b(e,t){return S(`/api/incidents/${e}/attachments`,t)}function x(e,t){return S(`runId`in e?`/api/threads/${e.runId}/attachments`:`/api/threads/drafts/${e.draftKey}/attachments`,t)}async function S(e,t){let n=new FormData;n.append(`file`,t,t.name);let r=await fetch(e,{method:`POST`,body:n,credentials:`include`}),i=await r.json().catch(()=>({}));if(!r.ok)throw Error(`message`in i&&i.message||`Upload failed (${r.status})`);return i}function C({className:e,...t}){return(0,y.jsx)(`div`,{"data-slot":`input-group`,className:p(`group/input-group relative flex w-full min-w-0 flex-col rounded-pool bg-surface-1`,e),...t})}var w=d(`flex min-w-0 items-center gap-1 text-body text-text-2`,{variants:{align:{"inline-start":`order-first`,"inline-end":`order-last`,"block-start":`order-first w-full`,"block-end":`order-last w-full`}},defaultVariants:{align:`block-end`}});function T({className:e,align:t=`block-end`,...n}){return(0,y.jsx)(`div`,{"data-slot":`input-group-addon`,"data-align":t,className:p(w({align:t}),e),...n})}function E({className:e,type:t=`button`,variant:n=`text`,...r}){return(0,y.jsx)(f,{type:t,variant:n,className:p(`h-8`,e),...r})}function ue({className:e,...t}){return(0,y.jsx)(`textarea`,{"data-slot":`input-group-control`,className:p(`block w-full min-w-0 resize-none bg-transparent text-body text-text-1 outline-none placeholder:text-text-3 disabled:cursor-not-allowed`,e),...t})}function de({className:e,onSubmit:t,children:n,...r}){return(0,y.jsx)(`form`,{className:p(`w-full`,e),onSubmit:e=>{e.preventDefault(),t(e)},...r,children:(0,y.jsx)(C,{className:`px-3 pt-2.5 pb-2`,children:n})})}function fe({className:e,...t}){return(0,y.jsx)(`div`,{className:p(`contents`,e),...t})}function pe({className:e,onKeyDown:t,...n}){return(0,y.jsx)(ue,{name:`message`,rows:1,className:p(`field-sizing-content max-h-40 min-h-11 py-0.5 leading-5`,e),onKeyDown:e=>{t?.(e),e.defaultPrevented||e.key!==`Enter`||e.shiftKey||e.nativeEvent.isComposing||(e.preventDefault(),e.currentTarget.form?.querySelector(`button[type="submit"]`)?.disabled||e.currentTarget.form?.requestSubmit())},...n})}function me({className:e,...t}){return(0,y.jsx)(T,{align:`block-end`,className:p(`mt-1 justify-between gap-1`,e),...t})}function he({className:e,...t}){return(0,y.jsx)(`div`,{className:p(`flex min-w-0 items-center gap-1`,e),...t})}function D({variant:e=`text`,className:t,...n}){return(0,y.jsx)(E,{type:`button`,variant:e,className:p(`px-2`,t),...n})}function ge({className:e,variant:t=`primary`,status:n,children:r,...i}){let a=n===`submitted`?(0,y.jsx)(u,{state:`busy`,className:`size-4`}):n===`streaming`?(0,y.jsx)(o,{className:`size-3.5 fill-current`}):(0,y.jsx)(ae,{className:`size-4`});return(0,y.jsx)(E,{"aria-label":`Send`,type:`submit`,variant:t,className:p(`size-8 rounded-full p-0 disabled:pointer-events-auto disabled:cursor-default disabled:bg-surface-3 disabled:text-text-3 disabled:opacity-100`,e),...i,children:r??a})}function _e(e){return e===`live`||e===`continue`||e===`resume`}function ve(e,t,n=t===`live`){return e.isComposing?null:e.key===`Escape`?n?`stop`:`blur`:e.key!==`Enter`||e.shiftKey||e.altKey?null:_e(t)?e.ctrlKey||e.metaKey?`now`:`queue`:`investigate`}function O(e,t,n){let r=e.find(e=>e.id===t)??e[0],i=e[0];if(!r||!i)return{};let a={emptySend:!r.needsText,sendLabel:r.label};return e.length<2?a:{...a,mode:{id:r.id,label:r.label,...r.id===i.id?{}:{onClear:()=>n(i.id)}},slash:e.filter(e=>e.id!==r.id).map(e=>({id:e.id,label:e.label,detail:e.detail,run:()=>n(e.id)}))}}var k=e=>{for(let t of e)t.preview&&URL.revokeObjectURL(t.preview)},A=e=>({key:`${e.name}-${crypto.randomUUID()}`,file:e,...e.type.startsWith(`image/`)?{preview:URL.createObjectURL(e)}:{}}),j=`text/*,.log,.json,.csv,.md,.txt,.yaml,.yml`;function M({state:n,onSend:r,onStop:s,stopping:c,onResume:l,resuming:ae,placeholder:u,choice:d,onChoice:h,locked:g,branch:_,dock:b,blockedReason:x,autoFocus:S,top:C,slash:w,mode:T,text:E,onText:ue,initialFiles:_e,onFilesChange:O,boxRef:M,accessHint:ye,agentless:N,emptySend:be,sendLabel:P=`Send`,ended:F,notice:I,holdSend:xe,pending:Se,undeliverable:L,onSaveAsNote:R,above:Ce,floating:we,noFiles:Te,onRepeat:Ee,focusSignal:De}){let[Oe,ke]=(0,v.useState)(``),z=E??Oe,B=ue??ke,[V,H]=(0,v.useState)(()=>(_e??[]).map(A)),[U,W]=(0,v.useState)(null),[Ae,je]=(0,v.useState)(!1),G=(0,v.useRef)(null),Me=(0,v.useRef)(null),K=n===`live`,q=!!x,J=!!z.trim(),Y=Ae||!!Se,Ne=!Y&&!q&&!xe&&(J||!!be),Pe=/^\/(\w*)$/.exec(z)?.[1]?.toLowerCase(),X=w&&Pe!==void 0?w.filter(e=>e.id.startsWith(Pe)):[],Fe=e=>{B(``),e.run(),G.current?.focus()},{harness:Z}=d,Q={label:Z?.label??`The agent`,images:Z?.checked?.outcome===`answers-acp`?Z.checked.images:null};(0,v.useEffect)(()=>{S&&G.current?.focus()},[S]),(0,v.useEffect)(()=>{let e=G.current;De&&e&&(e.focus(),e.setSelectionRange(e.value.length,e.value.length))},[De]);let Ie=(0,v.useRef)(V);Ie.current=V,(0,v.useEffect)(()=>{M&&(M.current={text:z,files:V.map(e=>e.file)})},[M,z,V]);let Le=(0,v.useRef)(O);Le.current=O,(0,v.useEffect)(()=>{Le.current?.(V.map(e=>e.file))},[V]),(0,v.useEffect)(()=>()=>k(Ie.current),[]);let $=e=>{let t=V.length,n=[],r=null;for(let i of e){let e=le(i,Q,t);e?r=e:(t++,n.push(A(i)))}W(r),n.length&&H(e=>[...e,...n])},Re=async e=>{if(Ne){je(!0);try{await r({text:z.trim(),files:V.map(e=>e.file)},e),B(``),k(V),H([]),W(null)}catch(e){W(a(e))}finally{je(!1)}}},ze=e=>{let t=X[0];if(t&&e.key===`Enter`&&!e.shiftKey&&!e.nativeEvent.isComposing){e.preventDefault(),Fe(t);return}let r=ve({key:e.key,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,metaKey:e.metaKey,altKey:e.altKey,isComposing:e.nativeEvent.isComposing},K?`live`:n===`interrupted`?`resume`:`draft`,K&&!c);r&&(e.preventDefault(),e.stopPropagation(),r===`stop`?s?.():r===`blur`?G.current?.blur():Re(r===`now`))},Be=e=>{let t=Array.from(e.clipboardData.files);t.length&&!Te&&(e.preventDefault(),$(t))},Ve=K&&!J&&s?(0,y.jsx)(m,{label:`Stop`,keys:[`Esc`],side:`top`,children:(0,y.jsx)(D,{"aria-label":`Stop`,disabled:c,onClick:s,className:`w-8 rounded-full bg-text-1 text-canvas hover:bg-text-2`,"data-testid":`composer-stop`,children:(0,y.jsx)(o,{className:`size-3 fill-current`})})}):n===`interrupted`&&!J&&l?(0,y.jsx)(m,{label:`Resume`,side:`top`,children:(0,y.jsx)(D,{"aria-label":`Resume`,disabled:ae,onClick:l,className:`w-8 rounded-full bg-text-1 text-canvas hover:bg-text-2`,"data-testid":`composer-resume`,children:(0,y.jsx)(se,{className:`size-3 fill-current`})})}):(0,y.jsxs)(y.Fragment,{children:[Ee&&(0,y.jsx)(m,{label:`Repeat…`,side:`top`,children:(0,y.jsx)(D,{"aria-label":`Repeat…`,disabled:!J||Y,onClick:()=>Ee(z.trim()),className:`w-8 text-text-3`,"data-testid":`composer-repeat`,children:(0,y.jsx)(ce,{className:`size-3.5`})})}),(0,y.jsx)(m,{label:P,keys:[`Enter`],side:`top`,children:(0,y.jsx)(`span`,{className:`inline-flex`,children:(0,y.jsx)(ge,{status:Y?`submitted`:void 0,disabled:!Ne,"aria-label":P,"data-testid":`composer-send`})})})]});if(F)return(0,y.jsxs)(`div`,{className:`flex flex-col gap-1`,"data-testid":`thread-composer`,children:[Ce,(0,y.jsxs)(`div`,{className:`flex items-center gap-3 rounded-[10px] bg-surface-2 px-3 py-2.5 text-text-2`,"data-testid":`composer-no-session`,children:[(0,y.jsx)(`span`,{className:`min-w-0 flex-1`,children:F.reason??`This run kept no agent session, so it can't continue. Start a new run.`}),F.onRecheck&&(0,y.jsx)(f,{variant:`secondary`,onClick:F.onRecheck,"data-testid":`composer-recheck`,children:`Investigate again`}),(0,y.jsxs)(f,{variant:`secondary`,onClick:F.onNewRun,"data-testid":`composer-new-run`,children:[(0,y.jsx)(ee,{}),`New run`]})]})]});let He=ne(Z).length>0,Ue=Q.images===!0?`Attach a screenshot or a log`:Q.images===!1?`${Q.label} can't take images. Text files only.`:`Images: not checked yet. Text files only.`,We=!!b||V.length>0;return(0,y.jsxs)(`div`,{className:`flex flex-col gap-1`,"data-testid":`thread-composer`,children:[Ce,(C||_||T)&&(0,y.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-1.5`,children:[C,T&&(0,y.jsxs)(`span`,{className:`inline-flex h-7 items-center gap-1 rounded-control bg-surface-3 pr-1 pl-2 text-meta font-medium text-text-1`,"data-testid":`composer-mode`,"data-mode":T.id,children:[T.label,T.onClear&&(0,y.jsx)(`button`,{type:`button`,"aria-label":`Clear ${T.label}`,onClick:T.onClear,className:`rounded-[4px] p-0.5 text-text-3 hover:bg-surface-4 hover:text-text-1`,"data-testid":`composer-mode-clear`,children:(0,y.jsx)(i,{className:`size-3`})})]}),_&&(0,y.jsxs)(`span`,{className:`inline-flex h-7 min-w-0 items-center gap-1 px-1.5 text-meta text-text-3`,"data-testid":`composer-branch`,children:[(0,y.jsx)(e,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),(0,y.jsx)(`span`,{className:`truncate`,children:_})]})]}),X.length>0&&(0,y.jsx)(`ul`,{"aria-label":`Commands`,className:`flex flex-col gap-px rounded-[10px] bg-surface-2 p-1`,"data-testid":`composer-slash`,children:X.map((e,t)=>(0,y.jsx)(`li`,{children:(0,y.jsxs)(`button`,{type:`button`,onMouseDown:e=>e.preventDefault(),onClick:()=>Fe(e),className:p(`flex h-8 w-full items-center gap-2 rounded-control px-2.5 text-left text-body text-text-1 hover:bg-surface-3`,t===0&&`bg-surface-3`),"data-testid":`composer-slash-${e.id}`,children:[(0,y.jsxs)(`span`,{className:`font-mono text-meta text-text-3`,children:[`/`,e.id]}),(0,y.jsx)(`span`,{className:`shrink-0`,children:e.label}),e.detail&&(0,y.jsx)(`span`,{className:`min-w-0 truncate text-meta text-text-3`,children:e.detail})]})},e.id))}),(0,y.jsxs)(`div`,{className:p(`overflow-hidden rounded-[10px] bg-surface-2 focus-within:ring-2 focus-within:ring-accent/60`,we&&`shadow-float`),children:[We&&(0,y.jsxs)(`div`,{className:`flex flex-col gap-2.5 bg-surface-3 px-3 pt-2.5 pb-2`,"data-testid":`composer-dock`,children:[b,V.length>0&&(0,y.jsx)(`ul`,{className:`flex flex-wrap gap-1.5`,"data-testid":`composer-files`,children:V.map(e=>(0,y.jsxs)(`li`,{className:`inline-flex h-8 max-w-56 items-center gap-1.5 rounded-control bg-surface-4 pr-1 pl-2 text-meta text-text-1`,"data-testid":`composer-file`,children:[e.preview?(0,y.jsx)(`img`,{src:e.preview,alt:``,className:`size-6 rounded-[4px] object-cover`,"data-testid":`composer-thumb`}):(0,y.jsx)(t,{className:`size-3.5 shrink-0 text-text-3`}),(0,y.jsx)(`span`,{className:`truncate`,children:e.file.name}),(0,y.jsx)(`button`,{type:`button`,"aria-label":`Remove ${e.file.name}`,onClick:()=>{k([e]),H(t=>t.filter(t=>t!==e))},className:`rounded-[4px] p-0.5 text-text-3 hover:bg-surface-3 hover:text-text-1`,children:(0,y.jsx)(i,{className:`size-3`})})]},e.key))})]}),(0,y.jsxs)(de,{"data-live":K?``:void 0,className:`[&>[data-slot=input-group]]:bg-transparent`,onSubmit:()=>void Re(!1),onDragOver:e=>e.preventDefault(),onDrop:e=>{e.dataTransfer.files.length&&(e.preventDefault(),$(Array.from(e.dataTransfer.files)))},children:[(0,y.jsx)(fe,{children:(0,y.jsx)(pe,{ref:G,value:z,onChange:e=>B(e.target.value),onKeyDown:ze,onPaste:Be,disabled:q,placeholder:u,"aria-label":u,className:`min-h-6`,"data-testid":`composer-input`})}),(0,y.jsxs)(me,{className:`-ml-1.5`,children:[(0,y.jsxs)(he,{className:`min-w-0 flex-1 gap-0.5 max-sm:overflow-x-auto max-sm:[scrollbar-width:none] max-sm:[&>*]:shrink-0 sm:flex-wrap sm:gap-y-1`,"data-testid":`composer-chips`,"data-scroll-x":!0,children:[!Te&&(0,y.jsx)(m,{label:Ue,side:`top`,children:(0,y.jsx)(D,{"aria-label":`Attach a file`,disabled:q,onClick:()=>Me.current?.click(),className:`w-8 text-text-3`,"data-testid":`composer-attach`,children:(0,y.jsx)(oe,{className:`size-3.5`})})}),(0,y.jsx)(`input`,{ref:Me,type:`file`,multiple:!0,hidden:!0,accept:Q.images===!0?`image/png,image/jpeg,image/webp,image/gif,${j}`:j,onChange:e=>{e.target.files&&$(Array.from(e.target.files)),e.target.value=``},"data-testid":`composer-file-input`}),!N&&(0,y.jsx)(re,{harness:Z,model:d.model,disabled:g||q,onPick:(e,t)=>h({harnessId:e.id,model:t})}),!N&&He&&(0,y.jsx)(te,{harness:Z,model:d.model,effort:d.effort,disabled:g||q,onEffort:e=>h({effort:e}),onModel:e=>h({model:e})}),!N&&(0,y.jsx)(ie,{harness:Z,level:d.accessLevel,onLevel:e=>h({accessLevel:e}),lockedHint:ye??(g?`Kept from the first message`:void 0),disabled:q})]}),(0,y.jsx)(`div`,{className:`ml-auto flex shrink-0 items-center gap-0.5`,children:Ve})]})]})]}),(q||U||I)&&(0,y.jsx)(`p`,{className:p(`px-3 text-meta`,U?`text-danger`:`text-text-2`),"data-testid":U?`composer-refusal`:`composer-blocked`,children:U??(q?x:I)}),L&&(0,y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 px-3 text-meta text-danger`,"data-testid":`composer-undeliverable`,children:[`The run ended before your message reached it.`,R&&(0,y.jsx)(f,{variant:`text`,size:`sm`,onClick:()=>R(L),children:`Save as note`})]})]})}export{se as a,x as i,O as n,b as r,M as t};
@@ -1 +1 @@
1
- import{t as e}from"./utils-A3okWeke.js";import{t}from"./NewThread-HisGwIRc.js";import{t as n}from"./jsx-runtime-Wy9s6hX0.js";var r=n(),i={alerts:`Ask how to send alerts`,services:`Ask how to add a service`,schedules:`Ask how schedules work`};function a({place:n,className:a}){return(0,r.jsx)(`div`,{className:e(`w-full max-w-(--reading-w)`,a),"data-testid":`helper-thread`,"data-place":n,children:(0,r.jsx)(t,{subject:{kind:`none`},branch:null,place:n,placeholder:i[n],autoFocus:!1})})}export{a as t};
1
+ import{t as e}from"./utils-A3okWeke.js";import{t}from"./NewThread-CAT5otyD.js";import{t as n}from"./jsx-runtime-Wy9s6hX0.js";var r=n(),i={alerts:`Ask how to send alerts`,services:`Ask how to add a service`,schedules:`Ask how schedules work`};function a({place:n,className:a}){return(0,r.jsx)(`div`,{className:e(`w-full max-w-(--reading-w)`,a),"data-testid":`helper-thread`,"data-place":n,children:(0,r.jsx)(t,{subject:{kind:`none`},branch:null,place:n,placeholder:i[n],autoFocus:!1})})}export{a as t};