aegis-desktop 1.0.13 → 1.0.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (96) hide show
  1. package/SOURCE-OFFER.txt +9 -0
  2. package/bin/aegis.js +1 -32
  3. package/lib/account-key.js +1 -56
  4. package/lib/auto.js +1 -430
  5. package/lib/avatar/companion.js +1 -698
  6. package/lib/avatar/cosmetics.js +1 -532
  7. package/lib/avatar/events.js +1 -344
  8. package/lib/avatar/holder-turn.js +1 -350
  9. package/lib/avatar/holders.js +1 -612
  10. package/lib/avatar/identity.js +1 -641
  11. package/lib/avatar/level.js +1 -368
  12. package/lib/avatar/mirror.js +1 -524
  13. package/lib/avatar/persona.js +1 -388
  14. package/lib/avatar/profile.js +1 -977
  15. package/lib/avatar/register.js +1 -307
  16. package/lib/avatar/store.js +1 -472
  17. package/lib/avatar/tiers.js +1 -38
  18. package/lib/avatar/transfer.js +1 -415
  19. package/lib/avatar/turn.js +1 -216
  20. package/lib/avatar/voice.js +1 -328
  21. package/lib/avatar/xp.js +1 -404
  22. package/lib/deep-link.js +1 -120
  23. package/lib/fingerprint.js +2 -347
  24. package/lib/google-connect.js +1 -169
  25. package/lib/local/agents.js +1 -105
  26. package/lib/local/autonomous.js +1 -1045
  27. package/lib/local/claude-pro.js +1 -993
  28. package/lib/local/context.js +1 -95
  29. package/lib/local/engine.js +1 -3228
  30. package/lib/local/entitlement.js +1 -654
  31. package/lib/local/git-scope.js +1 -228
  32. package/lib/local/local.js +1 -2135
  33. package/lib/local/prompt.js +1 -275
  34. package/lib/local/queue.js +1 -560
  35. package/lib/local/session-rounds.js +1 -208
  36. package/lib/local/shell.js +1 -680
  37. package/lib/local/telemetry.js +1 -470
  38. package/lib/local/tools.js +1 -1238
  39. package/lib/local/turn-guard.js +1 -300
  40. package/lib/local/worktree-lock.js +1 -235
  41. package/lib/provider-key-mirror.js +1 -252
  42. package/lib/quick-launcher.js +1 -84
  43. package/lib/settings.js +1 -890
  44. package/lib/sync/memory-queue.js +1 -60
  45. package/lib/sync/persist-gate.js +1 -148
  46. package/lib/sync/sessions.js +1 -106
  47. package/lib/window-state.js +1 -66
  48. package/main.js +3 -4390
  49. package/package.json +3 -5
  50. package/preload.js +3 -628
  51. package/renderer/app.js +1 -6560
  52. package/renderer/avatar/assemble.js +1 -335
  53. package/renderer/avatar/avatar.js +1 -380
  54. package/renderer/avatar/cards.js +1 -141
  55. package/renderer/avatar/hud.js +1 -206
  56. package/renderer/avatar/machine.js +1 -213
  57. package/renderer/avatar/pane.js +1 -439
  58. package/renderer/avatar/parts.js +1 -437
  59. package/renderer/budget.js +1 -168
  60. package/renderer/companion.js +1 -223
  61. package/renderer/diff.js +1 -359
  62. package/renderer/diffview.js +1 -336
  63. package/renderer/fingerprint.js +3 -720
  64. package/renderer/markdown.js +1 -168
  65. package/renderer/provider-toolbar.js +1 -134
  66. package/renderer/providers.js +1 -259
  67. package/renderer/quick.js +1 -191
  68. package/renderer/stream-policy.js +1 -306
  69. package/renderer/transcript-view.js +1 -323
  70. package/renderer/usage.js +1 -1239
  71. package/vendor/aegis.js +1 -2054
  72. package/vendor/attest.js +1 -442
  73. package/vendor/authorship-key.js +1 -410
  74. package/vendor/auto-provision.js +1 -134
  75. package/vendor/brain-catalog.js +1 -268
  76. package/vendor/byok-catalog.js +1 -230
  77. package/vendor/credentials.js +1 -494
  78. package/vendor/device-fingerprint.js +1 -141
  79. package/vendor/drive-connect.js +1 -85
  80. package/vendor/drive-upload.js +1 -174
  81. package/vendor/env-file.js +1 -1273
  82. package/vendor/fingerprint.js +1 -1064
  83. package/vendor/foreign-memory.js +1 -669
  84. package/vendor/google-signin.js +1 -125
  85. package/vendor/hooks.js +1 -430
  86. package/vendor/model-discovery.js +1 -330
  87. package/vendor/platform.js +1 -937
  88. package/vendor/prefs.js +1 -351
  89. package/vendor/presence-constants.js +1 -107
  90. package/vendor/presence.js +1 -438
  91. package/vendor/record-vault.js +3 -1055
  92. package/vendor/session-store.js +1 -548
  93. package/vendor/topup.js +1 -297
  94. package/vendor/touch.js +1 -458
  95. package/vendor/update.js +1 -704
  96. package/vendor/user-models.js +1 -381
@@ -1,439 +1,3 @@
1
1
  // SPDX-License-Identifier: AGPL-3.0-or-later
2
2
  // Copyright (C) 2026 Niklas Borneklint — AEGIS Code (aegiscode) / Aegiscloud.
3
- // AEGIS Code (aegiscode) — source: https://github.com/aegisinfo/aegiscode-plugin
4
- // Conveying a modified copy, or running one as a network service, owes the
5
- // corresponding source under this licence (§5/§13) — see LICENSING.md.
6
- 'use strict';
7
-
8
- /**
9
- * parts.js — the layered SVG part manifest.
10
- *
11
- * `lib/avatar/persona.js` says it plainly: "Ids only — geometry lives in
12
- * `renderer/avatar/`, which reads these same ids." This is that
13
- * geometry, and the sentence above is enforced rather than trusted: `IDS` below
14
- * IS `persona.PARTS`, read from the shared module — this file declares no id
15
- * list of its own. Adding `hair: 'mohawk-9'` to the persona schema whose
16
- * geometry is missing therefore fails `desktop/test/avatar-render.test.mjs`
17
- * (which asserts the manifest covers every id, both directions), instead of
18
- * rendering a bald head the user cannot explain.
19
- *
20
- * Everything here is DATA. There is no branch on a part id anywhere in the
21
- * renderer: the assembler walks `LAYERS` in order and emits whatever shapes the
22
- * manifest holds, so a commissioned art pack or a seasonal outfit is a file,
23
- * not a fork. That is the whole point of the phase: the avatar is data,
24
- * not art.
25
- *
26
- * Two deliberate limits, stated here rather than discovered later:
27
- *
28
- * - **Flat vector only.** No WebGL, no sprite atlas, no per-frame work. The
29
- * motion in §6 of the plan is CSS transforms on the groups this manifest
30
- * produces, and it is off under `prefers-reduced-motion`.
31
- * - **No text in the SVG.** Nothing the user typed (name, pronouns, address)
32
- * is ever placed inside the markup, so there is no string to escape and no
33
- * injection surface in the assembled string. The persona's identity text
34
- * reaches the screen through the HUD's *text* readout, where it belongs.
35
- *
36
- * Dual-environment on purpose: the renderer loads this with a `<script>` tag
37
- * (classic script, publishes `AegisAvatarParts`), and the Node tests `require()`
38
- * it. The shared modules it reads (`persona.js`, `events.js`) are loaded the
39
- * same way — see index.html and the UMD tail of each.
40
- */
41
-
42
- // The shared pure modules. In the browser they are separate <script> tags that
43
- // publish globals; in Node (tests) they are required. Never forked: the id list
44
- // and the state machine the engine uses are the ones the renderer draws.
45
- const shared = typeof window !== 'undefined' && window.AegisAvatarPersona
46
- ? { persona: window.AegisAvatarPersona, events: window.AegisAvatarEvents }
47
- : typeof module !== 'undefined' && module.exports
48
- ? {
49
- persona: require('../../lib/avatar/persona.js'),
50
- events: require('../../lib/avatar/events.js'),
51
- }
52
- : { persona: null, events: null };
53
-
54
- const PERSONA = shared.persona;
55
- const EVENTS = shared.events;
56
-
57
- /** Draw order, back to front. An outfit layer is an "under" or "over" group. */
58
- const LAYERS = Object.freeze([
59
- 'shadow',
60
- 'hairBack',
61
- 'body',
62
- 'outfitUnder',
63
- 'head',
64
- 'face',
65
- 'hairFront',
66
- 'outfitOver',
67
- 'accessory',
68
- 'effect',
69
- ]);
70
-
71
- /** Six skin tones, light to deep. Index = `presentation.skin` (0–5). */
72
- const SKIN_TONES = Object.freeze(['#f7dcc9', '#eec2a4', '#dda57f', '#c0835a', '#8e5c3c', '#5f3c28']);
73
-
74
- /**
75
- * Palettes. Roles, not literals: a part asks for `cloth` and the palette that
76
- * the persona selected answers. That is what lets the same geometry render in
77
- * six moods, and what makes a new palette a six-key object rather than a
78
- * re-drawing of every part.
79
- */
80
- const PALETTES = Object.freeze({
81
- amber: Object.freeze({ bg: '#241a12', ink: '#f6e6d2', accent: '#f0a83c', cloth: '#3d2c1e', clothShade: '#2a1d13', metal: '#c9a227' }),
82
- slate: Object.freeze({ bg: '#14181f', ink: '#e6ecf5', accent: '#6fa8dc', cloth: '#26313f', clothShade: '#1a222c', metal: '#9fb3c8' }),
83
- moss: Object.freeze({ bg: '#121a14', ink: '#e8f2e6', accent: '#7fbf7f', cloth: '#243329', clothShade: '#19241d', metal: '#a8bf8f' }),
84
- plum: Object.freeze({ bg: '#1c1220', ink: '#f1e6f5', accent: '#b27ad6', cloth: '#33203d', clothShade: '#24162c', metal: '#d8b4e2' }),
85
- mono: Object.freeze({ bg: '#131313', ink: '#f2f2f2', accent: '#bfbfbf', cloth: '#2b2b2b', clothShade: '#1d1d1d', metal: '#9a9a9a' }),
86
- sunset: Object.freeze({ bg: '#2a1418', ink: '#ffeede', accent: '#ff7a59', cloth: '#472029', clothShade: '#311519', metal: '#ffb27a' }),
87
- });
88
-
89
- /** Frames = the head silhouette. Ears are per-frame because the jaw moves. */
90
- const FRAMES = Object.freeze({
91
- A: Object.freeze({
92
- label: 'Round',
93
- head: 'M100 34 C133 34 153 58 153 93 C153 130 130 165 100 173 C70 165 47 130 47 93 C47 58 67 34 100 34 Z',
94
- ear: Object.freeze([Object.freeze({ cx: 47, cy: 100, r: 11 }), Object.freeze({ cx: 153, cy: 100, r: 11 })]),
95
- faceY: 104,
96
- }),
97
- B: Object.freeze({
98
- label: 'Square',
99
- head: 'M100 32 H141 Q155 32 155 62 V98 Q155 148 100 170 Q45 148 45 98 V62 Q45 32 59 32 Z',
100
- ear: Object.freeze([Object.freeze({ cx: 45, cy: 98, r: 10 }), Object.freeze({ cx: 155, cy: 98, r: 10 })]),
101
- faceY: 102,
102
- }),
103
- C: Object.freeze({
104
- label: 'Oval',
105
- head: 'M100 28 C129 28 147 52 147 90 C147 124 129 168 100 180 C71 168 53 124 53 90 C53 52 71 28 100 28 Z',
106
- ear: Object.freeze([Object.freeze({ cx: 53, cy: 96, r: 9 }), Object.freeze({ cx: 147, cy: 96, r: 9 })]),
107
- faceY: 106,
108
- }),
109
- });
110
-
111
- /** The neck + torso every persona has, under whatever they are wearing. */
112
- const BODY = Object.freeze({
113
- neck: 'M85 158 h30 v26 h-30 Z',
114
- shirt: 'M58 190 Q100 176 142 190 V262 H58 Z',
115
- sleeveL: 'M58 190 L38 226 L58 238 L74 206 Z',
116
- sleeveR: 'M142 190 L162 226 L142 238 L126 206 Z',
117
- });
118
-
119
- const HAIR = Object.freeze({
120
- 'short-1': Object.freeze({
121
- label: 'Short',
122
- back: Object.freeze([]),
123
- front: Object.freeze([
124
- Object.freeze({ kind: 'path', d: 'M100 28 C131 28 153 50 153 84 C144 62 124 54 100 54 C76 54 56 62 47 84 C47 50 69 28 100 28 Z' }),
125
- Object.freeze({ kind: 'path', d: 'M62 62 Q86 46 108 56 Q88 60 74 74 Z' }),
126
- ]),
127
- }),
128
- 'bob-2': Object.freeze({
129
- label: 'Bob',
130
- back: Object.freeze([
131
- Object.freeze({ kind: 'path', d: 'M44 96 Q44 30 100 30 Q156 30 156 96 V150 Q140 146 138 118 V96 Q132 62 100 62 Q68 62 62 96 V118 Q60 146 44 150 Z' }),
132
- ]),
133
- front: Object.freeze([
134
- Object.freeze({ kind: 'path', d: 'M100 26 C133 26 156 52 156 90 Q140 60 100 60 Q60 60 44 90 C44 52 67 26 100 26 Z' }),
135
- Object.freeze({ kind: 'path', d: 'M46 88 Q60 108 58 150 L44 150 Q42 110 46 88 Z' }),
136
- Object.freeze({ kind: 'path', d: 'M154 88 Q140 108 142 150 L156 150 Q158 110 154 88 Z' }),
137
- ]),
138
- }),
139
- 'long-3': Object.freeze({
140
- label: 'Long',
141
- back: Object.freeze([
142
- Object.freeze({ kind: 'path', d: 'M40 100 Q40 28 100 28 Q160 28 160 100 V226 Q142 232 138 200 V104 Q132 60 100 60 Q68 60 62 104 V200 Q58 232 40 226 Z' }),
143
- ]),
144
- front: Object.freeze([
145
- Object.freeze({ kind: 'path', d: 'M100 26 C134 26 158 52 158 92 Q140 58 100 58 Q60 58 42 92 C42 52 66 26 100 26 Z' }),
146
- Object.freeze({ kind: 'path', d: 'M52 88 Q64 120 62 170 L48 168 Q44 116 52 88 Z' }),
147
- Object.freeze({ kind: 'path', d: 'M148 88 Q136 120 138 170 L152 168 Q156 116 148 88 Z' }),
148
- ]),
149
- }),
150
- 'curly-4': Object.freeze({
151
- label: 'Curly',
152
- back: Object.freeze([
153
- Object.freeze({ kind: 'circle', cx: 62, cy: 66, r: 26 }),
154
- Object.freeze({ kind: 'circle', cx: 100, cy: 46, r: 30 }),
155
- Object.freeze({ kind: 'circle', cx: 138, cy: 66, r: 26 }),
156
- ]),
157
- front: Object.freeze([
158
- Object.freeze({ kind: 'circle', cx: 76, cy: 52, r: 20 }),
159
- Object.freeze({ kind: 'circle', cx: 106, cy: 44, r: 22 }),
160
- Object.freeze({ kind: 'circle', cx: 134, cy: 58, r: 18 }),
161
- ]),
162
- }),
163
- 'buzz-5': Object.freeze({
164
- label: 'Buzz',
165
- back: Object.freeze([]),
166
- front: Object.freeze([
167
- Object.freeze({ kind: 'path', d: 'M100 30 C130 30 152 52 152 82 Q136 58 100 58 Q64 58 48 82 C48 52 70 30 100 30 Z' }),
168
- ]),
169
- }),
170
- 'ponytail-6': Object.freeze({
171
- label: 'Ponytail',
172
- back: Object.freeze([
173
- Object.freeze({ kind: 'path', d: 'M146 74 Q186 96 178 148 Q170 190 150 196 Q166 156 158 122 Q150 92 138 82 Z' }),
174
- ]),
175
- front: Object.freeze([
176
- Object.freeze({ kind: 'path', d: 'M100 28 C132 28 154 50 154 86 Q140 58 100 58 Q60 58 46 86 C46 50 68 28 100 28 Z' }),
177
- ]),
178
- }),
179
- 'braids-7': Object.freeze({
180
- label: 'Braids',
181
- back: Object.freeze([
182
- Object.freeze({ kind: 'path', d: 'M52 92 Q44 150 48 196 L70 196 Q60 150 64 100 Z' }),
183
- Object.freeze({ kind: 'path', d: 'M148 92 Q156 150 152 196 L130 196 Q140 150 136 100 Z' }),
184
- ]),
185
- front: Object.freeze([
186
- Object.freeze({ kind: 'path', d: 'M100 28 C132 28 154 50 154 86 Q140 58 100 58 Q60 58 46 86 C46 50 68 28 100 28 Z' }),
187
- ]),
188
- detail: Object.freeze([
189
- Object.freeze({ kind: 'path', d: 'M50 132 H70 M50 160 H70 M130 132 H150 M130 160 H150', stroke: true, role: 'hairShade' }),
190
- ]),
191
- }),
192
- 'wavy-8': Object.freeze({
193
- label: 'Wavy',
194
- back: Object.freeze([
195
- Object.freeze({ kind: 'path', d: 'M42 96 Q42 30 100 30 Q158 30 158 96 Q150 130 156 168 Q146 158 142 132 Q140 96 132 70 Q118 58 100 58 Q82 58 68 70 Q60 96 58 132 Q54 158 44 168 Q50 130 42 96 Z' }),
196
- ]),
197
- front: Object.freeze([
198
- Object.freeze({ kind: 'path', d: 'M100 26 C134 26 158 54 156 94 Q146 62 116 58 Q96 56 84 66 Q66 74 44 94 C42 54 66 26 100 26 Z' }),
199
- ]),
200
- }),
201
- });
202
-
203
- /** Eye shapes. `expression` may replace the lids (see EXPRESSIONS below). */
204
- const EYES = Object.freeze({
205
- soft: Object.freeze({
206
- label: 'Soft',
207
- left: Object.freeze([Object.freeze({ kind: 'ellipse', cx: 78, cy: 106, rx: 12, ry: 9 }), Object.freeze({ kind: 'circle', cx: 78, cy: 106, r: 5, role: 'ink' }), Object.freeze({ kind: 'circle', cx: 80, cy: 103, r: 2, role: 'highlight' })]),
208
- right: Object.freeze([Object.freeze({ kind: 'ellipse', cx: 122, cy: 106, rx: 12, ry: 9 }), Object.freeze({ kind: 'circle', cx: 122, cy: 106, r: 5, role: 'ink' }), Object.freeze({ kind: 'circle', cx: 124, cy: 103, r: 2, role: 'highlight' })]),
209
- }),
210
- sharp: Object.freeze({
211
- label: 'Sharp',
212
- left: Object.freeze([Object.freeze({ kind: 'path', d: 'M66 106 Q78 94 90 106 Q78 112 66 106 Z' }), Object.freeze({ kind: 'circle', cx: 79, cy: 104, r: 4, role: 'ink' })]),
213
- right: Object.freeze([Object.freeze({ kind: 'path', d: 'M110 106 Q122 94 134 106 Q122 112 110 106 Z' }), Object.freeze({ kind: 'circle', cx: 121, cy: 104, r: 4, role: 'ink' })]),
214
- }),
215
- sleepy: Object.freeze({
216
- label: 'Sleepy',
217
- left: Object.freeze([Object.freeze({ kind: 'path', d: 'M66 106 Q78 112 90 106', stroke: true }), Object.freeze({ kind: 'circle', cx: 78, cy: 109, r: 3, role: 'ink' })]),
218
- right: Object.freeze([Object.freeze({ kind: 'path', d: 'M110 106 Q122 112 134 106', stroke: true }), Object.freeze({ kind: 'circle', cx: 122, cy: 109, r: 3, role: 'ink' })]),
219
- }),
220
- bright: Object.freeze({
221
- label: 'Bright',
222
- left: Object.freeze([Object.freeze({ kind: 'circle', cx: 78, cy: 105, r: 12 }), Object.freeze({ kind: 'circle', cx: 78, cy: 105, r: 6, role: 'ink' }), Object.freeze({ kind: 'circle', cx: 82, cy: 100, r: 3, role: 'highlight' })]),
223
- right: Object.freeze([Object.freeze({ kind: 'circle', cx: 122, cy: 105, r: 12 }), Object.freeze({ kind: 'circle', cx: 122, cy: 105, r: 6, role: 'ink' }), Object.freeze({ kind: 'circle', cx: 126, cy: 100, r: 3, role: 'highlight' })]),
224
- }),
225
- });
226
-
227
- /** Everything that is always on the face regardless of expression. */
228
- const FACE = Object.freeze({
229
- nose: Object.freeze([Object.freeze({ kind: 'path', d: 'M100 116 Q104 124 98 128', stroke: true })]),
230
- });
231
-
232
- /**
233
- * Expressions. The seven core ones are exactly `events.js`'s `EXPRESSIONS`
234
- * values — asserted by test, so a new engine state cannot silently render a
235
- * face nobody drew. The named packs after them are cosmetic additions; the
236
- * *state machine never selects them*, they exist for the customization pane and
237
- * for `persona.expressions.custom`, which may reference these atoms by name.
238
- */
239
- const EXPRESSIONS = Object.freeze({
240
- neutral: Object.freeze({ label: 'Neutral', brows: Object.freeze(['M64 92 Q78 86 90 92', 'M110 92 Q122 86 136 92']), mouth: 'M88 140 Q100 146 112 140' }),
241
- attentive: Object.freeze({ label: 'Attentive', brows: Object.freeze(['M64 88 Q78 80 90 88', 'M110 88 Q122 80 136 88']), mouth: 'M88 140 Q100 148 112 140' }),
242
- focused: Object.freeze({ label: 'Focused', brows: Object.freeze(['M64 90 Q78 84 90 96', 'M110 96 Q122 84 136 90']), mouth: 'M88 142 H112' }),
243
- waiting: Object.freeze({ label: 'Waiting', brows: Object.freeze(['M62 86 Q78 78 92 84', 'M108 84 Q122 78 138 86']), mouth: 'M90 142 Q100 138 110 142' }),
244
- happy: Object.freeze({ label: 'Happy', brows: Object.freeze(['M64 88 Q78 82 90 88', 'M110 88 Q122 82 136 88']), mouth: 'M84 138 Q100 156 116 138', eyes: 'arc' }),
245
- sleepy: Object.freeze({ label: 'Sleepy', brows: Object.freeze(['M64 94 Q78 90 90 94', 'M110 94 Q122 90 136 94']), mouth: 'M92 144 Q100 150 108 144', eyes: 'closed' }),
246
- concerned: Object.freeze({ label: 'Concerned', brows: Object.freeze(['M62 84 Q78 92 92 98', 'M108 98 Q122 92 138 84']), mouth: 'M88 146 Q100 138 112 146' }),
247
- warm: Object.freeze({ label: 'Warm', brows: Object.freeze(['M64 90 Q78 84 90 90', 'M110 90 Q122 84 136 90']), mouth: 'M86 138 Q100 152 114 138' }),
248
- proud: Object.freeze({ label: 'Proud', brows: Object.freeze(['M64 86 Q78 80 90 86', 'M110 86 Q122 80 136 86']), mouth: 'M88 138 Q104 150 112 138' }),
249
- playful: Object.freeze({ label: 'Playful', brows: Object.freeze(['M64 88 Q78 80 90 88', 'M110 88 Q122 80 136 88']), mouth: 'M84 138 Q100 158 116 138', eyes: 'arc' }),
250
- curious: Object.freeze({ label: 'Curious', brows: Object.freeze(['M64 82 Q78 76 90 88', 'M110 88 Q122 76 136 82']), mouth: 'M94 142 Q100 148 106 142' }),
251
- steady: Object.freeze({ label: 'Steady', brows: Object.freeze(['M64 90 Q78 86 90 90', 'M110 90 Q122 86 136 90']), mouth: 'M90 141 Q100 145 110 141' }),
252
- delighted: Object.freeze({ label: 'Delighted', brows: Object.freeze(['M62 86 Q78 78 92 86', 'M108 86 Q122 78 138 86']), mouth: 'M82 136 Q100 160 118 136', eyes: 'arc' }),
253
- reverent: Object.freeze({ label: 'Reverent', brows: Object.freeze(['M64 94 Q78 88 90 94', 'M110 94 Q122 88 136 94']), mouth: 'M90 140 Q100 144 110 140', eyes: 'closed' }),
254
- weary: Object.freeze({ label: 'Weary', brows: Object.freeze(['M62 92 Q78 96 92 100', 'M108 100 Q122 96 138 92']), mouth: 'M88 146 Q100 142 112 146' }),
255
- });
256
-
257
- /** Which pack adds which ids. `core` is the base every persona has. */
258
- const EXPRESSION_PACKS = Object.freeze({
259
- core: Object.freeze(['neutral', 'attentive', 'focused', 'waiting', 'happy', 'sleepy', 'concerned']),
260
- trusted: Object.freeze(['warm', 'proud']),
261
- companion: Object.freeze(['playful', 'curious']),
262
- confidant: Object.freeze(['steady', 'delighted']),
263
- archivist: Object.freeze(['reverent', 'weary']),
264
- });
265
-
266
- /** Eye replacements an expression may request. */
267
- const EYE_OVERRIDES = Object.freeze({
268
- arc: Object.freeze([
269
- Object.freeze({ kind: 'path', d: 'M66 108 Q78 96 90 108', role: 'ink' }),
270
- Object.freeze({ kind: 'path', d: 'M110 108 Q122 96 134 108', role: 'ink' }),
271
- ]),
272
- closed: Object.freeze([
273
- Object.freeze({ kind: 'path', d: 'M66 106 H90', role: 'ink' }),
274
- Object.freeze({ kind: 'path', d: 'M110 106 H134', role: 'ink' }),
275
- ]),
276
- });
277
-
278
- /** Outfits: an `under` group (drawn behind the head) and an `over` group. */
279
- const OUTFITS = Object.freeze({
280
- hoodie: Object.freeze({
281
- label: 'Hoodie',
282
- under: Object.freeze([]),
283
- over: Object.freeze([
284
- Object.freeze({ kind: 'path', d: 'M56 192 Q100 174 144 192 V262 H56 Z' }),
285
- Object.freeze({ kind: 'path', d: 'M78 178 Q100 196 122 178 L134 190 Q100 212 66 190 Z', role: 'clothShade' }),
286
- Object.freeze({ kind: 'path', d: 'M74 214 H126 V240 H74 Z', role: 'clothShade' }),
287
- Object.freeze({ kind: 'path', d: 'M96 196 V214 M104 196 V214', role: 'metal' }),
288
- ]),
289
- }),
290
- tshirt: Object.freeze({
291
- label: 'T-shirt',
292
- under: Object.freeze([]),
293
- over: Object.freeze([
294
- Object.freeze({ kind: 'path', d: 'M56 192 Q100 176 144 192 V262 H56 Z', role: 'accent' }),
295
- Object.freeze({ kind: 'path', d: 'M84 182 Q100 194 116 182 L120 188 Q100 200 80 188 Z', role: 'clothShade' }),
296
- ]),
297
- }),
298
- flannel: Object.freeze({
299
- label: 'Flannel',
300
- under: Object.freeze([]),
301
- over: Object.freeze([
302
- Object.freeze({ kind: 'path', d: 'M56 192 Q100 176 144 192 V262 H56 Z' }),
303
- Object.freeze({ kind: 'path', d: 'M70 196 V262 M88 194 V262 M112 194 V262 M130 196 V262', role: 'clothShade' }),
304
- Object.freeze({ kind: 'path', d: 'M56 214 H144 M56 236 H144', role: 'accent' }),
305
- Object.freeze({ kind: 'path', d: 'M84 182 L100 200 L116 182 L124 190 L100 214 L76 190 Z', role: 'clothShade' }),
306
- ]),
307
- }),
308
- jacket: Object.freeze({
309
- label: 'Jacket',
310
- under: Object.freeze([]),
311
- over: Object.freeze([
312
- Object.freeze({ kind: 'path', d: 'M54 190 Q100 172 146 190 V262 H54 Z' }),
313
- Object.freeze({ kind: 'path', d: 'M54 190 L100 214 L146 190 L146 200 L100 224 L54 200 Z', role: 'clothShade' }),
314
- Object.freeze({ kind: 'path', d: 'M100 214 V262', role: 'metal' }),
315
- ]),
316
- }),
317
- headphones: Object.freeze({
318
- label: 'Headphones',
319
- under: Object.freeze([]),
320
- over: Object.freeze([
321
- Object.freeze({ kind: 'path', d: 'M46 96 Q46 30 100 30 Q154 30 154 96', role: 'metal' }),
322
- Object.freeze({ kind: 'rect', x: 34, y: 88, width: 22, height: 34, rx: 8 }),
323
- Object.freeze({ kind: 'rect', x: 144, y: 88, width: 22, height: 34, rx: 8 }),
324
- Object.freeze({ kind: 'circle', cx: 45, cy: 105, r: 6, role: 'accent' }),
325
- Object.freeze({ kind: 'circle', cx: 155, cy: 105, r: 6, role: 'accent' }),
326
- ]),
327
- accessory: true,
328
- }),
329
- glasses: Object.freeze({
330
- label: 'Glasses',
331
- under: Object.freeze([]),
332
- over: Object.freeze([
333
- Object.freeze({ kind: 'rect', x: 60, y: 96, width: 40, height: 26, rx: 8, role: 'metal' }),
334
- Object.freeze({ kind: 'rect', x: 100, y: 96, width: 40, height: 26, rx: 8, role: 'metal' }),
335
- Object.freeze({ kind: 'path', d: 'M100 106 H100 M60 104 L44 100 M140 104 L156 100', role: 'metal' }),
336
- ]),
337
- accessory: true,
338
- }),
339
- scarf: Object.freeze({
340
- label: 'Scarf',
341
- under: Object.freeze([]),
342
- over: Object.freeze([
343
- Object.freeze({ kind: 'path', d: 'M72 172 Q100 190 128 172 L134 190 Q100 208 66 190 Z', role: 'accent' }),
344
- Object.freeze({ kind: 'path', d: 'M112 190 L128 236 L112 240 L98 194 Z', role: 'accent' }),
345
- ]),
346
- }),
347
- apron: Object.freeze({
348
- label: 'Apron',
349
- under: Object.freeze([]),
350
- over: Object.freeze([
351
- Object.freeze({ kind: 'path', d: 'M74 200 H126 V262 H74 Z', role: 'clothShade' }),
352
- Object.freeze({ kind: 'path', d: 'M80 190 L92 200 M120 190 L108 200', role: 'metal' }),
353
- Object.freeze({ kind: 'path', d: 'M80 228 H120', role: 'accent' }),
354
- ]),
355
- }),
356
- 'seasonal-winter': Object.freeze({
357
- label: 'Winter set',
358
- under: Object.freeze([]),
359
- over: Object.freeze([
360
- Object.freeze({ kind: 'path', d: 'M44 74 Q100 44 156 74 L156 88 Q100 60 44 88 Z', role: 'accent' }),
361
- Object.freeze({ kind: 'circle', cx: 100, cy: 40, r: 12, role: 'accent' }),
362
- Object.freeze({ kind: 'path', d: 'M72 172 Q100 190 128 172 L134 190 Q100 208 66 190 Z', role: 'clothShade' }),
363
- ]),
364
- }),
365
- 'archive-coat': Object.freeze({
366
- label: 'Archive coat',
367
- under: Object.freeze([]),
368
- over: Object.freeze([
369
- Object.freeze({ kind: 'path', d: 'M50 188 Q100 168 150 188 V262 H50 Z' }),
370
- Object.freeze({ kind: 'path', d: 'M50 188 L100 216 L150 188 L150 200 L100 228 L50 200 Z', role: 'clothShade' }),
371
- Object.freeze({ kind: 'path', d: 'M56 222 H144 V234 H56 Z', role: 'metal' }),
372
- Object.freeze({ kind: 'path', d: 'M100 228 V262', role: 'metal' }),
373
- ]),
374
- }),
375
- });
376
-
377
- /** Human labels for the pane. A missing label falls back to the raw id. */
378
- const LABELS = Object.freeze({
379
- frame: Object.freeze({ A: 'Round', B: 'Square', C: 'Oval' }),
380
- hair: Object.freeze(Object.fromEntries(Object.entries(HAIR).map(([k, v]) => [k, v.label]))),
381
- eyes: Object.freeze(Object.fromEntries(Object.entries(EYES).map(([k, v]) => [k, v.label]))),
382
- outfit: Object.freeze(Object.fromEntries(Object.entries(OUTFITS).map(([k, v]) => [k, v.label]))),
383
- palette: Object.freeze({ amber: 'Amber', slate: 'Slate', moss: 'Moss', plum: 'Plum', mono: 'Mono', sunset: 'Sunset' }),
384
- expressionPack: Object.freeze({ core: 'Core', trusted: 'Trusted', companion: 'Companion', confidant: 'Confidant', archivist: 'Archivist' }),
385
- skin: Object.freeze({ 0: 'Tone 1', 1: 'Tone 2', 2: 'Tone 3', 3: 'Tone 4', 4: 'Tone 5', 5: 'Tone 6' }),
386
- });
387
-
388
- /** Id lists the assembler validates against — `persona.PARTS`, never a copy. */
389
- const IDS = PERSONA ? PERSONA.PARTS : Object.freeze({});
390
-
391
- /** The persona's own defaults, for a renderer that has never seen a file. */
392
- function defaultPersona() {
393
- if (!PERSONA) throw new Error('avatar/parts.js: the shared persona module is not loaded');
394
- return PERSONA.defaultPersona();
395
- }
396
-
397
- /**
398
- * Motion policy: `prefers-reduced-motion` is not advisory (persona.js says so,
399
- * and this defers to the same function rather than re-deciding it).
400
- */
401
- function motionFor(persona, prefersReducedMotion) {
402
- if (!PERSONA) return prefersReducedMotion ? 'minimal' : 'full';
403
- const record = persona && persona.appearance ? persona : defaultPersona();
404
- return PERSONA.appliesMotion(record, Boolean(prefersReducedMotion));
405
- }
406
-
407
- /** The expressions a persona's pack can show (core always included). */
408
- function expressionsFor(persona) {
409
- const pack = persona && persona.expressions && persona.expressions.pack;
410
- const extra = EXPRESSION_PACKS[pack] || [];
411
- const list = EXPRESSION_PACKS.core.slice();
412
- for (const id of extra) if (!list.includes(id)) list.push(id);
413
- return list;
414
- }
415
-
416
- const API = Object.freeze({
417
- LAYERS,
418
- IDS,
419
- SKIN_TONES,
420
- PALETTES,
421
- FRAMES,
422
- BODY,
423
- HAIR,
424
- EYES,
425
- FACE,
426
- EXPRESSIONS,
427
- EXPRESSION_PACKS,
428
- EYE_OVERRIDES,
429
- OUTFITS,
430
- LABELS,
431
- defaultPersona,
432
- motionFor,
433
- expressionsFor,
434
- });
435
-
436
- // UMD tail — the file is a classic renderer script AND a Node module. The
437
- // shared persona/events modules are loaded the same way.
438
- if (typeof module !== 'undefined' && module.exports) module.exports = API;
439
- else if (typeof globalThis !== 'undefined') globalThis.AegisAvatarParts = API;
3
+ "use strict";const shared="undefined"!=typeof window&&window.AegisAvatarPersona?{persona:window.AegisAvatarPersona,events:window.AegisAvatarEvents}:"undefined"!=typeof module&&module.exports?{persona:require("../../lib/avatar/persona.js"),events:require("../../lib/avatar/events.js")}:{persona:null,events:null},PERSONA=shared.persona,EVENTS=shared.events,LAYERS=Object.freeze(["shadow","hairBack","body","outfitUnder","head","face","hairFront","outfitOver","accessory","effect"]),SKIN_TONES=Object.freeze(["#f7dcc9","#eec2a4","#dda57f","#c0835a","#8e5c3c","#5f3c28"]),PALETTES=Object.freeze({amber:Object.freeze({bg:"#241a12",ink:"#f6e6d2",accent:"#f0a83c",cloth:"#3d2c1e",clothShade:"#2a1d13",metal:"#c9a227"}),slate:Object.freeze({bg:"#14181f",ink:"#e6ecf5",accent:"#6fa8dc",cloth:"#26313f",clothShade:"#1a222c",metal:"#9fb3c8"}),moss:Object.freeze({bg:"#121a14",ink:"#e8f2e6",accent:"#7fbf7f",cloth:"#243329",clothShade:"#19241d",metal:"#a8bf8f"}),plum:Object.freeze({bg:"#1c1220",ink:"#f1e6f5",accent:"#b27ad6",cloth:"#33203d",clothShade:"#24162c",metal:"#d8b4e2"}),mono:Object.freeze({bg:"#131313",ink:"#f2f2f2",accent:"#bfbfbf",cloth:"#2b2b2b",clothShade:"#1d1d1d",metal:"#9a9a9a"}),sunset:Object.freeze({bg:"#2a1418",ink:"#ffeede",accent:"#ff7a59",cloth:"#472029",clothShade:"#311519",metal:"#ffb27a"})}),FRAMES=Object.freeze({A:Object.freeze({label:"Round",head:"M100 34 C133 34 153 58 153 93 C153 130 130 165 100 173 C70 165 47 130 47 93 C47 58 67 34 100 34 Z",ear:Object.freeze([Object.freeze({cx:47,cy:100,r:11}),Object.freeze({cx:153,cy:100,r:11})]),faceY:104}),B:Object.freeze({label:"Square",head:"M100 32 H141 Q155 32 155 62 V98 Q155 148 100 170 Q45 148 45 98 V62 Q45 32 59 32 Z",ear:Object.freeze([Object.freeze({cx:45,cy:98,r:10}),Object.freeze({cx:155,cy:98,r:10})]),faceY:102}),C:Object.freeze({label:"Oval",head:"M100 28 C129 28 147 52 147 90 C147 124 129 168 100 180 C71 168 53 124 53 90 C53 52 71 28 100 28 Z",ear:Object.freeze([Object.freeze({cx:53,cy:96,r:9}),Object.freeze({cx:147,cy:96,r:9})]),faceY:106})}),BODY=Object.freeze({neck:"M85 158 h30 v26 h-30 Z",shirt:"M58 190 Q100 176 142 190 V262 H58 Z",sleeveL:"M58 190 L38 226 L58 238 L74 206 Z",sleeveR:"M142 190 L162 226 L142 238 L126 206 Z"}),HAIR=Object.freeze({"short-1":Object.freeze({label:"Short",back:Object.freeze([]),front:Object.freeze([Object.freeze({kind:"path",d:"M100 28 C131 28 153 50 153 84 C144 62 124 54 100 54 C76 54 56 62 47 84 C47 50 69 28 100 28 Z"}),Object.freeze({kind:"path",d:"M62 62 Q86 46 108 56 Q88 60 74 74 Z"})])}),"bob-2":Object.freeze({label:"Bob",back:Object.freeze([Object.freeze({kind:"path",d:"M44 96 Q44 30 100 30 Q156 30 156 96 V150 Q140 146 138 118 V96 Q132 62 100 62 Q68 62 62 96 V118 Q60 146 44 150 Z"})]),front:Object.freeze([Object.freeze({kind:"path",d:"M100 26 C133 26 156 52 156 90 Q140 60 100 60 Q60 60 44 90 C44 52 67 26 100 26 Z"}),Object.freeze({kind:"path",d:"M46 88 Q60 108 58 150 L44 150 Q42 110 46 88 Z"}),Object.freeze({kind:"path",d:"M154 88 Q140 108 142 150 L156 150 Q158 110 154 88 Z"})])}),"long-3":Object.freeze({label:"Long",back:Object.freeze([Object.freeze({kind:"path",d:"M40 100 Q40 28 100 28 Q160 28 160 100 V226 Q142 232 138 200 V104 Q132 60 100 60 Q68 60 62 104 V200 Q58 232 40 226 Z"})]),front:Object.freeze([Object.freeze({kind:"path",d:"M100 26 C134 26 158 52 158 92 Q140 58 100 58 Q60 58 42 92 C42 52 66 26 100 26 Z"}),Object.freeze({kind:"path",d:"M52 88 Q64 120 62 170 L48 168 Q44 116 52 88 Z"}),Object.freeze({kind:"path",d:"M148 88 Q136 120 138 170 L152 168 Q156 116 148 88 Z"})])}),"curly-4":Object.freeze({label:"Curly",back:Object.freeze([Object.freeze({kind:"circle",cx:62,cy:66,r:26}),Object.freeze({kind:"circle",cx:100,cy:46,r:30}),Object.freeze({kind:"circle",cx:138,cy:66,r:26})]),front:Object.freeze([Object.freeze({kind:"circle",cx:76,cy:52,r:20}),Object.freeze({kind:"circle",cx:106,cy:44,r:22}),Object.freeze({kind:"circle",cx:134,cy:58,r:18})])}),"buzz-5":Object.freeze({label:"Buzz",back:Object.freeze([]),front:Object.freeze([Object.freeze({kind:"path",d:"M100 30 C130 30 152 52 152 82 Q136 58 100 58 Q64 58 48 82 C48 52 70 30 100 30 Z"})])}),"ponytail-6":Object.freeze({label:"Ponytail",back:Object.freeze([Object.freeze({kind:"path",d:"M146 74 Q186 96 178 148 Q170 190 150 196 Q166 156 158 122 Q150 92 138 82 Z"})]),front:Object.freeze([Object.freeze({kind:"path",d:"M100 28 C132 28 154 50 154 86 Q140 58 100 58 Q60 58 46 86 C46 50 68 28 100 28 Z"})])}),"braids-7":Object.freeze({label:"Braids",back:Object.freeze([Object.freeze({kind:"path",d:"M52 92 Q44 150 48 196 L70 196 Q60 150 64 100 Z"}),Object.freeze({kind:"path",d:"M148 92 Q156 150 152 196 L130 196 Q140 150 136 100 Z"})]),front:Object.freeze([Object.freeze({kind:"path",d:"M100 28 C132 28 154 50 154 86 Q140 58 100 58 Q60 58 46 86 C46 50 68 28 100 28 Z"})]),detail:Object.freeze([Object.freeze({kind:"path",d:"M50 132 H70 M50 160 H70 M130 132 H150 M130 160 H150",stroke:!0,role:"hairShade"})])}),"wavy-8":Object.freeze({label:"Wavy",back:Object.freeze([Object.freeze({kind:"path",d:"M42 96 Q42 30 100 30 Q158 30 158 96 Q150 130 156 168 Q146 158 142 132 Q140 96 132 70 Q118 58 100 58 Q82 58 68 70 Q60 96 58 132 Q54 158 44 168 Q50 130 42 96 Z"})]),front:Object.freeze([Object.freeze({kind:"path",d:"M100 26 C134 26 158 54 156 94 Q146 62 116 58 Q96 56 84 66 Q66 74 44 94 C42 54 66 26 100 26 Z"})])})}),EYES=Object.freeze({soft:Object.freeze({label:"Soft",left:Object.freeze([Object.freeze({kind:"ellipse",cx:78,cy:106,rx:12,ry:9}),Object.freeze({kind:"circle",cx:78,cy:106,r:5,role:"ink"}),Object.freeze({kind:"circle",cx:80,cy:103,r:2,role:"highlight"})]),right:Object.freeze([Object.freeze({kind:"ellipse",cx:122,cy:106,rx:12,ry:9}),Object.freeze({kind:"circle",cx:122,cy:106,r:5,role:"ink"}),Object.freeze({kind:"circle",cx:124,cy:103,r:2,role:"highlight"})])}),sharp:Object.freeze({label:"Sharp",left:Object.freeze([Object.freeze({kind:"path",d:"M66 106 Q78 94 90 106 Q78 112 66 106 Z"}),Object.freeze({kind:"circle",cx:79,cy:104,r:4,role:"ink"})]),right:Object.freeze([Object.freeze({kind:"path",d:"M110 106 Q122 94 134 106 Q122 112 110 106 Z"}),Object.freeze({kind:"circle",cx:121,cy:104,r:4,role:"ink"})])}),sleepy:Object.freeze({label:"Sleepy",left:Object.freeze([Object.freeze({kind:"path",d:"M66 106 Q78 112 90 106",stroke:!0}),Object.freeze({kind:"circle",cx:78,cy:109,r:3,role:"ink"})]),right:Object.freeze([Object.freeze({kind:"path",d:"M110 106 Q122 112 134 106",stroke:!0}),Object.freeze({kind:"circle",cx:122,cy:109,r:3,role:"ink"})])}),bright:Object.freeze({label:"Bright",left:Object.freeze([Object.freeze({kind:"circle",cx:78,cy:105,r:12}),Object.freeze({kind:"circle",cx:78,cy:105,r:6,role:"ink"}),Object.freeze({kind:"circle",cx:82,cy:100,r:3,role:"highlight"})]),right:Object.freeze([Object.freeze({kind:"circle",cx:122,cy:105,r:12}),Object.freeze({kind:"circle",cx:122,cy:105,r:6,role:"ink"}),Object.freeze({kind:"circle",cx:126,cy:100,r:3,role:"highlight"})])})}),FACE=Object.freeze({nose:Object.freeze([Object.freeze({kind:"path",d:"M100 116 Q104 124 98 128",stroke:!0})])}),EXPRESSIONS=Object.freeze({neutral:Object.freeze({label:"Neutral",brows:Object.freeze(["M64 92 Q78 86 90 92","M110 92 Q122 86 136 92"]),mouth:"M88 140 Q100 146 112 140"}),attentive:Object.freeze({label:"Attentive",brows:Object.freeze(["M64 88 Q78 80 90 88","M110 88 Q122 80 136 88"]),mouth:"M88 140 Q100 148 112 140"}),focused:Object.freeze({label:"Focused",brows:Object.freeze(["M64 90 Q78 84 90 96","M110 96 Q122 84 136 90"]),mouth:"M88 142 H112"}),waiting:Object.freeze({label:"Waiting",brows:Object.freeze(["M62 86 Q78 78 92 84","M108 84 Q122 78 138 86"]),mouth:"M90 142 Q100 138 110 142"}),happy:Object.freeze({label:"Happy",brows:Object.freeze(["M64 88 Q78 82 90 88","M110 88 Q122 82 136 88"]),mouth:"M84 138 Q100 156 116 138",eyes:"arc"}),sleepy:Object.freeze({label:"Sleepy",brows:Object.freeze(["M64 94 Q78 90 90 94","M110 94 Q122 90 136 94"]),mouth:"M92 144 Q100 150 108 144",eyes:"closed"}),concerned:Object.freeze({label:"Concerned",brows:Object.freeze(["M62 84 Q78 92 92 98","M108 98 Q122 92 138 84"]),mouth:"M88 146 Q100 138 112 146"}),warm:Object.freeze({label:"Warm",brows:Object.freeze(["M64 90 Q78 84 90 90","M110 90 Q122 84 136 90"]),mouth:"M86 138 Q100 152 114 138"}),proud:Object.freeze({label:"Proud",brows:Object.freeze(["M64 86 Q78 80 90 86","M110 86 Q122 80 136 86"]),mouth:"M88 138 Q104 150 112 138"}),playful:Object.freeze({label:"Playful",brows:Object.freeze(["M64 88 Q78 80 90 88","M110 88 Q122 80 136 88"]),mouth:"M84 138 Q100 158 116 138",eyes:"arc"}),curious:Object.freeze({label:"Curious",brows:Object.freeze(["M64 82 Q78 76 90 88","M110 88 Q122 76 136 82"]),mouth:"M94 142 Q100 148 106 142"}),steady:Object.freeze({label:"Steady",brows:Object.freeze(["M64 90 Q78 86 90 90","M110 90 Q122 86 136 90"]),mouth:"M90 141 Q100 145 110 141"}),delighted:Object.freeze({label:"Delighted",brows:Object.freeze(["M62 86 Q78 78 92 86","M108 86 Q122 78 138 86"]),mouth:"M82 136 Q100 160 118 136",eyes:"arc"}),reverent:Object.freeze({label:"Reverent",brows:Object.freeze(["M64 94 Q78 88 90 94","M110 94 Q122 88 136 94"]),mouth:"M90 140 Q100 144 110 140",eyes:"closed"}),weary:Object.freeze({label:"Weary",brows:Object.freeze(["M62 92 Q78 96 92 100","M108 100 Q122 96 138 92"]),mouth:"M88 146 Q100 142 112 146"})}),EXPRESSION_PACKS=Object.freeze({core:Object.freeze(["neutral","attentive","focused","waiting","happy","sleepy","concerned"]),trusted:Object.freeze(["warm","proud"]),companion:Object.freeze(["playful","curious"]),confidant:Object.freeze(["steady","delighted"]),archivist:Object.freeze(["reverent","weary"])}),EYE_OVERRIDES=Object.freeze({arc:Object.freeze([Object.freeze({kind:"path",d:"M66 108 Q78 96 90 108",role:"ink"}),Object.freeze({kind:"path",d:"M110 108 Q122 96 134 108",role:"ink"})]),closed:Object.freeze([Object.freeze({kind:"path",d:"M66 106 H90",role:"ink"}),Object.freeze({kind:"path",d:"M110 106 H134",role:"ink"})])}),OUTFITS=Object.freeze({hoodie:Object.freeze({label:"Hoodie",under:Object.freeze([]),over:Object.freeze([Object.freeze({kind:"path",d:"M56 192 Q100 174 144 192 V262 H56 Z"}),Object.freeze({kind:"path",d:"M78 178 Q100 196 122 178 L134 190 Q100 212 66 190 Z",role:"clothShade"}),Object.freeze({kind:"path",d:"M74 214 H126 V240 H74 Z",role:"clothShade"}),Object.freeze({kind:"path",d:"M96 196 V214 M104 196 V214",role:"metal"})])}),tshirt:Object.freeze({label:"T-shirt",under:Object.freeze([]),over:Object.freeze([Object.freeze({kind:"path",d:"M56 192 Q100 176 144 192 V262 H56 Z",role:"accent"}),Object.freeze({kind:"path",d:"M84 182 Q100 194 116 182 L120 188 Q100 200 80 188 Z",role:"clothShade"})])}),flannel:Object.freeze({label:"Flannel",under:Object.freeze([]),over:Object.freeze([Object.freeze({kind:"path",d:"M56 192 Q100 176 144 192 V262 H56 Z"}),Object.freeze({kind:"path",d:"M70 196 V262 M88 194 V262 M112 194 V262 M130 196 V262",role:"clothShade"}),Object.freeze({kind:"path",d:"M56 214 H144 M56 236 H144",role:"accent"}),Object.freeze({kind:"path",d:"M84 182 L100 200 L116 182 L124 190 L100 214 L76 190 Z",role:"clothShade"})])}),jacket:Object.freeze({label:"Jacket",under:Object.freeze([]),over:Object.freeze([Object.freeze({kind:"path",d:"M54 190 Q100 172 146 190 V262 H54 Z"}),Object.freeze({kind:"path",d:"M54 190 L100 214 L146 190 L146 200 L100 224 L54 200 Z",role:"clothShade"}),Object.freeze({kind:"path",d:"M100 214 V262",role:"metal"})])}),headphones:Object.freeze({label:"Headphones",under:Object.freeze([]),over:Object.freeze([Object.freeze({kind:"path",d:"M46 96 Q46 30 100 30 Q154 30 154 96",role:"metal"}),Object.freeze({kind:"rect",x:34,y:88,width:22,height:34,rx:8}),Object.freeze({kind:"rect",x:144,y:88,width:22,height:34,rx:8}),Object.freeze({kind:"circle",cx:45,cy:105,r:6,role:"accent"}),Object.freeze({kind:"circle",cx:155,cy:105,r:6,role:"accent"})]),accessory:!0}),glasses:Object.freeze({label:"Glasses",under:Object.freeze([]),over:Object.freeze([Object.freeze({kind:"rect",x:60,y:96,width:40,height:26,rx:8,role:"metal"}),Object.freeze({kind:"rect",x:100,y:96,width:40,height:26,rx:8,role:"metal"}),Object.freeze({kind:"path",d:"M100 106 H100 M60 104 L44 100 M140 104 L156 100",role:"metal"})]),accessory:!0}),scarf:Object.freeze({label:"Scarf",under:Object.freeze([]),over:Object.freeze([Object.freeze({kind:"path",d:"M72 172 Q100 190 128 172 L134 190 Q100 208 66 190 Z",role:"accent"}),Object.freeze({kind:"path",d:"M112 190 L128 236 L112 240 L98 194 Z",role:"accent"})])}),apron:Object.freeze({label:"Apron",under:Object.freeze([]),over:Object.freeze([Object.freeze({kind:"path",d:"M74 200 H126 V262 H74 Z",role:"clothShade"}),Object.freeze({kind:"path",d:"M80 190 L92 200 M120 190 L108 200",role:"metal"}),Object.freeze({kind:"path",d:"M80 228 H120",role:"accent"})])}),"seasonal-winter":Object.freeze({label:"Winter set",under:Object.freeze([]),over:Object.freeze([Object.freeze({kind:"path",d:"M44 74 Q100 44 156 74 L156 88 Q100 60 44 88 Z",role:"accent"}),Object.freeze({kind:"circle",cx:100,cy:40,r:12,role:"accent"}),Object.freeze({kind:"path",d:"M72 172 Q100 190 128 172 L134 190 Q100 208 66 190 Z",role:"clothShade"})])}),"archive-coat":Object.freeze({label:"Archive coat",under:Object.freeze([]),over:Object.freeze([Object.freeze({kind:"path",d:"M50 188 Q100 168 150 188 V262 H50 Z"}),Object.freeze({kind:"path",d:"M50 188 L100 216 L150 188 L150 200 L100 228 L50 200 Z",role:"clothShade"}),Object.freeze({kind:"path",d:"M56 222 H144 V234 H56 Z",role:"metal"}),Object.freeze({kind:"path",d:"M100 228 V262",role:"metal"})])})}),LABELS=Object.freeze({frame:Object.freeze({A:"Round",B:"Square",C:"Oval"}),hair:Object.freeze(Object.fromEntries(Object.entries(HAIR).map((([e,r])=>[e,r.label])))),eyes:Object.freeze(Object.fromEntries(Object.entries(EYES).map((([e,r])=>[e,r.label])))),outfit:Object.freeze(Object.fromEntries(Object.entries(OUTFITS).map((([e,r])=>[e,r.label])))),palette:Object.freeze({amber:"Amber",slate:"Slate",moss:"Moss",plum:"Plum",mono:"Mono",sunset:"Sunset"}),expressionPack:Object.freeze({core:"Core",trusted:"Trusted",companion:"Companion",confidant:"Confidant",archivist:"Archivist"}),skin:Object.freeze({0:"Tone 1",1:"Tone 2",2:"Tone 3",3:"Tone 4",4:"Tone 5",5:"Tone 6"})}),IDS=PERSONA?PERSONA.PARTS:Object.freeze({});function defaultPersona(){if(!PERSONA)throw new Error("avatar/parts.js: the shared persona module is not loaded");return PERSONA.defaultPersona()}function motionFor(e,r){if(!PERSONA)return r?"minimal":"full";const t=e&&e.appearance?e:defaultPersona();return PERSONA.appliesMotion(t,Boolean(r))}function expressionsFor(e){const r=e&&e.expressions&&e.expressions.pack,t=EXPRESSION_PACKS[r]||[],c=EXPRESSION_PACKS.core.slice();for(const e of t)c.includes(e)||c.push(e);return c}const API=Object.freeze({LAYERS:LAYERS,IDS:IDS,SKIN_TONES:SKIN_TONES,PALETTES:PALETTES,FRAMES:FRAMES,BODY:BODY,HAIR:HAIR,EYES:EYES,FACE:FACE,EXPRESSIONS:EXPRESSIONS,EXPRESSION_PACKS:EXPRESSION_PACKS,EYE_OVERRIDES:EYE_OVERRIDES,OUTFITS:OUTFITS,LABELS:LABELS,defaultPersona:defaultPersona,motionFor:motionFor,expressionsFor:expressionsFor});"undefined"!=typeof module&&module.exports?module.exports=API:"undefined"!=typeof globalThis&&(globalThis.AegisAvatarParts=API);
@@ -1,170 +1,3 @@
1
1
  // SPDX-License-Identifier: AGPL-3.0-or-later
2
2
  // Copyright (C) 2026 Niklas Borneklint — AEGIS Code (aegiscode) / Aegiscloud.
3
- // AEGIS Code (aegiscode) — source: https://github.com/aegisinfo/aegiscode-plugin
4
- // Conveying a modified copy, or running one as a network service, owes the
5
- // corresponding source under this licence (§5/§13) — see LICENSING.md.
6
- 'use strict';
7
-
8
- /**
9
- * budget.js — what a request is sized by.
10
- *
11
- * Two questions live here, and only one of them is a budget:
12
- *
13
- * 1. `maxTokensCeiling(meta)` — how many output tokens the SELECTED MODEL
14
- * says it can produce. Display-only: it prints "max output: N" in the
15
- * Model hint. It is a property of the model discovered from the catalog,
16
- * never a number this app puts on a request. (Kept for that one line;
17
- * it decided a request's ceiling until the "Max tokens" dropdown below
18
- * was removed.)
19
- * 2. `budgetFor(model, stated, effort)` — the token budget a request
20
- * actually travels with, or `undefined` for "state none".
21
- *
22
- * There used to be a third thing: a "Max tokens" dropdown (1k/4k/16k/64k/300k
23
- * plus an "adaptive" checkbox) that asked the user to state, before sending,
24
- * how long the answer would be. Output length cannot be predicted from a
25
- * prompt — it is a guess at text nobody has written yet — and the guess was
26
- * wrong in both directions:
27
- *
28
- * - it was ignored exactly where it mattered. The pooled Aegis Cloud class
29
- * is sized server-side from `effort` (aegis1 services/pool_brain.py
30
- * pass_budgets: low/medium/high -> 16384/32768/65536 tokens total across
31
- * the worker fan-out), and the server reads a body max_tokens as a ceiling
32
- * OVER that ladder — so the number on screen was never the budget the call
33
- * ran on;
34
- * - it was obeyed exactly where it hurt. A DeepSeek reasoning model bills
35
- * hidden chain-of-thought against the SAME budget as its answer, so the
36
- * 4k default was spent before the first visible token and the turn came
37
- * back empty — no error, no tool call, just a turn that "completed" with
38
- * nothing.
39
- *
40
- * So the number is gone, and what a call is sized by is derived from effort.
41
- * This file mirrors desktop/lib/local/engine.js (DEEPSEEK_REASONING_MODEL_RE,
42
- * EFFORT_TOKEN_BUDGET, the stated-cap-wins rule) and keeps it a PURE function
43
- * for one reason: test/budget.test.mjs requires both copies and asserts they
44
- * answer identically over a table of cases, so the mirror cannot drift
45
- * silently — which is how the two copies of aegis1's ladder came to disagree
46
- * in the first place (974adc5).
47
- */
48
-
49
- /** The flat ceiling, for a model whose catalog entry reports no `max_output`. */
50
- const FLAT_CEILING = 300000;
51
-
52
- /**
53
- * The model's own output limit, for the Model hint ("max output: N").
54
- *
55
- * Clamped to FLAT_CEILING because a provider's advertised limit can exceed
56
- * anything worth displaying, and falls back to the flat ceiling when no
57
- * per-model metadata is known — the only two states that matter for a line of
58
- * explanatory text.
59
- *
60
- * NOT a request ceiling. Nothing here reads this to size a call.
61
- */
62
- function maxTokensCeiling(meta) {
63
- const raw = meta && Number(meta.max_output);
64
- return Number.isFinite(raw) && raw > 0 ? Math.min(FLAT_CEILING, raw) : FLAT_CEILING;
65
- }
66
-
67
- /**
68
- * DeepSeek's reasoning models, which spend part of the budget on hidden
69
- * chain-of-thought before emitting a single visible token — DeepSeek counts
70
- * those tokens against the SAME budget as the answer.
71
- *
72
- * Covers the 4.1 family (`deepseek-flash`, i.e. "Flash 4.1", and
73
- * `deepseek-v4.1-flash`), the ids the picker used to advertise
74
- * (`deepseek-v4-flash`, `deepseek-v4-pro`) and the deprecated
75
- * `deepseek-reasoner`. Mirrors DEEPSEEK_REASONING_MODEL_RE in
76
- * desktop/lib/local/engine.js verbatim — test/budget.test.mjs compares the two.
77
- */
78
- const DEEPSEEK_REASONING_MODEL_RE = /^deepseek-(v4(\.\d+)?-(flash|pro)|flash|pro|reasoner)$/;
79
-
80
- /**
81
- * Effort rung -> tokens. Mirrors EFFORT_TOKEN_BUDGET in
82
- * desktop/lib/local/engine.js, which mirrors the upstream engine's src/backend.js.
83
- *
84
- * These are the numbers the models whose output length cannot be predicted are
85
- * sized by, which is why the rung replaced the dropdown: a rung is a
86
- * decision about how hard to think, and it is the same decision the engine and
87
- * the server already make.
88
- */
89
- const EFFORT_TOKEN_BUDGET = { low: 8192, medium: 16384, high: 32768 };
90
-
91
- /**
92
- * DeepSeek native reasoning level per config rung.
93
- *
94
- * The field is `effort`, not `reasoning_effort`. Measured live 2026-10-21 on the
95
- * surface this client actually reaches (the relay's
96
- * `https://api.deepseek.com/anthropic` transport), interleaved paired samples,
97
- * n=12, output tokens: absent 818 · low 772 · medium 836 · high 818 · max 1494.
98
- * Only `max` separates from sending nothing, and `GET /models` reports
99
- * `supported_levels: ["low","high","max"]` on both live ids — so `medium` is
100
- * not a level these models have, and it is folded upward here rather than sent
101
- * to be absorbed into the vendor's default (a 200 that changes nothing, which
102
- * is the one failure this knob cannot surface). `max` stays unreachable: it is
103
- * not a rung of this knob.
104
- *
105
- * Mirrors DEEPSEEK_EFFORT in desktop/lib/local/engine.js — carried here so the
106
- * no-drift guarantee for DEEPSEEK_REASONING_MODEL_RE and EFFORT_TOKEN_BUDGET
107
- * extends to the wire knob too. That guard was missing, which is how the two
108
- * copies agreed on a field name that reached no vendor at all.
109
- */
110
- const DEEPSEEK_EFFORT = { low: 'low', medium: 'high', high: 'high' };
111
-
112
- /**
113
- * There is no longer a "class that requires a stated max_tokens".
114
- *
115
- * That set held exactly one entry — `anthropic`, the direct-dial class that
116
- * spoke the Messages API itself, which rejects a request with no `max_tokens`.
117
- * That class is gone: the survivors are `aegis`, whose pooled path lets the
118
- * server size the budget (aegis1's pass_budgets ladder), and `byok`, which
119
- * reaches its upstream provider through the AEGIS relay — the relay owns the
120
- * upstream wire format, so the requirement is no longer this client's to
121
- * satisfy. A stated number is therefore only ever the caller's own.
122
- */
123
-
124
- /** An unknown or "auto" rung falls to the top: the same default the engine
125
- * and the upstream engine apply, so "auto" cannot silently mean "smallest". */
126
- function effortRung(effort) {
127
- return effort === 'low' || effort === 'medium' ? effort : 'high';
128
- }
129
-
130
- /**
131
- * The budget a request travels with.
132
- *
133
- * EXACTLY ONE authority per call, in this order:
134
- *
135
- * 1. a number the caller STATED (`stated`) is returned verbatim — a
136
- * deliberate cap is a liability ceiling and is never raised or lowered by
137
- * a rung;
138
- * 2. otherwise a model that reasons against its own output budget gets the
139
- * effort rung;
140
- * 3. otherwise `undefined`: no `max_tokens` is sent at all and the
141
- * provider's own output limit governs. Stating a number here was the
142
- * whole defect — `max_tokens: 4096` invented by the transport meant a
143
- * DeepSeek model answered nothing, with no error to explain it.
144
- *
145
- * No `cls` parameter: it has no bearing on the answer any more. When a class
146
- * could change the outcome (the removed `anthropic` direct-dial lane) the
147
- * engine's `reasoningBudget()` took it too, and the two must stay one
148
- * authority — a parameter that no longer selects anything is how the next
149
- * class-dependent rule gets added to one copy and not the other.
150
- */
151
- function budgetFor(model, stated, effort) {
152
- const n = Number(stated);
153
- if (Number.isFinite(n) && n > 0) return n;
154
- if (DEEPSEEK_REASONING_MODEL_RE.test(String(model || ''))) {
155
- return EFFORT_TOKEN_BUDGET[effortRung(effort)];
156
- }
157
- return undefined;
158
- }
159
-
160
- if (typeof module !== 'undefined' && module.exports) {
161
- module.exports = {
162
- budgetFor,
163
- effortRung,
164
- maxTokensCeiling,
165
- FLAT_CEILING,
166
- EFFORT_TOKEN_BUDGET,
167
- DEEPSEEK_EFFORT,
168
- DEEPSEEK_REASONING_MODEL_RE,
169
- };
170
- }
3
+ "use strict";const FLAT_CEILING=3e5;function maxTokensCeiling(E){const e=E&&Number(E.max_output);return Number.isFinite(e)&&e>0?Math.min(3e5,e):3e5}const DEEPSEEK_REASONING_MODEL_RE=/^deepseek-(v4(\.\d+)?-(flash|pro)|flash|pro|reasoner)$/,EFFORT_TOKEN_BUDGET={low:8192,medium:16384,high:32768},DEEPSEEK_EFFORT={low:"low",medium:"high",high:"high"};function effortRung(E){return"low"===E||"medium"===E?E:"high"}function budgetFor(E,e,o){const n=Number(e);return Number.isFinite(n)&&n>0?n:DEEPSEEK_REASONING_MODEL_RE.test(String(E||""))?EFFORT_TOKEN_BUDGET[effortRung(o)]:void 0}"undefined"!=typeof module&&module.exports&&(module.exports={budgetFor:budgetFor,effortRung:effortRung,maxTokensCeiling:maxTokensCeiling,FLAT_CEILING:3e5,EFFORT_TOKEN_BUDGET:EFFORT_TOKEN_BUDGET,DEEPSEEK_EFFORT:DEEPSEEK_EFFORT,DEEPSEEK_REASONING_MODEL_RE:DEEPSEEK_REASONING_MODEL_RE});