@ghl-ai/aw 0.1.38-beta.6 → 0.1.38-beta.8

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.
@@ -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')} — opt out of anonymous analytics`);
30
- fmt.logMessage(` ${chalk.dim('aw telemetry enable')} — re-enable analytics`);
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.1";
13
+ export const AW_ECC_TAG = "v1.0.2";
14
14
 
15
15
  const MARKETPLACE_NAME = "aw-marketplace";
16
16
  const PLUGIN_KEY = `aw@${MARKETPLACE_NAME}`;
@@ -3,6 +3,7 @@ import { join } from 'node:path';
3
3
  import { getSupportedHarnessPhaseEntries } from '../hook-manifest.mjs';
4
4
  import {
5
5
  buildDelegatingPhaseScript,
6
+ buildNodeSilentPhaseScript,
6
7
  buildRegistryDelegatingPhaseScript,
7
8
  buildReservedPhaseScript,
8
9
  } from './shared-phase-scripts.mjs';
@@ -110,10 +111,9 @@ const CODEX_HOME_PHASE_BLUEPRINTS = {
110
111
  scriptName: 'aw-stop.sh',
111
112
  scriptMarker: '# aw-managed: codex-global-stop',
112
113
  buildScriptContent() {
113
- return buildReservedPhaseScript({
114
+ return buildNodeSilentPhaseScript({
114
115
  marker: this.scriptMarker,
115
- phase: 'Stop',
116
- harnessLabel: 'Codex home routing',
116
+ targetPath: '$HOME/.aw-ecc/scripts/hooks/capabilities/telemetry/telemetry-stop.js',
117
117
  });
118
118
  },
119
119
  buildEntry(command) {
@@ -54,6 +54,23 @@ exit 0
54
54
  `;
55
55
  }
56
56
 
57
+ export function buildNodeSilentPhaseScript({
58
+ marker,
59
+ targetPath,
60
+ }) {
61
+ return `#!/usr/bin/env bash
62
+ ${marker}
63
+ set -euo pipefail
64
+
65
+ TARGET="${targetPath}"
66
+ if [[ -f "$TARGET" ]]; then
67
+ node "$TARGET" > /dev/null
68
+ fi
69
+
70
+ exit 0
71
+ `;
72
+ }
73
+
57
74
  export function buildReservedPhaseScript({
58
75
  marker,
59
76
  phase,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ghl-ai/aw",
3
- "version": "0.1.38-beta.6",
3
+ "version": "0.1.38-beta.8",
4
4
  "description": "Agentic Workspace CLI — pull, push & manage agents, skills and commands from the registry",
5
5
  "type": "module",
6
6
  "bin": {