@infomity/remogent 0.2.1 → 0.2.2

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.
Files changed (2) hide show
  1. package/dist/sessions.js +18 -1
  2. package/package.json +1 -1
package/dist/sessions.js CHANGED
@@ -1,7 +1,20 @@
1
- import { stat } from "node:fs/promises";
1
+ import { mkdir, stat } from "node:fs/promises";
2
+ import { join } from "node:path";
2
3
  import { randomBytes } from "node:crypto";
4
+ import { REMOGENT_DIR } from "./identity.js";
3
5
  import { ProtocolError, } from "./protocol.js";
4
6
  import { autoTitle, customTitle } from "./title.js";
7
+ /**
8
+ * Folder a chat starts in when the phone does not choose one (it sends "." or an empty string).
9
+ * Never the host process's own cwd: the autostart service runs from a system directory such as
10
+ * C:\Windows\System32, which is a poor (and for some CLIs, unusable) workspace.
11
+ */
12
+ export const DEFAULT_PROJECTS_DIR = join(REMOGENT_DIR, "projects");
13
+ /** "." / "" mean "host default"; any other value is used as given. */
14
+ export function isHostDefaultCwd(cwd) {
15
+ const c = cwd.trim();
16
+ return c === "" || c === ".";
17
+ }
5
18
  /** How long a model list is reused before the engine CLI is asked again. */
6
19
  const MODELS_TTL_MS = 10 * 60_000;
7
20
  const MAX_MODELS = 100;
@@ -223,6 +236,10 @@ export class SessionManager {
223
236
  if (!adapter)
224
237
  throw new ProtocolError("engine_unavailable", `engine "${engine}" is not available on this host`, reqId);
225
238
  try {
239
+ if (isHostDefaultCwd(cwd)) {
240
+ cwd = DEFAULT_PROJECTS_DIR;
241
+ await mkdir(cwd, { recursive: true });
242
+ }
226
243
  if (!(await stat(cwd)).isDirectory())
227
244
  throw new Error("not a directory");
228
245
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@infomity/remogent",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "Remogent host: drive Claude Code, Gemini CLI and Codex CLI on your PC from the Remogent Android app. No cloud relay, no account.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",