@statechange/council 0.3.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (124) hide show
  1. package/assets/icon.icns +0 -0
  2. package/assets/icon.png +0 -0
  3. package/assets/logo.png +0 -0
  4. package/dist/cli.js +1 -1
  5. package/dist/cli.js.map +1 -1
  6. package/dist/commands/gui.d.ts +5 -1
  7. package/dist/commands/gui.js +3 -1
  8. package/dist/commands/gui.js.map +1 -1
  9. package/dist/commands/install.js +68 -46
  10. package/dist/commands/install.js.map +1 -1
  11. package/dist/electron/ipc-handlers.js +6 -1
  12. package/dist/electron/ipc-handlers.js.map +1 -1
  13. package/dist/electron/main.js +31 -4
  14. package/dist/electron/main.js.map +1 -1
  15. package/dist/electron/preload.js +1 -0
  16. package/dist/electron/preload.js.map +1 -1
  17. package/dist-electron/main.js +249 -223
  18. package/dist-electron/preload.mjs +1 -1
  19. package/dist-renderer/assets/{ar-SA-G6X2FPQ2-CNUtTBRd.js → ar-SA-G6X2FPQ2-DIdoFnw2.js} +1 -1
  20. package/dist-renderer/assets/{arc-BsV2XMg-.js → arc-BTotlQZy.js} +1 -1
  21. package/dist-renderer/assets/{az-AZ-76LH7QW2-BU-6SB21.js → az-AZ-76LH7QW2-vKvyE204.js} +1 -1
  22. package/dist-renderer/assets/{bg-BG-XCXSNQG7-L1xMEEzs.js → bg-BG-XCXSNQG7-CUw6XMat.js} +1 -1
  23. package/dist-renderer/assets/{blockDiagram-38ab4fdb-BHS1f8SU.js → blockDiagram-38ab4fdb-KuBxDdIg.js} +1 -1
  24. package/dist-renderer/assets/{bn-BD-2XOGV67Q-BgaYSNWB.js → bn-BD-2XOGV67Q-jAYEmCju.js} +1 -1
  25. package/dist-renderer/assets/{c4Diagram-3d4e48cf-D2Rl9Buo.js → c4Diagram-3d4e48cf-BNBdnuO2.js} +1 -1
  26. package/dist-renderer/assets/{ca-ES-6MX7JW3Y-DsFYhkLC.js → ca-ES-6MX7JW3Y-CI1kukXq.js} +1 -1
  27. package/dist-renderer/assets/channel-CYpnUKSx.js +1 -0
  28. package/dist-renderer/assets/{classDiagram-70f12bd4-BGxDdVFC.js → classDiagram-70f12bd4-CupH4cFs.js} +1 -1
  29. package/dist-renderer/assets/{classDiagram-v2-f2320105-BuoUwdmW.js → classDiagram-v2-f2320105-BahsG3Tc.js} +1 -1
  30. package/dist-renderer/assets/clone-DFY_WtGN.js +1 -0
  31. package/dist-renderer/assets/{createText-2e5e7dd3-BX6eAgL1.js → createText-2e5e7dd3-B3UjfUG4.js} +1 -1
  32. package/dist-renderer/assets/{cs-CZ-2BRQDIVT-CXV-i633.js → cs-CZ-2BRQDIVT-UI0wC0-v.js} +1 -1
  33. package/dist-renderer/assets/{da-DK-5WZEPLOC-DmYIifsm.js → da-DK-5WZEPLOC-CQAf8fls.js} +1 -1
  34. package/dist-renderer/assets/{de-DE-XR44H4JA-B2T52TzN.js → de-DE-XR44H4JA-CjKBhliG.js} +1 -1
  35. package/dist-renderer/assets/{edges-e0da2a9e-ChSiyO2u.js → edges-e0da2a9e-2iE4P-5f.js} +1 -1
  36. package/dist-renderer/assets/{el-GR-BZB4AONW-DlS_8ZJJ.js → el-GR-BZB4AONW-CQB6VLsx.js} +1 -1
  37. package/dist-renderer/assets/{erDiagram-9861fffd-REAc3tDU.js → erDiagram-9861fffd-BBDZcr4V.js} +1 -1
  38. package/dist-renderer/assets/{es-ES-U4NZUMDT-DL-zHXpT.js → es-ES-U4NZUMDT-DiI8d1UY.js} +1 -1
  39. package/dist-renderer/assets/{eu-ES-A7QVB2H4-Cq0Kx947.js → eu-ES-A7QVB2H4-DkxqpvcF.js} +1 -1
  40. package/dist-renderer/assets/{fa-IR-HGAKTJCU-DJqZOqAL.js → fa-IR-HGAKTJCU-D6yQ0OLT.js} +1 -1
  41. package/dist-renderer/assets/{fi-FI-Z5N7JZ37-CQiIDJrs.js → fi-FI-Z5N7JZ37-YXeS6J7A.js} +1 -1
  42. package/dist-renderer/assets/{flowDb-956e92f1-iZnRwdLd.js → flowDb-956e92f1-BUyPBg4x.js} +1 -1
  43. package/dist-renderer/assets/{flowDiagram-66a62f08-Cww5ErID.js → flowDiagram-66a62f08-DlzNPiyJ.js} +1 -1
  44. package/dist-renderer/assets/flowDiagram-v2-96b9c2cf-D9BHRMv4.js +1 -0
  45. package/dist-renderer/assets/{flowchart-elk-definition-4a651766-B3GjdX0I.js → flowchart-elk-definition-4a651766-Chzxgp5p.js} +1 -1
  46. package/dist-renderer/assets/{fr-FR-RHASNOE6-DXRyDBSp.js → fr-FR-RHASNOE6-f9mGiK-9.js} +1 -1
  47. package/dist-renderer/assets/{ganttDiagram-c361ad54-Dh5UuCf5.js → ganttDiagram-c361ad54-WJyNxrSM.js} +1 -1
  48. package/dist-renderer/assets/{gitGraphDiagram-72cf32ee-CUrdiK9f.js → gitGraphDiagram-72cf32ee-BVsVFoEf.js} +1 -1
  49. package/dist-renderer/assets/{gl-ES-HMX3MZ6V-DB2LhjQl.js → gl-ES-HMX3MZ6V-BjCm-PNJ.js} +1 -1
  50. package/dist-renderer/assets/{graph-KS9cHKTv.js → graph-CkTunRXI.js} +1 -1
  51. package/dist-renderer/assets/{he-IL-6SHJWFNN-CWdud4mG.js → he-IL-6SHJWFNN-DfYxNI2P.js} +1 -1
  52. package/dist-renderer/assets/{hi-IN-IWLTKZ5I-DkfCxaBI.js → hi-IN-IWLTKZ5I-DoZMu26E.js} +1 -1
  53. package/dist-renderer/assets/{hu-HU-A5ZG7DT2-DVX9rddx.js → hu-HU-A5ZG7DT2-DTrSQZCB.js} +1 -1
  54. package/dist-renderer/assets/{id-ID-SAP4L64H-CIosyByg.js → id-ID-SAP4L64H-C_U2ELPS.js} +1 -1
  55. package/dist-renderer/assets/{index-3862675e-CVxUAJo4.js → index-3862675e-BNtj693g.js} +1 -1
  56. package/dist-renderer/assets/index-B-vvA6a2.js +36 -0
  57. package/dist-renderer/assets/{index-B61Czmwn.js → index-CMFrvjlh.js} +4 -4
  58. package/dist-renderer/assets/index-Dfvdrrq2.css +1 -0
  59. package/dist-renderer/assets/{infoDiagram-f8f76790-CWACEGb6.js → infoDiagram-f8f76790-BgR_oHkS.js} +1 -1
  60. package/dist-renderer/assets/{it-IT-JPQ66NNP-D-TuMToN.js → it-IT-JPQ66NNP-DUHgayhE.js} +1 -1
  61. package/dist-renderer/assets/{ja-JP-DBVTYXUO-CK6puaHx.js → ja-JP-DBVTYXUO-BvvEmKLB.js} +1 -1
  62. package/dist-renderer/assets/{journeyDiagram-49397b02-DM-laNCt.js → journeyDiagram-49397b02-DMpZKzA6.js} +1 -1
  63. package/dist-renderer/assets/{kaa-6HZHGXH3-CiRWfMKd.js → kaa-6HZHGXH3-g6rUcGHV.js} +1 -1
  64. package/dist-renderer/assets/{kab-KAB-ZGHBKWFO-D4w9BQ8H.js → kab-KAB-ZGHBKWFO-7y2loFp3.js} +1 -1
  65. package/dist-renderer/assets/{kk-KZ-P5N5QNE5-RZi2AGvr.js → kk-KZ-P5N5QNE5-CrUBYCyh.js} +1 -1
  66. package/dist-renderer/assets/{km-KH-HSX4SM5Z-Dm-OPxhU.js → km-KH-HSX4SM5Z-BmTnQD1U.js} +1 -1
  67. package/dist-renderer/assets/{ko-KR-MTYHY66A-PbPGVqVz.js → ko-KR-MTYHY66A-B13GdnWI.js} +1 -1
  68. package/dist-renderer/assets/{ku-TR-6OUDTVRD-Bw0cMtYj.js → ku-TR-6OUDTVRD-BLvm9HOc.js} +1 -1
  69. package/dist-renderer/assets/{layout-zADYSvqS.js → layout-BRp1ZWud.js} +1 -1
  70. package/dist-renderer/assets/{line-DfBkzhQg.js → line-CBnb-2iQ.js} +1 -1
  71. package/dist-renderer/assets/{linear-O3lyK7Iz.js → linear-DflXVGQM.js} +1 -1
  72. package/dist-renderer/assets/{lt-LT-XHIRWOB4-06ru_RZe.js → lt-LT-XHIRWOB4-o21UyUem.js} +1 -1
  73. package/dist-renderer/assets/{lv-LV-5QDEKY6T-DsGBjFui.js → lv-LV-5QDEKY6T-Co_yvRsA.js} +1 -1
  74. package/dist-renderer/assets/{mindmap-definition-fc14e90a-Bg9UaNPK.js → mindmap-definition-fc14e90a-DpcRC-Qx.js} +1 -1
  75. package/dist-renderer/assets/{mr-IN-CRQNXWMA-C1kWOErC.js → mr-IN-CRQNXWMA-4PVnnNcU.js} +1 -1
  76. package/dist-renderer/assets/{my-MM-5M5IBNSE-C8wD2OFs.js → my-MM-5M5IBNSE-Dk5W3fXX.js} +1 -1
  77. package/dist-renderer/assets/{nb-NO-T6EIAALU-B7ac-R_W.js → nb-NO-T6EIAALU-DMkPaluQ.js} +1 -1
  78. package/dist-renderer/assets/{nl-NL-IS3SIHDZ-Up67nxB7.js → nl-NL-IS3SIHDZ-CYOTB3Eg.js} +1 -1
  79. package/dist-renderer/assets/{nn-NO-6E72VCQL-BPlkzXM9.js → nn-NO-6E72VCQL-D4OuF2An.js} +1 -1
  80. package/dist-renderer/assets/{oc-FR-POXYY2M6-TRLIkgml.js → oc-FR-POXYY2M6-Dgdddkga.js} +1 -1
  81. package/dist-renderer/assets/{pa-IN-N4M65BXN-Dl7hF9RX.js → pa-IN-N4M65BXN-DB2Y0wYm.js} +1 -1
  82. package/dist-renderer/assets/{percentages-BXMCSKIN-wBXtRqNn.js → percentages-BXMCSKIN-bsDgM1tI.js} +7 -7
  83. package/dist-renderer/assets/{pica-CGZUgvhx.js → pica-B0wN7u7a.js} +1 -1
  84. package/dist-renderer/assets/{pieDiagram-8a3498a8-ZPRkRtpu.js → pieDiagram-8a3498a8-D8QY6THh.js} +1 -1
  85. package/dist-renderer/assets/{pl-PL-T2D74RX3-DkwkT852.js → pl-PL-T2D74RX3-BvikiN3J.js} +1 -1
  86. package/dist-renderer/assets/{pt-BR-5N22H2LF-BMFWH_jN.js → pt-BR-5N22H2LF-DsWDLPF-.js} +1 -1
  87. package/dist-renderer/assets/{pt-PT-UZXXM6DQ-BPSC-yrG.js → pt-PT-UZXXM6DQ-BnTfNmgE.js} +1 -1
  88. package/dist-renderer/assets/{quadrantDiagram-120e2f19-DB1TyNBK.js → quadrantDiagram-120e2f19-CYknF173.js} +1 -1
  89. package/dist-renderer/assets/{requirementDiagram-deff3bca-DqVc_A29.js → requirementDiagram-deff3bca-DpK6qRCG.js} +1 -1
  90. package/dist-renderer/assets/{ro-RO-JPDTUUEW-CgkEXyU-.js → ro-RO-JPDTUUEW-WzwdaLQU.js} +1 -1
  91. package/dist-renderer/assets/{ru-RU-B4JR7IUQ-BJIahd0q.js → ru-RU-B4JR7IUQ-kSoy6NPm.js} +1 -1
  92. package/dist-renderer/assets/{sankeyDiagram-04a897e0-DZqGbQ0e.js → sankeyDiagram-04a897e0-qq5SY-Ue.js} +1 -1
  93. package/dist-renderer/assets/{sequenceDiagram-704730f1-D0Q04jBP.js → sequenceDiagram-704730f1-WIIr9Ug4.js} +1 -1
  94. package/dist-renderer/assets/{si-LK-N5RQ5JYF-DZ97xsfW.js → si-LK-N5RQ5JYF-AuePWwxD.js} +1 -1
  95. package/dist-renderer/assets/{sk-SK-C5VTKIMK-3O0GcaTE.js → sk-SK-C5VTKIMK-DC2HAG_f.js} +1 -1
  96. package/dist-renderer/assets/{sl-SI-NN7IZMDC-x_-Ca4Po.js → sl-SI-NN7IZMDC-BYS14Fmd.js} +1 -1
  97. package/dist-renderer/assets/{stateDiagram-587899a1-BkW3tbK-.js → stateDiagram-587899a1-BoO-tW9h.js} +1 -1
  98. package/dist-renderer/assets/{stateDiagram-v2-d93cdb3a-CZYVILLk.js → stateDiagram-v2-d93cdb3a-_GDLfMOw.js} +1 -1
  99. package/dist-renderer/assets/{styles-6aaf32cf-BQKVAqEs.js → styles-6aaf32cf-Bq02XG30.js} +1 -1
  100. package/dist-renderer/assets/{styles-9a916d00-DTjDY-zu.js → styles-9a916d00-DrDuz5OD.js} +1 -1
  101. package/dist-renderer/assets/{styles-c10674c1-CviHLZ2K.js → styles-c10674c1-BiUI5sb2.js} +1 -1
  102. package/dist-renderer/assets/{subset-shared.chunk-DIxPfZhi.js → subset-shared.chunk-B4D4aZVR.js} +1 -1
  103. package/dist-renderer/assets/{subset-worker.chunk-DDMwauN2.js → subset-worker.chunk-iv_EGnGX.js} +1 -1
  104. package/dist-renderer/assets/{sv-SE-XGPEYMSR-DmtUCQiw.js → sv-SE-XGPEYMSR-C_IQ_dRL.js} +1 -1
  105. package/dist-renderer/assets/{svgDrawCommon-08f97a94-B6bAmadW.js → svgDrawCommon-08f97a94-CGR4dkyx.js} +1 -1
  106. package/dist-renderer/assets/{ta-IN-2NMHFXQM-D7fiXwNW.js → ta-IN-2NMHFXQM-Bv6L9r0f.js} +1 -1
  107. package/dist-renderer/assets/{th-TH-HPSO5L25-D_F5D_Tj.js → th-TH-HPSO5L25-Y-RfnO5u.js} +1 -1
  108. package/dist-renderer/assets/{timeline-definition-85554ec2-BZuaxri2.js → timeline-definition-85554ec2-DNqe_2XL.js} +1 -1
  109. package/dist-renderer/assets/{tr-TR-DEFEU3FU-CzwSWbpN.js → tr-TR-DEFEU3FU-B46ZqcXK.js} +1 -1
  110. package/dist-renderer/assets/{uk-UA-QMV73CPH-BaaxaBLn.js → uk-UA-QMV73CPH-DzETOoLm.js} +1 -1
  111. package/dist-renderer/assets/{vi-VN-M7AON7JQ-BQ9szPme.js → vi-VN-M7AON7JQ-CKt3VFx4.js} +1 -1
  112. package/dist-renderer/assets/{xychartDiagram-e933f94c-7rTYP6vy.js → xychartDiagram-e933f94c-IFYih3oh.js} +1 -1
  113. package/dist-renderer/assets/{zh-CN-LNUGB5OW-DDjjE3j0.js → zh-CN-LNUGB5OW-DDBoaB0P.js} +1 -1
  114. package/dist-renderer/assets/{zh-HK-E62DVLB3-CUaw1jmU.js → zh-HK-E62DVLB3-CtYuCfrU.js} +1 -1
  115. package/dist-renderer/assets/{zh-TW-RAJ6MFWO-BFOuD9P0.js → zh-TW-RAJ6MFWO-61MRQ0N-.js} +1 -1
  116. package/dist-renderer/icon.png +0 -0
  117. package/dist-renderer/index.html +3 -3
  118. package/package.json +2 -1
  119. package/skills/council-install/SKILL.md +9 -9
  120. package/dist-renderer/assets/channel-D6rvl4sk.js +0 -1
  121. package/dist-renderer/assets/clone-ya1OS7ZU.js +0 -1
  122. package/dist-renderer/assets/flowDiagram-v2-96b9c2cf-DMQnUrJv.js +0 -1
  123. package/dist-renderer/assets/index-3RkkhxnO.js +0 -36
  124. package/dist-renderer/assets/index-BF6L2_KC.css +0 -1
@@ -1,20 +1,20 @@
1
- import { shell as q, dialog as be, protocol as ue, app as j, net as ke, BrowserWindow as de, ipcMain as ve } from "electron";
2
- import { join as u, basename as C, resolve as me, dirname as _e } from "node:path";
3
- import { fileURLToPath as Ee, pathToFileURL as Ae } from "node:url";
4
- import { existsSync as v, writeFileSync as Ie, appendFileSync as Se } from "node:fs";
5
- import { readFile as y, readdir as H, stat as fe, mkdir as N, rm as B, writeFile as $, appendFile as Oe } from "node:fs/promises";
1
+ import { shell as ee, dialog as ke, app as L, protocol as me, Menu as te, net as ve, BrowserWindow as pe, ipcMain as _e } from "electron";
2
+ import { join as u, basename as C, resolve as G, dirname as Ee } from "node:path";
3
+ import { fileURLToPath as Ae, pathToFileURL as Ie } from "node:url";
4
+ import { existsSync as v, writeFileSync as Se, appendFileSync as Oe } from "node:fs";
5
+ import { readFile as y, readdir as z, stat as fe, mkdir as N, rm as F, writeFile as $, appendFile as Pe } from "node:fs/promises";
6
6
  import { execFile as U } from "node:child_process";
7
7
  import { promisify as R } from "node:util";
8
8
  import { homedir as w } from "node:os";
9
- import z from "gray-matter";
9
+ import V from "gray-matter";
10
10
  import { z as k } from "zod";
11
- import Pe from "@anthropic-ai/sdk";
12
- import $e from "openai";
13
- import { GoogleGenerativeAI as Ce } from "@google/generative-ai";
14
- import { Ollama as Ne } from "ollama";
15
- import { createRequire as xe } from "node:module";
11
+ import $e from "@anthropic-ai/sdk";
12
+ import Ce from "openai";
13
+ import { GoogleGenerativeAI as Ne } from "@google/generative-ai";
14
+ import { Ollama as xe } from "ollama";
15
+ import { createRequire as Ue } from "node:module";
16
16
  import "dotenv/config";
17
- const Ue = k.object({
17
+ const Re = k.object({
18
18
  name: k.string(),
19
19
  description: k.string(),
20
20
  interests: k.array(k.string()).default([]),
@@ -23,24 +23,24 @@ const Ue = k.object({
23
23
  skills: k.array(k.string()).default([]),
24
24
  temperature: k.number().min(0).max(2).optional(),
25
25
  avatar: k.string().optional()
26
- }), Re = (n, r) => [
26
+ }), Te = (n, r) => [
27
27
  u(n, "skills", r, "SKILL.md"),
28
28
  u(process.cwd(), ".claude", "skills", r, "SKILL.md"),
29
29
  u(w(), ".agents", "skills", r, "SKILL.md"),
30
30
  u(w(), ".claude", "skills", r, "SKILL.md")
31
31
  ];
32
- async function Te(n, r) {
33
- for (const t of Re(r, n))
32
+ async function Le(n, r) {
33
+ for (const t of Te(r, n))
34
34
  if (v(t)) {
35
- const e = await y(t, "utf-8"), { content: o } = z(e);
35
+ const e = await y(t, "utf-8"), { content: o } = V(e);
36
36
  return o.trim();
37
37
  }
38
38
  return null;
39
39
  }
40
- async function Le(n, r) {
40
+ async function De(n, r) {
41
41
  const t = [];
42
42
  for (const e of n) {
43
- const o = await Te(e, r);
43
+ const o = await Le(e, r);
44
44
  o && t.push(`## Skill: ${e}
45
45
 
46
46
  ${o}`);
@@ -49,10 +49,10 @@ ${o}`);
49
49
 
50
50
  `);
51
51
  }
52
- function De(n, r) {
52
+ function Ke(n, r) {
53
53
  return n ? n.startsWith("http://") || n.startsWith("https://") ? n : `council-file://${n.startsWith("/") ? n : u(r, n)}` : void 0;
54
54
  }
55
- async function Ke(n, r) {
55
+ async function je(n, r) {
56
56
  const t = /\{\{(.+?)\}\}/g;
57
57
  let e = n;
58
58
  for (const o of n.matchAll(t)) {
@@ -65,14 +65,14 @@ async function Ke(n, r) {
65
65
  }
66
66
  return e;
67
67
  }
68
- async function ee(n) {
69
- const r = me(n), t = u(r, "ABOUT.md");
68
+ async function ne(n) {
69
+ const r = G(n), t = u(r, "ABOUT.md");
70
70
  if (!v(t))
71
71
  throw new Error(`No ABOUT.md found in ${r}`);
72
- const e = await y(t, "utf-8"), { data: o, content: s } = z(e), a = Ue.parse(o);
73
- let i = await Ke(s.trim(), r);
72
+ const e = await y(t, "utf-8"), { data: o, content: s } = V(e), a = Re.parse(o);
73
+ let i = await je(s.trim(), r);
74
74
  if (a.skills.length > 0) {
75
- const l = await Le(a.skills, r);
75
+ const l = await De(a.skills, r);
76
76
  l && (i += `
77
77
 
78
78
  ` + l);
@@ -82,51 +82,51 @@ async function ee(n) {
82
82
  frontmatter: a,
83
83
  systemPrompt: i,
84
84
  dirPath: r,
85
- avatarUrl: De(a.avatar, r)
85
+ avatarUrl: Ke(a.avatar, r)
86
86
  };
87
87
  }
88
- async function te(n, r) {
88
+ async function oe(n, r) {
89
89
  const t = [], e = /* @__PURE__ */ new Set();
90
90
  if (r?.length) {
91
91
  for (const o of r)
92
92
  if (v(u(o, "ABOUT.md")))
93
93
  try {
94
- const s = await ee(o);
94
+ const s = await ne(o);
95
95
  e.has(s.id) || (t.push(s), e.add(s.id));
96
96
  } catch {
97
97
  }
98
98
  }
99
99
  if (v(n)) {
100
- const o = await H(n);
100
+ const o = await z(n);
101
101
  for (const s of o) {
102
102
  const a = u(n, s);
103
- (await fe(a)).isDirectory() && v(u(a, "ABOUT.md")) && (e.has(C(a)) || (t.push(await ee(a)), e.add(C(a))));
103
+ (await fe(a)).isDirectory() && v(u(a, "ABOUT.md")) && (e.has(C(a)) || (t.push(await ne(a)), e.add(C(a))));
104
104
  }
105
105
  }
106
106
  if (t.length === 0)
107
107
  throw new Error(`No counsellors found in ${n}. Each counsellor needs a directory with an ABOUT.md file.`);
108
108
  return t;
109
109
  }
110
- const je = R(U), pe = u(w(), ".ai-council", "config.json"), ne = u(w(), ".ai-council", "counsellors");
111
- async function V() {
110
+ const Be = R(U), he = u(w(), ".ai-council", "config.json"), se = u(w(), ".ai-council", "counsellors");
111
+ async function X() {
112
112
  try {
113
- return JSON.parse(await y(pe, "utf-8"));
113
+ return JSON.parse(await y(he, "utf-8"));
114
114
  } catch {
115
115
  return { backends: {} };
116
116
  }
117
117
  }
118
- async function X(n) {
118
+ async function Q(n) {
119
119
  const r = u(w(), ".ai-council");
120
- await N(r, { recursive: !0 }), await $(pe, JSON.stringify(n, null, 2), "utf-8");
120
+ await N(r, { recursive: !0 }), await $(he, JSON.stringify(n, null, 2), "utf-8");
121
121
  }
122
- function oe(n) {
122
+ function re(n) {
123
123
  return Object.values(n.counsellors ?? {}).map((r) => r.path);
124
124
  }
125
- async function Be(n) {
126
- const r = me(n), t = u(r, "ABOUT.md");
125
+ async function Ge(n) {
126
+ const r = G(n), t = u(r, "ABOUT.md");
127
127
  if (!v(t))
128
128
  throw new Error(`No ABOUT.md found in ${r}`);
129
- const e = C(r), o = await V(), s = o.counsellors ?? {};
129
+ const e = C(r), o = await X(), s = o.counsellors ?? {};
130
130
  if (s[e])
131
131
  throw new Error(`Counsellor "${e}" is already registered (path: ${s[e].path})`);
132
132
  const l = (await y(t, "utf-8")).match(/^name:\s*["']?(.+?)["']?\s*$/m)?.[1] ?? e;
@@ -134,15 +134,15 @@ async function Be(n) {
134
134
  path: r,
135
135
  source: "local",
136
136
  addedAt: (/* @__PURE__ */ new Date()).toISOString()
137
- }, o.counsellors = s, await X(o), { id: e, name: l };
137
+ }, o.counsellors = s, await Q(o), { id: e, name: l };
138
138
  }
139
- async function Ge(n) {
140
- await N(ne, { recursive: !0 });
141
- const r = C(n, ".git").replace(/\.git$/, ""), t = u(ne, r);
139
+ async function Fe(n) {
140
+ await N(se, { recursive: !0 });
141
+ const r = C(n, ".git").replace(/\.git$/, ""), t = u(se, r);
142
142
  if (v(t))
143
143
  throw new Error(`Directory already exists: ${t}. Remove it first or use a different URL.`);
144
- await je("git", ["clone", "--depth", "1", n, t]);
145
- const e = [], o = await V(), s = o.counsellors ?? {};
144
+ await Be("git", ["clone", "--depth", "1", n, t]);
145
+ const e = [], o = await X(), s = o.counsellors ?? {};
146
146
  if (v(u(t, "ABOUT.md"))) {
147
147
  const a = r;
148
148
  if (s[a])
@@ -155,35 +155,35 @@ async function Ge(n) {
155
155
  addedAt: (/* @__PURE__ */ new Date()).toISOString()
156
156
  }, e.push({ id: a, name: c });
157
157
  } else {
158
- const a = await H(t);
158
+ const a = await z(t);
159
159
  for (const i of a) {
160
160
  if (i.startsWith(".")) continue;
161
161
  const l = u(t, i);
162
162
  if ((await fe(l)).isDirectory() && v(u(l, "ABOUT.md"))) {
163
163
  const m = i;
164
164
  if (s[m]) continue;
165
- const p = (await y(u(l, "ABOUT.md"), "utf-8")).match(/^name:\s*["']?(.+?)["']?\s*$/m)?.[1] ?? m;
165
+ const f = (await y(u(l, "ABOUT.md"), "utf-8")).match(/^name:\s*["']?(.+?)["']?\s*$/m)?.[1] ?? m;
166
166
  s[m] = {
167
167
  path: l,
168
168
  source: "git",
169
169
  url: n,
170
170
  addedAt: (/* @__PURE__ */ new Date()).toISOString()
171
- }, e.push({ id: m, name: p });
171
+ }, e.push({ id: m, name: f });
172
172
  }
173
173
  }
174
174
  if (e.length === 0)
175
- throw await B(t, { recursive: !0, force: !0 }), new Error("No counsellors found in cloned repository (no ABOUT.md files)");
175
+ throw await F(t, { recursive: !0, force: !0 }), new Error("No counsellors found in cloned repository (no ABOUT.md files)");
176
176
  }
177
- return o.counsellors = s, await X(o), e;
177
+ return o.counsellors = s, await Q(o), e;
178
178
  }
179
- async function Fe(n, r = !1) {
180
- const t = await V(), e = t.counsellors ?? {}, o = e[n];
179
+ async function We(n, r = !1) {
180
+ const t = await X(), e = t.counsellors ?? {}, o = e[n];
181
181
  if (!o)
182
182
  throw new Error(`Counsellor "${n}" is not registered`);
183
- r && o.source === "git" && v(o.path) && await B(o.path, { recursive: !0, force: !0 }), delete e[n], t.counsellors = e, await X(t);
183
+ r && o.source === "git" && v(o.path) && await F(o.path, { recursive: !0, force: !0 }), delete e[n], t.counsellors = e, await Q(t);
184
184
  }
185
- function We(n) {
186
- const r = new Pe({
185
+ function Me(n) {
186
+ const r = new $e({
187
187
  apiKey: n.apiKey ?? process.env.ANTHROPIC_API_KEY,
188
188
  ...n.baseUrl ? { baseURL: n.baseUrl } : {}
189
189
  });
@@ -234,7 +234,7 @@ function We(n) {
234
234
  };
235
235
  }
236
236
  function Ye(n) {
237
- const r = new $e({
237
+ const r = new Ce({
238
238
  apiKey: n.apiKey ?? process.env.OPENAI_API_KEY,
239
239
  ...n.baseUrl ? { baseURL: n.baseUrl } : {}
240
240
  });
@@ -285,8 +285,8 @@ function Ye(n) {
285
285
  }
286
286
  };
287
287
  }
288
- function Me(n) {
289
- const r = n.apiKey ?? process.env.GOOGLE_API_KEY ?? "", t = new Ce(r);
288
+ function He(n) {
289
+ const r = n.apiKey ?? process.env.GOOGLE_API_KEY ?? "", t = new Ne(r);
290
290
  return {
291
291
  name: "google",
292
292
  defaultModel: "gemini-2.0-flash",
@@ -336,7 +336,7 @@ function Me(n) {
336
336
  };
337
337
  }
338
338
  function Je(n) {
339
- const r = new Ne({
339
+ const r = new xe({
340
340
  host: n.baseUrl ?? "http://localhost:11434"
341
341
  });
342
342
  return {
@@ -389,14 +389,14 @@ function Je(n) {
389
389
  }
390
390
  };
391
391
  }
392
- const se = {
393
- anthropic: We,
392
+ const ae = {
393
+ anthropic: Me,
394
394
  openai: Ye,
395
- google: Me,
395
+ google: He,
396
396
  ollama: Je
397
397
  };
398
398
  let T = null;
399
- async function He() {
399
+ async function ze() {
400
400
  if (T) return T;
401
401
  const n = u(w(), ".ai-council", "config.json");
402
402
  try {
@@ -407,23 +407,23 @@ async function He() {
407
407
  }
408
408
  return T;
409
409
  }
410
- const M = /* @__PURE__ */ new Map();
411
- function ze() {
412
- T = null, M.clear();
410
+ const J = /* @__PURE__ */ new Map();
411
+ function Ve() {
412
+ T = null, J.clear();
413
413
  }
414
- async function G(n) {
415
- const r = M.get(n);
414
+ async function W(n) {
415
+ const r = J.get(n);
416
416
  if (r) return r;
417
- const t = se[n];
417
+ const t = ae[n];
418
418
  if (!t)
419
- throw new Error(`Unknown backend: "${n}". Available: ${Object.keys(se).join(", ")}`);
420
- const o = (await He()).backends[n] ?? {}, s = t(o);
421
- return M.set(n, s), s;
419
+ throw new Error(`Unknown backend: "${n}". Available: ${Object.keys(ae).join(", ")}`);
420
+ const o = (await ze()).backends[n] ?? {}, s = t(o);
421
+ return J.set(n, s), s;
422
422
  }
423
- function Ve() {
423
+ function Xe() {
424
424
  return '\n## Excalidraw Element Reference\n\nOutput a JSON array of Excalidraw elements. Each element needs these fields:\n\n### Common Fields (all elements)\n- `type`: "rectangle" | "ellipse" | "diamond" | "text" | "arrow" | "line"\n- `id`: unique string (e.g. "rect1", "text1", "arrow1")\n- `x`, `y`: number (top-left origin, x increases right, y increases down)\n- `width`, `height`: number\n- `strokeColor`: hex string (e.g. "#1e1e1e")\n- `backgroundColor`: hex string or "transparent"\n- `fillStyle`: "solid" | "hachure" | "cross-hatch"\n- `strokeWidth`: 1 | 2 | 4\n- `roughness`: 0 (sharp) | 1 (sketchy)\n- `opacity`: 100\n- `angle`: 0\n- `seed`: any integer (e.g. 1)\n- `version`: 1\n- `isDeleted`: false\n- `groupIds`: []\n- `boundElements`: null or array of { id: string, type: "text" | "arrow" }\n- `link`: null\n- `locked`: false\n\n### Text Elements\nAdditional fields: `text`, `fontSize` (16-24), `fontFamily` (1=hand, 2=normal, 3=mono), `textAlign` ("left"|"center"|"right"), `verticalAlign` ("top"|"middle"), `baseline`: 0, `containerId`: null or parent shape id\n\n### Arrow/Line Elements\nAdditional fields: `points` (array of [x,y] relative to element x,y — first point always [0,0]), `startBinding` and `endBinding`: null or { elementId: string, focus: 0, gap: 5 }, `lastCommittedPoint`: null, `startArrowhead`: null, `endArrowhead`: "arrow" | null\n\n### Color Palette\n- Blue: "#1971c2", Light blue bg: "#a5d8ff"\n- Green: "#2f9e44", Light green bg: "#b2f2bb"\n- Red: "#e03131", Light red bg: "#ffc9c9"\n- Orange: "#e8590c", Light orange bg: "#ffd8a8"\n- Purple: "#7048e8", Light purple bg: "#d0bfff"\n- Yellow: "#f08c00", Light yellow bg: "#ffec99"\n- Gray: "#868e96", Light gray bg: "#dee2e6"\n- Dark: "#1e1e1e"\n\n### Layout Tips\n- Space shapes ~200px apart horizontally, ~150px vertically\n- Typical shape size: 160×80 for rectangles, 120×60 for ellipses\n- Center text inside shapes using containerId\n- Use arrows to show relationships (agreement, disagreement, influence)\n\n### Compact Example\n```json\n[\n {"type":"rectangle","id":"r1","x":50,"y":50,"width":160,"height":80,"strokeColor":"#1971c2","backgroundColor":"#a5d8ff","fillStyle":"solid","strokeWidth":2,"roughness":1,"opacity":100,"angle":0,"seed":1,"version":1,"isDeleted":false,"groupIds":[],"boundElements":[{"id":"t1","type":"text"},{"id":"a1","type":"arrow"}],"link":null,"locked":false},\n {"type":"text","id":"t1","x":60,"y":70,"width":140,"height":40,"text":"Counsellor A","fontSize":16,"fontFamily":2,"textAlign":"center","verticalAlign":"middle","baseline":0,"containerId":"r1","strokeColor":"#1e1e1e","backgroundColor":"transparent","fillStyle":"solid","strokeWidth":1,"roughness":0,"opacity":100,"angle":0,"seed":2,"version":1,"isDeleted":false,"groupIds":[],"boundElements":null,"link":null,"locked":false},\n {"type":"rectangle","id":"r2","x":350,"y":50,"width":160,"height":80,"strokeColor":"#2f9e44","backgroundColor":"#b2f2bb","fillStyle":"solid","strokeWidth":2,"roughness":1,"opacity":100,"angle":0,"seed":3,"version":1,"isDeleted":false,"groupIds":[],"boundElements":[{"id":"t2","type":"text"},{"id":"a1","type":"arrow"}],"link":null,"locked":false},\n {"type":"text","id":"t2","x":360,"y":70,"width":140,"height":40,"text":"Counsellor B","fontSize":16,"fontFamily":2,"textAlign":"center","verticalAlign":"middle","baseline":0,"containerId":"r2","strokeColor":"#1e1e1e","backgroundColor":"transparent","fillStyle":"solid","strokeWidth":1,"roughness":0,"opacity":100,"angle":0,"seed":4,"version":1,"isDeleted":false,"groupIds":[],"boundElements":null,"link":null,"locked":false},\n {"type":"arrow","id":"a1","x":210,"y":90,"width":140,"height":0,"points":[[0,0],[140,0]],"startBinding":{"elementId":"r1","focus":0,"gap":5},"endBinding":{"elementId":"r2","focus":0,"gap":5},"startArrowhead":null,"endArrowhead":"arrow","strokeColor":"#1e1e1e","backgroundColor":"transparent","fillStyle":"solid","strokeWidth":2,"roughness":1,"opacity":100,"angle":0,"seed":5,"version":1,"isDeleted":false,"groupIds":[],"boundElements":null,"link":null,"locked":false,"lastCommittedPoint":null}\n]\n```\n'.trim();
425
425
  }
426
- const F = "---EXCALIDRAW---", Xe = `You are the Secretary of a council discussion. Your job is to synthesize a clear, structured summary of the conversation that just took place.
426
+ const M = "---EXCALIDRAW---", Qe = `You are the Secretary of a council discussion. Your job is to synthesize a clear, structured summary of the conversation that just took place.
427
427
 
428
428
  Structure your summary with these sections:
429
429
 
@@ -440,7 +440,7 @@ Where did they disagree? What are the key tensions?
440
440
  What are the most important takeaways? What would you recommend based on the full discussion?
441
441
 
442
442
  Be concise but thorough. Use markdown formatting.`;
443
- function Qe(n) {
443
+ function Ze(n) {
444
444
  const r = [];
445
445
  r.push(`Topic: ${n.topic}`), r.push(`Counsellors: ${n.counsellors.map((e) => e.name).join(", ")}`), r.push(`Rounds: ${n.rounds}`), r.push("");
446
446
  let t = 0;
@@ -449,7 +449,7 @@ function Qe(n) {
449
449
  return r.join(`
450
450
  `);
451
451
  }
452
- async function Ze({
452
+ async function qe({
453
453
  result: n,
454
454
  config: r,
455
455
  onChunk: t,
@@ -458,11 +458,11 @@ async function Ze({
458
458
  const o = r.secretary;
459
459
  if (!o?.backend)
460
460
  throw new Error("No secretary backend configured");
461
- const s = await G(o.backend), a = o.model ?? s.defaultModel, i = o.systemPrompt || Xe, l = Ve(), c = `${i}
461
+ const s = await W(o.backend), a = o.model ?? s.defaultModel, i = o.systemPrompt || Qe, l = Xe(), c = `${i}
462
462
 
463
463
  ${l}
464
464
 
465
- After your text summary, output \`${F}\` on its own line, then a JSON array of Excalidraw elements showing a visual map of where each counsellor stands on the topic. Use shapes for each counsellor with their name, arrows to show relationships (agreement/disagreement), and position them to visually represent the discussion dynamics.`, m = Qe(n), g = {
465
+ After your text summary, output \`${M}\` on its own line, then a JSON array of Excalidraw elements showing a visual map of where each counsellor stands on the topic. Use shapes for each counsellor with their name, arrows to show relationships (agreement/disagreement), and position them to visually represent the discussion dynamics.`, m = Ze(n), g = {
466
466
  model: a,
467
467
  systemPrompt: c,
468
468
  messages: [{ role: "user", content: `Please summarize this council discussion and create a position diagram:
@@ -470,18 +470,18 @@ After your text summary, output \`${F}\` on its own line, then a JSON array of E
470
470
  ${m}` }],
471
471
  temperature: 0.5
472
472
  };
473
- let f = "";
473
+ let p = "";
474
474
  if (s.chatStream)
475
475
  for await (const E of s.chatStream(g)) {
476
476
  if (e?.aborted) break;
477
- f += E.delta, E.delta && t && t(E.delta);
477
+ p += E.delta, E.delta && t && t(E.delta);
478
478
  }
479
479
  else
480
- f = (await s.chat(g)).content, t && t(f);
481
- const p = f.indexOf(F);
482
- if (p === -1)
483
- return { text: f.trim() };
484
- const d = f.slice(0, p).trim(), h = f.slice(p + F.length).trim();
480
+ p = (await s.chat(g)).content, t && t(p);
481
+ const f = p.indexOf(M);
482
+ if (f === -1)
483
+ return { text: p.trim() };
484
+ const d = p.slice(0, f).trim(), h = p.slice(f + M.length).trim();
485
485
  let b;
486
486
  try {
487
487
  const E = h.match(/\[[\s\S]*\]/);
@@ -490,8 +490,8 @@ ${m}` }],
490
490
  }
491
491
  return { text: d, diagram: b };
492
492
  }
493
- const qe = "You are the Secretary of a council debate. Briefly summarize this round of discussion. Note emerging agreements, disagreements, and shifts in position. 2-3 paragraphs max. Use markdown formatting.";
494
- async function et({
493
+ const et = "You are the Secretary of a council debate. Briefly summarize this round of discussion. Note emerging agreements, disagreements, and shifts in position. 2-3 paragraphs max. Use markdown formatting.";
494
+ async function tt({
495
495
  result: n,
496
496
  roundNumber: r,
497
497
  config: t,
@@ -501,13 +501,13 @@ async function et({
501
501
  const s = t.secretary;
502
502
  if (!s?.backend)
503
503
  throw new Error("No secretary backend configured");
504
- const a = await G(s.backend), i = s.model ?? a.defaultModel, l = n.turns.filter((f) => f.round === r), c = [];
504
+ const a = await W(s.backend), i = s.model ?? a.defaultModel, l = n.turns.filter((p) => p.round === r), c = [];
505
505
  c.push(`Topic: ${n.topic}`), c.push(`Round ${r}${r === 1 ? " (Constructive)" : " (Rebuttal)"}`), c.push("");
506
- for (const f of l)
507
- c.push(`[${f.counsellorName}]:`), c.push(f.content), c.push("");
506
+ for (const p of l)
507
+ c.push(`[${p.counsellorName}]:`), c.push(p.content), c.push("");
508
508
  const m = {
509
509
  model: i,
510
- systemPrompt: qe,
510
+ systemPrompt: et,
511
511
  messages: [{ role: "user", content: `Please summarize this round:
512
512
 
513
513
  ${c.join(`
@@ -516,15 +516,15 @@ ${c.join(`
516
516
  };
517
517
  let g = "";
518
518
  if (a.chatStream)
519
- for await (const f of a.chatStream(m)) {
519
+ for await (const p of a.chatStream(m)) {
520
520
  if (o?.aborted) break;
521
- g += f.delta, f.delta && e && e(f.delta);
521
+ g += p.delta, p.delta && e && e(p.delta);
522
522
  }
523
523
  else
524
524
  g = (await a.chat(m)).content, e && e(g);
525
525
  return g.trim();
526
526
  }
527
- async function tt({
527
+ async function nt({
528
528
  topic: n,
529
529
  firstRoundTurns: r,
530
530
  config: t
@@ -532,7 +532,7 @@ async function tt({
532
532
  const e = t.secretary;
533
533
  if (!e?.backend)
534
534
  throw new Error("No secretary backend configured");
535
- const o = await G(e.backend), s = e.model ?? o.defaultModel, a = r.map((l) => `[${l.counsellorName}]: ${l.content.slice(0, 300)}`).join(`
535
+ const o = await W(e.backend), s = e.model ?? o.defaultModel, a = r.map((l) => `[${l.counsellorName}]: ${l.content.slice(0, 300)}`).join(`
536
536
 
537
537
  `);
538
538
  return (await o.chat({
@@ -550,12 +550,12 @@ ${a}`
550
550
  temperature: 0.3
551
551
  })).content.trim().replace(/^["']+|["']+$/g, "").replace(/[.!?]+$/, "").trim();
552
552
  }
553
- const he = u(w(), ".ai-council"), nt = u(he, "council.log");
554
- let re = !1;
555
- async function ot() {
556
- re || (await N(he, { recursive: !0 }), re = !0);
553
+ const ge = u(w(), ".ai-council"), ot = u(ge, "council.log");
554
+ let ie = !1;
555
+ async function st() {
556
+ ie || (await N(ge, { recursive: !0 }), ie = !0);
557
557
  }
558
- function st(n, r, t, e) {
558
+ function rt(n, r, t, e) {
559
559
  let s = `[${(/* @__PURE__ */ new Date()).toISOString()}] ${n} [${r}] ${t}`;
560
560
  if (e !== void 0) {
561
561
  const a = e instanceof Error ? `${e.message}
@@ -567,18 +567,18 @@ ${e.stack ?? ""}` : typeof e == "string" ? e : JSON.stringify(e, null, 2);
567
567
  return s + `
568
568
  `;
569
569
  }
570
- async function W(n, r, t, e) {
570
+ async function Y(n, r, t, e) {
571
571
  try {
572
- await ot(), await Oe(nt, st(n, r, t, e));
572
+ await st(), await Pe(ot, rt(n, r, t, e));
573
573
  } catch {
574
574
  }
575
575
  }
576
576
  const O = {
577
- info: (n, r, t) => W("INFO", n, r, t),
578
- warn: (n, r, t) => W("WARN", n, r, t),
579
- error: (n, r, t) => W("ERROR", n, r, t)
577
+ info: (n, r, t) => Y("INFO", n, r, t),
578
+ warn: (n, r, t) => Y("WARN", n, r, t),
579
+ error: (n, r, t) => Y("ERROR", n, r, t)
580
580
  };
581
- function rt(n, r, t) {
581
+ function at(n, r, t) {
582
582
  const e = [{ role: "user", content: n }];
583
583
  for (const o of r)
584
584
  o.counsellorId === t ? e.push({ role: "assistant", content: o.content }) : e.push({
@@ -587,7 +587,7 @@ function rt(n, r, t) {
587
587
  });
588
588
  return e;
589
589
  }
590
- function at(n, r, t, e) {
590
+ function it(n, r, t, e) {
591
591
  const o = [{ role: "user", content: n }];
592
592
  if (e === 1)
593
593
  return o;
@@ -610,7 +610,7 @@ function at(n, r, t, e) {
610
610
  i.counsellorId === t && i.round !== 1 && i.round !== a && i.round < e && o.push({ role: "assistant", content: i.content });
611
611
  return o;
612
612
  }
613
- function it(n, r) {
613
+ function ct(n, r) {
614
614
  const t = [...n];
615
615
  let e = r | 0;
616
616
  const o = () => {
@@ -624,7 +624,7 @@ function it(n, r) {
624
624
  }
625
625
  return t;
626
626
  }
627
- function Y(n, r, t, e, o, s) {
627
+ function H(n, r, t, e, o, s) {
628
628
  return {
629
629
  topic: n.topic,
630
630
  topicSource: n.topicSource,
@@ -645,7 +645,7 @@ function Y(n, r, t, e, o, s) {
645
645
  ...n.mode === "debate" ? { mode: "debate" } : {}
646
646
  };
647
647
  }
648
- async function ct(n, r, t, e, o) {
648
+ async function lt(n, r, t, e, o) {
649
649
  let s;
650
650
  typeof n == "string" ? s = {
651
651
  topic: n,
@@ -658,86 +658,86 @@ async function ct(n, r, t, e, o) {
658
658
  let l = 0, c = 0;
659
659
  const m = s.mode === "debate", g = {};
660
660
  O.info("conversation", `Starting ${m ? "debate" : "freeform"} — ${s.counsellors.length} counsellors, ${s.rounds} rounds`, {
661
- counsellors: s.counsellors.map((f) => `${f.frontmatter.name} (${f.frontmatter.backend}/${f.frontmatter.model ?? "default"})`),
661
+ counsellors: s.counsellors.map((p) => `${p.frontmatter.name} (${p.frontmatter.backend}/${p.frontmatter.model ?? "default"})`),
662
662
  topic: s.topic.slice(0, 200)
663
663
  });
664
- for (let f = 1; f <= s.rounds; f++) {
665
- const p = m && f > 1 ? it(s.counsellors, f) : s.counsellors;
666
- for (const d of p) {
664
+ for (let p = 1; p <= s.rounds; p++) {
665
+ const f = m && p > 1 ? ct(s.counsellors, p) : s.counsellors;
666
+ for (const d of f) {
667
667
  if (s.signal?.aborted)
668
- return Y(s, i, a, l, c, g);
668
+ return H(s, i, a, l, c, g);
669
669
  if (s.beforeTurn) {
670
670
  const h = await s.beforeTurn();
671
671
  h && (i.push(h), s.onEvent({ type: "turn_complete", turn: h }));
672
672
  }
673
- s.onEvent({ type: "turn_start", round: f, counsellorName: d.frontmatter.name });
673
+ s.onEvent({ type: "turn_start", round: p, counsellorName: d.frontmatter.name });
674
674
  try {
675
- const h = await G(d.frontmatter.backend), b = d.frontmatter.model ?? h.defaultModel, E = m ? at(s.topic, i, d.id, f) : rt(s.topic, i, d.id), Q = {
675
+ const h = await W(d.frontmatter.backend), b = d.frontmatter.model ?? h.defaultModel, E = m ? it(s.topic, i, d.id, p) : at(s.topic, i, d.id), Z = {
676
676
  model: b,
677
677
  systemPrompt: d.systemPrompt,
678
678
  messages: E,
679
679
  temperature: d.frontmatter.temperature
680
680
  };
681
- let L, x;
681
+ let D, x;
682
682
  if (h.chatStream) {
683
- L = "";
684
- for await (const S of h.chatStream(Q)) {
683
+ D = "";
684
+ for await (const S of h.chatStream(Z)) {
685
685
  if (s.signal?.aborted) break;
686
- L += S.delta, S.delta && s.onEvent({ type: "turn_chunk", counsellorName: d.frontmatter.name, delta: S.delta }), S.tokenUsage && (x = S.tokenUsage);
686
+ D += S.delta, S.delta && s.onEvent({ type: "turn_chunk", counsellorName: d.frontmatter.name, delta: S.delta }), S.tokenUsage && (x = S.tokenUsage);
687
687
  }
688
688
  } else {
689
- const S = await h.chat(Q);
690
- L = S.content, x = S.tokenUsage;
689
+ const S = await h.chat(Z);
690
+ D = S.content, x = S.tokenUsage;
691
691
  }
692
- const Z = {
693
- round: f,
692
+ const q = {
693
+ round: p,
694
694
  counsellorId: d.id,
695
695
  counsellorName: d.frontmatter.name,
696
- content: L,
696
+ content: D,
697
697
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
698
698
  model: b,
699
699
  backend: d.frontmatter.backend,
700
700
  tokenUsage: x,
701
701
  avatarUrl: d.avatarUrl
702
702
  };
703
- x && (l += x.input, c += x.output), i.push(Z), s.onEvent({ type: "turn_complete", turn: Z });
703
+ x && (l += x.input, c += x.output), i.push(q), s.onEvent({ type: "turn_complete", turn: q });
704
704
  } catch (h) {
705
705
  const b = h instanceof Error ? h.message : String(h);
706
- O.error("conversation", `Turn failed for ${d.frontmatter.name} (round ${f}, model ${d.frontmatter.model ?? "default"}, backend ${d.frontmatter.backend})`, h), s.onEvent({ type: "error", counsellorName: d.frontmatter.name, error: b });
706
+ O.error("conversation", `Turn failed for ${d.frontmatter.name} (round ${p}, model ${d.frontmatter.model ?? "default"}, backend ${d.frontmatter.backend})`, h), s.onEvent({ type: "error", counsellorName: d.frontmatter.name, error: b });
707
707
  }
708
708
  }
709
- if (s.onEvent({ type: "round_complete", round: f }), m && s.config?.secretary?.backend && !s.signal?.aborted)
709
+ if (s.onEvent({ type: "round_complete", round: p }), m && s.config?.secretary?.backend && !s.signal?.aborted)
710
710
  try {
711
- const d = Y(s, i, a, l, c, g);
712
- s.onEvent({ type: "round_summary_start", round: f });
713
- const h = await et({
711
+ const d = H(s, i, a, l, c, g);
712
+ s.onEvent({ type: "round_summary_start", round: p });
713
+ const h = await tt({
714
714
  result: d,
715
- roundNumber: f,
715
+ roundNumber: p,
716
716
  config: s.config,
717
717
  onChunk: (b) => {
718
- s.onEvent({ type: "round_summary_chunk", round: f, delta: b });
718
+ s.onEvent({ type: "round_summary_chunk", round: p, delta: b });
719
719
  },
720
720
  signal: s.signal
721
721
  });
722
- g[f] = h, s.onEvent({ type: "round_summary_complete", round: f, summary: h });
722
+ g[p] = h, s.onEvent({ type: "round_summary_complete", round: p, summary: h });
723
723
  } catch (d) {
724
- O.error("conversation", `Interim summary failed for round ${f}`, d);
724
+ O.error("conversation", `Interim summary failed for round ${p}`, d);
725
725
  }
726
726
  }
727
- return Y(s, i, a, l, c, g);
727
+ return H(s, i, a, l, c, g);
728
728
  }
729
729
  const I = u(w(), ".ai-council", "history");
730
- function lt(n) {
730
+ function ut(n) {
731
731
  return n.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "").slice(0, 40);
732
732
  }
733
- async function ut(n) {
733
+ async function dt(n) {
734
734
  await N(I, { recursive: !0 });
735
- const r = new Date(n.startedAt).toISOString().replace(/[:.]/g, "-").slice(0, 19), t = lt(n.topic), e = `${r}-${t}`, o = u(I, `${e}.json`);
735
+ const r = new Date(n.startedAt).toISOString().replace(/[:.]/g, "-").slice(0, 19), t = ut(n.topic), e = `${r}-${t}`, o = u(I, `${e}.json`);
736
736
  return await $(o, JSON.stringify(n, null, 2), "utf-8"), e;
737
737
  }
738
- async function dt() {
738
+ async function mt() {
739
739
  await N(I, { recursive: !0 });
740
- const n = await H(I), r = [];
740
+ const n = await z(I), r = [];
741
741
  for (const t of n)
742
742
  if (t.endsWith(".json"))
743
743
  try {
@@ -755,24 +755,24 @@ async function dt() {
755
755
  }
756
756
  return r.sort((t, e) => e.startedAt.localeCompare(t.startedAt));
757
757
  }
758
- async function ae(n) {
758
+ async function ce(n) {
759
759
  const r = u(I, `${n}.json`), t = await y(r, "utf-8"), e = JSON.parse(t);
760
760
  return e.infographic && !e.infographics && (e.infographics = [e.infographic], delete e.infographic), e;
761
761
  }
762
- async function mt(n) {
762
+ async function pt(n) {
763
763
  const r = u(I, `${n}.json`);
764
- await B(r);
764
+ await F(r);
765
765
  }
766
766
  async function ft(n, r) {
767
767
  const t = u(I, `${n}.json`), e = await y(t, "utf-8"), o = JSON.parse(e);
768
768
  o.infographics || (o.infographics = []), o.infographics.push(r), await $(t, JSON.stringify(o, null, 2), "utf-8");
769
769
  }
770
- async function pt(n, r) {
770
+ async function ht(n, r) {
771
771
  const t = u(I, `${n}.json`), e = await y(t, "utf-8"), o = JSON.parse(e);
772
772
  o.infographics && r >= 0 && r < o.infographics.length && o.infographics.splice(r, 1), await $(t, JSON.stringify(o, null, 2), "utf-8");
773
773
  }
774
- const ge = xe(import.meta.url);
775
- function ht(n) {
774
+ const ye = Ue(import.meta.url);
775
+ function gt(n) {
776
776
  const r = n.counsellors.map((e) => e.name).join(", "), t = n.summary ?? n.turns.map((e) => `${e.counsellorName}: ${e.content.slice(0, 200)}`).join(`
777
777
  `);
778
778
  return [
@@ -784,13 +784,13 @@ function ht(n) {
784
784
  "Include relevant icons and visual hierarchy. Use a horizontal landscape layout."
785
785
  ].join(" ");
786
786
  }
787
- function gt(n) {
787
+ function yt(n) {
788
788
  if (n.infographic?.backend) return n.infographic.backend;
789
789
  const r = !!(n.backends.google?.apiKey || process.env.GOOGLE_API_KEY), t = !!(n.backends.openai?.apiKey || process.env.OPENAI_API_KEY);
790
790
  return r ? "google" : t ? "openai" : null;
791
791
  }
792
- async function yt(n, r) {
793
- const t = ge("openai").default, s = (await new t({
792
+ async function wt(n, r) {
793
+ const t = ye("openai").default, s = (await new t({
794
794
  apiKey: r.backends.openai?.apiKey || process.env.OPENAI_API_KEY,
795
795
  ...r.backends.openai?.baseUrl ? { baseURL: r.backends.openai.baseUrl } : {}
796
796
  }).images.generate({
@@ -802,8 +802,8 @@ async function yt(n, r) {
802
802
  if (!s) throw new Error("No image data returned from OpenAI");
803
803
  return s;
804
804
  }
805
- async function wt(n, r) {
806
- const { GoogleGenAI: t } = ge("@google/genai"), e = r.backends.google?.apiKey || process.env.GOOGLE_API_KEY;
805
+ async function bt(n, r) {
806
+ const { GoogleGenAI: t } = ye("@google/genai"), e = r.backends.google?.apiKey || process.env.GOOGLE_API_KEY;
807
807
  if (!e) throw new Error("No Google API key configured");
808
808
  const a = (await new t({ apiKey: e }).models.generateContent({
809
809
  model: "gemini-3-pro-image-preview",
@@ -818,24 +818,24 @@ async function wt(n, r) {
818
818
  return i.inlineData.data;
819
819
  throw new Error("No image data in Gemini response");
820
820
  }
821
- async function ie(n, r, t) {
822
- const e = t ?? gt(r);
821
+ async function le(n, r, t) {
822
+ const e = t ?? yt(r);
823
823
  if (!e) throw new Error("No image-capable backend configured (need OpenAI or Google API key)");
824
- const o = ht(n);
825
- return e === "openai" ? yt(o, r) : wt(o, r);
824
+ const o = gt(n);
825
+ return e === "openai" ? wt(o, r) : bt(o, r);
826
826
  }
827
- const ye = {
827
+ const we = {
828
828
  anthropic: "https://api.anthropic.com",
829
829
  openai: "https://api.openai.com/v1",
830
830
  google: "https://generativelanguage.googleapis.com",
831
831
  ollama: "http://localhost:11434"
832
- }, ce = [
832
+ }, ue = [
833
833
  "claude-opus-4-20250514",
834
834
  "claude-sonnet-4-5-20250514",
835
835
  "claude-sonnet-4-20250514",
836
836
  "claude-haiku-4-20250414",
837
837
  "claude-3-5-haiku-20241022"
838
- ], D = [
838
+ ], K = [
839
839
  "gemini-2.5-pro",
840
840
  "gemini-2.5-flash",
841
841
  "gemini-2.0-flash",
@@ -843,12 +843,12 @@ const ye = {
843
843
  "gemini-1.5-pro",
844
844
  "gemini-1.5-flash"
845
845
  ];
846
- async function bt(n, r) {
846
+ async function kt(n, r) {
847
847
  try {
848
848
  switch (n) {
849
849
  case "ollama": {
850
850
  const { Ollama: t } = await import("ollama");
851
- return { connected: !0, models: (await new t({ host: r.baseUrl || ye.ollama }).list()).models.map((a) => a.name).sort() };
851
+ return { connected: !0, models: (await new t({ host: r.baseUrl || we.ollama }).list()).models.map((a) => a.name).sort() };
852
852
  }
853
853
  case "openai": {
854
854
  const { default: t } = await import("openai");
@@ -865,33 +865,36 @@ async function bt(n, r) {
865
865
  try {
866
866
  return { connected: !0, models: (await e.models.list({ limit: 100 })).data.map((a) => a.id).sort() };
867
867
  } catch {
868
- return { connected: !0, models: ce };
868
+ return { connected: !0, models: ue };
869
869
  }
870
870
  }
871
871
  case "google": {
872
872
  const t = r.apiKey || process.env.GOOGLE_API_KEY || "";
873
- if (!t) return { connected: !1, models: D, error: "No API key" };
873
+ if (!t) return { connected: !1, models: K, error: "No API key" };
874
874
  const e = await fetch(
875
875
  `https://generativelanguage.googleapis.com/v1beta/models?key=${t}`
876
876
  );
877
877
  if (!e.ok) {
878
878
  const i = (await e.json().catch(() => ({})))?.error?.message || `HTTP ${e.status}`;
879
- return { connected: !1, models: D, error: i };
879
+ return { connected: !1, models: K, error: i };
880
880
  }
881
881
  const s = ((await e.json()).models || []).filter((a) => a.name.includes("gemini") && a.supportedGenerationMethods?.includes("generateContent")).map((a) => a.name.replace("models/", "")).sort();
882
- return { connected: !0, models: s.length > 0 ? s : D };
882
+ return { connected: !0, models: s.length > 0 ? s : K };
883
883
  }
884
884
  default:
885
885
  return { connected: !1, models: [], error: `Unknown backend: ${n}` };
886
886
  }
887
887
  } catch (t) {
888
888
  const e = t instanceof Error ? t.message : String(t);
889
- return { connected: !1, models: n === "anthropic" ? ce : n === "google" ? D : [], error: e };
889
+ return { connected: !1, models: n === "anthropic" ? ue : n === "google" ? K : [], error: e };
890
890
  }
891
891
  }
892
- let A = null, K = [];
893
- function kt(n, r) {
894
- n.handle("counsellors:list", async (t, e) => {
892
+ let A = null, j = [];
893
+ function vt(n, r) {
894
+ n.handle("app:getCouncilDir", async () => {
895
+ const t = process.env.COUNCIL_CWD || w();
896
+ return G(t, "council");
897
+ }), n.handle("counsellors:list", async (t, e) => {
895
898
  const o = u(w(), ".ai-council", "config.json");
896
899
  let s = { backends: {} };
897
900
  try {
@@ -899,8 +902,8 @@ function kt(n, r) {
899
902
  s = JSON.parse(c);
900
903
  } catch {
901
904
  }
902
- const a = oe(s), i = s.counsellors ?? {};
903
- return (await te(e, a)).map((c) => {
905
+ const a = re(s), i = s.counsellors ?? {};
906
+ return (await oe(e, a)).map((c) => {
904
907
  const m = i[c.id];
905
908
  return {
906
909
  id: c.id,
@@ -917,7 +920,7 @@ function kt(n, r) {
917
920
  };
918
921
  });
919
922
  }), n.handle("counsellors:get", async (t, e) => {
920
- const o = u(e, "ABOUT.md"), s = await y(o, "utf-8"), { data: a, content: i } = z(s);
923
+ const o = u(e, "ABOUT.md"), s = await y(o, "utf-8"), { data: a, content: i } = V(s);
921
924
  return { frontmatter: a, body: i.trim(), raw: s };
922
925
  }), n.handle("counsellors:save", async (t, e, o) => {
923
926
  const s = u(e, "ABOUT.md");
@@ -925,7 +928,7 @@ function kt(n, r) {
925
928
  }), n.handle("counsellors:create", async (t, e, o, s) => {
926
929
  const a = u(e, o);
927
930
  return await N(a, { recursive: !0 }), await $(u(a, "ABOUT.md"), s, "utf-8"), { success: !0, dirPath: a };
928
- }), n.handle("counsellors:delete", async (t, e) => (await B(e, { recursive: !0, force: !0 }), { success: !0 })), n.handle("config:get", async () => {
931
+ }), n.handle("counsellors:delete", async (t, e) => (await F(e, { recursive: !0, force: !0 }), { success: !0 })), n.handle("config:get", async () => {
929
932
  const t = u(w(), ".ai-council", "config.json");
930
933
  let e = { backends: {} };
931
934
  try {
@@ -942,37 +945,37 @@ function kt(n, r) {
942
945
  OPENAI_API_KEY: s(process.env.OPENAI_API_KEY),
943
946
  GOOGLE_API_KEY: s(process.env.GOOGLE_API_KEY)
944
947
  };
945
- return { config: e, envStatus: o, envKeySuffix: a, defaultUrls: ye };
946
- }), n.handle("backend:probe", async (t, e, o) => bt(e, o)), n.handle("config:save", async (t, e) => {
948
+ return { config: e, envStatus: o, envKeySuffix: a, defaultUrls: we };
949
+ }), n.handle("backend:probe", async (t, e, o) => kt(e, o)), n.handle("config:save", async (t, e) => {
947
950
  const o = u(w(), ".ai-council");
948
- return await N(o, { recursive: !0 }), await $(u(o, "config.json"), JSON.stringify(e, null, 2), "utf-8"), ze(), { success: !0 };
951
+ return await N(o, { recursive: !0 }), await $(u(o, "config.json"), JSON.stringify(e, null, 2), "utf-8"), Ve(), { success: !0 };
949
952
  }), n.handle("discussion:start", async (t, e) => {
950
953
  const o = r();
951
954
  if (!o) return { error: "No window" };
952
- A && A.abort(), A = new AbortController(), K = [];
955
+ A && A.abort(), A = new AbortController(), j = [];
953
956
  const s = u(w(), ".ai-council", "config.json");
954
957
  let a = { backends: {} };
955
958
  try {
956
- const p = await y(s, "utf-8");
957
- a = JSON.parse(p);
959
+ const f = await y(s, "utf-8");
960
+ a = JSON.parse(f);
958
961
  } catch {
959
962
  }
960
- const i = oe(a), l = await te(e.councilDir, i), c = e.counsellorIds?.length ? l.filter((p) => e.counsellorIds.includes(p.id)) : l;
963
+ const i = re(a), l = await oe(e.councilDir, i), c = e.counsellorIds?.length ? l.filter((f) => e.counsellorIds.includes(f.id)) : l;
961
964
  if (c.length === 0) {
962
965
  o.webContents.send("discussion:event", { type: "error", counsellorName: "", error: "No counsellors found" });
963
966
  return;
964
967
  }
965
- const m = (p) => {
966
- o.isDestroyed() || o.webContents.send("discussion:event", p);
967
- }, g = async () => K.length === 0 ? null : {
968
+ const m = (f) => {
969
+ o.isDestroyed() || o.webContents.send("discussion:event", f);
970
+ }, g = async () => j.length === 0 ? null : {
968
971
  round: 0,
969
972
  counsellorId: "__user__",
970
973
  counsellorName: "You",
971
- content: K.shift(),
974
+ content: j.shift(),
972
975
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
973
976
  model: "human",
974
977
  backend: "human"
975
- }, f = {
978
+ }, p = {
976
979
  topic: e.topic,
977
980
  topicSource: e.topicSource,
978
981
  counsellors: c,
@@ -984,30 +987,30 @@ function kt(n, r) {
984
987
  config: a
985
988
  };
986
989
  try {
987
- const p = await ct(f);
990
+ const f = await lt(p);
988
991
  if (a.secretary?.backend)
989
992
  try {
990
993
  m({ type: "summary_start" });
991
- const d = await Ze({
992
- result: p,
994
+ const d = await qe({
995
+ result: f,
993
996
  config: a,
994
997
  onChunk: (h) => {
995
998
  m({ type: "summary_chunk", delta: h });
996
999
  },
997
1000
  signal: A?.signal
998
1001
  });
999
- p.summary = d.text, d.diagram && (p.diagram = d.diagram), m({ type: "summary_complete", summary: d.text, diagram: d.diagram });
1002
+ f.summary = d.text, d.diagram && (f.diagram = d.diagram), m({ type: "summary_complete", summary: d.text, diagram: d.diagram });
1000
1003
  } catch (d) {
1001
1004
  O.error("ipc:discussion", "Secretary summary failed", d), m({ type: "error", counsellorName: "Secretary", error: d instanceof Error ? d.message : String(d) });
1002
1005
  }
1003
1006
  if (a.secretary?.backend)
1004
1007
  try {
1005
- const d = p.turns.filter((b) => b.round === 1), h = await tt({
1006
- topic: p.topic,
1008
+ const d = f.turns.filter((b) => b.round === 1), h = await nt({
1009
+ topic: f.topic,
1007
1010
  firstRoundTurns: d,
1008
1011
  config: a
1009
1012
  });
1010
- p.title = h, m({ type: "title_generated", title: h });
1013
+ f.title = h, m({ type: "title_generated", title: h });
1011
1014
  } catch (d) {
1012
1015
  O.error("ipc:discussion", "Title generation failed", d);
1013
1016
  }
@@ -1015,24 +1018,24 @@ function kt(n, r) {
1015
1018
  for (const d of e.infographicBackends)
1016
1019
  try {
1017
1020
  m({ type: "infographic_start" });
1018
- const h = await ie(p, a, d);
1019
- p.infographics || (p.infographics = []), p.infographics.push(h), m({ type: "infographic_complete", infographic: h });
1021
+ const h = await le(f, a, d);
1022
+ f.infographics || (f.infographics = []), f.infographics.push(h), m({ type: "infographic_complete", infographic: h });
1020
1023
  } catch (h) {
1021
1024
  O.error("ipc:discussion", `Infographic generation failed (${d})`, h), m({ type: "infographic_error", error: h instanceof Error ? h.message : String(h) });
1022
1025
  }
1023
- m({ type: "complete", result: p });
1026
+ m({ type: "complete", result: f });
1024
1027
  try {
1025
- await ut(p);
1028
+ await dt(f);
1026
1029
  } catch (d) {
1027
1030
  O.error("ipc:discussion", "Failed to save to history", d);
1028
1031
  }
1029
- } catch (p) {
1030
- O.error("ipc:discussion", "Discussion failed", p), m({ type: "error", counsellorName: "", error: p instanceof Error ? p.message : String(p) });
1032
+ } catch (f) {
1033
+ O.error("ipc:discussion", "Discussion failed", f), m({ type: "error", counsellorName: "", error: f instanceof Error ? f.message : String(f) });
1031
1034
  } finally {
1032
1035
  A = null;
1033
1036
  }
1034
- }), n.handle("discussion:stop", async () => (A && (A.abort(), A = null), { success: !0 })), n.handle("discussion:inject", async (t, e) => (K.push(e), { success: !0 })), n.handle("registry:add-local", async (t, e) => Be(e)), n.handle("registry:add-remote", async (t, e) => Ge(e)), n.handle("registry:remove", async (t, e, o) => (await Fe(e, o), { success: !0 })), n.handle("shell:open-in-finder", async (t, e) => {
1035
- q.showItemInFolder(u(e, "ABOUT.md"));
1037
+ }), n.handle("discussion:stop", async () => (A && (A.abort(), A = null), { success: !0 })), n.handle("discussion:inject", async (t, e) => (j.push(e), { success: !0 })), n.handle("registry:add-local", async (t, e) => Ge(e)), n.handle("registry:add-remote", async (t, e) => Fe(e)), n.handle("registry:remove", async (t, e, o) => (await We(e, o), { success: !0 })), n.handle("shell:open-in-finder", async (t, e) => {
1038
+ ee.showItemInFolder(u(e, "ABOUT.md"));
1036
1039
  }), n.handle("shell:open-in-terminal", async (t, e) => {
1037
1040
  await R(U)("open", ["-a", "Terminal", e]);
1038
1041
  }), n.handle("shell:open-in-editor", async (t, e) => {
@@ -1040,9 +1043,9 @@ function kt(n, r) {
1040
1043
  try {
1041
1044
  await o("code", [e]);
1042
1045
  } catch {
1043
- q.openPath(e);
1046
+ ee.openPath(e);
1044
1047
  }
1045
- }), n.handle("history:list", async () => dt()), n.handle("history:get", async (t, e) => ae(e)), n.handle("history:delete", async (t, e) => (await mt(e), { success: !0 })), n.handle("infographic:generate", async (t, e, o) => {
1048
+ }), n.handle("history:list", async () => mt()), n.handle("history:get", async (t, e) => ce(e)), n.handle("history:delete", async (t, e) => (await pt(e), { success: !0 })), n.handle("infographic:generate", async (t, e, o) => {
1046
1049
  const s = u(w(), ".ai-council", "config.json");
1047
1050
  let a = { backends: {} };
1048
1051
  try {
@@ -1050,9 +1053,9 @@ function kt(n, r) {
1050
1053
  a = JSON.parse(c);
1051
1054
  } catch {
1052
1055
  }
1053
- const i = await ae(e), l = await ie(i, a, o);
1056
+ const i = await ce(e), l = await le(i, a, o);
1054
1057
  return await ft(e, l), { infographic: l };
1055
- }), n.handle("infographic:delete", async (t, e, o) => (await pt(e, o), { success: !0 })), n.handle("file:read-as-text", async (t, e) => {
1058
+ }), n.handle("infographic:delete", async (t, e, o) => (await ht(e, o), { success: !0 })), n.handle("file:read-as-text", async (t, e) => {
1056
1059
  const o = C(e), s = o.includes(".") ? "." + o.split(".").pop().toLowerCase() : "", a = /* @__PURE__ */ new Set([
1057
1060
  ".txt",
1058
1061
  ".md",
@@ -1147,32 +1150,34 @@ function kt(n, r) {
1147
1150
  }), n.handle("dialog:selectDirectory", async () => {
1148
1151
  const t = r();
1149
1152
  if (!t) return null;
1150
- const e = await be.showOpenDialog(t, {
1153
+ const e = await ke.showOpenDialog(t, {
1151
1154
  properties: ["openDirectory"]
1152
1155
  });
1153
1156
  return e.canceled ? null : e.filePaths[0];
1154
1157
  });
1155
1158
  }
1156
- const vt = Ee(import.meta.url), J = _e(vt), we = u(J, "..", "electron-debug.log");
1159
+ const _t = Ae(import.meta.url), B = Ee(_t), be = u(B, "..", "electron-debug.log");
1157
1160
  function P(n, ...r) {
1158
1161
  const t = `[${(/* @__PURE__ */ new Date()).toISOString()}] [${n}] ${r.map((e) => typeof e == "string" ? e : JSON.stringify(e)).join(" ")}
1159
1162
  `;
1160
- Se(we, t);
1163
+ Oe(be, t);
1161
1164
  }
1162
- Ie(we, `=== AI Council Electron — started ${(/* @__PURE__ */ new Date()).toISOString()} ===
1165
+ Se(be, `=== State Change Council Electron — started ${(/* @__PURE__ */ new Date()).toISOString()} ===
1163
1166
  `);
1167
+ L.name = "State Change Council";
1164
1168
  let _ = null;
1165
- function le() {
1166
- P("main", "Creating BrowserWindow"), _ = new de({
1169
+ function de() {
1170
+ P("main", "Creating BrowserWindow"), _ = new pe({
1167
1171
  width: 1200,
1168
1172
  height: 800,
1169
1173
  minWidth: 800,
1170
1174
  minHeight: 600,
1171
- title: "AI Council",
1175
+ title: "State Change Council",
1176
+ icon: G(B, "..", "assets", "icon.png"),
1172
1177
  webPreferences: {
1173
1178
  contextIsolation: !0,
1174
1179
  nodeIntegration: !1,
1175
- preload: u(J, "preload.mjs")
1180
+ preload: u(B, "preload.mjs")
1176
1181
  }
1177
1182
  }), _.webContents.on("console-message", (r, t, e, o, s) => {
1178
1183
  const a = ["DEBUG", "INFO", "WARN", "ERROR"][t] || "LOG";
@@ -1186,24 +1191,45 @@ function le() {
1186
1191
  if (n)
1187
1192
  P("main", `Loading dev server URL: ${n}`), _.loadURL(n);
1188
1193
  else {
1189
- const r = u(J, "../dist-renderer/index.html");
1194
+ const r = u(B, "../dist-renderer/index.html");
1190
1195
  P("main", `Loading file: ${r}`), _.loadFile(r);
1191
1196
  }
1192
1197
  process.env.VITE_DEV_SERVER_URL && _.webContents.openDevTools(), _.on("closed", () => {
1193
1198
  _ = null;
1194
1199
  });
1195
1200
  }
1196
- ue.registerSchemesAsPrivileged([
1201
+ me.registerSchemesAsPrivileged([
1197
1202
  { scheme: "council-file", privileges: { bypassCSP: !0, supportFetchAPI: !0 } }
1198
1203
  ]);
1199
- j.whenReady().then(() => {
1200
- P("main", "App ready, registering IPC handlers"), ue.handle("council-file", (n) => {
1201
- const r = decodeURIComponent(n.url.replace("council-file://", ""));
1202
- return ke.fetch(Ae(r).href);
1203
- }), kt(ve, () => _), le(), j.on("activate", () => {
1204
- de.getAllWindows().length === 0 && le();
1204
+ L.whenReady().then(() => {
1205
+ P("main", "App ready, registering IPC handlers");
1206
+ const n = "State Change Council", r = [
1207
+ {
1208
+ label: n,
1209
+ submenu: [
1210
+ { role: "about", label: `About ${n}` },
1211
+ { type: "separator" },
1212
+ { role: "services" },
1213
+ { type: "separator" },
1214
+ { role: "hide", label: `Hide ${n}` },
1215
+ { role: "hideOthers" },
1216
+ { role: "unhide" },
1217
+ { type: "separator" },
1218
+ { role: "quit", label: `Quit ${n}` }
1219
+ ]
1220
+ },
1221
+ { role: "fileMenu" },
1222
+ { role: "editMenu" },
1223
+ { role: "viewMenu" },
1224
+ { role: "windowMenu" }
1225
+ ];
1226
+ te.setApplicationMenu(te.buildFromTemplate(r)), me.handle("council-file", (t) => {
1227
+ const e = decodeURIComponent(t.url.replace("council-file://", ""));
1228
+ return ve.fetch(Ie(e).href);
1229
+ }), vt(_e, () => _), de(), L.on("activate", () => {
1230
+ pe.getAllWindows().length === 0 && de();
1205
1231
  });
1206
1232
  });
1207
- j.on("window-all-closed", () => {
1208
- process.platform !== "darwin" && j.quit();
1233
+ L.on("window-all-closed", () => {
1234
+ process.platform !== "darwin" && L.quit();
1209
1235
  });