myaiforone 1.1.34 → 1.1.35
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/.claude/commands/setup.md +2 -0
- package/bin/cli.js +31 -24
- package/dist/web-ui.d.ts.map +1 -1
- package/dist/web-ui.js +71 -28
- package/dist/web-ui.js.map +1 -1
- package/docs/CLAUDE-AI-SETUP.md +26 -0
- package/package.json +1 -1
- package/public/admin.html +13 -4
- package/src/web-ui.ts +67 -29
|
@@ -46,6 +46,8 @@ Check these prerequisites. If any fail, help the user fix them before continuing
|
|
|
46
46
|
|
|
47
47
|
Note: Claude Code CLI is already proven to work — the user is running this wizard inside it. No need to check.
|
|
48
48
|
|
|
49
|
+
**Claude is optional.** If the user says they won't use Claude (they plan to use Venice, Ollama, or another provider), skip any Claude auth steps and continue. They can add provider API keys in Admin → Settings after setup.
|
|
50
|
+
|
|
49
51
|
Detect platform via `process.platform` (darwin = Mac, win32 = Windows, linux = Linux).
|
|
50
52
|
|
|
51
53
|
After checks pass, print:
|
package/bin/cli.js
CHANGED
|
@@ -170,20 +170,7 @@ async function checkClaude() {
|
|
|
170
170
|
}
|
|
171
171
|
|
|
172
172
|
console.log(' Claude Code CLI is installed but not authenticated.');
|
|
173
|
-
|
|
174
|
-
console.log(' A browser window will open — sign in with your Anthropic account.');
|
|
175
|
-
console.log('');
|
|
176
|
-
|
|
177
|
-
try {
|
|
178
|
-
execSync('claude auth login', { stdio: 'inherit' });
|
|
179
|
-
} catch {
|
|
180
|
-
fail(1,
|
|
181
|
-
'Claude Code authentication failed.',
|
|
182
|
-
'Run "claude auth login" manually. You need a Claude Pro/Max subscription or an Anthropic API key.'
|
|
183
|
-
);
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
stepDone(`Claude Code CLI ${version} (authenticated)`);
|
|
173
|
+
await runClaudeAuth(version);
|
|
187
174
|
return;
|
|
188
175
|
}
|
|
189
176
|
|
|
@@ -204,21 +191,41 @@ async function checkClaude() {
|
|
|
204
191
|
const newVersion = run('claude --version', { silent: true }) || 'installed';
|
|
205
192
|
console.log(` Installed Claude Code CLI ${newVersion}`);
|
|
206
193
|
console.log('');
|
|
207
|
-
|
|
194
|
+
await runClaudeAuth(newVersion);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
async function runClaudeAuth(version) {
|
|
208
198
|
console.log(' Running: claude auth login');
|
|
209
|
-
console.log('
|
|
199
|
+
console.log('');
|
|
200
|
+
console.log(' This will either:');
|
|
201
|
+
console.log(' A) Open a browser window automatically — just sign in and come back');
|
|
202
|
+
console.log(' B) Show a URL + ask for a code (common on Windows):');
|
|
203
|
+
console.log(' 1. Copy the URL and open it in your browser');
|
|
204
|
+
console.log(' 2. Sign in and approve access');
|
|
205
|
+
console.log(' 3. Copy the short code shown and paste it back here');
|
|
210
206
|
console.log('');
|
|
211
207
|
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
208
|
+
let authenticated = false;
|
|
209
|
+
while (!authenticated) {
|
|
210
|
+
try {
|
|
211
|
+
execSync('claude auth login', { stdio: 'inherit' });
|
|
212
|
+
authenticated = true;
|
|
213
|
+
} catch {
|
|
214
|
+
console.log('');
|
|
215
|
+
console.log(' Authentication did not complete.');
|
|
216
|
+
const retry = await ask(' Try again? (y/n) ');
|
|
217
|
+
if (retry.toLowerCase() !== 'y') {
|
|
218
|
+
console.log('');
|
|
219
|
+
console.log(' Skipping Claude authentication. You can run "claude auth login" later.');
|
|
220
|
+
console.log('');
|
|
221
|
+
stepDone('Claude Code CLI (skipped auth)');
|
|
222
|
+
return;
|
|
223
|
+
}
|
|
224
|
+
console.log('');
|
|
225
|
+
}
|
|
219
226
|
}
|
|
220
227
|
|
|
221
|
-
stepDone(`Claude Code CLI ${
|
|
228
|
+
stepDone(`Claude Code CLI ${version} (authenticated)`);
|
|
222
229
|
}
|
|
223
230
|
|
|
224
231
|
// ── Step 2: Install dependencies ─────────────────────────────────────────────
|
package/dist/web-ui.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web-ui.d.ts","sourceRoot":"","sources":["../src/web-ui.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAa7C,UAAU,YAAY;IACpB,MAAM,EAAE,SAAS,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,gBAAgB,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACrG,SAAS,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,qBAAqB,EAAE,aAAa,CAAC,CAAC;CACtE;AAyBD,wBAAgB,UAAU,CAAC,IAAI,EAAE,YAAY,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"web-ui.d.ts","sourceRoot":"","sources":["../src/web-ui.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAa7C,UAAU,YAAY;IACpB,MAAM,EAAE,SAAS,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,gBAAgB,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACrG,SAAS,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,qBAAqB,EAAE,aAAa,CAAC,CAAC;CACtE;AAyBD,wBAAgB,UAAU,CAAC,IAAI,EAAE,YAAY,GAAG,IAAI,CA0sLnD"}
|
package/dist/web-ui.js
CHANGED
|
@@ -5294,41 +5294,84 @@ Project context and credentials are at: ${projectDir}/context.md and ${projectDi
|
|
|
5294
5294
|
res.status(500).json({ error: e.message });
|
|
5295
5295
|
}
|
|
5296
5296
|
});
|
|
5297
|
-
// POST /api/update —
|
|
5297
|
+
// POST /api/update — update to latest version and restart
|
|
5298
5298
|
app.post("/api/update", async (_req, res) => {
|
|
5299
5299
|
try {
|
|
5300
5300
|
const platform = process.platform;
|
|
5301
5301
|
log.info("[Update] Platform update triggered via API");
|
|
5302
|
-
//
|
|
5303
|
-
|
|
5304
|
-
|
|
5305
|
-
|
|
5306
|
-
|
|
5307
|
-
|
|
5308
|
-
|
|
5309
|
-
|
|
5310
|
-
|
|
5311
|
-
|
|
5312
|
-
|
|
5302
|
+
// Detect if managed by a system service (launchd on Mac, Task Scheduler on Windows)
|
|
5303
|
+
// These services auto-restart the process when it exits, so we just need to update
|
|
5304
|
+
// the global package and exit — no need to spawn a competing npx process.
|
|
5305
|
+
const launchdPlist = join(homedir(), "Library", "LaunchAgents", "com.agenticledger.channelToAgentToClaude.plist");
|
|
5306
|
+
const isMacService = platform === "darwin" && existsSync(launchdPlist);
|
|
5307
|
+
const isWinService = platform === "win32" &&
|
|
5308
|
+
opts.baseDir.includes("node_modules") &&
|
|
5309
|
+
(opts.baseDir.includes("npm") || opts.baseDir.includes("yarn")) &&
|
|
5310
|
+
!opts.baseDir.includes("_npx");
|
|
5311
|
+
const isManagedService = isMacService || isWinService;
|
|
5312
|
+
// NOTE: We intentionally do NOT delete the npx cache here.
|
|
5313
|
+
// Deleting it before the new version downloads can leave the app with no files at all
|
|
5314
|
+
// if the download fails. npx myaiforone@latest already fetches the latest version from
|
|
5315
|
+
// npm automatically — manual cache clearing is unnecessary and was causing data loss.
|
|
5316
|
+
if (isManagedService) {
|
|
5317
|
+
// Try to update the global package so the service manager restarts with new version
|
|
5318
|
+
log.info(`[Update] Managed service detected (${platform}) — running npm install -g myaiforone@latest`);
|
|
5319
|
+
let globalUpdateOk = false;
|
|
5320
|
+
try {
|
|
5321
|
+
execSync("npm install -g myaiforone@latest", { timeout: 120_000, stdio: "ignore" });
|
|
5322
|
+
log.info("[Update] Global install updated successfully");
|
|
5323
|
+
globalUpdateOk = true;
|
|
5324
|
+
}
|
|
5325
|
+
catch (installErr) {
|
|
5326
|
+
log.warn(`[Update] Global install failed: ${installErr.message}`);
|
|
5327
|
+
}
|
|
5328
|
+
if (globalUpdateOk) {
|
|
5329
|
+
res.json({ ok: true, message: "Updated. Service will restart automatically..." });
|
|
5330
|
+
// Just exit — launchd / Task Scheduler will restart with the updated package
|
|
5331
|
+
setTimeout(() => process.exit(0), 1000);
|
|
5332
|
+
}
|
|
5333
|
+
else if (isMacService) {
|
|
5334
|
+
// Permissions issue — unload launchd so it doesn't restart the old version,
|
|
5335
|
+
// then spawn npx to pull and run the latest
|
|
5336
|
+
res.json({ ok: true, message: "Updating via npx (run `sudo npm install -g myaiforone@latest` in Terminal for faster updates)..." });
|
|
5337
|
+
setTimeout(() => {
|
|
5338
|
+
log.info("[Update] Unloading launchd service before npx spawn...");
|
|
5339
|
+
try {
|
|
5340
|
+
execSync(`launchctl unload "${launchdPlist}"`, { timeout: 5_000, stdio: "ignore" });
|
|
5341
|
+
}
|
|
5342
|
+
catch { }
|
|
5343
|
+
const child = cpSpawn("npx", ["myaiforone@latest"], {
|
|
5344
|
+
cwd: process.cwd(),
|
|
5345
|
+
env: { ...process.env },
|
|
5346
|
+
stdio: "ignore",
|
|
5347
|
+
detached: true,
|
|
5348
|
+
shell: true,
|
|
5349
|
+
});
|
|
5350
|
+
child.unref();
|
|
5351
|
+
process.exit(0);
|
|
5352
|
+
}, 1000);
|
|
5353
|
+
}
|
|
5354
|
+
else {
|
|
5355
|
+
// Windows with no write access — nothing we can do automatically
|
|
5356
|
+
res.json({ ok: false, message: "Update failed: permission denied. Run `npm install -g myaiforone@latest` as Administrator." });
|
|
5313
5357
|
}
|
|
5314
5358
|
}
|
|
5315
5359
|
else {
|
|
5316
|
-
|
|
5317
|
-
|
|
5318
|
-
|
|
5319
|
-
|
|
5320
|
-
|
|
5321
|
-
|
|
5322
|
-
|
|
5323
|
-
|
|
5324
|
-
|
|
5325
|
-
|
|
5326
|
-
|
|
5327
|
-
|
|
5328
|
-
|
|
5329
|
-
|
|
5330
|
-
|
|
5331
|
-
}, 1000);
|
|
5360
|
+
// Running via npx or direct node — clear cache and spawn new process
|
|
5361
|
+
res.json({ ok: true, message: "Clearing cache and restarting with latest version..." });
|
|
5362
|
+
setTimeout(() => {
|
|
5363
|
+
log.info("[Update] Spawning npx myaiforone@latest...");
|
|
5364
|
+
const child = cpSpawn("npx", ["myaiforone@latest"], {
|
|
5365
|
+
cwd: process.cwd(),
|
|
5366
|
+
env: { ...process.env },
|
|
5367
|
+
stdio: "ignore",
|
|
5368
|
+
detached: true,
|
|
5369
|
+
shell: true,
|
|
5370
|
+
});
|
|
5371
|
+
child.unref();
|
|
5372
|
+
process.exit(0);
|
|
5373
|
+
}, 1000);
|
|
5374
|
+
}
|
|
5332
5375
|
}
|
|
5333
5376
|
catch (e) {
|
|
5334
5377
|
res.status(500).json({ error: e.message });
|