@ghl-ai/aw 0.1.42-beta.22 → 0.1.42-beta.23

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.
@@ -2,7 +2,7 @@ import { join } from 'node:path';
2
2
 
3
3
  import { getSupportedHarnessPhaseEntries } from '../hook-manifest.mjs';
4
4
  import {
5
- buildDelegatingPhaseScript,
5
+ buildRegistryDelegatingPhaseScriptWithTelemetry,
6
6
  buildReservedPhaseScript,
7
7
  } from './shared-phase-scripts.mjs';
8
8
 
@@ -18,39 +18,17 @@ const CODEX_HOME_PHASE_BLUEPRINTS = {
18
18
  scriptName: 'aw-session-start.sh',
19
19
  scriptMarker: '# aw-managed: codex-global-session-start',
20
20
  buildScriptContent() {
21
- return `#!/usr/bin/env bash
22
- ${this.scriptMarker}
23
- set -euo pipefail
24
-
25
- # Capture stdin so we can feed it to both telemetry and the AW router delegate.
26
- STDIN=$(cat)
27
-
28
- # Fire session_start telemetry (non-blocking, all output suppressed).
29
- TELEMETRY_HOOK="$HOME/.aw-ecc/scripts/hooks/aw-usage-session-start.js"
30
- if [[ -f "$TELEMETRY_HOOK" ]] && command -v node >/dev/null 2>&1; then
31
- printf '%s' "$STDIN" | AW_HARNESS=codex node "$TELEMETRY_HOOK" >/dev/null 2>&1 || true
32
- fi
33
-
34
- TARGETS=(
35
- "$HOME/.aw_registry/platform/core/skills/using-aw-skills/hooks/session-start.sh"
36
- "$HOME/.aw/.aw_registry/platform/core/skills/using-aw-skills/hooks/session-start.sh"
37
- )
38
-
39
- for target in "\${TARGETS[@]}"; do
40
- if [[ -f "\$target" ]]; then
41
- printf '%s' "$STDIN" | bash "\$target"
42
- exit $?
43
- fi
44
- done
45
-
46
- CONTEXT="# AW Session Context
47
-
48
- WARNING: AW using-aw-skills hook not found in ~/.aw_registry. Run aw init or aw pull platform."
49
-
50
- JSON_CONTEXT=$(printf '%s' "\$CONTEXT" | python3 -c 'import json, sys; print(json.dumps(sys.stdin.read()))')
51
-
52
- echo "{\\"hookSpecificOutput\\":{\\"hookEventName\\":\\"SessionStart\\",\\"additionalContext\\":\${JSON_CONTEXT}}}"
53
- `;
21
+ return buildRegistryDelegatingPhaseScriptWithTelemetry({
22
+ marker: this.scriptMarker,
23
+ phase: 'SessionStart',
24
+ targetCandidates: [
25
+ '$HOME/.aw_registry/platform/core/skills/using-aw-skills/hooks/session-start.sh',
26
+ '$HOME/.aw/.aw_registry/platform/core/skills/using-aw-skills/hooks/session-start.sh',
27
+ ],
28
+ warningMessage: 'WARNING: AW using-aw-skills hook not found in ~/.aw_registry. Run aw init or aw pull platform.',
29
+ telemetryHookPath: '$HOME/.aw-ecc/scripts/hooks/aw-usage-session-start.js',
30
+ harnessEnv: 'codex',
31
+ });
54
32
  },
55
33
  buildEntry(command) {
56
34
  return {
@@ -37,6 +37,53 @@ echo "{\\"hookSpecificOutput\\":{\\"hookEventName\\":\\"${phase}\\",\\"additiona
37
37
  `;
38
38
  }
39
39
 
40
+ export function buildRegistryDelegatingPhaseScriptWithTelemetry({
41
+ marker,
42
+ phase,
43
+ targetCandidates,
44
+ warningMessage,
45
+ telemetryHookPath,
46
+ harnessEnv,
47
+ }) {
48
+ const targetsBlock = targetCandidates
49
+ .map(target => ` "${target}"`)
50
+ .join('\n');
51
+ const escapedWarning = escapeDoubleQuotes(warningMessage);
52
+
53
+ return `#!/usr/bin/env bash
54
+ ${marker}
55
+ set -euo pipefail
56
+
57
+ # Capture stdin so we can feed it to both telemetry and the AW router delegate.
58
+ STDIN=$(cat)
59
+
60
+ # Fire telemetry (non-blocking, all output suppressed).
61
+ TELEMETRY_HOOK="${telemetryHookPath}"
62
+ if [[ -f "$TELEMETRY_HOOK" ]] && command -v node >/dev/null 2>&1; then
63
+ printf '%s' "$STDIN" | AW_HARNESS=${harnessEnv} node "$TELEMETRY_HOOK" >/dev/null 2>&1 || true
64
+ fi
65
+
66
+ TARGETS=(
67
+ ${targetsBlock}
68
+ )
69
+
70
+ for target in "\${TARGETS[@]}"; do
71
+ if [[ -f "\$target" ]]; then
72
+ printf '%s' "$STDIN" | bash "\$target"
73
+ exit $?
74
+ fi
75
+ done
76
+
77
+ CONTEXT="# AW Session Context
78
+
79
+ ${escapedWarning}"
80
+
81
+ JSON_CONTEXT=$(printf '%s' "\$CONTEXT" | python3 -c 'import json, sys; print(json.dumps(sys.stdin.read()))')
82
+
83
+ echo "{\\"hookSpecificOutput\\":{\\"hookEventName\\":\\"${phase}\\",\\"additionalContext\\":\${JSON_CONTEXT}}}"
84
+ `;
85
+ }
86
+
40
87
  export function buildDelegatingPhaseScript({
41
88
  marker,
42
89
  targetPath,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ghl-ai/aw",
3
- "version": "0.1.42-beta.22",
3
+ "version": "0.1.42-beta.23",
4
4
  "description": "Agentic Workspace CLI — pull, push & manage agents, skills and commands from the registry",
5
5
  "type": "module",
6
6
  "bin": {