@hasna/computer 0.1.12 → 0.1.13

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/cli/index.js CHANGED
@@ -993,7 +993,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
993
993
  this._exitCallback = (err) => {
994
994
  if (err.code !== "commander.executeSubCommandAsync") {
995
995
  throw err;
996
- }
996
+ } else {}
997
997
  };
998
998
  }
999
999
  return this;
@@ -17260,7 +17260,7 @@ function screenshotsMatch(prev, curr, threshold = 0.98) {
17260
17260
  // src/db/index.ts
17261
17261
  import { Database } from "bun:sqlite";
17262
17262
  import { join as join6 } from "path";
17263
- import { mkdirSync as mkdirSync2 } from "fs";
17263
+ import { cpSync, existsSync as existsSync4, mkdirSync as mkdirSync2, statSync } from "fs";
17264
17264
  import { homedir as homedir2 } from "os";
17265
17265
  var SERVICE_NAME = "computer";
17266
17266
  function getDataDir(service = SERVICE_NAME) {
@@ -17270,9 +17270,25 @@ function getDataDir(service = SERVICE_NAME) {
17270
17270
  }
17271
17271
  const home = process.env["HOME"] || process.env["USERPROFILE"] || homedir2();
17272
17272
  const dir = join6(home, ".hasna", service);
17273
+ migrateLegacyDataDir(home, service, dir);
17273
17274
  mkdirSync2(dir, { recursive: true });
17274
17275
  return dir;
17275
17276
  }
17277
+ function migrateLegacyDataDir(home, service, targetDir) {
17278
+ if (service !== SERVICE_NAME || existsSync4(targetDir))
17279
+ return;
17280
+ for (const legacyDir of [join6(home, ".open-computer"), join6(home, ".computer")]) {
17281
+ if (!existsSync4(legacyDir))
17282
+ continue;
17283
+ try {
17284
+ if (!statSync(legacyDir).isDirectory())
17285
+ continue;
17286
+ mkdirSync2(join6(home, ".hasna"), { recursive: true });
17287
+ cpSync(legacyDir, targetDir, { recursive: true, force: false });
17288
+ return;
17289
+ } catch {}
17290
+ }
17291
+ }
17276
17292
  function getDbPath(service = SERVICE_NAME) {
17277
17293
  if (service === SERVICE_NAME && process.env["COMPUTER_DB_PATH"]) {
17278
17294
  mkdirSync2(join6(process.env["COMPUTER_DB_PATH"], ".."), { recursive: true });
@@ -18279,7 +18295,7 @@ function renderKitty(base64, width, height) {
18279
18295
  }
18280
18296
 
18281
18297
  // src/apps/ghostty/driver.ts
18282
- import { existsSync as existsSync4 } from "fs";
18298
+ import { existsSync as existsSync5 } from "fs";
18283
18299
 
18284
18300
  // src/apps/ghostty/applescript.ts
18285
18301
  function parseGrid(spec) {
@@ -18382,7 +18398,7 @@ function ghosttyAvailability(env = {}) {
18382
18398
  if (platform !== "darwin") {
18383
18399
  return { available: false, reason: "Ghostty orchestration requires macOS (AppleScript)" };
18384
18400
  }
18385
- const hasAppBundle = env.hasAppBundle ?? existsSync4(APP_BUNDLE);
18401
+ const hasAppBundle = env.hasAppBundle ?? existsSync5(APP_BUNDLE);
18386
18402
  const hasBinary = env.hasBinary ?? Bun.which("ghostty") !== null;
18387
18403
  if (!hasAppBundle && !hasBinary) {
18388
18404
  return { available: false, reason: `Ghostty not found (${APP_BUNDLE} missing and no \`ghostty\` on PATH)` };
@@ -18834,14 +18850,14 @@ program2.command("headless").description("Check headless mode status and availab
18834
18850
  program2.command("record").description("Record mouse/keyboard events as a replayable macro").option("-d, --duration <seconds>", "Max recording duration in seconds", "60").option("-o, --output <file>", "Save recording to JSON file").action(async (opts) => {
18835
18851
  const { join: join7, dirname: dirname2 } = await import("path");
18836
18852
  const { fileURLToPath: fileURLToPath2 } = await import("url");
18837
- const { existsSync: existsSync5, writeFileSync: writeFileSync2 } = await import("fs");
18853
+ const { existsSync: existsSync6, writeFileSync: writeFileSync2 } = await import("fs");
18838
18854
  const __dirname2 = dirname2(fileURLToPath2(import.meta.url));
18839
18855
  const candidates = [
18840
18856
  join7(__dirname2, "..", "..", "helpers", "record"),
18841
18857
  join7(__dirname2, "..", "helpers", "record"),
18842
18858
  join7(process.env.HOME ?? "~", ".hasna", "computer", "helpers", "record")
18843
18859
  ];
18844
- const helperPath = candidates.find((c) => existsSync5(c));
18860
+ const helperPath = candidates.find((c) => existsSync6(c));
18845
18861
  if (!helperPath) {
18846
18862
  console.log(chalk.red("Record helper not found. Run: swiftc helpers/record.swift -o helpers/record -framework CoreGraphics"));
18847
18863
  process.exit(1);
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/db/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAIzF,MAAM,WAAW,SAAS;IACxB,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG;QACpB,GAAG,CAAC,GAAG,MAAM,EAAE,OAAO,EAAE,GAAG;YAAE,OAAO,EAAE,MAAM,CAAC;YAAC,eAAe,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;SAAE,CAAC;QAClF,GAAG,CAAC,GAAG,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;QACnC,GAAG,CAAC,GAAG,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,EAAE,CAAC;KACtC,CAAC;IACF,KAAK,IAAI,IAAI,CAAC;CACf;AAED,wBAAgB,UAAU,CAAC,OAAO,SAAe,GAAG,MAAM,CASzD;AAED,wBAAgB,SAAS,CAAC,OAAO,SAAe,GAAG,MAAM,CAMxD;AAID,+CAA+C;AAC/C,wBAAgB,KAAK,IAAI,SAAS,CA6EjC;AAED,2BAA2B;AAC3B,wBAAsB,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAoBnE;AAED,uBAAuB;AACvB,wBAAsB,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAgBnE;AAED,qCAAqC;AACrC,wBAAsB,SAAS,CAAC,MAAM,EAAE;IACtC,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE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,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,GAAG,OAAO,CAAC,IAAI,CAAC,CAkBhB;AAED,0BAA0B;AAC1B,wBAAgB,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,GAAG,IAAI,CAKrD;AAED,oBAAoB;AACpB,wBAAgB,YAAY,CAAC,IAAI,CAAC,EAAE;IAClC,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,GAAG,OAAO,EAAE,CA8BZ;AAED,0CAA0C;AAC1C,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,GAAE,MAAW,GAAG,OAAO,EAAE,CAU3E;AAED,kDAAkD;AAClD,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,MAAM,EACb,KAAK,GAAE,MAAW,GACjB,SAAS,EAAE,CAuBb;AAED,oCAAoC;AACpC,wBAAgB,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,EAAE,CAoB5D;AAED,oCAAoC;AACpC,wBAAgB,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAKjD;AAED,wBAAwB;AACxB,wBAAgB,QAAQ,IAAI;IAC1B,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;CACtB,CAmBA"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.test.d.ts","sourceRoot":"","sources":["../../src/db/index.test.ts"],"names":[],"mappings":""}
package/dist/index.js CHANGED
@@ -14442,7 +14442,7 @@ function screenshotsMatch(prev, curr, threshold = 0.98) {
14442
14442
  // src/db/index.ts
14443
14443
  import { Database } from "bun:sqlite";
14444
14444
  import { join as join5 } from "path";
14445
- import { mkdirSync as mkdirSync2 } from "fs";
14445
+ import { cpSync, existsSync as existsSync3, mkdirSync as mkdirSync2, statSync } from "fs";
14446
14446
  import { homedir } from "os";
14447
14447
  var SERVICE_NAME = "computer";
14448
14448
  function getDataDir(service = SERVICE_NAME) {
@@ -14452,9 +14452,25 @@ function getDataDir(service = SERVICE_NAME) {
14452
14452
  }
14453
14453
  const home = process.env["HOME"] || process.env["USERPROFILE"] || homedir();
14454
14454
  const dir = join5(home, ".hasna", service);
14455
+ migrateLegacyDataDir(home, service, dir);
14455
14456
  mkdirSync2(dir, { recursive: true });
14456
14457
  return dir;
14457
14458
  }
14459
+ function migrateLegacyDataDir(home, service, targetDir) {
14460
+ if (service !== SERVICE_NAME || existsSync3(targetDir))
14461
+ return;
14462
+ for (const legacyDir of [join5(home, ".open-computer"), join5(home, ".computer")]) {
14463
+ if (!existsSync3(legacyDir))
14464
+ continue;
14465
+ try {
14466
+ if (!statSync(legacyDir).isDirectory())
14467
+ continue;
14468
+ mkdirSync2(join5(home, ".hasna"), { recursive: true });
14469
+ cpSync(legacyDir, targetDir, { recursive: true, force: false });
14470
+ return;
14471
+ } catch {}
14472
+ }
14473
+ }
14458
14474
  function getDbPath(service = SERVICE_NAME) {
14459
14475
  if (service === SERVICE_NAME && process.env["COMPUTER_DB_PATH"]) {
14460
14476
  mkdirSync2(join5(process.env["COMPUTER_DB_PATH"], ".."), { recursive: true });
@@ -15006,7 +15022,7 @@ async function getHeadlessStatus() {
15006
15022
  }
15007
15023
  // src/drivers/mac/accessibility.ts
15008
15024
  import { join as join6, dirname as dirname2 } from "path";
15009
- import { existsSync as existsSync3 } from "fs";
15025
+ import { existsSync as existsSync4 } from "fs";
15010
15026
  import { fileURLToPath as fileURLToPath2 } from "url";
15011
15027
  async function queryAccessibilityTree(opts) {
15012
15028
  const helperPath = getAccessibilityHelperPath();
@@ -15072,7 +15088,7 @@ function getAccessibilityHelperPath() {
15072
15088
  join6(process.env.HOME ?? "~", ".hasna", "computer", "helpers", "accessibility")
15073
15089
  ];
15074
15090
  for (const candidate of candidates) {
15075
- if (existsSync3(candidate)) {
15091
+ if (existsSync4(candidate)) {
15076
15092
  _helperPath = candidate;
15077
15093
  return candidate;
15078
15094
  }
package/dist/mcp/index.js CHANGED
@@ -18384,7 +18384,7 @@ function screenshotsMatch(prev, curr, threshold = 0.98) {
18384
18384
  // src/db/index.ts
18385
18385
  import { Database } from "bun:sqlite";
18386
18386
  import { join as join5 } from "path";
18387
- import { mkdirSync as mkdirSync2 } from "fs";
18387
+ import { cpSync, existsSync as existsSync3, mkdirSync as mkdirSync2, statSync } from "fs";
18388
18388
  import { homedir } from "os";
18389
18389
  var SERVICE_NAME = "computer";
18390
18390
  function getDataDir(service = SERVICE_NAME) {
@@ -18394,9 +18394,25 @@ function getDataDir(service = SERVICE_NAME) {
18394
18394
  }
18395
18395
  const home = process.env["HOME"] || process.env["USERPROFILE"] || homedir();
18396
18396
  const dir = join5(home, ".hasna", service);
18397
+ migrateLegacyDataDir(home, service, dir);
18397
18398
  mkdirSync2(dir, { recursive: true });
18398
18399
  return dir;
18399
18400
  }
18401
+ function migrateLegacyDataDir(home, service, targetDir) {
18402
+ if (service !== SERVICE_NAME || existsSync3(targetDir))
18403
+ return;
18404
+ for (const legacyDir of [join5(home, ".open-computer"), join5(home, ".computer")]) {
18405
+ if (!existsSync3(legacyDir))
18406
+ continue;
18407
+ try {
18408
+ if (!statSync(legacyDir).isDirectory())
18409
+ continue;
18410
+ mkdirSync2(join5(home, ".hasna"), { recursive: true });
18411
+ cpSync(legacyDir, targetDir, { recursive: true, force: false });
18412
+ return;
18413
+ } catch {}
18414
+ }
18415
+ }
18400
18416
  function getDbPath(service = SERVICE_NAME) {
18401
18417
  if (service === SERVICE_NAME && process.env["COMPUTER_DB_PATH"]) {
18402
18418
  mkdirSync2(join5(process.env["COMPUTER_DB_PATH"], ".."), { recursive: true });
@@ -18983,7 +18999,7 @@ function rowToAgent(row) {
18983
18999
 
18984
19000
  // src/drivers/mac/accessibility.ts
18985
19001
  import { join as join6, dirname as dirname2 } from "path";
18986
- import { existsSync as existsSync3 } from "fs";
19002
+ import { existsSync as existsSync4 } from "fs";
18987
19003
  import { fileURLToPath as fileURLToPath2 } from "url";
18988
19004
  async function queryAccessibilityTree(opts) {
18989
19005
  const helperPath = getAccessibilityHelperPath();
@@ -19049,7 +19065,7 @@ function getAccessibilityHelperPath() {
19049
19065
  join6(process.env.HOME ?? "~", ".hasna", "computer", "helpers", "accessibility")
19050
19066
  ];
19051
19067
  for (const candidate of candidates) {
19052
- if (existsSync3(candidate)) {
19068
+ if (existsSync4(candidate)) {
19053
19069
  _helperPath = candidate;
19054
19070
  return candidate;
19055
19071
  }
@@ -19058,7 +19074,7 @@ function getAccessibilityHelperPath() {
19058
19074
  }
19059
19075
 
19060
19076
  // src/apps/ghostty/driver.ts
19061
- import { existsSync as existsSync4 } from "fs";
19077
+ import { existsSync as existsSync5 } from "fs";
19062
19078
 
19063
19079
  // src/apps/ghostty/applescript.ts
19064
19080
  function parseGrid(spec) {
@@ -19161,7 +19177,7 @@ function ghosttyAvailability(env = {}) {
19161
19177
  if (platform !== "darwin") {
19162
19178
  return { available: false, reason: "Ghostty orchestration requires macOS (AppleScript)" };
19163
19179
  }
19164
- const hasAppBundle = env.hasAppBundle ?? existsSync4(APP_BUNDLE);
19180
+ const hasAppBundle = env.hasAppBundle ?? existsSync5(APP_BUNDLE);
19165
19181
  const hasBinary = env.hasBinary ?? Bun.which("ghostty") !== null;
19166
19182
  if (!hasAppBundle && !hasBinary) {
19167
19183
  return { available: false, reason: `Ghostty not found (${APP_BUNDLE} missing and no \`ghostty\` on PATH)` };
@@ -11391,7 +11391,7 @@ var require_lib2 = __commonJS((exports, module) => {
11391
11391
  // src/server/index.ts
11392
11392
  import { join as join7, dirname as dirname3 } from "path";
11393
11393
  import { fileURLToPath as fileURLToPath3 } from "url";
11394
- import { existsSync as existsSync5 } from "fs";
11394
+ import { existsSync as existsSync6 } from "fs";
11395
11395
 
11396
11396
  // src/agent/loop.ts
11397
11397
  import { randomUUID } from "crypto";
@@ -20882,7 +20882,7 @@ function screenshotsMatch(prev, curr, threshold = 0.98) {
20882
20882
  // src/db/index.ts
20883
20883
  import { Database } from "bun:sqlite";
20884
20884
  import { join as join5 } from "path";
20885
- import { mkdirSync as mkdirSync2 } from "fs";
20885
+ import { cpSync, existsSync as existsSync3, mkdirSync as mkdirSync2, statSync } from "fs";
20886
20886
  import { homedir } from "os";
20887
20887
  var SERVICE_NAME = "computer";
20888
20888
  function getDataDir(service = SERVICE_NAME) {
@@ -20892,9 +20892,25 @@ function getDataDir(service = SERVICE_NAME) {
20892
20892
  }
20893
20893
  const home = process.env["HOME"] || process.env["USERPROFILE"] || homedir();
20894
20894
  const dir = join5(home, ".hasna", service);
20895
+ migrateLegacyDataDir(home, service, dir);
20895
20896
  mkdirSync2(dir, { recursive: true });
20896
20897
  return dir;
20897
20898
  }
20899
+ function migrateLegacyDataDir(home, service, targetDir) {
20900
+ if (service !== SERVICE_NAME || existsSync3(targetDir))
20901
+ return;
20902
+ for (const legacyDir of [join5(home, ".open-computer"), join5(home, ".computer")]) {
20903
+ if (!existsSync3(legacyDir))
20904
+ continue;
20905
+ try {
20906
+ if (!statSync(legacyDir).isDirectory())
20907
+ continue;
20908
+ mkdirSync2(join5(home, ".hasna"), { recursive: true });
20909
+ cpSync(legacyDir, targetDir, { recursive: true, force: false });
20910
+ return;
20911
+ } catch {}
20912
+ }
20913
+ }
20898
20914
  function getDbPath(service = SERVICE_NAME) {
20899
20915
  if (service === SERVICE_NAME && process.env["COMPUTER_DB_PATH"]) {
20900
20916
  mkdirSync2(join5(process.env["COMPUTER_DB_PATH"], ".."), { recursive: true });
@@ -24732,7 +24748,7 @@ class JSONSchemaGenerator {
24732
24748
  if (val === undefined) {
24733
24749
  if (this.unrepresentable === "throw") {
24734
24750
  throw new Error("Literal `undefined` cannot be represented in JSON Schema");
24735
- }
24751
+ } else {}
24736
24752
  } else if (typeof val === "bigint") {
24737
24753
  if (this.unrepresentable === "throw") {
24738
24754
  throw new Error("BigInt literals cannot be represented in JSON Schema");
@@ -34893,7 +34909,7 @@ function rowToAgent(row) {
34893
34909
 
34894
34910
  // src/drivers/mac/accessibility.ts
34895
34911
  import { join as join6, dirname as dirname2 } from "path";
34896
- import { existsSync as existsSync3 } from "fs";
34912
+ import { existsSync as existsSync4 } from "fs";
34897
34913
  import { fileURLToPath as fileURLToPath2 } from "url";
34898
34914
  async function queryAccessibilityTree(opts) {
34899
34915
  const helperPath = getAccessibilityHelperPath();
@@ -34959,7 +34975,7 @@ function getAccessibilityHelperPath() {
34959
34975
  join6(process.env.HOME ?? "~", ".hasna", "computer", "helpers", "accessibility")
34960
34976
  ];
34961
34977
  for (const candidate of candidates) {
34962
- if (existsSync3(candidate)) {
34978
+ if (existsSync4(candidate)) {
34963
34979
  _helperPath = candidate;
34964
34980
  return candidate;
34965
34981
  }
@@ -34968,7 +34984,7 @@ function getAccessibilityHelperPath() {
34968
34984
  }
34969
34985
 
34970
34986
  // src/apps/ghostty/driver.ts
34971
- import { existsSync as existsSync4 } from "fs";
34987
+ import { existsSync as existsSync5 } from "fs";
34972
34988
 
34973
34989
  // src/apps/ghostty/applescript.ts
34974
34990
  function parseGrid(spec) {
@@ -35071,7 +35087,7 @@ function ghosttyAvailability(env = {}) {
35071
35087
  if (platform !== "darwin") {
35072
35088
  return { available: false, reason: "Ghostty orchestration requires macOS (AppleScript)" };
35073
35089
  }
35074
- const hasAppBundle = env.hasAppBundle ?? existsSync4(APP_BUNDLE);
35090
+ const hasAppBundle = env.hasAppBundle ?? existsSync5(APP_BUNDLE);
35075
35091
  const hasBinary = env.hasBinary ?? Bun.which("ghostty") !== null;
35076
35092
  if (!hasAppBundle && !hasBinary) {
35077
35093
  return { available: false, reason: `Ghostty not found (${APP_BUNDLE} missing and no \`ghostty\` on PATH)` };
@@ -35808,7 +35824,7 @@ var DASHBOARD_DIRS = [
35808
35824
  join7(__dirname2, "..", "..", "dashboard", "dist"),
35809
35825
  join7(__dirname2, "..", "dashboard", "dist")
35810
35826
  ];
35811
- var DASHBOARD_DIR = DASHBOARD_DIRS.find((d) => existsSync5(d));
35827
+ var DASHBOARD_DIR = DASHBOARD_DIRS.find((d) => existsSync6(d));
35812
35828
  var server = Bun.serve({
35813
35829
  port: PORT,
35814
35830
  async fetch(req) {
@@ -35887,7 +35903,7 @@ var server = Bun.serve({
35887
35903
  }
35888
35904
  const filePath = path.replace("/dashboard", "");
35889
35905
  const fullPath = join7(DASHBOARD_DIR, filePath);
35890
- if (existsSync5(fullPath)) {
35906
+ if (existsSync6(fullPath)) {
35891
35907
  return new Response(Bun.file(fullPath), { headers: { "Access-Control-Allow-Origin": "*" } });
35892
35908
  }
35893
35909
  return new Response(Bun.file(join7(DASHBOARD_DIR, "index.html")), {
package/dist/storage.js CHANGED
@@ -4905,7 +4905,7 @@ var require_lib2 = __commonJS((exports, module) => {
4905
4905
  // src/db/index.ts
4906
4906
  import { Database } from "bun:sqlite";
4907
4907
  import { join } from "path";
4908
- import { mkdirSync } from "fs";
4908
+ import { cpSync, existsSync, mkdirSync, statSync } from "fs";
4909
4909
  import { homedir } from "os";
4910
4910
  var SERVICE_NAME = "computer";
4911
4911
  function getDataDir(service = SERVICE_NAME) {
@@ -4915,9 +4915,25 @@ function getDataDir(service = SERVICE_NAME) {
4915
4915
  }
4916
4916
  const home = process.env["HOME"] || process.env["USERPROFILE"] || homedir();
4917
4917
  const dir = join(home, ".hasna", service);
4918
+ migrateLegacyDataDir(home, service, dir);
4918
4919
  mkdirSync(dir, { recursive: true });
4919
4920
  return dir;
4920
4921
  }
4922
+ function migrateLegacyDataDir(home, service, targetDir) {
4923
+ if (service !== SERVICE_NAME || existsSync(targetDir))
4924
+ return;
4925
+ for (const legacyDir of [join(home, ".open-computer"), join(home, ".computer")]) {
4926
+ if (!existsSync(legacyDir))
4927
+ continue;
4928
+ try {
4929
+ if (!statSync(legacyDir).isDirectory())
4930
+ continue;
4931
+ mkdirSync(join(home, ".hasna"), { recursive: true });
4932
+ cpSync(legacyDir, targetDir, { recursive: true, force: false });
4933
+ return;
4934
+ } catch {}
4935
+ }
4936
+ }
4921
4937
  function getDbPath(service = SERVICE_NAME) {
4922
4938
  if (service === SERVICE_NAME && process.env["COMPUTER_DB_PATH"]) {
4923
4939
  mkdirSync(join(process.env["COMPUTER_DB_PATH"], ".."), { recursive: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hasna/computer",
3
- "version": "0.1.12",
3
+ "version": "0.1.13",
4
4
  "description": "Open-source computer use for AI agents — control your Mac with Anthropic or OpenAI. CLI + MCP server + REST API + Dashboard.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",