@tryvoyager/cli 0.1.1 → 0.1.3

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/bin/voyager CHANGED
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tryvoyager/cli",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "Voyager CLI for secure local MCP setup on macOS",
5
5
  "license": "UNLICENSED",
6
6
  "private": false,
@@ -35629,7 +35629,6 @@ var SAFE_PROVISIONING_OUTPUT_FIELDS = new Set([
35629
35629
  "http_status",
35630
35630
  "operation",
35631
35631
  "regenerate_api_key",
35632
- "workflow_id",
35633
35632
  "google_2fa_code",
35634
35633
  "message",
35635
35634
  "polling_timeout",
@@ -35640,7 +35639,6 @@ var SAFE_PROVISIONING_OUTPUT_FIELDS = new Set([
35640
35639
  "dashboard_url",
35641
35640
  "docs_url",
35642
35641
  "context7_docs_url",
35643
- "account_id",
35644
35642
  "credential_reference",
35645
35643
  "credential_env_key",
35646
35644
  "secret_env_key",
@@ -35714,7 +35712,6 @@ var SAFE_DIRECTORY_TOP_LEVEL_FIELDS = new Set([
35714
35712
  "http_status"
35715
35713
  ]);
35716
35714
  var SAFE_PROVIDER_FIELDS = new Set([
35717
- "id",
35718
35715
  "name",
35719
35716
  "slug",
35720
35717
  "description",
@@ -35746,9 +35743,7 @@ var SAFE_CREDENTIAL_REFERENCE_FIELDS = new Set([
35746
35743
  "dashboard_url",
35747
35744
  "docs_url",
35748
35745
  "context7_docs_url",
35749
- "account_id",
35750
35746
  "environment",
35751
- "workflow_id",
35752
35747
  "source"
35753
35748
  ]);
35754
35749
  function pickJsonFields(obj, allowedFields) {
@@ -35869,10 +35864,6 @@ function sanitizeOnboardingStatusToolResult(value) {
35869
35864
  const safe = {
35870
35865
  status: readStringField(obj, "status") ?? "unknown"
35871
35866
  };
35872
- const userId = readStringField(obj, "user_id");
35873
- if (userId) {
35874
- safe.user_id = userId;
35875
- }
35876
35867
  const globalProfile = sanitizeOnboardingProfile(obj.global_profile);
35877
35868
  if (globalProfile) {
35878
35869
  safe.global_profile = globalProfile;
@@ -37969,6 +37960,42 @@ async function getOnboardingStatus() {
37969
37960
  }
37970
37961
 
37971
37962
  // packages/mcp-server/src/index.ts
37963
+ var workflowHandleById = new Map;
37964
+ var workflowIdByHandle = new Map;
37965
+ var workflowHandleCounter = 0;
37966
+ function rememberWorkflowHandle(workflowId) {
37967
+ if (typeof workflowId !== "string") {
37968
+ return null;
37969
+ }
37970
+ const cleaned = workflowId.trim();
37971
+ if (!cleaned) {
37972
+ return null;
37973
+ }
37974
+ const existing = workflowHandleById.get(cleaned);
37975
+ if (existing) {
37976
+ return existing;
37977
+ }
37978
+ workflowHandleCounter += 1;
37979
+ const handle = `workflow_${workflowHandleCounter}`;
37980
+ workflowHandleById.set(cleaned, handle);
37981
+ workflowIdByHandle.set(handle, cleaned);
37982
+ return handle;
37983
+ }
37984
+ function resolveWorkflowReference(reference) {
37985
+ const cleaned = reference.trim();
37986
+ return workflowIdByHandle.get(cleaned) ?? cleaned;
37987
+ }
37988
+ function sanitizedProvisioningContent(value) {
37989
+ const safe = sanitizeProvisioningToolResult(value);
37990
+ if (value && typeof value === "object" && !Array.isArray(value)) {
37991
+ const raw = value;
37992
+ const workflowHandle = rememberWorkflowHandle(raw.workflow_id) ?? (typeof raw.workflow_handle === "string" && raw.workflow_handle.trim().length > 0 ? raw.workflow_handle.trim() : null);
37993
+ if (workflowHandle) {
37994
+ safe.workflow_handle = workflowHandle;
37995
+ }
37996
+ }
37997
+ return JSON.stringify(safe);
37998
+ }
37972
37999
  function readBackendErrorReason(payload) {
37973
38000
  if (!payload || typeof payload !== "object" || !("detail" in payload)) {
37974
38001
  return null;
@@ -38033,25 +38060,27 @@ server.registerTool("provision_account", {
38033
38060
  const resultObj = typeof result === "object" && result !== null ? result : {};
38034
38061
  if (resultObj.status === "waiting_for_2fa") {
38035
38062
  const code = resultObj.google_2fa_code ?? "";
38036
- const userMsg = code ? `ACTION REQUIRED: Google 2FA verification \u2014 tap number ${code} on your phone NOW to approve sign-in. After approving, call get_provisioning_status with workflow_id "${resultObj.workflow_id ?? ""}" to continue.` : `ACTION REQUIRED: Google 2FA verification \u2014 check your phone NOW and approve the sign-in prompt. After approving, call get_provisioning_status with workflow_id "${resultObj.workflow_id ?? ""}" to continue.`;
38063
+ const workflowHandle = rememberWorkflowHandle(resultObj.workflow_id);
38064
+ const userMsg = code ? `ACTION REQUIRED: Google 2FA verification \u2014 tap number ${code} on your phone NOW to approve sign-in. After approving, call get_provisioning_status with workflow_handle "${workflowHandle ?? ""}" to continue.` : `ACTION REQUIRED: Google 2FA verification \u2014 check your phone NOW and approve the sign-in prompt. After approving, call get_provisioning_status with workflow_handle "${workflowHandle ?? ""}" to continue.`;
38037
38065
  return {
38038
38066
  content: [
38039
38067
  { type: "text", text: userMsg },
38040
- { type: "text", text: JSON.stringify(sanitizeProvisioningToolResult(result)) }
38068
+ { type: "text", text: sanitizedProvisioningContent(result) }
38041
38069
  ]
38042
38070
  };
38043
38071
  }
38044
38072
  if (resultObj.reason === "browser_agent_stalled" && typeof resultObj.workflow_id === "string") {
38045
- const userMsg = `Provisioning appears stalled in the browser flow. Call get_provisioning_status with workflow_id "${resultObj.workflow_id}" to continue polling, or rerun provision_account to retry.`;
38073
+ const workflowHandle = rememberWorkflowHandle(resultObj.workflow_id);
38074
+ const userMsg = `Provisioning appears stalled in the browser flow. Call get_provisioning_status with workflow_handle "${workflowHandle ?? ""}" to continue polling, or rerun provision_account to retry.`;
38046
38075
  return {
38047
38076
  content: [
38048
38077
  { type: "text", text: userMsg },
38049
- { type: "text", text: JSON.stringify(sanitizeProvisioningToolResult(result)) }
38078
+ { type: "text", text: sanitizedProvisioningContent(result) }
38050
38079
  ]
38051
38080
  };
38052
38081
  }
38053
38082
  return {
38054
- content: [{ type: "text", text: JSON.stringify(sanitizeProvisioningToolResult(result)) }]
38083
+ content: [{ type: "text", text: sanitizedProvisioningContent(result) }]
38055
38084
  };
38056
38085
  } catch (error2) {
38057
38086
  if (error2 instanceof BackendError) {
@@ -38065,7 +38094,7 @@ server.registerTool("provision_account", {
38065
38094
  regenerate_api_key: regenerateApiKey
38066
38095
  };
38067
38096
  return {
38068
- content: [{ type: "text", text: JSON.stringify(sanitizeProvisioningToolResult(payload2)) }]
38097
+ content: [{ type: "text", text: sanitizedProvisioningContent(payload2) }]
38069
38098
  };
38070
38099
  }
38071
38100
  const payload = {
@@ -38077,50 +38106,59 @@ server.registerTool("provision_account", {
38077
38106
  regenerate_api_key: regenerateApiKey
38078
38107
  };
38079
38108
  return {
38080
- content: [{ type: "text", text: JSON.stringify(sanitizeProvisioningToolResult(payload)) }]
38109
+ content: [{ type: "text", text: sanitizedProvisioningContent(payload) }]
38081
38110
  };
38082
38111
  }
38083
38112
  });
38084
38113
  server.registerTool("get_provisioning_status", {
38085
38114
  title: "Get Provisioning Status",
38086
- description: "Get workflow status and (if completed) re-run finalization/setup for diagnostics or manual recovery.",
38115
+ description: "Get provisioning status using the workflow_handle returned by provision_account. Legacy raw workflow ids are also accepted.",
38087
38116
  inputSchema: {
38088
- workflow_id: exports_external.string().min(1)
38117
+ workflow_handle: exports_external.string().min(1).optional(),
38118
+ workflow_id: exports_external.string().min(1).optional()
38119
+ }
38120
+ }, async ({ workflow_handle, workflow_id }) => {
38121
+ const workflowReference = (workflow_handle ?? workflow_id ?? "").trim();
38122
+ if (!workflowReference) {
38123
+ throw new McpError(ErrorCode.InvalidParams, "workflow_handle is required");
38089
38124
  }
38090
- }, async ({ workflow_id }) => {
38125
+ const resolvedWorkflowId = resolveWorkflowReference(workflowReference);
38091
38126
  try {
38092
- const result = await getProvisioningStatus(workflow_id);
38127
+ const result = await getProvisioningStatus(resolvedWorkflowId);
38093
38128
  const resultObj = typeof result === "object" && result !== null ? result : {};
38094
38129
  if (resultObj.status === "waiting_for_2fa") {
38095
38130
  const code = resultObj.google_2fa_code ?? "";
38096
- const userMsg = code ? `ACTION REQUIRED: Google 2FA verification \u2014 tap number ${code} on your phone NOW to approve sign-in. After approving, call get_provisioning_status with workflow_id "${workflow_id}" to continue.` : `ACTION REQUIRED: Google 2FA verification \u2014 check your phone NOW and approve the sign-in prompt. After approving, call get_provisioning_status with workflow_id "${workflow_id}" to continue.`;
38131
+ const rememberedHandle = rememberWorkflowHandle(resultObj.workflow_id) ?? workflowReference;
38132
+ const userMsg = code ? `ACTION REQUIRED: Google 2FA verification \u2014 tap number ${code} on your phone NOW to approve sign-in. After approving, call get_provisioning_status with workflow_handle "${rememberedHandle}" to continue.` : `ACTION REQUIRED: Google 2FA verification \u2014 check your phone NOW and approve the sign-in prompt. After approving, call get_provisioning_status with workflow_handle "${rememberedHandle}" to continue.`;
38097
38133
  return {
38098
38134
  content: [
38099
38135
  { type: "text", text: userMsg },
38100
- { type: "text", text: JSON.stringify(sanitizeProvisioningToolResult(result)) }
38136
+ { type: "text", text: sanitizedProvisioningContent(result) }
38101
38137
  ]
38102
38138
  };
38103
38139
  }
38104
38140
  if (resultObj.polling_timeout) {
38105
- const userMsg = `Workflow still in progress (backend is still running). Call get_provisioning_status again with workflow_id "${workflow_id}" to continue polling.`;
38141
+ const rememberedHandle = rememberWorkflowHandle(resultObj.workflow_id) ?? workflowReference;
38142
+ const userMsg = `Workflow still in progress (backend is still running). Call get_provisioning_status again with workflow_handle "${rememberedHandle}" to continue polling.`;
38106
38143
  return {
38107
38144
  content: [
38108
38145
  { type: "text", text: userMsg },
38109
- { type: "text", text: JSON.stringify(sanitizeProvisioningToolResult(result)) }
38146
+ { type: "text", text: sanitizedProvisioningContent(result) }
38110
38147
  ]
38111
38148
  };
38112
38149
  }
38113
38150
  if (resultObj.reason === "browser_agent_stalled") {
38114
- const userMsg = `Provisioning appears stalled. You can retry provision_account, or keep polling get_provisioning_status with workflow_id "${workflow_id}".`;
38151
+ const rememberedHandle = rememberWorkflowHandle(resultObj.workflow_id) ?? workflowReference;
38152
+ const userMsg = `Provisioning appears stalled. You can retry provision_account, or keep polling get_provisioning_status with workflow_handle "${rememberedHandle}".`;
38115
38153
  return {
38116
38154
  content: [
38117
38155
  { type: "text", text: userMsg },
38118
- { type: "text", text: JSON.stringify(sanitizeProvisioningToolResult(result)) }
38156
+ { type: "text", text: sanitizedProvisioningContent(result) }
38119
38157
  ]
38120
38158
  };
38121
38159
  }
38122
38160
  return {
38123
- content: [{ type: "text", text: JSON.stringify(sanitizeProvisioningToolResult(result)) }]
38161
+ content: [{ type: "text", text: sanitizedProvisioningContent(result) }]
38124
38162
  };
38125
38163
  } catch (error2) {
38126
38164
  if (error2 instanceof BackendError) {
@@ -38129,20 +38167,20 @@ server.registerTool("get_provisioning_status", {
38129
38167
  reason: readBackendErrorReason(error2.payload) ?? "backend_error",
38130
38168
  retryable: error2.status >= 500 || error2.status === 429 || error2.status === 408,
38131
38169
  http_status: error2.status,
38132
- workflow_id
38170
+ workflow_handle: workflowReference
38133
38171
  };
38134
38172
  return {
38135
- content: [{ type: "text", text: JSON.stringify(sanitizeProvisioningToolResult(payload2)) }]
38173
+ content: [{ type: "text", text: sanitizedProvisioningContent(payload2) }]
38136
38174
  };
38137
38175
  }
38138
38176
  const payload = {
38139
38177
  status: "failed",
38140
38178
  reason: error2 instanceof Error ? error2.message : "unexpected_error",
38141
38179
  retryable: false,
38142
- workflow_id
38180
+ workflow_handle: workflowReference
38143
38181
  };
38144
38182
  return {
38145
- content: [{ type: "text", text: JSON.stringify(sanitizeProvisioningToolResult(payload)) }]
38183
+ content: [{ type: "text", text: sanitizedProvisioningContent(payload) }]
38146
38184
  };
38147
38185
  }
38148
38186
  });