@tryvira/mcp 0.1.9 → 0.1.11
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/cli.js +16 -4
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -840,8 +840,8 @@ function createViraMcpServer(config) {
|
|
|
840
840
|
function createViraMcpOptions(config) {
|
|
841
841
|
if (!config.baseUrl?.trim() || !config.apiKey?.trim()) throw new Error("VIRA_MCP_CONFIG_REQUIRED");
|
|
842
842
|
const fetcher = config.fetcher ?? fetch;
|
|
843
|
-
const api = async (path, body, requestId) => {
|
|
844
|
-
const response = await fetcher(`${config.baseUrl.replace(/\/$/, "")}${path}`, { method: body ? "POST" : "GET", headers: { authorization: `Bearer ${config.apiKey}`, "content-type": "application/json", "idempotency-key": requestId }, ...body ? { body: JSON.stringify(body) } : {} });
|
|
843
|
+
const api = async (path, body, requestId, method) => {
|
|
844
|
+
const response = await fetcher(`${config.baseUrl.replace(/\/$/, "")}${path}`, { method: method ?? (body ? "POST" : "GET"), headers: { authorization: `Bearer ${config.apiKey}`, "content-type": "application/json", "idempotency-key": requestId }, ...body ? { body: JSON.stringify(body) } : {} });
|
|
845
845
|
const payload = await response.json().catch(() => null);
|
|
846
846
|
if (!response.ok) return { error: `VIRA_API_${response.status}`, result: payload };
|
|
847
847
|
return { result: payload };
|
|
@@ -912,6 +912,10 @@ function createViraMcpOptions(config) {
|
|
|
912
912
|
if (tool === "create_semantic_task") return api("/v1/semantic-tasks", args, `mcp:${tool}:${String(args.taskKey)}`);
|
|
913
913
|
if (tool === "list_behavior_points") return api("/v1/behavior-points", void 0, `mcp:${tool}:${config.scope.projectId}`);
|
|
914
914
|
if (tool === "create_behavior_point") return api("/v1/behavior-points", args, `mcp:${tool}:${String(args.key)}`);
|
|
915
|
+
if (tool === "delete_ai_system") return api(`/v1/ai-systems/${encodeURIComponent(String(args.systemId))}`, { confirm: args.confirm === true }, `mcp:${tool}:${String(args.systemId)}`, "DELETE");
|
|
916
|
+
if (tool === "delete_semantic_task") return api(`/v1/semantic-tasks/${encodeURIComponent(String(args.taskId))}`, { confirm: args.confirm === true }, `mcp:${tool}:${String(args.taskId)}`, "DELETE");
|
|
917
|
+
if (tool === "delete_behavior_point") return api(`/v1/behavior-points/${encodeURIComponent(String(args.pointId))}`, { confirm: args.confirm === true }, `mcp:${tool}:${String(args.pointId)}`, "DELETE");
|
|
918
|
+
if (tool === "delete_behavior_strategy") return api(`/v1/behavior-strategies/${encodeURIComponent(String(args.strategyId))}`, { confirm: args.confirm === true }, `mcp:${tool}:${String(args.strategyId)}`, "DELETE");
|
|
915
919
|
if (tool === "activate_behavior_strategy") return api(`/v1/behavior-strategies/${encodeURIComponent(String(args.strategyId))}/activate`, {}, `mcp:${tool}:${String(args.strategyId)}`);
|
|
916
920
|
return authoringTransport.call(input);
|
|
917
921
|
} };
|
|
@@ -984,6 +988,10 @@ var init_vira_server = __esm({
|
|
|
984
988
|
{ name: "continue_strategy_execution", description: "Continue a waiting Strategy execution with the same pinned artifact, state, and external references.", effectful: true, inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, executionId: { type: "string" }, authorityDigest: { type: "string" }, state: { type: "object", additionalProperties: true }, references: { type: "object", additionalProperties: true } }, required: ["organizationId", "projectId", "environmentId", "executionId"] } },
|
|
985
989
|
{ name: "cancel_strategy_execution", description: "Cancel a non-terminal scoped Strategy execution.", effectful: true, inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, executionId: { type: "string" } }, required: ["organizationId", "projectId", "environmentId", "executionId"] } },
|
|
986
990
|
{ name: "list_ai_systems", description: "Read connected AI systems in the configured scope.", inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" } }, required: ["organizationId", "projectId", "environmentId"] } },
|
|
991
|
+
{ name: "delete_ai_system", description: "Delete an unused scoped AI system after explicit confirmation.", effectful: true, inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, systemId: { type: "string" }, confirm: { type: "boolean" } }, required: ["organizationId", "projectId", "environmentId", "systemId", "confirm"] } },
|
|
992
|
+
{ name: "delete_semantic_task", description: "Delete an unused scoped Semantic Task after explicit confirmation.", effectful: true, inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, taskId: { type: "string" }, confirm: { type: "boolean" } }, required: ["organizationId", "projectId", "environmentId", "taskId", "confirm"] } },
|
|
993
|
+
{ name: "delete_behavior_point", description: "Delete an unused scoped BehaviorPoint after explicit confirmation.", effectful: true, inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, pointId: { type: "string" }, confirm: { type: "boolean" } }, required: ["organizationId", "projectId", "environmentId", "pointId", "confirm"] } },
|
|
994
|
+
{ name: "delete_behavior_strategy", description: "Delete a non-active unused scoped Behavior Strategy after explicit confirmation.", effectful: true, inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, strategyId: { type: "string" }, confirm: { type: "boolean" } }, required: ["organizationId", "projectId", "environmentId", "strategyId", "confirm"] } },
|
|
987
995
|
{ name: "list_discovery_candidates", description: "Read evidence-backed discovery candidates awaiting human review.", inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, reviewState: { type: "string" } }, required: ["organizationId", "projectId", "environmentId"] } },
|
|
988
996
|
{ name: "review_discovery_candidate", description: "Record a human review decision for a scoped discovery candidate.", effectful: true, inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, kind: { type: "string" }, key: { type: "string" }, decision: { type: "string" }, payload: { type: "object" } }, required: ["organizationId", "projectId", "environmentId", "kind", "key", "decision"] } },
|
|
989
997
|
{ name: "create_observation", description: "Submit one scoped observation for discovery; it does not publish behavior.", effectful: true, inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, id: { type: "string" }, content: { type: "object" }, consent: { type: "boolean" } }, required: ["organizationId", "projectId", "environmentId", "id", "content", "consent"] } },
|
|
@@ -1244,7 +1252,7 @@ async function applyPostgresMigrations(client, migrations) {
|
|
|
1244
1252
|
if (appliedIds.has(migration.id)) {
|
|
1245
1253
|
const previous = appliedIds.get(migration.id);
|
|
1246
1254
|
if (previous && previous !== checksum) {
|
|
1247
|
-
if (previous !== legacyChecksum) throw new Error(`POSTGRES_MIGRATION_CHECKSUM_MISMATCH:${migration.id}`);
|
|
1255
|
+
if (previous !== legacyChecksum && !migration.legacyChecksums?.includes(previous)) throw new Error(`POSTGRES_MIGRATION_CHECKSUM_MISMATCH:${migration.id}`);
|
|
1248
1256
|
await client.query("UPDATE vira_schema_migrations SET checksum=$1, code_version=$2 WHERE id=$3", [checksum, migration.codeVersion ?? process.env.VIRA_VERSION ?? null, migration.id]);
|
|
1249
1257
|
}
|
|
1250
1258
|
if (!previous) await client.query("UPDATE vira_schema_migrations SET checksum=$1, code_version=$2 WHERE id=$3", [checksum, migration.codeVersion ?? process.env.VIRA_VERSION ?? null, migration.id]);
|
|
@@ -1278,7 +1286,11 @@ async function openPostgresRuntime(options = {}) {
|
|
|
1278
1286
|
try {
|
|
1279
1287
|
const migrations = [];
|
|
1280
1288
|
const migrationPaths = options.migrationPaths ?? [...defaultMigrationPaths, resolve(here, "../migrations/006_postgres_control_plane_repositories.sql")];
|
|
1281
|
-
for (const path of migrationPaths)
|
|
1289
|
+
for (const path of migrationPaths) {
|
|
1290
|
+
const id = path.split(/[\\/]/).pop().replace(/\.sql$/i, "");
|
|
1291
|
+
const legacyChecksums = id === "001_vnext_foundation" ? ["d1a175e1b8af20bcf9bc650fb299626513532e4d18da429569251eff69475427"] : void 0;
|
|
1292
|
+
migrations.push({ id, sql: await readFile(path, "utf8"), ...legacyChecksums ? { legacyChecksums } : {} });
|
|
1293
|
+
}
|
|
1282
1294
|
const client = await pool.connect();
|
|
1283
1295
|
try {
|
|
1284
1296
|
await applyPostgresMigrations(client, migrations);
|