dorkos 0.27.0 → 0.29.0

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/bin/cli.js CHANGED
@@ -14364,7 +14364,7 @@ var init_config_schema = __esm({
14364
14364
  "tunnel.passcodeHash",
14365
14365
  "tunnel.passcodeSalt"
14366
14366
  ];
14367
- ONBOARDING_STEPS = ["meet-dorkbot", "discovery", "pulse", "adapters"];
14367
+ ONBOARDING_STEPS = ["meet-dorkbot", "discovery", "tasks", "adapters"];
14368
14368
  OnboardingStepSchema = external_exports.enum(ONBOARDING_STEPS);
14369
14369
  OnboardingStateSchema = external_exports.object({
14370
14370
  completedSteps: external_exports.array(OnboardingStepSchema).default(() => []),
@@ -14382,8 +14382,9 @@ var init_config_schema = __esm({
14382
14382
  server: external_exports.object({
14383
14383
  port: external_exports.number().int().min(1024).max(65535).default(4242),
14384
14384
  cwd: external_exports.string().nullable().default(null),
14385
- boundary: external_exports.string().nullable().default(null)
14386
- }).default(() => ({ port: 4242, cwd: null, boundary: null })),
14385
+ boundary: external_exports.string().nullable().default(null),
14386
+ open: external_exports.boolean().default(true)
14387
+ }).default(() => ({ port: 4242, cwd: null, boundary: null, open: true })),
14387
14388
  tunnel: external_exports.object({
14388
14389
  enabled: external_exports.boolean().default(false),
14389
14390
  domain: external_exports.string().nullable().default(null),
@@ -14438,8 +14439,8 @@ var init_config_schema = __esm({
14438
14439
  relayTools: external_exports.boolean().default(true),
14439
14440
  meshTools: external_exports.boolean().default(true),
14440
14441
  adapterTools: external_exports.boolean().default(true),
14441
- pulseTools: external_exports.boolean().default(true)
14442
- }).default(() => ({ relayTools: true, meshTools: true, adapterTools: true, pulseTools: true })),
14442
+ tasksTools: external_exports.boolean().default(true)
14443
+ }).default(() => ({ relayTools: true, meshTools: true, adapterTools: true, tasksTools: true })),
14443
14444
  uploads: external_exports.object({
14444
14445
  maxFileSize: external_exports.number().int().positive().default(10 * 1024 * 1024),
14445
14446
  // 10MB
@@ -18780,7 +18781,7 @@ var require_main = __commonJS({
18780
18781
 
18781
18782
  // src/cli.ts
18782
18783
  import { parseArgs } from "node:util";
18783
- import os, { networkInterfaces } from "os";
18784
+ import os2, { networkInterfaces } from "os";
18784
18785
  import path4 from "path";
18785
18786
  import { fileURLToPath } from "url";
18786
18787
  import fs4 from "fs";
@@ -18877,7 +18878,165 @@ var cliEnvSchema = external_exports.object({
18877
18878
  });
18878
18879
  var env = cliEnvSchema.parse(process.env);
18879
18880
 
18881
+ // src/startup-diagnostics.ts
18882
+ import os from "os";
18883
+ var MIN_NODE_MAJOR = 20;
18884
+ function checkNodeVersion() {
18885
+ const major = parseInt(process.versions.node.split(".")[0], 10);
18886
+ if (major < MIN_NODE_MAJOR) {
18887
+ return {
18888
+ category: "node-version",
18889
+ headline: `Node.js ${process.versions.node} is not supported`,
18890
+ detail: `DorkOS requires Node.js ${MIN_NODE_MAJOR} or later. You are running ${process.versions.node}.`,
18891
+ fix: [
18892
+ `Upgrade Node.js to v${MIN_NODE_MAJOR}+ (LTS recommended):`,
18893
+ ` nvm install --lts # if using nvm`,
18894
+ ` brew install node # if using Homebrew`,
18895
+ ` https://nodejs.org # manual download`
18896
+ ].join("\n")
18897
+ };
18898
+ }
18899
+ return null;
18900
+ }
18901
+ function diagnoseStartupError(err) {
18902
+ const msg = err instanceof Error ? err.message : String(err);
18903
+ const code = err?.code;
18904
+ if (msg.includes("does not provide an export named") || msg.includes("is not a function") || msg.includes("Cannot find module") && msg.includes("claude-agent-sdk")) {
18905
+ const missingExport = msg.match(/export named '(\w+)'/)?.[1];
18906
+ return {
18907
+ category: "sdk-mismatch",
18908
+ headline: "Claude Agent SDK version mismatch",
18909
+ detail: missingExport ? `This version of DorkOS requires a newer Claude Agent SDK (missing export: ${missingExport}).` : `The installed Claude Agent SDK is incompatible with this version of DorkOS.`,
18910
+ fix: [
18911
+ "Update DorkOS and the SDK together:",
18912
+ " npm install -g dorkos@latest",
18913
+ "",
18914
+ "If you installed from source:",
18915
+ " pnpm install # updates all workspace dependencies"
18916
+ ].join("\n")
18917
+ };
18918
+ }
18919
+ if (code === "MODULE_NOT_FOUND" || msg.includes("Cannot find module")) {
18920
+ const modMatch = msg.match(/Cannot find module '([^']+)'/);
18921
+ const modName = modMatch?.[1] ?? "unknown";
18922
+ return {
18923
+ category: "module-not-found",
18924
+ headline: `Missing dependency: ${modName}`,
18925
+ detail: `A required module could not be found. This usually means a partial install or corrupted node_modules.`,
18926
+ fix: [
18927
+ "Reinstall DorkOS:",
18928
+ " npm install -g dorkos@latest",
18929
+ "",
18930
+ "Or clear the cache and retry:",
18931
+ " npm cache clean --force && npm install -g dorkos"
18932
+ ].join("\n")
18933
+ };
18934
+ }
18935
+ if (code === "EADDRINUSE") {
18936
+ const portMatch = msg.match(/(?:port\s+)?(\d{4,5})/i);
18937
+ const port2 = portMatch?.[1] ?? process.env.DORKOS_PORT ?? "4242";
18938
+ return {
18939
+ category: "port-conflict",
18940
+ headline: `Port ${port2} is already in use`,
18941
+ detail: `Another process is listening on port ${port2}. This could be another DorkOS instance or a different application.`,
18942
+ fix: [
18943
+ "Find what is using the port:",
18944
+ ` lsof -i :${port2}`,
18945
+ "",
18946
+ "Kill it if safe:",
18947
+ ` kill $(lsof -ti :${port2})`,
18948
+ "",
18949
+ "Or start DorkOS on a different port:",
18950
+ ` dorkos --port ${parseInt(port2) + 1}`
18951
+ ].join("\n")
18952
+ };
18953
+ }
18954
+ if (code === "EACCES" || code === "EPERM") {
18955
+ const pathMatch = msg.match(/'([^']+)'/);
18956
+ const filePath = pathMatch?.[1] ?? "~/.dork";
18957
+ return {
18958
+ category: "permission-denied",
18959
+ headline: "Permission denied",
18960
+ detail: `Cannot access ${filePath}. The data directory may be owned by a different user or have restricted permissions.`,
18961
+ fix: [
18962
+ "Fix ownership of the DorkOS data directory:",
18963
+ ` sudo chown -R $(whoami) ~/.dork`,
18964
+ "",
18965
+ "Or check if another user is running DorkOS:",
18966
+ ` ls -la ~/.dork`
18967
+ ].join("\n")
18968
+ };
18969
+ }
18970
+ if (msg.includes("SQLITE") || msg.includes("database") || msg.includes("migration") || msg.includes("drizzle")) {
18971
+ return {
18972
+ category: "db-error",
18973
+ headline: "Database error",
18974
+ detail: `The DorkOS database at ~/.dork/dork.db may be corrupted or incompatible: ${msg}`,
18975
+ fix: [
18976
+ "Back up and recreate the database:",
18977
+ " mv ~/.dork/dork.db ~/.dork/dork.db.bak",
18978
+ " dorkos # will create a fresh database",
18979
+ "",
18980
+ "Your agents and config are stored separately and will not be lost."
18981
+ ].join("\n")
18982
+ };
18983
+ }
18984
+ if (msg.includes("config") && (msg.includes("JSON") || msg.includes("parse") || msg.includes("schema"))) {
18985
+ return {
18986
+ category: "config-error",
18987
+ headline: "Invalid configuration",
18988
+ detail: `The config file at ~/.dork/config.json could not be parsed: ${msg}`,
18989
+ fix: [
18990
+ "Validate the config:",
18991
+ " dorkos config validate",
18992
+ "",
18993
+ "Or reset to defaults:",
18994
+ " dorkos config reset",
18995
+ "",
18996
+ "A backup of your previous config may be at ~/.dork/config.json.bak"
18997
+ ].join("\n")
18998
+ };
18999
+ }
19000
+ return {
19001
+ category: "unknown",
19002
+ headline: "Startup failed",
19003
+ detail: msg,
19004
+ fix: [
19005
+ "Check the logs for details:",
19006
+ ` cat ~/.dork/logs/dorkos-${(/* @__PURE__ */ new Date()).toISOString().slice(0, 10)}.ndjson | tail -20`,
19007
+ "",
19008
+ "If this persists, please report the issue:",
19009
+ " https://github.com/doriancollier/dorkos/issues"
19010
+ ].join("\n")
19011
+ };
19012
+ }
19013
+ function formatDiagnostic(diag) {
19014
+ const red = "\x1B[31m";
19015
+ const yellow = "\x1B[33m";
19016
+ const dim = "\x1B[2m";
19017
+ const bold = "\x1B[1m";
19018
+ const reset = "\x1B[0m";
19019
+ const lines = [
19020
+ "",
19021
+ `${red}${bold}\u2716 ${diag.headline}${reset}`,
19022
+ "",
19023
+ `${dim}${diag.detail}${reset}`,
19024
+ "",
19025
+ `${yellow}${bold}How to fix:${reset}`,
19026
+ diag.fix,
19027
+ "",
19028
+ `${dim}Platform: ${os.platform()} ${os.arch()} | Node: ${process.versions.node}${reset}`,
19029
+ ""
19030
+ ];
19031
+ return lines.join("\n");
19032
+ }
19033
+
18880
19034
  // src/cli.ts
19035
+ var nodeVersionIssue = checkNodeVersion();
19036
+ if (nodeVersionIssue) {
19037
+ console.error(formatDiagnostic(nodeVersionIssue));
19038
+ process.exit(1);
19039
+ }
18881
19040
  var __dirname = path4.dirname(fileURLToPath(import.meta.url));
18882
19041
  var values;
18883
19042
  var positionals;
@@ -18888,14 +19047,16 @@ try {
18888
19047
  tunnel: { type: "boolean", short: "t", default: false },
18889
19048
  dir: { type: "string", short: "d" },
18890
19049
  boundary: { type: "string", short: "b" },
18891
- pulse: { type: "boolean" },
19050
+ tasks: { type: "boolean" },
19051
+ open: { type: "boolean" },
18892
19052
  "log-level": { type: "string", short: "l" },
18893
19053
  help: { type: "boolean", short: "h" },
18894
19054
  version: { type: "boolean", short: "v" },
18895
19055
  "post-install-check": { type: "boolean", default: false },
18896
19056
  yes: { type: "boolean", short: "y", default: false }
18897
19057
  },
18898
- allowPositionals: true
19058
+ allowPositionals: true,
19059
+ allowNegative: true
18899
19060
  }));
18900
19061
  } catch (err) {
18901
19062
  if (err instanceof TypeError && err.code === "ERR_PARSE_ARGS_UNKNOWN_OPTION") {
@@ -18931,8 +19092,9 @@ Options:
18931
19092
  -t, --tunnel Enable ngrok tunnel
18932
19093
  -d, --dir <path> Working directory (default: current directory)
18933
19094
  -b, --boundary <path> Directory boundary (default: home directory)
18934
- --pulse Enable Pulse scheduler
18935
- --no-pulse Disable Pulse scheduler
19095
+ --tasks Enable Tasks scheduler
19096
+ --no-tasks Disable Tasks scheduler
19097
+ --no-open Don't open browser on startup
18936
19098
  -l, --log-level <level> Log level (fatal|error|warn|info|debug|trace)
18937
19099
  --post-install-check Verify installation and exit
18938
19100
  -h, --help Show this help message
@@ -18955,16 +19117,16 @@ Examples:
18955
19117
  process.exit(0);
18956
19118
  }
18957
19119
  if (values.version) {
18958
- console.log("0.27.0");
19120
+ console.log("0.29.0");
18959
19121
  process.exit(0);
18960
19122
  }
18961
19123
  if (values["post-install-check"]) {
18962
19124
  checkClaude();
18963
- console.log(`dorkos ${"0.27.0"}`);
19125
+ console.log(`dorkos ${"0.29.0"}`);
18964
19126
  console.log("Installation verified.");
18965
19127
  process.exit(0);
18966
19128
  }
18967
- var DORK_HOME = env.DORK_HOME || path4.join(os.homedir(), ".dork");
19129
+ var DORK_HOME = env.DORK_HOME || path4.join(os2.homedir(), ".dork");
18968
19130
  var subcommand = positionals[0];
18969
19131
  if (subcommand === "cleanup") {
18970
19132
  const { runCleanup: runCleanup2 } = await Promise.resolve().then(() => (init_cleanup_command(), cleanup_command_exports));
@@ -19020,10 +19182,21 @@ var tunnelDomain = cfgMgr.getDot("tunnel.domain");
19020
19182
  if (tunnelDomain && !process.env.TUNNEL_DOMAIN) {
19021
19183
  process.env.TUNNEL_DOMAIN = tunnelDomain;
19022
19184
  }
19023
- if (values.pulse !== void 0) {
19024
- process.env.DORKOS_PULSE_ENABLED = values.pulse ? "true" : "false";
19025
- } else if (!process.env.DORKOS_PULSE_ENABLED && cfgMgr.getDot("scheduler.enabled")) {
19026
- process.env.DORKOS_PULSE_ENABLED = "true";
19185
+ if (values.tasks !== void 0) {
19186
+ process.env.DORKOS_TASKS_ENABLED = values.tasks ? "true" : "false";
19187
+ } else if (!process.env.DORKOS_TASKS_ENABLED && cfgMgr.getDot("scheduler.enabled")) {
19188
+ process.env.DORKOS_TASKS_ENABLED = "true";
19189
+ }
19190
+ var shouldOpenBrowser = true;
19191
+ if (values.open !== void 0) {
19192
+ shouldOpenBrowser = Boolean(values.open);
19193
+ } else if (process.env.DORKOS_OPEN !== void 0) {
19194
+ shouldOpenBrowser = process.env.DORKOS_OPEN !== "false" && process.env.DORKOS_OPEN !== "0";
19195
+ } else {
19196
+ const configOpen = cfgMgr.getDot("server.open");
19197
+ if (configOpen !== void 0 && configOpen !== null) {
19198
+ shouldOpenBrowser = Boolean(configOpen);
19199
+ }
19027
19200
  }
19028
19201
  if (!process.env.DORKOS_RELAY_ENABLED && cfgMgr.getDot("relay.enabled")) {
19029
19202
  process.env.DORKOS_RELAY_ENABLED = "true";
@@ -19045,7 +19218,7 @@ if (cliBoundary) {
19045
19218
  }
19046
19219
  }
19047
19220
  var boundaryVal = process.env.DORKOS_BOUNDARY;
19048
- var home = os.homedir();
19221
+ var home = os2.homedir();
19049
19222
  if (boundaryVal && !boundaryVal.startsWith(home + path4.sep) && boundaryVal !== home) {
19050
19223
  console.warn(
19051
19224
  `[Warning] Directory boundary "${boundaryVal}" is above home directory "${home}". This grants access to system directories.`
@@ -19066,11 +19239,17 @@ if (fs4.existsSync(envPath)) {
19066
19239
  const dotenv = await import("dotenv");
19067
19240
  dotenv.config({ path: envPath, override: false });
19068
19241
  }
19069
- await import("../server/index.js");
19242
+ try {
19243
+ await import("../server/index.js");
19244
+ } catch (err) {
19245
+ const diag = diagnoseStartupError(err);
19246
+ console.error(formatDiagnostic(diag));
19247
+ process.exit(1);
19248
+ }
19070
19249
  var port = process.env.DORKOS_PORT || String(DEFAULT_PORT);
19071
19250
  var localUrl = `http://localhost:${port}`;
19072
19251
  console.log("");
19073
- console.log(` DorkOS v${"0.27.0"}`);
19252
+ console.log(` DorkOS v${"0.29.0"}`);
19074
19253
  console.log(` Local: ${link(localUrl, localUrl)}`);
19075
19254
  var nets = networkInterfaces();
19076
19255
  var networkUrl = null;
@@ -19105,20 +19284,10 @@ if (process.env.TUNNEL_ENABLED) {
19105
19284
  }
19106
19285
  }
19107
19286
  console.log("");
19108
- if (process.stdin.isTTY) {
19109
- const { confirm: confirm3 } = await import("@inquirer/prompts");
19110
- try {
19111
- const shouldOpen = await confirm3({
19112
- message: "Open DorkOS in your browser?",
19113
- default: true
19114
- });
19115
- if (shouldOpen) {
19116
- const { exec } = await import("node:child_process");
19117
- const openCmd = process.platform === "darwin" ? "open" : process.platform === "win32" ? "start" : "xdg-open";
19118
- exec(`${openCmd} ${localUrl}`);
19119
- }
19120
- } catch {
19121
- }
19287
+ if (shouldOpenBrowser && process.stdin.isTTY) {
19288
+ const { exec } = await import("node:child_process");
19289
+ const openCmd = process.platform === "darwin" ? "open" : process.platform === "win32" ? "start" : "xdg-open";
19290
+ exec(`${openCmd} ${localUrl}`);
19122
19291
  }
19123
19292
  {
19124
19293
  const { tunnelManager: tunnelManager2 } = await Promise.resolve().then(() => (init_tunnel_manager(), tunnel_manager_exports));
@@ -19141,9 +19310,9 @@ if (process.stdin.isTTY) {
19141
19310
  }
19142
19311
  });
19143
19312
  }
19144
- checkForUpdate("0.27.0").then((latestVersion) => {
19313
+ checkForUpdate("0.29.0").then((latestVersion) => {
19145
19314
  if (latestVersion) {
19146
- const msg = `Update available: ${"0.27.0"} \u2192 ${latestVersion}`;
19315
+ const msg = `Update available: ${"0.29.0"} \u2192 ${latestVersion}`;
19147
19316
  const cmd = "Run npm install -g dorkos@latest to update";
19148
19317
  const width = Math.max(msg.length, cmd.length) + 6;
19149
19318
  const pad = (s2) => `\u2502 ${s2}${" ".repeat(width - s2.length - 6)} \u2502`;