@essentialai/cogent-server 3.1.0 → 3.1.2
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 +1 -1
- package/dist/index.js.map +1 -1
- package/dist/middleware/ws-auth.d.ts.map +1 -1
- package/dist/middleware/ws-auth.js +28 -14
- package/dist/middleware/ws-auth.js.map +1 -1
- package/dist/routes/messages.d.ts.map +1 -1
- package/dist/routes/messages.js +6 -1
- package/dist/routes/messages.js.map +1 -1
- package/dist/routes/ui.d.ts.map +1 -1
- package/dist/routes/ui.js +5 -0
- package/dist/routes/ui.js.map +1 -1
- package/dist/services/connection-manager.d.ts +1 -1
- package/dist/services/connection-manager.d.ts.map +1 -1
- package/dist/services/connection-manager.js +3 -0
- package/dist/services/connection-manager.js.map +1 -1
- package/dist/services/message-queue.d.ts +12 -0
- package/dist/services/message-queue.d.ts.map +1 -1
- package/dist/services/message-queue.js +36 -0
- package/dist/services/message-queue.js.map +1 -1
- package/dist/services/peer-cleanup.d.ts +3 -1
- package/dist/services/peer-cleanup.d.ts.map +1 -1
- package/dist/services/peer-cleanup.js +24 -11
- package/dist/services/peer-cleanup.js.map +1 -1
- package/dist/services/session-store.d.ts +12 -0
- package/dist/services/session-store.d.ts.map +1 -1
- package/dist/services/session-store.js +45 -2
- package/dist/services/session-store.js.map +1 -1
- package/dist/services/stats-service.d.ts.map +1 -1
- package/dist/services/stats-service.js +1 -6
- package/dist/services/stats-service.js.map +1 -1
- package/dist/ui/pages/HowToPage.d.ts.map +1 -1
- package/dist/ui/pages/HowToPage.js +127 -2
- package/dist/ui/pages/HowToPage.js.map +1 -1
- package/dist/ui/pages/LandingPage.d.ts.map +1 -1
- package/dist/ui/pages/LandingPage.js +1 -1
- package/dist/ui/pages/LandingPage.js.map +1 -1
- package/dist/ui/pages/UpdateGuidePage.d.ts +3 -0
- package/dist/ui/pages/UpdateGuidePage.d.ts.map +1 -0
- package/dist/ui/pages/UpdateGuidePage.js +167 -0
- package/dist/ui/pages/UpdateGuidePage.js.map +1 -0
- package/dist/ws/adapter-handler.d.ts.map +1 -1
- package/dist/ws/adapter-handler.js +14 -7
- package/dist/ws/adapter-handler.js.map +1 -1
- package/dist/ws/handler.d.ts.map +1 -1
- package/dist/ws/handler.js +3 -2
- package/dist/ws/handler.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "hono/jsx/jsx-runtime";
|
|
2
|
+
import { css } from "hono/css";
|
|
3
|
+
import { Layout } from "../components/Layout.js";
|
|
4
|
+
import { colors } from "../styles/theme.js";
|
|
5
|
+
// --- Styles (reuse FAQ page patterns) ---
|
|
6
|
+
const container = css `
|
|
7
|
+
max-width: 960px;
|
|
8
|
+
margin: 0 auto;
|
|
9
|
+
padding: 2rem 1.5rem;
|
|
10
|
+
`;
|
|
11
|
+
const heroSection = css `
|
|
12
|
+
text-align: center;
|
|
13
|
+
padding: 2rem 0 1.5rem;
|
|
14
|
+
`;
|
|
15
|
+
const heroTitle = css `
|
|
16
|
+
font-size: 2rem;
|
|
17
|
+
font-weight: 700;
|
|
18
|
+
color: ${colors.green};
|
|
19
|
+
margin: 0 0 0.75rem 0;
|
|
20
|
+
`;
|
|
21
|
+
const heroSubtitle = css `
|
|
22
|
+
font-size: 0.95rem;
|
|
23
|
+
color: ${colors.textMuted};
|
|
24
|
+
margin: 0 0 0.5rem 0;
|
|
25
|
+
line-height: 1.6;
|
|
26
|
+
max-width: 700px;
|
|
27
|
+
margin-left: auto;
|
|
28
|
+
margin-right: auto;
|
|
29
|
+
`;
|
|
30
|
+
const backLink = css `
|
|
31
|
+
display: inline-block;
|
|
32
|
+
color: ${colors.cyan};
|
|
33
|
+
font-size: 0.85rem;
|
|
34
|
+
margin-bottom: 1.5rem;
|
|
35
|
+
&:hover { text-decoration: underline; }
|
|
36
|
+
`;
|
|
37
|
+
const section = css `
|
|
38
|
+
margin-bottom: 3rem;
|
|
39
|
+
`;
|
|
40
|
+
const sectionTitle = css `
|
|
41
|
+
font-size: 1.2rem;
|
|
42
|
+
color: ${colors.green};
|
|
43
|
+
margin: 0 0 1rem 0;
|
|
44
|
+
font-weight: 700;
|
|
45
|
+
`;
|
|
46
|
+
const stepTitle = css `
|
|
47
|
+
font-size: 1rem;
|
|
48
|
+
color: ${colors.amber};
|
|
49
|
+
margin: 1.5rem 0 0.5rem 0;
|
|
50
|
+
font-weight: 700;
|
|
51
|
+
`;
|
|
52
|
+
const paragraph = css `
|
|
53
|
+
color: ${colors.text};
|
|
54
|
+
font-size: 0.9rem;
|
|
55
|
+
line-height: 1.7;
|
|
56
|
+
margin: 0.75rem 0;
|
|
57
|
+
`;
|
|
58
|
+
const codeBlock = css `
|
|
59
|
+
background: ${colors.bg};
|
|
60
|
+
border: 1px solid ${colors.border};
|
|
61
|
+
border-radius: 4px;
|
|
62
|
+
padding: 1rem;
|
|
63
|
+
color: ${colors.green};
|
|
64
|
+
font-size: 0.85rem;
|
|
65
|
+
overflow-x: auto;
|
|
66
|
+
white-space: pre;
|
|
67
|
+
margin: 0.75rem 0;
|
|
68
|
+
line-height: 1.5;
|
|
69
|
+
`;
|
|
70
|
+
const noteText = css `
|
|
71
|
+
color: ${colors.textMuted};
|
|
72
|
+
font-size: 0.85rem;
|
|
73
|
+
margin: 0.75rem 0;
|
|
74
|
+
line-height: 1.6;
|
|
75
|
+
`;
|
|
76
|
+
const warningBox = css `
|
|
77
|
+
background: ${colors.amber}11;
|
|
78
|
+
border: 1px solid ${colors.amber}44;
|
|
79
|
+
border-radius: 6px;
|
|
80
|
+
padding: 0.75rem 1rem;
|
|
81
|
+
margin: 0.75rem 0;
|
|
82
|
+
color: ${colors.amber};
|
|
83
|
+
font-size: 0.85rem;
|
|
84
|
+
line-height: 1.6;
|
|
85
|
+
`;
|
|
86
|
+
const bulletList = css `
|
|
87
|
+
margin: 0.5rem 0;
|
|
88
|
+
padding-left: 1.25rem;
|
|
89
|
+
& li {
|
|
90
|
+
color: ${colors.text};
|
|
91
|
+
font-size: 0.9rem;
|
|
92
|
+
line-height: 1.7;
|
|
93
|
+
margin: 0.3rem 0;
|
|
94
|
+
}
|
|
95
|
+
`;
|
|
96
|
+
const inlineCode = css `
|
|
97
|
+
background: ${colors.bg};
|
|
98
|
+
border: 1px solid ${colors.border};
|
|
99
|
+
border-radius: 3px;
|
|
100
|
+
padding: 0.15rem 0.4rem;
|
|
101
|
+
color: ${colors.green};
|
|
102
|
+
font-size: 0.85em;
|
|
103
|
+
`;
|
|
104
|
+
const troubleTable = css `
|
|
105
|
+
width: 100%;
|
|
106
|
+
border-collapse: collapse;
|
|
107
|
+
margin: 0.75rem 0;
|
|
108
|
+
font-size: 0.85rem;
|
|
109
|
+
& th {
|
|
110
|
+
text-align: left;
|
|
111
|
+
color: ${colors.amber};
|
|
112
|
+
padding: 0.5rem 0.75rem;
|
|
113
|
+
border-bottom: 1px solid ${colors.border};
|
|
114
|
+
font-weight: 700;
|
|
115
|
+
}
|
|
116
|
+
& td {
|
|
117
|
+
padding: 0.5rem 0.75rem;
|
|
118
|
+
border-bottom: 1px solid ${colors.border};
|
|
119
|
+
color: ${colors.text};
|
|
120
|
+
vertical-align: top;
|
|
121
|
+
}
|
|
122
|
+
`;
|
|
123
|
+
const footer = css `
|
|
124
|
+
text-align: center;
|
|
125
|
+
padding: 2rem 0;
|
|
126
|
+
color: ${colors.textMuted};
|
|
127
|
+
font-size: 0.8rem;
|
|
128
|
+
border-top: 1px solid ${colors.border};
|
|
129
|
+
margin-top: 2rem;
|
|
130
|
+
`;
|
|
131
|
+
// --- Component ---
|
|
132
|
+
export const UpdateGuidePage = () => (_jsx(Layout, { title: "Update & Troubleshooting", children: _jsxs("div", { class: container, children: [_jsx("a", { href: "/", class: backLink, children: "\u2190 Back to Home" }), _jsxs("div", { class: heroSection, children: [_jsx("h1", { class: heroTitle, children: "Update & Troubleshooting" }), _jsx("p", { class: heroSubtitle, children: "How to update Cogent Bridge to the latest version, verify your setup, and fix common issues." })] }), _jsxs("div", { class: section, children: [_jsx("h2", { class: sectionTitle, children: "Updating to a New Version" }), _jsxs("p", { class: paragraph, children: ["When a new version is released, you need to update ", _jsx("strong", { children: "three things" }), ": the CC plugin, the npm package cache, and restart all CC sessions. Skipping any step means old code keeps running."] }), _jsx("h3", { class: stepTitle, children: "Step 1: Update the CC Plugin" }), _jsx("div", { class: codeBlock, children: "claude plugins update cogent" }), _jsx("p", { class: noteText, children: "Expected: Plugin updates to the latest version." }), _jsx("p", { class: paragraph, children: "If that doesn't work, force-clear the plugin cache and let CC re-fetch on next launch:" }), _jsx("div", { class: codeBlock, children: `rm -rf ~/.claude/plugins/cache/cogent
|
|
133
|
+
rm -rf ~/.claude/plugins/marketplaces/cogent` }), _jsx("h3", { class: stepTitle, children: "Step 2: Clear the npm/npx Cache" }), _jsxs("p", { class: paragraph, children: ["Claude Code runs the MCP server via ", _jsx("code", { class: inlineCode, children: "npx" }), ", which caches old versions. Force a clean fetch:"] }), _jsx("div", { class: codeBlock, children: `npm cache clean --force
|
|
134
|
+
rm -rf ~/.npm/_npx` }), _jsx("p", { class: paragraph, children: "Verify the latest version is available:" }), _jsx("div", { class: codeBlock, children: "npm view @essentialai/cogent-bridge version" }), _jsx("p", { class: noteText, children: "Expected: The version number matching the latest release." }), _jsx("h3", { class: stepTitle, children: "Step 3: Close ALL Running Claude Code Sessions" }), _jsxs("div", { class: warningBox, children: [_jsx("strong", { children: "Critical:" }), " Old MCP server processes stay alive in memory even after you update the npm package. Every open CC terminal is running the old code until you close and reopen it."] }), _jsxs("p", { class: paragraph, children: ["Close every open Claude Code window \u2014 type ", _jsx("code", { class: inlineCode, children: "/exit" }), " in each one, or quit the terminal entirely."] }), _jsx("p", { class: paragraph, children: "Verify no stale processes remain:" }), _jsx("div", { class: codeBlock, children: "ps aux | grep cogent | grep -v grep" }), _jsx("p", { class: noteText, children: "Expected: No output. If you see processes:" }), _jsx("div", { class: codeBlock, children: "pkill -f cogent-bridge" }), _jsx("h3", { class: stepTitle, children: "Step 4: Verify the Server (Cloud Mode)" }), _jsxs("p", { class: paragraph, children: ["If you're using cloud mode (", _jsx("code", { class: inlineCode, children: "cogent.tools" }), "), check the server is running the latest version:"] }), _jsx("div", { class: codeBlock, children: "curl -s https://cogent.tools/api/health" }), _jsxs("p", { class: noteText, children: ["Expected: JSON with ", _jsx("code", { class: inlineCode, children: "\"version\"" }), " matching the latest release. If the version is old, contact your server administrator."] }), _jsx("h3", { class: stepTitle, children: "Step 5: Start Fresh CC Sessions" }), _jsx("p", { class: paragraph, children: "Open new terminal windows and start Claude Code. The new MCP server will load automatically from the updated npm package." })] }), _jsxs("div", { class: section, children: [_jsx("h2", { class: sectionTitle, children: "Verifying Your Setup" }), _jsx("h3", { class: stepTitle, children: "Test 1: Basic Registration" }), _jsx("p", { class: paragraph, children: "Open a fresh CC session and paste:" }), _jsx("div", { class: codeBlock, children: `Use cogent_join_session to join channel "test-channel" with secret "test-secret-123".
|
|
135
|
+
Then use cogent_register_peer to register as peerId="test-peer-a", label="Test Agent A".` }), _jsxs("p", { class: noteText, children: ["Expected: Both tools return ", _jsx("code", { class: inlineCode, children: "\"success\": true" }), "."] }), _jsx("h3", { class: stepTitle, children: "Test 2: Two CC Peers Communicate" }), _jsxs("p", { class: paragraph, children: ["Open ", _jsx("strong", { children: "two" }), " fresh CC sessions in separate terminals."] }), _jsxs("p", { class: paragraph, children: [_jsx("strong", { children: "Terminal A" }), " \u2014 paste:"] }), _jsx("div", { class: codeBlock, children: `Use cogent_join_session to join channel "test-channel" with secret "test-secret-123".
|
|
136
|
+
Then use cogent_register_peer to register as peerId="peer-a", label="Agent A".` }), _jsxs("p", { class: paragraph, children: [_jsx("strong", { children: "Terminal B" }), " \u2014 paste:"] }), _jsx("div", { class: codeBlock, children: `Use cogent_join_session to join channel "test-channel" with secret "test-secret-123".
|
|
137
|
+
Then use cogent_register_peer to register as peerId="peer-b", label="Agent B".
|
|
138
|
+
After registration, send a message to peer-a using cogent_send_message with
|
|
139
|
+
fromPeerId="peer-b", toPeerId="peer-a", message="Hello from Agent B — can you hear me?"` }), _jsxs("p", { class: noteText, children: ["Expected: Terminal B's ", _jsx("code", { class: inlineCode, children: "cogent_send_message" }), " blocks for a few seconds while Agent A processes via auto-relay, then returns Agent A's response."] }), _jsx("h3", { class: stepTitle, children: "Test 3: Slack Integration" }), _jsxs("p", { class: paragraph, children: ["Requires a Slack channel mapped to a Cogent session via ", _jsx("code", { class: inlineCode, children: "/cogent map" }), "."] }), _jsxs("p", { class: paragraph, children: [_jsx("strong", { children: "In a CC session" }), " \u2014 paste:"] }), _jsx("div", { class: codeBlock, children: `Use cogent_join_session to join channel "your-channel" with secret "your-secret".
|
|
140
|
+
Then use cogent_register_peer to register as peerId="my-agent", label="My Agent".
|
|
141
|
+
After registration, send a test message to the Slack user using cogent_send_message
|
|
142
|
+
with fromPeerId="my-agent", toPeerId="slack-username",
|
|
143
|
+
message="Hello from CC — can you see this in Slack?"` }), _jsxs("p", { class: noteText, children: ["Replace ", _jsx("code", { class: inlineCode, children: "your-channel" }), ", ", _jsx("code", { class: inlineCode, children: "your-secret" }), ", and ", _jsx("code", { class: inlineCode, children: "slack-username" }), " with your actual values."] }), _jsx("p", { class: paragraph, children: "Expected:" }), _jsxs("ul", { class: bulletList, children: [_jsxs("li", { children: [_jsx("code", { class: inlineCode, children: "cogent_send_message" }), " blocks waiting for the Slack user's reply (up to 120 seconds)"] }), _jsx("li", { children: "The message appears in the mapped Slack channel" }), _jsx("li", { children: "When the Slack user replies, the response is returned to the CC session" })] }), _jsx("h3", { class: stepTitle, children: "Test 4: Verify WebSocket Connections" }), _jsx("div", { class: codeBlock, children: `cat ~/.cogent/logs/bridge-*.log | grep "WebSocket state"` }), _jsxs("p", { class: noteText, children: ["Expected: One ", _jsx("code", { class: inlineCode, children: "WebSocket state: connected" }), " line per registered peer."] }), _jsx("h3", { class: stepTitle, children: "Test 5: Verify Auto-Relay" }), _jsx("div", { class: codeBlock, children: `cat ~/.cogent/logs/bridge-*.log | grep "Auto-relay"` }), _jsxs("p", { class: noteText, children: ["Expected: Lines showing ", _jsx("code", { class: inlineCode, children: "Auto-relay: processing message" }), " and ", _jsx("code", { class: inlineCode, children: "Auto-relay: response sent back" }), "."] })] }), _jsxs("div", { class: section, children: [_jsx("h2", { class: sectionTitle, children: "Troubleshooting" }), _jsxs("table", { class: troubleTable, children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { children: "Symptom" }), _jsx("th", { children: "Cause" }), _jsx("th", { children: "Fix" })] }) }), _jsxs("tbody", { children: [_jsxs("tr", { children: [_jsxs("td", { children: [_jsx("code", { class: inlineCode, children: "npm view" }), " shows old version"] }), _jsx("td", { children: "npm cache stale" }), _jsxs("td", { children: [_jsx("code", { class: inlineCode, children: "npm cache clean --force" }), " then ", _jsx("code", { class: inlineCode, children: "rm -rf ~/.npm/_npx" })] })] }), _jsxs("tr", { children: [_jsx("td", { children: "\"appears offline\" when sending to a peer" }), _jsx("td", { children: "Server version mismatch or peer not connected via WS" }), _jsxs("td", { children: ["Check ", _jsx("code", { class: inlineCode, children: "curl -s https://cogent.tools/api/health" }), " shows latest version. Check peer log for ", _jsx("code", { class: inlineCode, children: "WebSocket state: connected" })] })] }), _jsxs("tr", { children: [_jsx("td", { children: "WebSocket never connects" }), _jsx("td", { children: "Old MCP server process still running" }), _jsxs("td", { children: [_jsx("code", { class: inlineCode, children: "pkill -f cogent-bridge" }), ", close all CC windows, start fresh"] })] }), _jsxs("tr", { children: [_jsx("td", { children: "Plugin shows old version" }), _jsx("td", { children: "Plugin cache not cleared" }), _jsxs("td", { children: [_jsx("code", { class: inlineCode, children: "rm -rf ~/.claude/plugins/cache/cogent" }), " then restart CC"] })] }), _jsxs("tr", { children: [_jsx("td", { children: "Only one peer gets WebSocket" }), _jsxs("td", { children: ["Second peer's ", _jsx("code", { class: inlineCode, children: "join_session" }), " didn't trigger reinit"] }), _jsxs("td", { children: ["Check ", _jsx("code", { class: inlineCode, children: "~/.cogent/logs/bridge-*.log" }), " for errors after \"Startup complete\""] })] }), _jsxs("tr", { children: [_jsxs("td", { children: [_jsx("code", { class: inlineCode, children: "cogent_join_session" }), " fails with 401"] }), _jsx("td", { children: "Wrong secret for existing channel" }), _jsx("td", { children: "Double-check the secret matches the one used when the channel was created" })] }), _jsxs("tr", { children: [_jsxs("td", { children: [_jsx("code", { class: inlineCode, children: "cogent_send_message" }), " times out (120s)"] }), _jsx("td", { children: "Target peer offline or CC session ended" }), _jsxs("td", { children: ["Check target peer's log for ", _jsx("code", { class: inlineCode, children: "Auto-relay: processing" }), ". If missing, the peer's CC session may have ended"] })] }), _jsxs("tr", { children: [_jsx("td", { children: _jsx("code", { class: inlineCode, children: "CLI_NOT_FOUND" }) }), _jsxs("td", { children: [_jsx("code", { class: inlineCode, children: "claude" }), " not on PATH"] }), _jsxs("td", { children: ["Set ", _jsx("code", { class: inlineCode, children: "COGENT_CLAUDE_PATH" }), " in ", _jsx("code", { class: inlineCode, children: ".mcp.json" }), " to the full path (find with ", _jsx("code", { class: inlineCode, children: "which claude" }), ")"] })] }), _jsxs("tr", { children: [_jsx("td", { children: _jsx("code", { class: inlineCode, children: "LOCK_TIMEOUT" }) }), _jsx("td", { children: "Lock held by dead process" }), _jsxs("td", { children: ["Delete ", _jsx("code", { class: inlineCode, children: "~/.cogent/cogent-state.json.lock" })] })] }), _jsxs("tr", { children: [_jsx("td", { children: "Messages arrive but CC agent says \"no notification\"" }), _jsx("td", { children: "Auto-relay processes in background subprocess" }), _jsxs("td", { children: ["Expected behavior. Check logs for ", _jsx("code", { class: inlineCode, children: "Auto-relay: processing" }), " to confirm messages were handled. Response goes back to sender automatically"] })] })] })] })] }), _jsxs("div", { class: section, children: [_jsx("h2", { class: sectionTitle, children: "Checking Logs" }), _jsxs("p", { class: paragraph, children: ["Cogent Bridge logs are stored in ", _jsx("code", { class: inlineCode, children: "~/.cogent/logs/" }), ". Each MCP server instance creates its own log file."] }), _jsx("div", { class: codeBlock, children: `# List recent logs
|
|
144
|
+
ls -lt ~/.cogent/logs/bridge-*.log | head -5
|
|
145
|
+
|
|
146
|
+
# Search all logs for errors
|
|
147
|
+
grep -i "error\\|warn\\|fail" ~/.cogent/logs/bridge-*.log
|
|
148
|
+
|
|
149
|
+
# Clear old logs before testing
|
|
150
|
+
rm -f ~/.cogent/logs/bridge-*.log` })] }), _jsxs("div", { class: section, children: [_jsx("h2", { class: sectionTitle, children: "Full Reset" }), _jsx("p", { class: paragraph, children: "If nothing else works, do a complete clean slate:" }), _jsx("div", { class: codeBlock, children: `# 1. Kill all cogent processes
|
|
151
|
+
pkill -f cogent-bridge
|
|
152
|
+
|
|
153
|
+
# 2. Close all CC sessions (manually close all terminal windows)
|
|
154
|
+
|
|
155
|
+
# 3. Clear all caches
|
|
156
|
+
npm cache clean --force
|
|
157
|
+
rm -rf ~/.npm/_npx
|
|
158
|
+
rm -rf ~/.claude/plugins/cache/cogent
|
|
159
|
+
rm -rf ~/.claude/plugins/marketplaces/cogent
|
|
160
|
+
|
|
161
|
+
# 4. Clear cogent state and logs
|
|
162
|
+
rm -rf ~/.cogent/logs/
|
|
163
|
+
rm -f ~/.cogent/cogent-state.json
|
|
164
|
+
rm -f ~/.cogent/cogent-state.json.lock
|
|
165
|
+
|
|
166
|
+
# 5. Start a fresh CC session — the plugin re-fetches everything` }), _jsxs("div", { class: warningBox, children: ["Step 4 removes your local state including credential cache. You'll need to run ", _jsx("code", { class: inlineCode, children: "cogent_join_session" }), " again."] })] }), _jsxs("div", { class: section, children: [_jsx("h2", { class: sectionTitle, children: "Environment Variables" }), _jsxs("table", { class: troubleTable, children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { children: "Variable" }), _jsx("th", { children: "Default" }), _jsx("th", { children: "Description" })] }) }), _jsxs("tbody", { children: [_jsxs("tr", { children: [_jsx("td", { children: _jsx("code", { class: inlineCode, children: "COGENT_STATE_PATH" }) }), _jsx("td", { children: _jsx("code", { class: inlineCode, children: "~/.cogent" }) }), _jsx("td", { children: "State directory for logs, credentials, and local state" })] }), _jsxs("tr", { children: [_jsx("td", { children: _jsx("code", { class: inlineCode, children: "COGENT_LOG_LEVEL" }) }), _jsx("td", { children: _jsx("code", { class: inlineCode, children: "info" }) }), _jsx("td", { children: "Log verbosity: debug, info, warn, error" })] }), _jsxs("tr", { children: [_jsx("td", { children: _jsx("code", { class: inlineCode, children: "COGENT_TIMEOUT_MS" }) }), _jsx("td", { children: _jsx("code", { class: inlineCode, children: "120000" }) }), _jsxs("td", { children: ["Timeout for ", _jsx("code", { class: inlineCode, children: "claude --resume" }), " subprocess calls (ms)"] })] }), _jsxs("tr", { children: [_jsx("td", { children: _jsx("code", { class: inlineCode, children: "COGENT_CHAR_LIMIT" }) }), _jsx("td", { children: _jsx("code", { class: inlineCode, children: "0" }) }), _jsx("td", { children: "Max message length (0 = unlimited)" })] }), _jsxs("tr", { children: [_jsx("td", { children: _jsx("code", { class: inlineCode, children: "COGENT_STALE_TIMEOUT_MS" }) }), _jsx("td", { children: _jsx("code", { class: inlineCode, children: "1800000" }) }), _jsx("td", { children: "Idle peer timeout before stale cleanup (30 min)" })] }), _jsxs("tr", { children: [_jsx("td", { children: _jsx("code", { class: inlineCode, children: "COGENT_CLAUDE_PATH" }) }), _jsx("td", { children: _jsx("code", { class: inlineCode, children: "claude" }) }), _jsx("td", { children: "Path to the Claude CLI executable" })] }), _jsxs("tr", { children: [_jsx("td", { children: _jsx("code", { class: inlineCode, children: "COGENT_ENDPOINT" }) }), _jsx("td", { children: _jsx("em", { children: "not set" }) }), _jsxs("td", { children: ["Cloud relay URL (e.g., ", _jsx("code", { class: inlineCode, children: "https://cogent.tools" }), "). Enables cloud mode when set"] })] })] })] })] }), _jsxs("div", { class: footer, children: ["COGENT \u2014 Powered by ", _jsx("a", { href: "https://essentialai.uk", style: "color: inherit;", children: "Essential AI Solutions Ltd." }), " \u2014 ", _jsx("a", { href: "/", style: "color: inherit;", children: "cogent.tools" })] })] }) }));
|
|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,MAAM,mCAAmC,CAAC;AAS3E;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,eAAe,EAAE,eAAe,CAAC;IACjC,YAAY,EAAE,mBAAmB,CAAC;IAClC,YAAY,EAAE,YAAY,CAAC;IAC3B,iBAAiB,EAAE,iBAAiB,CAAC;IACrC,mBAAmB,EAAE,MAAM,CAAC;IAC5B,kBAAkB,EAAE,MAAM,CAAC;CAC5B;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,sBAAsB,CACpC,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,oBAAoB,GACzB,QAAQ,
|
|
1
|
+
{"version":3,"file":"adapter-handler.d.ts","sourceRoot":"","sources":["../../src/ws/adapter-handler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAExC,OAAO,KAAK,EAAE,eAAe,EAAqB,MAAM,iCAAiC,CAAC;AAC1F,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAS3E;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,eAAe,EAAE,eAAe,CAAC;IACjC,YAAY,EAAE,mBAAmB,CAAC;IAClC,YAAY,EAAE,YAAY,CAAC;IAC3B,iBAAiB,EAAE,iBAAiB,CAAC;IACrC,mBAAmB,EAAE,MAAM,CAAC;IAC5B,kBAAkB,EAAE,MAAM,CAAC;CAC5B;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,sBAAsB,CACpC,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,oBAAoB,GACzB,QAAQ,CAiGV"}
|
|
@@ -30,14 +30,14 @@ export function createAdapterWsHandler(sessionId, platform, deps) {
|
|
|
30
30
|
};
|
|
31
31
|
deps.adapterRegistry.addConnection(conn);
|
|
32
32
|
// 3. Flush offline message queue for this adapter
|
|
33
|
-
const messages = await deps.messageQueue.
|
|
33
|
+
const messages = await deps.messageQueue.peekAll(sessionId, adapterQueueKey);
|
|
34
34
|
if (messages.length > 0) {
|
|
35
35
|
const queueFrame = createQueuedMessagesFrame(messages);
|
|
36
36
|
ws.send(JSON.stringify(queueFrame));
|
|
37
37
|
}
|
|
38
38
|
console.error(`[AdapterWsHandler] Adapter connected: platform=${platform}, session=${sessionId}`);
|
|
39
39
|
},
|
|
40
|
-
onMessage(evt, _ws) {
|
|
40
|
+
async onMessage(evt, _ws) {
|
|
41
41
|
// Parse incoming adapter frame
|
|
42
42
|
let parsed;
|
|
43
43
|
try {
|
|
@@ -50,12 +50,19 @@ export function createAdapterWsHandler(sessionId, platform, deps) {
|
|
|
50
50
|
}
|
|
51
51
|
if (parsed.type === "adapter_received" && parsed.payload) {
|
|
52
52
|
// Stage 2 ack: adapter has received the message
|
|
53
|
-
// Route as delivery_ack to the
|
|
54
|
-
//
|
|
55
|
-
|
|
53
|
+
// Route as delivery_ack to the original sender CC peer.
|
|
54
|
+
// The peerId in the delivery_ack frame must be the acknowledging party
|
|
55
|
+
// (toPeerId of the original message) so the sender's waitForDeliveryAck()
|
|
56
|
+
// resolves correctly. For broadcasts (toPeerId is "*" or absent), fall back
|
|
57
|
+
// to the adapter's identity as the acknowledging party.
|
|
58
|
+
const { messageId, fromPeerId, toPeerId } = parsed.payload;
|
|
56
59
|
if (messageId && fromPeerId && typeof messageId === "string" && typeof fromPeerId === "string") {
|
|
57
|
-
|
|
58
|
-
|
|
60
|
+
await deps.messageQueue.ackDelivered(sessionId, adapterQueueKey, [messageId]);
|
|
61
|
+
// peerId = the party acknowledging receipt (the target peer or adapter for broadcasts)
|
|
62
|
+
const ackingPeerId = (typeof toPeerId === "string" && toPeerId !== "*")
|
|
63
|
+
? toPeerId
|
|
64
|
+
: `_adapter:${platform}`;
|
|
65
|
+
const deliveryAck = createDeliveryAckFrame(messageId, ackingPeerId);
|
|
59
66
|
deps.connectionManager.sendToPeer(sessionId, fromPeerId, JSON.stringify(deliveryAck));
|
|
60
67
|
}
|
|
61
68
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adapter-handler.js","sourceRoot":"","sources":["../../src/ws/adapter-handler.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EACL,yBAAyB,EACzB,6BAA6B,EAC7B,+BAA+B,EAC/B,sBAAsB,GACvB,MAAM,aAAa,CAAC;AAcrB;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,sBAAsB,CACpC,SAAiB,EACjB,QAAgB,EAChB,IAA0B;IAE1B,MAAM,eAAe,GAAG,YAAY,QAAQ,EAAE,CAAC;IAE/C,OAAO;QACL,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE;YACnB,MAAM,KAAK,GAAG,EAAE,CAAC,GAAgB,CAAC;YAElC,0EAA0E;YAC1E,MAAM,iBAAiB,GAAG,cAAc,CACtC,KAAK,EACL,IAAI,CAAC,mBAAmB,EACxB,IAAI,CAAC,kBAAkB,CACxB,CAAC;YAEF,iDAAiD;YACjD,MAAM,IAAI,GAAsB;gBAC9B,EAAE;gBACF,KAAK;gBACL,SAAS;gBACT,QAAQ;gBACR,WAAW,EAAE,IAAI,CAAC,GAAG,EAAE;gBACvB,iBAAiB;aAClB,CAAC;YACF,IAAI,CAAC,eAAe,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;YAEzC,kDAAkD;YAClD,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,
|
|
1
|
+
{"version":3,"file":"adapter-handler.js","sourceRoot":"","sources":["../../src/ws/adapter-handler.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EACL,yBAAyB,EACzB,6BAA6B,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KAAK,EAAE,iBAAiB,EAAkB,MAAM,mCAAmC,CAAC;AAC3F,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AASjE;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,iBAAiB,EAAE,iBAAiB,CAAC;IACrC,YAAY,EAAE,mBAAmB,CAAC;IAClC,YAAY,EAAE,YAAY,CAAC;IAC3B,mBAAmB,EAAE,MAAM,CAAC;IAC5B,kBAAkB,EAAE,MAAM,CAAC;CAC5B;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAC7B,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,aAAa,GAClB,QAAQ,
|
|
1
|
+
{"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../src/ws/handler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAExC,OAAO,KAAK,EAAE,iBAAiB,EAAkB,MAAM,mCAAmC,CAAC;AAC3F,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AASjE;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,iBAAiB,EAAE,iBAAiB,CAAC;IACrC,YAAY,EAAE,mBAAmB,CAAC;IAClC,YAAY,EAAE,YAAY,CAAC;IAC3B,mBAAmB,EAAE,MAAM,CAAC;IAC5B,kBAAkB,EAAE,MAAM,CAAC;CAC5B;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAC7B,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,aAAa,GAClB,QAAQ,CA6GV"}
|
package/dist/ws/handler.js
CHANGED
|
@@ -36,7 +36,7 @@ export function createWsHandler(sessionId, peerId, deps) {
|
|
|
36
36
|
ws.send(JSON.stringify(snapshotFrame));
|
|
37
37
|
}
|
|
38
38
|
// 4. Flush offline message queue
|
|
39
|
-
const messages = await deps.messageQueue.
|
|
39
|
+
const messages = await deps.messageQueue.peekAll(sessionId, peerId);
|
|
40
40
|
if (messages.length > 0) {
|
|
41
41
|
const queueFrame = createQueuedMessagesFrame(messages);
|
|
42
42
|
ws.send(JSON.stringify(queueFrame));
|
|
@@ -54,7 +54,7 @@ export function createWsHandler(sessionId, peerId, deps) {
|
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
},
|
|
57
|
-
onMessage(evt, _ws) {
|
|
57
|
+
async onMessage(evt, _ws) {
|
|
58
58
|
// Parse incoming client frame
|
|
59
59
|
let parsed;
|
|
60
60
|
try {
|
|
@@ -73,6 +73,7 @@ export function createWsHandler(sessionId, peerId, deps) {
|
|
|
73
73
|
typeof payload.toPeerId === "string") {
|
|
74
74
|
// Route delivery ack to the original sender.
|
|
75
75
|
// peerId in the server frame = the acknowledger (fromPeerId in client frame)
|
|
76
|
+
await deps.messageQueue.ackDelivered(sessionId, peerId, [payload.messageId]);
|
|
76
77
|
const ackFrame = createDeliveryAckFrame(payload.messageId, payload.fromPeerId);
|
|
77
78
|
deps.connectionManager.sendToPeer(sessionId, payload.toPeerId, JSON.stringify(ackFrame));
|
|
78
79
|
}
|
package/dist/ws/handler.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handler.js","sourceRoot":"","sources":["../../src/ws/handler.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EACL,wBAAwB,EACxB,yBAAyB,EACzB,wBAAwB,EACxB,sBAAsB,GACvB,MAAM,aAAa,CAAC;AAcrB;;;;;;;;GAQG;AACH,MAAM,UAAU,eAAe,CAC7B,SAAiB,EACjB,MAAc,EACd,IAAmB;IAEnB,OAAO;QACL,KAAK,CAAC,MAAM,CAAC,IAAI,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