@ghl-ai/aw 0.1.38-beta.7 → 0.1.38-beta.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/commands/telemetry.mjs +59 -3
- package/ecc.mjs +1 -1
- package/package.json +1 -1
package/commands/telemetry.mjs
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
// commands/telemetry.mjs — `aw telemetry [enable|disable|status]`
|
|
1
|
+
// commands/telemetry.mjs — `aw telemetry [enable|disable|status|flush-queue]`
|
|
2
2
|
|
|
3
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
4
|
+
import { join } from 'node:path';
|
|
5
|
+
import { homedir } from 'node:os';
|
|
3
6
|
import { enableTelemetry, disableTelemetry, getStatus } from '../telemetry.mjs';
|
|
4
7
|
import * as fmt from '../fmt.mjs';
|
|
5
8
|
import { chalk } from '../fmt.mjs';
|
|
@@ -19,13 +22,66 @@ export async function telemetryCommand(args) {
|
|
|
19
22
|
return;
|
|
20
23
|
}
|
|
21
24
|
|
|
25
|
+
if (sub === 'flush-queue') {
|
|
26
|
+
await flushQueueCommand();
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
|
|
22
30
|
// status (default)
|
|
23
31
|
const status = getStatus();
|
|
24
32
|
fmt.intro('aw telemetry');
|
|
25
33
|
fmt.logStep(`Status: ${status.enabled ? chalk.green('enabled') : chalk.red('disabled')}`);
|
|
26
34
|
fmt.logStep(`Machine ID: ${chalk.dim(status.machine_id)}`);
|
|
27
35
|
fmt.logStep(`Config: ${chalk.dim(status.config_path)}`);
|
|
36
|
+
|
|
37
|
+
// Show queue depth if available
|
|
38
|
+
const queueFile = join(homedir(), '.aw', 'telemetry', 'queue.jsonl');
|
|
39
|
+
if (existsSync(queueFile)) {
|
|
40
|
+
try {
|
|
41
|
+
const lines = readFileSync(queueFile, 'utf8').trim().split('\n').filter(Boolean);
|
|
42
|
+
fmt.logStep(`Queue: ${chalk.yellow(lines.length)} pending prompt(s)`);
|
|
43
|
+
} catch { /* best effort */ }
|
|
44
|
+
}
|
|
45
|
+
|
|
28
46
|
fmt.logMessage('');
|
|
29
|
-
fmt.logMessage(` ${chalk.dim('aw telemetry disable')}
|
|
30
|
-
fmt.logMessage(` ${chalk.dim('aw telemetry enable')}
|
|
47
|
+
fmt.logMessage(` ${chalk.dim('aw telemetry disable')} — opt out of anonymous analytics`);
|
|
48
|
+
fmt.logMessage(` ${chalk.dim('aw telemetry enable')} — re-enable analytics`);
|
|
49
|
+
fmt.logMessage(` ${chalk.dim('aw telemetry flush-queue')} — manually flush pending queue`);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
async function flushQueueCommand() {
|
|
53
|
+
const eccBase = join(homedir(), '.aw-ecc');
|
|
54
|
+
const libPath = join(eccBase, 'scripts', 'hooks', 'capabilities', 'telemetry', 'telemetry-lib.js');
|
|
55
|
+
|
|
56
|
+
if (!existsSync(libPath)) {
|
|
57
|
+
fmt.logWarn('Telemetry library not found. Run aw init first.');
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const {
|
|
62
|
+
readQueue,
|
|
63
|
+
flushQueueToApi,
|
|
64
|
+
getNamespace,
|
|
65
|
+
buildTelemetryHeaders,
|
|
66
|
+
} = await import(libPath);
|
|
67
|
+
|
|
68
|
+
const entries = readQueue();
|
|
69
|
+
if (entries.length === 0) {
|
|
70
|
+
fmt.logSuccess('Queue is empty — nothing to flush.');
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
fmt.logStep(`Flushing ${entries.length} pending prompt(s)...`);
|
|
75
|
+
|
|
76
|
+
const namespace = getNamespace();
|
|
77
|
+
const headers = buildTelemetryHeaders(namespace);
|
|
78
|
+
const result = await flushQueueToApi(headers);
|
|
79
|
+
|
|
80
|
+
if (result.flushed > 0) {
|
|
81
|
+
fmt.logSuccess(`Flushed ${result.flushed} prompt(s) to API.`);
|
|
82
|
+
} else if (result.failed) {
|
|
83
|
+
fmt.logWarn('Flush failed — entries remain in queue for retry.');
|
|
84
|
+
} else {
|
|
85
|
+
fmt.logSuccess('Nothing to flush.');
|
|
86
|
+
}
|
|
31
87
|
}
|
package/ecc.mjs
CHANGED
|
@@ -10,7 +10,7 @@ import { applyStoredStartupPreferences } from "./startup.mjs";
|
|
|
10
10
|
|
|
11
11
|
const AW_ECC_REPO_SSH = "git@github.com:shreyansh-ghl/aw-ecc.git";
|
|
12
12
|
const AW_ECC_REPO_HTTPS = "https://github.com/shreyansh-ghl/aw-ecc.git";
|
|
13
|
-
export const AW_ECC_TAG = "v1.0.
|
|
13
|
+
export const AW_ECC_TAG = "v1.0.5";
|
|
14
14
|
|
|
15
15
|
const MARKETPLACE_NAME = "aw-marketplace";
|
|
16
16
|
const PLUGIN_KEY = `aw@${MARKETPLACE_NAME}`;
|