@dmsdc-ai/aigentry-deliberation 0.0.31 → 0.0.32
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 +24 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -3331,8 +3331,31 @@ server.tool(
|
|
|
3331
3331
|
session_id: z.string().describe("Session ID to inject context into"),
|
|
3332
3332
|
context: z.string().describe("The context text to inject"),
|
|
3333
3333
|
speaker: z.string().default("system").describe("Optional label for who injected the context (default: 'system')"),
|
|
3334
|
+
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
3335
|
},
|
|
3335
|
-
safeToolHandler("deliberation_inject_context", async ({ session_id, context, speaker }) => {
|
|
3336
|
+
safeToolHandler("deliberation_inject_context", async ({ session_id, context, speaker, remote_url }) => {
|
|
3337
|
+
if (remote_url) {
|
|
3338
|
+
try {
|
|
3339
|
+
const baseUrl = remote_url.startsWith("http") ? remote_url : `http://${remote_url}`;
|
|
3340
|
+
// Ensure trailing slash is removed
|
|
3341
|
+
const cleanBaseUrl = baseUrl.replace(/\/$/, "");
|
|
3342
|
+
const response = await fetch(`${cleanBaseUrl}/api/sessions/${encodeURIComponent(session_id)}/context`, {
|
|
3343
|
+
method: "POST",
|
|
3344
|
+
headers: { "Content-Type": "application/json" },
|
|
3345
|
+
body: JSON.stringify({ context, speaker: speaker || "system" })
|
|
3346
|
+
});
|
|
3347
|
+
|
|
3348
|
+
if (!response.ok) {
|
|
3349
|
+
let errText = await response.text();
|
|
3350
|
+
try { errText = JSON.parse(errText).error || errText; } catch { /* ignore */ }
|
|
3351
|
+
return { content: [{ type: "text", text: `❌ Remote context injection failed (${response.status}): ${errText}` }] };
|
|
3352
|
+
}
|
|
3353
|
+
return { content: [{ type: "text", text: `✅ Context successfully injected remotely into session "${session_id}" at ${remote_url}.` }] };
|
|
3354
|
+
} catch (e) {
|
|
3355
|
+
return { content: [{ type: "text", text: `❌ Error connecting to remote observer at ${remote_url}: ${e.message}` }] };
|
|
3356
|
+
}
|
|
3357
|
+
}
|
|
3358
|
+
|
|
3336
3359
|
const resolved = resolveSessionId(session_id);
|
|
3337
3360
|
if (!resolved) {
|
|
3338
3361
|
return { content: [{ type: "text", text: t("No active deliberation.", "활성 deliberation이 없습니다.", "en") }] };
|
package/package.json
CHANGED