@dmsdc-ai/aigentry-deliberation 0.0.31 → 0.0.33
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/index.js +59 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -3324,6 +3324,41 @@ server.tool(
|
|
|
3324
3324
|
})
|
|
3325
3325
|
);
|
|
3326
3326
|
|
|
3327
|
+
server.tool(
|
|
3328
|
+
"deliberation_list_remote_sessions",
|
|
3329
|
+
"List all active deliberation sessions on a remote machine (via Tailscale/IP) to find the correct session_id for context injection.",
|
|
3330
|
+
{
|
|
3331
|
+
remote_url: z.string().describe("The Tailscale IP or Host and port (e.g., '100.100.100.5:3847') of the remote machine."),
|
|
3332
|
+
},
|
|
3333
|
+
safeToolHandler("deliberation_list_remote_sessions", async ({ remote_url }) => {
|
|
3334
|
+
try {
|
|
3335
|
+
const baseUrl = remote_url.startsWith("http") ? remote_url : `http://${remote_url}`;
|
|
3336
|
+
const cleanBaseUrl = baseUrl.replace(/\/$/, "");
|
|
3337
|
+
const response = await fetch(`${cleanBaseUrl}/api/sessions`);
|
|
3338
|
+
|
|
3339
|
+
if (!response.ok) {
|
|
3340
|
+
return { content: [{ type: "text", text: `❌ Failed to fetch remote sessions (${response.status})` }] };
|
|
3341
|
+
}
|
|
3342
|
+
|
|
3343
|
+
const sessions = await response.json();
|
|
3344
|
+
if (!Array.isArray(sessions) || sessions.length === 0) {
|
|
3345
|
+
return { content: [{ type: "text", text: `No active deliberation sessions found on ${remote_url}.` }] };
|
|
3346
|
+
}
|
|
3347
|
+
|
|
3348
|
+
let result = `### Active Sessions on ${remote_url}\n\n`;
|
|
3349
|
+
for (const s of sessions) {
|
|
3350
|
+
result += `- **ID:** \`${s.id}\`\n`;
|
|
3351
|
+
result += ` **Topic:** ${s.topic}\n`;
|
|
3352
|
+
result += ` **Status:** ${s.status} (Round ${s.current_round}/${s.max_rounds})\n\n`;
|
|
3353
|
+
}
|
|
3354
|
+
|
|
3355
|
+
return { content: [{ type: "text", text: result }] };
|
|
3356
|
+
} catch (e) {
|
|
3357
|
+
return { content: [{ type: "text", text: `❌ Error connecting to remote machine at ${remote_url}: ${e.message}` }] };
|
|
3358
|
+
}
|
|
3359
|
+
})
|
|
3360
|
+
);
|
|
3361
|
+
|
|
3327
3362
|
server.tool(
|
|
3328
3363
|
"deliberation_inject_context",
|
|
3329
3364
|
"Inject additional context or instructions into a specific active session. (Useful for local or remote context injection via Tailscale)",
|
|
@@ -3331,8 +3366,31 @@ server.tool(
|
|
|
3331
3366
|
session_id: z.string().describe("Session ID to inject context into"),
|
|
3332
3367
|
context: z.string().describe("The context text to inject"),
|
|
3333
3368
|
speaker: z.string().default("system").describe("Optional label for who injected the context (default: 'system')"),
|
|
3369
|
+
remote_url: z.string().optional().describe("Optional Tailscale IP/Host and port (e.g., '100.100.100.5:3847') of the remote machine running the session. If provided, context is injected remotely."),
|
|
3334
3370
|
},
|
|
3335
|
-
safeToolHandler("deliberation_inject_context", async ({ session_id, context, speaker }) => {
|
|
3371
|
+
safeToolHandler("deliberation_inject_context", async ({ session_id, context, speaker, remote_url }) => {
|
|
3372
|
+
if (remote_url) {
|
|
3373
|
+
try {
|
|
3374
|
+
const baseUrl = remote_url.startsWith("http") ? remote_url : `http://${remote_url}`;
|
|
3375
|
+
// Ensure trailing slash is removed
|
|
3376
|
+
const cleanBaseUrl = baseUrl.replace(/\/$/, "");
|
|
3377
|
+
const response = await fetch(`${cleanBaseUrl}/api/sessions/${encodeURIComponent(session_id)}/context`, {
|
|
3378
|
+
method: "POST",
|
|
3379
|
+
headers: { "Content-Type": "application/json" },
|
|
3380
|
+
body: JSON.stringify({ context, speaker: speaker || "system" })
|
|
3381
|
+
});
|
|
3382
|
+
|
|
3383
|
+
if (!response.ok) {
|
|
3384
|
+
let errText = await response.text();
|
|
3385
|
+
try { errText = JSON.parse(errText).error || errText; } catch { /* ignore */ }
|
|
3386
|
+
return { content: [{ type: "text", text: `❌ Remote context injection failed (${response.status}): ${errText}` }] };
|
|
3387
|
+
}
|
|
3388
|
+
return { content: [{ type: "text", text: `✅ Context successfully injected remotely into session "${session_id}" at ${remote_url}.` }] };
|
|
3389
|
+
} catch (e) {
|
|
3390
|
+
return { content: [{ type: "text", text: `❌ Error connecting to remote observer at ${remote_url}: ${e.message}` }] };
|
|
3391
|
+
}
|
|
3392
|
+
}
|
|
3393
|
+
|
|
3336
3394
|
const resolved = resolveSessionId(session_id);
|
|
3337
3395
|
if (!resolved) {
|
|
3338
3396
|
return { content: [{ type: "text", text: t("No active deliberation.", "활성 deliberation이 없습니다.", "en") }] };
|
package/package.json
CHANGED