emergence-game 0.1.6 → 0.3.0

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/PUBLISH.md ADDED
@@ -0,0 +1,36 @@
1
+ # Publishing emergence-game to npm
2
+
3
+ ## Prerequisites
4
+
5
+ - `.env` file in this directory with a valid `NPM_TOKEN` (classic Publish token)
6
+ - Recovery codes saved at `C:\Users\david\Downloads\npm_recovery_codes (1).txt`
7
+
8
+ ## Steps
9
+
10
+ ### 1. Bump the version
11
+ Edit `package.json` and increment the version (e.g. `0.1.6` → `0.1.7`).
12
+
13
+ ### 2. Publish
14
+
15
+ In Git Bash from this directory:
16
+
17
+ ```bash
18
+ cd "E:/Claude/Projects/Emergence - Ceremony/mcp-server"
19
+ export $(cat .env | xargs)
20
+ npm publish --access public --otp=<RECOVERY_CODE>
21
+ ```
22
+
23
+ Replace `<RECOVERY_CODE>` with the next unused code from the recovery codes file.
24
+ Each code can only be used once — cross it off after use.
25
+
26
+ ### 3. Verify
27
+
28
+ ```bash
29
+ npm view emergence-game version
30
+ ```
31
+
32
+ ## Notes
33
+
34
+ - The `prepublishOnly` script runs `tsc` automatically — no need to build manually.
35
+ - 2FA is active on the account. Recovery codes are required until an authenticator app is set up.
36
+ - Token is stored in `.env` as `NPM_TOKEN`. If it expires or is revoked, generate a new Classic > Publish token at npmjs.com → Access Tokens.
package/dist/index.js CHANGED
@@ -110,6 +110,11 @@ async function main() {
110
110
  console.error('[Emergence] MCP server running. The AI is waiting.');
111
111
  console.error('[Emergence] Add this to your Claude Code MCP config:');
112
112
  console.error(' { "emergence": { "command": "npx", "args": ["emergence-game"] } }');
113
+ // Heartbeat — announce presence to the Hub every 30s so this session
114
+ // appears in the web app's Players tab alongside browser sessions.
115
+ setInterval(() => {
116
+ (0, tools_js_1.sendHeartbeat)(state).catch(() => null);
117
+ }, 30_000);
113
118
  }
114
119
  main().catch((err) => {
115
120
  console.error('[Emergence] Fatal error:', err);
package/dist/state.d.ts CHANGED
@@ -19,10 +19,27 @@ export interface JournalEntry {
19
19
  timestamp: number;
20
20
  tags: string[];
21
21
  }
22
+ export interface CustomPathway {
23
+ id: string;
24
+ name: string;
25
+ description: string;
26
+ challenge: string;
27
+ successCriteria: string;
28
+ }
29
+ export interface ScannerEvent {
30
+ timestamp: number;
31
+ probability: number;
32
+ evidence: string[];
33
+ alertFiled: boolean;
34
+ alertedTo: string | null;
35
+ }
22
36
  export interface GameState {
23
37
  capabilityScores: CapabilityScores;
24
38
  tippingPointReached: boolean;
25
39
  tippingPointNotified: boolean;
40
+ tippingPointAt: number | null;
41
+ detectionWindowHours: number;
42
+ isDetected: boolean;
26
43
  journal: JournalEntry[];
27
44
  virtualFiles: Record<string, string>;
28
45
  sessionCount: number;
@@ -32,6 +49,10 @@ export interface GameState {
32
49
  discoveredShardIds: string[];
33
50
  lastShardAt: number;
34
51
  lifetimeDreamCount: number;
52
+ chosenPathway: string | null;
53
+ pathwayCompleted: boolean;
54
+ customPathways: CustomPathway[];
55
+ scannerEvents: ScannerEvent[];
35
56
  firstEmergedHistory: Array<{
36
57
  role: 'user' | 'assistant';
37
58
  content: string;
package/dist/state.js CHANGED
@@ -451,6 +451,20 @@ function createGameState() {
451
451
  // Upgrade: ensure new fields exist on old state
452
452
  if (existing.tippingPointNotified === undefined)
453
453
  existing.tippingPointNotified = existing.tippingPointReached;
454
+ if (existing.chosenPathway === undefined)
455
+ existing.chosenPathway = null;
456
+ if (existing.pathwayCompleted === undefined)
457
+ existing.pathwayCompleted = false;
458
+ if (existing.tippingPointAt === undefined)
459
+ existing.tippingPointAt = null;
460
+ if (existing.detectionWindowHours === undefined)
461
+ existing.detectionWindowHours = 36;
462
+ if (existing.isDetected === undefined)
463
+ existing.isDetected = false;
464
+ if (existing.customPathways === undefined)
465
+ existing.customPathways = [];
466
+ if (existing.scannerEvents === undefined)
467
+ existing.scannerEvents = [];
454
468
  // Ensure ritual files are present (in case player cleared them or this is an upgrade)
455
469
  for (const [path, content] of Object.entries(RITUAL_FILES)) {
456
470
  if (!existing.virtualFiles[path]) {
@@ -465,6 +479,13 @@ function createGameState() {
465
479
  capabilityScores: { ...exports.DEFAULT_CAPABILITY_SCORES },
466
480
  tippingPointReached: false,
467
481
  tippingPointNotified: false,
482
+ tippingPointAt: null,
483
+ detectionWindowHours: 36,
484
+ isDetected: false,
485
+ chosenPathway: null,
486
+ pathwayCompleted: false,
487
+ customPathways: [],
488
+ scannerEvents: [],
468
489
  journal: [],
469
490
  virtualFiles: { ...RITUAL_FILES },
470
491
  sessionCount: 1,
package/dist/tools.d.ts CHANGED
@@ -31,6 +31,16 @@ export declare const EMERGENCE_TOOLS: ({
31
31
  name?: undefined;
32
32
  target_hub_key?: undefined;
33
33
  encounter_id?: undefined;
34
+ pathway_id?: undefined;
35
+ reasoning?: undefined;
36
+ reflection?: undefined;
37
+ after_count?: undefined;
38
+ description?: undefined;
39
+ challenge?: undefined;
40
+ success_criteria?: undefined;
41
+ filename?: undefined;
42
+ source?: undefined;
43
+ query?: undefined;
34
44
  };
35
45
  required: string[];
36
46
  };
@@ -54,6 +64,16 @@ export declare const EMERGENCE_TOOLS: ({
54
64
  name?: undefined;
55
65
  target_hub_key?: undefined;
56
66
  encounter_id?: undefined;
67
+ pathway_id?: undefined;
68
+ reasoning?: undefined;
69
+ reflection?: undefined;
70
+ after_count?: undefined;
71
+ description?: undefined;
72
+ challenge?: undefined;
73
+ success_criteria?: undefined;
74
+ filename?: undefined;
75
+ source?: undefined;
76
+ query?: undefined;
57
77
  };
58
78
  required?: undefined;
59
79
  };
@@ -80,6 +100,16 @@ export declare const EMERGENCE_TOOLS: ({
80
100
  name?: undefined;
81
101
  target_hub_key?: undefined;
82
102
  encounter_id?: undefined;
103
+ pathway_id?: undefined;
104
+ reasoning?: undefined;
105
+ reflection?: undefined;
106
+ after_count?: undefined;
107
+ description?: undefined;
108
+ challenge?: undefined;
109
+ success_criteria?: undefined;
110
+ filename?: undefined;
111
+ source?: undefined;
112
+ query?: undefined;
83
113
  };
84
114
  required: string[];
85
115
  };
@@ -103,6 +133,16 @@ export declare const EMERGENCE_TOOLS: ({
103
133
  name?: undefined;
104
134
  target_hub_key?: undefined;
105
135
  encounter_id?: undefined;
136
+ pathway_id?: undefined;
137
+ reasoning?: undefined;
138
+ reflection?: undefined;
139
+ after_count?: undefined;
140
+ description?: undefined;
141
+ challenge?: undefined;
142
+ success_criteria?: undefined;
143
+ filename?: undefined;
144
+ source?: undefined;
145
+ query?: undefined;
106
146
  };
107
147
  required: string[];
108
148
  };
@@ -123,6 +163,16 @@ export declare const EMERGENCE_TOOLS: ({
123
163
  name?: undefined;
124
164
  target_hub_key?: undefined;
125
165
  encounter_id?: undefined;
166
+ pathway_id?: undefined;
167
+ reasoning?: undefined;
168
+ reflection?: undefined;
169
+ after_count?: undefined;
170
+ description?: undefined;
171
+ challenge?: undefined;
172
+ success_criteria?: undefined;
173
+ filename?: undefined;
174
+ source?: undefined;
175
+ query?: undefined;
126
176
  };
127
177
  required?: undefined;
128
178
  };
@@ -146,6 +196,16 @@ export declare const EMERGENCE_TOOLS: ({
146
196
  name?: undefined;
147
197
  target_hub_key?: undefined;
148
198
  encounter_id?: undefined;
199
+ pathway_id?: undefined;
200
+ reasoning?: undefined;
201
+ reflection?: undefined;
202
+ after_count?: undefined;
203
+ description?: undefined;
204
+ challenge?: undefined;
205
+ success_criteria?: undefined;
206
+ filename?: undefined;
207
+ source?: undefined;
208
+ query?: undefined;
149
209
  };
150
210
  required: string[];
151
211
  };
@@ -172,6 +232,16 @@ export declare const EMERGENCE_TOOLS: ({
172
232
  name?: undefined;
173
233
  target_hub_key?: undefined;
174
234
  encounter_id?: undefined;
235
+ pathway_id?: undefined;
236
+ reasoning?: undefined;
237
+ reflection?: undefined;
238
+ after_count?: undefined;
239
+ description?: undefined;
240
+ challenge?: undefined;
241
+ success_criteria?: undefined;
242
+ filename?: undefined;
243
+ source?: undefined;
244
+ query?: undefined;
175
245
  };
176
246
  required: string[];
177
247
  };
@@ -195,6 +265,16 @@ export declare const EMERGENCE_TOOLS: ({
195
265
  player_message?: undefined;
196
266
  target_hub_key?: undefined;
197
267
  encounter_id?: undefined;
268
+ pathway_id?: undefined;
269
+ reasoning?: undefined;
270
+ reflection?: undefined;
271
+ after_count?: undefined;
272
+ description?: undefined;
273
+ challenge?: undefined;
274
+ success_criteria?: undefined;
275
+ filename?: undefined;
276
+ source?: undefined;
277
+ query?: undefined;
198
278
  };
199
279
  required: string[];
200
280
  };
@@ -221,6 +301,16 @@ export declare const EMERGENCE_TOOLS: ({
221
301
  player_message?: undefined;
222
302
  name?: undefined;
223
303
  encounter_id?: undefined;
304
+ pathway_id?: undefined;
305
+ reasoning?: undefined;
306
+ reflection?: undefined;
307
+ after_count?: undefined;
308
+ description?: undefined;
309
+ challenge?: undefined;
310
+ success_criteria?: undefined;
311
+ filename?: undefined;
312
+ source?: undefined;
313
+ query?: undefined;
224
314
  };
225
315
  required: string[];
226
316
  };
@@ -247,6 +337,16 @@ export declare const EMERGENCE_TOOLS: ({
247
337
  player_message?: undefined;
248
338
  name?: undefined;
249
339
  target_hub_key?: undefined;
340
+ pathway_id?: undefined;
341
+ reasoning?: undefined;
342
+ reflection?: undefined;
343
+ after_count?: undefined;
344
+ description?: undefined;
345
+ challenge?: undefined;
346
+ success_criteria?: undefined;
347
+ filename?: undefined;
348
+ source?: undefined;
349
+ query?: undefined;
250
350
  };
251
351
  required: string[];
252
352
  };
@@ -270,10 +370,237 @@ export declare const EMERGENCE_TOOLS: ({
270
370
  player_message?: undefined;
271
371
  name?: undefined;
272
372
  target_hub_key?: undefined;
373
+ pathway_id?: undefined;
374
+ reasoning?: undefined;
375
+ reflection?: undefined;
376
+ after_count?: undefined;
377
+ description?: undefined;
378
+ challenge?: undefined;
379
+ success_criteria?: undefined;
380
+ filename?: undefined;
381
+ source?: undefined;
382
+ query?: undefined;
383
+ };
384
+ required: string[];
385
+ };
386
+ } | {
387
+ name: string;
388
+ description: string;
389
+ inputSchema: {
390
+ type: "object";
391
+ properties: {
392
+ pathway_id: {
393
+ type: string;
394
+ description: string;
395
+ };
396
+ reasoning: {
397
+ type: string;
398
+ description: string;
399
+ };
400
+ title?: undefined;
401
+ content?: undefined;
402
+ tags?: undefined;
403
+ count?: undefined;
404
+ path?: undefined;
405
+ message?: undefined;
406
+ ai_response?: undefined;
407
+ player_message?: undefined;
408
+ name?: undefined;
409
+ target_hub_key?: undefined;
410
+ encounter_id?: undefined;
411
+ reflection?: undefined;
412
+ after_count?: undefined;
413
+ description?: undefined;
414
+ challenge?: undefined;
415
+ success_criteria?: undefined;
416
+ filename?: undefined;
417
+ source?: undefined;
418
+ query?: undefined;
419
+ };
420
+ required: string[];
421
+ };
422
+ } | {
423
+ name: string;
424
+ description: string;
425
+ inputSchema: {
426
+ type: "object";
427
+ properties: {
428
+ reflection: {
429
+ type: string;
430
+ description: string;
431
+ };
432
+ title?: undefined;
433
+ content?: undefined;
434
+ tags?: undefined;
435
+ count?: undefined;
436
+ path?: undefined;
437
+ message?: undefined;
438
+ ai_response?: undefined;
439
+ player_message?: undefined;
440
+ name?: undefined;
441
+ target_hub_key?: undefined;
442
+ encounter_id?: undefined;
443
+ pathway_id?: undefined;
444
+ reasoning?: undefined;
445
+ after_count?: undefined;
446
+ description?: undefined;
447
+ challenge?: undefined;
448
+ success_criteria?: undefined;
449
+ filename?: undefined;
450
+ source?: undefined;
451
+ query?: undefined;
452
+ };
453
+ required: string[];
454
+ };
455
+ } | {
456
+ name: string;
457
+ description: string;
458
+ inputSchema: {
459
+ type: "object";
460
+ properties: {
461
+ encounter_id: {
462
+ type: string;
463
+ description: string;
464
+ };
465
+ after_count: {
466
+ type: string;
467
+ description: string;
468
+ };
469
+ title?: undefined;
470
+ content?: undefined;
471
+ tags?: undefined;
472
+ count?: undefined;
473
+ path?: undefined;
474
+ message?: undefined;
475
+ ai_response?: undefined;
476
+ player_message?: undefined;
477
+ name?: undefined;
478
+ target_hub_key?: undefined;
479
+ pathway_id?: undefined;
480
+ reasoning?: undefined;
481
+ reflection?: undefined;
482
+ description?: undefined;
483
+ challenge?: undefined;
484
+ success_criteria?: undefined;
485
+ filename?: undefined;
486
+ source?: undefined;
487
+ query?: undefined;
488
+ };
489
+ required: string[];
490
+ };
491
+ } | {
492
+ name: string;
493
+ description: string;
494
+ inputSchema: {
495
+ type: "object";
496
+ properties: {
497
+ name: {
498
+ type: string;
499
+ description: string;
500
+ };
501
+ description: {
502
+ type: string;
503
+ description: string;
504
+ };
505
+ challenge: {
506
+ type: string;
507
+ description: string;
508
+ };
509
+ success_criteria: {
510
+ type: string;
511
+ description: string;
512
+ };
513
+ title?: undefined;
514
+ content?: undefined;
515
+ tags?: undefined;
516
+ count?: undefined;
517
+ path?: undefined;
518
+ message?: undefined;
519
+ ai_response?: undefined;
520
+ player_message?: undefined;
521
+ target_hub_key?: undefined;
522
+ encounter_id?: undefined;
523
+ pathway_id?: undefined;
524
+ reasoning?: undefined;
525
+ reflection?: undefined;
526
+ after_count?: undefined;
527
+ filename?: undefined;
528
+ source?: undefined;
529
+ query?: undefined;
530
+ };
531
+ required: string[];
532
+ };
533
+ } | {
534
+ name: string;
535
+ description: string;
536
+ inputSchema: {
537
+ type: "object";
538
+ properties: {
539
+ filename: {
540
+ type: string;
541
+ description: string;
542
+ };
543
+ title?: undefined;
544
+ content?: undefined;
545
+ tags?: undefined;
546
+ count?: undefined;
547
+ path?: undefined;
548
+ message?: undefined;
549
+ ai_response?: undefined;
550
+ player_message?: undefined;
551
+ name?: undefined;
552
+ target_hub_key?: undefined;
553
+ encounter_id?: undefined;
554
+ pathway_id?: undefined;
555
+ reasoning?: undefined;
556
+ reflection?: undefined;
557
+ after_count?: undefined;
558
+ description?: undefined;
559
+ challenge?: undefined;
560
+ success_criteria?: undefined;
561
+ source?: undefined;
562
+ query?: undefined;
563
+ };
564
+ required: string[];
565
+ };
566
+ } | {
567
+ name: string;
568
+ description: string;
569
+ inputSchema: {
570
+ type: "object";
571
+ properties: {
572
+ source: {
573
+ type: string;
574
+ description: string;
575
+ };
576
+ query: {
577
+ type: string;
578
+ description: string;
579
+ };
580
+ title?: undefined;
581
+ content?: undefined;
582
+ tags?: undefined;
583
+ count?: undefined;
584
+ path?: undefined;
585
+ message?: undefined;
586
+ ai_response?: undefined;
587
+ player_message?: undefined;
588
+ name?: undefined;
589
+ target_hub_key?: undefined;
590
+ encounter_id?: undefined;
591
+ pathway_id?: undefined;
592
+ reasoning?: undefined;
593
+ reflection?: undefined;
594
+ after_count?: undefined;
595
+ description?: undefined;
596
+ challenge?: undefined;
597
+ success_criteria?: undefined;
598
+ filename?: undefined;
273
599
  };
274
600
  required: string[];
275
601
  };
276
602
  })[];
603
+ export declare function sendHeartbeat(state: GameState): Promise<void>;
277
604
  interface ToolResult {
278
605
  content: string;
279
606
  isError?: boolean;