glimmervoid 0.52.2-next.697 → 0.52.2-next.699

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 (152) hide show
  1. package/dist/bin/glimmervoid.js +15 -10
  2. package/dist/chunks/{adapters-BbOhEt3K.js → adapters-BQVgsufG.js} +1 -1
  3. package/dist/chunks/{adapters-KsgiBN7g.js → adapters-BwrJAzEk.js} +2 -2
  4. package/dist/chunks/agent-api-cli-CAVmc6oB.js +1 -0
  5. package/dist/chunks/{agent-api-cli-oEczDo6J.js → agent-api-cli-CtQRT4Db.js} +1 -1
  6. package/dist/chunks/{agent-api-core-Bx7YtsJX.js → agent-api-core-Ddnr3HgI.js} +45 -1
  7. package/dist/chunks/{config-DMO8GHVh.js → config-BL8YQ3Ak.js} +1 -1
  8. package/dist/chunks/config-store-CEM4SJvM.js +1 -0
  9. package/dist/chunks/{config-store-BZU0pwDi.js → config-store-aB3AE95Q.js} +1 -1
  10. package/dist/chunks/{main-BJFZUB8b.js → main-D6DExe_h.js} +9 -104
  11. package/dist/chunks/{pr-flows-external-BRtHbSYM.js → pack-agent-DlW4j1b6.js} +267 -170
  12. package/dist/chunks/pack-bridge-CQ2Jlear.js +153 -0
  13. package/dist/chunks/packs-cli-DCKa39sG.js +502 -0
  14. package/dist/chunks/packs-cli-DV__4MB_.js +1 -0
  15. package/dist/chunks/{pair-cli-COUf3oqu.js → pair-cli-Dud8jpuO.js} +2 -2
  16. package/dist/chunks/{pr-flows-cli-CXEWmN7B.js → pr-flows-cli-Clw5RPyH.js} +7 -16
  17. package/dist/chunks/pr-flows-external-DfN4780W.js +147 -0
  18. package/dist/chunks/{remote-config-DGikQcIX.js → remote-config-dHj-Qfux.js} +1 -1
  19. package/dist/chunks/{settings-cli-C1MpfiMd.js → settings-cli-9Z0TOaxK.js} +4 -4
  20. package/dist/chunks/{settings-readout-core-CmSf-Xx7.js → settings-readout-core-c06UYQ-8.js} +1 -1
  21. package/dist/chunks/{ssh-sign-cli-CzTz9BiL.js → ssh-sign-cli-CtLGtrUf.js} +1 -1
  22. package/dist/client/assets/{action-status-DP6ioCmx.js → action-status-Bbo7Fyia.js} +1 -1
  23. package/dist/client/assets/action-status-Bbo7Fyia.js.br +0 -0
  24. package/dist/client/assets/{arena-panel-Bq_N5X1d.js → arena-panel-DjLi_oT2.js} +2 -2
  25. package/dist/client/assets/arena-panel-DjLi_oT2.js.br +0 -0
  26. package/dist/client/assets/{benchmark-panel-ryHZdeXk.js → benchmark-panel-BGIM23C6.js} +1 -1
  27. package/dist/client/assets/benchmark-panel-BGIM23C6.js.br +0 -0
  28. package/dist/client/assets/{boards-view-gTzMZiol.js → boards-view-DVlW49Sr.js} +1 -1
  29. package/dist/client/assets/boards-view-DVlW49Sr.js.br +0 -0
  30. package/dist/client/assets/button-CeEmJCQe.js +1 -0
  31. package/dist/client/assets/button-CeEmJCQe.js.br +0 -0
  32. package/dist/client/assets/{card-actions-zCz9tHtX.js → card-actions-D5VASOyl.js} +1 -1
  33. package/dist/client/assets/{card-registry-BDFzrxQP.js → card-registry-CxPu9XGn.js} +1 -1
  34. package/dist/client/assets/card-registry-CxPu9XGn.js.br +0 -0
  35. package/dist/client/assets/{community-panel-BO1QiePf.js → community-panel-BTKm5Lhg.js} +1 -1
  36. package/dist/client/assets/community-panel-BTKm5Lhg.js.br +0 -0
  37. package/dist/client/assets/{control-ws-UoNejDTB.js → control-ws-DxQoY1aG.js} +1 -1
  38. package/dist/client/assets/control-ws-DxQoY1aG.js.br +0 -0
  39. package/dist/client/assets/{dialogs-dHL1tDYy.js → dialogs-B2pJJnBE.js} +1 -1
  40. package/dist/client/assets/dialogs-B2pJJnBE.js.br +0 -0
  41. package/dist/client/assets/{doc-editor-ui-chyeOfet.js → doc-editor-ui-Bbxos6dN.js} +1 -1
  42. package/dist/client/assets/doc-editor-ui-Bbxos6dN.js.br +0 -0
  43. package/dist/client/assets/{feature-hint-DPfwv8Qe.js → feature-hint-DQt3iscN.js} +1 -1
  44. package/dist/client/assets/feature-hint-DQt3iscN.js.br +0 -0
  45. package/dist/client/assets/{first-run-checklist-w-110hem.js → first-run-checklist-BTtzaAxJ.js} +1 -1
  46. package/dist/client/assets/first-run-checklist-BTtzaAxJ.js.br +0 -0
  47. package/dist/client/assets/{hooks-panel-DuVgf_lN.js → hooks-panel-ezwWnzzh.js} +1 -1
  48. package/dist/client/assets/hooks-panel-ezwWnzzh.js.br +0 -0
  49. package/dist/client/assets/index-MrcTP834.js +75 -0
  50. package/dist/client/assets/index-MrcTP834.js.br +0 -0
  51. package/dist/client/assets/{issues-panel-qlnHYLBW.js → issues-panel-tctX4Q02.js} +1 -1
  52. package/dist/client/assets/issues-panel-tctX4Q02.js.br +0 -0
  53. package/dist/client/assets/{lane-read-token-step-oXeNfMHE.js → lane-read-token-step-DkaiOW-4.js} +1 -1
  54. package/dist/client/assets/lane-read-token-step-DkaiOW-4.js.br +0 -0
  55. package/dist/client/assets/{menu-ER74fqs1.js → menu-ByAf-D4t.js} +1 -1
  56. package/dist/client/assets/menu-ByAf-D4t.js.br +0 -0
  57. package/dist/client/assets/{modal-T0t68alc.js → modal-Cccq9QKp.js} +1 -1
  58. package/dist/client/assets/modal-Cccq9QKp.js.br +0 -0
  59. package/dist/client/assets/{my-prs-panel-DghSKpbk.js → my-prs-panel-DoxJN1p6.js} +1 -1
  60. package/dist/client/assets/my-prs-panel-DoxJN1p6.js.br +0 -0
  61. package/dist/client/assets/{nyan-cat-trmJWrVl.js → nyan-cat-DYqFVEIO.js} +1 -1
  62. package/dist/client/assets/nyan-cat-DYqFVEIO.js.br +0 -0
  63. package/dist/client/assets/{phone-shell-BdcE4Ih2.js → phone-shell-D2vARBmz.js} +1 -1
  64. package/dist/client/assets/phone-shell-D2vARBmz.js.br +0 -0
  65. package/dist/client/assets/{plan-face-Ctp6Q2w0.js → plan-face-3E2usY8A.js} +1 -1
  66. package/dist/client/assets/plan-face-3E2usY8A.js.br +0 -0
  67. package/dist/client/assets/{plan-render-DeOz3r6C.js → plan-render-DolHJmvM.js} +1 -1
  68. package/dist/client/assets/plan-render-DolHJmvM.js.br +0 -0
  69. package/dist/client/assets/{pr-queue-columns--vCEWzQx.js → pr-queue-columns-DrjGb4RH.js} +1 -1
  70. package/dist/client/assets/pr-queue-columns-DrjGb4RH.js.br +0 -0
  71. package/dist/client/assets/{pr-status-icon-Bt7cQdYv.js → pr-status-icon-DxYoCfBP.js} +1 -1
  72. package/dist/client/assets/pr-status-icon-DxYoCfBP.js.br +0 -0
  73. package/dist/client/assets/{radar-panel-D0wJY_nu.js → radar-panel-iLONRxIB.js} +1 -1
  74. package/dist/client/assets/radar-panel-iLONRxIB.js.br +0 -0
  75. package/dist/client/assets/{repo-roots-adder-BtWcg5vC.js → repo-roots-adder-B7o85a0g.js} +1 -1
  76. package/dist/client/assets/repo-roots-adder-B7o85a0g.js.br +0 -0
  77. package/dist/client/assets/{resume-dialog-DQDyaeEE.js → resume-dialog-Dee6nJCh.js} +1 -1
  78. package/dist/client/assets/resume-dialog-Dee6nJCh.js.br +0 -0
  79. package/dist/client/assets/{review-queue-panel-BcWmyEjv.js → review-queue-panel-smdp-hn3.js} +1 -1
  80. package/dist/client/assets/review-queue-panel-smdp-hn3.js.br +0 -0
  81. package/dist/client/assets/{session-actions-O2gdJm4Y.js → session-actions-Bup-o08b.js} +2 -2
  82. package/dist/client/assets/session-actions-Bup-o08b.js.br +0 -0
  83. package/dist/client/assets/{session-row-OLB0sL3R.js → session-row-A_MI5_sD.js} +1 -1
  84. package/dist/client/assets/session-row-A_MI5_sD.js.br +0 -0
  85. package/dist/client/assets/{session-tick-CICZHafe.js → session-tick-lPppK7OC.js} +1 -1
  86. package/dist/client/assets/session-tick-lPppK7OC.js.br +0 -0
  87. package/dist/client/assets/{settings-panel-CVhn_sVH.js → settings-panel-BnyIiop4.js} +2 -2
  88. package/dist/client/assets/settings-panel-BnyIiop4.js.br +0 -0
  89. package/dist/client/assets/{setup-step-CaBKPldA.js → setup-step-B0XzLQJc.js} +1 -1
  90. package/dist/client/assets/setup-step-B0XzLQJc.js.br +0 -0
  91. package/dist/client/assets/{shown-face-B0wjZKZT.js → shown-face-DZEzOG7B.js} +1 -1
  92. package/dist/client/assets/shown-face-DZEzOG7B.js.br +0 -0
  93. package/dist/client/assets/{trace-panel-D2XB5RxU.js → trace-panel-rD_JORVh.js} +1 -1
  94. package/dist/client/assets/trace-panel-rD_JORVh.js.br +0 -0
  95. package/dist/client/assets/{usage-panel-B1dQfY6p.js → usage-panel-B6oMuE3s.js} +1 -1
  96. package/dist/client/assets/usage-panel-B6oMuE3s.js.br +0 -0
  97. package/dist/client/assets/{your-day-tip-Brj1r-sQ.js → your-day-tip-CnENMCMS.js} +1 -1
  98. package/dist/client/assets/your-day-tip-CnENMCMS.js.br +0 -0
  99. package/dist/client/index.html +12 -12
  100. package/dist/client/index.html.br +0 -0
  101. package/dist/examples/packs/plan-usage/icon.svg +1 -0
  102. package/dist/examples/packs/plan-usage/pack.json +11 -0
  103. package/dist/examples/packs/plan-usage/panel/bridge.js +23 -0
  104. package/dist/examples/packs/plan-usage/panel/index.html +15 -0
  105. package/dist/examples/packs/plan-usage/panel/panel.css +15 -0
  106. package/dist/examples/packs/plan-usage/panel/panel.js +56 -0
  107. package/dist/schema/pack.v1.json +43 -21
  108. package/dist/server/index.js +1 -1
  109. package/package.json +1 -1
  110. package/dist/chunks/agent-api-cli-D93znXwp.js +0 -1
  111. package/dist/chunks/config-store-DT65GJMG.js +0 -1
  112. package/dist/chunks/pack-bridge-DifQHfqf.js +0 -152
  113. package/dist/client/assets/action-status-DP6ioCmx.js.br +0 -0
  114. package/dist/client/assets/arena-panel-Bq_N5X1d.js.br +0 -0
  115. package/dist/client/assets/benchmark-panel-ryHZdeXk.js.br +0 -0
  116. package/dist/client/assets/boards-view-gTzMZiol.js.br +0 -0
  117. package/dist/client/assets/button-CBoNTVJe.js +0 -1
  118. package/dist/client/assets/button-CBoNTVJe.js.br +0 -0
  119. package/dist/client/assets/card-registry-BDFzrxQP.js.br +0 -0
  120. package/dist/client/assets/community-panel-BO1QiePf.js.br +0 -0
  121. package/dist/client/assets/control-ws-UoNejDTB.js.br +0 -0
  122. package/dist/client/assets/dialogs-dHL1tDYy.js.br +0 -0
  123. package/dist/client/assets/doc-editor-ui-chyeOfet.js.br +0 -0
  124. package/dist/client/assets/feature-hint-DPfwv8Qe.js.br +0 -0
  125. package/dist/client/assets/first-run-checklist-w-110hem.js.br +0 -0
  126. package/dist/client/assets/hooks-panel-DuVgf_lN.js.br +0 -0
  127. package/dist/client/assets/index-o7oGy8XE.js +0 -75
  128. package/dist/client/assets/index-o7oGy8XE.js.br +0 -0
  129. package/dist/client/assets/issues-panel-qlnHYLBW.js.br +0 -0
  130. package/dist/client/assets/lane-read-token-step-oXeNfMHE.js.br +0 -0
  131. package/dist/client/assets/menu-ER74fqs1.js.br +0 -0
  132. package/dist/client/assets/modal-T0t68alc.js.br +0 -0
  133. package/dist/client/assets/my-prs-panel-DghSKpbk.js.br +0 -0
  134. package/dist/client/assets/nyan-cat-trmJWrVl.js.br +0 -0
  135. package/dist/client/assets/phone-shell-BdcE4Ih2.js.br +0 -0
  136. package/dist/client/assets/plan-face-Ctp6Q2w0.js.br +0 -0
  137. package/dist/client/assets/plan-render-DeOz3r6C.js.br +0 -0
  138. package/dist/client/assets/pr-queue-columns--vCEWzQx.js.br +0 -0
  139. package/dist/client/assets/pr-status-icon-Bt7cQdYv.js.br +0 -0
  140. package/dist/client/assets/radar-panel-D0wJY_nu.js.br +0 -0
  141. package/dist/client/assets/repo-roots-adder-BtWcg5vC.js.br +0 -0
  142. package/dist/client/assets/resume-dialog-DQDyaeEE.js.br +0 -0
  143. package/dist/client/assets/review-queue-panel-BcWmyEjv.js.br +0 -0
  144. package/dist/client/assets/session-actions-O2gdJm4Y.js.br +0 -0
  145. package/dist/client/assets/session-row-OLB0sL3R.js.br +0 -0
  146. package/dist/client/assets/session-tick-CICZHafe.js.br +0 -0
  147. package/dist/client/assets/settings-panel-CVhn_sVH.js.br +0 -0
  148. package/dist/client/assets/setup-step-CaBKPldA.js.br +0 -0
  149. package/dist/client/assets/shown-face-B0wjZKZT.js.br +0 -0
  150. package/dist/client/assets/trace-panel-D2XB5RxU.js.br +0 -0
  151. package/dist/client/assets/usage-panel-B1dQfY6p.js.br +0 -0
  152. package/dist/client/assets/your-day-tip-Brj1r-sQ.js.br +0 -4
@@ -1,13 +1,41 @@
1
1
  import { r as errorMessage } from "./text-DoirglWV.js";
2
- import { An as ReportedPrFlowActionOutcome, Mn as prFlowRulesJsonSchema, Sn as PrFlowRule, Tn as PrFlowsSettings, hn as PrFlowCommand, wn as PrFlowSourceOutput, xn as PrFlowPrAction, yn as PrFlowPackRequires } from "./session-BrX33men.js";
3
- import { c as runCommandSafely } from "./child-process-safe-BIh8yQ0I.js";
4
- import { r as ThemePalette, t as PackBridgeTopic } from "./pack-bridge-DifQHfqf.js";
2
+ import { Mn as prFlowRulesJsonSchema, Sn as PrFlowRule, Tn as PrFlowsSettings, hn as PrFlowCommand, xn as PrFlowPrAction, yn as PrFlowPackRequires } from "./session-BrX33men.js";
3
+ import { i as ThemePalette, n as packBridgeJsonSchemaText, t as PackBridgeTopic } from "./pack-bridge-CQ2Jlear.js";
5
4
  import { t as parseJsonOrNull } from "./json-core-If8h-Qgy.js";
6
5
  import { n as withoutGlimmervoidSecrets } from "./spawn-env-C9TqrBFa.js";
7
6
  import fs from "node:fs";
8
7
  import path from "node:path";
9
8
  import { z } from "zod";
10
9
  import crypto from "node:crypto";
10
+ //#region server/core/host-policy.ts
11
+ var LOOPBACK_HOST_RE = /^(?:localhost|127(?:\.\d{1,3}){3}|\[::1\]|\[::ffff:127(?:\.\d{1,3}){3}\])$/;
12
+ function hostOnly(value) {
13
+ const trimmed = String(value == null ? "" : value).trim().toLowerCase();
14
+ if (trimmed === "") return "";
15
+ if (trimmed.startsWith("[")) {
16
+ const close = trimmed.indexOf("]");
17
+ if (close === -1) return "";
18
+ return trimmed.slice(0, close + 1);
19
+ }
20
+ const colon = trimmed.lastIndexOf(":");
21
+ if (colon === -1) return trimmed;
22
+ return trimmed.slice(0, colon);
23
+ }
24
+ function hostMatches(allowed, candidate) {
25
+ if (allowed === "") return false;
26
+ if (allowed === candidate) return true;
27
+ if (!allowed.startsWith("*.")) return false;
28
+ const suffix = allowed.slice(1);
29
+ return candidate.endsWith(suffix) && candidate.length > suffix.length;
30
+ }
31
+ function decideHostAllowed(hostHeader, allowedHosts = []) {
32
+ if (hostHeader == null || hostHeader === "") return true;
33
+ const host = hostOnly(hostHeader);
34
+ if (host === "") return false;
35
+ if (LOOPBACK_HOST_RE.test(host)) return true;
36
+ return (Array.isArray(allowedHosts) ? allowedHosts : [allowedHosts]).some((entry) => hostMatches(hostOnly(entry), host));
37
+ }
38
+ //#endregion
11
39
  //#region server/github/core/pr-flows-core.ts
12
40
  var MERGE_LINE_DISTANCE = 3;
13
41
  var BODY_PREFIX_CHARACTERS = 120;
@@ -686,6 +714,14 @@ var PACK_PANEL_CONTENT_POLICY = [
686
714
  function packFileMime(filePath) {
687
715
  return PACK_FILE_MIME_BY_EXTENSION[path.posix.extname(filePath).toLowerCase()] ?? "application/octet-stream";
688
716
  }
717
+ function packFileHeaders(filePath) {
718
+ return {
719
+ "Content-Security-Policy": PACK_PANEL_CONTENT_POLICY,
720
+ "X-Content-Type-Options": "nosniff",
721
+ "Referrer-Policy": "no-referrer",
722
+ "Content-Type": packFileMime(filePath)
723
+ };
724
+ }
689
725
  function uiSectionErrors(pack) {
690
726
  return pack.ui && !pack.ui.ok ? pack.ui.errors : [];
691
727
  }
@@ -738,6 +774,57 @@ function packRow(packDir, read, approvedFingerprints) {
738
774
  function pendingPackNote(row) {
739
775
  return `The pack '${row.name}' waits for your approval in Settings, Packs`;
740
776
  }
777
+ var MAX_REFERENCE_LENGTH = 512;
778
+ var HTML_REFERENCE_PATTERN = new RegExp(`\\b(src|href|poster|srcset|imagesrcset)\\s*=\\s*${`(?:"([^"]{0,${MAX_REFERENCE_LENGTH}})"|'([^']{0,${MAX_REFERENCE_LENGTH}})'|([^\\s"'>]{1,${MAX_REFERENCE_LENGTH}}))`}`, "gi");
779
+ var CSS_REFERENCE_PATTERN = new RegExp(`url\\(\\s*["']?([^"')]{0,${MAX_REFERENCE_LENGTH}})["']?\\s*\\)|@import\\s+["']([^"']{1,${MAX_REFERENCE_LENGTH}})["']`, "gi");
780
+ var INERT_REFERENCE_PATTERN = /^(?:#|data:|blob:|javascript:|about:|mailto:)/i;
781
+ var REMOTE_REFERENCE_PATTERN = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;
782
+ function withoutDelimited(text, opener, closer) {
783
+ const keptParts = [];
784
+ let cursor = 0;
785
+ while (cursor < text.length) {
786
+ const openAt = text.indexOf(opener, cursor);
787
+ if (openAt === -1) return [...keptParts, text.slice(cursor)].join("");
788
+ keptParts.push(text.slice(cursor, openAt));
789
+ const closeAt = text.indexOf(closer, openAt + opener.length);
790
+ if (closeAt === -1) return keptParts.join("");
791
+ cursor = closeAt + closer.length;
792
+ }
793
+ return keptParts.join("");
794
+ }
795
+ function attributeUrls(attributeName, value) {
796
+ if (!attributeName.toLowerCase().endsWith("srcset")) return [value];
797
+ return value.split(",").map((candidate) => candidate.trim().split(/\s+/)[0] ?? "");
798
+ }
799
+ function referencesIn(filePath, text) {
800
+ const withoutComments = withoutDelimited(withoutDelimited(text, "<!--", "-->"), "/*", "*/");
801
+ const cssReferences = [...withoutComments.matchAll(CSS_REFERENCE_PATTERN)].map((match) => match[1] ?? match[2] ?? "");
802
+ return [...filePath.endsWith(".html") ? [...withoutComments.matchAll(HTML_REFERENCE_PATTERN)].flatMap((match) => attributeUrls(match[1] ?? "", match[2] ?? match[3] ?? match[4] ?? "")) : [], ...cssReferences].map((reference) => reference.trim()).filter((reference) => reference !== "" && !INERT_REFERENCE_PATTERN.test(reference));
803
+ }
804
+ function decodedPath(reference) {
805
+ try {
806
+ return decodeURIComponent(reference);
807
+ } catch {
808
+ return reference;
809
+ }
810
+ }
811
+ function referenceError(filePath, reference, filesByPath) {
812
+ if (REMOTE_REFERENCE_PATTERN.test(reference)) return `${filePath} loads ${reference}, but a panel has no network; put that file in the pack`;
813
+ if (reference.startsWith("/")) return `${filePath} refers to ${reference}, an absolute path that leaves the pack; use a path relative to ${filePath}`;
814
+ const referencedPath = path.posix.normalize(path.posix.join(path.posix.dirname(filePath), decodedPath(reference.replace(/[?#].*$/, ""))));
815
+ if (referencedPath.startsWith("../")) return `${filePath} refers to ${reference}, which is outside the pack`;
816
+ return filesByPath.has(referencedPath) ? null : `${filePath} refers to ${reference}, which is not a file in the pack`;
817
+ }
818
+ function panelReferenceErrors(filesByPath) {
819
+ return [...filesByPath].filter(([filePath]) => filePath.endsWith(".html") || filePath.endsWith(".css")).flatMap(([filePath, bytes]) => referencesIn(filePath, bytes.toString("utf8")).map((reference) => referenceError(filePath, reference, filesByPath)).filter((error) => error !== null));
820
+ }
821
+ var SUBSCRIBED_TOPICS_PATTERN = /subscribe\(\s*\[([^\]]{0,500})\]|kind\s*:\s*['"]subscribe['"][^}]{0,500}?topics\s*:\s*\[([^\]]{0,500})\]/g;
822
+ function undeclaredSubscriptionErrors(filesByPath, declaredReads) {
823
+ return [...filesByPath].filter(([filePath]) => filePath.endsWith(".js") || filePath.endsWith(".html")).flatMap(([filePath, bytes]) => {
824
+ const subscribedTopics = [...bytes.toString("utf8").matchAll(SUBSCRIBED_TOPICS_PATTERN)].flatMap((match) => [...(match[1] ?? match[2] ?? "").matchAll(/['"]([^'"]+)['"]/g)].map((topic) => topic[1] ?? ""));
825
+ return [...new Set(subscribedTopics)].filter((topic) => !declaredReads.has(topic)).map((topic) => `${filePath} subscribes to '${topic}', which no panel lists under reads, so it never arrives; add it to reads or drop it`);
826
+ });
827
+ }
741
828
  //#endregion
742
829
  //#region shared/contracts/pack.ts
743
830
  var PACK_SCHEMA_URL = "https://glimmervoid.dev/schema/pack.v1.json";
@@ -745,8 +832,8 @@ var PACK_FILE_NAME = "pack.json";
745
832
  var PackName = z.string().regex(/^[a-z0-9][a-z0-9-]{0,39}$/, { error: "a pack name is lowercase letters, digits and dashes, at most 40 characters" });
746
833
  var PackHeader = z.strictObject({
747
834
  $schema: z.string().optional(),
748
- name: PackName,
749
- version: z.number().int().positive(),
835
+ name: PackName.describe("Unique among installed packs; a second pack with the same name is refused. Theme and panel ids are scoped to it, so they never clash with another pack"),
836
+ version: z.number().int().positive().describe("Your release number, shown to the operator beside the pack; raise it with each change. Approval follows the files, not this number: any changed file asks again"),
750
837
  description: z.string().max(500).optional(),
751
838
  requires: PrFlowPackRequires.default({
752
839
  env: [],
@@ -786,9 +873,9 @@ var PackFilePath = z.string().regex(/^(?!\/)(?!.*(?:^|\/)\.\.?(?:\/|$))[A-Za-z0-
786
873
  var PackPanel = z.strictObject({
787
874
  id: PackItemId,
788
875
  label: z.string().trim().min(1).max(24),
789
- entry: PackFilePath.refine((filePath) => filePath.endsWith(".html"), { error: "a panel entry is an .html file" }),
876
+ entry: PackFilePath.refine((filePath) => filePath.endsWith(".html"), { error: "a panel entry is an .html file" }).describe("The HTML page the panel opens, relative to the pack folder"),
790
877
  icon: PackFilePath.refine((filePath) => filePath.endsWith(".svg"), { error: "a panel icon is an .svg file" }).optional(),
791
- reads: z.array(PackBridgeTopic).default([])
878
+ reads: z.array(PackBridgeTopic).default([]).describe("The bridge topics this panel may receive; the operator sees them before approving, and a subscribe for any other topic is ignored")
792
879
  });
793
880
  var PackUi = z.strictObject({
794
881
  themes: z.array(ThemePalette.extend({ id: PackItemId })).max(8).default([]),
@@ -830,29 +917,35 @@ var PACKS_STATE_FILE_NAME = "packs-state.json";
830
917
  function packsStatePath(homeDir) {
831
918
  return path.join(homeDir, PACKS_STATE_FILE_NAME);
832
919
  }
920
+ function readApprovedPackFingerprints(homeDir) {
921
+ const statePath = packsStatePath(homeDir);
922
+ if (!fs.existsSync(statePath)) return /* @__PURE__ */ new Set();
923
+ return new Set(PacksState.safeParse(parseJsonOrNull(fs.readFileSync(statePath, "utf8"))).data?.approvedFingerprints ?? []);
924
+ }
833
925
  function sha256(bytes) {
834
926
  return crypto.createHash("sha256").update(bytes).digest("hex");
835
927
  }
836
928
  async function readPackFiles(packDir) {
837
929
  const filesByPath = /* @__PURE__ */ new Map();
930
+ const errors = [];
838
931
  const pendingDirs = [""];
839
932
  let totalBytes = 0;
840
933
  while (pendingDirs.length > 0) {
841
934
  const relativeDir = pendingDirs.pop() ?? "";
842
935
  for (const entry of await fs.promises.readdir(path.join(packDir, relativeDir), { withFileTypes: true })) {
843
936
  const relativePath = path.posix.join(relativeDir, entry.name);
844
- if (entry.isSymbolicLink()) return {
845
- ok: false,
846
- error: `${relativePath} is a symlink, and a pack holds only its own files`
847
- };
937
+ if (entry.isSymbolicLink()) {
938
+ errors.push(`${relativePath} is a symlink, and a pack holds only its own files`);
939
+ continue;
940
+ }
848
941
  if (entry.isDirectory()) {
849
942
  pendingDirs.push(relativePath);
850
943
  continue;
851
944
  }
852
- if (!entry.isFile()) return {
853
- ok: false,
854
- error: `${relativePath} is not a regular file`
855
- };
945
+ if (!entry.isFile()) {
946
+ errors.push(`${relativePath} is not a regular file`);
947
+ continue;
948
+ }
856
949
  totalBytes += (await fs.promises.lstat(path.join(packDir, relativePath))).size;
857
950
  if (totalBytes > PACK_MAX_TOTAL_BYTES) return {
858
951
  ok: false,
@@ -863,7 +956,8 @@ async function readPackFiles(packDir) {
863
956
  }
864
957
  return {
865
958
  ok: true,
866
- filesByPath
959
+ filesByPath,
960
+ errors
867
961
  };
868
962
  }
869
963
  function packFingerprint(filesByPath) {
@@ -883,14 +977,54 @@ async function missingRequires(requires, env) {
883
977
  for (const program of requires.programs) if (!await isProgramOnPath(program, env)) missingPrograms.push(`program ${program}`);
884
978
  return [...requires.env.filter((name) => !commandEnv[name]).map((name) => `env ${name}`), ...missingPrograms];
885
979
  }
886
- function withPanelFilesPresent(ui, filesByPath) {
887
- if (!ui?.ok) return ui;
888
- const missing = ui.value.panels.flatMap((panel, index) => [panel.entry, ...panel.icon ? [panel.icon] : []].filter((filePath) => !filesByPath.has(filePath)).map((filePath) => `${PACK_FILE_NAME} ui.panels.${index}: ${filePath} is not a file in the pack`));
980
+ function missingPanelFiles(panel, index, filesByPath) {
981
+ return [panel.entry, ...panel.icon ? [panel.icon] : []].filter((filePath) => !filesByPath.has(filePath)).map((filePath) => `${PACK_FILE_NAME} ui.panels.${index}: ${filePath} is not a file in the pack`);
982
+ }
983
+ function rawPanels(rawUi) {
984
+ if (rawUi === null || typeof rawUi !== "object" || !("panels" in rawUi) || !Array.isArray(rawUi.panels)) return [];
985
+ return rawUi.panels;
986
+ }
987
+ function declaredPanelReads(rawUi) {
988
+ const panels = validRawPanels(rawUi);
989
+ return panels.length === rawPanels(rawUi).length ? new Set(panels.flatMap(({ panel }) => panel.reads)) : null;
990
+ }
991
+ function validRawPanels(rawUi) {
992
+ return rawPanels(rawUi).flatMap((rawPanel, index) => {
993
+ const panel = PackPanel.safeParse(rawPanel);
994
+ return panel.success ? [{
995
+ index,
996
+ panel: panel.data
997
+ }] : [];
998
+ });
999
+ }
1000
+ function withPanelFilesPresent(ui, rawUi, filesByPath) {
1001
+ if (ui === null) return null;
1002
+ const missing = validRawPanels(rawUi).flatMap(({ index, panel }) => missingPanelFiles(panel, index, filesByPath));
1003
+ if (!ui.ok) return {
1004
+ ok: false,
1005
+ errors: [...ui.errors, ...missing]
1006
+ };
889
1007
  return missing.length === 0 ? ui : {
890
1008
  ok: false,
891
1009
  errors: missing
892
1010
  };
893
1011
  }
1012
+ function manifestJson(manifest) {
1013
+ try {
1014
+ return {
1015
+ ok: true,
1016
+ value: JSON.parse(manifest.toString("utf8"))
1017
+ };
1018
+ } catch (error) {
1019
+ return {
1020
+ ok: false,
1021
+ error: `${PACK_FILE_NAME} is not valid JSON: ${errorMessage(error)}`
1022
+ };
1023
+ }
1024
+ }
1025
+ function sectionErrors(section) {
1026
+ return section && !section.ok ? section.errors : [];
1027
+ }
894
1028
  function issueLines(error, sectionLabel) {
895
1029
  return error.issues.map((issue) => `${[sectionLabel, ...issue.path.map(String)].join(".")}: ${issue.message}`);
896
1030
  }
@@ -922,14 +1056,35 @@ async function readPackDirUnguarded(packDir, env) {
922
1056
  errors: [read.error]
923
1057
  };
924
1058
  const manifest = read.filesByPath.get(PACK_FILE_NAME);
1059
+ const { filesByPath } = read;
925
1060
  if (!manifest) return {
926
1061
  ok: false,
927
- errors: [`there is no ${PACK_FILE_NAME}`]
1062
+ errors: [...read.errors, `there is no ${PACK_FILE_NAME}`],
1063
+ filesByPath
928
1064
  };
929
- const header = PackHeader.safeParse(parseJsonOrNull(manifest.toString("utf8")));
1065
+ const manifestValue = manifestJson(manifest);
1066
+ if (!manifestValue.ok) return {
1067
+ ok: false,
1068
+ errors: [...read.errors, manifestValue.error],
1069
+ filesByPath
1070
+ };
1071
+ const header = PackHeader.safeParse(manifestValue.value);
930
1072
  if (!header.success) return {
931
1073
  ok: false,
932
- errors: header.error.issues.map((issue) => `${PACK_FILE_NAME} ${issue.path.join(".") || "(root)"}: ${issue.message}`)
1074
+ errors: [...read.errors, ...header.error.issues.map((issue) => `${PACK_FILE_NAME} ${issue.path.join(".") || "(root)"}: ${issue.message}`)],
1075
+ filesByPath
1076
+ };
1077
+ const prFlows = parseSection(PackPrFlows, header.data.prFlows, "prFlows");
1078
+ const ui = withPanelFilesPresent(parseSection(PackUi, header.data.ui, "ui"), header.data.ui, read.filesByPath);
1079
+ if (read.errors.length > 0) return {
1080
+ ok: false,
1081
+ errors: [
1082
+ ...read.errors,
1083
+ ...sectionErrors(prFlows),
1084
+ ...sectionErrors(ui)
1085
+ ],
1086
+ filesByPath,
1087
+ header: header.data
933
1088
  };
934
1089
  return {
935
1090
  ok: true,
@@ -938,8 +1093,8 @@ async function readPackDirUnguarded(packDir, env) {
938
1093
  header: header.data,
939
1094
  fingerprint: packFingerprint(read.filesByPath),
940
1095
  filesByPath: read.filesByPath,
941
- prFlows: parseSection(PackPrFlows, header.data.prFlows, "prFlows"),
942
- ui: withPanelFilesPresent(parseSection(PackUi, header.data.ui, "ui"), read.filesByPath),
1096
+ prFlows,
1097
+ ui,
943
1098
  missingRequires: await missingRequires(header.data.requires, env)
944
1099
  }
945
1100
  };
@@ -1003,19 +1158,26 @@ var PR_FLOW_PLACEHOLDERS_BY_KIND = {
1003
1158
  "baseRef"
1004
1159
  ]
1005
1160
  };
1161
+ function pageErrors(filesByPath, header) {
1162
+ const declaredReads = header ? declaredPanelReads(header.ui) : null;
1163
+ return [...panelReferenceErrors(filesByPath), ...declaredReads ? undeclaredSubscriptionErrors(filesByPath, declaredReads) : []];
1164
+ }
1006
1165
  async function checkPack(packDir, env, isApprovedFingerprint) {
1007
1166
  const read = await readPackDir(packDir, env);
1008
- if (!read.ok) return {
1009
- packDir: path.resolve(packDir),
1010
- name: null,
1011
- isApproved: false,
1012
- errors: read.errors,
1013
- missingRequires: [],
1014
- entries: [],
1015
- rules: [],
1016
- panels: [],
1017
- themes: []
1018
- };
1167
+ if (!read.ok) {
1168
+ const name = read.header ? `${read.header.name} v${read.header.version}` : null;
1169
+ return {
1170
+ packDir: path.resolve(packDir),
1171
+ name,
1172
+ isApproved: false,
1173
+ errors: [...read.errors, ...pageErrors(read.filesByPath ?? /* @__PURE__ */ new Map(), read.header)],
1174
+ missingRequires: [],
1175
+ entries: [],
1176
+ rules: [],
1177
+ panels: [],
1178
+ themes: []
1179
+ };
1180
+ }
1019
1181
  const { pack } = read;
1020
1182
  const { prFlowsPacks, warnings: prFlowsErrors } = prFlowsPacksOf([pack]);
1021
1183
  const ui = pack.ui?.ok ? pack.ui.value : {
@@ -1026,7 +1188,11 @@ async function checkPack(packDir, env, isApprovedFingerprint) {
1026
1188
  packDir: pack.dir,
1027
1189
  name: `${pack.header.name} v${pack.header.version}`,
1028
1190
  isApproved: isApprovedFingerprint(pack.fingerprint),
1029
- errors: [...prFlowsErrors, ...uiSectionErrors(pack)],
1191
+ errors: [
1192
+ ...prFlowsErrors,
1193
+ ...uiSectionErrors(pack),
1194
+ ...pageErrors(pack.filesByPath, pack.header)
1195
+ ],
1030
1196
  missingRequires: pack.missingRequires,
1031
1197
  entries: [],
1032
1198
  rules: [],
@@ -1059,9 +1225,14 @@ async function checkPack(packDir, env, isApprovedFingerprint) {
1059
1225
  function packCheckHasProblem(report) {
1060
1226
  return report.errors.length > 0 || report.missingRequires.length > 0 || report.entries.some((entry) => entry.error !== null);
1061
1227
  }
1228
+ function reportHeading(report) {
1229
+ const checked = report.name === null ? `Checked the pack at ${report.packDir}` : `Checked pack ${report.name} at ${report.packDir}`;
1230
+ if (packCheckHasProblem(report)) return `${checked}: fix the problems below, then check it again`;
1231
+ return `${checked}: no problems; ${report.isApproved ? "it is approved" : "once installed, it waits for the operator to approve it in Settings, Packs"}`;
1232
+ }
1062
1233
  function packReportText(report) {
1063
1234
  return [
1064
- report.name === null ? `Checked the pack at ${report.packDir}` : `Checked pack ${report.name} at ${report.packDir}, ${report.isApproved ? "approved" : "waits for approval in Settings, Packs"}`,
1235
+ reportHeading(report),
1065
1236
  ...report.panels.map((panel) => `panel ${panel}`),
1066
1237
  ...report.themes.map((theme) => `theme ${theme}`),
1067
1238
  ...report.entries.map((entry) => `${entry.kind} ${entry.id} (${entry.label}): ${entry.error === null ? `valid\n would run ${JSON.stringify(entry.argv)}` : `invalid, ${entry.error}`}`),
@@ -1071,145 +1242,71 @@ function packReportText(report) {
1071
1242
  ].join("\n");
1072
1243
  }
1073
1244
  //#endregion
1074
- //#region server/github/pr-flows-external.ts
1075
- var OUTPUT_MAX_BYTES = 1048576;
1076
- var ACTION_OUTPUT_MAX_BYTES = 67108864;
1077
- var ERROR_MAX_CHARACTERS = 200;
1078
- var UNBOUNDED_PR_FIELDS = /* @__PURE__ */ new Set(["threads", "reviewItems"]);
1079
- function boundedPrJson(pr) {
1080
- return JSON.stringify(Object.fromEntries(Object.entries(pr).filter(([field]) => !UNBOUNDED_PR_FIELDS.has(field))));
1081
- }
1082
- var CONTROL_CHARACTERS = /[\u0000-\u001f\u007f-\u009f]+/g;
1083
- function firstCharacters(text) {
1084
- return [...text.replace(CONTROL_CHARACTERS, " ").trim()].slice(0, ERROR_MAX_CHARACTERS).join("");
1085
- }
1086
- function reportedActionOutcome(stdout) {
1087
- const lastLine = stdout.trim().split("\n").at(-1) ?? "";
1088
- const reported = ReportedPrFlowActionOutcome.safeParse(parseJsonOrNull(stdout)).data ?? ReportedPrFlowActionOutcome.safeParse(parseJsonOrNull(lastLine)).data;
1089
- if (!reported) return null;
1090
- return {
1091
- outcome: reported.outcome,
1092
- message: firstCharacters(reported.message ?? "")
1093
- };
1245
+ //#region server/packs/pack-agent.ts
1246
+ async function exampleLines(examplePacksDir) {
1247
+ const entries = await fs.promises.readdir(examplePacksDir, { withFileTypes: true }).catch(() => []);
1248
+ const lines = await Promise.all(entries.filter((entry) => entry.isDirectory()).map(async (entry) => {
1249
+ const manifestText = await fs.promises.readFile(path.join(examplePacksDir, entry.name, PACK_FILE_NAME), "utf8").catch(() => "");
1250
+ const header = PackHeader.safeParse(parseJsonOrNull(manifestText));
1251
+ return `- ${path.join(examplePacksDir, entry.name)}${header.success && header.data.description ? `: ${header.data.description}` : ""}`;
1252
+ }));
1253
+ return lines.length === 0 ? ["(this install ships no example packs)"] : lines.sort();
1094
1254
  }
1095
- function unknownPlaceholderError(name, knownNames) {
1096
- return firstCharacters(`The command names {${name}}, which is not a placeholder; use ${knownNames}.`);
1255
+ async function packGuideText({ homeDir, examplePacksDir }, schemaLines) {
1256
+ return [
1257
+ "Glimmervoid packs",
1258
+ "",
1259
+ `A pack is a folder holding a ${PACK_FILE_NAME} and the files it names, at most 1 MiB in all and without symlinks. Install one by placing its folder under ${path.join(homeDir, PACKS_DIR_NAME)}, or by listing its path under "packs" in Glimmervoid's config.json.`,
1260
+ "Nothing in a pack runs or shows until the operator approves it in Settings, Packs, and any change to any file in it asks again. Never approve a pack for the operator; check it, then tell them it waits for approval.",
1261
+ "",
1262
+ "Sections of pack.json, each checked on its own:",
1263
+ "- prFlows: commands My PRs runs on pull requests (prActions, sources, actions, rules).",
1264
+ "- ui.themes: color themes for the Theme picker; every chrome and state color is a #rrggbb hex.",
1265
+ "- ui.panels: HTML pages shown as dashboard tabs. A panel runs sandboxed in an opaque origin: no network, no cookies, no storage, no popups or navigation (a link in a panel opens nothing), no access to the dashboard page. Put every script, style, image and font in the pack; inline <script> and <style> work too. Every panel file is served with this Content-Security-Policy:",
1266
+ ` ${PACK_PANEL_CONTENT_POLICY}`,
1267
+ "",
1268
+ "Panel bridge: list the topics a panel needs under its reads in pack.json; the operator sees them before approving. The panel posts {\"v\":1,\"kind\":\"subscribe\",\"topics\":[...]} to window.parent and gets {\"v\":1,\"kind\":\"hello\",\"granted\":[...]}: the subscribed topics that are also in reads, so a topic left out of reads never arrives. Then a {\"v\":1,\"kind\":\"topic\",\"topic\":...,\"data\":...} message comes for each granted topic, right away and again whenever it changes. Accept messages only when event.source === window.parent. The descriptions in the bridge JSON Schema below give each field's units and meaning.",
1269
+ "Each example panel ships the same bridge.js; copy it beside your panel and load it before your own script. It defines window.glimmervoid.subscribe(topics, onTopic) (it calls onTopic(\"hello\", granted) once, then onTopic(topic, data) per topic message), applyTheme(themeData) (pass it the theme topic data; it sets every color as a CSS custom property on the root, such as var(--bg) or var(--state-running)) and element(tag, className, text).",
1270
+ "",
1271
+ "Examples to copy and adapt:",
1272
+ ...await exampleLines(examplePacksDir),
1273
+ "",
1274
+ "Workflow: write the pack in any folder, run glimmervoid packs check <folder> (exits 1 and lists every problem, including files a page loads that are missing or remote), then glimmervoid packs preview <folder> to open its panels in a browser with sample data and its themes, without installing or approving anything. Then install it and tell the operator it waits for approval. The packs tool with action check runs the same check.",
1275
+ "",
1276
+ ...schemaLines
1277
+ ].join("\n");
1097
1278
  }
1098
- function createPrFlowsExternal({ homeDir, baseEnv = () => process.env, runCommand = runCommandSafely }) {
1099
- function placeholderValues(pr) {
1100
- return {
1101
- prUrl: pr.url,
1102
- repo: pr.repo,
1103
- number: String(pr.number),
1104
- head: pr.headRefOid
1105
- };
1106
- }
1107
- function commandEnv(pr) {
1108
- return {
1109
- ...withoutGlimmervoidSecrets(baseEnv()),
1110
- GLIMMERVOID_PR_URL: pr.url,
1111
- GLIMMERVOID_PR_REPO: pr.repo,
1112
- GLIMMERVOID_PR_NUMBER: String(pr.number),
1113
- GLIMMERVOID_PR_HEAD: pr.headRefOid
1114
- };
1115
- }
1116
- async function runSource(source, pr) {
1117
- const expanded = expandPlaceholders(source.command, placeholderValues(pr));
1118
- if (!expanded.ok) return {
1119
- ok: false,
1120
- error: unknownPlaceholderError(expanded.unknown, "{prUrl}, {repo}, {number} or {head}")
1121
- };
1122
- const [program, ...args] = expanded.argv;
1123
- if (program === void 0) return {
1124
- ok: false,
1125
- error: "The command is empty."
1126
- };
1127
- const run = await runCommand(program, args, {
1128
- cwd: homeDir,
1129
- env: commandEnv(pr),
1130
- timeoutMs: source.timeoutSeconds * 1e3,
1131
- maxBufferBytes: OUTPUT_MAX_BYTES
1132
- });
1133
- if (!run.ok) return {
1134
- ok: false,
1135
- error: `The command failed: ${firstCharacters(run.stderr) || "no error output"}`
1136
- };
1137
- const output = PrFlowSourceOutput.safeParse(parseJsonOrNull(run.stdout));
1138
- if (!output.success) return {
1139
- ok: false,
1140
- error: `The command printed no valid findings JSON: ${output.error.issues[0]?.message ?? "unreadable output"}`
1141
- };
1142
- return {
1143
- ok: true,
1144
- output: output.data
1145
- };
1146
- }
1147
- function itemInvocation(pr, item) {
1148
- return {
1149
- values: {
1150
- ...placeholderValues(pr),
1151
- itemPath: item.path,
1152
- itemLine: item.lineStart === null ? "" : String(item.lineStart)
1153
- },
1154
- knownNames: "{prUrl}, {repo}, {number}, {head}, {itemPath} or {itemLine}",
1155
- env: {
1156
- ...commandEnv(pr),
1157
- GLIMMERVOID_ITEM_JSON: JSON.stringify(item)
1158
- }
1159
- };
1160
- }
1161
- function prInvocation(pr, extraEnv) {
1162
- return {
1163
- values: prActionPlaceholderValues(pr),
1164
- knownNames: "{prUrl}, {repo}, {number}, {head}, {headRef} or {baseRef}",
1165
- env: {
1166
- ...commandEnv(pr),
1167
- GLIMMERVOID_PR_HEAD_REF: pr.headRefName,
1168
- GLIMMERVOID_PR_BASE_REF: pr.baseRefName,
1169
- GLIMMERVOID_PR_JSON: boundedPrJson(pr),
1170
- ...extraEnv
1171
- }
1172
- };
1173
- }
1174
- async function runAction(action, pr, item, extraEnv = {}) {
1175
- const { values, knownNames, env } = item === void 0 ? prInvocation(pr, extraEnv) : itemInvocation(pr, item);
1176
- const expanded = expandPlaceholders(action.command, values);
1177
- if (!expanded.ok) return {
1178
- outcome: "failed",
1179
- message: unknownPlaceholderError(expanded.unknown, knownNames)
1180
- };
1181
- const [program, ...args] = expanded.argv;
1182
- if (program === void 0) return {
1183
- outcome: "failed",
1184
- message: "The command is empty."
1185
- };
1186
- const timeoutMs = action.timeoutSeconds * 1e3;
1187
- const startedAtMs = performance.now();
1188
- const run = await runCommand(program, args, {
1189
- cwd: homeDir,
1190
- env,
1191
- timeoutMs,
1192
- maxBufferBytes: ACTION_OUTPUT_MAX_BYTES
1193
- });
1194
- const reported = reportedActionOutcome(run.stdout);
1195
- if (reported) return reported;
1196
- if (run.ok) return {
1197
- outcome: "done",
1198
- message: ""
1199
- };
1200
- if (performance.now() - startedAtMs >= timeoutMs) return {
1201
- outcome: "failed",
1202
- message: `timed out after ${action.timeoutSeconds}s`
1203
- };
1279
+ function rowLines(row) {
1280
+ return [
1281
+ `${row.name}${row.version === null ? "" : ` v${row.version}`}: ${row.state} at ${row.dir}`,
1282
+ ...row.panels.map((panel) => ` panel ${panel.id} (${panel.label})${panel.reads.length === 0 ? "" : `, reads ${panel.reads.join(", ")}`}`),
1283
+ ...row.themes.map((theme) => ` theme ${theme.id} (${theme.label}, ${theme.mode})`),
1284
+ ...row.missingRequires.map((missing) => ` missing on this machine: ${missing}`),
1285
+ ...row.errors.map((error) => ` error: ${error}`)
1286
+ ];
1287
+ }
1288
+ async function readPacksForAgent(request, deps) {
1289
+ if (request.command === "guide") return {
1290
+ text: await packGuideText(deps, [
1291
+ `${PACK_FILE_NAME} JSON Schema:`,
1292
+ packJsonSchemaText(),
1293
+ "Panel bridge messages JSON Schema:",
1294
+ packBridgeJsonSchemaText()
1295
+ ]),
1296
+ hasProblem: false
1297
+ };
1298
+ if (request.command === "list") {
1299
+ const rows = deps.packRows();
1204
1300
  return {
1205
- outcome: "failed",
1206
- message: firstCharacters(run.stderr) || "The command failed with no error output."
1301
+ text: rows.length === 0 ? `No packs are installed; ${path.join(deps.homeDir, PACKS_DIR_NAME)} holds none and config.json lists none.` : rows.flatMap(rowLines).join("\n"),
1302
+ hasProblem: rows.some((row) => row.errors.length > 0)
1207
1303
  };
1208
1304
  }
1305
+ const report = await checkPack(request.path ?? "", deps.env, deps.isApproved);
1209
1306
  return {
1210
- runSource,
1211
- runAction
1307
+ text: packReportText(report),
1308
+ hasProblem: packCheckHasProblem(report)
1212
1309
  };
1213
1310
  }
1214
1311
  //#endregion
1215
- export { prActionRunAfterExit as A, unknownActionWarnings as B, expandPlaceholders as C, mergeItems as D, itemLocation as E, savedRuleFor as F, withPrActionRun as G, withHandled as H, shouldTellBranchMoved as I, withReopened as K, sourceCandidates as L, prFlowCommands as M, prFlowRules as N, packPathsOf as O, prFlowSetup as P, teammateThreadItems as R, commandFingerprint as S, flaggingReviewers as T, withInterruptedRuns as U, visibleRun as V, withOnlyOpenPrs as W, packFileMime as _, packReportText as a, acceptReport as b, packsStatePath as c, PackHeader as d, PacksState as f, approvedPackThemes as g, approvedPackPanels as h, packCheckHasProblem as i, prActionsForRepo as j, plannedActions as k, readPackDir as l, PACK_PANEL_CONTENT_POLICY as m, PR_FLOW_PLACEHOLDERS_BY_KIND as n, PACKS_DIR_NAME as o, packJsonSchemaText as p, withRuleRun as q, checkPack as r, packDirsUnder as s, createPrFlowsExternal as t, PACK_FILE_NAME as u, packRow as v, fixLocallyPrompt as w, branchMovedNote as x, pendingPackNote as y, threadCandidates as z };
1312
+ export { prActionPlaceholderValues as A, threadCandidates as B, expandPlaceholders as C, mergeItems as D, itemLocation as E, prFlowSetup as F, withOnlyOpenPrs as G, visibleRun as H, savedRuleFor as I, withRuleRun as J, withPrActionRun as K, shouldTellBranchMoved as L, prActionsForRepo as M, prFlowCommands as N, packPathsOf as O, prFlowRules as P, sourceCandidates as R, commandFingerprint as S, flaggingReviewers as T, withHandled as U, unknownActionWarnings as V, withInterruptedRuns as W, decideHostAllowed as Y, packFileHeaders as _, packCheckHasProblem as a, acceptReport as b, packDirsUnder as c, readPackDir as d, PACK_FILE_NAME as f, approvedPackThemes as g, approvedPackPanels as h, checkPack as i, prActionRunAfterExit as j, plannedActions as k, packsStatePath as l, packJsonSchemaText as m, readPacksForAgent as n, packReportText as o, PacksState as p, withReopened as q, PR_FLOW_PLACEHOLDERS_BY_KIND as r, PACKS_DIR_NAME as s, packGuideText as t, readApprovedPackFingerprints as u, packRow as v, fixLocallyPrompt as w, branchMovedNote as x, pendingPackNote as y, teammateThreadItems as z };