diff --git a/AGENTS.md b/AGENTS.md index 37d4130..1f8d51a 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -8,32 +8,11 @@ bare clone with no workspace, the full guide is at ` site also names the current version. -The package targets `x86_64` and `aarch64`; confirm the new tag publishes both -before bumping: +The package targets `x86_64` and `aarch64`. Confirm the new tag publishes both, +and read its manifest-list digest (the top-level `Digest:` line, not a +per-platform one): ```bash -docker manifest inspect ghcr.io/anomalyco/opencode: | jq '.manifests[].platform' +docker buildx imagetools inspect ghcr.io/anomalyco/opencode: ``` ## Applying the bump -1. Edit the `FROM` line in `./Dockerfile` to the new tag: +1. Edit the `FROM` line in `./Dockerfile` to the new tag and its digest: ```dockerfile - FROM ghcr.io/anomalyco/opencode: + FROM ghcr.io/anomalyco/opencode:@sha256: ``` 2. Bump the package version in `startos/versions/current.ts` to match, and add diff --git a/instructions.md b/instructions.md index 4a37a65..fec625e 100644 --- a/instructions.md +++ b/instructions.md @@ -25,14 +25,14 @@ StartOS server. You use it from a browser: 1. On install, the service shows a task: **Set the admin password before signing in**. Run the **Set Admin Password** action and copy the password it returns. The username is always `opencode`. -2. Open the **Web Interface** from the service's Interfaces tab (enable an - address there if none is enabled yet). +2. Open the **Web Interface** from the service's Interfaces tab. 3. On the **Connect to a server** screen, click **Use password**. The server address is already filled in — leave it as it is — paste the password, and click **Connect**. -4. In the web app, open **Settings → Providers** and connect a model provider - (an API key, or your OpenCode Console account). OpenCode can't do anything - until it has a model to use. +4. Choose a model. Out of the box OpenCode uses a free model hosted by + OpenCode, so your prompts and code are sent to OpenCode's servers. To use + your own provider instead, open **Settings → Providers** and connect it (an + API key, or your OpenCode Console account). 5. Back on the home screen, click **Add project** and choose a folder to work in. Pick a folder inside your home directory (`~/…`, shown as `root` when you browse from `/`) — that is where your server keeps data across restarts. diff --git a/startos/actions/setAdminPassword.ts b/startos/actions/setAdminPassword.ts index 1960039..ff72cd2 100644 --- a/startos/actions/setAdminPassword.ts +++ b/startos/actions/setAdminPassword.ts @@ -13,8 +13,6 @@ export const setAdminPassword = sdk.Action.withoutInput( description: i18n( 'Generate a new random password for the OpenCode web interface. Replaces any existing password.', ), - // Confirm before overwriting an existing password; run straight through on - // first set. warning: (await storeJson.read((s) => s.adminPassword).const(effects)) ? i18n('Replaces the current admin password.') : null, diff --git a/startos/backups.ts b/startos/backups.ts index 0150495..1dc3519 100644 --- a/startos/backups.ts +++ b/startos/backups.ts @@ -1,8 +1,5 @@ import { sdk } from './sdk' export const { createBackup, restoreInit } = sdk.setupBackups( - // `main` (the container's home: sessions, credentials, repositories and - // projects) plus `startos` (the generated login password). Restoring the data - // without the password would leave the service locked behind a lost credential. async ({ effects }) => sdk.Backups.ofVolumes('main', 'startos'), ) diff --git a/startos/fileModels/store.json.ts b/startos/fileModels/store.json.ts index 0bd4196..6b5e276 100644 --- a/startos/fileModels/store.json.ts +++ b/startos/fileModels/store.json.ts @@ -2,10 +2,6 @@ import { FileHelper, z } from '@start9labs/start-sdk' import { sdk } from '../sdk' const shape = z.looseObject({ - // The password the OpenCode server requires for the web interface and HTTP - // API. Cleartext because the server reads it from the environment unchanged, - // so it cannot be stored as a hash. It lives on the `startos` volume, which no - // subcontainer mounts, so the service never sees the file itself. adminPassword: z.string().optional().catch(undefined), }) diff --git a/startos/init/watchCredentials.ts b/startos/init/watchCredentials.ts index 58df653..5857eb1 100644 --- a/startos/init/watchCredentials.ts +++ b/startos/init/watchCredentials.ts @@ -3,10 +3,6 @@ import { storeJson } from '../fileModels/store.json' import { i18n } from '../i18n' import { sdk } from '../sdk' -// Reactive watcher: on a fresh install (or if the store is ever cleared) it -// raises a critical task that blocks the service until the user sets a password. -// The task is idempotent on its replay key, so a rebuild after the password is -// set is a no-op. export const watchCredentials = sdk.setupOnInit(async (effects) => { const adminPassword = await storeJson .read((s) => s.adminPassword) diff --git a/startos/interfaces.ts b/startos/interfaces.ts index ba40e7c..88b1a21 100644 --- a/startos/interfaces.ts +++ b/startos/interfaces.ts @@ -3,8 +3,6 @@ import { sdk } from './sdk' import { uiPort } from './utils' export const setInterfaces = sdk.setupInterfaces(async ({ effects }) => { - // One HTTP origin serves both the browser web app (`/`) and the HTTP API - // (`/api/*`), so a single interface covers everything. const uiMulti = sdk.MultiHost.of(effects, 'ui') const uiOrigin = await uiMulti.bindPort(uiPort, { protocol: 'http', @@ -16,7 +14,6 @@ export const setInterfaces = sdk.setupInterfaces(async ({ effects }) => { id: 'ui', description: i18n('The OpenCode web interface and HTTP API'), type: 'ui', - // The URL itself carries no secret; the server gates it with its own login. masked: false, schemeOverride: null, username: null, diff --git a/startos/main.ts b/startos/main.ts index cad401a..a486a5c 100644 --- a/startos/main.ts +++ b/startos/main.ts @@ -4,14 +4,6 @@ import { sdk } from './sdk' import { uiPort } from './utils' export const main = sdk.setupMain(async ({ effects }) => { - // Reactive: when the password changes (set or rotated by the action), the - // daemon spec is rebuilt and the server restarts with the new value. - // - // A missing password is unreachable in normal operation: `watchCredentials` - // raises a critical task on a fresh install or a restore that brought back - // `main` without `startos`, and a critical task blocks the service from - // starting. Throwing rather than substituting a value keeps the failure - // visible and, unlike a generated fallback, produces no restart loop. const adminPassword = await storeJson .read((s) => s.adminPassword) .const(effects) @@ -27,17 +19,12 @@ export const main = sdk.setupMain(async ({ effects }) => { sdk.Mounts.of().mountVolume({ volumeId: 'main', subpath: null, - // The image's HOME is /root, and OpenCode keeps everything — sessions - // database, provider credentials, cloned repositories and the user's - // own projects — under it. Mounting the whole home persists it all. mountpoint: '/root', readonly: false, }), 'opencode-sub', ), exec: { - // The image's entrypoint is the `opencode` binary itself; override only - // the command so it runs the server rather than the interactive TUI. command: sdk.useEntrypoint([ 'serve', '--hostname', @@ -47,7 +34,6 @@ export const main = sdk.setupMain(async ({ effects }) => { ]), env: { OPENCODE_PASSWORD: adminPassword, - // Never let the container try to replace its own binary. OPENCODE_DISABLE_AUTOUPDATE: '1', }, }, diff --git a/startos/manifest/index.ts b/startos/manifest/index.ts index dc57c6f..76f3ffa 100644 --- a/startos/manifest/index.ts +++ b/startos/manifest/index.ts @@ -5,18 +5,14 @@ export const manifest = setupManifest({ id: 'opencode', title: 'OpenCode', license: 'MIT', - packageRepo: 'https://github.com/jonbotx/opencode-startos', + packageRepo: 'https://github.com/Start9-Community/opencode-startos', upstreamRepo: 'https://github.com/anomalyco/opencode', marketingUrl: 'https://opencode.ai', donationUrl: null, description: { short, long }, - // `main` is the container's home directory (sessions, credentials, - // repositories and projects); `startos` holds the generated login password - // and is never mounted into the container. + // `startos` holds the login password and is never mounted into the container. volumes: ['main', 'startos'], images: { - // Built from ./Dockerfile: the upstream image plus the git and bash the - // Alpine base omits (see the Dockerfile for why). opencode: { source: { dockerBuild: {} }, arch: ['x86_64', 'aarch64'], diff --git a/startos/utils.ts b/startos/utils.ts index 23f1d9e..b464446 100644 --- a/startos/utils.ts +++ b/startos/utils.ts @@ -1,4 +1 @@ -// The internal port the OpenCode server binds and that the `ui` interface is -// exported on. Kept in one place so startos/main.ts (which launches it and -// health-checks it) and startos/interfaces.ts (which exposes it) cannot drift. export const uiPort = 4096