Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions acp.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ it, watch its tool calls and approve them from the editor's agent panel.
## The command

```bash
npx lousho acp agent.yaml # a spec file
npx lousho acp ./my-agent --model openai/gpt-4o # an agent directory, on another model
npx lousho acp src/agent.ts # a .ts/.js module (createAgent() options or an agent)
npx @linuxdevil/lousho acp agent.yaml # a spec file
npx @linuxdevil/lousho acp ./my-agent --model openai/gpt-4o # an agent directory, on another model
npx @linuxdevil/lousho acp src/agent.ts # a .ts/.js module (createAgent() options or an agent)
```

```text
Expand Down Expand Up @@ -122,7 +122,7 @@ It resolves once `input` ends, after aborting any running turn.

```ts
import * as readline from 'node:readline';
import { createAgent, serveAcp } from 'lousho';
import { createAgent, serveAcp } from '@linuxdevil/lousho';

const agent = createAgent({ model: 'openai/gpt-4o-mini', instructions: 'You are a coding assistant.' });

Expand Down
24 changes: 12 additions & 12 deletions agent-directories.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ code at any time without a rewrite.
> implied; the files run with your process's full permissions.

```ts
import { loadAgentDir } from 'lousho';
import { loadAgentDir } from '@linuxdevil/lousho';

const agent = await loadAgentDir('./my-agent');
const { text } = await agent.send('Hello!');
Expand Down Expand Up @@ -111,7 +111,7 @@ rule decides.

```ts
// hooks.ts — the default export is a hook or a list of them
import type { AgentHook } from 'lousho';
import type { AgentHook } from '@linuxdevil/lousho';
const audit: AgentHook = {
name: 'audit',
postToolCall(ctx) {
Expand All @@ -123,7 +123,7 @@ export default audit;

```ts
// approve.ts — the default export decides every `ask`ed call
import type { ApproveToolCall } from 'lousho';
import type { ApproveToolCall } from '@linuxdevil/lousho';
const approve: ApproveToolCall = ({ args }) => !String(args.path ?? '').endsWith('.test.js');
export default approve;
```
Expand All @@ -148,7 +148,7 @@ that exports no tool at all is an error, as are two tools with the same name
```ts
// tools/send_email.ts
import { z } from 'zod';
import { defineTool } from 'lousho';
import { defineTool } from '@linuxdevil/lousho';

export default defineTool({
name: 'send_email',
Expand Down Expand Up @@ -239,7 +239,7 @@ internal helper of the generated bundle); with your own server, use

```ts
import { createServer } from 'node:http';
import { createAgent, mountChannels, resolveAgentDir } from 'lousho';
import { createAgent, mountChannels, resolveAgentDir } from '@linuxdevil/lousho';

// channels/support.ts: export default webhookChannel({ secret: process.env.HOOK_SECRET ?? '' })
const { config, channels } = await resolveAgentDir('./my-agent');
Expand All @@ -262,7 +262,7 @@ naming the file. A `memory` override passed to `loadAgentDir(dir, { overrides })
is merged with the directory's slots by name: the override wins a name clash.

```ts
import { defineMemory, fileMemory, resolveAgentDir } from 'lousho';
import { defineMemory, fileMemory, resolveAgentDir } from '@linuxdevil/lousho';

// memory/notes.ts: export default { scope: 'global', provider: fileMemory({ dir: './.lousho/memory' }) }
const { manifest } = await resolveAgentDir('./my-agent', {
Expand All @@ -276,7 +276,7 @@ A relative `dir` in a `memory/*.ts` file resolves against the process working di
```ts
// memory/notes.ts
import { fileURLToPath } from 'node:url';
import { fileMemory } from 'lousho';
import { fileMemory } from '@linuxdevil/lousho';

export default {
scope: 'global',
Expand All @@ -300,7 +300,7 @@ The path follows the module: a copied or bundled build keeps its memory next to
handy for tests and tooling:

```ts
import { resolveAgentDir, createAgent } from 'lousho';
import { resolveAgentDir, createAgent } from '@linuxdevil/lousho';

const { config, manifest } = await resolveAgentDir('./my-agent');
console.log(manifest.tools, manifest.skills, manifest.subagents);
Expand All @@ -320,8 +320,8 @@ declares (`guardrails`, `onEvent`, `retry`, `reasoning`, `redactContent`,
`output`, ...). Use it to swap the model in tests:

```ts
import { loadAgentDir } from 'lousho';
import { mockModel } from 'lousho/testing';
import { loadAgentDir } from '@linuxdevil/lousho';
import { mockModel } from '@linuxdevil/lousho/testing';

const agent = await loadAgentDir('./my-agent', { provider: mockModel(['Hi there.']) });
```
Expand Down Expand Up @@ -352,7 +352,7 @@ says so. Compile the directory first, or use `.js`/`.mjs` tools with an
## Run it with `lousho dev`

```bash
npx lousho dev ./my-agent
npx @linuxdevil/lousho dev ./my-agent
```

Serves the chat UI and `POST /chat` for the directory and reloads it when
Expand All @@ -371,7 +371,7 @@ dev](/schedules#in-lousho-dev)).
## Deploy it with `lousho build`

```bash
npx lousho build ./my-agent --target=node-server # or docker
npx @linuxdevil/lousho build ./my-agent --target=node-server # or docker
```

The agent directory is the unit of deployment: the built server loads it with
Expand Down
Loading
Loading