Skip to content

Commit 66e6c05

Browse files
committed
Add cli manual and agentic execution to web studio
1 parent a8606e5 commit 66e6c05

32 files changed

Lines changed: 3222 additions & 81 deletions

agent/build.gradle

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
apply plugin: 'java'
2+
3+
buildDir = 'target'
4+
5+
def codexRuntimeDirectory = file("${projectDir}/resources/codex")
6+
def codexPackageJson = file("${codexRuntimeDirectory}/package.json")
7+
def codexPackageLock = file("${codexRuntimeDirectory}/package-lock.json")
8+
def codexNodeModules = file("${codexRuntimeDirectory}/node_modules")
9+
def npmExecutable = System.getProperty('os.name').toLowerCase().contains('windows') ? 'npm.cmd' : 'npm'
10+
11+
sourceSets {
12+
main {
13+
resources {
14+
srcDirs = ['resources']
15+
}
16+
}
17+
}
18+
19+
tasks.register('checkCodexAgentRuntimeTooling') {
20+
group = 'build'
21+
description = 'Check that the Codex agent runtime tooling is available.'
22+
23+
doLast {
24+
if (!codexRuntimeDirectory.isDirectory()) {
25+
throw new GradleException("Missing Codex runtime directory: ${codexRuntimeDirectory}")
26+
}
27+
28+
if (!codexPackageJson.isFile()) {
29+
throw new GradleException("Missing Codex runtime package.json: ${codexPackageJson}")
30+
}
31+
32+
def npmVersionOutput = new ByteArrayOutputStream()
33+
def npmVersionResult = exec {
34+
commandLine npmExecutable, '--version'
35+
workingDir codexRuntimeDirectory
36+
standardOutput = npmVersionOutput
37+
errorOutput = npmVersionOutput
38+
ignoreExitValue = true
39+
}
40+
41+
if (npmVersionResult.exitValue != 0) {
42+
throw new GradleException(
43+
"npm is required to install the Codex agent runtime dependencies. " +
44+
"Checked command '${npmExecutable} --version' and it failed with: ${npmVersionOutput.toString().trim()}"
45+
)
46+
}
47+
}
48+
}
49+
50+
tasks.register('installCodexAgent', Exec) {
51+
group = 'build'
52+
description = 'Install the Codex agent runtime npm dependencies.'
53+
dependsOn tasks.named('checkCodexAgentRuntimeTooling')
54+
workingDir codexRuntimeDirectory
55+
commandLine npmExecutable, 'install'
56+
inputs.file(codexPackageJson)
57+
if (codexPackageLock.exists()) {
58+
inputs.file(codexPackageLock)
59+
}
60+
outputs.dir(codexNodeModules)
61+
}

agent/resources/codex/package-lock.json

Lines changed: 147 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

agent/resources/codex/package.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"name": "testar-codex-runtime",
3+
"private": true,
4+
"type": "module",
5+
"dependencies": {
6+
"@openai/codex-sdk": "0.139.0"
7+
}
8+
}

0 commit comments

Comments
 (0)