@kya-os/create-molti 0.1.0-canary.5 → 0.1.0-canary.7

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.
@@ -23,7 +23,7 @@ export async function ensureMoltbotGateway(
23
23
  env: Record<string, unknown>
24
24
  ): Promise<void> {
25
25
  // Check for existing process
26
- const processes = await sandbox.ps();
26
+ const processes = await sandbox.listProcesses();
27
27
  const existing = processes.find(
28
28
  (p: { command: string; status: string }) =>
29
29
  (p.command.includes("start-moltbot.sh") || p.command.includes("clawdbot gateway")) &&
@@ -39,7 +39,7 @@ export async function ensureMoltbotGateway(
39
39
  const envVars = buildEnvVars(env);
40
40
 
41
41
  // Start the moltbot process
42
- await sandbox.start("/usr/local/bin/start-moltbot.sh", {
42
+ await sandbox.startProcess("/usr/local/bin/start-moltbot.sh", {
43
43
  env: envVars,
44
44
  });
45
45
 
@@ -1 +1 @@
1
- {"version":3,"file":"health-module.d.ts","sourceRoot":"","sources":["../../src/templates/health-module.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,wBAAgB,oBAAoB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAuDhE"}
1
+ {"version":3,"file":"health-module.d.ts","sourceRoot":"","sources":["../../src/templates/health-module.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,wBAAgB,oBAAoB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAyDhE"}
@@ -33,7 +33,7 @@ publicRoutes.get("/api/status", async (c) => {
33
33
  const sandbox = c.get("sandbox");
34
34
 
35
35
  try {
36
- const processes = await sandbox.ps();
36
+ const processes = await sandbox.listProcesses();
37
37
  const moltbot = processes.find(
38
38
  (p: { command: string; status: string }) =>
39
39
  (p.command.includes("start-moltbot.sh") || p.command.includes("clawdbot gateway")) &&
@@ -47,13 +47,15 @@ publicRoutes.get("/api/status", async (c) => {
47
47
  did: c.env.MCP_IDENTITY_AGENT_DID,
48
48
  },
49
49
  gateway: moltbot
50
- ? { pid: moltbot.pid, status: moltbot.status }
50
+ ? { id: moltbot.id, pid: moltbot.pid, status: moltbot.status }
51
51
  : null,
52
52
  });
53
- } catch {
53
+ } catch (err) {
54
54
  return c.json({
55
55
  status: "unknown",
56
56
  service: "${projectName}",
57
+ error: err instanceof Error ? err.message : String(err),
58
+ stack: err instanceof Error ? err.stack : undefined,
57
59
  });
58
60
  }
59
61
  });
@@ -1 +1 @@
1
- {"version":3,"file":"health-module.js","sourceRoot":"","sources":["../../src/templates/health-module.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,UAAU,oBAAoB,CAAC,WAAmB;IACtD,OAAO;;;;;;;;;;;;;;;;;gBAiBO,WAAW;;;;;;;;;;;;;;;;;;;;;kBAqBT,WAAW;;;;;;;;;;;kBAWX,WAAW;;;;CAI5B,CAAC;AACF,CAAC"}
1
+ {"version":3,"file":"health-module.js","sourceRoot":"","sources":["../../src/templates/health-module.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,UAAU,oBAAoB,CAAC,WAAmB;IACtD,OAAO;;;;;;;;;;;;;;;;;gBAiBO,WAAW;;;;;;;;;;;;;;;;;;;;;kBAqBT,WAAW;;;;;;;;;;;kBAWX,WAAW;;;;;;CAM5B,CAAC;AACF,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"worker-index.d.ts","sourceRoot":"","sources":["../../src/templates/worker-index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CA2F/D"}
1
+ {"version":3,"file":"worker-index.d.ts","sourceRoot":"","sources":["../../src/templates/worker-index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAiG/D"}
@@ -49,8 +49,10 @@ app.all("*", async (c) => {
49
49
 
50
50
  try {
51
51
  await ensureMoltbotGateway(sandbox, c.env as unknown as MoltbotEnv);
52
- } catch {
53
- return c.html(loadingPage(), 503);
52
+ } catch (err) {
53
+ const errorMsg = err instanceof Error ? err.message : String(err);
54
+ console.error("[Moltworker] Gateway startup failed:", errorMsg, err instanceof Error ? err.stack : "");
55
+ return c.html(loadingPage(errorMsg), 503);
54
56
  }
55
57
 
56
58
  // WebSocket upgrade
@@ -67,7 +69,10 @@ app.all("*", async (c) => {
67
69
  return response;
68
70
  });
69
71
 
70
- function loadingPage(): string {
72
+ function loadingPage(error?: string): string {
73
+ const errorHtml = error
74
+ ? \`<pre style="margin-top:1rem;padding:1rem;background:#1a1a1a;border:1px solid #333;border-radius:8px;text-align:left;max-width:600px;overflow-x:auto;font-size:0.85rem;color:#f87171">\${error}</pre>\`
75
+ : "";
71
76
  return \`<!DOCTYPE html>
72
77
  <html>
73
78
  <head><title>${projectName} — Starting</title></head>
@@ -75,6 +80,7 @@ function loadingPage(): string {
75
80
  <div style="text-align:center">
76
81
  <h2>Starting ${projectName}...</h2>
77
82
  <p>The agent container is warming up. This page will refresh automatically.</p>
83
+ \${errorHtml}
78
84
  <script>setTimeout(() => location.reload(), 3000)</script>
79
85
  </div>
80
86
  </body>
@@ -1 +1 @@
1
- {"version":3,"file":"worker-index.js","sourceRoot":"","sources":["../../src/templates/worker-index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,UAAU,mBAAmB,CAAC,WAAmB;IACrD,OAAO;KACJ,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;eAgED,WAAW;;;mBAGP,WAAW;;;;;;;;;;;;;;;;;;;;;CAqB7B,CAAC;AACF,CAAC"}
1
+ {"version":3,"file":"worker-index.js","sourceRoot":"","sources":["../../src/templates/worker-index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,UAAU,mBAAmB,CAAC,WAAmB;IACrD,OAAO;KACJ,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;eAqED,WAAW;;;mBAGP,WAAW;;;;;;;;;;;;;;;;;;;;;;CAsB7B,CAAC;AACF,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kya-os/create-molti",
3
- "version": "0.1.0-canary.5",
3
+ "version": "0.1.0-canary.7",
4
4
  "description": "Scaffold a Moltworker project with MCP-I identity",
5
5
  "type": "module",
6
6
  "main": "./dist/helpers/index.js",
@@ -24,7 +24,7 @@ export async function ensureMoltbotGateway(
24
24
  env: Record<string, unknown>
25
25
  ): Promise<void> {
26
26
  // Check for existing process
27
- const processes = await sandbox.ps();
27
+ const processes = await sandbox.listProcesses();
28
28
  const existing = processes.find(
29
29
  (p: { command: string; status: string }) =>
30
30
  (p.command.includes("start-moltbot.sh") || p.command.includes("clawdbot gateway")) &&
@@ -40,7 +40,7 @@ export async function ensureMoltbotGateway(
40
40
  const envVars = buildEnvVars(env);
41
41
 
42
42
  // Start the moltbot process
43
- await sandbox.start("/usr/local/bin/start-moltbot.sh", {
43
+ await sandbox.startProcess("/usr/local/bin/start-moltbot.sh", {
44
44
  env: envVars,
45
45
  });
46
46
 
@@ -34,7 +34,7 @@ publicRoutes.get("/api/status", async (c) => {
34
34
  const sandbox = c.get("sandbox");
35
35
 
36
36
  try {
37
- const processes = await sandbox.ps();
37
+ const processes = await sandbox.listProcesses();
38
38
  const moltbot = processes.find(
39
39
  (p: { command: string; status: string }) =>
40
40
  (p.command.includes("start-moltbot.sh") || p.command.includes("clawdbot gateway")) &&
@@ -48,13 +48,15 @@ publicRoutes.get("/api/status", async (c) => {
48
48
  did: c.env.MCP_IDENTITY_AGENT_DID,
49
49
  },
50
50
  gateway: moltbot
51
- ? { pid: moltbot.pid, status: moltbot.status }
51
+ ? { id: moltbot.id, pid: moltbot.pid, status: moltbot.status }
52
52
  : null,
53
53
  });
54
- } catch {
54
+ } catch (err) {
55
55
  return c.json({
56
56
  status: "unknown",
57
57
  service: "${projectName}",
58
+ error: err instanceof Error ? err.message : String(err),
59
+ stack: err instanceof Error ? err.stack : undefined,
58
60
  });
59
61
  }
60
62
  });
@@ -50,8 +50,10 @@ app.all("*", async (c) => {
50
50
 
51
51
  try {
52
52
  await ensureMoltbotGateway(sandbox, c.env as unknown as MoltbotEnv);
53
- } catch {
54
- return c.html(loadingPage(), 503);
53
+ } catch (err) {
54
+ const errorMsg = err instanceof Error ? err.message : String(err);
55
+ console.error("[Moltworker] Gateway startup failed:", errorMsg, err instanceof Error ? err.stack : "");
56
+ return c.html(loadingPage(errorMsg), 503);
55
57
  }
56
58
 
57
59
  // WebSocket upgrade
@@ -68,7 +70,10 @@ app.all("*", async (c) => {
68
70
  return response;
69
71
  });
70
72
 
71
- function loadingPage(): string {
73
+ function loadingPage(error?: string): string {
74
+ const errorHtml = error
75
+ ? \`<pre style="margin-top:1rem;padding:1rem;background:#1a1a1a;border:1px solid #333;border-radius:8px;text-align:left;max-width:600px;overflow-x:auto;font-size:0.85rem;color:#f87171">\${error}</pre>\`
76
+ : "";
72
77
  return \`<!DOCTYPE html>
73
78
  <html>
74
79
  <head><title>${projectName} — Starting</title></head>
@@ -76,6 +81,7 @@ function loadingPage(): string {
76
81
  <div style="text-align:center">
77
82
  <h2>Starting ${projectName}...</h2>
78
83
  <p>The agent container is warming up. This page will refresh automatically.</p>
84
+ \${errorHtml}
79
85
  <script>setTimeout(() => location.reload(), 3000)</script>
80
86
  </div>
81
87
  </body>