aegisone 1.0.18 → 1.0.20

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 (48) hide show
  1. package/README.md +2 -2
  2. package/package.json +1 -1
  3. package/scripts/bump.mjs +29 -4
  4. package/scripts/predist.mjs +2 -0
  5. package/src/dispatch.js +1 -0
  6. package/vendor/cli/bin/aegiscode.js +29 -0
  7. package/vendor/cli/package.json +1 -1
  8. package/vendor/cli/src/app.js +335 -24
  9. package/vendor/cli/src/autonomous.js +19 -2
  10. package/vendor/cli/src/chatflow.js +77 -4
  11. package/vendor/cli/src/commands.js +175 -5
  12. package/vendor/cli/src/config.js +21 -0
  13. package/vendor/cli/src/connect.js +351 -0
  14. package/vendor/cli/src/deps.js +97 -1
  15. package/vendor/cli/src/engine.js +98 -8
  16. package/vendor/cli/src/fingerprint.js +46 -16
  17. package/vendor/cli/src/limits.js +1 -1
  18. package/vendor/cli/src/overlays.js +54 -0
  19. package/vendor/cli/src/provenance.lock.json +3 -3
  20. package/vendor/cli/src/screens.js +14 -1
  21. package/vendor/cli/vendor/client/credentials.js +9 -2
  22. package/vendor/cli/vendor/client/google-signin.js +127 -0
  23. package/vendor/cli/vendor/client/record-vault.js +431 -113
  24. package/vendor/cli/vendor/client/update.js +266 -0
  25. package/vendor/cli/vendor/desktop/lib/local/claude-pro.js +134 -11
  26. package/vendor/cli/vendor/desktop/lib/local/engine.js +47 -25
  27. package/vendor/cli/vendor/desktop/lib/settings.js +65 -24
  28. package/vendor/desktop/lib/auto.js +11 -7
  29. package/vendor/desktop/lib/fingerprint.js +76 -17
  30. package/vendor/desktop/lib/local/claude-pro.js +134 -11
  31. package/vendor/desktop/lib/local/engine.js +47 -25
  32. package/vendor/desktop/lib/settings.js +65 -24
  33. package/vendor/desktop/main.js +79 -24
  34. package/vendor/desktop/package.json +4 -2
  35. package/vendor/desktop/preload.js +31 -12
  36. package/vendor/desktop/renderer/app.js +676 -17
  37. package/vendor/desktop/renderer/budget.js +18 -9
  38. package/vendor/desktop/renderer/companion.js +225 -0
  39. package/vendor/desktop/renderer/fingerprint.css +16 -0
  40. package/vendor/desktop/renderer/fingerprint.js +62 -2
  41. package/vendor/desktop/renderer/index.html +285 -121
  42. package/vendor/desktop/renderer/provider-toolbar.js +136 -0
  43. package/vendor/desktop/renderer/providers.js +261 -0
  44. package/vendor/desktop/renderer/style.css +547 -171
  45. package/vendor/desktop/vendor/credentials.js +9 -2
  46. package/vendor/desktop/vendor/google-signin.js +127 -0
  47. package/vendor/desktop/vendor/record-vault.js +431 -113
  48. package/vendor/desktop/vendor/update.js +266 -0
@@ -524,27 +524,43 @@ const EFFORT_TOKEN_BUDGET = { low: 8192, medium: 16384, high: 32768 };
524
524
  /**
525
525
  * DeepSeek native reasoning level per config rung.
526
526
  *
527
- * The field is `reasoning_effort`, NOT `effort`. Verified live 2026-10-02: a
528
- * DeepSeek body carrying `effort` returns HTTP 200 and is ignored, while
529
- * `reasoning_effort` binds and rejects an unknown value with a 422 naming its
530
- * enum (none|minimal|low|medium|high|xhigh|ultra|max). Behaviourally,
531
- * `reasoning_effort:"none"` produced 0 reasoning_content chars and `"max"`
532
- * produced 138, whereas `effort:"none"` still produced 112 — thinking stayed
533
- * on. So the old field was inert on every turn, and inertness is the worst
534
- * failure here: it 200s, nothing surfaces, and the model merely thinks at the
535
- * wrong depth.
527
+ * The field is `effort`, NOT `reasoning_effort`. Verified live 2026-10-21
528
+ * against the surface this client actually reaches — the relay's
529
+ * `https://api.deepseek.com/anthropic` transport — by measuring output tokens
530
+ * over interleaved paired samples (n=12) against an absent-field baseline:
536
531
  *
537
- * Every rung of the knob has a namesake in that enum, so the map is 1:1 rather
538
- * than the earlier (low|max, no medium) fold, which rested on the mistaken
539
- * belief that DeepSeek had no `medium`. `max_tokens` (EFFORT_TOKEN_BUDGET)
540
- * still scales as the output ceiling, since hidden chain-of-thought shares that
541
- * budget on DeepSeek.
532
+ * absent 818 · low 772 · medium 836 · high 818 · max 1494
542
533
  *
543
- * Mirrors the upstream engine's src/backend.js DEEPSEEK_EFFORT verbatim;
544
- * desktop/renderer/budget.js carries the renderer's copy for the same
545
- * no-drift guarantee as DEEPSEEK_REASONING_MODEL_RE above.
534
+ * Only `max` separates from sending nothing. `GET /models` reports
535
+ * `supported_levels: ["low","high","max"]`, default `high`, on both live ids
536
+ * (`deepseek-flash`, `deepseek-v4-pro`) — so `medium` is not a level these
537
+ * models have. It passes the deserializer (unknown values *do* 422 with the
538
+ * enum, so validation is real) and is then absorbed into the default, which is
539
+ * this codebase's worst failure mode: a 200, nothing surfaced, and the model
540
+ * thinking at a depth nobody chose.
541
+ *
542
+ * What the earlier version of this comment asserted — that `reasoning_effort`
543
+ * binds and `effort` is ignored — was measured on the vendor's OpenAI-shaped
544
+ * `/chat/completions`, a surface this client never reaches, and it led to the
545
+ * knob being dead end-to-end: aegis1 forwards `reasoning_effort` only for
546
+ * BYOK_REASONING_EFFORT_PROVIDERS (openai/groq/gemini/grok — deepseek is
547
+ * absent), so the field was dropped at the relay. The `effort` channel is the
548
+ * one aegis1 gates on `provider_id == "deepseek"` (app.py) and that the
549
+ * Anthropic adapter nests as `output_config.effort`; it is the only channel
550
+ * that reaches the vendor, and the only one that measurably binds.
551
+ *
552
+ * The map folds `medium` upward for the same reason the Gemini row does: the
553
+ * vendor has no such level, and a rung that 200s while doing nothing is worse
554
+ * than one that says what it does. `max` is deliberately NOT reachable — it is
555
+ * not a rung of this knob, and mapping the default rung onto it would silently
556
+ * multiply reasoning spend on every turn nobody asked to deepen.
557
+ * `max_tokens` (EFFORT_TOKEN_BUDGET) still scales as the output ceiling, since
558
+ * hidden chain-of-thought shares that budget on DeepSeek.
559
+ *
560
+ * desktop/renderer/budget.js carries the renderer's copy; test/budget.test.mjs
561
+ * compares the two tables, so the mirror cannot drift silently.
546
562
  */
547
- const DEEPSEEK_EFFORT = { low: 'low', medium: 'medium', high: 'high' };
563
+ const DEEPSEEK_EFFORT = { low: 'low', medium: 'high', high: 'high' };
548
564
 
549
565
  /**
550
566
  * Per-family effort translation, mirroring the upstream engine's
@@ -565,7 +581,7 @@ const DEEPSEEK_EFFORT = { low: 'low', medium: 'medium', high: 'high' };
565
581
  const EFFORT_IDENTITY = { low: 'low', medium: 'medium', high: 'high' };
566
582
  const EFFORT_INERT_RE = /non-reasoning/i;
567
583
  const EFFORT_DIALECTS = [
568
- { provider: 'deepseek', re: DEEPSEEK_REASONING_MODEL_RE, field: 'reasoning_effort', map: DEEPSEEK_EFFORT },
584
+ { provider: 'deepseek', re: DEEPSEEK_REASONING_MODEL_RE, field: 'effort', map: DEEPSEEK_EFFORT },
569
585
  { provider: 'openai', re: /^(gpt-5|o[0-9])/i, field: 'reasoning_effort', map: EFFORT_IDENTITY },
570
586
  { provider: 'groq', re: /^(openai\/gpt-oss|qwen\/qwen3)/i, field: 'reasoning_effort', map: EFFORT_IDENTITY },
571
587
  { provider: 'xai', re: /^grok-(4\.[5-9]|[5-9])/, field: 'reasoning_effort', map: EFFORT_IDENTITY },
@@ -1967,8 +1983,8 @@ function createLocalEngine({
1967
1983
  const { provider, model: bareModel } = splitByokModel(opts.model);
1968
1984
  // Translate the rung for THIS vendor once, and carry the verdict rather
1969
1985
  // than a bare level: the relay validates strictly upstream and the field
1970
- // name is not portable (DeepSeek's OpenAI-compatible surface takes
1971
- // `reasoning_effort`, same spelling as OpenAI's). Undefined for a family
1986
+ // name is not portable (DeepSeek's `/anthropic` transport takes `effort`,
1987
+ // OpenAI-shaped vendors take `reasoning_effort`). Undefined for a family
1972
1988
  // with no dialect, which the transport then omits entirely.
1973
1989
  const effort = nativeEffort(provider, bareModel, opts.effort);
1974
1990
  try {
@@ -1999,10 +2015,16 @@ function createLocalEngine({
1999
2015
  toolChoice: opts.toolChoice,
2000
2016
  // Native effort knob, field and level both from the dialect table.
2001
2017
  // `bareModel` is already provider-less, so it matches the dialect
2002
- // regexes without further stripping. Only a dialect whose field is
2003
- // `reasoning_effort` is forwarded: DeepSeek used to ride a separate
2004
- // `effort` body key, which the API 200s and ignores, so that whole
2005
- // second channel is gone rather than left as a way to reintroduce it.
2018
+ // regexes without further stripping. Both wire channels are live, and
2019
+ // which one is used is the dialect's decision, not this call site's:
2020
+ // DeepSeek's `/anthropic` transport takes `effort` (aegis1 gates it on
2021
+ // provider_id == "deepseek" and the adapter nests it as
2022
+ // `output_config.effort`), while the OpenAI-shaped vendors take
2023
+ // `reasoning_effort`. Routing on the field name is what keeps a
2024
+ // dialect from being silently dropped here — the previous form
2025
+ // forwarded only `reasoning_effort`, so turning DeepSeek's dialect
2026
+ // over to `effort` would have died at this line.
2027
+ effort: effort && effort.field === 'effort' ? effort.level : undefined,
2006
2028
  reasoningEffort: effort && effort.field === 'reasoning_effort' ? effort.level : undefined,
2007
2029
  stream: true,
2008
2030
  onStream: opts.onDelta,
@@ -103,6 +103,19 @@ const QUICK_LAUNCHER_NAMESPACE = '__quickLauncher';
103
103
  * fighting existing app/OS bindings, memorable enough to type once. */
104
104
  const DEFAULT_QUICK_LAUNCHER_SHORTCUT = 'CmdOrCtrl+Shift+Space';
105
105
 
106
+ /** Reserved namespace for where `fingerprint publish`/the vault card sends
107
+ * sealed records: `{ backend }`, one of VAULT_BACKEND_VALUES — app-level, not
108
+ * a provider, for the same reason the quick launcher isn't. Default is
109
+ * `aegiscloud` (unset reads as the default, same convention as confirm mode)
110
+ * because it is the only backend that exists on a fresh install — see
111
+ * client/record-vault.js's own DEFAULT_BACKEND. `drive` asks the fingerprint
112
+ * service to talk to rclone's `gdrive` remote instead (the user's own Drive,
113
+ * configured by them); `off` means publish/anchor/vault/audit refuse with a
114
+ * named reason rather than silently reaching either backend. */
115
+ const VAULT_BACKEND_NAMESPACE = '__vaultBackend';
116
+ const DEFAULT_VAULT_BACKEND = 'aegiscloud';
117
+ const VAULT_BACKEND_VALUES = Object.freeze(['aegiscloud', 'drive', 'off']);
118
+
106
119
  /** Reserved namespace for the tool-call approval ("confirm mode") preference:
107
120
  * `{ enabled }` — app-level, not a provider, so it stays out of the provider
108
121
  * CRUD surface for the same reason the AEGIS key does. Default is ON
@@ -138,31 +151,34 @@ const AVATAR_NAMESPACE = '__avatar';
138
151
  * main.js telemetryEnabled() through getTelemetryOptIn(). */
139
152
  const TELEMETRY_NAMESPACE = '__telemetry';
140
153
 
141
- /** Reserved namespace for the auto-drain opt-in:
154
+ /** Reserved namespace for the auto-drain switch:
142
155
  * `{ enabled, intervalMs }` — app-level, not a provider.
143
156
  *
144
- * DEFAULT OFF, and unlike every preference above that default is the design
145
- * rather than a convention: this is the one setting in the app that causes a
146
- * full tool loop to run on a real model in the user's checkout with nobody
147
- * watching. desktop/main.js and desktop/preload.js both used to state the
148
- * absolute rule — "there is no interval, no drain at startup, and no
149
- * drain-on-idle anywhere" — and that rule is still what an install that never
150
- * touches this namespace gets. What changed (user request, phase A of the
151
- * automation work) is that the rule became a DEFAULT instead of an absolute:
152
- * an explicit `enabled: true` here is the only thing that arms a timer, the
153
- * toggle that writes it is in the queue card, and `lib/auto.js` refuses to
154
- * run a tick when the queue is empty or another host already holds the drain
155
- * lock. Nothing secret lives here, so no encryption — same shape as
156
- * `__confirmMode`/`__memoryPersist` above. */
157
+ * DEFAULT ON (user request: the queue must work with no click and nothing on
158
+ * screen). An absent namespace means "drain in the background"; only an
159
+ * explicit `enabled: false` disarms it, and that is what the settings store
160
+ * writes when someone turns the worker off from the CLI or by hand.
161
+ *
162
+ * The guards are what make that default defensible, and they live in
163
+ * `lib/auto.js`, not here: a tick skips when the queue is empty (so an idle
164
+ * install costs one JSON parse and no lock I/O), when another host holds the
165
+ * drain lock, when a drain is already in flight, and when the switch was
166
+ * turned off since the last tick — the switch is re-read on EVERY tick, so
167
+ * disarming stops the very next one. Nothing secret lives here, so no
168
+ * encryption — same shape as `__confirmMode`/`__memoryPersist` above. */
157
169
  const AUTO_DRAIN_NAMESPACE = '__autoDrain';
158
170
 
159
- /** Reserved namespace for the auto-mint (seal-on-quiet) opt-in:
171
+ /** Reserved namespace for the auto-mint (seal-on-quiet) switch:
160
172
  * `{ enabled, publish }` — app-level, not a provider.
161
173
  *
162
- * DEFAULT OFF for the same reason as auto-drain, and `publish` is a second,
163
- * independent opt-in: sealing writes a local record, whereas publishing sends
164
- * those bytes to the vault over `rclone` and writes an anchor beside them. An
165
- * automatic network copy is never implied by an automatic seal.
174
+ * `enabled` is DEFAULT ON, same as auto-drain: a session seals itself once it
175
+ * has been quiet, with nothing on screen asking for it. Only an explicit
176
+ * `enabled: false` disarms it.
177
+ *
178
+ * `publish` stays a separate, DEFAULT OFF switch: sealing writes a local
179
+ * record, whereas publishing sends those bytes to the vault over `rclone` and
180
+ * writes an anchor beside them. An automatic network copy is never implied by
181
+ * an automatic seal.
166
182
  *
167
183
  * The AI half of the record resolves through the shared rungs in
168
184
  * client/attest.js (`$AEGIS_AI_SECRET`/`$AEGIS_AI_MODEL` in the app scope) —
@@ -195,6 +211,7 @@ const RESERVED_NAMESPACES = Object.freeze([
195
211
  AEGIS_KEY_NAMESPACE,
196
212
  LEGACY_AEGIS_NAMESPACE,
197
213
  QUICK_LAUNCHER_NAMESPACE,
214
+ VAULT_BACKEND_NAMESPACE,
198
215
  CONFIRM_MODE_NAMESPACE,
199
216
  MEMORY_PERSIST_NAMESPACE,
200
217
  AVATAR_NAMESPACE,
@@ -539,6 +556,24 @@ function createSettingsStore({ dir, safeStorage, prefsDir, env } = {}) {
539
556
  return quickLauncherConfig();
540
557
  }
541
558
 
559
+ // --- Vault backend: reserved namespace, plain (unencrypted) preference ---
560
+ // No secret lives here either — just which of three named destinations a
561
+ // publish goes to — so like the quick launcher there is nothing to encrypt.
562
+
563
+ function vaultBackendConfig() {
564
+ const cfg = load()[VAULT_BACKEND_NAMESPACE] || {};
565
+ const backend = VAULT_BACKEND_VALUES.includes(cfg.backend) ? cfg.backend : DEFAULT_VAULT_BACKEND;
566
+ return { backend };
567
+ }
568
+
569
+ function setVaultBackendConfig(backend) {
570
+ if (!VAULT_BACKEND_VALUES.includes(backend)) return vaultBackendConfig();
571
+ const data = load();
572
+ data[VAULT_BACKEND_NAMESPACE] = { backend };
573
+ save(data);
574
+ return vaultBackendConfig();
575
+ }
576
+
542
577
  // --- Confirm mode: SHARED preference (AEGISONE ON8, decision D8 rule 1) --
543
578
  // "Confirm before running tools" — the switch for the renderer's tool-call
544
579
  // approval gate (desktop/lib/local/engine.js gatedExecuteTool). ON (default,
@@ -726,10 +761,10 @@ function createSettingsStore({ dir, safeStorage, prefsDir, env } = {}) {
726
761
  function getAutoDrain() {
727
762
  const cfg = load()[AUTO_DRAIN_NAMESPACE] || {};
728
763
  return {
729
- // Unset === false. This is the opposite of confirm mode/memory persist,
730
- // and it is the whole point of the feature: nothing drains itself until
731
- // someone says so in as many words.
732
- enabled: cfg.enabled === true,
764
+ // Unset === TRUE. The queue drains in the background unless someone
765
+ // switched it off in as many words; `lib/auto.js` re-reads this on every
766
+ // tick, so that off switch stops the very next one.
767
+ enabled: cfg.enabled !== false,
733
768
  intervalMs: clampAutoDrainInterval(cfg.intervalMs),
734
769
  };
735
770
  }
@@ -760,7 +795,8 @@ function createSettingsStore({ dir, safeStorage, prefsDir, env } = {}) {
760
795
  function getAutoMint() {
761
796
  const cfg = load()[AUTO_MINT_NAMESPACE] || {};
762
797
  return {
763
- enabled: cfg.enabled === true,
798
+ // Unset === TRUE (background sealing). `publish` below stays opt-in.
799
+ enabled: cfg.enabled !== false,
764
800
  // Independent of `enabled` on purpose: an automatic seal must not drag
765
801
  // an automatic upload along with it.
766
802
  publish: cfg.publish === true,
@@ -807,6 +843,8 @@ function createSettingsStore({ dir, safeStorage, prefsDir, env } = {}) {
807
843
  migrateLegacyAegisKey,
808
844
  quickLauncherConfig,
809
845
  setQuickLauncherConfig,
846
+ vaultBackendConfig,
847
+ setVaultBackendConfig,
810
848
  getConfirmMode,
811
849
  setConfirmMode,
812
850
  confirmModeState,
@@ -833,6 +871,7 @@ module.exports = {
833
871
  AEGIS_KEY_NAMESPACE,
834
872
  LEGACY_AEGIS_NAMESPACE,
835
873
  QUICK_LAUNCHER_NAMESPACE,
874
+ VAULT_BACKEND_NAMESPACE,
836
875
  CONFIRM_MODE_NAMESPACE,
837
876
  MEMORY_PERSIST_NAMESPACE,
838
877
  AVATAR_NAMESPACE,
@@ -844,6 +883,8 @@ module.exports = {
844
883
  AUTO_DRAIN_INTERVAL_MAX_MS,
845
884
  AVATAR_MOTION_MODES,
846
885
  DEFAULT_QUICK_LAUNCHER_SHORTCUT,
886
+ DEFAULT_VAULT_BACKEND,
887
+ VAULT_BACKEND_VALUES,
847
888
  RESERVED_NAMESPACES,
848
889
  isReservedNamespace,
849
890
  maskKey,
@@ -109,13 +109,14 @@ try {
109
109
  // below (`fingerprintStatus`/`keygen`/`mint`/`verify`/`backup`).
110
110
  const { createFingerprintService } = require('./lib/fingerprint.js');
111
111
 
112
- // The two opt-in automations (lib/auto.js): the auto-drain timer and the
113
- // seal-on-quiet auto-mint. Both are DEFAULT OFF and read their switch from the
114
- // settings store's reserved `__autoDrain`/`__autoMint` namespaces on every tick,
115
- // so this require wires the TIMING only — the queue worker still owns the lock
116
- // and lib/fingerprint.js still owns the seal. See the header of lib/auto.js for
117
- // why the "nothing drains unless the user asked" rule became a default rather
118
- // than an absolute.
112
+ // The two background automations (lib/auto.js): the auto-drain timer and the
113
+ // seal-on-quiet auto-mint. Both are DEFAULT ON — the queue and the seal run
114
+ // with no click and no card on the desktop — and both read their switch from
115
+ // the settings store's reserved `__autoDrain`/`__autoMint` namespaces on every
116
+ // tick, so this require wires the TIMING only: the queue worker still owns the
117
+ // lock and lib/fingerprint.js still owns the seal. An explicit `enabled: false`
118
+ // in the settings store is what stops either one, and stopping it takes effect
119
+ // on the very next tick.
119
120
  const { createAutoDrain, createAutoMint } = require('./lib/auto.js');
120
121
 
121
122
  // The shared `~/.aegiscode/.env` loader (client/env-file.js, staged to
@@ -260,6 +261,12 @@ const MENU_SEARCH_CHANNEL = `${IPC_PREFIX}menuSearch`;
260
261
  * knows the open session id, main.js just pings it. */
261
262
  const MENU_EXPORT_MARKDOWN_CHANNEL = `${IPC_PREFIX}menuExportMarkdown`;
262
263
  const MENU_EXPORT_JSON_CHANNEL = `${IPC_PREFIX}menuExportJson`;
264
+ /** View > Authorship panel. The φ(α) card that used to open this sheet was
265
+ * removed from the sidebar (sealing runs in the background now), so the menu
266
+ * is what keeps the panel — key, records, vault — reachable at all. Same split
267
+ * as the channels above: main has no panel state, it just asks the renderer to
268
+ * open the sheet it already owns. */
269
+ const MENU_FINGERPRINT_CHANNEL = `${IPC_PREFIX}menuFingerprint`;
263
270
 
264
271
  /**
265
272
  * Main -> renderer push for a resolved aegis:// deep link (D? deep linking).
@@ -830,7 +837,7 @@ function providerRouteConfigured(engine) {
830
837
  * reject), injected by bootstrap() so this module still needs no `electron`
831
838
  * import to stay unit-testable.
832
839
  */
833
- function createIpcDispatch(aegis, dir, persistApiKey, openExternal, providerConfigured, avatar) {
840
+ function createIpcDispatch(aegis, dir, persistApiKey, openExternal, providerConfigured, avatar, getVaultBackend) {
834
841
  // One service for the window's lifetime, bound to the app's data dir — but
835
842
  // created LAZILY, which is what the comment here always claimed and what the
836
843
  // code did not do. `createFingerprintService({ dir })` throws on a missing
@@ -844,12 +851,12 @@ function createIpcDispatch(aegis, dir, persistApiKey, openExternal, providerConf
844
851
  let fingerprintService = null;
845
852
  const fingerprint = new Proxy({}, {
846
853
  get(_target, prop) {
847
- if (!fingerprintService) fingerprintService = createFingerprintService({ dir });
854
+ if (!fingerprintService) fingerprintService = createFingerprintService({ dir, getVaultBackend });
848
855
  const value = fingerprintService[prop];
849
856
  return typeof value === 'function' ? value.bind(fingerprintService) : value;
850
857
  },
851
858
  has(_target, prop) {
852
- if (!fingerprintService) fingerprintService = createFingerprintService({ dir });
859
+ if (!fingerprintService) fingerprintService = createFingerprintService({ dir, getVaultBackend });
853
860
  return prop in fingerprintService;
854
861
  },
855
862
  });
@@ -1046,8 +1053,8 @@ function withReplyNotify(promise, event, onReplyFinished) {
1046
1053
  * tests, where the safe no-op default in createIpcDispatch takes over.
1047
1054
  * `onReplyFinished` is likewise bootstrap()-only: it fires the native
1048
1055
  * "reply ready" notification when the window is unfocused/hidden. */
1049
- function registerIpc(ipcMain, aegis, dir, persistApiKey, openExternal, onReplyFinished, providerConfigured) {
1050
- const dispatch = createIpcDispatch(aegis, dir, persistApiKey, openExternal, providerConfigured);
1056
+ function registerIpc(ipcMain, aegis, dir, persistApiKey, openExternal, onReplyFinished, providerConfigured, getVaultBackend) {
1057
+ const dispatch = createIpcDispatch(aegis, dir, persistApiKey, openExternal, providerConfigured, undefined, getVaultBackend);
1051
1058
  for (const [name, handler] of Object.entries(dispatch)) {
1052
1059
  if (name === 'chatCompletion') {
1053
1060
  // Streaming render (D2.1): when the renderer asks for stream, SSE deltas
@@ -1154,6 +1161,29 @@ function registerConfirmModeIpc(ipcMain, dispatch) {
1154
1161
  return dispatch;
1155
1162
  }
1156
1163
 
1164
+ /**
1165
+ * Vault backend preference: `aegis:getVaultBackend` / `aegis:setVaultBackend`.
1166
+ * Same shape as createConfirmModeDispatch — unit-testable with a stub store —
1167
+ * and registered through the same generic registerConfirmModeIpc, which does
1168
+ * nothing confirm-mode-specific; it just wires `{name: handler}` pairs as
1169
+ * `aegis:<name>`.
1170
+ *
1171
+ * `getVaultBackend` answers `{ backend }`, one of
1172
+ * desktop/lib/settings.js's VAULT_BACKEND_VALUES ('aegiscloud' | 'drive' |
1173
+ * 'off'). `setVaultBackend` refuses an unrecognised value the same way
1174
+ * settings.setVaultBackendConfig does (returns the unchanged state rather than
1175
+ * writing something the fingerprint service's vaultScope()/vaultDisabled()
1176
+ * would not recognise either) — a bad payload cannot silently point the vault
1177
+ * somewhere, or at nothing, that the picker never actually offered.
1178
+ */
1179
+ function createVaultBackendDispatch(settings) {
1180
+ if (!settings) throw new Error('createVaultBackendDispatch requires a settings store');
1181
+ return {
1182
+ getVaultBackend: () => settings.vaultBackendConfig(),
1183
+ setVaultBackend: (payload) => settings.setVaultBackendConfig(payload && payload.backend),
1184
+ };
1185
+ }
1186
+
1157
1187
  /**
1158
1188
  * Funnel instrumentation (Phase 2 of docs/upgrade-conversion-plan.md):
1159
1189
  * `aegis:telemetryEvent` / `aegis:telemetryReport`, backed by the store in
@@ -3156,6 +3186,10 @@ function buildAppMenu({ app, Menu, BrowserWindow, updateManager }) {
3156
3186
  label: 'Export Session…',
3157
3187
  click: () => sendToFocusedWindow(BrowserWindow, MENU_EXPORT_JSON_CHANNEL),
3158
3188
  };
3189
+ const fingerprintItem = {
3190
+ label: 'Authorship Panel…',
3191
+ click: () => sendToFocusedWindow(BrowserWindow, MENU_FINGERPRINT_CHANNEL),
3192
+ };
3159
3193
 
3160
3194
  const template = [
3161
3195
  ...(isMac
@@ -3206,6 +3240,8 @@ function buildAppMenu({ app, Menu, BrowserWindow, updateManager }) {
3206
3240
  submenu: [
3207
3241
  searchItem,
3208
3242
  { type: 'separator' },
3243
+ fingerprintItem,
3244
+ { type: 'separator' },
3209
3245
  { role: 'reload', accelerator: 'CmdOrCtrl+R' },
3210
3246
  { role: 'forceReload' },
3211
3247
  { type: 'separator' },
@@ -3467,7 +3503,8 @@ function bootstrap() {
3467
3503
  persistApiKey,
3468
3504
  (url) => shell.openExternal(url),
3469
3505
  handleReplyFinished,
3470
- () => providerRouteConfigured(engine)
3506
+ () => providerRouteConfigured(engine),
3507
+ () => settings.vaultBackendConfig().backend
3471
3508
  );
3472
3509
  const modelIpc = registerModelIpc(
3473
3510
  ipcMain,
@@ -3495,6 +3532,15 @@ function bootstrap() {
3495
3532
  // the CLI, which shares this store.
3496
3533
  registerConfirmModeIpc(ipcMain, withAutoRoundsSwitch(createConfirmModeDispatch(settings), modelIpc.modelDispatch));
3497
3534
 
3535
+ // Vault backend preference (Settings/the authorship panel → Google Drive /
3536
+ // AE / No sync): aegis:getVaultBackend / aegis:setVaultBackend. Registered
3537
+ // here, beside confirm mode, for the same reason — this is where the
3538
+ // settings store lands, and lib/fingerprint.js's vaultScope()/vaultDisabled()
3539
+ // read the live value through the getVaultBackend thunks passed to
3540
+ // registerIpc and createAutoMint above, so a change here reaches the very
3541
+ // next publish/anchor/vault/audit call with no restart.
3542
+ registerConfirmModeIpc(ipcMain, createVaultBackendDispatch(settings));
3543
+
3498
3544
  // Funnel instrumentation (Phase 2 of docs/upgrade-conversion-plan.md):
3499
3545
  // aegis:telemetryEvent / aegis:telemetryReport, backed by
3500
3546
  // lib/local/telemetry.js.
@@ -3539,12 +3585,12 @@ function bootstrap() {
3539
3585
  // nobody to answer a card, so the interactive engine is the wrong one to hand
3540
3586
  // a worker (see createQueueEngine).
3541
3587
  //
3542
- // Registration alone drains nothing. There are now exactly two ways a drain
3543
- // starts, and both are visible in the UI: a click on the card's
3544
- // Run one / Drain all, or the card's "drain automatically" switch — a
3545
- // PERSISTED, DEFAULT-OFF setting (settings.js `__autoDrain`) read by
3546
- // lib/auto.js on every tick. There is still no boot drain and no
3547
- // drain-on-idle; the interval only exists while the switch is on.
3588
+ // Registration alone drains nothing. Two ways a drain starts: the queue
3589
+ // card's Run one / Drain all (the card is hidden now, but the IPC and the
3590
+ // CLI entry point are the same call), or the background worker below — a
3591
+ // PERSISTED setting (settings.js `__autoDrain`), ON unless explicitly
3592
+ // switched off, read by lib/auto.js on every tick. There is still no boot
3593
+ // drain and no drain-on-idle: the first tick is one interval after start.
3548
3594
  const queueDispatch = registerQueueIpc(ipcMain, {
3549
3595
  engine: createQueueEngine(aegis, settings),
3550
3596
  aegis,
@@ -3584,7 +3630,12 @@ function bootstrap() {
3584
3630
  let autoFingerprint = null;
3585
3631
  autoMint = createAutoMint({
3586
3632
  mint: (payload) => {
3587
- if (!autoFingerprint) autoFingerprint = createFingerprintService({ dir: dataDir });
3633
+ if (!autoFingerprint) {
3634
+ autoFingerprint = createFingerprintService({
3635
+ dir: dataDir,
3636
+ getVaultBackend: () => settings.vaultBackendConfig().backend,
3637
+ });
3638
+ }
3588
3639
  return autoFingerprint.mint(payload || {});
3589
3640
  },
3590
3641
  settings,
@@ -3592,10 +3643,12 @@ function bootstrap() {
3592
3643
 
3593
3644
  registerAutoIpc(ipcMain, createAutoDispatch({ autoDrain, autoMint }));
3594
3645
 
3595
- // Arm whatever the user left switched on — and nothing else. Both start()
3596
- // calls are reads of a persisted, default-off setting: on a default install
3597
- // the drain timer is not created at all and the mint has no pending turns, so
3598
- // the queue still waits for a click and no session is ever sealed by itself.
3646
+ // Arm the background workers. Both start() calls are reads of a persisted
3647
+ // setting that is ON unless it was explicitly switched off (settings.js
3648
+ // `__autoDrain`/`__autoMint`), so a default install drains a queued task with
3649
+ // no click and seals a quiet session with nothing on screen. Neither start()
3650
+ // drains or seals anything by itself: the drain's first tick is one interval
3651
+ // away and the mint waits for a finished turn before its quiet clock starts.
3599
3652
  autoDrain.start();
3600
3653
  autoMint.start();
3601
3654
 
@@ -4104,6 +4157,7 @@ module.exports = {
4104
4157
  MENU_SEARCH_CHANNEL,
4105
4158
  MENU_EXPORT_MARKDOWN_CHANNEL,
4106
4159
  MENU_EXPORT_JSON_CHANNEL,
4160
+ MENU_FINGERPRINT_CHANNEL,
4107
4161
  DEEP_LINK_CHANNEL,
4108
4162
  UPDATE_STATUS_CHANNEL,
4109
4163
  UPDATE_CHECK_INTERVAL_MS,
@@ -4139,6 +4193,7 @@ module.exports = {
4139
4193
  createQuickLauncherDispatch,
4140
4194
  registerQuickLauncherIpc,
4141
4195
  createConfirmModeDispatch,
4196
+ createVaultBackendDispatch,
4142
4197
  withAutoRoundsSwitch,
4143
4198
  createTelemetryDispatch,
4144
4199
  registerTelemetryIpc,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "aegis-desktop",
3
3
  "productName": "AEGIS Desktop",
4
- "version": "1.0.10",
4
+ "version": "1.0.12",
5
5
  "description": "Thin Electron host for AEGIS — a local chat UI over the shared client/aegis.js transport. Ships transport + UI only; engine logic stays server-side.",
6
6
  "author": {
7
7
  "name": "AEGIS Code",
@@ -32,7 +32,7 @@
32
32
  "demo": "node scripts/record-demo-gif.mjs",
33
33
  "dist": "npm run predist && electron-builder",
34
34
  "dist:dir": "npm run predist && electron-builder --dir",
35
- "check": "node --check main.js && node --check preload.js && node --check renderer/app.js && node --check renderer/quick.js && node --check renderer/budget.js && node --check renderer/usage.js && node --check renderer/stream-policy.js && node --check renderer/transcript-view.js && node --check renderer/diff.js && node --check renderer/diffview.js && node --check renderer/markdown.js && node --check renderer/vendor/aegis-highlight.js && node --check scripts/predist.mjs && node --check scripts/generate-icon.mjs && node --check scripts/bundle-fonts.mjs && node --check lib/local/local.js && node --check lib/local/context.js && node --check lib/local/engine.js && node --check lib/local/session-rounds.js && node --check lib/local/tools.js && node --check lib/local/prompt.js && node --check lib/local/shell.js && node --check lib/local/agents.js && node --check lib/local/queue.js && node --check lib/local/autonomous.js && node --check lib/account-key.js && node --check lib/settings.js && node --check lib/sync/sessions.js && node --check lib/sync/memory-queue.js && node --check lib/window-state.js && node --check lib/deep-link.js && node --check lib/quick-launcher.js && node --check lib/avatar/tiers.js && node --check lib/avatar/xp.js && node --check lib/avatar/level.js && node --check lib/avatar/events.js && node --check lib/avatar/persona.js && node --check bin/aegis.js",
35
+ "check": "node --check main.js && node --check preload.js && node --check renderer/app.js && node --check renderer/quick.js && node --check renderer/providers.js && node --check renderer/provider-toolbar.js && node --check renderer/companion.js && node --check renderer/budget.js && node --check renderer/usage.js && node --check renderer/stream-policy.js && node --check renderer/transcript-view.js && node --check renderer/diff.js && node --check renderer/diffview.js && node --check renderer/markdown.js && node --check renderer/vendor/aegis-highlight.js && node --check scripts/predist.mjs && node --check scripts/generate-icon.mjs && node --check scripts/bundle-fonts.mjs && node --check lib/local/local.js && node --check lib/local/context.js && node --check lib/local/engine.js && node --check lib/local/session-rounds.js && node --check lib/local/tools.js && node --check lib/local/prompt.js && node --check lib/local/shell.js && node --check lib/local/agents.js && node --check lib/local/queue.js && node --check lib/local/autonomous.js && node --check lib/account-key.js && node --check lib/settings.js && node --check lib/sync/sessions.js && node --check lib/sync/memory-queue.js && node --check lib/window-state.js && node --check lib/deep-link.js && node --check lib/quick-launcher.js && node --check lib/avatar/tiers.js && node --check lib/avatar/xp.js && node --check lib/avatar/level.js && node --check lib/avatar/events.js && node --check lib/avatar/persona.js && node --check bin/aegis.js",
36
36
  "test:shell": "node ../test/desktop-shell.mjs",
37
37
  "test:model": "node ../test/model-dispatch.mjs",
38
38
  "test:budget": "node ../test/budget.test.mjs",
@@ -50,6 +50,8 @@
50
50
  "test:stream-policy": "node ../test/stream-policy.test.mjs",
51
51
  "test:renderer-dom": "node ../test/renderer-dom.test.mjs",
52
52
  "test:renderer-wiring": "node ../test/renderer-wiring.test.mjs",
53
+ "test:renderer-welcome": "node test/renderer-welcome.test.mjs",
54
+ "test:renderer-providers": "node ../test/renderer-providers.test.mjs",
53
55
  "test:avatar-xp": "node test/avatar-xp.test.mjs",
54
56
  "test:avatar-level": "node test/avatar-level.test.mjs",
55
57
  "test:avatar-events": "node test/avatar-events.test.mjs",
@@ -32,6 +32,7 @@ const MENU_NEW_CHAT_CHANNEL = `${IPC_PREFIX}menuNewChat`;
32
32
  const MENU_SEARCH_CHANNEL = `${IPC_PREFIX}menuSearch`;
33
33
  const MENU_EXPORT_MARKDOWN_CHANNEL = `${IPC_PREFIX}menuExportMarkdown`;
34
34
  const MENU_EXPORT_JSON_CHANNEL = `${IPC_PREFIX}menuExportJson`;
35
+ const MENU_FINGERPRINT_CHANNEL = `${IPC_PREFIX}menuFingerprint`;
35
36
  const DEEP_LINK_CHANNEL = `${IPC_PREFIX}deepLink`;
36
37
  const QUICK_LAUNCHER_PUSH_CHANNEL = `${IPC_PREFIX}quickLauncherPush`;
37
38
 
@@ -204,6 +205,14 @@ const api = {
204
205
  getConfirmMode: () => invoke('getConfirmMode'),
205
206
  setConfirmMode: (enabled) => invoke('setConfirmMode', { enabled: Boolean(enabled) }),
206
207
 
208
+ // Vault backend (the authorship panel's Google Drive / AE / No sync picker):
209
+ // main.js createVaultBackendDispatch persists it in the settings store's
210
+ // reserved `__vaultBackend` namespace, and lib/fingerprint.js's
211
+ // vaultScope()/vaultDisabled() read it on every publish/anchor/vault/audit
212
+ // call. Both resolve `{ backend }`.
213
+ getVaultBackend: () => invoke('getVaultBackend'),
214
+ setVaultBackend: (backend) => invoke('setVaultBackend', { backend: String(backend || '') }),
215
+
207
216
  // Funnel instrumentation (Phase 2 of docs/upgrade-conversion-plan.md). The
208
217
  // renderer emits exactly two event names, on two surfaces, carrying a
209
218
  // campaign and a surface — nothing else, ever. This method picks those three
@@ -298,6 +307,14 @@ const api = {
298
307
  ipcRenderer.on(MENU_EXPORT_MARKDOWN_CHANNEL, listener);
299
308
  return () => ipcRenderer.removeListener(MENU_EXPORT_MARKDOWN_CHANNEL, listener);
300
309
  },
310
+ // View > Authorship Panel… — the sidebar card that used to open the φ(α)
311
+ // sheet is gone (sealing runs in the background), so the menu is the entry
312
+ // point. The renderer owns the sheet, main only asks for it.
313
+ onMenuFingerprint: (onTrigger) => {
314
+ const listener = () => onTrigger();
315
+ ipcRenderer.on(MENU_FINGERPRINT_CHANNEL, listener);
316
+ return () => ipcRenderer.removeListener(MENU_FINGERPRINT_CHANNEL, listener);
317
+ },
301
318
  onMenuExportJson: (onTrigger) => {
302
319
  const listener = () => onTrigger();
303
320
  ipcRenderer.on(MENU_EXPORT_JSON_CHANNEL, listener);
@@ -452,16 +469,17 @@ const quickLauncher = {
452
469
  // task's own tool loop runs in — and main.js refuses it unless it is an
453
470
  // absolute path that already exists; this file never joins, reads or writes
454
471
  // a path itself.
455
- // 2. No drain that starts by itself UNLESS the persisted switch is armed.
456
- // `drain`/`proceed` above are invoked only from the queue card's two
457
- // buttons; the timer that can call one without a click lives in
458
- // desktop/lib/auto.js and is armed by exactly one thing — the
459
- // `aegis.auto.setDrain({ enabled: true })` call the card's toggle makes
460
- // below, which writes settings.js's reserved `__autoDrain` namespace. It
461
- // is OFF in a default install, it is re-read on every tick, and switching
462
- // it off stops the very next one. Draining spends money on a real model in
463
- // a real checkout, so that switch is persisted and visible rather than
464
- // implied — but it is also not hidden from this file's users any more.
472
+ // 2. No drain that starts by itself unless the persisted switch says so —
473
+ // and in a default install it DOES say so. `drain`/`proceed` above are the
474
+ // manual entry points (the queue card is hidden now; the same calls back
475
+ // the `aegis autonomous` CLI path), and the timer that calls `proceed()`
476
+ // with no click lives in desktop/lib/auto.js, armed from settings.js's
477
+ // reserved `__autoDrain` namespace. That namespace is ON unless an
478
+ // explicit `enabled: false` is written — which is exactly what
479
+ // `aegis.auto.setDrain({ enabled: false })` below persists. Every tick
480
+ // re-reads it, so switching it off stops the very next one. Draining
481
+ // spends money on a real model in a real checkout, so the switch stays in
482
+ // the settings store rather than in this file's defaults.
465
483
  const queue = {
466
484
  // Queue one task. `payload` is { task, cwd, class, model, effort, workers,
467
485
  // maxRounds, commit }; main.js range-checks every field and answers
@@ -514,8 +532,9 @@ const queue = {
514
532
  * app's own scope (client/attest.js), so no key can be handed in from the DOM
515
533
  * even by a mistake in main.js.
516
534
  *
517
- * Both switches are OFF until one of these calls says otherwise, and the only
518
- * caller is a toggle the user clicked — see the queue section's note 2 above.
535
+ * Both switches are ON unless the settings store says otherwise; these calls
536
+ * are how a host turns one OFF. Nothing on screen has to ask first — see the
537
+ * queue section's note 2 above.
519
538
  */
520
539
  const auto = {
521
540
  // { ok, drain: { enabled, intervalMs, armed, busy, ticks, drains, last, lastSkip }, mint: { … } }