anywhere-ai 0.0.34 → 0.0.36

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.js CHANGED
@@ -17,11 +17,11 @@ var STATUS_PATH = path.join(ANYWHERE_DIR, "status.json");
17
17
  var args = process.argv.slice(2);
18
18
  var command = args.find((a) => !a.startsWith("-"));
19
19
  if (args.includes("--version") || args.includes("-v")) {
20
- console.log(`anywhere-ai v${"0.0.34"}`);
20
+ console.log(`anywhere-ai v${"0.0.36"}`);
21
21
  process.exit(0);
22
22
  }
23
23
  if (args.includes("--help") || args.includes("-h") || command === "help") {
24
- console.log(`anywhere-ai v${"0.0.34"} \u2014 Mobile coding agent
24
+ console.log(`anywhere-ai v${"0.0.36"} \u2014 Mobile coding agent
25
25
 
26
26
  Usage: npx anywhere-ai [command] [options]
27
27
 
@@ -131,9 +131,9 @@ async function checkForUpdate() {
131
131
  try {
132
132
  const res = await fetch("https://registry.npmjs.org/anywhere-ai/latest", { signal: AbortSignal.timeout(3e3) });
133
133
  const data = await res.json();
134
- if (data.version && data.version !== "0.0.34") {
134
+ if (data.version && data.version !== "0.0.36") {
135
135
  console.log(`
136
- Update available: v${"0.0.34"} \u2192 v${data.version}`);
136
+ Update available: v${"0.0.36"} \u2192 v${data.version}`);
137
137
  console.log(` Run: npx anywhere-ai@latest
138
138
  `);
139
139
  }
package/dist/server.js CHANGED
@@ -693,14 +693,14 @@ chats.get("/", async (c) => {
693
693
  return c.json({ result: allChats });
694
694
  } catch (error) {
695
695
  console.error("[GET /chats] error:", error);
696
- return c.json({ result: [] });
696
+ return c.json({ error: "Failed to list chats" }, 500);
697
697
  }
698
698
  });
699
699
  chats.get("/:id", async (c) => {
700
700
  const sessionId = c.req.param("id");
701
701
  if (!sessionId || /[\/\\]/.test(sessionId))
702
702
  return c.json({ error: "Invalid session id" }, 400);
703
- const limit = Math.min(Math.max(parseInt(c.req.query("limit") || "30", 10) || 30, 1), 500);
703
+ const limit = Math.min(Math.max(parseInt(c.req.query("limit") || "50", 10) || 50, 1), 500);
704
704
  const offset = Math.max(parseInt(c.req.query("offset") || "0", 10) || 0, 0);
705
705
  try {
706
706
  const file = await findSessionFile(sessionId);
@@ -721,7 +721,13 @@ chats.get("/:id", async (c) => {
721
721
  } else {
722
722
  const content = await readFile2(file, "utf-8");
723
723
  const lines = content.split("\n").filter(Boolean);
724
- const parsed = lines.map((line) => JSON.parse(line));
724
+ const parsed = lines.flatMap((line) => {
725
+ try {
726
+ return [JSON.parse(line)];
727
+ } catch {
728
+ return [];
729
+ }
730
+ });
725
731
  for (const obj of parsed) {
726
732
  if (obj.type === "user" && obj.cwd && !cwd) cwd = obj.cwd;
727
733
  }
@@ -815,7 +821,7 @@ git.get("/status", async (c) => {
815
821
  try {
816
822
  const cwd = c.req.query("cwd");
817
823
  const root = await getRepoRoot(cwd);
818
- if (!root) return c.json({ files: [], error: "Not a git repository" });
824
+ if (!root) return c.json({ error: "Not a git repository" }, 400);
819
825
  const { stdout: statusOut } = await execAsync("git status --porcelain", {
820
826
  cwd: root
821
827
  });
@@ -882,7 +888,7 @@ git.get("/status", async (c) => {
882
888
  return c.json({ files });
883
889
  } catch (error) {
884
890
  console.error("git status error:", error);
885
- return c.json({ files: [] });
891
+ return c.json({ error: "Failed to get git status" }, 500);
886
892
  }
887
893
  });
888
894
  git.get("/diff", async (c) => {
@@ -974,7 +980,7 @@ gh.get("/repos", async (c) => {
974
980
  );
975
981
  return c.json({ username, repos: all });
976
982
  } catch (error) {
977
- return c.json([]);
983
+ return c.json({ error: "Failed to list repos" }, 500);
978
984
  }
979
985
  });
980
986
  gh.get("/pr", async (c) => {
@@ -1028,6 +1034,8 @@ app.use("/v1/*", bearerAuth({ token }));
1028
1034
  app.route("/v1/chats", chats);
1029
1035
  app.route("/v1/git", git);
1030
1036
  app.route("/v1/gh", gh);
1037
+ app.notFound((c) => c.json({ error: "Not found" }, 404));
1038
+ app.onError((err, c) => c.json({ error: err.message || "Internal server error" }, 500));
1031
1039
  serve(
1032
1040
  {
1033
1041
  fetch: app.fetch,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "anywhere-ai",
3
- "version": "0.0.34",
3
+ "version": "0.0.36",
4
4
  "type": "module",
5
5
  "description": "Code on any repo from your phone",
6
6
  "bin": {