@sonenta/mcp 0.36.0 → 0.38.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/README.md +1 -1
- package/bin/sonenta-mcp.js +275 -20
- package/bin/sonenta-mcp.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Model Context Protocol server for **Sonenta** translation management — **pure TypeScript**, no Python, no `uv`, no bundled wheel. Runs on Node ≥18.
|
|
4
4
|
|
|
5
|
-
Wires Claude Desktop and other MCP clients into your Sonenta project's keys, translations, accessibility surfaces, source-health, and glossary tools.
|
|
5
|
+
Wires Claude Desktop and other MCP clients into your Sonenta project's keys, translations, accessibility surfaces, source-health, and glossary tools — plus **agent-observability** tools (`session_start` / `annotate` / `human_needed` / `session_end`) that surface an agent's run as a live, timestamped thread in the Sonenta dashboard, and **prompt-library** reads (`list_prompts` / `resolve_prompt`) so agents can discover and reuse the project's curated prompts.
|
|
6
6
|
|
|
7
7
|
## Use
|
|
8
8
|
|
package/bin/sonenta-mcp.js
CHANGED
|
@@ -8388,21 +8388,21 @@ var init_protocol = __esm({
|
|
|
8388
8388
|
* the error appropriately (e.g., by failing the task, logging, etc.). The Protocol layer
|
|
8389
8389
|
* simply propagates the error.
|
|
8390
8390
|
*/
|
|
8391
|
-
async _enqueueTaskMessage(taskId, message,
|
|
8391
|
+
async _enqueueTaskMessage(taskId, message, sessionId2) {
|
|
8392
8392
|
if (!this._taskStore || !this._taskMessageQueue) {
|
|
8393
8393
|
throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");
|
|
8394
8394
|
}
|
|
8395
8395
|
const maxQueueSize = this._options?.maxTaskQueueSize;
|
|
8396
|
-
await this._taskMessageQueue.enqueue(taskId, message,
|
|
8396
|
+
await this._taskMessageQueue.enqueue(taskId, message, sessionId2, maxQueueSize);
|
|
8397
8397
|
}
|
|
8398
8398
|
/**
|
|
8399
8399
|
* Clears the message queue for a task and rejects any pending request resolvers.
|
|
8400
8400
|
* @param taskId The task ID whose queue should be cleared
|
|
8401
8401
|
* @param sessionId Optional session ID for binding the operation to a specific session
|
|
8402
8402
|
*/
|
|
8403
|
-
async _clearTaskQueue(taskId,
|
|
8403
|
+
async _clearTaskQueue(taskId, sessionId2) {
|
|
8404
8404
|
if (this._taskMessageQueue) {
|
|
8405
|
-
const messages = await this._taskMessageQueue.dequeueAll(taskId,
|
|
8405
|
+
const messages = await this._taskMessageQueue.dequeueAll(taskId, sessionId2);
|
|
8406
8406
|
for (const message of messages) {
|
|
8407
8407
|
if (message.type === "request" && isJSONRPCRequest(message.message)) {
|
|
8408
8408
|
const requestId = message.message.id;
|
|
@@ -8445,7 +8445,7 @@ var init_protocol = __esm({
|
|
|
8445
8445
|
}, { once: true });
|
|
8446
8446
|
});
|
|
8447
8447
|
}
|
|
8448
|
-
requestTaskStore(request,
|
|
8448
|
+
requestTaskStore(request, sessionId2) {
|
|
8449
8449
|
const taskStore = this._taskStore;
|
|
8450
8450
|
if (!taskStore) {
|
|
8451
8451
|
throw new Error("No task store configured");
|
|
@@ -8458,18 +8458,18 @@ var init_protocol = __esm({
|
|
|
8458
8458
|
return await taskStore.createTask(taskParams, request.id, {
|
|
8459
8459
|
method: request.method,
|
|
8460
8460
|
params: request.params
|
|
8461
|
-
},
|
|
8461
|
+
}, sessionId2);
|
|
8462
8462
|
},
|
|
8463
8463
|
getTask: async (taskId) => {
|
|
8464
|
-
const task = await taskStore.getTask(taskId,
|
|
8464
|
+
const task = await taskStore.getTask(taskId, sessionId2);
|
|
8465
8465
|
if (!task) {
|
|
8466
8466
|
throw new McpError(ErrorCode.InvalidParams, "Failed to retrieve task: Task not found");
|
|
8467
8467
|
}
|
|
8468
8468
|
return task;
|
|
8469
8469
|
},
|
|
8470
8470
|
storeTaskResult: async (taskId, status, result) => {
|
|
8471
|
-
await taskStore.storeTaskResult(taskId, status, result,
|
|
8472
|
-
const task = await taskStore.getTask(taskId,
|
|
8471
|
+
await taskStore.storeTaskResult(taskId, status, result, sessionId2);
|
|
8472
|
+
const task = await taskStore.getTask(taskId, sessionId2);
|
|
8473
8473
|
if (task) {
|
|
8474
8474
|
const notification = TaskStatusNotificationSchema.parse({
|
|
8475
8475
|
method: "notifications/tasks/status",
|
|
@@ -8482,18 +8482,18 @@ var init_protocol = __esm({
|
|
|
8482
8482
|
}
|
|
8483
8483
|
},
|
|
8484
8484
|
getTaskResult: (taskId) => {
|
|
8485
|
-
return taskStore.getTaskResult(taskId,
|
|
8485
|
+
return taskStore.getTaskResult(taskId, sessionId2);
|
|
8486
8486
|
},
|
|
8487
8487
|
updateTaskStatus: async (taskId, status, statusMessage) => {
|
|
8488
|
-
const task = await taskStore.getTask(taskId,
|
|
8488
|
+
const task = await taskStore.getTask(taskId, sessionId2);
|
|
8489
8489
|
if (!task) {
|
|
8490
8490
|
throw new McpError(ErrorCode.InvalidParams, `Task "${taskId}" not found - it may have been cleaned up`);
|
|
8491
8491
|
}
|
|
8492
8492
|
if (isTerminal(task.status)) {
|
|
8493
8493
|
throw new McpError(ErrorCode.InvalidParams, `Cannot update task "${taskId}" from terminal status "${task.status}" to "${status}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);
|
|
8494
8494
|
}
|
|
8495
|
-
await taskStore.updateTaskStatus(taskId, status, statusMessage,
|
|
8496
|
-
const updatedTask = await taskStore.getTask(taskId,
|
|
8495
|
+
await taskStore.updateTaskStatus(taskId, status, statusMessage, sessionId2);
|
|
8496
|
+
const updatedTask = await taskStore.getTask(taskId, sessionId2);
|
|
8497
8497
|
if (updatedTask) {
|
|
8498
8498
|
const notification = TaskStatusNotificationSchema.parse({
|
|
8499
8499
|
method: "notifications/tasks/status",
|
|
@@ -8506,7 +8506,7 @@ var init_protocol = __esm({
|
|
|
8506
8506
|
}
|
|
8507
8507
|
},
|
|
8508
8508
|
listTasks: (cursor) => {
|
|
8509
|
-
return taskStore.listTasks(cursor,
|
|
8509
|
+
return taskStore.listTasks(cursor, sessionId2);
|
|
8510
8510
|
}
|
|
8511
8511
|
};
|
|
8512
8512
|
}
|
|
@@ -15724,8 +15724,8 @@ var init_server2 = __esm({
|
|
|
15724
15724
|
this._serverInfo = _serverInfo;
|
|
15725
15725
|
this._loggingLevels = /* @__PURE__ */ new Map();
|
|
15726
15726
|
this.LOG_LEVEL_SEVERITY = new Map(LoggingLevelSchema.options.map((level, index) => [level, index]));
|
|
15727
|
-
this.isMessageIgnored = (level,
|
|
15728
|
-
const currentLevel = this._loggingLevels.get(
|
|
15727
|
+
this.isMessageIgnored = (level, sessionId2) => {
|
|
15728
|
+
const currentLevel = this._loggingLevels.get(sessionId2);
|
|
15729
15729
|
return currentLevel ? this.LOG_LEVEL_SEVERITY.get(level) < this.LOG_LEVEL_SEVERITY.get(currentLevel) : false;
|
|
15730
15730
|
};
|
|
15731
15731
|
this._capabilities = options?.capabilities ?? {};
|
|
@@ -16068,9 +16068,9 @@ var init_server2 = __esm({
|
|
|
16068
16068
|
* @param params
|
|
16069
16069
|
* @param sessionId optional for stateless and backward compatibility
|
|
16070
16070
|
*/
|
|
16071
|
-
async sendLoggingMessage(params,
|
|
16071
|
+
async sendLoggingMessage(params, sessionId2) {
|
|
16072
16072
|
if (this._capabilities.logging) {
|
|
16073
|
-
if (!this.isMessageIgnored(params.level,
|
|
16073
|
+
if (!this.isMessageIgnored(params.level, sessionId2)) {
|
|
16074
16074
|
return this.notification({ method: "notifications/message", params });
|
|
16075
16075
|
}
|
|
16076
16076
|
}
|
|
@@ -16904,6 +16904,19 @@ var init_client = __esm({
|
|
|
16904
16904
|
this.config = config3;
|
|
16905
16905
|
}
|
|
16906
16906
|
config;
|
|
16907
|
+
/**
|
|
16908
|
+
* Active agent-observability session (contract §0). Set by `session_start`;
|
|
16909
|
+
* while non-null it is attached as `X-MCP-Session-Id` to EVERY subsequent MCP
|
|
16910
|
+
* request so the backend can auto-attach captured mutations to the thread.
|
|
16911
|
+
* Cleared by `session_end` so later calls don't bind to a closed session.
|
|
16912
|
+
*/
|
|
16913
|
+
sessionId = null;
|
|
16914
|
+
setSession(id) {
|
|
16915
|
+
this.sessionId = id;
|
|
16916
|
+
}
|
|
16917
|
+
clearSession() {
|
|
16918
|
+
this.sessionId = null;
|
|
16919
|
+
}
|
|
16907
16920
|
buildUrl(path, params) {
|
|
16908
16921
|
const base = this.config.apiBase.replace(/\/+$/, "");
|
|
16909
16922
|
const url = new URL(`${base}${path}`);
|
|
@@ -16927,6 +16940,7 @@ var init_client = __esm({
|
|
|
16927
16940
|
"User-Agent": this.config.userAgent,
|
|
16928
16941
|
Accept: "application/json"
|
|
16929
16942
|
});
|
|
16943
|
+
if (this.sessionId) headers.set("X-MCP-Session-Id", this.sessionId);
|
|
16930
16944
|
const init = { method, headers };
|
|
16931
16945
|
if (opts.json !== void 0) {
|
|
16932
16946
|
headers.set("Content-Type", "application/json");
|
|
@@ -19429,6 +19443,177 @@ var init_schemas_generated = __esm({
|
|
|
19429
19443
|
}
|
|
19430
19444
|
});
|
|
19431
19445
|
|
|
19446
|
+
// src/tools/schemas.observability.ts
|
|
19447
|
+
var PROJECT_UUID, SESSION_ID, OBSERVABILITY_SCHEMAS, OBSERVABILITY_TOOL_NAMES;
|
|
19448
|
+
var init_schemas_observability = __esm({
|
|
19449
|
+
"src/tools/schemas.observability.ts"() {
|
|
19450
|
+
"use strict";
|
|
19451
|
+
PROJECT_UUID = {
|
|
19452
|
+
type: "string",
|
|
19453
|
+
description: "Project UUID. Required when multiple projects are configured (SONENTA_PROJECTS); defaults to the single configured project otherwise."
|
|
19454
|
+
};
|
|
19455
|
+
SESSION_ID = {
|
|
19456
|
+
type: "string",
|
|
19457
|
+
description: "Agent session id returned by session_start. Optional: defaults to this server's active session, so you normally omit it after calling session_start."
|
|
19458
|
+
};
|
|
19459
|
+
OBSERVABILITY_SCHEMAS = {
|
|
19460
|
+
session_start: {
|
|
19461
|
+
description: "Open an observability session so your work shows up as a live, timestamped thread in the Sonenta dashboard. Call this ONCE at the very start of a task, before touching anything. After it returns, every later MCP call you make is automatically attached to this session's thread (no extra wiring) \u2014 so real mutations (keys created, translations proposed, variants set\u2026) are captured even if you never call annotate. Returns {session_id, status, channel}. Idempotent per (project, session_ref) while a running session with that ref exists. Observability is always free (0 credits).",
|
|
19462
|
+
inputSchema: {
|
|
19463
|
+
type: "object",
|
|
19464
|
+
properties: {
|
|
19465
|
+
project_uuid: PROJECT_UUID,
|
|
19466
|
+
agent: {
|
|
19467
|
+
type: "string",
|
|
19468
|
+
description: "Stable agent label shown in the dashboard thread, e.g. 'sonenta-source-health' or 'sonenta-a11y'. Use your own agent name."
|
|
19469
|
+
},
|
|
19470
|
+
title: {
|
|
19471
|
+
type: "string",
|
|
19472
|
+
description: "Optional one-line human-readable title for this run, e.g. 'Repair placeholder drift'."
|
|
19473
|
+
},
|
|
19474
|
+
session_ref: {
|
|
19475
|
+
type: "string",
|
|
19476
|
+
description: "Optional client idempotency key; reusing it while a session is still running returns that same session."
|
|
19477
|
+
},
|
|
19478
|
+
metadata: {
|
|
19479
|
+
type: "object",
|
|
19480
|
+
description: "Optional opaque object echoed back in the session detail (free-form run context)."
|
|
19481
|
+
}
|
|
19482
|
+
},
|
|
19483
|
+
required: ["agent"]
|
|
19484
|
+
}
|
|
19485
|
+
},
|
|
19486
|
+
annotate: {
|
|
19487
|
+
description: "Append one readable line to the current session's thread \u2014 a human-facing step summary, NOT structured data. Use it to narrate what you are doing at a level a project owner can follow ('Found 12 keys with fr placeholder drift; repairing'). Optional; the thread stays faithful without it because real mutations are auto-captured. Free (0 credits).",
|
|
19488
|
+
inputSchema: {
|
|
19489
|
+
type: "object",
|
|
19490
|
+
properties: {
|
|
19491
|
+
project_uuid: PROJECT_UUID,
|
|
19492
|
+
session_id: SESSION_ID,
|
|
19493
|
+
summary: {
|
|
19494
|
+
type: "string",
|
|
19495
|
+
description: "The readable one-line step summary to append to the thread."
|
|
19496
|
+
},
|
|
19497
|
+
level: {
|
|
19498
|
+
type: "string",
|
|
19499
|
+
enum: ["info", "warning"],
|
|
19500
|
+
default: "info",
|
|
19501
|
+
description: "info for normal progress; warning to flag something the human should notice."
|
|
19502
|
+
},
|
|
19503
|
+
payload: {
|
|
19504
|
+
type: "object",
|
|
19505
|
+
description: "Optional structured detail rendered when the line is expanded in the dashboard."
|
|
19506
|
+
}
|
|
19507
|
+
},
|
|
19508
|
+
required: ["summary"]
|
|
19509
|
+
}
|
|
19510
|
+
},
|
|
19511
|
+
human_needed: {
|
|
19512
|
+
description: "Raise a decision you are waiting on a human for \u2014 it appears as a todo in the dashboard and pauses that branch of work until a person resolves it. Use this the moment you hit a choice that is the founder's to make (never guess a business rule): merge vs keep-separate, an ambiguous source, an irreversible action. Provide clear options when there is a discrete set. Free (0 credits).",
|
|
19513
|
+
inputSchema: {
|
|
19514
|
+
type: "object",
|
|
19515
|
+
properties: {
|
|
19516
|
+
project_uuid: PROJECT_UUID,
|
|
19517
|
+
session_id: SESSION_ID,
|
|
19518
|
+
question: {
|
|
19519
|
+
type: "string",
|
|
19520
|
+
description: `The decision, phrased for a human, e.g. "Merge duplicate 'Save' keys or keep them separate?".`
|
|
19521
|
+
},
|
|
19522
|
+
detail: {
|
|
19523
|
+
type: "string",
|
|
19524
|
+
description: "Optional context that helps the human decide."
|
|
19525
|
+
},
|
|
19526
|
+
deep_link: {
|
|
19527
|
+
type: "string",
|
|
19528
|
+
description: "Optional relative dashboard path to the thing needing attention; defaults to the session thread."
|
|
19529
|
+
},
|
|
19530
|
+
options: {
|
|
19531
|
+
type: "array",
|
|
19532
|
+
items: { type: "string" },
|
|
19533
|
+
description: "Optional suggested choices, e.g. ['merge', 'keep separate']."
|
|
19534
|
+
}
|
|
19535
|
+
},
|
|
19536
|
+
required: ["question"]
|
|
19537
|
+
}
|
|
19538
|
+
},
|
|
19539
|
+
session_end: {
|
|
19540
|
+
description: "Close the current observability session when the task is done (or aborted). Records a closing line, marks the thread ended, and triggers the opt-in end-of-session email to project devs. After this, later MCP calls no longer attach to this session. Idempotent \u2014 ending an already-ended session is a no-op. Free (0 credits).",
|
|
19541
|
+
inputSchema: {
|
|
19542
|
+
type: "object",
|
|
19543
|
+
properties: {
|
|
19544
|
+
project_uuid: PROJECT_UUID,
|
|
19545
|
+
session_id: SESSION_ID,
|
|
19546
|
+
summary: {
|
|
19547
|
+
type: "string",
|
|
19548
|
+
description: "Optional closing line, e.g. 'Repaired 12 keys, 1 decision pending'."
|
|
19549
|
+
},
|
|
19550
|
+
status: {
|
|
19551
|
+
type: "string",
|
|
19552
|
+
enum: ["ended", "aborted"],
|
|
19553
|
+
default: "ended",
|
|
19554
|
+
description: "ended for a normal finish; aborted if you stopped early."
|
|
19555
|
+
}
|
|
19556
|
+
},
|
|
19557
|
+
required: []
|
|
19558
|
+
}
|
|
19559
|
+
}
|
|
19560
|
+
};
|
|
19561
|
+
OBSERVABILITY_TOOL_NAMES = Object.keys(OBSERVABILITY_SCHEMAS);
|
|
19562
|
+
}
|
|
19563
|
+
});
|
|
19564
|
+
|
|
19565
|
+
// src/tools/schemas.prompts.ts
|
|
19566
|
+
var PROJECT_UUID2, PROMPTS_SCHEMAS, PROMPTS_TOOL_NAMES;
|
|
19567
|
+
var init_schemas_prompts = __esm({
|
|
19568
|
+
"src/tools/schemas.prompts.ts"() {
|
|
19569
|
+
"use strict";
|
|
19570
|
+
PROJECT_UUID2 = {
|
|
19571
|
+
type: "string",
|
|
19572
|
+
description: "Project UUID. Required when multiple projects are configured (SONENTA_PROJECTS); defaults to the single configured project otherwise."
|
|
19573
|
+
};
|
|
19574
|
+
PROMPTS_SCHEMAS = {
|
|
19575
|
+
list_prompts: {
|
|
19576
|
+
description: "Browse the Sonenta prompt library (the global catalogue). Use this to discover the reusable, curated prompts available for a project before you write your own \u2014 filter by section / subsection / tier / phase to narrow down. Read-only, free (0 credits). Returns {items:[{key, i18n_key, section, subsection, tier, phase, agent, category, title, template, enabled}], total}. To get a single ready-to-use template with variables filled, use resolve_prompt instead.",
|
|
19577
|
+
inputSchema: {
|
|
19578
|
+
type: "object",
|
|
19579
|
+
properties: {
|
|
19580
|
+
project_uuid: PROJECT_UUID2,
|
|
19581
|
+
section: { type: "string", description: "Filter by top-level section." },
|
|
19582
|
+
subsection: { type: "string", description: "Filter by subsection within a section." },
|
|
19583
|
+
tier: { type: "string", description: "Filter by tier." },
|
|
19584
|
+
phase: { type: "string", description: "Filter by phase." },
|
|
19585
|
+
enabled: {
|
|
19586
|
+
type: "boolean",
|
|
19587
|
+
description: "If set, return only enabled (true) or only disabled (false) prompts; omit for all."
|
|
19588
|
+
}
|
|
19589
|
+
}
|
|
19590
|
+
}
|
|
19591
|
+
},
|
|
19592
|
+
resolve_prompt: {
|
|
19593
|
+
description: "Resolve the single best-matching prompt for a section and get its template ready to use, with catalogue variables filled in. Use this when you want THE prompt for a job rather than a list to pick from. `section` is required; narrow further with subsection / tier / phase, and pass language / namespace / count to shape the resolved variables. Read-only, free (0 credits). Returns {prompt:{key, i18n_key, template, resolved, variables_used}}; errors 404 if nothing matches.",
|
|
19594
|
+
inputSchema: {
|
|
19595
|
+
type: "object",
|
|
19596
|
+
properties: {
|
|
19597
|
+
project_uuid: PROJECT_UUID2,
|
|
19598
|
+
section: { type: "string", description: "Section to resolve a prompt for (REQUIRED)." },
|
|
19599
|
+
subsection: { type: "string", description: "Optional subsection to narrow the match." },
|
|
19600
|
+
tier: { type: "string", description: "Optional tier to narrow the match." },
|
|
19601
|
+
phase: { type: "string", description: "Optional phase to narrow the match." },
|
|
19602
|
+
language: { type: "string", description: "Optional language code used when filling template variables." },
|
|
19603
|
+
namespace: { type: "string", description: "Optional namespace used when filling template variables." },
|
|
19604
|
+
count: {
|
|
19605
|
+
type: "integer",
|
|
19606
|
+
description: "Optional count used by count-dependent template variables (default 0)."
|
|
19607
|
+
}
|
|
19608
|
+
},
|
|
19609
|
+
required: ["section"]
|
|
19610
|
+
}
|
|
19611
|
+
}
|
|
19612
|
+
};
|
|
19613
|
+
PROMPTS_TOOL_NAMES = Object.keys(PROMPTS_SCHEMAS);
|
|
19614
|
+
}
|
|
19615
|
+
});
|
|
19616
|
+
|
|
19432
19617
|
// src/tools/registry.ts
|
|
19433
19618
|
var registry_exports = {};
|
|
19434
19619
|
__export(registry_exports, {
|
|
@@ -19441,6 +19626,14 @@ function copyPresent(body, args, keys) {
|
|
|
19441
19626
|
function copyTruthy(target, args, keys) {
|
|
19442
19627
|
for (const k of keys) if (args[k]) target[k] = args[k];
|
|
19443
19628
|
}
|
|
19629
|
+
function sessionId(args, client) {
|
|
19630
|
+
const explicit = args["session_id"];
|
|
19631
|
+
if (explicit) return str(explicit);
|
|
19632
|
+
if (client.sessionId) return client.sessionId;
|
|
19633
|
+
throw new ToolValidationError(
|
|
19634
|
+
"session_id is required (call session_start first, or pass session_id explicitly)"
|
|
19635
|
+
);
|
|
19636
|
+
}
|
|
19444
19637
|
function a11yReportParams(args) {
|
|
19445
19638
|
const params = {};
|
|
19446
19639
|
if (args["version_id"]) params["version_id"] = str(args["version_id"]);
|
|
@@ -19480,6 +19673,8 @@ var init_registry = __esm({
|
|
|
19480
19673
|
init_errors3();
|
|
19481
19674
|
init_helpers2();
|
|
19482
19675
|
init_schemas_generated();
|
|
19676
|
+
init_schemas_observability();
|
|
19677
|
+
init_schemas_prompts();
|
|
19483
19678
|
A11Y_SURFACES = ["aria_label", "alt_text", "screen_reader", "plain_language"];
|
|
19484
19679
|
has = (args, k) => k in args;
|
|
19485
19680
|
truthy = (args, k) => Boolean(args[k]);
|
|
@@ -19997,9 +20192,69 @@ var init_registry = __esm({
|
|
|
19997
20192
|
let url = `/v1/mcp/projects/${p}/source-duplicates/propose-plan`;
|
|
19998
20193
|
if (args["version_id"]) url += `?version_id=${str(args["version_id"])}`;
|
|
19999
20194
|
return client.post(url, body);
|
|
20195
|
+
},
|
|
20196
|
+
// ---- agent observability (contract v1, task 1611) ----
|
|
20197
|
+
async session_start(args, client) {
|
|
20198
|
+
const p = resolveProjectUuid(args, client);
|
|
20199
|
+
if (!truthy(args, "agent")) throw new ToolValidationError("agent is required");
|
|
20200
|
+
const body = { agent: args["agent"] };
|
|
20201
|
+
copyPresent(body, args, ["title", "session_ref", "metadata"]);
|
|
20202
|
+
const data = await client.post(`/v1/mcp/projects/${p}/agent/sessions`, body);
|
|
20203
|
+
const sid = data?.["session_id"];
|
|
20204
|
+
if (typeof sid === "string" && sid) client.setSession(sid);
|
|
20205
|
+
return data;
|
|
20206
|
+
},
|
|
20207
|
+
async annotate(args, client) {
|
|
20208
|
+
const p = resolveProjectUuid(args, client);
|
|
20209
|
+
const sid = sessionId(args, client);
|
|
20210
|
+
if (!truthy(args, "summary")) throw new ToolValidationError("summary is required");
|
|
20211
|
+
const body = { summary: args["summary"] };
|
|
20212
|
+
copyPresent(body, args, ["level", "payload"]);
|
|
20213
|
+
return client.post(`/v1/mcp/projects/${p}/agent/sessions/${sid}/annotate`, body);
|
|
20214
|
+
},
|
|
20215
|
+
async human_needed(args, client) {
|
|
20216
|
+
const p = resolveProjectUuid(args, client);
|
|
20217
|
+
const sid = sessionId(args, client);
|
|
20218
|
+
if (!truthy(args, "question")) throw new ToolValidationError("question is required");
|
|
20219
|
+
const body = { question: args["question"] };
|
|
20220
|
+
copyPresent(body, args, ["detail", "deep_link", "options"]);
|
|
20221
|
+
return client.post(`/v1/mcp/projects/${p}/agent/sessions/${sid}/human-needed`, body);
|
|
20222
|
+
},
|
|
20223
|
+
async session_end(args, client) {
|
|
20224
|
+
const p = resolveProjectUuid(args, client);
|
|
20225
|
+
const sid = sessionId(args, client);
|
|
20226
|
+
const body = {};
|
|
20227
|
+
copyPresent(body, args, ["summary", "status"]);
|
|
20228
|
+
const data = await client.post(`/v1/mcp/projects/${p}/agent/sessions/${sid}/end`, body);
|
|
20229
|
+
if (client.sessionId === sid) client.clearSession();
|
|
20230
|
+
return data;
|
|
20231
|
+
},
|
|
20232
|
+
// ---- prompt library (read-only, task 1618 / backend #230) ----
|
|
20233
|
+
async list_prompts(args, client) {
|
|
20234
|
+
const p = resolveProjectUuid(args, client);
|
|
20235
|
+
const params = {};
|
|
20236
|
+
for (const k of ["section", "subsection", "tier", "phase"]) {
|
|
20237
|
+
if (args[k]) params[k] = str(args[k]);
|
|
20238
|
+
}
|
|
20239
|
+
if ("enabled" in args) params["enabled"] = Boolean(args["enabled"]);
|
|
20240
|
+
return client.get(`/v1/mcp/projects/${p}/prompts/catalogue`, params);
|
|
20241
|
+
},
|
|
20242
|
+
async resolve_prompt(args, client) {
|
|
20243
|
+
const p = resolveProjectUuid(args, client);
|
|
20244
|
+
if (!truthy(args, "section")) throw new ToolValidationError("section is required");
|
|
20245
|
+
const params = { section: str(args["section"]) };
|
|
20246
|
+
for (const k of ["subsection", "tier", "phase", "language", "namespace"]) {
|
|
20247
|
+
if (args[k]) params[k] = str(args[k]);
|
|
20248
|
+
}
|
|
20249
|
+
if ("count" in args) params["count"] = args["count"];
|
|
20250
|
+
return client.get(`/v1/mcp/projects/${p}/prompts/resolve`, params);
|
|
20000
20251
|
}
|
|
20001
20252
|
};
|
|
20002
|
-
TOOLS = Object.entries(
|
|
20253
|
+
TOOLS = Object.entries({
|
|
20254
|
+
...SCHEMAS,
|
|
20255
|
+
...OBSERVABILITY_SCHEMAS,
|
|
20256
|
+
...PROMPTS_SCHEMAS
|
|
20257
|
+
}).map(([name, schema]) => {
|
|
20003
20258
|
const handler = HANDLERS[name];
|
|
20004
20259
|
if (!handler) throw new Error(`registry: no handler ported for tool '${name}'`);
|
|
20005
20260
|
return { name, description: schema.description, inputSchema: schema.inputSchema, handler };
|
|
@@ -20089,7 +20344,7 @@ var init_server3 = __esm({
|
|
|
20089
20344
|
init_errors3();
|
|
20090
20345
|
init_helpers2();
|
|
20091
20346
|
init_registry();
|
|
20092
|
-
VERSION = "0.
|
|
20347
|
+
VERSION = "0.38.0";
|
|
20093
20348
|
}
|
|
20094
20349
|
});
|
|
20095
20350
|
|