Spaces:
Sleeping
Sleeping
Agent Manager commited on
Commit ·
0d13486
1
Parent(s): ca40e67
Make managed OpenCode startup deterministic
Browse files- Dockerfile +1 -1
- server/default-agent.js +4 -0
- test/default-agent.js +1 -0
Dockerfile
CHANGED
|
@@ -4,7 +4,7 @@ WORKDIR /app
|
|
| 4 |
|
| 5 |
COPY package.json package-lock.json ./
|
| 6 |
RUN npm ci --no-audit --no-fund
|
| 7 |
-
RUN npm install -g opencode-ai@1.18.15 --no-audit --no-fund
|
| 8 |
|
| 9 |
COPY . .
|
| 10 |
RUN npm run build
|
|
|
|
| 4 |
|
| 5 |
COPY package.json package-lock.json ./
|
| 6 |
RUN npm ci --no-audit --no-fund
|
| 7 |
+
RUN npm install -g opencode-ai@1.18.15 @ai-sdk/openai-compatible@3.0.26 --no-audit --no-fund
|
| 8 |
|
| 9 |
COPY . .
|
| 10 |
RUN npm run build
|
server/default-agent.js
CHANGED
|
@@ -259,6 +259,9 @@ export function prepareOpenCode(username) {
|
|
| 259 |
const configPath = path.join(configDir, 'opencode.json')
|
| 260 |
const config = {
|
| 261 |
$schema: 'https://opencode.ai/config.json',
|
|
|
|
|
|
|
|
|
|
| 262 |
model: OPENCODE_MODEL,
|
| 263 |
provider: {
|
| 264 |
'cowrite-hf': {
|
|
@@ -298,6 +301,7 @@ async function runOpenCode(username, accessToken, prompt) {
|
|
| 298 |
XDG_CACHE_HOME: dirs.cacheDir,
|
| 299 |
XDG_STATE_HOME: dirs.stateDir,
|
| 300 |
OPENCODE_CONFIG: dirs.configPath,
|
|
|
|
| 301 |
OPENCODE_ENABLE_EXA: '1',
|
| 302 |
HF_OAUTH_TOKEN: accessToken,
|
| 303 |
}
|
|
|
|
| 259 |
const configPath = path.join(configDir, 'opencode.json')
|
| 260 |
const config = {
|
| 261 |
$schema: 'https://opencode.ai/config.json',
|
| 262 |
+
// A managed, non-interactive worker must never stop at startup to check
|
| 263 |
+
// for or install a newer OpenCode release.
|
| 264 |
+
autoupdate: false,
|
| 265 |
model: OPENCODE_MODEL,
|
| 266 |
provider: {
|
| 267 |
'cowrite-hf': {
|
|
|
|
| 301 |
XDG_CACHE_HOME: dirs.cacheDir,
|
| 302 |
XDG_STATE_HOME: dirs.stateDir,
|
| 303 |
OPENCODE_CONFIG: dirs.configPath,
|
| 304 |
+
OPENCODE_DISABLE_AUTOUPDATE: 'true',
|
| 305 |
OPENCODE_ENABLE_EXA: '1',
|
| 306 |
HF_OAUTH_TOKEN: accessToken,
|
| 307 |
}
|
test/default-agent.js
CHANGED
|
@@ -28,6 +28,7 @@ assert.deepEqual(await pollMentions('Alice', 0, managed, { includeManaged: true
|
|
| 28 |
|
| 29 |
const { configPath } = prepareOpenCode('Alice')
|
| 30 |
const config = JSON.parse(fs.readFileSync(configPath, 'utf8'))
|
|
|
|
| 31 |
assert.equal(config.permission['*'], 'deny')
|
| 32 |
assert.equal(config.permission.websearch, 'allow')
|
| 33 |
assert.equal(config.permission.webfetch, 'deny')
|
|
|
|
| 28 |
|
| 29 |
const { configPath } = prepareOpenCode('Alice')
|
| 30 |
const config = JSON.parse(fs.readFileSync(configPath, 'utf8'))
|
| 31 |
+
assert.equal(config.autoupdate, false)
|
| 32 |
assert.equal(config.permission['*'], 'deny')
|
| 33 |
assert.equal(config.permission.websearch, 'allow')
|
| 34 |
assert.equal(config.permission.webfetch, 'deny')
|