# @agentos-software/opencode

> **This package is no longer published to npm.** Version 0.4.0 throws an error when imported.

agentOS software now ships as digest-addressed `.aospkg` packages, published with each release under
`https://releases.rivet.dev/agent-os/<version>/software/` (or `latest`). The [`manifest.json`](https://releases.rivet.dev/agent-os/latest/software/manifest.json)
lists each package's name, `sha256:` digest, size, and path. Older `@agentos-software/opencode` versions on npm use an
`.aospkg` format that agentOS 0.4+ rejects.

`opencode` is not part of the agentOS 0.4 software registry. The examples below install `ripgrep`; browse the [registry](https://rivet.dev/agentos/docs/registry) for what is available.

`@rivet-dev/agentos-core` includes a default bundle (coreutils with `sh`, sed, grep, gawk, findutils,
diffutils, tar, gzip) unless you pass `defaultSoftware: false`.

## Library (`@rivet-dev/agentos-core`)

```ts
import { AgentOs } from "@rivet-dev/agentos-core";

const base = "https://releases.rivet.dev/agent-os/latest/software/";
const { artifacts } = await (await fetch(`${base}manifest.json`)).json();
const pkg = artifacts.find((a: { name: string }) => a.name === "ripgrep");

const vm = await AgentOs.create();
await vm.software.install({
	type: "url",
	url: new URL(pkg.path, base).href,
	expectedDigest: pkg.digest,
});
```

You can also pass `{ packagePath }` pointing at a downloaded `.aospkg` file in the VM's `software` option.

## Hosted (`@rivet-dev/agentos`)

```ts
import { createAgentOsClient } from "@rivet-dev/agentos";

const client = createAgentOsClient({ endpoint: "https://api.rivet.dev" });
const vm = client.agentOS.getOrCreate(["my-vm"]);

const base = "https://releases.rivet.dev/agent-os/latest/software/";
const { artifacts } = await (await fetch(`${base}manifest.json`)).json();
const pkg = artifacts.find((a: { name: string }) => a.name === "ripgrep");

const installed = await vm.v1.software.install({
	source: { url: new URL(pkg.path, base).href, digest: pkg.digest },
});
if (installed.config.state === "restart_required") await vm.v1.vm.restart({});
```

Hosted VMs also accept package URLs in their `software` config at creation.

## Docs

- Software: https://rivet.dev/agentos/docs/software
- Registry: https://rivet.dev/agentos/docs/registry
