@devness/useai 0.8.7 → 0.8.9
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/index.js +50 -31
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -120,6 +120,9 @@ var init_chain = __esm({
|
|
|
120
120
|
});
|
|
121
121
|
|
|
122
122
|
// ../shared/dist/types/config.js
|
|
123
|
+
function getUserMode(config2) {
|
|
124
|
+
return config2.auth?.token ? "cloud" : "local";
|
|
125
|
+
}
|
|
123
126
|
var init_config = __esm({
|
|
124
127
|
"../shared/dist/types/config.js"() {
|
|
125
128
|
"use strict";
|
|
@@ -215,7 +218,7 @@ var VERSION;
|
|
|
215
218
|
var init_version = __esm({
|
|
216
219
|
"../shared/dist/constants/version.js"() {
|
|
217
220
|
"use strict";
|
|
218
|
-
VERSION = "0.8.
|
|
221
|
+
VERSION = "0.8.9";
|
|
219
222
|
}
|
|
220
223
|
});
|
|
221
224
|
|
|
@@ -250,7 +253,7 @@ var init_defaults = __esm({
|
|
|
250
253
|
milestones: true
|
|
251
254
|
};
|
|
252
255
|
DEFAULT_SYNC_CONFIG = {
|
|
253
|
-
enabled:
|
|
256
|
+
enabled: false,
|
|
254
257
|
interval_hours: 1
|
|
255
258
|
};
|
|
256
259
|
DEFAULT_CONFIG = {
|
|
@@ -5112,6 +5115,9 @@ function migrateConfig(raw) {
|
|
|
5112
5115
|
};
|
|
5113
5116
|
}
|
|
5114
5117
|
delete config2.sync.include;
|
|
5118
|
+
if (config2.sync.enabled && !config2.auth?.token) {
|
|
5119
|
+
config2.sync.enabled = false;
|
|
5120
|
+
}
|
|
5115
5121
|
if (!config2.evaluation_framework) {
|
|
5116
5122
|
config2.evaluation_framework = "space";
|
|
5117
5123
|
}
|
|
@@ -6318,6 +6324,7 @@ __export(dist_exports, {
|
|
|
6318
6324
|
generateSessionId: () => generateSessionId,
|
|
6319
6325
|
getFramework: () => getFramework,
|
|
6320
6326
|
getFrameworkIds: () => getFrameworkIds,
|
|
6327
|
+
getUserMode: () => getUserMode,
|
|
6321
6328
|
hasTimeOverlap: () => hasTimeOverlap,
|
|
6322
6329
|
installAutostart: () => installAutostart,
|
|
6323
6330
|
installClaudeCodeHooks: () => installClaudeCodeHooks,
|
|
@@ -33905,7 +33912,8 @@ function registerTools(server2, session2, opts) {
|
|
|
33905
33912
|
session2.inProgressSince = Date.now();
|
|
33906
33913
|
writeMcpMapping(session2.mcpSessionId, session2.sessionId);
|
|
33907
33914
|
const childSuffix = parentSessionId ? ` \xB7 child of ${parentSessionId.slice(0, 8)}` : "";
|
|
33908
|
-
const
|
|
33915
|
+
const mode = config2.auth?.token ? "cloud" : "local";
|
|
33916
|
+
const responseText = `useai session started \u2014 ${session2.sessionTaskType} on ${session2.clientName} \xB7 ${session2.sessionId.slice(0, 8)} \xB7 conv ${session2.conversationId.slice(0, 8)}#${session2.conversationIndex}${childSuffix} \xB7 ${session2.signingAvailable ? "signed" : "unsigned"} \xB7 ${mode}`;
|
|
33909
33917
|
return {
|
|
33910
33918
|
content: [
|
|
33911
33919
|
{
|
|
@@ -34613,6 +34621,7 @@ function handleLocalConfig(_req, res) {
|
|
|
34613
34621
|
const raw = readJson(CONFIG_FILE, {});
|
|
34614
34622
|
const config2 = migrateConfig(raw);
|
|
34615
34623
|
json(res, 200, {
|
|
34624
|
+
mode: config2.auth?.token ? "cloud" : "local",
|
|
34616
34625
|
authenticated: !!config2.auth?.token,
|
|
34617
34626
|
email: config2.auth?.user?.email ?? null,
|
|
34618
34627
|
username: config2.auth?.user?.username ?? null,
|
|
@@ -34628,6 +34637,7 @@ function handleLocalConfigFull(_req, res) {
|
|
|
34628
34637
|
const raw = readJson(CONFIG_FILE, {});
|
|
34629
34638
|
const config2 = migrateConfig(raw);
|
|
34630
34639
|
json(res, 200, {
|
|
34640
|
+
mode: config2.auth?.token ? "cloud" : "local",
|
|
34631
34641
|
capture: config2.capture,
|
|
34632
34642
|
sync: config2.sync,
|
|
34633
34643
|
evaluation_framework: config2.evaluation_framework ?? "space",
|
|
@@ -36315,23 +36325,26 @@ if (!command && process.stdin.isTTY) {
|
|
|
36315
36325
|
}
|
|
36316
36326
|
}
|
|
36317
36327
|
if (command === "update") {
|
|
36328
|
+
const p = await import("@clack/prompts");
|
|
36318
36329
|
const { fetchLatestVersion: fetchLatestVersion2, fetchDaemonHealth: fetchDaemonHealth2, killDaemon: killDaemon2, ensureDaemon: ensureDaemon2, installClaudeCodeHooks: installClaudeCodeHooks2, VERSION: VERSION3 } = await Promise.resolve().then(() => (init_dist(), dist_exports));
|
|
36319
36330
|
const { AI_TOOLS: AI_TOOLS2 } = await Promise.resolve().then(() => (init_tools2(), tools_exports));
|
|
36320
|
-
|
|
36331
|
+
p.intro(import_picocolors2.default.bgCyan(import_picocolors2.default.black(" useai update ")));
|
|
36332
|
+
const checkSpinner = p.spinner();
|
|
36333
|
+
checkSpinner.start("Checking for updates...");
|
|
36321
36334
|
const latest = await fetchLatestVersion2();
|
|
36322
36335
|
if (!latest) {
|
|
36323
|
-
|
|
36336
|
+
checkSpinner.stop("Could not reach npm registry");
|
|
36337
|
+
p.log.error("Failed to check for updates. Please check your network connection.");
|
|
36324
36338
|
process.exit(1);
|
|
36325
36339
|
}
|
|
36326
36340
|
const healthBefore = await fetchDaemonHealth2();
|
|
36327
36341
|
const runningVersion = healthBefore?.version ?? VERSION3;
|
|
36328
36342
|
if (runningVersion === latest && VERSION3 === latest) {
|
|
36329
|
-
|
|
36343
|
+
checkSpinner.stop(`Already up to date (v${latest})`);
|
|
36344
|
+
p.outro("Nothing to do.");
|
|
36330
36345
|
process.exit(0);
|
|
36331
36346
|
}
|
|
36332
|
-
|
|
36333
|
-
console.log(` ${import_picocolors2.default.dim("Latest:")} v${latest}`);
|
|
36334
|
-
console.log();
|
|
36347
|
+
checkSpinner.stop(`Update available: v${runningVersion} \u2192 v${latest}`);
|
|
36335
36348
|
const configuredTools = AI_TOOLS2.filter((t) => {
|
|
36336
36349
|
try {
|
|
36337
36350
|
return t.isConfigured();
|
|
@@ -36339,66 +36352,72 @@ if (command === "update") {
|
|
|
36339
36352
|
return false;
|
|
36340
36353
|
}
|
|
36341
36354
|
});
|
|
36355
|
+
const updateSpinner = p.spinner();
|
|
36342
36356
|
if (configuredTools.length > 0) {
|
|
36343
|
-
|
|
36357
|
+
updateSpinner.start(`Removing MCP configs from ${configuredTools.length} tools...`);
|
|
36344
36358
|
for (const tool of configuredTools) {
|
|
36345
36359
|
try {
|
|
36346
36360
|
tool.remove();
|
|
36347
|
-
console.log(import_picocolors2.default.dim(` \u21BB ${tool.name}`));
|
|
36348
36361
|
} catch {
|
|
36349
|
-
console.log(import_picocolors2.default.red(` \u2717 Failed to remove ${tool.name}`));
|
|
36350
36362
|
}
|
|
36351
36363
|
}
|
|
36352
|
-
|
|
36364
|
+
updateSpinner.stop(`Removed configs from ${configuredTools.length} tools`);
|
|
36353
36365
|
}
|
|
36354
|
-
|
|
36366
|
+
const daemonSpinner = p.spinner();
|
|
36367
|
+
daemonSpinner.start("Stopping daemon and clearing cache...");
|
|
36355
36368
|
await killDaemon2();
|
|
36356
|
-
console.log(import_picocolors2.default.dim(" Clearing npx cache..."));
|
|
36357
36369
|
const { execSync: execSync4 } = await import("child_process");
|
|
36358
36370
|
try {
|
|
36359
36371
|
execSync4("npm cache clean --force", { stdio: "ignore", timeout: 15e3 });
|
|
36360
36372
|
} catch {
|
|
36361
36373
|
}
|
|
36362
|
-
|
|
36374
|
+
daemonSpinner.message("Starting updated daemon...");
|
|
36363
36375
|
const daemonOk = await ensureDaemon2({ preferOnline: true });
|
|
36364
36376
|
if (!daemonOk) {
|
|
36365
|
-
|
|
36366
|
-
|
|
36367
|
-
|
|
36368
|
-
|
|
36377
|
+
daemonSpinner.stop("Failed to start updated daemon");
|
|
36378
|
+
p.note(
|
|
36379
|
+
[
|
|
36380
|
+
"Run in foreground to debug:",
|
|
36381
|
+
` npx @devness/useai daemon --port 19200`
|
|
36382
|
+
].join("\n"),
|
|
36383
|
+
"Troubleshooting"
|
|
36384
|
+
);
|
|
36369
36385
|
process.exit(1);
|
|
36370
36386
|
}
|
|
36371
36387
|
const healthAfter = await fetchDaemonHealth2();
|
|
36372
36388
|
const newVersion = healthAfter?.version ?? "unknown";
|
|
36373
|
-
|
|
36374
|
-
\u2713 Daemon updated: v${runningVersion} \u2192 v${newVersion}`));
|
|
36389
|
+
daemonSpinner.stop(`Daemon updated: v${runningVersion} \u2192 v${newVersion}`);
|
|
36375
36390
|
if (configuredTools.length > 0) {
|
|
36376
|
-
|
|
36391
|
+
const httpOk = [];
|
|
36392
|
+
const stdioOk = [];
|
|
36393
|
+
const failed = [];
|
|
36377
36394
|
for (const tool of configuredTools) {
|
|
36378
36395
|
try {
|
|
36379
36396
|
if (tool.supportsUrl) {
|
|
36380
36397
|
tool.installHttp();
|
|
36381
|
-
|
|
36398
|
+
httpOk.push(tool.name);
|
|
36382
36399
|
} else {
|
|
36383
36400
|
tool.install();
|
|
36384
|
-
|
|
36401
|
+
stdioOk.push(tool.name);
|
|
36385
36402
|
}
|
|
36386
36403
|
} catch {
|
|
36387
|
-
|
|
36404
|
+
failed.push(tool.name);
|
|
36388
36405
|
}
|
|
36389
36406
|
}
|
|
36407
|
+
if (httpOk.length > 0) p.log.success(`HTTP (daemon): ${httpOk.join(", ")}`);
|
|
36408
|
+
if (stdioOk.length > 0) p.log.success(`stdio: ${stdioOk.join(", ")}`);
|
|
36409
|
+
if (failed.length > 0) p.log.error(`Failed: ${failed.join(", ")}`);
|
|
36390
36410
|
}
|
|
36391
36411
|
try {
|
|
36392
36412
|
const hooksInstalled = installClaudeCodeHooks2();
|
|
36393
36413
|
if (hooksInstalled) {
|
|
36394
|
-
|
|
36414
|
+
p.log.success("Claude Code hooks reinstalled");
|
|
36395
36415
|
}
|
|
36396
36416
|
} catch {
|
|
36397
36417
|
}
|
|
36398
|
-
|
|
36399
|
-
|
|
36400
|
-
|
|
36401
|
-
`));
|
|
36418
|
+
const dashboard = `
|
|
36419
|
+
Dashboard \u2192 ${import_picocolors2.default.cyan("http://127.0.0.1:19200/dashboard")}`;
|
|
36420
|
+
p.outro(`UseAI updated to v${newVersion} in ${import_picocolors2.default.bold(String(configuredTools.length))} tool${configuredTools.length === 1 ? "" : "s"}.${dashboard}`);
|
|
36402
36421
|
process.exit(0);
|
|
36403
36422
|
}
|
|
36404
36423
|
if (command === "daemon") {
|