gnosys 5.9.2 → 5.9.4

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 (136) hide show
  1. package/dist/cli.js +311 -147
  2. package/dist/cli.js.map +1 -1
  3. package/dist/lib/chat/index.d.ts.map +1 -1
  4. package/dist/lib/chat/index.js +5 -0
  5. package/dist/lib/chat/index.js.map +1 -1
  6. package/dist/lib/cleanup.d.ts +52 -0
  7. package/dist/lib/cleanup.d.ts.map +1 -0
  8. package/dist/lib/cleanup.js +168 -0
  9. package/dist/lib/cleanup.js.map +1 -0
  10. package/dist/lib/config.d.ts +7 -0
  11. package/dist/lib/config.d.ts.map +1 -1
  12. package/dist/lib/config.js +41 -2
  13. package/dist/lib/config.js.map +1 -1
  14. package/dist/lib/dream.d.ts.map +1 -1
  15. package/dist/lib/dream.js +13 -2
  16. package/dist/lib/dream.js.map +1 -1
  17. package/dist/lib/paths.d.ts +8 -0
  18. package/dist/lib/paths.d.ts.map +1 -1
  19. package/dist/lib/paths.js +15 -0
  20. package/dist/lib/paths.js.map +1 -1
  21. package/dist/lib/remote.d.ts +11 -0
  22. package/dist/lib/remote.d.ts.map +1 -1
  23. package/dist/lib/remote.js +26 -2
  24. package/dist/lib/remote.js.map +1 -1
  25. package/dist/lib/remoteWizard.d.ts.map +1 -1
  26. package/dist/lib/remoteWizard.js +112 -52
  27. package/dist/lib/remoteWizard.js.map +1 -1
  28. package/dist/lib/setup/coldStart.d.ts +71 -0
  29. package/dist/lib/setup/coldStart.d.ts.map +1 -0
  30. package/dist/lib/setup/coldStart.js +122 -0
  31. package/dist/lib/setup/coldStart.js.map +1 -0
  32. package/dist/lib/setup/configSetRender.d.ts +26 -0
  33. package/dist/lib/setup/configSetRender.d.ts.map +1 -0
  34. package/dist/lib/setup/configSetRender.js +103 -0
  35. package/dist/lib/setup/configSetRender.js.map +1 -0
  36. package/dist/lib/setup/dreamRender.d.ts +44 -0
  37. package/dist/lib/setup/dreamRender.d.ts.map +1 -0
  38. package/dist/lib/setup/dreamRender.js +55 -0
  39. package/dist/lib/setup/dreamRender.js.map +1 -0
  40. package/dist/lib/setup/dreamState.d.ts +50 -0
  41. package/dist/lib/setup/dreamState.d.ts.map +1 -0
  42. package/dist/lib/setup/dreamState.js +68 -0
  43. package/dist/lib/setup/dreamState.js.map +1 -0
  44. package/dist/lib/setup/modelsRender.d.ts +25 -0
  45. package/dist/lib/setup/modelsRender.d.ts.map +1 -0
  46. package/dist/lib/setup/modelsRender.js +33 -0
  47. package/dist/lib/setup/modelsRender.js.map +1 -0
  48. package/dist/lib/setup/remoteRender.d.ts +43 -0
  49. package/dist/lib/setup/remoteRender.d.ts.map +1 -0
  50. package/dist/lib/setup/remoteRender.js +65 -0
  51. package/dist/lib/setup/remoteRender.js.map +1 -0
  52. package/dist/lib/setup/routingRender.d.ts +48 -0
  53. package/dist/lib/setup/routingRender.d.ts.map +1 -0
  54. package/dist/lib/setup/routingRender.js +114 -0
  55. package/dist/lib/setup/routingRender.js.map +1 -0
  56. package/dist/lib/setup/sections/ides.d.ts +8 -0
  57. package/dist/lib/setup/sections/ides.d.ts.map +1 -1
  58. package/dist/lib/setup/sections/ides.js +88 -33
  59. package/dist/lib/setup/sections/ides.js.map +1 -1
  60. package/dist/lib/setup/sections/preferences.d.ts +8 -0
  61. package/dist/lib/setup/sections/preferences.d.ts.map +1 -1
  62. package/dist/lib/setup/sections/preferences.js +54 -20
  63. package/dist/lib/setup/sections/preferences.js.map +1 -1
  64. package/dist/lib/setup/sections/routing.d.ts +0 -1
  65. package/dist/lib/setup/sections/routing.d.ts.map +1 -1
  66. package/dist/lib/setup/sections/routing.js +80 -38
  67. package/dist/lib/setup/sections/routing.js.map +1 -1
  68. package/dist/lib/setup/storePath.d.ts +30 -0
  69. package/dist/lib/setup/storePath.d.ts.map +1 -0
  70. package/dist/lib/setup/storePath.js +47 -0
  71. package/dist/lib/setup/storePath.js.map +1 -0
  72. package/dist/lib/setup/summary.d.ts +33 -19
  73. package/dist/lib/setup/summary.d.ts.map +1 -1
  74. package/dist/lib/setup/summary.js +148 -113
  75. package/dist/lib/setup/summary.js.map +1 -1
  76. package/dist/lib/setup/syncProjectsRender.d.ts +57 -0
  77. package/dist/lib/setup/syncProjectsRender.d.ts.map +1 -0
  78. package/dist/lib/setup/syncProjectsRender.js +184 -0
  79. package/dist/lib/setup/syncProjectsRender.js.map +1 -0
  80. package/dist/lib/setup/ui/diff.d.ts +19 -0
  81. package/dist/lib/setup/ui/diff.d.ts.map +1 -0
  82. package/dist/lib/setup/ui/diff.js +34 -0
  83. package/dist/lib/setup/ui/diff.js.map +1 -0
  84. package/dist/lib/setup/ui/footer.d.ts +11 -0
  85. package/dist/lib/setup/ui/footer.d.ts.map +1 -0
  86. package/dist/lib/setup/ui/footer.js +21 -0
  87. package/dist/lib/setup/ui/footer.js.map +1 -0
  88. package/dist/lib/setup/ui/header.d.ts +24 -0
  89. package/dist/lib/setup/ui/header.d.ts.map +1 -0
  90. package/dist/lib/setup/ui/header.js +49 -0
  91. package/dist/lib/setup/ui/header.js.map +1 -0
  92. package/dist/lib/setup/ui/index.d.ts +28 -0
  93. package/dist/lib/setup/ui/index.d.ts.map +1 -0
  94. package/dist/lib/setup/ui/index.js +19 -0
  95. package/dist/lib/setup/ui/index.js.map +1 -0
  96. package/dist/lib/setup/ui/menu.d.ts +27 -0
  97. package/dist/lib/setup/ui/menu.d.ts.map +1 -0
  98. package/dist/lib/setup/ui/menu.js +75 -0
  99. package/dist/lib/setup/ui/menu.js.map +1 -0
  100. package/dist/lib/setup/ui/panel.d.ts +23 -0
  101. package/dist/lib/setup/ui/panel.d.ts.map +1 -0
  102. package/dist/lib/setup/ui/panel.js +60 -0
  103. package/dist/lib/setup/ui/panel.js.map +1 -0
  104. package/dist/lib/setup/ui/prompt.d.ts +27 -0
  105. package/dist/lib/setup/ui/prompt.d.ts.map +1 -0
  106. package/dist/lib/setup/ui/prompt.js +38 -0
  107. package/dist/lib/setup/ui/prompt.js.map +1 -0
  108. package/dist/lib/setup/ui/safePrompt.d.ts +24 -0
  109. package/dist/lib/setup/ui/safePrompt.d.ts.map +1 -0
  110. package/dist/lib/setup/ui/safePrompt.js +71 -0
  111. package/dist/lib/setup/ui/safePrompt.js.map +1 -0
  112. package/dist/lib/setup/ui/spinner.d.ts +28 -0
  113. package/dist/lib/setup/ui/spinner.d.ts.map +1 -0
  114. package/dist/lib/setup/ui/spinner.js +87 -0
  115. package/dist/lib/setup/ui/spinner.js.map +1 -0
  116. package/dist/lib/setup/ui/status.d.ts +21 -0
  117. package/dist/lib/setup/ui/status.d.ts.map +1 -0
  118. package/dist/lib/setup/ui/status.js +49 -0
  119. package/dist/lib/setup/ui/status.js.map +1 -0
  120. package/dist/lib/setup/ui/table.d.ts +37 -0
  121. package/dist/lib/setup/ui/table.d.ts.map +1 -0
  122. package/dist/lib/setup/ui/table.js +82 -0
  123. package/dist/lib/setup/ui/table.js.map +1 -0
  124. package/dist/lib/setup/ui/title.d.ts +14 -0
  125. package/dist/lib/setup/ui/title.d.ts.map +1 -0
  126. package/dist/lib/setup/ui/title.js +24 -0
  127. package/dist/lib/setup/ui/title.js.map +1 -0
  128. package/dist/lib/setup/ui/tokens.d.ts +66 -0
  129. package/dist/lib/setup/ui/tokens.d.ts.map +1 -0
  130. package/dist/lib/setup/ui/tokens.js +87 -0
  131. package/dist/lib/setup/ui/tokens.js.map +1 -0
  132. package/dist/lib/setup.d.ts +38 -0
  133. package/dist/lib/setup.d.ts.map +1 -1
  134. package/dist/lib/setup.js +440 -308
  135. package/dist/lib/setup.js.map +1 -1
  136. package/package.json +1 -1
@@ -0,0 +1,103 @@
1
+ /**
2
+ * Render helpers for `gnosys config set` (Screen 13).
3
+ *
4
+ * Provides:
5
+ * - Schema/key validation against a known set of config keys
6
+ * - Levenshtein-based "did you mean?" suggestion on typo
7
+ * - Helpers to label the active store as `(project)` or `(global)`
8
+ *
9
+ * Output rendering is deferred to the cli.ts action so we don't drag the
10
+ * full config schema into this module — but the validator and the
11
+ * suggestion logic are pure and snapshot-testable.
12
+ */
13
+ import path from "path";
14
+ /**
15
+ * Known top-level keys accepted by `gnosys config set`. Mirrors the switch
16
+ * cases in cli.ts; keep these in sync when a new branch is added.
17
+ */
18
+ export const KNOWN_CONFIG_KEYS = [
19
+ "provider",
20
+ "model",
21
+ "task",
22
+ "ollama-url",
23
+ "ollama-model",
24
+ "anthropic-model",
25
+ "groq-model",
26
+ "openai-model",
27
+ "openai-url",
28
+ "lmstudio-url",
29
+ "lmstudio-model",
30
+ "xai-model",
31
+ "mistral-model",
32
+ "custom-url",
33
+ "custom-model",
34
+ "custom-key",
35
+ "recall",
36
+ ];
37
+ /**
38
+ * Validate a user-supplied config key. Returns the closest known key
39
+ * (by edit distance) when the input doesn't match exactly. The caller
40
+ * uses the suggestion to render a `did you mean X?` hint.
41
+ */
42
+ export function suggestConfigKey(input) {
43
+ if (KNOWN_CONFIG_KEYS.includes(input))
44
+ return null;
45
+ let best = null;
46
+ let bestDist = Infinity;
47
+ for (const candidate of KNOWN_CONFIG_KEYS) {
48
+ const d = levenshtein(input, candidate);
49
+ if (d < bestDist) {
50
+ bestDist = d;
51
+ best = candidate;
52
+ }
53
+ }
54
+ // Only suggest when the edit distance is small enough to be plausibly
55
+ // a typo. Anything > 3 is a wild miss — don't suggest.
56
+ return bestDist <= 3 ? best : null;
57
+ }
58
+ /**
59
+ * Classify a store path as `project` or `global`. Used to label both the
60
+ * Diff row and the "saved" status line so the user always knows which
61
+ * store was touched.
62
+ *
63
+ * The convention: store paths under `~/.gnosys` (the central user store)
64
+ * count as global; everything else is project-scoped.
65
+ */
66
+ export function classifyStore(storePath, homeDir) {
67
+ const globalPath = path.join(homeDir, ".gnosys");
68
+ // Normalize both sides for the comparison so symlinks / trailing slashes
69
+ // don't trip a false negative.
70
+ const norm = path.resolve(storePath);
71
+ return norm === path.resolve(globalPath) ? "global" : "project";
72
+ }
73
+ /**
74
+ * Compute the Levenshtein edit distance between two strings. Small inputs
75
+ * only — config keys are at most ~20 chars.
76
+ */
77
+ export function levenshtein(a, b) {
78
+ if (a === b)
79
+ return 0;
80
+ if (a.length === 0)
81
+ return b.length;
82
+ if (b.length === 0)
83
+ return a.length;
84
+ const m = a.length;
85
+ const n = b.length;
86
+ const prev = new Array(n + 1);
87
+ const curr = new Array(n + 1);
88
+ for (let j = 0; j <= n; j++)
89
+ prev[j] = j;
90
+ for (let i = 1; i <= m; i++) {
91
+ curr[0] = i;
92
+ for (let j = 1; j <= n; j++) {
93
+ const cost = a.charCodeAt(i - 1) === b.charCodeAt(j - 1) ? 0 : 1;
94
+ curr[j] = Math.min(curr[j - 1] + 1, // insertion
95
+ prev[j] + 1, // deletion
96
+ prev[j - 1] + cost);
97
+ }
98
+ for (let j = 0; j <= n; j++)
99
+ prev[j] = curr[j];
100
+ }
101
+ return prev[n];
102
+ }
103
+ //# sourceMappingURL=configSetRender.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"configSetRender.js","sourceRoot":"","sources":["../../../src/lib/setup/configSetRender.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB;;;GAGG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAsB;IAClD,UAAU;IACV,OAAO;IACP,MAAM;IACN,YAAY;IACZ,cAAc;IACd,iBAAiB;IACjB,YAAY;IACZ,cAAc;IACd,YAAY;IACZ,cAAc;IACd,gBAAgB;IAChB,WAAW;IACX,eAAe;IACf,YAAY;IACZ,cAAc;IACd,YAAY;IACZ,QAAQ;CACT,CAAC;AAEF;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAAa;IAC5C,IAAI,iBAAiB,CAAC,QAAQ,CAAC,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IACnD,IAAI,IAAI,GAAkB,IAAI,CAAC;IAC/B,IAAI,QAAQ,GAAG,QAAQ,CAAC;IACxB,KAAK,MAAM,SAAS,IAAI,iBAAi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,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE;QAAE,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IACzC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QAC5B,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;QACZ,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;YAC5B,MAAM,IAAI,GAAG,CAAC,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YACjE,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAChB,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,EAAY,YAAY;YACvC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,EAAgB,WAAW;YACtC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,CACnB,CAAC;QACJ,CAAC;QACD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE;YAAE,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;IACjD,CAAC;IACD,OAAO,IAAI,CAAC,CAAC,CAAC,CAAC;AACjB,CAAC"}
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Render helpers for `gnosys setup dream` (Screen 7).
3
+ *
4
+ * The wizard runs inside `runDreamSetup` (in `setup.ts`); this module
5
+ * owns only the pure helpers that are easy to snapshot-test:
6
+ *
7
+ * - buildDreamDiffRows: the 4-row before/after summary printed at the
8
+ * end of the three-step flow
9
+ * - renderThresholdsBlock: the static "thresholds + sub-tasks" panel
10
+ * rendered on screen 7.2 with default values inside fake `[N ]`
11
+ * fields
12
+ */
13
+ export interface DreamDiffRow {
14
+ label: string;
15
+ from: string;
16
+ to: string;
17
+ }
18
+ export interface DreamSettings {
19
+ provider: string;
20
+ model?: string;
21
+ machine: string;
22
+ idleMinutes: number;
23
+ maxRuntimeMinutes: number;
24
+ selfCritique: boolean;
25
+ generateSummaries: boolean;
26
+ discoverRelationships: boolean;
27
+ }
28
+ /**
29
+ * Build the four canonical rows for the post-save Diff block. Always
30
+ * emits the same four labels so users have a consistent footprint
31
+ * across machines.
32
+ */
33
+ export declare function buildDreamDiffRows(prev: Partial<DreamSettings> | null, next: DreamSettings): DreamDiffRow[];
34
+ /**
35
+ * Render the static thresholds/sub-tasks block from screen 7.2. Returns
36
+ * an array of lines (no trailing newline). The wizard prints these
37
+ * before asking for `enter | e`.
38
+ */
39
+ export declare function renderThresholdsBlock(idleMinutes: number, maxRuntimeMinutes: number, minMemories: number, subs: {
40
+ selfCritique: boolean;
41
+ generateSummaries: boolean;
42
+ discoverRelationships: boolean;
43
+ }): string[];
44
+ //# sourceMappingURL=dreamRender.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dreamRender.d.ts","sourceRoot":"","sources":["../../../src/lib/setup/dreamRender.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,YAAY,EAAE,OAAO,CAAC;IACtB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,qBAAqB,EAAE,OAAO,CAAC;CAChC;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,OAAO,CAAC,aAAa,CAAC,GAAG,IAAI,EAAE,IAAI,EAAE,aAAa,GAAG,YAAY,EAAE,CAiB3G;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CACnC,WAAW,EAAE,MAAM,EACnB,iBAAiB,EAAE,MAAM,EACzB,WAAW,EAAE,MAAM,EACnB,IAAI,EAAE;IAAE,YAAY,EAAE,OAAO,CAAC;IAAC,iBAAiB,EAAE,OAAO,CAAC;IAAC,qBAAqB,EAAE,OAAO,CAAA;CAAE,GAC1F,MAAM,EAAE,CAaV"}
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Render helpers for `gnosys setup dream` (Screen 7).
3
+ *
4
+ * The wizard runs inside `runDreamSetup` (in `setup.ts`); this module
5
+ * owns only the pure helpers that are easy to snapshot-test:
6
+ *
7
+ * - buildDreamDiffRows: the 4-row before/after summary printed at the
8
+ * end of the three-step flow
9
+ * - renderThresholdsBlock: the static "thresholds + sub-tasks" panel
10
+ * rendered on screen 7.2 with default values inside fake `[N ]`
11
+ * fields
12
+ */
13
+ /**
14
+ * Build the four canonical rows for the post-save Diff block. Always
15
+ * emits the same four labels so users have a consistent footprint
16
+ * across machines.
17
+ */
18
+ export function buildDreamDiffRows(prev, next) {
19
+ const prevProvider = prev?.provider ? `${prev.provider}${prev.model ? " / " + prev.model : ""}` : "—";
20
+ const nextProvider = `${next.provider}${next.model ? " / " + next.model : ""}`;
21
+ return [
22
+ { label: "provider", from: prevProvider, to: nextProvider },
23
+ { label: "machine", from: prev?.machine ?? "—", to: next.machine },
24
+ {
25
+ label: "idle threshold",
26
+ from: prev?.idleMinutes !== undefined ? `${prev.idleMinutes} min` : "—",
27
+ to: `${next.idleMinutes} min`,
28
+ },
29
+ {
30
+ label: "max runtime",
31
+ from: prev?.maxRuntimeMinutes !== undefined ? `${prev.maxRuntimeMinutes} min` : "—",
32
+ to: `${next.maxRuntimeMinutes} min`,
33
+ },
34
+ ];
35
+ }
36
+ /**
37
+ * Render the static thresholds/sub-tasks block from screen 7.2. Returns
38
+ * an array of lines (no trailing newline). The wizard prints these
39
+ * before asking for `enter | e`.
40
+ */
41
+ export function renderThresholdsBlock(idleMinutes, maxRuntimeMinutes, minMemories, subs) {
42
+ const fmt = (n) => String(n).padEnd(3);
43
+ return [
44
+ ` when to run`,
45
+ ` idle threshold [${fmt(idleMinutes)}] minutes wait this long before starting`,
46
+ ` max runtime [${fmt(maxRuntimeMinutes)}] minutes cap each cycle to avoid runaway`,
47
+ ` min memories [${fmt(minMemories)}] only run if there's enough new material`,
48
+ "",
49
+ ` what to do`,
50
+ ` ${subs.selfCritique ? "✓" : "○"} self-critique review and re-rank existing memories`,
51
+ ` ${subs.generateSummaries ? "✓" : "○"} generate summaries produce a "what changed today" digest`,
52
+ ` ${subs.discoverRelationships ? "✓" : "○"} discover relationships link related memories explicitly`,
53
+ ];
54
+ }
55
+ //# sourceMappingURL=dreamRender.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dreamRender.js","sourceRoot":"","sources":["../../../src/lib/setup/dreamRender.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAmBH;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAAC,IAAmC,EAAE,IAAmB;IACzF,MAAM,YAAY,GAAG,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC;IACtG,MAAM,YAAY,GAAG,GAAG,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;IAC/E,OAAO;QACL,EAAE,KAAK,EAAE,UAAU,EAA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AC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,4DAA4D;KAC3G,CAAC;AACJ,CAAC"}
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Dream-state reconciler (v5.9.4 Bugs 7 + 8).
3
+ *
4
+ * Three sources of truth need to agree before we can display "dream mode
5
+ * is enabled · machine X" with confidence:
6
+ *
7
+ * 1. `cfg.dream.enabled` / `cfg.dream.provider` / `cfg.dream.model`
8
+ * live in gnosys.json
9
+ * 2. `dream_machine_id` lives in the LOCAL central DB meta table
10
+ * 3. `dream_machine_id` may ALSO live in the REMOTE DB (when multi-machine
11
+ * sync is configured)
12
+ *
13
+ * Before v5.9.4 the summary panel only checked (1) and re-entry into the
14
+ * dream wizard only checked (2). Switching machines or enabling dream from
15
+ * a different machine caused both screens to show stale "no designated
16
+ * machine" or "dream mode disabled" messages.
17
+ *
18
+ * `getDreamState()` is the single source of truth used by every caller.
19
+ */
20
+ import type { GnosysDB } from "../db.js";
21
+ import type { GnosysConfig } from "../config.js";
22
+ /** Where the active dream state came from. */
23
+ export type DreamStateSource = "config" | "local-db" | "remote-db" | "default";
24
+ export interface DreamState {
25
+ /** True if any source advertises dream mode as active. */
26
+ enabled: boolean;
27
+ /** Designated dream machine id, or null when nothing claims the role. */
28
+ machineId: string | null;
29
+ /** Effective dream provider name (e.g. anthropic, ollama). */
30
+ provider: string;
31
+ /** Effective dream model name (may be empty when provider has no default). */
32
+ model: string;
33
+ /** Which source we trusted for the `enabled` + `machineId` fields. */
34
+ source: DreamStateSource;
35
+ }
36
+ /**
37
+ * Reconcile dream state across config + local DB meta + (optional) remote DB
38
+ * meta. `dream.enabled` is treated as a positive signal from any of the
39
+ * sources — a designated machine id in EITHER DB beats `cfg.dream.enabled: false`
40
+ * because that indicates a real session enabled it elsewhere.
41
+ *
42
+ * Source precedence for the `machineId` field:
43
+ * - local DB wins when set
44
+ * - remote DB falls in next (for first-time setup on a new machine)
45
+ * - config still drives provider/model regardless
46
+ */
47
+ export declare function getDreamState(cfg: GnosysConfig, localDb: GnosysDB | null, remoteDb?: GnosysDB | null): DreamState;
48
+ /** Describe a dream state in one line for the settings summary panel. */
49
+ export declare function describeDreamState(state: DreamState): string;
50
+ //# sourceMappingURL=dreamState.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dreamState.d.ts","sourceRoot":"","sources":["../../../src/lib/setup/dreamState.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEjD,8CAA8C;AAC9C,MAAM,MAAM,gBAAgB,GAAG,QAAQ,GAAG,UAAU,GAAG,WAAW,GAAG,SAAS,CAAC;AAE/E,MAAM,WAAW,UAAU;IACzB,0DAA0D;IAC1D,OAAO,EAAE,OAAO,CAAC;IACjB,yEAAyE;IACzE,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,8DAA8D;IAC9D,QAAQ,EAAE,MAAM,CAAC;IACjB,8EAA8E;IAC9E,KAAK,EAAE,MAAM,CAAC;IACd,sEAAsE;IACtE,MAAM,EAAE,gBAAgB,CAAC;CAC1B;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,aAAa,CAC3B,GAAG,EAAE,YAAY,EACjB,OAAO,EAAE,QAAQ,GAAG,IAAI,EACxB,QAAQ,GAAE,QAAQ,GAAG,IAAW,GAC/B,UAAU,CAoBZ;AAED,yEAAyE;AACzE,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAK5D"}
@@ -0,0 +1,68 @@
1
+ /**
2
+ * Dream-state reconciler (v5.9.4 Bugs 7 + 8).
3
+ *
4
+ * Three sources of truth need to agree before we can display "dream mode
5
+ * is enabled · machine X" with confidence:
6
+ *
7
+ * 1. `cfg.dream.enabled` / `cfg.dream.provider` / `cfg.dream.model`
8
+ * live in gnosys.json
9
+ * 2. `dream_machine_id` lives in the LOCAL central DB meta table
10
+ * 3. `dream_machine_id` may ALSO live in the REMOTE DB (when multi-machine
11
+ * sync is configured)
12
+ *
13
+ * Before v5.9.4 the summary panel only checked (1) and re-entry into the
14
+ * dream wizard only checked (2). Switching machines or enabling dream from
15
+ * a different machine caused both screens to show stale "no designated
16
+ * machine" or "dream mode disabled" messages.
17
+ *
18
+ * `getDreamState()` is the single source of truth used by every caller.
19
+ */
20
+ /**
21
+ * Reconcile dream state across config + local DB meta + (optional) remote DB
22
+ * meta. `dream.enabled` is treated as a positive signal from any of the
23
+ * sources — a designated machine id in EITHER DB beats `cfg.dream.enabled: false`
24
+ * because that indicates a real session enabled it elsewhere.
25
+ *
26
+ * Source precedence for the `machineId` field:
27
+ * - local DB wins when set
28
+ * - remote DB falls in next (for first-time setup on a new machine)
29
+ * - config still drives provider/model regardless
30
+ */
31
+ export function getDreamState(cfg, localDb, remoteDb = null) {
32
+ const configEnabled = !!cfg.dream?.enabled;
33
+ const provider = cfg.dream?.provider ?? "ollama";
34
+ const model = cfg.dream?.model ?? "";
35
+ const localMachineId = safeReadDreamMachineId(localDb);
36
+ const remoteMachineId = safeReadDreamMachineId(remoteDb);
37
+ let machineId = null;
38
+ let source = configEnabled ? "config" : "default";
39
+ if (localMachineId) {
40
+ machineId = localMachineId;
41
+ source = "local-db";
42
+ }
43
+ else if (remoteMachineId) {
44
+ machineId = remoteMachineId;
45
+ source = "remote-db";
46
+ }
47
+ const enabled = configEnabled || machineId !== null;
48
+ return { enabled, machineId, provider, model, source };
49
+ }
50
+ /** Describe a dream state in one line for the settings summary panel. */
51
+ export function describeDreamState(state) {
52
+ if (!state.enabled)
53
+ return "disabled";
54
+ const machinePart = state.machineId ? ` · ${state.machineId}` : "";
55
+ const modelPart = state.model ? `${state.provider} / ${state.model}` : state.provider;
56
+ return `${modelPart}${machinePart}`;
57
+ }
58
+ function safeReadDreamMachineId(db) {
59
+ if (!db)
60
+ return null;
61
+ try {
62
+ return db.getDreamMachineId();
63
+ }
64
+ catch {
65
+ return null;
66
+ }
67
+ }
68
+ //# sourceMappingURL=dreamState.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dreamState.js","sourceRoot":"","sources":["../../../src/lib/setup/dreamState.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAqBH;;;;;;;;;;GAUG;AACH,MAAM,UAAU,aAAa,CAC3B,GAAiB,EACjB,OAAwB,EACxB,WAA4B,IAAI;IAEhC,MAAM,aAAa,GAAG,CAAC,CAAC,GAAG,CAAC,KAAK,EAAE,OAAO,CAAC;IAC3C,MAAM,QAAQ,GAAG,GAAG,CAAC,KAAK,EAAE,QAAQ,IAAI,QAAQ,CAAC;IACjD,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,EAAE,KAAK,IAAI,EAAE,CAAC;IAErC,MAAM,cAAc,GAAG,sBAAsB,CAAC,OAAO,CAAC,CAAC;IACvD,MAAM,eAAe,GAAG,sBAAsB,CAAC,QAAQ,CAAC,CAAC;IAEzD,IAAI,SAAS,GAAkB,IAAI,CAAC;IACpC,IAAI,MAAM,GAAqB,aAAa,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC;IACpE,IAAI,cAAc,EAAE,CAAC;QACnB,SAAS,GAAG,cAAc,CAAC;QAC3B,MAAM,GAAG,UAAU,CAAC;IACtB,CAAC;SAAM,IAAI,eAAe,EAAE,CAAC;QAC3B,SAAS,GAAG,eAAe,CAAC;QAC5B,MAAM,GAAG,WAAW,CAAC;IACvB,CAAC;IAED,MAAM,OAAO,GAAG,aAAa,IAAI,SAAS,KAAK,IAAI,CAAC;IACpD,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;AACzD,CAAC;AAED,yEAAyE;AACzE,MAAM,UAAU,kBAAkB,CAAC,KAAiB;IAClD,IAAI,CAAC,KAAK,CAAC,OAAO;QAAE,OAAO,UAAU,CAAC;IACtC,MAAM,WAAW,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,KAAK,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IACnE,MAAM,SAAS,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,QAAQ,MAAM,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC;IACtF,OAAO,GAAG,SAAS,GAAG,WAAW,EAAE,CAAC;AACtC,CAAC;AAED,SAAS,sBAAsB,CAAC,EAAmB;IACjD,IAAI,CAAC,EAAE;QAAE,OAAO,IAAI,CAAC;IACrB,IAAI,CAAC;QACH,OAAO,EAAE,CAAC,iBAAiB,EAAE,CAAC;IAChC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Render helpers for `gnosys setup models` (Screen 3).
3
+ *
4
+ * Currently only owns the small pre-save diff-row builder. The rest of
5
+ * the screen's chrome (Header, Title, Spinner, Diff, Status) lives in
6
+ * `runModelsSetup` and is composed inline so we don't drag the entire
7
+ * provider/model picker through a render layer it doesn't need.
8
+ */
9
+ export interface ModelDiffRow {
10
+ label: string;
11
+ from: string;
12
+ to: string;
13
+ }
14
+ /**
15
+ * Build the Diff rows for the pre-save block. Always returns at least
16
+ * two rows (`provider` + `model`) so the user can see what landed in
17
+ * gnosys.json, even when nothing actually changed.
18
+ *
19
+ * - If the new provider differs from the current one, emit the row.
20
+ * - If the new model differs from the current one, emit the row.
21
+ * - When neither changed, emit two rows showing the (unchanged) values
22
+ * so the diff block isn't empty.
23
+ */
24
+ export declare function buildModelsDiffRows(currentProvider: string | undefined, currentModel: string | undefined, newProvider: string, newModel: string): ModelDiffRow[];
25
+ //# sourceMappingURL=modelsRender.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"modelsRender.d.ts","sourceRoot":"","sources":["../../../src/lib/setup/modelsRender.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;CACZ;AAED;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CACjC,eAAe,EAAE,MAAM,GAAG,SAAS,EACnC,YAAY,EAAE,MAAM,GAAG,SAAS,EAChC,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,MAAM,GACf,YAAY,EAAE,CAahB"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Render helpers for `gnosys setup models` (Screen 3).
3
+ *
4
+ * Currently only owns the small pre-save diff-row builder. The rest of
5
+ * the screen's chrome (Header, Title, Spinner, Diff, Status) lives in
6
+ * `runModelsSetup` and is composed inline so we don't drag the entire
7
+ * provider/model picker through a render layer it doesn't need.
8
+ */
9
+ /**
10
+ * Build the Diff rows for the pre-save block. Always returns at least
11
+ * two rows (`provider` + `model`) so the user can see what landed in
12
+ * gnosys.json, even when nothing actually changed.
13
+ *
14
+ * - If the new provider differs from the current one, emit the row.
15
+ * - If the new model differs from the current one, emit the row.
16
+ * - When neither changed, emit two rows showing the (unchanged) values
17
+ * so the diff block isn't empty.
18
+ */
19
+ export function buildModelsDiffRows(currentProvider, currentModel, newProvider, newModel) {
20
+ const rows = [];
21
+ if (currentProvider && currentProvider !== newProvider) {
22
+ rows.push({ label: "provider", from: currentProvider, to: newProvider });
23
+ }
24
+ if (currentModel && currentModel !== newModel) {
25
+ rows.push({ label: "model", from: currentModel, to: newModel });
26
+ }
27
+ if (rows.length === 0) {
28
+ rows.push({ label: "provider", from: currentProvider ?? "(unset)", to: newProvider });
29
+ rows.push({ label: "model", from: currentModel ?? "(unset)", to: newModel });
30
+ }
31
+ return rows;
32
+ }
33
+ //# sourceMappingURL=modelsRender.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"modelsRender.js","sourceRoot":"","sources":["../../../src/lib/setup/modelsRender.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAQH;;;;;;;;;GASG;AACH,MAAM,UAAU,mBAAmB,CACjC,eAAmC,EACnC,YAAgC,EAChC,WAAmB,EACnB,QAAgB;IAEhB,MAAM,IAAI,GAAmB,EAAE,CAAC;IAChC,IAAI,eAAe,IAAI,eAAe,KAAK,WAAW,EAAE,CAAC;QACvD,IAAI,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,eAAe,EAAE,EAAE,EAAE,WAAW,EAAE,CAAC,CAAC;IAC3E,CAAC;IACD,IAAI,YAAY,IAAI,YAAY,KAAK,QAAQ,EAAE,CAAC;QAC9C,IAAI,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAC;IAClE,CAAC;IACD,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACtB,IAAI,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,eAAe,IAAI,SAAS,EAAE,EAAE,EAAE,WAAW,EAAE,CAAC,CAAC;QACtF,IAAI,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,YAAY,IAAI,SAAS,EAAE,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAC;IAC/E,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Sync mode picked in the hierarchical mode menu. Persisted to the
3
+ * `remote_mode` meta key so other tooling can read it back.
4
+ */
5
+ export type SyncMode = "read-write" | "pull-only" | "push-only";
6
+ /** Description for each mode — shown as the meta column in the picker. */
7
+ export declare const SYNC_MODE_LABELS: Record<SyncMode, string>;
8
+ /**
9
+ * Render the validation summary as a bullet list of `✓`/`✗` rows.
10
+ *
11
+ * Replaces `showValidationSummary` in the wizard. Each check is one
12
+ * Status() line — easier to scan than the old col-aligned text dump.
13
+ */
14
+ export interface ValidationSummaryInput {
15
+ pathExists: boolean;
16
+ writable: boolean;
17
+ sqliteCompatible: boolean;
18
+ latencyMs: number | null;
19
+ existing?: {
20
+ found: boolean;
21
+ memoryCount: number | null;
22
+ lastModified: string | null;
23
+ };
24
+ warnings: string[];
25
+ errors: string[];
26
+ }
27
+ export declare function renderValidationSummary(v: ValidationSummaryInput): string;
28
+ /**
29
+ * Render the leading Header + current-status line for the remote wizard.
30
+ * Returns a multi-line string the wizard can print as-is.
31
+ */
32
+ export declare function renderRemoteIntro(localActive: number, localArchived: number, currentRemote: string | null): string;
33
+ /**
34
+ * Render the final Diff block summarizing what changed at the end of
35
+ * the wizard run.
36
+ */
37
+ export interface RemoteDiffInput {
38
+ previousRemote: string | null;
39
+ newRemote: string;
40
+ mode: SyncMode;
41
+ }
42
+ export declare function renderRemoteDiff(d: RemoteDiffInput): string;
43
+ //# sourceMappingURL=remoteRender.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remoteRender.d.ts","sourceRoot":"","sources":["../../../src/lib/setup/remoteRender.ts"],"names":[],"mappings":"AAYA;;;GAGG;AACH,MAAM,MAAM,QAAQ,GAAG,YAAY,GAAG,WAAW,GAAG,WAAW,CAAC;AAEhE,0EAA0E;AAC1E,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,QAAQ,EAAE,MAAM,CAIrD,CAAC;AAEF;;;;;GAKG;AACH,MAAM,WAAW,sBAAsB;IACrC,UAAU,EAAE,OAAO,CAAC;IACpB,QAAQ,EAAE,OAAO,CAAC;IAClB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,QAAQ,CAAC,EAAE;QAAE,KAAK,EAAE,OAAO,CAAC;QAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC;IACvF,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAED,wBAAgB,uBAAuB,CAAC,CAAC,EAAE,sBAAsB,GAAG,MAAM,CAgBzE;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,WAAW,EAAE,MAAM,EACnB,aAAa,EAAE,MAAM,EACrB,aAAa,EAAE,MAAM,GAAG,IAAI,GAC3B,MAAM,CAWR;AAED;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,QAAQ,CAAC;CAChB;AAED,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,eAAe,GAAG,MAAM,CAW3D"}
@@ -0,0 +1,65 @@
1
+ /**
2
+ * Render helpers for `gnosys setup remote` (Screen 6).
3
+ *
4
+ * The wizard's flow is in `lib/remoteWizard.ts`; this module owns only
5
+ * the pure render functions and the sync-mode picker payload so the
6
+ * layout can be snapshot-tested without spinning up an interactive
7
+ * readline.
8
+ */
9
+ import { c, color, glyph } from "./ui/tokens.js";
10
+ import { Header } from "./ui/header.js";
11
+ import { Status } from "./ui/status.js";
12
+ /** Description for each mode — shown as the meta column in the picker. */
13
+ export const SYNC_MODE_LABELS = {
14
+ "read-write": "this machine reads and writes",
15
+ "pull-only": "read remote, never write",
16
+ "push-only": "write to remote, never read locally",
17
+ };
18
+ export function renderValidationSummary(v) {
19
+ const lines = [];
20
+ lines.push(Status(v.pathExists ? "ok" : "fail", "path exists"));
21
+ lines.push(Status(v.writable ? "ok" : "fail", "writable"));
22
+ lines.push(Status(v.sqliteCompatible ? "ok" : "fail", "sqlite compatible"));
23
+ if (v.latencyMs !== null) {
24
+ lines.push(Status("ok", "latency", `${v.latencyMs} ms`));
25
+ }
26
+ if (v.existing?.found) {
27
+ const date = v.existing.lastModified ? v.existing.lastModified.split("T")[0] : "unknown";
28
+ const count = v.existing.memoryCount ?? "?";
29
+ lines.push(Status("ok", "found existing remote", `${count} memories · last write ${date}`));
30
+ }
31
+ for (const w of v.warnings)
32
+ lines.push(Status("warn", w));
33
+ for (const e of v.errors)
34
+ lines.push(Status("fail", e));
35
+ return lines.join("\n");
36
+ }
37
+ /**
38
+ * Render the leading Header + current-status line for the remote wizard.
39
+ * Returns a multi-line string the wizard can print as-is.
40
+ */
41
+ export function renderRemoteIntro(localActive, localArchived, currentRemote) {
42
+ const lines = [];
43
+ lines.push(Header(["gnosys", "setup", "remote"]));
44
+ lines.push("");
45
+ lines.push(` ${color(c.text, "Multi-machine sync")}`);
46
+ lines.push(` ${color(c.textDim, "share your memory store across machines via a path on a NAS, iCloud, Dropbox, etc.")}`);
47
+ lines.push("");
48
+ const remoteTxt = currentRemote ?? "not configured";
49
+ lines.push(` ${color(c.textDim, "local DB")} ${color(c.text, `~/.gnosys/gnosys.db (${localActive} active, ${localArchived} archived)`)}`);
50
+ lines.push(` ${color(c.textDim, "current")} ${color(c.text, remoteTxt)}`);
51
+ return lines.join("\n");
52
+ }
53
+ export function renderRemoteDiff(d) {
54
+ const lines = [];
55
+ const indent = " ";
56
+ const arrow = color(c.textGhost, glyph.arrow);
57
+ const fromR = color(c.textMid, (d.previousRemote ?? "not configured").padEnd(20));
58
+ const labelR = color(c.textDim, "remote".padEnd(8));
59
+ lines.push(`${indent}${labelR} ${fromR} ${arrow} ${color(c.accentHi, d.newRemote)}`);
60
+ const labelM = color(c.textDim, "mode".padEnd(8));
61
+ const fromM = color(c.textMid, "—".padEnd(20));
62
+ lines.push(`${indent}${labelM} ${fromM} ${arrow} ${color(c.accentHi, d.mode)}`);
63
+ return lines.join("\n");
64
+ }
65
+ //# sourceMappingURL=remoteRender.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remoteRender.js","sourceRoot":"","sources":["../../../src/lib/setup/remoteRender.ts"],"names":[],"mappings":"AAAA;;;;;;;G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,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACtF,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
@@ -0,0 +1,48 @@
1
+ /** Cost-tier bucket. `free` = ollama / lmstudio (always $0). */
2
+ export type CostTier = "free" | "$" | "$$" | "$$$";
3
+ /**
4
+ * Classify a provider/model pair into a `$ / $$ / $$$ / free` bucket. The
5
+ * heuristic is the average of input + output pricing from PROVIDER_TIERS:
6
+ *
7
+ * free local providers (ollama, lmstudio) and any model
8
+ * whose registered cost is 0/0
9
+ * $ avg < 1.0 (cheap cloud — groq, gpt-mini, xai-mini)
10
+ * $$ avg < 5.0 (mid — sonnet, gpt-5, grok-flagship)
11
+ * $$$ otherwise (premium — opus, mistral-large)
12
+ *
13
+ * Falls back to `$$` when the model isn't registered (unknown — conservative
14
+ * mid-tier so the user notices unknown spend).
15
+ */
16
+ export declare function classifyCost(provider: string, model: string): CostTier;
17
+ /** One row in the task-routing table. */
18
+ export interface TaskRow {
19
+ task: string;
20
+ /** "provider / model" — pre-formatted. */
21
+ uses: string;
22
+ cost: CostTier;
23
+ /** When true, the row gets a `▶` marker in accent-hi (changed). */
24
+ changed?: boolean;
25
+ }
26
+ /**
27
+ * Render the task-routing table block (title + columnar table). Returns
28
+ * the full multi-line string with no trailing newline.
29
+ *
30
+ * Built on the generic `Table` atom; the only routing-specific bits are
31
+ * the optional `▶` change marker (via `rowFormatter`) and the cost-tier
32
+ * colouring (different ANSI per tier).
33
+ */
34
+ export declare function renderRoutingTable(rows: TaskRow[]): string;
35
+ /**
36
+ * Render the final diff block — one row per task, showing either
37
+ * `from → to` (changed) or `(unchanged)`. Always emits a row per task
38
+ * so the user has a full picture.
39
+ */
40
+ export interface DiffEntry {
41
+ task: string;
42
+ /** "provider / model" before the edit. */
43
+ from: string;
44
+ /** "provider / model" after the edit, or null when unchanged. */
45
+ to: string | null;
46
+ }
47
+ export declare function renderRoutingDiff(entries: DiffEntry[]): string;
48
+ //# sourceMappingURL=routingRender.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"routingRender.d.ts","sourceRoot":"","sources":["../../../src/lib/setup/routingRender.ts"],"names":[],"mappings":"AAYA,gEAAgE;AAChE,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,GAAG,GAAG,IAAI,GAAG,KAAK,CAAC;AAEnD;;;;;;;;;;;;GAYG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,QAAQ,CAUtE;AAED,yCAAyC;AACzC,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,0CAA0C;IAC1C,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,QAAQ,CAAC;IACf,mEAAmE;IACnE,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,OAAO,EAAE,GAAG,MAAM,CAgC1D;AAED;;;;GAIG;AACH,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,0CAA0C;IAC1C,IAAI,EAAE,MAAM,CAAC;IACb,iEAAiE;IACjE,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;CACnB;AAED,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,SAAS,EAAE,GAAG,MAAM,CAgB9D"}