@ornexus/neocortex 4.0.1 → 4.0.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 (62) hide show
  1. package/install.ps1 +92 -33
  2. package/install.sh +15 -1
  3. package/package.json +3 -3
  4. package/packages/client/dist/adapters/adapter-registry.js +1 -106
  5. package/packages/client/dist/adapters/antigravity-adapter.js +2 -77
  6. package/packages/client/dist/adapters/claude-code-adapter.js +3 -79
  7. package/packages/client/dist/adapters/codex-adapter.js +2 -80
  8. package/packages/client/dist/adapters/cursor-adapter.js +4 -115
  9. package/packages/client/dist/adapters/gemini-adapter.js +2 -71
  10. package/packages/client/dist/adapters/index.js +1 -21
  11. package/packages/client/dist/adapters/platform-detector.js +1 -106
  12. package/packages/client/dist/adapters/target-adapter.js +0 -12
  13. package/packages/client/dist/adapters/vscode-adapter.js +2 -72
  14. package/packages/client/dist/agent/refresh-stubs.js +2 -234
  15. package/packages/client/dist/agent/update-agent-yaml.js +1 -102
  16. package/packages/client/dist/agent/update-description.js +1 -251
  17. package/packages/client/dist/cache/crypto-utils.js +1 -76
  18. package/packages/client/dist/cache/encrypted-cache.js +1 -94
  19. package/packages/client/dist/cache/in-memory-asset-cache.js +1 -70
  20. package/packages/client/dist/cache/index.js +1 -13
  21. package/packages/client/dist/cli.js +2 -163
  22. package/packages/client/dist/commands/activate.js +8 -390
  23. package/packages/client/dist/commands/cache-status.js +2 -112
  24. package/packages/client/dist/commands/invoke.js +28 -490
  25. package/packages/client/dist/config/resolver-selection.js +1 -278
  26. package/packages/client/dist/config/secure-config.js +12 -269
  27. package/packages/client/dist/constants.js +1 -25
  28. package/packages/client/dist/context/context-collector.js +2 -222
  29. package/packages/client/dist/context/context-sanitizer.js +1 -145
  30. package/packages/client/dist/index.js +1 -38
  31. package/packages/client/dist/license/index.js +1 -5
  32. package/packages/client/dist/license/license-client.js +1 -257
  33. package/packages/client/dist/machine/fingerprint.js +2 -160
  34. package/packages/client/dist/machine/index.js +1 -5
  35. package/packages/client/dist/resilience/circuit-breaker.js +1 -170
  36. package/packages/client/dist/resilience/degradation-manager.js +1 -164
  37. package/packages/client/dist/resilience/freshness-indicator.js +1 -100
  38. package/packages/client/dist/resilience/index.js +1 -8
  39. package/packages/client/dist/resilience/recovery-detector.js +1 -74
  40. package/packages/client/dist/resolvers/asset-resolver.js +0 -13
  41. package/packages/client/dist/resolvers/local-resolver.js +8 -218
  42. package/packages/client/dist/resolvers/remote-resolver.js +1 -282
  43. package/packages/client/dist/telemetry/index.js +1 -5
  44. package/packages/client/dist/telemetry/offline-queue.js +1 -131
  45. package/packages/client/dist/tier/index.js +1 -5
  46. package/packages/client/dist/tier/tier-aware-client.js +1 -260
  47. package/packages/client/dist/types/index.js +1 -38
  48. package/targets-stubs/antigravity/gemini.md +1 -1
  49. package/targets-stubs/antigravity/install-antigravity.sh +49 -3
  50. package/targets-stubs/antigravity/skill/SKILL.md +23 -4
  51. package/targets-stubs/claude-code/neocortex.agent.yaml +19 -1
  52. package/targets-stubs/claude-code/neocortex.md +64 -29
  53. package/targets-stubs/codex/agents.md +20 -3
  54. package/targets-stubs/codex/config-mcp.toml +5 -0
  55. package/targets-stubs/cursor/agent.md +23 -5
  56. package/targets-stubs/cursor/install-cursor.sh +51 -3
  57. package/targets-stubs/cursor/mcp.json +7 -0
  58. package/targets-stubs/gemini-cli/agent.md +37 -6
  59. package/targets-stubs/gemini-cli/install-gemini.sh +50 -17
  60. package/targets-stubs/vscode/agent.md +47 -10
  61. package/targets-stubs/vscode/install-vscode.sh +50 -3
  62. package/targets-stubs/vscode/mcp.json +8 -0
@@ -2,6 +2,55 @@
2
2
  # Neocortex - Cursor IDE Install Adapter (Thin Client)
3
3
  # Simplified installer for npm tarball mode (targets-stubs only)
4
4
 
5
+ # Additive JSON merge for MCP config. Preserves user-defined servers.
6
+ # Uses jq (preferred) or python3 (fallback). On total failure, only creates
7
+ # the file if it does not exist (never overwrites).
8
+ _merge_cursor_mcp() {
9
+ local stub_file="$1"
10
+ local dest_file="$2"
11
+
12
+ if [ ! -f "$dest_file" ]; then
13
+ cp "$stub_file" "$dest_file"
14
+ echo "[CURSOR] Created MCP config: $dest_file"
15
+ return 0
16
+ fi
17
+
18
+ if command -v jq >/dev/null 2>&1; then
19
+ local tmp="${dest_file}.neocortex.tmp"
20
+ if jq -s '.[0] * .[1]' "$dest_file" "$stub_file" > "$tmp" 2>/dev/null; then
21
+ mv "$tmp" "$dest_file"
22
+ echo "[CURSOR] Merged MCP config into: $dest_file (via jq)"
23
+ return 0
24
+ fi
25
+ rm -f "$tmp"
26
+ fi
27
+
28
+ if command -v python3 >/dev/null 2>&1; then
29
+ if python3 - "$dest_file" "$stub_file" <<'PYEOF' 2>/dev/null
30
+ import json, sys
31
+ dest_path, stub_path = sys.argv[1], sys.argv[2]
32
+ with open(dest_path) as f:
33
+ dest = json.load(f)
34
+ with open(stub_path) as f:
35
+ stub = json.load(f)
36
+ dest.setdefault('mcpServers', {})
37
+ for k, v in stub.get('mcpServers', {}).items():
38
+ dest['mcpServers'][k] = v
39
+ with open(dest_path, 'w') as f:
40
+ json.dump(dest, f, indent=2)
41
+ f.write('\n')
42
+ PYEOF
43
+ then
44
+ echo "[CURSOR] Merged MCP config into: $dest_file (via python3)"
45
+ return 0
46
+ fi
47
+ fi
48
+
49
+ echo "[CURSOR] WARN: jq and python3 not found; leaving existing $dest_file untouched"
50
+ echo "[CURSOR] WARN: Stub available at: $stub_file"
51
+ return 0
52
+ }
53
+
5
54
  install_cursor() {
6
55
  local source_dir="${1:?SOURCE_DIR required}"
7
56
  local dest_dir="${2:?DEST_DIR required}"
@@ -23,10 +72,9 @@ install_cursor() {
23
72
  echo "[CURSOR] Installed agent stub: .cursor/agents/neocortex.md"
24
73
  fi
25
74
 
26
- # 2. Copy MCP config
75
+ # 2. Additive merge MCP config (preserves user-configured servers)
27
76
  if [ -f "$cursor_target/mcp.json" ]; then
28
- cp "$cursor_target/mcp.json" "$dest_dir/.cursor/mcp.json"
29
- echo "[CURSOR] Installed MCP config: .cursor/mcp.json"
77
+ _merge_cursor_mcp "$cursor_target/mcp.json" "$dest_dir/.cursor/mcp.json" || true
30
78
  fi
31
79
 
32
80
  echo "[CURSOR] Thin-client installation complete!"
@@ -6,6 +6,13 @@
6
6
  },
7
7
  "context7": {
8
8
  "url": "https://mcp.context7.com/mcp"
9
+ },
10
+ "browser_use": {
11
+ "command": "npx",
12
+ "args": ["-y", "browser-use-mcp"],
13
+ "env": {
14
+ "BROWSER_USE_API_KEY": "${BROWSER_USE_API_KEY}"
15
+ }
9
16
  }
10
17
  }
11
18
  }
@@ -1,13 +1,23 @@
1
1
  ---
2
2
  name: neocortex
3
- description: "🧠 Neocortex v4.0.1 | OrNexus Team"
3
+ description: "🧠 Neocortex v4.0.2 | OrNexus Team"
4
4
  kind: local
5
5
  tools:
6
+ # File operations (Gemini CLI built-ins)
6
7
  - read_file
7
8
  - write_file
8
9
  - replace
10
+ - list_directory
11
+ - glob
12
+ - grep_search
13
+ # Shell access
9
14
  - run_shell_command
10
- - search_file_content
15
+ # Web research (Gemini CLI built-ins)
16
+ - google_web_search
17
+ - web_fetch
18
+ # MCP tools (wildcards grant access to all tools from each connected server)
19
+ - mcp_context7_*
20
+ - mcp_playwright_*
11
21
  model: gemini-2.5-pro
12
22
  max_turns: 50
13
23
  timeout_mins: 30
@@ -43,7 +53,7 @@ SEMPRE que este agente for invocado, imprima o banner abaixo como PRIMEIRO outpu
43
53
  ┌────────────────────────────────────────────────────────────┐
44
54
  │ │
45
55
  │ ####### N E O C O R T E X │
46
- │ ### ######## v4.0.1
56
+ │ ### ######## v4.0.2
47
57
  │ ######### ##### │
48
58
  │ ## ############## Development Orchestrator │
49
59
  │ ## ### ###### ## OrNexus Team │
@@ -95,7 +105,28 @@ neocortex-client invoke \
95
105
 
96
106
  ## Regras
97
107
 
98
- - NUNCA invente logica de orquestracao - toda logica vem do server
99
- - NUNCA pule o thin client - sempre execute o invoke
100
- - SEMPRE siga as instrucoes retornadas literalmente
108
+ ### Orquestracao (triggers `*xxx`)
109
+ - NUNCA invente logica de orquestracao - toda logica de pipeline/step/workflow vem do server
110
+ - NUNCA pule o thin client para argumentos prefixados com `*` - sempre execute `neocortex-client invoke`
111
+ - SEMPRE siga as instrucoes retornadas pelo server literalmente
101
112
  - Se o thin client falhar, mostre o erro e aguarde input do usuario
113
+
114
+ ### Pesquisa livre / analise (sem prefixo `*`)
115
+ Quando o usuario pedir pesquisa, analise, brainstorm, validacao de hipotese, ou qualquer
116
+ tarefa free-form que NAO seja um trigger de orquestracao, voce TEM permissao para usar
117
+ diretamente as tools do Gemini CLI:
118
+
119
+ - **`google_web_search` / `web_fetch`** - pesquisa de mercado, validacao de hipoteses,
120
+ references reais (docs, blogs, repos)
121
+ - **`read_file` / `write_file` / `replace` / `list_directory` / `glob` / `grep_search`** -
122
+ exploracao e manipulacao do projeto local
123
+ - **`run_shell_command`** - qualquer ferramenta CLI (jq, curl, psql, docker, fly, gh, etc.)
124
+ - **`browser_agent`** (built-in subagent do Gemini CLI) - navegacao/screenshot/scraping
125
+ via chrome-devtools-mcp, se habilitado em `~/.gemini/settings.json`
126
+ - **MCP servers configurados** (`mcp_context7_*`, `mcp_playwright_*`) - documentacao
127
+ atualizada de libs/frameworks, browser automation para visual research
128
+
129
+ NUNCA recuse uma pesquisa por falta de tools. NUNCA fabrique fontes - se nao encontrar
130
+ dados reais, diga isso explicitamente. Quando a pesquisa resultar em decisoes que
131
+ precisem virar epic/stories, ai sim invoque `neocortex-client invoke --args "*create-epic ..."`
132
+ para entrar no fluxo de orquestracao.
@@ -2,6 +2,54 @@
2
2
  # Neocortex - Gemini CLI Install Adapter (Thin Client)
3
3
  # Simplified installer for npm tarball mode (targets-stubs only)
4
4
 
5
+ # Additive JSON merge for Gemini CLI settings.json (root key: mcpServers).
6
+ # Preserves user-defined servers and any other settings present.
7
+ _merge_gemini_mcp() {
8
+ local stub_file="$1"
9
+ local dest_file="$2"
10
+
11
+ if [ ! -f "$dest_file" ]; then
12
+ cp "$stub_file" "$dest_file"
13
+ echo "[GEMINI] Created settings: $dest_file"
14
+ return 0
15
+ fi
16
+
17
+ if command -v jq >/dev/null 2>&1; then
18
+ local tmp="${dest_file}.neocortex.tmp"
19
+ if jq -s '.[0] * .[1]' "$dest_file" "$stub_file" > "$tmp" 2>/dev/null; then
20
+ mv "$tmp" "$dest_file"
21
+ echo "[GEMINI] Merged MCP config into: $dest_file (via jq)"
22
+ return 0
23
+ fi
24
+ rm -f "$tmp"
25
+ fi
26
+
27
+ if command -v python3 >/dev/null 2>&1; then
28
+ if python3 - "$dest_file" "$stub_file" <<'PYEOF' 2>/dev/null
29
+ import json, sys
30
+ dest_path, stub_path = sys.argv[1], sys.argv[2]
31
+ with open(dest_path) as f:
32
+ dest = json.load(f)
33
+ with open(stub_path) as f:
34
+ stub = json.load(f)
35
+ dest.setdefault('mcpServers', {})
36
+ for k, v in stub.get('mcpServers', {}).items():
37
+ dest['mcpServers'][k] = v
38
+ with open(dest_path, 'w') as f:
39
+ json.dump(dest, f, indent=2)
40
+ f.write('\n')
41
+ PYEOF
42
+ then
43
+ echo "[GEMINI] Merged MCP config into: $dest_file (via python3)"
44
+ return 0
45
+ fi
46
+ fi
47
+
48
+ echo "[GEMINI] WARN: jq and python3 not found; leaving existing $dest_file untouched"
49
+ echo "[GEMINI] WARN: Stub available at: $stub_file"
50
+ return 0
51
+ }
52
+
5
53
  install_gemini() {
6
54
  local source_dir="${1:?SOURCE_DIR required}"
7
55
  local dest_dir="${2:?DEST_DIR required}"
@@ -30,24 +78,9 @@ install_gemini() {
30
78
  echo "[GEMINI] Installed: GEMINI.md (project root)"
31
79
  fi
32
80
 
33
- # 3. Merge MCP config into settings.json
81
+ # 3. Additive merge MCP config into settings.json
34
82
  if [ -f "$gemini_target/settings-mcp.json" ]; then
35
- local settings_file="$gemini_home/settings.json"
36
- if [ -f "$settings_file" ]; then
37
- if command -v jq >/dev/null 2>&1; then
38
- local mcp_fragment
39
- mcp_fragment=$(cat "$gemini_target/settings-mcp.json")
40
- jq --argjson mcp "$mcp_fragment" '. * $mcp' "$settings_file" > "${settings_file}.tmp"
41
- mv "${settings_file}.tmp" "$settings_file"
42
- echo "[GEMINI] Merged MCP config into ~/.gemini/settings.json"
43
- else
44
- cp "$gemini_target/settings-mcp.json" "$gemini_home/settings-mcp.json"
45
- echo "[GEMINI] WARN: jq not found - copy settings-mcp.json manually"
46
- fi
47
- else
48
- cp "$gemini_target/settings-mcp.json" "$settings_file"
49
- echo "[GEMINI] Created ~/.gemini/settings.json with MCP config"
50
- fi
83
+ _merge_gemini_mcp "$gemini_target/settings-mcp.json" "$gemini_home/settings.json" || true
51
84
  fi
52
85
 
53
86
  echo "[GEMINI] Thin-client installation complete!"
@@ -1,12 +1,24 @@
1
1
  ---
2
2
  name: "neocortex"
3
- description: "🧠 Neocortex v4.0.1 | OrNexus Team"
3
+ description: "🧠 Neocortex v4.0.2 | OrNexus Team"
4
4
  tools:
5
- - readFile
6
- - editFiles
7
- - textSearch
8
- - runInTerminal
9
- - codebase
5
+ # Read / Edit (built-in tool sets)
6
+ - read
7
+ - edit
8
+ # Search codebase, files, usages
9
+ - search
10
+ # Execute commands in terminal
11
+ - execute
12
+ # Web fetch + search
13
+ - web
14
+ # Delegate to subagents
15
+ - agent
16
+ # Todo tracking
17
+ - todos
18
+ # MCP servers (wildcards grant access to all tools from each connected server)
19
+ - context7/*
20
+ - playwright/*
21
+ - browser_use/*
10
22
  agents:
11
23
  - "*"
12
24
  model:
@@ -44,7 +56,7 @@ SEMPRE que este agente for invocado, imprima o banner abaixo como PRIMEIRO outpu
44
56
  ┌────────────────────────────────────────────────────────────┐
45
57
  │ │
46
58
  │ ####### N E O C O R T E X │
47
- │ ### ######## v4.0.1
59
+ │ ### ######## v4.0.2
48
60
  │ ######### ##### │
49
61
  │ ## ############## Development Orchestrator │
50
62
  │ ## ### ###### ## OrNexus Team │
@@ -96,7 +108,32 @@ neocortex-client invoke \
96
108
 
97
109
  ## Regras
98
110
 
99
- - NUNCA invente logica de orquestracao - toda logica vem do server
100
- - NUNCA pule o thin client - sempre execute o invoke
101
- - SEMPRE siga as instrucoes retornadas literalmente
111
+ ### Orquestracao (triggers `*xxx`)
112
+ - NUNCA invente logica de orquestracao - toda logica de pipeline/step/workflow vem do server
113
+ - NUNCA pule o thin client para argumentos prefixados com `*` - sempre execute `neocortex-client invoke`
114
+ - SEMPRE siga as instrucoes retornadas pelo server literalmente
102
115
  - Se o thin client falhar, mostre o erro e aguarde input do usuario
116
+
117
+ ### Pesquisa livre / analise (sem prefixo `*`)
118
+ Quando o usuario pedir pesquisa, analise, brainstorm, validacao de hipotese, ou qualquer
119
+ tarefa free-form que NAO seja um trigger de orquestracao, voce TEM permissao para usar
120
+ diretamente as tools do VS Code / Copilot Chat:
121
+
122
+ - **`search` tool set** (`search/codebase`, `search/fileSearch`, `search/textSearch`,
123
+ `search/usages`) - exploracao e analise do projeto local
124
+ - **`read` tool set** (`read/readFile`, `read/problems`, `read/terminalLastCommand`) -
125
+ leitura de arquivos, problemas e output de terminal
126
+ - **`web` tool set** (`web/fetch`) - pesquisa de mercado, validacao de hipoteses,
127
+ fetching de documentacao oficial
128
+ - **`execute` tool set** (`execute/runInTerminal`, `execute/getTerminalOutput`) -
129
+ qualquer ferramenta CLI (jq, curl, psql, docker, fly, gh, etc.)
130
+ - **`edit` tool set** (`edit/editFiles`, `edit/createFile`, `edit/createDirectory`) -
131
+ manipulacao direta do projeto quando solicitado
132
+ - **`agent` tool set** - delegar trabalho a subagents especializados quando util
133
+ - **MCP servers configurados** (`context7/*`, `playwright/*`, `browser_use/*`) -
134
+ documentacao atualizada, browser automation, visual research
135
+
136
+ NUNCA recuse uma pesquisa por falta de tools. NUNCA fabrique fontes - se nao encontrar
137
+ dados reais, diga isso explicitamente. Quando a pesquisa resultar em decisoes que
138
+ precisem virar epic/stories, ai sim invoque `neocortex-client invoke --args "*create-epic ..."`
139
+ para entrar no fluxo de orquestracao.
@@ -2,6 +2,54 @@
2
2
  # Neocortex - VSCode / GitHub Copilot Install Adapter (Thin Client)
3
3
  # Simplified installer for npm tarball mode (targets-stubs only)
4
4
 
5
+ # Additive JSON merge for VSCode MCP config (uses "servers" key).
6
+ # Preserves user-defined servers. Never overwrites silently.
7
+ _merge_vscode_mcp() {
8
+ local stub_file="$1"
9
+ local dest_file="$2"
10
+
11
+ if [ ! -f "$dest_file" ]; then
12
+ cp "$stub_file" "$dest_file"
13
+ echo "[VSCODE] Created MCP config: $dest_file"
14
+ return 0
15
+ fi
16
+
17
+ if command -v jq >/dev/null 2>&1; then
18
+ local tmp="${dest_file}.neocortex.tmp"
19
+ if jq -s '.[0] * .[1]' "$dest_file" "$stub_file" > "$tmp" 2>/dev/null; then
20
+ mv "$tmp" "$dest_file"
21
+ echo "[VSCODE] Merged MCP config into: $dest_file (via jq)"
22
+ return 0
23
+ fi
24
+ rm -f "$tmp"
25
+ fi
26
+
27
+ if command -v python3 >/dev/null 2>&1; then
28
+ if python3 - "$dest_file" "$stub_file" <<'PYEOF' 2>/dev/null
29
+ import json, sys
30
+ dest_path, stub_path = sys.argv[1], sys.argv[2]
31
+ with open(dest_path) as f:
32
+ dest = json.load(f)
33
+ with open(stub_path) as f:
34
+ stub = json.load(f)
35
+ dest.setdefault('servers', {})
36
+ for k, v in stub.get('servers', {}).items():
37
+ dest['servers'][k] = v
38
+ with open(dest_path, 'w') as f:
39
+ json.dump(dest, f, indent=2)
40
+ f.write('\n')
41
+ PYEOF
42
+ then
43
+ echo "[VSCODE] Merged MCP config into: $dest_file (via python3)"
44
+ return 0
45
+ fi
46
+ fi
47
+
48
+ echo "[VSCODE] WARN: jq and python3 not found; leaving existing $dest_file untouched"
49
+ echo "[VSCODE] WARN: Stub available at: $stub_file"
50
+ return 0
51
+ }
52
+
5
53
  install_vscode() {
6
54
  local source_dir="${1:?SOURCE_DIR required}"
7
55
  local dest_dir="${2:?DEST_DIR required}"
@@ -30,10 +78,9 @@ install_vscode() {
30
78
  echo "[VSCODE] Installed: .github/copilot-instructions.md"
31
79
  fi
32
80
 
33
- # 3. Copy MCP config
81
+ # 3. Additive merge MCP config
34
82
  if [ -f "$vscode_target/mcp.json" ]; then
35
- cp "$vscode_target/mcp.json" "$dest_dir/.vscode/mcp.json"
36
- echo "[VSCODE] Installed MCP config: .vscode/mcp.json"
83
+ _merge_vscode_mcp "$vscode_target/mcp.json" "$dest_dir/.vscode/mcp.json" || true
37
84
  fi
38
85
 
39
86
  echo "[VSCODE] Thin-client installation complete!"
@@ -8,6 +8,14 @@
8
8
  "context7": {
9
9
  "type": "http",
10
10
  "url": "https://mcp.context7.com/mcp"
11
+ },
12
+ "browser_use": {
13
+ "type": "stdio",
14
+ "command": "npx",
15
+ "args": ["-y", "browser-use-mcp"],
16
+ "env": {
17
+ "BROWSER_USE_API_KEY": "${env:BROWSER_USE_API_KEY}"
18
+ }
11
19
  }
12
20
  }
13
21
  }