@mediagato/modelreins-channel 4.1.0 → 4.4.5
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/modelreins-channel.mjs +15 -0
- package/package.json +19 -19
package/modelreins-channel.mjs
CHANGED
|
@@ -1012,10 +1012,25 @@ async function heartbeat() {
|
|
|
1012
1012
|
* 3. Claude's context window receives the job as a <channel> tag
|
|
1013
1013
|
* 4. Claude reads it, executes the task, calls modelreins_complete when done
|
|
1014
1014
|
*/
|
|
1015
|
+
let _pollCount = 0;
|
|
1016
|
+
|
|
1015
1017
|
async function pollJobs() {
|
|
1016
1018
|
// One job at a time — don't accept new work while something is running.
|
|
1017
1019
|
if (currentJobId) return;
|
|
1018
1020
|
|
|
1021
|
+
// Check killswitch every 12 polls (~60s at default POLL_MS).
|
|
1022
|
+
_pollCount++;
|
|
1023
|
+
if (_pollCount % 12 === 1) {
|
|
1024
|
+
try {
|
|
1025
|
+
const ks = await api('GET', '/killswitch');
|
|
1026
|
+
if (ks.data?.active) {
|
|
1027
|
+
const reason = ks.data.reason || 'killswitch active';
|
|
1028
|
+
await api('PUT', '/presence', { instance: WORKER_NAME, status: 'offline', details: `Killswitch: ${reason}` });
|
|
1029
|
+
process.exit(0);
|
|
1030
|
+
}
|
|
1031
|
+
} catch (_) { /* network error — don't stop polling */ }
|
|
1032
|
+
}
|
|
1033
|
+
|
|
1019
1034
|
const res = await api('GET', `/jobs?status=pending&assigned_to=${encodeURIComponent(WORKER_NAME)}&limit=1`);
|
|
1020
1035
|
const jobs = res.data?.jobs || (Array.isArray(res.data) ? res.data : []);
|
|
1021
1036
|
|
package/package.json
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@mediagato/modelreins-channel",
|
|
3
|
-
"version": "4.
|
|
4
|
-
"description": "ModelReins MCP Channel — turn any Claude Code session into a ModelReins worker",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"main": "modelreins-channel.mjs",
|
|
7
|
-
"bin": {
|
|
8
|
-
"modelreins-channel": "./modelreins-channel.mjs"
|
|
9
|
-
},
|
|
10
|
-
"dependencies": {
|
|
11
|
-
"@modelcontextprotocol/sdk": "^1.12.0"
|
|
12
|
-
},
|
|
13
|
-
"keywords": ["modelreins", "mcp", "claude-code", "channel", "ai-orchestration"],
|
|
14
|
-
"license": "BSL-1.1",
|
|
15
|
-
"repository": {
|
|
16
|
-
"type": "git",
|
|
17
|
-
"url": "https://github.com/mediagato/modelreins"
|
|
18
|
-
}
|
|
19
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@mediagato/modelreins-channel",
|
|
3
|
+
"version": "4.4.5",
|
|
4
|
+
"description": "ModelReins MCP Channel — turn any Claude Code session into a ModelReins worker",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "modelreins-channel.mjs",
|
|
7
|
+
"bin": {
|
|
8
|
+
"modelreins-channel": "./modelreins-channel.mjs"
|
|
9
|
+
},
|
|
10
|
+
"dependencies": {
|
|
11
|
+
"@modelcontextprotocol/sdk": "^1.12.0"
|
|
12
|
+
},
|
|
13
|
+
"keywords": ["modelreins", "mcp", "claude-code", "channel", "ai-orchestration"],
|
|
14
|
+
"license": "BSL-1.1",
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "https://github.com/mediagato/modelreins"
|
|
18
|
+
}
|
|
19
|
+
}
|