aegisone 1.0.34 → 1.0.37
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/LICENSE +661 -0
- package/README.md +1 -1
- package/SOURCE-OFFER.txt +9 -0
- package/bin/aegis.js +1 -322
- package/package.json +4 -5
- package/scripts/bump.mjs +1 -211
- package/scripts/bundle.js +1 -129
- package/scripts/predist.mjs +1 -976
- package/src/child.js +1 -285
- package/src/dispatch.js +1 -269
- package/src/doctor.js +1 -639
- package/src/host.js +1 -111
- package/src/iface/paths.js +3 -0
- package/src/iface/pty.js +3 -0
- package/src/iface/update.js +3 -0
- package/src/iface/window.js +3 -0
- package/src/permissions.js +1 -383
- package/src/probes.js +1 -159
- package/src/protocol.js +3 -0
- package/src/release.js +1 -409
- package/src/selfhost.js +3 -0
- package/vendor/cli/package.json +3 -7
- package/vendor/cli/scripts/check.mjs +1 -52
- package/vendor/cli/scripts/demo.mjs +1 -94
- package/vendor/cli/scripts/predist.mjs +1 -75
- package/vendor/cli/scripts/runtests.mjs +1 -56
- package/vendor/cli/scripts/seal-gate.mjs +1 -74
- package/vendor/cli/src/agents.js +1 -139
- package/vendor/cli/src/app.js +1 -2957
- package/vendor/cli/src/art.js +1 -289
- package/vendor/cli/src/chatflow.js +1 -3023
- package/vendor/cli/src/checkpoint.js +1 -90
- package/vendor/cli/src/clipboard.js +1 -424
- package/vendor/cli/src/cloudsync.js +1 -528
- package/vendor/cli/src/commands.js +1 -4089
- package/vendor/cli/src/config.js +1 -581
- package/vendor/cli/src/connect.js +1 -349
- package/vendor/cli/src/credentials.js +1 -33
- package/vendor/cli/src/deps.js +1 -232
- package/vendor/cli/src/devrun.js +1 -187
- package/vendor/cli/src/diff.js +1 -333
- package/vendor/cli/src/diffview.js +1 -296
- package/vendor/cli/src/engine.js +1 -297
- package/vendor/cli/src/entitlement.js +1 -355
- package/vendor/cli/src/events.js +1 -707
- package/vendor/cli/src/export.js +1 -67
- package/vendor/cli/src/filepreview.js +1 -153
- package/vendor/cli/src/fingerprint.js +1 -592
- package/vendor/cli/src/format.js +1 -259
- package/vendor/cli/src/fuzzy.js +1 -119
- package/vendor/cli/src/history.js +1 -423
- package/vendor/cli/src/init.js +1 -175
- package/vendor/cli/src/input.js +1 -139
- package/vendor/cli/src/keys.js +1 -183
- package/vendor/cli/src/markdown.js +1 -306
- package/vendor/cli/src/models.js +1 -507
- package/vendor/cli/src/naming.js +1 -57
- package/vendor/cli/src/overlays.js +1 -462
- package/vendor/cli/src/panels.js +1 -1418
- package/vendor/cli/src/ping.js +1 -226
- package/vendor/cli/src/presence.js +1 -238
- package/vendor/cli/src/render.js +1 -516
- package/vendor/cli/src/screen.js +1 -518
- package/vendor/cli/src/screens.js +1 -896
- package/vendor/cli/src/secret.js +1 -59
- package/vendor/cli/src/securefs.js +1 -359
- package/vendor/cli/src/settings.js +1 -155
- package/vendor/cli/src/shared.js +1 -52
- package/vendor/cli/src/sharedpaths.js +1 -53
- package/vendor/cli/src/signup.js +1 -156
- package/vendor/cli/src/summarize.js +1 -95
- package/vendor/cli/src/sysdiag.js +1 -585
- package/vendor/cli/src/system.js +1 -40
- package/vendor/cli/src/theme.js +1 -570
- package/vendor/cli/src/title.js +1 -220
- package/vendor/cli/src/todos.js +1 -115
- package/vendor/cli/src/tokens.js +1 -263
- package/vendor/cli/src/topup.js +1 -210
- package/vendor/cli/src/update.js +1 -191
- package/vendor/cli/vendor/client/aegis.js +1 -2441
- package/vendor/cli/vendor/client/attest.js +1 -518
- package/vendor/cli/vendor/client/authorship-key.js +1 -410
- package/vendor/cli/vendor/client/auto-provision.js +1 -134
- package/vendor/cli/vendor/client/brain-catalog.js +1 -268
- package/vendor/cli/vendor/client/byok-catalog.js +1 -199
- package/vendor/cli/vendor/client/catalog-client.js +1 -487
- package/vendor/cli/vendor/client/conversation-export.js +1 -177
- package/vendor/cli/vendor/client/credentials.js +1 -494
- package/vendor/cli/vendor/client/device-fingerprint.js +1 -141
- package/vendor/cli/vendor/client/drive-connect.js +1 -110
- package/vendor/cli/vendor/client/drive-upload.js +1 -234
- package/vendor/cli/vendor/client/env-file.js +1 -1273
- package/vendor/cli/vendor/client/fingerprint.js +1 -1064
- package/vendor/cli/vendor/client/foreign-memory.js +1 -669
- package/vendor/cli/vendor/client/google-signin.js +1 -133
- package/vendor/cli/vendor/client/hooks.js +1 -430
- package/vendor/cli/vendor/client/model-discovery.js +1 -373
- package/vendor/cli/vendor/client/naming.js +1 -283
- package/vendor/cli/vendor/client/platform.js +1 -937
- package/vendor/cli/vendor/client/prefs.js +1 -351
- package/vendor/cli/vendor/client/presence-constants.js +1 -107
- package/vendor/cli/vendor/client/presence.js +1 -438
- package/vendor/cli/vendor/client/record-vault.js +3 -1055
- package/vendor/cli/vendor/client/session-store.js +1 -575
- package/vendor/cli/vendor/client/topup.js +1 -297
- package/vendor/cli/vendor/client/touch.js +1 -458
- package/vendor/cli/vendor/client/update.js +1 -763
- package/vendor/cli/vendor/client/user-models.js +1 -381
- package/vendor/cli/vendor/desktop/lib/local/agents.js +1 -105
- package/vendor/cli/vendor/desktop/lib/local/attachments.js +1 -276
- package/vendor/cli/vendor/desktop/lib/local/autonomous.js +1 -1045
- package/vendor/cli/vendor/desktop/lib/local/claude-pro.js +1 -1028
- package/vendor/cli/vendor/desktop/lib/local/context.js +1 -125
- package/vendor/cli/vendor/desktop/lib/local/engine.js +1 -3666
- package/vendor/cli/vendor/desktop/lib/local/entitlement.js +1 -660
- package/vendor/cli/vendor/desktop/lib/local/git-scope.js +1 -228
- package/vendor/cli/vendor/desktop/lib/local/integrity.js +1 -1
- package/vendor/cli/vendor/desktop/lib/local/local.js +1 -2145
- package/vendor/cli/vendor/desktop/lib/local/prompt.js +1 -280
- package/vendor/cli/vendor/desktop/lib/local/queue.js +1 -560
- package/vendor/cli/vendor/desktop/lib/local/session-rounds.js +1 -238
- package/vendor/cli/vendor/desktop/lib/local/spill.js +1 -75
- package/vendor/cli/vendor/desktop/lib/local/turn-guard.js +1 -300
- package/vendor/cli/vendor/desktop/lib/local/worktree-lock.js +1 -235
- package/vendor/cli/vendor/desktop/lib/settings.js +1 -890
- package/vendor/cli/vendor/desktop/main.js +67 -1
- package/vendor/cli/vendor/desktop/renderer/usage.js +1 -1239
- package/vendor/cli/vendor/hosts/install.js +1 -638
- package/vendor/cli/vendor/hosts/openai-shim.js +1 -515
- package/vendor/cli/vendor/hosts/spec.js +1 -164
- package/vendor/cli/vendor/hosts/targets.js +1 -346
- package/vendor/cli/vendor/mcp/server.js +1 -221
- package/vendor/cli/vendor/mcp/tools.js +1 -408
- package/vendor/cli/vendor/one/src/child.js +1 -285
- package/vendor/cli/vendor/one/src/permissions.js +1 -383
- package/vendor/cli/vendor/one/src/selfhost.js +3 -0
- package/vendor/desktop/bin/aegis.js +1 -32
- package/vendor/desktop/lib/account-key.js +1 -56
- package/vendor/desktop/lib/auto.js +1 -461
- package/vendor/desktop/lib/avatar/companion.js +1 -698
- package/vendor/desktop/lib/avatar/cosmetics.js +1 -532
- package/vendor/desktop/lib/avatar/events.js +1 -344
- package/vendor/desktop/lib/avatar/holder-turn.js +1 -350
- package/vendor/desktop/lib/avatar/holders.js +1 -612
- package/vendor/desktop/lib/avatar/identity.js +1 -641
- package/vendor/desktop/lib/avatar/level.js +1 -368
- package/vendor/desktop/lib/avatar/mirror.js +1 -524
- package/vendor/desktop/lib/avatar/persona.js +1 -388
- package/vendor/desktop/lib/avatar/profile.js +1 -977
- package/vendor/desktop/lib/avatar/register.js +1 -307
- package/vendor/desktop/lib/avatar/store.js +1 -472
- package/vendor/desktop/lib/avatar/tiers.js +1 -38
- package/vendor/desktop/lib/avatar/transfer.js +1 -415
- package/vendor/desktop/lib/avatar/turn.js +1 -216
- package/vendor/desktop/lib/avatar/voice.js +1 -328
- package/vendor/desktop/lib/avatar/xp.js +1 -404
- package/vendor/desktop/lib/deep-link.js +1 -120
- package/vendor/desktop/lib/fingerprint.js +2 -347
- package/vendor/desktop/lib/google-connect.js +1 -323
- package/vendor/desktop/lib/local/agents.js +1 -105
- package/vendor/desktop/lib/local/attachments.js +1 -276
- package/vendor/desktop/lib/local/autonomous.js +1 -1045
- package/vendor/desktop/lib/local/claude-pro.js +1 -1028
- package/vendor/desktop/lib/local/context.js +1 -125
- package/vendor/desktop/lib/local/engine.js +1 -3666
- package/vendor/desktop/lib/local/entitlement.js +1 -660
- package/vendor/desktop/lib/local/git-scope.js +1 -228
- package/vendor/desktop/lib/local/integrity.js +1 -1
- package/vendor/desktop/lib/local/local.js +1 -2145
- package/vendor/desktop/lib/local/prompt.js +1 -280
- package/vendor/desktop/lib/local/queue.js +1 -560
- package/vendor/desktop/lib/local/session-rounds.js +1 -238
- package/vendor/desktop/lib/local/spill.js +1 -75
- package/vendor/desktop/lib/local/telemetry.js +1 -470
- package/vendor/desktop/lib/local/turn-guard.js +1 -300
- package/vendor/desktop/lib/local/worktree-lock.js +1 -235
- package/vendor/desktop/lib/provider-key-mirror.js +1 -252
- package/vendor/desktop/lib/quick-launcher.js +1 -84
- package/vendor/desktop/lib/settings.js +1 -890
- package/vendor/desktop/lib/sync/memory-queue.js +1 -60
- package/vendor/desktop/lib/sync/persist-gate.js +1 -148
- package/vendor/desktop/lib/sync/sessions.js +1 -106
- package/vendor/desktop/lib/window-state.js +1 -66
- package/vendor/desktop/main.js +67 -1
- package/vendor/desktop/package.json +3 -5
- package/vendor/desktop/preload.js +1 -679
- package/vendor/desktop/renderer/app.js +1 -7250
- package/vendor/desktop/renderer/avatar/assemble.js +1 -335
- package/vendor/desktop/renderer/avatar/avatar.js +1 -380
- package/vendor/desktop/renderer/avatar/cards.js +1 -141
- package/vendor/desktop/renderer/avatar/hud.js +1 -206
- package/vendor/desktop/renderer/avatar/machine.js +1 -213
- package/vendor/desktop/renderer/avatar/pane.js +1 -439
- package/vendor/desktop/renderer/avatar/parts.js +1 -437
- package/vendor/desktop/renderer/budget.js +1 -172
- package/vendor/desktop/renderer/companion.js +1 -223
- package/vendor/desktop/renderer/diff.js +1 -359
- package/vendor/desktop/renderer/diffview.js +1 -336
- package/vendor/desktop/renderer/filepreview.js +1 -211
- package/vendor/desktop/renderer/fingerprint.js +3 -789
- package/vendor/desktop/renderer/markdown.js +1 -168
- package/vendor/desktop/renderer/provider-mark.js +1 -311
- package/vendor/desktop/renderer/provider-toolbar.js +1 -134
- package/vendor/desktop/renderer/providers.js +1 -259
- package/vendor/desktop/renderer/quick.js +1 -285
- package/vendor/desktop/renderer/stream-policy.js +1 -387
- package/vendor/desktop/renderer/transcript-view.js +1 -323
- package/vendor/desktop/renderer/usage.js +1 -1239
- package/vendor/desktop/vendor/aegis.js +1 -2441
- package/vendor/desktop/vendor/attest.js +1 -518
- package/vendor/desktop/vendor/authorship-key.js +1 -410
- package/vendor/desktop/vendor/auto-provision.js +1 -134
- package/vendor/desktop/vendor/brain-catalog.js +1 -268
- package/vendor/desktop/vendor/byok-catalog.js +1 -199
- package/vendor/desktop/vendor/catalog-client.js +1 -487
- package/vendor/desktop/vendor/conversation-export.js +1 -177
- package/vendor/desktop/vendor/credentials.js +1 -494
- package/vendor/desktop/vendor/device-fingerprint.js +1 -141
- package/vendor/desktop/vendor/drive-connect.js +1 -110
- package/vendor/desktop/vendor/drive-upload.js +1 -234
- package/vendor/desktop/vendor/env-file.js +1 -1273
- package/vendor/desktop/vendor/faces/cli/LICENSE +661 -0
- package/vendor/desktop/vendor/faces/cli/README.md +784 -0
- package/vendor/desktop/vendor/faces/cli/bin/aegiscode.js +20 -0
- package/vendor/desktop/vendor/faces/cli/package.json +44 -0
- package/vendor/desktop/vendor/faces/cli/scripts/check.mjs +4 -0
- package/vendor/desktop/vendor/faces/cli/scripts/demo.mjs +4 -0
- package/vendor/desktop/vendor/faces/cli/scripts/predist.mjs +4 -0
- package/vendor/desktop/vendor/faces/cli/scripts/runtests.mjs +4 -0
- package/vendor/desktop/vendor/faces/cli/scripts/seal-gate.mjs +3 -0
- package/vendor/desktop/vendor/faces/cli/src/agents.js +3 -0
- package/vendor/desktop/vendor/faces/cli/src/app.js +3 -0
- package/vendor/desktop/vendor/faces/cli/src/art.js +3 -0
- package/vendor/desktop/vendor/faces/cli/src/autonomous.js +3 -0
- package/vendor/desktop/vendor/faces/cli/src/caps.js +3 -0
- package/vendor/desktop/vendor/faces/cli/src/chatflow.js +3 -0
- package/vendor/desktop/vendor/faces/cli/src/checkpoint.js +3 -0
- package/vendor/desktop/vendor/faces/cli/src/clipboard.js +3 -0
- package/vendor/desktop/vendor/faces/cli/src/cloudsync.js +3 -0
- package/vendor/desktop/vendor/faces/cli/src/commands.js +3 -0
- package/vendor/desktop/vendor/faces/cli/src/config.js +3 -0
- package/vendor/desktop/vendor/faces/cli/src/connect.js +3 -0
- package/vendor/desktop/vendor/faces/cli/src/credentials.js +3 -0
- package/vendor/desktop/vendor/faces/cli/src/deps.js +3 -0
- package/vendor/desktop/vendor/faces/cli/src/devrun.js +3 -0
- package/vendor/desktop/vendor/faces/cli/src/diff.js +3 -0
- package/vendor/desktop/vendor/faces/cli/src/diffview.js +3 -0
- package/vendor/desktop/vendor/faces/cli/src/engine.js +3 -0
- package/vendor/desktop/vendor/faces/cli/src/entitlement.js +3 -0
- package/vendor/desktop/vendor/faces/cli/src/events.js +3 -0
- package/vendor/desktop/vendor/faces/cli/src/export.js +3 -0
- package/vendor/desktop/vendor/faces/cli/src/filepreview.js +3 -0
- package/vendor/desktop/vendor/faces/cli/src/fingerprint.js +3 -0
- package/vendor/desktop/vendor/faces/cli/src/format.js +3 -0
- package/vendor/desktop/vendor/faces/cli/src/fuzzy.js +3 -0
- package/vendor/desktop/vendor/faces/cli/src/gate.js +3 -0
- package/vendor/desktop/vendor/faces/cli/src/history.js +3 -0
- package/vendor/desktop/vendor/faces/cli/src/init.js +3 -0
- package/vendor/desktop/vendor/faces/cli/src/input.js +3 -0
- package/vendor/desktop/vendor/faces/cli/src/keys.js +3 -0
- package/vendor/desktop/vendor/faces/cli/src/limits.js +3 -0
- package/vendor/desktop/vendor/faces/cli/src/markdown.js +3 -0
- package/vendor/desktop/vendor/faces/cli/src/mcp.js +3 -0
- package/vendor/desktop/vendor/faces/cli/src/models.js +3 -0
- package/vendor/desktop/vendor/faces/cli/src/naming.js +3 -0
- package/vendor/desktop/vendor/faces/cli/src/overlays.js +3 -0
- package/vendor/desktop/vendor/faces/cli/src/panels.js +3 -0
- package/vendor/desktop/vendor/faces/cli/src/permissions.js +3 -0
- package/vendor/desktop/vendor/faces/cli/src/ping.js +3 -0
- package/vendor/desktop/vendor/faces/cli/src/presence.js +3 -0
- package/vendor/desktop/vendor/faces/cli/src/provenance.js +58 -0
- package/vendor/desktop/vendor/faces/cli/src/provenance.lock.json +36 -0
- package/vendor/desktop/vendor/faces/cli/src/render.js +3 -0
- package/vendor/desktop/vendor/faces/cli/src/screen.js +3 -0
- package/vendor/desktop/vendor/faces/cli/src/screens.js +3 -0
- package/vendor/desktop/vendor/faces/cli/src/secret.js +3 -0
- package/vendor/desktop/vendor/faces/cli/src/securefs.js +3 -0
- package/vendor/desktop/vendor/faces/cli/src/settings.js +3 -0
- package/vendor/desktop/vendor/faces/cli/src/shared.js +3 -0
- package/vendor/desktop/vendor/faces/cli/src/sharedpaths.js +3 -0
- package/vendor/desktop/vendor/faces/cli/src/signup.js +3 -0
- package/vendor/desktop/vendor/faces/cli/src/summarize.js +3 -0
- package/vendor/desktop/vendor/faces/cli/src/sysdiag.js +3 -0
- package/vendor/desktop/vendor/faces/cli/src/system.js +3 -0
- package/vendor/desktop/vendor/faces/cli/src/theme.js +3 -0
- package/vendor/desktop/vendor/faces/cli/src/title.js +3 -0
- package/vendor/desktop/vendor/faces/cli/src/todos.js +3 -0
- package/vendor/desktop/vendor/faces/cli/src/tokens.js +3 -0
- package/vendor/desktop/vendor/faces/cli/src/topup.js +3 -0
- package/vendor/desktop/vendor/faces/cli/src/update.js +3 -0
- package/vendor/desktop/vendor/faces/cli/vendor/client/aegis.js +4 -0
- package/vendor/desktop/vendor/faces/cli/vendor/client/attest.js +3 -0
- package/vendor/desktop/vendor/faces/cli/vendor/client/authorship-key.js +3 -0
- package/vendor/desktop/vendor/faces/cli/vendor/client/auto-provision.js +3 -0
- package/vendor/desktop/vendor/faces/cli/vendor/client/brain-catalog.js +3 -0
- package/vendor/desktop/vendor/faces/cli/vendor/client/byok-catalog.js +3 -0
- package/vendor/desktop/vendor/faces/cli/vendor/client/catalog-client.js +3 -0
- package/vendor/desktop/vendor/faces/cli/vendor/client/conversation-export.js +3 -0
- package/vendor/desktop/vendor/faces/cli/vendor/client/credentials.js +3 -0
- package/vendor/desktop/vendor/faces/cli/vendor/client/device-fingerprint.js +3 -0
- package/vendor/desktop/vendor/faces/cli/vendor/client/drive-connect.js +3 -0
- package/vendor/desktop/vendor/faces/cli/vendor/client/drive-upload.js +3 -0
- package/vendor/desktop/vendor/faces/cli/vendor/client/env-file.js +3 -0
- package/vendor/desktop/vendor/faces/cli/vendor/client/fingerprint.js +3 -0
- package/vendor/desktop/vendor/faces/cli/vendor/client/foreign-memory.js +3 -0
- package/vendor/desktop/vendor/faces/cli/vendor/client/google-signin.js +3 -0
- package/vendor/desktop/vendor/faces/cli/vendor/client/hooks.js +3 -0
- package/vendor/desktop/vendor/faces/cli/vendor/client/model-discovery.js +3 -0
- package/vendor/desktop/vendor/faces/cli/vendor/client/naming.js +3 -0
- package/vendor/desktop/vendor/faces/cli/vendor/client/platform.js +3 -0
- package/vendor/desktop/vendor/faces/cli/vendor/client/prefs.js +3 -0
- package/vendor/desktop/vendor/faces/cli/vendor/client/presence-constants.js +3 -0
- package/vendor/desktop/vendor/faces/cli/vendor/client/presence.js +3 -0
- package/vendor/desktop/vendor/faces/cli/vendor/client/record-vault.js +105 -0
- package/vendor/desktop/vendor/faces/cli/vendor/client/session-store.js +3 -0
- package/vendor/desktop/vendor/faces/cli/vendor/client/topup.js +3 -0
- package/vendor/desktop/vendor/faces/cli/vendor/client/touch.js +3 -0
- package/vendor/desktop/vendor/faces/cli/vendor/client/update.js +3 -0
- package/vendor/desktop/vendor/faces/cli/vendor/client/user-models.js +3 -0
- package/vendor/desktop/vendor/faces/cli/vendor/covenant/README.md +21 -0
- package/vendor/desktop/vendor/faces/cli/vendor/covenant/aegis.seal +177 -0
- package/vendor/desktop/vendor/faces/cli/vendor/desktop/lib/local/aegis-seal.mjs +241 -0
- package/vendor/desktop/vendor/faces/cli/vendor/desktop/lib/local/agents.js +3 -0
- package/vendor/desktop/vendor/faces/cli/vendor/desktop/lib/local/attachments.js +3 -0
- package/vendor/desktop/vendor/faces/cli/vendor/desktop/lib/local/autonomous.js +3 -0
- package/vendor/desktop/vendor/faces/cli/vendor/desktop/lib/local/claude-pro.js +3 -0
- package/vendor/desktop/vendor/faces/cli/vendor/desktop/lib/local/context.js +3 -0
- package/vendor/desktop/vendor/faces/cli/vendor/desktop/lib/local/covenant.js +567 -0
- package/vendor/desktop/vendor/faces/cli/vendor/desktop/lib/local/engine.js +3 -0
- package/vendor/desktop/vendor/faces/cli/vendor/desktop/lib/local/entitlement.js +3 -0
- package/vendor/desktop/vendor/faces/cli/vendor/desktop/lib/local/exec-plan.js +3 -0
- package/vendor/desktop/vendor/faces/cli/vendor/desktop/lib/local/git-scope.js +3 -0
- package/vendor/desktop/vendor/faces/cli/vendor/desktop/lib/local/integrity.js +3 -0
- package/vendor/desktop/vendor/faces/cli/vendor/desktop/lib/local/local.js +3 -0
- package/vendor/desktop/vendor/faces/cli/vendor/desktop/lib/local/prompt.js +3 -0
- package/vendor/desktop/vendor/faces/cli/vendor/desktop/lib/local/queue.js +3 -0
- package/vendor/desktop/vendor/faces/cli/vendor/desktop/lib/local/session-rounds.js +3 -0
- package/vendor/desktop/vendor/faces/cli/vendor/desktop/lib/local/shell.js +3 -0
- package/vendor/desktop/vendor/faces/cli/vendor/desktop/lib/local/spill.js +3 -0
- package/vendor/desktop/vendor/faces/cli/vendor/desktop/lib/local/tools.js +3 -0
- package/vendor/desktop/vendor/faces/cli/vendor/desktop/lib/local/turn-guard.js +3 -0
- package/vendor/desktop/vendor/faces/cli/vendor/desktop/lib/local/worktree-lock.js +3 -0
- package/vendor/desktop/vendor/faces/cli/vendor/desktop/lib/settings.js +3 -0
- package/vendor/desktop/vendor/faces/cli/vendor/desktop/main.js +4 -0
- package/vendor/desktop/vendor/faces/cli/vendor/desktop/renderer/usage.js +3 -0
- package/vendor/desktop/vendor/faces/cli/vendor/hosts/install.js +1 -0
- package/vendor/desktop/vendor/faces/cli/vendor/hosts/openai-shim.js +2 -0
- package/vendor/desktop/vendor/faces/cli/vendor/hosts/spec.js +1 -0
- package/vendor/desktop/vendor/faces/cli/vendor/hosts/targets.js +1 -0
- package/vendor/desktop/vendor/faces/cli/vendor/mcp/server.js +4 -0
- package/vendor/desktop/vendor/faces/cli/vendor/mcp/tools.js +3 -0
- package/vendor/desktop/vendor/faces/cli/vendor/one/src/child.js +3 -0
- package/vendor/desktop/vendor/faces/cli/vendor/one/src/permissions.js +3 -0
- package/vendor/desktop/vendor/faces/cli/vendor/one/src/selfhost.js +3 -0
- package/vendor/desktop/vendor/faces/cli/vendor/tools/agent-gate.mjs +1203 -0
- package/vendor/desktop/vendor/fingerprint.js +1 -1064
- package/vendor/desktop/vendor/foreign-memory.js +1 -669
- package/vendor/desktop/vendor/google-signin.js +1 -133
- package/vendor/desktop/vendor/hooks.js +1 -430
- package/vendor/desktop/vendor/model-discovery.js +1 -373
- package/vendor/desktop/vendor/naming.js +1 -283
- package/vendor/desktop/vendor/platform.js +1 -937
- package/vendor/desktop/vendor/prefs.js +1 -351
- package/vendor/desktop/vendor/presence-constants.js +1 -107
- package/vendor/desktop/vendor/presence.js +1 -438
- package/vendor/desktop/vendor/record-vault.js +3 -1055
- package/vendor/desktop/vendor/selfhost.js +3 -0
- package/vendor/desktop/vendor/session-store.js +1 -575
- package/vendor/desktop/vendor/topup.js +1 -297
- package/vendor/desktop/vendor/touch.js +1 -458
- package/vendor/desktop/vendor/update.js +1 -763
- package/vendor/desktop/vendor/user-models.js +1 -381
|
@@ -1,337 +1,3 @@
|
|
|
1
1
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
2
2
|
// Copyright (C) 2026 Niklas Borneklint — AEGIS Code (aegiscode) / Aegiscloud.
|
|
3
|
-
|
|
4
|
-
// Conveying a modified copy, or running one as a network service, owes the
|
|
5
|
-
// corresponding source under this licence (§5/§13) — see LICENSING.md.
|
|
6
|
-
'use strict';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* assemble.js — persona JSON in, layered SVG out.
|
|
10
|
-
*
|
|
11
|
-
* A pure string builder. It takes a validated persona record plus one
|
|
12
|
-
* expression id and returns the markup, the layer list it walked, and — the
|
|
13
|
-
* part that matters — a `warnings`/`missing` pair. Three rules:
|
|
14
|
-
*
|
|
15
|
-
* 1. **Never blank, never throw.** An id the manifest does not know (a persona
|
|
16
|
-
* hand-edited, or written by a newer release) renders the default part and
|
|
17
|
-
* is REPORTED. `persona.js` made the same choice at the storage boundary
|
|
18
|
-
* for the same reason: the user's own file must not be able to take the
|
|
19
|
-
* companion's face away.
|
|
20
|
-
*
|
|
21
|
-
* 2. **No interpolation of user text.** Nothing the user typed is placed in
|
|
22
|
-
* the markup, so there is no escaping question and no injection surface:
|
|
23
|
-
* the only persona-supplied value that reaches the SVG is `hairColor`, and
|
|
24
|
-
* it is re-checked against `#rrggbb` here even though `persona.js` already
|
|
25
|
-
* checked it. Geometry comes from the manifest, which is code.
|
|
26
|
-
*
|
|
27
|
-
* 3. **No styles, no scripts, no references.** The output carries no `<style>`,
|
|
28
|
-
* no `on*` attribute and no `href`/`url(...)`: motion lives in avatar.css,
|
|
29
|
-
* keyed off the `data-motion` attribute this file sets. That keeps the
|
|
30
|
-
* renderer's CSP (`script-src 'self'; style-src 'self'`) satisfied by
|
|
31
|
-
* construction, and `desktop/test/avatar-render.test.mjs` asserts all four
|
|
32
|
-
* absences rather than trusting this paragraph.
|
|
33
|
-
*
|
|
34
|
-
* Pure: no DOM, no Electron. It runs identically under `node --test` and in the
|
|
35
|
-
* renderer, which is what makes the whole phase testable.
|
|
36
|
-
*/
|
|
37
|
-
|
|
38
|
-
'use strict';
|
|
39
|
-
|
|
40
|
-
const pkg = typeof window !== 'undefined' && window.AegisAvatarParts
|
|
41
|
-
? window.AegisAvatarParts
|
|
42
|
-
: typeof module !== 'undefined' && module.exports
|
|
43
|
-
? require('./parts.js')
|
|
44
|
-
: null;
|
|
45
|
-
|
|
46
|
-
if (!pkg) throw new Error('avatar/assemble.js: avatar/parts.js must be loaded first');
|
|
47
|
-
|
|
48
|
-
const HEX = /^#[0-9a-f]{6}$/i;
|
|
49
|
-
|
|
50
|
-
/** Lighten (`amount > 0`) or darken (`amount < 0`) a `#rrggbb` colour. */
|
|
51
|
-
function shade(hex, amount) {
|
|
52
|
-
const m = HEX.exec(String(hex || ''));
|
|
53
|
-
if (!m) return hex;
|
|
54
|
-
const n = parseInt(m[0].slice(1), 16);
|
|
55
|
-
const target = amount < 0 ? 0 : 255;
|
|
56
|
-
const k = Math.min(1, Math.abs(amount));
|
|
57
|
-
const mix = (c) => Math.round(c * (1 - k) + target * k);
|
|
58
|
-
const r = mix((n >> 16) & 255);
|
|
59
|
-
const g = mix((n >> 8) & 255);
|
|
60
|
-
const b = mix(n & 255);
|
|
61
|
-
return `#${((r << 16) | (g << 8) | b).toString(16).padStart(6, '0')}`;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
/** Walk a flat list of shape specs, keeping only the ones with geometry. */
|
|
65
|
-
function shapesOf(list) {
|
|
66
|
-
return Array.isArray(list) ? list.filter((s) => s && typeof s === 'object') : [];
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
/** A path string from an expression is geometry — normalise it to a shape. */
|
|
70
|
-
function asStrokes(value) {
|
|
71
|
-
if (typeof value === 'string' && value.trim()) return [{ kind: 'path', d: value, stroke: true }];
|
|
72
|
-
if (!Array.isArray(value)) return [];
|
|
73
|
-
return value
|
|
74
|
-
.map((v) => (typeof v === 'string' ? { kind: 'path', d: v, stroke: true } : v))
|
|
75
|
-
.filter((s) => s && typeof s === 'object');
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
function call(fn, ...args) {
|
|
79
|
-
return typeof fn === 'function' ? fn(...args) : undefined;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* Resolve a custom expression from `persona.expressions.custom`.
|
|
84
|
-
*
|
|
85
|
-
* A custom expression is DATA too: `{ mouth, brows, eyes }` where `mouth` is an
|
|
86
|
-
* SVG path, `brows` is a path or a list of paths, and `eyes` names one of the
|
|
87
|
-
* manifest's eye overrides. Anything unrecognised is dropped with a warning, so
|
|
88
|
-
* a half-written custom expression renders the core face rather than nothing.
|
|
89
|
-
*/
|
|
90
|
-
function customExpression(persona, id, warnings) {
|
|
91
|
-
const custom = persona && persona.expressions && persona.expressions.custom;
|
|
92
|
-
const record = custom && typeof custom === 'object' ? custom[id] : null;
|
|
93
|
-
if (!record || typeof record !== 'object') return null;
|
|
94
|
-
const out = { label: id, custom: true };
|
|
95
|
-
if (typeof record.mouth === 'string' && record.mouth.trim()) out.mouth = record.mouth.trim();
|
|
96
|
-
if (record.brows !== undefined) out.brows = asStrokes(record.brows).map((s) => s.d);
|
|
97
|
-
if (record.eyes !== undefined) {
|
|
98
|
-
if (typeof record.eyes === 'string' && pkg.EYE_OVERRIDES[record.eyes]) out.eyes = record.eyes;
|
|
99
|
-
else warnings.push(`custom expression ${id}: unknown eye override ${JSON.stringify(record.eyes)} — ignored`);
|
|
100
|
-
}
|
|
101
|
-
if (out.mouth === undefined && out.brows === undefined && out.eyes === undefined) {
|
|
102
|
-
warnings.push(`custom expression ${id} carries no drawable geometry — ignored`);
|
|
103
|
-
return null;
|
|
104
|
-
}
|
|
105
|
-
return out;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
* Assemble the avatar.
|
|
110
|
-
*
|
|
111
|
-
* @param {object} persona a persona record (validated or raw — both survive)
|
|
112
|
-
* @param {object} [opts]
|
|
113
|
-
* @param {string} [opts.expression] an `events.js` expression id
|
|
114
|
-
* @param {boolean} [opts.reducedMotion] the OS preference; forces `minimal`
|
|
115
|
-
* @param {string} [opts.motion] explicit override, mostly for tests
|
|
116
|
-
* @returns {{ svg: string, layers: object[], warnings: string[], missing: string[],
|
|
117
|
-
* expression: string, palette: string, frame: string, motion: string }}
|
|
118
|
-
*/
|
|
119
|
-
function assemble(persona, opts = {}) {
|
|
120
|
-
const warnings = [];
|
|
121
|
-
const missing = [];
|
|
122
|
-
const p = persona && typeof persona === 'object' ? persona : pkg.defaultPersona();
|
|
123
|
-
const presentation = p.presentation && typeof p.presentation === 'object' ? p.presentation : {};
|
|
124
|
-
const appearance = p.appearance && typeof p.appearance === 'object' ? p.appearance : {};
|
|
125
|
-
|
|
126
|
-
// ---- palette / skin / hair colour --------------------------------------
|
|
127
|
-
const paletteId = pkg.PALETTES[presentation.palette] ? presentation.palette : 'amber';
|
|
128
|
-
if (presentation.palette !== undefined && paletteId !== presentation.palette) {
|
|
129
|
-
warnings.push(`unknown palette ${JSON.stringify(presentation.palette)} — using ${paletteId}`);
|
|
130
|
-
}
|
|
131
|
-
const palette = pkg.PALETTES[paletteId];
|
|
132
|
-
const skin = Number.isInteger(presentation.skin) && presentation.skin >= 0 && presentation.skin < pkg.SKIN_TONES.length
|
|
133
|
-
? presentation.skin
|
|
134
|
-
: 2;
|
|
135
|
-
const skinTone = pkg.SKIN_TONES[skin];
|
|
136
|
-
const hairColor = HEX.test(String(presentation.hairColor || '')) ? String(presentation.hairColor) : '#3b2a20';
|
|
137
|
-
|
|
138
|
-
function colorFor(role) {
|
|
139
|
-
switch (role) {
|
|
140
|
-
case 'skin': return skinTone;
|
|
141
|
-
case 'skinShade': return shade(skinTone, -0.18);
|
|
142
|
-
case 'hair': return hairColor;
|
|
143
|
-
case 'hairShade': return shade(hairColor, -0.25);
|
|
144
|
-
case 'cloth': return palette.cloth;
|
|
145
|
-
case 'clothShade': return palette.clothShade;
|
|
146
|
-
case 'accent': return palette.accent;
|
|
147
|
-
case 'metal': return palette.metal;
|
|
148
|
-
case 'bg': return palette.bg;
|
|
149
|
-
case 'ink': return palette.ink;
|
|
150
|
-
case 'sclera': return '#fdfbf7';
|
|
151
|
-
case 'highlight': return '#ffffff';
|
|
152
|
-
default: return palette.ink;
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
// ---- parts -------------------------------------------------------------
|
|
157
|
-
function part(table, kind, id, fallback) {
|
|
158
|
-
const got = table[id];
|
|
159
|
-
if (got) return got;
|
|
160
|
-
if (id !== undefined && id !== null && id !== '') {
|
|
161
|
-
missing.push(`${kind}:${id}`);
|
|
162
|
-
warnings.push(`unknown ${kind} ${JSON.stringify(id)} — using ${fallback}`);
|
|
163
|
-
}
|
|
164
|
-
return table[fallback];
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
const frameId = pkg.FRAMES[presentation.frame] ? presentation.frame : 'A';
|
|
168
|
-
const frame = pkg.FRAMES[frameId];
|
|
169
|
-
const hair = part(pkg.HAIR, 'hair', presentation.hair, 'bob-2');
|
|
170
|
-
const eyes = part(pkg.EYES, 'eyes', presentation.eyes, 'soft');
|
|
171
|
-
|
|
172
|
-
const outfitIds = [];
|
|
173
|
-
for (const item of Array.isArray(presentation.outfit) ? presentation.outfit : []) {
|
|
174
|
-
if (pkg.OUTFITS[item]) outfitIds.push(item);
|
|
175
|
-
else missing.push(`outfit:${item}`);
|
|
176
|
-
}
|
|
177
|
-
if (!outfitIds.length && Array.isArray(presentation.outfit) && presentation.outfit.length) {
|
|
178
|
-
warnings.push('no known outfit layer — wearing the plain tee');
|
|
179
|
-
}
|
|
180
|
-
const outfits = outfitIds.slice(0, 3).map((id) => pkg.OUTFITS[id]);
|
|
181
|
-
|
|
182
|
-
// ---- expression --------------------------------------------------------
|
|
183
|
-
const requested = typeof opts.expression === 'string' && opts.expression ? opts.expression : 'neutral';
|
|
184
|
-
let expression = pkg.EXPRESSIONS[requested];
|
|
185
|
-
let expressionId = requested;
|
|
186
|
-
if (!expression) {
|
|
187
|
-
const custom = customExpression(p, requested, warnings);
|
|
188
|
-
if (custom) {
|
|
189
|
-
expression = custom;
|
|
190
|
-
} else {
|
|
191
|
-
if (requested !== 'neutral') {
|
|
192
|
-
missing.push(`expression:${requested}`);
|
|
193
|
-
warnings.push(`unknown expression ${JSON.stringify(requested)} — using neutral`);
|
|
194
|
-
}
|
|
195
|
-
expression = pkg.EXPRESSIONS.neutral;
|
|
196
|
-
expressionId = 'neutral';
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
const eyeOverride = expression.eyes && pkg.EYE_OVERRIDES[expression.eyes] ? pkg.EYE_OVERRIDES[expression.eyes] : null;
|
|
201
|
-
const browShapes = Array.isArray(expression.brows)
|
|
202
|
-
? asStrokes(expression.brows)
|
|
203
|
-
: asStrokes(expression.brows);
|
|
204
|
-
const mouthShapes = asStrokes(expression.mouth);
|
|
205
|
-
|
|
206
|
-
const sheet = {
|
|
207
|
-
shadow: [{ kind: 'ellipse', cx: 100, cy: 254, rx: 62, ry: 10, role: 'clothShade', opacity: 0.5 }],
|
|
208
|
-
hairBack: shapesOf(hair.back),
|
|
209
|
-
body: [
|
|
210
|
-
{ kind: 'path', d: pkg.BODY.neck, role: 'skinShade' },
|
|
211
|
-
{ kind: 'path', d: pkg.BODY.shirt, role: 'cloth' },
|
|
212
|
-
{ kind: 'path', d: pkg.BODY.sleeveL, role: 'cloth' },
|
|
213
|
-
{ kind: 'path', d: pkg.BODY.sleeveR, role: 'cloth' },
|
|
214
|
-
],
|
|
215
|
-
outfitUnder: [],
|
|
216
|
-
head: [
|
|
217
|
-
{ kind: 'path', d: frame.head, role: 'skin' },
|
|
218
|
-
...frame.ear.map((e) => ({ kind: 'circle', cx: e.cx, cy: e.cy, r: e.r, role: 'skin' })),
|
|
219
|
-
],
|
|
220
|
-
face: [
|
|
221
|
-
...(eyeOverride
|
|
222
|
-
? eyeOverride.map((s) => ({ ...s, stroke: true }))
|
|
223
|
-
: [...eyes.left, ...eyes.right]),
|
|
224
|
-
...browShapes,
|
|
225
|
-
...shapesOf(pkg.FACE.nose),
|
|
226
|
-
...mouthShapes,
|
|
227
|
-
],
|
|
228
|
-
hairFront: [...shapesOf(hair.front), ...shapesOf(hair.detail)],
|
|
229
|
-
outfitOver: [],
|
|
230
|
-
accessory: [],
|
|
231
|
-
effect: [],
|
|
232
|
-
};
|
|
233
|
-
|
|
234
|
-
// Outfit layers draw in the order the persona listed them: the last one is
|
|
235
|
-
// the outermost. Items flagged `accessory` (headphones, glasses) go on top of
|
|
236
|
-
// the hair instead of into the clothes pile.
|
|
237
|
-
const under = sheet.outfitUnder;
|
|
238
|
-
for (const item of outfits) {
|
|
239
|
-
under.push(...shapesOf(item.under).map((s) => ({ ...s, defaultRole: 'cloth' })));
|
|
240
|
-
const overShapes = shapesOf(item.over).map((s) => ({ ...s, defaultRole: 'cloth' }));
|
|
241
|
-
if (item.accessory) sheet.accessory.push(...overShapes);
|
|
242
|
-
else sheet.outfitOver.push(...overShapes);
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
// A celebrating face gets a few sparks — motion-gated in CSS, and the only
|
|
246
|
-
// thing on the `effect` layer.
|
|
247
|
-
if (expressionId === 'happy' || expressionId === 'playful' || expressionId === 'delighted') {
|
|
248
|
-
sheet.effect.push(
|
|
249
|
-
{ kind: 'path', d: 'M28 66 l4 10 l10 4 l-10 4 l-4 10 l-4 -10 l-10 -4 l10 -4 Z', role: 'accent', opacity: 0.9 },
|
|
250
|
-
{ kind: 'path', d: 'M172 88 l3 8 l8 3 l-8 3 l-3 8 l-3 -8 l-8 -3 l8 -3 Z', role: 'accent', opacity: 0.7 }
|
|
251
|
-
);
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
// ---- markup ------------------------------------------------------------
|
|
255
|
-
/** Per-layer default fill role, so a manifest entry rarely repeats itself. */
|
|
256
|
-
const layerDefaultRole = {
|
|
257
|
-
shadow: 'clothShade',
|
|
258
|
-
hairBack: 'hair',
|
|
259
|
-
body: 'cloth',
|
|
260
|
-
outfitUnder: 'cloth',
|
|
261
|
-
head: 'skin',
|
|
262
|
-
face: 'ink',
|
|
263
|
-
hairFront: 'hair',
|
|
264
|
-
outfitOver: 'cloth',
|
|
265
|
-
accessory: 'metal',
|
|
266
|
-
effect: 'accent',
|
|
267
|
-
};
|
|
268
|
-
|
|
269
|
-
function renderShape(shape, layer) {
|
|
270
|
-
const role = shape.role || shape.defaultRole || layerDefaultRole[layer] || 'ink';
|
|
271
|
-
const fill = colorFor(role);
|
|
272
|
-
const common = [];
|
|
273
|
-
if (shape.stroke) {
|
|
274
|
-
common.push('fill="none"', `stroke="${fill}"`, 'stroke-width="3.5"', 'stroke-linecap="round"', 'stroke-linejoin="round"');
|
|
275
|
-
} else {
|
|
276
|
-
common.push(`fill="${fill}"`);
|
|
277
|
-
}
|
|
278
|
-
if (typeof shape.opacity === 'number') common.push(`opacity="${shape.opacity}"`);
|
|
279
|
-
|
|
280
|
-
switch (shape.kind) {
|
|
281
|
-
case 'circle':
|
|
282
|
-
return `<circle cx="${shape.cx}" cy="${shape.cy}" r="${shape.r}" ${common.join(' ')}/>`;
|
|
283
|
-
case 'ellipse':
|
|
284
|
-
return `<ellipse cx="${shape.cx}" cy="${shape.cy}" rx="${shape.rx}" ry="${shape.ry}" ${common.join(' ')}/>`;
|
|
285
|
-
case 'rect': {
|
|
286
|
-
const rx = shape.rx === undefined ? 0 : shape.rx;
|
|
287
|
-
return `<rect x="${shape.x}" y="${shape.y}" width="${shape.width}" height="${shape.height}" rx="${rx}" ${common.join(' ')}/>`;
|
|
288
|
-
}
|
|
289
|
-
case 'path':
|
|
290
|
-
default:
|
|
291
|
-
return `<path d="${shape.d}" ${common.join(' ')}/>`;
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
const motion = opts.motion
|
|
296
|
-
? String(opts.motion)
|
|
297
|
-
: pkg.motionFor(p, Boolean(opts.reducedMotion));
|
|
298
|
-
const size = ['small', 'medium', 'large'].includes(appearance.size) ? appearance.size : 'medium';
|
|
299
|
-
|
|
300
|
-
const layers = [];
|
|
301
|
-
const groups = [];
|
|
302
|
-
for (const name of pkg.LAYERS) {
|
|
303
|
-
const shapes = sheet[name] || [];
|
|
304
|
-
layers.push({ name, shapes: shapes.length });
|
|
305
|
-
if (!shapes.length) continue;
|
|
306
|
-
const body = shapes.map((s) => renderShape(s, name)).join('');
|
|
307
|
-
groups.push(`<g class="avatar-layer avatar-${name}" data-layer="${name}">${body}</g>`);
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
const svg =
|
|
311
|
-
`<svg class="avatar-svg" viewBox="0 0 200 268" xmlns="http://www.w3.org/2000/svg" ` +
|
|
312
|
-
`aria-hidden="true" focusable="false" role="presentation" ` +
|
|
313
|
-
`data-motion="${motion}" data-size="${size}" data-frame="${frameId}" ` +
|
|
314
|
-
`data-palette="${paletteId}" data-expression="${expressionId}">` +
|
|
315
|
-
`<rect class="avatar-bg" x="0" y="0" width="200" height="268" rx="24" fill="${colorFor('bg')}"/>` +
|
|
316
|
-
groups.join('') +
|
|
317
|
-
'</svg>';
|
|
318
|
-
|
|
319
|
-
return {
|
|
320
|
-
svg,
|
|
321
|
-
layers,
|
|
322
|
-
warnings,
|
|
323
|
-
missing,
|
|
324
|
-
expression: expressionId,
|
|
325
|
-
expressionLabel: expression.label || expressionId,
|
|
326
|
-
palette: paletteId,
|
|
327
|
-
frame: frameId,
|
|
328
|
-
hair: hair === pkg.HAIR[presentation.hair] ? presentation.hair : 'bob-2',
|
|
329
|
-
motion,
|
|
330
|
-
size,
|
|
331
|
-
};
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
const API = Object.freeze({ assemble, shade });
|
|
335
|
-
|
|
336
|
-
if (typeof module !== 'undefined' && module.exports) module.exports = API;
|
|
337
|
-
else if (typeof globalThis !== 'undefined') globalThis.AegisAvatarAssemble = API;
|
|
3
|
+
"use strict";const pkg="undefined"!=typeof window&&window.AegisAvatarParts?window.AegisAvatarParts:"undefined"!=typeof module&&module.exports?require("./parts.js"):null;if(!pkg)throw new Error("avatar/assemble.js: avatar/parts.js must be loaded first");const HEX=/^#[0-9a-f]{6}$/i;function shade(e,t){const r=HEX.exec(String(e||""));if(!r)return e;const s=parseInt(r[0].slice(1),16),o=t<0?0:255,a=Math.min(1,Math.abs(t)),n=e=>Math.round(e*(1-a)+o*a);return`#${(n(s>>16&255)<<16|n(s>>8&255)<<8|n(255&s)).toString(16).padStart(6,"0")}`}function shapesOf(e){return Array.isArray(e)?e.filter((e=>e&&"object"==typeof e)):[]}function asStrokes(e){return"string"==typeof e&&e.trim()?[{kind:"path",d:e,stroke:!0}]:Array.isArray(e)?e.map((e=>"string"==typeof e?{kind:"path",d:e,stroke:!0}:e)).filter((e=>e&&"object"==typeof e)):[]}function call(e,...t){return"function"==typeof e?e(...t):void 0}function customExpression(e,t,r){const s=e&&e.expressions&&e.expressions.custom,o=s&&"object"==typeof s?s[t]:null;if(!o||"object"!=typeof o)return null;const a={label:t,custom:!0};return"string"==typeof o.mouth&&o.mouth.trim()&&(a.mouth=o.mouth.trim()),void 0!==o.brows&&(a.brows=asStrokes(o.brows).map((e=>e.d))),void 0!==o.eyes&&("string"==typeof o.eyes&&pkg.EYE_OVERRIDES[o.eyes]?a.eyes=o.eyes:r.push(`custom expression ${t}: unknown eye override ${JSON.stringify(o.eyes)} — ignored`)),void 0===a.mouth&&void 0===a.brows&&void 0===a.eyes?(r.push(`custom expression ${t} carries no drawable geometry — ignored`),null):a}function assemble(e,t={}){const r=[],s=[],o=e&&"object"==typeof e?e:pkg.defaultPersona(),a=o.presentation&&"object"==typeof o.presentation?o.presentation:{},n=o.appearance&&"object"==typeof o.appearance?o.appearance:{},i=pkg.PALETTES[a.palette]?a.palette:"amber";void 0!==a.palette&&i!==a.palette&&r.push(`unknown palette ${JSON.stringify(a.palette)} — using ${i}`);const l=pkg.PALETTES[i],c=Number.isInteger(a.skin)&&a.skin>=0&&a.skin<pkg.SKIN_TONES.length?a.skin:2,p=pkg.SKIN_TONES[c],u=HEX.test(String(a.hairColor||""))?String(a.hairColor):"#3b2a20";function h(e){switch(e){case"skin":return p;case"skinShade":return shade(p,-.18);case"hair":return u;case"hairShade":return shade(u,-.25);case"cloth":return l.cloth;case"clothShade":return l.clothShade;case"accent":return l.accent;case"metal":return l.metal;case"bg":return l.bg;case"ink":default:return l.ink;case"sclera":return"#fdfbf7";case"highlight":return"#ffffff"}}function d(e,t,o,a){return e[o]||(null!=o&&""!==o&&(s.push(`${t}:${o}`),r.push(`unknown ${t} ${JSON.stringify(o)} — using ${a}`)),e[a])}const f=pkg.FRAMES[a.frame]?a.frame:"A",g=pkg.FRAMES[f],y=d(pkg.HAIR,"hair",a.hair,"bob-2"),k=d(pkg.EYES,"eyes",a.eyes,"soft"),m=[];for(const e of Array.isArray(a.outfit)?a.outfit:[])pkg.OUTFITS[e]?m.push(e):s.push(`outfit:${e}`);!m.length&&Array.isArray(a.outfit)&&a.outfit.length&&r.push("no known outfit layer — wearing the plain tee");const b=m.slice(0,3).map((e=>pkg.OUTFITS[e])),$="string"==typeof t.expression&&t.expression?t.expression:"neutral";let S=pkg.EXPRESSIONS[$],x=$;if(!S){const e=customExpression(o,$,r);e?S=e:("neutral"!==$&&(s.push(`expression:${$}`),r.push(`unknown expression ${JSON.stringify($)} — using neutral`)),S=pkg.EXPRESSIONS.neutral,x="neutral")}const w=S.eyes&&pkg.EYE_OVERRIDES[S.eyes]?pkg.EYE_OVERRIDES[S.eyes]:null,E=(Array.isArray(S.brows),asStrokes(S.brows)),v=asStrokes(S.mouth),A={shadow:[{kind:"ellipse",cx:100,cy:254,rx:62,ry:10,role:"clothShade",opacity:.5}],hairBack:shapesOf(y.back),body:[{kind:"path",d:pkg.BODY.neck,role:"skinShade"},{kind:"path",d:pkg.BODY.shirt,role:"cloth"},{kind:"path",d:pkg.BODY.sleeveL,role:"cloth"},{kind:"path",d:pkg.BODY.sleeveR,role:"cloth"}],outfitUnder:[],head:[{kind:"path",d:g.head,role:"skin"},...g.ear.map((e=>({kind:"circle",cx:e.cx,cy:e.cy,r:e.r,role:"skin"})))],face:[...w?w.map((e=>({...e,stroke:!0}))):[...k.left,...k.right],...E,...shapesOf(pkg.FACE.nose),...v],hairFront:[...shapesOf(y.front),...shapesOf(y.detail)],outfitOver:[],accessory:[],effect:[]},O=A.outfitUnder;for(const e of b){O.push(...shapesOf(e.under).map((e=>({...e,defaultRole:"cloth"}))));const t=shapesOf(e.over).map((e=>({...e,defaultRole:"cloth"})));e.accessory?A.accessory.push(...t):A.outfitOver.push(...t)}"happy"!==x&&"playful"!==x&&"delighted"!==x||A.effect.push({kind:"path",d:"M28 66 l4 10 l10 4 l-10 4 l-4 10 l-4 -10 l-10 -4 l10 -4 Z",role:"accent",opacity:.9},{kind:"path",d:"M172 88 l3 8 l8 3 l-8 3 l-3 8 l-3 -8 l-8 -3 l8 -3 Z",role:"accent",opacity:.7});const j={shadow:"clothShade",hairBack:"hair",body:"cloth",outfitUnder:"cloth",head:"skin",face:"ink",hairFront:"hair",outfitOver:"cloth",accessory:"metal",effect:"accent"};function R(e,t){const r=h(e.role||e.defaultRole||j[t]||"ink"),s=[];switch(e.stroke?s.push('fill="none"',`stroke="${r}"`,'stroke-width="3.5"','stroke-linecap="round"','stroke-linejoin="round"'):s.push(`fill="${r}"`),"number"==typeof e.opacity&&s.push(`opacity="${e.opacity}"`),e.kind){case"circle":return`<circle cx="${e.cx}" cy="${e.cy}" r="${e.r}" ${s.join(" ")}/>`;case"ellipse":return`<ellipse cx="${e.cx}" cy="${e.cy}" rx="${e.rx}" ry="${e.ry}" ${s.join(" ")}/>`;case"rect":{const t=void 0===e.rx?0:e.rx;return`<rect x="${e.x}" y="${e.y}" width="${e.width}" height="${e.height}" rx="${t}" ${s.join(" ")}/>`}default:return`<path d="${e.d}" ${s.join(" ")}/>`}}const I=t.motion?String(t.motion):pkg.motionFor(o,Boolean(t.reducedMotion)),T=["small","medium","large"].includes(n.size)?n.size:"medium",N=[],P=[];for(const e of pkg.LAYERS){const t=A[e]||[];if(N.push({name:e,shapes:t.length}),!t.length)continue;const r=t.map((t=>R(t,e))).join("");P.push(`<g class="avatar-layer avatar-${e}" data-layer="${e}">${r}</g>`)}return{svg:`<svg class="avatar-svg" viewBox="0 0 200 268" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" role="presentation" data-motion="${I}" data-size="${T}" data-frame="${f}" data-palette="${i}" data-expression="${x}"><rect class="avatar-bg" x="0" y="0" width="200" height="268" rx="24" fill="${h("bg")}"/>`+P.join("")+"</svg>",layers:N,warnings:r,missing:s,expression:x,expressionLabel:S.label||x,palette:i,frame:f,hair:y===pkg.HAIR[a.hair]?a.hair:"bob-2",motion:I,size:T}}const API=Object.freeze({assemble:assemble,shade:shade});"undefined"!=typeof module&&module.exports?module.exports=API:"undefined"!=typeof globalThis&&(globalThis.AegisAvatarAssemble=API);
|