aegiscode 7.0.10 → 7.0.12

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.
@@ -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,