aegisone 1.0.34 → 1.0.35

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 (226) hide show
  1. package/LICENSE +661 -0
  2. package/README.md +1 -1
  3. package/SOURCE-OFFER.txt +9 -0
  4. package/bin/aegis.js +1 -322
  5. package/package.json +4 -5
  6. package/scripts/bump.mjs +1 -211
  7. package/scripts/bundle.js +1 -129
  8. package/scripts/predist.mjs +1 -976
  9. package/src/child.js +1 -285
  10. package/src/dispatch.js +1 -269
  11. package/src/doctor.js +1 -639
  12. package/src/host.js +1 -111
  13. package/src/permissions.js +1 -383
  14. package/src/probes.js +1 -159
  15. package/src/release.js +1 -409
  16. package/vendor/cli/package.json +3 -7
  17. package/vendor/cli/scripts/check.mjs +1 -52
  18. package/vendor/cli/scripts/demo.mjs +1 -94
  19. package/vendor/cli/scripts/predist.mjs +1 -75
  20. package/vendor/cli/scripts/runtests.mjs +1 -56
  21. package/vendor/cli/scripts/seal-gate.mjs +1 -74
  22. package/vendor/cli/src/agents.js +1 -139
  23. package/vendor/cli/src/app.js +1 -2957
  24. package/vendor/cli/src/art.js +1 -289
  25. package/vendor/cli/src/chatflow.js +1 -3023
  26. package/vendor/cli/src/checkpoint.js +1 -90
  27. package/vendor/cli/src/clipboard.js +1 -424
  28. package/vendor/cli/src/cloudsync.js +1 -528
  29. package/vendor/cli/src/commands.js +1 -4089
  30. package/vendor/cli/src/config.js +1 -581
  31. package/vendor/cli/src/connect.js +1 -349
  32. package/vendor/cli/src/credentials.js +1 -33
  33. package/vendor/cli/src/deps.js +1 -232
  34. package/vendor/cli/src/devrun.js +1 -187
  35. package/vendor/cli/src/diff.js +1 -333
  36. package/vendor/cli/src/diffview.js +1 -296
  37. package/vendor/cli/src/engine.js +1 -297
  38. package/vendor/cli/src/entitlement.js +1 -355
  39. package/vendor/cli/src/events.js +1 -707
  40. package/vendor/cli/src/export.js +1 -67
  41. package/vendor/cli/src/filepreview.js +1 -153
  42. package/vendor/cli/src/fingerprint.js +1 -592
  43. package/vendor/cli/src/format.js +1 -259
  44. package/vendor/cli/src/fuzzy.js +1 -119
  45. package/vendor/cli/src/history.js +1 -423
  46. package/vendor/cli/src/init.js +1 -175
  47. package/vendor/cli/src/input.js +1 -139
  48. package/vendor/cli/src/keys.js +1 -183
  49. package/vendor/cli/src/markdown.js +1 -306
  50. package/vendor/cli/src/models.js +1 -507
  51. package/vendor/cli/src/naming.js +1 -57
  52. package/vendor/cli/src/overlays.js +1 -462
  53. package/vendor/cli/src/panels.js +1 -1418
  54. package/vendor/cli/src/ping.js +1 -226
  55. package/vendor/cli/src/presence.js +1 -238
  56. package/vendor/cli/src/render.js +1 -516
  57. package/vendor/cli/src/screen.js +1 -518
  58. package/vendor/cli/src/screens.js +1 -896
  59. package/vendor/cli/src/secret.js +1 -59
  60. package/vendor/cli/src/securefs.js +1 -359
  61. package/vendor/cli/src/settings.js +1 -155
  62. package/vendor/cli/src/shared.js +1 -52
  63. package/vendor/cli/src/sharedpaths.js +1 -53
  64. package/vendor/cli/src/signup.js +1 -156
  65. package/vendor/cli/src/summarize.js +1 -95
  66. package/vendor/cli/src/sysdiag.js +1 -585
  67. package/vendor/cli/src/system.js +1 -40
  68. package/vendor/cli/src/theme.js +1 -570
  69. package/vendor/cli/src/title.js +1 -220
  70. package/vendor/cli/src/todos.js +1 -115
  71. package/vendor/cli/src/tokens.js +1 -263
  72. package/vendor/cli/src/topup.js +1 -210
  73. package/vendor/cli/src/update.js +1 -191
  74. package/vendor/cli/vendor/client/aegis.js +1 -2441
  75. package/vendor/cli/vendor/client/attest.js +1 -518
  76. package/vendor/cli/vendor/client/authorship-key.js +1 -410
  77. package/vendor/cli/vendor/client/auto-provision.js +1 -134
  78. package/vendor/cli/vendor/client/brain-catalog.js +1 -268
  79. package/vendor/cli/vendor/client/byok-catalog.js +1 -199
  80. package/vendor/cli/vendor/client/catalog-client.js +1 -487
  81. package/vendor/cli/vendor/client/conversation-export.js +1 -177
  82. package/vendor/cli/vendor/client/credentials.js +1 -494
  83. package/vendor/cli/vendor/client/device-fingerprint.js +1 -141
  84. package/vendor/cli/vendor/client/drive-connect.js +1 -110
  85. package/vendor/cli/vendor/client/drive-upload.js +1 -234
  86. package/vendor/cli/vendor/client/env-file.js +1 -1273
  87. package/vendor/cli/vendor/client/fingerprint.js +1 -1064
  88. package/vendor/cli/vendor/client/foreign-memory.js +1 -669
  89. package/vendor/cli/vendor/client/google-signin.js +1 -133
  90. package/vendor/cli/vendor/client/hooks.js +1 -430
  91. package/vendor/cli/vendor/client/model-discovery.js +1 -373
  92. package/vendor/cli/vendor/client/naming.js +1 -283
  93. package/vendor/cli/vendor/client/platform.js +1 -937
  94. package/vendor/cli/vendor/client/prefs.js +1 -351
  95. package/vendor/cli/vendor/client/presence-constants.js +1 -107
  96. package/vendor/cli/vendor/client/presence.js +1 -438
  97. package/vendor/cli/vendor/client/record-vault.js +3 -1055
  98. package/vendor/cli/vendor/client/session-store.js +1 -575
  99. package/vendor/cli/vendor/client/topup.js +1 -297
  100. package/vendor/cli/vendor/client/touch.js +1 -458
  101. package/vendor/cli/vendor/client/update.js +1 -763
  102. package/vendor/cli/vendor/client/user-models.js +1 -381
  103. package/vendor/cli/vendor/desktop/lib/local/agents.js +1 -105
  104. package/vendor/cli/vendor/desktop/lib/local/attachments.js +1 -276
  105. package/vendor/cli/vendor/desktop/lib/local/autonomous.js +1 -1045
  106. package/vendor/cli/vendor/desktop/lib/local/claude-pro.js +1 -1028
  107. package/vendor/cli/vendor/desktop/lib/local/context.js +1 -125
  108. package/vendor/cli/vendor/desktop/lib/local/engine.js +1 -3666
  109. package/vendor/cli/vendor/desktop/lib/local/entitlement.js +1 -660
  110. package/vendor/cli/vendor/desktop/lib/local/git-scope.js +1 -228
  111. package/vendor/cli/vendor/desktop/lib/local/local.js +1 -2145
  112. package/vendor/cli/vendor/desktop/lib/local/prompt.js +1 -280
  113. package/vendor/cli/vendor/desktop/lib/local/queue.js +1 -560
  114. package/vendor/cli/vendor/desktop/lib/local/session-rounds.js +1 -238
  115. package/vendor/cli/vendor/desktop/lib/local/spill.js +1 -75
  116. package/vendor/cli/vendor/desktop/lib/local/turn-guard.js +1 -300
  117. package/vendor/cli/vendor/desktop/lib/local/worktree-lock.js +1 -235
  118. package/vendor/cli/vendor/desktop/lib/settings.js +1 -890
  119. package/vendor/cli/vendor/desktop/renderer/usage.js +1 -1239
  120. package/vendor/cli/vendor/hosts/install.js +1 -638
  121. package/vendor/cli/vendor/hosts/openai-shim.js +1 -515
  122. package/vendor/cli/vendor/hosts/spec.js +1 -164
  123. package/vendor/cli/vendor/hosts/targets.js +1 -346
  124. package/vendor/cli/vendor/mcp/server.js +1 -221
  125. package/vendor/cli/vendor/mcp/tools.js +1 -408
  126. package/vendor/cli/vendor/one/src/child.js +1 -285
  127. package/vendor/cli/vendor/one/src/permissions.js +1 -383
  128. package/vendor/desktop/bin/aegis.js +1 -32
  129. package/vendor/desktop/lib/account-key.js +1 -56
  130. package/vendor/desktop/lib/auto.js +1 -461
  131. package/vendor/desktop/lib/avatar/companion.js +1 -698
  132. package/vendor/desktop/lib/avatar/cosmetics.js +1 -532
  133. package/vendor/desktop/lib/avatar/events.js +1 -344
  134. package/vendor/desktop/lib/avatar/holder-turn.js +1 -350
  135. package/vendor/desktop/lib/avatar/holders.js +1 -612
  136. package/vendor/desktop/lib/avatar/identity.js +1 -641
  137. package/vendor/desktop/lib/avatar/level.js +1 -368
  138. package/vendor/desktop/lib/avatar/mirror.js +1 -524
  139. package/vendor/desktop/lib/avatar/persona.js +1 -388
  140. package/vendor/desktop/lib/avatar/profile.js +1 -977
  141. package/vendor/desktop/lib/avatar/register.js +1 -307
  142. package/vendor/desktop/lib/avatar/store.js +1 -472
  143. package/vendor/desktop/lib/avatar/tiers.js +1 -38
  144. package/vendor/desktop/lib/avatar/transfer.js +1 -415
  145. package/vendor/desktop/lib/avatar/turn.js +1 -216
  146. package/vendor/desktop/lib/avatar/voice.js +1 -328
  147. package/vendor/desktop/lib/avatar/xp.js +1 -404
  148. package/vendor/desktop/lib/deep-link.js +1 -120
  149. package/vendor/desktop/lib/fingerprint.js +2 -347
  150. package/vendor/desktop/lib/google-connect.js +1 -323
  151. package/vendor/desktop/lib/local/agents.js +1 -105
  152. package/vendor/desktop/lib/local/attachments.js +1 -276
  153. package/vendor/desktop/lib/local/autonomous.js +1 -1045
  154. package/vendor/desktop/lib/local/claude-pro.js +1 -1028
  155. package/vendor/desktop/lib/local/context.js +1 -125
  156. package/vendor/desktop/lib/local/engine.js +1 -3666
  157. package/vendor/desktop/lib/local/entitlement.js +1 -660
  158. package/vendor/desktop/lib/local/git-scope.js +1 -228
  159. package/vendor/desktop/lib/local/local.js +1 -2145
  160. package/vendor/desktop/lib/local/prompt.js +1 -280
  161. package/vendor/desktop/lib/local/queue.js +1 -560
  162. package/vendor/desktop/lib/local/session-rounds.js +1 -238
  163. package/vendor/desktop/lib/local/spill.js +1 -75
  164. package/vendor/desktop/lib/local/telemetry.js +1 -470
  165. package/vendor/desktop/lib/local/turn-guard.js +1 -300
  166. package/vendor/desktop/lib/local/worktree-lock.js +1 -235
  167. package/vendor/desktop/lib/provider-key-mirror.js +1 -252
  168. package/vendor/desktop/lib/quick-launcher.js +1 -84
  169. package/vendor/desktop/lib/settings.js +1 -890
  170. package/vendor/desktop/lib/sync/memory-queue.js +1 -60
  171. package/vendor/desktop/lib/sync/persist-gate.js +1 -148
  172. package/vendor/desktop/lib/sync/sessions.js +1 -106
  173. package/vendor/desktop/lib/window-state.js +1 -66
  174. package/vendor/desktop/package.json +2 -4
  175. package/vendor/desktop/preload.js +1 -679
  176. package/vendor/desktop/renderer/app.js +1 -7250
  177. package/vendor/desktop/renderer/avatar/assemble.js +1 -335
  178. package/vendor/desktop/renderer/avatar/avatar.js +1 -380
  179. package/vendor/desktop/renderer/avatar/cards.js +1 -141
  180. package/vendor/desktop/renderer/avatar/hud.js +1 -206
  181. package/vendor/desktop/renderer/avatar/machine.js +1 -213
  182. package/vendor/desktop/renderer/avatar/pane.js +1 -439
  183. package/vendor/desktop/renderer/avatar/parts.js +1 -437
  184. package/vendor/desktop/renderer/budget.js +1 -172
  185. package/vendor/desktop/renderer/companion.js +1 -223
  186. package/vendor/desktop/renderer/diff.js +1 -359
  187. package/vendor/desktop/renderer/diffview.js +1 -336
  188. package/vendor/desktop/renderer/filepreview.js +1 -211
  189. package/vendor/desktop/renderer/fingerprint.js +3 -789
  190. package/vendor/desktop/renderer/markdown.js +1 -168
  191. package/vendor/desktop/renderer/provider-mark.js +1 -311
  192. package/vendor/desktop/renderer/provider-toolbar.js +1 -134
  193. package/vendor/desktop/renderer/providers.js +1 -259
  194. package/vendor/desktop/renderer/quick.js +1 -285
  195. package/vendor/desktop/renderer/stream-policy.js +1 -387
  196. package/vendor/desktop/renderer/transcript-view.js +1 -323
  197. package/vendor/desktop/renderer/usage.js +1 -1239
  198. package/vendor/desktop/vendor/aegis.js +1 -2441
  199. package/vendor/desktop/vendor/attest.js +1 -518
  200. package/vendor/desktop/vendor/authorship-key.js +1 -410
  201. package/vendor/desktop/vendor/auto-provision.js +1 -134
  202. package/vendor/desktop/vendor/brain-catalog.js +1 -268
  203. package/vendor/desktop/vendor/byok-catalog.js +1 -199
  204. package/vendor/desktop/vendor/catalog-client.js +1 -487
  205. package/vendor/desktop/vendor/conversation-export.js +1 -177
  206. package/vendor/desktop/vendor/credentials.js +1 -494
  207. package/vendor/desktop/vendor/device-fingerprint.js +1 -141
  208. package/vendor/desktop/vendor/drive-connect.js +1 -110
  209. package/vendor/desktop/vendor/drive-upload.js +1 -234
  210. package/vendor/desktop/vendor/env-file.js +1 -1273
  211. package/vendor/desktop/vendor/fingerprint.js +1 -1064
  212. package/vendor/desktop/vendor/foreign-memory.js +1 -669
  213. package/vendor/desktop/vendor/google-signin.js +1 -133
  214. package/vendor/desktop/vendor/hooks.js +1 -430
  215. package/vendor/desktop/vendor/model-discovery.js +1 -373
  216. package/vendor/desktop/vendor/naming.js +1 -283
  217. package/vendor/desktop/vendor/platform.js +1 -937
  218. package/vendor/desktop/vendor/prefs.js +1 -351
  219. package/vendor/desktop/vendor/presence-constants.js +1 -107
  220. package/vendor/desktop/vendor/presence.js +1 -438
  221. package/vendor/desktop/vendor/record-vault.js +3 -1055
  222. package/vendor/desktop/vendor/session-store.js +1 -575
  223. package/vendor/desktop/vendor/topup.js +1 -297
  224. package/vendor/desktop/vendor/touch.js +1 -458
  225. package/vendor/desktop/vendor/update.js +1 -763
  226. package/vendor/desktop/vendor/user-models.js +1 -381
@@ -1,62 +1,3 @@
1
1
  // SPDX-License-Identifier: AGPL-3.0-or-later
2
2
  // Copyright (C) 2026 Niklas Borneklint — AEGIS Code (aegiscode) / Aegiscloud.
3
- // AEGIS Code (aegiscode) — source: https://github.com/aegisinfo/aegiscode-plugin
4
- // Conveying a modified copy, or running one as a network service, owes the
5
- // corresponding source under this licence (§5/§13) — see LICENSING.md.
6
- 'use strict';
7
-
8
- /**
9
- * memory-queue.js — local retry queue for cloud memory saves (plan P3 §7).
10
- * When `aegis.memorySave()` fails (no key configured, offline), the entry is
11
- * appended to <dir>/memory-queue.json instead of being dropped, so a later
12
- * "Sync now" or heartbeat retry can flush it once the cloud is reachable.
13
- * Pure Node + injectable dir, mirrors desktop/lib/sync/sessions.js.
14
- */
15
-
16
- const fs = require('node:fs');
17
- const path = require('node:path');
18
-
19
- function queueFile(dir) {
20
- return path.join(dir, 'memory-queue.json');
21
- }
22
-
23
- function load(dir) {
24
- try {
25
- const data = JSON.parse(fs.readFileSync(queueFile(dir), 'utf8'));
26
- return Array.isArray(data) ? data : [];
27
- } catch {
28
- return [];
29
- }
30
- }
31
-
32
- function atomicWrite(file, data) {
33
- fs.mkdirSync(path.dirname(file), { recursive: true });
34
- const tmp = `${file}.tmp-${process.pid}`;
35
- fs.writeFileSync(tmp, JSON.stringify(data, null, 2));
36
- fs.renameSync(tmp, file);
37
- }
38
-
39
- function save(dir, entries) {
40
- atomicWrite(queueFile(dir), entries);
41
- }
42
-
43
- /** Queue a memory entry that a cloud save couldn't reach right now. */
44
- function enqueue(dir, entry) {
45
- const entries = load(dir);
46
- const queued = { ...entry, queuedAt: Date.now() };
47
- entries.push(queued);
48
- save(dir, entries);
49
- return queued;
50
- }
51
-
52
- function listQueued(dir) {
53
- return load(dir);
54
- }
55
-
56
- module.exports = {
57
- queueFile,
58
- load,
59
- save,
60
- enqueue,
61
- listQueued,
62
- };
3
+ "use strict";const fs=require("node:fs"),path=require("node:path");function queueFile(e){return path.join(e,"memory-queue.json")}function load(e){try{const u=JSON.parse(fs.readFileSync(queueFile(e),"utf8"));return Array.isArray(u)?u:[]}catch{return[]}}function atomicWrite(e,u){fs.mkdirSync(path.dirname(e),{recursive:!0});const n=`${e}.tmp-${process.pid}`;fs.writeFileSync(n,JSON.stringify(u,null,2)),fs.renameSync(n,e)}function save(e,u){atomicWrite(queueFile(e),u)}function enqueue(e,u){const n=load(e),t={...u,queuedAt:Date.now()};return n.push(t),save(e,n),t}function listQueued(e){return load(e)}module.exports={queueFile:queueFile,load:load,save:save,enqueue:enqueue,listQueued:listQueued};
@@ -1,150 +1,3 @@
1
1
  // SPDX-License-Identifier: AGPL-3.0-or-later
2
2
  // Copyright (C) 2026 Niklas Borneklint — AEGIS Code (aegiscode) / Aegiscloud.
3
- // AEGIS Code (aegiscode) — source: https://github.com/aegisinfo/aegiscode-plugin
4
- // Conveying a modified copy, or running one as a network service, owes the
5
- // corresponding source under this licence (§5/§13) — see LICENSING.md.
6
- 'use strict';
7
-
8
- /**
9
- * persist-gate.js — the desktop half of "persisting memory for every account".
10
- *
11
- * `cli/` stores the preference in the shared non-secret store as `memoryPersist`
12
- * (`cli/src/config.js`, migrated off the legacy `cloudSync` key). Since AEGIS
13
- * ONE D5 that store is `$AEGISCODE_HOME/preferences.json` (`client/prefs.js`),
14
- * which the shell and the window both write — so this gate reads the SAME value
15
- * the Settings pane writes, and there is no second copy to disagree with.
16
- *
17
- * Two reasons the gate is not taken from the renderer:
18
- *
19
- * 1. The decision has to be enforceable in the main process whatever the
20
- * renderer believes. A renderer-held flag is a suggestion; the process
21
- * that opens the socket decides.
22
- * 2. `createSyncDispatch()` / createAutoPush() are unit-tested in plain Node,
23
- * where no renderer and no Electron exist.
24
- *
25
- * Default is ON, matching cli/. `source` keeps "the user turned this off" and
26
- * "nobody has been asked yet" tellable apart — the whole point of shipping a
27
- * default is that the absence of a stored key is not the same as a stored no.
28
- *
29
- * A pre-D5 `<userData>/settings.json` `__memoryPersist` namespace is still read
30
- * as a FALLBACK (`readSettings` below, `source: 'config'`) so a gate that runs
31
- * before adoption lands cannot read "default" over a user's explicit `false`.
32
- * It is never written: the store retires it on the first write.
33
- */
34
-
35
- const fs = require('node:fs');
36
- const path = require('node:path');
37
-
38
- const { MEMORY_PERSIST_NAMESPACE, SETTINGS_FILE } = require('../settings.js');
39
-
40
- // The shared, non-secret preference store (D5), resolved the same two ways the
41
- // other cross-host modules are: in-repo `client/*.js`, packaged `vendor/*.js`.
42
- const prefs = (() => {
43
- try {
44
- return require('../../../client/prefs.js');
45
- } catch {
46
- return require('../../vendor/prefs.js');
47
- }
48
- })();
49
-
50
- /** The settings file the store writes (`createSettingsStore` uses the same
51
- * `path.join(dir, SETTINGS_FILE)`, so both agree on one source of truth).
52
- * A caller that already holds the file path may pass it directly. */
53
- function settingsFile(dir) {
54
- const p = dir || '';
55
- return p.endsWith(SETTINGS_FILE) ? p : path.join(p, SETTINGS_FILE);
56
- }
57
-
58
- function readSettings(dir) {
59
- try {
60
- const data = JSON.parse(fs.readFileSync(settingsFile(dir), 'utf8'));
61
- return data && typeof data === 'object' ? data : {};
62
- } catch {
63
- return {};
64
- }
65
- }
66
-
67
- /**
68
- * `{ enabled, source }`, read from the SHARED store the Settings pane writes.
69
- *
70
- * `source` is 'config' only when a file actually carries an explicit value — an
71
- * explicit `false` survives, an absent preference is ON. `dir` is the legacy
72
- * settings directory (Electron's `<userData>`), consulted only when the shared
73
- * store has no opinion; `opts.prefsDir`/`opts.env` locate the shared store for
74
- * callers that hold their own seam (tests).
75
- */
76
- function gateState(dir, opts) {
77
- const o = opts || {};
78
- const shared = prefs.load({ dir: o.prefsDir, env: o.env });
79
- if (typeof shared.memoryPersist === 'boolean') {
80
- return { enabled: shared.memoryPersist, source: 'config' };
81
- }
82
- const cfg = readSettings(dir)[MEMORY_PERSIST_NAMESPACE];
83
- if (!cfg || cfg.enabled === undefined) return { enabled: true, source: 'default' };
84
- return { enabled: Boolean(cfg.enabled), source: 'config' };
85
- }
86
-
87
- /**
88
- * The post-turn push, gated.
89
- *
90
- * `push` is `createSyncDispatch`'s own drain, so this inherits the queue
91
- * fallback for free: a push flushes `memory-queue.json` before it touches the
92
- * session list, which is exactly the "offline now, sync later" behaviour the
93
- * manual button had and the automatic path must not lose.
94
- *
95
- * Coalesced: a turn that ends while a drain is still in flight does not open a
96
- * second one. `push()` snapshots `sessions.listPending(dir)`, so a concurrent
97
- * call would race the same rows; the newest session instead goes out on the
98
- * next trigger (the following turn's auto push, or "Sync now"). One turn of
99
- * delay is the correct trade against two writers marking the same session
100
- * synced.
101
- */
102
- function createAutoPush({ push, dir, gate, prefsDir, env } = {}) {
103
- if (typeof push !== 'function') throw new Error('createAutoPush requires a push()');
104
- const readGate = typeof gate === 'function' ? gate : () => gateState(dir, { prefsDir, env });
105
- let inFlight = null;
106
-
107
- async function run() {
108
- const state = readGate();
109
- if (!state.enabled) {
110
- return {
111
- ok: true,
112
- skipped: true,
113
- gate: state,
114
- reason: 'persisting memory is off',
115
- };
116
- }
117
- try {
118
- const result = await push();
119
- return Object.assign({}, result, { skipped: false, gate: state });
120
- } catch (err) {
121
- // A chat turn must never fail because a background push did. `push()`
122
- // already resolves `{ ok:false, … }` for its expected failures; this
123
- // catches the unexpected so the caller's fire-and-forget cannot become
124
- // an unhandled rejection.
125
- return {
126
- ok: false,
127
- skipped: false,
128
- gate: state,
129
- reason: (err && err.message) || String(err),
130
- };
131
- }
132
- }
133
-
134
- function auto() {
135
- if (inFlight) return inFlight;
136
- inFlight = run().finally(() => {
137
- inFlight = null;
138
- });
139
- return inFlight;
140
- }
141
-
142
- return { auto, gate: () => readGate(), state: () => readGate() };
143
- }
144
-
145
- module.exports = {
146
- settingsFile,
147
- readSettings,
148
- gateState,
149
- createAutoPush,
150
- };
3
+ "use strict";const fs=require("node:fs"),path=require("node:path"),{MEMORY_PERSIST_NAMESPACE:MEMORY_PERSIST_NAMESPACE,SETTINGS_FILE:SETTINGS_FILE}=require("../settings.js"),prefs=(()=>{try{return require("../../../client/prefs.js")}catch{return require("../../vendor/prefs.js")}})();function settingsFile(e){const t=e||"";return t.endsWith(SETTINGS_FILE)?t:path.join(t,SETTINGS_FILE)}function readSettings(e){try{const t=JSON.parse(fs.readFileSync(settingsFile(e),"utf8"));return t&&"object"==typeof t?t:{}}catch{return{}}}function gateState(e,t){const r=t||{},n=prefs.load({dir:r.prefsDir,env:r.env});if("boolean"==typeof n.memoryPersist)return{enabled:n.memoryPersist,source:"config"};const s=readSettings(e)[MEMORY_PERSIST_NAMESPACE];return s&&void 0!==s.enabled?{enabled:Boolean(s.enabled),source:"config"}:{enabled:!0,source:"default"}}function createAutoPush({push:e,dir:t,gate:r,prefsDir:n,env:s}={}){if("function"!=typeof e)throw new Error("createAutoPush requires a push()");const i="function"==typeof r?r:()=>gateState(t,{prefsDir:n,env:s});let o=null;return{auto:function(){return o||(o=async function(){const t=i();if(!t.enabled)return{ok:!0,skipped:!0,gate:t,reason:"persisting memory is off"};try{const r=await e();return Object.assign({},r,{skipped:!1,gate:t})}catch(e){return{ok:!1,skipped:!1,gate:t,reason:e&&e.message||String(e)}}}().finally((()=>{o=null})),o)},gate:()=>i(),state:()=>i()}}module.exports={settingsFile:settingsFile,readSettings:readSettings,gateState:gateState,createAutoPush:createAutoPush};
@@ -1,108 +1,3 @@
1
1
  // SPDX-License-Identifier: AGPL-3.0-or-later
2
2
  // Copyright (C) 2026 Niklas Borneklint — AEGIS Code (aegiscode) / Aegiscloud.
3
- // AEGIS Code (aegiscode) — source: https://github.com/aegisinfo/aegiscode-plugin
4
- // Conveying a modified copy, or running one as a network service, owes the
5
- // corresponding source under this licence (§5/§13) — see LICENSING.md.
6
- 'use strict';
7
-
8
- /**
9
- * sessions.js — the desktop's session store, now a thin binding over the
10
- * SHARED store in `client/session-store.js`.
11
- *
12
- * This file used to be the implementation. It was the desktop's private
13
- * `sessions.json`, while the terminal host kept `~/.aegiscode/history.jsonl`
14
- * and the MCP plugin could see neither — three hosts, one account, three
15
- * disjoint views of the conversation. The implementation now lives in
16
- * `client/session-store.js`, which is the tree every host already bundles,
17
- * and every call here forwards to it.
18
- *
19
- * Two things that matter are deliberately unchanged:
20
- *
21
- * * the public API and its argument order (`(dir, …)` first) — `main.js`, the
22
- * sync dispatch and `test/sync-sessions.test.mjs` call it by those names;
23
- * * the record shape — `pending`, `seq`, `updatedAt`, `remoteId`,
24
- * `lastSyncedAt`, `__seq` all keep their meaning, because cloud sync and
25
- * the renderer's session list read them.
26
- *
27
- * The only real change is *where* `dir` points: main.js now passes the shared
28
- * data dir (see `resolveStoreDir`), so a session typed in the terminal appears
29
- * in the desktop's list without a network round trip.
30
- *
31
- * Resolution mirrors main.js's own pattern for the shared client: `client/` in
32
- * a source checkout, `vendor/` in the packaged app (electron-builder cannot
33
- * reach outside the app dir, so predist.mjs stages the file).
34
- */
35
-
36
- const shared = (() => {
37
- try {
38
- return require('../../../client/session-store.js');
39
- } catch {
40
- return require('../../vendor/session-store.js');
41
- }
42
- })();
43
-
44
- const credentials = (() => {
45
- try {
46
- return require('../../../client/credentials.js');
47
- } catch {
48
- return require('../../vendor/credentials.js');
49
- }
50
- })();
51
-
52
- /**
53
- * The directory the shared store lives in: `$AEGISCODE_HOME` or `~/.aegiscode`.
54
- * `legacyDir` (Electron's userData) is only used to adopt a pre-unification
55
- * store, never to read sessions from afterwards.
56
- */
57
- function resolveStoreDir(legacyDir) {
58
- const dir = credentials.aegisHome();
59
- if (legacyDir && legacyDir !== dir) adopt(dir, legacyDir);
60
- return dir;
61
- }
62
-
63
- const {
64
- storeFile,
65
- load,
66
- save,
67
- upsertSession,
68
- appendMessage,
69
- recordExchange,
70
- listSessions,
71
- getSession,
72
- deleteSession,
73
- markSynced,
74
- markPending,
75
- listPending,
76
- mergeRemoteSessions,
77
- listSummaries,
78
- readTranscript,
79
- adopt,
80
- toMarkdown,
81
- toJson,
82
- } = shared;
83
-
84
- /** Kept under its old name — main.js and the tests call `sessionsFile`. */
85
- const sessionsFile = storeFile;
86
-
87
- module.exports = {
88
- sessionsFile,
89
- storeFile,
90
- resolveStoreDir,
91
- load,
92
- save,
93
- upsertSession,
94
- appendMessage,
95
- recordExchange,
96
- listSessions,
97
- getSession,
98
- deleteSession,
99
- markSynced,
100
- markPending,
101
- listPending,
102
- mergeRemoteSessions,
103
- listSummaries,
104
- readTranscript,
105
- adopt,
106
- toMarkdown,
107
- toJson,
108
- };
3
+ "use strict";const shared=(()=>{try{return require("../../../client/session-store.js")}catch{return require("../../vendor/session-store.js")}})(),credentials=(()=>{try{return require("../../../client/credentials.js")}catch{return require("../../vendor/credentials.js")}})();function resolveStoreDir(e){const s=credentials.aegisHome();return e&&e!==s&&adopt(s,e),s}const{storeFile:storeFile,load:load,save:save,upsertSession:upsertSession,appendMessage:appendMessage,recordExchange:recordExchange,listSessions:listSessions,getSession:getSession,deleteSession:deleteSession,markSynced:markSynced,markPending:markPending,listPending:listPending,mergeRemoteSessions:mergeRemoteSessions,listSummaries:listSummaries,readTranscript:readTranscript,adopt:adopt,toMarkdown:toMarkdown,toJson:toJson}=shared,sessionsFile=storeFile;module.exports={sessionsFile:sessionsFile,storeFile:storeFile,resolveStoreDir:resolveStoreDir,load:load,save:save,upsertSession:upsertSession,appendMessage:appendMessage,recordExchange:recordExchange,listSessions:listSessions,getSession:getSession,deleteSession:deleteSession,markSynced:markSynced,markPending:markPending,listPending:listPending,mergeRemoteSessions:mergeRemoteSessions,listSummaries:listSummaries,readTranscript:readTranscript,adopt:adopt,toMarkdown:toMarkdown,toJson:toJson};
@@ -1,68 +1,3 @@
1
1
  // SPDX-License-Identifier: AGPL-3.0-or-later
2
2
  // Copyright (C) 2026 Niklas Borneklint — AEGIS Code (aegiscode) / Aegiscloud.
3
- // AEGIS Code (aegiscode) — source: https://github.com/aegisinfo/aegiscode-plugin
4
- // Conveying a modified copy, or running one as a network service, owes the
5
- // corresponding source under this licence (§5/§13) — see LICENSING.md.
6
- 'use strict';
7
-
8
- /**
9
- * window-state.js — persisted BrowserWindow bounds (native desktop plumbing).
10
- * Pure Node + injectable dir, mirrors desktop/lib/sync/memory-queue.js: reads
11
- * and writes <dir>/window-state.json, no Electron import, so it unit-tests
12
- * without the Electron binary.
13
- */
14
-
15
- const fs = require('node:fs');
16
- const path = require('node:path');
17
-
18
- function stateFile(dir) {
19
- return path.join(dir, 'window-state.json');
20
- }
21
-
22
- function load(dir) {
23
- try {
24
- const data = JSON.parse(fs.readFileSync(stateFile(dir), 'utf8'));
25
- return data && typeof data === 'object' ? data : null;
26
- } catch {
27
- return null;
28
- }
29
- }
30
-
31
- function save(dir, state) {
32
- const file = stateFile(dir);
33
- fs.mkdirSync(path.dirname(file), { recursive: true });
34
- const tmp = `${file}.tmp-${process.pid}`;
35
- fs.writeFileSync(tmp, JSON.stringify(state, null, 2));
36
- fs.renameSync(tmp, file);
37
- }
38
-
39
- /**
40
- * Clamp a saved rectangle so it always intersects at least one connected
41
- * display's work area. A saved position from a monitor that has since been
42
- * unplugged, or from a resolution that shrank, would otherwise place the
43
- * window off every visible screen — it "opens" but is unreachable. `displays`
44
- * takes plain `{ workArea: {x,y,width,height} }` objects (electron.screen's
45
- * shape) so this stays pure and Electron-free for testing.
46
- */
47
- function clampToDisplay(bounds, displays, fallback) {
48
- if (!bounds || typeof bounds !== 'object') return { ...fallback };
49
- const { x, y, width, height } = bounds;
50
- if (![x, y, width, height].every((n) => Number.isFinite(n))) return { ...fallback };
51
-
52
- const w = Math.max(1, width);
53
- const h = Math.max(1, height);
54
- const list = Array.isArray(displays) ? displays : [];
55
-
56
- const visible = list.some((d) => {
57
- const wa = d && d.workArea;
58
- if (!wa) return false;
59
- return x < wa.x + wa.width && x + w > wa.x && y < wa.y + wa.height && y + h > wa.y;
60
- });
61
-
62
- if (visible) return { x, y, width: w, height: h };
63
- // Position is off every screen: keep the saved size but drop x/y so the
64
- // caller's default centering (no x/y passed to BrowserWindow) takes over.
65
- return { ...fallback, width: w, height: h };
66
- }
67
-
68
- module.exports = { stateFile, load, save, clampToDisplay };
3
+ "use strict";const fs=require("node:fs"),path=require("node:path");function stateFile(t){return path.join(t,"window-state.json")}function load(t){try{const e=JSON.parse(fs.readFileSync(stateFile(t),"utf8"));return e&&"object"==typeof e?e:null}catch{return null}}function save(t,e){const i=stateFile(t);fs.mkdirSync(path.dirname(i),{recursive:!0});const r=`${i}.tmp-${process.pid}`;fs.writeFileSync(r,JSON.stringify(e,null,2)),fs.renameSync(r,i)}function clampToDisplay(t,e,i){if(!t||"object"!=typeof t)return{...i};const{x:r,y:n,width:s,height:a}=t;if(![r,n,s,a].every((t=>Number.isFinite(t))))return{...i};const o=Math.max(1,s),c=Math.max(1,a);return(Array.isArray(e)?e:[]).some((t=>{const e=t&&t.workArea;return!!e&&r<e.x+e.width&&r+o>e.x&&n<e.y+e.height&&n+c>e.y}))?{x:r,y:n,width:o,height:c}:{...i,width:o,height:c}}module.exports={stateFile:stateFile,load:load,save:save,clampToDisplay:clampToDisplay};
@@ -22,13 +22,11 @@
22
22
  "vendor",
23
23
  "bin",
24
24
  "build",
25
- "docs"
25
+ "docs",
26
+ "SOURCE-OFFER.txt"
26
27
  ],
27
28
  "scripts": {
28
29
  "start": "electron .",
29
- "predist": "node scripts/predist.mjs",
30
- "prepack": "node scripts/predist.mjs --quiet",
31
- "prepublishOnly": "npm run predist",
32
30
  "icon": "node scripts/generate-icon.mjs",
33
31
  "shots": "node scripts/capture-marketing-shots.mjs",
34
32
  "demo": "node scripts/record-demo-gif.mjs",