@ghl-ai/aw 0.1.37-beta.34 → 0.1.37-beta.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.
@@ -132,8 +132,8 @@ async function memoryPack(args) {
132
132
 
133
133
  const params = { query };
134
134
  if (args['--namespace']) params.namespace = args['--namespace'];
135
- if (args['--budget']) params.budget = parseInt(args['--budget'], 10);
136
- else params.budget = 3500;
135
+ if (args['--budget']) params.token_budget = parseInt(args['--budget'], 10);
136
+ else params.token_budget = 3500;
137
137
  if (args['--layer']) params.layer = args['--layer'];
138
138
  if (args['--overlay']) params.overlay = args['--overlay'];
139
139
  if (args['--angle']) params.angle = args['--angle'];
package/ecc.mjs CHANGED
@@ -9,7 +9,7 @@ import * as fmt from "./fmt.mjs";
9
9
 
10
10
  const AW_ECC_REPO_SSH = "git@github.com:shreyansh-ghl/aw-ecc.git";
11
11
  const AW_ECC_REPO_HTTPS = "https://github.com/shreyansh-ghl/aw-ecc.git";
12
- const AW_ECC_TAG = "v1.2.9";
12
+ const AW_ECC_TAG = "v1.3.0";
13
13
 
14
14
  const MARKETPLACE_NAME = "aw-marketplace";
15
15
  const PLUGIN_KEY = `aw@${MARKETPLACE_NAME}`;
package/memory-bridge.mjs CHANGED
@@ -1,9 +1,60 @@
1
1
  // memory-bridge.mjs — Bridge between CLI and MCP memory backend (JSON-RPC)
2
2
 
3
- import { MCP_BASE_URL } from './constants.mjs';
3
+ import { execSync } from 'node:child_process';
4
+ import { join } from 'node:path';
5
+ import { MCP_BASE_URL, AW_HOME, REGISTRY_DIR } from './constants.mjs';
6
+ import * as config from './config.mjs';
4
7
 
5
8
  let _rpcId = 1;
6
9
 
10
+ /** Cached headers — resolved once per process. */
11
+ let _cachedHeaders = null;
12
+
13
+ /**
14
+ * Resolve auth + namespace headers for MCP requests.
15
+ * - X-Namespace: from .sync-config.json namespace (team slug → server resolves to team_id)
16
+ * - Authorization: GitHub PAT from GITHUB_TOKEN env or `gh auth token`
17
+ */
18
+ function resolveHeaders() {
19
+ if (_cachedHeaders) return _cachedHeaders;
20
+
21
+ const headers = {
22
+ 'Content-Type': 'application/json',
23
+ 'Accept': 'application/json, text/event-stream',
24
+ };
25
+
26
+ // Resolve namespace from .sync-config.json → X-Namespace header
27
+ const registryDir = join(AW_HOME, REGISTRY_DIR);
28
+ const cfg = config.load(registryDir);
29
+ if (cfg?.namespace) {
30
+ headers['X-Namespace'] = cfg.namespace;
31
+ }
32
+
33
+ // Resolve GitHub token for auth
34
+ const token = process.env.GITHUB_TOKEN || resolveGhToken();
35
+ if (token) {
36
+ headers['Authorization'] = `Bearer ${token}`;
37
+ }
38
+
39
+ _cachedHeaders = headers;
40
+ return headers;
41
+ }
42
+
43
+ /** Try `gh auth token` silently — returns null on failure. */
44
+ function resolveGhToken() {
45
+ try {
46
+ const token = execSync('gh auth token', {
47
+ encoding: 'utf8',
48
+ stdio: ['pipe', 'pipe', 'pipe'],
49
+ timeout: 3000,
50
+ }).trim();
51
+ if (token && (token.startsWith('ghp_') || token.startsWith('gho_') || token.startsWith('github_pat_'))) {
52
+ return token;
53
+ }
54
+ } catch { /* gh not available or not authenticated */ }
55
+ return null;
56
+ }
57
+
7
58
  /**
8
59
  * Call an MCP memory tool by name via JSON-RPC 2.0 (Streamable HTTP).
9
60
  * @param {string} toolName — MCP tool name (e.g. 'memory_curated_store', 'memory_search')
@@ -13,10 +64,7 @@ let _rpcId = 1;
13
64
  export async function callMemoryTool(toolName, params) {
14
65
  const response = await fetch(MCP_BASE_URL, {
15
66
  method: 'POST',
16
- headers: {
17
- 'Content-Type': 'application/json',
18
- 'Accept': 'application/json, text/event-stream',
19
- },
67
+ headers: resolveHeaders(),
20
68
  body: JSON.stringify({
21
69
  jsonrpc: '2.0',
22
70
  id: _rpcId++,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ghl-ai/aw",
3
- "version": "0.1.37-beta.34",
3
+ "version": "0.1.37-beta.35",
4
4
  "description": "Agentic Workspace CLI — pull, push & manage agents, skills and commands from the registry",
5
5
  "type": "module",
6
6
  "bin": "bin.js",