@eventmodelers/node-kit 0.0.9 → 0.0.11
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/package.json +1 -1
- package/src/cli.js +1 -1
- package/templates/realtime-agent/src/index.js +4 -19
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -221,7 +221,7 @@ program
|
|
|
221
221
|
try {
|
|
222
222
|
const cfg = JSON.parse(readFileSync(configPath, 'utf-8'));
|
|
223
223
|
console.log(`\nConnected to: ${cfg.baseUrl}`);
|
|
224
|
-
console.log(`Organization: ${cfg.
|
|
224
|
+
console.log(`Organization: ${cfg.organizationId}`);
|
|
225
225
|
console.log(`Board: ${cfg.boardId}`);
|
|
226
226
|
} catch {
|
|
227
227
|
console.log('\n⚠️ Config file is invalid JSON');
|
|
@@ -22,7 +22,7 @@ function loadLocalConfig() {
|
|
|
22
22
|
const raw = readFileSync(configPath, 'utf-8');
|
|
23
23
|
const cfg = JSON.parse(raw);
|
|
24
24
|
|
|
25
|
-
for (const key of ['token', '
|
|
25
|
+
for (const key of ['token', 'organizationId', 'boardId', 'baseUrl']) {
|
|
26
26
|
if (!cfg[key]) throw new Error(`Missing config field: ${key}`);
|
|
27
27
|
}
|
|
28
28
|
|
|
@@ -50,7 +50,7 @@ async function getRealtimeToken(cfg) {
|
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
async function fetchAndPersistSlices(cfg, cwd) {
|
|
53
|
-
const url = `${cfg.baseUrl}/api/org/${cfg.
|
|
53
|
+
const url = `${cfg.baseUrl}/api/org/${cfg.organizationId}/boards/${cfg.boardId}/slicedata/slices`;
|
|
54
54
|
const res = await fetch(url, {
|
|
55
55
|
headers: { 'x-token': cfg.token, 'x-board-id': cfg.boardId },
|
|
56
56
|
});
|
|
@@ -96,7 +96,7 @@ async function start() {
|
|
|
96
96
|
const local = loadLocalConfig();
|
|
97
97
|
const cfg = await fetchPlatformConfig(local);
|
|
98
98
|
|
|
99
|
-
console.log(`[agent] Starting — org=${cfg.
|
|
99
|
+
console.log(`[agent] Starting — org=${cfg.organizationId}, board=${cfg.boardId}, base=${cfg.baseUrl}, cwd=${claudeCwd}`);
|
|
100
100
|
|
|
101
101
|
let realtimeToken = await getRealtimeToken(cfg);
|
|
102
102
|
|
|
@@ -138,23 +138,8 @@ async function start() {
|
|
|
138
138
|
} catch (err) {
|
|
139
139
|
console.error('[agent] Token refresh failed:', err);
|
|
140
140
|
}
|
|
141
|
-
},
|
|
141
|
+
}, 10 * 60 * 1000);
|
|
142
142
|
|
|
143
|
-
const ping = async () => {
|
|
144
|
-
try {
|
|
145
|
-
const res = await fetch(`${cfg.baseUrl}/api/agent-alive`, {
|
|
146
|
-
method: 'POST',
|
|
147
|
-
headers: { 'Authorization': `Bearer ${realtimeToken}`, 'Content-Type': 'application/json' },
|
|
148
|
-
body: JSON.stringify({ token: cfg.token }),
|
|
149
|
-
});
|
|
150
|
-
if (!res.ok) console.error(`[agent] Ping failed: ${res.status}`);
|
|
151
|
-
} catch (err) {
|
|
152
|
-
console.error('[agent] Ping error:', err);
|
|
153
|
-
}
|
|
154
|
-
};
|
|
155
|
-
|
|
156
|
-
await ping();
|
|
157
|
-
setInterval(ping, 10 * 1000);
|
|
158
143
|
}
|
|
159
144
|
|
|
160
145
|
start().catch((err) => {
|