@rk0429/agentic-relay 0.10.1 → 0.11.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/relay.mjs +20 -14
- package/package.json +1 -1
package/dist/relay.mjs
CHANGED
|
@@ -55,8 +55,8 @@ var init_recursion_guard = __esm({
|
|
|
55
55
|
RecursionGuard = class _RecursionGuard {
|
|
56
56
|
constructor(config = {
|
|
57
57
|
maxDepth: 5,
|
|
58
|
-
maxCallsPerSession:
|
|
59
|
-
timeoutSec:
|
|
58
|
+
maxCallsPerSession: 50,
|
|
59
|
+
timeoutSec: 1800
|
|
60
60
|
}) {
|
|
61
61
|
this.config = config;
|
|
62
62
|
}
|
|
@@ -110,10 +110,15 @@ var init_recursion_guard = __esm({
|
|
|
110
110
|
reason: `Max calls per session exceeded: ${currentCount} >= ${this.config.maxCallsPerSession}`
|
|
111
111
|
};
|
|
112
112
|
}
|
|
113
|
-
if (this.detectLoop(
|
|
113
|
+
if (this.detectLoop(
|
|
114
|
+
context.traceId,
|
|
115
|
+
context.backend,
|
|
116
|
+
context.promptHash,
|
|
117
|
+
context.taskType
|
|
118
|
+
)) {
|
|
114
119
|
return {
|
|
115
120
|
allowed: false,
|
|
116
|
-
reason: `Loop detected: same (backend=${context.backend}, promptHash=${context.promptHash}) appeared
|
|
121
|
+
reason: `Loop detected: same (backend=${context.backend}, taskType=${context.taskType ?? ""}, promptHash=${context.promptHash}) appeared 5+ times in trace ${context.traceId}`
|
|
117
122
|
};
|
|
118
123
|
}
|
|
119
124
|
return { allowed: true };
|
|
@@ -127,7 +132,7 @@ var init_recursion_guard = __esm({
|
|
|
127
132
|
} else {
|
|
128
133
|
this.callCounts.set(context.traceId, { count: 1, createdAt: Date.now() });
|
|
129
134
|
}
|
|
130
|
-
const key = `${context.backend}:${context.promptHash}`;
|
|
135
|
+
const key = `${context.backend}:${context.taskType ?? ""}:${context.promptHash}`;
|
|
131
136
|
const hashEntry = this.promptHashes.get(context.traceId);
|
|
132
137
|
if (hashEntry) {
|
|
133
138
|
hashEntry.hashes.push(key);
|
|
@@ -135,12 +140,12 @@ var init_recursion_guard = __esm({
|
|
|
135
140
|
this.promptHashes.set(context.traceId, { hashes: [key], createdAt: Date.now() });
|
|
136
141
|
}
|
|
137
142
|
}
|
|
138
|
-
/** Detect if the same (backend + promptHash) combination has appeared
|
|
139
|
-
detectLoop(traceId, backend, promptHash) {
|
|
140
|
-
const key = `${backend}:${promptHash}`;
|
|
143
|
+
/** Detect if the same (backend + taskType + promptHash) combination has appeared 5+ times */
|
|
144
|
+
detectLoop(traceId, backend, promptHash, taskType) {
|
|
145
|
+
const key = `${backend}:${taskType ?? ""}:${promptHash}`;
|
|
141
146
|
const hashes = this.promptHashes.get(traceId)?.hashes ?? [];
|
|
142
147
|
const count = hashes.filter((h) => h === key).length;
|
|
143
|
-
return count >=
|
|
148
|
+
return count >= 5;
|
|
144
149
|
}
|
|
145
150
|
/** Get current config (for testing/inspection) */
|
|
146
151
|
getConfig() {
|
|
@@ -344,7 +349,8 @@ async function executeSpawnAgent(input, registry2, sessionManager2, guard, hooks
|
|
|
344
349
|
traceId: envContext.traceId,
|
|
345
350
|
depth: envContext.depth,
|
|
346
351
|
backend: effectiveBackend,
|
|
347
|
-
promptHash
|
|
352
|
+
promptHash,
|
|
353
|
+
taskType: input.taskType
|
|
348
354
|
};
|
|
349
355
|
const guardResult = guard.canSpawn(context);
|
|
350
356
|
if (!guardResult.allowed) {
|
|
@@ -1145,7 +1151,7 @@ var init_server = __esm({
|
|
|
1145
1151
|
this.backendSelector = new BackendSelector();
|
|
1146
1152
|
this.server = new McpServer({
|
|
1147
1153
|
name: "agentic-relay",
|
|
1148
|
-
version: "0.
|
|
1154
|
+
version: "0.11.0"
|
|
1149
1155
|
});
|
|
1150
1156
|
this.registerTools(this.server);
|
|
1151
1157
|
}
|
|
@@ -1453,7 +1459,7 @@ var init_server = __esm({
|
|
|
1453
1459
|
});
|
|
1454
1460
|
const server = new McpServer({
|
|
1455
1461
|
name: "agentic-relay",
|
|
1456
|
-
version: "0.
|
|
1462
|
+
version: "0.11.0"
|
|
1457
1463
|
});
|
|
1458
1464
|
this.registerTools(server);
|
|
1459
1465
|
transport.onclose = () => {
|
|
@@ -4405,7 +4411,7 @@ function createVersionCommand(registry2) {
|
|
|
4405
4411
|
description: "Show relay and backend versions"
|
|
4406
4412
|
},
|
|
4407
4413
|
async run() {
|
|
4408
|
-
const relayVersion = "0.
|
|
4414
|
+
const relayVersion = "0.11.0";
|
|
4409
4415
|
console.log(`agentic-relay v${relayVersion}`);
|
|
4410
4416
|
console.log("");
|
|
4411
4417
|
console.log("Backends:");
|
|
@@ -4755,7 +4761,7 @@ void configManager.getConfig().then((config) => {
|
|
|
4755
4761
|
var main = defineCommand10({
|
|
4756
4762
|
meta: {
|
|
4757
4763
|
name: "relay",
|
|
4758
|
-
version: "0.
|
|
4764
|
+
version: "0.11.0",
|
|
4759
4765
|
description: "Unified CLI proxy for Claude Code, Codex CLI, and Gemini CLI"
|
|
4760
4766
|
},
|
|
4761
4767
|
subCommands: {
|
package/package.json
CHANGED