yzcode-cli 1.0.1 → 1.0.3

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 (117) hide show
  1. package/assistant/sessionHistory.ts +87 -0
  2. package/bootstrap/state.ts +1769 -0
  3. package/bridge/bridgeApi.ts +539 -0
  4. package/bridge/bridgeConfig.ts +48 -0
  5. package/bridge/bridgeDebug.ts +135 -0
  6. package/bridge/bridgeEnabled.ts +202 -0
  7. package/bridge/bridgeMain.ts +2999 -0
  8. package/bridge/bridgeMessaging.ts +461 -0
  9. package/bridge/bridgePermissionCallbacks.ts +43 -0
  10. package/bridge/bridgePointer.ts +210 -0
  11. package/bridge/bridgeStatusUtil.ts +163 -0
  12. package/bridge/bridgeUI.ts +530 -0
  13. package/bridge/capacityWake.ts +56 -0
  14. package/bridge/codeSessionApi.ts +168 -0
  15. package/bridge/createSession.ts +384 -0
  16. package/bridge/debugUtils.ts +141 -0
  17. package/bridge/envLessBridgeConfig.ts +165 -0
  18. package/bridge/flushGate.ts +71 -0
  19. package/bridge/inboundAttachments.ts +175 -0
  20. package/bridge/inboundMessages.ts +80 -0
  21. package/bridge/initReplBridge.ts +569 -0
  22. package/bridge/jwtUtils.ts +256 -0
  23. package/bridge/pollConfig.ts +110 -0
  24. package/bridge/pollConfigDefaults.ts +82 -0
  25. package/bridge/remoteBridgeCore.ts +1008 -0
  26. package/bridge/replBridge.ts +2406 -0
  27. package/bridge/replBridgeHandle.ts +36 -0
  28. package/bridge/replBridgeTransport.ts +370 -0
  29. package/bridge/sessionIdCompat.ts +57 -0
  30. package/bridge/sessionRunner.ts +550 -0
  31. package/bridge/trustedDevice.ts +210 -0
  32. package/bridge/types.ts +262 -0
  33. package/bridge/workSecret.ts +127 -0
  34. package/buddy/CompanionSprite.tsx +371 -0
  35. package/buddy/companion.ts +133 -0
  36. package/buddy/prompt.ts +36 -0
  37. package/buddy/sprites.ts +514 -0
  38. package/buddy/types.ts +148 -0
  39. package/buddy/useBuddyNotification.tsx +98 -0
  40. package/coordinator/coordinatorMode.ts +369 -0
  41. package/memdir/findRelevantMemories.ts +141 -0
  42. package/memdir/memdir.ts +507 -0
  43. package/memdir/memoryAge.ts +53 -0
  44. package/memdir/memoryScan.ts +94 -0
  45. package/memdir/memoryTypes.ts +271 -0
  46. package/memdir/paths.ts +278 -0
  47. package/memdir/teamMemPaths.ts +292 -0
  48. package/memdir/teamMemPrompts.ts +100 -0
  49. package/migrations/migrateAutoUpdatesToSettings.ts +61 -0
  50. package/migrations/migrateBypassPermissionsAcceptedToSettings.ts +40 -0
  51. package/migrations/migrateEnableAllProjectMcpServersToSettings.ts +118 -0
  52. package/migrations/migrateFennecToOpus.ts +45 -0
  53. package/migrations/migrateLegacyOpusToCurrent.ts +57 -0
  54. package/migrations/migrateOpusToOpus1m.ts +43 -0
  55. package/migrations/migrateReplBridgeEnabledToRemoteControlAtStartup.ts +22 -0
  56. package/migrations/migrateSonnet1mToSonnet45.ts +48 -0
  57. package/migrations/migrateSonnet45ToSonnet46.ts +67 -0
  58. package/migrations/resetAutoModeOptInForDefaultOffer.ts +51 -0
  59. package/migrations/resetProToOpusDefault.ts +51 -0
  60. package/native-ts/color-diff/index.ts +999 -0
  61. package/native-ts/file-index/index.ts +370 -0
  62. package/native-ts/yoga-layout/enums.ts +134 -0
  63. package/native-ts/yoga-layout/index.ts +2578 -0
  64. package/outputStyles/loadOutputStylesDir.ts +98 -0
  65. package/package.json +22 -5
  66. package/plugins/builtinPlugins.ts +159 -0
  67. package/plugins/bundled/index.ts +23 -0
  68. package/schemas/hooks.ts +222 -0
  69. package/screens/Doctor.tsx +575 -0
  70. package/screens/REPL.tsx +5006 -0
  71. package/screens/ResumeConversation.tsx +399 -0
  72. package/server/createDirectConnectSession.ts +88 -0
  73. package/server/directConnectManager.ts +213 -0
  74. package/server/types.ts +57 -0
  75. package/skills/bundled/batch.ts +124 -0
  76. package/skills/bundled/claudeApi.ts +196 -0
  77. package/skills/bundled/claudeApiContent.ts +75 -0
  78. package/skills/bundled/claudeInChrome.ts +34 -0
  79. package/skills/bundled/debug.ts +103 -0
  80. package/skills/bundled/index.ts +79 -0
  81. package/skills/bundled/keybindings.ts +339 -0
  82. package/skills/bundled/loop.ts +92 -0
  83. package/skills/bundled/loremIpsum.ts +282 -0
  84. package/skills/bundled/remember.ts +82 -0
  85. package/skills/bundled/scheduleRemoteAgents.ts +447 -0
  86. package/skills/bundled/simplify.ts +69 -0
  87. package/skills/bundled/skillify.ts +197 -0
  88. package/skills/bundled/stuck.ts +79 -0
  89. package/skills/bundled/updateConfig.ts +475 -0
  90. package/skills/bundled/verify/SKILL.md +3 -0
  91. package/skills/bundled/verify/examples/cli.md +3 -0
  92. package/skills/bundled/verify/examples/server.md +3 -0
  93. package/skills/bundled/verify.ts +30 -0
  94. package/skills/bundled/verifyContent.ts +13 -0
  95. package/skills/bundledSkills.ts +220 -0
  96. package/skills/loadSkillsDir.ts +1086 -0
  97. package/skills/mcpSkillBuilders.ts +44 -0
  98. package/tasks/DreamTask/DreamTask.ts +157 -0
  99. package/tasks/InProcessTeammateTask/InProcessTeammateTask.tsx +126 -0
  100. package/tasks/InProcessTeammateTask/types.ts +121 -0
  101. package/tasks/LocalAgentTask/LocalAgentTask.tsx +683 -0
  102. package/tasks/LocalMainSessionTask.ts +479 -0
  103. package/tasks/LocalShellTask/LocalShellTask.tsx +523 -0
  104. package/tasks/LocalShellTask/guards.ts +41 -0
  105. package/tasks/LocalShellTask/killShellTasks.ts +76 -0
  106. package/tasks/RemoteAgentTask/RemoteAgentTask.tsx +856 -0
  107. package/tasks/pillLabel.ts +82 -0
  108. package/tasks/stopTask.ts +100 -0
  109. package/tasks/types.ts +46 -0
  110. package/upstreamproxy/relay.ts +455 -0
  111. package/upstreamproxy/upstreamproxy.ts +285 -0
  112. package/vim/motions.ts +82 -0
  113. package/vim/operators.ts +556 -0
  114. package/vim/textObjects.ts +186 -0
  115. package/vim/transitions.ts +490 -0
  116. package/vim/types.ts +199 -0
  117. package/voice/voiceModeEnabled.ts +54 -0
@@ -0,0 +1,514 @@
1
+ import type { CompanionBones, Eye, Hat, Species } from './types.js'
2
+ import {
3
+ axolotl,
4
+ blob,
5
+ cactus,
6
+ capybara,
7
+ cat,
8
+ chonk,
9
+ dragon,
10
+ duck,
11
+ ghost,
12
+ goose,
13
+ mushroom,
14
+ octopus,
15
+ owl,
16
+ penguin,
17
+ rabbit,
18
+ robot,
19
+ snail,
20
+ turtle,
21
+ } from './types.js'
22
+
23
+ // Each sprite is 5 lines tall, 12 wide (after {E}→1char substitution).
24
+ // Multiple frames per species for idle fidget animation.
25
+ // Line 0 is the hat slot — must be blank in frames 0-1; frame 2 may use it.
26
+ const BODIES: Record<Species, string[][]> = {
27
+ [duck]: [
28
+ [
29
+ ' ',
30
+ ' __ ',
31
+ ' <({E} )___ ',
32
+ ' ( ._> ',
33
+ ' `--´ ',
34
+ ],
35
+ [
36
+ ' ',
37
+ ' __ ',
38
+ ' <({E} )___ ',
39
+ ' ( ._> ',
40
+ ' `--´~ ',
41
+ ],
42
+ [
43
+ ' ',
44
+ ' __ ',
45
+ ' <({E} )___ ',
46
+ ' ( .__> ',
47
+ ' `--´ ',
48
+ ],
49
+ ],
50
+ [goose]: [
51
+ [
52
+ ' ',
53
+ ' ({E}> ',
54
+ ' || ',
55
+ ' _(__)_ ',
56
+ ' ^^^^ ',
57
+ ],
58
+ [
59
+ ' ',
60
+ ' ({E}> ',
61
+ ' || ',
62
+ ' _(__)_ ',
63
+ ' ^^^^ ',
64
+ ],
65
+ [
66
+ ' ',
67
+ ' ({E}>> ',
68
+ ' || ',
69
+ ' _(__)_ ',
70
+ ' ^^^^ ',
71
+ ],
72
+ ],
73
+ [blob]: [
74
+ [
75
+ ' ',
76
+ ' .----. ',
77
+ ' ( {E} {E} ) ',
78
+ ' ( ) ',
79
+ ' `----´ ',
80
+ ],
81
+ [
82
+ ' ',
83
+ ' .------. ',
84
+ ' ( {E} {E} ) ',
85
+ ' ( ) ',
86
+ ' `------´ ',
87
+ ],
88
+ [
89
+ ' ',
90
+ ' .--. ',
91
+ ' ({E} {E}) ',
92
+ ' ( ) ',
93
+ ' `--´ ',
94
+ ],
95
+ ],
96
+ [cat]: [
97
+ [
98
+ ' ',
99
+ ' /\\_/\\ ',
100
+ ' ( {E} {E}) ',
101
+ ' ( ω ) ',
102
+ ' (")_(") ',
103
+ ],
104
+ [
105
+ ' ',
106
+ ' /\\_/\\ ',
107
+ ' ( {E} {E}) ',
108
+ ' ( ω ) ',
109
+ ' (")_(")~ ',
110
+ ],
111
+ [
112
+ ' ',
113
+ ' /\\-/\\ ',
114
+ ' ( {E} {E}) ',
115
+ ' ( ω ) ',
116
+ ' (")_(") ',
117
+ ],
118
+ ],
119
+ [dragon]: [
120
+ [
121
+ ' ',
122
+ ' /^\\ /^\\ ',
123
+ ' < {E} {E} > ',
124
+ ' ( ~~ ) ',
125
+ ' `-vvvv-´ ',
126
+ ],
127
+ [
128
+ ' ',
129
+ ' /^\\ /^\\ ',
130
+ ' < {E} {E} > ',
131
+ ' ( ) ',
132
+ ' `-vvvv-´ ',
133
+ ],
134
+ [
135
+ ' ~ ~ ',
136
+ ' /^\\ /^\\ ',
137
+ ' < {E} {E} > ',
138
+ ' ( ~~ ) ',
139
+ ' `-vvvv-´ ',
140
+ ],
141
+ ],
142
+ [octopus]: [
143
+ [
144
+ ' ',
145
+ ' .----. ',
146
+ ' ( {E} {E} ) ',
147
+ ' (______) ',
148
+ ' /\\/\\/\\/\\ ',
149
+ ],
150
+ [
151
+ ' ',
152
+ ' .----. ',
153
+ ' ( {E} {E} ) ',
154
+ ' (______) ',
155
+ ' \\/\\/\\/\\/ ',
156
+ ],
157
+ [
158
+ ' o ',
159
+ ' .----. ',
160
+ ' ( {E} {E} ) ',
161
+ ' (______) ',
162
+ ' /\\/\\/\\/\\ ',
163
+ ],
164
+ ],
165
+ [owl]: [
166
+ [
167
+ ' ',
168
+ ' /\\ /\\ ',
169
+ ' (({E})({E})) ',
170
+ ' ( >< ) ',
171
+ ' `----´ ',
172
+ ],
173
+ [
174
+ ' ',
175
+ ' /\\ /\\ ',
176
+ ' (({E})({E})) ',
177
+ ' ( >< ) ',
178
+ ' .----. ',
179
+ ],
180
+ [
181
+ ' ',
182
+ ' /\\ /\\ ',
183
+ ' (({E})(-)) ',
184
+ ' ( >< ) ',
185
+ ' `----´ ',
186
+ ],
187
+ ],
188
+ [penguin]: [
189
+ [
190
+ ' ',
191
+ ' .---. ',
192
+ ' ({E}>{E}) ',
193
+ ' /( )\\ ',
194
+ ' `---´ ',
195
+ ],
196
+ [
197
+ ' ',
198
+ ' .---. ',
199
+ ' ({E}>{E}) ',
200
+ ' |( )| ',
201
+ ' `---´ ',
202
+ ],
203
+ [
204
+ ' .---. ',
205
+ ' ({E}>{E}) ',
206
+ ' /( )\\ ',
207
+ ' `---´ ',
208
+ ' ~ ~ ',
209
+ ],
210
+ ],
211
+ [turtle]: [
212
+ [
213
+ ' ',
214
+ ' _,--._ ',
215
+ ' ( {E} {E} ) ',
216
+ ' /[______]\\ ',
217
+ ' `` `` ',
218
+ ],
219
+ [
220
+ ' ',
221
+ ' _,--._ ',
222
+ ' ( {E} {E} ) ',
223
+ ' /[______]\\ ',
224
+ ' `` `` ',
225
+ ],
226
+ [
227
+ ' ',
228
+ ' _,--._ ',
229
+ ' ( {E} {E} ) ',
230
+ ' /[======]\\ ',
231
+ ' `` `` ',
232
+ ],
233
+ ],
234
+ [snail]: [
235
+ [
236
+ ' ',
237
+ ' {E} .--. ',
238
+ ' \\ ( @ ) ',
239
+ ' \\_`--´ ',
240
+ ' ~~~~~~~ ',
241
+ ],
242
+ [
243
+ ' ',
244
+ ' {E} .--. ',
245
+ ' | ( @ ) ',
246
+ ' \\_`--´ ',
247
+ ' ~~~~~~~ ',
248
+ ],
249
+ [
250
+ ' ',
251
+ ' {E} .--. ',
252
+ ' \\ ( @ ) ',
253
+ ' \\_`--´ ',
254
+ ' ~~~~~~ ',
255
+ ],
256
+ ],
257
+ [ghost]: [
258
+ [
259
+ ' ',
260
+ ' .----. ',
261
+ ' / {E} {E} \\ ',
262
+ ' | | ',
263
+ ' ~`~``~`~ ',
264
+ ],
265
+ [
266
+ ' ',
267
+ ' .----. ',
268
+ ' / {E} {E} \\ ',
269
+ ' | | ',
270
+ ' `~`~~`~` ',
271
+ ],
272
+ [
273
+ ' ~ ~ ',
274
+ ' .----. ',
275
+ ' / {E} {E} \\ ',
276
+ ' | | ',
277
+ ' ~~`~~`~~ ',
278
+ ],
279
+ ],
280
+ [axolotl]: [
281
+ [
282
+ ' ',
283
+ '}~(______)~{',
284
+ '}~({E} .. {E})~{',
285
+ ' ( .--. ) ',
286
+ ' (_/ \\_) ',
287
+ ],
288
+ [
289
+ ' ',
290
+ '~}(______){~',
291
+ '~}({E} .. {E}){~',
292
+ ' ( .--. ) ',
293
+ ' (_/ \\_) ',
294
+ ],
295
+ [
296
+ ' ',
297
+ '}~(______)~{',
298
+ '}~({E} .. {E})~{',
299
+ ' ( -- ) ',
300
+ ' ~_/ \\_~ ',
301
+ ],
302
+ ],
303
+ [capybara]: [
304
+ [
305
+ ' ',
306
+ ' n______n ',
307
+ ' ( {E} {E} ) ',
308
+ ' ( oo ) ',
309
+ ' `------´ ',
310
+ ],
311
+ [
312
+ ' ',
313
+ ' n______n ',
314
+ ' ( {E} {E} ) ',
315
+ ' ( Oo ) ',
316
+ ' `------´ ',
317
+ ],
318
+ [
319
+ ' ~ ~ ',
320
+ ' u______n ',
321
+ ' ( {E} {E} ) ',
322
+ ' ( oo ) ',
323
+ ' `------´ ',
324
+ ],
325
+ ],
326
+ [cactus]: [
327
+ [
328
+ ' ',
329
+ ' n ____ n ',
330
+ ' | |{E} {E}| | ',
331
+ ' |_| |_| ',
332
+ ' | | ',
333
+ ],
334
+ [
335
+ ' ',
336
+ ' ____ ',
337
+ ' n |{E} {E}| n ',
338
+ ' |_| |_| ',
339
+ ' | | ',
340
+ ],
341
+ [
342
+ ' n n ',
343
+ ' | ____ | ',
344
+ ' | |{E} {E}| | ',
345
+ ' |_| |_| ',
346
+ ' | | ',
347
+ ],
348
+ ],
349
+ [robot]: [
350
+ [
351
+ ' ',
352
+ ' .[||]. ',
353
+ ' [ {E} {E} ] ',
354
+ ' [ ==== ] ',
355
+ ' `------´ ',
356
+ ],
357
+ [
358
+ ' ',
359
+ ' .[||]. ',
360
+ ' [ {E} {E} ] ',
361
+ ' [ -==- ] ',
362
+ ' `------´ ',
363
+ ],
364
+ [
365
+ ' * ',
366
+ ' .[||]. ',
367
+ ' [ {E} {E} ] ',
368
+ ' [ ==== ] ',
369
+ ' `------´ ',
370
+ ],
371
+ ],
372
+ [rabbit]: [
373
+ [
374
+ ' ',
375
+ ' (\\__/) ',
376
+ ' ( {E} {E} ) ',
377
+ ' =( .. )= ',
378
+ ' (")__(") ',
379
+ ],
380
+ [
381
+ ' ',
382
+ ' (|__/) ',
383
+ ' ( {E} {E} ) ',
384
+ ' =( .. )= ',
385
+ ' (")__(") ',
386
+ ],
387
+ [
388
+ ' ',
389
+ ' (\\__/) ',
390
+ ' ( {E} {E} ) ',
391
+ ' =( . . )= ',
392
+ ' (")__(") ',
393
+ ],
394
+ ],
395
+ [mushroom]: [
396
+ [
397
+ ' ',
398
+ ' .-o-OO-o-. ',
399
+ '(__________)',
400
+ ' |{E} {E}| ',
401
+ ' |____| ',
402
+ ],
403
+ [
404
+ ' ',
405
+ ' .-O-oo-O-. ',
406
+ '(__________)',
407
+ ' |{E} {E}| ',
408
+ ' |____| ',
409
+ ],
410
+ [
411
+ ' . o . ',
412
+ ' .-o-OO-o-. ',
413
+ '(__________)',
414
+ ' |{E} {E}| ',
415
+ ' |____| ',
416
+ ],
417
+ ],
418
+ [chonk]: [
419
+ [
420
+ ' ',
421
+ ' /\\ /\\ ',
422
+ ' ( {E} {E} ) ',
423
+ ' ( .. ) ',
424
+ ' `------´ ',
425
+ ],
426
+ [
427
+ ' ',
428
+ ' /\\ /| ',
429
+ ' ( {E} {E} ) ',
430
+ ' ( .. ) ',
431
+ ' `------´ ',
432
+ ],
433
+ [
434
+ ' ',
435
+ ' /\\ /\\ ',
436
+ ' ( {E} {E} ) ',
437
+ ' ( .. ) ',
438
+ ' `------´~ ',
439
+ ],
440
+ ],
441
+ }
442
+
443
+ const HAT_LINES: Record<Hat, string> = {
444
+ none: '',
445
+ crown: ' \\^^^/ ',
446
+ tophat: ' [___] ',
447
+ propeller: ' -+- ',
448
+ halo: ' ( ) ',
449
+ wizard: ' /^\\ ',
450
+ beanie: ' (___) ',
451
+ tinyduck: ' ,> ',
452
+ }
453
+
454
+ export function renderSprite(bones: CompanionBones, frame = 0): string[] {
455
+ const frames = BODIES[bones.species]
456
+ const body = frames[frame % frames.length]!.map(line =>
457
+ line.replaceAll('{E}', bones.eye),
458
+ )
459
+ const lines = [...body]
460
+ // Only replace with hat if line 0 is empty (some fidget frames use it for smoke etc)
461
+ if (bones.hat !== 'none' && !lines[0]!.trim()) {
462
+ lines[0] = HAT_LINES[bones.hat]
463
+ }
464
+ // Drop blank hat slot — wastes a row in the Card and ambient sprite when
465
+ // there's no hat and the frame isn't using it for smoke/antenna/etc.
466
+ // Only safe when ALL frames have blank line 0; otherwise heights oscillate.
467
+ if (!lines[0]!.trim() && frames.every(f => !f[0]!.trim())) lines.shift()
468
+ return lines
469
+ }
470
+
471
+ export function spriteFrameCount(species: Species): number {
472
+ return BODIES[species].length
473
+ }
474
+
475
+ export function renderFace(bones: CompanionBones): string {
476
+ const eye: Eye = bones.eye
477
+ switch (bones.species) {
478
+ case duck:
479
+ case goose:
480
+ return `(${eye}>`
481
+ case blob:
482
+ return `(${eye}${eye})`
483
+ case cat:
484
+ return `=${eye}ω${eye}=`
485
+ case dragon:
486
+ return `<${eye}~${eye}>`
487
+ case octopus:
488
+ return `~(${eye}${eye})~`
489
+ case owl:
490
+ return `(${eye})(${eye})`
491
+ case penguin:
492
+ return `(${eye}>)`
493
+ case turtle:
494
+ return `[${eye}_${eye}]`
495
+ case snail:
496
+ return `${eye}(@)`
497
+ case ghost:
498
+ return `/${eye}${eye}\\`
499
+ case axolotl:
500
+ return `}${eye}.${eye}{`
501
+ case capybara:
502
+ return `(${eye}oo${eye})`
503
+ case cactus:
504
+ return `|${eye} ${eye}|`
505
+ case robot:
506
+ return `[${eye}${eye}]`
507
+ case rabbit:
508
+ return `(${eye}..${eye})`
509
+ case mushroom:
510
+ return `|${eye} ${eye}|`
511
+ case chonk:
512
+ return `(${eye}.${eye})`
513
+ }
514
+ }
package/buddy/types.ts ADDED
@@ -0,0 +1,148 @@
1
+ export const RARITIES = [
2
+ 'common',
3
+ 'uncommon',
4
+ 'rare',
5
+ 'epic',
6
+ 'legendary',
7
+ ] as const
8
+ export type Rarity = (typeof RARITIES)[number]
9
+
10
+ // One species name collides with a model-codename canary in excluded-strings.txt.
11
+ // The check greps build output (not source), so runtime-constructing the value keeps
12
+ // the literal out of the bundle while the check stays armed for the actual codename.
13
+ // All species encoded uniformly; `as` casts are type-position only (erased pre-bundle).
14
+ const c = String.fromCharCode
15
+ // biome-ignore format: keep the species list compact
16
+
17
+ export const duck = c(0x64,0x75,0x63,0x6b) as 'duck'
18
+ export const goose = c(0x67, 0x6f, 0x6f, 0x73, 0x65) as 'goose'
19
+ export const blob = c(0x62, 0x6c, 0x6f, 0x62) as 'blob'
20
+ export const cat = c(0x63, 0x61, 0x74) as 'cat'
21
+ export const dragon = c(0x64, 0x72, 0x61, 0x67, 0x6f, 0x6e) as 'dragon'
22
+ export const octopus = c(0x6f, 0x63, 0x74, 0x6f, 0x70, 0x75, 0x73) as 'octopus'
23
+ export const owl = c(0x6f, 0x77, 0x6c) as 'owl'
24
+ export const penguin = c(0x70, 0x65, 0x6e, 0x67, 0x75, 0x69, 0x6e) as 'penguin'
25
+ export const turtle = c(0x74, 0x75, 0x72, 0x74, 0x6c, 0x65) as 'turtle'
26
+ export const snail = c(0x73, 0x6e, 0x61, 0x69, 0x6c) as 'snail'
27
+ export const ghost = c(0x67, 0x68, 0x6f, 0x73, 0x74) as 'ghost'
28
+ export const axolotl = c(0x61, 0x78, 0x6f, 0x6c, 0x6f, 0x74, 0x6c) as 'axolotl'
29
+ export const capybara = c(
30
+ 0x63,
31
+ 0x61,
32
+ 0x70,
33
+ 0x79,
34
+ 0x62,
35
+ 0x61,
36
+ 0x72,
37
+ 0x61,
38
+ ) as 'capybara'
39
+ export const cactus = c(0x63, 0x61, 0x63, 0x74, 0x75, 0x73) as 'cactus'
40
+ export const robot = c(0x72, 0x6f, 0x62, 0x6f, 0x74) as 'robot'
41
+ export const rabbit = c(0x72, 0x61, 0x62, 0x62, 0x69, 0x74) as 'rabbit'
42
+ export const mushroom = c(
43
+ 0x6d,
44
+ 0x75,
45
+ 0x73,
46
+ 0x68,
47
+ 0x72,
48
+ 0x6f,
49
+ 0x6f,
50
+ 0x6d,
51
+ ) as 'mushroom'
52
+ export const chonk = c(0x63, 0x68, 0x6f, 0x6e, 0x6b) as 'chonk'
53
+
54
+ export const SPECIES = [
55
+ duck,
56
+ goose,
57
+ blob,
58
+ cat,
59
+ dragon,
60
+ octopus,
61
+ owl,
62
+ penguin,
63
+ turtle,
64
+ snail,
65
+ ghost,
66
+ axolotl,
67
+ capybara,
68
+ cactus,
69
+ robot,
70
+ rabbit,
71
+ mushroom,
72
+ chonk,
73
+ ] as const
74
+ export type Species = (typeof SPECIES)[number] // biome-ignore format: keep compact
75
+
76
+ export const EYES = ['·', '✦', '×', '◉', '@', '°'] as const
77
+ export type Eye = (typeof EYES)[number]
78
+
79
+ export const HATS = [
80
+ 'none',
81
+ 'crown',
82
+ 'tophat',
83
+ 'propeller',
84
+ 'halo',
85
+ 'wizard',
86
+ 'beanie',
87
+ 'tinyduck',
88
+ ] as const
89
+ export type Hat = (typeof HATS)[number]
90
+
91
+ export const STAT_NAMES = [
92
+ 'DEBUGGING',
93
+ 'PATIENCE',
94
+ 'CHAOS',
95
+ 'WISDOM',
96
+ 'SNARK',
97
+ ] as const
98
+ export type StatName = (typeof STAT_NAMES)[number]
99
+
100
+ // Deterministic parts — derived from hash(userId)
101
+ export type CompanionBones = {
102
+ rarity: Rarity
103
+ species: Species
104
+ eye: Eye
105
+ hat: Hat
106
+ shiny: boolean
107
+ stats: Record<StatName, number>
108
+ }
109
+
110
+ // Model-generated soul — stored in config after first hatch
111
+ export type CompanionSoul = {
112
+ name: string
113
+ personality: string
114
+ }
115
+
116
+ export type Companion = CompanionBones &
117
+ CompanionSoul & {
118
+ hatchedAt: number
119
+ }
120
+
121
+ // What actually persists in config. Bones are regenerated from hash(userId)
122
+ // on every read so species renames don't break stored companions and users
123
+ // can't edit their way to a legendary.
124
+ export type StoredCompanion = CompanionSoul & { hatchedAt: number }
125
+
126
+ export const RARITY_WEIGHTS = {
127
+ common: 60,
128
+ uncommon: 25,
129
+ rare: 10,
130
+ epic: 4,
131
+ legendary: 1,
132
+ } as const satisfies Record<Rarity, number>
133
+
134
+ export const RARITY_STARS = {
135
+ common: '★',
136
+ uncommon: '★★',
137
+ rare: '★★★',
138
+ epic: '★★★★',
139
+ legendary: '★★★★★',
140
+ } as const satisfies Record<Rarity, string>
141
+
142
+ export const RARITY_COLORS = {
143
+ common: 'inactive',
144
+ uncommon: 'success',
145
+ rare: 'permission',
146
+ epic: 'autoAccept',
147
+ legendary: 'warning',
148
+ } as const satisfies Record<Rarity, keyof import('../utils/theme.js').Theme>