@keysync/cli 0.1.135 → 0.1.136

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # KeySync CLI
2
2
 
3
- KeySync CLI 0.1.135 synchronizes supported AI application configuration on macOS, Windows, and Linux.
3
+ KeySync CLI 0.1.136 synchronizes supported AI application configuration on macOS, Windows, and Linux.
4
4
 
5
5
  ## Requirements
6
6
 
@@ -17012,7 +17012,7 @@ var require_diagnostic_sanitize = __commonJS({
17012
17012
  var MAX_KEY_LENGTH = 64;
17013
17013
  var MAX_PAYLOAD_BYTES = 48 * 1024;
17014
17014
  function sanitizeDiagnosticText2(value) {
17015
- return String(value ?? "").replace(/\bBearer\s+[A-Za-z0-9._~+/=-]+/gi, "Bearer [REDACTED]").replace(/\bsk-[A-Za-z0-9_-]{4,}\b/gi, "[REDACTED]").replace(/((?:password|token|secret|api[_-]?key|authorization|cookie|private[_-]?key|recovery[_-]?key)\s*[:=]\s*)[^,\s}]+/gi, "$1[REDACTED]").replace(USER_PATH, "[REDACTED_USER_DIR]").slice(0, 4096);
17015
+ return String(value ?? "").replace(/\bBearer\s+[A-Za-z0-9._~+/=-]+/gi, "Bearer [REDACTED]").replace(/\bsk-[A-Za-z0-9_-]{4,}\b/gi, "[REDACTED]").replace(/((?:password|token|secret|api[_-]?key|authorization|cookie|private[_-]?key|recovery[_-]?key)\\*["']\s*:\s*)[^\r\n]*/gi, "$1[REDACTED]").replace(/(--[A-Za-z0-9_-]*?(?:password|token|secret|api[_-]?key|authorization|cookie|private[_-]?key|recovery[_-]?key)\s+)[^\r\n]*/gi, "$1[REDACTED]").replace(/((?:password|token|secret|api[_-]?key|authorization|cookie|private[_-]?key|recovery[_-]?key)\s*[:=]\s*)[^,\s}]+/gi, "$1[REDACTED]").replace(USER_PATH, "[REDACTED_USER_DIR]").slice(0, 4096);
17016
17016
  }
17017
17017
  function boundedUtf8(value, state) {
17018
17018
  const text = sanitizeDiagnosticText2(value);
@@ -75118,7 +75118,7 @@ var KeySyncApiClient = class {
75118
75118
  });
75119
75119
  } catch (error) {
75120
75120
  const apiError = controller?.signal.aborted ? new ApiError(0, "REQUEST_TIMEOUT", `Request timed out after ${timeoutMs}ms`) : new ApiError(0, "NETWORK_ERROR", "Cannot reach the backend server");
75121
- notifyApiFailure({ method, path: diagnosticPath(path), status: apiError.status, code: apiError.code, message: apiError.message, failure_stage: "request" });
75121
+ if (requestOptions.reportFailure !== false) notifyApiFailure({ method, path: diagnosticPath(path), status: apiError.status, code: apiError.code, message: apiError.message, failure_stage: "request" });
75122
75122
  throw apiError;
75123
75123
  } finally {
75124
75124
  if (timeout) clearTimeout(timeout);
@@ -75131,19 +75131,19 @@ var KeySyncApiClient = class {
75131
75131
  } catch {
75132
75132
  if (response.ok) {
75133
75133
  const apiError = new ApiError(response.status, "RESPONSE_PARSE_ERROR", "Backend returned an invalid JSON response");
75134
- notifyApiFailure({ method, path: diagnosticPath(path), status: apiError.status, code: apiError.code, message: apiError.message, failure_stage: "response_parse" });
75134
+ if (requestOptions.reportFailure !== false) notifyApiFailure({ method, path: diagnosticPath(path), status: apiError.status, code: apiError.code, message: apiError.message, failure_stage: "response_parse" });
75135
75135
  throw apiError;
75136
75136
  }
75137
75137
  }
75138
75138
  } else if (response.ok && response.status !== 204) {
75139
75139
  const apiError = new ApiError(response.status, "RESPONSE_PARSE_ERROR", "Backend returned an empty response");
75140
- notifyApiFailure({ method, path: diagnosticPath(path), status: apiError.status, code: apiError.code, message: apiError.message, failure_stage: "response_parse" });
75140
+ if (requestOptions.reportFailure !== false) notifyApiFailure({ method, path: diagnosticPath(path), status: apiError.status, code: apiError.code, message: apiError.message, failure_stage: "response_parse" });
75141
75141
  throw apiError;
75142
75142
  }
75143
75143
  if (!response.ok) {
75144
75144
  const message = payload.error?.message?.trim() || payload.message?.trim() || response.statusText.trim() || `HTTP ${response.status}`;
75145
75145
  const apiError = new ApiError(response.status, payload.error?.code ?? "HTTP_ERROR", message, payload.error?.details);
75146
- notifyApiFailure({ method, path: diagnosticPath(path), status: apiError.status, code: apiError.code, message: apiError.message, failure_stage: "response" });
75146
+ if (requestOptions.reportFailure !== false) notifyApiFailure({ method, path: diagnosticPath(path), status: apiError.status, code: apiError.code, message: apiError.message, failure_stage: "response" });
75147
75147
  throw apiError;
75148
75148
  }
75149
75149
  return payload.data;
@@ -94485,7 +94485,7 @@ async function syncAndApply(session, deviceId, stateDir = defaultStateDir(), opt
94485
94485
  }
94486
94486
 
94487
94487
  // keysync-cli-version:keysync-cli-package.json
94488
- var keysync_cli_package_default = { name: "@keysync/cli", version: "0.1.135" };
94488
+ var keysync_cli_package_default = { name: "@keysync/cli", version: "0.1.136" };
94489
94489
 
94490
94490
  // apps/cli/src/version.ts
94491
94491
  var overrideVersion = process.env.KEYSYNC_ALLOW_CLIENT_VERSION_OVERRIDE === "1" ? process.env.KEYSYNC_CLIENT_VERSION_OVERRIDE?.trim() : "";
@@ -96692,7 +96692,18 @@ async function main() {
96692
96692
  stopNow?.();
96693
96693
  });
96694
96694
  let dshRecoveryLoop = Promise.resolve();
96695
+ let dshStartupStage = "controller_create";
96696
+ const recordDshStartup = (status, stage, error) => {
96697
+ console.log(JSON.stringify({
96698
+ event: "dsh_host.startup",
96699
+ status,
96700
+ stage,
96701
+ daemon_pid: process.pid,
96702
+ ...error ? { error_name: error instanceof Error ? error.name : "Error", error_code: error instanceof ApiError ? error.code : error?.code ?? "DSH_HOST_START_FAILED" } : {}
96703
+ }));
96704
+ };
96695
96705
  try {
96706
+ recordDshStartup("started", dshStartupStage);
96696
96707
  dshHost = await createDshHostController({
96697
96708
  session,
96698
96709
  stateDir,
@@ -96703,6 +96714,8 @@ async function main() {
96703
96714
  process.env.KEYSYNC_DSH_HOME = dshHost.dshHome;
96704
96715
  process.env.KEYSYNC_DISCOVERY_HINTS_JSON = dshDiscoveryHintsJson(dshHost.accountRoot);
96705
96716
  const activeHost = dshHost;
96717
+ dshStartupStage = "pipe_bind";
96718
+ recordDshStartup("started", dshStartupStage);
96706
96719
  dshRpc = await startDshHostRpcServer(dshHostSocketPath(defaultStateRoot()), (method, params) => {
96707
96720
  if (method === "host.shutdown") {
96708
96721
  setTimeout(() => process.kill(process.pid, "SIGINT"), 0);
@@ -96710,7 +96723,11 @@ async function main() {
96710
96723
  }
96711
96724
  return activeHost.dispatch(method, params);
96712
96725
  });
96726
+ dshStartupStage = "restore";
96727
+ recordDshStartup("started", dshStartupStage);
96713
96728
  await dshHost.restore();
96729
+ dshStartupStage = "ready";
96730
+ recordDshStartup("ready", dshStartupStage);
96714
96731
  dshRecoveryLoop = (async () => {
96715
96732
  while (!stopped) {
96716
96733
  await Promise.race([sleep3(1e3), stopPromise]);
@@ -96727,6 +96744,9 @@ async function main() {
96727
96744
  await runTick();
96728
96745
  await Promise.race([sleep3(Math.max(1, intervalSeconds) * 1e3), stopPromise]);
96729
96746
  } while (!stopped);
96747
+ } catch (error) {
96748
+ if (dshStartupStage !== "ready") recordDshStartup("failed", dshStartupStage, error);
96749
+ throw error;
96730
96750
  } finally {
96731
96751
  stopped = true;
96732
96752
  stopNow();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@keysync/cli",
3
- "version": "0.1.135",
3
+ "version": "0.1.136",
4
4
  "description": "KeySync cross-platform CLI and daemon",
5
5
  "license": "MIT",
6
6
  "type": "module",