aegisone 1.0.63 → 1.0.65
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.
- package/README.md +1 -1
- package/bin/aegis.js +1 -1
- package/package.json +1 -1
- package/scripts/bump.mjs +1 -1
- package/scripts/bundle.js +1 -1
- package/scripts/postinstall.mjs +1 -1
- package/scripts/predist.mjs +1 -1
- package/src/child.js +1 -1
- package/src/dispatch.js +1 -1
- package/src/doctor.js +1 -1
- package/src/probes.js +1 -1
- package/src/productupdate.js +1 -1
- package/src/protocol.js +1 -1
- package/src/release.js +1 -1
- package/src/selfhost.js +1 -1
- package/vendor/cli/package.json +1 -1
- package/vendor/cli/scripts/check.mjs +1 -1
- package/vendor/cli/scripts/demo.mjs +1 -1
- package/vendor/cli/scripts/postinstall.mjs +1 -1
- package/vendor/cli/scripts/predist.mjs +1 -1
- package/vendor/cli/scripts/runtests.mjs +1 -1
- package/vendor/cli/src/app.js +1 -1
- package/vendor/cli/src/art.js +1 -1
- package/vendor/cli/src/chatflow.js +1 -1
- package/vendor/cli/src/checkpoint.js +1 -1
- package/vendor/cli/src/clipboard.js +1 -1
- package/vendor/cli/src/cloudsync.js +1 -1
- package/vendor/cli/src/commands.js +2 -2
- package/vendor/cli/src/config.js +1 -1
- package/vendor/cli/src/connect.js +1 -1
- package/vendor/cli/src/devrun.js +1 -1
- package/vendor/cli/src/diff.js +1 -1
- package/vendor/cli/src/diffview.js +1 -1
- package/vendor/cli/src/dream.js +1 -1
- package/vendor/cli/src/engine.js +1 -1
- package/vendor/cli/src/events.js +1 -1
- package/vendor/cli/src/export.js +1 -1
- package/vendor/cli/src/fingerprint.js +1 -1
- package/vendor/cli/src/format.js +1 -1
- package/vendor/cli/src/fuzzy.js +1 -1
- package/vendor/cli/src/history.js +1 -1
- package/vendor/cli/src/init.js +1 -1
- package/vendor/cli/src/markdown.js +1 -1
- package/vendor/cli/src/models.js +1 -1
- package/vendor/cli/src/overlays.js +1 -1
- package/vendor/cli/src/panels.js +1 -1
- package/vendor/cli/src/ping.js +1 -1
- package/vendor/cli/src/presence.js +1 -1
- package/vendor/cli/src/render.js +1 -1
- package/vendor/cli/src/screen.js +1 -1
- package/vendor/cli/src/screens.js +1 -1
- package/vendor/cli/src/secret.js +1 -1
- package/vendor/cli/src/securefs.js +1 -1
- package/vendor/cli/src/settings.js +1 -1
- package/vendor/cli/src/signup.js +1 -1
- package/vendor/cli/src/summarize.js +1 -1
- package/vendor/cli/src/sysdiag.js +1 -1
- package/vendor/cli/src/theme.js +1 -1
- package/vendor/cli/src/title.js +1 -1
- package/vendor/cli/src/todos.js +1 -1
- package/vendor/cli/src/tokens.js +1 -1
- package/vendor/cli/src/topup.js +1 -1
- package/vendor/cli/src/update.js +1 -1
- package/vendor/cli/vendor/client/aegis.js +1 -1
- package/vendor/cli/vendor/client/attest.js +1 -1
- package/vendor/cli/vendor/client/authorship-key.js +1 -1
- package/vendor/cli/vendor/client/auto-provision.js +1 -1
- package/vendor/cli/vendor/client/brain-catalog.js +1 -1
- package/vendor/cli/vendor/client/byok-catalog.js +1 -1
- package/vendor/cli/vendor/client/catalog-client.js +1 -1
- package/vendor/cli/vendor/client/conversation-export.js +1 -1
- package/vendor/cli/vendor/client/credentials.js +1 -1
- package/vendor/cli/vendor/client/credits.js +1 -1
- package/vendor/cli/vendor/client/drive-connect.js +1 -1
- package/vendor/cli/vendor/client/env-file.js +1 -1
- package/vendor/cli/vendor/client/fingerprint.js +1 -1
- package/vendor/cli/vendor/client/foreign-memory.js +1 -1
- package/vendor/cli/vendor/client/foreign-sessions.js +1 -1
- package/vendor/cli/vendor/client/google-signin.js +1 -1
- package/vendor/cli/vendor/client/hooks.js +1 -1
- package/vendor/cli/vendor/client/model-discovery.js +1 -1
- package/vendor/cli/vendor/client/model-sync.js +1 -1
- package/vendor/cli/vendor/client/naming.js +1 -1
- package/vendor/cli/vendor/client/platform.js +1 -1
- package/vendor/cli/vendor/client/prefs.js +1 -1
- package/vendor/cli/vendor/client/presence.js +1 -1
- package/vendor/cli/vendor/client/record-vault.js +2 -2
- package/vendor/cli/vendor/client/session-search.js +1 -1
- package/vendor/cli/vendor/client/session-store.js +1 -1
- package/vendor/cli/vendor/client/skills.js +1 -1
- package/vendor/cli/vendor/client/topup.js +1 -1
- package/vendor/cli/vendor/client/touch.js +1 -1
- package/vendor/cli/vendor/client/update.js +1 -1
- package/vendor/cli/vendor/client/user-models.js +1 -1
- package/vendor/cli/vendor/desktop/lib/local/attachments.js +1 -1
- package/vendor/cli/vendor/desktop/lib/local/autonomous.js +1 -1
- package/vendor/cli/vendor/desktop/lib/local/claude-pro.js +1 -1
- package/vendor/cli/vendor/desktop/lib/local/context.js +1 -1
- package/vendor/cli/vendor/desktop/lib/local/engine.js +1 -1
- package/vendor/cli/vendor/desktop/lib/local/entitlement.js +1 -1
- package/vendor/cli/vendor/desktop/lib/local/integrity.js +1 -1
- package/vendor/cli/vendor/desktop/lib/local/local.js +1 -1
- package/vendor/cli/vendor/desktop/lib/local/perm-rules.js +5 -0
- package/vendor/cli/vendor/desktop/lib/local/perm-store.js +5 -0
- package/vendor/cli/vendor/desktop/lib/local/perm-write.js +5 -0
- package/vendor/cli/vendor/desktop/lib/local/pro-sessions.js +3 -1
- package/vendor/cli/vendor/desktop/lib/local/prompt.js +1 -1
- package/vendor/cli/vendor/desktop/lib/local/queue.js +1 -1
- package/vendor/cli/vendor/desktop/lib/local/repeat-guard.js +1 -1
- package/vendor/cli/vendor/desktop/lib/local/session-rounds.js +1 -1
- package/vendor/cli/vendor/desktop/lib/local/spill.js +1 -1
- package/vendor/cli/vendor/desktop/lib/local/turn-guard.js +1 -1
- package/vendor/cli/vendor/desktop/lib/local/verify-stop.js +1 -1
- package/vendor/cli/vendor/desktop/lib/local/worktree-lock.js +1 -1
- package/vendor/cli/vendor/desktop/lib/settings.js +1 -1
- package/vendor/cli/vendor/desktop/renderer/usage.js +1 -1
- package/vendor/cli/vendor/hosts/install.js +1 -1
- package/vendor/cli/vendor/hosts/openai-shim.js +1 -1
- package/vendor/cli/vendor/hosts/spec.js +1 -1
- package/vendor/cli/vendor/hosts/targets.js +1 -1
- package/vendor/cli/vendor/mcp/admission.js +1 -1
- package/vendor/cli/vendor/mcp/server.js +1 -1
- package/vendor/cli/vendor/mcp/tools.js +1 -1
- package/vendor/cli/vendor/one/src/child.js +1 -1
- package/vendor/cli/vendor/one/src/protocol.js +1 -1
- package/vendor/cli/vendor/one/src/selfhost.js +1 -1
- package/vendor/desktop/bin/aegis.js +1 -1
- package/vendor/desktop/lib/auto.js +1 -1
- package/vendor/desktop/lib/avatar/companion.js +1 -1
- package/vendor/desktop/lib/avatar/cosmetics.js +1 -1
- package/vendor/desktop/lib/avatar/holder-turn.js +1 -1
- package/vendor/desktop/lib/avatar/holders.js +1 -1
- package/vendor/desktop/lib/avatar/identity.js +1 -1
- package/vendor/desktop/lib/avatar/level.js +1 -1
- package/vendor/desktop/lib/avatar/mirror.js +1 -1
- package/vendor/desktop/lib/avatar/persona.js +1 -1
- package/vendor/desktop/lib/avatar/profile.js +1 -1
- package/vendor/desktop/lib/avatar/register.js +1 -1
- package/vendor/desktop/lib/avatar/store.js +1 -1
- package/vendor/desktop/lib/avatar/transfer.js +1 -1
- package/vendor/desktop/lib/avatar/turn.js +1 -1
- package/vendor/desktop/lib/avatar/voice.js +1 -1
- package/vendor/desktop/lib/avatar/xp.js +1 -1
- package/vendor/desktop/lib/deep-link.js +1 -1
- package/vendor/desktop/lib/local/attachments.js +1 -1
- package/vendor/desktop/lib/local/autonomous.js +1 -1
- package/vendor/desktop/lib/local/claude-pro.js +1 -1
- package/vendor/desktop/lib/local/cli-face.js +1 -1
- package/vendor/desktop/lib/local/context.js +1 -1
- package/vendor/desktop/lib/local/engine.js +1 -1
- package/vendor/desktop/lib/local/entitlement.js +1 -1
- package/vendor/desktop/lib/local/integrity.js +1 -1
- package/vendor/desktop/lib/local/local.js +1 -1
- package/vendor/desktop/lib/local/perm-rules.js +5 -0
- package/vendor/desktop/lib/local/perm-store.js +5 -0
- package/vendor/desktop/lib/local/perm-write.js +5 -0
- package/vendor/desktop/lib/local/pro-sessions.js +3 -1
- package/vendor/desktop/lib/local/prompt.js +1 -1
- package/vendor/desktop/lib/local/pty-host.js +1 -1
- package/vendor/desktop/lib/local/queue.js +1 -1
- package/vendor/desktop/lib/local/repeat-guard.js +1 -1
- package/vendor/desktop/lib/local/session-rounds.js +1 -1
- package/vendor/desktop/lib/local/spill.js +1 -1
- package/vendor/desktop/lib/local/telemetry.js +1 -1
- package/vendor/desktop/lib/local/turn-guard.js +1 -1
- package/vendor/desktop/lib/local/verify-stop.js +1 -1
- package/vendor/desktop/lib/local/worktree-lock.js +1 -1
- package/vendor/desktop/lib/provider-key-mirror.js +1 -1
- package/vendor/desktop/lib/quick-launcher.js +1 -1
- package/vendor/desktop/lib/settings.js +1 -1
- package/vendor/desktop/lib/skills-host.js +1 -1
- package/vendor/desktop/lib/speech-host.js +1 -1
- package/vendor/desktop/lib/sync/memory-store.js +1 -1
- package/vendor/desktop/lib/sync/persist-gate.js +1 -1
- package/vendor/desktop/lib/window-state.js +1 -1
- package/vendor/desktop/package.json +1 -1
- package/vendor/desktop/preload.js +3 -1
- package/vendor/desktop/renderer/app.js +3 -3
- package/vendor/desktop/renderer/avatar/assemble.js +1 -1
- package/vendor/desktop/renderer/avatar/avatar.js +1 -1
- package/vendor/desktop/renderer/avatar/cards.js +1 -1
- package/vendor/desktop/renderer/avatar/hud.js +1 -1
- package/vendor/desktop/renderer/avatar/pane.js +1 -1
- package/vendor/desktop/renderer/avatar/parts.js +1 -1
- package/vendor/desktop/renderer/commands.js +1 -1
- package/vendor/desktop/renderer/companion.js +1 -1
- package/vendor/desktop/renderer/composer-triggers.js +1 -1
- package/vendor/desktop/renderer/dictation.js +1 -1
- package/vendor/desktop/renderer/diff.js +1 -1
- package/vendor/desktop/renderer/diffview.js +1 -1
- package/vendor/desktop/renderer/fingerprint.js +2 -2
- package/vendor/desktop/renderer/index.html +10 -4
- package/vendor/desktop/renderer/library.js +1 -1
- package/vendor/desktop/renderer/markdown.js +1 -1
- package/vendor/desktop/renderer/palette-filter.js +1 -1
- package/vendor/desktop/renderer/provider-toolbar.js +1 -1
- package/vendor/desktop/renderer/providers.js +1 -1
- package/vendor/desktop/renderer/pty-frame.css +35 -0
- package/vendor/desktop/renderer/pty-frame.html +47 -0
- package/vendor/desktop/renderer/pty-panel.js +1 -1
- package/vendor/desktop/renderer/quick.js +1 -1
- package/vendor/desktop/renderer/settings-skills.js +1 -1
- package/vendor/desktop/renderer/shortcuts.js +1 -1
- package/vendor/desktop/renderer/stream-policy.js +1 -1
- package/vendor/desktop/renderer/style.css +22 -0
- package/vendor/desktop/renderer/transcript-view.js +1 -1
- package/vendor/desktop/renderer/usage.js +1 -1
- package/vendor/desktop/renderer/welcome-rows.js +1 -1
- package/vendor/desktop/vendor/aegis.js +1 -1
- package/vendor/desktop/vendor/attest.js +1 -1
- package/vendor/desktop/vendor/authorship-key.js +1 -1
- package/vendor/desktop/vendor/auto-provision.js +1 -1
- package/vendor/desktop/vendor/brain-catalog.js +1 -1
- package/vendor/desktop/vendor/byok-catalog.js +1 -1
- package/vendor/desktop/vendor/catalog-client.js +1 -1
- package/vendor/desktop/vendor/conversation-export.js +1 -1
- package/vendor/desktop/vendor/credentials.js +1 -1
- package/vendor/desktop/vendor/credits.js +1 -1
- package/vendor/desktop/vendor/drive-connect.js +1 -1
- package/vendor/desktop/vendor/env-file.js +1 -1
- package/vendor/desktop/vendor/faces/cli/bin/aegiscode.js +2 -2
- package/vendor/desktop/vendor/faces/cli/package.json +1 -1
- package/vendor/desktop/vendor/faces/cli/scripts/check.mjs +1 -1
- package/vendor/desktop/vendor/faces/cli/scripts/demo.mjs +1 -1
- package/vendor/desktop/vendor/faces/cli/scripts/postinstall.mjs +1 -1
- package/vendor/desktop/vendor/faces/cli/scripts/predist.mjs +1 -1
- package/vendor/desktop/vendor/faces/cli/scripts/runtests.mjs +1 -1
- package/vendor/desktop/vendor/faces/cli/src/app.js +1 -1
- package/vendor/desktop/vendor/faces/cli/src/art.js +1 -1
- package/vendor/desktop/vendor/faces/cli/src/autonomous.js +1 -1
- package/vendor/desktop/vendor/faces/cli/src/caps.js +1 -1
- package/vendor/desktop/vendor/faces/cli/src/chatflow.js +1 -1
- package/vendor/desktop/vendor/faces/cli/src/checkpoint.js +1 -1
- package/vendor/desktop/vendor/faces/cli/src/clipboard.js +1 -1
- package/vendor/desktop/vendor/faces/cli/src/cloudsync.js +1 -1
- package/vendor/desktop/vendor/faces/cli/src/commands.js +2 -2
- package/vendor/desktop/vendor/faces/cli/src/config.js +1 -1
- package/vendor/desktop/vendor/faces/cli/src/connect.js +1 -1
- package/vendor/desktop/vendor/faces/cli/src/devrun.js +1 -1
- package/vendor/desktop/vendor/faces/cli/src/diff.js +1 -1
- package/vendor/desktop/vendor/faces/cli/src/diffview.js +1 -1
- package/vendor/desktop/vendor/faces/cli/src/dream.js +1 -1
- package/vendor/desktop/vendor/faces/cli/src/engine.js +1 -1
- package/vendor/desktop/vendor/faces/cli/src/events.js +1 -1
- package/vendor/desktop/vendor/faces/cli/src/export.js +1 -1
- package/vendor/desktop/vendor/faces/cli/src/fingerprint.js +1 -1
- package/vendor/desktop/vendor/faces/cli/src/format.js +1 -1
- package/vendor/desktop/vendor/faces/cli/src/fuzzy.js +1 -1
- package/vendor/desktop/vendor/faces/cli/src/history.js +1 -1
- package/vendor/desktop/vendor/faces/cli/src/init.js +1 -1
- package/vendor/desktop/vendor/faces/cli/src/limits.js +1 -1
- package/vendor/desktop/vendor/faces/cli/src/markdown.js +1 -1
- package/vendor/desktop/vendor/faces/cli/src/mcp.js +1 -1
- package/vendor/desktop/vendor/faces/cli/src/models.js +1 -1
- package/vendor/desktop/vendor/faces/cli/src/overlays.js +1 -1
- package/vendor/desktop/vendor/faces/cli/src/panels.js +1 -1
- package/vendor/desktop/vendor/faces/cli/src/permissions.js +1 -1
- package/vendor/desktop/vendor/faces/cli/src/ping.js +1 -1
- package/vendor/desktop/vendor/faces/cli/src/presence.js +1 -1
- package/vendor/desktop/vendor/faces/cli/src/provenance.js +1 -1
- package/vendor/desktop/vendor/faces/cli/src/render.js +1 -1
- package/vendor/desktop/vendor/faces/cli/src/screen.js +1 -1
- package/vendor/desktop/vendor/faces/cli/src/screens.js +1 -1
- package/vendor/desktop/vendor/faces/cli/src/secret.js +1 -1
- package/vendor/desktop/vendor/faces/cli/src/securefs.js +1 -1
- package/vendor/desktop/vendor/faces/cli/src/settings.js +1 -1
- package/vendor/desktop/vendor/faces/cli/src/signup.js +1 -1
- package/vendor/desktop/vendor/faces/cli/src/summarize.js +1 -1
- package/vendor/desktop/vendor/faces/cli/src/sysdiag.js +1 -1
- package/vendor/desktop/vendor/faces/cli/src/theme.js +1 -1
- package/vendor/desktop/vendor/faces/cli/src/title.js +1 -1
- package/vendor/desktop/vendor/faces/cli/src/todos.js +1 -1
- package/vendor/desktop/vendor/faces/cli/src/tokens.js +1 -1
- package/vendor/desktop/vendor/faces/cli/src/topup.js +1 -1
- package/vendor/desktop/vendor/faces/cli/src/update.js +1 -1
- package/vendor/desktop/vendor/faces/cli/vendor/client/aegis.js +1 -1
- package/vendor/desktop/vendor/faces/cli/vendor/client/attest.js +1 -1
- package/vendor/desktop/vendor/faces/cli/vendor/client/authorship-key.js +1 -1
- package/vendor/desktop/vendor/faces/cli/vendor/client/auto-provision.js +1 -1
- package/vendor/desktop/vendor/faces/cli/vendor/client/brain-catalog.js +1 -1
- package/vendor/desktop/vendor/faces/cli/vendor/client/byok-catalog.js +1 -1
- package/vendor/desktop/vendor/faces/cli/vendor/client/catalog-client.js +1 -1
- package/vendor/desktop/vendor/faces/cli/vendor/client/conversation-export.js +1 -1
- package/vendor/desktop/vendor/faces/cli/vendor/client/credentials.js +1 -1
- package/vendor/desktop/vendor/faces/cli/vendor/client/credits.js +1 -1
- package/vendor/desktop/vendor/faces/cli/vendor/client/drive-connect.js +1 -1
- package/vendor/desktop/vendor/faces/cli/vendor/client/env-file.js +1 -1
- package/vendor/desktop/vendor/faces/cli/vendor/client/fingerprint.js +1 -1
- package/vendor/desktop/vendor/faces/cli/vendor/client/foreign-memory.js +1 -1
- package/vendor/desktop/vendor/faces/cli/vendor/client/foreign-sessions.js +1 -1
- package/vendor/desktop/vendor/faces/cli/vendor/client/google-signin.js +1 -1
- package/vendor/desktop/vendor/faces/cli/vendor/client/hooks.js +1 -1
- package/vendor/desktop/vendor/faces/cli/vendor/client/model-discovery.js +1 -1
- package/vendor/desktop/vendor/faces/cli/vendor/client/model-sync.js +1 -1
- package/vendor/desktop/vendor/faces/cli/vendor/client/naming.js +1 -1
- package/vendor/desktop/vendor/faces/cli/vendor/client/platform.js +1 -1
- package/vendor/desktop/vendor/faces/cli/vendor/client/prefs.js +1 -1
- package/vendor/desktop/vendor/faces/cli/vendor/client/presence.js +1 -1
- package/vendor/desktop/vendor/faces/cli/vendor/client/record-vault.js +2 -2
- package/vendor/desktop/vendor/faces/cli/vendor/client/session-search.js +1 -1
- package/vendor/desktop/vendor/faces/cli/vendor/client/session-store.js +1 -1
- package/vendor/desktop/vendor/faces/cli/vendor/client/skills.js +1 -1
- package/vendor/desktop/vendor/faces/cli/vendor/client/topup.js +1 -1
- package/vendor/desktop/vendor/faces/cli/vendor/client/touch.js +1 -1
- package/vendor/desktop/vendor/faces/cli/vendor/client/update.js +1 -1
- package/vendor/desktop/vendor/faces/cli/vendor/client/user-models.js +1 -1
- package/vendor/desktop/vendor/faces/cli/vendor/desktop/lib/local/attachments.js +1 -1
- package/vendor/desktop/vendor/faces/cli/vendor/desktop/lib/local/autonomous.js +1 -1
- package/vendor/desktop/vendor/faces/cli/vendor/desktop/lib/local/claude-pro.js +1 -1
- package/vendor/desktop/vendor/faces/cli/vendor/desktop/lib/local/context.js +1 -1
- package/vendor/desktop/vendor/faces/cli/vendor/desktop/lib/local/engine.js +1 -1
- package/vendor/desktop/vendor/faces/cli/vendor/desktop/lib/local/entitlement.js +1 -1
- package/vendor/desktop/vendor/faces/cli/vendor/desktop/lib/local/exec-plan.js +1 -1
- package/vendor/desktop/vendor/faces/cli/vendor/desktop/lib/local/integrity.js +1 -1
- package/vendor/desktop/vendor/faces/cli/vendor/desktop/lib/local/local.js +1 -1
- package/vendor/desktop/vendor/faces/cli/vendor/desktop/lib/local/perm-rules.js +2 -0
- package/vendor/desktop/vendor/faces/cli/vendor/desktop/lib/local/perm-store.js +3 -1
- package/vendor/desktop/vendor/faces/cli/vendor/desktop/lib/local/perm-write.js +2 -0
- package/vendor/desktop/vendor/faces/cli/vendor/desktop/lib/local/pro-sessions.js +3 -1
- package/vendor/desktop/vendor/faces/cli/vendor/desktop/lib/local/prompt.js +1 -1
- package/vendor/desktop/vendor/faces/cli/vendor/desktop/lib/local/queue.js +1 -1
- package/vendor/desktop/vendor/faces/cli/vendor/desktop/lib/local/repeat-guard.js +1 -1
- package/vendor/desktop/vendor/faces/cli/vendor/desktop/lib/local/session-rounds.js +1 -1
- package/vendor/desktop/vendor/faces/cli/vendor/desktop/lib/local/shell.js +1 -1
- package/vendor/desktop/vendor/faces/cli/vendor/desktop/lib/local/spill.js +1 -1
- package/vendor/desktop/vendor/faces/cli/vendor/desktop/lib/local/tools.js +1 -1
- package/vendor/desktop/vendor/faces/cli/vendor/desktop/lib/local/turn-guard.js +1 -1
- package/vendor/desktop/vendor/faces/cli/vendor/desktop/lib/local/verify-stop.js +1 -1
- package/vendor/desktop/vendor/faces/cli/vendor/desktop/lib/local/worktree-lock.js +1 -1
- package/vendor/desktop/vendor/faces/cli/vendor/desktop/lib/settings.js +1 -1
- package/vendor/desktop/vendor/faces/cli/vendor/desktop/main.js +3 -3
- package/vendor/desktop/vendor/faces/cli/vendor/desktop/renderer/usage.js +1 -1
- package/vendor/desktop/vendor/faces/cli/vendor/hosts/install.js +1 -1
- package/vendor/desktop/vendor/faces/cli/vendor/hosts/openai-shim.js +1 -1
- package/vendor/desktop/vendor/faces/cli/vendor/hosts/spec.js +1 -1
- package/vendor/desktop/vendor/faces/cli/vendor/hosts/targets.js +1 -1
- package/vendor/desktop/vendor/faces/cli/vendor/mcp/admission.js +1 -1
- package/vendor/desktop/vendor/faces/cli/vendor/mcp/server.js +1 -1
- package/vendor/desktop/vendor/faces/cli/vendor/mcp/tools.js +1 -1
- package/vendor/desktop/vendor/faces/cli/vendor/one/src/child.js +1 -1
- package/vendor/desktop/vendor/faces/cli/vendor/one/src/protocol.js +1 -1
- package/vendor/desktop/vendor/faces/cli/vendor/one/src/selfhost.js +1 -1
- package/vendor/desktop/vendor/fingerprint.js +1 -1
- package/vendor/desktop/vendor/foreign-memory.js +1 -1
- package/vendor/desktop/vendor/foreign-sessions.js +1 -1
- package/vendor/desktop/vendor/google-signin.js +1 -1
- package/vendor/desktop/vendor/hooks.js +1 -1
- package/vendor/desktop/vendor/model-discovery.js +1 -1
- package/vendor/desktop/vendor/model-sync.js +1 -1
- package/vendor/desktop/vendor/naming.js +1 -1
- package/vendor/desktop/vendor/platform.js +1 -1
- package/vendor/desktop/vendor/prefs.js +1 -1
- package/vendor/desktop/vendor/presence.js +1 -1
- package/vendor/desktop/vendor/protocol.js +1 -1
- package/vendor/desktop/vendor/record-vault.js +2 -2
- package/vendor/desktop/vendor/selfhost.js +1 -1
- package/vendor/desktop/vendor/session-search.js +1 -1
- package/vendor/desktop/vendor/session-store.js +1 -1
- package/vendor/desktop/vendor/skills.js +1 -1
- package/vendor/desktop/vendor/topup.js +1 -1
- package/vendor/desktop/vendor/touch.js +1 -1
- package/vendor/desktop/vendor/update.js +1 -1
- package/vendor/desktop/vendor/user-models.js +1 -1
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
2
2
|
// Copyright (C) 2026 Niklas Borneklint — AEGIS Code (aegiscode) / Aegiscloud.
|
|
3
|
-
"use strict";const path=require("node:path"),WARN_AT=2,REFUSE_AT=5,MODES=new Set(["off","dark","enforce"]),READ_TOOLS=new Set(["readFile"]);function resolveMode(e){const t=String((e||process.env||{}).AEGIS_REPEAT_GUARD||"").trim().toLowerCase();return MODES.has(t)?t:"dark"}function stableJson(e){return null===e||"object"!=typeof e?JSON.stringify(e):Array.isArray(e)?`[${e.map(stableJson).join(",")}]`:`{${Object.keys(e).filter(
|
|
3
|
+
"use strict";const path=require("node:path"),WARN_AT=2,REFUSE_AT=5,MODES=new Set(["off","dark","enforce"]),READ_TOOLS=new Set(["readFile"]);function resolveMode(e){const t=String((e||process.env||{}).AEGIS_REPEAT_GUARD||"").trim().toLowerCase();return MODES.has(t)?t:"dark"}function stableJson(e){return null===e||"object"!=typeof e?JSON.stringify(e):Array.isArray(e)?`[${e.map(stableJson).join(",")}]`:`{${Object.keys(e).filter(t=>void 0!==e[t]).sort().map(t=>`${JSON.stringify(t)}:${stableJson(e[t])}`).join(",")}}`}function callKey(e,t){let a;try{a=stableJson(t&&"object"==typeof t?t:{})}catch{a=`~unserialisable:${Math.random()}`}return`${e}\0${a}`}function beginRepeatGuard(e){const t=resolveMode(e&&e.env);return{mode:t,active:"off"!==t,cwd:e&&e.cwd||null,counts:new Map,paths:new Map,written:new Set,readKeys:new Map,warned:new Set,refusals:0,warnings:0}}function pathKey(e,t){let a=String(e||"");return a?(!t||a.startsWith("~")||path.isAbsolute(a)||(a=path.resolve(t,a)),a.split("\\").join("/").replace(/^\.\//,"")):""}function recordWrite(e,t){if(!e||!e.active)return;const a=pathKey(t,e.cwd);if(!a)return;e.written.add(a);const n=e.readKeys.get(a);if(n){for(const t of n)e.counts.delete(t),e.paths.delete(t),e.warned.delete(t);n.clear()}}function check(e,t,a){if(!e||!e.active)return{action:"allow"};let n=!1;if(READ_TOOLS.has(t)){const t=pathKey(a&&a.file_path,e.cwd);t&&e.written.has(t)&&(e.written.delete(t),n=!0)}const r=callKey(t,a),s=(e.counts.get(r)||0)+1;if(e.counts.set(r,s),1===s&&e.paths.set(r,summarize(t,a)),READ_TOOLS.has(t)){const t=pathKey(a&&a.file_path,e.cwd);t&&(e.readKeys.has(t)||e.readKeys.set(t,new Set),e.readKeys.get(t).add(r))}if(n)return{action:"allow"};if(s<2)return{action:"allow"};const o=e.paths.get(r)||t;return s>=5?(5===s&&(e.refusals+=1),"enforce"===e.mode?{action:"refuse",error:`refused: this is the ${ordinal(s)} identical call to \`${o}\` this turn, so the result is already in the conversation above and running it again cannot change it. Do not repeat it and do not retry it with a cosmetic variation. Either use what the earlier result already told you, or take a different action (read a different path, change the command, or write the fix). If you are genuinely blocked, stop calling tools and say what blocks you.`}:{action:"allow"}):"enforce"!==e.mode||e.warned.has(r)?{action:"allow"}:(e.warned.add(r),e.warnings+=1,{action:"allow",note:`note: you have now called \`${o}\` ${s} times this turn with identical arguments. Its result is already above — read it again before repeating the call.`})}function summarize(e,t){const a=t&&"object"==typeof t?t:{},n=a.file_path||a.path||a.command||a.pattern||a.query;return"string"==typeof n&&n?`${e} ${n.length>80?`${n.slice(0,77)}…`:n}`:e}function ordinal(e){const t=["th","st","nd","rd"],a=e%100;return t[(a-20)%10]||t[a]||t[0]}function stats(e){if(!e)return{distinct:0,warnings:0,refusals:0,maxRepeat:0,repeats:[]};let t=0;const a=[];for(const[n,r]of e.counts)r>t&&(t=r),r>=2&&a.push({call:e.paths.get(n)||"",times:r});return a.sort((e,t)=>t.times-e.times),{distinct:e.counts.size,warnings:e.warnings,refusals:e.refusals,maxRepeat:t,repeats:a.slice(0,5)}}module.exports={WARN_AT:2,REFUSE_AT:5,beginRepeatGuard:beginRepeatGuard,recordWrite:recordWrite,check:check,stats:stats,callKey:callKey,stableJson:stableJson,resolveMode:resolveMode};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
2
2
|
// Copyright (C) 2026 Niklas Borneklint — AEGIS Code (aegiscode) / Aegiscloud.
|
|
3
|
-
"use strict";const TTL_MS=18e5,MAX_ENTRIES=64,entries=new Map,historyKeys=new WeakMap;let historyKeySeq=0;function prune(e=Date.now()){for(const[t,n]of entries)e-n.at>TTL_MS&&entries.delete(t);for(;entries.size>
|
|
3
|
+
"use strict";const TTL_MS=18e5,MAX_ENTRIES=64,entries=new Map,historyKeys=new WeakMap;let historyKeySeq=0;function prune(e=Date.now()){for(const[t,n]of entries)e-n.at>TTL_MS&&entries.delete(t);for(;entries.size>64;){const e=entries.keys().next();if(e.done)break;entries.delete(e.value)}return entries.size}function keyFor(e,t){const n=e&&"object"==typeof e?e:{},r=n.sessionKey||n.sessionId||n.chatId||n.threadId||n.conversationId;if("string"==typeof r&&r.trim())return`s:${r.trim()}`;if("string"==typeof n.cwd&&n.cwd.trim())return`cwd:${n.cwd.trim()}`;if(t&&"object"==typeof t){let e=historyKeys.get(t);return e||(historyKeySeq+=1,e=`hist-${historyKeySeq}`,historyKeys.set(t,e)),e}return"default"}function isStatedKey(e){const t=e&&"object"==typeof e?e:{},n=t.sessionKey||t.sessionId||t.chatId||t.threadId||t.conversationId;return!("string"!=typeof n||!n.trim())||"string"==typeof t.cwd&&t.cwd.trim().length>0}function bonus(e){const t=Number.isFinite(e)&&e>0?e:0;return Math.max(4,Math.ceil(t/4))}function peek(e,t=Date.now()){return prune(t),entries.get(e)||null}function take(e,t=Date.now()){prune(t);const n=entries.get(e);return n?(entries.delete(e),n):null}function adopt({now:e=Date.now(),maxAgeMs:t=6e5}={}){prune(e);let n=null,r=null;for(const[s,i]of entries)e-i.at>t||(!r||i.at>r.at)&&(r=i,n=s);return r?(entries.delete(n),{key:n,entry:r}):null}function record(e,{rounds:t,tokens:n,note:r,chain:s,messages:i,added:o}={},a=Date.now()){prune(a);const u=entries.get(e),d={rounds:Number.isFinite(t)?t:0,tokens:Number.isFinite(n)?n:0,note:"string"==typeof r?r:"",at:a,interruptions:(Number.isFinite(s)?s:u&&u.interruptions)||0,messages:Array.isArray(i)?i.slice():[],added:Array.isArray(o)?o.slice():[]};return d.interruptions+=1,entries.delete(e),entries.set(e,d),prune(a),d}function resumePreamble(e){return`[session resume] The previous turn in this conversation was cut off at ${e&&e.rounds?e.rounds:"the previous turn's"} tool rounds${e&&e.tokens?` (${e.tokens.toLocaleString()} tokens)`:""} because it reached the round horizon, so the work it started is unfinished. Continue that work now: do not restart, do not re-do steps that already completed, and do not treat the interruption as a failure to report. Pick up the next unfinished step and finish with a written answer.`}function state(e=Date.now()){return prune(e),{size:entries.size,ttlMs:TTL_MS,maxEntries:64,entries:[...entries].map(([e,t])=>({key:e,...t}))}}function reset(){return entries.clear(),entries.size}module.exports={TTL_MS:TTL_MS,MAX_ENTRIES:64,keyFor:keyFor,isStatedKey:isStatedKey,bonus:bonus,peek:peek,take:take,adopt:adopt,record:record,resumePreamble:resumePreamble,state:state,reset:reset};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
2
2
|
// Copyright (C) 2026 Niklas Borneklint — AEGIS Code (aegiscode) / Aegiscloud.
|
|
3
|
-
"use strict";const fs=require("node:fs"),os=require("node:os"),path=require("node:path"),SPILL_MAX_FILES=40;let spillDir=null,spillCount=0;function spill(t){try{if(spillCount>=
|
|
3
|
+
"use strict";const fs=require("node:fs"),os=require("node:os"),path=require("node:path"),SPILL_MAX_FILES=40;let spillDir=null,spillCount=0;function spill(t){try{if(spillCount>=40)return null;spillDir||(spillDir=fs.mkdtempSync(path.join(os.tmpdir(),"aegiscode-tool-"))),spillCount+=1;const l=path.join(spillDir,`output-${spillCount}.txt`);return fs.writeFileSync(l,String(t),"utf8"),l}catch{return null}}function cap(t,l){const n=String(null==t?"":t);if(n.length<=l)return n;const i=n.slice(0,l),r=spill(n);return r?`${i}\n… (truncated after ${l} of ${n.length} chars — full output: ${r} — grep or readFile that path)`:`${i}\n… (truncated)`}module.exports={spill:spill,cap:cap,SPILL_MAX_FILES:40};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
2
2
|
// Copyright (C) 2026 Niklas Borneklint — AEGIS Code (aegiscode) / Aegiscloud.
|
|
3
|
-
"use strict";const fs=require("node:fs"),path=require("node:path"),crypto=require("node:crypto"),FUNNEL=Object.freeze(["install","key_connected","first_auto_turn","drain_used","upgrade_prompt_rendered","upgrade_prompt_clicked","checkout_started","paid"]),EVENT_ALLOWLIST=Object.freeze(["upgrade_prompt_rendered","upgrade_prompt_clicked"]),SURFACES=Object.freeze(["welcome","queue","memory","status","topup"]),CAMPAIGNS=Object.freeze(["welcome_cloud","queue_cap","memory_quota","status_card","topup_bank"]),CAMPAIGN_RE=/^[a-z0-9][a-z0-9_-]{0,63}$/,RECORD_KEYS=Object.freeze(["event","campaign","surface","app","install","ts"]),RING_MAX=500,TELEMETRY_ENV="AEGIS_TELEMETRY",DIR_NAME="telemetry",FILE_NAME="funnel.jsonl",INSTALL_ID_FILE="install-id";function telemetryEnabled(e,t){try{const t=e&&e[TELEMETRY_ENV];if(null!=t&&""!==String(t).trim())return/^(1|true|on|yes)$/i.test(String(t).trim())}catch{}try{if(t&&"function"==typeof t.getTelemetryOptIn)return!0===t.getTelemetryOptIn()}catch{}return!1}function isoNow(e){const t="function"==typeof e?e():Date.now();return new Date(Number.isFinite(t)?t:Date.now()).toISOString().replace(/\.\d{3}Z$/,"Z")}function sanitizeEvent(e,t,r){try{const n="string"==typeof e?e.trim():"";if(!EVENT_ALLOWLIST.includes(n))return null;const i=t&&"object"==typeof t?t:{},o="string"==typeof i.campaign?i.campaign.trim().toLowerCase():"",a="string"==typeof i.surface?i.surface.trim().toLowerCase():"";if(!CAMPAIGN_RE.test(o)||!CAMPAIGNS.includes(o))return null;if(!SURFACES.includes(a))return null;const c=r||{};return{event:n,campaign:o,surface:a,app:"string"==typeof c.app?c.app.slice(0,32):"",install:"string"==typeof c.install?c.install.slice(0,32):"",ts:isoNow(c.now)}}catch{return null}}function summarize(e){const t={},r={},n={};let i=0;for(const o of Array.isArray(e)?e:[]){if(!o||"object"!=typeof o||!EVENT_ALLOWLIST.includes(o.event)){i+=1;continue}t[o.event]=(t[o.event]||0)+1;const e=r[o.campaign]||{upgrade_prompt_rendered:0,upgrade_prompt_clicked:0};e[o.event]=(e[o.event]||0)+1,r[o.campaign]=e;const a=n[o.surface]||{upgrade_prompt_rendered:0,upgrade_prompt_clicked:0};a[o.event]=(a[o.event]||0)+1,n[o.surface]=a}return{totals:t,byCampaign:r,bySurface:n,dropped:i}}function noopTelemetry(){return{enabled:!1,transport:"off",dir:null,file:null,record:()=>!1,events:()=>[],report:()=>({enabled:!1,transport:"off",file:null,buffered:0,totals:{},byCampaign:{},bySurface:{},dropped:0}),flush:()=>Promise.resolve()}}function createTelemetry(e={}){if(!e.enabled)return noopTelemetry();const t="string"==typeof e.dir&&e.dir?e.dir:null,r=t?path.join(t,DIR_NAME):null,n=r?path.join(r,FILE_NAME):null,i=!1!==e.persist&&Boolean(n),o=new Set,a="function"==typeof e.log?e.log:()=>{};function c(e,t){if(!o.has(e)){o.add(e);try{a("debug",`telemetry: ${e}`,t)}catch{}}}const l=[];let s=0,u="string"==typeof e.installId?e.installId:null;function p(){if(u)return u;if(u=function(){try{return crypto.randomBytes(8).toString("hex")}catch{return`anon${Date.now().toString(16)}`}}(),!i)return u;const e=path.join(r,"install-id");try{const t=fs.readFileSync(e,"utf8").trim();/^[a-z0-9]{8,32}$/i.test(t)?u=t:fs.writeFileSync(e,u,{mode:384})}catch{try{fs.mkdirSync(r,{recursive:!0}),fs.writeFileSync(e,u,{mode:384})}catch(e){c("install-id",e)}}return u}let f=Promise.resolve();return{enabled:!0,transport:"local-jsonl",dir:r,file:n,record:function(t,o){try{const u=sanitizeEvent(t,o,{app:e.appVersion,install:p(),now:e.now});if(!u)return s+=1,!1;if(l.push(u),l.length>500&&l.splice(0,l.length-500),i&&n&&(a=`${JSON.stringify(u)}\n`,f=f.then((
|
|
3
|
+
"use strict";const fs=require("node:fs"),path=require("node:path"),crypto=require("node:crypto"),FUNNEL=Object.freeze(["install","key_connected","first_auto_turn","drain_used","upgrade_prompt_rendered","upgrade_prompt_clicked","checkout_started","paid"]),EVENT_ALLOWLIST=Object.freeze(["upgrade_prompt_rendered","upgrade_prompt_clicked"]),SURFACES=Object.freeze(["welcome","queue","memory","status","topup"]),CAMPAIGNS=Object.freeze(["welcome_cloud","queue_cap","memory_quota","status_card","topup_bank"]),CAMPAIGN_RE=/^[a-z0-9][a-z0-9_-]{0,63}$/,RECORD_KEYS=Object.freeze(["event","campaign","surface","app","install","ts"]),RING_MAX=500,TELEMETRY_ENV="AEGIS_TELEMETRY",DIR_NAME="telemetry",FILE_NAME="funnel.jsonl",INSTALL_ID_FILE="install-id";function telemetryEnabled(e,t){try{const t=e&&e[TELEMETRY_ENV];if(null!=t&&""!==String(t).trim())return/^(1|true|on|yes)$/i.test(String(t).trim())}catch{}try{if(t&&"function"==typeof t.getTelemetryOptIn)return!0===t.getTelemetryOptIn()}catch{}return!1}function isoNow(e){const t="function"==typeof e?e():Date.now();return new Date(Number.isFinite(t)?t:Date.now()).toISOString().replace(/\.\d{3}Z$/,"Z")}function sanitizeEvent(e,t,r){try{const n="string"==typeof e?e.trim():"";if(!EVENT_ALLOWLIST.includes(n))return null;const i=t&&"object"==typeof t?t:{},o="string"==typeof i.campaign?i.campaign.trim().toLowerCase():"",a="string"==typeof i.surface?i.surface.trim().toLowerCase():"";if(!CAMPAIGN_RE.test(o)||!CAMPAIGNS.includes(o))return null;if(!SURFACES.includes(a))return null;const c=r||{};return{event:n,campaign:o,surface:a,app:"string"==typeof c.app?c.app.slice(0,32):"",install:"string"==typeof c.install?c.install.slice(0,32):"",ts:isoNow(c.now)}}catch{return null}}function summarize(e){const t={},r={},n={};let i=0;for(const o of Array.isArray(e)?e:[]){if(!o||"object"!=typeof o||!EVENT_ALLOWLIST.includes(o.event)){i+=1;continue}t[o.event]=(t[o.event]||0)+1;const e=r[o.campaign]||{upgrade_prompt_rendered:0,upgrade_prompt_clicked:0};e[o.event]=(e[o.event]||0)+1,r[o.campaign]=e;const a=n[o.surface]||{upgrade_prompt_rendered:0,upgrade_prompt_clicked:0};a[o.event]=(a[o.event]||0)+1,n[o.surface]=a}return{totals:t,byCampaign:r,bySurface:n,dropped:i}}function noopTelemetry(){return{enabled:!1,transport:"off",dir:null,file:null,record:()=>!1,events:()=>[],report:()=>({enabled:!1,transport:"off",file:null,buffered:0,totals:{},byCampaign:{},bySurface:{},dropped:0}),flush:()=>Promise.resolve()}}function createTelemetry(e={}){if(!e.enabled)return noopTelemetry();const t="string"==typeof e.dir&&e.dir?e.dir:null,r=t?path.join(t,DIR_NAME):null,n=r?path.join(r,FILE_NAME):null,i=!1!==e.persist&&Boolean(n),o=new Set,a="function"==typeof e.log?e.log:()=>{};function c(e,t){if(!o.has(e)){o.add(e);try{a("debug",`telemetry: ${e}`,t)}catch{}}}const l=[];let s=0,u="string"==typeof e.installId?e.installId:null;function p(){if(u)return u;if(u=function(){try{return crypto.randomBytes(8).toString("hex")}catch{return`anon${Date.now().toString(16)}`}}(),!i)return u;const e=path.join(r,"install-id");try{const t=fs.readFileSync(e,"utf8").trim();/^[a-z0-9]{8,32}$/i.test(t)?u=t:fs.writeFileSync(e,u,{mode:384})}catch{try{fs.mkdirSync(r,{recursive:!0}),fs.writeFileSync(e,u,{mode:384})}catch(e){c("install-id",e)}}return u}let f=Promise.resolve();return{enabled:!0,transport:"local-jsonl",dir:r,file:n,record:function(t,o){try{const u=sanitizeEvent(t,o,{app:e.appVersion,install:p(),now:e.now});if(!u)return s+=1,!1;if(l.push(u),l.length>500&&l.splice(0,l.length-500),i&&n&&(a=`${JSON.stringify(u)}\n`,f=f.then(()=>new Promise(e=>{fs.mkdir(r,{recursive:!0},()=>{fs.appendFile(n,a,t=>{t&&c("append",t),e()})})})).catch(e=>{c("append",e)})),"function"==typeof e.sender)try{const t=e.sender(u);t&&"function"==typeof t.catch&&t.catch(e=>c("sender",e))}catch(e){c("sender",e)}return!0}catch(e){return c("record",e),!1}var a},events:function(){return l.slice()},report:function(){try{const t=summarize(l);return{enabled:!0,transport:"function"==typeof e.sender?"local-jsonl+server":"local-jsonl",file:i?n:null,install:u,buffered:l.length,...t,droppedUnrecognised:s}}catch(e){return c("report",e),{enabled:!0,error:"report failed",totals:{},byCampaign:{},bySurface:{}}}},flush:function(){return f.catch(()=>{})},installId:()=>p()}}function readFile(e){try{const t=fs.readFileSync(e,"utf8"),r=[];for(const e of t.split("\n"))if(e.trim())try{r.push(JSON.parse(e))}catch{}return r}catch{return[]}}module.exports={FUNNEL:FUNNEL,EVENT_ALLOWLIST:EVENT_ALLOWLIST,SURFACES:SURFACES,CAMPAIGNS:CAMPAIGNS,CAMPAIGN_RE:CAMPAIGN_RE,RECORD_KEYS:RECORD_KEYS,RING_MAX:500,TELEMETRY_ENV:TELEMETRY_ENV,DIR_NAME:DIR_NAME,FILE_NAME:FILE_NAME,INSTALL_ID_FILE:"install-id",telemetryEnabled:telemetryEnabled,sanitizeEvent:sanitizeEvent,summarize:summarize,createTelemetry:createTelemetry,readFile:readFile};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
2
2
|
// Copyright (C) 2026 Niklas Borneklint — AEGIS Code (aegiscode) / Aegiscloud.
|
|
3
|
-
"use strict";const{gitRoot:gitRoot,gitStatusSnapshot:gitStatusSnapshot}=require("./git-scope.js"),GIT_FLAGS_WITH_ARG=new Set(["-C","-c","--git-dir","--work-tree","--namespace","--exec-path"]);function tokenize(t){const e=[];for(const n of String(t||"").split(/[|;&\n]+/)){const t=[],r=/"([^"]*)"|'([^']*)'|(\S+)/g;let s;for(;s=r.exec(n);)t.push(s[1]??s[2]??s[3]);t.length&&e.push(t)}return e}function gitInvocation(t){const e=t.findIndex(
|
|
3
|
+
"use strict";const{gitRoot:gitRoot,gitStatusSnapshot:gitStatusSnapshot}=require("./git-scope.js"),GIT_FLAGS_WITH_ARG=new Set(["-C","-c","--git-dir","--work-tree","--namespace","--exec-path"]);function tokenize(t){const e=[];for(const n of String(t||"").split(/[|;&\n]+/)){const t=[],r=/"([^"]*)"|'([^']*)'|(\S+)/g;let s;for(;s=r.exec(n);)t.push(s[1]??s[2]??s[3]);t.length&&e.push(t)}return e}function gitInvocation(t){const e=t.findIndex(t=>"git"===t||t.endsWith("/git"));if(-1===e)return null;let n=e+1;for(;n<t.length&&t[n].startsWith("-");)n+=GIT_FLAGS_WITH_ARG.has(t[n])?2:1;return n>=t.length?null:{sub:t[n],args:t.slice(n+1)}}function namedPaths(t){const e=t.indexOf("--");return-1!==e?t.slice(e+1).filter(t=>!t.startsWith("-")):t.filter(t=>!t.startsWith("-"))}const isTreeMark=t=>"."===t||"./"===t||"*"===t||"./*"===t,hasForce=t=>t.some(t=>"-f"===t||"--force"===t||/^-[a-zA-Z]*f/.test(t));function judge(t,e){const n=namedPaths(e),r=0===n.length||n.some(isTreeMark);switch(t){case"checkout":return e.includes("--")||hasForce(e)?{what:"checkout of uncommitted changes",scope:r?"tree":"paths",paths:n}:r&&n.length?{what:"checkout . (tree-wide restore)",scope:"tree",paths:n}:null;case"restore":return{what:"restore (discards uncommitted changes)",scope:r?"tree":"paths",paths:n};case"reset":return e.includes("--hard")?{what:"reset --hard",scope:"tree",paths:[]}:null;case"clean":return hasForce(e)?{what:"clean -f (deletes untracked files)",scope:"tree",paths:[]}:null;case"stash":{const t=e.find(t=>!t.startsWith("-"));return"list"===t||"show"===t?null:{what:`stash ${t||"push"} (uncommitted changes across the tree)`,scope:"tree",paths:[]}}case"worktree":{const t=e.find(t=>!t.startsWith("-"));return"remove"===t||"prune"===t?{what:`worktree ${t}`,scope:"tree",paths:[]}:null}default:return null}}function classifyDestructive(t){for(const e of tokenize(t)){const t=gitInvocation(e);if(!t)continue;const n=judge(t.sub,t.args);if(n)return{destructive:!0,...n}}return{destructive:!1}}function beginTurnGuard(t){const e=gitRoot(t),n=e?gitStatusSnapshot(t):null;return{root:e,cwd:t,before:n,startedAt:Date.now(),written:new Set,active:Boolean(e&&n)}}function toRel(t,e){let n=String(e||"");return n?(t.root&&n.startsWith(t.root)&&(n=n.slice(t.root.length).replace(/^[/\\]/,"")),n.split("\\").join("/")):null}function recordWrite(t,e){if(!t||!t.active)return;const n=toRel(t,e);n&&t.written.add(n)}function foreignSince(t){if(!t||!t.active)return[];const e=gitStatusSnapshot(t.cwd);if(!e)return[];const n=[];for(const[r,s]of e)t.written.has(r)||t.before.has(r)&&t.before.get(r)===s&&n.push(r);return n.sort()}function concurrentSince(t){if(!t||!t.active)return[];const e=gitStatusSnapshot(t.cwd);if(!e)return[];const n=[];for(const[r]of e)t.written.has(r)||t.before.has(r)||n.push(r);return n.sort()}function blocksDestructive(t,e){const n=classifyDestructive(e);if(!n.destructive)return{ok:!0};if(!t||!t.active)return{ok:!0};let r=foreignSince(t),s=concurrentSince(t).filter(t=>!r.includes(t)),o=[];if("tree"===n.scope)o=[...r,...s];else{const t=new Set(n.paths.map(t=>t.replace(/^\.\//,""))),e=e=>e.filter(e=>t.has(e)||t.has("./"+e));r=e(r),s=e(s),o=[...r,...s]}if(!o.length)return{ok:!0,what:n.what};const i=[];return r.length&&i.push(`${r.length} hold another agent's uncommitted work: `+r.slice(0,8).join(", ")+(r.length>8?` (+${r.length-8} more)`:"")),s.length&&i.push(`${s.length} changed since this turn began and were not written by this session: ${s.slice(0,8).join(", ")}`+(s.length>8?` (+${s.length-8} more)`:"")),{ok:!1,what:n.what,scope:n.scope,foreign:r,unattributed:s,reason:`refusing \`${n.what}\` in ${t.root}: `+("tree"===n.scope?"it is tree-scoped and would discard work it did not create — ":"it targets a path that is not yours to discard — ")+i.join("; ")+". Name only the paths you mean, or take the worktree lock first."}}module.exports={classifyDestructive:classifyDestructive,beginTurnGuard:beginTurnGuard,recordWrite:recordWrite,foreignSince:foreignSince,concurrentSince:concurrentSince,blocksDestructive:blocksDestructive};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
2
2
|
// Copyright (C) 2026 Niklas Borneklint — AEGIS Code (aegiscode) / Aegiscloud.
|
|
3
|
-
"use strict";const CODE_EXT=new Set([".js",".mjs",".cjs",".jsx",".ts",".tsx",".mts",".cts",".py",".rb",".go",".rs",".java",".kt",".kts",".scala",".swift",".c",".h",".cc",".cpp",".hpp",".cxx",".hh",".m",".mm",".cs",".fs",".php",".pl",".pm",".lua",".r",".jl",".dart",".ex",".exs",".erl",".hrl",".hs",".clj",".cljs",".ml",".mli",".sh",".bash",".zsh",".fish",".ps1",".sql",".vue",".svelte",".zig",".nim",".cr",".v",".sv",".sol",".tf"]),EXEC_TOOLS=new Set(["exec"]),NUDGE="You edited %s and the turn is ending, but no command has been run since that edit. Editing a file proves it compiles no more than describing it did. Run the project's check now — its tests, a type check, or at minimum the file's own linter — and report what it printed. If you already know the change cannot be checked by a command (a comment, a docs string, a config value), say so explicitly and finish; do not claim the change \"works\" without evidence.",NUDGE_WITH_CMD='You edited %s and the turn is ending, but no command has been run since that edit. Editing a file proves it compiles no more than describing it did. The check for this repo is likely `%s` (%s) — run it and report what it printed. If you disagree with that command, run what actually checks this change. If the change cannot be checked by a command (a comment, a docs string, a config value), say so explicitly and finish; do not claim the change "works" without evidence.',MODES=new Set(["off","dark","enforce"]);function resolveMode(e){const t=String(e&&e.mode||"").trim().toLowerCase();if(MODES.has(t))return t;const n=String(process.env.AEGIS_VERIFY_STOP||"").trim().toLowerCase();return MODES.has(n)?n:"dark"}function beginVerifyGuard(e){const t=resolveMode(e);return{mode:t,cwd:e&&e.cwd||null,active:"off"!==t,dirty:[],ranSince:!1,nudged:!1,fired:0}}function extOf(e){const t=String(e||"").split(/[/\\]/).pop()||"",n=t.lastIndexOf(".");return n<=0?"":t.slice(n).toLowerCase()}function isCodePath(e){return CODE_EXT.has(extOf(e))}function recordMutation(e,t){e&&e.active&&isCodePath(t)&&(e.dirty.push(String(t)),e.ranSince=!1)}function recordExec(e){e&&e.active&&(e.ranSince=!0,e.dirty=[])}function shouldNudge(e){if(!e||!e.active)return{nudge:!1};if(!e.dirty.length)return{nudge:!1};if(e.ranSince)return{nudge:!1};if(e.nudged)return{nudge:!1};const t=e.dirty.slice(-3),n=t.join(", ")+(e.dirty.length>3?` (+${e.dirty.length-3} more)`:"");if(e.fired=1,"enforce"!==e.mode)return{nudge:!1,fired:!0,paths:t};e.nudged=!0;let i=null;if(e.cwd)try{const{detectCheckCommand:t}=require("./check-command.js");i=t(e.cwd,e.dirty[e.dirty.length-1])}catch{i=null}if(i){const e=[n,i.cmd,i.why];let r=0;return{nudge:!0,text:NUDGE_WITH_CMD.replace(/%s/g,(
|
|
3
|
+
"use strict";const CODE_EXT=new Set([".js",".mjs",".cjs",".jsx",".ts",".tsx",".mts",".cts",".py",".rb",".go",".rs",".java",".kt",".kts",".scala",".swift",".c",".h",".cc",".cpp",".hpp",".cxx",".hh",".m",".mm",".cs",".fs",".php",".pl",".pm",".lua",".r",".jl",".dart",".ex",".exs",".erl",".hrl",".hs",".clj",".cljs",".ml",".mli",".sh",".bash",".zsh",".fish",".ps1",".sql",".vue",".svelte",".zig",".nim",".cr",".v",".sv",".sol",".tf"]),EXEC_TOOLS=new Set(["exec"]),NUDGE="You edited %s and the turn is ending, but no command has been run since that edit. Editing a file proves it compiles no more than describing it did. Run the project's check now — its tests, a type check, or at minimum the file's own linter — and report what it printed. If you already know the change cannot be checked by a command (a comment, a docs string, a config value), say so explicitly and finish; do not claim the change \"works\" without evidence.",NUDGE_WITH_CMD='You edited %s and the turn is ending, but no command has been run since that edit. Editing a file proves it compiles no more than describing it did. The check for this repo is likely `%s` (%s) — run it and report what it printed. If you disagree with that command, run what actually checks this change. If the change cannot be checked by a command (a comment, a docs string, a config value), say so explicitly and finish; do not claim the change "works" without evidence.',MODES=new Set(["off","dark","enforce"]);function resolveMode(e){const t=String(e&&e.mode||"").trim().toLowerCase();if(MODES.has(t))return t;const n=String(process.env.AEGIS_VERIFY_STOP||"").trim().toLowerCase();return MODES.has(n)?n:"dark"}function beginVerifyGuard(e){const t=resolveMode(e);return{mode:t,cwd:e&&e.cwd||null,active:"off"!==t,dirty:[],ranSince:!1,nudged:!1,fired:0}}function extOf(e){const t=String(e||"").split(/[/\\]/).pop()||"",n=t.lastIndexOf(".");return n<=0?"":t.slice(n).toLowerCase()}function isCodePath(e){return CODE_EXT.has(extOf(e))}function recordMutation(e,t){e&&e.active&&isCodePath(t)&&(e.dirty.push(String(t)),e.ranSince=!1)}function recordExec(e){e&&e.active&&(e.ranSince=!0,e.dirty=[])}function shouldNudge(e){if(!e||!e.active)return{nudge:!1};if(!e.dirty.length)return{nudge:!1};if(e.ranSince)return{nudge:!1};if(e.nudged)return{nudge:!1};const t=e.dirty.slice(-3),n=t.join(", ")+(e.dirty.length>3?` (+${e.dirty.length-3} more)`:"");if(e.fired=1,"enforce"!==e.mode)return{nudge:!1,fired:!0,paths:t};e.nudged=!0;let i=null;if(e.cwd)try{const{detectCheckCommand:t}=require("./check-command.js");i=t(e.cwd,e.dirty[e.dirty.length-1])}catch{i=null}if(i){const e=[n,i.cmd,i.why];let r=0;return{nudge:!0,text:NUDGE_WITH_CMD.replace(/%s/g,()=>String(e[r++])),paths:t,cmd:i.cmd}}return{nudge:!0,text:NUDGE.replace("%s",n),paths:t}}module.exports={beginVerifyGuard:beginVerifyGuard,recordMutation:recordMutation,recordExec:recordExec,shouldNudge:shouldNudge,resolveMode:resolveMode,isCodePath:isCodePath,extOf:extOf,EXEC_TOOLS:EXEC_TOOLS,CODE_EXT:CODE_EXT,NUDGE:NUDGE};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
2
2
|
// Copyright (C) 2026 Niklas Borneklint — AEGIS Code (aegiscode) / Aegiscloud.
|
|
3
|
-
"use strict";const fs=require("node:fs"),path=require("node:path"),os=require("node:os"),crypto=require("node:crypto");function worktreeLockDir(){if(process.env.AEGISCODE_WORKTREE_LOCK_DIR)return process.env.AEGISCODE_WORKTREE_LOCK_DIR;if(process.env.AEGISCODEX_WORKTREE_LOCK_DIR)return process.env.AEGISCODEX_WORKTREE_LOCK_DIR;const r=process.env.AEGISCODE_HOME||process.env.AEGISCODEX_HOME||path.join(os.homedir(),".aegiscode");return path.join(r,"worktree-locks")}const DEFAULT_WORKTREE_WAIT_MS=66e4,NOOP_TOKEN="(no-worktree)";function canonical(r){if(!r)return null;const e=path.resolve(String(r));try{return fs.realpathSync(e)}catch{return e}}function worktreeLockPath(r){if(!r)return null;const e=crypto.createHash("sha1").update(canonical(r)).digest("hex").slice(0,16);return path.join(worktreeLockDir(),e+".lock")}function pidAlive(r){try{return process.kill(r,0),!0}catch{return!1}}function readHolder(r){try{return JSON.parse(fs.readFileSync(worktreeLockPath(r),"utf8"))}catch{return null}}function worktreeLockHolder(r){if(!r)return null;const e=readHolder(r);return e?{pid:e.pid,token:e.token,since:e.since,root:e.root||canonical(r),session:e.session||null}:null}function isWorktreeLocked(r){if(!r)return!1;const e=readHolder(r),o=Number(e&&e.pid);if(!Number.isInteger(o)||o<=0||!pidAlive(o)){try{fs.unlinkSync(worktreeLockPath(r))}catch{}return!1}return!0}function tryAcquire(r,e,o){try{fs.mkdirSync(worktreeLockDir(),{recursive:!0});const t=fs.openSync(worktreeLockPath(r),"wx");return fs.writeFileSync(t,JSON.stringify({pid:process.pid,token:e,since:Date.now(),root:canonical(r),session:o&&o.session||null})),fs.closeSync(t),!0}catch(r){return!r||"EEXIST"!==r.code}}function releaseWorktreeLock(r,e){if(!r||!e||e===NOOP_TOKEN)return;const o=readHolder(r);if(o&&o.token===e)try{fs.unlinkSync(worktreeLockPath(r))}catch{}}async function acquireWorktreeLock(r,{waitMs:e=
|
|
3
|
+
"use strict";const fs=require("node:fs"),path=require("node:path"),os=require("node:os"),crypto=require("node:crypto");function worktreeLockDir(){if(process.env.AEGISCODE_WORKTREE_LOCK_DIR)return process.env.AEGISCODE_WORKTREE_LOCK_DIR;if(process.env.AEGISCODEX_WORKTREE_LOCK_DIR)return process.env.AEGISCODEX_WORKTREE_LOCK_DIR;const r=process.env.AEGISCODE_HOME||process.env.AEGISCODEX_HOME||path.join(os.homedir(),".aegiscode");return path.join(r,"worktree-locks")}const DEFAULT_WORKTREE_WAIT_MS=66e4,NOOP_TOKEN="(no-worktree)";function canonical(r){if(!r)return null;const e=path.resolve(String(r));try{return fs.realpathSync(e)}catch{return e}}function worktreeLockPath(r){if(!r)return null;const e=crypto.createHash("sha1").update(canonical(r)).digest("hex").slice(0,16);return path.join(worktreeLockDir(),e+".lock")}function pidAlive(r){try{return process.kill(r,0),!0}catch{return!1}}function readHolder(r){try{return JSON.parse(fs.readFileSync(worktreeLockPath(r),"utf8"))}catch{return null}}function worktreeLockHolder(r){if(!r)return null;const e=readHolder(r);return e?{pid:e.pid,token:e.token,since:e.since,root:e.root||canonical(r),session:e.session||null}:null}function isWorktreeLocked(r){if(!r)return!1;const e=readHolder(r),o=Number(e&&e.pid);if(!Number.isInteger(o)||o<=0||!pidAlive(o)){try{fs.unlinkSync(worktreeLockPath(r))}catch{}return!1}return!0}function tryAcquire(r,e,o){try{fs.mkdirSync(worktreeLockDir(),{recursive:!0});const t=fs.openSync(worktreeLockPath(r),"wx");return fs.writeFileSync(t,JSON.stringify({pid:process.pid,token:e,since:Date.now(),root:canonical(r),session:o&&o.session||null})),fs.closeSync(t),!0}catch(r){return!r||"EEXIST"!==r.code}}function releaseWorktreeLock(r,e){if(!r||!e||e===NOOP_TOKEN)return;const o=readHolder(r);if(o&&o.token===e)try{fs.unlinkSync(worktreeLockPath(r))}catch{}}async function acquireWorktreeLock(r,{waitMs:e=66e4,pollMs:o=200,signal:t,session:n=null}={}){if(!r)return NOOP_TOKEN;const c=crypto.randomUUID(),i=Date.now()+e;for(;;){if(t&&t.aborted)return null;if(tryAcquire(r,c,{session:n}))return c;if(isWorktreeLocked(r)){if(Date.now()>=i)return null;await new Promise(r=>setTimeout(r,o))}}}class WorktreeBusyError extends Error{constructor(r,e){super(`working tree ${r} is locked by pid ${e?e.pid:"?"}`),this.name="WorktreeBusyError",this.root=r,this.holder=e||null}}async function withWorktreeLock(r,e,o){const t=await acquireWorktreeLock(r,e);if(!t)throw new WorktreeBusyError(r,worktreeLockHolder(r));try{return await o()}finally{releaseWorktreeLock(r,t)}}module.exports={DEFAULT_WORKTREE_WAIT_MS:66e4,worktreeLockDir:worktreeLockDir,worktreeLockPath:worktreeLockPath,worktreeLockHolder:worktreeLockHolder,isWorktreeLocked:isWorktreeLocked,releaseWorktreeLock:releaseWorktreeLock,acquireWorktreeLock:acquireWorktreeLock,WorktreeBusyError:WorktreeBusyError,withWorktreeLock:withWorktreeLock};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
2
2
|
// Copyright (C) 2026 Niklas Borneklint — AEGIS Code (aegiscode) / Aegiscloud.
|
|
3
|
-
"use strict";const RESERVED_PREFIX="__",KEY_VAR_SUFFIX=/_API_KEY$/;function mirrorProviderKeyToEnvFile(e,r,n,t={}){const o="function"==typeof t.onWarn?t.onWarn:()=>{},i=t.envOpts||{};if(!e||"function"!=typeof e.setEnvValue)return null;if("string"!=typeof r||!r)return null;if(r.startsWith(
|
|
3
|
+
"use strict";const RESERVED_PREFIX="__",KEY_VAR_SUFFIX=/_API_KEY$/;function mirrorProviderKeyToEnvFile(e,r,n,t={}){const o="function"==typeof t.onWarn?t.onWarn:()=>{},i=t.envOpts||{};if(!e||"function"!=typeof e.setEnvValue)return null;if("string"!=typeof r||!r)return null;if(r.startsWith("__"))return null;const s="function"==typeof e.envVarFor?e.envVarFor(r):"";if(!s||!KEY_VAR_SUFFIX.test(s))return null;try{if(n)return e.setEnvValue(s,n,i);const t="function"==typeof e.keyStatus?e.keyStatus(s,i):null;return t&&t.inFile?"function"==typeof e.clearEnvValue?e.clearEnvValue(s,i):(i.env?delete i.env[s]:delete process.env[s],o(`removed ${r}'s key in the app, but ${s} is still in the shared env file — this build has no clearEnvValue; delete the line by hand`),null):null}catch(e){return o(`could not mirror ${r}'s key into the shared env file: ${e&&e.message}`),null}}function backfillProviderKeys(e,r,n={}){const t="function"==typeof n.onWarn?n.onWarn:()=>{},o=n.envOpts||{},i={mirrored:[],skipped:[],failed:[]};if(!e||"function"!=typeof e.list)return i;if(!r||"function"!=typeof r.envVarFor)return i;let s=[];try{s=e.list()||[]}catch(e){return t(`could not read the provider store to backfill the shared env file: ${e&&e.message}`),i}for(const u of s){const s=u&&u.provider;if("string"!=typeof s||!s)continue;if(s.startsWith("__"))continue;const l=r.envVarFor(s);if(!l||!KEY_VAR_SUFFIX.test(l)){i.skipped.push(s);continue}if("function"==typeof r.isForeignSecret&&r.isForeignSecret(l)){i.skipped.push(s);continue}let f=null;try{f="function"==typeof r.keyStatus?r.keyStatus(l,o):null}catch{}if(f&&f.inFile){i.skipped.push(s);continue}if(!1===u.configured){i.skipped.push(s);continue}let c="";try{c="function"==typeof e.rawKey?e.rawKey(s):""}catch(e){t(`could not decrypt ${s}'s stored key for the shared env file: ${e&&e.message}`),i.failed.push(s);continue}if(!c){i.skipped.push(s);continue}const a=mirrorProviderKeyToEnvFile(r,s,c,n);a&&a.ok?i.mirrored.push(s):i.failed.push(s)}return i}function wrapProviderKeyMirror(e,r,n={}){if(!e||"function"!=typeof e.set)return e;const t=(e,t)=>mirrorProviderKeyToEnvFile(r,e,t,n),o=e.set.bind(e),i="function"==typeof e.remove?e.remove.bind(e):null;return e.set=(e,r)=>{const n=o(e,r);return r&&"string"==typeof r.key&&r.key&&t(e,r.key),n},i&&(e.remove=e=>{const r=i(e);return t(e,""),r}),e}module.exports={mirrorProviderKeyToEnvFile:mirrorProviderKeyToEnvFile,wrapProviderKeyMirror:wrapProviderKeyMirror,backfillProviderKeys:backfillProviderKeys};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
2
2
|
// Copyright (C) 2026 Niklas Borneklint — AEGIS Code (aegiscode) / Aegiscloud.
|
|
3
|
-
"use strict";function shouldEnableGlobalShortcut({isPackaged:t,enabled:a}={}){return Boolean(t)||Boolean(a)}function computeQuickLauncherBounds({cursor:t,displays:a,size:h,fallback:e}={}){const u=Math.max(1,h&&h.width||560),n=Math.max(1,h&&h.height||320),o=Array.isArray(a)?a:[],r=t&&Number.isFinite(t.x)&&Number.isFinite(t.y)?t:null,i=r?o.find(
|
|
3
|
+
"use strict";function shouldEnableGlobalShortcut({isPackaged:t,enabled:a}={}){return Boolean(t)||Boolean(a)}function computeQuickLauncherBounds({cursor:t,displays:a,size:h,fallback:e}={}){const u=Math.max(1,h&&h.width||560),n=Math.max(1,h&&h.height||320),o=Array.isArray(a)?a:[],r=t&&Number.isFinite(t.x)&&Number.isFinite(t.y)?t:null,i=r?o.find(t=>{const a=t&&t.workArea;return a&&r.x>=a.x&&r.x<a.x+a.width&&r.y>=a.y&&r.y<a.y+a.height}):null,l=i||o[0]||null;if(!l||!l.workArea)return{x:e&&e.x||0,y:e&&e.y||0,width:u,height:n};const c=l.workArea;let d,s;return r?(d=Math.round(r.x-u/2),s=Math.round(r.y-n/2)):(d=Math.round(c.x+(c.width-u)/2),s=Math.round(c.y+(c.height-n)/2)),d=Math.min(Math.max(d,c.x),Math.max(c.x,c.x+c.width-u)),s=Math.min(Math.max(s,c.y),Math.max(c.y,c.y+c.height-n)),{x:d,y:s,width:u,height:n}}module.exports={shouldEnableGlobalShortcut:shouldEnableGlobalShortcut,computeQuickLauncherBounds:computeQuickLauncherBounds};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
2
2
|
// Copyright (C) 2026 Niklas Borneklint — AEGIS Code (aegiscode) / Aegiscloud.
|
|
3
|
-
"use strict";const fs=require("node:fs"),path=require("node:path"),{execFileSync:execFileSync}=require("node:child_process"),prefs=(()=>{try{return require("../../client/prefs.js")}catch{return require("../vendor/prefs.js")}})(),credentials=(()=>{try{return require("../../client/credentials.js")}catch{return require("../vendor/credentials.js")}})(),localTransport=require("./local/local.js"),LOCAL_NAMESPACE="local",SETTINGS_FILE="settings.json",AEGIS_KEY_NAMESPACE="__aegis",LEGACY_AEGIS_NAMESPACE="aegis",QUICK_LAUNCHER_NAMESPACE="__quickLauncher",DEFAULT_QUICK_LAUNCHER_SHORTCUT="CmdOrCtrl+Shift+Space",VAULT_BACKEND_NAMESPACE="__vaultBackend",DEFAULT_VAULT_BACKEND="aegiscloud",VAULT_BACKEND_VALUES=Object.freeze(["aegiscloud","drive","off"]),CONFIRM_MODE_NAMESPACE="__confirmMode",FONT_SCALE_NAMESPACE="__fontScale",ACCENT_NAMESPACE="__accent",MEMORY_PERSIST_NAMESPACE="__memoryPersist",AVATAR_NAMESPACE="__avatar",TELEMETRY_NAMESPACE="__telemetry",AUTO_DRAIN_NAMESPACE="__autoDrain",AUTO_MINT_NAMESPACE="__autoMint",AUTO_DRAIN_INTERVAL_DEFAULT_MS=6e4,AUTO_DRAIN_INTERVAL_MIN_MS=15e3,AUTO_DRAIN_INTERVAL_MAX_MS=18e5,RESERVED_NAMESPACES=Object.freeze(["__aegis","aegis","__quickLauncher","__vaultBackend","__confirmMode","__memoryPersist","__avatar","__telemetry","__autoDrain","__autoMint"]),AVATAR_MOTION_MODES=Object.freeze(["system","full","minimal"]);function isReservedNamespace(e){return RESERVED_NAMESPACES.includes(e)}function maskKey(e){return e?e.length<=10?"configured":`${e.slice(0,9)}…${e.slice(-4)}`:null}const IS_WIN32="win32"===process.platform;function restrictFile(e){if(IS_WIN32){const n=process.env.USERNAME||process.env.USER||process.env.USERDOMAIN;if(!n)return void console.error(`[settings] cannot restrict ${e}: no current user to grant (USERNAME unset)`);try{execFileSync("icacls",[e,"/inheritance:r","/grant:r",`${n}:(F)`],{stdio:"ignore"})}catch(n){console.error(`[settings] failed to restrict ACL on ${e}: ${n.message}`)}}else try{fs.chmodSync(e,384)}catch(n){console.error(`[settings] failed to chmod ${e} to 0600: ${n.message}`)}}function createSettingsStore({dir:e,safeStorage:n,prefsDir:t,env:r}={}){if(!e)throw new Error("createSettingsStore requires a storage dir");const o=path.join(e,SETTINGS_FILE),i=(()=>{const e=null==t?"":String(t).trim();return e?path.resolve(e):credentials.aegisHome(r)})(),s=(()=>{try{return prefs.adopt({dir:i,legacyDir:e})}catch(e){return(process.env.AEGISCODE_DEBUG||process.env.AEGIS_HIST_DEBUG)&&process.stderr.write(`aegis-desktop: shared-preference adoption failed: ${e.message}\n`),{adopted:!1,keys:[],reason:`adoption failed: ${e.message}`}}})();function a(){try{return prefs.load({dir:i})}catch{return{}}}function c(e){if(!prefs.SHARED_PREF_KEYS.includes(e))throw new Error(`"${e}" is not a shared preference (see client/prefs.js SHARED_PREF_KEYS)`);const n=a()[e];return void 0===n?null:n}const u=()=>Boolean(n&&"function"==typeof n.isEncryptionAvailable&&n.isEncryptionAvailable());function l(e){return null==e?null:u()?n.encryptString(String(e)).toString("base64"):Buffer.from(String(e),"utf8").toString("base64")}function _(e){if(!e)return null;try{const t=Buffer.from(String(e),"base64");return u()?n.decryptString(t):t.toString("utf8")}catch{return null}}function d(){try{return JSON.parse(fs.readFileSync(o,"utf8"))||{}}catch{return{}}}function f(e){fs.mkdirSync(path.dirname(o),{recursive:!0});const n=`${o}.tmp-${process.pid}`;fs.writeFileSync(n,JSON.stringify(e,null,2),{mode:384}),fs.renameSync(n,o),restrictFile(o)}function A(e){if(isReservedNamespace(e))throw new Error(`reserved namespace "${e}" is not a provider config — use setAegisKey()/aegisRawKey() for the AEGIS key`)}function E(e){const n=d()[e]||{},t=_(n.key);return{provider:e,baseURL:n.baseURL||"",configured:Boolean(t),keyMask:maskKey(t)}}function S(){const e=_((d().__aegis||{}).key);return{configured:Boolean(e),keyMask:maskKey(e)}}function m(e){return Number.isFinite(e)?Math.min(1.3,Math.max(.85,Math.round(100*e)/100)):1}function M(){return m((d().__fontScale||{}).scale)}const p=["default","cobalt","amber"];function g(e){const n="string"==typeof e?e.trim().toLowerCase():"";return p.includes(n)?n:"default"}function y(){return g((d().__accent||{}).name)}function N(){const e=d().__quickLauncher||{},n="string"==typeof e.shortcut&&e.shortcut.trim()?e.shortcut.trim():"CmdOrCtrl+Shift+Space";return{enabled:Boolean(e.enabled),shortcut:n}}function b(){const e=d().__vaultBackend||{};return{backend:VAULT_BACKEND_VALUES.includes(e.backend)?e.backend:"aegiscloud"}}function v(){const e=a();if("boolean"==typeof e.confirmMode)return{enabled:e.confirmMode,source:"config"};const n=d().__confirmMode||{};return void 0===n.enabled?{enabled:!0,source:"default"}:{enabled:Boolean(n.enabled),source:"config"}}function C(){const e=a().sandboxPolicy;return e&&"object"==typeof e?e:null}function T(){return!0===a().devMode}function h(){const e=a().accountUsername;return"string"==typeof e?e:null}function R(){const e=a();return"string"==typeof e.permissionMode?e.permissionMode:null}function I(){return!0===(d().__telemetry||{}).enabled}function L(){const e=a();if("boolean"==typeof e.memoryPersist)return{enabled:e.memoryPersist,source:"config"};const n=d().__memoryPersist||{};return void 0===n.enabled?{enabled:!0,source:"default"}:{enabled:Boolean(n.enabled),source:"config"}}function D(){const e=d().__avatar||{};return{enabled:void 0===e.enabled||Boolean(e.enabled),showLevel:void 0===e.showLevel||Boolean(e.showLevel),motion:AVATAR_MOTION_MODES.includes(e.motion)?e.motion:"system"}}function P(){const e=d().__avatar||{};return{...D(),source:void 0===e.enabled?"default":"config"}}function O(e){const n=Number(e);if(!Number.isFinite(n))return 6e4;const t=Math.round(n);return t<15e3||t>18e5?6e4:t}function U(){const e=d().__autoDrain||{};return{enabled:!1!==e.enabled,intervalMs:O(e.intervalMs)}}function k(){const e=d().__autoDrain||{};return{...U(),source:void 0===e.enabled?"default":"config"}}function B(){const e=d().__autoMint||{};return{enabled:!1!==e.enabled,publish:!0===e.publish}}function K(){const e=d().__autoMint||{};return{...B(),source:void 0===e.enabled?"default":"config"}}return{file:o,sharedDir:i,adoption:s,sharedFile:function(){return prefs.prefsFile({dir:i})},getSharedPref:c,setSharedPref:function(e,n){if(!prefs.SHARED_PREF_KEYS.includes(e))throw new Error(`"${e}" is not a shared preference (see client/prefs.js SHARED_PREF_KEYS)`);return prefs.set({[e]:n},{dir:i}),c(e)},getDevMode:T,setDevMode:function(e){return prefs.set({devMode:Boolean(e)},{dir:i}),T()},getAccountUsername:h,setAccountUsername:function(e){return prefs.set({accountUsername:"string"==typeof e?e:null},{dir:i}),h()},get:E,set:function(e,{baseURL:n,key:t}={}){A(e);let r=n;if("local"===e&&n){const e=localTransport.remoteRefusal(n);if(e)throw e;r=localTransport.normalizeBase(n)}const o=d(),i=o[e]||{};return void 0!==r&&(i.baseURL=r),void 0!==t&&(i.key=t?l(t):null),o[e]=i,f(o),E(e)},rawKey:function(e){return _((d()[e]||{}).key)},remove:function(e){A(e);const n=d();return delete n[e],f(n),{ok:!0}},list:function(){const e=d();return Object.keys(e).filter((e=>!isReservedNamespace(e))).map((e=>E(e)))},maskKey:maskKey,aegisKey:S,aegisRawKey:function(){return _((d().__aegis||{}).key)},aegisKeySavedAt:function(){return(d().__aegis||{}).savedAt||null},setAegisKey:function(e){const n=d();return n.__aegis={...n.__aegis||{},key:e?l(e):null,savedAt:e?(new Date).toISOString():null},f(n),S()},migrateLegacyAegisKey:function(){try{const e=d();if(!e.aegis)return{migrated:!1};const n=e.aegis||{},t=e.__aegis||{},r={...e};return n.key&&!t.key&&(r.__aegis={...t,key:n.key}),delete r.aegis,f(r),{migrated:!0}}catch{return{migrated:!1}}},quickLauncherConfig:N,setQuickLauncherConfig:function({enabled:e,shortcut:n}={}){const t=d();return t.__quickLauncher={enabled:Boolean(e),shortcut:"string"==typeof n&&n.trim()?n.trim():"CmdOrCtrl+Shift+Space"},f(t),N()},vaultBackendConfig:b,setVaultBackendConfig:function(e){if(!VAULT_BACKEND_VALUES.includes(e))return b();const n=d();return n.__vaultBackend={backend:e},f(n),b()},getConfirmMode:function(){return v().enabled},setConfirmMode:function(e){prefs.set({confirmMode:Boolean(e)},{dir:i});const n=d();return void 0!==n.__confirmMode&&(delete n.__confirmMode,f(n)),v().enabled},confirmModeState:v,getFontScale:M,setFontScale:function(e){const n=d();return n.__fontScale={scale:m(e)},f(n),M()},clampFontScale:m,getAccent:y,setAccent:function(e){const n=d();return n.__accent={name:g(e)},f(n),y()},clampAccent:g,ACCENT_SKINS:p,getPermissionMode:R,setPermissionMode:function(e){if(null==e||""===e||"off"===e||"none"===e)return prefs.remove("permissionMode",{dir:i}),null;const n=String(e),t=function(){const e=[path.join(__dirname,"..","..","one","src","permissions.js"),path.join(__dirname,"..","vendor","one","src","permissions.js")];for(const n of e)try{const e=require(n);if(e&&Array.isArray(e.PERMISSION_MODES)&&e.PERMISSION_MODES.length)return[...e.PERMISSION_MODES]}catch{}return["acceptEdits","auto","bypassPermissions","manual","dontAsk","plan"]}();if(!t.includes(n))throw new Error(`"${n}" is not one of ${t.join("|")} (or 'off' to clear it)`);return prefs.set({permissionMode:n},{dir:i}),R()},getSandboxPolicy:C,setSandboxPolicy:function(e){return e&&"object"==typeof e?(prefs.set({sandboxPolicy:e},{dir:i}),C()):(prefs.set({sandboxPolicy:null},{dir:i}),null)},getTelemetryOptIn:I,setTelemetryOptIn:function(e){const n=d();return n.__telemetry={enabled:Boolean(e)},f(n),I()},getMemoryPersist:function(){return L().enabled},memoryPersistState:L,setMemoryPersist:function(e){prefs.set({memoryPersist:Boolean(e)},{dir:i});const n=d();return void 0!==n.__memoryPersist&&(delete n.__memoryPersist,f(n)),L()},getAvatar:D,avatarState:P,setAvatar:function(e={}){const n=D(),t=e&&"object"==typeof e?e:{},r={enabled:void 0===t.enabled?n.enabled:Boolean(t.enabled),showLevel:void 0===t.showLevel?n.showLevel:Boolean(t.showLevel),motion:AVATAR_MOTION_MODES.includes(t.motion)?t.motion:n.motion},o=d();return o.__avatar=r,f(o),P()},getAutoDrain:U,autoDrainState:k,setAutoDrain:function(e={}){const n=U(),t=e&&"object"==typeof e?e:{},r=d();return r.__autoDrain={enabled:void 0===t.enabled?n.enabled:Boolean(t.enabled),intervalMs:void 0===t.intervalMs?n.intervalMs:O(t.intervalMs)},f(r),k()},getAutoMint:B,autoMintState:K,setAutoMint:function(e={}){const n=B(),t=e&&"object"==typeof e?e:{},r=d();return r.__autoMint={enabled:void 0===t.enabled?n.enabled:Boolean(t.enabled),publish:void 0===t.publish?n.publish:Boolean(t.publish)},f(r),K()},clampAutoDrainInterval:O}}module.exports={SETTINGS_FILE:SETTINGS_FILE,AEGIS_KEY_NAMESPACE:"__aegis",LEGACY_AEGIS_NAMESPACE:"aegis",QUICK_LAUNCHER_NAMESPACE:"__quickLauncher",VAULT_BACKEND_NAMESPACE:"__vaultBackend",CONFIRM_MODE_NAMESPACE:"__confirmMode",MEMORY_PERSIST_NAMESPACE:"__memoryPersist",AVATAR_NAMESPACE:"__avatar",TELEMETRY_NAMESPACE:"__telemetry",AUTO_DRAIN_NAMESPACE:"__autoDrain",AUTO_MINT_NAMESPACE:"__autoMint",AUTO_DRAIN_INTERVAL_DEFAULT_MS:6e4,AUTO_DRAIN_INTERVAL_MIN_MS:15e3,AUTO_DRAIN_INTERVAL_MAX_MS:18e5,AVATAR_MOTION_MODES:AVATAR_MOTION_MODES,DEFAULT_QUICK_LAUNCHER_SHORTCUT:"CmdOrCtrl+Shift+Space",DEFAULT_VAULT_BACKEND:"aegiscloud",VAULT_BACKEND_VALUES:VAULT_BACKEND_VALUES,RESERVED_NAMESPACES:RESERVED_NAMESPACES,isReservedNamespace:isReservedNamespace,maskKey:maskKey,createSettingsStore:createSettingsStore};
|
|
3
|
+
"use strict";const fs=require("node:fs"),path=require("node:path"),{execFileSync:execFileSync}=require("node:child_process"),prefs=(()=>{try{return require("../../client/prefs.js")}catch{return require("../vendor/prefs.js")}})(),credentials=(()=>{try{return require("../../client/credentials.js")}catch{return require("../vendor/credentials.js")}})(),localTransport=require("./local/local.js"),LOCAL_NAMESPACE="local",SETTINGS_FILE="settings.json",AEGIS_KEY_NAMESPACE="__aegis",LEGACY_AEGIS_NAMESPACE="aegis",QUICK_LAUNCHER_NAMESPACE="__quickLauncher",DEFAULT_QUICK_LAUNCHER_SHORTCUT="CmdOrCtrl+Shift+Space",VAULT_BACKEND_NAMESPACE="__vaultBackend",DEFAULT_VAULT_BACKEND="aegiscloud",VAULT_BACKEND_VALUES=Object.freeze(["aegiscloud","drive","off"]),CONFIRM_MODE_NAMESPACE="__confirmMode",FONT_SCALE_NAMESPACE="__fontScale",ACCENT_NAMESPACE="__accent",MEMORY_PERSIST_NAMESPACE="__memoryPersist",AVATAR_NAMESPACE="__avatar",TELEMETRY_NAMESPACE="__telemetry",AUTO_DRAIN_NAMESPACE="__autoDrain",AUTO_MINT_NAMESPACE="__autoMint",AUTO_DRAIN_INTERVAL_DEFAULT_MS=6e4,AUTO_DRAIN_INTERVAL_MIN_MS=15e3,AUTO_DRAIN_INTERVAL_MAX_MS=18e5,RESERVED_NAMESPACES=Object.freeze(["__aegis","aegis","__quickLauncher","__vaultBackend","__confirmMode","__memoryPersist","__avatar","__telemetry","__autoDrain","__autoMint"]),AVATAR_MOTION_MODES=Object.freeze(["system","full","minimal"]);function isReservedNamespace(e){return RESERVED_NAMESPACES.includes(e)}function maskKey(e){return e?e.length<=10?"configured":`${e.slice(0,9)}…${e.slice(-4)}`:null}const IS_WIN32="win32"===process.platform;function restrictFile(e){if(IS_WIN32){const n=process.env.USERNAME||process.env.USER||process.env.USERDOMAIN;if(!n)return void console.error(`[settings] cannot restrict ${e}: no current user to grant (USERNAME unset)`);try{execFileSync("icacls",[e,"/inheritance:r","/grant:r",`${n}:(F)`],{stdio:"ignore"})}catch(n){console.error(`[settings] failed to restrict ACL on ${e}: ${n.message}`)}return}try{fs.chmodSync(e,384)}catch(n){console.error(`[settings] failed to chmod ${e} to 0600: ${n.message}`)}}function createSettingsStore({dir:e,safeStorage:n,prefsDir:t,env:r}={}){if(!e)throw new Error("createSettingsStore requires a storage dir");const o=path.join(e,SETTINGS_FILE),i=(()=>{const e=null==t?"":String(t).trim();return e?path.resolve(e):credentials.aegisHome(r)})(),s=(()=>{try{return prefs.adopt({dir:i,legacyDir:e})}catch(e){return(process.env.AEGISCODE_DEBUG||process.env.AEGIS_HIST_DEBUG)&&process.stderr.write(`aegis-desktop: shared-preference adoption failed: ${e.message}\n`),{adopted:!1,keys:[],reason:`adoption failed: ${e.message}`}}})();function a(){try{return prefs.load({dir:i})}catch{return{}}}function c(e){if(!prefs.SHARED_PREF_KEYS.includes(e))throw new Error(`"${e}" is not a shared preference (see client/prefs.js SHARED_PREF_KEYS)`);const n=a()[e];return void 0===n?null:n}const u=()=>Boolean(n&&"function"==typeof n.isEncryptionAvailable&&n.isEncryptionAvailable());function _(e){return null==e?null:u()?n.encryptString(String(e)).toString("base64"):Buffer.from(String(e),"utf8").toString("base64")}function l(e){if(!e)return null;try{const t=Buffer.from(String(e),"base64");return u()?n.decryptString(t):t.toString("utf8")}catch{return null}}function d(){try{return JSON.parse(fs.readFileSync(o,"utf8"))||{}}catch{return{}}}function f(e){fs.mkdirSync(path.dirname(o),{recursive:!0});const n=`${o}.tmp-${process.pid}`;fs.writeFileSync(n,JSON.stringify(e,null,2),{mode:384}),fs.renameSync(n,o),restrictFile(o)}function A(e){if(isReservedNamespace(e))throw new Error(`reserved namespace "${e}" is not a provider config — use setAegisKey()/aegisRawKey() for the AEGIS key`)}function E(e){const n=d()[e]||{},t=l(n.key);return{provider:e,baseURL:n.baseURL||"",configured:Boolean(t),keyMask:maskKey(t)}}function S(){const e=l((d().__aegis||{}).key);return{configured:Boolean(e),keyMask:maskKey(e)}}function m(e){return Number.isFinite(e)?Math.min(1.3,Math.max(.85,Math.round(100*e)/100)):1}function M(){return m((d().__fontScale||{}).scale)}const p=["default","cobalt","amber"];function g(e){const n="string"==typeof e?e.trim().toLowerCase():"";return p.includes(n)?n:"default"}function y(){return g((d().__accent||{}).name)}function N(){const e=d().__quickLauncher||{},n="string"==typeof e.shortcut&&e.shortcut.trim()?e.shortcut.trim():"CmdOrCtrl+Shift+Space";return{enabled:Boolean(e.enabled),shortcut:n}}function b(){const e=d().__vaultBackend||{};return{backend:VAULT_BACKEND_VALUES.includes(e.backend)?e.backend:"aegiscloud"}}function v(){const e=a();if("boolean"==typeof e.confirmMode)return{enabled:e.confirmMode,source:"config"};const n=d().__confirmMode||{};return void 0===n.enabled?{enabled:!0,source:"default"}:{enabled:Boolean(n.enabled),source:"config"}}function C(){const e=a().sandboxPolicy;return e&&"object"==typeof e?e:null}function T(){return!0===a().devMode}function h(){const e=a().accountUsername;return"string"==typeof e?e:null}function R(){const e=a();return"string"==typeof e.permissionMode?e.permissionMode:null}function I(){return!0===(d().__telemetry||{}).enabled}function L(){const e=a();if("boolean"==typeof e.memoryPersist)return{enabled:e.memoryPersist,source:"config"};const n=d().__memoryPersist||{};return void 0===n.enabled?{enabled:!0,source:"default"}:{enabled:Boolean(n.enabled),source:"config"}}function D(){const e=d().__avatar||{};return{enabled:void 0===e.enabled||Boolean(e.enabled),showLevel:void 0===e.showLevel||Boolean(e.showLevel),motion:AVATAR_MOTION_MODES.includes(e.motion)?e.motion:"system"}}function P(){const e=d().__avatar||{};return{...D(),source:void 0===e.enabled?"default":"config"}}function O(e){const n=Number(e);if(!Number.isFinite(n))return 6e4;const t=Math.round(n);return t<15e3||t>18e5?6e4:t}function U(){const e=d().__autoDrain||{};return{enabled:!1!==e.enabled,intervalMs:O(e.intervalMs)}}function k(){const e=d().__autoDrain||{};return{...U(),source:void 0===e.enabled?"default":"config"}}function B(){const e=d().__autoMint||{};return{enabled:!1!==e.enabled,publish:!0===e.publish}}function K(){const e=d().__autoMint||{};return{...B(),source:void 0===e.enabled?"default":"config"}}return{file:o,sharedDir:i,adoption:s,sharedFile:function(){return prefs.prefsFile({dir:i})},getSharedPref:c,setSharedPref:function(e,n){if(!prefs.SHARED_PREF_KEYS.includes(e))throw new Error(`"${e}" is not a shared preference (see client/prefs.js SHARED_PREF_KEYS)`);return prefs.set({[e]:n},{dir:i}),c(e)},getDevMode:T,setDevMode:function(e){return prefs.set({devMode:Boolean(e)},{dir:i}),T()},getAccountUsername:h,setAccountUsername:function(e){return prefs.set({accountUsername:"string"==typeof e?e:null},{dir:i}),h()},get:E,set:function(e,{baseURL:n,key:t}={}){A(e);let r=n;if("local"===e&&n){const e=localTransport.remoteRefusal(n);if(e)throw e;r=localTransport.normalizeBase(n)}const o=d(),i=o[e]||{};return void 0!==r&&(i.baseURL=r),void 0!==t&&(i.key=t?_(t):null),o[e]=i,f(o),E(e)},rawKey:function(e){return l((d()[e]||{}).key)},remove:function(e){A(e);const n=d();return delete n[e],f(n),{ok:!0}},list:function(){const e=d();return Object.keys(e).filter(e=>!isReservedNamespace(e)).map(e=>E(e))},maskKey:maskKey,aegisKey:S,aegisRawKey:function(){return l((d().__aegis||{}).key)},aegisKeySavedAt:function(){return(d().__aegis||{}).savedAt||null},setAegisKey:function(e){const n=d();return n.__aegis={...n.__aegis||{},key:e?_(e):null,savedAt:e?(new Date).toISOString():null},f(n),S()},migrateLegacyAegisKey:function(){try{const e=d();if(!e.aegis)return{migrated:!1};const n=e.aegis||{},t=e.__aegis||{},r={...e};return n.key&&!t.key&&(r.__aegis={...t,key:n.key}),delete r.aegis,f(r),{migrated:!0}}catch{return{migrated:!1}}},quickLauncherConfig:N,setQuickLauncherConfig:function({enabled:e,shortcut:n}={}){const t=d();return t.__quickLauncher={enabled:Boolean(e),shortcut:"string"==typeof n&&n.trim()?n.trim():"CmdOrCtrl+Shift+Space"},f(t),N()},vaultBackendConfig:b,setVaultBackendConfig:function(e){if(!VAULT_BACKEND_VALUES.includes(e))return b();const n=d();return n.__vaultBackend={backend:e},f(n),b()},getConfirmMode:function(){return v().enabled},setConfirmMode:function(e){prefs.set({confirmMode:Boolean(e)},{dir:i});const n=d();return void 0!==n.__confirmMode&&(delete n.__confirmMode,f(n)),v().enabled},confirmModeState:v,getFontScale:M,setFontScale:function(e){const n=d();return n.__fontScale={scale:m(e)},f(n),M()},clampFontScale:m,getAccent:y,setAccent:function(e){const n=d();return n.__accent={name:g(e)},f(n),y()},clampAccent:g,ACCENT_SKINS:p,getPermissionMode:R,setPermissionMode:function(e){if(null==e||""===e||"off"===e||"none"===e)return prefs.remove("permissionMode",{dir:i}),null;const n=String(e),t=function(){const e=[path.join(__dirname,"..","..","one","src","permissions.js"),path.join(__dirname,"..","vendor","one","src","permissions.js")];for(const n of e)try{const e=require(n);if(e&&Array.isArray(e.PERMISSION_MODES)&&e.PERMISSION_MODES.length)return[...e.PERMISSION_MODES]}catch{}return["acceptEdits","auto","bypassPermissions","manual","dontAsk","plan"]}();if(!t.includes(n))throw new Error(`"${n}" is not one of ${t.join("|")} (or 'off' to clear it)`);return prefs.set({permissionMode:n},{dir:i}),R()},getSandboxPolicy:C,setSandboxPolicy:function(e){return e&&"object"==typeof e?(prefs.set({sandboxPolicy:e},{dir:i}),C()):(prefs.set({sandboxPolicy:null},{dir:i}),null)},getTelemetryOptIn:I,setTelemetryOptIn:function(e){const n=d();return n.__telemetry={enabled:Boolean(e)},f(n),I()},getMemoryPersist:function(){return L().enabled},memoryPersistState:L,setMemoryPersist:function(e){prefs.set({memoryPersist:Boolean(e)},{dir:i});const n=d();return void 0!==n.__memoryPersist&&(delete n.__memoryPersist,f(n)),L()},getAvatar:D,avatarState:P,setAvatar:function(e={}){const n=D(),t=e&&"object"==typeof e?e:{},r={enabled:void 0===t.enabled?n.enabled:Boolean(t.enabled),showLevel:void 0===t.showLevel?n.showLevel:Boolean(t.showLevel),motion:AVATAR_MOTION_MODES.includes(t.motion)?t.motion:n.motion},o=d();return o.__avatar=r,f(o),P()},getAutoDrain:U,autoDrainState:k,setAutoDrain:function(e={}){const n=U(),t=e&&"object"==typeof e?e:{},r=d();return r.__autoDrain={enabled:void 0===t.enabled?n.enabled:Boolean(t.enabled),intervalMs:void 0===t.intervalMs?n.intervalMs:O(t.intervalMs)},f(r),k()},getAutoMint:B,autoMintState:K,setAutoMint:function(e={}){const n=B(),t=e&&"object"==typeof e?e:{},r=d();return r.__autoMint={enabled:void 0===t.enabled?n.enabled:Boolean(t.enabled),publish:void 0===t.publish?n.publish:Boolean(t.publish)},f(r),K()},clampAutoDrainInterval:O}}module.exports={SETTINGS_FILE:SETTINGS_FILE,AEGIS_KEY_NAMESPACE:"__aegis",LEGACY_AEGIS_NAMESPACE:"aegis",QUICK_LAUNCHER_NAMESPACE:"__quickLauncher",VAULT_BACKEND_NAMESPACE:"__vaultBackend",CONFIRM_MODE_NAMESPACE:"__confirmMode",MEMORY_PERSIST_NAMESPACE:"__memoryPersist",AVATAR_NAMESPACE:"__avatar",TELEMETRY_NAMESPACE:"__telemetry",AUTO_DRAIN_NAMESPACE:"__autoDrain",AUTO_MINT_NAMESPACE:"__autoMint",AUTO_DRAIN_INTERVAL_DEFAULT_MS:6e4,AUTO_DRAIN_INTERVAL_MIN_MS:15e3,AUTO_DRAIN_INTERVAL_MAX_MS:18e5,AVATAR_MOTION_MODES:AVATAR_MOTION_MODES,DEFAULT_QUICK_LAUNCHER_SHORTCUT:"CmdOrCtrl+Shift+Space",DEFAULT_VAULT_BACKEND:"aegiscloud",VAULT_BACKEND_VALUES:VAULT_BACKEND_VALUES,RESERVED_NAMESPACES:RESERVED_NAMESPACES,isReservedNamespace:isReservedNamespace,maskKey:maskKey,createSettingsStore:createSettingsStore};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
2
2
|
// Copyright (C) 2026 Niklas Borneklint — AEGIS Code (aegiscode) / Aegiscloud.
|
|
3
|
-
"use strict";const os=require("node:os");let skillsLib;try{skillsLib=require("../../client/skills.js")}catch{skillsLib=require("../vendor/skills.js")}function baseIo(r={}){return{fs:r.fs,home:r.home||os.homedir(),cwd:r.cwd||process.env.AEGIS_WORKSPACE||os.homedir(),platform:r.platform||process.platform}}function list(r={}){try{const e=baseIo(r),{entries:t,roots:s,missing:o}=skillsLib.scan(e);return{ok:!0,skills:t.map(
|
|
3
|
+
"use strict";const os=require("node:os");let skillsLib;try{skillsLib=require("../../client/skills.js")}catch{skillsLib=require("../vendor/skills.js")}function baseIo(r={}){return{fs:r.fs,home:r.home||os.homedir(),cwd:r.cwd||process.env.AEGIS_WORKSPACE||os.homedir(),platform:r.platform||process.platform}}function list(r={}){try{const e=baseIo(r),{entries:t,roots:s,missing:o}=skillsLib.scan(e);return{ok:!0,skills:t.map(r=>({name:r.name,description:r.description,scope:r.scope,path:r.path,hasFrontmatter:r.hasFrontmatter,warning:r.warning,lines:r.lines,bodyPreview:r.bodyPreview})),roots:s,missing:o,createDir:skillsLib.defaultCreateDir(e),nameRule:skillsLib.NAME_RE.source}}catch(r){return{ok:!1,error:r&&r.message||"could not scan for skills",skills:[]}}}function read(r={},e={}){try{const t=baseIo(e),s=skillsLib.find(String(r.name||""),t);if(!s)return{ok:!1,error:`no skill named "${r.name||""}" was found`};const o=(e.fs||require("node:fs")).readFileSync(s.path,"utf8");return{ok:!0,skill:{name:s.name,description:s.description,scope:s.scope,path:s.path,hasFrontmatter:s.hasFrontmatter,warning:s.warning,content:o}}}catch(r){return{ok:!1,error:r&&r.message||"could not read that skill"}}}function create(r={},e={}){try{const t=baseIo(e),s={name:String(r.name||""),description:String(r.description||""),body:String(r.body||""),targetDir:r.targetDir?String(r.targetDir):""},o=skillsLib.create(s,t);return o.ok?{ok:!0,name:o.name,dir:o.dir,path:o.path}:{ok:!1,error:o.reason,exists:Boolean(o.exists)}}catch(r){return{ok:!1,error:r&&r.message||"could not create that skill"}}}function remove(r={},e={}){try{const t=skillsLib.remove(String(r.name||""),baseIo(e));return t.ok?{ok:!0,name:t.name,dir:t.dir}:{ok:!1,error:t.reason}}catch(r){return{ok:!1,error:r&&r.message||"could not remove that skill"}}}async function importFromUrl(r={},e={}){try{const t=baseIo(e),s=await skillsLib.importFromUrl({url:String(r.url||""),name:r.name?String(r.name):"",targetDir:r.targetDir?String(r.targetDir):""},t);return s.ok?{ok:!0,name:s.name,dir:s.dir,path:s.path,source:s.source}:{ok:!1,error:s.reason,exists:Boolean(s.exists)}}catch(r){return{ok:!1,error:r&&r.message||"could not import that skill"}}}module.exports={list:list,read:read,create:create,remove:remove,importFromUrl:importFromUrl,skillsLib:skillsLib};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
2
2
|
// Copyright (C) 2026 Niklas Borneklint — AEGIS Code (aegiscode) / Aegiscloud.
|
|
3
|
-
"use strict";const fs=require("node:fs"),os=require("node:os"),path=require("node:path"),{execFile:execFile,execFileSync:execFileSync}=require("node:child_process"),speech=require("./speech-resolve.js");function whichProbe(e){try{const n="win32"===process.platform?"where":"which";return execFileSync(n,[e],{stdio:"ignore",timeout:2e3}),!0}catch{return!1}}function status(e={}){const n=e.settings||{},t="function"==typeof e.probe?e.probe:whichProbe,o=speech.detectEngine({probe:t}),s=speech.resolve(n,{detected:o,envEngine:envEngine()});return{...s,detected:o||null,settings:{enabled:!0===n.enabled,engine:n.engine||"none",model:n.model||"",language:n.language||"auto",maxSeconds:s.maxSeconds},needsModel:Boolean(o)&&!n.model}}function envEngine(){const e=String(process.env.AEGIS_SPEECH||"").trim().toLowerCase();return"none"===e||"local"===e?e:void 0}async function transcribe(e,n={}){const t=Buffer.isBuffer(e)?e:Buffer.from(e||[]);if(!t.length)return{ok:!1,reason:"nothing was recorded"};const o=n.resolved||status({settings:n.settings,probe:n.probe});if(!o.enabled)return{ok:!1,reason:o.reason,install:o.install||null};const s=speech.checkRecording({bytes:t.length,ext:n.ext||"webm"});if(!s.ok)return{ok:!1,reason:s.reason};const r=speech.plan("audio",o);if(!r.ok)return{ok:!1,reason:r.reason};const i=String(n.ext||"webm").replace(/^\./,"").toLowerCase(),c=path.join(os.tmpdir(),`aegis-dictation-${process.pid}-${Date.now()}.${i}`);let a=null;try{a=fs.openSync(c,"w",384),fs.writeFileSync(a,t),fs.closeSync(a),a=null;const e=r.args.map(
|
|
3
|
+
"use strict";const fs=require("node:fs"),os=require("node:os"),path=require("node:path"),{execFile:execFile,execFileSync:execFileSync}=require("node:child_process"),speech=require("./speech-resolve.js");function whichProbe(e){try{const n="win32"===process.platform?"where":"which";return execFileSync(n,[e],{stdio:"ignore",timeout:2e3}),!0}catch{return!1}}function status(e={}){const n=e.settings||{},t="function"==typeof e.probe?e.probe:whichProbe,o=speech.detectEngine({probe:t}),s=speech.resolve(n,{detected:o,envEngine:envEngine()});return{...s,detected:o||null,settings:{enabled:!0===n.enabled,engine:n.engine||"none",model:n.model||"",language:n.language||"auto",maxSeconds:s.maxSeconds},needsModel:Boolean(o)&&!n.model}}function envEngine(){const e=String(process.env.AEGIS_SPEECH||"").trim().toLowerCase();return"none"===e||"local"===e?e:void 0}async function transcribe(e,n={}){const t=Buffer.isBuffer(e)?e:Buffer.from(e||[]);if(!t.length)return{ok:!1,reason:"nothing was recorded"};const o=n.resolved||status({settings:n.settings,probe:n.probe});if(!o.enabled)return{ok:!1,reason:o.reason,install:o.install||null};const s=speech.checkRecording({bytes:t.length,ext:n.ext||"webm"});if(!s.ok)return{ok:!1,reason:s.reason};const r=speech.plan("audio",o);if(!r.ok)return{ok:!1,reason:r.reason};const i=String(n.ext||"webm").replace(/^\./,"").toLowerCase(),c=path.join(os.tmpdir(),`aegis-dictation-${process.pid}-${Date.now()}.${i}`);let a=null;try{a=fs.openSync(c,"w",384),fs.writeFileSync(a,t),fs.closeSync(a),a=null;const e=r.args.map(e=>"audio"===e?c:e),s="function"==typeof n.exec?n.exec:execFileAsync,i=await s(r.cmd,e,{timeout:Math.round(1e3*o.maxSeconds)+15e3,maxBuffer:8388608,windowsHide:!0}),l=speech.normalizeTranscript(String(i&&i.stdout||""));return l?{ok:!0,text:l,engine:r.engine}:{ok:!1,reason:"nothing was heard in that recording",engine:r.engine}}catch(e){const n=String(e&&e.stderr||"").trim();return e&&"ENOENT"===e.code?{ok:!1,reason:`could not run ${r.cmd} — it is on PATH for the shell but not for the app; set Dictation → engine command in Settings`,install:speech.installHint()}:e&&(e.killed||"SIGTERM"===e.signal)?{ok:!1,reason:"transcription took too long and was stopped"}:{ok:!1,reason:n||`transcription failed: ${e&&e.message||"unknown error"}`}}finally{if(null!==a)try{fs.closeSync(a)}catch{}try{fs.unlinkSync(c)}catch{}}}function execFileAsync(e,n,t){return new Promise((o,s)=>{execFile(e,n,{...t,shell:!1,encoding:"utf8"},(e,n,t)=>{if(e)return e.stdout=n,e.stderr=t,void s(e);o({stdout:n,stderr:t})})})}module.exports={status:status,transcribe:transcribe,whichProbe:whichProbe,execFileAsync:execFileAsync,speech:speech};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
2
2
|
// Copyright (C) 2026 Niklas Borneklint — AEGIS Code (aegiscode) / Aegiscloud.
|
|
3
|
-
"use strict";const path=require("node:path"),fs=require("node:fs"),MIN_NODE=[22,5,0],SCHEMA_VERSION=1;function versionAtLeast(e){const t=process.versions.node.split(".").map(
|
|
3
|
+
"use strict";const path=require("node:path"),fs=require("node:fs"),MIN_NODE=[22,5,0],SCHEMA_VERSION=1;function versionAtLeast(e){const t=process.versions.node.split(".").map(e=>Number.parseInt(e,10));for(let r=0;r<e.length;r+=1){const s=t[r]||0;if(s>e[r])return!0;if(s<e[r])return!1}return!0}function loadSqlite(){if(!versionAtLeast(MIN_NODE))return null;const e=process.emitWarning;let t=null;try{process.emitWarning=function(t,...r){const s="string"==typeof r[0]?r[0]:r[0]&&r[0].type,o="string"==typeof t?t:t&&t.message||"";if("ExperimentalWarning"!==s||!/SQLite/i.test(o))return e.call(process,t,...r)},t=require("node:sqlite")}catch{t=null}finally{process.emitWarning=e}return t&&"function"==typeof t.DatabaseSync?t:null}const sqlite=loadSqlite();function isAvailable(){return Boolean(sqlite)}function unavailableReason(){return versionAtLeast(MIN_NODE)?"node:sqlite is not loadable on this runtime":`node:sqlite needs Node >= ${MIN_NODE.join(".")}; this is ${process.versions.node}`}const openHandles=new Map;function entryKey(e){if(e&&"string"==typeof e.id&&e.id)return e.id;const t=String(e&&(e.body||e.text||e.content)||""),r=String(e&&e.scope||"default");return`local:${require("node:crypto").createHash("sha256").update(`${r}\0${t}`).digest("hex").slice(0,32)}`}function normalize(e){const t=e||{},r=String(t.body||t.text||t.content||""),s=Array.isArray(t.tags)?t.tags.map(String):[];return{id:entryKey(t),body:r,scope:String(t.scope||"default"),tags:s,updated:Number(t.updated??t.updated_at??Date.now())||Date.now(),source:String(t.source||"local")}}class MemoryStore{constructor({dir:e,file:t}={}){if(!e&&!t)throw new Error("memory-store: dir or file is required");this.file=t||path.join(e,"memory.db"),this.db=null,this.fts=!1,this.reason=null}open(){if(this.db)return{ok:!0,fts:this.fts,file:this.file};if(!sqlite)return this.reason=unavailableReason(),{ok:!1,reason:this.reason};if(openHandles.get(this.file))throw new Error(`memory-store: a handle for ${this.file} is already open in this process — one owner per file (node:sqlite has no cross-handle locking here)`);try{fs.mkdirSync(path.dirname(this.file),{recursive:!0}),this.db=new sqlite.DatabaseSync(this.file)}catch(e){return this.reason=`open failed: ${e.message}`,this.db=null,{ok:!1,reason:this.reason}}openHandles.set(this.file,this);try{this.db.exec("PRAGMA journal_mode=WAL"),this.db.exec("PRAGMA synchronous=NORMAL"),this.db.exec("PRAGMA busy_timeout=2000")}catch{}const e=this._createSchema();return this._migrate(),{ok:!0,fts:e.fts,file:this.file}}_createSchema(){this.db.exec("\n CREATE TABLE IF NOT EXISTS memory (\n id TEXT PRIMARY KEY,\n body TEXT NOT NULL,\n scope TEXT NOT NULL DEFAULT 'default',\n tags TEXT NOT NULL DEFAULT '[]',\n updated INTEGER NOT NULL,\n source TEXT NOT NULL DEFAULT 'local'\n );\n CREATE INDEX IF NOT EXISTS memory_updated ON memory(updated);\n CREATE INDEX IF NOT EXISTS memory_scope ON memory(scope);\n ");try{this.db.exec("\n CREATE VIRTUAL TABLE IF NOT EXISTS memory_fts\n USING fts5(body, id UNINDEXED, scope UNINDEXED);\n "),this.fts=!0}catch{this.fts=!1}return{fts:this.fts}}_migrate(){if(this.db)try{const e=this.db.prepare("PRAGMA user_version").get(),t=e&&Number(e.user_version)||0;this.fts&&this.db.exec("\n INSERT INTO memory_fts (body, id, scope)\n SELECT m.body, m.id, m.scope FROM memory m\n WHERE NOT EXISTS (SELECT 1 FROM memory_fts f WHERE f.id = m.id)\n "),1!==t&&this.db.exec("PRAGMA user_version = 1")}catch{}}upsert(e){const t=this.open();if(!t.ok)return{ok:!1,reason:t.reason};const r=normalize(e);try{return this.db.prepare("INSERT INTO memory (id, body, scope, tags, updated, source)\n VALUES (?, ?, ?, ?, ?, ?)\n ON CONFLICT(id) DO UPDATE SET\n body = excluded.body,\n scope = excluded.scope,\n tags = excluded.tags,\n updated = excluded.updated,\n source = excluded.source").run(r.id,r.body,r.scope,JSON.stringify(r.tags),r.updated,r.source),this.fts&&(this.db.prepare("DELETE FROM memory_fts WHERE id = ?").run(r.id),this.db.prepare("INSERT INTO memory_fts (body, id, scope) VALUES (?, ?, ?)").run(r.body,r.id,r.scope)),{ok:!0,id:r.id}}catch(e){return{ok:!1,reason:e.message}}}upsertMany(e){const t=this.open();if(!t.ok)return{ok:!1,reason:t.reason,wrote:0,failed:0};const r=Array.isArray(e)?e:[];let s=0,o=0;try{this.db.exec("BEGIN");for(const e of r)this.upsert(e).ok?s+=1:o+=1;this.db.exec("COMMIT")}catch(e){try{this.db.exec("ROLLBACK")}catch{}return{ok:!1,reason:e.message,wrote:s,failed:o}}return{ok:!0,wrote:s,failed:o}}search(e,{limit:t=5,scope:r=null}={}){const s=this.open();if(!s.ok)return{ok:!1,reason:s.reason,results:[]};const o=String(e||"").trim(),n=Math.max(1,Math.min(200,Number(t)||5));try{let e;if(o)if(this.fts){const t=o.split(/\s+/).filter(Boolean).map(e=>`"${e.replace(/"/g,'""')}"`).join(" ");e=r?this.db.prepare("SELECT m.id, m.body, m.scope, m.tags, m.updated\n FROM memory_fts f JOIN memory m ON m.id = f.id\n WHERE memory_fts MATCH ? AND m.scope = ?\n ORDER BY rank LIMIT ?").all(t,r,n):this.db.prepare("SELECT m.id, m.body, m.scope, m.tags, m.updated\n FROM memory_fts f JOIN memory m ON m.id = f.id\n WHERE memory_fts MATCH ?\n ORDER BY rank LIMIT ?").all(t,n)}else e=r?this.db.prepare("SELECT id, body, scope, tags, updated FROM memory\n WHERE body LIKE '%' || ? || '%' AND scope = ?\n ORDER BY updated DESC LIMIT ?").all(o,r,n):this.db.prepare("SELECT id, body, scope, tags, updated FROM memory\n WHERE body LIKE '%' || ? || '%' ORDER BY updated DESC LIMIT ?").all(o,n);else e=r?this.db.prepare("SELECT id, body, scope, tags, updated FROM memory WHERE scope = ? ORDER BY updated DESC LIMIT ?").all(r,n):this.db.prepare("SELECT id, body, scope, tags, updated FROM memory ORDER BY updated DESC LIMIT ?").all(n);return{ok:!0,fts:this.fts,results:e.map(e=>({id:e.id,body:e.body,scope:e.scope,tags:JSON.parse(e.tags||"[]"),updated:e.updated}))}}catch(e){return{ok:!1,reason:e.message,results:[]}}}watermark(){if(!this.open().ok)return 0;try{const e=this.db.prepare("SELECT MAX(updated) AS w FROM memory").get();return e&&Number(e.w)||0}catch{return 0}}count(){if(!this.open().ok)return 0;try{const e=this.db.prepare("SELECT COUNT(*) AS n FROM memory").get();return e&&Number(e.n)||0}catch{return 0}}schemaVersion(){if(!this.open().ok)return-1;try{const e=this.db.prepare("PRAGMA user_version").get();return e&&Number(e.user_version)||0}catch{return-1}}close(){if(this.db){try{this.db.close()}catch{}openHandles.delete(this.file),this.db=null}}}function openStore(e){const t=new MemoryStore(e),r=t.open();return{store:t,opened:r}}module.exports={MemoryStore:MemoryStore,openStore:openStore,isAvailable:isAvailable,unavailableReason:unavailableReason,entryKey:entryKey,normalize:normalize,MIN_NODE:MIN_NODE,SCHEMA_VERSION:1};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
2
2
|
// Copyright (C) 2026 Niklas Borneklint — AEGIS Code (aegiscode) / Aegiscloud.
|
|
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:"cloud sync 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((
|
|
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:"cloud sync 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,3 +1,3 @@
|
|
|
1
1
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
2
2
|
// Copyright (C) 2026 Niklas Borneklint — AEGIS Code (aegiscode) / Aegiscloud.
|
|
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(
|
|
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};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "aegis-desktop",
|
|
3
3
|
"productName": "aegis one",
|
|
4
4
|
"desktopName": "aegis-desktop",
|
|
5
|
-
"version": "1.0.
|
|
5
|
+
"version": "1.0.57",
|
|
6
6
|
"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.",
|
|
7
7
|
"author": {
|
|
8
8
|
"name": "AEGIS Code",
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
2
2
|
// Copyright (C) 2026 Niklas Borneklint — AEGIS Code (aegiscode) / Aegiscloud.
|
|
3
|
-
"use strict";const{contextBridge:contextBridge,ipcRenderer:ipcRenderer}=require("electron"),IPC_PREFIX="aegis:",MODEL_PREFIX="model:",SYNC_PREFIX="sync:",QUICK_PREFIX="quick:",QUEUE_PREFIX="queue:",AUTO_PREFIX="auto:",QUEUE_PROGRESS_CHANNEL=`${QUEUE_PREFIX}progress`,QUEUE_CHANGED_CHANNEL=`${QUEUE_PREFIX}changed`,CHAT_DELTA_CHANNEL="aegis:chatDelta",PTY_EVENT_CHANNEL="aegis:ptyEvent",UPDATE_STATUS_CHANNEL="aegis:updateStatus",ACCOUNT_STATUS_CHANNEL="aegis:accountStatusChanged",MENU_NEW_CHAT_CHANNEL="aegis:menuNewChat",MENU_SEARCH_CHANNEL="aegis:menuSearch",MENU_SEARCH_MEMORY_CHANNEL="aegis:menuSearchMemory",MENU_CREDITS_CHANNEL="aegis:menuCredits",MENU_PALETTE_CHANNEL="aegis:menuPalette",MENU_TOGGLE_SIDEBAR_CHANNEL="aegis:menuToggleSidebar",MENU_FIND_CHANNEL="aegis:menuFind",MENU_GO_BACK_CHANNEL="aegis:menuGoBack",MENU_GO_FORWARD_CHANNEL="aegis:menuGoForward",MENU_EXPORT_MARKDOWN_CHANNEL="aegis:menuExportMarkdown",MENU_EXPORT_JSON_CHANNEL="aegis:menuExportJson",MENU_FINGERPRINT_CHANNEL="aegis:menuFingerprint",MENU_GOOGLE_DRIVE_CHANNEL="aegis:menuGoogleDrive",DEEP_LINK_CHANNEL="aegis:deepLink",QUICK_LAUNCHER_PUSH_CHANNEL="aegis:quickLauncherPush";function invoke(e,n){return ipcRenderer.invoke("aegis:"+e,void 0===n?void 0:n)}function invokeModel(e,n){return ipcRenderer.invoke("model:"+e,void 0===n?void 0:n)}function invokeSync(e,n){return ipcRenderer.invoke("sync:"+e,void 0===n?void 0:n)}function invokeQuick(e,n){return ipcRenderer.invoke("quick:"+e,void 0===n?void 0:n)}function invokeQueue(e,n){return ipcRenderer.invoke(QUEUE_PREFIX+e,void 0===n?void 0:n)}function invokeAuto(e,n){return ipcRenderer.invoke("auto:"+e,void 0===n?void 0:n)}function deltaListener(e,n){const o=e||null;return(e,i)=>{(i&&i.id?i.id:null)===o&&n(i)}}const api={status:()=>invoke("status"),attachments:Object.freeze({pathFor:e=>{try{const{webUtils:n}=require("electron");return n&&"function"==typeof n.getPathForFile&&n.getPathForFile(e)||""}catch{return""}},ingest:e=>invoke("attachments:ingest",{path:String(null==e?"":e)})}),setApiKey:e=>invoke("setApiKey",{key:e}),verifyApiKey:()=>invoke("verifyApiKey"),tokenBankBalance:()=>invoke("tokenBankBalance"),billingCheckout:()=>invoke("billingCheckout"),tokenBankTopup:e=>invoke("tokenBankTopup",{amountEur:e}),listModels:()=>invoke("listModels"),readTextFile:(e,n)=>{try{return ipcRenderer.sendSync("model:readTextFile",{file:e,cwd:n})}catch{return null}},chatCompletion:(e,n)=>{const o=e||{};if("function"!=typeof n)return invoke("chatCompletion",{...o,stream:!1});const i=deltaListener(o.sessionId,n),r=()=>ipcRenderer.removeListener("aegis:chatDelta",i);return ipcRenderer.on("aegis:chatDelta",i),invoke("chatCompletion",{...o,stream:!0}).then((e=>(r(),e)),(e=>{throw r(),e}))},byokStatus:()=>invoke("byokStatus"),byokSet:(e,n)=>invoke("byokSet",{provider:e,apiKey:n}),memorySearch:(e,n)=>invoke("memorySearch",{query:e,limit:n}),memorySave:e=>invoke("memorySave",{entry:e}),memoryList:e=>invoke("memoryList",{limit:e}),verifyToken:e=>invoke("verifyToken",{token:e}),memoryActivate:e=>invoke("memoryActivate",{token:e}),memoryPull:e=>invoke("memoryPull",{since:e}),memorySaveBatch:e=>invoke("memorySaveBatch",{entries:e}),memoryImport:e=>invoke("memoryImport",e||{}),sessionsImportScan:()=>invoke("sessionsImportScan"),sessionsImport:e=>invoke("sessionsImport",e||{}),importConversation:e=>invoke("importConversation",e||{}),openExternal:e=>invoke("openExternal",{url:e}),fingerprintStatus:()=>invoke("fingerprintStatus"),fingerprintKeygen:e=>invoke("fingerprintKeygen",e||{}),fingerprintMint:e=>invoke("fingerprintMint",e||{}),fingerprintVerify:e=>invoke("fingerprintVerify",e||{}),fingerprintBackup:e=>invoke("fingerprintBackup",e||{}),fingerprintPublish:e=>invoke("fingerprintPublish",e||{}),fingerprintAnchor:e=>invoke("fingerprintAnchor",e||{}),fingerprintVault:()=>invoke("fingerprintVault"),fingerprintVaultAudit:()=>invoke("fingerprintVaultAudit"),getConfirmMode:()=>invoke("getConfirmMode"),setConfirmMode:e=>invoke("setConfirmMode",{enabled:Boolean(e)}),getDevMode:()=>invoke("getDevMode"),setDevMode:e=>invoke("setDevMode",{enabled:Boolean(e)}),getModelAutoSync:()=>invoke("getModelAutoSync"),setModelAutoSync:e=>invoke("setModelAutoSync",{enabled:Boolean(e)}),getAccountUsername:()=>invoke("getAccountUsername"),setAccountUsername:e=>invoke("setAccountUsername",{username:null==e?null:String(e)}),getFontScale:()=>invoke("getFontScale"),setFontScale:e=>invoke("setFontScale",{scale:Number(e)}),getAccent:()=>invoke("getAccent"),setAccent:e=>invoke("setAccent",{name:String(e)}),getPermissionMode:()=>invoke("getPermissionMode"),setPermissionMode:e=>invoke("setPermissionMode",{mode:e?"plan":null}),permRulesList:()=>invoke("permRulesList"),permRulesAdd:(e,n)=>invoke("permRulesAdd",{list:String(e||""),rule:String(n||"")}),permRulesRemove:(e,n)=>invoke("permRulesRemove",{list:String(e||""),rule:String(n||"")}),personaRead:()=>invoke("personaRead"),personaPatch:e=>invoke("personaPatch",{patch:e||{}}),getSandboxPolicy:()=>invoke("getSandboxPolicy"),setSandboxPolicy:(e,n)=>invoke("setSandboxPolicy",{mode:String(e||""),network:String(n||"")}),getVaultBackend:()=>invoke("getVaultBackend"),openCliFace:e=>invoke("openCliFace",{args:Array.isArray(e)?e.map(String):[]}),pty:Object.freeze({hello:()=>invoke("ptyHello",{}),exec:(e,n)=>invoke("ptyExec",{id:e,params:n||{}}),write:(e,n)=>invoke("ptyWrite",{id:e,data:String(null==n?"":n)}),resize:(e,n,o)=>invoke("ptyResize",{id:e,cols:Number(n)||0,rows:Number(o)||0}),cancel:e=>invoke("ptyCancel",{id:e}),onEvent:(e,n)=>{const o=(o,i)=>{i&&i.id===e&&n(i)};return ipcRenderer.on("aegis:ptyEvent",o),()=>ipcRenderer.removeListener("aegis:ptyEvent",o)}}),setVaultBackend:e=>invoke("setVaultBackend",{backend:String(e||"")}),telemetryEvent:(e,n)=>{const o=n||{};return invoke("telemetryEvent",{event:null==e?"":String(e),campaign:null==o.campaign?null:String(o.campaign),surface:null==o.surface?null:String(o.surface)})},telemetryReport:()=>invoke("telemetryReport"),covenantStatus:()=>invoke("covenantStatus"),covenantGapReport:()=>invoke("covenantGapReport"),getMemoryPersist:()=>invoke("memoryPersist.get"),setMemoryPersist:e=>invoke("memoryPersist.set",{enabled:Boolean(e)}),checkForUpdates:()=>invoke("checkForUpdates"),downloadUpdate:()=>invoke("downloadUpdate"),quitAndInstallUpdate:()=>invoke("quitAndInstallUpdate"),updateStatus:()=>invoke("updateStatus"),onUpdateStatus:e=>{const n=(n,o)=>e(o);return ipcRenderer.on("aegis:updateStatus",n),()=>ipcRenderer.removeListener("aegis:updateStatus",n)},accountStatus:()=>invoke("accountStatus"),registerAccount:()=>invoke("registerAccount"),onAccountStatus:e=>{const n=(n,o)=>e(o);return ipcRenderer.on(ACCOUNT_STATUS_CHANNEL,n),()=>ipcRenderer.removeListener(ACCOUNT_STATUS_CHANNEL,n)},driveSignIn:()=>invoke("driveSignIn"),driveConnect:()=>invoke("driveConnect"),driveStatus:()=>invoke("driveStatus"),driveSyncMemory:()=>invoke("driveSyncMemory"),driveBackupConversation:e=>invoke("driveBackupConversation",{sessionId:e}),speechStatus:()=>invoke("speechStatus"),speechSet:e=>{const n=e||{},o={};return"boolean"==typeof n.enabled&&(o.enabled=n.enabled),"string"==typeof n.engine&&(o.engine="local"===n.engine?"local":"none"),"string"==typeof n.model&&(o.model=n.model),"string"==typeof n.language&&(o.language=n.language),null!=n.maxSeconds&&Number.isFinite(Number(n.maxSeconds))&&(o.maxSeconds=Number(n.maxSeconds)),invoke("speechSet",o)},speechTranscribe:e=>{const n=e||{};return invoke("speechTranscribe",{audio:n.audio,ext:null==n.ext?"webm":String(n.ext)})},skillsList:()=>invoke("skillsList"),skillsRead:e=>invoke("skillsRead",{name:String(null==e?"":e)}),skillsCreate:e=>{const n=e||{};return invoke("skillsCreate",{name:String(null==n.name?"":n.name),description:String(null==n.description?"":n.description),body:String(null==n.body?"":n.body),targetDir:String(null==n.targetDir?"":n.targetDir)})},skillsRemove:e=>invoke("skillsRemove",{name:String(null==e?"":e)}),skillsImport:e=>{const n=e||{};return invoke("skillsImport",{url:String(null==n.url?"":n.url),name:String(null==n.name?"":n.name),targetDir:String(null==n.targetDir?"":n.targetDir)})},onMenuNewChat:e=>{const n=()=>e();return ipcRenderer.on("aegis:menuNewChat",n),()=>ipcRenderer.removeListener("aegis:menuNewChat",n)},onMenuSearch:e=>{const n=()=>e();return ipcRenderer.on("aegis:menuSearch",n),()=>ipcRenderer.removeListener("aegis:menuSearch",n)},onMenuSearchMemory:e=>{const n=()=>e();return ipcRenderer.on("aegis:menuSearchMemory",n),()=>ipcRenderer.removeListener("aegis:menuSearchMemory",n)},onMenuCredits:e=>{const n=()=>e();return ipcRenderer.on("aegis:menuCredits",n),()=>ipcRenderer.removeListener("aegis:menuCredits",n)},credits:()=>invoke("credits"),onMenuPalette:e=>{const n=()=>e();return ipcRenderer.on("aegis:menuPalette",n),()=>ipcRenderer.removeListener("aegis:menuPalette",n)},onMenuToggleSidebar:e=>{const n=()=>e();return ipcRenderer.on("aegis:menuToggleSidebar",n),()=>ipcRenderer.removeListener("aegis:menuToggleSidebar",n)},onMenuFind:e=>{const n=()=>e();return ipcRenderer.on("aegis:menuFind",n),()=>ipcRenderer.removeListener("aegis:menuFind",n)},onMenuGoBack:e=>{const n=()=>e();return ipcRenderer.on("aegis:menuGoBack",n),()=>ipcRenderer.removeListener("aegis:menuGoBack",n)},onMenuGoForward:e=>{const n=()=>e();return ipcRenderer.on("aegis:menuGoForward",n),()=>ipcRenderer.removeListener("aegis:menuGoForward",n)},setNavState:e=>invoke("setNavState",e),onMenuExportMarkdown:e=>{const n=()=>e();return ipcRenderer.on("aegis:menuExportMarkdown",n),()=>ipcRenderer.removeListener("aegis:menuExportMarkdown",n)},onMenuFingerprint:e=>{const n=()=>e();return ipcRenderer.on("aegis:menuFingerprint",n),()=>ipcRenderer.removeListener("aegis:menuFingerprint",n)},onMenuGoogleDrive:e=>{const n=()=>e();return ipcRenderer.on("aegis:menuGoogleDrive",n),()=>ipcRenderer.removeListener("aegis:menuGoogleDrive",n)},onMenuExportJson:e=>{const n=()=>e();return ipcRenderer.on("aegis:menuExportJson",n),()=>ipcRenderer.removeListener("aegis:menuExportJson",n)},exportSession:(e,n)=>invoke("exportSession",{sessionId:e,format:n}),onDeepLink:e=>{const n=(n,o)=>e(o);return ipcRenderer.on("aegis:deepLink",n),()=>ipcRenderer.removeListener("aegis:deepLink",n)},onQuickLauncherPush:e=>{const n=(n,o)=>e(o);return ipcRenderer.on("aegis:quickLauncherPush",n),()=>ipcRenderer.removeListener("aegis:quickLauncherPush",n)}},models={listClasses:()=>invokeModel("listClasses"),listModels:e=>invokeModel("listModels",{class:e}),chat:(e,n)=>{const o=e||{};if("function"!=typeof n)return invokeModel("chat",o);const i=deltaListener(o.sessionId,n),r=()=>ipcRenderer.removeListener("aegis:chatDelta",i);return ipcRenderer.on("aegis:chatDelta",i),invokeModel("chat",o).then((e=>(r(),e)),(e=>{throw r(),e}))},settings:{get:()=>invokeModel("settings.get"),set:(e,n)=>invokeModel("settings.set",{provider:e,baseURL:n&&n.baseURL,key:n&&n.key}),remove:e=>invokeModel("settings.remove",{provider:e})},userModels:{get:()=>invokeModel("userModels.get"),add:(e,n)=>invokeModel("userModels.add",{provider:e,model:n}),remove:(e,n)=>invokeModel("userModels.remove",{provider:e,model:n}),discover:e=>invokeModel("userModels.discover",{provider:e}),addAll:(e,n)=>invokeModel("userModels.addAll",{provider:e,ids:n}),canDiscover:e=>invokeModel("userModels.canDiscover",{provider:e}),discoverable:()=>invokeModel("userModels.discoverable"),syncPlan:e=>invokeModel("userModels.syncPlan",{only:e}),syncApply:(e,n)=>invokeModel("userModels.syncApply",{plan:e,only:n}),syncStatus:()=>invokeModel("userModels.syncStatus"),syncNow:e=>invokeModel("userModels.syncNow",{only:e})},cancel:e=>invokeModel("cancel",{sessionId:e}),respondApproval:(e,n)=>invokeModel("respondApproval",{approvalId:e,decision:n}),respondRoundsAsk:(e,n)=>invokeModel("respondRoundsAsk",{roundsAskId:e,decision:n}),clearApprovals:e=>invokeModel("clearApprovals",{sessionId:e}),listUndoable:e=>invokeModel("listUndoable",{sessionId:e}),undoMutation:(e,n)=>invokeModel("undoMutation",{sessionId:e,id:n})},sync={listSessions:()=>invokeSync("listSessions"),searchSessions:(e,n)=>invokeSync("searchSessions",{query:e,limit:n}),open:e=>invokeSync("open",{sessionId:e}),save:e=>invokeSync("save",e||{}),nameSession:e=>invokeSync("nameSession",{sessionId:e&&e.sessionId,prompt:e&&e.prompt,class:e&&e.class,model:e&&e.model}),append:(e,n)=>invokeSync("append",{sessionId:e,message:n}),delete:e=>invokeSync("delete",{sessionId:e}),rename:(e,n)=>invokeSync("rename",{sessionId:e,title:n}),push:()=>invokeSync("push"),pull:()=>invokeSync("pull"),status:()=>invokeSync("status"),auto:()=>invokeSync("auto"),memoryPersistState:()=>invokeSync("memoryPersistState")},quickLauncher={status:()=>invokeQuick("status"),setConfig:e=>invokeQuick("setConfig",{enabled:e&&e.enabled,shortcut:e&&e.shortcut}),pushToMain:e=>invokeQuick("pushToMain",e||{})},queue={enqueue:e=>invokeQueue("enqueue",queueTaskFields(e)),list:()=>invokeQueue("list"),clear:e=>invokeQueue("clear",{all:Boolean(e)}),entitlement:e=>invokeQueue("entitlement",{force:Boolean(e)}),retry:e=>queueWithId("retry",e),remove:e=>queueWithId("remove",e),drain:()=>invokeQueue("drain",{}),proceed:()=>invokeQueue("proceed",{}),stop:e=>{const n=queueTaskId(e);return invokeQueue("stop",null==n?{}:{id:n})},onProgress:e=>{if("function"!=typeof e)return()=>{};const n=(n,o)=>e(o);return ipcRenderer.on(QUEUE_PROGRESS_CHANNEL,n),()=>ipcRenderer.removeListener(QUEUE_PROGRESS_CHANNEL,n)},onChanged:e=>{if("function"!=typeof e)return()=>{};const n=()=>e();return ipcRenderer.on(QUEUE_CHANGED_CHANNEL,n),()=>ipcRenderer.removeListener(QUEUE_CHANGED_CHANNEL,n)}},auto={status:()=>invokeAuto("autoStatus"),setDrain:e=>{const n=e||{},o={enabled:Boolean(n.enabled)};return null!=n.intervalMs&&Number.isFinite(Number(n.intervalMs))&&(o.intervalMs=Number(n.intervalMs)),invokeAuto("autoSetDrain",o)},setMint:e=>{const n=e||{};return invokeAuto("autoSetMint",{enabled:Boolean(n.enabled),publish:Boolean(n.publish)})},sealNow:e=>invokeAuto("autoSealNow",{publish:Boolean(e)})};function queueTaskId(e){const n=Number(e);return Number.isInteger(n)&&n>0?n:null}function queueWithId(e,n){const o=queueTaskId(n);return null==o?Promise.resolve({ok:!1,reason:`${e} needs a task id`}):invokeQueue(e,{id:o})}function queueTaskFields(e){const n=e||{};return{task:String(null==n.task?"":n.task),cwd:String(null==n.cwd?"":n.cwd),class:null==n.class?null:String(n.class),model:null==n.model?null:String(n.model),effort:null==n.effort?null:String(n.effort),workers:null==n.workers?null:Number(n.workers),maxRounds:null==n.maxRounds?null:Number(n.maxRounds),fanout:Boolean(n.fanout),commit:Boolean(n.commit)}}contextBridge.exposeInMainWorld("aegis",Object.freeze(api)),contextBridge.exposeInMainWorld("models",Object.freeze(models)),contextBridge.exposeInMainWorld("sync",Object.freeze(sync)),contextBridge.exposeInMainWorld("quickLauncher",Object.freeze(quickLauncher)),contextBridge.exposeInMainWorld("queue",Object.freeze(queue)),contextBridge.exposeInMainWorld("auto",Object.freeze(auto));
|
|
3
|
+
"use strict";const{contextBridge:contextBridge,ipcRenderer:ipcRenderer}=require("electron"),IPC_PREFIX="aegis:",MODEL_PREFIX="model:",SYNC_PREFIX="sync:",QUICK_PREFIX="quick:",QUEUE_PREFIX="queue:",AUTO_PREFIX="auto:",QUEUE_PROGRESS_CHANNEL="queue:progress",QUEUE_CHANGED_CHANNEL="queue:changed",CHAT_DELTA_CHANNEL="aegis:chatDelta",PTY_EVENT_CHANNEL="aegis:ptyEvent",UPDATE_STATUS_CHANNEL="aegis:updateStatus",ACCOUNT_STATUS_CHANNEL="aegis:accountStatusChanged",MENU_NEW_CHAT_CHANNEL="aegis:menuNewChat",MENU_SEARCH_CHANNEL="aegis:menuSearch",MENU_SEARCH_MEMORY_CHANNEL="aegis:menuSearchMemory",MENU_CREDITS_CHANNEL="aegis:menuCredits",MENU_PALETTE_CHANNEL="aegis:menuPalette",MENU_TOGGLE_SIDEBAR_CHANNEL="aegis:menuToggleSidebar",MENU_FIND_CHANNEL="aegis:menuFind",MENU_GO_BACK_CHANNEL="aegis:menuGoBack",MENU_GO_FORWARD_CHANNEL="aegis:menuGoForward",MENU_EXPORT_MARKDOWN_CHANNEL="aegis:menuExportMarkdown",MENU_EXPORT_JSON_CHANNEL="aegis:menuExportJson",MENU_FINGERPRINT_CHANNEL="aegis:menuFingerprint",MENU_GOOGLE_DRIVE_CHANNEL="aegis:menuGoogleDrive",DEEP_LINK_CHANNEL="aegis:deepLink",QUICK_LAUNCHER_PUSH_CHANNEL="aegis:quickLauncherPush";function invoke(e,n){return ipcRenderer.invoke("aegis:"+e,void 0===n?void 0:n)}function invokeModel(e,n){return ipcRenderer.invoke("model:"+e,void 0===n?void 0:n)}function invokeSync(e,n){return ipcRenderer.invoke("sync:"+e,void 0===n?void 0:n)}function invokeQuick(e,n){return ipcRenderer.invoke("quick:"+e,void 0===n?void 0:n)}function invokeQueue(e,n){return ipcRenderer.invoke("queue:"+e,void 0===n?void 0:n)}function invokeAuto(e,n){return ipcRenderer.invoke("auto:"+e,void 0===n?void 0:n)}function deltaListener(e,n){const o=e||null;return(e,i)=>{(i&&i.id?i.id:null)===o&&n(i)}}const api={status:()=>invoke("status"),attachments:Object.freeze({pathFor:e=>{try{const{webUtils:n}=require("electron");return n&&"function"==typeof n.getPathForFile&&n.getPathForFile(e)||""}catch{return""}},ingest:e=>invoke("attachments:ingest",{path:String(null==e?"":e)})}),setApiKey:e=>invoke("setApiKey",{key:e}),verifyApiKey:()=>invoke("verifyApiKey"),tokenBankBalance:()=>invoke("tokenBankBalance"),billingCheckout:()=>invoke("billingCheckout"),tokenBankTopup:e=>invoke("tokenBankTopup",{amountEur:e}),listModels:()=>invoke("listModels"),readTextFile:(e,n)=>{try{return ipcRenderer.sendSync("model:readTextFile",{file:e,cwd:n})}catch{return null}},chatCompletion:(e,n)=>{const o=e||{};if("function"!=typeof n)return invoke("chatCompletion",{...o,stream:!1});const i=deltaListener(o.sessionId,n),r=()=>ipcRenderer.removeListener("aegis:chatDelta",i);return ipcRenderer.on("aegis:chatDelta",i),invoke("chatCompletion",{...o,stream:!0}).then(e=>(r(),e),e=>{throw r(),e})},byokStatus:()=>invoke("byokStatus"),byokSet:(e,n)=>invoke("byokSet",{provider:e,apiKey:n}),memorySearch:(e,n)=>invoke("memorySearch",{query:e,limit:n}),memorySave:e=>invoke("memorySave",{entry:e}),memoryList:e=>invoke("memoryList",{limit:e}),verifyToken:e=>invoke("verifyToken",{token:e}),memoryActivate:e=>invoke("memoryActivate",{token:e}),memoryPull:e=>invoke("memoryPull",{since:e}),memorySaveBatch:e=>invoke("memorySaveBatch",{entries:e}),memoryImport:e=>invoke("memoryImport",e||{}),sessionsImportScan:()=>invoke("sessionsImportScan"),sessionsImport:e=>invoke("sessionsImport",e||{}),importConversation:e=>invoke("importConversation",e||{}),openExternal:e=>invoke("openExternal",{url:e}),fingerprintStatus:()=>invoke("fingerprintStatus"),fingerprintKeygen:e=>invoke("fingerprintKeygen",e||{}),fingerprintMint:e=>invoke("fingerprintMint",e||{}),fingerprintVerify:e=>invoke("fingerprintVerify",e||{}),fingerprintBackup:e=>invoke("fingerprintBackup",e||{}),
|
|
4
|
+
// The vault: publish a sealed record (default gdrive:AEGIS-AGPL/records),
|
|
5
|
+
fingerprintPublish:e=>invoke("fingerprintPublish",e||{}),fingerprintAnchor:e=>invoke("fingerprintAnchor",e||{}),fingerprintVault:()=>invoke("fingerprintVault"),fingerprintVaultAudit:()=>invoke("fingerprintVaultAudit"),getConfirmMode:()=>invoke("getConfirmMode"),setConfirmMode:e=>invoke("setConfirmMode",{enabled:Boolean(e)}),getDevMode:()=>invoke("getDevMode"),setDevMode:e=>invoke("setDevMode",{enabled:Boolean(e)}),getModelAutoSync:()=>invoke("getModelAutoSync"),setModelAutoSync:e=>invoke("setModelAutoSync",{enabled:Boolean(e)}),getAccountUsername:()=>invoke("getAccountUsername"),setAccountUsername:e=>invoke("setAccountUsername",{username:null==e?null:String(e)}),getFontScale:()=>invoke("getFontScale"),setFontScale:e=>invoke("setFontScale",{scale:Number(e)}),getAccent:()=>invoke("getAccent"),setAccent:e=>invoke("setAccent",{name:String(e)}),getPermissionMode:()=>invoke("getPermissionMode"),setPermissionMode:e=>invoke("setPermissionMode",{mode:e?"plan":null}),permRulesList:()=>invoke("permRulesList"),permRulesAdd:(e,n)=>invoke("permRulesAdd",{list:String(e||""),rule:String(n||"")}),permRulesRemove:(e,n)=>invoke("permRulesRemove",{list:String(e||""),rule:String(n||"")}),personaRead:()=>invoke("personaRead"),personaPatch:e=>invoke("personaPatch",{patch:e||{}}),getSandboxPolicy:()=>invoke("getSandboxPolicy"),setSandboxPolicy:(e,n)=>invoke("setSandboxPolicy",{mode:String(e||""),network:String(n||"")}),getVaultBackend:()=>invoke("getVaultBackend"),openCliFace:e=>invoke("openCliFace",{args:Array.isArray(e)?e.map(String):[]}),pty:Object.freeze({hello:()=>invoke("ptyHello",{}),exec:(e,n)=>invoke("ptyExec",{id:e,params:n||{}}),write:(e,n)=>invoke("ptyWrite",{id:e,data:String(null==n?"":n)}),resize:(e,n,o)=>invoke("ptyResize",{id:e,cols:Number(n)||0,rows:Number(o)||0}),cancel:e=>invoke("ptyCancel",{id:e}),onEvent:(e,n)=>{const o=(o,i)=>{i&&i.id===e&&n(i)};return ipcRenderer.on("aegis:ptyEvent",o),()=>ipcRenderer.removeListener("aegis:ptyEvent",o)}}),setVaultBackend:e=>invoke("setVaultBackend",{backend:String(e||"")}),telemetryEvent:(e,n)=>{const o=n||{};return invoke("telemetryEvent",{event:null==e?"":String(e),campaign:null==o.campaign?null:String(o.campaign),surface:null==o.surface?null:String(o.surface)})},telemetryReport:()=>invoke("telemetryReport"),covenantStatus:()=>invoke("covenantStatus"),covenantGapReport:()=>invoke("covenantGapReport"),getMemoryPersist:()=>invoke("memoryPersist.get"),setMemoryPersist:e=>invoke("memoryPersist.set",{enabled:Boolean(e)}),checkForUpdates:()=>invoke("checkForUpdates"),downloadUpdate:()=>invoke("downloadUpdate"),quitAndInstallUpdate:()=>invoke("quitAndInstallUpdate"),updateStatus:()=>invoke("updateStatus"),onUpdateStatus:e=>{const n=(n,o)=>e(o);return ipcRenderer.on("aegis:updateStatus",n),()=>ipcRenderer.removeListener("aegis:updateStatus",n)},accountStatus:()=>invoke("accountStatus"),registerAccount:()=>invoke("registerAccount"),onAccountStatus:e=>{const n=(n,o)=>e(o);return ipcRenderer.on(ACCOUNT_STATUS_CHANNEL,n),()=>ipcRenderer.removeListener(ACCOUNT_STATUS_CHANNEL,n)},driveSignIn:()=>invoke("driveSignIn"),driveConnect:()=>invoke("driveConnect"),driveStatus:()=>invoke("driveStatus"),driveSyncMemory:()=>invoke("driveSyncMemory"),driveBackupConversation:e=>invoke("driveBackupConversation",{sessionId:e}),speechStatus:()=>invoke("speechStatus"),speechSet:e=>{const n=e||{},o={};return"boolean"==typeof n.enabled&&(o.enabled=n.enabled),"string"==typeof n.engine&&(o.engine="local"===n.engine?"local":"none"),"string"==typeof n.model&&(o.model=n.model),"string"==typeof n.language&&(o.language=n.language),null!=n.maxSeconds&&Number.isFinite(Number(n.maxSeconds))&&(o.maxSeconds=Number(n.maxSeconds)),invoke("speechSet",o)},speechTranscribe:e=>{const n=e||{};return invoke("speechTranscribe",{audio:n.audio,ext:null==n.ext?"webm":String(n.ext)})},skillsList:()=>invoke("skillsList"),skillsRead:e=>invoke("skillsRead",{name:String(null==e?"":e)}),skillsCreate:e=>{const n=e||{};return invoke("skillsCreate",{name:String(null==n.name?"":n.name),description:String(null==n.description?"":n.description),body:String(null==n.body?"":n.body),targetDir:String(null==n.targetDir?"":n.targetDir)})},skillsRemove:e=>invoke("skillsRemove",{name:String(null==e?"":e)}),skillsImport:e=>{const n=e||{};return invoke("skillsImport",{url:String(null==n.url?"":n.url),name:String(null==n.name?"":n.name),targetDir:String(null==n.targetDir?"":n.targetDir)})},onMenuNewChat:e=>{const n=()=>e();return ipcRenderer.on("aegis:menuNewChat",n),()=>ipcRenderer.removeListener("aegis:menuNewChat",n)},onMenuSearch:e=>{const n=()=>e();return ipcRenderer.on("aegis:menuSearch",n),()=>ipcRenderer.removeListener("aegis:menuSearch",n)},onMenuSearchMemory:e=>{const n=()=>e();return ipcRenderer.on("aegis:menuSearchMemory",n),()=>ipcRenderer.removeListener("aegis:menuSearchMemory",n)},onMenuCredits:e=>{const n=()=>e();return ipcRenderer.on("aegis:menuCredits",n),()=>ipcRenderer.removeListener("aegis:menuCredits",n)},credits:()=>invoke("credits"),onMenuPalette:e=>{const n=()=>e();return ipcRenderer.on("aegis:menuPalette",n),()=>ipcRenderer.removeListener("aegis:menuPalette",n)},onMenuToggleSidebar:e=>{const n=()=>e();return ipcRenderer.on("aegis:menuToggleSidebar",n),()=>ipcRenderer.removeListener("aegis:menuToggleSidebar",n)},onMenuFind:e=>{const n=()=>e();return ipcRenderer.on("aegis:menuFind",n),()=>ipcRenderer.removeListener("aegis:menuFind",n)},onMenuGoBack:e=>{const n=()=>e();return ipcRenderer.on("aegis:menuGoBack",n),()=>ipcRenderer.removeListener("aegis:menuGoBack",n)},onMenuGoForward:e=>{const n=()=>e();return ipcRenderer.on("aegis:menuGoForward",n),()=>ipcRenderer.removeListener("aegis:menuGoForward",n)},setNavState:e=>invoke("setNavState",e),onMenuExportMarkdown:e=>{const n=()=>e();return ipcRenderer.on("aegis:menuExportMarkdown",n),()=>ipcRenderer.removeListener("aegis:menuExportMarkdown",n)},onMenuFingerprint:e=>{const n=()=>e();return ipcRenderer.on("aegis:menuFingerprint",n),()=>ipcRenderer.removeListener("aegis:menuFingerprint",n)},onMenuGoogleDrive:e=>{const n=()=>e();return ipcRenderer.on("aegis:menuGoogleDrive",n),()=>ipcRenderer.removeListener("aegis:menuGoogleDrive",n)},onMenuExportJson:e=>{const n=()=>e();return ipcRenderer.on("aegis:menuExportJson",n),()=>ipcRenderer.removeListener("aegis:menuExportJson",n)},exportSession:(e,n)=>invoke("exportSession",{sessionId:e,format:n}),onDeepLink:e=>{const n=(n,o)=>e(o);return ipcRenderer.on("aegis:deepLink",n),()=>ipcRenderer.removeListener("aegis:deepLink",n)},onQuickLauncherPush:e=>{const n=(n,o)=>e(o);return ipcRenderer.on("aegis:quickLauncherPush",n),()=>ipcRenderer.removeListener("aegis:quickLauncherPush",n)}},models={listClasses:()=>invokeModel("listClasses"),listModels:e=>invokeModel("listModels",{class:e}),chat:(e,n)=>{const o=e||{};if("function"!=typeof n)return invokeModel("chat",o);const i=deltaListener(o.sessionId,n),r=()=>ipcRenderer.removeListener("aegis:chatDelta",i);return ipcRenderer.on("aegis:chatDelta",i),invokeModel("chat",o).then(e=>(r(),e),e=>{throw r(),e})},settings:{get:()=>invokeModel("settings.get"),set:(e,n)=>invokeModel("settings.set",{provider:e,baseURL:n&&n.baseURL,key:n&&n.key}),remove:e=>invokeModel("settings.remove",{provider:e})},userModels:{get:()=>invokeModel("userModels.get"),add:(e,n)=>invokeModel("userModels.add",{provider:e,model:n}),remove:(e,n)=>invokeModel("userModels.remove",{provider:e,model:n}),discover:e=>invokeModel("userModels.discover",{provider:e}),addAll:(e,n)=>invokeModel("userModels.addAll",{provider:e,ids:n}),canDiscover:e=>invokeModel("userModels.canDiscover",{provider:e}),discoverable:()=>invokeModel("userModels.discoverable"),syncPlan:e=>invokeModel("userModels.syncPlan",{only:e}),syncApply:(e,n)=>invokeModel("userModels.syncApply",{plan:e,only:n}),syncStatus:()=>invokeModel("userModels.syncStatus"),syncNow:e=>invokeModel("userModels.syncNow",{only:e})},cancel:e=>invokeModel("cancel",{sessionId:e}),respondApproval:(e,n)=>invokeModel("respondApproval",{approvalId:e,decision:n}),respondRoundsAsk:(e,n)=>invokeModel("respondRoundsAsk",{roundsAskId:e,decision:n}),clearApprovals:e=>invokeModel("clearApprovals",{sessionId:e}),listUndoable:e=>invokeModel("listUndoable",{sessionId:e}),undoMutation:(e,n)=>invokeModel("undoMutation",{sessionId:e,id:n})},sync={listSessions:()=>invokeSync("listSessions"),searchSessions:(e,n)=>invokeSync("searchSessions",{query:e,limit:n}),open:e=>invokeSync("open",{sessionId:e}),save:e=>invokeSync("save",e||{}),nameSession:e=>invokeSync("nameSession",{sessionId:e&&e.sessionId,prompt:e&&e.prompt,class:e&&e.class,model:e&&e.model}),append:(e,n)=>invokeSync("append",{sessionId:e,message:n}),delete:e=>invokeSync("delete",{sessionId:e}),rename:(e,n)=>invokeSync("rename",{sessionId:e,title:n}),push:()=>invokeSync("push"),pull:()=>invokeSync("pull"),status:()=>invokeSync("status"),auto:()=>invokeSync("auto"),memoryPersistState:()=>invokeSync("memoryPersistState")},quickLauncher={status:()=>invokeQuick("status"),setConfig:e=>invokeQuick("setConfig",{enabled:e&&e.enabled,shortcut:e&&e.shortcut}),pushToMain:e=>invokeQuick("pushToMain",e||{})},queue={enqueue:e=>invokeQueue("enqueue",queueTaskFields(e)),list:()=>invokeQueue("list"),clear:e=>invokeQueue("clear",{all:Boolean(e)}),entitlement:e=>invokeQueue("entitlement",{force:Boolean(e)}),retry:e=>queueWithId("retry",e),remove:e=>queueWithId("remove",e),drain:()=>invokeQueue("drain",{}),proceed:()=>invokeQueue("proceed",{}),stop:e=>{const n=queueTaskId(e);return invokeQueue("stop",null==n?{}:{id:n})},onProgress:e=>{if("function"!=typeof e)return()=>{};const n=(n,o)=>e(o);return ipcRenderer.on("queue:progress",n),()=>ipcRenderer.removeListener("queue:progress",n)},onChanged:e=>{if("function"!=typeof e)return()=>{};const n=()=>e();return ipcRenderer.on("queue:changed",n),()=>ipcRenderer.removeListener("queue:changed",n)}},auto={status:()=>invokeAuto("autoStatus"),setDrain:e=>{const n=e||{},o={enabled:Boolean(n.enabled)};return null!=n.intervalMs&&Number.isFinite(Number(n.intervalMs))&&(o.intervalMs=Number(n.intervalMs)),invokeAuto("autoSetDrain",o)},setMint:e=>{const n=e||{};return invokeAuto("autoSetMint",{enabled:Boolean(n.enabled),publish:Boolean(n.publish)})},sealNow:e=>invokeAuto("autoSealNow",{publish:Boolean(e)})};function queueTaskId(e){const n=Number(e);return Number.isInteger(n)&&n>0?n:null}function queueWithId(e,n){const o=queueTaskId(n);return null==o?Promise.resolve({ok:!1,reason:`${e} needs a task id`}):invokeQueue(e,{id:o})}function queueTaskFields(e){const n=e||{};return{task:String(null==n.task?"":n.task),cwd:String(null==n.cwd?"":n.cwd),class:null==n.class?null:String(n.class),model:null==n.model?null:String(n.model),effort:null==n.effort?null:String(n.effort),workers:null==n.workers?null:Number(n.workers),maxRounds:null==n.maxRounds?null:Number(n.maxRounds),fanout:Boolean(n.fanout),commit:Boolean(n.commit)}}contextBridge.exposeInMainWorld("aegis",Object.freeze(api)),contextBridge.exposeInMainWorld("models",Object.freeze(models)),contextBridge.exposeInMainWorld("sync",Object.freeze(sync)),contextBridge.exposeInMainWorld("quickLauncher",Object.freeze(quickLauncher)),contextBridge.exposeInMainWorld("queue",Object.freeze(queue)),contextBridge.exposeInMainWorld("auto",Object.freeze(auto));
|