deepthinking-mcp 2.5.5 → 2.6.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/dist/index.js +177 -12
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -442,7 +442,7 @@ Phase 3 Modes (v2.1+):
|
|
|
442
442
|
Actions:
|
|
443
443
|
- add_thought: Add a new thought to the session (default)
|
|
444
444
|
- summarize: Generate a summary of the session
|
|
445
|
-
- export: Export session in various formats (markdown, latex, json, html, jupyter)
|
|
445
|
+
- export: Export session in various formats (markdown, latex, json, html, jupyter, mermaid, dot, ascii)
|
|
446
446
|
- switch_mode: Change reasoning mode mid-session
|
|
447
447
|
- get_session: Retrieve session information
|
|
448
448
|
- recommend_mode: Get intelligent mode recommendations based on problem characteristics
|
|
@@ -709,6 +709,99 @@ Choose the mode that best fits your problem type, or use recommend_mode to get i
|
|
|
709
709
|
},
|
|
710
710
|
description: "Temporal causal/enabling relations"
|
|
711
711
|
},
|
|
712
|
+
// Game theory properties (Phase 3, v2.2)
|
|
713
|
+
players: {
|
|
714
|
+
type: "array",
|
|
715
|
+
items: {
|
|
716
|
+
type: "object",
|
|
717
|
+
properties: {
|
|
718
|
+
id: { type: "string" },
|
|
719
|
+
name: { type: "string" },
|
|
720
|
+
role: { type: "string" },
|
|
721
|
+
isRational: { type: "boolean" },
|
|
722
|
+
availableStrategies: {
|
|
723
|
+
type: "array",
|
|
724
|
+
items: { type: "string" }
|
|
725
|
+
}
|
|
726
|
+
},
|
|
727
|
+
required: ["id", "name", "isRational", "availableStrategies"]
|
|
728
|
+
},
|
|
729
|
+
description: "Players in the game"
|
|
730
|
+
},
|
|
731
|
+
strategies: {
|
|
732
|
+
type: "array",
|
|
733
|
+
items: {
|
|
734
|
+
type: "object",
|
|
735
|
+
properties: {
|
|
736
|
+
id: { type: "string" },
|
|
737
|
+
playerId: { type: "string" },
|
|
738
|
+
name: { type: "string" },
|
|
739
|
+
description: { type: "string" },
|
|
740
|
+
isPure: { type: "boolean" },
|
|
741
|
+
probability: { type: "number", minimum: 0, maximum: 1 }
|
|
742
|
+
},
|
|
743
|
+
required: ["id", "playerId", "name", "description", "isPure"]
|
|
744
|
+
},
|
|
745
|
+
description: "Available strategies"
|
|
746
|
+
},
|
|
747
|
+
payoffMatrix: {
|
|
748
|
+
type: "object",
|
|
749
|
+
properties: {
|
|
750
|
+
players: {
|
|
751
|
+
type: "array",
|
|
752
|
+
items: { type: "string" }
|
|
753
|
+
},
|
|
754
|
+
dimensions: {
|
|
755
|
+
type: "array",
|
|
756
|
+
items: { type: "number" }
|
|
757
|
+
},
|
|
758
|
+
payoffs: {
|
|
759
|
+
type: "array",
|
|
760
|
+
items: {
|
|
761
|
+
type: "object",
|
|
762
|
+
properties: {
|
|
763
|
+
strategyProfile: {
|
|
764
|
+
type: "array",
|
|
765
|
+
items: { type: "string" }
|
|
766
|
+
},
|
|
767
|
+
payoffs: {
|
|
768
|
+
type: "array",
|
|
769
|
+
items: { type: "number" }
|
|
770
|
+
}
|
|
771
|
+
},
|
|
772
|
+
required: ["strategyProfile", "payoffs"]
|
|
773
|
+
}
|
|
774
|
+
}
|
|
775
|
+
},
|
|
776
|
+
required: ["players", "dimensions", "payoffs"],
|
|
777
|
+
description: "Payoff matrix for the game"
|
|
778
|
+
},
|
|
779
|
+
// Evidential reasoning properties (Phase 3, v2.3)
|
|
780
|
+
frameOfDiscernment: {
|
|
781
|
+
type: "array",
|
|
782
|
+
items: { type: "string" },
|
|
783
|
+
description: "Frame of discernment (set of all possible hypotheses)"
|
|
784
|
+
},
|
|
785
|
+
beliefMasses: {
|
|
786
|
+
type: "array",
|
|
787
|
+
items: {
|
|
788
|
+
type: "object",
|
|
789
|
+
properties: {
|
|
790
|
+
hypothesisSet: {
|
|
791
|
+
type: "array",
|
|
792
|
+
items: { type: "string" }
|
|
793
|
+
},
|
|
794
|
+
mass: {
|
|
795
|
+
type: "number",
|
|
796
|
+
minimum: 0,
|
|
797
|
+
maximum: 1
|
|
798
|
+
},
|
|
799
|
+
justification: { type: "string" }
|
|
800
|
+
},
|
|
801
|
+
required: ["hypothesisSet", "mass", "justification"]
|
|
802
|
+
},
|
|
803
|
+
description: "Belief mass assignments (Dempster-Shafer)"
|
|
804
|
+
},
|
|
712
805
|
action: {
|
|
713
806
|
type: "string",
|
|
714
807
|
enum: ["add_thought", "summarize", "export", "switch_mode", "get_session", "recommend_mode"],
|
|
@@ -1402,23 +1495,33 @@ var SessionManager = class {
|
|
|
1402
1495
|
activeSessions;
|
|
1403
1496
|
config;
|
|
1404
1497
|
logger;
|
|
1498
|
+
storage;
|
|
1405
1499
|
/**
|
|
1406
1500
|
* Creates a new SessionManager instance
|
|
1407
1501
|
*
|
|
1408
1502
|
* @param config - Optional default configuration applied to all new sessions
|
|
1409
1503
|
* @param logLevel - Optional minimum log level (default: INFO)
|
|
1504
|
+
* @param storage - Optional persistent storage backend for sessions
|
|
1410
1505
|
*
|
|
1411
1506
|
* @example
|
|
1412
1507
|
* ```typescript
|
|
1508
|
+
* // Memory-only mode (default)
|
|
1413
1509
|
* const manager = new SessionManager({
|
|
1414
1510
|
* enableAutoSave: true,
|
|
1415
1511
|
* maxThoughtsInMemory: 500
|
|
1416
1512
|
* }, LogLevel.DEBUG);
|
|
1513
|
+
*
|
|
1514
|
+
* // With file-based persistence
|
|
1515
|
+
* import { FileSessionStore } from './storage/file-store.js';
|
|
1516
|
+
* const storage = new FileSessionStore('./sessions');
|
|
1517
|
+
* await storage.initialize();
|
|
1518
|
+
* const manager = new SessionManager({}, LogLevel.INFO, storage);
|
|
1417
1519
|
* ```
|
|
1418
1520
|
*/
|
|
1419
|
-
constructor(config, logLevel) {
|
|
1521
|
+
constructor(config, logLevel, storage) {
|
|
1420
1522
|
this.activeSessions = /* @__PURE__ */ new Map();
|
|
1421
1523
|
this.config = config || {};
|
|
1524
|
+
this.storage = storage;
|
|
1422
1525
|
this.logger = createLogger({
|
|
1423
1526
|
minLevel: logLevel || 1 /* INFO */,
|
|
1424
1527
|
enableConsole: true
|
|
@@ -1471,6 +1574,14 @@ var SessionManager = class {
|
|
|
1471
1574
|
collaborators: author ? [author] : []
|
|
1472
1575
|
};
|
|
1473
1576
|
this.activeSessions.set(sessionId, session);
|
|
1577
|
+
if (this.storage && session.config.enableAutoSave) {
|
|
1578
|
+
try {
|
|
1579
|
+
await this.storage.saveSession(session);
|
|
1580
|
+
this.logger.debug("Session persisted to storage", { sessionId });
|
|
1581
|
+
} catch (error) {
|
|
1582
|
+
this.logger.error("Failed to persist session", error, { sessionId });
|
|
1583
|
+
}
|
|
1584
|
+
}
|
|
1474
1585
|
this.logger.info("Session created", {
|
|
1475
1586
|
sessionId,
|
|
1476
1587
|
title,
|
|
@@ -1483,7 +1594,8 @@ var SessionManager = class {
|
|
|
1483
1594
|
/**
|
|
1484
1595
|
* Get a session by ID
|
|
1485
1596
|
*
|
|
1486
|
-
* Retrieves
|
|
1597
|
+
* Retrieves a session by its unique identifier. If the session is not in memory
|
|
1598
|
+
* but storage is available, it will attempt to load from storage.
|
|
1487
1599
|
*
|
|
1488
1600
|
* @param sessionId - Unique UUID v4 identifier of the session
|
|
1489
1601
|
* @returns Promise resolving to the session, or null if not found
|
|
@@ -1498,7 +1610,19 @@ var SessionManager = class {
|
|
|
1498
1610
|
* ```
|
|
1499
1611
|
*/
|
|
1500
1612
|
async getSession(sessionId) {
|
|
1501
|
-
|
|
1613
|
+
let session = this.activeSessions.get(sessionId);
|
|
1614
|
+
if (!session && this.storage) {
|
|
1615
|
+
try {
|
|
1616
|
+
session = await this.storage.loadSession(sessionId);
|
|
1617
|
+
if (session) {
|
|
1618
|
+
this.activeSessions.set(sessionId, session);
|
|
1619
|
+
this.logger.debug("Session loaded from storage", { sessionId });
|
|
1620
|
+
}
|
|
1621
|
+
} catch (error) {
|
|
1622
|
+
this.logger.error("Failed to load session from storage", error, { sessionId });
|
|
1623
|
+
}
|
|
1624
|
+
}
|
|
1625
|
+
return session || null;
|
|
1502
1626
|
}
|
|
1503
1627
|
/**
|
|
1504
1628
|
* Add a thought to a session
|
|
@@ -1549,6 +1673,14 @@ var SessionManager = class {
|
|
|
1549
1673
|
totalThoughts: session.thoughts.length
|
|
1550
1674
|
});
|
|
1551
1675
|
}
|
|
1676
|
+
if (this.storage && session.config.enableAutoSave) {
|
|
1677
|
+
try {
|
|
1678
|
+
await this.storage.saveSession(session);
|
|
1679
|
+
this.logger.debug("Session persisted after thought added", { sessionId });
|
|
1680
|
+
} catch (error) {
|
|
1681
|
+
this.logger.error("Failed to persist session", error, { sessionId });
|
|
1682
|
+
}
|
|
1683
|
+
}
|
|
1552
1684
|
this.logger.debug("Thought added", {
|
|
1553
1685
|
sessionId,
|
|
1554
1686
|
thoughtNumber: thought.thoughtNumber,
|
|
@@ -1588,6 +1720,14 @@ var SessionManager = class {
|
|
|
1588
1720
|
session.mode = newMode;
|
|
1589
1721
|
session.config.modeConfig.mode = newMode;
|
|
1590
1722
|
session.updatedAt = /* @__PURE__ */ new Date();
|
|
1723
|
+
if (this.storage && session.config.enableAutoSave) {
|
|
1724
|
+
try {
|
|
1725
|
+
await this.storage.saveSession(session);
|
|
1726
|
+
this.logger.debug("Session persisted after mode switch", { sessionId });
|
|
1727
|
+
} catch (error) {
|
|
1728
|
+
this.logger.error("Failed to persist session", error, { sessionId });
|
|
1729
|
+
}
|
|
1730
|
+
}
|
|
1591
1731
|
this.logger.info("Session mode switched", {
|
|
1592
1732
|
sessionId,
|
|
1593
1733
|
oldMode,
|
|
@@ -1599,9 +1739,10 @@ var SessionManager = class {
|
|
|
1599
1739
|
/**
|
|
1600
1740
|
* List all active sessions with metadata
|
|
1601
1741
|
*
|
|
1602
|
-
* Returns summary information for all sessions
|
|
1603
|
-
*
|
|
1742
|
+
* Returns summary information for all sessions. If storage is available,
|
|
1743
|
+
* includes both in-memory sessions and persisted sessions.
|
|
1604
1744
|
*
|
|
1745
|
+
* @param includeStoredSessions - Whether to include sessions from storage (default: true)
|
|
1605
1746
|
* @returns Promise resolving to array of session metadata
|
|
1606
1747
|
*
|
|
1607
1748
|
* @example
|
|
@@ -1612,8 +1753,8 @@ var SessionManager = class {
|
|
|
1612
1753
|
* });
|
|
1613
1754
|
* ```
|
|
1614
1755
|
*/
|
|
1615
|
-
async listSessions() {
|
|
1616
|
-
|
|
1756
|
+
async listSessions(includeStoredSessions = true) {
|
|
1757
|
+
const memoryMetadata = Array.from(this.activeSessions.values()).map((session) => ({
|
|
1617
1758
|
id: session.id,
|
|
1618
1759
|
title: session.title,
|
|
1619
1760
|
createdAt: session.createdAt,
|
|
@@ -1622,11 +1763,27 @@ var SessionManager = class {
|
|
|
1622
1763
|
mode: session.mode,
|
|
1623
1764
|
isComplete: session.isComplete
|
|
1624
1765
|
}));
|
|
1766
|
+
if (!this.storage || !includeStoredSessions) {
|
|
1767
|
+
return memoryMetadata;
|
|
1768
|
+
}
|
|
1769
|
+
try {
|
|
1770
|
+
const storedMetadata = await this.storage.listSessions();
|
|
1771
|
+
const memoryIds = new Set(memoryMetadata.map((s) => s.id));
|
|
1772
|
+
const combined = [
|
|
1773
|
+
...memoryMetadata,
|
|
1774
|
+
...storedMetadata.filter((s) => !memoryIds.has(s.id))
|
|
1775
|
+
];
|
|
1776
|
+
return combined;
|
|
1777
|
+
} catch (error) {
|
|
1778
|
+
this.logger.error("Failed to list stored sessions", error);
|
|
1779
|
+
return memoryMetadata;
|
|
1780
|
+
}
|
|
1625
1781
|
}
|
|
1626
1782
|
/**
|
|
1627
1783
|
* Delete a session
|
|
1628
1784
|
*
|
|
1629
|
-
* Removes a session from memory
|
|
1785
|
+
* Removes a session from memory and storage (if available).
|
|
1786
|
+
* This operation cannot be undone.
|
|
1630
1787
|
*
|
|
1631
1788
|
* @param sessionId - ID of the session to delete
|
|
1632
1789
|
* @returns Promise that resolves when deletion is complete
|
|
@@ -1638,15 +1795,23 @@ var SessionManager = class {
|
|
|
1638
1795
|
*/
|
|
1639
1796
|
async deleteSession(sessionId) {
|
|
1640
1797
|
const session = this.activeSessions.get(sessionId);
|
|
1641
|
-
const
|
|
1642
|
-
if (
|
|
1798
|
+
const deletedFromMemory = this.activeSessions.delete(sessionId);
|
|
1799
|
+
if (this.storage) {
|
|
1800
|
+
try {
|
|
1801
|
+
await this.storage.deleteSession(sessionId);
|
|
1802
|
+
this.logger.debug("Session deleted from storage", { sessionId });
|
|
1803
|
+
} catch (error) {
|
|
1804
|
+
this.logger.error("Failed to delete session from storage", error, { sessionId });
|
|
1805
|
+
}
|
|
1806
|
+
}
|
|
1807
|
+
if (deletedFromMemory && session) {
|
|
1643
1808
|
this.logger.info("Session deleted", {
|
|
1644
1809
|
sessionId,
|
|
1645
1810
|
title: session.title,
|
|
1646
1811
|
thoughtCount: session.thoughts.length
|
|
1647
1812
|
});
|
|
1648
1813
|
} else {
|
|
1649
|
-
this.logger.warn("Attempted to delete non-existent session", { sessionId });
|
|
1814
|
+
this.logger.warn("Attempted to delete non-existent session from memory", { sessionId });
|
|
1650
1815
|
}
|
|
1651
1816
|
}
|
|
1652
1817
|
/**
|