glimmervoid 0.48.2-next.324 → 0.48.2-next.325

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 (116) hide show
  1. package/dist/bin/glimmervoid.js +8 -8
  2. package/dist/chunks/{adapters-D8xHv4PL.js → adapters-DHBg5a1U.js} +2 -2
  3. package/dist/chunks/{adapters-0TN1lwSQ.js → adapters-ybe8U5A9.js} +1 -1
  4. package/dist/chunks/{agent-api-cli-oGfkkamu.js → agent-api-cli-7nA6bFKo.js} +1 -1
  5. package/dist/chunks/{agent-api-cli-LmDZJYBU.js → agent-api-cli-BujQi0eW.js} +1 -1
  6. package/dist/chunks/{agent-api-core-d8buFWR7.js → agent-api-core-CJNGGV_x.js} +1 -1
  7. package/dist/chunks/{build-channel-mugSvSEU.js → build-channel-gWrx6n1v.js} +1 -1
  8. package/dist/chunks/{config-BhW20Z0o.js → config-D3lqEm6E.js} +6 -1
  9. package/dist/chunks/config-store-BCQO3eaR.js +1 -0
  10. package/dist/chunks/{config-store-BU6GyHYN.js → config-store-CLi-efj8.js} +2 -2
  11. package/dist/chunks/{main-zcXkyOXh.js → main-D_aeEHz4.js} +7 -7
  12. package/dist/chunks/{pair-cli-WgDlgw4L.js → pair-cli-BzEL9ZmN.js} +2 -2
  13. package/dist/chunks/{remote-config-Djbp-5a3.js → remote-config-D1QDGYt9.js} +1 -1
  14. package/dist/chunks/{settings-cli-BuTd67kn.js → settings-cli-B9ZQmURc.js} +4 -4
  15. package/dist/chunks/{settings-readout-core-D3gPFroz.js → settings-readout-core-atYka8Qf.js} +1 -1
  16. package/dist/chunks/{ssh-sign-cli-BEDhS81V.js → ssh-sign-cli-3-_rbQ2N.js} +1 -1
  17. package/dist/client/assets/{action-status-CMDI7GJF.js → action-status-2TEW4EL2.js} +1 -1
  18. package/dist/client/assets/action-status-2TEW4EL2.js.br +0 -0
  19. package/dist/client/assets/{benchmark-panel-YhKFG123.js → benchmark-panel-CP4WhCBH.js} +1 -1
  20. package/dist/client/assets/benchmark-panel-CP4WhCBH.js.br +0 -0
  21. package/dist/client/assets/{boards-view-_hclRdRS.js → boards-view-BJYVVuAR.js} +1 -1
  22. package/dist/client/assets/boards-view-BJYVVuAR.js.br +0 -0
  23. package/dist/client/assets/{card-registry-B8Mbwncq.js → card-registry-D5FILlqB.js} +1 -1
  24. package/dist/client/assets/card-registry-D5FILlqB.js.br +0 -0
  25. package/dist/client/assets/community-panel-B_9lv2X8.js +1 -0
  26. package/dist/client/assets/community-panel-B_9lv2X8.js.br +0 -0
  27. package/dist/client/assets/{community-panel-3yirKGM1.css → community-panel-DR_-RgSK.css} +1 -1
  28. package/dist/client/assets/{control-ws-zdIwblY5.js → control-ws-CLjOEjA2.js} +1 -1
  29. package/dist/client/assets/control-ws-CLjOEjA2.js.br +0 -0
  30. package/dist/client/assets/{dialogs-Bv21KgtZ.js → dialogs-CuSD5S0r.js} +1 -1
  31. package/dist/client/assets/dialogs-CuSD5S0r.js.br +0 -0
  32. package/dist/client/assets/{doc-editor-ui-BIdQ_Fxe.js → doc-editor-ui-ClrdLGcB.js} +1 -1
  33. package/dist/client/assets/doc-editor-ui-ClrdLGcB.js.br +0 -0
  34. package/dist/client/assets/{feature-hint-u8l__sRG.js → feature-hint-CTxbYnF7.js} +1 -1
  35. package/dist/client/assets/feature-hint-CTxbYnF7.js.br +0 -0
  36. package/dist/client/assets/{first-run-checklist-C6ixG4ej.js → first-run-checklist-CpnK0-KD.js} +1 -1
  37. package/dist/client/assets/first-run-checklist-CpnK0-KD.js.br +0 -0
  38. package/dist/client/assets/{hooks-panel-DidIDOky.js → hooks-panel-DkucnYh0.js} +1 -1
  39. package/dist/client/assets/hooks-panel-DkucnYh0.js.br +0 -0
  40. package/dist/client/assets/{index-BW8cXix9.js → index-C4QIxDmH.js} +5 -5
  41. package/dist/client/assets/index-C4QIxDmH.js.br +0 -0
  42. package/dist/client/assets/{issues-panel-CJm59-qI.js → issues-panel-CRJ8Tqsd.js} +1 -1
  43. package/dist/client/assets/issues-panel-CRJ8Tqsd.js.br +0 -0
  44. package/dist/client/assets/{my-prs-panel-BQjnd8cl.js → my-prs-panel-D-_SsbTn.js} +1 -1
  45. package/dist/client/assets/my-prs-panel-D-_SsbTn.js.br +0 -0
  46. package/dist/client/assets/{nyan-cat-Zsrxf476.js → nyan-cat-C8ZBpKZC.js} +1 -1
  47. package/dist/client/assets/nyan-cat-C8ZBpKZC.js.br +0 -0
  48. package/dist/client/assets/{phone-shell-BTY-D5oy.js → phone-shell-BY4zkwU3.js} +1 -1
  49. package/dist/client/assets/phone-shell-BY4zkwU3.js.br +0 -0
  50. package/dist/client/assets/{plan-face-DuMdg_iM.js → plan-face-CC57KbS2.js} +1 -1
  51. package/dist/client/assets/plan-face-CC57KbS2.js.br +0 -0
  52. package/dist/client/assets/{plan-render-xH7n9n24.js → plan-render-CBwdbgWh.js} +1 -1
  53. package/dist/client/assets/plan-render-CBwdbgWh.js.br +0 -0
  54. package/dist/client/assets/{pr-queue-columns-GigIMcjy.js → pr-queue-columns-BR9_AlRZ.js} +1 -1
  55. package/dist/client/assets/pr-queue-columns-BR9_AlRZ.js.br +0 -0
  56. package/dist/client/assets/{radar-panel-CXx8X4u-.js → radar-panel-C2y5BKrA.js} +1 -1
  57. package/dist/client/assets/radar-panel-C2y5BKrA.js.br +0 -0
  58. package/dist/client/assets/{repo-roots-adder-YaiE38zm.js → repo-roots-adder-Km-Y5D9I.js} +1 -1
  59. package/dist/client/assets/repo-roots-adder-Km-Y5D9I.js.br +0 -0
  60. package/dist/client/assets/{resume-dialog-DY2aF3yT.js → resume-dialog-DFsSpADn.js} +1 -1
  61. package/dist/client/assets/resume-dialog-DFsSpADn.js.br +0 -0
  62. package/dist/client/assets/{review-queue-panel-DA3XOY37.js → review-queue-panel-BjQZvseg.js} +1 -1
  63. package/dist/client/assets/review-queue-panel-BjQZvseg.js.br +0 -0
  64. package/dist/client/assets/{session-tick-DP1vZPA_.js → session-tick-Bx-5Nn6w.js} +1 -1
  65. package/dist/client/assets/session-tick-Bx-5Nn6w.js.br +0 -0
  66. package/dist/client/assets/{settings-panel-w-UMyqNl.js → settings-panel-B3LsEVG_.js} +2 -2
  67. package/dist/client/assets/settings-panel-B3LsEVG_.js.br +0 -0
  68. package/dist/client/assets/{shown-lightbox-Cft13vCO.js → shown-lightbox-CpXaL3qx.js} +1 -1
  69. package/dist/client/assets/shown-lightbox-CpXaL3qx.js.br +0 -0
  70. package/dist/client/assets/{team-review-panel-DSqhLe8P.js → team-review-panel-CkVcgb_2.js} +1 -1
  71. package/dist/client/assets/team-review-panel-CkVcgb_2.js.br +0 -0
  72. package/dist/client/assets/{trace-panel-CozwJhFT.js → trace-panel-CzdN4h2l.js} +1 -1
  73. package/dist/client/assets/trace-panel-CzdN4h2l.js.br +0 -0
  74. package/dist/client/assets/{updates-view-core-40jpDW2b.js → updates-view-core-C8XDTgVm.js} +1 -1
  75. package/dist/client/assets/updates-view-core-C8XDTgVm.js.br +0 -0
  76. package/dist/client/assets/{usage-panel-2T4jC6_s.js → usage-panel-CZS06nLL.js} +1 -1
  77. package/dist/client/assets/usage-panel-CZS06nLL.js.br +0 -0
  78. package/dist/client/assets/{your-day-tip-gh132qNv.js → your-day-tip-BTTrlVRy.js} +1 -1
  79. package/dist/client/assets/your-day-tip-BTTrlVRy.js.br +0 -0
  80. package/dist/client/index.html +6 -6
  81. package/dist/client/index.html.br +0 -0
  82. package/dist/server/index.js +1 -1
  83. package/package.json +1 -1
  84. package/dist/chunks/config-store-BgVJwvLP.js +0 -1
  85. package/dist/client/assets/action-status-CMDI7GJF.js.br +0 -0
  86. package/dist/client/assets/benchmark-panel-YhKFG123.js.br +0 -0
  87. package/dist/client/assets/boards-view-_hclRdRS.js.br +0 -0
  88. package/dist/client/assets/card-registry-B8Mbwncq.js.br +0 -0
  89. package/dist/client/assets/community-panel-D17s7eZh.js +0 -1
  90. package/dist/client/assets/community-panel-D17s7eZh.js.br +0 -0
  91. package/dist/client/assets/control-ws-zdIwblY5.js.br +0 -0
  92. package/dist/client/assets/dialogs-Bv21KgtZ.js.br +0 -0
  93. package/dist/client/assets/doc-editor-ui-BIdQ_Fxe.js.br +0 -0
  94. package/dist/client/assets/feature-hint-u8l__sRG.js.br +0 -0
  95. package/dist/client/assets/first-run-checklist-C6ixG4ej.js.br +0 -0
  96. package/dist/client/assets/hooks-panel-DidIDOky.js.br +0 -0
  97. package/dist/client/assets/index-BW8cXix9.js.br +0 -0
  98. package/dist/client/assets/issues-panel-CJm59-qI.js.br +0 -0
  99. package/dist/client/assets/my-prs-panel-BQjnd8cl.js.br +0 -0
  100. package/dist/client/assets/nyan-cat-Zsrxf476.js.br +0 -0
  101. package/dist/client/assets/phone-shell-BTY-D5oy.js.br +0 -0
  102. package/dist/client/assets/plan-face-DuMdg_iM.js.br +0 -0
  103. package/dist/client/assets/plan-render-xH7n9n24.js.br +0 -0
  104. package/dist/client/assets/pr-queue-columns-GigIMcjy.js.br +0 -0
  105. package/dist/client/assets/radar-panel-CXx8X4u-.js.br +0 -0
  106. package/dist/client/assets/repo-roots-adder-YaiE38zm.js.br +0 -0
  107. package/dist/client/assets/resume-dialog-DY2aF3yT.js.br +0 -0
  108. package/dist/client/assets/review-queue-panel-DA3XOY37.js.br +0 -0
  109. package/dist/client/assets/session-tick-DP1vZPA_.js.br +0 -0
  110. package/dist/client/assets/settings-panel-w-UMyqNl.js.br +0 -0
  111. package/dist/client/assets/shown-lightbox-Cft13vCO.js.br +0 -0
  112. package/dist/client/assets/team-review-panel-DSqhLe8P.js.br +0 -0
  113. package/dist/client/assets/trace-panel-CozwJhFT.js.br +0 -0
  114. package/dist/client/assets/updates-view-core-40jpDW2b.js.br +0 -0
  115. package/dist/client/assets/usage-panel-2T4jC6_s.js.br +0 -0
  116. package/dist/client/assets/your-day-tip-gh132qNv.js.br +0 -0
@@ -5,7 +5,7 @@ import { a as packageRoot } from "../chunks/runtime-paths-D_ZjJLE0.js";
5
5
  import { n as glimmervoidHomeDir, t as decideConfigPath } from "../chunks/config-path-core-DUWk0Lui.js";
6
6
  import { t as AGENT_API_VERBS } from "../chunks/session-Cc-HBJIZ.js";
7
7
  import { a as execSync } from "../chunks/child-process-safe-BCOoKfxG.js";
8
- import { J as isOwnedCommandName, Y as parseCommand, q as OWNED_COMMAND_SPECS, r as agentCommandHelpLines } from "../chunks/agent-api-core-d8buFWR7.js";
8
+ import { J as isOwnedCommandName, Y as parseCommand, q as OWNED_COMMAND_SPECS, r as agentCommandHelpLines } from "../chunks/agent-api-core-CJNGGV_x.js";
9
9
  import { t as renderTable } from "../chunks/ascii-figure-core-pDAwtlKO.js";
10
10
  import { i as parseCommandLine, r as gitDoctorRows, t as probeGitVersion } from "../chunks/git-version-xS1GFU8P.js";
11
11
  import { i as pnpmGlobalBinDir, n as npmGlobalBinDir, r as onPath, t as formatPathNotice } from "../chunks/path-doctor-C23VAqeu.js";
@@ -62,7 +62,7 @@ var OWNED_COMMAND_RUNNERS = {
62
62
  return 0;
63
63
  },
64
64
  pair: async ({ values }) => {
65
- const { runPairCli } = await import("../chunks/pair-cli-WgDlgw4L.js");
65
+ const { runPairCli } = await import("../chunks/pair-cli-BzEL9ZmN.js");
66
66
  return runPairCli({
67
67
  isListing: values.list === true,
68
68
  revokeDeviceId: typeof values.revoke === "string" ? values.revoke : null,
@@ -74,11 +74,11 @@ var OWNED_COMMAND_RUNNERS = {
74
74
  return runAgentSetupCli();
75
75
  },
76
76
  settings: async (parsed) => {
77
- const { runParsedSettingsCli } = await import("../chunks/settings-cli-BuTd67kn.js");
77
+ const { runParsedSettingsCli } = await import("../chunks/settings-cli-B9ZQmURc.js");
78
78
  return runParsedSettingsCli(parsed);
79
79
  },
80
80
  "ssh-sign": async ({ rawArgs }) => {
81
- const { runSshSignCli } = await import("../chunks/ssh-sign-cli-BEDhS81V.js");
81
+ const { runSshSignCli } = await import("../chunks/ssh-sign-cli-3-_rbQ2N.js");
82
82
  return runSshSignCli(rawArgs);
83
83
  }
84
84
  };
@@ -100,7 +100,7 @@ async function runOwnedCommand(name, subcommandArgs) {
100
100
  return OWNED_COMMAND_RUNNERS[name](parsed);
101
101
  }
102
102
  var SUBCOMMAND_RUNNERS = new Map([...Object.keys(OWNED_COMMAND_SPECS).filter(isOwnedCommandName).map((name) => [name, (subcommandArgs) => runOwnedCommand(name, subcommandArgs)]), ...AGENT_API_VERBS.filter((verb) => !isOwnedCommandName(verb)).map((verb) => [verb, async (subcommandArgs, subcommandName) => {
103
- const { runAgentApiCli } = await import("../chunks/agent-api-cli-oGfkkamu.js");
103
+ const { runAgentApiCli } = await import("../chunks/agent-api-cli-7nA6bFKo.js");
104
104
  return runAgentApiCli([subcommandName, ...subcommandArgs]);
105
105
  }])]);
106
106
  var AGENT_INSTALL_COMMAND_BY_ID = {
@@ -114,7 +114,7 @@ function missingAgentText(agentId) {
114
114
  }
115
115
  async function printSessionLimits() {
116
116
  if (!process.env["GLIMMERVOID_AGENT_URL"]) return;
117
- const { sessionLimitsHelpLines } = await import("../chunks/agent-api-cli-oGfkkamu.js");
117
+ const { sessionLimitsHelpLines } = await import("../chunks/agent-api-cli-7nA6bFKo.js");
118
118
  const limitsLines = await sessionLimitsHelpLines();
119
119
  console.log(`\n${limitsLines.join("\n")}`);
120
120
  }
@@ -171,7 +171,7 @@ async function readDeclaredCustomAgents() {
171
171
  declared: [],
172
172
  error: null
173
173
  };
174
- const { loadConfigFile } = await import("../chunks/config-store-BgVJwvLP.js");
174
+ const { loadConfigFile } = await import("../chunks/config-store-BCQO3eaR.js");
175
175
  try {
176
176
  const loaded = loadConfigFile(decided.path, { exitOnError: false });
177
177
  if (!loaded.config) return {
@@ -247,7 +247,7 @@ async function runDoctor() {
247
247
  }
248
248
  switchSection("Agents");
249
249
  try {
250
- const { listAgentIds, describeAgentResolvability, setCustomAgents } = await import("../chunks/adapters-0TN1lwSQ.js");
250
+ const { listAgentIds, describeAgentResolvability, setCustomAgents } = await import("../chunks/adapters-ybe8U5A9.js");
251
251
  const declaredCustomAgents = await readDeclaredCustomAgents();
252
252
  if (declaredCustomAgents.error) line("config", declaredCustomAgents.error);
253
253
  setCustomAgents(declaredCustomAgents.declared);
@@ -2,7 +2,7 @@ import { a as isMissingFileError, r as errorMessage } from "./text-DoirglWV.js";
2
2
  import { o as relayPath, u as isPathInside } from "./runtime-paths-D_ZjJLE0.js";
3
3
  import { Yt as FULL_SHA_RE, Zt as shortSha$1 } from "./session-Cc-HBJIZ.js";
4
4
  import { c as spawn, i as execFileSync, r as execFileAsync } from "./child-process-safe-BCOoKfxG.js";
5
- import { Ot as UpdateChannel, S as InstallFlavor, c as SHELL_AGENT_ID } from "./config-BhW20Z0o.js";
5
+ import { Ot as UpdateChannel, S as InstallFlavor, c as SHELL_AGENT_ID } from "./config-D3lqEm6E.js";
6
6
  import { o as supervisionLine } from "./session-routes-CyZVo7KV.js";
7
7
  import { a as rawTextOr, o as textOr, r as numberOr } from "./coerce-oz_Z_6E7.js";
8
8
  import { n as parseJsonRecord } from "./json-core-If8h-Qgy.js";
@@ -11,7 +11,7 @@ import { t as buildAgentEnv } from "./spawn-env-Bjy1iYqZ.js";
11
11
  import { t as buildHookCommand } from "./hook-command-core-qTNK-xMF.js";
12
12
  import { i as isSpinnerChar, n as classifyAgentTitle, r as isBrailleChar, t as grok } from "./grok-B2RMzXN-.js";
13
13
  import { O as nextBackoffMs } from "./json-file-AKRVPqG1.js";
14
- import { n as isExperimentalBuild, t as compareReleaseVersions } from "./build-channel-mugSvSEU.js";
14
+ import { n as isExperimentalBuild, t as compareReleaseVersions } from "./build-channel-gWrx6n1v.js";
15
15
  import { n as buildAgentSpawnCommand, r as resolveAgentCommand, t as kimi } from "./kimi-BUCUWtAv.js";
16
16
  import { c as CODEX_HOME_PROFILE, f as renderCodexHookTables, n as AGENT_HOME_CONFIG_NAME, p as renderCodexHooksBlock } from "./agent-home-core-DgW3orTE.js";
17
17
  import { c as releaseAgentHome, i as holdPreparedAgentHome, n as generatedAgentHomePath, s as realAgentHome } from "./agent-home-BzANIIVe.js";
@@ -1 +1 @@
1
- export { a as describeAgentResolvability, l as listAgentIds, f as setCustomAgents } from "./adapters-D8xHv4PL.js";
1
+ export { a as describeAgentResolvability, l as listAgentIds, f as setCustomAgents } from "./adapters-DHBg5a1U.js";
@@ -1 +1 @@
1
- export { t as askAgentApi, r as runAgentApiCli, i as sessionLimitsHelpLines } from "./agent-api-cli-LmDZJYBU.js";
1
+ export { t as askAgentApi, r as runAgentApiCli, i as sessionLimitsHelpLines } from "./agent-api-cli-BujQi0eW.js";
@@ -1,5 +1,5 @@
1
1
  import { l as AgentLimitsReply, r as AGENT_URL_ENV } from "./session-Cc-HBJIZ.js";
2
- import { Y as parseCommand, i as agentCommandSpec, m as isAgentApiVerb, t as AGENT_COMMAND_HELP } from "./agent-api-core-d8buFWR7.js";
2
+ import { Y as parseCommand, i as agentCommandSpec, m as isAgentApiVerb, t as AGENT_COMMAND_HELP } from "./agent-api-core-CJNGGV_x.js";
3
3
  import { i as formatSessionLimits } from "./session-routes-CyZVo7KV.js";
4
4
  import { i as resolveHookTarget } from "./hook-relay-core-DA_bz2KA.js";
5
5
  import { t as parseJsonOrNull } from "./json-core-If8h-Qgy.js";
@@ -1,5 +1,5 @@
1
1
  import { C as RefinedTaskTitle, R as TASK_TITLE_CONTROL_CHARACTERS, Y as WhiteboardAgentRequest, a as AgentAnswerRequest, c as AgentEditRequest, d as AgentReadRequest, f as AgentReviewsRequest, g as AgentSpawnRequest, h as AgentSettingsRequest, n as AGENT_REPLY_SCHEMAS, o as AgentAttentionRequest, p as AgentSendRequest, s as AgentCloseRequest, t as AGENT_API_VERBS, u as AgentPullRequestRequest } from "./session-Cc-HBJIZ.js";
2
- import { D as pullRequestKeyFromReference, l as TASK_TITLE_SOURCE_PRIORITY, o as PersistedTaskTitle } from "./config-BhW20Z0o.js";
2
+ import { D as pullRequestKeyFromReference, l as TASK_TITLE_SOURCE_PRIORITY, o as PersistedTaskTitle } from "./config-D3lqEm6E.js";
3
3
  import { n as NO_OWN_WORKTREE_REASON, t as COMMAND_ROUTES } from "./session-routes-CyZVo7KV.js";
4
4
  import path from "node:path";
5
5
  import { parseArgs } from "node:util";
@@ -1,5 +1,5 @@
1
1
  import "./session-Cc-HBJIZ.js";
2
- import { C as ONBOARDING_STEPS, E as OPERATOR_SURFACES, T as OPERATOR_ACTIONS_BY_SURFACE, b as DASHBOARD_VIEWS, j as HintFeature, n as BUILTIN_AGENT_IDS, w as ONBOARDING_STEP_STATES } from "./config-BhW20Z0o.js";
2
+ import { C as ONBOARDING_STEPS, E as OPERATOR_SURFACES, T as OPERATOR_ACTIONS_BY_SURFACE, b as DASHBOARD_VIEWS, j as HintFeature, n as BUILTIN_AGENT_IDS, w as ONBOARDING_STEP_STATES } from "./config-D3lqEm6E.js";
3
3
  import { z } from "zod";
4
4
  //#region shared/contracts/telemetry.ts
5
5
  var TELEMETRY_ADAPTERS = Object.freeze([...BUILTIN_AGENT_IDS, "custom"]);
@@ -1643,7 +1643,12 @@ var OPERATOR_ACTIONS_BY_SURFACE = Object.freeze({
1643
1643
  "open-shell",
1644
1644
  "check-github-again",
1645
1645
  "save-github-teams",
1646
- "save-review-skill"
1646
+ "save-review-skill",
1647
+ "save-community-key",
1648
+ "save-community-project",
1649
+ "save-community-skill",
1650
+ "save-community-discord",
1651
+ "finish-community-setup"
1647
1652
  ],
1648
1653
  reviews: [
1649
1654
  "open-session",
@@ -0,0 +1 @@
1
+ export { c as loadConfigFile } from "./config-store-CLi-efj8.js";
@@ -1,10 +1,10 @@
1
1
  import { n as errorLabel, r as errorMessage } from "./text-DoirglWV.js";
2
2
  import { a as packageRoot, l as equalsIgnoringCaseOnWindows } from "./runtime-paths-D_ZjJLE0.js";
3
3
  import { n as glimmervoidHomeDir$1, t as decideConfigPath } from "./config-path-core-DUWk0Lui.js";
4
- import { $ as FLYING_ANIMALS_DEFAULTS, Dt as UPDATE_CHANNELS, Q as COMMUNITY_INTERVAL_MINUTES_RANGE, _t as USAGE_RETAIN_DAYS_RANGE, at as NON_NEGATIVE_NUMBER_RANGE, bt as WORKFLOWS_MAX_CONCURRENT_SESSIONS_RANGE, ct as POSTHOG_FIX_TIMEOUT_RANGE, d as BranchGcFileSettings, dt as POSTHOG_TRAFFIC_MIN_USERS_RANGE, et as FLYING_ANIMALS_DURATION_RANGE, f as USAGE_COST_MODES, ft as POSTHOG_TRAFFIC_MULTIPLIER_RANGE, gt as USAGE_INTEGER_RANGES, ht as USAGE_BUDGET_RANGE, i as Config, it as MEMORY_RESERVE_MB_RANGE, lt as POSTHOG_PROJECT_ID_RANGE, m as normalizeLegacyConfigNumbers, mt as TASK_TITLE_TIMEOUT_RANGE, n as BUILTIN_AGENT_IDS, nt as FLYING_ANIMALS_SCALE_RANGE, ot as PORT_RANGE, pt as REPLAY_BUFFER_KB_RANGE, rt as KEEP_MERGEABLE_TIMEOUT_MINUTES_RANGE, s as RUNTIME_CONFIG_SCALAR_KEYS, st as POSITIVE_NUMBER_RANGE, t as AGENT_ID_SHAPE_MESSAGE, tt as FLYING_ANIMALS_GAP_RANGE, u as configIssueMessage, ut as POSTHOG_TRAFFIC_BASELINE_RANGE, vt as USAGE_SCAN_INTERVAL_RANGE, yt as WORKFLOWS_MAX_ACTIONS_PER_POLL_RANGE } from "./config-BhW20Z0o.js";
4
+ import { $ as FLYING_ANIMALS_DEFAULTS, Dt as UPDATE_CHANNELS, Q as COMMUNITY_INTERVAL_MINUTES_RANGE, _t as USAGE_RETAIN_DAYS_RANGE, at as NON_NEGATIVE_NUMBER_RANGE, bt as WORKFLOWS_MAX_CONCURRENT_SESSIONS_RANGE, ct as POSTHOG_FIX_TIMEOUT_RANGE, d as BranchGcFileSettings, dt as POSTHOG_TRAFFIC_MIN_USERS_RANGE, et as FLYING_ANIMALS_DURATION_RANGE, f as USAGE_COST_MODES, ft as POSTHOG_TRAFFIC_MULTIPLIER_RANGE, gt as USAGE_INTEGER_RANGES, ht as USAGE_BUDGET_RANGE, i as Config, it as MEMORY_RESERVE_MB_RANGE, lt as POSTHOG_PROJECT_ID_RANGE, m as normalizeLegacyConfigNumbers, mt as TASK_TITLE_TIMEOUT_RANGE, n as BUILTIN_AGENT_IDS, nt as FLYING_ANIMALS_SCALE_RANGE, ot as PORT_RANGE, pt as REPLAY_BUFFER_KB_RANGE, rt as KEEP_MERGEABLE_TIMEOUT_MINUTES_RANGE, s as RUNTIME_CONFIG_SCALAR_KEYS, st as POSITIVE_NUMBER_RANGE, t as AGENT_ID_SHAPE_MESSAGE, tt as FLYING_ANIMALS_GAP_RANGE, u as configIssueMessage, ut as POSTHOG_TRAFFIC_BASELINE_RANGE, vt as USAGE_SCAN_INTERVAL_RANGE, yt as WORKFLOWS_MAX_ACTIONS_PER_POLL_RANGE } from "./config-D3lqEm6E.js";
5
5
  import { n as isRecord } from "./coerce-oz_Z_6E7.js";
6
6
  import { d as writeJsonAtomicSync, f as writeTextAtomic, p as writeTextAtomicSync } from "./json-file-AKRVPqG1.js";
7
- import { f as FeatureFlagsResponse, g as TELEMETRY_KILL_SWITCH_FLAG, n as isExperimentalBuild, p as MAX_TEXT_LENGTH } from "./build-channel-mugSvSEU.js";
7
+ import { f as FeatureFlagsResponse, g as TELEMETRY_KILL_SWITCH_FLAG, n as isExperimentalBuild, p as MAX_TEXT_LENGTH } from "./build-channel-gWrx6n1v.js";
8
8
  import fs from "node:fs";
9
9
  import path from "node:path";
10
10
  import os from "node:os";
@@ -4,8 +4,8 @@ import { a as packageRoot, c as caseFoldedPathKey, d as safePathSegment, f as sa
4
4
  import { n as glimmervoidHomeDir, r as isOperatorHomeUnderTest, t as decideConfigPath } from "./config-path-core-DUWk0Lui.js";
5
5
  import { $ as MyPrAutoRebase, $t as NODE_ID_RE, A as SIGN_URL_ENV, At as ReviewComment, Bt as TeamReviewStateEntry, Ct as FindingSeverity, D as SESSION_NAME_PATTERN, Dt as PostingPlan, Et as PostedReviewEvent, F as ShownFile, Ft as ReviewVerdict, G as Frame, Gt as canApproveAfterComment, H as BoardRecord, Ht as TeamReviewThreadCommentsResponse, It as TeamReviewActionRequest, J as WHITEBOARD_LIMITS, Jt as hasStandingViewerApproval, K as Note, Kt as decisionAsIfApprovalRequired, L as SshSignRequest, Mt as ReviewFinding, Nt as ReviewResult, O as SESSION_NAME_RULE_TEXT, Ot as PrDetail, Pt as ReviewThreadId, Q as MyPr, Qt as GH_SEGMENT, Rt as TeamReviewCompareFiles, S as ConversationQuestion, St as EarlierReview, T as SESSION_DOC_BODY_CAP_BYTES, Tt as GithubReviewState, Ut as TeamReviewThreadResult, Vt as TeamReviewStatus, W as Box, Wt as TeamReviewThreadsRepository, X as Wire, Xt as HEX_SHA_RE, Z as LinkedPr, Zt as shortSha, _ as COHERENCE_HOOKS_INACTIVE, at as MyPrMergeMethod, b as CONVERSATION_TOOL_RESULT_HOOK_EVENT, bt as CommitSha, cn as MERGEABLE_LIVE_STATES, ct as MyPrMergeStateResponse, en as REPO_SLUG_RE, et as MyPrCheckContext, ft as MyPrThreadNode, ht as MyPrsState, i as ASK_USER_QUESTION_TOOL_NAME, it as MyPrLaneEntry, j as SSH_SIGN_BODY_CAP_BYTES, jt as ReviewDraft, k as SHOWN_FILE_CAP_BYTES, ln as RESTARTABLE_STATES, lt as MyPrMergeWhenReadyRequest, mt as MyPrsSnapshot, nt as MyPrKeepMergeableRequest, on as BADGE_LABELS, ot as MyPrMergeRequest, pt as MyPrThreadsResponse, r as AGENT_URL_ENV, sn as KILLABLE_STATES, tn as repoParts, tt as MyPrCheckContextsResponse, un as STATES, v as CONVERSATION_APPROVAL_SUMMARY_MAX_CHARS, xt as DECIDING_REVIEW_STATES, y as CONVERSATION_PERMISSION_HOOK_EVENT, z as TaskTitle, zt as TeamReviewResolveResponse } from "./session-Cc-HBJIZ.js";
6
6
  import { c as spawn, i as execFileSync, n as execFile, r as execFileAsync, s as refuseLaunchesOf, t as assertLaunchable } from "./child-process-safe-BCOoKfxG.js";
7
- import { $t as issuePullRequestStateFromGithub, A as HINT_VIEW_BY_FEATURE, At as SessionSetup, B as MergedPrListing, Bt as PLAN_RESULT_HOOK_EVENT, Ct as CommunityItem, D as pullRequestKeyFromReference, Et as DISCORD_CHANNEL_NAME_RE, F as BenchmarkJudgement, Ft as ChangeMap, G as GithubPrLightSearchNode, Gt as planTitle, H as PrCheckoutCaseInput, Ht as PlanDecision, I as BenchmarkRun, It as changeMapFactId, J as WorkflowCommentBody, Jt as IssueKey, K as GithubPrsFrame, Kt as GithubIssuePullRequestsRepository, L as BenchmarkStatus, Lt as PLAN_BODY_CAP_BYTES, M as BenchmarkActionRequest, Mt as TraceCheckpoint, N as BenchmarkCase, Nt as TraceRecord, O as FeatureHintState, P as BenchmarkId, Pt as CoherenceJournalOutput, Qt as IssuesStatus, R as BenchmarkSuite, Rt as PLAN_HOOK_EVENT, St as CommunityDraft, Tt as CommunityVerdict, U as GithubPrDetailNode, Ut as PlanRevision, V as MinedPrReviewData, Vt as PLAN_TOOL_NAME, W as GithubPrKey, Wt as parseExitPlanModeHookPayload, X as WorkflowsSettings, Xt as IssuesSearchResponse, Y as WorkflowLabelName, Yt as IssueUpdate, Z as WorkflowsState, Zt as IssuesState, _ as CLIENT_LOG_TEXT_MAX_CHARS, a as ConfigUpdate, c as SHELL_AGENT_ID, f as USAGE_COST_MODES, gt as USAGE_INTEGER_RANGES, h as CHANGES_POLL_INTERVAL_MS, jt as MAX_RAW_LINE_CHARS, k as HINT_FEATURES, kt as UpdateJournal, p as USAGE_VENDOR_KEYS, q as comparablePrKey, qt as GithubIssueResponse, r as BrowserConfig, rt as KEEP_MERGEABLE_TIMEOUT_MINUTES_RANGE, s as RUNTIME_CONFIG_SCALAR_KEYS, u as configIssueMessage, v as CONTROL_FRAME_MAX_BYTES, wt as CommunityState, x as GithubTeam, xt as CommunityActionRequest, y as ClientMessage, z as CommitComparison, zt as PLAN_HOOK_OUTPUT_MAX_CHARS } from "./config-BhW20Z0o.js";
8
- import { A as parseRefinedSessionName, B as resumePromptFor, C as decideTaskTitleRefinement, D as extractPromptTaskTitle, E as extractOscTaskTitle, F as AUTO_CONTINUE_PROMPT, G as isAutoNameOf, H as claudeProjectsDir, I as RESUME_ID_RE, K as nextSuggestedName, L as isConversationReplacedAtStartup, M as resolveRefocusTaskTitle, N as resolveTaskTitle, O as isSelfWakePrompt, P as seedTaskTitleSources, R as pickAutoResume, S as cleanTaskPrompt, T as extractHookTaskTitle, U as listRepoConversations, V as shouldAdoptReportedResumeId, W as listRepoWorktreePaths, _ as projectReviewDetail, a as checkAgentReply, b as buildTaskTitleRefinementPrompt, c as deriveChildSessionName, d as describePushLanding, f as describeRoleRefusal, g as projectMyPrs, h as parseAgentVerb, j as parseRefinedTaskTitle, k as isSubstantivePrompt, l as describeChildEndNote, n as REFUSAL_REASON, o as decideAgentRequest, p as describeUnpushedCloseRefusal, s as decideSpawnAllowance, u as describeKeptChildAttention, v as projectReviews, w as extractAiTitle, x as chooseRefinedSessionName, y as buildPersistedTaskTitle, z as resolveResumeTarget } from "./agent-api-core-d8buFWR7.js";
7
+ import { $t as issuePullRequestStateFromGithub, A as HINT_VIEW_BY_FEATURE, At as SessionSetup, B as MergedPrListing, Bt as PLAN_RESULT_HOOK_EVENT, Ct as CommunityItem, D as pullRequestKeyFromReference, Et as DISCORD_CHANNEL_NAME_RE, F as BenchmarkJudgement, Ft as ChangeMap, G as GithubPrLightSearchNode, Gt as planTitle, H as PrCheckoutCaseInput, Ht as PlanDecision, I as BenchmarkRun, It as changeMapFactId, J as WorkflowCommentBody, Jt as IssueKey, K as GithubPrsFrame, Kt as GithubIssuePullRequestsRepository, L as BenchmarkStatus, Lt as PLAN_BODY_CAP_BYTES, M as BenchmarkActionRequest, Mt as TraceCheckpoint, N as BenchmarkCase, Nt as TraceRecord, O as FeatureHintState, P as BenchmarkId, Pt as CoherenceJournalOutput, Qt as IssuesStatus, R as BenchmarkSuite, Rt as PLAN_HOOK_EVENT, St as CommunityDraft, Tt as CommunityVerdict, U as GithubPrDetailNode, Ut as PlanRevision, V as MinedPrReviewData, Vt as PLAN_TOOL_NAME, W as GithubPrKey, Wt as parseExitPlanModeHookPayload, X as WorkflowsSettings, Xt as IssuesSearchResponse, Y as WorkflowLabelName, Yt as IssueUpdate, Z as WorkflowsState, Zt as IssuesState, _ as CLIENT_LOG_TEXT_MAX_CHARS, a as ConfigUpdate, c as SHELL_AGENT_ID, f as USAGE_COST_MODES, gt as USAGE_INTEGER_RANGES, h as CHANGES_POLL_INTERVAL_MS, jt as MAX_RAW_LINE_CHARS, k as HINT_FEATURES, kt as UpdateJournal, p as USAGE_VENDOR_KEYS, q as comparablePrKey, qt as GithubIssueResponse, r as BrowserConfig, rt as KEEP_MERGEABLE_TIMEOUT_MINUTES_RANGE, s as RUNTIME_CONFIG_SCALAR_KEYS, u as configIssueMessage, v as CONTROL_FRAME_MAX_BYTES, wt as CommunityState, x as GithubTeam, xt as CommunityActionRequest, y as ClientMessage, z as CommitComparison, zt as PLAN_HOOK_OUTPUT_MAX_CHARS } from "./config-D3lqEm6E.js";
8
+ import { A as parseRefinedSessionName, B as resumePromptFor, C as decideTaskTitleRefinement, D as extractPromptTaskTitle, E as extractOscTaskTitle, F as AUTO_CONTINUE_PROMPT, G as isAutoNameOf, H as claudeProjectsDir, I as RESUME_ID_RE, K as nextSuggestedName, L as isConversationReplacedAtStartup, M as resolveRefocusTaskTitle, N as resolveTaskTitle, O as isSelfWakePrompt, P as seedTaskTitleSources, R as pickAutoResume, S as cleanTaskPrompt, T as extractHookTaskTitle, U as listRepoConversations, V as shouldAdoptReportedResumeId, W as listRepoWorktreePaths, _ as projectReviewDetail, a as checkAgentReply, b as buildTaskTitleRefinementPrompt, c as deriveChildSessionName, d as describePushLanding, f as describeRoleRefusal, g as projectMyPrs, h as parseAgentVerb, j as parseRefinedTaskTitle, k as isSubstantivePrompt, l as describeChildEndNote, n as REFUSAL_REASON, o as decideAgentRequest, p as describeUnpushedCloseRefusal, s as decideSpawnAllowance, u as describeKeptChildAttention, v as projectReviews, w as extractAiTitle, x as chooseRefinedSessionName, y as buildPersistedTaskTitle, z as resolveResumeTarget } from "./agent-api-core-CJNGGV_x.js";
9
9
  import { a as permitsHelpCommand, o as supervisionLine, r as describeSessionLimits } from "./session-routes-CyZVo7KV.js";
10
10
  import { a as rawTextOr, i as positiveNumberOr, n as isRecord, o as textOr, r as numberOr, t as coercedNumberOr } from "./coerce-oz_Z_6E7.js";
11
11
  import { i as parseCommandLine, n as warnWhenGitIsTooOld } from "./git-version-xS1GFU8P.js";
@@ -17,15 +17,15 @@ import { r as knownWriteHookInput } from "./posthog-read-gate-core-CeSY56AB.js";
17
17
  import { a as readPageTitle, i as filesAfterRetention, n as decideShownKind, o as shownMimeForFilename, r as describeOverCap, t as SHOWN_SNIFF_BYTES } from "./shown-files-core-CWrkgcoQ.js";
18
18
  import { n as shellQuote } from "./hook-command-core-qTNK-xMF.js";
19
19
  import { C as parseCgroupBytes, D as DEFAULT_MAX_MS, E as DEFAULT_BASE_MS, O as nextBackoffMs, S as memoryReserveBytes, T as parseMemAvailableBytes, _ as createSpawnGate, a as jsonStateLoadError, b as cgroupLimitBytes, c as loadedJsonValue, d as writeJsonAtomicSync, g as createSerialQueue, h as createMemoryAdmission, i as createJsonStateWriter, m as createKeyedSerialQueue, n as appendJsonLines, o as loadJsonStateFile, p as writeTextAtomicSync, r as createJsonStateStore, s as loadJsonStateFileSync, t as appendJsonLine, u as writeJsonAtomic, v as isQueueAdmissionTimeout, w as parseCgroupV2Path, x as headroomFromReadings, y as cgroupAncestorPaths } from "./json-file-AKRVPqG1.js";
20
- import { $ as stableConfigKey, B as buildPersonProperties, F as TELEMETRY_FLAGS_URL, G as decideRemoteTelemetryState, H as claudeAccountUuidOf, I as adapterBucket, J as nodeMajorVersion, K as decideTelemetryConsent, L as buildAiGenerationEvents, M as isExperimentalSetting, N as FIRST_RUN_NOTICE, P as TELEMETRY_BATCH_URL, R as buildBrowserExceptionProperties, U as codexUserIdOf, V as classifySessionExit, W as decideIsDevInstall, X as resolveProjectToken, Y as parsePosthogReleaseId, _ as settingsBlockSpecFor, a as ensureProjectIds, at as sessionIdFromBranch, ct as canonicalizePath, f as DEFAULT_TIMER_FNS, g as mergeSettingsBlock, i as createConfigStore, it as planWorktreeGc, k as valueAtPath, lt as comparableDirectoryPath, n as DEFAULT_CONFIG, nt as matchedPrefix, o as generateProjectId, ot as usablePrefixes, p as unrefTimer, q as exceptionFingerprint, rt as planBranchGc, s as glimmervoidHomeDir$1, st as worktreeIntegrationTips, t as ABORT_CONFIG_SAVE, tt as DEFAULT_BRANCH_GC_PREFIXES, ut as isSameDirectoryPath, v as validateSettingsBlock, y as SETTINGS_INDEX, z as buildExceptionProperties } from "./config-store-BU6GyHYN.js";
21
- import { _ as TelemetryState, a as DEEP_HISTORY_SCROLLBACK_LINES, c as describeDataAttach, d as DashboardTelemetryReport, h as TELEMETRY_EVENT_SCHEMAS, i as HookEnvelope, l as parseDataAttach, m as PendingCrashReport, r as HTTP_URL_RE, s as LOGGED_FAST_CLOSE_COUNTS, u as parseDataClientMessage } from "./build-channel-mugSvSEU.js";
20
+ import { $ as stableConfigKey, B as buildPersonProperties, F as TELEMETRY_FLAGS_URL, G as decideRemoteTelemetryState, H as claudeAccountUuidOf, I as adapterBucket, J as nodeMajorVersion, K as decideTelemetryConsent, L as buildAiGenerationEvents, M as isExperimentalSetting, N as FIRST_RUN_NOTICE, P as TELEMETRY_BATCH_URL, R as buildBrowserExceptionProperties, U as codexUserIdOf, V as classifySessionExit, W as decideIsDevInstall, X as resolveProjectToken, Y as parsePosthogReleaseId, _ as settingsBlockSpecFor, a as ensureProjectIds, at as sessionIdFromBranch, ct as canonicalizePath, f as DEFAULT_TIMER_FNS, g as mergeSettingsBlock, i as createConfigStore, it as planWorktreeGc, k as valueAtPath, lt as comparableDirectoryPath, n as DEFAULT_CONFIG, nt as matchedPrefix, o as generateProjectId, ot as usablePrefixes, p as unrefTimer, q as exceptionFingerprint, rt as planBranchGc, s as glimmervoidHomeDir$1, st as worktreeIntegrationTips, t as ABORT_CONFIG_SAVE, tt as DEFAULT_BRANCH_GC_PREFIXES, ut as isSameDirectoryPath, v as validateSettingsBlock, y as SETTINGS_INDEX, z as buildExceptionProperties } from "./config-store-CLi-efj8.js";
21
+ import { _ as TelemetryState, a as DEEP_HISTORY_SCROLLBACK_LINES, c as describeDataAttach, d as DashboardTelemetryReport, h as TELEMETRY_EVENT_SCHEMAS, i as HookEnvelope, l as parseDataAttach, m as PendingCrashReport, r as HTTP_URL_RE, s as LOGGED_FAST_CLOSE_COUNTS, u as parseDataClientMessage } from "./build-channel-gWrx6n1v.js";
22
22
  import { i as resolveArgvCommandMatches } from "./kimi-BUCUWtAv.js";
23
- import { $ as isUsageFile, A as exceedsUploadCap, B as isOversizedPartialLine, C as parseResolvedSha, Ct as totalTokensOf$1, D as MAX_UPLOAD_BYTES, E as openContainedFile, Et as claudeCode, F as MAX_TRANSCRIPT_READ_BYTES, G as codexHomes, H as resumeOffsetFrom, I as TRACE_TAIL_SCAN_BYTES, J as continuationDelayMs, K as codexRootCandidates, L as committedOffsetFromTraceTailOrNull, M as imageMimeForUploadFilename, N as isSafePathSegment, O as buildUploadFilename, P as planUploadRetention, Q as grokHomes, R as completeLineBytes, S as parseRegistryLatest, St as shouldReplace, T as shortSha$1, Tt as HOOK_TOOLS, U as withCommittedOffset, V as planContiguousRead, W as codexFallbackRoots, X as dedupeCodexFiles, Y as decideFileRead, Z as expandTilde, _ as decideUpdateStatus, _t as identityFromRelPath, a as describeAgentResolvability, at as sessionsRootCandidates, b as normalizeUpdateChannel, bt as parseJsonLine, c as isKnownAgentId, ct as splitLines, d as resolveAdapter, dt as addEntryToTotals, et as kimiHomes, f as setCustomAgents, ft as dedupKeys, g as decideInstallFlavor, gt as foldReplacementIntoGenerationRollup, h as requestCodexAppServer, ht as foldEntryIntoGenerationRollup, i as customAgentFingerprint, it as scopedClaudeRoots, j as framePathPaste, k as decideUploadType, l as listAgentIds, lt as kimiDedupIdentity, m as readHostCodexVersion, mt as expandAdvisorIterations, n as cachedAgentResolvability, nt as projectDirCandidates, o as getAdapter, ot as shouldEvaluateDespiteIoFailures, p as codex, pt as emptyTotals, q as codexSessionIdFromPath, r as commandFor, rt as resolveProjectsDirs, s as hookProfileOf, st as shouldPersistWarehouse, t as DEFAULT_AGENT_ID$1, tt as passOutcome, u as resetCommandCache, ut as parseKimiUsageLine, v as isCheckFresh, vt as isWithinGenerationRecencyWindow, w as pickNewestPublished, wt as vendorUsageEntry, x as parseRegistryDeprecation, xt as parseUsageLine, y as normalizeSha, yt as mergeGenerationRollups, z as containmentRefusalReason } from "./adapters-D8xHv4PL.js";
23
+ import { $ as isUsageFile, A as exceedsUploadCap, B as isOversizedPartialLine, C as parseResolvedSha, Ct as totalTokensOf$1, D as MAX_UPLOAD_BYTES, E as openContainedFile, Et as claudeCode, F as MAX_TRANSCRIPT_READ_BYTES, G as codexHomes, H as resumeOffsetFrom, I as TRACE_TAIL_SCAN_BYTES, J as continuationDelayMs, K as codexRootCandidates, L as committedOffsetFromTraceTailOrNull, M as imageMimeForUploadFilename, N as isSafePathSegment, O as buildUploadFilename, P as planUploadRetention, Q as grokHomes, R as completeLineBytes, S as parseRegistryLatest, St as shouldReplace, T as shortSha$1, Tt as HOOK_TOOLS, U as withCommittedOffset, V as planContiguousRead, W as codexFallbackRoots, X as dedupeCodexFiles, Y as decideFileRead, Z as expandTilde, _ as decideUpdateStatus, _t as identityFromRelPath, a as describeAgentResolvability, at as sessionsRootCandidates, b as normalizeUpdateChannel, bt as parseJsonLine, c as isKnownAgentId, ct as splitLines, d as resolveAdapter, dt as addEntryToTotals, et as kimiHomes, f as setCustomAgents, ft as dedupKeys, g as decideInstallFlavor, gt as foldReplacementIntoGenerationRollup, h as requestCodexAppServer, ht as foldEntryIntoGenerationRollup, i as customAgentFingerprint, it as scopedClaudeRoots, j as framePathPaste, k as decideUploadType, l as listAgentIds, lt as kimiDedupIdentity, m as readHostCodexVersion, mt as expandAdvisorIterations, n as cachedAgentResolvability, nt as projectDirCandidates, o as getAdapter, ot as shouldEvaluateDespiteIoFailures, p as codex, pt as emptyTotals, q as codexSessionIdFromPath, r as commandFor, rt as resolveProjectsDirs, s as hookProfileOf, st as shouldPersistWarehouse, t as DEFAULT_AGENT_ID$1, tt as passOutcome, u as resetCommandCache, ut as parseKimiUsageLine, v as isCheckFresh, vt as isWithinGenerationRecencyWindow, w as pickNewestPublished, wt as vendorUsageEntry, x as parseRegistryDeprecation, xt as parseUsageLine, y as normalizeSha, yt as mergeGenerationRollups, z as containmentRefusalReason } from "./adapters-DHBg5a1U.js";
24
24
  import { c as CODEX_HOME_PROFILE, l as KIMI_HOME_PROFILE } from "./agent-home-core-DgW3orTE.js";
25
25
  import { d as releaseSessionLock, f as sessionIdOfLockFile, l as releaseUnheldAgentHomeSecrets, n as generatedAgentHomePath, p as trashSessionTempFolderOnceUnheld, s as realAgentHome, u as createHeldSessionTempFolder } from "./agent-home-BzANIIVe.js";
26
26
  import { a as formatSshPublicKey, c as orderAgentSockets, i as commitSigningShimText, l as parseSshPublicKey, n as NO_AGENT_HOLDS_KEY, o as isForwardedAgentDirName, r as agentListsKey, s as isSignableGitObject, t as COMMIT_SIGNING_SHIM_NAME } from "./ssh-signing-core-CRhVVWNW.js";
27
- import { a as configSiblingPath, c as defaultPairingsPath, d as decideDeviceAuth, f as deviceNameFromUserAgent, l as defaultSeenPath, n as normalizeRemoteConfig, o as createPairingsStore, p as hashSecret, r as validateRemoteConfig, s as createSeenStore, t as decideBindHost, u as DEFAULT_DEVICE_MAX_AGE_MS } from "./remote-config-Djbp-5a3.js";
28
- import { n as configFileViewOf, u as readSettingsForAgent } from "./settings-readout-core-D3gPFroz.js";
27
+ import { a as configSiblingPath, c as defaultPairingsPath, d as decideDeviceAuth, f as deviceNameFromUserAgent, l as defaultSeenPath, n as normalizeRemoteConfig, o as createPairingsStore, p as hashSecret, r as validateRemoteConfig, s as createSeenStore, t as decideBindHost, u as DEFAULT_DEVICE_MAX_AGE_MS } from "./remote-config-D1QDGYt9.js";
28
+ import { n as configFileViewOf, u as readSettingsForAgent } from "./settings-readout-core-atYka8Qf.js";
29
29
  import { createRequire } from "node:module";
30
30
  import fs, { readFileSync } from "node:fs";
31
31
  import path, { join, resolve } from "node:path";
@@ -1,6 +1,6 @@
1
1
  import { r as errorMessage } from "./text-DoirglWV.js";
2
- import { l as resolveConfigPath } from "./config-store-BU6GyHYN.js";
3
- import { c as defaultPairingsPath, i as REVOCATION_PROPAGATION_SECONDS, l as defaultSeenPath, n as normalizeRemoteConfig, o as createPairingsStore, s as createSeenStore } from "./remote-config-Djbp-5a3.js";
2
+ import { l as resolveConfigPath } from "./config-store-CLi-efj8.js";
3
+ import { c as defaultPairingsPath, i as REVOCATION_PROPAGATION_SECONDS, l as defaultSeenPath, n as normalizeRemoteConfig, o as createPairingsStore, s as createSeenStore } from "./remote-config-D1QDGYt9.js";
4
4
  import fs from "node:fs";
5
5
  //#region server/text-format.ts
6
6
  function trimIso(iso) {
@@ -2,7 +2,7 @@ import { n as errorLabel, r as errorMessage } from "./text-DoirglWV.js";
2
2
  import { l as equalsIgnoringCaseOnWindows } from "./runtime-paths-D_ZjJLE0.js";
3
3
  import { n as isRecord } from "./coerce-oz_Z_6E7.js";
4
4
  import { a as jsonStateLoadError, d as writeJsonAtomicSync, l as sleepSync, s as loadJsonStateFileSync, u as writeJsonAtomic } from "./json-file-AKRVPqG1.js";
5
- import { ct as canonicalizePath, f as DEFAULT_TIMER_FNS, p as unrefTimer, s as glimmervoidHomeDir } from "./config-store-BU6GyHYN.js";
5
+ import { ct as canonicalizePath, f as DEFAULT_TIMER_FNS, p as unrefTimer, s as glimmervoidHomeDir } from "./config-store-CLi-efj8.js";
6
6
  import fs from "node:fs";
7
7
  import path from "node:path";
8
8
  import crypto from "node:crypto";
@@ -1,11 +1,11 @@
1
1
  import { r as errorMessage, t as errorCode } from "./text-DoirglWV.js";
2
2
  import { n as glimmervoidHomeDir, t as decideConfigPath } from "./config-path-core-DUWk0Lui.js";
3
3
  import { m as AgentSettingsReply } from "./session-Cc-HBJIZ.js";
4
- import { r as BrowserConfig } from "./config-BhW20Z0o.js";
4
+ import { r as BrowserConfig } from "./config-D3lqEm6E.js";
5
5
  import { n as isRecord } from "./coerce-oz_Z_6E7.js";
6
6
  import { t as renderTable } from "./ascii-figure-core-pDAwtlKO.js";
7
- import { E as setValueAtPath, Q as readEnvSecrets, T as scoreSettingsSearch, Z as ENV_SECRET_BINDINGS, b as cloneValue, c as loadConfigFile, d as validateConfig, et as withEnvSecrets, j as SETTINGS_REGISTRY, k as valueAtPath, m as isSettingAvailable, r as IS_EXPERIMENTAL_BUILD, u as saveConfigFileOnce, w as parsePosthogProjectSelection, x as deleteValueAtPath } from "./config-store-BU6GyHYN.js";
8
- import { a as fail, c as listSettings, d as renderSectionTables, f as requireConfigFileSetting, g as valueText, h as succeed, i as describeSetting, l as readSetting, m as settingsRequestForServer, n as configFileViewOf, o as fitColumn, p as sectionOf, r as defaultText, s as getSetting, t as availableSettings } from "./settings-readout-core-D3gPFroz.js";
7
+ import { E as setValueAtPath, Q as readEnvSecrets, T as scoreSettingsSearch, Z as ENV_SECRET_BINDINGS, b as cloneValue, c as loadConfigFile, d as validateConfig, et as withEnvSecrets, j as SETTINGS_REGISTRY, k as valueAtPath, m as isSettingAvailable, r as IS_EXPERIMENTAL_BUILD, u as saveConfigFileOnce, w as parsePosthogProjectSelection, x as deleteValueAtPath } from "./config-store-CLi-efj8.js";
8
+ import { a as fail, c as listSettings, d as renderSectionTables, f as requireConfigFileSetting, g as valueText, h as succeed, i as describeSetting, l as readSetting, m as settingsRequestForServer, n as configFileViewOf, o as fitColumn, p as sectionOf, r as defaultText, s as getSetting, t as availableSettings } from "./settings-readout-core-atYka8Qf.js";
9
9
  import fs from "node:fs";
10
10
  import os from "node:os";
11
11
  //#region server/settings-cli.ts
@@ -303,7 +303,7 @@ function runParsedSettingsCommand(parsed, io) {
303
303
  async function runParsedSettingsCli(parsed, io = processIo()) {
304
304
  const serverRequest = settingsRequestForServer(parsed, process.env);
305
305
  if (!serverRequest) return runParsedSettingsCommand(parsed, io);
306
- const { askAgentApi } = await import("./agent-api-cli-oGfkkamu.js");
306
+ const { askAgentApi } = await import("./agent-api-cli-7nA6bFKo.js");
307
307
  const reply = AgentSettingsReply.safeParse(await askAgentApi("settings", serverRequest).catch((error) => ({
308
308
  ok: false,
309
309
  error: errorMessage(error)
@@ -1,6 +1,6 @@
1
1
  import { h as AgentSettingsRequest } from "./session-Cc-HBJIZ.js";
2
2
  import { t as renderTable } from "./ascii-figure-core-pDAwtlKO.js";
3
- import { A as FILE_ONLY_GROUPS, C as hasScaledUnit, D as settingsGroupOf, O as settingsOf, Q as readEnvSecrets, S as displayText, b as cloneValue, j as SETTINGS_REGISTRY, k as valueAtPath, m as isSettingAvailable, y as SETTINGS_INDEX } from "./config-store-BU6GyHYN.js";
3
+ import { A as FILE_ONLY_GROUPS, C as hasScaledUnit, D as settingsGroupOf, O as settingsOf, Q as readEnvSecrets, S as displayText, b as cloneValue, j as SETTINGS_REGISTRY, k as valueAtPath, m as isSettingAvailable, y as SETTINGS_INDEX } from "./config-store-CLi-efj8.js";
4
4
  //#region server/core/settings-readout-core.ts
5
5
  var VALUE_COLUMN_WIDTH = 40;
6
6
  var SECTION_BY_SETTING_ID = new Map([...SETTINGS_REGISTRY.sections.flatMap((section) => section.settings.map((setting) => [setting.id, {
@@ -2,7 +2,7 @@ import { r as errorMessage } from "./text-DoirglWV.js";
2
2
  import { A as SIGN_URL_ENV, I as SshSignReply } from "./session-Cc-HBJIZ.js";
3
3
  import { c as spawn, r as execFileAsync } from "./child-process-safe-BCOoKfxG.js";
4
4
  import { a as isLoopbackHostname } from "./hook-relay-core-DA_bz2KA.js";
5
- import { n as postToAgentIngress } from "./agent-api-cli-LmDZJYBU.js";
5
+ import { n as postToAgentIngress } from "./agent-api-cli-BujQi0eW.js";
6
6
  import { l as parseSshPublicKey } from "./ssh-signing-core-CRhVVWNW.js";
7
7
  import path from "node:path";
8
8
  import fs from "node:fs/promises";
@@ -1 +1 @@
1
- import{G as e,H as t,n}from"./updates-view-core-40jpDW2b.js";import{S as r,s as i}from"./dom-helpers-DBbFg1c_.js";import{c as a,d as o,u as s}from"./control-ws-zdIwblY5.js";var c=`http://www.w3.org/2000/svg`;function l(e,t){let n=document.createElementNS(c,e);for(let[e,r]of Object.entries(t))n.setAttribute(e,r);return n}function u(e,t){let n=document.createElementNS(c,`svg`);return n.setAttribute(`width`,String(e)),n.setAttribute(`height`,String(t)),n.setAttribute(`viewBox`,`0 0 ${e} ${t}`),n.setAttribute(`aria-hidden`,`true`),n}var d=`M4 4L12 12M12 4L4 12`,f=`M10 3L5 8L10 13`,p=`M3 8h0.01M8 8h0.01M13 8h0.01`,m=`M8 2.5v6M5 5.5h6M5 12.5h6`,h=`M4.5 12.5h7a3 3 0 0 0 0.4-5.97a4 4 0 0 0-7.7 0.57a2.7 2.7 0 0 0 0.3 5.4z`,g=`M8 1.8l5.2 2v4c0 3.2-2.2 5.4-5.2 6.4c-3-1-5.2-3.2-5.2-6.4v-4z`,_=`M9.2 1.5L3.5 9h4.3l-1 5.5L12.5 7H8.2z`,v=`M8.7 4.2L5.6 8.6h2.5l-.6 3.2l3.1-4.4H8.1z`,y=`M3 13V9M8 13V3M13 13V6.5`;function b(e,t=`2`){let n=u(16,16);return n.classList.add(`line-icon`),n.append(l(`path`,{d:e,fill:`none`,stroke:`currentColor`,"stroke-width":t,"stroke-linecap":`round`,"stroke-linejoin":`round`})),n}function x(e,t){let{class:n,...r}=t,i=u(16,16);return n!==void 0&&i.classList.add(n),i.append(l(e,r)),i}function S(e){let t=document.createElement(`span`);t.className=`status-icon`,t.dataset.icon=e;for(let n of r[e])t.append(x(n.tag,n.attributes));return t}function C(e,t){e.dataset.icon!==t&&(e.dataset.icon=t,e.replaceChildren(S(t)))}var w={busy:`text-text-muted`,ok:`text-state-done`,error:`text-state-failed`},T=15e3,E=`Something went wrong. Details are hidden in streamer mode.`;function D(e,t){return e!==`error`||t.startsWith(`Not connected to the server. Reconnecting.`)?t:document.documentElement.hasAttribute(`data-streamer`)?E:t}var O={busy:`working`,ok:`complete`,error:`failed`};function k(e){let t=e.querySelector(`:scope > .action-status-icon`),n=e.querySelector(`:scope > .action-status-text`);if(t&&n&&e.childNodes.length===2)return{iconElement:t,textElement:n};let r=i(`span`,`action-status-icon`);r.setAttribute(`aria-hidden`,`true`);let a=i(`span`,`action-status-text`);return e.replaceChildren(r,a),{iconElement:r,textElement:a}}function A(e){e.replaceChildren(),delete e.dataset.tone}function j(e,t,n){if(!n){A(e);return}if(!t){A(e),e.textContent=n;return}e.dataset.tone=t;let{iconElement:r,textElement:i}=k(e);C(r,O[t]),i.textContent=D(t,n)}function M(e=`action-status`){let t=i(`p`,e);return t.setAttribute(`role`,`status`),t.hidden=!0,{element:t,show:(n,r)=>{t.className=`${e} text-meta ${w[n]}`,j(t,n,r),t.hidden=!r},clear:()=>{t.hidden=!0,A(t)}}}function N(e,t){return s(e)?!0:(t.show(`error`,n),!1)}function P(e,t){let n=e instanceof Error?e.message:``;return n===`Request timed out`?`The server did not answer within ${Math.round(t/1e3)} s.`:n||`Not connected to the server. Reconnecting.`}async function F(e,t,n,{busyText:r,timeoutMs:i=T}={}){r&&n.show(`busy`,r);try{let r=await o(e,t,{timeoutMs:i});return n.clear(),r}catch(e){return n.show(`error`,P(e,i)),null}}var I=null,L=3e4,R=null;function z(){let e=document.getElementById(`header-status`),t=document.getElementById(`header-status-text`),n=document.getElementById(`header-status-age`),r=document.getElementById(`header-status-dismiss`);return!e||!t||!n||!r?null:(r.dataset.wired===void 0&&(r.dataset.wired=``,r.addEventListener(`click`,W)),{line:e,text:t,age:n})}function B(){let n=z();if(!n||!I)return;let r=e(Date.now()-I.raisedAt,{...t,justNowBelowSeconds:60});n.age.textContent!==r&&(n.age.textContent=r)}function V({source:e,sessionId:t,message:n,hidesInStreamerMode:r=!0}){a(e,n);let o=z();if(!o)return;let s=r?D(`error`,n):n,c=i(`strong`,`header-status-source`,e);o.text.replaceChildren(c,` ${s}`),o.text.title=`${e}: ${s}`,I={source:e,sessionId:t??null,raisedAt:Date.now()},B(),R??=window.setInterval(B,L),o.line.hidden=!1}function H(e,t){I?.source===e&&(t===void 0||I.sessionId===t)&&W()}function U(e){I?.sessionId===e&&W()}function W(){I=null,R!==null&&window.clearInterval(R),R=null;let e=z();e&&(e.line.hidden=!0,e.text.replaceChildren(),e.text.title=``,e.age.textContent=``)}export{l as S,v as _,j as a,b,F as c,f as d,_ as f,p as g,h,M as i,N as l,d as m,H as n,V as o,m as p,U as r,P as s,T as t,C as u,g as v,u as x,y};
1
+ import{G as e,H as t,n}from"./updates-view-core-C8XDTgVm.js";import{S as r,s as i}from"./dom-helpers-DBbFg1c_.js";import{c as a,d as o,u as s}from"./control-ws-CLjOEjA2.js";var c=`http://www.w3.org/2000/svg`;function l(e,t){let n=document.createElementNS(c,e);for(let[e,r]of Object.entries(t))n.setAttribute(e,r);return n}function u(e,t){let n=document.createElementNS(c,`svg`);return n.setAttribute(`width`,String(e)),n.setAttribute(`height`,String(t)),n.setAttribute(`viewBox`,`0 0 ${e} ${t}`),n.setAttribute(`aria-hidden`,`true`),n}var d=`M4 4L12 12M12 4L4 12`,f=`M10 3L5 8L10 13`,p=`M3 8h0.01M8 8h0.01M13 8h0.01`,m=`M8 2.5v6M5 5.5h6M5 12.5h6`,h=`M4.5 12.5h7a3 3 0 0 0 0.4-5.97a4 4 0 0 0-7.7 0.57a2.7 2.7 0 0 0 0.3 5.4z`,g=`M8 1.8l5.2 2v4c0 3.2-2.2 5.4-5.2 6.4c-3-1-5.2-3.2-5.2-6.4v-4z`,_=`M9.2 1.5L3.5 9h4.3l-1 5.5L12.5 7H8.2z`,v=`M8.7 4.2L5.6 8.6h2.5l-.6 3.2l3.1-4.4H8.1z`,y=`M3 13V9M8 13V3M13 13V6.5`;function b(e,t=`2`){let n=u(16,16);return n.classList.add(`line-icon`),n.append(l(`path`,{d:e,fill:`none`,stroke:`currentColor`,"stroke-width":t,"stroke-linecap":`round`,"stroke-linejoin":`round`})),n}function x(e,t){let{class:n,...r}=t,i=u(16,16);return n!==void 0&&i.classList.add(n),i.append(l(e,r)),i}function S(e){let t=document.createElement(`span`);t.className=`status-icon`,t.dataset.icon=e;for(let n of r[e])t.append(x(n.tag,n.attributes));return t}function C(e,t){e.dataset.icon!==t&&(e.dataset.icon=t,e.replaceChildren(S(t)))}var w={busy:`text-text-muted`,ok:`text-state-done`,error:`text-state-failed`},T=15e3,E=`Something went wrong. Details are hidden in streamer mode.`;function D(e,t){return e!==`error`||t.startsWith(`Not connected to the server. Reconnecting.`)?t:document.documentElement.hasAttribute(`data-streamer`)?E:t}var O={busy:`working`,ok:`complete`,error:`failed`};function k(e){let t=e.querySelector(`:scope > .action-status-icon`),n=e.querySelector(`:scope > .action-status-text`);if(t&&n&&e.childNodes.length===2)return{iconElement:t,textElement:n};let r=i(`span`,`action-status-icon`);r.setAttribute(`aria-hidden`,`true`);let a=i(`span`,`action-status-text`);return e.replaceChildren(r,a),{iconElement:r,textElement:a}}function A(e){e.replaceChildren(),delete e.dataset.tone}function j(e,t,n){if(!n){A(e);return}if(!t){A(e),e.textContent=n;return}e.dataset.tone=t;let{iconElement:r,textElement:i}=k(e);C(r,O[t]),i.textContent=D(t,n)}function M(e=`action-status`){let t=i(`p`,e);return t.setAttribute(`role`,`status`),t.hidden=!0,{element:t,show:(n,r)=>{t.className=`${e} text-meta ${w[n]}`,j(t,n,r),t.hidden=!r},clear:()=>{t.hidden=!0,A(t)}}}function N(e,t){return s(e)?!0:(t.show(`error`,n),!1)}function P(e,t){let n=e instanceof Error?e.message:``;return n===`Request timed out`?`The server did not answer within ${Math.round(t/1e3)} s.`:n||`Not connected to the server. Reconnecting.`}async function F(e,t,n,{busyText:r,timeoutMs:i=T}={}){r&&n.show(`busy`,r);try{let r=await o(e,t,{timeoutMs:i});return n.clear(),r}catch(e){return n.show(`error`,P(e,i)),null}}var I=null,L=3e4,R=null;function z(){let e=document.getElementById(`header-status`),t=document.getElementById(`header-status-text`),n=document.getElementById(`header-status-age`),r=document.getElementById(`header-status-dismiss`);return!e||!t||!n||!r?null:(r.dataset.wired===void 0&&(r.dataset.wired=``,r.addEventListener(`click`,W)),{line:e,text:t,age:n})}function B(){let n=z();if(!n||!I)return;let r=e(Date.now()-I.raisedAt,{...t,justNowBelowSeconds:60});n.age.textContent!==r&&(n.age.textContent=r)}function V({source:e,sessionId:t,message:n,hidesInStreamerMode:r=!0}){a(e,n);let o=z();if(!o)return;let s=r?D(`error`,n):n,c=i(`strong`,`header-status-source`,e);o.text.replaceChildren(c,` ${s}`),o.text.title=`${e}: ${s}`,I={source:e,sessionId:t??null,raisedAt:Date.now()},B(),R??=window.setInterval(B,L),o.line.hidden=!1}function H(e,t){I?.source===e&&(t===void 0||I.sessionId===t)&&W()}function U(e){I?.sessionId===e&&W()}function W(){I=null,R!==null&&window.clearInterval(R),R=null;let e=z();e&&(e.line.hidden=!0,e.text.replaceChildren(),e.text.title=``,e.age.textContent=``)}export{l as S,v as _,j as a,b,F as c,f as d,_ as f,p as g,h,M as i,N as l,d as m,H as n,V as o,m as p,U as r,P as s,T as t,C as u,g as v,u as x,y};
@@ -1 +1 @@
1
- import"./updates-view-core-40jpDW2b.js";import{n as e,r as t,s as n}from"./dom-helpers-DBbFg1c_.js";import{$ as r,Q as i,et as a}from"./index-BW8cXix9.js";var o={mine:`Mine`,run:`Run`,cancel:`Cancel`},s=null;function c(e){return e===null?`n/a`:`${Math.round(e*100)}%`}function l(e){if(e===null)return`n/a`;let t=Math.round(e*100);return t>0?`+${t}`:String(t)}function u(e,t,i){let a=n(`button`,`bench-action-button`,o[t]);return a.type=`button`,a.disabled=i,a.addEventListener(`click`,()=>r(e.id,t)),a}function d(e,t){let n=e.inFlight;if(!n||n.suiteId!==t.id)return``;let r=n.caseId?`case ${n.caseId}, `:``;return`Cell ${n.cellIndex+1} of ${n.cellCount}: ${r}arm ${n.armId}, trial ${n.trial}, ${n.phase}.`}function f(e){let t=n(`td`,`bench-score`,c(e?.recall??null));return e&&e.invalid>0&&(t.title=`${e.invalid} invalid or failed cell(s)`),e&&e.degraded>0&&(t.dataset.degraded=`true`),t}function p(e){let t=e.armIds.filter(t=>t!==e.baselineArm),r=n(`table`,`bench-table`),i=n(`tr`);i.append(n(`th`,null,`Case`),...e.armIds.map(t=>n(`th`,null,t===e.baselineArm?`${t} (baseline)`:t))),i.append(...t.map(e=>n(`th`,null,`${e} vs baseline`))),r.append(i);for(let i of e.rows){let a=n(`tr`);a.append(n(`td`,`bench-case`,i.caseId),...e.armIds.map(e=>f(i.arms[e]))),a.append(...t.map(e=>n(`td`,`bench-delta`,l(i.deltaVsBaseline[e]??null)))),r.append(a)}let a=[...new Set(e.armIds.flatMap(t=>Object.keys(e.totals[t]?.recallByTag??{})))].sort(),o=n(`tr`,`bench-total`);o.append(n(`td`,`bench-case`,`Paired recall`),...e.armIds.map(t=>f(e.totals[t]))),r.append(o);for(let t of a){let i=n(`tr`,`bench-total`);i.append(n(`td`,`bench-case`,`Recall, ${t}`),...e.armIds.map(r=>n(`td`,`bench-score`,c(e.totals[r]?.recallByTag[t]??null)))),r.append(i)}return r}function m(e,r){let{isServerConnected:a,pendingActionBySuite:o,outcomeBySuite:s}=i(),c=n(`div`,`bench-suite`),l=e.inFlight?.suiteId===r.id,f=!!e.inFlight&&!l,m=o.has(r.id)||!a,h=n(`div`,`bench-summary`);h.append(n(`span`,`bench-suite-title`,r.title),t(`bench`,r.caseCount===1?`case`:`cases`,String(r.caseCount)),t(`bench`,r.candidateCount===1?`candidate`:`candidates`,String(r.candidateCount)),t(`bench`,`arms`,String(r.armIds.length))),c.append(h);let g=n(`div`,`bench-controls`),_=e.configured===!0&&r.error===null;g.append(u(r,`mine`,!_||m||l),u(r,`run`,!_||m||l||f||r.caseCount===0),u(r,`cancel`,m||!l));let v=n(`span`,`bench-status`,(a?``:`Not connected to the server. Reconnecting.`)||d(e,r)||s.get(r.id)||``);if(v.setAttribute(`role`,`status`),g.append(v),c.append(g),r.error)return c.append(n(`p`,`bench-error`,r.error)),c;let y=r.latestReport;return y?(c.append(n(`p`,`bench-run-line`,`Latest run ${y.runId}: ${y.status}. Only cases every arm scored count toward paired recall.`)),y.rows.length>0&&c.append(p(y)),c):(c.append(n(`p`,`bench-empty`,r.caseCount===0?`Move approved candidates into the cases folder, then choose Run.`:`No run yet.`)),c)}function h(){if(!s)return;s.textContent=``;let{status:t}=i(),r=e(`bench`,`Benchmarks`,`Suites from the benchmarks folder of the Glimmervoid home, one run at a time.`);if(s.append(r),!t)s.append(n(`p`,`bench-empty`,`Waiting for the server.`));else if(!t.configured)s.append(n(`p`,`bench-empty`,t.reason||`Benchmarks are off.`));else if(t.suites.length===0)s.append(n(`p`,`bench-empty`,`No suites yet. Create a folder holding suite.json under benchmarks in the Glimmervoid home.`));else for(let e of t.suites)s.append(m(t,e))}function g(e){s||(s=n(`div`,`bench-content`),e.append(s),a(h),h())}var _={mount:g};export{_ as view};
1
+ import"./updates-view-core-C8XDTgVm.js";import{n as e,r as t,s as n}from"./dom-helpers-DBbFg1c_.js";import{$ as r,Q as i,et as a}from"./index-C4QIxDmH.js";var o={mine:`Mine`,run:`Run`,cancel:`Cancel`},s=null;function c(e){return e===null?`n/a`:`${Math.round(e*100)}%`}function l(e){if(e===null)return`n/a`;let t=Math.round(e*100);return t>0?`+${t}`:String(t)}function u(e,t,i){let a=n(`button`,`bench-action-button`,o[t]);return a.type=`button`,a.disabled=i,a.addEventListener(`click`,()=>r(e.id,t)),a}function d(e,t){let n=e.inFlight;if(!n||n.suiteId!==t.id)return``;let r=n.caseId?`case ${n.caseId}, `:``;return`Cell ${n.cellIndex+1} of ${n.cellCount}: ${r}arm ${n.armId}, trial ${n.trial}, ${n.phase}.`}function f(e){let t=n(`td`,`bench-score`,c(e?.recall??null));return e&&e.invalid>0&&(t.title=`${e.invalid} invalid or failed cell(s)`),e&&e.degraded>0&&(t.dataset.degraded=`true`),t}function p(e){let t=e.armIds.filter(t=>t!==e.baselineArm),r=n(`table`,`bench-table`),i=n(`tr`);i.append(n(`th`,null,`Case`),...e.armIds.map(t=>n(`th`,null,t===e.baselineArm?`${t} (baseline)`:t))),i.append(...t.map(e=>n(`th`,null,`${e} vs baseline`))),r.append(i);for(let i of e.rows){let a=n(`tr`);a.append(n(`td`,`bench-case`,i.caseId),...e.armIds.map(e=>f(i.arms[e]))),a.append(...t.map(e=>n(`td`,`bench-delta`,l(i.deltaVsBaseline[e]??null)))),r.append(a)}let a=[...new Set(e.armIds.flatMap(t=>Object.keys(e.totals[t]?.recallByTag??{})))].sort(),o=n(`tr`,`bench-total`);o.append(n(`td`,`bench-case`,`Paired recall`),...e.armIds.map(t=>f(e.totals[t]))),r.append(o);for(let t of a){let i=n(`tr`,`bench-total`);i.append(n(`td`,`bench-case`,`Recall, ${t}`),...e.armIds.map(r=>n(`td`,`bench-score`,c(e.totals[r]?.recallByTag[t]??null)))),r.append(i)}return r}function m(e,r){let{isServerConnected:a,pendingActionBySuite:o,outcomeBySuite:s}=i(),c=n(`div`,`bench-suite`),l=e.inFlight?.suiteId===r.id,f=!!e.inFlight&&!l,m=o.has(r.id)||!a,h=n(`div`,`bench-summary`);h.append(n(`span`,`bench-suite-title`,r.title),t(`bench`,r.caseCount===1?`case`:`cases`,String(r.caseCount)),t(`bench`,r.candidateCount===1?`candidate`:`candidates`,String(r.candidateCount)),t(`bench`,`arms`,String(r.armIds.length))),c.append(h);let g=n(`div`,`bench-controls`),_=e.configured===!0&&r.error===null;g.append(u(r,`mine`,!_||m||l),u(r,`run`,!_||m||l||f||r.caseCount===0),u(r,`cancel`,m||!l));let v=n(`span`,`bench-status`,(a?``:`Not connected to the server. Reconnecting.`)||d(e,r)||s.get(r.id)||``);if(v.setAttribute(`role`,`status`),g.append(v),c.append(g),r.error)return c.append(n(`p`,`bench-error`,r.error)),c;let y=r.latestReport;return y?(c.append(n(`p`,`bench-run-line`,`Latest run ${y.runId}: ${y.status}. Only cases every arm scored count toward paired recall.`)),y.rows.length>0&&c.append(p(y)),c):(c.append(n(`p`,`bench-empty`,r.caseCount===0?`Move approved candidates into the cases folder, then choose Run.`:`No run yet.`)),c)}function h(){if(!s)return;s.textContent=``;let{status:t}=i(),r=e(`bench`,`Benchmarks`,`Suites from the benchmarks folder of the Glimmervoid home, one run at a time.`);if(s.append(r),!t)s.append(n(`p`,`bench-empty`,`Waiting for the server.`));else if(!t.configured)s.append(n(`p`,`bench-empty`,t.reason||`Benchmarks are off.`));else if(t.suites.length===0)s.append(n(`p`,`bench-empty`,`No suites yet. Create a folder holding suite.json under benchmarks in the Glimmervoid home.`));else for(let e of t.suites)s.append(m(t,e))}function g(e){s||(s=n(`div`,`bench-content`),e.append(s),a(h),h())}var _={mount:g};export{_ as view};
@@ -1 +1 @@
1
- import{yt as e}from"./updates-view-core-40jpDW2b.js";import{s as t}from"./dom-helpers-DBbFg1c_.js";import{a as n,r}from"./card-registry-B8Mbwncq.js";import{i}from"./action-status-CMDI7GJF.js";import{a,n as o}from"./modal-USMHOKBI.js";import{ai as s,bi as c,ci as l,ei as u,ii as d,li as f,ni as p,oi as m,ri as h,si as g,ti as _,xi as v,yi as y}from"./index-BW8cXix9.js";var b=4,ee=200,te=2e4,ne=1.1,re=[`wire`,`note`,`frame`,`box`];function x(e){let t=Math.random().toString(36).slice(2,8);return`${e}-${Date.now().toString(36)}${t}`}function S(){return document.documentElement.dataset.layout===`phone`}function ie(e){let{svg:n,canvas:r,renderer:i}=e,a=new Map,o=new Set,s={x:0,y:0,width:1e3,height:600},c=null,l=null;function u(){n.setAttribute(`viewBox`,`${s.x} ${s.y} ${s.width} ${s.height}`)}function d(){let e=i.layout();if(!e)return;let{bounds:t}=e,r=n.clientWidth,a=n.clientHeight;if(r===0||a===0){s={...t},u();return}let o=Math.max(1,t.width/r,t.height/a),c=r*o;s={x:t.x-(c-t.width)/2,y:t.y,width:c,height:a*o},u()}function f(e,t){let r=n.getScreenCTM();if(!r)return{x:e,y:t};let i=new DOMPoint(e,t).matrixTransform(r.inverse());return{x:i.x,y:i.y}}function p(){let e=n.clientWidth||1,t=n.clientHeight||1;return Math.max(s.width/e,s.height/t)}function m(e,t){let n=Math.min(te,Math.max(ee,s.width*t)),r=n/s.width;s={x:e.x-(e.x-s.x)*r,y:e.y-(e.y-s.y)*r,width:n,height:s.height*r},u()}function h(e,t){let n=p();s={...s,x:s.x-e*n,y:s.y-t*n},u()}function g(t){o=t,i.setSelection(o),e.onSelectionChange(o)}function _(e,t){if(!t){g(o.has(e)&&o.size===1?new Set:new Set([e]));return}let n=new Set(o);n.delete(e)||n.add(e),g(n)}function v(e){let t=new Set([...o].filter(t=>e?.elements[t]));t.size!==o.size&&g(t)}function y(e){let t=i.layout()?.elements.find(t=>t.id===e);return t?.kind===`box`?t:null}function x(){let[e,t]=[...a.values()];return!e||!t?0:Math.hypot(e.x-t.x,e.y-t.y)}function ie(){c={kind:`pinch`,distance:x(),viewWidth:s.width}}function C(e){if(e.button!==0||l)return;if(a.set(e.pointerId,{x:e.clientX,y:e.clientY}),n.setPointerCapture(e.pointerId),a.size===2){ie();return}let t=i.elementFromTarget(e.target),r=t?.kind===`box`&&!S()?y(t.id):null;if(t&&r){c={kind:`drag`,pointerId:e.pointerId,boxId:t.id,origin:f(e.clientX,e.clientY),start:r,hasMoved:!1,isAdditive:e.shiftKey};return}if(t&&!S()){_(t.id,e.shiftKey);return}let o=t?.kind===`box`?t.id:null;c={kind:`pan`,pointerId:e.pointerId,lastClient:{x:e.clientX,y:e.clientY},hasMoved:!1,tappedBoxId:o}}function w(e,t){let n=f(t.clientX,t.clientY),r=n.x-e.origin.x,a=n.y-e.origin.y;!e.hasMoved&&Math.hypot(r,a)<b*p()||(e.hasMoved=!0,i.nodeOf(e.boxId)?.setAttribute(`transform`,`translate(${r} ${a})`))}function T(e,t){let n=t.clientX-e.lastClient.x,r=t.clientY-e.lastClient.y;!e.hasMoved&&Math.hypot(n,r)<b||(e.hasMoved=!0,e.lastClient={x:t.clientX,y:t.clientY},h(n,r))}function ae(e){let t=x();if(t<=0||e.distance<=0)return;let n=[...a.values()];m(f(n.reduce((e,t)=>e+t.x,0)/n.length,n.reduce((e,t)=>e+t.y,0)/n.length),e.viewWidth*(e.distance/t)/s.width)}function oe(e){a.has(e.pointerId)&&(a.set(e.pointerId,{x:e.clientX,y:e.clientY}),c?.kind===`pinch`?ae(c):c?.kind===`drag`&&c.pointerId===e.pointerId?w(c,e):c?.kind===`pan`&&c.pointerId===e.pointerId&&T(c,e))}async function se(t,n){if(!t.hasMoved){_(t.boxId,t.isAdditive);return}let r=f(n.clientX,n.clientY),a={x:Math.round(t.start.x+r.x-t.origin.x),y:Math.round(t.start.y+r.y-t.origin.y)};await e.sendOps([{op:`set`,id:t.boxId,fields:{at:a}}])||i.nodeOf(t.boxId)?.removeAttribute(`transform`)}function ce(t){if(!a.delete(t.pointerId))return;let n=c;n?.kind===`pinch`?c=null:(c=null,n?.kind===`drag`&&n.pointerId===t.pointerId?se(n,t):n?.kind!==`pan`||n.hasMoved||(n.tappedBoxId&&S()?e.onPhoneTapBox(n.tappedBoxId):n.tappedBoxId||g(new Set)))}function le(e){a.delete(e.pointerId),c?.kind===`drag`&&i.nodeOf(c.boxId)?.removeAttribute(`transform`),c=null}function E(e){e.preventDefault(),e.ctrlKey||e.metaKey?m(f(e.clientX,e.clientY),e.deltaY>0?ne:1/ne):h(-e.deltaX,-e.deltaY)}function D(){let e=l;l=null,e?.remove()}function ue(a){let o=e.currentBoard()?.elements[a],s=i.nodeOf(a);if(o?.kind!==`box`||!s)return;D();let c=r.getBoundingClientRect(),u=s.getBoundingClientRect(),d=t(`input`,`wb-title-input`);d.type=`text`,d.value=o.title,d.maxLength=80,d.setAttribute(`aria-label`,`Box title`),d.style.left=`${u.left-c.left}px`,d.style.top=`${u.top-c.top}px`,d.style.width=`${Math.max(160,u.width)}px`,l=d,r.append(d),d.addEventListener(`keydown`,t=>{if(t.key===`Escape`){t.preventDefault(),D(),n.focus();return}if(t.key!==`Enter`)return;t.preventDefault();let r=d.value.trim();D(),n.focus(),r&&r!==o.title&&e.sendOps([{op:`set`,id:a,fields:{title:r}}])}),d.addEventListener(`blur`,D),d.focus(),d.select()}function de(e){if(S())return;let t=i.elementFromTarget(document.elementFromPoint(e.clientX,e.clientY));t?.kind===`box`&&ue(t.id)}function fe(){let t=e.currentBoard();if(!t||o.size===0)return;let n=[...o].flatMap(e=>t.elements[e]??[]),r=re.flatMap(e=>n.filter(t=>t.kind===e)).map(e=>({op:`remove`,id:e.id}));g(new Set),e.sendOps(r)}function pe(e){e.target===n&&(e.key===`Delete`||e.key===`Backspace`?(e.preventDefault(),fe()):e.key===`Escape`&&g(new Set))}return n.tabIndex=0,n.addEventListener(`pointerdown`,C),n.addEventListener(`pointermove`,oe),n.addEventListener(`pointerup`,ce),n.addEventListener(`pointercancel`,le),n.addEventListener(`wheel`,E,{passive:!1}),n.addEventListener(`dblclick`,de),n.addEventListener(`keydown`,pe),{fit:d,selectedIds:()=>o,clearSelection:()=>g(new Set),pruneSelection:v,closeTitleInput:D}}var C=40,w=220,T=90,ae=30,oe=20,se=18,ce=20,le=26,E=18,D=26,ue=170,de=21,fe=17,pe=10,O=22,me=24,he=16,ge=24,_e=8,ve=Object.freeze({blue:`#60a5fa`,green:`#4ade80`,orange:`#fb923c`,pink:`#f472b6`,cyan:`#22d3ee`,yellow:`#facc15`});function k(e,t){let n=e.split(/\s+/).filter(Boolean),r=[],i=``;for(let e of n){let n=e.match(RegExp(`.{1,${t}}`,`g`))??[e];for(let e of n){let n=i?`${i} ${e}`:e;n.length<=t?i=n:(r.push(i),i=e)}}return i&&r.push(i),r.length>0?r:[``]}function ye(e,t){let n=e.lanes.find(e=>e.id===t.lane);return n?{label:n.label||n.id,hex:ve[n.color]}:null}function be(e,t){let n=k(t.title,ce),r=t.lines.flatMap(e=>k(e.text,le-(e.muted?2:0)).map(t=>({text:t,muted:e.muted}))),i=ye(e,t);return{titleLines:n,bodyLines:r,lane:i,height:24+n.length*oe+r.length*se+(i?26:0)}}function A(e,t){return Object.values(e.elements).filter(e=>e.kind===t)}function xe(e){let t=k(e.text,de);return{lines:t,height:24+(t.length+1)*fe}}function Se(e){let t=new Map;for(let n of A(e,`note`)){let e=t.get(n.on),r=xe(n).height;t.set(n.on,e===void 0?r:e+pe+r)}return t}function Ce(e){return e.columns.map(e=>e.title?k(e.title,me):[])}function we(e){return(Math.max(1,...e.map(e=>e.length))-1)*he}function Te(e,t){let n=new Set(A(e,`box`).filter(e=>!e.at&&t.has(e.id)).map(e=>e.column)),r=[],i=C;for(let t of e.columns)r.push(i),i+=w+(n.has(t.id)?Math.max(T,186):T);return r}function Ee(e){let t=new Map;for(let n of A(e,`frame`))for(let e of n.contains)t.has(e)||t.set(e,n.id);return t}function De(e,t){return e===t?0:(e?E:0)+(t?44:0)}function Oe(e,t,n,r){let i=new Map,a=new Map,o=new Map,s=Ee(e),c=A(e,`box`).map((e,t)=>({box:e,index:t})).sort((e,t)=>e.box.order-t.box.order||e.index-t.index);for(let{box:l}of c){let c=Math.max(0,e.columns.findIndex(e=>e.id===l.column)),u=be(e,l),d=s.get(l.id)??null,f=(a.get(l.column)??n)+De(o.get(l.column)??null,d),p=l.at??{x:t[c]??C,y:f};if(!l.at){let e=(r.get(l.id)??0)-_e;a.set(l.column,f+Math.max(u.height,e)+ae),o.set(l.column,d)}i.set(l.id,{kind:`box`,id:l.id,x:p.x,y:p.y,width:w,height:u.height,titleLines:u.titleLines,bodyLines:u.bodyLines,lane:u.lane,isGhost:l.ghost})}return i}function ke(e){if(e.length===0)return null;let t=Math.min(...e.map(e=>e.x)),n=Math.min(...e.map(e=>e.y)),r=Math.max(...e.map(e=>e.x+e.width)),i=Math.max(...e.map(e=>e.y+e.height));return{x:t,y:n,width:r-t,height:i-n}}function Ae(e,t){return A(e,`frame`).flatMap(e=>{let n=ke(e.contains.flatMap(e=>t.get(e)??[]));return n?[{kind:`frame`,id:e.id,title:e.title,x:n.x-E,y:n.y-E-D,width:n.width+36,height:n.height+36+D}]:[]})}function je(e,t){let n=e.x+e.width/2,r=t.x+t.width/2;if(Math.abs(r-n)>e.width/2){let i=r>n,a={x:i?e.x+e.width:e.x,y:e.y+Math.min(e.height/2,40)},o={x:i?t.x:t.x+t.width,y:t.y+Math.min(t.height/2,40)},s=(o.x-a.x)/2;return{start:a,end:o,path:`M ${a.x} ${a.y} C ${a.x+s} ${a.y}, ${o.x-s} ${o.y}, ${o.x} ${o.y}`}}let i=t.y>e.y,a={x:n,y:i?e.y+e.height:e.y},o={x:r,y:i?t.y:t.y+t.height},s=(o.y-a.y)/2;return{start:a,end:o,path:`M ${a.x} ${a.y} C ${a.x} ${a.y+s}, ${o.x} ${o.y-s}, ${o.x} ${o.y}`}}function Me(e,t){return A(e,`wire`).flatMap(e=>{let n=t.get(e.from),r=t.get(e.to);if(!n||!r)return[];let i=je(n,r);return[{kind:`wire`,id:e.id,path:i.path,start:i.start,end:i.end,label:e.label,labelAt:{x:(i.start.x+i.end.x)/2,y:(i.start.y+i.end.y)/2-6},isDashed:e.dashed,tone:e.tone,strokeHex:e.tone===`lane`?n.lane?.hex??null:null}]})}function Ne(e){return e.resolvedBy?`resolved by ${e.resolvedBy}`:e.author?`from ${e.author}`:``}function Pe(e,t){let n=new Map;return A(e,`note`).flatMap(e=>{let r=t.get(e.on);if(!r)return[];let{lines:i,height:a}=xe(e),o=n.get(e.on)??r.y-_e;return n.set(e.on,o+a+pe),[{kind:`note`,id:e.id,x:r.x+r.width-ge,y:o,width:ue,height:a,lines:i,byline:Ne(e),isResolved:e.resolvedBy!==null}]})}function Fe(e,t,n){let r=e.flatMap(e=>e.kind===`wire`?[]:[e]),i=(t.at(-1)??C)+w,a=ke([...r,{x:0,y:0,width:i,height:n}]);return a?{x:Math.min(0,a.x-C),y:Math.min(0,a.y-C),width:a.width+80,height:a.height+80}:{x:0,y:0,width:i+C,height:80}}function Ie(e){let t=Se(e),n=Te(e,t),r=Ce(e),i=we(r),a=84+i,o=Oe(e,n,a,t),s=[...Ae(e,o),...Me(e,o),...o.values(),...Pe(e,o)],c=Fe(s,n,a),l=c.y+c.height,u=e.lanes.map((e,t)=>({label:e.label||e.id,hex:ve[e.color],x:C,y:l+t*O})),d=l+u.length*O+(u.length>0?12:0),f=e.caption?{text:e.caption,x:C,y:d}:null,p=u.length*O+(f?30:0)+(u.length>0?12:0);return{columns:e.columns.map((e,t)=>({id:e.id,titleLines:r[t]??[],titleBaselineY:56,ruleY:66+i,x:n[t]??C,width:w})),elements:s,legend:u,caption:f,bounds:{...c,height:c.height+p}}}function Le(e){return JSON.stringify(e)}var Re=`http://www.w3.org/2000/svg`,j=12,ze=26,Be=20,Ve=18,He=17,Ue=14,We=16;function M(e,t={},n=``){let r=document.createElementNS(Re,e);for(let[e,n]of Object.entries(t))r.setAttribute(e,String(n));return n&&r.setAttribute(`class`,n),r}function N(e,t,n,r){let i=M(`text`,{x:t,y:n},r);return i.textContent=e,i}function P(e,t){let n=M(`g`,{},`wb-element ${t}`);return n.dataset.elementId=e.id,n.dataset.elementKind=e.kind,n}function Ge(e){let t=P(e,e.isGhost?`wb-box wb-ghost`:`wb-box`),n=M(`rect`,{x:e.x,y:e.y,width:e.width,height:e.height,rx:8},`wb-box-outline`);e.lane&&(n.style.stroke=e.lane.hex),t.append(n),e.titleLines.forEach((n,r)=>{t.append(N(n,e.x+j,e.y+ze+r*Be,`wb-box-title`))});let r=e.y+ze+e.titleLines.length*Be;if(e.bodyLines.forEach((n,i)=>{let a=e.x+j+(n.muted?Ue:0);t.append(N(n.text,a,r+i*Ve,n.muted?`wb-box-line wb-muted`:`wb-box-line`))}),!e.lane)return t;let i=e.y+e.height-28,a=Math.min(e.width-24,16+e.lane.label.length*8),o=M(`rect`,{x:e.x+j,y:i,width:a,height:18,rx:9},`wb-lane-pill`);o.style.stroke=e.lane.hex;let s=N(e.lane.label,e.x+j+8,i+13,`wb-lane-pill-text`);return s.style.fill=e.lane.hex,t.append(o,s),t}function Ke(e){let t=P(e,`wb-frame`);return t.append(M(`rect`,{x:e.x,y:e.y,width:e.width,height:e.height,rx:12},`wb-frame-outline`),N(e.title,e.x+14,e.y+18,`wb-frame-title`)),t}function qe(e){let t=P(e,`wb-wire wb-tone-${e.tone}`),n=M(`path`,{d:e.path},`wb-wire-hit`),r=M(`path`,{d:e.path,"marker-end":`url(#wb-arrow)`},e.isDashed?`wb-wire-line wb-dashed`:`wb-wire-line`);return e.strokeHex&&(r.style.stroke=e.strokeHex),t.append(n,r,M(`circle`,{cx:e.start.x,cy:e.start.y,r:3},`wb-wire-dot`)),e.label&&t.append(N(e.label,e.labelAt.x,e.labelAt.y,`wb-wire-label`)),t}function Je(e){let t=P(e,e.isResolved?`wb-note wb-resolved`:`wb-note`);return t.append(M(`rect`,{x:e.x,y:e.y,width:e.width,height:e.height,rx:4},`wb-note-card`)),e.lines.forEach((n,r)=>{t.append(N(n,e.x+10,e.y+22+r*He,`wb-note-text`))}),e.byline&&t.append(N(e.byline,e.x+10,e.y+22+e.lines.length*He,`wb-note-byline`)),t}var Ye={frame:`frames`,wire:`wires`,box:`boxes`,note:`notes`},Xe=[`box`,`frame`,`wire`,`note`];function Ze(e){switch(e.kind){case`box`:return Ge(e);case`frame`:return Ke(e);case`wire`:return qe(e);case`note`:return Je(e)}}function Qe(e){let t=M(`g`,{},`wb-chrome`);for(let n of e.columns)n.titleLines.length!==0&&(n.titleLines.forEach((e,r)=>{t.append(N(e,n.x,n.titleBaselineY+r*We,`wb-column-title`))}),t.append(M(`line`,{x1:n.x,y1:n.ruleY,x2:n.x+n.width,y2:n.ruleY},`wb-column-rule`)));for(let n of e.legend){let e=M(`rect`,{x:n.x,y:n.y,width:14,height:14,rx:3},`wb-legend-swatch`);e.style.fill=n.hex,t.append(e,N(n.label,n.x+22,n.y+12,`wb-legend-text`))}return e.caption&&t.append(N(e.caption.text,e.caption.x,e.caption.y+16,`wb-caption`)),t}function $e(){let e=M(`defs`),t=M(`marker`,{id:`wb-arrow`,viewBox:`0 0 10 10`,refX:9,refY:5,markerWidth:8,markerHeight:8,orient:`auto-start-reverse`});return t.append(M(`path`,{d:`M 0 1 L 10 5 L 0 9 z`,fill:`context-stroke`})),e.append(t),e}function et(e){let t={frames:M(`g`,{},`wb-layer`),wires:M(`g`,{},`wb-layer`),boxes:M(`g`,{},`wb-layer`),notes:M(`g`,{},`wb-layer`)},n=M(`g`);e.replaceChildren($e(),n,t.frames,t.wires,t.boxes,t.notes);let r=new Map,i=null,a=new Set;function o(e,t){t.classList.toggle(`is-selected`,a.has(e))}function s(e){let a=Ie(e),s=Qe(a);n.replaceWith(s),n=s;let c=new Set;for(let e of a.elements){c.add(e.id);let n=Le(e),i=r.get(e.id);if(i?.signature===n)continue;let a=Ze(e);o(e.id,a),i&&i.node.replaceWith(a),i||t[Ye[e.kind]].append(a),r.set(e.id,{signature:n,node:a})}for(let[e,t]of r)c.has(e)||(t.node.remove(),r.delete(e));return i=a,a}function c(e){if(!(e instanceof Element))return null;let t=e.closest(`.wb-element`),n=t?.dataset.elementId,r=Xe.find(e=>e===t?.dataset.elementKind);return!n||!r?null:{id:n,kind:r}}function l(e){a=e;for(let[e,t]of r)o(e,t.node)}function u(){for(let e of r.values())e.node.remove();r.clear();let e=M(`g`);n.replaceWith(e),n=e,i=null}return{render:s,layout:()=>i,elementFromTarget:c,nodeOf:e=>r.get(e)?.node??null,setSelection:l,clear:u}}var tt=`http://www.w3.org/2000/svg`,nt=`No boards yet. Make one here, or have an agent run glimmervoid whiteboard new <title>.`,rt=`Pick a board above.`,F=null,I=null,L=null,R=null,it=!0,z=null,B=i(`action-status wb-status`),V=i(`action-status wb-status`);function H(e){let{dialog:n,close:r,actions:i,btnCancel:a}=o({title:e.title}),s=t(`input`,`dialog-input`);s.type=`text`,s.placeholder=e.placeholder,s.maxLength=e.maxLength,s.value=e.initialValue??``,s.autocomplete=`off`,s.setAttribute(`aria-label`,e.label);let c=t(`div`,`dialog-error`);c.setAttribute(`role`,`alert`);let l=e.choices?t(`select`,`dialog-input wb-dialog-select`):null;if(l&&e.choices){l.setAttribute(`aria-label`,e.choices.label);for(let n of e.choices.options){let e=t(`option`,null,n.text);e.value=n.value,l.append(e)}}let u=t(`button`,`btn-dialog btn-dialog-confirm`,e.confirmLabel);u.type=`button`,i.append(u),n.append(t(`label`,`dialog-label`,e.label),s,...l?[l]:[],c,i);async function d(){let t=s.value.trim();if(!t){c.textContent=`${e.label} is empty.`;return}u.disabled=!0;let n=await e.onSubmit(t,l?.value??null);u.disabled=!1,n?c.textContent=n:r()}a.addEventListener(`click`,r),u.addEventListener(`click`,()=>void d()),s.addEventListener(`keydown`,e=>{e.key===`Enter`&&(e.preventDefault(),d())}),requestAnimationFrame(()=>s.focus())}function U(){return F?g(F):null}function W(){return u().find(e=>e.id===F)??null}async function at(e){if(!F||e.length===0)return!1;let t=await l(F,e);return t.ok?(B.clear(),!0):(B.show(`error`,t.error),!1)}async function G(e){if(!F)return`No board is open.`;let t=await l(F,e);return t.ok?null:t.error}function K(e){let t=r(e);return t?n(t):`closed session`}function q(e){let t=U();return[...R?.selectedIds()??new Set].flatMap(e=>t?.elements[e]??[]).filter(t=>t.kind===e)}function J(){if(!I)return;let e=U(),t=q(`box`).length,n=R?.selectedIds().size??0;I.buttons.box.disabled=!e,I.buttons.wire.disabled=t!==2,I.buttons.note.disabled=t!==1,I.buttons.frame.disabled=t===0,I.buttons.fit.disabled=!e,I.buttons.remove.disabled=!e,I.toolbar.dataset.selectedCount=String(n)}function Y(){if(!I)return;let e=u();F&&!e.some(e=>e.id===F)&&(F=null),!F&&e[0]&&Q(e[0].id),I.list.replaceChildren(...e.map(e=>{let n=t(`button`,`wb-board-tab`,e.title);return n.type=`button`,n.setAttribute(`aria-pressed`,String(e.id===F)),e.connectedSessionIds.length>0&&n.append(t(`span`,`wb-board-tab-count`,String(e.connectedSessionIds.length))),n.addEventListener(`click`,()=>Q(e.id)),n})),ot()}function ot(){if(!I)return;let e=W(),n=u().length>0;I.boardHead.hidden=!e,I.canvas.hidden=!e,I.empty.hidden=!!e,I.empty.textContent=n?rt:nt,e&&(I.boardTitle.textContent=e.title,I.boardMeta.textContent=`v${e.version}`,I.presence.replaceChildren(...e.connectedSessionIds.map(e=>t(`span`,`wb-presence-pill`,K(e)))),e.connectedSessionIds.length===0&&I.presence.append(t(`span`,`wb-presence-none`,`no sessions connected`)),J(),X())}function st(e,t){let n=K(t);if(!e?.connectedSessionIds.includes(t))return`${n} is not connected to this board`;let r=e.queuedBySessionId[t]??0;return r===0?`${n} has read every change`:`${r} board ${r===1?`edit`:`edits`} queued for ${n}`}function X(){if(!I||!z)return;let e=W();I.dockQueued.textContent=st(e,z),I.sendToAgent.disabled=!e?.connectedSessionIds.includes(z)}async function ct(){if(!I||!F||!z)return;I.sendToAgent.disabled=!0,V.show(`busy`,`sending`);let e=await h(F,z);X(),e.ok?V.show(`ok`,`sent; the agent reads the board when it is ready`):V.show(`error`,e.error)}function Z(){if(!L)return;let e=U();e?(L.render(e),R?.pruneSelection(e),it&&=(R?.fit(),!1),J()):L.clear()}function Q(e){F!==e&&(F=e,it=!0,R?.clearSelection(),R?.closeTitleInput(),L?.clear(),B.clear(),Y(),m(e).then(Z))}function lt(){let t=U();if(!t)return;let n=q(`box`)[0],r=t.columns.map(e=>({value:e.id,text:e.title||e.id})),i=n?.column;i&&r.sort((e,t)=>Number(t.value===i)-Number(e.value===i)),H({title:`Add a box`,label:`Box title`,placeholder:`parse the feed`,maxLength:e.title,confirmLabel:`Add box`,choices:r.length>1?{label:`Column`,options:r}:void 0,onSubmit:(e,t)=>G([{op:`add`,element:{kind:`box`,id:x(`box`),title:e,column:t??r[0]?.value??`main`,lines:[],lane:null,ghost:!1,order:0,at:null}}])})}function ut(t){H({title:`Pin a note`,label:`Note`,placeholder:`what about retries?`,maxLength:e.noteText,confirmLabel:`Pin note`,onSubmit:e=>G([{op:`add`,element:{kind:`note`,id:x(`note`),on:t,text:e,author:``,resolvedBy:null}}])})}function dt(){let[e,t]=q(`box`);e&&t&&(R?.clearSelection(),at([{op:`add`,element:{kind:`wire`,id:x(`wire`),from:e.id,to:t.id,dashed:!1,tone:`plain`,label:null}}]))}function ft(){let t=q(`box`).map(e=>e.id);t.length!==0&&H({title:`Frame the selected boxes`,label:`Frame title`,placeholder:`intake`,maxLength:e.title,confirmLabel:`Add frame`,onSubmit:async e=>{let n=await G([{op:`add`,element:{kind:`frame`,id:x(`frame`),title:e,contains:t}}]);return n||R?.clearSelection(),n}})}function pt(){let e=W();if(!e)return;let t=e.connectedSessionIds.map(K),n=t.length>0?` ${t.join(`, `)} ${t.length===1?`is`:`are`} connected and will lose it.`:``;a({title:`Delete board`,message:`Delete "${e.title}" for good?${n}`,confirmLabel:`Delete board`,danger:!0,onConfirm:()=>{p(e.id).then(e=>{e.ok||B.show(`error`,e.error)})}})}function mt(){H({title:`New board`,label:`Board title`,placeholder:`knowledge writer`,maxLength:e.title,confirmLabel:`Create board`,onSubmit:async e=>{let t=await _(e);return t.ok?(Q(t.boardId),null):t.error}})}function $(e,n,r=``){let i=t(`button`,`wb-button ${r}`.trim(),e);return i.type=`button`,i.addEventListener(`click`,n),i}function ht(e){let n=t(`div`,`wb-top`),r=t(`div`,`wb-board-list`);r.setAttribute(`aria-label`,`Boards`),n.append(r,$(`new board`,mt));let i=t(`div`,`wb-board-head`),a=t(`div`,`wb-title-row`),o=t(`h2`,`wb-board-title`),c=t(`span`,`wb-board-meta`),l=t(`div`,`wb-presence`);a.append(o,c,l);let u=t(`div`,`wb-toolbar`),f={box:$(`box`,lt),wire:$(`wire`,dt),note:$(`note`,()=>{let[e]=q(`box`);e&&ut(e.id)}),frame:$(`frame`,ft),fit:$(`fit`,()=>R?.fit()),remove:$(`delete board`,pt,`wb-button-danger`)};f.fit.dataset.phoneVisible=``,u.append(f.box,f.wire,f.note,f.frame,f.fit,f.remove,B.element),i.append(a,u);let p=t(`div`,`wb-canvas`),m=document.createElementNS(tt,`svg`);m.setAttribute(`class`,`wb-svg`),m.setAttribute(`role`,`img`),m.setAttribute(`aria-label`,`Whiteboard`),m.setAttribute(`preserveAspectRatio`,`xMidYMin meet`),p.append(m);let h=t(`p`,`wb-empty`,nt),g=t(`div`,`wb-dock`);g.hidden=!0;let _=t(`span`,`wb-dock-queued`),v=$(`send to agent`,()=>void ct()),y=t(`div`,`wb-dock-bar`);y.append(_,v,V.element),g.append(y),e.replaceChildren(n,i,p,h,g),I={list:r,boardHead:i,boardTitle:o,boardMeta:c,presence:l,toolbar:u,canvas:p,empty:h,dock:g,dockQueued:_,sendToAgent:v,buttons:f};let b=et(m);L=b,R=ie({svg:m,canvas:p,renderer:b,currentBoard:U,sendOps:at,onSelectionChange:J,onPhoneTapBox:ut}),s(Y),d(e=>{e===F&&Z()}),Y()}function gt(){return document.documentElement.dataset.layout===`phone`}function _t(){z&&c()===z&&v(),z=null,I&&(I.dock.hidden=!0)}function vt(e){if(!I||gt())return;let t=r(e);t&&(z=e,I.dock.hidden=!1,V.clear(),X(),y(t,e,I.dock,{className:`wb-docked-card`}))}function yt(){let e=f();e&&(Q(e.boardId),e.dockSessionId&&vt(e.dockSessionId)),Y(),F&&m(F).then(Z)}var bt={mount:ht,refresh:yt,deactivate:_t};export{bt as view};
1
+ import{yt as e}from"./updates-view-core-C8XDTgVm.js";import{s as t}from"./dom-helpers-DBbFg1c_.js";import{a as n,r}from"./card-registry-D5FILlqB.js";import{i}from"./action-status-2TEW4EL2.js";import{a,n as o}from"./modal-USMHOKBI.js";import{ai as s,bi as c,ci as l,ei as u,ii as d,li as f,ni as p,oi as m,ri as h,si as g,ti as _,xi as v,yi as y}from"./index-C4QIxDmH.js";var b=4,ee=200,te=2e4,ne=1.1,re=[`wire`,`note`,`frame`,`box`];function x(e){let t=Math.random().toString(36).slice(2,8);return`${e}-${Date.now().toString(36)}${t}`}function S(){return document.documentElement.dataset.layout===`phone`}function ie(e){let{svg:n,canvas:r,renderer:i}=e,a=new Map,o=new Set,s={x:0,y:0,width:1e3,height:600},c=null,l=null;function u(){n.setAttribute(`viewBox`,`${s.x} ${s.y} ${s.width} ${s.height}`)}function d(){let e=i.layout();if(!e)return;let{bounds:t}=e,r=n.clientWidth,a=n.clientHeight;if(r===0||a===0){s={...t},u();return}let o=Math.max(1,t.width/r,t.height/a),c=r*o;s={x:t.x-(c-t.width)/2,y:t.y,width:c,height:a*o},u()}function f(e,t){let r=n.getScreenCTM();if(!r)return{x:e,y:t};let i=new DOMPoint(e,t).matrixTransform(r.inverse());return{x:i.x,y:i.y}}function p(){let e=n.clientWidth||1,t=n.clientHeight||1;return Math.max(s.width/e,s.height/t)}function m(e,t){let n=Math.min(te,Math.max(ee,s.width*t)),r=n/s.width;s={x:e.x-(e.x-s.x)*r,y:e.y-(e.y-s.y)*r,width:n,height:s.height*r},u()}function h(e,t){let n=p();s={...s,x:s.x-e*n,y:s.y-t*n},u()}function g(t){o=t,i.setSelection(o),e.onSelectionChange(o)}function _(e,t){if(!t){g(o.has(e)&&o.size===1?new Set:new Set([e]));return}let n=new Set(o);n.delete(e)||n.add(e),g(n)}function v(e){let t=new Set([...o].filter(t=>e?.elements[t]));t.size!==o.size&&g(t)}function y(e){let t=i.layout()?.elements.find(t=>t.id===e);return t?.kind===`box`?t:null}function x(){let[e,t]=[...a.values()];return!e||!t?0:Math.hypot(e.x-t.x,e.y-t.y)}function ie(){c={kind:`pinch`,distance:x(),viewWidth:s.width}}function C(e){if(e.button!==0||l)return;if(a.set(e.pointerId,{x:e.clientX,y:e.clientY}),n.setPointerCapture(e.pointerId),a.size===2){ie();return}let t=i.elementFromTarget(e.target),r=t?.kind===`box`&&!S()?y(t.id):null;if(t&&r){c={kind:`drag`,pointerId:e.pointerId,boxId:t.id,origin:f(e.clientX,e.clientY),start:r,hasMoved:!1,isAdditive:e.shiftKey};return}if(t&&!S()){_(t.id,e.shiftKey);return}let o=t?.kind===`box`?t.id:null;c={kind:`pan`,pointerId:e.pointerId,lastClient:{x:e.clientX,y:e.clientY},hasMoved:!1,tappedBoxId:o}}function w(e,t){let n=f(t.clientX,t.clientY),r=n.x-e.origin.x,a=n.y-e.origin.y;!e.hasMoved&&Math.hypot(r,a)<b*p()||(e.hasMoved=!0,i.nodeOf(e.boxId)?.setAttribute(`transform`,`translate(${r} ${a})`))}function T(e,t){let n=t.clientX-e.lastClient.x,r=t.clientY-e.lastClient.y;!e.hasMoved&&Math.hypot(n,r)<b||(e.hasMoved=!0,e.lastClient={x:t.clientX,y:t.clientY},h(n,r))}function ae(e){let t=x();if(t<=0||e.distance<=0)return;let n=[...a.values()];m(f(n.reduce((e,t)=>e+t.x,0)/n.length,n.reduce((e,t)=>e+t.y,0)/n.length),e.viewWidth*(e.distance/t)/s.width)}function oe(e){a.has(e.pointerId)&&(a.set(e.pointerId,{x:e.clientX,y:e.clientY}),c?.kind===`pinch`?ae(c):c?.kind===`drag`&&c.pointerId===e.pointerId?w(c,e):c?.kind===`pan`&&c.pointerId===e.pointerId&&T(c,e))}async function se(t,n){if(!t.hasMoved){_(t.boxId,t.isAdditive);return}let r=f(n.clientX,n.clientY),a={x:Math.round(t.start.x+r.x-t.origin.x),y:Math.round(t.start.y+r.y-t.origin.y)};await e.sendOps([{op:`set`,id:t.boxId,fields:{at:a}}])||i.nodeOf(t.boxId)?.removeAttribute(`transform`)}function ce(t){if(!a.delete(t.pointerId))return;let n=c;n?.kind===`pinch`?c=null:(c=null,n?.kind===`drag`&&n.pointerId===t.pointerId?se(n,t):n?.kind!==`pan`||n.hasMoved||(n.tappedBoxId&&S()?e.onPhoneTapBox(n.tappedBoxId):n.tappedBoxId||g(new Set)))}function le(e){a.delete(e.pointerId),c?.kind===`drag`&&i.nodeOf(c.boxId)?.removeAttribute(`transform`),c=null}function E(e){e.preventDefault(),e.ctrlKey||e.metaKey?m(f(e.clientX,e.clientY),e.deltaY>0?ne:1/ne):h(-e.deltaX,-e.deltaY)}function D(){let e=l;l=null,e?.remove()}function ue(a){let o=e.currentBoard()?.elements[a],s=i.nodeOf(a);if(o?.kind!==`box`||!s)return;D();let c=r.getBoundingClientRect(),u=s.getBoundingClientRect(),d=t(`input`,`wb-title-input`);d.type=`text`,d.value=o.title,d.maxLength=80,d.setAttribute(`aria-label`,`Box title`),d.style.left=`${u.left-c.left}px`,d.style.top=`${u.top-c.top}px`,d.style.width=`${Math.max(160,u.width)}px`,l=d,r.append(d),d.addEventListener(`keydown`,t=>{if(t.key===`Escape`){t.preventDefault(),D(),n.focus();return}if(t.key!==`Enter`)return;t.preventDefault();let r=d.value.trim();D(),n.focus(),r&&r!==o.title&&e.sendOps([{op:`set`,id:a,fields:{title:r}}])}),d.addEventListener(`blur`,D),d.focus(),d.select()}function de(e){if(S())return;let t=i.elementFromTarget(document.elementFromPoint(e.clientX,e.clientY));t?.kind===`box`&&ue(t.id)}function fe(){let t=e.currentBoard();if(!t||o.size===0)return;let n=[...o].flatMap(e=>t.elements[e]??[]),r=re.flatMap(e=>n.filter(t=>t.kind===e)).map(e=>({op:`remove`,id:e.id}));g(new Set),e.sendOps(r)}function pe(e){e.target===n&&(e.key===`Delete`||e.key===`Backspace`?(e.preventDefault(),fe()):e.key===`Escape`&&g(new Set))}return n.tabIndex=0,n.addEventListener(`pointerdown`,C),n.addEventListener(`pointermove`,oe),n.addEventListener(`pointerup`,ce),n.addEventListener(`pointercancel`,le),n.addEventListener(`wheel`,E,{passive:!1}),n.addEventListener(`dblclick`,de),n.addEventListener(`keydown`,pe),{fit:d,selectedIds:()=>o,clearSelection:()=>g(new Set),pruneSelection:v,closeTitleInput:D}}var C=40,w=220,T=90,ae=30,oe=20,se=18,ce=20,le=26,E=18,D=26,ue=170,de=21,fe=17,pe=10,O=22,me=24,he=16,ge=24,_e=8,ve=Object.freeze({blue:`#60a5fa`,green:`#4ade80`,orange:`#fb923c`,pink:`#f472b6`,cyan:`#22d3ee`,yellow:`#facc15`});function k(e,t){let n=e.split(/\s+/).filter(Boolean),r=[],i=``;for(let e of n){let n=e.match(RegExp(`.{1,${t}}`,`g`))??[e];for(let e of n){let n=i?`${i} ${e}`:e;n.length<=t?i=n:(r.push(i),i=e)}}return i&&r.push(i),r.length>0?r:[``]}function ye(e,t){let n=e.lanes.find(e=>e.id===t.lane);return n?{label:n.label||n.id,hex:ve[n.color]}:null}function be(e,t){let n=k(t.title,ce),r=t.lines.flatMap(e=>k(e.text,le-(e.muted?2:0)).map(t=>({text:t,muted:e.muted}))),i=ye(e,t);return{titleLines:n,bodyLines:r,lane:i,height:24+n.length*oe+r.length*se+(i?26:0)}}function A(e,t){return Object.values(e.elements).filter(e=>e.kind===t)}function xe(e){let t=k(e.text,de);return{lines:t,height:24+(t.length+1)*fe}}function Se(e){let t=new Map;for(let n of A(e,`note`)){let e=t.get(n.on),r=xe(n).height;t.set(n.on,e===void 0?r:e+pe+r)}return t}function Ce(e){return e.columns.map(e=>e.title?k(e.title,me):[])}function we(e){return(Math.max(1,...e.map(e=>e.length))-1)*he}function Te(e,t){let n=new Set(A(e,`box`).filter(e=>!e.at&&t.has(e.id)).map(e=>e.column)),r=[],i=C;for(let t of e.columns)r.push(i),i+=w+(n.has(t.id)?Math.max(T,186):T);return r}function Ee(e){let t=new Map;for(let n of A(e,`frame`))for(let e of n.contains)t.has(e)||t.set(e,n.id);return t}function De(e,t){return e===t?0:(e?E:0)+(t?44:0)}function Oe(e,t,n,r){let i=new Map,a=new Map,o=new Map,s=Ee(e),c=A(e,`box`).map((e,t)=>({box:e,index:t})).sort((e,t)=>e.box.order-t.box.order||e.index-t.index);for(let{box:l}of c){let c=Math.max(0,e.columns.findIndex(e=>e.id===l.column)),u=be(e,l),d=s.get(l.id)??null,f=(a.get(l.column)??n)+De(o.get(l.column)??null,d),p=l.at??{x:t[c]??C,y:f};if(!l.at){let e=(r.get(l.id)??0)-_e;a.set(l.column,f+Math.max(u.height,e)+ae),o.set(l.column,d)}i.set(l.id,{kind:`box`,id:l.id,x:p.x,y:p.y,width:w,height:u.height,titleLines:u.titleLines,bodyLines:u.bodyLines,lane:u.lane,isGhost:l.ghost})}return i}function ke(e){if(e.length===0)return null;let t=Math.min(...e.map(e=>e.x)),n=Math.min(...e.map(e=>e.y)),r=Math.max(...e.map(e=>e.x+e.width)),i=Math.max(...e.map(e=>e.y+e.height));return{x:t,y:n,width:r-t,height:i-n}}function Ae(e,t){return A(e,`frame`).flatMap(e=>{let n=ke(e.contains.flatMap(e=>t.get(e)??[]));return n?[{kind:`frame`,id:e.id,title:e.title,x:n.x-E,y:n.y-E-D,width:n.width+36,height:n.height+36+D}]:[]})}function je(e,t){let n=e.x+e.width/2,r=t.x+t.width/2;if(Math.abs(r-n)>e.width/2){let i=r>n,a={x:i?e.x+e.width:e.x,y:e.y+Math.min(e.height/2,40)},o={x:i?t.x:t.x+t.width,y:t.y+Math.min(t.height/2,40)},s=(o.x-a.x)/2;return{start:a,end:o,path:`M ${a.x} ${a.y} C ${a.x+s} ${a.y}, ${o.x-s} ${o.y}, ${o.x} ${o.y}`}}let i=t.y>e.y,a={x:n,y:i?e.y+e.height:e.y},o={x:r,y:i?t.y:t.y+t.height},s=(o.y-a.y)/2;return{start:a,end:o,path:`M ${a.x} ${a.y} C ${a.x} ${a.y+s}, ${o.x} ${o.y-s}, ${o.x} ${o.y}`}}function Me(e,t){return A(e,`wire`).flatMap(e=>{let n=t.get(e.from),r=t.get(e.to);if(!n||!r)return[];let i=je(n,r);return[{kind:`wire`,id:e.id,path:i.path,start:i.start,end:i.end,label:e.label,labelAt:{x:(i.start.x+i.end.x)/2,y:(i.start.y+i.end.y)/2-6},isDashed:e.dashed,tone:e.tone,strokeHex:e.tone===`lane`?n.lane?.hex??null:null}]})}function Ne(e){return e.resolvedBy?`resolved by ${e.resolvedBy}`:e.author?`from ${e.author}`:``}function Pe(e,t){let n=new Map;return A(e,`note`).flatMap(e=>{let r=t.get(e.on);if(!r)return[];let{lines:i,height:a}=xe(e),o=n.get(e.on)??r.y-_e;return n.set(e.on,o+a+pe),[{kind:`note`,id:e.id,x:r.x+r.width-ge,y:o,width:ue,height:a,lines:i,byline:Ne(e),isResolved:e.resolvedBy!==null}]})}function Fe(e,t,n){let r=e.flatMap(e=>e.kind===`wire`?[]:[e]),i=(t.at(-1)??C)+w,a=ke([...r,{x:0,y:0,width:i,height:n}]);return a?{x:Math.min(0,a.x-C),y:Math.min(0,a.y-C),width:a.width+80,height:a.height+80}:{x:0,y:0,width:i+C,height:80}}function Ie(e){let t=Se(e),n=Te(e,t),r=Ce(e),i=we(r),a=84+i,o=Oe(e,n,a,t),s=[...Ae(e,o),...Me(e,o),...o.values(),...Pe(e,o)],c=Fe(s,n,a),l=c.y+c.height,u=e.lanes.map((e,t)=>({label:e.label||e.id,hex:ve[e.color],x:C,y:l+t*O})),d=l+u.length*O+(u.length>0?12:0),f=e.caption?{text:e.caption,x:C,y:d}:null,p=u.length*O+(f?30:0)+(u.length>0?12:0);return{columns:e.columns.map((e,t)=>({id:e.id,titleLines:r[t]??[],titleBaselineY:56,ruleY:66+i,x:n[t]??C,width:w})),elements:s,legend:u,caption:f,bounds:{...c,height:c.height+p}}}function Le(e){return JSON.stringify(e)}var Re=`http://www.w3.org/2000/svg`,j=12,ze=26,Be=20,Ve=18,He=17,Ue=14,We=16;function M(e,t={},n=``){let r=document.createElementNS(Re,e);for(let[e,n]of Object.entries(t))r.setAttribute(e,String(n));return n&&r.setAttribute(`class`,n),r}function N(e,t,n,r){let i=M(`text`,{x:t,y:n},r);return i.textContent=e,i}function P(e,t){let n=M(`g`,{},`wb-element ${t}`);return n.dataset.elementId=e.id,n.dataset.elementKind=e.kind,n}function Ge(e){let t=P(e,e.isGhost?`wb-box wb-ghost`:`wb-box`),n=M(`rect`,{x:e.x,y:e.y,width:e.width,height:e.height,rx:8},`wb-box-outline`);e.lane&&(n.style.stroke=e.lane.hex),t.append(n),e.titleLines.forEach((n,r)=>{t.append(N(n,e.x+j,e.y+ze+r*Be,`wb-box-title`))});let r=e.y+ze+e.titleLines.length*Be;if(e.bodyLines.forEach((n,i)=>{let a=e.x+j+(n.muted?Ue:0);t.append(N(n.text,a,r+i*Ve,n.muted?`wb-box-line wb-muted`:`wb-box-line`))}),!e.lane)return t;let i=e.y+e.height-28,a=Math.min(e.width-24,16+e.lane.label.length*8),o=M(`rect`,{x:e.x+j,y:i,width:a,height:18,rx:9},`wb-lane-pill`);o.style.stroke=e.lane.hex;let s=N(e.lane.label,e.x+j+8,i+13,`wb-lane-pill-text`);return s.style.fill=e.lane.hex,t.append(o,s),t}function Ke(e){let t=P(e,`wb-frame`);return t.append(M(`rect`,{x:e.x,y:e.y,width:e.width,height:e.height,rx:12},`wb-frame-outline`),N(e.title,e.x+14,e.y+18,`wb-frame-title`)),t}function qe(e){let t=P(e,`wb-wire wb-tone-${e.tone}`),n=M(`path`,{d:e.path},`wb-wire-hit`),r=M(`path`,{d:e.path,"marker-end":`url(#wb-arrow)`},e.isDashed?`wb-wire-line wb-dashed`:`wb-wire-line`);return e.strokeHex&&(r.style.stroke=e.strokeHex),t.append(n,r,M(`circle`,{cx:e.start.x,cy:e.start.y,r:3},`wb-wire-dot`)),e.label&&t.append(N(e.label,e.labelAt.x,e.labelAt.y,`wb-wire-label`)),t}function Je(e){let t=P(e,e.isResolved?`wb-note wb-resolved`:`wb-note`);return t.append(M(`rect`,{x:e.x,y:e.y,width:e.width,height:e.height,rx:4},`wb-note-card`)),e.lines.forEach((n,r)=>{t.append(N(n,e.x+10,e.y+22+r*He,`wb-note-text`))}),e.byline&&t.append(N(e.byline,e.x+10,e.y+22+e.lines.length*He,`wb-note-byline`)),t}var Ye={frame:`frames`,wire:`wires`,box:`boxes`,note:`notes`},Xe=[`box`,`frame`,`wire`,`note`];function Ze(e){switch(e.kind){case`box`:return Ge(e);case`frame`:return Ke(e);case`wire`:return qe(e);case`note`:return Je(e)}}function Qe(e){let t=M(`g`,{},`wb-chrome`);for(let n of e.columns)n.titleLines.length!==0&&(n.titleLines.forEach((e,r)=>{t.append(N(e,n.x,n.titleBaselineY+r*We,`wb-column-title`))}),t.append(M(`line`,{x1:n.x,y1:n.ruleY,x2:n.x+n.width,y2:n.ruleY},`wb-column-rule`)));for(let n of e.legend){let e=M(`rect`,{x:n.x,y:n.y,width:14,height:14,rx:3},`wb-legend-swatch`);e.style.fill=n.hex,t.append(e,N(n.label,n.x+22,n.y+12,`wb-legend-text`))}return e.caption&&t.append(N(e.caption.text,e.caption.x,e.caption.y+16,`wb-caption`)),t}function $e(){let e=M(`defs`),t=M(`marker`,{id:`wb-arrow`,viewBox:`0 0 10 10`,refX:9,refY:5,markerWidth:8,markerHeight:8,orient:`auto-start-reverse`});return t.append(M(`path`,{d:`M 0 1 L 10 5 L 0 9 z`,fill:`context-stroke`})),e.append(t),e}function et(e){let t={frames:M(`g`,{},`wb-layer`),wires:M(`g`,{},`wb-layer`),boxes:M(`g`,{},`wb-layer`),notes:M(`g`,{},`wb-layer`)},n=M(`g`);e.replaceChildren($e(),n,t.frames,t.wires,t.boxes,t.notes);let r=new Map,i=null,a=new Set;function o(e,t){t.classList.toggle(`is-selected`,a.has(e))}function s(e){let a=Ie(e),s=Qe(a);n.replaceWith(s),n=s;let c=new Set;for(let e of a.elements){c.add(e.id);let n=Le(e),i=r.get(e.id);if(i?.signature===n)continue;let a=Ze(e);o(e.id,a),i&&i.node.replaceWith(a),i||t[Ye[e.kind]].append(a),r.set(e.id,{signature:n,node:a})}for(let[e,t]of r)c.has(e)||(t.node.remove(),r.delete(e));return i=a,a}function c(e){if(!(e instanceof Element))return null;let t=e.closest(`.wb-element`),n=t?.dataset.elementId,r=Xe.find(e=>e===t?.dataset.elementKind);return!n||!r?null:{id:n,kind:r}}function l(e){a=e;for(let[e,t]of r)o(e,t.node)}function u(){for(let e of r.values())e.node.remove();r.clear();let e=M(`g`);n.replaceWith(e),n=e,i=null}return{render:s,layout:()=>i,elementFromTarget:c,nodeOf:e=>r.get(e)?.node??null,setSelection:l,clear:u}}var tt=`http://www.w3.org/2000/svg`,nt=`No boards yet. Make one here, or have an agent run glimmervoid whiteboard new <title>.`,rt=`Pick a board above.`,F=null,I=null,L=null,R=null,it=!0,z=null,B=i(`action-status wb-status`),V=i(`action-status wb-status`);function H(e){let{dialog:n,close:r,actions:i,btnCancel:a}=o({title:e.title}),s=t(`input`,`dialog-input`);s.type=`text`,s.placeholder=e.placeholder,s.maxLength=e.maxLength,s.value=e.initialValue??``,s.autocomplete=`off`,s.setAttribute(`aria-label`,e.label);let c=t(`div`,`dialog-error`);c.setAttribute(`role`,`alert`);let l=e.choices?t(`select`,`dialog-input wb-dialog-select`):null;if(l&&e.choices){l.setAttribute(`aria-label`,e.choices.label);for(let n of e.choices.options){let e=t(`option`,null,n.text);e.value=n.value,l.append(e)}}let u=t(`button`,`btn-dialog btn-dialog-confirm`,e.confirmLabel);u.type=`button`,i.append(u),n.append(t(`label`,`dialog-label`,e.label),s,...l?[l]:[],c,i);async function d(){let t=s.value.trim();if(!t){c.textContent=`${e.label} is empty.`;return}u.disabled=!0;let n=await e.onSubmit(t,l?.value??null);u.disabled=!1,n?c.textContent=n:r()}a.addEventListener(`click`,r),u.addEventListener(`click`,()=>void d()),s.addEventListener(`keydown`,e=>{e.key===`Enter`&&(e.preventDefault(),d())}),requestAnimationFrame(()=>s.focus())}function U(){return F?g(F):null}function W(){return u().find(e=>e.id===F)??null}async function at(e){if(!F||e.length===0)return!1;let t=await l(F,e);return t.ok?(B.clear(),!0):(B.show(`error`,t.error),!1)}async function G(e){if(!F)return`No board is open.`;let t=await l(F,e);return t.ok?null:t.error}function K(e){let t=r(e);return t?n(t):`closed session`}function q(e){let t=U();return[...R?.selectedIds()??new Set].flatMap(e=>t?.elements[e]??[]).filter(t=>t.kind===e)}function J(){if(!I)return;let e=U(),t=q(`box`).length,n=R?.selectedIds().size??0;I.buttons.box.disabled=!e,I.buttons.wire.disabled=t!==2,I.buttons.note.disabled=t!==1,I.buttons.frame.disabled=t===0,I.buttons.fit.disabled=!e,I.buttons.remove.disabled=!e,I.toolbar.dataset.selectedCount=String(n)}function Y(){if(!I)return;let e=u();F&&!e.some(e=>e.id===F)&&(F=null),!F&&e[0]&&Q(e[0].id),I.list.replaceChildren(...e.map(e=>{let n=t(`button`,`wb-board-tab`,e.title);return n.type=`button`,n.setAttribute(`aria-pressed`,String(e.id===F)),e.connectedSessionIds.length>0&&n.append(t(`span`,`wb-board-tab-count`,String(e.connectedSessionIds.length))),n.addEventListener(`click`,()=>Q(e.id)),n})),ot()}function ot(){if(!I)return;let e=W(),n=u().length>0;I.boardHead.hidden=!e,I.canvas.hidden=!e,I.empty.hidden=!!e,I.empty.textContent=n?rt:nt,e&&(I.boardTitle.textContent=e.title,I.boardMeta.textContent=`v${e.version}`,I.presence.replaceChildren(...e.connectedSessionIds.map(e=>t(`span`,`wb-presence-pill`,K(e)))),e.connectedSessionIds.length===0&&I.presence.append(t(`span`,`wb-presence-none`,`no sessions connected`)),J(),X())}function st(e,t){let n=K(t);if(!e?.connectedSessionIds.includes(t))return`${n} is not connected to this board`;let r=e.queuedBySessionId[t]??0;return r===0?`${n} has read every change`:`${r} board ${r===1?`edit`:`edits`} queued for ${n}`}function X(){if(!I||!z)return;let e=W();I.dockQueued.textContent=st(e,z),I.sendToAgent.disabled=!e?.connectedSessionIds.includes(z)}async function ct(){if(!I||!F||!z)return;I.sendToAgent.disabled=!0,V.show(`busy`,`sending`);let e=await h(F,z);X(),e.ok?V.show(`ok`,`sent; the agent reads the board when it is ready`):V.show(`error`,e.error)}function Z(){if(!L)return;let e=U();e?(L.render(e),R?.pruneSelection(e),it&&=(R?.fit(),!1),J()):L.clear()}function Q(e){F!==e&&(F=e,it=!0,R?.clearSelection(),R?.closeTitleInput(),L?.clear(),B.clear(),Y(),m(e).then(Z))}function lt(){let t=U();if(!t)return;let n=q(`box`)[0],r=t.columns.map(e=>({value:e.id,text:e.title||e.id})),i=n?.column;i&&r.sort((e,t)=>Number(t.value===i)-Number(e.value===i)),H({title:`Add a box`,label:`Box title`,placeholder:`parse the feed`,maxLength:e.title,confirmLabel:`Add box`,choices:r.length>1?{label:`Column`,options:r}:void 0,onSubmit:(e,t)=>G([{op:`add`,element:{kind:`box`,id:x(`box`),title:e,column:t??r[0]?.value??`main`,lines:[],lane:null,ghost:!1,order:0,at:null}}])})}function ut(t){H({title:`Pin a note`,label:`Note`,placeholder:`what about retries?`,maxLength:e.noteText,confirmLabel:`Pin note`,onSubmit:e=>G([{op:`add`,element:{kind:`note`,id:x(`note`),on:t,text:e,author:``,resolvedBy:null}}])})}function dt(){let[e,t]=q(`box`);e&&t&&(R?.clearSelection(),at([{op:`add`,element:{kind:`wire`,id:x(`wire`),from:e.id,to:t.id,dashed:!1,tone:`plain`,label:null}}]))}function ft(){let t=q(`box`).map(e=>e.id);t.length!==0&&H({title:`Frame the selected boxes`,label:`Frame title`,placeholder:`intake`,maxLength:e.title,confirmLabel:`Add frame`,onSubmit:async e=>{let n=await G([{op:`add`,element:{kind:`frame`,id:x(`frame`),title:e,contains:t}}]);return n||R?.clearSelection(),n}})}function pt(){let e=W();if(!e)return;let t=e.connectedSessionIds.map(K),n=t.length>0?` ${t.join(`, `)} ${t.length===1?`is`:`are`} connected and will lose it.`:``;a({title:`Delete board`,message:`Delete "${e.title}" for good?${n}`,confirmLabel:`Delete board`,danger:!0,onConfirm:()=>{p(e.id).then(e=>{e.ok||B.show(`error`,e.error)})}})}function mt(){H({title:`New board`,label:`Board title`,placeholder:`knowledge writer`,maxLength:e.title,confirmLabel:`Create board`,onSubmit:async e=>{let t=await _(e);return t.ok?(Q(t.boardId),null):t.error}})}function $(e,n,r=``){let i=t(`button`,`wb-button ${r}`.trim(),e);return i.type=`button`,i.addEventListener(`click`,n),i}function ht(e){let n=t(`div`,`wb-top`),r=t(`div`,`wb-board-list`);r.setAttribute(`aria-label`,`Boards`),n.append(r,$(`new board`,mt));let i=t(`div`,`wb-board-head`),a=t(`div`,`wb-title-row`),o=t(`h2`,`wb-board-title`),c=t(`span`,`wb-board-meta`),l=t(`div`,`wb-presence`);a.append(o,c,l);let u=t(`div`,`wb-toolbar`),f={box:$(`box`,lt),wire:$(`wire`,dt),note:$(`note`,()=>{let[e]=q(`box`);e&&ut(e.id)}),frame:$(`frame`,ft),fit:$(`fit`,()=>R?.fit()),remove:$(`delete board`,pt,`wb-button-danger`)};f.fit.dataset.phoneVisible=``,u.append(f.box,f.wire,f.note,f.frame,f.fit,f.remove,B.element),i.append(a,u);let p=t(`div`,`wb-canvas`),m=document.createElementNS(tt,`svg`);m.setAttribute(`class`,`wb-svg`),m.setAttribute(`role`,`img`),m.setAttribute(`aria-label`,`Whiteboard`),m.setAttribute(`preserveAspectRatio`,`xMidYMin meet`),p.append(m);let h=t(`p`,`wb-empty`,nt),g=t(`div`,`wb-dock`);g.hidden=!0;let _=t(`span`,`wb-dock-queued`),v=$(`send to agent`,()=>void ct()),y=t(`div`,`wb-dock-bar`);y.append(_,v,V.element),g.append(y),e.replaceChildren(n,i,p,h,g),I={list:r,boardHead:i,boardTitle:o,boardMeta:c,presence:l,toolbar:u,canvas:p,empty:h,dock:g,dockQueued:_,sendToAgent:v,buttons:f};let b=et(m);L=b,R=ie({svg:m,canvas:p,renderer:b,currentBoard:U,sendOps:at,onSelectionChange:J,onPhoneTapBox:ut}),s(Y),d(e=>{e===F&&Z()}),Y()}function gt(){return document.documentElement.dataset.layout===`phone`}function _t(){z&&c()===z&&v(),z=null,I&&(I.dock.hidden=!0)}function vt(e){if(!I||gt())return;let t=r(e);t&&(z=e,I.dock.hidden=!1,V.clear(),X(),y(t,e,I.dock,{className:`wb-docked-card`}))}function yt(){let e=f();e&&(Q(e.boardId),e.dockSessionId&&vt(e.dockSessionId)),Y(),F&&m(F).then(Z)}var bt={mount:ht,refresh:yt,deactivate:_t};export{bt as view};
@@ -1 +1 @@
1
- import{ht as e}from"./updates-view-core-40jpDW2b.js";import{D as t}from"./dom-helpers-DBbFg1c_.js";var n=new Map(Object.entries({WAITING:`now`,COMPLETE:`later`,FAILED:`resting`,IDLE:`resting`,RUNNING:`resting`,STARTING:`resting`,INITIALIZING:`resting`,DORMANT:`resting`,DONE:`resting`}));function r(e){return(typeof e.state==`string`?n.get(e.state):void 0)??`resting`}function i(e,n){return[...e].map(([e,r])=>{let i=r.currentState||t.DORMANT;return{id:e,ui:r,name:n(r),isDormant:i===t.DORMANT,state:i,unseenOutcome:r.unseenOutcome??null,ownerId:r.ownerId??null}})}function a(e){let t=new Set(e.map(({id:e})=>e)),n=e=>e.ownerId&&t.has(e.ownerId)?e.ownerId:null,r=new Map;for(let t of e){let e=n(t);e&&r.set(e,[...r.get(e)??[],t])}return e.flatMap(e=>n(e)?[]:[e,...r.get(e.id)??[]])}function o(e){return a([...e].sort((e,t)=>Number(e.isDormant===!0)-Number(t.isDormant===!0)))}function s({ownerName:e,ownedCount:t}){return e===null?t===1?`Owns 1 session`:t>1?`Owns ${t} sessions`:null:`Owned by ${e}`}function c(e,t,n){if(!e.length)return null;let r=n<0?-1:1,i=t==null?-1:e.indexOf(t);return e[((i===-1?r===1?-1:0:i)+r+e.length)%e.length]}function l({state:n,unseenOutcome:r}){if(n===t.WAITING)return`waiting`;let i=e.safeParse(r);return i.success?i.data:null}function u(e={}){return l(e)!==null}var d=new Map([[`failed`,0],[`waiting`,1],[`finished`,2]]);function f(e){let t=l(e);return t===null?void 0:d.get(t)}function p(e){return e.filter(e=>f(e)!==void 0).sort((e,t)=>(f(e)??0)-(f(t)??0)).map(({id:e})=>e)}function m(e,t){let n=new Map(e.map(e=>[e.id,e]));return p(e).flatMap(e=>{let r=n.get(e),i=r?l(r):null;return!r||i===null||e===t?[]:[{id:e,kind:i,name:r.name??``}]})}var h={headTile:32,tile:26,tileGap:4,overflowSlot:40};function g(e,t){if(t===0)return 0;let{headTile:n,tile:r,tileGap:i,overflowSlot:a}=h,o=r+i;if(n+(t-1)*o<=e)return t;let s=e-a-i-n,c=Math.floor(s/o);return Math.max(1,Math.min(t-1,1+c))}var _={waiting:`waitingCount`,failed:`failedCount`,finished:`finishedCount`};function v(e,t,n){let r=l(t||{});r!==null&&(e[_[r]]+=n)}function y(e){let t={waitingCount:0,finishedCount:0,failedCount:0};for(let n of e||[])v(t,n,1);return t}function b(){return{counts:{waitingCount:0,finishedCount:0,failedCount:0},ownedCountByOwnerId:new Map}}function x(e,t,n){if(v(e.counts,t,n),t.ownerId===null)return;let r=(e.ownedCountByOwnerId.get(t.ownerId)??0)+n;r>0?e.ownedCountByOwnerId.set(t.ownerId,r):e.ownedCountByOwnerId.delete(t.ownerId)}function S(e,t){x(e,t,1)}function C(e,t){x(e,t,-1)}function w({waitingCount:e,finishedCount:t,failedCount:n}){return e+n+t}function T({waitingCount:e,failedCount:t}){return e+t}function E({waitingCount:e,finishedCount:t,failedCount:n}){let r=[];return n>0&&r.push(`${n} FAILED`),e===1&&r.push(`1 NEEDS YOU`),e>1&&r.push(`${e} NEED YOU`),t>0&&r.push(`${t} FINISHED`),r.length===0?`ALL CLEAR`:r.join(`, `)}var D=new Map([[`hand`,2]]),O=1;function k(e){return e?typeof e==`string`&&D.get(e)||O:0}function A(e){let t=!1,n=0;for(let r of e||[]){let e=k(r);e<=n||(t=typeof r!=`string`||r,n=e)}return t}var j=new Map,M=b();function N(e){return e.card?.dataset.session||e.nameEl?.textContent||``}function P(e){return typeof e==`string`?e:String(e)}function F(e){return typeof e==`string`?j.get(e):void 0}var I=document.getElementById(`sessions-container`);export{T as S,c as _,N as a,S as b,E as c,s as d,g as f,o as g,m as h,P as i,i as l,u as m,I as n,j as o,w as p,F as r,h as s,M as t,y as u,A as v,C as x,r as y};
1
+ import{ht as e}from"./updates-view-core-C8XDTgVm.js";import{D as t}from"./dom-helpers-DBbFg1c_.js";var n=new Map(Object.entries({WAITING:`now`,COMPLETE:`later`,FAILED:`resting`,IDLE:`resting`,RUNNING:`resting`,STARTING:`resting`,INITIALIZING:`resting`,DORMANT:`resting`,DONE:`resting`}));function r(e){return(typeof e.state==`string`?n.get(e.state):void 0)??`resting`}function i(e,n){return[...e].map(([e,r])=>{let i=r.currentState||t.DORMANT;return{id:e,ui:r,name:n(r),isDormant:i===t.DORMANT,state:i,unseenOutcome:r.unseenOutcome??null,ownerId:r.ownerId??null}})}function a(e){let t=new Set(e.map(({id:e})=>e)),n=e=>e.ownerId&&t.has(e.ownerId)?e.ownerId:null,r=new Map;for(let t of e){let e=n(t);e&&r.set(e,[...r.get(e)??[],t])}return e.flatMap(e=>n(e)?[]:[e,...r.get(e.id)??[]])}function o(e){return a([...e].sort((e,t)=>Number(e.isDormant===!0)-Number(t.isDormant===!0)))}function s({ownerName:e,ownedCount:t}){return e===null?t===1?`Owns 1 session`:t>1?`Owns ${t} sessions`:null:`Owned by ${e}`}function c(e,t,n){if(!e.length)return null;let r=n<0?-1:1,i=t==null?-1:e.indexOf(t);return e[((i===-1?r===1?-1:0:i)+r+e.length)%e.length]}function l({state:n,unseenOutcome:r}){if(n===t.WAITING)return`waiting`;let i=e.safeParse(r);return i.success?i.data:null}function u(e={}){return l(e)!==null}var d=new Map([[`failed`,0],[`waiting`,1],[`finished`,2]]);function f(e){let t=l(e);return t===null?void 0:d.get(t)}function p(e){return e.filter(e=>f(e)!==void 0).sort((e,t)=>(f(e)??0)-(f(t)??0)).map(({id:e})=>e)}function m(e,t){let n=new Map(e.map(e=>[e.id,e]));return p(e).flatMap(e=>{let r=n.get(e),i=r?l(r):null;return!r||i===null||e===t?[]:[{id:e,kind:i,name:r.name??``}]})}var h={headTile:32,tile:26,tileGap:4,overflowSlot:40};function g(e,t){if(t===0)return 0;let{headTile:n,tile:r,tileGap:i,overflowSlot:a}=h,o=r+i;if(n+(t-1)*o<=e)return t;let s=e-a-i-n,c=Math.floor(s/o);return Math.max(1,Math.min(t-1,1+c))}var _={waiting:`waitingCount`,failed:`failedCount`,finished:`finishedCount`};function v(e,t,n){let r=l(t||{});r!==null&&(e[_[r]]+=n)}function y(e){let t={waitingCount:0,finishedCount:0,failedCount:0};for(let n of e||[])v(t,n,1);return t}function b(){return{counts:{waitingCount:0,finishedCount:0,failedCount:0},ownedCountByOwnerId:new Map}}function x(e,t,n){if(v(e.counts,t,n),t.ownerId===null)return;let r=(e.ownedCountByOwnerId.get(t.ownerId)??0)+n;r>0?e.ownedCountByOwnerId.set(t.ownerId,r):e.ownedCountByOwnerId.delete(t.ownerId)}function S(e,t){x(e,t,1)}function C(e,t){x(e,t,-1)}function w({waitingCount:e,finishedCount:t,failedCount:n}){return e+n+t}function T({waitingCount:e,failedCount:t}){return e+t}function E({waitingCount:e,finishedCount:t,failedCount:n}){let r=[];return n>0&&r.push(`${n} FAILED`),e===1&&r.push(`1 NEEDS YOU`),e>1&&r.push(`${e} NEED YOU`),t>0&&r.push(`${t} FINISHED`),r.length===0?`ALL CLEAR`:r.join(`, `)}var D=new Map([[`hand`,2]]),O=1;function k(e){return e?typeof e==`string`&&D.get(e)||O:0}function A(e){let t=!1,n=0;for(let r of e||[]){let e=k(r);e<=n||(t=typeof r!=`string`||r,n=e)}return t}var j=new Map,M=b();function N(e){return e.card?.dataset.session||e.nameEl?.textContent||``}function P(e){return typeof e==`string`?e:String(e)}function F(e){return typeof e==`string`?j.get(e):void 0}var I=document.getElementById(`sessions-container`);export{T as S,c as _,N as a,S as b,E as c,s as d,g as f,o as g,m as h,P as i,i as l,u as m,I as n,j as o,w as p,F as r,h as s,M as t,y as u,A as v,C as x,r as y};
@@ -0,0 +1 @@
1
+ import{b as e,d as t,f as n,s as r}from"./dom-helpers-DBbFg1c_.js";import{d as i,u as a}from"./control-ws-CLjOEjA2.js";import{o}from"./card-registry-D5FILlqB.js";import{c as s,i as c,s as ee,t as l}from"./action-status-2TEW4EL2.js";import{i as u}from"./modal-USMHOKBI.js";import{Bt as d,Ct as f,Dt as p,Lt as m,Nt as h,Pt as g,Qr as _,Rt as v,St as y,Vt as b,Zr as te,_ as ne,bt as x,dn as re,fn as ie,j as ae,jt as oe,lt as se,m as ce,vt as le,wt as ue,x as de,xt as fe,yt as pe}from"./index-C4QIxDmH.js";import{t as me}from"./team-review-panel-CkVcgb_2.js";import{t as he}from"./pr-queue-columns-BR9_AlRZ.js";import{n as S}from"./setup-step-D0y3riKj.js";var ge={HIGH:`High confidence`,MEDIUM:`Medium confidence`,LOW:`Low confidence`},_e={HIGH:`ok`,MEDIUM:`warn`,LOW:`muted`},C={queued:`Waiting to be researched`,running:`Researching`,error:`Research failed`,aside:`Set aside`},ve={forum:`Forum`,discord:`Discord`};function w(e){return e.status===`ready`&&e.verdict?{text:ge[e.verdict],tone:_e[e.verdict]}:e.status===`ready`?{text:`Researched`,tone:`muted`}:e.status===`error`?{text:C.error,tone:`danger`}:{text:C[e.status],tone:`muted`}}function T(e){let t=ve[e.item.source];return e.item.channel?`${t} #${e.item.channel}`:t}function E(e){return e.entry.item.title||`Untitled question`}function ye(e){return e.status!==`running`&&e.status!==`queued`}function be(e){return e.status!==`aside`}function xe(e){let t=e.find(e=>e.id===`working`)?.items.length??0;return t===0?`No community question needs you right now.`:`No community question needs you right now. ${t} ${t===1?`question is`:`questions are`} being researched.`}function D(e){return e?e.configured===!1?e.reason??`The community lane is not set up yet.`:`No community questions yet. New ones asked after you turned this on show up here.`:`Waiting for the community lane to report.`}function Se(e){return e.filter(e=>!e.isWorkspace&&!e.isEphemeral).map(({id:e,name:t})=>({id:e,name:t})).toSorted((e,t)=>e.name.localeCompare(t.name))}var O=[`key`,`project`,`skill`,`discord`];function Ce(e){let t=e===`finished`?O.length:O.indexOf(e),n=e=>e<t?`done`:e===t?`current`:`upcoming`;return{key:n(0),project:n(1),skill:n(2),discord:n(3)}}function we(e){let t=e.split(/[\s,]+/).map(e=>e.replace(/^#/,``)).filter(Boolean);return[...new Set(t)]}var k=2;function A(e){a({type:`dashboard-telemetry`,event:`operator_action`,properties:{surface:`onboarding`,action:e}})}function j(){let e=ae().community,t=typeof e==`object`&&e?e:{},n=Array.isArray(t.discordChannels)?t.discordChannels.filter(e=>typeof e==`string`):[];return{projectId:typeof t.projectId==`number`?t.projectId:k,skill:typeof t.skill==`string`?t.skill:``,discordChannels:n}}function Te(e,t,n,i){let a=r(`input`,`dialog-input repo-roots-adder-input`);return a.id=e,a.type=i,a.value=t,a.placeholder=n,a.autocomplete=`off`,a.spellcheck=!1,a}function M(e,t){let n=r(`button`,`btn-dialog btn-dialog-${t}`,e);return n.type=`button`,n}function Ee({onFinish:e}){let t=r(`section`,`first-run-checklist review-setup`);t.setAttribute(`aria-labelledby`,`community-setup-title`);let n=r(`h2`,`first-run-title`,`Answer community questions`);n.id=`community-setup-title`;let a=r(`ol`,`first-run-steps`),o=r(`p`,`first-run-step-hint review-setup-foot`,`Each question gets a researched draft reply. Nothing posts until you post it yourself. `);o.append(ne(`lanes-community`,`community-enabled`,`All community settings`));let s=r(`div`,`first-run-step-actions`),u=M(`Finish setup`,`confirm`);s.append(u),s.hidden=!0,t.append(r(`span`,`first-run-eyebrow`,`SET UP COMMUNITY`),n,a,s,o);let d=null;u.addEventListener(`click`,()=>{A(`finish-community-setup`),d=null,e()});function f(e){d=e,y(),(a.querySelector(`[aria-current="step"] input`)??(s.hidden?null:u))?.focus()}async function p(e,t,n,r){t.disabled=!0,n.show(`busy`,`Saving`);try{let t=await i(`update-settings`,{settings:e},{timeoutMs:l});if(t.type===`settings-error`){n.show(`error`,t.message);return}if(t.type!==`settings-updated`){n.show(`error`,`The server did not confirm the save.`);return}de(t.settings),f(r)}catch(e){n.show(`error`,ee(e,l))}finally{t.disabled=!1}}function m(e){let t=Te(e.inputId,e.initialValue,e.placeholder,e.inputType),n=r(`label`,`repo-roots-adder-label`,e.label);n.htmlFor=t.id;let i=r(`div`,`first-run-step-actions`),a=c(),o=M(e.saveLabel,`confirm`),s=()=>{let n=e.settingsPatch(t.value);typeof n==`string`?a.show(`error`,n):(A(e.action),p(n,o,a,e.nextProgress))};if(o.addEventListener(`click`,s),t.addEventListener(`keydown`,e=>{e.key===`Enter`&&(e.preventDefault(),s())}),i.append(o),e.isSkippable){let t=M(`Skip`,`cancel`);t.addEventListener(`click`,()=>f(e.nextProgress)),i.append(t)}return i.append(a.element),[r(`p`,`first-run-step-text`,e.advice),n,t,i]}let h=()=>m({advice:`Glimmervoid reads new forum and Discord questions through your PostHog personal API key. Create one in PostHog under Settings, Personal API keys, with read access to the project that holds the questions.`,label:`PERSONAL API KEY`,inputId:`community-setup-key`,inputType:`password`,initialValue:``,placeholder:`phx_`,saveLabel:`Save key`,action:`save-community-key`,nextProgress:`project`,isSkippable:!1,settingsPatch:e=>e.trim()?{posthog:{apiKey:e.trim()}}:`Paste a PostHog personal API key.`}),g=()=>m({advice:`The PostHog project that holds the synced community forum table and the Discord bot events. PostHog's own community lives in project 2.`,label:`PROJECT ID`,inputId:`community-setup-project`,inputType:`number`,initialValue:String(j().projectId),placeholder:String(k),saveLabel:`Use project`,action:`save-community-project`,nextProgress:`skill`,isSkippable:!1,settingsPatch:e=>{let t=Number(e.trim());return Number.isInteger(t)&&t>0?{community:{projectId:t}}:`Type the project id as a whole number, such as 2.`}}),_=()=>m({advice:`The Claude Code skill the research agent follows for each question, typed by name. A skill that knows your docs and support playbook gives the best drafts. Skip to research with whatever skills the agent has.`,label:`SKILL`,inputId:`community-setup-skill`,inputType:`text`,initialValue:j().skill,placeholder:`skill name`,saveLabel:`Save skill`,action:`save-community-skill`,nextProgress:`discord`,isSkippable:!0,settingsPatch:e=>({community:{skill:e.trim()}})}),v=()=>m({advice:`Discord questions come from a Discord bot that sends message_sent and thread_created events into the project above. With that bot in place, list the channels to watch by name, without the #. A cheap model picks out the real questions; only those are researched.`,label:`CHANNELS`,inputId:`community-setup-discord`,inputType:`text`,initialValue:j().discordChannels.join(`, `),placeholder:`community-questions, help`,saveLabel:`Save channels`,action:`save-community-discord`,nextProgress:`finished`,isSkippable:!0,settingsPatch:e=>{let t=we(e);return t.length>0?{community:{discordChannels:t}}:`Type at least one channel, or skip.`}});function y(){if(!d)return;let e=Ce(d);a.replaceChildren(S({title:`1. PostHog personal API key`,state:e.key,summary:`Key saved`,badge:`NEEDED`,body:h}),S({title:`2. PostHog project`,state:e.project,summary:`Project ${j().projectId}`,badge:``,body:g}),S({title:`3. Research skill (optional)`,state:e.skill,summary:j().skill||`No skill`,badge:``,body:_}),S({title:`4. Discord (optional)`,state:e.discord,summary:j().discordChannels.map(e=>`#${e}`).join(` `)||`Forum only`,badge:``,body:v})),s.hidden=d!==`finished`}function b(){d=`key`,y()}return{element:t,open:b,isOpen:()=>d!==null}}var N=null,P=null,F=null,I=null,L=[],R=null,z=!1,B=null,V=null,H=``,U=new Map,W=null;function De(){return Se([...o].map(([e,t])=>({id:e,name:t.nameEl.textContent??e,isWorkspace:t.card.dataset.workspace!==void 0,isEphemeral:t.card.dataset.ephemeral!==void 0})))}function G(e,t){let n=r(`button`,`pr-action pr-action-ghost`,e);return n.type=`button`,n.disabled=!_(t),n.addEventListener(`click`,()=>te(t)),n}function K(e,t,n){let i=r(`button`,`pr-action`,e);return i.type=`button`,i.disabled=!t,i.addEventListener(`click`,n),i}function q(e,t,n){let i=r(`ul`,e);i.setAttribute(`aria-label`,t);for(let e of n)i.append(r(`li`,null,e));return i}function Oe(e){let t=r(`div`,`pr-detail-heading`),n=r(`div`,`pr-detail-title`);n.append(r(`h2`,null,e.item.title||`Untitled question`));let i=r(`div`,`pr-detail-meta`),a=Date.parse(e.item.createdAt);return i.append(r(`span`,null,e.item.author),r(`span`,null,T(e))),Number.isNaN(a)||i.append(r(`span`,null,`Asked ${ce(a)}`)),t.append(n,i),t}function ke(e){let t=r(`section`,`community-question`);return t.setAttribute(`aria-label`,`Question as asked`),t.append(r(`h3`,`pr-section-heading`,`Question as asked`),r(`p`,`community-question-body`,e.item.body)),t}function Ae(e){let t=r(`section`,`pr-verdict-box`);t.setAttribute(`aria-label`,`Research`);let n=w(e),i=r(`div`,`pr-verdict-line`),a=r(`strong`,`community-badge`,n.text);if(a.dataset.tone=n.tone,i.append(a),t.append(i),e.error&&t.append(r(`p`,`pr-attention-detail`,e.error)),e.summary&&t.append(r(`p`,`pr-verdict-summary`,e.summary)),e.goal&&t.append(r(`p`,`community-goal`,`Goal: ${e.goal}`)),e.gaps.length>0&&t.append(q(`pr-verdict-gaps`,`Not covered`,e.gaps)),e.checked.length===0)return t;let o=r(`details`,`pr-verdict-checked`);return o.append(r(`summary`,null,`What it checked (${e.checked.length})`),q(`community-checked`,`What it checked`,e.checked)),t.append(o),t}function je(e){if(!e.draft)return null;let t=r(`section`,`community-draft`);t.setAttribute(`aria-label`,`Draft reply`),t.append(r(`h3`,`pr-section-heading`,`Draft reply`),r(`p`,`community-draft-body`,e.draft.body));let n=e.draft.publicLinks.filter(_);if(n.length===0)return t;let i=r(`ul`,`community-links`);for(let e of n){let t=r(`li`);t.append(G(e,e)),i.append(t)}return t.append(i),t}function Me(t,n){let r=t.draft?e(t.draft.body):null;r?r.then(()=>n.show(`ok`,`Draft copied. Post it yourself where the question was asked.`),()=>n.show(`error`,`Copying failed. Select the draft text instead.`)):n.show(`error`,`This browser does not allow copying here. Select the draft text instead.`)}async function Ne(e,t){if(!H){t.show(`error`,`Pick a session to start from first.`);return}let n=await s(`open-community-session`,{key:e.item.key,projectId:H},t,{busyText:`Starting a session with the research.`});n?.type===`open-community-session-result`&&(n.ok?(t.show(`ok`,`Started ${n.sessionName??`a session`}.`),n.sessionId&&se()?.openTerminal(n.sessionId)):t.show(`error`,n.error??`The session did not start.`))}async function J(e,t,n){let r=t===`rerun`?`Queuing the research again.`:`Setting the question aside.`,i=await s(`community-action`,{key:e.item.key,action:t},n,{busyText:r});i?.type===`community-action-result`&&(i.ok||n.show(`error`,i.error??`The change did not apply.`))}function Pe(){let e=r(`select`,`community-session-picker`);e.setAttribute(`aria-label`,`Session to start from`);let t=De();t.some(e=>e.id===H)||(H=t[0]?.id??``);for(let n of t){let t=r(`option`,null,n.name);t.value=n.id,t.selected=n.id===H,e.append(t)}return e.disabled=t.length===0,e.addEventListener(`change`,()=>{H=e.value}),e}function Fe(e){let t=r(`div`,`community-actions`),n=c(`pr-action-status`),i=r(`div`,`community-action-buttons`);return i.append(K(`Copy draft`,e.draft!==null,()=>Me(e,n)),G(`Open thread`,e.item.url),Pe(),K(`Start session`,!0,()=>void Ne(e,n)),K(`Re-run`,ye(e),()=>void J(e,`rerun`,n)),K(`Set aside`,be(e),()=>void J(e,`set-aside`,n))),t.append(i,n.element),t}function Ie(e){let t=r(`article`,`pr-detail community-detail`),n=je(e);return t.append(Oe(e),Fe(e),...n?[n]:[],Ae(e),ke(e)),t}function Y(){if(!F)return;let e=m(L,R),t=e?JSON.stringify(e.entry):`empty:${b(L).length}`;if(t===V)return;if(V=t,e){F.replaceChildren(Ie(e.entry));return}let n=L.some(e=>e.items.length>0);F.replaceChildren(n?me({title:`All caught up`,detail:xe(L)}):r(`p`,`pr-empty`,D(x())))}function Le(e,t){f(h(e))&&t.querySelector(`.pr-queue-unseen`)?.remove()}function X(){if(!I)return;let e=g(L,E);ie(I,p(e),e.filter(e=>e.id!==R))}function Z(e){R=e;for(let[t,n]of U)n.setAttribute(`aria-current`,String(t===e));let t=m(L,e),n=U.get(e);t&&n&&Le(t,n),Y(),X(),N&&(N.dataset.detailOpen=`true`)}function Re(){N&&(N.dataset.detailOpen=`false`),R&&U.get(R)?.focus({preventScroll:!0})}function Q(e){let t=m(L,e);if(!t)return;L.find(e=>e.items.includes(t))?.id===`aside`&&(z=!0),R=e,$(),Z(e);let n=U.get(e);n?.focus({preventScroll:!0}),n?.scrollIntoView({block:`nearest`})}function ze(e){if(e.repeat||e.defaultPrevented||!N||t(N)||u()||n(e)||document.activeElement?.classList.contains(`xterm-helper-textarea`))return;let r=v(e);if(r!==`next-row`&&r!==`previous-row`)return;let i=d([...U.keys()],R,r===`next-row`?1:-1);i&&(e.preventDefault(),i!==R&&Q(i))}function Be(e,t){let n=r(`button`,`pr-queue-row pr-queue-row-quiet`);n.type=`button`,n.dataset.queueKey=e.key,n.setAttribute(`aria-current`,String(e.key===R));let i=w(e.entry),a=r(`span`,`review-queue-action community-badge`,i.text);a.dataset.tone=i.tone;let o=r(`span`,`pr-queue-top`);if(o.append(a,r(`span`,`pr-queue-title`,E(e))),n.append(o,r(`span`,`pr-queue-elapsed`,T(e.entry))),n.title=E(e),t&&y(h(e))){let e=r(`span`,`tab-activity active pr-queue-unseen`);e.setAttribute(`aria-hidden`,`true`),n.append(e)}return n.addEventListener(`click`,()=>Z(e.key)),U.set(e.key,n),n}function Ve(e){let t=r(`h3`,`pr-section-heading review-group-heading`),n=r(`span`,`review-group-count`,String(e.items.length));if(e.id!==`aside`)return t.append(r(`span`,null,e.title),n),t;let i=r(`button`,`review-group-toggle`),a=r(`span`,`review-group-chevron`,`▸`);return a.setAttribute(`aria-hidden`,`true`),i.append(a,e.title),i.type=`button`,i.setAttribute(`aria-expanded`,String(z)),i.addEventListener(`click`,()=>{z=!z,B=null,$()}),t.append(i,n),t}function He(e){let t=r(`section`,`pr-queue-section`);if(t.dataset.group=e.id,t.append(Ve(e)),e.id===`aside`&&!z)return t;for(let n of e.items)t.append(Be(n,e.id===`turn`));return t}function Ue(){if(!N||!W)return!1;x()?.configured===!1&&!W.isOpen()&&W.open();let e=W.isOpen();return N.dataset.setup=String(e),W.element.hidden=!e,e}function $(){if(!P||Ue())return;L=pe(),R=oe(L.filter(e=>e.id!==`aside`||z),R),X();let e=JSON.stringify([L,R,z,fe(),x()?.error??null]);if(e!==B){B=e,U.clear();let t=x()?.error,n=t?[r(`p`,`my-pr-note`,t)]:[],i=L.filter(e=>e.items.length>0).map(He);P.replaceChildren(...n,...i.length>0?i:[r(`p`,`pr-empty`,D(x()))])}Y()}function We(e){if(N)return;N=r(`div`,`pr-content review-queue community-queue`),e.append(N);let n=he({queueLabel:`Community questions`,scopeTabs:null,resizerLabel:`Resize community queue`});P=n.queue,F=r(`div`,`review-queue-detail`);let i=r(`div`,`review-queue-phone-bar`),a=r(`button`,`pr-action pr-action-ghost review-queue-back`,`Back to queue`);a.type=`button`,a.addEventListener(`click`,Re),i.append(a),n.detail.append(i,F),I=re({onJump:()=>{let e=g(L,E).find(e=>e.id!==R)?.id;e&&Q(e)},rowFor:e=>U.get(e)}),I.classList.add(`review-queue-banner`),n.queue.before(I),W=Ee({onFinish:$}),W.element.hidden=!0,N.append(W.element,n.columns),N.dataset.detailOpen=`false`,le(()=>!t(N)),ue(e=>{e.kind===`status`&&$()}),document.addEventListener(`keydown`,ze),$()}var Ge={mount:We,refresh:()=>{V=null,$()}};export{Ge as view};
@@ -1 +1 @@
1
- .community-question-body,.community-draft-body{white-space:pre-wrap;overflow-wrap:anywhere;margin:0}.community-question,.community-draft{flex-direction:column;gap:6px;padding:12px 16px;display:flex}.community-question-body{color:var(--text-dim)}.community-actions{flex-direction:column;gap:6px;padding:8px 16px;display:flex}.community-action-buttons{flex-wrap:wrap;align-items:center;gap:8px;display:flex}.community-session-picker{max-width:24ch}.community-links{flex-wrap:wrap;gap:6px;margin:0;padding:0;list-style:none;display:flex}.community-goal{margin:0}.community-badge[data-tone=ok]{color:var(--state-complete)}.community-badge[data-tone=warn]{color:var(--state-waiting)}.community-badge[data-tone=danger]{color:var(--state-failed)}.community-badge[data-tone=muted]{color:var(--text-dim)}
1
+ .community-question-body,.community-draft-body{white-space:pre-wrap;overflow-wrap:anywhere;margin:0}.community-question,.community-draft{flex-direction:column;gap:6px;padding:12px 16px;display:flex}.community-question-body{color:var(--text-dim)}.community-actions{flex-direction:column;gap:6px;padding:8px 16px;display:flex}.community-action-buttons{flex-wrap:wrap;align-items:center;gap:8px;display:flex}.community-session-picker{max-width:24ch}.community-links{flex-wrap:wrap;gap:6px;margin:0;padding:0;list-style:none;display:flex}.community-goal{margin:0}.community-badge[data-tone=ok]{color:var(--state-complete)}.community-badge[data-tone=warn]{color:var(--state-waiting)}.community-badge[data-tone=danger]{color:var(--state-failed)}.community-badge[data-tone=muted]{color:var(--text-dim)}.community-queue[data-setup=true]>.pr-columns{display:none}
@@ -1,4 +1,4 @@
1
- import{et as e,n as t,ot as n,tt as r}from"./updates-view-core-40jpDW2b.js";var i=32,a=/^\s*at .+:\d+:\d+\)?$|^[^@\s]*@.+:\d+:\d+$/;function o(e){let t=e.stack??``,n=String(e);return(t.startsWith(n)?t.slice(n.length):t).split(`
1
+ import{et as e,n as t,ot as n,tt as r}from"./updates-view-core-C8XDTgVm.js";var i=32,a=/^\s*at .+:\d+:\d+\)?$|^[^@\s]*@.+:\d+:\d+$/;function o(e){let t=e.stack??``,n=String(e);return(t.startsWith(n)?t.slice(n.length):t).split(`
2
2
  `).filter(e=>a.test(e)).join(`
3
3
  `)}function s(t){return t==null?null:t instanceof Error?{name:(t.name||`Error`).slice(0,128),stack:o(t).slice(0,e)}:{name:`NonError`,stack:``}}function c(e,t,n){let r=new Set,i=!1;return(a,o)=>{r.has(a)||(r.size>=t?(i||n?.(),i=!0):e(o)&&r.add(a))}}function ee(e){let t=c(e,i);return e=>{let n=s(e);n&&t(`${n.name}\n${n.stack}`,{type:`client-error`,...n})}}function l(e){if(!(e instanceof Error))return`${typeof e}: ${String(e)}`;let t=o(e).split(`
4
4
  `)[0]?.trim()??``;return[`${e.name||`Error`}: ${e.message}`,t].filter(Boolean).join(` `)}function u(e){return e.slice(0,5).map(e=>`${e.path.map(String).join(`.`)||`(root)`}: ${e.message}`).join(`; `)}function te(e){return typeof e!=`object`||!e||!(`type`in e)?`(untyped)`:String(e.type)}function d(e){let t=[];return{sendOrHold(n){return e(n)||t.push(n),!0},flushUnsent(){for(;t.length>0;){let n=t[0];if(!n||!e(n))return;t.shift()}}}}function ne(e){let t=d(e),n=c(t.sendOrHold,i,()=>t.sendOrHold({type:`client-log`,scope:`client-log`,text:`More than ${i} distinct log lines on this page; later ones were not sent.`}));return{report(e,t){let i={scope:e.slice(0,64),text:t.slice(0,r)};n(`${i.scope}\n${i.text}`,{type:`client-log`,...i})},flushUnsent:t.flushUnsent}}function re(e){let t=d(e),n={source:`dashboard`,message:`More than ${i} distinct header errors on this page; later ones were not sent.`},r=c(t.sendOrHold,i,()=>t.sendOrHold({type:`dashboard-telemetry`,event:`header_error_shown`,properties:n}));return{report(e,t){let n={source:e.slice(0,512),message:t.slice(0,512)};r(`${n.source}\n${n.message}`,{type:`dashboard-telemetry`,event:`header_error_shown`,properties:n})},flushUnsent:t.flushUnsent}}var ie=6e4,ae=18e5,f=20;function p({attempt:e=1,baseMs:t=ie,maxMs:n=ae,retryAfterMs:r=null,random:i=Math.random,jitter:a=`full`}={}){if(typeof r==`number`&&Number.isFinite(r)&&r>0)return Math.min(r,n);let o=Math.max(0,Math.min(e,f)-1),s=Math.min(n,t*2**o);return a===`none`?s:Math.round(a===`half`?s*(.5+.5*i()):i()*s)}var m=500,h=3e4;function g(e,t=Math.random){return p({attempt:(typeof e==`number`&&Number.isFinite(e)&&e>0?Math.floor(e):0)+1,baseMs:m,maxMs:h,random:t,jitter:`half`})}function oe(e){return e===`https:`?`wss:`:`ws:`}function _(e,t){return`${oe(e?.protocol)}//${e.host}${t}`}var se=1500,ce=15e3,v=3e3,y=2e3,b=[{kind:`reconnect-shown-terminals`},{kind:`replace-control`}];function x(e){return e.isReplacing?{state:e,actions:[]}:{state:{...e,isReplacing:!0},actions:b}}function S(e,t,n){if(e.isProbing||e.isReplacing)return{state:e,actions:[]};let r={kind:`probe-control`,deadlineMs:t,isAnnounced:n},i=n?[{kind:`hold-input`},r]:[r];return{state:{...e,isProbing:!0},actions:i}}function C(e){return e.isVisible?[{kind:`schedule-heartbeat`,inMs:ce}]:[]}function w(e,t){switch(t.kind){case`shown`:{let n={...e,isVisible:!0};return t.hiddenForMs>1e4?x(n):S(n,se,!0)}case`hidden`:return{state:{...e,isVisible:!1},actions:[{kind:`cancel-heartbeat`}]};case`frozen`:return{state:{...e,isFrozen:!0,isProbing:!1,isReplacing:!1},actions:[{kind:`cancel-heartbeat`},{kind:`close-sockets`}]};case`resumed`:return e.isFrozen?{state:{...e,isFrozen:!1,isReplacing:!0},actions:b}:x(e);case`network-changed`:return e.isVisible?S(e,v,!1):{state:e,actions:[]};case`heartbeat-due`:return e.isVisible?t.lateByMs>5e3?x(e):S(e,v,!1):{state:e,actions:[]};case`pong`:return e.isFrozen?{state:{...e,isProbing:!1},actions:[{kind:`release-input`}]}:{state:{...e,isProbing:!1},actions:[{kind:`release-input`},...C(e)]};case`pong-missed`:{if(e.isFrozen)return{state:{...e,isProbing:!1},actions:[{kind:`release-input`}]};let t=x({...e,isProbing:!1});return{state:t.state,actions:[...t.actions,{kind:`release-input`}]}}case`handshake-overdue`:return{state:{...e,isReplacing:!0},actions:[{kind:`replace-control`}]};case`control-opened`:return{state:{...e,isReplacing:!1},actions:C(e)};case`control-closed`:return{state:{...e,isReplacing:!1},actions:[{kind:`cancel-heartbeat`}]}}}var T=``,E=null;function D(){return T}function O(){return T?Promise.resolve(T):E||(E=fetch(`/control-token`,{credentials:`same-origin`,cache:`no-store`,signal:AbortSignal.timeout(y)}).then(e=>e.ok?e.json():null).then(e=>{let t=e?.token;return T=typeof t==`string`?t:``,T}).catch(()=>``).finally(()=>{E=null}),E)}function k(){T=``}function A(e){return T?`${e}${e.includes(`?`)?`&`:`?`}token=${encodeURIComponent(T)}`:e}var j=null,M=null,N=0,P=new Map,F=!1,I=0,L=0,R=null,z=null,B=null;function V(e){z=e}function H(e){B=e}function U(e){R=e}function W(e){return j?.readyState===WebSocket.OPEN&&(j.send(JSON.stringify(e)),!0)}var G=ne(W),K=re(W);function q(e,t){console.warn(`[${e}] ${t}`),G.report(e,t)}function le(e,t){G.report(`header error`,`${e}: ${t}`),K.report(e,t)}function J(e){return L+=1,`${e}-${L}`}function Y(e,n,{timeoutMs:r=5e3}={}){let i=J(e);return new Promise((a,o)=>{let s=setTimeout(()=>{P.delete(i),o(Error(`Request timed out`))},r);P.set(i,{resolve:a,reject:o,timer:s}),j?.readyState===WebSocket.OPEN?j.send(JSON.stringify({type:e,requestId:i,...n})):(clearTimeout(s),P.delete(i),o(Error(t)))})}function ue(e){if(typeof e!=`object`||!e||!(`requestId`in e))return;let t=e.requestId;if(typeof t!=`string`)return;let n=P.get(t);n&&(clearTimeout(n.timer),P.delete(t),n.reject(Error(`The server sent a reply this dashboard could not read. Reload the page to pick up the current version.`)))}function X(e){for(let t of P.values())clearTimeout(t.timer),t.reject(Error(e));P.clear()}function Z(){M!==null&&clearTimeout(M),M=null}function Q(){let e=j;j=null,Z(),X(t),z&&z(`disconnected`,`Reconnecting`),e?.close()}function de(){Q(),N=0,$()}function fe(e,t){return t&&z&&z(`connecting`,`Connecting`),Y(`ping`,{},{timeoutMs:e}).then(()=>(t&&z&&z(`verified`,`Connected`),!0),()=>!1)}function $(){if(Z(),!D()&&!F){F=!0,O().finally(()=>{F=!1,$()});return}if(F)return;let e=I>0?`?since=${I}`:``,r=_(location,A(`/control${e}`)),i=new WebSocket(r);j=i,B?.(`connecting`);let a=!1;i.addEventListener(`open`,()=>{j===i&&(a=!0,N=0,z&&z(`connected`,`Connected`),G.flushUnsent(),K.flushUnsent(),B?.(`opened`))}),i.addEventListener(`message`,e=>{if(j!==i)return;let t;try{t=JSON.parse(e.data)}catch{q(`control`,`dropped a server message that is not JSON`);return}let r=n.safeParse(t);if(!r.success){q(`control`,`dropped ${te(t)}: ${u(r.error.issues)}`),ue(t);return}let a=r.data;if(a.type===`snapshot`&&typeof a.seq!=`number`&&(I=0),typeof a.seq==`number`){if(a.seq<=I)return;I=a.seq}let o=typeof a.requestId==`string`?a.requestId:``,s=o?P.get(o):void 0;s?(clearTimeout(s.timer),P.delete(o),s.resolve(a)):R&&R(a)}),i.addEventListener(`close`,()=>{if(j!==i)return;j=null,X(t),a||k(),z&&z(`disconnected`,`Reconnecting`),B?.(`closed`);let e=g(N);N+=1,M=setTimeout($,e)})}export{u as C,l as S,y as _,H as a,g as b,le as c,Y as d,V as f,A as g,D as h,U as i,q as l,O as m,$ as n,fe as o,k as p,J as r,de as s,Q as t,W as u,w as v,ee as x,_ as y};
@@ -1,4 +1,4 @@
1
- import{C as e,F as t,I as n,L as r,at as i,it as a}from"./updates-view-core-40jpDW2b.js";import{g as o,h as s,s as c}from"./dom-helpers-DBbFg1c_.js";import{d as l}from"./control-ws-zdIwblY5.js";import{i as u,s as d,t as f}from"./action-status-CMDI7GJF.js";import{n as p,r as m,t as h}from"./modal-USMHOKBI.js";import{n as g}from"./session-tick-DP1vZPA_.js";import{Ar as _,Dr as v,In as y,Mr as b,Or as x,Tr as S,_r as C,gi as w,hi as T,jr as E,kr as D,m as O,mi as k}from"./index-BW8cXix9.js";import{t as ee}from"./repo-roots-adder-YaiE38zm.js";import{t as te}from"./sandboxed-frame-D9MEfNuX.js";var ne=`<h2 class="dialog-title" id="add-session-title">Add Session</h2>
1
+ import{C as e,F as t,I as n,L as r,at as i,it as a}from"./updates-view-core-C8XDTgVm.js";import{g as o,h as s,s as c}from"./dom-helpers-DBbFg1c_.js";import{d as l}from"./control-ws-CLjOEjA2.js";import{i as u,s as d,t as f}from"./action-status-2TEW4EL2.js";import{n as p,r as m,t as h}from"./modal-USMHOKBI.js";import{n as g}from"./session-tick-Bx-5Nn6w.js";import{Ar as _,Dr as v,In as y,Mr as b,Or as x,Tr as S,_r as C,gi as w,hi as T,jr as E,kr as D,m as O,mi as k}from"./index-C4QIxDmH.js";import{t as ee}from"./repo-roots-adder-Km-Y5D9I.js";import{t as te}from"./sandboxed-frame-D9MEfNuX.js";var ne=`<h2 class="dialog-title" id="add-session-title">Add Session</h2>
2
2
  <fieldset class="dialog-mode-controls add-session-agent-only" aria-label="Session kind">
3
3
  <button type="button" class="dialog-mode-button" id="add-session-single-mode" aria-pressed="true">Single repo</button>
4
4
  <button type="button" class="dialog-mode-button" id="add-session-workspace-mode" aria-pressed="false">Workspace</button>
@@ -1 +1 @@
1
- import{s as e}from"./dom-helpers-DBbFg1c_.js";import{d as t}from"./control-ws-zdIwblY5.js";import{s as n,t as r}from"./action-status-CMDI7GJF.js";import{a as i,r as a,t as o}from"./modal-USMHOKBI.js";import{fi as s,wn as c}from"./index-BW8cXix9.js";import{i as l,t as u}from"./plan-render-xH7n9n24.js";var d=null;function f(t){let n=s(t.sessionId);t.select.replaceChildren(...n.map(n=>{let r=e(`option`,null,n.name);return r.value=n.path,r.selected=n.path===t.docPath,r})),t.select.hidden=n.length<2,t.title.textContent=n.find(e=>e.path===t.docPath)?.name??t.title.textContent}function p(e){let t=s(e.sessionId).some(t=>t.path===e.docPath);e.btnEdit.setAttribute(`aria-pressed`,String(e.mode===`edit`)),e.btnPreview.setAttribute(`aria-pressed`,String(e.mode===`preview`)),e.textarea.hidden=e.mode!==`edit`,e.preview.hidden=e.mode!==`preview`,e.select.disabled=e.isBusy,e.btnReload.disabled=e.isBusy||!t,e.btnSave.disabled=e.isBusy||!t||e.baseHash===null||!e.hasUnsavedChanges}function m(e,t,n=`quiet`){e.status.textContent=t,e.status.dataset.tone=n}function h(e){e.preview.replaceChildren(u(l(e.textarea.value)))}function g(e,t){i({title:e,message:`Your unsaved edits will be lost.`,confirmLabel:`Discard`,danger:!0,onConfirm:t})}function _(e,t,n){e.hasUnsavedChanges?g(t,n):n()}async function v(e,i){try{return{reply:await t(e,i,{timeoutMs:r}),failureText:null}}catch(e){return{reply:null,failureText:n(e,r)}}}async function y(e,t){e.docPath=t,e.isBusy=!0,e.baseHash=null,e.textarea.readOnly=!0,f(e),m(e,`Loading`),p(e);let{reply:n,failureText:r}=await v(`session-doc-read`,{id:e.sessionId,path:t});if(d!==e||e.docPath!==t)return;e.isBusy=!1,e.textarea.readOnly=!1;let i=n?.type===`session-doc-response`?n:null;!i?.ok||i.text===void 0||i.hash===void 0?(m(e,i?.error||r||`Could not open this doc`,`warn`),p(e)):(e.textarea.value=i.text,e.baseHash=i.hash,e.hasUnsavedChanges=!1,e.mode===`preview`&&h(e),m(e,``),p(e))}async function b(e){if(e.btnSave.disabled||e.baseHash===null)return;e.isBusy=!0,m(e,`Saving`),p(e);let t=e.docPath,n=e.textarea.value,{reply:r,failureText:i}=await v(`session-doc-save`,{id:e.sessionId,path:t,text:n,baseHash:e.baseHash});if(d!==e||e.docPath!==t)return;e.isBusy=!1;let a=r?.type===`session-doc-save-result`?r:null;!a?.ok||a.hash===void 0?(m(e,a?.conflict?`The agent changed this file since you opened it. Reload to see its version.`:a?.error||i||`Save failed`,`warn`),p(e)):(e.baseHash=a.hash,e.hasUnsavedChanges=e.textarea.value!==n,m(e,e.hasUnsavedChanges?`Unsaved changes`:`Saved`),p(e))}function x(e,t){e.mode=t,t===`preview`&&h(e),p(e),t===`edit`&&e.textarea.focus()}function S(t,n){let r=e(`button`,`plan-control ${n}`,t);return r.type=`button`,r}function C(t){let n=s(t)[0];if(!n||d)return;let r=()=>_(M,`Close this doc?`,()=>M.close()),i=a({dialogClass:`doc-editor`,closeOnBackdrop:!1,onEscape:r}),l=`doc-editor-title-${t}`,u=e(`h3`,`doc-editor-title`,n.name);u.id=l;let f=e(`select`,`plan-control doc-editor-picker`);f.setAttribute(`aria-label`,`Doc`);let h=e(`span`,`doc-editor-status`);h.setAttribute(`role`,`status`);let g=S(`Edit`,`doc-editor-mode`),v=S(`Preview`,`doc-editor-mode`),C=S(`Reload`,`doc-editor-reload`),w=S(`Save`,`doc-editor-save`),T=S(`Close`,`doc-editor-close`),E=e(`div`,`doc-editor-modes`);E.append(g,v);let D=e(`div`,`doc-editor-actions`);D.append(h,C,w,T);let O=e(`div`,`doc-editor-header`);O.append(u,f,E,D);let k=e(`textarea`,`plan-editor doc-editor-text`);k.spellcheck=!0,k.setAttribute(`aria-labelledby`,l);let A=e(`div`,`doc-editor-preview`),j=e(`div`,`doc-editor-body`);j.append(k,A),i.dialog.append(O,j),o(i.dialog,l);let M={sessionId:t,docPath:n.path,baseHash:null,hasUnsavedChanges:!1,isBusy:!1,mode:c()?`preview`:`edit`,title:u,select:f,textarea:k,preview:A,status:h,btnEdit:g,btnPreview:v,btnReload:C,btnSave:w,close:()=>{d=null,i.close()}};d=M,k.addEventListener(`input`,()=>{M.hasUnsavedChanges||(M.hasUnsavedChanges=!0,m(M,`Unsaved changes`),p(M))}),k.addEventListener(`keydown`,e=>{(e.ctrlKey||e.metaKey)&&e.key.toLowerCase()===`s`&&(e.preventDefault(),b(M))}),f.addEventListener(`change`,()=>{let e=f.value;f.value=M.docPath,_(M,`Open another doc?`,()=>{y(M,e)})}),g.addEventListener(`click`,()=>x(M,`edit`)),v.addEventListener(`click`,()=>x(M,`preview`)),C.addEventListener(`click`,()=>{_(M,`Reload this doc?`,()=>{y(M,M.docPath)})}),w.addEventListener(`click`,()=>{b(M)}),T.addEventListener(`click`,r),y(M,n.path),M.mode===`edit`&&k.focus()}function w(e){d&&d.sessionId===e&&(f(d),p(d),!s(e).some(e=>e.path===d?.docPath)&&m(d,`This doc is no longer surfaced, so it cannot be saved.`,`warn`))}export{w as applyDocsToOpenEditor,C as openDocEditor};
1
+ import{s as e}from"./dom-helpers-DBbFg1c_.js";import{d as t}from"./control-ws-CLjOEjA2.js";import{s as n,t as r}from"./action-status-2TEW4EL2.js";import{a as i,r as a,t as o}from"./modal-USMHOKBI.js";import{fi as s,wn as c}from"./index-C4QIxDmH.js";import{i as l,t as u}from"./plan-render-CBwdbgWh.js";var d=null;function f(t){let n=s(t.sessionId);t.select.replaceChildren(...n.map(n=>{let r=e(`option`,null,n.name);return r.value=n.path,r.selected=n.path===t.docPath,r})),t.select.hidden=n.length<2,t.title.textContent=n.find(e=>e.path===t.docPath)?.name??t.title.textContent}function p(e){let t=s(e.sessionId).some(t=>t.path===e.docPath);e.btnEdit.setAttribute(`aria-pressed`,String(e.mode===`edit`)),e.btnPreview.setAttribute(`aria-pressed`,String(e.mode===`preview`)),e.textarea.hidden=e.mode!==`edit`,e.preview.hidden=e.mode!==`preview`,e.select.disabled=e.isBusy,e.btnReload.disabled=e.isBusy||!t,e.btnSave.disabled=e.isBusy||!t||e.baseHash===null||!e.hasUnsavedChanges}function m(e,t,n=`quiet`){e.status.textContent=t,e.status.dataset.tone=n}function h(e){e.preview.replaceChildren(u(l(e.textarea.value)))}function g(e,t){i({title:e,message:`Your unsaved edits will be lost.`,confirmLabel:`Discard`,danger:!0,onConfirm:t})}function _(e,t,n){e.hasUnsavedChanges?g(t,n):n()}async function v(e,i){try{return{reply:await t(e,i,{timeoutMs:r}),failureText:null}}catch(e){return{reply:null,failureText:n(e,r)}}}async function y(e,t){e.docPath=t,e.isBusy=!0,e.baseHash=null,e.textarea.readOnly=!0,f(e),m(e,`Loading`),p(e);let{reply:n,failureText:r}=await v(`session-doc-read`,{id:e.sessionId,path:t});if(d!==e||e.docPath!==t)return;e.isBusy=!1,e.textarea.readOnly=!1;let i=n?.type===`session-doc-response`?n:null;!i?.ok||i.text===void 0||i.hash===void 0?(m(e,i?.error||r||`Could not open this doc`,`warn`),p(e)):(e.textarea.value=i.text,e.baseHash=i.hash,e.hasUnsavedChanges=!1,e.mode===`preview`&&h(e),m(e,``),p(e))}async function b(e){if(e.btnSave.disabled||e.baseHash===null)return;e.isBusy=!0,m(e,`Saving`),p(e);let t=e.docPath,n=e.textarea.value,{reply:r,failureText:i}=await v(`session-doc-save`,{id:e.sessionId,path:t,text:n,baseHash:e.baseHash});if(d!==e||e.docPath!==t)return;e.isBusy=!1;let a=r?.type===`session-doc-save-result`?r:null;!a?.ok||a.hash===void 0?(m(e,a?.conflict?`The agent changed this file since you opened it. Reload to see its version.`:a?.error||i||`Save failed`,`warn`),p(e)):(e.baseHash=a.hash,e.hasUnsavedChanges=e.textarea.value!==n,m(e,e.hasUnsavedChanges?`Unsaved changes`:`Saved`),p(e))}function x(e,t){e.mode=t,t===`preview`&&h(e),p(e),t===`edit`&&e.textarea.focus()}function S(t,n){let r=e(`button`,`plan-control ${n}`,t);return r.type=`button`,r}function C(t){let n=s(t)[0];if(!n||d)return;let r=()=>_(M,`Close this doc?`,()=>M.close()),i=a({dialogClass:`doc-editor`,closeOnBackdrop:!1,onEscape:r}),l=`doc-editor-title-${t}`,u=e(`h3`,`doc-editor-title`,n.name);u.id=l;let f=e(`select`,`plan-control doc-editor-picker`);f.setAttribute(`aria-label`,`Doc`);let h=e(`span`,`doc-editor-status`);h.setAttribute(`role`,`status`);let g=S(`Edit`,`doc-editor-mode`),v=S(`Preview`,`doc-editor-mode`),C=S(`Reload`,`doc-editor-reload`),w=S(`Save`,`doc-editor-save`),T=S(`Close`,`doc-editor-close`),E=e(`div`,`doc-editor-modes`);E.append(g,v);let D=e(`div`,`doc-editor-actions`);D.append(h,C,w,T);let O=e(`div`,`doc-editor-header`);O.append(u,f,E,D);let k=e(`textarea`,`plan-editor doc-editor-text`);k.spellcheck=!0,k.setAttribute(`aria-labelledby`,l);let A=e(`div`,`doc-editor-preview`),j=e(`div`,`doc-editor-body`);j.append(k,A),i.dialog.append(O,j),o(i.dialog,l);let M={sessionId:t,docPath:n.path,baseHash:null,hasUnsavedChanges:!1,isBusy:!1,mode:c()?`preview`:`edit`,title:u,select:f,textarea:k,preview:A,status:h,btnEdit:g,btnPreview:v,btnReload:C,btnSave:w,close:()=>{d=null,i.close()}};d=M,k.addEventListener(`input`,()=>{M.hasUnsavedChanges||(M.hasUnsavedChanges=!0,m(M,`Unsaved changes`),p(M))}),k.addEventListener(`keydown`,e=>{(e.ctrlKey||e.metaKey)&&e.key.toLowerCase()===`s`&&(e.preventDefault(),b(M))}),f.addEventListener(`change`,()=>{let e=f.value;f.value=M.docPath,_(M,`Open another doc?`,()=>{y(M,e)})}),g.addEventListener(`click`,()=>x(M,`edit`)),v.addEventListener(`click`,()=>x(M,`preview`)),C.addEventListener(`click`,()=>{_(M,`Reload this doc?`,()=>{y(M,M.docPath)})}),w.addEventListener(`click`,()=>{b(M)}),T.addEventListener(`click`,r),y(M,n.path),M.mode===`edit`&&k.focus()}function w(e){d&&d.sessionId===e&&(f(d),p(d),!s(e).some(e=>e.path===d?.docPath)&&m(d,`This doc is no longer surfaced, so it cannot be saved.`,`warn`))}export{w as applyDocsToOpenEditor,C as openDocEditor};