@tryvira/mcp 0.1.79 → 0.1.91
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 +9 -3
- package/dist/cli.js +575 -67
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# @tryvira/mcp 0.1.
|
|
1
|
+
# @tryvira/mcp 0.1.91
|
|
2
2
|
|
|
3
3
|
An MCP server for connecting MCP-compatible applications to Vira's governed AI
|
|
4
4
|
behavior and runtime APIs. The package is MIT licensed.
|
|
@@ -26,12 +26,16 @@ VIRA_API_KEY=vira_dev_local.local-development-only-32chars
|
|
|
26
26
|
VIRA_ORGANIZATION_ID=local-org
|
|
27
27
|
VIRA_PROJECT_ID=local-project
|
|
28
28
|
VIRA_ENVIRONMENT_ID=local
|
|
29
|
+
VIRA_ORGANIZATION_UNIT_ID=local-sales
|
|
29
30
|
```
|
|
30
31
|
|
|
31
32
|
MCP API calls allow up to 30 seconds per request by default. Set
|
|
32
33
|
`VIRA_MCP_API_TIMEOUT_MS` to a value from `1000` to `120000` when the connected
|
|
33
34
|
Control API needs a different request budget. The MCP adapter retries once for
|
|
34
35
|
safe reads and idempotency-keyed operations.
|
|
36
|
+
For projects linked to organization units, set `VIRA_ORGANIZATION_UNIT_ID` to
|
|
37
|
+
select an active unit membership. If the actor belongs to several linked units,
|
|
38
|
+
this selection is required.
|
|
35
39
|
|
|
36
40
|
For example, an MCP client configuration uses the same names:
|
|
37
41
|
|
|
@@ -50,11 +54,13 @@ policy, evaluation, and release eligibility. The server does not bypass those ch
|
|
|
50
54
|
|
|
51
55
|
## What a client can discover
|
|
52
56
|
|
|
53
|
-
|
|
54
|
-
workflow tools cover connection, semantic resolution, TaskRuns, Teach, evaluation,
|
|
57
|
+
The current source exposes a compact, task-oriented public catalog. The first-class
|
|
58
|
+
workflow tools cover connection, semantic resolution, TaskRuns, compound plan persistence/readback, Teach, evaluation,
|
|
55
59
|
pack release and runtime projection. The remaining registered Control API operations
|
|
56
60
|
are available through `read_control_api` and `write_control_api`, so the catalog
|
|
57
61
|
does not duplicate every GET/POST route as a separate model-facing tool.
|
|
62
|
+
Organization-unit tools cover scoped hierarchy reads, membership management, and project bindings;
|
|
63
|
+
the API enforces owner and Department Admin limits on every request.
|
|
58
64
|
AI System/connection diagnostics, Behavior Programs and Strategies, Pack
|
|
59
65
|
evaluation/approval/revision/materialization, TaskRun readback and recovery,
|
|
60
66
|
observation and signal operations, Teach analysis/review, comparative
|
package/dist/cli.js
CHANGED
|
@@ -13,9 +13,19 @@ var registry = /* @__PURE__ */ Object.create(null);
|
|
|
13
13
|
var add = (names, authority) => names.forEach((name) => {
|
|
14
14
|
registry[name] = authority;
|
|
15
15
|
});
|
|
16
|
-
var generatedReadTools = ["list_strategy_executions", "search_runtime_traces", "get_ai_system", "list_system_connections", "list_inventory", "get_connection", "get_connection_health", "list_teach_analyses", "get_teach_analysis", "get_evaluation", "list_conversation_archive", "list_teach_runs", "get_teach_run_recommendation", "get_improvement_proposal", "list_compound_task_plans", "get_compound_task_plan", "get_behavior_program"];
|
|
16
|
+
var generatedReadTools = ["list_strategy_executions", "search_runtime_traces", "get_ai_system", "list_system_connections", "list_inventory", "get_connection", "get_connection_health", "list_teach_analyses", "get_teach_analysis", "get_evaluation", "list_conversation_archive", "list_teach_runs", "get_teach_run_recommendation", "get_task_run_evidence", "get_improvement_proposal", "list_compound_task_plans", "get_compound_task_plan", "get_behavior_program"];
|
|
17
17
|
add(generatedReadTools, read());
|
|
18
|
-
add(["get_scope", "list_capabilities", "get_job", "list_inbox", "get_conflict_inspection", "get_optimization_run", "list_semantic_tasks", "list_behavior_points", "list_behavior_programs", "list_behavior_strategies", "get_behavior_strategy", "get_behavior_program", "get_task_run", "list_task_run_events", "get_strategy_execution", "get_strategy_execution_trace", "list_ai_systems", "get_ai_system", "list_system_connections", "get_connection", "get_connection_health", "list_inventory", "list_connection_inventory", "list_discovery_candidates", "get_signal_mapping", "get_pack_revision", "get_pack_revision_diff", "list_packs", "get_pack", "diagnose_pack", "list_evaluations", "get_teach_analysis", "get_teach_run_recommendation", "get_evaluation", "get_evaluation_comparison", "get_evaluation_plan", "get_improvement_proposal", "search_runtime_traces"], read());
|
|
18
|
+
add(["get_scope", "list_capabilities", "get_job", "list_inbox", "get_conflict_inspection", "get_optimization_run", "list_semantic_tasks", "list_behavior_points", "list_behavior_programs", "list_behavior_strategies", "get_behavior_strategy", "get_behavior_program", "get_task_run", "list_task_run_events", "get_strategy_execution", "get_strategy_execution_trace", "get_ai_usage_reconciliation", "list_ai_systems", "get_ai_system", "list_system_connections", "get_connection", "get_connection_health", "list_inventory", "list_connection_inventory", "list_discovery_candidates", "get_signal_mapping", "get_pack_revision", "get_pack_revision_diff", "list_packs", "get_pack", "diagnose_pack", "list_evaluations", "get_teach_analysis", "get_teach_run_recommendation", "get_evaluation", "get_evaluation_comparison", "get_evaluation_plan", "get_improvement_proposal", "search_runtime_traces"], read());
|
|
19
|
+
add(["list_organization_units", "list_organization_unit_members", "list_project_organization_units", "list_organization_billing_admins", "list_ai_system_unit_grants", "get_ai_credit_wallet", "list_ai_credit_budgets", "list_ai_usage_receipts", "get_ai_usage_summary", "list_notification_destinations"], read());
|
|
20
|
+
registry.preview_organization_unit_archive = { permissionClass: "integration.read", requiredRoles: ["workspace.owner"], effectType: "read", scopePolicy: "environment", approvalRequirement: "none" };
|
|
21
|
+
add(["reserve_ai_credits", "release_ai_credit_reservation"], effectful("billing.write", "human", ["admin.billing.write", "workspace.owner"]));
|
|
22
|
+
add(["save_compound_task_plan"], effectful("runtime.execute", "server"));
|
|
23
|
+
add(["queue_task_run_host_dispatch"], effectful("runtime.execute", "human"));
|
|
24
|
+
add(["create_organization_unit", "set_organization_unit_member", "bind_project_organization_unit"], effectful("integration.write", "human", ["workspace.owner"]));
|
|
25
|
+
add(["archive_organization_unit"], effectful("integration.write", "human", ["workspace.owner"]));
|
|
26
|
+
add(["set_organization_billing_admin"], effectful("billing.write", "human", ["workspace.owner"]));
|
|
27
|
+
add(["grant_ai_system_unit_access", "revoke_ai_system_unit_access"], effectful("integration.write", "human", ["workspace.owner"]));
|
|
28
|
+
add(["create_notification_destination", "revoke_notification_destination"], effectful("integration.write", "human", ["workspace.owner"]));
|
|
19
29
|
add(["connect_ai_system", "observe", "record_user_feedback", "record_business_outcome"], effectful("integration.write", "server", ["studio.write", "admin"]));
|
|
20
30
|
add(["mark_inbox_read"], effectful("teach.write", "server", ["studio.write", "admin"]));
|
|
21
31
|
add(["inspect_conflicts", "resolve_conflict"], effectful("behavior.write", "server", ["studio.write", "admin", "release.approve"]));
|
|
@@ -25,7 +35,7 @@ add(["test_connection"], effectful("integration.write", "server", ["studio.write
|
|
|
25
35
|
add(["resolve_semantic", "resolve_task_run", "simulate_behavior_strategy"], read("runtime.execute"));
|
|
26
36
|
add(["observe"], effectful("observation.write", "server", ["integration.write", "studio.write", "admin"]));
|
|
27
37
|
add(["list_observations", "get_observation"], read("observation.write"));
|
|
28
|
-
add(["resolve_runtime", "start_task_run", "continue_task_run", "cancel_task_run", "retry_task_run", "start_strategy_execution", "continue_strategy_execution", "cancel_strategy_execution", "compile_behavior_capsule", "serve_behavior_projection", "authorize_host_tool"], effectful("runtime.execute"));
|
|
38
|
+
add(["execute_managed_chat", "resolve_runtime", "start_task_run", "continue_task_run", "cancel_task_run", "retry_task_run", "start_strategy_execution", "continue_strategy_execution", "cancel_strategy_execution", "compile_behavior_capsule", "serve_behavior_projection", "authorize_host_tool"], effectful("runtime.execute"));
|
|
29
39
|
add(["create_semantic_task", "create_behavior_point", "activate_behavior_strategy", "delete_ai_system", "delete_semantic_task", "delete_behavior_point", "delete_behavior_strategy"], effectful("behavior.write", "server", ["integration.write", "studio.write", "release.approve", "admin"]));
|
|
30
40
|
add(["create_behavior_program", "delete_behavior_program", "delete_behavior_program_cascade", "validate_behavior_strategy", "activate_behavior_strategy", "create_behavior_strategy", "create_behavior_strategy_variant"], effectful("behavior.write", "server", ["integration.write", "studio.write", "release.approve", "admin"]));
|
|
31
41
|
add(["submit_teach_evidence", "create_teach_proposal", "transition_teach_proposal", "accept_teach_recommendation"], effectful("teach.write", "server", ["integration.write", "studio.write", "admin"]));
|
|
@@ -34,6 +44,7 @@ registry.get_teach_behavior_set = read();
|
|
|
34
44
|
add(["start_evaluation", "create_evaluation_plan", "seal_evaluation_plan", "create_improvement_proposal", "review_improvement_proposal", "create_behavior_revision_candidate", "evaluate_behavior_revision_candidate", "accept_behavior_revision_candidate"], effectful("evaluation.write", "server", ["integration.write", "studio.write", "admin"]));
|
|
35
45
|
add(["review_comparative_finding", "edit_improvement_proposal", "transition_behavior_revision_candidate"], effectful("evaluation.write", "server", ["integration.write", "studio.write", "admin"]));
|
|
36
46
|
add(["create_release"], effectful("release.approve", "human"));
|
|
47
|
+
add(["retire_program_pointer"], effectful("release.approve", "human"));
|
|
37
48
|
add(["create_signal_discovery_proposal", "review_signal_discovery_proposal", "materialize_signal_discovery", "create_signal_mapping", "review_signal_mapping", "review_discovery_candidate"], effectful("discovery.write"));
|
|
38
49
|
add(["create_observation"], effectful("observation.write"));
|
|
39
50
|
add(["create_pack_revision", "transition_pack_revision", "materialize_pack_revision", "import_pack", "install_pack", "evaluate_pack", "approve_pack", "release_pack", "preview_pack_upgrade"], effectful("pack.write", "server", ["integration.write", "studio.write", "release.approve", "admin"]));
|
|
@@ -52,8 +63,30 @@ var isKnownMcpTool = (tool) => Boolean(getMcpToolAuthority(tool));
|
|
|
52
63
|
// src/public-tool-catalog.ts
|
|
53
64
|
var coreTools = Object.freeze([
|
|
54
65
|
{ name: "get_scope", description: "Read the immutable scope configured for this MCP session.", inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" } }, required: ["organizationId", "projectId", "environmentId"] } },
|
|
55
|
-
{ name: "list_capabilities", description: "Show
|
|
66
|
+
{ name: "list_capabilities", description: "Show coarse role-based product capability groups and the canonical Control API operation inventory. Role eligibility is a hint; it is not per-operation availability or authorization.", inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, surface: { type: "string" } }, required: ["organizationId", "projectId", "environmentId"] } },
|
|
67
|
+
{ name: "list_organization_units", description: "List organization units visible to the authenticated actor.", inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" } }, required: ["organizationId", "projectId", "environmentId"] } },
|
|
68
|
+
{ name: "list_ai_system_unit_grants", description: "List unit access grants for an AI System. Workspace owner permission is required.", inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, aiSystemId: { type: "string" } }, required: ["organizationId", "projectId", "environmentId", "aiSystemId"] } },
|
|
69
|
+
{ name: "grant_ai_system_unit_access", description: "Grant scoped capabilities on an AI System to a Project-bound unit. Workspace owner permission is required.", effectful: true, inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, aiSystemId: { type: "string" }, unitId: { type: "string" }, permissions: { type: "array", items: { type: "string", enum: ["system.read", "system.use", "observation.write", "teach.write", "evaluation.write", "release.approve", "integration.manage", "secret.read", "trace.read"] } } }, required: ["organizationId", "projectId", "environmentId", "aiSystemId", "unitId", "permissions"] } },
|
|
70
|
+
{ name: "revoke_ai_system_unit_access", description: "Revoke an AI System unit access grant. Workspace owner permission is required.", effectful: true, inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, aiSystemId: { type: "string" }, unitId: { type: "string" } }, required: ["organizationId", "projectId", "environmentId", "aiSystemId", "unitId"] } },
|
|
71
|
+
{ name: "list_organization_billing_admins", description: "List organization Billing Admin memberships. Workspace owner permission is required.", inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" } }, required: ["organizationId", "projectId", "environmentId"] } },
|
|
72
|
+
{ name: "set_organization_billing_admin", description: "Grant or revoke an organization Billing Admin membership. Workspace owner permission is required.", effectful: true, inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, actorId: { type: "string" }, status: { type: "string", enum: ["ACTIVE", "REVOKED"] } }, required: ["organizationId", "projectId", "environmentId", "actorId", "status"] } },
|
|
73
|
+
{ name: "get_ai_credit_wallet", description: "Read the organization AI credit balance and recent ledger entries. Organization billing admin permission is required.", inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" } }, required: ["organizationId", "projectId", "environmentId"] } },
|
|
74
|
+
{ name: "get_ai_usage_summary", description: "Read monthly provider cost and customer credits by provider/model, optionally filtered to an organization unit. Owners and Billing Admins may read organization data; a Department Admin sees only their active unit.", inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, organizationUnitId: { type: "string", minLength: 1 } }, required: ["organizationId", "projectId", "environmentId"] } },
|
|
75
|
+
{ name: "list_ai_usage_receipts", description: "Read rated provider usage receipts, optionally filtered to an organization unit. Owners and Billing Admins may read organization data; a Department Admin sees only their active unit.", inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, organizationUnitId: { type: "string", minLength: 1 }, limit: { type: "integer", minimum: 1, maximum: 500 } }, required: ["organizationId", "projectId", "environmentId"] } },
|
|
76
|
+
{ name: "list_ai_credit_budgets", description: "Read organization AI credit budget caps and consumed or reserved usage. Organization billing admin permission is required.", inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" } }, required: ["organizationId", "projectId", "environmentId"] } },
|
|
77
|
+
{ name: "reserve_ai_credits", description: "Reserve an approved upper bound before a managed AI provider call. Organization Billing Admin permission and human approval are required.", effectful: true, inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, amountMicrocredits: { type: "integer", minimum: 1, maximum: 9007199254740991 }, periodStart: { type: "string" }, periodEnd: { type: "string" }, idempotencyKey: { type: "string" }, aiSystemId: { type: "string" } }, required: ["organizationId", "projectId", "environmentId", "amountMicrocredits", "periodStart", "periodEnd", "idempotencyKey"] } },
|
|
78
|
+
{ name: "release_ai_credit_reservation", description: "Release an unused AI credit reservation before a usage receipt is recorded. Organization Billing Admin permission and human approval are required.", effectful: true, inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, reservationId: { type: "string" }, idempotencyKey: { type: "string" } }, required: ["organizationId", "projectId", "environmentId", "reservationId"] } },
|
|
79
|
+
{ name: "create_organization_unit", description: "Create an organization unit. Workspace owner permission is required.", effectful: true, inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, id: { type: "string" }, parentUnitId: { type: ["string", "null"] }, name: { type: "string" }, kind: { type: "string", enum: ["business_unit", "department", "team"] } }, required: ["organizationId", "projectId", "environmentId", "name", "kind"] } },
|
|
80
|
+
{ name: "list_organization_unit_members", description: "List memberships for a unit managed by the authenticated owner or Department Admin.", inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, unitId: { type: "string" } }, required: ["organizationId", "projectId", "environmentId", "unitId"] } },
|
|
81
|
+
{ name: "preview_organization_unit_archive", description: "Preview the affected descendants, memberships, and project ownership before an organization unit is archived. Workspace owner permission is required.", inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, unitId: { type: "string" } }, required: ["organizationId", "projectId", "environmentId", "unitId"] } },
|
|
82
|
+
{ name: "archive_organization_unit", description: "Archive an organization unit subtree after reviewing its impact. Workspace owner permission and explicit confirmation are required.", effectful: true, inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, unitId: { type: "string" }, confirm: { type: "boolean", const: true } }, required: ["organizationId", "projectId", "environmentId", "unitId", "confirm"] } },
|
|
83
|
+
{ name: "set_organization_unit_member", description: "Set a scoped unit membership. Owner authority is required for elevated roles.", effectful: true, inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, unitId: { type: "string" }, actorId: { type: "string" }, role: { type: "string", enum: ["department_admin", "teacher", "reviewer", "billing_admin", "viewer"] }, status: { type: "string", enum: ["ACTIVE", "REVOKED"] } }, required: ["organizationId", "projectId", "environmentId", "unitId", "actorId", "role"] } },
|
|
84
|
+
{ name: "list_project_organization_units", description: "List organization unit bindings for the current project.", inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, targetProjectId: { type: "string" } }, required: ["organizationId", "projectId", "environmentId", "targetProjectId"] } },
|
|
85
|
+
{ name: "bind_project_organization_unit", description: "Bind an organization unit to a project. Workspace owners may bind units and assign primary ownership; Department Admins may bind only their active unit as a non-primary owner.", effectful: true, inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, targetProjectId: { type: "string" }, unitId: { type: "string" }, primaryOwner: { type: "boolean" } }, required: ["organizationId", "projectId", "environmentId", "targetProjectId", "unitId"] } },
|
|
56
86
|
{ name: "list_inbox", description: "List scoped review notifications for the authenticated actor.", inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, limit: { type: "number" } }, required: ["organizationId", "projectId", "environmentId"] } },
|
|
87
|
+
{ name: "list_notification_destinations", description: "List authorized notification destinations in the current organization, project, and environment scope. Endpoint secrets are never returned.", inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" } }, required: ["organizationId", "projectId", "environmentId"] } },
|
|
88
|
+
{ name: "create_notification_destination", description: "Register an encrypted Slack or Microsoft Teams Workflows destination. The endpoint is a secret and is never returned; owner or integration.write permission is required.", effectful: true, inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, label: { type: "string", minLength: 1 }, provider: { type: "string", enum: ["slack", "microsoft_teams"] }, endpoint: { type: "string", minLength: 1, writeOnly: true }, idempotencyKey: { type: "string", minLength: 1 } }, required: ["organizationId", "projectId", "environmentId", "label", "provider", "endpoint"] } },
|
|
89
|
+
{ name: "revoke_notification_destination", description: "Revoke a scoped notification destination. Pending deliveries are suppressed after revocation; owner or integration.write permission is required.", effectful: true, inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, destinationId: { type: "string", minLength: 1 } }, required: ["organizationId", "projectId", "environmentId", "destinationId"] } },
|
|
57
90
|
{ name: "mark_inbox_read", description: "Mark one scoped review notification as read.", effectful: true, inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, notificationId: { type: "string" } }, required: ["organizationId", "projectId", "environmentId", "notificationId"] } },
|
|
58
91
|
{ name: "inspect_conflicts", description: "Create a scoped conflict inspection.", effectful: true, inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, id: { type: "string" }, proposed: { type: "array", items: { type: "object", additionalProperties: false, properties: { id: { type: "string" }, controlPointId: { type: "string" }, policyEffect: { type: "string" }, strategyKey: { type: "string" }, scope: { type: "string" } }, required: ["id", "controlPointId", "policyEffect", "strategyKey"] } }, active: { type: "array", items: { type: "object", additionalProperties: false, properties: { id: { type: "string" }, controlPointId: { type: "string" }, policyEffect: { type: "string" }, strategyKey: { type: "string" }, scope: { type: "string" } }, required: ["id", "controlPointId", "policyEffect", "strategyKey"] } }, controls: { type: "array", items: { type: "object", additionalProperties: false, properties: { id: { type: "string" }, level: { type: "string" }, autonomy: { type: "string", enum: ["MANUAL", "ASSISTED", "AUTOMATIC"] }, value: { type: "string" }, enabled: { type: "boolean" }, authorityDigest: { type: ["string", "null"] } }, required: ["id", "level", "autonomy", "value", "enabled"] } } }, required: ["organizationId", "projectId", "environmentId", "proposed", "active", "controls"] } },
|
|
59
92
|
{ name: "get_conflict_inspection", description: "Read a persisted scoped conflict inspection.", inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, inspectionId: { type: "string" } }, required: ["organizationId", "projectId", "environmentId", "inspectionId"] } },
|
|
@@ -74,11 +107,18 @@ var coreTools = Object.freeze([
|
|
|
74
107
|
{ name: "accept_teach_recommendation", description: "Accept a complete Teach behavior graph for evaluation; this never publishes directly.", effectful: true, inputSchema: { type: "object", properties: { teachRunId: { type: "string" }, actorId: { type: "string" } }, required: ["teachRunId", "actorId"] } },
|
|
75
108
|
{ name: "create_teach_proposal", description: "Create a reviewed Teach proposal from admitted evidence.", effectful: true, inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, evidenceId: { type: "string" }, controlPointId: { type: "string" }, summary: { type: "string" } }, required: ["organizationId", "projectId", "environmentId", "evidenceId", "controlPointId", "summary"] } },
|
|
76
109
|
{ name: "transition_teach_proposal", description: "Review, evaluate, or promote a Teach proposal.", effectful: true, inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, proposalId: { type: "string" }, transition: { type: "string" }, decision: { type: "string" }, score: { type: "number" }, evaluationId: { type: "string" } }, required: ["organizationId", "projectId", "environmentId", "proposalId", "transition"] } },
|
|
77
|
-
{ name: "create_release", description: "Create a scoped release using either provider-backed evaluation or explicit manual approval with step-up evidence.", effectful: true, inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, releaseId: { type: "string" }, artifactId: { type: "string" }, evaluationId: { type: "string" }, manualApproval: { type: "object", properties: { reason: { type: "string" } }, required: ["reason"] }, stepUp: { type: "object", properties: { id: { type: "string" }, assertion: { type: "string" }, purpose: { type: "string" } }, required: ["id", "assertion", "purpose"] } }, required: ["organizationId", "projectId", "environmentId", "artifactId"] } },
|
|
78
|
-
{ name: "
|
|
79
|
-
{ name: "
|
|
80
|
-
{ name: "
|
|
110
|
+
{ name: "create_release", description: "Create a scoped release using either provider-backed evaluation or explicit manual approval with step-up evidence. Optionally set aiSystemId (or manifest.aiSystemId) to bind the release to an AI System; it must match the linked evaluation and the caller needs release.approve on that System.", effectful: true, inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, releaseId: { type: "string" }, artifactId: { type: "string" }, evaluationId: { type: "string" }, aiSystemId: { type: "string" }, manifest: { type: "object", properties: { aiSystemId: { type: "string" } }, additionalProperties: true }, manualApproval: { type: "object", properties: { reason: { type: "string" } }, required: ["reason"] }, stepUp: { type: "object", properties: { id: { type: "string" }, assertion: { type: "string" }, purpose: { type: "string" } }, required: ["id", "assertion", "purpose"] } }, required: ["organizationId", "projectId", "environmentId", "artifactId"] } },
|
|
111
|
+
{ name: "retire_program_pointer", description: "Retire the current scoped program pointer with a version fence. Irreversible for the active pointer; requires release.approve permission and explicit human confirmation.", effectful: true, inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, pointerKey: { type: "string", minLength: 1 }, confirm: { type: "boolean", const: true }, expectedVersion: { type: "integer", minimum: 1, maximum: Number.MAX_SAFE_INTEGER }, reason: { type: "string", minLength: 1, maxLength: 500 } }, required: ["organizationId", "projectId", "environmentId", "pointerKey", "confirm", "expectedVersion", "reason"] } },
|
|
112
|
+
{ name: "resolve_semantic", description: "Resolve input through the governed semantic runtime. Remote inference consumes AI credits for the authorized AI System.", inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, input: { type: "string" }, aiSystemId: { type: "string", minLength: 1 }, requestId: { type: "string", minLength: 1 }, sessionId: { type: "string" }, profile: { type: "object" }, selection: { type: "object" }, candidates: { type: "array", items: { type: "object", additionalProperties: true } }, timeoutMs: { type: "number" } }, required: ["organizationId", "projectId", "environmentId", "input", "aiSystemId"] } },
|
|
113
|
+
{ name: "execute_managed_chat", description: "Run an authorized Vira-managed chat completion. A provider usage receipt is settled before output is returned. This is a billable model operation, not BYOK observation.", effectful: true, inputSchema: { type: "object", additionalProperties: false, properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, organizationUnitId: { type: "string" }, aiSystemId: { type: "string", minLength: 1 }, connectionId: { type: "string", minLength: 1 }, operationId: { type: "string", minLength: 1, maxLength: 200 }, model: { type: "string", minLength: 1 }, messages: { type: "array", minItems: 1, maxItems: 128, items: { type: "object", additionalProperties: true } }, max_tokens: { type: "integer", minimum: 1, maximum: 8192 } }, required: ["organizationId", "projectId", "environmentId", "aiSystemId", "connectionId", "operationId", "model", "messages"] } },
|
|
114
|
+
{ name: "resolve_task_run", description: "Resolve a scoped TaskRun route without starting execution. Remote inference consumes AI credits for the authorized AI System.", inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, input: { type: "string" }, aiSystemId: { type: "string", minLength: 1 }, requestId: { type: "string", minLength: 1 }, requestedMode: { type: "string" }, intentCount: { type: "number" }, hostCapabilities: { type: "array", items: { type: "string" } } }, required: ["organizationId", "projectId", "environmentId", "input", "aiSystemId"] } },
|
|
115
|
+
{ name: "start_task_run", description: "Start a TaskRun from a natural-language request. The server requires an authorized AI System and derives the actor, host capabilities, mode and released plan; requestedMode and plan fields are advanced overrides only.", effectful: true, inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, aiSystemId: { type: "string" }, taskRunId: { type: "string" }, requestId: { type: "string" }, ownerActorRef: { type: "string" }, input: { type: "string" }, requestedMode: { type: "string" }, hostCapabilities: { type: "array", items: { type: "string" } } }, required: ["organizationId", "projectId", "environmentId", "aiSystemId", "input"] } },
|
|
116
|
+
{ name: "list_compound_task_plans", description: "List persisted compound execution plans for the authenticated organization, project, and environment with bounded cursor pagination.", inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, limit: { type: "number" }, cursor: { type: "string" } }, required: ["organizationId", "projectId", "environmentId"] } },
|
|
117
|
+
{ name: "save_compound_task_plan", description: "Persist a validated immutable compound execution plan in the authenticated scope. This writes a plan but does not execute it.", effectful: true, inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, plan: { type: "object", additionalProperties: true }, idempotencyKey: { type: "string" } }, required: ["organizationId", "projectId", "environmentId", "plan"] } },
|
|
118
|
+
{ name: "get_compound_task_plan", description: "Read one persisted compound execution plan in the authenticated organization, project, and environment.", inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, planId: { type: "string" } }, required: ["organizationId", "projectId", "environmentId", "planId"] } },
|
|
81
119
|
{ name: "get_task_run", description: "Read a scoped TaskRun state and lifecycle version.", inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, taskRunId: { type: "string" } }, required: ["organizationId", "projectId", "environmentId", "taskRunId"] } },
|
|
120
|
+
{ name: "queue_task_run_host_dispatch", description: "Queue an effectful SINGLE TaskRun after a real human approval has already been issued in the authenticated session. Never execute locally or issue an approval through this tool; read TaskRun evidence for the result.", effectful: true, inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, organizationUnitId: { type: "string" }, taskRunId: { type: "string" }, childRunId: { type: "string" }, aiSystemId: { type: "string" }, sessionId: { type: "string" }, approvalId: { type: "string" }, context: { type: "object", additionalProperties: true }, proposal: { type: "object", additionalProperties: true } }, required: ["organizationId", "projectId", "environmentId", "organizationUnitId", "taskRunId", "childRunId", "aiSystemId", "sessionId", "approvalId", "context", "proposal"] } },
|
|
121
|
+
{ name: "get_task_run_evidence", description: "Read one authorized TaskRun execution evidence graph: verified Strategy release/evaluation, step receipts and exact rated AI credit usage. Parent and child department/AI System grants are checked by Control API.", inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, taskRunId: { type: "string" } }, required: ["organizationId", "projectId", "environmentId", "taskRunId"] } },
|
|
82
122
|
{ name: "list_task_run_events", description: "Read the persisted scoped TaskRun lifecycle events.", inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, taskRunId: { type: "string" } }, required: ["organizationId", "projectId", "environmentId", "taskRunId"] } },
|
|
83
123
|
{ name: "continue_task_run", description: "Resume a waiting scoped TaskRun using its current state version.", effectful: true, inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, taskRunId: { type: "string" }, expectedVersion: { type: "number" }, cursor: { type: "string" } }, required: ["organizationId", "projectId", "environmentId", "taskRunId", "expectedVersion"] } },
|
|
84
124
|
{ name: "cancel_task_run", description: "Cancel a scoped TaskRun using its current state version.", effectful: true, inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, taskRunId: { type: "string" }, expectedVersion: { type: "number" } }, required: ["organizationId", "projectId", "environmentId", "taskRunId", "expectedVersion"] } },
|
|
@@ -97,18 +137,22 @@ var coreTools = Object.freeze([
|
|
|
97
137
|
{ name: "start_strategy_execution", description: "Start a persisted Strategy execution through the governed runtime boundary.", effectful: true, inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, behaviorPoint: { type: "string" }, executionBoundary: { type: "object" }, revisionId: { type: "string" }, idempotencyKey: { type: "string" }, nonce: { type: "string" }, expiresAt: { type: "number" }, decisionPlanId: { type: "string" }, candidates: { type: "array", items: { type: "object" } }, policy: { type: "string" }, allowedIds: { type: "array", items: { type: "string" } }, calibrationId: { type: "string" }, postModelJudge: { type: "object" }, shadow: { type: "object" }, artifactDigest: { type: "string" }, traceId: { type: "string" }, executionId: { type: "string" }, state: { type: "object" } }, required: ["organizationId", "projectId", "environmentId", "revisionId", "idempotencyKey", "nonce", "expiresAt", "decisionPlanId", "candidates", "policy", "artifactDigest"] } },
|
|
98
138
|
{ name: "get_strategy_execution", description: "Read one scoped Strategy execution.", inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, executionId: { type: "string" } }, required: ["organizationId", "projectId", "environmentId", "executionId"] } },
|
|
99
139
|
{ name: "get_strategy_execution_trace", description: "Read persisted Strategy step receipts and trace evidence.", inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, executionId: { type: "string" } }, required: ["organizationId", "projectId", "environmentId", "executionId"] } },
|
|
140
|
+
{ name: "get_ai_usage_reconciliation", description: "Read server-authorized Strategy provider request and rated-credit evidence for the active department. Read-only; does not create receipts, settle credits or approve a bill.", inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, executionId: { type: "string" } }, required: ["organizationId", "projectId", "environmentId", "executionId"] } },
|
|
100
141
|
{ 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"] } },
|
|
101
142
|
{ 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"] } },
|
|
102
|
-
{ name: "list_ai_systems", description: "Read
|
|
143
|
+
{ name: "list_ai_systems", description: "Read AI Systems visible in the selected department with optional cursor pagination and search. Results include the canonical ownerUnitId and active consumingUnitGrants for Workspace Owners; grants do not replace active membership.", inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, limit: { type: "number" }, cursor: { type: "string" }, search: { type: "string" } }, required: ["organizationId", "projectId", "environmentId"] } },
|
|
144
|
+
{ name: "get_connection_health", description: "Read the latest health state for one AI System connection.", inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, connectionId: { type: "string", minLength: 1 } }, required: ["organizationId", "projectId", "environmentId", "connectionId"] } },
|
|
145
|
+
{ name: "list_connection_inventory", description: "Read capability inventory for one AI System in the authenticated scope.", inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, systemId: { type: "string", minLength: 1 } }, required: ["organizationId", "projectId", "environmentId", "systemId"] } },
|
|
103
146
|
{ 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"] } },
|
|
104
147
|
{ 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"] } },
|
|
105
148
|
{ 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"] } },
|
|
106
149
|
{ 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"] } },
|
|
107
|
-
{ 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"] } },
|
|
150
|
+
{ 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" }, patch: { type: "object" }, payload: { type: "object", description: "Deprecated alias for patch; do not supply both." } }, required: ["organizationId", "projectId", "environmentId", "kind", "key", "decision"] } },
|
|
108
151
|
{ 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"] } },
|
|
109
|
-
{ name: "record_user_feedback", description: "Record scoped user feedback for an observed AI interaction.", effectful: true, inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, event: { type: "object" } }, required: ["organizationId", "projectId", "environmentId", "event"] } },
|
|
110
|
-
{ name: "record_business_outcome", description: "Record a scoped business outcome for an observed AI interaction.", effectful: true, inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, event: { type: "object" } }, required: ["organizationId", "projectId", "environmentId", "event"] } },
|
|
111
|
-
{ name: "
|
|
152
|
+
{ name: "record_user_feedback", description: "Record scoped user feedback for an observed AI interaction. Supply a stable eventId so retries are idempotent.", effectful: true, inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, event: { type: "object" } }, required: ["organizationId", "projectId", "environmentId", "event"] } },
|
|
153
|
+
{ name: "record_business_outcome", description: "Record a scoped business outcome for an observed AI interaction. Supply a stable eventId so retries are idempotent.", effectful: true, inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, event: { type: "object" } }, required: ["organizationId", "projectId", "environmentId", "event"] } },
|
|
154
|
+
{ name: "observe", description: "Submit an observation using a stable eventId. conversation.output events derive the canonical eventId from conversationId and requestId so OpenCode and MCP retries share one identity.", effectful: true, inputSchema: { type: "object", properties: { event: { type: "object", required: ["type"] }, idempotencyKey: { type: "string" } }, required: ["event"] } },
|
|
155
|
+
{ name: "start_evaluation", description: "Start a scoped evaluation. Use assertions for a manual evaluation, or planId + evaluationPolicy + comparisonPlan for a provider-backed execution bound to a sealed evaluation plan. Optionally set aiSystemId (or targetArtifact.aiSystemId) to persist AI System attribution; the caller needs evaluation.write on that System.", effectful: true, inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, id: { type: "string" }, aiSystemId: { type: "string" }, planId: { type: "string" }, evaluationPolicy: { type: "object" }, comparisonPlan: { type: "object", properties: { arms: { type: "array", items: { type: "string" } } }, required: ["arms"] }, targetArtifact: { oneOf: [{ type: "string" }, { type: "object", properties: { aiSystemId: { type: "string" } }, additionalProperties: true }] }, dataset: { type: "array", items: { type: "object", additionalProperties: true } }, assertions: { type: "array", items: { type: "boolean" } }, threshold: { type: "number" } }, required: ["organizationId", "projectId", "environmentId", "id", "dataset"] } },
|
|
112
156
|
{ name: "create_evaluation_plan", description: "Create an immutable OFF/current-on evaluation plan for a scoped behavior target.", effectful: true, inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, id: { type: "string" }, suiteId: { type: "string" }, suiteVersion: { type: "string" }, suiteDigest: { type: "string" }, datasetSnapshotDigest: { type: "string" }, evaluationPolicyDigest: { type: "string" }, arms: { type: "array" } }, required: ["organizationId", "projectId", "environmentId", "id", "suiteId", "suiteVersion", "suiteDigest", "datasetSnapshotDigest", "evaluationPolicyDigest", "arms"] } },
|
|
113
157
|
{ name: "seal_evaluation_plan", description: "Seal an evaluation plan so its suite, dataset, and execution arms cannot drift.", effectful: true, inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, planId: { type: "string" } }, required: ["organizationId", "projectId", "environmentId", "planId"] } },
|
|
114
158
|
{ name: "create_improvement_proposal", description: "Create a Teach improvement proposal from a completed comparative evaluation.", effectful: true, inputSchema: { type: "object", properties: { organizationId: { type: "string" }, projectId: { type: "string" }, environmentId: { type: "string" }, evaluationId: { type: "string" }, id: { type: "string" }, basePackId: { type: "string" }, basePackDigest: { type: "string" }, behaviorSet: { type: "object" } }, required: ["organizationId", "projectId", "environmentId", "evaluationId", "id", "basePackId", "basePackDigest"] } },
|
|
@@ -138,18 +182,51 @@ var coreTools = Object.freeze([
|
|
|
138
182
|
var MCP_PUBLIC_CORE_TOOL_NAMES = Object.freeze([
|
|
139
183
|
"get_scope",
|
|
140
184
|
"list_capabilities",
|
|
185
|
+
"list_organization_units",
|
|
186
|
+
"preview_organization_unit_archive",
|
|
187
|
+
"archive_organization_unit",
|
|
188
|
+
"list_ai_system_unit_grants",
|
|
189
|
+
"grant_ai_system_unit_access",
|
|
190
|
+
"revoke_ai_system_unit_access",
|
|
191
|
+
"list_organization_billing_admins",
|
|
192
|
+
"set_organization_billing_admin",
|
|
193
|
+
"get_ai_credit_wallet",
|
|
194
|
+
"list_ai_credit_budgets",
|
|
195
|
+
"reserve_ai_credits",
|
|
196
|
+
"release_ai_credit_reservation",
|
|
197
|
+
"list_ai_usage_receipts",
|
|
198
|
+
"get_ai_usage_summary",
|
|
199
|
+
"create_organization_unit",
|
|
200
|
+
"list_organization_unit_members",
|
|
201
|
+
"set_organization_unit_member",
|
|
202
|
+
"list_project_organization_units",
|
|
203
|
+
"bind_project_organization_unit",
|
|
141
204
|
"connect_ai_system",
|
|
142
205
|
"list_ai_systems",
|
|
206
|
+
"list_connection_inventory",
|
|
207
|
+
"get_connection_health",
|
|
143
208
|
"get_job",
|
|
144
209
|
"list_semantic_tasks",
|
|
145
210
|
"create_semantic_task",
|
|
146
211
|
"list_behavior_points",
|
|
147
212
|
"list_discovery_candidates",
|
|
213
|
+
"create_signal_discovery_proposal",
|
|
214
|
+
"review_signal_discovery_proposal",
|
|
215
|
+
"materialize_signal_discovery",
|
|
216
|
+
"create_signal_mapping",
|
|
217
|
+
"get_signal_mapping",
|
|
218
|
+
"review_signal_mapping",
|
|
148
219
|
"create_behavior_point",
|
|
149
220
|
"resolve_semantic",
|
|
221
|
+
"execute_managed_chat",
|
|
150
222
|
"resolve_task_run",
|
|
151
223
|
"start_task_run",
|
|
224
|
+
"list_compound_task_plans",
|
|
225
|
+
"save_compound_task_plan",
|
|
226
|
+
"get_compound_task_plan",
|
|
152
227
|
"get_task_run",
|
|
228
|
+
"get_task_run_evidence",
|
|
229
|
+
"queue_task_run_host_dispatch",
|
|
153
230
|
"list_task_run_events",
|
|
154
231
|
"continue_task_run",
|
|
155
232
|
"cancel_task_run",
|
|
@@ -177,6 +254,7 @@ var MCP_PUBLIC_CORE_TOOL_NAMES = Object.freeze([
|
|
|
177
254
|
"approve_pack",
|
|
178
255
|
"release_pack",
|
|
179
256
|
"create_release",
|
|
257
|
+
"retire_program_pointer",
|
|
180
258
|
"serve_behavior_projection",
|
|
181
259
|
"list_behavior_strategies",
|
|
182
260
|
"get_behavior_strategy",
|
|
@@ -185,8 +263,12 @@ var MCP_PUBLIC_CORE_TOOL_NAMES = Object.freeze([
|
|
|
185
263
|
"get_pack",
|
|
186
264
|
"list_evaluations",
|
|
187
265
|
"get_strategy_execution_trace",
|
|
266
|
+
"get_ai_usage_reconciliation",
|
|
188
267
|
"continue_strategy_execution",
|
|
189
268
|
"list_inbox",
|
|
269
|
+
"list_notification_destinations",
|
|
270
|
+
"create_notification_destination",
|
|
271
|
+
"revoke_notification_destination",
|
|
190
272
|
"mark_inbox_read",
|
|
191
273
|
"inspect_conflicts",
|
|
192
274
|
"get_conflict_inspection",
|
|
@@ -224,8 +306,8 @@ var parameterDescription = (toolName, name) => {
|
|
|
224
306
|
var normalizeJsonSchema = (value) => {
|
|
225
307
|
if (Array.isArray(value)) return value.map(normalizeJsonSchema);
|
|
226
308
|
if (!value || typeof value !== "object") return value;
|
|
227
|
-
const
|
|
228
|
-
const normalized = Object.fromEntries(Object.entries(
|
|
309
|
+
const record2 = value;
|
|
310
|
+
const normalized = Object.fromEntries(Object.entries(record2).map(([key, item]) => [key, normalizeJsonSchema(item)]));
|
|
229
311
|
if (normalized.additionalProperties === true) normalized.additionalProperties = {};
|
|
230
312
|
if (normalized.type === "object" && !Object.hasOwn(normalized, "properties")) normalized.properties = {};
|
|
231
313
|
if (normalized.type === "object" && !Object.hasOwn(normalized, "additionalProperties")) normalized.additionalProperties = {};
|
|
@@ -252,6 +334,7 @@ var lifecycleGuidance = {
|
|
|
252
334
|
list_packs: "Use to find scoped Pack drafts and releases; use get_pack for one Pack\u2019s full detail.",
|
|
253
335
|
list_evaluations: "Use to inspect evaluation records and statuses; use start_evaluation to run one and get_evaluation for full provenance.",
|
|
254
336
|
get_evaluation: "Use to read one evaluation\u2019s status, provenance, score, and receipts; it never starts or approves an evaluation.",
|
|
337
|
+
retire_program_pointer: "RETIRE ACTIVE POINTER: first inspect the current pointer and version, then retire only the exact pointer version reviewed by the human. This removes the active pointer but preserves retirement history; it cannot be undone through this operation. Requires release.approve and explicit confirm=true.",
|
|
255
338
|
mark_inbox_read: "Use after list_inbox returns a notificationId that the current actor has reviewed. On success the notification is marked read; repeated calls for the same notification are safe and do not create a new notification.",
|
|
256
339
|
serve_behavior_projection: "RUNTIME PROJECTION: use after get_scope/list_capabilities, Pack install, evaluation, approval, release, and a verified promotion pointer confirm that the requested Behavior Program is active. The response contains the projected behavior and an execution receipt. Do not use this tool for authoring, classification, candidate evaluation, model calls, or host actions; it does not call the model or execute tools. Use compile_behavior_capsule for pre-model context, resolve_runtime/executeRuntime for enforcement, and evaluate_behavior_revision_candidate for unreleased candidate testing."
|
|
257
340
|
};
|
|
@@ -259,9 +342,9 @@ var enrichTool = (tool) => {
|
|
|
259
342
|
const required2 = requiredInputs(tool);
|
|
260
343
|
const guidance = lifecycleGuidance[tool.name] ?? (tool.effectful ? "Use only after the preceding resource and authority prerequisites are satisfied; inspect the server receipt before continuing." : "Use to read the scoped resource; use its create, execute, or transition sibling for state changes.");
|
|
261
344
|
const contract = required2.length ? `Required fields: ${required2.join(", ")}.` : "No fields are required unless supplied by the schema.";
|
|
262
|
-
const scope2 = "The authenticated MCP session supplies the tenant scope;
|
|
345
|
+
const scope2 = "The authenticated MCP session supplies the tenant scope; all supplied scope identifiers must match it. Unknown fields are rejected.";
|
|
263
346
|
const state = tool.effectful ? "This changes governed state and remains fail-closed behind server authorization and an auditable receipt." : "This is read-only and returns scope-bound data.";
|
|
264
|
-
return { ...tool, description: `${(tool.description ?? "Vira MCP operation").trim()} ${guidance} ${contract} ${scope2} ${state}`, annotations: { title: tool.name, readOnlyHint: !tool.effectful, destructiveHint: tool.effectful === true && /delete|revoke|cancel/.test(tool.name), idempotentHint: /^(get|list|resolve|diagnose|inspect|preview|simulate|search|test)_/.test(tool.name), openWorldHint: false }, inputSchema: describeInput(tool.name, tool.inputSchema) };
|
|
347
|
+
return { ...tool, description: `${(tool.description ?? "Vira MCP operation").trim()} ${guidance} ${contract} ${scope2} ${state}`, annotations: { title: tool.name, readOnlyHint: !tool.effectful, destructiveHint: tool.effectful === true && /delete|revoke|cancel|retire/.test(tool.name), idempotentHint: /^(get|list|resolve|diagnose|inspect|preview|simulate|search|test)_/.test(tool.name), openWorldHint: false }, inputSchema: describeInput(tool.name, tool.inputSchema) };
|
|
265
348
|
};
|
|
266
349
|
var descriptionOverrides = {
|
|
267
350
|
create_behavior_point: "AUTHORING: attach a canonical BehaviorPoint to an existing Semantic Task. Supply either taskId or taskIds; constraints define the policy boundary. Use create_behavior_program for executable rules and do not use this tool to publish a Pack.",
|
|
@@ -297,7 +380,7 @@ var MCP_PUBLIC_TOOL_CATALOG = Object.freeze([...coreTools.filter((tool) => MCP_P
|
|
|
297
380
|
var catalogNames = MCP_PUBLIC_TOOL_CATALOG.map((tool) => tool.name);
|
|
298
381
|
if (new Set(catalogNames).size !== catalogNames.length || catalogNames.some((name) => !getMcpToolAuthority(name))) throw new Error("MCP_PUBLIC_TOOL_CATALOG_INVALID");
|
|
299
382
|
function assertMcpToolScope(input2, scope2, errorCode = "MCP_SCOPE_MISMATCH") {
|
|
300
|
-
const fields = ["organizationId", "projectId", "environmentId"];
|
|
383
|
+
const fields = ["organizationId", "projectId", "environmentId", "organizationUnitId"];
|
|
301
384
|
const assertRecord = (value) => {
|
|
302
385
|
if (!value || typeof value !== "object" || Array.isArray(value)) return;
|
|
303
386
|
for (const key of fields) {
|
|
@@ -317,6 +400,386 @@ function unwrapMcpClientResponse(value) {
|
|
|
317
400
|
return value;
|
|
318
401
|
}
|
|
319
402
|
|
|
403
|
+
// src/taskrun-host-dispatch.ts
|
|
404
|
+
var id = (v) => typeof v === "string" && v.length > 0 && v.length <= 500 && v === v.trim();
|
|
405
|
+
var obj = (v) => !!v && typeof v === "object" && !Array.isArray(v);
|
|
406
|
+
function buildMcpTaskRunHostDispatch(args, scope2) {
|
|
407
|
+
if (![scope2.organizationId, scope2.projectId, scope2.environmentId, scope2.organizationUnitId, args.taskRunId, args.childRunId, args.aiSystemId, args.sessionId, args.approvalId].every(id)) throw Error("MCP_SINGLE_HOST_DISPATCH_REQUIRED");
|
|
408
|
+
if (args.organizationUnitId !== void 0 && args.organizationUnitId !== scope2.organizationUnitId) throw Error("MCP_SCOPE_MISMATCH");
|
|
409
|
+
const context = args.context, proposal = args.proposal;
|
|
410
|
+
if (!obj(context) || !obj(proposal) || !id(context.execution_id) || !context.execution_id.startsWith("runtime:taskrun:") || !id(context.data_version) || !id(proposal.proposal_id)) throw Error("MCP_SINGLE_HOST_CONTEXT_INVALID");
|
|
411
|
+
return { executionId: context.execution_id, dataVersion: context.data_version, sessionId: args.sessionId, aiSystemId: args.aiSystemId, scope: { ...scope2 }, context, proposal, approval: { approvalId: args.approvalId }, taskRunDispatch: { taskRunId: args.taskRunId, childRunId: args.childRunId } };
|
|
412
|
+
}
|
|
413
|
+
function assertMcpTaskRunHostQueued(value) {
|
|
414
|
+
if (!obj(value) || value.status !== "QUEUED" || value.clientExecutionAllowed !== false || !id(value.invocationId) || !/^single-host:[a-f0-9]{64}$/.test(value.invocationId) || Object.hasOwn(value, "allowed")) throw Error("MCP_SINGLE_HOST_QUEUE_PROOF_REQUIRED");
|
|
415
|
+
return { status: "QUEUED", invocationId: value.invocationId, clientExecutionAllowed: false };
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
// ../../contracts/observation-event-identity.ts
|
|
419
|
+
function requiredIdentityPart(value, code) {
|
|
420
|
+
if (typeof value !== "string" || !value.trim() || value !== value.trim()) throw new Error(code);
|
|
421
|
+
return value;
|
|
422
|
+
}
|
|
423
|
+
function createConversationOutputObservationIdentity(input2) {
|
|
424
|
+
const conversationId = requiredIdentityPart(input2.conversationId, "CONVERSATION_ID_REQUIRED");
|
|
425
|
+
const requestId = requiredIdentityPart(input2.requestId, "CONVERSATION_REQUEST_ID_REQUIRED");
|
|
426
|
+
const eventId = `${conversationId}:assistant:${requestId}`;
|
|
427
|
+
return Object.freeze({ conversationId, requestId, eventId, idempotencyKey: `conversation.output:${eventId}` });
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
// ../../contracts/external-host-commercial-v1.ts
|
|
431
|
+
var externalHostCommercialEvidence = Object.freeze({
|
|
432
|
+
schemaVersion: 1,
|
|
433
|
+
chargeClass: "byok",
|
|
434
|
+
authority: "HOST_REPORTED_UNVERIFIED",
|
|
435
|
+
settlementStatus: "NOT_CHARGEABLE",
|
|
436
|
+
managedCreditEligible: false
|
|
437
|
+
});
|
|
438
|
+
var meteringEvents = /* @__PURE__ */ new Set([
|
|
439
|
+
"model.request",
|
|
440
|
+
"model.response",
|
|
441
|
+
"cost",
|
|
442
|
+
"latency"
|
|
443
|
+
]);
|
|
444
|
+
var forbiddenClaims = /* @__PURE__ */ new Set([
|
|
445
|
+
"billingAccountId",
|
|
446
|
+
"customerMicrocredits",
|
|
447
|
+
"managedMicrocredits",
|
|
448
|
+
"chargeClass",
|
|
449
|
+
"managedCreditEligible",
|
|
450
|
+
"settlementStatus",
|
|
451
|
+
"reconciliationStatus",
|
|
452
|
+
"receiptSetAttested",
|
|
453
|
+
"reservationId",
|
|
454
|
+
"usageReceiptId",
|
|
455
|
+
"creditStatus",
|
|
456
|
+
"ratedMicrocredits",
|
|
457
|
+
"settledCustomerMicrocredits",
|
|
458
|
+
"providerCostMinor",
|
|
459
|
+
"creditReservationId",
|
|
460
|
+
"creditSettlementId",
|
|
461
|
+
"creditLedgerEntryId",
|
|
462
|
+
"credit",
|
|
463
|
+
"settlement",
|
|
464
|
+
"rateCard",
|
|
465
|
+
"rateCardId",
|
|
466
|
+
"rating",
|
|
467
|
+
"ratedReceipt",
|
|
468
|
+
"ratedReceiptId",
|
|
469
|
+
"providerBillingProof",
|
|
470
|
+
"independentProviderProof",
|
|
471
|
+
"providerEvidence"
|
|
472
|
+
]);
|
|
473
|
+
var record = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
|
|
474
|
+
function normalizeExternalHostCommercialPayload(eventType, value) {
|
|
475
|
+
if (!meteringEvents.has(eventType)) return value;
|
|
476
|
+
if (!record(value)) throw new Error("EXTERNAL_HOST_METERING_PAYLOAD_INVALID");
|
|
477
|
+
for (const key of forbiddenClaims) {
|
|
478
|
+
if (Object.prototype.hasOwnProperty.call(value, key))
|
|
479
|
+
throw new Error("EXTERNAL_HOST_MANAGED_CREDIT_CLAIM_FORBIDDEN");
|
|
480
|
+
}
|
|
481
|
+
const supplied = value.commercial;
|
|
482
|
+
if (supplied !== void 0 && (!record(supplied) || Object.keys(supplied).length !== Object.keys(externalHostCommercialEvidence).length || Object.entries(externalHostCommercialEvidence).some(([key, expected]) => supplied[key] !== expected)))
|
|
483
|
+
throw new Error("EXTERNAL_HOST_MANAGED_CREDIT_CLAIM_FORBIDDEN");
|
|
484
|
+
const model = value.model;
|
|
485
|
+
if (record(model) && [...forbiddenClaims].some((key) => Object.prototype.hasOwnProperty.call(model, key)))
|
|
486
|
+
throw new Error("EXTERNAL_HOST_MANAGED_CREDIT_CLAIM_FORBIDDEN");
|
|
487
|
+
return { ...value, commercial: externalHostCommercialEvidence };
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
// src/observation.ts
|
|
491
|
+
function normalizeMcpObservationEvent(value) {
|
|
492
|
+
if (value.eventType !== "conversation.output") {
|
|
493
|
+
const eventId = typeof value.eventId === "string" ? value.eventId.trim() : "";
|
|
494
|
+
if (!eventId) throw new Error("MCP_OBSERVATION_EVENT_ID_REQUIRED");
|
|
495
|
+
const classified = normalizeExternalHostCommercialPayload(String(value.eventType), value.payload ?? {});
|
|
496
|
+
return { event: classified === value.payload ? value : { ...value, payload: classified }, idempotencyKey: eventId };
|
|
497
|
+
}
|
|
498
|
+
if (value.conversationId === void 0 && value.requestId === void 0) {
|
|
499
|
+
const eventId = typeof value.eventId === "string" ? value.eventId.trim() : "";
|
|
500
|
+
if (!eventId) throw new Error("MCP_OBSERVATION_EVENT_ID_REQUIRED");
|
|
501
|
+
const classified = normalizeExternalHostCommercialPayload(String(value.eventType), value.payload ?? {});
|
|
502
|
+
return { event: classified === value.payload ? value : { ...value, payload: classified }, idempotencyKey: eventId };
|
|
503
|
+
}
|
|
504
|
+
const identity = createConversationOutputObservationIdentity({ conversationId: value.conversationId, requestId: value.requestId });
|
|
505
|
+
if (value.eventId !== void 0 && value.eventId !== identity.eventId) throw new Error("MCP_CONVERSATION_OUTPUT_EVENT_ID_MISMATCH");
|
|
506
|
+
return { event: { ...value, eventId: identity.eventId }, idempotencyKey: identity.idempotencyKey };
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
// src/authority-request.ts
|
|
510
|
+
import { randomUUID } from "node:crypto";
|
|
511
|
+
function newMcpAuthorizationKey(tool) {
|
|
512
|
+
if (typeof tool !== "string" || !/^[a-z][a-z0-9_]{0,127}$/.test(tool)) throw new Error("MCP_AUTHORITY_TOOL_INVALID");
|
|
513
|
+
return "mcp:authorize:" + tool + ":" + randomUUID();
|
|
514
|
+
}
|
|
515
|
+
function newMcpMutationKey(tool) {
|
|
516
|
+
if (typeof tool !== "string" || !/^[a-z][a-z0-9_]{0,127}$/.test(tool)) throw new Error("MCP_MUTATION_TOOL_INVALID");
|
|
517
|
+
return "mcp:execute:" + tool + ":" + randomUUID();
|
|
518
|
+
}
|
|
519
|
+
function sanitizeMcpAuthorityArguments(tool, args) {
|
|
520
|
+
if (!args || typeof args !== "object" || Array.isArray(args)) throw new Error("MCP_AUTHORITY_ARGUMENTS_INVALID");
|
|
521
|
+
if (tool === "create_notification_destination" && typeof args.endpoint === "string") return { ...args, endpoint: "[REDACTED]" };
|
|
522
|
+
if (tool === "queue_task_run_host_dispatch") return Object.fromEntries(Object.entries(args).filter(([key]) => !["approvalId", "context", "proposal", "sessionId"].includes(key)));
|
|
523
|
+
return { ...args };
|
|
524
|
+
}
|
|
525
|
+
function assertMcpAuthorityDecisionReceipt(value) {
|
|
526
|
+
if (value?.allowed !== true) throw new Error(
|
|
527
|
+
typeof value?.reason === "string" && value.reason.trim() ? value.reason : "MCP_AUTHORITY_DENIED"
|
|
528
|
+
);
|
|
529
|
+
if (typeof value.decisionDigest !== "string" || !/^[a-f0-9]{64}$/.test(value.decisionDigest))
|
|
530
|
+
throw new Error("MCP_AUTHORITY_DECISION_DIGEST_MISSING");
|
|
531
|
+
return value.decisionDigest;
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
// src/control-operation-boundary.ts
|
|
535
|
+
var REGISTERED_MCP_CONTROL_OPERATIONS = Object.freeze([
|
|
536
|
+
"DELETE /v1/ai-systems/{systemId}/unit-grants/{unitId}",
|
|
537
|
+
"DELETE /v1/behavior-points/{pointId}",
|
|
538
|
+
"DELETE /v1/behavior-programs/{programId}/cascade",
|
|
539
|
+
"DELETE /v1/semantic-tasks/{taskId}",
|
|
540
|
+
"GET /v1/ai-systems",
|
|
541
|
+
"GET /v1/ai-systems/{systemId}",
|
|
542
|
+
"GET /v1/ai-systems/{systemId}/clone-cutover/route",
|
|
543
|
+
"GET /v1/ai-systems/{systemId}/clone-cutover/route/live",
|
|
544
|
+
"GET /v1/ai-systems/{systemId}/connections",
|
|
545
|
+
"GET /v1/ai-systems/{systemId}/inventory",
|
|
546
|
+
"GET /v1/ai-systems/{systemId}/ownership-transfer/readiness",
|
|
547
|
+
"GET /v1/ai-systems/{systemId}/unit-grants",
|
|
548
|
+
"GET /v1/behavior-improvement-proposals/{proposalId}",
|
|
549
|
+
"GET /v1/behavior-points",
|
|
550
|
+
"GET /v1/behavior-policy-bindings/current",
|
|
551
|
+
"GET /v1/behavior-policy-sources",
|
|
552
|
+
"GET /v1/behavior-policy-sources/{sourceRevisionId}",
|
|
553
|
+
"GET /v1/behavior-programs",
|
|
554
|
+
"GET /v1/behavior-programs/{programId}",
|
|
555
|
+
"GET /v1/behavior-strategies",
|
|
556
|
+
"GET /v1/behavior-strategies/{strategyId}",
|
|
557
|
+
"GET /v1/billing/ai-usage",
|
|
558
|
+
"GET /v1/billing/ai-usage/summary",
|
|
559
|
+
"GET /v1/billing/credits",
|
|
560
|
+
"GET /v1/billing/credits/budgets",
|
|
561
|
+
"GET /v1/capabilities",
|
|
562
|
+
"GET /v1/compound-tasks/plans",
|
|
563
|
+
"GET /v1/compound-tasks/plans/{planId}",
|
|
564
|
+
"GET /v1/conflicts/{inspectionId}",
|
|
565
|
+
"GET /v1/connections/{connectionId}",
|
|
566
|
+
"GET /v1/connections/{connectionId}/health",
|
|
567
|
+
"GET /v1/discovery/candidates",
|
|
568
|
+
"GET /v1/evaluations",
|
|
569
|
+
"GET /v1/evaluations/{evaluationId}",
|
|
570
|
+
"GET /v1/jobs/{jobId}",
|
|
571
|
+
"GET /v1/notification-destinations",
|
|
572
|
+
"GET /v1/notifications/inbox",
|
|
573
|
+
"GET /v1/observations/backfills/{backfillId}/history",
|
|
574
|
+
"GET /v1/observations/backfills/{backfillId}/readiness",
|
|
575
|
+
"GET /v1/observations/trajectories/{trajectoryKey}/runtime-evidence",
|
|
576
|
+
"GET /v1/optimization/runs/{runId}",
|
|
577
|
+
"GET /v1/organization-units",
|
|
578
|
+
"GET /v1/organization-units/{unitId}/members",
|
|
579
|
+
"GET /v1/organization/billing-admins",
|
|
580
|
+
"GET /v1/packs",
|
|
581
|
+
"GET /v1/packs/{packId}",
|
|
582
|
+
"GET /v1/projects/{projectId}/organization-units",
|
|
583
|
+
"GET /v1/runtime/strategy-executions",
|
|
584
|
+
"GET /v1/runtime/strategy-executions/{executionId}",
|
|
585
|
+
"GET /v1/runtime/strategy-executions/{executionId}/credit-reconciliation",
|
|
586
|
+
"GET /v1/runtime/strategy-executions/{executionId}/trace",
|
|
587
|
+
"GET /v1/runtime/traces/search",
|
|
588
|
+
"GET /v1/semantic-tasks",
|
|
589
|
+
"GET /v1/signals/mappings/{id}",
|
|
590
|
+
"GET /v1/task-runs/{taskRunId}",
|
|
591
|
+
"GET /v1/task-runs/{taskRunId}/events",
|
|
592
|
+
"GET /v1/task-runs/{taskRunId}/evidence",
|
|
593
|
+
"GET /v1/teach/analyses",
|
|
594
|
+
"GET /v1/teach/analyses/{analysisId}",
|
|
595
|
+
"GET /v1/teach/conversations",
|
|
596
|
+
"GET /v1/teach/runs",
|
|
597
|
+
"GET /v1/teach/runs/{teachRunId}/behavior-set",
|
|
598
|
+
"GET /v1/teach/runs/{teachRunId}/recommendation",
|
|
599
|
+
"POST /v1/ai-systems",
|
|
600
|
+
"POST /v1/ai-systems/{systemId}/clone-cutover/accept",
|
|
601
|
+
"POST /v1/ai-systems/{systemId}/clone-cutover/prepare",
|
|
602
|
+
"POST /v1/ai-systems/{systemId}/clone-cutover/readiness",
|
|
603
|
+
"POST /v1/ai-systems/{systemId}/clone-cutover/route/accept",
|
|
604
|
+
"POST /v1/ai-systems/{systemId}/clone-cutover/route/admission",
|
|
605
|
+
"POST /v1/ai-systems/{systemId}/clone-cutover/route/behavior",
|
|
606
|
+
"POST /v1/ai-systems/{systemId}/clone-cutover/route/drain",
|
|
607
|
+
"POST /v1/ai-systems/{systemId}/clone-cutover/route/drain/cases",
|
|
608
|
+
"POST /v1/ai-systems/{systemId}/clone-cutover/route/live/accept",
|
|
609
|
+
"POST /v1/ai-systems/{systemId}/clone-cutover/route/live/activate",
|
|
610
|
+
"POST /v1/ai-systems/{systemId}/clone-cutover/route/live/rollback",
|
|
611
|
+
"POST /v1/ai-systems/{systemId}/clone-cutover/route/live/rollback/accept",
|
|
612
|
+
"POST /v1/ai-systems/{systemId}/clone-cutover/route/probe",
|
|
613
|
+
"POST /v1/ai-systems/{systemId}/clone-cutover/route/reconcile/host",
|
|
614
|
+
"POST /v1/ai-systems/{systemId}/clone-cutover/route/reconcile/probe-release",
|
|
615
|
+
"POST /v1/ai-systems/{systemId}/clone-cutover/route/stage",
|
|
616
|
+
"POST /v1/ai-systems/{systemId}/clone-cutover/route/withdraw",
|
|
617
|
+
"POST /v1/ai-systems/{systemId}/connections",
|
|
618
|
+
"POST /v1/ai-systems/{systemId}/ownership-transfer/accept",
|
|
619
|
+
"POST /v1/ai-systems/{systemId}/ownership-transfer/commit",
|
|
620
|
+
"POST /v1/ai-systems/{systemId}/unit-grants",
|
|
621
|
+
"POST /v1/behavior-improvement-proposals/{proposalId}",
|
|
622
|
+
"POST /v1/behavior-points",
|
|
623
|
+
"POST /v1/behavior-policy-bindings/commit",
|
|
624
|
+
"POST /v1/behavior-policy-bindings/commit-wide",
|
|
625
|
+
"POST /v1/behavior-policy-bindings/impact",
|
|
626
|
+
"POST /v1/behavior-policy-bindings/preview",
|
|
627
|
+
"POST /v1/behavior-policy-sources",
|
|
628
|
+
"POST /v1/behavior-programs",
|
|
629
|
+
"POST /v1/behavior-revision-candidates",
|
|
630
|
+
"POST /v1/behavior-strategies",
|
|
631
|
+
"POST /v1/behavior-strategies/{strategyId}/simulate",
|
|
632
|
+
"POST /v1/behavior-strategies/{strategyId}/validate",
|
|
633
|
+
"POST /v1/behavior-strategies/{strategyId}/variants",
|
|
634
|
+
"POST /v1/billing/credits/reservations",
|
|
635
|
+
"POST /v1/billing/credits/reservations/{reservationId}/release",
|
|
636
|
+
"POST /v1/compound-tasks/plans",
|
|
637
|
+
"POST /v1/conflicts/inspect",
|
|
638
|
+
"POST /v1/conflicts/{inspectionId}/resolve",
|
|
639
|
+
"POST /v1/connections/{connectionId}/test",
|
|
640
|
+
"POST /v1/discovery/candidates/{kind}/{key}/publish",
|
|
641
|
+
"POST /v1/discovery/candidates/{kind}/{key}/review",
|
|
642
|
+
"POST /v1/evaluation-plans",
|
|
643
|
+
"POST /v1/evaluations",
|
|
644
|
+
"POST /v1/evaluations/{evaluationId}/improvement-proposal",
|
|
645
|
+
"POST /v1/model-serving/resolve",
|
|
646
|
+
"POST /v1/model-serving/traces",
|
|
647
|
+
"POST /v1/notification-destinations",
|
|
648
|
+
"POST /v1/notification-destinations/{destinationId}/revoke",
|
|
649
|
+
"POST /v1/notifications/{notificationId}/read",
|
|
650
|
+
"POST /v1/observations",
|
|
651
|
+
"POST /v1/observations/batch",
|
|
652
|
+
"POST /v1/observations/sdk",
|
|
653
|
+
"POST /v1/optimization/execute",
|
|
654
|
+
"POST /v1/optimization/runs/{runId}/cancel",
|
|
655
|
+
"POST /v1/organization-units",
|
|
656
|
+
"POST /v1/organization-units/{unitId}/archive",
|
|
657
|
+
"POST /v1/organization-units/{unitId}/archive-preview",
|
|
658
|
+
"POST /v1/organization-units/{unitId}/members/{actorId}",
|
|
659
|
+
"POST /v1/organization/billing-admins/{actorId}",
|
|
660
|
+
"POST /v1/pack-revisions",
|
|
661
|
+
"POST /v1/packs/import",
|
|
662
|
+
"POST /v1/packs/{packId}/evaluate",
|
|
663
|
+
"POST /v1/packs/{packId}/install",
|
|
664
|
+
"POST /v1/packs/{packId}/release",
|
|
665
|
+
"POST /v1/projects/{projectId}/organization-units/{unitId}",
|
|
666
|
+
"POST /v1/promotions/program-pointers/{pointerKey}/retire",
|
|
667
|
+
"POST /v1/quality/evaluate",
|
|
668
|
+
"POST /v1/releases",
|
|
669
|
+
"POST /v1/releases/manual-program",
|
|
670
|
+
"POST /v1/runtime/actions/approvals",
|
|
671
|
+
"POST /v1/runtime/actions/authorize",
|
|
672
|
+
"POST /v1/runtime/behavior-capsule",
|
|
673
|
+
"POST /v1/runtime/behavior-projection",
|
|
674
|
+
"POST /v1/runtime/capabilities/attest",
|
|
675
|
+
"POST /v1/runtime/capabilities/resolve",
|
|
676
|
+
"POST /v1/runtime/execute",
|
|
677
|
+
"POST /v1/runtime/resolve",
|
|
678
|
+
"POST /v1/runtime/strategy-executions",
|
|
679
|
+
"POST /v1/runtime/strategy-executions/{executionId}/cancel",
|
|
680
|
+
"POST /v1/runtime/strategy-executions/{executionId}/continue",
|
|
681
|
+
"POST /v1/semantic-tasks",
|
|
682
|
+
"POST /v1/semantic/resolve",
|
|
683
|
+
"POST /v1/signals/discovery-proposals",
|
|
684
|
+
"POST /v1/signals/discovery-proposals/{id}/materialize",
|
|
685
|
+
"POST /v1/signals/discovery-proposals/{id}/review",
|
|
686
|
+
"POST /v1/signals/mappings",
|
|
687
|
+
"POST /v1/signals/mappings/{id}/review",
|
|
688
|
+
"POST /v1/task-runs",
|
|
689
|
+
"POST /v1/task-runs/resolve",
|
|
690
|
+
"POST /v1/task-runs/{taskRunId}/cancel",
|
|
691
|
+
"POST /v1/task-runs/{taskRunId}/continue",
|
|
692
|
+
"POST /v1/teach/analyses",
|
|
693
|
+
"POST /v1/teach/conversations",
|
|
694
|
+
"POST /v1/teach/conversations/import",
|
|
695
|
+
"POST /v1/teach/conversations/{evidenceId}/revoke",
|
|
696
|
+
"POST /v1/teach/cross-conversation-analyses",
|
|
697
|
+
"POST /v1/teach/evidence",
|
|
698
|
+
"POST /v1/teach/proposals",
|
|
699
|
+
"POST /v1/teach/proposals/{proposalId}/request-changes",
|
|
700
|
+
"POST /v1/teach/runs/{teachRunId}/recommendation/accept"
|
|
701
|
+
]);
|
|
702
|
+
var deniedRegardlessOfContract = (path, method) => path === "/v1/notification-destinations" || path.startsWith("/v1/notification-destinations/") || method !== "GET" && /^\/v1\/observations\/(?:supersessions|backfills)(?:\/|$)/.test(path) || // These mutations require exact human/owner workflows, not a generic
|
|
703
|
+
// model-authored request with a coarse write_control_api permission.
|
|
704
|
+
method !== "GET" && // High-impact changes require dedicated tools, explicit human approval,
|
|
705
|
+
// and version/receipt fences rather than a generic MCP write envelope.
|
|
706
|
+
(method === "DELETE" || /^\/v1\/(?:releases|promotions|deployments)(?:\/|$)/.test(path) || /^\/v1\/ai-systems\/[^/]+\/clone-cutover(?:\/|$)/.test(path) || /^\/v1\/(?:packs|pack-revisions|behavior-revision-candidates)\/[^/]+\/(?:release|approve|promote|accept|materialize|install)(?:\/|$)/.test(path) || /^\/v1\/teach\/proposals\/[^/]+\/(?:promote|approve)(?:\/|$)/.test(path) || /^\/v1\/runtime\/actions(?:\/|$)/.test(path) || /^\/v1\/(?:organization-units|organization\/billing-admins|projects\/[^/]+\/organization-units)(?:\/|$)/.test(path) || /^\/v1\/ai-systems\/[^/]+\/unit-grants(?:\/|$)/.test(path) || /^\/v1\/billing(?:\/|$)/.test(path) || /^\/v1\/runtime\/actions\/approvals(?:\/|$)/.test(path) || /^\/v1\/promotions\/program-pointers\/[^/]+\/retire$/.test(path));
|
|
707
|
+
var canonicalSegment = (value) => {
|
|
708
|
+
if (typeof value !== "string" || !value.trim() || value !== value.trim() || value.length > 512 || value === "." || value === ".." || /[/?#\\%\u0000]/.test(value))
|
|
709
|
+
throw new Error("MCP_CONTROL_PATH_PARAMETER_INVALID");
|
|
710
|
+
return encodeURIComponent(value);
|
|
711
|
+
};
|
|
712
|
+
function resolveStdioMcpControlOperation(method, path, pathParams = {}) {
|
|
713
|
+
if (typeof path !== "string" || !path.startsWith("/v1/") || /[?#\\]/.test(path))
|
|
714
|
+
throw new Error("MCP_CONTROL_PATH_INVALID");
|
|
715
|
+
const supplied = path.split("/");
|
|
716
|
+
if (supplied.some((segment, i) => {
|
|
717
|
+
if (i === 0) return false;
|
|
718
|
+
if (!segment || segment === "." || segment === "..") return true;
|
|
719
|
+
try {
|
|
720
|
+
const decoded = decodeURIComponent(segment);
|
|
721
|
+
return decoded === "." || decoded === ".." || /[/?#\\%\u0000]/.test(decoded);
|
|
722
|
+
} catch {
|
|
723
|
+
return true;
|
|
724
|
+
}
|
|
725
|
+
})) throw new Error("MCP_CONTROL_PATH_INVALID");
|
|
726
|
+
if (!pathParams || typeof pathParams !== "object" || Array.isArray(pathParams))
|
|
727
|
+
throw new Error("MCP_CONTROL_PATH_PARAMETER_INVALID");
|
|
728
|
+
const explicit = pathParams;
|
|
729
|
+
const entries = REGISTERED_MCP_CONTROL_OPERATIONS.filter((entry) => entry.startsWith(method + " ")).map((entry) => entry.slice(method.length + 1));
|
|
730
|
+
const route = entries.includes(path) ? path : entries.find((template2) => {
|
|
731
|
+
const segments = template2.split("/");
|
|
732
|
+
return segments.length === supplied.length && segments.every((part, i) => /^\{[a-zA-Z][a-zA-Z0-9]*\}$/.test(part) || part === supplied[i]);
|
|
733
|
+
});
|
|
734
|
+
if (!route || deniedRegardlessOfContract(route, method))
|
|
735
|
+
throw new Error("MCP_CONTROL_OPERATION_NOT_FOUND");
|
|
736
|
+
const template = route.split("/");
|
|
737
|
+
const names = template.flatMap((part) => /^\{[a-zA-Z][a-zA-Z0-9]*\}$/.test(part) ? [part.slice(1, -1)] : []);
|
|
738
|
+
if (Object.keys(explicit).some((key) => !names.includes(key)))
|
|
739
|
+
throw new Error("MCP_CONTROL_PATH_PARAMETER_INVALID");
|
|
740
|
+
const concrete = template.map((part, i) => {
|
|
741
|
+
if (!/^\{[a-zA-Z][a-zA-Z0-9]*\}$/.test(part)) return part;
|
|
742
|
+
const name = part.slice(1, -1);
|
|
743
|
+
const source = supplied[i] === part ? void 0 : decodeURIComponent(supplied[i]);
|
|
744
|
+
const provided = explicit[name];
|
|
745
|
+
if (provided !== void 0 && source !== void 0 && provided !== source)
|
|
746
|
+
throw new Error("MCP_CONTROL_PATH_PARAMETER_MISMATCH");
|
|
747
|
+
return canonicalSegment(provided ?? source);
|
|
748
|
+
}).join("/");
|
|
749
|
+
return concrete;
|
|
750
|
+
}
|
|
751
|
+
function validateStdioMcpScope(scope2, value) {
|
|
752
|
+
for (const key of ["organizationId", "projectId", "environmentId"])
|
|
753
|
+
if (value[key] !== void 0 && value[key] !== scope2[key])
|
|
754
|
+
throw new Error("MCP_SCOPE_MISMATCH");
|
|
755
|
+
if (scope2.organizationUnitId !== void 0 && value.organizationUnitId !== void 0 && value.organizationUnitId !== scope2.organizationUnitId)
|
|
756
|
+
throw new Error("MCP_SCOPE_MISMATCH");
|
|
757
|
+
}
|
|
758
|
+
function bindStdioMcpScope(scope2, value) {
|
|
759
|
+
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
760
|
+
throw new Error("MCP_CONTROL_BODY_INVALID");
|
|
761
|
+
const body = value;
|
|
762
|
+
validateStdioMcpScope(scope2, body);
|
|
763
|
+
if (Object.hasOwn(body, "scope")) {
|
|
764
|
+
if (!body.scope || typeof body.scope !== "object" || Array.isArray(body.scope))
|
|
765
|
+
throw new Error("MCP_SCOPE_MISMATCH");
|
|
766
|
+
validateStdioMcpScope(scope2, body.scope);
|
|
767
|
+
}
|
|
768
|
+
return { ...body, ...scope2 };
|
|
769
|
+
}
|
|
770
|
+
function bindStdioMcpQuery(scope2, value) {
|
|
771
|
+
if (value !== void 0 && (!value || typeof value !== "object" || Array.isArray(value)))
|
|
772
|
+
throw new Error("MCP_CONTROL_QUERY_INVALID");
|
|
773
|
+
const query = value ?? {};
|
|
774
|
+
if (Object.hasOwn(query, "scope")) throw new Error("MCP_SCOPE_MISMATCH");
|
|
775
|
+
validateStdioMcpScope(scope2, query);
|
|
776
|
+
const result = new URLSearchParams();
|
|
777
|
+
for (const [key, item] of Object.entries(query))
|
|
778
|
+
if (item !== void 0) result.set(key, typeof item === "string" ? item : JSON.stringify(item));
|
|
779
|
+
for (const [key, item] of Object.entries(scope2)) result.set(key, item);
|
|
780
|
+
return result;
|
|
781
|
+
}
|
|
782
|
+
|
|
320
783
|
// src/cli.ts
|
|
321
784
|
var required = (key) => {
|
|
322
785
|
const value = process.env[key]?.trim();
|
|
@@ -327,15 +790,17 @@ var baseUrl = (process.env.VIRA_API_URL ?? "").replace(/\/$/, "");
|
|
|
327
790
|
if (!baseUrl) throw new Error("VIRA_API_URL_REQUIRED");
|
|
328
791
|
var allowInsecureLocalhost = process.env.VIRA_ALLOW_INSECURE_LOCALHOST === "true";
|
|
329
792
|
var apiKey = required("VIRA_API_KEY");
|
|
793
|
+
var organizationUnitId = process.env.VIRA_ORGANIZATION_UNIT_ID?.trim() || void 0;
|
|
330
794
|
var scope = {
|
|
331
795
|
organizationId: required("VIRA_ORGANIZATION_ID"),
|
|
332
796
|
projectId: required("VIRA_PROJECT_ID"),
|
|
333
|
-
environmentId: required("VIRA_ENVIRONMENT_ID")
|
|
797
|
+
environmentId: required("VIRA_ENVIRONMENT_ID"),
|
|
798
|
+
...process.env.VIRA_ORGANIZATION_UNIT_ID?.trim() ? { organizationUnitId: process.env.VIRA_ORGANIZATION_UNIT_ID.trim() } : {}
|
|
334
799
|
};
|
|
335
800
|
var mcpApiTimeoutMs = Number(process.env.VIRA_MCP_API_TIMEOUT_MS ?? 3e4);
|
|
336
801
|
if (!Number.isInteger(mcpApiTimeoutMs) || mcpApiTimeoutMs < 1e3 || mcpApiTimeoutMs > 12e4) throw new Error("VIRA_MCP_API_TIMEOUT_MS_INVALID");
|
|
337
|
-
var mcpHttpOptions = { apiKey, timeoutMs: mcpApiTimeoutMs, retries: 1 };
|
|
338
|
-
var client = new ViraClient({ baseUrl, apiKey, allowInsecureLocalhost, timeoutMs: mcpApiTimeoutMs, retries: 1 });
|
|
802
|
+
var mcpHttpOptions = { apiKey, timeoutMs: mcpApiTimeoutMs, retries: 1, defaultHeaders: organizationUnitId ? { "x-vira-organization-unit-id": organizationUnitId } : void 0 };
|
|
803
|
+
var client = new ViraClient({ baseUrl, apiKey, allowInsecureLocalhost, timeoutMs: mcpApiTimeoutMs, retries: 1, organizationUnitId });
|
|
339
804
|
var hostToolDefinitions = (() => {
|
|
340
805
|
try {
|
|
341
806
|
const parsed = JSON.parse(process.env.VIRA_HOST_TOOL_DEFINITIONS ?? "[]");
|
|
@@ -382,7 +847,12 @@ var importPackSchema = input({ manifest: packManifestSchema.optional(), objects:
|
|
|
382
847
|
if (!value.manifest && !value.archiveBase64) ctx.addIssue({ code: z.ZodIssueCode.custom, message: "MCP_PACK_MANIFEST_OR_ARCHIVE_REQUIRED", path: ["manifest"] });
|
|
383
848
|
if (value.archiveBase64 && !value.fileName) ctx.addIssue({ code: z.ZodIssueCode.custom, message: "MCP_PACK_FILE_NAME_REQUIRED", path: ["fileName"] });
|
|
384
849
|
});
|
|
385
|
-
var scopeQuery = (args) =>
|
|
850
|
+
var scopeQuery = (args, allowOrganizationUnitFilter = false) => {
|
|
851
|
+
if (!allowOrganizationUnitFilter) return assertMcpToolScope(args, scope);
|
|
852
|
+
const requestedUnit = typeof args.organizationUnitId === "string" ? args.organizationUnitId : void 0;
|
|
853
|
+
if (scope.organizationUnitId && requestedUnit && scope.organizationUnitId !== requestedUnit) throw new Error("MCP_SCOPE_MISMATCH");
|
|
854
|
+
return assertMcpToolScope({ ...args, organizationUnitId: void 0 }, scope);
|
|
855
|
+
};
|
|
386
856
|
var decodePageCursor = (cursor) => {
|
|
387
857
|
if (!cursor) return 0;
|
|
388
858
|
try {
|
|
@@ -404,54 +874,76 @@ var listFromApi = async (path, args) => {
|
|
|
404
874
|
const offset = decodePageCursor(typeof args.cursor === "string" ? args.cursor : void 0);
|
|
405
875
|
if (offset < 0) throw new Error("MCP_PAGE_CURSOR_INVALID");
|
|
406
876
|
if (!body || typeof body !== "object" || Array.isArray(body)) return body;
|
|
407
|
-
const
|
|
408
|
-
const collectionKey = Object.keys(
|
|
877
|
+
const record2 = body;
|
|
878
|
+
const collectionKey = Object.keys(record2).find((key) => Array.isArray(record2[key]));
|
|
409
879
|
if (!collectionKey) return body;
|
|
410
|
-
if (Object.prototype.hasOwnProperty.call(
|
|
411
|
-
const collection =
|
|
880
|
+
if (Object.prototype.hasOwnProperty.call(record2, "nextCursor")) return body;
|
|
881
|
+
const collection = record2[collectionKey];
|
|
412
882
|
const page = collection.slice(offset, offset + requestedLimit);
|
|
413
883
|
const nextCursor = offset + requestedLimit < collection.length ? encodePageCursor(offset + requestedLimit) : void 0;
|
|
414
|
-
return { ...
|
|
884
|
+
return { ...record2, [collectionKey]: page, nextCursor };
|
|
415
885
|
};
|
|
416
|
-
var readFromApi = async (path) => {
|
|
886
|
+
var readFromApi = async (path, query) => {
|
|
417
887
|
const url = new URL(`${baseUrl}${path}`);
|
|
418
888
|
for (const [key, value] of Object.entries(scope)) url.searchParams.set(key, value);
|
|
889
|
+
for (const [key, value] of Object.entries(query ?? {})) if (value !== void 0) url.searchParams.set(key, String(value));
|
|
890
|
+
for (const [key, value] of Object.entries(scope)) url.searchParams.set(key, value);
|
|
419
891
|
return (await viraHttpRequest(url, { ...mcpHttpOptions, method: "GET" })).body;
|
|
420
892
|
};
|
|
421
|
-
var
|
|
422
|
-
const path = String(
|
|
423
|
-
|
|
424
|
-
return path;
|
|
893
|
+
var controlRequest = (args, method) => {
|
|
894
|
+
const path = resolveStdioMcpControlOperation(method, String(args.path ?? ""), args.pathParams);
|
|
895
|
+
const query = bindStdioMcpQuery(scope, args.query);
|
|
896
|
+
return { path: path + "?" + query.toString(), method };
|
|
425
897
|
};
|
|
426
|
-
var
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
const entries = Object.entries(query).filter(([, value]) => value !== void 0);
|
|
430
|
-
return entries.length ? "?" + entries.map(([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(typeof value === "string" ? value : JSON.stringify(value))}`).join("&") : "";
|
|
898
|
+
var readControlApi = async (args) => {
|
|
899
|
+
const request = controlRequest(args, "GET");
|
|
900
|
+
return (await viraHttpRequest(baseUrl + request.path, { ...mcpHttpOptions, method: "GET" })).body;
|
|
431
901
|
};
|
|
432
|
-
var controlPath = (args) => safeControlPath(args.path).replace(/\{([A-Za-z0-9_]+)\}/g, (_match, key) => {
|
|
433
|
-
const values = args.pathParams && typeof args.pathParams === "object" ? args.pathParams : {};
|
|
434
|
-
const value = values[key];
|
|
435
|
-
if (typeof value !== "string" || !value.trim()) throw new Error("MCP_CONTROL_PATH_PARAMETER_REQUIRED");
|
|
436
|
-
return encodeURIComponent(value);
|
|
437
|
-
});
|
|
438
|
-
var readControlApi = async (args) => readFromApi(`${controlPath(args)}${controlQuery(args.query)}`);
|
|
439
902
|
var writeControlApi = async (args) => {
|
|
440
|
-
const path = controlPath(args);
|
|
441
903
|
const method = String(args.method ?? "POST");
|
|
442
904
|
if (!["POST", "PUT", "PATCH", "DELETE"].includes(method)) throw new Error("MCP_CONTROL_WRITE_METHOD_INVALID");
|
|
443
|
-
|
|
905
|
+
const request = controlRequest(args, method);
|
|
906
|
+
const body = bindStdioMcpScope(scope, args.body);
|
|
907
|
+
return (await viraHttpRequest(baseUrl + request.path, {
|
|
908
|
+
...mcpHttpOptions,
|
|
909
|
+
method,
|
|
910
|
+
body,
|
|
911
|
+
idempotencyKey: String(args.idempotencyKey ?? newMcpMutationKey("write_control_api"))
|
|
912
|
+
})).body;
|
|
444
913
|
};
|
|
445
914
|
var optimizerRequest = async (path, method, body) => {
|
|
446
|
-
const
|
|
447
|
-
const url = new URL(`${baseUrl}${
|
|
915
|
+
const controlPath = path === "/v1/optimize" ? "/v1/optimization/execute" : path;
|
|
916
|
+
const url = new URL(`${baseUrl}${controlPath}`);
|
|
448
917
|
if (method === "GET") for (const [key, value] of Object.entries(scope)) url.searchParams.set(key, value);
|
|
449
|
-
return (await viraHttpRequest(url, { ...mcpHttpOptions, method, body: body ? { ...body, scope } : void 0, idempotencyKey: method === "POST" ?
|
|
918
|
+
return (await viraHttpRequest(url, { ...mcpHttpOptions, method, body: body ? { ...body, scope } : void 0, idempotencyKey: method === "POST" ? newMcpMutationKey("optimizer_request") : void 0 })).body;
|
|
450
919
|
};
|
|
451
920
|
var fullTools = [
|
|
452
921
|
{ name: "get_scope", description: "Read the immutable organization/project/environment scope configured for this MCP session.", inputSchema: input(), run: async () => ({ scope, apiUrl: baseUrl }) },
|
|
453
|
-
{ name: "list_capabilities", description: "
|
|
922
|
+
{ name: "list_capabilities", description: "Show coarse role-based capability groups and the canonical Control API operation inventory. This is not per-operation authorization.", inputSchema: input(), run: () => readFromApi("/v1/capabilities?surface=mcp") },
|
|
923
|
+
{ name: "list_organization_units", description: "List organization units visible to this actor.", inputSchema: input(), run: () => readFromApi("/v1/organization-units") },
|
|
924
|
+
{ name: "list_ai_system_unit_grants", description: "List unit access grants for an AI System. Workspace owner permission is required.", inputSchema: input({ aiSystemId: z.string().min(1) }), run: (args) => readFromApi(`/v1/ai-systems/${encodeURIComponent(String(args.aiSystemId))}/unit-grants`) },
|
|
925
|
+
{ name: "grant_ai_system_unit_access", description: "Grant scoped capabilities on an AI System to a Project-bound unit. Requires workspace owner permission and human approval.", inputSchema: input({ aiSystemId: z.string().min(1), unitId: z.string().min(1), permissions: z.array(z.enum(["system.read", "system.use", "observation.write", "teach.write", "evaluation.write", "release.approve", "integration.manage", "secret.read", "trace.read"])).min(1) }), effectful: true, run: async (args) => (await viraHttpRequest(`${baseUrl}/v1/ai-systems/${encodeURIComponent(String(args.aiSystemId))}/unit-grants`, { ...mcpHttpOptions, method: "POST", body: { ...scope, unitId: String(args.unitId), permissions: args.permissions }, idempotencyKey: newMcpMutationKey("grant_ai_system_unit_access") })).body },
|
|
926
|
+
{ name: "revoke_ai_system_unit_access", description: "Revoke an AI System unit access grant. Requires workspace owner permission and human approval.", inputSchema: input({ aiSystemId: z.string().min(1), unitId: z.string().min(1) }), effectful: true, run: async (args) => (await viraHttpRequest(`${baseUrl}/v1/ai-systems/${encodeURIComponent(String(args.aiSystemId))}/unit-grants/${encodeURIComponent(String(args.unitId))}`, { ...mcpHttpOptions, method: "DELETE", body: { ...scope }, idempotencyKey: newMcpMutationKey("revoke_ai_system_unit_access") })).body },
|
|
927
|
+
{ name: "list_organization_billing_admins", description: "List organization Billing Admin memberships. Workspace owner permission is required.", inputSchema: input(), run: () => readFromApi("/v1/organization/billing-admins") },
|
|
928
|
+
{ name: "set_organization_billing_admin", description: "Grant or revoke an organization Billing Admin membership. Workspace owner permission is required.", inputSchema: input({ actorId: z.string().min(1), status: z.enum(["ACTIVE", "REVOKED"]) }), effectful: true, run: async (args) => (await viraHttpRequest(`${baseUrl}/v1/organization/billing-admins/${encodeURIComponent(String(args.actorId))}`, { ...mcpHttpOptions, method: "POST", body: { ...scope, status: args.status }, idempotencyKey: newMcpMutationKey("set_organization_billing_admin") })).body },
|
|
929
|
+
{ name: "get_ai_credit_wallet", description: "Read the organization AI credit balance and recent ledger entries. Organization billing admin permission is required.", inputSchema: input(), run: () => readFromApi("/v1/billing/credits") },
|
|
930
|
+
{ name: "list_ai_credit_budgets", description: "Read organization, department, project, and AI System budget caps with consumed and reserved credits. Organization billing admin permission is required.", inputSchema: input(), run: () => readFromApi("/v1/billing/credits/budgets") },
|
|
931
|
+
{ name: "reserve_ai_credits", description: "Reserve an approved upper bound before a managed AI provider call. Requires organization Billing Admin permission and explicit human approval.", inputSchema: input({ amountMicrocredits: z.number().int().positive(), periodStart: z.string(), periodEnd: z.string(), idempotencyKey: z.string().min(1), aiSystemId: z.string().optional() }), effectful: true, run: (args) => client.reserveAICredits({ organizationId: scope.organizationId, projectId: scope.projectId, environmentId: scope.environmentId, amountMicrocredits: Number(args.amountMicrocredits), periodStart: String(args.periodStart), periodEnd: String(args.periodEnd), idempotencyKey: String(args.idempotencyKey), aiSystemId: args.aiSystemId }) },
|
|
932
|
+
{ name: "release_ai_credit_reservation", description: "Release an unused AI credit reservation before any usage receipt is recorded. Requires explicit human approval.", inputSchema: input({ reservationId: z.string().min(1), idempotencyKey: z.string().min(1).optional() }), effectful: true, run: (args) => client.releaseAICreditReservation(String(args.reservationId), { idempotencyKey: typeof args.idempotencyKey === "string" ? args.idempotencyKey : void 0 }) },
|
|
933
|
+
{ name: "list_ai_usage_receipts", description: "Read rated provider usage receipts, optionally filtered to an organization unit. Organization owners and Billing Admins may read organization data; a Department Admin sees only their active unit.", inputSchema: input({ organizationUnitId: z.string().min(1).optional(), limit: z.number().int().positive().max(500).optional() }), run: (args) => readFromApi("/v1/billing/ai-usage", { organizationUnitId: args.organizationUnitId, limit: args.limit }) },
|
|
934
|
+
{ name: "get_ai_usage_summary", description: "Read monthly provider cost and customer credits by provider/model, optionally filtered to an organization unit. Organization owners and Billing Admins may read organization data; a Department Admin sees only their active unit.", inputSchema: input({ organizationUnitId: z.string().min(1).optional() }), run: (args) => readFromApi("/v1/billing/ai-usage/summary", { organizationUnitId: args.organizationUnitId }) },
|
|
935
|
+
{ name: "execute_managed_chat", description: "Run an authorized Vira-managed model completion. This is a billable operation; server-side credit admission and approval remain required.", inputSchema: input({ aiSystemId: z.string().min(1), connectionId: z.string().min(1), operationId: z.string().min(1).max(200), model: z.string().min(1), messages: z.array(z.record(z.string(), z.unknown())).min(1).max(128), max_tokens: z.number().int().positive().max(8192).optional() }), effectful: true, run: (args) => client.executeManagedChat({ aiSystemId: String(args.aiSystemId), connectionId: String(args.connectionId), operationId: String(args.operationId), model: String(args.model), messages: args.messages, max_tokens: args.max_tokens }) },
|
|
936
|
+
{ name: "create_organization_unit", description: "Create an organization unit as a workspace owner.", inputSchema: input({ id: z.string().min(1).optional(), parentUnitId: z.string().min(1).nullable().optional(), name: z.string().min(1), kind: z.enum(["business_unit", "department", "team"]) }), effectful: true, run: async (args) => (await viraHttpRequest(`${baseUrl}/v1/organization-units`, { ...mcpHttpOptions, method: "POST", body: { ...scope, ...args }, idempotencyKey: `mcp:create-unit:${String(args.id ?? args.name)}` })).body },
|
|
937
|
+
{ name: "preview_organization_unit_archive", description: "Preview the affected descendants, memberships, and project ownership before archiving an organization unit. Workspace owner required.", inputSchema: input({ unitId: z.string().min(1) }), run: async (args) => (await viraHttpRequest(`${baseUrl}/v1/organization-units/${encodeURIComponent(String(args.unitId))}/archive-preview`, { ...mcpHttpOptions, method: "POST", body: scope })).body },
|
|
938
|
+
{ name: "archive_organization_unit", description: "Archive an organization unit subtree after reviewing its impact. Workspace owner and explicit confirmation required.", inputSchema: input({ unitId: z.string().min(1), confirm: z.literal(true) }), effectful: true, run: async (args) => (await viraHttpRequest(`${baseUrl}/v1/organization-units/${encodeURIComponent(String(args.unitId))}/archive`, { ...mcpHttpOptions, method: "POST", body: { ...scope, confirm: true }, idempotencyKey: `mcp:unit-archive:${String(args.unitId)}` })).body },
|
|
939
|
+
{ name: "list_organization_unit_members", description: "List memberships for a unit managed by this actor.", inputSchema: input({ unitId: z.string().min(1) }), run: (args) => readFromApi(`/v1/organization-units/${encodeURIComponent(String(args.unitId))}/members`) },
|
|
940
|
+
{ name: "set_organization_unit_member", description: "Set a unit membership after the server checks organization membership and role authority.", inputSchema: input({ unitId: z.string().min(1), actorId: z.string().min(1), role: z.enum(["department_admin", "teacher", "reviewer", "billing_admin", "viewer"]), status: z.enum(["ACTIVE", "REVOKED"]).optional() }), effectful: true, run: async (args) => (await viraHttpRequest(`${baseUrl}/v1/organization-units/${encodeURIComponent(String(args.unitId))}/members/${encodeURIComponent(String(args.actorId))}`, { ...mcpHttpOptions, method: "POST", body: { ...scope, role: args.role, status: args.status }, idempotencyKey: newMcpMutationKey("set_organization_unit_member") })).body },
|
|
941
|
+
{ name: "list_project_organization_units", description: "List organization unit bindings for a project in this MCP scope.", inputSchema: input({ targetProjectId: z.string().min(1) }), run: (args) => readFromApi(`/v1/projects/${encodeURIComponent(String(args.targetProjectId))}/organization-units`) },
|
|
942
|
+
{ name: "bind_project_organization_unit", description: "Bind a unit to a project as a workspace owner, or let a Department Admin bind only their active unit as a non-primary owner.", inputSchema: input({ targetProjectId: z.string().min(1), unitId: z.string().min(1), primaryOwner: z.boolean().optional() }), effectful: true, run: async (args) => (await viraHttpRequest(`${baseUrl}/v1/projects/${encodeURIComponent(String(args.targetProjectId))}/organization-units/${encodeURIComponent(String(args.unitId))}`, { ...mcpHttpOptions, method: "POST", body: { ...scope, primaryOwner: args.primaryOwner }, idempotencyKey: newMcpMutationKey("bind_project_organization_unit") })).body },
|
|
454
943
|
{ name: "list_inbox", description: "List the authenticated actor\u2019s scoped review notifications.", inputSchema: input({ ...pageFields, search: z.string().min(1).optional() }), run: async (args) => readFromApi(`/v1/notifications/inbox?${new URLSearchParams(Object.entries(args).filter(([, v]) => v !== void 0).map(([k, v]) => [k, String(v)])).toString()}`) },
|
|
944
|
+
{ name: "list_notification_destinations", description: "List scoped notification destinations. Endpoint secrets are never returned.", inputSchema: input(), run: () => readFromApi("/v1/notification-destinations") },
|
|
945
|
+
{ name: "create_notification_destination", description: "Register an encrypted Slack or Microsoft Teams Workflows destination. The endpoint is a secret and is never returned; owner or integration.write permission is required.", inputSchema: input({ label: z.string().min(1), provider: z.enum(["slack", "microsoft_teams"]), endpoint: z.string().min(1), idempotencyKey: z.string().min(1).optional() }), effectful: true, run: async (args) => (await viraHttpRequest(`${baseUrl}/v1/notification-destinations`, { ...mcpHttpOptions, method: "POST", body: { ...scope, label: String(args.label), provider: args.provider, endpoint: String(args.endpoint) }, idempotencyKey: String(args.idempotencyKey ?? `mcp:notification-destination:${String(args.label)}`) })).body },
|
|
946
|
+
{ name: "revoke_notification_destination", description: "Revoke a scoped destination so queued deliveries are suppressed. Owner or integration.write permission is required.", inputSchema: input({ destinationId: z.string().min(1) }), effectful: true, run: async (args) => (await viraHttpRequest(`${baseUrl}/v1/notification-destinations/${encodeURIComponent(String(args.destinationId))}/revoke`, { ...mcpHttpOptions, method: "POST", body: scope, idempotencyKey: `mcp:notification-destination-revoke:${String(args.destinationId)}` })).body },
|
|
455
947
|
{ name: "mark_inbox_read", description: "Mark one scoped review notification as read.", inputSchema: input({ notificationId: z.string().min(1) }), effectful: true, run: async (args) => (await viraHttpRequest(`${baseUrl}/v1/notifications/${encodeURIComponent(String(args.notificationId))}/read`, { ...mcpHttpOptions, method: "POST", body: scope, idempotencyKey: `mcp:inbox:${String(args.notificationId)}` })).body },
|
|
456
948
|
{ name: "inspect_conflicts", description: "Create a scoped conflict inspection for proposed versus active behavior.", inputSchema: input({ id: z.string().optional(), proposed: z.array(z.unknown()), active: z.array(z.unknown()), controls: z.array(z.unknown()) }), effectful: true, run: async (args) => (await viraHttpRequest(`${baseUrl}/v1/conflicts/inspect`, { ...mcpHttpOptions, method: "POST", body: { ...scope, ...args }, idempotencyKey: `mcp:conflicts:inspect:${String(args.id ?? scope.projectId)}` })).body },
|
|
457
949
|
{ name: "get_conflict_inspection", description: "Read a persisted scoped conflict inspection.", inputSchema: input({ inspectionId: z.string().min(1) }), run: (args) => readFromApi(`/v1/conflicts/${encodeURIComponent(String(args.inspectionId))}`) },
|
|
@@ -474,7 +966,7 @@ var fullTools = [
|
|
|
474
966
|
{ name: "resolve_semantic", description: "Classify input into registered Semantic Tasks. Use before execution when you need intent candidates; it does not run a behavior, tool, or TaskRun.", inputSchema: input({ input: z.string().min(1), profile: z.record(z.string(), z.unknown()).optional(), sessionId: z.string().optional(), selection: z.record(z.string(), z.unknown()).optional(), candidates: z.array(z.string()).optional(), timeoutMs: z.number().positive().optional(), requestId: z.string().optional(), executionBoundary: z.record(z.string(), z.unknown()).optional(), idempotencyKey: z.string().min(1).optional() }), run: (args) => client.resolveSemantic(args) },
|
|
475
967
|
{ name: "resolve_runtime", description: "Resolve a selected BehaviorPoint into released runtime authority. Use after canonical selection; it does not classify text or start a TaskRun.", inputSchema: input({ behaviorPoint: z.string().min(1).optional(), executionBoundary: z.record(z.string(), z.unknown()).optional(), semanticContext: z.record(z.string(), z.unknown()).optional(), idempotencyKey: z.string().min(1).optional() }), effectful: true, run: (args) => client.resolveRuntime(args) },
|
|
476
968
|
{ name: "resolve_task_run", description: "Preview server-owned AUTO mode selection and child plan. Use to inspect routing; it does not execute the TaskRun.", inputSchema: input({ input: z.string().min(1), requestedMode: z.enum(["AUTO", "SINGLE", "STRATEGY", "COMPOUND", "HYBRID"]).optional(), intentCount: z.number().int().positive().optional(), hostCapabilities: z.array(z.string()).optional(), hybridPlan: z.array(z.object({ semanticTaskKey: z.string().min(1), mode: z.enum(["SINGLE", "STRATEGY"]) })).optional() }), run: (args) => client.resolveTaskRun(args) },
|
|
477
|
-
{ name: "start_task_run", description: "Admit a registered TaskRun after server-side scope, release and authority checks; omit mode for AUTO.", inputSchema: input({ taskRunId: z.string().min(1), requestId: z.string().min(1), input: z.unknown(), ownerActorRef: z.string().min(1), requestedMode: z.enum(["AUTO", "SINGLE", "STRATEGY", "COMPOUND", "HYBRID"]).optional(), hybridPlan: z.array(z.object({ semanticTaskKey: z.string().min(1), mode: z.enum(["SINGLE", "STRATEGY"]) })).optional(), compoundPlanId: z.string().optional(), conversationId: z.string().optional(), episodeId: z.string().optional(), traceRootRef: z.string().optional(), budget: z.object({ maxChildren: z.number().int().positive().optional(), maxCalls: z.number().int().positive().optional(), maxLatencyMs: z.number().int().positive().optional(), maxCostMicros: z.number().int().positive().optional() }).optional(), hostCapabilities: z.array(z.string()).optional(), idempotencyKey: z.string().min(1).optional() }), effectful: true, run: (args) => {
|
|
969
|
+
{ name: "start_task_run", description: "Admit a registered TaskRun after server-side scope, AI System permission, release and authority checks; omit mode for AUTO.", inputSchema: input({ taskRunId: z.string().min(1), requestId: z.string().min(1), aiSystemId: z.string().min(1), input: z.unknown(), ownerActorRef: z.string().min(1), requestedMode: z.enum(["AUTO", "SINGLE", "STRATEGY", "COMPOUND", "HYBRID"]).optional(), hybridPlan: z.array(z.object({ semanticTaskKey: z.string().min(1), mode: z.enum(["SINGLE", "STRATEGY"]) })).optional(), compoundPlanId: z.string().optional(), conversationId: z.string().optional(), episodeId: z.string().optional(), traceRootRef: z.string().optional(), budget: z.object({ maxChildren: z.number().int().positive().optional(), maxCalls: z.number().int().positive().optional(), maxLatencyMs: z.number().int().positive().optional(), maxCostMicros: z.number().int().positive().optional() }).optional(), hostCapabilities: z.array(z.string()).optional(), idempotencyKey: z.string().min(1).optional() }), effectful: true, run: (args) => {
|
|
478
970
|
const { idempotencyKey, ...request } = args;
|
|
479
971
|
return client.startTaskRun(request, { idempotencyKey });
|
|
480
972
|
} },
|
|
@@ -482,12 +974,12 @@ var fullTools = [
|
|
|
482
974
|
{ name: "cancel_task_run", description: "Cancel a TaskRun using optimistic state-version fencing.", inputSchema: input({ taskRunId: z.string().min(1), expectedVersion: z.number().int().nonnegative(), idempotencyKey: z.string().min(1).optional() }), effectful: true, run: (args) => client.cancelTaskRun(String(args.taskRunId), Number(args.expectedVersion), { idempotencyKey: args.idempotencyKey }) },
|
|
483
975
|
{ name: "retry_task_run", description: "Retry a failed, blocked, or partial TaskRun using the same immutable plan and authority fencing.", inputSchema: input({ taskRunId: z.string().min(1), expectedVersion: z.number().int().nonnegative(), idempotencyKey: z.string().min(1).optional() }), effectful: true, run: (args) => client.retryTaskRun(String(args.taskRunId), Number(args.expectedVersion), { idempotencyKey: args.idempotencyKey }) },
|
|
484
976
|
{ name: "create_semantic_task", description: "Create a Semantic Task for review in the API key scope.", inputSchema: input({ id: z.string().optional(), taskKey: z.string().min(1), description: z.string().optional(), version: z.number().int().positive().optional(), aliases: z.array(z.string()).optional(), examples: z.array(z.string()).optional(), negativeExamples: z.array(z.string()).optional(), idempotencyKey: z.string().min(1).optional() }), effectful: true, run: (args) => {
|
|
485
|
-
const { id, idempotencyKey, ...task } = args;
|
|
486
|
-
return client.createSemanticTask(task, { id, idempotencyKey });
|
|
977
|
+
const { id: id2, idempotencyKey, ...task } = args;
|
|
978
|
+
return client.createSemanticTask(task, { id: id2, idempotencyKey });
|
|
487
979
|
} },
|
|
488
980
|
{ name: "create_behavior_point", description: "Create a BehaviorPoint in the API key scope.", inputSchema: input({ id: z.string().optional(), key: z.string().min(1), taskId: z.string().optional(), taskIds: z.array(z.string()).optional(), constraints: z.unknown().optional(), idempotencyKey: z.string().min(1).optional() }), effectful: true, run: (args) => {
|
|
489
|
-
const { id, idempotencyKey, ...point } = args;
|
|
490
|
-
return client.createBehaviorPoint(point, { id, idempotencyKey });
|
|
981
|
+
const { id: id2, idempotencyKey, ...point } = args;
|
|
982
|
+
return client.createBehaviorPoint(point, { id: id2, idempotencyKey });
|
|
491
983
|
} },
|
|
492
984
|
{ name: "create_observation", description: "Submit one scoped observation for discovery without publishing behavior.", inputSchema: input({ id: z.string().min(1), content: z.record(z.string(), z.unknown()), consent: z.boolean() }), effectful: true, run: async (args) => (await viraHttpRequest(`${baseUrl}/v1/observations`, { ...mcpHttpOptions, method: "POST", body: { ...scope, ...args }, idempotencyKey: `mcp:create_observation:${String(args.id)}` })).body },
|
|
493
985
|
{ name: "submit_teach_evidence", description: "Admit selected consented evidence into Teach analysis. Use after observation; it is not generic observation ingest and does not publish behavior.", inputSchema: input({ evidenceId: z.string().optional(), source: z.string().min(1), content: z.string().min(1), consent: z.literal(true), privacy: z.string().optional(), conversationId: z.string().optional(), controlPointId: z.string().optional(), summary: z.string().optional(), idempotencyKey: z.string().min(1).optional() }), effectful: true, run: (args) => {
|
|
@@ -510,6 +1002,7 @@ var fullTools = [
|
|
|
510
1002
|
{ name: "release_pack", description: "Release a separately evaluated and approved Pack.", inputSchema: input({ packId: z.string().min(1) }), effectful: true, run: (args) => client.releasePack(String(args.packId)) },
|
|
511
1003
|
{ name: "preview_pack_upgrade", description: "Preview a scoped Behavior Pack upgrade without applying it.", inputSchema: input({ packId: z.string().min(1), incoming: z.record(z.string(), z.unknown()) }), effectful: true, run: (args) => client.previewPackUpgrade(String(args.packId), args.incoming) },
|
|
512
1004
|
{ name: "get_strategy_execution_trace", description: "Read persisted Strategy execution trace and receipts.", inputSchema: input({ executionId: z.string().min(1) }), run: (args) => client.getStrategyExecutionTrace(String(args.executionId)) },
|
|
1005
|
+
{ name: "get_ai_usage_reconciliation", description: "Read exact Strategy provider-request and rated-credit evidence in the authenticated department; does not settle or mutate usage.", inputSchema: input({ executionId: z.string().min(1) }), run: (args) => client.getAIUsageReconciliation(String(args.executionId)) },
|
|
513
1006
|
{ name: "continue_strategy_execution", description: "Continue a waiting Strategy execution under the same immutable authority.", inputSchema: input({ executionId: z.string().min(1), authorityDigest: z.string().optional(), state: z.record(z.string(), z.unknown()).optional(), references: z.record(z.string(), z.unknown()).optional() }), effectful: true, run: (args) => client.continueStrategyExecution(String(args.executionId), { authorityDigest: args.authorityDigest, state: args.state, references: args.references }) },
|
|
514
1007
|
{ name: "start_strategy_execution", description: "Start a server-authorized immutable Strategy execution.", inputSchema: input({ artifactDigest: z.string().min(1), revisionId: z.string().min(1), idempotencyKey: z.string().min(1), nonce: z.string().min(1), expiresAt: z.number().positive(), decisionPlanId: z.string().min(1), candidates: z.array(z.record(z.string(), z.unknown())), policy: z.string().min(1), behaviorPoint: z.string().optional(), executionBoundary: z.record(z.string(), z.unknown()).optional() }), effectful: true, run: (args) => client.startStrategyExecution(args) },
|
|
515
1008
|
{ name: "list_host_tools", description: "List host tools registered dynamically by the host with their ActionDefinition bindings; this MCP server defines no domain tools.", inputSchema: input(), run: async () => ({ tools: hostToolDefinitions }) },
|
|
@@ -521,12 +1014,12 @@ var fullTools = [
|
|
|
521
1014
|
if (String(proposalRecord.tool_key ?? "") !== registered.name) throw new Error("MCP_HOST_TOOL_DEFINITION_MISMATCH");
|
|
522
1015
|
return client.authorizeHostAction({ executionId: String(executionId), sessionId: String(sessionId), dataVersion: String(dataVersion), scope, context: contextRecord, proposal: proposalRecord, ...approval ? { approval } : {} });
|
|
523
1016
|
} },
|
|
524
|
-
{ name: "list_ai_systems", description: "List
|
|
1017
|
+
{ name: "list_ai_systems", description: "List AI Systems visible in the selected department with bounded cursor pagination. Results include the canonical ownerUnitId and active consumingUnitGrants when the caller is a Workspace Owner; grants do not replace membership in the selected department.", inputSchema: input(pageFields), run: (args) => listFromApi("/v1/ai-systems", args) },
|
|
525
1018
|
{ name: "delete_ai_system", description: "Delete an unused scoped AI System after explicit confirmation.", inputSchema: input({ systemId: z.string().min(1), confirm: z.literal(true) }), effectful: true, run: (args) => client.deleteAISystem(String(args.systemId), { confirm: args.confirm === true }) },
|
|
526
|
-
{ name: "get_ai_system", description: "Read one
|
|
1019
|
+
{ name: "get_ai_system", description: "Read one AI System with its server-resolved ownerUnitId. Workspace Owners also receive active consumingUnitGrants; grants never replace active department membership.", inputSchema: input({ systemId: z.string().min(1) }), run: (args) => client.getAISystem(String(args.systemId)) },
|
|
527
1020
|
{ name: "list_system_connections", description: "List connections for an AI system with bounded cursor pagination and search.", inputSchema: input({ systemId: z.string().min(1), ...pageFields, search: z.string().min(1).optional() }), run: (args) => client.listSystemConnections(String(args.systemId), { limit: args.limit, cursor: args.cursor, search: args.search }) },
|
|
528
1021
|
{ name: "list_discovery_candidates", description: "Read evidence-backed discovery candidates with bounded pagination and search.", inputSchema: input({ reviewState: z.string().optional(), ...pageFields, search: z.string().optional() }), run: (args) => client.discover({ reviewState: args.reviewState, limit: args.limit, cursor: args.cursor, search: args.search }) },
|
|
529
|
-
{ name: "review_discovery_candidate", description: "Record a human review decision for a scoped discovery candidate.", inputSchema: input({ kind: z.string().min(1), key: z.string().min(1), decision: z.string().min(1), payload: z.record(z.string(), z.unknown()).optional() }), effectful: true, run: (args) => client.reviewDiscoveryCandidate(String(args.kind), String(args.key), { decision: String(args.decision), ...args.payload ? { payload: args.payload } : {} }) },
|
|
1022
|
+
{ name: "review_discovery_candidate", description: "Record a human review decision for a scoped discovery candidate.", inputSchema: input({ kind: z.string().min(1), key: z.string().min(1), decision: z.string().min(1), patch: z.record(z.string(), z.unknown()).optional(), payload: z.record(z.string(), z.unknown()).optional() }), effectful: true, run: (args) => client.reviewDiscoveryCandidate(String(args.kind), String(args.key), { decision: String(args.decision), ...args.patch !== void 0 ? { patch: args.patch } : {}, ...args.payload !== void 0 ? { payload: args.payload } : {} }, { idempotencyKey: newMcpMutationKey("review_discovery_candidate") }) },
|
|
530
1023
|
{ name: "get_connection", description: "Read one connection.", inputSchema: input({ connectionId: z.string().min(1) }), run: (args) => client.getConnection(String(args.connectionId)) },
|
|
531
1024
|
{ name: "get_connection_health", description: "Read the latest health state for one AI System connection.", inputSchema: input({ connectionId: z.string().min(1) }), run: (args) => client.connectionHealth(String(args.connectionId)) },
|
|
532
1025
|
{ name: "list_connection_inventory", description: "List capability inventory for one connected AI System.", inputSchema: input({ systemId: z.string().min(1) }), run: (args) => client.inventory(String(args.systemId)) },
|
|
@@ -537,9 +1030,22 @@ var fullTools = [
|
|
|
537
1030
|
{ name: "validate_behavior_strategy", description: "Validate a Behavior Strategy.", inputSchema: input({ strategyId: z.string().min(1) }), effectful: true, run: (args) => client.validateBehaviorStrategy(String(args.strategyId)) },
|
|
538
1031
|
{ name: "activate_behavior_strategy", description: "Activate a validated Behavior Strategy.", inputSchema: input({ strategyId: z.string().min(1) }), effectful: true, run: (args) => client.activateBehaviorStrategy(String(args.strategyId)) },
|
|
539
1032
|
{ name: "simulate_behavior_strategy", description: "Simulate a Behavior Strategy.", inputSchema: input({ strategyId: z.string().min(1), initialState: z.record(z.string(), z.unknown()).optional() }), run: (args) => client.simulateBehaviorStrategy(String(args.strategyId), args.initialState ?? {}) },
|
|
1033
|
+
{ name: "get_task_run_evidence", description: "Read authorized TaskRun evidence, including SINGLE host completion.", inputSchema: input({ taskRunId: z.string().min(1) }), run: (args) => readFromApi(`/v1/task-runs/${encodeURIComponent(String(args.taskRunId))}/evidence`) },
|
|
1034
|
+
{ name: "queue_task_run_host_dispatch", description: "Queue a previously human-approved SINGLE host dispatch, not local execution.", inputSchema: input({ organizationUnitId: z.string().min(1), taskRunId: z.string().min(1), childRunId: z.string().min(1), aiSystemId: z.string().min(1), sessionId: z.string().min(1), approvalId: z.string().min(1), context: z.record(z.string(), z.unknown()), proposal: z.record(z.string(), z.unknown()) }), effectful: true, run: async (args) => {
|
|
1035
|
+
const body = buildMcpTaskRunHostDispatch(args, scope);
|
|
1036
|
+
const response = await viraHttpRequest(`${baseUrl}/v1/runtime/actions/authorize`, { ...mcpHttpOptions, retries: 0, method: "POST", body });
|
|
1037
|
+
if (response.status !== 202) throw Error("MCP_SINGLE_HOST_QUEUE_PROOF_REQUIRED");
|
|
1038
|
+
return assertMcpTaskRunHostQueued(response.body);
|
|
1039
|
+
} },
|
|
540
1040
|
{ name: "get_task_run", description: "Read TaskRun state and final result.", inputSchema: input({ taskRunId: z.string().min(1) }), run: (args) => client.getTaskRun(String(args.taskRunId)) },
|
|
1041
|
+
{ name: "list_compound_task_plans", description: "List persisted compound execution plans in the authenticated scope with bounded cursor pagination.", inputSchema: input({ limit: z.number().int().positive().max(500).optional(), cursor: z.string().min(1).optional() }), run: (args) => client.listCompoundTaskPlans(args) },
|
|
1042
|
+
{ name: "save_compound_task_plan", description: "Persist a validated immutable compound execution plan in the authenticated scope. This does not execute the plan.", inputSchema: input({ plan: z.record(z.string(), z.unknown()), idempotencyKey: z.string().min(1).optional() }), effectful: true, run: (args) => client.saveCompoundTaskPlan(args.plan, { idempotencyKey: args.idempotencyKey }) },
|
|
1043
|
+
{ name: "get_compound_task_plan", description: "Read one persisted compound execution plan in the authenticated scope.", inputSchema: input({ planId: z.string().min(1) }), run: (args) => client.getCompoundTaskPlan(String(args.planId)) },
|
|
541
1044
|
{ name: "list_task_run_events", description: "Read TaskRun lifecycle events and child lineage.", inputSchema: input({ taskRunId: z.string().min(1) }), run: (args) => client.listTaskRunEvents(String(args.taskRunId)) },
|
|
542
|
-
{ name: "observe", description: "Ingest a scoped observation.", inputSchema: input({ event: z.record(z.string(), z.unknown()) }), effectful: true, run: (args) =>
|
|
1045
|
+
{ name: "observe", description: "Ingest a scoped observation. Conversation output events derive the same event ID as OpenCode from conversationId and requestId.", inputSchema: input({ event: z.record(z.string(), z.unknown()) }), effectful: true, run: (args) => {
|
|
1046
|
+
const normalized = normalizeMcpObservationEvent(args.event);
|
|
1047
|
+
return client.observe(normalized.event, { idempotencyKey: normalized.idempotencyKey });
|
|
1048
|
+
} },
|
|
543
1049
|
{ name: "list_observations", description: "List admitted observations in the current environment with bounded pagination.", inputSchema: input(pageFields), run: (args) => client.listObservations(args) },
|
|
544
1050
|
{ name: "get_observation", description: "Read one admitted observation by event ID in the current environment.", inputSchema: input({ eventId: z.string().min(1) }), run: (args) => client.getObservation(String(args.eventId)) },
|
|
545
1051
|
{ name: "record_user_feedback", description: "Record scoped user feedback for an observed AI interaction.", inputSchema: input({ event: z.record(z.string(), z.unknown()) }), effectful: true, run: (args) => client.recordUserFeedback(args.event) },
|
|
@@ -583,11 +1089,12 @@ var fullTools = [
|
|
|
583
1089
|
{ name: "approve_pack", description: "Approve a passed Pack evaluation.", inputSchema: input({ packId: z.string().min(1), reason: z.string().optional() }), effectful: true, run: (args) => client.approvePack(String(args.packId), { manualApproval: true, reason: args.reason }) },
|
|
584
1090
|
{ name: "compile_behavior_capsule", description: "Compile a Behavior Program capsule.", inputSchema: input({ programId: z.string().min(1), input: z.string().min(1), selection: z.record(z.string(), z.unknown()).optional(), candidates: z.array(z.unknown()).optional() }), effectful: true, run: (args) => client.compileBehaviorCapsule(args) },
|
|
585
1091
|
{ name: "serve_behavior_projection", description: "Serve the active behavior projection for verification. Use only after get_scope/list_capabilities, Pack install, evaluation, approval, release, and a verified promotion pointer confirm that the requested Behavior Program is active. Do not use this tool to create, install, evaluate, approve, or release a Pack, to classify input, to call the model, or to execute a host action; it does not call the model or execute tools. Use compile_behavior_capsule when you need pre-model context, resolve_runtime/executeRuntime when you need enforcement, and evaluate_behavior_revision_candidate when testing an unreleased candidate.", inputSchema: input({ input: z.string().min(1), provider: z.string().min(1), programId: z.string().optional() }), effectful: true, run: (args) => client.serveBehaviorProjection(args) },
|
|
586
|
-
{ name: "create_release", description: "Create a governed release for an approved immutable artifact.", inputSchema: input({ release: z.record(z.string(), z.unknown()) }), effectful: true, run: (args) => client.createRelease(args.release) }
|
|
1092
|
+
{ name: "create_release", description: "Create a governed release for an approved immutable artifact.", inputSchema: input({ release: z.record(z.string(), z.unknown()) }), effectful: true, run: (args) => client.createRelease(args.release) },
|
|
1093
|
+
{ name: "retire_program_pointer", description: "Retire the current scoped program pointer with a version fence. Irreversible for the active pointer; requires release.approve permission and explicit human confirmation.", inputSchema: input({ pointerKey: z.string().min(1), confirm: z.literal(true), expectedVersion: z.number().int().positive(), reason: z.string().min(1).max(500), idempotencyKey: z.string().min(1).optional() }), effectful: true, run: async (args) => (await viraHttpRequest(`${baseUrl}/v1/promotions/program-pointers/${encodeURIComponent(String(args.pointerKey))}/retire`, { ...mcpHttpOptions, method: "POST", body: { ...scope, confirm: true, expectedVersion: Number(args.expectedVersion), reason: String(args.reason).trim() }, idempotencyKey: String(args.idempotencyKey ?? `mcp:program-pointer-retire:${String(args.pointerKey)}:${String(args.expectedVersion)}`) })).body }
|
|
587
1094
|
];
|
|
588
1095
|
var genericTools = [
|
|
589
|
-
{ name: "read_control_api", description: "Call one registered read-only Control API path not promoted to a first-class MCP tool.", inputSchema: input({ path: z.string().
|
|
590
|
-
{ name: "write_control_api", description: "Call one registered effectful Control API path not promoted to a first-class MCP tool. Server authorization and receipts still apply.", inputSchema: input({ path: z.string().
|
|
1096
|
+
{ name: "read_control_api", description: "Call one registered read-only Control API path not promoted to a first-class MCP tool.", inputSchema: input({ path: z.string().min(4), pathParams: z.record(z.string(), z.string()).optional(), query: z.record(z.string(), z.unknown()).optional() }), run: readControlApi },
|
|
1097
|
+
{ name: "write_control_api", description: "Call one registered effectful Control API path not promoted to a first-class MCP tool. Server authorization and receipts still apply.", inputSchema: input({ path: z.string().min(4), method: z.enum(["POST", "PUT", "PATCH", "DELETE"]).default("POST"), pathParams: z.record(z.string(), z.string()).optional(), query: z.record(z.string(), z.unknown()).optional(), body: z.record(z.string(), z.unknown()), idempotencyKey: z.string().min(1).optional() }), effectful: true, run: writeControlApi }
|
|
591
1098
|
];
|
|
592
1099
|
var handlerDefinitions = [...fullTools, ...genericTools];
|
|
593
1100
|
if (new Set(handlerDefinitions.map((tool) => tool.name)).size !== handlerDefinitions.length) throw new Error("MCP_TOOL_HANDLER_DUPLICATE");
|
|
@@ -600,19 +1107,20 @@ var tools = Object.freeze(MCP_PUBLIC_TOOL_CATALOG.map((definition) => {
|
|
|
600
1107
|
if (tools.some((tool) => !isKnownMcpTool(tool.name) || Boolean(tool.effectful) !== (getMcpToolAuthority(tool.name)?.effectType === "effectful"))) throw new Error("MCP_TOOL_REGISTRY_DRIFT");
|
|
601
1108
|
var authorize = async (tool, args) => {
|
|
602
1109
|
if (!tool.effectful) return;
|
|
1110
|
+
const authorityArguments = sanitizeMcpAuthorityArguments(tool.name, args);
|
|
603
1111
|
const decision = (await viraHttpRequest(authorityUrl, {
|
|
604
1112
|
...mcpHttpOptions,
|
|
605
1113
|
method: "POST",
|
|
606
|
-
body: { tool: tool.name, arguments:
|
|
607
|
-
idempotencyKey:
|
|
1114
|
+
body: { tool: tool.name, arguments: authorityArguments, scope },
|
|
1115
|
+
idempotencyKey: newMcpAuthorizationKey(tool.name)
|
|
608
1116
|
})).body;
|
|
609
|
-
|
|
1117
|
+
assertMcpAuthorityDecisionReceipt(decision);
|
|
610
1118
|
};
|
|
611
|
-
var server = new McpServer({ name: process.env.VIRA_MCP_SERVER_NAME ?? "vira", version: "0.1.
|
|
1119
|
+
var server = new McpServer({ name: process.env.VIRA_MCP_SERVER_NAME ?? "vira", version: "0.1.91" }, { capabilities: { tools: {} } });
|
|
612
1120
|
for (const tool of tools) {
|
|
613
1121
|
server.registerTool(tool.name, { description: tool.description, inputSchema: tool.inputSchema, outputSchema: z.fromJSONSchema(MCP_PUBLIC_TOOL_CATALOG.find((item) => item.name === tool.name).outputSchema), annotations: tool.annotations }, async (raw) => {
|
|
614
1122
|
const args = raw;
|
|
615
|
-
scopeQuery(args);
|
|
1123
|
+
scopeQuery(args, ["list_ai_usage_receipts", "get_ai_usage_summary"].includes(tool.name));
|
|
616
1124
|
try {
|
|
617
1125
|
await authorize(tool, args);
|
|
618
1126
|
const apiArgs = Object.fromEntries(Object.entries(args).filter(([key]) => !(key in scope)));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tryvira/mcp",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.91",
|
|
4
4
|
"mcpName": "io.github.hrpering/vira",
|
|
5
5
|
"description": "Vira MCP client and npx-ready JSON-RPC launcher.",
|
|
6
6
|
"keywords": [
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
},
|
|
15
15
|
"repository": {
|
|
16
16
|
"type": "git",
|
|
17
|
-
"url": "https://github.com/hrpering/
|
|
17
|
+
"url": "https://github.com/hrpering/Vira_Behavior_Prod.git"
|
|
18
18
|
},
|
|
19
19
|
"homepage": "https://github.com/hrpering/tryvira#readme",
|
|
20
20
|
"bugs": {
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@modelcontextprotocol/server": "^2.4.0",
|
|
41
|
-
"@tryvira/sdk": "^0.1.
|
|
41
|
+
"@tryvira/sdk": "^0.1.94",
|
|
42
42
|
"zod": "^4.2.0"
|
|
43
43
|
},
|
|
44
44
|
"scripts": {
|