ag-cortex 0.1.1 → 0.1.2

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.
Files changed (3) hide show
  1. package/README.md +9 -1
  2. package/lib/core.js +41 -7
  3. package/package.json +9 -1
package/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # Antigravity Cortex
2
2
 
3
+ [**Documentation**](https://i3ringit.github.io/antigravity-cortex/) | [**Repository**](https://github.com/i3ringit/antigravity-cortex)
4
+
3
5
  The central "brain" and standard library for Antigravity-powered agents. This package distributes shared **Skills**, **Workflows**, and **Rules** that are injected into project workspaces to ensure consistent, high-quality engineering.
4
6
 
5
7
  ## Architecture
@@ -20,10 +22,16 @@ To add Antigravity Cortex to your project:
20
22
  npm install -D ag-cortex
21
23
 
22
24
  # 2. Initialize the brain
23
- # This copies the assets to your .agent/ directory and creates a tracking manifest.
25
+ # This copies assets to .agent/, creates a manifest, and automatically installs required browser binaries.
24
26
  npx ag-cortex install
25
27
  ```
26
28
 
29
+ > [!NOTE]
30
+ > **Linux Users**: If you encounter errors about missing shared libraries, you likely need to install system dependencies. Run:
31
+ > ```bash
32
+ > sudo npx agent-browser install --with-deps
33
+ > ```
34
+
27
35
  ## Usage
28
36
 
29
37
  ### Updating Assets
package/lib/core.js CHANGED
@@ -1,6 +1,6 @@
1
1
  const fs = require('fs-extra');
2
2
  const path = require('path');
3
- const { execSync } = require('child_process');
3
+ const { spawn } = require('child_process');
4
4
 
5
5
  // Paths
6
6
  const PKG_ROOT = path.resolve(__dirname, '..');
@@ -37,6 +37,21 @@ async function walk(dir, baseDir = dir) {
37
37
  return results;
38
38
  }
39
39
 
40
+
41
+ /**
42
+ * Helper to run commands asynchronously using spawn, avoiding event loop blocking.
43
+ */
44
+ async function spawnCommand(command, args, options = {}) {
45
+ return new Promise((resolve, reject) => {
46
+ const proc = spawn(command, args, { stdio: 'inherit', ...options });
47
+ proc.on('close', code => {
48
+ if (code === 0) resolve();
49
+ else reject(new Error(`Command '${command} ${args.join(' ')}' failed with code ${code}`));
50
+ });
51
+ proc.on('error', reject);
52
+ });
53
+ }
54
+
40
55
  async function install() {
41
56
  const chalk = (await import('chalk')).default;
42
57
  console.log(chalk.blue(`📦 Installing Cortex assets to ${TARGET_AGENT_DIR}...`));
@@ -91,20 +106,39 @@ async function install() {
91
106
 
92
107
  try {
93
108
  if (isLinux) {
94
- console.log(chalk.yellow(` 🐧 Linux detected: Attempting to install system dependencies...`));
95
- console.log(chalk.gray(` (If this fails, you may need to run with sudo)`));
96
- execSync('npx agent-browser install --with-deps', { stdio: 'inherit', cwd: TARGET_ROOT });
109
+ console.log(chalk.yellow(` 🐧 Linux detected.`));
110
+ console.log(chalk.yellow(` ⚠️ To ensure all system dependencies are met for headless browsing, you should run:`));
111
+ console.log(chalk.bold(` sudo npx agent-browser install --with-deps`));
112
+ console.log(chalk.gray(` (Proceeding with basic installation to avoid sudo prompt...)`));
113
+ const npx = process.platform === 'win32' ? 'npx.cmd' : 'npx';
114
+ await spawnCommand(npx, ['agent-browser', 'install'], { cwd: TARGET_ROOT });
97
115
  } else {
98
- execSync('npx agent-browser install', { stdio: 'inherit', cwd: TARGET_ROOT });
116
+ const npx = process.platform === 'win32' ? 'npx.cmd' : 'npx';
117
+ await spawnCommand(npx, ['agent-browser', 'install'], { cwd: TARGET_ROOT });
99
118
  }
100
- console.log(chalk.green(` ✅ Agent Browser installed.`));
119
+
120
+ console.log(chalk.blue(` 🌐 Ensuring correct Playwright browsers are installed...`));
121
+ let pwVersion = 'latest';
122
+ try {
123
+ const pwCorePkg = require('playwright-core/package.json');
124
+ pwVersion = pwCorePkg.version;
125
+ console.log(chalk.gray(` Detected runtime: playwright-core v${pwVersion}`));
126
+ } catch (e) {
127
+ console.warn(chalk.yellow(` Could not resolve playwright-core version, defaulting to 'latest'.`));
128
+ }
129
+
130
+ const npx = process.platform === 'win32' ? 'npx.cmd' : 'npx';
131
+ await spawnCommand(npx, ['--yes', `playwright@${pwVersion}`, 'install', 'chromium', 'chromium-headless-shell'], { cwd: TARGET_ROOT });
132
+
133
+ console.log(chalk.green(` ✅ Agent Browser setup complete.`));
101
134
  } catch (e) {
102
135
  if (isLinux) {
103
136
  console.warn(chalk.yellow(` ⚠️ Automatic setup failed. You likely need sudo for system dependencies.`));
104
137
  console.warn(chalk.bold(` Please run: sudo npx agent-browser install --with-deps`));
105
138
  } else {
106
- console.warn(chalk.yellow(` ⚠️ Agent Browser setup had issues. Try running: npx agent-browser install --with-deps`));
139
+ console.warn(chalk.yellow(` ⚠️ Agent Browser setup had issues.`));
107
140
  }
141
+ console.warn(chalk.bold(` Also ensure browsers are installed: npx playwright install chromium`));
108
142
  }
109
143
  }
110
144
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ag-cortex",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Antigravity Cortex - Agentic Workflow Distribution. The central brain and standard library for Antigravity-powered agents.",
5
5
  "bin": {
6
6
  "ag-cortex": "./bin/ag-cortex.js"
@@ -20,6 +20,14 @@
20
20
  "workflows",
21
21
  "skills"
22
22
  ],
23
+ "homepage": "https://i3ringit.github.io/antigravity-cortex/",
24
+ "repository": {
25
+ "type": "git",
26
+ "url": "git+https://github.com/i3ringit/antigravity-cortex.git"
27
+ },
28
+ "bugs": {
29
+ "url": "https://github.com/i3ringit/antigravity-cortex/issues"
30
+ },
23
31
  "author": "Marcos del Cristo",
24
32
  "license": "MIT",
25
33
  "dependencies": {