@wayai/cli 0.3.109 → 0.3.111

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -648,13 +648,15 @@ var init_api_client = __esm({
648
648
  /**
649
649
  * Re-discover an MCP connection's tool/resource catalog (refreshes stale
650
650
  * input schemas that `push` leaves untouched). `connection` is the display
651
- * name or the connection UUID.
651
+ * name or the connection UUID. With `{ check: true }` the server compares the
652
+ * live catalog and returns drift WITHOUT writing anything (read-only).
652
653
  */
653
- async syncMcp(hubId, connection, organizationId) {
654
+ async syncMcp(hubId, connection, organizationId, opts) {
654
655
  return this.request("POST", "/api/ci/sync-mcp", {
655
656
  hub_id: hubId,
656
657
  connection,
657
- ...organizationId && { organization_id: organizationId }
658
+ ...organizationId && { organization_id: organizationId },
659
+ ...opts?.check && { check: true }
658
660
  });
659
661
  }
660
662
  async lookup(path31, opts) {
@@ -6060,7 +6062,7 @@ var init_dist = __esm({
6060
6062
  "gi"
6061
6063
  );
6062
6064
  QUERY_CREDENTIAL_RE = new RegExp(
6063
- `((?:^|[?&;\\s])${SENSITIVE_KEY_PATTERN}=)[^&;\\s"']+`,
6065
+ `((?:^|[?&#;\\s])${SENSITIVE_KEY_PATTERN}=)[^&;\\s"']+`,
6064
6066
  "gi"
6065
6067
  );
6066
6068
  REDACTED = "[REDACTED]";
@@ -8069,7 +8071,8 @@ var init_dist = __esm({
8069
8071
  ciSyncMcpBody = external_exports.object({
8070
8072
  hub_id: ciUuidSchema,
8071
8073
  connection: external_exports.string().min(1, "connection is required"),
8072
- organization_id: ciUuidSchema.optional()
8074
+ organization_id: ciUuidSchema.optional(),
8075
+ check: external_exports.boolean().optional()
8073
8076
  });
8074
8077
  ciOrgResourcesParam = external_exports.object({
8075
8078
  org_id: ciUuidSchema
@@ -13858,7 +13861,8 @@ var init_contracts = __esm({
13858
13861
  ciSyncMcpBody2 = external_exports.object({
13859
13862
  hub_id: ciUuidSchema2,
13860
13863
  connection: external_exports.string().min(1, "connection is required"),
13861
- organization_id: ciUuidSchema2.optional()
13864
+ organization_id: ciUuidSchema2.optional(),
13865
+ check: external_exports.boolean().optional()
13862
13866
  });
13863
13867
  ciOrgResourcesParam2 = external_exports.object({
13864
13868
  org_id: ciUuidSchema2
@@ -18107,7 +18111,12 @@ async function deleteHistoryCommand(args2) {
18107
18111
  }
18108
18112
  }
18109
18113
  const result = await (conversationId ? client.deleteHistory(hubId, { userId, mode: "current", conversationId }) : client.deleteHistory(hubId, { userId, mode: "all" }));
18110
- console.log(`Deleted ${result.deleted_count} conversation(s).`);
18114
+ let summary = `Deleted ${result.deleted_count} conversation(s).`;
18115
+ if (!conversationId && result.cleared_state_count > 0) {
18116
+ const n = result.cleared_state_count;
18117
+ summary += ` Cleared ${n} user-scoped state entr${n === 1 ? "y" : "ies"}.`;
18118
+ }
18119
+ console.log(summary);
18111
18120
  }
18112
18121
  var init_delete_history = __esm({
18113
18122
  "src/commands/delete-history.ts"() {
@@ -18179,28 +18188,70 @@ __export(sync_mcp_exports, {
18179
18188
  });
18180
18189
  function parseArgs12(args2) {
18181
18190
  let connection;
18191
+ let check = false;
18182
18192
  for (let i = 0; i < args2.length; i++) {
18183
18193
  const arg = args2[i];
18184
18194
  if (arg === "--connection" && args2[i + 1]) {
18185
18195
  connection = args2[++i];
18196
+ } else if (arg === "--check" || arg === "--dry-run") {
18197
+ check = true;
18186
18198
  }
18187
18199
  }
18188
- return { connection };
18200
+ return { connection, check };
18189
18201
  }
18190
18202
  async function syncMcpCommand(args2) {
18191
18203
  const hubId = resolveActiveHubId(args2);
18192
- const { connection } = parseArgs12(args2);
18204
+ const { connection, check } = parseArgs12(args2);
18193
18205
  if (!connection) {
18194
- console.error("Usage: wayai sync-mcp --connection <name> [--hub <uuid|folder-name>]");
18206
+ console.error("Usage: wayai sync-mcp --connection <name> [--hub <uuid|folder-name>] [--check]");
18195
18207
  console.error("");
18196
18208
  console.error("Re-discovers the MCP connection's tools/resources and refreshes their");
18197
18209
  console.error("cached input schemas. `--connection` accepts the connection display name");
18198
18210
  console.error("(as in connections[].name) or its UUID.");
18211
+ console.error("");
18212
+ console.error(" --check Report tool-schema drift (cached catalog vs live server)");
18213
+ console.error(" WITHOUT writing anything. Exits 1 when drift is found \u2014");
18214
+ console.error(" for CI. Alias: --dry-run.");
18199
18215
  process.exit(1);
18200
18216
  }
18201
18217
  const { organization_id: organizationId } = requireRepoConfig();
18202
18218
  const { config, accessToken } = await requireAuth();
18203
18219
  const client = new ApiClient({ apiUrl: config.api_url, accessToken });
18220
+ if (check) {
18221
+ console.log(`Checking MCP tool-schema drift for connection "${connection}"...`);
18222
+ const result2 = await client.syncMcp(hubId, connection, organizationId, { check: true });
18223
+ const drift = result2.drift ?? [];
18224
+ if (result2.reachable === false) {
18225
+ console.log(
18226
+ `Could not reach the MCP server to verify drift for "${result2.connection_name}"${result2.message ? ` (${result2.message})` : ""}. Catalog drift not verified.`
18227
+ );
18228
+ return;
18229
+ }
18230
+ if (drift.length === 0) {
18231
+ console.log(`No drift \u2014 connection "${result2.connection_name}" catalog matches the server \u2713`);
18232
+ return;
18233
+ }
18234
+ const noun = drift.length === 1 ? "tool has" : "tools have";
18235
+ console.log(`
18236
+ \u26A0 ${drift.length} ${noun} drifted on connection "${result2.connection_name}":
18237
+ `);
18238
+ for (const d of drift) {
18239
+ if (d.kind === "added") {
18240
+ console.log(` + ${d.tool_name} \u2014 advertised by the server, not in the catalog`);
18241
+ } else if (d.kind === "removed") {
18242
+ console.log(` - ${d.tool_name} \u2014 in the catalog, no longer on the server`);
18243
+ } else {
18244
+ console.log(` ~ ${d.tool_name} \u2014 ${d.detail ?? "schema changed"}`);
18245
+ }
18246
+ }
18247
+ console.log(
18248
+ // Quote the name — display names are free-form and often contain spaces,
18249
+ // and the CLI reads `--connection` as a single token.
18250
+ `
18251
+ Run \`wayai sync-mcp --connection "${result2.connection_name}"\` to refresh the catalog.`
18252
+ );
18253
+ process.exit(1);
18254
+ }
18204
18255
  console.log(`Syncing MCP tools for connection "${connection}"...`);
18205
18256
  const result = await client.syncMcp(hubId, connection, organizationId);
18206
18257
  console.log(
@@ -23385,7 +23436,7 @@ Commands:
23385
23436
  conversations List or inspect conversations
23386
23437
  alerts Show a hub's active connection/credential alerts (run this FIRST when a hub misbehaves)
23387
23438
  analytics Show analytics summary and metrics (use \`analytics query\` for structured ClickHouse queries)
23388
- delete-history Delete your conversations on a hub (--conversation-id <id> for just one)
23439
+ delete-history Delete your conversations on a hub; full history also clears your user-scoped state (--conversation-id <id> deletes just one, keeps state)
23389
23440
  evals List evaluation scenarios for the current hub (use \`evals sql\` for read-only SQL on eval results)
23390
23441
  run-eval Run all enabled evals and show results
23391
23442
  eval-results View results from a completed eval session